@wp-playground/client 0.5.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +148 -79
- package/index.d.ts +114 -56
- package/index.js +3860 -3484
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Nt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var L=(e,t,r)=>(Nt(e,t,"read from private field"),r?r.call(e):t.get(e)),Z=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},te=(e,t,r,n)=>(Nt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var ce=(e,t,r)=>(Nt(e,t,"access private method"),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});if(typeof File>"u"){class e extends Blob{constructor(r,n,s){super(r);let o;s!=null&&s.lastModified&&(o=new Date),(!o||isNaN(o.getFullYear()))&&(o=new Date),this.lastModifiedDate=o,this.lastModified=o.getMilliseconds(),this.name=n||""}}global.File=e}function asPromise(e){return new Promise(function(t,r){e.onload=e.onerror=function(n){e.onload=e.onerror=null,n.type==="load"?t(e.result):r(new Error("Failed to read the blob/file"))}})}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const t=new FileReader;return t.readAsArrayBuffer(this),asPromise(t)});typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const t=new FileReader;return t.readAsText(this),asPromise(t)});function isByobSupported(){const e=new Uint8Array([1,2,3,4]),r=new File([e],"test").stream();try{return r.getReader({mode:"byob"}),!0}catch{return!1}}(typeof Blob.prototype.stream>"u"||!isByobSupported())&&(Blob.prototype.stream=function(){let e=0;const t=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(r){const n=r.byobRequest.view,o=await t.slice(e,e+n.byteLength).arrayBuffer(),i=new Uint8Array(o);new Uint8Array(n.buffer).set(i);const l=i.byteLength;r.byobRequest.respond(l),e+=l,e>=t.size&&r.close()}})});if(typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const wpContentFilesExcludedFromExport=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/export-wxz.php","mu-plugins/0-playground.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"];class Semaphore{constructor({concurrency:t}){this._running=0,this.concurrency=t,this.queue=[]}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency)await new Promise(t=>this.queue.push(t));else{this._running++;let t=!1;return()=>{t||(t=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}}async run(t){const r=await this.acquire();try{return await t()}finally{r()}}}function joinPaths(...e){let t=e.join("/");const r=t[0]==="/",n=t.substring(t.length-1)==="/";return t=normalizePath(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function dirname(e){if(e==="/")return"/";e=normalizePath(e);const t=e.lastIndexOf("/");return t===-1?"":t===0?"/":e.substr(0,t)}function normalizePath(e){const t=e[0]==="/";return e=normalizePathsArray(e.split("/").filter(r=>!!r),!t).join("/"),(t?"/":"")+e.replace(/\/$/,"")}function normalizePathsArray(e,t){let r=0;for(let n=e.length-1;n>=0;n--){const s=e[n];s==="."?e.splice(n,1):s===".."?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e}function createSpawnHandler(e){return function(t){const r=new ChildProcess,n=new ProcessApi(r);return setTimeout(async()=>{await e(t,n),r.emit("spawn",!0)}),r}}class EventEmitter{constructor(){this.listeners={}}emit(t,r){this.listeners[t]&&this.listeners[t].forEach(function(n){n(r)})}on(t,r){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(r)}}class ProcessApi extends EventEmitter{constructor(t){super(),this.childProcess=t,this.exited=!1,this.stdinData=[],t.on("stdin",r=>{this.stdinData?this.stdinData.push(r.slice()):this.emit("stdin",r)})}stdout(t){typeof t=="string"&&(t=new TextEncoder().encode(t)),this.childProcess.stdout.emit("data",t)}stderr(t){typeof t=="string"&&(t=new TextEncoder().encode(t)),this.childProcess.stderr.emit("data",t)}exit(t){this.exited||(this.exited=!0,this.childProcess.emit("exit",t))}flushStdin(){if(this.stdinData)for(let t=0;t<this.stdinData.length;t++)this.emit("stdin",this.stdinData[t]);this.stdinData=null}}let lastPid=9743;class ChildProcess extends EventEmitter{constructor(t=lastPid++){super(),this.pid=t,this.stdout=new EventEmitter,this.stderr=new EventEmitter;const r=this;this.stdin={write:n=>{r.emit("stdin",n)}}}}function phpVar(e){return`json_decode(base64_decode('${stringToBase64(JSON.stringify(e))}'), true)`}function phpVars(e){const t={};for(const r in e)t[r]=phpVar(e[r]);return t}function stringToBase64(e){return bytesToBase64(new TextEncoder().encode(e))}function bytesToBase64(e){const t=String.fromCodePoint(...e);return btoa(t)}const activatePlugin=async(e,{pluginPath:t,pluginName:r},n)=>{n==null||n.tracker.setCaption(`Activating ${r||t}`);const s=await e.documentRoot;await e.run({throwOnError:!0,code:`<?php
|
|
2
2
|
define( 'WP_ADMIN', true );
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
require_once( ${phpVar(s)}. "/wp-load.php" );
|
|
4
|
+
require_once( ${phpVar(s)}. "/wp-admin/includes/plugin.php" );
|
|
5
|
+
|
|
6
|
+
// Set current user to admin
|
|
7
|
+
set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
8
|
+
|
|
9
|
+
$plugin_path = ${phpVar(t)};
|
|
10
|
+
|
|
6
11
|
if (!is_dir($plugin_path)) {
|
|
7
12
|
activate_plugin($plugin_path);
|
|
8
|
-
|
|
13
|
+
die();
|
|
9
14
|
}
|
|
10
|
-
|
|
15
|
+
|
|
11
16
|
foreach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {
|
|
12
17
|
$info = get_plugin_data( $file, false, false );
|
|
13
18
|
if ( ! empty( $info['Name'] ) ) {
|
|
14
19
|
activate_plugin( $file );
|
|
15
|
-
|
|
20
|
+
die();
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
// If we got here, the plugin was not found.
|
|
25
|
+
exit(1);
|
|
26
|
+
`})},activateTheme=async(e,{themeFolderName:t},r)=>{r==null||r.tracker.setCaption(`Activating ${t}`);const n=await e.documentRoot;await e.run({throwOnError:!0,code:`<?php
|
|
20
27
|
define( 'WP_ADMIN', true );
|
|
21
|
-
require_once(
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
require_once( ${phpVar(n)}. "/wp-load.php" );
|
|
29
|
+
|
|
30
|
+
// Set current user to admin
|
|
31
|
+
set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
32
|
+
|
|
33
|
+
switch_theme( ${phpVar(t)} );
|
|
34
|
+
`})},rewriteWpConfigToDefineConstants=`<?php
|
|
24
35
|
|
|
25
36
|
/**
|
|
26
37
|
* Rewrites the wp-config.php file to ensure specific constants are defined
|
|
@@ -293,7 +304,7 @@ function rewrite_wp_config_to_define_constants($content, $constants = [])
|
|
|
293
304
|
[','],
|
|
294
305
|
[var_export($constants[$name], true)],
|
|
295
306
|
$third_arg_buffer,
|
|
296
|
-
[");"]
|
|
307
|
+
[");"]
|
|
297
308
|
);
|
|
298
309
|
|
|
299
310
|
// Remove the constant from the list so we can process any remaining
|
|
@@ -314,14 +325,14 @@ function rewrite_wp_config_to_define_constants($content, $constants = [])
|
|
|
314
325
|
var_export($name, true),
|
|
315
326
|
',',
|
|
316
327
|
var_export($value, true),
|
|
317
|
-
");\\n"
|
|
318
|
-
]
|
|
328
|
+
");\\n"
|
|
329
|
+
]
|
|
319
330
|
);
|
|
320
331
|
}
|
|
321
332
|
$prepend[] = "?>";
|
|
322
333
|
$output = array_merge(
|
|
323
334
|
$prepend,
|
|
324
|
-
$output
|
|
335
|
+
$output
|
|
325
336
|
);
|
|
326
337
|
}
|
|
327
338
|
|
|
@@ -351,12 +362,12 @@ function skip_whitespace($tokens) {
|
|
|
351
362
|
}
|
|
352
363
|
return $output;
|
|
353
364
|
}
|
|
354
|
-
`,
|
|
365
|
+
`,defineWpConfigConsts=async(e,{consts:t,method:r="rewrite-wp-config"})=>{switch(r){case"define-before-run":await defineBeforeRun(e,t);break;case"rewrite-wp-config":{const n=await e.documentRoot,s=joinPaths(n,"/wp-config.php"),o=await e.readFileAsText(s),i=await rewriteDefineCalls(e,o,t);await e.writeFile(s,i);break}default:throw new Error(`Invalid method: ${r}`)}};async function defineBeforeRun(e,t){for(const r in t)await e.defineConstant(r,t[r])}async function rewriteDefineCalls(e,t,r){await e.writeFile("/tmp/code.php",t);const n=phpVars({consts:r});return await e.run({throwOnError:!0,code:`${rewriteWpConfigToDefineConstants}
|
|
355
366
|
$wp_config_path = '/tmp/code.php';
|
|
356
367
|
$wp_config = file_get_contents($wp_config_path);
|
|
357
368
|
$new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${n.consts});
|
|
358
369
|
file_put_contents($wp_config_path, $new_wp_config);
|
|
359
|
-
`}),await e.readFileAsText("/tmp/code.php")}const
|
|
370
|
+
`}),await e.readFileAsText("/tmp/code.php")}const transportFetch=`<?php
|
|
360
371
|
|
|
361
372
|
/**
|
|
362
373
|
* This transport delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
@@ -501,7 +512,7 @@ if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
|
501
512
|
|
|
502
513
|
}
|
|
503
514
|
}
|
|
504
|
-
`,
|
|
515
|
+
`,transportDummy=`<?php
|
|
505
516
|
|
|
506
517
|
/**
|
|
507
518
|
* This transport does not perform any HTTP requests and only exists
|
|
@@ -556,7 +567,7 @@ if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
|
556
567
|
|
|
557
568
|
}
|
|
558
569
|
}
|
|
559
|
-
`,
|
|
570
|
+
`,playgroundMuPlugin=`<?php
|
|
560
571
|
/**
|
|
561
572
|
* Add a notice to wp-login.php offering the username and password.
|
|
562
573
|
*/
|
|
@@ -578,35 +589,57 @@ EOT;
|
|
|
578
589
|
* makes it more clear that the feature is not yet supported.
|
|
579
590
|
*
|
|
580
591
|
* https://github.com/WordPress/wordpress-playground/issues/498
|
|
592
|
+
*
|
|
593
|
+
* Added styling to hide the Popular tags section of the Plugins page
|
|
594
|
+
* and the nonfunctional Try Again button (both Plugins and Themes) that's
|
|
595
|
+
* appended when the message is displayed.
|
|
596
|
+
*
|
|
597
|
+
* https://github.com/WordPress/wordpress-playground/issues/927
|
|
598
|
+
*
|
|
581
599
|
*/
|
|
600
|
+
|
|
601
|
+
add_action('admin_head', function () {
|
|
602
|
+
echo '<style>
|
|
603
|
+
:is(.plugins-popular-tags-wrapper:has(div.networking_err_msg),
|
|
604
|
+
button.button.try-again) {
|
|
605
|
+
display: none;
|
|
606
|
+
}
|
|
607
|
+
</style>';
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
add_action('init', 'networking_disabled');
|
|
611
|
+
function networking_disabled() {
|
|
612
|
+
$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.
|
|
613
|
+
<p>There are two alternative methods to enable global networking support:</p>
|
|
614
|
+
<ol>
|
|
615
|
+
<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>
|
|
616
|
+
<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.
|
|
617
|
+
</li></ol>
|
|
618
|
+
<p>
|
|
619
|
+
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>
|
|
620
|
+
<strong>Please note:</strong> This option is hidden when browsing Playground as an embedded iframe.</p></div>';
|
|
621
|
+
return $networking_err_msg;
|
|
622
|
+
}
|
|
623
|
+
|
|
582
624
|
add_filter('plugins_api_result', function ($res) {
|
|
583
625
|
if ($res instanceof WP_Error) {
|
|
584
626
|
$res = new WP_Error(
|
|
585
627
|
'plugins_api_failed',
|
|
586
|
-
|
|
587
|
-
|
|
628
|
+
networking_disabled()
|
|
629
|
+
);
|
|
588
630
|
}
|
|
589
631
|
return $res;
|
|
590
632
|
});
|
|
591
633
|
|
|
592
634
|
add_filter('gettext', function ($translation) {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
// Only change the message on /wp-admin/theme-install.php
|
|
598
|
-
if ('theme-install.php' !== $pagenow) {
|
|
599
|
-
return $translation;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
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>.') {
|
|
603
|
-
return 'Enable networking support in Playground settings to access the Themes directory. Network access is an <a href="https://github.com/WordPress/wordpress-playground/issues/85" target="_blank">experimental, opt-in feature</a>. If you don\\'t want to use it, you can still upload themes or install them using the <a href="https://wordpress.github.io/wordpress-playground/query-api">Query API</a> (e.g. ?theme=pendant).';
|
|
635
|
+
if( $GLOBALS['pagenow'] === 'theme-install.php') {
|
|
636
|
+
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>.') {
|
|
637
|
+
return networking_disabled();
|
|
638
|
+
}
|
|
604
639
|
}
|
|
605
640
|
return $translation;
|
|
606
641
|
});
|
|
607
642
|
|
|
608
|
-
|
|
609
|
-
|
|
610
643
|
/**
|
|
611
644
|
* Links with target="top" don't work in the playground iframe because of
|
|
612
645
|
* the sandbox attribute. What they really should be targeting is the
|
|
@@ -678,10 +711,10 @@ if (defined('USE_FETCH_FOR_REQUESTS') && USE_FETCH_FOR_REQUESTS) {
|
|
|
678
711
|
require(__DIR__ . '/playground-includes/requests_transport_dummy.php');
|
|
679
712
|
$__requests_class::add_transport('Requests_Transport_Dummy');
|
|
680
713
|
}
|
|
681
|
-
`;async function
|
|
682
|
-
require_once ${
|
|
714
|
+
`;async function updateFile(e,t,r){let n="";await e.fileExists(t)&&(n=await e.readFileAsText(t)),await e.writeFile(t,r(n))}const applyWordPressPatches=async(e,t)=>{const r=new WordPressPatcher(e,t.wordpressPath||"/wordpress",t.siteUrl);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()};class WordPressPatcher{constructor(t,r,n){this.php=t,this.scopedSiteUrl=n,this.wordpressPath=r}async addPhpInfo(){await this.php.writeFile(joinPaths(this.wordpressPath,"phpinfo.php"),"<?php phpinfo(); ")}async patchSiteUrl(){await defineWpConfigConsts(this.php,{consts:{WP_HOME:this.scopedSiteUrl,WP_SITEURL:this.scopedSiteUrl}})}async patchSecrets(){await defineWpConfigConsts(this.php,{consts:{AUTH_KEY:randomString(40),SECURE_AUTH_KEY:randomString(40),LOGGED_IN_KEY:randomString(40),NONCE_KEY:randomString(40),AUTH_SALT:randomString(40),SECURE_AUTH_SALT:randomString(40),LOGGED_IN_SALT:randomString(40),NONCE_SALT:randomString(40)}})}async disableSiteHealth(){await updateFile(this.php,joinPaths(this.wordpressPath,"wp-includes/default-filters.php"),t=>t.replace(/add_filter[^;]+wp_maybe_grant_site_health_caps[^;]+;/i,""))}async disableWpNewBlogNotification(){await updateFile(this.php,joinPaths(this.wordpressPath,"wp-config.php"),t=>`${t} function wp_new_blog_notification(...$args){} `)}async prepareForRunningInsideWebBrowser(){await this.php.mkdir(joinPaths(this.wordpressPath,"wp-content/mu-plugins")),await this.php.writeFile(joinPaths(this.wordpressPath,"/wp-content/mu-plugins/0-playground.php"),playgroundMuPlugin),await this.php.mkdir(joinPaths(this.wordpressPath,"/wp-content/mu-plugins/playground-includes")),await this.php.writeFile(joinPaths(this.wordpressPath,"/wp-content/mu-plugins/playground-includes/requests_transport_dummy.php"),transportDummy)}async addFetchNetworkTransport(){await defineWpConfigConsts(this.php,{consts:{USE_FETCH_FOR_REQUESTS:!0}});const t=[joinPaths(this.wordpressPath,"/wp-includes/Requests/Transport/fsockopen.php"),joinPaths(this.wordpressPath,"/wp-includes/Requests/Transport/cURL.php"),joinPaths(this.wordpressPath,"/wp-includes/Requests/src/Transport/Fsockopen.php"),joinPaths(this.wordpressPath,"/wp-includes/Requests/src/Transport/Curl.php")];for(const r of t)await this.php.fileExists(r)&&await updateFile(this.php,r,n=>n.includes("public static function test2")?n:n.replace("public static function test","public static function test( $capabilities = array() ) { return false; } public static function test2"));await this.php.writeFile(joinPaths(this.wordpressPath,"wp-content/mu-plugins/playground-includes/wp_http_fetch.php"),transportFetch),await this.php.mkdir(`${this.wordpressPath}/wp-content/fonts`)}}function randomString(e){const t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=-[]/.,<>?";let r="";for(let n=e;n>0;--n)r+=t[Math.floor(Math.random()*t.length)];return r}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})=>{await e.unlink(t)},runSql=async(e,{sql:t},r)=>{r==null||r.tracker.setCaption("Executing SQL Queries");const n=`/tmp/${crypto.randomUUID()}.sql`;await e.writeFile(n,new Uint8Array(await t.arrayBuffer()));const s=await e.documentRoot,o=phpVars({docroot:s,sqlFilename:n}),i=await e.run({code:`<?php
|
|
715
|
+
require_once ${o.docroot} . '/wp-load.php';
|
|
683
716
|
|
|
684
|
-
$handle = fopen(${
|
|
717
|
+
$handle = fopen(${o.sqlFilename}, 'r');
|
|
685
718
|
$buffer = '';
|
|
686
719
|
|
|
687
720
|
global $wpdb;
|
|
@@ -697,7 +730,57 @@ if (defined('USE_FETCH_FOR_REQUESTS') && USE_FETCH_FOR_REQUESTS) {
|
|
|
697
730
|
$wpdb->query($buffer);
|
|
698
731
|
$buffer = '';
|
|
699
732
|
}
|
|
700
|
-
`});return await
|
|
733
|
+
`});return await rm(e,{path:n}),i},setPhpIniEntry=async(e,{key:t,value:r})=>{await e.setPhpIniEntry(t,r)},request=async(e,{request:t})=>{const r=await e.request(t);if(r.httpStatusCode>399||r.httpStatusCode<200)throw console.warn("WordPress response was",{response:r}),new Error(`Request failed with status ${r.httpStatusCode}`);return r},login=async(e,{username:t="admin",password:r="password"}={},n)=>{var o,i,l;n==null||n.tracker.setCaption((n==null?void 0:n.initialCaption)||"Logging in"),await e.request({url:"/wp-login.php"});const s=await e.request({url:"/wp-login.php",method:"POST",formData:{log:t,pwd:r,rememberme:"forever"}});if(!((l=(i=(o=s.headers)==null?void 0:o.location)==null?void 0:i[0])!=null&&l.includes("/wp-admin/")))throw console.warn("WordPress response was",{response:s,text:s.text}),new Error(`Failed to log in as ${t} with password ${r}`)},setSiteOptions=async(e,{options:t})=>{const r=await e.documentRoot;await e.run({throwOnError:!0,code:`<?php
|
|
734
|
+
include ${phpVar(r)} . '/wp-load.php';
|
|
735
|
+
$site_options = ${phpVar(t)};
|
|
736
|
+
foreach($site_options as $name => $value) {
|
|
737
|
+
update_option($name, $value);
|
|
738
|
+
}
|
|
739
|
+
echo "Success";
|
|
740
|
+
`})},updateUserMeta=async(e,{meta:t,userId:r})=>{const n=await e.documentRoot;await e.run({throwOnError:!0,code:`<?php
|
|
741
|
+
include ${phpVar(n)} . '/wp-load.php';
|
|
742
|
+
$meta = ${phpVar(t)};
|
|
743
|
+
foreach($meta as $name => $value) {
|
|
744
|
+
update_user_meta(${phpVar(r)}, $name, $value);
|
|
745
|
+
}
|
|
746
|
+
`})};function isURLScoped(e){return e.pathname.startsWith("/scope:")}function getURLScope(e){return isURLScoped(e)?e.pathname.split("/")[1].split(":")[1]:null}const enableMultisite=async e=>{var w;await defineWpConfigConsts(e,{consts:{WP_ALLOW_MULTISITE:1}});const t=new URL(await e.absoluteUrl);if(t.port!==""){let R=`The current host is ${t.host}, but WordPress multisites do not support custom ports.`;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)}const r=t.pathname.replace(/\/$/,"")+"/",n=`${t.protocol}//${t.hostname}${r}`;await setSiteOptions(e,{options:{siteurl:n,home:n}}),await login(e,{});const s=await e.documentRoot,i=(await e.run({throwOnError:!0,code:`<?php
|
|
747
|
+
define( 'WP_ADMIN', true );
|
|
748
|
+
require_once(${phpVar(s)} . "/wp-load.php");
|
|
749
|
+
|
|
750
|
+
// Set current user to admin
|
|
751
|
+
set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
752
|
+
|
|
753
|
+
require_once(${phpVar(s)} . "/wp-admin/includes/plugin.php");
|
|
754
|
+
$plugins_root = ${phpVar(s)} . "/wp-content/plugins";
|
|
755
|
+
$plugins = glob($plugins_root . "/*");
|
|
756
|
+
|
|
757
|
+
$deactivated_plugins = [];
|
|
758
|
+
foreach($plugins as $plugin_path) {
|
|
759
|
+
if (!is_dir($plugin_path)) {
|
|
760
|
+
deactivate_plugins($plugin_path);
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
// Find plugin entry file
|
|
764
|
+
foreach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {
|
|
765
|
+
$info = get_plugin_data( $file, false, false );
|
|
766
|
+
if ( ! empty( $info['Name'] ) ) {
|
|
767
|
+
deactivate_plugins( $file );
|
|
768
|
+
$deactivated_plugins[] = substr($file, strlen($plugins_root) + 1);
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
echo json_encode($deactivated_plugins);
|
|
774
|
+
`})).json,p=(w=(await request(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))==null?void 0:w[1],d=await request(e,{request:{url:"/wp-admin/network.php",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:jsonToUrlEncoded({_wpnonce:p,_wp_http_referer:r+"wp-admin/network.php",sitename:"My WordPress Website Sites",email:"admin@localhost.com",submit:"Install"})}});if(d.httpStatusCode!==200)throw console.warn("WordPress response was",{response:d,text:d.text,headers:d.headers}),new Error(`Failed to enable multisite. Response code was ${d.httpStatusCode}`);await defineWpConfigConsts(e,{consts:{SUNRISE:"on",MULTISITE:!0,SUBDOMAIN_INSTALL:!1,SITE_ID_CURRENT_SITE:1,BLOG_ID_CURRENT_SITE:1,DOMAIN_CURRENT_SITE:t.hostname,PATH_CURRENT_SITE:r}});const u=new URL(await e.absoluteUrl),m=isURLScoped(u)?"scope:"+getURLScope(u):null;await e.writeFile(joinPaths(s,"/wp-content/sunrise.php"),`<?php
|
|
775
|
+
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
776
|
+
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
777
|
+
}
|
|
778
|
+
$folder = ${phpVar(m)};
|
|
779
|
+
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
780
|
+
$_SERVER['HTTP_HOST'] = ${phpVar(u.hostname)};
|
|
781
|
+
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
782
|
+
}
|
|
783
|
+
`),await login(e,{});for(const R of i)await activatePlugin(e,{pluginPath:R})};function jsonToUrlEncoded(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}const cp=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},mv=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},mkdir=async(e,{path:t})=>{await e.mkdir(t)},rmdir=async(e,{path:t})=>{await e.rmdir(t)},writeFile=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),await e.writeFile(t,r)},defineSiteUrl=async(e,{siteUrl:t})=>{await defineWpConfigConsts(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},importFile=async(e,{file:t})=>{var l;const r=await e.request({url:"/wp-admin/admin.php?import=wordpress"}),n=(l=DOM(r).getElementById("import-upload-form"))==null?void 0:l.getAttribute("action"),s=await e.request({url:`/wp-admin/${n}`,method:"POST",files:{import:t}}),o=DOM(s).querySelector("#wpbody-content form");if(!o)throw console.log(s.text),new Error("Could not find an importer form in response. See the response text above for details.");const i=getFormData(o);i.fetch_attachments="1";for(const p in i)if(p.startsWith("user_map[")){const d="user_new["+p.slice(9,-1)+"]";i[d]="1"}await e.request({url:o.action,method:"POST",formData:i})};function DOM(e){return new DOMParser().parseFromString(e.text,"text/html")}function getFormData(e){return Object.fromEntries(new FormData(e).entries())}const zipFunctions=`<?php
|
|
701
784
|
|
|
702
785
|
function zipDir($root, $output, $options = array())
|
|
703
786
|
{
|
|
@@ -780,34 +863,20 @@ function delTree($dir)
|
|
|
780
863
|
}
|
|
781
864
|
return rmdir($dir);
|
|
782
865
|
}
|
|
783
|
-
`;async function
|
|
866
|
+
`;async function runPhpWithZipFunctions(e,t){return await e.run({throwOnError:!0,code:zipFunctions+t})}const tmpPath="/tmp/file.zip",unzip=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)await e.writeFile(tmpPath,await e.readFileAsBuffer(r)),console.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else if(t)await e.writeFile(tmpPath,new Uint8Array(await t.arrayBuffer()));else throw new Error("Either zipPath or zipFile must be provided");const s=phpVars({zipPath:tmpPath,extractToPath:n});await runPhpWithZipFunctions(e,`unzip(${s.zipPath}, ${s.extractToPath});`),e.fileExists(tmpPath)&&await e.unlink(tmpPath)},importWordPressFiles=async(e,{wordPressFilesZip:t,pathInZip:r=""})=>{const n=await e.documentRoot;let s=joinPaths("/tmp","import");await e.mkdir(s),await unzip(e,{zipFile:t,extractToPath:s}),s=joinPaths(s,r);const o=joinPaths(s,"wp-content"),i=joinPaths(n,"wp-content");for(const u of wpContentFilesExcludedFromExport){const m=joinPaths(o,u);await removePath(e,m);const w=joinPaths(i,u);await e.fileExists(w)&&(await e.mkdir(dirname(m)),await e.mv(w,m))}const l=joinPaths(s,"wp-content","database");await e.fileExists(l)||await e.mv(joinPaths(n,"wp-content","database"),l);const p=await e.listFiles(s);for(const u of p)await removePath(e,joinPaths(n,u)),await e.mv(joinPaths(s,u),joinPaths(n,u));await e.rmdir(s);const d=phpVar(joinPaths(n,"wp-admin","upgrade.php"));await e.run({throwOnError:!0,code:`<?php
|
|
784
867
|
$_GET['step'] = 'upgrade_db';
|
|
785
|
-
require ${
|
|
786
|
-
`})};async function
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
}
|
|
792
|
-
echo "Success";
|
|
793
|
-
`,n=await e.run({code:r});return to(n),{code:r,result:n}},eo=async(e,{meta:t,userId:r})=>{const n=`<?php
|
|
794
|
-
include 'wordpress/wp-load.php';
|
|
795
|
-
$meta = ${Kt(t)};
|
|
796
|
-
foreach($meta as $name => $value) {
|
|
797
|
-
update_user_meta(${Kt(r)}, $name, $value);
|
|
798
|
-
}
|
|
799
|
-
echo "Success";
|
|
800
|
-
`,s=await e.run({code:n});return to(s),{code:n,result:s}};async function to(e){if(e.text!=="Success")throw console.log(e),new Error(`Failed to run code: ${e.text} ${e.errors}`)}const ro=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,s=ye(n,"wp-content");let i=zn;t&&(i=i.filter(d=>!d.startsWith("themes/twenty")).filter(d=>d!=="plugins/sqlite-database-integration"));const o=vr({zipPath:r,wpContentPath:s,documentRoot:n,exceptPaths:i.map(d=>ye(n,"wp-content",d)),additionalPaths:t?{[ye(n,"wp-config.php")]:"wp-config.php"}:{}});await Wi(e,`zipDir(${o.wpContentPath}, ${o.zipPath}, array(
|
|
801
|
-
'exclude_paths' => ${o.exceptPaths},
|
|
802
|
-
'zip_root' => ${o.documentRoot},
|
|
803
|
-
'additional_paths' => ${o.additionalPaths}
|
|
804
|
-
));`);const l=await e.readFileAsBuffer(r);return e.unlink(r),l},La=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin:Vn,activateTheme:Wn,applyWordPressPatches:ji,cp:Mi,defineSiteUrl:zi,defineWpConfigConsts:Lt,exportWXR:Bi,exportWXZ:Gi,importFile:Vi,importWordPressFiles:xi,installPlugin:Ji,installTheme:Yi,login:Qi,mkdir:Li,mv:Ui,request:qi,rm:Bn,rmdir:Hi,runPHP:Ii,runPHPWithOptions:Ai,runSql:Di,runWpInstallationWizard:Zi,setPhpIniEntry:Fi,setSiteOptions:Xi,unzip:mn,updateUserMeta:eo,writeFile:Gn,zipWpContent:ro},Symbol.toStringTag,{value:"Module"})),Ha=5*1024*1024;function za(e,t){const r=e.headers.get("content-length")||"",n=parseInt(r,10)||Ha;function s(i,o){t(new CustomEvent("progress",{detail:{loaded:i,total:o}}))}return new Response(new ReadableStream({async start(i){if(!e.body){i.close();return}const o=e.body.getReader();let l=0;for(;;)try{const{done:d,value:u}=await o.read();if(u&&(l+=u.byteLength),d){s(l,l),i.close();break}else s(l,n),i.enqueue(u)}catch(d){console.error({e:d}),i.error(d);break}}}),{status:e.status,statusText:e.statusText,headers:e.headers})}const Tn=1e-5;class gn extends EventTarget{constructor({weight:t=1,caption:r="",fillTime:n=4}={}){super(),this._selfWeight=1,this._selfDone=!1,this._selfProgress=0,this._selfCaption="",this._isFilling=!1,this._subTrackers=[],this._weight=t,this._selfCaption=r,this._fillTime=n}stage(t,r=""){if(t||(t=this._selfWeight),this._selfWeight-t<-Tn)throw new Error(`Cannot add a stage with weight ${t} as the total weight of registered stages would exceed 1.`);this._selfWeight-=t;const n=new gn({caption:r,weight:t,fillTime:this._fillTime});return this._subTrackers.push(n),n.addEventListener("progress",()=>this.notifyProgress()),n.addEventListener("done",()=>{this.done&&this.notifyDone()}),n}fillSlowly({stopBeforeFinishing:t=!0}={}){if(this._isFilling)return;this._isFilling=!0;const r=100,n=this._fillTime/r;this._fillInterval=setInterval(()=>{this.set(this._selfProgress+1),t&&this._selfProgress>=99&&clearInterval(this._fillInterval)},n)}set(t){this._selfProgress=Math.min(t,100),this.notifyProgress(),this._selfProgress+Tn>=100&&this.finish()}finish(){this._fillInterval&&clearInterval(this._fillInterval),this._selfDone=!0,this._selfProgress=100,this._isFilling=!1,this._fillInterval=void 0,this.notifyProgress(),this.notifyDone()}get caption(){for(let t=this._subTrackers.length-1;t>=0;t--)if(!this._subTrackers[t].done){const r=this._subTrackers[t].caption;if(r)return r}return this._selfCaption}setCaption(t){this._selfCaption=t,this.notifyProgress()}get done(){return this.progress+Tn>=100}get progress(){if(this._selfDone)return 100;const t=this._subTrackers.reduce((r,n)=>r+n.progress*n.weight,this._selfProgress*this._selfWeight);return Math.round(t*1e4)/1e4}get weight(){return this._weight}get observer(){return this._progressObserver||(this._progressObserver=t=>{this.set(t)}),this._progressObserver}get loadingListener(){return this._loadingListener||(this._loadingListener=t=>{this.set(t.detail.loaded/t.detail.total*100)}),this._loadingListener}pipe(t){t.setProgress({progress:this.progress,caption:this.caption}),this.addEventListener("progress",r=>{t.setProgress({progress:r.detail.progress,caption:r.detail.caption})}),this.addEventListener("done",()=>{t.setLoaded()})}addEventListener(t,r){super.addEventListener(t,r)}removeEventListener(t,r){super.removeEventListener(t,r)}notifyProgress(){const t=this;this.dispatchEvent(new CustomEvent("progress",{detail:{get progress(){return t.progress},get caption(){return t.caption}}}))}notifyDone(){this.dispatchEvent(new CustomEvent("done"))}}const Qs=Symbol("error"),Zs=Symbol("message");class Kn extends Event{constructor(t,r={}){super(t),this[Qs]=r.error===void 0?null:r.error,this[Zs]=r.message===void 0?"":r.message}get error(){return this[Qs]}get message(){return this[Zs]}}Object.defineProperty(Kn.prototype,"error",{enumerable:!0});Object.defineProperty(Kn.prototype,"message",{enumerable:!0});const Va=typeof globalThis.ErrorEvent=="function"?globalThis.ErrorEvent:Kn;function Wa(e){return e instanceof Error?"exitCode"in e&&(e==null?void 0:e.exitCode)===0||(e==null?void 0:e.name)==="ExitStatus"&&"status"in e&&e.status===0:!1}class xa extends EventTarget{constructor(){super(...arguments),this.listenersCount=0}addEventListener(t,r){++this.listenersCount,super.addEventListener(t,r)}removeEventListener(t,r){--this.listenersCount,super.removeEventListener(t,r)}hasListeners(){return this.listenersCount>0}}function Ba(e){e.asm={...e.asm};const t=new xa;for(const r in e.asm)if(typeof e.asm[r]=="function"){const n=e.asm[r];e.asm[r]=function(...s){var i;try{return n(...s)}catch(o){if(!(o instanceof Error))throw o;const l=Ka(o,(i=e.lastAsyncifyStackSource)==null?void 0:i.stack);if(e.lastAsyncifyStackSource&&(o.cause=e.lastAsyncifyStackSource),t.hasListeners()){t.dispatchEvent(new Va("error",{error:o,message:l}));return}throw Wa(o)||Qa(l),o}}}return t}let In=[];function Ga(){return In}function Ka(e,t){if(e.message==="unreachable"){let r=Ja;t||(r+=`
|
|
868
|
+
require ${d};
|
|
869
|
+
`})};async function removePath(e,t){await e.fileExists(t)&&(await e.isDir(t)?await e.rmdir(t):await e.unlink(t))}async function exportWXR(e){const t=await e.request({url:"/wp-admin/export.php?download=true&content=all"});return new File([t.bytes],"export.xml")}async function exportWXZ(e){const t=await e.request({url:"/wp-admin/export.php?download=true&content=all&export_wxz=1"});return new File([t.bytes],"export.wxz")}async function installAsset(e,{targetPath:t,zipFile:r}){const s=r.name.replace(/\.zip$/,""),o=joinPaths(await e.documentRoot,"wp-content"),i=joinPaths(o,crypto.randomUUID()),l=joinPaths(i,"assets",s);await e.fileExists(l)&&await e.rmdir(i,{recursive:!0}),await e.mkdir(i);try{await unzip(e,{zipFile:r,extractToPath:l});let p=await e.listFiles(l,{prependPath:!0});p=p.filter(R=>!R.endsWith("/__MACOSX"));const d=p.length===1&&await e.isDir(p[0]);let u,m="";d?(m=p[0],u=p[0].split("/").pop()):(m=l,u=s);const w=`${t}/${u}`;return await e.mv(m,w),{assetFolderPath:w,assetFolderName:u}}finally{await e.rmdir(i,{recursive:!0})}}function zipNameToHumanName(e){const t=e.split(".").shift().replace(/-/g," ");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const installPlugin=async(e,{pluginZipFile:t,options:r={}},n)=>{const s=t.name.split("/").pop()||"plugin.zip",o=zipNameToHumanName(s);n==null||n.tracker.setCaption(`Installing the ${o} plugin`);const{assetFolderPath:i}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});("activate"in r?r.activate:!0)&&await activatePlugin(e,{pluginPath:i,pluginName:o},n)},installTheme=async(e,{themeZipFile:t,options:r={}},n)=>{const s=zipNameToHumanName(t.name);n==null||n.tracker.setCaption(`Installing the ${s} theme`);const{assetFolderName:o}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});("activate"in r?r.activate:!0)&&await activateTheme(e,{themeFolderName:o},n)},runWpInstallationWizard=async(e,{options:t})=>{await e.request({url:"/wp-admin/install.php?step=2",method:"POST",formData:{language:"en",prefix:"wp_",weblog_title:"My WordPress Website",user_name:t.adminPassword||"admin",admin_password:t.adminPassword||"password",admin_password2:t.adminPassword||"password",Submit:"Install WordPress",pw_weak:"1",admin_email:"admin@localhost.com"}})},zipWpContent=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,s=joinPaths(n,"wp-content");let o=wpContentFilesExcludedFromExport;t&&(o=o.filter(p=>!p.startsWith("themes/twenty")).filter(p=>p!=="mu-plugins/sqlite-database-integration"));const i=phpVars({zipPath:r,wpContentPath:s,documentRoot:n,exceptPaths:o.map(p=>joinPaths(n,"wp-content",p)),additionalPaths:t?{[joinPaths(n,"wp-config.php")]:"wp-config.php"}:{}});await runPhpWithZipFunctions(e,`zipDir(${i.wpContentPath}, ${i.zipPath}, array(
|
|
870
|
+
'exclude_paths' => ${i.exceptPaths},
|
|
871
|
+
'zip_root' => ${i.documentRoot},
|
|
872
|
+
'additional_paths' => ${i.additionalPaths}
|
|
873
|
+
));`);const l=await e.readFileAsBuffer(r);return e.unlink(r),l},stepHandlers=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin,activateTheme,applyWordPressPatches,cp,defineSiteUrl,defineWpConfigConsts,enableMultisite,exportWXR,exportWXZ,importFile,importWordPressFiles,installPlugin,installTheme,login,mkdir,mv,request,rm,rmdir,runPHP,runPHPWithOptions,runSql,runWpInstallationWizard,setPhpIniEntry,setSiteOptions,unzip,updateUserMeta,writeFile,zipWpContent},Symbol.toStringTag,{value:"Module"})),FALLBACK_FILE_SIZE=5*1024*1024;function cloneResponseMonitorProgress(e,t){const r=e.headers.get("content-length")||"",n=parseInt(r,10)||FALLBACK_FILE_SIZE;function s(o,i){t(new CustomEvent("progress",{detail:{loaded:o,total:i}}))}return new Response(new ReadableStream({async start(o){if(!e.body){o.close();return}const i=e.body.getReader();let l=0;for(;;)try{const{done:p,value:d}=await i.read();if(d&&(l+=d.byteLength),p){s(l,l),o.close();break}else s(l,n),o.enqueue(d)}catch(p){console.error({e:p}),o.error(p);break}}}),{status:e.status,statusText:e.statusText,headers:e.headers})}const PROGRESS_EPSILON=1e-5;class ProgressTracker extends EventTarget{constructor({weight:t=1,caption:r="",fillTime:n=4}={}){super(),this._selfWeight=1,this._selfDone=!1,this._selfProgress=0,this._selfCaption="",this._isFilling=!1,this._subTrackers=[],this._weight=t,this._selfCaption=r,this._fillTime=n}stage(t,r=""){if(t||(t=this._selfWeight),this._selfWeight-t<-PROGRESS_EPSILON)throw new Error(`Cannot add a stage with weight ${t} as the total weight of registered stages would exceed 1.`);this._selfWeight-=t;const n=new ProgressTracker({caption:r,weight:t,fillTime:this._fillTime});return this._subTrackers.push(n),n.addEventListener("progress",()=>this.notifyProgress()),n.addEventListener("done",()=>{this.done&&this.notifyDone()}),n}fillSlowly({stopBeforeFinishing:t=!0}={}){if(this._isFilling)return;this._isFilling=!0;const r=100,n=this._fillTime/r;this._fillInterval=setInterval(()=>{this.set(this._selfProgress+1),t&&this._selfProgress>=99&&clearInterval(this._fillInterval)},n)}set(t){this._selfProgress=Math.min(t,100),this.notifyProgress(),this._selfProgress+PROGRESS_EPSILON>=100&&this.finish()}finish(){this._fillInterval&&clearInterval(this._fillInterval),this._selfDone=!0,this._selfProgress=100,this._isFilling=!1,this._fillInterval=void 0,this.notifyProgress(),this.notifyDone()}get caption(){for(let t=this._subTrackers.length-1;t>=0;t--)if(!this._subTrackers[t].done){const r=this._subTrackers[t].caption;if(r)return r}return this._selfCaption}setCaption(t){this._selfCaption=t,this.notifyProgress()}get done(){return this.progress+PROGRESS_EPSILON>=100}get progress(){if(this._selfDone)return 100;const t=this._subTrackers.reduce((r,n)=>r+n.progress*n.weight,this._selfProgress*this._selfWeight);return Math.round(t*1e4)/1e4}get weight(){return this._weight}get observer(){return this._progressObserver||(this._progressObserver=t=>{this.set(t)}),this._progressObserver}get loadingListener(){return this._loadingListener||(this._loadingListener=t=>{this.set(t.detail.loaded/t.detail.total*100)}),this._loadingListener}pipe(t){t.setProgress({progress:this.progress,caption:this.caption}),this.addEventListener("progress",r=>{t.setProgress({progress:r.detail.progress,caption:r.detail.caption})}),this.addEventListener("done",()=>{t.setLoaded()})}addEventListener(t,r){super.addEventListener(t,r)}removeEventListener(t,r){super.removeEventListener(t,r)}notifyProgress(){const t=this;this.dispatchEvent(new CustomEvent("progress",{detail:{get progress(){return t.progress},get caption(){return t.caption}}}))}notifyDone(){this.dispatchEvent(new CustomEvent("done"))}}const kError=Symbol("error"),kMessage=Symbol("message");class ErrorEvent2 extends Event{constructor(t,r={}){super(t),this[kError]=r.error===void 0?null:r.error,this[kMessage]=r.message===void 0?"":r.message}get error(){return this[kError]}get message(){return this[kMessage]}}Object.defineProperty(ErrorEvent2.prototype,"error",{enumerable:!0});Object.defineProperty(ErrorEvent2.prototype,"message",{enumerable:!0});const ErrorEvent=typeof globalThis.ErrorEvent=="function"?globalThis.ErrorEvent:ErrorEvent2;function isExitCodeZero(e){return e instanceof Error?"exitCode"in e&&(e==null?void 0:e.exitCode)===0||(e==null?void 0:e.name)==="ExitStatus"&&"status"in e&&e.status===0:!1}class UnhandledRejectionsTarget extends EventTarget{constructor(){super(...arguments),this.listenersCount=0}addEventListener(t,r){++this.listenersCount,super.addEventListener(t,r)}removeEventListener(t,r){--this.listenersCount,super.removeEventListener(t,r)}hasListeners(){return this.listenersCount>0}}function improveWASMErrorReporting(e){e.asm={...e.asm};const t=new UnhandledRejectionsTarget;for(const r in e.asm)if(typeof e.asm[r]=="function"){const n=e.asm[r];e.asm[r]=function(...s){var o;try{return n(...s)}catch(i){if(!(i instanceof Error))throw i;const l=clarifyErrorMessage(i,(o=e.lastAsyncifyStackSource)==null?void 0:o.stack);if(e.lastAsyncifyStackSource&&(i.cause=e.lastAsyncifyStackSource),t.hasListeners()){t.dispatchEvent(new ErrorEvent("error",{error:i,message:l}));return}throw isExitCodeZero(i)||showCriticalErrorBox(l),i}}}return t}let functionsMaybeMissingFromAsyncify=[];function getFunctionsMaybeMissingFromAsyncify(){return functionsMaybeMissingFromAsyncify}function clarifyErrorMessage(e,t){if(e.message==="unreachable"){let r=UNREACHABLE_ERROR;t||(r+=`
|
|
805
874
|
|
|
806
875
|
This stack trace is lacking. For a better one initialize
|
|
807
876
|
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
808
877
|
|
|
809
|
-
`),
|
|
810
|
-
`;return r}return e.message}const
|
|
878
|
+
`),functionsMaybeMissingFromAsyncify=extractPHPFunctionsFromStack(t||e.stack||"");for(const n of functionsMaybeMissingFromAsyncify)r+=` * ${n}
|
|
879
|
+
`;return r}return e.message}const UNREACHABLE_ERROR=`
|
|
811
880
|
"unreachable" WASM instruction executed.
|
|
812
881
|
|
|
813
882
|
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
@@ -831,13 +900,13 @@ the Dockerfile, you'll need to trigger this error again with long stack
|
|
|
831
900
|
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
832
901
|
CLI option:
|
|
833
902
|
|
|
834
|
-
`,
|
|
835
|
-
${
|
|
836
|
-
${
|
|
837
|
-
`))console.log(`${
|
|
838
|
-
`).slice(1).map(r=>{const n=r.trim().substring(3).split(" ");return{fn:n.length>=2?n[0]:"<unknown>",isWasm:r.includes("wasm://")}}).filter(({fn:r,isWasm:n})=>n&&!r.startsWith("dynCall_")&&!r.startsWith("invoke_")).map(({fn:r})=>r);return Array.from(new Set(t))}catch{return[]}}ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=async function*(){const e=this.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}},ReadableStream.prototype.iterate=ReadableStream.prototype[Symbol.asyncIterator]);class
|
|
903
|
+
`,redBg="\x1B[41m",bold="\x1B[1m",reset="\x1B[0m",eol="\x1B[K";let logged=!1;function showCriticalErrorBox(e){if(!logged&&(logged=!0,!(e!=null&&e.trim().startsWith("Program terminated with exit")))){console.log(`${redBg}
|
|
904
|
+
${eol}
|
|
905
|
+
${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
|
|
906
|
+
`))console.log(`${eol} ${t} `);console.log(`${reset}`)}}function extractPHPFunctionsFromStack(e){try{const t=e.split(`
|
|
907
|
+
`).slice(1).map(r=>{const n=r.trim().substring(3).split(" ");return{fn:n.length>=2?n[0]:"<unknown>",isWasm:r.includes("wasm://")}}).filter(({fn:r,isWasm:n})=>n&&!r.startsWith("dynCall_")&&!r.startsWith("invoke_")).map(({fn:r})=>r);return Array.from(new Set(t))}catch{return[]}}ReadableStream.prototype[Symbol.asyncIterator]||(ReadableStream.prototype[Symbol.asyncIterator]=async function*(){const e=this.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}},ReadableStream.prototype.iterate=ReadableStream.prototype[Symbol.asyncIterator]);class PHPResponse{constructor(t,r,n,s="",o=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=o,this.errors=s}static fromRawData(t){return new PHPResponse(t.httpStatusCode,t.headers,t.bytes,t.errors,t.exitCode)}toRawData(){return{headers:this.headers,bytes:this.bytes,errors:this.errors,exitCode:this.exitCode,httpStatusCode:this.httpStatusCode}}get json(){return JSON.parse(this.text)}get text(){return new TextDecoder().decode(this.bytes)}}const SupportedPHPVersions=["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"],LatestSupportedPHPVersion=SupportedPHPVersions[0],SupportedPHPVersionsList=SupportedPHPVersions,SupportedPHPExtensionsList=["iconv","mbstring","xml-bundle","gd"],SupportedPHPExtensionBundles={"kitchen-sink":SupportedPHPExtensionsList};var Ae,Be;class PHPBrowser{constructor(t,r={}){Z(this,Ae,void 0);Z(this,Be,void 0);this.requestHandler=t,te(this,Ae,{}),te(this,Be,{handleRedirects:!1,maxRedirects:4,...r})}async request(t,r=0){const n=await this.requestHandler.request({...t,headers:{...t.headers,cookie:this.serializeCookies()}});if(n.headers["set-cookie"]&&this.setCookies(n.headers["set-cookie"]),L(this,Be).handleRedirects&&n.headers.location&&r<L(this,Be).maxRedirects){const s=new URL(n.headers.location[0],this.requestHandler.absoluteUrl);return this.request({url:s.toString(),method:"GET",headers:{}},r+1)}return n}pathToInternalUrl(t){return this.requestHandler.pathToInternalUrl(t)}internalUrlToPath(t){return this.requestHandler.internalUrlToPath(t)}get absoluteUrl(){return this.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.documentRoot}setCookies(t){for(const r of t)try{if(!r.includes("="))continue;const n=r.indexOf("="),s=r.substring(0,n),o=r.substring(n+1).split(";")[0];L(this,Ae)[s]=o}catch(n){console.error(n)}}serializeCookies(){const t=[];for(const r in L(this,Ae))t.push(`${r}=${L(this,Ae)[r]}`);return t.join("; ")}}Ae=new WeakMap,Be=new WeakMap;const DEFAULT_BASE_URL="http://example.com";function toRelativeUrl(e){return e.toString().substring(e.origin.length)}function removePathPrefix(e,t){return!t||!e.startsWith(t)?e:e.substring(t.length)}function ensurePathPrefix(e,t){return!t||e.startsWith(t)?e:t+e}var Se,Ge,dt,De,Ke,we,Je,Ze,mt,zt,_t,Wt,gt,Bt;class PHPRequestHandler{constructor(t,r={}){Z(this,mt);Z(this,_t);Z(this,gt);Z(this,Se,void 0);Z(this,Ge,void 0);Z(this,dt,void 0);Z(this,De,void 0);Z(this,Ke,void 0);Z(this,we,void 0);Z(this,Je,void 0);Z(this,Ze,void 0);te(this,Ze,new Semaphore({concurrency:1}));const{documentRoot:n="/www/",absoluteUrl:s=typeof location=="object"?location==null?void 0:location.href:""}=r;this.php=t,te(this,Se,n);const o=new URL(s);te(this,dt,o.hostname),te(this,De,o.port?Number(o.port):o.protocol==="https:"?443:80),te(this,Ge,(o.protocol||"").replace(":",""));const i=L(this,De)!==443&&L(this,De)!==80;te(this,Ke,[L(this,dt),i?`:${L(this,De)}`:""].join("")),te(this,we,o.pathname.replace(/\/+$/,"")),te(this,Je,[`${L(this,Ge)}://`,L(this,Ke),L(this,we)].join(""))}pathToInternalUrl(t){return`${this.absoluteUrl}${t}`}internalUrlToPath(t){const r=new URL(t);return r.pathname.startsWith(L(this,we))&&(r.pathname=r.pathname.slice(L(this,we).length)),toRelativeUrl(r)}get isRequestRunning(){return L(this,Ze).running>0}get absoluteUrl(){return L(this,Je)}get documentRoot(){return L(this,Se)}async request(t){const r=t.url.startsWith("http://")||t.url.startsWith("https://"),n=new URL(t.url,r?void 0:DEFAULT_BASE_URL),s=removePathPrefix(n.pathname,L(this,we)),o=`${L(this,Se)}${s}`;return seemsLikeAPHPRequestHandlerPath(o)?await ce(this,_t,Wt).call(this,t,n):ce(this,mt,zt).call(this,o)}}Se=new WeakMap,Ge=new WeakMap,dt=new WeakMap,De=new WeakMap,Ke=new WeakMap,we=new WeakMap,Je=new WeakMap,Ze=new WeakMap,mt=new WeakSet,zt=function(t){if(!this.php.fileExists(t))return new PHPResponse(404,{"x-file-type":["static"]},new TextEncoder().encode("404 File not found"));const r=this.php.readFileAsBuffer(t);return new PHPResponse(200,{"content-length":[`${r.byteLength}`],"content-type":[inferMimeType(t)],"accept-ranges":["bytes"],"cache-control":["public, max-age=0"]},r)},_t=new WeakSet,Wt=async function(t,r){var s,o;const n=await L(this,Ze).acquire();try{this.php.addServerGlobalEntry("REMOTE_ADDR","127.0.0.1"),this.php.addServerGlobalEntry("DOCUMENT_ROOT",L(this,Se)),this.php.addServerGlobalEntry("HTTPS",L(this,Je).startsWith("https://")?"on":"");let i="GET";const l={host:L(this,Ke),...normalizeHeaders(t.headers||{})},p=[];if(t.files&&Object.keys(t.files).length){i="POST";for(const m in t.files){const w=t.files[m];p.push({key:m,name:w.name,type:w.type,data:new Uint8Array(await w.arrayBuffer())})}(s=l["content-type"])!=null&&s.startsWith("multipart/form-data")&&(t.formData=parseMultipartFormDataString(t.body||""),l["content-type"]="application/x-www-form-urlencoded",delete t.body)}let d;t.formData!==void 0?(i="POST",l["content-type"]=l["content-type"]||"application/x-www-form-urlencoded",d=new URLSearchParams(t.formData).toString()):d=t.body;let u;try{let m=r.pathname;if((o=t.headers)!=null&&o["x-rewrite-url"])try{m=new URL(t.headers["x-rewrite-url"]).pathname}catch{}u=ce(this,gt,Bt).call(this,m)}catch{return new PHPResponse(404,{},new TextEncoder().encode("404 File not found"))}return await this.php.run({relativeUri:ensurePathPrefix(toRelativeUrl(r),L(this,we)),protocol:L(this,Ge),method:t.method||i,body:d,fileInfos:p,scriptPath:u,headers:l})}finally{n()}},gt=new WeakSet,Bt=function(t){let r=removePathPrefix(t,L(this,we));r.includes(".php")?r=r.split(".php")[0]+".php":(r.endsWith("/")||(r+="/"),r.endsWith("index.php")||(r+="index.php"));const n=`${L(this,Se)}${r}`;if(this.php.fileExists(n))return n;throw new Error(`File not found: ${n}`)};function parseMultipartFormDataString(e){const t={},r=e.match(/--(.*)\r\n/);if(!r)return t;const n=r[1],s=e.split(`--${n}`);return s.shift(),s.pop(),s.forEach(o=>{const i=o.indexOf(`\r
|
|
839
908
|
\r
|
|
840
|
-
`),l=i.substring(0,o).trim(),d=i.substring(o+4).trim(),u=l.match(/name="([^"]+)"/);if(u){const p=u[1];t[p]=d}}),t}function ic(e){switch(e.split(".").pop()){case"css":return"text/css";case"js":return"application/javascript";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"woff":return"font/woff";case"woff2":return"font/woff2";case"ttf":return"font/ttf";case"otf":return"font/otf";case"eot":return"font/eot";case"ico":return"image/x-icon";case"html":return"text/html";case"json":return"application/json";case"xml":return"application/xml";case"txt":case"md":return"text/plain";default:return"application-octet-stream"}}function oc(e){return ac(e)||cc(e)}function ac(e){return e.endsWith(".php")||e.includes(".php/")}function cc(e){return!e.split("/").pop().includes(".")}const Wr={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function lc(e){const t=typeof e=="object"?e==null?void 0:e.errno:null;if(t in Wr)return Wr[t]}function xe(e=""){return function(r,n,s){const i=s.value;s.value=function(...o){try{return i.apply(this,o)}catch(l){const d=typeof l=="object"?l==null?void 0:l.errno:null;if(d in Wr){const u=Wr[d],p=typeof o[0]=="string"?o[0]:null,h=p!==null?e.replaceAll("{path}",p):e;throw new Error(`${h}: ${u}`,{cause:l})}throw l}}}}const uc=new Map;function dc(e){return uc.get(e)}(function(){var e;return typeof process<"u"&&((e=process.release)==null?void 0:e.name)==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"})();var pc=Object.defineProperty,fc=Object.getOwnPropertyDescriptor,Be=(e,t,r,n)=>{for(var s=n>1?void 0:n?fc(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(n?o(t,r,s):o(s))||s);return n&&s&&pc(t,r,s),s};const we="string",Dt="number",te=Symbol("__private__dont__use");var wt,nt,vt,st,Ye,Gt,wr,rn,co,nn,lo,sn,uo,on,po,an,fo,cn,ho,ln,mo,un,yo,dn,go,pn,$o,fn,_o,hn,wo;class Ge{constructor(t,r){ee(this,rn);ee(this,nn);ee(this,sn);ee(this,on);ee(this,an);ee(this,cn);ee(this,ln);ee(this,un);ee(this,dn);ee(this,pn);ee(this,fn);ee(this,hn);ee(this,wt,void 0);ee(this,nt,void 0);ee(this,vt,void 0);ee(this,st,void 0);ee(this,Ye,void 0);ee(this,Gt,void 0);ee(this,wr,void 0);pe(this,wt,[]),pe(this,nt,!1),pe(this,vt,null),pe(this,st,{}),pe(this,Ye,new Map),pe(this,Gt,[]),pe(this,wr,new xn({concurrency:1})),t!==void 0&&this.initializeRuntime(t),r&&(this.requestHandler=new ec(new nc(this,r)))}addEventListener(t,r){z(this,Ye).has(t)||z(this,Ye).set(t,new Set),z(this,Ye).get(t).add(r)}removeEventListener(t,r){var n;(n=z(this,Ye).get(t))==null||n.delete(r)}dispatchEvent(t){const r=z(this,Ye).get(t.type);if(r)for(const n of r)n(t)}async onMessage(t){z(this,Gt).push(t)}async setSpawnHandler(t){this[te].spawnProcess=t}get absoluteUrl(){return this.requestHandler.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.requestHandler.documentRoot}pathToInternalUrl(t){return this.requestHandler.requestHandler.pathToInternalUrl(t)}internalUrlToPath(t){return this.requestHandler.requestHandler.internalUrlToPath(t)}initializeRuntime(t){if(this[te])throw new Error("PHP runtime already initialized.");const r=dc(t);if(!r)throw new Error("Invalid PHP runtime id.");this[te]=r,r.onMessage=async n=>{for(const s of z(this,Gt)){const i=await s(n);if(i)return i}return""},pe(this,vt,Ba(r))}setPhpIniPath(t){if(z(this,nt))throw new Error("Cannot set PHP ini path after calling run().");this[te].ccall("wasm_set_phpini_path",null,["string"],[t])}setPhpIniEntry(t,r){if(z(this,nt))throw new Error("Cannot set PHP ini entries after calling run().");z(this,wt).push([t,r])}chdir(t){this[te].FS.chdir(t)}async request(t,r){if(!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(t,r)}async run(t){const r=await z(this,wr).acquire();try{z(this,nt)||(_e(this,rn,co).call(this),pe(this,nt,!0)),_e(this,un,yo).call(this,t.scriptPath||""),_e(this,sn,uo).call(this,t.relativeUri||""),_e(this,an,fo).call(this,t.method||"GET");const n=vo(t.headers||{}),s=n.host||"example.com:443";if(_e(this,on,po).call(this,s,t.protocol||"http"),_e(this,cn,ho).call(this,n),t.body&&_e(this,ln,mo).call(this,t.body),t.fileInfos)for(const i of t.fileInfos)_e(this,pn,$o).call(this,i);return t.code&&_e(this,fn,_o).call(this," ?>"+t.code),_e(this,dn,go).call(this),await _e(this,hn,wo).call(this)}finally{r(),this.dispatchEvent({type:"request.end"})}}addServerGlobalEntry(t,r){z(this,st)[t]=r}defineConstant(t,r){let n={};try{n=JSON.parse(this.fileExists("/tmp/consts.json")&&this.readFileAsText("/tmp/consts.json")||"{}")}catch{}this.writeFile("/tmp/consts.json",JSON.stringify({...n,[t]:r}))}mkdir(t){this[te].FS.mkdirTree(t)}mkdirTree(t){this.mkdir(t)}readFileAsText(t){return new TextDecoder().decode(this.readFileAsBuffer(t))}readFileAsBuffer(t){return this[te].FS.readFile(t)}writeFile(t,r){this[te].FS.writeFile(t,r)}unlink(t){this[te].FS.unlink(t)}mv(t,r){try{this[te].FS.rename(t,r)}catch(n){const s=lc(n);throw s?new Error(`Could not move ${t} to ${r}: ${s}`,{cause:n}):n}}rmdir(t,r={recursive:!0}){r!=null&&r.recursive&&this.listFiles(t).forEach(n=>{const s=`${t}/${n}`;this.isDir(s)?this.rmdir(s,r):this.unlink(s)}),this[te].FS.rmdir(t)}listFiles(t,r={prependPath:!1}){if(!this.fileExists(t))return[];try{const n=this[te].FS.readdir(t).filter(s=>s!=="."&&s!=="..");if(r.prependPath){const s=t.replace(/\/$/,"");return n.map(i=>`${s}/${i}`)}return n}catch(n){return console.error(n,{path:t}),[]}}isDir(t){return this.fileExists(t)?this[te].FS.isDir(this[te].FS.lookupPath(t).node.mode):!1}fileExists(t){try{return this[te].FS.lookupPath(t),!0}catch{return!1}}exit(t=0){return this[te]._exit(t)}}wt=new WeakMap,nt=new WeakMap,vt=new WeakMap,st=new WeakMap,Ye=new WeakMap,Gt=new WeakMap,wr=new WeakMap,rn=new WeakSet,co=function(){if(this.setPhpIniEntry("auto_prepend_file","/tmp/consts.php"),this.fileExists("/tmp/consts.php")||this.writeFile("/tmp/consts.php",`<?php
|
|
909
|
+
`),l=o.substring(0,i).trim(),p=o.substring(i+4).trim(),d=l.match(/name="([^"]+)"/);if(d){const u=d[1];t[u]=p}}),t}function inferMimeType(e){switch(e.split(".").pop()){case"css":return"text/css";case"js":return"application/javascript";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"woff":return"font/woff";case"woff2":return"font/woff2";case"ttf":return"font/ttf";case"otf":return"font/otf";case"eot":return"font/eot";case"ico":return"image/x-icon";case"html":return"text/html";case"json":return"application/json";case"xml":return"application/xml";case"txt":case"md":return"text/plain";default:return"application-octet-stream"}}function seemsLikeAPHPRequestHandlerPath(e){return seemsLikeAPHPFile(e)||seemsLikeADirectoryRoot(e)}function seemsLikeAPHPFile(e){return e.endsWith(".php")||e.includes(".php/")}function seemsLikeADirectoryRoot(e){return!e.split("/").pop().includes(".")}const FileErrorCodes={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function getEmscriptenFsError(e){const t=typeof e=="object"?e==null?void 0:e.errno:null;if(t in FileErrorCodes)return FileErrorCodes[t]}function rethrowFileSystemError(e=""){return function(r,n,s){const o=s.value;s.value=function(...i){try{return o.apply(this,i)}catch(l){const p=typeof l=="object"?l==null?void 0:l.errno:null;if(p in FileErrorCodes){const d=FileErrorCodes[p],u=typeof i[0]=="string"?i[0]:null,m=u!==null?e.replaceAll("{path}",u):e;throw new Error(`${m}: ${d}`,{cause:l})}throw l}}}}const loadedRuntimes=new Map;function getLoadedRuntime(e){return loadedRuntimes.get(e)}(function(){var e;return typeof process<"u"&&((e=process.release)==null?void 0:e.name)==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"})();var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,r,n)=>{for(var s=n>1?void 0:n?__getOwnPropDesc(t,r):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(n?i(t,r,s):i(s))||s);return n&&s&&__defProp(t,r,s),s};const STRING="string",NUMBER="number",__private__dont__use=Symbol("__private__dont__use");var Fe,Qe,Ye,Pe,Re,Te,be,Xe,$t,Gt,yt,Kt,wt,Jt,vt,Zt,Pt,Qt,bt,Yt,Et,Xt,St,er,Rt,tr,Tt,rr,kt,nr,Ct,sr;class BasePHP{constructor(e,t){Z(this,$t);Z(this,yt);Z(this,wt);Z(this,vt);Z(this,Pt);Z(this,bt);Z(this,Et);Z(this,St);Z(this,Rt);Z(this,Tt);Z(this,kt);Z(this,Ct);Z(this,Fe,void 0);Z(this,Qe,void 0);Z(this,Ye,void 0);Z(this,Pe,void 0);Z(this,Re,void 0);Z(this,Te,void 0);Z(this,be,void 0);Z(this,Xe,void 0);te(this,Fe,[]),te(this,Pe,!1),te(this,Re,null),te(this,Te,{}),te(this,be,new Map),te(this,Xe,[]),this.semaphore=new Semaphore({concurrency:1}),e!==void 0&&this.initializeRuntime(e),t&&(this.requestHandler=new PHPBrowser(new PHPRequestHandler(this,t)))}addEventListener(e,t){L(this,be).has(e)||L(this,be).set(e,new Set),L(this,be).get(e).add(t)}removeEventListener(e,t){var r;(r=L(this,be).get(e))==null||r.delete(t)}dispatchEvent(e){const t=L(this,be).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){L(this,Xe).push(e)}async setSpawnHandler(handler){typeof handler=="string"&&(handler=createSpawnHandler(eval(handler))),this[__private__dont__use].spawnProcess=handler}get absoluteUrl(){return this.requestHandler.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.requestHandler.documentRoot}pathToInternalUrl(e){return this.requestHandler.requestHandler.pathToInternalUrl(e)}internalUrlToPath(e){return this.requestHandler.requestHandler.internalUrlToPath(e)}initializeRuntime(e){if(this[__private__dont__use])throw new Error("PHP runtime already initialized.");const t=getLoadedRuntime(e);if(!t)throw new Error("Invalid PHP runtime id.");this[__private__dont__use]=t,t.onMessage=async r=>{for(const n of L(this,Xe)){const s=await n(r);if(s)return s}return""},te(this,Re,improveWASMErrorReporting(t)),this.dispatchEvent({type:"runtime.initialized"})}async setSapiName(e){if(this[__private__dont__use].ccall("wasm_set_sapi_name",NUMBER,[STRING],[e])!==0)throw new Error("Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?");te(this,Ye,e)}setPhpIniPath(e){if(L(this,Pe))throw new Error("Cannot set PHP ini path after calling run().");te(this,Qe,e),this[__private__dont__use].ccall("wasm_set_phpini_path",null,["string"],[e])}setPhpIniEntry(e,t){if(L(this,Pe))throw new Error("Cannot set PHP ini entries after calling run().");L(this,Fe).push([e,t])}chdir(e){this[__private__dont__use].FS.chdir(e)}async request(e,t){if(!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(e,t)}async run(e){const t=await this.semaphore.acquire();let r;try{L(this,Pe)||(ce(this,$t,Gt).call(this),te(this,Pe,!0)),ce(this,St,er).call(this,e.scriptPath||""),ce(this,wt,Jt).call(this,e.relativeUri||""),ce(this,Pt,Qt).call(this,e.method||"GET");const n=normalizeHeaders(e.headers||{}),s=n.host||"example.com:443";if(ce(this,vt,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)for(const i of e.fileInfos)ce(this,Tt,rr).call(this,i);typeof e.code=="string"&&ce(this,kt,nr).call(this," ?>"+e.code),ce(this,Rt,tr).call(this);const o=await ce(this,Ct,sr).call(this);if(e.throwOnError&&o.exitCode!==0){const i={stdout:o.text,stderr:o.errors};console.warn("PHP.run() output was:",i);const l=new Error(`PHP.run() failed with exit code ${o.exitCode} and the following output`);throw l.output=i,l}return o}finally{try{r&&this[__private__dont__use].free(r)}finally{t(),this.dispatchEvent({type:"request.end"})}}}addServerGlobalEntry(e,t){L(this,Te)[e]=t}defineConstant(e,t){let r={};try{r=JSON.parse(this.fileExists("/tmp/consts.json")&&this.readFileAsText("/tmp/consts.json")||"{}")}catch{}this.writeFile("/tmp/consts.json",JSON.stringify({...r,[e]:t}))}mkdir(e){this[__private__dont__use].FS.mkdirTree(e)}mkdirTree(e){this.mkdir(e)}readFileAsText(e){return new TextDecoder().decode(this.readFileAsBuffer(e))}readFileAsBuffer(e){return this[__private__dont__use].FS.readFile(e)}writeFile(e,t){this[__private__dont__use].FS.writeFile(e,t)}unlink(e){this[__private__dont__use].FS.unlink(e)}mv(e,t){try{this[__private__dont__use].FS.rename(e,t)}catch(r){const n=getEmscriptenFsError(r);throw n?new Error(`Could not move ${e} to ${t}: ${n}`,{cause:r}):r}}rmdir(e,t={recursive:!0}){t!=null&&t.recursive&&this.listFiles(e).forEach(r=>{const n=`${e}/${r}`;this.isDir(n)?this.rmdir(n,t):this.unlink(n)}),this[__private__dont__use].FS.rmdir(e)}listFiles(e,t={prependPath:!1}){if(!this.fileExists(e))return[];try{const r=this[__private__dont__use].FS.readdir(e).filter(n=>n!=="."&&n!=="..");if(t.prependPath){const n=e.replace(/\/$/,"");return r.map(s=>`${n}/${s}`)}return r}catch(r){return console.error(r,{path:e}),[]}}isDir(e){return this.fileExists(e)?this[__private__dont__use].FS.isDir(this[__private__dont__use].FS.lookupPath(e).node.mode):!1}fileExists(e){try{return this[__private__dont__use].FS.lookupPath(e),!0}catch{return!1}}hotSwapPHPRuntime(e){const t=this[__private__dont__use].FS;try{this.exit()}catch{}if(this.initializeRuntime(e),L(this,Qe)&&this.setPhpIniPath(L(this,Qe)),L(this,Ye)&&this.setSapiName(L(this,Ye)),this.requestHandler){const r=this.documentRoot;recreateMemFS(this[__private__dont__use].FS,t,r)}}exit(e=0){this.dispatchEvent({type:"runtime.beforedestroy"});try{this[__private__dont__use]._exit(e)}catch{}te(this,Pe,!1),te(this,Re,null),delete this[__private__dont__use].onMessage,delete this[__private__dont__use]}}Fe=new WeakMap,Qe=new WeakMap,Ye=new WeakMap,Pe=new WeakMap,Re=new WeakMap,Te=new WeakMap,be=new WeakMap,Xe=new WeakMap,$t=new WeakSet,Gt=function(){if(this.setPhpIniEntry("auto_prepend_file","/tmp/consts.php"),this.fileExists("/tmp/consts.php")||this.writeFile("/tmp/consts.php",`<?php
|
|
841
910
|
if(file_exists('/tmp/consts.json')) {
|
|
842
911
|
$consts = json_decode(file_get_contents('/tmp/consts.json'), true);
|
|
843
912
|
foreach ($consts as $const => $value) {
|
|
@@ -845,23 +914,23 @@ ${Ya} WASM ERROR${ei}${Xs}`);for(const t of e.split(`
|
|
|
845
914
|
define($const, $value);
|
|
846
915
|
}
|
|
847
916
|
}
|
|
848
|
-
}`),
|
|
917
|
+
}`),L(this,Fe).length>0){const e=L(this,Fe).map(([t,r])=>`${t}=${r}`).join(`
|
|
849
918
|
`)+`
|
|
850
919
|
|
|
851
|
-
`;this[te].ccall("wasm_set_phpini_entries",null,[we],[t])}this[te].ccall("php_wasm_init",null,[],[])},nn=new WeakSet,lo=function(){const t="/tmp/headers.json";if(!this.fileExists(t))throw new Error("SAPI Error: Could not find response headers file.");const r=JSON.parse(this.readFileAsText(t)),n={};for(const s of r.headers){if(!s.includes(": "))continue;const i=s.indexOf(": "),o=s.substring(0,i).toLowerCase(),l=s.substring(i+2);o in n||(n[o]=[]),n[o].push(l)}return{headers:n,httpStatusCode:r.status}},sn=new WeakSet,uo=function(t){if(this[te].ccall("wasm_set_request_uri",null,[we],[t]),t.includes("?")){const r=t.substring(t.indexOf("?")+1);this[te].ccall("wasm_set_query_string",null,[we],[r])}},on=new WeakSet,po=function(t,r){this[te].ccall("wasm_set_request_host",null,[we],[t]);let n;try{n=parseInt(new URL(t).port,10)}catch{}(!n||isNaN(n)||n===80)&&(n=r==="https"?443:80),this[te].ccall("wasm_set_request_port",null,[Dt],[n]),(r==="https"||!r&&n===443)&&this.addServerGlobalEntry("HTTPS","on")},an=new WeakSet,fo=function(t){this[te].ccall("wasm_set_request_method",null,[we],[t])},cn=new WeakSet,ho=function(t){t.cookie&&this[te].ccall("wasm_set_cookies",null,[we],[t.cookie]),t["content-type"]&&this[te].ccall("wasm_set_content_type",null,[we],[t["content-type"]]),t["content-length"]&&this[te].ccall("wasm_set_content_length",null,[Dt],[parseInt(t["content-length"],10)]);for(const r in t){let n="HTTP_";["content-type","content-length"].includes(r.toLowerCase())&&(n=""),this.addServerGlobalEntry(`${n}${r.toUpperCase().replace(/-/g,"_")}`,t[r])}},ln=new WeakSet,mo=function(t){this[te].ccall("wasm_set_request_body",null,[we],[t]),this[te].ccall("wasm_set_content_length",null,[Dt],[new TextEncoder().encode(t).length])},un=new WeakSet,yo=function(t){this[te].ccall("wasm_set_path_translated",null,[we],[t])},dn=new WeakSet,go=function(){for(const t in z(this,st))this[te].ccall("wasm_add_SERVER_entry",null,[we,we],[t,z(this,st)[t]])},pn=new WeakSet,$o=function(t){const{key:r,name:n,type:s,data:i}=t,o=`/tmp/${Math.random().toFixed(20)}`;this.writeFile(o,i);const l=0;this[te].ccall("wasm_add_uploaded_file",null,[we,we,we,we,Dt,Dt],[r,n,s,o,l,i.byteLength])},fn=new WeakSet,_o=function(t){this[te].ccall("wasm_set_php_code",null,[we],[t])},hn=new WeakSet,wo=async function(){var i;let t,r;try{t=await new Promise((o,l)=>{var u;r=p=>{const h=new Error("Rethrown");h.cause=p.error,h.betterMessage=p.message,l(h)},(u=z(this,vt))==null||u.addEventListener("error",r);const d=this[te].ccall("wasm_sapi_handle_request",Dt,[],[],{async:!0});return d instanceof Promise?d.then(o,l):o(d)})}catch(o){for(const p in this)typeof this[p]=="function"&&(this[p]=()=>{throw new Error("PHP runtime has crashed – see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=Ga();const l=o,d="betterMessage"in l?l.betterMessage:l.message,u=new Error(d);throw u.cause=l,u}finally{(i=z(this,vt))==null||i.removeEventListener("error",r),pe(this,st,{})}const{headers:n,httpStatusCode:s}=_e(this,nn,lo).call(this);return new bt(s,n,this.readFileAsBuffer("/tmp/stdout"),this.readFileAsText("/tmp/stderr"),t)};Be([xe('Could not create directory "{path}"')],Ge.prototype,"mkdir",1);Be([xe('Could not create directory "{path}"')],Ge.prototype,"mkdirTree",1);Be([xe('Could not read "{path}"')],Ge.prototype,"readFileAsText",1);Be([xe('Could not read "{path}"')],Ge.prototype,"readFileAsBuffer",1);Be([xe('Could not write to "{path}"')],Ge.prototype,"writeFile",1);Be([xe('Could not unlink "{path}"')],Ge.prototype,"unlink",1);Be([xe('Could not remove directory "{path}"')],Ge.prototype,"rmdir",1);Be([xe('Could not list files in "{path}"')],Ge.prototype,"listFiles",1);Be([xe('Could not stat "{path}"')],Ge.prototype,"isDir",1);Be([xe('Could not stat "{path}"')],Ge.prototype,"fileExists",1);function vo(e){const t={};for(const r in e)t[r.toLowerCase()]=e[r];return t}const hc=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function mc(e){return e&&typeof e=="object"&&typeof e.resource=="string"&&hc.includes(e.resource)}class St{static create(t,{semaphore:r,progress:n}){let s;switch(t.resource){case"vfs":s=new yc(t,n);break;case"literal":s=new gc(t,n);break;case"wordpress.org/themes":s=new wc(t,n);break;case"wordpress.org/plugins":s=new vc(t,n);break;case"url":s=new _c(t,n);break;default:throw new Error(`Invalid resource: ${t}`)}return s=new bc(s),r&&(s=new Pc(s,r)),s}setPlayground(t){this.playground=t}get isAsync(){return!1}}class yc extends St{constructor(t,r){super(),this.resource=t,this.progress=r}async resolve(){var r;const t=await this.playground.readFileAsBuffer(this.resource.path);return(r=this.progress)==null||r.set(100),new File([t],this.name)}get name(){return this.resource.path.split("/").pop()||""}}class gc extends St{constructor(t,r){super(),this.resource=t,this.progress=r}async resolve(){var t;return(t=this.progress)==null||t.set(100),new File([this.resource.contents],this.resource.name)}get name(){return this.resource.name}}class Jn extends St{constructor(t){super(),this.progress=t}async resolve(){var n,s;(n=this.progress)==null||n.setCaption(this.caption);const t=this.getURL();let r=await fetch(t);if(r=await za(r,((s=this.progress)==null?void 0:s.loadingListener)??$c),r.status!==200)throw new Error(`Could not download "${t}"`);return new File([await r.blob()],this.name)}get caption(){return`Downloading ${this.name}`}get name(){try{return new URL(this.getURL(),"http://example.com").pathname.split("/").pop()}catch{return this.getURL()}}get isAsync(){return!0}}const $c=()=>{};class _c extends Jn{constructor(t,r){super(r),this.resource=t}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class wc extends Jn{constructor(t,r){super(r),this.resource=t}get name(){return yn(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${bo(this.resource.slug)}`}}class vc extends Jn{constructor(t,r){super(r),this.resource=t}get name(){return yn(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${bo(this.resource.slug)}`}}function bo(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class Po extends St{constructor(t){super(),this.resource=t}async resolve(){return this.resource.resolve()}async setPlayground(t){return this.resource.setPlayground(t)}get progress(){return this.resource.progress}set progress(t){this.resource.progress=t}get name(){return this.resource.name}get isAsync(){return this.resource.isAsync}}class bc extends Po{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class Pc extends Po{constructor(t,r){super(t),this.semaphore=r}async resolve(){return this.isAsync?this.semaphore.run(()=>super.resolve()):super.resolve()}}var Ec=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var An={exports:{}},Eo={},Ae={},Jt={},br={},G={},$r={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(k){if(super(),!e.IDENTIFIER.test(k))throw new Error("CodeGen: name must be a valid identifier");this.str=k}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(k){super(),this._items=typeof k=="string"?[k]:k}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const k=this._items[0];return k===""||k==='""'}get str(){var k;return(k=this._str)!==null&&k!==void 0?k:this._str=this._items.reduce((O,j)=>`${O}${j}`,"")}get names(){var k;return(k=this._names)!==null&&k!==void 0?k:this._names=this._items.reduce((O,j)=>(j instanceof r&&(O[j.str]=(O[j.str]||0)+1),O),{})}}e._Code=n,e.nil=new n("");function s(g,...k){const O=[g[0]];let j=0;for(;j<k.length;)l(O,k[j]),O.push(g[++j]);return new n(O)}e._=s;const i=new n("+");function o(g,...k){const O=[T(g[0])];let j=0;for(;j<k.length;)O.push(i),l(O,k[j]),O.push(i,T(g[++j]));return d(O),new n(O)}e.str=o;function l(g,k){k instanceof n?g.push(...k._items):k instanceof r?g.push(k):g.push(h(k))}e.addCodeArg=l;function d(g){let k=1;for(;k<g.length-1;){if(g[k]===i){const O=u(g[k-1],g[k+1]);if(O!==void 0){g.splice(k-1,3,O);continue}g[k++]="+"}k++}}function u(g,k){if(k==='""')return g;if(g==='""')return k;if(typeof g=="string")return k instanceof r||g[g.length-1]!=='"'?void 0:typeof k!="string"?`${g.slice(0,-1)}${k}"`:k[0]==='"'?g.slice(0,-1)+k.slice(1):void 0;if(typeof k=="string"&&k[0]==='"'&&!(g instanceof r))return`"${g}${k.slice(1)}`}function p(g,k){return k.emptyStr()?g:g.emptyStr()?k:o`${g}${k}`}e.strConcat=p;function h(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:T(Array.isArray(g)?g.join(","):g)}function v(g){return new n(T(g))}e.stringify=v;function T(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=T;function w(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new n(`.${g}`):s`[${g}]`}e.getProperty=w;function R(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new n(`${g}`);throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=R;function _(g){return new n(g.toString())}e.regexpCode=_})($r);var Dn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=$r;class r extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var n;(function(d){d[d.Started=0]="Started",d[d.Completed=1]="Completed"})(n=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:u,parent:p}={}){this._names={},this._prefixes=u,this._parent=p}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const p=this._names[u]||this._nameGroup(u);return`${u}${p.index++}`}_nameGroup(u){var p,h;if(!((h=(p=this._parent)===null||p===void 0?void 0:p._prefixes)===null||h===void 0)&&h.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=s;class i extends t.Name{constructor(u,p){super(p),this.prefix=u}setValue(u,{property:p,itemIndex:h}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(p)}[${h}]`}}e.ValueScopeName=i;const o=(0,t._)`\n`;class l extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?o:t.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,p){var h;if(p.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const v=this.toName(u),{prefix:T}=v,w=(h=p.key)!==null&&h!==void 0?h:p.ref;let R=this._values[T];if(R){const k=R.get(w);if(k)return k}else R=this._values[T]=new Map;R.set(w,v);const _=this._scope[T]||(this._scope[T]=[]),g=_.length;return _[g]=p.ref,v.setValue(p,{property:T,itemIndex:g}),v}getValue(u,p){const h=this._values[u];if(h)return h.get(p)}scopeRefs(u,p=this._values){return this._reduceValues(p,h=>{if(h.scopePath===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return(0,t._)`${u}${h.scopePath}`})}scopeCode(u=this._values,p,h){return this._reduceValues(u,v=>{if(v.value===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return v.value.code},p,h)}_reduceValues(u,p,h={},v){let T=t.nil;for(const w in u){const R=u[w];if(!R)continue;const _=h[w]=h[w]||new Map;R.forEach(g=>{if(_.has(g))return;_.set(g,n.Started);let k=p(g);if(k){const O=this.opts.es5?e.varKinds.var:e.varKinds.const;T=(0,t._)`${T}${O} ${g} = ${k};${this.opts._n}`}else if(k=v==null?void 0:v(g))T=(0,t._)`${T}${k}${this.opts._n}`;else throw new r(g);_.set(g,n.Completed)})}return T}}e.ValueScope=l})(Dn);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=$r,r=Dn;var n=$r;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Dn;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(a,m){return this}}class o extends i{constructor(a,m,N){super(),this.varKind=a,this.name=m,this.rhs=N}render({es5:a,_n:m}){const N=a?r.varKinds.var:this.varKind,q=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${q};`+m}optimizeNames(a,m){if(a[this.name.str])return this.rhs&&(this.rhs=he(this.rhs,a,m)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(a,m,N){super(),this.lhs=a,this.rhs=m,this.sideEffects=N}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,m){if(!(this.lhs instanceof t.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=he(this.rhs,a,m),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return Re(a,this.rhs)}}class d extends l{constructor(a,m,N,q){super(a,N,q),this.op=m}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}}class u extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}}class p extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}}class h extends i{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}}class v extends i{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,m){return this.code=he(this.code,a,m),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class T extends i{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((m,N)=>m+N.render(a),"")}optimizeNodes(){const{nodes:a}=this;let m=a.length;for(;m--;){const N=a[m].optimizeNodes();Array.isArray(N)?a.splice(m,1,...N):N?a[m]=N:a.splice(m,1)}return a.length>0?this:void 0}optimizeNames(a,m){const{nodes:N}=this;let q=N.length;for(;q--;){const M=N[q];M.optimizeNames(a,m)||(at(a,M.names),N.splice(q,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((a,m)=>Z(a,m.names),{})}}class w extends T{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class R extends T{}class _ extends w{}_.kind="else";class g extends w{constructor(a,m){super(m),this.condition=a}render(a){let m=`if(${this.condition})`+super.render(a);return this.else&&(m+="else "+this.else.render(a)),m}optimizeNodes(){super.optimizeNodes();const a=this.condition;if(a===!0)return this.nodes;let m=this.else;if(m){const N=m.optimizeNodes();m=this.else=Array.isArray(N)?new _(N):N}if(m)return a===!1?m instanceof g?m:m.nodes:this.nodes.length?this:new g(ct(a),m instanceof g?[m]:m.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,m){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(a,m),!!(super.optimizeNames(a,m)||this.else))return this.condition=he(this.condition,a,m),this}get names(){const a=super.names;return Re(a,this.condition),this.else&&Z(a,this.else.names),a}}g.kind="if";class k extends w{}k.kind="for";class O extends k{constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,m){if(super.optimizeNames(a,m))return this.iteration=he(this.iteration,a,m),this}get names(){return Z(super.names,this.iteration.names)}}class j extends k{constructor(a,m,N,q){super(),this.varKind=a,this.name=m,this.from=N,this.to=q}render(a){const m=a.es5?r.varKinds.var:this.varKind,{name:N,from:q,to:M}=this;return`for(${m} ${N}=${q}; ${N}<${M}; ${N}++)`+super.render(a)}get names(){const a=Re(super.names,this.from);return Re(a,this.to)}}class D extends k{constructor(a,m,N,q){super(),this.loop=a,this.varKind=m,this.name=N,this.iterable=q}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,m){if(super.optimizeNames(a,m))return this.iterable=he(this.iterable,a,m),this}get names(){return Z(super.names,this.iterable.names)}}class b extends w{constructor(a,m,N){super(),this.name=a,this.args=m,this.async=N}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}b.kind="func";class C extends T{render(a){return"return "+super.render(a)}}C.kind="return";class A extends w{render(a){let m="try"+super.render(a);return this.catch&&(m+=this.catch.render(a)),this.finally&&(m+=this.finally.render(a)),m}optimizeNodes(){var a,m;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(m=this.finally)===null||m===void 0||m.optimizeNodes(),this}optimizeNames(a,m){var N,q;return super.optimizeNames(a,m),(N=this.catch)===null||N===void 0||N.optimizeNames(a,m),(q=this.finally)===null||q===void 0||q.optimizeNames(a,m),this}get names(){const a=super.names;return this.catch&&Z(a,this.catch.names),this.finally&&Z(a,this.finally.names),a}}class W extends w{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}W.kind="catch";class K extends w{render(a){return"finally"+super.render(a)}}K.kind="finally";class ce{constructor(a,m={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...m,_n:m.lines?`
|
|
852
|
-
`:""},this._extScope=a,this._scope=new r.Scope({parent:a}),this._nodes=[new R]}toString(){return this._root.render(this.opts)}name(a){return this._scope.name(a)}scopeName(a){return this._extScope.name(a)}scopeValue(a,m){const N=this._extScope.value(a,m);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(a,m){return this._extScope.getValue(a,m)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,m,N,q){const M=this._scope.toName(m);return N!==void 0&&q&&(this._constants[M.str]=N),this._leafNode(new o(a,M,N)),M}const(a,m,N){return this._def(r.varKinds.const,a,m,N)}let(a,m,N){return this._def(r.varKinds.let,a,m,N)}var(a,m,N){return this._def(r.varKinds.var,a,m,N)}assign(a,m,N){return this._leafNode(new l(a,m,N))}add(a,m){return this._leafNode(new d(a,e.operators.ADD,m))}code(a){return typeof a=="function"?a():a!==t.nil&&this._leafNode(new v(a)),this}object(...a){const m=["{"];for(const[N,q]of a)m.length>1&&m.push(","),m.push(N),(N!==q||this.opts.es5)&&(m.push(":"),(0,t.addCodeArg)(m,q));return m.push("}"),new t._Code(m)}if(a,m,N){if(this._blockNode(new g(a)),m&&N)this.code(m).else().code(N).endIf();else if(m)this.code(m).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new g(a))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(g,_)}_for(a,m){return this._blockNode(a),m&&this.code(m).endFor(),this}for(a,m){return this._for(new O(a),m)}forRange(a,m,N,q,M=this.opts.es5?r.varKinds.var:r.varKinds.let){const J=this._scope.toName(a);return this._for(new j(M,J,m,N),()=>q(J))}forOf(a,m,N,q=r.varKinds.const){const M=this._scope.toName(a);if(this.opts.es5){const J=m instanceof t.Name?m:this.var("_arr",m);return this.forRange("_i",0,(0,t._)`${J}.length`,Q=>{this.var(M,(0,t._)`${J}[${Q}]`),N(M)})}return this._for(new D("of",q,M,m),()=>N(M))}forIn(a,m,N,q=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${m})`,N);const M=this._scope.toName(a);return this._for(new D("in",q,M,m),()=>N(M))}endFor(){return this._endBlockNode(k)}label(a){return this._leafNode(new u(a))}break(a){return this._leafNode(new p(a))}return(a){const m=new C;if(this._blockNode(m),this.code(a),m.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(C)}try(a,m,N){if(!m&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const q=new A;if(this._blockNode(q),this.code(a),m){const M=this.name("e");this._currNode=q.catch=new W(M),m(M)}return N&&(this._currNode=q.finally=new K,this.code(N)),this._endBlockNode(W,K)}throw(a){return this._leafNode(new h(a))}block(a,m){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(m),this}endBlock(a){const m=this._blockStarts.pop();if(m===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-m;if(N<0||a!==void 0&&N!==a)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${a} expected`);return this._nodes.length=m,this}func(a,m=t.nil,N,q){return this._blockNode(new b(a,m,N)),q&&this.code(q).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(a=1){for(;a-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(a){return this._currNode.nodes.push(a),this}_blockNode(a){this._currNode.nodes.push(a),this._nodes.push(a)}_endBlockNode(a,m){const N=this._currNode;if(N instanceof a||m&&N instanceof m)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${m?`${a.kind}/${m.kind}`:a.kind}"`)}_elseNode(a){const m=this._currNode;if(!(m instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=m.else=a,this}get _root(){return this._nodes[0]}get _currNode(){const a=this._nodes;return a[a.length-1]}set _currNode(a){const m=this._nodes;m[m.length-1]=a}}e.CodeGen=ce;function Z(P,a){for(const m in a)P[m]=(P[m]||0)+(a[m]||0);return P}function Re(P,a){return a instanceof t._CodeOrName?Z(P,a.names):P}function he(P,a,m){if(P instanceof t.Name)return N(P);if(!q(P))return P;return new t._Code(P._items.reduce((M,J)=>(J instanceof t.Name&&(J=N(J)),J instanceof t._Code?M.push(...J._items):M.push(J),M),[]));function N(M){const J=m[M.str];return J===void 0||a[M.str]!==1?M:(delete a[M.str],J)}function q(M){return M instanceof t._Code&&M._items.some(J=>J instanceof t.Name&&a[J.str]===1&&m[J.str]!==void 0)}}function at(P,a){for(const m in a)P[m]=(P[m]||0)-(a[m]||0)}function ct(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:(0,t._)`!${I(P)}`}e.not=ct;const Tt=$(e.operators.AND);function Xt(...P){return P.reduce(Tt)}e.and=Xt;const Rt=$(e.operators.OR);function F(...P){return P.reduce(Rt)}e.or=F;function $(P){return(a,m)=>a===t.nil?m:m===t.nil?a:(0,t._)`${I(a)} ${P} ${I(m)}`}function I(P){return P instanceof t.Name?P:(0,t._)`(${P})`}})(G);var re={};(function(e){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;const t=G,r=$r;function n(b){const C={};for(const A of b)C[A]=!0;return C}e.toHash=n;function s(b,C){return typeof C=="boolean"?C:Object.keys(C).length===0?!0:(i(b,C),!o(C,b.self.RULES.all))}e.alwaysValidSchema=s;function i(b,C=b.schema){const{opts:A,self:W}=b;if(!A.strictSchema||typeof C=="boolean")return;const K=W.RULES.keywords;for(const ce in C)K[ce]||D(b,`unknown keyword: "${ce}"`)}e.checkUnknownRules=i;function o(b,C){if(typeof b=="boolean")return!b;for(const A in b)if(C[A])return!0;return!1}e.schemaHasRules=o;function l(b,C){if(typeof b=="boolean")return!b;for(const A in b)if(A!=="$ref"&&C.all[A])return!0;return!1}e.schemaHasRulesButRef=l;function d({topSchemaRef:b,schemaPath:C},A,W,K){if(!K){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,t._)`${A}`}return(0,t._)`${b}${C}${(0,t.getProperty)(W)}`}e.schemaRefOrVal=d;function u(b){return v(decodeURIComponent(b))}e.unescapeFragment=u;function p(b){return encodeURIComponent(h(b))}e.escapeFragment=p;function h(b){return typeof b=="number"?`${b}`:b.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=h;function v(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=v;function T(b,C){if(Array.isArray(b))for(const A of b)C(A);else C(b)}e.eachItem=T;function w({mergeNames:b,mergeToName:C,mergeValues:A,resultToName:W}){return(K,ce,Z,Re)=>{const he=Z===void 0?ce:Z instanceof t.Name?(ce instanceof t.Name?b(K,ce,Z):C(K,ce,Z),Z):ce instanceof t.Name?(C(K,Z,ce),ce):A(ce,Z);return Re===t.Name&&!(he instanceof t.Name)?W(K,he):he}}e.mergeEvaluated={props:w({mergeNames:(b,C,A)=>b.if((0,t._)`${A} !== true && ${C} !== undefined`,()=>{b.if((0,t._)`${C} === true`,()=>b.assign(A,!0),()=>b.assign(A,(0,t._)`${A} || {}`).code((0,t._)`Object.assign(${A}, ${C})`))}),mergeToName:(b,C,A)=>b.if((0,t._)`${A} !== true`,()=>{C===!0?b.assign(A,!0):(b.assign(A,(0,t._)`${A} || {}`),_(b,A,C))}),mergeValues:(b,C)=>b===!0?!0:{...b,...C},resultToName:R}),items:w({mergeNames:(b,C,A)=>b.if((0,t._)`${A} !== true && ${C} !== undefined`,()=>b.assign(A,(0,t._)`${C} === true ? true : ${A} > ${C} ? ${A} : ${C}`)),mergeToName:(b,C,A)=>b.if((0,t._)`${A} !== true`,()=>b.assign(A,C===!0?!0:(0,t._)`${A} > ${C} ? ${A} : ${C}`)),mergeValues:(b,C)=>b===!0?!0:Math.max(b,C),resultToName:(b,C)=>b.var("items",C)})};function R(b,C){if(C===!0)return b.var("props",!0);const A=b.var("props",(0,t._)`{}`);return C!==void 0&&_(b,A,C),A}e.evaluatedPropsToName=R;function _(b,C,A){Object.keys(A).forEach(W=>b.assign((0,t._)`${C}${(0,t.getProperty)(W)}`,!0))}e.setEvaluated=_;const g={};function k(b,C){return b.scopeValue("func",{ref:C,code:g[C.code]||(g[C.code]=new r._Code(C.code))})}e.useFunc=k;var O;(function(b){b[b.Num=0]="Num",b[b.Str=1]="Str"})(O=e.Type||(e.Type={}));function j(b,C,A){if(b instanceof t.Name){const W=C===O.Num;return A?W?(0,t._)`"[" + ${b} + "]"`:(0,t._)`"['" + ${b} + "']"`:W?(0,t._)`"/" + ${b}`:(0,t._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(b).toString():"/"+h(b)}e.getErrorPath=j;function D(b,C,A=b.opts.strictSchema){if(A){if(C=`strict mode: ${C}`,A===!0)throw new Error(C);b.self.logger.warn(C)}}e.checkStrictMode=D})(re);var Ke={};Object.defineProperty(Ke,"__esModule",{value:!0});const ve=G,Tc={data:new ve.Name("data"),valCxt:new ve.Name("valCxt"),instancePath:new ve.Name("instancePath"),parentData:new ve.Name("parentData"),parentDataProperty:new ve.Name("parentDataProperty"),rootData:new ve.Name("rootData"),dynamicAnchors:new ve.Name("dynamicAnchors"),vErrors:new ve.Name("vErrors"),errors:new ve.Name("errors"),this:new ve.Name("this"),self:new ve.Name("self"),scope:new ve.Name("scope"),json:new ve.Name("json"),jsonPos:new ve.Name("jsonPos"),jsonLen:new ve.Name("jsonLen"),jsonPart:new ve.Name("jsonPart")};Ke.default=Tc;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=G,r=re,n=Ke;e.keywordError={message:({keyword:_})=>(0,t.str)`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:g})=>g?(0,t.str)`"${_}" keyword must be ${g} ($data)`:(0,t.str)`"${_}" keyword is invalid ($data)`};function s(_,g=e.keywordError,k,O){const{it:j}=_,{gen:D,compositeRule:b,allErrors:C}=j,A=h(_,g,k);O??(b||C)?d(D,A):u(j,(0,t._)`[${A}]`)}e.reportError=s;function i(_,g=e.keywordError,k){const{it:O}=_,{gen:j,compositeRule:D,allErrors:b}=O,C=h(_,g,k);d(j,C),D||b||u(O,n.default.vErrors)}e.reportExtraError=i;function o(_,g){_.assign(n.default.errors,g),_.if((0,t._)`${n.default.vErrors} !== null`,()=>_.if(g,()=>_.assign((0,t._)`${n.default.vErrors}.length`,g),()=>_.assign(n.default.vErrors,null)))}e.resetErrorsCount=o;function l({gen:_,keyword:g,schemaValue:k,data:O,errsCount:j,it:D}){if(j===void 0)throw new Error("ajv implementation error");const b=_.name("err");_.forRange("i",j,n.default.errors,C=>{_.const(b,(0,t._)`${n.default.vErrors}[${C}]`),_.if((0,t._)`${b}.instancePath === undefined`,()=>_.assign((0,t._)`${b}.instancePath`,(0,t.strConcat)(n.default.instancePath,D.errorPath))),_.assign((0,t._)`${b}.schemaPath`,(0,t.str)`${D.errSchemaPath}/${g}`),D.opts.verbose&&(_.assign((0,t._)`${b}.schema`,k),_.assign((0,t._)`${b}.data`,O))})}e.extendErrors=l;function d(_,g){const k=_.const("err",g);_.if((0,t._)`${n.default.vErrors} === null`,()=>_.assign(n.default.vErrors,(0,t._)`[${k}]`),(0,t._)`${n.default.vErrors}.push(${k})`),_.code((0,t._)`${n.default.errors}++`)}function u(_,g){const{gen:k,validateName:O,schemaEnv:j}=_;j.$async?k.throw((0,t._)`new ${_.ValidationError}(${g})`):(k.assign((0,t._)`${O}.errors`,g),k.return(!1))}const p={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function h(_,g,k){const{createErrors:O}=_.it;return O===!1?(0,t._)`{}`:v(_,g,k)}function v(_,g,k={}){const{gen:O,it:j}=_,D=[T(j,k),w(_,k)];return R(_,g,D),O.object(...D)}function T({errorPath:_},{instancePath:g}){const k=g?(0,t.str)`${_}${(0,r.getErrorPath)(g,r.Type.Str)}`:_;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,k)]}function w({keyword:_,it:{errSchemaPath:g}},{schemaPath:k,parentSchema:O}){let j=O?g:(0,t.str)`${g}/${_}`;return k&&(j=(0,t.str)`${j}${(0,r.getErrorPath)(k,r.Type.Str)}`),[p.schemaPath,j]}function R(_,{params:g,message:k},O){const{keyword:j,data:D,schemaValue:b,it:C}=_,{opts:A,propertyName:W,topSchemaRef:K,schemaPath:ce}=C;O.push([p.keyword,j],[p.params,typeof g=="function"?g(_):g||(0,t._)`{}`]),A.messages&&O.push([p.message,typeof k=="function"?k(_):k]),A.verbose&&O.push([p.schema,b],[p.parentSchema,(0,t._)`${K}${ce}`],[n.default.data,D]),W&&O.push([p.propertyName,W])}})(br);Object.defineProperty(Jt,"__esModule",{value:!0});Jt.boolOrEmptySchema=Jt.topBoolOrEmptySchema=void 0;const Rc=br,kc=G,Oc=Ke,Cc={message:"boolean schema is false"};function Nc(e){const{gen:t,schema:r,validateName:n}=e;r===!1?So(e,!1):typeof r=="object"&&r.$async===!0?t.return(Oc.default.data):(t.assign((0,kc._)`${n}.errors`,null),t.return(!0))}Jt.topBoolOrEmptySchema=Nc;function jc(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),So(e)):r.var(t,!0)}Jt.boolOrEmptySchema=jc;function So(e,t){const{gen:r,data:n}=e,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Rc.reportError)(s,Cc,void 0,t)}var Pr={},Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.getRules=Pt.isJSONType=void 0;const Ic=["string","number","integer","boolean","null","object","array"],Ac=new Set(Ic);function Dc(e){return typeof e=="string"&&Ac.has(e)}Pt.isJSONType=Dc;function Fc(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Pt.getRules=Fc;var Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.shouldUseRule=Qe.shouldUseGroup=Qe.schemaHasRulesForType=void 0;function qc({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&To(e,n)}Qe.schemaHasRulesForType=qc;function To(e,t){return t.rules.some(r=>Ro(e,r))}Qe.shouldUseGroup=To;function Ro(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Qe.shouldUseRule=Ro;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=Pt,r=Qe,n=br,s=G,i=re;var o;(function(O){O[O.Correct=0]="Correct",O[O.Wrong=1]="Wrong"})(o=e.DataType||(e.DataType={}));function l(O){const j=d(O.type);if(j.includes("null")){if(O.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!j.length&&O.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');O.nullable===!0&&j.push("null")}return j}e.getSchemaTypes=l;function d(O){const j=Array.isArray(O)?O:O?[O]:[];if(j.every(t.isJSONType))return j;throw new Error("type must be JSONType or JSONType[]: "+j.join(","))}e.getJSONTypes=d;function u(O,j){const{gen:D,data:b,opts:C}=O,A=h(j,C.coerceTypes),W=j.length>0&&!(A.length===0&&j.length===1&&(0,r.schemaHasRulesForType)(O,j[0]));if(W){const K=R(j,b,C.strictNumbers,o.Wrong);D.if(K,()=>{A.length?v(O,j,A):g(O)})}return W}e.coerceAndCheckDataType=u;const p=new Set(["string","number","integer","boolean","null"]);function h(O,j){return j?O.filter(D=>p.has(D)||j==="array"&&D==="array"):[]}function v(O,j,D){const{gen:b,data:C,opts:A}=O,W=b.let("dataType",(0,s._)`typeof ${C}`),K=b.let("coerced",(0,s._)`undefined`);A.coerceTypes==="array"&&b.if((0,s._)`${W} == 'object' && Array.isArray(${C}) && ${C}.length == 1`,()=>b.assign(C,(0,s._)`${C}[0]`).assign(W,(0,s._)`typeof ${C}`).if(R(j,C,A.strictNumbers),()=>b.assign(K,C))),b.if((0,s._)`${K} !== undefined`);for(const Z of D)(p.has(Z)||Z==="array"&&A.coerceTypes==="array")&&ce(Z);b.else(),g(O),b.endIf(),b.if((0,s._)`${K} !== undefined`,()=>{b.assign(C,K),T(O,K)});function ce(Z){switch(Z){case"string":b.elseIf((0,s._)`${W} == "number" || ${W} == "boolean"`).assign(K,(0,s._)`"" + ${C}`).elseIf((0,s._)`${C} === null`).assign(K,(0,s._)`""`);return;case"number":b.elseIf((0,s._)`${W} == "boolean" || ${C} === null
|
|
853
|
-
|| (${
|
|
854
|
-
|| (${
|
|
855
|
-
|| ${W} === "boolean" || ${C} === null`).assign(K,(0,s._)`[${C}]`)}}}function T({gen:O,parentData:j,parentDataProperty:D},b){O.if((0,s._)`${j} !== undefined`,()=>O.assign((0,s._)`${j}[${D}]`,b))}function w(O,j,D,b=o.Correct){const C=b===o.Correct?s.operators.EQ:s.operators.NEQ;let A;switch(O){case"null":return(0,s._)`${j} ${C} null`;case"array":A=(0,s._)`Array.isArray(${j})`;break;case"object":A=(0,s._)`${j} && typeof ${j} == "object" && !Array.isArray(${j})`;break;case"integer":A=W((0,s._)`!(${j} % 1) && !isNaN(${j})`);break;case"number":A=W();break;default:return(0,s._)`typeof ${j} ${C} ${O}`}return b===o.Correct?A:(0,s.not)(A);function W(K=s.nil){return(0,s.and)((0,s._)`typeof ${j} == "number"`,K,D?(0,s._)`isFinite(${j})`:s.nil)}}e.checkDataType=w;function R(O,j,D,b){if(O.length===1)return w(O[0],j,D,b);let C;const A=(0,i.toHash)(O);if(A.array&&A.object){const W=(0,s._)`typeof ${j} != "object"`;C=A.null?W:(0,s._)`!${j} || ${W}`,delete A.null,delete A.array,delete A.object}else C=s.nil;A.number&&delete A.integer;for(const W in A)C=(0,s.and)(C,w(W,j,D,b));return C}e.checkDataTypes=R;const _={message:({schema:O})=>`must be ${O}`,params:({schema:O,schemaValue:j})=>typeof O=="string"?(0,s._)`{type: ${O}}`:(0,s._)`{type: ${j}}`};function g(O){const j=k(O);(0,n.reportError)(j,_)}e.reportTypeError=g;function k(O){const{gen:j,data:D,schema:b}=O,C=(0,i.schemaRefOrVal)(O,b,"type");return{gen:j,keyword:"type",data:D,schema:b.type,schemaCode:C,schemaValue:C,parentSchema:b,params:{},it:O}}})(Pr);var _n={};Object.defineProperty(_n,"__esModule",{value:!0});_n.assignDefaults=void 0;const Ft=G,Mc=re;function Uc(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)oi(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,i)=>oi(e,i,s.default))}_n.assignDefaults=Uc;function oi(e,t,r){const{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;const l=(0,Ft._)`${i}${(0,Ft.getProperty)(t)}`;if(s){(0,Mc.checkStrictMode)(e,`default is ignored for: ${l}`);return}let d=(0,Ft._)`${l} === undefined`;o.useDefaults==="empty"&&(d=(0,Ft._)`${d} || ${l} === null || ${l} === ""`),n.if(d,(0,Ft._)`${l} = ${(0,Ft.stringify)(r)}`)}var We={},B={};Object.defineProperty(B,"__esModule",{value:!0});B.validateUnion=B.validateArray=B.usePattern=B.callValidateCode=B.schemaProperties=B.allSchemaProperties=B.noPropertyInData=B.propertyInData=B.isOwnProperty=B.hasPropFunc=B.reportMissingProp=B.checkMissingProp=B.checkReportMissingProp=void 0;const ie=G,Yn=re,tt=Ke,Lc=re;function Hc(e,t){const{gen:r,data:n,it:s}=e;r.if(Zn(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ie._)`${t}`},!0),e.error()})}B.checkReportMissingProp=Hc;function zc({gen:e,data:t,it:{opts:r}},n,s){return(0,ie.or)(...n.map(i=>(0,ie.and)(Zn(e,t,i,r.ownProperties),(0,ie._)`${s} = ${i}`)))}B.checkMissingProp=zc;function Vc(e,t){e.setParams({missingProperty:t},!0),e.error()}B.reportMissingProp=Vc;function ko(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ie._)`Object.prototype.hasOwnProperty`})}B.hasPropFunc=ko;function Qn(e,t,r){return(0,ie._)`${ko(e)}.call(${t}, ${r})`}B.isOwnProperty=Qn;function Wc(e,t,r,n){const s=(0,ie._)`${t}${(0,ie.getProperty)(r)} !== undefined`;return n?(0,ie._)`${s} && ${Qn(e,t,r)}`:s}B.propertyInData=Wc;function Zn(e,t,r,n){const s=(0,ie._)`${t}${(0,ie.getProperty)(r)} === undefined`;return n?(0,ie.or)(s,(0,ie.not)(Qn(e,t,r))):s}B.noPropertyInData=Zn;function Oo(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}B.allSchemaProperties=Oo;function xc(e,t){return Oo(t).filter(r=>!(0,Yn.alwaysValidSchema)(e,t[r]))}B.schemaProperties=xc;function Bc({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},l,d,u){const p=u?(0,ie._)`${e}, ${t}, ${n}${s}`:t,h=[[tt.default.instancePath,(0,ie.strConcat)(tt.default.instancePath,i)],[tt.default.parentData,o.parentData],[tt.default.parentDataProperty,o.parentDataProperty],[tt.default.rootData,tt.default.rootData]];o.opts.dynamicRef&&h.push([tt.default.dynamicAnchors,tt.default.dynamicAnchors]);const v=(0,ie._)`${p}, ${r.object(...h)}`;return d!==ie.nil?(0,ie._)`${l}.call(${d}, ${v})`:(0,ie._)`${l}(${v})`}B.callValidateCode=Bc;const Gc=(0,ie._)`new RegExp`;function Kc({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ie._)`${s.code==="new RegExp"?Gc:(0,Lc.useFunc)(e,s)}(${r}, ${n})`})}B.usePattern=Kc;function Jc(e){const{gen:t,data:r,keyword:n,it:s}=e,i=t.name("valid");if(s.allErrors){const l=t.let("valid",!0);return o(()=>t.assign(l,!1)),l}return t.var(i,!0),o(()=>t.break()),i;function o(l){const d=t.const("len",(0,ie._)`${r}.length`);t.forRange("i",0,d,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Yn.Type.Num},i),t.if((0,ie.not)(i),l)})}}B.validateArray=Jc;function Yc(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(d=>(0,Yn.alwaysValidSchema)(s,d))&&!s.opts.unevaluated)return;const o=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((d,u)=>{const p=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},l);t.assign(o,(0,ie._)`${o} || ${l}`),e.mergeValidEvaluated(p,l)||t.if((0,ie.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}B.validateUnion=Yc;Object.defineProperty(We,"__esModule",{value:!0});We.validateKeywordUsage=We.validSchemaType=We.funcKeywordCode=We.macroKeywordCode=void 0;const be=G,ht=Ke,Qc=B,Zc=br;function Xc(e,t){const{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,l=t.macro.call(o.self,s,i,o),d=Co(r,n,l);o.opts.validateSchema!==!1&&o.self.validateSchema(l,!0);const u=r.name("valid");e.subschema({schema:l,schemaPath:be.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:d,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}We.macroKeywordCode=Xc;function el(e,t){var r;const{gen:n,keyword:s,schema:i,parentSchema:o,$data:l,it:d}=e;rl(d,t);const u=!l&&t.compile?t.compile.call(d.self,i,o,d):t.validate,p=Co(n,s,u),h=n.let("valid");e.block$data(h,v),e.ok((r=t.valid)!==null&&r!==void 0?r:h);function v(){if(t.errors===!1)R(),t.modifying&&ai(e),_(()=>e.error());else{const g=t.async?T():w();t.modifying&&ai(e),_(()=>tl(e,g))}}function T(){const g=n.let("ruleErrs",null);return n.try(()=>R((0,be._)`await `),k=>n.assign(h,!1).if((0,be._)`${k} instanceof ${d.ValidationError}`,()=>n.assign(g,(0,be._)`${k}.errors`),()=>n.throw(k))),g}function w(){const g=(0,be._)`${p}.errors`;return n.assign(g,null),R(be.nil),g}function R(g=t.async?(0,be._)`await `:be.nil){const k=d.opts.passContext?ht.default.this:ht.default.self,O=!("compile"in t&&!l||t.schema===!1);n.assign(h,(0,be._)`${g}${(0,Qc.callValidateCode)(e,p,k,O)}`,t.modifying)}function _(g){var k;n.if((0,be.not)((k=t.valid)!==null&&k!==void 0?k:h),g)}}We.funcKeywordCode=el;function ai(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,be._)`${n.parentData}[${n.parentDataProperty}]`))}function tl(e,t){const{gen:r}=e;r.if((0,be._)`Array.isArray(${t})`,()=>{r.assign(ht.default.vErrors,(0,be._)`${ht.default.vErrors} === null ? ${t} : ${ht.default.vErrors}.concat(${t})`).assign(ht.default.errors,(0,be._)`${ht.default.vErrors}.length`),(0,Zc.extendErrors)(e)},()=>e.error())}function rl({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Co(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,be.stringify)(r)})}function nl(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}We.validSchemaType=nl;function sl({schema:e,opts:t,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw new Error("ajv implementation error");const o=s.dependencies;if(o!=null&&o.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[i])){const d=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(d);else throw new Error(d)}}We.validateKeywordUsage=sl;var ot={};Object.defineProperty(ot,"__esModule",{value:!0});ot.extendSubschemaMode=ot.extendSubschemaData=ot.getSubschema=void 0;const Ve=G,No=re;function il(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const l=e.schema[t];return r===void 0?{schema:l,schemaPath:(0,Ve._)`${e.schemaPath}${(0,Ve.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:l[r],schemaPath:(0,Ve._)`${e.schemaPath}${(0,Ve.getProperty)(t)}${(0,Ve.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,No.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}ot.getSubschema=il;function ol(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(r!==void 0){const{errorPath:u,dataPathArr:p,opts:h}=t,v=l.let("data",(0,Ve._)`${t.data}${(0,Ve.getProperty)(r)}`,!0);d(v),e.errorPath=(0,Ve.str)`${u}${(0,No.getErrorPath)(r,n,h.jsPropertySyntax)}`,e.parentDataProperty=(0,Ve._)`${r}`,e.dataPathArr=[...p,e.parentDataProperty]}if(s!==void 0){const u=s instanceof Ve.Name?s:l.let("data",s,!0);d(u),o!==void 0&&(e.propertyName=o)}i&&(e.dataTypes=i);function d(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}ot.extendSubschemaData=ol;function al(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}ot.extendSubschemaMode=al;var $e={},jo=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r},Io={exports:{}},it=Io.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Mr(t,n,s,e,"",e)};it.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};it.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};it.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};it.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Mr(e,t,r,n,s,i,o,l,d,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,l,d,u);for(var p in n){var h=n[p];if(Array.isArray(h)){if(p in it.arrayKeywords)for(var v=0;v<h.length;v++)Mr(e,t,r,h[v],s+"/"+p+"/"+v,i,s,p,n,v)}else if(p in it.propsKeywords){if(h&&typeof h=="object")for(var T in h)Mr(e,t,r,h[T],s+"/"+p+"/"+cl(T),i,s,p,n,T)}else(p in it.keywords||e.allKeys&&!(p in it.skipKeywords))&&Mr(e,t,r,h,s+"/"+p,i,s,p,n)}r(n,s,i,o,l,d,u)}}function cl(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var ll=Io.exports;Object.defineProperty($e,"__esModule",{value:!0});$e.getSchemaRefs=$e.resolveUrl=$e.normalizeId=$e._getFullPath=$e.getFullPath=$e.inlineRef=void 0;const ul=re,dl=jo,pl=ll,fl=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function hl(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Fn(e):t?Ao(e)<=t:!1}$e.inlineRef=hl;const ml=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Fn(e){for(const t in e){if(ml.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(Fn)||typeof r=="object"&&Fn(r))return!0}return!1}function Ao(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!fl.has(r)&&(typeof e[r]=="object"&&(0,ul.eachItem)(e[r],n=>t+=Ao(n)),t===1/0))return 1/0}return t}function Do(e,t="",r){r!==!1&&(t=Ht(t));const n=e.parse(t);return Fo(e,n)}$e.getFullPath=Do;function Fo(e,t){return e.serialize(t).split("#")[0]+"#"}$e._getFullPath=Fo;const yl=/#\/?$/;function Ht(e){return e?e.replace(yl,""):""}$e.normalizeId=Ht;function gl(e,t,r){return r=Ht(r),e.resolve(t,r)}$e.resolveUrl=gl;const $l=/^[a-z_][-a-z0-9._]*$/i;function _l(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Ht(e[r]||t),i={"":s},o=Do(n,s,!1),l={},d=new Set;return pl(e,{allKeys:!0},(h,v,T,w)=>{if(w===void 0)return;const R=o+v;let _=i[w];typeof h[r]=="string"&&(_=g.call(this,h[r])),k.call(this,h.$anchor),k.call(this,h.$dynamicAnchor),i[v]=_;function g(O){const j=this.opts.uriResolver.resolve;if(O=Ht(_?j(_,O):O),d.has(O))throw p(O);d.add(O);let D=this.refs[O];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?u(h,D.schema,O):O!==Ht(R)&&(O[0]==="#"?(u(h,l[O],O),l[O]=h):this.refs[O]=R),O}function k(O){if(typeof O=="string"){if(!$l.test(O))throw new Error(`invalid anchor "${O}"`);g.call(this,`#${O}`)}}}),l;function u(h,v,T){if(v!==void 0&&!dl(h,v))throw p(T)}function p(h){return new Error(`reference "${h}" resolves to more than one schema`)}}$e.getSchemaRefs=_l;Object.defineProperty(Ae,"__esModule",{value:!0});Ae.getData=Ae.KeywordCxt=Ae.validateFunctionCode=void 0;const qo=Jt,ci=Pr,Xn=Qe,xr=Pr,wl=_n,pr=We,Rn=ot,U=G,V=Ke,vl=$e,Ze=re,lr=br;function bl(e){if(Lo(e)&&(Ho(e),Uo(e))){Sl(e);return}Mo(e,()=>(0,qo.topBoolOrEmptySchema)(e))}Ae.validateFunctionCode=bl;function Mo({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){s.code.es5?e.func(t,(0,U._)`${V.default.data}, ${V.default.valCxt}`,n.$async,()=>{e.code((0,U._)`"use strict"; ${li(r,s)}`),El(e,s),e.code(i)}):e.func(t,(0,U._)`${V.default.data}, ${Pl(s)}`,n.$async,()=>e.code(li(r,s)).code(i))}function Pl(e){return(0,U._)`{${V.default.instancePath}="", ${V.default.parentData}, ${V.default.parentDataProperty}, ${V.default.rootData}=${V.default.data}${e.dynamicRef?(0,U._)`, ${V.default.dynamicAnchors}={}`:U.nil}}={}`}function El(e,t){e.if(V.default.valCxt,()=>{e.var(V.default.instancePath,(0,U._)`${V.default.valCxt}.${V.default.instancePath}`),e.var(V.default.parentData,(0,U._)`${V.default.valCxt}.${V.default.parentData}`),e.var(V.default.parentDataProperty,(0,U._)`${V.default.valCxt}.${V.default.parentDataProperty}`),e.var(V.default.rootData,(0,U._)`${V.default.valCxt}.${V.default.rootData}`),t.dynamicRef&&e.var(V.default.dynamicAnchors,(0,U._)`${V.default.valCxt}.${V.default.dynamicAnchors}`)},()=>{e.var(V.default.instancePath,(0,U._)`""`),e.var(V.default.parentData,(0,U._)`undefined`),e.var(V.default.parentDataProperty,(0,U._)`undefined`),e.var(V.default.rootData,V.default.data),t.dynamicRef&&e.var(V.default.dynamicAnchors,(0,U._)`{}`)})}function Sl(e){const{schema:t,opts:r,gen:n}=e;Mo(e,()=>{r.$comment&&t.$comment&&Vo(e),Cl(e),n.let(V.default.vErrors,null),n.let(V.default.errors,0),r.unevaluated&&Tl(e),zo(e),Il(e)})}function Tl(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,U._)`${r}.evaluated`),t.if((0,U._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,U._)`${e.evaluated}.props`,(0,U._)`undefined`)),t.if((0,U._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,U._)`${e.evaluated}.items`,(0,U._)`undefined`))}function li(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,U._)`/*# sourceURL=${r} */`:U.nil}function Rl(e,t){if(Lo(e)&&(Ho(e),Uo(e))){kl(e,t);return}(0,qo.boolOrEmptySchema)(e,t)}function Uo({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function Lo(e){return typeof e.schema!="boolean"}function kl(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&Vo(e),Nl(e),jl(e);const i=n.const("_errs",V.default.errors);zo(e,i),n.var(t,(0,U._)`${i} === ${V.default.errors}`)}function Ho(e){(0,Ze.checkUnknownRules)(e),Ol(e)}function zo(e,t){if(e.opts.jtd)return ui(e,[],!1,t);const r=(0,ci.getSchemaTypes)(e.schema),n=(0,ci.coerceAndCheckDataType)(e,r);ui(e,r,!n,t)}function Ol(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ze.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Cl(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ze.checkStrictMode)(e,"default is ignored in the schema root")}function Nl(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,vl.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function jl(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Vo({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const i=r.$comment;if(s.$comment===!0)e.code((0,U._)`${V.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){const o=(0,U.str)`${n}/$comment`,l=e.scopeValue("root",{ref:t.root});e.code((0,U._)`${V.default.self}.opts.$comment(${i}, ${o}, ${l}.schema)`)}}function Il(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;r.$async?t.if((0,U._)`${V.default.errors} === 0`,()=>t.return(V.default.data),()=>t.throw((0,U._)`new ${s}(${V.default.vErrors})`)):(t.assign((0,U._)`${n}.errors`,V.default.vErrors),i.unevaluated&&Al(e),t.return((0,U._)`${V.default.errors} === 0`))}function Al({gen:e,evaluated:t,props:r,items:n}){r instanceof U.Name&&e.assign((0,U._)`${t}.props`,r),n instanceof U.Name&&e.assign((0,U._)`${t}.items`,n)}function ui(e,t,r,n){const{gen:s,schema:i,data:o,allErrors:l,opts:d,self:u}=e,{RULES:p}=u;if(i.$ref&&(d.ignoreKeywordsWithRef||!(0,Ze.schemaHasRulesButRef)(i,p))){s.block(()=>Bo(e,"$ref",p.all.$ref.definition));return}d.jtd||Dl(e,t),s.block(()=>{for(const v of p.rules)h(v);h(p.post)});function h(v){(0,Xn.shouldUseGroup)(i,v)&&(v.type?(s.if((0,xr.checkDataType)(v.type,o,d.strictNumbers)),di(e,v),t.length===1&&t[0]===v.type&&r&&(s.else(),(0,xr.reportTypeError)(e)),s.endIf()):di(e,v),l||s.if((0,U._)`${V.default.errors} === ${n||0}`))}}function di(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,wl.assignDefaults)(e,t.type),r.block(()=>{for(const i of t.rules)(0,Xn.shouldUseRule)(n,i)&&Bo(e,i.keyword,i.definition,t.type)})}function Dl(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Fl(e,t),e.opts.allowUnionTypes||ql(e,t),Ml(e,e.dataTypes))}function Fl(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Wo(e.dataTypes,r)||es(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Ll(e,t)}}function ql(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&es(e,"use allowUnionTypes to allow union type keyword")}function Ml(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,Xn.shouldUseRule)(e.schema,s)){const{type:i}=s.definition;i.length&&!i.some(o=>Ul(t,o))&&es(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function Ul(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Wo(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Ll(e,t){const r=[];for(const n of e.dataTypes)Wo(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function es(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ze.checkStrictMode)(e,t,e.opts.strictTypes)}class xo{constructor(t,r,n){if((0,pr.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ze.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Go(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,pr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",V.default.errors))}result(t,r,n){this.failResult((0,U.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,U.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:r}=this;this.fail((0,U._)`${r} !== undefined && (${(0,U.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?lr.reportExtraError:lr.reportError)(this,this.def.error,r)}$dataError(){(0,lr.reportError)(this,this.def.$dataError||lr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,lr.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=U.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=U.nil,r=U.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:i,def:o}=this;n.if((0,U.or)((0,U._)`${s} === undefined`,r)),t!==U.nil&&n.assign(t,!0),(i.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==U.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:i}=this;return(0,U.or)(o(),l());function o(){if(n.length){if(!(r instanceof U.Name))throw new Error("ajv implementation error");const d=Array.isArray(n)?n:[n];return(0,U._)`${(0,xr.checkDataTypes)(d,r,i.opts.strictNumbers,xr.DataType.Wrong)}`}return U.nil}function l(){if(s.validateSchema){const d=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,U._)`!${d}(${r})`}return U.nil}}subschema(t,r){const n=(0,Rn.getSubschema)(this.it,t);(0,Rn.extendSubschemaData)(n,this.it,t),(0,Rn.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return Rl(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ze.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ze.mergeEvaluated.items(s,t.items,n.items,r)))}mergeValidEvaluated(t,r){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(t,U.Name)),!0}}Ae.KeywordCxt=xo;function Bo(e,t,r,n){const s=new xo(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,pr.funcKeywordCode)(s,r):"macro"in r?(0,pr.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,pr.funcKeywordCode)(s,r)}const Hl=/^\/(?:[^~]|~0|~1)*$/,zl=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Go(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return V.default.rootData;if(e[0]==="/"){if(!Hl.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,i=V.default.rootData}else{const u=zl.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const p=+u[1];if(s=u[2],s==="#"){if(p>=t)throw new Error(d("property/index",p));return n[t-p]}if(p>t)throw new Error(d("data",p));if(i=r[t-p],!s)return i}let o=i;const l=s.split("/");for(const u of l)u&&(i=(0,U._)`${i}${(0,U.getProperty)((0,Ze.unescapeJsonPointer)(u))}`,o=(0,U._)`${o} && ${i}`);return o;function d(u,p){return`Cannot access ${u} ${p} levels up, current level is ${t}`}}Ae.getData=Go;var Er={};Object.defineProperty(Er,"__esModule",{value:!0});class Vl extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}Er.default=Vl;var Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});const kn=$e;class Wl extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,kn.resolveUrl)(t,r,n),this.missingSchema=(0,kn.normalizeId)((0,kn.getFullPath)(t,this.missingRef))}}Sr.default=Wl;var Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.resolveSchema=Se.getCompilingSchema=Se.resolveRef=Se.compileSchema=Se.SchemaEnv=void 0;const Ne=G,xl=Er,ft=Ke,Ie=$e,pi=re,Bl=Ae;class wn{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Ie.normalizeId)(n==null?void 0:n[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n==null?void 0:n.$async,this.refs={}}}Se.SchemaEnv=wn;function ts(e){const t=Ko.call(this,e);if(t)return t;const r=(0,Ie.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new Ne.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let l;e.$async&&(l=o.scopeValue("Error",{ref:xl.default,code:(0,Ne._)`require("ajv/dist/runtime/validation_error").default`}));const d=o.scopeName("validate");e.validateName=d;const u={gen:o,allErrors:this.opts.allErrors,data:ft.default.data,parentData:ft.default.parentData,parentDataProperty:ft.default.parentDataProperty,dataNames:[ft.default.data],dataPathArr:[Ne.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Ne.stringify)(e.schema)}:{ref:e.schema}),validateName:d,ValidationError:l,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Ne.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ne._)`""`,opts:this.opts,self:this};let p;try{this._compilations.add(e),(0,Bl.validateFunctionCode)(u),o.optimize(this.opts.code.optimize);const h=o.toString();p=`${o.scopeRefs(ft.default.scope)}return ${h}`,this.opts.code.process&&(p=this.opts.code.process(p,e));const T=new Function(`${ft.default.self}`,`${ft.default.scope}`,p)(this,this.scope.get());if(this.scope.value(d,{ref:T}),T.errors=null,T.schema=e.schema,T.schemaEnv=e,e.$async&&(T.$async=!0),this.opts.code.source===!0&&(T.source={validateName:d,validateCode:h,scopeValues:o._values}),this.opts.unevaluated){const{props:w,items:R}=u;T.evaluated={props:w instanceof Ne.Name?void 0:w,items:R instanceof Ne.Name?void 0:R,dynamicProps:w instanceof Ne.Name,dynamicItems:R instanceof Ne.Name},T.source&&(T.source.evaluated=(0,Ne.stringify)(T.evaluated))}return e.validate=T,e}catch(h){throw delete e.validate,delete e.validateName,p&&this.logger.error("Error compiling schema, function code:",p),h}finally{this._compilations.delete(e)}}Se.compileSchema=ts;function Gl(e,t,r){var n;r=(0,Ie.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let i=Yl.call(this,e,r);if(i===void 0){const o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;o&&(i=new wn({schema:o,schemaId:l,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=Kl.call(this,i)}Se.resolveRef=Gl;function Kl(e){return(0,Ie.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ts.call(this,e)}function Ko(e){for(const t of this._compilations)if(Jl(t,e))return t}Se.getCompilingSchema=Ko;function Jl(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Yl(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||vn.call(this,e,t)}function vn(e,t){const r=this.opts.uriResolver.parse(t),n=(0,Ie._getFullPath)(this.opts.uriResolver,r);let s=(0,Ie.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return On.call(this,r,e);const i=(0,Ie.normalizeId)(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){const l=vn.call(this,e,o);return typeof(l==null?void 0:l.schema)!="object"?void 0:On.call(this,r,l)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||ts.call(this,o),i===(0,Ie.normalizeId)(t)){const{schema:l}=o,{schemaId:d}=this.opts,u=l[d];return u&&(s=(0,Ie.resolveUrl)(this.opts.uriResolver,s,u)),new wn({schema:l,schemaId:d,root:e,baseId:s})}return On.call(this,r,o)}}Se.resolveSchema=vn;const Ql=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function On(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const l of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const d=r[(0,pi.unescapeFragment)(l)];if(d===void 0)return;r=d;const u=typeof r=="object"&&r[this.opts.schemaId];!Ql.has(l)&&u&&(t=(0,Ie.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,pi.schemaHasRulesButRef)(r,this.RULES)){const l=(0,Ie.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=vn.call(this,n,l)}const{schemaId:o}=this.opts;if(i=i||new wn({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i}const Zl="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Xl="Meta-schema for $data reference (JSON AnySchema extension proposal)",eu="object",tu=["$data"],ru={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},nu=!1,su={$id:Zl,description:Xl,type:eu,required:tu,properties:ru,additionalProperties:nu};var rs={},qn={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(e,t){(function(r,n){n(t)})(Ec,function(r){function n(){for(var f=arguments.length,c=Array(f),y=0;y<f;y++)c[y]=arguments[y];if(c.length>1){c[0]=c[0].slice(0,-1);for(var S=c.length-1,E=1;E<S;++E)c[E]=c[E].slice(1,-1);return c[S]=c[S].slice(1),c.join("")}else return c[0]}function s(f){return"(?:"+f+")"}function i(f){return f===void 0?"undefined":f===null?"null":Object.prototype.toString.call(f).split(" ").pop().split("]").shift().toLowerCase()}function o(f){return f.toUpperCase()}function l(f){return f!=null?f instanceof Array?f:typeof f.length!="number"||f.split||f.setInterval||f.call?[f]:Array.prototype.slice.call(f):[]}function d(f,c){var y=f;if(c)for(var S in c)y[S]=c[S];return y}function u(f){var c="[A-Za-z]",y="[0-9]",S=n(y,"[A-Fa-f]"),E=s(s("%[EFef]"+S+"%"+S+S+"%"+S+S)+"|"+s("%[89A-Fa-f]"+S+"%"+S+S)+"|"+s("%"+S+S)),L="[\\:\\/\\?\\#\\[\\]\\@]",H="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",X=n(L,H),se=f?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",ue=f?"[\\uE000-\\uF8FF]":"[]",Y=n(c,y,"[\\-\\.\\_\\~]",se);s(c+n(c,y,"[\\+\\-\\.]")+"*"),s(s(E+"|"+n(Y,H,"[\\:]"))+"*");var ne=s(s("25[0-5]")+"|"+s("2[0-4]"+y)+"|"+s("1"+y+y)+"|"+s("0?[1-9]"+y)+"|0?0?"+y),de=s(ne+"\\."+ne+"\\."+ne+"\\."+ne),x=s(S+"{1,4}"),oe=s(s(x+"\\:"+x)+"|"+de),me=s(s(x+"\\:")+"{6}"+oe),ae=s("\\:\\:"+s(x+"\\:")+"{5}"+oe),Xe=s(s(x)+"?\\:\\:"+s(x+"\\:")+"{4}"+oe),Me=s(s(s(x+"\\:")+"{0,1}"+x)+"?\\:\\:"+s(x+"\\:")+"{3}"+oe),Ue=s(s(s(x+"\\:")+"{0,2}"+x)+"?\\:\\:"+s(x+"\\:")+"{2}"+oe),At=s(s(s(x+"\\:")+"{0,3}"+x)+"?\\:\\:"+x+"\\:"+oe),dt=s(s(s(x+"\\:")+"{0,4}"+x)+"?\\:\\:"+oe),Oe=s(s(s(x+"\\:")+"{0,5}"+x)+"?\\:\\:"+x),Le=s(s(s(x+"\\:")+"{0,6}"+x)+"?\\:\\:"),pt=s([me,ae,Xe,Me,Ue,At,dt,Oe,Le].join("|")),Je=s(s(Y+"|"+E)+"+");s("[vV]"+S+"+\\."+n(Y,H,"[\\:]")+"+"),s(s(E+"|"+n(Y,H))+"*");var ar=s(E+"|"+n(Y,H,"[\\:\\@]"));return s(s(E+"|"+n(Y,H,"[\\@]"))+"+"),s(s(ar+"|"+n("[\\/\\?]",ue))+"*"),{NOT_SCHEME:new RegExp(n("[^]",c,y,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",Y,H),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",Y,H),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",Y,H),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",Y,H),"g"),NOT_QUERY:new RegExp(n("[^\\%]",Y,H,"[\\:\\@\\/\\?]",ue),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",Y,H,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",Y,H),"g"),UNRESERVED:new RegExp(Y,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",Y,X),"g"),PCT_ENCODED:new RegExp(E,"g"),IPV4ADDRESS:new RegExp("^("+de+")$"),IPV6ADDRESS:new RegExp("^\\[?("+pt+")"+s(s("\\%25|\\%(?!"+S+"{2})")+"("+Je+")")+"?\\]?$")}}var p=u(!1),h=u(!0),v=function(){function f(c,y){var S=[],E=!0,L=!1,H=void 0;try{for(var X=c[Symbol.iterator](),se;!(E=(se=X.next()).done)&&(S.push(se.value),!(y&&S.length===y));E=!0);}catch(ue){L=!0,H=ue}finally{try{!E&&X.return&&X.return()}finally{if(L)throw H}}return S}return function(c,y){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return f(c,y);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),T=function(f){if(Array.isArray(f)){for(var c=0,y=Array(f.length);c<f.length;c++)y[c]=f[c];return y}else return Array.from(f)},w=2147483647,R=36,_=1,g=26,k=38,O=700,j=72,D=128,b="-",C=/^xn--/,A=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,K={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ce=R-_,Z=Math.floor,Re=String.fromCharCode;function he(f){throw new RangeError(K[f])}function at(f,c){for(var y=[],S=f.length;S--;)y[S]=c(f[S]);return y}function ct(f,c){var y=f.split("@"),S="";y.length>1&&(S=y[0]+"@",f=y[1]),f=f.replace(W,".");var E=f.split("."),L=at(E,c).join(".");return S+L}function Tt(f){for(var c=[],y=0,S=f.length;y<S;){var E=f.charCodeAt(y++);if(E>=55296&&E<=56319&&y<S){var L=f.charCodeAt(y++);(L&64512)==56320?c.push(((E&1023)<<10)+(L&1023)+65536):(c.push(E),y--)}else c.push(E)}return c}var Xt=function(c){return String.fromCodePoint.apply(String,T(c))},Rt=function(c){return c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:R},F=function(c,y){return c+22+75*(c<26)-((y!=0)<<5)},$=function(c,y,S){var E=0;for(c=S?Z(c/O):c>>1,c+=Z(c/y);c>ce*g>>1;E+=R)c=Z(c/ce);return Z(E+(ce+1)*c/(c+k))},I=function(c){var y=[],S=c.length,E=0,L=D,H=j,X=c.lastIndexOf(b);X<0&&(X=0);for(var se=0;se<X;++se)c.charCodeAt(se)>=128&&he("not-basic"),y.push(c.charCodeAt(se));for(var ue=X>0?X+1:0;ue<S;){for(var Y=E,ne=1,de=R;;de+=R){ue>=S&&he("invalid-input");var x=Rt(c.charCodeAt(ue++));(x>=R||x>Z((w-E)/ne))&&he("overflow"),E+=x*ne;var oe=de<=H?_:de>=H+g?g:de-H;if(x<oe)break;var me=R-oe;ne>Z(w/me)&&he("overflow"),ne*=me}var ae=y.length+1;H=$(E-Y,ae,Y==0),Z(E/ae)>w-L&&he("overflow"),L+=Z(E/ae),E%=ae,y.splice(E++,0,L)}return String.fromCodePoint.apply(String,y)},P=function(c){var y=[];c=Tt(c);var S=c.length,E=D,L=0,H=j,X=!0,se=!1,ue=void 0;try{for(var Y=c[Symbol.iterator](),ne;!(X=(ne=Y.next()).done);X=!0){var de=ne.value;de<128&&y.push(Re(de))}}catch(cr){se=!0,ue=cr}finally{try{!X&&Y.return&&Y.return()}finally{if(se)throw ue}}var x=y.length,oe=x;for(x&&y.push(b);oe<S;){var me=w,ae=!0,Xe=!1,Me=void 0;try{for(var Ue=c[Symbol.iterator](),At;!(ae=(At=Ue.next()).done);ae=!0){var dt=At.value;dt>=E&&dt<me&&(me=dt)}}catch(cr){Xe=!0,Me=cr}finally{try{!ae&&Ue.return&&Ue.return()}finally{if(Xe)throw Me}}var Oe=oe+1;me-E>Z((w-L)/Oe)&&he("overflow"),L+=(me-E)*Oe,E=me;var Le=!0,pt=!1,Je=void 0;try{for(var ar=c[Symbol.iterator](),Ws;!(Le=(Ws=ar.next()).done);Le=!0){var xs=Ws.value;if(xs<E&&++L>w&&he("overflow"),xs==E){for(var kr=L,Or=R;;Or+=R){var Cr=Or<=H?_:Or>=H+g?g:Or-H;if(kr<Cr)break;var Bs=kr-Cr,Gs=R-Cr;y.push(Re(F(Cr+Bs%Gs,0))),kr=Z(Bs/Gs)}y.push(Re(F(kr,0))),H=$(L,Oe,oe==x),L=0,++oe}}}catch(cr){pt=!0,Je=cr}finally{try{!Le&&ar.return&&ar.return()}finally{if(pt)throw Je}}++L,++E}return y.join("")},a=function(c){return ct(c,function(y){return C.test(y)?I(y.slice(4).toLowerCase()):y})},m=function(c){return ct(c,function(y){return A.test(y)?"xn--"+P(y):y})},N={version:"2.1.0",ucs2:{decode:Tt,encode:Xt},decode:I,encode:P,toASCII:m,toUnicode:a},q={};function M(f){var c=f.charCodeAt(0),y=void 0;return c<16?y="%0"+c.toString(16).toUpperCase():c<128?y="%"+c.toString(16).toUpperCase():c<2048?y="%"+(c>>6|192).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase():y="%"+(c>>12|224).toString(16).toUpperCase()+"%"+(c>>6&63|128).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase(),y}function J(f){for(var c="",y=0,S=f.length;y<S;){var E=parseInt(f.substr(y+1,2),16);if(E<128)c+=String.fromCharCode(E),y+=3;else if(E>=194&&E<224){if(S-y>=6){var L=parseInt(f.substr(y+4,2),16);c+=String.fromCharCode((E&31)<<6|L&63)}else c+=f.substr(y,6);y+=6}else if(E>=224){if(S-y>=9){var H=parseInt(f.substr(y+4,2),16),X=parseInt(f.substr(y+7,2),16);c+=String.fromCharCode((E&15)<<12|(H&63)<<6|X&63)}else c+=f.substr(y,9);y+=9}else c+=f.substr(y,3),y+=3}return c}function Q(f,c){function y(S){var E=J(S);return E.match(c.UNRESERVED)?E:S}return f.scheme&&(f.scheme=String(f.scheme).replace(c.PCT_ENCODED,y).toLowerCase().replace(c.NOT_SCHEME,"")),f.userinfo!==void 0&&(f.userinfo=String(f.userinfo).replace(c.PCT_ENCODED,y).replace(c.NOT_USERINFO,M).replace(c.PCT_ENCODED,o)),f.host!==void 0&&(f.host=String(f.host).replace(c.PCT_ENCODED,y).toLowerCase().replace(c.NOT_HOST,M).replace(c.PCT_ENCODED,o)),f.path!==void 0&&(f.path=String(f.path).replace(c.PCT_ENCODED,y).replace(f.scheme?c.NOT_PATH:c.NOT_PATH_NOSCHEME,M).replace(c.PCT_ENCODED,o)),f.query!==void 0&&(f.query=String(f.query).replace(c.PCT_ENCODED,y).replace(c.NOT_QUERY,M).replace(c.PCT_ENCODED,o)),f.fragment!==void 0&&(f.fragment=String(f.fragment).replace(c.PCT_ENCODED,y).replace(c.NOT_FRAGMENT,M).replace(c.PCT_ENCODED,o)),f}function le(f){return f.replace(/^0*(.*)/,"$1")||"0"}function De(f,c){var y=f.match(c.IPV4ADDRESS)||[],S=v(y,2),E=S[1];return E?E.split(".").map(le).join("."):f}function kt(f,c){var y=f.match(c.IPV6ADDRESS)||[],S=v(y,3),E=S[1],L=S[2];if(E){for(var H=E.toLowerCase().split("::").reverse(),X=v(H,2),se=X[0],ue=X[1],Y=ue?ue.split(":").map(le):[],ne=se.split(":").map(le),de=c.IPV4ADDRESS.test(ne[ne.length-1]),x=de?7:8,oe=ne.length-x,me=Array(x),ae=0;ae<x;++ae)me[ae]=Y[ae]||ne[oe+ae]||"";de&&(me[x-1]=De(me[x-1],c));var Xe=me.reduce(function(Oe,Le,pt){if(!Le||Le==="0"){var Je=Oe[Oe.length-1];Je&&Je.index+Je.length===pt?Je.length++:Oe.push({index:pt,length:1})}return Oe},[]),Me=Xe.sort(function(Oe,Le){return Le.length-Oe.length})[0],Ue=void 0;if(Me&&Me.length>1){var At=me.slice(0,Me.index),dt=me.slice(Me.index+Me.length);Ue=At.join(":")+"::"+dt.join(":")}else Ue=me.join(":");return L&&(Ue+="%"+L),Ue}else return f}var er=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,tr="".match(/(){0}/)[1]===void 0;function Te(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={},S=c.iri!==!1?h:p;c.reference==="suffix"&&(f=(c.scheme?c.scheme+":":"")+"//"+f);var E=f.match(er);if(E){tr?(y.scheme=E[1],y.userinfo=E[3],y.host=E[4],y.port=parseInt(E[5],10),y.path=E[6]||"",y.query=E[7],y.fragment=E[8],isNaN(y.port)&&(y.port=E[5])):(y.scheme=E[1]||void 0,y.userinfo=f.indexOf("@")!==-1?E[3]:void 0,y.host=f.indexOf("//")!==-1?E[4]:void 0,y.port=parseInt(E[5],10),y.path=E[6]||"",y.query=f.indexOf("?")!==-1?E[7]:void 0,y.fragment=f.indexOf("#")!==-1?E[8]:void 0,isNaN(y.port)&&(y.port=f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?E[4]:void 0)),y.host&&(y.host=kt(De(y.host,S),S)),y.scheme===void 0&&y.userinfo===void 0&&y.host===void 0&&y.port===void 0&&!y.path&&y.query===void 0?y.reference="same-document":y.scheme===void 0?y.reference="relative":y.fragment===void 0?y.reference="absolute":y.reference="uri",c.reference&&c.reference!=="suffix"&&c.reference!==y.reference&&(y.error=y.error||"URI is not a "+c.reference+" reference.");var L=q[(c.scheme||y.scheme||"").toLowerCase()];if(!c.unicodeSupport&&(!L||!L.unicodeSupport)){if(y.host&&(c.domainHost||L&&L.domainHost))try{y.host=N.toASCII(y.host.replace(S.PCT_ENCODED,J).toLowerCase())}catch(H){y.error=y.error||"Host's domain name can not be converted to ASCII via punycode: "+H}Q(y,p)}else Q(y,S);L&&L.parse&&L.parse(y,c)}else y.error=y.error||"URI can not be parsed.";return y}function rr(f,c){var y=c.iri!==!1?h:p,S=[];return f.userinfo!==void 0&&(S.push(f.userinfo),S.push("@")),f.host!==void 0&&S.push(kt(De(String(f.host),y),y).replace(y.IPV6ADDRESS,function(E,L,H){return"["+L+(H?"%25"+H:"")+"]"})),(typeof f.port=="number"||typeof f.port=="string")&&(S.push(":"),S.push(String(f.port))),S.length?S.join(""):void 0}var Ot=/^\.\.?\//,Ct=/^\/\.(\/|$)/,Nt=/^\/\.\.(\/|$)/,nr=/^\/?(?:.|\n)*?(?=\/|$)/;function Fe(f){for(var c=[];f.length;)if(f.match(Ot))f=f.replace(Ot,"");else if(f.match(Ct))f=f.replace(Ct,"/");else if(f.match(Nt))f=f.replace(Nt,"/"),c.pop();else if(f==="."||f==="..")f="";else{var y=f.match(nr);if(y){var S=y[0];f=f.slice(S.length),c.push(S)}else throw new Error("Unexpected dot segment condition")}return c.join("")}function Pe(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=c.iri?h:p,S=[],E=q[(c.scheme||f.scheme||"").toLowerCase()];if(E&&E.serialize&&E.serialize(f,c),f.host&&!y.IPV6ADDRESS.test(f.host)){if(c.domainHost||E&&E.domainHost)try{f.host=c.iri?N.toUnicode(f.host):N.toASCII(f.host.replace(y.PCT_ENCODED,J).toLowerCase())}catch(X){f.error=f.error||"Host's domain name can not be converted to "+(c.iri?"Unicode":"ASCII")+" via punycode: "+X}}Q(f,y),c.reference!=="suffix"&&f.scheme&&(S.push(f.scheme),S.push(":"));var L=rr(f,c);if(L!==void 0&&(c.reference!=="suffix"&&S.push("//"),S.push(L),f.path&&f.path.charAt(0)!=="/"&&S.push("/")),f.path!==void 0){var H=f.path;!c.absolutePath&&(!E||!E.absolutePath)&&(H=Fe(H)),L===void 0&&(H=H.replace(/^\/\//,"/%2F")),S.push(H)}return f.query!==void 0&&(S.push("?"),S.push(f.query)),f.fragment!==void 0&&(S.push("#"),S.push(f.fragment)),S.join("")}function jt(f,c){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=arguments[3],E={};return S||(f=Te(Pe(f,y),y),c=Te(Pe(c,y),y)),y=y||{},!y.tolerant&&c.scheme?(E.scheme=c.scheme,E.userinfo=c.userinfo,E.host=c.host,E.port=c.port,E.path=Fe(c.path||""),E.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(E.userinfo=c.userinfo,E.host=c.host,E.port=c.port,E.path=Fe(c.path||""),E.query=c.query):(c.path?(c.path.charAt(0)==="/"?E.path=Fe(c.path):((f.userinfo!==void 0||f.host!==void 0||f.port!==void 0)&&!f.path?E.path="/"+c.path:f.path?E.path=f.path.slice(0,f.path.lastIndexOf("/")+1)+c.path:E.path=c.path,E.path=Fe(E.path)),E.query=c.query):(E.path=f.path,c.query!==void 0?E.query=c.query:E.query=f.query),E.userinfo=f.userinfo,E.host=f.host,E.port=f.port),E.scheme=f.scheme),E.fragment=c.fragment,E}function sr(f,c,y){var S=d({scheme:"null"},y);return Pe(jt(Te(f,S),Te(c,S),S,!0),S)}function lt(f,c){return typeof f=="string"?f=Pe(Te(f,c),c):i(f)==="object"&&(f=Te(Pe(f,c),c)),f}function ir(f,c,y){return typeof f=="string"?f=Pe(Te(f,y),y):i(f)==="object"&&(f=Pe(f,y)),typeof c=="string"?c=Pe(Te(c,y),y):i(c)==="object"&&(c=Pe(c,y)),f===c}function Rr(f,c){return f&&f.toString().replace(!c||!c.iri?p.ESCAPE:h.ESCAPE,M)}function ke(f,c){return f&&f.toString().replace(!c||!c.iri?p.PCT_ENCODED:h.PCT_ENCODED,J)}var ut={scheme:"http",domainHost:!0,parse:function(c,y){return c.host||(c.error=c.error||"HTTP URIs must have a host."),c},serialize:function(c,y){var S=String(c.scheme).toLowerCase()==="https";return(c.port===(S?443:80)||c.port==="")&&(c.port=void 0),c.path||(c.path="/"),c}},Fs={scheme:"https",domainHost:ut.domainHost,parse:ut.parse,serialize:ut.serialize};function qs(f){return typeof f.secure=="boolean"?f.secure:String(f.scheme).toLowerCase()==="wss"}var or={scheme:"ws",domainHost:!0,parse:function(c,y){var S=c;return S.secure=qs(S),S.resourceName=(S.path||"/")+(S.query?"?"+S.query:""),S.path=void 0,S.query=void 0,S},serialize:function(c,y){if((c.port===(qs(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){var S=c.resourceName.split("?"),E=v(S,2),L=E[0],H=E[1];c.path=L&&L!=="/"?L:void 0,c.query=H,c.resourceName=void 0}return c.fragment=void 0,c}},Ms={scheme:"wss",domainHost:or.domainHost,parse:or.parse,serialize:or.serialize},ya={},Us="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",qe="[0-9A-Fa-f]",ga=s(s("%[EFef]"+qe+"%"+qe+qe+"%"+qe+qe)+"|"+s("%[89A-Fa-f]"+qe+"%"+qe+qe)+"|"+s("%"+qe+qe)),$a="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",_a="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",wa=n(_a,'[\\"\\\\]'),va="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ba=new RegExp(Us,"g"),It=new RegExp(ga,"g"),Pa=new RegExp(n("[^]",$a,"[\\.]",'[\\"]',wa),"g"),Ls=new RegExp(n("[^]",Us,va),"g"),Ea=Ls;function Pn(f){var c=J(f);return c.match(ba)?c:f}var Hs={scheme:"mailto",parse:function(c,y){var S=c,E=S.to=S.path?S.path.split(","):[];if(S.path=void 0,S.query){for(var L=!1,H={},X=S.query.split("&"),se=0,ue=X.length;se<ue;++se){var Y=X[se].split("=");switch(Y[0]){case"to":for(var ne=Y[1].split(","),de=0,x=ne.length;de<x;++de)E.push(ne[de]);break;case"subject":S.subject=ke(Y[1],y);break;case"body":S.body=ke(Y[1],y);break;default:L=!0,H[ke(Y[0],y)]=ke(Y[1],y);break}}L&&(S.headers=H)}S.query=void 0;for(var oe=0,me=E.length;oe<me;++oe){var ae=E[oe].split("@");if(ae[0]=ke(ae[0]),y.unicodeSupport)ae[1]=ke(ae[1],y).toLowerCase();else try{ae[1]=N.toASCII(ke(ae[1],y).toLowerCase())}catch(Xe){S.error=S.error||"Email address's domain name can not be converted to ASCII via punycode: "+Xe}E[oe]=ae.join("@")}return S},serialize:function(c,y){var S=c,E=l(c.to);if(E){for(var L=0,H=E.length;L<H;++L){var X=String(E[L]),se=X.lastIndexOf("@"),ue=X.slice(0,se).replace(It,Pn).replace(It,o).replace(Pa,M),Y=X.slice(se+1);try{Y=y.iri?N.toUnicode(Y):N.toASCII(ke(Y,y).toLowerCase())}catch(oe){S.error=S.error||"Email address's domain name can not be converted to "+(y.iri?"Unicode":"ASCII")+" via punycode: "+oe}E[L]=ue+"@"+Y}S.path=E.join(",")}var ne=c.headers=c.headers||{};c.subject&&(ne.subject=c.subject),c.body&&(ne.body=c.body);var de=[];for(var x in ne)ne[x]!==ya[x]&&de.push(x.replace(It,Pn).replace(It,o).replace(Ls,M)+"="+ne[x].replace(It,Pn).replace(It,o).replace(Ea,M));return de.length&&(S.query=de.join("&")),S}},Sa=/^([^\:]+)\:(.*)/,zs={scheme:"urn",parse:function(c,y){var S=c.path&&c.path.match(Sa),E=c;if(S){var L=y.scheme||E.scheme||"urn",H=S[1].toLowerCase(),X=S[2],se=L+":"+(y.nid||H),ue=q[se];E.nid=H,E.nss=X,E.path=void 0,ue&&(E=ue.parse(E,y))}else E.error=E.error||"URN can not be parsed.";return E},serialize:function(c,y){var S=y.scheme||c.scheme||"urn",E=c.nid,L=S+":"+(y.nid||E),H=q[L];H&&(c=H.serialize(c,y));var X=c,se=c.nss;return X.path=(E||y.nid)+":"+se,X}},Ta=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Vs={scheme:"urn:uuid",parse:function(c,y){var S=c;return S.uuid=S.nss,S.nss=void 0,!y.tolerant&&(!S.uuid||!S.uuid.match(Ta))&&(S.error=S.error||"UUID is not valid."),S},serialize:function(c,y){var S=c;return S.nss=(c.uuid||"").toLowerCase(),S}};q[ut.scheme]=ut,q[Fs.scheme]=Fs,q[or.scheme]=or,q[Ms.scheme]=Ms,q[Hs.scheme]=Hs,q[zs.scheme]=zs,q[Vs.scheme]=Vs,r.SCHEMES=q,r.pctEncChar=M,r.pctDecChars=J,r.parse=Te,r.removeDotSegments=Fe,r.serialize=Pe,r.resolveComponents=jt,r.resolve=sr,r.normalize=lt,r.equal=ir,r.escapeComponent=Rr,r.unescapeComponent=ke,Object.defineProperty(r,"__esModule",{value:!0})})})(qn,qn.exports);var iu=qn.exports;Object.defineProperty(rs,"__esModule",{value:!0});const Jo=iu;Jo.code='require("ajv/dist/runtime/uri").default';rs.default=Jo;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Ae;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=G;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=Er,s=Sr,i=Pt,o=Se,l=G,d=$e,u=Pr,p=re,h=su,v=rs,T=(F,$)=>new RegExp(F,$);T.code="new RegExp";const w=["removeAdditional","useDefaults","coerceTypes"],R=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},k=200;function O(F){var $,I,P,a,m,N,q,M,J,Q,le,De,kt,er,tr,Te,rr,Ot,Ct,Nt,nr,Fe,Pe,jt,sr;const lt=F.strict,ir=($=F.code)===null||$===void 0?void 0:$.optimize,Rr=ir===!0||ir===void 0?1:ir||0,ke=(P=(I=F.code)===null||I===void 0?void 0:I.regExp)!==null&&P!==void 0?P:T,ut=(a=F.uriResolver)!==null&&a!==void 0?a:v.default;return{strictSchema:(N=(m=F.strictSchema)!==null&&m!==void 0?m:lt)!==null&&N!==void 0?N:!0,strictNumbers:(M=(q=F.strictNumbers)!==null&&q!==void 0?q:lt)!==null&&M!==void 0?M:!0,strictTypes:(Q=(J=F.strictTypes)!==null&&J!==void 0?J:lt)!==null&&Q!==void 0?Q:"log",strictTuples:(De=(le=F.strictTuples)!==null&&le!==void 0?le:lt)!==null&&De!==void 0?De:"log",strictRequired:(er=(kt=F.strictRequired)!==null&&kt!==void 0?kt:lt)!==null&&er!==void 0?er:!1,code:F.code?{...F.code,optimize:Rr,regExp:ke}:{optimize:Rr,regExp:ke},loopRequired:(tr=F.loopRequired)!==null&&tr!==void 0?tr:k,loopEnum:(Te=F.loopEnum)!==null&&Te!==void 0?Te:k,meta:(rr=F.meta)!==null&&rr!==void 0?rr:!0,messages:(Ot=F.messages)!==null&&Ot!==void 0?Ot:!0,inlineRefs:(Ct=F.inlineRefs)!==null&&Ct!==void 0?Ct:!0,schemaId:(Nt=F.schemaId)!==null&&Nt!==void 0?Nt:"$id",addUsedSchema:(nr=F.addUsedSchema)!==null&&nr!==void 0?nr:!0,validateSchema:(Fe=F.validateSchema)!==null&&Fe!==void 0?Fe:!0,validateFormats:(Pe=F.validateFormats)!==null&&Pe!==void 0?Pe:!0,unicodeRegExp:(jt=F.unicodeRegExp)!==null&&jt!==void 0?jt:!0,int32range:(sr=F.int32range)!==null&&sr!==void 0?sr:!0,uriResolver:ut}}class j{constructor($={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,...O($)};const{es5:I,lines:P}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:R,es5:I,lines:P}),this.logger=Z($.logger);const a=$.validateFormats;$.validateFormats=!1,this.RULES=(0,i.getRules)(),D.call(this,_,$,"NOT SUPPORTED"),D.call(this,g,$,"DEPRECATED","warn"),this._metaOpts=K.call(this),$.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords&&W.call(this,$.keywords),typeof $.meta=="object"&&this.addMetaSchema($.meta),C.call(this),$.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:$,meta:I,schemaId:P}=this.opts;let a=h;P==="id"&&(a={...h},a.id=a.$id,delete a.$id),I&&$&&this.addMetaSchema(a,a[P],!1)}defaultMeta(){const{meta:$,schemaId:I}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[I]||$:void 0}validate($,I){let P;if(typeof $=="string"){if(P=this.getSchema($),!P)throw new Error(`no schema with key or ref "${$}"`)}else P=this.compile($);const a=P(I);return"$async"in P||(this.errors=P.errors),a}compile($,I){const P=this._addSchema($,I);return P.validate||this._compileSchemaEnv(P)}compileAsync($,I){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:P}=this.opts;return a.call(this,$,I);async function a(Q,le){await m.call(this,Q.$schema);const De=this._addSchema(Q,le);return De.validate||N.call(this,De)}async function m(Q){Q&&!this.getSchema(Q)&&await a.call(this,{$ref:Q},!0)}async function N(Q){try{return this._compileSchemaEnv(Q)}catch(le){if(!(le instanceof s.default))throw le;return q.call(this,le),await M.call(this,le.missingSchema),N.call(this,Q)}}function q({missingSchema:Q,missingRef:le}){if(this.refs[Q])throw new Error(`AnySchema ${Q} is loaded but ${le} cannot be resolved`)}async function M(Q){const le=await J.call(this,Q);this.refs[Q]||await m.call(this,le.$schema),this.refs[Q]||this.addSchema(le,Q,I)}async function J(Q){const le=this._loading[Q];if(le)return le;try{return await(this._loading[Q]=P(Q))}finally{delete this._loading[Q]}}}addSchema($,I,P,a=this.opts.validateSchema){if(Array.isArray($)){for(const N of $)this.addSchema(N,void 0,P,a);return this}let m;if(typeof $=="object"){const{schemaId:N}=this.opts;if(m=$[N],m!==void 0&&typeof m!="string")throw new Error(`schema ${N} must be string`)}return I=(0,d.normalizeId)(I||m),this._checkUnique(I),this.schemas[I]=this._addSchema($,P,I,a,!0),this}addMetaSchema($,I,P=this.opts.validateSchema){return this.addSchema($,I,!0,P),this}validateSchema($,I){if(typeof $=="boolean")return!0;let P;if(P=$.$schema,P!==void 0&&typeof P!="string")throw new Error("$schema must be a string");if(P=P||this.opts.defaultMeta||this.defaultMeta(),!P)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(P,$);if(!a&&I){const m="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(m);else throw new Error(m)}return a}getSchema($){let I;for(;typeof(I=b.call(this,$))=="string";)$=I;if(I===void 0){const{schemaId:P}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:P});if(I=o.resolveSchema.call(this,a,$),!I)return;this.refs[$]=I}return I.validate||this._compileSchemaEnv(I)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const I=b.call(this,$);return typeof I=="object"&&this._cache.delete(I.schema),delete this.schemas[$],delete this.refs[$],this}case"object":{const I=$;this._cache.delete(I);let P=$[this.opts.schemaId];return P&&(P=(0,d.normalizeId)(P),delete this.schemas[P],delete this.refs[P]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(const I of $)this.addKeyword(I);return this}addKeyword($,I){let P;if(typeof $=="string")P=$,typeof I=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),I.keyword=P);else if(typeof $=="object"&&I===void 0){if(I=$,P=I.keyword,Array.isArray(P)&&!P.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(he.call(this,P,I),!I)return(0,p.eachItem)(P,m=>at.call(this,m)),this;Tt.call(this,I);const a={...I,type:(0,u.getJSONTypes)(I.type),schemaType:(0,u.getJSONTypes)(I.schemaType)};return(0,p.eachItem)(P,a.type.length===0?m=>at.call(this,m,a):m=>a.type.forEach(N=>at.call(this,m,a,N))),this}getKeyword($){const I=this.RULES.all[$];return typeof I=="object"?I.definition:!!I}removeKeyword($){const{RULES:I}=this;delete I.keywords[$],delete I.all[$];for(const P of I.rules){const a=P.rules.findIndex(m=>m.keyword===$);a>=0&&P.rules.splice(a,1)}return this}addFormat($,I){return typeof I=="string"&&(I=new RegExp(I)),this.formats[$]=I,this}errorsText($=this.errors,{separator:I=", ",dataVar:P="data"}={}){return!$||$.length===0?"No errors":$.map(a=>`${P}${a.instancePath} ${a.message}`).reduce((a,m)=>a+I+m)}$dataMetaSchema($,I){const P=this.RULES.all;$=JSON.parse(JSON.stringify($));for(const a of I){const m=a.split("/").slice(1);let N=$;for(const q of m)N=N[q];for(const q in P){const M=P[q];if(typeof M!="object")continue;const{$data:J}=M.definition,Q=N[q];J&&Q&&(N[q]=Rt(Q))}}return $}_removeAllSchemas($,I){for(const P in $){const a=$[P];(!I||I.test(P))&&(typeof a=="string"?delete $[P]:a&&!a.meta&&(this._cache.delete(a.schema),delete $[P]))}}_addSchema($,I,P,a=this.opts.validateSchema,m=this.opts.addUsedSchema){let N;const{schemaId:q}=this.opts;if(typeof $=="object")N=$[q];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof $!="boolean")throw new Error("schema must be object or boolean")}let M=this._cache.get($);if(M!==void 0)return M;P=(0,d.normalizeId)(N||P);const J=d.getSchemaRefs.call(this,$,P);return M=new o.SchemaEnv({schema:$,schemaId:q,meta:I,baseId:P,localRefs:J}),this._cache.set(M.schema,M),m&&!P.startsWith("#")&&(P&&this._checkUnique(P),this.refs[P]=M),a&&this.validateSchema($,!0),M}_checkUnique($){if(this.schemas[$]||this.refs[$])throw new Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta?this._compileMetaSchema($):o.compileSchema.call(this,$),!$.validate)throw new Error("ajv implementation error");return $.validate}_compileMetaSchema($){const I=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,$)}finally{this.opts=I}}}e.default=j,j.ValidationError=n.default,j.MissingRefError=s.default;function D(F,$,I,P="error"){for(const a in F){const m=a;m in $&&this.logger[P](`${I}: option ${a}. ${F[m]}`)}}function b(F){return F=(0,d.normalizeId)(F),this.schemas[F]||this.refs[F]}function C(){const F=this.opts.schemas;if(F)if(Array.isArray(F))this.addSchema(F);else for(const $ in F)this.addSchema(F[$],$)}function A(){for(const F in this.opts.formats){const $=this.opts.formats[F];$&&this.addFormat(F,$)}}function W(F){if(Array.isArray(F)){this.addVocabulary(F);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const $ in F){const I=F[$];I.keyword||(I.keyword=$),this.addKeyword(I)}}function K(){const F={...this.opts};for(const $ of w)delete F[$];return F}const ce={log(){},warn(){},error(){}};function Z(F){if(F===!1)return ce;if(F===void 0)return console;if(F.log&&F.warn&&F.error)return F;throw new Error("logger must implement log, warn and error methods")}const Re=/^[a-z_$][a-z0-9_$:-]*$/i;function he(F,$){const{RULES:I}=this;if((0,p.eachItem)(F,P=>{if(I.keywords[P])throw new Error(`Keyword ${P} is already defined`);if(!Re.test(P))throw new Error(`Keyword ${P} has invalid name`)}),!!$&&$.$data&&!("code"in $||"validate"in $))throw new Error('$data keyword must have "code" or "validate" function')}function at(F,$,I){var P;const a=$==null?void 0:$.post;if(I&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:m}=this;let N=a?m.post:m.rules.find(({type:M})=>M===I);if(N||(N={type:I,rules:[]},m.rules.push(N)),m.keywords[F]=!0,!$)return;const q={keyword:F,definition:{...$,type:(0,u.getJSONTypes)($.type),schemaType:(0,u.getJSONTypes)($.schemaType)}};$.before?ct.call(this,N,q,$.before):N.rules.push(q),m.all[F]=q,(P=$.implements)===null||P===void 0||P.forEach(M=>this.addKeyword(M))}function ct(F,$,I){const P=F.rules.findIndex(a=>a.keyword===I);P>=0?F.rules.splice(P,0,$):(F.rules.push($),this.logger.warn(`rule ${I} is not defined`))}function Tt(F){let{metaSchema:$}=F;$!==void 0&&(F.$data&&this.opts.$data&&($=Rt($)),F.validateSchema=this.compile($,!0))}const Xt={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Rt(F){return{anyOf:[F,Xt]}}})(Eo);var ns={},ss={},is={};Object.defineProperty(is,"__esModule",{value:!0});const ou={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};is.default=ou;var Et={};Object.defineProperty(Et,"__esModule",{value:!0});Et.callRef=Et.getValidate=void 0;const au=Sr,fi=B,Ee=G,qt=Ke,hi=Se,Nr=re,cu={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:l,self:d}=n,{root:u}=i;if((r==="#"||r==="#/")&&s===u.baseId)return h();const p=hi.resolveRef.call(d,u,s,r);if(p===void 0)throw new au.default(n.opts.uriResolver,s,r);if(p instanceof hi.SchemaEnv)return v(p);return T(p);function h(){if(i===u)return Ur(e,o,i,i.$async);const w=t.scopeValue("root",{ref:u});return Ur(e,(0,Ee._)`${w}.validate`,u,u.$async)}function v(w){const R=Yo(e,w);Ur(e,R,w,w.$async)}function T(w){const R=t.scopeValue("schema",l.code.source===!0?{ref:w,code:(0,Ee.stringify)(w)}:{ref:w}),_=t.name("valid"),g=e.subschema({schema:w,dataTypes:[],schemaPath:Ee.nil,topSchemaRef:R,errSchemaPath:r},_);e.mergeEvaluated(g),e.ok(_)}}};function Yo(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ee._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Et.getValidate=Yo;function Ur(e,t,r,n){const{gen:s,it:i}=e,{allErrors:o,schemaEnv:l,opts:d}=i,u=d.passContext?qt.default.this:Ee.nil;n?p():h();function p(){if(!l.$async)throw new Error("async schema referenced by sync schema");const w=s.let("valid");s.try(()=>{s.code((0,Ee._)`await ${(0,fi.callValidateCode)(e,t,u)}`),T(t),o||s.assign(w,!0)},R=>{s.if((0,Ee._)`!(${R} instanceof ${i.ValidationError})`,()=>s.throw(R)),v(R),o||s.assign(w,!1)}),e.ok(w)}function h(){e.result((0,fi.callValidateCode)(e,t,u),()=>T(t),()=>v(t))}function v(w){const R=(0,Ee._)`${w}.errors`;s.assign(qt.default.vErrors,(0,Ee._)`${qt.default.vErrors} === null ? ${R} : ${qt.default.vErrors}.concat(${R})`),s.assign(qt.default.errors,(0,Ee._)`${qt.default.vErrors}.length`)}function T(w){var R;if(!i.opts.unevaluated)return;const _=(R=r==null?void 0:r.validate)===null||R===void 0?void 0:R.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=Nr.mergeEvaluated.props(s,_.props,i.props));else{const g=s.var("props",(0,Ee._)`${w}.evaluated.props`);i.props=Nr.mergeEvaluated.props(s,g,i.props,Ee.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=Nr.mergeEvaluated.items(s,_.items,i.items));else{const g=s.var("items",(0,Ee._)`${w}.evaluated.items`);i.items=Nr.mergeEvaluated.items(s,g,i.items,Ee.Name)}}}Et.callRef=Ur;Et.default=cu;Object.defineProperty(ss,"__esModule",{value:!0});const lu=is,uu=Et,du=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",lu.default,uu.default];ss.default=du;var os={},as={};Object.defineProperty(as,"__esModule",{value:!0});const Br=G,rt=Br.operators,Gr={maximum:{okStr:"<=",ok:rt.LTE,fail:rt.GT},minimum:{okStr:">=",ok:rt.GTE,fail:rt.LT},exclusiveMaximum:{okStr:"<",ok:rt.LT,fail:rt.GTE},exclusiveMinimum:{okStr:">",ok:rt.GT,fail:rt.LTE}},pu={message:({keyword:e,schemaCode:t})=>(0,Br.str)`must be ${Gr[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Br._)`{comparison: ${Gr[e].okStr}, limit: ${t}}`},fu={keyword:Object.keys(Gr),type:"number",schemaType:"number",$data:!0,error:pu,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Br._)`${r} ${Gr[t].fail} ${n} || isNaN(${r})`)}};as.default=fu;var cs={};Object.defineProperty(cs,"__esModule",{value:!0});const fr=G,hu={message:({schemaCode:e})=>(0,fr.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,fr._)`{multipleOf: ${e}}`},mu={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:hu,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),l=i?(0,fr._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,fr._)`${o} !== parseInt(${o})`;e.fail$data((0,fr._)`(${n} === 0 || (${o} = ${r}/${n}, ${l}))`)}};cs.default=mu;var ls={},us={};Object.defineProperty(us,"__esModule",{value:!0});function Qo(e){const t=e.length;let r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}us.default=Qo;Qo.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(ls,"__esModule",{value:!0});const mt=G,yu=re,gu=us,$u={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,mt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,mt._)`{limit: ${e}}`},_u={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:$u,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?mt.operators.GT:mt.operators.LT,o=s.opts.unicode===!1?(0,mt._)`${r}.length`:(0,mt._)`${(0,yu.useFunc)(e.gen,gu.default)}(${r})`;e.fail$data((0,mt._)`${o} ${i} ${n}`)}};ls.default=_u;var ds={};Object.defineProperty(ds,"__esModule",{value:!0});const wu=B,Kr=G,vu={message:({schemaCode:e})=>(0,Kr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Kr._)`{pattern: ${e}}`},bu={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:vu,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:i}=e,o=i.opts.unicodeRegExp?"u":"",l=r?(0,Kr._)`(new RegExp(${s}, ${o}))`:(0,wu.usePattern)(e,n);e.fail$data((0,Kr._)`!${l}.test(${t})`)}};ds.default=bu;var ps={};Object.defineProperty(ps,"__esModule",{value:!0});const hr=G,Pu={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,hr.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,hr._)`{limit: ${e}}`},Eu={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Pu,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?hr.operators.GT:hr.operators.LT;e.fail$data((0,hr._)`Object.keys(${r}).length ${s} ${n}`)}};ps.default=Eu;var fs={};Object.defineProperty(fs,"__esModule",{value:!0});const ur=B,mr=G,Su=re,Tu={message:({params:{missingProperty:e}})=>(0,mr.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,mr._)`{missingProperty: ${e}}`},Ru={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Tu,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:o}=e,{opts:l}=o;if(!i&&r.length===0)return;const d=r.length>=l.loopRequired;if(o.allErrors?u():p(),l.strictRequired){const T=e.parentSchema.properties,{definedProperties:w}=e.it;for(const R of r)if((T==null?void 0:T[R])===void 0&&!w.has(R)){const _=o.schemaEnv.baseId+o.errSchemaPath,g=`required property "${R}" is not defined at "${_}" (strictRequired)`;(0,Su.checkStrictMode)(o,g,o.opts.strictRequired)}}function u(){if(d||i)e.block$data(mr.nil,h);else for(const T of r)(0,ur.checkReportMissingProp)(e,T)}function p(){const T=t.let("missing");if(d||i){const w=t.let("valid",!0);e.block$data(w,()=>v(T,w)),e.ok(w)}else t.if((0,ur.checkMissingProp)(e,r,T)),(0,ur.reportMissingProp)(e,T),t.else()}function h(){t.forOf("prop",n,T=>{e.setParams({missingProperty:T}),t.if((0,ur.noPropertyInData)(t,s,T,l.ownProperties),()=>e.error())})}function v(T,w){e.setParams({missingProperty:T}),t.forOf(T,n,()=>{t.assign(w,(0,ur.propertyInData)(t,s,T,l.ownProperties)),t.if((0,mr.not)(w),()=>{e.error(),t.break()})},mr.nil)}}};fs.default=Ru;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});const yr=G,ku={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,yr.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,yr._)`{limit: ${e}}`},Ou={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:ku,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?yr.operators.GT:yr.operators.LT;e.fail$data((0,yr._)`${r}.length ${s} ${n}`)}};hs.default=Ou;var ms={},Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});const Zo=jo;Zo.code='require("ajv/dist/runtime/equal").default';Tr.default=Zo;Object.defineProperty(ms,"__esModule",{value:!0});const Cn=Pr,ge=G,Cu=re,Nu=Tr,ju={message:({params:{i:e,j:t}})=>(0,ge.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,ge._)`{i: ${e}, j: ${t}}`},Iu={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:ju,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:l}=e;if(!n&&!s)return;const d=t.let("valid"),u=i.items?(0,Cn.getSchemaTypes)(i.items):[];e.block$data(d,p,(0,ge._)`${o} === false`),e.ok(d);function p(){const w=t.let("i",(0,ge._)`${r}.length`),R=t.let("j");e.setParams({i:w,j:R}),t.assign(d,!0),t.if((0,ge._)`${w} > 1`,()=>(h()?v:T)(w,R))}function h(){return u.length>0&&!u.some(w=>w==="object"||w==="array")}function v(w,R){const _=t.name("item"),g=(0,Cn.checkDataTypes)(u,_,l.opts.strictNumbers,Cn.DataType.Wrong),k=t.const("indices",(0,ge._)`{}`);t.for((0,ge._)`;${w}--;`,()=>{t.let(_,(0,ge._)`${r}[${w}]`),t.if(g,(0,ge._)`continue`),u.length>1&&t.if((0,ge._)`typeof ${_} == "string"`,(0,ge._)`${_} += "_"`),t.if((0,ge._)`typeof ${k}[${_}] == "number"`,()=>{t.assign(R,(0,ge._)`${k}[${_}]`),e.error(),t.assign(d,!1).break()}).code((0,ge._)`${k}[${_}] = ${w}`)})}function T(w,R){const _=(0,Cu.useFunc)(t,Nu.default),g=t.name("outer");t.label(g).for((0,ge._)`;${w}--;`,()=>t.for((0,ge._)`${R} = ${w}; ${R}--;`,()=>t.if((0,ge._)`${_}(${r}[${w}], ${r}[${R}])`,()=>{e.error(),t.assign(d,!1).break(g)})))}}};ms.default=Iu;var ys={};Object.defineProperty(ys,"__esModule",{value:!0});const Mn=G,Au=re,Du=Tr,Fu={message:"must be equal to constant",params:({schemaCode:e})=>(0,Mn._)`{allowedValue: ${e}}`},qu={keyword:"const",$data:!0,error:Fu,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Mn._)`!${(0,Au.useFunc)(t,Du.default)}(${r}, ${s})`):e.fail((0,Mn._)`${i} !== ${r}`)}};ys.default=qu;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});const dr=G,Mu=re,Uu=Tr,Lu={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,dr._)`{allowedValues: ${e}}`},Hu={keyword:"enum",schemaType:"array",$data:!0,error:Lu,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const l=s.length>=o.opts.loopEnum;let d;const u=()=>d??(d=(0,Mu.useFunc)(t,Uu.default));let p;if(l||n)p=t.let("valid"),e.block$data(p,h);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const T=t.const("vSchema",i);p=(0,dr.or)(...s.map((w,R)=>v(T,R)))}e.pass(p);function h(){t.assign(p,!1),t.forOf("v",i,T=>t.if((0,dr._)`${u()}(${r}, ${T})`,()=>t.assign(p,!0).break()))}function v(T,w){const R=s[w];return typeof R=="object"&&R!==null?(0,dr._)`${u()}(${r}, ${T}[${w}])`:(0,dr._)`${r} === ${R}`}}};gs.default=Hu;Object.defineProperty(os,"__esModule",{value:!0});const zu=as,Vu=cs,Wu=ls,xu=ds,Bu=ps,Gu=fs,Ku=hs,Ju=ms,Yu=ys,Qu=gs,Zu=[zu.default,Vu.default,Wu.default,xu.default,Bu.default,Gu.default,Ku.default,Ju.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Yu.default,Qu.default];os.default=Zu;var $s={},Qt={};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.validateAdditionalItems=void 0;const yt=G,Un=re,Xu={message:({params:{len:e}})=>(0,yt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,yt._)`{limit: ${e}}`},ed={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Xu,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Un.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Xo(e,n)}};function Xo(e,t){const{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;const l=r.const("len",(0,yt._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,yt._)`${l} <= ${t.length}`);else if(typeof n=="object"&&!(0,Un.alwaysValidSchema)(o,n)){const u=r.var("valid",(0,yt._)`${l} <= ${t.length}`);r.if((0,yt.not)(u),()=>d(u)),e.ok(u)}function d(u){r.forRange("i",t.length,l,p=>{e.subschema({keyword:i,dataProp:p,dataPropType:Un.Type.Num},u),o.allErrors||r.if((0,yt.not)(u),()=>r.break())})}}Qt.validateAdditionalItems=Xo;Qt.default=ed;var _s={},Zt={};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.validateTuple=void 0;const mi=G,Lr=re,td=B,rd={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return ea(e,"additionalItems",t);r.items=!0,!(0,Lr.alwaysValidSchema)(r,t)&&e.ok((0,td.validateArray)(e))}};function ea(e,t,r=e.schema){const{gen:n,parentSchema:s,data:i,keyword:o,it:l}=e;p(s),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=Lr.mergeEvaluated.items(n,r.length,l.items));const d=n.name("valid"),u=n.const("len",(0,mi._)`${i}.length`);r.forEach((h,v)=>{(0,Lr.alwaysValidSchema)(l,h)||(n.if((0,mi._)`${u} > ${v}`,()=>e.subschema({keyword:o,schemaProp:v,dataProp:v},d)),e.ok(d))});function p(h){const{opts:v,errSchemaPath:T}=l,w=r.length,R=w===h.minItems&&(w===h.maxItems||h[t]===!1);if(v.strictTuples&&!R){const _=`"${o}" is ${w}-tuple, but minItems or maxItems/${t} are not specified or different at path "${T}"`;(0,Lr.checkStrictMode)(l,_,v.strictTuples)}}}Zt.validateTuple=ea;Zt.default=rd;Object.defineProperty(_s,"__esModule",{value:!0});const nd=Zt,sd={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,nd.validateTuple)(e,"items")};_s.default=sd;var ws={};Object.defineProperty(ws,"__esModule",{value:!0});const yi=G,id=re,od=B,ad=Qt,cd={message:({params:{len:e}})=>(0,yi.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,yi._)`{limit: ${e}}`},ld={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:cd,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,id.alwaysValidSchema)(n,t)&&(s?(0,ad.validateAdditionalItems)(e,s):e.ok((0,od.validateArray)(e)))}};ws.default=ld;var vs={};Object.defineProperty(vs,"__esModule",{value:!0});const Ce=G,jr=re,ud={message:({params:{min:e,max:t}})=>t===void 0?(0,Ce.str)`must contain at least ${e} valid item(s)`:(0,Ce.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ce._)`{minContains: ${e}}`:(0,Ce._)`{minContains: ${e}, maxContains: ${t}}`},dd={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ud,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;let o,l;const{minContains:d,maxContains:u}=n;i.opts.next?(o=d===void 0?1:d,l=u):o=1;const p=t.const("len",(0,Ce._)`${s}.length`);if(e.setParams({min:o,max:l}),l===void 0&&o===0){(0,jr.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&o>l){(0,jr.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,jr.alwaysValidSchema)(i,r)){let R=(0,Ce._)`${p} >= ${o}`;l!==void 0&&(R=(0,Ce._)`${R} && ${p} <= ${l}`),e.pass(R);return}i.items=!0;const h=t.name("valid");l===void 0&&o===1?T(h,()=>t.if(h,()=>t.break())):o===0?(t.let(h,!0),l!==void 0&&t.if((0,Ce._)`${s}.length > 0`,v)):(t.let(h,!1),v()),e.result(h,()=>e.reset());function v(){const R=t.name("_valid"),_=t.let("count",0);T(R,()=>t.if(R,()=>w(_)))}function T(R,_){t.forRange("i",0,p,g=>{e.subschema({keyword:"contains",dataProp:g,dataPropType:jr.Type.Num,compositeRule:!0},R),_()})}function w(R){t.code((0,Ce._)`${R}++`),l===void 0?t.if((0,Ce._)`${R} >= ${o}`,()=>t.assign(h,!0).break()):(t.if((0,Ce._)`${R} > ${l}`,()=>t.assign(h,!1).break()),o===1?t.assign(h,!0):t.if((0,Ce._)`${R} >= ${o}`,()=>t.assign(h,!0)))}}};vs.default=dd;var ta={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=G,r=re,n=B;e.error={message:({params:{property:d,depsCount:u,deps:p}})=>{const h=u===1?"property":"properties";return(0,t.str)`must have ${h} ${p} when property ${d} is present`},params:({params:{property:d,depsCount:u,deps:p,missingProperty:h}})=>(0,t._)`{property: ${d},
|
|
856
|
-
missingProperty: ${
|
|
857
|
-
depsCount: ${
|
|
858
|
-
deps: ${p}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){const[u,p]=i(d);o(d,u),l(d,p)}};function i({schema:d}){const u={},p={};for(const h in d){if(h==="__proto__")continue;const v=Array.isArray(d[h])?u:p;v[h]=d[h]}return[u,p]}function o(d,u=d.schema){const{gen:p,data:h,it:v}=d;if(Object.keys(u).length===0)return;const T=p.let("missing");for(const w in u){const R=u[w];if(R.length===0)continue;const _=(0,n.propertyInData)(p,h,w,v.opts.ownProperties);d.setParams({property:w,depsCount:R.length,deps:R.join(", ")}),v.allErrors?p.if(_,()=>{for(const g of R)(0,n.checkReportMissingProp)(d,g)}):(p.if((0,t._)`${_} && (${(0,n.checkMissingProp)(d,R,T)})`),(0,n.reportMissingProp)(d,T),p.else())}}e.validatePropertyDeps=o;function l(d,u=d.schema){const{gen:p,data:h,keyword:v,it:T}=d,w=p.name("valid");for(const R in u)(0,r.alwaysValidSchema)(T,u[R])||(p.if((0,n.propertyInData)(p,h,R,T.opts.ownProperties),()=>{const _=d.subschema({keyword:v,schemaProp:R},w);d.mergeValidEvaluated(_,w)},()=>p.var(w,!0)),d.ok(w))}e.validateSchemaDeps=l,e.default=s})(ta);var bs={};Object.defineProperty(bs,"__esModule",{value:!0});const ra=G,pd=re,fd={message:"property name must be valid",params:({params:e})=>(0,ra._)`{propertyName: ${e.propertyName}}`},hd={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:fd,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,pd.alwaysValidSchema)(s,r))return;const i=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if((0,ra.not)(i),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(i)}};bs.default=hd;var bn={};Object.defineProperty(bn,"__esModule",{value:!0});const Ir=B,je=G,md=Ke,Ar=re,yd={message:"must NOT have additional properties",params:({params:e})=>(0,je._)`{additionalProperty: ${e.additionalProperty}}`},gd={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:yd,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:l,opts:d}=o;if(o.props=!0,d.removeAdditional!=="all"&&(0,Ar.alwaysValidSchema)(o,r))return;const u=(0,Ir.allSchemaProperties)(n.properties),p=(0,Ir.allSchemaProperties)(n.patternProperties);h(),e.ok((0,je._)`${i} === ${md.default.errors}`);function h(){t.forIn("key",s,_=>{!u.length&&!p.length?w(_):t.if(v(_),()=>w(_))})}function v(_){let g;if(u.length>8){const k=(0,Ar.schemaRefOrVal)(o,n.properties,"properties");g=(0,Ir.isOwnProperty)(t,k,_)}else u.length?g=(0,je.or)(...u.map(k=>(0,je._)`${_} === ${k}`)):g=je.nil;return p.length&&(g=(0,je.or)(g,...p.map(k=>(0,je._)`${(0,Ir.usePattern)(e,k)}.test(${_})`))),(0,je.not)(g)}function T(_){t.code((0,je._)`delete ${s}[${_}]`)}function w(_){if(d.removeAdditional==="all"||d.removeAdditional&&r===!1){T(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),l||t.break();return}if(typeof r=="object"&&!(0,Ar.alwaysValidSchema)(o,r)){const g=t.name("valid");d.removeAdditional==="failing"?(R(_,g,!1),t.if((0,je.not)(g),()=>{e.reset(),T(_)})):(R(_,g),l||t.if((0,je.not)(g),()=>t.break()))}}function R(_,g,k){const O={keyword:"additionalProperties",dataProp:_,dataPropType:Ar.Type.Str};k===!1&&Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(O,g)}}};bn.default=gd;var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0});const $d=Ae,gi=B,Nn=re,$i=bn,_d={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&$i.default.code(new $d.KeywordCxt(i,$i.default,"additionalProperties"));const o=(0,gi.allSchemaProperties)(r);for(const h of o)i.definedProperties.add(h);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=Nn.mergeEvaluated.props(t,(0,Nn.toHash)(o),i.props));const l=o.filter(h=>!(0,Nn.alwaysValidSchema)(i,r[h]));if(l.length===0)return;const d=t.name("valid");for(const h of l)u(h)?p(h):(t.if((0,gi.propertyInData)(t,s,h,i.opts.ownProperties)),p(h),i.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(h),e.ok(d);function u(h){return i.opts.useDefaults&&!i.compositeRule&&r[h].default!==void 0}function p(h){e.subschema({keyword:"properties",schemaProp:h,dataProp:h},d)}}};Ps.default=_d;var Es={};Object.defineProperty(Es,"__esModule",{value:!0});const _i=B,Dr=G,wi=re,vi=re,wd={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,l=(0,_i.allSchemaProperties)(r),d=l.filter(R=>(0,wi.alwaysValidSchema)(i,r[R]));if(l.length===0||d.length===l.length&&(!i.opts.unevaluated||i.props===!0))return;const u=o.strictSchema&&!o.allowMatchingProperties&&s.properties,p=t.name("valid");i.props!==!0&&!(i.props instanceof Dr.Name)&&(i.props=(0,vi.evaluatedPropsToName)(t,i.props));const{props:h}=i;v();function v(){for(const R of l)u&&T(R),i.allErrors?w(R):(t.var(p,!0),w(R),t.if(p))}function T(R){for(const _ in u)new RegExp(R).test(_)&&(0,wi.checkStrictMode)(i,`property ${_} matches pattern ${R} (use allowMatchingProperties)`)}function w(R){t.forIn("key",n,_=>{t.if((0,Dr._)`${(0,_i.usePattern)(e,R)}.test(${_})`,()=>{const g=d.includes(R);g||e.subschema({keyword:"patternProperties",schemaProp:R,dataProp:_,dataPropType:vi.Type.Str},p),i.opts.unevaluated&&h!==!0?t.assign((0,Dr._)`${h}[${_}]`,!0):!g&&!i.allErrors&&t.if((0,Dr.not)(p),()=>t.break())})})}}};Es.default=wd;var Ss={};Object.defineProperty(Ss,"__esModule",{value:!0});const vd=re,bd={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,vd.alwaysValidSchema)(n,r)){e.fail();return}const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Ss.default=bd;var Ts={};Object.defineProperty(Ts,"__esModule",{value:!0});const Pd=B,Ed={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Pd.validateUnion,error:{message:"must match a schema in anyOf"}};Ts.default=Ed;var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});const Hr=G,Sd=re,Td={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Hr._)`{passingSchemas: ${e.passing}}`},Rd={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Td,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const i=r,o=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(u),e.result(o,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((p,h)=>{let v;(0,Sd.alwaysValidSchema)(s,p)?t.var(d,!0):v=e.subschema({keyword:"oneOf",schemaProp:h,compositeRule:!0},d),h>0&&t.if((0,Hr._)`${d} && ${o}`).assign(o,!1).assign(l,(0,Hr._)`[${l}, ${h}]`).else(),t.if(d,()=>{t.assign(o,!0),t.assign(l,h),v&&e.mergeEvaluated(v,Hr.Name)})})}}};Rs.default=Rd;var ks={};Object.defineProperty(ks,"__esModule",{value:!0});const kd=re,Od={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((i,o)=>{if((0,kd.alwaysValidSchema)(n,i))return;const l=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(l)})}};ks.default=Od;var Os={};Object.defineProperty(Os,"__esModule",{value:!0});const Jr=G,na=re,Cd={message:({params:e})=>(0,Jr.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Jr._)`{failingKeyword: ${e.ifClause}}`},Nd={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Cd,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,na.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=bi(n,"then"),i=bi(n,"else");if(!s&&!i)return;const o=t.let("valid",!0),l=t.name("_valid");if(d(),e.reset(),s&&i){const p=t.let("ifClause");e.setParams({ifClause:p}),t.if(l,u("then",p),u("else",p))}else s?t.if(l,u("then")):t.if((0,Jr.not)(l),u("else"));e.pass(o,()=>e.error(!0));function d(){const p=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(p)}function u(p,h){return()=>{const v=e.subschema({keyword:p},l);t.assign(o,l),e.mergeValidEvaluated(v,o),h?t.assign(h,(0,Jr._)`${p}`):e.setParams({ifClause:p})}}}};function bi(e,t){const r=e.schema[t];return r!==void 0&&!(0,na.alwaysValidSchema)(e,r)}Os.default=Nd;var Cs={};Object.defineProperty(Cs,"__esModule",{value:!0});const jd=re,Id={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,jd.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Cs.default=Id;Object.defineProperty($s,"__esModule",{value:!0});const Ad=Qt,Dd=_s,Fd=Zt,qd=ws,Md=vs,Ud=ta,Ld=bs,Hd=bn,zd=Ps,Vd=Es,Wd=Ss,xd=Ts,Bd=Rs,Gd=ks,Kd=Os,Jd=Cs;function Yd(e=!1){const t=[Wd.default,xd.default,Bd.default,Gd.default,Kd.default,Jd.default,Ld.default,Hd.default,Ud.default,zd.default,Vd.default];return e?t.push(Dd.default,qd.default):t.push(Ad.default,Fd.default),t.push(Md.default),t}$s.default=Yd;var Ns={},js={};Object.defineProperty(js,"__esModule",{value:!0});const fe=G,Qd={message:({schemaCode:e})=>(0,fe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,fe._)`{format: ${e}}`},Zd={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Qd,code(e,t){const{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:l}=e,{opts:d,errSchemaPath:u,schemaEnv:p,self:h}=l;if(!d.validateFormats)return;s?v():T();function v(){const w=r.scopeValue("formats",{ref:h.formats,code:d.code.formats}),R=r.const("fDef",(0,fe._)`${w}[${o}]`),_=r.let("fType"),g=r.let("format");r.if((0,fe._)`typeof ${R} == "object" && !(${R} instanceof RegExp)`,()=>r.assign(_,(0,fe._)`${R}.type || "string"`).assign(g,(0,fe._)`${R}.validate`),()=>r.assign(_,(0,fe._)`"string"`).assign(g,R)),e.fail$data((0,fe.or)(k(),O()));function k(){return d.strictSchema===!1?fe.nil:(0,fe._)`${o} && !${g}`}function O(){const j=p.$async?(0,fe._)`(${R}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,fe._)`${g}(${n})`,D=(0,fe._)`(typeof ${g} == "function" ? ${j} : ${g}.test(${n}))`;return(0,fe._)`${g} && ${g} !== true && ${_} === ${t} && !${D}`}}function T(){const w=h.formats[i];if(!w){k();return}if(w===!0)return;const[R,_,g]=O(w);R===t&&e.pass(j());function k(){if(d.strictSchema===!1){h.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function O(D){const b=D instanceof RegExp?(0,fe.regexpCode)(D):d.code.formats?(0,fe._)`${d.code.formats}${(0,fe.getProperty)(i)}`:void 0,C=r.scopeValue("formats",{key:i,ref:D,code:b});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,fe._)`${C}.validate`]:["string",D,C]}function j(){if(typeof w=="object"&&!(w instanceof RegExp)&&w.async){if(!p.$async)throw new Error("async format in sync schema");return(0,fe._)`await ${g}(${n})`}return typeof _=="function"?(0,fe._)`${g}(${n})`:(0,fe._)`${g}.test(${n})`}}}};js.default=Zd;Object.defineProperty(Ns,"__esModule",{value:!0});const Xd=js,ep=[Xd.default];Ns.default=ep;var Yt={};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.contentVocabulary=Yt.metadataVocabulary=void 0;Yt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Yt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(ns,"__esModule",{value:!0});const tp=ss,rp=os,np=$s,sp=Ns,Pi=Yt,ip=[tp.default,rp.default,(0,np.default)(),sp.default,Pi.metadataVocabulary,Pi.contentVocabulary];ns.default=ip;var Is={},sa={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))})(sa);Object.defineProperty(Is,"__esModule",{value:!0});const Mt=G,Ln=sa,Ei=Se,op=re,ap={message:({params:{discrError:e,tagName:t}})=>e===Ln.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Mt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},cp={keyword:"discriminator",type:"object",schemaType:"object",error:ap,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),u=t.const("tag",(0,Mt._)`${r}${(0,Mt.getProperty)(l)}`);t.if((0,Mt._)`typeof ${u} == "string"`,()=>p(),()=>e.error(!1,{discrError:Ln.DiscrError.Tag,tag:u,tagName:l})),e.ok(d);function p(){const T=v();t.if(!1);for(const w in T)t.elseIf((0,Mt._)`${u} === ${w}`),t.assign(d,h(T[w]));t.else(),e.error(!1,{discrError:Ln.DiscrError.Mapping,tag:u,tagName:l}),t.endIf()}function h(T){const w=t.name("valid"),R=e.subschema({keyword:"oneOf",schemaProp:T},w);return e.mergeEvaluated(R,Mt.Name),w}function v(){var T;const w={},R=g(s);let _=!0;for(let j=0;j<o.length;j++){let D=o[j];D!=null&&D.$ref&&!(0,op.schemaHasRulesButRef)(D,i.self.RULES)&&(D=Ei.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,D==null?void 0:D.$ref),D instanceof Ei.SchemaEnv&&(D=D.schema));const b=(T=D==null?void 0:D.properties)===null||T===void 0?void 0:T[l];if(typeof b!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);_=_&&(R||g(D)),k(b,j)}if(!_)throw new Error(`discriminator: "${l}" must be required`);return w;function g({required:j}){return Array.isArray(j)&&j.includes(l)}function k(j,D){if(j.const)O(j.const,D);else if(j.enum)for(const b of j.enum)O(b,D);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function O(j,D){if(typeof j!="string"||j in w)throw new Error(`discriminator: "${l}" values must be unique strings`);w[j]=D}}}};Is.default=cp;const lp="http://json-schema.org/draft-07/schema#",up="http://json-schema.org/draft-07/schema#",dp="Core schema meta-schema",pp={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},fp=["object","boolean"],hp={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},mp={$schema:lp,$id:up,title:dp,definitions:pp,type:fp,properties:hp,default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=Eo,n=ns,s=Is,i=mp,o=["/properties"],l="http://json-schema.org/draft-07/schema";class d extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(w=>this.addVocabulary(w)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const w=this.opts.$data?this.$dataMetaSchema(i,o):i;this.addMetaSchema(w,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var u=Ae;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var p=G;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});var h=Er;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var v=Sr;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return v.default}})})(An,An.exports);var yp=An.exports;const gp=Sc(yp),$p="http://json-schema.org/schema",_p="#/definitions/Blueprint",wp={Blueprint:{type:"object",properties:{landingPage:{type:"string",description:"The URL to navigate to after the blueprint has been run."},description:{type:"string",description:"Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what."},preferredVersions:{type:"object",properties:{php:{anyOf:[{$ref:"#/definitions/SupportedPHPVersion"},{type:"string",const:"latest"}],description:"The preferred PHP version to use. If not specified, the latest supported version will be used"},wp:{type:"string",description:"The preferred WordPress version to use. If not specified, the latest supported version will be used"}},required:["php","wp"],additionalProperties:!1,description:"The preferred PHP and WordPress versions to use."},features:{type:"object",properties:{networking:{type:"boolean",description:"Should boot with support for network request via wp_safe_remote_get?"}},additionalProperties:!1},constants:{type:"object",additionalProperties:{type:"string"},description:"PHP Constants to define on every request",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},plugins:{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/FileReference"}]},description:"WordPress plugins to install and activate",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},login:{anyOf:[{type:"boolean"},{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:!1}],description:"User to log in as. If true, logs the user in as admin/password."},phpExtensionBundles:{type:"array",items:{$ref:"#/definitions/SupportedPHPExtensionBundle"},description:"The PHP extensions to use."},steps:{type:"array",items:{anyOf:[{$ref:"#/definitions/StepDefinition"},{type:"string"},{not:{}},{type:"boolean",const:!1},{type:"null"}]},description:"The steps to run after every other operation in this Blueprint was executed."},$schema:{type:"string"}},additionalProperties:!1},SupportedPHPVersion:{type:"string",enum:["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"]},FileReference:{anyOf:[{$ref:"#/definitions/VFSReference"},{$ref:"#/definitions/LiteralReference"},{$ref:"#/definitions/CoreThemeReference"},{$ref:"#/definitions/CorePluginReference"},{$ref:"#/definitions/UrlReference"}]},VFSReference:{type:"object",properties:{resource:{type:"string",const:"vfs",description:"Identifies the file resource as Virtual File System (VFS)"},path:{type:"string",description:"The path to the file in the VFS"}},required:["resource","path"],additionalProperties:!1},LiteralReference:{type:"object",properties:{resource:{type:"string",const:"literal",description:"Identifies the file resource as a literal file"},name:{type:"string",description:"The name of the file"},contents:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The contents of the file"}},required:["resource","name","contents"],additionalProperties:!1},CoreThemeReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/themes",description:"Identifies the file resource as a WordPress Core theme"},slug:{type:"string",description:"The slug of the WordPress Core theme"}},required:["resource","slug"],additionalProperties:!1},CorePluginReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/plugins",description:"Identifies the file resource as a WordPress Core plugin"},slug:{type:"string",description:"The slug of the WordPress Core plugin"}},required:["resource","slug"],additionalProperties:!1},UrlReference:{type:"object",properties:{resource:{type:"string",const:"url",description:"Identifies the file resource as a URL"},url:{type:"string",description:"The URL of the file"},caption:{type:"string",description:"Optional caption for displaying a progress message"}},required:["resource","url"],additionalProperties:!1},SupportedPHPExtensionBundle:{type:"string",const:"kitchen-sink"},StepDefinition:{type:"object",discriminator:{propertyName:"step"},required:["step"],oneOf:[{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activatePlugin"},pluginPath:{type:"string",description:"Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php)."},pluginName:{type:"string",description:"Optional. Plugin name to display in the progress bar."}},required:["pluginPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activateTheme"},themeFolderName:{type:"string",description:"The name of the theme folder inside wp-content/themes/"}},required:["step","themeFolderName"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"applyWordPressPatches"},siteUrl:{type:"string"},wordpressPath:{type:"string"},addPhpInfo:{type:"boolean"},patchSecrets:{type:"boolean"},disableSiteHealth:{type:"boolean"},disableWpNewBlogNotification:{type:"boolean"},prepareForRunningInsideWebBrowser:{type:"boolean"},addFetchNetworkTransport:{type:"boolean"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"cp"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineWpConfigConsts"},consts:{type:"object",additionalProperties:{},description:"The constants to define"},method:{type:"string",enum:["rewrite-wp-config","define-before-run"],description:`The method of defining the constants. Possible values are:
|
|
920
|
+
`;this[__private__dont__use].ccall("wasm_set_phpini_entries",null,[STRING],[e])}this[__private__dont__use].ccall("php_wasm_init",null,[],[])},yt=new WeakSet,Kt=function(){const e="/tmp/headers.json";if(!this.fileExists(e))throw new Error("SAPI Error: Could not find response headers file.");const t=JSON.parse(this.readFileAsText(e)),r={};for(const n of t.headers){if(!n.includes(": "))continue;const s=n.indexOf(": "),o=n.substring(0,s).toLowerCase(),i=n.substring(s+2);o in r||(r[o]=[]),r[o].push(i)}return{headers:r,httpStatusCode:t.status}},wt=new WeakSet,Jt=function(e){if(this[__private__dont__use].ccall("wasm_set_request_uri",null,[STRING],[e]),e.includes("?")){const t=e.substring(e.indexOf("?")+1);this[__private__dont__use].ccall("wasm_set_query_string",null,[STRING],[t])}},vt=new WeakSet,Zt=function(e,t){this[__private__dont__use].ccall("wasm_set_request_host",null,[STRING],[e]);let r;try{r=parseInt(new URL(e).port,10)}catch{}(!r||isNaN(r)||r===80)&&(r=t==="https"?443:80),this[__private__dont__use].ccall("wasm_set_request_port",null,[NUMBER],[r]),(t==="https"||!t&&r===443)&&this.addServerGlobalEntry("HTTPS","on")},Pt=new WeakSet,Qt=function(e){this[__private__dont__use].ccall("wasm_set_request_method",null,[STRING],[e])},bt=new WeakSet,Yt=function(e){e.cookie&&this[__private__dont__use].ccall("wasm_set_cookies",null,[STRING],[e.cookie]),e["content-type"]&&this[__private__dont__use].ccall("wasm_set_content_type",null,[STRING],[e["content-type"]]),e["content-length"]&&this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[parseInt(e["content-length"],10)]);for(const t in e){let r="HTTP_";["content-type","content-length"].includes(t.toLowerCase())&&(r=""),this.addServerGlobalEntry(`${r}${t.toUpperCase().replace(/-/g,"_")}`,e[t])}},Et=new WeakSet,Xt=function(e){const t=this[__private__dont__use].lengthBytesUTF8(e),r=this[__private__dont__use].malloc(t+1);if(!r)throw new Error("Could not allocate memory for the request body.");return this[__private__dont__use].stringToUTF8(e,r,t+1),this[__private__dont__use].ccall("wasm_set_request_body",null,[NUMBER],[r]),this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[new TextEncoder().encode(e).length]),r},St=new WeakSet,er=function(e){this[__private__dont__use].ccall("wasm_set_path_translated",null,[STRING],[e])},Rt=new WeakSet,tr=function(){for(const e in L(this,Te))this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,L(this,Te)[e]])},Tt=new WeakSet,rr=function(e){const{key:t,name:r,type:n,data:s}=e,o=`/tmp/${Math.random().toFixed(20)}`;this.writeFile(o,s);const i=0;this[__private__dont__use].ccall("wasm_add_uploaded_file",null,[STRING,STRING,STRING,STRING,NUMBER,NUMBER],[t,r,n,o,i,s.byteLength])},kt=new WeakSet,nr=function(e){this[__private__dont__use].ccall("wasm_set_php_code",null,[STRING],[e])},Ct=new WeakSet,sr=async function(){var s;let e,t;try{e=await new Promise((o,i)=>{var p;t=d=>{const u=new Error("Rethrown");u.cause=d.error,u.betterMessage=d.message,i(u)},(p=L(this,Re))==null||p.addEventListener("error",t);const l=this[__private__dont__use].ccall("wasm_sapi_handle_request",NUMBER,[],[],{async:!0});return l instanceof Promise?l.then(o,i):o(l)})}catch(o){for(const d in this)typeof this[d]=="function"&&(this[d]=()=>{throw new Error("PHP runtime has crashed – see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=getFunctionsMaybeMissingFromAsyncify();const i=o,l="betterMessage"in i?i.betterMessage:i.message,p=new Error(l);throw p.cause=i,p}finally{(s=L(this,Re))==null||s.removeEventListener("error",t),te(this,Te,{})}const{headers:r,httpStatusCode:n}=ce(this,yt,Kt).call(this);return new PHPResponse(n,r,this.readFileAsBuffer("/tmp/stdout"),this.readFileAsText("/tmp/stderr"),e)};__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdir",1);__decorateClass([rethrowFileSystemError('Could not create directory "{path}"')],BasePHP.prototype,"mkdirTree",1);__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsText",1);__decorateClass([rethrowFileSystemError('Could not read "{path}"')],BasePHP.prototype,"readFileAsBuffer",1);__decorateClass([rethrowFileSystemError('Could not write to "{path}"')],BasePHP.prototype,"writeFile",1);__decorateClass([rethrowFileSystemError('Could not unlink "{path}"')],BasePHP.prototype,"unlink",1);__decorateClass([rethrowFileSystemError('Could not remove directory "{path}"')],BasePHP.prototype,"rmdir",1);__decorateClass([rethrowFileSystemError('Could not list files in "{path}"')],BasePHP.prototype,"listFiles",1);__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"isDir",1);__decorateClass([rethrowFileSystemError('Could not stat "{path}"')],BasePHP.prototype,"fileExists",1);function normalizeHeaders(e){const t={};for(const r in e)t[r.toLowerCase()]=e[r];return t}function recreateMemFS(e,t,r){let n;try{n=t.lookupPath(r)}catch{return}if(!("contents"in n.node))return;try{e=e.lookupPath(r);return}catch{}if(!t.isDir(n.node.mode)){e.writeFile(r,t.readFile(r));return}e.mkdirTree(r);const s=t.readdir(r).filter(o=>o!=="."&&o!=="..");for(const o of s)recreateMemFS(e,t,joinPaths(r,o))}const ResourceTypes=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function isFileReference(e){return e&&typeof e=="object"&&typeof e.resource=="string"&&ResourceTypes.includes(e.resource)}class Resource{static create(t,{semaphore:r,progress:n}){let s;switch(t.resource){case"vfs":s=new VFSResource(t,n);break;case"literal":s=new LiteralResource(t,n);break;case"wordpress.org/themes":s=new CoreThemeResource(t,n);break;case"wordpress.org/plugins":s=new CorePluginResource(t,n);break;case"url":s=new UrlResource(t,n);break;default:throw new Error(`Invalid resource: ${t}`)}return s=new CachedResource(s),r&&(s=new SemaphoreResource(s,r)),s}setPlayground(t){this.playground=t}get isAsync(){return!1}}class VFSResource extends Resource{constructor(t,r){super(),this.resource=t,this.progress=r}async resolve(){var r;const t=await this.playground.readFileAsBuffer(this.resource.path);return(r=this.progress)==null||r.set(100),new File([t],this.name)}get name(){return this.resource.path.split("/").pop()||""}}class LiteralResource extends Resource{constructor(t,r){super(),this.resource=t,this.progress=r}async resolve(){var t;return(t=this.progress)==null||t.set(100),new File([this.resource.contents],this.resource.name)}get name(){return this.resource.name}}class FetchResource extends Resource{constructor(t){super(),this.progress=t}async resolve(){var n,s;(n=this.progress)==null||n.setCaption(this.caption);const t=this.getURL();let r=await fetch(t);if(r=await cloneResponseMonitorProgress(r,((s=this.progress)==null?void 0:s.loadingListener)??noop),r.status!==200)throw new Error(`Could not download "${t}"`);return new File([await r.blob()],this.name)}get caption(){return`Downloading ${this.name}`}get name(){try{return new URL(this.getURL(),"http://example.com").pathname.split("/").pop()}catch{return this.getURL()}}get isAsync(){return!0}}const noop=()=>{};class UrlResource extends FetchResource{constructor(t,r){super(r),this.resource=t}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class CoreThemeResource extends FetchResource{constructor(t,r){super(r),this.resource=t}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${toDirectoryZipName(this.resource.slug)}`}}class CorePluginResource extends FetchResource{constructor(t,r){super(r),this.resource=t}get name(){return zipNameToHumanName(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${toDirectoryZipName(this.resource.slug)}`}}function toDirectoryZipName(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class DecoratedResource extends Resource{constructor(t){super(),this.resource=t}async resolve(){return this.resource.resolve()}async setPlayground(t){return this.resource.setPlayground(t)}get progress(){return this.resource.progress}set progress(t){this.resource.progress=t}get name(){return this.resource.name}get isAsync(){return this.resource.isAsync}}class CachedResource extends DecoratedResource{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class SemaphoreResource extends DecoratedResource{constructor(t,r){super(t),this.semaphore=r}async resolve(){return this.isAsync?this.semaphore.run(()=>super.resolve()):super.resolve()}}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ajv$1={exports:{}},core$2={},validate={},boolSchema={},errors={},codegen={},code$1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(k){if(super(),!e.IDENTIFIER.test(k))throw new Error("CodeGen: name must be a valid identifier");this.str=k}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(k){super(),this._items=typeof k=="string"?[k]:k}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const k=this._items[0];return k===""||k==='""'}get str(){var k;return(k=this._str)!==null&&k!==void 0?k:this._str=this._items.reduce((C,I)=>`${C}${I}`,"")}get names(){var k;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),{})}}e._Code=n,e.nil=new n("");function s(g,...k){const C=[g[0]];let I=0;for(;I<k.length;)l(C,k[I]),C.push(g[++I]);return new n(C)}e._=s;const o=new n("+");function i(g,...k){const C=[R(g[0])];let I=0;for(;I<k.length;)C.push(o),l(C,k[I]),C.push(o,R(g[++I]));return p(C),new n(C)}e.str=i;function l(g,k){k instanceof n?g.push(...k._items):k instanceof r?g.push(k):g.push(m(k))}e.addCodeArg=l;function p(g){let k=1;for(;k<g.length-1;){if(g[k]===o){const C=d(g[k-1],g[k+1]);if(C!==void 0){g.splice(k-1,3,C);continue}g[k++]="+"}k++}}function d(g,k){if(k==='""')return g;if(g==='""')return k;if(typeof g=="string")return k instanceof r||g[g.length-1]!=='"'?void 0:typeof k!="string"?`${g.slice(0,-1)}${k}"`:k[0]==='"'?g.slice(0,-1)+k.slice(1):void 0;if(typeof k=="string"&&k[0]==='"'&&!(g instanceof r))return`"${g}${k.slice(1)}`}function u(g,k){return k.emptyStr()?g:g.emptyStr()?k:i`${g}${k}`}e.strConcat=u;function m(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:R(Array.isArray(g)?g.join(","):g)}function w(g){return new n(R(g))}e.stringify=w;function R(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=R;function v(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new n(`.${g}`):s`[${g}]`}e.getProperty=v;function T(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new n(`${g}`);throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=T;function $(g){return new n(g.toString())}e.regexpCode=$})(code$1);var scope={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=code$1;class r extends Error{constructor(d){super(`CodeGen: "code" for ${d} not defined`),this.value=d.value}}var n;(function(p){p[p.Started=0]="Started",p[p.Completed=1]="Completed"})(n=e.UsedValueState||(e.UsedValueState={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:d,parent:u}={}){this._names={},this._prefixes=d,this._parent=u}toName(d){return d instanceof t.Name?d:this.name(d)}name(d){return new t.Name(this._newName(d))}_newName(d){const u=this._names[d]||this._nameGroup(d);return`${d}${u.index++}`}_nameGroup(d){var u,m;if(!((m=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||m===void 0)&&m.has(d)||this._prefixes&&!this._prefixes.has(d))throw new Error(`CodeGen: prefix "${d}" is not allowed in this scope`);return this._names[d]={prefix:d,index:0}}}e.Scope=s;class o extends t.Name{constructor(d,u){super(u),this.prefix=d}setValue(d,{property:u,itemIndex:m}){this.value=d,this.scopePath=(0,t._)`.${new t.Name(u)}[${m}]`}}e.ValueScopeName=o;const i=(0,t._)`\n`;class l extends s{constructor(d){super(d),this._values={},this._scope=d.scope,this.opts={...d,_n:d.lines?i:t.nil}}get(){return this._scope}name(d){return new o(d,this._newName(d))}value(d,u){var m;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const w=this.toName(d),{prefix:R}=w,v=(m=u.key)!==null&&m!==void 0?m:u.ref;let T=this._values[R];if(T){const k=T.get(v);if(k)return k}else T=this._values[R]=new Map;T.set(v,w);const $=this._scope[R]||(this._scope[R]=[]),g=$.length;return $[g]=u.ref,w.setValue(u,{property:R,itemIndex:g}),w}getValue(d,u){const m=this._values[d];if(m)return m.get(u)}scopeRefs(d,u=this._values){return this._reduceValues(u,m=>{if(m.scopePath===void 0)throw new Error(`CodeGen: name "${m}" has no value`);return(0,t._)`${d}${m.scopePath}`})}scopeCode(d=this._values,u,m){return this._reduceValues(d,w=>{if(w.value===void 0)throw new Error(`CodeGen: name "${w}" has no value`);return w.value.code},u,m)}_reduceValues(d,u,m={},w){let R=t.nil;for(const v in d){const T=d[v];if(!T)continue;const $=m[v]=m[v]||new Map;T.forEach(g=>{if($.has(g))return;$.set(g,n.Started);let k=u(g);if(k){const C=this.opts.es5?e.varKinds.var:e.varKinds.const;R=(0,t._)`${R}${C} ${g} = ${k};${this.opts._n}`}else if(k=w==null?void 0:w(g))R=(0,t._)`${R}${k}${this.opts._n}`;else throw new r(g);$.set(g,n.Completed)})}return R}}e.ValueScope=l})(scope);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=code$1,r=scope;var n=code$1;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=scope;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(a,h){return this}}class i extends o{constructor(a,h,N){super(),this.varKind=a,this.name=h,this.rhs=N}render({es5:a,_n:h}){const N=a?r.varKinds.var:this.varKind,q=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${q};`+h}optimizeNames(a,h){if(a[this.name.str])return this.rhs&&(this.rhs=ie(this.rhs,a,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends o{constructor(a,h,N){super(),this.lhs=a,this.rhs=h,this.sideEffects=N}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,h){if(!(this.lhs instanceof t.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=ie(this.rhs,a,h),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return ue(a,this.rhs)}}class p extends l{constructor(a,h,N,q){super(a,N,q),this.op=h}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}}class d extends o{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}}class u extends o{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}}class m extends o{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}}class w extends o{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,h){return this.code=ie(this.code,a,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class R extends o{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((h,N)=>h+N.render(a),"")}optimizeNodes(){const{nodes:a}=this;let h=a.length;for(;h--;){const N=a[h].optimizeNodes();Array.isArray(N)?a.splice(h,1,...N):N?a[h]=N:a.splice(h,1)}return a.length>0?this:void 0}optimizeNames(a,h){const{nodes:N}=this;let q=N.length;for(;q--;){const M=N[q];M.optimizeNames(a,h)||(ke(a,M.names),N.splice(q,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((a,h)=>K(a,h.names),{})}}class v extends R{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class T extends R{}class $ extends v{}$.kind="else";class g extends v{constructor(a,h){super(h),this.condition=a}render(a){let h=`if(${this.condition})`+super.render(a);return this.else&&(h+="else "+this.else.render(a)),h}optimizeNodes(){super.optimizeNodes();const a=this.condition;if(a===!0)return this.nodes;let h=this.else;if(h){const N=h.optimizeNodes();h=this.else=Array.isArray(N)?new $(N):N}if(h)return a===!1?h instanceof g?h:h.nodes:this.nodes.length?this:new g(Ce(a),h instanceof g?[h]:h.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,h){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(a,h),!!(super.optimizeNames(a,h)||this.else))return this.condition=ie(this.condition,a,h),this}get names(){const a=super.names;return ue(a,this.condition),this.else&&K(a,this.else.names),a}}g.kind="if";class k extends v{}k.kind="for";class C extends k{constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,h){if(super.optimizeNames(a,h))return this.iteration=ie(this.iteration,a,h),this}get names(){return K(super.names,this.iteration.names)}}class I extends k{constructor(a,h,N,q){super(),this.varKind=a,this.name=h,this.from=N,this.to=q}render(a){const h=a.es5?r.varKinds.var:this.varKind,{name:N,from:q,to:M}=this;return`for(${h} ${N}=${q}; ${N}<${M}; ${N}++)`+super.render(a)}get names(){const a=ue(super.names,this.from);return ue(a,this.to)}}class D extends k{constructor(a,h,N,q){super(),this.loop=a,this.varKind=h,this.name=N,this.iterable=q}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,h){if(super.optimizeNames(a,h))return this.iterable=ie(this.iterable,a,h),this}get names(){return K(super.names,this.iterable.names)}}class P extends v{constructor(a,h,N){super(),this.name=a,this.args=h,this.async=N}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}P.kind="func";class O extends R{render(a){return"return "+super.render(a)}}O.kind="return";class A extends v{render(a){let h="try"+super.render(a);return this.catch&&(h+=this.catch.render(a)),this.finally&&(h+=this.finally.render(a)),h}optimizeNodes(){var a,h;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(a,h){var N,q;return super.optimizeNames(a,h),(N=this.catch)===null||N===void 0||N.optimizeNames(a,h),(q=this.finally)===null||q===void 0||q.optimizeNames(a,h),this}get names(){const a=super.names;return this.catch&&K(a,this.catch.names),this.finally&&K(a,this.finally.names),a}}class H extends v{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}H.kind="catch";class z extends v{render(a){return"finally"+super.render(a)}}z.kind="finally";class re{constructor(a,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?`
|
|
921
|
+
`:""},this._extScope=a,this._scope=new r.Scope({parent:a}),this._nodes=[new T]}toString(){return this._root.render(this.opts)}name(a){return this._scope.name(a)}scopeName(a){return this._extScope.name(a)}scopeValue(a,h){const N=this._extScope.value(a,h);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(a,h){return this._extScope.getValue(a,h)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,h,N,q){const M=this._scope.toName(h);return N!==void 0&&q&&(this._constants[M.str]=N),this._leafNode(new i(a,M,N)),M}const(a,h,N){return this._def(r.varKinds.const,a,h,N)}let(a,h,N){return this._def(r.varKinds.let,a,h,N)}var(a,h,N){return this._def(r.varKinds.var,a,h,N)}assign(a,h,N){return this._leafNode(new l(a,h,N))}add(a,h){return this._leafNode(new p(a,e.operators.ADD,h))}code(a){return typeof a=="function"?a():a!==t.nil&&this._leafNode(new w(a)),this}object(...a){const h=["{"];for(const[N,q]of a)h.length>1&&h.push(","),h.push(N),(N!==q||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,q));return h.push("}"),new t._Code(h)}if(a,h,N){if(this._blockNode(new g(a)),h&&N)this.code(h).else().code(N).endIf();else if(h)this.code(h).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new g(a))}else(){return this._elseNode(new $)}endIf(){return this._endBlockNode(g,$)}_for(a,h){return this._blockNode(a),h&&this.code(h).endFor(),this}for(a,h){return this._for(new C(a),h)}forRange(a,h,N,q,M=this.opts.es5?r.varKinds.var:r.varKinds.let){const W=this._scope.toName(a);return this._for(new I(M,W,h,N),()=>q(W))}forOf(a,h,N,q=r.varKinds.const){const M=this._scope.toName(a);if(this.opts.es5){const W=h instanceof t.Name?h:this.var("_arr",h);return this.forRange("_i",0,(0,t._)`${W}.length`,G=>{this.var(M,(0,t._)`${W}[${G}]`),N(M)})}return this._for(new D("of",q,M,h),()=>N(M))}forIn(a,h,N,q=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${h})`,N);const M=this._scope.toName(a);return this._for(new D("in",q,M,h),()=>N(M))}endFor(){return this._endBlockNode(k)}label(a){return this._leafNode(new d(a))}break(a){return this._leafNode(new u(a))}return(a){const h=new O;if(this._blockNode(h),this.code(a),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(O)}try(a,h,N){if(!h&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const q=new A;if(this._blockNode(q),this.code(a),h){const M=this.name("e");this._currNode=q.catch=new H(M),h(M)}return N&&(this._currNode=q.finally=new z,this.code(N)),this._endBlockNode(H,z)}throw(a){return this._leafNode(new m(a))}block(a,h){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(h),this}endBlock(a){const h=this._blockStarts.pop();if(h===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-h;if(N<0||a!==void 0&&N!==a)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${a} expected`);return this._nodes.length=h,this}func(a,h=t.nil,N,q){return this._blockNode(new P(a,h,N)),q&&this.code(q).endFunc(),this}endFunc(){return this._endBlockNode(P)}optimize(a=1){for(;a-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(a){return this._currNode.nodes.push(a),this}_blockNode(a){this._currNode.nodes.push(a),this._nodes.push(a)}_endBlockNode(a,h){const N=this._currNode;if(N instanceof a||h&&N instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${a.kind}/${h.kind}`:a.kind}"`)}_elseNode(a){const h=this._currNode;if(!(h instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=a,this}get _root(){return this._nodes[0]}get _currNode(){const a=this._nodes;return a[a.length-1]}set _currNode(a){const h=this._nodes;h[h.length-1]=a}}e.CodeGen=re;function K(b,a){for(const h in a)b[h]=(b[h]||0)+(a[h]||0);return b}function ue(b,a){return a instanceof t._CodeOrName?K(b,a.names):b}function ie(b,a,h){if(b instanceof t.Name)return N(b);if(!q(b))return b;return new t._Code(b._items.reduce((M,W)=>(W instanceof t.Name&&(W=N(W)),W instanceof t._Code?M.push(...W._items):M.push(W),M),[]));function N(M){const W=h[M.str];return W===void 0||a[M.str]!==1?M:(delete a[M.str],W)}function q(M){return M instanceof t._Code&&M._items.some(W=>W instanceof t.Name&&a[W.str]===1&&h[W.str]!==void 0)}}function ke(b,a){for(const h in a)b[h]=(b[h]||0)-(a[h]||0)}function Ce(b){return typeof b=="boolean"||typeof b=="number"||b===null?!b:(0,t._)`!${j(b)}`}e.not=Ce;const qe=y(e.operators.AND);function et(...b){return b.reduce(qe)}e.and=et;const Me=y(e.operators.OR);function F(...b){return b.reduce(Me)}e.or=F;function y(b){return(a,h)=>a===t.nil?h:h===t.nil?a:(0,t._)`${j(a)} ${b} ${j(h)}`}function j(b){return b instanceof t.Name?b:(0,t._)`(${b})`}})(codegen);var util={};(function(e){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;const t=codegen,r=code$1;function n(P){const O={};for(const A of P)O[A]=!0;return O}e.toHash=n;function s(P,O){return typeof O=="boolean"?O:Object.keys(O).length===0?!0:(o(P,O),!i(O,P.self.RULES.all))}e.alwaysValidSchema=s;function o(P,O=P.schema){const{opts:A,self:H}=P;if(!A.strictSchema||typeof O=="boolean")return;const z=H.RULES.keywords;for(const re in O)z[re]||D(P,`unknown keyword: "${re}"`)}e.checkUnknownRules=o;function i(P,O){if(typeof P=="boolean")return!P;for(const A in P)if(O[A])return!0;return!1}e.schemaHasRules=i;function l(P,O){if(typeof P=="boolean")return!P;for(const A in P)if(A!=="$ref"&&O.all[A])return!0;return!1}e.schemaHasRulesButRef=l;function p({topSchemaRef:P,schemaPath:O},A,H,z){if(!z){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,t._)`${A}`}return(0,t._)`${P}${O}${(0,t.getProperty)(H)}`}e.schemaRefOrVal=p;function d(P){return w(decodeURIComponent(P))}e.unescapeFragment=d;function u(P){return encodeURIComponent(m(P))}e.escapeFragment=u;function m(P){return typeof P=="number"?`${P}`:P.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=m;function w(P){return P.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=w;function R(P,O){if(Array.isArray(P))for(const A of P)O(A);else O(P)}e.eachItem=R;function v({mergeNames:P,mergeToName:O,mergeValues:A,resultToName:H}){return(z,re,K,ue)=>{const ie=K===void 0?re:K instanceof t.Name?(re instanceof t.Name?P(z,re,K):O(z,re,K),K):re instanceof t.Name?(O(z,K,re),re):A(re,K);return ue===t.Name&&!(ie instanceof t.Name)?H(z,ie):ie}}e.mergeEvaluated={props:v({mergeNames:(P,O,A)=>P.if((0,t._)`${A} !== true && ${O} !== undefined`,()=>{P.if((0,t._)`${O} === true`,()=>P.assign(A,!0),()=>P.assign(A,(0,t._)`${A} || {}`).code((0,t._)`Object.assign(${A}, ${O})`))}),mergeToName:(P,O,A)=>P.if((0,t._)`${A} !== true`,()=>{O===!0?P.assign(A,!0):(P.assign(A,(0,t._)`${A} || {}`),$(P,A,O))}),mergeValues:(P,O)=>P===!0?!0:{...P,...O},resultToName:T}),items:v({mergeNames:(P,O,A)=>P.if((0,t._)`${A} !== true && ${O} !== undefined`,()=>P.assign(A,(0,t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),mergeToName:(P,O,A)=>P.if((0,t._)`${A} !== true`,()=>P.assign(A,O===!0?!0:(0,t._)`${A} > ${O} ? ${A} : ${O}`)),mergeValues:(P,O)=>P===!0?!0:Math.max(P,O),resultToName:(P,O)=>P.var("items",O)})};function T(P,O){if(O===!0)return P.var("props",!0);const A=P.var("props",(0,t._)`{}`);return O!==void 0&&$(P,A,O),A}e.evaluatedPropsToName=T;function $(P,O,A){Object.keys(A).forEach(H=>P.assign((0,t._)`${O}${(0,t.getProperty)(H)}`,!0))}e.setEvaluated=$;const g={};function k(P,O){return P.scopeValue("func",{ref:O,code:g[O.code]||(g[O.code]=new r._Code(O.code))})}e.useFunc=k;var C;(function(P){P[P.Num=0]="Num",P[P.Str=1]="Str"})(C=e.Type||(e.Type={}));function I(P,O,A){if(P instanceof t.Name){const H=O===C.Num;return A?H?(0,t._)`"[" + ${P} + "]"`:(0,t._)`"['" + ${P} + "']"`:H?(0,t._)`"/" + ${P}`:(0,t._)`"/" + ${P}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(P).toString():"/"+m(P)}e.getErrorPath=I;function D(P,O,A=P.opts.strictSchema){if(A){if(O=`strict mode: ${O}`,A===!0)throw new Error(O);P.self.logger.warn(O)}}e.checkStrictMode=D})(util);var names$1={};Object.defineProperty(names$1,"__esModule",{value:!0});const codegen_1$t=codegen,names={data:new codegen_1$t.Name("data"),valCxt:new codegen_1$t.Name("valCxt"),instancePath:new codegen_1$t.Name("instancePath"),parentData:new codegen_1$t.Name("parentData"),parentDataProperty:new codegen_1$t.Name("parentDataProperty"),rootData:new codegen_1$t.Name("rootData"),dynamicAnchors:new codegen_1$t.Name("dynamicAnchors"),vErrors:new codegen_1$t.Name("vErrors"),errors:new codegen_1$t.Name("errors"),this:new codegen_1$t.Name("this"),self:new codegen_1$t.Name("self"),scope:new codegen_1$t.Name("scope"),json:new codegen_1$t.Name("json"),jsonPos:new codegen_1$t.Name("jsonPos"),jsonLen:new codegen_1$t.Name("jsonLen"),jsonPart:new codegen_1$t.Name("jsonPart")};names$1.default=names;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=codegen,r=util,n=names$1;e.keywordError={message:({keyword:$})=>(0,t.str)`must pass "${$}" keyword validation`},e.keyword$DataError={message:({keyword:$,schemaType:g})=>g?(0,t.str)`"${$}" keyword must be ${g} ($data)`:(0,t.str)`"${$}" keyword is invalid ($data)`};function s($,g=e.keywordError,k,C){const{it:I}=$,{gen:D,compositeRule:P,allErrors:O}=I,A=m($,g,k);C??(P||O)?p(D,A):d(I,(0,t._)`[${A}]`)}e.reportError=s;function o($,g=e.keywordError,k){const{it:C}=$,{gen:I,compositeRule:D,allErrors:P}=C,O=m($,g,k);p(I,O),D||P||d(C,n.default.vErrors)}e.reportExtraError=o;function i($,g){$.assign(n.default.errors,g),$.if((0,t._)`${n.default.vErrors} !== null`,()=>$.if(g,()=>$.assign((0,t._)`${n.default.vErrors}.length`,g),()=>$.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function l({gen:$,keyword:g,schemaValue:k,data:C,errsCount:I,it:D}){if(I===void 0)throw new Error("ajv implementation error");const P=$.name("err");$.forRange("i",I,n.default.errors,O=>{$.const(P,(0,t._)`${n.default.vErrors}[${O}]`),$.if((0,t._)`${P}.instancePath === undefined`,()=>$.assign((0,t._)`${P}.instancePath`,(0,t.strConcat)(n.default.instancePath,D.errorPath))),$.assign((0,t._)`${P}.schemaPath`,(0,t.str)`${D.errSchemaPath}/${g}`),D.opts.verbose&&($.assign((0,t._)`${P}.schema`,k),$.assign((0,t._)`${P}.data`,C))})}e.extendErrors=l;function p($,g){const k=$.const("err",g);$.if((0,t._)`${n.default.vErrors} === null`,()=>$.assign(n.default.vErrors,(0,t._)`[${k}]`),(0,t._)`${n.default.vErrors}.push(${k})`),$.code((0,t._)`${n.default.errors}++`)}function d($,g){const{gen:k,validateName:C,schemaEnv:I}=$;I.$async?k.throw((0,t._)`new ${$.ValidationError}(${g})`):(k.assign((0,t._)`${C}.errors`,g),k.return(!1))}const u={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function m($,g,k){const{createErrors:C}=$.it;return C===!1?(0,t._)`{}`:w($,g,k)}function w($,g,k={}){const{gen:C,it:I}=$,D=[R(I,k),v($,k)];return T($,g,D),C.object(...D)}function R({errorPath:$},{instancePath:g}){const k=g?(0,t.str)`${$}${(0,r.getErrorPath)(g,r.Type.Str)}`:$;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,k)]}function v({keyword:$,it:{errSchemaPath:g}},{schemaPath:k,parentSchema:C}){let I=C?g:(0,t.str)`${g}/${$}`;return k&&(I=(0,t.str)`${I}${(0,r.getErrorPath)(k,r.Type.Str)}`),[u.schemaPath,I]}function T($,{params:g,message:k},C){const{keyword:I,data:D,schemaValue:P,it:O}=$,{opts:A,propertyName:H,topSchemaRef:z,schemaPath:re}=O;C.push([u.keyword,I],[u.params,typeof g=="function"?g($):g||(0,t._)`{}`]),A.messages&&C.push([u.message,typeof k=="function"?k($):k]),A.verbose&&C.push([u.schema,P],[u.parentSchema,(0,t._)`${z}${re}`],[n.default.data,D]),H&&C.push([u.propertyName,H])}})(errors);Object.defineProperty(boolSchema,"__esModule",{value:!0});boolSchema.boolOrEmptySchema=boolSchema.topBoolOrEmptySchema=void 0;const errors_1$2=errors,codegen_1$s=codegen,names_1$6=names$1,boolError={message:"boolean schema is false"};function topBoolOrEmptySchema(e){const{gen:t,schema:r,validateName:n}=e;r===!1?falseSchemaError(e,!1):typeof r=="object"&&r.$async===!0?t.return(names_1$6.default.data):(t.assign((0,codegen_1$s._)`${n}.errors`,null),t.return(!0))}boolSchema.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),falseSchemaError(e)):r.var(t,!0)}boolSchema.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(e,t){const{gen:r,data:n}=e,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,errors_1$2.reportError)(s,boolError,void 0,t)}var dataType={},rules={};Object.defineProperty(rules,"__esModule",{value:!0});rules.getRules=rules.isJSONType=void 0;const _jsonTypes=["string","number","integer","boolean","null","object","array"],jsonTypes=new Set(_jsonTypes);function isJSONType(e){return typeof e=="string"&&jsonTypes.has(e)}rules.isJSONType=isJSONType;function getRules(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}rules.getRules=getRules;var applicability={};Object.defineProperty(applicability,"__esModule",{value:!0});applicability.shouldUseRule=applicability.shouldUseGroup=applicability.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&shouldUseGroup(e,n)}applicability.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(e,t){return t.rules.some(r=>shouldUseRule(e,r))}applicability.shouldUseGroup=shouldUseGroup;function shouldUseRule(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}applicability.shouldUseRule=shouldUseRule;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=rules,r=applicability,n=errors,s=codegen,o=util;var i;(function(C){C[C.Correct=0]="Correct",C[C.Wrong=1]="Wrong"})(i=e.DataType||(e.DataType={}));function l(C){const I=p(C.type);if(I.includes("null")){if(C.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!I.length&&C.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');C.nullable===!0&&I.push("null")}return I}e.getSchemaTypes=l;function p(C){const I=Array.isArray(C)?C:C?[C]:[];if(I.every(t.isJSONType))return I;throw new Error("type must be JSONType or JSONType[]: "+I.join(","))}e.getJSONTypes=p;function d(C,I){const{gen:D,data:P,opts:O}=C,A=m(I,O.coerceTypes),H=I.length>0&&!(A.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(C,I[0]));if(H){const z=T(I,P,O.strictNumbers,i.Wrong);D.if(z,()=>{A.length?w(C,I,A):g(C)})}return H}e.coerceAndCheckDataType=d;const u=new Set(["string","number","integer","boolean","null"]);function m(C,I){return I?C.filter(D=>u.has(D)||I==="array"&&D==="array"):[]}function w(C,I,D){const{gen:P,data:O,opts:A}=C,H=P.let("dataType",(0,s._)`typeof ${O}`),z=P.let("coerced",(0,s._)`undefined`);A.coerceTypes==="array"&&P.if((0,s._)`${H} == 'object' && Array.isArray(${O}) && ${O}.length == 1`,()=>P.assign(O,(0,s._)`${O}[0]`).assign(H,(0,s._)`typeof ${O}`).if(T(I,O,A.strictNumbers),()=>P.assign(z,O))),P.if((0,s._)`${z} !== undefined`);for(const K of D)(u.has(K)||K==="array"&&A.coerceTypes==="array")&&re(K);P.else(),g(C),P.endIf(),P.if((0,s._)`${z} !== undefined`,()=>{P.assign(O,z),R(C,z)});function re(K){switch(K){case"string":P.elseIf((0,s._)`${H} == "number" || ${H} == "boolean"`).assign(z,(0,s._)`"" + ${O}`).elseIf((0,s._)`${O} === null`).assign(z,(0,s._)`""`);return;case"number":P.elseIf((0,s._)`${H} == "boolean" || ${O} === null
|
|
922
|
+
|| (${H} == "string" && ${O} && ${O} == +${O})`).assign(z,(0,s._)`+${O}`);return;case"integer":P.elseIf((0,s._)`${H} === "boolean" || ${O} === null
|
|
923
|
+
|| (${H} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(z,(0,s._)`+${O}`);return;case"boolean":P.elseIf((0,s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(z,!1).elseIf((0,s._)`${O} === "true" || ${O} === 1`).assign(z,!0);return;case"null":P.elseIf((0,s._)`${O} === "" || ${O} === 0 || ${O} === false`),P.assign(z,null);return;case"array":P.elseIf((0,s._)`${H} === "string" || ${H} === "number"
|
|
924
|
+
|| ${H} === "boolean" || ${O} === null`).assign(z,(0,s._)`[${O}]`)}}}function R({gen:C,parentData:I,parentDataProperty:D},P){C.if((0,s._)`${I} !== undefined`,()=>C.assign((0,s._)`${I}[${D}]`,P))}function v(C,I,D,P=i.Correct){const O=P===i.Correct?s.operators.EQ:s.operators.NEQ;let A;switch(C){case"null":return(0,s._)`${I} ${O} null`;case"array":A=(0,s._)`Array.isArray(${I})`;break;case"object":A=(0,s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":A=H((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":A=H();break;default:return(0,s._)`typeof ${I} ${O} ${C}`}return P===i.Correct?A:(0,s.not)(A);function H(z=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,z,D?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=v;function T(C,I,D,P){if(C.length===1)return v(C[0],I,D,P);let O;const A=(0,o.toHash)(C);if(A.array&&A.object){const H=(0,s._)`typeof ${I} != "object"`;O=A.null?H:(0,s._)`!${I} || ${H}`,delete A.null,delete A.array,delete A.object}else O=s.nil;A.number&&delete A.integer;for(const H in A)O=(0,s.and)(O,v(H,I,D,P));return O}e.checkDataTypes=T;const $={message:({schema:C})=>`must be ${C}`,params:({schema:C,schemaValue:I})=>typeof C=="string"?(0,s._)`{type: ${C}}`:(0,s._)`{type: ${I}}`};function g(C){const I=k(C);(0,n.reportError)(I,$)}e.reportTypeError=g;function k(C){const{gen:I,data:D,schema:P}=C,O=(0,o.schemaRefOrVal)(C,P,"type");return{gen:I,keyword:"type",data:D,schema:P.type,schemaCode:O,schemaValue:O,parentSchema:P,params:{},it:C}}})(dataType);var defaults={};Object.defineProperty(defaults,"__esModule",{value:!0});defaults.assignDefaults=void 0;const codegen_1$r=codegen,util_1$p=util;function assignDefaults(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)assignDefault(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>assignDefault(e,o,s.default))}defaults.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:s,data:o,opts:i}=e;if(r===void 0)return;const l=(0,codegen_1$r._)`${o}${(0,codegen_1$r.getProperty)(t)}`;if(s){(0,util_1$p.checkStrictMode)(e,`default is ignored for: ${l}`);return}let p=(0,codegen_1$r._)`${l} === undefined`;i.useDefaults==="empty"&&(p=(0,codegen_1$r._)`${p} || ${l} === null || ${l} === ""`),n.if(p,(0,codegen_1$r._)`${l} = ${(0,codegen_1$r.stringify)(r)}`)}var keyword={},code={};Object.defineProperty(code,"__esModule",{value:!0});code.validateUnion=code.validateArray=code.usePattern=code.callValidateCode=code.schemaProperties=code.allSchemaProperties=code.noPropertyInData=code.propertyInData=code.isOwnProperty=code.hasPropFunc=code.reportMissingProp=code.checkMissingProp=code.checkReportMissingProp=void 0;const codegen_1$q=codegen,util_1$o=util,names_1$5=names$1,util_2$1=util;function checkReportMissingProp(e,t){const{gen:r,data:n,it:s}=e;r.if(noPropertyInData(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,codegen_1$q._)`${t}`},!0),e.error()})}code.checkReportMissingProp=checkReportMissingProp;function checkMissingProp({gen:e,data:t,it:{opts:r}},n,s){return(0,codegen_1$q.or)(...n.map(o=>(0,codegen_1$q.and)(noPropertyInData(e,t,o,r.ownProperties),(0,codegen_1$q._)`${s} = ${o}`)))}code.checkMissingProp=checkMissingProp;function reportMissingProp(e,t){e.setParams({missingProperty:t},!0),e.error()}code.reportMissingProp=reportMissingProp;function hasPropFunc(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,codegen_1$q._)`Object.prototype.hasOwnProperty`})}code.hasPropFunc=hasPropFunc;function isOwnProperty(e,t,r){return(0,codegen_1$q._)`${hasPropFunc(e)}.call(${t}, ${r})`}code.isOwnProperty=isOwnProperty;function propertyInData(e,t,r,n){const s=(0,codegen_1$q._)`${t}${(0,codegen_1$q.getProperty)(r)} !== undefined`;return n?(0,codegen_1$q._)`${s} && ${isOwnProperty(e,t,r)}`:s}code.propertyInData=propertyInData;function noPropertyInData(e,t,r,n){const s=(0,codegen_1$q._)`${t}${(0,codegen_1$q.getProperty)(r)} === undefined`;return n?(0,codegen_1$q.or)(s,(0,codegen_1$q.not)(isOwnProperty(e,t,r))):s}code.noPropertyInData=noPropertyInData;function allSchemaProperties(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}code.allSchemaProperties=allSchemaProperties;function schemaProperties(e,t){return allSchemaProperties(t).filter(r=>!(0,util_1$o.alwaysValidSchema)(e,t[r]))}code.schemaProperties=schemaProperties;function callValidateCode({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},l,p,d){const u=d?(0,codegen_1$q._)`${e}, ${t}, ${n}${s}`:t,m=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,o)],[names_1$5.default.parentData,i.parentData],[names_1$5.default.parentDataProperty,i.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];i.opts.dynamicRef&&m.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const w=(0,codegen_1$q._)`${u}, ${r.object(...m)}`;return p!==codegen_1$q.nil?(0,codegen_1$q._)`${l}.call(${p}, ${w})`:(0,codegen_1$q._)`${l}(${w})`}code.callValidateCode=callValidateCode;const newRegExp=(0,codegen_1$q._)`new RegExp`;function usePattern({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,codegen_1$q._)`${s.code==="new RegExp"?newRegExp:(0,util_2$1.useFunc)(e,s)}(${r}, ${n})`})}code.usePattern=usePattern;function validateArray(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const l=t.let("valid",!0);return i(()=>t.assign(l,!1)),l}return t.var(o,!0),i(()=>t.break()),o;function i(l){const p=t.const("len",(0,codegen_1$q._)`${r}.length`);t.forRange("i",0,p,d=>{e.subschema({keyword:n,dataProp:d,dataPropType:util_1$o.Type.Num},o),t.if((0,codegen_1$q.not)(o),l)})}}code.validateArray=validateArray;function validateUnion(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(p=>(0,util_1$o.alwaysValidSchema)(s,p))&&!s.opts.unevaluated)return;const i=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((p,d)=>{const u=e.subschema({keyword:n,schemaProp:d,compositeRule:!0},l);t.assign(i,(0,codegen_1$q._)`${i} || ${l}`),e.mergeValidEvaluated(u,l)||t.if((0,codegen_1$q.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}code.validateUnion=validateUnion;Object.defineProperty(keyword,"__esModule",{value:!0});keyword.validateKeywordUsage=keyword.validSchemaType=keyword.funcKeywordCode=keyword.macroKeywordCode=void 0;const codegen_1$p=codegen,names_1$4=names$1,code_1$9=code,errors_1$1=errors;function macroKeywordCode(e,t){const{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=e,l=t.macro.call(i.self,s,o,i),p=useKeyword(r,n,l);i.opts.validateSchema!==!1&&i.self.validateSchema(l,!0);const d=r.name("valid");e.subschema({schema:l,schemaPath:codegen_1$p.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:p,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}keyword.macroKeywordCode=macroKeywordCode;function funcKeywordCode(e,t){var r;const{gen:n,keyword:s,schema:o,parentSchema:i,$data:l,it:p}=e;checkAsyncKeyword(p,t);const d=!l&&t.compile?t.compile.call(p.self,o,i,p):t.validate,u=useKeyword(n,s,d),m=n.let("valid");e.block$data(m,w),e.ok((r=t.valid)!==null&&r!==void 0?r:m);function w(){if(t.errors===!1)T(),t.modifying&&modifyData(e),$(()=>e.error());else{const g=t.async?R():v();t.modifying&&modifyData(e),$(()=>addErrs(e,g))}}function R(){const g=n.let("ruleErrs",null);return n.try(()=>T((0,codegen_1$p._)`await `),k=>n.assign(m,!1).if((0,codegen_1$p._)`${k} instanceof ${p.ValidationError}`,()=>n.assign(g,(0,codegen_1$p._)`${k}.errors`),()=>n.throw(k))),g}function v(){const g=(0,codegen_1$p._)`${u}.errors`;return n.assign(g,null),T(codegen_1$p.nil),g}function T(g=t.async?(0,codegen_1$p._)`await `:codegen_1$p.nil){const k=p.opts.passContext?names_1$4.default.this:names_1$4.default.self,C=!("compile"in t&&!l||t.schema===!1);n.assign(m,(0,codegen_1$p._)`${g}${(0,code_1$9.callValidateCode)(e,u,k,C)}`,t.modifying)}function $(g){var k;n.if((0,codegen_1$p.not)((k=t.valid)!==null&&k!==void 0?k:m),g)}}keyword.funcKeywordCode=funcKeywordCode;function modifyData(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,codegen_1$p._)`${n.parentData}[${n.parentDataProperty}]`))}function addErrs(e,t){const{gen:r}=e;r.if((0,codegen_1$p._)`Array.isArray(${t})`,()=>{r.assign(names_1$4.default.vErrors,(0,codegen_1$p._)`${names_1$4.default.vErrors} === null ? ${t} : ${names_1$4.default.vErrors}.concat(${t})`).assign(names_1$4.default.errors,(0,codegen_1$p._)`${names_1$4.default.vErrors}.length`),(0,errors_1$1.extendErrors)(e)},()=>e.error())}function checkAsyncKeyword({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function useKeyword(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,codegen_1$p.stringify)(r)})}function validSchemaType(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}keyword.validSchemaType=validSchemaType;function validateKeywordUsage({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");const i=s.dependencies;if(i!=null&&i.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){const p=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(p);else throw new Error(p)}}keyword.validateKeywordUsage=validateKeywordUsage;var subschema={};Object.defineProperty(subschema,"__esModule",{value:!0});subschema.extendSubschemaMode=subschema.extendSubschemaData=subschema.getSubschema=void 0;const codegen_1$o=codegen,util_1$n=util;function getSubschema(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const l=e.schema[t];return r===void 0?{schema:l,schemaPath:(0,codegen_1$o._)`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:l[r],schemaPath:(0,codegen_1$o._)`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}${(0,codegen_1$o.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,util_1$n.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}subschema.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(r!==void 0){const{errorPath:d,dataPathArr:u,opts:m}=t,w=l.let("data",(0,codegen_1$o._)`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0);p(w),e.errorPath=(0,codegen_1$o.str)`${d}${(0,util_1$n.getErrorPath)(r,n,m.jsPropertySyntax)}`,e.parentDataProperty=(0,codegen_1$o._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){const d=s instanceof codegen_1$o.Name?s:l.let("data",s,!0);p(d),i!==void 0&&(e.propertyName=i)}o&&(e.dataTypes=o);function p(d){e.data=d,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,d]}}subschema.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}subschema.extendSubschemaMode=extendSubschemaMode;var resolve$1={},fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r},jsonSchemaTraverse={exports:{}},traverse$1=jsonSchemaTraverse.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};_traverse(t,n,s,e,"",e)};traverse$1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};traverse$1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};traverse$1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};traverse$1.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function _traverse(e,t,r,n,s,o,i,l,p,d){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,i,l,p,d);for(var u in n){var m=n[u];if(Array.isArray(m)){if(u in traverse$1.arrayKeywords)for(var w=0;w<m.length;w++)_traverse(e,t,r,m[w],s+"/"+u+"/"+w,o,s,u,n,w)}else if(u in traverse$1.propsKeywords){if(m&&typeof m=="object")for(var R in m)_traverse(e,t,r,m[R],s+"/"+u+"/"+escapeJsonPtr(R),o,s,u,n,R)}else(u in traverse$1.keywords||e.allKeys&&!(u in traverse$1.skipKeywords))&&_traverse(e,t,r,m,s+"/"+u,o,s,u,n)}r(n,s,o,i,l,p,d)}}function escapeJsonPtr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var jsonSchemaTraverseExports=jsonSchemaTraverse.exports;Object.defineProperty(resolve$1,"__esModule",{value:!0});resolve$1.getSchemaRefs=resolve$1.resolveUrl=resolve$1.normalizeId=resolve$1._getFullPath=resolve$1.getFullPath=resolve$1.inlineRef=void 0;const util_1$m=util,equal$2=fastDeepEqual,traverse=jsonSchemaTraverseExports,SIMPLE_INLINED=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(e,t=!0){return typeof e=="boolean"?!0:t===!0?!hasRef(e):t?countKeys(e)<=t:!1}resolve$1.inlineRef=inlineRef;const REF_KEYWORDS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(e){for(const t in e){if(REF_KEYWORDS.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(hasRef)||typeof r=="object"&&hasRef(r))return!0}return!1}function countKeys(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!SIMPLE_INLINED.has(r)&&(typeof e[r]=="object"&&(0,util_1$m.eachItem)(e[r],n=>t+=countKeys(n)),t===1/0))return 1/0}return t}function getFullPath(e,t="",r){r!==!1&&(t=normalizeId(t));const n=e.parse(t);return _getFullPath(e,n)}resolve$1.getFullPath=getFullPath;function _getFullPath(e,t){return e.serialize(t).split("#")[0]+"#"}resolve$1._getFullPath=_getFullPath;const TRAILING_SLASH_HASH=/#\/?$/;function normalizeId(e){return e?e.replace(TRAILING_SLASH_HASH,""):""}resolve$1.normalizeId=normalizeId;function resolveUrl(e,t,r){return r=normalizeId(r),e.resolve(t,r)}resolve$1.resolveUrl=resolveUrl;const ANCHOR=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=normalizeId(e[r]||t),o={"":s},i=getFullPath(n,s,!1),l={},p=new Set;return traverse(e,{allKeys:!0},(m,w,R,v)=>{if(v===void 0)return;const T=i+w;let $=o[v];typeof m[r]=="string"&&($=g.call(this,m[r])),k.call(this,m.$anchor),k.call(this,m.$dynamicAnchor),o[w]=$;function g(C){const I=this.opts.uriResolver.resolve;if(C=normalizeId($?I($,C):C),p.has(C))throw u(C);p.add(C);let D=this.refs[C];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?d(m,D.schema,C):C!==normalizeId(T)&&(C[0]==="#"?(d(m,l[C],C),l[C]=m):this.refs[C]=T),C}function k(C){if(typeof C=="string"){if(!ANCHOR.test(C))throw new Error(`invalid anchor "${C}"`);g.call(this,`#${C}`)}}}),l;function d(m,w,R){if(w!==void 0&&!equal$2(m,w))throw u(R)}function u(m){return new Error(`reference "${m}" resolves to more than one schema`)}}resolve$1.getSchemaRefs=getSchemaRefs;Object.defineProperty(validate,"__esModule",{value:!0});validate.getData=validate.KeywordCxt=validate.validateFunctionCode=void 0;const boolSchema_1=boolSchema,dataType_1$1=dataType,applicability_1=applicability,dataType_2=dataType,defaults_1=defaults,keyword_1=keyword,subschema_1=subschema,codegen_1$n=codegen,names_1$3=names$1,resolve_1$2=resolve$1,util_1$l=util,errors_1=errors;function validateFunctionCode(e){if(isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))){topSchemaObjCode(e);return}validateFunction(e,()=>(0,boolSchema_1.topBoolOrEmptySchema)(e))}validate.validateFunctionCode=validateFunctionCode;function validateFunction({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${names_1$3.default.valCxt}`,n.$async,()=>{e.code((0,codegen_1$n._)`"use strict"; ${funcSourceUrl(r,s)}`),destructureValCxtES5(e,s),e.code(o)}):e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(s)}`,n.$async,()=>e.code(funcSourceUrl(r,s)).code(o))}function destructureValCxt(e){return(0,codegen_1$n._)`{${names_1$3.default.instancePath}="", ${names_1$3.default.parentData}, ${names_1$3.default.parentDataProperty}, ${names_1$3.default.rootData}=${names_1$3.default.data}${e.dynamicRef?(0,codegen_1$n._)`, ${names_1$3.default.dynamicAnchors}={}`:codegen_1$n.nil}}={}`}function destructureValCxtES5(e,t){e.if(names_1$3.default.valCxt,()=>{e.var(names_1$3.default.instancePath,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.instancePath}`),e.var(names_1$3.default.parentData,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentData}`),e.var(names_1$3.default.parentDataProperty,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentDataProperty}`),e.var(names_1$3.default.rootData,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.rootData}`),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.dynamicAnchors}`)},()=>{e.var(names_1$3.default.instancePath,(0,codegen_1$n._)`""`),e.var(names_1$3.default.parentData,(0,codegen_1$n._)`undefined`),e.var(names_1$3.default.parentDataProperty,(0,codegen_1$n._)`undefined`),e.var(names_1$3.default.rootData,names_1$3.default.data),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,(0,codegen_1$n._)`{}`)})}function topSchemaObjCode(e){const{schema:t,opts:r,gen:n}=e;validateFunction(e,()=>{r.$comment&&t.$comment&&commentKeyword(e),checkNoDefault(e),n.let(names_1$3.default.vErrors,null),n.let(names_1$3.default.errors,0),r.unevaluated&&resetEvaluated(e),typeAndKeywords(e),returnResults(e)})}function resetEvaluated(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,codegen_1$n._)`${r}.evaluated`),t.if((0,codegen_1$n._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,codegen_1$n._)`${e.evaluated}.props`,(0,codegen_1$n._)`undefined`)),t.if((0,codegen_1$n._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,codegen_1$n._)`${e.evaluated}.items`,(0,codegen_1$n._)`undefined`))}function funcSourceUrl(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,codegen_1$n._)`/*# sourceURL=${r} */`:codegen_1$n.nil}function subschemaCode(e,t){if(isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))){subSchemaObjCode(e,t);return}(0,boolSchema_1.boolOrEmptySchema)(e,t)}function schemaCxtHasRules({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function isSchemaObj(e){return typeof e.schema!="boolean"}function subSchemaObjCode(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&commentKeyword(e),updateContext(e),checkAsyncSchema(e);const o=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,o),n.var(t,(0,codegen_1$n._)`${o} === ${names_1$3.default.errors}`)}function checkKeywords(e){(0,util_1$l.checkUnknownRules)(e),checkRefsAndKeywords(e)}function typeAndKeywords(e,t){if(e.opts.jtd)return schemaKeywords(e,[],!1,t);const r=(0,dataType_1$1.getSchemaTypes)(e.schema),n=(0,dataType_1$1.coerceAndCheckDataType)(e,r);schemaKeywords(e,r,!n,t)}function checkRefsAndKeywords(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,util_1$l.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function checkNoDefault(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,util_1$l.checkStrictMode)(e,"default is ignored in the schema root")}function updateContext(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,resolve_1$2.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function checkAsyncSchema(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const o=r.$comment;if(s.$comment===!0)e.code((0,codegen_1$n._)`${names_1$3.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){const i=(0,codegen_1$n.str)`${n}/$comment`,l=e.scopeValue("root",{ref:t.root});e.code((0,codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${o}, ${i}, ${l}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0,codegen_1$n._)`${names_1$3.default.errors} === 0`,()=>t.return(names_1$3.default.data),()=>t.throw((0,codegen_1$n._)`new ${s}(${names_1$3.default.vErrors})`)):(t.assign((0,codegen_1$n._)`${n}.errors`,names_1$3.default.vErrors),o.unevaluated&&assignEvaluated(e),t.return((0,codegen_1$n._)`${names_1$3.default.errors} === 0`))}function assignEvaluated({gen:e,evaluated:t,props:r,items:n}){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)}function schemaKeywords(e,t,r,n){const{gen:s,schema:o,data:i,allErrors:l,opts:p,self:d}=e,{RULES:u}=d;if(o.$ref&&(p.ignoreKeywordsWithRef||!(0,util_1$l.schemaHasRulesButRef)(o,u))){s.block(()=>keywordCode(e,"$ref",u.all.$ref.definition));return}p.jtd||checkStrictTypes(e,t),s.block(()=>{for(const w of u.rules)m(w);m(u.post)});function m(w){(0,applicability_1.shouldUseGroup)(o,w)&&(w.type?(s.if((0,dataType_2.checkDataType)(w.type,i,p.strictNumbers)),iterateKeywords(e,w),t.length===1&&t[0]===w.type&&r&&(s.else(),(0,dataType_2.reportTypeError)(e)),s.endIf()):iterateKeywords(e,w),l||s.if((0,codegen_1$n._)`${names_1$3.default.errors} === ${n||0}`))}}function iterateKeywords(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,defaults_1.assignDefaults)(e,t.type),r.block(()=>{for(const o of t.rules)(0,applicability_1.shouldUseRule)(n,o)&&keywordCode(e,o.keyword,o.definition,t.type)})}function checkStrictTypes(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(checkContextTypes(e,t),e.opts.allowUnionTypes||checkMultipleTypes(e,t),checkKeywordTypes(e,e.dataTypes))}function checkContextTypes(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{includesType(e.dataTypes,r)||strictTypesError(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),narrowSchemaTypes(e,t)}}function checkMultipleTypes(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&strictTypesError(e,"use allowUnionTypes to allow union type keyword")}function checkKeywordTypes(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,applicability_1.shouldUseRule)(e.schema,s)){const{type:o}=s.definition;o.length&&!o.some(i=>hasApplicableType(t,i))&&strictTypesError(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function hasApplicableType(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function includesType(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function narrowSchemaTypes(e,t){const r=[];for(const n of e.dataTypes)includesType(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function strictTypesError(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,util_1$l.checkStrictMode)(e,t,e.opts.strictTypes)}class KeywordCxt{constructor(t,r,n){if((0,keyword_1.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,util_1$l.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",getData(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,keyword_1.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",names_1$3.default.errors))}result(t,r,n){this.failResult((0,codegen_1$n.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,codegen_1$n.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:r}=this;this.fail((0,codegen_1$n._)`${r} !== undefined && (${(0,codegen_1$n.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?errors_1.reportExtraError:errors_1.reportError)(this,this.def.error,r)}$dataError(){(0,errors_1.reportError)(this,this.def.$dataError||errors_1.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,errors_1.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=codegen_1$n.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=codegen_1$n.nil,r=codegen_1$n.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,codegen_1$n.or)((0,codegen_1$n._)`${s} === undefined`,r)),t!==codegen_1$n.nil&&n.assign(t,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==codegen_1$n.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,codegen_1$n.or)(i(),l());function i(){if(n.length){if(!(r instanceof codegen_1$n.Name))throw new Error("ajv implementation error");const p=Array.isArray(n)?n:[n];return(0,codegen_1$n._)`${(0,dataType_2.checkDataTypes)(p,r,o.opts.strictNumbers,dataType_2.DataType.Wrong)}`}return codegen_1$n.nil}function l(){if(s.validateSchema){const p=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,codegen_1$n._)`!${p}(${r})`}return codegen_1$n.nil}}subschema(t,r){const n=(0,subschema_1.getSubschema)(this.it,t);(0,subschema_1.extendSubschemaData)(n,this.it,t),(0,subschema_1.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return subschemaCode(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=util_1$l.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=util_1$l.mergeEvaluated.items(s,t.items,n.items,r)))}mergeValidEvaluated(t,r){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(t,codegen_1$n.Name)),!0}}validate.KeywordCxt=KeywordCxt;function keywordCode(e,t,r,n){const s=new KeywordCxt(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,keyword_1.funcKeywordCode)(s,r):"macro"in r?(0,keyword_1.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,keyword_1.funcKeywordCode)(s,r)}const JSON_POINTER=/^\/(?:[^~]|~0|~1)*$/,RELATIVE_JSON_POINTER=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return names_1$3.default.rootData;if(e[0]==="/"){if(!JSON_POINTER.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=names_1$3.default.rootData}else{const d=RELATIVE_JSON_POINTER.exec(e);if(!d)throw new Error(`Invalid JSON-pointer: ${e}`);const u=+d[1];if(s=d[2],s==="#"){if(u>=t)throw new Error(p("property/index",u));return n[t-u]}if(u>t)throw new Error(p("data",u));if(o=r[t-u],!s)return o}let i=o;const l=s.split("/");for(const d of l)d&&(o=(0,codegen_1$n._)`${o}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(d))}`,i=(0,codegen_1$n._)`${i} && ${o}`);return i;function p(d,u){return`Cannot access ${d} ${u} levels up, current level is ${t}`}}validate.getData=getData;var validation_error={};Object.defineProperty(validation_error,"__esModule",{value:!0});class ValidationError extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}validation_error.default=ValidationError;var ref_error={};Object.defineProperty(ref_error,"__esModule",{value:!0});const resolve_1$1=resolve$1;class MissingRefError extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,resolve_1$1.resolveUrl)(t,r,n),this.missingSchema=(0,resolve_1$1.normalizeId)((0,resolve_1$1.getFullPath)(t,this.missingRef))}}ref_error.default=MissingRefError;var compile={};Object.defineProperty(compile,"__esModule",{value:!0});compile.resolveSchema=compile.getCompilingSchema=compile.resolveRef=compile.compileSchema=compile.SchemaEnv=void 0;const codegen_1$m=codegen,validation_error_1=validation_error,names_1$2=names$1,resolve_1=resolve$1,util_1$k=util,validate_1$1=validate;class SchemaEnv{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,resolve_1.normalizeId)(n==null?void 0:n[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n==null?void 0:n.$async,this.refs={}}}compile.SchemaEnv=SchemaEnv;function compileSchema(e){const t=getCompilingSchema.call(this,e);if(t)return t;const r=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let l;e.$async&&(l=i.scopeValue("Error",{ref:validation_error_1.default,code:(0,codegen_1$m._)`require("ajv/dist/runtime/validation_error").default`}));const p=i.scopeName("validate");e.validateName=p;const d={gen:i,allErrors:this.opts.allErrors,data:names_1$2.default.data,parentData:names_1$2.default.parentData,parentDataProperty:names_1$2.default.parentDataProperty,dataNames:[names_1$2.default.data],dataPathArr:[codegen_1$m.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,codegen_1$m.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:l,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:codegen_1$m.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,codegen_1$m._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(e),(0,validate_1$1.validateFunctionCode)(d),i.optimize(this.opts.code.optimize);const m=i.toString();u=`${i.scopeRefs(names_1$2.default.scope)}return ${m}`,this.opts.code.process&&(u=this.opts.code.process(u,e));const R=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,u)(this,this.scope.get());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:m,scopeValues:i._values}),this.opts.unevaluated){const{props:v,items:T}=d;R.evaluated={props:v instanceof codegen_1$m.Name?void 0:v,items:T instanceof codegen_1$m.Name?void 0:T,dynamicProps:v instanceof codegen_1$m.Name,dynamicItems:T instanceof codegen_1$m.Name},R.source&&(R.source.evaluated=(0,codegen_1$m.stringify)(R.evaluated))}return e.validate=R,e}catch(m){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),m}finally{this._compilations.delete(e)}}compile.compileSchema=compileSchema;function resolveRef(e,t,r){var n;r=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=resolve.call(this,e,r);if(o===void 0){const i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;i&&(o=new SchemaEnv({schema:i,schemaId:l,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=inlineOrCompile.call(this,o)}compile.resolveRef=resolveRef;function inlineOrCompile(e){return(0,resolve_1.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:compileSchema.call(this,e)}function getCompilingSchema(e){for(const t of this._compilations)if(sameSchemaEnv(t,e))return t}compile.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function resolve(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||resolveSchema.call(this,e,t)}function resolveSchema(e,t){const r=this.opts.uriResolver.parse(t),n=(0,resolve_1._getFullPath)(this.opts.uriResolver,r);let s=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return getJsonPointer.call(this,r,e);const o=(0,resolve_1.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const l=resolveSchema.call(this,e,i);return typeof(l==null?void 0:l.schema)!="object"?void 0:getJsonPointer.call(this,r,l)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||compileSchema.call(this,i),o===(0,resolve_1.normalizeId)(t)){const{schema:l}=i,{schemaId:p}=this.opts,d=l[p];return d&&(s=(0,resolve_1.resolveUrl)(this.opts.uriResolver,s,d)),new SchemaEnv({schema:l,schemaId:p,root:e,baseId:s})}return getJsonPointer.call(this,r,i)}}compile.resolveSchema=resolveSchema;const PREVENT_SCOPE_CHANGE=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const l of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const p=r[(0,util_1$k.unescapeFragment)(l)];if(p===void 0)return;r=p;const d=typeof r=="object"&&r[this.opts.schemaId];!PREVENT_SCOPE_CHANGE.has(l)&&d&&(t=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,d))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,util_1$k.schemaHasRulesButRef)(r,this.RULES)){const l=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=resolveSchema.call(this,n,l)}const{schemaId:i}=this.opts;if(o=o||new SchemaEnv({schema:r,schemaId:i,root:n,baseId:t}),o.schema!==o.root.schema)return o}const $id$1="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description="Meta-schema for $data reference (JSON AnySchema extension proposal)",type$1="object",required$1=["$data"],properties$2={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties$1=!1,require$$9={$id:$id$1,description,type:type$1,required:required$1,properties:properties$2,additionalProperties:additionalProperties$1};var uri$1={},uri_all={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(e,t){(function(r,n){n(t)})(commonjsGlobal,function(r){function n(){for(var f=arguments.length,c=Array(f),_=0;_<f;_++)c[_]=arguments[_];if(c.length>1){c[0]=c[0].slice(0,-1);for(var S=c.length-1,E=1;E<S;++E)c[E]=c[E].slice(1,-1);return c[S]=c[S].slice(1),c.join("")}else return c[0]}function s(f){return"(?:"+f+")"}function o(f){return f===void 0?"undefined":f===null?"null":Object.prototype.toString.call(f).split(" ").pop().split("]").shift().toLowerCase()}function i(f){return f.toUpperCase()}function l(f){return f!=null?f instanceof Array?f:typeof f.length!="number"||f.split||f.setInterval||f.call?[f]:Array.prototype.slice.call(f):[]}function p(f,c){var _=f;if(c)for(var S in c)_[S]=c[S];return _}function d(f){var c="[A-Za-z]",_="[0-9]",S=n(_,"[A-Fa-f]"),E=s(s("%[EFef]"+S+"%"+S+S+"%"+S+S)+"|"+s("%[89A-Fa-f]"+S+"%"+S+S)+"|"+s("%"+S+S)),U="[\\:\\/\\?\\#\\[\\]\\@]",x="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",J=n(U,x),Y=f?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",se=f?"[\\uE000-\\uF8FF]":"[]",B=n(c,_,"[\\-\\.\\_\\~]",Y);s(c+n(c,_,"[\\+\\-\\.]")+"*"),s(s(E+"|"+n(B,x,"[\\:]"))+"*");var Q=s(s("25[0-5]")+"|"+s("2[0-4]"+_)+"|"+s("1"+_+_)+"|"+s("0?[1-9]"+_)+"|0?0?"+_),oe=s(Q+"\\."+Q+"\\."+Q+"\\."+Q),V=s(S+"{1,4}"),X=s(s(V+"\\:"+V)+"|"+oe),ae=s(s(V+"\\:")+"{6}"+X),ee=s("\\:\\:"+s(V+"\\:")+"{5}"+X),Ee=s(s(V)+"?\\:\\:"+s(V+"\\:")+"{4}"+X),ge=s(s(s(V+"\\:")+"{0,1}"+V)+"?\\:\\:"+s(V+"\\:")+"{3}"+X),$e=s(s(s(V+"\\:")+"{0,2}"+V)+"?\\:\\:"+s(V+"\\:")+"{2}"+X),We=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,ge,$e,We,Ie,fe,ye].join("|")),ve=s(s(B+"|"+E)+"+");s("[vV]"+S+"+\\."+n(B,x,"[\\:]")+"+"),s(s(E+"|"+n(B,x))+"*");var ct=s(E+"|"+n(B,x,"[\\:\\@]"));return s(s(E+"|"+n(B,x,"[\\@]"))+"+"),s(s(ct+"|"+n("[\\/\\?]",se))+"*"),{NOT_SCHEME:new RegExp(n("[^]",c,_,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",B,x),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",B,x),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",B,x),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",B,x),"g"),NOT_QUERY:new RegExp(n("[^\\%]",B,x,"[\\:\\@\\/\\?]",se),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",B,x,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",B,x),"g"),UNRESERVED:new RegExp(B,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",B,J),"g"),PCT_ENCODED:new RegExp(E,"g"),IPV4ADDRESS:new RegExp("^("+oe+")$"),IPV6ADDRESS:new RegExp("^\\[?("+je+")"+s(s("\\%25|\\%(?!"+S+"{2})")+"("+ve+")")+"?\\]?$")}}var u=d(!1),m=d(!0),w=function(){function f(c,_){var S=[],E=!0,U=!1,x=void 0;try{for(var J=c[Symbol.iterator](),Y;!(E=(Y=J.next()).done)&&(S.push(Y.value),!(_&&S.length===_));E=!0);}catch(se){U=!0,x=se}finally{try{!E&&J.return&&J.return()}finally{if(U)throw x}}return S}return function(c,_){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return f(c,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),R=function(f){if(Array.isArray(f)){for(var c=0,_=Array(f.length);c<f.length;c++)_[c]=f[c];return _}else return Array.from(f)},v=2147483647,T=36,$=1,g=26,k=38,C=700,I=72,D=128,P="-",O=/^xn--/,A=/[^\0-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,z={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},re=T-$,K=Math.floor,ue=String.fromCharCode;function ie(f){throw new RangeError(z[f])}function ke(f,c){for(var _=[],S=f.length;S--;)_[S]=c(f[S]);return _}function Ce(f,c){var _=f.split("@"),S="";_.length>1&&(S=_[0]+"@",f=_[1]),f=f.replace(H,".");var E=f.split("."),U=ke(E,c).join(".");return S+U}function qe(f){for(var c=[],_=0,S=f.length;_<S;){var E=f.charCodeAt(_++);if(E>=55296&&E<=56319&&_<S){var U=f.charCodeAt(_++);(U&64512)==56320?c.push(((E&1023)<<10)+(U&1023)+65536):(c.push(E),_--)}else c.push(E)}return c}var et=function(c){return String.fromCodePoint.apply(String,R(c))},Me=function(c){return c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:T},F=function(c,_){return c+22+75*(c<26)-((_!=0)<<5)},y=function(c,_,S){var E=0;for(c=S?K(c/C):c>>1,c+=K(c/_);c>re*g>>1;E+=T)c=K(c/re);return K(E+(re+1)*c/(c+k))},j=function(c){var _=[],S=c.length,E=0,U=D,x=I,J=c.lastIndexOf(P);J<0&&(J=0);for(var Y=0;Y<J;++Y)c.charCodeAt(Y)>=128&&ie("not-basic"),_.push(c.charCodeAt(Y));for(var se=J>0?J+1:0;se<S;){for(var B=E,Q=1,oe=T;;oe+=T){se>=S&&ie("invalid-input");var V=Me(c.charCodeAt(se++));(V>=T||V>K((v-E)/Q))&&ie("overflow"),E+=V*Q;var X=oe<=x?$:oe>=x+g?g:oe-x;if(V<X)break;var ae=T-X;Q>K(v/ae)&&ie("overflow"),Q*=ae}var ee=_.length+1;x=y(E-B,ee,B==0),K(E/ee)>v-U&&ie("overflow"),U+=K(E/ee),E%=ee,_.splice(E++,0,U)}return String.fromCodePoint.apply(String,_)},b=function(c){var _=[];c=qe(c);var S=c.length,E=D,U=0,x=I,J=!0,Y=!1,se=void 0;try{for(var B=c[Symbol.iterator](),Q;!(J=(Q=B.next()).done);J=!0){var oe=Q.value;oe<128&&_.push(ue(oe))}}catch(lt){Y=!0,se=lt}finally{try{!J&&B.return&&B.return()}finally{if(Y)throw se}}var V=_.length,X=V;for(V&&_.push(P);X<S;){var ae=v,ee=!0,Ee=!1,ge=void 0;try{for(var $e=c[Symbol.iterator](),We;!(ee=(We=$e.next()).done);ee=!0){var Ie=We.value;Ie>=E&&Ie<ae&&(ae=Ie)}}catch(lt){Ee=!0,ge=lt}finally{try{!ee&&$e.return&&$e.return()}finally{if(Ee)throw ge}}var fe=X+1;ae-E>K((v-U)/fe)&&ie("overflow"),U+=(ae-E)*fe,E=ae;var ye=!0,je=!1,ve=void 0;try{for(var ct=c[Symbol.iterator](),xt;!(ye=(xt=ct.next()).done);ye=!0){var Lt=xt.value;if(Lt<E&&++U>v&&ie("overflow"),Lt==E){for(var pt=U,ft=T;;ft+=T){var ht=ft<=x?$:ft>=x+g?g:ft-x;if(pt<ht)break;var Ht=pt-ht,Vt=T-ht;_.push(ue(F(ht+Ht%Vt,0))),pt=K(Ht/Vt)}_.push(ue(F(pt,0))),x=y(U,fe,X==V),U=0,++X}}}catch(lt){je=!0,ve=lt}finally{try{!ye&&ct.return&&ct.return()}finally{if(je)throw ve}}++U,++E}return _.join("")},a=function(c){return Ce(c,function(_){return O.test(_)?j(_.slice(4).toLowerCase()):_})},h=function(c){return Ce(c,function(_){return A.test(_)?"xn--"+b(_):_})},N={version:"2.1.0",ucs2:{decode:qe,encode:et},decode:j,encode:b,toASCII:h,toUnicode:a},q={};function M(f){var c=f.charCodeAt(0),_=void 0;return c<16?_="%0"+c.toString(16).toUpperCase():c<128?_="%"+c.toString(16).toUpperCase():c<2048?_="%"+(c>>6|192).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase():_="%"+(c>>12|224).toString(16).toUpperCase()+"%"+(c>>6&63|128).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase(),_}function W(f){for(var c="",_=0,S=f.length;_<S;){var E=parseInt(f.substr(_+1,2),16);if(E<128)c+=String.fromCharCode(E),_+=3;else if(E>=194&&E<224){if(S-_>=6){var U=parseInt(f.substr(_+4,2),16);c+=String.fromCharCode((E&31)<<6|U&63)}else c+=f.substr(_,6);_+=6}else if(E>=224){if(S-_>=9){var x=parseInt(f.substr(_+4,2),16),J=parseInt(f.substr(_+7,2),16);c+=String.fromCharCode((E&15)<<12|(x&63)<<6|J&63)}else c+=f.substr(_,9);_+=9}else c+=f.substr(_,3),_+=3}return c}function G(f,c){function _(S){var E=W(S);return E.match(c.UNRESERVED)?E:S}return f.scheme&&(f.scheme=String(f.scheme).replace(c.PCT_ENCODED,_).toLowerCase().replace(c.NOT_SCHEME,"")),f.userinfo!==void 0&&(f.userinfo=String(f.userinfo).replace(c.PCT_ENCODED,_).replace(c.NOT_USERINFO,M).replace(c.PCT_ENCODED,i)),f.host!==void 0&&(f.host=String(f.host).replace(c.PCT_ENCODED,_).toLowerCase().replace(c.NOT_HOST,M).replace(c.PCT_ENCODED,i)),f.path!==void 0&&(f.path=String(f.path).replace(c.PCT_ENCODED,_).replace(f.scheme?c.NOT_PATH:c.NOT_PATH_NOSCHEME,M).replace(c.PCT_ENCODED,i)),f.query!==void 0&&(f.query=String(f.query).replace(c.PCT_ENCODED,_).replace(c.NOT_QUERY,M).replace(c.PCT_ENCODED,i)),f.fragment!==void 0&&(f.fragment=String(f.fragment).replace(c.PCT_ENCODED,_).replace(c.NOT_FRAGMENT,M).replace(c.PCT_ENCODED,i)),f}function ne(f){return f.replace(/^0*(.*)/,"$1")||"0"}function he(f,c){var _=f.match(c.IPV4ADDRESS)||[],S=w(_,2),E=S[1];return E?E.split(".").map(ne).join("."):f}function Ue(f,c){var _=f.match(c.IPV6ADDRESS)||[],S=w(_,3),E=S[1],U=S[2];if(E){for(var x=E.toLowerCase().split("::").reverse(),J=w(x,2),Y=J[0],se=J[1],B=se?se.split(":").map(ne):[],Q=Y.split(":").map(ne),oe=c.IPV4ADDRESS.test(Q[Q.length-1]),V=oe?7:8,X=Q.length-V,ae=Array(V),ee=0;ee<V;++ee)ae[ee]=B[ee]||Q[X+ee]||"";oe&&(ae[V-1]=he(ae[V-1],c));var Ee=ae.reduce(function(fe,ye,je){if(!ye||ye==="0"){var ve=fe[fe.length-1];ve&&ve.index+ve.length===je?ve.length++:fe.push({index:je,length:1})}return fe},[]),ge=Ee.sort(function(fe,ye){return ye.length-fe.length})[0],$e=void 0;if(ge&&ge.length>1){var We=ae.slice(0,ge.index),Ie=ae.slice(ge.index+ge.length);$e=We.join(":")+"::"+Ie.join(":")}else $e=ae.join(":");return U&&($e+="%"+U),$e}else return f}var tt=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,rt="".match(/(){0}/)[1]===void 0;function de(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={},S=c.iri!==!1?m:u;c.reference==="suffix"&&(f=(c.scheme?c.scheme+":":"")+"//"+f);var E=f.match(tt);if(E){rt?(_.scheme=E[1],_.userinfo=E[3],_.host=E[4],_.port=parseInt(E[5],10),_.path=E[6]||"",_.query=E[7],_.fragment=E[8],isNaN(_.port)&&(_.port=E[5])):(_.scheme=E[1]||void 0,_.userinfo=f.indexOf("@")!==-1?E[3]:void 0,_.host=f.indexOf("//")!==-1?E[4]:void 0,_.port=parseInt(E[5],10),_.path=E[6]||"",_.query=f.indexOf("?")!==-1?E[7]:void 0,_.fragment=f.indexOf("#")!==-1?E[8]:void 0,isNaN(_.port)&&(_.port=f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?E[4]:void 0)),_.host&&(_.host=Ue(he(_.host,S),S)),_.scheme===void 0&&_.userinfo===void 0&&_.host===void 0&&_.port===void 0&&!_.path&&_.query===void 0?_.reference="same-document":_.scheme===void 0?_.reference="relative":_.fragment===void 0?_.reference="absolute":_.reference="uri",c.reference&&c.reference!=="suffix"&&c.reference!==_.reference&&(_.error=_.error||"URI is not a "+c.reference+" reference.");var U=q[(c.scheme||_.scheme||"").toLowerCase()];if(!c.unicodeSupport&&(!U||!U.unicodeSupport)){if(_.host&&(c.domainHost||U&&U.domainHost))try{_.host=N.toASCII(_.host.replace(S.PCT_ENCODED,W).toLowerCase())}catch(x){_.error=_.error||"Host's domain name can not be converted to ASCII via punycode: "+x}G(_,u)}else G(_,S);U&&U.parse&&U.parse(_,c)}else _.error=_.error||"URI can not be parsed.";return _}function nt(f,c){var _=c.iri!==!1?m:u,S=[];return f.userinfo!==void 0&&(S.push(f.userinfo),S.push("@")),f.host!==void 0&&S.push(Ue(he(String(f.host),_),_).replace(_.IPV6ADDRESS,function(E,U,x){return"["+U+(x?"%25"+x:"")+"]"})),(typeof f.port=="number"||typeof f.port=="string")&&(S.push(":"),S.push(String(f.port))),S.length?S.join(""):void 0}var xe=/^\.\.?\//,Le=/^\/\.(\/|$)/,He=/^\/\.\.(\/|$)/,st=/^\/?(?:.|\n)*?(?=\/|$)/;function me(f){for(var c=[];f.length;)if(f.match(xe))f=f.replace(xe,"");else if(f.match(Le))f=f.replace(Le,"/");else if(f.match(He))f=f.replace(He,"/"),c.pop();else if(f==="."||f==="..")f="";else{var _=f.match(st);if(_){var S=_[0];f=f.slice(S.length),c.push(S)}else throw new Error("Unexpected dot segment condition")}return c.join("")}function le(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=c.iri?m:u,S=[],E=q[(c.scheme||f.scheme||"").toLowerCase()];if(E&&E.serialize&&E.serialize(f,c),f.host&&!_.IPV6ADDRESS.test(f.host)){if(c.domainHost||E&&E.domainHost)try{f.host=c.iri?N.toUnicode(f.host):N.toASCII(f.host.replace(_.PCT_ENCODED,W).toLowerCase())}catch(J){f.error=f.error||"Host's domain name can not be converted to "+(c.iri?"Unicode":"ASCII")+" via punycode: "+J}}G(f,_),c.reference!=="suffix"&&f.scheme&&(S.push(f.scheme),S.push(":"));var U=nt(f,c);if(U!==void 0&&(c.reference!=="suffix"&&S.push("//"),S.push(U),f.path&&f.path.charAt(0)!=="/"&&S.push("/")),f.path!==void 0){var x=f.path;!c.absolutePath&&(!E||!E.absolutePath)&&(x=me(x)),U===void 0&&(x=x.replace(/^\/\//,"/%2F")),S.push(x)}return f.query!==void 0&&(S.push("?"),S.push(f.query)),f.fragment!==void 0&&(S.push("#"),S.push(f.fragment)),S.join("")}function Ve(f,c){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=arguments[3],E={};return S||(f=de(le(f,_),_),c=de(le(c,_),_)),_=_||{},!_.tolerant&&c.scheme?(E.scheme=c.scheme,E.userinfo=c.userinfo,E.host=c.host,E.port=c.port,E.path=me(c.path||""),E.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(E.userinfo=c.userinfo,E.host=c.host,E.port=c.port,E.path=me(c.path||""),E.query=c.query):(c.path?(c.path.charAt(0)==="/"?E.path=me(c.path):((f.userinfo!==void 0||f.host!==void 0||f.port!==void 0)&&!f.path?E.path="/"+c.path:f.path?E.path=f.path.slice(0,f.path.lastIndexOf("/")+1)+c.path:E.path=c.path,E.path=me(E.path)),E.query=c.query):(E.path=f.path,c.query!==void 0?E.query=c.query:E.query=f.query),E.userinfo=f.userinfo,E.host=f.host,E.port=f.port),E.scheme=f.scheme),E.fragment=c.fragment,E}function ot(f,c,_){var S=p({scheme:"null"},_);return le(Ve(de(f,S),de(c,S),S,!0),S)}function Oe(f,c){return typeof f=="string"?f=le(de(f,c),c):o(f)==="object"&&(f=de(le(f,c),c)),f}function it(f,c,_){return typeof f=="string"?f=le(de(f,_),_):o(f)==="object"&&(f=le(f,_)),typeof c=="string"?c=le(de(c,_),_):o(c)==="object"&&(c=le(c,_)),f===c}function ut(f,c){return f&&f.toString().replace(!c||!c.iri?u.ESCAPE:m.ESCAPE,M)}function pe(f,c){return f&&f.toString().replace(!c||!c.iri?u.PCT_ENCODED:m.PCT_ENCODED,W)}var Ne={scheme:"http",domainHost:!0,parse:function(c,_){return c.host||(c.error=c.error||"HTTP URIs must have a host."),c},serialize:function(c,_){var S=String(c.scheme).toLowerCase()==="https";return(c.port===(S?443:80)||c.port==="")&&(c.port=void 0),c.path||(c.path="/"),c}},It={scheme:"https",domainHost:Ne.domainHost,parse:Ne.parse,serialize:Ne.serialize};function jt(f){return typeof f.secure=="boolean"?f.secure:String(f.scheme).toLowerCase()==="wss"}var at={scheme:"ws",domainHost:!0,parse:function(c,_){var S=c;return S.secure=jt(S),S.resourceName=(S.path||"/")+(S.query?"?"+S.query:""),S.path=void 0,S.query=void 0,S},serialize:function(c,_){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){var S=c.resourceName.split("?"),E=w(S,2),U=E[0],x=E[1];c.path=U&&U!=="/"?U:void 0,c.query=x,c.resourceName=void 0}return c.fragment=void 0,c}},At={scheme:"wss",domainHost:at.domainHost,parse:at.parse,serialize:at.serialize},or={},Dt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",_e="[0-9A-Fa-f]",ir=s(s("%[EFef]"+_e+"%"+_e+_e+"%"+_e+_e)+"|"+s("%[89A-Fa-f]"+_e+"%"+_e+_e)+"|"+s("%"+_e+_e)),ar="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",cr="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",lr=n(cr,'[\\"\\\\]'),dr="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ur=new RegExp(Dt,"g"),ze=new RegExp(ir,"g"),pr=new RegExp(n("[^]",ar,"[\\.]",'[\\"]',lr),"g"),Ft=new RegExp(n("[^]",Dt,dr),"g"),fr=Ft;function Ot(f){var c=W(f);return c.match(ur)?c:f}var qt={scheme:"mailto",parse:function(c,_){var S=c,E=S.to=S.path?S.path.split(","):[];if(S.path=void 0,S.query){for(var U=!1,x={},J=S.query.split("&"),Y=0,se=J.length;Y<se;++Y){var B=J[Y].split("=");switch(B[0]){case"to":for(var Q=B[1].split(","),oe=0,V=Q.length;oe<V;++oe)E.push(Q[oe]);break;case"subject":S.subject=pe(B[1],_);break;case"body":S.body=pe(B[1],_);break;default:U=!0,x[pe(B[0],_)]=pe(B[1],_);break}}U&&(S.headers=x)}S.query=void 0;for(var X=0,ae=E.length;X<ae;++X){var ee=E[X].split("@");if(ee[0]=pe(ee[0]),_.unicodeSupport)ee[1]=pe(ee[1],_).toLowerCase();else try{ee[1]=N.toASCII(pe(ee[1],_).toLowerCase())}catch(Ee){S.error=S.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ee}E[X]=ee.join("@")}return S},serialize:function(c,_){var S=c,E=l(c.to);if(E){for(var U=0,x=E.length;U<x;++U){var J=String(E[U]),Y=J.lastIndexOf("@"),se=J.slice(0,Y).replace(ze,Ot).replace(ze,i).replace(pr,M),B=J.slice(Y+1);try{B=_.iri?N.toUnicode(B):N.toASCII(pe(B,_).toLowerCase())}catch(X){S.error=S.error||"Email address's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+X}E[U]=se+"@"+B}S.path=E.join(",")}var Q=c.headers=c.headers||{};c.subject&&(Q.subject=c.subject),c.body&&(Q.body=c.body);var oe=[];for(var V in Q)Q[V]!==or[V]&&oe.push(V.replace(ze,Ot).replace(ze,i).replace(Ft,M)+"="+Q[V].replace(ze,Ot).replace(ze,i).replace(fr,M));return oe.length&&(S.query=oe.join("&")),S}},hr=/^([^\:]+)\:(.*)/,Mt={scheme:"urn",parse:function(c,_){var S=c.path&&c.path.match(hr),E=c;if(S){var U=_.scheme||E.scheme||"urn",x=S[1].toLowerCase(),J=S[2],Y=U+":"+(_.nid||x),se=q[Y];E.nid=x,E.nss=J,E.path=void 0,se&&(E=se.parse(E,_))}else E.error=E.error||"URN can not be parsed.";return E},serialize:function(c,_){var S=_.scheme||c.scheme||"urn",E=c.nid,U=S+":"+(_.nid||E),x=q[U];x&&(c=x.serialize(c,_));var J=c,Y=c.nss;return J.path=(E||_.nid)+":"+Y,J}},mr=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ut={scheme:"urn:uuid",parse:function(c,_){var S=c;return S.uuid=S.nss,S.nss=void 0,!_.tolerant&&(!S.uuid||!S.uuid.match(mr))&&(S.error=S.error||"UUID is not valid."),S},serialize:function(c,_){var S=c;return S.nss=(c.uuid||"").toLowerCase(),S}};q[Ne.scheme]=Ne,q[It.scheme]=It,q[at.scheme]=at,q[At.scheme]=At,q[qt.scheme]=qt,q[Mt.scheme]=Mt,q[Ut.scheme]=Ut,r.SCHEMES=q,r.pctEncChar=M,r.pctDecChars=W,r.parse=de,r.removeDotSegments=me,r.serialize=le,r.resolveComponents=Ve,r.resolve=ot,r.normalize=Oe,r.equal=it,r.escapeComponent=ut,r.unescapeComponent=pe,Object.defineProperty(r,"__esModule",{value:!0})})})(uri_all,uri_all.exports);var uri_allExports=uri_all.exports;Object.defineProperty(uri$1,"__esModule",{value:!0});const uri=uri_allExports;uri.code='require("ajv/dist/runtime/uri").default';uri$1.default=uri;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=validate;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=codegen;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=validation_error,s=ref_error,o=rules,i=compile,l=codegen,p=resolve$1,d=dataType,u=util,m=require$$9,w=uri$1,R=(F,y)=>new RegExp(F,y);R.code="new RegExp";const v=["removeAdditional","useDefaults","coerceTypes"],T=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),$={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},k=200;function C(F){var y,j,b,a,h,N,q,M,W,G,ne,he,Ue,tt,rt,de,nt,xe,Le,He,st,me,le,Ve,ot;const Oe=F.strict,it=(y=F.code)===null||y===void 0?void 0:y.optimize,ut=it===!0||it===void 0?1:it||0,pe=(b=(j=F.code)===null||j===void 0?void 0:j.regExp)!==null&&b!==void 0?b:R,Ne=(a=F.uriResolver)!==null&&a!==void 0?a:w.default;return{strictSchema:(N=(h=F.strictSchema)!==null&&h!==void 0?h:Oe)!==null&&N!==void 0?N:!0,strictNumbers:(M=(q=F.strictNumbers)!==null&&q!==void 0?q:Oe)!==null&&M!==void 0?M:!0,strictTypes:(G=(W=F.strictTypes)!==null&&W!==void 0?W:Oe)!==null&&G!==void 0?G:"log",strictTuples:(he=(ne=F.strictTuples)!==null&&ne!==void 0?ne:Oe)!==null&&he!==void 0?he:"log",strictRequired:(tt=(Ue=F.strictRequired)!==null&&Ue!==void 0?Ue:Oe)!==null&&tt!==void 0?tt:!1,code:F.code?{...F.code,optimize:ut,regExp:pe}:{optimize:ut,regExp:pe},loopRequired:(rt=F.loopRequired)!==null&&rt!==void 0?rt:k,loopEnum:(de=F.loopEnum)!==null&&de!==void 0?de:k,meta:(nt=F.meta)!==null&&nt!==void 0?nt:!0,messages:(xe=F.messages)!==null&&xe!==void 0?xe:!0,inlineRefs:(Le=F.inlineRefs)!==null&&Le!==void 0?Le:!0,schemaId:(He=F.schemaId)!==null&&He!==void 0?He:"$id",addUsedSchema:(st=F.addUsedSchema)!==null&&st!==void 0?st:!0,validateSchema:(me=F.validateSchema)!==null&&me!==void 0?me:!0,validateFormats:(le=F.validateFormats)!==null&&le!==void 0?le:!0,unicodeRegExp:(Ve=F.unicodeRegExp)!==null&&Ve!==void 0?Ve:!0,int32range:(ot=F.int32range)!==null&&ot!==void 0?ot:!0,uriResolver:Ne}}class I{constructor(y={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,y=this.opts={...y,...C(y)};const{es5:j,lines:b}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:T,es5:j,lines:b}),this.logger=K(y.logger);const a=y.validateFormats;y.validateFormats=!1,this.RULES=(0,o.getRules)(),D.call(this,$,y,"NOT SUPPORTED"),D.call(this,g,y,"DEPRECATED","warn"),this._metaOpts=z.call(this),y.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),y.keywords&&H.call(this,y.keywords),typeof y.meta=="object"&&this.addMetaSchema(y.meta),O.call(this),y.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:y,meta:j,schemaId:b}=this.opts;let a=m;b==="id"&&(a={...m},a.id=a.$id,delete a.$id),j&&y&&this.addMetaSchema(a,a[b],!1)}defaultMeta(){const{meta:y,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof y=="object"?y[j]||y:void 0}validate(y,j){let b;if(typeof y=="string"){if(b=this.getSchema(y),!b)throw new Error(`no schema with key or ref "${y}"`)}else b=this.compile(y);const a=b(j);return"$async"in b||(this.errors=b.errors),a}compile(y,j){const b=this._addSchema(y,j);return b.validate||this._compileSchemaEnv(b)}compileAsync(y,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:b}=this.opts;return a.call(this,y,j);async function a(G,ne){await h.call(this,G.$schema);const he=this._addSchema(G,ne);return he.validate||N.call(this,he)}async function h(G){G&&!this.getSchema(G)&&await a.call(this,{$ref:G},!0)}async function N(G){try{return this._compileSchemaEnv(G)}catch(ne){if(!(ne instanceof s.default))throw ne;return q.call(this,ne),await M.call(this,ne.missingSchema),N.call(this,G)}}function q({missingSchema:G,missingRef:ne}){if(this.refs[G])throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`)}async function M(G){const ne=await W.call(this,G);this.refs[G]||await h.call(this,ne.$schema),this.refs[G]||this.addSchema(ne,G,j)}async function W(G){const ne=this._loading[G];if(ne)return ne;try{return await(this._loading[G]=b(G))}finally{delete this._loading[G]}}}addSchema(y,j,b,a=this.opts.validateSchema){if(Array.isArray(y)){for(const N of y)this.addSchema(N,void 0,b,a);return this}let h;if(typeof y=="object"){const{schemaId:N}=this.opts;if(h=y[N],h!==void 0&&typeof h!="string")throw new Error(`schema ${N} must be string`)}return j=(0,p.normalizeId)(j||h),this._checkUnique(j),this.schemas[j]=this._addSchema(y,b,j,a,!0),this}addMetaSchema(y,j,b=this.opts.validateSchema){return this.addSchema(y,j,!0,b),this}validateSchema(y,j){if(typeof y=="boolean")return!0;let b;if(b=y.$schema,b!==void 0&&typeof b!="string")throw new Error("$schema must be a string");if(b=b||this.opts.defaultMeta||this.defaultMeta(),!b)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(b,y);if(!a&&j){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return a}getSchema(y){let j;for(;typeof(j=P.call(this,y))=="string";)y=j;if(j===void 0){const{schemaId:b}=this.opts,a=new i.SchemaEnv({schema:{},schemaId:b});if(j=i.resolveSchema.call(this,a,y),!j)return;this.refs[y]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(y){if(y instanceof RegExp)return this._removeAllSchemas(this.schemas,y),this._removeAllSchemas(this.refs,y),this;switch(typeof y){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=P.call(this,y);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[y],delete this.refs[y],this}case"object":{const j=y;this._cache.delete(j);let b=y[this.opts.schemaId];return b&&(b=(0,p.normalizeId)(b),delete this.schemas[b],delete this.refs[b]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(y){for(const j of y)this.addKeyword(j);return this}addKeyword(y,j){let b;if(typeof y=="string")b=y,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=b);else if(typeof y=="object"&&j===void 0){if(j=y,b=j.keyword,Array.isArray(b)&&!b.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(ie.call(this,b,j),!j)return(0,u.eachItem)(b,h=>ke.call(this,h)),this;qe.call(this,j);const a={...j,type:(0,d.getJSONTypes)(j.type),schemaType:(0,d.getJSONTypes)(j.schemaType)};return(0,u.eachItem)(b,a.type.length===0?h=>ke.call(this,h,a):h=>a.type.forEach(N=>ke.call(this,h,a,N))),this}getKeyword(y){const j=this.RULES.all[y];return typeof j=="object"?j.definition:!!j}removeKeyword(y){const{RULES:j}=this;delete j.keywords[y],delete j.all[y];for(const b of j.rules){const a=b.rules.findIndex(h=>h.keyword===y);a>=0&&b.rules.splice(a,1)}return this}addFormat(y,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[y]=j,this}errorsText(y=this.errors,{separator:j=", ",dataVar:b="data"}={}){return!y||y.length===0?"No errors":y.map(a=>`${b}${a.instancePath} ${a.message}`).reduce((a,h)=>a+j+h)}$dataMetaSchema(y,j){const b=this.RULES.all;y=JSON.parse(JSON.stringify(y));for(const a of j){const h=a.split("/").slice(1);let N=y;for(const q of h)N=N[q];for(const q in b){const M=b[q];if(typeof M!="object")continue;const{$data:W}=M.definition,G=N[q];W&&G&&(N[q]=Me(G))}}return y}_removeAllSchemas(y,j){for(const b in y){const a=y[b];(!j||j.test(b))&&(typeof a=="string"?delete y[b]:a&&!a.meta&&(this._cache.delete(a.schema),delete y[b]))}}_addSchema(y,j,b,a=this.opts.validateSchema,h=this.opts.addUsedSchema){let N;const{schemaId:q}=this.opts;if(typeof y=="object")N=y[q];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof y!="boolean")throw new Error("schema must be object or boolean")}let M=this._cache.get(y);if(M!==void 0)return M;b=(0,p.normalizeId)(N||b);const W=p.getSchemaRefs.call(this,y,b);return M=new i.SchemaEnv({schema:y,schemaId:q,meta:j,baseId:b,localRefs:W}),this._cache.set(M.schema,M),h&&!b.startsWith("#")&&(b&&this._checkUnique(b),this.refs[b]=M),a&&this.validateSchema(y,!0),M}_checkUnique(y){if(this.schemas[y]||this.refs[y])throw new Error(`schema with key or id "${y}" already exists`)}_compileSchemaEnv(y){if(y.meta?this._compileMetaSchema(y):i.compileSchema.call(this,y),!y.validate)throw new Error("ajv implementation error");return y.validate}_compileMetaSchema(y){const j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,y)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function D(F,y,j,b="error"){for(const a in F){const h=a;h in y&&this.logger[b](`${j}: option ${a}. ${F[h]}`)}}function P(F){return F=(0,p.normalizeId)(F),this.schemas[F]||this.refs[F]}function O(){const F=this.opts.schemas;if(F)if(Array.isArray(F))this.addSchema(F);else for(const y in F)this.addSchema(F[y],y)}function A(){for(const F in this.opts.formats){const y=this.opts.formats[F];y&&this.addFormat(F,y)}}function H(F){if(Array.isArray(F)){this.addVocabulary(F);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const y in F){const j=F[y];j.keyword||(j.keyword=y),this.addKeyword(j)}}function z(){const F={...this.opts};for(const y of v)delete F[y];return F}const re={log(){},warn(){},error(){}};function K(F){if(F===!1)return re;if(F===void 0)return console;if(F.log&&F.warn&&F.error)return F;throw new Error("logger must implement log, warn and error methods")}const ue=/^[a-z_$][a-z0-9_$:-]*$/i;function ie(F,y){const{RULES:j}=this;if((0,u.eachItem)(F,b=>{if(j.keywords[b])throw new Error(`Keyword ${b} is already defined`);if(!ue.test(b))throw new Error(`Keyword ${b} has invalid name`)}),!!y&&y.$data&&!("code"in y||"validate"in y))throw new Error('$data keyword must have "code" or "validate" function')}function ke(F,y,j){var b;const a=y==null?void 0:y.post;if(j&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let N=a?h.post:h.rules.find(({type:M})=>M===j);if(N||(N={type:j,rules:[]},h.rules.push(N)),h.keywords[F]=!0,!y)return;const q={keyword:F,definition:{...y,type:(0,d.getJSONTypes)(y.type),schemaType:(0,d.getJSONTypes)(y.schemaType)}};y.before?Ce.call(this,N,q,y.before):N.rules.push(q),h.all[F]=q,(b=y.implements)===null||b===void 0||b.forEach(M=>this.addKeyword(M))}function Ce(F,y,j){const b=F.rules.findIndex(a=>a.keyword===j);b>=0?F.rules.splice(b,0,y):(F.rules.push(y),this.logger.warn(`rule ${j} is not defined`))}function qe(F){let{metaSchema:y}=F;y!==void 0&&(F.$data&&this.opts.$data&&(y=Me(y)),F.validateSchema=this.compile(y,!0))}const et={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Me(F){return{anyOf:[F,et]}}})(core$2);var draft7={},core$1={},id={};Object.defineProperty(id,"__esModule",{value:!0});const def$s={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};id.default=def$s;var ref={};Object.defineProperty(ref,"__esModule",{value:!0});ref.callRef=ref.getValidate=void 0;const ref_error_1=ref_error,code_1$8=code,codegen_1$l=codegen,names_1$1=names$1,compile_1$1=compile,util_1$j=util,def$r={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:i,opts:l,self:p}=n,{root:d}=o;if((r==="#"||r==="#/")&&s===d.baseId)return m();const u=compile_1$1.resolveRef.call(p,d,s,r);if(u===void 0)throw new ref_error_1.default(n.opts.uriResolver,s,r);if(u instanceof compile_1$1.SchemaEnv)return w(u);return R(u);function m(){if(o===d)return callRef(e,i,o,o.$async);const v=t.scopeValue("root",{ref:d});return callRef(e,(0,codegen_1$l._)`${v}.validate`,d,d.$async)}function w(v){const T=getValidate(e,v);callRef(e,T,v,v.$async)}function R(v){const T=t.scopeValue("schema",l.code.source===!0?{ref:v,code:(0,codegen_1$l.stringify)(v)}:{ref:v}),$=t.name("valid"),g=e.subschema({schema:v,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:T,errSchemaPath:r},$);e.mergeEvaluated(g),e.ok($)}}};function getValidate(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,codegen_1$l._)`${r.scopeValue("wrapper",{ref:t})}.validate`}ref.getValidate=getValidate;function callRef(e,t,r,n){const{gen:s,it:o}=e,{allErrors:i,schemaEnv:l,opts:p}=o,d=p.passContext?names_1$1.default.this:codegen_1$l.nil;n?u():m();function u(){if(!l.$async)throw new Error("async schema referenced by sync schema");const v=s.let("valid");s.try(()=>{s.code((0,codegen_1$l._)`await ${(0,code_1$8.callValidateCode)(e,t,d)}`),R(t),i||s.assign(v,!0)},T=>{s.if((0,codegen_1$l._)`!(${T} instanceof ${o.ValidationError})`,()=>s.throw(T)),w(T),i||s.assign(v,!1)}),e.ok(v)}function m(){e.result((0,code_1$8.callValidateCode)(e,t,d),()=>R(t),()=>w(t))}function w(v){const T=(0,codegen_1$l._)`${v}.errors`;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`)}function R(v){var T;if(!o.opts.unevaluated)return;const $=(T=r==null?void 0:r.validate)===null||T===void 0?void 0:T.evaluated;if(o.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(o.props=util_1$j.mergeEvaluated.props(s,$.props,o.props));else{const g=s.var("props",(0,codegen_1$l._)`${v}.evaluated.props`);o.props=util_1$j.mergeEvaluated.props(s,g,o.props,codegen_1$l.Name)}if(o.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(o.items=util_1$j.mergeEvaluated.items(s,$.items,o.items));else{const g=s.var("items",(0,codegen_1$l._)`${v}.evaluated.items`);o.items=util_1$j.mergeEvaluated.items(s,g,o.items,codegen_1$l.Name)}}}ref.callRef=callRef;ref.default=def$r;Object.defineProperty(core$1,"__esModule",{value:!0});const id_1=id,ref_1=ref,core=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",id_1.default,ref_1.default];core$1.default=core;var validation$1={},limitNumber={};Object.defineProperty(limitNumber,"__esModule",{value:!0});const codegen_1$k=codegen,ops=codegen_1$k.operators,KWDs={maximum:{okStr:"<=",ok:ops.LTE,fail:ops.GT},minimum:{okStr:">=",ok:ops.GTE,fail:ops.LT},exclusiveMaximum:{okStr:"<",ok:ops.LT,fail:ops.GTE},exclusiveMinimum:{okStr:">",ok:ops.GT,fail:ops.LTE}},error$i={message:({keyword:e,schemaCode:t})=>(0,codegen_1$k.str)`must be ${KWDs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,codegen_1$k._)`{comparison: ${KWDs[e].okStr}, limit: ${t}}`},def$q={keyword:Object.keys(KWDs),type:"number",schemaType:"number",$data:!0,error:error$i,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,codegen_1$k._)`${r} ${KWDs[t].fail} ${n} || isNaN(${r})`)}};limitNumber.default=def$q;var multipleOf={};Object.defineProperty(multipleOf,"__esModule",{value:!0});const codegen_1$j=codegen,error$h={message:({schemaCode:e})=>(0,codegen_1$j.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,codegen_1$j._)`{multipleOf: ${e}}`},def$p={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:error$h,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),l=o?(0,codegen_1$j._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,codegen_1$j._)`${i} !== parseInt(${i})`;e.fail$data((0,codegen_1$j._)`(${n} === 0 || (${i} = ${r}/${n}, ${l}))`)}};multipleOf.default=def$p;var limitLength={},ucs2length$1={};Object.defineProperty(ucs2length$1,"__esModule",{value:!0});function ucs2length(e){const t=e.length;let r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}ucs2length$1.default=ucs2length;ucs2length.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(limitLength,"__esModule",{value:!0});const codegen_1$i=codegen,util_1$i=util,ucs2length_1=ucs2length$1,error$g={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,codegen_1$i.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,codegen_1$i._)`{limit: ${e}}`},def$o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:error$g,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?codegen_1$i.operators.GT:codegen_1$i.operators.LT,i=s.opts.unicode===!1?(0,codegen_1$i._)`${r}.length`:(0,codegen_1$i._)`${(0,util_1$i.useFunc)(e.gen,ucs2length_1.default)}(${r})`;e.fail$data((0,codegen_1$i._)`${i} ${o} ${n}`)}};limitLength.default=def$o;var pattern={};Object.defineProperty(pattern,"__esModule",{value:!0});const code_1$7=code,codegen_1$h=codegen,error$f={message:({schemaCode:e})=>(0,codegen_1$h.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,codegen_1$h._)`{pattern: ${e}}`},def$n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:error$f,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,i=o.opts.unicodeRegExp?"u":"",l=r?(0,codegen_1$h._)`(new RegExp(${s}, ${i}))`:(0,code_1$7.usePattern)(e,n);e.fail$data((0,codegen_1$h._)`!${l}.test(${t})`)}};pattern.default=def$n;var limitProperties={};Object.defineProperty(limitProperties,"__esModule",{value:!0});const codegen_1$g=codegen,error$e={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,codegen_1$g.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,codegen_1$g._)`{limit: ${e}}`},def$m={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:error$e,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?codegen_1$g.operators.GT:codegen_1$g.operators.LT;e.fail$data((0,codegen_1$g._)`Object.keys(${r}).length ${s} ${n}`)}};limitProperties.default=def$m;var required={};Object.defineProperty(required,"__esModule",{value:!0});const code_1$6=code,codegen_1$f=codegen,util_1$h=util,error$d={message:({params:{missingProperty:e}})=>(0,codegen_1$f.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,codegen_1$f._)`{missingProperty: ${e}}`},def$l={keyword:"required",type:"object",schemaType:"array",$data:!0,error:error$d,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:i}=e,{opts:l}=i;if(!o&&r.length===0)return;const p=r.length>=l.loopRequired;if(i.allErrors?d():u(),l.strictRequired){const R=e.parentSchema.properties,{definedProperties:v}=e.it;for(const T of r)if((R==null?void 0:R[T])===void 0&&!v.has(T)){const $=i.schemaEnv.baseId+i.errSchemaPath,g=`required property "${T}" is not defined at "${$}" (strictRequired)`;(0,util_1$h.checkStrictMode)(i,g,i.opts.strictRequired)}}function d(){if(p||o)e.block$data(codegen_1$f.nil,m);else for(const R of r)(0,code_1$6.checkReportMissingProp)(e,R)}function u(){const R=t.let("missing");if(p||o){const v=t.let("valid",!0);e.block$data(v,()=>w(R,v)),e.ok(v)}else t.if((0,code_1$6.checkMissingProp)(e,r,R)),(0,code_1$6.reportMissingProp)(e,R),t.else()}function m(){t.forOf("prop",n,R=>{e.setParams({missingProperty:R}),t.if((0,code_1$6.noPropertyInData)(t,s,R,l.ownProperties),()=>e.error())})}function w(R,v){e.setParams({missingProperty:R}),t.forOf(R,n,()=>{t.assign(v,(0,code_1$6.propertyInData)(t,s,R,l.ownProperties)),t.if((0,codegen_1$f.not)(v),()=>{e.error(),t.break()})},codegen_1$f.nil)}}};required.default=def$l;var limitItems={};Object.defineProperty(limitItems,"__esModule",{value:!0});const codegen_1$e=codegen,error$c={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,codegen_1$e.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,codegen_1$e._)`{limit: ${e}}`},def$k={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:error$c,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?codegen_1$e.operators.GT:codegen_1$e.operators.LT;e.fail$data((0,codegen_1$e._)`${r}.length ${s} ${n}`)}};limitItems.default=def$k;var uniqueItems={},equal$1={};Object.defineProperty(equal$1,"__esModule",{value:!0});const equal=fastDeepEqual;equal.code='require("ajv/dist/runtime/equal").default';equal$1.default=equal;Object.defineProperty(uniqueItems,"__esModule",{value:!0});const dataType_1=dataType,codegen_1$d=codegen,util_1$g=util,equal_1$2=equal$1,error$b={message:({params:{i:e,j:t}})=>(0,codegen_1$d.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,codegen_1$d._)`{i: ${e}, j: ${t}}`},def$j={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:error$b,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:l}=e;if(!n&&!s)return;const p=t.let("valid"),d=o.items?(0,dataType_1.getSchemaTypes)(o.items):[];e.block$data(p,u,(0,codegen_1$d._)`${i} === false`),e.ok(p);function u(){const v=t.let("i",(0,codegen_1$d._)`${r}.length`),T=t.let("j");e.setParams({i:v,j:T}),t.assign(p,!0),t.if((0,codegen_1$d._)`${v} > 1`,()=>(m()?w:R)(v,T))}function m(){return d.length>0&&!d.some(v=>v==="object"||v==="array")}function w(v,T){const $=t.name("item"),g=(0,dataType_1.checkDataTypes)(d,$,l.opts.strictNumbers,dataType_1.DataType.Wrong),k=t.const("indices",(0,codegen_1$d._)`{}`);t.for((0,codegen_1$d._)`;${v}--;`,()=>{t.let($,(0,codegen_1$d._)`${r}[${v}]`),t.if(g,(0,codegen_1$d._)`continue`),d.length>1&&t.if((0,codegen_1$d._)`typeof ${$} == "string"`,(0,codegen_1$d._)`${$} += "_"`),t.if((0,codegen_1$d._)`typeof ${k}[${$}] == "number"`,()=>{t.assign(T,(0,codegen_1$d._)`${k}[${$}]`),e.error(),t.assign(p,!1).break()}).code((0,codegen_1$d._)`${k}[${$}] = ${v}`)})}function R(v,T){const $=(0,util_1$g.useFunc)(t,equal_1$2.default),g=t.name("outer");t.label(g).for((0,codegen_1$d._)`;${v}--;`,()=>t.for((0,codegen_1$d._)`${T} = ${v}; ${T}--;`,()=>t.if((0,codegen_1$d._)`${$}(${r}[${v}], ${r}[${T}])`,()=>{e.error(),t.assign(p,!1).break(g)})))}}};uniqueItems.default=def$j;var _const={};Object.defineProperty(_const,"__esModule",{value:!0});const codegen_1$c=codegen,util_1$f=util,equal_1$1=equal$1,error$a={message:"must be equal to constant",params:({schemaCode:e})=>(0,codegen_1$c._)`{allowedValue: ${e}}`},def$i={keyword:"const",$data:!0,error:error$a,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,codegen_1$c._)`!${(0,util_1$f.useFunc)(t,equal_1$1.default)}(${r}, ${s})`):e.fail((0,codegen_1$c._)`${o} !== ${r}`)}};_const.default=def$i;var _enum={};Object.defineProperty(_enum,"__esModule",{value:!0});const codegen_1$b=codegen,util_1$e=util,equal_1=equal$1,error$9={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,codegen_1$b._)`{allowedValues: ${e}}`},def$h={keyword:"enum",schemaType:"array",$data:!0,error:error$9,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:i}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const l=s.length>=i.opts.loopEnum;let p;const d=()=>p??(p=(0,util_1$e.useFunc)(t,equal_1.default));let u;if(l||n)u=t.let("valid"),e.block$data(u,m);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const R=t.const("vSchema",o);u=(0,codegen_1$b.or)(...s.map((v,T)=>w(R,T)))}e.pass(u);function m(){t.assign(u,!1),t.forOf("v",o,R=>t.if((0,codegen_1$b._)`${d()}(${r}, ${R})`,()=>t.assign(u,!0).break()))}function w(R,v){const T=s[v];return typeof T=="object"&&T!==null?(0,codegen_1$b._)`${d()}(${r}, ${R}[${v}])`:(0,codegen_1$b._)`${r} === ${T}`}}};_enum.default=def$h;Object.defineProperty(validation$1,"__esModule",{value:!0});const limitNumber_1=limitNumber,multipleOf_1=multipleOf,limitLength_1=limitLength,pattern_1=pattern,limitProperties_1=limitProperties,required_1=required,limitItems_1=limitItems,uniqueItems_1=uniqueItems,const_1=_const,enum_1=_enum,validation=[limitNumber_1.default,multipleOf_1.default,limitLength_1.default,pattern_1.default,limitProperties_1.default,required_1.default,limitItems_1.default,uniqueItems_1.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},const_1.default,enum_1.default];validation$1.default=validation;var applicator={},additionalItems={};Object.defineProperty(additionalItems,"__esModule",{value:!0});additionalItems.validateAdditionalItems=void 0;const codegen_1$a=codegen,util_1$d=util,error$8={message:({params:{len:e}})=>(0,codegen_1$a.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,codegen_1$a._)`{limit: ${e}}`},def$g={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:error$8,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,util_1$d.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(e,n)}};function validateAdditionalItems(e,t){const{gen:r,schema:n,data:s,keyword:o,it:i}=e;i.items=!0;const l=r.const("len",(0,codegen_1$a._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,codegen_1$a._)`${l} <= ${t.length}`);else if(typeof n=="object"&&!(0,util_1$d.alwaysValidSchema)(i,n)){const d=r.var("valid",(0,codegen_1$a._)`${l} <= ${t.length}`);r.if((0,codegen_1$a.not)(d),()=>p(d)),e.ok(d)}function p(d){r.forRange("i",t.length,l,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:util_1$d.Type.Num},d),i.allErrors||r.if((0,codegen_1$a.not)(d),()=>r.break())})}}additionalItems.validateAdditionalItems=validateAdditionalItems;additionalItems.default=def$g;var prefixItems={},items={};Object.defineProperty(items,"__esModule",{value:!0});items.validateTuple=void 0;const codegen_1$9=codegen,util_1$c=util,code_1$5=code,def$f={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return validateTuple(e,"additionalItems",t);r.items=!0,!(0,util_1$c.alwaysValidSchema)(r,t)&&e.ok((0,code_1$5.validateArray)(e))}};function validateTuple(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:l}=e;u(s),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=util_1$c.mergeEvaluated.items(n,r.length,l.items));const p=n.name("valid"),d=n.const("len",(0,codegen_1$9._)`${o}.length`);r.forEach((m,w)=>{(0,util_1$c.alwaysValidSchema)(l,m)||(n.if((0,codegen_1$9._)`${d} > ${w}`,()=>e.subschema({keyword:i,schemaProp:w,dataProp:w},p)),e.ok(p))});function u(m){const{opts:w,errSchemaPath:R}=l,v=r.length,T=v===m.minItems&&(v===m.maxItems||m[t]===!1);if(w.strictTuples&&!T){const $=`"${i}" is ${v}-tuple, but minItems or maxItems/${t} are not specified or different at path "${R}"`;(0,util_1$c.checkStrictMode)(l,$,w.strictTuples)}}}items.validateTuple=validateTuple;items.default=def$f;Object.defineProperty(prefixItems,"__esModule",{value:!0});const items_1$1=items,def$e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,items_1$1.validateTuple)(e,"items")};prefixItems.default=def$e;var items2020={};Object.defineProperty(items2020,"__esModule",{value:!0});const codegen_1$8=codegen,util_1$b=util,code_1$4=code,additionalItems_1$1=additionalItems,error$7={message:({params:{len:e}})=>(0,codegen_1$8.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,codegen_1$8._)`{limit: ${e}}`},def$d={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:error$7,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,util_1$b.alwaysValidSchema)(n,t)&&(s?(0,additionalItems_1$1.validateAdditionalItems)(e,s):e.ok((0,code_1$4.validateArray)(e)))}};items2020.default=def$d;var contains={};Object.defineProperty(contains,"__esModule",{value:!0});const codegen_1$7=codegen,util_1$a=util,error$6={message:({params:{min:e,max:t}})=>t===void 0?(0,codegen_1$7.str)`must contain at least ${e} valid item(s)`:(0,codegen_1$7.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,codegen_1$7._)`{minContains: ${e}}`:(0,codegen_1$7._)`{minContains: ${e}, maxContains: ${t}}`},def$c={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:error$6,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let i,l;const{minContains:p,maxContains:d}=n;o.opts.next?(i=p===void 0?1:p,l=d):i=1;const u=t.const("len",(0,codegen_1$7._)`${s}.length`);if(e.setParams({min:i,max:l}),l===void 0&&i===0){(0,util_1$a.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&i>l){(0,util_1$a.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,util_1$a.alwaysValidSchema)(o,r)){let T=(0,codegen_1$7._)`${u} >= ${i}`;l!==void 0&&(T=(0,codegen_1$7._)`${T} && ${u} <= ${l}`),e.pass(T);return}o.items=!0;const m=t.name("valid");l===void 0&&i===1?R(m,()=>t.if(m,()=>t.break())):i===0?(t.let(m,!0),l!==void 0&&t.if((0,codegen_1$7._)`${s}.length > 0`,w)):(t.let(m,!1),w()),e.result(m,()=>e.reset());function w(){const T=t.name("_valid"),$=t.let("count",0);R(T,()=>t.if(T,()=>v($)))}function R(T,$){t.forRange("i",0,u,g=>{e.subschema({keyword:"contains",dataProp:g,dataPropType:util_1$a.Type.Num,compositeRule:!0},T),$()})}function v(T){t.code((0,codegen_1$7._)`${T}++`),l===void 0?t.if((0,codegen_1$7._)`${T} >= ${i}`,()=>t.assign(m,!0).break()):(t.if((0,codegen_1$7._)`${T} > ${l}`,()=>t.assign(m,!1).break()),i===1?t.assign(m,!0):t.if((0,codegen_1$7._)`${T} >= ${i}`,()=>t.assign(m,!0)))}}};contains.default=def$c;var dependencies={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=codegen,r=util,n=code;e.error={message:({params:{property:p,depsCount:d,deps:u}})=>{const m=d===1?"property":"properties";return(0,t.str)`must have ${m} ${u} when property ${p} is present`},params:({params:{property:p,depsCount:d,deps:u,missingProperty:m}})=>(0,t._)`{property: ${p},
|
|
925
|
+
missingProperty: ${m},
|
|
926
|
+
depsCount: ${d},
|
|
927
|
+
deps: ${u}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(p){const[d,u]=o(p);i(p,d),l(p,u)}};function o({schema:p}){const d={},u={};for(const m in p){if(m==="__proto__")continue;const w=Array.isArray(p[m])?d:u;w[m]=p[m]}return[d,u]}function i(p,d=p.schema){const{gen:u,data:m,it:w}=p;if(Object.keys(d).length===0)return;const R=u.let("missing");for(const v in d){const T=d[v];if(T.length===0)continue;const $=(0,n.propertyInData)(u,m,v,w.opts.ownProperties);p.setParams({property:v,depsCount:T.length,deps:T.join(", ")}),w.allErrors?u.if($,()=>{for(const g of T)(0,n.checkReportMissingProp)(p,g)}):(u.if((0,t._)`${$} && (${(0,n.checkMissingProp)(p,T,R)})`),(0,n.reportMissingProp)(p,R),u.else())}}e.validatePropertyDeps=i;function l(p,d=p.schema){const{gen:u,data:m,keyword:w,it:R}=p,v=u.name("valid");for(const T in d)(0,r.alwaysValidSchema)(R,d[T])||(u.if((0,n.propertyInData)(u,m,T,R.opts.ownProperties),()=>{const $=p.subschema({keyword:w,schemaProp:T},v);p.mergeValidEvaluated($,v)},()=>u.var(v,!0)),p.ok(v))}e.validateSchemaDeps=l,e.default=s})(dependencies);var propertyNames={};Object.defineProperty(propertyNames,"__esModule",{value:!0});const codegen_1$6=codegen,util_1$9=util,error$5={message:"property name must be valid",params:({params:e})=>(0,codegen_1$6._)`{propertyName: ${e.propertyName}}`},def$b={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:error$5,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,util_1$9.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if((0,codegen_1$6.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};propertyNames.default=def$b;var additionalProperties={};Object.defineProperty(additionalProperties,"__esModule",{value:!0});const code_1$3=code,codegen_1$5=codegen,names_1=names$1,util_1$8=util,error$4={message:"must NOT have additional properties",params:({params:e})=>(0,codegen_1$5._)`{additionalProperty: ${e.additionalProperty}}`},def$a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:error$4,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:l,opts:p}=i;if(i.props=!0,p.removeAdditional!=="all"&&(0,util_1$8.alwaysValidSchema)(i,r))return;const d=(0,code_1$3.allSchemaProperties)(n.properties),u=(0,code_1$3.allSchemaProperties)(n.patternProperties);m(),e.ok((0,codegen_1$5._)`${o} === ${names_1.default.errors}`);function m(){t.forIn("key",s,$=>{!d.length&&!u.length?v($):t.if(w($),()=>v($))})}function w($){let g;if(d.length>8){const k=(0,util_1$8.schemaRefOrVal)(i,n.properties,"properties");g=(0,code_1$3.isOwnProperty)(t,k,$)}else d.length?g=(0,codegen_1$5.or)(...d.map(k=>(0,codegen_1$5._)`${$} === ${k}`)):g=codegen_1$5.nil;return u.length&&(g=(0,codegen_1$5.or)(g,...u.map(k=>(0,codegen_1$5._)`${(0,code_1$3.usePattern)(e,k)}.test(${$})`))),(0,codegen_1$5.not)(g)}function R($){t.code((0,codegen_1$5._)`delete ${s}[${$}]`)}function v($){if(p.removeAdditional==="all"||p.removeAdditional&&r===!1){R($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),l||t.break();return}if(typeof r=="object"&&!(0,util_1$8.alwaysValidSchema)(i,r)){const g=t.name("valid");p.removeAdditional==="failing"?(T($,g,!1),t.if((0,codegen_1$5.not)(g),()=>{e.reset(),R($)})):(T($,g),l||t.if((0,codegen_1$5.not)(g),()=>t.break()))}}function T($,g,k){const C={keyword:"additionalProperties",dataProp:$,dataPropType:util_1$8.Type.Str};k===!1&&Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(C,g)}}};additionalProperties.default=def$a;var properties$1={};Object.defineProperty(properties$1,"__esModule",{value:!0});const validate_1=validate,code_1$2=code,util_1$7=util,additionalProperties_1$1=additionalProperties,def$9={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(o,additionalProperties_1$1.default,"additionalProperties"));const i=(0,code_1$2.allSchemaProperties)(r);for(const m of i)o.definedProperties.add(m);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(i),o.props));const l=i.filter(m=>!(0,util_1$7.alwaysValidSchema)(o,r[m]));if(l.length===0)return;const p=t.name("valid");for(const m of l)d(m)?u(m):(t.if((0,code_1$2.propertyInData)(t,s,m,o.opts.ownProperties)),u(m),o.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(m),e.ok(p);function d(m){return o.opts.useDefaults&&!o.compositeRule&&r[m].default!==void 0}function u(m){e.subschema({keyword:"properties",schemaProp:m,dataProp:m},p)}}};properties$1.default=def$9;var patternProperties={};Object.defineProperty(patternProperties,"__esModule",{value:!0});const code_1$1=code,codegen_1$4=codegen,util_1$6=util,util_2=util,def$8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,l=(0,code_1$1.allSchemaProperties)(r),p=l.filter(T=>(0,util_1$6.alwaysValidSchema)(o,r[T]));if(l.length===0||p.length===l.length&&(!o.opts.unevaluated||o.props===!0))return;const d=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");o.props!==!0&&!(o.props instanceof codegen_1$4.Name)&&(o.props=(0,util_2.evaluatedPropsToName)(t,o.props));const{props:m}=o;w();function w(){for(const T of l)d&&R(T),o.allErrors?v(T):(t.var(u,!0),v(T),t.if(u))}function R(T){for(const $ in d)new RegExp(T).test($)&&(0,util_1$6.checkStrictMode)(o,`property ${$} matches pattern ${T} (use allowMatchingProperties)`)}function v(T){t.forIn("key",n,$=>{t.if((0,codegen_1$4._)`${(0,code_1$1.usePattern)(e,T)}.test(${$})`,()=>{const g=p.includes(T);g||e.subschema({keyword:"patternProperties",schemaProp:T,dataProp:$,dataPropType:util_2.Type.Str},u),o.opts.unevaluated&&m!==!0?t.assign((0,codegen_1$4._)`${m}[${$}]`,!0):!g&&!o.allErrors&&t.if((0,codegen_1$4.not)(u),()=>t.break())})})}}};patternProperties.default=def$8;var not={};Object.defineProperty(not,"__esModule",{value:!0});const util_1$5=util,def$7={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,util_1$5.alwaysValidSchema)(n,r)){e.fail();return}const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};not.default=def$7;var anyOf={};Object.defineProperty(anyOf,"__esModule",{value:!0});const code_1=code,def$6={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:code_1.validateUnion,error:{message:"must match a schema in anyOf"}};anyOf.default=def$6;var oneOf={};Object.defineProperty(oneOf,"__esModule",{value:!0});const codegen_1$3=codegen,util_1$4=util,error$3={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,codegen_1$3._)`{passingSchemas: ${e.passing}}`},def$5={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:error$3,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,i=t.let("valid",!1),l=t.let("passing",null),p=t.name("_valid");e.setParams({passing:l}),t.block(d),e.result(i,()=>e.reset(),()=>e.error(!0));function d(){o.forEach((u,m)=>{let w;(0,util_1$4.alwaysValidSchema)(s,u)?t.var(p,!0):w=e.subschema({keyword:"oneOf",schemaProp:m,compositeRule:!0},p),m>0&&t.if((0,codegen_1$3._)`${p} && ${i}`).assign(i,!1).assign(l,(0,codegen_1$3._)`[${l}, ${m}]`).else(),t.if(p,()=>{t.assign(i,!0),t.assign(l,m),w&&e.mergeEvaluated(w,codegen_1$3.Name)})})}}};oneOf.default=def$5;var allOf={};Object.defineProperty(allOf,"__esModule",{value:!0});const util_1$3=util,def$4={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,i)=>{if((0,util_1$3.alwaysValidSchema)(n,o))return;const l=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(l)})}};allOf.default=def$4;var _if={};Object.defineProperty(_if,"__esModule",{value:!0});const codegen_1$2=codegen,util_1$2=util,error$2={message:({params:e})=>(0,codegen_1$2.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,codegen_1$2._)`{failingKeyword: ${e.ifClause}}`},def$3={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:error$2,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,util_1$2.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=hasSchema(n,"then"),o=hasSchema(n,"else");if(!s&&!o)return;const i=t.let("valid",!0),l=t.name("_valid");if(p(),e.reset(),s&&o){const u=t.let("ifClause");e.setParams({ifClause:u}),t.if(l,d("then",u),d("else",u))}else s?t.if(l,d("then")):t.if((0,codegen_1$2.not)(l),d("else"));e.pass(i,()=>e.error(!0));function p(){const u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(u)}function d(u,m){return()=>{const w=e.subschema({keyword:u},l);t.assign(i,l),e.mergeValidEvaluated(w,i),m?t.assign(m,(0,codegen_1$2._)`${u}`):e.setParams({ifClause:u})}}}};function hasSchema(e,t){const r=e.schema[t];return r!==void 0&&!(0,util_1$2.alwaysValidSchema)(e,r)}_if.default=def$3;var thenElse={};Object.defineProperty(thenElse,"__esModule",{value:!0});const util_1$1=util,def$2={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,util_1$1.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};thenElse.default=def$2;Object.defineProperty(applicator,"__esModule",{value:!0});const additionalItems_1=additionalItems,prefixItems_1=prefixItems,items_1=items,items2020_1=items2020,contains_1=contains,dependencies_1=dependencies,propertyNames_1=propertyNames,additionalProperties_1=additionalProperties,properties_1=properties$1,patternProperties_1=patternProperties,not_1=not,anyOf_1=anyOf,oneOf_1=oneOf,allOf_1=allOf,if_1=_if,thenElse_1=thenElse;function getApplicator(e=!1){const t=[not_1.default,anyOf_1.default,oneOf_1.default,allOf_1.default,if_1.default,thenElse_1.default,propertyNames_1.default,additionalProperties_1.default,dependencies_1.default,properties_1.default,patternProperties_1.default];return e?t.push(prefixItems_1.default,items2020_1.default):t.push(additionalItems_1.default,items_1.default),t.push(contains_1.default),t}applicator.default=getApplicator;var format$2={},format$1={};Object.defineProperty(format$1,"__esModule",{value:!0});const codegen_1$1=codegen,error$1={message:({schemaCode:e})=>(0,codegen_1$1.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,codegen_1$1._)`{format: ${e}}`},def$1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:error$1,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:l}=e,{opts:p,errSchemaPath:d,schemaEnv:u,self:m}=l;if(!p.validateFormats)return;s?w():R();function w(){const v=r.scopeValue("formats",{ref:m.formats,code:p.code.formats}),T=r.const("fDef",(0,codegen_1$1._)`${v}[${i}]`),$=r.let("fType"),g=r.let("format");r.if((0,codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`,()=>r.assign($,(0,codegen_1$1._)`${T}.type || "string"`).assign(g,(0,codegen_1$1._)`${T}.validate`),()=>r.assign($,(0,codegen_1$1._)`"string"`).assign(g,T)),e.fail$data((0,codegen_1$1.or)(k(),C()));function k(){return p.strictSchema===!1?codegen_1$1.nil:(0,codegen_1$1._)`${i} && !${g}`}function C(){const I=u.$async?(0,codegen_1$1._)`(${T}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,codegen_1$1._)`${g}(${n})`,D=(0,codegen_1$1._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;return(0,codegen_1$1._)`${g} && ${g} !== true && ${$} === ${t} && !${D}`}}function R(){const v=m.formats[o];if(!v){k();return}if(v===!0)return;const[T,$,g]=C(v);T===t&&e.pass(I());function k(){if(p.strictSchema===!1){m.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${o}" ignored in schema at path "${d}"`}}function C(D){const P=D instanceof RegExp?(0,codegen_1$1.regexpCode)(D):p.code.formats?(0,codegen_1$1._)`${p.code.formats}${(0,codegen_1$1.getProperty)(o)}`:void 0,O=r.scopeValue("formats",{key:o,ref:D,code:P});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,codegen_1$1._)`${O}.validate`]:["string",D,O]}function I(){if(typeof v=="object"&&!(v instanceof RegExp)&&v.async){if(!u.$async)throw new Error("async format in sync schema");return(0,codegen_1$1._)`await ${g}(${n})`}return typeof $=="function"?(0,codegen_1$1._)`${g}(${n})`:(0,codegen_1$1._)`${g}.test(${n})`}}}};format$1.default=def$1;Object.defineProperty(format$2,"__esModule",{value:!0});const format_1$1=format$1,format=[format_1$1.default];format$2.default=format;var metadata={};Object.defineProperty(metadata,"__esModule",{value:!0});metadata.contentVocabulary=metadata.metadataVocabulary=void 0;metadata.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];metadata.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(draft7,"__esModule",{value:!0});const core_1=core$1,validation_1=validation$1,applicator_1=applicator,format_1=format$2,metadata_1=metadata,draft7Vocabularies=[core_1.default,validation_1.default,(0,applicator_1.default)(),format_1.default,metadata_1.metadataVocabulary,metadata_1.contentVocabulary];draft7.default=draft7Vocabularies;var discriminator={},types={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))})(types);Object.defineProperty(discriminator,"__esModule",{value:!0});const codegen_1=codegen,types_1=types,compile_1=compile,util_1=util,error={message:({params:{discrError:e,tagName:t}})=>e===types_1.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,codegen_1._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},def={keyword:"discriminator",type:"object",schemaType:"object",error,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const p=t.let("valid",!1),d=t.const("tag",(0,codegen_1._)`${r}${(0,codegen_1.getProperty)(l)}`);t.if((0,codegen_1._)`typeof ${d} == "string"`,()=>u(),()=>e.error(!1,{discrError:types_1.DiscrError.Tag,tag:d,tagName:l})),e.ok(p);function u(){const R=w();t.if(!1);for(const v in R)t.elseIf((0,codegen_1._)`${d} === ${v}`),t.assign(p,m(R[v]));t.else(),e.error(!1,{discrError:types_1.DiscrError.Mapping,tag:d,tagName:l}),t.endIf()}function m(R){const v=t.name("valid"),T=e.subschema({keyword:"oneOf",schemaProp:R},v);return e.mergeEvaluated(T,codegen_1.Name),v}function w(){var R;const v={},T=g(s);let $=!0;for(let I=0;I<i.length;I++){let D=i[I];D!=null&&D.$ref&&!(0,util_1.schemaHasRulesButRef)(D,o.self.RULES)&&(D=compile_1.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,D==null?void 0:D.$ref),D instanceof compile_1.SchemaEnv&&(D=D.schema));const P=(R=D==null?void 0:D.properties)===null||R===void 0?void 0:R[l];if(typeof P!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);$=$&&(T||g(D)),k(P,I)}if(!$)throw new Error(`discriminator: "${l}" must be required`);return v;function g({required:I}){return Array.isArray(I)&&I.includes(l)}function k(I,D){if(I.const)C(I.const,D);else if(I.enum)for(const P of I.enum)C(P,D);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function C(I,D){if(typeof I!="string"||I in v)throw new Error(`discriminator: "${l}" values must be unique strings`);v[I]=D}}}};discriminator.default=def;const $schema$1="http://json-schema.org/draft-07/schema#",$id="http://json-schema.org/draft-07/schema#",title="Core schema meta-schema",definitions$1={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type=["object","boolean"],properties={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},require$$3={$schema:$schema$1,$id,title,definitions:definitions$1,type,properties,default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=core$2,n=draft7,s=discriminator,o=require$$3,i=["/properties"],l="http://json-schema.org/draft-07/schema";class p extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(v=>this.addVocabulary(v)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const v=this.opts.$data?this.$dataMetaSchema(o,i):o;this.addMetaSchema(v,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=p,Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var d=validate;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var u=codegen;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var m=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return m.default}});var w=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return w.default}})})(ajv$1,ajv$1.exports);var ajvExports=ajv$1.exports;const Ajv=getDefaultExportFromCjs(ajvExports),$schema="http://json-schema.org/schema",$ref="#/definitions/Blueprint",definitions={Blueprint:{type:"object",properties:{landingPage:{type:"string",description:"The URL to navigate to after the blueprint has been run."},description:{type:"string",description:"Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what."},preferredVersions:{type:"object",properties:{php:{anyOf:[{$ref:"#/definitions/SupportedPHPVersion"},{type:"string",const:"latest"}],description:"The preferred PHP version to use. If not specified, the latest supported version will be used"},wp:{type:"string",description:"The preferred WordPress version to use. If not specified, the latest supported version will be used"}},required:["php","wp"],additionalProperties:!1,description:"The preferred PHP and WordPress versions to use."},features:{type:"object",properties:{networking:{type:"boolean",description:"Should boot with support for network request via wp_safe_remote_get?"}},additionalProperties:!1},constants:{type:"object",additionalProperties:{type:"string"},description:"PHP Constants to define on every request",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},plugins:{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/definitions/FileReference"}]},description:"WordPress plugins to install and activate",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define",deprecated:"This experimental option will change without warning.\nUse `steps` instead."},login:{anyOf:[{type:"boolean"},{type:"object",properties:{username:{type:"string"},password:{type:"string"}},required:["username","password"],additionalProperties:!1}],description:"User to log in as. If true, logs the user in as admin/password."},phpExtensionBundles:{type:"array",items:{$ref:"#/definitions/SupportedPHPExtensionBundle"},description:"The PHP extensions to use."},steps:{type:"array",items:{anyOf:[{$ref:"#/definitions/StepDefinition"},{type:"string"},{not:{}},{type:"boolean",const:!1},{type:"null"}]},description:"The steps to run after every other operation in this Blueprint was executed."},$schema:{type:"string"}},additionalProperties:!1},SupportedPHPVersion:{type:"string",enum:["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"]},FileReference:{anyOf:[{$ref:"#/definitions/VFSReference"},{$ref:"#/definitions/LiteralReference"},{$ref:"#/definitions/CoreThemeReference"},{$ref:"#/definitions/CorePluginReference"},{$ref:"#/definitions/UrlReference"}]},VFSReference:{type:"object",properties:{resource:{type:"string",const:"vfs",description:"Identifies the file resource as Virtual File System (VFS)"},path:{type:"string",description:"The path to the file in the VFS"}},required:["resource","path"],additionalProperties:!1},LiteralReference:{type:"object",properties:{resource:{type:"string",const:"literal",description:"Identifies the file resource as a literal file"},name:{type:"string",description:"The name of the file"},contents:{anyOf:[{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The contents of the file"}},required:["resource","name","contents"],additionalProperties:!1},CoreThemeReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/themes",description:"Identifies the file resource as a WordPress Core theme"},slug:{type:"string",description:"The slug of the WordPress Core theme"}},required:["resource","slug"],additionalProperties:!1},CorePluginReference:{type:"object",properties:{resource:{type:"string",const:"wordpress.org/plugins",description:"Identifies the file resource as a WordPress Core plugin"},slug:{type:"string",description:"The slug of the WordPress Core plugin"}},required:["resource","slug"],additionalProperties:!1},UrlReference:{type:"object",properties:{resource:{type:"string",const:"url",description:"Identifies the file resource as a URL"},url:{type:"string",description:"The URL of the file"},caption:{type:"string",description:"Optional caption for displaying a progress message"}},required:["resource","url"],additionalProperties:!1},SupportedPHPExtensionBundle:{type:"string",const:"kitchen-sink"},StepDefinition:{type:"object",discriminator:{propertyName:"step"},required:["step"],oneOf:[{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activatePlugin"},pluginPath:{type:"string",description:"Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php)."},pluginName:{type:"string",description:"Optional. Plugin name to display in the progress bar."}},required:["pluginPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"activateTheme"},themeFolderName:{type:"string",description:"The name of the theme folder inside wp-content/themes/"}},required:["step","themeFolderName"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"applyWordPressPatches"},siteUrl:{type:"string"},wordpressPath:{type:"string"},addPhpInfo:{type:"boolean"},patchSecrets:{type:"boolean"},disableSiteHealth:{type:"boolean"},disableWpNewBlogNotification:{type:"boolean"},prepareForRunningInsideWebBrowser:{type:"boolean"},addFetchNetworkTransport:{type:"boolean"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"cp"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineWpConfigConsts"},consts:{type:"object",additionalProperties:{},description:"The constants to define"},method:{type:"string",enum:["rewrite-wp-config","define-before-run"],description:`The method of defining the constants. Possible values are:
|
|
859
928
|
|
|
860
929
|
- rewrite-wp-config: Default. Rewrites the wp-config.php file to explicitly call define() with the requested name and value. This method alters the file on the disk, but it doesn't conflict with existing define() calls in wp-config.php.
|
|
861
930
|
- define-before-run: Defines the constant before running the requested script. It doesn't alter any files on the disk, but constants defined this way may conflict with existing define() calls in wp-config.php.`},virtualize:{type:"boolean",deprecated:`This option is noop and will be removed in a future version.
|
|
862
931
|
This option is only kept in here to avoid breaking Blueprint schema validation
|
|
863
|
-
for existing apps using this option.`}},required:["consts","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineSiteUrl"},siteUrl:{type:"string",description:"The URL"}},required:["siteUrl","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importFile"},file:{$ref:"#/definitions/FileReference",description:"The file to import"}},required:["file","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWordPressFiles"},wordPressFilesZip:{$ref:"#/definitions/FileReference",description:"The zip file containing the top-level WordPress files and directories."},pathInZip:{type:"string",description:"The path inside the zip file where the WordPress files are."}},required:["step","wordPressFilesZip"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"installPlugin",description:"The step identifier."},pluginZipFile:{$ref:"#/definitions/FileReference",description:"The plugin zip file to install."},options:{$ref:"#/definitions/InstallPluginOptions",description:"Optional installation options."}},required:["pluginZipFile","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"installTheme",description:"The step identifier."},themeZipFile:{$ref:"#/definitions/FileReference",description:"The theme zip file to install."},options:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the theme after installing it."}},additionalProperties:!1,description:"Optional installation options."}},required:["step","themeZipFile"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"login"},username:{type:"string",description:"The user to log in as. Defaults to 'admin'."},password:{type:"string",description:"The password to log in with. Defaults to 'password'."}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mkdir"},path:{type:"string",description:"The path of the directory you want to create"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mv"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"request"},request:{$ref:"#/definitions/PHPRequest",description:"Request details (See /wordpress-playground/api/universal/interface/PHPRequest)"}},required:["request","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rm"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rmdir"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHP",description:"The step identifier."},code:{type:"string",description:"The PHP code to run."}},required:["code","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHPWithOptions"},options:{$ref:"#/definitions/PHPRunOptions",description:"Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runWpInstallationWizard"},options:{$ref:"#/definitions/WordPressInstallationOptions"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runSql",description:"The step identifier."},sql:{$ref:"#/definitions/FileReference",description:"The SQL to run. Each non-empty line must contain a valid SQL query."}},required:["sql","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setPhpIniEntry"},key:{type:"string",description:'Entry name e.g. "display_errors"'},value:{type:"string",description:'Entry value as a string e.g. "1"'}},required:["key","step","value"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setSiteOptions",description:'The name of the step. Must be "setSiteOptions".'},options:{type:"object",additionalProperties:{},description:"The options to set on the site."}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"unzip"},zipPath:{type:"string",description:"The zip file to extract"},extractToPath:{type:"string",description:"The path to extract the zip file to"}},required:["extractToPath","step","zipPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"updateUserMeta"},meta:{type:"object",additionalProperties:{},description:'An object of user meta values to set, e.g. { "first_name": "John" }'},userId:{type:"number",description:"User ID"}},required:["meta","step","userId"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"writeFile"},path:{type:"string",description:"The path of the file to write to"},data:{anyOf:[{$ref:"#/definitions/FileReference"},{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The data to write"}},required:["data","path","step"]}]},InstallPluginOptions:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the plugin after installing it."}},additionalProperties:!1},PHPRequest:{type:"object",properties:{method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},url:{type:"string",description:"Request path or absolute URL."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},files:{type:"object",additionalProperties:{type:"object",properties:{size:{type:"number"},type:{type:"string"},lastModified:{type:"number"},name:{type:"string"},webkitRelativePath:{type:"string"}},required:["lastModified","name","size","type","webkitRelativePath"],additionalProperties:!1},description:"Uploaded files"},body:{type:"string",description:"Request body without the files."},formData:{type:"object",additionalProperties:{},description:"Form data. If set, the request body will be ignored and the content-type header will be set to `application/x-www-form-urlencoded`."}},required:["url"],additionalProperties:!1},HTTPMethod:{type:"string",enum:["GET","POST","HEAD","OPTIONS","PATCH","PUT","DELETE"]},PHPRequestHeaders:{type:"object",additionalProperties:{type:"string"}},PHPRunOptions:{type:"object",properties:{relativeUri:{type:"string",description:"Request path following the domain:port part."},scriptPath:{type:"string",description:"Path of the .php file to execute."},protocol:{type:"string",description:"Request protocol."},method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{type:"string",description:"Request body without the files."},fileInfos:{type:"array",items:{$ref:"#/definitions/FileInfo"},description:"Uploaded files."},code:{type:"string",description:"The code snippet to eval instead of a php file."}},additionalProperties:!1},FileInfo:{type:"object",properties:{key:{type:"string"},name:{type:"string"},type:{type:"string"},data:{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}},required:["key","name","type","data"],additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},vp={$schema:$p,$ref:_p,definitions:wp};function ia(e,{progress:t=new gn,semaphore:r=new xn({concurrency:3}),onStepCompleted:n=()=>{}}={}){var u,p,h;if(e={...e,steps:(e.steps||[]).filter(Tp)},e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const v=e.plugins.map(T=>typeof T=="string"?T.startsWith("https://")?{resource:"url",url:T}:{resource:"wordpress.org/plugins",slug:T}:T).map(T=>({step:"installPlugin",pluginZipFile:T}));e.steps.unshift(...v)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login});const{valid:s,errors:i}=Pp(e);if(!s){const v=new Error(`Invalid blueprint: ${i[0].message} at ${i[0].instancePath}`);throw v.errors=i,v}const o=e.steps||[],l=o.reduce((v,T)=>{var w;return v+(((w=T.progress)==null?void 0:w.weight)||1)},0),d=o.map(v=>Rp(v,{semaphore:r,rootProgressTracker:t,totalProgressWeight:l}));return{versions:{php:Ep((u=e.preferredVersions)==null?void 0:u.php,$n,no),wp:((p=e.preferredVersions)==null?void 0:p.wp)||"latest"},phpExtensions:Sp([],e.phpExtensionBundles||[]),features:{networking:((h=e.features)==null?void 0:h.networking)??!1},run:async v=>{try{for(const{resources:T}of d)for(const w of T)w.setPlayground(v),w.isAsync&&w.resolve();for(const{run:T,step:w}of d){const R=await T(v);n(R,w)}}finally{try{await v.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const bp=new gp({discriminator:!0});let Fr;function Pp(e){var s;Fr=bp.compile(vp);const t=Fr(e);if(t)return{valid:t};const r=new Set;for(const i of Fr.errors)i.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(i.instancePath);const n=(s=Fr.errors)==null?void 0:s.filter(i=>!(i.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(i.instancePath)));return{valid:t,errors:n}}function Ep(e,t,r){return e&&t.includes(e)?e:r}function Sp(e,t){const r=so.filter(s=>e.includes(s)),n=t.flatMap(s=>s in ni?ni[s]:[]);return Array.from(new Set([...r,...n]))}function Tp(e){return!!(typeof e=="object"&&e)}function Rp(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var p;const s=r.stage((((p=e.progress)==null?void 0:p.weight)||1)/n),i={};for(const h of Object.keys(e)){let v=e[h];mc(v)&&(v=St.create(v,{semaphore:t})),i[h]=v}const o=async h=>{var v;try{return s.fillSlowly(),await La[e.step](h,await kp(i),{tracker:s,initialCaption:(v=e.progress)==null?void 0:v.caption})}finally{s.finish()}},l=Si(i),d=Si(i).filter(h=>h.isAsync),u=1/(d.length+1);for(const h of d)h.progress=s.stage(u);return{run:o,step:e,resources:l}}function Si(e){const t=[];for(const r in e){const n=e[r];n instanceof St&&t.push(n)}return t}async function kp(e){const t={};for(const r in e){const n=e[r];n instanceof St?t[r]=await n.resolve():t[r]=n}return t}async function oa(e,t){await e.run(t)}function Op(){}/**
|
|
932
|
+
for existing apps using this option.`}},required:["consts","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"defineSiteUrl"},siteUrl:{type:"string",description:"The URL"}},required:["siteUrl","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"enableMultisite"}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importFile"},file:{$ref:"#/definitions/FileReference",description:"The file to import"}},required:["file","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"importWordPressFiles"},wordPressFilesZip:{$ref:"#/definitions/FileReference",description:"The zip file containing the top-level WordPress files and directories."},pathInZip:{type:"string",description:"The path inside the zip file where the WordPress files are."}},required:["step","wordPressFilesZip"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"installPlugin",description:"The step identifier."},pluginZipFile:{$ref:"#/definitions/FileReference",description:"The plugin zip file to install."},options:{$ref:"#/definitions/InstallPluginOptions",description:"Optional installation options."}},required:["pluginZipFile","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"installTheme",description:"The step identifier."},themeZipFile:{$ref:"#/definitions/FileReference",description:"The theme zip file to install."},options:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the theme after installing it."}},additionalProperties:!1,description:"Optional installation options."}},required:["step","themeZipFile"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"login"},username:{type:"string",description:"The user to log in as. Defaults to 'admin'."},password:{type:"string",description:"The password to log in with. Defaults to 'password'."}},required:["step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mkdir"},path:{type:"string",description:"The path of the directory you want to create"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"mv"},fromPath:{type:"string",description:"Source path"},toPath:{type:"string",description:"Target path"}},required:["fromPath","step","toPath"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"request"},request:{$ref:"#/definitions/PHPRequest",description:"Request details (See /wordpress-playground/api/universal/interface/PHPRequest)"}},required:["request","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rm"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"rmdir"},path:{type:"string",description:"The path to remove"}},required:["path","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHP",description:"The step identifier."},code:{type:"string",description:"The PHP code to run."}},required:["code","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runPHPWithOptions"},options:{$ref:"#/definitions/PHPRunOptions",description:"Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runWpInstallationWizard"},options:{$ref:"#/definitions/WordPressInstallationOptions"}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"runSql",description:"The step identifier."},sql:{$ref:"#/definitions/FileReference",description:"The SQL to run. Each non-empty line must contain a valid SQL query."}},required:["sql","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setPhpIniEntry"},key:{type:"string",description:'Entry name e.g. "display_errors"'},value:{type:"string",description:'Entry value as a string e.g. "1"'}},required:["key","step","value"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"setSiteOptions",description:'The name of the step. Must be "setSiteOptions".'},options:{type:"object",additionalProperties:{},description:"The options to set on the site."}},required:["options","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"unzip"},zipFile:{$ref:"#/definitions/FileReference",description:"The zip file to extract"},zipPath:{type:"string",description:"The path of the zip file to extract",deprecated:"Use zipFile instead."},extractToPath:{type:"string",description:"The path to extract the zip file to"}},required:["extractToPath","step"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"updateUserMeta"},meta:{type:"object",additionalProperties:{},description:'An object of user meta values to set, e.g. { "first_name": "John" }'},userId:{type:"number",description:"User ID"}},required:["meta","step","userId"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"writeFile"},path:{type:"string",description:"The path of the file to write to"},data:{anyOf:[{$ref:"#/definitions/FileReference"},{type:"string"},{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}],description:"The data to write"}},required:["data","path","step"]}]},InstallPluginOptions:{type:"object",properties:{activate:{type:"boolean",description:"Whether to activate the plugin after installing it."}},additionalProperties:!1},PHPRequest:{type:"object",properties:{method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},url:{type:"string",description:"Request path or absolute URL."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},files:{type:"object",additionalProperties:{type:"object",properties:{size:{type:"number"},type:{type:"string"},lastModified:{type:"number"},name:{type:"string"},webkitRelativePath:{type:"string"}},required:["lastModified","name","size","type","webkitRelativePath"],additionalProperties:!1},description:"Uploaded files"},body:{type:"string",description:"Request body without the files."},formData:{type:"object",additionalProperties:{},description:"Form data. If set, the request body will be ignored and the content-type header will be set to `application/x-www-form-urlencoded`."}},required:["url"],additionalProperties:!1},HTTPMethod:{type:"string",enum:["GET","POST","HEAD","OPTIONS","PATCH","PUT","DELETE"]},PHPRequestHeaders:{type:"object",additionalProperties:{type:"string"}},PHPRunOptions:{type:"object",properties:{relativeUri:{type:"string",description:"Request path following the domain:port part."},scriptPath:{type:"string",description:"Path of the .php file to execute."},protocol:{type:"string",description:"Request protocol."},method:{$ref:"#/definitions/HTTPMethod",description:"Request method. Default: `GET`."},headers:{$ref:"#/definitions/PHPRequestHeaders",description:"Request headers."},body:{type:"string",description:"Request body without the files."},fileInfos:{type:"array",items:{$ref:"#/definitions/FileInfo"},description:"Uploaded files."},code:{type:"string",description:"The code snippet to eval instead of a php file."},throwOnError:{type:"boolean",description:"Whether to throw an error if the PHP process exits with a non-zero code or outputs to stderr."}},additionalProperties:!1},FileInfo:{type:"object",properties:{key:{type:"string"},name:{type:"string"},type:{type:"string"},data:{type:"object",properties:{BYTES_PER_ELEMENT:{type:"number"},buffer:{type:"object",properties:{byteLength:{type:"number"}},required:["byteLength"],additionalProperties:!1},byteLength:{type:"number"},byteOffset:{type:"number"},length:{type:"number"}},required:["BYTES_PER_ELEMENT","buffer","byteLength","byteOffset","length"],additionalProperties:{type:"number"}}},required:["key","name","type","data"],additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},blueprintSchema={$schema,$ref,definitions};function compileBlueprint(e,{progress:t=new ProgressTracker,semaphore:r=new Semaphore({concurrency:3}),onStepCompleted:n=()=>{}}={}){var d,u,m;if(e={...e,steps:(e.steps||[]).filter(isStepDefinition)},e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const w=e.plugins.map(R=>typeof R=="string"?R.startsWith("https://")?{resource:"url",url:R}:{resource:"wordpress.org/plugins",slug:R}:R).map(R=>({step:"installPlugin",pluginZipFile:R}));e.steps.unshift(...w)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login});const{valid:s,errors:o}=validateBlueprint(e);if(!s){const w=new Error(`Invalid blueprint: ${o[0].message} at ${o[0].instancePath}`);throw w.errors=o,w}const i=e.steps||[],l=i.reduce((w,R)=>{var v;return w+(((v=R.progress)==null?void 0:v.weight)||1)},0),p=i.map(w=>compileStep(w,{semaphore:r,rootProgressTracker:t,totalProgressWeight:l}));return{versions:{php:compileVersion((d=e.preferredVersions)==null?void 0:d.php,SupportedPHPVersions,LatestSupportedPHPVersion),wp:((u=e.preferredVersions)==null?void 0:u.wp)||"latest"},phpExtensions:compilePHPExtensions([],e.phpExtensionBundles||[]),features:{networking:((m=e.features)==null?void 0:m.networking)??!1},run:async w=>{try{for(const{resources:R}of p)for(const v of R)v.setPlayground(w),v.isAsync&&v.resolve();for(const[R,{run:v,step:T}]of Object.entries(p))try{const $=await v(w);n($,T)}catch($){throw new Error(`Error when executing the blueprint step #${R} (${JSON.stringify(T)}). Inspect the cause of this error for more details`,{cause:$})}}finally{try{await w.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const ajv=new Ajv({discriminator:!0});let blueprintValidator;function validateBlueprint(e){var s;blueprintValidator=ajv.compile(blueprintSchema);const t=blueprintValidator(e);if(t)return{valid:t};const r=new Set;for(const o of blueprintValidator.errors)o.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(o.instancePath);const n=(s=blueprintValidator.errors)==null?void 0:s.filter(o=>!(o.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(o.instancePath)));return{valid:t,errors:n}}function compileVersion(e,t,r){return e&&t.includes(e)?e:r}function compilePHPExtensions(e,t){const r=SupportedPHPExtensionsList.filter(s=>e.includes(s)),n=t.flatMap(s=>s in SupportedPHPExtensionBundles?SupportedPHPExtensionBundles[s]:[]);return Array.from(new Set([...r,...n]))}function isStepDefinition(e){return!!(typeof e=="object"&&e)}function compileStep(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var u;const s=r.stage((((u=e.progress)==null?void 0:u.weight)||1)/n),o={};for(const m of Object.keys(e)){let w=e[m];isFileReference(w)&&(w=Resource.create(w,{semaphore:t})),o[m]=w}const i=async m=>{var w;try{return s.fillSlowly(),await stepHandlers[e.step](m,await resolveArguments(o),{tracker:s,initialCaption:(w=e.progress)==null?void 0:w.caption})}finally{s.finish()}},l=getResources(o),p=getResources(o).filter(m=>m.isAsync),d=1/(p.length+1);for(const m of p)m.progress=s.stage(d);return{run:i,step:e,resources:l}}function getResources(e){const t=[];for(const r in e){const n=e[r];n instanceof Resource&&t.push(n)}return t}async function resolveArguments(e){const t={};for(const r in e){const n=e[r];n instanceof Resource?t[r]=await n.resolve():t[r]=n}return t}async function runBlueprintSteps(e,t){await e.run(t)}function setPluginProxyURL(){}/**
|
|
864
933
|
* @license
|
|
865
934
|
* Copyright 2019 Google LLC
|
|
866
935
|
* SPDX-License-Identifier: Apache-2.0
|
|
867
|
-
*/const aa=Symbol("Comlink.proxy"),Cp=Symbol("Comlink.endpoint"),Np=Symbol("Comlink.releaseProxy"),jn=Symbol("Comlink.finalizer"),zr=Symbol("Comlink.thrown"),ca=e=>typeof e=="object"&&e!==null||typeof e=="function",jp={canHandle:e=>ca(e)&&e[aa],serialize(e){const{port1:t,port2:r}=new MessageChannel;return As(e,t),[r,[r]]},deserialize(e){return e.start(),Ds(e)}},Ip={canHandle:e=>ca(e)&&zr in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},gr=new Map([["proxy",jp],["throw",Ip]]);function Ap(e,t){for(const r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function As(e,t=globalThis,r=["*"]){t.addEventListener("message",function n(s){if(!s||!s.data)return;if(!Ap(r,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:i,type:o,path:l}=Object.assign({path:[]},s.data),d=(s.data.argumentList||[]).map(gt);let u;try{const p=l.slice(0,-1).reduce((v,T)=>v[T],e),h=l.reduce((v,T)=>v[T],e);switch(o){case"GET":u=h;break;case"SET":p[l.slice(-1)[0]]=gt(s.data.value),u=!0;break;case"APPLY":u=h.apply(p,d);break;case"CONSTRUCT":{const v=new h(...d);u=pa(v)}break;case"ENDPOINT":{const{port1:v,port2:T}=new MessageChannel;As(e,T),u=Up(v,[v])}break;case"RELEASE":u=void 0;break;default:return}}catch(p){u={value:p,[zr]:0}}Promise.resolve(u).catch(p=>({value:p,[zr]:0})).then(p=>{const[h,v]=Zr(p);t.postMessage(Object.assign(Object.assign({},h),{id:i}),v),o==="RELEASE"&&(t.removeEventListener("message",n),la(t),jn in e&&typeof e[jn]=="function"&&e[jn]())}).catch(p=>{const[h,v]=Zr({value:new TypeError("Unserializable return value"),[zr]:0});t.postMessage(Object.assign(Object.assign({},h),{id:i}),v)})}),t.start&&t.start()}function Dp(e){return e.constructor.name==="MessagePort"}function la(e){Dp(e)&&e.close()}function Ds(e,t){return Hn(e,[],t)}function qr(e){if(e)throw new Error("Proxy has been released and is not useable")}function ua(e){return Ut(e,{type:"RELEASE"}).then(()=>{la(e)})}const Yr=new WeakMap,Qr="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(Yr.get(e)||0)-1;Yr.set(e,t),t===0&&ua(e)});function Fp(e,t){const r=(Yr.get(t)||0)+1;Yr.set(t,r),Qr&&Qr.register(e,t,e)}function qp(e){Qr&&Qr.unregister(e)}function Hn(e,t=[],r=function(){}){let n=!1;const s=new Proxy(r,{get(i,o){if(qr(n),o===Np)return()=>{qp(s),ua(e),n=!0};if(o==="then"){if(t.length===0)return{then:()=>s};const l=Ut(e,{type:"GET",path:t.map(d=>d.toString())}).then(gt);return l.then.bind(l)}return Hn(e,[...t,o])},set(i,o,l){qr(n);const[d,u]=Zr(l);return Ut(e,{type:"SET",path:[...t,o].map(p=>p.toString()),value:d},u).then(gt)},apply(i,o,l){qr(n);const d=t[t.length-1];if(d===Cp)return Ut(e,{type:"ENDPOINT"}).then(gt);if(d==="bind")return Hn(e,t.slice(0,-1));const[u,p]=Ti(l);return Ut(e,{type:"APPLY",path:t.map(h=>h.toString()),argumentList:u},p).then(gt)},construct(i,o){qr(n);const[l,d]=Ti(o);return Ut(e,{type:"CONSTRUCT",path:t.map(u=>u.toString()),argumentList:l},d).then(gt)}});return Fp(s,e),s}function Mp(e){return Array.prototype.concat.apply([],e)}function Ti(e){const t=e.map(Zr);return[t.map(r=>r[0]),Mp(t.map(r=>r[1]))]}const da=new WeakMap;function Up(e,t){return da.set(e,t),e}function pa(e){return Object.assign(e,{[aa]:!0})}function Lp(e,t=globalThis,r="*"){return{postMessage:(n,s)=>e.postMessage(n,r,s),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function Zr(e){for(const[t,r]of gr)if(r.canHandle(e)){const[n,s]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},s]}return[{type:"RAW",value:e},da.get(e)||[]]}function gt(e){switch(e.type){case"HANDLER":return gr.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Ut(e,t,r){return new Promise(n=>{const s=Hp();e.addEventListener("message",function i(o){!o.data||!o.data.id||o.data.id!==s||(e.removeEventListener("message",i),n(o.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),r)})}function Hp(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function fa(e){Vp();const t=e instanceof Worker?e:Lp(e),r=Ds(t),n=ha(r);return new Proxy(n,{get:(s,i)=>i==="isConnected"?async()=>{for(let o=0;o<10;o++)try{await zp(r.isConnected(),200);break}catch{}}:r[i]})}async function zp(e,t){return new Promise((r,n)=>{setTimeout(n,t),e.then(r)})}let Ri=!1;function Vp(){Ri||(Ri=!0,gr.set("EVENT",{canHandle:e=>e instanceof CustomEvent,serialize:e=>[{detail:e.detail},[]],deserialize:e=>e}),gr.set("FUNCTION",{canHandle:e=>typeof e=="function",serialize(e){console.debug("[Comlink][Performance] Proxying a function");const{port1:t,port2:r}=new MessageChannel;return As(e,t),[r,[r]]},deserialize(e){return e.start(),Ds(e)}}),gr.set("PHPResponse",{canHandle:e=>typeof e=="object"&&e!==null&&"headers"in e&&"bytes"in e&&"errors"in e&&"exitCode"in e&&"httpStatusCode"in e,serialize(e){return[e.toRawData(),[]]},deserialize(e){return bt.fromRawData(e)}}))}function ha(e){return new Proxy(e,{get(t,r){switch(typeof t[r]){case"function":return(...n)=>t[r](...n);case"object":return t[r]===null?t[r]:ha(t[r]);case"undefined":case"number":case"string":return t[r];default:return pa(t[r])}}})}async function ma({iframe:e,blueprint:t,remoteUrl:r,progressTracker:n=new gn,disableProgressBar:s,onBlueprintStepCompleted:i}){if(xp(r),Wp(e),r=Oi(r,{progressbar:!s}),n.setCaption("Preparing WordPress"),!t)return ki(e,r,n);const o=ia(t,{progress:n.stage(.5),onStepCompleted:i}),l=await ki(e,Oi(r,{php:o.versions.php,wp:o.versions.wp,"php-extension":o.phpExtensions,networking:o.features.networking?"yes":"no"}),n);return await oa(o,l),n.finish(),l}function Wp(e){var t,r;(t=e.sandbox)!=null&&t.length&&!((r=e.sandbox)!=null&&r.contains("allow-storage-access-by-user-activation"))&&e.sandbox.add("allow-storage-access-by-user-activation")}async function ki(e,t,r){await new Promise(i=>{e.src=t,e.addEventListener("load",i,!1)});const n=fa(e.contentWindow);await n.isConnected(),r.pipe(n);const s=r.stage();return await n.onDownloadProgress(s.loadingListener),await n.isReady(),s.finish(),n}const Vr="https://playground.wordpress.net";function xp(e){const t=new URL(e,Vr);if((t.origin===Vr||t.hostname==="localhost")&&t.pathname!=="/remote.html")throw new Error(`Invalid remote URL: ${t}. Expected origin to be ${Vr}/remote.html.`)}function Oi(e,t){const r=new URL(e,Vr),n=new URLSearchParams(r.search);for(const[s,i]of Object.entries(t))if(i!=null&&i!==!1)if(Array.isArray(i))for(const o of i)n.append(s,o.toString());else n.set(s,i.toString());return r.search=n.toString(),r.toString()}async function Bp(e,t){if(console.warn("`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."),t!=null&&t.loadRemote)return ma({iframe:e,remoteUrl:t.loadRemote});const r=fa(e.contentWindow);return await r.isConnected(),r}exports.LatestSupportedPHPVersion=no;exports.SupportedPHPVersions=$n;exports.SupportedPHPVersionsList=Xa;exports.activatePlugin=Vn;exports.activateTheme=Wn;exports.applyWordPressPatches=ji;exports.compileBlueprint=ia;exports.connectPlayground=Bp;exports.cp=Mi;exports.defineSiteUrl=zi;exports.defineWpConfigConsts=Lt;exports.exportWXR=Bi;exports.exportWXZ=Gi;exports.importFile=Vi;exports.importWordPressFiles=xi;exports.installPlugin=Ji;exports.installTheme=Yi;exports.login=Qi;exports.mkdir=Li;exports.mv=Ui;exports.phpVar=Kt;exports.phpVars=vr;exports.request=qi;exports.rm=Bn;exports.rmdir=Hi;exports.runBlueprintSteps=oa;exports.runPHP=Ii;exports.runPHPWithOptions=Ai;exports.runSql=Di;exports.runWpInstallationWizard=Zi;exports.setPhpIniEntry=Fi;exports.setPluginProxyURL=Op;exports.setSiteOptions=Xi;exports.startPlaygroundWeb=ma;exports.unzip=mn;exports.updateUserMeta=eo;exports.wpContentFilesExcludedFromExport=zn;exports.writeFile=Gn;exports.zipWpContent=ro;
|
|
936
|
+
*/const proxyMarker=Symbol("Comlink.proxy"),createEndpoint=Symbol("Comlink.endpoint"),releaseProxy=Symbol("Comlink.releaseProxy"),finalizer=Symbol("Comlink.finalizer"),throwMarker=Symbol("Comlink.thrown"),isObject=e=>typeof e=="object"&&e!==null||typeof e=="function",proxyTransferHandler={canHandle:e=>isObject(e)&&e[proxyMarker],serialize(e){const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize(e){return e.start(),wrap(e)}},throwTransferHandler={canHandle:e=>isObject(e)&&throwMarker in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},transferHandlers=new Map([["proxy",proxyTransferHandler],["throw",throwTransferHandler]]);function isAllowedOrigin(e,t){for(const r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function expose(e,t=globalThis,r=["*"]){t.addEventListener("message",function n(s){if(!s||!s.data)return;if(!isAllowedOrigin(r,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:o,type:i,path:l}=Object.assign({path:[]},s.data),p=(s.data.argumentList||[]).map(fromWireValue);let d;try{const u=l.slice(0,-1).reduce((w,R)=>w[R],e),m=l.reduce((w,R)=>w[R],e);switch(i){case"GET":d=m;break;case"SET":u[l.slice(-1)[0]]=fromWireValue(s.data.value),d=!0;break;case"APPLY":d=m.apply(u,p);break;case"CONSTRUCT":{const w=new m(...p);d=proxy(w)}break;case"ENDPOINT":{const{port1:w,port2:R}=new MessageChannel;expose(e,R),d=transfer(w,[w])}break;case"RELEASE":d=void 0;break;default:return}}catch(u){d={value:u,[throwMarker]:0}}Promise.resolve(d).catch(u=>({value:u,[throwMarker]:0})).then(u=>{const[m,w]=toWireValue(u);t.postMessage(Object.assign(Object.assign({},m),{id:o}),w),i==="RELEASE"&&(t.removeEventListener("message",n),closeEndPoint(t),finalizer in e&&typeof e[finalizer]=="function"&&e[finalizer]())}).catch(u=>{const[m,w]=toWireValue({value:new TypeError("Unserializable return value"),[throwMarker]:0});t.postMessage(Object.assign(Object.assign({},m),{id:o}),w)})}),t.start&&t.start()}function isMessagePort(e){return e.constructor.name==="MessagePort"}function closeEndPoint(e){isMessagePort(e)&&e.close()}function wrap(e,t){return createProxy(e,[],t)}function throwIfProxyReleased(e){if(e)throw new Error("Proxy has been released and is not useable")}function releaseEndpoint(e){return requestResponseMessage(e,{type:"RELEASE"}).then(()=>{closeEndPoint(e)})}const proxyCounter=new WeakMap,proxyFinalizers="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(proxyCounter.get(e)||0)-1;proxyCounter.set(e,t),t===0&&releaseEndpoint(e)});function registerProxy(e,t){const r=(proxyCounter.get(t)||0)+1;proxyCounter.set(t,r),proxyFinalizers&&proxyFinalizers.register(e,t,e)}function unregisterProxy(e){proxyFinalizers&&proxyFinalizers.unregister(e)}function createProxy(e,t=[],r=function(){}){let n=!1;const s=new Proxy(r,{get(o,i){if(throwIfProxyReleased(n),i===releaseProxy)return()=>{unregisterProxy(s),releaseEndpoint(e),n=!0};if(i==="then"){if(t.length===0)return{then:()=>s};const l=requestResponseMessage(e,{type:"GET",path:t.map(p=>p.toString())}).then(fromWireValue);return l.then.bind(l)}return createProxy(e,[...t,i])},set(o,i,l){throwIfProxyReleased(n);const[p,d]=toWireValue(l);return requestResponseMessage(e,{type:"SET",path:[...t,i].map(u=>u.toString()),value:p},d).then(fromWireValue)},apply(o,i,l){throwIfProxyReleased(n);const p=t[t.length-1];if(p===createEndpoint)return requestResponseMessage(e,{type:"ENDPOINT"}).then(fromWireValue);if(p==="bind")return createProxy(e,t.slice(0,-1));const[d,u]=processArguments(l);return requestResponseMessage(e,{type:"APPLY",path:t.map(m=>m.toString()),argumentList:d},u).then(fromWireValue)},construct(o,i){throwIfProxyReleased(n);const[l,p]=processArguments(i);return requestResponseMessage(e,{type:"CONSTRUCT",path:t.map(d=>d.toString()),argumentList:l},p).then(fromWireValue)}});return registerProxy(s,e),s}function myFlat(e){return Array.prototype.concat.apply([],e)}function processArguments(e){const t=e.map(toWireValue);return[t.map(r=>r[0]),myFlat(t.map(r=>r[1]))]}const transferCache=new WeakMap;function transfer(e,t){return transferCache.set(e,t),e}function proxy(e){return Object.assign(e,{[proxyMarker]:!0})}function windowEndpoint(e,t=globalThis,r="*"){return{postMessage:(n,s)=>e.postMessage(n,r,s),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function toWireValue(e){for(const[t,r]of transferHandlers)if(r.canHandle(e)){const[n,s]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},s]}return[{type:"RAW",value:e},transferCache.get(e)||[]]}function fromWireValue(e){switch(e.type){case"HANDLER":return transferHandlers.get(e.name).deserialize(e.value);case"RAW":return e.value}}function requestResponseMessage(e,t,r){return new Promise(n=>{const s=generateUUID();e.addEventListener("message",function o(i){!i.data||!i.data.id||i.data.id!==s||(e.removeEventListener("message",o),n(i.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),r)})}function generateUUID(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function consumeAPI(e){setupTransferHandlers();const t=e instanceof Worker?e:windowEndpoint(e),r=wrap(t),n=proxyClone(r);return new Proxy(n,{get:(s,o)=>o==="isConnected"?async()=>{for(let i=0;i<10;i++)try{await runWithTimeout(r.isConnected(),200);break}catch{}}:r[o]})}async function runWithTimeout(e,t){return new Promise((r,n)=>{setTimeout(n,t),e.then(r)})}let isTransferHandlersSetup=!1;function setupTransferHandlers(){isTransferHandlersSetup||(isTransferHandlersSetup=!0,transferHandlers.set("EVENT",{canHandle:e=>e instanceof CustomEvent,serialize:e=>[{detail:e.detail},[]],deserialize:e=>e}),transferHandlers.set("FUNCTION",{canHandle:e=>typeof e=="function",serialize(e){console.debug("[Comlink][Performance] Proxying a function");const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize(e){return e.start(),wrap(e)}}),transferHandlers.set("PHPResponse",{canHandle:e=>typeof e=="object"&&e!==null&&"headers"in e&&"bytes"in e&&"errors"in e&&"exitCode"in e&&"httpStatusCode"in e,serialize(e){return[e.toRawData(),[]]},deserialize(e){return PHPResponse.fromRawData(e)}}))}function proxyClone(e){return new Proxy(e,{get(t,r){switch(typeof t[r]){case"function":return(...n)=>t[r](...n);case"object":return t[r]===null?t[r]:proxyClone(t[r]);case"undefined":case"number":case"string":return t[r];default:return proxy(t[r])}}})}async function startPlaygroundWeb({iframe:e,blueprint:t,remoteUrl:r,progressTracker:n=new ProgressTracker,disableProgressBar:s,onBlueprintStepCompleted:o,sapiName:i}){if(assertValidRemote(r),allowStorageAccessByUserActivation(e),r=setQueryParams(r,{progressbar:!s}),n.setCaption("Preparing WordPress"),!t)return doStartPlaygroundWeb(e,r,n);const l=compileBlueprint(t,{progress:n.stage(.5),onStepCompleted:o}),p=await doStartPlaygroundWeb(e,setQueryParams(r,{php:l.versions.php,wp:l.versions.wp,"sapi-name":i,"php-extension":l.phpExtensions,networking:l.features.networking?"yes":"no"}),n);return await runBlueprintSteps(l,p),n.finish(),p}function allowStorageAccessByUserActivation(e){var t,r;(t=e.sandbox)!=null&&t.length&&!((r=e.sandbox)!=null&&r.contains("allow-storage-access-by-user-activation"))&&e.sandbox.add("allow-storage-access-by-user-activation")}async function doStartPlaygroundWeb(e,t,r){await new Promise(o=>{e.src=t,e.addEventListener("load",o,!1)});const n=consumeAPI(e.contentWindow);await n.isConnected(),r.pipe(n);const s=r.stage();return await n.onDownloadProgress(s.loadingListener),await n.isReady(),s.finish(),n}const officialRemoteOrigin="https://playground.wordpress.net";function assertValidRemote(e){const t=new URL(e,officialRemoteOrigin);if((t.origin===officialRemoteOrigin||t.hostname==="localhost")&&t.pathname!=="/remote.html")throw new Error(`Invalid remote URL: ${t}. Expected origin to be ${officialRemoteOrigin}/remote.html.`)}function setQueryParams(e,t){const r=new URL(e,officialRemoteOrigin),n=new URLSearchParams(r.search);for(const[s,o]of Object.entries(t))if(o!=null&&o!==!1)if(Array.isArray(o))for(const i of o)n.append(s,i.toString());else n.set(s,o.toString());return r.search=n.toString(),r.toString()}async function connectPlayground(e,t){if(console.warn("`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."),t!=null&&t.loadRemote)return startPlaygroundWeb({iframe:e,remoteUrl:t.loadRemote});const r=consumeAPI(e.contentWindow);return await r.isConnected(),r}exports.LatestSupportedPHPVersion=LatestSupportedPHPVersion;exports.SupportedPHPVersions=SupportedPHPVersions;exports.SupportedPHPVersionsList=SupportedPHPVersionsList;exports.activatePlugin=activatePlugin;exports.activateTheme=activateTheme;exports.applyWordPressPatches=applyWordPressPatches;exports.compileBlueprint=compileBlueprint;exports.connectPlayground=connectPlayground;exports.cp=cp;exports.defineSiteUrl=defineSiteUrl;exports.defineWpConfigConsts=defineWpConfigConsts;exports.enableMultisite=enableMultisite;exports.exportWXR=exportWXR;exports.exportWXZ=exportWXZ;exports.importFile=importFile;exports.importWordPressFiles=importWordPressFiles;exports.installPlugin=installPlugin;exports.installTheme=installTheme;exports.login=login;exports.mkdir=mkdir;exports.mv=mv;exports.phpVar=phpVar;exports.phpVars=phpVars;exports.request=request;exports.rm=rm;exports.rmdir=rmdir;exports.runBlueprintSteps=runBlueprintSteps;exports.runPHP=runPHP;exports.runPHPWithOptions=runPHPWithOptions;exports.runSql=runSql;exports.runWpInstallationWizard=runWpInstallationWizard;exports.setPhpIniEntry=setPhpIniEntry;exports.setPluginProxyURL=setPluginProxyURL;exports.setSiteOptions=setSiteOptions;exports.startPlaygroundWeb=startPlaygroundWeb;exports.unzip=unzip;exports.updateUserMeta=updateUserMeta;exports.wpContentFilesExcludedFromExport=wpContentFilesExcludedFromExport;exports.writeFile=writeFile;exports.zipWpContent=zipWpContent;
|