@wp-playground/client 0.6.16 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +57 -29
- package/index.d.ts +152 -226
- package/index.js +943 -812
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var It = (e, t, r) => {
|
|
2
2
|
if (!t.has(e))
|
|
3
3
|
throw TypeError("Cannot " + r);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
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
|
-
},
|
|
10
|
-
var ce = (e, t, 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
|
-
|
|
112
|
-
|
|
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 () => {
|
|
@@ -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)
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
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,
|
|
1860
|
+
this.php = t, ie(this, Ke, new HttpCookieStore()), ie(this, Pe, n);
|
|
1908
1861
|
const o = new URL(s);
|
|
1909
|
-
|
|
1910
|
-
const c =
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
c ? `:${
|
|
1914
|
-
].join("")),
|
|
1915
|
-
`${
|
|
1916
|
-
|
|
1917
|
-
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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(
|
|
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
|
|
1895
|
+
return x(this, Ae).running > 0;
|
|
1931
1896
|
}
|
|
1932
|
-
/**
|
|
1897
|
+
/**
|
|
1898
|
+
* The absolute URL of this PHPRequestHandler instance.
|
|
1899
|
+
*/
|
|
1933
1900
|
get absoluteUrl() {
|
|
1934
|
-
return
|
|
1901
|
+
return x(this, Ge);
|
|
1935
1902
|
}
|
|
1936
|
-
/**
|
|
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
|
|
1908
|
+
return x(this, Pe);
|
|
1939
1909
|
}
|
|
1940
|
-
/**
|
|
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
|
-
|
|
1966
|
+
x(this, we)
|
|
1950
1967
|
),
|
|
1951
1968
|
this.rewriteRules
|
|
1952
|
-
), i = joinPaths(
|
|
1953
|
-
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this,
|
|
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(),
|
|
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
|
-
},
|
|
1998
|
+
}, ht = new WeakSet(), Bt = async function(t, r) {
|
|
1982
1999
|
var s;
|
|
1983
|
-
if (
|
|
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
|
|
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:
|
|
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,
|
|
2024
|
+
d = ce(this, mt, Gt).call(this, decodeURIComponent(r.pathname));
|
|
2011
2025
|
} catch {
|
|
2012
2026
|
return new PHPResponse(
|
|
2013
2027
|
404,
|
|
@@ -2016,17 +2030,25 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2016
2030
|
);
|
|
2017
2031
|
}
|
|
2018
2032
|
try {
|
|
2019
|
-
|
|
2033
|
+
const u = await this.php.run({
|
|
2020
2034
|
relativeUri: ensurePathPrefix(
|
|
2021
2035
|
toRelativeUrl(r),
|
|
2022
|
-
|
|
2036
|
+
x(this, we)
|
|
2023
2037
|
),
|
|
2024
|
-
protocol:
|
|
2038
|
+
protocol: x(this, We),
|
|
2025
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
|
+
},
|
|
2026
2045
|
body: c,
|
|
2027
2046
|
scriptPath: d,
|
|
2028
2047
|
headers: o
|
|
2029
2048
|
});
|
|
2049
|
+
return x(this, Ke).rememberCookiesFromResponseHeaders(
|
|
2050
|
+
u.headers
|
|
2051
|
+
), u;
|
|
2030
2052
|
} catch (u) {
|
|
2031
2053
|
const p = u;
|
|
2032
2054
|
if (p != null && p.response)
|
|
@@ -2036,10 +2058,10 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2036
2058
|
} finally {
|
|
2037
2059
|
n();
|
|
2038
2060
|
}
|
|
2039
|
-
},
|
|
2040
|
-
let r = removePathPrefix(t,
|
|
2041
|
-
r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${
|
|
2042
|
-
const n = `${
|
|
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}`;
|
|
2043
2065
|
if (this.php.fileExists(n))
|
|
2044
2066
|
return n;
|
|
2045
2067
|
throw new Error(`File not found: ${n}`);
|
|
@@ -2080,6 +2102,38 @@ function inferMimeType(e) {
|
|
|
2080
2102
|
case "txt":
|
|
2081
2103
|
case "md":
|
|
2082
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";
|
|
2083
2137
|
default:
|
|
2084
2138
|
return "application-octet-stream";
|
|
2085
2139
|
}
|
|
@@ -2221,7 +2275,7 @@ class PHPExecutionFailureError extends Error {
|
|
|
2221
2275
|
super(t), this.response = r, this.source = n;
|
|
2222
2276
|
}
|
|
2223
2277
|
}
|
|
2224
|
-
var
|
|
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;
|
|
2225
2279
|
class BasePHP {
|
|
2226
2280
|
/**
|
|
2227
2281
|
* Initializes a PHP runtime.
|
|
@@ -2231,46 +2285,55 @@ class BasePHP {
|
|
|
2231
2285
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2232
2286
|
*/
|
|
2233
2287
|
constructor(e, t) {
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
)
|
|
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));
|
|
2257
2320
|
}
|
|
2258
2321
|
addEventListener(e, t) {
|
|
2259
|
-
|
|
2322
|
+
x(this, Ee).has(e) || x(this, Ee).set(e, /* @__PURE__ */ new Set()), x(this, Ee).get(e).add(t);
|
|
2260
2323
|
}
|
|
2261
2324
|
removeEventListener(e, t) {
|
|
2262
2325
|
var r;
|
|
2263
|
-
(r =
|
|
2326
|
+
(r = x(this, Ee).get(e)) == null || r.delete(t);
|
|
2264
2327
|
}
|
|
2265
2328
|
dispatchEvent(e) {
|
|
2266
|
-
const t =
|
|
2329
|
+
const t = x(this, Ee).get(e.type);
|
|
2267
2330
|
if (t)
|
|
2268
2331
|
for (const r of t)
|
|
2269
2332
|
r(e);
|
|
2270
2333
|
}
|
|
2271
2334
|
/** @inheritDoc */
|
|
2272
2335
|
async onMessage(e) {
|
|
2273
|
-
|
|
2336
|
+
x(this, Ye).push(e);
|
|
2274
2337
|
}
|
|
2275
2338
|
/** @inheritDoc */
|
|
2276
2339
|
async setSpawnHandler(handler) {
|
|
@@ -2278,21 +2341,19 @@ class BasePHP {
|
|
|
2278
2341
|
}
|
|
2279
2342
|
/** @inheritDoc */
|
|
2280
2343
|
get absoluteUrl() {
|
|
2281
|
-
return this.requestHandler.
|
|
2344
|
+
return this.requestHandler.absoluteUrl;
|
|
2282
2345
|
}
|
|
2283
2346
|
/** @inheritDoc */
|
|
2284
2347
|
get documentRoot() {
|
|
2285
|
-
return this.requestHandler.
|
|
2348
|
+
return this.requestHandler.documentRoot;
|
|
2286
2349
|
}
|
|
2287
2350
|
/** @inheritDoc */
|
|
2288
2351
|
pathToInternalUrl(e) {
|
|
2289
|
-
return this.requestHandler.
|
|
2352
|
+
return this.requestHandler.pathToInternalUrl(e);
|
|
2290
2353
|
}
|
|
2291
2354
|
/** @inheritDoc */
|
|
2292
2355
|
internalUrlToPath(e) {
|
|
2293
|
-
return this.requestHandler.
|
|
2294
|
-
e
|
|
2295
|
-
);
|
|
2356
|
+
return this.requestHandler.internalUrlToPath(e);
|
|
2296
2357
|
}
|
|
2297
2358
|
initializeRuntime(e) {
|
|
2298
2359
|
if (this[__private__dont__use])
|
|
@@ -2301,13 +2362,13 @@ class BasePHP {
|
|
|
2301
2362
|
if (!t)
|
|
2302
2363
|
throw new Error("Invalid PHP runtime id.");
|
|
2303
2364
|
this[__private__dont__use] = t, t.onMessage = async (r) => {
|
|
2304
|
-
for (const n of
|
|
2365
|
+
for (const n of x(this, Ye)) {
|
|
2305
2366
|
const s = await n(r);
|
|
2306
2367
|
if (s)
|
|
2307
2368
|
return s;
|
|
2308
2369
|
}
|
|
2309
2370
|
return "";
|
|
2310
|
-
},
|
|
2371
|
+
}, ie(this, Re, improveWASMErrorReporting(t)), this.dispatchEvent({
|
|
2311
2372
|
type: "runtime.initialized"
|
|
2312
2373
|
});
|
|
2313
2374
|
}
|
|
@@ -2322,13 +2383,13 @@ class BasePHP {
|
|
|
2322
2383
|
throw new Error(
|
|
2323
2384
|
"Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?"
|
|
2324
2385
|
);
|
|
2325
|
-
|
|
2386
|
+
ie(this, Qe, e);
|
|
2326
2387
|
}
|
|
2327
2388
|
/** @inheritDoc */
|
|
2328
2389
|
setPhpIniPath(e) {
|
|
2329
|
-
if (
|
|
2390
|
+
if (x(this, be))
|
|
2330
2391
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2331
|
-
|
|
2392
|
+
ie(this, Je, e), this[__private__dont__use].ccall(
|
|
2332
2393
|
"wasm_set_phpini_path",
|
|
2333
2394
|
null,
|
|
2334
2395
|
["string"],
|
|
@@ -2337,46 +2398,49 @@ class BasePHP {
|
|
|
2337
2398
|
}
|
|
2338
2399
|
/** @inheritDoc */
|
|
2339
2400
|
setPhpIniEntry(e, t) {
|
|
2340
|
-
if (
|
|
2401
|
+
if (x(this, be))
|
|
2341
2402
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2342
|
-
|
|
2403
|
+
x(this, De).push([e, t]);
|
|
2343
2404
|
}
|
|
2344
2405
|
/** @inheritDoc */
|
|
2345
2406
|
chdir(e) {
|
|
2346
2407
|
this[__private__dont__use].FS.chdir(e);
|
|
2347
2408
|
}
|
|
2348
2409
|
/** @inheritDoc */
|
|
2349
|
-
async request(e
|
|
2410
|
+
async request(e) {
|
|
2350
2411
|
if (!this.requestHandler)
|
|
2351
2412
|
throw new Error("No request handler available.");
|
|
2352
|
-
return this.requestHandler.request(e
|
|
2413
|
+
return this.requestHandler.request(e);
|
|
2353
2414
|
}
|
|
2354
2415
|
/** @inheritDoc */
|
|
2355
2416
|
async run(e) {
|
|
2356
2417
|
const t = await this.semaphore.acquire();
|
|
2357
2418
|
let r;
|
|
2358
2419
|
try {
|
|
2359
|
-
if (
|
|
2420
|
+
if (x(this, be) || (ce(this, gt, Jt).call(this), ie(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2360
2421
|
throw new Error(
|
|
2361
2422
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2362
2423
|
);
|
|
2363
|
-
ce(this,
|
|
2364
|
-
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2365
|
-
ce(this, wt,
|
|
2366
|
-
const
|
|
2367
|
-
for (const
|
|
2368
|
-
ce(this, Tt,
|
|
2369
|
-
const
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
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,
|
|
2375
2439
|
"request"
|
|
2376
2440
|
);
|
|
2377
|
-
throw console.error(
|
|
2441
|
+
throw console.error(u), u;
|
|
2378
2442
|
}
|
|
2379
|
-
return
|
|
2443
|
+
return d;
|
|
2380
2444
|
} catch (n) {
|
|
2381
2445
|
throw this.dispatchEvent({
|
|
2382
2446
|
type: "request.error",
|
|
@@ -2394,9 +2458,6 @@ class BasePHP {
|
|
|
2394
2458
|
}
|
|
2395
2459
|
}
|
|
2396
2460
|
}
|
|
2397
|
-
addServerGlobalEntry(e, t) {
|
|
2398
|
-
H(this, Te)[e] = t;
|
|
2399
|
-
}
|
|
2400
2461
|
defineConstant(e, t) {
|
|
2401
2462
|
let r = {};
|
|
2402
2463
|
try {
|
|
@@ -2484,17 +2545,18 @@ class BasePHP {
|
|
|
2484
2545
|
* interrupting the operations of this PHP instance.
|
|
2485
2546
|
*
|
|
2486
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.
|
|
2487
2552
|
*/
|
|
2488
|
-
hotSwapPHPRuntime(e) {
|
|
2489
|
-
const
|
|
2553
|
+
hotSwapPHPRuntime(e, t) {
|
|
2554
|
+
const r = this[__private__dont__use].FS;
|
|
2490
2555
|
try {
|
|
2491
2556
|
this.exit();
|
|
2492
2557
|
} catch {
|
|
2493
2558
|
}
|
|
2494
|
-
|
|
2495
|
-
const r = this.documentRoot;
|
|
2496
|
-
copyFS(t, this[__private__dont__use].FS, r);
|
|
2497
|
-
}
|
|
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);
|
|
2498
2560
|
}
|
|
2499
2561
|
exit(e = 0) {
|
|
2500
2562
|
this.dispatchEvent({
|
|
@@ -2504,10 +2566,20 @@ class BasePHP {
|
|
|
2504
2566
|
this[__private__dont__use]._exit(e);
|
|
2505
2567
|
} catch {
|
|
2506
2568
|
}
|
|
2507
|
-
|
|
2569
|
+
ie(this, be, !1), ie(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2508
2570
|
}
|
|
2509
2571
|
}
|
|
2510
|
-
|
|
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() {
|
|
2511
2583
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2512
2584
|
"/internal/consts.php",
|
|
2513
2585
|
`<?php
|
|
@@ -2519,8 +2591,8 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2519
2591
|
}
|
|
2520
2592
|
}
|
|
2521
2593
|
}`
|
|
2522
|
-
),
|
|
2523
|
-
const e =
|
|
2594
|
+
), x(this, De).length > 0) {
|
|
2595
|
+
const e = x(this, De).map(([t, r]) => `${t}=${r}`).join(`
|
|
2524
2596
|
`) + `
|
|
2525
2597
|
|
|
2526
2598
|
`;
|
|
@@ -2532,7 +2604,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2532
2604
|
);
|
|
2533
2605
|
}
|
|
2534
2606
|
this[__private__dont__use].ccall("php_wasm_init", null, [], []);
|
|
2535
|
-
},
|
|
2607
|
+
}, yt = new WeakSet(), Qt = function() {
|
|
2536
2608
|
const e = "/internal/headers.json";
|
|
2537
2609
|
if (!this.fileExists(e))
|
|
2538
2610
|
throw new Error(
|
|
@@ -2549,7 +2621,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2549
2621
|
headers: r,
|
|
2550
2622
|
httpStatusCode: t.status
|
|
2551
2623
|
};
|
|
2552
|
-
},
|
|
2624
|
+
}, $t = new WeakSet(), Yt = function(e) {
|
|
2553
2625
|
if (this[__private__dont__use].ccall(
|
|
2554
2626
|
"wasm_set_request_uri",
|
|
2555
2627
|
null,
|
|
@@ -2564,32 +2636,35 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2564
2636
|
[t]
|
|
2565
2637
|
);
|
|
2566
2638
|
}
|
|
2567
|
-
}, wt = new WeakSet(),
|
|
2639
|
+
}, wt = new WeakSet(), Zt = function(e) {
|
|
2568
2640
|
this[__private__dont__use].ccall(
|
|
2569
2641
|
"wasm_set_request_host",
|
|
2570
2642
|
null,
|
|
2571
2643
|
[STRING],
|
|
2572
2644
|
[e]
|
|
2573
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) {
|
|
2574
2654
|
let r;
|
|
2575
2655
|
try {
|
|
2576
2656
|
r = parseInt(new URL(e).port, 10);
|
|
2577
2657
|
} catch {
|
|
2578
2658
|
}
|
|
2579
|
-
(!r || isNaN(r) || r === 80) && (r = t === "https" ? 443 : 80),
|
|
2580
|
-
|
|
2581
|
-
null,
|
|
2582
|
-
[NUMBER],
|
|
2583
|
-
[r]
|
|
2584
|
-
), (t === "https" || !t && r === 443) && this.addServerGlobalEntry("HTTPS", "on");
|
|
2585
|
-
}, 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) {
|
|
2586
2661
|
this[__private__dont__use].ccall(
|
|
2587
2662
|
"wasm_set_request_method",
|
|
2588
2663
|
null,
|
|
2589
2664
|
[STRING],
|
|
2590
2665
|
[e]
|
|
2591
2666
|
);
|
|
2592
|
-
}, Et = new WeakSet(),
|
|
2667
|
+
}, Et = new WeakSet(), rr = function(e) {
|
|
2593
2668
|
e.cookie && this[__private__dont__use].ccall(
|
|
2594
2669
|
"wasm_set_cookies",
|
|
2595
2670
|
null,
|
|
@@ -2606,14 +2681,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2606
2681
|
[NUMBER],
|
|
2607
2682
|
[parseInt(e["content-length"], 10)]
|
|
2608
2683
|
);
|
|
2609
|
-
|
|
2610
|
-
let r = "HTTP_";
|
|
2611
|
-
["content-type", "content-length"].includes(t.toLowerCase()) && (r = ""), this.addServerGlobalEntry(
|
|
2612
|
-
`${r}${t.toUpperCase().replace(/-/g, "_")}`,
|
|
2613
|
-
e[t]
|
|
2614
|
-
);
|
|
2615
|
-
}
|
|
2616
|
-
}, bt = new WeakSet(), Xt = function(e) {
|
|
2684
|
+
}, St = new WeakSet(), nr = function(e) {
|
|
2617
2685
|
let t, r;
|
|
2618
2686
|
typeof e == "string" ? (console.warn(
|
|
2619
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"
|
|
@@ -2636,36 +2704,35 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2636
2704
|
[NUMBER],
|
|
2637
2705
|
[r]
|
|
2638
2706
|
), n;
|
|
2639
|
-
},
|
|
2707
|
+
}, Rt = new WeakSet(), sr = function(e) {
|
|
2640
2708
|
this[__private__dont__use].ccall(
|
|
2641
2709
|
"wasm_set_path_translated",
|
|
2642
2710
|
null,
|
|
2643
2711
|
[STRING],
|
|
2644
2712
|
[e]
|
|
2645
2713
|
);
|
|
2646
|
-
},
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
}, 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) {
|
|
2655
2722
|
this[__private__dont__use].ccall(
|
|
2656
2723
|
"wasm_add_ENV_entry",
|
|
2657
2724
|
null,
|
|
2658
2725
|
[STRING, STRING],
|
|
2659
2726
|
[e, t]
|
|
2660
2727
|
);
|
|
2661
|
-
},
|
|
2728
|
+
}, Ct = new WeakSet(), ar = function(e) {
|
|
2662
2729
|
this[__private__dont__use].ccall(
|
|
2663
2730
|
"wasm_set_php_code",
|
|
2664
2731
|
null,
|
|
2665
2732
|
[STRING],
|
|
2666
2733
|
[e]
|
|
2667
2734
|
);
|
|
2668
|
-
},
|
|
2735
|
+
}, Ot = new WeakSet(), cr = async function() {
|
|
2669
2736
|
var s;
|
|
2670
2737
|
let e, t;
|
|
2671
2738
|
try {
|
|
@@ -2675,7 +2742,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2675
2742
|
console.error(u), console.error(u.error);
|
|
2676
2743
|
const p = new Error("Rethrown");
|
|
2677
2744
|
p.cause = u.error, p.betterMessage = u.message, o(p);
|
|
2678
|
-
}, (d =
|
|
2745
|
+
}, (d = x(this, Re)) == null || d.addEventListener(
|
|
2679
2746
|
"error",
|
|
2680
2747
|
t
|
|
2681
2748
|
);
|
|
@@ -2699,9 +2766,9 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2699
2766
|
const o = i, c = "betterMessage" in o ? o.betterMessage : o.message, d = new Error(c);
|
|
2700
2767
|
throw d.cause = o, console.error(d), d;
|
|
2701
2768
|
} finally {
|
|
2702
|
-
(s =
|
|
2769
|
+
(s = x(this, Re)) == null || s.removeEventListener("error", t);
|
|
2703
2770
|
}
|
|
2704
|
-
const { headers: r, httpStatusCode: n } = ce(this,
|
|
2771
|
+
const { headers: r, httpStatusCode: n } = ce(this, yt, Qt).call(this);
|
|
2705
2772
|
return new PHPResponse(
|
|
2706
2773
|
e === 0 ? n : 500,
|
|
2707
2774
|
r,
|
|
@@ -2865,16 +2932,52 @@ class FetchResource extends Resource {
|
|
|
2865
2932
|
}
|
|
2866
2933
|
/** @inheritDoc */
|
|
2867
2934
|
async resolve() {
|
|
2868
|
-
var
|
|
2869
|
-
(
|
|
2935
|
+
var r, n;
|
|
2936
|
+
(r = this.progress) == null || r.setCaption(this.caption);
|
|
2870
2937
|
const t = this.getURL();
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
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
|
+
}
|
|
2878
2981
|
}
|
|
2879
2982
|
/**
|
|
2880
2983
|
* Gets the caption for the progress tracker.
|
|
@@ -3388,12 +3491,12 @@ var scope = {};
|
|
|
3388
3491
|
let M = N.length;
|
|
3389
3492
|
for (; M--; ) {
|
|
3390
3493
|
const L = N[M];
|
|
3391
|
-
L.optimizeNames(a, h) || (
|
|
3494
|
+
L.optimizeNames(a, h) || (Te(a, L.names), N.splice(M, 1));
|
|
3392
3495
|
}
|
|
3393
3496
|
return N.length > 0 ? this : void 0;
|
|
3394
3497
|
}
|
|
3395
3498
|
get names() {
|
|
3396
|
-
return this.nodes.reduce((a, h) =>
|
|
3499
|
+
return this.nodes.reduce((a, h) => J(a, h.names), {});
|
|
3397
3500
|
}
|
|
3398
3501
|
}
|
|
3399
3502
|
class S extends C {
|
|
@@ -3425,7 +3528,7 @@ var scope = {};
|
|
|
3425
3528
|
h = this.else = Array.isArray(N) ? new $(N) : N;
|
|
3426
3529
|
}
|
|
3427
3530
|
if (h)
|
|
3428
|
-
return a === !1 ? h instanceof g ? h : h.nodes : this.nodes.length ? this : new g(
|
|
3531
|
+
return a === !1 ? h instanceof g ? h : h.nodes : this.nodes.length ? this : new g(ke(a), h instanceof g ? [h] : h.nodes);
|
|
3429
3532
|
if (!(a === !1 || !this.nodes.length))
|
|
3430
3533
|
return this;
|
|
3431
3534
|
}
|
|
@@ -3436,7 +3539,7 @@ var scope = {};
|
|
|
3436
3539
|
}
|
|
3437
3540
|
get names() {
|
|
3438
3541
|
const a = super.names;
|
|
3439
|
-
return ue(a, this.condition), this.else &&
|
|
3542
|
+
return ue(a, this.condition), this.else && J(a, this.else.names), a;
|
|
3440
3543
|
}
|
|
3441
3544
|
}
|
|
3442
3545
|
g.kind = "if";
|
|
@@ -3455,7 +3558,7 @@ var scope = {};
|
|
|
3455
3558
|
return this.iteration = oe(this.iteration, a, h), this;
|
|
3456
3559
|
}
|
|
3457
3560
|
get names() {
|
|
3458
|
-
return
|
|
3561
|
+
return J(super.names, this.iteration.names);
|
|
3459
3562
|
}
|
|
3460
3563
|
}
|
|
3461
3564
|
class I extends y {
|
|
@@ -3483,10 +3586,10 @@ var scope = {};
|
|
|
3483
3586
|
return this.iterable = oe(this.iterable, a, h), this;
|
|
3484
3587
|
}
|
|
3485
3588
|
get names() {
|
|
3486
|
-
return
|
|
3589
|
+
return J(super.names, this.iterable.names);
|
|
3487
3590
|
}
|
|
3488
3591
|
}
|
|
3489
|
-
class
|
|
3592
|
+
class v extends S {
|
|
3490
3593
|
constructor(a, h, N) {
|
|
3491
3594
|
super(), this.name = a, this.args = h, this.async = N;
|
|
3492
3595
|
}
|
|
@@ -3494,7 +3597,7 @@ var scope = {};
|
|
|
3494
3597
|
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(a);
|
|
3495
3598
|
}
|
|
3496
3599
|
}
|
|
3497
|
-
|
|
3600
|
+
v.kind = "func";
|
|
3498
3601
|
class O extends C {
|
|
3499
3602
|
render(a) {
|
|
3500
3603
|
return "return " + super.render(a);
|
|
@@ -3516,10 +3619,10 @@ var scope = {};
|
|
|
3516
3619
|
}
|
|
3517
3620
|
get names() {
|
|
3518
3621
|
const a = super.names;
|
|
3519
|
-
return this.catch &&
|
|
3622
|
+
return this.catch && J(a, this.catch.names), this.finally && J(a, this.finally.names), a;
|
|
3520
3623
|
}
|
|
3521
3624
|
}
|
|
3522
|
-
class
|
|
3625
|
+
class H extends S {
|
|
3523
3626
|
constructor(a) {
|
|
3524
3627
|
super(), this.error = a;
|
|
3525
3628
|
}
|
|
@@ -3527,14 +3630,14 @@ var scope = {};
|
|
|
3527
3630
|
return `catch(${this.error})` + super.render(a);
|
|
3528
3631
|
}
|
|
3529
3632
|
}
|
|
3530
|
-
|
|
3633
|
+
H.kind = "catch";
|
|
3531
3634
|
class z extends S {
|
|
3532
3635
|
render(a) {
|
|
3533
3636
|
return "finally" + super.render(a);
|
|
3534
3637
|
}
|
|
3535
3638
|
}
|
|
3536
3639
|
z.kind = "finally";
|
|
3537
|
-
class
|
|
3640
|
+
class te {
|
|
3538
3641
|
constructor(a, h = {}) {
|
|
3539
3642
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
3540
3643
|
` : "" }, this._extScope = a, this._scope = new r.Scope({ parent: a }), this._nodes = [new k()];
|
|
@@ -3680,9 +3783,9 @@ var scope = {};
|
|
|
3680
3783
|
const M = new A();
|
|
3681
3784
|
if (this._blockNode(M), this.code(a), h) {
|
|
3682
3785
|
const L = this.name("e");
|
|
3683
|
-
this._currNode = M.catch = new
|
|
3786
|
+
this._currNode = M.catch = new H(L), h(L);
|
|
3684
3787
|
}
|
|
3685
|
-
return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(
|
|
3788
|
+
return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(H, z);
|
|
3686
3789
|
}
|
|
3687
3790
|
// `throw` statement
|
|
3688
3791
|
throw(a) {
|
|
@@ -3704,11 +3807,11 @@ var scope = {};
|
|
|
3704
3807
|
}
|
|
3705
3808
|
// `function` heading (or definition if funcBody is passed)
|
|
3706
3809
|
func(a, h = t.nil, N, M) {
|
|
3707
|
-
return this._blockNode(new
|
|
3810
|
+
return this._blockNode(new v(a, h, N)), M && this.code(M).endFunc(), this;
|
|
3708
3811
|
}
|
|
3709
3812
|
// end function definition
|
|
3710
3813
|
endFunc() {
|
|
3711
|
-
return this._endBlockNode(
|
|
3814
|
+
return this._endBlockNode(v);
|
|
3712
3815
|
}
|
|
3713
3816
|
optimize(a = 1) {
|
|
3714
3817
|
for (; a-- > 0; )
|
|
@@ -3744,21 +3847,21 @@ var scope = {};
|
|
|
3744
3847
|
h[h.length - 1] = a;
|
|
3745
3848
|
}
|
|
3746
3849
|
}
|
|
3747
|
-
e.CodeGen =
|
|
3748
|
-
function
|
|
3850
|
+
e.CodeGen = te;
|
|
3851
|
+
function J(b, a) {
|
|
3749
3852
|
for (const h in a)
|
|
3750
|
-
|
|
3751
|
-
return
|
|
3752
|
-
}
|
|
3753
|
-
function ue(
|
|
3754
|
-
return a instanceof t._CodeOrName ?
|
|
3755
|
-
}
|
|
3756
|
-
function oe(
|
|
3757
|
-
if (
|
|
3758
|
-
return N(
|
|
3759
|
-
if (!M(
|
|
3760
|
-
return
|
|
3761
|
-
return new t._Code(
|
|
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), []));
|
|
3762
3865
|
function N(L) {
|
|
3763
3866
|
const W = h[L.str];
|
|
3764
3867
|
return W === void 0 || a[L.str] !== 1 ? L : (delete a[L.str], W);
|
|
@@ -3767,167 +3870,167 @@ var scope = {};
|
|
|
3767
3870
|
return L instanceof t._Code && L._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3768
3871
|
}
|
|
3769
3872
|
}
|
|
3770
|
-
function
|
|
3873
|
+
function Te(b, a) {
|
|
3771
3874
|
for (const h in a)
|
|
3772
|
-
|
|
3875
|
+
b[h] = (b[h] || 0) - (a[h] || 0);
|
|
3773
3876
|
}
|
|
3774
|
-
function
|
|
3775
|
-
return typeof
|
|
3877
|
+
function ke(b) {
|
|
3878
|
+
return typeof b == "boolean" || typeof b == "number" || b === null ? !b : (0, t._)`!${j(b)}`;
|
|
3776
3879
|
}
|
|
3777
|
-
e.not =
|
|
3778
|
-
const
|
|
3779
|
-
function
|
|
3780
|
-
return
|
|
3880
|
+
e.not = ke;
|
|
3881
|
+
const Fe = w(e.operators.AND);
|
|
3882
|
+
function Ze(...b) {
|
|
3883
|
+
return b.reduce(Fe);
|
|
3781
3884
|
}
|
|
3782
|
-
e.and =
|
|
3783
|
-
const
|
|
3784
|
-
function F(...
|
|
3785
|
-
return
|
|
3885
|
+
e.and = Ze;
|
|
3886
|
+
const Me = w(e.operators.OR);
|
|
3887
|
+
function F(...b) {
|
|
3888
|
+
return b.reduce(Me);
|
|
3786
3889
|
}
|
|
3787
3890
|
e.or = F;
|
|
3788
|
-
function
|
|
3789
|
-
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${
|
|
3891
|
+
function w(b) {
|
|
3892
|
+
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${b} ${j(h)}`;
|
|
3790
3893
|
}
|
|
3791
|
-
function j(
|
|
3792
|
-
return
|
|
3894
|
+
function j(b) {
|
|
3895
|
+
return b instanceof t.Name ? b : (0, t._)`(${b})`;
|
|
3793
3896
|
}
|
|
3794
3897
|
})(codegen);
|
|
3795
3898
|
var util = {};
|
|
3796
3899
|
(function(e) {
|
|
3797
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;
|
|
3798
3901
|
const t = codegen, r = code$1;
|
|
3799
|
-
function n(
|
|
3902
|
+
function n(v) {
|
|
3800
3903
|
const O = {};
|
|
3801
|
-
for (const A of
|
|
3904
|
+
for (const A of v)
|
|
3802
3905
|
O[A] = !0;
|
|
3803
3906
|
return O;
|
|
3804
3907
|
}
|
|
3805
3908
|
e.toHash = n;
|
|
3806
|
-
function s(
|
|
3807
|
-
return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (i(
|
|
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));
|
|
3808
3911
|
}
|
|
3809
3912
|
e.alwaysValidSchema = s;
|
|
3810
|
-
function i(
|
|
3811
|
-
const { opts: A, self:
|
|
3913
|
+
function i(v, O = v.schema) {
|
|
3914
|
+
const { opts: A, self: H } = v;
|
|
3812
3915
|
if (!A.strictSchema || typeof O == "boolean")
|
|
3813
3916
|
return;
|
|
3814
|
-
const z =
|
|
3815
|
-
for (const
|
|
3816
|
-
z[
|
|
3917
|
+
const z = H.RULES.keywords;
|
|
3918
|
+
for (const te in O)
|
|
3919
|
+
z[te] || D(v, `unknown keyword: "${te}"`);
|
|
3817
3920
|
}
|
|
3818
3921
|
e.checkUnknownRules = i;
|
|
3819
|
-
function o(
|
|
3820
|
-
if (typeof
|
|
3821
|
-
return !
|
|
3822
|
-
for (const A in
|
|
3922
|
+
function o(v, O) {
|
|
3923
|
+
if (typeof v == "boolean")
|
|
3924
|
+
return !v;
|
|
3925
|
+
for (const A in v)
|
|
3823
3926
|
if (O[A])
|
|
3824
3927
|
return !0;
|
|
3825
3928
|
return !1;
|
|
3826
3929
|
}
|
|
3827
3930
|
e.schemaHasRules = o;
|
|
3828
|
-
function c(
|
|
3829
|
-
if (typeof
|
|
3830
|
-
return !
|
|
3831
|
-
for (const A in
|
|
3931
|
+
function c(v, O) {
|
|
3932
|
+
if (typeof v == "boolean")
|
|
3933
|
+
return !v;
|
|
3934
|
+
for (const A in v)
|
|
3832
3935
|
if (A !== "$ref" && O.all[A])
|
|
3833
3936
|
return !0;
|
|
3834
3937
|
return !1;
|
|
3835
3938
|
}
|
|
3836
3939
|
e.schemaHasRulesButRef = c;
|
|
3837
|
-
function d({ topSchemaRef:
|
|
3940
|
+
function d({ topSchemaRef: v, schemaPath: O }, A, H, z) {
|
|
3838
3941
|
if (!z) {
|
|
3839
3942
|
if (typeof A == "number" || typeof A == "boolean")
|
|
3840
3943
|
return A;
|
|
3841
3944
|
if (typeof A == "string")
|
|
3842
3945
|
return (0, t._)`${A}`;
|
|
3843
3946
|
}
|
|
3844
|
-
return (0, t._)`${
|
|
3947
|
+
return (0, t._)`${v}${O}${(0, t.getProperty)(H)}`;
|
|
3845
3948
|
}
|
|
3846
3949
|
e.schemaRefOrVal = d;
|
|
3847
|
-
function u(
|
|
3848
|
-
return T(decodeURIComponent(
|
|
3950
|
+
function u(v) {
|
|
3951
|
+
return T(decodeURIComponent(v));
|
|
3849
3952
|
}
|
|
3850
3953
|
e.unescapeFragment = u;
|
|
3851
|
-
function p(
|
|
3852
|
-
return encodeURIComponent(_(
|
|
3954
|
+
function p(v) {
|
|
3955
|
+
return encodeURIComponent(_(v));
|
|
3853
3956
|
}
|
|
3854
3957
|
e.escapeFragment = p;
|
|
3855
|
-
function _(
|
|
3856
|
-
return typeof
|
|
3958
|
+
function _(v) {
|
|
3959
|
+
return typeof v == "number" ? `${v}` : v.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3857
3960
|
}
|
|
3858
3961
|
e.escapeJsonPointer = _;
|
|
3859
|
-
function T(
|
|
3860
|
-
return
|
|
3962
|
+
function T(v) {
|
|
3963
|
+
return v.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3861
3964
|
}
|
|
3862
3965
|
e.unescapeJsonPointer = T;
|
|
3863
|
-
function C(
|
|
3864
|
-
if (Array.isArray(
|
|
3865
|
-
for (const A of
|
|
3966
|
+
function C(v, O) {
|
|
3967
|
+
if (Array.isArray(v))
|
|
3968
|
+
for (const A of v)
|
|
3866
3969
|
O(A);
|
|
3867
3970
|
else
|
|
3868
|
-
O(
|
|
3971
|
+
O(v);
|
|
3869
3972
|
}
|
|
3870
3973
|
e.eachItem = C;
|
|
3871
|
-
function S({ mergeNames:
|
|
3872
|
-
return (z,
|
|
3873
|
-
const oe =
|
|
3874
|
-
return ue === t.Name && !(oe instanceof t.Name) ?
|
|
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;
|
|
3875
3978
|
};
|
|
3876
3979
|
}
|
|
3877
3980
|
e.mergeEvaluated = {
|
|
3878
3981
|
props: S({
|
|
3879
|
-
mergeNames: (
|
|
3880
|
-
|
|
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})`));
|
|
3881
3984
|
}),
|
|
3882
|
-
mergeToName: (
|
|
3883
|
-
O === !0 ?
|
|
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));
|
|
3884
3987
|
}),
|
|
3885
|
-
mergeValues: (
|
|
3988
|
+
mergeValues: (v, O) => v === !0 ? !0 : { ...v, ...O },
|
|
3886
3989
|
resultToName: k
|
|
3887
3990
|
}),
|
|
3888
3991
|
items: S({
|
|
3889
|
-
mergeNames: (
|
|
3890
|
-
mergeToName: (
|
|
3891
|
-
mergeValues: (
|
|
3892
|
-
resultToName: (
|
|
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)
|
|
3893
3996
|
})
|
|
3894
3997
|
};
|
|
3895
|
-
function k(
|
|
3998
|
+
function k(v, O) {
|
|
3896
3999
|
if (O === !0)
|
|
3897
|
-
return
|
|
3898
|
-
const A =
|
|
3899
|
-
return O !== void 0 && $(
|
|
4000
|
+
return v.var("props", !0);
|
|
4001
|
+
const A = v.var("props", (0, t._)`{}`);
|
|
4002
|
+
return O !== void 0 && $(v, A, O), A;
|
|
3900
4003
|
}
|
|
3901
4004
|
e.evaluatedPropsToName = k;
|
|
3902
|
-
function $(
|
|
3903
|
-
Object.keys(A).forEach((
|
|
4005
|
+
function $(v, O, A) {
|
|
4006
|
+
Object.keys(A).forEach((H) => v.assign((0, t._)`${O}${(0, t.getProperty)(H)}`, !0));
|
|
3904
4007
|
}
|
|
3905
4008
|
e.setEvaluated = $;
|
|
3906
4009
|
const g = {};
|
|
3907
|
-
function y(
|
|
3908
|
-
return
|
|
4010
|
+
function y(v, O) {
|
|
4011
|
+
return v.scopeValue("func", {
|
|
3909
4012
|
ref: O,
|
|
3910
4013
|
code: g[O.code] || (g[O.code] = new r._Code(O.code))
|
|
3911
4014
|
});
|
|
3912
4015
|
}
|
|
3913
4016
|
e.useFunc = y;
|
|
3914
4017
|
var P;
|
|
3915
|
-
(function(
|
|
3916
|
-
|
|
4018
|
+
(function(v) {
|
|
4019
|
+
v[v.Num = 0] = "Num", v[v.Str = 1] = "Str";
|
|
3917
4020
|
})(P = e.Type || (e.Type = {}));
|
|
3918
|
-
function I(
|
|
3919
|
-
if (
|
|
3920
|
-
const
|
|
3921
|
-
return A ?
|
|
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")`;
|
|
3922
4025
|
}
|
|
3923
|
-
return A ? (0, t.getProperty)(
|
|
4026
|
+
return A ? (0, t.getProperty)(v).toString() : "/" + _(v);
|
|
3924
4027
|
}
|
|
3925
4028
|
e.getErrorPath = I;
|
|
3926
|
-
function D(
|
|
4029
|
+
function D(v, O, A = v.opts.strictSchema) {
|
|
3927
4030
|
if (A) {
|
|
3928
4031
|
if (O = `strict mode: ${O}`, A === !0)
|
|
3929
4032
|
throw new Error(O);
|
|
3930
|
-
|
|
4033
|
+
v.self.logger.warn(O);
|
|
3931
4034
|
}
|
|
3932
4035
|
}
|
|
3933
4036
|
e.checkStrictMode = D;
|
|
@@ -3967,13 +4070,13 @@ names$1.default = names;
|
|
|
3967
4070
|
message: ({ keyword: $, schemaType: g }) => g ? (0, t.str)`"${$}" keyword must be ${g} ($data)` : (0, t.str)`"${$}" keyword is invalid ($data)`
|
|
3968
4071
|
};
|
|
3969
4072
|
function s($, g = e.keywordError, y, P) {
|
|
3970
|
-
const { it: I } = $, { gen: D, compositeRule:
|
|
3971
|
-
P ?? (
|
|
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}]`);
|
|
3972
4075
|
}
|
|
3973
4076
|
e.reportError = s;
|
|
3974
4077
|
function i($, g = e.keywordError, y) {
|
|
3975
|
-
const { it: P } = $, { gen: I, compositeRule: D, allErrors:
|
|
3976
|
-
d(I, O), D ||
|
|
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);
|
|
3977
4080
|
}
|
|
3978
4081
|
e.reportExtraError = i;
|
|
3979
4082
|
function o($, g) {
|
|
@@ -3983,9 +4086,9 @@ names$1.default = names;
|
|
|
3983
4086
|
function c({ gen: $, keyword: g, schemaValue: y, data: P, errsCount: I, it: D }) {
|
|
3984
4087
|
if (I === void 0)
|
|
3985
4088
|
throw new Error("ajv implementation error");
|
|
3986
|
-
const
|
|
4089
|
+
const v = $.name("err");
|
|
3987
4090
|
$.forRange("i", I, n.default.errors, (O) => {
|
|
3988
|
-
$.const(
|
|
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));
|
|
3989
4092
|
});
|
|
3990
4093
|
}
|
|
3991
4094
|
e.extendErrors = c;
|
|
@@ -4026,8 +4129,8 @@ names$1.default = names;
|
|
|
4026
4129
|
return y && (I = (0, t.str)`${I}${(0, r.getErrorPath)(y, r.Type.Str)}`), [p.schemaPath, I];
|
|
4027
4130
|
}
|
|
4028
4131
|
function k($, { params: g, message: y }, P) {
|
|
4029
|
-
const { keyword: I, data: D, schemaValue:
|
|
4030
|
-
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,
|
|
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]);
|
|
4031
4134
|
}
|
|
4032
4135
|
})(errors);
|
|
4033
4136
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4127,14 +4230,14 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4127
4230
|
}
|
|
4128
4231
|
e.getJSONTypes = d;
|
|
4129
4232
|
function u(P, I) {
|
|
4130
|
-
const { gen: D, data:
|
|
4131
|
-
if (
|
|
4132
|
-
const z = k(I,
|
|
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);
|
|
4133
4236
|
D.if(z, () => {
|
|
4134
4237
|
A.length ? T(P, I, A) : g(P);
|
|
4135
4238
|
});
|
|
4136
4239
|
}
|
|
4137
|
-
return
|
|
4240
|
+
return H;
|
|
4138
4241
|
}
|
|
4139
4242
|
e.coerceAndCheckDataType = u;
|
|
4140
4243
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
@@ -4142,43 +4245,43 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4142
4245
|
return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4143
4246
|
}
|
|
4144
4247
|
function T(P, I, D) {
|
|
4145
|
-
const { gen:
|
|
4146
|
-
A.coerceTypes === "array" &&
|
|
4147
|
-
for (const
|
|
4148
|
-
(p.has(
|
|
4149
|
-
|
|
4150
|
-
|
|
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);
|
|
4151
4254
|
});
|
|
4152
|
-
function
|
|
4153
|
-
switch (
|
|
4255
|
+
function te(J) {
|
|
4256
|
+
switch (J) {
|
|
4154
4257
|
case "string":
|
|
4155
|
-
|
|
4258
|
+
v.elseIf((0, s._)`${H} == "number" || ${H} == "boolean"`).assign(z, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(z, (0, s._)`""`);
|
|
4156
4259
|
return;
|
|
4157
4260
|
case "number":
|
|
4158
|
-
|
|
4159
|
-
|| (${
|
|
4261
|
+
v.elseIf((0, s._)`${H} == "boolean" || ${O} === null
|
|
4262
|
+
|| (${H} == "string" && ${O} && ${O} == +${O})`).assign(z, (0, s._)`+${O}`);
|
|
4160
4263
|
return;
|
|
4161
4264
|
case "integer":
|
|
4162
|
-
|
|
4163
|
-
|| (${
|
|
4265
|
+
v.elseIf((0, s._)`${H} === "boolean" || ${O} === null
|
|
4266
|
+
|| (${H} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(z, (0, s._)`+${O}`);
|
|
4164
4267
|
return;
|
|
4165
4268
|
case "boolean":
|
|
4166
|
-
|
|
4269
|
+
v.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(z, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(z, !0);
|
|
4167
4270
|
return;
|
|
4168
4271
|
case "null":
|
|
4169
|
-
|
|
4272
|
+
v.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), v.assign(z, null);
|
|
4170
4273
|
return;
|
|
4171
4274
|
case "array":
|
|
4172
|
-
|
|
4173
|
-
|| ${
|
|
4275
|
+
v.elseIf((0, s._)`${H} === "string" || ${H} === "number"
|
|
4276
|
+
|| ${H} === "boolean" || ${O} === null`).assign(z, (0, s._)`[${O}]`);
|
|
4174
4277
|
}
|
|
4175
4278
|
}
|
|
4176
4279
|
}
|
|
4177
|
-
function C({ gen: P, parentData: I, parentDataProperty: D },
|
|
4178
|
-
P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`,
|
|
4280
|
+
function C({ gen: P, parentData: I, parentDataProperty: D }, v) {
|
|
4281
|
+
P.if((0, s._)`${I} !== undefined`, () => P.assign((0, s._)`${I}[${D}]`, v));
|
|
4179
4282
|
}
|
|
4180
|
-
function S(P, I, D,
|
|
4181
|
-
const O =
|
|
4283
|
+
function S(P, I, D, v = o.Correct) {
|
|
4284
|
+
const O = v === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4182
4285
|
let A;
|
|
4183
4286
|
switch (P) {
|
|
4184
4287
|
case "null":
|
|
@@ -4190,33 +4293,33 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4190
4293
|
A = (0, s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;
|
|
4191
4294
|
break;
|
|
4192
4295
|
case "integer":
|
|
4193
|
-
A =
|
|
4296
|
+
A = H((0, s._)`!(${I} % 1) && !isNaN(${I})`);
|
|
4194
4297
|
break;
|
|
4195
4298
|
case "number":
|
|
4196
|
-
A =
|
|
4299
|
+
A = H();
|
|
4197
4300
|
break;
|
|
4198
4301
|
default:
|
|
4199
4302
|
return (0, s._)`typeof ${I} ${O} ${P}`;
|
|
4200
4303
|
}
|
|
4201
|
-
return
|
|
4202
|
-
function
|
|
4304
|
+
return v === o.Correct ? A : (0, s.not)(A);
|
|
4305
|
+
function H(z = s.nil) {
|
|
4203
4306
|
return (0, s.and)((0, s._)`typeof ${I} == "number"`, z, D ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4204
4307
|
}
|
|
4205
4308
|
}
|
|
4206
4309
|
e.checkDataType = S;
|
|
4207
|
-
function k(P, I, D,
|
|
4310
|
+
function k(P, I, D, v) {
|
|
4208
4311
|
if (P.length === 1)
|
|
4209
|
-
return S(P[0], I, D,
|
|
4312
|
+
return S(P[0], I, D, v);
|
|
4210
4313
|
let O;
|
|
4211
4314
|
const A = (0, i.toHash)(P);
|
|
4212
4315
|
if (A.array && A.object) {
|
|
4213
|
-
const
|
|
4214
|
-
O = A.null ?
|
|
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;
|
|
4215
4318
|
} else
|
|
4216
4319
|
O = s.nil;
|
|
4217
4320
|
A.number && delete A.integer;
|
|
4218
|
-
for (const
|
|
4219
|
-
O = (0, s.and)(O, S(
|
|
4321
|
+
for (const H in A)
|
|
4322
|
+
O = (0, s.and)(O, S(H, I, D, v));
|
|
4220
4323
|
return O;
|
|
4221
4324
|
}
|
|
4222
4325
|
e.checkDataTypes = k;
|
|
@@ -4230,15 +4333,15 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4230
4333
|
}
|
|
4231
4334
|
e.reportTypeError = g;
|
|
4232
4335
|
function y(P) {
|
|
4233
|
-
const { gen: I, data: D, schema:
|
|
4336
|
+
const { gen: I, data: D, schema: v } = P, O = (0, i.schemaRefOrVal)(P, v, "type");
|
|
4234
4337
|
return {
|
|
4235
4338
|
gen: I,
|
|
4236
4339
|
keyword: "type",
|
|
4237
4340
|
data: D,
|
|
4238
|
-
schema:
|
|
4341
|
+
schema: v.type,
|
|
4239
4342
|
schemaCode: O,
|
|
4240
4343
|
schemaValue: O,
|
|
4241
|
-
parentSchema:
|
|
4344
|
+
parentSchema: v,
|
|
4242
4345
|
params: {},
|
|
4243
4346
|
it: P
|
|
4244
4347
|
};
|
|
@@ -5244,8 +5347,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5244
5347
|
l[m] = arguments[m];
|
|
5245
5348
|
if (l.length > 1) {
|
|
5246
5349
|
l[0] = l[0].slice(0, -1);
|
|
5247
|
-
for (var R = l.length - 1,
|
|
5248
|
-
l[
|
|
5350
|
+
for (var R = l.length - 1, E = 1; E < R; ++E)
|
|
5351
|
+
l[E] = l[E].slice(1, -1);
|
|
5249
5352
|
return l[R] = l[R].slice(1), l.join("");
|
|
5250
5353
|
} else
|
|
5251
5354
|
return l[0];
|
|
@@ -5270,39 +5373,39 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5270
5373
|
return m;
|
|
5271
5374
|
}
|
|
5272
5375
|
function u(f) {
|
|
5273
|
-
var l = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"),
|
|
5274
|
-
s(l + n(l, m, "[\\+\\-\\.]") + "*"), s(s(
|
|
5275
|
-
var
|
|
5276
|
-
s("[vV]" + R + "+\\." + n(B, U, "[\\:]") + "+"), s(s(
|
|
5277
|
-
var
|
|
5278
|
-
return s(s(
|
|
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)) + "*"), {
|
|
5279
5382
|
NOT_SCHEME: new RegExp(n("[^]", l, m, "[\\+\\-\\.]"), "g"),
|
|
5280
5383
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
|
|
5281
5384
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
|
|
5282
5385
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, U), "g"),
|
|
5283
5386
|
NOT_PATH_NOSCHEME: new RegExp(n("[^\\%\\/\\@]", B, U), "g"),
|
|
5284
|
-
NOT_QUERY: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]",
|
|
5387
|
+
NOT_QUERY: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]", ne), "g"),
|
|
5285
5388
|
NOT_FRAGMENT: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]"), "g"),
|
|
5286
5389
|
ESCAPE: new RegExp(n("[^]", B, U), "g"),
|
|
5287
5390
|
UNRESERVED: new RegExp(B, "g"),
|
|
5288
|
-
OTHER_CHARS: new RegExp(n("[^\\%]", B,
|
|
5289
|
-
PCT_ENCODED: new RegExp(
|
|
5290
|
-
IPV4ADDRESS: new RegExp("^(" +
|
|
5291
|
-
IPV6ADDRESS: new RegExp("^\\[?(" +
|
|
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 + ")") + "?\\]?$")
|
|
5292
5395
|
//RFC 6874, with relaxed parsing rules
|
|
5293
5396
|
};
|
|
5294
5397
|
}
|
|
5295
5398
|
var p = u(!1), _ = u(!0), T = function() {
|
|
5296
5399
|
function f(l, m) {
|
|
5297
|
-
var R = [],
|
|
5400
|
+
var R = [], E = !0, q = !1, U = void 0;
|
|
5298
5401
|
try {
|
|
5299
|
-
for (var
|
|
5402
|
+
for (var Q = l[Symbol.iterator](), Z; !(E = (Z = Q.next()).done) && (R.push(Z.value), !(m && R.length === m)); E = !0)
|
|
5300
5403
|
;
|
|
5301
|
-
} catch (
|
|
5302
|
-
q = !0, U =
|
|
5404
|
+
} catch (ne) {
|
|
5405
|
+
q = !0, U = ne;
|
|
5303
5406
|
} finally {
|
|
5304
5407
|
try {
|
|
5305
|
-
!
|
|
5408
|
+
!E && Q.return && Q.return();
|
|
5306
5409
|
} finally {
|
|
5307
5410
|
if (q)
|
|
5308
5411
|
throw U;
|
|
@@ -5324,106 +5427,106 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5324
5427
|
return m;
|
|
5325
5428
|
} else
|
|
5326
5429
|
return Array.from(f);
|
|
5327
|
-
}, S = 2147483647, k = 36, $ = 1, g = 26, y = 38, P = 700, I = 72, D = 128,
|
|
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 = {
|
|
5328
5431
|
overflow: "Overflow: input needs wider integers to process",
|
|
5329
5432
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5330
5433
|
"invalid-input": "Invalid input"
|
|
5331
|
-
},
|
|
5434
|
+
}, te = k - $, J = Math.floor, ue = String.fromCharCode;
|
|
5332
5435
|
function oe(f) {
|
|
5333
5436
|
throw new RangeError(z[f]);
|
|
5334
5437
|
}
|
|
5335
|
-
function
|
|
5438
|
+
function Te(f, l) {
|
|
5336
5439
|
for (var m = [], R = f.length; R--; )
|
|
5337
5440
|
m[R] = l(f[R]);
|
|
5338
5441
|
return m;
|
|
5339
5442
|
}
|
|
5340
|
-
function
|
|
5443
|
+
function ke(f, l) {
|
|
5341
5444
|
var m = f.split("@"), R = "";
|
|
5342
|
-
m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(
|
|
5343
|
-
var
|
|
5445
|
+
m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(H, ".");
|
|
5446
|
+
var E = f.split("."), q = Te(E, l).join(".");
|
|
5344
5447
|
return R + q;
|
|
5345
5448
|
}
|
|
5346
|
-
function
|
|
5449
|
+
function Fe(f) {
|
|
5347
5450
|
for (var l = [], m = 0, R = f.length; m < R; ) {
|
|
5348
|
-
var
|
|
5349
|
-
if (
|
|
5451
|
+
var E = f.charCodeAt(m++);
|
|
5452
|
+
if (E >= 55296 && E <= 56319 && m < R) {
|
|
5350
5453
|
var q = f.charCodeAt(m++);
|
|
5351
|
-
(q & 64512) == 56320 ? l.push(((
|
|
5454
|
+
(q & 64512) == 56320 ? l.push(((E & 1023) << 10) + (q & 1023) + 65536) : (l.push(E), m--);
|
|
5352
5455
|
} else
|
|
5353
|
-
l.push(
|
|
5456
|
+
l.push(E);
|
|
5354
5457
|
}
|
|
5355
5458
|
return l;
|
|
5356
5459
|
}
|
|
5357
|
-
var
|
|
5460
|
+
var Ze = function(l) {
|
|
5358
5461
|
return String.fromCodePoint.apply(String, C(l));
|
|
5359
|
-
},
|
|
5462
|
+
}, Me = function(l) {
|
|
5360
5463
|
return l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : k;
|
|
5361
5464
|
}, F = function(l, m) {
|
|
5362
5465
|
return l + 22 + 75 * (l < 26) - ((m != 0) << 5);
|
|
5363
|
-
},
|
|
5364
|
-
var
|
|
5466
|
+
}, w = function(l, m, R) {
|
|
5467
|
+
var E = 0;
|
|
5365
5468
|
for (
|
|
5366
|
-
l = R ?
|
|
5469
|
+
l = R ? J(l / P) : l >> 1, l += J(l / m);
|
|
5367
5470
|
/* no initialization */
|
|
5368
|
-
l >
|
|
5369
|
-
|
|
5471
|
+
l > te * g >> 1;
|
|
5472
|
+
E += k
|
|
5370
5473
|
)
|
|
5371
|
-
l =
|
|
5372
|
-
return
|
|
5474
|
+
l = J(l / te);
|
|
5475
|
+
return J(E + (te + 1) * l / (l + y));
|
|
5373
5476
|
}, j = function(l) {
|
|
5374
|
-
var m = [], R = l.length,
|
|
5375
|
-
|
|
5376
|
-
for (var
|
|
5377
|
-
l.charCodeAt(
|
|
5378
|
-
for (var
|
|
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; ) {
|
|
5379
5482
|
for (
|
|
5380
|
-
var B =
|
|
5483
|
+
var B = E, Y = 1, se = k;
|
|
5381
5484
|
;
|
|
5382
5485
|
/* no condition */
|
|
5383
|
-
|
|
5486
|
+
se += k
|
|
5384
5487
|
) {
|
|
5385
|
-
|
|
5386
|
-
var V =
|
|
5387
|
-
(V >= k || V >
|
|
5388
|
-
var X =
|
|
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;
|
|
5389
5492
|
if (V < X)
|
|
5390
5493
|
break;
|
|
5391
5494
|
var ae = k - X;
|
|
5392
|
-
|
|
5495
|
+
Y > J(S / ae) && oe("overflow"), Y *= ae;
|
|
5393
5496
|
}
|
|
5394
5497
|
var ee = m.length + 1;
|
|
5395
|
-
U =
|
|
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);
|
|
5396
5499
|
}
|
|
5397
5500
|
return String.fromCodePoint.apply(String, m);
|
|
5398
|
-
},
|
|
5501
|
+
}, b = function(l) {
|
|
5399
5502
|
var m = [];
|
|
5400
|
-
l =
|
|
5401
|
-
var R = l.length,
|
|
5503
|
+
l = Fe(l);
|
|
5504
|
+
var R = l.length, E = D, q = 0, U = I, Q = !0, Z = !1, ne = void 0;
|
|
5402
5505
|
try {
|
|
5403
|
-
for (var B = l[Symbol.iterator](),
|
|
5404
|
-
var
|
|
5405
|
-
|
|
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));
|
|
5406
5509
|
}
|
|
5407
|
-
} catch (
|
|
5408
|
-
|
|
5510
|
+
} catch (at) {
|
|
5511
|
+
Z = !0, ne = at;
|
|
5409
5512
|
} finally {
|
|
5410
5513
|
try {
|
|
5411
|
-
!
|
|
5514
|
+
!Q && B.return && B.return();
|
|
5412
5515
|
} finally {
|
|
5413
|
-
if (
|
|
5414
|
-
throw
|
|
5516
|
+
if (Z)
|
|
5517
|
+
throw ne;
|
|
5415
5518
|
}
|
|
5416
5519
|
}
|
|
5417
5520
|
var V = m.length, X = V;
|
|
5418
|
-
for (V && m.push(
|
|
5521
|
+
for (V && m.push(v); X < R; ) {
|
|
5419
5522
|
var ae = S, ee = !0, Se = !1, ge = void 0;
|
|
5420
5523
|
try {
|
|
5421
|
-
for (var ye = l[Symbol.iterator](),
|
|
5422
|
-
var
|
|
5423
|
-
|
|
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);
|
|
5424
5527
|
}
|
|
5425
|
-
} catch (
|
|
5426
|
-
Se = !0, ge =
|
|
5528
|
+
} catch (at) {
|
|
5529
|
+
Se = !0, ge = at;
|
|
5427
5530
|
} finally {
|
|
5428
5531
|
try {
|
|
5429
5532
|
!ee && ye.return && ye.return();
|
|
@@ -5433,47 +5536,47 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5433
5536
|
}
|
|
5434
5537
|
}
|
|
5435
5538
|
var fe = X + 1;
|
|
5436
|
-
ae -
|
|
5437
|
-
var $e = !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;
|
|
5438
5541
|
try {
|
|
5439
|
-
for (var
|
|
5440
|
-
var Ht =
|
|
5441
|
-
if (Ht <
|
|
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) {
|
|
5442
5545
|
for (
|
|
5443
|
-
var
|
|
5546
|
+
var dt = q, ut = k;
|
|
5444
5547
|
;
|
|
5445
5548
|
/* no condition */
|
|
5446
|
-
|
|
5549
|
+
ut += k
|
|
5447
5550
|
) {
|
|
5448
|
-
var
|
|
5449
|
-
if (
|
|
5551
|
+
var pt = ut <= U ? $ : ut >= U + g ? g : ut - U;
|
|
5552
|
+
if (dt < pt)
|
|
5450
5553
|
break;
|
|
5451
|
-
var
|
|
5452
|
-
m.push(ue(F(
|
|
5554
|
+
var Vt = dt - pt, zt = k - pt;
|
|
5555
|
+
m.push(ue(F(pt + Vt % zt, 0))), dt = J(Vt / zt);
|
|
5453
5556
|
}
|
|
5454
|
-
m.push(ue(F(
|
|
5557
|
+
m.push(ue(F(dt, 0))), U = w(q, fe, X == V), q = 0, ++X;
|
|
5455
5558
|
}
|
|
5456
5559
|
}
|
|
5457
|
-
} catch (
|
|
5458
|
-
|
|
5560
|
+
} catch (at) {
|
|
5561
|
+
Ie = !0, ve = at;
|
|
5459
5562
|
} finally {
|
|
5460
5563
|
try {
|
|
5461
|
-
!$e &&
|
|
5564
|
+
!$e && ot.return && ot.return();
|
|
5462
5565
|
} finally {
|
|
5463
|
-
if (
|
|
5464
|
-
throw
|
|
5566
|
+
if (Ie)
|
|
5567
|
+
throw ve;
|
|
5465
5568
|
}
|
|
5466
5569
|
}
|
|
5467
|
-
++q, ++
|
|
5570
|
+
++q, ++E;
|
|
5468
5571
|
}
|
|
5469
5572
|
return m.join("");
|
|
5470
5573
|
}, a = function(l) {
|
|
5471
|
-
return
|
|
5574
|
+
return ke(l, function(m) {
|
|
5472
5575
|
return O.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5473
5576
|
});
|
|
5474
5577
|
}, h = function(l) {
|
|
5475
|
-
return
|
|
5476
|
-
return A.test(m) ? "xn--" +
|
|
5578
|
+
return ke(l, function(m) {
|
|
5579
|
+
return A.test(m) ? "xn--" + b(m) : m;
|
|
5477
5580
|
});
|
|
5478
5581
|
}, N = {
|
|
5479
5582
|
/**
|
|
@@ -5490,11 +5593,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5490
5593
|
* @type Object
|
|
5491
5594
|
*/
|
|
5492
5595
|
ucs2: {
|
|
5493
|
-
decode:
|
|
5494
|
-
encode:
|
|
5596
|
+
decode: Fe,
|
|
5597
|
+
encode: Ze
|
|
5495
5598
|
},
|
|
5496
5599
|
decode: j,
|
|
5497
|
-
encode:
|
|
5600
|
+
encode: b,
|
|
5498
5601
|
toASCII: h,
|
|
5499
5602
|
toUnicode: a
|
|
5500
5603
|
}, M = {};
|
|
@@ -5504,20 +5607,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5504
5607
|
}
|
|
5505
5608
|
function W(f) {
|
|
5506
5609
|
for (var l = "", m = 0, R = f.length; m < R; ) {
|
|
5507
|
-
var
|
|
5508
|
-
if (
|
|
5509
|
-
l += String.fromCharCode(
|
|
5510
|
-
else if (
|
|
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) {
|
|
5511
5614
|
if (R - m >= 6) {
|
|
5512
5615
|
var q = parseInt(f.substr(m + 4, 2), 16);
|
|
5513
|
-
l += String.fromCharCode((
|
|
5616
|
+
l += String.fromCharCode((E & 31) << 6 | q & 63);
|
|
5514
5617
|
} else
|
|
5515
5618
|
l += f.substr(m, 6);
|
|
5516
5619
|
m += 6;
|
|
5517
|
-
} else if (
|
|
5620
|
+
} else if (E >= 224) {
|
|
5518
5621
|
if (R - m >= 9) {
|
|
5519
|
-
var U = parseInt(f.substr(m + 4, 2), 16),
|
|
5520
|
-
l += String.fromCharCode((
|
|
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);
|
|
5521
5624
|
} else
|
|
5522
5625
|
l += f.substr(m, 9);
|
|
5523
5626
|
m += 9;
|
|
@@ -5528,49 +5631,49 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5528
5631
|
}
|
|
5529
5632
|
function G(f, l) {
|
|
5530
5633
|
function m(R) {
|
|
5531
|
-
var
|
|
5532
|
-
return
|
|
5634
|
+
var E = W(R);
|
|
5635
|
+
return E.match(l.UNRESERVED) ? E : R;
|
|
5533
5636
|
}
|
|
5534
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;
|
|
5535
5638
|
}
|
|
5536
|
-
function
|
|
5639
|
+
function re(f) {
|
|
5537
5640
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5538
5641
|
}
|
|
5539
5642
|
function he(f, l) {
|
|
5540
|
-
var m = f.match(l.IPV4ADDRESS) || [], R = T(m, 2),
|
|
5541
|
-
return
|
|
5542
|
-
}
|
|
5543
|
-
function
|
|
5544
|
-
var m = f.match(l.IPV6ADDRESS) || [], R = T(m, 3),
|
|
5545
|
-
if (
|
|
5546
|
-
for (var U =
|
|
5547
|
-
ae[ee] = B[ee] ||
|
|
5548
|
-
|
|
5549
|
-
var Se = ae.reduce(function(fe, $e,
|
|
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) {
|
|
5550
5653
|
if (!$e || $e === "0") {
|
|
5551
|
-
var
|
|
5552
|
-
|
|
5654
|
+
var ve = fe[fe.length - 1];
|
|
5655
|
+
ve && ve.index + ve.length === Ie ? ve.length++ : fe.push({ index: Ie, length: 1 });
|
|
5553
5656
|
}
|
|
5554
5657
|
return fe;
|
|
5555
5658
|
}, []), ge = Se.sort(function(fe, $e) {
|
|
5556
5659
|
return $e.length - fe.length;
|
|
5557
5660
|
})[0], ye = void 0;
|
|
5558
5661
|
if (ge && ge.length > 1) {
|
|
5559
|
-
var
|
|
5560
|
-
ye =
|
|
5662
|
+
var ze = ae.slice(0, ge.index), Ne = ae.slice(ge.index + ge.length);
|
|
5663
|
+
ye = ze.join(":") + "::" + Ne.join(":");
|
|
5561
5664
|
} else
|
|
5562
5665
|
ye = ae.join(":");
|
|
5563
5666
|
return q && (ye += "%" + q), ye;
|
|
5564
5667
|
} else
|
|
5565
5668
|
return f;
|
|
5566
5669
|
}
|
|
5567
|
-
var
|
|
5670
|
+
var Xe = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, et = "".match(/(){0}/)[1] === void 0;
|
|
5568
5671
|
function de(f) {
|
|
5569
5672
|
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = l.iri !== !1 ? _ : p;
|
|
5570
5673
|
l.reference === "suffix" && (f = (l.scheme ? l.scheme + ":" : "") + "//" + f);
|
|
5571
|
-
var
|
|
5572
|
-
if (
|
|
5573
|
-
|
|
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.");
|
|
5574
5677
|
var q = M[(l.scheme || m.scheme || "").toLowerCase()];
|
|
5575
5678
|
if (!l.unicodeSupport && (!q || !q.unicodeSupport)) {
|
|
5576
5679
|
if (m.host && (l.domainHost || q && q.domainHost))
|
|
@@ -5587,25 +5690,25 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5587
5690
|
m.error = m.error || "URI can not be parsed.";
|
|
5588
5691
|
return m;
|
|
5589
5692
|
}
|
|
5590
|
-
function
|
|
5693
|
+
function tt(f, l) {
|
|
5591
5694
|
var m = l.iri !== !1 ? _ : p, R = [];
|
|
5592
|
-
return f.userinfo !== void 0 && (R.push(f.userinfo), R.push("@")), f.host !== void 0 && R.push(
|
|
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) {
|
|
5593
5696
|
return "[" + q + (U ? "%25" + U : "") + "]";
|
|
5594
5697
|
})), (typeof f.port == "number" || typeof f.port == "string") && (R.push(":"), R.push(String(f.port))), R.length ? R.join("") : void 0;
|
|
5595
5698
|
}
|
|
5596
|
-
var
|
|
5699
|
+
var qe = /^\.\.?\//, Ue = /^\/\.(\/|$)/, xe = /^\/\.\.(\/|$)/, rt = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5597
5700
|
function me(f) {
|
|
5598
5701
|
for (var l = []; f.length; )
|
|
5599
|
-
if (f.match(
|
|
5600
|
-
f = f.replace(
|
|
5702
|
+
if (f.match(qe))
|
|
5703
|
+
f = f.replace(qe, "");
|
|
5704
|
+
else if (f.match(Ue))
|
|
5705
|
+
f = f.replace(Ue, "/");
|
|
5601
5706
|
else if (f.match(xe))
|
|
5602
|
-
f = f.replace(xe, "/");
|
|
5603
|
-
else if (f.match(Ve))
|
|
5604
|
-
f = f.replace(Ve, "/"), l.pop();
|
|
5707
|
+
f = f.replace(xe, "/"), l.pop();
|
|
5605
5708
|
else if (f === "." || f === "..")
|
|
5606
5709
|
f = "";
|
|
5607
5710
|
else {
|
|
5608
|
-
var m = f.match(
|
|
5711
|
+
var m = f.match(rt);
|
|
5609
5712
|
if (m) {
|
|
5610
5713
|
var R = m[0];
|
|
5611
5714
|
f = f.slice(R.length), l.push(R);
|
|
@@ -5615,44 +5718,44 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5615
5718
|
return l.join("");
|
|
5616
5719
|
}
|
|
5617
5720
|
function le(f) {
|
|
5618
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = l.iri ? _ : p, R = [],
|
|
5619
|
-
if (
|
|
5620
|
-
if (l.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)
|
|
5621
5724
|
try {
|
|
5622
5725
|
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5623
|
-
} catch (
|
|
5624
|
-
f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " +
|
|
5726
|
+
} catch (Q) {
|
|
5727
|
+
f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + Q;
|
|
5625
5728
|
}
|
|
5626
5729
|
}
|
|
5627
5730
|
G(f, m), l.reference !== "suffix" && f.scheme && (R.push(f.scheme), R.push(":"));
|
|
5628
|
-
var q =
|
|
5731
|
+
var q = tt(f, l);
|
|
5629
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) {
|
|
5630
5733
|
var U = f.path;
|
|
5631
|
-
!l.absolutePath && (!
|
|
5734
|
+
!l.absolutePath && (!E || !E.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), R.push(U);
|
|
5632
5735
|
}
|
|
5633
5736
|
return f.query !== void 0 && (R.push("?"), R.push(f.query)), f.fragment !== void 0 && (R.push("#"), R.push(f.fragment)), R.join("");
|
|
5634
5737
|
}
|
|
5635
|
-
function
|
|
5636
|
-
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3],
|
|
5637
|
-
return R || (f = de(le(f, m), m), l = de(le(l, m), m)), m = m || {}, !m.tolerant && l.scheme ? (
|
|
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;
|
|
5638
5741
|
}
|
|
5639
|
-
function
|
|
5742
|
+
function nt(f, l, m) {
|
|
5640
5743
|
var R = d({ scheme: "null" }, m);
|
|
5641
|
-
return le(
|
|
5744
|
+
return le(He(de(f, R), de(l, R), R, !0), R);
|
|
5642
5745
|
}
|
|
5643
|
-
function
|
|
5746
|
+
function Ce(f, l) {
|
|
5644
5747
|
return typeof f == "string" ? f = le(de(f, l), l) : i(f) === "object" && (f = de(le(f, l), l)), f;
|
|
5645
5748
|
}
|
|
5646
|
-
function
|
|
5749
|
+
function st(f, l, m) {
|
|
5647
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;
|
|
5648
5751
|
}
|
|
5649
|
-
function
|
|
5752
|
+
function lt(f, l) {
|
|
5650
5753
|
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE : _.ESCAPE, L);
|
|
5651
5754
|
}
|
|
5652
5755
|
function pe(f, l) {
|
|
5653
5756
|
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED : _.PCT_ENCODED, W);
|
|
5654
5757
|
}
|
|
5655
|
-
var
|
|
5758
|
+
var Oe = {
|
|
5656
5759
|
scheme: "http",
|
|
5657
5760
|
domainHost: !0,
|
|
5658
5761
|
parse: function(l, m) {
|
|
@@ -5662,50 +5765,50 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5662
5765
|
var R = String(l.scheme).toLowerCase() === "https";
|
|
5663
5766
|
return (l.port === (R ? 443 : 80) || l.port === "") && (l.port = void 0), l.path || (l.path = "/"), l;
|
|
5664
5767
|
}
|
|
5665
|
-
},
|
|
5768
|
+
}, jt = {
|
|
5666
5769
|
scheme: "https",
|
|
5667
|
-
domainHost:
|
|
5668
|
-
parse:
|
|
5669
|
-
serialize:
|
|
5770
|
+
domainHost: Oe.domainHost,
|
|
5771
|
+
parse: Oe.parse,
|
|
5772
|
+
serialize: Oe.serialize
|
|
5670
5773
|
};
|
|
5671
|
-
function
|
|
5774
|
+
function At(f) {
|
|
5672
5775
|
return typeof f.secure == "boolean" ? f.secure : String(f.scheme).toLowerCase() === "wss";
|
|
5673
5776
|
}
|
|
5674
|
-
var
|
|
5777
|
+
var it = {
|
|
5675
5778
|
scheme: "ws",
|
|
5676
5779
|
domainHost: !0,
|
|
5677
5780
|
parse: function(l, m) {
|
|
5678
5781
|
var R = l;
|
|
5679
|
-
return R.secure =
|
|
5782
|
+
return R.secure = At(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
|
|
5680
5783
|
},
|
|
5681
5784
|
serialize: function(l, m) {
|
|
5682
|
-
if ((l.port === (
|
|
5683
|
-
var R = l.resourceName.split("?"),
|
|
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];
|
|
5684
5787
|
l.path = q && q !== "/" ? q : void 0, l.query = U, l.resourceName = void 0;
|
|
5685
5788
|
}
|
|
5686
5789
|
return l.fragment = void 0, l;
|
|
5687
5790
|
}
|
|
5688
|
-
},
|
|
5791
|
+
}, Dt = {
|
|
5689
5792
|
scheme: "wss",
|
|
5690
|
-
domainHost:
|
|
5691
|
-
parse:
|
|
5692
|
-
serialize:
|
|
5693
|
-
},
|
|
5694
|
-
function
|
|
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) {
|
|
5695
5798
|
var l = W(f);
|
|
5696
|
-
return l.match(
|
|
5799
|
+
return l.match(mr) ? l : f;
|
|
5697
5800
|
}
|
|
5698
|
-
var
|
|
5801
|
+
var Lt = {
|
|
5699
5802
|
scheme: "mailto",
|
|
5700
5803
|
parse: function(l, m) {
|
|
5701
|
-
var R = l,
|
|
5804
|
+
var R = l, E = R.to = R.path ? R.path.split(",") : [];
|
|
5702
5805
|
if (R.path = void 0, R.query) {
|
|
5703
|
-
for (var q = !1, U = {},
|
|
5704
|
-
var B =
|
|
5806
|
+
for (var q = !1, U = {}, Q = R.query.split("&"), Z = 0, ne = Q.length; Z < ne; ++Z) {
|
|
5807
|
+
var B = Q[Z].split("=");
|
|
5705
5808
|
switch (B[0]) {
|
|
5706
5809
|
case "to":
|
|
5707
|
-
for (var
|
|
5708
|
-
|
|
5810
|
+
for (var Y = B[1].split(","), se = 0, V = Y.length; se < V; ++se)
|
|
5811
|
+
E.push(Y[se]);
|
|
5709
5812
|
break;
|
|
5710
5813
|
case "subject":
|
|
5711
5814
|
R.subject = pe(B[1], m);
|
|
@@ -5721,8 +5824,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5721
5824
|
q && (R.headers = U);
|
|
5722
5825
|
}
|
|
5723
5826
|
R.query = void 0;
|
|
5724
|
-
for (var X = 0, ae =
|
|
5725
|
-
var ee =
|
|
5827
|
+
for (var X = 0, ae = E.length; X < ae; ++X) {
|
|
5828
|
+
var ee = E[X].split("@");
|
|
5726
5829
|
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
5727
5830
|
ee[1] = pe(ee[1], m).toLowerCase();
|
|
5728
5831
|
else
|
|
@@ -5731,60 +5834,60 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5731
5834
|
} catch (Se) {
|
|
5732
5835
|
R.error = R.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5733
5836
|
}
|
|
5734
|
-
|
|
5837
|
+
E[X] = ee.join("@");
|
|
5735
5838
|
}
|
|
5736
5839
|
return R;
|
|
5737
5840
|
},
|
|
5738
5841
|
serialize: function(l, m) {
|
|
5739
|
-
var R = l,
|
|
5740
|
-
if (
|
|
5741
|
-
for (var q = 0, U =
|
|
5742
|
-
var
|
|
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);
|
|
5743
5846
|
try {
|
|
5744
5847
|
B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
|
|
5745
5848
|
} catch (X) {
|
|
5746
5849
|
R.error = R.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5747
5850
|
}
|
|
5748
|
-
|
|
5851
|
+
E[q] = ne + "@" + B;
|
|
5749
5852
|
}
|
|
5750
|
-
R.path =
|
|
5853
|
+
R.path = E.join(",");
|
|
5751
5854
|
}
|
|
5752
|
-
var
|
|
5753
|
-
l.subject && (
|
|
5754
|
-
var
|
|
5755
|
-
for (var V in
|
|
5756
|
-
|
|
5757
|
-
return
|
|
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;
|
|
5758
5861
|
}
|
|
5759
|
-
},
|
|
5862
|
+
}, yr = /^([^\:]+)\:(.*)/, qt = {
|
|
5760
5863
|
scheme: "urn",
|
|
5761
5864
|
parse: function(l, m) {
|
|
5762
|
-
var R = l.path && l.path.match(
|
|
5865
|
+
var R = l.path && l.path.match(yr), E = l;
|
|
5763
5866
|
if (R) {
|
|
5764
|
-
var q = m.scheme ||
|
|
5765
|
-
|
|
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));
|
|
5766
5869
|
} else
|
|
5767
|
-
|
|
5768
|
-
return
|
|
5870
|
+
E.error = E.error || "URN can not be parsed.";
|
|
5871
|
+
return E;
|
|
5769
5872
|
},
|
|
5770
5873
|
serialize: function(l, m) {
|
|
5771
|
-
var R = m.scheme || l.scheme || "urn",
|
|
5874
|
+
var R = m.scheme || l.scheme || "urn", E = l.nid, q = R + ":" + (m.nid || E), U = M[q];
|
|
5772
5875
|
U && (l = U.serialize(l, m));
|
|
5773
|
-
var
|
|
5774
|
-
return
|
|
5876
|
+
var Q = l, Z = l.nss;
|
|
5877
|
+
return Q.path = (E || m.nid) + ":" + Z, Q;
|
|
5775
5878
|
}
|
|
5776
|
-
},
|
|
5879
|
+
}, $r = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
5777
5880
|
scheme: "urn:uuid",
|
|
5778
5881
|
parse: function(l, m) {
|
|
5779
5882
|
var R = l;
|
|
5780
|
-
return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match(
|
|
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;
|
|
5781
5884
|
},
|
|
5782
5885
|
serialize: function(l, m) {
|
|
5783
5886
|
var R = l;
|
|
5784
5887
|
return R.nss = (l.uuid || "").toLowerCase(), R;
|
|
5785
5888
|
}
|
|
5786
5889
|
};
|
|
5787
|
-
M[
|
|
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 });
|
|
5788
5891
|
});
|
|
5789
5892
|
})(uri_all, uri_all.exports);
|
|
5790
5893
|
var uri_allExports = uri_all.exports;
|
|
@@ -5812,7 +5915,7 @@ uri$1.default = uri;
|
|
|
5812
5915
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5813
5916
|
return r.CodeGen;
|
|
5814
5917
|
} });
|
|
5815
|
-
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,
|
|
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);
|
|
5816
5919
|
C.code = "new RegExp";
|
|
5817
5920
|
const S = ["removeAdditional", "useDefaults", "coerceTypes"], k = /* @__PURE__ */ new Set([
|
|
5818
5921
|
"validate",
|
|
@@ -5850,71 +5953,71 @@ uri$1.default = uri;
|
|
|
5850
5953
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5851
5954
|
}, y = 200;
|
|
5852
5955
|
function P(F) {
|
|
5853
|
-
var
|
|
5854
|
-
const
|
|
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;
|
|
5855
5958
|
return {
|
|
5856
|
-
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h :
|
|
5857
|
-
strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M :
|
|
5858
|
-
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W :
|
|
5859
|
-
strictTuples: (he = (
|
|
5860
|
-
strictRequired: (
|
|
5861
|
-
code: F.code ? { ...F.code, optimize:
|
|
5862
|
-
loopRequired: (
|
|
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,
|
|
5863
5966
|
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : y,
|
|
5864
|
-
meta: (
|
|
5865
|
-
messages: (
|
|
5866
|
-
inlineRefs: (
|
|
5867
|
-
schemaId: (
|
|
5868
|
-
addUsedSchema: (
|
|
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,
|
|
5869
5972
|
validateSchema: (me = F.validateSchema) !== null && me !== void 0 ? me : !0,
|
|
5870
5973
|
validateFormats: (le = F.validateFormats) !== null && le !== void 0 ? le : !0,
|
|
5871
|
-
unicodeRegExp: (
|
|
5872
|
-
int32range: (
|
|
5873
|
-
uriResolver:
|
|
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
|
|
5874
5977
|
};
|
|
5875
5978
|
}
|
|
5876
5979
|
class I {
|
|
5877
|
-
constructor(
|
|
5878
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(),
|
|
5879
|
-
const { es5: j, lines:
|
|
5880
|
-
this.scope = new c.ValueScope({ scope: {}, prefixes: k, es5: j, lines:
|
|
5881
|
-
const a =
|
|
5882
|
-
|
|
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;
|
|
5883
5986
|
}
|
|
5884
5987
|
_addVocabularies() {
|
|
5885
5988
|
this.addKeyword("$async");
|
|
5886
5989
|
}
|
|
5887
5990
|
_addDefaultMetaSchema() {
|
|
5888
|
-
const { $data:
|
|
5991
|
+
const { $data: w, meta: j, schemaId: b } = this.opts;
|
|
5889
5992
|
let a = _;
|
|
5890
|
-
|
|
5993
|
+
b === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && w && this.addMetaSchema(a, a[b], !1);
|
|
5891
5994
|
}
|
|
5892
5995
|
defaultMeta() {
|
|
5893
|
-
const { meta:
|
|
5894
|
-
return this.opts.defaultMeta = typeof
|
|
5895
|
-
}
|
|
5896
|
-
validate(
|
|
5897
|
-
let
|
|
5898
|
-
if (typeof
|
|
5899
|
-
if (
|
|
5900
|
-
throw new Error(`no schema with key or ref "${
|
|
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}"`);
|
|
5901
6004
|
} else
|
|
5902
|
-
|
|
5903
|
-
const a =
|
|
5904
|
-
return "$async" in
|
|
6005
|
+
b = this.compile(w);
|
|
6006
|
+
const a = b(j);
|
|
6007
|
+
return "$async" in b || (this.errors = b.errors), a;
|
|
5905
6008
|
}
|
|
5906
|
-
compile(
|
|
5907
|
-
const
|
|
5908
|
-
return
|
|
6009
|
+
compile(w, j) {
|
|
6010
|
+
const b = this._addSchema(w, j);
|
|
6011
|
+
return b.validate || this._compileSchemaEnv(b);
|
|
5909
6012
|
}
|
|
5910
|
-
compileAsync(
|
|
6013
|
+
compileAsync(w, j) {
|
|
5911
6014
|
if (typeof this.opts.loadSchema != "function")
|
|
5912
6015
|
throw new Error("options.loadSchema should be a function");
|
|
5913
|
-
const { loadSchema:
|
|
5914
|
-
return a.call(this,
|
|
5915
|
-
async function a(G,
|
|
6016
|
+
const { loadSchema: b } = this.opts;
|
|
6017
|
+
return a.call(this, w, j);
|
|
6018
|
+
async function a(G, re) {
|
|
5916
6019
|
await h.call(this, G.$schema);
|
|
5917
|
-
const he = this._addSchema(G,
|
|
6020
|
+
const he = this._addSchema(G, re);
|
|
5918
6021
|
return he.validate || N.call(this, he);
|
|
5919
6022
|
}
|
|
5920
6023
|
async function h(G) {
|
|
@@ -5923,61 +6026,61 @@ uri$1.default = uri;
|
|
|
5923
6026
|
async function N(G) {
|
|
5924
6027
|
try {
|
|
5925
6028
|
return this._compileSchemaEnv(G);
|
|
5926
|
-
} catch (
|
|
5927
|
-
if (!(
|
|
5928
|
-
throw
|
|
5929
|
-
return M.call(this,
|
|
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);
|
|
5930
6033
|
}
|
|
5931
6034
|
}
|
|
5932
|
-
function M({ missingSchema: G, missingRef:
|
|
6035
|
+
function M({ missingSchema: G, missingRef: re }) {
|
|
5933
6036
|
if (this.refs[G])
|
|
5934
|
-
throw new Error(`AnySchema ${G} is loaded but ${
|
|
6037
|
+
throw new Error(`AnySchema ${G} is loaded but ${re} cannot be resolved`);
|
|
5935
6038
|
}
|
|
5936
6039
|
async function L(G) {
|
|
5937
|
-
const
|
|
5938
|
-
this.refs[G] || await h.call(this,
|
|
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);
|
|
5939
6042
|
}
|
|
5940
6043
|
async function W(G) {
|
|
5941
|
-
const
|
|
5942
|
-
if (
|
|
5943
|
-
return
|
|
6044
|
+
const re = this._loading[G];
|
|
6045
|
+
if (re)
|
|
6046
|
+
return re;
|
|
5944
6047
|
try {
|
|
5945
|
-
return await (this._loading[G] =
|
|
6048
|
+
return await (this._loading[G] = b(G));
|
|
5946
6049
|
} finally {
|
|
5947
6050
|
delete this._loading[G];
|
|
5948
6051
|
}
|
|
5949
6052
|
}
|
|
5950
6053
|
}
|
|
5951
6054
|
// Adds schema to the instance
|
|
5952
|
-
addSchema(
|
|
5953
|
-
if (Array.isArray(
|
|
5954
|
-
for (const N of
|
|
5955
|
-
this.addSchema(N, void 0,
|
|
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);
|
|
5956
6059
|
return this;
|
|
5957
6060
|
}
|
|
5958
6061
|
let h;
|
|
5959
|
-
if (typeof
|
|
6062
|
+
if (typeof w == "object") {
|
|
5960
6063
|
const { schemaId: N } = this.opts;
|
|
5961
|
-
if (h =
|
|
6064
|
+
if (h = w[N], h !== void 0 && typeof h != "string")
|
|
5962
6065
|
throw new Error(`schema ${N} must be string`);
|
|
5963
6066
|
}
|
|
5964
|
-
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(
|
|
6067
|
+
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(w, b, j, a, !0), this;
|
|
5965
6068
|
}
|
|
5966
6069
|
// Add schema that will be used to validate other schemas
|
|
5967
6070
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5968
|
-
addMetaSchema(
|
|
5969
|
-
return this.addSchema(
|
|
6071
|
+
addMetaSchema(w, j, b = this.opts.validateSchema) {
|
|
6072
|
+
return this.addSchema(w, j, !0, b), this;
|
|
5970
6073
|
}
|
|
5971
6074
|
// Validate schema against its meta-schema
|
|
5972
|
-
validateSchema(
|
|
5973
|
-
if (typeof
|
|
6075
|
+
validateSchema(w, j) {
|
|
6076
|
+
if (typeof w == "boolean")
|
|
5974
6077
|
return !0;
|
|
5975
|
-
let
|
|
5976
|
-
if (
|
|
6078
|
+
let b;
|
|
6079
|
+
if (b = w.$schema, b !== void 0 && typeof b != "string")
|
|
5977
6080
|
throw new Error("$schema must be a string");
|
|
5978
|
-
if (
|
|
6081
|
+
if (b = b || this.opts.defaultMeta || this.defaultMeta(), !b)
|
|
5979
6082
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5980
|
-
const a = this.validate(
|
|
6083
|
+
const a = this.validate(b, w);
|
|
5981
6084
|
if (!a && j) {
|
|
5982
6085
|
const h = "schema is invalid: " + this.errorsText();
|
|
5983
6086
|
if (this.opts.validateSchema === "log")
|
|
@@ -5989,15 +6092,15 @@ uri$1.default = uri;
|
|
|
5989
6092
|
}
|
|
5990
6093
|
// Get compiled schema by `key` or `ref`.
|
|
5991
6094
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
5992
|
-
getSchema(
|
|
6095
|
+
getSchema(w) {
|
|
5993
6096
|
let j;
|
|
5994
|
-
for (; typeof (j =
|
|
5995
|
-
|
|
6097
|
+
for (; typeof (j = v.call(this, w)) == "string"; )
|
|
6098
|
+
w = j;
|
|
5996
6099
|
if (j === void 0) {
|
|
5997
|
-
const { schemaId:
|
|
5998
|
-
if (j = o.resolveSchema.call(this, a,
|
|
6100
|
+
const { schemaId: b } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: b });
|
|
6101
|
+
if (j = o.resolveSchema.call(this, a, w), !j)
|
|
5999
6102
|
return;
|
|
6000
|
-
this.refs[
|
|
6103
|
+
this.refs[w] = j;
|
|
6001
6104
|
}
|
|
6002
6105
|
return j.validate || this._compileSchemaEnv(j);
|
|
6003
6106
|
}
|
|
@@ -6005,141 +6108,141 @@ uri$1.default = uri;
|
|
|
6005
6108
|
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
6006
6109
|
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
6007
6110
|
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
6008
|
-
removeSchema(
|
|
6009
|
-
if (
|
|
6010
|
-
return this._removeAllSchemas(this.schemas,
|
|
6011
|
-
switch (typeof
|
|
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) {
|
|
6012
6115
|
case "undefined":
|
|
6013
6116
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
6014
6117
|
case "string": {
|
|
6015
|
-
const j =
|
|
6016
|
-
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[
|
|
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;
|
|
6017
6120
|
}
|
|
6018
6121
|
case "object": {
|
|
6019
|
-
const j =
|
|
6122
|
+
const j = w;
|
|
6020
6123
|
this._cache.delete(j);
|
|
6021
|
-
let
|
|
6022
|
-
return
|
|
6124
|
+
let b = w[this.opts.schemaId];
|
|
6125
|
+
return b && (b = (0, d.normalizeId)(b), delete this.schemas[b], delete this.refs[b]), this;
|
|
6023
6126
|
}
|
|
6024
6127
|
default:
|
|
6025
6128
|
throw new Error("ajv.removeSchema: invalid parameter");
|
|
6026
6129
|
}
|
|
6027
6130
|
}
|
|
6028
6131
|
// add "vocabulary" - a collection of keywords
|
|
6029
|
-
addVocabulary(
|
|
6030
|
-
for (const j of
|
|
6132
|
+
addVocabulary(w) {
|
|
6133
|
+
for (const j of w)
|
|
6031
6134
|
this.addKeyword(j);
|
|
6032
6135
|
return this;
|
|
6033
6136
|
}
|
|
6034
|
-
addKeyword(
|
|
6035
|
-
let
|
|
6036
|
-
if (typeof
|
|
6037
|
-
|
|
6038
|
-
else if (typeof
|
|
6039
|
-
if (j =
|
|
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)
|
|
6040
6143
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6041
6144
|
} else
|
|
6042
6145
|
throw new Error("invalid addKeywords parameters");
|
|
6043
|
-
if (oe.call(this,
|
|
6044
|
-
return (0, p.eachItem)(
|
|
6045
|
-
|
|
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);
|
|
6046
6149
|
const a = {
|
|
6047
6150
|
...j,
|
|
6048
6151
|
type: (0, u.getJSONTypes)(j.type),
|
|
6049
6152
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6050
6153
|
};
|
|
6051
|
-
return (0, p.eachItem)(
|
|
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;
|
|
6052
6155
|
}
|
|
6053
|
-
getKeyword(
|
|
6054
|
-
const j = this.RULES.all[
|
|
6156
|
+
getKeyword(w) {
|
|
6157
|
+
const j = this.RULES.all[w];
|
|
6055
6158
|
return typeof j == "object" ? j.definition : !!j;
|
|
6056
6159
|
}
|
|
6057
6160
|
// Remove keyword
|
|
6058
|
-
removeKeyword(
|
|
6161
|
+
removeKeyword(w) {
|
|
6059
6162
|
const { RULES: j } = this;
|
|
6060
|
-
delete j.keywords[
|
|
6061
|
-
for (const
|
|
6062
|
-
const a =
|
|
6063
|
-
a >= 0 &&
|
|
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);
|
|
6064
6167
|
}
|
|
6065
6168
|
return this;
|
|
6066
6169
|
}
|
|
6067
6170
|
// Add format
|
|
6068
|
-
addFormat(
|
|
6069
|
-
return typeof j == "string" && (j = new RegExp(j)), this.formats[
|
|
6171
|
+
addFormat(w, j) {
|
|
6172
|
+
return typeof j == "string" && (j = new RegExp(j)), this.formats[w] = j, this;
|
|
6070
6173
|
}
|
|
6071
|
-
errorsText(
|
|
6072
|
-
return !
|
|
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);
|
|
6073
6176
|
}
|
|
6074
|
-
$dataMetaSchema(
|
|
6075
|
-
const
|
|
6076
|
-
|
|
6177
|
+
$dataMetaSchema(w, j) {
|
|
6178
|
+
const b = this.RULES.all;
|
|
6179
|
+
w = JSON.parse(JSON.stringify(w));
|
|
6077
6180
|
for (const a of j) {
|
|
6078
6181
|
const h = a.split("/").slice(1);
|
|
6079
|
-
let N =
|
|
6182
|
+
let N = w;
|
|
6080
6183
|
for (const M of h)
|
|
6081
6184
|
N = N[M];
|
|
6082
|
-
for (const M in
|
|
6083
|
-
const L =
|
|
6185
|
+
for (const M in b) {
|
|
6186
|
+
const L = b[M];
|
|
6084
6187
|
if (typeof L != "object")
|
|
6085
6188
|
continue;
|
|
6086
6189
|
const { $data: W } = L.definition, G = N[M];
|
|
6087
|
-
W && G && (N[M] =
|
|
6190
|
+
W && G && (N[M] = Me(G));
|
|
6088
6191
|
}
|
|
6089
6192
|
}
|
|
6090
|
-
return
|
|
6193
|
+
return w;
|
|
6091
6194
|
}
|
|
6092
|
-
_removeAllSchemas(
|
|
6093
|
-
for (const
|
|
6094
|
-
const a =
|
|
6095
|
-
(!j || j.test(
|
|
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]));
|
|
6096
6199
|
}
|
|
6097
6200
|
}
|
|
6098
|
-
_addSchema(
|
|
6201
|
+
_addSchema(w, j, b, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6099
6202
|
let N;
|
|
6100
6203
|
const { schemaId: M } = this.opts;
|
|
6101
|
-
if (typeof
|
|
6102
|
-
N =
|
|
6204
|
+
if (typeof w == "object")
|
|
6205
|
+
N = w[M];
|
|
6103
6206
|
else {
|
|
6104
6207
|
if (this.opts.jtd)
|
|
6105
6208
|
throw new Error("schema must be object");
|
|
6106
|
-
if (typeof
|
|
6209
|
+
if (typeof w != "boolean")
|
|
6107
6210
|
throw new Error("schema must be object or boolean");
|
|
6108
6211
|
}
|
|
6109
|
-
let L = this._cache.get(
|
|
6212
|
+
let L = this._cache.get(w);
|
|
6110
6213
|
if (L !== void 0)
|
|
6111
6214
|
return L;
|
|
6112
|
-
|
|
6113
|
-
const W = d.getSchemaRefs.call(this,
|
|
6114
|
-
return L = new o.SchemaEnv({ schema:
|
|
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;
|
|
6115
6218
|
}
|
|
6116
|
-
_checkUnique(
|
|
6117
|
-
if (this.schemas[
|
|
6118
|
-
throw new Error(`schema with key or id "${
|
|
6219
|
+
_checkUnique(w) {
|
|
6220
|
+
if (this.schemas[w] || this.refs[w])
|
|
6221
|
+
throw new Error(`schema with key or id "${w}" already exists`);
|
|
6119
6222
|
}
|
|
6120
|
-
_compileSchemaEnv(
|
|
6121
|
-
if (
|
|
6223
|
+
_compileSchemaEnv(w) {
|
|
6224
|
+
if (w.meta ? this._compileMetaSchema(w) : o.compileSchema.call(this, w), !w.validate)
|
|
6122
6225
|
throw new Error("ajv implementation error");
|
|
6123
|
-
return
|
|
6226
|
+
return w.validate;
|
|
6124
6227
|
}
|
|
6125
|
-
_compileMetaSchema(
|
|
6228
|
+
_compileMetaSchema(w) {
|
|
6126
6229
|
const j = this.opts;
|
|
6127
6230
|
this.opts = this._metaOpts;
|
|
6128
6231
|
try {
|
|
6129
|
-
o.compileSchema.call(this,
|
|
6232
|
+
o.compileSchema.call(this, w);
|
|
6130
6233
|
} finally {
|
|
6131
6234
|
this.opts = j;
|
|
6132
6235
|
}
|
|
6133
6236
|
}
|
|
6134
6237
|
}
|
|
6135
6238
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6136
|
-
function D(F,
|
|
6239
|
+
function D(F, w, j, b = "error") {
|
|
6137
6240
|
for (const a in F) {
|
|
6138
6241
|
const h = a;
|
|
6139
|
-
h in
|
|
6242
|
+
h in w && this.logger[b](`${j}: option ${a}. ${F[h]}`);
|
|
6140
6243
|
}
|
|
6141
6244
|
}
|
|
6142
|
-
function
|
|
6245
|
+
function v(F) {
|
|
6143
6246
|
return F = (0, d.normalizeId)(F), this.schemas[F] || this.refs[F];
|
|
6144
6247
|
}
|
|
6145
6248
|
function O() {
|
|
@@ -6148,39 +6251,39 @@ uri$1.default = uri;
|
|
|
6148
6251
|
if (Array.isArray(F))
|
|
6149
6252
|
this.addSchema(F);
|
|
6150
6253
|
else
|
|
6151
|
-
for (const
|
|
6152
|
-
this.addSchema(F[
|
|
6254
|
+
for (const w in F)
|
|
6255
|
+
this.addSchema(F[w], w);
|
|
6153
6256
|
}
|
|
6154
6257
|
function A() {
|
|
6155
6258
|
for (const F in this.opts.formats) {
|
|
6156
|
-
const
|
|
6157
|
-
|
|
6259
|
+
const w = this.opts.formats[F];
|
|
6260
|
+
w && this.addFormat(F, w);
|
|
6158
6261
|
}
|
|
6159
6262
|
}
|
|
6160
|
-
function
|
|
6263
|
+
function H(F) {
|
|
6161
6264
|
if (Array.isArray(F)) {
|
|
6162
6265
|
this.addVocabulary(F);
|
|
6163
6266
|
return;
|
|
6164
6267
|
}
|
|
6165
6268
|
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
6166
|
-
for (const
|
|
6167
|
-
const j = F[
|
|
6168
|
-
j.keyword || (j.keyword =
|
|
6269
|
+
for (const w in F) {
|
|
6270
|
+
const j = F[w];
|
|
6271
|
+
j.keyword || (j.keyword = w), this.addKeyword(j);
|
|
6169
6272
|
}
|
|
6170
6273
|
}
|
|
6171
6274
|
function z() {
|
|
6172
6275
|
const F = { ...this.opts };
|
|
6173
|
-
for (const
|
|
6174
|
-
delete F[
|
|
6276
|
+
for (const w of S)
|
|
6277
|
+
delete F[w];
|
|
6175
6278
|
return F;
|
|
6176
6279
|
}
|
|
6177
|
-
const
|
|
6280
|
+
const te = { log() {
|
|
6178
6281
|
}, warn() {
|
|
6179
6282
|
}, error() {
|
|
6180
6283
|
} };
|
|
6181
|
-
function
|
|
6284
|
+
function J(F) {
|
|
6182
6285
|
if (F === !1)
|
|
6183
|
-
return
|
|
6286
|
+
return te;
|
|
6184
6287
|
if (F === void 0)
|
|
6185
6288
|
return console;
|
|
6186
6289
|
if (F.log && F.warn && F.error)
|
|
@@ -6188,48 +6291,48 @@ uri$1.default = uri;
|
|
|
6188
6291
|
throw new Error("logger must implement log, warn and error methods");
|
|
6189
6292
|
}
|
|
6190
6293
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6191
|
-
function oe(F,
|
|
6294
|
+
function oe(F, w) {
|
|
6192
6295
|
const { RULES: j } = this;
|
|
6193
|
-
if ((0, p.eachItem)(F, (
|
|
6194
|
-
if (j.keywords[
|
|
6195
|
-
throw new Error(`Keyword ${
|
|
6196
|
-
if (!ue.test(
|
|
6197
|
-
throw new Error(`Keyword ${
|
|
6198
|
-
}), !!
|
|
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))
|
|
6199
6302
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6200
6303
|
}
|
|
6201
|
-
function
|
|
6202
|
-
var
|
|
6203
|
-
const a =
|
|
6304
|
+
function Te(F, w, j) {
|
|
6305
|
+
var b;
|
|
6306
|
+
const a = w == null ? void 0 : w.post;
|
|
6204
6307
|
if (j && a)
|
|
6205
6308
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6206
6309
|
const { RULES: h } = this;
|
|
6207
6310
|
let N = a ? h.post : h.rules.find(({ type: L }) => L === j);
|
|
6208
|
-
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !
|
|
6311
|
+
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !w)
|
|
6209
6312
|
return;
|
|
6210
6313
|
const M = {
|
|
6211
6314
|
keyword: F,
|
|
6212
6315
|
definition: {
|
|
6213
|
-
...
|
|
6214
|
-
type: (0, u.getJSONTypes)(
|
|
6215
|
-
schemaType: (0, u.getJSONTypes)(
|
|
6316
|
+
...w,
|
|
6317
|
+
type: (0, u.getJSONTypes)(w.type),
|
|
6318
|
+
schemaType: (0, u.getJSONTypes)(w.schemaType)
|
|
6216
6319
|
}
|
|
6217
6320
|
};
|
|
6218
|
-
|
|
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));
|
|
6219
6322
|
}
|
|
6220
|
-
function
|
|
6221
|
-
const
|
|
6222
|
-
|
|
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`));
|
|
6223
6326
|
}
|
|
6224
|
-
function
|
|
6225
|
-
let { metaSchema:
|
|
6226
|
-
|
|
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));
|
|
6227
6330
|
}
|
|
6228
|
-
const
|
|
6331
|
+
const Ze = {
|
|
6229
6332
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6230
6333
|
};
|
|
6231
|
-
function
|
|
6232
|
-
return { anyOf: [F,
|
|
6334
|
+
function Me(F) {
|
|
6335
|
+
return { anyOf: [F, Ze] };
|
|
6233
6336
|
}
|
|
6234
6337
|
})(core$2);
|
|
6235
6338
|
var draft7 = {}, core$1 = {}, id = {};
|
|
@@ -7243,7 +7346,7 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7243
7346
|
}
|
|
7244
7347
|
}
|
|
7245
7348
|
function P(D) {
|
|
7246
|
-
const
|
|
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 });
|
|
7247
7350
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${O}.validate`] : ["string", D, O];
|
|
7248
7351
|
}
|
|
7249
7352
|
function I() {
|
|
@@ -7334,10 +7437,10 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7334
7437
|
for (let I = 0; I < o.length; I++) {
|
|
7335
7438
|
let D = o[I];
|
|
7336
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));
|
|
7337
|
-
const
|
|
7338
|
-
if (typeof
|
|
7440
|
+
const v = (C = D == null ? void 0 : D.properties) === null || C === void 0 ? void 0 : C[c];
|
|
7441
|
+
if (typeof v != "object")
|
|
7339
7442
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);
|
|
7340
|
-
$ = $ && (k || g(D)), y(
|
|
7443
|
+
$ = $ && (k || g(D)), y(v, I);
|
|
7341
7444
|
}
|
|
7342
7445
|
if (!$)
|
|
7343
7446
|
throw new Error(`discriminator: "${c}" must be required`);
|
|
@@ -7349,8 +7452,8 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7349
7452
|
if (I.const)
|
|
7350
7453
|
P(I.const, D);
|
|
7351
7454
|
else if (I.enum)
|
|
7352
|
-
for (const
|
|
7353
|
-
P(
|
|
7455
|
+
for (const v of I.enum)
|
|
7456
|
+
P(v, D);
|
|
7354
7457
|
else
|
|
7355
7458
|
throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`);
|
|
7356
7459
|
}
|
|
@@ -9251,7 +9354,7 @@ function compileBlueprint(e, {
|
|
|
9251
9354
|
var _, T, C, S, k, $, g;
|
|
9252
9355
|
e = {
|
|
9253
9356
|
...e,
|
|
9254
|
-
steps: (e.steps || []).filter(isStepDefinition)
|
|
9357
|
+
steps: (e.steps || []).filter(isStepDefinition).filter(isStepStillSupported)
|
|
9255
9358
|
};
|
|
9256
9359
|
for (const y of e.steps)
|
|
9257
9360
|
typeof y == "object" && y.step === "importFile" && (y.step = "importWxr", console.warn(
|
|
@@ -9364,14 +9467,14 @@ function compileBlueprint(e, {
|
|
|
9364
9467
|
I.setPlayground(y), I.isAsync && I.resolve();
|
|
9365
9468
|
for (const [P, { run: I, step: D }] of Object.entries(p))
|
|
9366
9469
|
try {
|
|
9367
|
-
const
|
|
9368
|
-
n(
|
|
9369
|
-
} catch (
|
|
9370
|
-
throw console.error(
|
|
9470
|
+
const v = await I(y);
|
|
9471
|
+
n(v, D);
|
|
9472
|
+
} catch (v) {
|
|
9473
|
+
throw console.error(v), new Error(
|
|
9371
9474
|
`Error when executing the blueprint step #${P} (${JSON.stringify(
|
|
9372
9475
|
D
|
|
9373
|
-
)}) ${
|
|
9374
|
-
{ cause:
|
|
9476
|
+
)}) ${v instanceof Error ? `: ${v.message}` : v}`,
|
|
9477
|
+
{ cause: v }
|
|
9375
9478
|
);
|
|
9376
9479
|
}
|
|
9377
9480
|
} finally {
|
|
@@ -9419,6 +9522,11 @@ function compilePHPExtensions(e, t) {
|
|
|
9419
9522
|
function isStepDefinition(e) {
|
|
9420
9523
|
return !!(typeof e == "object" && e);
|
|
9421
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
|
+
}
|
|
9422
9530
|
function compileStep(e, {
|
|
9423
9531
|
semaphore: t,
|
|
9424
9532
|
rootProgressTracker: r,
|
|
@@ -9797,7 +9905,7 @@ function proxyClone(e) {
|
|
|
9797
9905
|
}
|
|
9798
9906
|
class Logger extends EventTarget {
|
|
9799
9907
|
constructor(t) {
|
|
9800
|
-
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);
|
|
9801
9909
|
}
|
|
9802
9910
|
/**
|
|
9803
9911
|
* Read the WordPress debug.log file and return its content.
|
|
@@ -9842,6 +9950,18 @@ class Logger extends EventTarget {
|
|
|
9842
9950
|
this.logUnhandledRejection.bind(this)
|
|
9843
9951
|
), this.windowConnected = !0);
|
|
9844
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
|
+
}
|
|
9845
9965
|
/**
|
|
9846
9966
|
* Register a listener for the request.end event and log the data.
|
|
9847
9967
|
* @param UniversalPHP playground instance
|
|
@@ -9923,7 +10043,19 @@ class Logger extends EventTarget {
|
|
|
9923
10043
|
* @returns string[]
|
|
9924
10044
|
*/
|
|
9925
10045
|
getLogs() {
|
|
9926
|
-
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 };
|
|
9927
10059
|
}
|
|
9928
10060
|
}
|
|
9929
10061
|
const logger = new Logger();
|
|
@@ -10048,7 +10180,6 @@ export {
|
|
|
10048
10180
|
runPHPWithOptions,
|
|
10049
10181
|
runSql,
|
|
10050
10182
|
runWpInstallationWizard,
|
|
10051
|
-
setPhpIniEntry,
|
|
10052
10183
|
setPluginProxyURL,
|
|
10053
10184
|
setSiteOptions,
|
|
10054
10185
|
startPlaygroundWeb,
|