@php-wasm/web 0.9.13 → 0.9.14
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 +542 -784
- package/package.json +7 -7
package/index.js
CHANGED
|
@@ -1,73 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import "/home/runner/work/wordpress-playground/wordpress-playground/node_modules/ini/lib/ini.js";
|
|
2
|
+
import * as m from "/home/runner/work/wordpress-playground/wordpress-playground/node_modules/comlink/dist/esm/comlink.mjs";
|
|
3
|
+
const F = function() {
|
|
4
|
+
var r;
|
|
5
|
+
return typeof process < "u" && ((r = process.release) == null ? void 0 : r.name) === "node" ? "NODE" : typeof window < "u" ? "WEB" : (
|
|
4
6
|
// @ts-ignore
|
|
5
7
|
typeof WorkerGlobalScope < "u" && // @ts-ignore
|
|
6
8
|
self instanceof WorkerGlobalScope ? "WORKER" : "NODE"
|
|
7
9
|
);
|
|
8
10
|
}();
|
|
9
|
-
if (
|
|
10
|
-
let
|
|
11
|
-
return new Promise(function(n,
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (F === "NODE") {
|
|
12
|
+
let r = function(t) {
|
|
13
|
+
return new Promise(function(n, o) {
|
|
14
|
+
t.onload = t.onerror = function(i) {
|
|
15
|
+
t.onload = t.onerror = null, i.type === "load" ? n(t.result) : o(new Error("Failed to read the blob/file"));
|
|
14
16
|
};
|
|
15
17
|
});
|
|
16
|
-
},
|
|
17
|
-
const
|
|
18
|
+
}, e = function() {
|
|
19
|
+
const t = new Uint8Array([1, 2, 3, 4]), o = new File([t], "test").stream();
|
|
18
20
|
try {
|
|
19
|
-
return
|
|
21
|
+
return o.getReader({ mode: "byob" }), !0;
|
|
20
22
|
} catch {
|
|
21
23
|
return !1;
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
26
|
if (typeof File > "u") {
|
|
25
|
-
class
|
|
26
|
-
constructor(
|
|
27
|
-
super(
|
|
27
|
+
class t extends Blob {
|
|
28
|
+
constructor(o, i, s) {
|
|
29
|
+
super(o);
|
|
28
30
|
let a;
|
|
29
|
-
|
|
31
|
+
s != null && s.lastModified && (a = /* @__PURE__ */ new Date()), (!a || isNaN(a.getFullYear())) && (a = /* @__PURE__ */ new Date()), this.lastModifiedDate = a, this.lastModified = a.getMilliseconds(), this.name = i || "";
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
global.File =
|
|
34
|
+
global.File = t;
|
|
33
35
|
}
|
|
34
36
|
typeof Blob.prototype.arrayBuffer > "u" && (Blob.prototype.arrayBuffer = function() {
|
|
35
37
|
const n = new FileReader();
|
|
36
|
-
return n.readAsArrayBuffer(this),
|
|
38
|
+
return n.readAsArrayBuffer(this), r(n);
|
|
37
39
|
}), typeof Blob.prototype.text > "u" && (Blob.prototype.text = function() {
|
|
38
40
|
const n = new FileReader();
|
|
39
|
-
return n.readAsText(this),
|
|
40
|
-
}), (typeof Blob.prototype.stream > "u" || !
|
|
41
|
-
let
|
|
41
|
+
return n.readAsText(this), r(n);
|
|
42
|
+
}), (typeof Blob.prototype.stream > "u" || !e()) && (Blob.prototype.stream = function() {
|
|
43
|
+
let t = 0;
|
|
42
44
|
const n = this;
|
|
43
45
|
return new ReadableStream({
|
|
44
46
|
type: "bytes",
|
|
45
47
|
// 0.5 MB seems like a reasonable chunk size, let's adjust
|
|
46
48
|
// this if needed.
|
|
47
49
|
autoAllocateChunkSize: 512 * 1024,
|
|
48
|
-
async pull(
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
).arrayBuffer(),
|
|
53
|
-
new Uint8Array(
|
|
54
|
-
const l =
|
|
55
|
-
|
|
50
|
+
async pull(o) {
|
|
51
|
+
const i = o.byobRequest.view, a = await n.slice(
|
|
52
|
+
t,
|
|
53
|
+
t + i.byteLength
|
|
54
|
+
).arrayBuffer(), c = new Uint8Array(a);
|
|
55
|
+
new Uint8Array(i.buffer).set(c);
|
|
56
|
+
const l = c.byteLength;
|
|
57
|
+
o.byobRequest.respond(l), t += l, t >= n.size && o.close();
|
|
56
58
|
}
|
|
57
59
|
});
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
|
-
if (
|
|
61
|
-
class
|
|
62
|
-
constructor(
|
|
63
|
-
super(
|
|
62
|
+
if (F === "NODE" && typeof CustomEvent > "u") {
|
|
63
|
+
class r extends Event {
|
|
64
|
+
constructor(t, n = {}) {
|
|
65
|
+
super(t, n), this.detail = n.detail;
|
|
64
66
|
}
|
|
65
67
|
initCustomEvent() {
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
globalThis.CustomEvent =
|
|
70
|
+
globalThis.CustomEvent = r;
|
|
69
71
|
}
|
|
70
|
-
const
|
|
72
|
+
const k = {
|
|
71
73
|
0: "No error occurred. System call completed successfully.",
|
|
72
74
|
1: "Argument list too long.",
|
|
73
75
|
2: "Permission denied.",
|
|
@@ -146,21 +148,21 @@ const x = {
|
|
|
146
148
|
75: "Cross-device link.",
|
|
147
149
|
76: "Extension: Capabilities insufficient."
|
|
148
150
|
};
|
|
149
|
-
function
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
return
|
|
151
|
+
function j(r) {
|
|
152
|
+
const e = typeof r == "object" ? r == null ? void 0 : r.errno : null;
|
|
153
|
+
if (e in k)
|
|
154
|
+
return k[e];
|
|
153
155
|
}
|
|
154
|
-
function y(
|
|
155
|
-
return function(
|
|
156
|
-
const
|
|
157
|
-
|
|
156
|
+
function y(r = "") {
|
|
157
|
+
return function(t, n, o) {
|
|
158
|
+
const i = o.value;
|
|
159
|
+
o.value = function(...s) {
|
|
158
160
|
try {
|
|
159
|
-
return
|
|
161
|
+
return i.apply(this, s);
|
|
160
162
|
} catch (a) {
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
const l =
|
|
163
|
+
const c = typeof a == "object" ? a == null ? void 0 : a.errno : null;
|
|
164
|
+
if (c in k) {
|
|
165
|
+
const l = k[c], u = typeof s[1] == "string" ? s[1] : null, d = u !== null ? r.replaceAll("{path}", u) : r;
|
|
164
166
|
throw new Error(`${d}: ${l}`, {
|
|
165
167
|
cause: a
|
|
166
168
|
});
|
|
@@ -170,61 +172,61 @@ function y(e = "") {
|
|
|
170
172
|
};
|
|
171
173
|
};
|
|
172
174
|
}
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
new CustomEvent(
|
|
175
|
+
const J = "playground-log", D = (r, ...e) => {
|
|
176
|
+
E.dispatchEvent(
|
|
177
|
+
new CustomEvent(J, {
|
|
176
178
|
detail: {
|
|
177
|
-
log:
|
|
178
|
-
args:
|
|
179
|
+
log: r,
|
|
180
|
+
args: e
|
|
179
181
|
}
|
|
180
182
|
})
|
|
181
183
|
);
|
|
182
|
-
},
|
|
183
|
-
switch (typeof
|
|
184
|
+
}, _ = (r, ...e) => {
|
|
185
|
+
switch (typeof r.message == "string" ? r.message = R(r.message) : r.message.message && typeof r.message.message == "string" && (r.message.message = R(r.message.message)), r.severity) {
|
|
184
186
|
case "Debug":
|
|
185
|
-
console.debug(
|
|
187
|
+
console.debug(r.message, ...e);
|
|
186
188
|
break;
|
|
187
189
|
case "Info":
|
|
188
|
-
console.info(
|
|
190
|
+
console.info(r.message, ...e);
|
|
189
191
|
break;
|
|
190
192
|
case "Warn":
|
|
191
|
-
console.warn(
|
|
193
|
+
console.warn(r.message, ...e);
|
|
192
194
|
break;
|
|
193
195
|
case "Error":
|
|
194
|
-
console.error(
|
|
196
|
+
console.error(r.message, ...e);
|
|
195
197
|
break;
|
|
196
198
|
case "Fatal":
|
|
197
|
-
console.error(
|
|
199
|
+
console.error(r.message, ...e);
|
|
198
200
|
break;
|
|
199
201
|
default:
|
|
200
|
-
console.log(
|
|
202
|
+
console.log(r.message, ...e);
|
|
201
203
|
}
|
|
202
|
-
},
|
|
203
|
-
`) : JSON.stringify(
|
|
204
|
-
|
|
205
|
-
},
|
|
206
|
-
if (
|
|
207
|
-
|
|
204
|
+
}, G = (r) => r instanceof Error ? [r.message, r.stack].join(`
|
|
205
|
+
`) : JSON.stringify(r, null, 2), M = [], O = (r) => {
|
|
206
|
+
M.push(r);
|
|
207
|
+
}, P = (r) => {
|
|
208
|
+
if (r.raw === !0)
|
|
209
|
+
O(r.message);
|
|
208
210
|
else {
|
|
209
|
-
const
|
|
210
|
-
typeof
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
const e = K(
|
|
212
|
+
typeof r.message == "object" ? G(r.message) : r.message,
|
|
213
|
+
r.severity ?? "Info",
|
|
214
|
+
r.prefix ?? "JavaScript"
|
|
213
215
|
);
|
|
214
|
-
|
|
216
|
+
O(e);
|
|
215
217
|
}
|
|
216
218
|
};
|
|
217
|
-
class
|
|
219
|
+
class U extends EventTarget {
|
|
218
220
|
// constructor
|
|
219
|
-
constructor(
|
|
220
|
-
super(), this.handlers =
|
|
221
|
+
constructor(e = []) {
|
|
222
|
+
super(), this.handlers = e, this.fatalErrorEvent = "playground-fatal-error";
|
|
221
223
|
}
|
|
222
224
|
/**
|
|
223
225
|
* Get all logs.
|
|
224
226
|
* @returns string[]
|
|
225
227
|
*/
|
|
226
228
|
getLogs() {
|
|
227
|
-
return this.handlers.includes(
|
|
229
|
+
return this.handlers.includes(P) ? [...M] : (this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
228
230
|
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
229
231
|
`), []);
|
|
230
232
|
}
|
|
@@ -236,9 +238,9 @@ class me extends EventTarget {
|
|
|
236
238
|
* @param raw boolean
|
|
237
239
|
* @param args any
|
|
238
240
|
*/
|
|
239
|
-
logMessage(
|
|
241
|
+
logMessage(e, ...t) {
|
|
240
242
|
for (const n of this.handlers)
|
|
241
|
-
n(
|
|
243
|
+
n(e, ...t);
|
|
242
244
|
}
|
|
243
245
|
/**
|
|
244
246
|
* Log message
|
|
@@ -246,15 +248,15 @@ class me extends EventTarget {
|
|
|
246
248
|
* @param message any
|
|
247
249
|
* @param args any
|
|
248
250
|
*/
|
|
249
|
-
log(
|
|
251
|
+
log(e, ...t) {
|
|
250
252
|
this.logMessage(
|
|
251
253
|
{
|
|
252
|
-
message:
|
|
254
|
+
message: e,
|
|
253
255
|
severity: void 0,
|
|
254
256
|
prefix: "JavaScript",
|
|
255
257
|
raw: !1
|
|
256
258
|
},
|
|
257
|
-
...
|
|
259
|
+
...t
|
|
258
260
|
);
|
|
259
261
|
}
|
|
260
262
|
/**
|
|
@@ -263,15 +265,15 @@ class me extends EventTarget {
|
|
|
263
265
|
* @param message any
|
|
264
266
|
* @param args any
|
|
265
267
|
*/
|
|
266
|
-
debug(
|
|
268
|
+
debug(e, ...t) {
|
|
267
269
|
this.logMessage(
|
|
268
270
|
{
|
|
269
|
-
message:
|
|
271
|
+
message: e,
|
|
270
272
|
severity: "Debug",
|
|
271
273
|
prefix: "JavaScript",
|
|
272
274
|
raw: !1
|
|
273
275
|
},
|
|
274
|
-
...
|
|
276
|
+
...t
|
|
275
277
|
);
|
|
276
278
|
}
|
|
277
279
|
/**
|
|
@@ -280,15 +282,15 @@ class me extends EventTarget {
|
|
|
280
282
|
* @param message any
|
|
281
283
|
* @param args any
|
|
282
284
|
*/
|
|
283
|
-
info(
|
|
285
|
+
info(e, ...t) {
|
|
284
286
|
this.logMessage(
|
|
285
287
|
{
|
|
286
|
-
message:
|
|
288
|
+
message: e,
|
|
287
289
|
severity: "Info",
|
|
288
290
|
prefix: "JavaScript",
|
|
289
291
|
raw: !1
|
|
290
292
|
},
|
|
291
|
-
...
|
|
293
|
+
...t
|
|
292
294
|
);
|
|
293
295
|
}
|
|
294
296
|
/**
|
|
@@ -297,15 +299,15 @@ class me extends EventTarget {
|
|
|
297
299
|
* @param message any
|
|
298
300
|
* @param args any
|
|
299
301
|
*/
|
|
300
|
-
warn(
|
|
302
|
+
warn(e, ...t) {
|
|
301
303
|
this.logMessage(
|
|
302
304
|
{
|
|
303
|
-
message:
|
|
305
|
+
message: e,
|
|
304
306
|
severity: "Warn",
|
|
305
307
|
prefix: "JavaScript",
|
|
306
308
|
raw: !1
|
|
307
309
|
},
|
|
308
|
-
...
|
|
310
|
+
...t
|
|
309
311
|
);
|
|
310
312
|
}
|
|
311
313
|
/**
|
|
@@ -314,54 +316,54 @@ class me extends EventTarget {
|
|
|
314
316
|
* @param message any
|
|
315
317
|
* @param args any
|
|
316
318
|
*/
|
|
317
|
-
error(
|
|
319
|
+
error(e, ...t) {
|
|
318
320
|
this.logMessage(
|
|
319
321
|
{
|
|
320
|
-
message:
|
|
322
|
+
message: e,
|
|
321
323
|
severity: "Error",
|
|
322
324
|
prefix: "JavaScript",
|
|
323
325
|
raw: !1
|
|
324
326
|
},
|
|
325
|
-
...
|
|
327
|
+
...t
|
|
326
328
|
);
|
|
327
329
|
}
|
|
328
330
|
}
|
|
329
|
-
const
|
|
331
|
+
const V = () => {
|
|
330
332
|
try {
|
|
331
333
|
if (process.env.NODE_ENV === "test")
|
|
332
|
-
return [
|
|
334
|
+
return [P, D];
|
|
333
335
|
} catch {
|
|
334
336
|
}
|
|
335
|
-
return [
|
|
336
|
-
},
|
|
337
|
-
const n = /* @__PURE__ */ new Date(),
|
|
337
|
+
return [P, _, D];
|
|
338
|
+
}, E = new U(V()), R = (r) => r.replace(/\t/g, ""), K = (r, e, t) => {
|
|
339
|
+
const n = /* @__PURE__ */ new Date(), o = new Intl.DateTimeFormat("en-GB", {
|
|
338
340
|
year: "numeric",
|
|
339
341
|
month: "short",
|
|
340
342
|
day: "2-digit",
|
|
341
343
|
timeZone: "UTC"
|
|
342
|
-
}).format(n).replace(/ /g, "-"),
|
|
344
|
+
}).format(n).replace(/ /g, "-"), i = new Intl.DateTimeFormat("en-GB", {
|
|
343
345
|
hour: "2-digit",
|
|
344
346
|
minute: "2-digit",
|
|
345
347
|
second: "2-digit",
|
|
346
348
|
hour12: !1,
|
|
347
349
|
timeZone: "UTC",
|
|
348
350
|
timeZoneName: "short"
|
|
349
|
-
}).format(n),
|
|
350
|
-
return
|
|
351
|
-
},
|
|
352
|
-
function
|
|
353
|
-
return new Promise((
|
|
354
|
-
setTimeout(() =>
|
|
351
|
+
}).format(n), s = o + " " + i;
|
|
352
|
+
return r = R(r), `[${s}] ${t} ${e}: ${r}`;
|
|
353
|
+
}, L = Symbol("SleepFinished");
|
|
354
|
+
function Z(r) {
|
|
355
|
+
return new Promise((e) => {
|
|
356
|
+
setTimeout(() => e(L), r);
|
|
355
357
|
});
|
|
356
358
|
}
|
|
357
|
-
class
|
|
359
|
+
class Q extends Error {
|
|
358
360
|
constructor() {
|
|
359
361
|
super("Acquiring lock timed out");
|
|
360
362
|
}
|
|
361
363
|
}
|
|
362
|
-
class
|
|
363
|
-
constructor({ concurrency:
|
|
364
|
-
this._running = 0, this.concurrency =
|
|
364
|
+
class Y {
|
|
365
|
+
constructor({ concurrency: e, timeout: t }) {
|
|
366
|
+
this._running = 0, this.concurrency = e, this.timeout = t, this.queue = [];
|
|
365
367
|
}
|
|
366
368
|
get remaining() {
|
|
367
369
|
return this.concurrency - this.running;
|
|
@@ -372,91 +374,91 @@ class ge {
|
|
|
372
374
|
async acquire() {
|
|
373
375
|
for (; ; )
|
|
374
376
|
if (this._running >= this.concurrency) {
|
|
375
|
-
const
|
|
376
|
-
this.queue.push(
|
|
377
|
+
const e = new Promise((t) => {
|
|
378
|
+
this.queue.push(t);
|
|
377
379
|
});
|
|
378
|
-
this.timeout !== void 0 ? await Promise.race([
|
|
379
|
-
(
|
|
380
|
-
if (
|
|
381
|
-
throw new
|
|
380
|
+
this.timeout !== void 0 ? await Promise.race([e, Z(this.timeout)]).then(
|
|
381
|
+
(t) => {
|
|
382
|
+
if (t === L)
|
|
383
|
+
throw new Q();
|
|
382
384
|
}
|
|
383
|
-
) : await
|
|
385
|
+
) : await e;
|
|
384
386
|
} else {
|
|
385
387
|
this._running++;
|
|
386
|
-
let
|
|
388
|
+
let e = !1;
|
|
387
389
|
return () => {
|
|
388
|
-
|
|
390
|
+
e || (e = !0, this._running--, this.queue.length > 0 && this.queue.shift()());
|
|
389
391
|
};
|
|
390
392
|
}
|
|
391
393
|
}
|
|
392
|
-
async run(
|
|
393
|
-
const
|
|
394
|
+
async run(e) {
|
|
395
|
+
const t = await this.acquire();
|
|
394
396
|
try {
|
|
395
|
-
return await
|
|
397
|
+
return await e();
|
|
396
398
|
} finally {
|
|
397
|
-
|
|
399
|
+
t();
|
|
398
400
|
}
|
|
399
401
|
}
|
|
400
402
|
}
|
|
401
|
-
class
|
|
402
|
-
constructor(
|
|
403
|
-
super(
|
|
403
|
+
class H extends Error {
|
|
404
|
+
constructor(e, t) {
|
|
405
|
+
super(e), this.userFriendlyMessage = t, this.userFriendlyMessage || (this.userFriendlyMessage = e);
|
|
404
406
|
}
|
|
405
407
|
}
|
|
406
|
-
function
|
|
407
|
-
let
|
|
408
|
-
const
|
|
409
|
-
return
|
|
408
|
+
function g(...r) {
|
|
409
|
+
let e = r.join("/");
|
|
410
|
+
const t = e[0] === "/", n = e.substring(e.length - 1) === "/";
|
|
411
|
+
return e = C(e), !e && !t && (e = "."), e && n && (e += "/"), e;
|
|
410
412
|
}
|
|
411
|
-
function
|
|
412
|
-
if (
|
|
413
|
+
function X(r) {
|
|
414
|
+
if (r === "/")
|
|
413
415
|
return "/";
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
return
|
|
416
|
+
r = C(r);
|
|
417
|
+
const e = r.lastIndexOf("/");
|
|
418
|
+
return e === -1 ? "" : e === 0 ? "/" : r.substr(0, e);
|
|
417
419
|
}
|
|
418
|
-
function
|
|
419
|
-
if (
|
|
420
|
+
function ee(r) {
|
|
421
|
+
if (r === "/")
|
|
420
422
|
return "/";
|
|
421
|
-
|
|
422
|
-
const
|
|
423
|
-
return
|
|
423
|
+
r = C(r);
|
|
424
|
+
const e = r.lastIndexOf("/");
|
|
425
|
+
return e === -1 ? r : r.substr(e + 1);
|
|
424
426
|
}
|
|
425
|
-
function
|
|
426
|
-
const
|
|
427
|
-
return
|
|
428
|
-
|
|
429
|
-
!
|
|
430
|
-
).join("/"), (
|
|
427
|
+
function C(r) {
|
|
428
|
+
const e = r[0] === "/";
|
|
429
|
+
return r = te(
|
|
430
|
+
r.split("/").filter((t) => !!t),
|
|
431
|
+
!e
|
|
432
|
+
).join("/"), (e ? "/" : "") + r.replace(/\/$/, "");
|
|
431
433
|
}
|
|
432
|
-
function
|
|
433
|
-
let
|
|
434
|
-
for (let n =
|
|
435
|
-
const
|
|
436
|
-
|
|
434
|
+
function te(r, e) {
|
|
435
|
+
let t = 0;
|
|
436
|
+
for (let n = r.length - 1; n >= 0; n--) {
|
|
437
|
+
const o = r[n];
|
|
438
|
+
o === "." ? r.splice(n, 1) : o === ".." ? (r.splice(n, 1), t++) : t && (r.splice(n, 1), t--);
|
|
437
439
|
}
|
|
438
|
-
if (
|
|
439
|
-
for (;
|
|
440
|
-
|
|
441
|
-
return
|
|
440
|
+
if (e)
|
|
441
|
+
for (; t; t--)
|
|
442
|
+
r.unshift("..");
|
|
443
|
+
return r;
|
|
442
444
|
}
|
|
443
|
-
var
|
|
444
|
-
for (var
|
|
445
|
-
(
|
|
446
|
-
return n &&
|
|
445
|
+
var re = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, h = (r, e, t, n) => {
|
|
446
|
+
for (var o = n > 1 ? void 0 : n ? ne(e, t) : e, i = r.length - 1, s; i >= 0; i--)
|
|
447
|
+
(s = r[i]) && (o = (n ? s(e, t, o) : s(o)) || o);
|
|
448
|
+
return n && o && re(e, t, o), o;
|
|
447
449
|
};
|
|
448
|
-
const p = class
|
|
449
|
-
static readFileAsText(
|
|
450
|
-
return new TextDecoder().decode(
|
|
450
|
+
const p = class f {
|
|
451
|
+
static readFileAsText(e, t) {
|
|
452
|
+
return new TextDecoder().decode(f.readFileAsBuffer(e, t));
|
|
451
453
|
}
|
|
452
|
-
static readFileAsBuffer(
|
|
453
|
-
return
|
|
454
|
+
static readFileAsBuffer(e, t) {
|
|
455
|
+
return e.readFile(t);
|
|
454
456
|
}
|
|
455
|
-
static writeFile(
|
|
456
|
-
|
|
457
|
+
static writeFile(e, t, n) {
|
|
458
|
+
e.writeFile(t, n);
|
|
457
459
|
}
|
|
458
|
-
static unlink(
|
|
459
|
-
|
|
460
|
+
static unlink(e, t) {
|
|
461
|
+
e.unlink(t);
|
|
460
462
|
}
|
|
461
463
|
/**
|
|
462
464
|
* Moves a file or directory in the PHP filesystem to a
|
|
@@ -465,70 +467,70 @@ const p = class m {
|
|
|
465
467
|
* @param oldPath The path to rename.
|
|
466
468
|
* @param newPath The new path.
|
|
467
469
|
*/
|
|
468
|
-
static mv(
|
|
470
|
+
static mv(e, t, n) {
|
|
469
471
|
try {
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
} catch (
|
|
473
|
-
const
|
|
474
|
-
throw
|
|
475
|
-
`Could not move ${
|
|
472
|
+
const o = e.lookupPath(t).node.mount, i = f.fileExists(e, n) ? e.lookupPath(n).node.mount : e.lookupPath(X(n)).node.mount;
|
|
473
|
+
o.mountpoint !== i.mountpoint ? (f.copyRecursive(e, t, n), f.rmdir(e, t, { recursive: !0 })) : e.rename(t, n);
|
|
474
|
+
} catch (o) {
|
|
475
|
+
const i = j(o);
|
|
476
|
+
throw i ? new Error(
|
|
477
|
+
`Could not move ${t} to ${n}: ${i}`,
|
|
476
478
|
{
|
|
477
|
-
cause:
|
|
479
|
+
cause: o
|
|
478
480
|
}
|
|
479
|
-
) :
|
|
481
|
+
) : o;
|
|
480
482
|
}
|
|
481
483
|
}
|
|
482
|
-
static rmdir(
|
|
483
|
-
n != null && n.recursive &&
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
}),
|
|
484
|
+
static rmdir(e, t, n = { recursive: !0 }) {
|
|
485
|
+
n != null && n.recursive && f.listFiles(e, t).forEach((o) => {
|
|
486
|
+
const i = `${t}/${o}`;
|
|
487
|
+
f.isDir(e, i) ? f.rmdir(e, i, n) : f.unlink(e, i);
|
|
488
|
+
}), e.rmdir(t);
|
|
487
489
|
}
|
|
488
|
-
static listFiles(
|
|
489
|
-
if (!
|
|
490
|
+
static listFiles(e, t, n = { prependPath: !1 }) {
|
|
491
|
+
if (!f.fileExists(e, t))
|
|
490
492
|
return [];
|
|
491
493
|
try {
|
|
492
|
-
const
|
|
493
|
-
(
|
|
494
|
+
const o = e.readdir(t).filter(
|
|
495
|
+
(i) => i !== "." && i !== ".."
|
|
494
496
|
);
|
|
495
497
|
if (n.prependPath) {
|
|
496
|
-
const
|
|
497
|
-
return
|
|
498
|
+
const i = t.replace(/\/$/, "");
|
|
499
|
+
return o.map((s) => `${i}/${s}`);
|
|
498
500
|
}
|
|
499
|
-
return
|
|
500
|
-
} catch (
|
|
501
|
-
return
|
|
501
|
+
return o;
|
|
502
|
+
} catch (o) {
|
|
503
|
+
return E.error(o, { path: t }), [];
|
|
502
504
|
}
|
|
503
505
|
}
|
|
504
|
-
static isDir(
|
|
505
|
-
return
|
|
506
|
+
static isDir(e, t) {
|
|
507
|
+
return f.fileExists(e, t) ? e.isDir(e.lookupPath(t).node.mode) : !1;
|
|
506
508
|
}
|
|
507
|
-
static fileExists(
|
|
509
|
+
static fileExists(e, t) {
|
|
508
510
|
try {
|
|
509
|
-
return
|
|
511
|
+
return e.lookupPath(t), !0;
|
|
510
512
|
} catch {
|
|
511
513
|
return !1;
|
|
512
514
|
}
|
|
513
515
|
}
|
|
514
|
-
static mkdir(
|
|
515
|
-
|
|
516
|
+
static mkdir(e, t) {
|
|
517
|
+
e.mkdirTree(t);
|
|
516
518
|
}
|
|
517
|
-
static copyRecursive(
|
|
518
|
-
const
|
|
519
|
-
if (
|
|
520
|
-
|
|
521
|
-
const
|
|
522
|
-
(
|
|
519
|
+
static copyRecursive(e, t, n) {
|
|
520
|
+
const o = e.lookupPath(t).node;
|
|
521
|
+
if (e.isDir(o.mode)) {
|
|
522
|
+
e.mkdirTree(n);
|
|
523
|
+
const i = e.readdir(t).filter(
|
|
524
|
+
(s) => s !== "." && s !== ".."
|
|
523
525
|
);
|
|
524
|
-
for (const
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
526
|
+
for (const s of i)
|
|
527
|
+
f.copyRecursive(
|
|
528
|
+
e,
|
|
529
|
+
g(t, s),
|
|
530
|
+
g(n, s)
|
|
529
531
|
);
|
|
530
532
|
} else
|
|
531
|
-
|
|
533
|
+
e.writeFile(n, e.readFile(t));
|
|
532
534
|
}
|
|
533
535
|
};
|
|
534
536
|
h([
|
|
@@ -561,8 +563,8 @@ h([
|
|
|
561
563
|
h([
|
|
562
564
|
y('Could not copy files from "{path}"')
|
|
563
565
|
], p, "copyRecursive", 1);
|
|
564
|
-
let
|
|
565
|
-
const
|
|
566
|
+
let v = p;
|
|
567
|
+
const oe = {
|
|
566
568
|
500: "Internal Server Error",
|
|
567
569
|
502: "Bad Gateway",
|
|
568
570
|
404: "Not Found",
|
|
@@ -577,26 +579,26 @@ const Te = {
|
|
|
577
579
|
201: "Created",
|
|
578
580
|
200: "OK"
|
|
579
581
|
};
|
|
580
|
-
class
|
|
581
|
-
constructor(
|
|
582
|
-
this.httpStatusCode =
|
|
582
|
+
class T {
|
|
583
|
+
constructor(e, t, n, o = "", i = 0) {
|
|
584
|
+
this.httpStatusCode = e, this.headers = t, this.bytes = n, this.exitCode = i, this.errors = o;
|
|
583
585
|
}
|
|
584
|
-
static forHttpCode(
|
|
585
|
-
return new
|
|
586
|
-
|
|
586
|
+
static forHttpCode(e, t = "") {
|
|
587
|
+
return new T(
|
|
588
|
+
e,
|
|
587
589
|
{},
|
|
588
590
|
new TextEncoder().encode(
|
|
589
|
-
|
|
591
|
+
t || oe[e] || ""
|
|
590
592
|
)
|
|
591
593
|
);
|
|
592
594
|
}
|
|
593
|
-
static fromRawData(
|
|
594
|
-
return new
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
595
|
+
static fromRawData(e) {
|
|
596
|
+
return new T(
|
|
597
|
+
e.httpStatusCode,
|
|
598
|
+
e.headers,
|
|
599
|
+
e.bytes,
|
|
600
|
+
e.errors,
|
|
601
|
+
e.exitCode
|
|
600
602
|
);
|
|
601
603
|
}
|
|
602
604
|
toRawData() {
|
|
@@ -621,54 +623,54 @@ class O {
|
|
|
621
623
|
return new TextDecoder().decode(this.bytes);
|
|
622
624
|
}
|
|
623
625
|
}
|
|
624
|
-
const
|
|
625
|
-
let
|
|
626
|
-
async function
|
|
627
|
-
const [
|
|
626
|
+
const ie = Symbol("RuntimeId"), N = /* @__PURE__ */ new Map();
|
|
627
|
+
let se = 0;
|
|
628
|
+
async function ae(r, e = {}) {
|
|
629
|
+
const [t, n, o] = ue(), i = r.init(ce, {
|
|
628
630
|
onAbort(a) {
|
|
629
|
-
|
|
631
|
+
o(a), E.error(a);
|
|
630
632
|
},
|
|
631
633
|
ENV: {},
|
|
632
634
|
// Emscripten sometimes prepends a '/' to the path, which
|
|
633
635
|
// breaks vite dev mode. An identity `locateFile` function
|
|
634
636
|
// fixes it.
|
|
635
637
|
locateFile: (a) => a,
|
|
636
|
-
...
|
|
638
|
+
...e,
|
|
637
639
|
noInitialRun: !0,
|
|
638
640
|
onRuntimeInitialized() {
|
|
639
|
-
|
|
641
|
+
e.onRuntimeInitialized && e.onRuntimeInitialized(), n();
|
|
640
642
|
}
|
|
641
643
|
});
|
|
642
|
-
await
|
|
643
|
-
const
|
|
644
|
-
return
|
|
645
|
-
return
|
|
646
|
-
},
|
|
644
|
+
await t;
|
|
645
|
+
const s = ++se;
|
|
646
|
+
return i.id = s, i.originalExit = i._exit, i._exit = function(a) {
|
|
647
|
+
return N.delete(s), i.originalExit(a);
|
|
648
|
+
}, i[ie] = s, N.set(s, i), s;
|
|
647
649
|
}
|
|
648
|
-
const
|
|
649
|
-
var
|
|
650
|
-
return typeof process < "u" && ((
|
|
651
|
-
}(),
|
|
652
|
-
const
|
|
653
|
-
|
|
650
|
+
const ce = function() {
|
|
651
|
+
var r;
|
|
652
|
+
return typeof process < "u" && ((r = process.release) == null ? void 0 : r.name) === "node" ? "NODE" : typeof window < "u" ? "WEB" : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? "WORKER" : "NODE";
|
|
653
|
+
}(), ue = () => {
|
|
654
|
+
const r = [], e = new Promise((t, n) => {
|
|
655
|
+
r.push(t, n);
|
|
654
656
|
});
|
|
655
|
-
return
|
|
657
|
+
return r.unshift(e), r;
|
|
656
658
|
}, w = Symbol("__private__dont__use");
|
|
657
659
|
ReadableStream.prototype[Symbol.asyncIterator] || (ReadableStream.prototype[Symbol.asyncIterator] = async function* () {
|
|
658
|
-
const
|
|
660
|
+
const r = this.getReader();
|
|
659
661
|
try {
|
|
660
662
|
for (; ; ) {
|
|
661
|
-
const { done:
|
|
662
|
-
if (
|
|
663
|
+
const { done: e, value: t } = await r.read();
|
|
664
|
+
if (e)
|
|
663
665
|
return;
|
|
664
|
-
yield
|
|
666
|
+
yield t;
|
|
665
667
|
}
|
|
666
668
|
} finally {
|
|
667
|
-
|
|
669
|
+
r.releaseLock();
|
|
668
670
|
}
|
|
669
671
|
}, ReadableStream.prototype.iterate = // @ts-ignore
|
|
670
672
|
ReadableStream.prototype[Symbol.asyncIterator]);
|
|
671
|
-
const
|
|
673
|
+
const le = [
|
|
672
674
|
"8.3",
|
|
673
675
|
"8.2",
|
|
674
676
|
"8.1",
|
|
@@ -678,342 +680,98 @@ const De = [
|
|
|
678
680
|
"7.2",
|
|
679
681
|
"7.1",
|
|
680
682
|
"7.0"
|
|
681
|
-
],
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
const Q = Symbol("Comlink.proxy"), Me = Symbol("Comlink.endpoint"), Le = Symbol("Comlink.releaseProxy"), L = Symbol("Comlink.finalizer"), C = Symbol("Comlink.thrown"), X = (e) => typeof e == "object" && e !== null || typeof e == "function", Ne = {
|
|
688
|
-
canHandle: (e) => X(e) && e[Q],
|
|
689
|
-
serialize(e) {
|
|
690
|
-
const { port1: t, port2: r } = new MessageChannel();
|
|
691
|
-
return M(e, t), [r, [r]];
|
|
692
|
-
},
|
|
693
|
-
deserialize(e) {
|
|
694
|
-
return e.start(), F(e);
|
|
695
|
-
}
|
|
696
|
-
}, We = {
|
|
697
|
-
canHandle: (e) => X(e) && C in e,
|
|
698
|
-
serialize({ value: e }) {
|
|
699
|
-
let t;
|
|
700
|
-
return e instanceof Error ? t = {
|
|
701
|
-
isError: !0,
|
|
702
|
-
value: {
|
|
703
|
-
message: e.message,
|
|
704
|
-
name: e.name,
|
|
705
|
-
stack: e.stack
|
|
706
|
-
}
|
|
707
|
-
} : t = { isError: !1, value: e }, [t, []];
|
|
708
|
-
},
|
|
709
|
-
deserialize(e) {
|
|
710
|
-
throw e.isError ? Object.assign(new Error(e.value.message), e.value) : e.value;
|
|
711
|
-
}
|
|
712
|
-
}, k = /* @__PURE__ */ new Map([
|
|
713
|
-
["proxy", Ne],
|
|
714
|
-
["throw", We]
|
|
715
|
-
]);
|
|
716
|
-
function Ie(e, t) {
|
|
717
|
-
for (const r of e)
|
|
718
|
-
if (t === r || r === "*" || r instanceof RegExp && r.test(t))
|
|
719
|
-
return !0;
|
|
720
|
-
return !1;
|
|
721
|
-
}
|
|
722
|
-
function M(e, t = globalThis, r = ["*"]) {
|
|
723
|
-
t.addEventListener("message", function n(s) {
|
|
724
|
-
if (!s || !s.data)
|
|
725
|
-
return;
|
|
726
|
-
if (!Ie(r, s.origin)) {
|
|
727
|
-
console.warn(`Invalid origin '${s.origin}' for comlink proxy`);
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
const { id: o, type: i, path: a } = Object.assign({ path: [] }, s.data), u = (s.data.argumentList || []).map(g);
|
|
731
|
-
let l;
|
|
732
|
-
try {
|
|
733
|
-
const c = a.slice(0, -1).reduce((f, P) => f[P], e), d = a.reduce((f, P) => f[P], e);
|
|
734
|
-
switch (i) {
|
|
735
|
-
case "GET":
|
|
736
|
-
l = d;
|
|
737
|
-
break;
|
|
738
|
-
case "SET":
|
|
739
|
-
c[a.slice(-1)[0]] = g(s.data.value), l = !0;
|
|
740
|
-
break;
|
|
741
|
-
case "APPLY":
|
|
742
|
-
l = d.apply(c, u);
|
|
743
|
-
break;
|
|
744
|
-
case "CONSTRUCT":
|
|
745
|
-
{
|
|
746
|
-
const f = new d(...u);
|
|
747
|
-
l = ne(f);
|
|
748
|
-
}
|
|
749
|
-
break;
|
|
750
|
-
case "ENDPOINT":
|
|
751
|
-
{
|
|
752
|
-
const { port1: f, port2: P } = new MessageChannel();
|
|
753
|
-
M(e, P), l = $e(f, [f]);
|
|
754
|
-
}
|
|
755
|
-
break;
|
|
756
|
-
case "RELEASE":
|
|
757
|
-
l = void 0;
|
|
758
|
-
break;
|
|
759
|
-
default:
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
} catch (c) {
|
|
763
|
-
l = { value: c, [C]: 0 };
|
|
764
|
-
}
|
|
765
|
-
Promise.resolve(l).catch((c) => ({ value: c, [C]: 0 })).then((c) => {
|
|
766
|
-
const [d, f] = A(c);
|
|
767
|
-
t.postMessage(Object.assign(Object.assign({}, d), { id: o }), f), i === "RELEASE" && (t.removeEventListener("message", n), ee(t), L in e && typeof e[L] == "function" && e[L]());
|
|
768
|
-
}).catch((c) => {
|
|
769
|
-
const [d, f] = A({
|
|
770
|
-
value: new TypeError("Unserializable return value"),
|
|
771
|
-
[C]: 0
|
|
772
|
-
});
|
|
773
|
-
t.postMessage(Object.assign(Object.assign({}, d), { id: o }), f);
|
|
774
|
-
});
|
|
775
|
-
}), t.start && t.start();
|
|
776
|
-
}
|
|
777
|
-
function He(e) {
|
|
778
|
-
return e.constructor.name === "MessagePort";
|
|
779
|
-
}
|
|
780
|
-
function ee(e) {
|
|
781
|
-
He(e) && e.close();
|
|
782
|
-
}
|
|
783
|
-
function F(e, t) {
|
|
784
|
-
return I(e, [], t);
|
|
785
|
-
}
|
|
786
|
-
function T(e) {
|
|
787
|
-
if (e)
|
|
788
|
-
throw new Error("Proxy has been released and is not useable");
|
|
789
|
-
}
|
|
790
|
-
function te(e) {
|
|
791
|
-
return E(e, {
|
|
792
|
-
type: "RELEASE"
|
|
793
|
-
}).then(() => {
|
|
794
|
-
ee(e);
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
const S = /* @__PURE__ */ new WeakMap(), D = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
|
|
798
|
-
const t = (S.get(e) || 0) - 1;
|
|
799
|
-
S.set(e, t), t === 0 && te(e);
|
|
800
|
-
});
|
|
801
|
-
function Fe(e, t) {
|
|
802
|
-
const r = (S.get(t) || 0) + 1;
|
|
803
|
-
S.set(t, r), D && D.register(e, t, e);
|
|
804
|
-
}
|
|
805
|
-
function ze(e) {
|
|
806
|
-
D && D.unregister(e);
|
|
807
|
-
}
|
|
808
|
-
function I(e, t = [], r = function() {
|
|
809
|
-
}) {
|
|
810
|
-
let n = !1;
|
|
811
|
-
const s = new Proxy(r, {
|
|
812
|
-
get(o, i) {
|
|
813
|
-
if (T(n), i === Le)
|
|
814
|
-
return () => {
|
|
815
|
-
ze(s), te(e), n = !0;
|
|
816
|
-
};
|
|
817
|
-
if (i === "then") {
|
|
818
|
-
if (t.length === 0)
|
|
819
|
-
return { then: () => s };
|
|
820
|
-
const a = E(e, {
|
|
821
|
-
type: "GET",
|
|
822
|
-
path: t.map((u) => u.toString())
|
|
823
|
-
}).then(g);
|
|
824
|
-
return a.then.bind(a);
|
|
825
|
-
}
|
|
826
|
-
return I(e, [...t, i]);
|
|
827
|
-
},
|
|
828
|
-
set(o, i, a) {
|
|
829
|
-
T(n);
|
|
830
|
-
const [u, l] = A(a);
|
|
831
|
-
return E(e, {
|
|
832
|
-
type: "SET",
|
|
833
|
-
path: [...t, i].map((c) => c.toString()),
|
|
834
|
-
value: u
|
|
835
|
-
}, l).then(g);
|
|
836
|
-
},
|
|
837
|
-
apply(o, i, a) {
|
|
838
|
-
T(n);
|
|
839
|
-
const u = t[t.length - 1];
|
|
840
|
-
if (u === Me)
|
|
841
|
-
return E(e, {
|
|
842
|
-
type: "ENDPOINT"
|
|
843
|
-
}).then(g);
|
|
844
|
-
if (u === "bind")
|
|
845
|
-
return I(e, t.slice(0, -1));
|
|
846
|
-
const [l, c] = q(a);
|
|
847
|
-
return E(e, {
|
|
848
|
-
type: "APPLY",
|
|
849
|
-
path: t.map((d) => d.toString()),
|
|
850
|
-
argumentList: l
|
|
851
|
-
}, c).then(g);
|
|
852
|
-
},
|
|
853
|
-
construct(o, i) {
|
|
854
|
-
T(n);
|
|
855
|
-
const [a, u] = q(i);
|
|
856
|
-
return E(e, {
|
|
857
|
-
type: "CONSTRUCT",
|
|
858
|
-
path: t.map((l) => l.toString()),
|
|
859
|
-
argumentList: a
|
|
860
|
-
}, u).then(g);
|
|
861
|
-
}
|
|
862
|
-
});
|
|
863
|
-
return Fe(s, e), s;
|
|
864
|
-
}
|
|
865
|
-
function Be(e) {
|
|
866
|
-
return Array.prototype.concat.apply([], e);
|
|
867
|
-
}
|
|
868
|
-
function q(e) {
|
|
869
|
-
const t = e.map(A);
|
|
870
|
-
return [t.map((r) => r[0]), Be(t.map((r) => r[1]))];
|
|
871
|
-
}
|
|
872
|
-
const re = /* @__PURE__ */ new WeakMap();
|
|
873
|
-
function $e(e, t) {
|
|
874
|
-
return re.set(e, t), e;
|
|
875
|
-
}
|
|
876
|
-
function ne(e) {
|
|
877
|
-
return Object.assign(e, { [Q]: !0 });
|
|
878
|
-
}
|
|
879
|
-
function se(e, t = globalThis, r = "*") {
|
|
880
|
-
return {
|
|
881
|
-
postMessage: (n, s) => e.postMessage(n, r, s),
|
|
882
|
-
addEventListener: t.addEventListener.bind(t),
|
|
883
|
-
removeEventListener: t.removeEventListener.bind(t)
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
function A(e) {
|
|
887
|
-
for (const [t, r] of k)
|
|
888
|
-
if (r.canHandle(e)) {
|
|
889
|
-
const [n, s] = r.serialize(e);
|
|
890
|
-
return [
|
|
891
|
-
{
|
|
892
|
-
type: "HANDLER",
|
|
893
|
-
name: t,
|
|
894
|
-
value: n
|
|
895
|
-
},
|
|
896
|
-
s
|
|
897
|
-
];
|
|
898
|
-
}
|
|
899
|
-
return [
|
|
900
|
-
{
|
|
901
|
-
type: "RAW",
|
|
902
|
-
value: e
|
|
903
|
-
},
|
|
904
|
-
re.get(e) || []
|
|
905
|
-
];
|
|
906
|
-
}
|
|
907
|
-
function g(e) {
|
|
908
|
-
switch (e.type) {
|
|
909
|
-
case "HANDLER":
|
|
910
|
-
return k.get(e.name).deserialize(e.value);
|
|
911
|
-
case "RAW":
|
|
912
|
-
return e.value;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
function E(e, t, r) {
|
|
916
|
-
return new Promise((n) => {
|
|
917
|
-
const s = je();
|
|
918
|
-
e.addEventListener("message", function o(i) {
|
|
919
|
-
!i.data || !i.data.id || i.data.id !== s || (e.removeEventListener("message", o), n(i.data));
|
|
920
|
-
}), e.start && e.start(), e.postMessage(Object.assign({ id: s }, t), r);
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
function je() {
|
|
924
|
-
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
925
|
-
}
|
|
926
|
-
function tt(e, t = void 0) {
|
|
927
|
-
oe();
|
|
928
|
-
const r = e instanceof Worker ? e : se(e, t), n = F(r), s = z(n);
|
|
929
|
-
return new Proxy(s, {
|
|
930
|
-
get: (o, i) => i === "isConnected" ? async () => {
|
|
683
|
+
], de = le[0];
|
|
684
|
+
function Re(r, e = void 0) {
|
|
685
|
+
B();
|
|
686
|
+
const t = r instanceof Worker ? r : m.windowEndpoint(r, e), n = m.wrap(t), o = x(n);
|
|
687
|
+
return new Proxy(o, {
|
|
688
|
+
get: (i, s) => s === "isConnected" ? async () => {
|
|
931
689
|
for (; ; )
|
|
932
690
|
try {
|
|
933
|
-
await
|
|
691
|
+
await fe(n.isConnected(), 200);
|
|
934
692
|
break;
|
|
935
693
|
} catch {
|
|
936
694
|
}
|
|
937
|
-
} : n[
|
|
695
|
+
} : n[s]
|
|
938
696
|
});
|
|
939
697
|
}
|
|
940
|
-
async function
|
|
941
|
-
return new Promise((
|
|
942
|
-
setTimeout(n,
|
|
698
|
+
async function fe(r, e) {
|
|
699
|
+
return new Promise((t, n) => {
|
|
700
|
+
setTimeout(n, e), r.then(t);
|
|
943
701
|
});
|
|
944
702
|
}
|
|
945
|
-
function
|
|
946
|
-
|
|
947
|
-
const
|
|
948
|
-
let n,
|
|
949
|
-
const
|
|
950
|
-
n =
|
|
951
|
-
}),
|
|
952
|
-
get: (
|
|
703
|
+
function Ce(r, e) {
|
|
704
|
+
B();
|
|
705
|
+
const t = Promise.resolve();
|
|
706
|
+
let n, o;
|
|
707
|
+
const i = new Promise((c, l) => {
|
|
708
|
+
n = c, o = l;
|
|
709
|
+
}), s = x(r), a = new Proxy(s, {
|
|
710
|
+
get: (c, l) => l === "isConnected" ? () => t : l === "isReady" ? () => i : l in c ? c[l] : e == null ? void 0 : e[l]
|
|
953
711
|
});
|
|
954
|
-
return
|
|
712
|
+
return m.expose(
|
|
955
713
|
a,
|
|
956
|
-
typeof window < "u" ?
|
|
957
|
-
), [n,
|
|
714
|
+
typeof window < "u" ? m.windowEndpoint(self.parent) : void 0
|
|
715
|
+
), [n, o, a];
|
|
958
716
|
}
|
|
959
|
-
let
|
|
960
|
-
function
|
|
961
|
-
if (
|
|
717
|
+
let W = !1;
|
|
718
|
+
function B() {
|
|
719
|
+
if (W)
|
|
962
720
|
return;
|
|
963
|
-
|
|
964
|
-
canHandle: (
|
|
965
|
-
serialize: (
|
|
721
|
+
W = !0, m.transferHandlers.set("EVENT", {
|
|
722
|
+
canHandle: (t) => t instanceof CustomEvent,
|
|
723
|
+
serialize: (t) => [
|
|
966
724
|
{
|
|
967
|
-
detail:
|
|
725
|
+
detail: t.detail
|
|
968
726
|
},
|
|
969
727
|
[]
|
|
970
728
|
],
|
|
971
|
-
deserialize: (
|
|
972
|
-
}),
|
|
973
|
-
canHandle: (
|
|
974
|
-
serialize(
|
|
975
|
-
const { port1: n, port2:
|
|
976
|
-
return
|
|
729
|
+
deserialize: (t) => t
|
|
730
|
+
}), m.transferHandlers.set("FUNCTION", {
|
|
731
|
+
canHandle: (t) => typeof t == "function",
|
|
732
|
+
serialize(t) {
|
|
733
|
+
const { port1: n, port2: o } = new MessageChannel();
|
|
734
|
+
return m.expose(t, n), [o, [o]];
|
|
977
735
|
},
|
|
978
|
-
deserialize(
|
|
979
|
-
return
|
|
736
|
+
deserialize(t) {
|
|
737
|
+
return t.start(), m.wrap(t);
|
|
980
738
|
}
|
|
981
|
-
}),
|
|
982
|
-
canHandle: (
|
|
983
|
-
serialize(
|
|
984
|
-
return [
|
|
739
|
+
}), m.transferHandlers.set("PHPResponse", {
|
|
740
|
+
canHandle: (t) => typeof t == "object" && t !== null && "headers" in t && "bytes" in t && "errors" in t && "exitCode" in t && "httpStatusCode" in t,
|
|
741
|
+
serialize(t) {
|
|
742
|
+
return [t.toRawData(), []];
|
|
985
743
|
},
|
|
986
|
-
deserialize(
|
|
987
|
-
return
|
|
744
|
+
deserialize(t) {
|
|
745
|
+
return T.fromRawData(t);
|
|
988
746
|
}
|
|
989
747
|
});
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
const n =
|
|
993
|
-
return
|
|
748
|
+
const r = m.transferHandlers.get("throw"), e = r == null ? void 0 : r.serialize;
|
|
749
|
+
r.serialize = ({ value: t }) => {
|
|
750
|
+
const n = e({ value: t });
|
|
751
|
+
return t.response && (n[0].value.response = t.response), t.source && (n[0].value.source = t.source), n;
|
|
994
752
|
};
|
|
995
753
|
}
|
|
996
|
-
function
|
|
997
|
-
return new Proxy(
|
|
998
|
-
get(
|
|
999
|
-
switch (typeof t
|
|
754
|
+
function x(r) {
|
|
755
|
+
return new Proxy(r, {
|
|
756
|
+
get(e, t) {
|
|
757
|
+
switch (typeof e[t]) {
|
|
1000
758
|
case "function":
|
|
1001
|
-
return (...n) => t
|
|
759
|
+
return (...n) => e[t](...n);
|
|
1002
760
|
case "object":
|
|
1003
|
-
return t
|
|
761
|
+
return e[t] === null ? e[t] : x(e[t]);
|
|
1004
762
|
case "undefined":
|
|
1005
763
|
case "number":
|
|
1006
764
|
case "string":
|
|
1007
|
-
return t
|
|
765
|
+
return e[t];
|
|
1008
766
|
default:
|
|
1009
|
-
return
|
|
767
|
+
return m.proxy(e[t]);
|
|
1010
768
|
}
|
|
1011
769
|
}
|
|
1012
770
|
});
|
|
1013
771
|
}
|
|
1014
|
-
async function
|
|
1015
|
-
if (
|
|
1016
|
-
switch (
|
|
772
|
+
async function me(r = de, e = "light") {
|
|
773
|
+
if (e === "kitchen-sink")
|
|
774
|
+
switch (r) {
|
|
1017
775
|
case "8.3":
|
|
1018
776
|
return await import("./kitchen-sink/php_8_3.js");
|
|
1019
777
|
case "8.2":
|
|
@@ -1034,7 +792,7 @@ async function qe(e = Ae, t = "light") {
|
|
|
1034
792
|
return await import("./kitchen-sink/php_7_0.js");
|
|
1035
793
|
}
|
|
1036
794
|
else
|
|
1037
|
-
switch (
|
|
795
|
+
switch (r) {
|
|
1038
796
|
case "8.3":
|
|
1039
797
|
return await import("./light/php_8_3.js");
|
|
1040
798
|
case "8.2":
|
|
@@ -1054,11 +812,11 @@ async function qe(e = Ae, t = "light") {
|
|
|
1054
812
|
case "7.0":
|
|
1055
813
|
return await import("./light/php_7_0.js");
|
|
1056
814
|
}
|
|
1057
|
-
throw new Error(`Unsupported PHP version ${
|
|
815
|
+
throw new Error(`Unsupported PHP version ${r}`);
|
|
1058
816
|
}
|
|
1059
|
-
const
|
|
817
|
+
const pe = () => ({
|
|
1060
818
|
websocket: {
|
|
1061
|
-
decorator: (
|
|
819
|
+
decorator: (r) => class extends r {
|
|
1062
820
|
constructor() {
|
|
1063
821
|
try {
|
|
1064
822
|
super();
|
|
@@ -1071,424 +829,424 @@ const Je = () => ({
|
|
|
1071
829
|
}
|
|
1072
830
|
}
|
|
1073
831
|
});
|
|
1074
|
-
async function
|
|
1075
|
-
var
|
|
1076
|
-
const
|
|
1077
|
-
return (
|
|
1078
|
-
...
|
|
1079
|
-
...
|
|
832
|
+
async function De(r, e = {}) {
|
|
833
|
+
var o;
|
|
834
|
+
const t = e.loadAllExtensions ? "kitchen-sink" : "light", n = await me(r, t);
|
|
835
|
+
return (o = e.onPhpLoaderModuleLoaded) == null || o.call(e, n), await ae(n, {
|
|
836
|
+
...e.emscriptenOptions || {},
|
|
837
|
+
...pe()
|
|
1080
838
|
});
|
|
1081
839
|
}
|
|
1082
|
-
function
|
|
840
|
+
function ye(r, e) {
|
|
1083
841
|
return {
|
|
1084
842
|
type: "response",
|
|
1085
|
-
requestId:
|
|
1086
|
-
response:
|
|
843
|
+
requestId: r,
|
|
844
|
+
response: e
|
|
1087
845
|
};
|
|
1088
846
|
}
|
|
1089
|
-
async function
|
|
847
|
+
async function Oe(r, e, t) {
|
|
1090
848
|
const n = navigator.serviceWorker;
|
|
1091
849
|
if (!n)
|
|
1092
|
-
throw window.isSecureContext ? new
|
|
850
|
+
throw window.isSecureContext ? new H(
|
|
1093
851
|
"Service workers are not supported in your browser."
|
|
1094
|
-
) : new
|
|
852
|
+
) : new H(
|
|
1095
853
|
"WordPress Playground uses service workers and may only work on HTTPS and http://localhost/ sites, but the current site is neither."
|
|
1096
854
|
);
|
|
1097
|
-
await (await n.register(
|
|
855
|
+
await (await n.register(t, {
|
|
1098
856
|
type: "module",
|
|
1099
857
|
// Always bypass HTTP cache when fetching the new Service Worker script:
|
|
1100
858
|
updateViaCache: "none"
|
|
1101
859
|
})).update(), navigator.serviceWorker.addEventListener(
|
|
1102
860
|
"message",
|
|
1103
|
-
async function(
|
|
1104
|
-
if (
|
|
861
|
+
async function(s) {
|
|
862
|
+
if (e && s.data.scope !== e)
|
|
1105
863
|
return;
|
|
1106
|
-
const a =
|
|
1107
|
-
|
|
864
|
+
const a = s.data.args || [], c = s.data.method, l = await r[c](...a);
|
|
865
|
+
s.source.postMessage(ye(s.data.requestId, l));
|
|
1108
866
|
}
|
|
1109
867
|
), n.startMessages();
|
|
1110
868
|
}
|
|
1111
|
-
function
|
|
1112
|
-
window.addEventListener("message", (
|
|
1113
|
-
|
|
1114
|
-
}), window.addEventListener("message", (
|
|
869
|
+
function He(r, e) {
|
|
870
|
+
window.addEventListener("message", (t) => {
|
|
871
|
+
t.source === r.contentWindow && (e && t.origin !== e || typeof t.data != "object" || t.data.type !== "relay" || window.parent.postMessage(t.data, "*"));
|
|
872
|
+
}), window.addEventListener("message", (t) => {
|
|
1115
873
|
var n;
|
|
1116
|
-
|
|
874
|
+
t.source === window.parent && (typeof t.data != "object" || t.data.type !== "relay" || (n = r == null ? void 0 : r.contentWindow) == null || n.postMessage(t.data));
|
|
1117
875
|
});
|
|
1118
876
|
}
|
|
1119
|
-
async function
|
|
1120
|
-
|
|
1121
|
-
const
|
|
1122
|
-
return new Promise((n,
|
|
1123
|
-
|
|
877
|
+
async function Ne(r, e = {}) {
|
|
878
|
+
r = he(r, e);
|
|
879
|
+
const t = new Worker(r, { type: "module" });
|
|
880
|
+
return new Promise((n, o) => {
|
|
881
|
+
t.onerror = (s) => {
|
|
1124
882
|
const a = new Error(
|
|
1125
|
-
`WebWorker failed to load at ${
|
|
883
|
+
`WebWorker failed to load at ${r}. ${s.message ? `Original error: ${s.message}` : ""}`
|
|
1126
884
|
);
|
|
1127
|
-
a.filename =
|
|
885
|
+
a.filename = s.filename, o(a);
|
|
1128
886
|
};
|
|
1129
|
-
function
|
|
1130
|
-
|
|
887
|
+
function i(s) {
|
|
888
|
+
s.data === "worker-script-started" && (n(t), t.removeEventListener("message", i));
|
|
1131
889
|
}
|
|
1132
|
-
|
|
890
|
+
t.addEventListener("message", i);
|
|
1133
891
|
});
|
|
1134
892
|
}
|
|
1135
|
-
function
|
|
1136
|
-
if (!Object.entries(
|
|
1137
|
-
return
|
|
1138
|
-
const
|
|
1139
|
-
for (const [n,
|
|
1140
|
-
if (Array.isArray(
|
|
1141
|
-
for (const
|
|
1142
|
-
|
|
893
|
+
function he(r, e) {
|
|
894
|
+
if (!Object.entries(e).length)
|
|
895
|
+
return r + "";
|
|
896
|
+
const t = new URL(r);
|
|
897
|
+
for (const [n, o] of Object.entries(e))
|
|
898
|
+
if (Array.isArray(o))
|
|
899
|
+
for (const i of o)
|
|
900
|
+
t.searchParams.append(n, i);
|
|
1143
901
|
else
|
|
1144
|
-
|
|
1145
|
-
return
|
|
902
|
+
t.searchParams.set(n, o);
|
|
903
|
+
return t.toString();
|
|
1146
904
|
}
|
|
1147
|
-
function
|
|
905
|
+
function we(r, e, t = () => {
|
|
1148
906
|
}) {
|
|
1149
907
|
function n() {
|
|
1150
|
-
|
|
1151
|
-
const
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1154
|
-
else if (
|
|
1155
|
-
for (const d of
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
908
|
+
e = be(e);
|
|
909
|
+
const i = r[w].FS, s = ge(i, (u) => {
|
|
910
|
+
if (u.path.startsWith(e))
|
|
911
|
+
t(u);
|
|
912
|
+
else if (u.operation === "RENAME" && u.toPath.startsWith(e))
|
|
913
|
+
for (const d of $(
|
|
914
|
+
r,
|
|
915
|
+
u.path,
|
|
916
|
+
u.toPath
|
|
1159
917
|
))
|
|
1160
|
-
|
|
918
|
+
t(d);
|
|
1161
919
|
}), a = {};
|
|
1162
|
-
for (const [
|
|
1163
|
-
a[
|
|
1164
|
-
function
|
|
1165
|
-
for (const [
|
|
1166
|
-
|
|
1167
|
-
return d(...
|
|
920
|
+
for (const [u] of Object.entries(s))
|
|
921
|
+
a[u] = i[u];
|
|
922
|
+
function c() {
|
|
923
|
+
for (const [u, d] of Object.entries(s))
|
|
924
|
+
i[u] = function(...b) {
|
|
925
|
+
return d(...b), a[u].apply(this, b);
|
|
1168
926
|
};
|
|
1169
927
|
}
|
|
1170
928
|
function l() {
|
|
1171
|
-
for (const [
|
|
1172
|
-
|
|
929
|
+
for (const [u, d] of Object.entries(a))
|
|
930
|
+
r[w].FS[u] = d;
|
|
1173
931
|
}
|
|
1174
|
-
|
|
1175
|
-
bind:
|
|
932
|
+
r[w].journal = {
|
|
933
|
+
bind: c,
|
|
1176
934
|
unbind: l
|
|
1177
|
-
},
|
|
935
|
+
}, c();
|
|
1178
936
|
}
|
|
1179
|
-
|
|
1180
|
-
function
|
|
1181
|
-
|
|
937
|
+
r.addEventListener("runtime.initialized", n), r[w] && n();
|
|
938
|
+
function o() {
|
|
939
|
+
r[w].journal.unbind(), delete r[w].journal;
|
|
1182
940
|
}
|
|
1183
|
-
return
|
|
1184
|
-
return
|
|
941
|
+
return r.addEventListener("runtime.beforedestroy", o), function() {
|
|
942
|
+
return r.removeEventListener("runtime.initialized", n), r.removeEventListener("runtime.beforedestroy", o), r[w].journal.unbind();
|
|
1185
943
|
};
|
|
1186
944
|
}
|
|
1187
|
-
const
|
|
945
|
+
const ge = (r, e = () => {
|
|
1188
946
|
}) => ({
|
|
1189
|
-
write(
|
|
1190
|
-
|
|
947
|
+
write(t) {
|
|
948
|
+
e({
|
|
1191
949
|
operation: "WRITE",
|
|
1192
|
-
path:
|
|
950
|
+
path: t.path,
|
|
1193
951
|
nodeType: "file"
|
|
1194
952
|
});
|
|
1195
953
|
},
|
|
1196
|
-
truncate(
|
|
954
|
+
truncate(t) {
|
|
1197
955
|
let n;
|
|
1198
|
-
typeof
|
|
956
|
+
typeof t == "string" ? n = r.lookupPath(t, {
|
|
1199
957
|
follow: !0
|
|
1200
|
-
}).node : n =
|
|
958
|
+
}).node : n = t, e({
|
|
1201
959
|
operation: "WRITE",
|
|
1202
|
-
path:
|
|
960
|
+
path: r.getPath(n),
|
|
1203
961
|
nodeType: "file"
|
|
1204
962
|
});
|
|
1205
963
|
},
|
|
1206
|
-
unlink(
|
|
1207
|
-
|
|
964
|
+
unlink(t) {
|
|
965
|
+
e({
|
|
1208
966
|
operation: "DELETE",
|
|
1209
|
-
path:
|
|
967
|
+
path: t,
|
|
1210
968
|
nodeType: "file"
|
|
1211
969
|
});
|
|
1212
970
|
},
|
|
1213
|
-
mknod(
|
|
1214
|
-
|
|
971
|
+
mknod(t, n) {
|
|
972
|
+
r.isFile(n) && e({
|
|
1215
973
|
operation: "CREATE",
|
|
1216
|
-
path:
|
|
974
|
+
path: t,
|
|
1217
975
|
nodeType: "file"
|
|
1218
976
|
});
|
|
1219
977
|
},
|
|
1220
|
-
mkdir(
|
|
1221
|
-
|
|
978
|
+
mkdir(t) {
|
|
979
|
+
e({
|
|
1222
980
|
operation: "CREATE",
|
|
1223
|
-
path:
|
|
981
|
+
path: t,
|
|
1224
982
|
nodeType: "directory"
|
|
1225
983
|
});
|
|
1226
984
|
},
|
|
1227
|
-
rmdir(
|
|
1228
|
-
|
|
985
|
+
rmdir(t) {
|
|
986
|
+
e({
|
|
1229
987
|
operation: "DELETE",
|
|
1230
|
-
path:
|
|
988
|
+
path: t,
|
|
1231
989
|
nodeType: "directory"
|
|
1232
990
|
});
|
|
1233
991
|
},
|
|
1234
|
-
rename(
|
|
992
|
+
rename(t, n) {
|
|
1235
993
|
try {
|
|
1236
|
-
const
|
|
994
|
+
const o = r.lookupPath(t, {
|
|
1237
995
|
follow: !0
|
|
1238
|
-
}),
|
|
996
|
+
}), i = r.lookupPath(n, {
|
|
1239
997
|
parent: !0
|
|
1240
998
|
}).path;
|
|
1241
|
-
|
|
999
|
+
e({
|
|
1242
1000
|
operation: "RENAME",
|
|
1243
|
-
nodeType:
|
|
1244
|
-
path:
|
|
1245
|
-
toPath:
|
|
1001
|
+
nodeType: r.isDir(o.node.mode) ? "directory" : "file",
|
|
1002
|
+
path: o.path,
|
|
1003
|
+
toPath: g(i, ee(n))
|
|
1246
1004
|
});
|
|
1247
1005
|
} catch {
|
|
1248
1006
|
}
|
|
1249
1007
|
}
|
|
1250
1008
|
});
|
|
1251
|
-
function*
|
|
1252
|
-
if (
|
|
1009
|
+
function* $(r, e, t) {
|
|
1010
|
+
if (r.isDir(e)) {
|
|
1253
1011
|
yield {
|
|
1254
1012
|
operation: "CREATE",
|
|
1255
|
-
path:
|
|
1013
|
+
path: t,
|
|
1256
1014
|
nodeType: "directory"
|
|
1257
1015
|
};
|
|
1258
|
-
for (const n of
|
|
1259
|
-
yield*
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1016
|
+
for (const n of r.listFiles(e))
|
|
1017
|
+
yield* $(
|
|
1018
|
+
r,
|
|
1019
|
+
g(e, n),
|
|
1020
|
+
g(t, n)
|
|
1263
1021
|
);
|
|
1264
1022
|
} else
|
|
1265
1023
|
yield {
|
|
1266
1024
|
operation: "CREATE",
|
|
1267
|
-
path:
|
|
1025
|
+
path: t,
|
|
1268
1026
|
nodeType: "file"
|
|
1269
1027
|
}, yield {
|
|
1270
1028
|
operation: "WRITE",
|
|
1271
1029
|
nodeType: "file",
|
|
1272
|
-
path:
|
|
1030
|
+
path: t
|
|
1273
1031
|
};
|
|
1274
1032
|
}
|
|
1275
|
-
function
|
|
1276
|
-
return
|
|
1033
|
+
function be(r) {
|
|
1034
|
+
return r.replace(/\/$/, "").replace(/\/\/+/g, "/");
|
|
1277
1035
|
}
|
|
1278
|
-
function
|
|
1279
|
-
return
|
|
1280
|
-
...
|
|
1036
|
+
function We(r, e = { initialSync: {} }) {
|
|
1037
|
+
return e = {
|
|
1038
|
+
...e,
|
|
1281
1039
|
initialSync: {
|
|
1282
|
-
...
|
|
1283
|
-
direction:
|
|
1040
|
+
...e.initialSync,
|
|
1041
|
+
direction: e.initialSync.direction ?? "opfs-to-memfs"
|
|
1284
1042
|
}
|
|
1285
|
-
}, async function(
|
|
1286
|
-
return
|
|
1043
|
+
}, async function(t, n, o) {
|
|
1044
|
+
return e.initialSync.direction === "opfs-to-memfs" ? (v.fileExists(n, o) && v.rmdir(n, o), v.mkdir(n, o), await Ee(n, r, o)) : await z(
|
|
1287
1045
|
n,
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
),
|
|
1046
|
+
r,
|
|
1047
|
+
o,
|
|
1048
|
+
e.initialSync.onProgress
|
|
1049
|
+
), ke(t, r, o);
|
|
1292
1050
|
};
|
|
1293
1051
|
}
|
|
1294
|
-
async function
|
|
1295
|
-
|
|
1296
|
-
const n = new
|
|
1052
|
+
async function Ee(r, e, t) {
|
|
1053
|
+
v.mkdir(r, t);
|
|
1054
|
+
const n = new Y({
|
|
1297
1055
|
concurrency: 40
|
|
1298
|
-
}),
|
|
1299
|
-
[
|
|
1056
|
+
}), o = [], i = [
|
|
1057
|
+
[e, t]
|
|
1300
1058
|
];
|
|
1301
|
-
for (;
|
|
1302
|
-
const [
|
|
1303
|
-
for await (const
|
|
1059
|
+
for (; i.length > 0; ) {
|
|
1060
|
+
const [s, a] = i.pop();
|
|
1061
|
+
for await (const c of s.values()) {
|
|
1304
1062
|
const l = n.run(async () => {
|
|
1305
|
-
const
|
|
1063
|
+
const u = g(
|
|
1306
1064
|
a,
|
|
1307
|
-
|
|
1065
|
+
c.name
|
|
1308
1066
|
);
|
|
1309
|
-
if (
|
|
1067
|
+
if (c.kind === "directory") {
|
|
1310
1068
|
try {
|
|
1311
|
-
|
|
1069
|
+
r.mkdir(u);
|
|
1312
1070
|
} catch (d) {
|
|
1313
1071
|
if ((d == null ? void 0 : d.errno) !== 20)
|
|
1314
|
-
throw
|
|
1072
|
+
throw E.error(d), d;
|
|
1315
1073
|
}
|
|
1316
|
-
|
|
1317
|
-
} else if (
|
|
1318
|
-
const d = await
|
|
1319
|
-
|
|
1074
|
+
i.push([c, u]);
|
|
1075
|
+
} else if (c.kind === "file") {
|
|
1076
|
+
const d = await c.getFile(), b = new Uint8Array(await d.arrayBuffer());
|
|
1077
|
+
r.createDataFile(
|
|
1320
1078
|
a,
|
|
1321
|
-
|
|
1322
|
-
|
|
1079
|
+
c.name,
|
|
1080
|
+
b,
|
|
1323
1081
|
!0,
|
|
1324
1082
|
!0,
|
|
1325
1083
|
!0
|
|
1326
1084
|
);
|
|
1327
1085
|
}
|
|
1328
|
-
|
|
1086
|
+
o.splice(o.indexOf(l), 1);
|
|
1329
1087
|
});
|
|
1330
|
-
|
|
1088
|
+
o.push(l);
|
|
1331
1089
|
}
|
|
1332
|
-
for (;
|
|
1333
|
-
await Promise.any(
|
|
1090
|
+
for (; i.length === 0 && o.length > 0; )
|
|
1091
|
+
await Promise.any(o);
|
|
1334
1092
|
}
|
|
1335
1093
|
}
|
|
1336
|
-
async function
|
|
1337
|
-
|
|
1338
|
-
const
|
|
1339
|
-
async function
|
|
1094
|
+
async function z(r, e, t, n) {
|
|
1095
|
+
r.mkdirTree(t);
|
|
1096
|
+
const o = [];
|
|
1097
|
+
async function i(c, l) {
|
|
1340
1098
|
await Promise.all(
|
|
1341
|
-
|
|
1342
|
-
(
|
|
1343
|
-
).map(async (
|
|
1344
|
-
const d =
|
|
1345
|
-
if (!
|
|
1346
|
-
|
|
1099
|
+
r.readdir(c).filter(
|
|
1100
|
+
(u) => u !== "." && u !== ".."
|
|
1101
|
+
).map(async (u) => {
|
|
1102
|
+
const d = g(c, u);
|
|
1103
|
+
if (!ve(r, d)) {
|
|
1104
|
+
o.push([l, d, u]);
|
|
1347
1105
|
return;
|
|
1348
1106
|
}
|
|
1349
|
-
const
|
|
1107
|
+
const b = await l.getDirectoryHandle(u, {
|
|
1350
1108
|
create: !0
|
|
1351
1109
|
});
|
|
1352
|
-
return await
|
|
1110
|
+
return await i(d, b);
|
|
1353
1111
|
})
|
|
1354
1112
|
);
|
|
1355
1113
|
}
|
|
1356
|
-
await
|
|
1357
|
-
let
|
|
1358
|
-
const a =
|
|
1359
|
-
([
|
|
1360
|
-
n == null || n({ files: ++
|
|
1114
|
+
await i(t, e);
|
|
1115
|
+
let s = 0;
|
|
1116
|
+
const a = o.map(
|
|
1117
|
+
([c, l, u]) => q(c, u, r, l).then(() => {
|
|
1118
|
+
n == null || n({ files: ++s, total: o.length });
|
|
1361
1119
|
})
|
|
1362
1120
|
);
|
|
1363
1121
|
await Promise.all(a);
|
|
1364
1122
|
}
|
|
1365
|
-
function
|
|
1366
|
-
return
|
|
1123
|
+
function ve(r, e) {
|
|
1124
|
+
return r.isDir(r.lookupPath(e, { follow: !0 }).node.mode);
|
|
1367
1125
|
}
|
|
1368
|
-
async function
|
|
1369
|
-
let
|
|
1126
|
+
async function q(r, e, t, n) {
|
|
1127
|
+
let o;
|
|
1370
1128
|
try {
|
|
1371
|
-
|
|
1129
|
+
o = t.readFile(n, {
|
|
1372
1130
|
encoding: "binary"
|
|
1373
1131
|
});
|
|
1374
1132
|
} catch {
|
|
1375
1133
|
return;
|
|
1376
1134
|
}
|
|
1377
|
-
const
|
|
1135
|
+
const i = await r.getFileHandle(e, { create: !0 }), s = i.createWritable !== void 0 ? (
|
|
1378
1136
|
// Google Chrome, Firefox, probably more browsers
|
|
1379
|
-
await
|
|
1137
|
+
await i.createWritable()
|
|
1380
1138
|
) : (
|
|
1381
1139
|
// Safari
|
|
1382
|
-
await
|
|
1140
|
+
await i.createSyncAccessHandle()
|
|
1383
1141
|
);
|
|
1384
1142
|
try {
|
|
1385
|
-
await
|
|
1143
|
+
await s.truncate(0), await s.write(o);
|
|
1386
1144
|
} finally {
|
|
1387
|
-
await
|
|
1145
|
+
await s.close();
|
|
1388
1146
|
}
|
|
1389
1147
|
}
|
|
1390
|
-
function
|
|
1391
|
-
const n = [],
|
|
1148
|
+
function ke(r, e, t) {
|
|
1149
|
+
const n = [], o = we(r, t, (a) => {
|
|
1392
1150
|
n.push(a);
|
|
1393
|
-
}),
|
|
1394
|
-
async function
|
|
1395
|
-
const a = await
|
|
1151
|
+
}), i = new Te(r, e, t);
|
|
1152
|
+
async function s() {
|
|
1153
|
+
const a = await r.semaphore.acquire();
|
|
1396
1154
|
try {
|
|
1397
1155
|
for (; n.length; )
|
|
1398
|
-
await
|
|
1156
|
+
await i.processEntry(n.shift());
|
|
1399
1157
|
} finally {
|
|
1400
1158
|
a();
|
|
1401
1159
|
}
|
|
1402
1160
|
}
|
|
1403
|
-
return
|
|
1404
|
-
|
|
1161
|
+
return r.addEventListener("request.end", s), function() {
|
|
1162
|
+
o(), r.removeEventListener("request.end", s);
|
|
1405
1163
|
};
|
|
1406
1164
|
}
|
|
1407
|
-
class
|
|
1408
|
-
constructor(
|
|
1409
|
-
this.php =
|
|
1165
|
+
class Te {
|
|
1166
|
+
constructor(e, t, n) {
|
|
1167
|
+
this.php = e, this.opfs = t, this.memfsRoot = I(n);
|
|
1410
1168
|
}
|
|
1411
|
-
toOpfsPath(
|
|
1412
|
-
return
|
|
1169
|
+
toOpfsPath(e) {
|
|
1170
|
+
return I(e.substring(this.memfsRoot.length));
|
|
1413
1171
|
}
|
|
1414
|
-
async processEntry(
|
|
1415
|
-
if (!
|
|
1172
|
+
async processEntry(e) {
|
|
1173
|
+
if (!e.path.startsWith(this.memfsRoot) || e.path === this.memfsRoot)
|
|
1416
1174
|
return;
|
|
1417
|
-
const
|
|
1418
|
-
if (
|
|
1175
|
+
const t = this.toOpfsPath(e.path), n = await A(this.opfs, t), o = S(t);
|
|
1176
|
+
if (o)
|
|
1419
1177
|
try {
|
|
1420
|
-
if (
|
|
1178
|
+
if (e.operation === "DELETE")
|
|
1421
1179
|
try {
|
|
1422
|
-
await n.removeEntry(
|
|
1180
|
+
await n.removeEntry(o, {
|
|
1423
1181
|
recursive: !0
|
|
1424
1182
|
});
|
|
1425
1183
|
} catch {
|
|
1426
1184
|
}
|
|
1427
|
-
else if (
|
|
1428
|
-
|
|
1185
|
+
else if (e.operation === "CREATE")
|
|
1186
|
+
e.nodeType === "directory" ? await n.getDirectoryHandle(o, {
|
|
1429
1187
|
create: !0
|
|
1430
|
-
}) : await n.getFileHandle(
|
|
1188
|
+
}) : await n.getFileHandle(o, {
|
|
1431
1189
|
create: !0
|
|
1432
1190
|
});
|
|
1433
|
-
else if (
|
|
1434
|
-
await
|
|
1191
|
+
else if (e.operation === "WRITE")
|
|
1192
|
+
await q(
|
|
1435
1193
|
n,
|
|
1436
|
-
|
|
1194
|
+
o,
|
|
1437
1195
|
this.php[w].FS,
|
|
1438
|
-
|
|
1196
|
+
e.path
|
|
1439
1197
|
);
|
|
1440
|
-
else if (
|
|
1441
|
-
const
|
|
1198
|
+
else if (e.operation === "RENAME" && e.toPath.startsWith(this.memfsRoot)) {
|
|
1199
|
+
const i = this.toOpfsPath(e.toPath), s = await A(
|
|
1442
1200
|
this.opfs,
|
|
1443
|
-
|
|
1444
|
-
), a =
|
|
1445
|
-
if (
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1201
|
+
i
|
|
1202
|
+
), a = S(i);
|
|
1203
|
+
if (e.nodeType === "directory") {
|
|
1204
|
+
const c = await s.getDirectoryHandle(
|
|
1205
|
+
o,
|
|
1448
1206
|
{
|
|
1449
1207
|
create: !0
|
|
1450
1208
|
}
|
|
1451
1209
|
);
|
|
1452
|
-
await
|
|
1210
|
+
await z(
|
|
1453
1211
|
this.php[w].FS,
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
), await n.removeEntry(
|
|
1212
|
+
c,
|
|
1213
|
+
e.toPath
|
|
1214
|
+
), await n.removeEntry(o, {
|
|
1457
1215
|
recursive: !0
|
|
1458
1216
|
});
|
|
1459
1217
|
} else
|
|
1460
|
-
(await n.getFileHandle(
|
|
1218
|
+
(await n.getFileHandle(o)).move(s, a);
|
|
1461
1219
|
}
|
|
1462
|
-
} catch (
|
|
1463
|
-
throw
|
|
1220
|
+
} catch (i) {
|
|
1221
|
+
throw E.log({ entry: e, name: o }), E.error(i), i;
|
|
1464
1222
|
}
|
|
1465
1223
|
}
|
|
1466
1224
|
}
|
|
1467
|
-
function
|
|
1468
|
-
return
|
|
1225
|
+
function I(r) {
|
|
1226
|
+
return r.replace(/\/$/, "").replace(/\/\/+/g, "/");
|
|
1469
1227
|
}
|
|
1470
|
-
function
|
|
1471
|
-
return
|
|
1228
|
+
function S(r) {
|
|
1229
|
+
return r.substring(r.lastIndexOf("/") + 1);
|
|
1472
1230
|
}
|
|
1473
|
-
async function
|
|
1474
|
-
const
|
|
1475
|
-
if (!
|
|
1476
|
-
return
|
|
1477
|
-
const n =
|
|
1478
|
-
let
|
|
1479
|
-
for (let
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1231
|
+
async function A(r, e) {
|
|
1232
|
+
const t = e.replace(/^\/+|\/+$/g, "").replace(/\/+/, "/");
|
|
1233
|
+
if (!t)
|
|
1234
|
+
return r;
|
|
1235
|
+
const n = t.split("/");
|
|
1236
|
+
let o = r;
|
|
1237
|
+
for (let i = 0; i < n.length - 1; i++) {
|
|
1238
|
+
const s = n[i];
|
|
1239
|
+
o = await o.getDirectoryHandle(s, { create: !0 });
|
|
1482
1240
|
}
|
|
1483
|
-
return
|
|
1241
|
+
return o;
|
|
1484
1242
|
}
|
|
1485
1243
|
export {
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1244
|
+
Re as consumeAPI,
|
|
1245
|
+
We as createDirectoryHandleMountHandler,
|
|
1246
|
+
Ce as exposeAPI,
|
|
1247
|
+
me as getPHPLoaderModule,
|
|
1248
|
+
De as loadWebRuntime,
|
|
1249
|
+
Oe as registerServiceWorker,
|
|
1250
|
+
He as setupPostMessageRelay,
|
|
1251
|
+
Ne as spawnPHPWorkerThread
|
|
1494
1252
|
};
|