@php-wasm/web 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,30 +1,30 @@
1
1
  import { PHPResponse as Le, LatestSupportedPHPVersion as me, FSHelpers as R, loadPHPRuntime as ge, __private__dont__use as q } from "@php-wasm/universal";
2
2
  import * as E from "comlink";
3
3
  import { jspi as Ke } from "wasm-feature-detect";
4
+ import { concatArrayBuffers as B, concatUint8Arrays as u, Semaphore as Ie, joinPaths as oe, basename as De } from "@php-wasm/util";
4
5
  import { logger as v } from "@php-wasm/logger";
5
- import { teeRequest as Ie, cloneRequest as De } from "@php-wasm/web-service-worker";
6
- import { Semaphore as We, joinPaths as oe, basename as Re } from "@php-wasm/util";
7
- import { journalFSEvents as be } from "@php-wasm/fs-journal";
8
- function pt(s, e = void 0) {
6
+ import { teeRequest as We, cloneRequest as Re } from "@php-wasm/web-service-worker";
7
+ import { journalFSEvents as be, normalizeFilesystemOperations as Pe } from "@php-wasm/fs-journal";
8
+ function wt(s, e = void 0) {
9
9
  ce();
10
10
  const t = s instanceof Worker ? s : E.windowEndpoint(s, e), r = E.wrap(t), n = j(r);
11
11
  return new Proxy(n, {
12
12
  get: (i, a) => a === "isConnected" ? async () => {
13
13
  for (; ; )
14
14
  try {
15
- await Pe(r.isConnected(), 200);
15
+ await Be(r.isConnected(), 200);
16
16
  break;
17
17
  } catch {
18
18
  }
19
19
  } : r[a]
20
20
  });
21
21
  }
22
- async function Pe(s, e) {
22
+ async function Be(s, e) {
23
23
  return new Promise((t, r) => {
24
24
  setTimeout(r, e), s.then(t);
25
25
  });
26
26
  }
27
- function wt(s, e) {
27
+ function yt(s, e) {
28
28
  ce();
29
29
  const t = Promise.resolve();
30
30
  let r, n;
@@ -95,7 +95,7 @@ function j(s) {
95
95
  }
96
96
  });
97
97
  }
98
- async function Be(s = me) {
98
+ async function Ue(s = me) {
99
99
  if (await Ke())
100
100
  switch (s) {
101
101
  case "8.4":
@@ -139,18 +139,6 @@ async function Be(s = me) {
139
139
  function p(s) {
140
140
  return Object.fromEntries(Object.entries(s).map(([e, t]) => [t, e]));
141
141
  }
142
- function u(s) {
143
- let e = 0;
144
- s.forEach((n) => e += n.length);
145
- const t = new Uint8Array(e);
146
- let r = 0;
147
- return s.forEach((n) => {
148
- t.set(n, r), r += n.length;
149
- }), t;
150
- }
151
- function B(s) {
152
- return u(s.map((e) => new Uint8Array(e))).buffer;
153
- }
154
142
  function I(s) {
155
143
  return new Uint8Array([s >> 8 & 255, s & 255]);
156
144
  }
@@ -260,9 +248,9 @@ const b = {
260
248
  key_share: 51,
261
249
  transparency_info: 52,
262
250
  connection_id: 54
263
- }, Ue = p(b), Se = {
251
+ }, ve = p(b), Se = {
264
252
  host_name: 0
265
- }, ve = p(Se);
253
+ }, Me = p(Se);
266
254
  class Ce {
267
255
  static decodeFromClient(e) {
268
256
  const t = new DataView(e.buffer);
@@ -279,7 +267,7 @@ class Ce {
279
267
  switch (r += _, a) {
280
268
  case Se.host_name:
281
269
  i.push({
282
- name_type: ve[a],
270
+ name_type: Me[a],
283
271
  name: {
284
272
  host_name: new TextDecoder().decode(c)
285
273
  }
@@ -521,7 +509,7 @@ const he = {
521
509
  x25519: 29,
522
510
  x448: 30
523
511
  }, J = p(le);
524
- class Me {
512
+ class Ne {
525
513
  /**
526
514
  * +--------------------------------------------------+
527
515
  * | Payload Length [2B] |
@@ -567,7 +555,7 @@ const Ae = {
567
555
  ansiX962_compressed_prime: 1,
568
556
  ansiX962_compressed_char2: 2
569
557
  }, X = p(Ae);
570
- class Ne {
558
+ class xe {
571
559
  /**
572
560
  * +--------------------------------------------------+
573
561
  * | Payload Length [2B] |
@@ -624,7 +612,7 @@ const G = {
624
612
  sha384: 5,
625
613
  sha512: 6
626
614
  }, ee = p($);
627
- class xe {
615
+ class ke {
628
616
  /**
629
617
  * Binary layout:
630
618
  *
@@ -677,14 +665,14 @@ class xe {
677
665
  }
678
666
  const te = {
679
667
  server_name: Ce,
680
- signature_algorithms: xe,
681
- supported_groups: Me,
682
- ec_point_formats: Ne
668
+ signature_algorithms: ke,
669
+ supported_groups: Ne,
670
+ ec_point_formats: xe
683
671
  };
684
- function ke(s) {
672
+ function qe(s) {
685
673
  const e = new m(s.buffer), t = [];
686
674
  for (; !e.isFinished(); ) {
687
- const r = e.offset, n = e.readUint16(), i = Ue[n], a = e.readUint16(), _ = e.readUint8Array(a);
675
+ const r = e.offset, n = e.readUint16(), i = ve[n], a = e.readUint16(), _ = e.readUint8Array(a);
688
676
  if (!(i in te))
689
677
  continue;
690
678
  const c = te[i];
@@ -720,12 +708,12 @@ async function re(s, e) {
720
708
  e
721
709
  );
722
710
  }
723
- const qe = {
711
+ const Oe = {
724
712
  Null: 0
725
- }, Oe = {
713
+ }, Fe = {
726
714
  Warning: 1,
727
715
  Fatal: 2
728
- }, ue = p(Oe), Fe = {
716
+ }, ue = p(Fe), je = {
729
717
  CloseNotify: 0,
730
718
  UnexpectedMessage: 10,
731
719
  BadRecordMac: 20,
@@ -751,7 +739,7 @@ const qe = {
751
739
  UserCanceled: 90,
752
740
  NoRenegotiation: 100,
753
741
  UnsupportedExtension: 110
754
- }, He = p(Fe), C = {
742
+ }, He = p(je), C = {
755
743
  ChangeCipherSpec: 20,
756
744
  Alert: 21,
757
745
  Handshake: 22,
@@ -765,7 +753,7 @@ const qe = {
765
753
  ServerHelloDone: 14,
766
754
  ClientKeyExchange: 16,
767
755
  Finished: 20
768
- }, je = {
756
+ }, Ge = {
769
757
  /**
770
758
  * Indicates that a named curve is used. This option
771
759
  * SHOULD be used when applicable.
@@ -774,12 +762,12 @@ const qe = {
774
762
  /**
775
763
  * Values 248 through 255 are reserved for private use.
776
764
  */
777
- }, Ge = {
765
+ }, $e = {
778
766
  secp256r1: 23
779
767
  };
780
768
  class ne extends Error {
781
769
  }
782
- const U = new Uint8Array([3, 3]), $e = crypto.subtle.generateKey(
770
+ const U = new Uint8Array([3, 3]), ze = crypto.subtle.generateKey(
783
771
  {
784
772
  name: "ECDH",
785
773
  namedCurve: "P-256"
@@ -790,7 +778,7 @@ const U = new Uint8Array([3, 3]), $e = crypto.subtle.generateKey(
790
778
  ["deriveKey", "deriveBits"]
791
779
  // Key usage
792
780
  );
793
- class ze {
781
+ class Ve {
794
782
  constructor() {
795
783
  this.receivedRecordSequenceNumber = 0, this.sentRecordSequenceNumber = 0, this.closed = !1, this.receivedBytesBuffer = new Uint8Array(), this.receivedTLSRecords = [], this.partialTLSMessages = {}, this.handshakeMessages = [], this.MAX_CHUNK_SIZE = 1024 * 16, this.clientEnd = {
796
784
  // We don't need to chunk the encrypted data.
@@ -807,7 +795,7 @@ class ze {
807
795
  * This will spread some messages across multiple records,
808
796
  * but TLS supports it so that's fine.
809
797
  */
810
- downstream: Ve(this.MAX_CHUNK_SIZE)
798
+ downstream: Ye(this.MAX_CHUNK_SIZE)
811
799
  }, this.serverUpstreamWriter = this.serverEnd.upstream.writable.getWriter();
812
800
  const e = this;
813
801
  this.serverEnd.downstream.readable.pipeTo(
@@ -876,13 +864,13 @@ class ze {
876
864
  K.serverHello(
877
865
  r.body,
878
866
  n,
879
- qe.Null
867
+ Oe.Null
880
868
  )
881
869
  ), await this.writeTLSRecord(
882
870
  C.Handshake,
883
871
  K.certificate(t)
884
872
  );
885
- const i = await $e, a = r.body.random, _ = await K.ECDHEServerKeyExchange(
873
+ const i = await ze, a = r.body.random, _ = await K.ECDHEServerKeyExchange(
886
874
  a,
887
875
  n,
888
876
  i,
@@ -1299,7 +1287,7 @@ class T {
1299
1287
  a
1300
1288
  );
1301
1289
  const _ = t.readUint16();
1302
- return r.extensions = ke(
1290
+ return r.extensions = qe(
1303
1291
  t.readUint8Array(_)
1304
1292
  ), r;
1305
1293
  }
@@ -1324,7 +1312,7 @@ class T {
1324
1312
  };
1325
1313
  }
1326
1314
  }
1327
- function Ve(s) {
1315
+ function Ye(s) {
1328
1316
  return new TransformStream({
1329
1317
  transform(e, t) {
1330
1318
  for (; e.length > 0; )
@@ -1385,9 +1373,9 @@ class K {
1385
1373
  await crypto.subtle.exportKey("raw", r.publicKey)
1386
1374
  ), a = new Uint8Array([
1387
1375
  // Curve type (1 byte)
1388
- je.NamedCurve,
1376
+ Ge.NamedCurve,
1389
1377
  // Curve name (2 bytes)
1390
- ...I(Ge.secp256r1),
1378
+ ...I($e.secp256r1),
1391
1379
  // Public key length (1 byte)
1392
1380
  i.byteLength,
1393
1381
  // Public key (65 bytes, uncompressed format)
@@ -1520,17 +1508,17 @@ class K {
1520
1508
  return new Uint8Array([1]);
1521
1509
  }
1522
1510
  }
1523
- function Ye(s, e) {
1524
- return Ze.generateCertificate(s, e);
1511
+ function Ze(s, e) {
1512
+ return Je.generateCertificate(s, e);
1525
1513
  }
1526
- function yt(s) {
1514
+ function Lt(s) {
1527
1515
  return `-----BEGIN CERTIFICATE-----
1528
1516
  ${fe(
1529
1517
  de(s.buffer)
1530
1518
  )}
1531
1519
  -----END CERTIFICATE-----`;
1532
1520
  }
1533
- async function Lt(s) {
1521
+ async function mt(s) {
1534
1522
  const e = await crypto.subtle.exportKey("pkcs8", s);
1535
1523
  return `-----BEGIN PRIVATE KEY-----
1536
1524
  ${fe(
@@ -1538,7 +1526,7 @@ ${fe(
1538
1526
  )}
1539
1527
  -----END PRIVATE KEY-----`;
1540
1528
  }
1541
- class Ze {
1529
+ class Je {
1542
1530
  static async generateCertificate(e, t) {
1543
1531
  const r = await crypto.subtle.generateKey(
1544
1532
  {
@@ -1644,7 +1632,7 @@ class Ze {
1644
1632
  H.UTCTime,
1645
1633
  new TextEncoder().encode(
1646
1634
  ie(
1647
- (e == null ? void 0 : e.notAfter) ?? Xe(/* @__PURE__ */ new Date(), 10)
1635
+ (e == null ? void 0 : e.notAfter) ?? Qe(/* @__PURE__ */ new Date(), 10)
1648
1636
  )
1649
1637
  )
1650
1638
  )
@@ -1710,7 +1698,7 @@ class Ze {
1710
1698
  ]);
1711
1699
  }
1712
1700
  }
1713
- const Je = {
1701
+ const Xe = {
1714
1702
  // Algorithm OIDs
1715
1703
  "1.2.840.113549.1.1.1": "rsaEncryption",
1716
1704
  "1.2.840.113549.1.1.4": "md5WithRSAEncryption",
@@ -1821,7 +1809,7 @@ const Je = {
1821
1809
  "1.3.6.1.5.5.7.3.8": "timeStamping"
1822
1810
  };
1823
1811
  function w(s) {
1824
- for (const [e, t] of Object.entries(Je))
1812
+ for (const [e, t] of Object.entries(Xe))
1825
1813
  if (t === s)
1826
1814
  return e;
1827
1815
  throw new Error(`OID not found for name: ${s}`);
@@ -1936,27 +1924,27 @@ function ie(s) {
1936
1924
  function W(s) {
1937
1925
  return s.toString().padStart(2, "0");
1938
1926
  }
1939
- function Xe(s, e) {
1927
+ function Qe(s, e) {
1940
1928
  const t = new Date(s);
1941
1929
  return t.setUTCFullYear(t.getUTCFullYear() + e), t;
1942
1930
  }
1943
- async function Qe(s, e, t) {
1931
+ async function et(s, e, t) {
1944
1932
  var a;
1945
1933
  const r = typeof s == "string" ? new Request(s, e) : s;
1946
1934
  if (!t)
1947
1935
  return await fetch(r);
1948
- const [n, i] = await Ie(r);
1936
+ const [n, i] = await We(r);
1949
1937
  try {
1950
1938
  return await fetch(n);
1951
1939
  } catch {
1952
- const c = ((a = new Headers(i.headers).get("x-cors-proxy-allowed-request-headers")) == null ? void 0 : a.split(",")) || [], S = c.includes("authorization") || c.includes("cookie"), h = await De(i, {
1940
+ const c = ((a = new Headers(i.headers).get("x-cors-proxy-allowed-request-headers")) == null ? void 0 : a.split(",")) || [], S = c.includes("authorization") || c.includes("cookie"), h = await Re(i, {
1953
1941
  url: `${t}${r.url}`,
1954
1942
  ...S && { credentials: "include" }
1955
1943
  });
1956
1944
  return await fetch(h, e);
1957
1945
  }
1958
1946
  }
1959
- class et extends TransformStream {
1947
+ class tt extends TransformStream {
1960
1948
  constructor() {
1961
1949
  let e = new Uint8Array(0), t = "SCAN_CHUNK_SIZE", r = 0;
1962
1950
  super({
@@ -2009,7 +1997,7 @@ class et extends TransformStream {
2009
1997
  });
2010
1998
  }
2011
1999
  }
2012
- const tt = (s, e) => ({
2000
+ const rt = (s, e) => ({
2013
2001
  ...s,
2014
2002
  websocket: {
2015
2003
  url: (t, r, n) => `ws://playground.internal/?${new URLSearchParams({
@@ -2017,7 +2005,7 @@ const tt = (s, e) => ({
2017
2005
  port: n
2018
2006
  }).toString()}`,
2019
2007
  subprotocol: "binary",
2020
- decorator: () => class extends rt {
2008
+ decorator: () => class extends nt {
2021
2009
  constructor(t, r) {
2022
2010
  super(t, r, {
2023
2011
  CAroot: e.CAroot,
@@ -2027,7 +2015,7 @@ const tt = (s, e) => ({
2027
2015
  }
2028
2016
  }
2029
2017
  });
2030
- class rt {
2018
+ class nt {
2031
2019
  constructor(e, t, {
2032
2020
  CAroot: r,
2033
2021
  corsProxyUrl: n,
@@ -2098,7 +2086,7 @@ class rt {
2098
2086
  switch (this.bufferedBytesFromClient = u([
2099
2087
  this.bufferedBytesFromClient,
2100
2088
  new Uint8Array(e)
2101
- ]), st(this.port, this.bufferedBytesFromClient)) {
2089
+ ]), it(this.port, this.bufferedBytesFromClient)) {
2102
2090
  case !1:
2103
2091
  return;
2104
2092
  case "other":
@@ -2117,7 +2105,7 @@ class rt {
2117
2105
  throw new Error(
2118
2106
  "TLS protocol is only supported when the TCPOverFetchWebsocket is instantiated with a CAroot"
2119
2107
  );
2120
- const e = await Ye(
2108
+ const e = await Ze(
2121
2109
  {
2122
2110
  subject: {
2123
2111
  commonName: this.host,
@@ -2127,7 +2115,7 @@ class rt {
2127
2115
  issuer: this.CAroot.tbsDescription.subject
2128
2116
  },
2129
2117
  this.CAroot.keyPair
2130
- ), t = new ze();
2118
+ ), t = new Ve();
2131
2119
  this.clientUpstream.readable.pipeTo(t.clientEnd.upstream.writable).catch(() => {
2132
2120
  }), t.clientEnd.downstream.readable.pipeTo(this.clientDownstream.writable).catch(() => {
2133
2121
  }), await t.TLSHandshake(e.keyPair.privateKey, [
@@ -2165,7 +2153,7 @@ class rt {
2165
2153
  this.emit("message", { data: new Uint8Array(0) }), this.readyState = this.CLOSING, this.emit("close"), this.readyState = this.CLOSED;
2166
2154
  }
2167
2155
  }
2168
- const nt = [
2156
+ const st = [
2169
2157
  "GET",
2170
2158
  "POST",
2171
2159
  "HEAD",
@@ -2175,7 +2163,7 @@ const nt = [
2175
2163
  "PUT",
2176
2164
  "TRACE"
2177
2165
  ];
2178
- function st(s, e) {
2166
+ function it(s, e) {
2179
2167
  if (e.length < 8)
2180
2168
  return !1;
2181
2169
  if (s === 443 && e[0] === C.Handshake && // TLS versions between 1.0 and 1.2
@@ -2184,7 +2172,7 @@ function st(s, e) {
2184
2172
  const r = new TextDecoder("latin1", {
2185
2173
  fatal: !0
2186
2174
  }).decode(e);
2187
- return nt.some(
2175
+ return st.some(
2188
2176
  (i) => r.startsWith(i + " ")
2189
2177
  ) ? "http" : "other";
2190
2178
  }
@@ -2198,7 +2186,7 @@ class L {
2198
2186
  var _;
2199
2187
  let n;
2200
2188
  try {
2201
- n = await Qe(
2189
+ n = await et(
2202
2190
  e,
2203
2191
  void 0,
2204
2192
  t
@@ -2264,7 +2252,7 @@ Content-Length: 0\r
2264
2252
  i = !0;
2265
2253
  break;
2266
2254
  }
2267
- n = u([n, P]), a = it(
2255
+ n = u([n, P]), a = at(
2268
2256
  n,
2269
2257
  new Uint8Array([13, 10, 13, 10])
2270
2258
  );
@@ -2298,7 +2286,7 @@ Content-Length: 0\r
2298
2286
  }
2299
2287
  }
2300
2288
  }), h === "chunked" && (f = f.pipeThrough(
2301
- new et()
2289
+ new tt()
2302
2290
  ));
2303
2291
  }
2304
2292
  const N = S.headers.get("Host") ?? t, z = new URL(S.path, r + "://" + N);
@@ -2325,7 +2313,7 @@ Content-Length: 0\r
2325
2313
  return { method: n, path: i, headers: a };
2326
2314
  }
2327
2315
  }
2328
- function it(s, e) {
2316
+ function at(s, e) {
2329
2317
  const t = s.length, r = e.length, n = t - r;
2330
2318
  for (let i = 0; i <= n; i++) {
2331
2319
  let a = !0;
@@ -2339,7 +2327,7 @@ function it(s, e) {
2339
2327
  }
2340
2328
  return -1;
2341
2329
  }
2342
- async function at(s) {
2330
+ async function _t(s) {
2343
2331
  const e = "icudt74l.dat", t = (await import("./shared/icudt74l.js")).dataFilename, r = await (await fetch(t)).arrayBuffer();
2344
2332
  return {
2345
2333
  ...s,
@@ -2358,7 +2346,7 @@ async function at(s) {
2358
2346
  }
2359
2347
  };
2360
2348
  }
2361
- const _t = () => ({
2349
+ const ot = () => ({
2362
2350
  websocket: {
2363
2351
  decorator: (s) => class extends s {
2364
2352
  constructor() {
@@ -2373,23 +2361,23 @@ const _t = () => ({
2373
2361
  }
2374
2362
  }
2375
2363
  });
2376
- async function gt(s, e = {}) {
2364
+ async function Kt(s, e = {}) {
2377
2365
  var i;
2378
2366
  let t = {
2379
- ..._t(),
2367
+ ...ot(),
2380
2368
  ...e.emscriptenOptions || {}
2381
2369
  };
2382
- e.tcpOverFetch && (t = tt(
2370
+ e.tcpOverFetch && (t = rt(
2383
2371
  t,
2384
2372
  e.tcpOverFetch
2385
- )), e.withICU && (t = at(t));
2373
+ )), e.withICU && (t = _t(t));
2386
2374
  const [r, n] = await Promise.all([
2387
- Be(s),
2375
+ Ue(s),
2388
2376
  t
2389
2377
  ]);
2390
2378
  return (i = e.onPhpLoaderModuleLoaded) == null || i.call(e, r), await ge(r, n);
2391
2379
  }
2392
- function Kt(s, e) {
2380
+ function It(s, e) {
2393
2381
  window.addEventListener("message", (t) => {
2394
2382
  t.source === s.contentWindow && (e && t.origin !== e || typeof t.data != "object" || t.data.type !== "relay" || window.parent.postMessage(t.data, "*"));
2395
2383
  }), window.addEventListener("message", (t) => {
@@ -2397,7 +2385,7 @@ function Kt(s, e) {
2397
2385
  t.source === window.parent && (typeof t.data != "object" || t.data.type !== "relay" || (r = s == null ? void 0 : s.contentWindow) == null || r.postMessage(t.data));
2398
2386
  });
2399
2387
  }
2400
- async function It(s) {
2388
+ async function Dt(s) {
2401
2389
  const e = new Worker(s, { type: "module" });
2402
2390
  return new Promise((t, r) => {
2403
2391
  e.onerror = (i) => {
@@ -2412,7 +2400,7 @@ async function It(s) {
2412
2400
  e.addEventListener("message", n);
2413
2401
  });
2414
2402
  }
2415
- function Dt(s, e = { initialSync: {} }) {
2403
+ function Wt(s, e = { initialSync: {} }) {
2416
2404
  return e = {
2417
2405
  ...e,
2418
2406
  initialSync: {
@@ -2420,17 +2408,17 @@ function Dt(s, e = { initialSync: {} }) {
2420
2408
  direction: e.initialSync.direction ?? "opfs-to-memfs"
2421
2409
  }
2422
2410
  }, async function(t, r, n) {
2423
- return e.initialSync.direction === "opfs-to-memfs" ? (R.fileExists(r, n) && R.rmdir(r, n), R.mkdir(r, n), await ot(r, s, n)) : await Te(
2411
+ return e.initialSync.direction === "opfs-to-memfs" ? (R.fileExists(r, n) && R.rmdir(r, n), R.mkdir(r, n), await ct(r, s, n)) : await Te(
2424
2412
  r,
2425
2413
  s,
2426
2414
  n,
2427
2415
  e.initialSync.onProgress
2428
- ), St(t, s, n);
2416
+ ), Ct(t, s, n);
2429
2417
  };
2430
2418
  }
2431
- async function ot(s, e, t) {
2419
+ async function ct(s, e, t) {
2432
2420
  R.mkdir(s, t);
2433
- const r = new We({
2421
+ const r = new Ie({
2434
2422
  concurrency: 40
2435
2423
  }), n = [], i = [
2436
2424
  [e, t]
@@ -2479,7 +2467,7 @@ async function Te(s, e, t, r) {
2479
2467
  (A) => A !== "." && A !== ".."
2480
2468
  ).map(async (A) => {
2481
2469
  const f = oe(h, A);
2482
- if (!ct(s, f)) {
2470
+ if (!St(s, f)) {
2483
2471
  n.push([l, f, A]);
2484
2472
  return;
2485
2473
  }
@@ -2492,7 +2480,7 @@ async function Te(s, e, t, r) {
2492
2480
  }
2493
2481
  await i(t, e);
2494
2482
  let a = 0;
2495
- const _ = r && lt(r, 100), c = 100, S = /* @__PURE__ */ new Set();
2483
+ const _ = r && At(r, 100), c = 100, S = /* @__PURE__ */ new Set();
2496
2484
  try {
2497
2485
  for (const [h, l, A] of n) {
2498
2486
  const f = F(
@@ -2515,7 +2503,7 @@ async function Te(s, e, t, r) {
2515
2503
  await Promise.allSettled(S);
2516
2504
  }
2517
2505
  }
2518
- function ct(s, e) {
2506
+ function St(s, e) {
2519
2507
  return s.isDir(s.lookupPath(e, { follow: !0 }).node.mode);
2520
2508
  }
2521
2509
  async function F(s, e, t, r) {
@@ -2540,15 +2528,19 @@ async function F(s, e, t, r) {
2540
2528
  await a.close();
2541
2529
  }
2542
2530
  }
2543
- function St(s, e, t) {
2531
+ function Ct(s, e, t) {
2544
2532
  const r = [], n = be(s, t, (_) => {
2545
2533
  r.push(_);
2546
- }), i = new Ct(s, e, t);
2534
+ }), i = new ht(s, e, t);
2547
2535
  async function a() {
2548
- const _ = await s.semaphore.acquire();
2536
+ if (r.length === 0)
2537
+ return;
2538
+ const _ = await s.semaphore.acquire(), c = [...r];
2539
+ r.splice(0, c.length);
2540
+ const S = Pe(c);
2549
2541
  try {
2550
- for (; r.length; )
2551
- await i.processEntry(r.shift());
2542
+ for (const h of S)
2543
+ await i.processEntry(h);
2552
2544
  } finally {
2553
2545
  _();
2554
2546
  }
@@ -2557,7 +2549,7 @@ function St(s, e, t) {
2557
2549
  n(), s.removeEventListener("request.end", a);
2558
2550
  };
2559
2551
  }
2560
- class Ct {
2552
+ class ht {
2561
2553
  constructor(e, t, r) {
2562
2554
  this.php = e, this.opfs = t, this.memfsRoot = ae(r);
2563
2555
  }
@@ -2567,7 +2559,7 @@ class Ct {
2567
2559
  async processEntry(e) {
2568
2560
  if (!e.path.startsWith(this.memfsRoot) || e.path === this.memfsRoot)
2569
2561
  return;
2570
- const t = this.toOpfsPath(e.path), r = await _e(this.opfs, t), n = ht(t);
2562
+ const t = this.toOpfsPath(e.path), r = await _e(this.opfs, t), n = lt(t);
2571
2563
  if (n)
2572
2564
  try {
2573
2565
  if (e.operation === "DELETE")
@@ -2616,7 +2608,7 @@ class Ct {
2616
2608
  }
2617
2609
  await F(
2618
2610
  a,
2619
- Re(i),
2611
+ De(i),
2620
2612
  this.php[q].FS,
2621
2613
  e.toPath
2622
2614
  );
@@ -2630,7 +2622,7 @@ class Ct {
2630
2622
  function ae(s) {
2631
2623
  return s.replace(/\/$/, "").replace(/\/\/+/g, "/");
2632
2624
  }
2633
- function ht(s) {
2625
+ function lt(s) {
2634
2626
  return s.substring(s.lastIndexOf("/") + 1);
2635
2627
  }
2636
2628
  async function _e(s, e) {
@@ -2645,7 +2637,7 @@ async function _e(s, e) {
2645
2637
  }
2646
2638
  return n;
2647
2639
  }
2648
- function lt(s, e) {
2640
+ function At(s, e) {
2649
2641
  let t = 0, r, n;
2650
2642
  return function(...a) {
2651
2643
  n = a;
@@ -2659,16 +2651,16 @@ function lt(s, e) {
2659
2651
  };
2660
2652
  }
2661
2653
  export {
2662
- yt as certificateToPEM,
2663
- pt as consumeAPI,
2664
- Dt as createDirectoryHandleMountHandler,
2665
- wt as exposeAPI,
2666
- Qe as fetchWithCorsProxy,
2667
- Ye as generateCertificate,
2668
- Be as getPHPLoaderModule,
2669
- gt as loadWebRuntime,
2670
- Lt as privateKeyToPEM,
2671
- Kt as setupPostMessageRelay,
2672
- It as spawnPHPWorkerThread
2654
+ Lt as certificateToPEM,
2655
+ wt as consumeAPI,
2656
+ Wt as createDirectoryHandleMountHandler,
2657
+ yt as exposeAPI,
2658
+ et as fetchWithCorsProxy,
2659
+ Ze as generateCertificate,
2660
+ Ue as getPHPLoaderModule,
2661
+ Kt as loadWebRuntime,
2662
+ mt as privateKeyToPEM,
2663
+ It as setupPostMessageRelay,
2664
+ Dt as spawnPHPWorkerThread
2673
2665
  };
2674
2666
  //# sourceMappingURL=index.js.map