zip-peek 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +103 -36
- package/dist/types.d.ts +12 -4
- package/dist/types.js +28 -4
- package/dist/zip-utils.d.ts +4 -0
- package/dist/zip-utils.js +16 -0
- package/dist/zipServiceWorker.js +1 -1
- package/dist/zipServiceWorker.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -188,9 +188,14 @@ When fallback resolution succeeds, the asset is still served normally, but `onEr
|
|
|
188
188
|
|
|
189
189
|
`onError`
|
|
190
190
|
|
|
191
|
-
Optional error handler for zip-peek failures and informational reports from the service worker. Receives `(error, info?)
|
|
191
|
+
Optional error handler for zip-peek failures and informational reports from the service worker. Receives `(error, info?)`.
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
- `error.message` is a **stable title** for telemetry grouping, always prefixed with `[zip-peek-error]`. Unique presigned query strings are not included in the title.
|
|
194
|
+
- `info` holds request-specific details (`path=… zipPath=… reason=… status=… cause=…`).
|
|
195
|
+
|
|
196
|
+
Service-worker fetch failures post `ZIP_SW_ERROR` so `onError` runs (allow-list 403, missing manifest/file 404, renew 502, origin/handler 500). A thrown `fetch()` (offline, DNS, CORS) uses `[zip-peek-error] [NetworkError] ZIP asset fetch failed` or `[zip-peek-error] [NetworkError] ZIP manifest fetch failed`. An HTTP error response from origin is not tagged `[NetworkError]`.
|
|
197
|
+
|
|
198
|
+
Besides those failures, `onError` is also called when exact manifest lookup fails but zip-basename folder fallback succeeds (see `requireExactManifestPath`). Use this to log or telemetry mismatches between request paths and manifest layout without blocking the response.
|
|
194
199
|
|
|
195
200
|
`zipAssetCacheName`
|
|
196
201
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InitZipPeekOptions, InitZipPeekResult, RenewPresignedUrlOptions } from "./types";
|
|
2
2
|
import { isZipPackage } from "./zip-utils";
|
|
3
3
|
export type { InitZipPeekOptions, InitZipPeekResult, RenewPresignedUrlOptions, ZipCacheClearingStrategy, ZipPeekErrorHandler, ZipPeekUrlExpiryHandler, ZipWorkerConfig, } from "./types";
|
|
4
|
-
export { getPresignedUrlExpiryMs } from "./zip-utils";
|
|
4
|
+
export { getPresignedUrlExpiryMs, isPresignedUrlExpired } from "./zip-utils";
|
|
5
5
|
/**
|
|
6
6
|
* Registers the zip-peek service worker and configures lazy ZIP asset loading.
|
|
7
7
|
*
|
|
@@ -19,8 +19,9 @@ export { getPresignedUrlExpiryMs } from "./zip-utils";
|
|
|
19
19
|
* worker may reclaim claims from open tabs after a service worker restart.
|
|
20
20
|
*
|
|
21
21
|
* When `onUrlExpiry` is provided and an allowed URL is a recognized presigned
|
|
22
|
-
* URL, zip-peek invokes the handler shortly before expiry
|
|
23
|
-
*
|
|
22
|
+
* URL, zip-peek invokes the handler shortly before expiry, on tab wake after
|
|
23
|
+
* sleep or backgrounding, and when a cache-miss fetch finds the URL already
|
|
24
|
+
* expired. Concurrent callers share one in-flight renewal.
|
|
24
25
|
*/
|
|
25
26
|
export declare function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall, cacheClearingStrategy, allowedZipUrls, requireExactManifestPath, zipAssetCacheName, assetCacheTtlMs, logPrefix, onError, onUrlExpiry, }: InitZipPeekOptions): Promise<InitZipPeekResult>;
|
|
26
27
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isZipPackage = exports.getPresignedUrlExpiryMs = void 0;
|
|
3
|
+
exports.isZipPackage = exports.isPresignedUrlExpired = exports.getPresignedUrlExpiryMs = void 0;
|
|
4
4
|
exports.initZipPeek = initZipPeek;
|
|
5
5
|
exports.renewPresignedUrl = renewPresignedUrl;
|
|
6
6
|
const types_1 = require("./types");
|
|
@@ -8,6 +8,7 @@ const zip_utils_1 = require("./zip-utils");
|
|
|
8
8
|
Object.defineProperty(exports, "isZipPackage", { enumerable: true, get: function () { return zip_utils_1.isZipPackage; } });
|
|
9
9
|
var zip_utils_2 = require("./zip-utils");
|
|
10
10
|
Object.defineProperty(exports, "getPresignedUrlExpiryMs", { enumerable: true, get: function () { return zip_utils_2.getPresignedUrlExpiryMs; } });
|
|
11
|
+
Object.defineProperty(exports, "isPresignedUrlExpired", { enumerable: true, get: function () { return zip_utils_2.isPresignedUrlExpired; } });
|
|
11
12
|
/** Default lead time before presigned URL expiry when scheduling renewal. */
|
|
12
13
|
const URL_EXPIRY_LEAD_MS = 10000;
|
|
13
14
|
/** Retry delay when onUrlExpiry runs but the URL is still tracked (renew failed / skipped). */
|
|
@@ -27,16 +28,8 @@ let lastConfiguredAllowedZipUrls = undefined;
|
|
|
27
28
|
const urlExpiryTimers = new Map();
|
|
28
29
|
/** Original resolved URLs for expiry parsing, keyed by normalized zip URL. */
|
|
29
30
|
const trackedZipUrls = new Map();
|
|
30
|
-
/**
|
|
31
|
-
const urlExpiryInFlight = new
|
|
32
|
-
function zipPackagePathname(zipUrl) {
|
|
33
|
-
try {
|
|
34
|
-
return new URL(zipUrl).pathname;
|
|
35
|
-
}
|
|
36
|
-
catch (_a) {
|
|
37
|
-
return zipUrl.split("?")[0].split("#")[0];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
31
|
+
/** In-flight onUrlExpiry promises keyed by normalized zip URL. */
|
|
32
|
+
const urlExpiryInFlight = new Map();
|
|
40
33
|
const sessionManifests = new Map();
|
|
41
34
|
function normalizeScopePath(href) {
|
|
42
35
|
let p = new URL(href).pathname;
|
|
@@ -180,6 +173,10 @@ function scheduleUrlExpiry(normalizedZipUrl, originalUrlForExpiry) {
|
|
|
180
173
|
trackedZipUrls.delete(normalizedZipUrl);
|
|
181
174
|
return;
|
|
182
175
|
}
|
|
176
|
+
if (isZipUrlDueForRenewal(originalUrlForExpiry)) {
|
|
177
|
+
void invokeUrlExpiry(normalizedZipUrl);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
183
180
|
const delayMs = Math.max(URL_EXPIRY_MIN_DELAY_MS, expiryMs - Date.now() - URL_EXPIRY_LEAD_MS);
|
|
184
181
|
const timerId = setTimeout(() => {
|
|
185
182
|
urlExpiryTimers.delete(normalizedZipUrl);
|
|
@@ -239,24 +236,74 @@ function rearmExpiryIfStillTracked(normalizedZipUrl) {
|
|
|
239
236
|
}, URL_EXPIRY_RETRY_MS);
|
|
240
237
|
urlExpiryTimers.set(normalizedZipUrl, timerId);
|
|
241
238
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
return;
|
|
239
|
+
function invokeUrlExpiry(normalizedZipUrl) {
|
|
240
|
+
const existing = urlExpiryInFlight.get(normalizedZipUrl);
|
|
241
|
+
if (existing)
|
|
242
|
+
return existing;
|
|
243
|
+
const handler = currentOnUrlExpiry;
|
|
244
|
+
if (!handler)
|
|
245
|
+
return Promise.resolve();
|
|
246
|
+
const run = (async () => {
|
|
247
|
+
var _a;
|
|
248
|
+
try {
|
|
249
|
+
await handler({
|
|
250
|
+
expiredZipURL: (_a = trackedZipUrls.get(normalizedZipUrl)) !== null && _a !== void 0 ? _a : "",
|
|
251
|
+
normalizedExpiredZipURL: normalizedZipUrl,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
reportZipPeekError(currentOnError, error, "onUrlExpiry handler failed");
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
urlExpiryInFlight.delete(normalizedZipUrl);
|
|
259
|
+
rearmExpiryIfStillTracked(normalizedZipUrl);
|
|
260
|
+
}
|
|
261
|
+
})();
|
|
262
|
+
urlExpiryInFlight.set(normalizedZipUrl, run);
|
|
263
|
+
return run;
|
|
264
|
+
}
|
|
265
|
+
function resolveTrackedZipEntry(requestedZipUrl) {
|
|
266
|
+
const requested = (0, zip_utils_1.normalizeZipUrl)(requestedZipUrl);
|
|
267
|
+
const original = trackedZipUrls.get(requested);
|
|
268
|
+
if (original) {
|
|
269
|
+
return { normalized: requested, original };
|
|
270
|
+
}
|
|
271
|
+
const path = (0, zip_utils_1.zipPackagePathname)(requestedZipUrl);
|
|
272
|
+
for (const [normalized, orig] of trackedZipUrls) {
|
|
273
|
+
if ((0, zip_utils_1.zipPackagePathname)(normalized) === path || (0, zip_utils_1.zipPackagePathname)(orig) === path) {
|
|
274
|
+
return { normalized, original: orig };
|
|
275
|
+
}
|
|
246
276
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
279
|
+
function resolveCurrentZipUrl(requestedZipUrl) {
|
|
280
|
+
const tracked = resolveTrackedZipEntry(requestedZipUrl);
|
|
281
|
+
if (tracked) {
|
|
282
|
+
return tracked.original;
|
|
253
283
|
}
|
|
254
|
-
|
|
255
|
-
|
|
284
|
+
const path = (0, zip_utils_1.zipPackagePathname)(requestedZipUrl);
|
|
285
|
+
if (Array.isArray(lastConfiguredAllowedZipUrls)) {
|
|
286
|
+
return lastConfiguredAllowedZipUrls.find((url) => (0, zip_utils_1.zipPackagePathname)(url) === path);
|
|
287
|
+
}
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
290
|
+
async function handleSwRenewRequest(zipUrl) {
|
|
291
|
+
var _a, _b;
|
|
292
|
+
try {
|
|
293
|
+
const tracked = resolveTrackedZipEntry(zipUrl);
|
|
294
|
+
const candidateOriginal = (_a = tracked === null || tracked === void 0 ? void 0 : tracked.original) !== null && _a !== void 0 ? _a : zipUrl;
|
|
295
|
+
const candidateNormalized = (_b = tracked === null || tracked === void 0 ? void 0 : tracked.normalized) !== null && _b !== void 0 ? _b : (0, zip_utils_1.normalizeZipUrl)(zipUrl);
|
|
296
|
+
if (isZipUrlDueForRenewal(candidateOriginal) || (0, zip_utils_1.isPresignedUrlExpired)(candidateOriginal)) {
|
|
297
|
+
await invokeUrlExpiry(candidateNormalized);
|
|
298
|
+
}
|
|
299
|
+
const nextUrl = resolveCurrentZipUrl(zipUrl);
|
|
300
|
+
if (!nextUrl || (0, zip_utils_1.isPresignedUrlExpired)(nextUrl)) {
|
|
301
|
+
return { ok: false };
|
|
302
|
+
}
|
|
303
|
+
return { ok: true, nextUrl };
|
|
256
304
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
rearmExpiryIfStillTracked(normalizedZipUrl);
|
|
305
|
+
catch (_c) {
|
|
306
|
+
return { ok: false };
|
|
260
307
|
}
|
|
261
308
|
}
|
|
262
309
|
function ensureClientMessageListener() {
|
|
@@ -296,6 +343,20 @@ function ensureClientMessageListener() {
|
|
|
296
343
|
port.postMessage(files ? { ok: true, files } : { ok: false });
|
|
297
344
|
return;
|
|
298
345
|
}
|
|
346
|
+
if (data.type === "ZIP_SW_RENEW_REQUEST" && data.zipUrl) {
|
|
347
|
+
const port = event.ports[0];
|
|
348
|
+
if (!port)
|
|
349
|
+
return;
|
|
350
|
+
void handleSwRenewRequest(data.zipUrl).then((result) => {
|
|
351
|
+
try {
|
|
352
|
+
port.postMessage(result);
|
|
353
|
+
}
|
|
354
|
+
catch (_a) {
|
|
355
|
+
// Port may already be closed if the client went away.
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
299
360
|
if (data.type !== "ZIP_SW_ERROR" || !currentOnError) {
|
|
300
361
|
return;
|
|
301
362
|
}
|
|
@@ -323,10 +384,11 @@ function normalizeAllowedZipUrls(allowedZipUrls) {
|
|
|
323
384
|
}
|
|
324
385
|
return Array.from(normalized);
|
|
325
386
|
}
|
|
326
|
-
function postWorkerMessage(message) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
387
|
+
async function postWorkerMessage(message) {
|
|
388
|
+
var _a;
|
|
389
|
+
const worker = (_a = navigator.serviceWorker.controller) !== null && _a !== void 0 ? _a : (await navigator.serviceWorker.ready).active;
|
|
390
|
+
if (!worker) {
|
|
391
|
+
throw (0, types_1.createZipPeekError)("No active service worker.");
|
|
330
392
|
}
|
|
331
393
|
return new Promise((resolve, reject) => {
|
|
332
394
|
const channel = new MessageChannel();
|
|
@@ -344,7 +406,7 @@ function postWorkerMessage(message) {
|
|
|
344
406
|
channel.port1.close();
|
|
345
407
|
reject((0, types_1.createZipPeekError)("Failed to deserialize the service worker response on MessageChannel."));
|
|
346
408
|
};
|
|
347
|
-
|
|
409
|
+
worker.postMessage(message, [channel.port2]);
|
|
348
410
|
});
|
|
349
411
|
}
|
|
350
412
|
async function postWorkerMessageOrThrow(message, info) {
|
|
@@ -372,8 +434,9 @@ async function postWorkerMessageOrThrow(message, info) {
|
|
|
372
434
|
* worker may reclaim claims from open tabs after a service worker restart.
|
|
373
435
|
*
|
|
374
436
|
* When `onUrlExpiry` is provided and an allowed URL is a recognized presigned
|
|
375
|
-
* URL, zip-peek invokes the handler shortly before expiry
|
|
376
|
-
*
|
|
437
|
+
* URL, zip-peek invokes the handler shortly before expiry, on tab wake after
|
|
438
|
+
* sleep or backgrounding, and when a cache-miss fetch finds the URL already
|
|
439
|
+
* expired. Concurrent callers share one in-flight renewal.
|
|
377
440
|
*/
|
|
378
441
|
async function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall = true, cacheClearingStrategy = "keep-all", allowedZipUrls, requireExactManifestPath = false, zipAssetCacheName, assetCacheTtlMs, logPrefix, onError, onUrlExpiry, }) {
|
|
379
442
|
if (onError) {
|
|
@@ -388,7 +451,9 @@ async function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall = true, c
|
|
|
388
451
|
throw (0, types_1.createZipPeekError)('cacheClearingStrategy "keep-allowed-urls" requires a non-empty allowedZipUrls allow-list.');
|
|
389
452
|
}
|
|
390
453
|
if (!("serviceWorker" in navigator)) {
|
|
454
|
+
// Usually happens in the built in Facebook/Messenger browser.
|
|
391
455
|
console.warn("zip-peek: Service Worker API not supported in this browser.");
|
|
456
|
+
alert("Browser not supported. Please try a different browser.");
|
|
392
457
|
return { reloaded: false, initialized: false };
|
|
393
458
|
}
|
|
394
459
|
ensureClientMessageListener();
|
|
@@ -473,6 +538,8 @@ async function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall = true, c
|
|
|
473
538
|
*/
|
|
474
539
|
async function renewPresignedUrl({ previousUrl, nextUrl }) {
|
|
475
540
|
if (!("serviceWorker" in navigator)) {
|
|
541
|
+
// Usually happens in the built in Facebook/Messenger browser.
|
|
542
|
+
alert("Browser not supported. Please try a different browser.");
|
|
476
543
|
throw (0, types_1.createZipPeekError)("Service Worker API not supported in this browser.");
|
|
477
544
|
}
|
|
478
545
|
// Prefer the host-provided absolute strings as-is so SigV4 query encoding is
|
|
@@ -494,7 +561,7 @@ async function renewPresignedUrl({ previousUrl, nextUrl }) {
|
|
|
494
561
|
nextUrl: next,
|
|
495
562
|
}, "Failed to renew ZIP URL in service worker");
|
|
496
563
|
if (Array.isArray(lastConfiguredAllowedZipUrls)) {
|
|
497
|
-
lastConfiguredAllowedZipUrls = lastConfiguredAllowedZipUrls.map((url) => url === previous ? next : url);
|
|
564
|
+
lastConfiguredAllowedZipUrls = lastConfiguredAllowedZipUrls.map((url) => (url === previous ? next : url));
|
|
498
565
|
if (!lastConfiguredAllowedZipUrls.includes(next)) {
|
|
499
566
|
lastConfiguredAllowedZipUrls = [...lastConfiguredAllowedZipUrls, next];
|
|
500
567
|
}
|
|
@@ -506,9 +573,9 @@ async function renewPresignedUrl({ previousUrl, nextUrl }) {
|
|
|
506
573
|
}
|
|
507
574
|
// Drop the previous URL and any orphaned tracked URLs for the same zip path
|
|
508
575
|
// (e.g. when a prior renew used a mismatched previousUrl and left a timer-less entry).
|
|
509
|
-
const nextPath = zipPackagePathname(next);
|
|
576
|
+
const nextPath = (0, zip_utils_1.zipPackagePathname)(next);
|
|
510
577
|
for (const [normalized] of [...trackedZipUrls]) {
|
|
511
|
-
if (normalized === previous || zipPackagePathname(normalized) === nextPath) {
|
|
578
|
+
if (normalized === previous || (0, zip_utils_1.zipPackagePathname)(normalized) === nextPath) {
|
|
512
579
|
trackedZipUrls.delete(normalized);
|
|
513
580
|
clearUrlExpiryTimer(normalized);
|
|
514
581
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -35,10 +35,11 @@ export type InitZipPeekOptions = {
|
|
|
35
35
|
/**
|
|
36
36
|
* Called shortly before a recognized presigned URL expires (CloudFront
|
|
37
37
|
* `Expires` or S3 `X-Amz-Date` + `X-Amz-Expires`). Also invoked after tab
|
|
38
|
-
* wake when a timer was missed due to sleep or background throttling
|
|
38
|
+
* wake when a timer was missed due to sleep or background throttling, and
|
|
39
|
+
* when a service-worker cache miss finds the URL already expired.
|
|
39
40
|
* Not scheduled for non-presigned ZIP URLs. If the handler does not call
|
|
40
41
|
* `renewPresignedUrl`, zip-peek re-arms a retry timer so renewal is not
|
|
41
|
-
* one-shot.
|
|
42
|
+
* one-shot. Concurrent callers share one in-flight handler call per ZIP URL.
|
|
42
43
|
*/
|
|
43
44
|
onUrlExpiry?: ZipPeekUrlExpiryHandler;
|
|
44
45
|
};
|
|
@@ -52,7 +53,14 @@ export type WorkerMessageResponse = {
|
|
|
52
53
|
errorStack?: string;
|
|
53
54
|
};
|
|
54
55
|
export declare const ZIP_PEEK_ERROR_PREFIX = "[zip-peek-error]";
|
|
56
|
+
export declare const NETWORK_ERROR_PREFIX = "[NetworkError]";
|
|
55
57
|
export declare function formatZipPeekError(message: string): string;
|
|
56
|
-
|
|
57
|
-
export declare function
|
|
58
|
+
/** Compact `key=value` details for `onError` info (Sentry extra), not the error title. */
|
|
59
|
+
export declare function zipErrorInfo(fields: Record<string, string | number | boolean | null | undefined>): string;
|
|
60
|
+
export type ZipPeekError = Error & {
|
|
61
|
+
zipPeekInfo?: string;
|
|
62
|
+
};
|
|
63
|
+
export declare function createZipPeekError(message: string, info?: string): Error;
|
|
64
|
+
export declare function toZipPeekError(error: unknown): ZipPeekError;
|
|
65
|
+
export declare function zipPeekErrorInfo(error: unknown): string | undefined;
|
|
58
66
|
export declare function errorMessage(error: unknown): string;
|
package/dist/types.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZIP_PEEK_ERROR_PREFIX = void 0;
|
|
3
|
+
exports.NETWORK_ERROR_PREFIX = exports.ZIP_PEEK_ERROR_PREFIX = void 0;
|
|
4
4
|
exports.formatZipPeekError = formatZipPeekError;
|
|
5
|
+
exports.zipErrorInfo = zipErrorInfo;
|
|
5
6
|
exports.createZipPeekError = createZipPeekError;
|
|
6
7
|
exports.toZipPeekError = toZipPeekError;
|
|
8
|
+
exports.zipPeekErrorInfo = zipPeekErrorInfo;
|
|
7
9
|
exports.errorMessage = errorMessage;
|
|
8
10
|
exports.ZIP_PEEK_ERROR_PREFIX = "[zip-peek-error]";
|
|
11
|
+
exports.NETWORK_ERROR_PREFIX = "[NetworkError]";
|
|
9
12
|
function formatZipPeekError(message) {
|
|
10
13
|
const trimmed = message.trim();
|
|
11
14
|
if (trimmed.startsWith(exports.ZIP_PEEK_ERROR_PREFIX)) {
|
|
@@ -13,16 +16,37 @@ function formatZipPeekError(message) {
|
|
|
13
16
|
}
|
|
14
17
|
return `${exports.ZIP_PEEK_ERROR_PREFIX} ${trimmed}`;
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
/** Compact `key=value` details for `onError` info (Sentry extra), not the error title. */
|
|
20
|
+
function zipErrorInfo(fields) {
|
|
21
|
+
return Object.entries(fields)
|
|
22
|
+
.filter((entry) => {
|
|
23
|
+
const value = entry[1];
|
|
24
|
+
return value != null && value !== "";
|
|
25
|
+
})
|
|
26
|
+
.map(([key, value]) => `${key}=${String(value)}`)
|
|
27
|
+
.join(" ");
|
|
28
|
+
}
|
|
29
|
+
function createZipPeekError(message, info) {
|
|
30
|
+
const err = new Error(formatZipPeekError(message));
|
|
31
|
+
if (info) {
|
|
32
|
+
err.zipPeekInfo = info;
|
|
33
|
+
}
|
|
34
|
+
return err;
|
|
18
35
|
}
|
|
19
36
|
function toZipPeekError(error) {
|
|
20
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
37
|
+
const err = (error instanceof Error ? error : new Error(String(error)));
|
|
21
38
|
if (!err.message.startsWith(exports.ZIP_PEEK_ERROR_PREFIX)) {
|
|
22
39
|
err.message = formatZipPeekError(err.message);
|
|
23
40
|
}
|
|
24
41
|
return err;
|
|
25
42
|
}
|
|
43
|
+
function zipPeekErrorInfo(error) {
|
|
44
|
+
if (error && typeof error === "object" && "zipPeekInfo" in error) {
|
|
45
|
+
const info = error.zipPeekInfo;
|
|
46
|
+
return info ? info : undefined;
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
26
50
|
function errorMessage(error) {
|
|
27
51
|
return error instanceof Error ? error.message : String(error);
|
|
28
52
|
}
|
package/dist/zip-utils.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export type NormalizeZipUrlOptions = {
|
|
|
12
12
|
* are not re-encoded.
|
|
13
13
|
*/
|
|
14
14
|
export declare function normalizeZipUrl(urlString: string, options?: NormalizeZipUrlOptions): string;
|
|
15
|
+
/** Pathname of a ZIP package URL (`/pkg.zip`), ignoring query and hash. */
|
|
16
|
+
export declare function zipPackagePathname(zipUrl: string): string;
|
|
17
|
+
/** True when a recognized presigned ZIP URL has already passed its expiry. */
|
|
18
|
+
export declare function isPresignedUrlExpired(url: string): boolean;
|
|
15
19
|
/** Basename of the ZIP file from a package URL, without the `.zip` extension. */
|
|
16
20
|
export declare function zipBasenameWithoutExtension(zipUrl: string): string;
|
|
17
21
|
/** Align zip entry names with URL paths under `*.zip/…`. */
|
package/dist/zip-utils.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isZipPackage = isZipPackage;
|
|
4
4
|
exports.normalizeZipUrl = normalizeZipUrl;
|
|
5
|
+
exports.zipPackagePathname = zipPackagePathname;
|
|
6
|
+
exports.isPresignedUrlExpired = isPresignedUrlExpired;
|
|
5
7
|
exports.zipBasenameWithoutExtension = zipBasenameWithoutExtension;
|
|
6
8
|
exports.normalizeZipEntryPath = normalizeZipEntryPath;
|
|
7
9
|
exports.parseZipAssetRequest = parseZipAssetRequest;
|
|
@@ -46,6 +48,20 @@ function normalizeZipUrl(urlString, options = {}) {
|
|
|
46
48
|
return prefix + hashSection;
|
|
47
49
|
return prefix + "?" + filtered.join("&") + hashSection;
|
|
48
50
|
}
|
|
51
|
+
/** Pathname of a ZIP package URL (`/pkg.zip`), ignoring query and hash. */
|
|
52
|
+
function zipPackagePathname(zipUrl) {
|
|
53
|
+
try {
|
|
54
|
+
return new URL(zipUrl).pathname;
|
|
55
|
+
}
|
|
56
|
+
catch (_a) {
|
|
57
|
+
return zipUrl.split("?")[0].split("#")[0];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** True when a recognized presigned ZIP URL has already passed its expiry. */
|
|
61
|
+
function isPresignedUrlExpired(url) {
|
|
62
|
+
const expiryMs = getPresignedUrlExpiryMs(url);
|
|
63
|
+
return expiryMs != null && expiryMs <= Date.now();
|
|
64
|
+
}
|
|
49
65
|
/** Basename of the ZIP file from a package URL, without the `.zip` extension. */
|
|
50
66
|
function zipBasenameWithoutExtension(zipUrl) {
|
|
51
67
|
var _a, _b;
|
package/dist/zipServiceWorker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var e={553(e,t){function n(e){const n=e.trim();return n.startsWith(t.ZIP_PEEK_ERROR_PREFIX)?n:`${t.ZIP_PEEK_ERROR_PREFIX} ${n}`}t.ZIP_PEEK_ERROR_PREFIX=void 0,t.formatZipPeekError=n,t.createZipPeekError=function(e){return new Error(n(e))},t.toZipPeekError=function(e){const s=e instanceof Error?e:new Error(String(e));return s.message.startsWith(t.ZIP_PEEK_ERROR_PREFIX)||(s.message=n(s.message)),s},t.errorMessage=function(e){return e instanceof Error?e.message:String(e)},t.ZIP_PEEK_ERROR_PREFIX="[zip-peek-error]"},314(e,t,n){t.clearAllClientClaims=void 0,t.persistAllowListState=o,t.ensureAllowedZipUrlsLoaded=async function(){if(r.allowedZipUrlsLoaded)return r.allowedZipUrlsLoaded;const e=(async()=>{try{const e=await caches.open(r.CONFIG_CACHE_NAME),t=await e.match(r.CONFIG_CACHE_KEY);if(!t)return;const n=await t.json();if(Array.isArray(n.allowedZipUrls)){const e=new Set(n.allowedZipUrls.filter(e=>"string"==typeof e).map(e=>(0,s.normalizeZipUrl)(e)));(0,r.setAllowListRestricted)(!1!==n.restricted),(0,r.setPersistedAllowUnion)(e)}else(0,r.setAllowListRestricted)(!1),(0,r.setPersistedAllowUnion)(null)}catch(e){(0,i.warn)("failed to load runtime config",e)}})();return(0,r.setAllowedZipUrlsLoaded)(e),e},t.clearZipAssetsExceptLiveClaims=async function(e){if(await l(),!r.allowListRestricted)return;if(await async function(){const e=await self.clients.matchAll({type:"window",includeUncontrolled:!0});await Promise.all(e.map(e=>async function(e){await new Promise(t=>{const n=new MessageChannel,o=setTimeout(()=>{n.port1.onmessage=null,n.port1.close(),t()},400);n.port1.onmessage=i=>{clearTimeout(o);const a=i.data;a&&"allowedZipUrls"in a&&(Array.isArray(a.allowedZipUrls)?(0,r.setClientAllowedZipUrls)(e.id,a.allowedZipUrls.map(e=>(0,s.normalizeZipUrl)(e))):null===a.allowedZipUrls&&r.clientAllowedZipUrls.delete(e.id)),n.port1.onmessage=null,n.port1.close(),t()};try{e.postMessage({type:"ZIP_SW_CLAIM_REQUEST"},[n.port2])}catch(e){clearTimeout(o),n.port1.close(),(0,i.warn)("failed to post ZIP_SW_CLAIM_REQUEST",e),t()}})}(e))),r.clientAllowedZipUrls.size>0?((0,r.setAllowListRestricted)(!0),await o()):e.length>0&&((0,r.setAllowListRestricted)(!1),(0,r.setPersistedAllowUnion)(null),await a(null,!1))}(),await l(),!r.allowListRestricted)return;const t=(0,r.getClaimsUnion)();await e(Array.from(t)),await o()},t.applyRuntimeConfig=async function(e,t){if(!e)return;let n=Object.assign({},r.runtimeConfig),i=!1;if("string"==typeof e.zipAssetCacheName&&e.zipAssetCacheName.trim()&&(n.zipAssetCacheName=e.zipAssetCacheName,i=!0),"number"==typeof e.assetCacheTtlMs&&Number.isFinite(e.assetCacheTtlMs)&&(n.assetCacheTtlMs=e.assetCacheTtlMs,i=!0),"string"==typeof e.logPrefix&&e.logPrefix.trim()&&(n.logPrefix=e.logPrefix,i=!0),"boolean"==typeof e.requireExactManifestPath&&(n.requireExactManifestPath=e.requireExactManifestPath,i=!0),i&&(0,r.setRuntimeConfig)(n),"allowedZipUrls"in e){const n=Array.isArray(e.allowedZipUrls)?e.allowedZipUrls.map(e=>(0,s.normalizeZipUrl)(e)):null;if(!t)return null===n?((0,r.clearAllClientClaims)(),(0,r.setAllowedZipUrlsLoaded)(Promise.resolve()),void await a(null,!1)):((0,r.setAllowListRestricted)(!0),(0,r.setPersistedAllowUnion)(new Set(n)),(0,r.setAllowedZipUrlsLoaded)(Promise.resolve()),void await a(n,!0));if(null===n){if(r.clientAllowedZipUrls.delete(t),await l(),0===r.clientAllowedZipUrls.size)return(0,r.setAllowListRestricted)(!1),(0,r.setPersistedAllowUnion)(null),(0,r.setAllowedZipUrlsLoaded)(Promise.resolve()),void await a(null,!1)}else(0,r.setClientAllowedZipUrls)(t,n);await l(),(0,r.setAllowedZipUrlsLoaded)(Promise.resolve()),await o()}},t.renewAllowedZipUrlClaims=function(e,t){for(const n of r.clientAllowedZipUrls.values())n.has(e)&&(n.delete(e),n.add(t));if(null===r.persistedAllowUnion||void 0===r.persistedAllowUnion?void 0:r.persistedAllowUnion.has(e)){const n=new Set(r.persistedAllowUnion);n.delete(e),n.add(t),(0,r.setPersistedAllowUnion)(n)}},t.isZipUrlAllowed=function(e){const t=(0,r.getAllowedZipUrlsUnion)();return null===t||t.has(e)};const s=n(343),r=n(262);Object.defineProperty(t,"clearAllClientClaims",{enumerable:!0,get:function(){return r.clearAllClientClaims}});const i=n(266);async function o(){const e=r.allowListRestricted?Array.from((0,r.getClaimsUnion)()):null;r.allowListRestricted?(0,r.setPersistedAllowUnion)(new Set(null!=e?e:[])):(0,r.setPersistedAllowUnion)(null),await a(e,r.allowListRestricted)}async function a(e,t=null!==e){try{const n=await caches.open(r.CONFIG_CACHE_NAME);await n.put(new Request(r.CONFIG_CACHE_KEY),new Response(JSON.stringify({allowedZipUrls:e,restricted:t}),{headers:{"Content-Type":"application/json"}}))}catch(e){(0,i.warn)("failed to persist runtime config",e)}}async function l(){const e=await self.clients.matchAll({type:"window",includeUncontrolled:!0}),t=new Set(e.map(e=>e.id));for(const e of[...r.clientAllowedZipUrls.keys()])t.has(e)||r.clientAllowedZipUrls.delete(e);0===r.clientAllowedZipUrls.size&&r.allowListRestricted?((0,r.setPersistedAllowUnion)(null),await a([],!0)):r.clientAllowedZipUrls.size>0&&await o()}},800(e,t,n){t.canonicalAssetRequest=function(e,t){return new Request((0,r.canonicalZipAssetRequestUrl)(e,t),{method:"GET"})},t.clearAllZipAssets=async function(){const e=await caches.open(a.runtimeConfig.zipAssetCacheName),t=await e.keys();await Promise.all(t.map(t=>e.delete(t))),await caches.delete(a.CONFIG_CACHE_NAME),a.zipManifests.clear(),a.pendingManifestLoads.clear(),a.inFlightZipAssets.clear(),(0,i.clearAllClientClaims)(),(0,a.setAllowedZipUrlsLoaded)(Promise.resolve())},t.clearZipAssetsExceptAllowed=async function(e){try{const t=new Set(e),n=await caches.open(a.runtimeConfig.zipAssetCacheName),s=await n.keys();for(const e of s){const s=e.url,i=(0,r.parseZipAssetRequest)(s);i&&!t.has(i.zipUrl)&&await n.delete(e)}for(const e of a.zipManifests.keys())t.has(e)||a.zipManifests.delete(e)}catch(e){throw(0,s.createZipPeekError)(`Failed to clear zip assets except allowed URLs: ${(0,s.errorMessage)(e)}`)}},t.putCachedFullAssetIfAbsent=async function(e,t){var n;try{const s=await caches.open(a.runtimeConfig.zipAssetCacheName),r=await s.match(e);if(r&&!c(r))return void await(null===(n=t.body)||void 0===n?void 0:n.cancel());const i=new Headers(t.headers);i.set(a.ASSET_CACHED_AT_HEADER,String(Date.now())),i.set("Access-Control-Allow-Origin","*"),await s.put(e,new Response(t.body,{status:t.status,statusText:t.statusText,headers:i}))}catch(e){t.body&&!t.body.locked&&await t.body.cancel(e),(0,l.warn)("asset cache put failed",e)}},t.readCachedZipAssetIfFresh=async function(e){let t=null,n="network";try{const s=await caches.open(a.runtimeConfig.zipAssetCacheName),r=await s.match(e);if(r)if(c(r))try{await s.delete(e)}catch(e){(0,l.warn)("asset cache delete expired failed",e)}else t=r,n="cache-api"}catch(e){(0,l.warn)("asset cache read failed",e)}return{response:t,assetSource:n}},t.renewZipUrl=async function(e,t){const n=(0,r.normalizeZipUrl)(e),l=(0,r.normalizeZipUrl)(t);if(n===l)return;a.allowListRestricted&&((0,i.renewAllowedZipUrlClaims)(n,l),(0,a.setAllowedZipUrlsLoaded)(Promise.resolve()),await(0,i.persistAllowListState)());const c=a.zipManifests.get(n);c&&(a.zipManifests.set(l,c),a.zipManifests.delete(n));const f=a.pendingManifestLoads.get(n);f&&(a.pendingManifestLoads.set(l,f),a.pendingManifestLoads.delete(n)),(0,o.remapInFlightZipAssetsForRenewal)(n,l);try{const e=await caches.open(a.runtimeConfig.zipAssetCacheName),t=await e.keys();for(const s of t){const t=s.url,i=(0,r.parseZipAssetRequest)(t);i&&(0,r.normalizeZipUrl)(i.zipUrl)===n&&await e.delete(s)}}catch(e){throw(0,s.createZipPeekError)(`Failed to clear cached assets for renewed ZIP URL: ${(0,s.errorMessage)(e)}`)}};const s=n(553),r=n(343),i=n(314),o=n(30),a=n(262),l=n(266);function c(e){const t=e.headers.get(a.ASSET_CACHED_AT_HEADER);if(!t)return!0;const n=parseInt(t,10);return!Number.isFinite(n)||Date.now()-n>a.runtimeConfig.assetCacheTtlMs}},30(e,t,n){t.getOrStartInFlightAsset=function(e,t){const n=e.url,s=r.inFlightZipAssets.get(n);if(s)return s;let i,o;const a=new Promise((e,t)=>{i=e,o=t}),l={resultPromise:t(),cacheFillPromise:a,leaderClaimed:!1,resolveCacheFill:i,rejectCacheFill:o};return a.finally(()=>{r.inFlightZipAssets.delete(n)}),r.inFlightZipAssets.set(n,l),l},t.completeInFlightAssetLoad=function(e,t){const n=r.inFlightZipAssets.get(e);n&&(void 0!==t?n.rejectCacheFill(t):n.resolveCacheFill())},t.remapInFlightZipAssetsForRenewal=function(e,t){const n=(0,s.normalizeZipUrl)(e),i=(0,s.normalizeZipUrl)(t);for(const[e,t]of[...r.inFlightZipAssets]){const o=(0,s.parseZipAssetRequest)(e);if(o&&(0,s.normalizeZipUrl)(o.zipUrl)===n){const n=(0,s.canonicalZipAssetRequestUrl)(i,o.internalPath);r.inFlightZipAssets.delete(e),r.inFlightZipAssets.set(n,t)}}};const s=n(343),r=n(262)},982(e,t,n){t.installFetchHandler=function(){self.addEventListener("fetch",e=>{const t=e.request.method;if("GET"!==t&&"HEAD"!==t)return;if(!(0,r.parseZipAssetRequest)(e.request.url))return;const n=async function(e,t){var n;const p="HEAD"===e.method,h=(0,r.parseZipAssetRequest)(e.url),g=(0,r.normalizeZipUrl)(h.zipUrl),m=h.internalPath,A=(0,r.normalizeZipEntryPath)(m);try{if(await(0,i.ensureAllowedZipUrlsLoaded)(),!(0,i.isZipUrlAllowed)(g))return(0,c.warn)("zip URL not allowed",{requestedZipUrl:g}),{response:(0,u.corsErrorResponse)(`ZIP URL not allowed (not in allowedZipUrls): ${g}`,403)};let r=l.zipManifests.get(g);if(r||(r=null!==(n=await(0,f.ensureManifestAvailable)(g,t))&&void 0!==n?n:void 0),!r){const e=Array.from(l.zipManifests.keys());return(0,c.warn)("manifest missing for zipUrl",{requestedZipUrl:g,knownZipUrls:e}),{response:(0,u.corsErrorResponse)(`ZIP manifest not loaded for ${g}. Ensure the ZIP is reachable and supports byte-range requests.`,404)}}const h=(0,f.resolveManifestEntry)(r,A,g,l.runtimeConfig.requireExactManifestPath);if(!h){const e=Array.from(r.keys()).slice(0,50);return(0,c.warn)("file not in manifest",{zipUrl:g,internalPathRaw:m,internalPathNormalized:A,requireExactManifestPath:l.runtimeConfig.requireExactManifestPath,manifestSize:r.size,sampleKeys:e}),{response:(0,u.corsErrorResponse)(`File "${m}" not found in ZIP manifest for ${g}`,404)}}const{key:E,info:y,matchKind:U}=h;if("zipBasenameFallback"===U&&((0,c.log)("resolved via zip-basename folder fallback",{requested:A,manifestKey:E}),(0,c.reportClientError)(new Error((0,s.formatZipPeekError)("Exact manifest path not found; resolved via zip-basename folder fallback")),`Exact manifest key "${A}" not found in ${g}; resolved using "${E}"`)),p)return{response:w(e,E,y)};const R=(0,o.canonicalAssetRequest)(g,E),C=await(0,o.readCachedZipAssetIfFresh)(R),Z=(0,f.entryUncompressedSize)(y),v=(0,u.getMimeType)(E);if(C.response)return{response:d(C.response.body,v,Z,C.assetSource,e.headers.get("range"))};const S=(0,a.getOrStartInFlightAsset)(R,()=>(0,u.fetchUncompressedZipEntryFromNetwork)(g,E,y)),z=await S.resultPromise;if(!z.ok)return(0,a.completeInFlightAssetLoad)(R.url),{response:z.response};const P=!S.leaderClaimed&&(S.leaderClaimed=!0),_=8===y.compression?null:e.headers.get("range");if(!P){await S.cacheFillPromise;const t=await(0,o.readCachedZipAssetIfFresh)(R);return t.response?{response:d(t.response.body,v,Z,t.assetSource,e.headers.get("range"))}:{response:(0,u.corsErrorResponse)(`Failed to serve "${E}" from ${g}: asset cache was not ready after in-flight load`,500)}}const[b,L]=z.stream.tee(),M={"Content-Type":z.contentType};null!==z.contentLength&&(M["Content-Length"]=String(z.contentLength));const I=R.url,T=(0,o.putCachedFullAssetIfAbsent)(R,new Response(L,{status:200,headers:M})).then(()=>{(0,a.completeInFlightAssetLoad)(I)}).catch(e=>{throw(0,a.completeInFlightAssetLoad)(I,e),e});return{response:d(b,z.contentType,z.contentLength,"network",_),background:T}}catch(e){return(0,c.error)("fetch handler failed",{zipUrl:g,internalPath:m,message:(0,s.errorMessage)(e)}),{response:(0,u.corsErrorResponse)(`Failed to serve "${m}" from ${g}: ${(0,s.errorMessage)(e)}`,500)}}}(e.request,e.clientId||void 0);e.respondWith(n.then(({response:e})=>e)),e.waitUntil(n.then(({background:e})=>e).catch(e=>{(0,c.warn)("background asset cache failed",(0,s.errorMessage)(e))}))})};const s=n(553),r=n(343),i=n(314),o=n(800),a=n(30),l=n(262),c=n(266),f=n(346),u=n(254);function p(e){return{"Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":l.ASSET_SOURCE_HEADER,[l.ASSET_SOURCE_HEADER]:e}}function d(e,t,n,s,r){if(r){if(null===n)return null==e||e.cancel(),new Response(null,{status:416,headers:p(s)});const i=r.replace(/^bytes=/,"");if(i.includes(","))return null==e||e.cancel(),new Response(null,{status:416,headers:Object.assign({"Content-Range":`bytes */${n}`},p(s))});const[o,a]=i.split("-"),l=""!==o?parseInt(o,10):NaN,c=""!==a?parseInt(a,10):n-1;if(isNaN(l)||isNaN(c)||l<0||c<l||l>=n)return null==e||e.cancel(),new Response(null,{status:416,headers:Object.assign({"Content-Range":`bytes */${n}`},p(s))});const f=Math.min(c,n-1),u=f-l+1,d=null===e?null:function(e,t,n){const s=e.getReader();let r=0,i=!1;return new ReadableStream({async pull(e){for(;!i;){const{done:o,value:a}=await s.read();if(o)return i=!0,void e.close();const l=a,c=r,f=r+l.byteLength-1;if(r+=l.byteLength,f<t)continue;if(c>n)return i=!0,void e.close();const u=Math.max(0,t-c),p=Math.min(l.byteLength,n-c+1);if(p>u&&e.enqueue(l.subarray(u,p)),f>=n)return i=!0,void e.close()}},cancel:e=>s.cancel(e)})}(e,l,f);return new Response(d,{status:206,headers:Object.assign({"Content-Type":t,"Content-Range":`bytes ${l}-${f}/${n}`,"Content-Length":u.toString(),"Accept-Ranges":"bytes"},p(s))})}const i=Object.assign({"Content-Type":t},p(s));return null!==n&&(i["Content-Length"]=n.toString(),i["Accept-Ranges"]="bytes"),new Response(e,{status:200,headers:i})}function w(e,t,n){const s=(0,u.getMimeType)(t),r=(0,f.entryUncompressedSize)(n),i=e.headers.get("range");if(null!==r&&i)return d(null,s,r,"manifest",i);const o=Object.assign({"Content-Type":s},p("manifest"));return null!==r&&(o["Content-Length"]=r.toString(),o["Accept-Ranges"]="bytes"),new Response(null,{status:200,headers:o})}},262(e,t){function n(){const e=new Set;for(const n of t.clientAllowedZipUrls.values())for(const t of n)e.add(t);return e}t.CONFIG_CACHE_KEY=t.allowedZipUrlsLoaded=t.persistedAllowUnion=t.allowListRestricted=t.clientAllowedZipUrls=t.runtimeConfig=t.inFlightZipAssets=t.pendingManifestLoads=t.zipManifests=t.LOCAL_FILE_HEADER_SIG=t.MIME_TYPES=t.ASSET_UPSTREAM_STATUS_HEADER=t.ASSET_ERROR_HEADER=t.ASSET_SOURCE_HEADER=t.ASSET_CACHED_AT_HEADER=t.CONFIG_CACHE_NAME=t.kF=t.o2=void 0,t.setRuntimeConfig=function(e){t.runtimeConfig=e},t.setAllowListRestricted=function(e){t.allowListRestricted=e},t.setPersistedAllowUnion=function(e){t.persistedAllowUnion=e},t.setAllowedZipUrlsLoaded=function(e){t.allowedZipUrlsLoaded=e},t.getClaimsUnion=n,t.getAllowedZipUrlsUnion=function(){return t.allowListRestricted?t.clientAllowedZipUrls.size>0?n():null!==t.persistedAllowUnion&&void 0!==t.persistedAllowUnion?t.persistedAllowUnion:new Set:null},t.setClientAllowedZipUrls=function(e,n){null!==n?(t.allowListRestricted=!0,t.clientAllowedZipUrls.set(e,new Set(n))):t.clientAllowedZipUrls.delete(e)},t.clearAllClientClaims=function(){t.clientAllowedZipUrls.clear(),t.allowListRestricted=!1,t.persistedAllowUnion=null},t.o2="zip-cache-v1",t.kF=72e5,t.CONFIG_CACHE_NAME="zip-peek-config-v1",t.o2,t.CONFIG_CACHE_NAME,t.ASSET_CACHED_AT_HEADER="X-ZipSW-Cached-At",t.ASSET_SOURCE_HEADER="X-ZipSW-Asset-Source",t.ASSET_ERROR_HEADER="X-ZipSW-Error",t.ASSET_UPSTREAM_STATUS_HEADER="X-ZipSW-Upstream-Status",t.MIME_TYPES={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",json:"application/json",js:"application/javascript",css:"text/css; charset=utf-8",html:"text/html; charset=utf-8",txt:"text/plain; charset=utf-8",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",wav:"audio/wav",oga:"audio/ogg",ogg:"audio/ogg",xml:"application/xml",wasm:"application/wasm"},t.LOCAL_FILE_HEADER_SIG=67324752,t.zipManifests=new Map,t.pendingManifestLoads=new Map,t.inFlightZipAssets=new Map,t.runtimeConfig={zipAssetCacheName:t.o2,assetCacheTtlMs:t.kF,logPrefix:"[zipSW]",requireExactManifestPath:!1},t.clientAllowedZipUrls=new Map,t.allowListRestricted=!1,t.persistedAllowUnion=null,t.allowedZipUrlsLoaded=null,t.CONFIG_CACHE_KEY=new URL("__zip_peek_runtime_config__",self.registration.scope).href},266(e,t,n){t.log=function(...e){console.log(r.runtimeConfig.logPrefix,...e)},t.warn=function(...e){console.warn(r.runtimeConfig.logPrefix,...e)},t.error=function(...e){console.error(r.runtimeConfig.logPrefix,s.ZIP_PEEK_ERROR_PREFIX,...e)},t.reportClientError=i,t.installClientErrorReporting=function(){self.addEventListener("error",e=>{var t;i(null!==(t=e.error)&&void 0!==t?t:e.message,"Service worker uncaught error")}),self.addEventListener("unhandledrejection",e=>{i(e.reason,"Service worker unhandled promise rejection")})};const s=n(553),r=n(262);function i(e,t){const n=(0,s.toZipPeekError)(e);self.clients.matchAll({type:"window",includeUncontrolled:!0}).then(e=>{const r={type:"ZIP_SW_ERROR",error:{message:n.message,stack:n.stack},info:t?(0,s.formatZipPeekError)(t):void 0};for(const t of e)t.postMessage(r)})}},346(e,t,n){t.manifestFilesToMap=o,t.sendManifestToClientId=l,t.ensureManifestAvailable=function(e,t){const n=r.zipManifests.get(e);if(n)return Promise.resolve(n);let c=r.pendingManifestLoads.get(e);return c||(c=(async()=>{const n=await async function(e,t){const n=await a(t);return n?function(e,t){return new Promise(n=>{const s=new MessageChannel,r=setTimeout(()=>{s.port1.close(),n(null)},500);s.port1.onmessage=e=>{clearTimeout(r),s.port1.close();const t=e.data;(null==t?void 0:t.ok)&&Array.isArray(t.files)?n(o(t.files)):n(null)},s.port1.onmessageerror=()=>{clearTimeout(r),s.port1.close(),n(null)};try{e.postMessage({type:"ZIP_SW_MANIFEST_REQUEST",zipUrl:t},[s.port2])}catch(e){clearTimeout(r),s.port1.close(),(0,i.warn)("failed to request manifest from client",e),n(null)}})}(n,e):null}(e,t);if(n)return r.zipManifests.set(e,n),(0,i.log)("restored manifest from client memory",{zipUrl:e,entryCount:n.size}),n;const c=await async function(e){const t=await fetch(e,{headers:{Range:"bytes=-65536"}});if(206!==t.status)return(0,i.error)("range requests not supported for ZIP manifest",{zipUrl:e,status:t.status}),null;const n=await t.arrayBuffer(),r=new DataView(n);let o=-1;for(let e=n.byteLength-22;e>=0;e--)if(101010256===r.getUint32(e,!0)){o=e;break}if(-1===o)return(0,i.error)("EOCD not found in last 64KB of ZIP file",e),null;const a=r.getUint32(o+16,!0),l=r.getUint32(o+12,!0);let c=n,f=-1;const u=t.headers.get("Content-Range");let p=0;if(u){const e=u.match(/\/(\d+)$/);e&&(p=parseInt(e[1],10))}if(p<=0)return(0,i.error)("could not determine ZIP file size from Content-Range header",{zipUrl:e,contentRange:u}),null;const d=p-n.byteLength;if(a>=d)f=a-d;else{const t=await fetch(e,{headers:{Range:`bytes=${a}-${a+l-1}`}});if(206!==t.status)return(0,i.error)("failed to fetch ZIP central directory",{zipUrl:e,status:t.status,cdOffset:a,cdSize:l}),null;c=await t.arrayBuffer(),f=0}return function(e,t,n,r){const o=new DataView(e);let a=t;const l=[];for(;a+46<=e.byteLength&&33639248===o.getUint32(a,!0);){const t=o.getUint16(a+10,!0),n=o.getUint32(a+20,!0),r=o.getUint32(a+24,!0),i=o.getUint16(a+28,!0),c=o.getUint16(a+30,!0),f=o.getUint16(a+32,!0),u=o.getUint32(a+42,!0),p=new TextDecoder;if(a+46+i>e.byteLength)break;const d=new Uint8Array(e,a+46,i),w=p.decode(d),h=(0,s.normalizeZipEntryPath)(w);""!==h&&l.push({filename:h,offset:u,compressedSize:n,uncompressedSize:r,compression:t}),a+=46+i+c+f}if(0===l.length)return(0,i.error)("no files parsed from central directory",r),null;l.sort((e,t)=>e.offset-t.offset);const c=new Map;for(let e=0;e<l.length;e++){const t=l[e],r=(0,s.normalizeZipEntryPath)(t.filename);""!==r&&(c.has(r)&&(0,i.warn)("duplicate manifest key after normalize; overwriting",r),c.set(r,{filename:t.filename,offset:t.offset,compressedSize:t.compressedSize,uncompressedSize:t.uncompressedSize,compression:t.compression,nextOffset:e<l.length-1?l[e+1].offset:n}))}return c.size>0?c:null}(c,f,a,e)}(e);return c&&(r.zipManifests.set(e,c),await l(e,c,t),(0,i.log)("manifest fetched and stored in memory",{zipUrl:e,entryCount:c.size})),c})().finally(()=>{r.pendingManifestLoads.delete(e)}),r.pendingManifestLoads.set(e,c),c)},t.entryUncompressedSize=function(e){return void 0!==e.uncompressedSize?e.uncompressedSize:0===e.compression?e.compressedSize:null},t.resolveManifestEntry=function(e,t,n,r){if(e.has(t))return{key:t,info:e.get(t),matchKind:"exact"};if(r)return null;const i=(0,s.zipBasenameWithoutExtension)(n);if(!i)return null;const o=`${i}/${t}`;return e.has(o)?{key:o,info:e.get(o),matchKind:"zipBasenameFallback"}:null};const s=n(343),r=n(262),i=n(266);function o(e){const t=new Map;for(const n of e){const e=(0,s.normalizeZipEntryPath)(n.filename);""!==e&&(t.has(e)&&(0,i.warn)("duplicate manifest key after normalize; overwriting",e),t.set(e,n))}return t.size>0?t:null}async function a(e){if(!e)return null;const t=await self.clients.get(e);return"window"===(null==t?void 0:t.type)?t:null}async function l(e,t,n){const s=await a(n);if(!s)return;const r=Array.from(t.values());try{s.postMessage({type:"ZIP_SW_MANIFEST_CREATED",zipUrl:e,files:r})}catch(e){(0,i.warn)("failed to send manifest to client",e)}}},993(e,t,n){t.installMessageHandler=function(){self.addEventListener("message",e=>{if(!e.data)return;const{type:t,zipUrl:n,files:p,config:d,allowedZipUrls:w,previousUrl:h,nextUrl:g}=e.data,m=function(e){if(!e||!("id"in e))return;const t=e.id;return"string"==typeof t?t:void 0}(e.source);if("ZIP_SW_CONFIG"===t){const t=(0,i.applyRuntimeConfig)(d,m).then(()=>u(e,{ok:!0})).catch(t=>u(e,f(t)));return void e.waitUntil(t)}if("ZIP_MANIFEST"===t){if(n&&p){const t=(0,r.normalizeZipUrl)(n),s=(0,c.manifestFilesToMap)(p),i=a.zipManifests.get(t);if(!s)return void(0,l.warn)("rejecting empty manifest; keeping existing",{zipUrl:t,existingSize:i?i.size:0});if(i&&i.size>s.size)return void(0,l.warn)("rejecting smaller manifest; keeping existing",{zipUrl:t,incomingSize:s.size,existingSize:i.size});a.zipManifests.set(t,s),e.waitUntil((0,c.sendManifestToClientId)(t,s,m));const o=Array.from(s.keys()).slice(0,40);(0,l.log)("ZIP_MANIFEST loaded",{zipUrl:t,entryCount:s.size,sampleKeys:o,replacedExistingSize:i?i.size:0})}}else if("CLEAR_ZIP_ASSETS_EXCEPT_ALLOWED"===t){const t=(0,i.clearZipAssetsExceptLiveClaims)(o.clearZipAssetsExceptAllowed).then(()=>u(e,{ok:!0})).catch(t=>u(e,f(t)));e.waitUntil(t)}else if("CLEAR_ALL_ZIP_ASSETS"===t){const t=(0,o.clearAllZipAssets)().then(()=>u(e,{ok:!0})).catch(t=>u(e,f(t)));e.waitUntil(t)}else if("PRELOAD_ZIP_MANIFESTS"===t&&w){const t=async function(e,t){const n=await Promise.all(e.map(async e=>({zipUrl:e,manifest:await(0,c.ensureManifestAvailable)(e,t)}))),r=n.filter(e=>!e.manifest).map(e=>e.zipUrl);if(r.length>0)throw(0,s.createZipPeekError)(`Failed to preload ZIP manifest(s): ${r.join(", ")}`)}(w,m).then(()=>u(e,{ok:!0})).catch(t=>u(e,f(t)));e.waitUntil(t)}else if("RENEW_ZIP_URL"===t&&h&&g){const t=(0,o.renewZipUrl)(h,g).then(()=>u(e,{ok:!0})).catch(t=>u(e,f(t)));e.waitUntil(t)}})};const s=n(553),r=n(343),i=n(314),o=n(800),a=n(262),l=n(266),c=n(346);function f(e){const t=(0,s.toZipPeekError)(e);return{ok:!1,error:t.message,errorStack:t.stack}}function u(e,t){var n;null===(n=e.ports[0])||void 0===n||n.postMessage(t)}},254(e,t,n){t.corsErrorResponse=c,t.getMimeType=f,t.fetchUncompressedZipEntryFromNetwork=async function(e,t,n){var r;const a=n.offset,l=n.nextOffset-1;(0,o.log)("fetching zip chunk from",{zipUrl:e,rangeStart:a,rangeEnd:l});const p=await fetch(e,{headers:{Range:`bytes=${a}-${l}`}});if(206!==p.status){const n=p.status>=400?p.status:502;return{ok:!1,response:c(`ZIP entry fetch for "${t}" expected HTTP 206 Partial Content from ${e}, got ${p.status}`,n,{upstreamStatus:p.status})}}if(!p.body)return{ok:!1,response:c(`ZIP entry fetch for "${t}" in ${e} returned no response body`,502)};const d=p.body.getReader();let w,h;try{({headerAndPayload:w,dataStart:h}=await async function(e){let t=new Uint8Array(0);for(;t.byteLength<30;){const{done:n,value:s}=await e.read();if(n)throw new Error("ZIP entry ended before its local file header was complete");t=u(t,s)}const n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==i.LOCAL_FILE_HEADER_SIG)throw new Error("Invalid local file header (expected ZIP signature 0x04034b50)");const s=30+n.getUint16(26,!0)+n.getUint16(28,!0);for(;t.byteLength<s;){const{done:n,value:s}=await e.read();if(n)throw new Error("ZIP entry ended before its local file header fields were complete");t=u(t,s)}return{headerAndPayload:t,dataStart:s}}(d))}catch(n){return await d.cancel(n),{ok:!1,response:c(`Invalid local file header for "${t}" in ${e}: ${n instanceof Error?n.message:String(n)}`,500)}}const g=function(e,t,n){let s=t,r=0;return new ReadableStream({async pull(t){if(r>=n)return await e.cancel(),void t.close();let i;if(s.byteLength>0)i=s,s=new Uint8Array(0);else{const{done:s,value:o}=await e.read();if(s)return void t.error(new Error(`ZIP entry ended after ${r} of ${n} compressed bytes`));i=o}const o=n-r,a=i.byteLength>o?i.subarray(0,o):i;r+=a.byteLength,t.enqueue(a),r>=n&&(await e.cancel(),t.close())},cancel:t=>e.cancel(t)})}(d,w.subarray(h),n.compressedSize),m=null!==(r=n.uncompressedSize)&&void 0!==r?r:0===n.compression?n.compressedSize:null;let A;if(8===n.compression)A=function(e,t){const n=e.getReader();let r,i=0,o=!1;return new ReadableStream({start(e){r=new s.Inflate(t=>{i+=t.byteLength,e.enqueue(t)})},async pull(e){for(;!o;){const{done:s,value:a}=await n.read();if(s)return o=!0,r.push(new Uint8Array(0),!0),null!==t&&i!==t?void e.error(new Error(`Inflated ZIP entry size mismatch: expected ${t}, received ${i}`)):void e.close();r.push(a)}},cancel:e=>n.cancel(e)})}(g,m);else{if(0!==n.compression)return await d.cancel(),{ok:!1,response:c(`Unsupported compression method ${n.compression} for "${t}" in ${e} (only stored/0 and DEFLATE/8 are supported)`,500)};A=g}return{ok:!0,stream:A,contentLength:m,contentType:f(t)}};const s=n(612),r=n(553),i=n(262),o=n(266);function a(e){return e.replace(/[\r\n]+/g," ").trim()}function l(e,t){const n=[i.ASSET_ERROR_HEADER],s={"Access-Control-Allow-Origin":"*",[i.ASSET_ERROR_HEADER]:a(e)},r=null==t?void 0:t.upstreamStatus;return void 0!==r&&(s[i.ASSET_UPSTREAM_STATUS_HEADER]=String(r),n.push(i.ASSET_UPSTREAM_STATUS_HEADER)),s["Access-Control-Expose-Headers"]=n.join(", "),s}function c(e,t,n){const s=(0,r.formatZipPeekError)(e);return new Response(s,{status:t,headers:l(s,n)})}function f(e){var t,n;const s=null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase();return s&&null!==(n=i.MIME_TYPES[s])&&void 0!==n?n:"application/octet-stream"}function u(e,t){const n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e),n.set(t,e.byteLength),n}},343(e,t){function n(e){try{return decodeURIComponent(e)}catch(t){return e}}t.normalizeZipUrl=function(e,t={}){const{stripCacheBuster:n=!0,stripHash:s=!0}=t,r=e=>s?e.split("#")[0]:e;if(!n)return r(e);const i=e.indexOf("?");if(-1===i)return r(e);const o=e.indexOf("#",i),a=e.substring(0,i),l=-1===o?e.substring(i+1):e.substring(i+1,o),c=s||-1===o?"":e.substring(o),f=l.split("&").filter(e=>{const t=e.indexOf("=");return"t"!==(-1===t?e:e.substring(0,t))});return 0===f.length?a+c:a+"?"+f.join("&")+c},t.zipBasenameWithoutExtension=function(e){var t,n;try{const n=null!==(t=new URL(e,"http://local").pathname.split("/").pop())&&void 0!==t?t:"";return n.endsWith(".zip")?n.slice(0,-4):n}catch(t){const s=null!==(n=e.split("?")[0].split("#")[0].split("/").pop())&&void 0!==n?n:"";return s.endsWith(".zip")?s.slice(0,-4):s}},t.normalizeZipEntryPath=function(e){let t=e.replace(/\\/g,"/");for(;t.startsWith("/");)t=t.slice(1);return t},t.parseZipAssetRequest=function(e){const t=/\.zip([/?])/.exec(e);if(!t)return null;const s=t.index+4,r=t[1],i=e.substring(0,s);if("/"===r){const t=e.substring(s+1),r=t.indexOf("?"),o=-1===r?t:t.substring(0,r);return""===o?null:{zipUrl:i,internalPath:n(o)}}const o=e.substring(s),a=o.indexOf("/");if(-1===a)return null;const l=o.substring(0,a),c=o.substring(a+1),f=c.indexOf("?"),u=-1===f?c:c.substring(0,f);return""===u?null:{zipUrl:i+l,internalPath:n(u)}},t.canonicalZipAssetRequestUrl=function(e,t){return e+"/"+encodeURIComponent(t)}},612(e,t){var n=Uint8Array,s=Uint16Array,r=Int32Array,i=new n([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,0,0,0]),o=new n([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,0,0]),a=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new s(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var o=new r(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)o[a]=a-n[i]<<5|i;return{b:n,r:o}},c=l(i,2),f=c.b,u=c.r;f[28]=258,u[258]=28;for(var p=l(o,0),d=p.b,w=(p.r,new s(32768)),h=0;h<32768;++h){var g=(43690&h)>>1|(21845&h)<<1;g=(61680&(g=(52428&g)>>2|(13107&g)<<2))>>4|(3855&g)<<4,w[h]=((65280&g)>>8|(255&g)<<8)>>1}var m=function(e,t,n){for(var r=e.length,i=0,o=new s(t);i<r;++i)e[i]&&++o[e[i]-1];var a,l=new s(t);for(i=1;i<t;++i)l[i]=l[i-1]+o[i-1]<<1;if(n){a=new s(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var f=i<<4|e[i],u=t-e[i],p=l[e[i]-1]++<<u,d=p|(1<<u)-1;p<=d;++p)a[w[p]>>c]=f}else for(a=new s(r),i=0;i<r;++i)e[i]&&(a[i]=w[l[e[i]-1]++]>>15-e[i]);return a},A=new n(288);for(h=0;h<144;++h)A[h]=8;for(h=144;h<256;++h)A[h]=9;for(h=256;h<280;++h)A[h]=7;for(h=280;h<288;++h)A[h]=8;var E=new n(32);for(h=0;h<32;++h)E[h]=5;var y=m(A,9,1),U=m(E,5,1),R=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},C=function(e,t,n){var s=t/8|0;return(e[s]|e[s+1]<<8)>>(7&t)&n},Z=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},v=function(e){return(e+7)/8|0},S=function(e,t,s){return(null==t||t<0)&&(t=0),(null==s||s>e.length)&&(s=e.length),new n(e.subarray(t,s))},z=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],P=function(e,t,n){var s=new Error(t||z[e]);if(s.code=e,Error.captureStackTrace&&Error.captureStackTrace(s,P),!n)throw s;return s},_=function(e,t,s,r){var l=e.length,c=r?r.length:0;if(!l||t.f&&!t.l)return s||new n(0);var u=!s,p=u||2!=t.i,w=t.i;u&&(s=new n(3*l));var h=function(e){var t=s.length;if(e>t){var r=new n(Math.max(2*t,e));r.set(s),s=r}},g=t.f||0,A=t.p||0,E=t.b||0,z=t.l,_=t.d,b=t.m,L=t.n,M=8*l;do{if(!z){g=C(e,A,1);var I=C(e,A+1,3);if(A+=3,!I){var T=e[(W=v(A)+4)-4]|e[W-3]<<8,k=W+T;if(k>l){w&&P(0);break}p&&h(E+T),s.set(e.subarray(W,k),E),t.b=E+=T,t.p=A=8*k,t.f=g;continue}if(1==I)z=y,_=U,b=9,L=5;else if(2==I){var F=C(e,A,31)+257,x=C(e,A+10,15)+4,O=F+C(e,A+5,31)+1;A+=14;for(var N=new n(O),H=new n(19),$=0;$<x;++$)H[a[$]]=C(e,A+3*$,7);A+=3*x;var D=R(H),q=(1<<D)-1,j=m(H,D,1);for($=0;$<O;){var W,K=j[C(e,A,q)];if(A+=15&K,(W=K>>4)<16)N[$++]=W;else{var G=0,X=0;for(16==W?(X=3+C(e,A,3),A+=2,G=N[$-1]):17==W?(X=3+C(e,A,7),A+=3):18==W&&(X=11+C(e,A,127),A+=7);X--;)N[$++]=G}}var B=N.subarray(0,F),Y=N.subarray(F);b=R(B),L=R(Y),z=m(B,b,1),_=m(Y,L,1)}else P(1);if(A>M){w&&P(0);break}}p&&h(E+131072);for(var Q=(1<<b)-1,V=(1<<L)-1,J=A;;J=A){var ee=(G=z[Z(e,A)&Q])>>4;if((A+=15&G)>M){w&&P(0);break}if(G||P(2),ee<256)s[E++]=ee;else{if(256==ee){J=A,z=null;break}var te=ee-254;if(ee>264){var ne=i[$=ee-257];te=C(e,A,(1<<ne)-1)+f[$],A+=ne}var se=_[Z(e,A)&V],re=se>>4;if(se||P(3),A+=15&se,Y=d[re],re>3&&(ne=o[re],Y+=Z(e,A)&(1<<ne)-1,A+=ne),A>M){w&&P(0);break}p&&h(E+131072);var ie=E+te;if(E<Y){var oe=c-Y,ae=Math.min(Y,ie);for(oe+E<0&&P(3);E<ae;++E)s[E]=r[oe+E]}for(;E<ie;++E)s[E]=s[E-Y]}}t.l=z,t.p=J,t.b=E,t.f=g,z&&(g=1,t.m=b,t.d=_,t.n=L)}while(!g);return E!=s.length&&u?S(s,0,E):s.subarray(0,E)},b=new n(0);var L=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var s=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:s?s.length:0},this.o=new n(32768),this.p=new n(0),s&&this.o.set(s)}return e.prototype.e=function(e){if(this.ondata||P(5),this.d&&P(4),this.p.length){if(e.length){var t=new n(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=_(this.p,this.s,this.o);this.ondata(S(n,t,this.s.b),this.d),this.o=S(n,this.s.b-32768),this.s.b=this.o.length,this.p=S(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();t.Inflate=L;var M="undefined"!=typeof TextDecoder&&new TextDecoder;try{M.decode(b,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout}};const t={};function n(s){const r=t[s];if(void 0!==r)return r.exports;const i=t[s]={exports:{}};return e[s](i,i.exports,n),i.exports}(()=>{const e=n(266),t=n(982),s=n(993);self.addEventListener("install",()=>{self.skipWaiting()}),self.addEventListener("activate",e=>{e.waitUntil(self.clients.claim())}),(0,e.installClientErrorReporting)(),(0,s.installMessageHandler)(),(0,t.installFetchHandler)()})()})();
|
|
1
|
+
(()=>{"use strict";var e={553(e,t){function n(e){const n=e.trim();return n.startsWith(t.ZIP_PEEK_ERROR_PREFIX)?n:`${t.ZIP_PEEK_ERROR_PREFIX} ${n}`}t.NETWORK_ERROR_PREFIX=t.ZIP_PEEK_ERROR_PREFIX=void 0,t.formatZipPeekError=n,t.zipErrorInfo=function(e){return Object.entries(e).filter(e=>{const t=e[1];return null!=t&&""!==t}).map(([e,t])=>`${e}=${String(t)}`).join(" ")},t.createZipPeekError=function(e,t){const r=new Error(n(e));return t&&(r.zipPeekInfo=t),r},t.toZipPeekError=function(e){const r=e instanceof Error?e:new Error(String(e));return r.message.startsWith(t.ZIP_PEEK_ERROR_PREFIX)||(r.message=n(r.message)),r},t.zipPeekErrorInfo=function(e){if(e&&"object"==typeof e&&"zipPeekInfo"in e){return e.zipPeekInfo||void 0}},t.errorMessage=function(e){return e instanceof Error?e.message:String(e)},t.ZIP_PEEK_ERROR_PREFIX="[zip-peek-error]",t.NETWORK_ERROR_PREFIX="[NetworkError]"},314(e,t,n){t.clearAllClientClaims=void 0,t.persistAllowListState=a,t.ensureAllowedZipUrlsLoaded=async function(){if(s.allowedZipUrlsLoaded)return s.allowedZipUrlsLoaded;const e=(async()=>{try{const e=await caches.open(s.CONFIG_CACHE_NAME),t=await e.match(s.CONFIG_CACHE_KEY);if(!t)return;const n=await t.json();if(Array.isArray(n.allowedZipUrls)){const e=new Set(n.allowedZipUrls.filter(e=>"string"==typeof e).map(e=>(0,r.normalizeZipUrl)(e)));(0,s.setAllowListRestricted)(!1!==n.restricted),(0,s.setPersistedAllowUnion)(e)}else(0,s.setAllowListRestricted)(!1),(0,s.setPersistedAllowUnion)(null)}catch(e){(0,i.warn)("failed to load runtime config",e)}})();return(0,s.setAllowedZipUrlsLoaded)(e),e},t.clearZipAssetsExceptLiveClaims=async function(e){if(await l(),!s.allowListRestricted)return;if(await async function(){const e=await self.clients.matchAll({type:"window",includeUncontrolled:!0});await Promise.all(e.map(e=>async function(e){await new Promise(t=>{const n=new MessageChannel,a=setTimeout(()=>{n.port1.onmessage=null,n.port1.close(),t()},400);n.port1.onmessage=i=>{clearTimeout(a);const o=i.data;o&&"allowedZipUrls"in o&&(Array.isArray(o.allowedZipUrls)?(0,s.setClientAllowedZipUrls)(e.id,o.allowedZipUrls.map(e=>(0,r.normalizeZipUrl)(e))):null===o.allowedZipUrls&&s.clientAllowedZipUrls.delete(e.id)),n.port1.onmessage=null,n.port1.close(),t()};try{e.postMessage({type:"ZIP_SW_CLAIM_REQUEST"},[n.port2])}catch(e){clearTimeout(a),n.port1.close(),(0,i.warn)("failed to post ZIP_SW_CLAIM_REQUEST",e),t()}})}(e))),s.clientAllowedZipUrls.size>0?((0,s.setAllowListRestricted)(!0),await a()):e.length>0&&((0,s.setAllowListRestricted)(!1),(0,s.setPersistedAllowUnion)(null),await o(null,!1))}(),await l(),!s.allowListRestricted)return;const t=(0,s.getClaimsUnion)();await e(Array.from(t)),await a()},t.applyRuntimeConfig=async function(e,t){if(!e)return;let n=Object.assign({},s.runtimeConfig),i=!1;if("string"==typeof e.zipAssetCacheName&&e.zipAssetCacheName.trim()&&(n.zipAssetCacheName=e.zipAssetCacheName,i=!0),"number"==typeof e.assetCacheTtlMs&&Number.isFinite(e.assetCacheTtlMs)&&(n.assetCacheTtlMs=e.assetCacheTtlMs,i=!0),"string"==typeof e.logPrefix&&e.logPrefix.trim()&&(n.logPrefix=e.logPrefix,i=!0),"boolean"==typeof e.requireExactManifestPath&&(n.requireExactManifestPath=e.requireExactManifestPath,i=!0),i&&(0,s.setRuntimeConfig)(n),"allowedZipUrls"in e){const n=Array.isArray(e.allowedZipUrls)?e.allowedZipUrls.map(e=>(0,r.normalizeZipUrl)(e)):null;if(!t)return null===n?((0,s.clearAllClientClaims)(),(0,s.setAllowedZipUrlsLoaded)(Promise.resolve()),void await o(null,!1)):((0,s.setAllowListRestricted)(!0),(0,s.setPersistedAllowUnion)(new Set(n)),(0,s.setAllowedZipUrlsLoaded)(Promise.resolve()),void await o(n,!0));if(null===n){if(s.clientAllowedZipUrls.delete(t),await l(),0===s.clientAllowedZipUrls.size)return(0,s.setAllowListRestricted)(!1),(0,s.setPersistedAllowUnion)(null),(0,s.setAllowedZipUrlsLoaded)(Promise.resolve()),void await o(null,!1)}else(0,s.setClientAllowedZipUrls)(t,n);await l(),(0,s.setAllowedZipUrlsLoaded)(Promise.resolve()),await a()}},t.renewAllowedZipUrlClaims=function(e,t){let n=!1;for(const r of s.clientAllowedZipUrls.values())r.has(e)&&(r.delete(e),r.add(t),n=!0);if(!n)for(const e of s.clientAllowedZipUrls.values())e.add(t);const r=new Set(null!==s.persistedAllowUnion&&void 0!==s.persistedAllowUnion?s.persistedAllowUnion:[]);r.delete(e),r.add(t),(0,s.setPersistedAllowUnion)(r)},t.isZipUrlAllowed=function(e){const t=(0,s.getAllowedZipUrlsUnion)();return null===t||t.has(e)};const r=n(343),s=n(262);Object.defineProperty(t,"clearAllClientClaims",{enumerable:!0,get:function(){return s.clearAllClientClaims}});const i=n(266);async function a(){if(!s.allowListRestricted)return(0,s.setPersistedAllowUnion)(null),void await o(null,!1);const e=(0,s.getClaimsUnion)(),t=e.size>0?Array.from(e):Array.from(null!==s.persistedAllowUnion&&void 0!==s.persistedAllowUnion?s.persistedAllowUnion:[]);(0,s.setPersistedAllowUnion)(new Set(t)),await o(t,!0)}async function o(e,t=null!==e){try{const n=await caches.open(s.CONFIG_CACHE_NAME);await n.put(new Request(s.CONFIG_CACHE_KEY),new Response(JSON.stringify({allowedZipUrls:e,restricted:t}),{headers:{"Content-Type":"application/json"}}))}catch(e){(0,i.warn)("failed to persist runtime config",e)}}async function l(){const e=await self.clients.matchAll({type:"window",includeUncontrolled:!0}),t=new Set(e.map(e=>e.id));for(const e of[...s.clientAllowedZipUrls.keys()])t.has(e)||s.clientAllowedZipUrls.delete(e);0===s.clientAllowedZipUrls.size&&s.allowListRestricted?((0,s.setPersistedAllowUnion)(null),await o([],!0)):s.clientAllowedZipUrls.size>0&&await a()}},800(e,t,n){t.canonicalAssetRequest=function(e,t){return new Request((0,s.canonicalZipAssetRequestUrl)(e,t),{method:"GET"})},t.clearAllZipAssets=async function(){const e=await caches.open(o.runtimeConfig.zipAssetCacheName),t=await e.keys();await Promise.all(t.map(t=>e.delete(t))),await caches.delete(o.CONFIG_CACHE_NAME),o.zipManifests.clear(),o.pendingManifestLoads.clear(),o.inFlightZipAssets.clear(),(0,i.clearAllClientClaims)(),(0,o.setAllowedZipUrlsLoaded)(Promise.resolve())},t.clearZipAssetsExceptAllowed=async function(e){try{const t=new Set(e),n=await caches.open(o.runtimeConfig.zipAssetCacheName),r=await n.keys();for(const e of r){const r=e.url,i=(0,s.parseZipAssetRequest)(r);i&&!t.has(i.zipUrl)&&await n.delete(e)}for(const e of o.zipManifests.keys())t.has(e)||o.zipManifests.delete(e)}catch(e){throw(0,r.createZipPeekError)(`Failed to clear zip assets except allowed URLs: ${(0,r.errorMessage)(e)}`)}},t.putCachedFullAssetIfAbsent=async function(e,t){var n;try{const r=await caches.open(o.runtimeConfig.zipAssetCacheName),s=await r.match(e);if(s&&!c(s))return void await(null===(n=t.body)||void 0===n?void 0:n.cancel());const i=new Headers(t.headers);i.set(o.ASSET_CACHED_AT_HEADER,String(Date.now())),i.set("Access-Control-Allow-Origin","*"),await r.put(e,new Response(t.body,{status:t.status,statusText:t.statusText,headers:i}))}catch(e){t.body&&!t.body.locked&&await t.body.cancel(e),(0,l.warn)("asset cache put failed",e)}},t.readCachedZipAssetIfFresh=async function(e){let t=null,n="network";try{const r=await caches.open(o.runtimeConfig.zipAssetCacheName),s=await r.match(e);if(s)if(c(s))try{await r.delete(e)}catch(e){(0,l.warn)("asset cache delete expired failed",e)}else t=s,n="cache-api"}catch(e){(0,l.warn)("asset cache read failed",e)}return{response:t,assetSource:n}},t.renewZipUrl=async function(e,t){const n=(0,s.normalizeZipUrl)(e),l=(0,s.normalizeZipUrl)(t);if(n===l)return;await(0,i.ensureAllowedZipUrlsLoaded)(),o.allowListRestricted&&((0,i.renewAllowedZipUrlClaims)(n,l),(0,o.setAllowedZipUrlsLoaded)(Promise.resolve()),await(0,i.persistAllowListState)());const c=o.zipManifests.get(n);c&&(o.zipManifests.set(l,c),o.zipManifests.delete(n));const p=o.pendingManifestLoads.get(n);p&&(o.pendingManifestLoads.set(l,p),o.pendingManifestLoads.delete(n)),(0,a.remapInFlightZipAssetsForRenewal)(n,l);try{const e=await caches.open(o.runtimeConfig.zipAssetCacheName),t=await e.keys();for(const r of t){const t=r.url,i=(0,s.parseZipAssetRequest)(t);i&&(0,s.normalizeZipUrl)(i.zipUrl)===n&&await e.delete(r)}}catch(e){throw(0,r.createZipPeekError)(`Failed to clear cached assets for renewed ZIP URL: ${(0,r.errorMessage)(e)}`)}};const r=n(553),s=n(343),i=n(314),a=n(30),o=n(262),l=n(266);function c(e){const t=e.headers.get(o.ASSET_CACHED_AT_HEADER);if(!t)return!0;const n=parseInt(t,10);return!Number.isFinite(n)||Date.now()-n>o.runtimeConfig.assetCacheTtlMs}},30(e,t,n){t.getOrStartInFlightAsset=function(e,t){const n=e.url,r=s.inFlightZipAssets.get(n);if(r)return r;let a,o;const l=new Promise((e,t)=>{a=e,o=t}),c={resultPromise:t(),cacheFillPromise:l,leaderClaimed:!1,resolveCacheFill:a,rejectCacheFill:o};return l.finally(()=>{!function(e){for(const[t,n]of s.inFlightZipAssets)n===e&&s.inFlightZipAssets.delete(t)}(c)}).catch(()=>{}),c.resultPromise.then(e=>{e.ok||i(c)},e=>{i(c,e)}),s.inFlightZipAssets.set(n,c),c},t.completeInFlightAssetLoad=function(e,t){const n=s.inFlightZipAssets.get(e);n&&i(n,t)},t.remapInFlightZipAssetsForRenewal=function(e,t){const n=(0,r.normalizeZipUrl)(e),i=(0,r.normalizeZipUrl)(t);for(const[e,t]of[...s.inFlightZipAssets]){const a=(0,r.parseZipAssetRequest)(e);if(a&&(0,r.normalizeZipUrl)(a.zipUrl)===n){const n=(0,r.canonicalZipAssetRequestUrl)(i,a.internalPath);s.inFlightZipAssets.delete(e),s.inFlightZipAssets.set(n,t)}}};const r=n(343),s=n(262);function i(e,t){void 0!==t?e.rejectCacheFill(t):e.resolveCacheFill()}},982(e,t,n){t.installFetchHandler=function(){self.addEventListener("fetch",e=>{const t=e.request.method;if("GET"!==t&&"HEAD"!==t)return;if(!(0,s.parseZipAssetRequest)(e.request.url))return;const n=async function(e,t){var n;const h="HEAD"===e.method,m=(0,s.parseZipAssetRequest)(e.url);let E=(0,s.normalizeZipUrl)(m.zipUrl);const A=m.internalPath,y=(0,s.normalizeZipEntryPath)(A);let U;try{let m;if(await(0,i.ensureAllowedZipUrlsLoaded)(),E=(0,u.resolveAllowedZipUrlByPathname)(E),!(0,i.isZipUrlAllowed)(E)&&(0,s.isPresignedUrlExpired)(E)){const e=await(0,u.requestClientRenewal)(E,t);e.ok?E=e.nextUrl:m=e.reason}if(!(0,i.isZipUrlAllowed)(E))return(0,c.warn)("zip URL not allowed",{requestedZipUrl:E}),d("ZIP URL not allowed",403,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(E),reason:m}));let P=l.zipManifests.get(E);if(P&&!h){const t=(0,p.resolveManifestEntry)(P,y,E,l.runtimeConfig.requireExactManifestPath);if(t){const n=(0,a.canonicalAssetRequest)(E,t.key),r=await(0,a.readCachedZipAssetIfFresh)(n);if(r.response){const n=(0,p.entryUncompressedSize)(t.info);return{response:w(r.response.body,(0,f.getMimeType)(t.key),n,r.assetSource,e.headers.get("range"))}}}}if((0,s.isPresignedUrlExpired)(E)&&(!h||!P)){const e=await(0,u.requestClientRenewal)(E,t);if(!e.ok)return d("Failed to renew expired presigned ZIP URL",502,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(E),reason:e.reason}));E=e.nextUrl,P=l.zipManifests.get(E)}if(P||(P=null!==(n=await(0,p.ensureManifestAvailable)(E,t))&&void 0!==n?n:void 0),!P){const e=Array.from(l.zipManifests.keys());return(0,c.warn)("manifest missing for zipUrl",{requestedZipUrl:E,knownZipUrls:e}),d("ZIP manifest not loaded",404,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(E)}))}const R=(0,p.resolveManifestEntry)(P,y,E,l.runtimeConfig.requireExactManifestPath);if(!R){const e=Array.from(P.keys()).slice(0,50);return(0,c.warn)("file not in manifest",{zipUrl:E,internalPathRaw:A,internalPathNormalized:y,requireExactManifestPath:l.runtimeConfig.requireExactManifestPath,manifestSize:P.size,sampleKeys:e}),d("File not found in ZIP manifest",404,(0,r.zipErrorInfo)({path:y,zipPath:(0,s.zipPackagePathname)(E)}))}const{key:Z,info:z,matchKind:C}=R;if("zipBasenameFallback"===C&&((0,c.log)("resolved via zip-basename folder fallback",{requested:y,manifestKey:Z}),(0,c.reportClientError)(new Error((0,r.formatZipPeekError)("Exact manifest path not found; resolved via zip-basename folder fallback")),`Exact manifest key "${y}" not found in ${E}; resolved using "${Z}"`)),h)return{response:g(e,Z,z)};const v=(0,a.canonicalAssetRequest)(E,Z),S=await(0,a.readCachedZipAssetIfFresh)(v),_=(0,p.entryUncompressedSize)(z),b=(0,f.getMimeType)(Z);if(S.response)return{response:w(S.response.body,b,_,S.assetSource,e.headers.get("range"))};const I=(0,o.getOrStartInFlightAsset)(v,()=>(0,f.fetchUncompressedZipEntryFromNetwork)(E,Z,z));U=v.url;const M=await I.resultPromise;if(!M.ok)return(0,o.completeInFlightAssetLoad)(v.url),{response:M.response};const L=!I.leaderClaimed&&(I.leaderClaimed=!0),k=8===z.compression?null:e.headers.get("range");if(!L){await I.cacheFillPromise;const t=await(0,a.readCachedZipAssetIfFresh)(v);return t.response?{response:w(t.response.body,b,_,t.assetSource,e.headers.get("range"))}:d("Asset cache was not ready after in-flight load",500,(0,r.zipErrorInfo)({path:Z,zipPath:(0,s.zipPackagePathname)(E)}))}const[T,F]=M.stream.tee(),x={"Content-Type":M.contentType};null!==M.contentLength&&(x["Content-Length"]=String(M.contentLength));const O=v.url,N=(0,a.putCachedFullAssetIfAbsent)(v,new Response(F,{status:200,headers:x})).then(()=>{(0,o.completeInFlightAssetLoad)(O)}).catch(e=>{throw(0,o.completeInFlightAssetLoad)(O,e),e});return{response:w(T,M.contentType,M.contentLength,"network",k),background:N}}catch(e){U&&(0,o.completeInFlightAssetLoad)(U,e),(0,c.error)("fetch handler failed",{zipUrl:E,internalPath:A,message:(0,r.errorMessage)(e)});const t=(0,r.errorMessage)(e),n=t.includes(r.NETWORK_ERROR_PREFIX)?t.startsWith(r.ZIP_PEEK_ERROR_PREFIX)?t.slice(r.ZIP_PEEK_ERROR_PREFIX.length).trim():t:"ZIP asset request failed",i=(0,r.zipPeekErrorInfo)(e);return d(n,500,[(0,r.zipErrorInfo)({path:A,zipPath:(0,s.zipPackagePathname)(E),cause:i?void 0:(0,r.errorMessage)(e)}),i].filter(Boolean).join(" "))}}(e.request,e.clientId||void 0);e.respondWith(n.then(({response:e})=>e)),e.waitUntil(n.then(({background:e})=>e).catch(e=>{(0,c.warn)("background asset cache failed",(0,r.errorMessage)(e))}))})};const r=n(553),s=n(343),i=n(314),a=n(800),o=n(30),l=n(262),c=n(266),p=n(346),u=n(933),f=n(254);function d(e,t,n,s){return(0,c.reportClientError)((0,r.createZipPeekError)(e),n),{response:(0,f.corsErrorResponse)(e,t,s)}}function h(e){return{"Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":l.ASSET_SOURCE_HEADER,[l.ASSET_SOURCE_HEADER]:e}}function w(e,t,n,r,s){if(s){if(null===n)return null==e||e.cancel(),new Response(null,{status:416,headers:h(r)});const i=s.replace(/^bytes=/,"");if(i.includes(","))return null==e||e.cancel(),new Response(null,{status:416,headers:Object.assign({"Content-Range":`bytes */${n}`},h(r))});const[a,o]=i.split("-"),l=""!==a?parseInt(a,10):NaN,c=""!==o?parseInt(o,10):n-1;if(isNaN(l)||isNaN(c)||l<0||c<l||l>=n)return null==e||e.cancel(),new Response(null,{status:416,headers:Object.assign({"Content-Range":`bytes */${n}`},h(r))});const p=Math.min(c,n-1),u=p-l+1,f=null===e?null:function(e,t,n){const r=e.getReader();let s=0,i=!1;return new ReadableStream({async pull(e){for(;!i;){const{done:a,value:o}=await r.read();if(a)return i=!0,void e.close();const l=o,c=s,p=s+l.byteLength-1;if(s+=l.byteLength,p<t)continue;if(c>n)return i=!0,void e.close();const u=Math.max(0,t-c),f=Math.min(l.byteLength,n-c+1);if(f>u&&e.enqueue(l.subarray(u,f)),p>=n)return i=!0,void e.close()}},cancel:e=>r.cancel(e)})}(e,l,p);return new Response(f,{status:206,headers:Object.assign({"Content-Type":t,"Content-Range":`bytes ${l}-${p}/${n}`,"Content-Length":u.toString(),"Accept-Ranges":"bytes"},h(r))})}const i=Object.assign({"Content-Type":t},h(r));return null!==n&&(i["Content-Length"]=n.toString(),i["Accept-Ranges"]="bytes"),new Response(e,{status:200,headers:i})}function g(e,t,n){const r=(0,f.getMimeType)(t),s=(0,p.entryUncompressedSize)(n),i=e.headers.get("range");if(null!==s&&i)return w(null,r,s,"manifest",i);const a=Object.assign({"Content-Type":r},h("manifest"));return null!==s&&(a["Content-Length"]=s.toString(),a["Accept-Ranges"]="bytes"),new Response(null,{status:200,headers:a})}},262(e,t){function n(){const e=new Set;for(const n of t.clientAllowedZipUrls.values())for(const t of n)e.add(t);return e}t.CONFIG_CACHE_KEY=t.allowedZipUrlsLoaded=t.persistedAllowUnion=t.allowListRestricted=t.clientAllowedZipUrls=t.runtimeConfig=t.inFlightZipAssets=t.pendingManifestLoads=t.zipManifests=t.LOCAL_FILE_HEADER_SIG=t.MIME_TYPES=t.ASSET_UPSTREAM_STATUS_HEADER=t.ASSET_ERROR_HEADER=t.ASSET_SOURCE_HEADER=t.ASSET_CACHED_AT_HEADER=t.CONFIG_CACHE_NAME=t.kF=t.o2=void 0,t.setRuntimeConfig=function(e){t.runtimeConfig=e},t.setAllowListRestricted=function(e){t.allowListRestricted=e},t.setPersistedAllowUnion=function(e){t.persistedAllowUnion=e},t.setAllowedZipUrlsLoaded=function(e){t.allowedZipUrlsLoaded=e},t.getClaimsUnion=n,t.getAllowedZipUrlsUnion=function(){return t.allowListRestricted?t.clientAllowedZipUrls.size>0?n():null!==t.persistedAllowUnion&&void 0!==t.persistedAllowUnion?t.persistedAllowUnion:new Set:null},t.setClientAllowedZipUrls=function(e,n){if(null===n)return void t.clientAllowedZipUrls.delete(e);t.allowListRestricted=!0;const r=t.clientAllowedZipUrls.get(e);if(r)for(const e of n)r.add(e);else t.clientAllowedZipUrls.set(e,new Set(n))},t.clearAllClientClaims=function(){t.clientAllowedZipUrls.clear(),t.allowListRestricted=!1,t.persistedAllowUnion=null},t.o2="zip-cache-v1",t.kF=72e5,t.CONFIG_CACHE_NAME="zip-peek-config-v1",t.o2,t.CONFIG_CACHE_NAME,t.ASSET_CACHED_AT_HEADER="X-ZipSW-Cached-At",t.ASSET_SOURCE_HEADER="X-ZipSW-Asset-Source",t.ASSET_ERROR_HEADER="X-ZipSW-Error",t.ASSET_UPSTREAM_STATUS_HEADER="X-ZipSW-Upstream-Status",t.MIME_TYPES={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",json:"application/json",js:"application/javascript",css:"text/css; charset=utf-8",html:"text/html; charset=utf-8",txt:"text/plain; charset=utf-8",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",wav:"audio/wav",oga:"audio/ogg",ogg:"audio/ogg",xml:"application/xml",wasm:"application/wasm"},t.LOCAL_FILE_HEADER_SIG=67324752,t.zipManifests=new Map,t.pendingManifestLoads=new Map,t.inFlightZipAssets=new Map,t.runtimeConfig={zipAssetCacheName:t.o2,assetCacheTtlMs:t.kF,logPrefix:"[zipSW]",requireExactManifestPath:!1},t.clientAllowedZipUrls=new Map,t.allowListRestricted=!1,t.persistedAllowUnion=null,t.allowedZipUrlsLoaded=null,t.CONFIG_CACHE_KEY=new URL("__zip_peek_runtime_config__",self.registration.scope).href},266(e,t,n){t.log=function(...e){console.log(s.runtimeConfig.logPrefix,...e)},t.warn=function(...e){console.warn(s.runtimeConfig.logPrefix,...e)},t.error=function(...e){console.error(s.runtimeConfig.logPrefix,r.ZIP_PEEK_ERROR_PREFIX,...e)},t.reportClientError=i,t.installClientErrorReporting=function(){self.addEventListener("error",e=>{var t;i(null!==(t=e.error)&&void 0!==t?t:e.message,"Service worker uncaught error")}),self.addEventListener("unhandledrejection",e=>{i(e.reason,"Service worker unhandled promise rejection")})};const r=n(553),s=n(262);function i(e,t){const n=(0,r.toZipPeekError)(e);self.clients.matchAll({type:"window",includeUncontrolled:!0}).then(e=>{const s={type:"ZIP_SW_ERROR",error:{message:n.message,stack:n.stack},info:t?(0,r.formatZipPeekError)(t):void 0};for(const t of e)t.postMessage(s)})}},346(e,t,n){t.manifestFilesToMap=o,t.sendManifestToClientId=c,t.ensureManifestAvailable=function(e,t){const n=i.zipManifests.get(e);if(n)return Promise.resolve(n);let p=i.pendingManifestLoads.get(e);return p||(p=(async()=>{const n=await async function(e,t){const n=await l(t);return n?function(e,t){return new Promise(n=>{const r=new MessageChannel,s=setTimeout(()=>{r.port1.close(),n(null)},500);r.port1.onmessage=e=>{clearTimeout(s),r.port1.close();const t=e.data;(null==t?void 0:t.ok)&&Array.isArray(t.files)?n(o(t.files)):n(null)},r.port1.onmessageerror=()=>{clearTimeout(s),r.port1.close(),n(null)};try{e.postMessage({type:"ZIP_SW_MANIFEST_REQUEST",zipUrl:t},[r.port2])}catch(e){clearTimeout(s),r.port1.close(),(0,a.warn)("failed to request manifest from client",e),n(null)}})}(n,e):null}(e,t);if(n)return i.zipManifests.set(e,n),(0,a.log)("restored manifest from client memory",{zipUrl:e,entryCount:n.size}),n;const p=await async function(e){let t;try{t=await fetch(e,{headers:{Range:"bytes=-65536"}})}catch(t){throw(0,r.createZipPeekError)(`${r.NETWORK_ERROR_PREFIX} ZIP manifest fetch failed`,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(e),cause:(0,r.errorMessage)(t)}))}if(206!==t.status)return(0,a.error)("range requests not supported for ZIP manifest",{zipUrl:e,status:t.status}),null;const n=await t.arrayBuffer(),i=new DataView(n);let o=-1;for(let e=n.byteLength-22;e>=0;e--)if(101010256===i.getUint32(e,!0)){o=e;break}if(-1===o)return(0,a.error)("EOCD not found in last 64KB of ZIP file",e),null;const l=i.getUint32(o+16,!0),c=i.getUint32(o+12,!0);let p=n,u=-1;const f=t.headers.get("Content-Range");let d=0;if(f){const e=f.match(/\/(\d+)$/);e&&(d=parseInt(e[1],10))}if(d<=0)return(0,a.error)("could not determine ZIP file size from Content-Range header",{zipUrl:e,contentRange:f}),null;const h=d-n.byteLength;if(l>=h)u=l-h;else{let t;try{t=await fetch(e,{headers:{Range:`bytes=${l}-${l+c-1}`}})}catch(t){throw(0,r.createZipPeekError)(`${r.NETWORK_ERROR_PREFIX} ZIP manifest fetch failed`,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(e),cause:(0,r.errorMessage)(t)}))}if(206!==t.status)return(0,a.error)("failed to fetch ZIP central directory",{zipUrl:e,status:t.status,cdOffset:l,cdSize:c}),null;p=await t.arrayBuffer(),u=0}return function(e,t,n,r){const i=new DataView(e);let o=t;const l=[];for(;o+46<=e.byteLength&&33639248===i.getUint32(o,!0);){const t=i.getUint16(o+10,!0),n=i.getUint32(o+20,!0),r=i.getUint32(o+24,!0),a=i.getUint16(o+28,!0),c=i.getUint16(o+30,!0),p=i.getUint16(o+32,!0),u=i.getUint32(o+42,!0),f=new TextDecoder;if(o+46+a>e.byteLength)break;const d=new Uint8Array(e,o+46,a),h=f.decode(d),w=(0,s.normalizeZipEntryPath)(h);""!==w&&l.push({filename:w,offset:u,compressedSize:n,uncompressedSize:r,compression:t}),o+=46+a+c+p}if(0===l.length)return(0,a.error)("no files parsed from central directory",r),null;l.sort((e,t)=>e.offset-t.offset);const c=new Map;for(let e=0;e<l.length;e++){const t=l[e],r=(0,s.normalizeZipEntryPath)(t.filename);""!==r&&(c.has(r)&&(0,a.warn)("duplicate manifest key after normalize; overwriting",r),c.set(r,{filename:t.filename,offset:t.offset,compressedSize:t.compressedSize,uncompressedSize:t.uncompressedSize,compression:t.compression,nextOffset:e<l.length-1?l[e+1].offset:n}))}return c.size>0?c:null}(p,u,l,e)}(e);return p&&(i.zipManifests.set(e,p),await c(e,p,t),(0,a.log)("manifest fetched and stored in memory",{zipUrl:e,entryCount:p.size})),p})().finally(()=>{i.pendingManifestLoads.delete(e)}),i.pendingManifestLoads.set(e,p),p)},t.entryUncompressedSize=function(e){return void 0!==e.uncompressedSize?e.uncompressedSize:0===e.compression?e.compressedSize:null},t.resolveManifestEntry=function(e,t,n,r){if(e.has(t))return{key:t,info:e.get(t),matchKind:"exact"};if(r)return null;const i=(0,s.zipBasenameWithoutExtension)(n);if(!i)return null;const a=`${i}/${t}`;return e.has(a)?{key:a,info:e.get(a),matchKind:"zipBasenameFallback"}:null};const r=n(553),s=n(343),i=n(262),a=n(266);function o(e){const t=new Map;for(const n of e){const e=(0,s.normalizeZipEntryPath)(n.filename);""!==e&&(t.has(e)&&(0,a.warn)("duplicate manifest key after normalize; overwriting",e),t.set(e,n))}return t.size>0?t:null}async function l(e){if(!e)return null;const t=await self.clients.get(e);return"window"===(null==t?void 0:t.type)?t:null}async function c(e,t,n){const r=await l(n);if(!r)return;const s=Array.from(t.values());try{r.postMessage({type:"ZIP_SW_MANIFEST_CREATED",zipUrl:e,files:s})}catch(e){(0,a.warn)("failed to send manifest to client",e)}}},993(e,t,n){t.installMessageHandler=function(){self.addEventListener("message",e=>{if(!e.data)return;const{type:t,zipUrl:n,files:p,config:f,allowedZipUrls:d,previousUrl:h,nextUrl:w}=e.data,g=function(e){if(!e||!("id"in e))return;const t=e.id;return"string"==typeof t?t:void 0}(e.source);if("ZIP_SW_CONFIG"!==t)if("ZIP_MANIFEST"===t){if(n&&p){const t=(0,s.normalizeZipUrl)(n),r=(0,c.manifestFilesToMap)(p),i=o.zipManifests.get(t);if(!r)return void(0,l.warn)("rejecting empty manifest; keeping existing",{zipUrl:t,existingSize:i?i.size:0});if(i&&i.size>r.size)return void(0,l.warn)("rejecting smaller manifest; keeping existing",{zipUrl:t,incomingSize:r.size,existingSize:i.size});o.zipManifests.set(t,r),e.waitUntil((0,c.sendManifestToClientId)(t,r,g));const a=Array.from(r.keys()).slice(0,40);(0,l.log)("ZIP_MANIFEST loaded",{zipUrl:t,entryCount:r.size,sampleKeys:a,replacedExistingSize:i?i.size:0})}}else"CLEAR_ZIP_ASSETS_EXCEPT_ALLOWED"===t?u(e,()=>(0,i.clearZipAssetsExceptLiveClaims)(a.clearZipAssetsExceptAllowed)):"CLEAR_ALL_ZIP_ASSETS"===t?u(e,()=>(0,a.clearAllZipAssets)()):"PRELOAD_ZIP_MANIFESTS"===t&&d?u(e,()=>async function(e,t){const n=await Promise.all(e.map(async e=>({zipUrl:e,manifest:await(0,c.ensureManifestAvailable)(e,t)}))),s=n.filter(e=>!e.manifest).map(e=>e.zipUrl);if(s.length>0)throw(0,r.createZipPeekError)(`Failed to preload ZIP manifest(s): ${s.join(", ")}`)}(d,g)):"RENEW_ZIP_URL"===t&&h&&w&&u(e,()=>(0,a.renewZipUrl)(h,w));else u(e,()=>(0,i.applyRuntimeConfig)(f,g))})};const r=n(553),s=n(343),i=n(314),a=n(800),o=n(262),l=n(266),c=n(346);function p(e,t){var n;null===(n=e.ports[0])||void 0===n||n.postMessage(t)}function u(e,t){e.waitUntil(self.clients.claim().then(t).then(()=>p(e,{ok:!0})).catch(t=>p(e,function(e){const t=(0,r.toZipPeekError)(e);return{ok:!1,error:t.message,errorStack:t.stack}}(t))))}},933(e,t,n){t.resolveAllowedZipUrlByPathname=function(e){const t=(0,s.getAllowedZipUrlsUnion)();if(null===t||t.has(e))return e;const n=(0,r.zipPackagePathname)(e);for(const e of t)if((0,r.zipPackagePathname)(e)===n)return e;return e},t.requestClientRenewal=function(e,t){if(null==(0,r.getPresignedUrlExpiryMs)(e))return Promise.resolve({ok:!1,reason:"not-presigned"});const n=(0,r.zipPackagePathname)(e)||(0,r.normalizeZipUrl)(e),s=a.get(n);if(s)return s;const o=async function(e,t){var n;let s=await async function(e){if(!e)return null;const t=await self.clients.get(e);return"window"===(null==t?void 0:t.type)?t:null}(t);if(!s){const e=await self.clients.matchAll({type:"window"});s=null!==(n=e[0])&&void 0!==n?n:null}return s?new Promise(t=>{const n=new MessageChannel;let a=!1;const o=e=>{a||(a=!0,n.port1.onmessage=null,n.port1.onmessageerror=null,n.port1.close(),t(e))};n.port1.onmessage=e=>{const t=e.data;if(!(null==t?void 0:t.ok)||"string"!=typeof t.nextUrl||""===t.nextUrl)return void o({ok:!1,reason:"page-rejected"});const n=(0,r.normalizeZipUrl)(t.nextUrl);(0,r.isPresignedUrlExpired)(n)?o({ok:!1,reason:"still-expired"}):o({ok:!0,nextUrl:n})},n.port1.onmessageerror=()=>{o({ok:!1,reason:"page-rejected"})};try{s.postMessage({type:"ZIP_SW_RENEW_REQUEST",zipUrl:e},[n.port2])}catch(e){(0,i.warn)("failed to post ZIP_SW_RENEW_REQUEST",e),o({ok:!1,reason:"page-rejected"})}}):{ok:!1,reason:"no-window-client"}}(e,t).finally(()=>{a.delete(n)});return a.set(n,o),o};const r=n(343),s=n(262),i=n(266),a=new Map},254(e,t,n){t.corsErrorResponse=p,t.getMimeType=f,t.fetchUncompressedZipEntryFromNetwork=async function(e,t,n){var l;const c=n.offset,p=n.nextOffset-1,h=(0,i.zipPackagePathname)(e);let w;(0,o.log)("fetching zip chunk from",{zipUrl:e,rangeStart:c,rangeEnd:p});try{w=await fetch(e,{headers:{Range:`bytes=${c}-${p}`}})}catch(e){return u(`${s.NETWORK_ERROR_PREFIX} ZIP asset fetch failed`,500,(0,s.zipErrorInfo)({path:t,zipPath:h,cause:(0,s.errorMessage)(e)}))}if(206!==w.status)return u("ZIP origin fetch failed",w.status>=400?w.status:502,(0,s.zipErrorInfo)({path:t,zipPath:h,status:w.status}),{upstreamStatus:w.status});if(!w.body)return u("ZIP origin fetch failed",502,(0,s.zipErrorInfo)({path:t,zipPath:h,reason:"empty-body"}));const g=w.body.getReader();let m,E;try{({headerAndPayload:m,dataStart:E}=await async function(e){let t=new Uint8Array(0);for(;t.byteLength<30;){const{done:n,value:r}=await e.read();if(n)throw new Error("ZIP entry ended before its local file header was complete");t=d(t,r)}const n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==a.LOCAL_FILE_HEADER_SIG)throw new Error("Invalid local file header (expected ZIP signature 0x04034b50)");const r=30+n.getUint16(26,!0)+n.getUint16(28,!0);for(;t.byteLength<r;){const{done:n,value:r}=await e.read();if(n)throw new Error("ZIP entry ended before its local file header fields were complete");t=d(t,r)}return{headerAndPayload:t,dataStart:r}}(g))}catch(e){return await g.cancel(e),u("ZIP asset request failed",500,(0,s.zipErrorInfo)({path:t,zipPath:h,cause:(0,s.errorMessage)(e)}))}const A=function(e,t,n){let r=t,s=0;return new ReadableStream({async pull(t){if(s>=n)return await e.cancel(),void t.close();let i;if(r.byteLength>0)i=r,r=new Uint8Array(0);else{const{done:r,value:a}=await e.read();if(r)return void t.error(new Error(`ZIP entry ended after ${s} of ${n} compressed bytes`));i=a}const a=n-s,o=i.byteLength>a?i.subarray(0,a):i;s+=o.byteLength,t.enqueue(o),s>=n&&(await e.cancel(),t.close())},cancel:t=>e.cancel(t)})}(g,m.subarray(E),n.compressedSize),y=null!==(l=n.uncompressedSize)&&void 0!==l?l:0===n.compression?n.compressedSize:null;let U;if(8===n.compression)U=function(e,t){const n=e.getReader();let s,i=0,a=!1;return new ReadableStream({start(e){s=new r.Inflate(t=>{i+=t.byteLength,e.enqueue(t)})},async pull(e){for(;!a;){const{done:r,value:o}=await n.read();if(r)return a=!0,s.push(new Uint8Array(0),!0),null!==t&&i!==t?void e.error(new Error(`Inflated ZIP entry size mismatch: expected ${t}, received ${i}`)):void e.close();s.push(o)}},cancel:e=>n.cancel(e)})}(A,y);else{if(0!==n.compression)return await g.cancel(),u("ZIP asset request failed",500,(0,s.zipErrorInfo)({path:t,zipPath:h,reason:"unsupported-compression",method:n.compression}));U=A}return{ok:!0,stream:U,contentLength:y,contentType:f(t)}};const r=n(612),s=n(553),i=n(343),a=n(262),o=n(266);function l(e){return e.replace(/[\r\n]+/g," ").trim()}function c(e,t){const n=[a.ASSET_ERROR_HEADER],r={"Access-Control-Allow-Origin":"*",[a.ASSET_ERROR_HEADER]:l(e)},s=null==t?void 0:t.upstreamStatus;return void 0!==s&&(r[a.ASSET_UPSTREAM_STATUS_HEADER]=String(s),n.push(a.ASSET_UPSTREAM_STATUS_HEADER)),r["Access-Control-Expose-Headers"]=n.join(", "),r}function p(e,t,n){const r=(0,s.formatZipPeekError)(e);return new Response(r,{status:t,headers:c(r,n)})}function u(e,t,n,r){return(0,o.reportClientError)((0,s.createZipPeekError)(e),n),{ok:!1,response:p(e,t,r)}}function f(e){var t,n;const r=null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase();return r&&null!==(n=a.MIME_TYPES[r])&&void 0!==n?n:"application/octet-stream"}function d(e,t){const n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e),n.set(t,e.byteLength),n}},343(e,t){function n(e){try{return decodeURIComponent(e)}catch(t){return e}}function r(e){const t=t=>function(e,t,n={}){const{stopAtPathSeparator:r=!0}=n,s=e.indexOf("?");if(-1===s)return null;const i=e.indexOf("#",s),a=-1===i?e.substring(s+1):e.substring(s+1,i),o=r?a.indexOf("/"):-1,l=-1===o?a:a.substring(0,o);for(const e of l.split("&")){const n=e.indexOf("=");if((-1===n?e:e.substring(0,n))===t)return-1===n?"":e.substring(n+1)}return null}(e,t,{stopAtPathSeparator:!1}),n=t("Expires");if(null!=n&&""!==n){const e=Number(n);if(Number.isFinite(e)&&e>0)return 1e3*e}const r=t("X-Amz-Date"),s=t("X-Amz-Expires");if(r&&s){const e=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/.exec(r);if(!e)return null;const[,t,n,i,a,o,l]=e,c=Date.UTC(Number(t),Number(n)-1,Number(i),Number(a),Number(o),Number(l)),p=Number(s);return!Number.isFinite(c)||!Number.isFinite(p)||p<=0?null:c+1e3*p}return null}t.normalizeZipUrl=function(e,t={}){const{stripCacheBuster:n=!0,stripHash:r=!0}=t,s=e=>r?e.split("#")[0]:e;if(!n)return s(e);const i=e.indexOf("?");if(-1===i)return s(e);const a=e.indexOf("#",i),o=e.substring(0,i),l=-1===a?e.substring(i+1):e.substring(i+1,a),c=r||-1===a?"":e.substring(a),p=l.split("&").filter(e=>{const t=e.indexOf("=");return"t"!==(-1===t?e:e.substring(0,t))});return 0===p.length?o+c:o+"?"+p.join("&")+c},t.zipPackagePathname=function(e){try{return new URL(e).pathname}catch(t){return e.split("?")[0].split("#")[0]}},t.isPresignedUrlExpired=function(e){const t=r(e);return null!=t&&t<=Date.now()},t.zipBasenameWithoutExtension=function(e){var t,n;try{const n=null!==(t=new URL(e,"http://local").pathname.split("/").pop())&&void 0!==t?t:"";return n.endsWith(".zip")?n.slice(0,-4):n}catch(t){const r=null!==(n=e.split("?")[0].split("#")[0].split("/").pop())&&void 0!==n?n:"";return r.endsWith(".zip")?r.slice(0,-4):r}},t.normalizeZipEntryPath=function(e){let t=e.replace(/\\/g,"/");for(;t.startsWith("/");)t=t.slice(1);return t},t.parseZipAssetRequest=function(e){const t=/\.zip([/?])/.exec(e);if(!t)return null;const r=t.index+4,s=t[1],i=e.substring(0,r);if("/"===s){const t=e.substring(r+1),s=t.indexOf("?"),a=-1===s?t:t.substring(0,s);return""===a?null:{zipUrl:i,internalPath:n(a)}}const a=e.substring(r),o=a.indexOf("/");if(-1===o)return null;const l=a.substring(0,o),c=a.substring(o+1),p=c.indexOf("?"),u=-1===p?c:c.substring(0,p);return""===u?null:{zipUrl:i+l,internalPath:n(u)}},t.canonicalZipAssetRequestUrl=function(e,t){return e+"/"+encodeURIComponent(t)},t.getPresignedUrlExpiryMs=r},612(e,t){var n=Uint8Array,r=Uint16Array,s=Int32Array,i=new n([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,0,0,0]),a=new n([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,0,0]),o=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new r(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var a=new s(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)a[o]=o-n[i]<<5|i;return{b:n,r:a}},c=l(i,2),p=c.b,u=c.r;p[28]=258,u[258]=28;for(var f=l(a,0),d=f.b,h=(f.r,new r(32768)),w=0;w<32768;++w){var g=(43690&w)>>1|(21845&w)<<1;g=(61680&(g=(52428&g)>>2|(13107&g)<<2))>>4|(3855&g)<<4,h[w]=((65280&g)>>8|(255&g)<<8)>>1}var m=function(e,t,n){for(var s=e.length,i=0,a=new r(t);i<s;++i)e[i]&&++a[e[i]-1];var o,l=new r(t);for(i=1;i<t;++i)l[i]=l[i-1]+a[i-1]<<1;if(n){o=new r(1<<t);var c=15-t;for(i=0;i<s;++i)if(e[i])for(var p=i<<4|e[i],u=t-e[i],f=l[e[i]-1]++<<u,d=f|(1<<u)-1;f<=d;++f)o[h[f]>>c]=p}else for(o=new r(s),i=0;i<s;++i)e[i]&&(o[i]=h[l[e[i]-1]++]>>15-e[i]);return o},E=new n(288);for(w=0;w<144;++w)E[w]=8;for(w=144;w<256;++w)E[w]=9;for(w=256;w<280;++w)E[w]=7;for(w=280;w<288;++w)E[w]=8;var A=new n(32);for(w=0;w<32;++w)A[w]=5;var y=m(E,9,1),U=m(A,5,1),P=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},R=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},Z=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},z=function(e){return(e+7)/8|0},C=function(e,t,r){return(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length),new n(e.subarray(t,r))},v=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],S=function(e,t,n){var r=new Error(t||v[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,S),!n)throw r;return r},_=function(e,t,r,s){var l=e.length,c=s?s.length:0;if(!l||t.f&&!t.l)return r||new n(0);var u=!r,f=u||2!=t.i,h=t.i;u&&(r=new n(3*l));var w=function(e){var t=r.length;if(e>t){var s=new n(Math.max(2*t,e));s.set(r),r=s}},g=t.f||0,E=t.p||0,A=t.b||0,v=t.l,_=t.d,b=t.m,I=t.n,M=8*l;do{if(!v){g=R(e,E,1);var L=R(e,E+1,3);if(E+=3,!L){var k=e[($=z(E)+4)-4]|e[$-3]<<8,T=$+k;if(T>l){h&&S(0);break}f&&w(A+k),r.set(e.subarray($,T),A),t.b=A+=k,t.p=E=8*T,t.f=g;continue}if(1==L)v=y,_=U,b=9,I=5;else if(2==L){var F=R(e,E,31)+257,x=R(e,E+10,15)+4,O=F+R(e,E+5,31)+1;E+=14;for(var N=new n(O),H=new n(19),q=0;q<x;++q)H[o[q]]=R(e,E+3*q,7);E+=3*x;var D=P(H),j=(1<<D)-1,W=m(H,D,1);for(q=0;q<O;){var $,K=W[R(e,E,j)];if(E+=15&K,($=K>>4)<16)N[q++]=$;else{var X=0,G=0;for(16==$?(G=3+R(e,E,3),E+=2,X=N[q-1]):17==$?(G=3+R(e,E,7),E+=3):18==$&&(G=11+R(e,E,127),E+=7);G--;)N[q++]=X}}var B=N.subarray(0,F),Y=N.subarray(F);b=P(B),I=P(Y),v=m(B,b,1),_=m(Y,I,1)}else S(1);if(E>M){h&&S(0);break}}f&&w(A+131072);for(var Q=(1<<b)-1,V=(1<<I)-1,J=E;;J=E){var ee=(X=v[Z(e,E)&Q])>>4;if((E+=15&X)>M){h&&S(0);break}if(X||S(2),ee<256)r[A++]=ee;else{if(256==ee){J=E,v=null;break}var te=ee-254;if(ee>264){var ne=i[q=ee-257];te=R(e,E,(1<<ne)-1)+p[q],E+=ne}var re=_[Z(e,E)&V],se=re>>4;if(re||S(3),E+=15&re,Y=d[se],se>3&&(ne=a[se],Y+=Z(e,E)&(1<<ne)-1,E+=ne),E>M){h&&S(0);break}f&&w(A+131072);var ie=A+te;if(A<Y){var ae=c-Y,oe=Math.min(Y,ie);for(ae+A<0&&S(3);A<oe;++A)r[A]=s[ae+A]}for(;A<ie;++A)r[A]=r[A-Y]}}t.l=v,t.p=J,t.b=A,t.f=g,v&&(g=1,t.m=b,t.d=_,t.n=I)}while(!g);return A!=r.length&&u?C(r,0,A):r.subarray(0,A)},b=new n(0);var I=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var r=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new n(32768),this.p=new n(0),r&&this.o.set(r)}return e.prototype.e=function(e){if(this.ondata||S(5),this.d&&S(4),this.p.length){if(e.length){var t=new n(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=_(this.p,this.s,this.o);this.ondata(C(n,t,this.s.b),this.d),this.o=C(n,this.s.b-32768),this.s.b=this.o.length,this.p=C(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();t.Inflate=I;var M="undefined"!=typeof TextDecoder&&new TextDecoder;try{M.decode(b,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout}};const t={};function n(r){const s=t[r];if(void 0!==s)return s.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}(()=>{const e=n(266),t=n(982),r=n(993);self.addEventListener("install",()=>{self.skipWaiting()}),self.addEventListener("activate",e=>{e.waitUntil(self.clients.claim())}),(0,e.installClientErrorReporting)(),(0,r.installMessageHandler)(),(0,t.installFetchHandler)()})()})();
|
|
2
2
|
//# sourceMappingURL=zipServiceWorker.js.map
|