linkque-cli-v2 1.4.6 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/linkquejs.js CHANGED
@@ -13060,7 +13060,37 @@ function initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength) {
13060
13060
  ready: new Promise((resolve2) => aesCrypto.resolveReady = resolve2),
13061
13061
  password: encodePassword(password, rawPassword),
13062
13062
  strength: encryptionStrength - 1,
13063
- pendingInput: EMPTY_UINT8_ARRAY
13063
+ pendingInput: EMPTY_UINT8_ARRAY,
13064
+ discarded: false
13065
+ });
13066
+ }
13067
+ function setDisposingReadable(stream, aesCrypto) {
13068
+ const reader = stream.readable.getReader();
13069
+ const readable = new ReadableStream({
13070
+ async pull(controller) {
13071
+ try {
13072
+ const { value, done } = await reader.read();
13073
+ if (done) {
13074
+ controller.close();
13075
+ } else {
13076
+ controller.enqueue(value);
13077
+ }
13078
+ } catch (error2) {
13079
+ disposeEngine(aesCrypto);
13080
+ reader.cancel(error2).catch(() => {
13081
+ });
13082
+ throw error2;
13083
+ }
13084
+ },
13085
+ cancel(reason) {
13086
+ disposeEngine(aesCrypto);
13087
+ return reader.cancel(reason);
13088
+ }
13089
+ });
13090
+ Object.defineProperty(stream, "readable", {
13091
+ get() {
13092
+ return readable;
13093
+ }
13064
13094
  });
13065
13095
  }
13066
13096
  function append(aesCrypto, input, output, paddingStart, paddingEnd, decrypt2) {
@@ -13090,7 +13120,9 @@ async function createDecryptionKeys(decrypt2, strength, password, preamble) {
13090
13120
  throw new Error(ERR_INVALID_PASSWORD);
13091
13121
  }
13092
13122
  }
