zip-peek 0.7.3-beta → 0.7.3
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 +25 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +131 -6
- package/dist/types.d.ts +6 -0
- package/dist/zipServiceWorker.js +1 -1
- package/dist/zipServiceWorker.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ The package provides two pieces:
|
|
|
40
40
|
At runtime, the package:
|
|
41
41
|
|
|
42
42
|
1. Registers the ZIP service worker with the configured `workerUrl` and `scopeUrl`.
|
|
43
|
-
2. Reloads once after first service worker install when needed, so the page becomes controlled.
|
|
43
|
+
2. Reloads once after first service worker install when needed, so the page becomes controlled. On later loads it calls `registration.update()` and reloads once when a newer worker version activates.
|
|
44
44
|
3. Intercepts matching `.zip/...` asset requests within the service worker scope.
|
|
45
45
|
4. Loads and caches the ZIP central directory on first use, or during init when `allowedZipUrls` is provided.
|
|
46
46
|
5. Streams the entry byte span (`offset` through `nextOffset − 1`), parses the local file header, and incrementally inflates deflated entries using `fflate`.
|
|
@@ -95,6 +95,7 @@ type InitZipPeekOptions = {
|
|
|
95
95
|
workerUrl: string;
|
|
96
96
|
scopeUrl: string;
|
|
97
97
|
reloadOnFirstInstall?: boolean;
|
|
98
|
+
reloadOnWorkerUpdate?: boolean;
|
|
98
99
|
cacheClearingStrategy?: ZipCacheClearingStrategy;
|
|
99
100
|
allowedZipUrls?: string[];
|
|
100
101
|
requireExactManifestPath?: boolean;
|
|
@@ -152,6 +153,16 @@ Choose the smallest scope that includes the pages and asset requests you want th
|
|
|
152
153
|
|
|
153
154
|
Defaults to `true`. When a service worker is installed for the first time, the current page may not yet be controlled by it. With this option enabled, the package reloads once and returns `{ reloaded: true, initialized: false }`.
|
|
154
155
|
|
|
156
|
+
`reloadOnWorkerUpdate`
|
|
157
|
+
|
|
158
|
+
Defaults to `true`. When a matching registration already exists, `initZipPeek()` calls `registration.update()` so a new `zipServiceWorker.js` is found on this load instead of after the browser's own update check. If the page already has a controller and a newer worker is installing, init waits up to 10 seconds for it to activate, then reloads the page and returns `{ reloaded: true, initialized: false }`. If the new worker fails to install or does not activate in time, init continues on the current worker and `onError` receives a `warn` titled `Updated service worker did not activate` (`reason=redundant` or `reason=timeout`).
|
|
159
|
+
|
|
160
|
+
After a successful init, zip-peek also reloads the page if the controlling worker changes mid-session (for example after the browser's own update check), because the new worker has not received this page's configuration.
|
|
161
|
+
|
|
162
|
+
Set it to `false` to skip both reloads. Init then sends its configuration to the newly activated worker and continues without a reload. A mid-session worker change is not reloaded either, and that worker runs without this page's configuration until the next init.
|
|
163
|
+
|
|
164
|
+
The reload is `window.location.reload()` of the window that runs `initZipPeek()`. Inside an iframe, only the iframe reloads.
|
|
165
|
+
|
|
155
166
|
`cacheClearingStrategy`
|
|
156
167
|
|
|
157
168
|
Defaults to `'keep-all'`. Controls which zip-peek cache entries are cleared during initialization.
|
|
@@ -188,7 +199,7 @@ When fallback resolution succeeds, the asset is still served normally, but `onEr
|
|
|
188
199
|
|
|
189
200
|
`onError`
|
|
190
201
|
|
|
191
|
-
Optional error handler for zip-peek failures and informational reports from the service worker. Receives `(error, info, level)`. `level` is `"warn"` for a thrown network fetch, a file missing from the manifest,
|
|
202
|
+
Optional error handler for zip-peek failures and informational reports from the service worker. Receives `(error, info, level)`. `level` is `"warn"` for a thrown network fetch, a file missing from the manifest, a successful zip-basename fallback, a service worker version mismatch, and an updated worker that does not activate. Every other report is `"error"`.
|
|
192
203
|
|
|
193
204
|
- `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
205
|
- `info` holds request-specific details (`path=… zipPath=… reason=… status=… cause=… zipSW=… zipPeek=…`). `zipSW` is the service-worker build version (the package version baked into `zipServiceWorker.js`). `zipPeek` is the zip-peek package version running on the page. They match on a fresh install and differ when a cached worker is older than the page. Manifest preload and manifest fetch failures also include `phase` (`tail` or `cd`) and `online`. The init step label is kept in front of those fields.
|
|
@@ -197,6 +208,8 @@ Service-worker fetch failures post `ZIP_SW_ERROR` so `onError` runs (allow-list
|
|
|
197
208
|
|
|
198
209
|
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.
|
|
199
210
|
|
|
211
|
+
During init, zip-peek asks the worker for its build version. If it differs from the page's zip-peek version, `onError` receives a `warn` titled `Service worker version mismatch` with `info` such as `zipSW=0.7.2 zipPeek=0.7.3`. This means the page and the worker came from different deploys, for example because a CDN served an old `zipServiceWorker.js`. Workers built before this check do not answer; after a 500 ms timeout the same warning is reported with `zipSW=unknown`. Init continues in every case.
|
|
212
|
+
|
|
200
213
|
`zipAssetCacheName`
|
|
201
214
|
|
|
202
215
|
Overrides the browser Cache API bucket used by the service worker for ZIP manifests and extracted assets.
|
|
@@ -375,6 +388,16 @@ or:
|
|
|
375
388
|
Service-Worker-Allowed: /
|
|
376
389
|
```
|
|
377
390
|
|
|
391
|
+
### 6. Do not cache a stable worker URL
|
|
392
|
+
|
|
393
|
+
When the worker is served under a stable name such as `zipServiceWorker.js`, serve it with:
|
|
394
|
+
|
|
395
|
+
```http
|
|
396
|
+
Cache-Control: no-cache
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
(or `max-age=0`), and make sure a CDN in front of it does not cache it for long. The browser skips its own HTTP cache when checking for worker updates, but a CDN or proxy can still return an old script. In that case `registration.update()` finds nothing new, and pages keep running the old worker. The `Service worker version mismatch` warning in `onError` shows when this happens.
|
|
400
|
+
|
|
378
401
|
## Bundler Configuration
|
|
379
402
|
|
|
380
403
|
The package ships the worker as:
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export { getPresignedUrlExpiryMs, isPresignedUrlExpired } from "./zip-utils";
|
|
|
23
23
|
* sleep or backgrounding, and when a cache-miss fetch finds the URL already
|
|
24
24
|
* expired. Concurrent callers share one in-flight renewal.
|
|
25
25
|
*/
|
|
26
|
-
export declare function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall, cacheClearingStrategy, allowedZipUrls, requireExactManifestPath, zipAssetCacheName, assetCacheTtlMs, logPrefix, onError, onUrlExpiry, }: InitZipPeekOptions): Promise<InitZipPeekResult>;
|
|
26
|
+
export declare function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall, reloadOnWorkerUpdate, cacheClearingStrategy, allowedZipUrls, requireExactManifestPath, zipAssetCacheName, assetCacheTtlMs, logPrefix, onError, onUrlExpiry, }: InitZipPeekOptions): Promise<InitZipPeekResult>;
|
|
27
27
|
/**
|
|
28
28
|
* Replace a presigned ZIP package URL after renewal so the service worker
|
|
29
29
|
* continue serving assets with the new credentials.
|
package/dist/index.js
CHANGED
|
@@ -25,10 +25,17 @@ const URL_EXPIRY_LEAD_MS = 10000;
|
|
|
25
25
|
const URL_EXPIRY_RETRY_MS = 5000;
|
|
26
26
|
/** Avoid delayMs=0 tight loops while a renewal is already in flight. */
|
|
27
27
|
const URL_EXPIRY_MIN_DELAY_MS = 1000;
|
|
28
|
+
/** How long init waits for an updated service worker to activate before continuing on the current one. */
|
|
29
|
+
const WORKER_ACTIVATION_TIMEOUT_MS = 10000;
|
|
30
|
+
/** Workers built before ZIP_SW_VERSION never reply, so the version check must not wait forever. */
|
|
31
|
+
const WORKER_VERSION_TIMEOUT_MS = 500;
|
|
28
32
|
let currentOnError;
|
|
29
33
|
let currentOnUrlExpiry;
|
|
34
|
+
let currentReloadOnWorkerUpdate = true;
|
|
30
35
|
let clientMessageListenerInstalled = false;
|
|
36
|
+
let controllerChangeListenerInstalled = false;
|
|
31
37
|
let expiryWakeListenersInstalled = false;
|
|
38
|
+
let reloadRequested = false;
|
|
32
39
|
/**
|
|
33
40
|
* Last allow-list sent to the service worker from this page.
|
|
34
41
|
* `undefined` = initZipPeek not completed; `null` = unrestricted; `string[]` = claim.
|
|
@@ -41,6 +48,39 @@ const trackedZipUrls = new Map();
|
|
|
41
48
|
/** In-flight onUrlExpiry promises keyed by normalized zip URL. */
|
|
42
49
|
const urlExpiryInFlight = new Map();
|
|
43
50
|
const sessionManifests = new Map();
|
|
51
|
+
function reloadPage(reason) {
|
|
52
|
+
if (reloadRequested) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
reloadRequested = true;
|
|
56
|
+
console.log(ZIP_PEEK_VERSION_FIELD, `Reloading page: ${reason}`);
|
|
57
|
+
window.location.reload();
|
|
58
|
+
}
|
|
59
|
+
function waitForWorkerActivated(worker, timeoutMs) {
|
|
60
|
+
if (worker.state === "activated") {
|
|
61
|
+
return Promise.resolve("activated");
|
|
62
|
+
}
|
|
63
|
+
if (worker.state === "redundant") {
|
|
64
|
+
return Promise.resolve("redundant");
|
|
65
|
+
}
|
|
66
|
+
return new Promise((resolve) => {
|
|
67
|
+
const finish = (result) => {
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
worker.removeEventListener("statechange", onStateChange);
|
|
70
|
+
resolve(result);
|
|
71
|
+
};
|
|
72
|
+
const onStateChange = () => {
|
|
73
|
+
if (worker.state === "activated") {
|
|
74
|
+
finish("activated");
|
|
75
|
+
}
|
|
76
|
+
else if (worker.state === "redundant") {
|
|
77
|
+
finish("redundant");
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const timer = setTimeout(() => finish("timeout"), timeoutMs);
|
|
81
|
+
worker.addEventListener("statechange", onStateChange);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
44
84
|
function normalizeScopePath(href) {
|
|
45
85
|
let p = new URL(href).pathname;
|
|
46
86
|
if (p.length > 1 && p.endsWith("/")) {
|
|
@@ -93,20 +133,22 @@ async function unregisterMismatchedScopeZipServiceWorkerIfNeeded(expectedWorkerU
|
|
|
93
133
|
}
|
|
94
134
|
}
|
|
95
135
|
}
|
|
96
|
-
async function ensureZipServiceWorkerRegistered({ workerUrl, scopeUrl, reloadOnFirstInstall = true, }) {
|
|
97
|
-
var _a, _b, _c;
|
|
136
|
+
async function ensureZipServiceWorkerRegistered({ workerUrl, scopeUrl, reloadOnFirstInstall = true, reloadOnWorkerUpdate = true, }) {
|
|
137
|
+
var _a, _b, _c, _d;
|
|
98
138
|
if (!("serviceWorker" in navigator)) {
|
|
99
139
|
return false;
|
|
100
140
|
}
|
|
141
|
+
const hadController = Boolean(navigator.serviceWorker.controller);
|
|
101
142
|
await unregisterMismatchedScopeZipServiceWorkerIfNeeded(workerUrl, scopeUrl);
|
|
102
143
|
const existing = await navigator.serviceWorker.getRegistration(scopeUrl);
|
|
103
144
|
const alreadyRegistered = existing &&
|
|
104
145
|
(zipServiceWorkerScriptMatches((_a = existing.active) === null || _a === void 0 ? void 0 : _a.scriptURL, workerUrl) ||
|
|
105
146
|
zipServiceWorkerScriptMatches((_b = existing.waiting) === null || _b === void 0 ? void 0 : _b.scriptURL, workerUrl) ||
|
|
106
147
|
zipServiceWorkerScriptMatches((_c = existing.installing) === null || _c === void 0 ? void 0 : _c.scriptURL, workerUrl));
|
|
148
|
+
let registration;
|
|
107
149
|
if (!alreadyRegistered) {
|
|
108
150
|
try {
|
|
109
|
-
await navigator.serviceWorker.register(workerUrl, { scope: scopeUrl });
|
|
151
|
+
registration = await navigator.serviceWorker.register(workerUrl, { scope: scopeUrl });
|
|
110
152
|
console.log(ZIP_PEEK_VERSION_FIELD, "Zip service worker registered successfully");
|
|
111
153
|
}
|
|
112
154
|
catch (error) {
|
|
@@ -116,11 +158,31 @@ async function ensureZipServiceWorkerRegistered({ workerUrl, scopeUrl, reloadOnF
|
|
|
116
158
|
}
|
|
117
159
|
}
|
|
118
160
|
else {
|
|
119
|
-
|
|
161
|
+
registration = existing;
|
|
162
|
+
console.log(ZIP_PEEK_VERSION_FIELD, "Zip service worker already registered; checking for updates.");
|
|
163
|
+
try {
|
|
164
|
+
await existing.update();
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
console.warn(ZIP_PEEK_VERSION_FIELD, "zip-peek: service worker update check failed", error);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const incomingWorker = (_d = registration.installing) !== null && _d !== void 0 ? _d : registration.waiting;
|
|
171
|
+
if (hadController && incomingWorker) {
|
|
172
|
+
const result = await waitForWorkerActivated(incomingWorker, WORKER_ACTIVATION_TIMEOUT_MS);
|
|
173
|
+
if (result === "activated") {
|
|
174
|
+
if (reloadOnWorkerUpdate) {
|
|
175
|
+
reloadPage("service worker updated");
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
reportZipPeekError(currentOnError, (0, types_1.createZipPeekError)("Updated service worker did not activate", "warn"), `reason=${result}`);
|
|
181
|
+
}
|
|
120
182
|
}
|
|
121
183
|
await navigator.serviceWorker.ready;
|
|
122
184
|
if (reloadOnFirstInstall && !navigator.serviceWorker.controller) {
|
|
123
|
-
|
|
185
|
+
reloadPage("first service worker install");
|
|
124
186
|
return true;
|
|
125
187
|
}
|
|
126
188
|
return false;
|
|
@@ -382,6 +444,25 @@ function ensureClientMessageListener() {
|
|
|
382
444
|
currentOnError(error, withPackageVersion(data.info ? (0, types_1.formatZipPeekError)(data.info) : undefined), (_d = data.level) !== null && _d !== void 0 ? _d : "error");
|
|
383
445
|
});
|
|
384
446
|
}
|
|
447
|
+
/**
|
|
448
|
+
* After init, a worker swap (browser soft update + skipWaiting/claim) leaves
|
|
449
|
+
* the page talking to a worker that never received ZIP_SW_CONFIG, so reload.
|
|
450
|
+
*/
|
|
451
|
+
function ensureControllerChangeListener() {
|
|
452
|
+
if (controllerChangeListenerInstalled || !("serviceWorker" in navigator)) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
controllerChangeListenerInstalled = true;
|
|
456
|
+
let hadController = Boolean(navigator.serviceWorker.controller);
|
|
457
|
+
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
|
458
|
+
const previouslyControlled = hadController;
|
|
459
|
+
hadController = Boolean(navigator.serviceWorker.controller);
|
|
460
|
+
if (!previouslyControlled || !currentReloadOnWorkerUpdate) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
reloadPage("service worker changed mid-session");
|
|
464
|
+
});
|
|
465
|
+
}
|
|
385
466
|
function normalizeAllowedZipUrls(allowedZipUrls) {
|
|
386
467
|
if (allowedZipUrls === undefined) {
|
|
387
468
|
return undefined;
|
|
@@ -424,6 +505,46 @@ async function postWorkerMessage(message) {
|
|
|
424
505
|
worker.postMessage(message, [channel.port2]);
|
|
425
506
|
});
|
|
426
507
|
}
|
|
508
|
+
async function readWorkerVersion(timeoutMs) {
|
|
509
|
+
var _a;
|
|
510
|
+
const worker = (_a = navigator.serviceWorker.controller) !== null && _a !== void 0 ? _a : (await navigator.serviceWorker.ready).active;
|
|
511
|
+
if (!worker) {
|
|
512
|
+
return undefined;
|
|
513
|
+
}
|
|
514
|
+
return new Promise((resolve) => {
|
|
515
|
+
const channel = new MessageChannel();
|
|
516
|
+
const finish = (version) => {
|
|
517
|
+
clearTimeout(timer);
|
|
518
|
+
channel.port1.onmessage = null;
|
|
519
|
+
channel.port1.close();
|
|
520
|
+
resolve(version);
|
|
521
|
+
};
|
|
522
|
+
const timer = setTimeout(() => finish(undefined), timeoutMs);
|
|
523
|
+
channel.port1.onmessage = (event) => {
|
|
524
|
+
const data = event.data;
|
|
525
|
+
finish(typeof (data === null || data === void 0 ? void 0 : data.version) === "string" ? data.version : undefined);
|
|
526
|
+
};
|
|
527
|
+
try {
|
|
528
|
+
worker.postMessage({ type: "ZIP_SW_VERSION" }, [channel.port2]);
|
|
529
|
+
}
|
|
530
|
+
catch (_a) {
|
|
531
|
+
finish(undefined);
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
/** Diagnostics only: reports a page/worker build mismatch through onError and never blocks init. */
|
|
536
|
+
async function checkWorkerVersion(onError) {
|
|
537
|
+
try {
|
|
538
|
+
const workerVersion = await readWorkerVersion(WORKER_VERSION_TIMEOUT_MS);
|
|
539
|
+
if (workerVersion === version_1.ZIP_PEEK_VERSION) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
reportZipPeekError(onError, (0, types_1.createZipPeekError)("Service worker version mismatch", "warn"), `zipSW=${workerVersion !== null && workerVersion !== void 0 ? workerVersion : "unknown"}`);
|
|
543
|
+
}
|
|
544
|
+
catch (error) {
|
|
545
|
+
console.warn(ZIP_PEEK_VERSION_FIELD, "zip-peek: service worker version check failed", error);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
427
548
|
async function postWorkerMessageOrThrow(message, info) {
|
|
428
549
|
try {
|
|
429
550
|
await postWorkerMessage(message);
|
|
@@ -453,13 +574,14 @@ async function postWorkerMessageOrThrow(message, info) {
|
|
|
453
574
|
* sleep or backgrounding, and when a cache-miss fetch finds the URL already
|
|
454
575
|
* expired. Concurrent callers share one in-flight renewal.
|
|
455
576
|
*/
|
|
456
|
-
async function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall = true, cacheClearingStrategy = "keep-all", allowedZipUrls, requireExactManifestPath = false, zipAssetCacheName, assetCacheTtlMs, logPrefix, onError, onUrlExpiry, }) {
|
|
577
|
+
async function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall = true, reloadOnWorkerUpdate = true, cacheClearingStrategy = "keep-all", allowedZipUrls, requireExactManifestPath = false, zipAssetCacheName, assetCacheTtlMs, logPrefix, onError, onUrlExpiry, }) {
|
|
457
578
|
if (onError) {
|
|
458
579
|
currentOnError = onError;
|
|
459
580
|
}
|
|
460
581
|
if (onUrlExpiry) {
|
|
461
582
|
currentOnUrlExpiry = onUrlExpiry;
|
|
462
583
|
}
|
|
584
|
+
currentReloadOnWorkerUpdate = reloadOnWorkerUpdate;
|
|
463
585
|
try {
|
|
464
586
|
const normalizedAllowedZipUrls = normalizeAllowedZipUrls(allowedZipUrls);
|
|
465
587
|
if (cacheClearingStrategy === "keep-allowed-urls" && !normalizedAllowedZipUrls) {
|
|
@@ -478,6 +600,7 @@ async function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall = true, c
|
|
|
478
600
|
workerUrl,
|
|
479
601
|
scopeUrl,
|
|
480
602
|
reloadOnFirstInstall,
|
|
603
|
+
reloadOnWorkerUpdate,
|
|
481
604
|
});
|
|
482
605
|
}
|
|
483
606
|
catch (error) {
|
|
@@ -490,6 +613,7 @@ async function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall = true, c
|
|
|
490
613
|
if (reloaded) {
|
|
491
614
|
return { reloaded: true, initialized: false };
|
|
492
615
|
}
|
|
616
|
+
await checkWorkerVersion(onError);
|
|
493
617
|
await postWorkerMessageOrThrow({
|
|
494
618
|
type: "ZIP_SW_CONFIG",
|
|
495
619
|
config: {
|
|
@@ -540,6 +664,7 @@ async function initZipPeek({ workerUrl, scopeUrl, reloadOnFirstInstall = true, c
|
|
|
540
664
|
}
|
|
541
665
|
}
|
|
542
666
|
}
|
|
667
|
+
ensureControllerChangeListener();
|
|
543
668
|
return { reloaded: false, initialized: true };
|
|
544
669
|
}
|
|
545
670
|
catch (error) {
|
package/dist/types.d.ts
CHANGED
|
@@ -26,6 +26,12 @@ export type InitZipPeekOptions = {
|
|
|
26
26
|
workerUrl: string;
|
|
27
27
|
scopeUrl: string;
|
|
28
28
|
reloadOnFirstInstall?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Reload the page after a newer service worker version activates, either
|
|
31
|
+
* during init (found by `registration.update()`) or later in the session.
|
|
32
|
+
* Defaults to `true`.
|
|
33
|
+
*/
|
|
34
|
+
reloadOnWorkerUpdate?: boolean;
|
|
29
35
|
cacheClearingStrategy?: ZipCacheClearingStrategy;
|
|
30
36
|
allowedZipUrls?: string[];
|
|
31
37
|
requireExactManifestPath?: boolean;
|
package/dist/zipServiceWorker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var e={616(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,r){const s=new Error(n(e));return s.zipPeekLevel=t,r&&(s.zipPeekInfo=r),s},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.zipPeekLevel||(r.zipPeekLevel="error"),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]"},285(e,t,n){t.ZIP_PEEK_VERSION=void 0,t.ZIP_PEEK_VERSION=n(330).version},887(e,t,n){t.clearAllClientClaims=void 0,t.persistAllowListState=o,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,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,s.setClientAllowedZipUrls)(e.id,a.allowedZipUrls.map(e=>(0,r.normalizeZipUrl)(e))):null===a.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(o),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 o()):e.length>0&&((0,s.setAllowListRestricted)(!1),(0,s.setPersistedAllowUnion)(null),await a(null,!1))}(),await l(),!s.allowListRestricted)return;const t=(0,s.getClaimsUnion)();await e(Array.from(t)),await o()},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 a(null,!1)):((0,s.setAllowListRestricted)(!0),(0,s.setPersistedAllowUnion)(new Set(n)),(0,s.setAllowedZipUrlsLoaded)(Promise.resolve()),void await a(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 a(null,!1)}else(0,s.setClientAllowedZipUrls)(t,n);await l(),(0,s.setAllowedZipUrlsLoaded)(Promise.resolve()),await o()}},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(602),s=n(803);Object.defineProperty(t,"clearAllClientClaims",{enumerable:!0,get:function(){return s.clearAllClientClaims}});const i=n(997);async function o(){if(!s.allowListRestricted)return(0,s.setPersistedAllowUnion)(null),void await a(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 a(t,!0)}async function a(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 a([],!0)):s.clientAllowedZipUrls.size>0&&await o()}},531(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(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),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 a.zipManifests.keys())t.has(e)||a.zipManifests.delete(e)}catch(e){throw(0,r.createZipPeekError)(`Failed to clear zip assets except allowed URLs: ${(0,r.errorMessage)(e)}`,"error")}},t.putCachedFullAssetIfAbsent=async function(e,t){var n;try{const r=await caches.open(a.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(a.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(a.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)(),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 u=a.pendingManifestLoads.get(n);u&&(a.pendingManifestLoads.set(l,u),a.pendingManifestLoads.delete(n)),(0,o.remapInFlightZipAssetsForRenewal)(n,l);try{const e=await caches.open(a.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)}`,"error")}};const r=n(616),s=n(602),i=n(887),o=n(489),a=n(803),l=n(997);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}},489(e,t,n){t.getOrStartInFlightAsset=function(e,t){const n=e.url,r=s.inFlightZipAssets.get(n);if(r)return r;let o,a;const l=new Promise((e,t)=>{o=e,a=t}),c={resultPromise:t(),cacheFillPromise:l,leaderClaimed:!1,resolveCacheFill:o,rejectCacheFill:a};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 o=(0,r.parseZipAssetRequest)(e);if(o&&(0,r.normalizeZipUrl)(o.zipUrl)===n){const n=(0,r.canonicalZipAssetRequestUrl)(i,o.internalPath);s.inFlightZipAssets.delete(e),s.inFlightZipAssets.set(n,t)}}};const r=n(602),s=n(803);function i(e,t){void 0!==t?e.rejectCacheFill(t):e.resolveCacheFill()}},629(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,w,m;const E="HEAD"===e.method,A=(0,s.parseZipAssetRequest)(e.url);let y=(0,s.normalizeZipUrl)(A.zipUrl);const P=A.internalPath,U=(0,s.normalizeZipEntryPath)(P);let R;try{let w;if(await(0,i.ensureAllowedZipUrlsLoaded)(),y=(0,p.resolveAllowedZipUrlByPathname)(y),!(0,i.isZipUrlAllowed)(y)&&(0,s.isPresignedUrlExpired)(y)){const e=await(0,p.requestClientRenewal)(y,t);e.ok?y=e.nextUrl:w=e.reason}if(!(0,i.isZipUrlAllowed)(y))return(0,c.warn)("zip URL not allowed",{requestedZipUrl:y}),d("ZIP URL not allowed",403,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(y),reason:w}),"error");let m=l.zipManifests.get(y);if(m&&!E){const t=(0,u.resolveManifestEntry)(m,U,y,l.runtimeConfig.requireExactManifestPath);if(t){const n=(0,o.canonicalAssetRequest)(y,t.key),r=await(0,o.readCachedZipAssetIfFresh)(n);if(r.response){const n=(0,u.entryUncompressedSize)(t.info);return{response:h(r.response.body,(0,f.getMimeType)(t.key),n,r.assetSource,e.headers.get("range"))}}}}if((0,s.isPresignedUrlExpired)(y)&&(!E||!m)){const e=await(0,p.requestClientRenewal)(y,t);if(!e.ok)return d("Failed to renew expired presigned ZIP URL",502,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(y),reason:e.reason}),"error");y=e.nextUrl,m=l.zipManifests.get(y)}if(m||(m=null!==(n=await(0,u.ensureManifestAvailable)(y,t))&&void 0!==n?n:void 0),!m){const e=Array.from(l.zipManifests.keys());return(0,c.warn)("manifest missing for zipUrl",{requestedZipUrl:y,knownZipUrls:e}),d("ZIP manifest not loaded",404,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(y)}),"error")}const A=(0,u.resolveManifestEntry)(m,U,y,l.runtimeConfig.requireExactManifestPath);if(!A){const e=Array.from(m.keys()).slice(0,50);return(0,c.warn)("file not in manifest",{zipUrl:y,internalPathRaw:P,internalPathNormalized:U,requireExactManifestPath:l.runtimeConfig.requireExactManifestPath,manifestSize:m.size,sampleKeys:e}),d("File not found in ZIP manifest",404,(0,r.zipErrorInfo)({path:U,zipPath:(0,s.zipPackagePathname)(y)}),"warn")}const{key:v,info:Z,matchKind:z}=A;if("zipBasenameFallback"===z&&((0,c.log)("resolved via zip-basename folder fallback",{requested:U,manifestKey:v}),(0,c.reportClientError)((0,r.createZipPeekError)("Exact manifest path not found; resolved via zip-basename folder fallback","warn"),`Exact manifest key "${U}" not found in ${y}; resolved using "${v}"`)),E)return{response:g(e,v,Z)};const S=(0,o.canonicalAssetRequest)(y,v),C=await(0,o.readCachedZipAssetIfFresh)(S),_=(0,u.entryUncompressedSize)(Z),b=(0,f.getMimeType)(v);if(C.response)return{response:h(C.response.body,b,_,C.assetSource,e.headers.get("range"))};const I=(0,a.getOrStartInFlightAsset)(S,()=>(0,f.fetchUncompressedZipEntryFromNetwork)(y,v,Z));R=S.url;const k=await I.resultPromise;if(!k.ok)return(0,a.completeInFlightAssetLoad)(S.url),{response:k.response};const L=!I.leaderClaimed&&(I.leaderClaimed=!0),M=8===Z.compression?null:e.headers.get("range");if(!L){await I.cacheFillPromise;const t=await(0,o.readCachedZipAssetIfFresh)(S);return t.response?{response:h(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:v,zipPath:(0,s.zipPackagePathname)(y)}),"error")}const[T,x]=k.stream.tee(),F={"Content-Type":k.contentType};null!==k.contentLength&&(F["Content-Length"]=String(k.contentLength));const O=S.url,N=(0,o.putCachedFullAssetIfAbsent)(S,new Response(x,{status:200,headers:F})).then(()=>{(0,a.completeInFlightAssetLoad)(O)}).catch(e=>{throw(0,a.completeInFlightAssetLoad)(O,e),e});return{response:h(T,k.contentType,k.contentLength,"network",M),background:N}}catch(e){R&&(0,a.completeInFlightAssetLoad)(R,e),(0,c.error)("fetch handler failed",{zipUrl:y,internalPath:P,message:(0,r.errorMessage)(e)});const t=(0,r.errorMessage)(e),n=t.startsWith(r.ZIP_PEEK_ERROR_PREFIX)?t.slice(r.ZIP_PEEK_ERROR_PREFIX.length).trim():t.includes(r.NETWORK_ERROR_PREFIX)?t:"ZIP asset request failed",i=(0,r.zipPeekErrorInfo)(e),o=e;return d(n,null!==(w=o.httpStatus)&&void 0!==w?w:500,[(0,r.zipErrorInfo)({path:P,zipPath:(0,s.zipPackagePathname)(y),cause:i?void 0:(0,r.errorMessage)(e)}),i].filter(Boolean).join(" "),null!==(m=o.zipPeekLevel)&&void 0!==m?m:"error",void 0!==o.upstreamStatus?{upstreamStatus:o.upstreamStatus}:void 0)}}(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(616),s=n(602),i=n(887),o=n(531),a=n(489),l=n(803),c=n(997),u=n(479),p=n(965),f=n(321);function d(e,t,n,s,i){return(0,c.reportClientError)((0,r.createZipPeekError)(e,s),n),{response:(0,f.corsErrorResponse)(e,t,i)}}function w(e){return{"Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":l.ASSET_SOURCE_HEADER,[l.ASSET_SOURCE_HEADER]:e}}function h(e,t,n,r,s){if(s){if(null===n)return null==e||e.cancel(),new Response(null,{status:416,headers:w(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}`},w(r))});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}`},w(r))});const u=Math.min(c,n-1),p=u-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:o,value:a}=await r.read();if(o)return i=!0,void e.close();const l=a,c=s,u=s+l.byteLength-1;if(s+=l.byteLength,u<t)continue;if(c>n)return i=!0,void e.close();const p=Math.max(0,t-c),f=Math.min(l.byteLength,n-c+1);if(f>p&&e.enqueue(l.subarray(p,f)),u>=n)return i=!0,void e.close()}},cancel:e=>r.cancel(e)})}(e,l,u);return new Response(f,{status:206,headers:Object.assign({"Content-Type":t,"Content-Range":`bytes ${l}-${u}/${n}`,"Content-Length":p.toString(),"Accept-Ranges":"bytes"},w(r))})}const i=Object.assign({"Content-Type":t},w(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,u.entryUncompressedSize)(n),i=e.headers.get("range");if(null!==s&&i)return h(null,r,s,"manifest",i);const o=Object.assign({"Content-Type":r},w("manifest"));return null!==s&&(o["Content-Length"]=s.toString(),o["Accept-Ranges"]="bytes"),new Response(null,{status:200,headers:o})}},803(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},997(e,t,n){t.withVersion=a,t.log=function(...e){console.log(i.runtimeConfig.logPrefix,o,...e)},t.warn=function(...e){console.warn(i.runtimeConfig.logPrefix,o,...e)},t.error=function(...e){console.error(i.runtimeConfig.logPrefix,o,r.ZIP_PEEK_ERROR_PREFIX,...e)},t.reportClientError=l,t.installClientErrorReporting=function(){self.addEventListener("error",e=>{var t;l(null!==(t=e.error)&&void 0!==t?t:e.message,"Service worker uncaught error")}),self.addEventListener("unhandledrejection",e=>{l(e.reason,"Service worker unhandled promise rejection")})};const r=n(616),s=n(285),i=n(803),o=`zipSW=${s.ZIP_PEEK_VERSION}`;function a(e){return e?e.includes("zipSW=")?e:`${e} ${o}`:o}function l(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:(0,r.formatZipPeekError)(a(t)),level:n.zipPeekLevel};for(const t of e)t.postMessage(s)})}},479(e,t,n){t.manifestFilesToMap=a,t.sendManifestToClientId=c,t.ensureManifestAvailable=function(e,t){const n=i.zipManifests.get(e);if(n)return Promise.resolve(n);let r=i.pendingManifestLoads.get(e);return r||(r=(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(a(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,o.warn)("failed to request manifest from client",e),n(null)}})}(n,e):null}(e,t);if(n)return i.zipManifests.set(e,n),(0,o.log)("restored manifest from client memory",{zipUrl:e,entryCount:n.size}),n;const r=await async function(e){const{response:t,buffer:n}=await f(e,"bytes=-65536","tail"),r=new DataView(n);let i=-1;for(let e=n.byteLength-22;e>=0;e--)if(101010256===r.getUint32(e,!0)){i=e;break}if(-1===i)throw p(e,"tail",{network:!1,reason:"no-eocd"});const a=r.getUint32(i+16,!0),l=r.getUint32(i+12,!0);let c=n,u=-1,d="tail";const w=t.headers.get("Content-Range");let h=0;if(w){const e=w.match(/\/(\d+)$/);e&&(h=parseInt(e[1],10))}if(h<=0)throw p(e,"tail",{network:!1,reason:"no-content-range"});const g=h-n.byteLength;a>=g?u=a-g:(d="cd",c=(await f(e,`bytes=${a}-${a+l-1}`,d)).buffer,u=0);const m=function(e,t,n,r){const i=new DataView(e);let a=t;const l=[];for(;a+46<=e.byteLength&&33639248===i.getUint32(a,!0);){const t=i.getUint16(a+10,!0),n=i.getUint32(a+20,!0),r=i.getUint32(a+24,!0),o=i.getUint16(a+28,!0),c=i.getUint16(a+30,!0),u=i.getUint16(a+32,!0),p=i.getUint32(a+42,!0),f=new TextDecoder;if(a+46+o>e.byteLength)break;const d=new Uint8Array(e,a+46,o),w=f.decode(d),h=(0,s.normalizeZipEntryPath)(w);""!==h&&l.push({filename:h,offset:p,compressedSize:n,uncompressedSize:r,compression:t}),a+=46+o+c+u}if(0===l.length)return(0,o.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,o.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,u,a,e);if(!m)throw p(e,d,{network:!1,reason:"empty-manifest"});return m}(e);return i.zipManifests.set(e,r),await c(e,r,t),(0,o.log)("manifest fetched and stored in memory",{zipUrl:e,entryCount:r.size}),r})().finally(()=>{i.pendingManifestLoads.delete(e)}),i.pendingManifestLoads.set(e,r),r)},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 r=n(616),s=n(602),i=n(803),o=n(997);function a(e){const t=new Map;for(const n of e){const e=(0,s.normalizeZipEntryPath)(n.filename);""!==e&&(t.has(e)&&(0,o.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,o.warn)("failed to send manifest to client",e)}}function u(e){return e instanceof Error?e.name&&"Error"!==e.name?`${e.name}: ${e.message}`:e.message:String(e)}function p(e,t,n){const i=(0,r.zipErrorInfo)({phase:t,zipPath:(0,s.zipPackagePathname)(e),online:navigator.onLine,status:n.status,reason:n.reason,cause:n.cause});(0,o.error)("ZIP manifest fetch failed",i);const a=(0,r.createZipPeekError)(n.network?`${r.NETWORK_ERROR_PREFIX} ZIP manifest fetch failed`:"ZIP manifest fetch failed",n.network?"warn":"error",i);return n.network?a.httpStatus=500:null!=n.status&&n.status>=400?(a.httpStatus=n.status,a.upstreamStatus=n.status):(a.httpStatus=502,null!=n.status&&(a.upstreamStatus=n.status)),a}async function f(e,t,n){let r;try{r=await fetch(e,{headers:{Range:t}})}catch(t){throw p(e,n,{network:!0,cause:u(t)})}if(206!==r.status)throw p(e,n,{network:!1,status:r.status});try{const e=await r.arrayBuffer();return{response:r,buffer:e}}catch(t){throw p(e,n,{network:!0,reason:"body",status:r.status,cause:u(t)})}}},866(e,t,n){t.installMessageHandler=function(){self.addEventListener("message",e=>{if(!e.data)return;const{type:t,zipUrl:n,files:u,config:f,allowedZipUrls:d,previousUrl:w,nextUrl:h}=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&&u){const t=(0,s.normalizeZipUrl)(n),r=(0,c.manifestFilesToMap)(u),i=a.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});a.zipManifests.set(t,r),e.waitUntil((0,c.sendManifestToClientId)(t,r,g));const o=Array.from(r.keys()).slice(0,40);(0,l.log)("ZIP_MANIFEST loaded",{zipUrl:t,entryCount:r.size,sampleKeys:o,replacedExistingSize:i?i.size:0})}}else"CLEAR_ZIP_ASSETS_EXCEPT_ALLOWED"===t?p(e,()=>(0,i.clearZipAssetsExceptLiveClaims)(o.clearZipAssetsExceptAllowed)):"CLEAR_ALL_ZIP_ASSETS"===t?p(e,()=>(0,o.clearAllZipAssets)()):"PRELOAD_ZIP_MANIFESTS"===t&&d?p(e,()=>async function(e,t){const n=[];if(await Promise.all(e.map(async e=>{try{await(0,c.ensureManifestAvailable)(e,t)}catch(e){n.push(e)}})),1===n.length)throw n[0];if(n.length>1){const e=n.map(e=>(0,r.toZipPeekError)(e));throw(0,r.createZipPeekError)("ZIP manifest fetch failed",e.every(e=>"warn"===e.zipPeekLevel)?"warn":"error",e.map(e=>{var t;return null!==(t=(0,r.zipPeekErrorInfo)(e))&&void 0!==t?t:e.message}).join(" | "))}}(d,g)):"RENEW_ZIP_URL"===t&&w&&h&&p(e,()=>(0,o.renewZipUrl)(w,h));else p(e,()=>(0,i.applyRuntimeConfig)(f,g))})};const r=n(616),s=n(602),i=n(887),o=n(531),a=n(803),l=n(997),c=n(479);function u(e,t){var n;null===(n=e.ports[0])||void 0===n||n.postMessage(t)}function p(e,t){e.waitUntil(self.clients.claim().then(t).then(()=>u(e,{ok:!0})).catch(t=>u(e,function(e){const t=(0,r.toZipPeekError)(e);return{ok:!1,error:t.message,errorStack:t.stack,info:(0,l.withVersion)((0,r.zipPeekErrorInfo)(t)),level:t.zipPeekLevel}}(t))))}},965(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=o.get(n);if(s)return s;const a=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 o=!1;const a=e=>{o||(o=!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 a({ok:!1,reason:"page-rejected"});const n=(0,r.normalizeZipUrl)(t.nextUrl);(0,r.isPresignedUrlExpired)(n)?a({ok:!1,reason:"still-expired"}):a({ok:!0,nextUrl:n})},n.port1.onmessageerror=()=>{a({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),a({ok:!1,reason:"page-rejected"})}}):{ok:!1,reason:"no-window-client"}}(e,t).finally(()=>{o.delete(n)});return o.set(n,a),a};const r=n(602),s=n(803),i=n(997),o=new Map},321(e,t,n){t.corsErrorResponse=u,t.getMimeType=f,t.fetchUncompressedZipEntryFromNetwork=async function(e,t,n){var l;const c=n.offset,u=n.nextOffset-1,w=(0,i.zipPackagePathname)(e);let h;(0,a.log)("fetching zip chunk from",{zipUrl:e,rangeStart:c,rangeEnd:u});try{h=await fetch(e,{headers:{Range:`bytes=${c}-${u}`}})}catch(e){return p(`${s.NETWORK_ERROR_PREFIX} ZIP asset fetch failed`,500,(0,s.zipErrorInfo)({path:t,zipPath:w,cause:(0,s.errorMessage)(e)}),"warn")}if(206!==h.status)return p("ZIP origin fetch failed",h.status>=400?h.status:502,(0,s.zipErrorInfo)({path:t,zipPath:w,status:h.status}),"error",{upstreamStatus:h.status});if(!h.body)return p("ZIP origin fetch failed",502,(0,s.zipErrorInfo)({path:t,zipPath:w,reason:"empty-body"}),"error");const g=h.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)!==o.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),p("ZIP asset request failed",500,(0,s.zipErrorInfo)({path:t,zipPath:w,cause:(0,s.errorMessage)(e)}),"error")}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:o}=await e.read();if(r)return void t.error(new Error(`ZIP entry ended after ${s} of ${n} compressed bytes`));i=o}const o=n-s,a=i.byteLength>o?i.subarray(0,o):i;s+=a.byteLength,t.enqueue(a),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 P;if(8===n.compression)P=function(e,t){const n=e.getReader();let s,i=0,o=!1;return new ReadableStream({start(e){s=new r.Inflate(t=>{i+=t.byteLength,e.enqueue(t)})},async pull(e){for(;!o;){const{done:r,value:a}=await n.read();if(r)return o=!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(a)}},cancel:e=>n.cancel(e)})}(A,y);else{if(0!==n.compression)return await g.cancel(),p("ZIP asset request failed",500,(0,s.zipErrorInfo)({path:t,zipPath:w,reason:"unsupported-compression",method:n.compression}),"error");P=A}return{ok:!0,stream:P,contentLength:y,contentType:f(t)}};const r=n(612),s=n(616),i=n(602),o=n(803),a=n(997);function l(e){return e.replace(/[\r\n]+/g," ").trim()}function c(e,t){const n=[o.ASSET_ERROR_HEADER],r={"Access-Control-Allow-Origin":"*",[o.ASSET_ERROR_HEADER]:l(e)},s=null==t?void 0:t.upstreamStatus;return void 0!==s&&(r[o.ASSET_UPSTREAM_STATUS_HEADER]=String(s),n.push(o.ASSET_UPSTREAM_STATUS_HEADER)),r["Access-Control-Expose-Headers"]=n.join(", "),r}function u(e,t,n){const r=(0,s.formatZipPeekError)(e);return new Response(r,{status:t,headers:c(r,n)})}function p(e,t,n,r,i){return(0,a.reportClientError)((0,s.createZipPeekError)(e,r),n),{ok:!1,response:u(e,t,i)}}function f(e){var t,n;const r=null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase();return r&&null!==(n=o.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}},602(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),o=-1===i?e.substring(s+1):e.substring(s+1,i),a=r?o.indexOf("/"):-1,l=-1===a?o:o.substring(0,a);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,o,a,l]=e,c=Date.UTC(Number(t),Number(n)-1,Number(i),Number(o),Number(a),Number(l)),u=Number(s);return!Number.isFinite(c)||!Number.isFinite(u)||u<=0?null:c+1e3*u}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 o=e.indexOf("#",i),a=e.substring(0,i),l=-1===o?e.substring(i+1):e.substring(i+1,o),c=r||-1===o?"":e.substring(o),u=l.split("&").filter(e=>{const t=e.indexOf("=");return"t"!==(-1===t?e:e.substring(0,t))});return 0===u.length?a+c:a+"?"+u.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("?"),o=-1===s?t:t.substring(0,s);return""===o?null:{zipUrl:i,internalPath:n(o)}}const o=e.substring(r),a=o.indexOf("/");if(-1===a)return null;const l=o.substring(0,a),c=o.substring(a+1),u=c.indexOf("?"),p=-1===u?c:c.substring(0,u);return""===p?null:{zipUrl:i+l,internalPath:n(p)}},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]),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 r(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var o=new s(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),u=c.b,p=c.r;u[28]=258,p[258]=28;for(var f=l(o,0),d=f.b,w=(f.r,new r(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 s=e.length,i=0,o=new r(t);i<s;++i)e[i]&&++o[e[i]-1];var a,l=new r(t);for(i=1;i<t;++i)l[i]=l[i-1]+o[i-1]<<1;if(n){a=new r(1<<t);var c=15-t;for(i=0;i<s;++i)if(e[i])for(var u=i<<4|e[i],p=t-e[i],f=l[e[i]-1]++<<p,d=f|(1<<p)-1;f<=d;++f)a[w[f]>>c]=u}else for(a=new r(s),i=0;i<s;++i)e[i]&&(a[i]=w[l[e[i]-1]++]>>15-e[i]);return a},E=new n(288);for(h=0;h<144;++h)E[h]=8;for(h=144;h<256;++h)E[h]=9;for(h=256;h<280;++h)E[h]=7;for(h=280;h<288;++h)E[h]=8;var A=new n(32);for(h=0;h<32;++h)A[h]=5;var y=m(E,9,1),P=m(A,5,1),U=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},v=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},z=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))},S=["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"],C=function(e,t,n){var r=new Error(t||S[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,C),!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 p=!r,f=p||2!=t.i,w=t.i;p&&(r=new n(3*l));var h=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,S=t.l,_=t.d,b=t.m,I=t.n,k=8*l;do{if(!S){g=R(e,E,1);var L=R(e,E+1,3);if(E+=3,!L){var M=e[($=Z(E)+4)-4]|e[$-3]<<8,T=$+M;if(T>l){w&&C(0);break}f&&h(A+M),r.set(e.subarray($,T),A),t.b=A+=M,t.p=E=8*T,t.f=g;continue}if(1==L)S=y,_=P,b=9,I=5;else if(2==L){var x=R(e,E,31)+257,F=R(e,E+10,15)+4,O=x+R(e,E+5,31)+1;E+=14;for(var N=new n(O),H=new n(19),q=0;q<F;++q)H[a[q]]=R(e,E+3*q,7);E+=3*F;var D=U(H),W=(1<<D)-1,j=m(H,D,1);for(q=0;q<O;){var $,K=j[R(e,E,W)];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,x),V=N.subarray(x);b=U(B),I=U(V),S=m(B,b,1),_=m(V,I,1)}else C(1);if(E>k){w&&C(0);break}}f&&h(A+131072);for(var Y=(1<<b)-1,Q=(1<<I)-1,J=E;;J=E){var ee=(X=S[v(e,E)&Y])>>4;if((E+=15&X)>k){w&&C(0);break}if(X||C(2),ee<256)r[A++]=ee;else{if(256==ee){J=E,S=null;break}var te=ee-254;if(ee>264){var ne=i[q=ee-257];te=R(e,E,(1<<ne)-1)+u[q],E+=ne}var re=_[v(e,E)&Q],se=re>>4;if(re||C(3),E+=15&re,V=d[se],se>3&&(ne=o[se],V+=v(e,E)&(1<<ne)-1,E+=ne),E>k){w&&C(0);break}f&&h(A+131072);var ie=A+te;if(A<V){var oe=c-V,ae=Math.min(V,ie);for(oe+A<0&&C(3);A<ae;++A)r[A]=s[oe+A]}for(;A<ie;++A)r[A]=r[A-V]}}t.l=S,t.p=J,t.b=A,t.f=g,S&&(g=1,t.m=b,t.d=_,t.n=I)}while(!g);return A!=r.length&&p?z(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||C(5),this.d&&C(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(z(n,t,this.s.b),this.d),this.o=z(n,this.s.b-32768),this.s.b=this.o.length,this.p=z(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 k="undefined"!=typeof TextDecoder&&new TextDecoder;try{k.decode(b,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout},330(e){e.exports=JSON.parse('{"version":"0.7.3-beta"}')}};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(997),t=n(629),r=n(866);self.addEventListener("install",()=>{self.skipWaiting()}),self.addEventListener("activate",e=>{e.waitUntil(self.clients.claim())}),(0,e.installClientErrorReporting)(),(0,r.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,r){const s=new Error(n(e));return s.zipPeekLevel=t,r&&(s.zipPeekInfo=r),s},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.zipPeekLevel||(r.zipPeekLevel="error"),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]"},348(e,t,n){t.ZIP_PEEK_VERSION=void 0,t.ZIP_PEEK_VERSION=n(330).version},314(e,t,n){t.clearAllClientClaims=void 0,t.persistAllowListState=o,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,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,s.setClientAllowedZipUrls)(e.id,a.allowedZipUrls.map(e=>(0,r.normalizeZipUrl)(e))):null===a.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(o),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 o()):e.length>0&&((0,s.setAllowListRestricted)(!1),(0,s.setPersistedAllowUnion)(null),await a(null,!1))}(),await l(),!s.allowListRestricted)return;const t=(0,s.getClaimsUnion)();await e(Array.from(t)),await o()},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 a(null,!1)):((0,s.setAllowListRestricted)(!0),(0,s.setPersistedAllowUnion)(new Set(n)),(0,s.setAllowedZipUrlsLoaded)(Promise.resolve()),void await a(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 a(null,!1)}else(0,s.setClientAllowedZipUrls)(t,n);await l(),(0,s.setAllowedZipUrlsLoaded)(Promise.resolve()),await o()}},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 o(){if(!s.allowListRestricted)return(0,s.setPersistedAllowUnion)(null),void await a(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 a(t,!0)}async function a(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 a([],!0)):s.clientAllowedZipUrls.size>0&&await o()}},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(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),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 a.zipManifests.keys())t.has(e)||a.zipManifests.delete(e)}catch(e){throw(0,r.createZipPeekError)(`Failed to clear zip assets except allowed URLs: ${(0,r.errorMessage)(e)}`,"error")}},t.putCachedFullAssetIfAbsent=async function(e,t){var n;try{const r=await caches.open(a.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(a.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(a.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)(),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 u=a.pendingManifestLoads.get(n);u&&(a.pendingManifestLoads.set(l,u),a.pendingManifestLoads.delete(n)),(0,o.remapInFlightZipAssetsForRenewal)(n,l);try{const e=await caches.open(a.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)}`,"error")}};const r=n(553),s=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,r=s.inFlightZipAssets.get(n);if(r)return r;let o,a;const l=new Promise((e,t)=>{o=e,a=t}),c={resultPromise:t(),cacheFillPromise:l,leaderClaimed:!1,resolveCacheFill:o,rejectCacheFill:a};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 o=(0,r.parseZipAssetRequest)(e);if(o&&(0,r.normalizeZipUrl)(o.zipUrl)===n){const n=(0,r.canonicalZipAssetRequestUrl)(i,o.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,w,m;const E="HEAD"===e.method,A=(0,s.parseZipAssetRequest)(e.url);let y=(0,s.normalizeZipUrl)(A.zipUrl);const P=A.internalPath,U=(0,s.normalizeZipEntryPath)(P);let R;try{let w;if(await(0,i.ensureAllowedZipUrlsLoaded)(),y=(0,p.resolveAllowedZipUrlByPathname)(y),!(0,i.isZipUrlAllowed)(y)&&(0,s.isPresignedUrlExpired)(y)){const e=await(0,p.requestClientRenewal)(y,t);e.ok?y=e.nextUrl:w=e.reason}if(!(0,i.isZipUrlAllowed)(y))return(0,c.warn)("zip URL not allowed",{requestedZipUrl:y}),d("ZIP URL not allowed",403,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(y),reason:w}),"error");let m=l.zipManifests.get(y);if(m&&!E){const t=(0,u.resolveManifestEntry)(m,U,y,l.runtimeConfig.requireExactManifestPath);if(t){const n=(0,o.canonicalAssetRequest)(y,t.key),r=await(0,o.readCachedZipAssetIfFresh)(n);if(r.response){const n=(0,u.entryUncompressedSize)(t.info);return{response:h(r.response.body,(0,f.getMimeType)(t.key),n,r.assetSource,e.headers.get("range"))}}}}if((0,s.isPresignedUrlExpired)(y)&&(!E||!m)){const e=await(0,p.requestClientRenewal)(y,t);if(!e.ok)return d("Failed to renew expired presigned ZIP URL",502,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(y),reason:e.reason}),"error");y=e.nextUrl,m=l.zipManifests.get(y)}if(m||(m=null!==(n=await(0,u.ensureManifestAvailable)(y,t))&&void 0!==n?n:void 0),!m){const e=Array.from(l.zipManifests.keys());return(0,c.warn)("manifest missing for zipUrl",{requestedZipUrl:y,knownZipUrls:e}),d("ZIP manifest not loaded",404,(0,r.zipErrorInfo)({zipPath:(0,s.zipPackagePathname)(y)}),"error")}const A=(0,u.resolveManifestEntry)(m,U,y,l.runtimeConfig.requireExactManifestPath);if(!A){const e=Array.from(m.keys()).slice(0,50);return(0,c.warn)("file not in manifest",{zipUrl:y,internalPathRaw:P,internalPathNormalized:U,requireExactManifestPath:l.runtimeConfig.requireExactManifestPath,manifestSize:m.size,sampleKeys:e}),d("File not found in ZIP manifest",404,(0,r.zipErrorInfo)({path:U,zipPath:(0,s.zipPackagePathname)(y)}),"warn")}const{key:v,info:Z,matchKind:z}=A;if("zipBasenameFallback"===z&&((0,c.log)("resolved via zip-basename folder fallback",{requested:U,manifestKey:v}),(0,c.reportClientError)((0,r.createZipPeekError)("Exact manifest path not found; resolved via zip-basename folder fallback","warn"),`Exact manifest key "${U}" not found in ${y}; resolved using "${v}"`)),E)return{response:g(e,v,Z)};const S=(0,o.canonicalAssetRequest)(y,v),C=await(0,o.readCachedZipAssetIfFresh)(S),_=(0,u.entryUncompressedSize)(Z),I=(0,f.getMimeType)(v);if(C.response)return{response:h(C.response.body,I,_,C.assetSource,e.headers.get("range"))};const b=(0,a.getOrStartInFlightAsset)(S,()=>(0,f.fetchUncompressedZipEntryFromNetwork)(y,v,Z));R=S.url;const k=await b.resultPromise;if(!k.ok)return(0,a.completeInFlightAssetLoad)(S.url),{response:k.response};const L=!b.leaderClaimed&&(b.leaderClaimed=!0),M=8===Z.compression?null:e.headers.get("range");if(!L){await b.cacheFillPromise;const t=await(0,o.readCachedZipAssetIfFresh)(S);return t.response?{response:h(t.response.body,I,_,t.assetSource,e.headers.get("range"))}:d("Asset cache was not ready after in-flight load",500,(0,r.zipErrorInfo)({path:v,zipPath:(0,s.zipPackagePathname)(y)}),"error")}const[T,x]=k.stream.tee(),F={"Content-Type":k.contentType};null!==k.contentLength&&(F["Content-Length"]=String(k.contentLength));const O=S.url,N=(0,o.putCachedFullAssetIfAbsent)(S,new Response(x,{status:200,headers:F})).then(()=>{(0,a.completeInFlightAssetLoad)(O)}).catch(e=>{throw(0,a.completeInFlightAssetLoad)(O,e),e});return{response:h(T,k.contentType,k.contentLength,"network",M),background:N}}catch(e){R&&(0,a.completeInFlightAssetLoad)(R,e),(0,c.error)("fetch handler failed",{zipUrl:y,internalPath:P,message:(0,r.errorMessage)(e)});const t=(0,r.errorMessage)(e),n=t.startsWith(r.ZIP_PEEK_ERROR_PREFIX)?t.slice(r.ZIP_PEEK_ERROR_PREFIX.length).trim():t.includes(r.NETWORK_ERROR_PREFIX)?t:"ZIP asset request failed",i=(0,r.zipPeekErrorInfo)(e),o=e;return d(n,null!==(w=o.httpStatus)&&void 0!==w?w:500,[(0,r.zipErrorInfo)({path:P,zipPath:(0,s.zipPackagePathname)(y),cause:i?void 0:(0,r.errorMessage)(e)}),i].filter(Boolean).join(" "),null!==(m=o.zipPeekLevel)&&void 0!==m?m:"error",void 0!==o.upstreamStatus?{upstreamStatus:o.upstreamStatus}:void 0)}}(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),o=n(800),a=n(30),l=n(262),c=n(266),u=n(346),p=n(933),f=n(254);function d(e,t,n,s,i){return(0,c.reportClientError)((0,r.createZipPeekError)(e,s),n),{response:(0,f.corsErrorResponse)(e,t,i)}}function w(e){return{"Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":l.ASSET_SOURCE_HEADER,[l.ASSET_SOURCE_HEADER]:e}}function h(e,t,n,r,s){if(s){if(null===n)return null==e||e.cancel(),new Response(null,{status:416,headers:w(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}`},w(r))});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}`},w(r))});const u=Math.min(c,n-1),p=u-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:o,value:a}=await r.read();if(o)return i=!0,void e.close();const l=a,c=s,u=s+l.byteLength-1;if(s+=l.byteLength,u<t)continue;if(c>n)return i=!0,void e.close();const p=Math.max(0,t-c),f=Math.min(l.byteLength,n-c+1);if(f>p&&e.enqueue(l.subarray(p,f)),u>=n)return i=!0,void e.close()}},cancel:e=>r.cancel(e)})}(e,l,u);return new Response(f,{status:206,headers:Object.assign({"Content-Type":t,"Content-Range":`bytes ${l}-${u}/${n}`,"Content-Length":p.toString(),"Accept-Ranges":"bytes"},w(r))})}const i=Object.assign({"Content-Type":t},w(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,u.entryUncompressedSize)(n),i=e.headers.get("range");if(null!==s&&i)return h(null,r,s,"manifest",i);const o=Object.assign({"Content-Type":r},w("manifest"));return null!==s&&(o["Content-Length"]=s.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){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.withVersion=a,t.log=function(...e){console.log(i.runtimeConfig.logPrefix,o,...e)},t.warn=function(...e){console.warn(i.runtimeConfig.logPrefix,o,...e)},t.error=function(...e){console.error(i.runtimeConfig.logPrefix,o,r.ZIP_PEEK_ERROR_PREFIX,...e)},t.reportClientError=l,t.installClientErrorReporting=function(){self.addEventListener("error",e=>{var t;l(null!==(t=e.error)&&void 0!==t?t:e.message,"Service worker uncaught error")}),self.addEventListener("unhandledrejection",e=>{l(e.reason,"Service worker unhandled promise rejection")})};const r=n(553),s=n(348),i=n(262),o=`zipSW=${s.ZIP_PEEK_VERSION}`;function a(e){return e?e.includes("zipSW=")?e:`${e} ${o}`:o}function l(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:(0,r.formatZipPeekError)(a(t)),level:n.zipPeekLevel};for(const t of e)t.postMessage(s)})}},346(e,t,n){t.manifestFilesToMap=a,t.sendManifestToClientId=c,t.ensureManifestAvailable=function(e,t){const n=i.zipManifests.get(e);if(n)return Promise.resolve(n);let r=i.pendingManifestLoads.get(e);return r||(r=(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(a(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,o.warn)("failed to request manifest from client",e),n(null)}})}(n,e):null}(e,t);if(n)return i.zipManifests.set(e,n),(0,o.log)("restored manifest from client memory",{zipUrl:e,entryCount:n.size}),n;const r=await async function(e){const{response:t,buffer:n}=await f(e,"bytes=-65536","tail"),r=new DataView(n);let i=-1;for(let e=n.byteLength-22;e>=0;e--)if(101010256===r.getUint32(e,!0)){i=e;break}if(-1===i)throw p(e,"tail",{network:!1,reason:"no-eocd"});const a=r.getUint32(i+16,!0),l=r.getUint32(i+12,!0);let c=n,u=-1,d="tail";const w=t.headers.get("Content-Range");let h=0;if(w){const e=w.match(/\/(\d+)$/);e&&(h=parseInt(e[1],10))}if(h<=0)throw p(e,"tail",{network:!1,reason:"no-content-range"});const g=h-n.byteLength;a>=g?u=a-g:(d="cd",c=(await f(e,`bytes=${a}-${a+l-1}`,d)).buffer,u=0);const m=function(e,t,n,r){const i=new DataView(e);let a=t;const l=[];for(;a+46<=e.byteLength&&33639248===i.getUint32(a,!0);){const t=i.getUint16(a+10,!0),n=i.getUint32(a+20,!0),r=i.getUint32(a+24,!0),o=i.getUint16(a+28,!0),c=i.getUint16(a+30,!0),u=i.getUint16(a+32,!0),p=i.getUint32(a+42,!0),f=new TextDecoder;if(a+46+o>e.byteLength)break;const d=new Uint8Array(e,a+46,o),w=f.decode(d),h=(0,s.normalizeZipEntryPath)(w);""!==h&&l.push({filename:h,offset:p,compressedSize:n,uncompressedSize:r,compression:t}),a+=46+o+c+u}if(0===l.length)return(0,o.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,o.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,u,a,e);if(!m)throw p(e,d,{network:!1,reason:"empty-manifest"});return m}(e);return i.zipManifests.set(e,r),await c(e,r,t),(0,o.log)("manifest fetched and stored in memory",{zipUrl:e,entryCount:r.size}),r})().finally(()=>{i.pendingManifestLoads.delete(e)}),i.pendingManifestLoads.set(e,r),r)},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 r=n(553),s=n(343),i=n(262),o=n(266);function a(e){const t=new Map;for(const n of e){const e=(0,s.normalizeZipEntryPath)(n.filename);""!==e&&(t.has(e)&&(0,o.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,o.warn)("failed to send manifest to client",e)}}function u(e){return e instanceof Error?e.name&&"Error"!==e.name?`${e.name}: ${e.message}`:e.message:String(e)}function p(e,t,n){const i=(0,r.zipErrorInfo)({phase:t,zipPath:(0,s.zipPackagePathname)(e),online:navigator.onLine,status:n.status,reason:n.reason,cause:n.cause});(0,o.error)("ZIP manifest fetch failed",i);const a=(0,r.createZipPeekError)(n.network?`${r.NETWORK_ERROR_PREFIX} ZIP manifest fetch failed`:"ZIP manifest fetch failed",n.network?"warn":"error",i);return n.network?a.httpStatus=500:null!=n.status&&n.status>=400?(a.httpStatus=n.status,a.upstreamStatus=n.status):(a.httpStatus=502,null!=n.status&&(a.upstreamStatus=n.status)),a}async function f(e,t,n){let r;try{r=await fetch(e,{headers:{Range:t}})}catch(t){throw p(e,n,{network:!0,cause:u(t)})}if(206!==r.status)throw p(e,n,{network:!1,status:r.status});try{const e=await r.arrayBuffer();return{response:r,buffer:e}}catch(t){throw p(e,n,{network:!0,reason:"body",status:r.status,cause:u(t)})}}},993(e,t,n){t.installMessageHandler=function(){self.addEventListener("message",e=>{var t;if(!e.data)return;const{type:n,zipUrl:p,files:d,config:w,allowedZipUrls:h,previousUrl:g,nextUrl:m}=e.data,E=function(e){if(!e||!("id"in e))return;const t=e.id;return"string"==typeof t?t:void 0}(e.source);if("ZIP_SW_VERSION"!==n)if("ZIP_SW_CONFIG"!==n)if("ZIP_MANIFEST"===n){if(p&&d){const t=(0,i.normalizeZipUrl)(p),n=(0,u.manifestFilesToMap)(d),r=l.zipManifests.get(t);if(!n)return void(0,c.warn)("rejecting empty manifest; keeping existing",{zipUrl:t,existingSize:r?r.size:0});if(r&&r.size>n.size)return void(0,c.warn)("rejecting smaller manifest; keeping existing",{zipUrl:t,incomingSize:n.size,existingSize:r.size});l.zipManifests.set(t,n),e.waitUntil((0,u.sendManifestToClientId)(t,n,E));const s=Array.from(n.keys()).slice(0,40);(0,c.log)("ZIP_MANIFEST loaded",{zipUrl:t,entryCount:n.size,sampleKeys:s,replacedExistingSize:r?r.size:0})}}else"CLEAR_ZIP_ASSETS_EXCEPT_ALLOWED"===n?f(e,()=>(0,o.clearZipAssetsExceptLiveClaims)(a.clearZipAssetsExceptAllowed)):"CLEAR_ALL_ZIP_ASSETS"===n?f(e,()=>(0,a.clearAllZipAssets)()):"PRELOAD_ZIP_MANIFESTS"===n&&h?f(e,()=>async function(e,t){const n=[];if(await Promise.all(e.map(async e=>{try{await(0,u.ensureManifestAvailable)(e,t)}catch(e){n.push(e)}})),1===n.length)throw n[0];if(n.length>1){const e=n.map(e=>(0,r.toZipPeekError)(e));throw(0,r.createZipPeekError)("ZIP manifest fetch failed",e.every(e=>"warn"===e.zipPeekLevel)?"warn":"error",e.map(e=>{var t;return null!==(t=(0,r.zipPeekErrorInfo)(e))&&void 0!==t?t:e.message}).join(" | "))}}(h,E)):"RENEW_ZIP_URL"===n&&g&&m&&f(e,()=>(0,a.renewZipUrl)(g,m));else f(e,()=>(0,o.applyRuntimeConfig)(w,E));else null===(t=e.ports[0])||void 0===t||t.postMessage({ok:!0,version:s.ZIP_PEEK_VERSION})})};const r=n(553),s=n(348),i=n(343),o=n(314),a=n(800),l=n(262),c=n(266),u=n(346);function p(e,t){var n;null===(n=e.ports[0])||void 0===n||n.postMessage(t)}function f(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,info:(0,c.withVersion)((0,r.zipPeekErrorInfo)(t)),level:t.zipPeekLevel}}(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=o.get(n);if(s)return s;const a=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 o=!1;const a=e=>{o||(o=!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 a({ok:!1,reason:"page-rejected"});const n=(0,r.normalizeZipUrl)(t.nextUrl);(0,r.isPresignedUrlExpired)(n)?a({ok:!1,reason:"still-expired"}):a({ok:!0,nextUrl:n})},n.port1.onmessageerror=()=>{a({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),a({ok:!1,reason:"page-rejected"})}}):{ok:!1,reason:"no-window-client"}}(e,t).finally(()=>{o.delete(n)});return o.set(n,a),a};const r=n(343),s=n(262),i=n(266),o=new Map},254(e,t,n){t.corsErrorResponse=u,t.getMimeType=f,t.fetchUncompressedZipEntryFromNetwork=async function(e,t,n){var l;const c=n.offset,u=n.nextOffset-1,w=(0,i.zipPackagePathname)(e);let h;(0,a.log)("fetching zip chunk from",{zipUrl:e,rangeStart:c,rangeEnd:u});try{h=await fetch(e,{headers:{Range:`bytes=${c}-${u}`}})}catch(e){return p(`${s.NETWORK_ERROR_PREFIX} ZIP asset fetch failed`,500,(0,s.zipErrorInfo)({path:t,zipPath:w,cause:(0,s.errorMessage)(e)}),"warn")}if(206!==h.status)return p("ZIP origin fetch failed",h.status>=400?h.status:502,(0,s.zipErrorInfo)({path:t,zipPath:w,status:h.status}),"error",{upstreamStatus:h.status});if(!h.body)return p("ZIP origin fetch failed",502,(0,s.zipErrorInfo)({path:t,zipPath:w,reason:"empty-body"}),"error");const g=h.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)!==o.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),p("ZIP asset request failed",500,(0,s.zipErrorInfo)({path:t,zipPath:w,cause:(0,s.errorMessage)(e)}),"error")}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:o}=await e.read();if(r)return void t.error(new Error(`ZIP entry ended after ${s} of ${n} compressed bytes`));i=o}const o=n-s,a=i.byteLength>o?i.subarray(0,o):i;s+=a.byteLength,t.enqueue(a),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 P;if(8===n.compression)P=function(e,t){const n=e.getReader();let s,i=0,o=!1;return new ReadableStream({start(e){s=new r.Inflate(t=>{i+=t.byteLength,e.enqueue(t)})},async pull(e){for(;!o;){const{done:r,value:a}=await n.read();if(r)return o=!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(a)}},cancel:e=>n.cancel(e)})}(A,y);else{if(0!==n.compression)return await g.cancel(),p("ZIP asset request failed",500,(0,s.zipErrorInfo)({path:t,zipPath:w,reason:"unsupported-compression",method:n.compression}),"error");P=A}return{ok:!0,stream:P,contentLength:y,contentType:f(t)}};const r=n(612),s=n(553),i=n(343),o=n(262),a=n(266);function l(e){return e.replace(/[\r\n]+/g," ").trim()}function c(e,t){const n=[o.ASSET_ERROR_HEADER],r={"Access-Control-Allow-Origin":"*",[o.ASSET_ERROR_HEADER]:l(e)},s=null==t?void 0:t.upstreamStatus;return void 0!==s&&(r[o.ASSET_UPSTREAM_STATUS_HEADER]=String(s),n.push(o.ASSET_UPSTREAM_STATUS_HEADER)),r["Access-Control-Expose-Headers"]=n.join(", "),r}function u(e,t,n){const r=(0,s.formatZipPeekError)(e);return new Response(r,{status:t,headers:c(r,n)})}function p(e,t,n,r,i){return(0,a.reportClientError)((0,s.createZipPeekError)(e,r),n),{ok:!1,response:u(e,t,i)}}function f(e){var t,n;const r=null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase();return r&&null!==(n=o.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),o=-1===i?e.substring(s+1):e.substring(s+1,i),a=r?o.indexOf("/"):-1,l=-1===a?o:o.substring(0,a);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,o,a,l]=e,c=Date.UTC(Number(t),Number(n)-1,Number(i),Number(o),Number(a),Number(l)),u=Number(s);return!Number.isFinite(c)||!Number.isFinite(u)||u<=0?null:c+1e3*u}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 o=e.indexOf("#",i),a=e.substring(0,i),l=-1===o?e.substring(i+1):e.substring(i+1,o),c=r||-1===o?"":e.substring(o),u=l.split("&").filter(e=>{const t=e.indexOf("=");return"t"!==(-1===t?e:e.substring(0,t))});return 0===u.length?a+c:a+"?"+u.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("?"),o=-1===s?t:t.substring(0,s);return""===o?null:{zipUrl:i,internalPath:n(o)}}const o=e.substring(r),a=o.indexOf("/");if(-1===a)return null;const l=o.substring(0,a),c=o.substring(a+1),u=c.indexOf("?"),p=-1===u?c:c.substring(0,u);return""===p?null:{zipUrl:i+l,internalPath:n(p)}},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]),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 r(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var o=new s(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),u=c.b,p=c.r;u[28]=258,p[258]=28;for(var f=l(o,0),d=f.b,w=(f.r,new r(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 s=e.length,i=0,o=new r(t);i<s;++i)e[i]&&++o[e[i]-1];var a,l=new r(t);for(i=1;i<t;++i)l[i]=l[i-1]+o[i-1]<<1;if(n){a=new r(1<<t);var c=15-t;for(i=0;i<s;++i)if(e[i])for(var u=i<<4|e[i],p=t-e[i],f=l[e[i]-1]++<<p,d=f|(1<<p)-1;f<=d;++f)a[w[f]>>c]=u}else for(a=new r(s),i=0;i<s;++i)e[i]&&(a[i]=w[l[e[i]-1]++]>>15-e[i]);return a},E=new n(288);for(h=0;h<144;++h)E[h]=8;for(h=144;h<256;++h)E[h]=9;for(h=256;h<280;++h)E[h]=7;for(h=280;h<288;++h)E[h]=8;var A=new n(32);for(h=0;h<32;++h)A[h]=5;var y=m(E,9,1),P=m(A,5,1),U=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},v=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},z=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))},S=["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"],C=function(e,t,n){var r=new Error(t||S[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,C),!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 p=!r,f=p||2!=t.i,w=t.i;p&&(r=new n(3*l));var h=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,S=t.l,_=t.d,I=t.m,b=t.n,k=8*l;do{if(!S){g=R(e,E,1);var L=R(e,E+1,3);if(E+=3,!L){var M=e[($=Z(E)+4)-4]|e[$-3]<<8,T=$+M;if(T>l){w&&C(0);break}f&&h(A+M),r.set(e.subarray($,T),A),t.b=A+=M,t.p=E=8*T,t.f=g;continue}if(1==L)S=y,_=P,I=9,b=5;else if(2==L){var x=R(e,E,31)+257,F=R(e,E+10,15)+4,O=x+R(e,E+5,31)+1;E+=14;for(var N=new n(O),H=new n(19),q=0;q<F;++q)H[a[q]]=R(e,E+3*q,7);E+=3*F;var D=U(H),W=(1<<D)-1,j=m(H,D,1);for(q=0;q<O;){var $,K=j[R(e,E,W)];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 V=N.subarray(0,x),B=N.subarray(x);I=U(V),b=U(B),S=m(V,I,1),_=m(B,b,1)}else C(1);if(E>k){w&&C(0);break}}f&&h(A+131072);for(var Y=(1<<I)-1,Q=(1<<b)-1,J=E;;J=E){var ee=(X=S[v(e,E)&Y])>>4;if((E+=15&X)>k){w&&C(0);break}if(X||C(2),ee<256)r[A++]=ee;else{if(256==ee){J=E,S=null;break}var te=ee-254;if(ee>264){var ne=i[q=ee-257];te=R(e,E,(1<<ne)-1)+u[q],E+=ne}var re=_[v(e,E)&Q],se=re>>4;if(re||C(3),E+=15&re,B=d[se],se>3&&(ne=o[se],B+=v(e,E)&(1<<ne)-1,E+=ne),E>k){w&&C(0);break}f&&h(A+131072);var ie=A+te;if(A<B){var oe=c-B,ae=Math.min(B,ie);for(oe+A<0&&C(3);A<ae;++A)r[A]=s[oe+A]}for(;A<ie;++A)r[A]=r[A-B]}}t.l=S,t.p=J,t.b=A,t.f=g,S&&(g=1,t.m=I,t.d=_,t.n=b)}while(!g);return A!=r.length&&p?z(r,0,A):r.subarray(0,A)},I=new n(0);var b=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||C(5),this.d&&C(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(z(n,t,this.s.b),this.d),this.o=z(n,this.s.b-32768),this.s.b=this.o.length,this.p=z(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=b;var k="undefined"!=typeof TextDecoder&&new TextDecoder;try{k.decode(I,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout},330(e){e.exports={version:"0.7.3"}}};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
|