@gyng/remote-zip 0.2.5 → 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/LICENSE-APACHE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work, excluding
103
+ those notices that do not pertain to any part of the Derivative
104
+ Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2021 Ng Guoyou
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,4 +1,4 @@
1
- Copyright 2021 AIcadium
1
+ Copyright 2021 Ng Guoyou
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/README.md CHANGED
@@ -8,38 +8,61 @@ Fetch file listings and individual files from a remote ZIP file.
8
8
 
9
9
  Without downloading the entire ZIP:
10
10
 
11
- - Fetch individual files in a remote ZIP
11
+ - Fetch individual files in a remote ZIP (buffered or streaming)
12
12
  - Fetch file listings
13
+ - ZIP64 archives (>4 GiB / >65,535 entries)
14
+ - Encrypted entries: traditional ZipCrypto and WinZip AES (AE-1/AE-2)
15
+ - CP437 and UTF-8 filenames; optional CRC-32 verification
13
16
 
14
17
  The gist of what the library does is:
15
18
 
16
19
  1. Get the content size of the ZIP file using a HTTP HEAD request.
17
- 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.
18
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.
19
22
  4. To get individual files, use another Range request with an offset to get the local file header + compressed data.
20
23
 
21
24
  ## Limitations
22
25
 
23
- - No ZIP64 support
24
- - No encrypted ZIP support
25
- - No stream support via `ReadableStream` due to testing/dev difficulties
26
- - Long comments in a ZIP file might cause `populate()` to fail
26
+ - PKWare _strong_ encryption (general-purpose bit 6) is detected and rejected
27
+ - Multi-disk / split archives are not supported
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
+
32
+ > Decrypting WinZip AES entries uses the Web Crypto API (`crypto.subtle`), which
33
+ > in browsers is only available in a secure context (HTTPS or `localhost`).
34
+ > Traditional ZipCrypto works everywhere but is cryptographically weak.
27
35
 
28
36
  ## Install
29
37
 
30
38
  ```bash
31
- yarn add @gyng/remote-zip
39
+ npm install @gyng/remote-zip
32
40
  ```
33
41
 
34
42
  ```bash
35
- npm install --save @gyng/remote-zip
43
+ yarn add @gyng/remote-zip
36
44
  ```
37
45
 
38
46
  ## Usage
39
47
 