13093
- function disposeEngine({ engine }) {
13123
+ function disposeEngine(aesCrypto) {
13124
+ const { engine } = aesCrypto;
13125
+ aesCrypto.discarded = true;
13094
13126
  if (engine && engine.dispose) {
13095
13127
  engine.dispose();
13096
13128
  }
@@ -13105,6 +13137,9 @@ async function createKeys(aesCrypto, strength, password, salt) {
13105
13137
  const keyLength = KEY_LENGTH[strength];
13106
13138
  const compositeKey = await deriveKey(password, salt, keyLength * 2 + PASSWORD_VERIFICATION_LENGTH);
13107
13139
  aesCrypto.engine = createEngine2(subarray(compositeKey, 0, keyLength), subarray(compositeKey, keyLength, keyLength * 2));
13140
+ if (aesCrypto.discarded) {
13141
+ disposeEngine(aesCrypto);
13142
+ }
13108
13143
  return subarray(compositeKey, keyLength * 2);
13109
13144
  }
13110
13145
  async function deriveKey(password, salt, length) {
@@ -13164,12 +13199,12 @@ var init_aes_crypto_stream = __esm({
13164
13199
  createEngine2 = createEngine;
13165
13200
  AESDecryptionStream = class extends TransformStream {
13166
13201
  constructor({ password, rawPassword, encryptionStrength, checkPasswordOnly, checkAuthenticationCode = true }) {
13202
+ const aesCrypto = {};
13167
13203
  super({
13168
13204
  start() {
13169
- initAesCrypto(this, password, rawPassword, encryptionStrength);
13205
+ initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength);
13170
13206
  },
13171
13207
  async transform(chunk, controller) {
13172
- const aesCrypto = this;
13173
13208
  const {
13174
13209
  password: password2,
13175
13210
  strength,
@@ -13188,6 +13223,9 @@ var init_aes_crypto_stream = __esm({
13188
13223
  } else {
13189
13224
  await ready;
13190
13225
  }
13226
+ if (aesCrypto.discarded) {
13227
+ return;
13228
+ }
13191
13229
  const output = new Uint8Array(chunk.length - AUTHENTICATION_CODE_LENGTH - (chunk.length - AUTHENTICATION_CODE_LENGTH) % BLOCK_LENGTH2);
13192
13230
  controller.enqueue(append(aesCrypto, chunk, output, 0, AUTHENTICATION_CODE_LENGTH, true));
13193
13231
  },
@@ -13196,9 +13234,12 @@ var init_aes_crypto_stream = __esm({
13196
13234
  engine,
13197
13235
  pendingInput,
13198
13236
  ready
13199
- } = this;
13237
+ } = aesCrypto;
13200
13238
  if (engine) {
13201
13239
  await ready;
13240
+ if (aesCrypto.discarded) {
13241
+ return;
13242
+ }
13202
13243
  const originalAuthenticationCode = subarray(pendingInput, pendingInput.length - AUTHENTICATION_CODE_LENGTH);
13203
13244
  const decryptedChunkArray = new Uint8Array(subarray(pendingInput, 0, pendingInput.length - AUTHENTICATION_CODE_LENGTH));
13204
13245
  engine.process(decryptedChunkArray, true);
@@ -13208,25 +13249,24 @@ var init_aes_crypto_stream = __esm({
13208
13249
  invalidAuthenticationCode |= authenticationCode[indexByte] ^ originalAuthenticationCode[indexByte];
13209
13250
  }
13210
13251
  if (invalidAuthenticationCode && checkAuthenticationCode) {
13211
- throw new Error(ERR_INVALID_AUTHENTICATION_CODE);
13252
+ controller.error(new Error(ERR_INVALID_AUTHENTICATION_CODE));
13253
+ return;
13212
13254
  }
13213
13255
  controller.enqueue(decryptedChunkArray);
13214
13256
  }
13215
- },
13216
- cancel() {
13217
- disposeEngine(this);
13218
13257
  }
13219
13258
  });
13259
+ setDisposingReadable(this, aesCrypto);
13220
13260
  }
13221
13261
  };
13222
13262
  AESEncryptionStream = class extends TransformStream {
13223
13263
  constructor({ password, rawPassword, encryptionStrength }) {
13264
+ const aesCrypto = {};
13224
13265
  super({
13225
13266
  start() {
13226
- initAesCrypto(this, password, rawPassword, encryptionStrength);
13267
+ initAesCrypto(aesCrypto, password, rawPassword, encryptionStrength);
13227
13268
  },
13228
13269
  async transform(chunk, controller) {
13229
- const aesCrypto = this;
13230
13270
  const {
13231
13271
  password: password2,
13232
13272
  strength,
@@ -13240,6 +13280,9 @@ var init_aes_crypto_stream = __esm({
13240
13280
  } else {
13241
13281
  await ready;
13242
13282
  }
13283
+ if (aesCrypto.discarded) {
13284
+ return;
13285
+ }
13243
13286
  const output = new Uint8Array(preamble.length + chunk.length - chunk.length % BLOCK_LENGTH2);
13244
13287
  output.set(preamble, 0);
13245
13288
  controller.enqueue(append(aesCrypto, chunk, output, preamble.length, 0, false));
@@ -13249,19 +13292,20 @@ var init_aes_crypto_stream = __esm({
13249
13292
  engine,
13250
13293
  pendingInput,
13251
13294
  ready
13252
- } = this;
13295
+ } = aesCrypto;
13253
13296
  if (engine) {
13254
13297
  await ready;
13298
+ if (aesCrypto.discarded) {
13299
+ return;
13300
+ }
13255
13301
  const encryptedChunkArray = new Uint8Array(pendingInput);
13256
13302
  engine.process(encryptedChunkArray, false);
13257
13303
  const authenticationCode = subarray(engine.digest(), 0, AUTHENTICATION_CODE_LENGTH);
13258
13304
  controller.enqueue(concat(encryptedChunkArray, authenticationCode));
13259
13305
  }
13260
- },
13261
- cancel() {
13262
- disposeEngine(this);
13263
13306
  }
13264
13307
  });
13308
+ setDisposingReadable(this, aesCrypto);
13265
13309
  }
13266
13310
  };
13267
13311
  }
@@ -13293,11 +13337,11 @@ function encrypt(target, input) {
13293
13337
  return output;
13294
13338
  }
13295
13339
  function createKeys2(target, password, rawPassword) {
13296
- const keys = [305419896, 591751049, 878082192];
13340
+ const cryptoKeys = [305419896, 591751049, 878082192];
13297
13341
  Object.assign(target, {
13298
- keys,
13299
- crcKey0: new Crc32(keys[0]),
13300
- crcKey2: new Crc32(keys[2])
13342
+ cryptoKeys,
13343
+ crcKey0: new Crc32(cryptoKeys[0]),
13344
+ crcKey2: new Crc32(cryptoKeys[2])
13301
13345
  });
13302
13346
  if (rawPassword) {
13303
13347
  for (let index = 0; index < rawPassword.length; index++) {
@@ -13310,16 +13354,16 @@ function createKeys2(target, password, rawPassword) {
13310
13354
  }
13311
13355
  }
13312
13356
  function updateKeys(target, byte) {
13313
- let [, key1] = target.keys;
13357
+ let [, key1] = target.cryptoKeys;
13314
13358
  target.crcKey0.append([byte]);
13315
13359
  const key0 = ~target.crcKey0.get();
13316
13360
  key1 = getInt32(Math.imul(getInt32(key1 + getInt8(key0)), 134775813) + 1);
13317
13361
  target.crcKey2.append([key1 >>> 24]);
13318
13362
  const key2 = ~target.crcKey2.get();
13319
- target.keys = [key0, key1, key2];
13363
+ target.cryptoKeys = [key0, key1, key2];
13320
13364
  }
13321
13365
  function getByte(target) {
13322
- const temp = target.keys[2] | 2;
13366
+ const temp = target.cryptoKeys[2] | 2;
13323
13367
  return getInt8(Math.imul(temp, temp ^ 1) >>> 8);
13324
13368
  }
13325
13369
  function getInt8(number4) {
@@ -13397,11 +13441,17 @@ function toCompatibleReadable(readable) {
13397
13441
  const reader = readable.getReader();
13398
13442
  return new ReadableStream({
13399
13443
  async pull(controller) {
13400
- const { value, done } = await reader.read();
13401
- if (done) {
13402
- controller.close();
13403
- } else {
13404
- controller.enqueue(value);
13444
+ try {
13445
+ const { value, done } = await reader.read();
13446
+ if (done) {
13447
+ controller.close();
13448
+ } else {
13449
+ controller.enqueue(value);
13450
+ }
13451
+ } catch (error2) {
13452
+ reader.cancel(error2).catch(() => {
13453
+ });
13454
+ throw error2;
13405
13455
  }
13406
13456
  },
13407
13457
  cancel(reason) {
@@ -13483,71 +13533,117 @@ var init_codec_registry = __esm({
13483
13533
  });
13484
13534
 
13485
13535
  // ../../node_modules/@zip.js/zip.js/lib/core/streams/zip-entry-stream.js
13486
- function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32) {
13536
+ function pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32, sourceErrors) {
13537
+ const writer = gzipStream.writable.getWriter();
13538
+ const reader = gzipStream.readable.getReader();
13539
+ const outputCrc32 = crc32 === UNDEFINED_VALUE ? new Crc32() : UNDEFINED_VALUE;
13487
13540
  let outputLength = 0;
13488
- let inputDone = false;
13489
- let watchdogTimeout;
13490
- let resolveTrailerReady, rejectTrailerReady;
13491
- const trailerReady = new Promise((resolve2, reject) => {
13492
- resolveTrailerReady = resolve2;
13493
- rejectTrailerReady = reject;
13494
- });
13495
- trailerReady.catch(() => {
13541
+ let trailerWritten = false;
13542
+ let settled = false;
13543
+ let resolvePull, controller;
13544
+ const output = new ReadableStream({
13545
+ start(streamController) {
13546
+ controller = streamController;
13547
+ },
13548
+ pull() {
13549
+ resumePump();
13550
+ },
13551
+ cancel(reason) {
13552
+ settled = true;
13553
+ resumePump();
13554
+ return reader.cancel(reason);
13555
+ }
13496
13556
  });
13497
- if (!outputSize) {
13498
- resolveTrailerReady();
13499
- }
13500
- const gzipWrapStream = new TransformStream({
13501
- start(controller) {
13557
+ pump();
13558
+ drain();
13559
+ return output;
13560
+ async function pump() {
13561
+ const inputReader = readable.getReader();
13562
+ try {
13502
13563
  const header = new Uint8Array(GZIP_HEADER_LENGTH);
13503
13564
  header.set(GZIP_HEADER_BYTES);
13504
- controller.enqueue(header);
13505
- },
13506
- transform(chunk, controller) {
13507
- controller.enqueue(chunk);
13508
- },
13509
- async flush(controller) {
13510
- inputDone = true;
13511
- startWatchdog();
13512
- try {
13513
- await trailerReady;
13514
- } finally {
13515
- stopWatchdog();
13565
+ await writer.write(header);
13566
+ for (; ; ) {
13567
+ await outputCapacity();
13568
+ await writer.ready;
13569
+ const { value, done } = await readSource(inputReader, sourceErrors);
13570
+ if (done) {
13571
+ break;
13572
+ }
13573
+ await writer.write(value);
13574
+ }
13575
+ if (outputCrc32) {
13576
+ await writer.write(new Uint8Array(0));
13516
13577
  }
13517
13578
  const trailer = new Uint8Array(GZIP_TRAILER_LENGTH);
13518
13579
  const dataView = getDataView(trailer);
13519
- dataView.setUint32(0, crc32.get(), true);
13580
+ dataView.setUint32(0, outputCrc32 ? outputCrc32.get() : crc32, true);
13520
13581
  dataView.setUint32(4, outputSize, true);
13521
- controller.enqueue(trailer);
13522
- },
13523
- cancel(reason) {
13524
- rejectTrailerReady(reason);
13582
+ trailerWritten = true;
13583
+ await writer.write(trailer);
13584
+ await writer.close();
13585
+ } catch (error2) {
13586
+ await abort(writer, error2);
13587
+ await cancel(inputReader, error2);
13525
13588
  }
13526
- });
13527
- const outputStream = new TransformStream({
13528
- transform(chunk, controller) {
13529
- crc32.append(chunk);
13530
- outputLength += chunk.length;
13531
- if (outputLength >= outputSize) {
13532
- resolveTrailerReady();
13533
- } else if (inputDone) {
13534
- startWatchdog();
13589
+ }
13590
+ async function drain() {
13591
+ try {
13592
+ for (; ; ) {
13593
+ const { value, done } = await read();
13594
+ if (done) {
13595
+ break;
13596
+ }
13597
+ outputLength += value.length;
13598
+ if (outputLength > outputSize) {
13599
+ throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
13600
+ }
13601
+ if (outputCrc32) {
13602
+ outputCrc32.append(value);
13603
+ }
13604
+ controller.enqueue(value);
13535
13605
  }
13536
- controller.enqueue(chunk);
13537
- },
13538
- cancel(reason) {
13539
- rejectTrailerReady(reason);
13606
+ if (!settled) {
13607
+ settled = true;
13608
+ controller.close();
13609
+ }
13610
+ } catch (error2) {
13611
+ fail(error2);
13612
+ await cancel(reader, error2);
13613
+ }
13614
+ }
13615
+ function read() {
13616
+ return reader.read().catch((error2) => {
13617
+ if (trailerWritten) {
13618
+ if (!outputCrc32) {
13619
+ throw mapError(error2, ERR_INVALID_CRC32);
13620
+ }
13621
+ if (outputLength != outputSize) {
13622
+ throw mapError(error2, ERR_INVALID_UNCOMPRESSED_SIZE);
13623
+ }
13624
+ return { done: true };
13625
+ }
13626
+ throw mapCodecError(error2, sourceErrors);
13627
+ });
13628
+ }
13629
+ function outputCapacity() {
13630
+ if (!settled && controller.desiredSize <= 0) {
13631
+ return new Promise((resolve2) => resolvePull = resolve2);
13632
+ }
13633
+ }
13634
+ function resumePump() {
13635
+ if (resolvePull) {
13636
+ const resolve2 = resolvePull;
13637
+ resolvePull = UNDEFINED_VALUE;
13638
+ resolve2();
13540
13639
  }
13541
- });
13542
- readable = pipeThrough(readable, gzipWrapStream);
13543
- readable = pipeThroughBackpressured(readable, gzipStream);
13544
- return pipeThrough(readable, outputStream);
13545
- function startWatchdog() {
13546
- stopWatchdog();
13547
- watchdogTimeout = setTimeout(() => rejectTrailerReady(new Error(ERR_INVALID_UNCOMPRESSED_SIZE)), GZIP_OUTPUT_STALL_TIMEOUT);
13548
13640
  }
13549
- function stopWatchdog() {
13550
- clearTimeout(watchdogTimeout);
13641
+ function fail(error2) {
13642
+ if (!settled) {
13643
+ settled = true;
13644
+ controller.error(error2);
13645
+ resumePump();
13646
+ }
13551
13647
  }
13552
13648
  }
13553
13649
  function supportsFormat(StreamClass, format) {
@@ -13591,14 +13687,14 @@ function createCodecStream(CodecStreamClass, format, options) {
13591
13687
  }
13592
13688
  return new CodecStreamClass(format, options);
13593
13689
  }
13594
- function getGzipCompressionStream(useCompressionStream, CompressionStreamNative, CompressionStreamFallback) {
13595
- if (useCompressionStream && CompressionStreamNative) {
13596
- return CompressionStreamNative;
13597
- } else if (CompressionStreamFallback && CompressionStreamFallback.requiresModule) {
13598
- return CompressionStreamFallback;
13690
+ function getGzipCodecStream(useCompressionStream, CodecStreamNative, CodecStreamFallback) {
13691
+ if (useCompressionStream && CodecStreamNative) {
13692
+ return CodecStreamNative;
13693
+ } else if (CodecStreamFallback && CodecStreamFallback.requiresModule) {
13694
+ return CodecStreamFallback;
13599
13695
  }
13600
13696
  }
13601
- function pipeThroughCompressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamFallback) {
13697
+ function pipeThroughCompressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamFallback, sourceErrors) {
13602
13698
  const Stream2 = useCompressionStream && CompressionStreamNative ? CompressionStreamNative : CompressionStreamFallback || CompressionStreamNative;
13603
13699
  const format = options.deflate64 ? FORMAT_DEFLATE64_RAW : FORMAT_DEFLATE_RAW;
13604
13700
  let codecStream;
@@ -13611,12 +13707,12 @@ function pipeThroughCompressionStream(readable, useCompressionStream, options, C
13611
13707
  throw error2;
13612
13708
  }
13613
13709
  }
13614
- return pipeThroughBackpressured(readable, codecStream);
13710
+ return pipeThroughBackpressured(readable, codecStream, sourceErrors);
13615
13711
  }
13616
13712
  function pipeThrough(readable, transformStream) {
13617
13713
  return toCompatibleReadable(readable).pipeThrough(transformStream);
13618
13714
  }
13619
- function pipeThroughBackpressured(readable, transformStream) {
13715
+ function pipeThroughBackpressured(readable, transformStream, sourceErrors) {
13620
13716
  const writer = transformStream.writable.getWriter();
13621
13717
  const reader = readable.getReader();
13622
13718
  pump();
@@ -13625,7 +13721,7 @@ function pipeThroughBackpressured(readable, transformStream) {
13625
13721
  try {
13626
13722
  for (; ; ) {
13627
13723
  await writer.ready;
13628
- const result = await reader.read();
13724
+ const result = await readSource(reader, sourceErrors);
13629
13725
  if (result.done) {
13630
13726
  await writer.close();
13631
13727
  break;
@@ -13650,26 +13746,44 @@ async function cancel(reader, error2) {
13650
13746
  } catch {
13651
13747
  }
13652
13748
  }
13653
- function mapInflateStreamError(readable) {
13749
+ function readSource(reader, sourceErrors) {
13750
+ const result = reader.read();
13751
+ return sourceErrors ? result.catch((error2) => {
13752
+ sourceErrors.add(error2);
13753
+ throw error2;
13754
+ }) : result;
13755
+ }
13756
+ function mapCodecError(error2, sourceErrors) {
13757
+ if (sourceErrors.has(error2)) {
13758
+ return error2;
13759
+ }
13760
+ return mapError(error2, isMemoryError(error2) ? ERR_CODEC_OUT_OF_MEMORY : ERR_INVALID_COMPRESSED_DATA);
13761
+ }
13762
+ function mapMemoryError(error2) {
13763
+ return isMemoryError(error2) ? mapError(error2, ERR_CODEC_OUT_OF_MEMORY) : error2;
13764
+ }
13765
+ function isMemoryError(error2) {
13766
+ return isErrorObject(error2) && error2.code == Z_MEM_ERROR_CODE;
13767
+ }
13768
+ function mapError(error2, message) {
13769
+ const mappedError = new Error(message);
13770
+ mappedError.cause = error2;
13771
+ return mappedError;
13772
+ }
13773
+ function mapInflateStreamError(readable, sourceErrors) {
13654
13774
  const reader = readable.getReader();
13655
13775
  return new ReadableStream({
13656
13776
  async pull(controller) {
13657
- let result;
13658
13777
  try {
13659
- result = await reader.read();
13660
- } catch (error2) {
13661
- if (error2 && error2.message) {
13662
- throw error2;
13778
+ const { value, done } = await reader.read();
13779
+ if (done) {
13780
+ controller.close();
13781
+ } else {
13782
+ controller.enqueue(value);
13663
13783
  }
13664
- const mappedError = new Error(ERR_INVALID_COMPRESSED_DATA);
13665
- mappedError.cause = error2;
13666
- throw mappedError;
13667
- }
13668
- const { value, done } = result;
13669
- if (done) {
13670
- controller.close();
13671
- } else {
13672
- controller.enqueue(value);
13784
+ } catch (error2) {
13785
+ await cancel(reader, error2);
13786
+ throw mapCodecError(error2, sourceErrors);
13673
13787
  }
13674
13788
  },
13675
13789
  cancel(reason) {
@@ -13677,7 +13791,7 @@ function mapInflateStreamError(readable) {
13677
13791
  }
13678
13792
  });
13679
13793
  }
13680
- var ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_COMPRESSED_DATA, ERR_INVALID_CRC32, FORMAT_DEFLATE_RAW, FORMAT_DEFLATE64_RAW, FORMAT_GZIP, GZIP_HEADER_LENGTH, GZIP_TRAILER_LENGTH, GZIP_HEADER_BYTES, GZIP_OUTPUT_STALL_TIMEOUT, DeflateStream, GzipToRawDeflateStream, InflateStream, formatSupportByStream;
13794
+ var ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_COMPRESSED_DATA, ERR_CODEC_OUT_OF_MEMORY, ERR_INVALID_CRC32, Z_MEM_ERROR_CODE, FORMAT_DEFLATE_RAW, FORMAT_DEFLATE64_RAW, FORMAT_GZIP, GZIP_HEADER_LENGTH, GZIP_TRAILER_LENGTH, GZIP_HEADER_BYTES, DeflateStream, GzipToRawDeflateStream, InflateStream, formatSupportByStream;
13681
13795
  var init_zip_entry_stream = __esm({
13682
13796
  "../../node_modules/@zip.js/zip.js/lib/core/streams/zip-entry-stream.js"() {
13683
13797
  init_crc32();
@@ -13688,17 +13802,19 @@ var init_zip_entry_stream = __esm({
13688
13802
  init_constants();
13689
13803
  init_array();
13690
13804
  init_compatible_streams();
13805
+ init_error();
13691
13806
  init_codec_registry();
13692
13807
  ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
13693
13808
  ERR_INVALID_COMPRESSED_DATA = "Invalid compressed data";
13809
+ ERR_CODEC_OUT_OF_MEMORY = "Codec out of memory";
13694
13810
  ERR_INVALID_CRC32 = "Invalid CRC32";
13811
+ Z_MEM_ERROR_CODE = "Z_MEM_ERROR";
13695
13812
  FORMAT_DEFLATE_RAW = "deflate-raw";
13696
13813
  FORMAT_DEFLATE64_RAW = "deflate64-raw";
13697
13814
  FORMAT_GZIP = "gzip";
13698
13815
  GZIP_HEADER_LENGTH = 10;
13699
13816
  GZIP_TRAILER_LENGTH = 8;
13700
13817
  GZIP_HEADER_BYTES = [31, 139, 8];
13701
- GZIP_OUTPUT_STALL_TIMEOUT = 5e3;
13702
13818
  DeflateStream = class extends TransformStream {
13703
13819
  constructor(options, { chunkSize, CompressionStreamFallback, CompressionStream: CompressionStream2 }) {
13704
13820
  super({});
@@ -13707,7 +13823,7 @@ var init_zip_entry_stream = __esm({
13707
13823
  let crc32Stream, encryptionStream, gzipCrc32Stream;
13708
13824
  let readable = super.readable;
13709
13825
  const codecStreams2 = format && getCodecStreams(format);
13710
- const GzipCompressionStream = getGzipCompressionStream(useCompressionStream, CompressionStream2, CompressionStreamFallback);
13826
+ const GzipCompressionStream = getGzipCodecStream(useCompressionStream, CompressionStream2, CompressionStreamFallback);
13711
13827
  const useGzipCrc32 = computeCrc32 && compressed && !deflate64 && !codecStreams2 && (!encrypted || zipCrypto) && Boolean(GzipCompressionStream);
13712
13828
  if ((!encrypted || zipCrypto) && computeCrc32 && !useGzipCrc32) {
13713
13829
  crc32Stream = new Crc32Stream();
@@ -13724,11 +13840,14 @@ var init_zip_entry_stream = __esm({
13724
13840
  try {
13725
13841
  readable = pipeThroughCompressionStream(readable, useCompressionStream, { level, chunkSize }, CompressionStream2, CompressionStreamFallback);
13726
13842
  } catch (error2) {
13843
+ if (!useCompressionStream && CompressionStreamFallback) {
13844
+ throw mapMemoryError(error2);
13845
+ }
13727
13846
  let gzipStream;
13728
13847
  try {
13729
13848
  gzipStream = new CompressionStream2(FORMAT_GZIP);
13730
13849
  } catch {
13731
- throw error2;
13850
+ throw mapMemoryError(error2);
13732
13851
  }
13733
13852
  readable = pipeThroughBackpressured(readable, gzipStream);
13734
13853
  readable = pipeThrough(readable, new GzipToRawDeflateStream());
@@ -13805,35 +13924,49 @@ var init_zip_entry_stream = __esm({
13805
13924
  }
13806
13925
  }
13807
13926
  if (compressed) {
13927
+ const sourceErrors = /* @__PURE__ */ new Set();
13808
13928
  const codecStreams2 = format && getCodecStreams(format);
13929
+ let gzipStream;
13809
13930
  if (codecStreams2) {
13810
- readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams2.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }));
13931
+ readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams2.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }), sourceErrors);
13811
13932
  } else {
13812
- try {
13813
- readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream2, DecompressionStreamFallback);
13814
- } catch (error2) {
13815
- if (deflate64 || outputSize === UNDEFINED_VALUE) {
13816
- throw error2;
13817
- }
13818
- let gzipStream;
13933
+ const GzipDecompressionStream = getGzipCodecStream(useCompressionStream, DecompressionStream2, DecompressionStreamFallback);
13934
+ if (checkCrc32 && !deflate64 && crc32 !== UNDEFINED_VALUE && outputSize !== UNDEFINED_VALUE && GzipDecompressionStream) {
13819
13935
  try {
13820
- gzipStream = new DecompressionStream2(FORMAT_GZIP);
13936
+ gzipStream = new GzipDecompressionStream(FORMAT_GZIP, { chunkSize });
13821
13937
  } catch {
13822
- throw error2;
13938
+ gzipStream = UNDEFINED_VALUE;
13939
+ }
13940
+ }
13941
+ if (!gzipStream) {
13942
+ try {
13943
+ readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream2, DecompressionStreamFallback, sourceErrors);
13944
+ } catch (error2) {
13945
+ if (deflate64 || outputSize === UNDEFINED_VALUE || !useCompressionStream && DecompressionStreamFallback) {
13946
+ throw mapMemoryError(error2);
13947
+ }
13948
+ try {
13949
+ gzipStream = new DecompressionStream2(FORMAT_GZIP);
13950
+ } catch {
13951
+ throw mapMemoryError(error2);
13952
+ }
13823
13953
  }
13824
- gzipCrc32 = new Crc32();
13825
- readable = pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, gzipCrc32);
13826
13954
  }
13827
13955
  }
13828
- readable = mapInflateStreamError(readable);
13956
+ if (gzipStream) {
13957
+ gzipCrc32 = true;
13958
+ readable = pipeThroughGzipDecompressionStream(readable, gzipStream, outputSize, crc32, sourceErrors);
13959
+ } else {
13960
+ readable = mapInflateStreamError(readable, sourceErrors);
13961
+ }
13829
13962
  }
13830
13963
  if (checkCrc32 && !gzipCrc32) {
13831
13964
  crc32Stream = new Crc32Stream();
13832
13965
  readable = pipeThrough(readable, crc32Stream);
13833
13966
  }
13834
13967
  setReadable(this, readable, () => {
13835
- if (checkCrc32) {
13836
- const computedCrc32 = gzipCrc32 ? gzipCrc32.get() >>> 0 : new DataView(crc32Stream.value.buffer).getUint32(0, false);
13968
+ if (crc32Stream) {
13969
+ const computedCrc32 = new DataView(crc32Stream.value.buffer).getUint32(0, false);
13837
13970
  if (crc32 != computedCrc32) {
13838
13971
  throw new Error(ERR_INVALID_CRC32);
13839
13972
  }
@@ -14041,7 +14174,8 @@ async function runWorker({ options, readable, writable, onTaskFinished, workerOp
14041
14174
  }
14042
14175
  codecStream = new CodecStream(options, config3);
14043
14176
  chunkStream = new ChunkStream(getChunkSize(config3));
14044
- await readable.pipeThrough(codecStream).pipeThrough(chunkStream).pipeTo(writable, { preventClose: true, preventAbort: true });
14177
+ const { signal } = workerOptions.streamOptions;
14178
+ await readable.pipeThrough(codecStream).pipeThrough(chunkStream).pipeTo(writable, { preventClose: true, preventAbort: true, signal });
14045
14179
  const {
14046
14180
  crc32,
14047
14181
  inputSize,
@@ -14901,6 +15035,7 @@ __export(zip_reader_exports, {
14901
15035
  ERR_AMBIGUOUS_ARCHIVE: () => ERR_AMBIGUOUS_ARCHIVE,
14902
15036
  ERR_BAD_FORMAT: () => ERR_BAD_FORMAT,
14903
15037
  ERR_CENTRAL_DIRECTORY_NOT_FOUND: () => ERR_CENTRAL_DIRECTORY_NOT_FOUND,
15038
+ ERR_CODEC_OUT_OF_MEMORY: () => ERR_CODEC_OUT_OF_MEMORY,
14904
15039
  ERR_ENCRYPTED: () => ERR_ENCRYPTED,
14905
15040
  ERR_ENCRYPTED_CENTRAL_DIRECTORY: () => ERR_ENCRYPTED_CENTRAL_DIRECTORY,
14906
15041
  ERR_ENTRY_DATA_OUT_OF_BOUNDS: () => ERR_ENTRY_DATA_OUT_OF_BOUNDS,
@@ -15536,7 +15671,7 @@ function getMaxAppendedDataSize(maxAppendedDataSize, strictness) {
15536
15671
  async function findEndOfCentralDirectory(reader, rejectAmbiguous, maxAppendedDataSize) {
15537
15672
  const { size } = reader;
15538
15673
  const anchoredLength = Math.min(size, END_OF_CENTRAL_DIR_LENGTH + MAX_16_BITS);
15539
- const remoteProbeBudget = { count: MAX_END_OF_CENTRAL_DIR_PROBES };
15674
+ const remoteProbeBudget = { remaining: MAX_END_OF_CENTRAL_DIR_PROBES };
15540
15675
  let endOfDirectoryInfo;
15541
15676
  let plausibleEndOfDirectoryInfo;
15542
15677
  let endOfDirectoryReachingEndCount = 0;
@@ -15623,8 +15758,8 @@ async function readSignature(reader, view, anchoredOffset, signatureOffset, size
15623
15758
  if (signatureOffset >= anchoredOffset) {
15624
15759
  return getUint32(view, signatureOffset - anchoredOffset);
15625
15760
  }
15626
- if (remoteProbeBudget.count > 0) {
15627
- remoteProbeBudget.count--;
15761
+ if (remoteProbeBudget.remaining > 0) {
15762
+ remoteProbeBudget.remaining--;
15628
15763
  const signatureArray = await readUint8Array(reader, signatureOffset, 4);
15629
15764
  return getUint32(getDataView(signatureArray), 0);
15630
15765
  }
@@ -16260,8 +16395,8 @@ var init_zip_reader = __esm({
16260
16395
  const passThroughCompression = Boolean(passThrough);
16261
16396
  const passThroughEncryption = passThrough === true;
16262
16397
  checkPasswordOption(password, rawPassword);
16263
- password = password && password.length && password;
16264
- rawPassword = rawPassword && rawPassword.length && rawPassword;
16398
+ password = password && password.length ? password : UNDEFINED_VALUE;
16399
+ rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
16265
16400
  if (extraFieldAES) {
16266
16401
  if (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) {
16267
16402
  throw new Error(ERR_UNSUPPORTED_COMPRESSION);
@@ -16406,6 +16541,7 @@ var init_zip_reader = __esm({
16406
16541
  ({ writable } = writer);
16407
16542
  const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
16408
16543
  const { outputSize: writtenSize } = await runWorker2({ readable, writable }, workerOptions);
16544
+ throwIfAborted(signal);
16409
16545
  if (writtenSize != outputSize) {
16410
16546
  throw Object.assign(new Error(ERR_INVALID_UNCOMPRESSED_SIZE), { outputSize: writtenSize });
16411
16547
  }
@@ -20046,6 +20182,7 @@ var EHookExecutorName;
20046
20182
  EHookExecutorName2["LinkquegwEventHookExecutor"] = "LinkquegwEventHookExecutor";
20047
20183
  EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
20048
20184
  EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
20185
+ EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
20049
20186
  })(EHookExecutorName || (EHookExecutorName = {}));
20050
20187
 
20051
20188
  // ../agent-a2ui-card-contract/dist/esm/protocol.js
@@ -23914,6 +24051,7 @@ var ETelemetryEventPrefix;
23914
24051
  ETelemetryEventPrefix2["ADVANCE"] = "harness.advance";
23915
24052
  ETelemetryEventPrefix2["MODEL_INVOKE"] = "harness.model.invoke";
23916
24053
  ETelemetryEventPrefix2["MODEL_ATTEMPT"] = "harness.model.attempt";
24054
+ ETelemetryEventPrefix2["MODEL_REASONING"] = "harness.model.reasoning";
23917
24055
  ETelemetryEventPrefix2["TOOL_INVOKE"] = "harness.tool.invoke";
23918
24056
  ETelemetryEventPrefix2["TOOL_ATTEMPT"] = "harness.tool.attempt";
23919
24057
  ETelemetryEventPrefix2["HOOK_CHAIN"] = "harness.hook.chain";
@@ -23955,6 +24093,8 @@ var ETelemetryEventName;
23955
24093
  ETelemetryEventName2["MODEL_INVOKE_FINISHED"] = "harness.model.invoke.finished";
23956
24094
  ETelemetryEventName2["MODEL_ATTEMPT_STARTED"] = "harness.model.attempt.started";
23957
24095
  ETelemetryEventName2["MODEL_ATTEMPT_FINISHED"] = "harness.model.attempt.finished";
24096
+ ETelemetryEventName2["MODEL_REASONING_STARTED"] = "harness.model.reasoning.started";
24097
+ ETelemetryEventName2["MODEL_REASONING_FINISHED"] = "harness.model.reasoning.finished";
23958
24098
  ETelemetryEventName2["TOOL_INVOKE_STARTED"] = "harness.tool.invoke.started";
23959
24099
  ETelemetryEventName2["TOOL_INVOKE_FINISHED"] = "harness.tool.invoke.finished";
23960
24100
  ETelemetryEventName2["TOOL_ATTEMPT_STARTED"] = "harness.tool.attempt.started";
@@ -23977,7 +24117,12 @@ var ETelemetryEventName;
23977
24117
  var ETelemetryContentSection;
23978
24118
  (function(ETelemetryContentSection2) {
23979
24119
  ETelemetryContentSection2["QUERY_INPUT"] = "query.input";
24120
+ ETelemetryContentSection2["MODEL_INPUT_DIGEST"] = "model.input.digest";
24121
+ ETelemetryContentSection2["MODEL_OUT_RAW"] = "model.out.raw";
23980
24122
  ETelemetryContentSection2["MODEL_OUTPUT"] = "model.output";
24123
+ ETelemetryContentSection2["MODEL_REASONING"] = "model.reasoning";
24124
+ ETelemetryContentSection2["FOLLOW_UP_QUESTION_INPUT"] = "follow_up_question.input";
24125
+ ETelemetryContentSection2["FOLLOW_UP_QUESTION_OUTPUT"] = "follow_up_question.output";
23981
24126
  ETelemetryContentSection2["MCP_ACTION_OUTPUT"] = "mcp_action.output";
23982
24127
  ETelemetryContentSection2["TOOL_INPUT"] = "tool.input";
23983
24128
  ETelemetryContentSection2["TOOL_OUTPUT"] = "tool.output";
@@ -23996,6 +24141,7 @@ var ETelemetryOperationName;
23996
24141
  ETelemetryOperationName2["ADVANCE"] = "harness.advance";
23997
24142
  ETelemetryOperationName2["MODEL_INVOKE"] = "harness.model.invoke";
23998
24143
  ETelemetryOperationName2["MODEL_ATTEMPT"] = "harness.model.attempt";
24144
+ ETelemetryOperationName2["MODEL_REASONING"] = "harness.model.reasoning";
23999
24145
  ETelemetryOperationName2["TOOL_ATTEMPT"] = "harness.tool.attempt";
24000
24146
  ETelemetryOperationName2["HOOK_CHAIN"] = "harness.hook.chain";
24001
24147
  ETelemetryOperationName2["MIDDLEWARE"] = "harness.middleware";
@@ -24131,6 +24277,7 @@ var ETelemetryTerminalSource;
24131
24277
  var ETelemetryModelPurpose;
24132
24278
  (function(ETelemetryModelPurpose2) {
24133
24279
  ETelemetryModelPurpose2["AGENT_LOOP"] = "agent_loop";
24280
+ ETelemetryModelPurpose2["FOLLOW_UP_QUESTION"] = "follow_up_question";
24134
24281
  })(ETelemetryModelPurpose || (ETelemetryModelPurpose = {}));
24135
24282
  var ETelemetryErrorType;
24136
24283
  (function(ETelemetryErrorType2) {
@@ -36933,7 +37080,7 @@ t.fill(8, 0, 144), t.fill(9, 144, 256), t.fill(7, 256, 280), t.fill(8, 280, 288)
36933
37080
  var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
36934
37081
  var e = (t3) => t3({ workerURI: (t4) => {
36935
37082
  const e3 = "text/javascript";
36936
- let r2 = '!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:o,Error:r,Uint8Array:s,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:w,TextEncoder:l,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,z="undefined",b="function",k=new s,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,x,M,P,D,F,E]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let o=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),s=e-8;for(;o<=s;o+=8){const t=n^r.getInt32(o,!0),e=r.getInt32(o+4,!0);n=E[255&t]^F[t>>>8&255]^D[t>>>16&255]^P[t>>>24&255]^M[255&e]^x[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;o<e;o++)n=n>>>8^I[255&(n^t[o])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new s(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function B(t,n){const e=new s(t.length+n.length);return e.set(t),e.set(n,t.length),e}function T(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const V=64,W=20,j=new s([128]),K=new s(1),O=new a([1732584193,4023233417,2562383102,271733878,3285377520]),H=new s(256),L=new a(256),N=new a(256),q=new a(256),G=new a(256);let J=!1;function Q(t,n){!function(){if(!J){let t=1,n=1;do{t=255&(t^t<<1^(128&t?27:0)),n=255&(n^n<<1),n=255&(n^n<<2),n=255&(n^n<<4),128&n&&(n^=9),H[t]=255&(n^(n<<1|n>>7)^(n<<2|n>>6)^(n<<3|n>>5)^(n<<4|n>>4)^99)}while(1!=t);H[0]=99;for(let t=0;t<256;t++){const n=H[t],e=$(n),o=e<<24|n<<16|n<<8|e^n;L[t]=o,N[t]=o>>>8|o<<24,q[t]=o>>>16|o<<16,G[t]=o>>>24|o<<8}J=!0}}();const e=new a(60),o=function(t,n){const e=t.length>>2,o=e+6,r=4*(o+1);let s=1;for(let o=0;o<e;o++)n[o]=t[4*o]<<24|t[4*o+1]<<16|t[4*o+2]<<8|t[4*o+3];for(let t=e;t<r;t++){let o=n[t-1];t%e==0?(o=Y(o<<8|o>>>24)^s<<24,s=$(s)):e>6&&t%e==4&&(o=Y(o)),n[t]=n[t-e]^o}return o}(t,e),r=new a(4),s=X(n);let c=0,i=0,f=0,w=0;return{process(t,n){n&&s.update(t,0,t.length),function(t){const n=new u(t.buffer,t.byteOffset,t.byteLength),e=t.length;let o=0;for(;o+16<=e;o+=16)l(),n.setInt32(o,n.getInt32(o)^r[0]),n.setInt32(o+4,n.getInt32(o+4)^r[1]),n.setInt32(o+8,n.getInt32(o+8)^r[2]),n.setInt32(o+12,n.getInt32(o+12)^r[3]);if(o<e){l();for(let n=0;o<e;o++,n++)t[o]^=r[n>>2]>>>24-8*(3&n)}}(t),n||s.update(t,0,t.length)},digest:()=>s.digest()};function l(){c=c+1|0,c||(i=i+1|0,i||(f=f+1|0,f||(w=w+1|0)));let t=Z(c)^e[0],n=Z(i)^e[1],s=Z(f)^e[2],a=Z(w)^e[3],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[4],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[5],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[6],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[7];t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[8],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[9],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[10],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[11],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[12],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[13],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[14],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[15],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[16],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[17],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[18],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[19],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[20],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[21],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[22],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[23],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[24],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[25],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[26],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[27],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[28],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[29],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[30],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[31],t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[32],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[33],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[34],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[35],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[36],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[37],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[38],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[39];let d=40;o>10&&(t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[40],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[41],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[42],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[43],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[44],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[45],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[46],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[47],d=48),o>12&&(t=L[u>>>24]^N[l>>>16&255]^q[h>>>8&255]^G[255&p]^e[48],n=L[l>>>24]^N[h>>>16&255]^q[p>>>8&255]^G[255&u]^e[49],s=L[h>>>24]^N[p>>>16&255]^q[u>>>8&255]^G[255&l]^e[50],a=L[p>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&h]^e[51],u=L[t>>>24]^N[n>>>16&255]^q[s>>>8&255]^G[255&a]^e[52],l=L[n>>>24]^N[s>>>16&255]^q[a>>>8&255]^G[255&t]^e[53],h=L[s>>>24]^N[a>>>16&255]^q[t>>>8&255]^G[255&n]^e[54],p=L[a>>>24]^N[t>>>16&255]^q[n>>>8&255]^G[255&s]^e[55],d=56),r[0]=(H[u>>>24]<<24|H[l>>>16&255]<<16|H[h>>>8&255]<<8|H[255&p])^e[d],r[1]=(H[l>>>24]<<24|H[h>>>16&255]<<16|H[p>>>8&255]<<8|H[255&u])^e[d+1],r[2]=(H[h>>>24]<<24|H[p>>>16&255]<<16|H[u>>>8&255]<<8|H[255&l])^e[d+2],r[3]=(H[p>>>24]<<24|H[u>>>16&255]<<16|H[l>>>8&255]<<8|H[255&h])^e[d+3]}}function X(t){const n=function(){const t=new a(O),n=new a(16),e=new s(V),r=new u(e.buffer),c=new s(8);let i=0,f=0;return{update:w,digest:function(){const n=8*f,e=o.floor(n/4294967296),r=n>>>0;for(w(j,0,1);56!=i;)w(K,0,1);c[0]=e>>>24,c[1]=e>>>16,c[2]=e>>>8,c[3]=e,c[4]=r>>>24,c[5]=r>>>16,c[6]=r>>>8,c[7]=r,w(c,0,8);const a=new s(W),l=new u(a.buffer);for(let n=0;n<t.length;n++)l.setInt32(4*n,t[n]);return t.set(O),i=0,f=0,a}};function w(t,n,o){const s=n+o;if(f+=o,i){for(;n<s&&i<V;)e[i++]=t[n++];i==V&&(l(r,0),i=0)}if(n+V<=s){const e=new u(t.buffer,t.byteOffset,t.byteLength);for(;n+V<=s;n+=V)l(e,n)}for(;n<s;)e[i++]=t[n++]}function l(e,o){for(let t=0;t<16;t++)n[t]=e.getInt32(o+4*t);let r,s=t[0],c=t[1],i=t[2],a=t[3],f=t[4];for(let t=0;t<15;t+=5)f=(s<<5|s>>>27)+((i^a)&c^a)+f+1518500249+n[t]|0,c=c<<30|c>>>2,a=(f<<5|f>>>27)+((c^i)&s^i)+a+1518500249+n[t+1]|0,s=s<<30|s>>>2,i=(a<<5|a>>>27)+((s^c)&f^c)+i+1518500249+n[t+2]|0,f=f<<30|f>>>2,c=(i<<5|i>>>27)+((f^s)&a^s)+c+1518500249+n[t+3]|0,a=a<<30|a>>>2,s=(c<<5|c>>>27)+((a^f)&i^f)+s+1518500249+n[t+4]|0,i=i<<30|i>>>2;f=(s<<5|s>>>27)+((i^a)&c^a)+f+1518500249+n[15]|0,c=c<<30|c>>>2,r=n[13]^n[8]^n[2]^n[0],r=r<<1|r>>>31,n[0]=r,a=(f<<5|f>>>27)+((c^i)&s^i)+a+1518500249+r|0,s=s<<30|s>>>2,r=n[14]^n[9]^n[3]^n[1],r=r<<1|r>>>31,n[1]=r,i=(a<<5|a>>>27)+((s^c)&f^c)+i+1518500249+r|0,f=f<<30|f>>>2,r=n[15]^n[10]^n[4]^n[2],r=r<<1|r>>>31,n[2]=r,c=(i<<5|i>>>27)+((f^s)&a^s)+c+1518500249+r|0,a=a<<30|a>>>2,r=n[0]^n[11]^n[5]^n[3],r=r<<1|r>>>31,n[3]=r,s=(c<<5|c>>>27)+((a^f)&i^f)+s+1518500249+r|0,i=i<<30|i>>>2;for(let t=20;t<40;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(s<<5|s>>>27)+(c^i^a)+f+1859775393+r|0,c=c<<30|c>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,a=(f<<5|f>>>27)+(s^c^i)+a+1859775393+r|0,s=s<<30|s>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,i=(a<<5|a>>>27)+(f^s^c)+i+1859775393+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,c=(i<<5|i>>>27)+(a^f^s)+c+1859775393+r|0,a=a<<30|a>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,s=(c<<5|c>>>27)+(i^a^f)+s+1859775393+r|0,i=i<<30|i>>>2;for(let t=40;t<60;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(s<<5|s>>>27)+(c&i|(c|i)&a)+f+2400959708+r|0,c=c<<30|c>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,a=(f<<5|f>>>27)+(s&c|(s|c)&i)+a+2400959708+r|0,s=s<<30|s>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,i=(a<<5|a>>>27)+(f&s|(f|s)&c)+i+2400959708+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,c=(i<<5|i>>>27)+(a&f|(a|f)&s)+c+2400959708+r|0,a=a<<30|a>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,s=(c<<5|c>>>27)+(i&a|(i|a)&f)+s+2400959708+r|0,i=i<<30|i>>>2;for(let t=60;t<80;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(s<<5|s>>>27)+(c^i^a)+f+3395469782+r|0,c=c<<30|c>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,a=(f<<5|f>>>27)+(s^c^i)+a+3395469782+r|0,s=s<<30|s>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,i=(a<<5|a>>>27)+(f^s^c)+i+3395469782+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,c=(i<<5|i>>>27)+(a^f^s)+c+3395469782+r|0,a=a<<30|a>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,s=(c<<5|c>>>27)+(i^a^f)+s+3395469782+r|0,i=i<<30|i>>>2;t[0]=t[0]+s|0,t[1]=t[1]+c|0,t[2]=t[2]+i|0,t[3]=t[3]+a|0,t[4]=t[4]+f|0}}(),e=new s(V),r=new s(V);t.length>V&&(n.update(t,0,t.length),t=n.digest());for(let n=0;n<V;n++){const o=n<t.length?t[n]:0;e[n]=54^o,r[n]=92^o}return n.update(e,0,V),{update(t,e,o){n.update(t,e,o)},digest(){const t=n.digest();n.update(r,0,V),n.update(t,0,W);const o=n.digest();return n.update(e,0,V),o}}}function Y(t){return H[t>>>24]<<24|H[t>>>16&255]<<16|H[t>>>8&255]<<8|H[255&t]}function Z(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function $(t){return 255&(t<<1^27*(t>>7))}const _=typeof h!=z&&typeof h.getRandomValues==b,tt="Invalid password",nt="zipjs-abort-check-password";function et(t){if(_)return h.getRandomValues(t);throw new r("Crypto API not supported")}const ot={name:"PBKDF2"},rt=n.assign({hash:{name:"HMAC"}},ot),st=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ot),ct=["deriveBits"],it=[8,12,16],at=[16,24,32],ft=10,ut=typeof h!=z,wt=ut&&h.subtle;let lt=ut&&typeof wt!=z&&typeof wt.importKey==b&&typeof wt.deriveBits==b,ht=Q;class pt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:o,checkAuthenticationCode:c=!0}){super({start(){yt(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,l:a,ready:f}=e;c?(await async function(t,n,e,o){const s=await gt(t,n,e,zt(o,0,it[n])),c=zt(o,it[n]);if(s[0]!=c[0]||s[1]!=c[1])throw St(t),new r(tt)}(e,i,c,zt(t,0,it[i]+2)),t=zt(t,it[i]+2),o?(St(e),n.error(new r(nt))):a()):await f;const u=new s(t.length-ft-(t.length-ft)%16);n.enqueue(mt(e,t,u,0,ft,!0))},async flush(t){const{h:n,m:e,ready:o}=this;if(n){await o;const i=zt(e,e.length-ft),a=new s(zt(e,0,e.length-ft));n.process(a,!0);const f=n.digest();let u=e.length<ft?1:0;for(let t=0;t<ft;t++)u|=f[t]^i[t];if(u&&c)throw new r("Invalid authentication code");t.enqueue(a)}},cancel(){St(this)}})}}class dt extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){yt(this,t,n,e)},async transform(t,n){const e=this,{password:o,strength:r,l:c,ready:i}=e;let a=k;o?(a=await async function(t,n,e){const o=et(new s(it[n]));return B(o,await gt(t,n,e,o))}(e,r,o),c()):await i;const f=new s(a.length+t.length-t.length%16);f.set(a,0),n.enqueue(mt(e,t,f,a.length,0,!1))},async flush(t){const{h:n,m:e,ready:o}=this;if(n){await o;const r=new s(e);n.process(r,!1);const c=zt(n.digest(),0,ft);t.enqueue(B(r,c))}},cancel(){St(this)}})}}function yt(t,e,o,r){n.assign(t,{ready:new w(n=>t.l=n),password:vt(e,o),strength:r-1,m:k})}function mt(t,n,e,o,r,c){const{h:i,m:a}=t;a.length&&(n=B(a,n));const f=n.length-r,u=f-f%16;if(e=function(t,n){if(n&&n>t.length){const e=t;(t=new s(n)).set(e,0)}return t}(e,o+u),u){const t=zt(e,o,o+u);t.set(zt(n,0,u)),i.process(t,c)}return t.m=zt(n,u),e}function St({h:t}){t&&t.dispose&&t.dispose()}async function gt(t,e,r,c){t.password=null;const i=at[e],a=await async function(t,e,r){if(lt)try{const o=await wt.importKey("raw",t,rt,!1,ct);return new s(await wt.deriveBits(n.assign({salt:e},st),o,8*r))}catch{lt=!1}return function(t,n,e,r){const c=X(t),i=new s(r),a=new s(n.length+4),f=new u(a.buffer);a.set(n);for(let t=1,e=0;e<r;t++,e+=W){f.setUint32(n.length,t),c.update(a,0,a.length);let s=c.digest();const u=s.slice();for(let t=1;t<1e3;t++){c.update(s,0,W),s=c.digest();for(let t=0;t<W;t++)u[t]^=s[t]}i.set(u.subarray(0,o.min(W,r-e)),e)}return i}(t,e,0,r)}(r,c,2*i+2);return t.h=ht(zt(a,0,i),zt(a,i,2*i)),zt(a,2*i)}function vt(t,n){return n===v?function(t){if(typeof l==z){t=unescape(encodeURIComponent(t));const n=new s(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new l).encode(t)}(t):n}function zt(t,n,e){return t.subarray(n,e)}class bt extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:o}){super({start(){Ct(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=It(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(tt);t=t.subarray(12)}o?n.error(new r(nt)):n.enqueue(It(e,t))}})}}class kt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){Ct(this,t,n,e)},transform(t,n){const e=this;let o,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=et(new s(12));n[11]=e.passwordVerification,o=new s(t.length+n.length),o.set(At(e,n),0),r=12}else o=new s(t.length),r=0;o.set(At(e,t),r),n.enqueue(o)}})}}function Ct(t,e,o,r){n.assign(t,{password:e,rawPassword:o,passwordVerification:r}),function(t,e,o){const r=[305419896,591751049,878082192];if(n.assign(t,{keys:r,S:new R(r[0]),v:new R(r[2])}),o)for(let n=0;n<o.length;n++)xt(t,o[n]);else for(let n=0;n<e.length;n++)xt(t,e.charCodeAt(n))}(t,e,o)}function It(t,n){const e=new s(n.length);for(let o=0;o<n.length;o++)e[o]=Mt(t)^n[o],xt(t,e[o]);return e}function At(t,n){const e=new s(n.length);for(let o=0;o<n.length;o++)e[o]=Mt(t)^n[o],xt(t,n[o]);return e}function xt(t,n){let[,e]=t.keys;t.S.append([n]);const r=~t.S.get();e=Dt(o.imul(Dt(e+Pt(r)),134775813)+1),t.v.append([e>>>24]);const s=~t.v.get();t.keys=[r,e,s]}function Mt(t){const n=2|t.keys[2];return Pt(o.imul(n,1^n)>>>8)}function Pt(t){return 255&t}function Dt(t){return 4294967295&t}function Ft(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:o}=await n.read();o?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Et=new f;function Rt(t){return Et.get(t)}const Ut="Invalid uncompressed size",Bt="deflate-raw",Tt="gzip",Vt=[31,139,8];class Wt extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:o}){super({});const{compressed:r,encrypted:s,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:w,format:l,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=l&&Rt(l),z=function(t,n,e){return t&&n?n:e&&e.C?e:void 0}(c,o,e),b=a&&r&&!w&&!v&&(!s||i)&&Boolean(z);if(s&&!i||!a||b||(y=new U,g=qt(g,y)),r)if(v)g=Gt(g,Lt(v.CompressionStream,l,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(b)S=new jt,g=Gt(g,new z(Tt,{level:f,chunkSize:n})),g=qt(g,S);else try{g=Nt(g,c,{level:f,chunkSize:n},o,e)}catch(t){let n;try{n=new o(Tt)}catch{throw t}g=Gt(g,n),g=qt(g,new jt)}s&&(i?g=qt(g,new kt(t)):(m=new dt(t),g=qt(g,m))),Ht(d,g,()=>{s&&!i||!a||(d.crc32=b?S.crc32:new u(y.value.buffer).getUint32(0))})}}class jt extends d{constructor(){let t,n=10,e=new s(0);super({transform(t,r){if(n){const e=o.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const s=e.length+t.length;if(s<=8)return void(e=B(e,t));const c=s-8,i=o.min(c,e.length);r.enqueue(B(e.subarray(0,i),t.subarray(0,c-i))),e=B(e.subarray(i),t.subarray(c-i))},flush(){const n=T(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Kt extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:o}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:l,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:z}=t;let b,k,C,I=super.readable;if(i&&(c?I=qt(I,new bt(t)):(k=new pt(t),I=qt(I,k))),l){const t=m&&Rt(m);if(t)I=Gt(I,Lt(t.DecompressionStream,m,{chunkSize:n,compressionMethod:S,rawBitFlag:g,uncompressedSize:z}));else try{I=Nt(I,h,{chunkSize:n,deflate64:p},o,e)}catch(t){if(p||z===v)throw t;let n;try{n=new o(Tt)}catch{throw t}C=new R,I=function(t,n,e,o){let c,i,a,f=0,u=!1;const l=new w((t,n)=>{i=t,a=n});l.catch(()=>{}),e||i();const h=new d({start(t){const n=new s(10);n.set(Vt),t.enqueue(n)},transform(t,n){n.enqueue(t)},async flush(t){u=!0,y();try{await l}finally{m()}const n=new s(8),r=T(n);r.setUint32(0,o.get(),!0),r.setUint32(4,e,!0),t.enqueue(n)},cancel(t){a(t)}}),p=new d({transform(t,n){o.append(t),f+=t.length,f>=e?i():u&&y(),n.enqueue(t)},cancel(t){a(t)}});return t=qt(t,h),qt(t=Gt(t,n),p);function y(){m(),c=setTimeout(()=>a(new r(Ut)),5e3)}function m(){clearTimeout(c)}}(I,n,z,C)}I=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new r("Invalid compressed data");throw n.cause=t,n}const{value:o,done:s}=e;s?t.close():t.enqueue(o)},cancel:t=>n.cancel(t)})}(I)}a&&!C&&(b=new U,I=qt(I,b)),Ht(this,I,()=>{if(a){const t=C?C.get()>>>0:new u(b.value.buffer).getUint32(0,!1);if(f!=t)throw new r("Invalid CRC32")}})}}const Ot=new f;function Ht(t,e,o){e=qt(e,new d({flush:o})),n.defineProperty(t,"readable",{get:()=>e})}function Lt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Nt(t,n,e,o,r){const s=n&&o?o:r||o,c=e.deflate64?"deflate64-raw":Bt;let i;try{i=new s(c,e)}catch(t){if(!n||!r||s==r)throw t;i=new r(c,e)}return Gt(t,i)}function qt(t,n){return Ft(t).pipeThrough(n)}function Gt(t,n){const e=n.writable.getWriter(),o=t.getReader();return async function(){try{for(;;){await e.ready;const t=await o.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await async function(t,n){try{await t.abort(n)}catch{}}(e,t),await async function(t,n){try{await t.cancel(n)}catch{}}(o,t)}}(),n.readable}const Jt="data",Qt="deflate";class Xt extends d{constructor(t,e){super({});const o=this,{codecType:s}=t;let c;s.startsWith(Qt)?c=Wt:s.startsWith("inflate")&&(c=Kt),o.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(o,{inputSize:i})}}),w=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),o.outputSize+=n.length,t.outputSize!==v&&o.outputSize>t.outputSize))throw new r(Ut)},flush(){const{crc32:t}=a;n.assign(o,{crc32:t,inputSize:i})}});n.defineProperty(o,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(w)})}}class Yt extends d{constructor(t){const o=[];let r=0,c=0;function i(){const n=new s(t);let e=0;for(;e<t;){const r=o[0],s=t-e;r.length<=s?(n.set(r,e),e+=r.length,o.shift()):(n.set(r.subarray(0,s),e),o[0]=r.subarray(s),e+=s)}return r-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(o.push(n),r+=n.length;r>t;)c+=t,e.enqueue(i())},flush(t){r&&(c+=r,t.enqueue(function(t,n){const e=new s(n);let o=0;for(const n of t)e.set(n,o),o+=n.length;return e}(o,r)))}}),n.defineProperty(this,"outputSize",{get:()=>c})}}let Zt=2;try{typeof navigator!=z&&navigator.hardwareConcurrency&&(Zt=navigator.hardwareConcurrency)}catch{}function $t(t){return Boolean(t)&&"object"==typeof t}const _t=new f,tn=new f,nn=function(){try{return structuredClone(new r)instanceof r}catch{return!1}}();let en=0;async function on(t){let n,s,c;try{const{options:i,config:a}=t;if(i.format)try{await async function(t,n){!Et.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:o}=n;if(typeof e!=b&&typeof o!=b)throw new r("Invalid codec module");Et.set(t,{CompressionStream:e,DecompressionStream:o})}(t,await(import(n)))}(i.format,i.codecURI)}catch(t){if($t(t))try{t.codecImportFailed=!0}catch{}throw t}if(a.CompressionStream=self.CompressionStream,a.DecompressionStream=self.DecompressionStream,i.compressed&&!i.format)if(i.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Ot.get(t);e||(e=new f,Ot.set(t,e));let o=e.get(n);if(o===v){try{new t(n),o=!0}catch{o=!1}e.set(n,o)}return o}(i.codecType.startsWith(Qt)?a.CompressionStream:a.DecompressionStream,Bt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{i.useCompressionStream=!0}if(i.encrypted&&!i.zipCrypto)try{await self.initModule(t.config)}catch{}!a.CompressionStreamFallback&&a.CompressionStreamZlib&&(a.CompressionStreamFallback=a.CompressionStreamZlib),!a.DecompressionStreamFallback&&a.DecompressionStreamZlib&&(a.DecompressionStreamFallback=a.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Ft(t.readable):new y({async pull(t){const n=new w(t=>_t.set(en,t));rn({type:"pull",messageId:en}),en=(en+1)%e.MAX_SAFE_INTEGER;const{value:o,done:r}=await n;t.enqueue(o),r&&t.close()}},u);c=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const o=new w(t=>n=t);tn.set(en,n),rn({type:Jt,value:t,messageId:en}),en=(en+1)%e.MAX_SAFE_INTEGER,await o}},u),n=new Xt(i,a),s=new Yt(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?o.max(r,64):65536;var n,r}(a)),await l.pipeThrough(n).pipeThrough(s).pipeTo(c,{preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=n;rn({type:"close",result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){const n=s?s.outputSize:0;if($t(t))try{t.outputSize=n}catch{}if(c&&!c.locked)try{await c.getWriter().close()}catch{}sn(t,n)}}function rn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new s(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function sn(t,n){const{message:e,stack:o,code:s,name:c,outputSize:i,cause:a,codecImportFailed:f}=function(t=new r("Unknown error")){return $t(t)?t:new r(String(t))}(t),u={message:e,stack:o,code:s,name:c,outputSize:i===v?n:i};if(a&&(u.cause={name:a.name,message:a.message}),f&&(u.codecImportFailed=!0),nn)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:o,done:r}=t;try{if("start"==n&&on(t),n==Jt){const t=_t.get(e);_t.delete(e),t({value:o||new s,done:r})}if("ack"==n){const t=tn.get(e);tn.delete(e),t()}}catch(t){sn(t)}}),p({type:"ready"});const cn="deflate",an="deflate-raw",fn="deflate64-raw",un="gzip";let wn,ln,hn,pn,dn;function yn(t,n,e={}){if(!wn){const t=new r("WASM module not loaded");throw t.cause=dn,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.I=ln(i),this.in=ln(a),this.inBufferSize=a,!this.I||!this.in)throw new r("allocation failed");if(t?(this.A=wn.deflate_process,this.M=wn.deflate_last_consumed,this.P=wn.deflate_end,this.D=wn.deflate_new(),e=n===un?wn.deflate_init_gzip(this.D,c):n===an?wn.deflate_init_raw(this.D,c):wn.deflate_init(this.D,c)):n===fn?(this.A=wn.inflate9_process,this.M=wn.inflate9_last_consumed,this.P=wn.inflate9_end,this.D=wn.inflate9_new(),e=wn.inflate9_init_raw(this.D)):(this.A=wn.inflate_process,this.M=wn.inflate_last_consumed,this.P=wn.inflate_end,this.D=wn.inflate_new(),e=n===an?wn.inflate_init_raw(this.D):n===un?wn.inflate_init_gzip(this.D):wn.inflate_init(this.D)),0!==e)throw new r("init failed:"+e)}catch(t){throw f(this),t}},transform(t,n){try{const e=t,c=new s(pn.buffer),a=this.A,f=this.M,u=this.I;let w=0;for(;w<e.length;){const t=o.min(e.length-w,32768);if((!this.in||this.inBufferSize<t)&&(this.in&&hn&&(hn(this.in),this.in=0),this.in=ln(t),this.inBufferSize=t,!this.in))throw new r("allocation failed");c.set(e.subarray(w,w+t),this.in);const s=a(this.D,this.in,t,u,i,0),l=s>>24&255,h=128&l?l-256:l;if(h<0)throw new r("process error:"+h);const p=16777215&s;p&&n.enqueue(c.slice(u,u+p));const d=f(this.D);if(0===d&&0===p)break;w+=d}}catch(t){f(this),n.error(t)}},flush(t){try{const n=new s(pn.buffer),e=this.A,o=this.I;for(;;){const s=e(this.D,0,0,o,i,4),c=s>>24&255,a=128&c?c-256:c;if(a<0)throw new r("process error:"+a);const f=16777215&s;if(f&&t.enqueue(n.slice(o,o+f)),1===c||0===f)break}}catch(n){t.error(n)}finally{const n=f(this);0!==n&&t.error(new r("end error:"+n))}},cancel(){f(this)}});function f(t){let n=0;return t.D&&t.P&&(n=t.P(t.D)),t.D=0,t.in&&hn&&hn(t.in),t.in=0,t.I&&hn&&hn(t.I),t.I=0,n}}class mn{constructor(t=cn,n){return yn(!0,t,n)}}class Sn{constructor(t=cn,n){return yn(!1,t,n)}}mn.C=!0,Sn.C=!0,mn.F=[cn,an,un],Sn.F=[cn,an,un,fn];const gn=65536;let vn,zn;function bn(t){return new s(t.memory.buffer)}let kn=!1;!function(t={}){const{init:n,R:e}=t,o=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;e&&(ht=e||Q),self.initModule=async t=>{n&&await n(t),o&&(t.CompressionStreamFallback=o),r&&(t.DecompressionStreamFallback=r)}}({CompressionStreamFallback:mn,DecompressionStreamFallback:Sn,R:function(t,n){const e=vn;let o=e?function(t,n,e){zn||(zn=t.malloc(gn));const o=zn?t.aes_hmac_new():0;if(o){const r=bn(t);if(r.set(n,zn),r.set(e,zn+n.length),t.aes_hmac_init(o,zn,n.length,zn+n.length,e.length))return t.aes_hmac_end(o,0),0}return o}(e,t,n):0;if(!o)return Q(t,n);const r=zn;return{process(t,n){for(let s=0;s<t.length;s+=gn){const c=t.subarray(s,s+gn),i=bn(e);i.set(c,r),e.aes_hmac_process(o,r,c.length,n?1:0),c.set(i.subarray(r,r+c.length))}},digest:()=>(e.aes_hmac_end(o,r),o=0,bn(e).slice(r,r+20)),dispose(){o&&(e.aes_hmac_end(o,0),o=0)}}},init:t=>async function(t,{baseURI:n}){if(!kn)try{await async function(t,n){let e,o;try{try{o=new URL(t,n)}catch{}const r=await fetch(o);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),o=e.length,r=new s(o);for(let t=0;t<o;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}const c=await WebAssembly.instantiate(e);var i;(function(t){if(wn=t,({malloc:ln,free:hn,memory:pn}=wn),"function"!=typeof ln||"function"!=typeof hn||!pn)throw wn=ln=hn=pn=null,new r("Invalid WASM module")})(c.instance.exports),typeof(i=c.instance.exports).aes_hmac_new==b&&(vn=i,zn=0)}(t,n),kn=!0}catch(t){throw function(t){dn=t}(t),t}}(t.wasmURI,t)})});\n';
37083
+ let r2 = '!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:o,Error:r,Uint8Array:c,Uint16Array:s,Uint32Array:a,Int32Array:i,Map:f,DataView:u,Promise:w,TextEncoder:l,crypto:d,postMessage:p,TransformStream:h,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new c,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,M,A,E,R,x,P,D]=C;class F{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let o=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),c=e-8;for(;o<=c;o+=8){const t=n^r.getInt32(o,!0),e=r.getInt32(o+4,!0);n=D[255&t]^P[t>>>8&255]^x[t>>>16&255]^R[t>>>24&255]^E[255&e]^A[e>>>8&255]^M[e>>>16&255]^I[e>>>24&255]}}for(;o<e;o++)n=n>>>8^I[255&(n^t[o])];this.o=n}get(){return~this.o}}class U extends h{constructor(){let t;const n=new F;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new c(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function B(t,n){const e=new c(t.length+n.length);return e.set(t),e.set(n,t.length),e}function W(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const O=64,V=20,K=new c([128]),T=new c(1),_=new i([1732584193,4023233417,2562383102,271733878,3285377520]),j=new c(256),H=new i(256),L=new i(256),Z=new i(256),N=new i(256);let q=!1;function G(t,n){!function(){if(!q){let t=1,n=1;do{t=255&(t^t<<1^(128&t?27:0)),n=255&(n^n<<1),n=255&(n^n<<2),n=255&(n^n<<4),128&n&&(n^=9),j[t]=255&(n^(n<<1|n>>7)^(n<<2|n>>6)^(n<<3|n>>5)^(n<<4|n>>4)^99)}while(1!=t);j[0]=99;for(let t=0;t<256;t++){const n=j[t],e=Y(n),o=e<<24|n<<16|n<<8|e^n;H[t]=o,L[t]=o>>>8|o<<24,Z[t]=o>>>16|o<<16,N[t]=o>>>24|o<<8}q=!0}}();const e=new i(60),o=function(t,n){const e=t.length>>2,o=e+6,r=4*(o+1);let c=1;for(let o=0;o<e;o++)n[o]=t[4*o]<<24|t[4*o+1]<<16|t[4*o+2]<<8|t[4*o+3];for(let t=e;t<r;t++){let o=n[t-1];t%e==0?(o=Q(o<<8|o>>>24)^c<<24,c=Y(c)):e>6&&t%e==4&&(o=Q(o)),n[t]=n[t-e]^o}return o}(t,e),r=new i(4),c=J(n);let s=0,a=0,f=0,w=0;return{process(t,n){n&&c.update(t,0,t.length),function(t){const n=new u(t.buffer,t.byteOffset,t.byteLength),e=t.length;let o=0;for(;o+16<=e;o+=16)l(),n.setInt32(o,n.getInt32(o)^r[0]),n.setInt32(o+4,n.getInt32(o+4)^r[1]),n.setInt32(o+8,n.getInt32(o+8)^r[2]),n.setInt32(o+12,n.getInt32(o+12)^r[3]);if(o<e){l();for(let n=0;o<e;o++,n++)t[o]^=r[n>>2]>>>24-8*(3&n)}}(t),n||c.update(t,0,t.length)},digest:()=>c.digest()};function l(){s=s+1|0,s||(a=a+1|0,a||(f=f+1|0,f||(w=w+1|0)));let t=X(s)^e[0],n=X(a)^e[1],c=X(f)^e[2],i=X(w)^e[3],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[4],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[5],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[6],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[7];t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[8],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[9],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[10],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[11],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[12],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[13],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[14],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[15],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[16],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[17],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[18],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[19],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[20],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[21],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[22],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[23],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[24],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[25],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[26],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[27],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[28],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[29],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[30],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[31],t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[32],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[33],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[34],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[35],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[36],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[37],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[38],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[39];let h=40;o>10&&(t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[40],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[41],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[42],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[43],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[44],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[45],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[46],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[47],h=48),o>12&&(t=H[u>>>24]^L[l>>>16&255]^Z[d>>>8&255]^N[255&p]^e[48],n=H[l>>>24]^L[d>>>16&255]^Z[p>>>8&255]^N[255&u]^e[49],c=H[d>>>24]^L[p>>>16&255]^Z[u>>>8&255]^N[255&l]^e[50],i=H[p>>>24]^L[u>>>16&255]^Z[l>>>8&255]^N[255&d]^e[51],u=H[t>>>24]^L[n>>>16&255]^Z[c>>>8&255]^N[255&i]^e[52],l=H[n>>>24]^L[c>>>16&255]^Z[i>>>8&255]^N[255&t]^e[53],d=H[c>>>24]^L[i>>>16&255]^Z[t>>>8&255]^N[255&n]^e[54],p=H[i>>>24]^L[t>>>16&255]^Z[n>>>8&255]^N[255&c]^e[55],h=56),r[0]=(j[u>>>24]<<24|j[l>>>16&255]<<16|j[d>>>8&255]<<8|j[255&p])^e[h],r[1]=(j[l>>>24]<<24|j[d>>>16&255]<<16|j[p>>>8&255]<<8|j[255&u])^e[h+1],r[2]=(j[d>>>24]<<24|j[p>>>16&255]<<16|j[u>>>8&255]<<8|j[255&l])^e[h+2],r[3]=(j[p>>>24]<<24|j[u>>>16&255]<<16|j[l>>>8&255]<<8|j[255&d])^e[h+3]}}function J(t){const n=function(){const t=new i(_),n=new i(16),e=new c(O),r=new u(e.buffer),s=new c(8);let a=0,f=0;return{update:w,digest:function(){const n=8*f,e=o.floor(n/4294967296),r=n>>>0;for(w(K,0,1);56!=a;)w(T,0,1);s[0]=e>>>24,s[1]=e>>>16,s[2]=e>>>8,s[3]=e,s[4]=r>>>24,s[5]=r>>>16,s[6]=r>>>8,s[7]=r,w(s,0,8);const i=new c(V),l=new u(i.buffer);for(let n=0;n<t.length;n++)l.setInt32(4*n,t[n]);return t.set(_),a=0,f=0,i}};function w(t,n,o){const c=n+o;if(f+=o,a){for(;n<c&&a<O;)e[a++]=t[n++];a==O&&(l(r,0),a=0)}if(n+O<=c){const e=new u(t.buffer,t.byteOffset,t.byteLength);for(;n+O<=c;n+=O)l(e,n)}for(;n<c;)e[a++]=t[n++]}function l(e,o){for(let t=0;t<16;t++)n[t]=e.getInt32(o+4*t);let r,c=t[0],s=t[1],a=t[2],i=t[3],f=t[4];for(let t=0;t<15;t+=5)f=(c<<5|c>>>27)+((a^i)&s^i)+f+1518500249+n[t]|0,s=s<<30|s>>>2,i=(f<<5|f>>>27)+((s^a)&c^a)+i+1518500249+n[t+1]|0,c=c<<30|c>>>2,a=(i<<5|i>>>27)+((c^s)&f^s)+a+1518500249+n[t+2]|0,f=f<<30|f>>>2,s=(a<<5|a>>>27)+((f^c)&i^c)+s+1518500249+n[t+3]|0,i=i<<30|i>>>2,c=(s<<5|s>>>27)+((i^f)&a^f)+c+1518500249+n[t+4]|0,a=a<<30|a>>>2;f=(c<<5|c>>>27)+((a^i)&s^i)+f+1518500249+n[15]|0,s=s<<30|s>>>2,r=n[13]^n[8]^n[2]^n[0],r=r<<1|r>>>31,n[0]=r,i=(f<<5|f>>>27)+((s^a)&c^a)+i+1518500249+r|0,c=c<<30|c>>>2,r=n[14]^n[9]^n[3]^n[1],r=r<<1|r>>>31,n[1]=r,a=(i<<5|i>>>27)+((c^s)&f^s)+a+1518500249+r|0,f=f<<30|f>>>2,r=n[15]^n[10]^n[4]^n[2],r=r<<1|r>>>31,n[2]=r,s=(a<<5|a>>>27)+((f^c)&i^c)+s+1518500249+r|0,i=i<<30|i>>>2,r=n[0]^n[11]^n[5]^n[3],r=r<<1|r>>>31,n[3]=r,c=(s<<5|s>>>27)+((i^f)&a^f)+c+1518500249+r|0,a=a<<30|a>>>2;for(let t=20;t<40;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s^a^i)+f+1859775393+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c^s^a)+i+1859775393+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f^c^s)+a+1859775393+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i^f^c)+s+1859775393+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a^i^f)+c+1859775393+r|0,a=a<<30|a>>>2;for(let t=40;t<60;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s&a|(s|a)&i)+f+2400959708+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c&s|(c|s)&a)+i+2400959708+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f&c|(f|c)&s)+a+2400959708+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i&f|(i|f)&c)+s+2400959708+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a&i|(a|i)&f)+c+2400959708+r|0,a=a<<30|a>>>2;for(let t=60;t<80;t+=5)r=n[t-3&15]^n[t-8&15]^n[t-14&15]^n[15&t],r=r<<1|r>>>31,n[15&t]=r,f=(c<<5|c>>>27)+(s^a^i)+f+3395469782+r|0,s=s<<30|s>>>2,r=n[t-2&15]^n[t-7&15]^n[t-13&15]^n[t+1&15],r=r<<1|r>>>31,n[t+1&15]=r,i=(f<<5|f>>>27)+(c^s^a)+i+3395469782+r|0,c=c<<30|c>>>2,r=n[t-1&15]^n[t-6&15]^n[t-12&15]^n[t+2&15],r=r<<1|r>>>31,n[t+2&15]=r,a=(i<<5|i>>>27)+(f^c^s)+a+3395469782+r|0,f=f<<30|f>>>2,r=n[15&t]^n[t-5&15]^n[t-11&15]^n[t+3&15],r=r<<1|r>>>31,n[t+3&15]=r,s=(a<<5|a>>>27)+(i^f^c)+s+3395469782+r|0,i=i<<30|i>>>2,r=n[t+1&15]^n[t-4&15]^n[t-10&15]^n[t+4&15],r=r<<1|r>>>31,n[t+4&15]=r,c=(s<<5|s>>>27)+(a^i^f)+c+3395469782+r|0,a=a<<30|a>>>2;t[0]=t[0]+c|0,t[1]=t[1]+s|0,t[2]=t[2]+a|0,t[3]=t[3]+i|0,t[4]=t[4]+f|0}}(),e=new c(O),r=new c(O);t.length>O&&(n.update(t,0,t.length),t=n.digest());for(let n=0;n<O;n++){const o=n<t.length?t[n]:0;e[n]=54^o,r[n]=92^o}return n.update(e,0,O),{update(t,e,o){n.update(t,e,o)},digest(){const t=n.digest();n.update(r,0,O),n.update(t,0,V);const o=n.digest();return n.update(e,0,O),o}}}function Q(t){return j[t>>>24]<<24|j[t>>>16&255]<<16|j[t>>>8&255]<<8|j[255&t]}function X(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function Y(t){return 255&(t<<1^27*(t>>7))}const $=typeof d!=b&&typeof d.getRandomValues==k,tt="Invalid password",nt="zipjs-abort-check-password";function et(t){if($)return d.getRandomValues(t);throw new r("Crypto API not supported")}const ot={name:"PBKDF2"},rt=n.assign({hash:{name:"HMAC"}},ot),ct=n.assign({iterations:1e3,hash:{name:"SHA-1"}},ot),st=["deriveBits"],at=[8,12,16],it=[16,24,32],ft=10,ut=typeof d!=b,wt=ut&&d.subtle;let lt=ut&&typeof wt!=b&&typeof wt.importKey==k&&typeof wt.deriveBits==k,dt=G;class pt extends h{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:o,checkAuthenticationCode:s=!0}){const a={};super({start(){yt(a,t,n,e)},async transform(t,n){const{password:e,strength:s,l:i,ready:f}=a;if(e?(await async function(t,n,e,o){const c=await vt(t,n,e,kt(o,0,at[n])),s=kt(o,at[n]);if(c[0]!=s[0]||c[1]!=s[1])throw gt(t),new r(tt)}(a,s,e,kt(t,0,at[s]+2)),t=kt(t,at[s]+2),o?(gt(a),n.error(new r(nt))):i()):await f,a.h)return;const u=new c(t.length-ft-(t.length-ft)%16);n.enqueue(St(a,t,u,0,ft,!0))},async flush(t){const{m:n,S:e,ready:o}=a;if(n){if(await o,a.h)return;const i=kt(e,e.length-ft),f=new c(kt(e,0,e.length-ft));n.process(f,!0);const u=n.digest();let w=e.length<ft?1:0;for(let t=0;t<ft;t++)w|=u[t]^i[t];if(w&&s)return void t.error(new r("Invalid authentication code"));t.enqueue(f)}}}),mt(this,a)}}class ht extends h{constructor({password:t,rawPassword:n,encryptionStrength:e}){const o={};super({start(){yt(o,t,n,e)},async transform(t,n){const{password:e,strength:r,l:s,ready:a}=o;let i=z;if(e?(i=await async function(t,n,e){const o=et(new c(at[n]));return B(o,await vt(t,n,e,o))}(o,r,e),s()):await a,o.h)return;const f=new c(i.length+t.length-t.length%16);f.set(i,0),n.enqueue(St(o,t,f,i.length,0,!1))},async flush(t){const{m:n,S:e,ready:r}=o;if(n){if(await r,o.h)return;const s=new c(e);n.process(s,!1);const a=kt(n.digest(),0,ft);t.enqueue(B(s,a))}}}),mt(this,o)}}function yt(t,e,o,r){n.assign(t,{ready:new w(n=>t.l=n),password:bt(e,o),strength:r-1,S:z,h:!1})}function mt(t,e){const o=t.readable.getReader(),r=new y({async pull(t){try{const{value:n,done:e}=await o.read();e?t.close():t.enqueue(n)}catch(t){throw gt(e),o.cancel(t).catch(()=>{}),t}},cancel:t=>(gt(e),o.cancel(t))});n.defineProperty(t,"readable",{get:()=>r})}function St(t,n,e,o,r,s){const{m:a,S:i}=t;i.length&&(n=B(i,n));const f=n.length-r,u=f-f%16;if(e=function(t,n){if(n&&n>t.length){const e=t;(t=new c(n)).set(e,0)}return t}(e,o+u),u){const t=kt(e,o,o+u);t.set(kt(n,0,u)),a.process(t,s)}return t.S=kt(n,u),e}function gt(t){const{m:n}=t;t.h=!0,n&&n.dispose&&n.dispose()}async function vt(t,e,r,s){t.password=null;const a=it[e],i=await async function(t,e,r){if(lt)try{const o=await wt.importKey("raw",t,rt,!1,st);return new c(await wt.deriveBits(n.assign({salt:e},ct),o,8*r))}catch{lt=!1}return function(t,n,e,r){const s=J(t),a=new c(r),i=new c(n.length+4),f=new u(i.buffer);i.set(n);for(let t=1,e=0;e<r;t++,e+=V){f.setUint32(n.length,t),s.update(i,0,i.length);let c=s.digest();const u=c.slice();for(let t=1;t<1e3;t++){s.update(c,0,V),c=s.digest();for(let t=0;t<V;t++)u[t]^=c[t]}a.set(u.subarray(0,o.min(V,r-e)),e)}return a}(t,e,0,r)}(r,s,2*a+2);return t.m=dt(kt(i,0,a),kt(i,a,2*a)),t.h&&gt(t),kt(i,2*a)}function bt(t,n){return n===v?function(t){if(typeof l==b){t=unescape(encodeURIComponent(t));const n=new c(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new l).encode(t)}(t):n}function kt(t,n,e){return t.subarray(n,e)}class zt extends h{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:o}){super({start(){It(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=Mt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(tt);t=t.subarray(12)}o?n.error(new r(nt)):n.enqueue(Mt(e,t))}})}}class Ct extends h{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){It(this,t,n,e)},transform(t,n){const e=this;let o,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=et(new c(12));n[11]=e.passwordVerification,o=new c(t.length+n.length),o.set(At(e,n),0),r=12}else o=new c(t.length),r=0;o.set(At(e,t),r),n.enqueue(o)}})}}function It(t,e,o,r){n.assign(t,{password:e,rawPassword:o,passwordVerification:r}),function(t,e,o){const r=[305419896,591751049,878082192];if(n.assign(t,{v:r,C:new F(r[0]),I:new F(r[2])}),o)for(let n=0;n<o.length;n++)Et(t,o[n]);else for(let n=0;n<e.length;n++)Et(t,e.charCodeAt(n))}(t,e,o)}function Mt(t,n){const e=new c(n.length);for(let o=0;o<n.length;o++)e[o]=Rt(t)^n[o],Et(t,e[o]);return e}function At(t,n){const e=new c(n.length);for(let o=0;o<n.length;o++)e[o]=Rt(t)^n[o],Et(t,n[o]);return e}function Et(t,n){let[,e]=t.v;t.C.append([n]);const r=~t.C.get();e=Pt(o.imul(Pt(e+xt(r)),134775813)+1),t.I.append([e>>>24]);const c=~t.I.get();t.v=[r,e,c]}function Rt(t){const n=2|t.v[2];return xt(o.imul(n,1^n)>>>8)}function xt(t){return 255&t}function Pt(t){return 4294967295&t}function Dt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){try{const{value:e,done:o}=await n.read();o?t.close():t.enqueue(e)}catch(t){throw n.cancel(t).catch(()=>{}),t}},cancel:t=>n.cancel(t)})}function Ft(t){return Boolean(t)&&"object"==typeof t}const Ut=new f;function Bt(t){return Ut.get(t)}const Wt="Invalid uncompressed size",Ot="Codec out of memory",Vt="Invalid CRC32",Kt="deflate-raw",Tt="gzip",_t=[31,139,8];class jt extends h{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:o}){super({});const{compressed:r,encrypted:c,useCompressionStream:s,zipCrypto:a,computeCrc32:i,level:f,deflate64:w,format:l,compressionMethod:d,inputSize:p}=t,h=this;let y,m,S,g=super.readable;const v=l&&Bt(l),b=Gt(s,o,e),k=i&&r&&!w&&!v&&(!c||a)&&Boolean(b);if(c&&!a||!i||k||(y=new U,g=Qt(g,y)),r)if(v)g=Xt(g,qt(v.CompressionStream,l,{level:f,chunkSize:n,compressionMethod:d,uncompressedSize:p}));else if(k)S=new Ht,g=Xt(g,new b(Tt,{level:f,chunkSize:n})),g=Qt(g,S);else try{g=Jt(g,s,{level:f,chunkSize:n},o,e)}catch(t){if(!s&&e)throw en(t);let n;try{n=new o(Tt)}catch{throw en(t)}g=Xt(g,n),g=Qt(g,new Ht)}c&&(a?g=Qt(g,new Ct(t)):(m=new ht(t),g=Qt(g,m))),Nt(h,g,()=>{c&&!a||!i||(h.crc32=k?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Ht extends h{constructor(){let t,n=10,e=new c(0);super({transform(t,r){if(n){const e=o.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const c=e.length+t.length;if(c<=8)return void(e=B(e,t));const s=c-8,a=o.min(s,e.length);r.enqueue(B(e.subarray(0,a),t.subarray(0,s-a))),e=B(e.subarray(a),t.subarray(s-a))},flush(){const n=W(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Lt extends h{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:o}){super({});const{zipCrypto:s,encrypted:a,checkCrc32:i,crc32:f,compressed:l,useCompressionStream:d,deflate64:p,format:h,compressionMethod:m,rawBitFlag:S,outputSize:g}=t;let b,k,z,C=super.readable;if(a&&(s?C=Qt(C,new zt(t)):(k=new pt(t),C=Qt(C,k))),l){const t=new Set,s=h&&Bt(h);let a;if(s)C=Xt(C,qt(s.DecompressionStream,h,{chunkSize:n,compressionMethod:m,rawBitFlag:S,uncompressedSize:g}),t);else{const r=Gt(d,o,e);if(i&&!p&&f!==v&&g!==v&&r)try{a=new r(Tt,{chunkSize:n})}catch{a=v}if(!a)try{C=Jt(C,d,{chunkSize:n,deflate64:p},o,e,t)}catch(t){if(p||g===v||!d&&e)throw en(t);try{a=new o(Tt)}catch{throw en(t)}}}a?(z=!0,C=function(t,n,e,o,s){const a=n.writable.getWriter(),i=n.readable.getReader(),f=o===v?new F:v;let u,l,d=0,p=!1,h=!1;const m=new y({start(t){l=t},pull(){b()},cancel:t=>(h=!0,b(),i.cancel(t))});return async function(){const n=t.getReader();try{const t=new c(10);for(t.set(_t),await a.write(t);;){await g(),await a.ready;const{value:t,done:e}=await tn(n,s);if(e)break;await a.write(t)}f&&await a.write(new c(0));const r=new c(8),i=W(r);i.setUint32(0,f?f.get():o,!0),i.setUint32(4,e,!0),p=!0,await a.write(r),await a.close()}catch(t){await Yt(a,t),await $t(n,t)}}(),async function(){try{for(;;){const{value:t,done:n}=await S();if(n)break;if(d+=t.length,d>e)throw new r(Wt);f&&f.append(t),l.enqueue(t)}h||(h=!0,l.close())}catch(t){!function(t){h||(h=!0,l.error(t),b())}(t),await $t(i,t)}}(),m;function S(){return i.read().catch(t=>{if(p){if(!f)throw rn(t,Vt);if(d!=e)throw rn(t,Wt);return{done:!0}}throw nn(t,s)})}function g(){if(!h&&l.desiredSize<=0)return new w(t=>u=t)}function b(){if(u){const t=u;u=v,t()}}}(C,a,g,f,t)):C=function(t,n){const e=t.getReader();return new y({async pull(t){try{const{value:n,done:o}=await e.read();o?t.close():t.enqueue(n)}catch(t){throw await $t(e,t),nn(t,n)}},cancel:t=>e.cancel(t)})}(C,t)}i&&!z&&(b=new U,C=Qt(C,b)),Nt(this,C,()=>{if(b){const t=new u(b.value.buffer).getUint32(0,!1);if(f!=t)throw new r(Vt)}})}}const Zt=new f;function Nt(t,e,o){e=Qt(e,new h({flush:o})),n.defineProperty(t,"readable",{get:()=>e})}function qt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Gt(t,n,e){return t&&n?n:e&&e.requiresModule?e:void 0}function Jt(t,n,e,o,r,c){const s=n&&o?o:r||o,a=e.deflate64?"deflate64-raw":Kt;let i;try{i=new s(a,e)}catch(t){if(!n||!r||s==r)throw t;i=new r(a,e)}return Xt(t,i,c)}function Qt(t,n){return Dt(t).pipeThrough(n)}function Xt(t,n,e){const o=n.writable.getWriter(),r=t.getReader();return async function(){try{for(;;){await o.ready;const t=await tn(r,e);if(t.done){await o.close();break}await o.write(t.value)}}catch(t){await Yt(o,t),await $t(r,t)}}(),n.readable}async function Yt(t,n){try{await t.abort(n)}catch{}}async function $t(t,n){try{await t.cancel(n)}catch{}}function tn(t,n){const e=t.read();return n?e.catch(t=>{throw n.add(t),t}):e}function nn(t,n){return n.has(t)?t:rn(t,on(t)?Ot:"Invalid compressed data")}function en(t){return on(t)?rn(t,Ot):t}function on(t){return Ft(t)&&"Z_MEM_ERROR"==t.code}function rn(t,n){const e=new r(n);return e.cause=t,e}const cn="data",sn="deflate";class an extends h{constructor(t,e){super({});const o=this,{codecType:c}=t;let s;c.startsWith(sn)?s=jt:c.startsWith("inflate")&&(s=Lt),o.outputSize=0;let a=0;const i=new s(t,e),f=super.readable,u=new h({transform(t,n){t&&t.length&&(a+=t.length,n.enqueue(t))},flush(){n.assign(o,{inputSize:a})}}),w=new h({transform(n,e){if(n&&n.length&&(e.enqueue(n),o.outputSize+=n.length,t.outputSize!==v&&o.outputSize>t.outputSize))throw new r(Wt)},flush(){const{crc32:t}=i;n.assign(o,{crc32:t,inputSize:a})}});n.defineProperty(o,"readable",{get:()=>f.pipeThrough(u).pipeThrough(i).pipeThrough(w)})}}class fn extends h{constructor(t){const o=[];let r=0,s=0;function a(){const n=new c(t);let e=0;for(;e<t;){const r=o[0],c=t-e;r.length<=c?(n.set(r,e),e+=r.length,o.shift()):(n.set(r.subarray(0,c),e),o[0]=r.subarray(c),e+=c)}return r-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(o.push(n),r+=n.length;r>t;)s+=t,e.enqueue(a())},flush(t){r&&(s+=r,t.enqueue(function(t,n){const e=new c(n);let o=0;for(const n of t)e.set(n,o),o+=n.length;return e}(o,r)))}}),n.defineProperty(this,"outputSize",{get:()=>s})}}let un=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(un=navigator.hardwareConcurrency)}catch{}const wn=new f,ln=new f,dn=function(){try{return structuredClone(new r)instanceof r}catch{return!1}}();let pn=0;async function hn(t){let n,c,s;try{const{options:a,config:i}=t;if(a.format)try{await async function(t,n){!Ut.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:o}=n;if(typeof e!=k&&typeof o!=k)throw new r("Invalid codec module");Ut.set(t,{CompressionStream:e,DecompressionStream:o})}(t,await(import(n)))}(a.format,a.codecURI)}catch(t){if(Ft(t))try{t.codecImportFailed=!0}catch{}throw t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,a.compressed&&!a.format)if(a.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Zt.get(t);e||(e=new f,Zt.set(t,e));let o=e.get(n);if(o===v){try{new t(n),o=!0}catch{o=!1}e.set(n,o)}return o}(a.codecType.startsWith(sn)?i.CompressionStream:i.DecompressionStream,Kt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{a.useCompressionStream=!0}if(a.encrypted&&!a.zipCrypto)try{await self.initModule(t.config)}catch{}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Dt(t.readable):new y({async pull(t){const n=new w(t=>wn.set(pn,t));yn({type:"pull",messageId:pn}),pn=(pn+1)%e.MAX_SAFE_INTEGER;const{value:o,done:r}=await n;t.enqueue(o),r&&t.close()}},u);s=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const o=new w(t=>n=t);ln.set(pn,n),yn({type:cn,value:t,messageId:pn}),pn=(pn+1)%e.MAX_SAFE_INTEGER,await o}},u),n=new an(a,i),c=new fn(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?o.max(r,64):65536;var n,r}(i)),await l.pipeThrough(n).pipeThrough(c).pipeTo(s,{preventClose:!0,preventAbort:!0}),await s.getWriter().close();const{crc32:d,inputSize:p,outputSize:h}=n;yn({type:"close",result:{crc32:d,inputSize:p,outputSize:h}})}catch(t){const n=c?c.outputSize:0;if(Ft(t))try{t.outputSize=n}catch{}if(s&&!s.locked)try{await s.getWriter().close()}catch{}mn(t,n)}}function yn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new c(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function mn(t,n){const{message:e,stack:o,code:c,name:s,outputSize:a,cause:i,codecImportFailed:f}=function(t=new r("Unknown error")){return Ft(t)?t:new r(String(t))}(t),u={message:e,stack:o,code:c,name:s,outputSize:a===v?n:a};if(Ft(i)&&(u.cause={name:i.name,message:i.message}),f&&(u.codecImportFailed=!0),dn)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:o,done:r}=t;try{if("start"==n&&hn(t),n==cn){const t=wn.get(e);wn.delete(e),t({value:o||new c,done:r})}if("ack"==n){const t=ln.get(e);ln.delete(e),t()}}catch(t){mn(t)}}),p({type:"ready"});const Sn="deflate",gn="deflate-raw",vn="deflate64-raw",bn="gzip",kn=[Sn,gn,bn],zn=[Sn,gn,bn,vn];let Cn,In,Mn,An,En;function Rn(t,n){return-4===n&&(t.code="Z_MEM_ERROR"),t}function xn(t,n,e={}){if(!(t?kn:zn).includes(n))throw new TypeError("Unsupported format: "+n);if(!Cn){const t=new r("WASM module not loaded");throw t.cause=En,t}const s="number"==typeof e.level?e.level:-1,a="number"==typeof e.outBuffer?e.outBuffer:65536,i="number"==typeof e.inBufferSize?e.inBufferSize:65536,f={M:0,in:0,inBufferSize:0,A:0,R:!1};let u,l,d,p,h=!0,S=!1;return function(){try{let e;if(f.M=In(a),f.in=In(i),f.inBufferSize=i,!f.M||!f.in)throw Rn(new r("allocation failed"),-4);if(t?(f.P=Cn.deflate_process,f.D=Cn.deflate_last_consumed,f.F=Cn.deflate_end,f.A=Cn.deflate_new(),e=n===bn?Cn.deflate_init_gzip(f.A,s):n===gn?Cn.deflate_init_raw(f.A,s):Cn.deflate_init(f.A,s)):n===vn?(f.P=Cn.inflate9_process,f.D=Cn.inflate9_last_consumed,f.F=Cn.inflate9_end,f.A=Cn.inflate9_new(),e=Cn.inflate9_init_raw(f.A)):(f.P=Cn.inflate_process,f.D=Cn.inflate_last_consumed,f.F=Cn.inflate_end,f.A=Cn.inflate_new(),e=n===gn?Cn.inflate_init_raw(f.A):n===bn?Cn.inflate_init_gzip(f.A):Cn.inflate_init(f.A)),0!==e)throw Rn(new r("init failed:"+e),e)}catch(t){throw b(f),t}}(),{readable:new y({start(t){u=t},pull(){h=!1,v()},cancel(t){S=!0,p=t,b(f),l.error(t),v()}},{highWaterMark:0}),writable:new m({start(t){l=t},async write(t){if(h&&await new w(t=>d=t),S)throw p;try{!function(t){const n=new c(An.buffer),e=f.P,s=f.D,i=f.M;let u=0;for(;u<t.length;){if(f.R)throw new r("trailing data after the end of the stream");const c=o.min(t.length-u,32768);if((!f.in||f.inBufferSize<c)&&(f.in&&Mn&&(Mn(f.in),f.in=0),f.in=In(c),f.inBufferSize=c,!f.in))throw Rn(new r("allocation failed"),-4);n.set(t.subarray(u,u+c),f.in);const w=e(f.A,f.in,c,i,a,0),l=w>>24&255,d=128&l?l-256:l;if(d<0)throw Rn(new r("process error:"+d),d);const p=16777215&w;p&&g(n.slice(i,i+p));const h=s(f.A);if(1===l)f.R=!0;else if(0===h&&0===p)break;u+=h}}(t)}catch(t){throw b(f),u.error(t),t}},close(){if(S)return;try{!function(){const t=new c(An.buffer),n=f.P,e=f.M;for(;;){const o=n(f.A,0,0,e,a,4),c=o>>24&255,s=128&c?c-256:c;if(s<0)throw Rn(new r("process error:"+s),s);const i=16777215&o;if(i&&g(t.slice(e,e+i)),1===c||0===i)break}}()}catch(t){throw b(f),u.error(t),t}const t=b(f);if(0!==t){const n=Rn(new r("end error:"+t),t);throw u.error(n),n}u.close()},abort(t){b(f),u.error(t)}},{highWaterMark:1})};function g(t){h=!0,u.enqueue(t)}function v(){if(d){const t=d;d=null,t()}}function b(t){let n=0;return t.A&&t.F&&(n=t.F(t.A)),t.A=0,t.in&&Mn&&Mn(t.in),t.in=0,t.M&&Mn&&Mn(t.M),t.M=0,n}}class Pn{constructor(t=Sn,n){return xn(!0,t,n)}}class Dn{constructor(t=Sn,n){return xn(!1,t,n)}}Pn.requiresModule=!0,Dn.requiresModule=!0,Pn.supportedFormats=kn,Dn.supportedFormats=zn;const Fn=65536;let Un,Bn;function Wn(t){return new c(t.memory.buffer)}let On=!1;!function(t={}){const{init:n,U:e}=t,o=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;e&&(dt=e||G),self.initModule=async t=>{n&&await n(t),o&&(t.CompressionStreamFallback=o),r&&(t.DecompressionStreamFallback=r)}}({CompressionStreamFallback:Pn,DecompressionStreamFallback:Dn,U:function(t,n){const e=Un;let o=e?function(t,n,e){Bn||(Bn=t.malloc(Fn));const o=Bn?t.aes_hmac_new():0;if(o){const r=Wn(t);if(r.set(n,Bn),r.set(e,Bn+n.length),t.aes_hmac_init(o,Bn,n.length,Bn+n.length,e.length))return t.aes_hmac_end(o,0),0}return o}(e,t,n):0;if(!o)return G(t,n);const r=Bn;return{process(t,n){for(let c=0;c<t.length;c+=Fn){const s=t.subarray(c,c+Fn),a=Wn(e);a.set(s,r),e.aes_hmac_process(o,r,s.length,n?1:0),s.set(a.subarray(r,r+s.length))}},digest:()=>(e.aes_hmac_end(o,r),o=0,Wn(e).slice(r,r+20)),dispose(){o&&(e.aes_hmac_end(o,0),o=0)}}},init:t=>async function(t,{baseURI:n}){if(!On)try{await async function(t,n){let e,o;try{try{o=new URL(t,n)}catch{}const r=await fetch(o);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),o=e.length,r=new c(o);for(let t=0;t<o;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}const s=await WebAssembly.instantiate(e);var a;(function(t){if(Cn=t,({malloc:In,free:Mn,memory:An}=Cn),"function"!=typeof In||"function"!=typeof Mn||!An)throw Cn=In=Mn=An=null,new r("Invalid WASM module")})(s.instance.exports),typeof(a=s.instance.exports).aes_hmac_new==k&&(Un=a,Bn=0)}(t,n),On=!0}catch(t){throw function(t){En=t}(t),t}}(t.wasmURI,t)})});\n';
36937
37084
  if ("string" == typeof r2 && (r2 = new TextEncoder().encode(r2)), t4) {
36938
37085
  const t5 = new Blob([r2], { type: e3 });
36939
37086
  return URL.createObjectURL(t5);
@@ -36941,17 +37088,17 @@ var e = (t3) => t3({ workerURI: (t4) => {
36941
37088
  return "data:" + e3 + ";base64," + function(t5) {
36942
37089
  let e4 = "";
36943
37090
  const r3 = t5.length;
36944
- let s4 = 0;
36945
- for (; s4 + 2 < r3; s4 += 3) {
36946
- const r4 = t5[s4] << 16 | t5[s4 + 1] << 8 | t5[s4 + 2];
37091
+ let o2 = 0;
37092
+ for (; o2 + 2 < r3; o2 += 3) {
37093
+ const r4 = t5[o2] << 16 | t5[o2 + 1] << 8 | t5[o2 + 2];
36947
37094
  e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + n[r4 >> 6 & 63] + n[63 & r4];
36948
37095
  }
36949
- const o2 = r3 - s4;
36950
- if (1 === o2) {
36951
- const r4 = t5[s4] << 16;
37096
+ const s4 = r3 - o2;
37097
+ if (1 === s4) {
37098
+ const r4 = t5[o2] << 16;
36952
37099
  e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + "==";
36953
- } else if (2 === o2) {
36954
- const r4 = t5[s4] << 16 | t5[s4 + 1] << 8;
37100
+ } else if (2 === s4) {
37101
+ const r4 = t5[o2] << 16 | t5[o2 + 1] << 8;
36955
37102
  e4 += n[r4 >> 18 & 63] + n[r4 >> 12 & 63] + n[r4 >> 6 & 63] + "=";
36956
37103
  }
36957
37104
  return e4;
@@ -36970,6 +37117,7 @@ init_codec_worker();
36970
37117
  var MODULE_WORKER_OPTIONS = { type: "module" };
36971
37118
  var ERROR_EVENT_TYPE = "error";
36972
37119
  var MESSAGE_ERROR_EVENT_TYPE = "messageerror";
37120
+ var ABORT_EVENT_TYPE = "abort";
36973
37121
  var webWorkerSource;
36974
37122
  var webWorkerURI;
36975
37123
  var webWorkerOptions;
@@ -37134,6 +37282,13 @@ function watchClosedStream(writableSource, workerData) {
37134
37282
  Object.assign(workerData, { destinationFailed: true, destinationError: error2 });
37135
37283
  }
37136
37284
  });
37285
+ const { signal } = workerData.workerOptions.streamOptions;
37286
+ if (signal) {
37287
+ const onAbort = () => abortController.abort(signal.reason);
37288
+ const removeAbortListener = () => signal.removeEventListener(ABORT_EVENT_TYPE, onAbort);
37289
+ signal.addEventListener(ABORT_EVENT_TYPE, onAbort);
37290
+ closed.then(removeAbortListener, removeAbortListener);
37291
+ }
37137
37292
  return {
37138
37293
  writable,
37139
37294
  closed,
@@ -37382,9 +37537,6 @@ function getResponseError(errorData, errorValue) {
37382
37537
  responseError = errorValue.value;
37383
37538
  } else {
37384
37539
  responseError = Object.assign(new Error(message), { stack, code, name });
37385
- if (cause) {
37386
- responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
37387
- }
37388
37540
  }
37389
37541
  if (isErrorObject(responseError)) {
37390
37542
  try {
@@ -37394,6 +37546,9 @@ function getResponseError(errorData, errorValue) {
37394
37546
  if (codecImportFailed) {
37395
37547
  responseError.codecImportFailed = true;
37396
37548
  }
37549
+ if (cause && !isErrorObject(responseError.cause)) {
37550
+ responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
37551
+ }
37397
37552
  if (errorValue) {
37398
37553
  if (responseError.name !== name) {
37399
37554
  responseError.name = name;
@@ -38068,9 +38223,11 @@ function resolveMetadata(zipWriter, name, options) {
38068
38223
  const passThrough = checkPassThroughOption(getOptionValue2(zipWriter, options, OPTION_PASS_THROUGH));
38069
38224
  const passThroughCompression = Boolean(passThrough);
38070
38225
  const passThroughEncryption = passThrough === true;
38071
- const password = getOptionValue2(zipWriter, options, OPTION_PASSWORD);
38072
- const rawPassword = getOptionValue2(zipWriter, options, OPTION_RAW_PASSWORD);
38226
+ let password = getOptionValue2(zipWriter, options, OPTION_PASSWORD);
38227
+ let rawPassword = getOptionValue2(zipWriter, options, OPTION_RAW_PASSWORD);
38073
38228
  checkPasswordOption(password, rawPassword);
38229
+ password = password && password.length ? password : UNDEFINED_VALUE;
38230
+ rawPassword = rawPassword && rawPassword.length ? rawPassword : UNDEFINED_VALUE;
38074
38231
  const encryptionStrength = getNumberOptionValue(zipWriter, options, OPTION_ENCRYPTION_STRENGTH, 3);
38075
38232
  const zipCrypto = getOptionValue2(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
38076
38233
  const extendedTimestamp = getOptionValue2(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
@@ -38581,6 +38738,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
38581
38738
  const result = await runWorker2({ readable, writable }, workerOptions);
38582
38739
  compressedSize = result.outputSize;
38583
38740
  writer.size += compressedSize;
38741
+ throwIfAborted(signal);
38584
38742
  if (!passThroughCompression) {
38585
38743
  uncompressedSize = result.inputSize;
38586
38744
  if (!encrypted || zipCrypto) {
@@ -39746,6 +39904,10 @@ var FORMAT_DEFLATE = "deflate";
39746
39904
  var FORMAT_DEFLATE_RAW2 = "deflate-raw";
39747
39905
  var FORMAT_DEFLATE64_RAW2 = "deflate64-raw";
39748
39906
  var FORMAT_GZIP2 = "gzip";
39907
+ var Z_MEM_ERROR = -4;
39908
+ var Z_MEM_ERROR_CODE2 = "Z_MEM_ERROR";
39909
+ var COMPRESSION_FORMATS = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2];
39910
+ var DECOMPRESSION_FORMATS = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2, FORMAT_DEFLATE64_RAW2];
39749
39911
  var wasm;
39750
39912
  var malloc;
39751
39913
  var free;
@@ -39762,7 +39924,16 @@ function setWasmExports(wasmAPI) {
39762
39924
  function setInitError(error2) {
39763
39925
  initError = error2;
39764
39926
  }
39927
+ function setZlibCode(error2, result) {
39928
+ if (result === Z_MEM_ERROR) {
39929
+ error2.code = Z_MEM_ERROR_CODE2;
39930
+ }
39931
+ return error2;
39932
+ }
39765
39933
  function _make(isCompress, type, options = {}) {
39934
+ if (!(isCompress ? COMPRESSION_FORMATS : DECOMPRESSION_FORMATS).includes(type)) {
39935
+ throw new TypeError("Unsupported format: " + type);
39936
+ }
39766
39937
  if (!wasm) {
39767
39938
  const error2 = new Error("WASM module not loaded");
39768
39939
  error2.cause = initError;
@@ -39771,147 +39942,208 @@ function _make(isCompress, type, options = {}) {
39771
39942
  const level = typeof options.level === "number" ? options.level : -1;
39772
39943
  const outBufferSize = typeof options.outBuffer === "number" ? options.outBuffer : 64 * 1024;
39773
39944
  const inBufferSize = typeof options.inBufferSize === "number" ? options.inBufferSize : 64 * 1024;
39774
- return new TransformStream({
39775
- start() {
39945
+ const state = { out: 0, in: 0, inBufferSize: 0, streamHandle: 0, streamEnded: false };
39946
+ let readableController, writableController, resolveWrite, cancelReason;
39947
+ let backpressure = true;
39948
+ let cancelled = false;
39949
+ initStream2();
39950
+ const readable = new ReadableStream({
39951
+ start(controller) {
39952
+ readableController = controller;
39953
+ },
39954
+ pull() {
39955
+ backpressure = false;
39956
+ resumeWrite();
39957
+ },
39958
+ cancel(reason) {
39959
+ cancelled = true;
39960
+ cancelReason = reason;
39961
+ disposeStream(state);
39962
+ writableController.error(reason);
39963
+ resumeWrite();
39964
+ }
39965
+ }, { highWaterMark: 0 });
39966
+ const writable = new WritableStream({
39967
+ start(controller) {
39968
+ writableController = controller;
39969
+ },
39970
+ async write(chunk) {
39971
+ if (backpressure) {
39972
+ await new Promise((resolve2) => resolveWrite = resolve2);
39973
+ }
39974
+ if (cancelled) {
39975
+ throw cancelReason;
39976
+ }
39776
39977
  try {
39777
- let result;
39778
- this.out = malloc(outBufferSize);
39779
- this.in = malloc(inBufferSize);
39780
- this.inBufferSize = inBufferSize;
39781
- if (!this.out || !this.in) {
39782
- throw new Error("allocation failed");
39783
- }
39784
- if (isCompress) {
39785
- this._process = wasm.deflate_process;
39786
- this._last_consumed = wasm.deflate_last_consumed;
39787
- this._end = wasm.deflate_end;
39788
- this.streamHandle = wasm.deflate_new();
39789
- if (type === FORMAT_GZIP2) {
39790
- result = wasm.deflate_init_gzip(this.streamHandle, level);
39791
- } else if (type === FORMAT_DEFLATE_RAW2) {
39792
- result = wasm.deflate_init_raw(this.streamHandle, level);
39793
- } else {
39794
- result = wasm.deflate_init(this.streamHandle, level);
39795
- }
39796
- } else {
39797
- if (type === FORMAT_DEFLATE64_RAW2) {
39798
- this._process = wasm.inflate9_process;
39799
- this._last_consumed = wasm.inflate9_last_consumed;
39800
- this._end = wasm.inflate9_end;
39801
- this.streamHandle = wasm.inflate9_new();
39802
- result = wasm.inflate9_init_raw(this.streamHandle);
39803
- } else {
39804
- this._process = wasm.inflate_process;
39805
- this._last_consumed = wasm.inflate_last_consumed;
39806
- this._end = wasm.inflate_end;
39807
- this.streamHandle = wasm.inflate_new();
39808
- if (type === FORMAT_DEFLATE_RAW2) {
39809
- result = wasm.inflate_init_raw(this.streamHandle);
39810
- } else if (type === FORMAT_GZIP2) {
39811
- result = wasm.inflate_init_gzip(this.streamHandle);
39812
- } else {
39813
- result = wasm.inflate_init(this.streamHandle);
39814
- }
39815
- }
39816
- }
39817
- if (result !== 0) {
39818
- throw new Error("init failed:" + result);
39819
- }
39978
+ processChunk(chunk);
39820
39979
  } catch (error2) {
39821
- disposeStream(this);
39980
+ disposeStream(state);
39981
+ readableController.error(error2);
39822
39982
  throw error2;
39823
39983
  }
39824
39984
  },
39825
- transform(chunk, controller) {
39985
+ close() {
39986
+ if (cancelled) {
39987
+ return;
39988
+ }
39826
39989
  try {
39827
- const buffer2 = chunk;
39828
- const heap = new Uint8Array(memory.buffer);
39829
- const process2 = this._process;
39830
- const last_consumed = this._last_consumed;
39831
- const out = this.out;
39832
- let offset = 0;
39833
- while (offset < buffer2.length) {
39834
- const toRead = Math.min(buffer2.length - offset, 32 * 1024);
39835
- if (!this.in || this.inBufferSize < toRead) {
39836
- if (this.in && free) {
39837
- free(this.in);
39838
- this.in = 0;
39839
- }
39840
- this.in = malloc(toRead);
39841
- this.inBufferSize = toRead;
39842
- if (!this.in) {
39843
- throw new Error("allocation failed");
39844
- }
39845
- }
39846
- heap.set(buffer2.subarray(offset, offset + toRead), this.in);
39847
- const result = process2(this.streamHandle, this.in, toRead, out, outBufferSize, 0);
39848
- const code = result >> 24 & 255;
39849
- const signedCode = code & 128 ? code - 256 : code;
39850
- if (signedCode < 0) {
39851
- throw new Error("process error:" + signedCode);
39852
- }
39853
- const prod = result & 16777215;
39854
- if (prod) {
39855
- controller.enqueue(heap.slice(out, out + prod));
39856
- }
39857
- const consumed = last_consumed(this.streamHandle);
39858
- if (consumed === 0 && prod === 0) {
39859
- break;
39860
- }
39861
- offset += consumed;
39862
- }
39990
+ flushStream();
39863
39991
  } catch (error2) {
39864
- disposeStream(this);
39865
- controller.error(error2);
39992
+ disposeStream(state);
39993
+ readableController.error(error2);
39994
+ throw error2;
39866
39995
  }
39996
+ const result = disposeStream(state);
39997
+ if (result !== 0) {
39998
+ const error2 = setZlibCode(new Error("end error:" + result), result);
39999
+ readableController.error(error2);
40000
+ throw error2;
40001
+ }
40002
+ readableController.close();
39867
40003
  },
39868
- flush(controller) {
39869
- try {
39870
- const heap = new Uint8Array(memory.buffer);
39871
- const process2 = this._process;
39872
- const out = this.out;
39873
- while (true) {
39874
- const result = process2(this.streamHandle, 0, 0, out, outBufferSize, 4);
39875
- const code = result >> 24 & 255;
39876
- const signedCode = code & 128 ? code - 256 : code;
39877
- if (signedCode < 0) {
39878
- throw new Error("process error:" + signedCode);
39879
- }
39880
- const produced = result & 16777215;
39881
- if (produced) {
39882
- controller.enqueue(heap.slice(out, out + produced));
39883
- }
39884
- if (code === 1 || produced === 0) {
39885
- break;
39886
- }
40004
+ abort(reason) {
40005
+ disposeStream(state);
40006
+ readableController.error(reason);
40007
+ }
40008
+ }, { highWaterMark: 1 });
40009
+ return { readable, writable };
40010
+ function initStream2() {
40011
+ try {
40012
+ let result;
40013
+ state.out = malloc(outBufferSize);
40014
+ state.in = malloc(inBufferSize);
40015
+ state.inBufferSize = inBufferSize;
40016
+ if (!state.out || !state.in) {
40017
+ throw setZlibCode(new Error("allocation failed"), Z_MEM_ERROR);
40018
+ }
40019
+ if (isCompress) {
40020
+ state._process = wasm.deflate_process;
40021
+ state._last_consumed = wasm.deflate_last_consumed;
40022
+ state._end = wasm.deflate_end;
40023
+ state.streamHandle = wasm.deflate_new();
40024
+ if (type === FORMAT_GZIP2) {
40025
+ result = wasm.deflate_init_gzip(state.streamHandle, level);
40026
+ } else if (type === FORMAT_DEFLATE_RAW2) {
40027
+ result = wasm.deflate_init_raw(state.streamHandle, level);
40028
+ } else {
40029
+ result = wasm.deflate_init(state.streamHandle, level);
39887
40030
  }
39888
- } catch (error2) {
39889
- controller.error(error2);
39890
- } finally {
39891
- const result = disposeStream(this);
39892
- if (result !== 0) {
39893
- controller.error(new Error("end error:" + result));
40031
+ } else {
40032
+ if (type === FORMAT_DEFLATE64_RAW2) {
40033
+ state._process = wasm.inflate9_process;
40034
+ state._last_consumed = wasm.inflate9_last_consumed;
40035
+ state._end = wasm.inflate9_end;
40036
+ state.streamHandle = wasm.inflate9_new();
40037
+ result = wasm.inflate9_init_raw(state.streamHandle);
40038
+ } else {
40039
+ state._process = wasm.inflate_process;
40040
+ state._last_consumed = wasm.inflate_last_consumed;
40041
+ state._end = wasm.inflate_end;
40042
+ state.streamHandle = wasm.inflate_new();
40043
+ if (type === FORMAT_DEFLATE_RAW2) {
40044
+ result = wasm.inflate_init_raw(state.streamHandle);
40045
+ } else if (type === FORMAT_GZIP2) {
40046
+ result = wasm.inflate_init_gzip(state.streamHandle);
40047
+ } else {
40048
+ result = wasm.inflate_init(state.streamHandle);
40049
+ }
39894
40050
  }
39895
40051
  }
39896
- },
39897
- cancel() {
39898
- disposeStream(this);
40052
+ if (result !== 0) {
40053
+ throw setZlibCode(new Error("init failed:" + result), result);
40054
+ }
40055
+ } catch (error2) {
40056
+ disposeStream(state);
40057
+ throw error2;
39899
40058
  }
39900
- });
39901
- function disposeStream(state) {
40059
+ }
40060
+ function processChunk(chunk) {
40061
+ const heap = new Uint8Array(memory.buffer);
40062
+ const process2 = state._process;
40063
+ const last_consumed = state._last_consumed;
40064
+ const out = state.out;
40065
+ let offset = 0;
40066
+ while (offset < chunk.length) {
40067
+ if (state.streamEnded) {
40068
+ throw new Error("trailing data after the end of the stream");
40069
+ }
40070
+ const toRead = Math.min(chunk.length - offset, 32 * 1024);
40071
+ if (!state.in || state.inBufferSize < toRead) {
40072
+ if (state.in && free) {
40073
+ free(state.in);
40074
+ state.in = 0;
40075
+ }
40076
+ state.in = malloc(toRead);
40077
+ state.inBufferSize = toRead;
40078
+ if (!state.in) {
40079
+ throw setZlibCode(new Error("allocation failed"), Z_MEM_ERROR);
40080
+ }
40081
+ }
40082
+ heap.set(chunk.subarray(offset, offset + toRead), state.in);
40083
+ const result = process2(state.streamHandle, state.in, toRead, out, outBufferSize, 0);
40084
+ const code = result >> 24 & 255;
40085
+ const signedCode = code & 128 ? code - 256 : code;
40086
+ if (signedCode < 0) {
40087
+ throw setZlibCode(new Error("process error:" + signedCode), signedCode);
40088
+ }
40089
+ const prod = result & 16777215;
40090
+ if (prod) {
40091
+ enqueue(heap.slice(out, out + prod));
40092
+ }
40093
+ const consumed = last_consumed(state.streamHandle);
40094
+ if (code === 1) {
40095
+ state.streamEnded = true;
40096
+ } else if (consumed === 0 && prod === 0) {
40097
+ break;
40098
+ }
40099
+ offset += consumed;
40100
+ }
40101
+ }
40102
+ function flushStream() {
40103
+ const heap = new Uint8Array(memory.buffer);
40104
+ const process2 = state._process;
40105
+ const out = state.out;
40106
+ while (true) {
40107
+ const result = process2(state.streamHandle, 0, 0, out, outBufferSize, 4);
40108
+ const code = result >> 24 & 255;
40109
+ const signedCode = code & 128 ? code - 256 : code;
40110
+ if (signedCode < 0) {
40111
+ throw setZlibCode(new Error("process error:" + signedCode), signedCode);
40112
+ }
40113
+ const produced = result & 16777215;
40114
+ if (produced) {
40115
+ enqueue(heap.slice(out, out + produced));
40116
+ }
40117
+ if (code === 1 || produced === 0) {
40118
+ break;
40119
+ }
40120
+ }
40121
+ }
40122
+ function enqueue(chunk) {
40123
+ backpressure = true;
40124
+ readableController.enqueue(chunk);
40125
+ }
40126
+ function resumeWrite() {
40127
+ if (resolveWrite) {
40128
+ const resolve2 = resolveWrite;
40129
+ resolveWrite = null;
40130
+ resolve2();
40131
+ }
40132
+ }
40133
+ function disposeStream(state2) {
39902
40134
  let endResult = 0;
39903
- if (state.streamHandle && state._end) {
39904
- endResult = state._end(state.streamHandle);
40135
+ if (state2.streamHandle && state2._end) {
40136
+ endResult = state2._end(state2.streamHandle);
39905
40137
  }
39906
- state.streamHandle = 0;
39907
- if (state.in && free) {
39908
- free(state.in);
40138
+ state2.streamHandle = 0;
40139
+ if (state2.in && free) {
40140
+ free(state2.in);
39909
40141
  }
39910
- state.in = 0;
39911
- if (state.out && free) {
39912
- free(state.out);
40142
+ state2.in = 0;
40143
+ if (state2.out && free) {
40144
+ free(state2.out);
39913
40145
  }
39914
- state.out = 0;
40146
+ state2.out = 0;
39915
40147
  return endResult;
39916
40148
  }
39917
40149
  }
@@ -39927,8 +40159,8 @@ var DecompressionStreamZlib = class {
39927
40159
  };
39928
40160
  CompressionStreamZlib.requiresModule = true;
39929
40161
  DecompressionStreamZlib.requiresModule = true;
39930
- CompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2];
39931
- DecompressionStreamZlib.supportedFormats = [FORMAT_DEFLATE, FORMAT_DEFLATE_RAW2, FORMAT_GZIP2, FORMAT_DEFLATE64_RAW2];
40162
+ CompressionStreamZlib.supportedFormats = COMPRESSION_FORMATS;
40163
+ DecompressionStreamZlib.supportedFormats = DECOMPRESSION_FORMATS;
39932
40164
 
39933
40165
  // ../../node_modules/@zip.js/zip.js/lib/core/streams/zlib-wasm/aes-hmac-sha1-wasm.js
39934
40166
  init_constants();
@@ -40073,6 +40305,7 @@ init_constants();
40073
40305
  init_array();
40074
40306
  init_compatible_streams();
40075
40307
  init_error();
40308
+ var EMPTY_RAW_PASSWORD = new Uint8Array(0);
40076
40309
 
40077
40310
  // ../../node_modules/@zip.js/zip.js/lib/zip-fs-wasm.js
40078
40311
  e(setDefaultConfiguration);
@@ -42695,7 +42928,10 @@ var parseDetailRef = (ref) => {
42695
42928
  return void 0;
42696
42929
  if (decoded.runId !== void 0 && typeof decoded.runId !== "string")
42697
42930
  return void 0;
42698
- if (decoded.readWindow !== void 0 && (!Array.isArray(decoded.readWindow) || decoded.readWindow.length > 8 || decoded.readWindow.some((entry) => !entry || !["logs", "traces"].includes(entry.source) || !Number.isSafeInteger(entry.bytes) || entry.bytes < 0 || !/^[a-f0-9]{64}$/.test(entry.digest)))) return void 0;
42931
+ if (decoded.readWindow !== void 0 && (!Array.isArray(decoded.readWindow) || decoded.readWindow.length > 8 || decoded.readWindow.some(
42932
+ (entry) => !entry || !["logs", "traces"].includes(entry.source) || !Number.isSafeInteger(entry.bytes) || entry.bytes < 0 || !/^[a-f0-9]{64}$/.test(entry.digest)
42933
+ )))
42934
+ return void 0;
42699
42935
  return {
42700
42936
  readWindow: decoded.readWindow,
42701
42937
  advanceId: decoded.advanceId,
@@ -42760,13 +42996,20 @@ async function scanRetainedLogs(cwd, pinned) {
42760
42996
  let complete = content.subarray(0, content.lastIndexOf(10) + 1);
42761
42997
  let window;
42762
42998
  if (pinned) {
42763
- window = [...remaining].find((entry) => entry.source === source && content.length >= entry.bytes && (0, import_node_crypto3.createHash)("sha256").update(content.subarray(0, entry.bytes)).digest("hex") === entry.digest);
42999
+ window = [...remaining].find(
43000
+ (entry) => entry.source === source && content.length >= entry.bytes && (0, import_node_crypto3.createHash)("sha256").update(content.subarray(0, entry.bytes)).digest("hex") === entry.digest
43001
+ );
42764
43002
  if (!window) continue;
42765
43003
  remaining.delete(window);
42766
43004
  complete = content.subarray(0, window.bytes);
42767
43005
  } else {
42768
- if (complete.length !== content.length) warnings.push("incomplete_tail");
42769
- window = { source, bytes: complete.length, digest: (0, import_node_crypto3.createHash)("sha256").update(complete).digest("hex") };
43006
+ if (complete.length !== content.length)
43007
+ warnings.push("incomplete_tail");
43008
+ window = {
43009
+ source,
43010
+ bytes: complete.length,
43011
+ digest: (0, import_node_crypto3.createHash)("sha256").update(complete).digest("hex")
43012
+ };
42770
43013
  }
42771
43014
  readWindow.push(window);
42772
43015
  const decoded = scanFile(complete.toString("utf8"), source);
@@ -42910,7 +43153,10 @@ ${g2.identity.runId ?? ""}` === latestRun.runKey
42910
43153
  var scanExecution = async (input) => {
42911
43154
  const identity = input.detailRef === void 0 ? void 0 : parseDetailRef(input.detailRef);
42912
43155
  if (input.detailRef !== void 0 && !identity) return null;
42913
- const { facts, warnings, readWindow } = await scanRetainedLogs(input.cwd, identity?.readWindow);
43156
+ const { facts, warnings, readWindow } = await scanRetainedLogs(
43157
+ input.cwd,
43158
+ identity?.readWindow
43159
+ );
42914
43160
  if (warnings.includes("read_window_expired")) return null;
42915
43161
  if (identity) {
42916
43162
  const filtered = facts.filter(
@@ -42918,13 +43164,22 @@ var scanExecution = async (input) => {
42918
43164
  );
42919
43165
  if (!filtered.length) return null;
42920
43166
  const { readWindow: _window, ...executionIdentity } = identity;
42921
- const snapshot2 = summarize({ identity: executionIdentity, facts: filtered, observation: { warnings } });
43167
+ const snapshot2 = summarize({
43168
+ identity: executionIdentity,
43169
+ facts: filtered,
43170
+ observation: { warnings }
43171
+ });
42922
43172
  return { ...snapshot2, detailRef: input.detailRef };
42923
43173
  }
42924
43174
  const selected = selectLatestAdvance(facts, input.threadId, input.runId);
42925
43175
  if (!selected) return null;
42926
43176
  const snapshot = summarize({ ...selected, observation: { warnings } });
42927
- return { ...snapshot, detailRef: Buffer.from(JSON.stringify({ ...selected.identity, readWindow })).toString("base64") };
43177
+ return {
43178
+ ...snapshot,
43179
+ detailRef: Buffer.from(
43180
+ JSON.stringify({ ...selected.identity, readWindow })
43181
+ ).toString("base64")
43182
+ };
42928
43183
  };
42929
43184
 
42930
43185
  // src/commands/runs/contentScanner.ts
@@ -42957,22 +43212,36 @@ var scanContent = async (input) => {
42957
43212
  if (value !== void 0 && (typeof value !== "string" || !value))
42958
43213
  return null;
42959
43214
  }
42960
- if (contentRef.recordIds !== void 0 && (!Array.isArray(contentRef.recordIds) || !contentRef.recordIds.length || contentRef.recordIds.length > 128 || contentRef.recordIds.some((id) => typeof id !== "string" || !id))) return null;
43215
+ if (contentRef.recordIds !== void 0 && (!Array.isArray(contentRef.recordIds) || !contentRef.recordIds.length || contentRef.recordIds.length > 128 || contentRef.recordIds.some((id) => typeof id !== "string" || !id)))
43216
+ return null;
42961
43217
  if (input.cursor !== void 0 && !/^(0|[1-9][0-9]*)$/.test(input.cursor))
42962
43218
  return null;
42963
43219
  if (input.maxBytes !== void 0 && (!Number.isSafeInteger(input.maxBytes) || input.maxBytes < 1))
42964
43220
  return null;
42965
- const { facts, warnings } = await scanRetainedLogs(input.cwd, identity.readWindow);
42966
- if (warnings.includes("read_window_expired")) return { availability: "unavailable" };
43221
+ const { facts, warnings } = await scanRetainedLogs(
43222
+ input.cwd,
43223
+ identity.readWindow
43224
+ );
43225
+ if (warnings.includes("read_window_expired"))
43226
+ return { availability: "unavailable" };
42967
43227
  let matched = facts.find(
42968
43228
  (f3) => f3.name === ETelemetryEventName.CONTENT_RECORDED && (!identity.threadId || f3.identity.threadId === identity.threadId) && (!identity.advanceId || f3.identity.advanceId === identity.advanceId) && (!identity.runId || f3.identity.runId === identity.runId) && matchContentRef(f3, contentRef)
42969
43229
  );
42970
43230
  if (contentRef.recordIds) {
42971
- const byRecord = new Map(facts.filter((f3) => f3.name === ETelemetryEventName.CONTENT_RECORDED && f3.identity.advanceId === identity.advanceId && (!identity.threadId || f3.identity.threadId === identity.threadId) && (!identity.runId || f3.identity.runId === identity.runId) && f3.identity.operationId === contentRef.operationId).map((f3) => [f3.identity.recordId, f3]));
43231
+ const byRecord = new Map(
43232
+ facts.filter(
43233
+ (f3) => f3.name === ETelemetryEventName.CONTENT_RECORDED && f3.identity.advanceId === identity.advanceId && (!identity.threadId || f3.identity.threadId === identity.threadId) && (!identity.runId || f3.identity.runId === identity.runId) && f3.identity.operationId === contentRef.operationId
43234
+ ).map((f3) => [f3.identity.recordId, f3])
43235
+ );
42972
43236
  const chunks = contentRef.recordIds.map((id) => byRecord.get(id));
42973
43237
  if (chunks.some((chunk) => !chunk)) return { availability: "unavailable" };
42974
- const values = chunks.map((chunk) => chunk.body);
42975
- if (values.some((value) => value.section !== "model.output" || typeof value.value !== "string")) return null;
43238
+ const values = chunks.map(
43239
+ (chunk) => chunk.body
43240
+ );
43241
+ if (values.some(
43242
+ (value) => value.section !== "model.output" || typeof value.value !== "string"
43243
+ ))
43244
+ return null;
42976
43245
  const prefix = [];
42977
43246
  for (const value of values) {
42978
43247
  if (value.chunkIndex !== prefix.length) break;
@@ -42980,7 +43249,13 @@ var scanContent = async (input) => {
42980
43249
  }
42981
43250
  if (!prefix.length) return { availability: "unavailable" };
42982
43251
  const complete = prefix.length === values.length && prefix.at(-1)?.final && prefix.at(-1)?.availability === "available";
42983
- matched = { ...chunks[0], body: { value: prefix.map((value) => value.value).join(""), availability: complete ? "available" : "partial" } };
43252
+ matched = {
43253
+ ...chunks[0],
43254
+ body: {
43255
+ value: prefix.map((value) => value.value).join(""),
43256
+ availability: complete ? "available" : "partial"
43257
+ }
43258
+ };
42984
43259
  }
42985
43260
  if (!matched) {
42986
43261
  return { availability: "unavailable" };