@wp-playground/client 0.6.15 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/index.cjs +60 -32
  2. package/index.d.ts +152 -226
  3. package/index.js +968 -823
  4. package/package.json +2 -2
package/index.js CHANGED
@@ -1,13 +1,13 @@
1
- var Nt = (e, t, r) => {
1
+ var It = (e, t, r) => {
2
2
  if (!t.has(e))
3
3
  throw TypeError("Cannot " + r);
4
4
  };
5
- var H = (e, t, r) => (Nt(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Q = (e, t, r) => {
5
+ var x = (e, t, r) => (It(e, t, "read from private field"), r ? r.call(e) : t.get(e)), K = (e, t, r) => {
6
6
  if (t.has(e))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
8
  t instanceof WeakSet ? t.add(e) : t.set(e, r);
9
- }, te = (e, t, r, n) => (Nt(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
10
- var ce = (e, t, r) => (Nt(e, t, "access private method"), r);
9
+ }, ie = (e, t, r, n) => (It(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
10
+ var ce = (e, t, r) => (It(e, t, "access private method"), r);
11
11
  const currentJsRuntime = function() {
12
12
  var e;
13
13
  return typeof process < "u" && ((e = process.release) == null ? void 0 : e.name) === "node" ? "NODE" : typeof window < "u" ? "WEB" : (
@@ -97,19 +97,40 @@ const wpContentFilesExcludedFromExport = [
97
97
  "themes/twentytwentyfour",
98
98
  "themes/twentytwentyfive",
99
99
  "themes/twentytwentysix"
100
- ];
100
+ ], SleepFinished = Symbol("SleepFinished");
101
+ function sleep(e) {
102
+ return new Promise((t) => {
103
+ setTimeout(() => t(SleepFinished), e);
104
+ });
105
+ }
106
+ class AcquireTimeoutError extends Error {
107
+ constructor() {
108
+ super("Acquiring lock timed out");
109
+ }
110
+ }
101
111
  class Semaphore {
102
- constructor({ concurrency: t }) {
103
- this._running = 0, this.concurrency = t, this.queue = [];
112
+ constructor({ concurrency: t, timeout: r }) {
113
+ this._running = 0, this.concurrency = t, this.timeout = r, this.queue = [];
114
+ }
115
+ get remaining() {
116
+ return this.concurrency - this.running;
104
117
  }
105
118
  get running() {
106
119
  return this._running;
107
120
  }
108
121
  async acquire() {
109
122
  for (; ; )
110
- if (this._running >= this.concurrency)
111
- await new Promise((t) => this.queue.push(t));
112
- else {
123
+ if (this._running >= this.concurrency) {
124
+ const t = new Promise((r) => {
125
+ this.queue.push(r);
126
+ });
127
+ this.timeout !== void 0 ? await Promise.race([t, sleep(this.timeout)]).then(
128
+ (r) => {
129
+ if (r === SleepFinished)
130
+ throw new AcquireTimeoutError();
131
+ }
132
+ ) : await t;
133
+ } else {
113
134
  this._running++;
114
135
  let t = !1;
115
136
  return () => {
@@ -274,7 +295,7 @@ require_once( ${phpVar(s)}. "/wp-load.php" );
274
295
  require_once( ${phpVar(s)}. "/wp-admin/includes/plugin.php" );
275
296
 
276
297
  // Set current user to admin
277
- set_current_user( get_users(array('role' => 'Administrator') )[0] );
298
+ wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
278
299
 
279
300
  $plugin_path = ${phpVar(t)};
280
301
 
@@ -304,7 +325,7 @@ define( 'WP_ADMIN', true );
304
325
  require_once( ${phpVar(n)}. "/wp-load.php" );
305
326
 
306
327
  // Set current user to admin
307
- set_current_user( get_users(array('role' => 'Administrator') )[0] );
328
+ wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
308
329
 
309
330
  switch_theme( ${phpVar(t)} );
310
331
  `
@@ -341,8 +362,6 @@ switch_theme( ${phpVar(t)} );
341
362
  `
342
363
  });
343
364
  return await rm(e, { path: n }), o;
344
- }, setPhpIniEntry = async (e, { key: t, value: r }) => {
345
- await e.setPhpIniEntry(t, r);
346
365
  }, request = async (e, { request: t }) => {
347
366
  const r = await e.request(t);
348
367
  if (r.httpStatusCode > 399 || r.httpStatusCode < 200)
@@ -793,7 +812,7 @@ define( 'WP_ADMIN', true );
793
812
  require_once(${phpVar(s)} . "/wp-load.php");
794
813
 
795
814
  // Set current user to admin
796
- set_current_user( get_users(array('role' => 'Administrator') )[0] );
815
+ ( get_users(array('role' => 'Administrator') )[0] );
797
816
 
798
817
  require_once(${phpVar(s)} . "/wp-admin/includes/plugin.php");
799
818
  $plugins_root = ${phpVar(s)} . "/wp-content/plugins";
@@ -1298,7 +1317,6 @@ const allStepHandlers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
1298
1317
  runPHPWithOptions,
1299
1318
  runSql,
1300
1319
  runWpInstallationWizard,
1301
- setPhpIniEntry,
1302
1320
  setSiteOptions,
1303
1321
  unzip,
1304
1322
  updateUserMeta,
@@ -1731,96 +1749,7 @@ const SupportedPHPVersions = [
1731
1749
  ], SupportedPHPExtensionBundles = {
1732
1750
  "kitchen-sink": SupportedPHPExtensionsList,
1733
1751
  light: []
1734
- };
1735
- var Ae, Ge;
1736
- class PHPBrowser {
1737
- /**
1738
- * @param server - The PHP server to browse.
1739
- * @param config - The browser configuration.
1740
- */
1741
- constructor(t, r = {}) {
1742
- Q(this, Ae, void 0);
1743
- Q(this, Ge, void 0);
1744
- this.requestHandler = t, te(this, Ae, {}), te(this, Ge, {
1745
- handleRedirects: !1,
1746
- maxRedirects: 4,
1747
- ...r
1748
- });
1749
- }
1750
- /**
1751
- * Sends the request to the server.
1752
- *
1753
- * When cookies are present in the response, this method stores
1754
- * them and sends them with any subsequent requests.
1755
- *
1756
- * When a redirection is present in the response, this method
1757
- * follows it by discarding a response and sending a subsequent
1758
- * request.
1759
- *
1760
- * @param request - The request.
1761
- * @param redirects - Internal. The number of redirects handled so far.
1762
- * @returns PHPRequestHandler response.
1763
- */
1764
- async request(t, r = 0) {
1765
- const n = await this.requestHandler.request({
1766
- ...t,
1767
- headers: {
1768
- ...t.headers,
1769
- cookie: this.serializeCookies()
1770
- }
1771
- });
1772
- if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this, Ge).handleRedirects && n.headers.location && r < H(this, Ge).maxRedirects) {
1773
- const s = new URL(
1774
- n.headers.location[0],
1775
- this.requestHandler.absoluteUrl
1776
- );
1777
- return this.request(
1778
- {
1779
- url: s.toString(),
1780
- method: "GET",
1781
- headers: {}
1782
- },
1783
- r + 1
1784
- );
1785
- }
1786
- return n;
1787
- }
1788
- /** @inheritDoc */
1789
- pathToInternalUrl(t) {
1790
- return this.requestHandler.pathToInternalUrl(t);
1791
- }
1792
- /** @inheritDoc */
1793
- internalUrlToPath(t) {
1794
- return this.requestHandler.internalUrlToPath(t);
1795
- }
1796
- /** @inheritDoc */
1797
- get absoluteUrl() {
1798
- return this.requestHandler.absoluteUrl;
1799
- }
1800
- /** @inheritDoc */
1801
- get documentRoot() {
1802
- return this.requestHandler.documentRoot;
1803
- }
1804
- setCookies(t) {
1805
- for (const r of t)
1806
- try {
1807
- if (!r.includes("="))
1808
- continue;
1809
- const n = r.indexOf("="), s = r.substring(0, n), i = r.substring(n + 1).split(";")[0];
1810
- H(this, Ae)[s] = i;
1811
- } catch (n) {
1812
- console.error(n);
1813
- }
1814
- }
1815
- serializeCookies() {
1816
- const t = [];
1817
- for (const r in H(this, Ae))
1818
- t.push(`${r}=${H(this, Ae)[r]}`);
1819
- return t.join("; ");
1820
- }
1821
- }
1822
- Ae = new WeakMap(), Ge = new WeakMap();
1823
- const DEFAULT_BASE_URL = "http://example.com";
1752
+ }, DEFAULT_BASE_URL = "http://example.com";
1824
1753
  function toRelativeUrl(e) {
1825
1754
  return e.toString().substring(e.origin.length);
1826
1755
  }
@@ -1858,7 +1787,30 @@ function fileToUint8Array(e) {
1858
1787
  }, r.readAsArrayBuffer(e);
1859
1788
  });
1860
1789
  }
1861
- var Pe, Ke, dt, De, Je, ve, Qe, Fe, mt, zt, _t, Wt, gt, Bt;
1790
+ class HttpCookieStore {
1791
+ constructor() {
1792
+ this.cookies = {};
1793
+ }
1794
+ rememberCookiesFromResponseHeaders(t) {
1795
+ if (t != null && t["set-cookie"])
1796
+ for (const r of t["set-cookie"])
1797
+ try {
1798
+ if (!r.includes("="))
1799
+ continue;
1800
+ const n = r.indexOf("="), s = r.substring(0, n), i = r.substring(n + 1).split(";")[0];
1801
+ this.cookies[s] = i;
1802
+ } catch (n) {
1803
+ console.error(n);
1804
+ }
1805
+ }
1806
+ getCookieRequestHeader() {
1807
+ const t = [];
1808
+ for (const r in this.cookies)
1809
+ t.push(`${r}=${this.cookies[r]}`);
1810
+ return t.join("; ");
1811
+ }
1812
+ }
1813
+ var Pe, We, ct, je, Be, we, Ge, Ae, Ke, ft, Wt, ht, Bt, mt, Gt;
1862
1814
  class PHPRequestHandler {
1863
1815
  /**
1864
1816
  * @param php - The PHP instance.
@@ -1871,7 +1823,7 @@ class PHPRequestHandler {
1871
1823
  * @param fsPath - Absolute path of the static file to serve.
1872
1824
  * @returns The response.
1873
1825
  */
1874
- Q(this, mt);
1826
+ K(this, ft);
1875
1827
  /**
1876
1828
  * Runs the requested PHP file with all the request and $_SERVER
1877
1829
  * superglobals populated.
@@ -1879,7 +1831,7 @@ class PHPRequestHandler {
1879
1831
  * @param request - The request.
1880
1832
  * @returns The response.
1881
1833
  */
1882
- Q(this, _t);
1834
+ K(this, ht);
1883
1835
  /**
1884
1836
  * Resolve the requested path to the filesystem path of the requested PHP file.
1885
1837
  *
@@ -1889,55 +1841,120 @@ class PHPRequestHandler {
1889
1841
  * @throws {Error} If the requested path doesn't exist.
1890
1842
  * @returns The resolved filesystem path.
1891
1843
  */
1892
- Q(this, gt);
1893
- Q(this, Pe, void 0);
1894
- Q(this, Ke, void 0);
1895
- Q(this, dt, void 0);
1896
- Q(this, De, void 0);
1897
- Q(this, Je, void 0);
1898
- Q(this, ve, void 0);
1899
- Q(this, Qe, void 0);
1900
- Q(this, Fe, void 0);
1901
- te(this, Fe, new Semaphore({ concurrency: 1 }));
1844
+ K(this, mt);
1845
+ K(this, Pe, void 0);
1846
+ K(this, We, void 0);
1847
+ K(this, ct, void 0);
1848
+ K(this, je, void 0);
1849
+ K(this, Be, void 0);
1850
+ K(this, we, void 0);
1851
+ K(this, Ge, void 0);
1852
+ K(this, Ae, void 0);
1853
+ K(this, Ke, void 0);
1854
+ ie(this, Ae, new Semaphore({ concurrency: 1 }));
1902
1855
  const {
1903
1856
  documentRoot: n = "/www/",
1904
1857
  absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : "",
1905
1858
  rewriteRules: i = []
1906
1859
  } = r;
1907
- this.php = t, te(this, Pe, n);
1860
+ this.php = t, ie(this, Ke, new HttpCookieStore()), ie(this, Pe, n);
1908
1861
  const o = new URL(s);
1909
- te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this, Ke, (o.protocol || "").replace(":", ""));
1910
- const c = H(this, De) !== 443 && H(this, De) !== 80;
1911
- te(this, Je, [
1912
- H(this, dt),
1913
- c ? `:${H(this, De)}` : ""
1914
- ].join("")), te(this, ve, o.pathname.replace(/\/+$/, "")), te(this, Qe, [
1915
- `${H(this, Ke)}://`,
1916
- H(this, Je),
1917
- H(this, ve)
1862
+ ie(this, ct, o.hostname), ie(this, je, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), ie(this, We, (o.protocol || "").replace(":", ""));
1863
+ const c = x(this, je) !== 443 && x(this, je) !== 80;
1864
+ ie(this, Be, [
1865
+ x(this, ct),
1866
+ c ? `:${x(this, je)}` : ""
1867
+ ].join("")), ie(this, we, o.pathname.replace(/\/+$/, "")), ie(this, Ge, [
1868
+ `${x(this, We)}://`,
1869
+ x(this, Be),
1870
+ x(this, we)
1918
1871
  ].join("")), this.rewriteRules = i;
1919
1872
  }
1920
- /** @inheritDoc */
1873
+ /**
1874
+ * Converts a path to an absolute URL based at the PHPRequestHandler
1875
+ * root.
1876
+ *
1877
+ * @param path The server path to convert to an absolute URL.
1878
+ * @returns The absolute URL.
1879
+ */
1921
1880
  pathToInternalUrl(t) {
1922
1881
  return `${this.absoluteUrl}${t}`;
1923
1882
  }
1924
- /** @inheritDoc */
1883
+ /**
1884
+ * Converts an absolute URL based at the PHPRequestHandler to a relative path
1885
+ * without the server pathname and scope.
1886
+ *
1887
+ * @param internalUrl An absolute URL based at the PHPRequestHandler root.
1888
+ * @returns The relative path.
1889
+ */
1925
1890
  internalUrlToPath(t) {
1926
1891
  const r = new URL(t);
1927
- return r.pathname.startsWith(H(this, ve)) && (r.pathname = r.pathname.slice(H(this, ve).length)), toRelativeUrl(r);
1892
+ return r.pathname.startsWith(x(this, we)) && (r.pathname = r.pathname.slice(x(this, we).length)), toRelativeUrl(r);
1928
1893
  }
1929
1894
  get isRequestRunning() {
1930
- return H(this, Fe).running > 0;
1895
+ return x(this, Ae).running > 0;
1931
1896
  }
1932
- /** @inheritDoc */
1897
+ /**
1898
+ * The absolute URL of this PHPRequestHandler instance.
1899
+ */
1933
1900
  get absoluteUrl() {
1934
- return H(this, Qe);
1901
+ return x(this, Ge);
1935
1902
  }
1936
- /** @inheritDoc */
1903
+ /**
1904
+ * The directory in the PHP filesystem where the server will look
1905
+ * for the files to serve. Default: `/var/www`.
1906
+ */
1937
1907
  get documentRoot() {
1938
- return H(this, Pe);
1908
+ return x(this, Pe);
1939
1909
  }
1940
- /** @inheritDoc */
1910
+ /**
1911
+ * Serves the request – either by serving a static file, or by
1912
+ * dispatching it to the PHP runtime.
1913
+ *
1914
+ * The request() method mode behaves like a web server and only works if
1915
+ * the PHP was initialized with a `requestHandler` option (which the online version
1916
+ * of WordPress Playground does by default).
1917
+ *
1918
+ * In the request mode, you pass an object containing the request information
1919
+ * (method, headers, body, etc.) and the path to the PHP file to run:
1920
+ *
1921
+ * ```ts
1922
+ * const php = PHP.load('7.4', {
1923
+ * requestHandler: {
1924
+ * documentRoot: "/www"
1925
+ * }
1926
+ * })
1927
+ * php.writeFile("/www/index.php", `<?php echo file_get_contents("php://input");`);
1928
+ * const result = await php.request({
1929
+ * method: "GET",
1930
+ * headers: {
1931
+ * "Content-Type": "text/plain"
1932
+ * },
1933
+ * body: "Hello world!",
1934
+ * path: "/www/index.php"
1935
+ * });
1936
+ * // result.text === "Hello world!"
1937
+ * ```
1938
+ *
1939
+ * The `request()` method cannot be used in conjunction with `cli()`.
1940
+ *
1941
+ * @example
1942
+ * ```js
1943
+ * const output = await php.request({
1944
+ * method: 'GET',
1945
+ * url: '/index.php',
1946
+ * headers: {
1947
+ * 'X-foo': 'bar',
1948
+ * },
1949
+ * body: {
1950
+ * foo: 'bar',
1951
+ * },
1952
+ * });
1953
+ * console.log(output.stdout); // "Hello world!"
1954
+ * ```
1955
+ *
1956
+ * @param request - PHP Request data.
1957
+ */
1941
1958
  async request(t) {
1942
1959
  const r = t.url.startsWith("http://") || t.url.startsWith("https://"), n = new URL(
1943
1960
  // Remove the hash part of the URL as it's not meant for the server.
@@ -1946,14 +1963,14 @@ class PHPRequestHandler {
1946
1963
  ), s = applyRewriteRules(
1947
1964
  removePathPrefix(
1948
1965
  decodeURIComponent(n.pathname),
1949
- H(this, ve)
1966
+ x(this, we)
1950
1967
  ),
1951
1968
  this.rewriteRules
1952
- ), i = joinPaths(H(this, Pe), s);
1953
- return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, zt).call(this, i);
1969
+ ), i = joinPaths(x(this, Pe), s);
1970
+ return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, ht, Bt).call(this, t, n) : ce(this, ft, Wt).call(this, i);
1954
1971
  }
1955
1972
  }
1956
- Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(), Je = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), Fe = new WeakMap(), mt = new WeakSet(), zt = function(t) {
1973
+ Pe = new WeakMap(), We = new WeakMap(), ct = new WeakMap(), je = new WeakMap(), Be = new WeakMap(), we = new WeakMap(), Ge = new WeakMap(), Ae = new WeakMap(), Ke = new WeakMap(), ft = new WeakSet(), Wt = function(t) {
1957
1974
  if (!this.php.fileExists(t))
1958
1975
  return new PHPResponse(
1959
1976
  404,
@@ -1978,9 +1995,9 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
1978
1995
  },
1979
1996
  r
1980
1997
  );
1981
- }, _t = new WeakSet(), Wt = async function(t, r) {
1998
+ }, ht = new WeakSet(), Bt = async function(t, r) {
1982
1999
  var s;
1983
- if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
2000
+ if (x(this, Ae).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
1984
2001
  return console.warn(
1985
2002
  "Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."
1986
2003
  ), new PHPResponse(
@@ -1988,16 +2005,13 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
1988
2005
  {},
1989
2006
  new TextEncoder().encode("502 Bad Gateway")
1990
2007
  );
1991
- const n = await H(this, Fe).acquire();
2008
+ const n = await x(this, Ae).acquire();
1992
2009
  try {
1993
- this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this, Pe)), this.php.addServerGlobalEntry(
1994
- "HTTPS",
1995
- H(this, Qe).startsWith("https://") ? "on" : ""
1996
- );
1997
2010
  let i = "GET";
1998
2011
  const o = {
1999
- host: H(this, Je),
2000
- ...normalizeHeaders(t.headers || {})
2012
+ host: x(this, Be),
2013
+ ...normalizeHeaders(t.headers || {}),
2014
+ cookie: x(this, Ke).getCookieRequestHeader()
2001
2015
  };
2002
2016
  let c = t.body;
2003
2017
  if (typeof c == "object" && !(c instanceof Uint8Array)) {
@@ -2007,7 +2021,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
2007
2021
  }
2008
2022
  let d;
2009
2023
  try {
2010
- d = ce(this, gt, Bt).call(this, decodeURIComponent(r.pathname));
2024
+ d = ce(this, mt, Gt).call(this, decodeURIComponent(r.pathname));
2011
2025
  } catch {
2012
2026
  return new PHPResponse(
2013
2027
  404,
@@ -2015,24 +2029,39 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
2015
2029
  new TextEncoder().encode("404 File not found")
2016
2030
  );
2017
2031
  }
2018
- return await this.php.run({
2019
- relativeUri: ensurePathPrefix(
2020
- toRelativeUrl(r),
2021
- H(this, ve)
2022
- ),
2023
- protocol: H(this, Ke),
2024
- method: t.method || i,
2025
- body: c,
2026
- scriptPath: d,
2027
- headers: o
2028
- });
2032
+ try {
2033
+ const u = await this.php.run({
2034
+ relativeUri: ensurePathPrefix(
2035
+ toRelativeUrl(r),
2036
+ x(this, we)
2037
+ ),
2038
+ protocol: x(this, We),
2039
+ method: t.method || i,
2040
+ $_SERVER: {
2041
+ REMOTE_ADDR: "127.0.0.1",
2042
+ DOCUMENT_ROOT: x(this, Pe),
2043
+ HTTPS: x(this, Ge).startsWith("https://") ? "on" : ""
2044
+ },
2045
+ body: c,
2046
+ scriptPath: d,
2047
+ headers: o
2048
+ });
2049
+ return x(this, Ke).rememberCookiesFromResponseHeaders(
2050
+ u.headers
2051
+ ), u;
2052
+ } catch (u) {
2053
+ const p = u;
2054
+ if (p != null && p.response)
2055
+ return p.response;
2056
+ throw u;
2057
+ }
2029
2058
  } finally {
2030
2059
  n();
2031
2060
  }
2032
- }, gt = new WeakSet(), Bt = function(t) {
2033
- let r = removePathPrefix(t, H(this, ve));
2034
- r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${H(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
2035
- const n = `${H(this, Pe)}${r}`;
2061
+ }, mt = new WeakSet(), Gt = function(t) {
2062
+ let r = removePathPrefix(t, x(this, we));
2063
+ r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${x(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
2064
+ const n = `${x(this, Pe)}${r}`;
2036
2065
  if (this.php.fileExists(n))
2037
2066
  return n;
2038
2067
  throw new Error(`File not found: ${n}`);
@@ -2073,6 +2102,38 @@ function inferMimeType(e) {
2073
2102
  case "txt":
2074
2103
  case "md":
2075
2104
  return "text/plain";
2105
+ case "pdf":
2106
+ return "application/pdf";
2107
+ case "webp":
2108
+ return "image/webp";
2109
+ case "mp3":
2110
+ return "audio/mpeg";
2111
+ case "mp4":
2112
+ return "video/mp4";
2113
+ case "csv":
2114
+ return "text/csv";
2115
+ case "xls":
2116
+ return "application/vnd.ms-excel";
2117
+ case "xlsx":
2118
+ return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
2119
+ case "doc":
2120
+ return "application/msword";
2121
+ case "docx":
2122
+ return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
2123
+ case "ppt":
2124
+ return "application/vnd.ms-powerpoint";
2125
+ case "pptx":
2126
+ return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
2127
+ case "zip":
2128
+ return "application/zip";
2129
+ case "rar":
2130
+ return "application/x-rar-compressed";
2131
+ case "tar":
2132
+ return "application/x-tar";
2133
+ case "gz":
2134
+ return "application/gzip";
2135
+ case "7z":
2136
+ return "application/x-7z-compressed";
2076
2137
  default:
2077
2138
  return "application-octet-stream";
2078
2139
  }
@@ -2209,7 +2270,12 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
2209
2270
  return n && s && __defProp(t, r, s), s;
2210
2271
  };
2211
2272
  const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
2212
- var Me, Ze, Ye, Ee, Re, Te, be, Xe, yt, Gt, $t, Kt, vt, Jt, wt, Qt, Pt, Zt, Et, Yt, bt, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
2273
+ class PHPExecutionFailureError extends Error {
2274
+ constructor(t, r, n) {
2275
+ super(t), this.response = r, this.source = n;
2276
+ }
2277
+ }
2278
+ var De, Je, Qe, be, Re, Ee, Ye, _t, Kt, gt, Jt, yt, Qt, $t, Yt, wt, Zt, vt, Xt, Pt, er, bt, tr, Et, rr, St, nr, Rt, sr, Tt, ir, kt, or, Ct, ar, Ot, cr;
2213
2279
  class BasePHP {
2214
2280
  /**
2215
2281
  * Initializes a PHP runtime.
@@ -2219,46 +2285,55 @@ class BasePHP {
2219
2285
  * @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
2220
2286
  */
2221
2287
  constructor(e, t) {
2222
- Q(this, yt);
2223
- Q(this, $t);
2224
- Q(this, vt);
2225
- Q(this, wt);
2226
- Q(this, Pt);
2227
- Q(this, Et);
2228
- Q(this, bt);
2229
- Q(this, St);
2230
- Q(this, Rt);
2231
- Q(this, Tt);
2232
- Q(this, kt);
2233
- Q(this, Ct);
2234
- Q(this, Me, void 0);
2235
- Q(this, Ze, void 0);
2236
- Q(this, Ye, void 0);
2237
- Q(this, Ee, void 0);
2238
- Q(this, Re, void 0);
2239
- Q(this, Te, void 0);
2240
- Q(this, be, void 0);
2241
- Q(this, Xe, void 0);
2242
- te(this, Me, []), te(this, Ee, !1), te(this, Re, null), te(this, Te, {}), te(this, be, /* @__PURE__ */ new Map()), te(this, Xe, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
2243
- new PHPRequestHandler(this, t)
2244
- ));
2288
+ /**
2289
+ * Prepares the $_SERVER entries for the PHP runtime.
2290
+ *
2291
+ * @param defaults Default entries to include in $_SERVER.
2292
+ * @param headers HTTP headers to include in $_SERVER (as HTTP_ prefixed entries).
2293
+ * @param port HTTP port, used to determine infer $_SERVER['HTTPS'] value if none
2294
+ * was provided.
2295
+ * @returns Computed $_SERVER entries.
2296
+ */
2297
+ K(this, _t);
2298
+ K(this, gt);
2299
+ K(this, yt);
2300
+ K(this, $t);
2301
+ K(this, wt);
2302
+ K(this, vt);
2303
+ K(this, Pt);
2304
+ K(this, bt);
2305
+ K(this, Et);
2306
+ K(this, St);
2307
+ K(this, Rt);
2308
+ K(this, Tt);
2309
+ K(this, kt);
2310
+ K(this, Ct);
2311
+ K(this, Ot);
2312
+ K(this, De, void 0);
2313
+ K(this, Je, void 0);
2314
+ K(this, Qe, void 0);
2315
+ K(this, be, void 0);
2316
+ K(this, Re, void 0);
2317
+ K(this, Ee, void 0);
2318
+ K(this, Ye, void 0);
2319
+ ie(this, De, []), ie(this, be, !1), ie(this, Re, null), ie(this, Ee, /* @__PURE__ */ new Map()), ie(this, Ye, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPRequestHandler(this, t));
2245
2320
  }
2246
2321
  addEventListener(e, t) {
2247
- H(this, be).has(e) || H(this, be).set(e, /* @__PURE__ */ new Set()), H(this, be).get(e).add(t);
2322
+ x(this, Ee).has(e) || x(this, Ee).set(e, /* @__PURE__ */ new Set()), x(this, Ee).get(e).add(t);
2248
2323
  }
2249
2324
  removeEventListener(e, t) {
2250
2325
  var r;
2251
- (r = H(this, be).get(e)) == null || r.delete(t);
2326
+ (r = x(this, Ee).get(e)) == null || r.delete(t);
2252
2327
  }
2253
2328
  dispatchEvent(e) {
2254
- const t = H(this, be).get(e.type);
2329
+ const t = x(this, Ee).get(e.type);
2255
2330
  if (t)
2256
2331
  for (const r of t)
2257
2332
  r(e);
2258
2333
  }
2259
2334
  /** @inheritDoc */
2260
2335
  async onMessage(e) {
2261
- H(this, Xe).push(e);
2336
+ x(this, Ye).push(e);
2262
2337
  }
2263
2338
  /** @inheritDoc */
2264
2339
  async setSpawnHandler(handler) {
@@ -2266,21 +2341,19 @@ class BasePHP {
2266
2341
  }
2267
2342
  /** @inheritDoc */
2268
2343
  get absoluteUrl() {
2269
- return this.requestHandler.requestHandler.absoluteUrl;
2344
+ return this.requestHandler.absoluteUrl;
2270
2345
  }
2271
2346
  /** @inheritDoc */
2272
2347
  get documentRoot() {
2273
- return this.requestHandler.requestHandler.documentRoot;
2348
+ return this.requestHandler.documentRoot;
2274
2349
  }
2275
2350
  /** @inheritDoc */
2276
2351
  pathToInternalUrl(e) {
2277
- return this.requestHandler.requestHandler.pathToInternalUrl(e);
2352
+ return this.requestHandler.pathToInternalUrl(e);
2278
2353
  }
2279
2354
  /** @inheritDoc */
2280
2355
  internalUrlToPath(e) {
2281
- return this.requestHandler.requestHandler.internalUrlToPath(
2282
- e
2283
- );
2356
+ return this.requestHandler.internalUrlToPath(e);
2284
2357
  }
2285
2358
  initializeRuntime(e) {
2286
2359
  if (this[__private__dont__use])
@@ -2289,13 +2362,13 @@ class BasePHP {
2289
2362
  if (!t)
2290
2363
  throw new Error("Invalid PHP runtime id.");
2291
2364
  this[__private__dont__use] = t, t.onMessage = async (r) => {
2292
- for (const n of H(this, Xe)) {
2365
+ for (const n of x(this, Ye)) {
2293
2366
  const s = await n(r);
2294
2367
  if (s)
2295
2368
  return s;
2296
2369
  }
2297
2370
  return "";
2298
- }, te(this, Re, improveWASMErrorReporting(t)), this.dispatchEvent({
2371
+ }, ie(this, Re, improveWASMErrorReporting(t)), this.dispatchEvent({
2299
2372
  type: "runtime.initialized"
2300
2373
  });
2301
2374
  }
@@ -2310,13 +2383,13 @@ class BasePHP {
2310
2383
  throw new Error(
2311
2384
  "Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?"
2312
2385
  );
2313
- te(this, Ye, e);
2386
+ ie(this, Qe, e);
2314
2387
  }
2315
2388
  /** @inheritDoc */
2316
2389
  setPhpIniPath(e) {
2317
- if (H(this, Ee))
2390
+ if (x(this, be))
2318
2391
  throw new Error("Cannot set PHP ini path after calling run().");
2319
- te(this, Ze, e), this[__private__dont__use].ccall(
2392
+ ie(this, Je, e), this[__private__dont__use].ccall(
2320
2393
  "wasm_set_phpini_path",
2321
2394
  null,
2322
2395
  ["string"],
@@ -2325,44 +2398,49 @@ class BasePHP {
2325
2398
  }
2326
2399
  /** @inheritDoc */
2327
2400
  setPhpIniEntry(e, t) {
2328
- if (H(this, Ee))
2401
+ if (x(this, be))
2329
2402
  throw new Error("Cannot set PHP ini entries after calling run().");
2330
- H(this, Me).push([e, t]);
2403
+ x(this, De).push([e, t]);
2331
2404
  }
2332
2405
  /** @inheritDoc */
2333
2406
  chdir(e) {
2334
2407
  this[__private__dont__use].FS.chdir(e);
2335
2408
  }
2336
2409
  /** @inheritDoc */
2337
- async request(e, t) {
2410
+ async request(e) {
2338
2411
  if (!this.requestHandler)
2339
2412
  throw new Error("No request handler available.");
2340
- return this.requestHandler.request(e, t);
2413
+ return this.requestHandler.request(e);
2341
2414
  }
2342
2415
  /** @inheritDoc */
2343
2416
  async run(e) {
2344
2417
  const t = await this.semaphore.acquire();
2345
2418
  let r;
2346
2419
  try {
2347
- if (H(this, Ee) || (ce(this, yt, Gt).call(this), te(this, Ee, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
2420
+ if (x(this, be) || (ce(this, gt, Jt).call(this), ie(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
2348
2421
  throw new Error(
2349
2422
  `The script path "${e.scriptPath}" does not exist.`
2350
2423
  );
2351
- ce(this, St, er).call(this, e.scriptPath || ""), ce(this, vt, Jt).call(this, e.relativeUri || ""), ce(this, Pt, Zt).call(this, e.method || "GET");
2352
- const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
2353
- ce(this, wt, Qt).call(this, s, e.protocol || "http"), ce(this, Et, Yt).call(this, n), e.body && (r = ce(this, bt, Xt).call(this, e.body)), typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
2354
- const i = e.env || {};
2355
- for (const c in i)
2356
- ce(this, Tt, rr).call(this, c, i[c]);
2357
- const o = await ce(this, Ct, sr).call(this);
2358
- if (o.exitCode !== 0) {
2359
- console.warn("PHP.run() output was:", o.text);
2360
- const c = new Error(
2361
- `PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors
2424
+ ce(this, Rt, sr).call(this, e.scriptPath || ""), ce(this, $t, Yt).call(this, e.relativeUri || ""), ce(this, bt, tr).call(this, e.method || "GET");
2425
+ const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443", i = ce(this, Pt, er).call(this, s, e.protocol || "http");
2426
+ ce(this, wt, Zt).call(this, s), ce(this, vt, Xt).call(this, i), ce(this, Et, rr).call(this, n), e.body && (r = ce(this, St, nr).call(this, e.body)), typeof e.code == "string" && ce(this, Ct, ar).call(this, " ?>" + e.code);
2427
+ const o = ce(this, _t, Kt).call(this, e.$_SERVER, n, i);
2428
+ for (const u in o)
2429
+ ce(this, Tt, ir).call(this, u, o[u]);
2430
+ const c = e.env || {};
2431
+ for (const u in c)
2432
+ ce(this, kt, or).call(this, u, c[u]);
2433
+ const d = await ce(this, Ot, cr).call(this);
2434
+ if (d.exitCode !== 0) {
2435
+ console.warn("PHP.run() output was:", d.text);
2436
+ const u = new PHPExecutionFailureError(
2437
+ `PHP.run() failed with exit code ${d.exitCode} and the following output: ` + d.errors,
2438
+ d,
2439
+ "request"
2362
2440
  );
2363
- throw c.response = o, c.source = "request", console.error(c), c;
2441
+ throw console.error(u), u;
2364
2442
  }
2365
- return o;
2443
+ return d;
2366
2444
  } catch (n) {
2367
2445
  throw this.dispatchEvent({
2368
2446
  type: "request.error",
@@ -2380,9 +2458,6 @@ class BasePHP {
2380
2458
  }
2381
2459
  }
2382
2460
  }
2383
- addServerGlobalEntry(e, t) {
2384
- H(this, Te)[e] = t;
2385
- }
2386
2461
  defineConstant(e, t) {
2387
2462
  let r = {};
2388
2463
  try {
@@ -2470,17 +2545,18 @@ class BasePHP {
2470
2545
  * interrupting the operations of this PHP instance.
2471
2546
  *
2472
2547
  * @param runtime
2548
+ * @param cwd. Internal, the VFS path to recreate in the new runtime.
2549
+ * This arg is temporary and will be removed once BasePHP
2550
+ * is fully decoupled from the request handler and
2551
+ * accepts a constructor-level cwd argument.
2473
2552
  */
2474
- hotSwapPHPRuntime(e) {
2475
- const t = this[__private__dont__use].FS;
2553
+ hotSwapPHPRuntime(e, t) {
2554
+ const r = this[__private__dont__use].FS;
2476
2555
  try {
2477
2556
  this.exit();
2478
2557
  } catch {
2479
2558
  }
2480
- if (this.initializeRuntime(e), H(this, Ze) && this.setPhpIniPath(H(this, Ze)), H(this, Ye) && this.setSapiName(H(this, Ye)), this.requestHandler) {
2481
- const r = this.documentRoot;
2482
- copyFS(t, this[__private__dont__use].FS, r);
2483
- }
2559
+ this.initializeRuntime(e), x(this, Je) && this.setPhpIniPath(x(this, Je)), x(this, Qe) && this.setSapiName(x(this, Qe)), t && copyFS(r, this[__private__dont__use].FS, t);
2484
2560
  }
2485
2561
  exit(e = 0) {
2486
2562
  this.dispatchEvent({
@@ -2490,10 +2566,20 @@ class BasePHP {
2490
2566
  this[__private__dont__use]._exit(e);
2491
2567
  } catch {
2492
2568
  }
2493
- te(this, Ee, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
2569
+ ie(this, be, !1), ie(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
2494
2570
  }
2495
2571
  }
2496
- Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), be = new WeakMap(), Xe = new WeakMap(), yt = new WeakSet(), Gt = function() {
2572
+ De = new WeakMap(), Je = new WeakMap(), Qe = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Ee = new WeakMap(), Ye = new WeakMap(), _t = new WeakSet(), Kt = function(e, t, r) {
2573
+ const n = {
2574
+ ...e || {}
2575
+ };
2576
+ n.HTTPS = n.HTTPS || r === 443 ? "on" : "off";
2577
+ for (const s in t) {
2578
+ let i = "HTTP_";
2579
+ ["content-type", "content-length"].includes(s.toLowerCase()) && (i = ""), n[`${i}${s.toUpperCase().replace(/-/g, "_")}`] = t[s];
2580
+ }
2581
+ return n;
2582
+ }, gt = new WeakSet(), Jt = function() {
2497
2583
  if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
2498
2584
  "/internal/consts.php",
2499
2585
  `<?php
@@ -2505,8 +2591,8 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2505
2591
  }
2506
2592
  }
2507
2593
  }`
2508
- ), H(this, Me).length > 0) {
2509
- const e = H(this, Me).map(([t, r]) => `${t}=${r}`).join(`
2594
+ ), x(this, De).length > 0) {
2595
+ const e = x(this, De).map(([t, r]) => `${t}=${r}`).join(`
2510
2596
  `) + `
2511
2597
 
2512
2598
  `;
@@ -2518,7 +2604,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2518
2604
  );
2519
2605
  }
2520
2606
  this[__private__dont__use].ccall("php_wasm_init", null, [], []);
2521
- }, $t = new WeakSet(), Kt = function() {
2607
+ }, yt = new WeakSet(), Qt = function() {
2522
2608
  const e = "/internal/headers.json";
2523
2609
  if (!this.fileExists(e))
2524
2610
  throw new Error(
@@ -2535,7 +2621,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2535
2621
  headers: r,
2536
2622
  httpStatusCode: t.status
2537
2623
  };
2538
- }, vt = new WeakSet(), Jt = function(e) {
2624
+ }, $t = new WeakSet(), Yt = function(e) {
2539
2625
  if (this[__private__dont__use].ccall(
2540
2626
  "wasm_set_request_uri",
2541
2627
  null,
@@ -2550,32 +2636,35 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2550
2636
  [t]
2551
2637
  );
2552
2638
  }
2553
- }, wt = new WeakSet(), Qt = function(e, t) {
2639
+ }, wt = new WeakSet(), Zt = function(e) {
2554
2640
  this[__private__dont__use].ccall(
2555
2641
  "wasm_set_request_host",
2556
2642
  null,
2557
2643
  [STRING],
2558
2644
  [e]
2559
2645
  );
2646
+ }, vt = new WeakSet(), Xt = function(e) {
2647
+ this[__private__dont__use].ccall(
2648
+ "wasm_set_request_port",
2649
+ null,
2650
+ [NUMBER],
2651
+ [e]
2652
+ );
2653
+ }, Pt = new WeakSet(), er = function(e, t) {
2560
2654
  let r;
2561
2655
  try {
2562
2656
  r = parseInt(new URL(e).port, 10);
2563
2657
  } catch {
2564
2658
  }
2565
- (!r || isNaN(r) || r === 80) && (r = t === "https" ? 443 : 80), this[__private__dont__use].ccall(
2566
- "wasm_set_request_port",
2567
- null,
2568
- [NUMBER],
2569
- [r]
2570
- ), (t === "https" || !t && r === 443) && this.addServerGlobalEntry("HTTPS", "on");
2571
- }, Pt = new WeakSet(), Zt = function(e) {
2659
+ return (!r || isNaN(r) || r === 80) && (r = t === "https" ? 443 : 80), r;
2660
+ }, bt = new WeakSet(), tr = function(e) {
2572
2661
  this[__private__dont__use].ccall(
2573
2662
  "wasm_set_request_method",
2574
2663
  null,
2575
2664
  [STRING],
2576
2665
  [e]
2577
2666
  );
2578
- }, Et = new WeakSet(), Yt = function(e) {
2667
+ }, Et = new WeakSet(), rr = function(e) {
2579
2668
  e.cookie && this[__private__dont__use].ccall(
2580
2669
  "wasm_set_cookies",
2581
2670
  null,
@@ -2592,14 +2681,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2592
2681
  [NUMBER],
2593
2682
  [parseInt(e["content-length"], 10)]
2594
2683
  );
2595
- for (const t in e) {
2596
- let r = "HTTP_";
2597
- ["content-type", "content-length"].includes(t.toLowerCase()) && (r = ""), this.addServerGlobalEntry(
2598
- `${r}${t.toUpperCase().replace(/-/g, "_")}`,
2599
- e[t]
2600
- );
2601
- }
2602
- }, bt = new WeakSet(), Xt = function(e) {
2684
+ }, St = new WeakSet(), nr = function(e) {
2603
2685
  let t, r;
2604
2686
  typeof e == "string" ? (console.warn(
2605
2687
  "Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"
@@ -2622,36 +2704,35 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2622
2704
  [NUMBER],
2623
2705
  [r]
2624
2706
  ), n;
2625
- }, St = new WeakSet(), er = function(e) {
2707
+ }, Rt = new WeakSet(), sr = function(e) {
2626
2708
  this[__private__dont__use].ccall(
2627
2709
  "wasm_set_path_translated",
2628
2710
  null,
2629
2711
  [STRING],
2630
2712
  [e]
2631
2713
  );
2632
- }, Rt = new WeakSet(), tr = function() {
2633
- for (const e in H(this, Te))
2634
- this[__private__dont__use].ccall(
2635
- "wasm_add_SERVER_entry",
2636
- null,
2637
- [STRING, STRING],
2638
- [e, H(this, Te)[e]]
2639
- );
2640
- }, Tt = new WeakSet(), rr = function(e, t) {
2714
+ }, Tt = new WeakSet(), ir = function(e, t) {
2715
+ this[__private__dont__use].ccall(
2716
+ "wasm_add_SERVER_entry",
2717
+ null,
2718
+ [STRING, STRING],
2719
+ [e, t]
2720
+ );
2721
+ }, kt = new WeakSet(), or = function(e, t) {
2641
2722
  this[__private__dont__use].ccall(
2642
2723
  "wasm_add_ENV_entry",
2643
2724
  null,
2644
2725
  [STRING, STRING],
2645
2726
  [e, t]
2646
2727
  );
2647
- }, kt = new WeakSet(), nr = function(e) {
2728
+ }, Ct = new WeakSet(), ar = function(e) {
2648
2729
  this[__private__dont__use].ccall(
2649
2730
  "wasm_set_php_code",
2650
2731
  null,
2651
2732
  [STRING],
2652
2733
  [e]
2653
2734
  );
2654
- }, Ct = new WeakSet(), sr = async function() {
2735
+ }, Ot = new WeakSet(), cr = async function() {
2655
2736
  var s;
2656
2737
  let e, t;
2657
2738
  try {
@@ -2661,7 +2742,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2661
2742
  console.error(u), console.error(u.error);
2662
2743
  const p = new Error("Rethrown");
2663
2744
  p.cause = u.error, p.betterMessage = u.message, o(p);
2664
- }, (d = H(this, Re)) == null || d.addEventListener(
2745
+ }, (d = x(this, Re)) == null || d.addEventListener(
2665
2746
  "error",
2666
2747
  t
2667
2748
  );
@@ -2685,11 +2766,11 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
2685
2766
  const o = i, c = "betterMessage" in o ? o.betterMessage : o.message, d = new Error(c);
2686
2767
  throw d.cause = o, console.error(d), d;
2687
2768
  } finally {
2688
- (s = H(this, Re)) == null || s.removeEventListener("error", t), te(this, Te, {});
2769
+ (s = x(this, Re)) == null || s.removeEventListener("error", t);
2689
2770
  }
2690
- const { headers: r, httpStatusCode: n } = ce(this, $t, Kt).call(this);
2771
+ const { headers: r, httpStatusCode: n } = ce(this, yt, Qt).call(this);
2691
2772
  return new PHPResponse(
2692
- n,
2773
+ e === 0 ? n : 500,
2693
2774
  r,
2694
2775
  this.readFileAsBuffer("/internal/stdout"),
2695
2776
  this.readFileAsText("/internal/stderr"),
@@ -2851,16 +2932,52 @@ class FetchResource extends Resource {
2851
2932
  }
2852
2933
  /** @inheritDoc */
2853
2934
  async resolve() {
2854
- var n, s;
2855
- (n = this.progress) == null || n.setCaption(this.caption);
2935
+ var r, n;
2936
+ (r = this.progress) == null || r.setCaption(this.caption);
2856
2937
  const t = this.getURL();
2857
- let r = await fetch(t);
2858
- if (r = await cloneResponseMonitorProgress(
2859
- r,
2860
- ((s = this.progress) == null ? void 0 : s.loadingListener) ?? noop
2861
- ), r.status !== 200)
2862
- throw new Error(`Could not download "${t}"`);
2863
- return new File([await r.blob()], this.name);
2938
+ try {
2939
+ let s = await fetch(t);
2940
+ if (!s.ok)
2941
+ throw new Error(`Could not download "${t}"`);
2942
+ if (s = await cloneResponseMonitorProgress(
2943
+ s,
2944
+ ((n = this.progress) == null ? void 0 : n.loadingListener) ?? noop
2945
+ ), s.status !== 200)
2946
+ throw new Error(`Could not download "${t}"`);
2947
+ return new File([await s.blob()], this.name);
2948
+ } catch (s) {
2949
+ throw new Error(
2950
+ `Could not download "${t}".
2951
+ Check if the URL is correct and the server is reachable.
2952
+ If the url is reachable, the server might be blocking the request.
2953
+ Check the console and network for more information.
2954
+
2955
+ ## Does the console shows an error about "No 'Access-Control-Allow-Origin' header"?
2956
+
2957
+ This means the server where your file is hosted does not allow requests from other sites
2958
+ (cross-origin requests, or CORS). You will need to move it to another server that allows
2959
+ cross-origin file downloads. You can learn more about CORS at
2960
+ https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS.
2961
+
2962
+ If you're loading a file from https://github.com/, there's an easy fix – you can load it from
2963
+ raw.githubusercontent.com instead. Here's how to do that:
2964
+
2965
+ 1. Start with the original GitHub URL for the file. For example:
2966
+ '''
2967
+ https://github.com/username/repository/blob/branch/filename
2968
+ '''
2969
+ 2. Replace 'github.com' with 'raw.githubusercontent.com'.
2970
+ 3. Remove the '/blob/' part of the URL.
2971
+
2972
+ The resulting URL should look like this:
2973
+ '''
2974
+ https://raw.githubusercontent.com/username/repository/branch/filename
2975
+ '''
2976
+
2977
+ Error:
2978
+ ${s}`
2979
+ );
2980
+ }
2864
2981
  }
2865
2982
  /**
2866
2983
  * Gets the caption for the progress tracker.
@@ -3374,12 +3491,12 @@ var scope = {};
3374
3491
  let M = N.length;
3375
3492
  for (; M--; ) {
3376
3493
  const L = N[M];
3377
- L.optimizeNames(a, h) || (ke(a, L.names), N.splice(M, 1));
3494
+ L.optimizeNames(a, h) || (Te(a, L.names), N.splice(M, 1));
3378
3495
  }
3379
3496
  return N.length > 0 ? this : void 0;
3380
3497
  }
3381
3498
  get names() {
3382
- return this.nodes.reduce((a, h) => K(a, h.names), {});
3499
+ return this.nodes.reduce((a, h) => J(a, h.names), {});
3383
3500
  }
3384
3501
  }
3385
3502
  class S extends C {
@@ -3411,7 +3528,7 @@ var scope = {};
3411
3528
  h = this.else = Array.isArray(N) ? new $(N) : N;
3412
3529
  }
3413
3530
  if (h)
3414
- return a === !1 ? h instanceof g ? h : h.nodes : this.nodes.length ? this : new g(Ce(a), h instanceof g ? [h] : h.nodes);
3531
+ return a === !1 ? h instanceof g ? h : h.nodes : this.nodes.length ? this : new g(ke(a), h instanceof g ? [h] : h.nodes);
3415
3532
  if (!(a === !1 || !this.nodes.length))
3416
3533
  return this;
3417
3534
  }
@@ -3422,7 +3539,7 @@ var scope = {};
3422
3539
  }
3423
3540
  get names() {
3424
3541
  const a = super.names;
3425
- return ue(a, this.condition), this.else && K(a, this.else.names), a;
3542
+ return ue(a, this.condition), this.else && J(a, this.else.names), a;
3426
3543
  }
3427
3544
  }
3428
3545
  g.kind = "if";
@@ -3441,7 +3558,7 @@ var scope = {};
3441
3558
  return this.iteration = oe(this.iteration, a, h), this;
3442
3559
  }
3443
3560
  get names() {
3444
- return K(super.names, this.iteration.names);
3561
+ return J(super.names, this.iteration.names);
3445
3562
  }
3446
3563
  }
3447
3564
  class I extends y {
@@ -3469,10 +3586,10 @@ var scope = {};
3469
3586
  return this.iterable = oe(this.iterable, a, h), this;
3470
3587
  }
3471
3588
  get names() {
3472
- return K(super.names, this.iterable.names);
3589
+ return J(super.names, this.iterable.names);
3473
3590
  }
3474
3591
  }
3475
- class w extends S {
3592
+ class v extends S {
3476
3593
  constructor(a, h, N) {
3477
3594
  super(), this.name = a, this.args = h, this.async = N;
3478
3595
  }
@@ -3480,7 +3597,7 @@ var scope = {};
3480
3597
  return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(a);
3481
3598
  }
3482
3599
  }
3483
- w.kind = "func";
3600
+ v.kind = "func";
3484
3601
  class O extends C {
3485
3602
  render(a) {
3486
3603
  return "return " + super.render(a);
@@ -3502,10 +3619,10 @@ var scope = {};
3502
3619
  }
3503
3620
  get names() {
3504
3621
  const a = super.names;
3505
- return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
3622
+ return this.catch && J(a, this.catch.names), this.finally && J(a, this.finally.names), a;
3506
3623
  }
3507
3624
  }
3508
- class x extends S {
3625
+ class H extends S {
3509
3626
  constructor(a) {
3510
3627
  super(), this.error = a;
3511
3628
  }
@@ -3513,14 +3630,14 @@ var scope = {};
3513
3630
  return `catch(${this.error})` + super.render(a);
3514
3631
  }
3515
3632
  }
3516
- x.kind = "catch";
3633
+ H.kind = "catch";
3517
3634
  class z extends S {
3518
3635
  render(a) {
3519
3636
  return "finally" + super.render(a);
3520
3637
  }
3521
3638
  }
3522
3639
  z.kind = "finally";
3523
- class re {
3640
+ class te {
3524
3641
  constructor(a, h = {}) {
3525
3642
  this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
3526
3643
  ` : "" }, this._extScope = a, this._scope = new r.Scope({ parent: a }), this._nodes = [new k()];
@@ -3666,9 +3783,9 @@ var scope = {};
3666
3783
  const M = new A();
3667
3784
  if (this._blockNode(M), this.code(a), h) {
3668
3785
  const L = this.name("e");
3669
- this._currNode = M.catch = new x(L), h(L);
3786
+ this._currNode = M.catch = new H(L), h(L);
3670
3787
  }
3671
- return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(x, z);
3788
+ return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(H, z);
3672
3789
  }
3673
3790
  // `throw` statement
3674
3791
  throw(a) {
@@ -3690,11 +3807,11 @@ var scope = {};
3690
3807
  }
3691
3808
  // `function` heading (or definition if funcBody is passed)
3692
3809
  func(a, h = t.nil, N, M) {
3693
- return this._blockNode(new w(a, h, N)), M && this.code(M).endFunc(), this;
3810
+ return this._blockNode(new v(a, h, N)), M && this.code(M).endFunc(), this;
3694
3811
  }
3695
3812
  // end function definition
3696
3813
  endFunc() {
3697
- return this._endBlockNode(w);
3814
+ return this._endBlockNode(v);
3698
3815
  }
3699
3816
  optimize(a = 1) {
3700
3817
  for (; a-- > 0; )
@@ -3730,21 +3847,21 @@ var scope = {};
3730
3847
  h[h.length - 1] = a;
3731
3848
  }
3732
3849
  }
3733
- e.CodeGen = re;
3734
- function K(E, a) {
3850
+ e.CodeGen = te;
3851
+ function J(b, a) {
3735
3852
  for (const h in a)
3736
- E[h] = (E[h] || 0) + (a[h] || 0);
3737
- return E;
3738
- }
3739
- function ue(E, a) {
3740
- return a instanceof t._CodeOrName ? K(E, a.names) : E;
3741
- }
3742
- function oe(E, a, h) {
3743
- if (E instanceof t.Name)
3744
- return N(E);
3745
- if (!M(E))
3746
- return E;
3747
- return new t._Code(E._items.reduce((L, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? L.push(...W._items) : L.push(W), L), []));
3853
+ b[h] = (b[h] || 0) + (a[h] || 0);
3854
+ return b;
3855
+ }
3856
+ function ue(b, a) {
3857
+ return a instanceof t._CodeOrName ? J(b, a.names) : b;
3858
+ }
3859
+ function oe(b, a, h) {
3860
+ if (b instanceof t.Name)
3861
+ return N(b);
3862
+ if (!M(b))
3863
+ return b;
3864
+ return new t._Code(b._items.reduce((L, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? L.push(...W._items) : L.push(W), L), []));
3748
3865
  function N(L) {
3749
3866
  const W = h[L.str];
3750
3867
  return W === void 0 || a[L.str] !== 1 ? L : (delete a[L.str], W);
@@ -3753,167 +3870,167 @@ var scope = {};
3753
3870
  return L instanceof t._Code && L._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
3754
3871
  }
3755
3872
  }
3756
- function ke(E, a) {
3873
+ function Te(b, a) {
3757
3874
  for (const h in a)
3758
- E[h] = (E[h] || 0) - (a[h] || 0);
3875
+ b[h] = (b[h] || 0) - (a[h] || 0);
3759
3876
  }
3760
- function Ce(E) {
3761
- return typeof E == "boolean" || typeof E == "number" || E === null ? !E : (0, t._)`!${j(E)}`;
3877
+ function ke(b) {
3878
+ return typeof b == "boolean" || typeof b == "number" || b === null ? !b : (0, t._)`!${j(b)}`;
3762
3879
  }
3763
- e.not = Ce;
3764
- const Le = v(e.operators.AND);
3765
- function et(...E) {
3766
- return E.reduce(Le);
3880
+ e.not = ke;
3881
+ const Fe = w(e.operators.AND);
3882
+ function Ze(...b) {
3883
+ return b.reduce(Fe);
3767
3884
  }
3768
- e.and = et;
3769
- const qe = v(e.operators.OR);
3770
- function F(...E) {
3771
- return E.reduce(qe);
3885
+ e.and = Ze;
3886
+ const Me = w(e.operators.OR);
3887
+ function F(...b) {
3888
+ return b.reduce(Me);
3772
3889
  }
3773
3890
  e.or = F;
3774
- function v(E) {
3775
- return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${E} ${j(h)}`;
3891
+ function w(b) {
3892
+ return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${b} ${j(h)}`;
3776
3893
  }
3777
- function j(E) {
3778
- return E instanceof t.Name ? E : (0, t._)`(${E})`;
3894
+ function j(b) {
3895
+ return b instanceof t.Name ? b : (0, t._)`(${b})`;
3779
3896
  }
3780
3897
  })(codegen);
3781
3898
  var util = {};
3782
3899
  (function(e) {
3783
3900
  Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0;
3784
3901
  const t = codegen, r = code$1;
3785
- function n(w) {
3902
+ function n(v) {
3786
3903
  const O = {};
3787
- for (const A of w)
3904
+ for (const A of v)
3788
3905
  O[A] = !0;
3789
3906
  return O;
3790
3907
  }
3791
3908
  e.toHash = n;
3792
- function s(w, O) {
3793
- return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (i(w, O), !o(O, w.self.RULES.all));
3909
+ function s(v, O) {
3910
+ return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (i(v, O), !o(O, v.self.RULES.all));
3794
3911
  }
3795
3912
  e.alwaysValidSchema = s;
3796
- function i(w, O = w.schema) {
3797
- const { opts: A, self: x } = w;
3913
+ function i(v, O = v.schema) {
3914
+ const { opts: A, self: H } = v;
3798
3915
  if (!A.strictSchema || typeof O == "boolean")
3799
3916
  return;
3800
- const z = x.RULES.keywords;
3801
- for (const re in O)
3802
- z[re] || D(w, `unknown keyword: "${re}"`);
3917
+ const z = H.RULES.keywords;
3918
+ for (const te in O)
3919
+ z[te] || D(v, `unknown keyword: "${te}"`);
3803
3920
  }
3804
3921
  e.checkUnknownRules = i;
3805
- function o(w, O) {
3806
- if (typeof w == "boolean")
3807
- return !w;
3808
- for (const A in w)
3922
+ function o(v, O) {
3923
+ if (typeof v == "boolean")
3924
+ return !v;
3925
+ for (const A in v)
3809
3926
  if (O[A])
3810
3927
  return !0;
3811
3928
  return !1;
3812
3929
  }
3813
3930
  e.schemaHasRules = o;
3814
- function c(w, O) {
3815
- if (typeof w == "boolean")
3816
- return !w;
3817
- for (const A in w)
3931
+ function c(v, O) {
3932
+ if (typeof v == "boolean")
3933
+ return !v;
3934
+ for (const A in v)
3818
3935
  if (A !== "$ref" && O.all[A])
3819
3936
  return !0;
3820
3937
  return !1;
3821
3938
  }
3822
3939
  e.schemaHasRulesButRef = c;
3823
- function d({ topSchemaRef: w, schemaPath: O }, A, x, z) {
3940
+ function d({ topSchemaRef: v, schemaPath: O }, A, H, z) {
3824
3941
  if (!z) {
3825
3942
  if (typeof A == "number" || typeof A == "boolean")
3826
3943
  return A;
3827
3944
  if (typeof A == "string")
3828
3945
  return (0, t._)`${A}`;
3829
3946
  }
3830
- return (0, t._)`${w}${O}${(0, t.getProperty)(x)}`;
3947
+ return (0, t._)`${v}${O}${(0, t.getProperty)(H)}`;
3831
3948
  }
3832
3949
  e.schemaRefOrVal = d;
3833
- function u(w) {
3834
- return T(decodeURIComponent(w));
3950
+ function u(v) {
3951
+ return T(decodeURIComponent(v));
3835
3952
  }
3836
3953
  e.unescapeFragment = u;
3837
- function p(w) {
3838
- return encodeURIComponent(_(w));
3954
+ function p(v) {
3955
+ return encodeURIComponent(_(v));
3839
3956
  }
3840
3957
  e.escapeFragment = p;
3841
- function _(w) {
3842
- return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
3958
+ function _(v) {
3959
+ return typeof v == "number" ? `${v}` : v.replace(/~/g, "~0").replace(/\//g, "~1");
3843
3960
  }
3844
3961
  e.escapeJsonPointer = _;
3845
- function T(w) {
3846
- return w.replace(/~1/g, "/").replace(/~0/g, "~");
3962
+ function T(v) {
3963
+ return v.replace(/~1/g, "/").replace(/~0/g, "~");
3847
3964
  }
3848
3965
  e.unescapeJsonPointer = T;
3849
- function C(w, O) {
3850
- if (Array.isArray(w))
3851
- for (const A of w)
3966
+ function C(v, O) {
3967
+ if (Array.isArray(v))
3968
+ for (const A of v)
3852
3969
  O(A);
3853
3970
  else
3854
- O(w);
3971
+ O(v);
3855
3972
  }
3856
3973
  e.eachItem = C;
3857
- function S({ mergeNames: w, mergeToName: O, mergeValues: A, resultToName: x }) {
3858
- return (z, re, K, ue) => {
3859
- const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(z, re, K) : O(z, re, K), K) : re instanceof t.Name ? (O(z, K, re), re) : A(re, K);
3860
- return ue === t.Name && !(oe instanceof t.Name) ? x(z, oe) : oe;
3974
+ function S({ mergeNames: v, mergeToName: O, mergeValues: A, resultToName: H }) {
3975
+ return (z, te, J, ue) => {
3976
+ const oe = J === void 0 ? te : J instanceof t.Name ? (te instanceof t.Name ? v(z, te, J) : O(z, te, J), J) : te instanceof t.Name ? (O(z, J, te), te) : A(te, J);
3977
+ return ue === t.Name && !(oe instanceof t.Name) ? H(z, oe) : oe;
3861
3978
  };
3862
3979
  }
3863
3980
  e.mergeEvaluated = {
3864
3981
  props: S({
3865
- mergeNames: (w, O, A) => w.if((0, t._)`${A} !== true && ${O} !== undefined`, () => {
3866
- w.if((0, t._)`${O} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${O})`));
3982
+ mergeNames: (v, O, A) => v.if((0, t._)`${A} !== true && ${O} !== undefined`, () => {
3983
+ v.if((0, t._)`${O} === true`, () => v.assign(A, !0), () => v.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${O})`));
3867
3984
  }),
3868
- mergeToName: (w, O, A) => w.if((0, t._)`${A} !== true`, () => {
3869
- O === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`), $(w, A, O));
3985
+ mergeToName: (v, O, A) => v.if((0, t._)`${A} !== true`, () => {
3986
+ O === !0 ? v.assign(A, !0) : (v.assign(A, (0, t._)`${A} || {}`), $(v, A, O));
3870
3987
  }),
3871
- mergeValues: (w, O) => w === !0 ? !0 : { ...w, ...O },
3988
+ mergeValues: (v, O) => v === !0 ? !0 : { ...v, ...O },
3872
3989
  resultToName: k
3873
3990
  }),
3874
3991
  items: S({
3875
- mergeNames: (w, O, A) => w.if((0, t._)`${A} !== true && ${O} !== undefined`, () => w.assign(A, (0, t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),
3876
- mergeToName: (w, O, A) => w.if((0, t._)`${A} !== true`, () => w.assign(A, O === !0 ? !0 : (0, t._)`${A} > ${O} ? ${A} : ${O}`)),
3877
- mergeValues: (w, O) => w === !0 ? !0 : Math.max(w, O),
3878
- resultToName: (w, O) => w.var("items", O)
3992
+ mergeNames: (v, O, A) => v.if((0, t._)`${A} !== true && ${O} !== undefined`, () => v.assign(A, (0, t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),
3993
+ mergeToName: (v, O, A) => v.if((0, t._)`${A} !== true`, () => v.assign(A, O === !0 ? !0 : (0, t._)`${A} > ${O} ? ${A} : ${O}`)),
3994
+ mergeValues: (v, O) => v === !0 ? !0 : Math.max(v, O),
3995
+ resultToName: (v, O) => v.var("items", O)
3879
3996
  })
3880
3997
  };
3881
- function k(w, O) {
3998
+ function k(v, O) {
3882
3999
  if (O === !0)
3883
- return w.var("props", !0);
3884
- const A = w.var("props", (0, t._)`{}`);
3885
- return O !== void 0 && $(w, A, O), A;
4000
+ return v.var("props", !0);
4001
+ const A = v.var("props", (0, t._)`{}`);
4002
+ return O !== void 0 && $(v, A, O), A;
3886
4003
  }
3887
4004
  e.evaluatedPropsToName = k;
3888
- function $(w, O, A) {
3889
- Object.keys(A).forEach((x) => w.assign((0, t._)`${O}${(0, t.getProperty)(x)}`, !0));
4005
+ function $(v, O, A) {
4006
+ Object.keys(A).forEach((H) => v.assign((0, t._)`${O}${(0, t.getProperty)(H)}`, !0));
3890
4007
  }
3891
4008
  e.setEvaluated = $;
3892
4009
  const g = {};
3893
- function y(w, O) {
3894
- return w.scopeValue("func", {
4010
+ function y(v, O) {
4011
+ return v.scopeValue("func", {
3895
4012
  ref: O,
3896
4013
  code: g[O.code] || (g[O.code] = new r._Code(O.code))
3897
4014
  });
3898
4015
  }
3899
4016
  e.useFunc = y;
3900
4017
  var P;
3901
- (function(w) {
3902
- w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
4018
+ (function(v) {
4019
+ v[v.Num = 0] = "Num", v[v.Str = 1] = "Str";
3903
4020
  })(P = e.Type || (e.Type = {}));
3904
- function I(w, O, A) {
3905
- if (w instanceof t.Name) {
3906
- const x = O === P.Num;
3907
- return A ? x ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : x ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
4021
+ function I(v, O, A) {
4022
+ if (v instanceof t.Name) {
4023
+ const H = O === P.Num;
4024
+ return A ? H ? (0, t._)`"[" + ${v} + "]"` : (0, t._)`"['" + ${v} + "']"` : H ? (0, t._)`"/" + ${v}` : (0, t._)`"/" + ${v}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
3908
4025
  }
3909
- return A ? (0, t.getProperty)(w).toString() : "/" + _(w);
4026
+ return A ? (0, t.getProperty)(v).toString() : "/" + _(v);
3910
4027
  }
3911
4028
  e.getErrorPath = I;
3912
- function D(w, O, A = w.opts.strictSchema) {
4029
+ function D(v, O, A = v.opts.strictSchema) {
3913
4030
  if (A) {
3914
4031
  if (O = `strict mode: ${O}`, A === !0)
3915
4032
  throw new Error(O);
3916
- w.self.logger.warn(O);
4033
+ v.self.logger.warn(O);
3917
4034
  }
3918
4035
  }
3919
4036
  e.checkStrictMode = D;
@@ -3953,13 +4070,13 @@ names$1.default = names;
3953
4070
  message: ({ keyword: $, schemaType: g }) => g ? (0, t.str)`"${$}" keyword must be ${g} ($data)` : (0, t.str)`"${$}" keyword is invalid ($data)`
3954
4071
  };
3955
4072
  function s($, g = e.keywordError, y, P) {
3956
- const { it: I } = $, { gen: D, compositeRule: w, allErrors: O } = I, A = _($, g, y);
3957
- P ?? (w || O) ? d(D, A) : u(I, (0, t._)`[${A}]`);
4073
+ const { it: I } = $, { gen: D, compositeRule: v, allErrors: O } = I, A = _($, g, y);
4074
+ P ?? (v || O) ? d(D, A) : u(I, (0, t._)`[${A}]`);
3958
4075
  }
3959
4076
  e.reportError = s;
3960
4077
  function i($, g = e.keywordError, y) {
3961
- const { it: P } = $, { gen: I, compositeRule: D, allErrors: w } = P, O = _($, g, y);
3962
- d(I, O), D || w || u(P, n.default.vErrors);
4078
+ const { it: P } = $, { gen: I, compositeRule: D, allErrors: v } = P, O = _($, g, y);
4079
+ d(I, O), D || v || u(P, n.default.vErrors);
3963
4080
  }
3964
4081
  e.reportExtraError = i;
3965
4082
  function o($, g) {
@@ -3969,9 +4086,9 @@ names$1.default = names;
3969
4086
  function c({ gen: $, keyword: g, schemaValue: y, data: P, errsCount: I, it: D }) {
3970
4087
  if (I === void 0)
3971
4088
  throw new Error("ajv implementation error");
3972
- const w = $.name("err");
4089
+ const v = $.name("err");
3973
4090
  $.forRange("i", I, n.default.errors, (O) => {
3974
- $.const(w, (0, t._)`${n.default.vErrors}[${O}]`), $.if((0, t._)`${w}.instancePath === undefined`, () => $.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${g}`), D.opts.verbose && ($.assign((0, t._)`${w}.schema`, y), $.assign((0, t._)`${w}.data`, P));
4091
+ $.const(v, (0, t._)`${n.default.vErrors}[${O}]`), $.if((0, t._)`${v}.instancePath === undefined`, () => $.assign((0, t._)`${v}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${v}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${g}`), D.opts.verbose && ($.assign((0, t._)`${v}.schema`, y), $.assign((0, t._)`${v}.data`, P));
3975
4092
  });
3976
4093
  }
3977
4094
  e.extendErrors = c;
@@ -4012,8 +4129,8 @@ names$1.default = names;
4012
4129
  return y && (I = (0, t.str)`${I}${(0, r.getErrorPath)(y, r.Type.Str)}`), [p.schemaPath, I];
4013
4130
  }
4014
4131
  function k($, { params: g, message: y }, P) {
4015
- const { keyword: I, data: D, schemaValue: w, it: O } = $, { opts: A, propertyName: x, topSchemaRef: z, schemaPath: re } = O;
4016
- P.push([p.keyword, I], [p.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && P.push([p.message, typeof y == "function" ? y($) : y]), A.verbose && P.push([p.schema, w], [p.parentSchema, (0, t._)`${z}${re}`], [n.default.data, D]), x && P.push([p.propertyName, x]);
4132
+ const { keyword: I, data: D, schemaValue: v, it: O } = $, { opts: A, propertyName: H, topSchemaRef: z, schemaPath: te } = O;
4133
+ P.push([p.keyword, I], [p.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && P.push([p.message, typeof y == "function" ? y($) : y]), A.verbose && P.push([p.schema, v], [p.parentSchema, (0, t._)`${z}${te}`], [n.default.data, D]), H && P.push([p.propertyName, H]);
4017
4134
  }
4018
4135
  })(errors);
4019
4136
  Object.defineProperty(boolSchema, "__esModule", { value: !0 });
@@ -4113,14 +4230,14 @@ applicability.shouldUseRule = shouldUseRule;
4113
4230
  }
4114
4231
  e.getJSONTypes = d;
4115
4232
  function u(P, I) {
4116
- const { gen: D, data: w, opts: O } = P, A = _(I, O.coerceTypes), x = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
4117
- if (x) {
4118
- const z = k(I, w, O.strictNumbers, o.Wrong);
4233
+ const { gen: D, data: v, opts: O } = P, A = _(I, O.coerceTypes), H = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
4234
+ if (H) {
4235
+ const z = k(I, v, O.strictNumbers, o.Wrong);
4119
4236
  D.if(z, () => {
4120
4237
  A.length ? T(P, I, A) : g(P);
4121
4238
  });
4122
4239
  }
4123
- return x;
4240
+ return H;
4124
4241
  }
4125
4242
  e.coerceAndCheckDataType = u;
4126
4243
  const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
@@ -4128,43 +4245,43 @@ applicability.shouldUseRule = shouldUseRule;
4128
4245
  return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
4129
4246
  }
4130
4247
  function T(P, I, D) {
4131
- const { gen: w, data: O, opts: A } = P, x = w.let("dataType", (0, s._)`typeof ${O}`), z = w.let("coerced", (0, s._)`undefined`);
4132
- A.coerceTypes === "array" && w.if((0, s._)`${x} == 'object' && Array.isArray(${O}) && ${O}.length == 1`, () => w.assign(O, (0, s._)`${O}[0]`).assign(x, (0, s._)`typeof ${O}`).if(k(I, O, A.strictNumbers), () => w.assign(z, O))), w.if((0, s._)`${z} !== undefined`);
4133
- for (const K of D)
4134
- (p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
4135
- w.else(), g(P), w.endIf(), w.if((0, s._)`${z} !== undefined`, () => {
4136
- w.assign(O, z), C(P, z);
4248
+ const { gen: v, data: O, opts: A } = P, H = v.let("dataType", (0, s._)`typeof ${O}`), z = v.let("coerced", (0, s._)`undefined`);
4249
+ A.coerceTypes === "array" && v.if((0, s._)`${H} == 'object' && Array.isArray(${O}) && ${O}.length == 1`, () => v.assign(O, (0, s._)`${O}[0]`).assign(H, (0, s._)`typeof ${O}`).if(k(I, O, A.strictNumbers), () => v.assign(z, O))), v.if((0, s._)`${z} !== undefined`);
4250
+ for (const J of D)
4251
+ (p.has(J) || J === "array" && A.coerceTypes === "array") && te(J);
4252
+ v.else(), g(P), v.endIf(), v.if((0, s._)`${z} !== undefined`, () => {
4253
+ v.assign(O, z), C(P, z);
4137
4254
  });
4138
- function re(K) {
4139
- switch (K) {
4255
+ function te(J) {
4256
+ switch (J) {
4140
4257
  case "string":
4141
- w.elseIf((0, s._)`${x} == "number" || ${x} == "boolean"`).assign(z, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(z, (0, s._)`""`);
4258
+ v.elseIf((0, s._)`${H} == "number" || ${H} == "boolean"`).assign(z, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(z, (0, s._)`""`);
4142
4259
  return;
4143
4260
  case "number":
4144
- w.elseIf((0, s._)`${x} == "boolean" || ${O} === null
4145
- || (${x} == "string" && ${O} && ${O} == +${O})`).assign(z, (0, s._)`+${O}`);
4261
+ v.elseIf((0, s._)`${H} == "boolean" || ${O} === null
4262
+ || (${H} == "string" && ${O} && ${O} == +${O})`).assign(z, (0, s._)`+${O}`);
4146
4263
  return;
4147
4264
  case "integer":
4148
- w.elseIf((0, s._)`${x} === "boolean" || ${O} === null
4149
- || (${x} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(z, (0, s._)`+${O}`);
4265
+ v.elseIf((0, s._)`${H} === "boolean" || ${O} === null
4266
+ || (${H} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(z, (0, s._)`+${O}`);
4150
4267
  return;
4151
4268
  case "boolean":
4152
- w.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(z, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(z, !0);
4269
+ v.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(z, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(z, !0);
4153
4270
  return;
4154
4271
  case "null":
4155
- w.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), w.assign(z, null);
4272
+ v.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), v.assign(z, null);
4156
4273
  return;
4157
4274
  case "array":
4158
- w.elseIf((0, s._)`${x} === "string" || ${x} === "number"
4159
- || ${x} === "boolean" || ${O} === null`).assign(z, (0, s._)`[${O}]`);
4275
+ v.elseIf((0, s._)`${H} === "string" || ${H} === "number"
4276
+ || ${H} === "boolean" || ${O} === null`).assign(z, (0, s._)`[${O}]`);
4160
4277
  }
4161
4278
  }
4162
4279
  }
4163
- function C({ gen: P, parentData: I, parentDataProperty: D }, w) {
4164
- P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, w));
4280
+ function C({ gen: P, parentData: I, parentDataProperty: D }, v) {
4281
+ P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, v));
4165
4282
  }
4166
- function S(P, I, D, w = o.Correct) {
4167
- const O = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
4283
+ function S(P, I, D, v = o.Correct) {
4284
+ const O = v === o.Correct ? s.operators.EQ : s.operators.NEQ;
4168
4285
  let A;
4169
4286
  switch (P) {
4170
4287
  case "null":
@@ -4176,33 +4293,33 @@ applicability.shouldUseRule = shouldUseRule;
4176
4293
  A = (0, s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;
4177
4294
  break;
4178
4295
  case "integer":
4179
- A = x((0, s._)`!(${I} % 1) && !isNaN(${I})`);
4296
+ A = H((0, s._)`!(${I} % 1) && !isNaN(${I})`);
4180
4297
  break;
4181
4298
  case "number":
4182
- A = x();
4299
+ A = H();
4183
4300
  break;
4184
4301
  default:
4185
4302
  return (0, s._)`typeof ${I} ${O} ${P}`;
4186
4303
  }
4187
- return w === o.Correct ? A : (0, s.not)(A);
4188
- function x(z = s.nil) {
4304
+ return v === o.Correct ? A : (0, s.not)(A);
4305
+ function H(z = s.nil) {
4189
4306
  return (0, s.and)((0, s._)`typeof ${I} == "number"`, z, D ? (0, s._)`isFinite(${I})` : s.nil);
4190
4307
  }
4191
4308
  }
4192
4309
  e.checkDataType = S;
4193
- function k(P, I, D, w) {
4310
+ function k(P, I, D, v) {
4194
4311
  if (P.length === 1)
4195
- return S(P[0], I, D, w);
4312
+ return S(P[0], I, D, v);
4196
4313
  let O;
4197
4314
  const A = (0, i.toHash)(P);
4198
4315
  if (A.array && A.object) {
4199
- const x = (0, s._)`typeof ${I} != "object"`;
4200
- O = A.null ? x : (0, s._)`!${I} || ${x}`, delete A.null, delete A.array, delete A.object;
4316
+ const H = (0, s._)`typeof ${I} != "object"`;
4317
+ O = A.null ? H : (0, s._)`!${I} || ${H}`, delete A.null, delete A.array, delete A.object;
4201
4318
  } else
4202
4319
  O = s.nil;
4203
4320
  A.number && delete A.integer;
4204
- for (const x in A)
4205
- O = (0, s.and)(O, S(x, I, D, w));
4321
+ for (const H in A)
4322
+ O = (0, s.and)(O, S(H, I, D, v));
4206
4323
  return O;
4207
4324
  }
4208
4325
  e.checkDataTypes = k;
@@ -4216,15 +4333,15 @@ applicability.shouldUseRule = shouldUseRule;
4216
4333
  }
4217
4334
  e.reportTypeError = g;
4218
4335
  function y(P) {
4219
- const { gen: I, data: D, schema: w } = P, O = (0, i.schemaRefOrVal)(P, w, "type");
4336
+ const { gen: I, data: D, schema: v } = P, O = (0, i.schemaRefOrVal)(P, v, "type");
4220
4337
  return {
4221
4338
  gen: I,
4222
4339
  keyword: "type",
4223
4340
  data: D,
4224
- schema: w.type,
4341
+ schema: v.type,
4225
4342
  schemaCode: O,
4226
4343
  schemaValue: O,
4227
- parentSchema: w,
4344
+ parentSchema: v,
4228
4345
  params: {},
4229
4346
  it: P
4230
4347
  };
@@ -5230,8 +5347,8 @@ var uri$1 = {}, uri_all = { exports: {} };
5230
5347
  l[m] = arguments[m];
5231
5348
  if (l.length > 1) {
5232
5349
  l[0] = l[0].slice(0, -1);
5233
- for (var R = l.length - 1, b = 1; b < R; ++b)
5234
- l[b] = l[b].slice(1, -1);
5350
+ for (var R = l.length - 1, E = 1; E < R; ++E)
5351
+ l[E] = l[E].slice(1, -1);
5235
5352
  return l[R] = l[R].slice(1), l.join("");
5236
5353
  } else
5237
5354
  return l[0];
@@ -5256,39 +5373,39 @@ var uri$1 = {}, uri_all = { exports: {} };
5256
5373
  return m;
5257
5374
  }
5258
5375
  function u(f) {
5259
- var l = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), b = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), q = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(q, U), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, m, "[\\-\\.\\_\\~]", Y);
5260
- s(l + n(l, m, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, U, "[\\:]")) + "*");
5261
- var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), V = s(R + "{1,4}"), X = s(s(V + "\\:" + V) + "|" + ie), ae = s(s(V + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(V + "\\:") + "{5}" + X), Se = s(s(V) + "?\\:\\:" + s(V + "\\:") + "{4}" + X), ge = s(s(s(V + "\\:") + "{0,1}" + V) + "?\\:\\:" + s(V + "\\:") + "{3}" + X), ye = s(s(s(V + "\\:") + "{0,2}" + V) + "?\\:\\:" + s(V + "\\:") + "{2}" + X), Be = s(s(s(V + "\\:") + "{0,3}" + V) + "?\\:\\:" + V + "\\:" + X), Ie = s(s(s(V + "\\:") + "{0,4}" + V) + "?\\:\\:" + X), fe = s(s(s(V + "\\:") + "{0,5}" + V) + "?\\:\\:" + V), $e = s(s(s(V + "\\:") + "{0,6}" + V) + "?\\:\\:"), je = s([ae, ee, Se, ge, ye, Be, Ie, fe, $e].join("|")), we = s(s(B + "|" + b) + "+");
5262
- s("[vV]" + R + "+\\." + n(B, U, "[\\:]") + "+"), s(s(b + "|" + n(B, U)) + "*");
5263
- var ct = s(b + "|" + n(B, U, "[\\:\\@]"));
5264
- return s(s(b + "|" + n(B, U, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
5376
+ var l = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), E = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), q = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", Q = n(q, U), Z = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", ne = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, m, "[\\-\\.\\_\\~]", Z);
5377
+ s(l + n(l, m, "[\\+\\-\\.]") + "*"), s(s(E + "|" + n(B, U, "[\\:]")) + "*");
5378
+ var Y = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), se = s(Y + "\\." + Y + "\\." + Y + "\\." + Y), V = s(R + "{1,4}"), X = s(s(V + "\\:" + V) + "|" + se), ae = s(s(V + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(V + "\\:") + "{5}" + X), Se = s(s(V) + "?\\:\\:" + s(V + "\\:") + "{4}" + X), ge = s(s(s(V + "\\:") + "{0,1}" + V) + "?\\:\\:" + s(V + "\\:") + "{3}" + X), ye = s(s(s(V + "\\:") + "{0,2}" + V) + "?\\:\\:" + s(V + "\\:") + "{2}" + X), ze = s(s(s(V + "\\:") + "{0,3}" + V) + "?\\:\\:" + V + "\\:" + X), Ne = s(s(s(V + "\\:") + "{0,4}" + V) + "?\\:\\:" + X), fe = s(s(s(V + "\\:") + "{0,5}" + V) + "?\\:\\:" + V), $e = s(s(s(V + "\\:") + "{0,6}" + V) + "?\\:\\:"), Ie = s([ae, ee, Se, ge, ye, ze, Ne, fe, $e].join("|")), ve = s(s(B + "|" + E) + "+");
5379
+ s("[vV]" + R + "+\\." + n(B, U, "[\\:]") + "+"), s(s(E + "|" + n(B, U)) + "*");
5380
+ var ot = s(E + "|" + n(B, U, "[\\:\\@]"));
5381
+ return s(s(E + "|" + n(B, U, "[\\@]")) + "+"), s(s(ot + "|" + n("[\\/\\?]", ne)) + "*"), {
5265
5382
  NOT_SCHEME: new RegExp(n("[^]", l, m, "[\\+\\-\\.]"), "g"),
5266
5383
  NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
5267
5384
  NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
5268
5385
  NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, U), "g"),
5269
5386
  NOT_PATH_NOSCHEME: new RegExp(n("[^\\%\\/\\@]", B, U), "g"),
5270
- NOT_QUERY: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]", se), "g"),
5387
+ NOT_QUERY: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]", ne), "g"),
5271
5388
  NOT_FRAGMENT: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]"), "g"),
5272
5389
  ESCAPE: new RegExp(n("[^]", B, U), "g"),
5273
5390
  UNRESERVED: new RegExp(B, "g"),
5274
- OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
5275
- PCT_ENCODED: new RegExp(b, "g"),
5276
- IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
5277
- IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + we + ")") + "?\\]?$")
5391
+ OTHER_CHARS: new RegExp(n("[^\\%]", B, Q), "g"),
5392
+ PCT_ENCODED: new RegExp(E, "g"),
5393
+ IPV4ADDRESS: new RegExp("^(" + se + ")$"),
5394
+ IPV6ADDRESS: new RegExp("^\\[?(" + Ie + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + ve + ")") + "?\\]?$")
5278
5395
  //RFC 6874, with relaxed parsing rules
5279
5396
  };
5280
5397
  }
5281
5398
  var p = u(!1), _ = u(!0), T = function() {
5282
5399
  function f(l, m) {
5283
- var R = [], b = !0, q = !1, U = void 0;
5400
+ var R = [], E = !0, q = !1, U = void 0;
5284
5401
  try {
5285
- for (var J = l[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (R.push(Y.value), !(m && R.length === m)); b = !0)
5402
+ for (var Q = l[Symbol.iterator](), Z; !(E = (Z = Q.next()).done) && (R.push(Z.value), !(m && R.length === m)); E = !0)
5286
5403
  ;
5287
- } catch (se) {
5288
- q = !0, U = se;
5404
+ } catch (ne) {
5405
+ q = !0, U = ne;
5289
5406
  } finally {
5290
5407
  try {
5291
- !b && J.return && J.return();
5408
+ !E && Q.return && Q.return();
5292
5409
  } finally {
5293
5410
  if (q)
5294
5411
  throw U;
@@ -5310,106 +5427,106 @@ var uri$1 = {}, uri_all = { exports: {} };
5310
5427
  return m;
5311
5428
  } else
5312
5429
  return Array.from(f);
5313
- }, S = 2147483647, k = 36, $ = 1, g = 26, y = 38, P = 700, I = 72, D = 128, w = "-", O = /^xn--/, A = /[^\0-\x7E]/, x = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
5430
+ }, S = 2147483647, k = 36, $ = 1, g = 26, y = 38, P = 700, I = 72, D = 128, v = "-", O = /^xn--/, A = /[^\0-\x7E]/, H = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
5314
5431
  overflow: "Overflow: input needs wider integers to process",
5315
5432
  "not-basic": "Illegal input >= 0x80 (not a basic code point)",
5316
5433
  "invalid-input": "Invalid input"
5317
- }, re = k - $, K = Math.floor, ue = String.fromCharCode;
5434
+ }, te = k - $, J = Math.floor, ue = String.fromCharCode;
5318
5435
  function oe(f) {
5319
5436
  throw new RangeError(z[f]);
5320
5437
  }
5321
- function ke(f, l) {
5438
+ function Te(f, l) {
5322
5439
  for (var m = [], R = f.length; R--; )
5323
5440
  m[R] = l(f[R]);
5324
5441
  return m;
5325
5442
  }
5326
- function Ce(f, l) {
5443
+ function ke(f, l) {
5327
5444
  var m = f.split("@"), R = "";
5328
- m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(x, ".");
5329
- var b = f.split("."), q = ke(b, l).join(".");
5445
+ m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(H, ".");
5446
+ var E = f.split("."), q = Te(E, l).join(".");
5330
5447
  return R + q;
5331
5448
  }
5332
- function Le(f) {
5449
+ function Fe(f) {
5333
5450
  for (var l = [], m = 0, R = f.length; m < R; ) {
5334
- var b = f.charCodeAt(m++);
5335
- if (b >= 55296 && b <= 56319 && m < R) {
5451
+ var E = f.charCodeAt(m++);
5452
+ if (E >= 55296 && E <= 56319 && m < R) {
5336
5453
  var q = f.charCodeAt(m++);
5337
- (q & 64512) == 56320 ? l.push(((b & 1023) << 10) + (q & 1023) + 65536) : (l.push(b), m--);
5454
+ (q & 64512) == 56320 ? l.push(((E & 1023) << 10) + (q & 1023) + 65536) : (l.push(E), m--);
5338
5455
  } else
5339
- l.push(b);
5456
+ l.push(E);
5340
5457
  }
5341
5458
  return l;
5342
5459
  }
5343
- var et = function(l) {
5460
+ var Ze = function(l) {
5344
5461
  return String.fromCodePoint.apply(String, C(l));
5345
- }, qe = function(l) {
5462
+ }, Me = function(l) {
5346
5463
  return l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : k;
5347
5464
  }, F = function(l, m) {
5348
5465
  return l + 22 + 75 * (l < 26) - ((m != 0) << 5);
5349
- }, v = function(l, m, R) {
5350
- var b = 0;
5466
+ }, w = function(l, m, R) {
5467
+ var E = 0;
5351
5468
  for (
5352
- l = R ? K(l / P) : l >> 1, l += K(l / m);
5469
+ l = R ? J(l / P) : l >> 1, l += J(l / m);
5353
5470
  /* no initialization */
5354
- l > re * g >> 1;
5355
- b += k
5471
+ l > te * g >> 1;
5472
+ E += k
5356
5473
  )
5357
- l = K(l / re);
5358
- return K(b + (re + 1) * l / (l + y));
5474
+ l = J(l / te);
5475
+ return J(E + (te + 1) * l / (l + y));
5359
5476
  }, j = function(l) {
5360
- var m = [], R = l.length, b = 0, q = D, U = I, J = l.lastIndexOf(w);
5361
- J < 0 && (J = 0);
5362
- for (var Y = 0; Y < J; ++Y)
5363
- l.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(l.charCodeAt(Y));
5364
- for (var se = J > 0 ? J + 1 : 0; se < R; ) {
5477
+ var m = [], R = l.length, E = 0, q = D, U = I, Q = l.lastIndexOf(v);
5478
+ Q < 0 && (Q = 0);
5479
+ for (var Z = 0; Z < Q; ++Z)
5480
+ l.charCodeAt(Z) >= 128 && oe("not-basic"), m.push(l.charCodeAt(Z));
5481
+ for (var ne = Q > 0 ? Q + 1 : 0; ne < R; ) {
5365
5482
  for (
5366
- var B = b, Z = 1, ie = k;
5483
+ var B = E, Y = 1, se = k;
5367
5484
  ;
5368
5485
  /* no condition */
5369
- ie += k
5486
+ se += k
5370
5487
  ) {
5371
- se >= R && oe("invalid-input");
5372
- var V = qe(l.charCodeAt(se++));
5373
- (V >= k || V > K((S - b) / Z)) && oe("overflow"), b += V * Z;
5374
- var X = ie <= U ? $ : ie >= U + g ? g : ie - U;
5488
+ ne >= R && oe("invalid-input");
5489
+ var V = Me(l.charCodeAt(ne++));
5490
+ (V >= k || V > J((S - E) / Y)) && oe("overflow"), E += V * Y;
5491
+ var X = se <= U ? $ : se >= U + g ? g : se - U;
5375
5492
  if (V < X)
5376
5493
  break;
5377
5494
  var ae = k - X;
5378
- Z > K(S / ae) && oe("overflow"), Z *= ae;
5495
+ Y > J(S / ae) && oe("overflow"), Y *= ae;
5379
5496
  }
5380
5497
  var ee = m.length + 1;
5381
- U = v(b - B, ee, B == 0), K(b / ee) > S - q && oe("overflow"), q += K(b / ee), b %= ee, m.splice(b++, 0, q);
5498
+ U = w(E - B, ee, B == 0), J(E / ee) > S - q && oe("overflow"), q += J(E / ee), E %= ee, m.splice(E++, 0, q);
5382
5499
  }
5383
5500
  return String.fromCodePoint.apply(String, m);
5384
- }, E = function(l) {
5501
+ }, b = function(l) {
5385
5502
  var m = [];
5386
- l = Le(l);
5387
- var R = l.length, b = D, q = 0, U = I, J = !0, Y = !1, se = void 0;
5503
+ l = Fe(l);
5504
+ var R = l.length, E = D, q = 0, U = I, Q = !0, Z = !1, ne = void 0;
5388
5505
  try {
5389
- for (var B = l[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
5390
- var ie = Z.value;
5391
- ie < 128 && m.push(ue(ie));
5506
+ for (var B = l[Symbol.iterator](), Y; !(Q = (Y = B.next()).done); Q = !0) {
5507
+ var se = Y.value;
5508
+ se < 128 && m.push(ue(se));
5392
5509
  }
5393
- } catch (lt) {
5394
- Y = !0, se = lt;
5510
+ } catch (at) {
5511
+ Z = !0, ne = at;
5395
5512
  } finally {
5396
5513
  try {
5397
- !J && B.return && B.return();
5514
+ !Q && B.return && B.return();
5398
5515
  } finally {
5399
- if (Y)
5400
- throw se;
5516
+ if (Z)
5517
+ throw ne;
5401
5518
  }
5402
5519
  }
5403
5520
  var V = m.length, X = V;
5404
- for (V && m.push(w); X < R; ) {
5521
+ for (V && m.push(v); X < R; ) {
5405
5522
  var ae = S, ee = !0, Se = !1, ge = void 0;
5406
5523
  try {
5407
- for (var ye = l[Symbol.iterator](), Be; !(ee = (Be = ye.next()).done); ee = !0) {
5408
- var Ie = Be.value;
5409
- Ie >= b && Ie < ae && (ae = Ie);
5524
+ for (var ye = l[Symbol.iterator](), ze; !(ee = (ze = ye.next()).done); ee = !0) {
5525
+ var Ne = ze.value;
5526
+ Ne >= E && Ne < ae && (ae = Ne);
5410
5527
  }
5411
- } catch (lt) {
5412
- Se = !0, ge = lt;
5528
+ } catch (at) {
5529
+ Se = !0, ge = at;
5413
5530
  } finally {
5414
5531
  try {
5415
5532
  !ee && ye.return && ye.return();
@@ -5419,47 +5536,47 @@ var uri$1 = {}, uri_all = { exports: {} };
5419
5536
  }
5420
5537
  }
5421
5538
  var fe = X + 1;
5422
- ae - b > K((S - q) / fe) && oe("overflow"), q += (ae - b) * fe, b = ae;
5423
- var $e = !0, je = !1, we = void 0;
5539
+ ae - E > J((S - q) / fe) && oe("overflow"), q += (ae - E) * fe, E = ae;
5540
+ var $e = !0, Ie = !1, ve = void 0;
5424
5541
  try {
5425
- for (var ct = l[Symbol.iterator](), Ut; !($e = (Ut = ct.next()).done); $e = !0) {
5426
- var Ht = Ut.value;
5427
- if (Ht < b && ++q > S && oe("overflow"), Ht == b) {
5542
+ for (var ot = l[Symbol.iterator](), xt; !($e = (xt = ot.next()).done); $e = !0) {
5543
+ var Ht = xt.value;
5544
+ if (Ht < E && ++q > S && oe("overflow"), Ht == E) {
5428
5545
  for (
5429
- var pt = q, ft = k;
5546
+ var dt = q, ut = k;
5430
5547
  ;
5431
5548
  /* no condition */
5432
- ft += k
5549
+ ut += k
5433
5550
  ) {
5434
- var ht = ft <= U ? $ : ft >= U + g ? g : ft - U;
5435
- if (pt < ht)
5551
+ var pt = ut <= U ? $ : ut >= U + g ? g : ut - U;
5552
+ if (dt < pt)
5436
5553
  break;
5437
- var xt = pt - ht, Vt = k - ht;
5438
- m.push(ue(F(ht + xt % Vt, 0))), pt = K(xt / Vt);
5554
+ var Vt = dt - pt, zt = k - pt;
5555
+ m.push(ue(F(pt + Vt % zt, 0))), dt = J(Vt / zt);
5439
5556
  }
5440
- m.push(ue(F(pt, 0))), U = v(q, fe, X == V), q = 0, ++X;
5557
+ m.push(ue(F(dt, 0))), U = w(q, fe, X == V), q = 0, ++X;
5441
5558
  }
5442
5559
  }
5443
- } catch (lt) {
5444
- je = !0, we = lt;
5560
+ } catch (at) {
5561
+ Ie = !0, ve = at;
5445
5562
  } finally {
5446
5563
  try {
5447
- !$e && ct.return && ct.return();
5564
+ !$e && ot.return && ot.return();
5448
5565
  } finally {
5449
- if (je)
5450
- throw we;
5566
+ if (Ie)
5567
+ throw ve;
5451
5568
  }
5452
5569
  }
5453
- ++q, ++b;
5570
+ ++q, ++E;
5454
5571
  }
5455
5572
  return m.join("");
5456
5573
  }, a = function(l) {
5457
- return Ce(l, function(m) {
5574
+ return ke(l, function(m) {
5458
5575
  return O.test(m) ? j(m.slice(4).toLowerCase()) : m;
5459
5576
  });
5460
5577
  }, h = function(l) {
5461
- return Ce(l, function(m) {
5462
- return A.test(m) ? "xn--" + E(m) : m;
5578
+ return ke(l, function(m) {
5579
+ return A.test(m) ? "xn--" + b(m) : m;
5463
5580
  });
5464
5581
  }, N = {
5465
5582
  /**
@@ -5476,11 +5593,11 @@ var uri$1 = {}, uri_all = { exports: {} };
5476
5593
  * @type Object
5477
5594
  */
5478
5595
  ucs2: {
5479
- decode: Le,
5480
- encode: et
5596
+ decode: Fe,
5597
+ encode: Ze
5481
5598
  },
5482
5599
  decode: j,
5483
- encode: E,
5600
+ encode: b,
5484
5601
  toASCII: h,
5485
5602
  toUnicode: a
5486
5603
  }, M = {};
@@ -5490,20 +5607,20 @@ var uri$1 = {}, uri_all = { exports: {} };
5490
5607
  }
5491
5608
  function W(f) {
5492
5609
  for (var l = "", m = 0, R = f.length; m < R; ) {
5493
- var b = parseInt(f.substr(m + 1, 2), 16);
5494
- if (b < 128)
5495
- l += String.fromCharCode(b), m += 3;
5496
- else if (b >= 194 && b < 224) {
5610
+ var E = parseInt(f.substr(m + 1, 2), 16);
5611
+ if (E < 128)
5612
+ l += String.fromCharCode(E), m += 3;
5613
+ else if (E >= 194 && E < 224) {
5497
5614
  if (R - m >= 6) {
5498
5615
  var q = parseInt(f.substr(m + 4, 2), 16);
5499
- l += String.fromCharCode((b & 31) << 6 | q & 63);
5616
+ l += String.fromCharCode((E & 31) << 6 | q & 63);
5500
5617
  } else
5501
5618
  l += f.substr(m, 6);
5502
5619
  m += 6;
5503
- } else if (b >= 224) {
5620
+ } else if (E >= 224) {
5504
5621
  if (R - m >= 9) {
5505
- var U = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
5506
- l += String.fromCharCode((b & 15) << 12 | (U & 63) << 6 | J & 63);
5622
+ var U = parseInt(f.substr(m + 4, 2), 16), Q = parseInt(f.substr(m + 7, 2), 16);
5623
+ l += String.fromCharCode((E & 15) << 12 | (U & 63) << 6 | Q & 63);
5507
5624
  } else
5508
5625
  l += f.substr(m, 9);
5509
5626
  m += 9;
@@ -5514,49 +5631,49 @@ var uri$1 = {}, uri_all = { exports: {} };
5514
5631
  }
5515
5632
  function G(f, l) {
5516
5633
  function m(R) {
5517
- var b = W(R);
5518
- return b.match(l.UNRESERVED) ? b : R;
5634
+ var E = W(R);
5635
+ return E.match(l.UNRESERVED) ? E : R;
5519
5636
  }
5520
5637
  return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED, m).toLowerCase().replace(l.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(l.PCT_ENCODED, m).replace(l.NOT_USERINFO, L).replace(l.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(l.PCT_ENCODED, m).toLowerCase().replace(l.NOT_HOST, L).replace(l.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(l.PCT_ENCODED, m).replace(f.scheme ? l.NOT_PATH : l.NOT_PATH_NOSCHEME, L).replace(l.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(l.PCT_ENCODED, m).replace(l.NOT_QUERY, L).replace(l.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(l.PCT_ENCODED, m).replace(l.NOT_FRAGMENT, L).replace(l.PCT_ENCODED, o)), f;
5521
5638
  }
5522
- function ne(f) {
5639
+ function re(f) {
5523
5640
  return f.replace(/^0*(.*)/, "$1") || "0";
5524
5641
  }
5525
5642
  function he(f, l) {
5526
- var m = f.match(l.IPV4ADDRESS) || [], R = T(m, 2), b = R[1];
5527
- return b ? b.split(".").map(ne).join(".") : f;
5528
- }
5529
- function Ue(f, l) {
5530
- var m = f.match(l.IPV6ADDRESS) || [], R = T(m, 3), b = R[1], q = R[2];
5531
- if (b) {
5532
- for (var U = b.toLowerCase().split("::").reverse(), J = T(U, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = l.IPV4ADDRESS.test(Z[Z.length - 1]), V = ie ? 7 : 8, X = Z.length - V, ae = Array(V), ee = 0; ee < V; ++ee)
5533
- ae[ee] = B[ee] || Z[X + ee] || "";
5534
- ie && (ae[V - 1] = he(ae[V - 1], l));
5535
- var Se = ae.reduce(function(fe, $e, je) {
5643
+ var m = f.match(l.IPV4ADDRESS) || [], R = T(m, 2), E = R[1];
5644
+ return E ? E.split(".").map(re).join(".") : f;
5645
+ }
5646
+ function Le(f, l) {
5647
+ var m = f.match(l.IPV6ADDRESS) || [], R = T(m, 3), E = R[1], q = R[2];
5648
+ if (E) {
5649
+ for (var U = E.toLowerCase().split("::").reverse(), Q = T(U, 2), Z = Q[0], ne = Q[1], B = ne ? ne.split(":").map(re) : [], Y = Z.split(":").map(re), se = l.IPV4ADDRESS.test(Y[Y.length - 1]), V = se ? 7 : 8, X = Y.length - V, ae = Array(V), ee = 0; ee < V; ++ee)
5650
+ ae[ee] = B[ee] || Y[X + ee] || "";
5651
+ se && (ae[V - 1] = he(ae[V - 1], l));
5652
+ var Se = ae.reduce(function(fe, $e, Ie) {
5536
5653
  if (!$e || $e === "0") {
5537
- var we = fe[fe.length - 1];
5538
- we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
5654
+ var ve = fe[fe.length - 1];
5655
+ ve && ve.index + ve.length === Ie ? ve.length++ : fe.push({ index: Ie, length: 1 });
5539
5656
  }
5540
5657
  return fe;
5541
5658
  }, []), ge = Se.sort(function(fe, $e) {
5542
5659
  return $e.length - fe.length;
5543
5660
  })[0], ye = void 0;
5544
5661
  if (ge && ge.length > 1) {
5545
- var Be = ae.slice(0, ge.index), Ie = ae.slice(ge.index + ge.length);
5546
- ye = Be.join(":") + "::" + Ie.join(":");
5662
+ var ze = ae.slice(0, ge.index), Ne = ae.slice(ge.index + ge.length);
5663
+ ye = ze.join(":") + "::" + Ne.join(":");
5547
5664
  } else
5548
5665
  ye = ae.join(":");
5549
5666
  return q && (ye += "%" + q), ye;
5550
5667
  } else
5551
5668
  return f;
5552
5669
  }
5553
- var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
5670
+ var Xe = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, et = "".match(/(){0}/)[1] === void 0;
5554
5671
  function de(f) {
5555
5672
  var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = l.iri !== !1 ? _ : p;
5556
5673
  l.reference === "suffix" && (f = (l.scheme ? l.scheme + ":" : "") + "//" + f);
5557
- var b = f.match(tt);
5558
- if (b) {
5559
- rt ? (m.scheme = b[1], m.userinfo = b[3], m.host = b[4], m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = b[7], m.fragment = b[8], isNaN(m.port) && (m.port = b[5])) : (m.scheme = b[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, m.host = f.indexOf("//") !== -1 ? b[4] : void 0, m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = f.indexOf("?") !== -1 ? b[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), m.host && (m.host = Ue(he(m.host, R), R)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", l.reference && l.reference !== "suffix" && l.reference !== m.reference && (m.error = m.error || "URI is not a " + l.reference + " reference.");
5674
+ var E = f.match(Xe);
5675
+ if (E) {
5676
+ et ? (m.scheme = E[1], m.userinfo = E[3], m.host = E[4], m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = E[7], m.fragment = E[8], isNaN(m.port) && (m.port = E[5])) : (m.scheme = E[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? E[3] : void 0, m.host = f.indexOf("//") !== -1 ? E[4] : void 0, m.port = parseInt(E[5], 10), m.path = E[6] || "", m.query = f.indexOf("?") !== -1 ? E[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? E[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? E[4] : void 0)), m.host && (m.host = Le(he(m.host, R), R)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", l.reference && l.reference !== "suffix" && l.reference !== m.reference && (m.error = m.error || "URI is not a " + l.reference + " reference.");
5560
5677
  var q = M[(l.scheme || m.scheme || "").toLowerCase()];
5561
5678
  if (!l.unicodeSupport && (!q || !q.unicodeSupport)) {
5562
5679
  if (m.host && (l.domainHost || q && q.domainHost))
@@ -5573,25 +5690,25 @@ var uri$1 = {}, uri_all = { exports: {} };
5573
5690
  m.error = m.error || "URI can not be parsed.";
5574
5691
  return m;
5575
5692
  }
5576
- function nt(f, l) {
5693
+ function tt(f, l) {
5577
5694
  var m = l.iri !== !1 ? _ : p, R = [];
5578
- return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(Ue(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(b, q, U) {
5695
+ return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(Le(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(E, q, U) {
5579
5696
  return "[" + q + (U ? "%25" + U : "") + "]";
5580
5697
  })), (typeof f.port == "number" || typeof f.port == "string") && (R.push(":"), R.push(String(f.port))), R.length ? R.join("") : void 0;
5581
5698
  }
5582
- var He = /^\.\.?\//, xe = /^\/\.(\/|$)/, Ve = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
5699
+ var qe = /^\.\.?\//, Ue = /^\/\.(\/|$)/, xe = /^\/\.\.(\/|$)/, rt = /^\/?(?:.|\n)*?(?=\/|$)/;
5583
5700
  function me(f) {
5584
5701
  for (var l = []; f.length; )
5585
- if (f.match(He))
5586
- f = f.replace(He, "");
5702
+ if (f.match(qe))
5703
+ f = f.replace(qe, "");
5704
+ else if (f.match(Ue))
5705
+ f = f.replace(Ue, "/");
5587
5706
  else if (f.match(xe))
5588
- f = f.replace(xe, "/");
5589
- else if (f.match(Ve))
5590
- f = f.replace(Ve, "/"), l.pop();
5707
+ f = f.replace(xe, "/"), l.pop();
5591
5708
  else if (f === "." || f === "..")
5592
5709
  f = "";
5593
5710
  else {
5594
- var m = f.match(st);
5711
+ var m = f.match(rt);
5595
5712
  if (m) {
5596
5713
  var R = m[0];
5597
5714
  f = f.slice(R.length), l.push(R);
@@ -5601,44 +5718,44 @@ var uri$1 = {}, uri_all = { exports: {} };
5601
5718
  return l.join("");
5602
5719
  }
5603
5720
  function le(f) {
5604
- var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = l.iri ? _ : p, R = [], b = M[(l.scheme || f.scheme || "").toLowerCase()];
5605
- if (b && b.serialize && b.serialize(f, l), f.host && !m.IPV6ADDRESS.test(f.host)) {
5606
- if (l.domainHost || b && b.domainHost)
5721
+ var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = l.iri ? _ : p, R = [], E = M[(l.scheme || f.scheme || "").toLowerCase()];
5722
+ if (E && E.serialize && E.serialize(f, l), f.host && !m.IPV6ADDRESS.test(f.host)) {
5723
+ if (l.domainHost || E && E.domainHost)
5607
5724
  try {
5608
5725
  f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
5609
- } catch (J) {
5610
- f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
5726
+ } catch (Q) {
5727
+ f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + Q;
5611
5728
  }
5612
5729
  }
5613
5730
  G(f, m), l.reference !== "suffix" && f.scheme && (R.push(f.scheme), R.push(":"));
5614
- var q = nt(f, l);
5731
+ var q = tt(f, l);
5615
5732
  if (q !== void 0 && (l.reference !== "suffix" && R.push("//"), R.push(q), f.path && f.path.charAt(0) !== "/" && R.push("/")), f.path !== void 0) {
5616
5733
  var U = f.path;
5617
- !l.absolutePath && (!b || !b.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), R.push(U);
5734
+ !l.absolutePath && (!E || !E.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), R.push(U);
5618
5735
  }
5619
5736
  return f.query !== void 0 && (R.push("?"), R.push(f.query)), f.fragment !== void 0 && (R.push("#"), R.push(f.fragment)), R.join("");
5620
5737
  }
5621
- function ze(f, l) {
5622
- var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], b = {};
5623
- return R || (f = de(le(f, m), m), l = de(le(l, m), m)), m = m || {}, !m.tolerant && l.scheme ? (b.scheme = l.scheme, b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0 ? (b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.path ? (l.path.charAt(0) === "/" ? b.path = me(l.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? b.path = "/" + l.path : f.path ? b.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + l.path : b.path = l.path, b.path = me(b.path)), b.query = l.query) : (b.path = f.path, l.query !== void 0 ? b.query = l.query : b.query = f.query), b.userinfo = f.userinfo, b.host = f.host, b.port = f.port), b.scheme = f.scheme), b.fragment = l.fragment, b;
5738
+ function He(f, l) {
5739
+ var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], E = {};
5740
+ return R || (f = de(le(f, m), m), l = de(le(l, m), m)), m = m || {}, !m.tolerant && l.scheme ? (E.scheme = l.scheme, E.userinfo = l.userinfo, E.host = l.host, E.port = l.port, E.path = me(l.path || ""), E.query = l.query) : (l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0 ? (E.userinfo = l.userinfo, E.host = l.host, E.port = l.port, E.path = me(l.path || ""), E.query = l.query) : (l.path ? (l.path.charAt(0) === "/" ? E.path = me(l.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? E.path = "/" + l.path : f.path ? E.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + l.path : E.path = l.path, E.path = me(E.path)), E.query = l.query) : (E.path = f.path, l.query !== void 0 ? E.query = l.query : E.query = f.query), E.userinfo = f.userinfo, E.host = f.host, E.port = f.port), E.scheme = f.scheme), E.fragment = l.fragment, E;
5624
5741
  }
5625
- function it(f, l, m) {
5742
+ function nt(f, l, m) {
5626
5743
  var R = d({ scheme: "null" }, m);
5627
- return le(ze(de(f, R), de(l, R), R, !0), R);
5744
+ return le(He(de(f, R), de(l, R), R, !0), R);
5628
5745
  }
5629
- function Oe(f, l) {
5746
+ function Ce(f, l) {
5630
5747
  return typeof f == "string" ? f = le(de(f, l), l) : i(f) === "object" && (f = de(le(f, l), l)), f;
5631
5748
  }
5632
- function ot(f, l, m) {
5749
+ function st(f, l, m) {
5633
5750
  return typeof f == "string" ? f = le(de(f, m), m) : i(f) === "object" && (f = le(f, m)), typeof l == "string" ? l = le(de(l, m), m) : i(l) === "object" && (l = le(l, m)), f === l;
5634
5751
  }
5635
- function ut(f, l) {
5752
+ function lt(f, l) {
5636
5753
  return f && f.toString().replace(!l || !l.iri ? p.ESCAPE : _.ESCAPE, L);
5637
5754
  }
5638
5755
  function pe(f, l) {
5639
5756
  return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED : _.PCT_ENCODED, W);
5640
5757
  }
5641
- var Ne = {
5758
+ var Oe = {
5642
5759
  scheme: "http",
5643
5760
  domainHost: !0,
5644
5761
  parse: function(l, m) {
@@ -5648,50 +5765,50 @@ var uri$1 = {}, uri_all = { exports: {} };
5648
5765
  var R = String(l.scheme).toLowerCase() === "https";
5649
5766
  return (l.port === (R ? 443 : 80) || l.port === "") && (l.port = void 0), l.path || (l.path = "/"), l;
5650
5767
  }
5651
- }, It = {
5768
+ }, jt = {
5652
5769
  scheme: "https",
5653
- domainHost: Ne.domainHost,
5654
- parse: Ne.parse,
5655
- serialize: Ne.serialize
5770
+ domainHost: Oe.domainHost,
5771
+ parse: Oe.parse,
5772
+ serialize: Oe.serialize
5656
5773
  };
5657
- function jt(f) {
5774
+ function At(f) {
5658
5775
  return typeof f.secure == "boolean" ? f.secure : String(f.scheme).toLowerCase() === "wss";
5659
5776
  }
5660
- var at = {
5777
+ var it = {
5661
5778
  scheme: "ws",
5662
5779
  domainHost: !0,
5663
5780
  parse: function(l, m) {
5664
5781
  var R = l;
5665
- return R.secure = jt(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
5782
+ return R.secure = At(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
5666
5783
  },
5667
5784
  serialize: function(l, m) {
5668
- if ((l.port === (jt(l) ? 443 : 80) || l.port === "") && (l.port = void 0), typeof l.secure == "boolean" && (l.scheme = l.secure ? "wss" : "ws", l.secure = void 0), l.resourceName) {
5669
- var R = l.resourceName.split("?"), b = T(R, 2), q = b[0], U = b[1];
5785
+ if ((l.port === (At(l) ? 443 : 80) || l.port === "") && (l.port = void 0), typeof l.secure == "boolean" && (l.scheme = l.secure ? "wss" : "ws", l.secure = void 0), l.resourceName) {
5786
+ var R = l.resourceName.split("?"), E = T(R, 2), q = E[0], U = E[1];
5670
5787
  l.path = q && q !== "/" ? q : void 0, l.query = U, l.resourceName = void 0;
5671
5788
  }
5672
5789
  return l.fragment = void 0, l;
5673
5790
  }
5674
- }, At = {
5791
+ }, Dt = {
5675
5792
  scheme: "wss",
5676
- domainHost: at.domainHost,
5677
- parse: at.parse,
5678
- serialize: at.serialize
5679
- }, ir = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", or = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(Dt, "g"), We = new RegExp(or, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", Dt, dr), "g"), fr = Ft;
5680
- function Ot(f) {
5793
+ domainHost: it.domainHost,
5794
+ parse: it.parse,
5795
+ serialize: it.serialize
5796
+ }, lr = {}, Ft = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", dr = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ur = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", pr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", fr = n(pr, '[\\"\\\\]'), hr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", mr = new RegExp(Ft, "g"), Ve = new RegExp(dr, "g"), _r = new RegExp(n("[^]", ur, "[\\.]", '[\\"]', fr), "g"), Mt = new RegExp(n("[^]", Ft, hr), "g"), gr = Mt;
5797
+ function Nt(f) {
5681
5798
  var l = W(f);
5682
- return l.match(ur) ? l : f;
5799
+ return l.match(mr) ? l : f;
5683
5800
  }
5684
- var Mt = {
5801
+ var Lt = {
5685
5802
  scheme: "mailto",
5686
5803
  parse: function(l, m) {
5687
- var R = l, b = R.to = R.path ? R.path.split(",") : [];
5804
+ var R = l, E = R.to = R.path ? R.path.split(",") : [];
5688
5805
  if (R.path = void 0, R.query) {
5689
- for (var q = !1, U = {}, J = R.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
5690
- var B = J[Y].split("=");
5806
+ for (var q = !1, U = {}, Q = R.query.split("&"), Z = 0, ne = Q.length; Z < ne; ++Z) {
5807
+ var B = Q[Z].split("=");
5691
5808
  switch (B[0]) {
5692
5809
  case "to":
5693
- for (var Z = B[1].split(","), ie = 0, V = Z.length; ie < V; ++ie)
5694
- b.push(Z[ie]);
5810
+ for (var Y = B[1].split(","), se = 0, V = Y.length; se < V; ++se)
5811
+ E.push(Y[se]);
5695
5812
  break;
5696
5813
  case "subject":
5697
5814
  R.subject = pe(B[1], m);
@@ -5707,8 +5824,8 @@ var uri$1 = {}, uri_all = { exports: {} };
5707
5824
  q && (R.headers = U);
5708
5825
  }
5709
5826
  R.query = void 0;
5710
- for (var X = 0, ae = b.length; X < ae; ++X) {
5711
- var ee = b[X].split("@");
5827
+ for (var X = 0, ae = E.length; X < ae; ++X) {
5828
+ var ee = E[X].split("@");
5712
5829
  if (ee[0] = pe(ee[0]), m.unicodeSupport)
5713
5830
  ee[1] = pe(ee[1], m).toLowerCase();
5714
5831
  else
@@ -5717,60 +5834,60 @@ var uri$1 = {}, uri_all = { exports: {} };
5717
5834
  } catch (Se) {
5718
5835
  R.error = R.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
5719
5836
  }
5720
- b[X] = ee.join("@");
5837
+ E[X] = ee.join("@");
5721
5838
  }
5722
5839
  return R;
5723
5840
  },
5724
5841
  serialize: function(l, m) {
5725
- var R = l, b = c(l.to);
5726
- if (b) {
5727
- for (var q = 0, U = b.length; q < U; ++q) {
5728
- var J = String(b[q]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, L), B = J.slice(Y + 1);
5842
+ var R = l, E = c(l.to);
5843
+ if (E) {
5844
+ for (var q = 0, U = E.length; q < U; ++q) {
5845
+ var Q = String(E[q]), Z = Q.lastIndexOf("@"), ne = Q.slice(0, Z).replace(Ve, Nt).replace(Ve, o).replace(_r, L), B = Q.slice(Z + 1);
5729
5846
  try {
5730
5847
  B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
5731
5848
  } catch (X) {
5732
5849
  R.error = R.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
5733
5850
  }
5734
- b[q] = se + "@" + B;
5851
+ E[q] = ne + "@" + B;
5735
5852
  }
5736
- R.path = b.join(",");
5853
+ R.path = E.join(",");
5737
5854
  }
5738
- var Z = l.headers = l.headers || {};
5739
- l.subject && (Z.subject = l.subject), l.body && (Z.body = l.body);
5740
- var ie = [];
5741
- for (var V in Z)
5742
- Z[V] !== ir[V] && ie.push(V.replace(We, Ot).replace(We, o).replace(Ft, L) + "=" + Z[V].replace(We, Ot).replace(We, o).replace(fr, L));
5743
- return ie.length && (R.query = ie.join("&")), R;
5855
+ var Y = l.headers = l.headers || {};
5856
+ l.subject && (Y.subject = l.subject), l.body && (Y.body = l.body);
5857
+ var se = [];
5858
+ for (var V in Y)
5859
+ Y[V] !== lr[V] && se.push(V.replace(Ve, Nt).replace(Ve, o).replace(Mt, L) + "=" + Y[V].replace(Ve, Nt).replace(Ve, o).replace(gr, L));
5860
+ return se.length && (R.query = se.join("&")), R;
5744
5861
  }
5745
- }, hr = /^([^\:]+)\:(.*)/, Lt = {
5862
+ }, yr = /^([^\:]+)\:(.*)/, qt = {
5746
5863
  scheme: "urn",
5747
5864
  parse: function(l, m) {
5748
- var R = l.path && l.path.match(hr), b = l;
5865
+ var R = l.path && l.path.match(yr), E = l;
5749
5866
  if (R) {
5750
- var q = m.scheme || b.scheme || "urn", U = R[1].toLowerCase(), J = R[2], Y = q + ":" + (m.nid || U), se = M[Y];
5751
- b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b, m));
5867
+ var q = m.scheme || E.scheme || "urn", U = R[1].toLowerCase(), Q = R[2], Z = q + ":" + (m.nid || U), ne = M[Z];
5868
+ E.nid = U, E.nss = Q, E.path = void 0, ne && (E = ne.parse(E, m));
5752
5869
  } else
5753
- b.error = b.error || "URN can not be parsed.";
5754
- return b;
5870
+ E.error = E.error || "URN can not be parsed.";
5871
+ return E;
5755
5872
  },
5756
5873
  serialize: function(l, m) {
5757
- var R = m.scheme || l.scheme || "urn", b = l.nid, q = R + ":" + (m.nid || b), U = M[q];
5874
+ var R = m.scheme || l.scheme || "urn", E = l.nid, q = R + ":" + (m.nid || E), U = M[q];
5758
5875
  U && (l = U.serialize(l, m));
5759
- var J = l, Y = l.nss;
5760
- return J.path = (b || m.nid) + ":" + Y, J;
5876
+ var Q = l, Z = l.nss;
5877
+ return Q.path = (E || m.nid) + ":" + Z, Q;
5761
5878
  }
5762
- }, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, qt = {
5879
+ }, $r = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
5763
5880
  scheme: "urn:uuid",
5764
5881
  parse: function(l, m) {
5765
5882
  var R = l;
5766
- return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match(mr)) && (R.error = R.error || "UUID is not valid."), R;
5883
+ return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match($r)) && (R.error = R.error || "UUID is not valid."), R;
5767
5884
  },
5768
5885
  serialize: function(l, m) {
5769
5886
  var R = l;
5770
5887
  return R.nss = (l.uuid || "").toLowerCase(), R;
5771
5888
  }
5772
5889
  };
5773
- M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[Lt.scheme] = Lt, M[qt.scheme] = qt, r.SCHEMES = M, r.pctEncChar = L, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = ze, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
5890
+ M[Oe.scheme] = Oe, M[jt.scheme] = jt, M[it.scheme] = it, M[Dt.scheme] = Dt, M[Lt.scheme] = Lt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = L, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = He, r.resolve = nt, r.normalize = Ce, r.equal = st, r.escapeComponent = lt, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
5774
5891
  });
5775
5892
  })(uri_all, uri_all.exports);
5776
5893
  var uri_allExports = uri_all.exports;
@@ -5798,7 +5915,7 @@ uri$1.default = uri;
5798
5915
  } }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
5799
5916
  return r.CodeGen;
5800
5917
  } });
5801
- const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util, _ = require$$9, T = uri$1, C = (F, v) => new RegExp(F, v);
5918
+ const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util, _ = require$$9, T = uri$1, C = (F, w) => new RegExp(F, w);
5802
5919
  C.code = "new RegExp";
5803
5920
  const S = ["removeAdditional", "useDefaults", "coerceTypes"], k = /* @__PURE__ */ new Set([
5804
5921
  "validate",
@@ -5836,71 +5953,71 @@ uri$1.default = uri;
5836
5953
  unicode: '"minLength"/"maxLength" account for unicode characters by default.'
5837
5954
  }, y = 200;
5838
5955
  function P(F) {
5839
- var v, j, E, a, h, N, M, L, W, G, ne, he, Ue, tt, rt, de, nt, He, xe, Ve, st, me, le, ze, it;
5840
- const Oe = F.strict, ot = (v = F.code) === null || v === void 0 ? void 0 : v.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (E = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && E !== void 0 ? E : C, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : T.default;
5956
+ var w, j, b, a, h, N, M, L, W, G, re, he, Le, Xe, et, de, tt, qe, Ue, xe, rt, me, le, He, nt;
5957
+ const Ce = F.strict, st = (w = F.code) === null || w === void 0 ? void 0 : w.optimize, lt = st === !0 || st === void 0 ? 1 : st || 0, pe = (b = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && b !== void 0 ? b : C, Oe = (a = F.uriResolver) !== null && a !== void 0 ? a : T.default;
5841
5958
  return {
5842
- strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
5843
- strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && L !== void 0 ? L : !0,
5844
- strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
5845
- strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
5846
- strictRequired: (tt = (Ue = F.strictRequired) !== null && Ue !== void 0 ? Ue : Oe) !== null && tt !== void 0 ? tt : !1,
5847
- code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
5848
- loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : y,
5959
+ strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Ce) !== null && N !== void 0 ? N : !0,
5960
+ strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M : Ce) !== null && L !== void 0 ? L : !0,
5961
+ strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Ce) !== null && G !== void 0 ? G : "log",
5962
+ strictTuples: (he = (re = F.strictTuples) !== null && re !== void 0 ? re : Ce) !== null && he !== void 0 ? he : "log",
5963
+ strictRequired: (Xe = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Ce) !== null && Xe !== void 0 ? Xe : !1,
5964
+ code: F.code ? { ...F.code, optimize: lt, regExp: pe } : { optimize: lt, regExp: pe },
5965
+ loopRequired: (et = F.loopRequired) !== null && et !== void 0 ? et : y,
5849
5966
  loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : y,
5850
- meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
5851
- messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
5852
- inlineRefs: (xe = F.inlineRefs) !== null && xe !== void 0 ? xe : !0,
5853
- schemaId: (Ve = F.schemaId) !== null && Ve !== void 0 ? Ve : "$id",
5854
- addUsedSchema: (st = F.addUsedSchema) !== null && st !== void 0 ? st : !0,
5967
+ meta: (tt = F.meta) !== null && tt !== void 0 ? tt : !0,
5968
+ messages: (qe = F.messages) !== null && qe !== void 0 ? qe : !0,
5969
+ inlineRefs: (Ue = F.inlineRefs) !== null && Ue !== void 0 ? Ue : !0,
5970
+ schemaId: (xe = F.schemaId) !== null && xe !== void 0 ? xe : "$id",
5971
+ addUsedSchema: (rt = F.addUsedSchema) !== null && rt !== void 0 ? rt : !0,
5855
5972
  validateSchema: (me = F.validateSchema) !== null && me !== void 0 ? me : !0,
5856
5973
  validateFormats: (le = F.validateFormats) !== null && le !== void 0 ? le : !0,
5857
- unicodeRegExp: (ze = F.unicodeRegExp) !== null && ze !== void 0 ? ze : !0,
5858
- int32range: (it = F.int32range) !== null && it !== void 0 ? it : !0,
5859
- uriResolver: Ne
5974
+ unicodeRegExp: (He = F.unicodeRegExp) !== null && He !== void 0 ? He : !0,
5975
+ int32range: (nt = F.int32range) !== null && nt !== void 0 ? nt : !0,
5976
+ uriResolver: Oe
5860
5977
  };
5861
5978
  }
5862
5979
  class I {
5863
- constructor(v = {}) {
5864
- this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), v = this.opts = { ...v, ...P(v) };
5865
- const { es5: j, lines: E } = this.opts.code;
5866
- this.scope = new c.ValueScope({ scope: {}, prefixes: k, es5: j, lines: E }), this.logger = K(v.logger);
5867
- const a = v.validateFormats;
5868
- v.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, $, v, "NOT SUPPORTED"), D.call(this, g, v, "DEPRECATED", "warn"), this._metaOpts = z.call(this), v.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), v.keywords && x.call(this, v.keywords), typeof v.meta == "object" && this.addMetaSchema(v.meta), O.call(this), v.validateFormats = a;
5980
+ constructor(w = {}) {
5981
+ this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), w = this.opts = { ...w, ...P(w) };
5982
+ const { es5: j, lines: b } = this.opts.code;
5983
+ this.scope = new c.ValueScope({ scope: {}, prefixes: k, es5: j, lines: b }), this.logger = J(w.logger);
5984
+ const a = w.validateFormats;
5985
+ w.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, $, w, "NOT SUPPORTED"), D.call(this, g, w, "DEPRECATED", "warn"), this._metaOpts = z.call(this), w.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), w.keywords && H.call(this, w.keywords), typeof w.meta == "object" && this.addMetaSchema(w.meta), O.call(this), w.validateFormats = a;
5869
5986
  }
5870
5987
  _addVocabularies() {
5871
5988
  this.addKeyword("$async");
5872
5989
  }
5873
5990
  _addDefaultMetaSchema() {
5874
- const { $data: v, meta: j, schemaId: E } = this.opts;
5991
+ const { $data: w, meta: j, schemaId: b } = this.opts;
5875
5992
  let a = _;
5876
- E === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && v && this.addMetaSchema(a, a[E], !1);
5993
+ b === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && w && this.addMetaSchema(a, a[b], !1);
5877
5994
  }
5878
5995
  defaultMeta() {
5879
- const { meta: v, schemaId: j } = this.opts;
5880
- return this.opts.defaultMeta = typeof v == "object" ? v[j] || v : void 0;
5881
- }
5882
- validate(v, j) {
5883
- let E;
5884
- if (typeof v == "string") {
5885
- if (E = this.getSchema(v), !E)
5886
- throw new Error(`no schema with key or ref "${v}"`);
5996
+ const { meta: w, schemaId: j } = this.opts;
5997
+ return this.opts.defaultMeta = typeof w == "object" ? w[j] || w : void 0;
5998
+ }
5999
+ validate(w, j) {
6000
+ let b;
6001
+ if (typeof w == "string") {
6002
+ if (b = this.getSchema(w), !b)
6003
+ throw new Error(`no schema with key or ref "${w}"`);
5887
6004
  } else
5888
- E = this.compile(v);
5889
- const a = E(j);
5890
- return "$async" in E || (this.errors = E.errors), a;
6005
+ b = this.compile(w);
6006
+ const a = b(j);
6007
+ return "$async" in b || (this.errors = b.errors), a;
5891
6008
  }
5892
- compile(v, j) {
5893
- const E = this._addSchema(v, j);
5894
- return E.validate || this._compileSchemaEnv(E);
6009
+ compile(w, j) {
6010
+ const b = this._addSchema(w, j);
6011
+ return b.validate || this._compileSchemaEnv(b);
5895
6012
  }
5896
- compileAsync(v, j) {
6013
+ compileAsync(w, j) {
5897
6014
  if (typeof this.opts.loadSchema != "function")
5898
6015
  throw new Error("options.loadSchema should be a function");
5899
- const { loadSchema: E } = this.opts;
5900
- return a.call(this, v, j);
5901
- async function a(G, ne) {
6016
+ const { loadSchema: b } = this.opts;
6017
+ return a.call(this, w, j);
6018
+ async function a(G, re) {
5902
6019
  await h.call(this, G.$schema);
5903
- const he = this._addSchema(G, ne);
6020
+ const he = this._addSchema(G, re);
5904
6021
  return he.validate || N.call(this, he);
5905
6022
  }
5906
6023
  async function h(G) {
@@ -5909,61 +6026,61 @@ uri$1.default = uri;
5909
6026
  async function N(G) {
5910
6027
  try {
5911
6028
  return this._compileSchemaEnv(G);
5912
- } catch (ne) {
5913
- if (!(ne instanceof s.default))
5914
- throw ne;
5915
- return M.call(this, ne), await L.call(this, ne.missingSchema), N.call(this, G);
6029
+ } catch (re) {
6030
+ if (!(re instanceof s.default))
6031
+ throw re;
6032
+ return M.call(this, re), await L.call(this, re.missingSchema), N.call(this, G);
5916
6033
  }
5917
6034
  }
5918
- function M({ missingSchema: G, missingRef: ne }) {
6035
+ function M({ missingSchema: G, missingRef: re }) {
5919
6036
  if (this.refs[G])
5920
- throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
6037
+ throw new Error(`AnySchema ${G} is loaded but ${re} cannot be resolved`);
5921
6038
  }
5922
6039
  async function L(G) {
5923
- const ne = await W.call(this, G);
5924
- this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
6040
+ const re = await W.call(this, G);
6041
+ this.refs[G] || await h.call(this, re.$schema), this.refs[G] || this.addSchema(re, G, j);
5925
6042
  }
5926
6043
  async function W(G) {
5927
- const ne = this._loading[G];
5928
- if (ne)
5929
- return ne;
6044
+ const re = this._loading[G];
6045
+ if (re)
6046
+ return re;
5930
6047
  try {
5931
- return await (this._loading[G] = E(G));
6048
+ return await (this._loading[G] = b(G));
5932
6049
  } finally {
5933
6050
  delete this._loading[G];
5934
6051
  }
5935
6052
  }
5936
6053
  }
5937
6054
  // Adds schema to the instance
5938
- addSchema(v, j, E, a = this.opts.validateSchema) {
5939
- if (Array.isArray(v)) {
5940
- for (const N of v)
5941
- this.addSchema(N, void 0, E, a);
6055
+ addSchema(w, j, b, a = this.opts.validateSchema) {
6056
+ if (Array.isArray(w)) {
6057
+ for (const N of w)
6058
+ this.addSchema(N, void 0, b, a);
5942
6059
  return this;
5943
6060
  }
5944
6061
  let h;
5945
- if (typeof v == "object") {
6062
+ if (typeof w == "object") {
5946
6063
  const { schemaId: N } = this.opts;
5947
- if (h = v[N], h !== void 0 && typeof h != "string")
6064
+ if (h = w[N], h !== void 0 && typeof h != "string")
5948
6065
  throw new Error(`schema ${N} must be string`);
5949
6066
  }
5950
- return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v, E, j, a, !0), this;
6067
+ return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(w, b, j, a, !0), this;
5951
6068
  }
5952
6069
  // Add schema that will be used to validate other schemas
5953
6070
  // options in META_IGNORE_OPTIONS are alway set to false
5954
- addMetaSchema(v, j, E = this.opts.validateSchema) {
5955
- return this.addSchema(v, j, !0, E), this;
6071
+ addMetaSchema(w, j, b = this.opts.validateSchema) {
6072
+ return this.addSchema(w, j, !0, b), this;
5956
6073
  }
5957
6074
  // Validate schema against its meta-schema
5958
- validateSchema(v, j) {
5959
- if (typeof v == "boolean")
6075
+ validateSchema(w, j) {
6076
+ if (typeof w == "boolean")
5960
6077
  return !0;
5961
- let E;
5962
- if (E = v.$schema, E !== void 0 && typeof E != "string")
6078
+ let b;
6079
+ if (b = w.$schema, b !== void 0 && typeof b != "string")
5963
6080
  throw new Error("$schema must be a string");
5964
- if (E = E || this.opts.defaultMeta || this.defaultMeta(), !E)
6081
+ if (b = b || this.opts.defaultMeta || this.defaultMeta(), !b)
5965
6082
  return this.logger.warn("meta-schema not available"), this.errors = null, !0;
5966
- const a = this.validate(E, v);
6083
+ const a = this.validate(b, w);
5967
6084
  if (!a && j) {
5968
6085
  const h = "schema is invalid: " + this.errorsText();
5969
6086
  if (this.opts.validateSchema === "log")
@@ -5975,15 +6092,15 @@ uri$1.default = uri;
5975
6092
  }
5976
6093
  // Get compiled schema by `key` or `ref`.
5977
6094
  // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
5978
- getSchema(v) {
6095
+ getSchema(w) {
5979
6096
  let j;
5980
- for (; typeof (j = w.call(this, v)) == "string"; )
5981
- v = j;
6097
+ for (; typeof (j = v.call(this, w)) == "string"; )
6098
+ w = j;
5982
6099
  if (j === void 0) {
5983
- const { schemaId: E } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: E });
5984
- if (j = o.resolveSchema.call(this, a, v), !j)
6100
+ const { schemaId: b } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: b });
6101
+ if (j = o.resolveSchema.call(this, a, w), !j)
5985
6102
  return;
5986
- this.refs[v] = j;
6103
+ this.refs[w] = j;
5987
6104
  }
5988
6105
  return j.validate || this._compileSchemaEnv(j);
5989
6106
  }
@@ -5991,141 +6108,141 @@ uri$1.default = uri;
5991
6108
  // If no parameter is passed all schemas but meta-schemas are removed.
5992
6109
  // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
5993
6110
  // Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
5994
- removeSchema(v) {
5995
- if (v instanceof RegExp)
5996
- return this._removeAllSchemas(this.schemas, v), this._removeAllSchemas(this.refs, v), this;
5997
- switch (typeof v) {
6111
+ removeSchema(w) {
6112
+ if (w instanceof RegExp)
6113
+ return this._removeAllSchemas(this.schemas, w), this._removeAllSchemas(this.refs, w), this;
6114
+ switch (typeof w) {
5998
6115
  case "undefined":
5999
6116
  return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
6000
6117
  case "string": {
6001
- const j = w.call(this, v);
6002
- return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[v], delete this.refs[v], this;
6118
+ const j = v.call(this, w);
6119
+ return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[w], delete this.refs[w], this;
6003
6120
  }
6004
6121
  case "object": {
6005
- const j = v;
6122
+ const j = w;
6006
6123
  this._cache.delete(j);
6007
- let E = v[this.opts.schemaId];
6008
- return E && (E = (0, d.normalizeId)(E), delete this.schemas[E], delete this.refs[E]), this;
6124
+ let b = w[this.opts.schemaId];
6125
+ return b && (b = (0, d.normalizeId)(b), delete this.schemas[b], delete this.refs[b]), this;
6009
6126
  }
6010
6127
  default:
6011
6128
  throw new Error("ajv.removeSchema: invalid parameter");
6012
6129
  }
6013
6130
  }
6014
6131
  // add "vocabulary" - a collection of keywords
6015
- addVocabulary(v) {
6016
- for (const j of v)
6132
+ addVocabulary(w) {
6133
+ for (const j of w)
6017
6134
  this.addKeyword(j);
6018
6135
  return this;
6019
6136
  }
6020
- addKeyword(v, j) {
6021
- let E;
6022
- if (typeof v == "string")
6023
- E = v, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = E);
6024
- else if (typeof v == "object" && j === void 0) {
6025
- if (j = v, E = j.keyword, Array.isArray(E) && !E.length)
6137
+ addKeyword(w, j) {
6138
+ let b;
6139
+ if (typeof w == "string")
6140
+ b = w, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = b);
6141
+ else if (typeof w == "object" && j === void 0) {
6142
+ if (j = w, b = j.keyword, Array.isArray(b) && !b.length)
6026
6143
  throw new Error("addKeywords: keyword must be string or non-empty array");
6027
6144
  } else
6028
6145
  throw new Error("invalid addKeywords parameters");
6029
- if (oe.call(this, E, j), !j)
6030
- return (0, p.eachItem)(E, (h) => ke.call(this, h)), this;
6031
- Le.call(this, j);
6146
+ if (oe.call(this, b, j), !j)
6147
+ return (0, p.eachItem)(b, (h) => Te.call(this, h)), this;
6148
+ Fe.call(this, j);
6032
6149
  const a = {
6033
6150
  ...j,
6034
6151
  type: (0, u.getJSONTypes)(j.type),
6035
6152
  schemaType: (0, u.getJSONTypes)(j.schemaType)
6036
6153
  };
6037
- return (0, p.eachItem)(E, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
6154
+ return (0, p.eachItem)(b, a.type.length === 0 ? (h) => Te.call(this, h, a) : (h) => a.type.forEach((N) => Te.call(this, h, a, N))), this;
6038
6155
  }
6039
- getKeyword(v) {
6040
- const j = this.RULES.all[v];
6156
+ getKeyword(w) {
6157
+ const j = this.RULES.all[w];
6041
6158
  return typeof j == "object" ? j.definition : !!j;
6042
6159
  }
6043
6160
  // Remove keyword
6044
- removeKeyword(v) {
6161
+ removeKeyword(w) {
6045
6162
  const { RULES: j } = this;
6046
- delete j.keywords[v], delete j.all[v];
6047
- for (const E of j.rules) {
6048
- const a = E.rules.findIndex((h) => h.keyword === v);
6049
- a >= 0 && E.rules.splice(a, 1);
6163
+ delete j.keywords[w], delete j.all[w];
6164
+ for (const b of j.rules) {
6165
+ const a = b.rules.findIndex((h) => h.keyword === w);
6166
+ a >= 0 && b.rules.splice(a, 1);
6050
6167
  }
6051
6168
  return this;
6052
6169
  }
6053
6170
  // Add format
6054
- addFormat(v, j) {
6055
- return typeof j == "string" && (j = new RegExp(j)), this.formats[v] = j, this;
6171
+ addFormat(w, j) {
6172
+ return typeof j == "string" && (j = new RegExp(j)), this.formats[w] = j, this;
6056
6173
  }
6057
- errorsText(v = this.errors, { separator: j = ", ", dataVar: E = "data" } = {}) {
6058
- return !v || v.length === 0 ? "No errors" : v.map((a) => `${E}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
6174
+ errorsText(w = this.errors, { separator: j = ", ", dataVar: b = "data" } = {}) {
6175
+ return !w || w.length === 0 ? "No errors" : w.map((a) => `${b}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
6059
6176
  }
6060
- $dataMetaSchema(v, j) {
6061
- const E = this.RULES.all;
6062
- v = JSON.parse(JSON.stringify(v));
6177
+ $dataMetaSchema(w, j) {
6178
+ const b = this.RULES.all;
6179
+ w = JSON.parse(JSON.stringify(w));
6063
6180
  for (const a of j) {
6064
6181
  const h = a.split("/").slice(1);
6065
- let N = v;
6182
+ let N = w;
6066
6183
  for (const M of h)
6067
6184
  N = N[M];
6068
- for (const M in E) {
6069
- const L = E[M];
6185
+ for (const M in b) {
6186
+ const L = b[M];
6070
6187
  if (typeof L != "object")
6071
6188
  continue;
6072
6189
  const { $data: W } = L.definition, G = N[M];
6073
- W && G && (N[M] = qe(G));
6190
+ W && G && (N[M] = Me(G));
6074
6191
  }
6075
6192
  }
6076
- return v;
6193
+ return w;
6077
6194
  }
6078
- _removeAllSchemas(v, j) {
6079
- for (const E in v) {
6080
- const a = v[E];
6081
- (!j || j.test(E)) && (typeof a == "string" ? delete v[E] : a && !a.meta && (this._cache.delete(a.schema), delete v[E]));
6195
+ _removeAllSchemas(w, j) {
6196
+ for (const b in w) {
6197
+ const a = w[b];
6198
+ (!j || j.test(b)) && (typeof a == "string" ? delete w[b] : a && !a.meta && (this._cache.delete(a.schema), delete w[b]));
6082
6199
  }
6083
6200
  }
6084
- _addSchema(v, j, E, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
6201
+ _addSchema(w, j, b, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
6085
6202
  let N;
6086
6203
  const { schemaId: M } = this.opts;
6087
- if (typeof v == "object")
6088
- N = v[M];
6204
+ if (typeof w == "object")
6205
+ N = w[M];
6089
6206
  else {
6090
6207
  if (this.opts.jtd)
6091
6208
  throw new Error("schema must be object");
6092
- if (typeof v != "boolean")
6209
+ if (typeof w != "boolean")
6093
6210
  throw new Error("schema must be object or boolean");
6094
6211
  }
6095
- let L = this._cache.get(v);
6212
+ let L = this._cache.get(w);
6096
6213
  if (L !== void 0)
6097
6214
  return L;
6098
- E = (0, d.normalizeId)(N || E);
6099
- const W = d.getSchemaRefs.call(this, v, E);
6100
- return L = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId: E, localRefs: W }), this._cache.set(L.schema, L), h && !E.startsWith("#") && (E && this._checkUnique(E), this.refs[E] = L), a && this.validateSchema(v, !0), L;
6215
+ b = (0, d.normalizeId)(N || b);
6216
+ const W = d.getSchemaRefs.call(this, w, b);
6217
+ return L = new o.SchemaEnv({ schema: w, schemaId: M, meta: j, baseId: b, localRefs: W }), this._cache.set(L.schema, L), h && !b.startsWith("#") && (b && this._checkUnique(b), this.refs[b] = L), a && this.validateSchema(w, !0), L;
6101
6218
  }
6102
- _checkUnique(v) {
6103
- if (this.schemas[v] || this.refs[v])
6104
- throw new Error(`schema with key or id "${v}" already exists`);
6219
+ _checkUnique(w) {
6220
+ if (this.schemas[w] || this.refs[w])
6221
+ throw new Error(`schema with key or id "${w}" already exists`);
6105
6222
  }
6106
- _compileSchemaEnv(v) {
6107
- if (v.meta ? this._compileMetaSchema(v) : o.compileSchema.call(this, v), !v.validate)
6223
+ _compileSchemaEnv(w) {
6224
+ if (w.meta ? this._compileMetaSchema(w) : o.compileSchema.call(this, w), !w.validate)
6108
6225
  throw new Error("ajv implementation error");
6109
- return v.validate;
6226
+ return w.validate;
6110
6227
  }
6111
- _compileMetaSchema(v) {
6228
+ _compileMetaSchema(w) {
6112
6229
  const j = this.opts;
6113
6230
  this.opts = this._metaOpts;
6114
6231
  try {
6115
- o.compileSchema.call(this, v);
6232
+ o.compileSchema.call(this, w);
6116
6233
  } finally {
6117
6234
  this.opts = j;
6118
6235
  }
6119
6236
  }
6120
6237
  }
6121
6238
  e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
6122
- function D(F, v, j, E = "error") {
6239
+ function D(F, w, j, b = "error") {
6123
6240
  for (const a in F) {
6124
6241
  const h = a;
6125
- h in v && this.logger[E](`${j}: option ${a}. ${F[h]}`);
6242
+ h in w && this.logger[b](`${j}: option ${a}. ${F[h]}`);
6126
6243
  }
6127
6244
  }
6128
- function w(F) {
6245
+ function v(F) {
6129
6246
  return F = (0, d.normalizeId)(F), this.schemas[F] || this.refs[F];
6130
6247
  }
6131
6248
  function O() {
@@ -6134,39 +6251,39 @@ uri$1.default = uri;
6134
6251
  if (Array.isArray(F))
6135
6252
  this.addSchema(F);
6136
6253
  else
6137
- for (const v in F)
6138
- this.addSchema(F[v], v);
6254
+ for (const w in F)
6255
+ this.addSchema(F[w], w);
6139
6256
  }
6140
6257
  function A() {
6141
6258
  for (const F in this.opts.formats) {
6142
- const v = this.opts.formats[F];
6143
- v && this.addFormat(F, v);
6259
+ const w = this.opts.formats[F];
6260
+ w && this.addFormat(F, w);
6144
6261
  }
6145
6262
  }
6146
- function x(F) {
6263
+ function H(F) {
6147
6264
  if (Array.isArray(F)) {
6148
6265
  this.addVocabulary(F);
6149
6266
  return;
6150
6267
  }
6151
6268
  this.logger.warn("keywords option as map is deprecated, pass array");
6152
- for (const v in F) {
6153
- const j = F[v];
6154
- j.keyword || (j.keyword = v), this.addKeyword(j);
6269
+ for (const w in F) {
6270
+ const j = F[w];
6271
+ j.keyword || (j.keyword = w), this.addKeyword(j);
6155
6272
  }
6156
6273
  }
6157
6274
  function z() {
6158
6275
  const F = { ...this.opts };
6159
- for (const v of S)
6160
- delete F[v];
6276
+ for (const w of S)
6277
+ delete F[w];
6161
6278
  return F;
6162
6279
  }
6163
- const re = { log() {
6280
+ const te = { log() {
6164
6281
  }, warn() {
6165
6282
  }, error() {
6166
6283
  } };
6167
- function K(F) {
6284
+ function J(F) {
6168
6285
  if (F === !1)
6169
- return re;
6286
+ return te;
6170
6287
  if (F === void 0)
6171
6288
  return console;
6172
6289
  if (F.log && F.warn && F.error)
@@ -6174,48 +6291,48 @@ uri$1.default = uri;
6174
6291
  throw new Error("logger must implement log, warn and error methods");
6175
6292
  }
6176
6293
  const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
6177
- function oe(F, v) {
6294
+ function oe(F, w) {
6178
6295
  const { RULES: j } = this;
6179
- if ((0, p.eachItem)(F, (E) => {
6180
- if (j.keywords[E])
6181
- throw new Error(`Keyword ${E} is already defined`);
6182
- if (!ue.test(E))
6183
- throw new Error(`Keyword ${E} has invalid name`);
6184
- }), !!v && v.$data && !("code" in v || "validate" in v))
6296
+ if ((0, p.eachItem)(F, (b) => {
6297
+ if (j.keywords[b])
6298
+ throw new Error(`Keyword ${b} is already defined`);
6299
+ if (!ue.test(b))
6300
+ throw new Error(`Keyword ${b} has invalid name`);
6301
+ }), !!w && w.$data && !("code" in w || "validate" in w))
6185
6302
  throw new Error('$data keyword must have "code" or "validate" function');
6186
6303
  }
6187
- function ke(F, v, j) {
6188
- var E;
6189
- const a = v == null ? void 0 : v.post;
6304
+ function Te(F, w, j) {
6305
+ var b;
6306
+ const a = w == null ? void 0 : w.post;
6190
6307
  if (j && a)
6191
6308
  throw new Error('keyword with "post" flag cannot have "type"');
6192
6309
  const { RULES: h } = this;
6193
6310
  let N = a ? h.post : h.rules.find(({ type: L }) => L === j);
6194
- if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !v)
6311
+ if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !w)
6195
6312
  return;
6196
6313
  const M = {
6197
6314
  keyword: F,
6198
6315
  definition: {
6199
- ...v,
6200
- type: (0, u.getJSONTypes)(v.type),
6201
- schemaType: (0, u.getJSONTypes)(v.schemaType)
6316
+ ...w,
6317
+ type: (0, u.getJSONTypes)(w.type),
6318
+ schemaType: (0, u.getJSONTypes)(w.schemaType)
6202
6319
  }
6203
6320
  };
6204
- v.before ? Ce.call(this, N, M, v.before) : N.rules.push(M), h.all[F] = M, (E = v.implements) === null || E === void 0 || E.forEach((L) => this.addKeyword(L));
6321
+ w.before ? ke.call(this, N, M, w.before) : N.rules.push(M), h.all[F] = M, (b = w.implements) === null || b === void 0 || b.forEach((L) => this.addKeyword(L));
6205
6322
  }
6206
- function Ce(F, v, j) {
6207
- const E = F.rules.findIndex((a) => a.keyword === j);
6208
- E >= 0 ? F.rules.splice(E, 0, v) : (F.rules.push(v), this.logger.warn(`rule ${j} is not defined`));
6323
+ function ke(F, w, j) {
6324
+ const b = F.rules.findIndex((a) => a.keyword === j);
6325
+ b >= 0 ? F.rules.splice(b, 0, w) : (F.rules.push(w), this.logger.warn(`rule ${j} is not defined`));
6209
6326
  }
6210
- function Le(F) {
6211
- let { metaSchema: v } = F;
6212
- v !== void 0 && (F.$data && this.opts.$data && (v = qe(v)), F.validateSchema = this.compile(v, !0));
6327
+ function Fe(F) {
6328
+ let { metaSchema: w } = F;
6329
+ w !== void 0 && (F.$data && this.opts.$data && (w = Me(w)), F.validateSchema = this.compile(w, !0));
6213
6330
  }
6214
- const et = {
6331
+ const Ze = {
6215
6332
  $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
6216
6333
  };
6217
- function qe(F) {
6218
- return { anyOf: [F, et] };
6334
+ function Me(F) {
6335
+ return { anyOf: [F, Ze] };
6219
6336
  }
6220
6337
  })(core$2);
6221
6338
  var draft7 = {}, core$1 = {}, id = {};
@@ -7229,7 +7346,7 @@ const codegen_1$1 = codegen, error$1 = {
7229
7346
  }
7230
7347
  }
7231
7348
  function P(D) {
7232
- const w = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : d.code.formats ? (0, codegen_1$1._)`${d.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, O = r.scopeValue("formats", { key: i, ref: D, code: w });
7349
+ const v = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : d.code.formats ? (0, codegen_1$1._)`${d.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, O = r.scopeValue("formats", { key: i, ref: D, code: v });
7233
7350
  return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${O}.validate`] : ["string", D, O];
7234
7351
  }
7235
7352
  function I() {
@@ -7320,10 +7437,10 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
7320
7437
  for (let I = 0; I < o.length; I++) {
7321
7438
  let D = o[I];
7322
7439
  D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, i.self.RULES) && (D = compile_1.resolveRef.call(i.self, i.schemaEnv.root, i.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
7323
- const w = (C = D == null ? void 0 : D.properties) === null || C === void 0 ? void 0 : C[c];
7324
- if (typeof w != "object")
7440
+ const v = (C = D == null ? void 0 : D.properties) === null || C === void 0 ? void 0 : C[c];
7441
+ if (typeof v != "object")
7325
7442
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);
7326
- $ = $ && (k || g(D)), y(w, I);
7443
+ $ = $ && (k || g(D)), y(v, I);
7327
7444
  }
7328
7445
  if (!$)
7329
7446
  throw new Error(`discriminator: "${c}" must be required`);
@@ -7335,8 +7452,8 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
7335
7452
  if (I.const)
7336
7453
  P(I.const, D);
7337
7454
  else if (I.enum)
7338
- for (const w of I.enum)
7339
- P(w, D);
7455
+ for (const v of I.enum)
7456
+ P(v, D);
7340
7457
  else
7341
7458
  throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`);
7342
7459
  }
@@ -9237,7 +9354,7 @@ function compileBlueprint(e, {
9237
9354
  var _, T, C, S, k, $, g;
9238
9355
  e = {
9239
9356
  ...e,
9240
- steps: (e.steps || []).filter(isStepDefinition)
9357
+ steps: (e.steps || []).filter(isStepDefinition).filter(isStepStillSupported)
9241
9358
  };
9242
9359
  for (const y of e.steps)
9243
9360
  typeof y == "object" && y.step === "importFile" && (y.step = "importWxr", console.warn(
@@ -9350,14 +9467,14 @@ function compileBlueprint(e, {
9350
9467
  I.setPlayground(y), I.isAsync && I.resolve();
9351
9468
  for (const [P, { run: I, step: D }] of Object.entries(p))
9352
9469
  try {
9353
- const w = await I(y);
9354
- n(w, D);
9355
- } catch (w) {
9356
- throw console.error(w), new Error(
9470
+ const v = await I(y);
9471
+ n(v, D);
9472
+ } catch (v) {
9473
+ throw console.error(v), new Error(
9357
9474
  `Error when executing the blueprint step #${P} (${JSON.stringify(
9358
9475
  D
9359
- )}) ${w instanceof Error ? `: ${w.message}` : w}`,
9360
- { cause: w }
9476
+ )}) ${v instanceof Error ? `: ${v.message}` : v}`,
9477
+ { cause: v }
9361
9478
  );
9362
9479
  }
9363
9480
  } finally {
@@ -9405,6 +9522,11 @@ function compilePHPExtensions(e, t) {
9405
9522
  function isStepDefinition(e) {
9406
9523
  return !!(typeof e == "object" && e);
9407
9524
  }
9525
+ function isStepStillSupported(e) {
9526
+ return e.step === "setPhpIniEntry" ? (console.warn(
9527
+ 'The "setPhpIniEntry" Blueprint is no longer supported and you can remove it from your Blueprint.'
9528
+ ), !1) : !0;
9529
+ }
9408
9530
  function compileStep(e, {
9409
9531
  semaphore: t,
9410
9532
  rootProgressTracker: r,
@@ -9783,7 +9905,7 @@ function proxyClone(e) {
9783
9905
  }
9784
9906
  class Logger extends EventTarget {
9785
9907
  constructor(t) {
9786
- super(), this.fatalErrorEvent = "playground-fatal-error", this.logs = [], this.windowConnected = !1, this.lastPHPLogLength = 0, this.errorLogPath = "/wordpress/wp-content/debug.log", t && (this.errorLogPath = t);
9908
+ super(), this.fatalErrorEvent = "playground-fatal-error", this.logs = [], this.windowConnected = !1, this.lastPHPLogLength = 0, this.context = {}, this.errorLogPath = "/wordpress/wp-content/debug.log", t && (this.errorLogPath = t);
9787
9909
  }
9788
9910
  /**
9789
9911
  * Read the WordPress debug.log file and return its content.
@@ -9828,6 +9950,18 @@ class Logger extends EventTarget {
9828
9950
  this.logUnhandledRejection.bind(this)
9829
9951
  ), this.windowConnected = !0);
9830
9952
  }
9953
+ /**
9954
+ * Register a listener for service worker messages and log the data.
9955
+ * The service worker will send the number of open Playground tabs.
9956
+ */
9957
+ addServiceWorkerMessageListener() {
9958
+ navigator.serviceWorker.addEventListener("message", (t) => {
9959
+ var r;
9960
+ ((r = t.data) == null ? void 0 : r.numberOfOpenPlaygroundTabs) !== void 0 && this.addContext({
9961
+ numberOfOpenPlaygroundTabs: t.data.numberOfOpenPlaygroundTabs
9962
+ });
9963
+ });
9964
+ }
9831
9965
  /**
9832
9966
  * Register a listener for the request.end event and log the data.
9833
9967
  * @param UniversalPHP playground instance
@@ -9909,7 +10043,19 @@ class Logger extends EventTarget {
9909
10043
  * @returns string[]
9910
10044
  */
9911
10045
  getLogs() {
9912
- return this.logs;
10046
+ return [...this.logs];
10047
+ }
10048
+ /**
10049
+ * Add context data.
10050
+ */
10051
+ addContext(t) {
10052
+ this.context = { ...this.context, ...t };
10053
+ }
10054
+ /**
10055
+ * Get context data.
10056
+ */
10057
+ getContext() {
10058
+ return { ...this.context };
9913
10059
  }
9914
10060
  }
9915
10061
  const logger = new Logger();
@@ -10034,7 +10180,6 @@ export {
10034
10180
  runPHPWithOptions,
10035
10181
  runSql,
10036
10182
  runWpInstallationWizard,
10037
- setPhpIniEntry,
10038
10183
  setPluginProxyURL,
10039
10184
  setSiteOptions,
10040
10185
  startPlaygroundWeb,