Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

client-zip

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

client-zip - npm Package Compare versions

Comparing version
2.4.6
to
2.5.0
+4
-0
CHANGES.md

@@ -0,1 +1,5 @@

## 2.5.0:
* new: `mode` field in input objects can override the default POSIX file mode.
## 2.4.6:

@@ -2,0 +6,0 @@

+5
-5

@@ -6,15 +6,15 @@ type BufferLike = ArrayBuffer | string | ArrayBufferView | Blob

* extra arguments can be given to override the input’s metadata. */
type InputWithMeta = File | Response | { input: File | Response, name?: any, lastModified?: any, size?: number | bigint }
type InputWithMeta = File | Response | { input: File | Response, name?: any, lastModified?: any, size?: number | bigint, mode?: number }
/** Intrinsic size, but the file name must be provided and modification date can’t be guessed. */
type InputWithSizeMeta = { input: BufferLike, name: any, lastModified?: any, size?: number | bigint }
type InputWithSizeMeta = { input: BufferLike, name: any, lastModified?: any, size?: number | bigint, mode?: number }
/** The file name must be provided ; modification date and content length can’t be guessed. */
type InputWithoutMeta = { input: StreamLike, name: any, lastModified?: any, size?: number | bigint }
type InputWithoutMeta = { input: StreamLike, name: any, lastModified?: any, size?: number | bigint, mode?: number }
/** The folder name must be provided ; modification date can’t be guessed. */
type InputFolder = { name: any, lastModified?: any, input?: never, size?: never }
type InputFolder = { name: any, lastModified?: any, input?: never, size?: never, mode?: number }
/** Both filename and size must be provided ; input is not helpful here. */
type JustMeta = { input?: StreamLike | undefined, name: any, lastModified?: any, size: number | bigint }
type JustMeta = { input?: StreamLike | undefined, name: any, lastModified?: any, size: number | bigint, mode?: number }

@@ -21,0 +21,0 @@ type ForAwaitable<T> = AsyncIterable<T> | Iterable<T>

@@ -1,1 +0,1 @@

