@gyng/remote-zip 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,7 +17,7 @@ Without downloading the entire ZIP:
17
17
  The gist of what the library does is:
18
18
 
19
19
  1. Get the content size of the ZIP file using a HTTP HEAD request.
20
- 2. Get the last 100 bytes using HTTP Range queries (hoping it's enough) to read the end-of-central-directory (EOCD) section.
20
+ 2. Range-fetch the archive tail, widening up to the maximum EOCD comment size when needed.
21
21
  3. Using the EOCD, read the central directory (CD) section with a Range request. This section contains a complete file listing and file byte offsets in the ZIP.
22
22
  4. To get individual files, use another Range request with an offset to get the local file header + compressed data.
23
23
 
@@ -26,6 +26,9 @@ The gist of what the library does is:
26
26
  - PKWare _strong_ encryption (general-purpose bit 6) is detected and rejected
27
27
  - Multi-disk / split archives are not supported
28
28
 
29
+ Range responses are validated against `Content-Range`; servers that ignore Range
30
+ requests are rejected instead of causing a whole-archive download.
31
+
29
32
  > Decrypting WinZip AES entries uses the Web Crypto API (`crypto.subtle`), which
30
33
  > in browsers is only available in a secure context (HTTPS or `localhost`).
31
34
  > Traditional ZipCrypto works everywhere but is cryptographically weak.
@@ -123,7 +126,7 @@ Requires Node >= 22.
123
126
  npm ci # install (reproducible, honours .npmrc cooldown)
124
127
  npm run d # watch and build
125
128
  npm run t:watch # watch and test
126
- npm run lint # prettier + eslint
129
+ npm run lint # oxfmt + type-aware oxlint
127
130
  npm run typecheck # tsc --noEmit (also checks tests)
128
131
  npm run build # type declarations + esm/cjs bundles
129
132
  npm test # run the test suite once
@@ -131,23 +134,6 @@ npm test # run the test suite once
131
134
 
132
135
  ### Publish
133
136
 
134
- #### Setup
135
-
136
- 1. Get an automation token from npm under settings
137
-
138
- ```
139
- https://www.npmjs.com/settings/$YOUR_USERNAME/tokens/
140
- ```
141
-
142
- 2. Add the token to your repository secrets.
143
-
144
- ```
145
- https://github.com/$YOUR_USERNAME/$YOUR_REPO_NAME/settings/secrets/actions/new
146
- ```
147
-
148
- - Name: `NPM_TOKEN`
149
- - Value: The automation token you got from the previous step
150
-
151
137
  #### Run
152
138
 
153
139
  1. Create a new release.
@@ -156,7 +142,10 @@ npm test # run the test suite once
156
142
  https://github.com/$YOUR_USERNAME/$YOUR_REPO_NAME/releases
157
143
  ```
158
144
 
159
- The workflow at `./github/workflows/publish.yml` should run and publish your packages to both NPM and GitHub Packages.
145
+ The workflow at `.github/workflows/publish.yml` publishes to npm through
146
+ Trusted Publishing (OIDC), attests the bundles, and publishes to GitHub
147
+ Packages. The npm package must have this repository configured as a Trusted
148
+ Publisher.
160
149
 
161
150
  Don't forget to bump your version number in `package.json` before this.
162
151
  </details>
package/lib/cjs/index.js CHANGED
@@ -1,7 +1,2 @@
1
- "use strict";var at=Object.defineProperty;var vi=Object.getOwnPropertyDescriptor;var Si=Object.getOwnPropertyNames;var Di=Object.prototype.hasOwnProperty;var Ri=(e,n)=>{for(var t in n)at(e,t,{get:n[t],enumerable:!0})},Ui=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Si(n))!Di.call(e,r)&&r!==t&&at(e,r,{get:()=>n[r],enumerable:!(i=vi(n,r))||i.enumerable});return e};var Oi=e=>Ui(at({},"__esModule",{value:!0}),e);var Ro={};Ri(Ro,{RemoteZip:()=>it,RemoteZipError:()=>R,RemoteZipPointer:()=>Ft,crc32:()=>nt,decodeZipString:()=>rt,isZip64:()=>wi,parseAllCDs:()=>Ei,parseOneCD:()=>Ai,parseOneEOCD:()=>ki,parseOneLocalFile:()=>Ht,parseZip64EOCD:()=>mi,parseZip64EOCDLocator:()=>xi,parseZipDatetime:()=>Pt});module.exports=Oi(Ro);function ge(e){let n=e.length;for(;--n>=0;)e[n]=0}var Ii=0,Rn=1,zi=2,Ci=3,Ti=258,Ut=29,Ce=256,ve=Ce+1+Ut,_e=30,Ot=19,Un=2*ve+1,te=15,ot=16,Ni=7,It=256,On=16,In=17,zn=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]),Ye=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]),Li=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Cn=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zi=512,q=new Array((ve+2)*2);ge(q);var Ee=new Array(_e*2);ge(Ee);var Se=new Array(Zi);ge(Se);var De=new Array(Ti-Ci+1);ge(De);var zt=new Array(Ut);ge(zt);var We=new Array(_e);ge(We);function st(e,n,t,i,r){this.static_tree=e,this.extra_bits=n,this.extra_base=t,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}var Tn,Nn,Ln;function lt(e,n){this.dyn_tree=e,this.max_code=0,this.stat_desc=n}var Zn=e=>e<256?Se[e]:Se[256+(e>>>7)],Re=(e,n)=>{e.pending_buf[e.pending++]=n&255,e.pending_buf[e.pending++]=n>>>8&255},N=(e,n,t)=>{e.bi_valid>ot-t?(e.bi_buf|=n<<e.bi_valid&65535,Re(e,e.bi_buf),e.bi_buf=n>>ot-e.bi_valid,e.bi_valid+=t-ot):(e.bi_buf|=n<<e.bi_valid&65535,e.bi_valid+=t)},P=(e,n,t)=>{N(e,t[n*2],t[n*2+1])},Mn=(e,n)=>{let t=0;do t|=e&1,e>>>=1,t<<=1;while(--n>0);return t>>>1},Mi=e=>{e.bi_valid===16?(Re(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Fi=(e,n)=>{let t=n.dyn_tree,i=n.max_code,r=n.stat_desc.static_tree,a=n.stat_desc.has_stree,l=n.stat_desc.extra_bits,s=n.stat_desc.extra_base,c=n.stat_desc.max_length,o,f,g,_,d,u,E=0;for(_=0;_<=te;_++)e.bl_count[_]=0;for(t[e.heap[e.heap_max]*2+1]=0,o=e.heap_max+1;o<Un;o++)f=e.heap[o],_=t[t[f*2+1]*2+1]+1,_>c&&(_=c,E++),t[f*2+1]=_,!(f>i)&&(e.bl_count[_]++,d=0,f>=s&&(d=l[f-s]),u=t[f*2],e.opt_len+=u*(_+d),a&&(e.static_len+=u*(r[f*2+1]+d)));if(E!==0){do{for(_=c-1;e.bl_count[_]===0;)_--;e.bl_count[_]--,e.bl_count[_+1]+=2,e.bl_count[c]--,E-=2}while(E>0);for(_=c;_!==0;_--)for(f=e.bl_count[_];f!==0;)g=e.heap[--o],!(g>i)&&(t[g*2+1]!==_&&(e.opt_len+=(_-t[g*2+1])*t[g*2],t[g*2+1]=_),f--)}},Fn=(e,n,t)=>{let i=new Array(te+1),r=0,a,l;for(a=1;a<=te;a++)r=r+t[a-1]<<1,i[a]=r;for(l=0;l<=n;l++){let s=e[l*2+1];s!==0&&(e[l*2]=Mn(i[s]++,s))}},Hi=()=>{let e,n,t,i,r,a=new Array(te+1);for(t=0,i=0;i<Ut-1;i++)for(zt[i]=t,e=0;e<1<<mt[i];e++)De[t++]=i;for(De[t-1]=i,r=0,i=0;i<16;i++)for(We[i]=r,e=0;e<1<<Ye[i];e++)Se[r++]=i;for(r>>=7;i<_e;i++)for(We[i]=r<<7,e=0;e<1<<Ye[i]-7;e++)Se[256+r++]=i;for(n=0;n<=te;n++)a[n]=0;for(e=0;e<=143;)q[e*2+1]=8,e++,a[8]++;for(;e<=255;)q[e*2+1]=9,e++,a[9]++;for(;e<=279;)q[e*2+1]=7,e++,a[7]++;for(;e<=287;)q[e*2+1]=8,e++,a[8]++;for(Fn(q,ve+1,a),e=0;e<_e;e++)Ee[e*2+1]=5,Ee[e*2]=Mn(e,5);Tn=new st(q,mt,Ce+1,ve,te),Nn=new st(Ee,Ye,0,_e,te),Ln=new st(new Array(0),Li,0,Ot,Ni)},Hn=e=>{let n;for(n=0;n<ve;n++)e.dyn_ltree[n*2]=0;for(n=0;n<_e;n++)e.dyn_dtree[n*2]=0;for(n=0;n<Ot;n++)e.bl_tree[n*2]=0;e.dyn_ltree[It*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Pn=e=>{e.bi_valid>8?Re(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},$t=(e,n,t,i)=>{let r=n*2,a=t*2;return e[r]<e[a]||e[r]===e[a]&&i[n]<=i[t]},ft=(e,n,t)=>{let i=e.heap[t],r=t<<1;for(;r<=e.heap_len&&(r<e.heap_len&&$t(n,e.heap[r+1],e.heap[r],e.depth)&&r++,!$t(n,i,e.heap[r],e.depth));)e.heap[t]=e.heap[r],t=r,r<<=1;e.heap[t]=i},Kt=(e,n,t)=>{let i,r,a=0,l,s;if(e.sym_next!==0)do i=e.pending_buf[e.sym_buf+a++]&255,i+=(e.pending_buf[e.sym_buf+a++]&255)<<8,r=e.pending_buf[e.sym_buf+a++],i===0?P(e,r,n):(l=De[r],P(e,l+Ce+1,n),s=mt[l],s!==0&&(r-=zt[l],N(e,r,s)),i--,l=Zn(i),P(e,l,t),s=Ye[l],s!==0&&(i-=We[l],N(e,i,s)));while(a<e.sym_next);P(e,It,n)},yt=(e,n)=>{let t=n.dyn_tree,i=n.stat_desc.static_tree,r=n.stat_desc.has_stree,a=n.stat_desc.elems,l,s,c=-1,o;for(e.heap_len=0,e.heap_max=Un,l=0;l<a;l++)t[l*2]!==0?(e.heap[++e.heap_len]=c=l,e.depth[l]=0):t[l*2+1]=0;for(;e.heap_len<2;)o=e.heap[++e.heap_len]=c<2?++c:0,t[o*2]=1,e.depth[o]=0,e.opt_len--,r&&(e.static_len-=i[o*2+1]);for(n.max_code=c,l=e.heap_len>>1;l>=1;l--)ft(e,t,l);o=a;do l=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ft(e,t,1),s=e.heap[1],e.heap[--e.heap_max]=l,e.heap[--e.heap_max]=s,t[o*2]=t[l*2]+t[s*2],e.depth[o]=(e.depth[l]>=e.depth[s]?e.depth[l]:e.depth[s])+1,t[l*2+1]=t[s*2+1]=o,e.heap[1]=o++,ft(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Fi(e,n),Fn(t,c,e.bl_count)},Gt=(e,n,t)=>{let i,r=-1,a,l=n[1],s=0,c=7,o=4;for(l===0&&(c=138,o=3),n[(t+1)*2+1]=65535,i=0;i<=t;i++)a=l,l=n[(i+1)*2+1],!(++s<c&&a===l)&&(s<o?e.bl_tree[a*2]+=s:a!==0?(a!==r&&e.bl_tree[a*2]++,e.bl_tree[On*2]++):s<=10?e.bl_tree[In*2]++:e.bl_tree[zn*2]++,s=0,r=a,l===0?(c=138,o=3):a===l?(c=6,o=3):(c=7,o=4))},qt=(e,n,t)=>{let i,r=-1,a,l=n[1],s=0,c=7,o=4;for(l===0&&(c=138,o=3),i=0;i<=t;i++)if(a=l,l=n[(i+1)*2+1],!(++s<c&&a===l)){if(s<o)do P(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==r&&(P(e,a,e.bl_tree),s--),P(e,On,e.bl_tree),N(e,s-3,2)):s<=10?(P(e,In,e.bl_tree),N(e,s-3,3)):(P(e,zn,e.bl_tree),N(e,s-11,7));s=0,r=a,l===0?(c=138,o=3):a===l?(c=6,o=3):(c=7,o=4)}},Pi=e=>{let n;for(Gt(e,e.dyn_ltree,e.l_desc.max_code),Gt(e,e.dyn_dtree,e.d_desc.max_code),yt(e,e.bl_desc),n=Ot-1;n>=3&&e.bl_tree[Cn[n]*2+1]===0;n--);return e.opt_len+=3*(n+1)+5+5+4,n},Bi=(e,n,t,i)=>{let r;for(N(e,n-257,5),N(e,t-1,5),N(e,i-4,4),r=0;r<i;r++)N(e,e.bl_tree[Cn[r]*2+1],3);qt(e,e.dyn_ltree,n-1),qt(e,e.dyn_dtree,t-1)},$i=e=>{let n=4093624447,t;for(t=0;t<=31;t++,n>>>=1)if(n&1&&e.dyn_ltree[t*2]!==0)return 0;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return 1;for(t=32;t<Ce;t++)if(e.dyn_ltree[t*2]!==0)return 1;return 0},Xt=!1,Ki=e=>{Xt||(Hi(),Xt=!0),e.l_desc=new lt(e.dyn_ltree,Tn),e.d_desc=new lt(e.dyn_dtree,Nn),e.bl_desc=new lt(e.bl_tree,Ln),e.bi_buf=0,e.bi_valid=0,Hn(e)},Bn=(e,n,t,i)=>{N(e,(Ii<<1)+(i?1:0),3),Pn(e),Re(e,t),Re(e,~t),t&&e.pending_buf.set(e.window.subarray(n,n+t),e.pending),e.pending+=t},Gi=e=>{N(e,Rn<<1,3),P(e,It,q),Mi(e)},qi=(e,n,t,i)=>{let r,a,l=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=$i(e)),yt(e,e.l_desc),yt(e,e.d_desc),l=Pi(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=t+5,t+4<=r&&n!==-1?Bn(e,n,t,i):e.strategy===4||a===r?(N(e,(Rn<<1)+(i?1:0),3),Kt(e,q,Ee)):(N(e,(zi<<1)+(i?1:0),3),Bi(e,e.l_desc.max_code+1,e.d_desc.max_code+1,l+1),Kt(e,e.dyn_ltree,e.dyn_dtree)),Hn(e),i&&Pn(e)},Xi=(e,n,t)=>(e.pending_buf[e.sym_buf+e.sym_next++]=n,e.pending_buf[e.sym_buf+e.sym_next++]=n>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,n===0?e.dyn_ltree[t*2]++:(e.matches++,n--,e.dyn_ltree[(De[t]+Ce+1)*2]++,e.dyn_dtree[Zn(n)*2]++),e.sym_next===e.sym_end),Yi=Ki,Wi=Bn,Vi=qi,ji=Xi,Ji=Gi,Qi={_tr_init:Yi,_tr_stored_block:Wi,_tr_flush_block:Vi,_tr_tally:ji,_tr_align:Ji},er=(e,n,t,i)=>{let r=e&65535|0,a=e>>>16&65535|0,l=0;for(;t!==0;){l=t>2e3?2e3:t,t-=l;do r=r+n[i++]|0,a=a+r|0;while(--l);r%=65521,a%=65521}return r|a<<16|0},Ue=er,tr=()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;n[t]=e}return n},nr=new Uint32Array(tr()),ir=(e,n,t,i)=>{let r=nr,a=i+t;e^=-1;for(let l=i;l<a;l++)e=e>>>8^r[(e^n[l])&255];return e^-1},z=ir,re={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"},be={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:rr,_tr_stored_block:Et,_tr_flush_block:ar,_tr_tally:j,_tr_align:or}=Qi,{Z_NO_FLUSH:J,Z_PARTIAL_FLUSH:sr,Z_FULL_FLUSH:lr,Z_FINISH:M,Z_BLOCK:Yt,Z_OK:C,Z_STREAM_END:Wt,Z_STREAM_ERROR:B,Z_DATA_ERROR:fr,Z_BUF_ERROR:ct,Z_DEFAULT_COMPRESSION:cr,Z_FILTERED:dr,Z_HUFFMAN_ONLY:$e,Z_RLE:_r,Z_FIXED:hr,Z_DEFAULT_STRATEGY:ur,Z_UNKNOWN:gr,Z_DEFLATED:Je}=be,br=9,wr=15,pr=8,xr=29,mr=256,At=mr+1+xr,yr=30,Er=19,Ar=2*At+1,kr=15,k=3,V=258,$=V+k+1,vr=32,he=42,Ct=57,kt=69,vt=73,St=91,Dt=103,ne=113,me=666,T=1,we=2,ae=3,pe=4,Sr=3,ie=(e,n)=>(e.msg=re[n],n),Vt=e=>e*2-(e>4?9:0),W=e=>{let n=e.length;for(;--n>=0;)e[n]=0},Dr=e=>{let n,t,i,r=e.w_size;n=e.hash_size,i=n;do t=e.head[--i],e.head[i]=t>=r?t-r:0;while(--n);n=r,i=n;do t=e.prev[--i],e.prev[i]=t>=r?t-r:0;while(--n)},Rr=(e,n,t)=>(n<<e.hash_shift^t)&e.hash_mask,Q=Rr,L=e=>{let n=e.state,t=n.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(n.pending_buf.subarray(n.pending_out,n.pending_out+t),e.next_out),e.next_out+=t,n.pending_out+=t,e.total_out+=t,e.avail_out-=t,n.pending-=t,n.pending===0&&(n.pending_out=0))},Z=(e,n)=>{ar(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,n),e.block_start=e.strstart,L(e.strm)},D=(e,n)=>{e.pending_buf[e.pending++]=n},xe=(e,n)=>{e.pending_buf[e.pending++]=n>>>8&255,e.pending_buf[e.pending++]=n&255},Rt=(e,n,t,i)=>{let r=e.avail_in;return r>i&&(r=i),r===0?0:(e.avail_in-=r,n.set(e.input.subarray(e.next_in,e.next_in+r),t),e.state.wrap===1?e.adler=Ue(e.adler,n,r,t):e.state.wrap===2&&(e.adler=z(e.adler,n,r,t)),e.next_in+=r,e.total_in+=r,r)},$n=(e,n)=>{let t=e.max_chain_length,i=e.strstart,r,a,l=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-$?e.strstart-(e.w_size-$):0,o=e.window,f=e.w_mask,g=e.prev,_=e.strstart+V,d=o[i+l-1],u=o[i+l];e.prev_length>=e.good_match&&(t>>=2),s>e.lookahead&&(s=e.lookahead);do if(r=n,!(o[r+l]!==u||o[r+l-1]!==d||o[r]!==o[i]||o[++r]!==o[i+1])){i+=2,r++;do;while(o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&i<_);if(a=V-(_-i),i=_-V,a>l){if(e.match_start=n,l=a,a>=s)break;d=o[i+l-1],u=o[i+l]}}while((n=g[n&f])>c&&--t!==0);return l<=e.lookahead?l:e.lookahead},ue=e=>{let n=e.w_size,t,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-$)&&(e.window.set(e.window.subarray(n,n+n-i),0),e.match_start-=n,e.strstart-=n,e.block_start-=n,e.insert>e.strstart&&(e.insert=e.strstart),Dr(e),i+=n),e.strm.avail_in===0)break;if(t=Rt(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=t,e.lookahead+e.insert>=k)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=Q(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Q(e,e.ins_h,e.window[r+k-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<k)););}while(e.lookahead<$&&e.strm.avail_in!==0)},Kn=(e,n)=>{let t=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,i,r,a,l=0,s=e.strm.avail_in;do{if(i=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,r=e.strstart-e.block_start,i>r+e.strm.avail_in&&(i=r+e.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&n!==M||n===J||i!==r+e.strm.avail_in)))break;l=n===M&&i===r+e.strm.avail_in?1:0,Et(e,0,0,l),e.pending_buf[e.pending-4]=i,e.pending_buf[e.pending-3]=i>>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,L(e.strm),r&&(r>i&&(r=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,i-=r),i&&(Rt(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(l===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),l?pe:n!==J&&n!==M&&e.strm.avail_in===0&&e.strstart===e.block_start?we:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Rt(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,t=a>e.w_size?e.w_size:a,r=e.strstart-e.block_start,(r>=t||(r||n===M)&&n!==J&&e.strm.avail_in===0&&r<=a)&&(i=r>a?a:r,l=n===M&&e.strm.avail_in===0&&i===r?1:0,Et(e,e.block_start,i,l),e.block_start+=i,L(e.strm)),l?ae:T)},dt=(e,n)=>{let t,i;for(;;){if(e.lookahead<$){if(ue(e),e.lookahead<$&&n===J)return T;if(e.lookahead===0)break}if(t=0,e.lookahead>=k&&(e.ins_h=Q(e,e.ins_h,e.window[e.strstart+k-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),t!==0&&e.strstart-t<=e.w_size-$&&(e.match_length=$n(e,t)),e.match_length>=k)if(i=j(e,e.strstart-e.match_start,e.match_length-k),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=k){e.match_length--;do e.strstart++,e.ins_h=Q(e,e.ins_h,e.window[e.strstart+k-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Q(e,e.ins_h,e.window[e.strstart+1]);else i=j(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Z(e,!1),e.strm.avail_out===0))return T}return e.insert=e.strstart<k-1?e.strstart:k-1,n===M?(Z(e,!0),e.strm.avail_out===0?ae:pe):e.sym_next&&(Z(e,!1),e.strm.avail_out===0)?T:we},ce=(e,n)=>{let t,i,r;for(;;){if(e.lookahead<$){if(ue(e),e.lookahead<$&&n===J)return T;if(e.lookahead===0)break}if(t=0,e.lookahead>=k&&(e.ins_h=Q(e,e.ins_h,e.window[e.strstart+k-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=k-1,t!==0&&e.prev_length<e.max_lazy_match&&e.strstart-t<=e.w_size-$&&(e.match_length=$n(e,t),e.match_length<=5&&(e.strategy===dr||e.match_length===k&&e.strstart-e.match_start>4096)&&(e.match_length=k-1)),e.prev_length>=k&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-k,i=j(e,e.strstart-1-e.prev_match,e.prev_length-k),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=Q(e,e.ins_h,e.window[e.strstart+k-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=k-1,e.strstart++,i&&(Z(e,!1),e.strm.avail_out===0))return T}else if(e.match_available){if(i=j(e,0,e.window[e.strstart-1]),i&&Z(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return T}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=j(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<k-1?e.strstart:k-1,n===M?(Z(e,!0),e.strm.avail_out===0?ae:pe):e.sym_next&&(Z(e,!1),e.strm.avail_out===0)?T:we},Ur=(e,n)=>{let t,i,r,a,l=e.window;for(;;){if(e.lookahead<=V){if(ue(e),e.lookahead<=V&&n===J)return T;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=k&&e.strstart>0&&(r=e.strstart-1,i=l[r],i===l[++r]&&i===l[++r]&&i===l[++r])){a=e.strstart+V;do;while(i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&r<a);e.match_length=V-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=k?(t=j(e,1,e.match_length-k),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(t=j(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),t&&(Z(e,!1),e.strm.avail_out===0))return T}return e.insert=0,n===M?(Z(e,!0),e.strm.avail_out===0?ae:pe):e.sym_next&&(Z(e,!1),e.strm.avail_out===0)?T:we},Or=(e,n)=>{let t;for(;;){if(e.lookahead===0&&(ue(e),e.lookahead===0)){if(n===J)return T;break}if(e.match_length=0,t=j(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,t&&(Z(e,!1),e.strm.avail_out===0))return T}return e.insert=0,n===M?(Z(e,!0),e.strm.avail_out===0?ae:pe):e.sym_next&&(Z(e,!1),e.strm.avail_out===0)?T:we};function H(e,n,t,i,r){this.good_length=e,this.max_lazy=n,this.nice_length=t,this.max_chain=i,this.func=r}var ye=[new H(0,0,0,0,Kn),new H(4,4,8,4,dt),new H(4,5,16,8,dt),new H(4,6,32,32,dt),new H(4,4,16,16,ce),new H(8,16,32,32,ce),new H(8,16,128,128,ce),new H(8,32,128,256,ce),new H(32,128,258,1024,ce),new H(32,258,258,4096,ce)],Ir=e=>{e.window_size=2*e.w_size,W(e.head),e.max_lazy_match=ye[e.level].max_lazy,e.good_match=ye[e.level].good_length,e.nice_match=ye[e.level].nice_length,e.max_chain_length=ye[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=k-1,e.match_available=0,e.ins_h=0};function zr(){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=Je,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(Ar*2),this.dyn_dtree=new Uint16Array((2*yr+1)*2),this.bl_tree=new Uint16Array((2*Er+1)*2),W(this.dyn_ltree),W(this.dyn_dtree),W(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(kr+1),this.heap=new Uint16Array(2*At+1),W(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*At+1),W(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 Te=e=>{if(!e)return 1;let n=e.state;return!n||n.strm!==e||n.status!==he&&n.status!==Ct&&n.status!==kt&&n.status!==vt&&n.status!==St&&n.status!==Dt&&n.status!==ne&&n.status!==me?1:0},Gn=e=>{if(Te(e))return ie(e,B);e.total_in=e.total_out=0,e.data_type=gr;let n=e.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap===2?Ct:n.wrap?he:ne,e.adler=n.wrap===2?0:1,n.last_flush=-2,rr(n),C},qn=e=>{let n=Gn(e);return n===C&&Ir(e.state),n},Cr=(e,n)=>Te(e)||e.state.wrap!==2?B:(e.state.gzhead=n,C),Xn=(e,n,t,i,r,a)=>{if(!e)return B;let l=1;if(n===cr&&(n=6),i<0?(l=0,i=-i):i>15&&(l=2,i-=16),r<1||r>br||t!==Je||i<8||i>15||n<0||n>9||a<0||a>hr||i===8&&l!==1)return ie(e,B);i===8&&(i=9);let s=new zr;return e.state=s,s.strm=e,s.status=he,s.wrap=l,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+k-1)/k),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=n,s.strategy=a,s.method=t,qn(e)},Tr=(e,n)=>Xn(e,n,Je,wr,pr,ur),Nr=(e,n)=>{if(Te(e)||n>Yt||n<0)return e?ie(e,B):B;let t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===me&&n!==M)return ie(e,e.avail_out===0?ct:B);let i=t.last_flush;if(t.last_flush=n,t.pending!==0){if(L(e),e.avail_out===0)return t.last_flush=-1,C}else if(e.avail_in===0&&Vt(n)<=Vt(i)&&n!==M)return ie(e,ct);if(t.status===me&&e.avail_in!==0)return ie(e,ct);if(t.status===he&&t.wrap===0&&(t.status=ne),t.status===he){let r=Je+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=$e||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,r|=a<<6,t.strstart!==0&&(r|=vr),r+=31-r%31,xe(t,r),t.strstart!==0&&(xe(t,e.adler>>>16),xe(t,e.adler&65535)),e.adler=1,t.status=ne,L(e),t.pending!==0)return t.last_flush=-1,C}if(t.status===Ct){if(e.adler=0,D(t,31),D(t,139),D(t,8),t.gzhead)D(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),D(t,t.gzhead.time&255),D(t,t.gzhead.time>>8&255),D(t,t.gzhead.time>>16&255),D(t,t.gzhead.time>>24&255),D(t,t.level===9?2:t.strategy>=$e||t.level<2?4:0),D(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(D(t,t.gzhead.extra.length&255),D(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=z(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=kt;else if(D(t,0),D(t,0),D(t,0),D(t,0),D(t,0),D(t,t.level===9?2:t.strategy>=$e||t.level<2?4:0),D(t,Sr),t.status=ne,L(e),t.pending!==0)return t.last_flush=-1,C}if(t.status===kt){if(t.gzhead.extra){let r=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),t.gzindex+=s,L(e),t.pending!==0)return t.last_flush=-1,C;r=0,a-=s}let l=new Uint8Array(t.gzhead.extra);t.pending_buf.set(l.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),t.gzindex=0}t.status=vt}if(t.status===vt){if(t.gzhead.name){let r=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),L(e),t.pending!==0)return t.last_flush=-1,C;r=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,D(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),t.gzindex=0}t.status=St}if(t.status===St){if(t.gzhead.comment){let r=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),L(e),t.pending!==0)return t.last_flush=-1,C;r=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,D(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r))}t.status=Dt}if(t.status===Dt){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(L(e),t.pending!==0))return t.last_flush=-1,C;D(t,e.adler&255),D(t,e.adler>>8&255),e.adler=0}if(t.status=ne,L(e),t.pending!==0)return t.last_flush=-1,C}if(e.avail_in!==0||t.lookahead!==0||n!==J&&t.status!==me){let r=t.level===0?Kn(t,n):t.strategy===$e?Or(t,n):t.strategy===_r?Ur(t,n):ye[t.level].func(t,n);if((r===ae||r===pe)&&(t.status=me),r===T||r===ae)return e.avail_out===0&&(t.last_flush=-1),C;if(r===we&&(n===sr?or(t):n!==Yt&&(Et(t,0,0,!1),n===lr&&(W(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),L(e),e.avail_out===0))return t.last_flush=-1,C}return n!==M?C:t.wrap<=0?Wt:(t.wrap===2?(D(t,e.adler&255),D(t,e.adler>>8&255),D(t,e.adler>>16&255),D(t,e.adler>>24&255),D(t,e.total_in&255),D(t,e.total_in>>8&255),D(t,e.total_in>>16&255),D(t,e.total_in>>24&255)):(xe(t,e.adler>>>16),xe(t,e.adler&65535)),L(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?C:Wt)},Lr=e=>{if(Te(e))return B;let n=e.state.status;return e.state=null,n===ne?ie(e,fr):C},Zr=(e,n)=>{let t=n.length;if(Te(e))return B;let i=e.state,r=i.wrap;if(r===2||r===1&&i.status!==he||i.lookahead)return B;if(r===1&&(e.adler=Ue(e.adler,n,t,0)),i.wrap=0,t>=i.w_size){r===0&&(W(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(n.subarray(t-i.w_size,t),0),n=c,t=i.w_size}let a=e.avail_in,l=e.next_in,s=e.input;for(e.avail_in=t,e.next_in=0,e.input=n,ue(i);i.lookahead>=k;){let c=i.strstart,o=i.lookahead-(k-1);do i.ins_h=Q(i,i.ins_h,i.window[c+k-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--o);i.strstart=c,i.lookahead=k-1,ue(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=k-1,i.match_available=0,e.next_in=l,e.input=s,e.avail_in=a,i.wrap=r,C},Mr=Tr,Fr=Xn,Hr=qn,Pr=Gn,Br=Cr,$r=Nr,Kr=Lr,Gr=Zr,qr="pako deflate (from Nodeca project)",Ae={deflateInit:Mr,deflateInit2:Fr,deflateReset:Hr,deflateResetKeep:Pr,deflateSetHeader:Br,deflate:$r,deflateEnd:Kr,deflateSetDictionary:Gr,deflateInfo:qr},Xr=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),Yr=function(e){let n=Array.prototype.slice.call(arguments,1);for(;n.length;){let t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)Xr(t,i)&&(e[i]=t[i])}}return e},Wr=e=>{let n=0;for(let i=0,r=e.length;i<r;i++)n+=e[i].length;let t=new Uint8Array(n);for(let i=0,r=0,a=e.length;i<a;i++){let l=e[i];t.set(l,r),r+=l.length}return t},Qe={assign:Yr,flattenChunks:Wr},Yn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Yn=!1}var Oe=new Uint8Array(256);for(let e=0;e<256;e++)Oe[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Oe[254]=Oe[254]=1;var Vr=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,i,r,a,l=e.length,s=0;for(r=0;r<l;r++)t=e.charCodeAt(r),(t&64512)===55296&&r+1<l&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),r++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(n=new Uint8Array(s),a=0,r=0;a<s;r++)t=e.charCodeAt(r),(t&64512)===55296&&r+1<l&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),r++)),t<128?n[a++]=t:t<2048?(n[a++]=192|t>>>6,n[a++]=128|t&63):t<65536?(n[a++]=224|t>>>12,n[a++]=128|t>>>6&63,n[a++]=128|t&63):(n[a++]=240|t>>>18,n[a++]=128|t>>>12&63,n[a++]=128|t>>>6&63,n[a++]=128|t&63);return n},jr=(e,n)=>{if(n<65534&&e.subarray&&Yn)return String.fromCharCode.apply(null,e.length===n?e:e.subarray(0,n));let t="";for(let i=0;i<n;i++)t+=String.fromCharCode(e[i]);return t},Jr=(e,n)=>{let t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let i,r,a=new Array(t*2);for(r=0,i=0;i<t;){let l=e[i++];if(l<128){a[r++]=l;continue}let s=Oe[l];if(s>4){a[r++]=65533,i+=s-1;continue}for(l&=s===2?31:s===3?15:7;s>1&&i<t;)l=l<<6|e[i++]&63,s--;if(s>1){a[r++]=65533;continue}l<65536?a[r++]=l:(l-=65536,a[r++]=55296|l>>10&1023,a[r++]=56320|l&1023)}return jr(a,r)},Qr=(e,n)=>{n=n||e.length,n>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(e[t]&192)===128;)t--;return t<0||t===0?n:t+Oe[e[t]]>n?t:n},Ie={string2buf:Vr,buf2string:Jr,utf8border:Qr};function ea(){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 Wn=ea,Vn=Object.prototype.toString,{Z_NO_FLUSH:ta,Z_SYNC_FLUSH:na,Z_FULL_FLUSH:ia,Z_FINISH:ra,Z_OK:Ve,Z_STREAM_END:aa,Z_DEFAULT_COMPRESSION:oa,Z_DEFAULT_STRATEGY:sa,Z_DEFLATED:la}=be;function Ne(e){this.options=Qe.assign({level:oa,method:la,chunkSize:16384,windowBits:15,memLevel:8,strategy:sa},e||{});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 Wn,this.strm.avail_out=0;let t=Ae.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==Ve)throw new Error(re[t]);if(n.header&&Ae.deflateSetHeader(this.strm,n.header),n.dictionary){let i;if(typeof n.dictionary=="string"?i=Ie.string2buf(n.dictionary):Vn.call(n.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(n.dictionary):i=n.dictionary,t=Ae.deflateSetDictionary(this.strm,i),t!==Ve)throw new Error(re[t]);this._dict_set=!0}}Ne.prototype.push=function(e,n){let t=this.strm,i=this.options.chunkSize,r,a;if(this.ended)return!1;for(n===~~n?a=n:a=n===!0?ra:ta,typeof e=="string"?t.input=Ie.string2buf(e):Vn.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===na||a===ia)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(r=Ae.deflate(t,a),r===aa)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),r=Ae.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Ve;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Ne.prototype.onData=function(e){this.chunks.push(e)};Ne.prototype.onEnd=function(e){e===Ve&&(this.result=Qe.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Tt(e,n){let t=new Ne(n);if(t.push(e,!0),t.err)throw t.msg||re[t.err];return t.result}function fa(e,n){return n=n||{},n.raw=!0,Tt(e,n)}function ca(e,n){return n=n||{},n.gzip=!0,Tt(e,n)}var da=Ne,_a=Tt,ha=fa,ua=ca,ga=be,ba={Deflate:da,deflate:_a,deflateRaw:ha,gzip:ua,constants:ga},Ke=16209,wa=16191,pa=function(n,t){let i,r,a,l,s,c,o,f,g,_,d,u,E,y,x,b,p,h,S,I,w,U,v,m,A=n.state;i=n.next_in,v=n.input,r=i+(n.avail_in-5),a=n.next_out,m=n.output,l=a-(t-n.avail_out),s=a+(n.avail_out-257),c=A.dmax,o=A.wsize,f=A.whave,g=A.wnext,_=A.window,d=A.hold,u=A.bits,E=A.lencode,y=A.distcode,x=(1<<A.lenbits)-1,b=(1<<A.distbits)-1;e:do{u<15&&(d+=v[i++]<<u,u+=8,d+=v[i++]<<u,u+=8),p=E[d&x];t:for(;;){if(h=p>>>24,d>>>=h,u-=h,h=p>>>16&255,h===0)m[a++]=p&65535;else if(h&16){S=p&65535,h&=15,h&&(u<h&&(d+=v[i++]<<u,u+=8),S+=d&(1<<h)-1,d>>>=h,u-=h),u<15&&(d+=v[i++]<<u,u+=8,d+=v[i++]<<u,u+=8),p=y[d&b];n:for(;;){if(h=p>>>24,d>>>=h,u-=h,h=p>>>16&255,h&16){if(I=p&65535,h&=15,u<h&&(d+=v[i++]<<u,u+=8,u<h&&(d+=v[i++]<<u,u+=8)),I+=d&(1<<h)-1,I>c){n.msg="invalid distance too far back",A.mode=Ke;break e}if(d>>>=h,u-=h,h=a-l,I>h){if(h=I-h,h>f&&A.sane){n.msg="invalid distance too far back",A.mode=Ke;break e}if(w=0,U=_,g===0){if(w+=o-h,h<S){S-=h;do m[a++]=_[w++];while(--h);w=a-I,U=m}}else if(g<h){if(w+=o+g-h,h-=g,h<S){S-=h;do m[a++]=_[w++];while(--h);if(w=0,g<S){h=g,S-=h;do m[a++]=_[w++];while(--h);w=a-I,U=m}}}else if(w+=g-h,h<S){S-=h;do m[a++]=_[w++];while(--h);w=a-I,U=m}for(;S>2;)m[a++]=U[w++],m[a++]=U[w++],m[a++]=U[w++],S-=3;S&&(m[a++]=U[w++],S>1&&(m[a++]=U[w++]))}else{w=a-I;do m[a++]=m[w++],m[a++]=m[w++],m[a++]=m[w++],S-=3;while(S>2);S&&(m[a++]=m[w++],S>1&&(m[a++]=m[w++]))}}else if((h&64)===0){p=y[(p&65535)+(d&(1<<h)-1)];continue n}else{n.msg="invalid distance code",A.mode=Ke;break e}break}}else if((h&64)===0){p=E[(p&65535)+(d&(1<<h)-1)];continue t}else if(h&32){A.mode=wa;break e}else{n.msg="invalid literal/length code",A.mode=Ke;break e}break}}while(i<r&&a<s);S=u>>3,i-=S,u-=S<<3,d&=(1<<u)-1,n.next_in=i,n.next_out=a,n.avail_in=i<r?5+(r-i):5-(i-r),n.avail_out=a<s?257+(s-a):257-(a-s),A.hold=d,A.bits=u},de=15,jt=852,Jt=592,Qt=0,_t=1,en=2,xa=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]),ma=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]),ya=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]),Ea=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]),Aa=(e,n,t,i,r,a,l,s)=>{let c=s.bits,o=0,f=0,g=0,_=0,d=0,u=0,E=0,y=0,x=0,b=0,p,h,S,I,w,U=null,v,m=new Uint16Array(de+1),A=new Uint16Array(de+1),ee=null,Bt,Pe,Be;for(o=0;o<=de;o++)m[o]=0;for(f=0;f<i;f++)m[n[t+f]]++;for(d=c,_=de;_>=1&&m[_]===0;_--);if(d>_&&(d=_),_===0)return r[a++]=1<<24|64<<16|0,r[a++]=1<<24|64<<16|0,s.bits=1,0;for(g=1;g<_&&m[g]===0;g++);for(d<g&&(d=g),y=1,o=1;o<=de;o++)if(y<<=1,y-=m[o],y<0)return-1;if(y>0&&(e===Qt||_!==1))return-1;for(A[1]=0,o=1;o<de;o++)A[o+1]=A[o]+m[o];for(f=0;f<i;f++)n[t+f]!==0&&(l[A[n[t+f]]++]=f);if(e===Qt?(U=ee=l,v=20):e===_t?(U=xa,ee=ma,v=257):(U=ya,ee=Ea,v=0),b=0,f=0,o=g,w=a,u=d,E=0,S=-1,x=1<<d,I=x-1,e===_t&&x>jt||e===en&&x>Jt)return 1;for(;;){Bt=o-E,l[f]+1<v?(Pe=0,Be=l[f]):l[f]>=v?(Pe=ee[l[f]-v],Be=U[l[f]-v]):(Pe=96,Be=0),p=1<<o-E,h=1<<u,g=h;do h-=p,r[w+(b>>E)+h]=Bt<<24|Pe<<16|Be|0;while(h!==0);for(p=1<<o-1;b&p;)p>>=1;if(p!==0?(b&=p-1,b+=p):b=0,f++,--m[o]===0){if(o===_)break;o=n[t+l[f]]}if(o>d&&(b&I)!==S){for(E===0&&(E=d),w+=g,u=o-E,y=1<<u;u+E<_&&(y-=m[u+E],!(y<=0));)u++,y<<=1;if(x+=1<<u,e===_t&&x>jt||e===en&&x>Jt)return 1;S=b&I,r[S]=d<<24|u<<16|w-a|0}}return b!==0&&(r[w+b]=o-E<<24|64<<16|0),s.bits=d,0},ke=Aa,ka=0,jn=1,Jn=2,{Z_FINISH:tn,Z_BLOCK:va,Z_TREES:Ge,Z_OK:oe,Z_STREAM_END:Sa,Z_NEED_DICT:Da,Z_STREAM_ERROR:F,Z_DATA_ERROR:Qn,Z_MEM_ERROR:ei,Z_BUF_ERROR:Ra,Z_DEFLATED:nn}=be,et=16180,rn=16181,an=16182,on=16183,sn=16184,ln=16185,fn=16186,cn=16187,dn=16188,_n=16189,je=16190,G=16191,ht=16192,hn=16193,ut=16194,un=16195,gn=16196,bn=16197,wn=16198,qe=16199,Xe=16200,pn=16201,xn=16202,mn=16203,yn=16204,En=16205,gt=16206,An=16207,kn=16208,O=16209,ti=16210,ni=16211,Ua=852,Oa=592,Ia=15,za=Ia,vn=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Ca(){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 se=e=>{if(!e)return 1;let n=e.state;return!n||n.strm!==e||n.mode<et||n.mode>ni?1:0},ii=e=>{if(se(e))return F;let n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=n.wrap&1),n.mode=et,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(Ua),n.distcode=n.distdyn=new Int32Array(Oa),n.sane=1,n.back=-1,oe},ri=e=>{if(se(e))return F;let n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,ii(e)},ai=(e,n)=>{let t;if(se(e))return F;let i=e.state;return n<0?(t=0,n=-n):(t=(n>>4)+5,n<48&&(n&=15)),n&&(n<8||n>15)?F:(i.window!==null&&i.wbits!==n&&(i.window=null),i.wrap=t,i.wbits=n,ri(e))},oi=(e,n)=>{if(!e)return F;let t=new Ca;e.state=t,t.strm=e,t.window=null,t.mode=et;let i=ai(e,n);return i!==oe&&(e.state=null),i},Ta=e=>oi(e,za),Sn=!0,bt,wt,Na=e=>{if(Sn){bt=new Int32Array(512),wt=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(ke(jn,e.lens,0,288,bt,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;ke(Jn,e.lens,0,32,wt,0,e.work,{bits:5}),Sn=!1}e.lencode=bt,e.lenbits=9,e.distcode=wt,e.distbits=5},si=(e,n,t,i)=>{let r,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(n.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),a.window.set(n.subarray(t-i,t-i+r),a.wnext),i-=r,i?(a.window.set(n.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0},La=(e,n)=>{let t,i,r,a,l,s,c,o,f,g,_,d,u,E,y=0,x,b,p,h,S,I,w,U,v=new Uint8Array(4),m,A,ee=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(se(e)||!e.output||!e.input&&e.avail_in!==0)return F;t=e.state,t.mode===G&&(t.mode=ht),l=e.next_out,r=e.output,c=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,o=t.hold,f=t.bits,g=s,_=c,U=oe;e:for(;;)switch(t.mode){case et:if(t.wrap===0){t.mode=ht;break}for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.wrap&2&&o===35615){t.wbits===0&&(t.wbits=15),t.check=0,v[0]=o&255,v[1]=o>>>8&255,t.check=z(t.check,v,2,0),o=0,f=0,t.mode=rn;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((o&255)<<8)+(o>>8))%31){e.msg="incorrect header check",t.mode=O;break}if((o&15)!==nn){e.msg="unknown compression method",t.mode=O;break}if(o>>>=4,f-=4,w=(o&15)+8,t.wbits===0&&(t.wbits=w),w>15||w>t.wbits){e.msg="invalid window size",t.mode=O;break}t.dmax=1<<t.wbits,t.flags=0,e.adler=t.check=1,t.mode=o&512?_n:G,o=0,f=0;break;case rn:for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.flags=o,(t.flags&255)!==nn){e.msg="unknown compression method",t.mode=O;break}if(t.flags&57344){e.msg="unknown header flags set",t.mode=O;break}t.head&&(t.head.text=o>>8&1),t.flags&512&&t.wrap&4&&(v[0]=o&255,v[1]=o>>>8&255,t.check=z(t.check,v,2,0)),o=0,f=0,t.mode=an;case an:for(;f<32;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.head&&(t.head.time=o),t.flags&512&&t.wrap&4&&(v[0]=o&255,v[1]=o>>>8&255,v[2]=o>>>16&255,v[3]=o>>>24&255,t.check=z(t.check,v,4,0)),o=0,f=0,t.mode=on;case on:for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.head&&(t.head.xflags=o&255,t.head.os=o>>8),t.flags&512&&t.wrap&4&&(v[0]=o&255,v[1]=o>>>8&255,t.check=z(t.check,v,2,0)),o=0,f=0,t.mode=sn;case sn:if(t.flags&1024){for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.length=o,t.head&&(t.head.extra_len=o),t.flags&512&&t.wrap&4&&(v[0]=o&255,v[1]=o>>>8&255,t.check=z(t.check,v,2,0)),o=0,f=0}else t.head&&(t.head.extra=null);t.mode=ln;case ln:if(t.flags&1024&&(d=t.length,d>s&&(d=s),d&&(t.head&&(w=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+d),w)),t.flags&512&&t.wrap&4&&(t.check=z(t.check,i,d,a)),s-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=fn;case fn:if(t.flags&2048){if(s===0)break e;d=0;do w=i[a+d++],t.head&&w&&t.length<65536&&(t.head.name+=String.fromCharCode(w));while(w&&d<s);if(t.flags&512&&t.wrap&4&&(t.check=z(t.check,i,d,a)),s-=d,a+=d,w)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=cn;case cn:if(t.flags&4096){if(s===0)break e;d=0;do w=i[a+d++],t.head&&w&&t.length<65536&&(t.head.comment+=String.fromCharCode(w));while(w&&d<s);if(t.flags&512&&t.wrap&4&&(t.check=z(t.check,i,d,a)),s-=d,a+=d,w)break e}else t.head&&(t.head.comment=null);t.mode=dn;case dn:if(t.flags&512){for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.wrap&4&&o!==(t.check&65535)){e.msg="header crc mismatch",t.mode=O;break}o=0,f=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=G;break;case _n:for(;f<32;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}e.adler=t.check=vn(o),o=0,f=0,t.mode=je;case je:if(t.havedict===0)return e.next_out=l,e.avail_out=c,e.next_in=a,e.avail_in=s,t.hold=o,t.bits=f,Da;e.adler=t.check=1,t.mode=G;case G:if(n===va||n===Ge)break e;case ht:if(t.last){o>>>=f&7,f-=f&7,t.mode=gt;break}for(;f<3;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}switch(t.last=o&1,o>>>=1,f-=1,o&3){case 0:t.mode=hn;break;case 1:if(Na(t),t.mode=qe,n===Ge){o>>>=2,f-=2;break e}break;case 2:t.mode=gn;break;case 3:e.msg="invalid block type",t.mode=O}o>>>=2,f-=2;break;case hn:for(o>>>=f&7,f-=f&7;f<32;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if((o&65535)!==(o>>>16^65535)){e.msg="invalid stored block lengths",t.mode=O;break}if(t.length=o&65535,o=0,f=0,t.mode=ut,n===Ge)break e;case ut:t.mode=un;case un:if(d=t.length,d){if(d>s&&(d=s),d>c&&(d=c),d===0)break e;r.set(i.subarray(a,a+d),l),s-=d,a+=d,c-=d,l+=d,t.length-=d;break}t.mode=G;break;case gn:for(;f<14;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.nlen=(o&31)+257,o>>>=5,f-=5,t.ndist=(o&31)+1,o>>>=5,f-=5,t.ncode=(o&15)+4,o>>>=4,f-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=O;break}t.have=0,t.mode=bn;case bn:for(;t.have<t.ncode;){for(;f<3;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.lens[ee[t.have++]]=o&7,o>>>=3,f-=3}for(;t.have<19;)t.lens[ee[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,m={bits:t.lenbits},U=ke(ka,t.lens,0,19,t.lencode,0,t.work,m),t.lenbits=m.bits,U){e.msg="invalid code lengths set",t.mode=O;break}t.have=0,t.mode=wn;case wn:for(;t.have<t.nlen+t.ndist;){for(;y=t.lencode[o&(1<<t.lenbits)-1],x=y>>>24,b=y>>>16&255,p=y&65535,!(x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(p<16)o>>>=x,f-=x,t.lens[t.have++]=p;else{if(p===16){for(A=x+2;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(o>>>=x,f-=x,t.have===0){e.msg="invalid bit length repeat",t.mode=O;break}w=t.lens[t.have-1],d=3+(o&3),o>>>=2,f-=2}else if(p===17){for(A=x+3;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}o>>>=x,f-=x,w=0,d=3+(o&7),o>>>=3,f-=3}else{for(A=x+7;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}o>>>=x,f-=x,w=0,d=11+(o&127),o>>>=7,f-=7}if(t.have+d>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=O;break}for(;d--;)t.lens[t.have++]=w}}if(t.mode===O)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=O;break}if(t.lenbits=9,m={bits:t.lenbits},U=ke(jn,t.lens,0,t.nlen,t.lencode,0,t.work,m),t.lenbits=m.bits,U){e.msg="invalid literal/lengths set",t.mode=O;break}if(t.distbits=6,t.distcode=t.distdyn,m={bits:t.distbits},U=ke(Jn,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,m),t.distbits=m.bits,U){e.msg="invalid distances set",t.mode=O;break}if(t.mode=qe,n===Ge)break e;case qe:t.mode=Xe;case Xe:if(s>=6&&c>=258){e.next_out=l,e.avail_out=c,e.next_in=a,e.avail_in=s,t.hold=o,t.bits=f,pa(e,_),l=e.next_out,r=e.output,c=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,o=t.hold,f=t.bits,t.mode===G&&(t.back=-1);break}for(t.back=0;y=t.lencode[o&(1<<t.lenbits)-1],x=y>>>24,b=y>>>16&255,p=y&65535,!(x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(b&&(b&240)===0){for(h=x,S=b,I=p;y=t.lencode[I+((o&(1<<h+S)-1)>>h)],x=y>>>24,b=y>>>16&255,p=y&65535,!(h+x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}o>>>=h,f-=h,t.back+=h}if(o>>>=x,f-=x,t.back+=x,t.length=p,b===0){t.mode=En;break}if(b&32){t.back=-1,t.mode=G;break}if(b&64){e.msg="invalid literal/length code",t.mode=O;break}t.extra=b&15,t.mode=pn;case pn:if(t.extra){for(A=t.extra;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.length+=o&(1<<t.extra)-1,o>>>=t.extra,f-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=xn;case xn:for(;y=t.distcode[o&(1<<t.distbits)-1],x=y>>>24,b=y>>>16&255,p=y&65535,!(x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if((b&240)===0){for(h=x,S=b,I=p;y=t.distcode[I+((o&(1<<h+S)-1)>>h)],x=y>>>24,b=y>>>16&255,p=y&65535,!(h+x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}o>>>=h,f-=h,t.back+=h}if(o>>>=x,f-=x,t.back+=x,b&64){e.msg="invalid distance code",t.mode=O;break}t.offset=p,t.extra=b&15,t.mode=mn;case mn:if(t.extra){for(A=t.extra;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.offset+=o&(1<<t.extra)-1,o>>>=t.extra,f-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=O;break}t.mode=yn;case yn:if(c===0)break e;if(d=_-c,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=O;break}d>t.wnext?(d-=t.wnext,u=t.wsize-d):u=t.wnext-d,d>t.length&&(d=t.length),E=t.window}else E=r,u=l-t.offset,d=t.length;d>c&&(d=c),c-=d,t.length-=d;do r[l++]=E[u++];while(--d);t.length===0&&(t.mode=Xe);break;case En:if(c===0)break e;r[l++]=t.length,c--,t.mode=Xe;break;case gt:if(t.wrap){for(;f<32;){if(s===0)break e;s--,o|=i[a++]<<f,f+=8}if(_-=c,e.total_out+=_,t.total+=_,t.wrap&4&&_&&(e.adler=t.check=t.flags?z(t.check,r,_,l-_):Ue(t.check,r,_,l-_)),_=c,t.wrap&4&&(t.flags?o:vn(o))!==t.check){e.msg="incorrect data check",t.mode=O;break}o=0,f=0}t.mode=An;case An:if(t.wrap&&t.flags){for(;f<32;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.wrap&4&&o!==(t.total&4294967295)){e.msg="incorrect length check",t.mode=O;break}o=0,f=0}t.mode=kn;case kn:U=Sa;break e;case O:U=Qn;break e;case ti:return ei;case ni:default:return F}return e.next_out=l,e.avail_out=c,e.next_in=a,e.avail_in=s,t.hold=o,t.bits=f,(t.wsize||_!==e.avail_out&&t.mode<O&&(t.mode<gt||n!==tn))&&si(e,e.output,e.next_out,_-e.avail_out),g-=e.avail_in,_-=e.avail_out,e.total_in+=g,e.total_out+=_,t.total+=_,t.wrap&4&&_&&(e.adler=t.check=t.flags?z(t.check,r,_,e.next_out-_):Ue(t.check,r,_,e.next_out-_)),e.data_type=t.bits+(t.last?64:0)+(t.mode===G?128:0)+(t.mode===qe||t.mode===ut?256:0),(g===0&&_===0||n===tn)&&U===oe&&(U=Ra),U},Za=e=>{if(se(e))return F;let n=e.state;return n.window&&(n.window=null),e.state=null,oe},Ma=(e,n)=>{if(se(e))return F;let t=e.state;return(t.wrap&2)===0?F:(t.head=n,n.done=!1,oe)},Fa=(e,n)=>{let t=n.length,i,r,a;return se(e)||(i=e.state,i.wrap!==0&&i.mode!==je)?F:i.mode===je&&(r=1,r=Ue(r,n,t,0),r!==i.check)?Qn:(a=si(e,n,t,t),a?(i.mode=ti,ei):(i.havedict=1,oe))},Ha=ri,Pa=ai,Ba=ii,$a=Ta,Ka=oi,Ga=La,qa=Za,Xa=Ma,Ya=Fa,Wa="pako inflate (from Nodeca project)",X={inflateReset:Ha,inflateReset2:Pa,inflateResetKeep:Ba,inflateInit:$a,inflateInit2:Ka,inflate:Ga,inflateEnd:qa,inflateGetHeader:Xa,inflateSetDictionary:Ya,inflateInfo:Wa};function Va(){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 ja=Va,li=Object.prototype.toString,{Z_NO_FLUSH:Ja,Z_FINISH:Qa,Z_OK:ze,Z_STREAM_END:pt,Z_NEED_DICT:xt,Z_STREAM_ERROR:eo,Z_DATA_ERROR:Dn,Z_MEM_ERROR:to}=be;function Le(e){this.options=Qe.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});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&&!(e&&e.windowBits)&&(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(n.windowBits&15)===0&&(n.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Wn,this.strm.avail_out=0;let t=X.inflateInit2(this.strm,n.windowBits);if(t!==ze)throw new Error(re[t]);if(this.header=new ja,X.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Ie.string2buf(n.dictionary):li.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=X.inflateSetDictionary(this.strm,n.dictionary),t!==ze)))throw new Error(re[t])}Le.prototype.push=function(e,n){let t=this.strm,i=this.options.chunkSize,r=this.options.dictionary,a,l,s;if(this.ended)return!1;for(n===~~n?l=n:l=n===!0?Qa:Ja,li.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=X.inflate(t,l),a===xt&&r&&(a=X.inflateSetDictionary(t,r),a===ze?a=X.inflate(t,l):a===Dn&&(a=xt));t.avail_in>0&&a===pt&&t.state.wrap>0&&e[t.next_in]!==0;)X.inflateReset(t),a=X.inflate(t,l);switch(a){case eo:case Dn:case xt:case to:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===pt))if(this.options.to==="string"){let c=Ie.utf8border(t.output,t.next_out),o=t.next_out-c,f=Ie.buf2string(t.output,c);t.next_out=o,t.avail_out=i-o,o&&t.output.set(t.output.subarray(c,c+o),0),this.onData(f)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===ze&&s===0)){if(a===pt)return a=X.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Le.prototype.onData=function(e){this.chunks.push(e)};Le.prototype.onEnd=function(e){e===ze&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Qe.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Nt(e,n){let t=new Le(n);if(t.push(e),t.err)throw t.msg||re[t.err];return t.result}function no(e,n){return n=n||{},n.raw=!0,Nt(e,n)}var io=Le,ro=Nt,ao=no,oo=Nt,so=be,lo={Inflate:io,inflate:ro,inflateRaw:ao,ungzip:oo,constants:so},{Deflate:Oo,deflate:Io,deflateRaw:zo,gzip:Co}=ba,{Inflate:fo,inflate:To,inflateRaw:co,ungzip:No}=lo;var Lt=fo;var fi=co;var _o=(()=>{let e=new Uint32Array(256);for(let n=0;n<256;n+=1){let t=n;for(let i=0;i<8;i+=1)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t>>>0}return e})(),Zt=(e,n)=>(_o[(e^n)&255]^e>>>8)>>>0,Me=class{state=4294967295;update(n){let t=this.state;for(let i=0;i<n.length;i+=1)t=Zt(t,n[i]);this.state=t}digest(){return(this.state^4294967295)>>>0}},nt=e=>{let n=new Me;return n.update(e),n.digest()},K=e=>(e<<1^(e&128?27:0))&255,Y=(()=>{let e=new Uint8Array(256),n=new Uint8Array(256),t=new Uint8Array(256),i=1;for(let a=0;a<255;a+=1)n[a]=i,t[i]=a,i=(i^K(i))&255;let r=a=>a===0?0:n[(255-t[a])%255];for(let a=0;a<256;a+=1){let l=r(a),s=l;for(let c=0;c<4;c+=1)l=(l<<1|l>>7)&255,s^=l;e[a]=(s^99)&255}return e})(),ho=(()=>{let e=new Uint8Array(11),n=1;for(let t=1;t<=10;t+=1)e[t]=n,n=K(n);return e})(),uo=e=>{let n=e.length/4,t=n+6,i=4*(t+1),r=new Uint8Array(i*4);r.set(e);for(let a=n;a<i;a+=1){let l=r[(a-1)*4],s=r[(a-1)*4+1],c=r[(a-1)*4+2],o=r[(a-1)*4+3];if(a%n===0){let f=l;l=Y[s]^ho[a/n],s=Y[c],c=Y[o],o=Y[f]}else n>6&&a%n===4&&(l=Y[l],s=Y[s],c=Y[c],o=Y[o]);r[a*4]=r[(a-n)*4]^l,r[a*4+1]=r[(a-n)*4+1]^s,r[a*4+2]=r[(a-n)*4+2]^c,r[a*4+3]=r[(a-n)*4+3]^o}return{w:r,rounds:t}},go=({w:e,rounds:n},t)=>{let i=t.slice(0,16),r=a=>{for(let l=0;l<16;l+=1)i[l]^=e[a*16+l]};r(0);for(let a=1;a<=n;a+=1){for(let s=0;s<16;s+=1)i[s]=Y[i[s]];let l=i[1];if(i[1]=i[5],i[5]=i[9],i[9]=i[13],i[13]=l,l=i[2],i[2]=i[10],i[10]=l,l=i[6],i[6]=i[14],i[14]=l,l=i[3],i[3]=i[15],i[15]=i[11],i[11]=i[7],i[7]=l,a!==n)for(let s=0;s<4;s+=1){let c=s*4,o=i[c],f=i[c+1],g=i[c+2],_=i[c+3];i[c]=K(o)^(K(f)^f)^g^_,i[c+1]=o^K(f)^(K(g)^g)^_,i[c+2]=o^f^K(g)^(K(_)^_),i[c+3]=K(o)^o^f^g^K(_)}r(a)}return i};var bo=(e,n)=>{let t=uo(n),i=new Uint8Array(e.length),r=new Uint8Array(16);for(let a=0,l=1;a<e.length;a+=16,l+=1){r.fill(0);for(let o=l,f=0;o>0&&f<16;o=Math.floor(o/256),f+=1)r[f]=o&255;let s=go(t,r),c=Math.min(16,e.length-a);for(let o=0;o<c;o+=1)i[a+o]=e[a+o]^s[o]}return i},Mt=class{k0=305419896;k1=591751049;k2=878082192;constructor(n){for(let t of n)this.update(t)}update(n){this.k0=Zt(this.k0,n),this.k1=this.k1+(this.k0&255)>>>0,this.k1=Math.imul(this.k1,134775813)+1>>>0,this.k2=Zt(this.k2,this.k1>>>24)}streamByte(){let n=(this.k2|2)&65535;return n*(n^1)>>>8&255}},ci=(e,n)=>{let t=new Mt(n),i=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1){let a=(e[r]^t.streamByte())&255;t.update(a),i[r]=a}return{plaintext:i.subarray(12),checkByte:i[11]}};var wo={1:{saltLength:8,keyLength:16},2:{saltLength:12,keyLength:24},3:{saltLength:16,keyLength:32}},di=e=>{let n=new DataView(e);for(let t=0;t+4<=e.byteLength;){let i=n.getUint16(t,!0),r=n.getUint16(t+2,!0);if(i===39169)return{strength:n.getUint8(t+4+4),actualMethod:n.getUint16(t+4+5,!0)};t=t+4+r}return null},tt=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),po=async(e,n,t)=>{let i=globalThis.crypto.subtle,r=await i.importKey("raw",tt(e),"PBKDF2",!1,["deriveBits"]),a=new Uint8Array(await i.deriveBits({name:"PBKDF2",salt:tt(n),iterations:1e3,hash:"SHA-1"},r,(t*2+2)*8));return{encKey:a.subarray(0,t),authKey:a.subarray(t,t*2),verify:a.subarray(t*2,t*2+2)}},xo=async(e,n)=>{let t=globalThis.crypto.subtle,i=await t.importKey("raw",tt(e),{name:"HMAC",hash:"SHA-1"},!1,["sign"]);return new Uint8Array(await t.sign("HMAC",i,tt(n)))},Ze=class extends Error{constructor(t){super(t);this.reason=t}reason},_i=async(e,n,t)=>{let i=wo[t];if(!i)throw new Ze("UNSUPPORTED");let{saltLength:r,keyLength:a}=i,l=e.subarray(0,r),s=e.subarray(r,r+2),c=e.subarray(e.length-10),o=e.subarray(r+2,e.length-10),{encKey:f,authKey:g,verify:_}=await po(n,l,a);if(_[0]!==s[0]||_[1]!==s[1])throw new Ze("WRONG_PASSWORD");let d=await xo(g,o),u=c.length===10;for(let E=0;E<10;E+=1)d[E]!==c[E]&&(u=!1);if(!u)throw new Ze("BAD_MAC");return bo(o,f)};var hi=1347092738,ui=1347093252,gi=1347093766,mo=1347094280,yo=1347094022,Eo=1347094023,le=4294967295,Fe=65535,R=class extends Error{code;constructor(n,t="UNKNOWN"){super(n),this.name=this.constructor.name,this.code=t}},Ao=e=>{switch(e.reason){case"WRONG_PASSWORD":return new R("Incorrect password (AES)","WRONG_PASSWORD");case"UNSUPPORTED":return new R("Unsupported AES key strength","UNSUPPORTED_ENCRYPTION");default:return new R("AES authentication failed (corrupt data or wrong password)","DECRYPTION_FAILED")}},He=(e,n)=>{if(e<200||e>=400)throw new R(`Could not fetch remote ZIP at ${n}: HTTP status ${e}`,"HTTP_ERROR")},it=class{contentLength;url;centralDirectoryRecords;endOfCentralDirectory;method;credentials;redirect;signal;timeoutMs;requestInit;constructor({contentLength:n,url:t,centralDirectoryRecords:i,endOfCentralDirectory:r,method:a,credentials:l="same-origin",redirect:s,signal:c,timeoutMs:o,requestInit:f}){this.contentLength=n,this.url=t,this.method=a,this.centralDirectoryRecords=i,this.endOfCentralDirectory=r,this.credentials=l,this.redirect=s,this.signal=c,this.timeoutMs=o,this.requestInit=f}requestInitFor(n,t,i){let r=[this.signal,i?.signal].filter(Boolean);return bi({credentials:this.credentials,redirect:this.redirect,signal:r.length<=1?r[0]:AbortSignal.any(r),timeoutMs:i?.timeoutMs??this.timeoutMs,requestInit:this.requestInit},n,t)}files(){return this.centralDirectoryRecords.map(n=>({filename:n.data.filename,size:n.data.uncompressedSize,modified:Pt(n.data.lastModifiedDate,n.data.lastModifiedTime),attributes:n.data.externalFileAttributes}))}async fetch(n,t,i){let{file:r,response:a}=await this.fetchEntryResponse(n,t,i),l=Ht(await a.arrayBuffer(),r.data.compressedSize);if(!l)throw new R("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");return this.decodeEntry(r,new Uint8Array(l.meta.compressedData),l.data.compressionMethod,i)}async decodeEntry(n,t,i,r){let a=t,l=i,s=n.data.generalPurposeBitFlag;if(s&1){if(s&64)throw new R("Strong-encrypted ZIP entries are not supported","UNSUPPORTED_ENCRYPTION");if(!r?.password)throw new R(`Password required for encrypted entry: ${n.data.filename}`,"UNSUPPORTED_ENCRYPTION");let f=new TextEncoder().encode(r.password),g=l===99?di(n.data.extraField):null;if(g){try{a=await _i(a,f,g.strength)}catch(_){throw Ao(_)}l=g.actualMethod}else{let{plaintext:_,checkByte:d}=ci(a,f),u=s&8?n.data.lastModifiedTime>>8&255:n.data.crc32>>>24&255;if(d!==u)throw new R(`Incorrect password for entry: ${n.data.filename}`,"WRONG_PASSWORD");a=_}}let c=r?.maxUncompressedSize,o;if(l===0){if(c!==void 0&&a.byteLength>c)throw new R(`Uncompressed size exceeds maxUncompressedSize (${c} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");o=a}else o=ko(a,c);if(r?.verifyCrc){let f=nt(o);if(f!==n.data.crc32)throw new R(`CRC-32 mismatch for ${n.data.filename}: expected ${n.data.crc32}, got ${f}`,"CRC_MISMATCH")}return o}async fetchStream(n,t,i){let{file:r,response:a}=await this.fetchEntryResponse(n,t,i);if(!a.body)throw new R("Remote ZIP response has no body to stream","LOCAL_HEADER_PARSE_FAILED");if(r.data.generalPurposeBitFlag&1){let c=Ht(await a.arrayBuffer(),r.data.compressedSize);if(!c)throw new R("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let o=await this.decodeEntry(r,new Uint8Array(c.meta.compressedData),c.data.compressionMethod,i);return new ReadableStream({start(f){f.enqueue(o),f.close()}})}let l=a.body.getReader(),s=vo(l,{compressedSize:r.data.compressedSize,compressionMethod:r.data.compressionMethod,maxBytes:i?.maxUncompressedSize,expectedCrc:i?.verifyCrc?r.data.crc32:void 0});return new ReadableStream({async pull(c){try{let{done:o,value:f}=await s.next();o?c.close():c.enqueue(f)}catch(o){await l.cancel(o),c.error(o)}},async cancel(c){await l.cancel(c)}})}async fetchEntryResponse(n,t,i){let r=this.centralDirectoryRecords.find(c=>c.data.filename===n);if(!r)throw new R(`File not found in remote ZIP: ${n}`,"FILE_NOT_FOUND");let a=new Headers(t);a.append("Range",`bytes=${r.data.localFileHeaderRelativeOffset}-${r.data.localFileHeaderRelativeOffset+r.data.compressedSize+418}`);let s=await fetch(this.url.toString(),this.requestInitFor(this.method,a,{signal:i?.signal,timeoutMs:i?.timeoutMs}));return He(s.status,this.url),{file:r,response:s}}},ko=(e,n)=>{if(n===void 0)try{return fi(e)}catch(c){throw new R(`Failed to inflate remote ZIP entry: ${String(c)}`,"UNKNOWN")}let t=new Lt({raw:!0}),i=[],r=0,a=!1;if(t.onData=c=>{if(a)return;let o=c;if(r+=o.length,r>n){a=!0;return}i.push(o)},t.push(e,!0),a)throw new R(`Decompressed size exceeds maxUncompressedSize (${n} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");if(t.err)throw new R(`Failed to inflate remote ZIP entry: ${t.msg}`,"UNKNOWN");let l=new Uint8Array(r),s=0;for(let c of i)l.set(c,s),s+=c.length;return l};async function*vo(e,n){let{compressedSize:t,compressionMethod:i,maxBytes:r,expectedCrc:a}=n,l=a!==void 0?new Me:void 0,s=new Uint8Array(0),c=b=>{let p=new Uint8Array(s.length+b.length);p.set(s),p.set(b,s.length),s=p},o=async b=>{for(;s.length<b;){let{done:p,value:h}=await e.read();if(p)throw new R("Truncated local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");c(h)}};await o(30);let f=new DataView(s.buffer,s.byteOffset,s.byteLength);if(f.getUint32(0)!==ui)throw new R("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let g=30+f.getUint16(26,!0)+f.getUint16(28,!0);await o(g);let _=0,d=[],u=b=>{if(_+=b.length,r!==void 0&&_>r)throw new R(`Decompressed size exceeds maxUncompressedSize (${r} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");l?.update(b),d.push(b)},E=i===0?void 0:new Lt({raw:!0});E&&(E.onData=b=>u(b));let y=t,x=b=>{let p=b.length>y?b.subarray(0,y):b;if(y-=p.length,E){if(E.push(p,y===0),E.err)throw new R(`Failed to inflate remote ZIP entry: ${E.msg}`,"UNKNOWN")}else u(p)};for(x(s.subarray(g)),yield*d.splice(0);y>0;){let{done:b,value:p}=await e.read();if(b)break;x(p),yield*d.splice(0)}if(l&&l.digest()!==a)throw new R(`CRC-32 mismatch: expected ${a}, got ${l.digest()}`,"CRC_MISMATCH")}var So=(e,n)=>{let t=[];if(e&&t.push(e),n!==void 0&&t.push(AbortSignal.timeout(n)),t.length!==0)return t.length===1?t[0]:AbortSignal.any(t)},bi=(e,n,t)=>{let i=new Headers(e.requestInit?.headers);return t&&t.forEach((r,a)=>i.set(a,r)),{...e.requestInit,method:n,headers:i,redirect:e.redirect??e.requestInit?.redirect??"follow",credentials:e.credentials,signal:So(e.signal,e.timeoutMs)}},Ft=class{url;headUrl;additionalHeaders;method;credentials;redirect;signal;timeoutMs;requestInit;constructor({url:n,headUrl:t,additionalHeaders:i,method:r="GET",credentials:a="same-origin",redirect:l,signal:s,timeoutMs:c,requestInit:o}){this.url=n,this.headUrl=t??n,this.additionalHeaders=i,this.method=r,this.credentials=a,this.redirect=l,this.signal=s,this.timeoutMs=c,this.requestInit=o}requestInitFor(n,t){return bi({credentials:this.credentials,redirect:this.redirect,signal:this.signal,timeoutMs:this.timeoutMs,requestInit:this.requestInit},n,t)}async populate(){let n=await fetch(this.headUrl.toString(),this.requestInitFor("HEAD",this.additionalHeaders));He(n.status,this.headUrl);let t=n.headers.get("content-length");if(!t)throw new R("Could not get Content-Length of URL","CONTENT_LENGTH_MISSING");let i=Number.parseInt(t,10),{eocd:r,cdOffset:a,cdSize:l}=await this.fetchEndOfCentralDirectory(i,this.additionalHeaders),s=await this.fetchCentralDirectoryRecords(a,l,this.additionalHeaders);return new it({url:this.url,contentLength:i,endOfCentralDirectory:r,centralDirectoryRecords:s,method:this.method,credentials:this.credentials,redirect:this.redirect,signal:this.signal,timeoutMs:this.timeoutMs,requestInit:this.requestInit})}async fetchEndOfCentralDirectory(n,t){let r=[128,65577];for(let a of r){let l=Math.max(0,n-a),s=new Headers(t);s.append("Range",`bytes=${l}-${n}`);let c=await fetch(this.url.toString(),this.requestInitFor(this.method,s));He(c.status,this.url);let o=await c.arrayBuffer(),f=ki(o);if(f){let g=f.data.centralDirectoryByteOffset,_=f.data.centralDirectoryByteSize;if(wi(f)){let d=xi(o);if(!d){if(a!==r[r.length-1]&&l>0)continue;throw new R("ZIP64 EOCD locator not found","UNSUPPORTED_ZIP64")}let u=await this.fetchZip64EOCD(d.zip64EOCDOffset,t);g=u.centralDirectoryByteOffset,_=u.centralDirectoryByteSize}if(g<0||_<0||g+_>n)throw new R(`Central directory is out of bounds (offset ${g}, size ${_}, archive ${n} bytes)`,"CENTRAL_DIRECTORY_OUT_OF_BOUNDS");return{eocd:f,cdOffset:g,cdSize:_}}if(l===0)break}throw new R("Could not get EOCD record of remote ZIP","EOCD_NOT_FOUND")}async fetchZip64EOCD(n,t){let i=new Headers(t);i.append("Range",`bytes=${n}-${n+56}`);let r=await fetch(this.url.toString(),this.requestInitFor(this.method,i));He(r.status,this.url);let a=mi(await r.arrayBuffer());if(!a)throw new R("ZIP64 EOCD record not found","UNSUPPORTED_ZIP64");return a}async fetchCentralDirectoryRecords(n,t,i){let r=new Headers(i);r.append("Range",`bytes=${n}-${n+t}`);let a=await fetch(this.url.toString(),this.requestInitFor(this.method,r));He(a.status,this.url);let l=await a.arrayBuffer();return Ei(l)}},Pt=(e,n)=>{let t=e&31||1,i=e>>5&15||1,r=(e>>9&127)+1980,a=n>>11&31,l=n>>5&63,s=(n&31)<<1,c=f=>f.toString().padStart(2,"0"),o=`${r}-${c(i)}-${c(t)}T${c(a)}:${c(l)}:${c(s)}`;return Number.isNaN(Date.parse(o))?Pt(0,0):o},wi=e=>e.data.diskNumber===Fe||e.data.cdDisk===Fe||e.data.centralDirectoryDiskNumber===Fe||e.data.centralDirectoryRecordCount===Fe||e.data.centralDirectoryByteSize===le||e.data.centralDirectoryByteOffset===le,fe=(e,n)=>{let t=e.getBigUint64(n,!0);if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new R(`ZIP64 value ${t} exceeds Number.MAX_SAFE_INTEGER`,"UNSUPPORTED_ZIP64");return Number(t)},pi=(e,n)=>{let t=new DataView(e);for(let i=0;i+4<=e.byteLength;){let r=t.getUint16(i,!0),a=t.getUint16(i+2,!0),l=i+4;if(r===1){let s={},c=l;return n.uncompressed&&(s.uncompressedSize=fe(t,c),c+=8),n.compressed&&(s.compressedSize=fe(t,c),c+=8),n.offset&&(s.localHeaderOffset=fe(t,c),c+=8),n.disk&&(s.diskStart=t.getUint32(c,!0)),s}i=l+a}return{}},xi=e=>{let n=new DataView(e);for(let t=e.byteLength-20;t>=0;t-=1)if(n.getUint32(t)===Eo)return{zip64EOCDOffset:fe(n,t+8)};return null},mi=e=>{let n=new DataView(e);for(let t=0;t<=e.byteLength-56;t+=1)if(n.getUint32(t)===yo)return{centralDirectoryRecordCount:fe(n,t+32),centralDirectoryByteSize:fe(n,t+40),centralDirectoryByteOffset:fe(n,t+48)};return null},Do="\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0",rt=(e,n)=>{if(n)return new TextDecoder().decode(e);let t="";for(let i of new Uint8Array(e))t+=i<128?String.fromCharCode(i):Do[i-128];return t},yi=e=>!!(e>>11&1),Ei=e=>{let n=[],t=new DataView(e);for(let i=0;i<=e.byteLength-4;i+=1)if(t.getUint32(i)===hi){let r=Ai(e.slice(i));if(r){n.push(r),i+=r.meta.length-1;continue}}else if(t.getUint32(i)===gi)break;return n},Ai=e=>{let t=new DataView(e);for(let i=0;i<e.byteLength-46;i+=1)if(t.getInt32(i)===hi){let r=t.getUint16(i+28,!0),a=t.getUint16(i+30,!0),l=t.getUint16(i+32,!0),s=t.getUint32(i+20,!0),c=t.getUint32(i+24,!0),o=t.getUint16(i+34,!0),f=t.getUint32(i+42,!0),g=e.slice(i+46+r,i+46+r+a),_={uncompressed:c===le,compressed:s===le,offset:f===le,disk:o===Fe},d=_.uncompressed||_.compressed||_.offset||_.disk?pi(g,_):{},u=yi(t.getUint16(i+8,!0));return{meta:{length:46+r+a+l},data:{signature:e.slice(i,i+4),versionMadeBy:t.getUint16(i+4,!0),versionToExtract:t.getUint16(i+6,!0),generalPurposeBitFlag:t.getUint16(i+8,!0),compressionMethod:t.getUint16(i+10,!0),lastModifiedTime:t.getUint16(i+12,!0),lastModifiedDate:t.getUint16(i+14,!0),crc32:t.getUint32(i+16,!0),compressedSize:d.compressedSize??s,uncompressedSize:d.uncompressedSize??c,filenameLength:r,extraFieldLength:a,fileCommentLength:l,startingDiskNumber:d.diskStart??o,internalFileAttributes:t.getUint16(i+36,!0),externalFileAttributes:t.getUint32(i+38,!0),localFileHeaderRelativeOffset:d.localHeaderOffset??f,filename:rt(e.slice(i+46,i+46+r),u),extraField:g,fileComment:rt(e.slice(i+46+r+a,i+46+r+a+l),u)}}}return null},ki=e=>{let t=new DataView(e),i=new TextDecoder;for(let r=e.byteLength-22;r>=0;r-=1)if(t.getUint32(r)===gi){let a=t.getUint16(r+20,!0);return{meta:{},data:{signature:e.slice(r,r+4),diskNumber:t.getUint16(r+4,!0),cdDisk:t.getUint16(r+6,!0),centralDirectoryDiskNumber:t.getUint16(r+8,!0),centralDirectoryRecordCount:t.getUint16(r+10,!0),centralDirectoryByteSize:t.getUint32(r+12,!0),centralDirectoryByteOffset:t.getUint32(r+16,!0),commentLength:a,comment:i.decode(e.slice(r+22,r+22+a))}}}return null},Ht=(e,n=0)=>{let i=new DataView(e);for(let r=0;r<=e.byteLength-30;r+=1)if(i.getUint32(r)===ui){let a=i.getUint16(r+26,!0),l=i.getUint16(r+28,!0),s=i.getUint16(r+6,!0),c=!!(s>>3&1),o=r+30+a+l,f=i.getUint32(r+18,!0),g=i.getUint32(r+22,!0),_=e.slice(r+30+a,o),d={uncompressed:g===le,compressed:f===le,offset:!1,disk:!1},u=d.uncompressed||d.compressed?pi(_,d):{},E=u.compressedSize??f,y=u.uncompressedSize??g,x=i.getUint32(o+n)===mo,b=x?4:0;return{meta:{dataDescriptor:c?{optionalSignature:x?e.slice(o+n,o+n+b):void 0,crc32:i.getUint32(o+n+b,!0),compressedSize:i.getUint32(o+n+b+4,!0),uncompressedSize:i.getUint32(o+n+b+8,!0)}:void 0,compressedData:c?e.slice(o,o+n):e.slice(o,o+E)},data:{signature:e.slice(r,r+4),versionToExtract:i.getUint16(r+4,!0),generalPurposeBitFlag:i.getUint16(r+6,!0),compressionMethod:i.getUint16(r+8,!0),lastModifiedTime:i.getUint16(r+10,!0),lastModifiedDate:i.getUint16(r+12,!0),crc32:i.getUint32(r+14,!0),compressedSize:E,uncompressedSize:y,filenameLength:a,extraFieldLength:l,filename:rt(e.slice(r+30,r+30+a),yi(s)),extraField:_}}}return null};0&&(module.exports={RemoteZip,RemoteZipError,RemoteZipPointer,crc32,decodeZipString,isZip64,parseAllCDs,parseOneCD,parseOneEOCD,parseOneLocalFile,parseZip64EOCD,parseZip64EOCDLocator,parseZipDatetime});
2
- /*! Bundled license information:
3
-
4
- pako/dist/pako.esm.mjs:
5
- (*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
6
- */
1
+ "use strict";var we=Object.defineProperty;var ur=Object.getOwnPropertyDescriptor;var _r=Object.getOwnPropertyNames;var wr=Object.prototype.hasOwnProperty;var gr=(e,r)=>{for(var t in r)we(e,t,{get:r[t],enumerable:!0})},br=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of _r(r))!wr.call(e,i)&&i!==t&&we(e,i,{get:()=>r[i],enumerable:!(a=ur(r,i))||a.enumerable});return e};var mr=e=>br(we({},"__esModule",{value:!0}),e);var Ea={};gr(Ea,{RemoteZip:()=>_e,RemoteZipError:()=>_,RemoteZipPointer:()=>Ge,crc32:()=>fe,decodeZipString:()=>Q,isZip64:()=>or,parseAllCDs:()=>dr,parseOneCD:()=>hr,parseOneEOCD:()=>fr,parseOneLocalFile:()=>qe,parseZip64EOCD:()=>cr,parseZip64EOCDLocator:()=>lr,parseZipDatetime:()=>We});module.exports=mr(Ea);var pr=4,je=0,Je=1,yr=2;function W(e){let r=e.length;for(;--r>=0;)e[r]=0}var vr=0,xr=1,Er=2,Ar=29,Ne=256,kr=286,Te=30,zt=19,Nt=573,Tt=15,ge=16;var Lt=256,Pt=16,Mt=17,Ht=18,Dr=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]),Sr=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]),ka=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Bt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ur=512,Ft=new Array(288*2);W(Ft);var Zt=new Array(Te*2);W(Zt);var Ue=new Array(Ur);W(Ue);var Le=new Array(256);W(Le);var $t=new Array(Ar);W($t);var Vt=new Array(Te);W(Vt);var Gt=e=>e<256?Ue[e]:Ue[256+(e>>>7)],oe=(e,r)=>{e.pending_buf[e.pending++]=r&255,e.pending_buf[e.pending++]=r>>>8&255},C=(e,r,t)=>{e.bi_valid>ge-t?(e.bi_buf|=r<<e.bi_valid&65535,oe(e,e.bi_buf),e.bi_buf=r>>ge-e.bi_valid,e.bi_valid+=t-ge):(e.bi_buf|=r<<e.bi_valid&65535,e.bi_valid+=t)},P=(e,r,t)=>{C(e,t[r*2],t[r*2+1])},Rr=(e,r)=>{let t=0;do t|=e&1,e>>>=1,t<<=1;while(--r>0);return t>>>1};var Ir=(e,r)=>{let t=r.dyn_tree,a=r.max_code,i=r.stat_desc.static_tree,n=r.stat_desc.has_stree,l=r.stat_desc.extra_bits,c=r.stat_desc.extra_base,d=r.stat_desc.max_length,o,s,w,f,h,v,x=0;for(f=0;f<=Tt;f++)e.bl_count[f]=0;for(t[e.heap[e.heap_max]*2+1]=0,o=e.heap_max+1;o<Nt;o++)s=e.heap[o],f=t[t[s*2+1]*2+1]+1,f>d&&(f=d,x++),t[s*2+1]=f,!(s>a)&&(e.bl_count[f]++,h=0,s>=c&&(h=l[s-c]),v=t[s*2],e.opt_len+=v*(f+h),n&&(e.static_len+=v*(i[s*2+1]+h)));if(x!==0){do{for(f=d-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[d]--,x-=2}while(x>0);for(f=d;f!==0;f--)for(s=e.bl_count[f];s!==0;)w=e.heap[--o],!(w>a)&&(t[w*2+1]!==f&&(e.opt_len+=(f-t[w*2+1])*t[w*2],t[w*2+1]=f),s--)}},Cr=(e,r,t)=>{let a=new Array(16),i=0,n,l;for(n=1;n<=Tt;n++)i=i+t[n-1]<<1,a[n]=i;for(l=0;l<=r;l++){let c=e[l*2+1];c!==0&&(e[l*2]=Rr(a[c]++,c))}};var Or=e=>{let r;for(r=0;r<kr;r++)e.dyn_ltree[r*2]=0;for(r=0;r<Te;r++)e.dyn_dtree[r*2]=0;for(r=0;r<zt;r++)e.bl_tree[r*2]=0;e.dyn_ltree[Lt*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},qt=e=>{e.bi_valid>8?oe(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Qe=(e,r,t,a)=>{let i=r*2,n=t*2;return e[i]<e[n]||e[i]===e[n]&&a[r]<=a[t]},be=(e,r,t)=>{let a=e.heap[t],i=t<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Qe(r,e.heap[i+1],e.heap[i],e.depth)&&i++,!Qe(r,a,e.heap[i],e.depth));)e.heap[t]=e.heap[i],t=i,i<<=1;e.heap[t]=a},et=(e,r,t)=>{let a,i,n=0,l,c;if(e.sym_next!==0)do a=e.pending_buf[e.sym_buf+n++]&255,a+=(e.pending_buf[e.sym_buf+n++]&255)<<8,i=e.pending_buf[e.sym_buf+n++],a===0?P(e,i,r):(l=Le[i],P(e,l+Ne+1,r),c=Dr[l],c!==0&&(i-=$t[l],C(e,i,c)),a--,l=Gt(a),P(e,l,t),c=Sr[l],c!==0&&(a-=Vt[l],C(e,a,c)));while(n<e.sym_next);P(e,Lt,r)},Re=(e,r)=>{let t=r.dyn_tree,a=r.stat_desc.static_tree,i=r.stat_desc.has_stree,n=r.stat_desc.elems,l,c,d=-1,o;for(e.heap_len=0,e.heap_max=Nt,l=0;l<n;l++)t[l*2]!==0?(e.heap[++e.heap_len]=d=l,e.depth[l]=0):t[l*2+1]=0;for(;e.heap_len<2;)o=e.heap[++e.heap_len]=d<2?++d:0,t[o*2]=1,e.depth[o]=0,e.opt_len--,i&&(e.static_len-=a[o*2+1]);for(r.max_code=d,l=e.heap_len>>1;l>=1;l--)be(e,t,l);o=n;do l=e.heap[1],e.heap[1]=e.heap[e.heap_len--],be(e,t,1),c=e.heap[1],e.heap[--e.heap_max]=l,e.heap[--e.heap_max]=c,t[o*2]=t[l*2]+t[c*2],e.depth[o]=(e.depth[l]>=e.depth[c]?e.depth[l]:e.depth[c])+1,t[l*2+1]=t[c*2+1]=o,e.heap[1]=o++,be(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Ir(e,r),Cr(t,d,e.bl_count)},tt=(e,r,t)=>{let a,i=-1,n,l=r[1],c=0,d=7,o=4;for(l===0&&(d=138,o=3),r[(t+1)*2+1]=65535,a=0;a<=t;a++)n=l,l=r[(a+1)*2+1],!(++c<d&&n===l)&&(c<o?e.bl_tree[n*2]+=c:n!==0?(n!==i&&e.bl_tree[n*2]++,e.bl_tree[Pt*2]++):c<=10?e.bl_tree[Mt*2]++:e.bl_tree[Ht*2]++,c=0,i=n,l===0?(d=138,o=3):n===l?(d=6,o=3):(d=7,o=4))},rt=(e,r,t)=>{let a,i=-1,n,l=r[1],c=0,d=7,o=4;for(l===0&&(d=138,o=3),a=0;a<=t;a++)if(n=l,l=r[(a+1)*2+1],!(++c<d&&n===l)){if(c<o)do P(e,n,e.bl_tree);while(--c!==0);else n!==0?(n!==i&&(P(e,n,e.bl_tree),c--),P(e,Pt,e.bl_tree),C(e,c-3,2)):c<=10?(P(e,Mt,e.bl_tree),C(e,c-3,3)):(P(e,Ht,e.bl_tree),C(e,c-11,7));c=0,i=n,l===0?(d=138,o=3):n===l?(d=6,o=3):(d=7,o=4)}},zr=e=>{let r;for(tt(e,e.dyn_ltree,e.l_desc.max_code),tt(e,e.dyn_dtree,e.d_desc.max_code),Re(e,e.bl_desc),r=zt-1;r>=3&&e.bl_tree[Bt[r]*2+1]===0;r--);return e.opt_len+=3*(r+1)+5+5+4,r},Nr=(e,r,t,a)=>{let i;for(C(e,r-257,5),C(e,t-1,5),C(e,a-4,4),i=0;i<a;i++)C(e,e.bl_tree[Bt[i]*2+1],3);rt(e,e.dyn_ltree,r-1),rt(e,e.dyn_dtree,t-1)},Tr=e=>{let r=4093624447,t;for(t=0;t<=31;t++,r>>>=1)if(r&1&&e.dyn_ltree[t*2]!==0)return je;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return Je;for(t=32;t<Ne;t++)if(e.dyn_ltree[t*2]!==0)return Je;return je};var Ie=(e,r,t,a)=>{C(e,(vr<<1)+(a?1:0),3),qt(e),oe(e,t),oe(e,~t),t&&e.pending_buf.set(e.window.subarray(r,r+t),e.pending),e.pending+=t};var Lr=(e,r,t,a)=>{let i,n,l=0;e.level>0?(e.strm.data_type===yr&&(e.strm.data_type=Tr(e)),Re(e,e.l_desc),Re(e,e.d_desc),l=zr(e),i=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=i&&(i=n)):i=n=t+5,t+4<=i&&r!==-1?Ie(e,r,t,a):e.strategy===pr||n===i?(C(e,(xr<<1)+(a?1:0),3),et(e,Ft,Zt)):(C(e,(Er<<1)+(a?1:0),3),Nr(e,e.l_desc.max_code+1,e.d_desc.max_code+1,l+1),et(e,e.dyn_ltree,e.dyn_dtree)),Or(e),a&&qt(e)},X=(e,r,t)=>(e.pending_buf[e.sym_buf+e.sym_next++]=r,e.pending_buf[e.sym_buf+e.sym_next++]=r>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,r===0?e.dyn_ltree[t*2]++:(e.matches++,r--,e.dyn_ltree[(Le[t]+Ne+1)*2]++,e.dyn_dtree[Gt(r)*2]++),e.sym_next===e.sym_end),se=(e,r,t,a)=>{let i=e&65535|0,n=e>>>16&65535|0,l=0;for(;t!==0;){l=t>2e3?2e3:t,t-=l;do i=i+r[a++]|0,n=n+i|0;while(--l);i%=65521,n%=65521}return i|n<<16|0},Pr=()=>{let e,r=[];for(var t=0;t<256;t++){e=t;for(var a=0;a<8;a++)e=e&1?3988292384^e>>>1:e>>>1;r[t]=e}return r},Mr=new Uint32Array(Pr()),O=(e,r,t,a)=>{let i=Mr,n=a+t;e^=-1;for(let l=a;l<n;l++)e=e>>>8^i[(e^r[l])&255];return e^-1},me={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"};var R=3,pe=258,N=262;var B=1,Pe=2,Me=3,He=4;var Hr=e=>{let r,t,a,i=e.w_size;r=e.hash_size,a=r;do t=e.head[--a],e.head[a]=t>=i?t-i:0;while(--r);r=i,a=r;do t=e.prev[--a],e.prev[a]=t>=i?t-i:0;while(--r)},Be=(e,r,t)=>(r<<e.hash_shift^t)&e.hash_mask,K=(e,r)=>{let t;if(e.legacy_hash)t=e.ins_h=Be(e,e.ins_h,e.window[r+R-1]);else{let i=e.window,n=i[r]|i[r+1]<<8|i[r+2]<<16|i[r+3]<<24;t=e.ins_h=Math.imul(n,66521)+66521>>>16&e.hash_mask}let a=e.prev[r&e.w_mask]=e.head[t];return e.head[t]=r,a},Ce=e=>{let r=e.state,t=r.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(r.pending_buf.subarray(r.pending_out,r.pending_out+t),e.next_out),e.next_out+=t,r.pending_out+=t,e.total_out+=t,e.avail_out-=t,r.pending-=t,r.pending===0&&(r.pending_out=0))},V=(e,r)=>{Lr(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,r),e.block_start=e.strstart,Ce(e.strm)};var Oe=(e,r,t,a)=>{let i=e.avail_in;return i>a&&(i=a),i===0?0:(e.avail_in-=i,r.set(e.input.subarray(e.next_in,e.next_in+i),t),e.state.wrap===1?e.adler=se(e.adler,r,i,t):e.state.wrap===2&&(e.adler=O(e.adler,r,i,t)),e.next_in+=i,e.total_in+=i,i)},Kt=(e,r)=>{let t=e.max_chain_length,a=e.strstart,i,n,l=e.prev_length,c=e.nice_match,d=e.strstart>e.w_size-N?e.strstart-(e.w_size-N):0,o=e.window,s=e.w_mask,w=e.prev,f=e.strstart+pe,h=o[a+l-1],v=o[a+l];e.prev_length>=e.good_match&&(t>>=2),c>e.lookahead&&(c=e.lookahead);do if(i=r,!(o[i+l]!==v||o[i+l-1]!==h||o[i]!==o[a]||o[++i]!==o[a+1])){a+=2,i++;do;while(o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&a<f);if(n=pe-(f-a),a=f-pe,n>l){if(e.match_start=r,l=n,n>=c)break;h=o[a+l-1],v=o[a+l]}}while((r=w[r&s])>d&&--t!==0);return l<=e.lookahead?l:e.lookahead},Wt=e=>{let r=e.w_size,t,a,i;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=r+(r-N)&&(e.window.set(e.window.subarray(r,r+r-a),0),e.match_start-=r,e.strstart-=r,e.block_start-=r,e.insert>e.strstart&&(e.insert=e.strstart),Hr(e),a+=r),e.strm.avail_in===0)break;if(t=Oe(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=t,e.legacy_hash){if(e.lookahead+e.insert>=R)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Be(e,e.ins_h,e.window[i+1]);e.insert&&(K(e,i),i++,e.insert--,!(e.lookahead+e.insert<R)););}else if(e.lookahead+e.insert>R)for(i=e.strstart-e.insert;e.insert&&(K(e,i),i++,e.insert--,!(e.lookahead+e.insert<=R)););}while(e.lookahead<N&&e.strm.avail_in!==0)},Br=(e,r)=>{let t=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a,i,n,l=0,c=e.strm.avail_in;do{if(a=65535,n=e.bi_valid+42>>3,e.strm.avail_out<n||(n=e.strm.avail_out-n,i=e.strstart-e.block_start,a>i+e.strm.avail_in&&(a=i+e.strm.avail_in),a>n&&(a=n),a<t&&(a===0&&r!==4||r===0||a!==i+e.strm.avail_in)))break;l=r===4&&a===i+e.strm.avail_in?1:0,Ie(e,0,0,l),e.pending_buf[e.pending-4]=a,e.pending_buf[e.pending-3]=a>>8,e.pending_buf[e.pending-2]=~a,e.pending_buf[e.pending-1]=~a>>8,Ce(e.strm),i&&(i>a&&(i=a),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,a-=i),a&&(Oe(e.strm,e.strm.output,e.strm.next_out,a),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a)}while(l===0);return c-=e.strm.avail_in,c&&(c>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=c&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-c,e.strm.next_in),e.strstart),e.strstart+=c,e.insert+=c>e.w_size-e.insert?e.w_size-e.insert:c),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),l?He:r!==0&&r!==4&&e.strm.avail_in===0&&e.strstart===e.block_start?Pe:(n=e.window_size-e.strstart,e.strm.avail_in>n&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(Oe(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water<e.strstart&&(e.high_water=e.strstart),n=e.bi_valid+42>>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,t=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=t||(i||r===4)&&r!==0&&e.strm.avail_in===0&&i<=n)&&(a=i>n?n:i,l=r===4&&e.strm.avail_in===0&&a===i?1:0,Ie(e,e.block_start,a,l),e.block_start+=a,Ce(e.strm)),l?Me:B)},ye=(e,r)=>{let t,a;for(;;){if(e.lookahead<N){if(Wt(e),e.lookahead<N&&r===0)return B;if(e.lookahead===0)break}if(t=0,e.lookahead>=R&&(t=K(e,e.strstart)),t!==0&&e.strstart-t<=e.w_size-N&&(e.match_length=Kt(e,t)),e.match_length>=R)if(a=X(e,e.strstart-e.match_start,e.match_length-R),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=R){e.match_length--;do e.strstart++,t=K(e,e.strstart);while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.legacy_hash&&(e.ins_h=e.window[e.strstart],e.ins_h=Be(e,e.ins_h,e.window[e.strstart+1]));else a=X(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(a&&(V(e,!1),e.strm.avail_out===0))return B}return e.insert=e.strstart<R-1?e.strstart:R-1,r===4?(V(e,!0),e.strm.avail_out===0?Me:He):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?B:Pe},q=(e,r)=>{let t,a,i;for(;;){if(e.lookahead<N){if(Wt(e),e.lookahead<N&&r===0)return B;if(e.lookahead===0)break}if(t=0,e.lookahead>=R&&(t=K(e,e.strstart)),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=R-1,t!==0&&e.prev_length<e.max_lazy_match&&e.strstart-t<=e.w_size-N&&(e.match_length=Kt(e,t),e.match_length<=5&&(e.strategy===1||e.match_length===R&&e.strstart-e.match_start>4096)&&(e.match_length=R-1)),e.prev_length>=R&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-R,a=X(e,e.strstart-1-e.prev_match,e.prev_length-R),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(t=K(e,e.strstart));while(--e.prev_length!==0);if(e.match_available=0,e.match_length=R-1,e.strstart++,a&&(V(e,!1),e.strm.avail_out===0))return B}else if(e.match_available){if(a=X(e,0,e.window[e.strstart-1]),a&&V(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return B}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(a=X(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<R-1?e.strstart:R-1,r===4?(V(e,!0),e.strm.avail_out===0?Me:He):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?B:Pe};var z=class{constructor(e,r,t,a,i){this.good_length=e,this.max_lazy=r,this.nice_length=t,this.max_chain=a,this.func=i}},Da=[new z(0,0,0,0,Br),new z(4,4,8,4,ye),new z(4,5,16,8,ye),new z(4,6,32,32,ye),new z(4,4,16,16,q),new z(8,16,32,32,q),new z(8,16,128,128,q),new z(8,32,128,256,q),new z(32,128,258,1024,q),new z(32,258,258,4096,q)];var re=16209,Fr=16191;function Zr(e,r){let t,a,i,n,l,c,d,o,s,w,f,h,v,x,A,E,g,u,b,S,m,y,D,p,k=e.state;t=e.next_in,D=e.input,a=t+(e.avail_in-5),i=e.next_out,p=e.output,n=i-(r-e.avail_out),l=i+(e.avail_out-257),c=k.dmax,d=k.wsize,o=k.whave,s=k.wnext,w=k.window,f=k.hold,h=k.bits,v=k.lencode,x=k.distcode,A=(1<<k.lenbits)-1,E=(1<<k.distbits)-1;e:do{h<15&&(f+=D[t++]<<h,h+=8,f+=D[t++]<<h,h+=8),g=v[f&A];t:for(;;){if(u=g>>>24,f>>>=u,h-=u,u=g>>>16&255,u===0)p[i++]=g&65535;else if(u&16){b=g&65535,u&=15,u&&(h<u&&(f+=D[t++]<<h,h+=8),b+=f&(1<<u)-1,f>>>=u,h-=u),h<15&&(f+=D[t++]<<h,h+=8,f+=D[t++]<<h,h+=8),g=x[f&E];r:for(;;){if(u=g>>>24,f>>>=u,h-=u,u=g>>>16&255,u&16){if(S=g&65535,u&=15,h<u&&(f+=D[t++]<<h,h+=8,h<u&&(f+=D[t++]<<h,h+=8)),S+=f&(1<<u)-1,S>c){e.msg="invalid distance too far back",k.mode=re;break e}if(f>>>=u,h-=u,u=i-n,S>u){if(u=S-u,u>o&&k.sane){e.msg="invalid distance too far back",k.mode=re;break e}if(m=0,y=w,s===0){if(m+=d-u,u<b){b-=u;do p[i++]=w[m++];while(--u);m=i-S,y=p}}else if(s<u){if(m+=d+s-u,u-=s,u<b){b-=u;do p[i++]=w[m++];while(--u);if(m=0,s<b){u=s,b-=u;do p[i++]=w[m++];while(--u);m=i-S,y=p}}}else if(m+=s-u,u<b){b-=u;do p[i++]=w[m++];while(--u);m=i-S,y=p}for(;b>2;)p[i++]=y[m++],p[i++]=y[m++],p[i++]=y[m++],b-=3;b&&(p[i++]=y[m++],b>1&&(p[i++]=y[m++]))}else{m=i-S;do p[i++]=p[m++],p[i++]=p[m++],p[i++]=p[m++],b-=3;while(b>2);b&&(p[i++]=p[m++],b>1&&(p[i++]=p[m++]))}}else if((u&64)===0){g=x[(g&65535)+(f&(1<<u)-1)];continue r}else{e.msg="invalid distance code",k.mode=re;break e}break}}else if((u&64)===0){g=v[(g&65535)+(f&(1<<u)-1)];continue t}else if(u&32){k.mode=Fr;break e}else{e.msg="invalid literal/length code",k.mode=re;break e}break}}while(t<a&&i<l);b=h>>3,t-=b,h-=b<<3,f&=(1<<h)-1,e.next_in=t,e.next_out=i,e.avail_in=t<a?5+(a-t):5-(t-a),e.avail_out=i<l?257+(l-i):257-(i-l),k.hold=f,k.bits=h}var ae=15,at=852,it=592,nt=0,ve=1,ot=2,$r=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]),Vr=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,199,75]),Gr=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]),qr=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]),j=(e,r,t,a,i,n,l,c)=>{let d=c.bits,o=0,s=0,w=0,f=0,h=0,v=0,x=0,A=0,E=0,g=0,u,b,S,m,y,D=null,p,k=new Uint16Array(16),I=new Uint16Array(16),$=null,Xe,ee,te;for(o=0;o<=ae;o++)k[o]=0;for(s=0;s<a;s++)k[r[t+s]]++;for(h=d,f=ae;f>=1&&k[f]===0;f--);if(h>f&&(h=f),f===0)return i[n++]=20971520,i[n++]=20971520,c.bits=1,0;for(w=1;w<f&&k[w]===0;w++);for(h<w&&(h=w),A=1,o=1;o<=ae;o++)if(A<<=1,A-=k[o],A<0)return-1;if(A>0&&(e===nt||f!==1))return-1;for(I[1]=0,o=1;o<ae;o++)I[o+1]=I[o]+k[o];for(s=0;s<a;s++)r[t+s]!==0&&(l[I[r[t+s]]++]=s);if(e===nt?(D=$=l,p=20):e===ve?(D=$r,$=Vr,p=257):(D=Gr,$=qr,p=0),g=0,s=0,o=w,y=n,v=h,x=0,S=-1,E=1<<h,m=E-1,e===ve&&E>at||e===ot&&E>it)return 1;for(;;){Xe=o-x,l[s]+1<p?(ee=0,te=l[s]):l[s]>=p?(ee=$[l[s]-p],te=D[l[s]-p]):(ee=96,te=0),u=1<<o-x,b=1<<v,w=b;do b-=u,i[y+(g>>x)+b]=Xe<<24|ee<<16|te|0;while(b!==0);for(u=1<<o-1;g&u;)u>>=1;if(u!==0?(g&=u-1,g+=u):g=0,s++,--k[o]===0){if(o===f)break;o=r[t+l[s]]}if(o>h&&(g&m)!==S){for(x===0&&(x=h),y+=w,v=o-x,A=1<<v;v+x<f&&(A-=k[v+x],!(A<=0));)v++,A<<=1;if(E+=1<<v,e===ve&&E>at||e===ot&&E>it)return 1;S=g&m,i[S]=h<<24|v<<16|y-n|0}}return g!==0&&(i[y+g]=o-x<<24|4194304),c.bits=h,0},Kr=0,Yt=1,Xt=2,ce=16180,st=16181,lt=16182,ct=16183,dt=16184,ht=16185,ft=16186,ut=16187,_t=16188,wt=16189,le=16190,L=16191,xe=16192,gt=16193,Ee=16194,bt=16195,mt=16196,pt=16197,yt=16198,ie=16199,ne=16200,vt=16201,xt=16202,Et=16203,At=16204,kt=16205,Ae=16206,Dt=16207,St=16208,U=16209,ze=16210,jt=16211,Wr=852,Yr=592;var Ut=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24),Xr=class{constructor(){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}},Y=e=>{if(!e)return 1;let r=e.state;return!r||r.strm!==e||r.mode<ce||r.mode>jt?1:0},jr=e=>{if(Y(e))return-2;let r=e.state;return e.total_in=e.total_out=r.total=0,e.msg="",r.wrap&&(e.adler=r.wrap&1),r.mode=ce,r.last=0,r.havedict=0,r.flags=-1,r.dmax=32768,r.head=null,r.hold=0,r.bits=0,r.lencode=r.lendyn=new Int32Array(Wr),r.distcode=r.distdyn=new Int32Array(Yr),r.sane=1,r.back=-1,0},Jt=e=>{if(Y(e))return-2;let r=e.state;return r.wsize=0,r.whave=0,r.wnext=0,jr(e)},Jr=(e,r)=>{let t;if(Y(e))return-2;let a=e.state;return r<0?(t=0,r=-r):(t=(r>>4)+5,r<48&&(r&=15)),r&&(r<8||r>15)?-2:(a.window!==null&&a.wbits!==r&&(a.window=null),a.wrap=t,a.wbits=r,Jt(e))},Qr=(e,r)=>{if(!e)return-2;let t=new Xr;e.state=t,t.strm=e,t.window=null,t.mode=ce;let a=Jr(e,r);return a!==0&&(e.state=null),a};var Rt=!0,ke,De,ea=e=>{if(Rt){ke=new Int32Array(512),De=new Int32Array(32);let r=0;for(;r<144;)e.lens[r++]=8;for(;r<256;)e.lens[r++]=9;for(;r<280;)e.lens[r++]=7;for(;r<288;)e.lens[r++]=8;for(j(Yt,e.lens,0,288,ke,0,e.work,{bits:9}),r=0;r<32;)e.lens[r++]=5;j(Xt,e.lens,0,32,De,0,e.work,{bits:5}),Rt=!1}e.lencode=ke,e.lenbits=9,e.distcode=De,e.distbits=5},Qt=(e,r,t,a)=>{let i,n=e.state;return n.window===null&&(n.window=new Uint8Array(1<<n.wbits)),n.wsize===0&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0),a>=n.wsize?(n.window.set(r.subarray(t-n.wsize,t),0),n.wnext=0,n.whave=n.wsize):(i=n.wsize-n.wnext,i>a&&(i=a),n.window.set(r.subarray(t-a,t-a+i),n.wnext),a-=i,a?(n.window.set(r.subarray(t-a,t),0),n.wnext=a,n.whave=n.wsize):(n.wnext+=i,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=i))),0},Se=(e,r)=>{let t,a,i,n,l,c,d,o,s,w,f,h,v,x,A=0,E,g,u,b,S,m,y,D,p=new Uint8Array(4),k,I,$=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Y(e)||!e.output||!e.input&&e.avail_in!==0)return-2;t=e.state,t.mode===L&&(t.mode=xe),l=e.next_out,i=e.output,d=e.avail_out,n=e.next_in,a=e.input,c=e.avail_in,o=t.hold,s=t.bits,w=c,f=d,D=0;e:for(;;)switch(t.mode){case ce:if(t.wrap===0){t.mode=xe;break}for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.wrap&2&&o===35615){t.wbits===0&&(t.wbits=15),t.check=0,p[0]=o&255,p[1]=o>>>8&255,t.check=O(t.check,p,2,0),o=0,s=0,t.mode=st;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((o&255)<<8)+(o>>8))%31){e.msg="incorrect header check",t.mode=U;break}if((o&15)!==8){e.msg="unknown compression method",t.mode=U;break}if(o>>>=4,s-=4,y=(o&15)+8,t.wbits===0&&(t.wbits=y),y>15||y>t.wbits){e.msg="invalid window size",t.mode=U;break}t.dmax=1<<t.wbits,t.flags=0,e.adler=t.check=1,t.mode=o&512?wt:L,o=0,s=0;break;case st:for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.flags=o,(t.flags&255)!==8){e.msg="unknown compression method",t.mode=U;break}if(t.flags&57344){e.msg="unknown header flags set",t.mode=U;break}t.head&&(t.head.text=o>>8&1),t.flags&512&&t.wrap&4&&(p[0]=o&255,p[1]=o>>>8&255,t.check=O(t.check,p,2,0)),o=0,s=0,t.mode=lt;case lt:for(;s<32;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.head&&(t.head.time=o),t.flags&512&&t.wrap&4&&(p[0]=o&255,p[1]=o>>>8&255,p[2]=o>>>16&255,p[3]=o>>>24&255,t.check=O(t.check,p,4,0)),o=0,s=0,t.mode=ct;case ct:for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.head&&(t.head.xflags=o&255,t.head.os=o>>8),t.flags&512&&t.wrap&4&&(p[0]=o&255,p[1]=o>>>8&255,t.check=O(t.check,p,2,0)),o=0,s=0,t.mode=dt;case dt:if(t.flags&1024){for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.length=o,t.head&&(t.head.extra_len=o),t.flags&512&&t.wrap&4&&(p[0]=o&255,p[1]=o>>>8&255,t.check=O(t.check,p,2,0)),o=0,s=0}else t.head&&(t.head.extra=null);t.mode=ht;case ht:if(t.flags&1024&&(h=t.length,h>c&&(h=c),h&&(t.head&&(y=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(a.subarray(n,n+h),y)),t.flags&512&&t.wrap&4&&(t.check=O(t.check,a,h,n)),c-=h,n+=h,t.length-=h),t.length))break e;t.length=0,t.mode=ft;case ft:if(t.flags&2048){if(c===0)break e;h=0;do y=a[n+h++],t.head&&y&&t.length<65536&&(t.head.name+=String.fromCharCode(y));while(y&&h<c);if(t.flags&512&&t.wrap&4&&(t.check=O(t.check,a,h,n)),c-=h,n+=h,y)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=ut;case ut:if(t.flags&4096){if(c===0)break e;h=0;do y=a[n+h++],t.head&&y&&t.length<65536&&(t.head.comment+=String.fromCharCode(y));while(y&&h<c);if(t.flags&512&&t.wrap&4&&(t.check=O(t.check,a,h,n)),c-=h,n+=h,y)break e}else t.head&&(t.head.comment=null);t.mode=_t;case _t:if(t.flags&512){for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.wrap&4&&o!==(t.check&65535)){e.msg="header crc mismatch",t.mode=U;break}o=0,s=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=L;break;case wt:for(;s<32;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}e.adler=t.check=Ut(o),o=0,s=0,t.mode=le;case le:if(t.havedict===0)return e.next_out=l,e.avail_out=d,e.next_in=n,e.avail_in=c,t.hold=o,t.bits=s,2;e.adler=t.check=1,t.mode=L;case L:if(r===5||r===6)break e;case xe:if(t.last){o>>>=s&7,s-=s&7,t.mode=Ae;break}for(;s<3;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}switch(t.last=o&1,o>>>=1,s-=1,o&3){case 0:t.mode=gt;break;case 1:if(ea(t),t.mode=ie,r===6){o>>>=2,s-=2;break e}break;case 2:t.mode=mt;break;case 3:e.msg="invalid block type",t.mode=U}o>>>=2,s-=2;break;case gt:for(o>>>=s&7,s-=s&7;s<32;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if((o&65535)!==(o>>>16^65535)){e.msg="invalid stored block lengths",t.mode=U;break}if(t.length=o&65535,o=0,s=0,t.mode=Ee,r===6)break e;case Ee:t.mode=bt;case bt:if(h=t.length,h){if(h>c&&(h=c),h>d&&(h=d),h===0)break e;i.set(a.subarray(n,n+h),l),c-=h,n+=h,d-=h,l+=h,t.length-=h;break}t.mode=L;break;case mt:for(;s<14;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.nlen=(o&31)+257,o>>>=5,s-=5,t.ndist=(o&31)+1,o>>>=5,s-=5,t.ncode=(o&15)+4,o>>>=4,s-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=U;break}t.have=0,t.mode=pt;case pt:for(;t.have<t.ncode;){for(;s<3;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.lens[$[t.have++]]=o&7,o>>>=3,s-=3}for(;t.have<19;)t.lens[$[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,k={bits:t.lenbits},D=j(Kr,t.lens,0,19,t.lencode,0,t.work,k),t.lenbits=k.bits,D){e.msg="invalid code lengths set",t.mode=U;break}t.have=0,t.mode=yt;case yt:for(;t.have<t.nlen+t.ndist;){for(;A=t.lencode[o&(1<<t.lenbits)-1],E=A>>>24,g=A>>>16&255,u=A&65535,!(E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(u<16)o>>>=E,s-=E,t.lens[t.have++]=u;else{if(u===16){for(I=E+2;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(o>>>=E,s-=E,t.have===0){e.msg="invalid bit length repeat",t.mode=U;break}y=t.lens[t.have-1],h=3+(o&3),o>>>=2,s-=2}else if(u===17){for(I=E+3;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}o>>>=E,s-=E,y=0,h=3+(o&7),o>>>=3,s-=3}else{for(I=E+7;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}o>>>=E,s-=E,y=0,h=11+(o&127),o>>>=7,s-=7}if(t.have+h>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=U;break}for(;h--;)t.lens[t.have++]=y}}if(t.mode===U)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=U;break}if(t.lenbits=9,k={bits:t.lenbits},D=j(Yt,t.lens,0,t.nlen,t.lencode,0,t.work,k),t.lenbits=k.bits,D){e.msg="invalid literal/lengths set",t.mode=U;break}if(t.distbits=6,t.distcode=t.distdyn,k={bits:t.distbits},D=j(Xt,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,k),t.distbits=k.bits,D){e.msg="invalid distances set",t.mode=U;break}if(t.mode=ie,r===6)break e;case ie:t.mode=ne;case ne:if(c>=6&&d>=258){e.next_out=l,e.avail_out=d,e.next_in=n,e.avail_in=c,t.hold=o,t.bits=s,Zr(e,f),l=e.next_out,i=e.output,d=e.avail_out,n=e.next_in,a=e.input,c=e.avail_in,o=t.hold,s=t.bits,t.mode===L&&(t.back=-1);break}for(t.back=0;A=t.lencode[o&(1<<t.lenbits)-1],E=A>>>24,g=A>>>16&255,u=A&65535,!(E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(g&&(g&240)===0){for(b=E,S=g,m=u;A=t.lencode[m+((o&(1<<b+S)-1)>>b)],E=A>>>24,g=A>>>16&255,u=A&65535,!(b+E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}o>>>=b,s-=b,t.back+=b}if(o>>>=E,s-=E,t.back+=E,t.length=u,g===0){t.mode=kt;break}if(g&32){t.back=-1,t.mode=L;break}if(g&64){e.msg="invalid literal/length code",t.mode=U;break}t.extra=g&15,t.mode=vt;case vt:if(t.extra){for(I=t.extra;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.length+=o&(1<<t.extra)-1,o>>>=t.extra,s-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=xt;case xt:for(;A=t.distcode[o&(1<<t.distbits)-1],E=A>>>24,g=A>>>16&255,u=A&65535,!(E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if((g&240)===0){for(b=E,S=g,m=u;A=t.distcode[m+((o&(1<<b+S)-1)>>b)],E=A>>>24,g=A>>>16&255,u=A&65535,!(b+E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}o>>>=b,s-=b,t.back+=b}if(o>>>=E,s-=E,t.back+=E,g&64){e.msg="invalid distance code",t.mode=U;break}t.offset=u,t.extra=g&15,t.mode=Et;case Et:if(t.extra){for(I=t.extra;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.offset+=o&(1<<t.extra)-1,o>>>=t.extra,s-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=U;break}t.mode=At;case At:if(d===0)break e;if(h=f-d,t.offset>h){if(h=t.offset-h,h>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=U;break}h>t.wnext?(h-=t.wnext,v=t.wsize-h):v=t.wnext-h,h>t.length&&(h=t.length),x=t.window}else x=i,v=l-t.offset,h=t.length;h>d&&(h=d),d-=h,t.length-=h;do i[l++]=x[v++];while(--h);t.length===0&&(t.mode=ne);break;case kt:if(d===0)break e;i[l++]=t.length,d--,t.mode=ne;break;case Ae:if(t.wrap){for(;s<32;){if(c===0)break e;c--,o|=a[n++]<<s,s+=8}if(f-=d,e.total_out+=f,t.total+=f,t.wrap&4&&f&&(e.adler=t.check=t.flags?O(t.check,i,f,l-f):se(t.check,i,f,l-f)),f=d,t.wrap&4&&(t.flags?o:Ut(o))!==t.check){e.msg="incorrect data check",t.mode=U;break}o=0,s=0}t.mode=Dt;case Dt:if(t.wrap&&t.flags){for(;s<32;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.wrap&4&&o!==(t.total&4294967295)){e.msg="incorrect length check",t.mode=U;break}o=0,s=0}t.mode=St;case St:D=1;break e;case U:D=-3;break e;case ze:return-4;case jt:default:return-2}return e.next_out=l,e.avail_out=d,e.next_in=n,e.avail_in=c,t.hold=o,t.bits=s,(t.wsize||f!==e.avail_out&&t.mode<U&&(t.mode<Ae||r!==4))&&Qt(e,e.output,e.next_out,f-e.avail_out)?(t.mode=ze,-4):(w-=e.avail_in,f-=e.avail_out,e.total_in+=w,e.total_out+=f,t.total+=f,t.wrap&4&&f&&(e.adler=t.check=t.flags?O(t.check,i,f,e.next_out-f):se(t.check,i,f,e.next_out-f)),e.data_type=t.bits+(t.last?64:0)+(t.mode===L?128:0)+(t.mode===ie||t.mode===Ee?256:0),(w===0&&f===0||r===4)&&D===0&&(D=-5),D)},It=e=>{if(Y(e))return-2;let r=e.state;return r.window&&(r.window=null),e.state=null,0};var Ct=(e,r)=>{let t=r.length,a,i,n;return Y(e)||(a=e.state,a.wrap!==0&&a.mode!==le)?-2:a.mode===le&&(i=1,i=se(i,r,t,0),i!==a.check)?-3:(n=Qt(e,r,t,t),n?(a.mode=ze,-4):(a.havedict=1,0))},ta=class{constructor(){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 ra=e=>{let r=new Uint8Array(e.reduce((a,i)=>a+i.length,0)),t=0;for(let a of e)r.set(a,t),t+=a.length;return r};var Ot=Object.prototype.toString,aa={chunkSize:1024*64,windowBits:15,raw:!1,dictionary:new Uint8Array(0)},de=class{options;err;msg;ended;started;chunks;strm;result;constructor(e={}){this.options=Object.assign({},aa,e);let r=this.options;r.raw&&r.windowBits>=0&&r.windowBits<16&&(r.windowBits=-r.windowBits,r.windowBits===0&&(r.windowBits=-15)),r.windowBits>=0&&r.windowBits<16&&!e.windowBits&&(r.windowBits+=32),r.windowBits>15&&r.windowBits<48&&(r.windowBits&15)===0&&(r.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.started=!1,this.chunks=[],this.result=new Uint8Array(0),this.strm=new ta,this.strm.avail_out=0;let t=Qr(this.strm,r.windowBits);if(t!==0)throw new Error(me[t]);Ot.call(r.dictionary)==="[object ArrayBuffer]"&&(r.dictionary=new Uint8Array(r.dictionary));let a=r.dictionary;if(r.raw&&a.length&&(t=Ct(this.strm,a),t!==0))throw new Error(me[t])}push(e,r=!1){let t=this.strm,a=this.options.chunkSize,i,n,l;if(this.ended)return this.err===0;for(typeof r=="number"?n=r:n=r===!0?4:0,Ot.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length,this.started||(this.started=!0,this.onStart(t));;){if(t.avail_out===0&&(t.output=new Uint8Array(a),t.next_out=0,t.avail_out=a),i=Se(t,n),i===2){let c=this.options.dictionary;c.length&&(i=Ct(t,c),i===0?i=Se(t,n):i===-3&&(i=2))}for(;t.avail_in>0&&i===1&&t.state.wrap&2&&t.state.flags!==0&&t.input[t.next_in]!==0;)Jt(t),i=Se(t,n);if(i===-2||i===-3||i===2||i===-4)break;if(l=t.avail_out,t.next_out&&(t.avail_out===0||i===1||n>0)&&(this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out)),t.avail_out=0,t.next_out=0),!((i===0||i===-5)&&l===0)){if(i===1){i=It(this.strm);break}if(t.avail_in===0){if(n===4){i=It(this.strm),i===0&&(i=-5);break}return!0}}}return this.err=i,this.msg=t.msg||me[i],this.ended=!0,this.onEnd(i),i===0}onStart(e){}onData(e){this.chunks.push(e)}onEnd(e){e===0&&(this.result=ra(this.chunks)),this.chunks=[]}};function ia(e,r={}){let t=new de(r);if(t.push(e,!0),t.err)throw new Error(t.msg);let a=t.result;return r.toText?new TextDecoder().decode(a):a}function er(e,r={}){return ia(e,{...r,raw:!0})}var na=(()=>{let e=new Uint32Array(256);for(let r=0;r<256;r+=1){let t=r;for(let a=0;a<8;a+=1)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t>>>0}return e})(),Fe=(e,r)=>(na[(e^r)&255]^e>>>8)>>>0,J=class{state=4294967295;update(r){let t=this.state;for(let a=0;a<r.length;a+=1)t=Fe(t,r[a]);this.state=t}digest(){return(this.state^4294967295)>>>0}},fe=e=>{let r=new J;return r.update(e),r.digest()},T=e=>(e<<1^(e&128?27:0))&255,M=(()=>{let e=new Uint8Array(256),r=new Uint8Array(256),t=new Uint8Array(256),a=1;for(let n=0;n<255;n+=1)r[n]=a,t[a]=n,a=(a^T(a))&255;let i=n=>n===0?0:r[(255-t[n])%255];for(let n=0;n<256;n+=1){let l=i(n),c=l;for(let d=0;d<4;d+=1)l=(l<<1|l>>7)&255,c^=l;e[n]=(c^99)&255}return e})(),oa=(()=>{let e=new Uint8Array(11),r=1;for(let t=1;t<=10;t+=1)e[t]=r,r=T(r);return e})(),sa=e=>{let r=e.length/4,t=r+6,a=4*(t+1),i=new Uint8Array(a*4);i.set(e);for(let n=r;n<a;n+=1){let l=i[(n-1)*4],c=i[(n-1)*4+1],d=i[(n-1)*4+2],o=i[(n-1)*4+3];if(n%r===0){let s=l;l=M[c]^oa[n/r],c=M[d],d=M[o],o=M[s]}else r>6&&n%r===4&&(l=M[l],c=M[c],d=M[d],o=M[o]);i[n*4]=i[(n-r)*4]^l,i[n*4+1]=i[(n-r)*4+1]^c,i[n*4+2]=i[(n-r)*4+2]^d,i[n*4+3]=i[(n-r)*4+3]^o}return{w:i,rounds:t}},la=({w:e,rounds:r},t)=>{let a=t.slice(0,16),i=n=>{for(let l=0;l<16;l+=1)a[l]^=e[n*16+l]};i(0);for(let n=1;n<=r;n+=1){for(let c=0;c<16;c+=1)a[c]=M[a[c]];let l=a[1];if(a[1]=a[5],a[5]=a[9],a[9]=a[13],a[13]=l,l=a[2],a[2]=a[10],a[10]=l,l=a[6],a[6]=a[14],a[14]=l,l=a[3],a[3]=a[15],a[15]=a[11],a[11]=a[7],a[7]=l,n!==r)for(let c=0;c<4;c+=1){let d=c*4,o=a[d],s=a[d+1],w=a[d+2],f=a[d+3];a[d]=T(o)^(T(s)^s)^w^f,a[d+1]=o^T(s)^(T(w)^w)^f,a[d+2]=o^s^T(w)^(T(f)^f),a[d+3]=T(o)^o^s^w^T(f)}i(n)}return a};var ca=(e,r)=>{let t=sa(r),a=new Uint8Array(e.length),i=new Uint8Array(16);for(let n=0,l=1;n<e.length;n+=16,l+=1){i.fill(0);for(let o=l,s=0;o>0&&s<16;o=Math.floor(o/256),s+=1)i[s]=o&255;let c=la(t,i),d=Math.min(16,e.length-n);for(let o=0;o<d;o+=1)a[n+o]=e[n+o]^c[o]}return a},Ze=class{k0=305419896;k1=591751049;k2=878082192;constructor(r){for(let t of r)this.update(t)}update(r){this.k0=Fe(this.k0,r),this.k1=this.k1+(this.k0&255)>>>0,this.k1=Math.imul(this.k1,134775813)+1>>>0,this.k2=Fe(this.k2,this.k1>>>24)}streamByte(){let r=(this.k2|2)&65535;return r*(r^1)>>>8&255}},tr=(e,r)=>{let t=new Ze(r),a=new Uint8Array(e.length);for(let i=0;i<e.length;i+=1){let n=(e[i]^t.streamByte())&255;t.update(n),a[i]=n}return{plaintext:a.subarray(12),checkByte:a[11]}};var da={1:{saltLength:8,keyLength:16},2:{saltLength:12,keyLength:24},3:{saltLength:16,keyLength:32}},$e=e=>{let r=new DataView(e);for(let t=0;t+4<=e.byteLength;){let a=r.getUint16(t,!0),i=r.getUint16(t+2,!0),n=t+4+i;if(n>e.byteLength)return null;if(a===39169)return i<7?null:{strength:r.getUint8(t+4+4),actualMethod:r.getUint16(t+4+5,!0)};t=n}return null},he=e=>{let r=new Uint8Array(e.byteLength);return r.set(e),r.buffer},ha=async(e,r,t)=>{let a=globalThis.crypto.subtle,i=await a.importKey("raw",he(e),"PBKDF2",!1,["deriveBits"]),n=new Uint8Array(await a.deriveBits({name:"PBKDF2",salt:he(r),iterations:1e3,hash:"SHA-1"},i,(t*2+2)*8));return{encKey:n.subarray(0,t),authKey:n.subarray(t,t*2),verify:n.subarray(t*2,t*2+2)}},fa=async(e,r)=>{let t=globalThis.crypto.subtle,a=await t.importKey("raw",he(e),{name:"HMAC",hash:"SHA-1"},!1,["sign"]);return new Uint8Array(await t.sign("HMAC",a,he(r)))},F=class extends Error{constructor(t){super(t);this.reason=t}reason},rr=async(e,r,t)=>{let a=da[t];if(!a)throw new F("UNSUPPORTED");let{saltLength:i,keyLength:n}=a;if(e.length<i+12)throw new F("BAD_MAC");let l=e.subarray(0,i),c=e.subarray(i,i+2),d=e.subarray(e.length-10),o=e.subarray(i+2,e.length-10),{encKey:s,authKey:w,verify:f}=await ha(r,l,n);if(f[0]!==c[0]||f[1]!==c[1])throw new F("WRONG_PASSWORD");let h=await fa(w,o),v=d.length===10;for(let x=0;x<10;x+=1)h[x]!==d[x]&&(v=!1);if(!v)throw new F("BAD_MAC");return ca(o,s)};var ar=1347092738,Ke=1347093252,Ve=1347093766,ua=1347094280,_a=1347094022,wa=1347094023,G=4294967295,H=65535,_=class extends Error{code;constructor(r,t="UNKNOWN"){super(r),this.name=this.constructor.name,this.code=t}},ga=e=>{switch(e.reason){case"WRONG_PASSWORD":return new _("Incorrect password (AES)","WRONG_PASSWORD");case"UNSUPPORTED":return new _("Unsupported AES key strength","UNSUPPORTED_ENCRYPTION");default:return new _("AES authentication failed (corrupt data or wrong password)","DECRYPTION_FAILED")}},ir=(e,r)=>{if(e<200||e>=300)throw new _(`Could not fetch remote ZIP at ${r}: HTTP status ${e}`,"HTTP_ERROR")},ue=(e,r,t,a,i,n="RANGE_RESPONSE_MISMATCH")=>{if(ir(e.status,r),e.status!==206)throw new _(`Server did not honour Range request for ${r}: HTTP status ${e.status}`,"RANGE_NOT_SUPPORTED");let l=e.headers.get("content-range"),c=l?.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(!c)throw new _(`Invalid or missing Content-Range from ${r}: ${l??"missing"}`,"RANGE_RESPONSE_MISMATCH");let d=Number(c[1]),o=Number(c[2]),s=Number(c[3]);if(d!==t||s!==i)throw new _(`Unexpected Content-Range from ${r}: ${l}`,"RANGE_RESPONSE_MISMATCH");if(o!==a)throw new _(`Truncated Range response from ${r}: expected ${t}-${a}, got ${l}`,o<a?n:"RANGE_RESPONSE_MISMATCH")},_e=class{contentLength;url;centralDirectoryRecords;endOfCentralDirectory;method;credentials;redirect;signal;timeoutMs;requestInit;constructor({contentLength:r,url:t,centralDirectoryRecords:a,endOfCentralDirectory:i,method:n,credentials:l="same-origin",redirect:c,signal:d,timeoutMs:o,requestInit:s}){this.contentLength=r,this.url=t,this.method=n,this.centralDirectoryRecords=a,this.endOfCentralDirectory=i,this.credentials=l,this.redirect=c,this.signal=d,this.timeoutMs=o,this.requestInit=s}requestInitFor(r,t,a){let i=[];return this.signal&&i.push(this.signal),a?.signal&&i.push(a.signal),nr({credentials:this.credentials,redirect:this.redirect,signal:i.length<=1?i[0]:AbortSignal.any(i),timeoutMs:a?.timeoutMs??this.timeoutMs,requestInit:this.requestInit},r,t)}files(){return this.centralDirectoryRecords.map(r=>({filename:r.data.filename,size:r.data.uncompressedSize,modified:We(r.data.lastModifiedDate,r.data.lastModifiedTime),attributes:r.data.externalFileAttributes}))}async fetch(r,t,a){let{file:i,response:n}=await this.fetchEntryResponse(r,t,a),l=qe(await n.arrayBuffer(),i.data.compressedSize);if(!l)throw new _("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");return ma(i,l),this.decodeEntry(i,new Uint8Array(l.meta.compressedData),l.data.compressionMethod,a)}async decodeEntry(r,t,a,i){let n=t,l=a,c=r.data.generalPurposeBitFlag;if(c&1){if(c&64)throw new _("Strong-encrypted ZIP entries are not supported","UNSUPPORTED_ENCRYPTION");if(!i?.password)throw new _(`Password required for encrypted entry: ${r.data.filename}`,"UNSUPPORTED_ENCRYPTION");let s=new TextEncoder().encode(i.password),w=l===99?$e(r.data.extraField):null;if(w){try{n=await rr(n,s,w.strength)}catch(f){throw f instanceof F?ga(f):new _(`AES decryption failed: ${String(f)}`,"DECRYPTION_FAILED")}l=w.actualMethod}else{let{plaintext:f,checkByte:h}=tr(n,s),v=c&8?r.data.lastModifiedTime>>8&255:r.data.crc32>>>24&255;if(h!==v)throw new _(`Incorrect password for entry: ${r.data.filename}`,"WRONG_PASSWORD");n=f}}let d=i?.maxUncompressedSize,o;if(l===0){if(d!==void 0&&n.byteLength>d)throw new _(`Uncompressed size exceeds maxUncompressedSize (${d} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");o=n}else o=pa(n,d);if(i?.verifyCrc){let s=fe(o);if(s!==r.data.crc32)throw new _(`CRC-32 mismatch for ${r.data.filename}: expected ${r.data.crc32}, got ${s}`,"CRC_MISMATCH")}return o}async fetchStream(r,t,a){let{file:i,response:n}=await this.fetchEntryResponse(r,t,a);if(!n.body)throw new _("Remote ZIP response has no body to stream","LOCAL_HEADER_PARSE_FAILED");if(i.data.generalPurposeBitFlag&1){let d=qe(await n.arrayBuffer(),i.data.compressedSize);if(!d)throw new _("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let o=await this.decodeEntry(i,new Uint8Array(d.meta.compressedData),d.data.compressionMethod,a);return new ReadableStream({start(s){s.enqueue(o),s.close()}})}let l=n.body.getReader(),c=ya(l,{compressedSize:i.data.compressedSize,compressionMethod:i.data.compressionMethod,expectedFilename:i.data.filename,expectedFlags:i.data.generalPurposeBitFlag,maxBytes:a?.maxUncompressedSize,expectedCrc:a?.verifyCrc?i.data.crc32:void 0});return new ReadableStream({async pull(d){try{let{done:o,value:s}=await c.next();o?d.close():d.enqueue(s)}catch(o){await l.cancel(o),d.error(o)}},async cancel(d){await l.cancel(d)}})}async fetchEntryResponse(r,t,a){let i=this.centralDirectoryRecords.find(v=>v.data.filename===r);if(!i)throw new _(`File not found in remote ZIP: ${r}`,"FILE_NOT_FOUND");ba(i);let n=i.data.localFileHeaderRelativeOffset;if(n+30>this.contentLength)throw new _(`Local file header is out of bounds for ${i.data.filename}`,"INVALID_ARCHIVE");let c=await(await this.fetchRange(n,n+29,t,a,"LOCAL_HEADER_PARSE_FAILED")).arrayBuffer(),d=new DataView(c);if(d.getUint32(0)!==Ke)throw new _("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let o=d.getUint16(6,!0),s=d.getUint16(8,!0);if(o!==i.data.generalPurposeBitFlag||s!==i.data.compressionMethod)throw new _(`Local header disagrees with central directory for ${i.data.filename}`,"INVALID_ARCHIVE");let w=30+d.getUint16(26,!0)+d.getUint16(28,!0),f=n+w+i.data.compressedSize;if(f>this.contentLength)throw new _(`Entry data is out of bounds for ${i.data.filename}`,"INVALID_ARCHIVE");let h=await this.fetchRange(n,f-1,t,a,"TRUNCATED_ENTRY");return{file:i,response:h}}async fetchRange(r,t,a,i,n){let l=new Headers(a);l.set("Range",`bytes=${r}-${t}`);let c=await fetch(this.url.toString(),this.requestInitFor(this.method,l,i));return ue(c,this.url,r,t,this.contentLength,n),c}},ba=e=>{let{compressionMethod:r,generalPurposeBitFlag:t}=e.data;if(r===99){let a=$e(e.data.extraField);if(!(t&1)||!a)throw new _(`Invalid WinZip AES metadata for ${e.data.filename}`,"INVALID_ARCHIVE");if(a.actualMethod!==0&&a.actualMethod!==8)throw new _(`Unsupported compression method ${a.actualMethod} for ${e.data.filename}`,"UNSUPPORTED_COMPRESSION");return}if(r!==0&&r!==8)throw new _(`Unsupported compression method ${r} for ${e.data.filename}`,"UNSUPPORTED_COMPRESSION")},ma=(e,r)=>{if(r.data.filename!==e.data.filename||r.data.generalPurposeBitFlag!==e.data.generalPurposeBitFlag||r.data.compressionMethod!==e.data.compressionMethod)throw new _(`Local header disagrees with central directory for ${e.data.filename}`,"INVALID_ARCHIVE")},pa=(e,r)=>{if(r===void 0)try{return er(e)}catch(d){throw new _(`Failed to inflate remote ZIP entry: ${String(d)}`,"UNKNOWN")}let t=new de({raw:!0}),a=[],i=0,n=!1;if(t.onData=d=>{if(n)return;let o=d;if(i+=o.length,i>r){n=!0;return}a.push(o)},t.push(e,!0),n)throw new _(`Decompressed size exceeds maxUncompressedSize (${r} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");if(t.err)throw new _(`Failed to inflate remote ZIP entry: ${t.msg}`,"UNKNOWN");let l=new Uint8Array(i),c=0;for(let d of a)l.set(d,c),c+=d.length;return l};async function*ya(e,r){let{compressedSize:t,compressionMethod:a,expectedFilename:i,expectedFlags:n,maxBytes:l,expectedCrc:c}=r,d=c!==void 0?new J:void 0,o=new Uint8Array(0),s=m=>{let y=new Uint8Array(o.length+m.length);y.set(o),y.set(m,o.length),o=y},w=async m=>{for(;o.length<m;){let{done:y,value:D}=await e.read();if(y)throw new _("Truncated local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");s(D)}};await w(30);let f=new DataView(o.buffer,o.byteOffset,o.byteLength);if(f.getUint32(0)!==Ke)throw new _("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let h=30+f.getUint16(26,!0)+f.getUint16(28,!0);await w(h);let v=f.getUint16(26,!0),x=Q(o.buffer.slice(o.byteOffset+30,o.byteOffset+30+v),Ye(n));if(f.getUint16(6,!0)!==n||f.getUint16(8,!0)!==a||x!==i)throw new _(`Local header disagrees with central directory for ${i}`,"INVALID_ARCHIVE");let A=0,E=[],g=m=>{if(A+=m.length,l!==void 0&&A>l)throw new _(`Decompressed size exceeds maxUncompressedSize (${l} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");d?.update(m),E.push(m)},u=a===0?void 0:new de({raw:!0});u&&(u.onData=m=>g(m));let b=t,S=m=>{let y=m.length>b?m.subarray(0,b):m;if(b-=y.length,u){if(u.push(y,b===0),u.err)throw new _(`Failed to inflate remote ZIP entry: ${u.msg}`,"UNKNOWN")}else g(y)};for(S(o.subarray(h)),yield*E.splice(0);b>0;){let{done:m,value:y}=await e.read();if(m)break;S(y),yield*E.splice(0)}if(b!==0)throw new _(`Truncated compressed data for ${i}`,"TRUNCATED_ENTRY");if(d&&d.digest()!==c)throw new _(`CRC-32 mismatch: expected ${c}, got ${d.digest()}`,"CRC_MISMATCH")}var va=(e,r)=>{let t=[];if(e&&t.push(e),r!==void 0&&t.push(AbortSignal.timeout(r)),t.length!==0)return t.length===1?t[0]:AbortSignal.any(t)},nr=(e,r,t)=>{let a=new Headers(e.requestInit?.headers);return t&&t.forEach((i,n)=>a.set(n,i)),{...e.requestInit,method:r,headers:a,redirect:e.redirect??e.requestInit?.redirect??"follow",credentials:e.credentials,signal:va(e.signal,e.timeoutMs)}},Ge=class{url;headUrl;additionalHeaders;method;credentials;redirect;signal;timeoutMs;requestInit;constructor({url:r,headUrl:t,additionalHeaders:a,method:i="GET",credentials:n="same-origin",redirect:l,signal:c,timeoutMs:d,requestInit:o}){this.url=r,this.headUrl=t??r,this.additionalHeaders=a,this.method=i,this.credentials=n,this.redirect=l,this.signal=c,this.timeoutMs=d,this.requestInit=o}requestInitFor(r,t){return nr({credentials:this.credentials,redirect:this.redirect,signal:this.signal,timeoutMs:this.timeoutMs,requestInit:this.requestInit},r,t)}async populate(){let r=await fetch(this.headUrl.toString(),this.requestInitFor("HEAD",this.additionalHeaders));ir(r.status,this.headUrl);let t=r.headers.get("content-length");if(!t)throw new _("Could not get Content-Length of URL","CONTENT_LENGTH_MISSING");if(!/^\d+$/.test(t))throw new _(`Invalid Content-Length: ${t}`,"INVALID_CONTENT_LENGTH");let a=Number(t);if(!Number.isSafeInteger(a)||a<22)throw new _(`Invalid Content-Length: ${t}`,"INVALID_CONTENT_LENGTH");let{eocd:i,cdOffset:n,cdSize:l,cdCount:c}=await this.fetchEndOfCentralDirectory(a,this.additionalHeaders),d=await this.fetchCentralDirectoryRecords(n,l,c,a,this.additionalHeaders);return new _e({url:this.url,contentLength:a,endOfCentralDirectory:i,centralDirectoryRecords:d,method:this.method,credentials:this.credentials,redirect:this.redirect,signal:this.signal,timeoutMs:this.timeoutMs,requestInit:this.requestInit})}async fetchEndOfCentralDirectory(r,t){let i=[128,65577];for(let n of i){let l=Math.max(0,r-n),c=new Headers(t);c.set("Range",`bytes=${l}-${r-1}`);let d=await fetch(this.url.toString(),this.requestInitFor(this.method,c));ue(d,this.url,l,r-1,r);let o=await d.arrayBuffer(),s=fr(o);if(s){let w=s.data.centralDirectoryByteOffset,f=s.data.centralDirectoryByteSize,h=s.data.centralDirectoryRecordCount;if(s.data.diskNumber!==0&&s.data.diskNumber!==H||s.data.cdDisk!==0&&s.data.cdDisk!==H||s.data.centralDirectoryDiskNumber!==h&&s.data.centralDirectoryDiskNumber!==H&&h!==H)throw new _("Multi-disk ZIP archives are not supported","UNSUPPORTED_MULTI_DISK");if(or(s)){let v=lr(o);if(!v){if(n!==i[i.length-1]&&l>0)continue;throw new _("ZIP64 EOCD locator not found","UNSUPPORTED_ZIP64")}if(v.diskWithZip64EOCD!==0||v.totalDisks!==1)throw new _("Multi-disk ZIP archives are not supported","UNSUPPORTED_MULTI_DISK");let x=await this.fetchZip64EOCD(v.zip64EOCDOffset,r,t);if(x.diskNumber!==0||x.cdDisk!==0||x.centralDirectoryDiskRecordCount!==x.centralDirectoryRecordCount)throw new _("Multi-disk ZIP archives are not supported","UNSUPPORTED_MULTI_DISK");w=x.centralDirectoryByteOffset,f=x.centralDirectoryByteSize,h=x.centralDirectoryRecordCount}if(w+f>r)throw new _(`Central directory is out of bounds (offset ${w}, size ${f}, archive ${r} bytes)`,"CENTRAL_DIRECTORY_OUT_OF_BOUNDS");return{eocd:s,cdOffset:w,cdSize:f,cdCount:h}}if(l===0)break}throw new _("Could not get EOCD record of remote ZIP","EOCD_NOT_FOUND")}async fetchZip64EOCD(r,t,a){if(r+56>t)throw new _("ZIP64 EOCD offset is out of bounds","INVALID_ARCHIVE");let i=new Headers(a);i.set("Range",`bytes=${r}-${r+55}`);let n=await fetch(this.url.toString(),this.requestInitFor(this.method,i));ue(n,this.url,r,r+55,t);let l=cr(await n.arrayBuffer());if(!l)throw new _("ZIP64 EOCD record not found","UNSUPPORTED_ZIP64");return l}async fetchCentralDirectoryRecords(r,t,a,i,n){if(t===0){if(a!==0)throw new _("Central directory record count does not match its size","INVALID_ARCHIVE");return[]}let l=new Headers(n);l.set("Range",`bytes=${r}-${r+t-1}`);let c=await fetch(this.url.toString(),this.requestInitFor(this.method,l));ue(c,this.url,r,r+t-1,i);let d=await c.arrayBuffer(),o=dr(d);if(o.length!==a)throw new _(`Central directory contains ${o.length} records; expected ${a}`,"INVALID_ARCHIVE");if(o.some(s=>s.data.startingDiskNumber!==0))throw new _("Multi-disk ZIP archives are not supported","UNSUPPORTED_MULTI_DISK");return o}},We=(e,r)=>{let t=e&31||1,a=e>>5&15||1,i=(e>>9&127)+1980,n=r>>11&31,l=r>>5&63,c=(r&31)<<1,d=s=>s.toString().padStart(2,"0"),o=`${i}-${d(a)}-${d(t)}T${d(n)}:${d(l)}:${d(c)}`;return Number.isNaN(Date.parse(o))?We(0,0):o},or=e=>e.data.diskNumber===H||e.data.cdDisk===H||e.data.centralDirectoryDiskNumber===H||e.data.centralDirectoryRecordCount===H||e.data.centralDirectoryByteSize===G||e.data.centralDirectoryByteOffset===G,Z=(e,r)=>{let t=e.getBigUint64(r,!0);if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new _(`ZIP64 value ${t} exceeds Number.MAX_SAFE_INTEGER`,"UNSUPPORTED_ZIP64");return Number(t)},sr=(e,r)=>{let t=new DataView(e);for(let a=0;a+4<=e.byteLength;){let i=t.getUint16(a,!0),n=t.getUint16(a+2,!0),l=a+4,c=l+n;if(c>e.byteLength)throw new _("Truncated ZIP extra field","INVALID_ARCHIVE");if(i===1){let d={},o=l,s=(r.uncompressed?8:0)+(r.compressed?8:0)+(r.offset?8:0)+(r.disk?4:0);if(n<s)throw new _("ZIP64 extra field is missing required values","INVALID_ARCHIVE");return r.uncompressed&&(d.uncompressedSize=Z(t,o),o+=8),r.compressed&&(d.compressedSize=Z(t,o),o+=8),r.offset&&(d.localHeaderOffset=Z(t,o),o+=8),r.disk&&(d.diskStart=t.getUint32(o,!0)),d}a=c}throw new _("ZIP64 sentinel has no ZIP64 extra field","INVALID_ARCHIVE")},lr=e=>{let r=new DataView(e);for(let t=e.byteLength-20;t>=0;t-=1)if(r.getUint32(t)===wa)return{diskWithZip64EOCD:r.getUint32(t+4,!0),zip64EOCDOffset:Z(r,t+8),totalDisks:r.getUint32(t+16,!0)};return null},cr=e=>{let r=new DataView(e);for(let t=0;t<=e.byteLength-56;t+=1)if(r.getUint32(t)===_a)return{diskNumber:r.getUint32(t+16,!0),cdDisk:r.getUint32(t+20,!0),centralDirectoryDiskRecordCount:Z(r,t+24),centralDirectoryRecordCount:Z(r,t+32),centralDirectoryByteSize:Z(r,t+40),centralDirectoryByteOffset:Z(r,t+48)};return null},xa="\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0",Q=(e,r)=>{if(r)return new TextDecoder().decode(e);let t="";for(let a of new Uint8Array(e))t+=a<128?String.fromCharCode(a):xa[a-128];return t},Ye=e=>!!(e>>11&1),dr=e=>{let r=[],t=new DataView(e),a=0;for(;a+4<=e.byteLength;){let i=t.getUint32(a);if(i===Ve)break;if(i!==ar)throw new _(`Unexpected data in central directory at offset ${a}`,"INVALID_ARCHIVE");let n=hr(e.slice(a));if(!n)throw new _(`Truncated central directory record at offset ${a}`,"INVALID_ARCHIVE");r.push(n),a+=n.meta.length}if(a!==e.byteLength&&(a+4>e.byteLength||t.getUint32(a)!==Ve))throw new _("Truncated central directory","INVALID_ARCHIVE");return r},hr=e=>{let t=new DataView(e);for(let a=0;a<=e.byteLength-46;a+=1)if(t.getInt32(a)===ar){let i=t.getUint16(a+28,!0),n=t.getUint16(a+30,!0),l=t.getUint16(a+32,!0),c=46+i+n+l;if(a+c>e.byteLength)throw new _("Truncated central directory record","INVALID_ARCHIVE");let d=t.getUint32(a+20,!0),o=t.getUint32(a+24,!0),s=t.getUint16(a+34,!0),w=t.getUint32(a+42,!0),f=e.slice(a+46+i,a+46+i+n),h={uncompressed:o===G,compressed:d===G,offset:w===G,disk:s===H},v=h.uncompressed||h.compressed||h.offset||h.disk?sr(f,h):{},x=Ye(t.getUint16(a+8,!0));return{meta:{length:c},data:{signature:e.slice(a,a+4),versionMadeBy:t.getUint16(a+4,!0),versionToExtract:t.getUint16(a+6,!0),generalPurposeBitFlag:t.getUint16(a+8,!0),compressionMethod:t.getUint16(a+10,!0),lastModifiedTime:t.getUint16(a+12,!0),lastModifiedDate:t.getUint16(a+14,!0),crc32:t.getUint32(a+16,!0),compressedSize:v.compressedSize??d,uncompressedSize:v.uncompressedSize??o,filenameLength:i,extraFieldLength:n,fileCommentLength:l,startingDiskNumber:v.diskStart??s,internalFileAttributes:t.getUint16(a+36,!0),externalFileAttributes:t.getUint32(a+38,!0),localFileHeaderRelativeOffset:v.localHeaderOffset??w,filename:Q(e.slice(a+46,a+46+i),x),extraField:f,fileComment:Q(e.slice(a+46+i+n,a+46+i+n+l),x)}}}return null},fr=e=>{let t=new DataView(e),a=new TextDecoder;for(let i=e.byteLength-22;i>=0;i-=1)if(t.getUint32(i)===Ve){let n=t.getUint16(i+20,!0);if(i+22+n!==e.byteLength)continue;return{meta:{},data:{signature:e.slice(i,i+4),diskNumber:t.getUint16(i+4,!0),cdDisk:t.getUint16(i+6,!0),centralDirectoryDiskNumber:t.getUint16(i+8,!0),centralDirectoryRecordCount:t.getUint16(i+10,!0),centralDirectoryByteSize:t.getUint32(i+12,!0),centralDirectoryByteOffset:t.getUint32(i+16,!0),commentLength:n,comment:a.decode(e.slice(i+22,i+22+n))}}}return null},qe=(e,r=0)=>{let a=new DataView(e);for(let i=0;i<=e.byteLength-30;i+=1)if(a.getUint32(i)===Ke){let n=a.getUint16(i+26,!0),l=a.getUint16(i+28,!0),c=a.getUint16(i+6,!0),d=!!(c>>3&1),o=i+30+n+l;if(o>e.byteLength)throw new _("Truncated local file header","INVALID_ARCHIVE");let s=a.getUint32(i+18,!0),w=a.getUint32(i+22,!0),f=e.slice(i+30+n,o),h={uncompressed:w===G,compressed:s===G,offset:!1,disk:!1},v=h.uncompressed||h.compressed?sr(f,h):{},x=v.compressedSize??s,A=v.uncompressedSize??w,g=o+(d?r:x);if(g>e.byteLength)throw new _("Truncated local file data","TRUNCATED_ENTRY");let u=d&&g+4<=e.byteLength&&a.getUint32(g)===ua,b=u?4:0,S=g+b;return{meta:{dataDescriptor:d&&S+12<=e.byteLength?{optionalSignature:u?e.slice(g,g+b):void 0,crc32:a.getUint32(S,!0),compressedSize:a.getUint32(S+4,!0),uncompressedSize:a.getUint32(S+8,!0)}:void 0,compressedData:d?e.slice(o,g):e.slice(o,o+x)},data:{signature:e.slice(i,i+4),versionToExtract:a.getUint16(i+4,!0),generalPurposeBitFlag:a.getUint16(i+6,!0),compressionMethod:a.getUint16(i+8,!0),lastModifiedTime:a.getUint16(i+10,!0),lastModifiedDate:a.getUint16(i+12,!0),crc32:a.getUint32(i+14,!0),compressedSize:x,uncompressedSize:A,filenameLength:n,extraFieldLength:l,filename:Q(e.slice(i+30,i+30+n),Ye(c)),extraField:f}}}return null};0&&(module.exports={RemoteZip,RemoteZipError,RemoteZipPointer,crc32,decodeZipString,isZip64,parseAllCDs,parseOneCD,parseOneEOCD,parseOneLocalFile,parseZip64EOCD,parseZip64EOCDLocator,parseZipDatetime});
7
2
  //# sourceMappingURL=index.js.map