@wp-playground/client 0.1.34 → 0.1.37

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.
Files changed (4) hide show
  1. package/index.cjs +10 -10
  2. package/index.d.ts +4 -1
  3. package/index.js +307 -273
  4. package/package.json +2 -2
package/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  function T(t) {
2
2
  return new DOMParser().parseFromString(t.text, "text/html");
3
3
  }
4
- function A(t) {
4
+ function L(t) {
5
5
  const e = t.split(".").shift().replace("-", " ");
6
6
  return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
7
7
  }
8
8
  async function E(t, e, r) {
9
9
  await t.writeFile(e, r(await t.readFileAsText(e)));
10
10
  }
11
- async function we(t) {
11
+ async function be(t) {
12
12
  return new Uint8Array(await t.arrayBuffer());
13
13
  }
14
- const ge = async (t, { plugin: e }, r) => {
14
+ const _e = async (t, { plugin: e }, r) => {
15
15
  r?.tracker.setCaption(`Activating ${e}`);
16
16
  const i = T(
17
17
  await t.request({
@@ -23,15 +23,15 @@ const ge = async (t, { plugin: e }, r) => {
23
23
  await t.request({
24
24
  url: "/wp-admin/" + i
25
25
  });
26
- }, ye = async (t, e) => {
27
- const r = new Pe(
26
+ }, $e = async (t, e) => {
27
+ const r = new Se(
28
28
  t,
29
29
  e.siteUrl,
30
30
  e.wordpressPath || "/wordpress"
31
31
  );
32
32
  e.patchSqlitePlugin !== !1 && await r.patchSqlitePlugin(), e.addPhpInfo !== !1 && await r.addPhpInfo(), e.patchSiteUrl !== !1 && await r.patchSiteUrl(), e.disableSiteHealth !== !1 && await r.disableSiteHealth(), e.disableWpNewBlogNotification !== !1 && await r.disableWpNewBlogNotification();
33
33
  };
34
- class Pe {
34
+ class Se {
35
35
  constructor(e, r, s) {
36
36
  this.php = e, this.scopedSiteUrl = r, this.wordpressPath = s;
37
37
  }
@@ -82,38 +82,39 @@ class Pe {
82
82
  );
83
83
  }
84
84
  }
85
- const be = async (t, { code: e }) => await t.run({ code: e }), _e = async (t, { options: e }) => await t.run(e), $e = async (t, { key: e, value: r }) => {
85
+ const ve = async (t, { code: e }) => await t.run({ code: e }), Ee = async (t, { options: e }) => await t.run(e), Re = async (t, { key: e, value: r }) => {
86
86
  await t.setPhpIniEntry(e, r);
87
- }, Se = async (t, { request: e }) => await t.request(e), ve = async (t, { fromPath: e, toPath: r }) => {
87
+ }, Te = async (t, { request: e }) => await t.request(e), xe = async (t, { fromPath: e, toPath: r }) => {
88
88
  await t.writeFile(
89
89
  r,
90
90
  await t.readFileAsBuffer(e)
91
91
  );
92
- }, Ee = async (t, { fromPath: e, toPath: r }) => {
92
+ }, Ce = async (t, { fromPath: e, toPath: r }) => {
93
93
  await t.mv(e, r);
94
- }, Re = async (t, { path: e }) => {
94
+ }, Fe = async (t, { path: e }) => {
95
95
  await t.mkdir(e);
96
- }, Te = async (t, { path: e }) => {
96
+ }, ke = async (t, { path: e }) => {
97
97
  await t.unlink(e);
98
- }, xe = async (t, { path: e }) => {
98
+ }, Oe = async (t, { path: e }) => {
99
99
  await t.rmdir(e);
100
- }, Ce = async (t, { path: e, data: r }) => {
101
- r instanceof File && (r = await we(r)), await t.writeFile(e, r);
102
- }, Fe = async (t, { siteUrl: e }) => {
100
+ }, Ue = async (t, { path: e, data: r }) => {
101
+ r instanceof File && (r = await be(r)), await t.writeFile(e, r);
102
+ }, Le = async (t, { siteUrl: e }) => {
103
+ const r = await t.documentRoot;
103
104
  await E(
104
105
  t,
105
- "/wordpress/wp-config.php",
106
- (r) => `<?php
106
+ `${r}/wp-config.php`,
107
+ (s) => `<?php
107
108
  if ( ! defined( 'WP_HOME' ) ) {
108
109
  define('WP_HOME', "${e}");
109
110
  }
110
111
  if ( ! defined( 'WP_SITEURL' ) ) {
111
112
  define('WP_SITEURL', "${e}");
112
113
  }
113
- ?>${r}`
114
+ ?>${s}`
114
115
  );
115
116
  };
116
- class te {
117
+ class se {
117
118
  constructor({ concurrency: e }) {
118
119
  this._running = 0, this.concurrency = e, this.queue = [];
119
120
  }
@@ -138,7 +139,7 @@ class te {
138
139
  }
139
140
  }
140
141
  }
141
- const ke = Symbol("literal");
142
+ const Ae = Symbol("literal");
142
143
  function S(t) {
143
144
  if (typeof t == "string")
144
145
  return t.startsWith("$") ? t : JSON.stringify(t);
@@ -149,18 +150,18 @@ function S(t) {
149
150
  if (t === null)
150
151
  return "null";
151
152
  if (typeof t == "object")
152
- return ke in t ? t.toString() : `array(${Object.entries(t).map(([r, s]) => `${JSON.stringify(r)} => ${S(s)}`).join(", ")})`;
153
+ return Ae in t ? t.toString() : `array(${Object.entries(t).map(([r, s]) => `${JSON.stringify(r)} => ${S(s)}`).join(", ")})`;
153
154
  if (typeof t == "function")
154
155
  return t();
155
156
  throw new Error(`Unsupported value: ${t}`);
156
157
  }
157
- function z(t) {
158
+ function D(t) {
158
159
  const e = {};
159
160
  for (const r in t)
160
161
  e[r] = S(t[r]);
161
162
  return e;
162
163
  }
163
- const j = `<?php
164
+ const B = `<?php
164
165
 
165
166
  function zipDir($dir, $output, $additionalFiles = array())
166
167
  {
@@ -223,28 +224,28 @@ function delTree($dir)
223
224
  return rmdir($dir);
224
225
  }
225
226
  `;
226
- async function Oe(t) {
227
- const e = "wordpress-playground.zip", r = `/${e}`, s = z({
227
+ async function He(t) {
228
+ const e = "wordpress-playground.zip", r = `/${e}`, s = D({
228
229
  zipPath: r,
229
230
  documentRoot: await t.documentRoot
230
231
  });
231
- await se(
232
+ await ie(
232
233
  t,
233
234
  `zipDir(${s.documentRoot}, ${s.zipPath});`
234
235
  );
235
236
  const n = await t.readFileAsBuffer(r);
236
237
  return t.unlink(r), new File([n], e);
237
238
  }
238
- const Ue = async (t, { fullSiteZip: e }) => {
239
+ const Ie = async (t, { fullSiteZip: e }) => {
239
240
  const r = "/import.zip";
240
241
  await t.writeFile(
241
242
  r,
242
243
  new Uint8Array(await e.arrayBuffer())
243
244
  );
244
245
  const s = await t.absoluteUrl, n = await t.documentRoot;
245
- await t.rmdir(n), await re(t, { zipPath: r, extractToPath: "/" });
246
- const i = z({ absoluteUrl: s });
247
- await He(
246
+ await t.rmdir(n), await ne(t, { zipPath: r, extractToPath: "/" });
247
+ const i = D({ absoluteUrl: s });
248
+ await ze(
248
249
  t,
249
250
  `${n}/wp-config.php`,
250
251
  (o) => `<?php
@@ -254,30 +255,30 @@ const Ue = async (t, { fullSiteZip: e }) => {
254
255
  }
255
256
  ?>${o}`
256
257
  );
257
- }, re = async (t, { zipPath: e, extractToPath: r }) => {
258
- const s = z({
258
+ }, ne = async (t, { zipPath: e, extractToPath: r }) => {
259
+ const s = D({
259
260
  zipPath: e,
260
261
  extractToPath: r
261
262
  });
262
- await se(
263
+ await ie(
263
264
  t,
264
265
  `unzip(${s.zipPath}, ${s.extractToPath});`
265
266
  );
266
- }, Ae = async (t, { file: e }) => {
267
+ }, Ne = async (t, { file: e }) => {
267
268
  const r = await t.request({
268
269
  url: "/wp-admin/admin.php?import=wordpress"
269
- }), s = B(r).getElementById("import-upload-form")?.getAttribute("action"), n = await t.request({
270
+ }), s = V(r).getElementById("import-upload-form")?.getAttribute("action"), n = await t.request({
270
271
  url: `/wp-admin/${s}`,
271
272
  method: "POST",
272
273
  files: { import: e }
273
- }), i = B(n).querySelector(
274
+ }), i = V(n).querySelector(
274
275
  "#wpbody-content form"
275
276
  );
276
277
  if (!i)
277
278
  throw console.log(n.text), new Error(
278
279
  "Could not find an importer form in response. See the response text above for details."
279
280
  );
280
- const o = Le(i);
281
+ const o = De(i);
281
282
  o.fetch_attachments = "1";
282
283
  for (const a in o)
283
284
  if (a.startsWith("user_map[")) {
@@ -290,29 +291,29 @@ const Ue = async (t, { fullSiteZip: e }) => {
290
291
  formData: o
291
292
  });
292
293
  };
293
- function B(t) {
294
+ function V(t) {
294
295
  return new DOMParser().parseFromString(t.text, "text/html");
295
296
  }
296
- function Le(t) {
297
+ function De(t) {
297
298
  return Object.fromEntries(new FormData(t).entries());
298
299
  }
299
- async function He(t, e, r) {
300
+ async function ze(t, e, r) {
300
301
  await t.writeFile(
301
302
  e,
302
303
  r(await t.readFileAsText(e))
303
304
  );
304
305
  }
305
- async function se(t, e) {
306
+ async function ie(t, e) {
306
307
  const r = await t.run({
307
- code: j + e
308
+ code: B + e
308
309
  });
309
310
  if (r.exitCode !== 0)
310
- throw console.log(j + e), console.log(e + ""), console.log(r.errors), r.errors;
311
+ throw console.log(B + e), console.log(e + ""), console.log(r.errors), r.errors;
311
312
  return r;
312
313
  }
313
- const Ie = async (t, { pluginZipFile: e, options: r = {} }, s) => {
314
+ const qe = async (t, { pluginZipFile: e, options: r = {} }, s) => {
314
315
  s?.tracker.setCaption(
315
- `Installing the ${A(e?.name)} plugin`
316
+ `Installing the ${L(e?.name)} plugin`
316
317
  );
317
318
  try {
318
319
  const n = "activate" in r ? r.activate : !0, i = await t.request({
@@ -338,14 +339,14 @@ const Ie = async (t, { pluginZipFile: e, options: r = {} }, s) => {
338
339
  }
339
340
  await t.isDir(
340
341
  "/wordpress/wp-content/plugins/gutenberg"
341
- ) && !await t.fileExists("/wordpress/.gutenberg-patched") && (await t.writeFile("/wordpress/.gutenberg-patched", "1"), await V(
342
+ ) && !await t.fileExists("/wordpress/.gutenberg-patched") && (await t.writeFile("/wordpress/.gutenberg-patched", "1"), await G(
342
343
  t,
343
344
  "/wordpress/wp-content/plugins/gutenberg/build/block-editor/index.js",
344
345
  (d) => d.replace(
345
346
  /srcDoc:("[^"]+"|[^,]+)/g,
346
347
  'src:"/wp-includes/empty.html"'
347
348
  )
348
- ), await V(
349
+ ), await G(
349
350
  t,
350
351
  "/wordpress/wp-content/plugins/gutenberg/build/block-editor/index.min.js",
351
352
  (d) => d.replace(
@@ -359,15 +360,15 @@ const Ie = async (t, { pluginZipFile: e, options: r = {} }, s) => {
359
360
  ), console.error(n);
360
361
  }
361
362
  };
362
- async function V(t, e, r) {
363
+ async function G(t, e, r) {
363
364
  return await t.writeFile(
364
365
  e,
365
366
  r(await t.readFileAsText(e))
366
367
  );
367
368
  }
368
- const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
369
+ const We = async (t, { themeZipFile: e, options: r = {} }, s) => {
369
370
  s?.tracker.setCaption(
370
- `Installing the ${A(e.name)} theme`
371
+ `Installing the ${L(e.name)} theme`
371
372
  );
372
373
  try {
373
374
  const n = "activate" in r ? r.activate : !0, i = await t.request({
@@ -399,12 +400,12 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
399
400
  console.error('The "activate" button was not found.');
400
401
  return;
401
402
  }
402
- const fe = y.attributes.getNamedItem("href").value, me = new URL(
403
- fe,
403
+ const ye = y.attributes.getNamedItem("href").value, Pe = new URL(
404
+ ye,
404
405
  await t.pathToInternalUrl("/wp-admin/")
405
406
  ).toString();
406
407
  await t.request({
407
- url: me
408
+ url: Pe
408
409
  });
409
410
  }
410
411
  } catch (n) {
@@ -412,7 +413,7 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
412
413
  `Proceeding without the ${e.name} theme. Could not install it in wp-admin. The original error was: ${n}`
413
414
  ), console.error(n);
414
415
  }
415
- }, ze = async (t, { username: e = "admin", password: r = "password" } = {}, s) => {
416
+ }, Me = async (t, { username: e = "admin", password: r = "password" } = {}, s) => {
416
417
  s?.tracker.setCaption(s?.initialCaption || "Logging in"), await t.request({
417
418
  url: "/wp-login.php"
418
419
  }), await t.request({
@@ -424,7 +425,7 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
424
425
  rememberme: "forever"
425
426
  }
426
427
  });
427
- }, De = async (t, { options: e }) => {
428
+ }, je = async (t, { options: e }) => {
428
429
  await t.request({
429
430
  url: "/wp-admin/install.php?step=2",
430
431
  method: "POST",
@@ -441,7 +442,7 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
441
442
  admin_email: "admin@localhost.com"
442
443
  }
443
444
  });
444
- }, qe = async (t, { options: e }) => {
445
+ }, Be = async (t, { options: e }) => {
445
446
  const r = `<?php
446
447
  include 'wordpress/wp-load.php';
447
448
  $site_options = ${S(e)};
@@ -452,8 +453,8 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
452
453
  `, s = await t.run({
453
454
  code: r
454
455
  });
455
- return ne(s), { code: r, result: s };
456
- }, We = async (t, { meta: e, userId: r }) => {
456
+ return oe(s), { code: r, result: s };
457
+ }, Ve = async (t, { meta: e, userId: r }) => {
457
458
  const s = `<?php
458
459
  include 'wordpress/wp-load.php';
459
460
  $meta = ${S(e)};
@@ -464,40 +465,40 @@ const Ne = async (t, { themeZipFile: e, options: r = {} }, s) => {
464
465
  `, n = await t.run({
465
466
  code: s
466
467
  });
467
- return ne(n), { code: s, result: n };
468
+ return oe(n), { code: s, result: n };
468
469
  };
469
- async function ne(t) {
470
+ async function oe(t) {
470
471
  if (t.text !== "Success")
471
472
  throw console.log(t), new Error(`Failed to run code: ${t.text} ${t.errors}`);
472
473
  }
473
- const Me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
474
+ const Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
474
475
  __proto__: null,
475
- activatePlugin: ge,
476
- applyWordPressPatches: ye,
477
- cp: ve,
478
- defineSiteUrl: Fe,
479
- importFile: Ae,
480
- installPlugin: Ie,
481
- installTheme: Ne,
482
- login: ze,
483
- mkdir: Re,
484
- mv: Ee,
485
- replaceSite: Ue,
486
- request: Se,
487
- rm: Te,
488
- rmdir: xe,
489
- runPHP: be,
490
- runPHPWithOptions: _e,
491
- runWpInstallationWizard: De,
492
- setPhpIniEntry: $e,
493
- setSiteOptions: qe,
494
- unzip: re,
495
- updateUserMeta: We,
496
- writeFile: Ce,
497
- zipEntireSite: Oe
498
- }, Symbol.toStringTag, { value: "Module" })), je = 5 * 1024 * 1024;
499
- function Be(t, e) {
500
- const r = t.headers.get("content-length") || "", s = parseInt(r, 10) || je;
476
+ activatePlugin: _e,
477
+ applyWordPressPatches: $e,
478
+ cp: xe,
479
+ defineSiteUrl: Le,
480
+ importFile: Ne,
481
+ installPlugin: qe,
482
+ installTheme: We,
483
+ login: Me,
484
+ mkdir: Fe,
485
+ mv: Ce,
486
+ replaceSite: Ie,
487
+ request: Te,
488
+ rm: ke,
489
+ rmdir: Oe,
490
+ runPHP: ve,
491
+ runPHPWithOptions: Ee,
492
+ runWpInstallationWizard: je,
493
+ setPhpIniEntry: Re,
494
+ setSiteOptions: Be,
495
+ unzip: ne,
496
+ updateUserMeta: Ve,
497
+ writeFile: Ue,
498
+ zipEntireSite: He
499
+ }, Symbol.toStringTag, { value: "Module" })), Je = 5 * 1024 * 1024;
500
+ function Ke(t, e) {
501
+ const r = t.headers.get("content-length") || "", s = parseInt(r, 10) || Je;
501
502
  function n(i, o) {
502
503
  e(
503
504
  new CustomEvent("progress", {
@@ -539,13 +540,13 @@ function Be(t, e) {
539
540
  );
540
541
  }
541
542
  const H = 1e-5;
542
- class L extends EventTarget {
543
+ class A extends EventTarget {
543
544
  constructor({
544
545
  weight: e = 1,
545
546
  caption: r = "",
546
547
  fillTime: s = 4
547
548
  } = {}) {
548
- super(), this._selfWeight = 1, this._selfProgress = 0, this._selfCaption = "", this._isFilling = !1, this._subTrackers = [], this._weight = e, this._selfCaption = r, this._fillTime = s;
549
+ super(), this._selfWeight = 1, this._selfDone = !1, this._selfProgress = 0, this._selfCaption = "", this._isFilling = !1, this._subTrackers = [], this._weight = e, this._selfCaption = r, this._fillTime = s;
549
550
  }
550
551
  /**
551
552
  * Creates a new sub-tracker with a specific weight.
@@ -588,7 +589,7 @@ class L extends EventTarget {
588
589
  `Cannot add a stage with weight ${e} as the total weight of registered stages would exceed 1.`
589
590
  );
590
591
  this._selfWeight -= e;
591
- const s = new L({
592
+ const s = new A({
592
593
  caption: r,
593
594
  weight: e,
594
595
  fillTime: this._fillTime
@@ -628,7 +629,7 @@ class L extends EventTarget {
628
629
  this._selfProgress = Math.min(e, 100), this.notifyProgress(), this._selfProgress + H >= 100 && this.finish();
629
630
  }
630
631
  finish() {
631
- this._fillInterval && clearInterval(this._fillInterval), this._selfProgress = 100, this._isFilling = !1, this._fillInterval = void 0, this.notifyProgress(), this.notifyDone();
632
+ this._fillInterval && clearInterval(this._fillInterval), this._selfDone = !0, this._selfProgress = 100, this._isFilling = !1, this._fillInterval = void 0, this.notifyProgress(), this.notifyDone();
632
633
  }
633
634
  get caption() {
634
635
  for (let e = this._subTrackers.length - 1; e >= 0; e--)
@@ -646,6 +647,8 @@ class L extends EventTarget {
646
647
  return this.progress + H >= 100;
647
648
  }
648
649
  get progress() {
650
+ if (this._selfDone)
651
+ return 100;
649
652
  const e = this._subTrackers.reduce(
650
653
  (r, s) => r + s.progress * s.weight,
651
654
  this._selfProgress * this._selfWeight
@@ -666,7 +669,10 @@ class L extends EventTarget {
666
669
  }), this._loadingListener;
667
670
  }
668
671
  pipe(e) {
669
- this.addEventListener("progress", (r) => {
672
+ e.setProgress({
673
+ progress: this.progress,
674
+ caption: this.caption
675
+ }), this.addEventListener("progress", (r) => {
670
676
  e.setProgress({
671
677
  progress: r.detail.progress,
672
678
  caption: r.detail.caption
@@ -735,7 +741,7 @@ class v {
735
741
  return new TextDecoder().decode(this.bytes);
736
742
  }
737
743
  }
738
- const D = [
744
+ const z = [
739
745
  "8.2",
740
746
  "8.1",
741
747
  "8.0",
@@ -745,8 +751,8 @@ const D = [
745
751
  "7.1",
746
752
  "7.0",
747
753
  "5.6"
748
- ], Ve = D[0], Lt = D;
749
- class Ge {
754
+ ], Ye = z[0], Nt = z;
755
+ class Qe {
750
756
  #e;
751
757
  #t;
752
758
  /**
@@ -832,17 +838,17 @@ class Ge {
832
838
  return e.join("; ");
833
839
  }
834
840
  }
835
- const Je = "http://example.com";
836
- function G(t) {
841
+ const Xe = "http://example.com";
842
+ function J(t) {
837
843
  return t.toString().substring(t.origin.length);
838
844
  }
839
- function J(t, e) {
845
+ function K(t, e) {
840
846
  return !e || !t.startsWith(e) ? t : t.substring(e.length);
841
847
  }
842
- function Ke(t, e) {
848
+ function Ze(t, e) {
843
849
  return !e || t.startsWith(e) ? t : e + t;
844
850
  }
845
- class Ye {
851
+ class et {
846
852
  #e;
847
853
  #t;
848
854
  #n;
@@ -857,7 +863,7 @@ class Ye {
857
863
  * @param config - Request Handler configuration.
858
864
  */
859
865
  constructor(e, r = {}) {
860
- this.#a = new te({ concurrency: 1 });
866
+ this.#a = new se({ concurrency: 1 });
861
867
  const {
862
868
  documentRoot: s = "/www/",
863
869
  absoluteUrl: n = typeof location == "object" ? location?.href : "",
@@ -883,7 +889,7 @@ class Ye {
883
889
  /** @inheritDoc */
884
890
  internalUrlToPath(e) {
885
891
  const r = new URL(e);
886
- return r.pathname.startsWith(this.#r) && (r.pathname = r.pathname.slice(this.#r.length)), G(r);
892
+ return r.pathname.startsWith(this.#r) && (r.pathname = r.pathname.slice(this.#r.length)), J(r);
887
893
  }
888
894
  get isRequestRunning() {
889
895
  return this.#a.running > 0;
@@ -900,8 +906,8 @@ class Ye {
900
906
  async request(e) {
901
907
  const r = e.url.startsWith("http://") || e.url.startsWith("https://"), s = new URL(
902
908
  e.url,
903
- r ? void 0 : Je
904
- ), n = J(
909
+ r ? void 0 : Xe
910
+ ), n = K(
905
911
  s.pathname,
906
912
  this.#r
907
913
  );
@@ -929,7 +935,7 @@ class Ye {
929
935
  // @TODO: Infer the content-type from the arrayBuffer instead of the file path.
930
936
  // The code below won't return the correct mime-type if the extension
931
937
  // was tampered with.
932
- "content-type": [Xe(r)],
938
+ "content-type": [rt(r)],
933
939
  "accept-ranges": ["bytes"],
934
940
  "cache-control": ["public, max-age=0"]
935
941
  },
@@ -953,7 +959,7 @@ class Ye {
953
959
  let n = "GET";
954
960
  const i = {
955
961
  host: this.#i,
956
- ...ie(e.headers || {})
962
+ ...ae(e.headers || {})
957
963
  }, o = [];
958
964
  if (e.files && Object.keys(e.files).length) {
959
965
  n = "POST";
@@ -966,7 +972,7 @@ class Ye {
966
972
  data: new Uint8Array(await c.arrayBuffer())
967
973
  });
968
974
  }
969
- i["content-type"]?.startsWith("multipart/form-data") && (e.formData = Qe(
975
+ i["content-type"]?.startsWith("multipart/form-data") && (e.formData = tt(
970
976
  e.body || ""
971
977
  ), i["content-type"] = "application/x-www-form-urlencoded", delete e.body);
972
978
  }
@@ -974,8 +980,8 @@ class Ye {
974
980
  return e.formData !== void 0 ? (n = "POST", i["content-type"] = i["content-type"] || "application/x-www-form-urlencoded", a = new URLSearchParams(
975
981
  e.formData
976
982
  ).toString()) : a = e.body, await this.php.run({
977
- relativeUri: Ke(
978
- G(r),
983
+ relativeUri: Ze(
984
+ J(r),
979
985
  this.#r
980
986
  ),
981
987
  protocol: this.#t,
@@ -998,13 +1004,13 @@ class Ye {
998
1004
  * @returns The resolved filesystem path.
999
1005
  */
1000
1006
  #h(e) {
1001
- let r = J(e, this.#r);
1007
+ let r = K(e, this.#r);
1002
1008
  r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r += "/"), r.endsWith("index.php") || (r += "index.php"));
1003
1009
  const s = `${this.#e}${r}`;
1004
1010
  return this.php.fileExists(s) ? s : `${this.#e}/index.php`;
1005
1011
  }
1006
1012
  }
1007
- function Qe(t) {
1013
+ function tt(t) {
1008
1014
  const e = {}, r = t.match(/--(.*)\r\n/);
1009
1015
  if (!r)
1010
1016
  return e;
@@ -1019,7 +1025,7 @@ function Qe(t) {
1019
1025
  }
1020
1026
  }), e;
1021
1027
  }
1022
- function Xe(t) {
1028
+ function rt(t) {
1023
1029
  switch (t.split(".").pop()) {
1024
1030
  case "css":
1025
1031
  return "text/css";
@@ -1059,7 +1065,7 @@ function Xe(t) {
1059
1065
  return "application-octet-stream";
1060
1066
  }
1061
1067
  }
1062
- const K = {
1068
+ const Y = {
1063
1069
  0: "No error occurred. System call completed successfully.",
1064
1070
  1: "Argument list too long.",
1065
1071
  2: "Permission denied.",
@@ -1146,8 +1152,8 @@ function m(t = "") {
1146
1152
  return i.apply(this, o);
1147
1153
  } catch (a) {
1148
1154
  const l = typeof a == "object" ? a?.errno : null;
1149
- if (l in K) {
1150
- const c = K[l], u = typeof o[0] == "string" ? o[0] : null, d = u !== null ? t.replaceAll("{path}", u) : t;
1155
+ if (l in Y) {
1156
+ const c = Y[l], u = typeof o[0] == "string" ? o[0] : null, d = u !== null ? t.replaceAll("{path}", u) : t;
1151
1157
  throw new Error(`${d}: ${c}`, {
1152
1158
  cause: a
1153
1159
  });
@@ -1157,17 +1163,17 @@ function m(t = "") {
1157
1163
  };
1158
1164
  };
1159
1165
  }
1160
- const Ze = [];
1161
- function et(t) {
1162
- return Ze[t];
1166
+ const st = [];
1167
+ function nt(t) {
1168
+ return st[t];
1163
1169
  }
1164
1170
  (function() {
1165
1171
  return typeof window < "u" && !{}.TEST ? "WEB" : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? "WORKER" : "NODE";
1166
1172
  })();
1167
- var tt = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, w = (t, e, r, s) => {
1168
- for (var n = s > 1 ? void 0 : s ? rt(e, r) : e, i = t.length - 1, o; i >= 0; i--)
1173
+ var it = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, w = (t, e, r, s) => {
1174
+ for (var n = s > 1 ? void 0 : s ? ot(e, r) : e, i = t.length - 1, o; i >= 0; i--)
1169
1175
  (o = t[i]) && (n = (s ? o(e, r, n) : o(n)) || n);
1170
- return s && n && tt(e, r, n), n;
1176
+ return s && n && it(e, r, n), n;
1171
1177
  };
1172
1178
  const f = "string", _ = "number", h = Symbol("__private__dont__use");
1173
1179
  class g {
@@ -1179,8 +1185,8 @@ class g {
1179
1185
  * @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
1180
1186
  */
1181
1187
  constructor(e, r) {
1182
- this.#e = [], this.#t = !1, e !== void 0 && this.initializeRuntime(e), r && (this.requestHandler = new Ge(
1183
- new Ye(this, r)
1188
+ this.#e = [], this.#t = !1, e !== void 0 && this.initializeRuntime(e), r && (this.requestHandler = new Qe(
1189
+ new et(this, r)
1184
1190
  ));
1185
1191
  }
1186
1192
  #e;
@@ -1191,7 +1197,7 @@ class g {
1191
1197
  }
1192
1198
  /** @inheritDoc */
1193
1199
  get documentRoot() {
1194
- return this.requestHandler.requestHandler.absoluteUrl;
1200
+ return this.requestHandler.requestHandler.documentRoot;
1195
1201
  }
1196
1202
  /** @inheritDoc */
1197
1203
  pathToInternalUrl(e) {
@@ -1206,7 +1212,7 @@ class g {
1206
1212
  initializeRuntime(e) {
1207
1213
  if (this[h])
1208
1214
  throw new Error("PHP runtime already initialized.");
1209
- const r = et(e);
1215
+ const r = nt(e);
1210
1216
  if (!r)
1211
1217
  throw new Error("Invalid PHP runtime id.");
1212
1218
  this[h] = r;
@@ -1243,7 +1249,7 @@ class g {
1243
1249
  this.#t || (this.#n(), this.#t = !0), this.#l(e.scriptPath || ""), this.#i(e.relativeUri || ""), this.#o(e.method || "GET");
1244
1250
  const { host: r, ...s } = {
1245
1251
  host: "example.com:443",
1246
- ...ie(e.headers || {})
1252
+ ...ae(e.headers || {})
1247
1253
  };
1248
1254
  if (this.#r(r, e.protocol || "http"), this.#a(s), e.body && this.#c(e.body), e.fileInfos)
1249
1255
  for (const n of e.fileInfos)
@@ -1505,21 +1511,21 @@ w([
1505
1511
  w([
1506
1512
  m('Could not stat "{path}"')
1507
1513
  ], g.prototype, "fileExists", 1);
1508
- function ie(t) {
1514
+ function ae(t) {
1509
1515
  const e = {};
1510
1516
  for (const r in t)
1511
1517
  e[r.toLowerCase()] = t[r];
1512
1518
  return e;
1513
1519
  }
1514
- const st = [
1520
+ const at = [
1515
1521
  "vfs",
1516
1522
  "literal",
1517
1523
  "wordpress.org/themes",
1518
1524
  "wordpress.org/plugins",
1519
1525
  "url"
1520
1526
  ];
1521
- function nt(t) {
1522
- return t && typeof t == "object" && typeof t.resource == "string" && st.includes(t.resource);
1527
+ function ct(t) {
1528
+ return t && typeof t == "object" && typeof t.resource == "string" && at.includes(t.resource);
1523
1529
  }
1524
1530
  class b {
1525
1531
  /**
@@ -1533,24 +1539,24 @@ class b {
1533
1539
  let n;
1534
1540
  switch (e.resource) {
1535
1541
  case "vfs":
1536
- n = new it(e, s);
1542
+ n = new lt(e, s);
1537
1543
  break;
1538
1544
  case "literal":
1539
- n = new ot(e, s);
1545
+ n = new ut(e, s);
1540
1546
  break;
1541
1547
  case "wordpress.org/themes":
1542
- n = new lt(e, s);
1548
+ n = new pt(e, s);
1543
1549
  break;
1544
1550
  case "wordpress.org/plugins":
1545
- n = new ut(e, s);
1551
+ n = new ft(e, s);
1546
1552
  break;
1547
1553
  case "url":
1548
- n = new ct(e, s);
1554
+ n = new dt(e, s);
1549
1555
  break;
1550
1556
  default:
1551
1557
  throw new Error(`Invalid resource: ${e}`);
1552
1558
  }
1553
- return n = new ht(n), r && (n = new dt(n, r)), n;
1559
+ return n = new mt(n), r && (n = new wt(n, r)), n;
1554
1560
  }
1555
1561
  setPlayground(e) {
1556
1562
  this.playground = e;
@@ -1560,7 +1566,7 @@ class b {
1560
1566
  return !1;
1561
1567
  }
1562
1568
  }
1563
- class it extends b {
1569
+ class lt extends b {
1564
1570
  /**
1565
1571
  * Creates a new instance of `VFSResource`.
1566
1572
  * @param playground The playground client.
@@ -1582,7 +1588,7 @@ class it extends b {
1582
1588
  return this.resource.path;
1583
1589
  }
1584
1590
  }
1585
- class ot extends b {
1591
+ class ut extends b {
1586
1592
  /**
1587
1593
  * Creates a new instance of `LiteralResource`.
1588
1594
  * @param resource The literal reference.
@@ -1613,9 +1619,9 @@ class q extends b {
1613
1619
  this.progress?.setCaption(this.caption);
1614
1620
  const e = this.getURL();
1615
1621
  let r = await fetch(e);
1616
- if (r = await Be(
1622
+ if (r = await Ke(
1617
1623
  r,
1618
- this.progress?.loadingListener ?? at
1624
+ this.progress?.loadingListener ?? ht
1619
1625
  ), r.status !== 200)
1620
1626
  throw new Error(`Could not download "${e}"`);
1621
1627
  return new File([await r.blob()], this.name);
@@ -1636,9 +1642,9 @@ class q extends b {
1636
1642
  return !0;
1637
1643
  }
1638
1644
  }
1639
- const at = () => {
1645
+ const ht = () => {
1640
1646
  };
1641
- class ct extends q {
1647
+ class dt extends q {
1642
1648
  /**
1643
1649
  * Creates a new instance of `UrlResource`.
1644
1650
  * @param resource The URL reference.
@@ -1656,34 +1662,40 @@ class ct extends q {
1656
1662
  return this.resource.caption ?? super.caption;
1657
1663
  }
1658
1664
  }
1659
- class lt extends q {
1665
+ let W = "/plugin-proxy";
1666
+ function Dt(t) {
1667
+ W = t;
1668
+ }
1669
+ class pt extends q {
1660
1670
  constructor(e, r) {
1661
1671
  super(r), this.resource = e;
1662
1672
  }
1663
1673
  get name() {
1664
- return A(this.resource.slug);
1674
+ return L(this.resource.slug);
1665
1675
  }
1666
1676
  getURL() {
1667
- return "/plugin-proxy?theme=" + oe(this.resource.slug);
1677
+ const e = ce(this.resource.slug);
1678
+ return `${W}?theme=` + e;
1668
1679
  }
1669
1680
  }
1670
- class ut extends q {
1681
+ class ft extends q {
1671
1682
  constructor(e, r) {
1672
1683
  super(r), this.resource = e;
1673
1684
  }
1674
1685
  /** @inheritDoc */
1675
1686
  get name() {
1676
- return A(this.resource.slug);
1687
+ return L(this.resource.slug);
1677
1688
  }
1678
1689
  /** @inheritDoc */
1679
1690
  getURL() {
1680
- return "/plugin-proxy?plugin=" + oe(this.resource.slug);
1691
+ const e = ce(this.resource.slug);
1692
+ return `${W}?plugin=` + e;
1681
1693
  }
1682
1694
  }
1683
- function oe(t) {
1695
+ function ce(t) {
1684
1696
  return !t || t.endsWith(".zip") ? t : t + ".latest-stable.zip";
1685
1697
  }
1686
- class ae extends b {
1698
+ class le extends b {
1687
1699
  constructor(e) {
1688
1700
  super(), this.resource = e;
1689
1701
  }
@@ -1712,13 +1724,13 @@ class ae extends b {
1712
1724
  return this.resource.isAsync;
1713
1725
  }
1714
1726
  }
1715
- class ht extends ae {
1727
+ class mt extends le {
1716
1728
  /** @inheritDoc */
1717
1729
  async resolve() {
1718
1730
  return this.promise || (this.promise = super.resolve()), this.promise;
1719
1731
  }
1720
1732
  }
1721
- class dt extends ae {
1733
+ class wt extends le {
1722
1734
  constructor(e, r) {
1723
1735
  super(e), this.semaphore = r;
1724
1736
  }
@@ -1727,18 +1739,18 @@ class dt extends ae {
1727
1739
  return this.isAsync ? this.semaphore.run(() => super.resolve()) : super.resolve();
1728
1740
  }
1729
1741
  }
1730
- const pt = ["6.2", "6.1", "6.0", "5.9"];
1731
- function ft(t, {
1732
- progress: e = new L(),
1733
- semaphore: r = new te({ concurrency: 3 }),
1742
+ const gt = ["6.2", "6.1", "6.0", "5.9"];
1743
+ function yt(t, {
1744
+ progress: e = new A(),
1745
+ semaphore: r = new se({ concurrency: 3 }),
1734
1746
  onStepCompleted: s = () => {
1735
1747
  }
1736
1748
  } = {}) {
1737
- const n = (t.steps || []).filter(mt), i = n.reduce(
1749
+ const n = (t.steps || []).filter(Pt), i = n.reduce(
1738
1750
  (a, l) => a + (l.progress?.weight || 1),
1739
1751
  0
1740
1752
  ), o = n.map(
1741
- (a) => wt(a, {
1753
+ (a) => bt(a, {
1742
1754
  semaphore: r,
1743
1755
  rootProgressTracker: e,
1744
1756
  totalProgressWeight: i
@@ -1746,14 +1758,14 @@ function ft(t, {
1746
1758
  );
1747
1759
  return {
1748
1760
  versions: {
1749
- php: Y(
1761
+ php: Q(
1750
1762
  t.preferredVersions?.php,
1751
- D,
1752
- Ve
1763
+ z,
1764
+ Ye
1753
1765
  ),
1754
- wp: Y(
1766
+ wp: Q(
1755
1767
  t.preferredVersions?.wp,
1756
- pt,
1768
+ gt,
1757
1769
  "6.2"
1758
1770
  )
1759
1771
  },
@@ -1778,13 +1790,13 @@ function ft(t, {
1778
1790
  }
1779
1791
  };
1780
1792
  }
1781
- function Y(t, e, r) {
1793
+ function Q(t, e, r) {
1782
1794
  return t && e.includes(t) ? t : r;
1783
1795
  }
1784
- function mt(t) {
1796
+ function Pt(t) {
1785
1797
  return !!(typeof t == "object" && t);
1786
1798
  }
1787
- function wt(t, {
1799
+ function bt(t, {
1788
1800
  semaphore: e,
1789
1801
  rootProgressTracker: r,
1790
1802
  totalProgressWeight: s
@@ -1794,15 +1806,15 @@ function wt(t, {
1794
1806
  ), i = {};
1795
1807
  for (const u of Object.keys(t)) {
1796
1808
  let d = t[u];
1797
- nt(d) && (d = b.create(d, {
1809
+ ct(d) && (d = b.create(d, {
1798
1810
  semaphore: e
1799
1811
  })), i[u] = d;
1800
1812
  }
1801
1813
  const o = async (u) => {
1802
1814
  try {
1803
- return n.fillSlowly(), await Me[t.step](
1815
+ return n.fillSlowly(), await Ge[t.step](
1804
1816
  u,
1805
- await gt(i),
1817
+ await _t(i),
1806
1818
  {
1807
1819
  tracker: n,
1808
1820
  initialCaption: t.progress?.caption
@@ -1811,14 +1823,14 @@ function wt(t, {
1811
1823
  } finally {
1812
1824
  n.finish();
1813
1825
  }
1814
- }, a = Q(i), l = Q(i).filter(
1826
+ }, a = X(i), l = X(i).filter(
1815
1827
  (u) => u.isAsync
1816
1828
  ), c = 1 / (l.length + 1);
1817
1829
  for (const u of l)
1818
1830
  u.progress = n.stage(c);
1819
1831
  return { run: o, step: t, resources: a };
1820
1832
  }
1821
- function Q(t) {
1833
+ function X(t) {
1822
1834
  const e = [];
1823
1835
  for (const r in t) {
1824
1836
  const s = t[r];
@@ -1826,7 +1838,7 @@ function Q(t) {
1826
1838
  }
1827
1839
  return e;
1828
1840
  }
1829
- async function gt(t) {
1841
+ async function _t(t) {
1830
1842
  const e = {};
1831
1843
  for (const r in t) {
1832
1844
  const s = t[r];
@@ -1834,7 +1846,7 @@ async function gt(t) {
1834
1846
  }
1835
1847
  return e;
1836
1848
  }
1837
- async function yt(t, e) {
1849
+ async function $t(t, e) {
1838
1850
  await t.run(e);
1839
1851
  }
1840
1852
  /**
@@ -1842,17 +1854,17 @@ async function yt(t, e) {
1842
1854
  * Copyright 2019 Google LLC
1843
1855
  * SPDX-License-Identifier: Apache-2.0
1844
1856
  */
1845
- const ce = Symbol("Comlink.proxy"), Pt = Symbol("Comlink.endpoint"), bt = Symbol("Comlink.releaseProxy"), I = Symbol("Comlink.finalizer"), C = Symbol("Comlink.thrown"), le = (t) => typeof t == "object" && t !== null || typeof t == "function", _t = {
1846
- canHandle: (t) => le(t) && t[ce],
1857
+ const ue = Symbol("Comlink.proxy"), St = Symbol("Comlink.endpoint"), vt = Symbol("Comlink.releaseProxy"), I = Symbol("Comlink.finalizer"), C = Symbol("Comlink.thrown"), he = (t) => typeof t == "object" && t !== null || typeof t == "function", Et = {
1858
+ canHandle: (t) => he(t) && t[ue],
1847
1859
  serialize(t) {
1848
1860
  const { port1: e, port2: r } = new MessageChannel();
1849
- return W(t, e), [r, [r]];
1861
+ return M(t, e), [r, [r]];
1850
1862
  },
1851
1863
  deserialize(t) {
1852
- return t.start(), M(t);
1864
+ return t.start(), j(t);
1853
1865
  }
1854
- }, $t = {
1855
- canHandle: (t) => le(t) && C in t,
1866
+ }, Rt = {
1867
+ canHandle: (t) => he(t) && C in t,
1856
1868
  serialize({ value: t }) {
1857
1869
  let e;
1858
1870
  return t instanceof Error ? e = {
@@ -1868,20 +1880,20 @@ const ce = Symbol("Comlink.proxy"), Pt = Symbol("Comlink.endpoint"), bt = Symbol
1868
1880
  throw t.isError ? Object.assign(new Error(t.value.message), t.value) : t.value;
1869
1881
  }
1870
1882
  }, R = /* @__PURE__ */ new Map([
1871
- ["proxy", _t],
1872
- ["throw", $t]
1883
+ ["proxy", Et],
1884
+ ["throw", Rt]
1873
1885
  ]);
1874
- function St(t, e) {
1886
+ function Tt(t, e) {
1875
1887
  for (const r of t)
1876
1888
  if (e === r || r === "*" || r instanceof RegExp && r.test(e))
1877
1889
  return !0;
1878
1890
  return !1;
1879
1891
  }
1880
- function W(t, e = globalThis, r = ["*"]) {
1892
+ function M(t, e = globalThis, r = ["*"]) {
1881
1893
  e.addEventListener("message", function s(n) {
1882
1894
  if (!n || !n.data)
1883
1895
  return;
1884
- if (!St(r, n.origin)) {
1896
+ if (!Tt(r, n.origin)) {
1885
1897
  console.warn(`Invalid origin '${n.origin}' for comlink proxy`);
1886
1898
  return;
1887
1899
  }
@@ -1902,13 +1914,13 @@ function W(t, e = globalThis, r = ["*"]) {
1902
1914
  case "CONSTRUCT":
1903
1915
  {
1904
1916
  const p = new d(...l);
1905
- c = Ct(p);
1917
+ c = me(p);
1906
1918
  }
1907
1919
  break;
1908
1920
  case "ENDPOINT":
1909
1921
  {
1910
1922
  const { port1: p, port2: y } = new MessageChannel();
1911
- W(t, y), c = xt(p, [p]);
1923
+ M(t, y), c = Ot(p, [p]);
1912
1924
  }
1913
1925
  break;
1914
1926
  case "RELEASE":
@@ -1922,7 +1934,7 @@ function W(t, e = globalThis, r = ["*"]) {
1922
1934
  }
1923
1935
  Promise.resolve(c).catch((u) => ({ value: u, [C]: 0 })).then((u) => {
1924
1936
  const [d, p] = U(u);
1925
- e.postMessage(Object.assign(Object.assign({}, d), { id: i }), p), o === "RELEASE" && (e.removeEventListener("message", s), ue(e), I in t && typeof t[I] == "function" && t[I]());
1937
+ e.postMessage(Object.assign(Object.assign({}, d), { id: i }), p), o === "RELEASE" && (e.removeEventListener("message", s), de(e), I in t && typeof t[I] == "function" && t[I]());
1926
1938
  }).catch((u) => {
1927
1939
  const [d, p] = U({
1928
1940
  value: new TypeError("Unserializable return value"),
@@ -1932,35 +1944,35 @@ function W(t, e = globalThis, r = ["*"]) {
1932
1944
  });
1933
1945
  }), e.start && e.start();
1934
1946
  }
1935
- function vt(t) {
1947
+ function xt(t) {
1936
1948
  return t.constructor.name === "MessagePort";
1937
1949
  }
1938
- function ue(t) {
1939
- vt(t) && t.close();
1950
+ function de(t) {
1951
+ xt(t) && t.close();
1940
1952
  }
1941
- function M(t, e) {
1953
+ function j(t, e) {
1942
1954
  return N(t, [], e);
1943
1955
  }
1944
1956
  function x(t) {
1945
1957
  if (t)
1946
1958
  throw new Error("Proxy has been released and is not useable");
1947
1959
  }
1948
- function he(t) {
1960
+ function pe(t) {
1949
1961
  return $(t, {
1950
1962
  type: "RELEASE"
1951
1963
  }).then(() => {
1952
- ue(t);
1964
+ de(t);
1953
1965
  });
1954
1966
  }
1955
1967
  const k = /* @__PURE__ */ new WeakMap(), O = "FinalizationRegistry" in globalThis && new FinalizationRegistry((t) => {
1956
1968
  const e = (k.get(t) || 0) - 1;
1957
- k.set(t, e), e === 0 && he(t);
1969
+ k.set(t, e), e === 0 && pe(t);
1958
1970
  });
1959
- function Et(t, e) {
1971
+ function Ct(t, e) {
1960
1972
  const r = (k.get(e) || 0) + 1;
1961
1973
  k.set(e, r), O && O.register(t, e, t);
1962
1974
  }
1963
- function Rt(t) {
1975
+ function Ft(t) {
1964
1976
  O && O.unregister(t);
1965
1977
  }
1966
1978
  function N(t, e = [], r = function() {
@@ -1968,9 +1980,9 @@ function N(t, e = [], r = function() {
1968
1980
  let s = !1;
1969
1981
  const n = new Proxy(r, {
1970
1982
  get(i, o) {
1971
- if (x(s), o === bt)
1983
+ if (x(s), o === vt)
1972
1984
  return () => {
1973
- Rt(n), he(t), s = !0;
1985
+ Ft(n), pe(t), s = !0;
1974
1986
  };
1975
1987
  if (o === "then") {
1976
1988
  if (e.length === 0)
@@ -1995,13 +2007,13 @@ function N(t, e = [], r = function() {
1995
2007
  apply(i, o, a) {
1996
2008
  x(s);
1997
2009
  const l = e[e.length - 1];
1998
- if (l === Pt)
2010
+ if (l === St)
1999
2011
  return $(t, {
2000
2012
  type: "ENDPOINT"
2001
2013
  }).then(P);
2002
2014
  if (l === "bind")
2003
2015
  return N(t, e.slice(0, -1));
2004
- const [c, u] = X(a);
2016
+ const [c, u] = Z(a);
2005
2017
  return $(t, {
2006
2018
  type: "APPLY",
2007
2019
  path: e.map((d) => d.toString()),
@@ -2010,7 +2022,7 @@ function N(t, e = [], r = function() {
2010
2022
  },
2011
2023
  construct(i, o) {
2012
2024
  x(s);
2013
- const [a, l] = X(o);
2025
+ const [a, l] = Z(o);
2014
2026
  return $(t, {
2015
2027
  type: "CONSTRUCT",
2016
2028
  path: e.map((c) => c.toString()),
@@ -2018,23 +2030,23 @@ function N(t, e = [], r = function() {
2018
2030
  }, l).then(P);
2019
2031
  }
2020
2032
  });
2021
- return Et(n, t), n;
2033
+ return Ct(n, t), n;
2022
2034
  }
2023
- function Tt(t) {
2035
+ function kt(t) {
2024
2036
  return Array.prototype.concat.apply([], t);
2025
2037
  }
2026
- function X(t) {
2038
+ function Z(t) {
2027
2039
  const e = t.map(U);
2028
- return [e.map((r) => r[0]), Tt(e.map((r) => r[1]))];
2040
+ return [e.map((r) => r[0]), kt(e.map((r) => r[1]))];
2029
2041
  }
2030
- const de = /* @__PURE__ */ new WeakMap();
2031
- function xt(t, e) {
2032
- return de.set(t, e), t;
2042
+ const fe = /* @__PURE__ */ new WeakMap();
2043
+ function Ot(t, e) {
2044
+ return fe.set(t, e), t;
2033
2045
  }
2034
- function Ct(t) {
2035
- return Object.assign(t, { [ce]: !0 });
2046
+ function me(t) {
2047
+ return Object.assign(t, { [ue]: !0 });
2036
2048
  }
2037
- function Ft(t, e = globalThis, r = "*") {
2049
+ function Ut(t, e = globalThis, r = "*") {
2038
2050
  return {
2039
2051
  postMessage: (s, n) => t.postMessage(s, r, n),
2040
2052
  addEventListener: e.addEventListener.bind(e),
@@ -2059,7 +2071,7 @@ function U(t) {
2059
2071
  type: "RAW",
2060
2072
  value: t
2061
2073
  },
2062
- de.get(t) || []
2074
+ fe.get(t) || []
2063
2075
  ];
2064
2076
  }
2065
2077
  function P(t) {
@@ -2072,22 +2084,25 @@ function P(t) {
2072
2084
  }
2073
2085
  function $(t, e, r) {
2074
2086
  return new Promise((s) => {
2075
- const n = kt();
2087
+ const n = Lt();
2076
2088
  t.addEventListener("message", function i(o) {
2077
2089
  !o.data || !o.data.id || o.data.id !== n || (t.removeEventListener("message", i), s(o.data));
2078
2090
  }), t.start && t.start(), t.postMessage(Object.assign({ id: n }, e), r);
2079
2091
  });
2080
2092
  }
2081
- function kt() {
2093
+ function Lt() {
2082
2094
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
2083
2095
  }
2084
- function pe(t) {
2085
- Ot();
2086
- const e = t instanceof Worker ? t : Ft(t);
2087
- return M(e);
2096
+ function we(t) {
2097
+ At();
2098
+ const e = t instanceof Worker ? t : Ut(t), r = j(e), s = ge(r);
2099
+ return new Proxy(s, {
2100
+ get: (n, i) => i === "isConnected" ? () => r.isConnected() : r[i]
2101
+ });
2088
2102
  }
2089
- function Ot() {
2090
- R.set("EVENT", {
2103
+ let ee = !1;
2104
+ function At() {
2105
+ ee || (ee = !0, R.set("EVENT", {
2091
2106
  canHandle: (t) => t instanceof CustomEvent,
2092
2107
  serialize: (t) => [
2093
2108
  {
@@ -2101,10 +2116,10 @@ function Ot() {
2101
2116
  serialize(t) {
2102
2117
  console.debug("[Comlink][Performance] Proxying a function");
2103
2118
  const { port1: e, port2: r } = new MessageChannel();
2104
- return W(t, e), [r, [r]];
2119
+ return M(t, e), [r, [r]];
2105
2120
  },
2106
2121
  deserialize(t) {
2107
- return t.start(), M(t);
2122
+ return t.start(), j(t);
2108
2123
  }
2109
2124
  }), R.set("PHPResponse", {
2110
2125
  canHandle: (t) => typeof t == "object" && t !== null && "headers" in t && "bytes" in t && "errors" in t && "exitCode" in t && "httpStatusCode" in t,
@@ -2114,105 +2129,124 @@ function Ot() {
2114
2129
  deserialize(t) {
2115
2130
  return v.fromRawData(t);
2116
2131
  }
2132
+ }));
2133
+ }
2134
+ function ge(t) {
2135
+ return new Proxy(t, {
2136
+ get(e, r) {
2137
+ switch (typeof e[r]) {
2138
+ case "function":
2139
+ return (...s) => e[r](...s);
2140
+ case "object":
2141
+ return e[r] === null ? e[r] : ge(e[r]);
2142
+ case "undefined":
2143
+ case "number":
2144
+ case "string":
2145
+ return e[r];
2146
+ default:
2147
+ return me(e[r]);
2148
+ }
2149
+ }
2117
2150
  });
2118
2151
  }
2119
2152
  (function() {
2120
2153
  return typeof navigator < "u" && navigator?.userAgent?.toLowerCase().indexOf("firefox") > -1 ? "iframe" : "webworker";
2121
2154
  })();
2122
- async function Ut({
2155
+ async function Ht({
2123
2156
  iframe: t,
2124
2157
  blueprint: e,
2125
2158
  remoteUrl: r,
2126
- progressTracker: s = new L(),
2159
+ progressTracker: s = new A(),
2127
2160
  disableProgressBar: n,
2128
2161
  onBlueprintStepCompleted: i
2129
2162
  }) {
2130
- if (At(r), r = ee(r, {
2163
+ if (It(r), r = re(r, {
2131
2164
  progressbar: !n
2132
2165
  }), s.setCaption("Preparing WordPress"), !e)
2133
- return Z(t, r, s);
2134
- const o = ft(e, {
2166
+ return te(t, r, s);
2167
+ const o = yt(e, {
2135
2168
  progress: s.stage(0.5),
2136
2169
  onStepCompleted: i
2137
- }), a = await Z(
2170
+ }), a = await te(
2138
2171
  t,
2139
- ee(r, {
2172
+ re(r, {
2140
2173
  php: o.versions.php,
2141
2174
  wp: o.versions.wp
2142
2175
  }),
2143
2176
  s
2144
2177
  );
2145
- return await yt(o, a), a;
2178
+ return await $t(o, a), s.finish(), a;
2146
2179
  }
2147
- async function Z(t, e, r) {
2148
- await new Promise((n) => {
2149
- t.src = e, t.addEventListener("load", n, !1);
2180
+ async function te(t, e, r) {
2181
+ await new Promise((i) => {
2182
+ t.src = e, t.addEventListener("load", i, !1);
2150
2183
  });
2151
- const s = pe(
2184
+ const s = we(
2152
2185
  t.contentWindow
2153
2186
  );
2154
- return await s.isConnected(), r.pipe(s), await s.onDownloadProgress(
2155
- r.stage().loadingListener
2156
- ), await s.isReady(), s;
2187
+ await s.isConnected(), r.pipe(s);
2188
+ const n = r.stage();
2189
+ return await s.onDownloadProgress(n.loadingListener), await s.isReady(), n.finish(), s;
2157
2190
  }
2158
2191
  const F = "https://playground.wordpress.net";
2159
- function At(t) {
2192
+ function It(t) {
2160
2193
  const e = new URL(t, F);
2161
2194
  if ((e.origin === F || e.hostname === "localhost") && e.pathname !== "/remote.html")
2162
2195
  throw new Error(
2163
2196
  `Invalid remote URL: ${e}. Expected origin to be ${F}/remote.html.`
2164
2197
  );
2165
2198
  }
2166
- function ee(t, e) {
2199
+ function re(t, e) {
2167
2200
  const r = new URL(t, F), s = new URLSearchParams(r.search);
2168
2201
  for (const [n, i] of Object.entries(e))
2169
2202
  i != null && i !== !1 && s.set(n, i.toString());
2170
2203
  return r.search = s.toString(), r.toString();
2171
2204
  }
2172
- async function Ht(t, e) {
2205
+ async function zt(t, e) {
2173
2206
  if (console.warn(
2174
2207
  "`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."
2175
2208
  ), e?.loadRemote)
2176
- return Ut({
2209
+ return Ht({
2177
2210
  iframe: t,
2178
2211
  remoteUrl: e.loadRemote
2179
2212
  });
2180
- const r = pe(
2213
+ const r = we(
2181
2214
  t.contentWindow
2182
2215
  );
2183
2216
  return await r.isConnected(), r;
2184
2217
  }
2185
2218
  export {
2186
- Ve as LatestSupportedPHPVersion,
2187
- D as SupportedPHPVersions,
2188
- Lt as SupportedPHPVersionsList,
2189
- ge as activatePlugin,
2190
- ye as applyWordPressPatches,
2191
- ft as compileBlueprint,
2192
- Ht as connectPlayground,
2193
- ve as cp,
2194
- Fe as defineSiteUrl,
2195
- Ae as importFile,
2196
- Ie as installPlugin,
2197
- Ne as installTheme,
2198
- ze as login,
2199
- Re as mkdir,
2200
- Ee as mv,
2219
+ Ye as LatestSupportedPHPVersion,
2220
+ z as SupportedPHPVersions,
2221
+ Nt as SupportedPHPVersionsList,
2222
+ _e as activatePlugin,
2223
+ $e as applyWordPressPatches,
2224
+ yt as compileBlueprint,
2225
+ zt as connectPlayground,
2226
+ xe as cp,
2227
+ Le as defineSiteUrl,
2228
+ Ne as importFile,
2229
+ qe as installPlugin,
2230
+ We as installTheme,
2231
+ Me as login,
2232
+ Fe as mkdir,
2233
+ Ce as mv,
2201
2234
  S as phpVar,
2202
- z as phpVars,
2203
- Ue as replaceSite,
2204
- Se as request,
2205
- Te as rm,
2206
- xe as rmdir,
2207
- yt as runBlueprintSteps,
2208
- be as runPHP,
2209
- _e as runPHPWithOptions,
2210
- De as runWpInstallationWizard,
2211
- $e as setPhpIniEntry,
2212
- qe as setSiteOptions,
2213
- Ut as startPlaygroundWeb,
2214
- re as unzip,
2215
- We as updateUserMeta,
2216
- Ce as writeFile,
2217
- Oe as zipEntireSite
2235
+ D as phpVars,
2236
+ Ie as replaceSite,
2237
+ Te as request,
2238
+ ke as rm,
2239
+ Oe as rmdir,
2240
+ $t as runBlueprintSteps,
2241
+ ve as runPHP,
2242
+ Ee as runPHPWithOptions,
2243
+ je as runWpInstallationWizard,
2244
+ Re as setPhpIniEntry,
2245
+ Dt as setPluginProxyURL,
2246
+ Be as setSiteOptions,
2247
+ Ht as startPlaygroundWeb,
2248
+ ne as unzip,
2249
+ Ve as updateUserMeta,
2250
+ Ue as writeFile,
2251
+ He as zipEntireSite
2218
2252
  };