@gyng/remote-zip 0.2.5 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,8 +8,11 @@ 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
 
@@ -20,26 +23,43 @@ The gist of what the library does is:
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
+ > Decrypting WinZip AES entries uses the Web Crypto API (`crypto.subtle`), which
30
+ > in browsers is only available in a secure context (HTTPS or `localhost`).
31
+ > Traditional ZipCrypto works everywhere but is cryptographically weak.
27
32
 
28
33
  ## Install
29
34
 
30
35
  ```bash
31
- yarn add @gyng/remote-zip
36
+ npm install @gyng/remote-zip
32
37
  ```
33
38
 
34
39
  ```bash
35
- npm install --save @gyng/remote-zip
40
+ yarn add @gyng/remote-zip
36
41
  ```
37
42
 
38
43
  ## Usage
39
44
 
40
45
  See the [generated API documentation](https://gyng.github.io/remote-zip/).
41
46
 
42
- If using in the browser, the server will need to whitelist CORS for `GET`, `HEAD`, and the `Range` header.
47
+ ### Server requirements (CORS & Range)
48
+
49
+ The remote server must support **HTTP Range** requests (respond `206 Partial
50
+ Content`). When used cross-origin from a browser, it must also send the right
51
+ CORS headers. The browser issues the CORS preflight (`OPTIONS`) automatically —
52
+ there is nothing to configure on the client — but the server needs to allow it:
53
+
54
+ - `Access-Control-Allow-Origin: <your origin>`
55
+ - `Access-Control-Allow-Methods: GET, HEAD` (add `POST` if you set a custom `method`)
56
+ - `Access-Control-Allow-Headers: Range` (plus `Authorization` / any custom headers you pass)
57
+ - `Access-Control-Expose-Headers: Content-Length, Content-Range` — **required**, or
58
+ the browser hides those response headers and `populate()` cannot read the archive size
59
+
60
+ `Range` is not a CORS-safelisted request header, so any cross-origin request
61
+ triggers a preflight. Static hosts like S3, GitHub Pages, and nginx support Range
62
+ out of the box; you only need to configure the CORS headers above.
43
63
 
44
64
  ### Basic
45
65
 
@@ -47,23 +67,48 @@ If using in the browser, the server will need to whitelist CORS for `GET`, `HEAD
47
67
  const url = new URL("http://www.example.com/test.zip");
48
68
  const remoteZip = await new RemoteZipPointer({ url }).populate();
49
69
  const fileListing = remoteZip.files(); // RemoteZipFile[]
50
- const uncompressedBytes = await remoteZip.fetch("test.txt"); // ArrayBuffer
70
+ const uncompressedBytes = await remoteZip.fetch("test.txt"); // Uint8Array
71
+ ```
72
+
73
+ ### Streaming
74
+
75
+ For large entries, `fetchStream` returns a `ReadableStream<Uint8Array>` of the
76
+ uncompressed bytes so you can process them incrementally without buffering the
77
+ whole file. `maxUncompressedSize`, if set, is enforced mid-stream.
78
+
79
+ ```ts
80
+ const stream = await remoteZip.fetchStream("big.bin");
81
+ for await (const chunk of stream) {
82
+ // handle each chunk
83
+ }
51
84
  ```
52
85
 
53
86
  ### With more features
54
87
 
55
88
  ```ts
56
- const method = "POST";
57
- const additonalHeaders = new Headers();
58
- additonalHeaders.append("X-Example", "foobar");
89
+ const additionalHeaders = new Headers();
90
+ additionalHeaders.append("X-Example", "foobar");
59
91
  const url = new URL("http://www.example.com/test.zip");
92
+
60
93
  const remoteZip = await new RemoteZipPointer({
61
94
  url,
62
95
  additionalHeaders,
63
- method,
96
+ method: "POST",
64
97
  credentials: "include",
98
+ // New request options (all optional), applied to every request:
99
+ redirect: "error", // avoid leaking auth headers cross-origin on a 30x
100
+ timeoutMs: 10_000, // per-request timeout
101
+ signal: AbortSignal.timeout(30_000), // or your own AbortController signal
102
+ requestInit: { cache: "no-store" }, // escape hatch merged into every fetch
65
103
  }).populate();
66
- const uncompressedBytes = await remoteZip.fetch("test.txt", additionalHeaders);
104
+
105
+ // Guard untrusted archives against decompression bombs, and pass a per-call
106
+ // signal/timeout if you like:
107
+ const uncompressedBytes = await remoteZip.fetch("test.txt", additionalHeaders, {
108
+ maxUncompressedSize: 50 * 1024 * 1024,
109
+ verifyCrc: true, // check the decompressed bytes against the entry's CRC-32
110
+ password: "hunter2", // for ZipCrypto / WinZip AES encrypted entries
111
+ });
67
112
  ```
68
113
 
69
114
  ## Dev
@@ -72,15 +117,16 @@ const uncompressedBytes = await remoteZip.fetch("test.txt", additionalHeaders);
72
117
  <summary>Dev instructions</summary>
73
118
  See `scripts` in `package.json` for more scripts.
74
119
 
75
- - `yarn d` watch and build
76
- - `yarn t:watch` watch and test
77
- - `yarn lint`
78
- - `yarn build`
79
-
80
- Run tests and checks with Docker
120
+ Requires Node >= 22.
81
121
 
82
- ```
83
- docker-compose -f docker-compose.test.yml up --build
122
+ ```bash
123
+ npm ci # install (reproducible, honours .npmrc cooldown)
124
+ npm run d # watch and build
125
+ npm run t:watch # watch and test
126
+ npm run lint # prettier + eslint
127
+ npm run typecheck # tsc --noEmit (also checks tests)
128
+ npm run build # type declarations + esm/cjs bundles
129
+ npm test # run the test suite once
84
130
  ```
85
131
 
86
132
  ### Publish
@@ -90,7 +136,7 @@ docker-compose -f docker-compose.test.yml up --build
90
136
  1. Get an automation token from npm under settings
91
137
 
92
138
  ```
93
- https://www.npmjs.com/settings/aicadium/tokens/
139
+ https://www.npmjs.com/settings/$YOUR_USERNAME/tokens/
94
140
  ```
95
141
 
96
142
  2. Add the token to your repository secrets.
@@ -114,3 +160,16 @@ docker-compose -f docker-compose.test.yml up --build
114
160
 
115
161
  Don't forget to bump your version number in `package.json` before this.
116
162
  </details>
163
+
164
+ ## License
165
+
166
+ Licensed under either of
167
+
168
+ - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
169
+ - MIT license ([LICENSE-MIT](LICENSE-MIT))
170
+
171
+ at your option.
172
+
173
+ Unless you explicitly state otherwise, any contribution intentionally submitted
174
+ for inclusion in this work by you, as defined in the Apache-2.0 license, shall be
175
+ dual licensed as above, without any additional terms or conditions.
@@ -0,0 +1,7 @@
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
+ */
7
+ //# sourceMappingURL=index.js.map