client-zip
Advanced tools
+6
-0
@@ -0,1 +1,7 @@ | ||
| ## 2.4.6: | ||
| * bugfix: the `filename` attribute in a Content-Disposition header is now parsed correctly | ||
| - when it is not the last attribute in the header | ||
| - and when it is the extended `filename*` attribute | ||
| ## 2.4.5: | ||
@@ -2,0 +8,0 @@ |
+1
-1
@@ -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\*?=["']?(.*?)["']?$/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 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}; |
+2
-2
| { | ||
| "name": "client-zip", | ||
| "version": "2.4.5", | ||
| "version": "2.4.6", | ||
| "description": "A tiny and fast client-side streaming ZIP generator", | ||
@@ -20,3 +20,3 @@ "browser": "index.js", | ||
| "type": "git", | ||
| "url": "git+ssh://git@github.com/Touffy/client-zip.git" | ||
| "url": "git@github.com:Touffy/client-zip.git" | ||
| }, | ||
@@ -23,0 +23,0 @@ "keywords": [ |
+7
-7
@@ -102,3 +102,3 @@  | ||
| An object with a *name* but no *input* and no *size* (not even zero) will be interpreted as an empty folder and renamed accordingly. To properly specify emtpy files without an *input*, set the *size* explicitly to zero (`0` or `0n`). | ||
| An object with a *name* but no *input* and no *size* (not even zero) will be interpreted as an empty folder and renamed accordingly. To properly specify empty files without an *input*, set the *size* explicitly to zero (`0` or `0n`). | ||
@@ -131,7 +131,7 @@ This iterable of metadata can be passed as the `metadata` property of `downloadZip`'s *options*, or, if you want to display the predicted size without actually creating the Zip file, to the `predictLength` function (not exposed in the worker script). Naturally, the metadata and actual data must match, and be **provided in the same order!** Otherwise, there could be inaccuracies in Zip64 lengths. | ||
| **Experiemnt 1** consists of 4 files (total 539 MB) manually added to a file input from my local filesystem, so there is no latency and the ZIP format structural overhead is insignificant. | ||
| **Experiment 1** consists of 4 files (total 539 MB) manually added to a file input from my local filesystem, so there is no latency and the ZIP format structural overhead is insignificant. | ||
| **Experiemnt 2** is a set of 6214 small TGA files (total 119 MB). I tried to load them with a file input as before, but my browsers kept throwing errors while processing the large array of Files. So I had to switch to a different method, where the files are served over HTTP locally by nginx and *fetched* lazily. Unfortunately, that causes some atrocious latency across the board. | ||
| **Experiment 2** is a set of 6214 small TGA files (total 119 MB). I tried to load them with a file input as before, but my browsers kept throwing errors while processing the large array of Files. So I had to switch to a different method, where the files are served over HTTP locally by nginx and *fetched* lazily. Unfortunately, that causes some atrocious latency across the board. | ||
| **Experiemnt 3** is the same set of 6214 TGA files combined with very small PNG files for a total of 12 044 files (total 130 MB). This time, the files are *fetched* by a [DownloadStream](https://github.com/Touffy/dl-stream) to minimize latency. | ||
| **Experiment 3** is the same set of 6214 TGA files combined with very small PNG files for a total of 12 044 files (total 130 MB). This time, the files are *fetched* by a [DownloadStream](https://github.com/Touffy/dl-stream) to minimize latency. | ||
@@ -161,3 +161,3 @@ | | | `client-zip`@2.4.3 | fflate@0.7.4 | zip.js@2.7.14 | conflux@4.0.3 | JSZip@3.10.1 | | ||
| | | `client-zip`@2.4.5 | fflate@0.7.4 | zip.js@2.7.14 | conflux@4.0.3 | JSZip@3.10.1 | | ||
| | | `client-zip`@2.4.6 | fflate@0.7.4 | zip.js@2.7.14 | conflux@4.0.3 | JSZip@3.10.1 | | ||
| |--------------------|-------------------:|-------------:|--------------:|--------------:|--------------:| | ||
@@ -178,3 +178,3 @@ | minified | 6.3 kB | 29.8 kB | 163.2 kB | 198.8 kB | 94.9 kB | | ||
| `client-zip` does not support compression, encryption, or any extra fields and attributes. It already meets the need that sparked its creation: combining many `fetch` responses into a one-click donwload for the end user. | ||
| `client-zip` does not support compression, encryption, or any extra fields and attributes. It already meets the need that sparked its creation: combining many `fetch` responses into a one-click download for the end user. | ||
@@ -222,2 +222,2 @@ **New in version 2**: it now generates Zip64 archives, which increases the limit on file size to 4 Exabytes (because of JavaScript numbers) and total size to 18 Zettabytes. | ||
| Usage of `predictLength` or the `metadata` option must be consistent with the actual input. For exampe, if `{ name: "file" }` is passed as metadata, client-zip will think it's an empty folder named "file/". If you then pass `{ input: "", name: "file" }` in the same order to `downloadZip`, it will store the contents as an empty file with no trailing slash ; therefore, the predicted length will be off by at least one. | ||
| Usage of `predictLength` or the `metadata` option must be consistent with the actual input. For example, if `{ name: "file" }` is passed as metadata, client-zip will think it's an empty folder named "file/". If you then pass `{ input: "", name: "file" }` in the same order to `downloadZip`, it will store the contents as an empty file with no trailing slash ; therefore, the predicted length will be off by at least one. |
+1
-1
@@ -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 l(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:d(e[Symbol.asyncIterator]())};throw new TypeError("Unsupported input format.")}function d(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\*?=["']?(.*?)["']?$/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 x(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}var F=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(...x(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(F(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]=x(e.value);return{done:0,value:Object.assign(l(...r),b(...t))}},throw:n.throw?.bind(n),[Symbol.asyncIterator](){return this}}}(e);return d(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 l=0n;for(const e of t)yield e,l+=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,l,1),e.setBigUint64(48,r,1),e.setUint32(56,1347094023),e.setBigUint64(64,r+l,1),e.setUint32(72,1,1),yield o(e)}const d=f(22);d.setUint32(0,1347093766),d.setUint16(8,u(i),1),d.setUint16(10,u(i),1),d.setUint32(12,s(l),1),d.setUint32(16,s(r),1),yield o(d)}(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 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})}})(); |
41172
0.66%