@wp-playground/blueprints 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blueprint-schema.json +0 -47
- package/index.cjs +43 -387
- package/index.d.ts +3 -18
- package/index.js +1134 -1639
- 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
|
@@ -202,6 +202,16 @@ class ChildProcess extends EventEmitter {
|
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
+
function randomString(e = 36, t = "!@#$%^&*()_+=-[]/.,<>?") {
|
|
206
|
+
const r = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + t;
|
|
207
|
+
let n = "";
|
|
208
|
+
for (let s = e; s > 0; --s)
|
|
209
|
+
n += r[Math.floor(Math.random() * r.length)];
|
|
210
|
+
return n;
|
|
211
|
+
}
|
|
212
|
+
function randomFilename() {
|
|
213
|
+
return randomString(36, "-_");
|
|
214
|
+
}
|
|
205
215
|
function phpVar(e) {
|
|
206
216
|
return `json_decode(base64_decode('${stringToBase64(
|
|
207
217
|
JSON.stringify(e)
|
|
@@ -267,6 +277,47 @@ set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
|
267
277
|
switch_theme( ${phpVar(t)} );
|
|
268
278
|
`
|
|
269
279
|
});
|
|
280
|
+
}, runPHP = async (e, { code: t }) => await e.run({ code: t, throwOnError: !0 }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
281
|
+
await e.unlink(t);
|
|
282
|
+
}, runSql = async (e, { sql: t }, r) => {
|
|
283
|
+
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
284
|
+
const n = `/tmp/${randomFilename()}.sql`;
|
|
285
|
+
await e.writeFile(
|
|
286
|
+
n,
|
|
287
|
+
new Uint8Array(await t.arrayBuffer())
|
|
288
|
+
);
|
|
289
|
+
const s = await e.documentRoot, i = phpVars({ docroot: s, sqlFilename: n }), a = await e.run({
|
|
290
|
+
code: `<?php
|
|
291
|
+
require_once ${i.docroot} . '/wp-load.php';
|
|
292
|
+
|
|
293
|
+
$handle = fopen(${i.sqlFilename}, 'r');
|
|
294
|
+
$buffer = '';
|
|
295
|
+
|
|
296
|
+
global $wpdb;
|
|
297
|
+
|
|
298
|
+
while ($bytes = fgets($handle)) {
|
|
299
|
+
$buffer .= $bytes;
|
|
300
|
+
|
|
301
|
+
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
302
|
+
") {
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
$wpdb->query($buffer);
|
|
307
|
+
$buffer = '';
|
|
308
|
+
}
|
|
309
|
+
`
|
|
310
|
+
});
|
|
311
|
+
return await rm(e, { path: n }), a;
|
|
312
|
+
}, setPhpIniEntry = async (e, { key: t, value: r }) => {
|
|
313
|
+
await e.setPhpIniEntry(t, r);
|
|
314
|
+
}, request = async (e, { request: t }) => {
|
|
315
|
+
const r = await e.request(t);
|
|
316
|
+
if (r.httpStatusCode > 399 || r.httpStatusCode < 200)
|
|
317
|
+
throw console.warn("WordPress response was", { response: r }), new Error(
|
|
318
|
+
`Request failed with status ${r.httpStatusCode}`
|
|
319
|
+
);
|
|
320
|
+
return r;
|
|
270
321
|
}, rewriteWpConfigToDefineConstants = `<?php
|
|
271
322
|
|
|
272
323
|
/**
|
|
@@ -635,522 +686,7 @@ async function rewriteDefineCalls(e, t, r) {
|
|
|
635
686
|
`
|
|
636
687
|
}), await e.readFileAsText("/tmp/code.php");
|
|
637
688
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* This transport delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
642
|
-
*
|
|
643
|
-
* This file isn't actually used. It's just here for reference and development. The actual
|
|
644
|
-
* PHP code used in WordPress is hardcoded copy residing in wordpress.mjs in the _patchWordPressCode
|
|
645
|
-
* function.
|
|
646
|
-
*
|
|
647
|
-
* The reason for calling it Wp_Http_Fetch and not something more natural like
|
|
648
|
-
* Requests_Transport_Fetch is the _get_first_available_transport(). It checks for
|
|
649
|
-
* a class named "Wp_Http_" . $transport_name – which means we must adhere to this
|
|
650
|
-
* hardcoded pattern.
|
|
651
|
-
*/
|
|
652
|
-
class Wp_Http_Fetch_Base
|
|
653
|
-
{
|
|
654
|
-
public $headers = '';
|
|
655
|
-
|
|
656
|
-
public function __construct()
|
|
657
|
-
{
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
public function __destruct()
|
|
661
|
-
{
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
666
|
-
*
|
|
667
|
-
* @TODO Implement handling for more $options such as cookies, filename, auth, etc.
|
|
668
|
-
*
|
|
669
|
-
* @param $url
|
|
670
|
-
* @param $headers
|
|
671
|
-
* @param $data
|
|
672
|
-
* @param $options
|
|
673
|
-
*
|
|
674
|
-
* @return false|string
|
|
675
|
-
*/
|
|
676
|
-
public function request($url, $headers = array(), $data = array(), $options = array())
|
|
677
|
-
{
|
|
678
|
-
// Disable wp-cron requests that are extremely slow in node.js runtime environment.
|
|
679
|
-
// @TODO: Make wp-cron requests faster.
|
|
680
|
-
if (str_contains($url, '/wp-cron.php')) {
|
|
681
|
-
return false;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
if (!empty($data)) {
|
|
685
|
-
$data_format = $options['data_format'];
|
|
686
|
-
if ($data_format === 'query') {
|
|
687
|
-
$url = self::format_get($url, $data);
|
|
688
|
-
$data = '';
|
|
689
|
-
} elseif (!is_string($data)) {
|
|
690
|
-
$data = http_build_query($data, null, '&');
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
$request = json_encode(
|
|
695
|
-
array(
|
|
696
|
-
'type' => 'request',
|
|
697
|
-
'data' => [
|
|
698
|
-
'headers' => $headers,
|
|
699
|
-
'data' => $data,
|
|
700
|
-
'url' => $url,
|
|
701
|
-
'method' => $options['type'],
|
|
702
|
-
]
|
|
703
|
-
)
|
|
704
|
-
);
|
|
705
|
-
|
|
706
|
-
$this->headers = post_message_to_js($request);
|
|
707
|
-
|
|
708
|
-
// Store a file if the request specifies it.
|
|
709
|
-
// Are we sure that \`$this->headers\` includes the body of the response?
|
|
710
|
-
$before_response_body = strpos($this->headers, "\\r\\n\\r\\n");
|
|
711
|
-
if (isset($options['filename']) && $options['filename'] && false !== $before_response_body) {
|
|
712
|
-
$response_body = substr($this->headers, $before_response_body + 4);
|
|
713
|
-
$this->headers = substr($this->headers, 0, $before_response_body);
|
|
714
|
-
file_put_contents($options['filename'], $response_body);
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
return $this->headers;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
public function request_multiple($requests, $options)
|
|
721
|
-
{
|
|
722
|
-
$responses = array();
|
|
723
|
-
$class = get_class($this);
|
|
724
|
-
foreach ($requests as $id => $request) {
|
|
725
|
-
try {
|
|
726
|
-
$handler = new $class();
|
|
727
|
-
$responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']);
|
|
728
|
-
$request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request));
|
|
729
|
-
} catch (Requests_Exception $e) {
|
|
730
|
-
$responses[$id] = $e;
|
|
731
|
-
}
|
|
732
|
-
if (!is_string($responses[$id])) {
|
|
733
|
-
$request['options']['hooks']->dispatch('multiple.request.complete', array(&$responses[$id], $id));
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
return $responses;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
protected static function format_get($url, $data)
|
|
741
|
-
{
|
|
742
|
-
if (!empty($data)) {
|
|
743
|
-
$query = '';
|
|
744
|
-
$url_parts = parse_url($url);
|
|
745
|
-
if (empty($url_parts['query'])) {
|
|
746
|
-
$url_parts['query'] = '';
|
|
747
|
-
} else {
|
|
748
|
-
$query = $url_parts['query'];
|
|
749
|
-
}
|
|
750
|
-
$query .= '&' . http_build_query($data, null, '&');
|
|
751
|
-
$query = trim($query, '&');
|
|
752
|
-
if (empty($url_parts['query'])) {
|
|
753
|
-
$url .= '?' . $query;
|
|
754
|
-
} else {
|
|
755
|
-
$url = str_replace($url_parts['query'], $query, $url);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
return $url;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
public static function test($capabilities = array())
|
|
763
|
-
{
|
|
764
|
-
if (!function_exists('post_message_to_js')) {
|
|
765
|
-
return false;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
return true;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
773
|
-
class Wp_Http_Fetch extends Wp_Http_Fetch_Base implements \\WpOrg\\Requests\\Transport
|
|
774
|
-
{
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
} else {
|
|
778
|
-
class Wp_Http_Fetch extends Wp_Http_Fetch_Base implements Requests_Transport
|
|
779
|
-
{
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
`, transportDummy = `<?php
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
* This transport does not perform any HTTP requests and only exists
|
|
787
|
-
* to prevent the Requests class from complaining about not having any
|
|
788
|
-
* transports.
|
|
789
|
-
*/
|
|
790
|
-
class Requests_Transport_Dummy_Base
|
|
791
|
-
{
|
|
792
|
-
public $headers = '';
|
|
793
|
-
|
|
794
|
-
public function __construct()
|
|
795
|
-
{
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
public function __destruct()
|
|
799
|
-
{
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
public function request($url, $headers = array(), $data = array(), $options = array())
|
|
803
|
-
{
|
|
804
|
-
return false;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
public function request_multiple($requests, $options)
|
|
808
|
-
{
|
|
809
|
-
$responses = array();
|
|
810
|
-
foreach ($requests as $id => $request) {
|
|
811
|
-
$responses[] = false;
|
|
812
|
-
}
|
|
813
|
-
return $responses;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
protected static function format_get($url, $data)
|
|
817
|
-
{
|
|
818
|
-
return $url;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
public static function test($capabilities = array())
|
|
822
|
-
{
|
|
823
|
-
return true;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
828
|
-
class Requests_Transport_Dummy extends Requests_Transport_Dummy_Base implements \\WpOrg\\Requests\\Transport
|
|
829
|
-
{
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
} else {
|
|
833
|
-
class Requests_Transport_Dummy extends Requests_Transport_Dummy_Base implements Requests_Transport
|
|
834
|
-
{
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
`, playgroundMuPlugin = `<?php
|
|
839
|
-
/**
|
|
840
|
-
* Add a notice to wp-login.php offering the username and password.
|
|
841
|
-
*/
|
|
842
|
-
add_action(
|
|
843
|
-
'login_message',
|
|
844
|
-
function () {
|
|
845
|
-
return <<<EOT
|
|
846
|
-
<div class="message info">
|
|
847
|
-
<strong>username:</strong> <code>admin</code><br><strong>password</strong>: <code>password</code>
|
|
848
|
-
</div>
|
|
849
|
-
EOT;
|
|
850
|
-
}
|
|
851
|
-
);
|
|
852
|
-
|
|
853
|
-
/**
|
|
854
|
-
* Because the in-browser Playground doesn't have access to the internet,
|
|
855
|
-
* network-dependent features like directories don't work. Normally, you'll
|
|
856
|
-
* see a confusing message like "An unexpected error occurred." This mu-plugin
|
|
857
|
-
* makes it more clear that the feature is not yet supported.
|
|
858
|
-
*
|
|
859
|
-
* https://github.com/WordPress/wordpress-playground/issues/498
|
|
860
|
-
*
|
|
861
|
-
* Added styling to hide the Popular tags section of the Plugins page
|
|
862
|
-
* and the nonfunctional Try Again button (both Plugins and Themes) that's
|
|
863
|
-
* appended when the message is displayed.
|
|
864
|
-
*
|
|
865
|
-
* https://github.com/WordPress/wordpress-playground/issues/927
|
|
866
|
-
*
|
|
867
|
-
*/
|
|
868
|
-
|
|
869
|
-
add_action('admin_head', function () {
|
|
870
|
-
echo '<style>
|
|
871
|
-
:is(.plugins-popular-tags-wrapper:has(div.networking_err_msg),
|
|
872
|
-
button.button.try-again) {
|
|
873
|
-
display: none;
|
|
874
|
-
}
|
|
875
|
-
</style>';
|
|
876
|
-
});
|
|
877
|
-
|
|
878
|
-
add_action('init', 'networking_disabled');
|
|
879
|
-
function networking_disabled() {
|
|
880
|
-
$networking_err_msg = '<div class="networking_err_msg">Network access is an <a href="https://github.com/WordPress/wordpress-playground/issues/85">experimental, opt-in feature</a>, which means you need to enable it to allow Playground to access the Plugins/Themes directories.
|
|
881
|
-
<p>There are two alternative methods to enable global networking support:</p>
|
|
882
|
-
<ol>
|
|
883
|
-
<li>Using the <a href="https://wordpress.github.io/wordpress-playground/query-api">Query API</a>: for example, https://playground.wordpress.net/<em>?networking=yes</em>; <strong>or</strong>
|
|
884
|
-
<li> Using the <a href="https://wordpress.github.io/wordpress-playground/blueprints-api/data-format/#features">Blueprint API</a>: add <code>"features": { "networking": true }</code> to the JSON file.
|
|
885
|
-
</li></ol>
|
|
886
|
-
<p>
|
|
887
|
-
When browsing Playground as a standalone instance, you can enable networking via the settings panel: select the option "Network access (e.g. for browsing plugins)" and hit the "Apply changes" button.<p>
|
|
888
|
-
<strong>Please note:</strong> This option is hidden when browsing Playground as an embedded iframe.</p></div>';
|
|
889
|
-
return $networking_err_msg;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
add_filter('plugins_api_result', function ($res) {
|
|
893
|
-
if ($res instanceof WP_Error) {
|
|
894
|
-
$res = new WP_Error(
|
|
895
|
-
'plugins_api_failed',
|
|
896
|
-
networking_disabled()
|
|
897
|
-
);
|
|
898
|
-
}
|
|
899
|
-
return $res;
|
|
900
|
-
});
|
|
901
|
-
|
|
902
|
-
add_filter('gettext', function ($translation) {
|
|
903
|
-
if( $GLOBALS['pagenow'] === 'theme-install.php') {
|
|
904
|
-
if ($translation === 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.') {
|
|
905
|
-
return networking_disabled();
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return $translation;
|
|
909
|
-
});
|
|
910
|
-
|
|
911
|
-
/**
|
|
912
|
-
* Links with target="top" don't work in the playground iframe because of
|
|
913
|
-
* the sandbox attribute. What they really should be targeting is the
|
|
914
|
-
* playground iframe itself (name="playground"). This mu-plugin rewrites
|
|
915
|
-
* all target="_top" links to target="playground" instead.
|
|
916
|
-
*
|
|
917
|
-
* https://github.com/WordPress/wordpress-playground/issues/266
|
|
918
|
-
*/
|
|
919
|
-
add_action('admin_print_scripts', function () {
|
|
920
|
-
?>
|
|
921
|
-
<script>
|
|
922
|
-
document.addEventListener('click', function (event) {
|
|
923
|
-
if (event.target.tagName === 'A' && ['_parent', '_top'].includes(event.target.target)) {
|
|
924
|
-
event.target.target = 'wordpress-playground';
|
|
925
|
-
}
|
|
926
|
-
});
|
|
927
|
-
<\/script>
|
|
928
|
-
<?php
|
|
929
|
-
});
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
* Supports URL rewriting to remove \`index.php\` from permalinks.
|
|
933
|
-
*/
|
|
934
|
-
add_filter('got_url_rewrite', '__return_true');
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* The default WordPress requests transports have been disabled
|
|
938
|
-
* at this point. However, the Requests class requires at least
|
|
939
|
-
* one working transport or else it throws warnings and acts up.
|
|
940
|
-
*
|
|
941
|
-
* This mu-plugin provides that transport. It's one of the two:
|
|
942
|
-
*
|
|
943
|
-
* * WP_Http_Fetch – Sends requests using browser's fetch() function.
|
|
944
|
-
* Only enabled when PHP was compiled with the VRZNO
|
|
945
|
-
* extension.
|
|
946
|
-
* * Requests_Transport_Dummy – Does not send any requests and only exists to keep
|
|
947
|
-
* the Requests class happy.
|
|
948
|
-
*/
|
|
949
|
-
$__requests_class = class_exists( '\\WpOrg\\Requests\\Requests' ) ? '\\WpOrg\\Requests\\Requests' : 'Requests';
|
|
950
|
-
if (defined('USE_FETCH_FOR_REQUESTS') && USE_FETCH_FOR_REQUESTS) {
|
|
951
|
-
require(__DIR__ . '/playground-includes/wp_http_fetch.php');
|
|
952
|
-
$__requests_class::add_transport('WP_Http_Fetch');
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* Add Fetch transport to the list of transports that WordPress
|
|
956
|
-
* will test for in the _get_first_available_transport() function.
|
|
957
|
-
*/
|
|
958
|
-
add_filter('http_api_transports', function ($transports) {
|
|
959
|
-
$transports[] = 'Fetch';
|
|
960
|
-
return $transports;
|
|
961
|
-
});
|
|
962
|
-
/**
|
|
963
|
-
* Disable signature verification as it doesn't seem to work with
|
|
964
|
-
* fetch requests:
|
|
965
|
-
*
|
|
966
|
-
* https://downloads.wordpress.org/plugin/classic-editor.zip returns no signature header.
|
|
967
|
-
* https://downloads.wordpress.org/plugin/classic-editor.zip.sig returns 404.
|
|
968
|
-
*
|
|
969
|
-
* @TODO Investigate why.
|
|
970
|
-
*/
|
|
971
|
-
add_filter('wp_signature_hosts', function ($hosts) {
|
|
972
|
-
return [];
|
|
973
|
-
});
|
|
974
|
-
|
|
975
|
-
add_filter('http_request_host_is_external', function ($arg) {
|
|
976
|
-
return true;
|
|
977
|
-
});
|
|
978
|
-
} else {
|
|
979
|
-
require(__DIR__ . '/playground-includes/requests_transport_dummy.php');
|
|
980
|
-
$__requests_class::add_transport('Requests_Transport_Dummy');
|
|
981
|
-
}
|
|
982
|
-
`;
|
|
983
|
-
async function updateFile(e, t, r) {
|
|
984
|
-
let n = "";
|
|
985
|
-
await e.fileExists(t) && (n = await e.readFileAsText(t)), await e.writeFile(t, r(n));
|
|
986
|
-
}
|
|
987
|
-
const applyWordPressPatches = async (e, t) => {
|
|
988
|
-
const r = new WordPressPatcher(
|
|
989
|
-
e,
|
|
990
|
-
t.wordpressPath || "/wordpress",
|
|
991
|
-
t.siteUrl
|
|
992
|
-
);
|
|
993
|
-
t.addPhpInfo === !0 && await r.addPhpInfo(), t.siteUrl && await r.patchSiteUrl(), t.patchSecrets === !0 && await r.patchSecrets(), t.disableSiteHealth === !0 && await r.disableSiteHealth(), t.disableWpNewBlogNotification === !0 && await r.disableWpNewBlogNotification(), t.prepareForRunningInsideWebBrowser === !0 && await r.prepareForRunningInsideWebBrowser(), t.addFetchNetworkTransport === !0 && await r.addFetchNetworkTransport();
|
|
994
|
-
};
|
|
995
|
-
class WordPressPatcher {
|
|
996
|
-
constructor(t, r, n) {
|
|
997
|
-
this.php = t, this.scopedSiteUrl = n, this.wordpressPath = r;
|
|
998
|
-
}
|
|
999
|
-
async addPhpInfo() {
|
|
1000
|
-
await this.php.writeFile(
|
|
1001
|
-
joinPaths(this.wordpressPath, "phpinfo.php"),
|
|
1002
|
-
"<?php phpinfo(); "
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
async patchSiteUrl() {
|
|
1006
|
-
await defineWpConfigConsts(this.php, {
|
|
1007
|
-
consts: {
|
|
1008
|
-
WP_HOME: this.scopedSiteUrl,
|
|
1009
|
-
WP_SITEURL: this.scopedSiteUrl
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
async patchSecrets() {
|
|
1014
|
-
await defineWpConfigConsts(this.php, {
|
|
1015
|
-
consts: {
|
|
1016
|
-
AUTH_KEY: randomString(40),
|
|
1017
|
-
SECURE_AUTH_KEY: randomString(40),
|
|
1018
|
-
LOGGED_IN_KEY: randomString(40),
|
|
1019
|
-
NONCE_KEY: randomString(40),
|
|
1020
|
-
AUTH_SALT: randomString(40),
|
|
1021
|
-
SECURE_AUTH_SALT: randomString(40),
|
|
1022
|
-
LOGGED_IN_SALT: randomString(40),
|
|
1023
|
-
NONCE_SALT: randomString(40)
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
async disableSiteHealth() {
|
|
1028
|
-
await updateFile(
|
|
1029
|
-
this.php,
|
|
1030
|
-
joinPaths(this.wordpressPath, "wp-includes/default-filters.php"),
|
|
1031
|
-
(t) => t.replace(
|
|
1032
|
-
/add_filter[^;]+wp_maybe_grant_site_health_caps[^;]+;/i,
|
|
1033
|
-
""
|
|
1034
|
-
)
|
|
1035
|
-
);
|
|
1036
|
-
}
|
|
1037
|
-
async disableWpNewBlogNotification() {
|
|
1038
|
-
await updateFile(
|
|
1039
|
-
this.php,
|
|
1040
|
-
joinPaths(this.wordpressPath, "wp-config.php"),
|
|
1041
|
-
// The original version of this function crashes WASM PHP, let's define an empty one instead.
|
|
1042
|
-
(t) => `${t} function wp_new_blog_notification(...$args){} `
|
|
1043
|
-
);
|
|
1044
|
-
}
|
|
1045
|
-
async prepareForRunningInsideWebBrowser() {
|
|
1046
|
-
await this.php.mkdir(
|
|
1047
|
-
joinPaths(this.wordpressPath, "wp-content/mu-plugins")
|
|
1048
|
-
), await this.php.writeFile(
|
|
1049
|
-
joinPaths(
|
|
1050
|
-
this.wordpressPath,
|
|
1051
|
-
"/wp-content/mu-plugins/0-playground.php"
|
|
1052
|
-
),
|
|
1053
|
-
playgroundMuPlugin
|
|
1054
|
-
), await this.php.mkdir(
|
|
1055
|
-
joinPaths(
|
|
1056
|
-
this.wordpressPath,
|
|
1057
|
-
"/wp-content/mu-plugins/playground-includes"
|
|
1058
|
-
)
|
|
1059
|
-
), await this.php.writeFile(
|
|
1060
|
-
joinPaths(
|
|
1061
|
-
this.wordpressPath,
|
|
1062
|
-
"/wp-content/mu-plugins/playground-includes/requests_transport_dummy.php"
|
|
1063
|
-
),
|
|
1064
|
-
transportDummy
|
|
1065
|
-
);
|
|
1066
|
-
}
|
|
1067
|
-
async addFetchNetworkTransport() {
|
|
1068
|
-
await defineWpConfigConsts(this.php, {
|
|
1069
|
-
consts: {
|
|
1070
|
-
USE_FETCH_FOR_REQUESTS: !0
|
|
1071
|
-
}
|
|
1072
|
-
});
|
|
1073
|
-
const t = [
|
|
1074
|
-
joinPaths(
|
|
1075
|
-
this.wordpressPath,
|
|
1076
|
-
"/wp-includes/Requests/Transport/fsockopen.php"
|
|
1077
|
-
),
|
|
1078
|
-
joinPaths(
|
|
1079
|
-
this.wordpressPath,
|
|
1080
|
-
"/wp-includes/Requests/Transport/cURL.php"
|
|
1081
|
-
),
|
|
1082
|
-
joinPaths(
|
|
1083
|
-
this.wordpressPath,
|
|
1084
|
-
"/wp-includes/Requests/src/Transport/Fsockopen.php"
|
|
1085
|
-
),
|
|
1086
|
-
joinPaths(
|
|
1087
|
-
this.wordpressPath,
|
|
1088
|
-
"/wp-includes/Requests/src/Transport/Curl.php"
|
|
1089
|
-
)
|
|
1090
|
-
];
|
|
1091
|
-
for (const r of t)
|
|
1092
|
-
await this.php.fileExists(r) && await updateFile(this.php, r, (n) => n.includes("public static function test2") ? n : n.replace(
|
|
1093
|
-
"public static function test",
|
|
1094
|
-
"public static function test( $capabilities = array() ) { return false; } public static function test2"
|
|
1095
|
-
));
|
|
1096
|
-
await this.php.writeFile(
|
|
1097
|
-
joinPaths(
|
|
1098
|
-
this.wordpressPath,
|
|
1099
|
-
"wp-content/mu-plugins/playground-includes/wp_http_fetch.php"
|
|
1100
|
-
),
|
|
1101
|
-
transportFetch
|
|
1102
|
-
), await this.php.mkdir(`${this.wordpressPath}/wp-content/fonts`);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
function randomString(e) {
|
|
1106
|
-
const t = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=-[]/.,<>?";
|
|
1107
|
-
let r = "";
|
|
1108
|
-
for (let n = e; n > 0; --n)
|
|
1109
|
-
r += t[Math.floor(Math.random() * t.length)];
|
|
1110
|
-
return r;
|
|
1111
|
-
}
|
|
1112
|
-
const runPHP = async (e, { code: t }) => await e.run({ code: t, throwOnError: !0 }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
1113
|
-
await e.unlink(t);
|
|
1114
|
-
}, runSql = async (e, { sql: t }, r) => {
|
|
1115
|
-
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
1116
|
-
const n = `/tmp/${crypto.randomUUID()}.sql`;
|
|
1117
|
-
await e.writeFile(
|
|
1118
|
-
n,
|
|
1119
|
-
new Uint8Array(await t.arrayBuffer())
|
|
1120
|
-
);
|
|
1121
|
-
const s = await e.documentRoot, 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) => {
|
|
689
|
+
const login = async (e, { username: t = "admin", password: r = "password" } = {}, n) => {
|
|
1154
690
|
var i, a, l;
|
|
1155
691
|
n == null || n.tracker.setCaption((n == null ? void 0 : n.initialCaption) || "Logging in"), await e.request({
|
|
1156
692
|
url: "/wp-login.php"
|
|
@@ -1204,7 +740,7 @@ function getURLScope(e) {
|
|
|
1204
740
|
return isURLScoped(e) ? e.pathname.split("/")[1].split(":")[1] : null;
|
|
1205
741
|
}
|
|
1206
742
|
const enableMultisite = async (e) => {
|
|
1207
|
-
var
|
|
743
|
+
var E;
|
|
1208
744
|
await defineWpConfigConsts(e, {
|
|
1209
745
|
consts: {
|
|
1210
746
|
WP_ALLOW_MULTISITE: 1
|
|
@@ -1212,8 +748,8 @@ const enableMultisite = async (e) => {
|
|
|
1212
748
|
});
|
|
1213
749
|
const t = new URL(await e.absoluteUrl);
|
|
1214
750
|
if (t.port !== "") {
|
|
1215
|
-
let
|
|
1216
|
-
throw t.hostname === "localhost" && (
|
|
751
|
+
let R = `The current host is ${t.host}, but WordPress multisites do not support custom ports.`;
|
|
752
|
+
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
753
|
}
|
|
1218
754
|
const r = t.pathname.replace(/\/$/, "") + "/", n = `${t.protocol}//${t.hostname}${r}`;
|
|
1219
755
|
await setSiteOptions(e, {
|
|
@@ -1253,13 +789,13 @@ foreach($plugins as $plugin_path) {
|
|
|
1253
789
|
}
|
|
1254
790
|
echo json_encode($deactivated_plugins);
|
|
1255
791
|
`
|
|
1256
|
-
})).json, p = (
|
|
792
|
+
})).json, p = (E = (await request(e, {
|
|
1257
793
|
request: {
|
|
1258
794
|
url: "/wp-admin/network.php"
|
|
1259
795
|
}
|
|
1260
796
|
})).text.match(
|
|
1261
797
|
/name="_wpnonce"\s+value="([^"]+)"/
|
|
1262
|
-
)) == null ? void 0 :
|
|
798
|
+
)) == null ? void 0 : E[1], u = await request(e, {
|
|
1263
799
|
request: {
|
|
1264
800
|
url: "/wp-admin/network.php",
|
|
1265
801
|
method: "POST",
|
|
@@ -1275,13 +811,13 @@ echo json_encode($deactivated_plugins);
|
|
|
1275
811
|
})
|
|
1276
812
|
}
|
|
1277
813
|
});
|
|
1278
|
-
if (
|
|
814
|
+
if (u.httpStatusCode !== 200)
|
|
1279
815
|
throw console.warn("WordPress response was", {
|
|
1280
|
-
response:
|
|
1281
|
-
text:
|
|
1282
|
-
headers:
|
|
816
|
+
response: u,
|
|
817
|
+
text: u.text,
|
|
818
|
+
headers: u.headers
|
|
1283
819
|
}), new Error(
|
|
1284
|
-
`Failed to enable multisite. Response code was ${
|
|
820
|
+
`Failed to enable multisite. Response code was ${u.httpStatusCode}`
|
|
1285
821
|
);
|
|
1286
822
|
await defineWpConfigConsts(e, {
|
|
1287
823
|
consts: {
|
|
@@ -1294,23 +830,23 @@ echo json_encode($deactivated_plugins);
|
|
|
1294
830
|
PATH_CURRENT_SITE: r
|
|
1295
831
|
}
|
|
1296
832
|
});
|
|
1297
|
-
const
|
|
833
|
+
const d = new URL(await e.absoluteUrl), $ = isURLScoped(d) ? "scope:" + getURLScope(d) : null;
|
|
1298
834
|
await e.writeFile(
|
|
1299
835
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
1300
836
|
`<?php
|
|
1301
837
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
1302
838
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
1303
839
|
}
|
|
1304
|
-
$folder = ${phpVar(
|
|
840
|
+
$folder = ${phpVar($)};
|
|
1305
841
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
1306
|
-
$_SERVER['HTTP_HOST'] = ${phpVar(
|
|
842
|
+
$_SERVER['HTTP_HOST'] = ${phpVar(d.hostname)};
|
|
1307
843
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
1308
844
|
}
|
|
1309
845
|
`
|
|
1310
846
|
), await login(e, {});
|
|
1311
|
-
for (const
|
|
847
|
+
for (const R of a)
|
|
1312
848
|
await activatePlugin(e, {
|
|
1313
|
-
pluginPath:
|
|
849
|
+
pluginPath: R
|
|
1314
850
|
});
|
|
1315
851
|
};
|
|
1316
852
|
function jsonToUrlEncoded(e) {
|
|
@@ -1357,8 +893,8 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
1357
893
|
a.fetch_attachments = "1";
|
|
1358
894
|
for (const p in a)
|
|
1359
895
|
if (p.startsWith("user_map[")) {
|
|
1360
|
-
const
|
|
1361
|
-
a[
|
|
896
|
+
const u = "user_new[" + p.slice(9, -1) + "]";
|
|
897
|
+
a[u] = "1";
|
|
1362
898
|
}
|
|
1363
899
|
await e.request({
|
|
1364
900
|
url: i.action,
|
|
@@ -1493,14 +1029,14 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1493
1029
|
extractToPath: s
|
|
1494
1030
|
}), s = joinPaths(s, r);
|
|
1495
1031
|
const i = joinPaths(s, "wp-content"), a = joinPaths(n, "wp-content");
|
|
1496
|
-
for (const
|
|
1497
|
-
const
|
|
1032
|
+
for (const d of wpContentFilesExcludedFromExport) {
|
|
1033
|
+
const $ = joinPaths(
|
|
1498
1034
|
i,
|
|
1499
|
-
|
|
1035
|
+
d
|
|
1500
1036
|
);
|
|
1501
|
-
await removePath(e,
|
|
1502
|
-
const
|
|
1503
|
-
await e.fileExists(
|
|
1037
|
+
await removePath(e, $);
|
|
1038
|
+
const E = joinPaths(a, d);
|
|
1039
|
+
await e.fileExists(E) && (await e.mkdir(dirname($)), await e.mv(E, $));
|
|
1504
1040
|
}
|
|
1505
1041
|
const l = joinPaths(
|
|
1506
1042
|
s,
|
|
@@ -1512,20 +1048,22 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1512
1048
|
l
|
|
1513
1049
|
);
|
|
1514
1050
|
const p = await e.listFiles(s);
|
|
1515
|
-
for (const
|
|
1516
|
-
await removePath(e, joinPaths(n,
|
|
1517
|
-
joinPaths(s,
|
|
1518
|
-
joinPaths(n,
|
|
1051
|
+
for (const d of p)
|
|
1052
|
+
await removePath(e, joinPaths(n, d)), await e.mv(
|
|
1053
|
+
joinPaths(s, d),
|
|
1054
|
+
joinPaths(n, d)
|
|
1519
1055
|
);
|
|
1520
|
-
await e.rmdir(s)
|
|
1521
|
-
|
|
1056
|
+
await e.rmdir(s), await defineSiteUrl(e, {
|
|
1057
|
+
siteUrl: await e.absoluteUrl
|
|
1058
|
+
});
|
|
1059
|
+
const u = phpVar(
|
|
1522
1060
|
joinPaths(n, "wp-admin", "upgrade.php")
|
|
1523
1061
|
);
|
|
1524
1062
|
await e.run({
|
|
1525
1063
|
throwOnError: !0,
|
|
1526
1064
|
code: `<?php
|
|
1527
1065
|
$_GET['step'] = 'upgrade_db';
|
|
1528
|
-
require ${
|
|
1066
|
+
require ${u};
|
|
1529
1067
|
`
|
|
1530
1068
|
});
|
|
1531
1069
|
};
|
|
@@ -1545,7 +1083,7 @@ async function exportWXZ(e) {
|
|
|
1545
1083
|
return new File([t.bytes], "export.wxz");
|
|
1546
1084
|
}
|
|
1547
1085
|
async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
1548
|
-
const s = r.name.replace(/\.zip$/, ""), i = joinPaths(await e.documentRoot, "wp-content"), a = joinPaths(i,
|
|
1086
|
+
const s = r.name.replace(/\.zip$/, ""), i = joinPaths(await e.documentRoot, "wp-content"), a = joinPaths(i, randomString()), l = joinPaths(a, "assets", s);
|
|
1549
1087
|
await e.fileExists(l) && await e.rmdir(a, {
|
|
1550
1088
|
recursive: !0
|
|
1551
1089
|
}), await e.mkdir(a);
|
|
@@ -1557,14 +1095,14 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1557
1095
|
let p = await e.listFiles(l, {
|
|
1558
1096
|
prependPath: !0
|
|
1559
1097
|
});
|
|
1560
|
-
p = p.filter((
|
|
1561
|
-
const
|
|
1562
|
-
let
|
|
1563
|
-
|
|
1564
|
-
const
|
|
1565
|
-
return await e.mv(
|
|
1566
|
-
assetFolderPath:
|
|
1567
|
-
assetFolderName:
|
|
1098
|
+
p = p.filter((R) => !R.endsWith("/__MACOSX"));
|
|
1099
|
+
const u = p.length === 1 && await e.isDir(p[0]);
|
|
1100
|
+
let d, $ = "";
|
|
1101
|
+
u ? ($ = p[0], d = p[0].split("/").pop()) : ($ = l, d = s);
|
|
1102
|
+
const E = `${t}/${d}`;
|
|
1103
|
+
return await e.mv($, E), {
|
|
1104
|
+
assetFolderPath: E,
|
|
1105
|
+
assetFolderName: d
|
|
1568
1106
|
};
|
|
1569
1107
|
} finally {
|
|
1570
1108
|
await e.rmdir(a, {
|
|
@@ -1653,7 +1191,6 @@ const installPlugin = async (e, { pluginZipFile: t, options: r = {} }, n) => {
|
|
|
1653
1191
|
__proto__: null,
|
|
1654
1192
|
activatePlugin,
|
|
1655
1193
|
activateTheme,
|
|
1656
|
-
applyWordPressPatches,
|
|
1657
1194
|
cp,
|
|
1658
1195
|
defineSiteUrl,
|
|
1659
1196
|
defineWpConfigConsts,
|
|
@@ -1704,12 +1241,12 @@ function cloneResponseMonitorProgress(e, t) {
|
|
|
1704
1241
|
let l = 0;
|
|
1705
1242
|
for (; ; )
|
|
1706
1243
|
try {
|
|
1707
|
-
const { done: p, value:
|
|
1708
|
-
if (
|
|
1244
|
+
const { done: p, value: u } = await a.read();
|
|
1245
|
+
if (u && (l += u.byteLength), p) {
|
|
1709
1246
|
s(l, l), i.close();
|
|
1710
1247
|
break;
|
|
1711
1248
|
} else
|
|
1712
|
-
s(l, n), i.enqueue(
|
|
1249
|
+
s(l, n), i.enqueue(u);
|
|
1713
1250
|
} catch (p) {
|
|
1714
1251
|
console.error({ e: p }), i.error(p);
|
|
1715
1252
|
break;
|
|
@@ -2106,7 +1643,7 @@ const SupportedPHPVersions = [
|
|
|
2106
1643
|
], SupportedPHPExtensionBundles = {
|
|
2107
1644
|
"kitchen-sink": SupportedPHPExtensionsList
|
|
2108
1645
|
};
|
|
2109
|
-
var De,
|
|
1646
|
+
var De, Ge;
|
|
2110
1647
|
class PHPBrowser {
|
|
2111
1648
|
/**
|
|
2112
1649
|
* @param server - The PHP server to browse.
|
|
@@ -2114,8 +1651,8 @@ class PHPBrowser {
|
|
|
2114
1651
|
*/
|
|
2115
1652
|
constructor(t, r = {}) {
|
|
2116
1653
|
Z(this, De, void 0);
|
|
2117
|
-
Z(this,
|
|
2118
|
-
this.requestHandler = t, te(this, De, {}), te(this,
|
|
1654
|
+
Z(this, Ge, void 0);
|
|
1655
|
+
this.requestHandler = t, te(this, De, {}), te(this, Ge, {
|
|
2119
1656
|
handleRedirects: !1,
|
|
2120
1657
|
maxRedirects: 4,
|
|
2121
1658
|
...r
|
|
@@ -2143,7 +1680,7 @@ class PHPBrowser {
|
|
|
2143
1680
|
cookie: this.serializeCookies()
|
|
2144
1681
|
}
|
|
2145
1682
|
});
|
|
2146
|
-
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this,
|
|
1683
|
+
if (n.headers["set-cookie"] && this.setCookies(n.headers["set-cookie"]), H(this, Ge).handleRedirects && n.headers.location && r < H(this, Ge).maxRedirects) {
|
|
2147
1684
|
const s = new URL(
|
|
2148
1685
|
n.headers.location[0],
|
|
2149
1686
|
this.requestHandler.absoluteUrl
|
|
@@ -2193,7 +1730,7 @@ class PHPBrowser {
|
|
|
2193
1730
|
return t.join("; ");
|
|
2194
1731
|
}
|
|
2195
1732
|
}
|
|
2196
|
-
De = new WeakMap(),
|
|
1733
|
+
De = new WeakMap(), Ge = new WeakMap();
|
|
2197
1734
|
const DEFAULT_BASE_URL = "http://example.com";
|
|
2198
1735
|
function toRelativeUrl(e) {
|
|
2199
1736
|
return e.toString().substring(e.origin.length);
|
|
@@ -2204,7 +1741,7 @@ function removePathPrefix(e, t) {
|
|
|
2204
1741
|
function ensurePathPrefix(e, t) {
|
|
2205
1742
|
return !t || e.startsWith(t) ? e : t + e;
|
|
2206
1743
|
}
|
|
2207
|
-
var Se,
|
|
1744
|
+
var Se, Ke, dt, Ae, Je, ve, Ze, Fe, mt, xt, _t, Wt, $t, Bt;
|
|
2208
1745
|
class PHPRequestHandler {
|
|
2209
1746
|
/**
|
|
2210
1747
|
* @param php - The PHP instance.
|
|
@@ -2235,30 +1772,30 @@ class PHPRequestHandler {
|
|
|
2235
1772
|
* @throws {Error} If the requested path doesn't exist.
|
|
2236
1773
|
* @returns The resolved filesystem path.
|
|
2237
1774
|
*/
|
|
2238
|
-
Z(this,
|
|
1775
|
+
Z(this, $t);
|
|
2239
1776
|
Z(this, Se, void 0);
|
|
2240
|
-
Z(this,
|
|
1777
|
+
Z(this, Ke, void 0);
|
|
2241
1778
|
Z(this, dt, void 0);
|
|
2242
1779
|
Z(this, Ae, void 0);
|
|
2243
|
-
Z(this, Ke, void 0);
|
|
2244
|
-
Z(this, ve, void 0);
|
|
2245
1780
|
Z(this, Je, void 0);
|
|
1781
|
+
Z(this, ve, void 0);
|
|
2246
1782
|
Z(this, Ze, void 0);
|
|
2247
|
-
|
|
1783
|
+
Z(this, Fe, void 0);
|
|
1784
|
+
te(this, Fe, new Semaphore({ concurrency: 1 }));
|
|
2248
1785
|
const {
|
|
2249
1786
|
documentRoot: n = "/www/",
|
|
2250
1787
|
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
2251
1788
|
} = r;
|
|
2252
1789
|
this.php = t, te(this, Se, n);
|
|
2253
1790
|
const 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,
|
|
1791
|
+
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
1792
|
const a = H(this, Ae) !== 443 && H(this, Ae) !== 80;
|
|
2256
|
-
te(this,
|
|
1793
|
+
te(this, Je, [
|
|
2257
1794
|
H(this, dt),
|
|
2258
1795
|
a ? `:${H(this, Ae)}` : ""
|
|
2259
|
-
].join("")), te(this, ve, i.pathname.replace(/\/+$/, "")), te(this,
|
|
2260
|
-
`${H(this,
|
|
2261
|
-
H(this,
|
|
1796
|
+
].join("")), te(this, ve, i.pathname.replace(/\/+$/, "")), te(this, Ze, [
|
|
1797
|
+
`${H(this, Ke)}://`,
|
|
1798
|
+
H(this, Je),
|
|
2262
1799
|
H(this, ve)
|
|
2263
1800
|
].join(""));
|
|
2264
1801
|
}
|
|
@@ -2272,11 +1809,11 @@ class PHPRequestHandler {
|
|
|
2272
1809
|
return r.pathname.startsWith(H(this, ve)) && (r.pathname = r.pathname.slice(H(this, ve).length)), toRelativeUrl(r);
|
|
2273
1810
|
}
|
|
2274
1811
|
get isRequestRunning() {
|
|
2275
|
-
return H(this,
|
|
1812
|
+
return H(this, Fe).running > 0;
|
|
2276
1813
|
}
|
|
2277
1814
|
/** @inheritDoc */
|
|
2278
1815
|
get absoluteUrl() {
|
|
2279
|
-
return H(this,
|
|
1816
|
+
return H(this, Ze);
|
|
2280
1817
|
}
|
|
2281
1818
|
/** @inheritDoc */
|
|
2282
1819
|
get documentRoot() {
|
|
@@ -2291,10 +1828,10 @@ class PHPRequestHandler {
|
|
|
2291
1828
|
n.pathname,
|
|
2292
1829
|
H(this, ve)
|
|
2293
1830
|
), i = `${H(this, Se)}${s}`;
|
|
2294
|
-
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t,
|
|
1831
|
+
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, xt).call(this, i);
|
|
2295
1832
|
}
|
|
2296
1833
|
}
|
|
2297
|
-
Se = new WeakMap(),
|
|
1834
|
+
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
1835
|
if (!this.php.fileExists(t))
|
|
2299
1836
|
return new PHPResponse(
|
|
2300
1837
|
404,
|
|
@@ -2319,49 +1856,57 @@ Se = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), Ae = new WeakMap(),
|
|
|
2319
1856
|
},
|
|
2320
1857
|
r
|
|
2321
1858
|
);
|
|
2322
|
-
}, _t = new WeakSet(),
|
|
2323
|
-
var s, i;
|
|
2324
|
-
|
|
1859
|
+
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
1860
|
+
var s, i, a;
|
|
1861
|
+
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1862
|
+
return console.warn(
|
|
1863
|
+
"Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."
|
|
1864
|
+
), new PHPResponse(
|
|
1865
|
+
502,
|
|
1866
|
+
{},
|
|
1867
|
+
new TextEncoder().encode("502 Bad Gateway")
|
|
1868
|
+
);
|
|
1869
|
+
const n = await H(this, Fe).acquire();
|
|
2325
1870
|
try {
|
|
2326
1871
|
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this, Se)), this.php.addServerGlobalEntry(
|
|
2327
1872
|
"HTTPS",
|
|
2328
|
-
H(this,
|
|
1873
|
+
H(this, Ze).startsWith("https://") ? "on" : ""
|
|
2329
1874
|
);
|
|
2330
|
-
let
|
|
2331
|
-
const
|
|
2332
|
-
host: H(this,
|
|
1875
|
+
let l = "GET";
|
|
1876
|
+
const p = {
|
|
1877
|
+
host: H(this, Je),
|
|
2333
1878
|
...normalizeHeaders(t.headers || {})
|
|
2334
|
-
},
|
|
1879
|
+
}, u = [];
|
|
2335
1880
|
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
|
|
1881
|
+
l = "POST";
|
|
1882
|
+
for (const E in t.files) {
|
|
1883
|
+
const R = t.files[E];
|
|
1884
|
+
u.push({
|
|
1885
|
+
key: E,
|
|
1886
|
+
name: R.name,
|
|
1887
|
+
type: R.type,
|
|
1888
|
+
data: new Uint8Array(await R.arrayBuffer())
|
|
2344
1889
|
});
|
|
2345
1890
|
}
|
|
2346
|
-
(
|
|
1891
|
+
(i = p["content-type"]) != null && i.startsWith("multipart/form-data") && (t.formData = parseMultipartFormDataString(
|
|
2347
1892
|
t.body || ""
|
|
2348
|
-
),
|
|
1893
|
+
), p["content-type"] = "application/x-www-form-urlencoded", delete t.body);
|
|
2349
1894
|
}
|
|
2350
1895
|
let d;
|
|
2351
|
-
t.formData !== void 0 ? (
|
|
1896
|
+
t.formData !== void 0 ? (l = "POST", p["content-type"] = p["content-type"] || "application/x-www-form-urlencoded", d = new URLSearchParams(
|
|
2352
1897
|
t.formData
|
|
2353
1898
|
).toString()) : d = t.body;
|
|
2354
|
-
let
|
|
1899
|
+
let $;
|
|
2355
1900
|
try {
|
|
2356
|
-
let
|
|
2357
|
-
if ((
|
|
1901
|
+
let E = r.pathname;
|
|
1902
|
+
if ((a = t.headers) != null && a["x-rewrite-url"])
|
|
2358
1903
|
try {
|
|
2359
|
-
|
|
1904
|
+
E = new URL(
|
|
2360
1905
|
t.headers["x-rewrite-url"]
|
|
2361
1906
|
).pathname;
|
|
2362
1907
|
} catch {
|
|
2363
1908
|
}
|
|
2364
|
-
|
|
1909
|
+
$ = ce(this, $t, Bt).call(this, E);
|
|
2365
1910
|
} catch {
|
|
2366
1911
|
return new PHPResponse(
|
|
2367
1912
|
404,
|
|
@@ -2374,17 +1919,17 @@ Se = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), Ae = new WeakMap(),
|
|
|
2374
1919
|
toRelativeUrl(r),
|
|
2375
1920
|
H(this, ve)
|
|
2376
1921
|
),
|
|
2377
|
-
protocol: H(this,
|
|
2378
|
-
method: t.method ||
|
|
1922
|
+
protocol: H(this, Ke),
|
|
1923
|
+
method: t.method || l,
|
|
2379
1924
|
body: d,
|
|
2380
|
-
fileInfos:
|
|
2381
|
-
scriptPath:
|
|
2382
|
-
headers:
|
|
1925
|
+
fileInfos: u,
|
|
1926
|
+
scriptPath: $,
|
|
1927
|
+
headers: p
|
|
2383
1928
|
});
|
|
2384
1929
|
} finally {
|
|
2385
1930
|
n();
|
|
2386
1931
|
}
|
|
2387
|
-
},
|
|
1932
|
+
}, $t = new WeakSet(), Bt = function(t) {
|
|
2388
1933
|
let r = removePathPrefix(t, H(this, ve));
|
|
2389
1934
|
r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r += "/"), r.endsWith("index.php") || (r += "index.php"));
|
|
2390
1935
|
const n = `${H(this, Se)}${r}`;
|
|
@@ -2400,10 +1945,10 @@ function parseMultipartFormDataString(e) {
|
|
|
2400
1945
|
return s.shift(), s.pop(), s.forEach((i) => {
|
|
2401
1946
|
const a = i.indexOf(`\r
|
|
2402
1947
|
\r
|
|
2403
|
-
`), l = i.substring(0, a).trim(), p = i.substring(a + 4).trim(),
|
|
2404
|
-
if (
|
|
2405
|
-
const
|
|
2406
|
-
t[
|
|
1948
|
+
`), l = i.substring(0, a).trim(), p = i.substring(a + 4).trim(), u = l.match(/name="([^"]+)"/);
|
|
1949
|
+
if (u) {
|
|
1950
|
+
const d = u[1];
|
|
1951
|
+
t[d] = p;
|
|
2407
1952
|
}
|
|
2408
1953
|
}), t;
|
|
2409
1954
|
}
|
|
@@ -2549,8 +2094,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2549
2094
|
} catch (l) {
|
|
2550
2095
|
const p = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2551
2096
|
if (p in FileErrorCodes) {
|
|
2552
|
-
const
|
|
2553
|
-
throw new Error(`${
|
|
2097
|
+
const u = FileErrorCodes[p], d = typeof a[0] == "string" ? a[0] : null, $ = d !== null ? e.replaceAll("{path}", d) : e;
|
|
2098
|
+
throw new Error(`${$}: ${u}`, {
|
|
2554
2099
|
cause: l
|
|
2555
2100
|
});
|
|
2556
2101
|
}
|
|
@@ -2573,7 +2118,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2573
2118
|
return n && s && __defProp(t, r, s), s;
|
|
2574
2119
|
};
|
|
2575
2120
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2576
|
-
var
|
|
2121
|
+
var Me, Qe, Ye, Pe, Re, Te, be, Xe, 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
2122
|
class BasePHP {
|
|
2578
2123
|
/**
|
|
2579
2124
|
* Initializes a PHP runtime.
|
|
@@ -2583,7 +2128,7 @@ class BasePHP {
|
|
|
2583
2128
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2584
2129
|
*/
|
|
2585
2130
|
constructor(e, t) {
|
|
2586
|
-
Z(this,
|
|
2131
|
+
Z(this, gt);
|
|
2587
2132
|
Z(this, yt);
|
|
2588
2133
|
Z(this, vt);
|
|
2589
2134
|
Z(this, wt);
|
|
@@ -2603,8 +2148,8 @@ class BasePHP {
|
|
|
2603
2148
|
*/
|
|
2604
2149
|
Z(this, Tt);
|
|
2605
2150
|
Z(this, kt);
|
|
2606
|
-
Z(this,
|
|
2607
|
-
Z(this,
|
|
2151
|
+
Z(this, Ct);
|
|
2152
|
+
Z(this, Me, void 0);
|
|
2608
2153
|
Z(this, Qe, void 0);
|
|
2609
2154
|
Z(this, Ye, void 0);
|
|
2610
2155
|
Z(this, Pe, void 0);
|
|
@@ -2612,7 +2157,7 @@ class BasePHP {
|
|
|
2612
2157
|
Z(this, Te, void 0);
|
|
2613
2158
|
Z(this, be, void 0);
|
|
2614
2159
|
Z(this, Xe, void 0);
|
|
2615
|
-
te(this,
|
|
2160
|
+
te(this, Me, []), te(this, Pe, !1), te(this, Re, null), te(this, Te, {}), te(this, be, /* @__PURE__ */ new Map()), te(this, Xe, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
|
|
2616
2161
|
new PHPRequestHandler(this, t)
|
|
2617
2162
|
));
|
|
2618
2163
|
}
|
|
@@ -2700,7 +2245,7 @@ class BasePHP {
|
|
|
2700
2245
|
setPhpIniEntry(e, t) {
|
|
2701
2246
|
if (H(this, Pe))
|
|
2702
2247
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2703
|
-
H(this,
|
|
2248
|
+
H(this, Me).push([e, t]);
|
|
2704
2249
|
}
|
|
2705
2250
|
/** @inheritDoc */
|
|
2706
2251
|
chdir(e) {
|
|
@@ -2717,13 +2262,13 @@ class BasePHP {
|
|
|
2717
2262
|
const t = await this.semaphore.acquire();
|
|
2718
2263
|
let r;
|
|
2719
2264
|
try {
|
|
2720
|
-
H(this, Pe) || (ce(this,
|
|
2265
|
+
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
2266
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2722
2267
|
if (ce(this, wt, Zt).call(this, s, e.protocol || "http"), ce(this, bt, Yt).call(this, n), e.body && (r = ce(this, Et, Xt).call(this, e.body)), e.fileInfos)
|
|
2723
2268
|
for (const a of e.fileInfos)
|
|
2724
2269
|
ce(this, Tt, rr).call(this, a);
|
|
2725
2270
|
typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
|
|
2726
|
-
const i = await ce(this,
|
|
2271
|
+
const i = await ce(this, Ct, sr).call(this);
|
|
2727
2272
|
if (e.throwOnError && i.exitCode !== 0) {
|
|
2728
2273
|
const a = {
|
|
2729
2274
|
stdout: i.text,
|
|
@@ -2859,7 +2404,7 @@ class BasePHP {
|
|
|
2859
2404
|
te(this, Pe, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2860
2405
|
}
|
|
2861
2406
|
}
|
|
2862
|
-
|
|
2407
|
+
Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), be = new WeakMap(), Xe = new WeakMap(), gt = new WeakSet(), Gt = function() {
|
|
2863
2408
|
if (this.setPhpIniEntry("auto_prepend_file", "/tmp/consts.php"), this.fileExists("/tmp/consts.php") || this.writeFile(
|
|
2864
2409
|
"/tmp/consts.php",
|
|
2865
2410
|
`<?php
|
|
@@ -2871,8 +2416,8 @@ Fe = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2871
2416
|
}
|
|
2872
2417
|
}
|
|
2873
2418
|
}`
|
|
2874
|
-
), H(this,
|
|
2875
|
-
const e = H(this,
|
|
2419
|
+
), H(this, Me).length > 0) {
|
|
2420
|
+
const e = H(this, Me).map(([t, r]) => `${t}=${r}`).join(`
|
|
2876
2421
|
`) + `
|
|
2877
2422
|
|
|
2878
2423
|
`;
|
|
@@ -3016,15 +2561,15 @@ Fe = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
3016
2561
|
[STRING],
|
|
3017
2562
|
[e]
|
|
3018
2563
|
);
|
|
3019
|
-
},
|
|
2564
|
+
}, Ct = new WeakSet(), sr = async function() {
|
|
3020
2565
|
var s;
|
|
3021
2566
|
let e, t;
|
|
3022
2567
|
try {
|
|
3023
2568
|
e = await new Promise((i, a) => {
|
|
3024
2569
|
var p;
|
|
3025
|
-
t = (
|
|
3026
|
-
const
|
|
3027
|
-
|
|
2570
|
+
t = (u) => {
|
|
2571
|
+
const d = new Error("Rethrown");
|
|
2572
|
+
d.cause = u.error, d.betterMessage = u.message, a(d);
|
|
3028
2573
|
}, (p = H(this, Re)) == null || p.addEventListener(
|
|
3029
2574
|
"error",
|
|
3030
2575
|
t
|
|
@@ -3039,8 +2584,8 @@ Fe = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
3039
2584
|
return l instanceof Promise ? l.then(i, a) : i(l);
|
|
3040
2585
|
});
|
|
3041
2586
|
} catch (i) {
|
|
3042
|
-
for (const
|
|
3043
|
-
typeof this[
|
|
2587
|
+
for (const u in this)
|
|
2588
|
+
typeof this[u] == "function" && (this[u] = () => {
|
|
3044
2589
|
throw new Error(
|
|
3045
2590
|
"PHP runtime has crashed – see the earlier error for details."
|
|
3046
2591
|
);
|
|
@@ -3384,42 +2929,42 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3384
2929
|
}
|
|
3385
2930
|
get str() {
|
|
3386
2931
|
var k;
|
|
3387
|
-
return (k = this._str) !== null && k !== void 0 ? k : this._str = this._items.reduce((
|
|
2932
|
+
return (k = this._str) !== null && k !== void 0 ? k : this._str = this._items.reduce((C, I) => `${C}${I}`, "");
|
|
3388
2933
|
}
|
|
3389
2934
|
get names() {
|
|
3390
2935
|
var k;
|
|
3391
|
-
return (k = this._names) !== null && k !== void 0 ? k : this._names = this._items.reduce((
|
|
2936
|
+
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
2937
|
}
|
|
3393
2938
|
}
|
|
3394
2939
|
e._Code = n, e.nil = new n("");
|
|
3395
2940
|
function s(_, ...k) {
|
|
3396
|
-
const
|
|
2941
|
+
const C = [_[0]];
|
|
3397
2942
|
let I = 0;
|
|
3398
2943
|
for (; I < k.length; )
|
|
3399
|
-
l(
|
|
3400
|
-
return new n(
|
|
2944
|
+
l(C, k[I]), C.push(_[++I]);
|
|
2945
|
+
return new n(C);
|
|
3401
2946
|
}
|
|
3402
2947
|
e._ = s;
|
|
3403
2948
|
const i = new n("+");
|
|
3404
2949
|
function a(_, ...k) {
|
|
3405
|
-
const
|
|
2950
|
+
const C = [R(_[0])];
|
|
3406
2951
|
let I = 0;
|
|
3407
2952
|
for (; I < k.length; )
|
|
3408
|
-
|
|
3409
|
-
return p(
|
|
2953
|
+
C.push(i), l(C, k[I]), C.push(i, R(_[++I]));
|
|
2954
|
+
return p(C), new n(C);
|
|
3410
2955
|
}
|
|
3411
2956
|
e.str = a;
|
|
3412
2957
|
function l(_, k) {
|
|
3413
|
-
k instanceof n ? _.push(...k._items) : k instanceof r ? _.push(k) : _.push(
|
|
2958
|
+
k instanceof n ? _.push(...k._items) : k instanceof r ? _.push(k) : _.push($(k));
|
|
3414
2959
|
}
|
|
3415
2960
|
e.addCodeArg = l;
|
|
3416
2961
|
function p(_) {
|
|
3417
2962
|
let k = 1;
|
|
3418
2963
|
for (; k < _.length - 1; ) {
|
|
3419
2964
|
if (_[k] === i) {
|
|
3420
|
-
const
|
|
3421
|
-
if (
|
|
3422
|
-
_.splice(k - 1, 3,
|
|
2965
|
+
const C = u(_[k - 1], _[k + 1]);
|
|
2966
|
+
if (C !== void 0) {
|
|
2967
|
+
_.splice(k - 1, 3, C);
|
|
3423
2968
|
continue;
|
|
3424
2969
|
}
|
|
3425
2970
|
_[k++] = "+";
|
|
@@ -3427,7 +2972,7 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3427
2972
|
k++;
|
|
3428
2973
|
}
|
|
3429
2974
|
}
|
|
3430
|
-
function
|
|
2975
|
+
function u(_, k) {
|
|
3431
2976
|
if (k === '""')
|
|
3432
2977
|
return _;
|
|
3433
2978
|
if (_ === '""')
|
|
@@ -3437,43 +2982,43 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3437
2982
|
if (typeof k == "string" && k[0] === '"' && !(_ instanceof r))
|
|
3438
2983
|
return `"${_}${k.slice(1)}`;
|
|
3439
2984
|
}
|
|
3440
|
-
function
|
|
2985
|
+
function d(_, k) {
|
|
3441
2986
|
return k.emptyStr() ? _ : _.emptyStr() ? k : a`${_}${k}`;
|
|
3442
2987
|
}
|
|
3443
|
-
e.strConcat =
|
|
3444
|
-
function
|
|
3445
|
-
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ :
|
|
2988
|
+
e.strConcat = d;
|
|
2989
|
+
function $(_) {
|
|
2990
|
+
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : R(Array.isArray(_) ? _.join(",") : _);
|
|
3446
2991
|
}
|
|
3447
|
-
function
|
|
3448
|
-
return new n(
|
|
2992
|
+
function E(_) {
|
|
2993
|
+
return new n(R(_));
|
|
3449
2994
|
}
|
|
3450
|
-
e.stringify =
|
|
3451
|
-
function
|
|
2995
|
+
e.stringify = E;
|
|
2996
|
+
function R(_) {
|
|
3452
2997
|
return JSON.stringify(_).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3453
2998
|
}
|
|
3454
|
-
e.safeStringify =
|
|
2999
|
+
e.safeStringify = R;
|
|
3455
3000
|
function v(_) {
|
|
3456
3001
|
return typeof _ == "string" && e.IDENTIFIER.test(_) ? new n(`.${_}`) : s`[${_}]`;
|
|
3457
3002
|
}
|
|
3458
3003
|
e.getProperty = v;
|
|
3459
|
-
function
|
|
3004
|
+
function T(_) {
|
|
3460
3005
|
if (typeof _ == "string" && e.IDENTIFIER.test(_))
|
|
3461
3006
|
return new n(`${_}`);
|
|
3462
3007
|
throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`);
|
|
3463
3008
|
}
|
|
3464
|
-
e.getEsmExportName =
|
|
3465
|
-
function
|
|
3009
|
+
e.getEsmExportName = T;
|
|
3010
|
+
function g(_) {
|
|
3466
3011
|
return new n(_.toString());
|
|
3467
3012
|
}
|
|
3468
|
-
e.regexpCode =
|
|
3013
|
+
e.regexpCode = g;
|
|
3469
3014
|
})(code$1);
|
|
3470
3015
|
var scope = {};
|
|
3471
3016
|
(function(e) {
|
|
3472
3017
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueScope = e.ValueScopeName = e.Scope = e.varKinds = e.UsedValueState = void 0;
|
|
3473
3018
|
const t = code$1;
|
|
3474
3019
|
class r extends Error {
|
|
3475
|
-
constructor(
|
|
3476
|
-
super(`CodeGen: "code" for ${
|
|
3020
|
+
constructor(u) {
|
|
3021
|
+
super(`CodeGen: "code" for ${u} not defined`), this.value = u.value;
|
|
3477
3022
|
}
|
|
3478
3023
|
}
|
|
3479
3024
|
var n;
|
|
@@ -3485,105 +3030,105 @@ var scope = {};
|
|
|
3485
3030
|
var: new t.Name("var")
|
|
3486
3031
|
};
|
|
3487
3032
|
class s {
|
|
3488
|
-
constructor({ prefixes:
|
|
3489
|
-
this._names = {}, this._prefixes =
|
|
3033
|
+
constructor({ prefixes: u, parent: d } = {}) {
|
|
3034
|
+
this._names = {}, this._prefixes = u, this._parent = d;
|
|
3490
3035
|
}
|
|
3491
|
-
toName(
|
|
3492
|
-
return
|
|
3036
|
+
toName(u) {
|
|
3037
|
+
return u instanceof t.Name ? u : this.name(u);
|
|
3493
3038
|
}
|
|
3494
|
-
name(
|
|
3495
|
-
return new t.Name(this._newName(
|
|
3039
|
+
name(u) {
|
|
3040
|
+
return new t.Name(this._newName(u));
|
|
3496
3041
|
}
|
|
3497
|
-
_newName(
|
|
3498
|
-
const
|
|
3499
|
-
return `${
|
|
3042
|
+
_newName(u) {
|
|
3043
|
+
const d = this._names[u] || this._nameGroup(u);
|
|
3044
|
+
return `${u}${d.index++}`;
|
|
3500
3045
|
}
|
|
3501
|
-
_nameGroup(
|
|
3502
|
-
var
|
|
3503
|
-
if (!((
|
|
3504
|
-
throw new Error(`CodeGen: prefix "${
|
|
3505
|
-
return this._names[
|
|
3046
|
+
_nameGroup(u) {
|
|
3047
|
+
var d, $;
|
|
3048
|
+
if (!(($ = (d = this._parent) === null || d === void 0 ? void 0 : d._prefixes) === null || $ === void 0) && $.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3049
|
+
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3050
|
+
return this._names[u] = { prefix: u, index: 0 };
|
|
3506
3051
|
}
|
|
3507
3052
|
}
|
|
3508
3053
|
e.Scope = s;
|
|
3509
3054
|
class i extends t.Name {
|
|
3510
|
-
constructor(
|
|
3511
|
-
super(
|
|
3055
|
+
constructor(u, d) {
|
|
3056
|
+
super(d), this.prefix = u;
|
|
3512
3057
|
}
|
|
3513
|
-
setValue(
|
|
3514
|
-
this.value =
|
|
3058
|
+
setValue(u, { property: d, itemIndex: $ }) {
|
|
3059
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(d)}[${$}]`;
|
|
3515
3060
|
}
|
|
3516
3061
|
}
|
|
3517
3062
|
e.ValueScopeName = i;
|
|
3518
3063
|
const a = (0, t._)`\n`;
|
|
3519
3064
|
class l extends s {
|
|
3520
|
-
constructor(
|
|
3521
|
-
super(
|
|
3065
|
+
constructor(u) {
|
|
3066
|
+
super(u), this._values = {}, this._scope = u.scope, this.opts = { ...u, _n: u.lines ? a : t.nil };
|
|
3522
3067
|
}
|
|
3523
3068
|
get() {
|
|
3524
3069
|
return this._scope;
|
|
3525
3070
|
}
|
|
3526
|
-
name(
|
|
3527
|
-
return new i(
|
|
3071
|
+
name(u) {
|
|
3072
|
+
return new i(u, this._newName(u));
|
|
3528
3073
|
}
|
|
3529
|
-
value(
|
|
3530
|
-
var
|
|
3531
|
-
if (
|
|
3074
|
+
value(u, d) {
|
|
3075
|
+
var $;
|
|
3076
|
+
if (d.ref === void 0)
|
|
3532
3077
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3533
|
-
const
|
|
3534
|
-
let
|
|
3535
|
-
if (
|
|
3536
|
-
const k =
|
|
3078
|
+
const E = this.toName(u), { prefix: R } = E, v = ($ = d.key) !== null && $ !== void 0 ? $ : d.ref;
|
|
3079
|
+
let T = this._values[R];
|
|
3080
|
+
if (T) {
|
|
3081
|
+
const k = T.get(v);
|
|
3537
3082
|
if (k)
|
|
3538
3083
|
return k;
|
|
3539
3084
|
} 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._)`${
|
|
3085
|
+
T = this._values[R] = /* @__PURE__ */ new Map();
|
|
3086
|
+
T.set(v, E);
|
|
3087
|
+
const g = this._scope[R] || (this._scope[R] = []), _ = g.length;
|
|
3088
|
+
return g[_] = d.ref, E.setValue(d, { property: R, itemIndex: _ }), E;
|
|
3089
|
+
}
|
|
3090
|
+
getValue(u, d) {
|
|
3091
|
+
const $ = this._values[u];
|
|
3092
|
+
if ($)
|
|
3093
|
+
return $.get(d);
|
|
3094
|
+
}
|
|
3095
|
+
scopeRefs(u, d = this._values) {
|
|
3096
|
+
return this._reduceValues(d, ($) => {
|
|
3097
|
+
if ($.scopePath === void 0)
|
|
3098
|
+
throw new Error(`CodeGen: name "${$}" has no value`);
|
|
3099
|
+
return (0, t._)`${u}${$.scopePath}`;
|
|
3555
3100
|
});
|
|
3556
3101
|
}
|
|
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 (!
|
|
3102
|
+
scopeCode(u = this._values, d, $) {
|
|
3103
|
+
return this._reduceValues(u, (E) => {
|
|
3104
|
+
if (E.value === void 0)
|
|
3105
|
+
throw new Error(`CodeGen: name "${E}" has no value`);
|
|
3106
|
+
return E.value.code;
|
|
3107
|
+
}, d, $);
|
|
3108
|
+
}
|
|
3109
|
+
_reduceValues(u, d, $ = {}, E) {
|
|
3110
|
+
let R = t.nil;
|
|
3111
|
+
for (const v in u) {
|
|
3112
|
+
const T = u[v];
|
|
3113
|
+
if (!T)
|
|
3569
3114
|
continue;
|
|
3570
|
-
const
|
|
3571
|
-
|
|
3572
|
-
if (
|
|
3115
|
+
const g = $[v] = $[v] || /* @__PURE__ */ new Map();
|
|
3116
|
+
T.forEach((_) => {
|
|
3117
|
+
if (g.has(_))
|
|
3573
3118
|
return;
|
|
3574
|
-
|
|
3575
|
-
let k =
|
|
3119
|
+
g.set(_, n.Started);
|
|
3120
|
+
let k = d(_);
|
|
3576
3121
|
if (k) {
|
|
3577
|
-
const
|
|
3578
|
-
|
|
3579
|
-
} else if (k =
|
|
3580
|
-
|
|
3122
|
+
const C = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3123
|
+
R = (0, t._)`${R}${C} ${_} = ${k};${this.opts._n}`;
|
|
3124
|
+
} else if (k = E == null ? void 0 : E(_))
|
|
3125
|
+
R = (0, t._)`${R}${k}${this.opts._n}`;
|
|
3581
3126
|
else
|
|
3582
3127
|
throw new r(_);
|
|
3583
|
-
|
|
3128
|
+
g.set(_, n.Completed);
|
|
3584
3129
|
});
|
|
3585
3130
|
}
|
|
3586
|
-
return
|
|
3131
|
+
return R;
|
|
3587
3132
|
}
|
|
3588
3133
|
}
|
|
3589
3134
|
e.ValueScope = l;
|
|
@@ -3643,8 +3188,8 @@ var scope = {};
|
|
|
3643
3188
|
super(), this.varKind = o, this.name = h, this.rhs = N;
|
|
3644
3189
|
}
|
|
3645
3190
|
render({ es5: o, _n: h }) {
|
|
3646
|
-
const N = o ? r.varKinds.var : this.varKind,
|
|
3647
|
-
return `${N} ${this.name}${
|
|
3191
|
+
const N = o ? r.varKinds.var : this.varKind, M = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
3192
|
+
return `${N} ${this.name}${M};` + h;
|
|
3648
3193
|
}
|
|
3649
3194
|
optimizeNames(o, h) {
|
|
3650
3195
|
if (o[this.name.str])
|
|
@@ -3671,14 +3216,14 @@ var scope = {};
|
|
|
3671
3216
|
}
|
|
3672
3217
|
}
|
|
3673
3218
|
class p extends l {
|
|
3674
|
-
constructor(o, h, N,
|
|
3675
|
-
super(o, N,
|
|
3219
|
+
constructor(o, h, N, M) {
|
|
3220
|
+
super(o, N, M), this.op = h;
|
|
3676
3221
|
}
|
|
3677
3222
|
render({ _n: o }) {
|
|
3678
3223
|
return `${this.lhs} ${this.op}= ${this.rhs};` + o;
|
|
3679
3224
|
}
|
|
3680
3225
|
}
|
|
3681
|
-
class
|
|
3226
|
+
class u extends i {
|
|
3682
3227
|
constructor(o) {
|
|
3683
3228
|
super(), this.label = o, this.names = {};
|
|
3684
3229
|
}
|
|
@@ -3686,7 +3231,7 @@ var scope = {};
|
|
|
3686
3231
|
return `${this.label}:` + o;
|
|
3687
3232
|
}
|
|
3688
3233
|
}
|
|
3689
|
-
class
|
|
3234
|
+
class d extends i {
|
|
3690
3235
|
constructor(o) {
|
|
3691
3236
|
super(), this.label = o, this.names = {};
|
|
3692
3237
|
}
|
|
@@ -3694,7 +3239,7 @@ var scope = {};
|
|
|
3694
3239
|
return `break${this.label ? ` ${this.label}` : ""};` + o;
|
|
3695
3240
|
}
|
|
3696
3241
|
}
|
|
3697
|
-
class
|
|
3242
|
+
class $ extends i {
|
|
3698
3243
|
constructor(o) {
|
|
3699
3244
|
super(), this.error = o;
|
|
3700
3245
|
}
|
|
@@ -3705,7 +3250,7 @@ var scope = {};
|
|
|
3705
3250
|
return this.error.names;
|
|
3706
3251
|
}
|
|
3707
3252
|
}
|
|
3708
|
-
class
|
|
3253
|
+
class E extends i {
|
|
3709
3254
|
constructor(o) {
|
|
3710
3255
|
super(), this.code = o;
|
|
3711
3256
|
}
|
|
@@ -3722,7 +3267,7 @@ var scope = {};
|
|
|
3722
3267
|
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
3723
3268
|
}
|
|
3724
3269
|
}
|
|
3725
|
-
class
|
|
3270
|
+
class R extends i {
|
|
3726
3271
|
constructor(o = []) {
|
|
3727
3272
|
super(), this.nodes = o;
|
|
3728
3273
|
}
|
|
@@ -3740,10 +3285,10 @@ var scope = {};
|
|
|
3740
3285
|
}
|
|
3741
3286
|
optimizeNames(o, h) {
|
|
3742
3287
|
const { nodes: N } = this;
|
|
3743
|
-
let
|
|
3744
|
-
for (;
|
|
3745
|
-
const
|
|
3746
|
-
|
|
3288
|
+
let M = N.length;
|
|
3289
|
+
for (; M--; ) {
|
|
3290
|
+
const q = N[M];
|
|
3291
|
+
q.optimizeNames(o, h) || (ke(o, q.names), N.splice(M, 1));
|
|
3747
3292
|
}
|
|
3748
3293
|
return N.length > 0 ? this : void 0;
|
|
3749
3294
|
}
|
|
@@ -3751,16 +3296,16 @@ var scope = {};
|
|
|
3751
3296
|
return this.nodes.reduce((o, h) => K(o, h.names), {});
|
|
3752
3297
|
}
|
|
3753
3298
|
}
|
|
3754
|
-
class v extends
|
|
3299
|
+
class v extends R {
|
|
3755
3300
|
render(o) {
|
|
3756
3301
|
return "{" + o._n + super.render(o) + "}" + o._n;
|
|
3757
3302
|
}
|
|
3758
3303
|
}
|
|
3759
|
-
class
|
|
3304
|
+
class T extends R {
|
|
3760
3305
|
}
|
|
3761
|
-
class
|
|
3306
|
+
class g extends v {
|
|
3762
3307
|
}
|
|
3763
|
-
|
|
3308
|
+
g.kind = "else";
|
|
3764
3309
|
class _ extends v {
|
|
3765
3310
|
constructor(o, h) {
|
|
3766
3311
|
super(h), this.condition = o;
|
|
@@ -3777,10 +3322,10 @@ var scope = {};
|
|
|
3777
3322
|
let h = this.else;
|
|
3778
3323
|
if (h) {
|
|
3779
3324
|
const N = h.optimizeNodes();
|
|
3780
|
-
h = this.else = Array.isArray(N) ? new
|
|
3325
|
+
h = this.else = Array.isArray(N) ? new g(N) : N;
|
|
3781
3326
|
}
|
|
3782
3327
|
if (h)
|
|
3783
|
-
return o === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(
|
|
3328
|
+
return o === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(Ce(o), h instanceof _ ? [h] : h.nodes);
|
|
3784
3329
|
if (!(o === !1 || !this.nodes.length))
|
|
3785
3330
|
return this;
|
|
3786
3331
|
}
|
|
@@ -3798,7 +3343,7 @@ var scope = {};
|
|
|
3798
3343
|
class k extends v {
|
|
3799
3344
|
}
|
|
3800
3345
|
k.kind = "for";
|
|
3801
|
-
class
|
|
3346
|
+
class C extends k {
|
|
3802
3347
|
constructor(o) {
|
|
3803
3348
|
super(), this.iteration = o;
|
|
3804
3349
|
}
|
|
@@ -3814,12 +3359,12 @@ var scope = {};
|
|
|
3814
3359
|
}
|
|
3815
3360
|
}
|
|
3816
3361
|
class I extends k {
|
|
3817
|
-
constructor(o, h, N,
|
|
3818
|
-
super(), this.varKind = o, this.name = h, this.from = N, this.to =
|
|
3362
|
+
constructor(o, h, N, M) {
|
|
3363
|
+
super(), this.varKind = o, this.name = h, this.from = N, this.to = M;
|
|
3819
3364
|
}
|
|
3820
3365
|
render(o) {
|
|
3821
|
-
const h = o.es5 ? r.varKinds.var : this.varKind, { name: N, from:
|
|
3822
|
-
return `for(${h} ${N}=${
|
|
3366
|
+
const h = o.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: q } = this;
|
|
3367
|
+
return `for(${h} ${N}=${M}; ${N}<${q}; ${N}++)` + super.render(o);
|
|
3823
3368
|
}
|
|
3824
3369
|
get names() {
|
|
3825
3370
|
const o = ue(super.names, this.from);
|
|
@@ -3827,8 +3372,8 @@ var scope = {};
|
|
|
3827
3372
|
}
|
|
3828
3373
|
}
|
|
3829
3374
|
class A extends k {
|
|
3830
|
-
constructor(o, h, N,
|
|
3831
|
-
super(), this.loop = o, this.varKind = h, this.name = N, this.iterable =
|
|
3375
|
+
constructor(o, h, N, M) {
|
|
3376
|
+
super(), this.loop = o, this.varKind = h, this.name = N, this.iterable = M;
|
|
3832
3377
|
}
|
|
3833
3378
|
render(o) {
|
|
3834
3379
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(o);
|
|
@@ -3850,12 +3395,12 @@ var scope = {};
|
|
|
3850
3395
|
}
|
|
3851
3396
|
}
|
|
3852
3397
|
w.kind = "func";
|
|
3853
|
-
class
|
|
3398
|
+
class O extends R {
|
|
3854
3399
|
render(o) {
|
|
3855
3400
|
return "return " + super.render(o);
|
|
3856
3401
|
}
|
|
3857
3402
|
}
|
|
3858
|
-
|
|
3403
|
+
O.kind = "return";
|
|
3859
3404
|
class D extends v {
|
|
3860
3405
|
render(o) {
|
|
3861
3406
|
let h = "try" + super.render(o);
|
|
@@ -3866,8 +3411,8 @@ var scope = {};
|
|
|
3866
3411
|
return super.optimizeNodes(), (o = this.catch) === null || o === void 0 || o.optimizeNodes(), (h = this.finally) === null || h === void 0 || h.optimizeNodes(), this;
|
|
3867
3412
|
}
|
|
3868
3413
|
optimizeNames(o, h) {
|
|
3869
|
-
var N,
|
|
3870
|
-
return super.optimizeNames(o, h), (N = this.catch) === null || N === void 0 || N.optimizeNames(o, h), (
|
|
3414
|
+
var N, M;
|
|
3415
|
+
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
3416
|
}
|
|
3872
3417
|
get names() {
|
|
3873
3418
|
const o = super.names;
|
|
@@ -3883,16 +3428,16 @@ var scope = {};
|
|
|
3883
3428
|
}
|
|
3884
3429
|
}
|
|
3885
3430
|
z.kind = "catch";
|
|
3886
|
-
class
|
|
3431
|
+
class x extends v {
|
|
3887
3432
|
render(o) {
|
|
3888
3433
|
return "finally" + super.render(o);
|
|
3889
3434
|
}
|
|
3890
3435
|
}
|
|
3891
|
-
|
|
3436
|
+
x.kind = "finally";
|
|
3892
3437
|
class re {
|
|
3893
3438
|
constructor(o, h = {}) {
|
|
3894
3439
|
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
|
|
3440
|
+
` : "" }, this._extScope = o, this._scope = new r.Scope({ parent: o }), this._nodes = [new T()];
|
|
3896
3441
|
}
|
|
3897
3442
|
toString() {
|
|
3898
3443
|
return this._root.render(this.opts);
|
|
@@ -3921,9 +3466,9 @@ var scope = {};
|
|
|
3921
3466
|
scopeCode() {
|
|
3922
3467
|
return this._extScope.scopeCode(this._values);
|
|
3923
3468
|
}
|
|
3924
|
-
_def(o, h, N,
|
|
3925
|
-
const
|
|
3926
|
-
return N !== void 0 &&
|
|
3469
|
+
_def(o, h, N, M) {
|
|
3470
|
+
const q = this._scope.toName(h);
|
|
3471
|
+
return N !== void 0 && M && (this._constants[q.str] = N), this._leafNode(new a(o, q, N)), q;
|
|
3927
3472
|
}
|
|
3928
3473
|
// `const` declaration (`var` in es5 mode)
|
|
3929
3474
|
const(o, h, N) {
|
|
@@ -3947,13 +3492,13 @@ var scope = {};
|
|
|
3947
3492
|
}
|
|
3948
3493
|
// appends passed SafeExpr to code or executes Block
|
|
3949
3494
|
code(o) {
|
|
3950
|
-
return typeof o == "function" ? o() : o !== t.nil && this._leafNode(new
|
|
3495
|
+
return typeof o == "function" ? o() : o !== t.nil && this._leafNode(new E(o)), this;
|
|
3951
3496
|
}
|
|
3952
3497
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
3953
3498
|
object(...o) {
|
|
3954
3499
|
const h = ["{"];
|
|
3955
|
-
for (const [N,
|
|
3956
|
-
h.length > 1 && h.push(","), h.push(N), (N !==
|
|
3500
|
+
for (const [N, M] of o)
|
|
3501
|
+
h.length > 1 && h.push(","), h.push(N), (N !== M || this.opts.es5) && (h.push(":"), (0, t.addCodeArg)(h, M));
|
|
3957
3502
|
return h.push("}"), new t._Code(h);
|
|
3958
3503
|
}
|
|
3959
3504
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
@@ -3972,42 +3517,42 @@ var scope = {};
|
|
|
3972
3517
|
}
|
|
3973
3518
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3974
3519
|
else() {
|
|
3975
|
-
return this._elseNode(new
|
|
3520
|
+
return this._elseNode(new g());
|
|
3976
3521
|
}
|
|
3977
3522
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3978
3523
|
endIf() {
|
|
3979
|
-
return this._endBlockNode(_,
|
|
3524
|
+
return this._endBlockNode(_, g);
|
|
3980
3525
|
}
|
|
3981
3526
|
_for(o, h) {
|
|
3982
3527
|
return this._blockNode(o), h && this.code(h).endFor(), this;
|
|
3983
3528
|
}
|
|
3984
3529
|
// a generic `for` clause (or statement if `forBody` is passed)
|
|
3985
3530
|
for(o, h) {
|
|
3986
|
-
return this._for(new
|
|
3531
|
+
return this._for(new C(o), h);
|
|
3987
3532
|
}
|
|
3988
3533
|
// `for` statement for a range of values
|
|
3989
|
-
forRange(o, h, N,
|
|
3990
|
-
const
|
|
3991
|
-
return this._for(new I(
|
|
3534
|
+
forRange(o, h, N, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3535
|
+
const W = this._scope.toName(o);
|
|
3536
|
+
return this._for(new I(q, W, h, N), () => M(W));
|
|
3992
3537
|
}
|
|
3993
3538
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3994
|
-
forOf(o, h, N,
|
|
3995
|
-
const
|
|
3539
|
+
forOf(o, h, N, M = r.varKinds.const) {
|
|
3540
|
+
const q = this._scope.toName(o);
|
|
3996
3541
|
if (this.opts.es5) {
|
|
3997
|
-
const
|
|
3998
|
-
return this.forRange("_i", 0, (0, t._)`${
|
|
3999
|
-
this.var(
|
|
3542
|
+
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3543
|
+
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3544
|
+
this.var(q, (0, t._)`${W}[${G}]`), N(q);
|
|
4000
3545
|
});
|
|
4001
3546
|
}
|
|
4002
|
-
return this._for(new A("of",
|
|
3547
|
+
return this._for(new A("of", M, q, h), () => N(q));
|
|
4003
3548
|
}
|
|
4004
3549
|
// `for-in` statement.
|
|
4005
3550
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
4006
|
-
forIn(o, h, N,
|
|
3551
|
+
forIn(o, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
4007
3552
|
if (this.opts.ownProperties)
|
|
4008
3553
|
return this.forOf(o, (0, t._)`Object.keys(${h})`, N);
|
|
4009
|
-
const
|
|
4010
|
-
return this._for(new A("in",
|
|
3554
|
+
const q = this._scope.toName(o);
|
|
3555
|
+
return this._for(new A("in", M, q, h), () => N(q));
|
|
4011
3556
|
}
|
|
4012
3557
|
// end `for` loop
|
|
4013
3558
|
endFor() {
|
|
@@ -4015,33 +3560,33 @@ var scope = {};
|
|
|
4015
3560
|
}
|
|
4016
3561
|
// `label` statement
|
|
4017
3562
|
label(o) {
|
|
4018
|
-
return this._leafNode(new
|
|
3563
|
+
return this._leafNode(new u(o));
|
|
4019
3564
|
}
|
|
4020
3565
|
// `break` statement
|
|
4021
3566
|
break(o) {
|
|
4022
|
-
return this._leafNode(new
|
|
3567
|
+
return this._leafNode(new d(o));
|
|
4023
3568
|
}
|
|
4024
3569
|
// `return` statement
|
|
4025
3570
|
return(o) {
|
|
4026
|
-
const h = new
|
|
3571
|
+
const h = new O();
|
|
4027
3572
|
if (this._blockNode(h), this.code(o), h.nodes.length !== 1)
|
|
4028
3573
|
throw new Error('CodeGen: "return" should have one node');
|
|
4029
|
-
return this._endBlockNode(
|
|
3574
|
+
return this._endBlockNode(O);
|
|
4030
3575
|
}
|
|
4031
3576
|
// `try` statement
|
|
4032
3577
|
try(o, h, N) {
|
|
4033
3578
|
if (!h && !N)
|
|
4034
3579
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
4035
|
-
const
|
|
4036
|
-
if (this._blockNode(
|
|
4037
|
-
const
|
|
4038
|
-
this._currNode =
|
|
3580
|
+
const M = new D();
|
|
3581
|
+
if (this._blockNode(M), this.code(o), h) {
|
|
3582
|
+
const q = this.name("e");
|
|
3583
|
+
this._currNode = M.catch = new z(q), h(q);
|
|
4039
3584
|
}
|
|
4040
|
-
return N && (this._currNode =
|
|
3585
|
+
return N && (this._currNode = M.finally = new x(), this.code(N)), this._endBlockNode(z, x);
|
|
4041
3586
|
}
|
|
4042
3587
|
// `throw` statement
|
|
4043
3588
|
throw(o) {
|
|
4044
|
-
return this._leafNode(new
|
|
3589
|
+
return this._leafNode(new $(o));
|
|
4045
3590
|
}
|
|
4046
3591
|
// start self-balancing block
|
|
4047
3592
|
block(o, h) {
|
|
@@ -4058,8 +3603,8 @@ var scope = {};
|
|
|
4058
3603
|
return this._nodes.length = h, this;
|
|
4059
3604
|
}
|
|
4060
3605
|
// `function` heading (or definition if funcBody is passed)
|
|
4061
|
-
func(o, h = t.nil, N,
|
|
4062
|
-
return this._blockNode(new w(o, h, N)),
|
|
3606
|
+
func(o, h = t.nil, N, M) {
|
|
3607
|
+
return this._blockNode(new w(o, h, N)), M && this.code(M).endFunc(), this;
|
|
4063
3608
|
}
|
|
4064
3609
|
// end function definition
|
|
4065
3610
|
endFunc() {
|
|
@@ -4111,33 +3656,33 @@ var scope = {};
|
|
|
4111
3656
|
function oe(P, o, h) {
|
|
4112
3657
|
if (P instanceof t.Name)
|
|
4113
3658
|
return N(P);
|
|
4114
|
-
if (!
|
|
3659
|
+
if (!M(P))
|
|
4115
3660
|
return P;
|
|
4116
|
-
return new t._Code(P._items.reduce((
|
|
4117
|
-
function N(
|
|
4118
|
-
const
|
|
4119
|
-
return
|
|
3661
|
+
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), []));
|
|
3662
|
+
function N(q) {
|
|
3663
|
+
const W = h[q.str];
|
|
3664
|
+
return W === void 0 || o[q.str] !== 1 ? q : (delete o[q.str], W);
|
|
4120
3665
|
}
|
|
4121
|
-
function q
|
|
4122
|
-
return
|
|
3666
|
+
function M(q) {
|
|
3667
|
+
return q instanceof t._Code && q._items.some((W) => W instanceof t.Name && o[W.str] === 1 && h[W.str] !== void 0);
|
|
4123
3668
|
}
|
|
4124
3669
|
}
|
|
4125
3670
|
function ke(P, o) {
|
|
4126
3671
|
for (const h in o)
|
|
4127
3672
|
P[h] = (P[h] || 0) - (o[h] || 0);
|
|
4128
3673
|
}
|
|
4129
|
-
function
|
|
3674
|
+
function Ce(P) {
|
|
4130
3675
|
return typeof P == "boolean" || typeof P == "number" || P === null ? !P : (0, t._)`!${j(P)}`;
|
|
4131
3676
|
}
|
|
4132
|
-
e.not =
|
|
3677
|
+
e.not = Ce;
|
|
4133
3678
|
const qe = y(e.operators.AND);
|
|
4134
3679
|
function et(...P) {
|
|
4135
3680
|
return P.reduce(qe);
|
|
4136
3681
|
}
|
|
4137
3682
|
e.and = et;
|
|
4138
|
-
const
|
|
3683
|
+
const Ue = y(e.operators.OR);
|
|
4139
3684
|
function F(...P) {
|
|
4140
|
-
return P.reduce(
|
|
3685
|
+
return P.reduce(Ue);
|
|
4141
3686
|
}
|
|
4142
3687
|
e.or = F;
|
|
4143
3688
|
function y(P) {
|
|
@@ -4152,137 +3697,137 @@ var util = {};
|
|
|
4152
3697
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.checkStrictMode = e.getErrorPath = e.Type = e.useFunc = e.setEvaluated = e.evaluatedPropsToName = e.mergeEvaluated = e.eachItem = e.unescapeJsonPointer = e.escapeJsonPointer = e.escapeFragment = e.unescapeFragment = e.schemaRefOrVal = e.schemaHasRulesButRef = e.schemaHasRules = e.checkUnknownRules = e.alwaysValidSchema = e.toHash = void 0;
|
|
4153
3698
|
const t = codegen, r = code$1;
|
|
4154
3699
|
function n(w) {
|
|
4155
|
-
const
|
|
3700
|
+
const O = {};
|
|
4156
3701
|
for (const D of w)
|
|
4157
|
-
|
|
4158
|
-
return
|
|
3702
|
+
O[D] = !0;
|
|
3703
|
+
return O;
|
|
4159
3704
|
}
|
|
4160
3705
|
e.toHash = n;
|
|
4161
|
-
function s(w,
|
|
4162
|
-
return typeof
|
|
3706
|
+
function s(w, O) {
|
|
3707
|
+
return typeof O == "boolean" ? O : Object.keys(O).length === 0 ? !0 : (i(w, O), !a(O, w.self.RULES.all));
|
|
4163
3708
|
}
|
|
4164
3709
|
e.alwaysValidSchema = s;
|
|
4165
|
-
function i(w,
|
|
3710
|
+
function i(w, O = w.schema) {
|
|
4166
3711
|
const { opts: D, self: z } = w;
|
|
4167
|
-
if (!D.strictSchema || typeof
|
|
3712
|
+
if (!D.strictSchema || typeof O == "boolean")
|
|
4168
3713
|
return;
|
|
4169
|
-
const
|
|
4170
|
-
for (const re in
|
|
4171
|
-
|
|
3714
|
+
const x = z.RULES.keywords;
|
|
3715
|
+
for (const re in O)
|
|
3716
|
+
x[re] || A(w, `unknown keyword: "${re}"`);
|
|
4172
3717
|
}
|
|
4173
3718
|
e.checkUnknownRules = i;
|
|
4174
|
-
function a(w,
|
|
3719
|
+
function a(w, O) {
|
|
4175
3720
|
if (typeof w == "boolean")
|
|
4176
3721
|
return !w;
|
|
4177
3722
|
for (const D in w)
|
|
4178
|
-
if (
|
|
3723
|
+
if (O[D])
|
|
4179
3724
|
return !0;
|
|
4180
3725
|
return !1;
|
|
4181
3726
|
}
|
|
4182
3727
|
e.schemaHasRules = a;
|
|
4183
|
-
function l(w,
|
|
3728
|
+
function l(w, O) {
|
|
4184
3729
|
if (typeof w == "boolean")
|
|
4185
3730
|
return !w;
|
|
4186
3731
|
for (const D in w)
|
|
4187
|
-
if (D !== "$ref" &&
|
|
3732
|
+
if (D !== "$ref" && O.all[D])
|
|
4188
3733
|
return !0;
|
|
4189
3734
|
return !1;
|
|
4190
3735
|
}
|
|
4191
3736
|
e.schemaHasRulesButRef = l;
|
|
4192
|
-
function p({ topSchemaRef: w, schemaPath:
|
|
4193
|
-
if (!
|
|
3737
|
+
function p({ topSchemaRef: w, schemaPath: O }, D, z, x) {
|
|
3738
|
+
if (!x) {
|
|
4194
3739
|
if (typeof D == "number" || typeof D == "boolean")
|
|
4195
3740
|
return D;
|
|
4196
3741
|
if (typeof D == "string")
|
|
4197
3742
|
return (0, t._)`${D}`;
|
|
4198
3743
|
}
|
|
4199
|
-
return (0, t._)`${w}${
|
|
3744
|
+
return (0, t._)`${w}${O}${(0, t.getProperty)(z)}`;
|
|
4200
3745
|
}
|
|
4201
3746
|
e.schemaRefOrVal = p;
|
|
4202
|
-
function d(w) {
|
|
4203
|
-
return S(decodeURIComponent(w));
|
|
4204
|
-
}
|
|
4205
|
-
e.unescapeFragment = d;
|
|
4206
3747
|
function u(w) {
|
|
4207
|
-
return
|
|
3748
|
+
return E(decodeURIComponent(w));
|
|
3749
|
+
}
|
|
3750
|
+
e.unescapeFragment = u;
|
|
3751
|
+
function d(w) {
|
|
3752
|
+
return encodeURIComponent($(w));
|
|
4208
3753
|
}
|
|
4209
|
-
e.escapeFragment =
|
|
4210
|
-
function
|
|
3754
|
+
e.escapeFragment = d;
|
|
3755
|
+
function $(w) {
|
|
4211
3756
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
4212
3757
|
}
|
|
4213
|
-
e.escapeJsonPointer =
|
|
4214
|
-
function
|
|
3758
|
+
e.escapeJsonPointer = $;
|
|
3759
|
+
function E(w) {
|
|
4215
3760
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
4216
3761
|
}
|
|
4217
|
-
e.unescapeJsonPointer =
|
|
4218
|
-
function
|
|
3762
|
+
e.unescapeJsonPointer = E;
|
|
3763
|
+
function R(w, O) {
|
|
4219
3764
|
if (Array.isArray(w))
|
|
4220
3765
|
for (const D of w)
|
|
4221
|
-
|
|
3766
|
+
O(D);
|
|
4222
3767
|
else
|
|
4223
|
-
|
|
3768
|
+
O(w);
|
|
4224
3769
|
}
|
|
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(
|
|
3770
|
+
e.eachItem = R;
|
|
3771
|
+
function v({ mergeNames: w, mergeToName: O, mergeValues: D, resultToName: z }) {
|
|
3772
|
+
return (x, re, K, ue) => {
|
|
3773
|
+
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);
|
|
3774
|
+
return ue === t.Name && !(oe instanceof t.Name) ? z(x, oe) : oe;
|
|
4230
3775
|
};
|
|
4231
3776
|
}
|
|
4232
3777
|
e.mergeEvaluated = {
|
|
4233
3778
|
props: v({
|
|
4234
|
-
mergeNames: (w,
|
|
4235
|
-
w.if((0, t._)`${
|
|
3779
|
+
mergeNames: (w, O, D) => w.if((0, t._)`${D} !== true && ${O} !== undefined`, () => {
|
|
3780
|
+
w.if((0, t._)`${O} === true`, () => w.assign(D, !0), () => w.assign(D, (0, t._)`${D} || {}`).code((0, t._)`Object.assign(${D}, ${O})`));
|
|
4236
3781
|
}),
|
|
4237
|
-
mergeToName: (w,
|
|
4238
|
-
|
|
3782
|
+
mergeToName: (w, O, D) => w.if((0, t._)`${D} !== true`, () => {
|
|
3783
|
+
O === !0 ? w.assign(D, !0) : (w.assign(D, (0, t._)`${D} || {}`), g(w, D, O));
|
|
4239
3784
|
}),
|
|
4240
|
-
mergeValues: (w,
|
|
4241
|
-
resultToName:
|
|
3785
|
+
mergeValues: (w, O) => w === !0 ? !0 : { ...w, ...O },
|
|
3786
|
+
resultToName: T
|
|
4242
3787
|
}),
|
|
4243
3788
|
items: v({
|
|
4244
|
-
mergeNames: (w,
|
|
4245
|
-
mergeToName: (w,
|
|
4246
|
-
mergeValues: (w,
|
|
4247
|
-
resultToName: (w,
|
|
3789
|
+
mergeNames: (w, O, D) => w.if((0, t._)`${D} !== true && ${O} !== undefined`, () => w.assign(D, (0, t._)`${O} === true ? true : ${D} > ${O} ? ${D} : ${O}`)),
|
|
3790
|
+
mergeToName: (w, O, D) => w.if((0, t._)`${D} !== true`, () => w.assign(D, O === !0 ? !0 : (0, t._)`${D} > ${O} ? ${D} : ${O}`)),
|
|
3791
|
+
mergeValues: (w, O) => w === !0 ? !0 : Math.max(w, O),
|
|
3792
|
+
resultToName: (w, O) => w.var("items", O)
|
|
4248
3793
|
})
|
|
4249
3794
|
};
|
|
4250
|
-
function
|
|
4251
|
-
if (
|
|
3795
|
+
function T(w, O) {
|
|
3796
|
+
if (O === !0)
|
|
4252
3797
|
return w.var("props", !0);
|
|
4253
3798
|
const D = w.var("props", (0, t._)`{}`);
|
|
4254
|
-
return
|
|
3799
|
+
return O !== void 0 && g(w, D, O), D;
|
|
4255
3800
|
}
|
|
4256
|
-
e.evaluatedPropsToName =
|
|
4257
|
-
function
|
|
4258
|
-
Object.keys(D).forEach((z) => w.assign((0, t._)`${
|
|
3801
|
+
e.evaluatedPropsToName = T;
|
|
3802
|
+
function g(w, O, D) {
|
|
3803
|
+
Object.keys(D).forEach((z) => w.assign((0, t._)`${O}${(0, t.getProperty)(z)}`, !0));
|
|
4259
3804
|
}
|
|
4260
|
-
e.setEvaluated =
|
|
3805
|
+
e.setEvaluated = g;
|
|
4261
3806
|
const _ = {};
|
|
4262
|
-
function k(w,
|
|
3807
|
+
function k(w, O) {
|
|
4263
3808
|
return w.scopeValue("func", {
|
|
4264
|
-
ref:
|
|
4265
|
-
code: _[
|
|
3809
|
+
ref: O,
|
|
3810
|
+
code: _[O.code] || (_[O.code] = new r._Code(O.code))
|
|
4266
3811
|
});
|
|
4267
3812
|
}
|
|
4268
3813
|
e.useFunc = k;
|
|
4269
|
-
var
|
|
3814
|
+
var C;
|
|
4270
3815
|
(function(w) {
|
|
4271
3816
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
4272
|
-
})(
|
|
4273
|
-
function I(w,
|
|
3817
|
+
})(C = e.Type || (e.Type = {}));
|
|
3818
|
+
function I(w, O, D) {
|
|
4274
3819
|
if (w instanceof t.Name) {
|
|
4275
|
-
const z =
|
|
3820
|
+
const z = O === C.Num;
|
|
4276
3821
|
return D ? z ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : z ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
4277
3822
|
}
|
|
4278
|
-
return D ? (0, t.getProperty)(w).toString() : "/" +
|
|
3823
|
+
return D ? (0, t.getProperty)(w).toString() : "/" + $(w);
|
|
4279
3824
|
}
|
|
4280
3825
|
e.getErrorPath = I;
|
|
4281
|
-
function A(w,
|
|
3826
|
+
function A(w, O, D = w.opts.strictSchema) {
|
|
4282
3827
|
if (D) {
|
|
4283
|
-
if (
|
|
4284
|
-
throw new Error(
|
|
4285
|
-
w.self.logger.warn(
|
|
3828
|
+
if (O = `strict mode: ${O}`, D === !0)
|
|
3829
|
+
throw new Error(O);
|
|
3830
|
+
w.self.logger.warn(O);
|
|
4286
3831
|
}
|
|
4287
3832
|
}
|
|
4288
3833
|
e.checkStrictMode = A;
|
|
@@ -4317,42 +3862,42 @@ names$1.default = names;
|
|
|
4317
3862
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
4318
3863
|
const t = codegen, r = util, n = names$1;
|
|
4319
3864
|
e.keywordError = {
|
|
4320
|
-
message: ({ keyword:
|
|
3865
|
+
message: ({ keyword: g }) => (0, t.str)`must pass "${g}" keyword validation`
|
|
4321
3866
|
}, e.keyword$DataError = {
|
|
4322
|
-
message: ({ keyword:
|
|
3867
|
+
message: ({ keyword: g, schemaType: _ }) => _ ? (0, t.str)`"${g}" keyword must be ${_} ($data)` : (0, t.str)`"${g}" keyword is invalid ($data)`
|
|
4323
3868
|
};
|
|
4324
|
-
function s(
|
|
4325
|
-
const { it: I } =
|
|
4326
|
-
|
|
3869
|
+
function s(g, _ = e.keywordError, k, C) {
|
|
3870
|
+
const { it: I } = g, { gen: A, compositeRule: w, allErrors: O } = I, D = $(g, _, k);
|
|
3871
|
+
C ?? (w || O) ? p(A, D) : u(I, (0, t._)`[${D}]`);
|
|
4327
3872
|
}
|
|
4328
3873
|
e.reportError = s;
|
|
4329
|
-
function i(
|
|
4330
|
-
const { it:
|
|
4331
|
-
p(I,
|
|
3874
|
+
function i(g, _ = e.keywordError, k) {
|
|
3875
|
+
const { it: C } = g, { gen: I, compositeRule: A, allErrors: w } = C, O = $(g, _, k);
|
|
3876
|
+
p(I, O), A || w || u(C, n.default.vErrors);
|
|
4332
3877
|
}
|
|
4333
3878
|
e.reportExtraError = i;
|
|
4334
|
-
function a(
|
|
4335
|
-
|
|
3879
|
+
function a(g, _) {
|
|
3880
|
+
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
3881
|
}
|
|
4337
3882
|
e.resetErrorsCount = a;
|
|
4338
|
-
function l({ gen:
|
|
3883
|
+
function l({ gen: g, keyword: _, schemaValue: k, data: C, errsCount: I, it: A }) {
|
|
4339
3884
|
if (I === void 0)
|
|
4340
3885
|
throw new Error("ajv implementation error");
|
|
4341
|
-
const w =
|
|
4342
|
-
|
|
4343
|
-
|
|
3886
|
+
const w = g.name("err");
|
|
3887
|
+
g.forRange("i", I, n.default.errors, (O) => {
|
|
3888
|
+
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
3889
|
});
|
|
4345
3890
|
}
|
|
4346
3891
|
e.extendErrors = l;
|
|
4347
|
-
function p(
|
|
4348
|
-
const k =
|
|
4349
|
-
|
|
3892
|
+
function p(g, _) {
|
|
3893
|
+
const k = g.const("err", _);
|
|
3894
|
+
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
3895
|
}
|
|
4351
|
-
function
|
|
4352
|
-
const { gen: k, validateName:
|
|
4353
|
-
I.$async ? k.throw((0, t._)`new ${
|
|
3896
|
+
function u(g, _) {
|
|
3897
|
+
const { gen: k, validateName: C, schemaEnv: I } = g;
|
|
3898
|
+
I.$async ? k.throw((0, t._)`new ${g.ValidationError}(${_})`) : (k.assign((0, t._)`${C}.errors`, _), k.return(!1));
|
|
4354
3899
|
}
|
|
4355
|
-
const
|
|
3900
|
+
const d = {
|
|
4356
3901
|
keyword: new t.Name("keyword"),
|
|
4357
3902
|
schemaPath: new t.Name("schemaPath"),
|
|
4358
3903
|
params: new t.Name("params"),
|
|
@@ -4361,28 +3906,28 @@ names$1.default = names;
|
|
|
4361
3906
|
schema: new t.Name("schema"),
|
|
4362
3907
|
parentSchema: new t.Name("parentSchema")
|
|
4363
3908
|
};
|
|
4364
|
-
function g
|
|
4365
|
-
const { createErrors:
|
|
4366
|
-
return
|
|
4367
|
-
}
|
|
4368
|
-
function
|
|
4369
|
-
const { gen:
|
|
4370
|
-
|
|
4371
|
-
v(
|
|
3909
|
+
function $(g, _, k) {
|
|
3910
|
+
const { createErrors: C } = g.it;
|
|
3911
|
+
return C === !1 ? (0, t._)`{}` : E(g, _, k);
|
|
3912
|
+
}
|
|
3913
|
+
function E(g, _, k = {}) {
|
|
3914
|
+
const { gen: C, it: I } = g, A = [
|
|
3915
|
+
R(I, k),
|
|
3916
|
+
v(g, k)
|
|
4372
3917
|
];
|
|
4373
|
-
return
|
|
3918
|
+
return T(g, _, A), C.object(...A);
|
|
4374
3919
|
}
|
|
4375
|
-
function
|
|
4376
|
-
const k = _ ? (0, t.str)`${
|
|
3920
|
+
function R({ errorPath: g }, { instancePath: _ }) {
|
|
3921
|
+
const k = _ ? (0, t.str)`${g}${(0, r.getErrorPath)(_, r.Type.Str)}` : g;
|
|
4377
3922
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, k)];
|
|
4378
3923
|
}
|
|
4379
|
-
function v({ keyword:
|
|
4380
|
-
let I =
|
|
4381
|
-
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [
|
|
3924
|
+
function v({ keyword: g, it: { errSchemaPath: _ } }, { schemaPath: k, parentSchema: C }) {
|
|
3925
|
+
let I = C ? _ : (0, t.str)`${_}/${g}`;
|
|
3926
|
+
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [d.schemaPath, I];
|
|
4382
3927
|
}
|
|
4383
|
-
function
|
|
4384
|
-
const { keyword: I, data: A, schemaValue: w, it:
|
|
4385
|
-
|
|
3928
|
+
function T(g, { params: _, message: k }, C) {
|
|
3929
|
+
const { keyword: I, data: A, schemaValue: w, it: O } = g, { opts: D, propertyName: z, topSchemaRef: x, schemaPath: re } = O;
|
|
3930
|
+
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
3931
|
}
|
|
4387
3932
|
})(errors);
|
|
4388
3933
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4458,86 +4003,86 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4458
4003
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
|
|
4459
4004
|
const t = rules, r = applicability, n = errors, s = codegen, i = util;
|
|
4460
4005
|
var a;
|
|
4461
|
-
(function(
|
|
4462
|
-
|
|
4006
|
+
(function(C) {
|
|
4007
|
+
C[C.Correct = 0] = "Correct", C[C.Wrong = 1] = "Wrong";
|
|
4463
4008
|
})(a = e.DataType || (e.DataType = {}));
|
|
4464
|
-
function l(
|
|
4465
|
-
const I = p(
|
|
4009
|
+
function l(C) {
|
|
4010
|
+
const I = p(C.type);
|
|
4466
4011
|
if (I.includes("null")) {
|
|
4467
|
-
if (
|
|
4012
|
+
if (C.nullable === !1)
|
|
4468
4013
|
throw new Error("type: null contradicts nullable: false");
|
|
4469
4014
|
} else {
|
|
4470
|
-
if (!I.length &&
|
|
4015
|
+
if (!I.length && C.nullable !== void 0)
|
|
4471
4016
|
throw new Error('"nullable" cannot be used without "type"');
|
|
4472
|
-
|
|
4017
|
+
C.nullable === !0 && I.push("null");
|
|
4473
4018
|
}
|
|
4474
4019
|
return I;
|
|
4475
4020
|
}
|
|
4476
4021
|
e.getSchemaTypes = l;
|
|
4477
|
-
function p(
|
|
4478
|
-
const I = Array.isArray(
|
|
4022
|
+
function p(C) {
|
|
4023
|
+
const I = Array.isArray(C) ? C : C ? [C] : [];
|
|
4479
4024
|
if (I.every(t.isJSONType))
|
|
4480
4025
|
return I;
|
|
4481
4026
|
throw new Error("type must be JSONType or JSONType[]: " + I.join(","));
|
|
4482
4027
|
}
|
|
4483
4028
|
e.getJSONTypes = p;
|
|
4484
|
-
function
|
|
4485
|
-
const { gen: A, data: w, opts:
|
|
4029
|
+
function u(C, I) {
|
|
4030
|
+
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
4031
|
if (z) {
|
|
4487
|
-
const
|
|
4488
|
-
A.if(
|
|
4489
|
-
D.length ?
|
|
4032
|
+
const x = T(I, w, O.strictNumbers, a.Wrong);
|
|
4033
|
+
A.if(x, () => {
|
|
4034
|
+
D.length ? E(C, I, D) : _(C);
|
|
4490
4035
|
});
|
|
4491
4036
|
}
|
|
4492
4037
|
return z;
|
|
4493
4038
|
}
|
|
4494
|
-
e.coerceAndCheckDataType =
|
|
4495
|
-
const
|
|
4496
|
-
function
|
|
4497
|
-
return I ?
|
|
4039
|
+
e.coerceAndCheckDataType = u;
|
|
4040
|
+
const d = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4041
|
+
function $(C, I) {
|
|
4042
|
+
return I ? C.filter((A) => d.has(A) || I === "array" && A === "array") : [];
|
|
4498
4043
|
}
|
|
4499
|
-
function
|
|
4500
|
-
const { gen: w, data:
|
|
4501
|
-
D.coerceTypes === "array" && w.if((0, s._)`${z} == 'object' && Array.isArray(${
|
|
4044
|
+
function E(C, I, A) {
|
|
4045
|
+
const { gen: w, data: O, opts: D } = C, z = w.let("dataType", (0, s._)`typeof ${O}`), x = w.let("coerced", (0, s._)`undefined`);
|
|
4046
|
+
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
4047
|
for (const K of A)
|
|
4503
|
-
(
|
|
4504
|
-
w.else(), _(
|
|
4505
|
-
w.assign(
|
|
4048
|
+
(d.has(K) || K === "array" && D.coerceTypes === "array") && re(K);
|
|
4049
|
+
w.else(), _(C), w.endIf(), w.if((0, s._)`${x} !== undefined`, () => {
|
|
4050
|
+
w.assign(O, x), R(C, x);
|
|
4506
4051
|
});
|
|
4507
4052
|
function re(K) {
|
|
4508
4053
|
switch (K) {
|
|
4509
4054
|
case "string":
|
|
4510
|
-
w.elseIf((0, s._)`${z} == "number" || ${z} == "boolean"`).assign(
|
|
4055
|
+
w.elseIf((0, s._)`${z} == "number" || ${z} == "boolean"`).assign(x, (0, s._)`"" + ${O}`).elseIf((0, s._)`${O} === null`).assign(x, (0, s._)`""`);
|
|
4511
4056
|
return;
|
|
4512
4057
|
case "number":
|
|
4513
|
-
w.elseIf((0, s._)`${z} == "boolean" || ${
|
|
4514
|
-
|| (${z} == "string" && ${
|
|
4058
|
+
w.elseIf((0, s._)`${z} == "boolean" || ${O} === null
|
|
4059
|
+
|| (${z} == "string" && ${O} && ${O} == +${O})`).assign(x, (0, s._)`+${O}`);
|
|
4515
4060
|
return;
|
|
4516
4061
|
case "integer":
|
|
4517
|
-
w.elseIf((0, s._)`${z} === "boolean" || ${
|
|
4518
|
-
|| (${z} === "string" && ${
|
|
4062
|
+
w.elseIf((0, s._)`${z} === "boolean" || ${O} === null
|
|
4063
|
+
|| (${z} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(x, (0, s._)`+${O}`);
|
|
4519
4064
|
return;
|
|
4520
4065
|
case "boolean":
|
|
4521
|
-
w.elseIf((0, s._)`${
|
|
4066
|
+
w.elseIf((0, s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(x, !1).elseIf((0, s._)`${O} === "true" || ${O} === 1`).assign(x, !0);
|
|
4522
4067
|
return;
|
|
4523
4068
|
case "null":
|
|
4524
|
-
w.elseIf((0, s._)`${
|
|
4069
|
+
w.elseIf((0, s._)`${O} === "" || ${O} === 0 || ${O} === false`), w.assign(x, null);
|
|
4525
4070
|
return;
|
|
4526
4071
|
case "array":
|
|
4527
4072
|
w.elseIf((0, s._)`${z} === "string" || ${z} === "number"
|
|
4528
|
-
|| ${z} === "boolean" || ${
|
|
4073
|
+
|| ${z} === "boolean" || ${O} === null`).assign(x, (0, s._)`[${O}]`);
|
|
4529
4074
|
}
|
|
4530
4075
|
}
|
|
4531
4076
|
}
|
|
4532
|
-
function
|
|
4533
|
-
|
|
4077
|
+
function R({ gen: C, parentData: I, parentDataProperty: A }, w) {
|
|
4078
|
+
C.if((0, s._)`${I} !== undefined`, () => C.assign((0, s._)`${I}[${A}]`, w));
|
|
4534
4079
|
}
|
|
4535
|
-
function v(
|
|
4536
|
-
const
|
|
4080
|
+
function v(C, I, A, w = a.Correct) {
|
|
4081
|
+
const O = w === a.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4537
4082
|
let D;
|
|
4538
|
-
switch (
|
|
4083
|
+
switch (C) {
|
|
4539
4084
|
case "null":
|
|
4540
|
-
return (0, s._)`${I} ${
|
|
4085
|
+
return (0, s._)`${I} ${O} null`;
|
|
4541
4086
|
case "array":
|
|
4542
4087
|
D = (0, s._)`Array.isArray(${I})`;
|
|
4543
4088
|
break;
|
|
@@ -4551,51 +4096,51 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4551
4096
|
D = z();
|
|
4552
4097
|
break;
|
|
4553
4098
|
default:
|
|
4554
|
-
return (0, s._)`typeof ${I} ${
|
|
4099
|
+
return (0, s._)`typeof ${I} ${O} ${C}`;
|
|
4555
4100
|
}
|
|
4556
4101
|
return w === a.Correct ? D : (0, s.not)(D);
|
|
4557
|
-
function z(
|
|
4558
|
-
return (0, s.and)((0, s._)`typeof ${I} == "number"`,
|
|
4102
|
+
function z(x = s.nil) {
|
|
4103
|
+
return (0, s.and)((0, s._)`typeof ${I} == "number"`, x, A ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4559
4104
|
}
|
|
4560
4105
|
}
|
|
4561
4106
|
e.checkDataType = v;
|
|
4562
|
-
function
|
|
4563
|
-
if (
|
|
4564
|
-
return v(
|
|
4565
|
-
let
|
|
4566
|
-
const D = (0, i.toHash)(
|
|
4107
|
+
function T(C, I, A, w) {
|
|
4108
|
+
if (C.length === 1)
|
|
4109
|
+
return v(C[0], I, A, w);
|
|
4110
|
+
let O;
|
|
4111
|
+
const D = (0, i.toHash)(C);
|
|
4567
4112
|
if (D.array && D.object) {
|
|
4568
4113
|
const z = (0, s._)`typeof ${I} != "object"`;
|
|
4569
|
-
|
|
4114
|
+
O = D.null ? z : (0, s._)`!${I} || ${z}`, delete D.null, delete D.array, delete D.object;
|
|
4570
4115
|
} else
|
|
4571
|
-
|
|
4116
|
+
O = s.nil;
|
|
4572
4117
|
D.number && delete D.integer;
|
|
4573
4118
|
for (const z in D)
|
|
4574
|
-
|
|
4575
|
-
return
|
|
4119
|
+
O = (0, s.and)(O, v(z, I, A, w));
|
|
4120
|
+
return O;
|
|
4576
4121
|
}
|
|
4577
|
-
e.checkDataTypes =
|
|
4578
|
-
const
|
|
4579
|
-
message: ({ schema:
|
|
4580
|
-
params: ({ schema:
|
|
4122
|
+
e.checkDataTypes = T;
|
|
4123
|
+
const g = {
|
|
4124
|
+
message: ({ schema: C }) => `must be ${C}`,
|
|
4125
|
+
params: ({ schema: C, schemaValue: I }) => typeof C == "string" ? (0, s._)`{type: ${C}}` : (0, s._)`{type: ${I}}`
|
|
4581
4126
|
};
|
|
4582
|
-
function _(
|
|
4583
|
-
const I = k(
|
|
4584
|
-
(0, n.reportError)(I,
|
|
4127
|
+
function _(C) {
|
|
4128
|
+
const I = k(C);
|
|
4129
|
+
(0, n.reportError)(I, g);
|
|
4585
4130
|
}
|
|
4586
4131
|
e.reportTypeError = _;
|
|
4587
|
-
function k(
|
|
4588
|
-
const { gen: I, data: A, schema: w } =
|
|
4132
|
+
function k(C) {
|
|
4133
|
+
const { gen: I, data: A, schema: w } = C, O = (0, i.schemaRefOrVal)(C, w, "type");
|
|
4589
4134
|
return {
|
|
4590
4135
|
gen: I,
|
|
4591
4136
|
keyword: "type",
|
|
4592
4137
|
data: A,
|
|
4593
4138
|
schema: w.type,
|
|
4594
|
-
schemaCode:
|
|
4595
|
-
schemaValue:
|
|
4139
|
+
schemaCode: O,
|
|
4140
|
+
schemaValue: O,
|
|
4596
4141
|
parentSchema: w,
|
|
4597
4142
|
params: {},
|
|
4598
|
-
it:
|
|
4143
|
+
it: C
|
|
4599
4144
|
};
|
|
4600
4145
|
}
|
|
4601
4146
|
})(dataType);
|
|
@@ -4673,16 +4218,16 @@ function schemaProperties(e, t) {
|
|
|
4673
4218
|
return allSchemaProperties(t).filter((r) => !(0, util_1$o.alwaysValidSchema)(e, t[r]));
|
|
4674
4219
|
}
|
|
4675
4220
|
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
|
|
4221
|
+
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: a }, l, p, u) {
|
|
4222
|
+
const d = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, $ = [
|
|
4678
4223
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4679
4224
|
[names_1$5.default.parentData, a.parentData],
|
|
4680
4225
|
[names_1$5.default.parentDataProperty, a.parentDataProperty],
|
|
4681
4226
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4682
4227
|
];
|
|
4683
|
-
a.opts.dynamicRef &&
|
|
4684
|
-
const
|
|
4685
|
-
return p !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${p}, ${
|
|
4228
|
+
a.opts.dynamicRef && $.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4229
|
+
const E = (0, codegen_1$q._)`${d}, ${r.object(...$)}`;
|
|
4230
|
+
return p !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${p}, ${E})` : (0, codegen_1$q._)`${l}(${E})`;
|
|
4686
4231
|
}
|
|
4687
4232
|
code.callValidateCode = callValidateCode;
|
|
4688
4233
|
const newRegExp = (0, codegen_1$q._)`new RegExp`;
|
|
@@ -4704,10 +4249,10 @@ function validateArray(e) {
|
|
|
4704
4249
|
return t.var(i, !0), a(() => t.break()), i;
|
|
4705
4250
|
function a(l) {
|
|
4706
4251
|
const p = t.const("len", (0, codegen_1$q._)`${r}.length`);
|
|
4707
|
-
t.forRange("i", 0, p, (
|
|
4252
|
+
t.forRange("i", 0, p, (u) => {
|
|
4708
4253
|
e.subschema({
|
|
4709
4254
|
keyword: n,
|
|
4710
|
-
dataProp:
|
|
4255
|
+
dataProp: u,
|
|
4711
4256
|
dataPropType: util_1$o.Type.Num
|
|
4712
4257
|
}, i), t.if((0, codegen_1$q.not)(i), l);
|
|
4713
4258
|
});
|
|
@@ -4721,13 +4266,13 @@ function validateUnion(e) {
|
|
|
4721
4266
|
if (r.some((p) => (0, util_1$o.alwaysValidSchema)(s, p)) && !s.opts.unevaluated)
|
|
4722
4267
|
return;
|
|
4723
4268
|
const a = t.let("valid", !1), l = t.name("_valid");
|
|
4724
|
-
t.block(() => r.forEach((p,
|
|
4725
|
-
const
|
|
4269
|
+
t.block(() => r.forEach((p, u) => {
|
|
4270
|
+
const d = e.subschema({
|
|
4726
4271
|
keyword: n,
|
|
4727
|
-
schemaProp:
|
|
4272
|
+
schemaProp: u,
|
|
4728
4273
|
compositeRule: !0
|
|
4729
4274
|
}, l);
|
|
4730
|
-
t.assign(a, (0, codegen_1$q._)`${a} || ${l}`), e.mergeValidEvaluated(
|
|
4275
|
+
t.assign(a, (0, codegen_1$q._)`${a} || ${l}`), e.mergeValidEvaluated(d, l) || t.if((0, codegen_1$q.not)(a));
|
|
4731
4276
|
})), e.result(a, () => e.reset(), () => e.error(!0));
|
|
4732
4277
|
}
|
|
4733
4278
|
code.validateUnion = validateUnion;
|
|
@@ -4737,45 +4282,45 @@ const codegen_1$p = codegen, names_1$4 = names$1, code_1$9 = code, errors_1$1 =
|
|
|
4737
4282
|
function macroKeywordCode(e, t) {
|
|
4738
4283
|
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
4284
|
a.opts.validateSchema !== !1 && a.self.validateSchema(l, !0);
|
|
4740
|
-
const
|
|
4285
|
+
const u = r.name("valid");
|
|
4741
4286
|
e.subschema({
|
|
4742
4287
|
schema: l,
|
|
4743
4288
|
schemaPath: codegen_1$p.nil,
|
|
4744
4289
|
errSchemaPath: `${a.errSchemaPath}/${n}`,
|
|
4745
4290
|
topSchemaRef: p,
|
|
4746
4291
|
compositeRule: !0
|
|
4747
|
-
},
|
|
4292
|
+
}, u), e.pass(u, () => e.error(!0));
|
|
4748
4293
|
}
|
|
4749
4294
|
keyword.macroKeywordCode = macroKeywordCode;
|
|
4750
4295
|
function funcKeywordCode(e, t) {
|
|
4751
4296
|
var r;
|
|
4752
4297
|
const { gen: n, keyword: s, schema: i, parentSchema: a, $data: l, it: p } = e;
|
|
4753
4298
|
checkAsyncKeyword(p, t);
|
|
4754
|
-
const
|
|
4755
|
-
e.block$data(
|
|
4756
|
-
function
|
|
4299
|
+
const u = !l && t.compile ? t.compile.call(p.self, i, a, p) : t.validate, d = useKeyword(n, s, u), $ = n.let("valid");
|
|
4300
|
+
e.block$data($, E), e.ok((r = t.valid) !== null && r !== void 0 ? r : $);
|
|
4301
|
+
function E() {
|
|
4757
4302
|
if (t.errors === !1)
|
|
4758
|
-
|
|
4303
|
+
T(), t.modifying && modifyData(e), g(() => e.error());
|
|
4759
4304
|
else {
|
|
4760
|
-
const _ = t.async ?
|
|
4761
|
-
t.modifying && modifyData(e),
|
|
4305
|
+
const _ = t.async ? R() : v();
|
|
4306
|
+
t.modifying && modifyData(e), g(() => addErrs(e, _));
|
|
4762
4307
|
}
|
|
4763
4308
|
}
|
|
4764
|
-
function
|
|
4309
|
+
function R() {
|
|
4765
4310
|
const _ = n.let("ruleErrs", null);
|
|
4766
|
-
return n.try(() =>
|
|
4311
|
+
return n.try(() => T((0, codegen_1$p._)`await `), (k) => n.assign($, !1).if((0, codegen_1$p._)`${k} instanceof ${p.ValidationError}`, () => n.assign(_, (0, codegen_1$p._)`${k}.errors`), () => n.throw(k))), _;
|
|
4767
4312
|
}
|
|
4768
4313
|
function v() {
|
|
4769
|
-
const _ = (0, codegen_1$p._)`${
|
|
4770
|
-
return n.assign(_, null),
|
|
4314
|
+
const _ = (0, codegen_1$p._)`${d}.errors`;
|
|
4315
|
+
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4771
4316
|
}
|
|
4772
|
-
function
|
|
4773
|
-
const k = p.opts.passContext ? names_1$4.default.this : names_1$4.default.self,
|
|
4774
|
-
n.assign(
|
|
4317
|
+
function T(_ = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4318
|
+
const k = p.opts.passContext ? names_1$4.default.this : names_1$4.default.self, C = !("compile" in t && !l || t.schema === !1);
|
|
4319
|
+
n.assign($, (0, codegen_1$p._)`${_}${(0, code_1$9.callValidateCode)(e, d, k, C)}`, t.modifying);
|
|
4775
4320
|
}
|
|
4776
|
-
function
|
|
4321
|
+
function g(_) {
|
|
4777
4322
|
var k;
|
|
4778
|
-
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k :
|
|
4323
|
+
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k : $), _);
|
|
4779
4324
|
}
|
|
4780
4325
|
}
|
|
4781
4326
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4854,16 +4399,16 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4854
4399
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4855
4400
|
const { gen: l } = t;
|
|
4856
4401
|
if (r !== void 0) {
|
|
4857
|
-
const { errorPath:
|
|
4858
|
-
p(
|
|
4402
|
+
const { errorPath: u, dataPathArr: d, opts: $ } = t, E = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4403
|
+
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
4404
|
}
|
|
4860
4405
|
if (s !== void 0) {
|
|
4861
|
-
const
|
|
4862
|
-
p(
|
|
4406
|
+
const u = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
4407
|
+
p(u), a !== void 0 && (e.propertyName = a);
|
|
4863
4408
|
}
|
|
4864
4409
|
i && (e.dataTypes = i);
|
|
4865
|
-
function p(
|
|
4866
|
-
e.data =
|
|
4410
|
+
function p(u) {
|
|
4411
|
+
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
4412
|
}
|
|
4868
4413
|
}
|
|
4869
4414
|
subschema.extendSubschemaData = extendSubschemaData;
|
|
@@ -4956,23 +4501,23 @@ traverse$1.skipKeywords = {
|
|
|
4956
4501
|
maxProperties: !0,
|
|
4957
4502
|
minProperties: !0
|
|
4958
4503
|
};
|
|
4959
|
-
function _traverse(e, t, r, n, s, i, a, l, p,
|
|
4504
|
+
function _traverse(e, t, r, n, s, i, a, l, p, u) {
|
|
4960
4505
|
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,
|
|
4506
|
+
t(n, s, i, a, l, p, u);
|
|
4507
|
+
for (var d in n) {
|
|
4508
|
+
var $ = n[d];
|
|
4509
|
+
if (Array.isArray($)) {
|
|
4510
|
+
if (d in traverse$1.arrayKeywords)
|
|
4511
|
+
for (var E = 0; E < $.length; E++)
|
|
4512
|
+
_traverse(e, t, r, $[E], s + "/" + d + "/" + E, i, s, d, n, E);
|
|
4513
|
+
} else if (d in traverse$1.propsKeywords) {
|
|
4514
|
+
if ($ && typeof $ == "object")
|
|
4515
|
+
for (var R in $)
|
|
4516
|
+
_traverse(e, t, r, $[R], s + "/" + d + "/" + escapeJsonPtr(R), i, s, d, n, R);
|
|
4972
4517
|
} else
|
|
4973
|
-
(
|
|
4518
|
+
(d in traverse$1.keywords || e.allKeys && !(d in traverse$1.skipKeywords)) && _traverse(e, t, r, $, s + "/" + d, i, s, d, n);
|
|
4974
4519
|
}
|
|
4975
|
-
r(n, s, i, a, l, p,
|
|
4520
|
+
r(n, s, i, a, l, p, u);
|
|
4976
4521
|
}
|
|
4977
4522
|
}
|
|
4978
4523
|
function escapeJsonPtr(e) {
|
|
@@ -5054,34 +4599,34 @@ function getSchemaRefs(e, t) {
|
|
|
5054
4599
|
if (typeof e == "boolean")
|
|
5055
4600
|
return {};
|
|
5056
4601
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, a = getFullPath(n, s, !1), l = {}, p = /* @__PURE__ */ new Set();
|
|
5057
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4602
|
+
return traverse(e, { allKeys: !0 }, ($, E, R, v) => {
|
|
5058
4603
|
if (v === void 0)
|
|
5059
4604
|
return;
|
|
5060
|
-
const
|
|
5061
|
-
let
|
|
5062
|
-
typeof
|
|
5063
|
-
function _(
|
|
4605
|
+
const T = a + E;
|
|
4606
|
+
let g = i[v];
|
|
4607
|
+
typeof $[r] == "string" && (g = _.call(this, $[r])), k.call(this, $.$anchor), k.call(this, $.$dynamicAnchor), i[E] = g;
|
|
4608
|
+
function _(C) {
|
|
5064
4609
|
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, `#${
|
|
4610
|
+
if (C = normalizeId(g ? I(g, C) : C), p.has(C))
|
|
4611
|
+
throw d(C);
|
|
4612
|
+
p.add(C);
|
|
4613
|
+
let A = this.refs[C];
|
|
4614
|
+
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;
|
|
4615
|
+
}
|
|
4616
|
+
function k(C) {
|
|
4617
|
+
if (typeof C == "string") {
|
|
4618
|
+
if (!ANCHOR.test(C))
|
|
4619
|
+
throw new Error(`invalid anchor "${C}"`);
|
|
4620
|
+
_.call(this, `#${C}`);
|
|
5076
4621
|
}
|
|
5077
4622
|
}
|
|
5078
4623
|
}), l;
|
|
5079
|
-
function
|
|
5080
|
-
if (
|
|
5081
|
-
throw
|
|
4624
|
+
function u($, E, R) {
|
|
4625
|
+
if (E !== void 0 && !equal$2($, E))
|
|
4626
|
+
throw d(R);
|
|
5082
4627
|
}
|
|
5083
|
-
function
|
|
5084
|
-
return new Error(`reference "${
|
|
4628
|
+
function d($) {
|
|
4629
|
+
return new Error(`reference "${$}" resolves to more than one schema`);
|
|
5085
4630
|
}
|
|
5086
4631
|
}
|
|
5087
4632
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -5191,18 +4736,18 @@ function assignEvaluated({ gen: e, evaluated: t, props: r, items: n }) {
|
|
|
5191
4736
|
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
4737
|
}
|
|
5193
4738
|
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",
|
|
4739
|
+
const { gen: s, schema: i, data: a, allErrors: l, opts: p, self: u } = e, { RULES: d } = u;
|
|
4740
|
+
if (i.$ref && (p.ignoreKeywordsWithRef || !(0, util_1$l.schemaHasRulesButRef)(i, d))) {
|
|
4741
|
+
s.block(() => keywordCode(e, "$ref", d.all.$ref.definition));
|
|
5197
4742
|
return;
|
|
5198
4743
|
}
|
|
5199
4744
|
p.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
5200
|
-
for (const
|
|
5201
|
-
|
|
5202
|
-
|
|
4745
|
+
for (const E of d.rules)
|
|
4746
|
+
$(E);
|
|
4747
|
+
$(d.post);
|
|
5203
4748
|
});
|
|
5204
|
-
function
|
|
5205
|
-
(0, applicability_1.shouldUseGroup)(i,
|
|
4749
|
+
function $(E) {
|
|
4750
|
+
(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
4751
|
}
|
|
5207
4752
|
}
|
|
5208
4753
|
function iterateKeywords(e, t) {
|
|
@@ -5371,27 +4916,27 @@ function getData(e, { dataLevel: t, dataNames: r, dataPathArr: n }) {
|
|
|
5371
4916
|
throw new Error(`Invalid JSON-pointer: ${e}`);
|
|
5372
4917
|
s = e, i = names_1$3.default.rootData;
|
|
5373
4918
|
} else {
|
|
5374
|
-
const
|
|
5375
|
-
if (!
|
|
4919
|
+
const u = RELATIVE_JSON_POINTER.exec(e);
|
|
4920
|
+
if (!u)
|
|
5376
4921
|
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 -
|
|
4922
|
+
const d = +u[1];
|
|
4923
|
+
if (s = u[2], s === "#") {
|
|
4924
|
+
if (d >= t)
|
|
4925
|
+
throw new Error(p("property/index", d));
|
|
4926
|
+
return n[t - d];
|
|
4927
|
+
}
|
|
4928
|
+
if (d > t)
|
|
4929
|
+
throw new Error(p("data", d));
|
|
4930
|
+
if (i = r[t - d], !s)
|
|
5386
4931
|
return i;
|
|
5387
4932
|
}
|
|
5388
4933
|
let a = i;
|
|
5389
4934
|
const l = s.split("/");
|
|
5390
|
-
for (const
|
|
5391
|
-
|
|
4935
|
+
for (const u of l)
|
|
4936
|
+
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
4937
|
return a;
|
|
5393
|
-
function p(
|
|
5394
|
-
return `Cannot access ${
|
|
4938
|
+
function p(u, d) {
|
|
4939
|
+
return `Cannot access ${u} ${d} levels up, current level is ${t}`;
|
|
5395
4940
|
}
|
|
5396
4941
|
}
|
|
5397
4942
|
validate.getData = getData;
|
|
@@ -5437,7 +4982,7 @@ function compileSchema(e) {
|
|
|
5437
4982
|
}));
|
|
5438
4983
|
const p = a.scopeName("validate");
|
|
5439
4984
|
e.validateName = p;
|
|
5440
|
-
const
|
|
4985
|
+
const u = {
|
|
5441
4986
|
gen: a,
|
|
5442
4987
|
allErrors: this.opts.allErrors,
|
|
5443
4988
|
data: names_1$2.default.data,
|
|
@@ -5461,24 +5006,24 @@ function compileSchema(e) {
|
|
|
5461
5006
|
opts: this.opts,
|
|
5462
5007
|
self: this
|
|
5463
5008
|
};
|
|
5464
|
-
let
|
|
5009
|
+
let d;
|
|
5465
5010
|
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
|
-
|
|
5011
|
+
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), a.optimize(this.opts.code.optimize);
|
|
5012
|
+
const $ = a.toString();
|
|
5013
|
+
d = `${a.scopeRefs(names_1$2.default.scope)}return ${$}`, this.opts.code.process && (d = this.opts.code.process(d, e));
|
|
5014
|
+
const R = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, d)(this, this.scope.get());
|
|
5015
|
+
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) {
|
|
5016
|
+
const { props: v, items: T } = u;
|
|
5017
|
+
R.evaluated = {
|
|
5473
5018
|
props: v instanceof codegen_1$m.Name ? void 0 : v,
|
|
5474
|
-
items:
|
|
5019
|
+
items: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5475
5020
|
dynamicProps: v instanceof codegen_1$m.Name,
|
|
5476
|
-
dynamicItems:
|
|
5477
|
-
},
|
|
5021
|
+
dynamicItems: T instanceof codegen_1$m.Name
|
|
5022
|
+
}, R.source && (R.source.evaluated = (0, codegen_1$m.stringify)(R.evaluated));
|
|
5478
5023
|
}
|
|
5479
|
-
return e.validate =
|
|
5480
|
-
} catch (
|
|
5481
|
-
throw delete e.validate, delete e.validateName,
|
|
5024
|
+
return e.validate = R, e;
|
|
5025
|
+
} catch ($) {
|
|
5026
|
+
throw delete e.validate, delete e.validateName, d && this.logger.error("Error compiling schema, function code:", d), $;
|
|
5482
5027
|
} finally {
|
|
5483
5028
|
this._compilations.delete(e);
|
|
5484
5029
|
}
|
|
@@ -5529,8 +5074,8 @@ function resolveSchema(e, t) {
|
|
|
5529
5074
|
}
|
|
5530
5075
|
if (typeof (a == null ? void 0 : a.schema) == "object") {
|
|
5531
5076
|
if (a.validate || compileSchema.call(this, a), i === (0, resolve_1.normalizeId)(t)) {
|
|
5532
|
-
const { schema: l } = a, { schemaId: p } = this.opts,
|
|
5533
|
-
return
|
|
5077
|
+
const { schema: l } = a, { schemaId: p } = this.opts, u = l[p];
|
|
5078
|
+
return u && (s = (0, resolve_1.resolveUrl)(this.opts.uriResolver, s, u)), new SchemaEnv({ schema: l, schemaId: p, root: e, baseId: s });
|
|
5534
5079
|
}
|
|
5535
5080
|
return getJsonPointer.call(this, r, a);
|
|
5536
5081
|
}
|
|
@@ -5554,8 +5099,8 @@ function getJsonPointer(e, { baseId: t, schema: r, root: n }) {
|
|
|
5554
5099
|
if (p === void 0)
|
|
5555
5100
|
return;
|
|
5556
5101
|
r = p;
|
|
5557
|
-
const
|
|
5558
|
-
!PREVENT_SCOPE_CHANGE.has(l) &&
|
|
5102
|
+
const u = typeof r == "object" && r[this.opts.schemaId];
|
|
5103
|
+
!PREVENT_SCOPE_CHANGE.has(l) && u && (t = (0, resolve_1.resolveUrl)(this.opts.uriResolver, t, u));
|
|
5559
5104
|
}
|
|
5560
5105
|
let i;
|
|
5561
5106
|
if (typeof r != "boolean" && r.$ref && !(0, util_1$k.schemaHasRulesButRef)(r, this.RULES)) {
|
|
@@ -5599,9 +5144,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5599
5144
|
c[m] = arguments[m];
|
|
5600
5145
|
if (c.length > 1) {
|
|
5601
5146
|
c[0] = c[0].slice(0, -1);
|
|
5602
|
-
for (var
|
|
5147
|
+
for (var S = c.length - 1, b = 1; b < S; ++b)
|
|
5603
5148
|
c[b] = c[b].slice(1, -1);
|
|
5604
|
-
return c[
|
|
5149
|
+
return c[S] = c[S].slice(1), c.join("");
|
|
5605
5150
|
} else
|
|
5606
5151
|
return c[0];
|
|
5607
5152
|
}
|
|
@@ -5620,15 +5165,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5620
5165
|
function p(f, c) {
|
|
5621
5166
|
var m = f;
|
|
5622
5167
|
if (c)
|
|
5623
|
-
for (var
|
|
5624
|
-
m[
|
|
5168
|
+
for (var S in c)
|
|
5169
|
+
m[S] = c[S];
|
|
5625
5170
|
return m;
|
|
5626
5171
|
}
|
|
5627
|
-
function
|
|
5628
|
-
var c = "[A-Za-z]", m = "[0-9]",
|
|
5172
|
+
function u(f) {
|
|
5173
|
+
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
5174
|
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]" +
|
|
5175
|
+
var Q = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), 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) + "+");
|
|
5176
|
+
s("[vV]" + S + "+\\." + n(B, L, "[\\:]") + "+"), s(s(b + "|" + n(B, L)) + "*");
|
|
5632
5177
|
var ct = s(b + "|" + n(B, L, "[\\:\\@]"));
|
|
5633
5178
|
return s(s(b + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5634
5179
|
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
@@ -5643,15 +5188,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5643
5188
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5644
5189
|
PCT_ENCODED: new RegExp(b, "g"),
|
|
5645
5190
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5646
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5191
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + S + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5647
5192
|
//RFC 6874, with relaxed parsing rules
|
|
5648
5193
|
};
|
|
5649
5194
|
}
|
|
5650
|
-
var
|
|
5195
|
+
var d = u(!1), $ = u(!0), E = function() {
|
|
5651
5196
|
function f(c, m) {
|
|
5652
|
-
var
|
|
5197
|
+
var S = [], b = !0, U = !1, L = void 0;
|
|
5653
5198
|
try {
|
|
5654
|
-
for (var J = c[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (
|
|
5199
|
+
for (var J = c[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (S.push(Y.value), !(m && S.length === m)); b = !0)
|
|
5655
5200
|
;
|
|
5656
5201
|
} catch (se) {
|
|
5657
5202
|
U = !0, L = se;
|
|
@@ -5663,7 +5208,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5663
5208
|
throw L;
|
|
5664
5209
|
}
|
|
5665
5210
|
}
|
|
5666
|
-
return
|
|
5211
|
+
return S;
|
|
5667
5212
|
}
|
|
5668
5213
|
return function(c, m) {
|
|
5669
5214
|
if (Array.isArray(c))
|
|
@@ -5672,36 +5217,36 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5672
5217
|
return f(c, m);
|
|
5673
5218
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5674
5219
|
};
|
|
5675
|
-
}(),
|
|
5220
|
+
}(), R = function(f) {
|
|
5676
5221
|
if (Array.isArray(f)) {
|
|
5677
5222
|
for (var c = 0, m = Array(f.length); c < f.length; c++)
|
|
5678
5223
|
m[c] = f[c];
|
|
5679
5224
|
return m;
|
|
5680
5225
|
} else
|
|
5681
5226
|
return Array.from(f);
|
|
5682
|
-
}, v = 2147483647,
|
|
5227
|
+
}, 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
5228
|
overflow: "Overflow: input needs wider integers to process",
|
|
5684
5229
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5685
5230
|
"invalid-input": "Invalid input"
|
|
5686
|
-
}, re =
|
|
5231
|
+
}, re = T - g, K = Math.floor, ue = String.fromCharCode;
|
|
5687
5232
|
function oe(f) {
|
|
5688
|
-
throw new RangeError(
|
|
5233
|
+
throw new RangeError(x[f]);
|
|
5689
5234
|
}
|
|
5690
5235
|
function ke(f, c) {
|
|
5691
|
-
for (var m = [],
|
|
5692
|
-
m[
|
|
5236
|
+
for (var m = [], S = f.length; S--; )
|
|
5237
|
+
m[S] = c(f[S]);
|
|
5693
5238
|
return m;
|
|
5694
5239
|
}
|
|
5695
|
-
function
|
|
5696
|
-
var m = f.split("@"),
|
|
5697
|
-
m.length > 1 && (
|
|
5240
|
+
function Ce(f, c) {
|
|
5241
|
+
var m = f.split("@"), S = "";
|
|
5242
|
+
m.length > 1 && (S = m[0] + "@", f = m[1]), f = f.replace(z, ".");
|
|
5698
5243
|
var b = f.split("."), U = ke(b, c).join(".");
|
|
5699
|
-
return
|
|
5244
|
+
return S + U;
|
|
5700
5245
|
}
|
|
5701
5246
|
function qe(f) {
|
|
5702
|
-
for (var c = [], m = 0,
|
|
5247
|
+
for (var c = [], m = 0, S = f.length; m < S; ) {
|
|
5703
5248
|
var b = f.charCodeAt(m++);
|
|
5704
|
-
if (b >= 55296 && b <= 56319 && m <
|
|
5249
|
+
if (b >= 55296 && b <= 56319 && m < S) {
|
|
5705
5250
|
var U = f.charCodeAt(m++);
|
|
5706
5251
|
(U & 64512) == 56320 ? c.push(((b & 1023) << 10) + (U & 1023) + 65536) : (c.push(b), m--);
|
|
5707
5252
|
} else
|
|
@@ -5710,40 +5255,40 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5710
5255
|
return c;
|
|
5711
5256
|
}
|
|
5712
5257
|
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 :
|
|
5258
|
+
return String.fromCodePoint.apply(String, R(c));
|
|
5259
|
+
}, Ue = function(c) {
|
|
5260
|
+
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : T;
|
|
5716
5261
|
}, F = function(c, m) {
|
|
5717
5262
|
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5718
|
-
}, y = function(c, m,
|
|
5263
|
+
}, y = function(c, m, S) {
|
|
5719
5264
|
var b = 0;
|
|
5720
5265
|
for (
|
|
5721
|
-
c =
|
|
5266
|
+
c = S ? K(c / C) : c >> 1, c += K(c / m);
|
|
5722
5267
|
/* no initialization */
|
|
5723
5268
|
c > re * _ >> 1;
|
|
5724
|
-
b +=
|
|
5269
|
+
b += T
|
|
5725
5270
|
)
|
|
5726
5271
|
c = K(c / re);
|
|
5727
5272
|
return K(b + (re + 1) * c / (c + k));
|
|
5728
5273
|
}, j = function(c) {
|
|
5729
|
-
var m = [],
|
|
5274
|
+
var m = [], S = c.length, b = 0, U = A, L = I, J = c.lastIndexOf(w);
|
|
5730
5275
|
J < 0 && (J = 0);
|
|
5731
5276
|
for (var Y = 0; Y < J; ++Y)
|
|
5732
5277
|
c.charCodeAt(Y) >= 128 && oe("not-basic"), m.push(c.charCodeAt(Y));
|
|
5733
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5278
|
+
for (var se = J > 0 ? J + 1 : 0; se < S; ) {
|
|
5734
5279
|
for (
|
|
5735
|
-
var B = b, Q = 1, ie =
|
|
5280
|
+
var B = b, Q = 1, ie = T;
|
|
5736
5281
|
;
|
|
5737
5282
|
/* no condition */
|
|
5738
|
-
ie +=
|
|
5283
|
+
ie += T
|
|
5739
5284
|
) {
|
|
5740
|
-
se >=
|
|
5741
|
-
var V =
|
|
5742
|
-
(V >=
|
|
5743
|
-
var X = ie <= L ?
|
|
5285
|
+
se >= S && oe("invalid-input");
|
|
5286
|
+
var V = Ue(c.charCodeAt(se++));
|
|
5287
|
+
(V >= T || V > K((v - b) / Q)) && oe("overflow"), b += V * Q;
|
|
5288
|
+
var X = ie <= L ? g : ie >= L + _ ? _ : ie - L;
|
|
5744
5289
|
if (V < X)
|
|
5745
5290
|
break;
|
|
5746
|
-
var ae =
|
|
5291
|
+
var ae = T - X;
|
|
5747
5292
|
Q > K(v / ae) && oe("overflow"), Q *= ae;
|
|
5748
5293
|
}
|
|
5749
5294
|
var ee = m.length + 1;
|
|
@@ -5753,7 +5298,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5753
5298
|
}, P = function(c) {
|
|
5754
5299
|
var m = [];
|
|
5755
5300
|
c = qe(c);
|
|
5756
|
-
var
|
|
5301
|
+
var S = c.length, b = A, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5757
5302
|
try {
|
|
5758
5303
|
for (var B = c[Symbol.iterator](), Q; !(J = (Q = B.next()).done); J = !0) {
|
|
5759
5304
|
var ie = Q.value;
|
|
@@ -5770,21 +5315,21 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5770
5315
|
}
|
|
5771
5316
|
}
|
|
5772
5317
|
var V = m.length, X = V;
|
|
5773
|
-
for (V && m.push(w); X <
|
|
5774
|
-
var ae = v, ee = !0, Ee = !1,
|
|
5318
|
+
for (V && m.push(w); X < S; ) {
|
|
5319
|
+
var ae = v, ee = !0, Ee = !1, $e = void 0;
|
|
5775
5320
|
try {
|
|
5776
|
-
for (var
|
|
5777
|
-
var Ie =
|
|
5321
|
+
for (var ge = c[Symbol.iterator](), Be; !(ee = (Be = ge.next()).done); ee = !0) {
|
|
5322
|
+
var Ie = Be.value;
|
|
5778
5323
|
Ie >= b && Ie < ae && (ae = Ie);
|
|
5779
5324
|
}
|
|
5780
5325
|
} catch (lt) {
|
|
5781
|
-
Ee = !0,
|
|
5326
|
+
Ee = !0, $e = lt;
|
|
5782
5327
|
} finally {
|
|
5783
5328
|
try {
|
|
5784
|
-
!ee &&
|
|
5329
|
+
!ee && ge.return && ge.return();
|
|
5785
5330
|
} finally {
|
|
5786
5331
|
if (Ee)
|
|
5787
|
-
throw
|
|
5332
|
+
throw $e;
|
|
5788
5333
|
}
|
|
5789
5334
|
}
|
|
5790
5335
|
var fe = X + 1;
|
|
@@ -5795,15 +5340,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5795
5340
|
var Ht = Lt.value;
|
|
5796
5341
|
if (Ht < b && ++U > v && oe("overflow"), Ht == b) {
|
|
5797
5342
|
for (
|
|
5798
|
-
var pt = U, ft =
|
|
5343
|
+
var pt = U, ft = T;
|
|
5799
5344
|
;
|
|
5800
5345
|
/* no condition */
|
|
5801
|
-
ft +=
|
|
5346
|
+
ft += T
|
|
5802
5347
|
) {
|
|
5803
|
-
var ht = ft <= L ?
|
|
5348
|
+
var ht = ft <= L ? g : ft >= L + _ ? _ : ft - L;
|
|
5804
5349
|
if (pt < ht)
|
|
5805
5350
|
break;
|
|
5806
|
-
var zt = pt - ht, Vt =
|
|
5351
|
+
var zt = pt - ht, Vt = T - ht;
|
|
5807
5352
|
m.push(ue(F(ht + zt % Vt, 0))), pt = K(zt / Vt);
|
|
5808
5353
|
}
|
|
5809
5354
|
m.push(ue(F(pt, 0))), L = y(U, fe, X == V), U = 0, ++X;
|
|
@@ -5823,11 +5368,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5823
5368
|
}
|
|
5824
5369
|
return m.join("");
|
|
5825
5370
|
}, o = function(c) {
|
|
5826
|
-
return
|
|
5827
|
-
return
|
|
5371
|
+
return Ce(c, function(m) {
|
|
5372
|
+
return O.test(m) ? j(m.slice(4).toLowerCase()) : m;
|
|
5828
5373
|
});
|
|
5829
5374
|
}, h = function(c) {
|
|
5830
|
-
return
|
|
5375
|
+
return Ce(c, function(m) {
|
|
5831
5376
|
return D.test(m) ? "xn--" + P(m) : m;
|
|
5832
5377
|
});
|
|
5833
5378
|
}, N = {
|
|
@@ -5852,25 +5397,25 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5852
5397
|
encode: P,
|
|
5853
5398
|
toASCII: h,
|
|
5854
5399
|
toUnicode: o
|
|
5855
|
-
},
|
|
5856
|
-
function
|
|
5400
|
+
}, M = {};
|
|
5401
|
+
function q(f) {
|
|
5857
5402
|
var c = f.charCodeAt(0), m = void 0;
|
|
5858
5403
|
return c < 16 ? m = "%0" + c.toString(16).toUpperCase() : c < 128 ? m = "%" + c.toString(16).toUpperCase() : c < 2048 ? m = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase() : m = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(), m;
|
|
5859
5404
|
}
|
|
5860
|
-
function
|
|
5861
|
-
for (var c = "", m = 0,
|
|
5405
|
+
function W(f) {
|
|
5406
|
+
for (var c = "", m = 0, S = f.length; m < S; ) {
|
|
5862
5407
|
var b = parseInt(f.substr(m + 1, 2), 16);
|
|
5863
5408
|
if (b < 128)
|
|
5864
5409
|
c += String.fromCharCode(b), m += 3;
|
|
5865
5410
|
else if (b >= 194 && b < 224) {
|
|
5866
|
-
if (
|
|
5411
|
+
if (S - m >= 6) {
|
|
5867
5412
|
var U = parseInt(f.substr(m + 4, 2), 16);
|
|
5868
5413
|
c += String.fromCharCode((b & 31) << 6 | U & 63);
|
|
5869
5414
|
} else
|
|
5870
5415
|
c += f.substr(m, 6);
|
|
5871
5416
|
m += 6;
|
|
5872
5417
|
} else if (b >= 224) {
|
|
5873
|
-
if (
|
|
5418
|
+
if (S - m >= 9) {
|
|
5874
5419
|
var L = parseInt(f.substr(m + 4, 2), 16), J = parseInt(f.substr(m + 7, 2), 16);
|
|
5875
5420
|
c += String.fromCharCode((b & 15) << 12 | (L & 63) << 6 | J & 63);
|
|
5876
5421
|
} else
|
|
@@ -5882,23 +5427,23 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5882
5427
|
return c;
|
|
5883
5428
|
}
|
|
5884
5429
|
function G(f, c) {
|
|
5885
|
-
function m(
|
|
5886
|
-
var b =
|
|
5887
|
-
return b.match(c.UNRESERVED) ? b :
|
|
5430
|
+
function m(S) {
|
|
5431
|
+
var b = W(S);
|
|
5432
|
+
return b.match(c.UNRESERVED) ? b : S;
|
|
5888
5433
|
}
|
|
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,
|
|
5434
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(c.PCT_ENCODED, m).replace(c.NOT_USERINFO, q).replace(c.PCT_ENCODED, 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
5435
|
}
|
|
5891
5436
|
function ne(f) {
|
|
5892
5437
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5893
5438
|
}
|
|
5894
5439
|
function he(f, c) {
|
|
5895
|
-
var m = f.match(c.IPV4ADDRESS) || [],
|
|
5440
|
+
var m = f.match(c.IPV4ADDRESS) || [], S = E(m, 2), b = S[1];
|
|
5896
5441
|
return b ? b.split(".").map(ne).join(".") : f;
|
|
5897
5442
|
}
|
|
5898
|
-
function
|
|
5899
|
-
var m = f.match(c.IPV6ADDRESS) || [],
|
|
5443
|
+
function Le(f, c) {
|
|
5444
|
+
var m = f.match(c.IPV6ADDRESS) || [], S = E(m, 3), b = S[1], U = S[2];
|
|
5900
5445
|
if (b) {
|
|
5901
|
-
for (var L = b.toLowerCase().split("::").reverse(), J =
|
|
5446
|
+
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
5447
|
ae[ee] = B[ee] || Q[X + ee] || "";
|
|
5903
5448
|
ie && (ae[V - 1] = he(ae[V - 1], c));
|
|
5904
5449
|
var Ee = ae.reduce(function(fe, ye, je) {
|
|
@@ -5907,105 +5452,105 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5907
5452
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5908
5453
|
}
|
|
5909
5454
|
return fe;
|
|
5910
|
-
}, []),
|
|
5455
|
+
}, []), $e = Ee.sort(function(fe, ye) {
|
|
5911
5456
|
return ye.length - fe.length;
|
|
5912
|
-
})[0],
|
|
5913
|
-
if (
|
|
5914
|
-
var
|
|
5915
|
-
|
|
5457
|
+
})[0], ge = void 0;
|
|
5458
|
+
if ($e && $e.length > 1) {
|
|
5459
|
+
var Be = ae.slice(0, $e.index), Ie = ae.slice($e.index + $e.length);
|
|
5460
|
+
ge = Be.join(":") + "::" + Ie.join(":");
|
|
5916
5461
|
} else
|
|
5917
|
-
|
|
5918
|
-
return U && (
|
|
5462
|
+
ge = ae.join(":");
|
|
5463
|
+
return U && (ge += "%" + U), ge;
|
|
5919
5464
|
} else
|
|
5920
5465
|
return f;
|
|
5921
5466
|
}
|
|
5922
5467
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5923
5468
|
function de(f) {
|
|
5924
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {},
|
|
5469
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, S = c.iri !== !1 ? $ : d;
|
|
5925
5470
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5926
5471
|
var b = f.match(tt);
|
|
5927
5472
|
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 =
|
|
5473
|
+
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.");
|
|
5474
|
+
var U = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5930
5475
|
if (!c.unicodeSupport && (!U || !U.unicodeSupport)) {
|
|
5931
5476
|
if (m.host && (c.domainHost || U && U.domainHost))
|
|
5932
5477
|
try {
|
|
5933
|
-
m.host = N.toASCII(m.host.replace(
|
|
5478
|
+
m.host = N.toASCII(m.host.replace(S.PCT_ENCODED, W).toLowerCase());
|
|
5934
5479
|
} catch (L) {
|
|
5935
5480
|
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + L;
|
|
5936
5481
|
}
|
|
5937
|
-
G(m,
|
|
5482
|
+
G(m, d);
|
|
5938
5483
|
} else
|
|
5939
|
-
G(m,
|
|
5484
|
+
G(m, S);
|
|
5940
5485
|
U && U.parse && U.parse(m, c);
|
|
5941
5486
|
} else
|
|
5942
5487
|
m.error = m.error || "URI can not be parsed.";
|
|
5943
5488
|
return m;
|
|
5944
5489
|
}
|
|
5945
5490
|
function nt(f, c) {
|
|
5946
|
-
var m = c.iri !== !1 ?
|
|
5947
|
-
return f.userinfo !== void 0 && (
|
|
5491
|
+
var m = c.iri !== !1 ? $ : d, S = [];
|
|
5492
|
+
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
5493
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5949
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5494
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (S.push(":"), S.push(String(f.port))), S.length ? S.join("") : void 0;
|
|
5950
5495
|
}
|
|
5951
|
-
var
|
|
5496
|
+
var He = /^\.\.?\//, ze = /^\/\.(\/|$)/, Ve = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5952
5497
|
function me(f) {
|
|
5953
5498
|
for (var c = []; f.length; )
|
|
5954
|
-
if (f.match(
|
|
5955
|
-
f = f.replace(
|
|
5956
|
-
else if (f.match(He))
|
|
5957
|
-
f = f.replace(He, "/");
|
|
5499
|
+
if (f.match(He))
|
|
5500
|
+
f = f.replace(He, "");
|
|
5958
5501
|
else if (f.match(ze))
|
|
5959
|
-
f = f.replace(ze, "/")
|
|
5502
|
+
f = f.replace(ze, "/");
|
|
5503
|
+
else if (f.match(Ve))
|
|
5504
|
+
f = f.replace(Ve, "/"), c.pop();
|
|
5960
5505
|
else if (f === "." || f === "..")
|
|
5961
5506
|
f = "";
|
|
5962
5507
|
else {
|
|
5963
5508
|
var m = f.match(st);
|
|
5964
5509
|
if (m) {
|
|
5965
|
-
var
|
|
5966
|
-
f = f.slice(
|
|
5510
|
+
var S = m[0];
|
|
5511
|
+
f = f.slice(S.length), c.push(S);
|
|
5967
5512
|
} else
|
|
5968
5513
|
throw new Error("Unexpected dot segment condition");
|
|
5969
5514
|
}
|
|
5970
5515
|
return c.join("");
|
|
5971
5516
|
}
|
|
5972
5517
|
function le(f) {
|
|
5973
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ?
|
|
5518
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? $ : d, S = [], b = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5974
5519
|
if (b && b.serialize && b.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5975
5520
|
if (c.domainHost || b && b.domainHost)
|
|
5976
5521
|
try {
|
|
5977
|
-
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED,
|
|
5522
|
+
f.host = c.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(m.PCT_ENCODED, W).toLowerCase());
|
|
5978
5523
|
} catch (J) {
|
|
5979
5524
|
f.error = f.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5980
5525
|
}
|
|
5981
5526
|
}
|
|
5982
|
-
G(f, m), c.reference !== "suffix" && f.scheme && (
|
|
5527
|
+
G(f, m), c.reference !== "suffix" && f.scheme && (S.push(f.scheme), S.push(":"));
|
|
5983
5528
|
var U = nt(f, c);
|
|
5984
|
-
if (U !== void 0 && (c.reference !== "suffix" &&
|
|
5529
|
+
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
5530
|
var L = f.path;
|
|
5986
|
-
!c.absolutePath && (!b || !b.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")),
|
|
5531
|
+
!c.absolutePath && (!b || !b.absolutePath) && (L = me(L)), U === void 0 && (L = L.replace(/^\/\//, "/%2F")), S.push(L);
|
|
5987
5532
|
}
|
|
5988
|
-
return f.query !== void 0 && (
|
|
5533
|
+
return f.query !== void 0 && (S.push("?"), S.push(f.query)), f.fragment !== void 0 && (S.push("#"), S.push(f.fragment)), S.join("");
|
|
5989
5534
|
}
|
|
5990
|
-
function
|
|
5991
|
-
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {},
|
|
5992
|
-
return
|
|
5535
|
+
function xe(f, c) {
|
|
5536
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, S = arguments[3], b = {};
|
|
5537
|
+
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
5538
|
}
|
|
5994
5539
|
function it(f, c, m) {
|
|
5995
|
-
var
|
|
5996
|
-
return le(
|
|
5540
|
+
var S = p({ scheme: "null" }, m);
|
|
5541
|
+
return le(xe(de(f, S), de(c, S), S, !0), S);
|
|
5997
5542
|
}
|
|
5998
|
-
function
|
|
5543
|
+
function Oe(f, c) {
|
|
5999
5544
|
return typeof f == "string" ? f = le(de(f, c), c) : i(f) === "object" && (f = de(le(f, c), c)), f;
|
|
6000
5545
|
}
|
|
6001
5546
|
function ot(f, c, m) {
|
|
6002
5547
|
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
5548
|
}
|
|
6004
5549
|
function ut(f, c) {
|
|
6005
|
-
return f && f.toString().replace(!c || !c.iri ?
|
|
5550
|
+
return f && f.toString().replace(!c || !c.iri ? d.ESCAPE : $.ESCAPE, q);
|
|
6006
5551
|
}
|
|
6007
5552
|
function pe(f, c) {
|
|
6008
|
-
return f && f.toString().replace(!c || !c.iri ?
|
|
5553
|
+
return f && f.toString().replace(!c || !c.iri ? d.PCT_ENCODED : $.PCT_ENCODED, W);
|
|
6009
5554
|
}
|
|
6010
5555
|
var Ne = {
|
|
6011
5556
|
scheme: "http",
|
|
@@ -6014,8 +5559,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6014
5559
|
return c.host || (c.error = c.error || "HTTP URIs must have a host."), c;
|
|
6015
5560
|
},
|
|
6016
5561
|
serialize: function(c, m) {
|
|
6017
|
-
var
|
|
6018
|
-
return (c.port === (
|
|
5562
|
+
var S = String(c.scheme).toLowerCase() === "https";
|
|
5563
|
+
return (c.port === (S ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
6019
5564
|
}
|
|
6020
5565
|
}, It = {
|
|
6021
5566
|
scheme: "https",
|
|
@@ -6030,12 +5575,12 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6030
5575
|
scheme: "ws",
|
|
6031
5576
|
domainHost: !0,
|
|
6032
5577
|
parse: function(c, m) {
|
|
6033
|
-
var
|
|
6034
|
-
return
|
|
5578
|
+
var S = c;
|
|
5579
|
+
return S.secure = jt(S), S.resourceName = (S.path || "/") + (S.query ? "?" + S.query : ""), S.path = void 0, S.query = void 0, S;
|
|
6035
5580
|
},
|
|
6036
5581
|
serialize: function(c, m) {
|
|
6037
5582
|
if ((c.port === (jt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
6038
|
-
var
|
|
5583
|
+
var S = c.resourceName.split("?"), b = E(S, 2), U = b[0], L = b[1];
|
|
6039
5584
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
6040
5585
|
}
|
|
6041
5586
|
return c.fragment = void 0, c;
|
|
@@ -6046,16 +5591,16 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6046
5591
|
parse: at.parse,
|
|
6047
5592
|
serialize: at.serialize
|
|
6048
5593
|
}, 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 =
|
|
5594
|
+
function Ot(f) {
|
|
5595
|
+
var c = W(f);
|
|
6051
5596
|
return c.match(ur) ? c : f;
|
|
6052
5597
|
}
|
|
6053
|
-
var
|
|
5598
|
+
var Mt = {
|
|
6054
5599
|
scheme: "mailto",
|
|
6055
5600
|
parse: function(c, m) {
|
|
6056
|
-
var
|
|
6057
|
-
if (
|
|
6058
|
-
for (var U = !1, L = {}, J =
|
|
5601
|
+
var S = c, b = S.to = S.path ? S.path.split(",") : [];
|
|
5602
|
+
if (S.path = void 0, S.query) {
|
|
5603
|
+
for (var U = !1, L = {}, J = S.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
6059
5604
|
var B = J[Y].split("=");
|
|
6060
5605
|
switch (B[0]) {
|
|
6061
5606
|
case "to":
|
|
@@ -6063,19 +5608,19 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6063
5608
|
b.push(Q[ie]);
|
|
6064
5609
|
break;
|
|
6065
5610
|
case "subject":
|
|
6066
|
-
|
|
5611
|
+
S.subject = pe(B[1], m);
|
|
6067
5612
|
break;
|
|
6068
5613
|
case "body":
|
|
6069
|
-
|
|
5614
|
+
S.body = pe(B[1], m);
|
|
6070
5615
|
break;
|
|
6071
5616
|
default:
|
|
6072
5617
|
U = !0, L[pe(B[0], m)] = pe(B[1], m);
|
|
6073
5618
|
break;
|
|
6074
5619
|
}
|
|
6075
5620
|
}
|
|
6076
|
-
U && (
|
|
5621
|
+
U && (S.headers = L);
|
|
6077
5622
|
}
|
|
6078
|
-
|
|
5623
|
+
S.query = void 0;
|
|
6079
5624
|
for (var X = 0, ae = b.length; X < ae; ++X) {
|
|
6080
5625
|
var ee = b[X].split("@");
|
|
6081
5626
|
if (ee[0] = pe(ee[0]), m.unicodeSupport)
|
|
@@ -6084,46 +5629,46 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6084
5629
|
try {
|
|
6085
5630
|
ee[1] = N.toASCII(pe(ee[1], m).toLowerCase());
|
|
6086
5631
|
} catch (Ee) {
|
|
6087
|
-
|
|
5632
|
+
S.error = S.error || "Email address's domain name can not be converted to ASCII via punycode: " + Ee;
|
|
6088
5633
|
}
|
|
6089
5634
|
b[X] = ee.join("@");
|
|
6090
5635
|
}
|
|
6091
|
-
return
|
|
5636
|
+
return S;
|
|
6092
5637
|
},
|
|
6093
5638
|
serialize: function(c, m) {
|
|
6094
|
-
var
|
|
5639
|
+
var S = c, b = l(c.to);
|
|
6095
5640
|
if (b) {
|
|
6096
5641
|
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,
|
|
5642
|
+
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
5643
|
try {
|
|
6099
5644
|
B = m.iri ? N.toUnicode(B) : N.toASCII(pe(B, m).toLowerCase());
|
|
6100
5645
|
} catch (X) {
|
|
6101
|
-
|
|
5646
|
+
S.error = S.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
6102
5647
|
}
|
|
6103
5648
|
b[U] = se + "@" + B;
|
|
6104
5649
|
}
|
|
6105
|
-
|
|
5650
|
+
S.path = b.join(",");
|
|
6106
5651
|
}
|
|
6107
5652
|
var Q = c.headers = c.headers || {};
|
|
6108
5653
|
c.subject && (Q.subject = c.subject), c.body && (Q.body = c.body);
|
|
6109
5654
|
var ie = [];
|
|
6110
5655
|
for (var V in Q)
|
|
6111
|
-
Q[V] !== ir[V] && ie.push(V.replace(We,
|
|
6112
|
-
return ie.length && (
|
|
5656
|
+
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));
|
|
5657
|
+
return ie.length && (S.query = ie.join("&")), S;
|
|
6113
5658
|
}
|
|
6114
|
-
}, hr = /^([^\:]+)\:(.*)/,
|
|
5659
|
+
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
6115
5660
|
scheme: "urn",
|
|
6116
5661
|
parse: function(c, m) {
|
|
6117
|
-
var
|
|
6118
|
-
if (
|
|
6119
|
-
var U = m.scheme || b.scheme || "urn", L =
|
|
5662
|
+
var S = c.path && c.path.match(hr), b = c;
|
|
5663
|
+
if (S) {
|
|
5664
|
+
var U = m.scheme || b.scheme || "urn", L = S[1].toLowerCase(), J = S[2], Y = U + ":" + (m.nid || L), se = M[Y];
|
|
6120
5665
|
b.nid = L, b.nss = J, b.path = void 0, se && (b = se.parse(b, m));
|
|
6121
5666
|
} else
|
|
6122
5667
|
b.error = b.error || "URN can not be parsed.";
|
|
6123
5668
|
return b;
|
|
6124
5669
|
},
|
|
6125
5670
|
serialize: function(c, m) {
|
|
6126
|
-
var
|
|
5671
|
+
var S = m.scheme || c.scheme || "urn", b = c.nid, U = S + ":" + (m.nid || b), L = M[U];
|
|
6127
5672
|
L && (c = L.serialize(c, m));
|
|
6128
5673
|
var J = c, Y = c.nss;
|
|
6129
5674
|
return J.path = (b || m.nid) + ":" + Y, J;
|
|
@@ -6131,15 +5676,15 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
6131
5676
|
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
6132
5677
|
scheme: "urn:uuid",
|
|
6133
5678
|
parse: function(c, m) {
|
|
6134
|
-
var
|
|
6135
|
-
return
|
|
5679
|
+
var S = c;
|
|
5680
|
+
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
5681
|
},
|
|
6137
5682
|
serialize: function(c, m) {
|
|
6138
|
-
var
|
|
6139
|
-
return
|
|
5683
|
+
var S = c;
|
|
5684
|
+
return S.nss = (c.uuid || "").toLowerCase(), S;
|
|
6140
5685
|
}
|
|
6141
5686
|
};
|
|
6142
|
-
|
|
5687
|
+
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
5688
|
});
|
|
6144
5689
|
})(uri_all, uri_all.exports);
|
|
6145
5690
|
var uri_allExports = uri_all.exports;
|
|
@@ -6167,9 +5712,9 @@ uri$1.default = uri;
|
|
|
6167
5712
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
6168
5713
|
return r.CodeGen;
|
|
6169
5714
|
} });
|
|
6170
|
-
const n = validation_error, s = ref_error, i = rules, a = compile, l = codegen, p = resolve$1,
|
|
6171
|
-
|
|
6172
|
-
const v = ["removeAdditional", "useDefaults", "coerceTypes"],
|
|
5715
|
+
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);
|
|
5716
|
+
R.code = "new RegExp";
|
|
5717
|
+
const v = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
6173
5718
|
"validate",
|
|
6174
5719
|
"serialize",
|
|
6175
5720
|
"parse",
|
|
@@ -6183,7 +5728,7 @@ uri$1.default = uri;
|
|
|
6183
5728
|
"func",
|
|
6184
5729
|
"obj",
|
|
6185
5730
|
"Error"
|
|
6186
|
-
]),
|
|
5731
|
+
]), g = {
|
|
6187
5732
|
errorDataPath: "",
|
|
6188
5733
|
format: "`validateFormats: false` can be used instead.",
|
|
6189
5734
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -6204,45 +5749,45 @@ uri$1.default = uri;
|
|
|
6204
5749
|
jsPropertySyntax: "",
|
|
6205
5750
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
6206
5751
|
}, k = 200;
|
|
6207
|
-
function
|
|
6208
|
-
var y, j, P, o, h, N,
|
|
6209
|
-
const
|
|
5752
|
+
function C(F) {
|
|
5753
|
+
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;
|
|
5754
|
+
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
5755
|
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 = (
|
|
5756
|
+
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
5757
|
+
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && q !== void 0 ? q : !0,
|
|
5758
|
+
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5759
|
+
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5760
|
+
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
6216
5761
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
6217
5762
|
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : k,
|
|
6218
5763
|
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : k,
|
|
6219
5764
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
6220
|
-
messages: (
|
|
6221
|
-
inlineRefs: (
|
|
6222
|
-
schemaId: (
|
|
5765
|
+
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5766
|
+
inlineRefs: (ze = F.inlineRefs) !== null && ze !== void 0 ? ze : !0,
|
|
5767
|
+
schemaId: (Ve = F.schemaId) !== null && Ve !== void 0 ? Ve : "$id",
|
|
6223
5768
|
addUsedSchema: (st = F.addUsedSchema) !== null && st !== void 0 ? st : !0,
|
|
6224
5769
|
validateSchema: (me = F.validateSchema) !== null && me !== void 0 ? me : !0,
|
|
6225
5770
|
validateFormats: (le = F.validateFormats) !== null && le !== void 0 ? le : !0,
|
|
6226
|
-
unicodeRegExp: (
|
|
5771
|
+
unicodeRegExp: (xe = F.unicodeRegExp) !== null && xe !== void 0 ? xe : !0,
|
|
6227
5772
|
int32range: (it = F.int32range) !== null && it !== void 0 ? it : !0,
|
|
6228
5773
|
uriResolver: Ne
|
|
6229
5774
|
};
|
|
6230
5775
|
}
|
|
6231
5776
|
class I {
|
|
6232
5777
|
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, ...
|
|
5778
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), y = this.opts = { ...y, ...C(y) };
|
|
6234
5779
|
const { es5: j, lines: P } = this.opts.code;
|
|
6235
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes:
|
|
5780
|
+
this.scope = new l.ValueScope({ scope: {}, prefixes: T, es5: j, lines: P }), this.logger = K(y.logger);
|
|
6236
5781
|
const o = y.validateFormats;
|
|
6237
|
-
y.validateFormats = !1, this.RULES = (0, i.getRules)(), A.call(this,
|
|
5782
|
+
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
5783
|
}
|
|
6239
5784
|
_addVocabularies() {
|
|
6240
5785
|
this.addKeyword("$async");
|
|
6241
5786
|
}
|
|
6242
5787
|
_addDefaultMetaSchema() {
|
|
6243
5788
|
const { $data: y, meta: j, schemaId: P } = this.opts;
|
|
6244
|
-
let o =
|
|
6245
|
-
P === "id" && (o = {
|
|
5789
|
+
let o = $;
|
|
5790
|
+
P === "id" && (o = { ...$ }, o.id = o.$id, delete o.$id), j && y && this.addMetaSchema(o, o[P], !1);
|
|
6246
5791
|
}
|
|
6247
5792
|
defaultMeta() {
|
|
6248
5793
|
const { meta: y, schemaId: j } = this.opts;
|
|
@@ -6281,18 +5826,18 @@ uri$1.default = uri;
|
|
|
6281
5826
|
} catch (ne) {
|
|
6282
5827
|
if (!(ne instanceof s.default))
|
|
6283
5828
|
throw ne;
|
|
6284
|
-
return
|
|
5829
|
+
return M.call(this, ne), await q.call(this, ne.missingSchema), N.call(this, G);
|
|
6285
5830
|
}
|
|
6286
5831
|
}
|
|
6287
|
-
function
|
|
5832
|
+
function M({ missingSchema: G, missingRef: ne }) {
|
|
6288
5833
|
if (this.refs[G])
|
|
6289
5834
|
throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
|
|
6290
5835
|
}
|
|
6291
|
-
async function
|
|
6292
|
-
const ne = await
|
|
5836
|
+
async function q(G) {
|
|
5837
|
+
const ne = await W.call(this, G);
|
|
6293
5838
|
this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
|
|
6294
5839
|
}
|
|
6295
|
-
async function
|
|
5840
|
+
async function W(G) {
|
|
6296
5841
|
const ne = this._loading[G];
|
|
6297
5842
|
if (ne)
|
|
6298
5843
|
return ne;
|
|
@@ -6396,14 +5941,14 @@ uri$1.default = uri;
|
|
|
6396
5941
|
} else
|
|
6397
5942
|
throw new Error("invalid addKeywords parameters");
|
|
6398
5943
|
if (oe.call(this, P, j), !j)
|
|
6399
|
-
return (0,
|
|
5944
|
+
return (0, d.eachItem)(P, (h) => ke.call(this, h)), this;
|
|
6400
5945
|
qe.call(this, j);
|
|
6401
5946
|
const o = {
|
|
6402
5947
|
...j,
|
|
6403
|
-
type: (0,
|
|
6404
|
-
schemaType: (0,
|
|
5948
|
+
type: (0, u.getJSONTypes)(j.type),
|
|
5949
|
+
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
6405
5950
|
};
|
|
6406
|
-
return (0,
|
|
5951
|
+
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
5952
|
}
|
|
6408
5953
|
getKeyword(y) {
|
|
6409
5954
|
const j = this.RULES.all[y];
|
|
@@ -6432,14 +5977,14 @@ uri$1.default = uri;
|
|
|
6432
5977
|
for (const o of j) {
|
|
6433
5978
|
const h = o.split("/").slice(1);
|
|
6434
5979
|
let N = y;
|
|
6435
|
-
for (const
|
|
6436
|
-
N = N[
|
|
6437
|
-
for (const
|
|
6438
|
-
const
|
|
6439
|
-
if (typeof
|
|
5980
|
+
for (const M of h)
|
|
5981
|
+
N = N[M];
|
|
5982
|
+
for (const M in P) {
|
|
5983
|
+
const q = P[M];
|
|
5984
|
+
if (typeof q != "object")
|
|
6440
5985
|
continue;
|
|
6441
|
-
const { $data:
|
|
6442
|
-
|
|
5986
|
+
const { $data: W } = q.definition, G = N[M];
|
|
5987
|
+
W && G && (N[M] = Ue(G));
|
|
6443
5988
|
}
|
|
6444
5989
|
}
|
|
6445
5990
|
return y;
|
|
@@ -6452,21 +5997,21 @@ uri$1.default = uri;
|
|
|
6452
5997
|
}
|
|
6453
5998
|
_addSchema(y, j, P, o = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6454
5999
|
let N;
|
|
6455
|
-
const { schemaId:
|
|
6000
|
+
const { schemaId: M } = this.opts;
|
|
6456
6001
|
if (typeof y == "object")
|
|
6457
|
-
N = y[
|
|
6002
|
+
N = y[M];
|
|
6458
6003
|
else {
|
|
6459
6004
|
if (this.opts.jtd)
|
|
6460
6005
|
throw new Error("schema must be object");
|
|
6461
6006
|
if (typeof y != "boolean")
|
|
6462
6007
|
throw new Error("schema must be object or boolean");
|
|
6463
6008
|
}
|
|
6464
|
-
let
|
|
6465
|
-
if (
|
|
6466
|
-
return
|
|
6009
|
+
let q = this._cache.get(y);
|
|
6010
|
+
if (q !== void 0)
|
|
6011
|
+
return q;
|
|
6467
6012
|
P = (0, p.normalizeId)(N || P);
|
|
6468
|
-
const
|
|
6469
|
-
return
|
|
6013
|
+
const W = p.getSchemaRefs.call(this, y, P);
|
|
6014
|
+
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
6015
|
}
|
|
6471
6016
|
_checkUnique(y) {
|
|
6472
6017
|
if (this.schemas[y] || this.refs[y])
|
|
@@ -6497,7 +6042,7 @@ uri$1.default = uri;
|
|
|
6497
6042
|
function w(F) {
|
|
6498
6043
|
return F = (0, p.normalizeId)(F), this.schemas[F] || this.refs[F];
|
|
6499
6044
|
}
|
|
6500
|
-
function
|
|
6045
|
+
function O() {
|
|
6501
6046
|
const F = this.opts.schemas;
|
|
6502
6047
|
if (F)
|
|
6503
6048
|
if (Array.isArray(F))
|
|
@@ -6523,7 +6068,7 @@ uri$1.default = uri;
|
|
|
6523
6068
|
j.keyword || (j.keyword = y), this.addKeyword(j);
|
|
6524
6069
|
}
|
|
6525
6070
|
}
|
|
6526
|
-
function
|
|
6071
|
+
function x() {
|
|
6527
6072
|
const F = { ...this.opts };
|
|
6528
6073
|
for (const y of v)
|
|
6529
6074
|
delete F[y];
|
|
@@ -6545,7 +6090,7 @@ uri$1.default = uri;
|
|
|
6545
6090
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6546
6091
|
function oe(F, y) {
|
|
6547
6092
|
const { RULES: j } = this;
|
|
6548
|
-
if ((0,
|
|
6093
|
+
if ((0, d.eachItem)(F, (P) => {
|
|
6549
6094
|
if (j.keywords[P])
|
|
6550
6095
|
throw new Error(`Keyword ${P} is already defined`);
|
|
6551
6096
|
if (!ue.test(P))
|
|
@@ -6559,31 +6104,31 @@ uri$1.default = uri;
|
|
|
6559
6104
|
if (j && o)
|
|
6560
6105
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6561
6106
|
const { RULES: h } = this;
|
|
6562
|
-
let N = o ? h.post : h.rules.find(({ type:
|
|
6107
|
+
let N = o ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6563
6108
|
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !y)
|
|
6564
6109
|
return;
|
|
6565
|
-
const
|
|
6110
|
+
const M = {
|
|
6566
6111
|
keyword: F,
|
|
6567
6112
|
definition: {
|
|
6568
6113
|
...y,
|
|
6569
|
-
type: (0,
|
|
6570
|
-
schemaType: (0,
|
|
6114
|
+
type: (0, u.getJSONTypes)(y.type),
|
|
6115
|
+
schemaType: (0, u.getJSONTypes)(y.schemaType)
|
|
6571
6116
|
}
|
|
6572
6117
|
};
|
|
6573
|
-
y.before ?
|
|
6118
|
+
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
6119
|
}
|
|
6575
|
-
function
|
|
6120
|
+
function Ce(F, y, j) {
|
|
6576
6121
|
const P = F.rules.findIndex((o) => o.keyword === j);
|
|
6577
6122
|
P >= 0 ? F.rules.splice(P, 0, y) : (F.rules.push(y), this.logger.warn(`rule ${j} is not defined`));
|
|
6578
6123
|
}
|
|
6579
6124
|
function qe(F) {
|
|
6580
6125
|
let { metaSchema: y } = F;
|
|
6581
|
-
y !== void 0 && (F.$data && this.opts.$data && (y =
|
|
6126
|
+
y !== void 0 && (F.$data && this.opts.$data && (y = Ue(y)), F.validateSchema = this.compile(y, !0));
|
|
6582
6127
|
}
|
|
6583
6128
|
const et = {
|
|
6584
6129
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6585
6130
|
};
|
|
6586
|
-
function
|
|
6131
|
+
function Ue(F) {
|
|
6587
6132
|
return { anyOf: [F, et] };
|
|
6588
6133
|
}
|
|
6589
6134
|
})(core$2);
|
|
@@ -6603,34 +6148,34 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6603
6148
|
keyword: "$ref",
|
|
6604
6149
|
schemaType: "string",
|
|
6605
6150
|
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 (
|
|
6151
|
+
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: a, opts: l, self: p } = n, { root: u } = i;
|
|
6152
|
+
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6153
|
+
return $();
|
|
6154
|
+
const d = compile_1$1.resolveRef.call(p, u, s, r);
|
|
6155
|
+
if (d === void 0)
|
|
6611
6156
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6612
|
-
if (
|
|
6613
|
-
return
|
|
6614
|
-
return
|
|
6615
|
-
function
|
|
6616
|
-
if (i ===
|
|
6157
|
+
if (d instanceof compile_1$1.SchemaEnv)
|
|
6158
|
+
return E(d);
|
|
6159
|
+
return R(d);
|
|
6160
|
+
function $() {
|
|
6161
|
+
if (i === u)
|
|
6617
6162
|
return callRef(e, a, i, i.$async);
|
|
6618
|
-
const v = t.scopeValue("root", { ref:
|
|
6619
|
-
return callRef(e, (0, codegen_1$l._)`${v}.validate`,
|
|
6163
|
+
const v = t.scopeValue("root", { ref: u });
|
|
6164
|
+
return callRef(e, (0, codegen_1$l._)`${v}.validate`, u, u.$async);
|
|
6620
6165
|
}
|
|
6621
|
-
function
|
|
6622
|
-
const
|
|
6623
|
-
callRef(e,
|
|
6166
|
+
function E(v) {
|
|
6167
|
+
const T = getValidate(e, v);
|
|
6168
|
+
callRef(e, T, v, v.$async);
|
|
6624
6169
|
}
|
|
6625
|
-
function
|
|
6626
|
-
const
|
|
6170
|
+
function R(v) {
|
|
6171
|
+
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
6172
|
schema: v,
|
|
6628
6173
|
dataTypes: [],
|
|
6629
6174
|
schemaPath: codegen_1$l.nil,
|
|
6630
|
-
topSchemaRef:
|
|
6175
|
+
topSchemaRef: T,
|
|
6631
6176
|
errSchemaPath: r
|
|
6632
|
-
},
|
|
6633
|
-
e.mergeEvaluated(_), e.ok(
|
|
6177
|
+
}, g);
|
|
6178
|
+
e.mergeEvaluated(_), e.ok(g);
|
|
6634
6179
|
}
|
|
6635
6180
|
}
|
|
6636
6181
|
};
|
|
@@ -6640,40 +6185,40 @@ function getValidate(e, t) {
|
|
|
6640
6185
|
}
|
|
6641
6186
|
ref.getValidate = getValidate;
|
|
6642
6187
|
function callRef(e, t, r, n) {
|
|
6643
|
-
const { gen: s, it: i } = e, { allErrors: a, schemaEnv: l, opts: p } = i,
|
|
6644
|
-
n ?
|
|
6645
|
-
function
|
|
6188
|
+
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;
|
|
6189
|
+
n ? d() : $();
|
|
6190
|
+
function d() {
|
|
6646
6191
|
if (!l.$async)
|
|
6647
6192
|
throw new Error("async schema referenced by sync schema");
|
|
6648
6193
|
const v = s.let("valid");
|
|
6649
6194
|
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._)`!(${
|
|
6195
|
+
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), R(t), a || s.assign(v, !0);
|
|
6196
|
+
}, (T) => {
|
|
6197
|
+
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), E(T), a || s.assign(v, !1);
|
|
6653
6198
|
}), e.ok(v);
|
|
6654
6199
|
}
|
|
6655
|
-
function
|
|
6656
|
-
e.result((0, code_1$8.callValidateCode)(e, t,
|
|
6200
|
+
function $() {
|
|
6201
|
+
e.result((0, code_1$8.callValidateCode)(e, t, u), () => R(t), () => E(t));
|
|
6657
6202
|
}
|
|
6658
|
-
function
|
|
6659
|
-
const
|
|
6660
|
-
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${
|
|
6203
|
+
function E(v) {
|
|
6204
|
+
const T = (0, codegen_1$l._)`${v}.errors`;
|
|
6205
|
+
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${T} : ${names_1$1.default.vErrors}.concat(${T})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6661
6206
|
}
|
|
6662
|
-
function
|
|
6663
|
-
var
|
|
6207
|
+
function R(v) {
|
|
6208
|
+
var T;
|
|
6664
6209
|
if (!i.opts.unevaluated)
|
|
6665
6210
|
return;
|
|
6666
|
-
const
|
|
6211
|
+
const g = (T = r == null ? void 0 : r.validate) === null || T === void 0 ? void 0 : T.evaluated;
|
|
6667
6212
|
if (i.props !== !0)
|
|
6668
|
-
if (
|
|
6669
|
-
|
|
6213
|
+
if (g && !g.dynamicProps)
|
|
6214
|
+
g.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, g.props, i.props));
|
|
6670
6215
|
else {
|
|
6671
6216
|
const _ = s.var("props", (0, codegen_1$l._)`${v}.evaluated.props`);
|
|
6672
6217
|
i.props = util_1$j.mergeEvaluated.props(s, _, i.props, codegen_1$l.Name);
|
|
6673
6218
|
}
|
|
6674
6219
|
if (i.items !== !0)
|
|
6675
|
-
if (
|
|
6676
|
-
|
|
6220
|
+
if (g && !g.dynamicItems)
|
|
6221
|
+
g.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, g.items, i.items));
|
|
6677
6222
|
else {
|
|
6678
6223
|
const _ = s.var("items", (0, codegen_1$l._)`${v}.evaluated.items`);
|
|
6679
6224
|
i.items = util_1$j.mergeEvaluated.items(s, _, i.items, codegen_1$l.Name);
|
|
@@ -6816,37 +6361,37 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6816
6361
|
if (!i && r.length === 0)
|
|
6817
6362
|
return;
|
|
6818
6363
|
const p = r.length >= l.loopRequired;
|
|
6819
|
-
if (a.allErrors ?
|
|
6820
|
-
const
|
|
6821
|
-
for (const
|
|
6822
|
-
if ((
|
|
6823
|
-
const
|
|
6364
|
+
if (a.allErrors ? u() : d(), l.strictRequired) {
|
|
6365
|
+
const R = e.parentSchema.properties, { definedProperties: v } = e.it;
|
|
6366
|
+
for (const T of r)
|
|
6367
|
+
if ((R == null ? void 0 : R[T]) === void 0 && !v.has(T)) {
|
|
6368
|
+
const g = a.schemaEnv.baseId + a.errSchemaPath, _ = `required property "${T}" is not defined at "${g}" (strictRequired)`;
|
|
6824
6369
|
(0, util_1$h.checkStrictMode)(a, _, a.opts.strictRequired);
|
|
6825
6370
|
}
|
|
6826
6371
|
}
|
|
6827
|
-
function
|
|
6372
|
+
function u() {
|
|
6828
6373
|
if (p || i)
|
|
6829
|
-
e.block$data(codegen_1$f.nil,
|
|
6374
|
+
e.block$data(codegen_1$f.nil, $);
|
|
6830
6375
|
else
|
|
6831
|
-
for (const
|
|
6832
|
-
(0, code_1$6.checkReportMissingProp)(e,
|
|
6376
|
+
for (const R of r)
|
|
6377
|
+
(0, code_1$6.checkReportMissingProp)(e, R);
|
|
6833
6378
|
}
|
|
6834
|
-
function
|
|
6835
|
-
const
|
|
6379
|
+
function d() {
|
|
6380
|
+
const R = t.let("missing");
|
|
6836
6381
|
if (p || i) {
|
|
6837
6382
|
const v = t.let("valid", !0);
|
|
6838
|
-
e.block$data(v, () =>
|
|
6383
|
+
e.block$data(v, () => E(R, v)), e.ok(v);
|
|
6839
6384
|
} else
|
|
6840
|
-
t.if((0, code_1$6.checkMissingProp)(e, r,
|
|
6385
|
+
t.if((0, code_1$6.checkMissingProp)(e, r, R)), (0, code_1$6.reportMissingProp)(e, R), t.else();
|
|
6841
6386
|
}
|
|
6842
|
-
function
|
|
6843
|
-
t.forOf("prop", n, (
|
|
6844
|
-
e.setParams({ missingProperty:
|
|
6387
|
+
function $() {
|
|
6388
|
+
t.forOf("prop", n, (R) => {
|
|
6389
|
+
e.setParams({ missingProperty: R }), t.if((0, code_1$6.noPropertyInData)(t, s, R, l.ownProperties), () => e.error());
|
|
6845
6390
|
});
|
|
6846
6391
|
}
|
|
6847
|
-
function
|
|
6848
|
-
e.setParams({ missingProperty:
|
|
6849
|
-
t.assign(v, (0, code_1$6.propertyInData)(t, s,
|
|
6392
|
+
function E(R, v) {
|
|
6393
|
+
e.setParams({ missingProperty: R }), t.forOf(R, n, () => {
|
|
6394
|
+
t.assign(v, (0, code_1$6.propertyInData)(t, s, R, l.ownProperties)), t.if((0, codegen_1$f.not)(v), () => {
|
|
6850
6395
|
e.error(), t.break();
|
|
6851
6396
|
});
|
|
6852
6397
|
}, codegen_1$f.nil);
|
|
@@ -6893,26 +6438,26 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6893
6438
|
const { gen: t, data: r, $data: n, schema: s, parentSchema: i, schemaCode: a, it: l } = e;
|
|
6894
6439
|
if (!n && !s)
|
|
6895
6440
|
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:
|
|
6441
|
+
const p = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6442
|
+
e.block$data(p, d, (0, codegen_1$d._)`${a} === false`), e.ok(p);
|
|
6443
|
+
function d() {
|
|
6444
|
+
const v = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6445
|
+
e.setParams({ i: v, j: T }), t.assign(p, !0), t.if((0, codegen_1$d._)`${v} > 1`, () => ($() ? E : R)(v, T));
|
|
6901
6446
|
}
|
|
6902
|
-
function
|
|
6903
|
-
return
|
|
6447
|
+
function $() {
|
|
6448
|
+
return u.length > 0 && !u.some((v) => v === "object" || v === "array");
|
|
6904
6449
|
}
|
|
6905
|
-
function
|
|
6906
|
-
const
|
|
6450
|
+
function E(v, T) {
|
|
6451
|
+
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
6452
|
t.for((0, codegen_1$d._)`;${v}--;`, () => {
|
|
6908
|
-
t.let(
|
|
6909
|
-
t.assign(
|
|
6910
|
-
}).code((0, codegen_1$d._)`${k}[${
|
|
6453
|
+
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"`, () => {
|
|
6454
|
+
t.assign(T, (0, codegen_1$d._)`${k}[${g}]`), e.error(), t.assign(p, !1).break();
|
|
6455
|
+
}).code((0, codegen_1$d._)`${k}[${g}] = ${v}`);
|
|
6911
6456
|
});
|
|
6912
6457
|
}
|
|
6913
|
-
function
|
|
6914
|
-
const
|
|
6915
|
-
t.label(_).for((0, codegen_1$d._)`;${v}--;`, () => t.for((0, codegen_1$d._)`${
|
|
6458
|
+
function R(v, T) {
|
|
6459
|
+
const g = (0, util_1$g.useFunc)(t, equal_1$2.default), _ = t.name("outer");
|
|
6460
|
+
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
6461
|
e.error(), t.assign(p, !1).break(_);
|
|
6917
6462
|
})));
|
|
6918
6463
|
}
|
|
@@ -6950,23 +6495,23 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6950
6495
|
throw new Error("enum must have non-empty array");
|
|
6951
6496
|
const l = s.length >= a.opts.loopEnum;
|
|
6952
6497
|
let p;
|
|
6953
|
-
const
|
|
6954
|
-
let
|
|
6498
|
+
const u = () => p ?? (p = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6499
|
+
let d;
|
|
6955
6500
|
if (l || n)
|
|
6956
|
-
|
|
6501
|
+
d = t.let("valid"), e.block$data(d, $);
|
|
6957
6502
|
else {
|
|
6958
6503
|
if (!Array.isArray(s))
|
|
6959
6504
|
throw new Error("ajv implementation error");
|
|
6960
|
-
const
|
|
6961
|
-
|
|
6505
|
+
const R = t.const("vSchema", i);
|
|
6506
|
+
d = (0, codegen_1$b.or)(...s.map((v, T) => E(R, T)));
|
|
6962
6507
|
}
|
|
6963
|
-
e.pass(
|
|
6964
|
-
function
|
|
6965
|
-
t.assign(
|
|
6508
|
+
e.pass(d);
|
|
6509
|
+
function $() {
|
|
6510
|
+
t.assign(d, !1), t.forOf("v", i, (R) => t.if((0, codegen_1$b._)`${u()}(${r}, ${R})`, () => t.assign(d, !0).break()));
|
|
6966
6511
|
}
|
|
6967
|
-
function
|
|
6968
|
-
const
|
|
6969
|
-
return typeof
|
|
6512
|
+
function E(R, v) {
|
|
6513
|
+
const T = s[v];
|
|
6514
|
+
return typeof T == "object" && T !== null ? (0, codegen_1$b._)`${u()}(${r}, ${R}[${v}])` : (0, codegen_1$b._)`${r} === ${T}`;
|
|
6970
6515
|
}
|
|
6971
6516
|
}
|
|
6972
6517
|
};
|
|
@@ -7020,12 +6565,12 @@ function validateAdditionalItems(e, t) {
|
|
|
7020
6565
|
if (n === !1)
|
|
7021
6566
|
e.setParams({ len: t.length }), e.pass((0, codegen_1$a._)`${l} <= ${t.length}`);
|
|
7022
6567
|
else if (typeof n == "object" && !(0, util_1$d.alwaysValidSchema)(a, n)) {
|
|
7023
|
-
const
|
|
7024
|
-
r.if((0, codegen_1$a.not)(
|
|
6568
|
+
const u = r.var("valid", (0, codegen_1$a._)`${l} <= ${t.length}`);
|
|
6569
|
+
r.if((0, codegen_1$a.not)(u), () => p(u)), e.ok(u);
|
|
7025
6570
|
}
|
|
7026
|
-
function p(
|
|
7027
|
-
r.forRange("i", t.length, l, (
|
|
7028
|
-
e.subschema({ keyword: i, dataProp:
|
|
6571
|
+
function p(u) {
|
|
6572
|
+
r.forRange("i", t.length, l, (d) => {
|
|
6573
|
+
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
6574
|
});
|
|
7030
6575
|
}
|
|
7031
6576
|
}
|
|
@@ -7048,20 +6593,20 @@ const codegen_1$9 = codegen, util_1$c = util, code_1$5 = code, def$f = {
|
|
|
7048
6593
|
};
|
|
7049
6594
|
function validateTuple(e, t, r = e.schema) {
|
|
7050
6595
|
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,
|
|
6596
|
+
d(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
6597
|
+
const p = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6598
|
+
r.forEach(($, E) => {
|
|
6599
|
+
(0, util_1$c.alwaysValidSchema)(l, $) || (n.if((0, codegen_1$9._)`${u} > ${E}`, () => e.subschema({
|
|
7055
6600
|
keyword: a,
|
|
7056
|
-
schemaProp:
|
|
7057
|
-
dataProp:
|
|
6601
|
+
schemaProp: E,
|
|
6602
|
+
dataProp: E
|
|
7058
6603
|
}, p)), e.ok(p));
|
|
7059
6604
|
});
|
|
7060
|
-
function
|
|
7061
|
-
const { opts:
|
|
7062
|
-
if (
|
|
7063
|
-
const
|
|
7064
|
-
(0, util_1$c.checkStrictMode)(l,
|
|
6605
|
+
function d($) {
|
|
6606
|
+
const { opts: E, errSchemaPath: R } = l, v = r.length, T = v === $.minItems && (v === $.maxItems || $[t] === !1);
|
|
6607
|
+
if (E.strictTuples && !T) {
|
|
6608
|
+
const g = `"${a}" is ${v}-tuple, but minItems or maxItems/${t} are not specified or different at path "${R}"`;
|
|
6609
|
+
(0, util_1$c.checkStrictMode)(l, g, E.strictTuples);
|
|
7065
6610
|
}
|
|
7066
6611
|
}
|
|
7067
6612
|
}
|
|
@@ -7108,9 +6653,9 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
7108
6653
|
code(e) {
|
|
7109
6654
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
7110
6655
|
let a, l;
|
|
7111
|
-
const { minContains: p, maxContains:
|
|
7112
|
-
i.opts.next ? (a = p === void 0 ? 1 : p, l =
|
|
7113
|
-
const
|
|
6656
|
+
const { minContains: p, maxContains: u } = n;
|
|
6657
|
+
i.opts.next ? (a = p === void 0 ? 1 : p, l = u) : a = 1;
|
|
6658
|
+
const d = t.const("len", (0, codegen_1$7._)`${s}.length`);
|
|
7114
6659
|
if (e.setParams({ min: a, max: l }), l === void 0 && a === 0) {
|
|
7115
6660
|
(0, util_1$a.checkStrictMode)(i, '"minContains" == 0 without "maxContains": "contains" keyword ignored');
|
|
7116
6661
|
return;
|
|
@@ -7120,29 +6665,29 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
7120
6665
|
return;
|
|
7121
6666
|
}
|
|
7122
6667
|
if ((0, util_1$a.alwaysValidSchema)(i, r)) {
|
|
7123
|
-
let
|
|
7124
|
-
l !== void 0 && (
|
|
6668
|
+
let T = (0, codegen_1$7._)`${d} >= ${a}`;
|
|
6669
|
+
l !== void 0 && (T = (0, codegen_1$7._)`${T} && ${d} <= ${l}`), e.pass(T);
|
|
7125
6670
|
return;
|
|
7126
6671
|
}
|
|
7127
6672
|
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,
|
|
6673
|
+
const $ = t.name("valid");
|
|
6674
|
+
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());
|
|
6675
|
+
function E() {
|
|
6676
|
+
const T = t.name("_valid"), g = t.let("count", 0);
|
|
6677
|
+
R(T, () => t.if(T, () => v(g)));
|
|
6678
|
+
}
|
|
6679
|
+
function R(T, g) {
|
|
6680
|
+
t.forRange("i", 0, d, (_) => {
|
|
7136
6681
|
e.subschema({
|
|
7137
6682
|
keyword: "contains",
|
|
7138
6683
|
dataProp: _,
|
|
7139
6684
|
dataPropType: util_1$a.Type.Num,
|
|
7140
6685
|
compositeRule: !0
|
|
7141
|
-
},
|
|
6686
|
+
}, T), g();
|
|
7142
6687
|
});
|
|
7143
6688
|
}
|
|
7144
|
-
function v(
|
|
7145
|
-
t.code((0, codegen_1$7._)`${
|
|
6689
|
+
function v(T) {
|
|
6690
|
+
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
6691
|
}
|
|
7147
6692
|
}
|
|
7148
6693
|
};
|
|
@@ -7152,14 +6697,14 @@ var dependencies = {};
|
|
|
7152
6697
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.validateSchemaDeps = e.validatePropertyDeps = e.error = void 0;
|
|
7153
6698
|
const t = codegen, r = util, n = code;
|
|
7154
6699
|
e.error = {
|
|
7155
|
-
message: ({ params: { property: p, depsCount:
|
|
7156
|
-
const
|
|
7157
|
-
return (0, t.str)`must have ${
|
|
6700
|
+
message: ({ params: { property: p, depsCount: u, deps: d } }) => {
|
|
6701
|
+
const $ = u === 1 ? "property" : "properties";
|
|
6702
|
+
return (0, t.str)`must have ${$} ${d} when property ${p} is present`;
|
|
7158
6703
|
},
|
|
7159
|
-
params: ({ params: { property: p, depsCount:
|
|
7160
|
-
missingProperty: ${
|
|
7161
|
-
depsCount: ${
|
|
7162
|
-
deps: ${
|
|
6704
|
+
params: ({ params: { property: p, depsCount: u, deps: d, missingProperty: $ } }) => (0, t._)`{property: ${p},
|
|
6705
|
+
missingProperty: ${$},
|
|
6706
|
+
depsCount: ${u},
|
|
6707
|
+
deps: ${d}}`
|
|
7163
6708
|
// TODO change to reference
|
|
7164
6709
|
};
|
|
7165
6710
|
const s = {
|
|
@@ -7168,51 +6713,51 @@ var dependencies = {};
|
|
|
7168
6713
|
schemaType: "object",
|
|
7169
6714
|
error: e.error,
|
|
7170
6715
|
code(p) {
|
|
7171
|
-
const [
|
|
7172
|
-
a(p,
|
|
6716
|
+
const [u, d] = i(p);
|
|
6717
|
+
a(p, u), l(p, d);
|
|
7173
6718
|
}
|
|
7174
6719
|
};
|
|
7175
6720
|
function i({ schema: p }) {
|
|
7176
|
-
const
|
|
7177
|
-
for (const
|
|
7178
|
-
if (
|
|
6721
|
+
const u = {}, d = {};
|
|
6722
|
+
for (const $ in p) {
|
|
6723
|
+
if ($ === "__proto__")
|
|
7179
6724
|
continue;
|
|
7180
|
-
const
|
|
7181
|
-
|
|
6725
|
+
const E = Array.isArray(p[$]) ? u : d;
|
|
6726
|
+
E[$] = p[$];
|
|
7182
6727
|
}
|
|
7183
|
-
return [
|
|
6728
|
+
return [u, d];
|
|
7184
6729
|
}
|
|
7185
|
-
function a(p,
|
|
7186
|
-
const { gen:
|
|
7187
|
-
if (Object.keys(
|
|
6730
|
+
function a(p, u = p.schema) {
|
|
6731
|
+
const { gen: d, data: $, it: E } = p;
|
|
6732
|
+
if (Object.keys(u).length === 0)
|
|
7188
6733
|
return;
|
|
7189
|
-
const
|
|
7190
|
-
for (const v in
|
|
7191
|
-
const
|
|
7192
|
-
if (
|
|
6734
|
+
const R = d.let("missing");
|
|
6735
|
+
for (const v in u) {
|
|
6736
|
+
const T = u[v];
|
|
6737
|
+
if (T.length === 0)
|
|
7193
6738
|
continue;
|
|
7194
|
-
const
|
|
6739
|
+
const g = (0, n.propertyInData)(d, $, v, E.opts.ownProperties);
|
|
7195
6740
|
p.setParams({
|
|
7196
6741
|
property: v,
|
|
7197
|
-
depsCount:
|
|
7198
|
-
deps:
|
|
7199
|
-
}),
|
|
7200
|
-
for (const _ of
|
|
6742
|
+
depsCount: T.length,
|
|
6743
|
+
deps: T.join(", ")
|
|
6744
|
+
}), E.allErrors ? d.if(g, () => {
|
|
6745
|
+
for (const _ of T)
|
|
7201
6746
|
(0, n.checkReportMissingProp)(p, _);
|
|
7202
|
-
}) : (
|
|
6747
|
+
}) : (d.if((0, t._)`${g} && (${(0, n.checkMissingProp)(p, T, R)})`), (0, n.reportMissingProp)(p, R), d.else());
|
|
7203
6748
|
}
|
|
7204
6749
|
}
|
|
7205
6750
|
e.validatePropertyDeps = a;
|
|
7206
|
-
function l(p,
|
|
7207
|
-
const { gen:
|
|
7208
|
-
for (const
|
|
7209
|
-
(0, r.alwaysValidSchema)(
|
|
7210
|
-
(0, n.propertyInData)(
|
|
6751
|
+
function l(p, u = p.schema) {
|
|
6752
|
+
const { gen: d, data: $, keyword: E, it: R } = p, v = d.name("valid");
|
|
6753
|
+
for (const T in u)
|
|
6754
|
+
(0, r.alwaysValidSchema)(R, u[T]) || (d.if(
|
|
6755
|
+
(0, n.propertyInData)(d, $, T, R.opts.ownProperties),
|
|
7211
6756
|
() => {
|
|
7212
|
-
const
|
|
7213
|
-
p.mergeValidEvaluated(
|
|
6757
|
+
const g = p.subschema({ keyword: E, schemaProp: T }, v);
|
|
6758
|
+
p.mergeValidEvaluated(g, v);
|
|
7214
6759
|
},
|
|
7215
|
-
() =>
|
|
6760
|
+
() => d.var(v, !0)
|
|
7216
6761
|
// TODO var
|
|
7217
6762
|
), p.ok(v));
|
|
7218
6763
|
}
|
|
@@ -7266,52 +6811,52 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
7266
6811
|
const { allErrors: l, opts: p } = a;
|
|
7267
6812
|
if (a.props = !0, p.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(a, r))
|
|
7268
6813
|
return;
|
|
7269
|
-
const
|
|
7270
|
-
|
|
7271
|
-
function
|
|
7272
|
-
t.forIn("key", s, (
|
|
7273
|
-
!
|
|
6814
|
+
const u = (0, code_1$3.allSchemaProperties)(n.properties), d = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6815
|
+
$(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6816
|
+
function $() {
|
|
6817
|
+
t.forIn("key", s, (g) => {
|
|
6818
|
+
!u.length && !d.length ? v(g) : t.if(E(g), () => v(g));
|
|
7274
6819
|
});
|
|
7275
6820
|
}
|
|
7276
|
-
function
|
|
6821
|
+
function E(g) {
|
|
7277
6822
|
let _;
|
|
7278
|
-
if (
|
|
6823
|
+
if (u.length > 8) {
|
|
7279
6824
|
const k = (0, util_1$8.schemaRefOrVal)(a, n.properties, "properties");
|
|
7280
|
-
_ = (0, code_1$3.isOwnProperty)(t, k,
|
|
6825
|
+
_ = (0, code_1$3.isOwnProperty)(t, k, g);
|
|
7281
6826
|
} else
|
|
7282
|
-
|
|
7283
|
-
return
|
|
6827
|
+
u.length ? _ = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${g} === ${k}`)) : _ = codegen_1$5.nil;
|
|
6828
|
+
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
6829
|
}
|
|
7285
|
-
function
|
|
7286
|
-
t.code((0, codegen_1$5._)`delete ${s}[${
|
|
6830
|
+
function R(g) {
|
|
6831
|
+
t.code((0, codegen_1$5._)`delete ${s}[${g}]`);
|
|
7287
6832
|
}
|
|
7288
|
-
function v(
|
|
6833
|
+
function v(g) {
|
|
7289
6834
|
if (p.removeAdditional === "all" || p.removeAdditional && r === !1) {
|
|
7290
|
-
|
|
6835
|
+
R(g);
|
|
7291
6836
|
return;
|
|
7292
6837
|
}
|
|
7293
6838
|
if (r === !1) {
|
|
7294
|
-
e.setParams({ additionalProperty:
|
|
6839
|
+
e.setParams({ additionalProperty: g }), e.error(), l || t.break();
|
|
7295
6840
|
return;
|
|
7296
6841
|
}
|
|
7297
6842
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(a, r)) {
|
|
7298
6843
|
const _ = t.name("valid");
|
|
7299
|
-
p.removeAdditional === "failing" ? (
|
|
7300
|
-
e.reset(),
|
|
7301
|
-
})) : (
|
|
6844
|
+
p.removeAdditional === "failing" ? (T(g, _, !1), t.if((0, codegen_1$5.not)(_), () => {
|
|
6845
|
+
e.reset(), R(g);
|
|
6846
|
+
})) : (T(g, _), l || t.if((0, codegen_1$5.not)(_), () => t.break()));
|
|
7302
6847
|
}
|
|
7303
6848
|
}
|
|
7304
|
-
function
|
|
7305
|
-
const
|
|
6849
|
+
function T(g, _, k) {
|
|
6850
|
+
const C = {
|
|
7306
6851
|
keyword: "additionalProperties",
|
|
7307
|
-
dataProp:
|
|
6852
|
+
dataProp: g,
|
|
7308
6853
|
dataPropType: util_1$8.Type.Str
|
|
7309
6854
|
};
|
|
7310
|
-
k === !1 && Object.assign(
|
|
6855
|
+
k === !1 && Object.assign(C, {
|
|
7311
6856
|
compositeRule: !0,
|
|
7312
6857
|
createErrors: !1,
|
|
7313
6858
|
allErrors: !1
|
|
7314
|
-
}), e.subschema(
|
|
6859
|
+
}), e.subschema(C, _);
|
|
7315
6860
|
}
|
|
7316
6861
|
}
|
|
7317
6862
|
};
|
|
@@ -7326,23 +6871,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
7326
6871
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
7327
6872
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
7328
6873
|
const a = (0, code_1$2.allSchemaProperties)(r);
|
|
7329
|
-
for (const
|
|
7330
|
-
i.definedProperties.add(
|
|
6874
|
+
for (const $ of a)
|
|
6875
|
+
i.definedProperties.add($);
|
|
7331
6876
|
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((
|
|
6877
|
+
const l = a.filter(($) => !(0, util_1$7.alwaysValidSchema)(i, r[$]));
|
|
7333
6878
|
if (l.length === 0)
|
|
7334
6879
|
return;
|
|
7335
6880
|
const p = t.name("valid");
|
|
7336
|
-
for (const
|
|
7337
|
-
|
|
7338
|
-
function
|
|
7339
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6881
|
+
for (const $ of l)
|
|
6882
|
+
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);
|
|
6883
|
+
function u($) {
|
|
6884
|
+
return i.opts.useDefaults && !i.compositeRule && r[$].default !== void 0;
|
|
7340
6885
|
}
|
|
7341
|
-
function
|
|
6886
|
+
function d($) {
|
|
7342
6887
|
e.subschema({
|
|
7343
6888
|
keyword: "properties",
|
|
7344
|
-
schemaProp:
|
|
7345
|
-
dataProp:
|
|
6889
|
+
schemaProp: $,
|
|
6890
|
+
dataProp: $
|
|
7346
6891
|
}, p);
|
|
7347
6892
|
}
|
|
7348
6893
|
}
|
|
@@ -7355,31 +6900,31 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
7355
6900
|
type: "object",
|
|
7356
6901
|
schemaType: "object",
|
|
7357
6902
|
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((
|
|
6903
|
+
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
6904
|
if (l.length === 0 || p.length === l.length && (!i.opts.unevaluated || i.props === !0))
|
|
7360
6905
|
return;
|
|
7361
|
-
const
|
|
6906
|
+
const u = a.strictSchema && !a.allowMatchingProperties && s.properties, d = t.name("valid");
|
|
7362
6907
|
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(
|
|
6908
|
+
const { props: $ } = i;
|
|
6909
|
+
E();
|
|
6910
|
+
function E() {
|
|
6911
|
+
for (const T of l)
|
|
6912
|
+
u && R(T), i.allErrors ? v(T) : (t.var(d, !0), v(T), t.if(d));
|
|
6913
|
+
}
|
|
6914
|
+
function R(T) {
|
|
6915
|
+
for (const g in u)
|
|
6916
|
+
new RegExp(T).test(g) && (0, util_1$6.checkStrictMode)(i, `property ${g} matches pattern ${T} (use allowMatchingProperties)`);
|
|
6917
|
+
}
|
|
6918
|
+
function v(T) {
|
|
6919
|
+
t.forIn("key", n, (g) => {
|
|
6920
|
+
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, T)}.test(${g})`, () => {
|
|
6921
|
+
const _ = p.includes(T);
|
|
7377
6922
|
_ || e.subschema({
|
|
7378
6923
|
keyword: "patternProperties",
|
|
7379
|
-
schemaProp:
|
|
7380
|
-
dataProp:
|
|
6924
|
+
schemaProp: T,
|
|
6925
|
+
dataProp: g,
|
|
7381
6926
|
dataPropType: util_2.Type.Str
|
|
7382
|
-
},
|
|
6927
|
+
}, 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
6928
|
});
|
|
7384
6929
|
});
|
|
7385
6930
|
}
|
|
@@ -7436,16 +6981,16 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7436
6981
|
if (s.opts.discriminator && n.discriminator)
|
|
7437
6982
|
return;
|
|
7438
6983
|
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,
|
|
6984
|
+
e.setParams({ passing: l }), t.block(u), e.result(a, () => e.reset(), () => e.error(!0));
|
|
6985
|
+
function u() {
|
|
6986
|
+
i.forEach((d, $) => {
|
|
6987
|
+
let E;
|
|
6988
|
+
(0, util_1$4.alwaysValidSchema)(s, d) ? t.var(p, !0) : E = e.subschema({
|
|
7444
6989
|
keyword: "oneOf",
|
|
7445
|
-
schemaProp:
|
|
6990
|
+
schemaProp: $,
|
|
7446
6991
|
compositeRule: !0
|
|
7447
|
-
}, p),
|
|
7448
|
-
t.assign(a, !0), t.assign(l,
|
|
6992
|
+
}, p), $ > 0 && t.if((0, codegen_1$3._)`${p} && ${a}`).assign(a, !1).assign(l, (0, codegen_1$3._)`[${l}, ${$}]`).else(), t.if(p, () => {
|
|
6993
|
+
t.assign(a, !0), t.assign(l, $), E && e.mergeEvaluated(E, codegen_1$3.Name);
|
|
7449
6994
|
});
|
|
7450
6995
|
});
|
|
7451
6996
|
}
|
|
@@ -7489,24 +7034,24 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7489
7034
|
return;
|
|
7490
7035
|
const a = t.let("valid", !0), l = t.name("_valid");
|
|
7491
7036
|
if (p(), e.reset(), s && i) {
|
|
7492
|
-
const
|
|
7493
|
-
e.setParams({ ifClause:
|
|
7037
|
+
const d = t.let("ifClause");
|
|
7038
|
+
e.setParams({ ifClause: d }), t.if(l, u("then", d), u("else", d));
|
|
7494
7039
|
} else
|
|
7495
|
-
s ? t.if(l,
|
|
7040
|
+
s ? t.if(l, u("then")) : t.if((0, codegen_1$2.not)(l), u("else"));
|
|
7496
7041
|
e.pass(a, () => e.error(!0));
|
|
7497
7042
|
function p() {
|
|
7498
|
-
const
|
|
7043
|
+
const d = e.subschema({
|
|
7499
7044
|
keyword: "if",
|
|
7500
7045
|
compositeRule: !0,
|
|
7501
7046
|
createErrors: !1,
|
|
7502
7047
|
allErrors: !1
|
|
7503
7048
|
}, l);
|
|
7504
|
-
e.mergeEvaluated(
|
|
7049
|
+
e.mergeEvaluated(d);
|
|
7505
7050
|
}
|
|
7506
|
-
function d
|
|
7051
|
+
function u(d, $) {
|
|
7507
7052
|
return () => {
|
|
7508
|
-
const
|
|
7509
|
-
t.assign(a, l), e.mergeValidEvaluated(
|
|
7053
|
+
const E = e.subschema({ keyword: d }, l);
|
|
7054
|
+
t.assign(a, l), e.mergeValidEvaluated(E, a), $ ? t.assign($, (0, codegen_1$2._)`${d}`) : e.setParams({ ifClause: d });
|
|
7510
7055
|
};
|
|
7511
7056
|
}
|
|
7512
7057
|
}
|
|
@@ -7559,55 +7104,55 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7559
7104
|
$data: !0,
|
|
7560
7105
|
error: error$1,
|
|
7561
7106
|
code(e, t) {
|
|
7562
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: a, it: l } = e, { opts: p, errSchemaPath:
|
|
7107
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: a, it: l } = e, { opts: p, errSchemaPath: u, schemaEnv: d, self: $ } = l;
|
|
7563
7108
|
if (!p.validateFormats)
|
|
7564
7109
|
return;
|
|
7565
|
-
s ?
|
|
7566
|
-
function
|
|
7110
|
+
s ? E() : R();
|
|
7111
|
+
function E() {
|
|
7567
7112
|
const v = r.scopeValue("formats", {
|
|
7568
|
-
ref:
|
|
7113
|
+
ref: $.formats,
|
|
7569
7114
|
code: p.code.formats
|
|
7570
|
-
}),
|
|
7571
|
-
r.if((0, codegen_1$1._)`typeof ${
|
|
7115
|
+
}), T = r.const("fDef", (0, codegen_1$1._)`${v}[${a}]`), g = r.let("fType"), _ = r.let("format");
|
|
7116
|
+
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
7117
|
function k() {
|
|
7573
7118
|
return p.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${a} && !${_}`;
|
|
7574
7119
|
}
|
|
7575
|
-
function
|
|
7576
|
-
const I =
|
|
7577
|
-
return (0, codegen_1$1._)`${_} && ${_} !== true && ${
|
|
7120
|
+
function C() {
|
|
7121
|
+
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}))`;
|
|
7122
|
+
return (0, codegen_1$1._)`${_} && ${_} !== true && ${g} === ${t} && !${A}`;
|
|
7578
7123
|
}
|
|
7579
7124
|
}
|
|
7580
|
-
function
|
|
7581
|
-
const v =
|
|
7125
|
+
function R() {
|
|
7126
|
+
const v = $.formats[i];
|
|
7582
7127
|
if (!v) {
|
|
7583
7128
|
k();
|
|
7584
7129
|
return;
|
|
7585
7130
|
}
|
|
7586
7131
|
if (v === !0)
|
|
7587
7132
|
return;
|
|
7588
|
-
const [
|
|
7589
|
-
|
|
7133
|
+
const [T, g, _] = C(v);
|
|
7134
|
+
T === t && e.pass(I());
|
|
7590
7135
|
function k() {
|
|
7591
7136
|
if (p.strictSchema === !1) {
|
|
7592
|
-
|
|
7137
|
+
$.logger.warn(A());
|
|
7593
7138
|
return;
|
|
7594
7139
|
}
|
|
7595
7140
|
throw new Error(A());
|
|
7596
7141
|
function A() {
|
|
7597
|
-
return `unknown format "${i}" ignored in schema at path "${
|
|
7142
|
+
return `unknown format "${i}" ignored in schema at path "${u}"`;
|
|
7598
7143
|
}
|
|
7599
7144
|
}
|
|
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._)`${
|
|
7145
|
+
function C(A) {
|
|
7146
|
+
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 });
|
|
7147
|
+
return typeof A == "object" && !(A instanceof RegExp) ? [A.type || "string", A.validate, (0, codegen_1$1._)`${O}.validate`] : ["string", A, O];
|
|
7603
7148
|
}
|
|
7604
7149
|
function I() {
|
|
7605
7150
|
if (typeof v == "object" && !(v instanceof RegExp) && v.async) {
|
|
7606
|
-
if (!
|
|
7151
|
+
if (!d.$async)
|
|
7607
7152
|
throw new Error("async format in sync schema");
|
|
7608
7153
|
return (0, codegen_1$1._)`await ${_}(${n})`;
|
|
7609
7154
|
}
|
|
7610
|
-
return typeof
|
|
7155
|
+
return typeof g == "function" ? (0, codegen_1$1._)`${_}(${n})` : (0, codegen_1$1._)`${_}.test(${n})`;
|
|
7611
7156
|
}
|
|
7612
7157
|
}
|
|
7613
7158
|
}
|
|
@@ -7669,32 +7214,32 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7669
7214
|
throw new Error("discriminator: mapping is not supported");
|
|
7670
7215
|
if (!a)
|
|
7671
7216
|
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
|
|
7217
|
+
const p = t.let("valid", !1), u = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(l)}`);
|
|
7218
|
+
t.if((0, codegen_1._)`typeof ${u} == "string"`, () => d(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: u, tagName: l })), e.ok(p);
|
|
7219
|
+
function d() {
|
|
7220
|
+
const R = E();
|
|
7676
7221
|
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
|
|
7222
|
+
for (const v in R)
|
|
7223
|
+
t.elseIf((0, codegen_1._)`${u} === ${v}`), t.assign(p, $(R[v]));
|
|
7224
|
+
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7225
|
+
}
|
|
7226
|
+
function $(R) {
|
|
7227
|
+
const v = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: R }, v);
|
|
7228
|
+
return e.mergeEvaluated(T, codegen_1.Name), v;
|
|
7229
|
+
}
|
|
7230
|
+
function E() {
|
|
7231
|
+
var R;
|
|
7232
|
+
const v = {}, T = _(s);
|
|
7233
|
+
let g = !0;
|
|
7689
7234
|
for (let I = 0; I < a.length; I++) {
|
|
7690
7235
|
let A = a[I];
|
|
7691
7236
|
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 = (
|
|
7237
|
+
const w = (R = A == null ? void 0 : A.properties) === null || R === void 0 ? void 0 : R[l];
|
|
7693
7238
|
if (typeof w != "object")
|
|
7694
7239
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7695
|
-
|
|
7240
|
+
g = g && (T || _(A)), k(w, I);
|
|
7696
7241
|
}
|
|
7697
|
-
if (
|
|
7242
|
+
if (!g)
|
|
7698
7243
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7699
7244
|
return v;
|
|
7700
7245
|
function _({ required: I }) {
|
|
@@ -7702,14 +7247,14 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7702
7247
|
}
|
|
7703
7248
|
function k(I, A) {
|
|
7704
7249
|
if (I.const)
|
|
7705
|
-
|
|
7250
|
+
C(I.const, A);
|
|
7706
7251
|
else if (I.enum)
|
|
7707
7252
|
for (const w of I.enum)
|
|
7708
|
-
|
|
7253
|
+
C(w, A);
|
|
7709
7254
|
else
|
|
7710
7255
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7711
7256
|
}
|
|
7712
|
-
function
|
|
7257
|
+
function C(I, A) {
|
|
7713
7258
|
if (typeof I != "string" || I in v)
|
|
7714
7259
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7715
7260
|
v[I] = A;
|
|
@@ -7977,31 +7522,31 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7977
7522
|
}
|
|
7978
7523
|
}
|
|
7979
7524
|
e.exports = t = p, Object.defineProperty(t, "__esModule", { value: !0 }), t.default = p;
|
|
7980
|
-
var
|
|
7525
|
+
var u = validate;
|
|
7981
7526
|
Object.defineProperty(t, "KeywordCxt", { enumerable: !0, get: function() {
|
|
7982
|
-
return
|
|
7527
|
+
return u.KeywordCxt;
|
|
7983
7528
|
} });
|
|
7984
|
-
var
|
|
7529
|
+
var d = codegen;
|
|
7985
7530
|
Object.defineProperty(t, "_", { enumerable: !0, get: function() {
|
|
7986
|
-
return
|
|
7531
|
+
return d._;
|
|
7987
7532
|
} }), Object.defineProperty(t, "str", { enumerable: !0, get: function() {
|
|
7988
|
-
return
|
|
7533
|
+
return d.str;
|
|
7989
7534
|
} }), Object.defineProperty(t, "stringify", { enumerable: !0, get: function() {
|
|
7990
|
-
return
|
|
7535
|
+
return d.stringify;
|
|
7991
7536
|
} }), Object.defineProperty(t, "nil", { enumerable: !0, get: function() {
|
|
7992
|
-
return
|
|
7537
|
+
return d.nil;
|
|
7993
7538
|
} }), Object.defineProperty(t, "Name", { enumerable: !0, get: function() {
|
|
7994
|
-
return
|
|
7539
|
+
return d.Name;
|
|
7995
7540
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7996
|
-
return
|
|
7541
|
+
return d.CodeGen;
|
|
7997
7542
|
} });
|
|
7998
|
-
var
|
|
7543
|
+
var $ = validation_error;
|
|
7999
7544
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
8000
|
-
return
|
|
7545
|
+
return $.default;
|
|
8001
7546
|
} });
|
|
8002
|
-
var
|
|
7547
|
+
var E = ref_error;
|
|
8003
7548
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
8004
|
-
return
|
|
7549
|
+
return E.default;
|
|
8005
7550
|
} });
|
|
8006
7551
|
})(ajv$1, ajv$1.exports);
|
|
8007
7552
|
var ajvExports = ajv$1.exports;
|
|
@@ -8409,55 +7954,6 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
8409
7954
|
"themeFolderName"
|
|
8410
7955
|
]
|
|
8411
7956
|
},
|
|
8412
|
-
{
|
|
8413
|
-
type: "object",
|
|
8414
|
-
additionalProperties: !1,
|
|
8415
|
-
properties: {
|
|
8416
|
-
progress: {
|
|
8417
|
-
type: "object",
|
|
8418
|
-
properties: {
|
|
8419
|
-
weight: {
|
|
8420
|
-
type: "number"
|
|
8421
|
-
},
|
|
8422
|
-
caption: {
|
|
8423
|
-
type: "string"
|
|
8424
|
-
}
|
|
8425
|
-
},
|
|
8426
|
-
additionalProperties: !1
|
|
8427
|
-
},
|
|
8428
|
-
step: {
|
|
8429
|
-
type: "string",
|
|
8430
|
-
const: "applyWordPressPatches"
|
|
8431
|
-
},
|
|
8432
|
-
siteUrl: {
|
|
8433
|
-
type: "string"
|
|
8434
|
-
},
|
|
8435
|
-
wordpressPath: {
|
|
8436
|
-
type: "string"
|
|
8437
|
-
},
|
|
8438
|
-
addPhpInfo: {
|
|
8439
|
-
type: "boolean"
|
|
8440
|
-
},
|
|
8441
|
-
patchSecrets: {
|
|
8442
|
-
type: "boolean"
|
|
8443
|
-
},
|
|
8444
|
-
disableSiteHealth: {
|
|
8445
|
-
type: "boolean"
|
|
8446
|
-
},
|
|
8447
|
-
disableWpNewBlogNotification: {
|
|
8448
|
-
type: "boolean"
|
|
8449
|
-
},
|
|
8450
|
-
prepareForRunningInsideWebBrowser: {
|
|
8451
|
-
type: "boolean"
|
|
8452
|
-
},
|
|
8453
|
-
addFetchNetworkTransport: {
|
|
8454
|
-
type: "boolean"
|
|
8455
|
-
}
|
|
8456
|
-
},
|
|
8457
|
-
required: [
|
|
8458
|
-
"step"
|
|
8459
|
-
]
|
|
8460
|
-
},
|
|
8461
7957
|
{
|
|
8462
7958
|
type: "object",
|
|
8463
7959
|
additionalProperties: !1,
|
|
@@ -9489,7 +8985,7 @@ function compileBlueprint(e, {
|
|
|
9489
8985
|
onStepCompleted: n = () => {
|
|
9490
8986
|
}
|
|
9491
8987
|
} = {}) {
|
|
9492
|
-
var
|
|
8988
|
+
var u, d, $;
|
|
9493
8989
|
if (e = {
|
|
9494
8990
|
...e,
|
|
9495
8991
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9500,17 +8996,17 @@ function compileBlueprint(e, {
|
|
|
9500
8996
|
step: "setSiteOptions",
|
|
9501
8997
|
options: e.siteOptions
|
|
9502
8998
|
}), e.plugins) {
|
|
9503
|
-
const
|
|
8999
|
+
const E = e.plugins.map((R) => typeof R == "string" ? R.startsWith("https://") ? {
|
|
9504
9000
|
resource: "url",
|
|
9505
|
-
url:
|
|
9001
|
+
url: R
|
|
9506
9002
|
} : {
|
|
9507
9003
|
resource: "wordpress.org/plugins",
|
|
9508
|
-
slug:
|
|
9509
|
-
} :
|
|
9004
|
+
slug: R
|
|
9005
|
+
} : R).map((R) => ({
|
|
9510
9006
|
step: "installPlugin",
|
|
9511
|
-
pluginZipFile:
|
|
9007
|
+
pluginZipFile: R
|
|
9512
9008
|
}));
|
|
9513
|
-
e.steps.unshift(...
|
|
9009
|
+
e.steps.unshift(...E);
|
|
9514
9010
|
}
|
|
9515
9011
|
e.login && e.steps.push({
|
|
9516
9012
|
step: "login",
|
|
@@ -9518,19 +9014,19 @@ function compileBlueprint(e, {
|
|
|
9518
9014
|
});
|
|
9519
9015
|
const { valid: s, errors: i } = validateBlueprint(e);
|
|
9520
9016
|
if (!s) {
|
|
9521
|
-
const
|
|
9017
|
+
const E = new Error(
|
|
9522
9018
|
`Invalid blueprint: ${i[0].message} at ${i[0].instancePath}`
|
|
9523
9019
|
);
|
|
9524
|
-
throw
|
|
9020
|
+
throw E.errors = i, E;
|
|
9525
9021
|
}
|
|
9526
9022
|
const a = e.steps || [], l = a.reduce(
|
|
9527
|
-
(
|
|
9023
|
+
(E, R) => {
|
|
9528
9024
|
var v;
|
|
9529
|
-
return
|
|
9025
|
+
return E + (((v = R.progress) == null ? void 0 : v.weight) || 1);
|
|
9530
9026
|
},
|
|
9531
9027
|
0
|
|
9532
9028
|
), p = a.map(
|
|
9533
|
-
(
|
|
9029
|
+
(E) => compileStep(E, {
|
|
9534
9030
|
semaphore: r,
|
|
9535
9031
|
rootProgressTracker: t,
|
|
9536
9032
|
totalProgressWeight: l
|
|
@@ -9539,11 +9035,11 @@ function compileBlueprint(e, {
|
|
|
9539
9035
|
return {
|
|
9540
9036
|
versions: {
|
|
9541
9037
|
php: compileVersion(
|
|
9542
|
-
(
|
|
9038
|
+
(u = e.preferredVersions) == null ? void 0 : u.php,
|
|
9543
9039
|
SupportedPHPVersions,
|
|
9544
9040
|
LatestSupportedPHPVersion
|
|
9545
9041
|
),
|
|
9546
|
-
wp: ((
|
|
9042
|
+
wp: ((d = e.preferredVersions) == null ? void 0 : d.wp) || "latest"
|
|
9547
9043
|
},
|
|
9548
9044
|
phpExtensions: compilePHPExtensions(
|
|
9549
9045
|
[],
|
|
@@ -9551,30 +9047,30 @@ function compileBlueprint(e, {
|
|
|
9551
9047
|
),
|
|
9552
9048
|
features: {
|
|
9553
9049
|
// Disable networking by default
|
|
9554
|
-
networking: ((
|
|
9050
|
+
networking: (($ = e.features) == null ? void 0 : $.networking) ?? !1
|
|
9555
9051
|
},
|
|
9556
|
-
run: async (
|
|
9052
|
+
run: async (E) => {
|
|
9557
9053
|
try {
|
|
9558
|
-
for (const { resources:
|
|
9559
|
-
for (const v of
|
|
9560
|
-
v.setPlayground(
|
|
9561
|
-
for (const [
|
|
9054
|
+
for (const { resources: R } of p)
|
|
9055
|
+
for (const v of R)
|
|
9056
|
+
v.setPlayground(E), v.isAsync && v.resolve();
|
|
9057
|
+
for (const [R, { run: v, step: T }] of Object.entries(p))
|
|
9562
9058
|
try {
|
|
9563
|
-
const
|
|
9564
|
-
n(
|
|
9565
|
-
} catch (
|
|
9059
|
+
const g = await v(E);
|
|
9060
|
+
n(g, T);
|
|
9061
|
+
} catch (g) {
|
|
9566
9062
|
throw new Error(
|
|
9567
|
-
`Error when executing the blueprint step #${
|
|
9568
|
-
|
|
9063
|
+
`Error when executing the blueprint step #${R} (${JSON.stringify(
|
|
9064
|
+
T
|
|
9569
9065
|
)}). Inspect the cause of this error for more details`,
|
|
9570
9066
|
{
|
|
9571
|
-
cause:
|
|
9067
|
+
cause: g
|
|
9572
9068
|
}
|
|
9573
9069
|
);
|
|
9574
9070
|
}
|
|
9575
9071
|
} finally {
|
|
9576
9072
|
try {
|
|
9577
|
-
await
|
|
9073
|
+
await E.goTo(
|
|
9578
9074
|
e.landingPage || "/"
|
|
9579
9075
|
);
|
|
9580
9076
|
} catch {
|
|
@@ -9622,35 +9118,35 @@ function compileStep(e, {
|
|
|
9622
9118
|
rootProgressTracker: r,
|
|
9623
9119
|
totalProgressWeight: n
|
|
9624
9120
|
}) {
|
|
9625
|
-
var
|
|
9121
|
+
var d;
|
|
9626
9122
|
const s = r.stage(
|
|
9627
|
-
(((
|
|
9123
|
+
(((d = e.progress) == null ? void 0 : d.weight) || 1) / n
|
|
9628
9124
|
), i = {};
|
|
9629
|
-
for (const
|
|
9630
|
-
let
|
|
9631
|
-
isFileReference(
|
|
9125
|
+
for (const $ of Object.keys(e)) {
|
|
9126
|
+
let E = e[$];
|
|
9127
|
+
isFileReference(E) && (E = Resource.create(E, {
|
|
9632
9128
|
semaphore: t
|
|
9633
|
-
})), i[
|
|
9129
|
+
})), i[$] = E;
|
|
9634
9130
|
}
|
|
9635
|
-
const a = async (
|
|
9636
|
-
var
|
|
9131
|
+
const a = async ($) => {
|
|
9132
|
+
var E;
|
|
9637
9133
|
try {
|
|
9638
9134
|
return s.fillSlowly(), await stepHandlers[e.step](
|
|
9639
|
-
|
|
9135
|
+
$,
|
|
9640
9136
|
await resolveArguments(i),
|
|
9641
9137
|
{
|
|
9642
9138
|
tracker: s,
|
|
9643
|
-
initialCaption: (
|
|
9139
|
+
initialCaption: (E = e.progress) == null ? void 0 : E.caption
|
|
9644
9140
|
}
|
|
9645
9141
|
);
|
|
9646
9142
|
} finally {
|
|
9647
9143
|
s.finish();
|
|
9648
9144
|
}
|
|
9649
9145
|
}, l = getResources(i), p = getResources(i).filter(
|
|
9650
|
-
(
|
|
9651
|
-
),
|
|
9652
|
-
for (const
|
|
9653
|
-
|
|
9146
|
+
($) => $.isAsync
|
|
9147
|
+
), u = 1 / (p.length + 1);
|
|
9148
|
+
for (const $ of p)
|
|
9149
|
+
$.progress = s.stage(u);
|
|
9654
9150
|
return { run: a, step: e, resources: l };
|
|
9655
9151
|
}
|
|
9656
9152
|
function getResources(e) {
|
|
@@ -9677,7 +9173,6 @@ function setPluginProxyURL() {
|
|
|
9677
9173
|
export {
|
|
9678
9174
|
activatePlugin,
|
|
9679
9175
|
activateTheme,
|
|
9680
|
-
applyWordPressPatches,
|
|
9681
9176
|
compileBlueprint,
|
|
9682
9177
|
cp,
|
|
9683
9178
|
defineSiteUrl,
|