40
48
  See the [generated API documentation](https://gyng.github.io/remote-zip/).
41
49
 
42
- If using in the browser, the server will need to whitelist CORS for `GET`, `HEAD`, and the `Range` header.
50
+ ### Server requirements (CORS & Range)
51
+
52
+ The remote server must support **HTTP Range** requests (respond `206 Partial
53
+ Content`). When used cross-origin from a browser, it must also send the right
54
+ CORS headers. The browser issues the CORS preflight (`OPTIONS`) automatically —
55
+ there is nothing to configure on the client — but the server needs to allow it:
56
+
57
+ - `Access-Control-Allow-Origin: <your origin>`
58
+ - `Access-Control-Allow-Methods: GET, HEAD` (add `POST` if you set a custom `method`)
59
+ - `Access-Control-Allow-Headers: Range` (plus `Authorization` / any custom headers you pass)
60
+ - `Access-Control-Expose-Headers: Content-Length, Content-Range` — **required**, or
61
+ the browser hides those response headers and `populate()` cannot read the archive size
62
+
63
+ `Range` is not a CORS-safelisted request header, so any cross-origin request
64
+ triggers a preflight. Static hosts like S3, GitHub Pages, and nginx support Range
65
+ out of the box; you only need to configure the CORS headers above.
43
66
 
44
67
  ### Basic
45
68
 
@@ -47,23 +70,48 @@ If using in the browser, the server will need to whitelist CORS for `GET`, `HEAD
47
70
  const url = new URL("http://www.example.com/test.zip");
48
71
  const remoteZip = await new RemoteZipPointer({ url }).populate();
49
72
  const fileListing = remoteZip.files(); // RemoteZipFile[]
50
- const uncompressedBytes = await remoteZip.fetch("test.txt"); // ArrayBuffer
73
+ const uncompressedBytes = await remoteZip.fetch("test.txt"); // Uint8Array
74
+ ```
75
+
76
+ ### Streaming
77
+
78
+ For large entries, `fetchStream` returns a `ReadableStream<Uint8Array>` of the
79
+ uncompressed bytes so you can process them incrementally without buffering the
80
+ whole file. `maxUncompressedSize`, if set, is enforced mid-stream.
81
+
82
+ ```ts
83
+ const stream = await remoteZip.fetchStream("big.bin");
84
+ for await (const chunk of stream) {
85
+ // handle each chunk
86
+ }
51
87
  ```
52
88
 
53
89
  ### With more features
54
90
 
55
91
  ```ts
56
- const method = "POST";
57
- const additonalHeaders = new Headers();
58
- additonalHeaders.append("X-Example", "foobar");
92
+ const additionalHeaders = new Headers();
93
+ additionalHeaders.append("X-Example", "foobar");
59
94
  const url = new URL("http://www.example.com/test.zip");
95
+
60
96
  const remoteZip = await new RemoteZipPointer({
61
97
  url,
62
98
  additionalHeaders,
63
- method,
99
+ method: "POST",
64
100
  credentials: "include",
101
+ // New request options (all optional), applied to every request:
102
+ redirect: "error", // avoid leaking auth headers cross-origin on a 30x
103
+ timeoutMs: 10_000, // per-request timeout
104
+ signal: AbortSignal.timeout(30_000), // or your own AbortController signal
105
+ requestInit: { cache: "no-store" }, // escape hatch merged into every fetch
65
106
  }).populate();
66
- const uncompressedBytes = await remoteZip.fetch("test.txt", additionalHeaders);
107
+
108
+ // Guard untrusted archives against decompression bombs, and pass a per-call
109
+ // signal/timeout if you like:
110
+ const uncompressedBytes = await remoteZip.fetch("test.txt", additionalHeaders, {
111
+ maxUncompressedSize: 50 * 1024 * 1024,
112
+ verifyCrc: true, // check the decompressed bytes against the entry's CRC-32
113
+ password: "hunter2", // for ZipCrypto / WinZip AES encrypted entries
114
+ });
67
115
  ```
68
116
 
69
117
  ## Dev
@@ -72,36 +120,20 @@ const uncompressedBytes = await remoteZip.fetch("test.txt", additionalHeaders);
72
120
  <summary>Dev instructions</summary>
73
121
  See `scripts` in `package.json` for more scripts.
74
122
 
75
- - `yarn d` watch and build
76
- - `yarn t:watch` watch and test
77
- - `yarn lint`
78
- - `yarn build`
123
+ Requires Node >= 22.
79
124
 
80
- Run tests and checks with Docker
81
-
82
- ```
83
- docker-compose -f docker-compose.test.yml up --build
125
+ ```bash
126
+ npm ci # install (reproducible, honours .npmrc cooldown)
127
+ npm run d # watch and build
128
+ npm run t:watch # watch and test
129
+ npm run lint # oxfmt + type-aware oxlint
130
+ npm run typecheck # tsc --noEmit (also checks tests)
131
+ npm run build # type declarations + esm/cjs bundles
132
+ npm test # run the test suite once
84
133
  ```
85
134
 
86
135
  ### Publish
87
136
 
88
- #### Setup
89
-
90
- 1. Get an automation token from npm under settings
91
-
92
- ```
93
- https://www.npmjs.com/settings/aicadium/tokens/
94
- ```
95
-
96
- 2. Add the token to your repository secrets.
97
-
98
- ```
99
- https://github.com/$YOUR_USERNAME/$YOUR_REPO_NAME/settings/secrets/actions/new
100
- ```
101
-
102
- - Name: `NPM_TOKEN`
103
- - Value: The automation token you got from the previous step
104
-
105
137
  #### Run
106
138
 
107
139
  1. Create a new release.
@@ -110,7 +142,23 @@ docker-compose -f docker-compose.test.yml up --build
110
142
  https://github.com/$YOUR_USERNAME/$YOUR_REPO_NAME/releases
111
143
  ```
112
144
 
113
- 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.
114
149
 
115
150
  Don't forget to bump your version number in `package.json` before this.
116
151
  </details>
152
+
153
+ ## License
154
+
155
+ Licensed under either of
156
+
157
+ - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
158
+ - MIT license ([LICENSE-MIT](LICENSE-MIT))
159
+
160
+ at your option.
161
+
162
+ Unless you explicitly state otherwise, any contribution intentionally submitted
163
+ for inclusion in this work by you, as defined in the Apache-2.0 license, shall be
164
+ dual licensed as above, without any additional terms or conditions.
@@ -0,0 +1,2 @@
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});
2
+ //# sourceMappingURL=index.js.map