@wp-playground/blueprints 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__vite-browser-external-2447137e.js +4 -0
- package/__vite-browser-external-b3701507.cjs +1 -0
- package/blueprint-schema.json +0 -47
- package/index.cjs +43 -387
- package/index.d.ts +3 -18
- package/index.js +1126 -1638
- package/lib/steps/enable-multisite.d.ts +1 -1
- package/lib/steps/handlers.d.ts +0 -1
- package/lib/steps/index.d.ts +2 -3
- package/package.json +2 -2
- package/lib/steps/apply-wordpress-patches/index.d.ts +0 -16
package/index.js
CHANGED
|
@@ -67,6 +67,9 @@ if (typeof CustomEvent > "u") {
|
|
|
67
67
|
}
|
|
68
68
|
globalThis.CustomEvent = e;
|
|
69
69
|
}
|
|
70
|
+
typeof crypto > "u" && import("./__vite-browser-external-2447137e.js").then((e) => {
|
|
71
|
+
global.crypto = e;
|
|
72
|
+
});
|
|
70
73
|
const wpContentFilesExcludedFromExport = [
|
|
71
74
|
"db.php",
|
|
72
75
|
"plugins/akismet",
|
|
@@ -267,6 +270,47 @@ set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
|
267
270
|
switch_theme( ${phpVar(t)} );
|
|
268
271
|
`
|
|
269
272
|
});
|
|
273
|
+
}, 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 }) => {
|
|
274
|
+
await e.unlink(t);
|
|
275
|
+
}, runSql = async (e, { sql: t }, r) => {
|
|
276
|
+
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
277
|
+
const n = `/tmp/${crypto.randomUUID()}.sql`;
|
|
278
|
+
await e.writeFile(
|
|
279
|
+
n,
|
|
280
|
+
new Uint8Array(await t.arrayBuffer())
|
|
281
|
+
);
|
|
282
|
+
const s = await e.documentRoot, i = phpVars({ docroot: s, sqlFilename: n }), a = await e.run({
|
|
283
|
+
code: `<?php
|
|
284
|
+
require_once ${i.docroot} . '/wp-load.php';
|
|
285
|
+
|
|
286
|
+
$handle = fopen(${i.sqlFilename}, 'r');
|
|
287
|
+
$buffer = '';
|
|
288
|
+
|
|
289
|
+
global $wpdb;
|
|
290
|
+
|
|
291
|
+
while ($bytes = fgets($handle)) {
|
|
292
|
+
$buffer .= $bytes;
|
|
293
|
+
|
|
294
|
+
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
295
|
+
") {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
$wpdb->query($buffer);
|
|
300
|
+
$buffer = '';
|
|
301
|
+
}
|
|
302
|
+
`
|
|
303
|
+
});
|
|
304
|
+
return await rm(e, { path: n }), a;
|
|
305
|
+
}, setPhpIniEntry = async (e, { key: t, value: r }) => {
|
|
306
|
+
await e.setPhpIniEntry(t, r);
|
|
307
|
+
}, request = async (e, { request: t }) => {
|
|
308
|
+
const r = await e.request(t);
|
|
309
|
+
if (r.httpStatusCode > 399 || r.httpStatusCode < 200)
|
|
310
|
+
throw console.warn("WordPress response was", { response: r }), new Error(
|
|
311
|
+
`Request failed with status ${r.httpStatusCode}`
|
|
312
|
+
);
|
|
313
|
+
return r;
|
|
270
314
|
}, rewriteWpConfigToDefineConstants = `<?php
|
|
271
315
|
|
|
272
316
|
/**
|
|
@@ -635,522 +679,7 @@ async function rewriteDefineCalls(e, t, r) {
|
|
|
635
679
|
`
|
|
636
680
|
}), await e.readFileAsText("/tmp/code.php");
|
|
637
681
|
}
|
|
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, i = phpVars({ docroot: s, sqlFilename: n }), a = await e.run({
|
|
1122
|
-
code: `<?php
|
|
1123
|
-
require_once ${i.docroot} . '/wp-load.php';
|
|
1124
|
-
|
|
1125
|
-
$handle = fopen(${i.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 }), a;
|
|
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) => {
|
|
682
|
+
const login = async (e, { username: t = "admin", password: r = "password" } = {}, n) => {
|
|
1154
683
|
var i, a, l;
|
|
1155
684
|
n == null || n.tracker.setCaption((n == null ? void 0 : n.initialCaption) || "Logging in"), await e.request({
|
|
1156
685
|
url: "/wp-login.php"
|
|
@@ -1204,7 +733,7 @@ function getURLScope(e) {
|
|
|
1204
733
|
return isURLScoped(e) ? e.pathname.split("/")[1].split(":")[1] : null;
|
|
1205
734
|
}
|
|
1206
735
|
const enableMultisite = async (e) => {
|
|
1207
|
-
var
|
|
736
|
+
var E;
|
|
1208
737
|
await defineWpConfigConsts(e, {
|
|
1209
738
|
consts: {
|
|
1210
739
|
WP_ALLOW_MULTISITE: 1
|
|
@@ -1212,8 +741,8 @@ const enableMultisite = async (e) => {
|
|
|
1212
741
|
});
|
|
1213
742
|
const t = new URL(await e.absoluteUrl);
|
|
1214
743
|
if (t.port !== "") {
|
|
1215
|
-
let
|
|
1216
|
-
throw t.hostname === "localhost" && (
|
|
744
|
+
let R = `The current host is ${t.host}, but WordPress multisites do not support custom ports.`;
|
|
745
|
+
throw t.hostname === "localhost" && (R += " For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."), new Error(R);
|
|
1217
746
|
}
|
|
1218
747
|
const r = t.pathname.replace(/\/$/, "") + "/", n = `${t.protocol}//${t.hostname}${r}`;
|
|
1219
748
|
await setSiteOptions(e, {
|
|
@@ -1253,13 +782,13 @@ foreach($plugins as $plugin_path) {
|
|
|
1253
782
|
}
|
|
1254
783
|
echo json_encode($deactivated_plugins);
|
|
1255
784
|
`
|
|
1256
|
-
})).json, p = (
|
|
785
|
+
})).json, p = (E = (await request(e, {
|
|
1257
786
|
request: {
|
|
1258
787
|
url: "/wp-admin/network.php"
|
|
1259
788
|
}
|
|
1260
789
|
})).text.match(
|
|
1261
790
|
/name="_wpnonce"\s+value="([^"]+)"/
|
|
1262
|
-
)) == null ? void 0 :
|
|
791
|
+
)) == null ? void 0 : E[1], u = await request(e, {
|
|
1263
792
|
request: {
|
|
1264
793
|
url: "/wp-admin/network.php",
|
|
1265
794
|
method: "POST",
|
|
@@ -1275,13 +804,13 @@ echo json_encode($deactivated_plugins);
|
|
|
1275
804
|
})
|
|
1276
805
|
}
|
|
1277
806
|
});
|
|
1278
|
-
if (
|
|
807
|
+
if (u.httpStatusCode !== 200)
|
|
1279
808
|
throw console.warn("WordPress response was", {
|
|
1280
|
-
response:
|
|
1281
|
-
text:
|
|
1282
|
-
headers:
|
|
809
|
+
response: u,
|
|
810
|
+
text: u.text,
|
|
811
|
+
headers: u.headers
|
|
1283
812
|
}), new Error(
|
|
1284
|
-
`Failed to enable multisite. Response code was ${
|
|
813
|
+
`Failed to enable multisite. Response code was ${u.httpStatusCode}`
|
|
1285
814
|
);
|
|
1286
815
|
await defineWpConfigConsts(e, {
|
|
1287
816
|
consts: {
|
|
@@ -1294,23 +823,23 @@ echo json_encode($deactivated_plugins);
|
|
|
1294
823
|
PATH_CURRENT_SITE: r
|
|
1295
824
|
}
|
|
1296
825
|
});
|
|
1297
|
-
const
|
|
826
|
+
const d = new URL(await e.absoluteUrl), $ = isURLScoped(d) ? "scope:" + getURLScope(d) : null;
|
|
1298
827
|
await e.writeFile(
|
|
1299
828
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
1300
829
|
`<?php
|
|
1301
830
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
1302
831
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
1303
832
|
}
|
|
1304
|
-
$folder = ${phpVar(
|
|
833
|
+
$folder = ${phpVar($)};
|
|
1305
834
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
1306
|
-
$_SERVER['HTTP_HOST'] = ${phpVar(
|
|
835
|
+
$_SERVER['HTTP_HOST'] = ${phpVar(d.hostname)};
|
|
1307
836
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
1308
837
|
}
|
|
1309
838
|
`
|
|
1310
839
|
), await login(e, {});
|
|
1311
|
-
for (const
|
|
840
|
+
for (const R of a)
|
|
1312
841
|
await activatePlugin(e, {
|
|
1313
|
-
pluginPath:
|
|
842
|
+
pluginPath: R
|
|
1314
843
|
});
|
|
1315
844
|
};
|
|
1316
845
|
function jsonToUrlEncoded(e) {
|
|
@@ -1357,8 +886,8 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
1357
886
|
a.fetch_attachments = "1";
|
|
1358
887
|
for (const p in a)
|
|
1359
888
|
if (p.startsWith("user_map[")) {
|
|
1360
|
-
const
|
|
1361
|
-
a[
|
|
889
|
+
const u = "user_new[" + p.slice(9, -1) + "]";
|
|
890
|
+
a[u] = "1";
|
|
1362
891
|
}
|
|
1363
892
|
await e.request({
|
|
1364
893
|
url: i.action,
|
|
@@ -1493,14 +1022,14 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1493
1022
|
extractToPath: s
|
|
1494
1023
|
}), s = joinPaths(s, r);
|
|
1495
1024
|
const i = joinPaths(s, "wp-content"), a = joinPaths(n, "wp-content");
|
|
1496
|
-
for (const
|
|
1497
|
-
const
|
|
1025
|
+
for (const d of wpContentFilesExcludedFromExport) {
|
|
1026
|
+
const $ = joinPaths(
|
|
1498
1027
|
i,
|
|
1499
|
-
|
|
1028
|
+
d
|
|
1500
1029
|
);
|
|
1501
|
-
await removePath(e,
|
|
1502
|
-
const
|
|
1503
|
-
await e.fileExists(
|
|
1030
|
+
await removePath(e, $);
|
|
1031
|
+
const E = joinPaths(a, d);
|
|
1032
|
+
await e.fileExists(E) && (await e.mkdir(dirname($)), await e.mv(E, $));
|
|
1504
1033
|
}
|
|
1505
1034
|
const l = joinPaths(
|
|
1506
1035
|
s,
|
|
@@ -1512,20 +1041,22 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1512
1041
|
l
|
|
1513
1042
|
);
|
|
1514
1043
|
const p = await e.listFiles(s);
|
|
1515
|
-
for (const
|
|
1516
|
-
await removePath(e, joinPaths(n,
|
|
1517
|
-
joinPaths(s,
|
|
1518
|
-
joinPaths(n,
|
|
1044
|
+
for (const d of p)
|
|
1045
|
+
await removePath(e, joinPaths(n, d)), await e.mv(
|
|
1046
|
+
joinPaths(s, d),
|
|
1047
|
+
joinPaths(n, d)
|
|
1519
1048
|
);
|
|
1520
|
-
await e.rmdir(s)
|
|
1521
|
-
|
|
1049
|
+
await e.rmdir(s), await defineSiteUrl(e, {
|
|
1050
|
+
siteUrl: await e.absoluteUrl
|
|
1051
|
+
});
|
|
1052
|
+
const u = phpVar(
|
|
1522
1053
|
joinPaths(n, "wp-admin", "upgrade.php")
|
|
1523
1054
|
);
|
|
1524
1055
|
await e.run({
|
|
1525
1056
|
throwOnError: !0,
|
|
1526
1057
|
code: `<?php
|
|
1527
1058
|
$_GET['step'] = 'upgrade_db';
|
|
1528
|
-
require ${
|
|
1059
|
+
require ${u};
|
|
1529
1060
|
`
|
|
1530
1061
|
});
|
|
1531
1062
|
};
|
|
@@ -1557,14 +1088,14 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1557
1088
|
let p = await e.listFiles(l, {
|
|
1558
1089
|
prependPath: !0
|
|
1559
1090
|
});
|
|
1560
|
-
p = p.filter((
|
|
1561
|
-
const
|
|
1562
|
-
let
|
|
1563
|
-
|
|
1564
|
-
const
|
|
1565
|
-
return await e.mv(
|
|
1566
|
-
assetFolderPath:
|
|
1567
|
-
assetFolderName:
|
|
1091
|
+
p = p.filter((R) => !R.endsWith("/__MACOSX"));
|
|
1092
|
+
const u = p.length === 1 && await e.isDir(p[0]);
|
|
1093
|
+
let d, $ = "";
|
|
1094
|
+
u ? ($ = p[0], d = p[0].split("/").pop()) : ($ = l, d = s);
|
|
1095
|
+
const E = `${t}/${d}`;
|
|
1096
|
+
return await e.mv($, E), {
|
|
1097
|
+
assetFolderPath: E,
|
|
1098
|
+
assetFolderName: d
|
|
1568
1099
|
};
|
|
1569
1100
|
} finally {
|
|
1570
1101
|
await e.rmdir(a, {
|
|
@@ -1653,7 +1184,6 @@ const installPlugin = async (e, { pluginZipFile: t, options: r = {} }, n) => {
|
|
|
1653
1184
|
__proto__: null,
|
|
1654
1185
|
activatePlugin,
|
|
1655
1186
|
activateTheme,
|
|
1656
|
-
applyWordPressPatches,
|
|
1657
1187
|
cp,
|
|
1658
1188
|
defineSiteUrl,
|
|
1659
1189
|
defineWpConfigConsts,
|
|
@@ -1704,12 +1234,12 @@ function cloneResponseMonitorProgress(e, t) {
|
|
|
1704
1234
|
let l = 0;
|
|
1705
1235
|
for (; ; )
|
|
1706
1236
|
try {
|
|
1707
|
-
const { done: p, value:
|
|
1708
|
-
if (
|
|
1237
|
+
const { done: p, value: u } = await a.read();
|
|
1238
|
+
if (u && (l += u.byteLength), p) {
|
|
1709
1239
|
s(l, l), i.close();
|
|
1710
1240
|
break;
|
|
1711
1241
|
} else
|
|
1712
|
-
s(l, n), i.enqueue(
|
|
1242
|
+
s(l, n), i.enqueue(u);
|
|
1713
1243
|
} catch (p) {
|
|
1714
1244
|
console.error({ e: p }), i.error(p);
|
|
1715
1245
|
break;
|
|
@@ -2106,7 +1636,7 @@ const SupportedPHPVersions = [
|
|
|
2106
1636
|
], SupportedPHPExtensionBundles = {
|
|
2107
1637
|
"kitchen-sink": SupportedPHPExtensionsList
|
|
2108
1638
|
};
|
|
2109
|
-
var De,
|
|
1639
|
+
var De, Ge;
|
|
2110
1640
|
class PHPBrowser {
|
|
2111
1641
|
/**
|
|
2112
1642
|
* @param server - The PHP server to browse.
|
|
@@ -2114,8 +1644,8 @@ class PHPBrowser {
|
|
|
2114
1644
|
*/
|
|
2115
1645
|
constructor(t, r = {}) {
|
|
2116
1646
|
Z(this, De, void 0);
|
|
2117
|
-
Z(this,
|
|
2118
|
-
this.requestHandler = t, te(this, De, {}), te(this,
|
|
1647
|
+
Z(this, Ge, void 0);
|
|
1648
|
+
this.requestHandler = t, te(this, De, {}), te(this, Ge, {
|
|
2119
1649
|
handleRedirects: !1,
|
|
2120
1650
|
maxRedirects: 4,
|
|
2121
1651
|
...r
|
|
@@ -2143,7 +1673,7 @@ class PHPBrowser {
|
|
|
2143
1673
|
cookie: this.serializeCookies()
|
|
2144
1674
|
}
|
|
2145
1675
|
});
|
|
2146
|
-
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this,
|
|
1676
|
+
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this, Ge).handleRedirects && n.headers.location && r < H(this, Ge).maxRedirects) {
|
|
2147
1677
|
const s = new URL(
|
|
2148
1678
|
n.headers.location[0],
|
|
2149
1679
|
this.requestHandler.absoluteUrl
|
|
@@ -2193,7 +1723,7 @@ class PHPBrowser {
|
|
|
2193
1723
|
return t.join("; ");
|
|
2194
1724
|
}
|
|
2195
1725
|
}
|
|
2196
|
-
De = new WeakMap(),
|
|
1726
|
+
De = new WeakMap(), Ge = new WeakMap();
|
|
2197
1727
|
const DEFAULT_BASE_URL = "http://example.com";
|
|
2198
1728
|
function toRelativeUrl(e) {
|
|
2199
1729
|
return e.toString().substring(e.origin.length);
|
|
@@ -2204,7 +1734,7 @@ function removePathPrefix(e, t) {
|
|
|
2204
1734
|
function ensurePathPrefix(e, t) {
|
|
2205
1735
|
return !t || e.startsWith(t) ? e : t + e;
|
|
2206
1736
|
}
|
|
2207
|
-
var Se,
|
|
1737
|
+
var Se, Ke, dt, Ae, Je, ve, Ze, Fe, mt, xt, _t, Wt, $t, Bt;
|
|
2208
1738
|
class PHPRequestHandler {
|
|
2209
1739
|
/**
|
|
2210
1740
|
* @param php - The PHP instance.
|
|
@@ -2235,30 +1765,30 @@ class PHPRequestHandler {
|
|
|
2235
1765
|
* @throws {Error} If the requested path doesn't exist.
|
|
2236
1766
|
* @returns The resolved filesystem path.
|
|
2237
1767
|
*/
|
|
2238
|
-
Z(this,
|
|
1768
|
+
Z(this, $t);
|
|
2239
1769
|
Z(this, Se, void 0);
|
|
2240
|
-
Z(this,
|
|
1770
|
+
Z(this, Ke, void 0);
|
|
2241
1771
|
Z(this, dt, void 0);
|
|
2242
1772
|
Z(this, Ae, void 0);
|
|
2243
|
-
Z(this, Ke, void 0);
|
|
2244
|
-
Z(this, ve, void 0);
|
|
2245
1773
|
Z(this, Je, void 0);
|
|
1774
|
+
Z(this, ve, void 0);
|
|
2246
1775
|
Z(this, Ze, void 0);
|
|
2247
|
-
|
|
1776
|
+
Z(this, Fe, void 0);
|
|
1777
|
+
te(this, Fe, new Semaphore({ concurrency: 1 }));
|
|
2248
1778
|
const {
|
|
2249
1779
|
documentRoot: n = "/www/",
|
|
2250
1780
|
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
2251
1781
|
} = r;
|
|
2252
1782
|
this.php = t, te(this, Se, n);
|
|
2253
1783
|
const i = new URL(s);
|
|
2254
|
-
te(this, dt, i.hostname), te(this, Ae, i.port ? Number(i.port) : i.protocol === "https:" ? 443 : 80), te(this,
|
|
1784
|
+
te(this, dt, i.hostname), te(this, Ae, i.port ? Number(i.port) : i.protocol === "https:" ? 443 : 80), te(this, Ke, (i.protocol || "").replace(":", ""));
|
|
2255
1785
|
const a = H(this, Ae) !== 443 && H(this, Ae) !== 80;
|
|
2256
|
-
te(this,
|
|
1786
|
+
te(this, Je, [
|
|
2257
1787
|
H(this, dt),
|
|
2258
1788
|
a ? `:${H(this, Ae)}` : ""
|
|
2259
|
-
].join("")), te(this, ve, i.pathname.replace(/\/+$/, "")), te(this,
|
|
2260
|
-
`${H(this,
|
|
2261
|
-
H(this,
|
|
1789
|
+
].join("")), te(this, ve, i.pathname.replace(/\/+$/, "")), te(this, Ze, [
|
|
1790
|
+
`${H(this, Ke)}://`,
|
|
1791
|
+
H(this, Je),
|
|
2262
1792
|
H(this, ve)
|
|
2263
1793
|
].join(""));
|
|
2264
1794
|
}
|
|
@@ -2272,11 +1802,11 @@ class PHPRequestHandler {
|
|
|
2272
1802
|
return r.pathname.startsWith(H(this, ve)) && (r.pathname = r.pathname.slice(H(this, ve).length)), toRelativeUrl(r);
|
|
2273
1803
|
}
|
|
2274
1804
|
get isRequestRunning() {
|
|
2275
|
-
return H(this,
|
|
1805
|
+
return H(this, Fe).running > 0;
|
|
2276
1806
|
}
|
|
2277
1807
|
/** @inheritDoc */
|
|
2278
1808
|
get absoluteUrl() {
|
|
2279
|
-
return H(this,
|
|
1809
|
+
return H(this, Ze);
|
|
2280
1810
|
}
|
|
2281
1811
|
/** @inheritDoc */
|
|
2282
1812
|
get documentRoot() {
|
|
@@ -2291,10 +1821,10 @@ class PHPRequestHandler {
|
|
|
2291
1821
|
n.pathname,
|
|
2292
1822
|
H(this, ve)
|
|
2293
1823
|
), i = `${H(this, Se)}${s}`;
|
|
2294
|
-
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t,
|
|
1824
|
+
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, xt).call(this, i);
|
|
2295
1825
|
}
|
|
2296
1826
|
}
|
|
2297
|
-
Se = new WeakMap(),
|
|
1827
|
+
Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), Ae = new WeakMap(), Je = new WeakMap(), ve = new WeakMap(), Ze = new WeakMap(), Fe = new WeakMap(), mt = new WeakSet(), xt = function(t) {
|
|
2298
1828
|
if (!this.php.fileExists(t))
|
|
2299
1829
|
return new PHPResponse(
|
|
2300
1830
|
404,
|
|
@@ -2319,49 +1849,57 @@ Se = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), Ae = new WeakMap(),
|
|
|
2319
1849
|
},
|
|
2320
1850
|
r
|
|
2321
1851
|
);
|
|
2322
|
-
}, _t = new WeakSet(),
|
|
2323
|
-
var s, i;
|
|
2324
|
-
|
|
1852
|
+
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
1853
|
+
var s, i, a;
|
|
1854
|
+
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1855
|
+
return console.warn(
|
|
1856
|
+
"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."
|
|
1857
|
+
), new PHPResponse(
|
|
1858
|
+
502,
|
|
1859
|
+
{},
|
|
1860
|
+
new TextEncoder().encode("502 Bad Gateway")
|
|
1861
|
+
);
|
|
1862
|
+
const n = await H(this, Fe).acquire();
|
|
2325
1863
|
try {
|
|
2326
1864
|
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this, Se)), this.php.addServerGlobalEntry(
|
|
2327
1865
|
"HTTPS",
|
|
2328
|
-
H(this,
|
|
1866
|
+
H(this, Ze).startsWith("https://") ? "on" : ""
|
|
2329
1867
|
);
|
|
2330
|
-
let
|
|
2331
|
-
const
|
|
2332
|
-
host: H(this,
|
|
1868
|
+
let l = "GET";
|
|
1869
|
+
const p = {
|
|
1870
|
+
host: H(this, Je),
|
|
2333
1871
|
...normalizeHeaders(t.headers || {})
|
|
2334
|
-
},
|
|
1872
|
+
}, u = [];
|
|
2335
1873
|
if (t.files && Object.keys(t.files).length) {
|
|
2336
|
-
|
|
2337
|
-
for (const
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2340
|
-
key:
|
|
2341
|
-
name:
|
|
2342
|
-
type:
|
|
2343
|
-
data: new Uint8Array(await
|
|
1874
|
+
l = "POST";
|
|
1875
|
+
for (const E in t.files) {
|
|
1876
|
+
const R = t.files[E];
|
|
1877
|
+
u.push({
|
|
1878
|
+
key: E,
|
|
1879
|
+
name: R.name,
|
|
1880
|
+
type: R.type,
|
|
1881
|
+
data: new Uint8Array(await R.arrayBuffer())
|
|
2344
1882
|
});
|
|
2345
1883
|
}
|
|
2346
|
-
(
|
|
1884
|
+
(i = p["content-type"]) != null && i.startsWith("multipart/form-data") && (t.formData = parseMultipartFormDataString(
|
|
2347
1885
|
t.body || ""
|
|
2348
|
-
),
|
|
1886
|
+
), p["content-type"] = "application/x-www-form-urlencoded", delete t.body);
|
|
2349
1887
|
}
|
|
2350
1888
|
let d;
|
|
2351
|
-
t.formData !== void 0 ? (
|
|
1889
|
+
t.formData !== void 0 ? (l = "POST", p["content-type"] = p["content-type"] || "application/x-www-form-urlencoded", d = new URLSearchParams(
|
|
2352
1890
|
t.formData
|
|
2353
1891
|
).toString()) : d = t.body;
|
|
2354
|
-
let
|
|
1892
|
+
let $;
|
|
2355
1893
|
try {
|
|
2356
|
-
let
|
|
2357
|
-
if ((
|
|
1894
|
+
let E = r.pathname;
|
|
1895
|
+
if ((a = t.headers) != null && a["x-rewrite-url"])
|
|
2358
1896
|
try {
|
|
2359
|
-
|
|
1897
|
+
E = new URL(
|
|
2360
1898
|
t.headers["x-rewrite-url"]
|
|
2361
1899
|
).pathname;
|
|
2362
1900
|
} catch {
|
|
2363
1901
|
}
|
|
2364
|
-
|
|
1902
|
+
$ = ce(this, $t, Bt).call(this, E);
|
|
2365
1903
|
} catch {
|
|
2366
1904
|
return new PHPResponse(
|
|
2367
1905
|
404,
|
|
@@ -2374,17 +1912,17 @@ Se = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), Ae = new WeakMap(),
|
|
|
2374
1912
|
toRelativeUrl(r),
|
|
2375
1913
|
H(this, ve)
|
|
2376
1914
|
),
|
|
2377
|
-
protocol: H(this,
|
|
2378
|
-
method: t.method ||
|
|
1915
|
+
protocol: H(this, Ke),
|
|
1916
|
+
method: t.method || l,
|
|
2379
1917
|
body: d,
|
|
2380
|
-
fileInfos:
|
|
2381
|
-
scriptPath:
|
|
2382
|
-
headers:
|
|
1918
|
+
fileInfos: u,
|
|
1919
|
+
scriptPath: $,
|
|
1920
|
+
headers: p
|
|
2383
1921
|
});
|
|
2384
1922
|
} finally {
|
|
2385
1923
|
n();
|
|
2386
1924
|
}
|
|
2387
|
-
},
|
|
1925
|
+
}, $t = new WeakSet(), Bt = function(t) {
|
|
2388
1926
|
let r = removePathPrefix(t, H(this, ve));
|
|
2389
1927
|
r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r += "/"), r.endsWith("index.php") || (r += "index.php"));
|
|
2390
1928
|
const n = `${H(this, Se)}${r}`;
|
|
@@ -2400,10 +1938,10 @@ function parseMultipartFormDataString(e) {
|
|
|
2400
1938
|
return s.shift(), s.pop(), s.forEach((i) => {
|
|
2401
1939
|
const a = i.indexOf(`\r
|
|
2402
1940
|
\r
|
|
2403
|
-
`), l = i.substring(0, a).trim(), p = i.substring(a + 4).trim(),
|
|
2404
|
-
if (
|
|
2405
|
-
const
|
|
2406
|
-
t[
|
|
1941
|
+
`), l = i.substring(0, a).trim(), p = i.substring(a + 4).trim(), u = l.match(/name="([^"]+)"/);
|
|
1942
|
+
if (u) {
|
|
1943
|
+
const d = u[1];
|
|
1944
|
+
t[d] = p;
|
|
2407
1945
|
}
|
|
2408
1946
|
}), t;
|
|
2409
1947
|
}
|
|
@@ -2549,8 +2087,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2549
2087
|
} catch (l) {
|
|
2550
2088
|
const p = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2551
2089
|
if (p in FileErrorCodes) {
|
|
2552
|
-
const
|
|
2553
|
-
throw new Error(`${
|
|
2090
|
+
const u = FileErrorCodes[p], d = typeof a[0] == "string" ? a[0] : null, $ = d !== null ? e.replaceAll("{path}", d) : e;
|
|
2091
|
+
throw new Error(`${$}: ${u}`, {
|
|
2554
2092
|
cause: l
|
|
2555
2093
|
});
|
|
2556
2094
|
}
|
|
@@ -2573,7 +2111,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2573
2111
|
return n && s && __defProp(t, r, s), s;
|
|
2574
2112
|
};
|
|
2575
2113
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2576
|
-
var
|
|
2114
|
+
var Me, Qe, Ye, Pe, Re, Te, be, Xe, gt, Gt, yt, Kt, vt, Jt, wt, Zt, Pt, Qt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2577
2115
|
class BasePHP {
|
|
2578
2116
|
/**
|
|
2579
2117
|
* Initializes a PHP runtime.
|
|
@@ -2583,7 +2121,7 @@ class BasePHP {
|
|
|
2583
2121
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2584
2122
|
*/
|
|
2585
2123
|
constructor(e, t) {
|
|
2586
|
-
Z(this,
|
|
2124
|
+
Z(this, gt);
|
|
2587
2125
|
Z(this, yt);
|
|
2588
2126
|
Z(this, vt);
|
|
2589
2127
|
Z(this, wt);
|
|
@@ -2603,8 +2141,8 @@ class BasePHP {
|
|
|
2603
2141
|
*/
|
|
2604
2142
|
Z(this, Tt);
|
|
2605
2143
|
Z(this, kt);
|
|
2606
|
-
Z(this,
|
|
2607
|
-
Z(this,
|
|
2144
|
+
Z(this, Ct);
|
|
2145
|
+
Z(this, Me, void 0);
|
|
2608
2146
|
Z(this, Qe, void 0);
|
|
2609
2147
|
Z(this, Ye, void 0);
|
|
2610
2148
|
Z(this, Pe, void 0);
|
|
@@ -2612,7 +2150,7 @@ class BasePHP {
|
|
|
2612
2150
|
Z(this, Te, void 0);
|
|
2613
2151
|
Z(this, be, void 0);
|
|
2614
2152
|
Z(this, Xe, void 0);
|
|
2615
|
-
te(this,
|
|
2153
|
+
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
2154
|
new PHPRequestHandler(this, t)
|
|
2617
2155
|
));
|
|
2618
2156
|
}
|
|
@@ -2700,7 +2238,7 @@ class BasePHP {
|
|
|
2700
2238
|
setPhpIniEntry(e, t) {
|
|
2701
2239
|
if (H(this, Pe))
|
|
2702
2240
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2703
|
-
H(this,
|
|
2241
|
+
H(this, Me).push([e, t]);
|
|
2704
2242
|
}
|
|
2705
2243
|
/** @inheritDoc */
|
|
2706
2244
|
chdir(e) {
|
|
@@ -2717,13 +2255,13 @@ class BasePHP {
|
|
|
2717
2255
|
const t = await this.semaphore.acquire();
|
|
2718
2256
|
let r;
|
|
2719
2257
|
try {
|
|
2720
|
-
H(this, Pe) || (ce(this,
|
|
2258
|
+
H(this, Pe) || (ce(this, gt, 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
2259
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2722
2260
|
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
2261
|
for (const a of e.fileInfos)
|
|
2724
2262
|
ce(this, Tt, rr).call(this, a);
|
|
2725
2263
|
typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
|
|
2726
|
-
const i = await ce(this,
|
|
2264
|
+
const i = await ce(this, Ct, sr).call(this);
|
|
2727
2265
|
if (e.throwOnError && i.exitCode !== 0) {
|
|
2728
2266
|
const a = {
|
|
2729
2267
|
stdout: i.text,
|
|
@@ -2859,7 +2397,7 @@ class BasePHP {
|
|
|
2859
2397
|
te(this, Pe, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2860
2398
|
}
|
|
2861
2399
|
}
|
|
2862
|
-
|
|
2400
|
+
Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), be = new WeakMap(), Xe = new WeakMap(), gt = new WeakSet(), Gt = function() {
|
|
2863
2401
|
if (this.setPhpIniEntry("auto_prepend_file", "/tmp/consts.php"), this.fileExists("/tmp/consts.php") || this.writeFile(
|
|
2864
2402
|
"/tmp/consts.php",
|
|
2865
2403
|
`<?php
|
|
@@ -2871,8 +2409,8 @@ Fe = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2871
2409
|
}
|
|
2872
2410
|
}
|
|
2873
2411
|
}`
|
|
2874
|
-
), H(this,
|
|
2875
|
-
const e = H(this,
|
|
2412
|
+
), H(this, Me).length > 0) {
|
|
2413
|
+
const e = H(this, Me).map(([t, r]) => `${t}=${r}`).join(`
|
|
2876
2414
|
`) + `
|
|
2877
2415
|
|
|
2878
2416
|
`;
|
|
@@ -3016,15 +2554,15 @@ Fe = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
3016
2554
|
[STRING],
|
|
3017
2555
|
[e]
|
|
3018
2556
|
);
|
|
3019
|
-
},
|
|
2557
|
+
}, Ct = new WeakSet(), sr = async function() {
|
|
3020
2558
|
var s;
|
|
3021
2559
|
let e, t;
|
|
3022
2560
|
try {
|
|
3023
2561
|
e = await new Promise((i, a) => {
|
|
3024
2562
|
var p;
|
|
3025
|
-
t = (
|
|
3026
|
-
const
|
|
3027
|
-
|
|
2563
|
+
t = (u) => {
|
|
2564
|
+
const d = new Error("Rethrown");
|
|
2565
|
+
d.cause = u.error, d.betterMessage = u.message, a(d);
|
|
3028
2566
|
}, (p = H(this, Re)) == null || p.addEventListener(
|
|
3029
2567
|
"error",
|
|
3030
2568
|
t
|
|
@@ -3039,8 +2577,8 @@ Fe = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
3039
2577
|
return l instanceof Promise ? l.then(i, a) : i(l);
|
|
3040
2578
|
});
|
|
3041
2579
|
} catch (i) {
|
|
3042
|
-
for (const
|
|
3043
|
-
typeof this[
|
|
2580
|
+
for (const u in this)
|
|
2581
|
+
typeof this[u] == "function" && (this[u] = () => {
|
|
3044
2582
|
throw new Error(
|
|
3045
2583
|
"PHP runtime has crashed – see the earlier error for details."
|
|
3046
2584
|
);
|
|
@@ -3384,42 +2922,42 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3384
2922
|
}
|
|
3385
2923
|
get str() {
|
|
3386
2924
|
var k;
|
|
3387
|
-
return (k = this._str) !== null && k !== void 0 ? k : this._str = this._items.reduce((
|
|
2925
|
+
return (k = this._str) !== null && k !== void 0 ? k : this._str = this._items.reduce((C, I) => `${C}${I}`, "");
|
|
3388
2926
|
}
|
|
3389
2927
|
get names() {
|
|
3390
2928
|
var k;
|
|
3391
|
-
return (k = this._names) !== null && k !== void 0 ? k : this._names = this._items.reduce((
|
|
2929
|
+
return (k = this._names) !== null && k !== void 0 ? k : this._names = this._items.reduce((C, I) => (I instanceof r && (C[I.str] = (C[I.str] || 0) + 1), C), {});
|
|
3392
2930
|
}
|
|
3393
2931
|
}
|
|
3394
2932
|
e._Code = n, e.nil = new n("");
|
|
3395
2933
|
function s(_, ...k) {
|
|
3396
|
-
const
|
|
2934
|
+
const C = [_[0]];
|
|
3397
2935
|
let I = 0;
|
|
3398
2936
|
for (; I < k.length; )
|
|
3399
|
-
l(
|
|
3400
|
-
return new n(
|
|
2937
|
+
l(C, k[I]), C.push(_[++I]);
|
|
2938
|
+
return new n(C);
|
|
3401
2939
|
}
|
|
3402
2940
|
e._ = s;
|
|
3403
2941
|
const i = new n("+");
|
|
3404
2942
|
function a(_, ...k) {
|
|
3405
|
-
const
|
|
2943
|
+
const C = [R(_[0])];
|
|
3406
2944
|
let I = 0;
|
|
3407
2945
|
for (; I < k.length; )
|
|
3408
|
-
|
|
3409
|
-
return p(
|
|
2946
|
+
C.push(i), l(C, k[I]), C.push(i, R(_[++I]));
|
|
2947
|
+
return p(C), new n(C);
|
|
3410
2948
|
}
|
|
3411
2949
|
e.str = a;
|
|
3412
2950
|
function l(_, k) {
|
|
3413
|
-
k instanceof n ? _.push(...k._items) : k instanceof r ? _.push(k) : _.push(
|
|
2951
|
+
k instanceof n ? _.push(...k._items) : k instanceof r ? _.push(k) : _.push($(k));
|
|
3414
2952
|
}
|
|
3415
2953
|
e.addCodeArg = l;
|
|
3416
2954
|
function p(_) {
|
|
3417
2955
|
let k = 1;
|
|
3418
2956
|
for (; k < _.length - 1; ) {
|
|
3419
2957
|
if (_[k] === i) {
|
|
3420
|
-
const
|
|
3421
|
-
if (
|
|
3422
|
-
_.splice(k - 1, 3,
|
|
2958
|
+
const C = u(_[k - 1], _[k + 1]);
|
|
2959
|
+
if (C !== void 0) {
|
|
2960
|
+
_.splice(k - 1, 3, C);
|
|
3423
2961
|
continue;
|
|
3424
2962
|
}
|
|
3425
2963
|
_[k++] = "+";
|
|
@@ -3427,7 +2965,7 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3427
2965
|
k++;
|
|
3428
2966
|
}
|
|
3429
2967
|
}
|
|
3430
|
-
function
|
|
2968
|
+
function u(_, k) {
|
|
3431
2969
|
if (k === '""')
|
|
3432
2970
|
return _;
|
|
3433
2971
|
if (_ === '""')
|
|
@@ -3437,43 +2975,43 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3437
2975
|
if (typeof k == "string" && k[0] === '"' && !(_ instanceof r))
|
|
3438
2976
|
return `"${_}${k.slice(1)}`;
|
|
3439
2977
|
}
|
|
3440
|
-
function
|
|
2978
|
+
function d(_, k) {
|
|
3441
2979
|
return k.emptyStr() ? _ : _.emptyStr() ? k : a`${_}${k}`;
|
|
3442
2980
|
}
|
|
3443
|
-
e.strConcat =
|
|
3444
|
-
function
|
|
3445
|
-
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ :
|
|
2981
|
+
e.strConcat = d;
|
|
2982
|
+
function $(_) {
|
|
2983
|
+
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : R(Array.isArray(_) ? _.join(",") : _);
|
|
3446
2984
|
}
|
|
3447
|
-
function
|
|
3448
|
-
return new n(
|
|
2985
|
+
function E(_) {
|
|
2986
|
+
return new n(R(_));
|
|
3449
2987
|
}
|
|
3450
|
-
e.stringify =
|
|
3451
|
-
function
|
|
2988
|
+
e.stringify = E;
|
|
2989
|
+
function R(_) {
|
|
3452
2990
|
return JSON.stringify(_).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3453
2991
|
}
|
|
3454
|
-
e.safeStringify =
|
|
2992
|
+
e.safeStringify = R;
|
|
3455
2993
|
function v(_) {
|
|
3456
2994
|
return typeof _ == "string" && e.IDENTIFIER.test(_) ? new n(`.${_}`) : s`[${_}]`;
|
|
3457
2995
|
}
|
|
3458
2996
|
e.getProperty = v;
|
|
3459
|
-
function
|
|
2997
|
+
function T(_) {
|
|
3460
2998
|
if (typeof _ == "string" && e.IDENTIFIER.test(_))
|
|
3461
2999
|
return new n(`${_}`);
|
|
3462
3000
|
throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`);
|
|
3463
3001
|
}
|
|
3464
|
-
e.getEsmExportName =
|
|
3465
|
-
function
|
|
3002
|
+
e.getEsmExportName = T;
|
|
3003
|
+
function g(_) {
|
|
3466
3004
|
return new n(_.toString());
|
|
3467
3005
|
}
|
|
3468
|
-
e.regexpCode =
|
|
3006
|
+
e.regexpCode = g;
|
|
3469
3007
|
})(code$1);
|
|
3470
3008
|
var scope = {};
|
|
3471
3009
|
(function(e) {
|
|
3472
3010
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0;
|
|
3473
3011
|
const t = code$1;
|
|
3474
3012
|
class r extends Error {
|
|
3475
|
-
constructor(
|
|
3476
|
-
super(`CodeGen: "code" for ${
|
|
3013
|
+
constructor(u) {
|
|
3014
|
+
super(`CodeGen: "code" for ${u} not defined`), this.value = u.value;
|
|
3477
3015
|
}
|
|
3478
3016
|
}
|
|
3479
3017
|
var n;
|
|
@@ -3485,105 +3023,105 @@ var scope = {};
|
|
|
3485
3023
|
var: new t.Name("var")
|
|
3486
3024
|
};
|
|
3487
3025
|
class s {
|
|
3488
|
-
constructor({ prefixes:
|
|
3489
|
-
this._names = {}, this._prefixes =
|
|
3026
|
+
constructor({ prefixes: u, parent: d } = {}) {
|
|
3027
|
+
this._names = {}, this._prefixes = u, this._parent = d;
|
|
3490
3028
|
}
|
|
3491
|
-
toName(
|
|
3492
|
-
return
|
|
3029
|
+
toName(u) {
|
|
3030
|
+
return u instanceof t.Name ? u : this.name(u);
|
|
3493
3031
|
}
|
|
3494
|
-
name(
|
|
3495
|
-
return new t.Name(this._newName(
|
|
3032
|
+
name(u) {
|
|
3033
|
+
return new t.Name(this._newName(u));
|
|
3496
3034
|
}
|
|
3497
|
-
_newName(
|
|
3498
|
-
const
|
|
3499
|
-
return `${
|
|
3035
|
+
_newName(u) {
|
|
3036
|
+
const d = this._names[u] || this._nameGroup(u);
|
|
3037
|
+
return `${u}${d.index++}`;
|
|
3500
3038
|
}
|
|
3501
|
-
_nameGroup(
|
|
3502
|
-
var
|
|
3503
|
-
if (!((
|
|
3504
|
-
throw new Error(`CodeGen: prefix "${
|
|
3505
|
-
return this._names[
|
|
3039
|
+
_nameGroup(u) {
|
|
3040
|
+
var d, $;
|
|
3041
|
+
if (!(($ = (d = this._parent) === null || d === void 0 ? void 0 : d._prefixes) === null || $ === void 0) && $.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3042
|
+
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3043
|
+
return this._names[u] = { prefix: u, index: 0 };
|
|
3506
3044
|
}
|
|
3507
3045
|
}
|
|
3508
3046
|
e.Scope = s;
|
|
3509
3047
|
class i extends t.Name {
|
|
3510
|
-
constructor(
|
|
3511
|
-
super(
|
|
3048
|
+
constructor(u, d) {
|
|
3049
|
+
super(d), this.prefix = u;
|
|
3512
3050
|
}
|
|
3513
|
-
setValue(
|
|
3514
|
-
this.value =
|
|
3051
|
+
setValue(u, { property: d, itemIndex: $ }) {
|
|
3052
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(d)}[${$}]`;
|
|
3515
3053
|
}
|
|
3516
3054
|
}
|
|
3517
3055
|
e.ValueScopeName = i;
|
|
3518
3056
|
const a = (0, t._)`\n`;
|
|
3519
3057
|
class l extends s {
|
|
3520
|
-
constructor(
|
|
3521
|
-
super(
|
|
3058
|
+
constructor(u) {
|
|
3059
|
+
super(u), this._values = {}, this._scope = u.scope, this.opts = { ...u, _n: u.lines ? a : t.nil };
|
|
3522
3060
|
}
|
|
3523
3061
|
get() {
|
|
3524
3062
|
return this._scope;
|
|
3525
3063
|
}
|
|
3526
|
-
name(
|
|
3527
|
-
return new i(
|
|
3064
|
+
name(u) {
|
|
3065
|
+
return new i(u, this._newName(u));
|
|
3528
3066
|
}
|
|
3529
|
-
value(
|
|
3530
|
-
var
|
|
3531
|
-
if (
|
|
3067
|
+
value(u, d) {
|
|
3068
|
+
var $;
|
|
3069
|
+
if (d.ref === void 0)
|
|
3532
3070
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3533
|
-
const
|
|
3534
|
-
let
|
|
3535
|
-
if (
|
|
3536
|
-
const k =
|
|
3071
|
+
const E = this.toName(u), { prefix: R } = E, v = ($ = d.key) !== null && $ !== void 0 ? $ : d.ref;
|
|
3072
|
+
let T = this._values[R];
|
|
3073
|
+
if (T) {
|
|
3074
|
+
const k = T.get(v);
|
|
3537
3075
|
if (k)
|
|
3538
3076
|
return k;
|
|
3539
3077
|
} else
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
const
|
|
3543
|
-
return
|
|
3544
|
-
}
|
|
3545
|
-
getValue(
|
|
3546
|
-
const
|
|
3547
|
-
if (
|
|
3548
|
-
return
|
|
3549
|
-
}
|
|
3550
|
-
scopeRefs(
|
|
3551
|
-
return this._reduceValues(
|
|
3552
|
-
if (
|
|
3553
|
-
throw new Error(`CodeGen: name "${
|
|
3554
|
-
return (0, t._)`${
|
|
3078
|
+
T = this._values[R] = /* @__PURE__ */ new Map();
|
|
3079
|
+
T.set(v, E);
|
|
3080
|
+
const g = this._scope[R] || (this._scope[R] = []), _ = g.length;
|
|
3081
|
+
return g[_] = d.ref, E.setValue(d, { property: R, itemIndex: _ }), E;
|
|
3082
|
+
}
|
|
3083
|
+
getValue(u, d) {
|
|
3084
|
+
const $ = this._values[u];
|
|
3085
|
+
if ($)
|
|
3086
|
+
return $.get(d);
|
|
3087
|
+
}
|
|
3088
|
+
scopeRefs(u, d = this._values) {
|
|
3089
|
+
return this._reduceValues(d, ($) => {
|
|
3090
|
+
if ($.scopePath === void 0)
|
|
3091
|
+
throw new Error(`CodeGen: name "${$}" has no value`);
|
|
3092
|
+
return (0, t._)`${u}${$.scopePath}`;
|
|
3555
3093
|
});
|
|
3556
3094
|
}
|
|
3557
|
-
scopeCode(
|
|
3558
|
-
return this._reduceValues(
|
|
3559
|
-
if (
|
|
3560
|
-
throw new Error(`CodeGen: name "${
|
|
3561
|
-
return
|
|
3562
|
-
},
|
|
3563
|
-
}
|
|
3564
|
-
_reduceValues(
|
|
3565
|
-
let
|
|
3566
|
-
for (const v in
|
|
3567
|
-
const
|
|
3568
|
-
if (!
|
|
3095
|
+
scopeCode(u = this._values, d, $) {
|
|
3096
|
+
return this._reduceValues(u, (E) => {
|
|
3097
|
+
if (E.value === void 0)
|
|
3098
|
+
throw new Error(`CodeGen: name "${E}" has no value`);
|
|
3099
|
+
return E.value.code;
|
|
3100
|
+
}, d, $);
|
|
3101
|
+
}
|
|
3102
|
+
_reduceValues(u, d, $ = {}, E) {
|
|
3103
|
+
let R = t.nil;
|
|
3104
|
+
for (const v in u) {
|
|
3105
|
+
const T = u[v];
|
|
3106
|
+
if (!T)
|
|
3569
3107
|
continue;
|
|
3570
|
-
const
|
|
3571
|
-
|
|
3572
|
-
if (
|
|
3108
|
+
const g = $[v] = $[v] || /* @__PURE__ */ new Map();
|
|
3109
|
+
T.forEach((_) => {
|
|
3110
|
+
if (g.has(_))
|
|
3573
3111
|
return;
|
|
3574
|
-
|
|
3575
|
-
let k =
|
|
3112
|
+
g.set(_, n.Started);
|
|
3113
|
+
let k = d(_);
|
|
3576
3114
|
if (k) {
|
|
3577
|
-
const
|
|
3578
|
-
|
|
3579
|
-
} else if (k =
|
|
3580
|
-
|
|
3115
|
+
const C = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3116
|
+
R = (0, t._)`${R}${C} ${_} = ${k};${this.opts._n}`;
|
|
3117
|
+
} else if (k = E == null ? void 0 : E(_))
|
|
3118
|
+
R = (0, t._)`${R}${k}${this.opts._n}`;
|
|
3581
3119
|
else
|
|
3582
3120
|
throw new r(_);
|
|
3583
|
-
|
|
3121
|
+
g.set(_, n.Completed);
|
|
3584
3122
|
});
|
|
3585
3123
|
}
|
|
3586
|
-
return
|
|
3124
|
+
return R;
|
|
3587
3125
|
}
|
|
3588
3126
|
}
|
|
3589
3127
|
e.ValueScope = l;
|
|
@@ -3643,8 +3181,8 @@ var scope = {};
|
|
|
3643
3181
|
super(), this.varKind = o, this.name = h, this.rhs = N;
|
|
3644
3182
|
}
|
|
3645
3183
|
render({ es5: o, _n: h }) {
|
|
3646
|
-
const N = o ? r.varKinds.var : this.varKind,
|
|
3647
|
-
return `${N} ${this.name}${
|
|
3184
|
+
const N = o ? r.varKinds.var : this.varKind, M = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
3185
|
+
return `${N} ${this.name}${M};` + h;
|
|
3648
3186
|
}
|
|
3649
3187
|
optimizeNames(o, h) {
|
|
3650
3188
|
if (o[this.name.str])
|
|
@@ -3671,14 +3209,14 @@ var scope = {};
|
|
|
3671
3209
|
}
|
|
3672
3210
|
}
|
|
3673
3211
|
class p extends l {
|
|
3674
|
-
constructor(o, h, N,
|
|
3675
|
-
super(o, N,
|
|
3212
|
+
constructor(o, h, N, M) {
|
|
3213
|
+
super(o, N, M), this.op = h;
|
|
3676
3214
|
}
|
|
3677
3215
|
render({ _n: o }) {
|
|
3678
3216
|
return `${this.lhs} ${this.op}= ${this.rhs};` + o;
|
|
3679
3217
|
}
|
|
3680
3218
|
}
|
|
3681
|
-
class
|
|
3219
|
+
class u extends i {
|
|
3682
3220
|
constructor(o) {
|
|
3683
3221
|
super(), this.label = o, this.names = {};
|
|
3684
3222
|
}
|
|
@@ -3686,7 +3224,7 @@ var scope = {};
|
|
|
3686
3224
|
return `${this.label}:` + o;
|
|
3687
3225
|
}
|
|
3688
3226
|
}
|
|
3689
|
-
class
|
|
3227
|
+
class d extends i {
|
|
3690
3228
|
constructor(o) {
|
|
3691
3229
|
super(), this.label = o, this.names = {};
|
|
3692
3230
|
}
|
|
@@ -3694,7 +3232,7 @@ var scope = {};
|
|
|
3694
3232
|
return `break${this.label ? ` ${this.label}` : ""};` + o;
|
|
3695
3233
|
}
|
|
3696
3234
|
}
|
|
3697
|
-
class
|
|
3235
|
+
class $ extends i {
|
|
3698
3236
|
constructor(o) {
|
|
3699
3237
|
super(), this.error = o;
|
|
3700
3238
|
}
|
|
@@ -3705,7 +3243,7 @@ var scope = {};
|
|
|
3705
3243
|
return this.error.names;
|
|
3706
3244
|
}
|
|
3707
3245
|
}
|
|
3708
|
-
class
|
|
3246
|
+
class E extends i {
|
|
3709
3247
|
constructor(o) {
|
|
3710
3248
|
super(), this.code = o;
|
|
3711
3249
|
}
|
|
@@ -3722,7 +3260,7 @@ var scope = {};
|
|
|
3722
3260
|
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
3723
3261
|
}
|
|
3724
3262
|
}
|
|
3725
|
-
class
|
|
3263
|
+
class R extends i {
|
|
3726
3264
|
constructor(o = []) {
|
|
3727
3265
|
super(), this.nodes = o;
|
|
3728
3266
|
}
|
|
@@ -3740,10 +3278,10 @@ var scope = {};
|
|
|
3740
3278
|
}
|
|
3741
3279
|
optimizeNames(o, h) {
|
|
3742
3280
|
const { nodes: N } = this;
|
|
3743
|
-
let
|
|
3744
|
-
for (;
|
|
3745
|
-
const
|
|
3746
|
-
|
|
3281
|
+
let M = N.length;
|
|
3282
|
+
for (; M--; ) {
|
|
3283
|
+
const q = N[M];
|
|
3284
|
+
q.optimizeNames(o, h) || (ke(o, q.names), N.splice(M, 1));
|
|
3747
3285
|
}
|
|
3748
3286
|
return N.length > 0 ? this : void 0;
|
|
3749
3287
|
}
|
|
@@ -3751,16 +3289,16 @@ var scope = {};
|
|
|
3751
3289
|
return this.nodes.reduce((o, h) => K(o, h.names), {});
|
|
3752
3290
|
}
|
|
3753
3291
|
}
|
|
3754
|
-
class v extends
|
|
3292
|
+
class v extends R {
|
|
3755
3293
|
render(o) {
|
|
3756
3294
|
return "{" + o._n + super.render(o) + "}" + o._n;
|
|
3757
3295
|
}
|
|
3758
3296
|
}
|
|
3759
|
-
class
|
|
3297
|
+
class T extends R {
|
|
3760
3298
|
}
|
|
3761
|
-
class
|
|
3299
|
+
class g extends v {
|
|
3762
3300
|
}
|
|
3763
|
-
|
|
3301
|
+
g.kind = "else";
|
|
3764
3302
|
class _ extends v {
|
|
3765
3303
|
constructor(o, h) {
|
|
3766
3304
|
super(h), this.condition = o;
|
|
@@ -3777,10 +3315,10 @@ var scope = {};
|
|
|
3777
3315
|
let h = this.else;
|
|
3778
3316
|
if (h) {
|
|
3779
3317
|
const N = h.optimizeNodes();
|
|
3780
|
-
h = this.else = Array.isArray(N) ? new
|
|
3318
|
+
h = this.else = Array.isArray(N) ? new g(N) : N;
|
|
3781
3319
|
}
|
|
3782
3320
|
if (h)
|
|
3783
|
-
return o === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(
|
|
3321
|
+
return o === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(Ce(o), h instanceof _ ? [h] : h.nodes);
|
|
3784
3322
|
if (!(o === !1 || !this.nodes.length))
|
|
3785
3323
|
return this;
|
|
3786
3324
|
}
|
|
@@ -3798,7 +3336,7 @@ var scope = {};
|
|
|
3798
3336
|
class k extends v {
|
|
3799
3337
|
}
|
|
3800
3338
|
k.kind = "for";
|
|
3801
|
-
class
|
|
3339
|
+
class C extends k {
|
|
3802
3340
|
constructor(o) {
|
|
3803
3341
|
super(), this.iteration = o;
|
|
3804
3342
|
}
|
|
@@ -3814,12 +3352,12 @@ var scope = {};
|
|
|
3814
3352
|
}
|
|
3815
3353
|
}
|
|
3816
3354
|
class I extends k {
|
|
3817
|
-
constructor(o, h, N,
|
|
3818
|
-
super(), this.varKind = o, this.name = h, this.from = N, this.to =
|
|
3355
|
+
constructor(o, h, N, M) {
|
|
3356
|
+
super(), this.varKind = o, this.name = h, this.from = N, this.to = M;
|
|
3819
3357
|
}
|
|
3820
3358
|
render(o) {
|
|
3821
|
-
const h = o.es5 ? r.varKinds.var : this.varKind, { name: N, from:
|
|
3822
|
-
return `for(${h} ${N}=${
|
|
3359
|
+
const h = o.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: q } = this;
|
|
3360
|
+
return `for(${h} ${N}=${M}; ${N}<${q}; ${N}++)` + super.render(o);
|
|
3823
3361
|
}
|
|
3824
3362
|
get names() {
|
|
3825
3363
|
const o = ue(super.names, this.from);
|
|
@@ -3827,8 +3365,8 @@ var scope = {};
|
|
|
3827
3365
|
}
|
|
3828
3366
|
}
|
|
3829
3367
|
class A extends k {
|
|
3830
|
-
constructor(o, h, N,
|
|
3831
|
-
super(), this.loop = o, this.varKind = h, this.name = N, this.iterable =
|
|
3368
|
+
constructor(o, h, N, M) {
|
|
3369
|
+
super(), this.loop = o, this.varKind = h, this.name = N, this.iterable = M;
|
|
3832
3370
|
}
|
|
3833
3371
|
render(o) {
|
|
3834
3372
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(o);
|
|
@@ -3850,12 +3388,12 @@ var scope = {};
|
|
|
3850
3388
|
}
|
|
3851
3389
|
}
|
|
3852
3390
|
w.kind = "func";
|
|
3853
|
-
class
|
|
3391
|
+
class O extends R {
|
|
3854
3392
|
render(o) {
|
|
3855
3393
|
return "return " + super.render(o);
|
|
3856
3394
|
}
|
|
3857
3395
|
}
|
|
3858
|
-
|
|
3396
|
+
O.kind = "return";
|
|
3859
3397
|
class D extends v {
|
|
3860
3398
|
render(o) {
|
|
3861
3399
|
let h = "try" + super.render(o);
|
|
@@ -3866,8 +3404,8 @@ var scope = {};
|
|
|
3866
3404
|
return super.optimizeNodes(), (o = this.catch) === null || o === void 0 || o.optimizeNodes(), (h = this.finally) === null || h === void 0 || h.optimizeNodes(), this;
|
|
3867
3405
|
}
|
|
3868
3406
|
optimizeNames(o, h) {
|
|
3869
|
-
var N,
|
|
3870
|
-
return super.optimizeNames(o, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(o, h), (
|
|
3407
|
+
var N, M;
|
|
3408
|
+
return super.optimizeNames(o, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(o, h), (M = this.finally) === null || M === void 0 || M.optimizeNames(o, h), this;
|
|
3871
3409
|
}
|
|
3872
3410
|
get names() {
|
|
3873
3411
|
const o = super.names;
|
|
@@ -3883,16 +3421,16 @@ var scope = {};
|
|
|
3883
3421
|
}
|
|
3884
3422
|
}
|
|
3885
3423
|
z.kind = "catch";
|
|
3886
|
-
class
|
|
3424
|
+
class x extends v {
|
|
3887
3425
|
render(o) {
|
|
3888
3426
|
return "finally" + super.render(o);
|
|
3889
3427
|
}
|
|
3890
3428
|
}
|
|
3891
|
-
|
|
3429
|
+
x.kind = "finally";
|
|
3892
3430
|
class re {
|
|
3893
3431
|
constructor(o, h = {}) {
|
|
3894
3432
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
3895
|
-
` : "" }, this._extScope = o, this._scope = new r.Scope({ parent: o }), this._nodes = [new
|
|
3433
|
+
` : "" }, this._extScope = o, this._scope = new r.Scope({ parent: o }), this._nodes = [new T()];
|
|
3896
3434
|
}
|
|
3897
3435
|
toString() {
|
|
3898
3436
|
return this._root.render(this.opts);
|
|
@@ -3921,9 +3459,9 @@ var scope = {};
|
|
|
3921
3459
|
scopeCode() {
|
|
3922
3460
|
return this._extScope.scopeCode(this._values);
|
|
3923
3461
|
}
|
|
3924
|
-
_def(o, h, N,
|
|
3925
|
-
const
|
|
3926
|
-
return N !== void 0 &&
|
|
3462
|
+
_def(o, h, N, M) {
|
|
3463
|
+
const q = this._scope.toName(h);
|
|
3464
|
+
return N !== void 0 && M && (this._constants[q.str] = N), this._leafNode(new a(o, q, N)), q;
|
|
3927
3465
|
}
|
|
3928
3466
|
// `const` declaration (`var` in es5 mode)
|
|
3929
3467
|
const(o, h, N) {
|
|
@@ -3947,13 +3485,13 @@ var scope = {};
|
|
|
3947
3485
|
}
|
|
3948
3486
|
// appends passed SafeExpr to code or executes Block
|
|
3949
3487
|
code(o) {
|
|
3950
|
-
return typeof o == "function" ? o() : o !== t.nil && this._leafNode(new
|
|
3488
|
+
return typeof o == "function" ? o() : o !== t.nil && this._leafNode(new E(o)), this;
|
|
3951
3489
|
}
|
|
3952
3490
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
3953
3491
|
object(...o) {
|
|
3954
3492
|
const h = ["{"];
|
|
3955
|
-
for (const [N,
|
|
3956
|
-
h.length > 1 && h.push(","), h.push(N), (N !==
|
|
3493
|
+
for (const [N, M] of o)
|
|
3494
|
+
h.length > 1 && h.push(","), h.push(N), (N !== M || this.opts.es5) && (h.push(":"), (0, t.addCodeArg)(h, M));
|
|
3957
3495
|
return h.push("}"), new t._Code(h);
|
|
3958
3496
|
}
|
|
3959
3497
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
@@ -3972,42 +3510,42 @@ var scope = {};
|
|
|
3972
3510
|
}
|
|
3973
3511
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3974
3512
|
else() {
|
|
3975
|
-
return this._elseNode(new
|
|
3513
|
+
return this._elseNode(new g());
|
|
3976
3514
|
}
|
|
3977
3515
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3978
3516
|
endIf() {
|
|
3979
|
-
return this._endBlockNode(_,
|
|
3517
|
+
return this._endBlockNode(_, g);
|
|
3980
3518
|
}
|
|
3981
3519
|
_for(o, h) {
|
|
3982
3520
|
return this._blockNode(o), h && this.code(h).endFor(), this;
|
|
3983
3521
|
}
|
|
3984
3522
|
// a generic `for` clause (or statement if `forBody` is passed)
|
|
3985
3523
|
for(o, h) {
|
|
3986
|
-
return this._for(new
|
|
3524
|
+
return this._for(new C(o), h);
|
|
3987
3525
|
}
|
|
3988
3526
|
// `for` statement for a range of values
|
|
3989
|
-
forRange(o, h, N,
|
|
3990
|
-
const
|
|
3991
|
-
return this._for(new I(
|
|
3527
|
+
forRange(o, h, N, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3528
|
+
const W = this._scope.toName(o);
|
|
3529
|
+
return this._for(new I(q, W, h, N), () => M(W));
|
|
3992
3530
|
}
|
|
3993
3531
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3994
|
-
forOf(o, h, N,
|
|
3995
|
-
const
|
|
3532
|
+
forOf(o, h, N, M = r.varKinds.const) {
|
|
3533
|
+
const q = this._scope.toName(o);
|
|
3996
3534
|
if (this.opts.es5) {
|
|
3997
|
-
const
|
|
3998
|
-
return this.forRange("_i", 0, (0, t._)`${
|
|
3999
|
-
this.var(
|
|
3535
|
+
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3536
|
+
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3537
|
+
this.var(q, (0, t._)`${W}[${G}]`), N(q);
|
|
4000
3538
|
});
|
|
4001
3539
|
}
|
|
4002
|
-
return this._for(new A("of",
|
|
3540
|
+
return this._for(new A("of", M, q, h), () => N(q));
|
|
4003
3541
|
}
|
|
4004
3542
|
// `for-in` statement.
|
|
4005
3543
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
4006
|
-
forIn(o, h, N,
|
|
3544
|
+
forIn(o, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
4007
3545
|
if (this.opts.ownProperties)
|
|
4008
3546
|
return this.forOf(o, (0, t._)`Object.keys(${h})`, N);
|
|
4009
|
-
const
|
|
4010
|
-
return this._for(new A("in",
|
|
3547
|
+
const q = this._scope.toName(o);
|
|
3548
|
+
return this._for(new A("in", M, q, h), () => N(q));
|
|
4011
3549
|
}
|
|
4012
3550
|
// end `for` loop
|
|
4013
3551
|
endFor() {
|
|
@@ -4015,33 +3553,33 @@ var scope = {};
|
|
|
4015
3553
|
}
|
|
4016
3554
|
// `label` statement
|
|
4017
3555
|
label(o) {
|
|
4018
|
-
return this._leafNode(new
|
|
3556
|
+
return this._leafNode(new u(o));
|
|
4019
3557
|
}
|
|
4020
3558
|
// `break` statement
|
|
4021
3559
|
break(o) {
|
|
4022
|
-
return this._leafNode(new
|
|
3560
|
+
return this._leafNode(new d(o));
|
|
4023
3561
|
}
|
|
4024
3562
|
// `return` statement
|
|
4025
3563
|
return(o) {
|
|
4026
|
-
const h = new
|
|
3564
|
+
const h = new O();
|
|
4027
3565
|
if (this._blockNode(h), this.code(o), h.nodes.length !== 1)
|
|
4028
3566
|
throw new Error('CodeGen: "return" should have one node');
|
|
4029
|
-
return this._endBlockNode(
|
|
3567
|
+
return this._endBlockNode(O);
|
|
4030
3568
|
}
|
|
4031
3569
|
// `try` statement
|
|
4032
3570
|
try(o, h, N) {
|
|
4033
3571
|
if (!h && !N)
|
|
4034
3572
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
4035
|
-
const
|
|
4036
|
-
if (this._blockNode(
|
|
4037
|
-
const
|
|
4038
|
-
this._currNode =
|
|
3573
|
+
const M = new D();
|
|
3574
|
+
if (this._blockNode(M), this.code(o), h) {
|
|
3575
|
+
const q = this.name("e");
|
|
3576
|
+
this._currNode = M.catch = new z(q), h(q);
|
|
4039
3577
|
}
|
|
4040
|
-
return N && (this._currNode =
|
|
3578
|
+
return N && (this._currNode = M.finally = new x(), this.code(N)), this._endBlockNode(z, x);
|
|
4041
3579
|
}
|
|
4042
3580
|
// `throw` statement
|
|
4043
3581
|
throw(o) {
|
|
4044
|
-
return this._leafNode(new
|
|
3582
|
+
return this._leafNode(new $(o));
|
|
4045
3583
|
}
|
|
4046
3584
|
// start self-balancing block
|
|
4047
3585
|
block(o, h) {
|
|
@@ -4058,8 +3596,8 @@ var scope = {};
|
|
|
4058
3596
|
return this._nodes.length = h, this;
|
|
4059
3597
|
}
|
|
4060
3598
|
// `function` heading (or definition if funcBody is passed)
|
|
4061
|
-
func(o, h = t.nil, N,
|
|
4062
|
-
return this._blockNode(new w(o, h, N)),
|
|
3599
|
+
func(o, h = t.nil, N, M) {
|
|
3600
|
+
return this._blockNode(new w(o, h, N)), M && this.code(M).endFunc(), this;
|
|
4063
3601
|
}
|
|
4064
3602
|
// end function definition
|
|
4065
3603
|
endFunc() {
|
|
@@ -4111,33 +3649,33 @@ var scope = {};
|
|
|
4111
3649
|
function oe(P, o, h) {
|
|
4112
3650
|
if (P instanceof t.Name)
|
|
4113
3651
|
return N(P);
|
|
4114
|
-
if (!
|
|
3652
|
+
if (!M(P))
|
|
4115
3653
|
return P;
|
|
4116
|
-
return new t._Code(P._items.reduce((
|
|
4117
|
-
function N(
|
|
4118
|
-
const
|
|
4119
|
-
return
|
|
3654
|
+
return new t._Code(P._items.reduce((q, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? q.push(...W._items) : q.push(W), q), []));
|
|
3655
|
+
function N(q) {
|
|
3656
|
+
const W = h[q.str];
|
|
3657
|
+
return W === void 0 || o[q.str] !== 1 ? q : (delete o[q.str], W);
|
|
4120
3658
|
}
|
|
4121
|
-
function q
|
|
4122
|
-
return
|
|
3659
|
+
function M(q) {
|
|
3660
|
+
return q instanceof t._Code && q._items.some((W) => W instanceof t.Name && o[W.str] === 1 && h[W.str] !== void 0);
|
|
4123
3661
|
}
|
|
4124
3662
|
}
|
|
4125
3663
|
function ke(P, o) {
|
|
4126
3664
|
for (const h in o)
|
|
4127
3665
|
P[h] = (P[h] || 0) - (o[h] || 0);
|
|
4128
3666
|
}
|
|
4129
|
-
function
|
|
3667
|
+
function Ce(P) {
|
|
4130
3668
|
return typeof P == "boolean" || typeof P == "number" || P === null ? !P : (0, t._)`!${j(P)}`;
|
|
4131
3669
|
}
|
|
4132
|
-
e.not =
|
|
3670
|
+
e.not = Ce;
|
|
4133
3671
|
const qe = y(e.operators.AND);
|
|
4134
3672
|
function et(...P) {
|
|
4135
3673
|
return P.reduce(qe);
|
|
4136
3674
|
}
|
|
4137
3675
|
e.and = et;
|
|
4138
|
-
const
|
|
3676
|
+
const Ue = y(e.operators.OR);
|
|
4139
3677
|
function F(...P) {
|
|
4140
|
-
return P.reduce(
|
|
3678
|
+
return P.reduce(Ue);
|
|
4141
3679
|
}
|
|
4142
3680
|
e.or = F;
|
|
4143
3681
|
function y(P) {
|
|
@@ -4152,137 +3690,137 @@ var util = {};
|
|
|
4152
3690
|
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
3691
|
const t = codegen, r = code$1;
|
|
4154
3692
|
function n(w) {
|
|
4155
|
-
const
|
|
3693
|
+
const O = {};
|
|
4156
3694
|
for (const D of w)
|
|
4157
|
-
|
|
4158
|
-
return
|
|
3695
|
+
O[D] = !0;
|
|
3696
|
+
return O;
|
|
4159
3697
|
}
|
|
4160
3698
|
e.toHash = n;
|
|
4161
|
-
function s(w,
|
|
4162
|
-
return typeof
|
|
3699
|
+
function s(w, O) {
|
|
3700
|
+
return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (i(w, O), !a(O, w.self.RULES.all));
|
|
4163
3701
|
}
|
|
4164
3702
|
e.alwaysValidSchema = s;
|
|
4165
|
-
function i(w,
|
|
3703
|
+
function i(w, O = w.schema) {
|
|
4166
3704
|
const { opts: D, self: z } = w;
|
|
4167
|
-
if (!D.strictSchema || typeof
|
|
3705
|
+
if (!D.strictSchema || typeof O == "boolean")
|
|
4168
3706
|
return;
|
|
4169
|
-
const
|
|
4170
|
-
for (const re in
|
|
4171
|
-
|
|
3707
|
+
const x = z.RULES.keywords;
|
|
3708
|
+
for (const re in O)
|
|
3709
|
+
x[re] || A(w, `unknown keyword: "${re}"`);
|
|
4172
3710
|
}
|
|
4173
3711
|
e.checkUnknownRules = i;
|
|
4174
|
-
function a(w,
|
|
3712
|
+
function a(w, O) {
|
|
4175
3713
|
if (typeof w == "boolean")
|
|
4176
3714
|
return !w;
|
|
4177
3715
|
for (const D in w)
|
|
4178
|
-
if (
|
|
3716
|
+
if (O[D])
|
|
4179
3717
|
return !0;
|
|
4180
3718
|
return !1;
|
|
4181
3719
|
}
|
|
4182
3720
|
e.schemaHasRules = a;
|
|
4183
|
-
function l(w,
|
|
3721
|
+
function l(w, O) {
|
|
4184
3722
|
if (typeof w == "boolean")
|
|
4185
3723
|
return !w;
|
|
4186
3724
|
for (const D in w)
|
|
4187
|
-
if (D !== "$ref" &&
|
|
3725
|
+
if (D !== "$ref" && O.all[D])
|
|
4188
3726
|
return !0;
|
|
4189
3727
|
return !1;
|
|
4190
3728
|
}
|
|
4191
3729
|
e.schemaHasRulesButRef = l;
|
|
4192
|
-
function p({ topSchemaRef: w, schemaPath:
|
|
4193
|
-
if (!
|
|
3730
|
+
function p({ topSchemaRef: w, schemaPath: O }, D, z, x) {
|
|
3731
|
+
if (!x) {
|
|
4194
3732
|
if (typeof D == "number" || typeof D == "boolean")
|
|
4195
3733
|
return D;
|
|
4196
3734
|
if (typeof D == "string")
|
|
4197
3735
|
return (0, t._)`${D}`;
|
|
4198
3736
|
}
|
|
4199
|
-
return (0, t._)`${w}${
|
|
3737
|
+
return (0, t._)`${w}${O}${(0, t.getProperty)(z)}`;
|
|
4200
3738
|
}
|
|
4201
3739
|
e.schemaRefOrVal = p;
|
|
4202
|
-
function d(w) {
|
|
4203
|
-
return S(decodeURIComponent(w));
|
|
4204
|
-
}
|
|
4205
|
-
e.unescapeFragment = d;
|
|
4206
3740
|
function u(w) {
|
|
4207
|
-
return
|
|
3741
|
+
return E(decodeURIComponent(w));
|
|
3742
|
+
}
|
|
3743
|
+
e.unescapeFragment = u;
|
|
3744
|
+
function d(w) {
|
|
3745
|
+
return encodeURIComponent($(w));
|
|
4208
3746
|
}
|
|
4209
|
-
e.escapeFragment =
|
|
4210
|
-
function
|
|
3747
|
+
e.escapeFragment = d;
|
|
3748
|
+
function $(w) {
|
|
4211
3749
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
4212
3750
|
}
|
|
4213
|
-
e.escapeJsonPointer =
|
|
4214
|
-
function
|
|
3751
|
+
e.escapeJsonPointer = $;
|
|
3752
|
+
function E(w) {
|
|
4215
3753
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
4216
3754
|
}
|
|
4217
|
-
e.unescapeJsonPointer =
|
|
4218
|
-
function
|
|
3755
|
+
e.unescapeJsonPointer = E;
|
|
3756
|
+
function R(w, O) {
|
|
4219
3757
|
if (Array.isArray(w))
|
|
4220
3758
|
for (const D of w)
|
|
4221
|
-
|
|
3759
|
+
O(D);
|
|
4222
3760
|
else
|
|
4223
|
-
|
|
3761
|
+
O(w);
|
|
4224
3762
|
}
|
|
4225
|
-
e.eachItem =
|
|
4226
|
-
function v({ mergeNames: w, mergeToName:
|
|
4227
|
-
return (
|
|
4228
|
-
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(
|
|
4229
|
-
return ue === t.Name && !(oe instanceof t.Name) ? z(
|
|
3763
|
+
e.eachItem = R;
|
|
3764
|
+
function v({ mergeNames: w, mergeToName: O, mergeValues: D, resultToName: z }) {
|
|
3765
|
+
return (x, re, K, ue) => {
|
|
3766
|
+
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(x, re, K) : O(x, re, K), K) : re instanceof t.Name ? (O(x, K, re), re) : D(re, K);
|
|
3767
|
+
return ue === t.Name && !(oe instanceof t.Name) ? z(x, oe) : oe;
|
|
4230
3768
|
};
|
|
4231
3769
|
}
|
|
4232
3770
|
e.mergeEvaluated = {
|
|
4233
3771
|
props: v({
|
|
4234
|
-
mergeNames: (w,
|
|
4235
|
-
w.if((0, t._)`${
|
|
3772
|
+
mergeNames: (w, O, D) => w.if((0, t._)`${D} !== true && ${O} !== undefined`, () => {
|
|
3773
|
+
w.if((0, t._)`${O} === true`, () => w.assign(D, !0), () => w.assign(D, (0, t._)`${D} || {}`).code((0, t._)`Object.assign(${D}, ${O})`));
|
|
4236
3774
|
}),
|
|
4237
|
-
mergeToName: (w,
|
|
4238
|
-
|
|
3775
|
+
mergeToName: (w, O, D) => w.if((0, t._)`${D} !== true`, () => {
|
|
3776
|
+
O === !0 ? w.assign(D, !0) : (w.assign(D, (0, t._)`${D} || {}`), g(w, D, O));
|
|
4239
3777
|
}),
|
|
4240
|
-
mergeValues: (w,
|
|
4241
|
-
resultToName:
|
|
3778
|
+
mergeValues: (w, O) => w === !0 ? !0 : { ...w, ...O },
|
|
3779
|
+
resultToName: T
|
|
4242
3780
|
}),
|
|
4243
3781
|
items: v({
|
|
4244
|
-
mergeNames: (w,
|
|
4245
|
-
mergeToName: (w,
|
|
4246
|
-
mergeValues: (w,
|
|
4247
|
-
resultToName: (w,
|
|
3782
|
+
mergeNames: (w, O, D) => w.if((0, t._)`${D} !== true && ${O} !== undefined`, () => w.assign(D, (0, t._)`${O} === true ? true : ${D} > ${O} ? ${D} : ${O}`)),
|
|
3783
|
+
mergeToName: (w, O, D) => w.if((0, t._)`${D} !== true`, () => w.assign(D, O === !0 ? !0 : (0, t._)`${D} > ${O} ? ${D} : ${O}`)),
|
|
3784
|
+
mergeValues: (w, O) => w === !0 ? !0 : Math.max(w, O),
|
|
3785
|
+
resultToName: (w, O) => w.var("items", O)
|
|
4248
3786
|
})
|
|
4249
3787
|
};
|
|
4250
|
-
function
|
|
4251
|
-
if (
|
|
3788
|
+
function T(w, O) {
|
|
3789
|
+
if (O === !0)
|
|
4252
3790
|
return w.var("props", !0);
|
|
4253
3791
|
const D = w.var("props", (0, t._)`{}`);
|
|
4254
|
-
return
|
|
3792
|
+
return O !== void 0 && g(w, D, O), D;
|
|
4255
3793
|
}
|
|
4256
|
-
e.evaluatedPropsToName =
|
|
4257
|
-
function
|
|
4258
|
-
Object.keys(D).forEach((z) => w.assign((0, t._)`${
|
|
3794
|
+
e.evaluatedPropsToName = T;
|
|
3795
|
+
function g(w, O, D) {
|
|
3796
|
+
Object.keys(D).forEach((z) => w.assign((0, t._)`${O}${(0, t.getProperty)(z)}`, !0));
|
|
4259
3797
|
}
|
|
4260
|
-
e.setEvaluated =
|
|
3798
|
+
e.setEvaluated = g;
|
|
4261
3799
|
const _ = {};
|
|
4262
|
-
function k(w,
|
|
3800
|
+
function k(w, O) {
|
|
4263
3801
|
return w.scopeValue("func", {
|
|
4264
|
-
ref:
|
|
4265
|
-
code: _[
|
|
3802
|
+
ref: O,
|
|
3803
|
+
code: _[O.code] || (_[O.code] = new r._Code(O.code))
|
|
4266
3804
|
});
|
|
4267
3805
|
}
|
|
4268
3806
|
e.useFunc = k;
|
|
4269
|
-
var
|
|
3807
|
+
var C;
|
|
4270
3808
|
(function(w) {
|
|
4271
3809
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
4272
|
-
})(
|
|
4273
|
-
function I(w,
|
|
3810
|
+
})(C = e.Type || (e.Type = {}));
|
|
3811
|
+
function I(w, O, D) {
|
|
4274
3812
|
if (w instanceof t.Name) {
|
|
4275
|
-
const z =
|
|
3813
|
+
const z = O === C.Num;
|
|
4276
3814
|
return D ? z ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : z ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
4277
3815
|
}
|
|
4278
|
-
return D ? (0, t.getProperty)(w).toString() : "/" +
|
|
3816
|
+
return D ? (0, t.getProperty)(w).toString() : "/" + $(w);
|
|
4279
3817
|
}
|
|
4280
3818
|
e.getErrorPath = I;
|
|
4281
|
-
function A(w,
|
|
3819
|
+
function A(w, O, D = w.opts.strictSchema) {
|
|
4282
3820
|
if (D) {
|
|
4283
|
-
if (
|
|
4284
|
-
throw new Error(
|
|
4285
|
-
w.self.logger.warn(
|
|
3821
|
+
if (O = `strict mode: ${O}`, D === !0)
|
|
3822
|
+
throw new Error(O);
|
|
3823
|
+
w.self.logger.warn(O);
|
|
4286
3824
|
}
|
|
4287
3825
|
}
|
|
4288
3826
|
e.checkStrictMode = A;
|
|
@@ -4317,42 +3855,42 @@ names$1.default = names;
|
|
|
4317
3855
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
4318
3856
|
const t = codegen, r = util, n = names$1;
|
|
4319
3857
|
e.keywordError = {
|
|
4320
|
-
message: ({ keyword:
|
|
3858
|
+
message: ({ keyword: g }) => (0, t.str)`must pass "${g}" keyword validation`
|
|
4321
3859
|
}, e.keyword$DataError = {
|
|
4322
|
-
message: ({ keyword:
|
|
3860
|
+
message: ({ keyword: g, schemaType: _ }) => _ ? (0, t.str)`"${g}" keyword must be ${_} ($data)` : (0, t.str)`"${g}" keyword is invalid ($data)`
|
|
4323
3861
|
};
|
|
4324
|
-
function s(
|
|
4325
|
-
const { it: I } =
|
|
4326
|
-
|
|
3862
|
+
function s(g, _ = e.keywordError, k, C) {
|
|
3863
|
+
const { it: I } = g, { gen: A, compositeRule: w, allErrors: O } = I, D = $(g, _, k);
|
|
3864
|
+
C ?? (w || O) ? p(A, D) : u(I, (0, t._)`[${D}]`);
|
|
4327
3865
|
}
|
|
4328
3866
|
e.reportError = s;
|
|
4329
|
-
function i(
|
|
4330
|
-
const { it:
|
|
4331
|
-
p(I,
|
|
3867
|
+
function i(g, _ = e.keywordError, k) {
|
|
3868
|
+
const { it: C } = g, { gen: I, compositeRule: A, allErrors: w } = C, O = $(g, _, k);
|
|
3869
|
+
p(I, O), A || w || u(C, n.default.vErrors);
|
|
4332
3870
|
}
|
|
4333
3871
|
e.reportExtraError = i;
|
|
4334
|
-
function a(
|
|
4335
|
-
|
|
3872
|
+
function a(g, _) {
|
|
3873
|
+
g.assign(n.default.errors, _), g.if((0, t._)`${n.default.vErrors} !== null`, () => g.if(_, () => g.assign((0, t._)`${n.default.vErrors}.length`, _), () => g.assign(n.default.vErrors, null)));
|
|
4336
3874
|
}
|
|
4337
3875
|
e.resetErrorsCount = a;
|
|
4338
|
-
function l({ gen:
|
|
3876
|
+
function l({ gen: g, keyword: _, schemaValue: k, data: C, errsCount: I, it: A }) {
|
|
4339
3877
|
if (I === void 0)
|
|
4340
3878
|
throw new Error("ajv implementation error");
|
|
4341
|
-
const w =
|
|
4342
|
-
|
|
4343
|
-
|
|
3879
|
+
const w = g.name("err");
|
|
3880
|
+
g.forRange("i", I, n.default.errors, (O) => {
|
|
3881
|
+
g.const(w, (0, t._)`${n.default.vErrors}[${O}]`), g.if((0, t._)`${w}.instancePath === undefined`, () => g.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, A.errorPath))), g.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${A.errSchemaPath}/${_}`), A.opts.verbose && (g.assign((0, t._)`${w}.schema`, k), g.assign((0, t._)`${w}.data`, C));
|
|
4344
3882
|
});
|
|
4345
3883
|
}
|
|
4346
3884
|
e.extendErrors = l;
|
|
4347
|
-
function p(
|
|
4348
|
-
const k =
|
|
4349
|
-
|
|
3885
|
+
function p(g, _) {
|
|
3886
|
+
const k = g.const("err", _);
|
|
3887
|
+
g.if((0, t._)`${n.default.vErrors} === null`, () => g.assign(n.default.vErrors, (0, t._)`[${k}]`), (0, t._)`${n.default.vErrors}.push(${k})`), g.code((0, t._)`${n.default.errors}++`);
|
|
4350
3888
|
}
|
|
4351
|
-
function
|
|
4352
|
-
const { gen: k, validateName:
|
|
4353
|
-
I.$async ? k.throw((0, t._)`new ${
|
|
3889
|
+
function u(g, _) {
|
|
3890
|
+
const { gen: k, validateName: C, schemaEnv: I } = g;
|
|
3891
|
+
I.$async ? k.throw((0, t._)`new ${g.ValidationError}(${_})`) : (k.assign((0, t._)`${C}.errors`, _), k.return(!1));
|
|
4354
3892
|
}
|
|
4355
|
-
const
|
|
3893
|
+
const d = {
|
|
4356
3894
|
keyword: new t.Name("keyword"),
|
|
4357
3895
|
schemaPath: new t.Name("schemaPath"),
|
|
4358
3896
|
params: new t.Name("params"),
|
|
@@ -4361,28 +3899,28 @@ names$1.default = names;
|
|
|
4361
3899
|
schema: new t.Name("schema"),
|
|
4362
3900
|
parentSchema: new t.Name("parentSchema")
|
|
4363
3901
|
};
|
|
4364
|
-
function g
|
|
4365
|
-
const { createErrors:
|
|
4366
|
-
return
|
|
4367
|
-
}
|
|
4368
|
-
function
|
|
4369
|
-
const { gen:
|
|
4370
|
-
|
|
4371
|
-
v(
|
|
3902
|
+
function $(g, _, k) {
|
|
3903
|
+
const { createErrors: C } = g.it;
|
|
3904
|
+
return C === !1 ? (0, t._)`{}` : E(g, _, k);
|
|
3905
|
+
}
|
|
3906
|
+
function E(g, _, k = {}) {
|
|
3907
|
+
const { gen: C, it: I } = g, A = [
|
|
3908
|
+
R(I, k),
|
|
3909
|
+
v(g, k)
|
|
4372
3910
|
];
|
|
4373
|
-
return
|
|
3911
|
+
return T(g, _, A), C.object(...A);
|
|
4374
3912
|
}
|
|
4375
|
-
function
|
|
4376
|
-
const k = _ ? (0, t.str)`${
|
|
3913
|
+
function R({ errorPath: g }, { instancePath: _ }) {
|
|
3914
|
+
const k = _ ? (0, t.str)`${g}${(0, r.getErrorPath)(_, r.Type.Str)}` : g;
|
|
4377
3915
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, k)];
|
|
4378
3916
|
}
|
|
4379
|
-
function v({ keyword:
|
|
4380
|
-
let I =
|
|
4381
|
-
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [
|
|
3917
|
+
function v({ keyword: g, it: { errSchemaPath: _ } }, { schemaPath: k, parentSchema: C }) {
|
|
3918
|
+
let I = C ? _ : (0, t.str)`${_}/${g}`;
|
|
3919
|
+
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [d.schemaPath, I];
|
|
4382
3920
|
}
|
|
4383
|
-
function
|
|
4384
|
-
const { keyword: I, data: A, schemaValue: w, it:
|
|
4385
|
-
|
|
3921
|
+
function T(g, { params: _, message: k }, C) {
|
|
3922
|
+
const { keyword: I, data: A, schemaValue: w, it: O } = g, { opts: D, propertyName: z, topSchemaRef: x, schemaPath: re } = O;
|
|
3923
|
+
C.push([d.keyword, I], [d.params, typeof _ == "function" ? _(g) : _ || (0, t._)`{}`]), D.messages && C.push([d.message, typeof k == "function" ? k(g) : k]), D.verbose && C.push([d.schema, w], [d.parentSchema, (0, t._)`${x}${re}`], [n.default.data, A]), z && C.push([d.propertyName, z]);
|
|
4386
3924
|
}
|
|
4387
3925
|
})(errors);
|
|
4388
3926
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4458,86 +3996,86 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4458
3996
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
|
|
4459
3997
|
const t = rules, r = applicability, n = errors, s = codegen, i = util;
|
|
4460
3998
|
var a;
|
|
4461
|
-
(function(
|
|
4462
|
-
|
|
3999
|
+
(function(C) {
|
|
4000
|
+
C[C.Correct = 0] = "Correct", C[C.Wrong = 1] = "Wrong";
|
|
4463
4001
|
})(a = e.DataType || (e.DataType = {}));
|
|
4464
|
-
function l(
|
|
4465
|
-
const I = p(
|
|
4002
|
+
function l(C) {
|
|
4003
|
+
const I = p(C.type);
|
|
4466
4004
|
if (I.includes("null")) {
|
|
4467
|
-
if (
|
|
4005
|
+
if (C.nullable === !1)
|
|
4468
4006
|
throw new Error("type: null contradicts nullable: false");
|
|
4469
4007
|
} else {
|
|
4470
|
-
if (!I.length &&
|
|
4008
|
+
if (!I.length && C.nullable !== void 0)
|
|
4471
4009
|
throw new Error('"nullable" cannot be used without "type"');
|
|
4472
|
-
|
|
4010
|
+
C.nullable === !0 && I.push("null");
|
|
4473
4011
|
}
|
|
4474
4012
|
return I;
|
|
4475
4013
|
}
|
|
4476
4014
|
e.getSchemaTypes = l;
|
|
4477
|
-
function p(
|
|
4478
|
-
const I = Array.isArray(
|
|
4015
|
+
function p(C) {
|
|
4016
|
+
const I = Array.isArray(C) ? C : C ? [C] : [];
|
|
4479
4017
|
if (I.every(t.isJSONType))
|
|
4480
4018
|
return I;
|
|
4481
4019
|
throw new Error("type must be JSONType or JSONType[]: " + I.join(","));
|
|
4482
4020
|
}
|
|
4483
4021
|
e.getJSONTypes = p;
|
|
4484
|
-
function
|
|
4485
|
-
const { gen: A, data: w, opts:
|
|
4022
|
+
function u(C, I) {
|
|
4023
|
+
const { gen: A, data: w, opts: O } = C, D = $(I, O.coerceTypes), z = I.length > 0 && !(D.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(C, I[0]));
|
|
4486
4024
|
if (z) {
|
|
4487
|
-
const
|
|
4488
|
-
A.if(
|
|
4489
|
-
D.length ?
|
|
4025
|
+
const x = T(I, w, O.strictNumbers, a.Wrong);
|
|
4026
|
+
A.if(x, () => {
|
|
4027
|
+
D.length ? E(C, I, D) : _(C);
|
|
4490
4028
|
});
|
|
4491
4029
|
}
|
|
4492
4030
|
return z;
|
|
4493
4031
|
}
|
|
4494
|
-
e.coerceAndCheckDataType =
|
|
4495
|
-
const
|
|
4496
|
-
function
|
|
4497
|
-
return I ?
|
|
4032
|
+
e.coerceAndCheckDataType = u;
|
|
4033
|
+
const d = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4034
|
+
function $(C, I) {
|
|
4035
|
+
return I ? C.filter((A) => d.has(A) || I === "array" && A === "array") : [];
|
|
4498
4036
|
}
|
|
4499
|
-
function
|
|
4500
|
-
const { gen: w, data:
|
|
4501
|
-
D.coerceTypes === "array" && w.if((0, s._)`${z} == 'object' && Array.isArray(${
|
|
4037
|
+
function E(C, I, A) {
|
|
4038
|
+
const { gen: w, data: O, opts: D } = C, z = w.let("dataType", (0, s._)`typeof ${O}`), x = w.let("coerced", (0, s._)`undefined`);
|
|
4039
|
+
D.coerceTypes === "array" && w.if((0, s._)`${z} == 'object' && Array.isArray(${O}) && ${O}.length == 1`, () => w.assign(O, (0, s._)`${O}[0]`).assign(z, (0, s._)`typeof ${O}`).if(T(I, O, D.strictNumbers), () => w.assign(x, O))), w.if((0, s._)`${x} !== undefined`);
|
|
4502
4040
|
for (const K of A)
|
|
4503
|
-
(
|
|
4504
|
-
w.else(), _(
|
|
4505
|
-
w.assign(
|
|
4041
|
+
(d.has(K) || K === "array" && D.coerceTypes === "array") && re(K);
|
|
4042
|
+
w.else(), _(C), w.endIf(), w.if((0, s._)`${x} !== undefined`, () => {
|
|
4043
|
+
w.assign(O, x), R(C, x);
|
|
4506
4044
|
});
|
|
4507
4045
|
function re(K) {
|
|
4508
4046
|
switch (K) {
|
|
4509
4047
|
case "string":
|
|
4510
|
-
w.elseIf((0, s._)`${z} == "number" || ${z} == "boolean"`).assign(
|
|
4048
|
+
w.elseIf((0, s._)`${z} == "number" || ${z} == "boolean"`).assign(x, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(x, (0, s._)`""`);
|
|
4511
4049
|
return;
|
|
4512
4050
|
case "number":
|
|
4513
|
-
w.elseIf((0, s._)`${z} == "boolean" || ${
|
|
4514
|
-
|| (${z} == "string" && ${
|
|
4051
|
+
w.elseIf((0, s._)`${z} == "boolean" || ${O} === null
|
|
4052
|
+
|| (${z} == "string" && ${O} && ${O} == +${O})`).assign(x, (0, s._)`+${O}`);
|
|
4515
4053
|
return;
|
|
4516
4054
|
case "integer":
|
|
4517
|
-
w.elseIf((0, s._)`${z} === "boolean" || ${
|
|
4518
|
-
|| (${z} === "string" && ${
|
|
4055
|
+
w.elseIf((0, s._)`${z} === "boolean" || ${O} === null
|
|
4056
|
+
|| (${z} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(x, (0, s._)`+${O}`);
|
|
4519
4057
|
return;
|
|
4520
4058
|
case "boolean":
|
|
4521
|
-
w.elseIf((0, s._)`${
|
|
4059
|
+
w.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(x, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(x, !0);
|
|
4522
4060
|
return;
|
|
4523
4061
|
case "null":
|
|
4524
|
-
w.elseIf((0, s._)`${
|
|
4062
|
+
w.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), w.assign(x, null);
|
|
4525
4063
|
return;
|
|
4526
4064
|
case "array":
|
|
4527
4065
|
w.elseIf((0, s._)`${z} === "string" || ${z} === "number"
|
|
4528
|
-
|| ${z} === "boolean" || ${
|
|
4066
|
+
|| ${z} === "boolean" || ${O} === null`).assign(x, (0, s._)`[${O}]`);
|
|
4529
4067
|
}
|
|
4530
4068
|
}
|
|
4531
4069
|
}
|
|
4532
|
-
function
|
|
4533
|
-
|
|
4070
|
+
function R({ gen: C, parentData: I, parentDataProperty: A }, w) {
|
|
4071
|
+
C.if((0, s._)`${I} !== undefined`, () => C.assign((0, s._)`${I}[${A}]`, w));
|
|
4534
4072
|
}
|
|
4535
|
-
function v(
|
|
4536
|
-
const
|
|
4073
|
+
function v(C, I, A, w = a.Correct) {
|
|
4074
|
+
const O = w === a.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4537
4075
|
let D;
|
|
4538
|
-
switch (
|
|
4076
|
+
switch (C) {
|
|
4539
4077
|
case "null":
|
|
4540
|
-
return (0, s._)`${I} ${
|
|
4078
|
+
return (0, s._)`${I} ${O} null`;
|
|
4541
4079
|
case "array":
|
|
4542
4080
|
D = (0, s._)`Array.isArray(${I})`;
|
|
4543
4081
|
break;
|
|
@@ -4551,51 +4089,51 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4551
4089
|
D = z();
|
|
4552
4090
|
break;
|
|
4553
4091
|
default:
|
|
4554
|
-
return (0, s._)`typeof ${I} ${
|
|
4092
|
+
return (0, s._)`typeof ${I} ${O} ${C}`;
|
|
4555
4093
|
}
|
|
4556
4094
|
return w === a.Correct ? D : (0, s.not)(D);
|
|
4557
|
-
function z(
|
|
4558
|
-
return (0, s.and)((0, s._)`typeof ${I} == "number"`,
|
|
4095
|
+
function z(x = s.nil) {
|
|
4096
|
+
return (0, s.and)((0, s._)`typeof ${I} == "number"`, x, A ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4559
4097
|
}
|
|
4560
4098
|
}
|
|
4561
4099
|
e.checkDataType = v;
|
|
4562
|
-
function
|
|
4563
|
-
if (
|
|
4564
|
-
return v(
|
|
4565
|
-
let
|
|
4566
|
-
const D = (0, i.toHash)(
|
|
4100
|
+
function T(C, I, A, w) {
|
|
4101
|
+
if (C.length === 1)
|
|
4102
|
+
return v(C[0], I, A, w);
|
|
4103
|
+
let O;
|
|
4104
|
+
const D = (0, i.toHash)(C);
|
|
4567
4105
|
if (D.array && D.object) {
|
|
4568
4106
|
const z = (0, s._)`typeof ${I} != "object"`;
|
|
4569
|
-
|
|
4107
|
+
O = D.null ? z : (0, s._)`!${I} || ${z}`, delete D.null, delete D.array, delete D.object;
|
|
4570
4108
|
} else
|
|
4571
|
-
|
|
4109
|
+
O = s.nil;
|
|
4572
4110
|
D.number && delete D.integer;
|
|
4573
4111
|
for (const z in D)
|
|
4574
|
-
|
|
4575
|
-
return
|
|
4112
|
+
O = (0, s.and)(O, v(z, I, A, w));
|
|
4113
|
+
return O;
|
|
4576
4114
|
}
|
|
4577
|
-
e.checkDataTypes =
|
|
4578
|
-
const
|
|
4579
|
-
message: ({ schema:
|
|
4580
|
-
params: ({ schema:
|
|
4115
|
+
e.checkDataTypes = T;
|
|
4116
|
+
const g = {
|
|
4117
|
+
message: ({ schema: C }) => `must be ${C}`,
|
|
4118
|
+
params: ({ schema: C, schemaValue: I }) => typeof C == "string" ? (0, s._)`{type: ${C}}` : (0, s._)`{type: ${I}}`
|
|
4581
4119
|
};
|
|
4582
|
-
function _(
|
|
4583
|
-
const I = k(
|
|
4584
|
-
(0, n.reportError)(I,
|
|
4120
|
+
function _(C) {
|
|
4121
|
+
const I = k(C);
|
|
4122
|
+
(0, n.reportError)(I, g);
|
|
4585
4123
|
}
|
|
4586
4124
|
e.reportTypeError = _;
|
|
4587
|
-
function k(
|
|
4588
|
-
const { gen: I, data: A, schema: w } =
|
|
4125
|
+
function k(C) {
|
|
4126
|
+
const { gen: I, data: A, schema: w } = C, O = (0, i.schemaRefOrVal)(C, w, "type");
|
|
4589
4127
|
return {
|
|
4590
4128
|
gen: I,
|
|
4591
4129
|
keyword: "type",
|
|
4592
4130
|
data: A,
|
|
4593
4131
|
schema: w.type,
|
|
4594
|
-
schemaCode:
|
|
4595
|
-
schemaValue:
|
|
4132
|
+
schemaCode: O,
|
|
4133
|
+
schemaValue: O,
|
|
4596
4134
|
parentSchema: w,
|
|
4597
4135
|
params: {},
|
|
4598
|
-
it:
|
|
4136
|
+
it: C
|
|
4599
4137
|
};
|
|
4600
4138
|
}
|
|
4601
4139
|
})(dataType);
|
|
@@ -4673,16 +4211,16 @@ function schemaProperties(e, t) {
|
|
|
4673
4211
|
return allSchemaProperties(t).filter((r) => !(0, util_1$o.alwaysValidSchema)(e, t[r]));
|
|
4674
4212
|
}
|
|
4675
4213
|
code.schemaProperties = schemaProperties;
|
|
4676
|
-
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: a }, l, p,
|
|
4677
|
-
const
|
|
4214
|
+
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: a }, l, p, u) {
|
|
4215
|
+
const d = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, $ = [
|
|
4678
4216
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4679
4217
|
[names_1$5.default.parentData, a.parentData],
|
|
4680
4218
|
[names_1$5.default.parentDataProperty, a.parentDataProperty],
|
|
4681
4219
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4682
4220
|
];
|
|
4683
|
-
a.opts.dynamicRef &&
|
|
4684
|
-
const
|
|
4685
|
-
return p !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${p}, ${
|
|
4221
|
+
a.opts.dynamicRef && $.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4222
|
+
const E = (0, codegen_1$q._)`${d}, ${r.object(...$)}`;
|
|
4223
|
+
return p !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${p}, ${E})` : (0, codegen_1$q._)`${l}(${E})`;
|
|
4686
4224
|
}
|
|
4687
4225
|
code.callValidateCode = callValidateCode;
|
|
4688
4226
|
const newRegExp = (0, codegen_1$q._)`new RegExp`;
|
|
@@ -4704,10 +4242,10 @@ function validateArray(e) {
|
|
|
4704
4242
|
return t.var(i, !0), a(() => t.break()), i;
|
|
4705
4243
|
function a(l) {
|
|
4706
4244
|
const p = t.const("len", (0, codegen_1$q._)`${r}.length`);
|
|
4707
|
-
t.forRange("i", 0, p, (
|
|
4245
|
+
t.forRange("i", 0, p, (u) => {
|
|
4708
4246
|
e.subschema({
|
|
4709
4247
|
keyword: n,
|
|
4710
|
-
dataProp:
|
|
4248
|
+
dataProp: u,
|
|
4711
4249
|
dataPropType: util_1$o.Type.Num
|
|
4712
4250
|
}, i), t.if((0, codegen_1$q.not)(i), l);
|
|
4713
4251
|
});
|
|
@@ -4721,13 +4259,13 @@ function validateUnion(e) {
|
|
|
4721
4259
|
if (r.some((p) => (0, util_1$o.alwaysValidSchema)(s, p)) && !s.opts.unevaluated)
|
|
4722
4260
|
return;
|
|
4723
4261
|
const a = t.let("valid", !1), l = t.name("_valid");
|
|
4724
|
-
t.block(() => r.forEach((p,
|
|
4725
|
-
const
|
|
4262
|
+
t.block(() => r.forEach((p, u) => {
|
|
4263
|
+
const d = e.subschema({
|
|
4726
4264
|
keyword: n,
|
|
4727
|
-
schemaProp:
|
|
4265
|
+
schemaProp: u,
|
|
4728
4266
|
compositeRule: !0
|
|
4729
4267
|
}, l);
|
|
4730
|
-
t.assign(a, (0, codegen_1$q._)`${a} || ${l}`), e.mergeValidEvaluated(
|
|
4268
|
+
t.assign(a, (0, codegen_1$q._)`${a} || ${l}`), e.mergeValidEvaluated(d, l) || t.if((0, codegen_1$q.not)(a));
|
|
4731
4269
|
})), e.result(a, () => e.reset(), () => e.error(!0));
|
|
4732
4270
|
}
|
|
4733
4271
|
code.validateUnion = validateUnion;
|
|
@@ -4737,45 +4275,45 @@ const codegen_1$p = codegen, names_1$4 = names$1, code_1$9 = code, errors_1$1 =
|
|
|
4737
4275
|
function macroKeywordCode(e, t) {
|
|
4738
4276
|
const { gen: r, keyword: n, schema: s, parentSchema: i, it: a } = e, l = t.macro.call(a.self, s, i, a), p = useKeyword(r, n, l);
|
|
4739
4277
|
a.opts.validateSchema !== !1 && a.self.validateSchema(l, !0);
|
|
4740
|
-
const
|
|
4278
|
+
const u = r.name("valid");
|
|
4741
4279
|
e.subschema({
|
|
4742
4280
|
schema: l,
|
|
4743
4281
|
schemaPath: codegen_1$p.nil,
|
|
4744
4282
|
errSchemaPath: `${a.errSchemaPath}/${n}`,
|
|
4745
4283
|
topSchemaRef: p,
|
|
4746
4284
|
compositeRule: !0
|
|
4747
|
-
},
|
|
4285
|
+
}, u), e.pass(u, () => e.error(!0));
|
|
4748
4286
|
}
|
|
4749
4287
|
keyword.macroKeywordCode = macroKeywordCode;
|
|
4750
4288
|
function funcKeywordCode(e, t) {
|
|
4751
4289
|
var r;
|
|
4752
4290
|
const { gen: n, keyword: s, schema: i, parentSchema: a, $data: l, it: p } = e;
|
|
4753
4291
|
checkAsyncKeyword(p, t);
|
|
4754
|
-
const
|
|
4755
|
-
e.block$data(
|
|
4756
|
-
function
|
|
4292
|
+
const u = !l && t.compile ? t.compile.call(p.self, i, a, p) : t.validate, d = useKeyword(n, s, u), $ = n.let("valid");
|
|
4293
|
+
e.block$data($, E), e.ok((r = t.valid) !== null && r !== void 0 ? r : $);
|
|
4294
|
+
function E() {
|
|
4757
4295
|
if (t.errors === !1)
|
|
4758
|
-
|
|
4296
|
+
T(), t.modifying && modifyData(e), g(() => e.error());
|
|
4759
4297
|
else {
|
|
4760
|
-
const _ = t.async ?
|
|
4761
|
-
t.modifying && modifyData(e),
|
|
4298
|
+
const _ = t.async ? R() : v();
|
|
4299
|
+
t.modifying && modifyData(e), g(() => addErrs(e, _));
|
|
4762
4300
|
}
|
|
4763
4301
|
}
|
|
4764
|
-
function
|
|
4302
|
+
function R() {
|
|
4765
4303
|
const _ = n.let("ruleErrs", null);
|
|
4766
|
-
return n.try(() =>
|
|
4304
|
+
return n.try(() => T((0, codegen_1$p._)`await `), (k) => n.assign($, !1).if((0, codegen_1$p._)`${k} instanceof ${p.ValidationError}`, () => n.assign(_, (0, codegen_1$p._)`${k}.errors`), () => n.throw(k))), _;
|
|
4767
4305
|
}
|
|
4768
4306
|
function v() {
|
|
4769
|
-
const _ = (0, codegen_1$p._)`${
|
|
4770
|
-
return n.assign(_, null),
|
|
4307
|
+
const _ = (0, codegen_1$p._)`${d}.errors`;
|
|
4308
|
+
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4771
4309
|
}
|
|
4772
|
-
function
|
|
4773
|
-
const k = p.opts.passContext ? names_1$4.default.this : names_1$4.default.self,
|
|
4774
|
-
n.assign(
|
|
4310
|
+
function T(_ = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4311
|
+
const k = p.opts.passContext ? names_1$4.default.this : names_1$4.default.self, C = !("compile" in t && !l || t.schema === !1);
|
|
4312
|
+
n.assign($, (0, codegen_1$p._)`${_}${(0, code_1$9.callValidateCode)(e, d, k, C)}`, t.modifying);
|
|
4775
4313
|
}
|
|
4776
|
-
function
|
|
4314
|
+
function g(_) {
|
|
4777
4315
|
var k;
|
|
4778
|
-
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k :
|
|
4316
|
+
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k : $), _);
|
|
4779
4317
|
}
|
|
4780
4318
|
}
|
|
4781
4319
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4854,16 +4392,16 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4854
4392
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4855
4393
|
const { gen: l } = t;
|
|
4856
4394
|
if (r !== void 0) {
|
|
4857
|
-
const { errorPath:
|
|
4858
|
-
p(
|
|
4395
|
+
const { errorPath: u, dataPathArr: d, opts: $ } = t, E = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4396
|
+
p(E), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, $.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...d, e.parentDataProperty];
|
|
4859
4397
|
}
|
|
4860
4398
|
if (s !== void 0) {
|
|
4861
|
-
const
|
|
4862
|
-
p(
|
|
4399
|
+
const u = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
4400
|
+
p(u), a !== void 0 && (e.propertyName = a);
|
|
4863
4401
|
}
|
|
4864
4402
|
i && (e.dataTypes = i);
|
|
4865
|
-
function p(
|
|
4866
|
-
e.data =
|
|
4403
|
+
function p(u) {
|
|
4404
|
+
e.data = u, e.dataLevel = t.dataLevel + 1, e.dataTypes = [], t.definedProperties = /* @__PURE__ */ new Set(), e.parentData = t.data, e.dataNames = [...t.dataNames, u];
|
|
4867
4405
|
}
|
|
4868
4406
|
}
|
|
4869
4407
|
subschema.extendSubschemaData = extendSubschemaData;
|
|
@@ -4956,23 +4494,23 @@ traverse$1.skipKeywords = {
|
|
|
4956
4494
|
maxProperties: !0,
|
|
4957
4495
|
minProperties: !0
|
|
4958
4496
|
};
|
|
4959
|
-
function _traverse(e, t, r, n, s, i, a, l, p,
|
|
4497
|
+
function _traverse(e, t, r, n, s, i, a, l, p, u) {
|
|
4960
4498
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4961
|
-
t(n, s, i, a, l, p,
|
|
4962
|
-
for (var
|
|
4963
|
-
var
|
|
4964
|
-
if (Array.isArray(
|
|
4965
|
-
if (
|
|
4966
|
-
for (var
|
|
4967
|
-
_traverse(e, t, r,
|
|
4968
|
-
} else if (
|
|
4969
|
-
if (
|
|
4970
|
-
for (var
|
|
4971
|
-
_traverse(e, t, r,
|
|
4499
|
+
t(n, s, i, a, l, p, u);
|
|
4500
|
+
for (var d in n) {
|
|
4501
|
+
var $ = n[d];
|
|
4502
|
+
if (Array.isArray($)) {
|
|
4503
|
+
if (d in traverse$1.arrayKeywords)
|
|
4504
|
+
for (var E = 0; E < $.length; E++)
|
|
4505
|
+
_traverse(e, t, r, $[E], s + "/" + d + "/" + E, i, s, d, n, E);
|
|
4506
|
+
} else if (d in traverse$1.propsKeywords) {
|
|
4507
|
+
if ($ && typeof $ == "object")
|
|
4508
|
+
for (var R in $)
|
|
4509
|
+
_traverse(e, t, r, $[R], s + "/" + d + "/" + escapeJsonPtr(R), i, s, d, n, R);
|
|
4972
4510
|
} else
|
|
4973
|
-
(
|
|
4511
|
+
(d in traverse$1.keywords || e.allKeys && !(d in traverse$1.skipKeywords)) && _traverse(e, t, r, $, s + "/" + d, i, s, d, n);
|
|
4974
4512
|
}
|
|
4975
|
-
r(n, s, i, a, l, p,
|
|
4513
|
+
r(n, s, i, a, l, p, u);
|
|
4976
4514
|
}
|
|
4977
4515
|
}
|
|
4978
4516
|
function escapeJsonPtr(e) {
|
|
@@ -5054,34 +4592,34 @@ function getSchemaRefs(e, t) {
|
|
|
5054
4592
|
if (typeof e == "boolean")
|
|
5055
4593
|
return {};
|
|
5056
4594
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, a = getFullPath(n, s, !1), l = {}, p = /* @__PURE__ */ new Set();
|
|
5057
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4595
|
+
return traverse(e, { allKeys: !0 }, ($, E, R, v) => {
|
|
5058
4596
|
if (v === void 0)
|
|
5059
4597
|
return;
|
|
5060
|
-
const
|
|
5061
|
-
let
|
|
5062
|
-
typeof
|
|
5063
|
-
function _(
|
|
4598
|
+
const T = a + E;
|
|
4599
|
+
let g = i[v];
|
|
4600
|
+
typeof $[r] == "string" && (g = _.call(this, $[r])), k.call(this, $.$anchor), k.call(this, $.$dynamicAnchor), i[E] = g;
|
|
4601
|
+
function _(C) {
|
|
5064
4602
|
const I = this.opts.uriResolver.resolve;
|
|
5065
|
-
if (
|
|
5066
|
-
throw
|
|
5067
|
-
p.add(
|
|
5068
|
-
let A = this.refs[
|
|
5069
|
-
return typeof A == "string" && (A = this.refs[A]), typeof A == "object" ?
|
|
5070
|
-
}
|
|
5071
|
-
function k(
|
|
5072
|
-
if (typeof
|
|
5073
|
-
if (!ANCHOR.test(
|
|
5074
|
-
throw new Error(`invalid anchor "${
|
|
5075
|
-
_.call(this, `#${
|
|
4603
|
+
if (C = normalizeId(g ? I(g, C) : C), p.has(C))
|
|
4604
|
+
throw d(C);
|
|
4605
|
+
p.add(C);
|
|
4606
|
+
let A = this.refs[C];
|
|
4607
|
+
return typeof A == "string" && (A = this.refs[A]), typeof A == "object" ? u($, A.schema, C) : C !== normalizeId(T) && (C[0] === "#" ? (u($, l[C], C), l[C] = $) : this.refs[C] = T), C;
|
|
4608
|
+
}
|
|
4609
|
+
function k(C) {
|
|
4610
|
+
if (typeof C == "string") {
|
|
4611
|
+
if (!ANCHOR.test(C))
|
|
4612
|
+
throw new Error(`invalid anchor "${C}"`);
|
|
4613
|
+
_.call(this, `#${C}`);
|
|
5076
4614
|
}
|
|
5077
4615
|
}
|
|
5078
4616
|
}), l;
|
|
5079
|
-
function
|
|
5080
|
-
if (
|
|
5081
|
-
throw
|
|
4617
|
+
function u($, E, R) {
|
|
4618
|
+
if (E !== void 0 && !equal$2($, E))
|
|
4619
|
+
throw d(R);
|
|
5082
4620
|
}
|
|
5083
|
-
function
|
|
5084
|
-
return new Error(`reference "${
|
|
4621
|
+
function d($) {
|
|
4622
|
+
return new Error(`reference "${$}" resolves to more than one schema`);
|
|
5085
4623
|
}
|
|
5086
4624
|
}
|
|
5087
4625
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -5191,18 +4729,18 @@ function assignEvaluated({ gen: e, evaluated: t, props: r, items: n }) {
|
|
|
5191
4729
|
r instanceof codegen_1$n.Name && e.assign((0, codegen_1$n._)`${t}.props`, r), n instanceof codegen_1$n.Name && e.assign((0, codegen_1$n._)`${t}.items`, n);
|
|
5192
4730
|
}
|
|
5193
4731
|
function schemaKeywords(e, t, r, n) {
|
|
5194
|
-
const { gen: s, schema: i, data: a, allErrors: l, opts: p, self:
|
|
5195
|
-
if (i.$ref && (p.ignoreKeywordsWithRef || !(0, util_1$l.schemaHasRulesButRef)(i,
|
|
5196
|
-
s.block(() => keywordCode(e, "$ref",
|
|
4732
|
+
const { gen: s, schema: i, data: a, allErrors: l, opts: p, self: u } = e, { RULES: d } = u;
|
|
4733
|
+
if (i.$ref && (p.ignoreKeywordsWithRef || !(0, util_1$l.schemaHasRulesButRef)(i, d))) {
|
|
4734
|
+
s.block(() => keywordCode(e, "$ref", d.all.$ref.definition));
|
|
5197
4735
|
return;
|
|
5198
4736
|
}
|
|
5199
4737
|
p.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
5200
|
-
for (const
|
|
5201
|
-
|
|
5202
|
-
|
|
4738
|
+
for (const E of d.rules)
|
|
4739
|
+
$(E);
|
|
4740
|
+
$(d.post);
|
|
5203
4741
|
});
|
|
5204
|
-
function
|
|
5205
|
-
(0, applicability_1.shouldUseGroup)(i,
|
|
4742
|
+
function $(E) {
|
|
4743
|
+
(0, applicability_1.shouldUseGroup)(i, E) && (E.type ? (s.if((0, dataType_2.checkDataType)(E.type, a, p.strictNumbers)), iterateKeywords(e, E), t.length === 1 && t[0] === E.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, E), l || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
5206
4744
|
}
|
|
5207
4745
|
}
|
|
5208
4746
|
function iterateKeywords(e, t) {
|
|
@@ -5371,27 +4909,27 @@ function getData(e, { dataLevel: t, dataNames: r, dataPathArr: n }) {
|
|
|
5371
4909
|
throw new Error(`Invalid JSON-pointer: ${e}`);
|
|
5372
4910
|
s = e, i = names_1$3.default.rootData;
|
|
5373
4911
|
} else {
|
|
5374
|
-
const
|
|
5375
|
-
if (!
|
|
4912
|
+
const u = RELATIVE_JSON_POINTER.exec(e);
|
|
4913
|
+
if (!u)
|
|
5376
4914
|
throw new Error(`Invalid JSON-pointer: ${e}`);
|
|
5377
|
-
const
|
|
5378
|
-
if (s =
|
|
5379
|
-
if (
|
|
5380
|
-
throw new Error(p("property/index",
|
|
5381
|
-
return n[t -
|
|
5382
|
-
}
|
|
5383
|
-
if (
|
|
5384
|
-
throw new Error(p("data",
|
|
5385
|
-
if (i = r[t -
|
|
4915
|
+
const d = +u[1];
|
|
4916
|
+
if (s = u[2], s === "#") {
|
|
4917
|
+
if (d >= t)
|
|
4918
|
+
throw new Error(p("property/index", d));
|
|
4919
|
+
return n[t - d];
|
|
4920
|
+
}
|
|
4921
|
+
if (d > t)
|
|
4922
|
+
throw new Error(p("data", d));
|
|
4923
|
+
if (i = r[t - d], !s)
|
|
5386
4924
|
return i;
|
|
5387
4925
|
}
|
|
5388
4926
|
let a = i;
|
|
5389
4927
|
const l = s.split("/");
|
|
5390
|
-
for (const
|
|
5391
|
-
|
|
4928
|
+
for (const u of l)
|
|
4929
|
+
u && (i = (0, codegen_1$n._)`${i}${(0, codegen_1$n.getProperty)((0, util_1$l.unescapeJsonPointer)(u))}`, a = (0, codegen_1$n._)`${a} && ${i}`);
|
|
5392
4930
|
return a;
|
|
5393
|
-
function p(
|
|
5394
|
-
return `Cannot access ${
|
|
4931
|
+
function p(u, d) {
|
|
4932
|
+
return `Cannot access ${u} ${d} levels up, current level is ${t}`;
|
|
5395
4933
|
}
|
|
5396
4934
|
}
|
|
5397
4935
|
validate.getData = getData;
|
|
@@ -5437,7 +4975,7 @@ function compileSchema(e) {
|
|
|
5437
4975
|
}));
|
|
5438
4976
|
const p = a.scopeName("validate");
|
|
5439
4977
|
e.validateName = p;
|
|
5440
|
-
const
|
|
4978
|
+
const u = {
|
|
5441
4979
|
gen: a,
|
|
5442
4980
|
allErrors: this.opts.allErrors,
|
|
5443
4981
|
data: names_1$2.default.data,
|
|
@@ -5461,24 +4999,24 @@ function compileSchema(e) {
|
|
|
5461
4999
|
opts: this.opts,
|
|
5462
5000
|
self: this
|
|
5463
5001
|
};
|
|
5464
|
-
let
|
|
5002
|
+
let d;
|
|
5465
5003
|
try {
|
|
5466
|
-
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(
|
|
5467
|
-
const
|
|
5468
|
-
|
|
5469
|
-
const
|
|
5470
|
-
if (this.scope.value(p, { ref:
|
|
5471
|
-
const { props: v, items:
|
|
5472
|
-
|
|
5004
|
+
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), a.optimize(this.opts.code.optimize);
|
|
5005
|
+
const $ = a.toString();
|
|
5006
|
+
d = `${a.scopeRefs(names_1$2.default.scope)}return ${$}`, this.opts.code.process && (d = this.opts.code.process(d, e));
|
|
5007
|
+
const R = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, d)(this, this.scope.get());
|
|
5008
|
+
if (this.scope.value(p, { ref: R }), R.errors = null, R.schema = e.schema, R.schemaEnv = e, e.$async && (R.$async = !0), this.opts.code.source === !0 && (R.source = { validateName: p, validateCode: $, scopeValues: a._values }), this.opts.unevaluated) {
|
|
5009
|
+
const { props: v, items: T } = u;
|
|
5010
|
+
R.evaluated = {
|
|
5473
5011
|
props: v instanceof codegen_1$m.Name ? void 0 : v,
|
|
5474
|
-
items:
|
|
5012
|
+
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5475
5013
|
dynamicProps: v instanceof codegen_1$m.Name,
|
|
5476
|
-
dynamicItems:
|
|
5477
|
-
},
|
|
5014
|
+
dynamicItems: T instanceof codegen_1$m.Name
|
|
5015
|
+
}, R.source && (R.source.evaluated = (0, codegen_1$m.stringify)(R.evaluated));
|
|
5478
5016
|
}
|
|
5479
|
-
return e.validate =
|
|
5480
|
-
} catch (
|
|
5481
|
-
throw delete e.validate, delete e.validateName,
|
|
5017
|
+
return e.validate = R, e;
|
|
5018
|
+
} catch ($) {
|
|
5019
|
+
throw delete e.validate, delete e.validateName, d && this.logger.error("Error compiling schema, function code:", d), $;
|
|
5482
5020
|
} finally {
|
|
5483
5021
|
this._compilations.delete(e);
|
|
5484
5022
|
}
|
|
@@ -5529,8 +5067,8 @@ function resolveSchema(e, t) {
|
|
|
5529
5067
|
}
|
|
5530
5068
|
if (typeof (a == null ? void 0 : a.schema) == "object") {
|
|
5531
5069
|
if (a.validate || compileSchema.call(this, a), i === (0, resolve_1.normalizeId)(t)) {
|
|
5532
|
-
const { schema: l } = a, { schemaId: p } = this.opts,
|
|
5533
|
-
return
|
|
5070
|
+
const { schema: l } = a, { schemaId: p } = this.opts, u = l[p];
|
|
5071
|
+
return u && (s = (0, resolve_1.resolveUrl)(this.opts.uriResolver, s, u)), new SchemaEnv({ schema: l, schemaId: p, root: e, baseId: s });
|
|
5534
5072
|
}
|
|
5535
5073
|
return getJsonPointer.call(this, r, a);
|
|
5536
5074
|
}
|
|
@@ -5554,8 +5092,8 @@ function getJsonPointer(e, { baseId: t, schema: r, root: n }) {
|
|
|
5554
5092
|
if (p === void 0)
|
|
5555
5093
|
return;
|
|
5556
5094
|
r = p;
|
|
5557
|
-
const
|
|
5558
|
-
!PREVENT_SCOPE_CHANGE.has(l) &&
|
|
5095
|
+
const u = typeof r == "object" && r[this.opts.schemaId];
|
|
5096
|
+
!PREVENT_SCOPE_CHANGE.has(l) && u && (t = (0, resolve_1.resolveUrl)(this.opts.uriResolver, t, u));
|
|
5559
5097
|
}
|
|
5560
5098
|
let i;
|
|
5561
5099
|
if (typeof r != "boolean" && r.$ref && !(0, util_1$k.schemaHasRulesButRef)(r, this.RULES)) {
|
|
@@ -5599,9 +5137,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5599
5137
|
c[m] = arguments[m];
|
|
5600
5138
|
if (c.length > 1) {
|
|
5601
5139
|
c[0] = c[0].slice(0, -1);
|
|
5602
|
-
for (var
|
|
5140
|
+
for (var S = c.length - 1, b = 1; b < S; ++b)
|
|
5603
5141
|
c[b] = c[b].slice(1, -1);
|
|
5604
|
-
return c[
|
|
5142
|
+
return c[S] = c[S].slice(1), c.join("");
|
|
5605
5143
|
} else
|
|
5606
5144
|
return c[0];
|
|
5607
5145
|
}
|
|
@@ -5620,15 +5158,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5620
5158
|
function p(f, c) {
|
|
5621
5159
|
var m = f;
|
|
5622
5160
|
if (c)
|
|
5623
|
-
for (var
|
|
5624
|
-
m[
|
|
5161
|
+
for (var S in c)
|
|
5162
|
+
m[S] = c[S];
|
|
5625
5163
|
return m;
|
|
5626
5164
|
}
|
|
5627
|
-
function
|
|
5628
|
-
var c = "[A-Za-z]", m = "[0-9]",
|
|
5165
|
+
function u(f) {
|
|
5166
|
+
var c = "[A-Za-z]", m = "[0-9]", S = n(m, "[A-Fa-f]"), b = s(s("%[EFef]" + S + "%" + S + S + "%" + S + S) + "|" + s("%[89A-Fa-f]" + S + "%" + S + S) + "|" + s("%" + S + S)), 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);
|
|
5629
5167
|
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, L, "[\\:]")) + "*");
|
|
5630
|
-
var Q = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Q + "\\." + Q + "\\." + Q + "\\." + Q), V = s(
|
|
5631
|
-
s("[vV]" +
|
|
5168
|
+
var Q = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Q + "\\." + Q + "\\." + Q + "\\." + Q), V = s(S + "{1,4}"), X = s(s(V + "\\:" + V) + "|" + ie), ae = s(s(V + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(V + "\\:") + "{5}" + X), Ee = s(s(V) + "?\\:\\:" + s(V + "\\:") + "{4}" + X), $e = s(s(s(V + "\\:") + "{0,1}" + V) + "?\\:\\:" + s(V + "\\:") + "{3}" + X), ge = s(s(s(V + "\\:") + "{0,2}" + V) + "?\\:\\:" + s(V + "\\:") + "{2}" + X), Be = s(s(s(V + "\\:") + "{0,3}" + V) + "?\\:\\:" + V + "\\:" + X), Ie = s(s(s(V + "\\:") + "{0,4}" + V) + "?\\:\\:" + X), fe = s(s(s(V + "\\:") + "{0,5}" + V) + "?\\:\\:" + V), ye = s(s(s(V + "\\:") + "{0,6}" + V) + "?\\:\\:"), je = s([ae, ee, Ee, $e, ge, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + b) + "+");
|
|
5169
|
+
s("[vV]" + S + "+\\." + n(B, L, "[\\:]") + "+"), s(s(b + "|" + n(B, L)) + "*");
|
|
5632
5170
|
var ct = s(b + "|" + n(B, L, "[\\:\\@]"));
|
|
5633
5171
|
return s(s(b + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5634
5172
|
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
@@ -5643,15 +5181,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5643
5181
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5644
5182
|
PCT_ENCODED: new RegExp(b, "g"),
|
|
5645
5183
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5646
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5184
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + S + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5647
5185
|
//RFC 6874, with relaxed parsing rules
|
|
5648
5186
|
};
|
|
5649
5187
|
}
|
|
5650
|
-
var
|
|
5188
|
+
var d = u(!1), $ = u(!0), E = function() {
|
|
5651
5189
|
function f(c, m) {
|
|
5652
|
-
var
|
|
5190
|
+
var S = [], b = !0, U = !1, L = void 0;
|
|
5653
5191
|
try {
|
|
5654
|
-
for (var J = c[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (
|
|
5192
|
+
for (var J = c[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (S.push(Y.value), !(m && S.length === m)); b = !0)
|
|
5655
5193
|
;
|
|
5656
5194
|
} catch (se) {
|
|
5657
5195
|
U = !0, L = se;
|
|
@@ -5663,7 +5201,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5663
5201
|
throw L;
|
|
5664
5202
|
}
|
|
5665
5203
|
}
|
|
5666
|
-
return
|
|
5204
|
+
return S;
|
|
5667
5205
|
}
|
|
5668
5206
|
return function(c, m) {
|
|
5669
5207
|
if (Array.isArray(c))
|
|
@@ -5672,36 +5210,36 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5672
5210
|
return f(c, m);
|
|
5673
5211
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5674
5212
|
};
|
|
5675
|
-
}(),
|
|
5213
|
+
}(), R = function(f) {
|
|
5676
5214
|
if (Array.isArray(f)) {
|
|
5677
5215
|
for (var c = 0, m = Array(f.length); c < f.length; c++)
|
|
5678
5216
|
m[c] = f[c];
|
|
5679
5217
|
return m;
|
|
5680
5218
|
} else
|
|
5681
5219
|
return Array.from(f);
|
|
5682
|
-
}, v = 2147483647,
|
|
5220
|
+
}, v = 2147483647, T = 36, g = 1, _ = 26, k = 38, C = 700, I = 72, A = 128, w = "-", O = /^xn--/, D = /[^\0-\x7E]/, z = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
5683
5221
|
overflow: "Overflow: input needs wider integers to process",
|
|
5684
5222
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5685
5223
|
"invalid-input": "Invalid input"
|
|
5686
|
-
}, re =
|
|
5224
|
+
}, re = T - g, K = Math.floor, ue = String.fromCharCode;
|
|
5687
5225
|
function oe(f) {
|
|
5688
|
-
throw new RangeError(
|
|
5226
|
+
throw new RangeError(x[f]);
|
|
5689
5227
|
}
|
|
5690
5228
|
function ke(f, c) {
|
|
5691
|
-
for (var m = [],
|
|
5692
|
-
m[
|
|
5229
|
+
for (var m = [], S = f.length; S--; )
|
|
5230
|
+
m[S] = c(f[S]);
|
|
5693
5231
|
return m;
|
|
5694
5232
|
}
|
|
5695
|
-
function
|
|
5696
|
-
var m = f.split("@"),
|
|
5697
|
-
m.length > 1 && (
|
|
5233
|
+
function Ce(f, c) {
|
|
5234
|
+
var m = f.split("@"), S = "";
|
|
5235
|
+
m.length > 1 && (S = m[0] + "@", f = m[1]), f = f.replace(z, ".");
|
|
5698
5236
|
var b = f.split("."), U = ke(b, c).join(".");
|
|
5699
|
-
return
|
|
5237
|
+
return S + U;
|
|
5700
5238
|
}
|
|
5701
5239
|
function qe(f) {
|
|
5702
|
-
for (var c = [], m = 0,
|
|
5240
|
+
for (var c = [], m = 0, S = f.length; m < S; ) {
|
|
5703
5241
|
var b = f.charCodeAt(m++);
|
|
5704
|
-
if (b >= 55296 && b <= 56319 && m <
|
|
5242
|
+
if (b >= 55296 && b <= 56319 && m < S) {
|
|
5705
5243
|
var U = f.charCodeAt(m++);
|
|
5706
5244
|
(U & 64512) == 56320 ? c.push(((b & 1023) << 10) + (U & 1023) + 65536) : (c.push(b), m--);
|
|
5707
5245
|
} else
|
|
@@ -5710,40 +5248,40 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5710
5248
|
return c;
|
|
5711
5249
|
}
|
|
5712
5250
|
var et = function(c) {
|
|
5713
|
-
return String.fromCodePoint.apply(String,
|
|
5714
|
-
},
|
|
5715
|
-
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 :
|
|
5251
|
+
return String.fromCodePoint.apply(String, R(c));
|
|
5252
|
+
}, Ue = function(c) {
|
|
5253
|
+
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5716
5254
|
}, F = function(c, m) {
|
|
5717
5255
|
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5718
|
-
}, y = function(c, m,
|
|
5256
|
+
}, y = function(c, m, S) {
|
|
5719
5257
|
var b = 0;
|
|
5720
5258
|
for (
|
|
5721
|
-
c =
|
|
5259
|
+
c = S ? K(c / C) : c >> 1, c += K(c / m);
|
|
5722
5260
|
/* no initialization */
|
|
5723
5261
|
c > re * _ >> 1;
|
|
5724
|
-
b +=
|
|
5262
|
+
b += T
|
|
5725
5263
|
)
|
|
5726
5264
|
c = K(c / re);
|
|
5727
5265
|
return K(b + (re + 1) * c / (c + k));
|
|
5728
5266
|
}, j = function(c) {
|
|
5729
|
-
var m = [],
|
|
5267
|
+
var m = [], S = c.length, b = 0, U = A, L = I, J = c.lastIndexOf(w);
|
|
5730
5268
|
J < 0 && (J = 0);
|
|
5731
5269
|
for (var Y = 0; Y < J; ++Y)
|
|
5732
5270
|
c.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(c.charCodeAt(Y));
|
|
5733
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5271
|
+
for (var se = J > 0 ? J + 1 : 0; se < S; ) {
|
|
5734
5272
|
for (
|
|
5735
|
-
var B = b, Q = 1, ie =
|
|
5273
|
+
var B = b, Q = 1, ie = T;
|
|
5736
5274
|
;
|
|
5737
5275
|
/* no condition */
|
|
5738
|
-
ie +=
|
|
5276
|
+
ie += T
|
|
5739
5277
|
) {
|
|
5740
|
-
se >=
|
|
5741
|
-
var V =
|
|
5742
|
-
(V >=
|
|
5743
|
-
var X = ie <= L ?
|
|
5278
|
+
se >= S && oe("invalid-input");
|
|
5279
|
+
var V = Ue(c.charCodeAt(se++));
|
|
5280
|
+
(V >= T || V > K((v - b) / Q)) && oe("overflow"), b += V * Q;
|
|
5281
|
+
var X = ie <= L ? g : ie >= L + _ ? _ : ie - L;
|
|
5744
5282
|
if (V < X)
|
|
5745
5283
|
break;
|
|
5746
|
-
var ae =
|
|
5284
|
+
var ae = T - X;
|
|
5747
5285
|
Q > K(v / ae) && oe("overflow"), Q *= ae;
|
|
5748
5286
|
}
|
|
5749
5287
|
var ee = m.length + 1;
|
|
@@ -5753,7 +5291,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5753
5291
|
}, P = function(c) {
|
|
5754
5292
|
var m = [];
|
|
5755
5293
|
c = qe(c);
|
|
5756
|
-
var
|
|
5294
|
+
var S = c.length, b = A, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5757
5295
|
try {
|
|
5758
5296
|
for (var B = c[Symbol.iterator](), Q; !(J = (Q = B.next()).done); J = !0) {
|
|
5759
5297
|
var ie = Q.value;
|
|
@@ -5770,21 +5308,21 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5770
5308
|
}
|
|
5771
5309
|
}
|
|
5772
5310
|
var V = m.length, X = V;
|
|
5773
|
-
for (V && m.push(w); X <
|
|
5774
|
-
var ae = v, ee = !0, Ee = !1,
|
|
5311
|
+
for (V && m.push(w); X < S; ) {
|
|
5312
|
+
var ae = v, ee = !0, Ee = !1, $e = void 0;
|
|
5775
5313
|
try {
|
|
5776
|
-
for (var
|
|
5777
|
-
var Ie =
|
|
5314
|
+
for (var ge = c[Symbol.iterator](), Be; !(ee = (Be = ge.next()).done); ee = !0) {
|
|
5315
|
+
var Ie = Be.value;
|
|
5778
5316
|
Ie >= b && Ie < ae && (ae = Ie);
|
|
5779
5317
|
}
|
|
5780
5318
|
} catch (lt) {
|
|
5781
|
-
Ee = !0,
|
|
5319
|
+
Ee = !0, $e = lt;
|
|
5782
5320
|
} finally {
|
|
5783
5321
|
try {
|
|
5784
|
-
!ee &&
|
|
5322
|
+
!ee && ge.return && ge.return();
|
|
5785
5323
|
} finally {
|
|
5786
5324
|
if (Ee)
|
|
5787
|
-
throw
|
|
5325
|
+
throw $e;
|
|
5788
5326
|
}
|
|
5789
5327
|
}
|
|
5790
5328
|
var fe = X + 1;
|
|
@@ -5795,15 +5333,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5795
5333
|
var Ht = Lt.value;
|
|
5796
5334
|
if (Ht < b && ++U > v && oe("overflow"), Ht == b) {
|
|
5797
5335
|
for (
|
|
5798
|
-
var pt = U, ft =
|
|
5336
|
+
var pt = U, ft = T;
|
|
5799
5337
|
;
|
|
5800
5338
|
/* no condition */
|
|
5801
|
-
ft +=
|
|
5339
|
+
ft += T
|
|
5802
5340
|
) {
|
|
5803
|
-
var ht = ft <= L ?
|
|
5341
|
+
var ht = ft <= L ? g : ft >= L + _ ? _ : ft - L;
|
|
5804
5342
|
if (pt < ht)
|
|
5805
5343
|
break;
|
|
5806
|
-
var zt = pt - ht, Vt =
|
|
5344
|
+
var zt = pt - ht, Vt = T - ht;
|
|
5807
5345
|
m.push(ue(F(ht + zt % Vt, 0))), pt = K(zt / Vt);
|
|
5808
5346
|
}
|
|
5809
5347
|
m.push(ue(F(pt, 0))), L = y(U, fe, X == V), U = 0, ++X;
|
|
@@ -5823,11 +5361,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5823
5361
|
}
|
|
5824
5362
|
return m.join("");
|
|
5825
5363
|
}, o = function(c) {
|
|
5826
|
-
return
|
|
5827
|
-
return
|
|
5364
|
+
return Ce(c, function(m) {
|
|
5365
|
+
return O.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5828
5366
|
});
|
|
5829
5367
|
}, h = function(c) {
|
|
5830
|
-
return
|
|
5368
|
+
return Ce(c, function(m) {
|
|
5831
5369
|
return D.test(m) ? "xn--" + P(m) : m;
|
|
5832
5370
|
});
|
|
5833
5371
|
}, N = {
|
|
@@ -5852,25 +5390,25 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5852
5390
|
encode: P,
|
|
5853
5391
|
toASCII: h,
|
|
5854
5392
|
toUnicode: o
|
|
5855
|
-
},
|
|
5856
|
-
function
|
|
5393
|
+
}, M = {};
|
|
5394
|
+
function q(f) {
|
|
5857
5395
|
var c = f.charCodeAt(0), m = void 0;
|
|
5858
5396
|
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
5397
|
}
|
|
5860
|
-
function
|
|
5861
|
-
for (var c = "", m = 0,
|
|
5398
|
+
function W(f) {
|
|
5399
|
+
for (var c = "", m = 0, S = f.length; m < S; ) {
|
|
5862
5400
|
var b = parseInt(f.substr(m + 1, 2), 16);
|
|
5863
5401
|
if (b < 128)
|
|
5864
5402
|
c += String.fromCharCode(b), m += 3;
|
|
5865
5403
|
else if (b >= 194 && b < 224) {
|
|
5866
|
-
if (
|
|
5404
|
+
if (S - m >= 6) {
|
|
5867
5405
|
var U = parseInt(f.substr(m + 4, 2), 16);
|
|
5868
5406
|
c += String.fromCharCode((b & 31) << 6 | U & 63);
|
|
5869
5407
|
} else
|
|
5870
5408
|
c += f.substr(m, 6);
|
|
5871
5409
|
m += 6;
|
|
5872
5410
|
} else if (b >= 224) {
|
|
5873
|
-
if (
|
|
5411
|
+
if (S - m >= 9) {
|
|
5874
5412
|
var L = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
|
|
5875
5413
|
c += String.fromCharCode((b & 15) << 12 | (L & 63) << 6 | J & 63);
|
|
5876
5414
|
} else
|
|
@@ -5882,23 +5420,23 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5882
5420
|
return c;
|
|
5883
5421
|
}
|
|
5884
5422
|
function G(f, c) {
|
|
5885
|
-
function m(
|
|
5886
|
-
var b =
|
|
5887
|
-
return b.match(c.UNRESERVED) ? b :
|
|
5423
|
+
function m(S) {
|
|
5424
|
+
var b = W(S);
|
|
5425
|
+
return b.match(c.UNRESERVED) ? b : S;
|
|
5888
5426
|
}
|
|
5889
|
-
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,
|
|
5427
|
+
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, a)), f.host !== void 0 && (f.host = String(f.host).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_HOST, q).replace(c.PCT_ENCODED, a)), 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, a)), f.query !== void 0 && (f.query = String(f.query).replace(c.PCT_ENCODED, m).replace(c.NOT_QUERY, q).replace(c.PCT_ENCODED, a)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(c.PCT_ENCODED, m).replace(c.NOT_FRAGMENT, q).replace(c.PCT_ENCODED, a)), f;
|
|
5890
5428
|
}
|
|
5891
5429
|
function ne(f) {
|
|
5892
5430
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5893
5431
|
}
|
|
5894
5432
|
function he(f, c) {
|
|
5895
|
-
var m = f.match(c.IPV4ADDRESS) || [],
|
|
5433
|
+
var m = f.match(c.IPV4ADDRESS) || [], S = E(m, 2), b = S[1];
|
|
5896
5434
|
return b ? b.split(".").map(ne).join(".") : f;
|
|
5897
5435
|
}
|
|
5898
|
-
function
|
|
5899
|
-
var m = f.match(c.IPV6ADDRESS) || [],
|
|
5436
|
+
function Le(f, c) {
|
|
5437
|
+
var m = f.match(c.IPV6ADDRESS) || [], S = E(m, 3), b = S[1], U = S[2];
|
|
5900
5438
|
if (b) {
|
|
5901
|
-
for (var L = b.toLowerCase().split("::").reverse(), J =
|
|
5439
|
+
for (var L = b.toLowerCase().split("::").reverse(), J = E(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Q = Y.split(":").map(ne), ie = c.IPV4ADDRESS.test(Q[Q.length - 1]), V = ie ? 7 : 8, X = Q.length - V, ae = Array(V), ee = 0; ee < V; ++ee)
|
|
5902
5440
|
ae[ee] = B[ee] || Q[X + ee] || "";
|
|
5903
5441
|
ie && (ae[V - 1] = he(ae[V - 1], c));
|
|
5904
5442
|
var Ee = ae.reduce(function(fe, ye, je) {
|
|
@@ -5907,105 +5445,105 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5907
5445
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5908
5446
|
}
|
|
5909
5447
|
return fe;
|
|
5910
|
-
}, []),
|
|
5448
|
+
}, []), $e = Ee.sort(function(fe, ye) {
|
|
5911
5449
|
return ye.length - fe.length;
|
|
5912
|
-
})[0],
|
|
5913
|
-
if (
|
|
5914
|
-
var
|
|
5915
|
-
|
|
5450
|
+
})[0], ge = void 0;
|
|
5451
|
+
if ($e && $e.length > 1) {
|
|
5452
|
+
var Be = ae.slice(0, $e.index), Ie = ae.slice($e.index + $e.length);
|
|
5453
|
+
ge = Be.join(":") + "::" + Ie.join(":");
|
|
5916
5454
|
} else
|
|
5917
|
-
|
|
5918
|
-
return U && (
|
|
5455
|
+
ge = ae.join(":");
|
|
5456
|
+
return U && (ge += "%" + U), ge;
|
|
5919
5457
|
} else
|
|
5920
5458
|
return f;
|
|
5921
5459
|
}
|
|
5922
5460
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5923
5461
|
function de(f) {
|
|
5924
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {},
|
|
5462
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, S = c.iri !== !1 ? $ : d;
|
|
5925
5463
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5926
5464
|
var b = f.match(tt);
|
|
5927
5465
|
if (b) {
|
|
5928
|
-
rt ? (m.scheme = b[1], m.userinfo = b[3], m.host = b[4], m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = b[7], m.fragment = b[8], isNaN(m.port) && (m.port = b[5])) : (m.scheme = b[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, m.host = f.indexOf("//") !== -1 ? b[4] : void 0, m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = f.indexOf("?") !== -1 ? b[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), m.host && (m.host =
|
|
5929
|
-
var U =
|
|
5466
|
+
rt ? (m.scheme = b[1], m.userinfo = b[3], m.host = b[4], m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = b[7], m.fragment = b[8], isNaN(m.port) && (m.port = b[5])) : (m.scheme = b[1] || void 0, m.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, m.host = f.indexOf("//") !== -1 ? b[4] : void 0, m.port = parseInt(b[5], 10), m.path = b[6] || "", m.query = f.indexOf("?") !== -1 ? b[7] : void 0, m.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(m.port) && (m.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), m.host && (m.host = Le(he(m.host, S), S)), 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.");
|
|
5467
|
+
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5930
5468
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5931
5469
|
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5932
5470
|
try {
|
|
5933
|
-
m.host = N.toASCII(m.host.replace(
|
|
5471
|
+
m.host = N.toASCII(m.host.replace(S.PCT_ENCODED, W).toLowerCase());
|
|
5934
5472
|
} catch (L) {
|
|
5935
5473
|
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5936
5474
|
}
|
|
5937
|
-
G(m,
|
|
5475
|
+
G(m, d);
|
|
5938
5476
|
} else
|
|
5939
|
-
G(m,
|
|
5477
|
+
G(m, S);
|
|
5940
5478
|
U && U.parse && U.parse(m, c);
|
|
5941
5479
|
} else
|
|
5942
5480
|
m.error = m.error || "URI can not be parsed.";
|
|
5943
5481
|
return m;
|
|
5944
5482
|
}
|
|
5945
5483
|
function nt(f, c) {
|
|
5946
|
-
var m = c.iri !== !1 ?
|
|
5947
|
-
return f.userinfo !== void 0 && (
|
|
5484
|
+
var m = c.iri !== !1 ? $ : d, S = [];
|
|
5485
|
+
return f.userinfo !== void 0 && (S.push(f.userinfo), S.push("@")), f.host !== void 0 && S.push(Le(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(b, U, L) {
|
|
5948
5486
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5949
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5487
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (S.push(":"), S.push(String(f.port))), S.length ? S.join("") : void 0;
|
|
5950
5488
|
}
|
|
5951
|
-
var
|
|
5489
|
+
var He = /^\.\.?\//, ze = /^\/\.(\/|$)/, Ve = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5952
5490
|
function me(f) {
|
|
5953
5491
|
for (var c = []; f.length; )
|
|
5954
|
-
if (f.match(
|
|
5955
|
-
f = f.replace(
|
|
5956
|
-
else if (f.match(He))
|
|
5957
|
-
f = f.replace(He, "/");
|
|
5492
|
+
if (f.match(He))
|
|
5493
|
+
f = f.replace(He, "");
|
|
5958
5494
|
else if (f.match(ze))
|
|
5959
|
-
f = f.replace(ze, "/")
|
|
5495
|
+
f = f.replace(ze, "/");
|
|
5496
|
+
else if (f.match(Ve))
|
|
5497
|
+
f = f.replace(Ve, "/"), c.pop();
|
|
5960
5498
|
else if (f === "." || f === "..")
|
|
5961
5499
|
f = "";
|
|
5962
5500
|
else {
|
|
5963
5501
|
var m = f.match(st);
|
|
5964
5502
|
if (m) {
|
|
5965
|
-
var
|
|
5966
|
-
f = f.slice(
|
|
5503
|
+
var S = m[0];
|
|
5504
|
+
f = f.slice(S.length), c.push(S);
|
|
5967
5505
|
} else
|
|
5968
5506
|
throw new Error("Unexpected dot segment condition");
|
|
5969
5507
|
}
|
|
5970
5508
|
return c.join("");
|
|
5971
5509
|
}
|
|
5972
5510
|
function le(f) {
|
|
5973
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ?
|
|
5511
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? $ : d, S = [], b = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5974
5512
|
if (b && b.serialize && b.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5975
5513
|
if (c.domainHost || b && b.domainHost)
|
|
5976
5514
|
try {
|
|
5977
|
-
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED,
|
|
5515
|
+
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5978
5516
|
} catch (J) {
|
|
5979
5517
|
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5980
5518
|
}
|
|
5981
5519
|
}
|
|
5982
|
-
G(f, m), c.reference !== "suffix" && f.scheme && (
|
|
5520
|
+
G(f, m), c.reference !== "suffix" && f.scheme && (S.push(f.scheme), S.push(":"));
|
|
5983
5521
|
var U = nt(f, c);
|
|
5984
|
-
if (U !== void 0 && (c.reference !== "suffix" &&
|
|
5522
|
+
if (U !== void 0 && (c.reference !== "suffix" && S.push("//"), S.push(U), f.path && f.path.charAt(0) !== "/" && S.push("/")), f.path !== void 0) {
|
|
5985
5523
|
var L = f.path;
|
|
5986
|
-
!c.absolutePath && (!b || !b.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")),
|
|
5524
|
+
!c.absolutePath && (!b || !b.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), S.push(L);
|
|
5987
5525
|
}
|
|
5988
|
-
return f.query !== void 0 && (
|
|
5526
|
+
return f.query !== void 0 && (S.push("?"), S.push(f.query)), f.fragment !== void 0 && (S.push("#"), S.push(f.fragment)), S.join("");
|
|
5989
5527
|
}
|
|
5990
|
-
function
|
|
5991
|
-
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {},
|
|
5992
|
-
return
|
|
5528
|
+
function xe(f, c) {
|
|
5529
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, S = arguments[3], b = {};
|
|
5530
|
+
return S || (f = de(le(f, m), m), c = de(le(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (b.scheme = c.scheme, b.userinfo = c.userinfo, b.host = c.host, b.port = c.port, b.path = me(c.path || ""), b.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (b.userinfo = c.userinfo, b.host = c.host, b.port = c.port, b.path = me(c.path || ""), b.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? b.path = me(c.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? b.path = "/" + c.path : f.path ? b.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + c.path : b.path = c.path, b.path = me(b.path)), b.query = c.query) : (b.path = f.path, c.query !== void 0 ? b.query = c.query : b.query = f.query), b.userinfo = f.userinfo, b.host = f.host, b.port = f.port), b.scheme = f.scheme), b.fragment = c.fragment, b;
|
|
5993
5531
|
}
|
|
5994
5532
|
function it(f, c, m) {
|
|
5995
|
-
var
|
|
5996
|
-
return le(
|
|
5533
|
+
var S = p({ scheme: "null" }, m);
|
|
5534
|
+
return le(xe(de(f, S), de(c, S), S, !0), S);
|
|
5997
5535
|
}
|
|
5998
|
-
function
|
|
5536
|
+
function Oe(f, c) {
|
|
5999
5537
|
return typeof f == "string" ? f = le(de(f, c), c) : i(f) === "object" && (f = de(le(f, c), c)), f;
|
|
6000
5538
|
}
|
|
6001
5539
|
function ot(f, c, m) {
|
|
6002
5540
|
return typeof f == "string" ? f = le(de(f, m), m) : i(f) === "object" && (f = le(f, m)), typeof c == "string" ? c = le(de(c, m), m) : i(c) === "object" && (c = le(c, m)), f === c;
|
|
6003
5541
|
}
|
|
6004
5542
|
function ut(f, c) {
|
|
6005
|
-
return f && f.toString().replace(!c || !c.iri ?
|
|
5543
|
+
return f && f.toString().replace(!c || !c.iri ? d.ESCAPE : $.ESCAPE, q);
|
|
6006
5544
|
}
|
|
6007
5545
|
function pe(f, c) {
|
|
6008
|
-
return f && f.toString().replace(!c || !c.iri ?
|
|
5546
|
+
return f && f.toString().replace(!c || !c.iri ? d.PCT_ENCODED : $.PCT_ENCODED, W);
|
|
6009
5547
|
}
|
|
6010
5548
|
var Ne = {
|
|
6011
5549
|
scheme: "http",
|
|
@@ -6014,8 +5552,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6014
5552
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
6015
5553
|
},
|
|
6016
5554
|
serialize: function(c, m) {
|
|
6017
|
-
var
|
|
6018
|
-
return (c.port === (
|
|
5555
|
+
var S = String(c.scheme).toLowerCase() === "https";
|
|
5556
|
+
return (c.port === (S ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
6019
5557
|
}
|
|
6020
5558
|
}, It = {
|
|
6021
5559
|
scheme: "https",
|
|
@@ -6030,12 +5568,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6030
5568
|
scheme: "ws",
|
|
6031
5569
|
domainHost: !0,
|
|
6032
5570
|
parse: function(c, m) {
|
|
6033
|
-
var
|
|
6034
|
-
return
|
|
5571
|
+
var S = c;
|
|
5572
|
+
return S.secure = jt(S), S.resourceName = (S.path || "/") + (S.query ? "?" + S.query : ""), S.path = void 0, S.query = void 0, S;
|
|
6035
5573
|
},
|
|
6036
5574
|
serialize: function(c, m) {
|
|
6037
5575
|
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
|
|
5576
|
+
var S = c.resourceName.split("?"), b = E(S, 2), U = b[0], L = b[1];
|
|
6039
5577
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
6040
5578
|
}
|
|
6041
5579
|
return c.fragment = void 0, c;
|
|
@@ -6046,16 +5584,16 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6046
5584
|
parse: at.parse,
|
|
6047
5585
|
serialize: at.serialize
|
|
6048
5586
|
}, ir = {}, At = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", or = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(At, "g"), We = new RegExp(or, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", At, dr), "g"), fr = Ft;
|
|
6049
|
-
function
|
|
6050
|
-
var c =
|
|
5587
|
+
function Ot(f) {
|
|
5588
|
+
var c = W(f);
|
|
6051
5589
|
return c.match(ur) ? c : f;
|
|
6052
5590
|
}
|
|
6053
|
-
var
|
|
5591
|
+
var Mt = {
|
|
6054
5592
|
scheme: "mailto",
|
|
6055
5593
|
parse: function(c, m) {
|
|
6056
|
-
var
|
|
6057
|
-
if (
|
|
6058
|
-
for (var U = !1, L = {}, J =
|
|
5594
|
+
var S = c, b = S.to = S.path ? S.path.split(",") : [];
|
|
5595
|
+
if (S.path = void 0, S.query) {
|
|
5596
|
+
for (var U = !1, L = {}, J = S.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
6059
5597
|
var B = J[Y].split("=");
|
|
6060
5598
|
switch (B[0]) {
|
|
6061
5599
|
case "to":
|
|
@@ -6063,19 +5601,19 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6063
5601
|
b.push(Q[ie]);
|
|
6064
5602
|
break;
|
|
6065
5603
|
case "subject":
|
|
6066
|
-
|
|
5604
|
+
S.subject = pe(B[1], m);
|
|
6067
5605
|
break;
|
|
6068
5606
|
case "body":
|
|
6069
|
-
|
|
5607
|
+
S.body = pe(B[1], m);
|
|
6070
5608
|
break;
|
|
6071
5609
|
default:
|
|
6072
5610
|
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
6073
5611
|
break;
|
|
6074
5612
|
}
|
|
6075
5613
|
}
|
|
6076
|
-
U && (
|
|
5614
|
+
U && (S.headers = L);
|
|
6077
5615
|
}
|
|
6078
|
-
|
|
5616
|
+
S.query = void 0;
|
|
6079
5617
|
for (var X = 0, ae = b.length; X < ae; ++X) {
|
|
6080
5618
|
var ee = b[X].split("@");
|
|
6081
5619
|
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
@@ -6084,46 +5622,46 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6084
5622
|
try {
|
|
6085
5623
|
ee[1] = N.toASCII(pe(ee[1], m).toLowerCase());
|
|
6086
5624
|
} catch (Ee) {
|
|
6087
|
-
|
|
5625
|
+
S.error = S.error || "Email address's domain name can not be converted to ASCII via punycode: " + Ee;
|
|
6088
5626
|
}
|
|
6089
5627
|
b[X] = ee.join("@");
|
|
6090
5628
|
}
|
|
6091
|
-
return
|
|
5629
|
+
return S;
|
|
6092
5630
|
},
|
|
6093
5631
|
serialize: function(c, m) {
|
|
6094
|
-
var
|
|
5632
|
+
var S = c, b = l(c.to);
|
|
6095
5633
|
if (b) {
|
|
6096
5634
|
for (var U = 0, L = b.length; U < L; ++U) {
|
|
6097
|
-
var J = String(b[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We,
|
|
5635
|
+
var J = String(b[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, a).replace(pr, q), B = J.slice(Y + 1);
|
|
6098
5636
|
try {
|
|
6099
5637
|
B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
|
|
6100
5638
|
} catch (X) {
|
|
6101
|
-
|
|
5639
|
+
S.error = S.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
6102
5640
|
}
|
|
6103
5641
|
b[U] = se + "@" + B;
|
|
6104
5642
|
}
|
|
6105
|
-
|
|
5643
|
+
S.path = b.join(",");
|
|
6106
5644
|
}
|
|
6107
5645
|
var Q = c.headers = c.headers || {};
|
|
6108
5646
|
c.subject && (Q.subject = c.subject), c.body && (Q.body = c.body);
|
|
6109
5647
|
var ie = [];
|
|
6110
5648
|
for (var V in Q)
|
|
6111
|
-
Q[V] !== ir[V] && ie.push(V.replace(We,
|
|
6112
|
-
return ie.length && (
|
|
5649
|
+
Q[V] !== ir[V] && ie.push(V.replace(We, Ot).replace(We, a).replace(Ft, q) + "=" + Q[V].replace(We, Ot).replace(We, a).replace(fr, q));
|
|
5650
|
+
return ie.length && (S.query = ie.join("&")), S;
|
|
6113
5651
|
}
|
|
6114
|
-
}, hr = /^([^\:]+)\:(.*)/,
|
|
5652
|
+
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
6115
5653
|
scheme: "urn",
|
|
6116
5654
|
parse: function(c, m) {
|
|
6117
|
-
var
|
|
6118
|
-
if (
|
|
6119
|
-
var U = m.scheme || b.scheme || "urn", L =
|
|
5655
|
+
var S = c.path && c.path.match(hr), b = c;
|
|
5656
|
+
if (S) {
|
|
5657
|
+
var U = m.scheme || b.scheme || "urn", L = S[1].toLowerCase(), J = S[2], Y = U + ":" + (m.nid || L), se = M[Y];
|
|
6120
5658
|
b.nid = L, b.nss = J, b.path = void 0, se && (b = se.parse(b, m));
|
|
6121
5659
|
} else
|
|
6122
5660
|
b.error = b.error || "URN can not be parsed.";
|
|
6123
5661
|
return b;
|
|
6124
5662
|
},
|
|
6125
5663
|
serialize: function(c, m) {
|
|
6126
|
-
var
|
|
5664
|
+
var S = m.scheme || c.scheme || "urn", b = c.nid, U = S + ":" + (m.nid || b), L = M[U];
|
|
6127
5665
|
L && (c = L.serialize(c, m));
|
|
6128
5666
|
var J = c, Y = c.nss;
|
|
6129
5667
|
return J.path = (b || m.nid) + ":" + Y, J;
|
|
@@ -6131,15 +5669,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6131
5669
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
6132
5670
|
scheme: "urn:uuid",
|
|
6133
5671
|
parse: function(c, m) {
|
|
6134
|
-
var
|
|
6135
|
-
return
|
|
5672
|
+
var S = c;
|
|
5673
|
+
return S.uuid = S.nss, S.nss = void 0, !m.tolerant && (!S.uuid || !S.uuid.match(mr)) && (S.error = S.error || "UUID is not valid."), S;
|
|
6136
5674
|
},
|
|
6137
5675
|
serialize: function(c, m) {
|
|
6138
|
-
var
|
|
6139
|
-
return
|
|
5676
|
+
var S = c;
|
|
5677
|
+
return S.nss = (c.uuid || "").toLowerCase(), S;
|
|
6140
5678
|
}
|
|
6141
5679
|
};
|
|
6142
|
-
|
|
5680
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[Dt.scheme] = Dt, 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 = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
6143
5681
|
});
|
|
6144
5682
|
})(uri_all, uri_all.exports);
|
|
6145
5683
|
var uri_allExports = uri_all.exports;
|
|
@@ -6167,9 +5705,9 @@ uri$1.default = uri;
|
|
|
6167
5705
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
6168
5706
|
return r.CodeGen;
|
|
6169
5707
|
} });
|
|
6170
|
-
const n = validation_error, s = ref_error, i = rules, a = compile, l = codegen, p = resolve$1,
|
|
6171
|
-
|
|
6172
|
-
const v = ["removeAdditional", "useDefaults", "coerceTypes"],
|
|
5708
|
+
const n = validation_error, s = ref_error, i = rules, a = compile, l = codegen, p = resolve$1, u = dataType, d = util, $ = require$$9, E = uri$1, R = (F, y) => new RegExp(F, y);
|
|
5709
|
+
R.code = "new RegExp";
|
|
5710
|
+
const v = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
6173
5711
|
"validate",
|
|
6174
5712
|
"serialize",
|
|
6175
5713
|
"parse",
|
|
@@ -6183,7 +5721,7 @@ uri$1.default = uri;
|
|
|
6183
5721
|
"func",
|
|
6184
5722
|
"obj",
|
|
6185
5723
|
"Error"
|
|
6186
|
-
]),
|
|
5724
|
+
]), g = {
|
|
6187
5725
|
errorDataPath: "",
|
|
6188
5726
|
format: "`validateFormats: false` can be used instead.",
|
|
6189
5727
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -6204,45 +5742,45 @@ uri$1.default = uri;
|
|
|
6204
5742
|
jsPropertySyntax: "",
|
|
6205
5743
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
6206
5744
|
}, k = 200;
|
|
6207
|
-
function
|
|
6208
|
-
var y, j, P, o, h, N,
|
|
6209
|
-
const
|
|
5745
|
+
function C(F) {
|
|
5746
|
+
var y, j, P, o, h, N, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, ze, Ve, st, me, le, xe, it;
|
|
5747
|
+
const Oe = F.strict, ot = (y = F.code) === null || y === void 0 ? void 0 : y.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (P = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && P !== void 0 ? P : R, Ne = (o = F.uriResolver) !== null && o !== void 0 ? o : E.default;
|
|
6210
5748
|
return {
|
|
6211
|
-
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h :
|
|
6212
|
-
strictNumbers: (
|
|
6213
|
-
strictTypes: (G = (
|
|
6214
|
-
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne :
|
|
6215
|
-
strictRequired: (tt = (
|
|
5749
|
+
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
5750
|
+
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && q !== void 0 ? q : !0,
|
|
5751
|
+
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5752
|
+
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5753
|
+
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
6216
5754
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
6217
5755
|
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : k,
|
|
6218
5756
|
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : k,
|
|
6219
5757
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
6220
|
-
messages: (
|
|
6221
|
-
inlineRefs: (
|
|
6222
|
-
schemaId: (
|
|
5758
|
+
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5759
|
+
inlineRefs: (ze = F.inlineRefs) !== null && ze !== void 0 ? ze : !0,
|
|
5760
|
+
schemaId: (Ve = F.schemaId) !== null && Ve !== void 0 ? Ve : "$id",
|
|
6223
5761
|
addUsedSchema: (st = F.addUsedSchema) !== null && st !== void 0 ? st : !0,
|
|
6224
5762
|
validateSchema: (me = F.validateSchema) !== null && me !== void 0 ? me : !0,
|
|
6225
5763
|
validateFormats: (le = F.validateFormats) !== null && le !== void 0 ? le : !0,
|
|
6226
|
-
unicodeRegExp: (
|
|
5764
|
+
unicodeRegExp: (xe = F.unicodeRegExp) !== null && xe !== void 0 ? xe : !0,
|
|
6227
5765
|
int32range: (it = F.int32range) !== null && it !== void 0 ? it : !0,
|
|
6228
5766
|
uriResolver: Ne
|
|
6229
5767
|
};
|
|
6230
5768
|
}
|
|
6231
5769
|
class I {
|
|
6232
5770
|
constructor(y = {}) {
|
|
6233
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), y = this.opts = { ...y, ...
|
|
5771
|
+
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
5772
|
const { es5: j, lines: P } = this.opts.code;
|
|
6235
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes:
|
|
5773
|
+
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines: P }), this.logger = K(y.logger);
|
|
6236
5774
|
const o = y.validateFormats;
|
|
6237
|
-
y.validateFormats = !1, this.RULES = (0, i.getRules)(), A.call(this,
|
|
5775
|
+
y.validateFormats = !1, this.RULES = (0, i.getRules)(), A.call(this, g, y, "NOT SUPPORTED"), A.call(this, _, y, "DEPRECATED", "warn"), this._metaOpts = x.call(this), y.formats && D.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), y.keywords && z.call(this, y.keywords), typeof y.meta == "object" && this.addMetaSchema(y.meta), O.call(this), y.validateFormats = o;
|
|
6238
5776
|
}
|
|
6239
5777
|
_addVocabularies() {
|
|
6240
5778
|
this.addKeyword("$async");
|
|
6241
5779
|
}
|
|
6242
5780
|
_addDefaultMetaSchema() {
|
|
6243
5781
|
const { $data: y, meta: j, schemaId: P } = this.opts;
|
|
6244
|
-
let o =
|
|
6245
|
-
P === "id" && (o = {
|
|
5782
|
+
let o = $;
|
|
5783
|
+
P === "id" && (o = { ...$ }, o.id = o.$id, delete o.$id), j && y && this.addMetaSchema(o, o[P], !1);
|
|
6246
5784
|
}
|
|
6247
5785
|
defaultMeta() {
|
|
6248
5786
|
const { meta: y, schemaId: j } = this.opts;
|
|
@@ -6281,18 +5819,18 @@ uri$1.default = uri;
|
|
|
6281
5819
|
} catch (ne) {
|
|
6282
5820
|
if (!(ne instanceof s.default))
|
|
6283
5821
|
throw ne;
|
|
6284
|
-
return
|
|
5822
|
+
return M.call(this, ne), await q.call(this, ne.missingSchema), N.call(this, G);
|
|
6285
5823
|
}
|
|
6286
5824
|
}
|
|
6287
|
-
function
|
|
5825
|
+
function M({ missingSchema: G, missingRef: ne }) {
|
|
6288
5826
|
if (this.refs[G])
|
|
6289
5827
|
throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
|
|
6290
5828
|
}
|
|
6291
|
-
async function
|
|
6292
|
-
const ne = await
|
|
5829
|
+
async function q(G) {
|
|
5830
|
+
const ne = await W.call(this, G);
|
|
6293
5831
|
this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
|
|
6294
5832
|
}
|
|
6295
|
-
async function
|
|
5833
|
+
async function W(G) {
|
|
6296
5834
|
const ne = this._loading[G];
|
|
6297
5835
|
if (ne)
|
|
6298
5836
|
return ne;
|
|
@@ -6396,14 +5934,14 @@ uri$1.default = uri;
|
|
|
6396
5934
|
} else
|
|
6397
5935
|
throw new Error("invalid addKeywords parameters");
|
|
6398
5936
|
if (oe.call(this, P, j), !j)
|
|
6399
|
-
return (0,
|
|
5937
|
+
return (0, d.eachItem)(P, (h) => ke.call(this, h)), this;
|
|
6400
5938
|
qe.call(this, j);
|
|
6401
5939
|
const o = {
|
|
6402
5940
|
...j,
|
|
6403
|
-
type: (0,
|
|
6404
|
-
schemaType: (0,
|
|
5941
|
+
type: (0, u.getJSONTypes)(j.type),
|
|
5942
|
+
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6405
5943
|
};
|
|
6406
|
-
return (0,
|
|
5944
|
+
return (0, d.eachItem)(P, o.type.length === 0 ? (h) => ke.call(this, h, o) : (h) => o.type.forEach((N) => ke.call(this, h, o, N))), this;
|
|
6407
5945
|
}
|
|
6408
5946
|
getKeyword(y) {
|
|
6409
5947
|
const j = this.RULES.all[y];
|
|
@@ -6432,14 +5970,14 @@ uri$1.default = uri;
|
|
|
6432
5970
|
for (const o of j) {
|
|
6433
5971
|
const h = o.split("/").slice(1);
|
|
6434
5972
|
let N = y;
|
|
6435
|
-
for (const
|
|
6436
|
-
N = N[
|
|
6437
|
-
for (const
|
|
6438
|
-
const
|
|
6439
|
-
if (typeof
|
|
5973
|
+
for (const M of h)
|
|
5974
|
+
N = N[M];
|
|
5975
|
+
for (const M in P) {
|
|
5976
|
+
const q = P[M];
|
|
5977
|
+
if (typeof q != "object")
|
|
6440
5978
|
continue;
|
|
6441
|
-
const { $data:
|
|
6442
|
-
|
|
5979
|
+
const { $data: W } = q.definition, G = N[M];
|
|
5980
|
+
W && G && (N[M] = Ue(G));
|
|
6443
5981
|
}
|
|
6444
5982
|
}
|
|
6445
5983
|
return y;
|
|
@@ -6452,21 +5990,21 @@ uri$1.default = uri;
|
|
|
6452
5990
|
}
|
|
6453
5991
|
_addSchema(y, j, P, o = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6454
5992
|
let N;
|
|
6455
|
-
const { schemaId:
|
|
5993
|
+
const { schemaId: M } = this.opts;
|
|
6456
5994
|
if (typeof y == "object")
|
|
6457
|
-
N = y[
|
|
5995
|
+
N = y[M];
|
|
6458
5996
|
else {
|
|
6459
5997
|
if (this.opts.jtd)
|
|
6460
5998
|
throw new Error("schema must be object");
|
|
6461
5999
|
if (typeof y != "boolean")
|
|
6462
6000
|
throw new Error("schema must be object or boolean");
|
|
6463
6001
|
}
|
|
6464
|
-
let
|
|
6465
|
-
if (
|
|
6466
|
-
return
|
|
6002
|
+
let q = this._cache.get(y);
|
|
6003
|
+
if (q !== void 0)
|
|
6004
|
+
return q;
|
|
6467
6005
|
P = (0, p.normalizeId)(N || P);
|
|
6468
|
-
const
|
|
6469
|
-
return
|
|
6006
|
+
const W = p.getSchemaRefs.call(this, y, P);
|
|
6007
|
+
return q = new a.SchemaEnv({ schema: y, schemaId: M, meta: j, baseId: P, localRefs: W }), this._cache.set(q.schema, q), h && !P.startsWith("#") && (P && this._checkUnique(P), this.refs[P] = q), o && this.validateSchema(y, !0), q;
|
|
6470
6008
|
}
|
|
6471
6009
|
_checkUnique(y) {
|
|
6472
6010
|
if (this.schemas[y] || this.refs[y])
|
|
@@ -6497,7 +6035,7 @@ uri$1.default = uri;
|
|
|
6497
6035
|
function w(F) {
|
|
6498
6036
|
return F = (0, p.normalizeId)(F), this.schemas[F] || this.refs[F];
|
|
6499
6037
|
}
|
|
6500
|
-
function
|
|
6038
|
+
function O() {
|
|
6501
6039
|
const F = this.opts.schemas;
|
|
6502
6040
|
if (F)
|
|
6503
6041
|
if (Array.isArray(F))
|
|
@@ -6523,7 +6061,7 @@ uri$1.default = uri;
|
|
|
6523
6061
|
j.keyword || (j.keyword = y), this.addKeyword(j);
|
|
6524
6062
|
}
|
|
6525
6063
|
}
|
|
6526
|
-
function
|
|
6064
|
+
function x() {
|
|
6527
6065
|
const F = { ...this.opts };
|
|
6528
6066
|
for (const y of v)
|
|
6529
6067
|
delete F[y];
|
|
@@ -6545,7 +6083,7 @@ uri$1.default = uri;
|
|
|
6545
6083
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6546
6084
|
function oe(F, y) {
|
|
6547
6085
|
const { RULES: j } = this;
|
|
6548
|
-
if ((0,
|
|
6086
|
+
if ((0, d.eachItem)(F, (P) => {
|
|
6549
6087
|
if (j.keywords[P])
|
|
6550
6088
|
throw new Error(`Keyword ${P} is already defined`);
|
|
6551
6089
|
if (!ue.test(P))
|
|
@@ -6559,31 +6097,31 @@ uri$1.default = uri;
|
|
|
6559
6097
|
if (j && o)
|
|
6560
6098
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6561
6099
|
const { RULES: h } = this;
|
|
6562
|
-
let N = o ? h.post : h.rules.find(({ type:
|
|
6100
|
+
let N = o ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6563
6101
|
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !y)
|
|
6564
6102
|
return;
|
|
6565
|
-
const
|
|
6103
|
+
const M = {
|
|
6566
6104
|
keyword: F,
|
|
6567
6105
|
definition: {
|
|
6568
6106
|
...y,
|
|
6569
|
-
type: (0,
|
|
6570
|
-
schemaType: (0,
|
|
6107
|
+
type: (0, u.getJSONTypes)(y.type),
|
|
6108
|
+
schemaType: (0, u.getJSONTypes)(y.schemaType)
|
|
6571
6109
|
}
|
|
6572
6110
|
};
|
|
6573
|
-
y.before ?
|
|
6111
|
+
y.before ? Ce.call(this, N, M, y.before) : N.rules.push(M), h.all[F] = M, (P = y.implements) === null || P === void 0 || P.forEach((q) => this.addKeyword(q));
|
|
6574
6112
|
}
|
|
6575
|
-
function
|
|
6113
|
+
function Ce(F, y, j) {
|
|
6576
6114
|
const P = F.rules.findIndex((o) => o.keyword === j);
|
|
6577
6115
|
P >= 0 ? F.rules.splice(P, 0, y) : (F.rules.push(y), this.logger.warn(`rule ${j} is not defined`));
|
|
6578
6116
|
}
|
|
6579
6117
|
function qe(F) {
|
|
6580
6118
|
let { metaSchema: y } = F;
|
|
6581
|
-
y !== void 0 && (F.$data && this.opts.$data && (y =
|
|
6119
|
+
y !== void 0 && (F.$data && this.opts.$data && (y = Ue(y)), F.validateSchema = this.compile(y, !0));
|
|
6582
6120
|
}
|
|
6583
6121
|
const et = {
|
|
6584
6122
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6585
6123
|
};
|
|
6586
|
-
function
|
|
6124
|
+
function Ue(F) {
|
|
6587
6125
|
return { anyOf: [F, et] };
|
|
6588
6126
|
}
|
|
6589
6127
|
})(core$2);
|
|
@@ -6603,34 +6141,34 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6603
6141
|
keyword: "$ref",
|
|
6604
6142
|
schemaType: "string",
|
|
6605
6143
|
code(e) {
|
|
6606
|
-
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: a, opts: l, self: p } = n, { root:
|
|
6607
|
-
if ((r === "#" || r === "#/") && s ===
|
|
6608
|
-
return
|
|
6609
|
-
const
|
|
6610
|
-
if (
|
|
6144
|
+
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: a, opts: l, self: p } = n, { root: u } = i;
|
|
6145
|
+
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6146
|
+
return $();
|
|
6147
|
+
const d = compile_1$1.resolveRef.call(p, u, s, r);
|
|
6148
|
+
if (d === void 0)
|
|
6611
6149
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6612
|
-
if (
|
|
6613
|
-
return
|
|
6614
|
-
return
|
|
6615
|
-
function
|
|
6616
|
-
if (i ===
|
|
6150
|
+
if (d instanceof compile_1$1.SchemaEnv)
|
|
6151
|
+
return E(d);
|
|
6152
|
+
return R(d);
|
|
6153
|
+
function $() {
|
|
6154
|
+
if (i === u)
|
|
6617
6155
|
return callRef(e, a, i, i.$async);
|
|
6618
|
-
const v = t.scopeValue("root", { ref:
|
|
6619
|
-
return callRef(e, (0, codegen_1$l._)`${v}.validate`,
|
|
6156
|
+
const v = t.scopeValue("root", { ref: u });
|
|
6157
|
+
return callRef(e, (0, codegen_1$l._)`${v}.validate`, u, u.$async);
|
|
6620
6158
|
}
|
|
6621
|
-
function
|
|
6622
|
-
const
|
|
6623
|
-
callRef(e,
|
|
6159
|
+
function E(v) {
|
|
6160
|
+
const T = getValidate(e, v);
|
|
6161
|
+
callRef(e, T, v, v.$async);
|
|
6624
6162
|
}
|
|
6625
|
-
function
|
|
6626
|
-
const
|
|
6163
|
+
function R(v) {
|
|
6164
|
+
const T = t.scopeValue("schema", l.code.source === !0 ? { ref: v, code: (0, codegen_1$l.stringify)(v) } : { ref: v }), g = t.name("valid"), _ = e.subschema({
|
|
6627
6165
|
schema: v,
|
|
6628
6166
|
dataTypes: [],
|
|
6629
6167
|
schemaPath: codegen_1$l.nil,
|
|
6630
|
-
topSchemaRef:
|
|
6168
|
+
topSchemaRef: T,
|
|
6631
6169
|
errSchemaPath: r
|
|
6632
|
-
},
|
|
6633
|
-
e.mergeEvaluated(_), e.ok(
|
|
6170
|
+
}, g);
|
|
6171
|
+
e.mergeEvaluated(_), e.ok(g);
|
|
6634
6172
|
}
|
|
6635
6173
|
}
|
|
6636
6174
|
};
|
|
@@ -6640,40 +6178,40 @@ function getValidate(e, t) {
|
|
|
6640
6178
|
}
|
|
6641
6179
|
ref.getValidate = getValidate;
|
|
6642
6180
|
function callRef(e, t, r, n) {
|
|
6643
|
-
const { gen: s, it: i } = e, { allErrors: a, schemaEnv: l, opts: p } = i,
|
|
6644
|
-
n ?
|
|
6645
|
-
function
|
|
6181
|
+
const { gen: s, it: i } = e, { allErrors: a, schemaEnv: l, opts: p } = i, u = p.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6182
|
+
n ? d() : $();
|
|
6183
|
+
function d() {
|
|
6646
6184
|
if (!l.$async)
|
|
6647
6185
|
throw new Error("async schema referenced by sync schema");
|
|
6648
6186
|
const v = s.let("valid");
|
|
6649
6187
|
s.try(() => {
|
|
6650
|
-
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t,
|
|
6651
|
-
}, (
|
|
6652
|
-
s.if((0, codegen_1$l._)`!(${
|
|
6188
|
+
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), R(t), a || s.assign(v, !0);
|
|
6189
|
+
}, (T) => {
|
|
6190
|
+
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), E(T), a || s.assign(v, !1);
|
|
6653
6191
|
}), e.ok(v);
|
|
6654
6192
|
}
|
|
6655
|
-
function
|
|
6656
|
-
e.result((0, code_1$8.callValidateCode)(e, t,
|
|
6193
|
+
function $() {
|
|
6194
|
+
e.result((0, code_1$8.callValidateCode)(e, t, u), () => R(t), () => E(t));
|
|
6657
6195
|
}
|
|
6658
|
-
function
|
|
6659
|
-
const
|
|
6660
|
-
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${
|
|
6196
|
+
function E(v) {
|
|
6197
|
+
const T = (0, codegen_1$l._)`${v}.errors`;
|
|
6198
|
+
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
6199
|
}
|
|
6662
|
-
function
|
|
6663
|
-
var
|
|
6200
|
+
function R(v) {
|
|
6201
|
+
var T;
|
|
6664
6202
|
if (!i.opts.unevaluated)
|
|
6665
6203
|
return;
|
|
6666
|
-
const
|
|
6204
|
+
const g = (T = r == null ? void 0 : r.validate) === null || T === void 0 ? void 0 : T.evaluated;
|
|
6667
6205
|
if (i.props !== !0)
|
|
6668
|
-
if (
|
|
6669
|
-
|
|
6206
|
+
if (g && !g.dynamicProps)
|
|
6207
|
+
g.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, g.props, i.props));
|
|
6670
6208
|
else {
|
|
6671
6209
|
const _ = s.var("props", (0, codegen_1$l._)`${v}.evaluated.props`);
|
|
6672
6210
|
i.props = util_1$j.mergeEvaluated.props(s, _, i.props, codegen_1$l.Name);
|
|
6673
6211
|
}
|
|
6674
6212
|
if (i.items !== !0)
|
|
6675
|
-
if (
|
|
6676
|
-
|
|
6213
|
+
if (g && !g.dynamicItems)
|
|
6214
|
+
g.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, g.items, i.items));
|
|
6677
6215
|
else {
|
|
6678
6216
|
const _ = s.var("items", (0, codegen_1$l._)`${v}.evaluated.items`);
|
|
6679
6217
|
i.items = util_1$j.mergeEvaluated.items(s, _, i.items, codegen_1$l.Name);
|
|
@@ -6816,37 +6354,37 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6816
6354
|
if (!i && r.length === 0)
|
|
6817
6355
|
return;
|
|
6818
6356
|
const p = r.length >= l.loopRequired;
|
|
6819
|
-
if (a.allErrors ?
|
|
6820
|
-
const
|
|
6821
|
-
for (const
|
|
6822
|
-
if ((
|
|
6823
|
-
const
|
|
6357
|
+
if (a.allErrors ? u() : d(), l.strictRequired) {
|
|
6358
|
+
const R = e.parentSchema.properties, { definedProperties: v } = e.it;
|
|
6359
|
+
for (const T of r)
|
|
6360
|
+
if ((R == null ? void 0 : R[T]) === void 0 && !v.has(T)) {
|
|
6361
|
+
const g = a.schemaEnv.baseId + a.errSchemaPath, _ = `required property "${T}" is not defined at "${g}" (strictRequired)`;
|
|
6824
6362
|
(0, util_1$h.checkStrictMode)(a, _, a.opts.strictRequired);
|
|
6825
6363
|
}
|
|
6826
6364
|
}
|
|
6827
|
-
function
|
|
6365
|
+
function u() {
|
|
6828
6366
|
if (p || i)
|
|
6829
|
-
e.block$data(codegen_1$f.nil,
|
|
6367
|
+
e.block$data(codegen_1$f.nil, $);
|
|
6830
6368
|
else
|
|
6831
|
-
for (const
|
|
6832
|
-
(0, code_1$6.checkReportMissingProp)(e,
|
|
6369
|
+
for (const R of r)
|
|
6370
|
+
(0, code_1$6.checkReportMissingProp)(e, R);
|
|
6833
6371
|
}
|
|
6834
|
-
function
|
|
6835
|
-
const
|
|
6372
|
+
function d() {
|
|
6373
|
+
const R = t.let("missing");
|
|
6836
6374
|
if (p || i) {
|
|
6837
6375
|
const v = t.let("valid", !0);
|
|
6838
|
-
e.block$data(v, () =>
|
|
6376
|
+
e.block$data(v, () => E(R, v)), e.ok(v);
|
|
6839
6377
|
} else
|
|
6840
|
-
t.if((0, code_1$6.checkMissingProp)(e, r,
|
|
6378
|
+
t.if((0, code_1$6.checkMissingProp)(e, r, R)), (0, code_1$6.reportMissingProp)(e, R), t.else();
|
|
6841
6379
|
}
|
|
6842
|
-
function
|
|
6843
|
-
t.forOf("prop", n, (
|
|
6844
|
-
e.setParams({ missingProperty:
|
|
6380
|
+
function $() {
|
|
6381
|
+
t.forOf("prop", n, (R) => {
|
|
6382
|
+
e.setParams({ missingProperty: R }), t.if((0, code_1$6.noPropertyInData)(t, s, R, l.ownProperties), () => e.error());
|
|
6845
6383
|
});
|
|
6846
6384
|
}
|
|
6847
|
-
function
|
|
6848
|
-
e.setParams({ missingProperty:
|
|
6849
|
-
t.assign(v, (0, code_1$6.propertyInData)(t, s,
|
|
6385
|
+
function E(R, v) {
|
|
6386
|
+
e.setParams({ missingProperty: R }), t.forOf(R, n, () => {
|
|
6387
|
+
t.assign(v, (0, code_1$6.propertyInData)(t, s, R, l.ownProperties)), t.if((0, codegen_1$f.not)(v), () => {
|
|
6850
6388
|
e.error(), t.break();
|
|
6851
6389
|
});
|
|
6852
6390
|
}, codegen_1$f.nil);
|
|
@@ -6893,26 +6431,26 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6893
6431
|
const { gen: t, data: r, $data: n, schema: s, parentSchema: i, schemaCode: a, it: l } = e;
|
|
6894
6432
|
if (!n && !s)
|
|
6895
6433
|
return;
|
|
6896
|
-
const p = t.let("valid"),
|
|
6897
|
-
e.block$data(p,
|
|
6898
|
-
function
|
|
6899
|
-
const v = t.let("i", (0, codegen_1$d._)`${r}.length`),
|
|
6900
|
-
e.setParams({ i: v, j:
|
|
6434
|
+
const p = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6435
|
+
e.block$data(p, d, (0, codegen_1$d._)`${a} === false`), e.ok(p);
|
|
6436
|
+
function d() {
|
|
6437
|
+
const v = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6438
|
+
e.setParams({ i: v, j: T }), t.assign(p, !0), t.if((0, codegen_1$d._)`${v} > 1`, () => ($() ? E : R)(v, T));
|
|
6901
6439
|
}
|
|
6902
|
-
function
|
|
6903
|
-
return
|
|
6440
|
+
function $() {
|
|
6441
|
+
return u.length > 0 && !u.some((v) => v === "object" || v === "array");
|
|
6904
6442
|
}
|
|
6905
|
-
function
|
|
6906
|
-
const
|
|
6443
|
+
function E(v, T) {
|
|
6444
|
+
const g = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, g, l.opts.strictNumbers, dataType_1.DataType.Wrong), k = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6907
6445
|
t.for((0, codegen_1$d._)`;${v}--;`, () => {
|
|
6908
|
-
t.let(
|
|
6909
|
-
t.assign(
|
|
6910
|
-
}).code((0, codegen_1$d._)`${k}[${
|
|
6446
|
+
t.let(g, (0, codegen_1$d._)`${r}[${v}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${g} == "string"`, (0, codegen_1$d._)`${g} += "_"`), t.if((0, codegen_1$d._)`typeof ${k}[${g}] == "number"`, () => {
|
|
6447
|
+
t.assign(T, (0, codegen_1$d._)`${k}[${g}]`), e.error(), t.assign(p, !1).break();
|
|
6448
|
+
}).code((0, codegen_1$d._)`${k}[${g}] = ${v}`);
|
|
6911
6449
|
});
|
|
6912
6450
|
}
|
|
6913
|
-
function
|
|
6914
|
-
const
|
|
6915
|
-
t.label(_).for((0, codegen_1$d._)`;${v}--;`, () => t.for((0, codegen_1$d._)`${
|
|
6451
|
+
function R(v, T) {
|
|
6452
|
+
const g = (0, util_1$g.useFunc)(t, equal_1$2.default), _ = t.name("outer");
|
|
6453
|
+
t.label(_).for((0, codegen_1$d._)`;${v}--;`, () => t.for((0, codegen_1$d._)`${T} = ${v}; ${T}--;`, () => t.if((0, codegen_1$d._)`${g}(${r}[${v}], ${r}[${T}])`, () => {
|
|
6916
6454
|
e.error(), t.assign(p, !1).break(_);
|
|
6917
6455
|
})));
|
|
6918
6456
|
}
|
|
@@ -6950,23 +6488,23 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6950
6488
|
throw new Error("enum must have non-empty array");
|
|
6951
6489
|
const l = s.length >= a.opts.loopEnum;
|
|
6952
6490
|
let p;
|
|
6953
|
-
const
|
|
6954
|
-
let
|
|
6491
|
+
const u = () => p ?? (p = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6492
|
+
let d;
|
|
6955
6493
|
if (l || n)
|
|
6956
|
-
|
|
6494
|
+
d = t.let("valid"), e.block$data(d, $);
|
|
6957
6495
|
else {
|
|
6958
6496
|
if (!Array.isArray(s))
|
|
6959
6497
|
throw new Error("ajv implementation error");
|
|
6960
|
-
const
|
|
6961
|
-
|
|
6498
|
+
const R = t.const("vSchema", i);
|
|
6499
|
+
d = (0, codegen_1$b.or)(...s.map((v, T) => E(R, T)));
|
|
6962
6500
|
}
|
|
6963
|
-
e.pass(
|
|
6964
|
-
function
|
|
6965
|
-
t.assign(
|
|
6501
|
+
e.pass(d);
|
|
6502
|
+
function $() {
|
|
6503
|
+
t.assign(d, !1), t.forOf("v", i, (R) => t.if((0, codegen_1$b._)`${u()}(${r}, ${R})`, () => t.assign(d, !0).break()));
|
|
6966
6504
|
}
|
|
6967
|
-
function
|
|
6968
|
-
const
|
|
6969
|
-
return typeof
|
|
6505
|
+
function E(R, v) {
|
|
6506
|
+
const T = s[v];
|
|
6507
|
+
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${u()}(${r}, ${R}[${v}])` : (0, codegen_1$b._)`${r} === ${T}`;
|
|
6970
6508
|
}
|
|
6971
6509
|
}
|
|
6972
6510
|
};
|
|
@@ -7020,12 +6558,12 @@ function validateAdditionalItems(e, t) {
|
|
|
7020
6558
|
if (n === !1)
|
|
7021
6559
|
e.setParams({ len: t.length }), e.pass((0, codegen_1$a._)`${l} <= ${t.length}`);
|
|
7022
6560
|
else if (typeof n == "object" && !(0, util_1$d.alwaysValidSchema)(a, n)) {
|
|
7023
|
-
const
|
|
7024
|
-
r.if((0, codegen_1$a.not)(
|
|
6561
|
+
const u = r.var("valid", (0, codegen_1$a._)`${l} <= ${t.length}`);
|
|
6562
|
+
r.if((0, codegen_1$a.not)(u), () => p(u)), e.ok(u);
|
|
7025
6563
|
}
|
|
7026
|
-
function p(
|
|
7027
|
-
r.forRange("i", t.length, l, (
|
|
7028
|
-
e.subschema({ keyword: i, dataProp:
|
|
6564
|
+
function p(u) {
|
|
6565
|
+
r.forRange("i", t.length, l, (d) => {
|
|
6566
|
+
e.subschema({ keyword: i, dataProp: d, dataPropType: util_1$d.Type.Num }, u), a.allErrors || r.if((0, codegen_1$a.not)(u), () => r.break());
|
|
7029
6567
|
});
|
|
7030
6568
|
}
|
|
7031
6569
|
}
|
|
@@ -7048,20 +6586,20 @@ const codegen_1$9 = codegen, util_1$c = util, code_1$5 = code, def$f = {
|
|
|
7048
6586
|
};
|
|
7049
6587
|
function validateTuple(e, t, r = e.schema) {
|
|
7050
6588
|
const { gen: n, parentSchema: s, data: i, keyword: a, it: l } = e;
|
|
7051
|
-
|
|
7052
|
-
const p = n.name("valid"),
|
|
7053
|
-
r.forEach((
|
|
7054
|
-
(0, util_1$c.alwaysValidSchema)(l,
|
|
6589
|
+
d(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
6590
|
+
const p = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6591
|
+
r.forEach(($, E) => {
|
|
6592
|
+
(0, util_1$c.alwaysValidSchema)(l, $) || (n.if((0, codegen_1$9._)`${u} > ${E}`, () => e.subschema({
|
|
7055
6593
|
keyword: a,
|
|
7056
|
-
schemaProp:
|
|
7057
|
-
dataProp:
|
|
6594
|
+
schemaProp: E,
|
|
6595
|
+
dataProp: E
|
|
7058
6596
|
}, p)), e.ok(p));
|
|
7059
6597
|
});
|
|
7060
|
-
function
|
|
7061
|
-
const { opts:
|
|
7062
|
-
if (
|
|
7063
|
-
const
|
|
7064
|
-
(0, util_1$c.checkStrictMode)(l,
|
|
6598
|
+
function d($) {
|
|
6599
|
+
const { opts: E, errSchemaPath: R } = l, v = r.length, T = v === $.minItems && (v === $.maxItems || $[t] === !1);
|
|
6600
|
+
if (E.strictTuples && !T) {
|
|
6601
|
+
const g = `"${a}" is ${v}-tuple, but minItems or maxItems/${t} are not specified or different at path "${R}"`;
|
|
6602
|
+
(0, util_1$c.checkStrictMode)(l, g, E.strictTuples);
|
|
7065
6603
|
}
|
|
7066
6604
|
}
|
|
7067
6605
|
}
|
|
@@ -7108,9 +6646,9 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
7108
6646
|
code(e) {
|
|
7109
6647
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
7110
6648
|
let a, l;
|
|
7111
|
-
const { minContains: p, maxContains:
|
|
7112
|
-
i.opts.next ? (a = p === void 0 ? 1 : p, l =
|
|
7113
|
-
const
|
|
6649
|
+
const { minContains: p, maxContains: u } = n;
|
|
6650
|
+
i.opts.next ? (a = p === void 0 ? 1 : p, l = u) : a = 1;
|
|
6651
|
+
const d = t.const("len", (0, codegen_1$7._)`${s}.length`);
|
|
7114
6652
|
if (e.setParams({ min: a, max: l }), l === void 0 && a === 0) {
|
|
7115
6653
|
(0, util_1$a.checkStrictMode)(i, '"minContains" == 0 without "maxContains": "contains" keyword ignored');
|
|
7116
6654
|
return;
|
|
@@ -7120,29 +6658,29 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
7120
6658
|
return;
|
|
7121
6659
|
}
|
|
7122
6660
|
if ((0, util_1$a.alwaysValidSchema)(i, r)) {
|
|
7123
|
-
let
|
|
7124
|
-
l !== void 0 && (
|
|
6661
|
+
let T = (0, codegen_1$7._)`${d} >= ${a}`;
|
|
6662
|
+
l !== void 0 && (T = (0, codegen_1$7._)`${T} && ${d} <= ${l}`), e.pass(T);
|
|
7125
6663
|
return;
|
|
7126
6664
|
}
|
|
7127
6665
|
i.items = !0;
|
|
7128
|
-
const
|
|
7129
|
-
l === void 0 && a === 1 ?
|
|
7130
|
-
function
|
|
7131
|
-
const
|
|
7132
|
-
T
|
|
7133
|
-
}
|
|
7134
|
-
function T
|
|
7135
|
-
t.forRange("i", 0,
|
|
6666
|
+
const $ = t.name("valid");
|
|
6667
|
+
l === void 0 && a === 1 ? R($, () => t.if($, () => t.break())) : a === 0 ? (t.let($, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, E)) : (t.let($, !1), E()), e.result($, () => e.reset());
|
|
6668
|
+
function E() {
|
|
6669
|
+
const T = t.name("_valid"), g = t.let("count", 0);
|
|
6670
|
+
R(T, () => t.if(T, () => v(g)));
|
|
6671
|
+
}
|
|
6672
|
+
function R(T, g) {
|
|
6673
|
+
t.forRange("i", 0, d, (_) => {
|
|
7136
6674
|
e.subschema({
|
|
7137
6675
|
keyword: "contains",
|
|
7138
6676
|
dataProp: _,
|
|
7139
6677
|
dataPropType: util_1$a.Type.Num,
|
|
7140
6678
|
compositeRule: !0
|
|
7141
|
-
},
|
|
6679
|
+
}, T), g();
|
|
7142
6680
|
});
|
|
7143
6681
|
}
|
|
7144
|
-
function v(
|
|
7145
|
-
t.code((0, codegen_1$7._)`${
|
|
6682
|
+
function v(T) {
|
|
6683
|
+
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${a}`, () => t.assign($, !0).break()) : (t.if((0, codegen_1$7._)`${T} > ${l}`, () => t.assign($, !1).break()), a === 1 ? t.assign($, !0) : t.if((0, codegen_1$7._)`${T} >= ${a}`, () => t.assign($, !0)));
|
|
7146
6684
|
}
|
|
7147
6685
|
}
|
|
7148
6686
|
};
|
|
@@ -7152,14 +6690,14 @@ var dependencies = {};
|
|
|
7152
6690
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0;
|
|
7153
6691
|
const t = codegen, r = util, n = code;
|
|
7154
6692
|
e.error = {
|
|
7155
|
-
message: ({ params: { property: p, depsCount:
|
|
7156
|
-
const
|
|
7157
|
-
return (0, t.str)`must have ${
|
|
6693
|
+
message: ({ params: { property: p, depsCount: u, deps: d } }) => {
|
|
6694
|
+
const $ = u === 1 ? "property" : "properties";
|
|
6695
|
+
return (0, t.str)`must have ${$} ${d} when property ${p} is present`;
|
|
7158
6696
|
},
|
|
7159
|
-
params: ({ params: { property: p, depsCount:
|
|
7160
|
-
missingProperty: ${
|
|
7161
|
-
depsCount: ${
|
|
7162
|
-
deps: ${
|
|
6697
|
+
params: ({ params: { property: p, depsCount: u, deps: d, missingProperty: $ } }) => (0, t._)`{property: ${p},
|
|
6698
|
+
missingProperty: ${$},
|
|
6699
|
+
depsCount: ${u},
|
|
6700
|
+
deps: ${d}}`
|
|
7163
6701
|
// TODO change to reference
|
|
7164
6702
|
};
|
|
7165
6703
|
const s = {
|
|
@@ -7168,51 +6706,51 @@ var dependencies = {};
|
|
|
7168
6706
|
schemaType: "object",
|
|
7169
6707
|
error: e.error,
|
|
7170
6708
|
code(p) {
|
|
7171
|
-
const [
|
|
7172
|
-
a(p,
|
|
6709
|
+
const [u, d] = i(p);
|
|
6710
|
+
a(p, u), l(p, d);
|
|
7173
6711
|
}
|
|
7174
6712
|
};
|
|
7175
6713
|
function i({ schema: p }) {
|
|
7176
|
-
const
|
|
7177
|
-
for (const
|
|
7178
|
-
if (
|
|
6714
|
+
const u = {}, d = {};
|
|
6715
|
+
for (const $ in p) {
|
|
6716
|
+
if ($ === "__proto__")
|
|
7179
6717
|
continue;
|
|
7180
|
-
const
|
|
7181
|
-
|
|
6718
|
+
const E = Array.isArray(p[$]) ? u : d;
|
|
6719
|
+
E[$] = p[$];
|
|
7182
6720
|
}
|
|
7183
|
-
return [
|
|
6721
|
+
return [u, d];
|
|
7184
6722
|
}
|
|
7185
|
-
function a(p,
|
|
7186
|
-
const { gen:
|
|
7187
|
-
if (Object.keys(
|
|
6723
|
+
function a(p, u = p.schema) {
|
|
6724
|
+
const { gen: d, data: $, it: E } = p;
|
|
6725
|
+
if (Object.keys(u).length === 0)
|
|
7188
6726
|
return;
|
|
7189
|
-
const
|
|
7190
|
-
for (const v in
|
|
7191
|
-
const
|
|
7192
|
-
if (
|
|
6727
|
+
const R = d.let("missing");
|
|
6728
|
+
for (const v in u) {
|
|
6729
|
+
const T = u[v];
|
|
6730
|
+
if (T.length === 0)
|
|
7193
6731
|
continue;
|
|
7194
|
-
const
|
|
6732
|
+
const g = (0, n.propertyInData)(d, $, v, E.opts.ownProperties);
|
|
7195
6733
|
p.setParams({
|
|
7196
6734
|
property: v,
|
|
7197
|
-
depsCount:
|
|
7198
|
-
deps:
|
|
7199
|
-
}),
|
|
7200
|
-
for (const _ of
|
|
6735
|
+
depsCount: T.length,
|
|
6736
|
+
deps: T.join(", ")
|
|
6737
|
+
}), E.allErrors ? d.if(g, () => {
|
|
6738
|
+
for (const _ of T)
|
|
7201
6739
|
(0, n.checkReportMissingProp)(p, _);
|
|
7202
|
-
}) : (
|
|
6740
|
+
}) : (d.if((0, t._)`${g} && (${(0, n.checkMissingProp)(p, T, R)})`), (0, n.reportMissingProp)(p, R), d.else());
|
|
7203
6741
|
}
|
|
7204
6742
|
}
|
|
7205
6743
|
e.validatePropertyDeps = a;
|
|
7206
|
-
function l(p,
|
|
7207
|
-
const { gen:
|
|
7208
|
-
for (const
|
|
7209
|
-
(0, r.alwaysValidSchema)(
|
|
7210
|
-
(0, n.propertyInData)(
|
|
6744
|
+
function l(p, u = p.schema) {
|
|
6745
|
+
const { gen: d, data: $, keyword: E, it: R } = p, v = d.name("valid");
|
|
6746
|
+
for (const T in u)
|
|
6747
|
+
(0, r.alwaysValidSchema)(R, u[T]) || (d.if(
|
|
6748
|
+
(0, n.propertyInData)(d, $, T, R.opts.ownProperties),
|
|
7211
6749
|
() => {
|
|
7212
|
-
const
|
|
7213
|
-
p.mergeValidEvaluated(
|
|
6750
|
+
const g = p.subschema({ keyword: E, schemaProp: T }, v);
|
|
6751
|
+
p.mergeValidEvaluated(g, v);
|
|
7214
6752
|
},
|
|
7215
|
-
() =>
|
|
6753
|
+
() => d.var(v, !0)
|
|
7216
6754
|
// TODO var
|
|
7217
6755
|
), p.ok(v));
|
|
7218
6756
|
}
|
|
@@ -7266,52 +6804,52 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
7266
6804
|
const { allErrors: l, opts: p } = a;
|
|
7267
6805
|
if (a.props = !0, p.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(a, r))
|
|
7268
6806
|
return;
|
|
7269
|
-
const
|
|
7270
|
-
|
|
7271
|
-
function
|
|
7272
|
-
t.forIn("key", s, (
|
|
7273
|
-
!
|
|
6807
|
+
const u = (0, code_1$3.allSchemaProperties)(n.properties), d = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6808
|
+
$(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6809
|
+
function $() {
|
|
6810
|
+
t.forIn("key", s, (g) => {
|
|
6811
|
+
!u.length && !d.length ? v(g) : t.if(E(g), () => v(g));
|
|
7274
6812
|
});
|
|
7275
6813
|
}
|
|
7276
|
-
function
|
|
6814
|
+
function E(g) {
|
|
7277
6815
|
let _;
|
|
7278
|
-
if (
|
|
6816
|
+
if (u.length > 8) {
|
|
7279
6817
|
const k = (0, util_1$8.schemaRefOrVal)(a, n.properties, "properties");
|
|
7280
|
-
_ = (0, code_1$3.isOwnProperty)(t, k,
|
|
6818
|
+
_ = (0, code_1$3.isOwnProperty)(t, k, g);
|
|
7281
6819
|
} else
|
|
7282
|
-
|
|
7283
|
-
return
|
|
6820
|
+
u.length ? _ = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${g} === ${k}`)) : _ = codegen_1$5.nil;
|
|
6821
|
+
return d.length && (_ = (0, codegen_1$5.or)(_, ...d.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${g})`))), (0, codegen_1$5.not)(_);
|
|
7284
6822
|
}
|
|
7285
|
-
function
|
|
7286
|
-
t.code((0, codegen_1$5._)`delete ${s}[${
|
|
6823
|
+
function R(g) {
|
|
6824
|
+
t.code((0, codegen_1$5._)`delete ${s}[${g}]`);
|
|
7287
6825
|
}
|
|
7288
|
-
function v(
|
|
6826
|
+
function v(g) {
|
|
7289
6827
|
if (p.removeAdditional === "all" || p.removeAdditional && r === !1) {
|
|
7290
|
-
|
|
6828
|
+
R(g);
|
|
7291
6829
|
return;
|
|
7292
6830
|
}
|
|
7293
6831
|
if (r === !1) {
|
|
7294
|
-
e.setParams({ additionalProperty:
|
|
6832
|
+
e.setParams({ additionalProperty: g }), e.error(), l || t.break();
|
|
7295
6833
|
return;
|
|
7296
6834
|
}
|
|
7297
6835
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(a, r)) {
|
|
7298
6836
|
const _ = t.name("valid");
|
|
7299
|
-
p.removeAdditional === "failing" ? (
|
|
7300
|
-
e.reset(),
|
|
7301
|
-
})) : (
|
|
6837
|
+
p.removeAdditional === "failing" ? (T(g, _, !1), t.if((0, codegen_1$5.not)(_), () => {
|
|
6838
|
+
e.reset(), R(g);
|
|
6839
|
+
})) : (T(g, _), l || t.if((0, codegen_1$5.not)(_), () => t.break()));
|
|
7302
6840
|
}
|
|
7303
6841
|
}
|
|
7304
|
-
function
|
|
7305
|
-
const
|
|
6842
|
+
function T(g, _, k) {
|
|
6843
|
+
const C = {
|
|
7306
6844
|
keyword: "additionalProperties",
|
|
7307
|
-
dataProp:
|
|
6845
|
+
dataProp: g,
|
|
7308
6846
|
dataPropType: util_1$8.Type.Str
|
|
7309
6847
|
};
|
|
7310
|
-
k === !1 && Object.assign(
|
|
6848
|
+
k === !1 && Object.assign(C, {
|
|
7311
6849
|
compositeRule: !0,
|
|
7312
6850
|
createErrors: !1,
|
|
7313
6851
|
allErrors: !1
|
|
7314
|
-
}), e.subschema(
|
|
6852
|
+
}), e.subschema(C, _);
|
|
7315
6853
|
}
|
|
7316
6854
|
}
|
|
7317
6855
|
};
|
|
@@ -7326,23 +6864,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
7326
6864
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
7327
6865
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
7328
6866
|
const a = (0, code_1$2.allSchemaProperties)(r);
|
|
7329
|
-
for (const
|
|
7330
|
-
i.definedProperties.add(
|
|
6867
|
+
for (const $ of a)
|
|
6868
|
+
i.definedProperties.add($);
|
|
7331
6869
|
i.opts.unevaluated && a.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(a), i.props));
|
|
7332
|
-
const l = a.filter((
|
|
6870
|
+
const l = a.filter(($) => !(0, util_1$7.alwaysValidSchema)(i, r[$]));
|
|
7333
6871
|
if (l.length === 0)
|
|
7334
6872
|
return;
|
|
7335
6873
|
const p = t.name("valid");
|
|
7336
|
-
for (const
|
|
7337
|
-
|
|
7338
|
-
function
|
|
7339
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6874
|
+
for (const $ of l)
|
|
6875
|
+
u($) ? d($) : (t.if((0, code_1$2.propertyInData)(t, s, $, i.opts.ownProperties)), d($), i.allErrors || t.else().var(p, !0), t.endIf()), e.it.definedProperties.add($), e.ok(p);
|
|
6876
|
+
function u($) {
|
|
6877
|
+
return i.opts.useDefaults && !i.compositeRule && r[$].default !== void 0;
|
|
7340
6878
|
}
|
|
7341
|
-
function
|
|
6879
|
+
function d($) {
|
|
7342
6880
|
e.subschema({
|
|
7343
6881
|
keyword: "properties",
|
|
7344
|
-
schemaProp:
|
|
7345
|
-
dataProp:
|
|
6882
|
+
schemaProp: $,
|
|
6883
|
+
dataProp: $
|
|
7346
6884
|
}, p);
|
|
7347
6885
|
}
|
|
7348
6886
|
}
|
|
@@ -7355,31 +6893,31 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
7355
6893
|
type: "object",
|
|
7356
6894
|
schemaType: "object",
|
|
7357
6895
|
code(e) {
|
|
7358
|
-
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: a } = i, l = (0, code_1$1.allSchemaProperties)(r), p = l.filter((
|
|
6896
|
+
const { gen: t, schema: r, data: n, parentSchema: s, it: i } = e, { opts: a } = i, l = (0, code_1$1.allSchemaProperties)(r), p = l.filter((T) => (0, util_1$6.alwaysValidSchema)(i, r[T]));
|
|
7359
6897
|
if (l.length === 0 || p.length === l.length && (!i.opts.unevaluated || i.props === !0))
|
|
7360
6898
|
return;
|
|
7361
|
-
const
|
|
6899
|
+
const u = a.strictSchema && !a.allowMatchingProperties && s.properties, d = t.name("valid");
|
|
7362
6900
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
7363
|
-
const { props:
|
|
7364
|
-
|
|
7365
|
-
function
|
|
7366
|
-
for (const
|
|
7367
|
-
|
|
7368
|
-
}
|
|
7369
|
-
function T
|
|
7370
|
-
for (const
|
|
7371
|
-
new RegExp(
|
|
7372
|
-
}
|
|
7373
|
-
function v(
|
|
7374
|
-
t.forIn("key", n, (
|
|
7375
|
-
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e,
|
|
7376
|
-
const _ = p.includes(
|
|
6901
|
+
const { props: $ } = i;
|
|
6902
|
+
E();
|
|
6903
|
+
function E() {
|
|
6904
|
+
for (const T of l)
|
|
6905
|
+
u && R(T), i.allErrors ? v(T) : (t.var(d, !0), v(T), t.if(d));
|
|
6906
|
+
}
|
|
6907
|
+
function R(T) {
|
|
6908
|
+
for (const g in u)
|
|
6909
|
+
new RegExp(T).test(g) && (0, util_1$6.checkStrictMode)(i, `property ${g} matches pattern ${T} (use allowMatchingProperties)`);
|
|
6910
|
+
}
|
|
6911
|
+
function v(T) {
|
|
6912
|
+
t.forIn("key", n, (g) => {
|
|
6913
|
+
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, T)}.test(${g})`, () => {
|
|
6914
|
+
const _ = p.includes(T);
|
|
7377
6915
|
_ || e.subschema({
|
|
7378
6916
|
keyword: "patternProperties",
|
|
7379
|
-
schemaProp:
|
|
7380
|
-
dataProp:
|
|
6917
|
+
schemaProp: T,
|
|
6918
|
+
dataProp: g,
|
|
7381
6919
|
dataPropType: util_2.Type.Str
|
|
7382
|
-
},
|
|
6920
|
+
}, d), i.opts.unevaluated && $ !== !0 ? t.assign((0, codegen_1$4._)`${$}[${g}]`, !0) : !_ && !i.allErrors && t.if((0, codegen_1$4.not)(d), () => t.break());
|
|
7383
6921
|
});
|
|
7384
6922
|
});
|
|
7385
6923
|
}
|
|
@@ -7436,16 +6974,16 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7436
6974
|
if (s.opts.discriminator && n.discriminator)
|
|
7437
6975
|
return;
|
|
7438
6976
|
const i = r, a = t.let("valid", !1), l = t.let("passing", null), p = t.name("_valid");
|
|
7439
|
-
e.setParams({ passing: l }), t.block(
|
|
7440
|
-
function
|
|
7441
|
-
i.forEach((
|
|
7442
|
-
let
|
|
7443
|
-
(0, util_1$4.alwaysValidSchema)(s,
|
|
6977
|
+
e.setParams({ passing: l }), t.block(u), e.result(a, () => e.reset(), () => e.error(!0));
|
|
6978
|
+
function u() {
|
|
6979
|
+
i.forEach((d, $) => {
|
|
6980
|
+
let E;
|
|
6981
|
+
(0, util_1$4.alwaysValidSchema)(s, d) ? t.var(p, !0) : E = e.subschema({
|
|
7444
6982
|
keyword: "oneOf",
|
|
7445
|
-
schemaProp:
|
|
6983
|
+
schemaProp: $,
|
|
7446
6984
|
compositeRule: !0
|
|
7447
|
-
}, p),
|
|
7448
|
-
t.assign(a, !0), t.assign(l,
|
|
6985
|
+
}, p), $ > 0 && t.if((0, codegen_1$3._)`${p} && ${a}`).assign(a, !1).assign(l, (0, codegen_1$3._)`[${l}, ${$}]`).else(), t.if(p, () => {
|
|
6986
|
+
t.assign(a, !0), t.assign(l, $), E && e.mergeEvaluated(E, codegen_1$3.Name);
|
|
7449
6987
|
});
|
|
7450
6988
|
});
|
|
7451
6989
|
}
|
|
@@ -7489,24 +7027,24 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7489
7027
|
return;
|
|
7490
7028
|
const a = t.let("valid", !0), l = t.name("_valid");
|
|
7491
7029
|
if (p(), e.reset(), s && i) {
|
|
7492
|
-
const
|
|
7493
|
-
e.setParams({ ifClause:
|
|
7030
|
+
const d = t.let("ifClause");
|
|
7031
|
+
e.setParams({ ifClause: d }), t.if(l, u("then", d), u("else", d));
|
|
7494
7032
|
} else
|
|
7495
|
-
s ? t.if(l,
|
|
7033
|
+
s ? t.if(l, u("then")) : t.if((0, codegen_1$2.not)(l), u("else"));
|
|
7496
7034
|
e.pass(a, () => e.error(!0));
|
|
7497
7035
|
function p() {
|
|
7498
|
-
const
|
|
7036
|
+
const d = e.subschema({
|
|
7499
7037
|
keyword: "if",
|
|
7500
7038
|
compositeRule: !0,
|
|
7501
7039
|
createErrors: !1,
|
|
7502
7040
|
allErrors: !1
|
|
7503
7041
|
}, l);
|
|
7504
|
-
e.mergeEvaluated(
|
|
7042
|
+
e.mergeEvaluated(d);
|
|
7505
7043
|
}
|
|
7506
|
-
function d
|
|
7044
|
+
function u(d, $) {
|
|
7507
7045
|
return () => {
|
|
7508
|
-
const
|
|
7509
|
-
t.assign(a, l), e.mergeValidEvaluated(
|
|
7046
|
+
const E = e.subschema({ keyword: d }, l);
|
|
7047
|
+
t.assign(a, l), e.mergeValidEvaluated(E, a), $ ? t.assign($, (0, codegen_1$2._)`${d}`) : e.setParams({ ifClause: d });
|
|
7510
7048
|
};
|
|
7511
7049
|
}
|
|
7512
7050
|
}
|
|
@@ -7559,55 +7097,55 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7559
7097
|
$data: !0,
|
|
7560
7098
|
error: error$1,
|
|
7561
7099
|
code(e, t) {
|
|
7562
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: a, it: l } = e, { opts: p, errSchemaPath:
|
|
7100
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: a, it: l } = e, { opts: p, errSchemaPath: u, schemaEnv: d, self: $ } = l;
|
|
7563
7101
|
if (!p.validateFormats)
|
|
7564
7102
|
return;
|
|
7565
|
-
s ?
|
|
7566
|
-
function
|
|
7103
|
+
s ? E() : R();
|
|
7104
|
+
function E() {
|
|
7567
7105
|
const v = r.scopeValue("formats", {
|
|
7568
|
-
ref:
|
|
7106
|
+
ref: $.formats,
|
|
7569
7107
|
code: p.code.formats
|
|
7570
|
-
}),
|
|
7571
|
-
r.if((0, codegen_1$1._)`typeof ${
|
|
7108
|
+
}), T = r.const("fDef", (0, codegen_1$1._)`${v}[${a}]`), g = r.let("fType"), _ = r.let("format");
|
|
7109
|
+
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign(g, (0, codegen_1$1._)`${T}.type || "string"`).assign(_, (0, codegen_1$1._)`${T}.validate`), () => r.assign(g, (0, codegen_1$1._)`"string"`).assign(_, T)), e.fail$data((0, codegen_1$1.or)(k(), C()));
|
|
7572
7110
|
function k() {
|
|
7573
7111
|
return p.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${a} && !${_}`;
|
|
7574
7112
|
}
|
|
7575
|
-
function
|
|
7576
|
-
const I =
|
|
7577
|
-
return (0, codegen_1$1._)`${_} && ${_} !== true && ${
|
|
7113
|
+
function C() {
|
|
7114
|
+
const I = d.$async ? (0, codegen_1$1._)`(${T}.async ? await ${_}(${n}) : ${_}(${n}))` : (0, codegen_1$1._)`${_}(${n})`, A = (0, codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;
|
|
7115
|
+
return (0, codegen_1$1._)`${_} && ${_} !== true && ${g} === ${t} && !${A}`;
|
|
7578
7116
|
}
|
|
7579
7117
|
}
|
|
7580
|
-
function
|
|
7581
|
-
const v =
|
|
7118
|
+
function R() {
|
|
7119
|
+
const v = $.formats[i];
|
|
7582
7120
|
if (!v) {
|
|
7583
7121
|
k();
|
|
7584
7122
|
return;
|
|
7585
7123
|
}
|
|
7586
7124
|
if (v === !0)
|
|
7587
7125
|
return;
|
|
7588
|
-
const [
|
|
7589
|
-
|
|
7126
|
+
const [T, g, _] = C(v);
|
|
7127
|
+
T === t && e.pass(I());
|
|
7590
7128
|
function k() {
|
|
7591
7129
|
if (p.strictSchema === !1) {
|
|
7592
|
-
|
|
7130
|
+
$.logger.warn(A());
|
|
7593
7131
|
return;
|
|
7594
7132
|
}
|
|
7595
7133
|
throw new Error(A());
|
|
7596
7134
|
function A() {
|
|
7597
|
-
return `unknown format "${i}" ignored in schema at path "${
|
|
7135
|
+
return `unknown format "${i}" ignored in schema at path "${u}"`;
|
|
7598
7136
|
}
|
|
7599
7137
|
}
|
|
7600
|
-
function
|
|
7601
|
-
const w = A instanceof RegExp ? (0, codegen_1$1.regexpCode)(A) : p.code.formats ? (0, codegen_1$1._)`${p.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0,
|
|
7602
|
-
return typeof A == "object" && !(A instanceof RegExp) ? [A.type || "string", A.validate, (0, codegen_1$1._)`${
|
|
7138
|
+
function C(A) {
|
|
7139
|
+
const w = A instanceof RegExp ? (0, codegen_1$1.regexpCode)(A) : p.code.formats ? (0, codegen_1$1._)`${p.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, O = r.scopeValue("formats", { key: i, ref: A, code: w });
|
|
7140
|
+
return typeof A == "object" && !(A instanceof RegExp) ? [A.type || "string", A.validate, (0, codegen_1$1._)`${O}.validate`] : ["string", A, O];
|
|
7603
7141
|
}
|
|
7604
7142
|
function I() {
|
|
7605
7143
|
if (typeof v == "object" && !(v instanceof RegExp) && v.async) {
|
|
7606
|
-
if (!
|
|
7144
|
+
if (!d.$async)
|
|
7607
7145
|
throw new Error("async format in sync schema");
|
|
7608
7146
|
return (0, codegen_1$1._)`await ${_}(${n})`;
|
|
7609
7147
|
}
|
|
7610
|
-
return typeof
|
|
7148
|
+
return typeof g == "function" ? (0, codegen_1$1._)`${_}(${n})` : (0, codegen_1$1._)`${_}.test(${n})`;
|
|
7611
7149
|
}
|
|
7612
7150
|
}
|
|
7613
7151
|
}
|
|
@@ -7669,32 +7207,32 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7669
7207
|
throw new Error("discriminator: mapping is not supported");
|
|
7670
7208
|
if (!a)
|
|
7671
7209
|
throw new Error("discriminator: requires oneOf keyword");
|
|
7672
|
-
const p = t.let("valid", !1),
|
|
7673
|
-
t.if((0, codegen_1._)`typeof ${
|
|
7674
|
-
function
|
|
7675
|
-
const
|
|
7210
|
+
const p = t.let("valid", !1), u = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(l)}`);
|
|
7211
|
+
t.if((0, codegen_1._)`typeof ${u} == "string"`, () => d(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: u, tagName: l })), e.ok(p);
|
|
7212
|
+
function d() {
|
|
7213
|
+
const R = E();
|
|
7676
7214
|
t.if(!1);
|
|
7677
|
-
for (const v in
|
|
7678
|
-
t.elseIf((0, codegen_1._)`${
|
|
7679
|
-
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag:
|
|
7680
|
-
}
|
|
7681
|
-
function
|
|
7682
|
-
const v = t.name("valid"),
|
|
7683
|
-
return e.mergeEvaluated(
|
|
7684
|
-
}
|
|
7685
|
-
function
|
|
7686
|
-
var
|
|
7687
|
-
const v = {},
|
|
7688
|
-
let
|
|
7215
|
+
for (const v in R)
|
|
7216
|
+
t.elseIf((0, codegen_1._)`${u} === ${v}`), t.assign(p, $(R[v]));
|
|
7217
|
+
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7218
|
+
}
|
|
7219
|
+
function $(R) {
|
|
7220
|
+
const v = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: R }, v);
|
|
7221
|
+
return e.mergeEvaluated(T, codegen_1.Name), v;
|
|
7222
|
+
}
|
|
7223
|
+
function E() {
|
|
7224
|
+
var R;
|
|
7225
|
+
const v = {}, T = _(s);
|
|
7226
|
+
let g = !0;
|
|
7689
7227
|
for (let I = 0; I < a.length; I++) {
|
|
7690
7228
|
let A = a[I];
|
|
7691
7229
|
A != null && A.$ref && !(0, util_1.schemaHasRulesButRef)(A, i.self.RULES) && (A = compile_1.resolveRef.call(i.self, i.schemaEnv.root, i.baseId, A == null ? void 0 : A.$ref), A instanceof compile_1.SchemaEnv && (A = A.schema));
|
|
7692
|
-
const w = (
|
|
7230
|
+
const w = (R = A == null ? void 0 : A.properties) === null || R === void 0 ? void 0 : R[l];
|
|
7693
7231
|
if (typeof w != "object")
|
|
7694
7232
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7695
|
-
|
|
7233
|
+
g = g && (T || _(A)), k(w, I);
|
|
7696
7234
|
}
|
|
7697
|
-
if (
|
|
7235
|
+
if (!g)
|
|
7698
7236
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7699
7237
|
return v;
|
|
7700
7238
|
function _({ required: I }) {
|
|
@@ -7702,14 +7240,14 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7702
7240
|
}
|
|
7703
7241
|
function k(I, A) {
|
|
7704
7242
|
if (I.const)
|
|
7705
|
-
|
|
7243
|
+
C(I.const, A);
|
|
7706
7244
|
else if (I.enum)
|
|
7707
7245
|
for (const w of I.enum)
|
|
7708
|
-
|
|
7246
|
+
C(w, A);
|
|
7709
7247
|
else
|
|
7710
7248
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7711
7249
|
}
|
|
7712
|
-
function
|
|
7250
|
+
function C(I, A) {
|
|
7713
7251
|
if (typeof I != "string" || I in v)
|
|
7714
7252
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7715
7253
|
v[I] = A;
|
|
@@ -7977,31 +7515,31 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7977
7515
|
}
|
|
7978
7516
|
}
|
|
7979
7517
|
e.exports = t = p, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = p;
|
|
7980
|
-
var
|
|
7518
|
+
var u = validate;
|
|
7981
7519
|
Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() {
|
|
7982
|
-
return
|
|
7520
|
+
return u.KeywordCxt;
|
|
7983
7521
|
} });
|
|
7984
|
-
var
|
|
7522
|
+
var d = codegen;
|
|
7985
7523
|
Object.defineProperty(t, "_", { enumerable: !0, get: function() {
|
|
7986
|
-
return
|
|
7524
|
+
return d._;
|
|
7987
7525
|
} }), Object.defineProperty(t, "str", { enumerable: !0, get: function() {
|
|
7988
|
-
return
|
|
7526
|
+
return d.str;
|
|
7989
7527
|
} }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() {
|
|
7990
|
-
return
|
|
7528
|
+
return d.stringify;
|
|
7991
7529
|
} }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() {
|
|
7992
|
-
return
|
|
7530
|
+
return d.nil;
|
|
7993
7531
|
} }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() {
|
|
7994
|
-
return
|
|
7532
|
+
return d.Name;
|
|
7995
7533
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7996
|
-
return
|
|
7534
|
+
return d.CodeGen;
|
|
7997
7535
|
} });
|
|
7998
|
-
var
|
|
7536
|
+
var $ = validation_error;
|
|
7999
7537
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
8000
|
-
return
|
|
7538
|
+
return $.default;
|
|
8001
7539
|
} });
|
|
8002
|
-
var
|
|
7540
|
+
var E = ref_error;
|
|
8003
7541
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
8004
|
-
return
|
|
7542
|
+
return E.default;
|
|
8005
7543
|
} });
|
|
8006
7544
|
})(ajv$1, ajv$1.exports);
|
|
8007
7545
|
var ajvExports = ajv$1.exports;
|
|
@@ -8409,55 +7947,6 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
8409
7947
|
"themeFolderName"
|
|
8410
7948
|
]
|
|
8411
7949
|
},
|
|
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
7950
|
{
|
|
8462
7951
|
type: "object",
|
|
8463
7952
|
additionalProperties: !1,
|
|
@@ -9489,7 +8978,7 @@ function compileBlueprint(e, {
|
|
|
9489
8978
|
onStepCompleted: n = () => {
|
|
9490
8979
|
}
|
|
9491
8980
|
} = {}) {
|
|
9492
|
-
var
|
|
8981
|
+
var u, d, $;
|
|
9493
8982
|
if (e = {
|
|
9494
8983
|
...e,
|
|
9495
8984
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9500,17 +8989,17 @@ function compileBlueprint(e, {
|
|
|
9500
8989
|
step: "setSiteOptions",
|
|
9501
8990
|
options: e.siteOptions
|
|
9502
8991
|
}), e.plugins) {
|
|
9503
|
-
const
|
|
8992
|
+
const E = e.plugins.map((R) => typeof R == "string" ? R.startsWith("https://") ? {
|
|
9504
8993
|
resource: "url",
|
|
9505
|
-
url:
|
|
8994
|
+
url: R
|
|
9506
8995
|
} : {
|
|
9507
8996
|
resource: "wordpress.org/plugins",
|
|
9508
|
-
slug:
|
|
9509
|
-
} :
|
|
8997
|
+
slug: R
|
|
8998
|
+
} : R).map((R) => ({
|
|
9510
8999
|
step: "installPlugin",
|
|
9511
|
-
pluginZipFile:
|
|
9000
|
+
pluginZipFile: R
|
|
9512
9001
|
}));
|
|
9513
|
-
e.steps.unshift(...
|
|
9002
|
+
e.steps.unshift(...E);
|
|
9514
9003
|
}
|
|
9515
9004
|
e.login && e.steps.push({
|
|
9516
9005
|
step: "login",
|
|
@@ -9518,19 +9007,19 @@ function compileBlueprint(e, {
|
|
|
9518
9007
|
});
|
|
9519
9008
|
const { valid: s, errors: i } = validateBlueprint(e);
|
|
9520
9009
|
if (!s) {
|
|
9521
|
-
const
|
|
9010
|
+
const E = new Error(
|
|
9522
9011
|
`Invalid blueprint: ${i[0].message} at ${i[0].instancePath}`
|
|
9523
9012
|
);
|
|
9524
|
-
throw
|
|
9013
|
+
throw E.errors = i, E;
|
|
9525
9014
|
}
|
|
9526
9015
|
const a = e.steps || [], l = a.reduce(
|
|
9527
|
-
(
|
|
9016
|
+
(E, R) => {
|
|
9528
9017
|
var v;
|
|
9529
|
-
return
|
|
9018
|
+
return E + (((v = R.progress) == null ? void 0 : v.weight) || 1);
|
|
9530
9019
|
},
|
|
9531
9020
|
0
|
|
9532
9021
|
), p = a.map(
|
|
9533
|
-
(
|
|
9022
|
+
(E) => compileStep(E, {
|
|
9534
9023
|
semaphore: r,
|
|
9535
9024
|
rootProgressTracker: t,
|
|
9536
9025
|
totalProgressWeight: l
|
|
@@ -9539,11 +9028,11 @@ function compileBlueprint(e, {
|
|
|
9539
9028
|
return {
|
|
9540
9029
|
versions: {
|
|
9541
9030
|
php: compileVersion(
|
|
9542
|
-
(
|
|
9031
|
+
(u = e.preferredVersions) == null ? void 0 : u.php,
|
|
9543
9032
|
SupportedPHPVersions,
|
|
9544
9033
|
LatestSupportedPHPVersion
|
|
9545
9034
|
),
|
|
9546
|
-
wp: ((
|
|
9035
|
+
wp: ((d = e.preferredVersions) == null ? void 0 : d.wp) || "latest"
|
|
9547
9036
|
},
|
|
9548
9037
|
phpExtensions: compilePHPExtensions(
|
|
9549
9038
|
[],
|
|
@@ -9551,30 +9040,30 @@ function compileBlueprint(e, {
|
|
|
9551
9040
|
),
|
|
9552
9041
|
features: {
|
|
9553
9042
|
// Disable networking by default
|
|
9554
|
-
networking: ((
|
|
9043
|
+
networking: (($ = e.features) == null ? void 0 : $.networking) ?? !1
|
|
9555
9044
|
},
|
|
9556
|
-
run: async (
|
|
9045
|
+
run: async (E) => {
|
|
9557
9046
|
try {
|
|
9558
|
-
for (const { resources:
|
|
9559
|
-
for (const v of
|
|
9560
|
-
v.setPlayground(
|
|
9561
|
-
for (const [
|
|
9047
|
+
for (const { resources: R } of p)
|
|
9048
|
+
for (const v of R)
|
|
9049
|
+
v.setPlayground(E), v.isAsync && v.resolve();
|
|
9050
|
+
for (const [R, { run: v, step: T }] of Object.entries(p))
|
|
9562
9051
|
try {
|
|
9563
|
-
const
|
|
9564
|
-
n(
|
|
9565
|
-
} catch (
|
|
9052
|
+
const g = await v(E);
|
|
9053
|
+
n(g, T);
|
|
9054
|
+
} catch (g) {
|
|
9566
9055
|
throw new Error(
|
|
9567
|
-
`Error when executing the blueprint step #${
|
|
9568
|
-
|
|
9056
|
+
`Error when executing the blueprint step #${R} (${JSON.stringify(
|
|
9057
|
+
T
|
|
9569
9058
|
)}). Inspect the cause of this error for more details`,
|
|
9570
9059
|
{
|
|
9571
|
-
cause:
|
|
9060
|
+
cause: g
|
|
9572
9061
|
}
|
|
9573
9062
|
);
|
|
9574
9063
|
}
|
|
9575
9064
|
} finally {
|
|
9576
9065
|
try {
|
|
9577
|
-
await
|
|
9066
|
+
await E.goTo(
|
|
9578
9067
|
e.landingPage || "/"
|
|
9579
9068
|
);
|
|
9580
9069
|
} catch {
|
|
@@ -9622,35 +9111,35 @@ function compileStep(e, {
|
|
|
9622
9111
|
rootProgressTracker: r,
|
|
9623
9112
|
totalProgressWeight: n
|
|
9624
9113
|
}) {
|
|
9625
|
-
var
|
|
9114
|
+
var d;
|
|
9626
9115
|
const s = r.stage(
|
|
9627
|
-
(((
|
|
9116
|
+
(((d = e.progress) == null ? void 0 : d.weight) || 1) / n
|
|
9628
9117
|
), i = {};
|
|
9629
|
-
for (const
|
|
9630
|
-
let
|
|
9631
|
-
isFileReference(
|
|
9118
|
+
for (const $ of Object.keys(e)) {
|
|
9119
|
+
let E = e[$];
|
|
9120
|
+
isFileReference(E) && (E = Resource.create(E, {
|
|
9632
9121
|
semaphore: t
|
|
9633
|
-
})), i[
|
|
9122
|
+
})), i[$] = E;
|
|
9634
9123
|
}
|
|
9635
|
-
const a = async (
|
|
9636
|
-
var
|
|
9124
|
+
const a = async ($) => {
|
|
9125
|
+
var E;
|
|
9637
9126
|
try {
|
|
9638
9127
|
return s.fillSlowly(), await stepHandlers[e.step](
|
|
9639
|
-
|
|
9128
|
+
$,
|
|
9640
9129
|
await resolveArguments(i),
|
|
9641
9130
|
{
|
|
9642
9131
|
tracker: s,
|
|
9643
|
-
initialCaption: (
|
|
9132
|
+
initialCaption: (E = e.progress) == null ? void 0 : E.caption
|
|
9644
9133
|
}
|
|
9645
9134
|
);
|
|
9646
9135
|
} finally {
|
|
9647
9136
|
s.finish();
|
|
9648
9137
|
}
|
|
9649
9138
|
}, l = getResources(i), p = getResources(i).filter(
|
|
9650
|
-
(
|
|
9651
|
-
),
|
|
9652
|
-
for (const
|
|
9653
|
-
|
|
9139
|
+
($) => $.isAsync
|
|
9140
|
+
), u = 1 / (p.length + 1);
|
|
9141
|
+
for (const $ of p)
|
|
9142
|
+
$.progress = s.stage(u);
|
|
9654
9143
|
return { run: a, step: e, resources: l };
|
|
9655
9144
|
}
|
|
9656
9145
|
function getResources(e) {
|
|
@@ -9677,7 +9166,6 @@ function setPluginProxyURL() {
|
|
|
9677
9166
|
export {
|
|
9678
9167
|
activatePlugin,
|
|
9679
9168
|
activateTheme,
|
|
9680
|
-
applyWordPressPatches,
|
|
9681
9169
|
compileBlueprint,
|
|
9682
9170
|
cp,
|
|
9683
9171
|
defineSiteUrl,
|