@wp-playground/client 0.6.0 → 0.6.2
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 +41 -385
- package/index.d.ts +3 -18
- package/index.js +1029 -1534
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var Nt = (e, t, r) => {
|
|
|
2
2
|
if (!t.has(e))
|
|
3
3
|
throw TypeError("Cannot " + r);
|
|
4
4
|
};
|
|
5
|
-
var H = (e, t, r) => (Nt(e, t, "read from private field"), r ? r.call(e) : t.get(e)),
|
|
5
|
+
var H = (e, t, r) => (Nt(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Z = (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);
|
|
@@ -202,6 +202,16 @@ class ChildProcess extends EventEmitter {
|
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
+
function randomString(e = 36, t = "!@#$%^&*()_+=-[]/.,<>?") {
|
|
206
|
+
const r = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + t;
|
|
207
|
+
let n = "";
|
|
208
|
+
for (let s = e; s > 0; --s)
|
|
209
|
+
n += r[Math.floor(Math.random() * r.length)];
|
|
210
|
+
return n;
|
|
211
|
+
}
|
|
212
|
+
function randomFilename() {
|
|
213
|
+
return randomString(36, "-_");
|
|
214
|
+
}
|
|
205
215
|
function phpVar(e) {
|
|
206
216
|
return `json_decode(base64_decode('${stringToBase64(
|
|
207
217
|
JSON.stringify(e)
|
|
@@ -267,6 +277,47 @@ set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
|
267
277
|
switch_theme( ${phpVar(t)} );
|
|
268
278
|
`
|
|
269
279
|
});
|
|
280
|
+
}, runPHP = async (e, { code: t }) => await e.run({ code: t, throwOnError: !0 }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
281
|
+
await e.unlink(t);
|
|
282
|
+
}, runSql = async (e, { sql: t }, r) => {
|
|
283
|
+
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
284
|
+
const n = `/tmp/${randomFilename()}.sql`;
|
|
285
|
+
await e.writeFile(
|
|
286
|
+
n,
|
|
287
|
+
new Uint8Array(await t.arrayBuffer())
|
|
288
|
+
);
|
|
289
|
+
const s = await e.documentRoot, o = phpVars({ docroot: s, sqlFilename: n }), i = await e.run({
|
|
290
|
+
code: `<?php
|
|
291
|
+
require_once ${o.docroot} . '/wp-load.php';
|
|
292
|
+
|
|
293
|
+
$handle = fopen(${o.sqlFilename}, 'r');
|
|
294
|
+
$buffer = '';
|
|
295
|
+
|
|
296
|
+
global $wpdb;
|
|
297
|
+
|
|
298
|
+
while ($bytes = fgets($handle)) {
|
|
299
|
+
$buffer .= $bytes;
|
|
300
|
+
|
|
301
|
+
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
302
|
+
") {
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
$wpdb->query($buffer);
|
|
307
|
+
$buffer = '';
|
|
308
|
+
}
|
|
309
|
+
`
|
|
310
|
+
});
|
|
311
|
+
return await rm(e, { path: n }), i;
|
|
312
|
+
}, setPhpIniEntry = async (e, { key: t, value: r }) => {
|
|
313
|
+
await e.setPhpIniEntry(t, r);
|
|
314
|
+
}, request = async (e, { request: t }) => {
|
|
315
|
+
const r = await e.request(t);
|
|
316
|
+
if (r.httpStatusCode > 399 || r.httpStatusCode < 200)
|
|
317
|
+
throw console.warn("WordPress response was", { response: r }), new Error(
|
|
318
|
+
`Request failed with status ${r.httpStatusCode}`
|
|
319
|
+
);
|
|
320
|
+
return r;
|
|
270
321
|
}, rewriteWpConfigToDefineConstants = `<?php
|
|
271
322
|
|
|
272
323
|
/**
|
|
@@ -635,522 +686,7 @@ async function rewriteDefineCalls(e, t, r) {
|
|
|
635
686
|
`
|
|
636
687
|
}), await e.readFileAsText("/tmp/code.php");
|
|
637
688
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* This transport delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
642
|
-
*
|
|
643
|
-
* This file isn't actually used. It's just here for reference and development. The actual
|
|
644
|
-
* PHP code used in WordPress is hardcoded copy residing in wordpress.mjs in the _patchWordPressCode
|
|
645
|
-
* function.
|
|
646
|
-
*
|
|
647
|
-
* The reason for calling it Wp_Http_Fetch and not something more natural like
|
|
648
|
-
* Requests_Transport_Fetch is the _get_first_available_transport(). It checks for
|
|
649
|
-
* a class named "Wp_Http_" . $transport_name – which means we must adhere to this
|
|
650
|
-
* hardcoded pattern.
|
|
651
|
-
*/
|
|
652
|
-
class Wp_Http_Fetch_Base
|
|
653
|
-
{
|
|
654
|
-
public $headers = '';
|
|
655
|
-
|
|
656
|
-
public function __construct()
|
|
657
|
-
{
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
public function __destruct()
|
|
661
|
-
{
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
666
|
-
*
|
|
667
|
-
* @TODO Implement handling for more $options such as cookies, filename, auth, etc.
|
|
668
|
-
*
|
|
669
|
-
* @param $url
|
|
670
|
-
* @param $headers
|
|
671
|
-
* @param $data
|
|
672
|
-
* @param $options
|
|
673
|
-
*
|
|
674
|
-
* @return false|string
|
|
675
|
-
*/
|
|
676
|
-
public function request($url, $headers = array(), $data = array(), $options = array())
|
|
677
|
-
{
|
|
678
|
-
// Disable wp-cron requests that are extremely slow in node.js runtime environment.
|
|
679
|
-
// @TODO: Make wp-cron requests faster.
|
|
680
|
-
if (str_contains($url, '/wp-cron.php')) {
|
|
681
|
-
return false;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
if (!empty($data)) {
|
|
685
|
-
$data_format = $options['data_format'];
|
|
686
|
-
if ($data_format === 'query') {
|
|
687
|
-
$url = self::format_get($url, $data);
|
|
688
|
-
$data = '';
|
|
689
|
-
} elseif (!is_string($data)) {
|
|
690
|
-
$data = http_build_query($data, null, '&');
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
$request = json_encode(
|
|
695
|
-
array(
|
|
696
|
-
'type' => 'request',
|
|
697
|
-
'data' => [
|
|
698
|
-
'headers' => $headers,
|
|
699
|
-
'data' => $data,
|
|
700
|
-
'url' => $url,
|
|
701
|
-
'method' => $options['type'],
|
|
702
|
-
]
|
|
703
|
-
)
|
|
704
|
-
);
|
|
705
|
-
|
|
706
|
-
$this->headers = post_message_to_js($request);
|
|
707
|
-
|
|
708
|
-
// Store a file if the request specifies it.
|
|
709
|
-
// Are we sure that \`$this->headers\` includes the body of the response?
|
|
710
|
-
$before_response_body = strpos($this->headers, "\\r\\n\\r\\n");
|
|
711
|
-
if (isset($options['filename']) && $options['filename'] && false !== $before_response_body) {
|
|
712
|
-
$response_body = substr($this->headers, $before_response_body + 4);
|
|
713
|
-
$this->headers = substr($this->headers, 0, $before_response_body);
|
|
714
|
-
file_put_contents($options['filename'], $response_body);
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
return $this->headers;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
public function request_multiple($requests, $options)
|
|
721
|
-
{
|
|
722
|
-
$responses = array();
|
|
723
|
-
$class = get_class($this);
|
|
724
|
-
foreach ($requests as $id => $request) {
|
|
725
|
-
try {
|
|
726
|
-
$handler = new $class();
|
|
727
|
-
$responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']);
|
|
728
|
-
$request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request));
|
|
729
|
-
} catch (Requests_Exception $e) {
|
|
730
|
-
$responses[$id] = $e;
|
|
731
|
-
}
|
|
732
|
-
if (!is_string($responses[$id])) {
|
|
733
|
-
$request['options']['hooks']->dispatch('multiple.request.complete', array(&$responses[$id], $id));
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
return $responses;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
protected static function format_get($url, $data)
|
|
741
|
-
{
|
|
742
|
-
if (!empty($data)) {
|
|
743
|
-
$query = '';
|
|
744
|
-
$url_parts = parse_url($url);
|
|
745
|
-
if (empty($url_parts['query'])) {
|
|
746
|
-
$url_parts['query'] = '';
|
|
747
|
-
} else {
|
|
748
|
-
$query = $url_parts['query'];
|
|
749
|
-
}
|
|
750
|
-
$query .= '&' . http_build_query($data, null, '&');
|
|
751
|
-
$query = trim($query, '&');
|
|
752
|
-
if (empty($url_parts['query'])) {
|
|
753
|
-
$url .= '?' . $query;
|
|
754
|
-
} else {
|
|
755
|
-
$url = str_replace($url_parts['query'], $query, $url);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
return $url;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
public static function test($capabilities = array())
|
|
763
|
-
{
|
|
764
|
-
if (!function_exists('post_message_to_js')) {
|
|
765
|
-
return false;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
return true;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
773
|
-
class Wp_Http_Fetch extends Wp_Http_Fetch_Base implements \\WpOrg\\Requests\\Transport
|
|
774
|
-
{
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
} else {
|
|
778
|
-
class Wp_Http_Fetch extends Wp_Http_Fetch_Base implements Requests_Transport
|
|
779
|
-
{
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
`, transportDummy = `<?php
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
* This transport does not perform any HTTP requests and only exists
|
|
787
|
-
* to prevent the Requests class from complaining about not having any
|
|
788
|
-
* transports.
|
|
789
|
-
*/
|
|
790
|
-
class Requests_Transport_Dummy_Base
|
|
791
|
-
{
|
|
792
|
-
public $headers = '';
|
|
793
|
-
|
|
794
|
-
public function __construct()
|
|
795
|
-
{
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
public function __destruct()
|
|
799
|
-
{
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
public function request($url, $headers = array(), $data = array(), $options = array())
|
|
803
|
-
{
|
|
804
|
-
return false;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
public function request_multiple($requests, $options)
|
|
808
|
-
{
|
|
809
|
-
$responses = array();
|
|
810
|
-
foreach ($requests as $id => $request) {
|
|
811
|
-
$responses[] = false;
|
|
812
|
-
}
|
|
813
|
-
return $responses;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
protected static function format_get($url, $data)
|
|
817
|
-
{
|
|
818
|
-
return $url;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
public static function test($capabilities = array())
|
|
822
|
-
{
|
|
823
|
-
return true;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
828
|
-
class Requests_Transport_Dummy extends Requests_Transport_Dummy_Base implements \\WpOrg\\Requests\\Transport
|
|
829
|
-
{
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
} else {
|
|
833
|
-
class Requests_Transport_Dummy extends Requests_Transport_Dummy_Base implements Requests_Transport
|
|
834
|
-
{
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
`, playgroundMuPlugin = `<?php
|
|
839
|
-
/**
|
|
840
|
-
* Add a notice to wp-login.php offering the username and password.
|
|
841
|
-
*/
|
|
842
|
-
add_action(
|
|
843
|
-
'login_message',
|
|
844
|
-
function () {
|
|
845
|
-
return <<<EOT
|
|
846
|
-
<div class="message info">
|
|
847
|
-
<strong>username:</strong> <code>admin</code><br><strong>password</strong>: <code>password</code>
|
|
848
|
-
</div>
|
|
849
|
-
EOT;
|
|
850
|
-
}
|
|
851
|
-
);
|
|
852
|
-
|
|
853
|
-
/**
|
|
854
|
-
* Because the in-browser Playground doesn't have access to the internet,
|
|
855
|
-
* network-dependent features like directories don't work. Normally, you'll
|
|
856
|
-
* see a confusing message like "An unexpected error occurred." This mu-plugin
|
|
857
|
-
* makes it more clear that the feature is not yet supported.
|
|
858
|
-
*
|
|
859
|
-
* https://github.com/WordPress/wordpress-playground/issues/498
|
|
860
|
-
*
|
|
861
|
-
* Added styling to hide the Popular tags section of the Plugins page
|
|
862
|
-
* and the nonfunctional Try Again button (both Plugins and Themes) that's
|
|
863
|
-
* appended when the message is displayed.
|
|
864
|
-
*
|
|
865
|
-
* https://github.com/WordPress/wordpress-playground/issues/927
|
|
866
|
-
*
|
|
867
|
-
*/
|
|
868
|
-
|
|
869
|
-
add_action('admin_head', function () {
|
|
870
|
-
echo '<style>
|
|
871
|
-
:is(.plugins-popular-tags-wrapper:has(div.networking_err_msg),
|
|
872
|
-
button.button.try-again) {
|
|
873
|
-
display: none;
|
|
874
|
-
}
|
|
875
|
-
</style>';
|
|
876
|
-
});
|
|
877
|
-
|
|
878
|
-
add_action('init', 'networking_disabled');
|
|
879
|
-
function networking_disabled() {
|
|
880
|
-
$networking_err_msg = '<div class="networking_err_msg">Network access is an <a href="https://github.com/WordPress/wordpress-playground/issues/85">experimental, opt-in feature</a>, which means you need to enable it to allow Playground to access the Plugins/Themes directories.
|
|
881
|
-
<p>There are two alternative methods to enable global networking support:</p>
|
|
882
|
-
<ol>
|
|
883
|
-
<li>Using the <a href="https://wordpress.github.io/wordpress-playground/query-api">Query API</a>: for example, https://playground.wordpress.net/<em>?networking=yes</em>; <strong>or</strong>
|
|
884
|
-
<li> Using the <a href="https://wordpress.github.io/wordpress-playground/blueprints-api/data-format/#features">Blueprint API</a>: add <code>"features": { "networking": true }</code> to the JSON file.
|
|
885
|
-
</li></ol>
|
|
886
|
-
<p>
|
|
887
|
-
When browsing Playground as a standalone instance, you can enable networking via the settings panel: select the option "Network access (e.g. for browsing plugins)" and hit the "Apply changes" button.<p>
|
|
888
|
-
<strong>Please note:</strong> This option is hidden when browsing Playground as an embedded iframe.</p></div>';
|
|
889
|
-
return $networking_err_msg;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
add_filter('plugins_api_result', function ($res) {
|
|
893
|
-
if ($res instanceof WP_Error) {
|
|
894
|
-
$res = new WP_Error(
|
|
895
|
-
'plugins_api_failed',
|
|
896
|
-
networking_disabled()
|
|
897
|
-
);
|
|
898
|
-
}
|
|
899
|
-
return $res;
|
|
900
|
-
});
|
|
901
|
-
|
|
902
|
-
add_filter('gettext', function ($translation) {
|
|
903
|
-
if( $GLOBALS['pagenow'] === 'theme-install.php') {
|
|
904
|
-
if ($translation === 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.') {
|
|
905
|
-
return networking_disabled();
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return $translation;
|
|
909
|
-
});
|
|
910
|
-
|
|
911
|
-
/**
|
|
912
|
-
* Links with target="top" don't work in the playground iframe because of
|
|
913
|
-
* the sandbox attribute. What they really should be targeting is the
|
|
914
|
-
* playground iframe itself (name="playground"). This mu-plugin rewrites
|
|
915
|
-
* all target="_top" links to target="playground" instead.
|
|
916
|
-
*
|
|
917
|
-
* https://github.com/WordPress/wordpress-playground/issues/266
|
|
918
|
-
*/
|
|
919
|
-
add_action('admin_print_scripts', function () {
|
|
920
|
-
?>
|
|
921
|
-
<script>
|
|
922
|
-
document.addEventListener('click', function (event) {
|
|
923
|
-
if (event.target.tagName === 'A' && ['_parent', '_top'].includes(event.target.target)) {
|
|
924
|
-
event.target.target = 'wordpress-playground';
|
|
925
|
-
}
|
|
926
|
-
});
|
|
927
|
-
<\/script>
|
|
928
|
-
<?php
|
|
929
|
-
});
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
* Supports URL rewriting to remove \`index.php\` from permalinks.
|
|
933
|
-
*/
|
|
934
|
-
add_filter('got_url_rewrite', '__return_true');
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* The default WordPress requests transports have been disabled
|
|
938
|
-
* at this point. However, the Requests class requires at least
|
|
939
|
-
* one working transport or else it throws warnings and acts up.
|
|
940
|
-
*
|
|
941
|
-
* This mu-plugin provides that transport. It's one of the two:
|
|
942
|
-
*
|
|
943
|
-
* * WP_Http_Fetch – Sends requests using browser's fetch() function.
|
|
944
|
-
* Only enabled when PHP was compiled with the VRZNO
|
|
945
|
-
* extension.
|
|
946
|
-
* * Requests_Transport_Dummy – Does not send any requests and only exists to keep
|
|
947
|
-
* the Requests class happy.
|
|
948
|
-
*/
|
|
949
|
-
$__requests_class = class_exists( '\\WpOrg\\Requests\\Requests' ) ? '\\WpOrg\\Requests\\Requests' : 'Requests';
|
|
950
|
-
if (defined('USE_FETCH_FOR_REQUESTS') && USE_FETCH_FOR_REQUESTS) {
|
|
951
|
-
require(__DIR__ . '/playground-includes/wp_http_fetch.php');
|
|
952
|
-
$__requests_class::add_transport('WP_Http_Fetch');
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* Add Fetch transport to the list of transports that WordPress
|
|
956
|
-
* will test for in the _get_first_available_transport() function.
|
|
957
|
-
*/
|
|
958
|
-
add_filter('http_api_transports', function ($transports) {
|
|
959
|
-
$transports[] = 'Fetch';
|
|
960
|
-
return $transports;
|
|
961
|
-
});
|
|
962
|
-
/**
|
|
963
|
-
* Disable signature verification as it doesn't seem to work with
|
|
964
|
-
* fetch requests:
|
|
965
|
-
*
|
|
966
|
-
* https://downloads.wordpress.org/plugin/classic-editor.zip returns no signature header.
|
|
967
|
-
* https://downloads.wordpress.org/plugin/classic-editor.zip.sig returns 404.
|
|
968
|
-
*
|
|
969
|
-
* @TODO Investigate why.
|
|
970
|
-
*/
|
|
971
|
-
add_filter('wp_signature_hosts', function ($hosts) {
|
|
972
|
-
return [];
|
|
973
|
-
});
|
|
974
|
-
|
|
975
|
-
add_filter('http_request_host_is_external', function ($arg) {
|
|
976
|
-
return true;
|
|
977
|
-
});
|
|
978
|
-
} else {
|
|
979
|
-
require(__DIR__ . '/playground-includes/requests_transport_dummy.php');
|
|
980
|
-
$__requests_class::add_transport('Requests_Transport_Dummy');
|
|
981
|
-
}
|
|
982
|
-
`;
|
|
983
|
-
async function updateFile(e, t, r) {
|
|
984
|
-
let n = "";
|
|
985
|
-
await e.fileExists(t) && (n = await e.readFileAsText(t)), await e.writeFile(t, r(n));
|
|
986
|
-
}
|
|
987
|
-
const applyWordPressPatches = async (e, t) => {
|
|
988
|
-
const r = new WordPressPatcher(
|
|
989
|
-
e,
|
|
990
|
-
t.wordpressPath || "/wordpress",
|
|
991
|
-
t.siteUrl
|
|
992
|
-
);
|
|
993
|
-
t.addPhpInfo === !0 && await r.addPhpInfo(), t.siteUrl && await r.patchSiteUrl(), t.patchSecrets === !0 && await r.patchSecrets(), t.disableSiteHealth === !0 && await r.disableSiteHealth(), t.disableWpNewBlogNotification === !0 && await r.disableWpNewBlogNotification(), t.prepareForRunningInsideWebBrowser === !0 && await r.prepareForRunningInsideWebBrowser(), t.addFetchNetworkTransport === !0 && await r.addFetchNetworkTransport();
|
|
994
|
-
};
|
|
995
|
-
class WordPressPatcher {
|
|
996
|
-
constructor(t, r, n) {
|
|
997
|
-
this.php = t, this.scopedSiteUrl = n, this.wordpressPath = r;
|
|
998
|
-
}
|
|
999
|
-
async addPhpInfo() {
|
|
1000
|
-
await this.php.writeFile(
|
|
1001
|
-
joinPaths(this.wordpressPath, "phpinfo.php"),
|
|
1002
|
-
"<?php phpinfo(); "
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
async patchSiteUrl() {
|
|
1006
|
-
await defineWpConfigConsts(this.php, {
|
|
1007
|
-
consts: {
|
|
1008
|
-
WP_HOME: this.scopedSiteUrl,
|
|
1009
|
-
WP_SITEURL: this.scopedSiteUrl
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
async patchSecrets() {
|
|
1014
|
-
await defineWpConfigConsts(this.php, {
|
|
1015
|
-
consts: {
|
|
1016
|
-
AUTH_KEY: randomString(40),
|
|
1017
|
-
SECURE_AUTH_KEY: randomString(40),
|
|
1018
|
-
LOGGED_IN_KEY: randomString(40),
|
|
1019
|
-
NONCE_KEY: randomString(40),
|
|
1020
|
-
AUTH_SALT: randomString(40),
|
|
1021
|
-
SECURE_AUTH_SALT: randomString(40),
|
|
1022
|
-
LOGGED_IN_SALT: randomString(40),
|
|
1023
|
-
NONCE_SALT: randomString(40)
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
async disableSiteHealth() {
|
|
1028
|
-
await updateFile(
|
|
1029
|
-
this.php,
|
|
1030
|
-
joinPaths(this.wordpressPath, "wp-includes/default-filters.php"),
|
|
1031
|
-
(t) => t.replace(
|
|
1032
|
-
/add_filter[^;]+wp_maybe_grant_site_health_caps[^;]+;/i,
|
|
1033
|
-
""
|
|
1034
|
-
)
|
|
1035
|
-
);
|
|
1036
|
-
}
|
|
1037
|
-
async disableWpNewBlogNotification() {
|
|
1038
|
-
await updateFile(
|
|
1039
|
-
this.php,
|
|
1040
|
-
joinPaths(this.wordpressPath, "wp-config.php"),
|
|
1041
|
-
// The original version of this function crashes WASM PHP, let's define an empty one instead.
|
|
1042
|
-
(t) => `${t} function wp_new_blog_notification(...$args){} `
|
|
1043
|
-
);
|
|
1044
|
-
}
|
|
1045
|
-
async prepareForRunningInsideWebBrowser() {
|
|
1046
|
-
await this.php.mkdir(
|
|
1047
|
-
joinPaths(this.wordpressPath, "wp-content/mu-plugins")
|
|
1048
|
-
), await this.php.writeFile(
|
|
1049
|
-
joinPaths(
|
|
1050
|
-
this.wordpressPath,
|
|
1051
|
-
"/wp-content/mu-plugins/0-playground.php"
|
|
1052
|
-
),
|
|
1053
|
-
playgroundMuPlugin
|
|
1054
|
-
), await this.php.mkdir(
|
|
1055
|
-
joinPaths(
|
|
1056
|
-
this.wordpressPath,
|
|
1057
|
-
"/wp-content/mu-plugins/playground-includes"
|
|
1058
|
-
)
|
|
1059
|
-
), await this.php.writeFile(
|
|
1060
|
-
joinPaths(
|
|
1061
|
-
this.wordpressPath,
|
|
1062
|
-
"/wp-content/mu-plugins/playground-includes/requests_transport_dummy.php"
|
|
1063
|
-
),
|
|
1064
|
-
transportDummy
|
|
1065
|
-
);
|
|
1066
|
-
}
|
|
1067
|
-
async addFetchNetworkTransport() {
|
|
1068
|
-
await defineWpConfigConsts(this.php, {
|
|
1069
|
-
consts: {
|
|
1070
|
-
USE_FETCH_FOR_REQUESTS: !0
|
|
1071
|
-
}
|
|
1072
|
-
});
|
|
1073
|
-
const t = [
|
|
1074
|
-
joinPaths(
|
|
1075
|
-
this.wordpressPath,
|
|
1076
|
-
"/wp-includes/Requests/Transport/fsockopen.php"
|
|
1077
|
-
),
|
|
1078
|
-
joinPaths(
|
|
1079
|
-
this.wordpressPath,
|
|
1080
|
-
"/wp-includes/Requests/Transport/cURL.php"
|
|
1081
|
-
),
|
|
1082
|
-
joinPaths(
|
|
1083
|
-
this.wordpressPath,
|
|
1084
|
-
"/wp-includes/Requests/src/Transport/Fsockopen.php"
|
|
1085
|
-
),
|
|
1086
|
-
joinPaths(
|
|
1087
|
-
this.wordpressPath,
|
|
1088
|
-
"/wp-includes/Requests/src/Transport/Curl.php"
|
|
1089
|
-
)
|
|
1090
|
-
];
|
|
1091
|
-
for (const r of t)
|
|
1092
|
-
await this.php.fileExists(r) && await updateFile(this.php, r, (n) => n.includes("public static function test2") ? n : n.replace(
|
|
1093
|
-
"public static function test",
|
|
1094
|
-
"public static function test( $capabilities = array() ) { return false; } public static function test2"
|
|
1095
|
-
));
|
|
1096
|
-
await this.php.writeFile(
|
|
1097
|
-
joinPaths(
|
|
1098
|
-
this.wordpressPath,
|
|
1099
|
-
"wp-content/mu-plugins/playground-includes/wp_http_fetch.php"
|
|
1100
|
-
),
|
|
1101
|
-
transportFetch
|
|
1102
|
-
), await this.php.mkdir(`${this.wordpressPath}/wp-content/fonts`);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
function randomString(e) {
|
|
1106
|
-
const t = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=-[]/.,<>?";
|
|
1107
|
-
let r = "";
|
|
1108
|
-
for (let n = e; n > 0; --n)
|
|
1109
|
-
r += t[Math.floor(Math.random() * t.length)];
|
|
1110
|
-
return r;
|
|
1111
|
-
}
|
|
1112
|
-
const runPHP = async (e, { code: t }) => await e.run({ code: t, throwOnError: !0 }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
1113
|
-
await e.unlink(t);
|
|
1114
|
-
}, runSql = async (e, { sql: t }, r) => {
|
|
1115
|
-
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
1116
|
-
const n = `/tmp/${crypto.randomUUID()}.sql`;
|
|
1117
|
-
await e.writeFile(
|
|
1118
|
-
n,
|
|
1119
|
-
new Uint8Array(await t.arrayBuffer())
|
|
1120
|
-
);
|
|
1121
|
-
const s = await e.documentRoot, o = phpVars({ docroot: s, sqlFilename: n }), i = await e.run({
|
|
1122
|
-
code: `<?php
|
|
1123
|
-
require_once ${o.docroot} . '/wp-load.php';
|
|
1124
|
-
|
|
1125
|
-
$handle = fopen(${o.sqlFilename}, 'r');
|
|
1126
|
-
$buffer = '';
|
|
1127
|
-
|
|
1128
|
-
global $wpdb;
|
|
1129
|
-
|
|
1130
|
-
while ($bytes = fgets($handle)) {
|
|
1131
|
-
$buffer .= $bytes;
|
|
1132
|
-
|
|
1133
|
-
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
1134
|
-
") {
|
|
1135
|
-
continue;
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
$wpdb->query($buffer);
|
|
1139
|
-
$buffer = '';
|
|
1140
|
-
}
|
|
1141
|
-
`
|
|
1142
|
-
});
|
|
1143
|
-
return await rm(e, { path: n }), i;
|
|
1144
|
-
}, setPhpIniEntry = async (e, { key: t, value: r }) => {
|
|
1145
|
-
await e.setPhpIniEntry(t, r);
|
|
1146
|
-
}, request = async (e, { request: t }) => {
|
|
1147
|
-
const r = await e.request(t);
|
|
1148
|
-
if (r.httpStatusCode > 399 || r.httpStatusCode < 200)
|
|
1149
|
-
throw console.warn("WordPress response was", { response: r }), new Error(
|
|
1150
|
-
`Request failed with status ${r.httpStatusCode}`
|
|
1151
|
-
);
|
|
1152
|
-
return r;
|
|
1153
|
-
}, login = async (e, { username: t = "admin", password: r = "password" } = {}, n) => {
|
|
689
|
+
const login = async (e, { username: t = "admin", password: r = "password" } = {}, n) => {
|
|
1154
690
|
var o, i, l;
|
|
1155
691
|
n == null || n.tracker.setCaption((n == null ? void 0 : n.initialCaption) || "Logging in"), await e.request({
|
|
1156
692
|
url: "/wp-login.php"
|
|
@@ -1204,7 +740,7 @@ function getURLScope(e) {
|
|
|
1204
740
|
return isURLScoped(e) ? e.pathname.split("/")[1].split(":")[1] : null;
|
|
1205
741
|
}
|
|
1206
742
|
const enableMultisite = async (e) => {
|
|
1207
|
-
var
|
|
743
|
+
var v;
|
|
1208
744
|
await defineWpConfigConsts(e, {
|
|
1209
745
|
consts: {
|
|
1210
746
|
WP_ALLOW_MULTISITE: 1
|
|
@@ -1212,8 +748,8 @@ const enableMultisite = async (e) => {
|
|
|
1212
748
|
});
|
|
1213
749
|
const t = new URL(await e.absoluteUrl);
|
|
1214
750
|
if (t.port !== "") {
|
|
1215
|
-
let
|
|
1216
|
-
throw t.hostname === "localhost" && (
|
|
751
|
+
let w = `The current host is ${t.host}, but WordPress multisites do not support custom ports.`;
|
|
752
|
+
throw t.hostname === "localhost" && (w += " For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."), new Error(w);
|
|
1217
753
|
}
|
|
1218
754
|
const r = t.pathname.replace(/\/$/, "") + "/", n = `${t.protocol}//${t.hostname}${r}`;
|
|
1219
755
|
await setSiteOptions(e, {
|
|
@@ -1253,13 +789,13 @@ foreach($plugins as $plugin_path) {
|
|
|
1253
789
|
}
|
|
1254
790
|
echo json_encode($deactivated_plugins);
|
|
1255
791
|
`
|
|
1256
|
-
})).json, p = (
|
|
792
|
+
})).json, p = (v = (await request(e, {
|
|
1257
793
|
request: {
|
|
1258
794
|
url: "/wp-admin/network.php"
|
|
1259
795
|
}
|
|
1260
796
|
})).text.match(
|
|
1261
797
|
/name="_wpnonce"\s+value="([^"]+)"/
|
|
1262
|
-
)) == null ? void 0 :
|
|
798
|
+
)) == null ? void 0 : v[1], d = await request(e, {
|
|
1263
799
|
request: {
|
|
1264
800
|
url: "/wp-admin/network.php",
|
|
1265
801
|
method: "POST",
|
|
@@ -1294,23 +830,23 @@ echo json_encode($deactivated_plugins);
|
|
|
1294
830
|
PATH_CURRENT_SITE: r
|
|
1295
831
|
}
|
|
1296
832
|
});
|
|
1297
|
-
const u = new URL(await e.absoluteUrl),
|
|
833
|
+
const u = new URL(await e.absoluteUrl), _ = isURLScoped(u) ? "scope:" + getURLScope(u) : null;
|
|
1298
834
|
await e.writeFile(
|
|
1299
835
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
1300
836
|
`<?php
|
|
1301
837
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
1302
838
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
1303
839
|
}
|
|
1304
|
-
$folder = ${phpVar(
|
|
840
|
+
$folder = ${phpVar(_)};
|
|
1305
841
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
1306
842
|
$_SERVER['HTTP_HOST'] = ${phpVar(u.hostname)};
|
|
1307
843
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
1308
844
|
}
|
|
1309
845
|
`
|
|
1310
846
|
), await login(e, {});
|
|
1311
|
-
for (const
|
|
847
|
+
for (const w of i)
|
|
1312
848
|
await activatePlugin(e, {
|
|
1313
|
-
pluginPath:
|
|
849
|
+
pluginPath: w
|
|
1314
850
|
});
|
|
1315
851
|
};
|
|
1316
852
|
function jsonToUrlEncoded(e) {
|
|
@@ -1494,13 +1030,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1494
1030
|
}), s = joinPaths(s, r);
|
|
1495
1031
|
const o = joinPaths(s, "wp-content"), i = joinPaths(n, "wp-content");
|
|
1496
1032
|
for (const u of wpContentFilesExcludedFromExport) {
|
|
1497
|
-
const
|
|
1033
|
+
const _ = joinPaths(
|
|
1498
1034
|
o,
|
|
1499
1035
|
u
|
|
1500
1036
|
);
|
|
1501
|
-
await removePath(e,
|
|
1502
|
-
const
|
|
1503
|
-
await e.fileExists(
|
|
1037
|
+
await removePath(e, _);
|
|
1038
|
+
const v = joinPaths(i, u);
|
|
1039
|
+
await e.fileExists(v) && (await e.mkdir(dirname(_)), await e.mv(v, _));
|
|
1504
1040
|
}
|
|
1505
1041
|
const l = joinPaths(
|
|
1506
1042
|
s,
|
|
@@ -1517,7 +1053,9 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1517
1053
|
joinPaths(s, u),
|
|
1518
1054
|
joinPaths(n, u)
|
|
1519
1055
|
);
|
|
1520
|
-
await e.rmdir(s)
|
|
1056
|
+
await e.rmdir(s), await defineSiteUrl(e, {
|
|
1057
|
+
siteUrl: await e.absoluteUrl
|
|
1058
|
+
});
|
|
1521
1059
|
const d = phpVar(
|
|
1522
1060
|
joinPaths(n, "wp-admin", "upgrade.php")
|
|
1523
1061
|
);
|
|
@@ -1545,7 +1083,7 @@ async function exportWXZ(e) {
|
|
|
1545
1083
|
return new File([t.bytes], "export.wxz");
|
|
1546
1084
|
}
|
|
1547
1085
|
async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
1548
|
-
const s = r.name.replace(/\.zip$/, ""), o = joinPaths(await e.documentRoot, "wp-content"), i = joinPaths(o,
|
|
1086
|
+
const s = r.name.replace(/\.zip$/, ""), o = joinPaths(await e.documentRoot, "wp-content"), i = joinPaths(o, randomString()), l = joinPaths(i, "assets", s);
|
|
1549
1087
|
await e.fileExists(l) && await e.rmdir(i, {
|
|
1550
1088
|
recursive: !0
|
|
1551
1089
|
}), await e.mkdir(i);
|
|
@@ -1557,13 +1095,13 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1557
1095
|
let p = await e.listFiles(l, {
|
|
1558
1096
|
prependPath: !0
|
|
1559
1097
|
});
|
|
1560
|
-
p = p.filter((
|
|
1098
|
+
p = p.filter((w) => !w.endsWith("/__MACOSX"));
|
|
1561
1099
|
const d = p.length === 1 && await e.isDir(p[0]);
|
|
1562
|
-
let u,
|
|
1563
|
-
d ? (
|
|
1564
|
-
const
|
|
1565
|
-
return await e.mv(
|
|
1566
|
-
assetFolderPath:
|
|
1100
|
+
let u, _ = "";
|
|
1101
|
+
d ? (_ = p[0], u = p[0].split("/").pop()) : (_ = l, u = s);
|
|
1102
|
+
const v = `${t}/${u}`;
|
|
1103
|
+
return await e.mv(_, v), {
|
|
1104
|
+
assetFolderPath: v,
|
|
1567
1105
|
assetFolderName: u
|
|
1568
1106
|
};
|
|
1569
1107
|
} finally {
|
|
@@ -1653,7 +1191,6 @@ const installPlugin = async (e, { pluginZipFile: t, options: r = {} }, n) => {
|
|
|
1653
1191
|
__proto__: null,
|
|
1654
1192
|
activatePlugin,
|
|
1655
1193
|
activateTheme,
|
|
1656
|
-
applyWordPressPatches,
|
|
1657
1194
|
cp,
|
|
1658
1195
|
defineSiteUrl,
|
|
1659
1196
|
defineWpConfigConsts,
|
|
@@ -2106,16 +1643,16 @@ const SupportedPHPVersions = [
|
|
|
2106
1643
|
], SupportedPHPExtensionBundles = {
|
|
2107
1644
|
"kitchen-sink": SupportedPHPExtensionsList
|
|
2108
1645
|
};
|
|
2109
|
-
var Ae,
|
|
1646
|
+
var Ae, Ge;
|
|
2110
1647
|
class PHPBrowser {
|
|
2111
1648
|
/**
|
|
2112
1649
|
* @param server - The PHP server to browse.
|
|
2113
1650
|
* @param config - The browser configuration.
|
|
2114
1651
|
*/
|
|
2115
1652
|
constructor(t, r = {}) {
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
this.requestHandler = t, te(this, Ae, {}), te(this,
|
|
1653
|
+
Z(this, Ae, void 0);
|
|
1654
|
+
Z(this, Ge, void 0);
|
|
1655
|
+
this.requestHandler = t, te(this, Ae, {}), te(this, Ge, {
|
|
2119
1656
|
handleRedirects: !1,
|
|
2120
1657
|
maxRedirects: 4,
|
|
2121
1658
|
...r
|
|
@@ -2143,7 +1680,7 @@ class PHPBrowser {
|
|
|
2143
1680
|
cookie: this.serializeCookies()
|
|
2144
1681
|
}
|
|
2145
1682
|
});
|
|
2146
|
-
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this,
|
|
1683
|
+
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this, Ge).handleRedirects && n.headers.location && r < H(this, Ge).maxRedirects) {
|
|
2147
1684
|
const s = new URL(
|
|
2148
1685
|
n.headers.location[0],
|
|
2149
1686
|
this.requestHandler.absoluteUrl
|
|
@@ -2193,7 +1730,7 @@ class PHPBrowser {
|
|
|
2193
1730
|
return t.join("; ");
|
|
2194
1731
|
}
|
|
2195
1732
|
}
|
|
2196
|
-
Ae = new WeakMap(),
|
|
1733
|
+
Ae = new WeakMap(), Ge = new WeakMap();
|
|
2197
1734
|
const DEFAULT_BASE_URL = "http://example.com";
|
|
2198
1735
|
function toRelativeUrl(e) {
|
|
2199
1736
|
return e.toString().substring(e.origin.length);
|
|
@@ -2204,7 +1741,7 @@ function removePathPrefix(e, t) {
|
|
|
2204
1741
|
function ensurePathPrefix(e, t) {
|
|
2205
1742
|
return !t || e.startsWith(t) ? e : t + e;
|
|
2206
1743
|
}
|
|
2207
|
-
var Se,
|
|
1744
|
+
var Se, Ke, dt, De, Je, ve, Ze, Fe, mt, xt, _t, Wt, gt, Bt;
|
|
2208
1745
|
class PHPRequestHandler {
|
|
2209
1746
|
/**
|
|
2210
1747
|
* @param php - The PHP instance.
|
|
@@ -2217,7 +1754,7 @@ class PHPRequestHandler {
|
|
|
2217
1754
|
* @param fsPath - Absolute path of the static file to serve.
|
|
2218
1755
|
* @returns The response.
|
|
2219
1756
|
*/
|
|
2220
|
-
|
|
1757
|
+
Z(this, mt);
|
|
2221
1758
|
/**
|
|
2222
1759
|
* Runs the requested PHP file with all the request and $_SERVER
|
|
2223
1760
|
* superglobals populated.
|
|
@@ -2225,7 +1762,7 @@ class PHPRequestHandler {
|
|
|
2225
1762
|
* @param request - The request.
|
|
2226
1763
|
* @returns The response.
|
|
2227
1764
|
*/
|
|
2228
|
-
|
|
1765
|
+
Z(this, _t);
|
|
2229
1766
|
/**
|
|
2230
1767
|
* Resolve the requested path to the filesystem path of the requested PHP file.
|
|
2231
1768
|
*
|
|
@@ -2235,31 +1772,31 @@ class PHPRequestHandler {
|
|
|
2235
1772
|
* @throws {Error} If the requested path doesn't exist.
|
|
2236
1773
|
* @returns The resolved filesystem path.
|
|
2237
1774
|
*/
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
te(this,
|
|
1775
|
+
Z(this, gt);
|
|
1776
|
+
Z(this, Se, void 0);
|
|
1777
|
+
Z(this, Ke, void 0);
|
|
1778
|
+
Z(this, dt, void 0);
|
|
1779
|
+
Z(this, De, void 0);
|
|
1780
|
+
Z(this, Je, void 0);
|
|
1781
|
+
Z(this, ve, void 0);
|
|
1782
|
+
Z(this, Ze, void 0);
|
|
1783
|
+
Z(this, Fe, void 0);
|
|
1784
|
+
te(this, Fe, new Semaphore({ concurrency: 1 }));
|
|
2248
1785
|
const {
|
|
2249
1786
|
documentRoot: n = "/www/",
|
|
2250
1787
|
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
2251
1788
|
} = r;
|
|
2252
1789
|
this.php = t, te(this, Se, n);
|
|
2253
1790
|
const o = new URL(s);
|
|
2254
|
-
te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this,
|
|
1791
|
+
te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this, Ke, (o.protocol || "").replace(":", ""));
|
|
2255
1792
|
const i = H(this, De) !== 443 && H(this, De) !== 80;
|
|
2256
|
-
te(this,
|
|
1793
|
+
te(this, Je, [
|
|
2257
1794
|
H(this, dt),
|
|
2258
1795
|
i ? `:${H(this, De)}` : ""
|
|
2259
|
-
].join("")), te(this,
|
|
2260
|
-
`${H(this,
|
|
2261
|
-
H(this,
|
|
2262
|
-
H(this,
|
|
1796
|
+
].join("")), te(this, ve, o.pathname.replace(/\/+$/, "")), te(this, Ze, [
|
|
1797
|
+
`${H(this, Ke)}://`,
|
|
1798
|
+
H(this, Je),
|
|
1799
|
+
H(this, ve)
|
|
2263
1800
|
].join(""));
|
|
2264
1801
|
}
|
|
2265
1802
|
/** @inheritDoc */
|
|
@@ -2269,14 +1806,14 @@ class PHPRequestHandler {
|
|
|
2269
1806
|
/** @inheritDoc */
|
|
2270
1807
|
internalUrlToPath(t) {
|
|
2271
1808
|
const r = new URL(t);
|
|
2272
|
-
return r.pathname.startsWith(H(this,
|
|
1809
|
+
return r.pathname.startsWith(H(this, ve)) && (r.pathname = r.pathname.slice(H(this, ve).length)), toRelativeUrl(r);
|
|
2273
1810
|
}
|
|
2274
1811
|
get isRequestRunning() {
|
|
2275
|
-
return H(this,
|
|
1812
|
+
return H(this, Fe).running > 0;
|
|
2276
1813
|
}
|
|
2277
1814
|
/** @inheritDoc */
|
|
2278
1815
|
get absoluteUrl() {
|
|
2279
|
-
return H(this,
|
|
1816
|
+
return H(this, Ze);
|
|
2280
1817
|
}
|
|
2281
1818
|
/** @inheritDoc */
|
|
2282
1819
|
get documentRoot() {
|
|
@@ -2289,12 +1826,12 @@ class PHPRequestHandler {
|
|
|
2289
1826
|
r ? void 0 : DEFAULT_BASE_URL
|
|
2290
1827
|
), s = removePathPrefix(
|
|
2291
1828
|
n.pathname,
|
|
2292
|
-
H(this,
|
|
1829
|
+
H(this, ve)
|
|
2293
1830
|
), o = `${H(this, Se)}${s}`;
|
|
2294
|
-
return seemsLikeAPHPRequestHandlerPath(o) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt,
|
|
1831
|
+
return seemsLikeAPHPRequestHandlerPath(o) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, xt).call(this, o);
|
|
2295
1832
|
}
|
|
2296
1833
|
}
|
|
2297
|
-
Se = new WeakMap(),
|
|
1834
|
+
Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(), Je = new WeakMap(), ve = new WeakMap(), Ze = new WeakMap(), Fe = new WeakMap(), mt = new WeakSet(), xt = function(t) {
|
|
2298
1835
|
if (!this.php.fileExists(t))
|
|
2299
1836
|
return new PHPResponse(
|
|
2300
1837
|
404,
|
|
@@ -2320,48 +1857,56 @@ Se = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2320
1857
|
r
|
|
2321
1858
|
);
|
|
2322
1859
|
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
2323
|
-
var s, o;
|
|
2324
|
-
|
|
1860
|
+
var s, o, i;
|
|
1861
|
+
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1862
|
+
return console.warn(
|
|
1863
|
+
"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."
|
|
1864
|
+
), new PHPResponse(
|
|
1865
|
+
502,
|
|
1866
|
+
{},
|
|
1867
|
+
new TextEncoder().encode("502 Bad Gateway")
|
|
1868
|
+
);
|
|
1869
|
+
const n = await H(this, Fe).acquire();
|
|
2325
1870
|
try {
|
|
2326
1871
|
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this, Se)), this.php.addServerGlobalEntry(
|
|
2327
1872
|
"HTTPS",
|
|
2328
|
-
H(this,
|
|
1873
|
+
H(this, Ze).startsWith("https://") ? "on" : ""
|
|
2329
1874
|
);
|
|
2330
|
-
let
|
|
2331
|
-
const
|
|
2332
|
-
host: H(this,
|
|
1875
|
+
let l = "GET";
|
|
1876
|
+
const p = {
|
|
1877
|
+
host: H(this, Je),
|
|
2333
1878
|
...normalizeHeaders(t.headers || {})
|
|
2334
|
-
},
|
|
1879
|
+
}, d = [];
|
|
2335
1880
|
if (t.files && Object.keys(t.files).length) {
|
|
2336
|
-
|
|
2337
|
-
for (const
|
|
2338
|
-
const w = t.files[
|
|
2339
|
-
|
|
2340
|
-
key:
|
|
1881
|
+
l = "POST";
|
|
1882
|
+
for (const v in t.files) {
|
|
1883
|
+
const w = t.files[v];
|
|
1884
|
+
d.push({
|
|
1885
|
+
key: v,
|
|
2341
1886
|
name: w.name,
|
|
2342
1887
|
type: w.type,
|
|
2343
1888
|
data: new Uint8Array(await w.arrayBuffer())
|
|
2344
1889
|
});
|
|
2345
1890
|
}
|
|
2346
|
-
(
|
|
1891
|
+
(o = p["content-type"]) != null && o.startsWith("multipart/form-data") && (t.formData = parseMultipartFormDataString(
|
|
2347
1892
|
t.body || ""
|
|
2348
|
-
),
|
|
1893
|
+
), p["content-type"] = "application/x-www-form-urlencoded", delete t.body);
|
|
2349
1894
|
}
|
|
2350
|
-
let d;
|
|
2351
|
-
t.formData !== void 0 ? (i = "POST", l["content-type"] = l["content-type"] || "application/x-www-form-urlencoded", d = new URLSearchParams(
|
|
2352
|
-
t.formData
|
|
2353
|
-
).toString()) : d = t.body;
|
|
2354
1895
|
let u;
|
|
1896
|
+
t.formData !== void 0 ? (l = "POST", p["content-type"] = p["content-type"] || "application/x-www-form-urlencoded", u = new URLSearchParams(
|
|
1897
|
+
t.formData
|
|
1898
|
+
).toString()) : u = t.body;
|
|
1899
|
+
let _;
|
|
2355
1900
|
try {
|
|
2356
|
-
let
|
|
2357
|
-
if ((
|
|
1901
|
+
let v = r.pathname;
|
|
1902
|
+
if ((i = t.headers) != null && i["x-rewrite-url"])
|
|
2358
1903
|
try {
|
|
2359
|
-
|
|
1904
|
+
v = new URL(
|
|
2360
1905
|
t.headers["x-rewrite-url"]
|
|
2361
1906
|
).pathname;
|
|
2362
1907
|
} catch {
|
|
2363
1908
|
}
|
|
2364
|
-
|
|
1909
|
+
_ = ce(this, gt, Bt).call(this, v);
|
|
2365
1910
|
} catch {
|
|
2366
1911
|
return new PHPResponse(
|
|
2367
1912
|
404,
|
|
@@ -2372,20 +1917,20 @@ Se = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2372
1917
|
return await this.php.run({
|
|
2373
1918
|
relativeUri: ensurePathPrefix(
|
|
2374
1919
|
toRelativeUrl(r),
|
|
2375
|
-
H(this,
|
|
1920
|
+
H(this, ve)
|
|
2376
1921
|
),
|
|
2377
|
-
protocol: H(this,
|
|
2378
|
-
method: t.method ||
|
|
2379
|
-
body:
|
|
2380
|
-
fileInfos:
|
|
2381
|
-
scriptPath:
|
|
2382
|
-
headers:
|
|
1922
|
+
protocol: H(this, Ke),
|
|
1923
|
+
method: t.method || l,
|
|
1924
|
+
body: u,
|
|
1925
|
+
fileInfos: d,
|
|
1926
|
+
scriptPath: _,
|
|
1927
|
+
headers: p
|
|
2383
1928
|
});
|
|
2384
1929
|
} finally {
|
|
2385
1930
|
n();
|
|
2386
1931
|
}
|
|
2387
1932
|
}, gt = new WeakSet(), Bt = function(t) {
|
|
2388
|
-
let r = removePathPrefix(t, H(this,
|
|
1933
|
+
let r = removePathPrefix(t, H(this, ve));
|
|
2389
1934
|
r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r += "/"), r.endsWith("index.php") || (r += "index.php"));
|
|
2390
1935
|
const n = `${H(this, Se)}${r}`;
|
|
2391
1936
|
if (this.php.fileExists(n))
|
|
@@ -2549,8 +2094,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2549
2094
|
} catch (l) {
|
|
2550
2095
|
const p = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2551
2096
|
if (p in FileErrorCodes) {
|
|
2552
|
-
const d = FileErrorCodes[p], u = typeof i[0] == "string" ? i[0] : null,
|
|
2553
|
-
throw new Error(`${
|
|
2097
|
+
const d = FileErrorCodes[p], u = typeof i[0] == "string" ? i[0] : null, _ = u !== null ? e.replaceAll("{path}", u) : e;
|
|
2098
|
+
throw new Error(`${_}: ${d}`, {
|
|
2554
2099
|
cause: l
|
|
2555
2100
|
});
|
|
2556
2101
|
}
|
|
@@ -2573,7 +2118,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2573
2118
|
return n && s && __defProp(t, r, s), s;
|
|
2574
2119
|
};
|
|
2575
2120
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2576
|
-
var
|
|
2121
|
+
var Me, Qe, Ye, Pe, Re, Te, be, Xe, $t, Gt, yt, Kt, vt, Jt, wt, Zt, Pt, Qt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2577
2122
|
class BasePHP {
|
|
2578
2123
|
/**
|
|
2579
2124
|
* Initializes a PHP runtime.
|
|
@@ -2583,15 +2128,15 @@ class BasePHP {
|
|
|
2583
2128
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2584
2129
|
*/
|
|
2585
2130
|
constructor(e, t) {
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2131
|
+
Z(this, $t);
|
|
2132
|
+
Z(this, yt);
|
|
2133
|
+
Z(this, vt);
|
|
2134
|
+
Z(this, wt);
|
|
2135
|
+
Z(this, Pt);
|
|
2136
|
+
Z(this, bt);
|
|
2137
|
+
Z(this, Et);
|
|
2138
|
+
Z(this, St);
|
|
2139
|
+
Z(this, Rt);
|
|
2595
2140
|
/**
|
|
2596
2141
|
* Adds file information to $_FILES superglobal in PHP.
|
|
2597
2142
|
*
|
|
@@ -2601,18 +2146,18 @@ class BasePHP {
|
|
|
2601
2146
|
*
|
|
2602
2147
|
* @param fileInfo - File details
|
|
2603
2148
|
*/
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
te(this,
|
|
2149
|
+
Z(this, Tt);
|
|
2150
|
+
Z(this, kt);
|
|
2151
|
+
Z(this, Ct);
|
|
2152
|
+
Z(this, Me, void 0);
|
|
2153
|
+
Z(this, Qe, void 0);
|
|
2154
|
+
Z(this, Ye, void 0);
|
|
2155
|
+
Z(this, Pe, void 0);
|
|
2156
|
+
Z(this, Re, void 0);
|
|
2157
|
+
Z(this, Te, void 0);
|
|
2158
|
+
Z(this, be, void 0);
|
|
2159
|
+
Z(this, Xe, void 0);
|
|
2160
|
+
te(this, Me, []), te(this, Pe, !1), te(this, Re, null), te(this, Te, {}), te(this, be, /* @__PURE__ */ new Map()), te(this, Xe, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
|
|
2616
2161
|
new PHPRequestHandler(this, t)
|
|
2617
2162
|
));
|
|
2618
2163
|
}
|
|
@@ -2689,7 +2234,7 @@ class BasePHP {
|
|
|
2689
2234
|
setPhpIniPath(e) {
|
|
2690
2235
|
if (H(this, Pe))
|
|
2691
2236
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2692
|
-
te(this,
|
|
2237
|
+
te(this, Qe, e), this[__private__dont__use].ccall(
|
|
2693
2238
|
"wasm_set_phpini_path",
|
|
2694
2239
|
null,
|
|
2695
2240
|
["string"],
|
|
@@ -2700,7 +2245,7 @@ class BasePHP {
|
|
|
2700
2245
|
setPhpIniEntry(e, t) {
|
|
2701
2246
|
if (H(this, Pe))
|
|
2702
2247
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2703
|
-
H(this,
|
|
2248
|
+
H(this, Me).push([e, t]);
|
|
2704
2249
|
}
|
|
2705
2250
|
/** @inheritDoc */
|
|
2706
2251
|
chdir(e) {
|
|
@@ -2717,9 +2262,9 @@ class BasePHP {
|
|
|
2717
2262
|
const t = await this.semaphore.acquire();
|
|
2718
2263
|
let r;
|
|
2719
2264
|
try {
|
|
2720
|
-
H(this, Pe) || (ce(this, $t, Gt).call(this), te(this, Pe, !0)), ce(this, St, er).call(this, e.scriptPath || ""), ce(this,
|
|
2265
|
+
H(this, Pe) || (ce(this, $t, Gt).call(this), te(this, Pe, !0)), ce(this, St, er).call(this, e.scriptPath || ""), ce(this, vt, Jt).call(this, e.relativeUri || ""), ce(this, Pt, Qt).call(this, e.method || "GET");
|
|
2721
2266
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2722
|
-
if (ce(this,
|
|
2267
|
+
if (ce(this, wt, Zt).call(this, s, e.protocol || "http"), ce(this, bt, Yt).call(this, n), e.body && (r = ce(this, Et, Xt).call(this, e.body)), e.fileInfos)
|
|
2723
2268
|
for (const i of e.fileInfos)
|
|
2724
2269
|
ce(this, Tt, rr).call(this, i);
|
|
2725
2270
|
typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
|
|
@@ -2843,7 +2388,7 @@ class BasePHP {
|
|
|
2843
2388
|
this.exit();
|
|
2844
2389
|
} catch {
|
|
2845
2390
|
}
|
|
2846
|
-
if (this.initializeRuntime(e), H(this,
|
|
2391
|
+
if (this.initializeRuntime(e), H(this, Qe) && this.setPhpIniPath(H(this, Qe)), H(this, Ye) && this.setSapiName(H(this, Ye)), this.requestHandler) {
|
|
2847
2392
|
const r = this.documentRoot;
|
|
2848
2393
|
recreateMemFS(this[__private__dont__use].FS, t, r);
|
|
2849
2394
|
}
|
|
@@ -2859,7 +2404,7 @@ class BasePHP {
|
|
|
2859
2404
|
te(this, Pe, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2860
2405
|
}
|
|
2861
2406
|
}
|
|
2862
|
-
|
|
2407
|
+
Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), be = new WeakMap(), Xe = new WeakMap(), $t = new WeakSet(), Gt = function() {
|
|
2863
2408
|
if (this.setPhpIniEntry("auto_prepend_file", "/tmp/consts.php"), this.fileExists("/tmp/consts.php") || this.writeFile(
|
|
2864
2409
|
"/tmp/consts.php",
|
|
2865
2410
|
`<?php
|
|
@@ -2871,8 +2416,8 @@ Fe = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2871
2416
|
}
|
|
2872
2417
|
}
|
|
2873
2418
|
}`
|
|
2874
|
-
), H(this,
|
|
2875
|
-
const e = H(this,
|
|
2419
|
+
), H(this, Me).length > 0) {
|
|
2420
|
+
const e = H(this, Me).map(([t, r]) => `${t}=${r}`).join(`
|
|
2876
2421
|
`) + `
|
|
2877
2422
|
|
|
2878
2423
|
`;
|
|
@@ -2901,7 +2446,7 @@ Fe = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2901
2446
|
headers: r,
|
|
2902
2447
|
httpStatusCode: t.status
|
|
2903
2448
|
};
|
|
2904
|
-
},
|
|
2449
|
+
}, vt = new WeakSet(), Jt = function(e) {
|
|
2905
2450
|
if (this[__private__dont__use].ccall(
|
|
2906
2451
|
"wasm_set_request_uri",
|
|
2907
2452
|
null,
|
|
@@ -2916,7 +2461,7 @@ Fe = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2916
2461
|
[t]
|
|
2917
2462
|
);
|
|
2918
2463
|
}
|
|
2919
|
-
},
|
|
2464
|
+
}, wt = new WeakSet(), Zt = function(e, t) {
|
|
2920
2465
|
this[__private__dont__use].ccall(
|
|
2921
2466
|
"wasm_set_request_host",
|
|
2922
2467
|
null,
|
|
@@ -2934,7 +2479,7 @@ Fe = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2934
2479
|
[NUMBER],
|
|
2935
2480
|
[r]
|
|
2936
2481
|
), (t === "https" || !t && r === 443) && this.addServerGlobalEntry("HTTPS", "on");
|
|
2937
|
-
}, Pt = new WeakSet(),
|
|
2482
|
+
}, Pt = new WeakSet(), Qt = function(e) {
|
|
2938
2483
|
this[__private__dont__use].ccall(
|
|
2939
2484
|
"wasm_set_request_method",
|
|
2940
2485
|
null,
|
|
@@ -3402,15 +2947,15 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3402
2947
|
e._ = s;
|
|
3403
2948
|
const o = new n("+");
|
|
3404
2949
|
function i(g, ...k) {
|
|
3405
|
-
const C = [
|
|
2950
|
+
const C = [w(g[0])];
|
|
3406
2951
|
let I = 0;
|
|
3407
2952
|
for (; I < k.length; )
|
|
3408
|
-
C.push(o), l(C, k[I]), C.push(o,
|
|
2953
|
+
C.push(o), l(C, k[I]), C.push(o, w(g[++I]));
|
|
3409
2954
|
return p(C), new n(C);
|
|
3410
2955
|
}
|
|
3411
2956
|
e.str = i;
|
|
3412
2957
|
function l(g, k) {
|
|
3413
|
-
k instanceof n ? g.push(...k._items) : k instanceof r ? g.push(k) : g.push(
|
|
2958
|
+
k instanceof n ? g.push(...k._items) : k instanceof r ? g.push(k) : g.push(_(k));
|
|
3414
2959
|
}
|
|
3415
2960
|
e.addCodeArg = l;
|
|
3416
2961
|
function p(g) {
|
|
@@ -3441,21 +2986,21 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3441
2986
|
return k.emptyStr() ? g : g.emptyStr() ? k : i`${g}${k}`;
|
|
3442
2987
|
}
|
|
3443
2988
|
e.strConcat = u;
|
|
3444
|
-
function
|
|
3445
|
-
return typeof g == "number" || typeof g == "boolean" || g === null ? g :
|
|
2989
|
+
function _(g) {
|
|
2990
|
+
return typeof g == "number" || typeof g == "boolean" || g === null ? g : w(Array.isArray(g) ? g.join(",") : g);
|
|
3446
2991
|
}
|
|
3447
|
-
function
|
|
3448
|
-
return new n(
|
|
2992
|
+
function v(g) {
|
|
2993
|
+
return new n(w(g));
|
|
3449
2994
|
}
|
|
3450
|
-
e.stringify =
|
|
3451
|
-
function
|
|
2995
|
+
e.stringify = v;
|
|
2996
|
+
function w(g) {
|
|
3452
2997
|
return JSON.stringify(g).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3453
2998
|
}
|
|
3454
|
-
e.safeStringify =
|
|
3455
|
-
function
|
|
2999
|
+
e.safeStringify = w;
|
|
3000
|
+
function P(g) {
|
|
3456
3001
|
return typeof g == "string" && e.IDENTIFIER.test(g) ? new n(`.${g}`) : s`[${g}]`;
|
|
3457
3002
|
}
|
|
3458
|
-
e.getProperty =
|
|
3003
|
+
e.getProperty = P;
|
|
3459
3004
|
function T(g) {
|
|
3460
3005
|
if (typeof g == "string" && e.IDENTIFIER.test(g))
|
|
3461
3006
|
return new n(`${g}`);
|
|
@@ -3499,8 +3044,8 @@ var scope = {};
|
|
|
3499
3044
|
return `${d}${u.index++}`;
|
|
3500
3045
|
}
|
|
3501
3046
|
_nameGroup(d) {
|
|
3502
|
-
var u,
|
|
3503
|
-
if (!((
|
|
3047
|
+
var u, _;
|
|
3048
|
+
if (!((_ = (u = this._parent) === null || u === void 0 ? void 0 : u._prefixes) === null || _ === void 0) && _.has(d) || this._prefixes && !this._prefixes.has(d))
|
|
3504
3049
|
throw new Error(`CodeGen: prefix "${d}" is not allowed in this scope`);
|
|
3505
3050
|
return this._names[d] = { prefix: d, index: 0 };
|
|
3506
3051
|
}
|
|
@@ -3510,8 +3055,8 @@ var scope = {};
|
|
|
3510
3055
|
constructor(d, u) {
|
|
3511
3056
|
super(u), this.prefix = d;
|
|
3512
3057
|
}
|
|
3513
|
-
setValue(d, { property: u, itemIndex:
|
|
3514
|
-
this.value = d, this.scopePath = (0, t._)`.${new t.Name(u)}[${
|
|
3058
|
+
setValue(d, { property: u, itemIndex: _ }) {
|
|
3059
|
+
this.value = d, this.scopePath = (0, t._)`.${new t.Name(u)}[${_}]`;
|
|
3515
3060
|
}
|
|
3516
3061
|
}
|
|
3517
3062
|
e.ValueScopeName = o;
|
|
@@ -3527,47 +3072,47 @@ var scope = {};
|
|
|
3527
3072
|
return new o(d, this._newName(d));
|
|
3528
3073
|
}
|
|
3529
3074
|
value(d, u) {
|
|
3530
|
-
var
|
|
3075
|
+
var _;
|
|
3531
3076
|
if (u.ref === void 0)
|
|
3532
3077
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3533
|
-
const
|
|
3534
|
-
let T = this._values[
|
|
3078
|
+
const v = this.toName(d), { prefix: w } = v, P = (_ = u.key) !== null && _ !== void 0 ? _ : u.ref;
|
|
3079
|
+
let T = this._values[w];
|
|
3535
3080
|
if (T) {
|
|
3536
|
-
const k = T.get(
|
|
3081
|
+
const k = T.get(P);
|
|
3537
3082
|
if (k)
|
|
3538
3083
|
return k;
|
|
3539
3084
|
} else
|
|
3540
|
-
T = this._values[
|
|
3541
|
-
T.set(
|
|
3542
|
-
const $ = this._scope[
|
|
3543
|
-
return $[g] = u.ref,
|
|
3085
|
+
T = this._values[w] = /* @__PURE__ */ new Map();
|
|
3086
|
+
T.set(P, v);
|
|
3087
|
+
const $ = this._scope[w] || (this._scope[w] = []), g = $.length;
|
|
3088
|
+
return $[g] = u.ref, v.setValue(u, { property: w, itemIndex: g }), v;
|
|
3544
3089
|
}
|
|
3545
3090
|
getValue(d, u) {
|
|
3546
|
-
const
|
|
3547
|
-
if (
|
|
3548
|
-
return
|
|
3091
|
+
const _ = this._values[d];
|
|
3092
|
+
if (_)
|
|
3093
|
+
return _.get(u);
|
|
3549
3094
|
}
|
|
3550
3095
|
scopeRefs(d, u = this._values) {
|
|
3551
|
-
return this._reduceValues(u, (
|
|
3552
|
-
if (
|
|
3553
|
-
throw new Error(`CodeGen: name "${
|
|
3554
|
-
return (0, t._)`${d}${
|
|
3096
|
+
return this._reduceValues(u, (_) => {
|
|
3097
|
+
if (_.scopePath === void 0)
|
|
3098
|
+
throw new Error(`CodeGen: name "${_}" has no value`);
|
|
3099
|
+
return (0, t._)`${d}${_.scopePath}`;
|
|
3555
3100
|
});
|
|
3556
3101
|
}
|
|
3557
|
-
scopeCode(d = this._values, u,
|
|
3558
|
-
return this._reduceValues(d, (
|
|
3559
|
-
if (
|
|
3560
|
-
throw new Error(`CodeGen: name "${
|
|
3561
|
-
return
|
|
3562
|
-
}, u,
|
|
3563
|
-
}
|
|
3564
|
-
_reduceValues(d, u,
|
|
3565
|
-
let
|
|
3566
|
-
for (const
|
|
3567
|
-
const T = d[
|
|
3102
|
+
scopeCode(d = this._values, u, _) {
|
|
3103
|
+
return this._reduceValues(d, (v) => {
|
|
3104
|
+
if (v.value === void 0)
|
|
3105
|
+
throw new Error(`CodeGen: name "${v}" has no value`);
|
|
3106
|
+
return v.value.code;
|
|
3107
|
+
}, u, _);
|
|
3108
|
+
}
|
|
3109
|
+
_reduceValues(d, u, _ = {}, v) {
|
|
3110
|
+
let w = t.nil;
|
|
3111
|
+
for (const P in d) {
|
|
3112
|
+
const T = d[P];
|
|
3568
3113
|
if (!T)
|
|
3569
3114
|
continue;
|
|
3570
|
-
const $ =
|
|
3115
|
+
const $ = _[P] = _[P] || /* @__PURE__ */ new Map();
|
|
3571
3116
|
T.forEach((g) => {
|
|
3572
3117
|
if ($.has(g))
|
|
3573
3118
|
return;
|
|
@@ -3575,15 +3120,15 @@ var scope = {};
|
|
|
3575
3120
|
let k = u(g);
|
|
3576
3121
|
if (k) {
|
|
3577
3122
|
const C = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3578
|
-
|
|
3579
|
-
} else if (k =
|
|
3580
|
-
|
|
3123
|
+
w = (0, t._)`${w}${C} ${g} = ${k};${this.opts._n}`;
|
|
3124
|
+
} else if (k = v == null ? void 0 : v(g))
|
|
3125
|
+
w = (0, t._)`${w}${k}${this.opts._n}`;
|
|
3581
3126
|
else
|
|
3582
3127
|
throw new r(g);
|
|
3583
3128
|
$.set(g, n.Completed);
|
|
3584
3129
|
});
|
|
3585
3130
|
}
|
|
3586
|
-
return
|
|
3131
|
+
return w;
|
|
3587
3132
|
}
|
|
3588
3133
|
}
|
|
3589
3134
|
e.ValueScope = l;
|
|
@@ -3643,8 +3188,8 @@ var scope = {};
|
|
|
3643
3188
|
super(), this.varKind = a, this.name = h, this.rhs = N;
|
|
3644
3189
|
}
|
|
3645
3190
|
render({ es5: a, _n: h }) {
|
|
3646
|
-
const N = a ? r.varKinds.var : this.varKind,
|
|
3647
|
-
return `${N} ${this.name}${
|
|
3191
|
+
const N = a ? r.varKinds.var : this.varKind, M = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
3192
|
+
return `${N} ${this.name}${M};` + h;
|
|
3648
3193
|
}
|
|
3649
3194
|
optimizeNames(a, h) {
|
|
3650
3195
|
if (a[this.name.str])
|
|
@@ -3671,8 +3216,8 @@ var scope = {};
|
|
|
3671
3216
|
}
|
|
3672
3217
|
}
|
|
3673
3218
|
class p extends l {
|
|
3674
|
-
constructor(a, h, N,
|
|
3675
|
-
super(a, N,
|
|
3219
|
+
constructor(a, h, N, M) {
|
|
3220
|
+
super(a, N, M), this.op = h;
|
|
3676
3221
|
}
|
|
3677
3222
|
render({ _n: a }) {
|
|
3678
3223
|
return `${this.lhs} ${this.op}= ${this.rhs};` + a;
|
|
@@ -3694,7 +3239,7 @@ var scope = {};
|
|
|
3694
3239
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3695
3240
|
}
|
|
3696
3241
|
}
|
|
3697
|
-
class
|
|
3242
|
+
class _ extends o {
|
|
3698
3243
|
constructor(a) {
|
|
3699
3244
|
super(), this.error = a;
|
|
3700
3245
|
}
|
|
@@ -3705,7 +3250,7 @@ var scope = {};
|
|
|
3705
3250
|
return this.error.names;
|
|
3706
3251
|
}
|
|
3707
3252
|
}
|
|
3708
|
-
class
|
|
3253
|
+
class v extends o {
|
|
3709
3254
|
constructor(a) {
|
|
3710
3255
|
super(), this.code = a;
|
|
3711
3256
|
}
|
|
@@ -3722,7 +3267,7 @@ var scope = {};
|
|
|
3722
3267
|
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
3723
3268
|
}
|
|
3724
3269
|
}
|
|
3725
|
-
class
|
|
3270
|
+
class w extends o {
|
|
3726
3271
|
constructor(a = []) {
|
|
3727
3272
|
super(), this.nodes = a;
|
|
3728
3273
|
}
|
|
@@ -3740,10 +3285,10 @@ var scope = {};
|
|
|
3740
3285
|
}
|
|
3741
3286
|
optimizeNames(a, h) {
|
|
3742
3287
|
const { nodes: N } = this;
|
|
3743
|
-
let
|
|
3744
|
-
for (;
|
|
3745
|
-
const
|
|
3746
|
-
|
|
3288
|
+
let M = N.length;
|
|
3289
|
+
for (; M--; ) {
|
|
3290
|
+
const q = N[M];
|
|
3291
|
+
q.optimizeNames(a, h) || (ke(a, q.names), N.splice(M, 1));
|
|
3747
3292
|
}
|
|
3748
3293
|
return N.length > 0 ? this : void 0;
|
|
3749
3294
|
}
|
|
@@ -3751,17 +3296,17 @@ var scope = {};
|
|
|
3751
3296
|
return this.nodes.reduce((a, h) => K(a, h.names), {});
|
|
3752
3297
|
}
|
|
3753
3298
|
}
|
|
3754
|
-
class
|
|
3299
|
+
class P extends w {
|
|
3755
3300
|
render(a) {
|
|
3756
3301
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3757
3302
|
}
|
|
3758
3303
|
}
|
|
3759
|
-
class T extends
|
|
3304
|
+
class T extends w {
|
|
3760
3305
|
}
|
|
3761
|
-
class $ extends
|
|
3306
|
+
class $ extends P {
|
|
3762
3307
|
}
|
|
3763
3308
|
$.kind = "else";
|
|
3764
|
-
class g extends
|
|
3309
|
+
class g extends P {
|
|
3765
3310
|
constructor(a, h) {
|
|
3766
3311
|
super(h), this.condition = a;
|
|
3767
3312
|
}
|
|
@@ -3795,7 +3340,7 @@ var scope = {};
|
|
|
3795
3340
|
}
|
|
3796
3341
|
}
|
|
3797
3342
|
g.kind = "if";
|
|
3798
|
-
class k extends
|
|
3343
|
+
class k extends P {
|
|
3799
3344
|
}
|
|
3800
3345
|
k.kind = "for";
|
|
3801
3346
|
class C extends k {
|
|
@@ -3814,12 +3359,12 @@ var scope = {};
|
|
|
3814
3359
|
}
|
|
3815
3360
|
}
|
|
3816
3361
|
class I extends k {
|
|
3817
|
-
constructor(a, h, N,
|
|
3818
|
-
super(), this.varKind = a, this.name = h, this.from = N, this.to =
|
|
3362
|
+
constructor(a, h, N, M) {
|
|
3363
|
+
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3819
3364
|
}
|
|
3820
3365
|
render(a) {
|
|
3821
|
-
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from:
|
|
3822
|
-
return `for(${h} ${N}=${
|
|
3366
|
+
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: q } = this;
|
|
3367
|
+
return `for(${h} ${N}=${M}; ${N}<${q}; ${N}++)` + super.render(a);
|
|
3823
3368
|
}
|
|
3824
3369
|
get names() {
|
|
3825
3370
|
const a = ue(super.names, this.from);
|
|
@@ -3827,8 +3372,8 @@ var scope = {};
|
|
|
3827
3372
|
}
|
|
3828
3373
|
}
|
|
3829
3374
|
class D extends k {
|
|
3830
|
-
constructor(a, h, N,
|
|
3831
|
-
super(), this.loop = a, this.varKind = h, this.name = N, this.iterable =
|
|
3375
|
+
constructor(a, h, N, M) {
|
|
3376
|
+
super(), this.loop = a, this.varKind = h, this.name = N, this.iterable = M;
|
|
3832
3377
|
}
|
|
3833
3378
|
render(a) {
|
|
3834
3379
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(a);
|
|
@@ -3841,7 +3386,7 @@ var scope = {};
|
|
|
3841
3386
|
return K(super.names, this.iterable.names);
|
|
3842
3387
|
}
|
|
3843
3388
|
}
|
|
3844
|
-
class
|
|
3389
|
+
class b extends P {
|
|
3845
3390
|
constructor(a, h, N) {
|
|
3846
3391
|
super(), this.name = a, this.args = h, this.async = N;
|
|
3847
3392
|
}
|
|
@@ -3849,14 +3394,14 @@ var scope = {};
|
|
|
3849
3394
|
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(a);
|
|
3850
3395
|
}
|
|
3851
3396
|
}
|
|
3852
|
-
|
|
3853
|
-
class O extends
|
|
3397
|
+
b.kind = "func";
|
|
3398
|
+
class O extends w {
|
|
3854
3399
|
render(a) {
|
|
3855
3400
|
return "return " + super.render(a);
|
|
3856
3401
|
}
|
|
3857
3402
|
}
|
|
3858
3403
|
O.kind = "return";
|
|
3859
|
-
class A extends
|
|
3404
|
+
class A extends P {
|
|
3860
3405
|
render(a) {
|
|
3861
3406
|
let h = "try" + super.render(a);
|
|
3862
3407
|
return this.catch && (h += this.catch.render(a)), this.finally && (h += this.finally.render(a)), h;
|
|
@@ -3866,15 +3411,15 @@ var scope = {};
|
|
|
3866
3411
|
return super.optimizeNodes(), (a = this.catch) === null || a === void 0 || a.optimizeNodes(), (h = this.finally) === null || h === void 0 || h.optimizeNodes(), this;
|
|
3867
3412
|
}
|
|
3868
3413
|
optimizeNames(a, h) {
|
|
3869
|
-
var N,
|
|
3870
|
-
return super.optimizeNames(a, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(a, h), (
|
|
3414
|
+
var N, M;
|
|
3415
|
+
return super.optimizeNames(a, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(a, h), (M = this.finally) === null || M === void 0 || M.optimizeNames(a, h), this;
|
|
3871
3416
|
}
|
|
3872
3417
|
get names() {
|
|
3873
3418
|
const a = super.names;
|
|
3874
3419
|
return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
|
|
3875
3420
|
}
|
|
3876
3421
|
}
|
|
3877
|
-
class
|
|
3422
|
+
class V extends P {
|
|
3878
3423
|
constructor(a) {
|
|
3879
3424
|
super(), this.error = a;
|
|
3880
3425
|
}
|
|
@@ -3882,13 +3427,13 @@ var scope = {};
|
|
|
3882
3427
|
return `catch(${this.error})` + super.render(a);
|
|
3883
3428
|
}
|
|
3884
3429
|
}
|
|
3885
|
-
|
|
3886
|
-
class
|
|
3430
|
+
V.kind = "catch";
|
|
3431
|
+
class x extends P {
|
|
3887
3432
|
render(a) {
|
|
3888
3433
|
return "finally" + super.render(a);
|
|
3889
3434
|
}
|
|
3890
3435
|
}
|
|
3891
|
-
|
|
3436
|
+
x.kind = "finally";
|
|
3892
3437
|
class re {
|
|
3893
3438
|
constructor(a, h = {}) {
|
|
3894
3439
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
@@ -3921,9 +3466,9 @@ var scope = {};
|
|
|
3921
3466
|
scopeCode() {
|
|
3922
3467
|
return this._extScope.scopeCode(this._values);
|
|
3923
3468
|
}
|
|
3924
|
-
_def(a, h, N,
|
|
3925
|
-
const
|
|
3926
|
-
return N !== void 0 &&
|
|
3469
|
+
_def(a, h, N, M) {
|
|
3470
|
+
const q = this._scope.toName(h);
|
|
3471
|
+
return N !== void 0 && M && (this._constants[q.str] = N), this._leafNode(new i(a, q, N)), q;
|
|
3927
3472
|
}
|
|
3928
3473
|
// `const` declaration (`var` in es5 mode)
|
|
3929
3474
|
const(a, h, N) {
|
|
@@ -3947,13 +3492,13 @@ var scope = {};
|
|
|
3947
3492
|
}
|
|
3948
3493
|
// appends passed SafeExpr to code or executes Block
|
|
3949
3494
|
code(a) {
|
|
3950
|
-
return typeof a == "function" ? a() : a !== t.nil && this._leafNode(new
|
|
3495
|
+
return typeof a == "function" ? a() : a !== t.nil && this._leafNode(new v(a)), this;
|
|
3951
3496
|
}
|
|
3952
3497
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
3953
3498
|
object(...a) {
|
|
3954
3499
|
const h = ["{"];
|
|
3955
|
-
for (const [N,
|
|
3956
|
-
h.length > 1 && h.push(","), h.push(N), (N !==
|
|
3500
|
+
for (const [N, M] of a)
|
|
3501
|
+
h.length > 1 && h.push(","), h.push(N), (N !== M || this.opts.es5) && (h.push(":"), (0, t.addCodeArg)(h, M));
|
|
3957
3502
|
return h.push("}"), new t._Code(h);
|
|
3958
3503
|
}
|
|
3959
3504
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
@@ -3986,28 +3531,28 @@ var scope = {};
|
|
|
3986
3531
|
return this._for(new C(a), h);
|
|
3987
3532
|
}
|
|
3988
3533
|
// `for` statement for a range of values
|
|
3989
|
-
forRange(a, h, N,
|
|
3534
|
+
forRange(a, h, N, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3990
3535
|
const W = this._scope.toName(a);
|
|
3991
|
-
return this._for(new I(
|
|
3536
|
+
return this._for(new I(q, W, h, N), () => M(W));
|
|
3992
3537
|
}
|
|
3993
3538
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3994
|
-
forOf(a, h, N,
|
|
3995
|
-
const
|
|
3539
|
+
forOf(a, h, N, M = r.varKinds.const) {
|
|
3540
|
+
const q = this._scope.toName(a);
|
|
3996
3541
|
if (this.opts.es5) {
|
|
3997
3542
|
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3998
3543
|
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3999
|
-
this.var(
|
|
3544
|
+
this.var(q, (0, t._)`${W}[${G}]`), N(q);
|
|
4000
3545
|
});
|
|
4001
3546
|
}
|
|
4002
|
-
return this._for(new D("of",
|
|
3547
|
+
return this._for(new D("of", M, q, h), () => N(q));
|
|
4003
3548
|
}
|
|
4004
3549
|
// `for-in` statement.
|
|
4005
3550
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
4006
|
-
forIn(a, h, N,
|
|
3551
|
+
forIn(a, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
4007
3552
|
if (this.opts.ownProperties)
|
|
4008
3553
|
return this.forOf(a, (0, t._)`Object.keys(${h})`, N);
|
|
4009
|
-
const
|
|
4010
|
-
return this._for(new D("in",
|
|
3554
|
+
const q = this._scope.toName(a);
|
|
3555
|
+
return this._for(new D("in", M, q, h), () => N(q));
|
|
4011
3556
|
}
|
|
4012
3557
|
// end `for` loop
|
|
4013
3558
|
endFor() {
|
|
@@ -4032,16 +3577,16 @@ var scope = {};
|
|
|
4032
3577
|
try(a, h, N) {
|
|
4033
3578
|
if (!h && !N)
|
|
4034
3579
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
4035
|
-
const
|
|
4036
|
-
if (this._blockNode(
|
|
4037
|
-
const
|
|
4038
|
-
this._currNode =
|
|
3580
|
+
const M = new A();
|
|
3581
|
+
if (this._blockNode(M), this.code(a), h) {
|
|
3582
|
+
const q = this.name("e");
|
|
3583
|
+
this._currNode = M.catch = new V(q), h(q);
|
|
4039
3584
|
}
|
|
4040
|
-
return N && (this._currNode =
|
|
3585
|
+
return N && (this._currNode = M.finally = new x(), this.code(N)), this._endBlockNode(V, x);
|
|
4041
3586
|
}
|
|
4042
3587
|
// `throw` statement
|
|
4043
3588
|
throw(a) {
|
|
4044
|
-
return this._leafNode(new
|
|
3589
|
+
return this._leafNode(new _(a));
|
|
4045
3590
|
}
|
|
4046
3591
|
// start self-balancing block
|
|
4047
3592
|
block(a, h) {
|
|
@@ -4058,12 +3603,12 @@ var scope = {};
|
|
|
4058
3603
|
return this._nodes.length = h, this;
|
|
4059
3604
|
}
|
|
4060
3605
|
// `function` heading (or definition if funcBody is passed)
|
|
4061
|
-
func(a, h = t.nil, N,
|
|
4062
|
-
return this._blockNode(new
|
|
3606
|
+
func(a, h = t.nil, N, M) {
|
|
3607
|
+
return this._blockNode(new b(a, h, N)), M && this.code(M).endFunc(), this;
|
|
4063
3608
|
}
|
|
4064
3609
|
// end function definition
|
|
4065
3610
|
endFunc() {
|
|
4066
|
-
return this._endBlockNode(
|
|
3611
|
+
return this._endBlockNode(b);
|
|
4067
3612
|
}
|
|
4068
3613
|
optimize(a = 1) {
|
|
4069
3614
|
for (; a-- > 0; )
|
|
@@ -4100,189 +3645,189 @@ var scope = {};
|
|
|
4100
3645
|
}
|
|
4101
3646
|
}
|
|
4102
3647
|
e.CodeGen = re;
|
|
4103
|
-
function K(
|
|
3648
|
+
function K(E, a) {
|
|
4104
3649
|
for (const h in a)
|
|
4105
|
-
|
|
4106
|
-
return
|
|
3650
|
+
E[h] = (E[h] || 0) + (a[h] || 0);
|
|
3651
|
+
return E;
|
|
4107
3652
|
}
|
|
4108
|
-
function ue(
|
|
4109
|
-
return a instanceof t._CodeOrName ? K(
|
|
3653
|
+
function ue(E, a) {
|
|
3654
|
+
return a instanceof t._CodeOrName ? K(E, a.names) : E;
|
|
4110
3655
|
}
|
|
4111
|
-
function ie(
|
|
4112
|
-
if (
|
|
4113
|
-
return N(
|
|
4114
|
-
if (!
|
|
4115
|
-
return
|
|
4116
|
-
return new t._Code(
|
|
4117
|
-
function N(
|
|
4118
|
-
const W = h[
|
|
4119
|
-
return W === void 0 || a[
|
|
3656
|
+
function ie(E, a, h) {
|
|
3657
|
+
if (E instanceof t.Name)
|
|
3658
|
+
return N(E);
|
|
3659
|
+
if (!M(E))
|
|
3660
|
+
return E;
|
|
3661
|
+
return new t._Code(E._items.reduce((q, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? q.push(...W._items) : q.push(W), q), []));
|
|
3662
|
+
function N(q) {
|
|
3663
|
+
const W = h[q.str];
|
|
3664
|
+
return W === void 0 || a[q.str] !== 1 ? q : (delete a[q.str], W);
|
|
4120
3665
|
}
|
|
4121
|
-
function q
|
|
4122
|
-
return
|
|
3666
|
+
function M(q) {
|
|
3667
|
+
return q instanceof t._Code && q._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
4123
3668
|
}
|
|
4124
3669
|
}
|
|
4125
|
-
function ke(
|
|
3670
|
+
function ke(E, a) {
|
|
4126
3671
|
for (const h in a)
|
|
4127
|
-
|
|
3672
|
+
E[h] = (E[h] || 0) - (a[h] || 0);
|
|
4128
3673
|
}
|
|
4129
|
-
function Ce(
|
|
4130
|
-
return typeof
|
|
3674
|
+
function Ce(E) {
|
|
3675
|
+
return typeof E == "boolean" || typeof E == "number" || E === null ? !E : (0, t._)`!${j(E)}`;
|
|
4131
3676
|
}
|
|
4132
3677
|
e.not = Ce;
|
|
4133
3678
|
const qe = y(e.operators.AND);
|
|
4134
|
-
function et(...
|
|
4135
|
-
return
|
|
3679
|
+
function et(...E) {
|
|
3680
|
+
return E.reduce(qe);
|
|
4136
3681
|
}
|
|
4137
3682
|
e.and = et;
|
|
4138
|
-
const
|
|
4139
|
-
function F(...
|
|
4140
|
-
return
|
|
3683
|
+
const Ue = y(e.operators.OR);
|
|
3684
|
+
function F(...E) {
|
|
3685
|
+
return E.reduce(Ue);
|
|
4141
3686
|
}
|
|
4142
3687
|
e.or = F;
|
|
4143
|
-
function y(
|
|
4144
|
-
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${
|
|
3688
|
+
function y(E) {
|
|
3689
|
+
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${E} ${j(h)}`;
|
|
4145
3690
|
}
|
|
4146
|
-
function j(
|
|
4147
|
-
return
|
|
3691
|
+
function j(E) {
|
|
3692
|
+
return E instanceof t.Name ? E : (0, t._)`(${E})`;
|
|
4148
3693
|
}
|
|
4149
3694
|
})(codegen);
|
|
4150
3695
|
var util = {};
|
|
4151
3696
|
(function(e) {
|
|
4152
3697
|
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;
|
|
4153
3698
|
const t = codegen, r = code$1;
|
|
4154
|
-
function n(
|
|
3699
|
+
function n(b) {
|
|
4155
3700
|
const O = {};
|
|
4156
|
-
for (const A of
|
|
3701
|
+
for (const A of b)
|
|
4157
3702
|
O[A] = !0;
|
|
4158
3703
|
return O;
|
|
4159
3704
|
}
|
|
4160
3705
|
e.toHash = n;
|
|
4161
|
-
function s(
|
|
4162
|
-
return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (o(
|
|
3706
|
+
function s(b, O) {
|
|
3707
|
+
return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (o(b, O), !i(O, b.self.RULES.all));
|
|
4163
3708
|
}
|
|
4164
3709
|
e.alwaysValidSchema = s;
|
|
4165
|
-
function o(
|
|
4166
|
-
const { opts: A, self:
|
|
3710
|
+
function o(b, O = b.schema) {
|
|
3711
|
+
const { opts: A, self: V } = b;
|
|
4167
3712
|
if (!A.strictSchema || typeof O == "boolean")
|
|
4168
3713
|
return;
|
|
4169
|
-
const
|
|
3714
|
+
const x = V.RULES.keywords;
|
|
4170
3715
|
for (const re in O)
|
|
4171
|
-
|
|
3716
|
+
x[re] || D(b, `unknown keyword: "${re}"`);
|
|
4172
3717
|
}
|
|
4173
3718
|
e.checkUnknownRules = o;
|
|
4174
|
-
function i(
|
|
4175
|
-
if (typeof
|
|
4176
|
-
return !
|
|
4177
|
-
for (const A in
|
|
3719
|
+
function i(b, O) {
|
|
3720
|
+
if (typeof b == "boolean")
|
|
3721
|
+
return !b;
|
|
3722
|
+
for (const A in b)
|
|
4178
3723
|
if (O[A])
|
|
4179
3724
|
return !0;
|
|
4180
3725
|
return !1;
|
|
4181
3726
|
}
|
|
4182
3727
|
e.schemaHasRules = i;
|
|
4183
|
-
function l(
|
|
4184
|
-
if (typeof
|
|
4185
|
-
return !
|
|
4186
|
-
for (const A in
|
|
3728
|
+
function l(b, O) {
|
|
3729
|
+
if (typeof b == "boolean")
|
|
3730
|
+
return !b;
|
|
3731
|
+
for (const A in b)
|
|
4187
3732
|
if (A !== "$ref" && O.all[A])
|
|
4188
3733
|
return !0;
|
|
4189
3734
|
return !1;
|
|
4190
3735
|
}
|
|
4191
3736
|
e.schemaHasRulesButRef = l;
|
|
4192
|
-
function p({ topSchemaRef:
|
|
4193
|
-
if (!
|
|
3737
|
+
function p({ topSchemaRef: b, schemaPath: O }, A, V, x) {
|
|
3738
|
+
if (!x) {
|
|
4194
3739
|
if (typeof A == "number" || typeof A == "boolean")
|
|
4195
3740
|
return A;
|
|
4196
3741
|
if (typeof A == "string")
|
|
4197
3742
|
return (0, t._)`${A}`;
|
|
4198
3743
|
}
|
|
4199
|
-
return (0, t._)`${
|
|
3744
|
+
return (0, t._)`${b}${O}${(0, t.getProperty)(V)}`;
|
|
4200
3745
|
}
|
|
4201
3746
|
e.schemaRefOrVal = p;
|
|
4202
|
-
function d(
|
|
4203
|
-
return
|
|
3747
|
+
function d(b) {
|
|
3748
|
+
return v(decodeURIComponent(b));
|
|
4204
3749
|
}
|
|
4205
3750
|
e.unescapeFragment = d;
|
|
4206
|
-
function u(
|
|
4207
|
-
return encodeURIComponent(
|
|
3751
|
+
function u(b) {
|
|
3752
|
+
return encodeURIComponent(_(b));
|
|
4208
3753
|
}
|
|
4209
3754
|
e.escapeFragment = u;
|
|
4210
|
-
function
|
|
4211
|
-
return typeof
|
|
3755
|
+
function _(b) {
|
|
3756
|
+
return typeof b == "number" ? `${b}` : b.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
4212
3757
|
}
|
|
4213
|
-
e.escapeJsonPointer =
|
|
4214
|
-
function
|
|
4215
|
-
return
|
|
3758
|
+
e.escapeJsonPointer = _;
|
|
3759
|
+
function v(b) {
|
|
3760
|
+
return b.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
4216
3761
|
}
|
|
4217
|
-
e.unescapeJsonPointer =
|
|
4218
|
-
function
|
|
4219
|
-
if (Array.isArray(
|
|
4220
|
-
for (const A of
|
|
3762
|
+
e.unescapeJsonPointer = v;
|
|
3763
|
+
function w(b, O) {
|
|
3764
|
+
if (Array.isArray(b))
|
|
3765
|
+
for (const A of b)
|
|
4221
3766
|
O(A);
|
|
4222
3767
|
else
|
|
4223
|
-
O(
|
|
3768
|
+
O(b);
|
|
4224
3769
|
}
|
|
4225
|
-
e.eachItem =
|
|
4226
|
-
function
|
|
4227
|
-
return (
|
|
4228
|
-
const ie = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ?
|
|
4229
|
-
return ue === t.Name && !(ie instanceof t.Name) ? x
|
|
3770
|
+
e.eachItem = w;
|
|
3771
|
+
function P({ mergeNames: b, mergeToName: O, mergeValues: A, resultToName: V }) {
|
|
3772
|
+
return (x, re, K, ue) => {
|
|
3773
|
+
const ie = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? b(x, re, K) : O(x, re, K), K) : re instanceof t.Name ? (O(x, K, re), re) : A(re, K);
|
|
3774
|
+
return ue === t.Name && !(ie instanceof t.Name) ? V(x, ie) : ie;
|
|
4230
3775
|
};
|
|
4231
3776
|
}
|
|
4232
3777
|
e.mergeEvaluated = {
|
|
4233
|
-
props:
|
|
4234
|
-
mergeNames: (
|
|
4235
|
-
|
|
3778
|
+
props: P({
|
|
3779
|
+
mergeNames: (b, O, A) => b.if((0, t._)`${A} !== true && ${O} !== undefined`, () => {
|
|
3780
|
+
b.if((0, t._)`${O} === true`, () => b.assign(A, !0), () => b.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${O})`));
|
|
4236
3781
|
}),
|
|
4237
|
-
mergeToName: (
|
|
4238
|
-
O === !0 ?
|
|
3782
|
+
mergeToName: (b, O, A) => b.if((0, t._)`${A} !== true`, () => {
|
|
3783
|
+
O === !0 ? b.assign(A, !0) : (b.assign(A, (0, t._)`${A} || {}`), $(b, A, O));
|
|
4239
3784
|
}),
|
|
4240
|
-
mergeValues: (
|
|
3785
|
+
mergeValues: (b, O) => b === !0 ? !0 : { ...b, ...O },
|
|
4241
3786
|
resultToName: T
|
|
4242
3787
|
}),
|
|
4243
|
-
items:
|
|
4244
|
-
mergeNames: (
|
|
4245
|
-
mergeToName: (
|
|
4246
|
-
mergeValues: (
|
|
4247
|
-
resultToName: (
|
|
3788
|
+
items: P({
|
|
3789
|
+
mergeNames: (b, O, A) => b.if((0, t._)`${A} !== true && ${O} !== undefined`, () => b.assign(A, (0, t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),
|
|
3790
|
+
mergeToName: (b, O, A) => b.if((0, t._)`${A} !== true`, () => b.assign(A, O === !0 ? !0 : (0, t._)`${A} > ${O} ? ${A} : ${O}`)),
|
|
3791
|
+
mergeValues: (b, O) => b === !0 ? !0 : Math.max(b, O),
|
|
3792
|
+
resultToName: (b, O) => b.var("items", O)
|
|
4248
3793
|
})
|
|
4249
3794
|
};
|
|
4250
|
-
function T(
|
|
3795
|
+
function T(b, O) {
|
|
4251
3796
|
if (O === !0)
|
|
4252
|
-
return
|
|
4253
|
-
const A =
|
|
4254
|
-
return O !== void 0 && $(
|
|
3797
|
+
return b.var("props", !0);
|
|
3798
|
+
const A = b.var("props", (0, t._)`{}`);
|
|
3799
|
+
return O !== void 0 && $(b, A, O), A;
|
|
4255
3800
|
}
|
|
4256
3801
|
e.evaluatedPropsToName = T;
|
|
4257
|
-
function $(
|
|
4258
|
-
Object.keys(A).forEach((
|
|
3802
|
+
function $(b, O, A) {
|
|
3803
|
+
Object.keys(A).forEach((V) => b.assign((0, t._)`${O}${(0, t.getProperty)(V)}`, !0));
|
|
4259
3804
|
}
|
|
4260
3805
|
e.setEvaluated = $;
|
|
4261
3806
|
const g = {};
|
|
4262
|
-
function k(
|
|
4263
|
-
return
|
|
3807
|
+
function k(b, O) {
|
|
3808
|
+
return b.scopeValue("func", {
|
|
4264
3809
|
ref: O,
|
|
4265
3810
|
code: g[O.code] || (g[O.code] = new r._Code(O.code))
|
|
4266
3811
|
});
|
|
4267
3812
|
}
|
|
4268
3813
|
e.useFunc = k;
|
|
4269
3814
|
var C;
|
|
4270
|
-
(function(
|
|
4271
|
-
|
|
3815
|
+
(function(b) {
|
|
3816
|
+
b[b.Num = 0] = "Num", b[b.Str = 1] = "Str";
|
|
4272
3817
|
})(C = e.Type || (e.Type = {}));
|
|
4273
|
-
function I(
|
|
4274
|
-
if (
|
|
4275
|
-
const
|
|
4276
|
-
return A ?
|
|
3818
|
+
function I(b, O, A) {
|
|
3819
|
+
if (b instanceof t.Name) {
|
|
3820
|
+
const V = O === C.Num;
|
|
3821
|
+
return A ? V ? (0, t._)`"[" + ${b} + "]"` : (0, t._)`"['" + ${b} + "']"` : V ? (0, t._)`"/" + ${b}` : (0, t._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
4277
3822
|
}
|
|
4278
|
-
return A ? (0, t.getProperty)(
|
|
3823
|
+
return A ? (0, t.getProperty)(b).toString() : "/" + _(b);
|
|
4279
3824
|
}
|
|
4280
3825
|
e.getErrorPath = I;
|
|
4281
|
-
function D(
|
|
3826
|
+
function D(b, O, A = b.opts.strictSchema) {
|
|
4282
3827
|
if (A) {
|
|
4283
3828
|
if (O = `strict mode: ${O}`, A === !0)
|
|
4284
3829
|
throw new Error(O);
|
|
4285
|
-
|
|
3830
|
+
b.self.logger.warn(O);
|
|
4286
3831
|
}
|
|
4287
3832
|
}
|
|
4288
3833
|
e.checkStrictMode = D;
|
|
@@ -4322,13 +3867,13 @@ names$1.default = names;
|
|
|
4322
3867
|
message: ({ keyword: $, schemaType: g }) => g ? (0, t.str)`"${$}" keyword must be ${g} ($data)` : (0, t.str)`"${$}" keyword is invalid ($data)`
|
|
4323
3868
|
};
|
|
4324
3869
|
function s($, g = e.keywordError, k, C) {
|
|
4325
|
-
const { it: I } = $, { gen: D, compositeRule:
|
|
4326
|
-
C ?? (
|
|
3870
|
+
const { it: I } = $, { gen: D, compositeRule: b, allErrors: O } = I, A = _($, g, k);
|
|
3871
|
+
C ?? (b || O) ? p(D, A) : d(I, (0, t._)`[${A}]`);
|
|
4327
3872
|
}
|
|
4328
3873
|
e.reportError = s;
|
|
4329
3874
|
function o($, g = e.keywordError, k) {
|
|
4330
|
-
const { it: C } = $, { gen: I, compositeRule: D, allErrors:
|
|
4331
|
-
p(I, O), D ||
|
|
3875
|
+
const { it: C } = $, { gen: I, compositeRule: D, allErrors: b } = C, O = _($, g, k);
|
|
3876
|
+
p(I, O), D || b || d(C, n.default.vErrors);
|
|
4332
3877
|
}
|
|
4333
3878
|
e.reportExtraError = o;
|
|
4334
3879
|
function i($, g) {
|
|
@@ -4338,9 +3883,9 @@ names$1.default = names;
|
|
|
4338
3883
|
function l({ gen: $, keyword: g, schemaValue: k, data: C, errsCount: I, it: D }) {
|
|
4339
3884
|
if (I === void 0)
|
|
4340
3885
|
throw new Error("ajv implementation error");
|
|
4341
|
-
const
|
|
3886
|
+
const b = $.name("err");
|
|
4342
3887
|
$.forRange("i", I, n.default.errors, (O) => {
|
|
4343
|
-
$.const(
|
|
3888
|
+
$.const(b, (0, t._)`${n.default.vErrors}[${O}]`), $.if((0, t._)`${b}.instancePath === undefined`, () => $.assign((0, t._)`${b}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), $.assign((0, t._)`${b}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${g}`), D.opts.verbose && ($.assign((0, t._)`${b}.schema`, k), $.assign((0, t._)`${b}.data`, C));
|
|
4344
3889
|
});
|
|
4345
3890
|
}
|
|
4346
3891
|
e.extendErrors = l;
|
|
@@ -4361,28 +3906,28 @@ names$1.default = names;
|
|
|
4361
3906
|
schema: new t.Name("schema"),
|
|
4362
3907
|
parentSchema: new t.Name("parentSchema")
|
|
4363
3908
|
};
|
|
4364
|
-
function
|
|
3909
|
+
function _($, g, k) {
|
|
4365
3910
|
const { createErrors: C } = $.it;
|
|
4366
|
-
return C === !1 ? (0, t._)`{}` :
|
|
3911
|
+
return C === !1 ? (0, t._)`{}` : v($, g, k);
|
|
4367
3912
|
}
|
|
4368
|
-
function
|
|
3913
|
+
function v($, g, k = {}) {
|
|
4369
3914
|
const { gen: C, it: I } = $, D = [
|
|
4370
|
-
|
|
4371
|
-
|
|
3915
|
+
w(I, k),
|
|
3916
|
+
P($, k)
|
|
4372
3917
|
];
|
|
4373
3918
|
return T($, g, D), C.object(...D);
|
|
4374
3919
|
}
|
|
4375
|
-
function
|
|
3920
|
+
function w({ errorPath: $ }, { instancePath: g }) {
|
|
4376
3921
|
const k = g ? (0, t.str)`${$}${(0, r.getErrorPath)(g, r.Type.Str)}` : $;
|
|
4377
3922
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, k)];
|
|
4378
3923
|
}
|
|
4379
|
-
function
|
|
3924
|
+
function P({ keyword: $, it: { errSchemaPath: g } }, { schemaPath: k, parentSchema: C }) {
|
|
4380
3925
|
let I = C ? g : (0, t.str)`${g}/${$}`;
|
|
4381
3926
|
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [u.schemaPath, I];
|
|
4382
3927
|
}
|
|
4383
3928
|
function T($, { params: g, message: k }, C) {
|
|
4384
|
-
const { keyword: I, data: D, schemaValue:
|
|
4385
|
-
C.push([u.keyword, I], [u.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && C.push([u.message, typeof k == "function" ? k($) : k]), A.verbose && C.push([u.schema,
|
|
3929
|
+
const { keyword: I, data: D, schemaValue: b, it: O } = $, { opts: A, propertyName: V, topSchemaRef: x, schemaPath: re } = O;
|
|
3930
|
+
C.push([u.keyword, I], [u.params, typeof g == "function" ? g($) : g || (0, t._)`{}`]), A.messages && C.push([u.message, typeof k == "function" ? k($) : k]), A.verbose && C.push([u.schema, b], [u.parentSchema, (0, t._)`${x}${re}`], [n.default.data, D]), V && C.push([u.propertyName, V]);
|
|
4386
3931
|
}
|
|
4387
3932
|
})(errors);
|
|
4388
3933
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4482,58 +4027,58 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4482
4027
|
}
|
|
4483
4028
|
e.getJSONTypes = p;
|
|
4484
4029
|
function d(C, I) {
|
|
4485
|
-
const { gen: D, data:
|
|
4486
|
-
if (
|
|
4487
|
-
const
|
|
4488
|
-
D.if(
|
|
4489
|
-
A.length ?
|
|
4030
|
+
const { gen: D, data: b, opts: O } = C, A = _(I, O.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(C, I[0]));
|
|
4031
|
+
if (V) {
|
|
4032
|
+
const x = T(I, b, O.strictNumbers, i.Wrong);
|
|
4033
|
+
D.if(x, () => {
|
|
4034
|
+
A.length ? v(C, I, A) : g(C);
|
|
4490
4035
|
});
|
|
4491
4036
|
}
|
|
4492
|
-
return
|
|
4037
|
+
return V;
|
|
4493
4038
|
}
|
|
4494
4039
|
e.coerceAndCheckDataType = d;
|
|
4495
4040
|
const u = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4496
|
-
function
|
|
4041
|
+
function _(C, I) {
|
|
4497
4042
|
return I ? C.filter((D) => u.has(D) || I === "array" && D === "array") : [];
|
|
4498
4043
|
}
|
|
4499
|
-
function
|
|
4500
|
-
const { gen:
|
|
4501
|
-
A.coerceTypes === "array" &&
|
|
4044
|
+
function v(C, I, D) {
|
|
4045
|
+
const { gen: b, data: O, opts: A } = C, V = b.let("dataType", (0, s._)`typeof ${O}`), x = b.let("coerced", (0, s._)`undefined`);
|
|
4046
|
+
A.coerceTypes === "array" && b.if((0, s._)`${V} == 'object' && Array.isArray(${O}) && ${O}.length == 1`, () => b.assign(O, (0, s._)`${O}[0]`).assign(V, (0, s._)`typeof ${O}`).if(T(I, O, A.strictNumbers), () => b.assign(x, O))), b.if((0, s._)`${x} !== undefined`);
|
|
4502
4047
|
for (const K of D)
|
|
4503
4048
|
(u.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4504
|
-
|
|
4505
|
-
|
|
4049
|
+
b.else(), g(C), b.endIf(), b.if((0, s._)`${x} !== undefined`, () => {
|
|
4050
|
+
b.assign(O, x), w(C, x);
|
|
4506
4051
|
});
|
|
4507
4052
|
function re(K) {
|
|
4508
4053
|
switch (K) {
|
|
4509
4054
|
case "string":
|
|
4510
|
-
|
|
4055
|
+
b.elseIf((0, s._)`${V} == "number" || ${V} == "boolean"`).assign(x, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(x, (0, s._)`""`);
|
|
4511
4056
|
return;
|
|
4512
4057
|
case "number":
|
|
4513
|
-
|
|
4514
|
-
|| (${
|
|
4058
|
+
b.elseIf((0, s._)`${V} == "boolean" || ${O} === null
|
|
4059
|
+
|| (${V} == "string" && ${O} && ${O} == +${O})`).assign(x, (0, s._)`+${O}`);
|
|
4515
4060
|
return;
|
|
4516
4061
|
case "integer":
|
|
4517
|
-
|
|
4518
|
-
|| (${
|
|
4062
|
+
b.elseIf((0, s._)`${V} === "boolean" || ${O} === null
|
|
4063
|
+
|| (${V} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(x, (0, s._)`+${O}`);
|
|
4519
4064
|
return;
|
|
4520
4065
|
case "boolean":
|
|
4521
|
-
|
|
4066
|
+
b.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(x, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(x, !0);
|
|
4522
4067
|
return;
|
|
4523
4068
|
case "null":
|
|
4524
|
-
|
|
4069
|
+
b.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), b.assign(x, null);
|
|
4525
4070
|
return;
|
|
4526
4071
|
case "array":
|
|
4527
|
-
|
|
4528
|
-
|| ${
|
|
4072
|
+
b.elseIf((0, s._)`${V} === "string" || ${V} === "number"
|
|
4073
|
+
|| ${V} === "boolean" || ${O} === null`).assign(x, (0, s._)`[${O}]`);
|
|
4529
4074
|
}
|
|
4530
4075
|
}
|
|
4531
4076
|
}
|
|
4532
|
-
function
|
|
4533
|
-
C.if((0, s._)`${I} !== undefined`, () => C.assign((0, s._)`${I}[${D}]`,
|
|
4077
|
+
function w({ gen: C, parentData: I, parentDataProperty: D }, b) {
|
|
4078
|
+
C.if((0, s._)`${I} !== undefined`, () => C.assign((0, s._)`${I}[${D}]`, b));
|
|
4534
4079
|
}
|
|
4535
|
-
function
|
|
4536
|
-
const O =
|
|
4080
|
+
function P(C, I, D, b = i.Correct) {
|
|
4081
|
+
const O = b === i.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4537
4082
|
let A;
|
|
4538
4083
|
switch (C) {
|
|
4539
4084
|
case "null":
|
|
@@ -4545,33 +4090,33 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4545
4090
|
A = (0, s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;
|
|
4546
4091
|
break;
|
|
4547
4092
|
case "integer":
|
|
4548
|
-
A =
|
|
4093
|
+
A = V((0, s._)`!(${I} % 1) && !isNaN(${I})`);
|
|
4549
4094
|
break;
|
|
4550
4095
|
case "number":
|
|
4551
|
-
A =
|
|
4096
|
+
A = V();
|
|
4552
4097
|
break;
|
|
4553
4098
|
default:
|
|
4554
4099
|
return (0, s._)`typeof ${I} ${O} ${C}`;
|
|
4555
4100
|
}
|
|
4556
|
-
return
|
|
4557
|
-
function x
|
|
4558
|
-
return (0, s.and)((0, s._)`typeof ${I} == "number"`,
|
|
4101
|
+
return b === i.Correct ? A : (0, s.not)(A);
|
|
4102
|
+
function V(x = s.nil) {
|
|
4103
|
+
return (0, s.and)((0, s._)`typeof ${I} == "number"`, x, D ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4559
4104
|
}
|
|
4560
4105
|
}
|
|
4561
|
-
e.checkDataType =
|
|
4562
|
-
function T(C, I, D,
|
|
4106
|
+
e.checkDataType = P;
|
|
4107
|
+
function T(C, I, D, b) {
|
|
4563
4108
|
if (C.length === 1)
|
|
4564
|
-
return
|
|
4109
|
+
return P(C[0], I, D, b);
|
|
4565
4110
|
let O;
|
|
4566
4111
|
const A = (0, o.toHash)(C);
|
|
4567
4112
|
if (A.array && A.object) {
|
|
4568
|
-
const
|
|
4569
|
-
O = A.null ?
|
|
4113
|
+
const V = (0, s._)`typeof ${I} != "object"`;
|
|
4114
|
+
O = A.null ? V : (0, s._)`!${I} || ${V}`, delete A.null, delete A.array, delete A.object;
|
|
4570
4115
|
} else
|
|
4571
4116
|
O = s.nil;
|
|
4572
4117
|
A.number && delete A.integer;
|
|
4573
|
-
for (const
|
|
4574
|
-
O = (0, s.and)(O,
|
|
4118
|
+
for (const V in A)
|
|
4119
|
+
O = (0, s.and)(O, P(V, I, D, b));
|
|
4575
4120
|
return O;
|
|
4576
4121
|
}
|
|
4577
4122
|
e.checkDataTypes = T;
|
|
@@ -4585,15 +4130,15 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4585
4130
|
}
|
|
4586
4131
|
e.reportTypeError = g;
|
|
4587
4132
|
function k(C) {
|
|
4588
|
-
const { gen: I, data: D, schema:
|
|
4133
|
+
const { gen: I, data: D, schema: b } = C, O = (0, o.schemaRefOrVal)(C, b, "type");
|
|
4589
4134
|
return {
|
|
4590
4135
|
gen: I,
|
|
4591
4136
|
keyword: "type",
|
|
4592
4137
|
data: D,
|
|
4593
|
-
schema:
|
|
4138
|
+
schema: b.type,
|
|
4594
4139
|
schemaCode: O,
|
|
4595
4140
|
schemaValue: O,
|
|
4596
|
-
parentSchema:
|
|
4141
|
+
parentSchema: b,
|
|
4597
4142
|
params: {},
|
|
4598
4143
|
it: C
|
|
4599
4144
|
};
|
|
@@ -4674,15 +4219,15 @@ function schemaProperties(e, t) {
|
|
|
4674
4219
|
}
|
|
4675
4220
|
code.schemaProperties = schemaProperties;
|
|
4676
4221
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: o }, it: i }, l, p, d) {
|
|
4677
|
-
const u = d ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4222
|
+
const u = d ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, _ = [
|
|
4678
4223
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, o)],
|
|
4679
4224
|
[names_1$5.default.parentData, i.parentData],
|
|
4680
4225
|
[names_1$5.default.parentDataProperty, i.parentDataProperty],
|
|
4681
4226
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4682
4227
|
];
|
|
4683
|
-
i.opts.dynamicRef &&
|
|
4684
|
-
const
|
|
4685
|
-
return p !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${p}, ${
|
|
4228
|
+
i.opts.dynamicRef && _.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4229
|
+
const v = (0, codegen_1$q._)`${u}, ${r.object(..._)}`;
|
|
4230
|
+
return p !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${p}, ${v})` : (0, codegen_1$q._)`${l}(${v})`;
|
|
4686
4231
|
}
|
|
4687
4232
|
code.callValidateCode = callValidateCode;
|
|
4688
4233
|
const newRegExp = (0, codegen_1$q._)`new RegExp`;
|
|
@@ -4751,31 +4296,31 @@ function funcKeywordCode(e, t) {
|
|
|
4751
4296
|
var r;
|
|
4752
4297
|
const { gen: n, keyword: s, schema: o, parentSchema: i, $data: l, it: p } = e;
|
|
4753
4298
|
checkAsyncKeyword(p, t);
|
|
4754
|
-
const d = !l && t.compile ? t.compile.call(p.self, o, i, p) : t.validate, u = useKeyword(n, s, d),
|
|
4755
|
-
e.block$data(
|
|
4756
|
-
function
|
|
4299
|
+
const d = !l && t.compile ? t.compile.call(p.self, o, i, p) : t.validate, u = useKeyword(n, s, d), _ = n.let("valid");
|
|
4300
|
+
e.block$data(_, v), e.ok((r = t.valid) !== null && r !== void 0 ? r : _);
|
|
4301
|
+
function v() {
|
|
4757
4302
|
if (t.errors === !1)
|
|
4758
4303
|
T(), t.modifying && modifyData(e), $(() => e.error());
|
|
4759
4304
|
else {
|
|
4760
|
-
const g = t.async ?
|
|
4305
|
+
const g = t.async ? w() : P();
|
|
4761
4306
|
t.modifying && modifyData(e), $(() => addErrs(e, g));
|
|
4762
4307
|
}
|
|
4763
4308
|
}
|
|
4764
|
-
function
|
|
4309
|
+
function w() {
|
|
4765
4310
|
const g = n.let("ruleErrs", null);
|
|
4766
|
-
return n.try(() => T((0, codegen_1$p._)`await `), (k) => n.assign(
|
|
4311
|
+
return n.try(() => T((0, codegen_1$p._)`await `), (k) => n.assign(_, !1).if((0, codegen_1$p._)`${k} instanceof ${p.ValidationError}`, () => n.assign(g, (0, codegen_1$p._)`${k}.errors`), () => n.throw(k))), g;
|
|
4767
4312
|
}
|
|
4768
|
-
function
|
|
4313
|
+
function P() {
|
|
4769
4314
|
const g = (0, codegen_1$p._)`${u}.errors`;
|
|
4770
4315
|
return n.assign(g, null), T(codegen_1$p.nil), g;
|
|
4771
4316
|
}
|
|
4772
4317
|
function T(g = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4773
4318
|
const k = p.opts.passContext ? names_1$4.default.this : names_1$4.default.self, C = !("compile" in t && !l || t.schema === !1);
|
|
4774
|
-
n.assign(
|
|
4319
|
+
n.assign(_, (0, codegen_1$p._)`${g}${(0, code_1$9.callValidateCode)(e, u, k, C)}`, t.modifying);
|
|
4775
4320
|
}
|
|
4776
4321
|
function $(g) {
|
|
4777
4322
|
var k;
|
|
4778
|
-
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k :
|
|
4323
|
+
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k : _), g);
|
|
4779
4324
|
}
|
|
4780
4325
|
}
|
|
4781
4326
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4854,8 +4399,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4854
4399
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4855
4400
|
const { gen: l } = t;
|
|
4856
4401
|
if (r !== void 0) {
|
|
4857
|
-
const { errorPath: d, dataPathArr: u, opts:
|
|
4858
|
-
p(
|
|
4402
|
+
const { errorPath: d, dataPathArr: u, opts: _ } = t, v = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4403
|
+
p(v), e.errorPath = (0, codegen_1$o.str)`${d}${(0, util_1$n.getErrorPath)(r, n, _.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...u, e.parentDataProperty];
|
|
4859
4404
|
}
|
|
4860
4405
|
if (s !== void 0) {
|
|
4861
4406
|
const d = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
@@ -4960,17 +4505,17 @@ function _traverse(e, t, r, n, s, o, i, l, p, d) {
|
|
|
4960
4505
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4961
4506
|
t(n, s, o, i, l, p, d);
|
|
4962
4507
|
for (var u in n) {
|
|
4963
|
-
var
|
|
4964
|
-
if (Array.isArray(
|
|
4508
|
+
var _ = n[u];
|
|
4509
|
+
if (Array.isArray(_)) {
|
|
4965
4510
|
if (u in traverse$1.arrayKeywords)
|
|
4966
|
-
for (var
|
|
4967
|
-
_traverse(e, t, r,
|
|
4511
|
+
for (var v = 0; v < _.length; v++)
|
|
4512
|
+
_traverse(e, t, r, _[v], s + "/" + u + "/" + v, o, s, u, n, v);
|
|
4968
4513
|
} else if (u in traverse$1.propsKeywords) {
|
|
4969
|
-
if (
|
|
4970
|
-
for (var
|
|
4971
|
-
_traverse(e, t, r,
|
|
4514
|
+
if (_ && typeof _ == "object")
|
|
4515
|
+
for (var w in _)
|
|
4516
|
+
_traverse(e, t, r, _[w], s + "/" + u + "/" + escapeJsonPtr(w), o, s, u, n, w);
|
|
4972
4517
|
} else
|
|
4973
|
-
(u in traverse$1.keywords || e.allKeys && !(u in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4518
|
+
(u in traverse$1.keywords || e.allKeys && !(u in traverse$1.skipKeywords)) && _traverse(e, t, r, _, s + "/" + u, o, s, u, n);
|
|
4974
4519
|
}
|
|
4975
4520
|
r(n, s, o, i, l, p, d);
|
|
4976
4521
|
}
|
|
@@ -5054,19 +4599,19 @@ function getSchemaRefs(e, t) {
|
|
|
5054
4599
|
if (typeof e == "boolean")
|
|
5055
4600
|
return {};
|
|
5056
4601
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), o = { "": s }, i = getFullPath(n, s, !1), l = {}, p = /* @__PURE__ */ new Set();
|
|
5057
|
-
return traverse(e, { allKeys: !0 }, (
|
|
5058
|
-
if (
|
|
4602
|
+
return traverse(e, { allKeys: !0 }, (_, v, w, P) => {
|
|
4603
|
+
if (P === void 0)
|
|
5059
4604
|
return;
|
|
5060
|
-
const T = i +
|
|
5061
|
-
let $ = o[
|
|
5062
|
-
typeof
|
|
4605
|
+
const T = i + v;
|
|
4606
|
+
let $ = o[P];
|
|
4607
|
+
typeof _[r] == "string" && ($ = g.call(this, _[r])), k.call(this, _.$anchor), k.call(this, _.$dynamicAnchor), o[v] = $;
|
|
5063
4608
|
function g(C) {
|
|
5064
4609
|
const I = this.opts.uriResolver.resolve;
|
|
5065
4610
|
if (C = normalizeId($ ? I($, C) : C), p.has(C))
|
|
5066
4611
|
throw u(C);
|
|
5067
4612
|
p.add(C);
|
|
5068
4613
|
let D = this.refs[C];
|
|
5069
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? d(
|
|
4614
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? d(_, D.schema, C) : C !== normalizeId(T) && (C[0] === "#" ? (d(_, l[C], C), l[C] = _) : this.refs[C] = T), C;
|
|
5070
4615
|
}
|
|
5071
4616
|
function k(C) {
|
|
5072
4617
|
if (typeof C == "string") {
|
|
@@ -5076,12 +4621,12 @@ function getSchemaRefs(e, t) {
|
|
|
5076
4621
|
}
|
|
5077
4622
|
}
|
|
5078
4623
|
}), l;
|
|
5079
|
-
function d(
|
|
5080
|
-
if (
|
|
5081
|
-
throw u(
|
|
4624
|
+
function d(_, v, w) {
|
|
4625
|
+
if (v !== void 0 && !equal$2(_, v))
|
|
4626
|
+
throw u(w);
|
|
5082
4627
|
}
|
|
5083
|
-
function u(
|
|
5084
|
-
return new Error(`reference "${
|
|
4628
|
+
function u(_) {
|
|
4629
|
+
return new Error(`reference "${_}" resolves to more than one schema`);
|
|
5085
4630
|
}
|
|
5086
4631
|
}
|
|
5087
4632
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -5197,12 +4742,12 @@ function schemaKeywords(e, t, r, n) {
|
|
|
5197
4742
|
return;
|
|
5198
4743
|
}
|
|
5199
4744
|
p.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
5200
|
-
for (const
|
|
5201
|
-
|
|
5202
|
-
|
|
4745
|
+
for (const v of u.rules)
|
|
4746
|
+
_(v);
|
|
4747
|
+
_(u.post);
|
|
5203
4748
|
});
|
|
5204
|
-
function
|
|
5205
|
-
(0, applicability_1.shouldUseGroup)(o,
|
|
4749
|
+
function _(v) {
|
|
4750
|
+
(0, applicability_1.shouldUseGroup)(o, v) && (v.type ? (s.if((0, dataType_2.checkDataType)(v.type, i, p.strictNumbers)), iterateKeywords(e, v), t.length === 1 && t[0] === v.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, v), l || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
5206
4751
|
}
|
|
5207
4752
|
}
|
|
5208
4753
|
function iterateKeywords(e, t) {
|
|
@@ -5464,21 +5009,21 @@ function compileSchema(e) {
|
|
|
5464
5009
|
let u;
|
|
5465
5010
|
try {
|
|
5466
5011
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(d), i.optimize(this.opts.code.optimize);
|
|
5467
|
-
const
|
|
5468
|
-
u = `${i.scopeRefs(names_1$2.default.scope)}return ${
|
|
5469
|
-
const
|
|
5470
|
-
if (this.scope.value(p, { ref:
|
|
5471
|
-
const { props:
|
|
5472
|
-
|
|
5473
|
-
props:
|
|
5012
|
+
const _ = i.toString();
|
|
5013
|
+
u = `${i.scopeRefs(names_1$2.default.scope)}return ${_}`, this.opts.code.process && (u = this.opts.code.process(u, e));
|
|
5014
|
+
const w = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, u)(this, this.scope.get());
|
|
5015
|
+
if (this.scope.value(p, { ref: w }), w.errors = null, w.schema = e.schema, w.schemaEnv = e, e.$async && (w.$async = !0), this.opts.code.source === !0 && (w.source = { validateName: p, validateCode: _, scopeValues: i._values }), this.opts.unevaluated) {
|
|
5016
|
+
const { props: P, items: T } = d;
|
|
5017
|
+
w.evaluated = {
|
|
5018
|
+
props: P instanceof codegen_1$m.Name ? void 0 : P,
|
|
5474
5019
|
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5475
|
-
dynamicProps:
|
|
5020
|
+
dynamicProps: P instanceof codegen_1$m.Name,
|
|
5476
5021
|
dynamicItems: T instanceof codegen_1$m.Name
|
|
5477
|
-
},
|
|
5022
|
+
}, w.source && (w.source.evaluated = (0, codegen_1$m.stringify)(w.evaluated));
|
|
5478
5023
|
}
|
|
5479
|
-
return e.validate =
|
|
5480
|
-
} catch (
|
|
5481
|
-
throw delete e.validate, delete e.validateName, u && this.logger.error("Error compiling schema, function code:", u),
|
|
5024
|
+
return e.validate = w, e;
|
|
5025
|
+
} catch (_) {
|
|
5026
|
+
throw delete e.validate, delete e.validateName, u && this.logger.error("Error compiling schema, function code:", u), _;
|
|
5482
5027
|
} finally {
|
|
5483
5028
|
this._compilations.delete(e);
|
|
5484
5029
|
}
|
|
@@ -5595,13 +5140,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5595
5140
|
n(t);
|
|
5596
5141
|
})(commonjsGlobal, function(r) {
|
|
5597
5142
|
function n() {
|
|
5598
|
-
for (var f = arguments.length, c = Array(f),
|
|
5599
|
-
c[
|
|
5143
|
+
for (var f = arguments.length, c = Array(f), m = 0; m < f; m++)
|
|
5144
|
+
c[m] = arguments[m];
|
|
5600
5145
|
if (c.length > 1) {
|
|
5601
5146
|
c[0] = c[0].slice(0, -1);
|
|
5602
|
-
for (var
|
|
5603
|
-
c[
|
|
5604
|
-
return c[
|
|
5147
|
+
for (var R = c.length - 1, S = 1; S < R; ++S)
|
|
5148
|
+
c[S] = c[S].slice(1, -1);
|
|
5149
|
+
return c[R] = c[R].slice(1), c.join("");
|
|
5605
5150
|
} else
|
|
5606
5151
|
return c[0];
|
|
5607
5152
|
}
|
|
@@ -5618,20 +5163,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5618
5163
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5619
5164
|
}
|
|
5620
5165
|
function p(f, c) {
|
|
5621
|
-
var
|
|
5166
|
+
var m = f;
|
|
5622
5167
|
if (c)
|
|
5623
|
-
for (var
|
|
5624
|
-
|
|
5625
|
-
return
|
|
5168
|
+
for (var R in c)
|
|
5169
|
+
m[R] = c[R];
|
|
5170
|
+
return m;
|
|
5626
5171
|
}
|
|
5627
5172
|
function d(f) {
|
|
5628
|
-
var c = "[A-Za-z]",
|
|
5629
|
-
s(c + n(c,
|
|
5630
|
-
var
|
|
5631
|
-
s("[vV]" +
|
|
5632
|
-
var ct = s(
|
|
5633
|
-
return s(s(
|
|
5634
|
-
NOT_SCHEME: new RegExp(n("[^]", c,
|
|
5173
|
+
var c = "[A-Za-z]", m = "[0-9]", R = n(m, "[A-Fa-f]"), S = s(s("%[EFef]" + R + "%" + R + R + "%" + R + R) + "|" + s("%[89A-Fa-f]" + R + "%" + R + R) + "|" + s("%" + R + R)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(U, L), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Y);
|
|
5174
|
+
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(S + "|" + n(B, L, "[\\:]")) + "*");
|
|
5175
|
+
var Q = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), oe = s(Q + "\\." + Q + "\\." + Q + "\\." + Q), z = s(R + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + oe), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Ee = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), ge = s(s(s(z + "\\:") + "{0,1}" + z) + "?\\:\\:" + s(z + "\\:") + "{3}" + X), $e = s(s(s(z + "\\:") + "{0,2}" + z) + "?\\:\\:" + s(z + "\\:") + "{2}" + X), Be = s(s(s(z + "\\:") + "{0,3}" + z) + "?\\:\\:" + z + "\\:" + X), Ie = s(s(s(z + "\\:") + "{0,4}" + z) + "?\\:\\:" + X), fe = s(s(s(z + "\\:") + "{0,5}" + z) + "?\\:\\:" + z), ye = s(s(s(z + "\\:") + "{0,6}" + z) + "?\\:\\:"), je = s([ae, ee, Ee, ge, $e, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + S) + "+");
|
|
5176
|
+
s("[vV]" + R + "+\\." + n(B, L, "[\\:]") + "+"), s(s(S + "|" + n(B, L)) + "*");
|
|
5177
|
+
var ct = s(S + "|" + n(B, L, "[\\:\\@]"));
|
|
5178
|
+
return s(s(S + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5179
|
+
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
5635
5180
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, L), "g"),
|
|
5636
5181
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, L), "g"),
|
|
5637
5182
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, L), "g"),
|
|
@@ -5641,123 +5186,123 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5641
5186
|
ESCAPE: new RegExp(n("[^]", B, L), "g"),
|
|
5642
5187
|
UNRESERVED: new RegExp(B, "g"),
|
|
5643
5188
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5644
|
-
PCT_ENCODED: new RegExp(
|
|
5189
|
+
PCT_ENCODED: new RegExp(S, "g"),
|
|
5645
5190
|
IPV4ADDRESS: new RegExp("^(" + oe + ")$"),
|
|
5646
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5191
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + R + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5647
5192
|
//RFC 6874, with relaxed parsing rules
|
|
5648
5193
|
};
|
|
5649
5194
|
}
|
|
5650
|
-
var u = d(!1),
|
|
5651
|
-
function f(c,
|
|
5652
|
-
var
|
|
5195
|
+
var u = d(!1), _ = d(!0), v = function() {
|
|
5196
|
+
function f(c, m) {
|
|
5197
|
+
var R = [], S = !0, U = !1, L = void 0;
|
|
5653
5198
|
try {
|
|
5654
|
-
for (var J = c[Symbol.iterator](), Y; !(
|
|
5199
|
+
for (var J = c[Symbol.iterator](), Y; !(S = (Y = J.next()).done) && (R.push(Y.value), !(m && R.length === m)); S = !0)
|
|
5655
5200
|
;
|
|
5656
5201
|
} catch (se) {
|
|
5657
5202
|
U = !0, L = se;
|
|
5658
5203
|
} finally {
|
|
5659
5204
|
try {
|
|
5660
|
-
!
|
|
5205
|
+
!S && J.return && J.return();
|
|
5661
5206
|
} finally {
|
|
5662
5207
|
if (U)
|
|
5663
5208
|
throw L;
|
|
5664
5209
|
}
|
|
5665
5210
|
}
|
|
5666
|
-
return
|
|
5211
|
+
return R;
|
|
5667
5212
|
}
|
|
5668
|
-
return function(c,
|
|
5213
|
+
return function(c, m) {
|
|
5669
5214
|
if (Array.isArray(c))
|
|
5670
5215
|
return c;
|
|
5671
5216
|
if (Symbol.iterator in Object(c))
|
|
5672
|
-
return f(c,
|
|
5217
|
+
return f(c, m);
|
|
5673
5218
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5674
5219
|
};
|
|
5675
|
-
}(),
|
|
5220
|
+
}(), w = function(f) {
|
|
5676
5221
|
if (Array.isArray(f)) {
|
|
5677
|
-
for (var c = 0,
|
|
5678
|
-
|
|
5679
|
-
return
|
|
5222
|
+
for (var c = 0, m = Array(f.length); c < f.length; c++)
|
|
5223
|
+
m[c] = f[c];
|
|
5224
|
+
return m;
|
|
5680
5225
|
} else
|
|
5681
5226
|
return Array.from(f);
|
|
5682
|
-
},
|
|
5227
|
+
}, P = 2147483647, T = 36, $ = 1, g = 26, k = 38, C = 700, I = 72, D = 128, b = "-", O = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
5683
5228
|
overflow: "Overflow: input needs wider integers to process",
|
|
5684
5229
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5685
5230
|
"invalid-input": "Invalid input"
|
|
5686
5231
|
}, re = T - $, K = Math.floor, ue = String.fromCharCode;
|
|
5687
5232
|
function ie(f) {
|
|
5688
|
-
throw new RangeError(
|
|
5233
|
+
throw new RangeError(x[f]);
|
|
5689
5234
|
}
|
|
5690
5235
|
function ke(f, c) {
|
|
5691
|
-
for (var
|
|
5692
|
-
|
|
5693
|
-
return
|
|
5236
|
+
for (var m = [], R = f.length; R--; )
|
|
5237
|
+
m[R] = c(f[R]);
|
|
5238
|
+
return m;
|
|
5694
5239
|
}
|
|
5695
5240
|
function Ce(f, c) {
|
|
5696
|
-
var
|
|
5697
|
-
|
|
5698
|
-
var
|
|
5699
|
-
return
|
|
5241
|
+
var m = f.split("@"), R = "";
|
|
5242
|
+
m.length > 1 && (R = m[0] + "@", f = m[1]), f = f.replace(V, ".");
|
|
5243
|
+
var S = f.split("."), U = ke(S, c).join(".");
|
|
5244
|
+
return R + U;
|
|
5700
5245
|
}
|
|
5701
5246
|
function qe(f) {
|
|
5702
|
-
for (var c = [],
|
|
5703
|
-
var
|
|
5704
|
-
if (
|
|
5705
|
-
var U = f.charCodeAt(
|
|
5706
|
-
(U & 64512) == 56320 ? c.push(((
|
|
5247
|
+
for (var c = [], m = 0, R = f.length; m < R; ) {
|
|
5248
|
+
var S = f.charCodeAt(m++);
|
|
5249
|
+
if (S >= 55296 && S <= 56319 && m < R) {
|
|
5250
|
+
var U = f.charCodeAt(m++);
|
|
5251
|
+
(U & 64512) == 56320 ? c.push(((S & 1023) << 10) + (U & 1023) + 65536) : (c.push(S), m--);
|
|
5707
5252
|
} else
|
|
5708
|
-
c.push(
|
|
5253
|
+
c.push(S);
|
|
5709
5254
|
}
|
|
5710
5255
|
return c;
|
|
5711
5256
|
}
|
|
5712
5257
|
var et = function(c) {
|
|
5713
|
-
return String.fromCodePoint.apply(String,
|
|
5714
|
-
},
|
|
5258
|
+
return String.fromCodePoint.apply(String, w(c));
|
|
5259
|
+
}, Ue = function(c) {
|
|
5715
5260
|
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5716
|
-
}, F = function(c,
|
|
5717
|
-
return c + 22 + 75 * (c < 26) - ((
|
|
5718
|
-
}, y = function(c,
|
|
5719
|
-
var
|
|
5261
|
+
}, F = function(c, m) {
|
|
5262
|
+
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5263
|
+
}, y = function(c, m, R) {
|
|
5264
|
+
var S = 0;
|
|
5720
5265
|
for (
|
|
5721
|
-
c =
|
|
5266
|
+
c = R ? K(c / C) : c >> 1, c += K(c / m);
|
|
5722
5267
|
/* no initialization */
|
|
5723
5268
|
c > re * g >> 1;
|
|
5724
|
-
|
|
5269
|
+
S += T
|
|
5725
5270
|
)
|
|
5726
5271
|
c = K(c / re);
|
|
5727
|
-
return K(
|
|
5272
|
+
return K(S + (re + 1) * c / (c + k));
|
|
5728
5273
|
}, j = function(c) {
|
|
5729
|
-
var
|
|
5274
|
+
var m = [], R = c.length, S = 0, U = D, L = I, J = c.lastIndexOf(b);
|
|
5730
5275
|
J < 0 && (J = 0);
|
|
5731
5276
|
for (var Y = 0; Y < J; ++Y)
|
|
5732
|
-
c.charCodeAt(Y) >= 128 && ie("not-basic"),
|
|
5733
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5277
|
+
c.charCodeAt(Y) >= 128 && ie("not-basic"), m.push(c.charCodeAt(Y));
|
|
5278
|
+
for (var se = J > 0 ? J + 1 : 0; se < R; ) {
|
|
5734
5279
|
for (
|
|
5735
|
-
var B =
|
|
5280
|
+
var B = S, Q = 1, oe = T;
|
|
5736
5281
|
;
|
|
5737
5282
|
/* no condition */
|
|
5738
5283
|
oe += T
|
|
5739
5284
|
) {
|
|
5740
|
-
se >=
|
|
5741
|
-
var
|
|
5742
|
-
(
|
|
5285
|
+
se >= R && ie("invalid-input");
|
|
5286
|
+
var z = Ue(c.charCodeAt(se++));
|
|
5287
|
+
(z >= T || z > K((P - S) / Q)) && ie("overflow"), S += z * Q;
|
|
5743
5288
|
var X = oe <= L ? $ : oe >= L + g ? g : oe - L;
|
|
5744
|
-
if (
|
|
5289
|
+
if (z < X)
|
|
5745
5290
|
break;
|
|
5746
5291
|
var ae = T - X;
|
|
5747
|
-
|
|
5292
|
+
Q > K(P / ae) && ie("overflow"), Q *= ae;
|
|
5748
5293
|
}
|
|
5749
|
-
var ee =
|
|
5750
|
-
L = y(
|
|
5294
|
+
var ee = m.length + 1;
|
|
5295
|
+
L = y(S - B, ee, B == 0), K(S / ee) > P - U && ie("overflow"), U += K(S / ee), S %= ee, m.splice(S++, 0, U);
|
|
5751
5296
|
}
|
|
5752
|
-
return String.fromCodePoint.apply(String,
|
|
5753
|
-
},
|
|
5754
|
-
var
|
|
5297
|
+
return String.fromCodePoint.apply(String, m);
|
|
5298
|
+
}, E = function(c) {
|
|
5299
|
+
var m = [];
|
|
5755
5300
|
c = qe(c);
|
|
5756
|
-
var
|
|
5301
|
+
var R = c.length, S = D, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5757
5302
|
try {
|
|
5758
|
-
for (var B = c[Symbol.iterator](),
|
|
5759
|
-
var oe =
|
|
5760
|
-
oe < 128 &&
|
|
5303
|
+
for (var B = c[Symbol.iterator](), Q; !(J = (Q = B.next()).done); J = !0) {
|
|
5304
|
+
var oe = Q.value;
|
|
5305
|
+
oe < 128 && m.push(ue(oe));
|
|
5761
5306
|
}
|
|
5762
5307
|
} catch (lt) {
|
|
5763
5308
|
Y = !0, se = lt;
|
|
@@ -5769,13 +5314,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5769
5314
|
throw se;
|
|
5770
5315
|
}
|
|
5771
5316
|
}
|
|
5772
|
-
var
|
|
5773
|
-
for (
|
|
5774
|
-
var ae =
|
|
5317
|
+
var z = m.length, X = z;
|
|
5318
|
+
for (z && m.push(b); X < R; ) {
|
|
5319
|
+
var ae = P, ee = !0, Ee = !1, ge = void 0;
|
|
5775
5320
|
try {
|
|
5776
|
-
for (var $e = c[Symbol.iterator](),
|
|
5777
|
-
var Ie =
|
|
5778
|
-
Ie >=
|
|
5321
|
+
for (var $e = c[Symbol.iterator](), Be; !(ee = (Be = $e.next()).done); ee = !0) {
|
|
5322
|
+
var Ie = Be.value;
|
|
5323
|
+
Ie >= S && Ie < ae && (ae = Ie);
|
|
5779
5324
|
}
|
|
5780
5325
|
} catch (lt) {
|
|
5781
5326
|
Ee = !0, ge = lt;
|
|
@@ -5788,12 +5333,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5788
5333
|
}
|
|
5789
5334
|
}
|
|
5790
5335
|
var fe = X + 1;
|
|
5791
|
-
ae -
|
|
5792
|
-
var ye = !0, je = !1,
|
|
5336
|
+
ae - S > K((P - U) / fe) && ie("overflow"), U += (ae - S) * fe, S = ae;
|
|
5337
|
+
var ye = !0, je = !1, we = void 0;
|
|
5793
5338
|
try {
|
|
5794
5339
|
for (var ct = c[Symbol.iterator](), Lt; !(ye = (Lt = ct.next()).done); ye = !0) {
|
|
5795
5340
|
var Ht = Lt.value;
|
|
5796
|
-
if (Ht <
|
|
5341
|
+
if (Ht < S && ++U > P && ie("overflow"), Ht == S) {
|
|
5797
5342
|
for (
|
|
5798
5343
|
var pt = U, ft = T;
|
|
5799
5344
|
;
|
|
@@ -5803,32 +5348,32 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5803
5348
|
var ht = ft <= L ? $ : ft >= L + g ? g : ft - L;
|
|
5804
5349
|
if (pt < ht)
|
|
5805
5350
|
break;
|
|
5806
|
-
var
|
|
5807
|
-
|
|
5351
|
+
var Vt = pt - ht, zt = T - ht;
|
|
5352
|
+
m.push(ue(F(ht + Vt % zt, 0))), pt = K(Vt / zt);
|
|
5808
5353
|
}
|
|
5809
|
-
|
|
5354
|
+
m.push(ue(F(pt, 0))), L = y(U, fe, X == z), U = 0, ++X;
|
|
5810
5355
|
}
|
|
5811
5356
|
}
|
|
5812
5357
|
} catch (lt) {
|
|
5813
|
-
je = !0,
|
|
5358
|
+
je = !0, we = lt;
|
|
5814
5359
|
} finally {
|
|
5815
5360
|
try {
|
|
5816
5361
|
!ye && ct.return && ct.return();
|
|
5817
5362
|
} finally {
|
|
5818
5363
|
if (je)
|
|
5819
|
-
throw
|
|
5364
|
+
throw we;
|
|
5820
5365
|
}
|
|
5821
5366
|
}
|
|
5822
|
-
++U, ++
|
|
5367
|
+
++U, ++S;
|
|
5823
5368
|
}
|
|
5824
|
-
return
|
|
5369
|
+
return m.join("");
|
|
5825
5370
|
}, a = function(c) {
|
|
5826
|
-
return Ce(c, function(
|
|
5827
|
-
return O.test(
|
|
5371
|
+
return Ce(c, function(m) {
|
|
5372
|
+
return O.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5828
5373
|
});
|
|
5829
5374
|
}, h = function(c) {
|
|
5830
|
-
return Ce(c, function(
|
|
5831
|
-
return A.test(
|
|
5375
|
+
return Ce(c, function(m) {
|
|
5376
|
+
return A.test(m) ? "xn--" + E(m) : m;
|
|
5832
5377
|
});
|
|
5833
5378
|
}, N = {
|
|
5834
5379
|
/**
|
|
@@ -5849,70 +5394,70 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5849
5394
|
encode: et
|
|
5850
5395
|
},
|
|
5851
5396
|
decode: j,
|
|
5852
|
-
encode:
|
|
5397
|
+
encode: E,
|
|
5853
5398
|
toASCII: h,
|
|
5854
5399
|
toUnicode: a
|
|
5855
|
-
},
|
|
5856
|
-
function
|
|
5857
|
-
var c = f.charCodeAt(0),
|
|
5858
|
-
return c < 16 ?
|
|
5400
|
+
}, M = {};
|
|
5401
|
+
function q(f) {
|
|
5402
|
+
var c = f.charCodeAt(0), m = void 0;
|
|
5403
|
+
return c < 16 ? m = "%0" + c.toString(16).toUpperCase() : c < 128 ? m = "%" + c.toString(16).toUpperCase() : c < 2048 ? m = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase() : m = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(), m;
|
|
5859
5404
|
}
|
|
5860
5405
|
function W(f) {
|
|
5861
|
-
for (var c = "",
|
|
5862
|
-
var
|
|
5863
|
-
if (
|
|
5864
|
-
c += String.fromCharCode(
|
|
5865
|
-
else if (
|
|
5866
|
-
if (
|
|
5867
|
-
var U = parseInt(f.substr(
|
|
5868
|
-
c += String.fromCharCode((
|
|
5406
|
+
for (var c = "", m = 0, R = f.length; m < R; ) {
|
|
5407
|
+
var S = parseInt(f.substr(m + 1, 2), 16);
|
|
5408
|
+
if (S < 128)
|
|
5409
|
+
c += String.fromCharCode(S), m += 3;
|
|
5410
|
+
else if (S >= 194 && S < 224) {
|
|
5411
|
+
if (R - m >= 6) {
|
|
5412
|
+
var U = parseInt(f.substr(m + 4, 2), 16);
|
|
5413
|
+
c += String.fromCharCode((S & 31) << 6 | U & 63);
|
|
5869
5414
|
} else
|
|
5870
|
-
c += f.substr(
|
|
5871
|
-
|
|
5872
|
-
} else if (
|
|
5873
|
-
if (
|
|
5874
|
-
var L = parseInt(f.substr(
|
|
5875
|
-
c += String.fromCharCode((
|
|
5415
|
+
c += f.substr(m, 6);
|
|
5416
|
+
m += 6;
|
|
5417
|
+
} else if (S >= 224) {
|
|
5418
|
+
if (R - m >= 9) {
|
|
5419
|
+
var L = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
|
|
5420
|
+
c += String.fromCharCode((S & 15) << 12 | (L & 63) << 6 | J & 63);
|
|
5876
5421
|
} else
|
|
5877
|
-
c += f.substr(
|
|
5878
|
-
|
|
5422
|
+
c += f.substr(m, 9);
|
|
5423
|
+
m += 9;
|
|
5879
5424
|
} else
|
|
5880
|
-
c += f.substr(
|
|
5425
|
+
c += f.substr(m, 3), m += 3;
|
|
5881
5426
|
}
|
|
5882
5427
|
return c;
|
|
5883
5428
|
}
|
|
5884
5429
|
function G(f, c) {
|
|
5885
|
-
function
|
|
5886
|
-
var
|
|
5887
|
-
return
|
|
5430
|
+
function m(R) {
|
|
5431
|
+
var S = W(R);
|
|
5432
|
+
return S.match(c.UNRESERVED) ? S : R;
|
|
5888
5433
|
}
|
|
5889
|
-
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED,
|
|
5434
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(c.PCT_ENCODED, m).replace(c.NOT_USERINFO, q).replace(c.PCT_ENCODED, i)), f.host !== void 0 && (f.host = String(f.host).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_HOST, q).replace(c.PCT_ENCODED, i)), f.path !== void 0 && (f.path = String(f.path).replace(c.PCT_ENCODED, m).replace(f.scheme ? c.NOT_PATH : c.NOT_PATH_NOSCHEME, q).replace(c.PCT_ENCODED, i)), f.query !== void 0 && (f.query = String(f.query).replace(c.PCT_ENCODED, m).replace(c.NOT_QUERY, q).replace(c.PCT_ENCODED, i)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(c.PCT_ENCODED, m).replace(c.NOT_FRAGMENT, q).replace(c.PCT_ENCODED, i)), f;
|
|
5890
5435
|
}
|
|
5891
5436
|
function ne(f) {
|
|
5892
5437
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5893
5438
|
}
|
|
5894
5439
|
function he(f, c) {
|
|
5895
|
-
var
|
|
5896
|
-
return
|
|
5897
|
-
}
|
|
5898
|
-
function
|
|
5899
|
-
var
|
|
5900
|
-
if (
|
|
5901
|
-
for (var L =
|
|
5902
|
-
ae[ee] = B[ee] ||
|
|
5903
|
-
oe && (ae[
|
|
5440
|
+
var m = f.match(c.IPV4ADDRESS) || [], R = v(m, 2), S = R[1];
|
|
5441
|
+
return S ? S.split(".").map(ne).join(".") : f;
|
|
5442
|
+
}
|
|
5443
|
+
function Le(f, c) {
|
|
5444
|
+
var m = f.match(c.IPV6ADDRESS) || [], R = v(m, 3), S = R[1], U = R[2];
|
|
5445
|
+
if (S) {
|
|
5446
|
+
for (var L = S.toLowerCase().split("::").reverse(), J = v(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Q = Y.split(":").map(ne), oe = c.IPV4ADDRESS.test(Q[Q.length - 1]), z = oe ? 7 : 8, X = Q.length - z, ae = Array(z), ee = 0; ee < z; ++ee)
|
|
5447
|
+
ae[ee] = B[ee] || Q[X + ee] || "";
|
|
5448
|
+
oe && (ae[z - 1] = he(ae[z - 1], c));
|
|
5904
5449
|
var Ee = ae.reduce(function(fe, ye, je) {
|
|
5905
5450
|
if (!ye || ye === "0") {
|
|
5906
|
-
var
|
|
5907
|
-
|
|
5451
|
+
var we = fe[fe.length - 1];
|
|
5452
|
+
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5908
5453
|
}
|
|
5909
5454
|
return fe;
|
|
5910
5455
|
}, []), ge = Ee.sort(function(fe, ye) {
|
|
5911
5456
|
return ye.length - fe.length;
|
|
5912
5457
|
})[0], $e = void 0;
|
|
5913
5458
|
if (ge && ge.length > 1) {
|
|
5914
|
-
var
|
|
5915
|
-
$e =
|
|
5459
|
+
var Be = ae.slice(0, ge.index), Ie = ae.slice(ge.index + ge.length);
|
|
5460
|
+
$e = Be.join(":") + "::" + Ie.join(":");
|
|
5916
5461
|
} else
|
|
5917
5462
|
$e = ae.join(":");
|
|
5918
5463
|
return U && ($e += "%" + U), $e;
|
|
@@ -5921,101 +5466,101 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5921
5466
|
}
|
|
5922
5467
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5923
5468
|
function de(f) {
|
|
5924
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5469
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, R = c.iri !== !1 ? _ : u;
|
|
5925
5470
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5926
|
-
var
|
|
5927
|
-
if (
|
|
5928
|
-
rt ? (
|
|
5929
|
-
var U =
|
|
5471
|
+
var S = f.match(tt);
|
|
5472
|
+
if (S) {
|
|
5473
|
+
rt ? (m.scheme = S[1], m.userinfo = S[3], m.host = S[4], m.port = parseInt(S[5], 10), m.path = S[6] || "", m.query = S[7], m.fragment = S[8], isNaN(m.port) && (m.port = S[5])) : (m.scheme = S[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? S[3] : void 0, m.host = f.indexOf("//") !== -1 ? S[4] : void 0, m.port = parseInt(S[5], 10), m.path = S[6] || "", m.query = f.indexOf("?") !== -1 ? S[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? S[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? S[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", c.reference && c.reference !== "suffix" && c.reference !== m.reference && (m.error = m.error || "URI is not a " + c.reference + " reference.");
|
|
5474
|
+
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5930
5475
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5931
|
-
if (
|
|
5476
|
+
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5932
5477
|
try {
|
|
5933
|
-
|
|
5478
|
+
m.host = N.toASCII(m.host.replace(R.PCT_ENCODED, W).toLowerCase());
|
|
5934
5479
|
} catch (L) {
|
|
5935
|
-
|
|
5480
|
+
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5936
5481
|
}
|
|
5937
|
-
G(
|
|
5482
|
+
G(m, u);
|
|
5938
5483
|
} else
|
|
5939
|
-
G(
|
|
5940
|
-
U && U.parse && U.parse(
|
|
5484
|
+
G(m, R);
|
|
5485
|
+
U && U.parse && U.parse(m, c);
|
|
5941
5486
|
} else
|
|
5942
|
-
|
|
5943
|
-
return
|
|
5487
|
+
m.error = m.error || "URI can not be parsed.";
|
|
5488
|
+
return m;
|
|
5944
5489
|
}
|
|
5945
5490
|
function nt(f, c) {
|
|
5946
|
-
var
|
|
5947
|
-
return f.userinfo !== void 0 && (
|
|
5491
|
+
var m = c.iri !== !1 ? _ : u, R = [];
|
|
5492
|
+
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(S, U, L) {
|
|
5948
5493
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5949
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5494
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (R.push(":"), R.push(String(f.port))), R.length ? R.join("") : void 0;
|
|
5950
5495
|
}
|
|
5951
|
-
var
|
|
5496
|
+
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, ze = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5952
5497
|
function me(f) {
|
|
5953
5498
|
for (var c = []; f.length; )
|
|
5954
|
-
if (f.match(
|
|
5955
|
-
f = f.replace(
|
|
5956
|
-
else if (f.match(
|
|
5957
|
-
f = f.replace(
|
|
5958
|
-
else if (f.match(
|
|
5959
|
-
f = f.replace(
|
|
5499
|
+
if (f.match(He))
|
|
5500
|
+
f = f.replace(He, "");
|
|
5501
|
+
else if (f.match(Ve))
|
|
5502
|
+
f = f.replace(Ve, "/");
|
|
5503
|
+
else if (f.match(ze))
|
|
5504
|
+
f = f.replace(ze, "/"), c.pop();
|
|
5960
5505
|
else if (f === "." || f === "..")
|
|
5961
5506
|
f = "";
|
|
5962
5507
|
else {
|
|
5963
|
-
var
|
|
5964
|
-
if (
|
|
5965
|
-
var
|
|
5966
|
-
f = f.slice(
|
|
5508
|
+
var m = f.match(st);
|
|
5509
|
+
if (m) {
|
|
5510
|
+
var R = m[0];
|
|
5511
|
+
f = f.slice(R.length), c.push(R);
|
|
5967
5512
|
} else
|
|
5968
5513
|
throw new Error("Unexpected dot segment condition");
|
|
5969
5514
|
}
|
|
5970
5515
|
return c.join("");
|
|
5971
5516
|
}
|
|
5972
5517
|
function le(f) {
|
|
5973
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5974
|
-
if (
|
|
5975
|
-
if (c.domainHost ||
|
|
5518
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? _ : u, R = [], S = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5519
|
+
if (S && S.serialize && S.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5520
|
+
if (c.domainHost || S && S.domainHost)
|
|
5976
5521
|
try {
|
|
5977
|
-
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(
|
|
5522
|
+
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5978
5523
|
} catch (J) {
|
|
5979
5524
|
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5980
5525
|
}
|
|
5981
5526
|
}
|
|
5982
|
-
G(f,
|
|
5527
|
+
G(f, m), c.reference !== "suffix" && f.scheme && (R.push(f.scheme), R.push(":"));
|
|
5983
5528
|
var U = nt(f, c);
|
|
5984
|
-
if (U !== void 0 && (c.reference !== "suffix" &&
|
|
5529
|
+
if (U !== void 0 && (c.reference !== "suffix" && R.push("//"), R.push(U), f.path && f.path.charAt(0) !== "/" && R.push("/")), f.path !== void 0) {
|
|
5985
5530
|
var L = f.path;
|
|
5986
|
-
!c.absolutePath && (!
|
|
5531
|
+
!c.absolutePath && (!S || !S.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), R.push(L);
|
|
5987
5532
|
}
|
|
5988
|
-
return f.query !== void 0 && (
|
|
5533
|
+
return f.query !== void 0 && (R.push("?"), R.push(f.query)), f.fragment !== void 0 && (R.push("#"), R.push(f.fragment)), R.join("");
|
|
5989
5534
|
}
|
|
5990
|
-
function
|
|
5991
|
-
var
|
|
5992
|
-
return
|
|
5535
|
+
function xe(f, c) {
|
|
5536
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, R = arguments[3], S = {};
|
|
5537
|
+
return R || (f = de(le(f, m), m), c = de(le(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (S.scheme = c.scheme, S.userinfo = c.userinfo, S.host = c.host, S.port = c.port, S.path = me(c.path || ""), S.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (S.userinfo = c.userinfo, S.host = c.host, S.port = c.port, S.path = me(c.path || ""), S.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? S.path = me(c.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? S.path = "/" + c.path : f.path ? S.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + c.path : S.path = c.path, S.path = me(S.path)), S.query = c.query) : (S.path = f.path, c.query !== void 0 ? S.query = c.query : S.query = f.query), S.userinfo = f.userinfo, S.host = f.host, S.port = f.port), S.scheme = f.scheme), S.fragment = c.fragment, S;
|
|
5993
5538
|
}
|
|
5994
|
-
function ot(f, c,
|
|
5995
|
-
var
|
|
5996
|
-
return le(
|
|
5539
|
+
function ot(f, c, m) {
|
|
5540
|
+
var R = p({ scheme: "null" }, m);
|
|
5541
|
+
return le(xe(de(f, R), de(c, R), R, !0), R);
|
|
5997
5542
|
}
|
|
5998
5543
|
function Oe(f, c) {
|
|
5999
5544
|
return typeof f == "string" ? f = le(de(f, c), c) : o(f) === "object" && (f = de(le(f, c), c)), f;
|
|
6000
5545
|
}
|
|
6001
|
-
function it(f, c,
|
|
6002
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5546
|
+
function it(f, c, m) {
|
|
5547
|
+
return typeof f == "string" ? f = le(de(f, m), m) : o(f) === "object" && (f = le(f, m)), typeof c == "string" ? c = le(de(c, m), m) : o(c) === "object" && (c = le(c, m)), f === c;
|
|
6003
5548
|
}
|
|
6004
5549
|
function ut(f, c) {
|
|
6005
|
-
return f && f.toString().replace(!c || !c.iri ? u.ESCAPE :
|
|
5550
|
+
return f && f.toString().replace(!c || !c.iri ? u.ESCAPE : _.ESCAPE, q);
|
|
6006
5551
|
}
|
|
6007
5552
|
function pe(f, c) {
|
|
6008
|
-
return f && f.toString().replace(!c || !c.iri ? u.PCT_ENCODED :
|
|
5553
|
+
return f && f.toString().replace(!c || !c.iri ? u.PCT_ENCODED : _.PCT_ENCODED, W);
|
|
6009
5554
|
}
|
|
6010
5555
|
var Ne = {
|
|
6011
5556
|
scheme: "http",
|
|
6012
5557
|
domainHost: !0,
|
|
6013
|
-
parse: function(c,
|
|
5558
|
+
parse: function(c, m) {
|
|
6014
5559
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
6015
5560
|
},
|
|
6016
|
-
serialize: function(c,
|
|
6017
|
-
var
|
|
6018
|
-
return (c.port === (
|
|
5561
|
+
serialize: function(c, m) {
|
|
5562
|
+
var R = String(c.scheme).toLowerCase() === "https";
|
|
5563
|
+
return (c.port === (R ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
6019
5564
|
}
|
|
6020
5565
|
}, It = {
|
|
6021
5566
|
scheme: "https",
|
|
@@ -6029,13 +5574,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6029
5574
|
var at = {
|
|
6030
5575
|
scheme: "ws",
|
|
6031
5576
|
domainHost: !0,
|
|
6032
|
-
parse: function(c,
|
|
6033
|
-
var
|
|
6034
|
-
return
|
|
5577
|
+
parse: function(c, m) {
|
|
5578
|
+
var R = c;
|
|
5579
|
+
return R.secure = jt(R), R.resourceName = (R.path || "/") + (R.query ? "?" + R.query : ""), R.path = void 0, R.query = void 0, R;
|
|
6035
5580
|
},
|
|
6036
|
-
serialize: function(c,
|
|
5581
|
+
serialize: function(c, m) {
|
|
6037
5582
|
if ((c.port === (jt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
6038
|
-
var
|
|
5583
|
+
var R = c.resourceName.split("?"), S = v(R, 2), U = S[0], L = S[1];
|
|
6039
5584
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
6040
5585
|
}
|
|
6041
5586
|
return c.fragment = void 0, c;
|
|
@@ -6045,101 +5590,101 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6045
5590
|
domainHost: at.domainHost,
|
|
6046
5591
|
parse: at.parse,
|
|
6047
5592
|
serialize: at.serialize
|
|
6048
|
-
}, or = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", ir = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(Dt, "g"),
|
|
5593
|
+
}, or = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", ir = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(Dt, "g"), We = new RegExp(ir, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", Dt, dr), "g"), fr = Ft;
|
|
6049
5594
|
function Ot(f) {
|
|
6050
5595
|
var c = W(f);
|
|
6051
5596
|
return c.match(ur) ? c : f;
|
|
6052
5597
|
}
|
|
6053
|
-
var
|
|
5598
|
+
var Mt = {
|
|
6054
5599
|
scheme: "mailto",
|
|
6055
|
-
parse: function(c,
|
|
6056
|
-
var
|
|
6057
|
-
if (
|
|
6058
|
-
for (var U = !1, L = {}, J =
|
|
5600
|
+
parse: function(c, m) {
|
|
5601
|
+
var R = c, S = R.to = R.path ? R.path.split(",") : [];
|
|
5602
|
+
if (R.path = void 0, R.query) {
|
|
5603
|
+
for (var U = !1, L = {}, J = R.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
6059
5604
|
var B = J[Y].split("=");
|
|
6060
5605
|
switch (B[0]) {
|
|
6061
5606
|
case "to":
|
|
6062
|
-
for (var
|
|
6063
|
-
|
|
5607
|
+
for (var Q = B[1].split(","), oe = 0, z = Q.length; oe < z; ++oe)
|
|
5608
|
+
S.push(Q[oe]);
|
|
6064
5609
|
break;
|
|
6065
5610
|
case "subject":
|
|
6066
|
-
|
|
5611
|
+
R.subject = pe(B[1], m);
|
|
6067
5612
|
break;
|
|
6068
5613
|
case "body":
|
|
6069
|
-
|
|
5614
|
+
R.body = pe(B[1], m);
|
|
6070
5615
|
break;
|
|
6071
5616
|
default:
|
|
6072
|
-
U = !0, L[pe(B[0],
|
|
5617
|
+
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
6073
5618
|
break;
|
|
6074
5619
|
}
|
|
6075
5620
|
}
|
|
6076
|
-
U && (
|
|
5621
|
+
U && (R.headers = L);
|
|
6077
5622
|
}
|
|
6078
|
-
|
|
6079
|
-
for (var X = 0, ae =
|
|
6080
|
-
var ee =
|
|
6081
|
-
if (ee[0] = pe(ee[0]),
|
|
6082
|
-
ee[1] = pe(ee[1],
|
|
5623
|
+
R.query = void 0;
|
|
5624
|
+
for (var X = 0, ae = S.length; X < ae; ++X) {
|
|
5625
|
+
var ee = S[X].split("@");
|
|
5626
|
+
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
5627
|
+
ee[1] = pe(ee[1], m).toLowerCase();
|
|
6083
5628
|
else
|
|
6084
5629
|
try {
|
|
6085
|
-
ee[1] = N.toASCII(pe(ee[1],
|
|
5630
|
+
ee[1] = N.toASCII(pe(ee[1], m).toLowerCase());
|
|
6086
5631
|
} catch (Ee) {
|
|
6087
|
-
|
|
5632
|
+
R.error = R.error || "Email address's domain name can not be converted to ASCII via punycode: " + Ee;
|
|
6088
5633
|
}
|
|
6089
|
-
|
|
5634
|
+
S[X] = ee.join("@");
|
|
6090
5635
|
}
|
|
6091
|
-
return
|
|
5636
|
+
return R;
|
|
6092
5637
|
},
|
|
6093
|
-
serialize: function(c,
|
|
6094
|
-
var
|
|
6095
|
-
if (
|
|
6096
|
-
for (var U = 0, L =
|
|
6097
|
-
var J = String(
|
|
5638
|
+
serialize: function(c, m) {
|
|
5639
|
+
var R = c, S = l(c.to);
|
|
5640
|
+
if (S) {
|
|
5641
|
+
for (var U = 0, L = S.length; U < L; ++U) {
|
|
5642
|
+
var J = String(S[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, i).replace(pr, q), B = J.slice(Y + 1);
|
|
6098
5643
|
try {
|
|
6099
|
-
B =
|
|
5644
|
+
B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
|
|
6100
5645
|
} catch (X) {
|
|
6101
|
-
|
|
5646
|
+
R.error = R.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
6102
5647
|
}
|
|
6103
|
-
|
|
5648
|
+
S[U] = se + "@" + B;
|
|
6104
5649
|
}
|
|
6105
|
-
|
|
5650
|
+
R.path = S.join(",");
|
|
6106
5651
|
}
|
|
6107
|
-
var
|
|
6108
|
-
c.subject && (
|
|
5652
|
+
var Q = c.headers = c.headers || {};
|
|
5653
|
+
c.subject && (Q.subject = c.subject), c.body && (Q.body = c.body);
|
|
6109
5654
|
var oe = [];
|
|
6110
|
-
for (var
|
|
6111
|
-
|
|
6112
|
-
return oe.length && (
|
|
5655
|
+
for (var z in Q)
|
|
5656
|
+
Q[z] !== or[z] && oe.push(z.replace(We, Ot).replace(We, i).replace(Ft, q) + "=" + Q[z].replace(We, Ot).replace(We, i).replace(fr, q));
|
|
5657
|
+
return oe.length && (R.query = oe.join("&")), R;
|
|
6113
5658
|
}
|
|
6114
|
-
}, hr = /^([^\:]+)\:(.*)/,
|
|
5659
|
+
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
6115
5660
|
scheme: "urn",
|
|
6116
|
-
parse: function(c,
|
|
6117
|
-
var
|
|
6118
|
-
if (
|
|
6119
|
-
var U =
|
|
6120
|
-
|
|
5661
|
+
parse: function(c, m) {
|
|
5662
|
+
var R = c.path && c.path.match(hr), S = c;
|
|
5663
|
+
if (R) {
|
|
5664
|
+
var U = m.scheme || S.scheme || "urn", L = R[1].toLowerCase(), J = R[2], Y = U + ":" + (m.nid || L), se = M[Y];
|
|
5665
|
+
S.nid = L, S.nss = J, S.path = void 0, se && (S = se.parse(S, m));
|
|
6121
5666
|
} else
|
|
6122
|
-
|
|
6123
|
-
return
|
|
5667
|
+
S.error = S.error || "URN can not be parsed.";
|
|
5668
|
+
return S;
|
|
6124
5669
|
},
|
|
6125
|
-
serialize: function(c,
|
|
6126
|
-
var
|
|
6127
|
-
L && (c = L.serialize(c,
|
|
5670
|
+
serialize: function(c, m) {
|
|
5671
|
+
var R = m.scheme || c.scheme || "urn", S = c.nid, U = R + ":" + (m.nid || S), L = M[U];
|
|
5672
|
+
L && (c = L.serialize(c, m));
|
|
6128
5673
|
var J = c, Y = c.nss;
|
|
6129
|
-
return J.path = (
|
|
5674
|
+
return J.path = (S || m.nid) + ":" + Y, J;
|
|
6130
5675
|
}
|
|
6131
5676
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
6132
5677
|
scheme: "urn:uuid",
|
|
6133
|
-
parse: function(c,
|
|
6134
|
-
var
|
|
6135
|
-
return
|
|
5678
|
+
parse: function(c, m) {
|
|
5679
|
+
var R = c;
|
|
5680
|
+
return R.uuid = R.nss, R.nss = void 0, !m.tolerant && (!R.uuid || !R.uuid.match(mr)) && (R.error = R.error || "UUID is not valid."), R;
|
|
6136
5681
|
},
|
|
6137
|
-
serialize: function(c,
|
|
6138
|
-
var
|
|
6139
|
-
return
|
|
5682
|
+
serialize: function(c, m) {
|
|
5683
|
+
var R = c;
|
|
5684
|
+
return R.nss = (c.uuid || "").toLowerCase(), R;
|
|
6140
5685
|
}
|
|
6141
5686
|
};
|
|
6142
|
-
|
|
5687
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = ot, r.normalize = Oe, r.equal = it, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
6143
5688
|
});
|
|
6144
5689
|
})(uri_all, uri_all.exports);
|
|
6145
5690
|
var uri_allExports = uri_all.exports;
|
|
@@ -6167,9 +5712,9 @@ uri$1.default = uri;
|
|
|
6167
5712
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
6168
5713
|
return r.CodeGen;
|
|
6169
5714
|
} });
|
|
6170
|
-
const n = validation_error, s = ref_error, o = rules, i = compile, l = codegen, p = resolve$1, d = dataType, u = util,
|
|
6171
|
-
|
|
6172
|
-
const
|
|
5715
|
+
const n = validation_error, s = ref_error, o = rules, i = compile, l = codegen, p = resolve$1, d = dataType, u = util, _ = require$$9, v = uri$1, w = (F, y) => new RegExp(F, y);
|
|
5716
|
+
w.code = "new RegExp";
|
|
5717
|
+
const P = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
6173
5718
|
"validate",
|
|
6174
5719
|
"serialize",
|
|
6175
5720
|
"parse",
|
|
@@ -6205,25 +5750,25 @@ uri$1.default = uri;
|
|
|
6205
5750
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
6206
5751
|
}, k = 200;
|
|
6207
5752
|
function C(F) {
|
|
6208
|
-
var y, j,
|
|
6209
|
-
const Oe = F.strict, it = (y = F.code) === null || y === void 0 ? void 0 : y.optimize, ut = it === !0 || it === void 0 ? 1 : it || 0, pe = (
|
|
5753
|
+
var y, j, E, a, h, N, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, Ve, ze, st, me, le, xe, ot;
|
|
5754
|
+
const Oe = F.strict, it = (y = F.code) === null || y === void 0 ? void 0 : y.optimize, ut = it === !0 || it === void 0 ? 1 : it || 0, pe = (E = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && E !== void 0 ? E : w, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : v.default;
|
|
6210
5755
|
return {
|
|
6211
5756
|
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
6212
|
-
strictNumbers: (
|
|
5757
|
+
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && q !== void 0 ? q : !0,
|
|
6213
5758
|
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
6214
5759
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
6215
|
-
strictRequired: (tt = (
|
|
5760
|
+
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
6216
5761
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
6217
5762
|
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : k,
|
|
6218
5763
|
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : k,
|
|
6219
5764
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
6220
|
-
messages: (
|
|
6221
|
-
inlineRefs: (
|
|
6222
|
-
schemaId: (
|
|
5765
|
+
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5766
|
+
inlineRefs: (Ve = F.inlineRefs) !== null && Ve !== void 0 ? Ve : !0,
|
|
5767
|
+
schemaId: (ze = F.schemaId) !== null && ze !== void 0 ? ze : "$id",
|
|
6223
5768
|
addUsedSchema: (st = F.addUsedSchema) !== null && st !== void 0 ? st : !0,
|
|
6224
5769
|
validateSchema: (me = F.validateSchema) !== null && me !== void 0 ? me : !0,
|
|
6225
5770
|
validateFormats: (le = F.validateFormats) !== null && le !== void 0 ? le : !0,
|
|
6226
|
-
unicodeRegExp: (
|
|
5771
|
+
unicodeRegExp: (xe = F.unicodeRegExp) !== null && xe !== void 0 ? xe : !0,
|
|
6227
5772
|
int32range: (ot = F.int32range) !== null && ot !== void 0 ? ot : !0,
|
|
6228
5773
|
uriResolver: Ne
|
|
6229
5774
|
};
|
|
@@ -6231,41 +5776,41 @@ uri$1.default = uri;
|
|
|
6231
5776
|
class I {
|
|
6232
5777
|
constructor(y = {}) {
|
|
6233
5778
|
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), y = this.opts = { ...y, ...C(y) };
|
|
6234
|
-
const { es5: j, lines:
|
|
6235
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines:
|
|
5779
|
+
const { es5: j, lines: E } = this.opts.code;
|
|
5780
|
+
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines: E }), this.logger = K(y.logger);
|
|
6236
5781
|
const a = y.validateFormats;
|
|
6237
|
-
y.validateFormats = !1, this.RULES = (0, o.getRules)(), D.call(this, $, y, "NOT SUPPORTED"), D.call(this, g, y, "DEPRECATED", "warn"), this._metaOpts =
|
|
5782
|
+
y.validateFormats = !1, this.RULES = (0, o.getRules)(), D.call(this, $, y, "NOT SUPPORTED"), D.call(this, g, y, "DEPRECATED", "warn"), this._metaOpts = x.call(this), y.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), y.keywords && V.call(this, y.keywords), typeof y.meta == "object" && this.addMetaSchema(y.meta), O.call(this), y.validateFormats = a;
|
|
6238
5783
|
}
|
|
6239
5784
|
_addVocabularies() {
|
|
6240
5785
|
this.addKeyword("$async");
|
|
6241
5786
|
}
|
|
6242
5787
|
_addDefaultMetaSchema() {
|
|
6243
|
-
const { $data: y, meta: j, schemaId:
|
|
6244
|
-
let a =
|
|
6245
|
-
|
|
5788
|
+
const { $data: y, meta: j, schemaId: E } = this.opts;
|
|
5789
|
+
let a = _;
|
|
5790
|
+
E === "id" && (a = { ..._ }, a.id = a.$id, delete a.$id), j && y && this.addMetaSchema(a, a[E], !1);
|
|
6246
5791
|
}
|
|
6247
5792
|
defaultMeta() {
|
|
6248
5793
|
const { meta: y, schemaId: j } = this.opts;
|
|
6249
5794
|
return this.opts.defaultMeta = typeof y == "object" ? y[j] || y : void 0;
|
|
6250
5795
|
}
|
|
6251
5796
|
validate(y, j) {
|
|
6252
|
-
let
|
|
5797
|
+
let E;
|
|
6253
5798
|
if (typeof y == "string") {
|
|
6254
|
-
if (
|
|
5799
|
+
if (E = this.getSchema(y), !E)
|
|
6255
5800
|
throw new Error(`no schema with key or ref "${y}"`);
|
|
6256
5801
|
} else
|
|
6257
|
-
|
|
6258
|
-
const a =
|
|
6259
|
-
return "$async" in
|
|
5802
|
+
E = this.compile(y);
|
|
5803
|
+
const a = E(j);
|
|
5804
|
+
return "$async" in E || (this.errors = E.errors), a;
|
|
6260
5805
|
}
|
|
6261
5806
|
compile(y, j) {
|
|
6262
|
-
const
|
|
6263
|
-
return
|
|
5807
|
+
const E = this._addSchema(y, j);
|
|
5808
|
+
return E.validate || this._compileSchemaEnv(E);
|
|
6264
5809
|
}
|
|
6265
5810
|
compileAsync(y, j) {
|
|
6266
5811
|
if (typeof this.opts.loadSchema != "function")
|
|
6267
5812
|
throw new Error("options.loadSchema should be a function");
|
|
6268
|
-
const { loadSchema:
|
|
5813
|
+
const { loadSchema: E } = this.opts;
|
|
6269
5814
|
return a.call(this, y, j);
|
|
6270
5815
|
async function a(G, ne) {
|
|
6271
5816
|
await h.call(this, G.$schema);
|
|
@@ -6281,14 +5826,14 @@ uri$1.default = uri;
|
|
|
6281
5826
|
} catch (ne) {
|
|
6282
5827
|
if (!(ne instanceof s.default))
|
|
6283
5828
|
throw ne;
|
|
6284
|
-
return
|
|
5829
|
+
return M.call(this, ne), await q.call(this, ne.missingSchema), N.call(this, G);
|
|
6285
5830
|
}
|
|
6286
5831
|
}
|
|
6287
|
-
function
|
|
5832
|
+
function M({ missingSchema: G, missingRef: ne }) {
|
|
6288
5833
|
if (this.refs[G])
|
|
6289
5834
|
throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
|
|
6290
5835
|
}
|
|
6291
|
-
async function
|
|
5836
|
+
async function q(G) {
|
|
6292
5837
|
const ne = await W.call(this, G);
|
|
6293
5838
|
this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
|
|
6294
5839
|
}
|
|
@@ -6297,17 +5842,17 @@ uri$1.default = uri;
|
|
|
6297
5842
|
if (ne)
|
|
6298
5843
|
return ne;
|
|
6299
5844
|
try {
|
|
6300
|
-
return await (this._loading[G] =
|
|
5845
|
+
return await (this._loading[G] = E(G));
|
|
6301
5846
|
} finally {
|
|
6302
5847
|
delete this._loading[G];
|
|
6303
5848
|
}
|
|
6304
5849
|
}
|
|
6305
5850
|
}
|
|
6306
5851
|
// Adds schema to the instance
|
|
6307
|
-
addSchema(y, j,
|
|
5852
|
+
addSchema(y, j, E, a = this.opts.validateSchema) {
|
|
6308
5853
|
if (Array.isArray(y)) {
|
|
6309
5854
|
for (const N of y)
|
|
6310
|
-
this.addSchema(N, void 0,
|
|
5855
|
+
this.addSchema(N, void 0, E, a);
|
|
6311
5856
|
return this;
|
|
6312
5857
|
}
|
|
6313
5858
|
let h;
|
|
@@ -6316,23 +5861,23 @@ uri$1.default = uri;
|
|
|
6316
5861
|
if (h = y[N], h !== void 0 && typeof h != "string")
|
|
6317
5862
|
throw new Error(`schema ${N} must be string`);
|
|
6318
5863
|
}
|
|
6319
|
-
return j = (0, p.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(y,
|
|
5864
|
+
return j = (0, p.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(y, E, j, a, !0), this;
|
|
6320
5865
|
}
|
|
6321
5866
|
// Add schema that will be used to validate other schemas
|
|
6322
5867
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
6323
|
-
addMetaSchema(y, j,
|
|
6324
|
-
return this.addSchema(y, j, !0,
|
|
5868
|
+
addMetaSchema(y, j, E = this.opts.validateSchema) {
|
|
5869
|
+
return this.addSchema(y, j, !0, E), this;
|
|
6325
5870
|
}
|
|
6326
5871
|
// Validate schema against its meta-schema
|
|
6327
5872
|
validateSchema(y, j) {
|
|
6328
5873
|
if (typeof y == "boolean")
|
|
6329
5874
|
return !0;
|
|
6330
|
-
let
|
|
6331
|
-
if (
|
|
5875
|
+
let E;
|
|
5876
|
+
if (E = y.$schema, E !== void 0 && typeof E != "string")
|
|
6332
5877
|
throw new Error("$schema must be a string");
|
|
6333
|
-
if (
|
|
5878
|
+
if (E = E || this.opts.defaultMeta || this.defaultMeta(), !E)
|
|
6334
5879
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
6335
|
-
const a = this.validate(
|
|
5880
|
+
const a = this.validate(E, y);
|
|
6336
5881
|
if (!a && j) {
|
|
6337
5882
|
const h = "schema is invalid: " + this.errorsText();
|
|
6338
5883
|
if (this.opts.validateSchema === "log")
|
|
@@ -6346,10 +5891,10 @@ uri$1.default = uri;
|
|
|
6346
5891
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
6347
5892
|
getSchema(y) {
|
|
6348
5893
|
let j;
|
|
6349
|
-
for (; typeof (j =
|
|
5894
|
+
for (; typeof (j = b.call(this, y)) == "string"; )
|
|
6350
5895
|
y = j;
|
|
6351
5896
|
if (j === void 0) {
|
|
6352
|
-
const { schemaId:
|
|
5897
|
+
const { schemaId: E } = this.opts, a = new i.SchemaEnv({ schema: {}, schemaId: E });
|
|
6353
5898
|
if (j = i.resolveSchema.call(this, a, y), !j)
|
|
6354
5899
|
return;
|
|
6355
5900
|
this.refs[y] = j;
|
|
@@ -6367,14 +5912,14 @@ uri$1.default = uri;
|
|
|
6367
5912
|
case "undefined":
|
|
6368
5913
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
6369
5914
|
case "string": {
|
|
6370
|
-
const j =
|
|
5915
|
+
const j = b.call(this, y);
|
|
6371
5916
|
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[y], delete this.refs[y], this;
|
|
6372
5917
|
}
|
|
6373
5918
|
case "object": {
|
|
6374
5919
|
const j = y;
|
|
6375
5920
|
this._cache.delete(j);
|
|
6376
|
-
let
|
|
6377
|
-
return
|
|
5921
|
+
let E = y[this.opts.schemaId];
|
|
5922
|
+
return E && (E = (0, p.normalizeId)(E), delete this.schemas[E], delete this.refs[E]), this;
|
|
6378
5923
|
}
|
|
6379
5924
|
default:
|
|
6380
5925
|
throw new Error("ajv.removeSchema: invalid parameter");
|
|
@@ -6387,23 +5932,23 @@ uri$1.default = uri;
|
|
|
6387
5932
|
return this;
|
|
6388
5933
|
}
|
|
6389
5934
|
addKeyword(y, j) {
|
|
6390
|
-
let
|
|
5935
|
+
let E;
|
|
6391
5936
|
if (typeof y == "string")
|
|
6392
|
-
|
|
5937
|
+
E = y, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = E);
|
|
6393
5938
|
else if (typeof y == "object" && j === void 0) {
|
|
6394
|
-
if (j = y,
|
|
5939
|
+
if (j = y, E = j.keyword, Array.isArray(E) && !E.length)
|
|
6395
5940
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6396
5941
|
} else
|
|
6397
5942
|
throw new Error("invalid addKeywords parameters");
|
|
6398
|
-
if (ie.call(this,
|
|
6399
|
-
return (0, u.eachItem)(
|
|
5943
|
+
if (ie.call(this, E, j), !j)
|
|
5944
|
+
return (0, u.eachItem)(E, (h) => ke.call(this, h)), this;
|
|
6400
5945
|
qe.call(this, j);
|
|
6401
5946
|
const a = {
|
|
6402
5947
|
...j,
|
|
6403
5948
|
type: (0, d.getJSONTypes)(j.type),
|
|
6404
5949
|
schemaType: (0, d.getJSONTypes)(j.schemaType)
|
|
6405
5950
|
};
|
|
6406
|
-
return (0, u.eachItem)(
|
|
5951
|
+
return (0, u.eachItem)(E, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
|
|
6407
5952
|
}
|
|
6408
5953
|
getKeyword(y) {
|
|
6409
5954
|
const j = this.RULES.all[y];
|
|
@@ -6413,9 +5958,9 @@ uri$1.default = uri;
|
|
|
6413
5958
|
removeKeyword(y) {
|
|
6414
5959
|
const { RULES: j } = this;
|
|
6415
5960
|
delete j.keywords[y], delete j.all[y];
|
|
6416
|
-
for (const
|
|
6417
|
-
const a =
|
|
6418
|
-
a >= 0 &&
|
|
5961
|
+
for (const E of j.rules) {
|
|
5962
|
+
const a = E.rules.findIndex((h) => h.keyword === y);
|
|
5963
|
+
a >= 0 && E.rules.splice(a, 1);
|
|
6419
5964
|
}
|
|
6420
5965
|
return this;
|
|
6421
5966
|
}
|
|
@@ -6423,50 +5968,50 @@ uri$1.default = uri;
|
|
|
6423
5968
|
addFormat(y, j) {
|
|
6424
5969
|
return typeof j == "string" && (j = new RegExp(j)), this.formats[y] = j, this;
|
|
6425
5970
|
}
|
|
6426
|
-
errorsText(y = this.errors, { separator: j = ", ", dataVar:
|
|
6427
|
-
return !y || y.length === 0 ? "No errors" : y.map((a) => `${
|
|
5971
|
+
errorsText(y = this.errors, { separator: j = ", ", dataVar: E = "data" } = {}) {
|
|
5972
|
+
return !y || y.length === 0 ? "No errors" : y.map((a) => `${E}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
6428
5973
|
}
|
|
6429
5974
|
$dataMetaSchema(y, j) {
|
|
6430
|
-
const
|
|
5975
|
+
const E = this.RULES.all;
|
|
6431
5976
|
y = JSON.parse(JSON.stringify(y));
|
|
6432
5977
|
for (const a of j) {
|
|
6433
5978
|
const h = a.split("/").slice(1);
|
|
6434
5979
|
let N = y;
|
|
6435
|
-
for (const
|
|
6436
|
-
N = N[
|
|
6437
|
-
for (const
|
|
6438
|
-
const
|
|
6439
|
-
if (typeof
|
|
5980
|
+
for (const M of h)
|
|
5981
|
+
N = N[M];
|
|
5982
|
+
for (const M in E) {
|
|
5983
|
+
const q = E[M];
|
|
5984
|
+
if (typeof q != "object")
|
|
6440
5985
|
continue;
|
|
6441
|
-
const { $data: W } =
|
|
6442
|
-
W && G && (N[
|
|
5986
|
+
const { $data: W } = q.definition, G = N[M];
|
|
5987
|
+
W && G && (N[M] = Ue(G));
|
|
6443
5988
|
}
|
|
6444
5989
|
}
|
|
6445
5990
|
return y;
|
|
6446
5991
|
}
|
|
6447
5992
|
_removeAllSchemas(y, j) {
|
|
6448
|
-
for (const
|
|
6449
|
-
const a = y[
|
|
6450
|
-
(!j || j.test(
|
|
5993
|
+
for (const E in y) {
|
|
5994
|
+
const a = y[E];
|
|
5995
|
+
(!j || j.test(E)) && (typeof a == "string" ? delete y[E] : a && !a.meta && (this._cache.delete(a.schema), delete y[E]));
|
|
6451
5996
|
}
|
|
6452
5997
|
}
|
|
6453
|
-
_addSchema(y, j,
|
|
5998
|
+
_addSchema(y, j, E, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6454
5999
|
let N;
|
|
6455
|
-
const { schemaId:
|
|
6000
|
+
const { schemaId: M } = this.opts;
|
|
6456
6001
|
if (typeof y == "object")
|
|
6457
|
-
N = y[
|
|
6002
|
+
N = y[M];
|
|
6458
6003
|
else {
|
|
6459
6004
|
if (this.opts.jtd)
|
|
6460
6005
|
throw new Error("schema must be object");
|
|
6461
6006
|
if (typeof y != "boolean")
|
|
6462
6007
|
throw new Error("schema must be object or boolean");
|
|
6463
6008
|
}
|
|
6464
|
-
let
|
|
6465
|
-
if (
|
|
6466
|
-
return
|
|
6467
|
-
|
|
6468
|
-
const W = p.getSchemaRefs.call(this, y,
|
|
6469
|
-
return
|
|
6009
|
+
let q = this._cache.get(y);
|
|
6010
|
+
if (q !== void 0)
|
|
6011
|
+
return q;
|
|
6012
|
+
E = (0, p.normalizeId)(N || E);
|
|
6013
|
+
const W = p.getSchemaRefs.call(this, y, E);
|
|
6014
|
+
return q = new i.SchemaEnv({ schema: y, schemaId: M, meta: j, baseId: E, localRefs: W }), this._cache.set(q.schema, q), h && !E.startsWith("#") && (E && this._checkUnique(E), this.refs[E] = q), a && this.validateSchema(y, !0), q;
|
|
6470
6015
|
}
|
|
6471
6016
|
_checkUnique(y) {
|
|
6472
6017
|
if (this.schemas[y] || this.refs[y])
|
|
@@ -6488,13 +6033,13 @@ uri$1.default = uri;
|
|
|
6488
6033
|
}
|
|
6489
6034
|
}
|
|
6490
6035
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6491
|
-
function D(F, y, j,
|
|
6036
|
+
function D(F, y, j, E = "error") {
|
|
6492
6037
|
for (const a in F) {
|
|
6493
6038
|
const h = a;
|
|
6494
|
-
h in y && this.logger[
|
|
6039
|
+
h in y && this.logger[E](`${j}: option ${a}. ${F[h]}`);
|
|
6495
6040
|
}
|
|
6496
6041
|
}
|
|
6497
|
-
function
|
|
6042
|
+
function b(F) {
|
|
6498
6043
|
return F = (0, p.normalizeId)(F), this.schemas[F] || this.refs[F];
|
|
6499
6044
|
}
|
|
6500
6045
|
function O() {
|
|
@@ -6512,7 +6057,7 @@ uri$1.default = uri;
|
|
|
6512
6057
|
y && this.addFormat(F, y);
|
|
6513
6058
|
}
|
|
6514
6059
|
}
|
|
6515
|
-
function
|
|
6060
|
+
function V(F) {
|
|
6516
6061
|
if (Array.isArray(F)) {
|
|
6517
6062
|
this.addVocabulary(F);
|
|
6518
6063
|
return;
|
|
@@ -6523,9 +6068,9 @@ uri$1.default = uri;
|
|
|
6523
6068
|
j.keyword || (j.keyword = y), this.addKeyword(j);
|
|
6524
6069
|
}
|
|
6525
6070
|
}
|
|
6526
|
-
function
|
|
6071
|
+
function x() {
|
|
6527
6072
|
const F = { ...this.opts };
|
|
6528
|
-
for (const y of
|
|
6073
|
+
for (const y of P)
|
|
6529
6074
|
delete F[y];
|
|
6530
6075
|
return F;
|
|
6531
6076
|
}
|
|
@@ -6545,24 +6090,24 @@ uri$1.default = uri;
|
|
|
6545
6090
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6546
6091
|
function ie(F, y) {
|
|
6547
6092
|
const { RULES: j } = this;
|
|
6548
|
-
if ((0, u.eachItem)(F, (
|
|
6549
|
-
if (j.keywords[
|
|
6550
|
-
throw new Error(`Keyword ${
|
|
6551
|
-
if (!ue.test(
|
|
6552
|
-
throw new Error(`Keyword ${
|
|
6093
|
+
if ((0, u.eachItem)(F, (E) => {
|
|
6094
|
+
if (j.keywords[E])
|
|
6095
|
+
throw new Error(`Keyword ${E} is already defined`);
|
|
6096
|
+
if (!ue.test(E))
|
|
6097
|
+
throw new Error(`Keyword ${E} has invalid name`);
|
|
6553
6098
|
}), !!y && y.$data && !("code" in y || "validate" in y))
|
|
6554
6099
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6555
6100
|
}
|
|
6556
6101
|
function ke(F, y, j) {
|
|
6557
|
-
var
|
|
6102
|
+
var E;
|
|
6558
6103
|
const a = y == null ? void 0 : y.post;
|
|
6559
6104
|
if (j && a)
|
|
6560
6105
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6561
6106
|
const { RULES: h } = this;
|
|
6562
|
-
let N = a ? h.post : h.rules.find(({ type:
|
|
6107
|
+
let N = a ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6563
6108
|
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !y)
|
|
6564
6109
|
return;
|
|
6565
|
-
const
|
|
6110
|
+
const M = {
|
|
6566
6111
|
keyword: F,
|
|
6567
6112
|
definition: {
|
|
6568
6113
|
...y,
|
|
@@ -6570,20 +6115,20 @@ uri$1.default = uri;
|
|
|
6570
6115
|
schemaType: (0, d.getJSONTypes)(y.schemaType)
|
|
6571
6116
|
}
|
|
6572
6117
|
};
|
|
6573
|
-
y.before ? Ce.call(this, N,
|
|
6118
|
+
y.before ? Ce.call(this, N, M, y.before) : N.rules.push(M), h.all[F] = M, (E = y.implements) === null || E === void 0 || E.forEach((q) => this.addKeyword(q));
|
|
6574
6119
|
}
|
|
6575
6120
|
function Ce(F, y, j) {
|
|
6576
|
-
const
|
|
6577
|
-
|
|
6121
|
+
const E = F.rules.findIndex((a) => a.keyword === j);
|
|
6122
|
+
E >= 0 ? F.rules.splice(E, 0, y) : (F.rules.push(y), this.logger.warn(`rule ${j} is not defined`));
|
|
6578
6123
|
}
|
|
6579
6124
|
function qe(F) {
|
|
6580
6125
|
let { metaSchema: y } = F;
|
|
6581
|
-
y !== void 0 && (F.$data && this.opts.$data && (y =
|
|
6126
|
+
y !== void 0 && (F.$data && this.opts.$data && (y = Ue(y)), F.validateSchema = this.compile(y, !0));
|
|
6582
6127
|
}
|
|
6583
6128
|
const et = {
|
|
6584
6129
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6585
6130
|
};
|
|
6586
|
-
function
|
|
6131
|
+
function Ue(F) {
|
|
6587
6132
|
return { anyOf: [F, et] };
|
|
6588
6133
|
}
|
|
6589
6134
|
})(core$2);
|
|
@@ -6605,26 +6150,26 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6605
6150
|
code(e) {
|
|
6606
6151
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: o, validateName: i, opts: l, self: p } = n, { root: d } = o;
|
|
6607
6152
|
if ((r === "#" || r === "#/") && s === d.baseId)
|
|
6608
|
-
return
|
|
6153
|
+
return _();
|
|
6609
6154
|
const u = compile_1$1.resolveRef.call(p, d, s, r);
|
|
6610
6155
|
if (u === void 0)
|
|
6611
6156
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6612
6157
|
if (u instanceof compile_1$1.SchemaEnv)
|
|
6613
|
-
return
|
|
6614
|
-
return
|
|
6615
|
-
function
|
|
6158
|
+
return v(u);
|
|
6159
|
+
return w(u);
|
|
6160
|
+
function _() {
|
|
6616
6161
|
if (o === d)
|
|
6617
6162
|
return callRef(e, i, o, o.$async);
|
|
6618
|
-
const
|
|
6619
|
-
return callRef(e, (0, codegen_1$l._)`${
|
|
6163
|
+
const P = t.scopeValue("root", { ref: d });
|
|
6164
|
+
return callRef(e, (0, codegen_1$l._)`${P}.validate`, d, d.$async);
|
|
6620
6165
|
}
|
|
6621
|
-
function
|
|
6622
|
-
const T = getValidate(e,
|
|
6623
|
-
callRef(e, T,
|
|
6166
|
+
function v(P) {
|
|
6167
|
+
const T = getValidate(e, P);
|
|
6168
|
+
callRef(e, T, P, P.$async);
|
|
6624
6169
|
}
|
|
6625
|
-
function
|
|
6626
|
-
const T = t.scopeValue("schema", l.code.source === !0 ? { ref:
|
|
6627
|
-
schema:
|
|
6170
|
+
function w(P) {
|
|
6171
|
+
const T = t.scopeValue("schema", l.code.source === !0 ? { ref: P, code: (0, codegen_1$l.stringify)(P) } : { ref: P }), $ = t.name("valid"), g = e.subschema({
|
|
6172
|
+
schema: P,
|
|
6628
6173
|
dataTypes: [],
|
|
6629
6174
|
schemaPath: codegen_1$l.nil,
|
|
6630
6175
|
topSchemaRef: T,
|
|
@@ -6641,25 +6186,25 @@ function getValidate(e, t) {
|
|
|
6641
6186
|
ref.getValidate = getValidate;
|
|
6642
6187
|
function callRef(e, t, r, n) {
|
|
6643
6188
|
const { gen: s, it: o } = e, { allErrors: i, schemaEnv: l, opts: p } = o, d = p.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6644
|
-
n ? u() :
|
|
6189
|
+
n ? u() : _();
|
|
6645
6190
|
function u() {
|
|
6646
6191
|
if (!l.$async)
|
|
6647
6192
|
throw new Error("async schema referenced by sync schema");
|
|
6648
|
-
const
|
|
6193
|
+
const P = s.let("valid");
|
|
6649
6194
|
s.try(() => {
|
|
6650
|
-
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, d)}`),
|
|
6195
|
+
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, d)}`), w(t), i || s.assign(P, !0);
|
|
6651
6196
|
}, (T) => {
|
|
6652
|
-
s.if((0, codegen_1$l._)`!(${T} instanceof ${o.ValidationError})`, () => s.throw(T)),
|
|
6653
|
-
}), e.ok(
|
|
6197
|
+
s.if((0, codegen_1$l._)`!(${T} instanceof ${o.ValidationError})`, () => s.throw(T)), v(T), i || s.assign(P, !1);
|
|
6198
|
+
}), e.ok(P);
|
|
6654
6199
|
}
|
|
6655
|
-
function
|
|
6656
|
-
e.result((0, code_1$8.callValidateCode)(e, t, d), () =>
|
|
6200
|
+
function _() {
|
|
6201
|
+
e.result((0, code_1$8.callValidateCode)(e, t, d), () => w(t), () => v(t));
|
|
6657
6202
|
}
|
|
6658
|
-
function
|
|
6659
|
-
const T = (0, codegen_1$l._)`${
|
|
6203
|
+
function v(P) {
|
|
6204
|
+
const T = (0, codegen_1$l._)`${P}.errors`;
|
|
6660
6205
|
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${T} : ${names_1$1.default.vErrors}.concat(${T})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6661
6206
|
}
|
|
6662
|
-
function
|
|
6207
|
+
function w(P) {
|
|
6663
6208
|
var T;
|
|
6664
6209
|
if (!o.opts.unevaluated)
|
|
6665
6210
|
return;
|
|
@@ -6668,14 +6213,14 @@ function callRef(e, t, r, n) {
|
|
|
6668
6213
|
if ($ && !$.dynamicProps)
|
|
6669
6214
|
$.props !== void 0 && (o.props = util_1$j.mergeEvaluated.props(s, $.props, o.props));
|
|
6670
6215
|
else {
|
|
6671
|
-
const g = s.var("props", (0, codegen_1$l._)`${
|
|
6216
|
+
const g = s.var("props", (0, codegen_1$l._)`${P}.evaluated.props`);
|
|
6672
6217
|
o.props = util_1$j.mergeEvaluated.props(s, g, o.props, codegen_1$l.Name);
|
|
6673
6218
|
}
|
|
6674
6219
|
if (o.items !== !0)
|
|
6675
6220
|
if ($ && !$.dynamicItems)
|
|
6676
6221
|
$.items !== void 0 && (o.items = util_1$j.mergeEvaluated.items(s, $.items, o.items));
|
|
6677
6222
|
else {
|
|
6678
|
-
const g = s.var("items", (0, codegen_1$l._)`${
|
|
6223
|
+
const g = s.var("items", (0, codegen_1$l._)`${P}.evaluated.items`);
|
|
6679
6224
|
o.items = util_1$j.mergeEvaluated.items(s, g, o.items, codegen_1$l.Name);
|
|
6680
6225
|
}
|
|
6681
6226
|
}
|
|
@@ -6817,36 +6362,36 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6817
6362
|
return;
|
|
6818
6363
|
const p = r.length >= l.loopRequired;
|
|
6819
6364
|
if (i.allErrors ? d() : u(), l.strictRequired) {
|
|
6820
|
-
const
|
|
6365
|
+
const w = e.parentSchema.properties, { definedProperties: P } = e.it;
|
|
6821
6366
|
for (const T of r)
|
|
6822
|
-
if ((
|
|
6367
|
+
if ((w == null ? void 0 : w[T]) === void 0 && !P.has(T)) {
|
|
6823
6368
|
const $ = i.schemaEnv.baseId + i.errSchemaPath, g = `required property "${T}" is not defined at "${$}" (strictRequired)`;
|
|
6824
6369
|
(0, util_1$h.checkStrictMode)(i, g, i.opts.strictRequired);
|
|
6825
6370
|
}
|
|
6826
6371
|
}
|
|
6827
6372
|
function d() {
|
|
6828
6373
|
if (p || o)
|
|
6829
|
-
e.block$data(codegen_1$f.nil,
|
|
6374
|
+
e.block$data(codegen_1$f.nil, _);
|
|
6830
6375
|
else
|
|
6831
|
-
for (const
|
|
6832
|
-
(0, code_1$6.checkReportMissingProp)(e,
|
|
6376
|
+
for (const w of r)
|
|
6377
|
+
(0, code_1$6.checkReportMissingProp)(e, w);
|
|
6833
6378
|
}
|
|
6834
6379
|
function u() {
|
|
6835
|
-
const
|
|
6380
|
+
const w = t.let("missing");
|
|
6836
6381
|
if (p || o) {
|
|
6837
|
-
const
|
|
6838
|
-
e.block$data(
|
|
6382
|
+
const P = t.let("valid", !0);
|
|
6383
|
+
e.block$data(P, () => v(w, P)), e.ok(P);
|
|
6839
6384
|
} else
|
|
6840
|
-
t.if((0, code_1$6.checkMissingProp)(e, r,
|
|
6385
|
+
t.if((0, code_1$6.checkMissingProp)(e, r, w)), (0, code_1$6.reportMissingProp)(e, w), t.else();
|
|
6841
6386
|
}
|
|
6842
|
-
function
|
|
6843
|
-
t.forOf("prop", n, (
|
|
6844
|
-
e.setParams({ missingProperty:
|
|
6387
|
+
function _() {
|
|
6388
|
+
t.forOf("prop", n, (w) => {
|
|
6389
|
+
e.setParams({ missingProperty: w }), t.if((0, code_1$6.noPropertyInData)(t, s, w, l.ownProperties), () => e.error());
|
|
6845
6390
|
});
|
|
6846
6391
|
}
|
|
6847
|
-
function w
|
|
6848
|
-
e.setParams({ missingProperty:
|
|
6849
|
-
t.assign(
|
|
6392
|
+
function v(w, P) {
|
|
6393
|
+
e.setParams({ missingProperty: w }), t.forOf(w, n, () => {
|
|
6394
|
+
t.assign(P, (0, code_1$6.propertyInData)(t, s, w, l.ownProperties)), t.if((0, codegen_1$f.not)(P), () => {
|
|
6850
6395
|
e.error(), t.break();
|
|
6851
6396
|
});
|
|
6852
6397
|
}, codegen_1$f.nil);
|
|
@@ -6896,23 +6441,23 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6896
6441
|
const p = t.let("valid"), d = o.items ? (0, dataType_1.getSchemaTypes)(o.items) : [];
|
|
6897
6442
|
e.block$data(p, u, (0, codegen_1$d._)`${i} === false`), e.ok(p);
|
|
6898
6443
|
function u() {
|
|
6899
|
-
const
|
|
6900
|
-
e.setParams({ i:
|
|
6444
|
+
const P = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6445
|
+
e.setParams({ i: P, j: T }), t.assign(p, !0), t.if((0, codegen_1$d._)`${P} > 1`, () => (_() ? v : w)(P, T));
|
|
6901
6446
|
}
|
|
6902
|
-
function
|
|
6903
|
-
return d.length > 0 && !d.some((
|
|
6447
|
+
function _() {
|
|
6448
|
+
return d.length > 0 && !d.some((P) => P === "object" || P === "array");
|
|
6904
6449
|
}
|
|
6905
|
-
function
|
|
6450
|
+
function v(P, T) {
|
|
6906
6451
|
const $ = t.name("item"), g = (0, dataType_1.checkDataTypes)(d, $, l.opts.strictNumbers, dataType_1.DataType.Wrong), k = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6907
|
-
t.for((0, codegen_1$d._)`;${
|
|
6908
|
-
t.let($, (0, codegen_1$d._)`${r}[${
|
|
6452
|
+
t.for((0, codegen_1$d._)`;${P}--;`, () => {
|
|
6453
|
+
t.let($, (0, codegen_1$d._)`${r}[${P}]`), t.if(g, (0, codegen_1$d._)`continue`), d.length > 1 && t.if((0, codegen_1$d._)`typeof ${$} == "string"`, (0, codegen_1$d._)`${$} += "_"`), t.if((0, codegen_1$d._)`typeof ${k}[${$}] == "number"`, () => {
|
|
6909
6454
|
t.assign(T, (0, codegen_1$d._)`${k}[${$}]`), e.error(), t.assign(p, !1).break();
|
|
6910
|
-
}).code((0, codegen_1$d._)`${k}[${$}] = ${
|
|
6455
|
+
}).code((0, codegen_1$d._)`${k}[${$}] = ${P}`);
|
|
6911
6456
|
});
|
|
6912
6457
|
}
|
|
6913
|
-
function
|
|
6458
|
+
function w(P, T) {
|
|
6914
6459
|
const $ = (0, util_1$g.useFunc)(t, equal_1$2.default), g = t.name("outer");
|
|
6915
|
-
t.label(g).for((0, codegen_1$d._)`;${
|
|
6460
|
+
t.label(g).for((0, codegen_1$d._)`;${P}--;`, () => t.for((0, codegen_1$d._)`${T} = ${P}; ${T}--;`, () => t.if((0, codegen_1$d._)`${$}(${r}[${P}], ${r}[${T}])`, () => {
|
|
6916
6461
|
e.error(), t.assign(p, !1).break(g);
|
|
6917
6462
|
})));
|
|
6918
6463
|
}
|
|
@@ -6953,20 +6498,20 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6953
6498
|
const d = () => p ?? (p = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6954
6499
|
let u;
|
|
6955
6500
|
if (l || n)
|
|
6956
|
-
u = t.let("valid"), e.block$data(u,
|
|
6501
|
+
u = t.let("valid"), e.block$data(u, _);
|
|
6957
6502
|
else {
|
|
6958
6503
|
if (!Array.isArray(s))
|
|
6959
6504
|
throw new Error("ajv implementation error");
|
|
6960
|
-
const
|
|
6961
|
-
u = (0, codegen_1$b.or)(...s.map((
|
|
6505
|
+
const w = t.const("vSchema", o);
|
|
6506
|
+
u = (0, codegen_1$b.or)(...s.map((P, T) => v(w, T)));
|
|
6962
6507
|
}
|
|
6963
6508
|
e.pass(u);
|
|
6964
|
-
function
|
|
6965
|
-
t.assign(u, !1), t.forOf("v", o, (
|
|
6509
|
+
function _() {
|
|
6510
|
+
t.assign(u, !1), t.forOf("v", o, (w) => t.if((0, codegen_1$b._)`${d()}(${r}, ${w})`, () => t.assign(u, !0).break()));
|
|
6966
6511
|
}
|
|
6967
|
-
function w
|
|
6968
|
-
const T = s[
|
|
6969
|
-
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${d()}(${r}, ${
|
|
6512
|
+
function v(w, P) {
|
|
6513
|
+
const T = s[P];
|
|
6514
|
+
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${d()}(${r}, ${w}[${P}])` : (0, codegen_1$b._)`${r} === ${T}`;
|
|
6970
6515
|
}
|
|
6971
6516
|
}
|
|
6972
6517
|
};
|
|
@@ -7050,18 +6595,18 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
7050
6595
|
const { gen: n, parentSchema: s, data: o, keyword: i, it: l } = e;
|
|
7051
6596
|
u(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
7052
6597
|
const p = n.name("valid"), d = n.const("len", (0, codegen_1$9._)`${o}.length`);
|
|
7053
|
-
r.forEach((
|
|
7054
|
-
(0, util_1$c.alwaysValidSchema)(l,
|
|
6598
|
+
r.forEach((_, v) => {
|
|
6599
|
+
(0, util_1$c.alwaysValidSchema)(l, _) || (n.if((0, codegen_1$9._)`${d} > ${v}`, () => e.subschema({
|
|
7055
6600
|
keyword: i,
|
|
7056
|
-
schemaProp:
|
|
7057
|
-
dataProp:
|
|
6601
|
+
schemaProp: v,
|
|
6602
|
+
dataProp: v
|
|
7058
6603
|
}, p)), e.ok(p));
|
|
7059
6604
|
});
|
|
7060
|
-
function u(
|
|
7061
|
-
const { opts:
|
|
7062
|
-
if (
|
|
7063
|
-
const $ = `"${i}" is ${
|
|
7064
|
-
(0, util_1$c.checkStrictMode)(l, $,
|
|
6605
|
+
function u(_) {
|
|
6606
|
+
const { opts: v, errSchemaPath: w } = l, P = r.length, T = P === _.minItems && (P === _.maxItems || _[t] === !1);
|
|
6607
|
+
if (v.strictTuples && !T) {
|
|
6608
|
+
const $ = `"${i}" is ${P}-tuple, but minItems or maxItems/${t} are not specified or different at path "${w}"`;
|
|
6609
|
+
(0, util_1$c.checkStrictMode)(l, $, v.strictTuples);
|
|
7065
6610
|
}
|
|
7066
6611
|
}
|
|
7067
6612
|
}
|
|
@@ -7125,13 +6670,13 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
7125
6670
|
return;
|
|
7126
6671
|
}
|
|
7127
6672
|
o.items = !0;
|
|
7128
|
-
const
|
|
7129
|
-
l === void 0 && i === 1 ?
|
|
7130
|
-
function
|
|
6673
|
+
const _ = t.name("valid");
|
|
6674
|
+
l === void 0 && i === 1 ? w(_, () => t.if(_, () => t.break())) : i === 0 ? (t.let(_, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, v)) : (t.let(_, !1), v()), e.result(_, () => e.reset());
|
|
6675
|
+
function v() {
|
|
7131
6676
|
const T = t.name("_valid"), $ = t.let("count", 0);
|
|
7132
|
-
|
|
6677
|
+
w(T, () => t.if(T, () => P($)));
|
|
7133
6678
|
}
|
|
7134
|
-
function
|
|
6679
|
+
function w(T, $) {
|
|
7135
6680
|
t.forRange("i", 0, u, (g) => {
|
|
7136
6681
|
e.subschema({
|
|
7137
6682
|
keyword: "contains",
|
|
@@ -7141,8 +6686,8 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
7141
6686
|
}, T), $();
|
|
7142
6687
|
});
|
|
7143
6688
|
}
|
|
7144
|
-
function
|
|
7145
|
-
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${i}`, () => t.assign(
|
|
6689
|
+
function P(T) {
|
|
6690
|
+
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${i}`, () => t.assign(_, !0).break()) : (t.if((0, codegen_1$7._)`${T} > ${l}`, () => t.assign(_, !1).break()), i === 1 ? t.assign(_, !0) : t.if((0, codegen_1$7._)`${T} >= ${i}`, () => t.assign(_, !0)));
|
|
7146
6691
|
}
|
|
7147
6692
|
}
|
|
7148
6693
|
};
|
|
@@ -7153,11 +6698,11 @@ var dependencies = {};
|
|
|
7153
6698
|
const t = codegen, r = util, n = code;
|
|
7154
6699
|
e.error = {
|
|
7155
6700
|
message: ({ params: { property: p, depsCount: d, deps: u } }) => {
|
|
7156
|
-
const
|
|
7157
|
-
return (0, t.str)`must have ${
|
|
6701
|
+
const _ = d === 1 ? "property" : "properties";
|
|
6702
|
+
return (0, t.str)`must have ${_} ${u} when property ${p} is present`;
|
|
7158
6703
|
},
|
|
7159
|
-
params: ({ params: { property: p, depsCount: d, deps: u, missingProperty:
|
|
7160
|
-
missingProperty: ${
|
|
6704
|
+
params: ({ params: { property: p, depsCount: d, deps: u, missingProperty: _ } }) => (0, t._)`{property: ${p},
|
|
6705
|
+
missingProperty: ${_},
|
|
7161
6706
|
depsCount: ${d},
|
|
7162
6707
|
deps: ${u}}`
|
|
7163
6708
|
// TODO change to reference
|
|
@@ -7174,47 +6719,47 @@ var dependencies = {};
|
|
|
7174
6719
|
};
|
|
7175
6720
|
function o({ schema: p }) {
|
|
7176
6721
|
const d = {}, u = {};
|
|
7177
|
-
for (const
|
|
7178
|
-
if (
|
|
6722
|
+
for (const _ in p) {
|
|
6723
|
+
if (_ === "__proto__")
|
|
7179
6724
|
continue;
|
|
7180
|
-
const
|
|
7181
|
-
|
|
6725
|
+
const v = Array.isArray(p[_]) ? d : u;
|
|
6726
|
+
v[_] = p[_];
|
|
7182
6727
|
}
|
|
7183
6728
|
return [d, u];
|
|
7184
6729
|
}
|
|
7185
6730
|
function i(p, d = p.schema) {
|
|
7186
|
-
const { gen: u, data:
|
|
6731
|
+
const { gen: u, data: _, it: v } = p;
|
|
7187
6732
|
if (Object.keys(d).length === 0)
|
|
7188
6733
|
return;
|
|
7189
|
-
const
|
|
7190
|
-
for (const
|
|
7191
|
-
const T = d[
|
|
6734
|
+
const w = u.let("missing");
|
|
6735
|
+
for (const P in d) {
|
|
6736
|
+
const T = d[P];
|
|
7192
6737
|
if (T.length === 0)
|
|
7193
6738
|
continue;
|
|
7194
|
-
const $ = (0, n.propertyInData)(u,
|
|
6739
|
+
const $ = (0, n.propertyInData)(u, _, P, v.opts.ownProperties);
|
|
7195
6740
|
p.setParams({
|
|
7196
|
-
property:
|
|
6741
|
+
property: P,
|
|
7197
6742
|
depsCount: T.length,
|
|
7198
6743
|
deps: T.join(", ")
|
|
7199
|
-
}),
|
|
6744
|
+
}), v.allErrors ? u.if($, () => {
|
|
7200
6745
|
for (const g of T)
|
|
7201
6746
|
(0, n.checkReportMissingProp)(p, g);
|
|
7202
|
-
}) : (u.if((0, t._)`${$} && (${(0, n.checkMissingProp)(p, T,
|
|
6747
|
+
}) : (u.if((0, t._)`${$} && (${(0, n.checkMissingProp)(p, T, w)})`), (0, n.reportMissingProp)(p, w), u.else());
|
|
7203
6748
|
}
|
|
7204
6749
|
}
|
|
7205
6750
|
e.validatePropertyDeps = i;
|
|
7206
6751
|
function l(p, d = p.schema) {
|
|
7207
|
-
const { gen: u, data:
|
|
6752
|
+
const { gen: u, data: _, keyword: v, it: w } = p, P = u.name("valid");
|
|
7208
6753
|
for (const T in d)
|
|
7209
|
-
(0, r.alwaysValidSchema)(
|
|
7210
|
-
(0, n.propertyInData)(u,
|
|
6754
|
+
(0, r.alwaysValidSchema)(w, d[T]) || (u.if(
|
|
6755
|
+
(0, n.propertyInData)(u, _, T, w.opts.ownProperties),
|
|
7211
6756
|
() => {
|
|
7212
|
-
const $ = p.subschema({ keyword:
|
|
7213
|
-
p.mergeValidEvaluated($,
|
|
6757
|
+
const $ = p.subschema({ keyword: v, schemaProp: T }, P);
|
|
6758
|
+
p.mergeValidEvaluated($, P);
|
|
7214
6759
|
},
|
|
7215
|
-
() => u.var(
|
|
6760
|
+
() => u.var(P, !0)
|
|
7216
6761
|
// TODO var
|
|
7217
|
-
), p.ok(
|
|
6762
|
+
), p.ok(P));
|
|
7218
6763
|
}
|
|
7219
6764
|
e.validateSchemaDeps = l, e.default = s;
|
|
7220
6765
|
})(dependencies);
|
|
@@ -7267,13 +6812,13 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
7267
6812
|
if (i.props = !0, p.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(i, r))
|
|
7268
6813
|
return;
|
|
7269
6814
|
const d = (0, code_1$3.allSchemaProperties)(n.properties), u = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
7270
|
-
|
|
7271
|
-
function
|
|
6815
|
+
_(), e.ok((0, codegen_1$5._)`${o} === ${names_1.default.errors}`);
|
|
6816
|
+
function _() {
|
|
7272
6817
|
t.forIn("key", s, ($) => {
|
|
7273
|
-
!d.length && !u.length ?
|
|
6818
|
+
!d.length && !u.length ? P($) : t.if(v($), () => P($));
|
|
7274
6819
|
});
|
|
7275
6820
|
}
|
|
7276
|
-
function
|
|
6821
|
+
function v($) {
|
|
7277
6822
|
let g;
|
|
7278
6823
|
if (d.length > 8) {
|
|
7279
6824
|
const k = (0, util_1$8.schemaRefOrVal)(i, n.properties, "properties");
|
|
@@ -7282,12 +6827,12 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
7282
6827
|
d.length ? g = (0, codegen_1$5.or)(...d.map((k) => (0, codegen_1$5._)`${$} === ${k}`)) : g = codegen_1$5.nil;
|
|
7283
6828
|
return u.length && (g = (0, codegen_1$5.or)(g, ...u.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${$})`))), (0, codegen_1$5.not)(g);
|
|
7284
6829
|
}
|
|
7285
|
-
function
|
|
6830
|
+
function w($) {
|
|
7286
6831
|
t.code((0, codegen_1$5._)`delete ${s}[${$}]`);
|
|
7287
6832
|
}
|
|
7288
|
-
function
|
|
6833
|
+
function P($) {
|
|
7289
6834
|
if (p.removeAdditional === "all" || p.removeAdditional && r === !1) {
|
|
7290
|
-
|
|
6835
|
+
w($);
|
|
7291
6836
|
return;
|
|
7292
6837
|
}
|
|
7293
6838
|
if (r === !1) {
|
|
@@ -7297,7 +6842,7 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
7297
6842
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(i, r)) {
|
|
7298
6843
|
const g = t.name("valid");
|
|
7299
6844
|
p.removeAdditional === "failing" ? (T($, g, !1), t.if((0, codegen_1$5.not)(g), () => {
|
|
7300
|
-
e.reset(),
|
|
6845
|
+
e.reset(), w($);
|
|
7301
6846
|
})) : (T($, g), l || t.if((0, codegen_1$5.not)(g), () => t.break()));
|
|
7302
6847
|
}
|
|
7303
6848
|
}
|
|
@@ -7326,23 +6871,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
7326
6871
|
const { gen: t, schema: r, parentSchema: n, data: s, it: o } = e;
|
|
7327
6872
|
o.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(o, additionalProperties_1$1.default, "additionalProperties"));
|
|
7328
6873
|
const i = (0, code_1$2.allSchemaProperties)(r);
|
|
7329
|
-
for (const
|
|
7330
|
-
o.definedProperties.add(
|
|
6874
|
+
for (const _ of i)
|
|
6875
|
+
o.definedProperties.add(_);
|
|
7331
6876
|
o.opts.unevaluated && i.length && o.props !== !0 && (o.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(i), o.props));
|
|
7332
|
-
const l = i.filter((
|
|
6877
|
+
const l = i.filter((_) => !(0, util_1$7.alwaysValidSchema)(o, r[_]));
|
|
7333
6878
|
if (l.length === 0)
|
|
7334
6879
|
return;
|
|
7335
6880
|
const p = t.name("valid");
|
|
7336
|
-
for (const
|
|
7337
|
-
d(
|
|
7338
|
-
function d(
|
|
7339
|
-
return o.opts.useDefaults && !o.compositeRule && r[
|
|
6881
|
+
for (const _ of l)
|
|
6882
|
+
d(_) ? u(_) : (t.if((0, code_1$2.propertyInData)(t, s, _, o.opts.ownProperties)), u(_), o.allErrors || t.else().var(p, !0), t.endIf()), e.it.definedProperties.add(_), e.ok(p);
|
|
6883
|
+
function d(_) {
|
|
6884
|
+
return o.opts.useDefaults && !o.compositeRule && r[_].default !== void 0;
|
|
7340
6885
|
}
|
|
7341
|
-
function u(
|
|
6886
|
+
function u(_) {
|
|
7342
6887
|
e.subschema({
|
|
7343
6888
|
keyword: "properties",
|
|
7344
|
-
schemaProp:
|
|
7345
|
-
dataProp:
|
|
6889
|
+
schemaProp: _,
|
|
6890
|
+
dataProp: _
|
|
7346
6891
|
}, p);
|
|
7347
6892
|
}
|
|
7348
6893
|
}
|
|
@@ -7360,17 +6905,17 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
7360
6905
|
return;
|
|
7361
6906
|
const d = i.strictSchema && !i.allowMatchingProperties && s.properties, u = t.name("valid");
|
|
7362
6907
|
o.props !== !0 && !(o.props instanceof codegen_1$4.Name) && (o.props = (0, util_2.evaluatedPropsToName)(t, o.props));
|
|
7363
|
-
const { props:
|
|
7364
|
-
|
|
7365
|
-
function
|
|
6908
|
+
const { props: _ } = o;
|
|
6909
|
+
v();
|
|
6910
|
+
function v() {
|
|
7366
6911
|
for (const T of l)
|
|
7367
|
-
d &&
|
|
6912
|
+
d && w(T), o.allErrors ? P(T) : (t.var(u, !0), P(T), t.if(u));
|
|
7368
6913
|
}
|
|
7369
|
-
function
|
|
6914
|
+
function w(T) {
|
|
7370
6915
|
for (const $ in d)
|
|
7371
6916
|
new RegExp(T).test($) && (0, util_1$6.checkStrictMode)(o, `property ${$} matches pattern ${T} (use allowMatchingProperties)`);
|
|
7372
6917
|
}
|
|
7373
|
-
function
|
|
6918
|
+
function P(T) {
|
|
7374
6919
|
t.forIn("key", n, ($) => {
|
|
7375
6920
|
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, T)}.test(${$})`, () => {
|
|
7376
6921
|
const g = p.includes(T);
|
|
@@ -7379,7 +6924,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
7379
6924
|
schemaProp: T,
|
|
7380
6925
|
dataProp: $,
|
|
7381
6926
|
dataPropType: util_2.Type.Str
|
|
7382
|
-
}, u), o.opts.unevaluated &&
|
|
6927
|
+
}, u), o.opts.unevaluated && _ !== !0 ? t.assign((0, codegen_1$4._)`${_}[${$}]`, !0) : !g && !o.allErrors && t.if((0, codegen_1$4.not)(u), () => t.break());
|
|
7383
6928
|
});
|
|
7384
6929
|
});
|
|
7385
6930
|
}
|
|
@@ -7438,14 +6983,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7438
6983
|
const o = r, i = t.let("valid", !1), l = t.let("passing", null), p = t.name("_valid");
|
|
7439
6984
|
e.setParams({ passing: l }), t.block(d), e.result(i, () => e.reset(), () => e.error(!0));
|
|
7440
6985
|
function d() {
|
|
7441
|
-
o.forEach((u,
|
|
7442
|
-
let
|
|
7443
|
-
(0, util_1$4.alwaysValidSchema)(s, u) ? t.var(p, !0) :
|
|
6986
|
+
o.forEach((u, _) => {
|
|
6987
|
+
let v;
|
|
6988
|
+
(0, util_1$4.alwaysValidSchema)(s, u) ? t.var(p, !0) : v = e.subschema({
|
|
7444
6989
|
keyword: "oneOf",
|
|
7445
|
-
schemaProp:
|
|
6990
|
+
schemaProp: _,
|
|
7446
6991
|
compositeRule: !0
|
|
7447
|
-
}, p),
|
|
7448
|
-
t.assign(i, !0), t.assign(l,
|
|
6992
|
+
}, p), _ > 0 && t.if((0, codegen_1$3._)`${p} && ${i}`).assign(i, !1).assign(l, (0, codegen_1$3._)`[${l}, ${_}]`).else(), t.if(p, () => {
|
|
6993
|
+
t.assign(i, !0), t.assign(l, _), v && e.mergeEvaluated(v, codegen_1$3.Name);
|
|
7449
6994
|
});
|
|
7450
6995
|
});
|
|
7451
6996
|
}
|
|
@@ -7503,10 +7048,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7503
7048
|
}, l);
|
|
7504
7049
|
e.mergeEvaluated(u);
|
|
7505
7050
|
}
|
|
7506
|
-
function d(u,
|
|
7051
|
+
function d(u, _) {
|
|
7507
7052
|
return () => {
|
|
7508
|
-
const
|
|
7509
|
-
t.assign(i, l), e.mergeValidEvaluated(
|
|
7053
|
+
const v = e.subschema({ keyword: u }, l);
|
|
7054
|
+
t.assign(i, l), e.mergeValidEvaluated(v, i), _ ? t.assign(_, (0, codegen_1$2._)`${u}`) : e.setParams({ ifClause: u });
|
|
7510
7055
|
};
|
|
7511
7056
|
}
|
|
7512
7057
|
}
|
|
@@ -7559,15 +7104,15 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7559
7104
|
$data: !0,
|
|
7560
7105
|
error: error$1,
|
|
7561
7106
|
code(e, t) {
|
|
7562
|
-
const { gen: r, data: n, $data: s, schema: o, schemaCode: i, it: l } = e, { opts: p, errSchemaPath: d, schemaEnv: u, self:
|
|
7107
|
+
const { gen: r, data: n, $data: s, schema: o, schemaCode: i, it: l } = e, { opts: p, errSchemaPath: d, schemaEnv: u, self: _ } = l;
|
|
7563
7108
|
if (!p.validateFormats)
|
|
7564
7109
|
return;
|
|
7565
|
-
s ?
|
|
7566
|
-
function
|
|
7567
|
-
const
|
|
7568
|
-
ref:
|
|
7110
|
+
s ? v() : w();
|
|
7111
|
+
function v() {
|
|
7112
|
+
const P = r.scopeValue("formats", {
|
|
7113
|
+
ref: _.formats,
|
|
7569
7114
|
code: p.code.formats
|
|
7570
|
-
}), T = r.const("fDef", (0, codegen_1$1._)`${
|
|
7115
|
+
}), T = r.const("fDef", (0, codegen_1$1._)`${P}[${i}]`), $ = r.let("fType"), g = r.let("format");
|
|
7571
7116
|
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign($, (0, codegen_1$1._)`${T}.type || "string"`).assign(g, (0, codegen_1$1._)`${T}.validate`), () => r.assign($, (0, codegen_1$1._)`"string"`).assign(g, T)), e.fail$data((0, codegen_1$1.or)(k(), C()));
|
|
7572
7117
|
function k() {
|
|
7573
7118
|
return p.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${i} && !${g}`;
|
|
@@ -7577,19 +7122,19 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7577
7122
|
return (0, codegen_1$1._)`${g} && ${g} !== true && ${$} === ${t} && !${D}`;
|
|
7578
7123
|
}
|
|
7579
7124
|
}
|
|
7580
|
-
function
|
|
7581
|
-
const
|
|
7582
|
-
if (!
|
|
7125
|
+
function w() {
|
|
7126
|
+
const P = _.formats[o];
|
|
7127
|
+
if (!P) {
|
|
7583
7128
|
k();
|
|
7584
7129
|
return;
|
|
7585
7130
|
}
|
|
7586
|
-
if (
|
|
7131
|
+
if (P === !0)
|
|
7587
7132
|
return;
|
|
7588
|
-
const [T, $, g] = C(
|
|
7133
|
+
const [T, $, g] = C(P);
|
|
7589
7134
|
T === t && e.pass(I());
|
|
7590
7135
|
function k() {
|
|
7591
7136
|
if (p.strictSchema === !1) {
|
|
7592
|
-
|
|
7137
|
+
_.logger.warn(D());
|
|
7593
7138
|
return;
|
|
7594
7139
|
}
|
|
7595
7140
|
throw new Error(D());
|
|
@@ -7598,11 +7143,11 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7598
7143
|
}
|
|
7599
7144
|
}
|
|
7600
7145
|
function C(D) {
|
|
7601
|
-
const
|
|
7146
|
+
const b = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : p.code.formats ? (0, codegen_1$1._)`${p.code.formats}${(0, codegen_1$1.getProperty)(o)}` : void 0, O = r.scopeValue("formats", { key: o, ref: D, code: b });
|
|
7602
7147
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${O}.validate`] : ["string", D, O];
|
|
7603
7148
|
}
|
|
7604
7149
|
function I() {
|
|
7605
|
-
if (typeof
|
|
7150
|
+
if (typeof P == "object" && !(P instanceof RegExp) && P.async) {
|
|
7606
7151
|
if (!u.$async)
|
|
7607
7152
|
throw new Error("async format in sync schema");
|
|
7608
7153
|
return (0, codegen_1$1._)`await ${g}(${n})`;
|
|
@@ -7672,31 +7217,31 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7672
7217
|
const p = t.let("valid", !1), d = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(l)}`);
|
|
7673
7218
|
t.if((0, codegen_1._)`typeof ${d} == "string"`, () => u(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: d, tagName: l })), e.ok(p);
|
|
7674
7219
|
function u() {
|
|
7675
|
-
const
|
|
7220
|
+
const w = v();
|
|
7676
7221
|
t.if(!1);
|
|
7677
|
-
for (const
|
|
7678
|
-
t.elseIf((0, codegen_1._)`${d} === ${
|
|
7222
|
+
for (const P in w)
|
|
7223
|
+
t.elseIf((0, codegen_1._)`${d} === ${P}`), t.assign(p, _(w[P]));
|
|
7679
7224
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: d, tagName: l }), t.endIf();
|
|
7680
7225
|
}
|
|
7681
|
-
function
|
|
7682
|
-
const
|
|
7683
|
-
return e.mergeEvaluated(T, codegen_1.Name),
|
|
7226
|
+
function _(w) {
|
|
7227
|
+
const P = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: w }, P);
|
|
7228
|
+
return e.mergeEvaluated(T, codegen_1.Name), P;
|
|
7684
7229
|
}
|
|
7685
|
-
function
|
|
7686
|
-
var
|
|
7687
|
-
const
|
|
7230
|
+
function v() {
|
|
7231
|
+
var w;
|
|
7232
|
+
const P = {}, T = g(s);
|
|
7688
7233
|
let $ = !0;
|
|
7689
7234
|
for (let I = 0; I < i.length; I++) {
|
|
7690
7235
|
let D = i[I];
|
|
7691
7236
|
D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, o.self.RULES) && (D = compile_1.resolveRef.call(o.self, o.schemaEnv.root, o.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
|
|
7692
|
-
const
|
|
7693
|
-
if (typeof
|
|
7237
|
+
const b = (w = D == null ? void 0 : D.properties) === null || w === void 0 ? void 0 : w[l];
|
|
7238
|
+
if (typeof b != "object")
|
|
7694
7239
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7695
|
-
$ = $ && (T || g(D)), k(
|
|
7240
|
+
$ = $ && (T || g(D)), k(b, I);
|
|
7696
7241
|
}
|
|
7697
7242
|
if (!$)
|
|
7698
7243
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7699
|
-
return
|
|
7244
|
+
return P;
|
|
7700
7245
|
function g({ required: I }) {
|
|
7701
7246
|
return Array.isArray(I) && I.includes(l);
|
|
7702
7247
|
}
|
|
@@ -7704,15 +7249,15 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7704
7249
|
if (I.const)
|
|
7705
7250
|
C(I.const, D);
|
|
7706
7251
|
else if (I.enum)
|
|
7707
|
-
for (const
|
|
7708
|
-
C(
|
|
7252
|
+
for (const b of I.enum)
|
|
7253
|
+
C(b, D);
|
|
7709
7254
|
else
|
|
7710
7255
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7711
7256
|
}
|
|
7712
7257
|
function C(I, D) {
|
|
7713
|
-
if (typeof I != "string" || I in
|
|
7258
|
+
if (typeof I != "string" || I in P)
|
|
7714
7259
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7715
|
-
|
|
7260
|
+
P[I] = D;
|
|
7716
7261
|
}
|
|
7717
7262
|
}
|
|
7718
7263
|
}
|
|
@@ -7964,13 +7509,13 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7964
7509
|
const r = core$2, n = draft7, s = discriminator, o = require$$3, i = ["/properties"], l = "http://json-schema.org/draft-07/schema";
|
|
7965
7510
|
class p extends r.default {
|
|
7966
7511
|
_addVocabularies() {
|
|
7967
|
-
super._addVocabularies(), n.default.forEach((
|
|
7512
|
+
super._addVocabularies(), n.default.forEach((P) => this.addVocabulary(P)), this.opts.discriminator && this.addKeyword(s.default);
|
|
7968
7513
|
}
|
|
7969
7514
|
_addDefaultMetaSchema() {
|
|
7970
7515
|
if (super._addDefaultMetaSchema(), !this.opts.meta)
|
|
7971
7516
|
return;
|
|
7972
|
-
const
|
|
7973
|
-
this.addMetaSchema(
|
|
7517
|
+
const P = this.opts.$data ? this.$dataMetaSchema(o, i) : o;
|
|
7518
|
+
this.addMetaSchema(P, l, !1), this.refs["http://json-schema.org/schema"] = l;
|
|
7974
7519
|
}
|
|
7975
7520
|
defaultMeta() {
|
|
7976
7521
|
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(l) ? l : void 0);
|
|
@@ -7995,13 +7540,13 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7995
7540
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7996
7541
|
return u.CodeGen;
|
|
7997
7542
|
} });
|
|
7998
|
-
var
|
|
7543
|
+
var _ = validation_error;
|
|
7999
7544
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
8000
|
-
return
|
|
7545
|
+
return _.default;
|
|
8001
7546
|
} });
|
|
8002
|
-
var
|
|
7547
|
+
var v = ref_error;
|
|
8003
7548
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
8004
|
-
return
|
|
7549
|
+
return v.default;
|
|
8005
7550
|
} });
|
|
8006
7551
|
})(ajv$1, ajv$1.exports);
|
|
8007
7552
|
var ajvExports = ajv$1.exports;
|
|
@@ -8409,55 +7954,6 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
8409
7954
|
"themeFolderName"
|
|
8410
7955
|
]
|
|
8411
7956
|
},
|
|
8412
|
-
{
|
|
8413
|
-
type: "object",
|
|
8414
|
-
additionalProperties: !1,
|
|
8415
|
-
properties: {
|
|
8416
|
-
progress: {
|
|
8417
|
-
type: "object",
|
|
8418
|
-
properties: {
|
|
8419
|
-
weight: {
|
|
8420
|
-
type: "number"
|
|
8421
|
-
},
|
|
8422
|
-
caption: {
|
|
8423
|
-
type: "string"
|
|
8424
|
-
}
|
|
8425
|
-
},
|
|
8426
|
-
additionalProperties: !1
|
|
8427
|
-
},
|
|
8428
|
-
step: {
|
|
8429
|
-
type: "string",
|
|
8430
|
-
const: "applyWordPressPatches"
|
|
8431
|
-
},
|
|
8432
|
-
siteUrl: {
|
|
8433
|
-
type: "string"
|
|
8434
|
-
},
|
|
8435
|
-
wordpressPath: {
|
|
8436
|
-
type: "string"
|
|
8437
|
-
},
|
|
8438
|
-
addPhpInfo: {
|
|
8439
|
-
type: "boolean"
|
|
8440
|
-
},
|
|
8441
|
-
patchSecrets: {
|
|
8442
|
-
type: "boolean"
|
|
8443
|
-
},
|
|
8444
|
-
disableSiteHealth: {
|
|
8445
|
-
type: "boolean"
|
|
8446
|
-
},
|
|
8447
|
-
disableWpNewBlogNotification: {
|
|
8448
|
-
type: "boolean"
|
|
8449
|
-
},
|
|
8450
|
-
prepareForRunningInsideWebBrowser: {
|
|
8451
|
-
type: "boolean"
|
|
8452
|
-
},
|
|
8453
|
-
addFetchNetworkTransport: {
|
|
8454
|
-
type: "boolean"
|
|
8455
|
-
}
|
|
8456
|
-
},
|
|
8457
|
-
required: [
|
|
8458
|
-
"step"
|
|
8459
|
-
]
|
|
8460
|
-
},
|
|
8461
7957
|
{
|
|
8462
7958
|
type: "object",
|
|
8463
7959
|
additionalProperties: !1,
|
|
@@ -9489,7 +8985,7 @@ function compileBlueprint(e, {
|
|
|
9489
8985
|
onStepCompleted: n = () => {
|
|
9490
8986
|
}
|
|
9491
8987
|
} = {}) {
|
|
9492
|
-
var d, u,
|
|
8988
|
+
var d, u, _;
|
|
9493
8989
|
if (e = {
|
|
9494
8990
|
...e,
|
|
9495
8991
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9500,17 +8996,17 @@ function compileBlueprint(e, {
|
|
|
9500
8996
|
step: "setSiteOptions",
|
|
9501
8997
|
options: e.siteOptions
|
|
9502
8998
|
}), e.plugins) {
|
|
9503
|
-
const
|
|
8999
|
+
const v = e.plugins.map((w) => typeof w == "string" ? w.startsWith("https://") ? {
|
|
9504
9000
|
resource: "url",
|
|
9505
|
-
url:
|
|
9001
|
+
url: w
|
|
9506
9002
|
} : {
|
|
9507
9003
|
resource: "wordpress.org/plugins",
|
|
9508
|
-
slug:
|
|
9509
|
-
} :
|
|
9004
|
+
slug: w
|
|
9005
|
+
} : w).map((w) => ({
|
|
9510
9006
|
step: "installPlugin",
|
|
9511
|
-
pluginZipFile:
|
|
9007
|
+
pluginZipFile: w
|
|
9512
9008
|
}));
|
|
9513
|
-
e.steps.unshift(...
|
|
9009
|
+
e.steps.unshift(...v);
|
|
9514
9010
|
}
|
|
9515
9011
|
e.login && e.steps.push({
|
|
9516
9012
|
step: "login",
|
|
@@ -9518,19 +9014,19 @@ function compileBlueprint(e, {
|
|
|
9518
9014
|
});
|
|
9519
9015
|
const { valid: s, errors: o } = validateBlueprint(e);
|
|
9520
9016
|
if (!s) {
|
|
9521
|
-
const
|
|
9017
|
+
const v = new Error(
|
|
9522
9018
|
`Invalid blueprint: ${o[0].message} at ${o[0].instancePath}`
|
|
9523
9019
|
);
|
|
9524
|
-
throw
|
|
9020
|
+
throw v.errors = o, v;
|
|
9525
9021
|
}
|
|
9526
9022
|
const i = e.steps || [], l = i.reduce(
|
|
9527
|
-
(
|
|
9528
|
-
var
|
|
9529
|
-
return
|
|
9023
|
+
(v, w) => {
|
|
9024
|
+
var P;
|
|
9025
|
+
return v + (((P = w.progress) == null ? void 0 : P.weight) || 1);
|
|
9530
9026
|
},
|
|
9531
9027
|
0
|
|
9532
9028
|
), p = i.map(
|
|
9533
|
-
(
|
|
9029
|
+
(v) => compileStep(v, {
|
|
9534
9030
|
semaphore: r,
|
|
9535
9031
|
rootProgressTracker: t,
|
|
9536
9032
|
totalProgressWeight: l
|
|
@@ -9551,20 +9047,20 @@ function compileBlueprint(e, {
|
|
|
9551
9047
|
),
|
|
9552
9048
|
features: {
|
|
9553
9049
|
// Disable networking by default
|
|
9554
|
-
networking: ((
|
|
9050
|
+
networking: ((_ = e.features) == null ? void 0 : _.networking) ?? !1
|
|
9555
9051
|
},
|
|
9556
|
-
run: async (
|
|
9052
|
+
run: async (v) => {
|
|
9557
9053
|
try {
|
|
9558
|
-
for (const { resources:
|
|
9559
|
-
for (const
|
|
9560
|
-
|
|
9561
|
-
for (const [
|
|
9054
|
+
for (const { resources: w } of p)
|
|
9055
|
+
for (const P of w)
|
|
9056
|
+
P.setPlayground(v), P.isAsync && P.resolve();
|
|
9057
|
+
for (const [w, { run: P, step: T }] of Object.entries(p))
|
|
9562
9058
|
try {
|
|
9563
|
-
const $ = await v
|
|
9059
|
+
const $ = await P(v);
|
|
9564
9060
|
n($, T);
|
|
9565
9061
|
} catch ($) {
|
|
9566
9062
|
throw new Error(
|
|
9567
|
-
`Error when executing the blueprint step #${
|
|
9063
|
+
`Error when executing the blueprint step #${w} (${JSON.stringify(
|
|
9568
9064
|
T
|
|
9569
9065
|
)}). Inspect the cause of this error for more details`,
|
|
9570
9066
|
{
|
|
@@ -9574,7 +9070,7 @@ function compileBlueprint(e, {
|
|
|
9574
9070
|
}
|
|
9575
9071
|
} finally {
|
|
9576
9072
|
try {
|
|
9577
|
-
await
|
|
9073
|
+
await v.goTo(
|
|
9578
9074
|
e.landingPage || "/"
|
|
9579
9075
|
);
|
|
9580
9076
|
} catch {
|
|
@@ -9626,31 +9122,31 @@ function compileStep(e, {
|
|
|
9626
9122
|
const s = r.stage(
|
|
9627
9123
|
(((u = e.progress) == null ? void 0 : u.weight) || 1) / n
|
|
9628
9124
|
), o = {};
|
|
9629
|
-
for (const
|
|
9630
|
-
let
|
|
9631
|
-
isFileReference(
|
|
9125
|
+
for (const _ of Object.keys(e)) {
|
|
9126
|
+
let v = e[_];
|
|
9127
|
+
isFileReference(v) && (v = Resource.create(v, {
|
|
9632
9128
|
semaphore: t
|
|
9633
|
-
})), o[
|
|
9129
|
+
})), o[_] = v;
|
|
9634
9130
|
}
|
|
9635
|
-
const i = async (
|
|
9636
|
-
var
|
|
9131
|
+
const i = async (_) => {
|
|
9132
|
+
var v;
|
|
9637
9133
|
try {
|
|
9638
9134
|
return s.fillSlowly(), await stepHandlers[e.step](
|
|
9639
|
-
|
|
9135
|
+
_,
|
|
9640
9136
|
await resolveArguments(o),
|
|
9641
9137
|
{
|
|
9642
9138
|
tracker: s,
|
|
9643
|
-
initialCaption: (
|
|
9139
|
+
initialCaption: (v = e.progress) == null ? void 0 : v.caption
|
|
9644
9140
|
}
|
|
9645
9141
|
);
|
|
9646
9142
|
} finally {
|
|
9647
9143
|
s.finish();
|
|
9648
9144
|
}
|
|
9649
9145
|
}, l = getResources(o), p = getResources(o).filter(
|
|
9650
|
-
(
|
|
9146
|
+
(_) => _.isAsync
|
|
9651
9147
|
), d = 1 / (p.length + 1);
|
|
9652
|
-
for (const
|
|
9653
|
-
|
|
9148
|
+
for (const _ of p)
|
|
9149
|
+
_.progress = s.stage(d);
|
|
9654
9150
|
return { run: i, step: e, resources: l };
|
|
9655
9151
|
}
|
|
9656
9152
|
function getResources(e) {
|
|
@@ -9725,27 +9221,27 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9725
9221
|
const { id: o, type: i, path: l } = Object.assign({ path: [] }, s.data), p = (s.data.argumentList || []).map(fromWireValue);
|
|
9726
9222
|
let d;
|
|
9727
9223
|
try {
|
|
9728
|
-
const u = l.slice(0, -1).reduce((
|
|
9224
|
+
const u = l.slice(0, -1).reduce((v, w) => v[w], e), _ = l.reduce((v, w) => v[w], e);
|
|
9729
9225
|
switch (i) {
|
|
9730
9226
|
case "GET":
|
|
9731
|
-
d =
|
|
9227
|
+
d = _;
|
|
9732
9228
|
break;
|
|
9733
9229
|
case "SET":
|
|
9734
9230
|
u[l.slice(-1)[0]] = fromWireValue(s.data.value), d = !0;
|
|
9735
9231
|
break;
|
|
9736
9232
|
case "APPLY":
|
|
9737
|
-
d =
|
|
9233
|
+
d = _.apply(u, p);
|
|
9738
9234
|
break;
|
|
9739
9235
|
case "CONSTRUCT":
|
|
9740
9236
|
{
|
|
9741
|
-
const
|
|
9742
|
-
d = proxy(
|
|
9237
|
+
const v = new _(...p);
|
|
9238
|
+
d = proxy(v);
|
|
9743
9239
|
}
|
|
9744
9240
|
break;
|
|
9745
9241
|
case "ENDPOINT":
|
|
9746
9242
|
{
|
|
9747
|
-
const { port1:
|
|
9748
|
-
expose(e,
|
|
9243
|
+
const { port1: v, port2: w } = new MessageChannel();
|
|
9244
|
+
expose(e, w), d = transfer(v, [v]);
|
|
9749
9245
|
}
|
|
9750
9246
|
break;
|
|
9751
9247
|
case "RELEASE":
|
|
@@ -9758,14 +9254,14 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9758
9254
|
d = { value: u, [throwMarker]: 0 };
|
|
9759
9255
|
}
|
|
9760
9256
|
Promise.resolve(d).catch((u) => ({ value: u, [throwMarker]: 0 })).then((u) => {
|
|
9761
|
-
const [
|
|
9762
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9257
|
+
const [_, v] = toWireValue(u);
|
|
9258
|
+
t.postMessage(Object.assign(Object.assign({}, _), { id: o }), v), i === "RELEASE" && (t.removeEventListener("message", n), closeEndPoint(t), finalizer in e && typeof e[finalizer] == "function" && e[finalizer]());
|
|
9763
9259
|
}).catch((u) => {
|
|
9764
|
-
const [
|
|
9260
|
+
const [_, v] = toWireValue({
|
|
9765
9261
|
value: new TypeError("Unserializable return value"),
|
|
9766
9262
|
[throwMarker]: 0
|
|
9767
9263
|
});
|
|
9768
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9264
|
+
t.postMessage(Object.assign(Object.assign({}, _), { id: o }), v);
|
|
9769
9265
|
});
|
|
9770
9266
|
}), t.start && t.start();
|
|
9771
9267
|
}
|
|
@@ -9841,7 +9337,7 @@ function createProxy(e, t = [], r = function() {
|
|
|
9841
9337
|
const [d, u] = processArguments(l);
|
|
9842
9338
|
return requestResponseMessage(e, {
|
|
9843
9339
|
type: "APPLY",
|
|
9844
|
-
path: t.map((
|
|
9340
|
+
path: t.map((_) => _.toString()),
|
|
9845
9341
|
argumentList: d
|
|
9846
9342
|
}, u).then(fromWireValue);
|
|
9847
9343
|
},
|
|
@@ -10068,7 +9564,6 @@ export {
|
|
|
10068
9564
|
SupportedPHPVersionsList,
|
|
10069
9565
|
activatePlugin,
|
|
10070
9566
|
activateTheme,
|
|
10071
|
-
applyWordPressPatches,
|
|
10072
9567
|
compileBlueprint,
|
|
10073
9568
|
connectPlayground,
|
|
10074
9569
|
cp,
|