"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),r=e=>Math.min(65535,Number(e));function f(e,i){if(void 0===i||i instanceof Date||(i=new Date(i)),e instanceof File)return{isFile:1,t:i||new Date(e.lastModified),i:e.stream()};if(e instanceof Response)return{isFile:1,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),i:e.body};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(void 0===e)return{isFile:0,t:i};if("string"==typeof e)return{isFile:1,t:i,i:t(e)};if(e instanceof Blob)return{isFile:1,t:i,i:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:1,t:i,i:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:1,t:i,i:n(e)};if(Symbol.asyncIterator in e)return{isFile:1,t:i,i:o(e[Symbol.asyncIterator]())};throw new TypeError("Unsupported input format.")}function o(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[f,o]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{o:d(f||t(e.name)),u:BigInt(e.size),l:o};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{o:d(f||t(s)),u:BigInt(u),l:o}}return f=d(f,void 0!==e||void 0!==r),"string"==typeof e?{o:f,u:BigInt(t(e).length),l:o}:e instanceof Blob?{o:f,u:BigInt(e.size),l:o}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{o:f,u:BigInt(e.byteLength),l:o}:{o:f,u:u(e,r),l:o}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n^=-1;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return(-1^n)>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({o:e,l:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.o.length,1),n(r)}async function*g(e){let{i:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.m=y(n,0),e.u=BigInt(n.length);else{e.u=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.m=y(n,e.m),e.u+=BigInt(n.length),yield n}}}function I(t,r){const f=e(16+(r?8:0));return f.setUint32(0,1347094280),f.setUint32(4,t.isFile?t.m:0,1),r?(f.setBigUint64(8,t.u,1),f.setBigUint64(16,t.u,1)):(f.setUint32(8,i(t.u),1),f.setUint32(12,i(t.u),1)),n(f)}function v(t,r,f=0,o=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|f),w(t.t,a,12),a.setUint32(16,t.isFile?t.m:0,1),a.setUint32(20,i(t.u),1),a.setUint32(24,i(t.u),1),a.setUint16(28,t.o.length,1),a.setUint16(30,o,1),a.setUint16(40,t.isFile?33204:16893,1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const f=e(r);return f.setUint16(0,1,1),f.setUint16(2,r-4,1),16&r&&(f.setBigUint64(4,t.u,1),f.setBigUint64(12,t.u,1)),f.setBigUint64(r-8,i,1),n(f)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.o)throw new Error("Every file must have a non-empty name.");if(void 0===r.u)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.o)}".`);const e=r.u>=0xffffffffn,f=t>=0xffffffffn;t+=BigInt(46+r.o.length+(e&&8))+r.u,n+=BigInt(r.o.length+46+(12*f|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(f(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return o(async function*(t,f){const o=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,f.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.o),e.isFile&&(yield*g(e));const t=e.u>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),o.push(v(e,a,n,i)),o.push(e.o),i&&o.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.o.length)+e.u,u||(u=t)}let d=0n;for(const e of o)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,r(s),1),l.setUint16(10,r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)}export{A as downloadZip,N as makeZip,S as predictLength};
"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const i=Number(0xffffffffn&n),r=Number(n>>32n);this.setUint32(e+(t?0:4),i,t),this.setUint32(e+(t?4:0),r,t)}});var e=e=>new DataView(new ArrayBuffer(e)),n=e=>new Uint8Array(e.buffer||e),t=e=>(new TextEncoder).encode(String(e)),i=e=>Math.min(4294967295,Number(e)),r=e=>Math.min(65535,Number(e));function o(e,i,r){void 0===i||i instanceof Date||(i=new Date(i));const o=void 0!==e;if(r||(r=o?436:509),e instanceof File)return{isFile:o,t:i||new Date(e.lastModified),bytes:e.stream(),mode:r};if(e instanceof Response)return{isFile:o,t:i||new Date(e.headers.get("Last-Modified")||Date.now()),bytes:e.body,mode:r};if(void 0===i)i=new Date;else if(isNaN(i))throw new Error("Invalid modification date.");if(!o)return{isFile:o,t:i,mode:r};if("string"==typeof e)return{isFile:o,t:i,bytes:t(e),mode:r};if(e instanceof Blob)return{isFile:o,t:i,bytes:e.stream(),mode:r};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:o,t:i,bytes:e,mode:r};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:o,t:i,bytes:n(e),mode:r};if(Symbol.asyncIterator in e)return{isFile:o,t:i,bytes:f(e[Symbol.asyncIterator]()),mode:r};throw new TypeError("Unsupported input format.")}function f(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const i=await e.next();if(!i.value){n.close();break}{const e=a(i.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function a(e){return"string"==typeof e?t(e):e instanceof Uint8Array?e:n(e)}function s(e,i,r){let[o,f]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[n(e),1]:[t(e),0]:[void 0,0]}(i);if(e instanceof File)return{i:d(o||t(e.name)),o:BigInt(e.size),u:f};if(e instanceof Response){const n=e.headers.get("content-disposition"),i=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),a=i&&i[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=a&&decodeURIComponent(a),u=r||+e.headers.get("content-length");return{i:d(o||t(s)),o:BigInt(u),u:f}}return o=d(o,void 0!==e||void 0!==r),"string"==typeof e?{i:o,o:BigInt(t(e).length),u:f}:e instanceof Blob?{i:o,o:BigInt(e.size),u:f}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:o,o:BigInt(e.byteLength),u:f}:{i:o,o:u(e,r),u:f}}function u(e,n){return n>-1?BigInt(n):e?void 0:0n}function d(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var l=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);l[e]=n}function y(e,n=0){n=~n;for(var t=0,i=e.length;t<i;t++)n=n>>>8^l[255&n^e[t]];return~n>>>0}function w(e,n,t=0){const i=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,r=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,i,1),n.setUint16(t+2,r,1)}function B({i:e,u:n},t){return 8*(!n||(t??function(e){try{b.decode(e)}catch{return 0}return 1}(e)))}var b=new TextDecoder("utf8",{fatal:1});function p(t,i=0){const r=e(30);return r.setUint32(0,1347093252),r.setUint32(4,754976768|i),w(t.t,r,10),r.setUint16(26,t.i.length,1),n(r)}async function*g(e){let{bytes:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.l=y(n,0),e.o=BigInt(n.length);else{e.o=0n;const t=n.getReader();for(;;){const{value:n,done:i}=await t.read();if(i)break;e.l=y(n,e.l),e.o+=BigInt(n.length),yield n}}}function I(t,r){const o=e(16+(r?8:0));return o.setUint32(0,1347094280),o.setUint32(4,t.isFile?t.l:0,1),r?(o.setBigUint64(8,t.o,1),o.setBigUint64(16,t.o,1)):(o.setUint32(8,i(t.o),1),o.setUint32(12,i(t.o),1)),n(o)}function v(t,r,o=0,f=0){const a=e(46);return a.setUint32(0,1347092738),a.setUint32(4,755182848),a.setUint16(8,2048|o),w(t.t,a,12),a.setUint32(16,t.isFile?t.l:0,1),a.setUint32(20,i(t.o),1),a.setUint32(24,i(t.o),1),a.setUint16(28,t.i.length,1),a.setUint16(30,f,1),a.setUint16(40,t.mode|(t.isFile?32768:16384),1),a.setUint32(42,i(r),1),n(a)}function h(t,i,r){const o=e(r);return o.setUint16(0,1,1),o.setUint16(2,r-4,1),16&r&&(o.setBigUint64(4,t.o,1),o.setBigUint64(12,t.o,1)),o.setBigUint64(r-8,i,1),n(o)}function D(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified,e.mode]]}var S=e=>function(e){let n=BigInt(22),t=0n,i=0;for(const r of e){if(!r.i)throw new Error("Every file must have a non-empty name.");if(void 0===r.o)throw new Error(`Missing size for file "${(new TextDecoder).decode(r.i)}".`);const e=r.o>=0xffffffffn,o=t>=0xffffffffn;t+=BigInt(46+r.i.length+(e&&8))+r.o,n+=BigInt(r.i.length+46+(12*o|28*e)),i||(i=e)}return(i||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield s(...D(n)[0])}(e));function A(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(S(n.metadata))),new Response(N(e,n),{headers:t})}function N(t,a={}){const u=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,i]=D(e.value);return{done:0,value:Object.assign(o(...i),s(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(t);return f(async function*(t,o){const f=[];let a=0n,s=0n,u=0;for await(const e of t){const n=B(e,o.buffersAreUTF8);yield p(e,n),yield new Uint8Array(e.i),e.isFile&&(yield*g(e));const t=e.o>=0xffffffffn,i=12*(a>=0xffffffffn)|28*t;yield I(e,t),f.push(v(e,a,n,i)),f.push(e.i),i&&f.push(h(e,a,i)),t&&(a+=8n),s++,a+=BigInt(46+e.i.length)+e.o,u||(u=t)}let d=0n;for(const e of f)yield e,d+=BigInt(e.length);if(u||a>=0xffffffffn){const t=e(76);t.setUint32(0,1347094022),t.setBigUint64(4,BigInt(44),1),t.setUint32(12,755182848),t.setBigUint64(24,s,1),t.setBigUint64(32,s,1),t.setBigUint64(40,d,1),t.setBigUint64(48,a,1),t.setUint32(56,1347094023),t.setBigUint64(64,a+d,1),t.setUint32(72,1,1),yield n(t)}const l=e(22);l.setUint32(0,1347093766),l.setUint16(8,r(s),1),l.setUint16(10,r(s),1),l.setUint32(12,i(d),1),l.setUint32(16,i(a),1),yield n(l)}(u,a),u)}export{A as downloadZip,N as makeZip,S as predictLength};
{
"name": "client-zip",
"version": "2.4.6",
"version": "2.5.0",
"description": "A tiny and fast client-side streaming ZIP generator",

@@ -31,5 +31,5 @@ "browser": "index.js",

"devDependencies": {
"esbuild": "^0.17.19",
"terser": "~5.14"
"esbuild": "^0.25.1",
"terser": "~5.39"
}
}

@@ -10,3 +10,3 @@ ![Test](https://github.com/Touffy/client-zip/workflows/Test/badge.svg)

`client-zip` is lightweight (6.3 kB minified, 2.6 kB gzipped), dependency-free, and 40 times faster than the old JSZip.
`client-zip` is lightweight (6.4 kB minified, 2.6 kB gzipped), dependency-free, and 40 times faster than the old JSZip.

@@ -79,2 +79,3 @@ * [Quick Start](#Quick-Start)

- `input`: something that contains your data; it can be a `File`, a `Blob`, a `Response`, some kind of `ArrayView` or a raw `ArrayBuffer`, a `ReadableStream<Uint8Array>` (yes, only Uint8Arrays, but most APIs give you just that type anyway), an `AsyncIterable<ArrayBuffer | ArrayView | string>`, … or just a string.
- `mode`: override the POSIX file mode (by default, it will be `0o664`). Should be between `0` and `0o777` — disrespect that constraint at your own risk.

@@ -161,5 +162,5 @@ The *options* argument currently supports three properties, `length`, `metadata` (see [Content-Length prediction](#content-length-prediction)) and `buffersAreUTF8` (see [Filename encoding](#filename-encoding)).

| | `client-zip`@2.4.6 | fflate@0.7.4 | zip.js@2.7.14 | conflux@4.0.3 | JSZip@3.10.1 |
| | `client-zip`@2.5.0 | fflate@0.7.4 | zip.js@2.7.14 | conflux@4.0.3 | JSZip@3.10.1 |
|--------------------|-------------------:|-------------:|--------------:|--------------:|--------------:|
| minified | 6.3 kB | 29.8 kB | 163.2 kB | 198.8 kB | 94.9 kB |
| minified | 6.4 kB | 29.8 kB | 163.2 kB | 198.8 kB | 94.9 kB |
| minified + gzipped | 2.6 kB | 11 kB | 58 kB | 56.6 kB | 27.6 kB |

@@ -189,4 +190,6 @@

The UNIX permissions in external attributes (ignored by many readers, though) are hardcoded to 664, could be made configurable.
<del>Configurable UNIX permissions in external attributes.</del> The UNIX permissions are now configurable (since 1.7.0) via the `mode` field, set by default to 664 for files, 775 for folders.
### ZIP64
### <del>ZIP64</del>

@@ -193,0 +196,0 @@

@@ -1,1 +0,1 @@

var downloadZip=(()=>{"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const r=Number(0xffffffffn&n),i=Number(n>>32n);this.setUint32(e+(t?0:4),r,t),this.setUint32(e+(t?4:0),i,t)}});var f=e=>new DataView(new ArrayBuffer(e)),o=e=>new Uint8Array(e.buffer||e),a=e=>(new TextEncoder).encode(String(e)),s=e=>Math.min(4294967295,Number(e)),u=e=>Math.min(65535,Number(e));function d(e,n){if(void 0===n||n instanceof Date||(n=new Date(n)),e instanceof File)return{isFile:1,t:n||new Date(e.lastModified),i:e.stream()};if(e instanceof Response)return{isFile:1,t:n||new Date(e.headers.get("Last-Modified")||Date.now()),i:e.body};if(void 0===n)n=new Date;else if(isNaN(n))throw new Error("Invalid modification date.");if(void 0===e)return{isFile:0,t:n};if("string"==typeof e)return{isFile:1,t:n,i:a(e)};if(e instanceof Blob)return{isFile:1,t:n,i:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:1,t:n,i:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:1,t:n,i:o(e)};if(Symbol.asyncIterator in e)return{isFile:1,t:n,i:l(e[Symbol.asyncIterator]())};throw new TypeError("Unsupported input format.")}function l(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const r=await e.next();if(!r.value){n.close();break}{const e=y(r.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function y(e){return"string"==typeof e?a(e):e instanceof Uint8Array?e:o(e)}function b(e,n,t){let[r,i]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[o(e),1]:[a(e),0]:[void 0,0]}(n);if(e instanceof File)return{o:B(r||a(e.name)),u:BigInt(e.size),l:i};if(e instanceof Response){const n=e.headers.get("content-disposition"),f=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),o=f&&f[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=o&&decodeURIComponent(o),u=t||+e.headers.get("content-length");return{o:B(r||a(s)),u:BigInt(u),l:i}}return r=B(r,void 0!==e||void 0!==t),"string"==typeof e?{o:r,u:BigInt(a(e).length),l:i}:e instanceof Blob?{o:r,u:BigInt(e.size),l:i}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{o:r,u:BigInt(e.byteLength),l:i}:{o:r,u:w(e,t),l:i}}function w(e,n){return n>-1?BigInt(n):e?void 0:0n}function B(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var p=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);p[e]=n}function g(e,n=0){n^=-1;for(var t=0,r=e.length;t<r;t++)n=n>>>8^p[255&n^e[t]];return(-1^n)>>>0}function v(e,n,t=0){const r=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,i=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,r,1),n.setUint16(t+2,i,1)}function I({o:e,l:n},t){return 8*(!n||(t??function(e){try{h.decode(e)}catch{return 0}return 1}(e)))}var h=new TextDecoder("utf8",{fatal:1});function D(e,n=0){const t=f(30);return t.setUint32(0,1347093252),t.setUint32(4,754976768|n),v(e.t,t,10),t.setUint16(26,e.o.length,1),o(t)}async function*S(e){let{i:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.m=g(n,0),e.u=BigInt(n.length);else{e.u=0n;const t=n.getReader();for(;;){const{value:n,done:r}=await t.read();if(r)break;e.m=g(n,e.m),e.u+=BigInt(n.length),yield n}}}function A(e,n){const t=f(16+(n?8:0));return t.setUint32(0,1347094280),t.setUint32(4,e.isFile?e.m:0,1),n?(t.setBigUint64(8,e.u,1),t.setBigUint64(16,e.u,1)):(t.setUint32(8,s(e.u),1),t.setUint32(12,s(e.u),1)),o(t)}function N(e,n,t=0,r=0){const i=f(46);return i.setUint32(0,1347092738),i.setUint32(4,755182848),i.setUint16(8,2048|t),v(e.t,i,12),i.setUint32(16,e.isFile?e.m:0,1),i.setUint32(20,s(e.u),1),i.setUint32(24,s(e.u),1),i.setUint16(28,e.o.length,1),i.setUint16(30,r,1),i.setUint16(40,e.isFile?33204:16893,1),i.setUint32(42,s(n),1),o(i)}function U(e,n,t){const r=f(t);return r.setUint16(0,1,1),r.setUint16(2,t-4,1),16&t&&(r.setBigUint64(4,e.u,1),r.setBigUint64(12,e.u,1)),r.setBigUint64(t-8,n,1),o(r)}function F(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}var x=e=>function(e){let n=BigInt(22),t=0n,r=0;for(const i of e){if(!i.o)throw new Error("Every file must have a non-empty name.");if(void 0===i.u)throw new Error(`Missing size for file "${(new TextDecoder).decode(i.o)}".`);const e=i.u>=0xffffffffn,f=t>=0xffffffffn;t+=BigInt(46+i.o.length+(e&&8))+i.u,n+=BigInt(i.o.length+46+(12*f|28*e)),r||(r=e)}return(r||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield b(...F(n)[0])}(e));return function(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(x(n.metadata))),new Response(function(e,n={}){const t=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,r]=F(e.value);return{done:0,value:Object.assign(d(...r),b(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(e);return l(async function*(e,n){const t=[];let r=0n,i=0n,a=0;for await(const f of e){const e=I(f,n.buffersAreUTF8);yield D(f,e),yield new Uint8Array(f.o),f.isFile&&(yield*S(f));const o=f.u>=0xffffffffn,s=12*(r>=0xffffffffn)|28*o;yield A(f,o),t.push(N(f,r,e,s)),t.push(f.o),s&&t.push(U(f,r,s)),o&&(r+=8n),i++,r+=BigInt(46+f.o.length)+f.u,a||(a=o)}let d=0n;for(const e of t)yield e,d+=BigInt(e.length);if(a||r>=0xffffffffn){const e=f(76);e.setUint32(0,1347094022),e.setBigUint64(4,BigInt(44),1),e.setUint32(12,755182848),e.setBigUint64(24,i,1),e.setBigUint64(32,i,1),e.setBigUint64(40,d,1),e.setBigUint64(48,r,1),e.setUint32(56,1347094023),e.setBigUint64(64,r+d,1),e.setUint32(72,1,1),yield o(e)}const l=f(22);l.setUint32(0,1347093766),l.setUint16(8,u(i),1),l.setUint16(10,u(i),1),l.setUint32(12,s(d),1),l.setUint32(16,s(r),1),yield o(l)}(t,n),t)}(e,n),{headers:t})}})();
var downloadZip=(()=>{"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,n,t){const r=Number(0xffffffffn&n),i=Number(n>>32n);this.setUint32(e+(t?0:4),r,t),this.setUint32(e+(t?4:0),i,t)}});var o=e=>new DataView(new ArrayBuffer(e)),f=e=>new Uint8Array(e.buffer||e),a=e=>(new TextEncoder).encode(String(e)),s=e=>Math.min(4294967295,Number(e)),u=e=>Math.min(65535,Number(e));function d(e,n,t){void 0===n||n instanceof Date||(n=new Date(n));const r=void 0!==e;if(t||(t=r?436:509),e instanceof File)return{isFile:r,t:n||new Date(e.lastModified),bytes:e.stream(),mode:t};if(e instanceof Response)return{isFile:r,t:n||new Date(e.headers.get("Last-Modified")||Date.now()),bytes:e.body,mode:t};if(void 0===n)n=new Date;else if(isNaN(n))throw new Error("Invalid modification date.");if(!r)return{isFile:r,t:n,mode:t};if("string"==typeof e)return{isFile:r,t:n,bytes:a(e),mode:t};if(e instanceof Blob)return{isFile:r,t:n,bytes:e.stream(),mode:t};if(e instanceof Uint8Array||e instanceof ReadableStream)return{isFile:r,t:n,bytes:e,mode:t};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{isFile:r,t:n,bytes:f(e),mode:t};if(Symbol.asyncIterator in e)return{isFile:r,t:n,bytes:l(e[Symbol.asyncIterator]()),mode:t};throw new TypeError("Unsupported input format.")}function l(e,n=e){return new ReadableStream({async pull(n){let t=0;for(;n.desiredSize>t;){const r=await e.next();if(!r.value){n.close();break}{const e=y(r.value);n.enqueue(e),t+=e.byteLength}}},cancel(e){n.throw?.(e)}})}function y(e){return"string"==typeof e?a(e):e instanceof Uint8Array?e:f(e)}function b(e,n,t){let[r,i]=function(e){return e?e instanceof Uint8Array?[e,1]:ArrayBuffer.isView(e)||e instanceof ArrayBuffer?[f(e),1]:[a(e),0]:[void 0,0]}(n);if(e instanceof File)return{i:B(r||a(e.name)),o:BigInt(e.size),u:i};if(e instanceof Response){const n=e.headers.get("content-disposition"),o=n&&n.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),f=o&&o[1]||e.url&&new URL(e.url).pathname.split("/").findLast(Boolean),s=f&&decodeURIComponent(f),u=t||+e.headers.get("content-length");return{i:B(r||a(s)),o:BigInt(u),u:i}}return r=B(r,void 0!==e||void 0!==t),"string"==typeof e?{i:r,o:BigInt(a(e).length),u:i}:e instanceof Blob?{i:r,o:BigInt(e.size),u:i}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:r,o:BigInt(e.byteLength),u:i}:{i:r,o:w(e,t),u:i}}function w(e,n){return n>-1?BigInt(n):e?void 0:0n}function B(e,n=1){if(!e||e.every((c=>47===c)))throw new Error("The file must have a name.");if(n)for(;47===e[e.length-1];)e=e.subarray(0,-1);else 47!==e[e.length-1]&&(e=new Uint8Array([...e,47]));return e}var p=new Uint32Array(256);for(let e=0;e<256;++e){let n=e;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);p[e]=n}function g(e,n=0){n=~n;for(var t=0,r=e.length;t<r;t++)n=n>>>8^p[255&n^e[t]];return~n>>>0}function v(e,n,t=0){const r=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,i=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;n.setUint16(t,r,1),n.setUint16(t+2,i,1)}function I({i:e,u:n},t){return 8*(!n||(t??function(e){try{h.decode(e)}catch{return 0}return 1}(e)))}var h=new TextDecoder("utf8",{fatal:1});function D(e,n=0){const t=o(30);return t.setUint32(0,1347093252),t.setUint32(4,754976768|n),v(e.t,t,10),t.setUint16(26,e.i.length,1),f(t)}async function*S(e){let{bytes:n}=e;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,e.l=g(n,0),e.o=BigInt(n.length);else{e.o=0n;const t=n.getReader();for(;;){const{value:n,done:r}=await t.read();if(r)break;e.l=g(n,e.l),e.o+=BigInt(n.length),yield n}}}function A(e,n){const t=o(16+(n?8:0));return t.setUint32(0,1347094280),t.setUint32(4,e.isFile?e.l:0,1),n?(t.setBigUint64(8,e.o,1),t.setBigUint64(16,e.o,1)):(t.setUint32(8,s(e.o),1),t.setUint32(12,s(e.o),1)),f(t)}function N(e,n,t=0,r=0){const i=o(46);return i.setUint32(0,1347092738),i.setUint32(4,755182848),i.setUint16(8,2048|t),v(e.t,i,12),i.setUint32(16,e.isFile?e.l:0,1),i.setUint32(20,s(e.o),1),i.setUint32(24,s(e.o),1),i.setUint16(28,e.i.length,1),i.setUint16(30,r,1),i.setUint16(40,e.mode|(e.isFile?32768:16384),1),i.setUint32(42,s(n),1),f(i)}function U(e,n,t){const r=o(t);return r.setUint16(0,1,1),r.setUint16(2,t-4,1),16&t&&(r.setBigUint64(4,e.o,1),r.setBigUint64(12,e.o,1)),r.setBigUint64(t-8,n,1),f(r)}function F(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified,e.mode]]}var x=e=>function(e){let n=BigInt(22),t=0n,r=0;for(const i of e){if(!i.i)throw new Error("Every file must have a non-empty name.");if(void 0===i.o)throw new Error(`Missing size for file "${(new TextDecoder).decode(i.i)}".`);const e=i.o>=0xffffffffn,o=t>=0xffffffffn;t+=BigInt(46+i.i.length+(e&&8))+i.o,n+=BigInt(i.i.length+46+(12*o|28*e)),r||(r=e)}return(r||t>=0xffffffffn)&&(n+=BigInt(76)),n+t}(function*(e){for(const n of e)yield b(...F(n)[0])}(e));return function(e,n={}){const t={"Content-Type":"application/zip","Content-Disposition":"attachment"};return("bigint"==typeof n.length||Number.isInteger(n.length))&&n.length>0&&(t["Content-Length"]=String(n.length)),n.metadata&&(t["Content-Length"]=String(x(n.metadata))),new Response(function(e,n={}){const t=function(e){const n=e[Symbol.iterator in e?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const e=await n.next();if(e.done)return e;const[t,r]=F(e.value);return{done:0,value:Object.assign(d(...r),b(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(e);return l(async function*(e,n){const t=[];let r=0n,i=0n,a=0;for await(const o of e){const e=I(o,n.buffersAreUTF8);yield D(o,e),yield new Uint8Array(o.i),o.isFile&&(yield*S(o));const f=o.o>=0xffffffffn,s=12*(r>=0xffffffffn)|28*f;yield A(o,f),t.push(N(o,r,e,s)),t.push(o.i),s&&t.push(U(o,r,s)),f&&(r+=8n),i++,r+=BigInt(46+o.i.length)+o.o,a||(a=f)}let d=0n;for(const e of t)yield e,d+=BigInt(e.length);if(a||r>=0xffffffffn){const e=o(76);e.setUint32(0,1347094022),e.setBigUint64(4,BigInt(44),1),e.setUint32(12,755182848),e.setBigUint64(24,i,1),e.setBigUint64(32,i,1),e.setBigUint64(40,d,1),e.setBigUint64(48,r,1),e.setUint32(56,1347094023),e.setBigUint64(64,r+d,1),e.setUint32(72,1,1),yield f(e)}const l=o(22);l.setUint32(0,1347093766),l.setUint16(8,u(i),1),l.setUint16(10,u(i),1),l.setUint32(12,s(d),1),l.setUint32(16,s(r),1),yield f(l)}(t,n),t)}(e,n),{headers:t})}})();