@wp-playground/blueprints 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blueprint-schema.json +0 -47
- package/index.cjs +43 -387
- package/index.d.ts +3 -18
- package/index.js +1134 -1639
- package/lib/steps/enable-multisite.d.ts +1 -1
- package/lib/steps/handlers.d.ts +0 -1
- package/lib/steps/index.d.ts +2 -3
- package/package.json +2 -2
- package/lib/steps/apply-wordpress-patches/index.d.ts +0 -16
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Nt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var H=(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 i;s!=null&&s.lastModified&&(i=new Date),(!i||isNaN(i.getFullYear()))&&(i=new Date),this.lastModifiedDate=i,this.lastModified=i.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,i=await t.slice(e,e+n.byteLength).arrayBuffer(),a=new Uint8Array(i);new Uint8Array(n.buffer).set(a);const l=a.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
|
|
1
|
+
"use strict";var Nt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var H=(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 i;s!=null&&s.lastModified&&(i=new Date),(!i||isNaN(i.getFullYear()))&&(i=new Date),this.lastModifiedDate=i,this.lastModified=i.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,i=await t.slice(e,e+n.byteLength).arrayBuffer(),a=new Uint8Array(i);new Uint8Array(n.buffer).set(a);const l=a.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 randomString(e=36,t="!@#$%^&*()_+=-[]/.,<>?"){const r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+t;let n="";for(let s=e;s>0;--s)n+=r[Math.floor(Math.random()*r.length)];return n}function randomFilename(){return randomString(36,"-_")}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
3
|
require_once( ${phpVar(s)}. "/wp-load.php" );
|
|
4
4
|
require_once( ${phpVar(s)}. "/wp-admin/includes/plugin.php" );
|
|
@@ -31,7 +31,26 @@ require_once( ${phpVar(n)}. "/wp-load.php" );
|
|
|
31
31
|
set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
32
32
|
|
|
33
33
|
switch_theme( ${phpVar(t)} );
|
|
34
|
-
`})},
|
|
34
|
+
`})},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/${randomFilename()}.sql`;await e.writeFile(n,new Uint8Array(await t.arrayBuffer()));const s=await e.documentRoot,i=phpVars({docroot:s,sqlFilename:n}),a=await e.run({code:`<?php
|
|
35
|
+
require_once ${i.docroot} . '/wp-load.php';
|
|
36
|
+
|
|
37
|
+
$handle = fopen(${i.sqlFilename}, 'r');
|
|
38
|
+
$buffer = '';
|
|
39
|
+
|
|
40
|
+
global $wpdb;
|
|
41
|
+
|
|
42
|
+
while ($bytes = fgets($handle)) {
|
|
43
|
+
$buffer .= $bytes;
|
|
44
|
+
|
|
45
|
+
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
46
|
+
") {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
$wpdb->query($buffer);
|
|
51
|
+
$buffer = '';
|
|
52
|
+
}
|
|
53
|
+
`});return await rm(e,{path:n}),a},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},rewriteWpConfigToDefineConstants=`<?php
|
|
35
54
|
|
|
36
55
|
/**
|
|
37
56
|
* Rewrites the wp-config.php file to ensure specific constants are defined
|
|
@@ -367,370 +386,7 @@ function skip_whitespace($tokens) {
|
|
|
367
386
|
$wp_config = file_get_contents($wp_config_path);
|
|
368
387
|
$new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${n.consts});
|
|
369
388
|
file_put_contents($wp_config_path, $new_wp_config);
|
|
370
|
-
`}),await e.readFileAsText("/tmp/code.php")}const
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* This transport delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
374
|
-
*
|
|
375
|
-
* This file isn't actually used. It's just here for reference and development. The actual
|
|
376
|
-
* PHP code used in WordPress is hardcoded copy residing in wordpress.mjs in the _patchWordPressCode
|
|
377
|
-
* function.
|
|
378
|
-
*
|
|
379
|
-
* The reason for calling it Wp_Http_Fetch and not something more natural like
|
|
380
|
-
* Requests_Transport_Fetch is the _get_first_available_transport(). It checks for
|
|
381
|
-
* a class named "Wp_Http_" . $transport_name – which means we must adhere to this
|
|
382
|
-
* hardcoded pattern.
|
|
383
|
-
*/
|
|
384
|
-
class Wp_Http_Fetch_Base
|
|
385
|
-
{
|
|
386
|
-
public $headers = '';
|
|
387
|
-
|
|
388
|
-
public function __construct()
|
|
389
|
-
{
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
public function __destruct()
|
|
393
|
-
{
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Delegates PHP HTTP requests to JavaScript synchronous XHR.
|
|
398
|
-
*
|
|
399
|
-
* @TODO Implement handling for more $options such as cookies, filename, auth, etc.
|
|
400
|
-
*
|
|
401
|
-
* @param $url
|
|
402
|
-
* @param $headers
|
|
403
|
-
* @param $data
|
|
404
|
-
* @param $options
|
|
405
|
-
*
|
|
406
|
-
* @return false|string
|
|
407
|
-
*/
|
|
408
|
-
public function request($url, $headers = array(), $data = array(), $options = array())
|
|
409
|
-
{
|
|
410
|
-
// Disable wp-cron requests that are extremely slow in node.js runtime environment.
|
|
411
|
-
// @TODO: Make wp-cron requests faster.
|
|
412
|
-
if (str_contains($url, '/wp-cron.php')) {
|
|
413
|
-
return false;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
if (!empty($data)) {
|
|
417
|
-
$data_format = $options['data_format'];
|
|
418
|
-
if ($data_format === 'query') {
|
|
419
|
-
$url = self::format_get($url, $data);
|
|
420
|
-
$data = '';
|
|
421
|
-
} elseif (!is_string($data)) {
|
|
422
|
-
$data = http_build_query($data, null, '&');
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
$request = json_encode(
|
|
427
|
-
array(
|
|
428
|
-
'type' => 'request',
|
|
429
|
-
'data' => [
|
|
430
|
-
'headers' => $headers,
|
|
431
|
-
'data' => $data,
|
|
432
|
-
'url' => $url,
|
|
433
|
-
'method' => $options['type'],
|
|
434
|
-
]
|
|
435
|
-
)
|
|
436
|
-
);
|
|
437
|
-
|
|
438
|
-
$this->headers = post_message_to_js($request);
|
|
439
|
-
|
|
440
|
-
// Store a file if the request specifies it.
|
|
441
|
-
// Are we sure that \`$this->headers\` includes the body of the response?
|
|
442
|
-
$before_response_body = strpos($this->headers, "\\r\\n\\r\\n");
|
|
443
|
-
if (isset($options['filename']) && $options['filename'] && false !== $before_response_body) {
|
|
444
|
-
$response_body = substr($this->headers, $before_response_body + 4);
|
|
445
|
-
$this->headers = substr($this->headers, 0, $before_response_body);
|
|
446
|
-
file_put_contents($options['filename'], $response_body);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
return $this->headers;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
public function request_multiple($requests, $options)
|
|
453
|
-
{
|
|
454
|
-
$responses = array();
|
|
455
|
-
$class = get_class($this);
|
|
456
|
-
foreach ($requests as $id => $request) {
|
|
457
|
-
try {
|
|
458
|
-
$handler = new $class();
|
|
459
|
-
$responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']);
|
|
460
|
-
$request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request));
|
|
461
|
-
} catch (Requests_Exception $e) {
|
|
462
|
-
$responses[$id] = $e;
|
|
463
|
-
}
|
|
464
|
-
if (!is_string($responses[$id])) {
|
|
465
|
-
$request['options']['hooks']->dispatch('multiple.request.complete', array(&$responses[$id], $id));
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
return $responses;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
protected static function format_get($url, $data)
|
|
473
|
-
{
|
|
474
|
-
if (!empty($data)) {
|
|
475
|
-
$query = '';
|
|
476
|
-
$url_parts = parse_url($url);
|
|
477
|
-
if (empty($url_parts['query'])) {
|
|
478
|
-
$url_parts['query'] = '';
|
|
479
|
-
} else {
|
|
480
|
-
$query = $url_parts['query'];
|
|
481
|
-
}
|
|
482
|
-
$query .= '&' . http_build_query($data, null, '&');
|
|
483
|
-
$query = trim($query, '&');
|
|
484
|
-
if (empty($url_parts['query'])) {
|
|
485
|
-
$url .= '?' . $query;
|
|
486
|
-
} else {
|
|
487
|
-
$url = str_replace($url_parts['query'], $query, $url);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
return $url;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
public static function test($capabilities = array())
|
|
495
|
-
{
|
|
496
|
-
if (!function_exists('post_message_to_js')) {
|
|
497
|
-
return false;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
return true;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
505
|
-
class Wp_Http_Fetch extends Wp_Http_Fetch_Base implements \\WpOrg\\Requests\\Transport
|
|
506
|
-
{
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
} else {
|
|
510
|
-
class Wp_Http_Fetch extends Wp_Http_Fetch_Base implements Requests_Transport
|
|
511
|
-
{
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
`,transportDummy=`<?php
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* This transport does not perform any HTTP requests and only exists
|
|
519
|
-
* to prevent the Requests class from complaining about not having any
|
|
520
|
-
* transports.
|
|
521
|
-
*/
|
|
522
|
-
class Requests_Transport_Dummy_Base
|
|
523
|
-
{
|
|
524
|
-
public $headers = '';
|
|
525
|
-
|
|
526
|
-
public function __construct()
|
|
527
|
-
{
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
public function __destruct()
|
|
531
|
-
{
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
public function request($url, $headers = array(), $data = array(), $options = array())
|
|
535
|
-
{
|
|
536
|
-
return false;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
public function request_multiple($requests, $options)
|
|
540
|
-
{
|
|
541
|
-
$responses = array();
|
|
542
|
-
foreach ($requests as $id => $request) {
|
|
543
|
-
$responses[] = false;
|
|
544
|
-
}
|
|
545
|
-
return $responses;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
protected static function format_get($url, $data)
|
|
549
|
-
{
|
|
550
|
-
return $url;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
public static function test($capabilities = array())
|
|
554
|
-
{
|
|
555
|
-
return true;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
if (class_exists('\\WpOrg\\Requests\\Requests')) {
|
|
560
|
-
class Requests_Transport_Dummy extends Requests_Transport_Dummy_Base implements \\WpOrg\\Requests\\Transport
|
|
561
|
-
{
|
|
562
|
-
|
|
563
|
-
}
|
|
564
|
-
} else {
|
|
565
|
-
class Requests_Transport_Dummy extends Requests_Transport_Dummy_Base implements Requests_Transport
|
|
566
|
-
{
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
`,playgroundMuPlugin=`<?php
|
|
571
|
-
/**
|
|
572
|
-
* Add a notice to wp-login.php offering the username and password.
|
|
573
|
-
*/
|
|
574
|
-
add_action(
|
|
575
|
-
'login_message',
|
|
576
|
-
function () {
|
|
577
|
-
return <<<EOT
|
|
578
|
-
<div class="message info">
|
|
579
|
-
<strong>username:</strong> <code>admin</code><br><strong>password</strong>: <code>password</code>
|
|
580
|
-
</div>
|
|
581
|
-
EOT;
|
|
582
|
-
}
|
|
583
|
-
);
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Because the in-browser Playground doesn't have access to the internet,
|
|
587
|
-
* network-dependent features like directories don't work. Normally, you'll
|
|
588
|
-
* see a confusing message like "An unexpected error occurred." This mu-plugin
|
|
589
|
-
* makes it more clear that the feature is not yet supported.
|
|
590
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
624
|
-
add_filter('plugins_api_result', function ($res) {
|
|
625
|
-
if ($res instanceof WP_Error) {
|
|
626
|
-
$res = new WP_Error(
|
|
627
|
-
'plugins_api_failed',
|
|
628
|
-
networking_disabled()
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
return $res;
|
|
632
|
-
});
|
|
633
|
-
|
|
634
|
-
add_filter('gettext', function ($translation) {
|
|
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
|
-
}
|
|
639
|
-
}
|
|
640
|
-
return $translation;
|
|
641
|
-
});
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* Links with target="top" don't work in the playground iframe because of
|
|
645
|
-
* the sandbox attribute. What they really should be targeting is the
|
|
646
|
-
* playground iframe itself (name="playground"). This mu-plugin rewrites
|
|
647
|
-
* all target="_top" links to target="playground" instead.
|
|
648
|
-
*
|
|
649
|
-
* https://github.com/WordPress/wordpress-playground/issues/266
|
|
650
|
-
*/
|
|
651
|
-
add_action('admin_print_scripts', function () {
|
|
652
|
-
?>
|
|
653
|
-
<script>
|
|
654
|
-
document.addEventListener('click', function (event) {
|
|
655
|
-
if (event.target.tagName === 'A' && ['_parent', '_top'].includes(event.target.target)) {
|
|
656
|
-
event.target.target = 'wordpress-playground';
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
<\/script>
|
|
660
|
-
<?php
|
|
661
|
-
});
|
|
662
|
-
|
|
663
|
-
/**
|
|
664
|
-
* Supports URL rewriting to remove \`index.php\` from permalinks.
|
|
665
|
-
*/
|
|
666
|
-
add_filter('got_url_rewrite', '__return_true');
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
* The default WordPress requests transports have been disabled
|
|
670
|
-
* at this point. However, the Requests class requires at least
|
|
671
|
-
* one working transport or else it throws warnings and acts up.
|
|
672
|
-
*
|
|
673
|
-
* This mu-plugin provides that transport. It's one of the two:
|
|
674
|
-
*
|
|
675
|
-
* * WP_Http_Fetch – Sends requests using browser's fetch() function.
|
|
676
|
-
* Only enabled when PHP was compiled with the VRZNO
|
|
677
|
-
* extension.
|
|
678
|
-
* * Requests_Transport_Dummy – Does not send any requests and only exists to keep
|
|
679
|
-
* the Requests class happy.
|
|
680
|
-
*/
|
|
681
|
-
$__requests_class = class_exists( '\\WpOrg\\Requests\\Requests' ) ? '\\WpOrg\\Requests\\Requests' : 'Requests';
|
|
682
|
-
if (defined('USE_FETCH_FOR_REQUESTS') && USE_FETCH_FOR_REQUESTS) {
|
|
683
|
-
require(__DIR__ . '/playground-includes/wp_http_fetch.php');
|
|
684
|
-
$__requests_class::add_transport('WP_Http_Fetch');
|
|
685
|
-
|
|
686
|
-
/**
|
|
687
|
-
* Add Fetch transport to the list of transports that WordPress
|
|
688
|
-
* will test for in the _get_first_available_transport() function.
|
|
689
|
-
*/
|
|
690
|
-
add_filter('http_api_transports', function ($transports) {
|
|
691
|
-
$transports[] = 'Fetch';
|
|
692
|
-
return $transports;
|
|
693
|
-
});
|
|
694
|
-
/**
|
|
695
|
-
* Disable signature verification as it doesn't seem to work with
|
|
696
|
-
* fetch requests:
|
|
697
|
-
*
|
|
698
|
-
* https://downloads.wordpress.org/plugin/classic-editor.zip returns no signature header.
|
|
699
|
-
* https://downloads.wordpress.org/plugin/classic-editor.zip.sig returns 404.
|
|
700
|
-
*
|
|
701
|
-
* @TODO Investigate why.
|
|
702
|
-
*/
|
|
703
|
-
add_filter('wp_signature_hosts', function ($hosts) {
|
|
704
|
-
return [];
|
|
705
|
-
});
|
|
706
|
-
|
|
707
|
-
add_filter('http_request_host_is_external', function ($arg) {
|
|
708
|
-
return true;
|
|
709
|
-
});
|
|
710
|
-
} else {
|
|
711
|
-
require(__DIR__ . '/playground-includes/requests_transport_dummy.php');
|
|
712
|
-
$__requests_class::add_transport('Requests_Transport_Dummy');
|
|
713
|
-
}
|
|
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,i=phpVars({docroot:s,sqlFilename:n}),a=await e.run({code:`<?php
|
|
715
|
-
require_once ${i.docroot} . '/wp-load.php';
|
|
716
|
-
|
|
717
|
-
$handle = fopen(${i.sqlFilename}, 'r');
|
|
718
|
-
$buffer = '';
|
|
719
|
-
|
|
720
|
-
global $wpdb;
|
|
721
|
-
|
|
722
|
-
while ($bytes = fgets($handle)) {
|
|
723
|
-
$buffer .= $bytes;
|
|
724
|
-
|
|
725
|
-
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
726
|
-
") {
|
|
727
|
-
continue;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
$wpdb->query($buffer);
|
|
731
|
-
$buffer = '';
|
|
732
|
-
}
|
|
733
|
-
`});return await rm(e,{path:n}),a},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 i,a,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=(a=(i=s.headers)==null?void 0:i.location)==null?void 0:a[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
|
|
389
|
+
`}),await e.readFileAsText("/tmp/code.php")}const login=async(e,{username:t="admin",password:r="password"}={},n)=>{var i,a,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=(a=(i=s.headers)==null?void 0:i.location)==null?void 0:a[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
390
|
include ${phpVar(r)} . '/wp-load.php';
|
|
735
391
|
$site_options = ${phpVar(t)};
|
|
736
392
|
foreach($site_options as $name => $value) {
|
|
@@ -743,7 +399,7 @@ if (defined('USE_FETCH_FOR_REQUESTS') && USE_FETCH_FOR_REQUESTS) {
|
|
|
743
399
|
foreach($meta as $name => $value) {
|
|
744
400
|
update_user_meta(${phpVar(r)}, $name, $value);
|
|
745
401
|
}
|
|
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
|
|
402
|
+
`})};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 E;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,a=(await e.run({throwOnError:!0,code:`<?php
|
|
747
403
|
define( 'WP_ADMIN', true );
|
|
748
404
|
require_once(${phpVar(s)} . "/wp-load.php");
|
|
749
405
|
|
|
@@ -771,16 +427,16 @@ foreach($plugins as $plugin_path) {
|
|
|
771
427
|
}
|
|
772
428
|
}
|
|
773
429
|
echo json_encode($deactivated_plugins);
|
|
774
|
-
`})).json,p=(
|
|
430
|
+
`})).json,p=(E=(await request(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))==null?void 0:E[1],u=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(u.httpStatusCode!==200)throw console.warn("WordPress response was",{response:u,text:u.text,headers:u.headers}),new Error(`Failed to enable multisite. Response code was ${u.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 d=new URL(await e.absoluteUrl),$=isURLScoped(d)?"scope:"+getURLScope(d):null;await e.writeFile(joinPaths(s,"/wp-content/sunrise.php"),`<?php
|
|
775
431
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
776
432
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
777
433
|
}
|
|
778
|
-
$folder = ${phpVar(
|
|
434
|
+
$folder = ${phpVar($)};
|
|
779
435
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
780
|
-
$_SERVER['HTTP_HOST'] = ${phpVar(
|
|
436
|
+
$_SERVER['HTTP_HOST'] = ${phpVar(d.hostname)};
|
|
781
437
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
782
438
|
}
|
|
783
|
-
`),await login(e,{});for(const
|
|
439
|
+
`),await login(e,{});for(const R of a)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}}),i=DOM(s).querySelector("#wpbody-content form");if(!i)throw console.log(s.text),new Error("Could not find an importer form in response. See the response text above for details.");const a=getFormData(i);a.fetch_attachments="1";for(const p in a)if(p.startsWith("user_map[")){const u="user_new["+p.slice(9,-1)+"]";a[u]="1"}await e.request({url:i.action,method:"POST",formData:a})};function DOM(e){return new DOMParser().parseFromString(e.text,"text/html")}function getFormData(e){return Object.fromEntries(new FormData(e).entries())}const zipFunctions=`<?php
|
|
784
440
|
|
|
785
441
|
function zipDir($root, $output, $options = array())
|
|
786
442
|
{
|
|
@@ -863,14 +519,14 @@ function delTree($dir)
|
|
|
863
519
|
}
|
|
864
520
|
return rmdir($dir);
|
|
865
521
|
}
|
|
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 i=joinPaths(s,"wp-content"),a=joinPaths(n,"wp-content");for(const
|
|
522
|
+
`;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 i=joinPaths(s,"wp-content"),a=joinPaths(n,"wp-content");for(const d of wpContentFilesExcludedFromExport){const $=joinPaths(i,d);await removePath(e,$);const E=joinPaths(a,d);await e.fileExists(E)&&(await e.mkdir(dirname($)),await e.mv(E,$))}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 d of p)await removePath(e,joinPaths(n,d)),await e.mv(joinPaths(s,d),joinPaths(n,d));await e.rmdir(s),await defineSiteUrl(e,{siteUrl:await e.absoluteUrl});const u=phpVar(joinPaths(n,"wp-admin","upgrade.php"));await e.run({throwOnError:!0,code:`<?php
|
|
867
523
|
$_GET['step'] = 'upgrade_db';
|
|
868
|
-
require ${
|
|
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$/,""),i=joinPaths(await e.documentRoot,"wp-content"),a=joinPaths(i,
|
|
524
|
+
require ${u};
|
|
525
|
+
`})};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$/,""),i=joinPaths(await e.documentRoot,"wp-content"),a=joinPaths(i,randomString()),l=joinPaths(a,"assets",s);await e.fileExists(l)&&await e.rmdir(a,{recursive:!0}),await e.mkdir(a);try{await unzip(e,{zipFile:r,extractToPath:l});let p=await e.listFiles(l,{prependPath:!0});p=p.filter(R=>!R.endsWith("/__MACOSX"));const u=p.length===1&&await e.isDir(p[0]);let d,$="";u?($=p[0],d=p[0].split("/").pop()):($=l,d=s);const E=`${t}/${d}`;return await e.mv($,E),{assetFolderPath:E,assetFolderName:d}}finally{await e.rmdir(a,{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",i=zipNameToHumanName(s);n==null||n.tracker.setCaption(`Installing the ${i} plugin`);const{assetFolderPath:a}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});("activate"in r?r.activate:!0)&&await activatePlugin(e,{pluginPath:a,pluginName:i},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:i}=await installAsset(e,{zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});("activate"in r?r.activate:!0)&&await activateTheme(e,{themeFolderName:i},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 i=wpContentFilesExcludedFromExport;t&&(i=i.filter(p=>!p.startsWith("themes/twenty")).filter(p=>p!=="mu-plugins/sqlite-database-integration"));const a=phpVars({zipPath:r,wpContentPath:s,documentRoot:n,exceptPaths:i.map(p=>joinPaths(n,"wp-content",p)),additionalPaths:t?{[joinPaths(n,"wp-config.php")]:"wp-config.php"}:{}});await runPhpWithZipFunctions(e,`zipDir(${a.wpContentPath}, ${a.zipPath}, array(
|
|
870
526
|
'exclude_paths' => ${a.exceptPaths},
|
|
871
527
|
'zip_root' => ${a.documentRoot},
|
|
872
528
|
'additional_paths' => ${a.additionalPaths}
|
|
873
|
-
));`);const l=await e.readFileAsBuffer(r);return e.unlink(r),l},stepHandlers=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin,activateTheme,
|
|
529
|
+
));`);const l=await e.readFileAsBuffer(r);return e.unlink(r),l},stepHandlers=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin,activateTheme,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(i,a){t(new CustomEvent("progress",{detail:{loaded:i,total:a}}))}return new Response(new ReadableStream({async start(i){if(!e.body){i.close();return}const a=e.body.getReader();let l=0;for(;;)try{const{done:p,value:u}=await a.read();if(u&&(l+=u.byteLength),p){s(l,l),i.close();break}else s(l,n),i.enqueue(u)}catch(p){console.error({e:p}),i.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 i;try{return n(...s)}catch(a){if(!(a instanceof Error))throw a;const l=clarifyErrorMessage(a,(i=e.lastAsyncifyStackSource)==null?void 0:i.stack);if(e.lastAsyncifyStackSource&&(a.cause=e.lastAsyncifyStackSource),t.hasListeners()){t.dispatchEvent(new ErrorEvent("error",{error:a,message:l}));return}throw isExitCodeZero(a)||showCriticalErrorBox(l),a}}}return t}let functionsMaybeMissingFromAsyncify=[];function getFunctionsMaybeMissingFromAsyncify(){return functionsMaybeMissingFromAsyncify}function clarifyErrorMessage(e,t){if(e.message==="unreachable"){let r=UNREACHABLE_ERROR;t||(r+=`
|
|
874
530
|
|
|
875
531
|
This stack trace is lacking. For a better one initialize
|
|
876
532
|
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
@@ -904,9 +560,9 @@ CLI option:
|
|
|
904
560
|
${eol}
|
|
905
561
|
${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
|
|
906
562
|
`))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="",i=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=i,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],SupportedPHPExtensionsList=["iconv","mbstring","xml-bundle","gd"],SupportedPHPExtensionBundles={"kitchen-sink":SupportedPHPExtensionsList};var De,
|
|
563
|
+
`).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="",i=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=i,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],SupportedPHPExtensionsList=["iconv","mbstring","xml-bundle","gd"],SupportedPHPExtensionBundles={"kitchen-sink":SupportedPHPExtensionsList};var De,Ge;class PHPBrowser{constructor(t,r={}){Z(this,De,void 0);Z(this,Ge,void 0);this.requestHandler=t,te(this,De,{}),te(this,Ge,{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"]),H(this,Ge).handleRedirects&&n.headers.location&&r<H(this,Ge).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),i=r.substring(n+1).split(";")[0];H(this,De)[s]=i}catch(n){console.error(n)}}serializeCookies(){const t=[];for(const r in H(this,De))t.push(`${r}=${H(this,De)[r]}`);return t.join("; ")}}De=new WeakMap,Ge=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,Ke,dt,Ae,Je,ve,Ze,Fe,mt,xt,_t,Wt,$t,Bt;class PHPRequestHandler{constructor(t,r={}){Z(this,mt);Z(this,_t);Z(this,$t);Z(this,Se,void 0);Z(this,Ke,void 0);Z(this,dt,void 0);Z(this,Ae,void 0);Z(this,Je,void 0);Z(this,ve,void 0);Z(this,Ze,void 0);Z(this,Fe,void 0);te(this,Fe,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 i=new URL(s);te(this,dt,i.hostname),te(this,Ae,i.port?Number(i.port):i.protocol==="https:"?443:80),te(this,Ke,(i.protocol||"").replace(":",""));const a=H(this,Ae)!==443&&H(this,Ae)!==80;te(this,Je,[H(this,dt),a?`:${H(this,Ae)}`:""].join("")),te(this,ve,i.pathname.replace(/\/+$/,"")),te(this,Ze,[`${H(this,Ke)}://`,H(this,Je),H(this,ve)].join(""))}pathToInternalUrl(t){return`${this.absoluteUrl}${t}`}internalUrlToPath(t){const r=new URL(t);return r.pathname.startsWith(H(this,ve))&&(r.pathname=r.pathname.slice(H(this,ve).length)),toRelativeUrl(r)}get isRequestRunning(){return H(this,Fe).running>0}get absoluteUrl(){return H(this,Ze)}get documentRoot(){return H(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,H(this,ve)),i=`${H(this,Se)}${s}`;return seemsLikeAPHPRequestHandlerPath(i)?await ce(this,_t,Wt).call(this,t,n):ce(this,mt,xt).call(this,i)}}Se=new WeakMap,Ke=new WeakMap,dt=new WeakMap,Ae=new WeakMap,Je=new WeakMap,ve=new WeakMap,Ze=new WeakMap,Fe=new WeakMap,mt=new WeakSet,xt=function(t){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,i,a;if(H(this,Fe).running>0&&((s=t.headers)==null?void 0:s["x-request-issuer"])==="php")return console.warn("Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."),new PHPResponse(502,{},new TextEncoder().encode("502 Bad Gateway"));const n=await H(this,Fe).acquire();try{this.php.addServerGlobalEntry("REMOTE_ADDR","127.0.0.1"),this.php.addServerGlobalEntry("DOCUMENT_ROOT",H(this,Se)),this.php.addServerGlobalEntry("HTTPS",H(this,Ze).startsWith("https://")?"on":"");let l="GET";const p={host:H(this,Je),...normalizeHeaders(t.headers||{})},u=[];if(t.files&&Object.keys(t.files).length){l="POST";for(const E in t.files){const R=t.files[E];u.push({key:E,name:R.name,type:R.type,data:new Uint8Array(await R.arrayBuffer())})}(i=p["content-type"])!=null&&i.startsWith("multipart/form-data")&&(t.formData=parseMultipartFormDataString(t.body||""),p["content-type"]="application/x-www-form-urlencoded",delete t.body)}let d;t.formData!==void 0?(l="POST",p["content-type"]=p["content-type"]||"application/x-www-form-urlencoded",d=new URLSearchParams(t.formData).toString()):d=t.body;let $;try{let E=r.pathname;if((a=t.headers)!=null&&a["x-rewrite-url"])try{E=new URL(t.headers["x-rewrite-url"]).pathname}catch{}$=ce(this,$t,Bt).call(this,E)}catch{return new PHPResponse(404,{},new TextEncoder().encode("404 File not found"))}return await this.php.run({relativeUri:ensurePathPrefix(toRelativeUrl(r),H(this,ve)),protocol:H(this,Ke),method:t.method||l,body:d,fileInfos:u,scriptPath:$,headers:p})}finally{n()}},$t=new WeakSet,Bt=function(t){let r=removePathPrefix(t,H(this,ve));r.includes(".php")?r=r.split(".php")[0]+".php":(r.endsWith("/")||(r+="/"),r.endsWith("index.php")||(r+="index.php"));const n=`${H(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(i=>{const a=i.indexOf(`\r
|
|
908
564
|
\r
|
|
909
|
-
`),l=i.substring(0,a).trim(),p=i.substring(a+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 i=s.value;s.value=function(...a){try{return i.apply(this,a)}catch(l){const p=typeof l=="object"?l==null?void 0:l.errno:null;if(p in FileErrorCodes){const d=FileErrorCodes[p],u=typeof a[0]=="string"?a[0]:null,g=u!==null?e.replaceAll("{path}",u):e;throw new Error(`${g}: ${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,i=e.length-1,a;i>=0;i--)(a=e[i])&&(s=(n?a(t,r,s):a(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,vt,Jt,wt,Zt,Pt,Qt,bt,Yt,Et,Xt,St,er,Rt,tr,Tt,rr,kt,nr,Ot,sr;class BasePHP{constructor(e,t){Z(this,$t);Z(this,yt);Z(this,vt);Z(this,wt);Z(this,Pt);Z(this,bt);Z(this,Et);Z(this,St);Z(this,Rt);Z(this,Tt);Z(this,kt);Z(this,Ot);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){H(this,be).has(e)||H(this,be).set(e,new Set),H(this,be).get(e).add(t)}removeEventListener(e,t){var r;(r=H(this,be).get(e))==null||r.delete(t)}dispatchEvent(e){const t=H(this,be).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){H(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 H(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(H(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(H(this,Pe))throw new Error("Cannot set PHP ini entries after calling run().");H(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{H(this,Pe)||(ce(this,$t,Gt).call(this),te(this,Pe,!0)),ce(this,St,er).call(this,e.scriptPath||""),ce(this,vt,Jt).call(this,e.relativeUri||""),ce(this,Pt,Qt).call(this,e.method||"GET");const n=normalizeHeaders(e.headers||{}),s=n.host||"example.com:443";if(ce(this,wt,Zt).call(this,s,e.protocol||"http"),ce(this,bt,Yt).call(this,n),e.body&&(r=ce(this,Et,Xt).call(this,e.body)),e.fileInfos)for(const a of e.fileInfos)ce(this,Tt,rr).call(this,a);typeof e.code=="string"&&ce(this,kt,nr).call(this," ?>"+e.code),ce(this,Rt,tr).call(this);const i=await ce(this,Ot,sr).call(this);if(e.throwOnError&&i.exitCode!==0){const a={stdout:i.text,stderr:i.errors};console.warn("PHP.run() output was:",a);const l=new Error(`PHP.run() failed with exit code ${i.exitCode} and the following output`);throw l.output=a,l}return i}finally{try{r&&this[__private__dont__use].free(r)}finally{t(),this.dispatchEvent({type:"request.end"})}}}addServerGlobalEntry(e,t){H(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),H(this,Qe)&&this.setPhpIniPath(H(this,Qe)),H(this,Ye)&&this.setSapiName(H(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
|
|
565
|
+
`),l=i.substring(0,a).trim(),p=i.substring(a+4).trim(),u=l.match(/name="([^"]+)"/);if(u){const d=u[1];t[d]=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 i=s.value;s.value=function(...a){try{return i.apply(this,a)}catch(l){const p=typeof l=="object"?l==null?void 0:l.errno:null;if(p in FileErrorCodes){const u=FileErrorCodes[p],d=typeof a[0]=="string"?a[0]:null,$=d!==null?e.replaceAll("{path}",d):e;throw new Error(`${$}: ${u}`,{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,i=e.length-1,a;i>=0;i--)(a=e[i])&&(s=(n?a(t,r,s):a(s))||s);return n&&s&&__defProp(t,r,s),s};const STRING="string",NUMBER="number",__private__dont__use=Symbol("__private__dont__use");var Me,Qe,Xe,Pe,Re,Te,be,Ye,gt,Gt,yt,Kt,vt,Jt,wt,Zt,Pt,Qt,bt,Xt,Et,Yt,St,er,Rt,tr,Tt,rr,kt,nr,Ct,sr;class BasePHP{constructor(e,t){Z(this,gt);Z(this,yt);Z(this,vt);Z(this,wt);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,Me,void 0);Z(this,Qe,void 0);Z(this,Xe,void 0);Z(this,Pe,void 0);Z(this,Re,void 0);Z(this,Te,void 0);Z(this,be,void 0);Z(this,Ye,void 0);te(this,Me,[]),te(this,Pe,!1),te(this,Re,null),te(this,Te,{}),te(this,be,new Map),te(this,Ye,[]),this.semaphore=new Semaphore({concurrency:1}),e!==void 0&&this.initializeRuntime(e),t&&(this.requestHandler=new PHPBrowser(new PHPRequestHandler(this,t)))}addEventListener(e,t){H(this,be).has(e)||H(this,be).set(e,new Set),H(this,be).get(e).add(t)}removeEventListener(e,t){var r;(r=H(this,be).get(e))==null||r.delete(t)}dispatchEvent(e){const t=H(this,be).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){H(this,Ye).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 H(this,Ye)){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,Xe,e)}setPhpIniPath(e){if(H(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(H(this,Pe))throw new Error("Cannot set PHP ini entries after calling run().");H(this,Me).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{H(this,Pe)||(ce(this,gt,Gt).call(this),te(this,Pe,!0)),ce(this,St,er).call(this,e.scriptPath||""),ce(this,vt,Jt).call(this,e.relativeUri||""),ce(this,Pt,Qt).call(this,e.method||"GET");const n=normalizeHeaders(e.headers||{}),s=n.host||"example.com:443";if(ce(this,wt,Zt).call(this,s,e.protocol||"http"),ce(this,bt,Xt).call(this,n),e.body&&(r=ce(this,Et,Yt).call(this,e.body)),e.fileInfos)for(const a of e.fileInfos)ce(this,Tt,rr).call(this,a);typeof e.code=="string"&&ce(this,kt,nr).call(this," ?>"+e.code),ce(this,Rt,tr).call(this);const i=await ce(this,Ct,sr).call(this);if(e.throwOnError&&i.exitCode!==0){const a={stdout:i.text,stderr:i.errors};console.warn("PHP.run() output was:",a);const l=new Error(`PHP.run() failed with exit code ${i.exitCode} and the following output`);throw l.output=a,l}return i}finally{try{r&&this[__private__dont__use].free(r)}finally{t(),this.dispatchEvent({type:"request.end"})}}}addServerGlobalEntry(e,t){H(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),H(this,Qe)&&this.setPhpIniPath(H(this,Qe)),H(this,Xe)&&this.setSapiName(H(this,Xe)),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]}}Me=new WeakMap,Qe=new WeakMap,Xe=new WeakMap,Pe=new WeakMap,Re=new WeakMap,Te=new WeakMap,be=new WeakMap,Ye=new WeakMap,gt=new WeakSet,Gt=function(){if(this.setPhpIniEntry("auto_prepend_file","/tmp/consts.php"),this.fileExists("/tmp/consts.php")||this.writeFile("/tmp/consts.php",`<?php
|
|
910
566
|
if(file_exists('/tmp/consts.json')) {
|
|
911
567
|
$consts = json_decode(file_get_contents('/tmp/consts.json'), true);
|
|
912
568
|
foreach ($consts as $const => $value) {
|
|
@@ -914,19 +570,19 @@ ${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
|
|
|
914
570
|
define($const, $value);
|
|
915
571
|
}
|
|
916
572
|
}
|
|
917
|
-
}`),H(this,
|
|
573
|
+
}`),H(this,Me).length>0){const e=H(this,Me).map(([t,r])=>`${t}=${r}`).join(`
|
|
918
574
|
`)+`
|
|
919
575
|
|
|
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(": "),i=n.substring(0,s).toLowerCase(),a=n.substring(s+2);i in r||(r[i]=[]),r[i].push(a)}return{headers:r,httpStatusCode:t.status}},vt=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])}},wt=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 H(this,Te))this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,H(this,Te)[e]])},Tt=new WeakSet,rr=function(e){const{key:t,name:r,type:n,data:s}=e,i=`/tmp/${Math.random().toFixed(20)}`;this.writeFile(i,s);const a=0;this[__private__dont__use].ccall("wasm_add_uploaded_file",null,[STRING,STRING,STRING,STRING,NUMBER,NUMBER],[t,r,n,i,a,s.byteLength])},kt=new WeakSet,nr=function(e){this[__private__dont__use].ccall("wasm_set_php_code",null,[STRING],[e])},Ot=new WeakSet,sr=async function(){var s;let e,t;try{e=await new Promise((i,a)=>{var p;t=d=>{const u=new Error("Rethrown");u.cause=d.error,u.betterMessage=d.message,a(u)},(p=H(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(i,a):i(l)})}catch(i){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 a=i,l="betterMessage"in a?a.betterMessage:a.message,p=new Error(l);throw p.cause=a,p}finally{(s=H(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(i=>i!=="."&&i!=="..");for(const i of s)recreateMemFS(e,t,joinPaths(r,i))}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((O,I)=>`${O}${I}`,"")}get names(){var k;return(k=this._names)!==null&&k!==void 0?k:this._names=this._items.reduce((O,I)=>(I instanceof r&&(O[I.str]=(O[I.str]||0)+1),O),{})}}e._Code=n,e.nil=new n("");function s(_,...k){const O=[_[0]];let I=0;for(;I<k.length;)l(O,k[I]),O.push(_[++I]);return new n(O)}e._=s;const i=new n("+");function a(_,...k){const O=[T(_[0])];let I=0;for(;I<k.length;)O.push(i),l(O,k[I]),O.push(i,T(_[++I]));return p(O),new n(O)}e.str=a;function l(_,k){k instanceof n?_.push(...k._items):k instanceof r?_.push(k):_.push(g(k))}e.addCodeArg=l;function p(_){let k=1;for(;k<_.length-1;){if(_[k]===i){const O=d(_[k-1],_[k+1]);if(O!==void 0){_.splice(k-1,3,O);continue}_[k++]="+"}k++}}function d(_,k){if(k==='""')return _;if(_==='""')return k;if(typeof _=="string")return k instanceof r||_[_.length-1]!=='"'?void 0:typeof k!="string"?`${_.slice(0,-1)}${k}"`:k[0]==='"'?_.slice(0,-1)+k.slice(1):void 0;if(typeof k=="string"&&k[0]==='"'&&!(_ instanceof r))return`"${_}${k.slice(1)}`}function u(_,k){return k.emptyStr()?_:_.emptyStr()?k:a`${_}${k}`}e.strConcat=u;function g(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:T(Array.isArray(_)?_.join(","):_)}function S(_){return new n(T(_))}e.stringify=S;function T(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=T;function v(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new n(`.${_}`):s`[${_}]`}e.getProperty=v;function R(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new n(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=R;function $(_){return new n(_.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,g;if(!((g=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||g===void 0)&&g.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 i extends t.Name{constructor(d,u){super(u),this.prefix=d}setValue(d,{property:u,itemIndex:g}){this.value=d,this.scopePath=(0,t._)`.${new t.Name(u)}[${g}]`}}e.ValueScopeName=i;const a=(0,t._)`\n`;class l extends s{constructor(d){super(d),this._values={},this._scope=d.scope,this.opts={...d,_n:d.lines?a:t.nil}}get(){return this._scope}name(d){return new i(d,this._newName(d))}value(d,u){var g;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const S=this.toName(d),{prefix:T}=S,v=(g=u.key)!==null&&g!==void 0?g:u.ref;let R=this._values[T];if(R){const k=R.get(v);if(k)return k}else R=this._values[T]=new Map;R.set(v,S);const $=this._scope[T]||(this._scope[T]=[]),_=$.length;return $[_]=u.ref,S.setValue(u,{property:T,itemIndex:_}),S}getValue(d,u){const g=this._values[d];if(g)return g.get(u)}scopeRefs(d,u=this._values){return this._reduceValues(u,g=>{if(g.scopePath===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return(0,t._)`${d}${g.scopePath}`})}scopeCode(d=this._values,u,g){return this._reduceValues(d,S=>{if(S.value===void 0)throw new Error(`CodeGen: name "${S}" has no value`);return S.value.code},u,g)}_reduceValues(d,u,g={},S){let T=t.nil;for(const v in d){const R=d[v];if(!R)continue;const $=g[v]=g[v]||new Map;R.forEach(_=>{if($.has(_))return;$.set(_,n.Started);let k=u(_);if(k){const O=this.opts.es5?e.varKinds.var:e.varKinds.const;T=(0,t._)`${T}${O} ${_} = ${k};${this.opts._n}`}else if(k=S==null?void 0:S(_))T=(0,t._)`${T}${k}${this.opts._n}`;else throw new r(_);$.set(_,n.Completed)})}return T}}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 i{optimizeNodes(){return this}optimizeNames(o,h){return this}}class a extends i{constructor(o,h,N){super(),this.varKind=o,this.name=h,this.rhs=N}render({es5:o,_n:h}){const N=o?r.varKinds.var:this.varKind,q=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${q};`+h}optimizeNames(o,h){if(o[this.name.str])return this.rhs&&(this.rhs=oe(this.rhs,o,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(o,h,N){super(),this.lhs=o,this.rhs=h,this.sideEffects=N}render({_n:o}){return`${this.lhs} = ${this.rhs};`+o}optimizeNames(o,h){if(!(this.lhs instanceof t.Name&&!o[this.lhs.str]&&!this.sideEffects))return this.rhs=oe(this.rhs,o,h),this}get names(){const o=this.lhs instanceof t.Name?{}:{...this.lhs.names};return ue(o,this.rhs)}}class p extends l{constructor(o,h,N,q){super(o,N,q),this.op=h}render({_n:o}){return`${this.lhs} ${this.op}= ${this.rhs};`+o}}class d extends i{constructor(o){super(),this.label=o,this.names={}}render({_n:o}){return`${this.label}:`+o}}class u extends i{constructor(o){super(),this.label=o,this.names={}}render({_n:o}){return`break${this.label?` ${this.label}`:""};`+o}}class g extends i{constructor(o){super(),this.error=o}render({_n:o}){return`throw ${this.error};`+o}get names(){return this.error.names}}class S extends i{constructor(o){super(),this.code=o}render({_n:o}){return`${this.code};`+o}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(o,h){return this.code=oe(this.code,o,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class T extends i{constructor(o=[]){super(),this.nodes=o}render(o){return this.nodes.reduce((h,N)=>h+N.render(o),"")}optimizeNodes(){const{nodes:o}=this;let h=o.length;for(;h--;){const N=o[h].optimizeNodes();Array.isArray(N)?o.splice(h,1,...N):N?o[h]=N:o.splice(h,1)}return o.length>0?this:void 0}optimizeNames(o,h){const{nodes:N}=this;let q=N.length;for(;q--;){const M=N[q];M.optimizeNames(o,h)||(ke(o,M.names),N.splice(q,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((o,h)=>K(o,h.names),{})}}class v extends T{render(o){return"{"+o._n+super.render(o)+"}"+o._n}}class R extends T{}class $ extends v{}$.kind="else";class _ extends v{constructor(o,h){super(h),this.condition=o}render(o){let h=`if(${this.condition})`+super.render(o);return this.else&&(h+="else "+this.else.render(o)),h}optimizeNodes(){super.optimizeNodes();const o=this.condition;if(o===!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 o===!1?h instanceof _?h:h.nodes:this.nodes.length?this:new _(Oe(o),h instanceof _?[h]:h.nodes);if(!(o===!1||!this.nodes.length))return this}optimizeNames(o,h){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(o,h),!!(super.optimizeNames(o,h)||this.else))return this.condition=oe(this.condition,o,h),this}get names(){const o=super.names;return ue(o,this.condition),this.else&&K(o,this.else.names),o}}_.kind="if";class k extends v{}k.kind="for";class O extends k{constructor(o){super(),this.iteration=o}render(o){return`for(${this.iteration})`+super.render(o)}optimizeNames(o,h){if(super.optimizeNames(o,h))return this.iteration=oe(this.iteration,o,h),this}get names(){return K(super.names,this.iteration.names)}}class I extends k{constructor(o,h,N,q){super(),this.varKind=o,this.name=h,this.from=N,this.to=q}render(o){const h=o.es5?r.varKinds.var:this.varKind,{name:N,from:q,to:M}=this;return`for(${h} ${N}=${q}; ${N}<${M}; ${N}++)`+super.render(o)}get names(){const o=ue(super.names,this.from);return ue(o,this.to)}}class A extends k{constructor(o,h,N,q){super(),this.loop=o,this.varKind=h,this.name=N,this.iterable=q}render(o){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(o)}optimizeNames(o,h){if(super.optimizeNames(o,h))return this.iterable=oe(this.iterable,o,h),this}get names(){return K(super.names,this.iterable.names)}}class w extends v{constructor(o,h,N){super(),this.name=o,this.args=h,this.async=N}render(o){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(o)}}w.kind="func";class C extends T{render(o){return"return "+super.render(o)}}C.kind="return";class D extends v{render(o){let h="try"+super.render(o);return this.catch&&(h+=this.catch.render(o)),this.finally&&(h+=this.finally.render(o)),h}optimizeNodes(){var o,h;return super.optimizeNodes(),(o=this.catch)===null||o===void 0||o.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(o,h){var N,q;return super.optimizeNames(o,h),(N=this.catch)===null||N===void 0||N.optimizeNames(o,h),(q=this.finally)===null||q===void 0||q.optimizeNames(o,h),this}get names(){const o=super.names;return this.catch&&K(o,this.catch.names),this.finally&&K(o,this.finally.names),o}}class x extends v{constructor(o){super(),this.error=o}render(o){return`catch(${this.error})`+super.render(o)}}x.kind="catch";class V extends v{render(o){return"finally"+super.render(o)}}V.kind="finally";class re{constructor(o,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?`
|
|
921
|
-
`:""},this._extScope=o,this._scope=new r.Scope({parent:o}),this._nodes=[new R]}toString(){return this._root.render(this.opts)}name(o){return this._scope.name(o)}scopeName(o){return this._extScope.name(o)}scopeValue(o,h){const N=this._extScope.value(o,h);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(o,h){return this._extScope.getValue(o,h)}scopeRefs(o){return this._extScope.scopeRefs(o,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(o,h,N,q){const M=this._scope.toName(h);return N!==void 0&&q&&(this._constants[M.str]=N),this._leafNode(new a(o,M,N)),M}const(o,h,N){return this._def(r.varKinds.const,o,h,N)}let(o,h,N){return this._def(r.varKinds.let,o,h,N)}var(o,h,N){return this._def(r.varKinds.var,o,h,N)}assign(o,h,N){return this._leafNode(new l(o,h,N))}add(o,h){return this._leafNode(new p(o,e.operators.ADD,h))}code(o){return typeof o=="function"?o():o!==t.nil&&this._leafNode(new S(o)),this}object(...o){const h=["{"];for(const[N,q]of o)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(o,h,N){if(this._blockNode(new _(o)),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(o){return this._elseNode(new _(o))}else(){return this._elseNode(new $)}endIf(){return this._endBlockNode(_,$)}_for(o,h){return this._blockNode(o),h&&this.code(h).endFor(),this}for(o,h){return this._for(new O(o),h)}forRange(o,h,N,q,M=this.opts.es5?r.varKinds.var:r.varKinds.let){const W=this._scope.toName(o);return this._for(new I(M,W,h,N),()=>q(W))}forOf(o,h,N,q=r.varKinds.const){const M=this._scope.toName(o);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 A("of",q,M,h),()=>N(M))}forIn(o,h,N,q=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(o,(0,t._)`Object.keys(${h})`,N);const M=this._scope.toName(o);return this._for(new A("in",q,M,h),()=>N(M))}endFor(){return this._endBlockNode(k)}label(o){return this._leafNode(new d(o))}break(o){return this._leafNode(new u(o))}return(o){const h=new C;if(this._blockNode(h),this.code(o),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(C)}try(o,h,N){if(!h&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const q=new D;if(this._blockNode(q),this.code(o),h){const M=this.name("e");this._currNode=q.catch=new x(M),h(M)}return N&&(this._currNode=q.finally=new V,this.code(N)),this._endBlockNode(x,V)}throw(o){return this._leafNode(new g(o))}block(o,h){return this._blockStarts.push(this._nodes.length),o&&this.code(o).endBlock(h),this}endBlock(o){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||o!==void 0&&N!==o)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${o} expected`);return this._nodes.length=h,this}func(o,h=t.nil,N,q){return this._blockNode(new w(o,h,N)),q&&this.code(q).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(o=1){for(;o-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(o){return this._currNode.nodes.push(o),this}_blockNode(o){this._currNode.nodes.push(o),this._nodes.push(o)}_endBlockNode(o,h){const N=this._currNode;if(N instanceof o||h&&N instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${o.kind}/${h.kind}`:o.kind}"`)}_elseNode(o){const h=this._currNode;if(!(h instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=o,this}get _root(){return this._nodes[0]}get _currNode(){const o=this._nodes;return o[o.length-1]}set _currNode(o){const h=this._nodes;h[h.length-1]=o}}e.CodeGen=re;function K(P,o){for(const h in o)P[h]=(P[h]||0)+(o[h]||0);return P}function ue(P,o){return o instanceof t._CodeOrName?K(P,o.names):P}function oe(P,o,h){if(P instanceof t.Name)return N(P);if(!q(P))return P;return new t._Code(P._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||o[M.str]!==1?M:(delete o[M.str],W)}function q(M){return M instanceof t._Code&&M._items.some(W=>W instanceof t.Name&&o[W.str]===1&&h[W.str]!==void 0)}}function ke(P,o){for(const h in o)P[h]=(P[h]||0)-(o[h]||0)}function Oe(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:(0,t._)`!${j(P)}`}e.not=Oe;const qe=y(e.operators.AND);function et(...P){return P.reduce(qe)}e.and=et;const Me=y(e.operators.OR);function F(...P){return P.reduce(Me)}e.or=F;function y(P){return(o,h)=>o===t.nil?h:h===t.nil?o:(0,t._)`${j(o)} ${P} ${j(h)}`}function j(P){return P instanceof t.Name?P:(0,t._)`(${P})`}})(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(w){const C={};for(const D of w)C[D]=!0;return C}e.toHash=n;function s(w,C){return typeof C=="boolean"?C:Object.keys(C).length===0?!0:(i(w,C),!a(C,w.self.RULES.all))}e.alwaysValidSchema=s;function i(w,C=w.schema){const{opts:D,self:x}=w;if(!D.strictSchema||typeof C=="boolean")return;const V=x.RULES.keywords;for(const re in C)V[re]||A(w,`unknown keyword: "${re}"`)}e.checkUnknownRules=i;function a(w,C){if(typeof w=="boolean")return!w;for(const D in w)if(C[D])return!0;return!1}e.schemaHasRules=a;function l(w,C){if(typeof w=="boolean")return!w;for(const D in w)if(D!=="$ref"&&C.all[D])return!0;return!1}e.schemaHasRulesButRef=l;function p({topSchemaRef:w,schemaPath:C},D,x,V){if(!V){if(typeof D=="number"||typeof D=="boolean")return D;if(typeof D=="string")return(0,t._)`${D}`}return(0,t._)`${w}${C}${(0,t.getProperty)(x)}`}e.schemaRefOrVal=p;function d(w){return S(decodeURIComponent(w))}e.unescapeFragment=d;function u(w){return encodeURIComponent(g(w))}e.escapeFragment=u;function g(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=g;function S(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=S;function T(w,C){if(Array.isArray(w))for(const D of w)C(D);else C(w)}e.eachItem=T;function v({mergeNames:w,mergeToName:C,mergeValues:D,resultToName:x}){return(V,re,K,ue)=>{const oe=K===void 0?re:K instanceof t.Name?(re instanceof t.Name?w(V,re,K):C(V,re,K),K):re instanceof t.Name?(C(V,K,re),re):D(re,K);return ue===t.Name&&!(oe instanceof t.Name)?x(V,oe):oe}}e.mergeEvaluated={props:v({mergeNames:(w,C,D)=>w.if((0,t._)`${D} !== true && ${C} !== undefined`,()=>{w.if((0,t._)`${C} === true`,()=>w.assign(D,!0),()=>w.assign(D,(0,t._)`${D} || {}`).code((0,t._)`Object.assign(${D}, ${C})`))}),mergeToName:(w,C,D)=>w.if((0,t._)`${D} !== true`,()=>{C===!0?w.assign(D,!0):(w.assign(D,(0,t._)`${D} || {}`),$(w,D,C))}),mergeValues:(w,C)=>w===!0?!0:{...w,...C},resultToName:R}),items:v({mergeNames:(w,C,D)=>w.if((0,t._)`${D} !== true && ${C} !== undefined`,()=>w.assign(D,(0,t._)`${C} === true ? true : ${D} > ${C} ? ${D} : ${C}`)),mergeToName:(w,C,D)=>w.if((0,t._)`${D} !== true`,()=>w.assign(D,C===!0?!0:(0,t._)`${D} > ${C} ? ${D} : ${C}`)),mergeValues:(w,C)=>w===!0?!0:Math.max(w,C),resultToName:(w,C)=>w.var("items",C)})};function R(w,C){if(C===!0)return w.var("props",!0);const D=w.var("props",(0,t._)`{}`);return C!==void 0&&$(w,D,C),D}e.evaluatedPropsToName=R;function $(w,C,D){Object.keys(D).forEach(x=>w.assign((0,t._)`${C}${(0,t.getProperty)(x)}`,!0))}e.setEvaluated=$;const _={};function k(w,C){return w.scopeValue("func",{ref:C,code:_[C.code]||(_[C.code]=new r._Code(C.code))})}e.useFunc=k;var O;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(O=e.Type||(e.Type={}));function I(w,C,D){if(w instanceof t.Name){const x=C===O.Num;return D?x?(0,t._)`"[" + ${w} + "]"`:(0,t._)`"['" + ${w} + "']"`:x?(0,t._)`"/" + ${w}`:(0,t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return D?(0,t.getProperty)(w).toString():"/"+g(w)}e.getErrorPath=I;function A(w,C,D=w.opts.strictSchema){if(D){if(C=`strict mode: ${C}`,D===!0)throw new Error(C);w.self.logger.warn(C)}}e.checkStrictMode=A})(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:_})=>_?(0,t.str)`"${$}" keyword must be ${_} ($data)`:(0,t.str)`"${$}" keyword is invalid ($data)`};function s($,_=e.keywordError,k,O){const{it:I}=$,{gen:A,compositeRule:w,allErrors:C}=I,D=g($,_,k);O??(w||C)?p(A,D):d(I,(0,t._)`[${D}]`)}e.reportError=s;function i($,_=e.keywordError,k){const{it:O}=$,{gen:I,compositeRule:A,allErrors:w}=O,C=g($,_,k);p(I,C),A||w||d(O,n.default.vErrors)}e.reportExtraError=i;function a($,_){$.assign(n.default.errors,_),$.if((0,t._)`${n.default.vErrors} !== null`,()=>$.if(_,()=>$.assign((0,t._)`${n.default.vErrors}.length`,_),()=>$.assign(n.default.vErrors,null)))}e.resetErrorsCount=a;function l({gen:$,keyword:_,schemaValue:k,data:O,errsCount:I,it:A}){if(I===void 0)throw new Error("ajv implementation error");const w=$.name("err");$.forRange("i",I,n.default.errors,C=>{$.const(w,(0,t._)`${n.default.vErrors}[${C}]`),$.if((0,t._)`${w}.instancePath === undefined`,()=>$.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,A.errorPath))),$.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${A.errSchemaPath}/${_}`),A.opts.verbose&&($.assign((0,t._)`${w}.schema`,k),$.assign((0,t._)`${w}.data`,O))})}e.extendErrors=l;function p($,_){const k=$.const("err",_);$.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($,_){const{gen:k,validateName:O,schemaEnv:I}=$;I.$async?k.throw((0,t._)`new ${$.ValidationError}(${_})`):(k.assign((0,t._)`${O}.errors`,_),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 g($,_,k){const{createErrors:O}=$.it;return O===!1?(0,t._)`{}`:S($,_,k)}function S($,_,k={}){const{gen:O,it:I}=$,A=[T(I,k),v($,k)];return R($,_,A),O.object(...A)}function T({errorPath:$},{instancePath:_}){const k=_?(0,t.str)`${$}${(0,r.getErrorPath)(_,r.Type.Str)}`:$;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,k)]}function v({keyword:$,it:{errSchemaPath:_}},{schemaPath:k,parentSchema:O}){let I=O?_:(0,t.str)`${_}/${$}`;return k&&(I=(0,t.str)`${I}${(0,r.getErrorPath)(k,r.Type.Str)}`),[u.schemaPath,I]}function R($,{params:_,message:k},O){const{keyword:I,data:A,schemaValue:w,it:C}=$,{opts:D,propertyName:x,topSchemaRef:V,schemaPath:re}=C;O.push([u.keyword,I],[u.params,typeof _=="function"?_($):_||(0,t._)`{}`]),D.messages&&O.push([u.message,typeof k=="function"?k($):k]),D.verbose&&O.push([u.schema,w],[u.parentSchema,(0,t._)`${V}${re}`],[n.default.data,A]),x&&O.push([u.propertyName,x])}})(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,i=util;var a;(function(O){O[O.Correct=0]="Correct",O[O.Wrong=1]="Wrong"})(a=e.DataType||(e.DataType={}));function l(O){const I=p(O.type);if(I.includes("null")){if(O.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!I.length&&O.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');O.nullable===!0&&I.push("null")}return I}e.getSchemaTypes=l;function p(O){const I=Array.isArray(O)?O:O?[O]:[];if(I.every(t.isJSONType))return I;throw new Error("type must be JSONType or JSONType[]: "+I.join(","))}e.getJSONTypes=p;function d(O,I){const{gen:A,data:w,opts:C}=O,D=g(I,C.coerceTypes),x=I.length>0&&!(D.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(O,I[0]));if(x){const V=R(I,w,C.strictNumbers,a.Wrong);A.if(V,()=>{D.length?S(O,I,D):_(O)})}return x}e.coerceAndCheckDataType=d;const u=new Set(["string","number","integer","boolean","null"]);function g(O,I){return I?O.filter(A=>u.has(A)||I==="array"&&A==="array"):[]}function S(O,I,A){const{gen:w,data:C,opts:D}=O,x=w.let("dataType",(0,s._)`typeof ${C}`),V=w.let("coerced",(0,s._)`undefined`);D.coerceTypes==="array"&&w.if((0,s._)`${x} == 'object' && Array.isArray(${C}) && ${C}.length == 1`,()=>w.assign(C,(0,s._)`${C}[0]`).assign(x,(0,s._)`typeof ${C}`).if(R(I,C,D.strictNumbers),()=>w.assign(V,C))),w.if((0,s._)`${V} !== undefined`);for(const K of A)(u.has(K)||K==="array"&&D.coerceTypes==="array")&&re(K);w.else(),_(O),w.endIf(),w.if((0,s._)`${V} !== undefined`,()=>{w.assign(C,V),T(O,V)});function re(K){switch(K){case"string":w.elseIf((0,s._)`${x} == "number" || ${x} == "boolean"`).assign(V,(0,s._)`"" + ${C}`).elseIf((0,s._)`${C} === null`).assign(V,(0,s._)`""`);return;case"number":w.elseIf((0,s._)`${x} == "boolean" || ${C} === null
|
|
922
|
-
|| (${
|
|
923
|
-
|| (${
|
|
924
|
-
|| ${x} === "boolean" || ${C} === null`).assign(V,(0,s._)`[${C}]`)}}}function T({gen:O,parentData:I,parentDataProperty:A},w){O.if((0,s._)`${I} !== undefined`,()=>O.assign((0,s._)`${I}[${A}]`,w))}function v(O,I,A,w=a.Correct){const C=w===a.Correct?s.operators.EQ:s.operators.NEQ;let D;switch(O){case"null":return(0,s._)`${I} ${C} null`;case"array":D=(0,s._)`Array.isArray(${I})`;break;case"object":D=(0,s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":D=x((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":D=x();break;default:return(0,s._)`typeof ${I} ${C} ${O}`}return w===a.Correct?D:(0,s.not)(D);function x(V=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,V,A?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=v;function R(O,I,A,w){if(O.length===1)return v(O[0],I,A,w);let C;const D=(0,i.toHash)(O);if(D.array&&D.object){const x=(0,s._)`typeof ${I} != "object"`;C=D.null?x:(0,s._)`!${I} || ${x}`,delete D.null,delete D.array,delete D.object}else C=s.nil;D.number&&delete D.integer;for(const x in D)C=(0,s.and)(C,v(x,I,A,w));return C}e.checkDataTypes=R;const $={message:({schema:O})=>`must be ${O}`,params:({schema:O,schemaValue:I})=>typeof O=="string"?(0,s._)`{type: ${O}}`:(0,s._)`{type: ${I}}`};function _(O){const I=k(O);(0,n.reportError)(I,$)}e.reportTypeError=_;function k(O){const{gen:I,data:A,schema:w}=O,C=(0,i.schemaRefOrVal)(O,w,"type");return{gen:I,keyword:"type",data:A,schema:w.type,schemaCode:C,schemaValue:C,parentSchema:w,params:{},it:O}}})(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,i)=>assignDefault(e,i,s.default))}defaults.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:s,data:i,opts:a}=e;if(r===void 0)return;const l=(0,codegen_1$r._)`${i}${(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`;a.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(i=>(0,codegen_1$q.and)(noPropertyInData(e,t,i,r.ownProperties),(0,codegen_1$q._)`${s} = ${i}`)))}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:i},it:a},l,p,d){const u=d?(0,codegen_1$q._)`${e}, ${t}, ${n}${s}`:t,g=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,i)],[names_1$5.default.parentData,a.parentData],[names_1$5.default.parentDataProperty,a.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];a.opts.dynamicRef&&g.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const S=(0,codegen_1$q._)`${u}, ${r.object(...g)}`;return p!==codegen_1$q.nil?(0,codegen_1$q._)`${l}.call(${p}, ${S})`:(0,codegen_1$q._)`${l}(${S})`}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,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,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,i=t.name("valid");if(s.allErrors){const l=t.let("valid",!0);return a(()=>t.assign(l,!1)),l}return t.var(i,!0),a(()=>t.break()),i;function a(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},i),t.if((0,codegen_1$q.not)(i),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 a=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(a,(0,codegen_1$q._)`${a} || ${l}`),e.mergeValidEvaluated(u,l)||t.if((0,codegen_1$q.not)(a))})),e.result(a,()=>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:i,it:a}=e,l=t.macro.call(a.self,s,i,a),p=useKeyword(r,n,l);a.opts.validateSchema!==!1&&a.self.validateSchema(l,!0);const d=r.name("valid");e.subschema({schema:l,schemaPath:codegen_1$p.nil,errSchemaPath:`${a.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:i,parentSchema:a,$data:l,it:p}=e;checkAsyncKeyword(p,t);const d=!l&&t.compile?t.compile.call(p.self,i,a,p):t.validate,u=useKeyword(n,s,d),g=n.let("valid");e.block$data(g,S),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function S(){if(t.errors===!1)R(),t.modifying&&modifyData(e),$(()=>e.error());else{const _=t.async?T():v();t.modifying&&modifyData(e),$(()=>addErrs(e,_))}}function T(){const _=n.let("ruleErrs",null);return n.try(()=>R((0,codegen_1$p._)`await `),k=>n.assign(g,!1).if((0,codegen_1$p._)`${k} instanceof ${p.ValidationError}`,()=>n.assign(_,(0,codegen_1$p._)`${k}.errors`),()=>n.throw(k))),_}function v(){const _=(0,codegen_1$p._)`${u}.errors`;return n.assign(_,null),R(codegen_1$p.nil),_}function R(_=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,O=!("compile"in t&&!l||t.schema===!1);n.assign(g,(0,codegen_1$p._)`${_}${(0,code_1$9.callValidateCode)(e,u,k,O)}`,t.modifying)}function $(_){var k;n.if((0,codegen_1$p.not)((k=t.valid)!==null&&k!==void 0?k: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,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw new Error("ajv implementation error");const a=s.dependencies;if(a!=null&&a.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[i])){const p=`keyword "${i}" 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:i,topSchemaRef:a}){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||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}subschema.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:a}){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:g}=t,S=l.let("data",(0,codegen_1$o._)`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0);p(S),e.errorPath=(0,codegen_1$o.str)`${d}${(0,util_1$n.getErrorPath)(r,n,g.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),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);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: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}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,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 a=i[s];if(!e(t[a],r[a]))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,i,a,l,p,d){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,a,l,p,d);for(var u in n){var g=n[u];if(Array.isArray(g)){if(u in traverse$1.arrayKeywords)for(var S=0;S<g.length;S++)_traverse(e,t,r,g[S],s+"/"+u+"/"+S,i,s,u,n,S)}else if(u in traverse$1.propsKeywords){if(g&&typeof g=="object")for(var T in g)_traverse(e,t,r,g[T],s+"/"+u+"/"+escapeJsonPtr(T),i,s,u,n,T)}else(u in traverse$1.keywords||e.allKeys&&!(u in traverse$1.skipKeywords))&&_traverse(e,t,r,g,s+"/"+u,i,s,u,n)}r(n,s,i,a,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),i={"":s},a=getFullPath(n,s,!1),l={},p=new Set;return traverse(e,{allKeys:!0},(g,S,T,v)=>{if(v===void 0)return;const R=a+S;let $=i[v];typeof g[r]=="string"&&($=_.call(this,g[r])),k.call(this,g.$anchor),k.call(this,g.$dynamicAnchor),i[S]=$;function _(O){const I=this.opts.uriResolver.resolve;if(O=normalizeId($?I($,O):O),p.has(O))throw u(O);p.add(O);let A=this.refs[O];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?d(g,A.schema,O):O!==normalizeId(R)&&(O[0]==="#"?(d(g,l[O],O),l[O]=g):this.refs[O]=R),O}function k(O){if(typeof O=="string"){if(!ANCHOR.test(O))throw new Error(`invalid anchor "${O}"`);_.call(this,`#${O}`)}}}),l;function d(g,S,T){if(S!==void 0&&!equal$2(g,S))throw u(T)}function u(g){return new Error(`reference "${g}" 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},i){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(i)}):e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(s)}`,n.$async,()=>e.code(funcSourceUrl(r,s)).code(i))}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 i=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,i),n.var(t,(0,codegen_1$n._)`${i} === ${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 i=r.$comment;if(s.$comment===!0)e.code((0,codegen_1$n._)`${names_1$3.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){const a=(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(${i}, ${a}, ${l}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=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),i.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:i,data:a,allErrors:l,opts:p,self:d}=e,{RULES:u}=d;if(i.$ref&&(p.ignoreKeywordsWithRef||!(0,util_1$l.schemaHasRulesButRef)(i,u))){s.block(()=>keywordCode(e,"$ref",u.all.$ref.definition));return}p.jtd||checkStrictTypes(e,t),s.block(()=>{for(const S of u.rules)g(S);g(u.post)});function g(S){(0,applicability_1.shouldUseGroup)(i,S)&&(S.type?(s.if((0,dataType_2.checkDataType)(S.type,a,p.strictNumbers)),iterateKeywords(e,S),t.length===1&&t[0]===S.type&&r&&(s.else(),(0,dataType_2.reportTypeError)(e)),s.endIf()):iterateKeywords(e,S),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 i of t.rules)(0,applicability_1.shouldUseRule)(n,i)&&keywordCode(e,i.keyword,i.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:i}=s.definition;i.length&&!i.some(a=>hasApplicableType(t,a))&&strictTypesError(e,`missing type "${i.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:i,def:a}=this;n.if((0,codegen_1$n.or)((0,codegen_1$n._)`${s} === undefined`,r)),t!==codegen_1$n.nil&&n.assign(t,!0),(i.length||a.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:i}=this;return(0,codegen_1$n.or)(a(),l());function a(){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,i.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,i;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,i=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(i=r[t-u],!s)return i}let a=i;const l=s.split("/");for(const d of l)d&&(i=(0,codegen_1$n._)`${i}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(d))}`,a=(0,codegen_1$n._)`${a} && ${i}`);return a;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:i}=this.opts,a=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let l;e.$async&&(l=a.scopeValue("Error",{ref:validation_error_1.default,code:(0,codegen_1$m._)`require("ajv/dist/runtime/validation_error").default`}));const p=a.scopeName("validate");e.validateName=p;const d={gen:a,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:a.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),a.optimize(this.opts.code.optimize);const g=a.toString();u=`${a.scopeRefs(names_1$2.default.scope)}return ${g}`,this.opts.code.process&&(u=this.opts.code.process(u,e));const T=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,u)(this,this.scope.get());if(this.scope.value(p,{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:p,validateCode:g,scopeValues:a._values}),this.opts.unevaluated){const{props:v,items:R}=d;T.evaluated={props:v instanceof codegen_1$m.Name?void 0:v,items:R instanceof codegen_1$m.Name?void 0:R,dynamicProps:v instanceof codegen_1$m.Name,dynamicItems:R instanceof codegen_1$m.Name},T.source&&(T.source.evaluated=(0,codegen_1$m.stringify)(T.evaluated))}return e.validate=T,e}catch(g){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),g}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 i=resolve.call(this,e,r);if(i===void 0){const a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;a&&(i=new SchemaEnv({schema:a,schemaId:l,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=inlineOrCompile.call(this,i)}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 i=(0,resolve_1.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){const l=resolveSchema.call(this,e,a);return typeof(l==null?void 0:l.schema)!="object"?void 0:getJsonPointer.call(this,r,l)}if(typeof(a==null?void 0:a.schema)=="object"){if(a.validate||compileSchema.call(this,a),i===(0,resolve_1.normalizeId)(t)){const{schema:l}=a,{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,a)}}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 i;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);i=resolveSchema.call(this,n,l)}const{schemaId:a}=this.opts;if(i=i||new SchemaEnv({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}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),m=0;m<f;m++)c[m]=arguments[m];if(c.length>1){c[0]=c[0].slice(0,-1);for(var E=c.length-1,b=1;b<E;++b)c[b]=c[b].slice(1,-1);return c[E]=c[E].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 a(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 m=f;if(c)for(var E in c)m[E]=c[E];return m}function d(f){var c="[A-Za-z]",m="[0-9]",E=n(m,"[A-Fa-f]"),b=s(s("%[EFef]"+E+"%"+E+E+"%"+E+E)+"|"+s("%[89A-Fa-f]"+E+"%"+E+E)+"|"+s("%"+E+E)),U="[\\:\\/\\?\\#\\[\\]\\@]",L="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",J=n(U,L),Y=f?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",se=f?"[\\uE000-\\uF8FF]":"[]",B=n(c,m,"[\\-\\.\\_\\~]",Y);s(c+n(c,m,"[\\+\\-\\.]")+"*"),s(s(b+"|"+n(B,L,"[\\:]"))+"*");var Q=s(s("25[0-5]")+"|"+s("2[0-4]"+m)+"|"+s("1"+m+m)+"|"+s("0?[1-9]"+m)+"|0?0?"+m),ie=s(Q+"\\."+Q+"\\."+Q+"\\."+Q),z=s(E+"{1,4}"),X=s(s(z+"\\:"+z)+"|"+ie),ae=s(s(z+"\\:")+"{6}"+X),ee=s("\\:\\:"+s(z+"\\:")+"{5}"+X),Ee=s(s(z)+"?\\:\\:"+s(z+"\\:")+"{4}"+X),ge=s(s(s(z+"\\:")+"{0,1}"+z)+"?\\:\\:"+s(z+"\\:")+"{3}"+X),$e=s(s(s(z+"\\:")+"{0,2}"+z)+"?\\:\\:"+s(z+"\\:")+"{2}"+X),We=s(s(s(z+"\\:")+"{0,3}"+z)+"?\\:\\:"+z+"\\:"+X),Ie=s(s(s(z+"\\:")+"{0,4}"+z)+"?\\:\\:"+X),fe=s(s(s(z+"\\:")+"{0,5}"+z)+"?\\:\\:"+z),ye=s(s(s(z+"\\:")+"{0,6}"+z)+"?\\:\\:"),je=s([ae,ee,Ee,ge,$e,We,Ie,fe,ye].join("|")),we=s(s(B+"|"+b)+"+");s("[vV]"+E+"+\\."+n(B,L,"[\\:]")+"+"),s(s(b+"|"+n(B,L))+"*");var ct=s(b+"|"+n(B,L,"[\\:\\@]"));return s(s(b+"|"+n(B,L,"[\\@]"))+"+"),s(s(ct+"|"+n("[\\/\\?]",se))+"*"),{NOT_SCHEME:new RegExp(n("[^]",c,m,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",B,L),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",B,L),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",B,L),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",B,L),"g"),NOT_QUERY:new RegExp(n("[^\\%]",B,L,"[\\:\\@\\/\\?]",se),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",B,L,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",B,L),"g"),UNRESERVED:new RegExp(B,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",B,J),"g"),PCT_ENCODED:new RegExp(b,"g"),IPV4ADDRESS:new RegExp("^("+ie+")$"),IPV6ADDRESS:new RegExp("^\\[?("+je+")"+s(s("\\%25|\\%(?!"+E+"{2})")+"("+we+")")+"?\\]?$")}}var u=d(!1),g=d(!0),S=function(){function f(c,m){var E=[],b=!0,U=!1,L=void 0;try{for(var J=c[Symbol.iterator](),Y;!(b=(Y=J.next()).done)&&(E.push(Y.value),!(m&&E.length===m));b=!0);}catch(se){U=!0,L=se}finally{try{!b&&J.return&&J.return()}finally{if(U)throw L}}return E}return function(c,m){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return f(c,m);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),T=function(f){if(Array.isArray(f)){for(var c=0,m=Array(f.length);c<f.length;c++)m[c]=f[c];return m}else return Array.from(f)},v=2147483647,R=36,$=1,_=26,k=38,O=700,I=72,A=128,w="-",C=/^xn--/,D=/[^\0-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,V={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},re=R-$,K=Math.floor,ue=String.fromCharCode;function oe(f){throw new RangeError(V[f])}function ke(f,c){for(var m=[],E=f.length;E--;)m[E]=c(f[E]);return m}function Oe(f,c){var m=f.split("@"),E="";m.length>1&&(E=m[0]+"@",f=m[1]),f=f.replace(x,".");var b=f.split("."),U=ke(b,c).join(".");return E+U}function qe(f){for(var c=[],m=0,E=f.length;m<E;){var b=f.charCodeAt(m++);if(b>=55296&&b<=56319&&m<E){var U=f.charCodeAt(m++);(U&64512)==56320?c.push(((b&1023)<<10)+(U&1023)+65536):(c.push(b),m--)}else c.push(b)}return c}var et=function(c){return String.fromCodePoint.apply(String,T(c))},Me=function(c){return c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:R},F=function(c,m){return c+22+75*(c<26)-((m!=0)<<5)},y=function(c,m,E){var b=0;for(c=E?K(c/O):c>>1,c+=K(c/m);c>re*_>>1;b+=R)c=K(c/re);return K(b+(re+1)*c/(c+k))},j=function(c){var m=[],E=c.length,b=0,U=A,L=I,J=c.lastIndexOf(w);J<0&&(J=0);for(var Y=0;Y<J;++Y)c.charCodeAt(Y)>=128&&oe("not-basic"),m.push(c.charCodeAt(Y));for(var se=J>0?J+1:0;se<E;){for(var B=b,Q=1,ie=R;;ie+=R){se>=E&&oe("invalid-input");var z=Me(c.charCodeAt(se++));(z>=R||z>K((v-b)/Q))&&oe("overflow"),b+=z*Q;var X=ie<=L?$:ie>=L+_?_:ie-L;if(z<X)break;var ae=R-X;Q>K(v/ae)&&oe("overflow"),Q*=ae}var ee=m.length+1;L=y(b-B,ee,B==0),K(b/ee)>v-U&&oe("overflow"),U+=K(b/ee),b%=ee,m.splice(b++,0,U)}return String.fromCodePoint.apply(String,m)},P=function(c){var m=[];c=qe(c);var E=c.length,b=A,U=0,L=I,J=!0,Y=!1,se=void 0;try{for(var B=c[Symbol.iterator](),Q;!(J=(Q=B.next()).done);J=!0){var ie=Q.value;ie<128&&m.push(ue(ie))}}catch(lt){Y=!0,se=lt}finally{try{!J&&B.return&&B.return()}finally{if(Y)throw se}}var z=m.length,X=z;for(z&&m.push(w);X<E;){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>=b&&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-b>K((v-U)/fe)&&oe("overflow"),U+=(ae-b)*fe,b=ae;var ye=!0,je=!1,we=void 0;try{for(var ct=c[Symbol.iterator](),Lt;!(ye=(Lt=ct.next()).done);ye=!0){var Ht=Lt.value;if(Ht<b&&++U>v&&oe("overflow"),Ht==b){for(var pt=U,ft=R;;ft+=R){var ht=ft<=L?$:ft>=L+_?_:ft-L;if(pt<ht)break;var xt=pt-ht,zt=R-ht;m.push(ue(F(ht+xt%zt,0))),pt=K(xt/zt)}m.push(ue(F(pt,0))),L=y(U,fe,X==z),U=0,++X}}}catch(lt){je=!0,we=lt}finally{try{!ye&&ct.return&&ct.return()}finally{if(je)throw we}}++U,++b}return m.join("")},o=function(c){return Oe(c,function(m){return C.test(m)?j(m.slice(4).toLowerCase()):m})},h=function(c){return Oe(c,function(m){return D.test(m)?"xn--"+P(m):m})},N={version:"2.1.0",ucs2:{decode:qe,encode:et},decode:j,encode:P,toASCII:h,toUnicode:o},q={};function M(f){var c=f.charCodeAt(0),m=void 0;return c<16?m="%0"+c.toString(16).toUpperCase():c<128?m="%"+c.toString(16).toUpperCase():c<2048?m="%"+(c>>6|192).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase():m="%"+(c>>12|224).toString(16).toUpperCase()+"%"+(c>>6&63|128).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase(),m}function W(f){for(var c="",m=0,E=f.length;m<E;){var b=parseInt(f.substr(m+1,2),16);if(b<128)c+=String.fromCharCode(b),m+=3;else if(b>=194&&b<224){if(E-m>=6){var U=parseInt(f.substr(m+4,2),16);c+=String.fromCharCode((b&31)<<6|U&63)}else c+=f.substr(m,6);m+=6}else if(b>=224){if(E-m>=9){var L=parseInt(f.substr(m+4,2),16),J=parseInt(f.substr(m+7,2),16);c+=String.fromCharCode((b&15)<<12|(L&63)<<6|J&63)}else c+=f.substr(m,9);m+=9}else c+=f.substr(m,3),m+=3}return c}function G(f,c){function m(E){var b=W(E);return b.match(c.UNRESERVED)?b:E}return f.scheme&&(f.scheme=String(f.scheme).replace(c.PCT_ENCODED,m).toLowerCase().replace(c.NOT_SCHEME,"")),f.userinfo!==void 0&&(f.userinfo=String(f.userinfo).replace(c.PCT_ENCODED,m).replace(c.NOT_USERINFO,M).replace(c.PCT_ENCODED,a)),f.host!==void 0&&(f.host=String(f.host).replace(c.PCT_ENCODED,m).toLowerCase().replace(c.NOT_HOST,M).replace(c.PCT_ENCODED,a)),f.path!==void 0&&(f.path=String(f.path).replace(c.PCT_ENCODED,m).replace(f.scheme?c.NOT_PATH:c.NOT_PATH_NOSCHEME,M).replace(c.PCT_ENCODED,a)),f.query!==void 0&&(f.query=String(f.query).replace(c.PCT_ENCODED,m).replace(c.NOT_QUERY,M).replace(c.PCT_ENCODED,a)),f.fragment!==void 0&&(f.fragment=String(f.fragment).replace(c.PCT_ENCODED,m).replace(c.NOT_FRAGMENT,M).replace(c.PCT_ENCODED,a)),f}function ne(f){return f.replace(/^0*(.*)/,"$1")||"0"}function he(f,c){var m=f.match(c.IPV4ADDRESS)||[],E=S(m,2),b=E[1];return b?b.split(".").map(ne).join("."):f}function Ue(f,c){var m=f.match(c.IPV6ADDRESS)||[],E=S(m,3),b=E[1],U=E[2];if(b){for(var L=b.toLowerCase().split("::").reverse(),J=S(L,2),Y=J[0],se=J[1],B=se?se.split(":").map(ne):[],Q=Y.split(":").map(ne),ie=c.IPV4ADDRESS.test(Q[Q.length-1]),z=ie?7:8,X=Q.length-z,ae=Array(z),ee=0;ee<z;++ee)ae[ee]=B[ee]||Q[X+ee]||"";ie&&(ae[z-1]=he(ae[z-1],c));var Ee=ae.reduce(function(fe,ye,je){if(!ye||ye==="0"){var we=fe[fe.length-1];we&&we.index+we.length===je?we.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]:{},m={},E=c.iri!==!1?g:u;c.reference==="suffix"&&(f=(c.scheme?c.scheme+":":"")+"//"+f);var b=f.match(tt);if(b){rt?(m.scheme=b[1],m.userinfo=b[3],m.host=b[4],m.port=parseInt(b[5],10),m.path=b[6]||"",m.query=b[7],m.fragment=b[8],isNaN(m.port)&&(m.port=b[5])):(m.scheme=b[1]||void 0,m.userinfo=f.indexOf("@")!==-1?b[3]:void 0,m.host=f.indexOf("//")!==-1?b[4]:void 0,m.port=parseInt(b[5],10),m.path=b[6]||"",m.query=f.indexOf("?")!==-1?b[7]:void 0,m.fragment=f.indexOf("#")!==-1?b[8]:void 0,isNaN(m.port)&&(m.port=f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?b[4]:void 0)),m.host&&(m.host=Ue(he(m.host,E),E)),m.scheme===void 0&&m.userinfo===void 0&&m.host===void 0&&m.port===void 0&&!m.path&&m.query===void 0?m.reference="same-document":m.scheme===void 0?m.reference="relative":m.fragment===void 0?m.reference="absolute":m.reference="uri",c.reference&&c.reference!=="suffix"&&c.reference!==m.reference&&(m.error=m.error||"URI is not a "+c.reference+" reference.");var U=q[(c.scheme||m.scheme||"").toLowerCase()];if(!c.unicodeSupport&&(!U||!U.unicodeSupport)){if(m.host&&(c.domainHost||U&&U.domainHost))try{m.host=N.toASCII(m.host.replace(E.PCT_ENCODED,W).toLowerCase())}catch(L){m.error=m.error||"Host's domain name can not be converted to ASCII via punycode: "+L}G(m,u)}else G(m,E);U&&U.parse&&U.parse(m,c)}else m.error=m.error||"URI can not be parsed.";return m}function nt(f,c){var m=c.iri!==!1?g:u,E=[];return f.userinfo!==void 0&&(E.push(f.userinfo),E.push("@")),f.host!==void 0&&E.push(Ue(he(String(f.host),m),m).replace(m.IPV6ADDRESS,function(b,U,L){return"["+U+(L?"%25"+L:"")+"]"})),(typeof f.port=="number"||typeof f.port=="string")&&(E.push(":"),E.push(String(f.port))),E.length?E.join(""):void 0}var Le=/^\.\.?\//,He=/^\/\.(\/|$)/,xe=/^\/\.\.(\/|$)/,st=/^\/?(?:.|\n)*?(?=\/|$)/;function me(f){for(var c=[];f.length;)if(f.match(Le))f=f.replace(Le,"");else if(f.match(He))f=f.replace(He,"/");else if(f.match(xe))f=f.replace(xe,"/"),c.pop();else if(f==="."||f==="..")f="";else{var m=f.match(st);if(m){var E=m[0];f=f.slice(E.length),c.push(E)}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]:{},m=c.iri?g:u,E=[],b=q[(c.scheme||f.scheme||"").toLowerCase()];if(b&&b.serialize&&b.serialize(f,c),f.host&&!m.IPV6ADDRESS.test(f.host)){if(c.domainHost||b&&b.domainHost)try{f.host=c.iri?N.toUnicode(f.host):N.toASCII(f.host.replace(m.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,m),c.reference!=="suffix"&&f.scheme&&(E.push(f.scheme),E.push(":"));var U=nt(f,c);if(U!==void 0&&(c.reference!=="suffix"&&E.push("//"),E.push(U),f.path&&f.path.charAt(0)!=="/"&&E.push("/")),f.path!==void 0){var L=f.path;!c.absolutePath&&(!b||!b.absolutePath)&&(L=me(L)),U===void 0&&(L=L.replace(/^\/\//,"/%2F")),E.push(L)}return f.query!==void 0&&(E.push("?"),E.push(f.query)),f.fragment!==void 0&&(E.push("#"),E.push(f.fragment)),E.join("")}function ze(f,c){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E=arguments[3],b={};return E||(f=de(le(f,m),m),c=de(le(c,m),m)),m=m||{},!m.tolerant&&c.scheme?(b.scheme=c.scheme,b.userinfo=c.userinfo,b.host=c.host,b.port=c.port,b.path=me(c.path||""),b.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(b.userinfo=c.userinfo,b.host=c.host,b.port=c.port,b.path=me(c.path||""),b.query=c.query):(c.path?(c.path.charAt(0)==="/"?b.path=me(c.path):((f.userinfo!==void 0||f.host!==void 0||f.port!==void 0)&&!f.path?b.path="/"+c.path:f.path?b.path=f.path.slice(0,f.path.lastIndexOf("/")+1)+c.path:b.path=c.path,b.path=me(b.path)),b.query=c.query):(b.path=f.path,c.query!==void 0?b.query=c.query:b.query=f.query),b.userinfo=f.userinfo,b.host=f.host,b.port=f.port),b.scheme=f.scheme),b.fragment=c.fragment,b}function it(f,c,m){var E=p({scheme:"null"},m);return le(ze(de(f,E),de(c,E),E,!0),E)}function Ce(f,c){return typeof f=="string"?f=le(de(f,c),c):i(f)==="object"&&(f=de(le(f,c),c)),f}function ot(f,c,m){return typeof f=="string"?f=le(de(f,m),m):i(f)==="object"&&(f=le(f,m)),typeof c=="string"?c=le(de(c,m),m):i(c)==="object"&&(c=le(c,m)),f===c}function ut(f,c){return f&&f.toString().replace(!c||!c.iri?u.ESCAPE:g.ESCAPE,M)}function pe(f,c){return f&&f.toString().replace(!c||!c.iri?u.PCT_ENCODED:g.PCT_ENCODED,W)}var Ne={scheme:"http",domainHost:!0,parse:function(c,m){return c.host||(c.error=c.error||"HTTP URIs must have a host."),c},serialize:function(c,m){var E=String(c.scheme).toLowerCase()==="https";return(c.port===(E?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,m){var E=c;return E.secure=jt(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E},serialize:function(c,m){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 E=c.resourceName.split("?"),b=S(E,2),U=b[0],L=b[1];c.path=U&&U!=="/"?U:void 0,c.query=L,c.resourceName=void 0}return c.fragment=void 0,c}},Dt={scheme:"wss",domainHost:at.domainHost,parse:at.parse,serialize:at.serialize},ir={},At="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",_e="[0-9A-Fa-f]",or=s(s("%[EFef]"+_e+"%"+_e+_e+"%"+_e+_e)+"|"+s("%[89A-Fa-f]"+_e+"%"+_e+_e)+"|"+s("%"+_e+_e)),ar="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",cr="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",lr=n(cr,'[\\"\\\\]'),dr="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ur=new RegExp(At,"g"),Ve=new RegExp(or,"g"),pr=new RegExp(n("[^]",ar,"[\\.]",'[\\"]',lr),"g"),Ft=new RegExp(n("[^]",At,dr),"g"),fr=Ft;function Ct(f){var c=W(f);return c.match(ur)?c:f}var qt={scheme:"mailto",parse:function(c,m){var E=c,b=E.to=E.path?E.path.split(","):[];if(E.path=void 0,E.query){for(var U=!1,L={},J=E.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(","),ie=0,z=Q.length;ie<z;++ie)b.push(Q[ie]);break;case"subject":E.subject=pe(B[1],m);break;case"body":E.body=pe(B[1],m);break;default:U=!0,L[pe(B[0],m)]=pe(B[1],m);break}}U&&(E.headers=L)}E.query=void 0;for(var X=0,ae=b.length;X<ae;++X){var ee=b[X].split("@");if(ee[0]=pe(ee[0]),m.unicodeSupport)ee[1]=pe(ee[1],m).toLowerCase();else try{ee[1]=N.toASCII(pe(ee[1],m).toLowerCase())}catch(Ee){E.error=E.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ee}b[X]=ee.join("@")}return E},serialize:function(c,m){var E=c,b=l(c.to);if(b){for(var U=0,L=b.length;U<L;++U){var J=String(b[U]),Y=J.lastIndexOf("@"),se=J.slice(0,Y).replace(Ve,Ct).replace(Ve,a).replace(pr,M),B=J.slice(Y+1);try{B=m.iri?N.toUnicode(B):N.toASCII(pe(B,m).toLowerCase())}catch(X){E.error=E.error||"Email address's domain name can not be converted to "+(m.iri?"Unicode":"ASCII")+" via punycode: "+X}b[U]=se+"@"+B}E.path=b.join(",")}var Q=c.headers=c.headers||{};c.subject&&(Q.subject=c.subject),c.body&&(Q.body=c.body);var ie=[];for(var z in Q)Q[z]!==ir[z]&&ie.push(z.replace(Ve,Ct).replace(Ve,a).replace(Ft,M)+"="+Q[z].replace(Ve,Ct).replace(Ve,a).replace(fr,M));return ie.length&&(E.query=ie.join("&")),E}},hr=/^([^\:]+)\:(.*)/,Mt={scheme:"urn",parse:function(c,m){var E=c.path&&c.path.match(hr),b=c;if(E){var U=m.scheme||b.scheme||"urn",L=E[1].toLowerCase(),J=E[2],Y=U+":"+(m.nid||L),se=q[Y];b.nid=L,b.nss=J,b.path=void 0,se&&(b=se.parse(b,m))}else b.error=b.error||"URN can not be parsed.";return b},serialize:function(c,m){var E=m.scheme||c.scheme||"urn",b=c.nid,U=E+":"+(m.nid||b),L=q[U];L&&(c=L.serialize(c,m));var J=c,Y=c.nss;return J.path=(b||m.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,m){var E=c;return E.uuid=E.nss,E.nss=void 0,!m.tolerant&&(!E.uuid||!E.uuid.match(mr))&&(E.error=E.error||"UUID is not valid."),E},serialize:function(c,m){var E=c;return E.nss=(c.uuid||"").toLowerCase(),E}};q[Ne.scheme]=Ne,q[It.scheme]=It,q[at.scheme]=at,q[Dt.scheme]=Dt,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=ze,r.resolve=it,r.normalize=Ce,r.equal=ot,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,i=rules,a=compile,l=codegen,p=resolve$1,d=dataType,u=util,g=require$$9,S=uri$1,T=(F,y)=>new RegExp(F,y);T.code="new RegExp";const v=["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."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},k=200;function O(F){var y,j,P,o,h,N,q,M,W,G,ne,he,Ue,tt,rt,de,nt,Le,He,xe,st,me,le,ze,it;const Ce=F.strict,ot=(y=F.code)===null||y===void 0?void 0:y.optimize,ut=ot===!0||ot===void 0?1:ot||0,pe=(P=(j=F.code)===null||j===void 0?void 0:j.regExp)!==null&&P!==void 0?P:T,Ne=(o=F.uriResolver)!==null&&o!==void 0?o:S.default;return{strictSchema:(N=(h=F.strictSchema)!==null&&h!==void 0?h:Ce)!==null&&N!==void 0?N:!0,strictNumbers:(M=(q=F.strictNumbers)!==null&&q!==void 0?q:Ce)!==null&&M!==void 0?M:!0,strictTypes:(G=(W=F.strictTypes)!==null&&W!==void 0?W:Ce)!==null&&G!==void 0?G:"log",strictTuples:(he=(ne=F.strictTuples)!==null&&ne!==void 0?ne:Ce)!==null&&he!==void 0?he:"log",strictRequired:(tt=(Ue=F.strictRequired)!==null&&Ue!==void 0?Ue:Ce)!==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:(Le=F.messages)!==null&&Le!==void 0?Le:!0,inlineRefs:(He=F.inlineRefs)!==null&&He!==void 0?He:!0,schemaId:(xe=F.schemaId)!==null&&xe!==void 0?xe:"$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:(ze=F.unicodeRegExp)!==null&&ze!==void 0?ze:!0,int32range:(it=F.int32range)!==null&&it!==void 0?it:!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,...O(y)};const{es5:j,lines:P}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:R,es5:j,lines:P}),this.logger=K(y.logger);const o=y.validateFormats;y.validateFormats=!1,this.RULES=(0,i.getRules)(),A.call(this,$,y,"NOT SUPPORTED"),A.call(this,_,y,"DEPRECATED","warn"),this._metaOpts=V.call(this),y.formats&&D.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),y.keywords&&x.call(this,y.keywords),typeof y.meta=="object"&&this.addMetaSchema(y.meta),C.call(this),y.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:y,meta:j,schemaId:P}=this.opts;let o=g;P==="id"&&(o={...g},o.id=o.$id,delete o.$id),j&&y&&this.addMetaSchema(o,o[P],!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 P;if(typeof y=="string"){if(P=this.getSchema(y),!P)throw new Error(`no schema with key or ref "${y}"`)}else P=this.compile(y);const o=P(j);return"$async"in P||(this.errors=P.errors),o}compile(y,j){const P=this._addSchema(y,j);return P.validate||this._compileSchemaEnv(P)}compileAsync(y,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:P}=this.opts;return o.call(this,y,j);async function o(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 o.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]=P(G))}finally{delete this._loading[G]}}}addSchema(y,j,P,o=this.opts.validateSchema){if(Array.isArray(y)){for(const N of y)this.addSchema(N,void 0,P,o);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,P,j,o,!0),this}addMetaSchema(y,j,P=this.opts.validateSchema){return this.addSchema(y,j,!0,P),this}validateSchema(y,j){if(typeof y=="boolean")return!0;let P;if(P=y.$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 o=this.validate(P,y);if(!o&&j){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return o}getSchema(y){let j;for(;typeof(j=w.call(this,y))=="string";)y=j;if(j===void 0){const{schemaId:P}=this.opts,o=new a.SchemaEnv({schema:{},schemaId:P});if(j=a.resolveSchema.call(this,o,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=w.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 P=y[this.opts.schemaId];return P&&(P=(0,p.normalizeId)(P),delete this.schemas[P],delete this.refs[P]),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 P;if(typeof y=="string")P=y,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=P);else if(typeof y=="object"&&j===void 0){if(j=y,P=j.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(oe.call(this,P,j),!j)return(0,u.eachItem)(P,h=>ke.call(this,h)),this;qe.call(this,j);const o={...j,type:(0,d.getJSONTypes)(j.type),schemaType:(0,d.getJSONTypes)(j.schemaType)};return(0,u.eachItem)(P,o.type.length===0?h=>ke.call(this,h,o):h=>o.type.forEach(N=>ke.call(this,h,o,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 P of j.rules){const o=P.rules.findIndex(h=>h.keyword===y);o>=0&&P.rules.splice(o,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:P="data"}={}){return!y||y.length===0?"No errors":y.map(o=>`${P}${o.instancePath} ${o.message}`).reduce((o,h)=>o+j+h)}$dataMetaSchema(y,j){const P=this.RULES.all;y=JSON.parse(JSON.stringify(y));for(const o of j){const h=o.split("/").slice(1);let N=y;for(const q of h)N=N[q];for(const q in P){const M=P[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 P in y){const o=y[P];(!j||j.test(P))&&(typeof o=="string"?delete y[P]:o&&!o.meta&&(this._cache.delete(o.schema),delete y[P]))}}_addSchema(y,j,P,o=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;P=(0,p.normalizeId)(N||P);const W=p.getSchemaRefs.call(this,y,P);return M=new a.SchemaEnv({schema:y,schemaId:q,meta:j,baseId:P,localRefs:W}),this._cache.set(M.schema,M),h&&!P.startsWith("#")&&(P&&this._checkUnique(P),this.refs[P]=M),o&&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):a.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{a.compileSchema.call(this,y)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function A(F,y,j,P="error"){for(const o in F){const h=o;h in y&&this.logger[P](`${j}: option ${o}. ${F[h]}`)}}function w(F){return F=(0,p.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 y in F)this.addSchema(F[y],y)}function D(){for(const F in this.opts.formats){const y=this.opts.formats[F];y&&this.addFormat(F,y)}}function x(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 V(){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 oe(F,y){const{RULES:j}=this;if((0,u.eachItem)(F,P=>{if(j.keywords[P])throw new Error(`Keyword ${P} is already defined`);if(!ue.test(P))throw new Error(`Keyword ${P} 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 P;const o=y==null?void 0:y.post;if(j&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let N=o?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?Oe.call(this,N,q,y.before):N.rules.push(q),h.all[F]=q,(P=y.implements)===null||P===void 0||P.forEach(M=>this.addKeyword(M))}function Oe(F,y,j){const P=F.rules.findIndex(o=>o.keyword===j);P>=0?F.rules.splice(P,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:i,validateName:a,opts:l,self:p}=n,{root:d}=i;if((r==="#"||r==="#/")&&s===d.baseId)return g();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 S(u);return T(u);function g(){if(i===d)return callRef(e,a,i,i.$async);const v=t.scopeValue("root",{ref:d});return callRef(e,(0,codegen_1$l._)`${v}.validate`,d,d.$async)}function S(v){const R=getValidate(e,v);callRef(e,R,v,v.$async)}function T(v){const R=t.scopeValue("schema",l.code.source===!0?{ref:v,code:(0,codegen_1$l.stringify)(v)}:{ref:v}),$=t.name("valid"),_=e.subschema({schema:v,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:R,errSchemaPath:r},$);e.mergeEvaluated(_),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:i}=e,{allErrors:a,schemaEnv:l,opts:p}=i,d=p.passContext?names_1$1.default.this:codegen_1$l.nil;n?u():g();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)}`),T(t),a||s.assign(v,!0)},R=>{s.if((0,codegen_1$l._)`!(${R} instanceof ${i.ValidationError})`,()=>s.throw(R)),S(R),a||s.assign(v,!1)}),e.ok(v)}function g(){e.result((0,code_1$8.callValidateCode)(e,t,d),()=>T(t),()=>S(t))}function S(v){const R=(0,codegen_1$l._)`${v}.errors`;s.assign(names_1$1.default.vErrors,(0,codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${R} : ${names_1$1.default.vErrors}.concat(${R})`),s.assign(names_1$1.default.errors,(0,codegen_1$l._)`${names_1$1.default.vErrors}.length`)}function T(v){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=util_1$j.mergeEvaluated.props(s,$.props,i.props));else{const _=s.var("props",(0,codegen_1$l._)`${v}.evaluated.props`);i.props=util_1$j.mergeEvaluated.props(s,_,i.props,codegen_1$l.Name)}if(i.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(i.items=util_1$j.mergeEvaluated.items(s,$.items,i.items));else{const _=s.var("items",(0,codegen_1$l._)`${v}.evaluated.items`);i.items=util_1$j.mergeEvaluated.items(s,_,i.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,i=s.opts.multipleOfPrecision,a=t.let("res"),l=i?(0,codegen_1$j._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,codegen_1$j._)`${a} !== parseInt(${a})`;e.fail$data((0,codegen_1$j._)`(${n} === 0 || (${a} = ${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,i=t==="maxLength"?codegen_1$i.operators.GT:codegen_1$i.operators.LT,a=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._)`${a} ${i} ${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:i}=e,a=i.opts.unicodeRegExp?"u":"",l=r?(0,codegen_1$h._)`(new RegExp(${s}, ${a}))`:(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:i,it:a}=e,{opts:l}=a;if(!i&&r.length===0)return;const p=r.length>=l.loopRequired;if(a.allErrors?d():u(),l.strictRequired){const T=e.parentSchema.properties,{definedProperties:v}=e.it;for(const R of r)if((T==null?void 0:T[R])===void 0&&!v.has(R)){const $=a.schemaEnv.baseId+a.errSchemaPath,_=`required property "${R}" is not defined at "${$}" (strictRequired)`;(0,util_1$h.checkStrictMode)(a,_,a.opts.strictRequired)}}function d(){if(p||i)e.block$data(codegen_1$f.nil,g);else for(const T of r)(0,code_1$6.checkReportMissingProp)(e,T)}function u(){const T=t.let("missing");if(p||i){const v=t.let("valid",!0);e.block$data(v,()=>S(T,v)),e.ok(v)}else t.if((0,code_1$6.checkMissingProp)(e,r,T)),(0,code_1$6.reportMissingProp)(e,T),t.else()}function g(){t.forOf("prop",n,T=>{e.setParams({missingProperty:T}),t.if((0,code_1$6.noPropertyInData)(t,s,T,l.ownProperties),()=>e.error())})}function S(T,v){e.setParams({missingProperty:T}),t.forOf(T,n,()=>{t.assign(v,(0,code_1$6.propertyInData)(t,s,T,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:i,schemaCode:a,it:l}=e;if(!n&&!s)return;const p=t.let("valid"),d=i.items?(0,dataType_1.getSchemaTypes)(i.items):[];e.block$data(p,u,(0,codegen_1$d._)`${a} === false`),e.ok(p);function u(){const v=t.let("i",(0,codegen_1$d._)`${r}.length`),R=t.let("j");e.setParams({i:v,j:R}),t.assign(p,!0),t.if((0,codegen_1$d._)`${v} > 1`,()=>(g()?S:T)(v,R))}function g(){return d.length>0&&!d.some(v=>v==="object"||v==="array")}function S(v,R){const $=t.name("item"),_=(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(_,(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(R,(0,codegen_1$d._)`${k}[${$}]`),e.error(),t.assign(p,!1).break()}).code((0,codegen_1$d._)`${k}[${$}] = ${v}`)})}function T(v,R){const $=(0,util_1$g.useFunc)(t,equal_1$2.default),_=t.name("outer");t.label(_).for((0,codegen_1$d._)`;${v}--;`,()=>t.for((0,codegen_1$d._)`${R} = ${v}; ${R}--;`,()=>t.if((0,codegen_1$d._)`${$}(${r}[${v}], ${r}[${R}])`,()=>{e.error(),t.assign(p,!1).break(_)})))}}};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:i}=e;n||i&&typeof i=="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._)`${i} !== ${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:i,it:a}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const l=s.length>=a.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,g);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const T=t.const("vSchema",i);u=(0,codegen_1$b.or)(...s.map((v,R)=>S(T,R)))}e.pass(u);function g(){t.assign(u,!1),t.forOf("v",i,T=>t.if((0,codegen_1$b._)`${d()}(${r}, ${T})`,()=>t.assign(u,!0).break()))}function S(T,v){const R=s[v];return typeof R=="object"&&R!==null?(0,codegen_1$b._)`${d()}(${r}, ${T}[${v}])`:(0,codegen_1$b._)`${r} === ${R}`}}};_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:i,it:a}=e;a.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)(a,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:i,dataProp:u,dataPropType:util_1$d.Type.Num},d),a.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:i,keyword:a,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._)`${i}.length`);r.forEach((g,S)=>{(0,util_1$c.alwaysValidSchema)(l,g)||(n.if((0,codegen_1$9._)`${d} > ${S}`,()=>e.subschema({keyword:a,schemaProp:S,dataProp:S},p)),e.ok(p))});function u(g){const{opts:S,errSchemaPath:T}=l,v=r.length,R=v===g.minItems&&(v===g.maxItems||g[t]===!1);if(S.strictTuples&&!R){const $=`"${a}" is ${v}-tuple, but minItems or maxItems/${t} are not specified or different at path "${T}"`;(0,util_1$c.checkStrictMode)(l,$,S.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:i}=e;let a,l;const{minContains:p,maxContains:d}=n;i.opts.next?(a=p===void 0?1:p,l=d):a=1;const u=t.const("len",(0,codegen_1$7._)`${s}.length`);if(e.setParams({min:a,max:l}),l===void 0&&a===0){(0,util_1$a.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&a>l){(0,util_1$a.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,util_1$a.alwaysValidSchema)(i,r)){let R=(0,codegen_1$7._)`${u} >= ${a}`;l!==void 0&&(R=(0,codegen_1$7._)`${R} && ${u} <= ${l}`),e.pass(R);return}i.items=!0;const g=t.name("valid");l===void 0&&a===1?T(g,()=>t.if(g,()=>t.break())):a===0?(t.let(g,!0),l!==void 0&&t.if((0,codegen_1$7._)`${s}.length > 0`,S)):(t.let(g,!1),S()),e.result(g,()=>e.reset());function S(){const R=t.name("_valid"),$=t.let("count",0);T(R,()=>t.if(R,()=>v($)))}function T(R,$){t.forRange("i",0,u,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:util_1$a.Type.Num,compositeRule:!0},R),$()})}function v(R){t.code((0,codegen_1$7._)`${R}++`),l===void 0?t.if((0,codegen_1$7._)`${R} >= ${a}`,()=>t.assign(g,!0).break()):(t.if((0,codegen_1$7._)`${R} > ${l}`,()=>t.assign(g,!1).break()),a===1?t.assign(g,!0):t.if((0,codegen_1$7._)`${R} >= ${a}`,()=>t.assign(g,!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 g=d===1?"property":"properties";return(0,t.str)`must have ${g} ${u} when property ${p} is present`},params:({params:{property:p,depsCount:d,deps:u,missingProperty:g}})=>(0,t._)`{property: ${p},
|
|
925
|
-
missingProperty: ${
|
|
926
|
-
depsCount: ${
|
|
927
|
-
deps: ${u}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(p){const[d,u]=i(p);a(p,d),l(p,u)}};function i({schema:p}){const d={},u={};for(const g in p){if(g==="__proto__")continue;const S=Array.isArray(p[g])?d:u;S[g]=p[g]}return[d,u]}function a(p,d=p.schema){const{gen:u,data:g,it:S}=p;if(Object.keys(d).length===0)return;const T=u.let("missing");for(const v in d){const R=d[v];if(R.length===0)continue;const $=(0,n.propertyInData)(u,g,v,S.opts.ownProperties);p.setParams({property:v,depsCount:R.length,deps:R.join(", ")}),S.allErrors?u.if($,()=>{for(const _ of R)(0,n.checkReportMissingProp)(p,_)}):(u.if((0,t._)`${$} && (${(0,n.checkMissingProp)(p,R,T)})`),(0,n.reportMissingProp)(p,T),u.else())}}e.validatePropertyDeps=a;function l(p,d=p.schema){const{gen:u,data:g,keyword:S,it:T}=p,v=u.name("valid");for(const R in d)(0,r.alwaysValidSchema)(T,d[R])||(u.if((0,n.propertyInData)(u,g,R,T.opts.ownProperties),()=>{const $=p.subschema({keyword:S,schemaProp:R},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 i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,codegen_1$6.not)(i),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(i)}};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:i,it:a}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:l,opts:p}=a;if(a.props=!0,p.removeAdditional!=="all"&&(0,util_1$8.alwaysValidSchema)(a,r))return;const d=(0,code_1$3.allSchemaProperties)(n.properties),u=(0,code_1$3.allSchemaProperties)(n.patternProperties);g(),e.ok((0,codegen_1$5._)`${i} === ${names_1.default.errors}`);function g(){t.forIn("key",s,$=>{!d.length&&!u.length?v($):t.if(S($),()=>v($))})}function S($){let _;if(d.length>8){const k=(0,util_1$8.schemaRefOrVal)(a,n.properties,"properties");_=(0,code_1$3.isOwnProperty)(t,k,$)}else d.length?_=(0,codegen_1$5.or)(...d.map(k=>(0,codegen_1$5._)`${$} === ${k}`)):_=codegen_1$5.nil;return u.length&&(_=(0,codegen_1$5.or)(_,...u.map(k=>(0,codegen_1$5._)`${(0,code_1$3.usePattern)(e,k)}.test(${$})`))),(0,codegen_1$5.not)(_)}function T($){t.code((0,codegen_1$5._)`delete ${s}[${$}]`)}function v($){if(p.removeAdditional==="all"||p.removeAdditional&&r===!1){T($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),l||t.break();return}if(typeof r=="object"&&!(0,util_1$8.alwaysValidSchema)(a,r)){const _=t.name("valid");p.removeAdditional==="failing"?(R($,_,!1),t.if((0,codegen_1$5.not)(_),()=>{e.reset(),T($)})):(R($,_),l||t.if((0,codegen_1$5.not)(_),()=>t.break()))}}function R($,_,k){const O={keyword:"additionalProperties",dataProp:$,dataPropType:util_1$8.Type.Str};k===!1&&Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(O,_)}}};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:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i,additionalProperties_1$1.default,"additionalProperties"));const a=(0,code_1$2.allSchemaProperties)(r);for(const g of a)i.definedProperties.add(g);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(a),i.props));const l=a.filter(g=>!(0,util_1$7.alwaysValidSchema)(i,r[g]));if(l.length===0)return;const p=t.name("valid");for(const g of l)d(g)?u(g):(t.if((0,code_1$2.propertyInData)(t,s,g,i.opts.ownProperties)),u(g),i.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(g),e.ok(p);function d(g){return i.opts.useDefaults&&!i.compositeRule&&r[g].default!==void 0}function u(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},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:i}=e,{opts:a}=i,l=(0,code_1$1.allSchemaProperties)(r),p=l.filter(R=>(0,util_1$6.alwaysValidSchema)(i,r[R]));if(l.length===0||p.length===l.length&&(!i.opts.unevaluated||i.props===!0))return;const d=a.strictSchema&&!a.allowMatchingProperties&&s.properties,u=t.name("valid");i.props!==!0&&!(i.props instanceof codegen_1$4.Name)&&(i.props=(0,util_2.evaluatedPropsToName)(t,i.props));const{props:g}=i;S();function S(){for(const R of l)d&&T(R),i.allErrors?v(R):(t.var(u,!0),v(R),t.if(u))}function T(R){for(const $ in d)new RegExp(R).test($)&&(0,util_1$6.checkStrictMode)(i,`property ${$} matches pattern ${R} (use allowMatchingProperties)`)}function v(R){t.forIn("key",n,$=>{t.if((0,codegen_1$4._)`${(0,code_1$1.usePattern)(e,R)}.test(${$})`,()=>{const _=p.includes(R);_||e.subschema({keyword:"patternProperties",schemaProp:R,dataProp:$,dataPropType:util_2.Type.Str},u),i.opts.unevaluated&&g!==!0?t.assign((0,codegen_1$4._)`${g}[${$}]`,!0):!_&&!i.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 i=r,a=t.let("valid",!1),l=t.let("passing",null),p=t.name("_valid");e.setParams({passing:l}),t.block(d),e.result(a,()=>e.reset(),()=>e.error(!0));function d(){i.forEach((u,g)=>{let S;(0,util_1$4.alwaysValidSchema)(s,u)?t.var(p,!0):S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},p),g>0&&t.if((0,codegen_1$3._)`${p} && ${a}`).assign(a,!1).assign(l,(0,codegen_1$3._)`[${l}, ${g}]`).else(),t.if(p,()=>{t.assign(a,!0),t.assign(l,g),S&&e.mergeEvaluated(S,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((i,a)=>{if((0,util_1$3.alwaysValidSchema)(n,i))return;const l=e.subschema({keyword:"allOf",schemaProp:a},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"),i=hasSchema(n,"else");if(!s&&!i)return;const a=t.let("valid",!0),l=t.name("_valid");if(p(),e.reset(),s&&i){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(a,()=>e.error(!0));function p(){const u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(u)}function d(u,g){return()=>{const S=e.subschema({keyword:u},l);t.assign(a,l),e.mergeValidEvaluated(S,a),g?t.assign(g,(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:i,schemaCode:a,it:l}=e,{opts:p,errSchemaPath:d,schemaEnv:u,self:g}=l;if(!p.validateFormats)return;s?S():T();function S(){const v=r.scopeValue("formats",{ref:g.formats,code:p.code.formats}),R=r.const("fDef",(0,codegen_1$1._)`${v}[${a}]`),$=r.let("fType"),_=r.let("format");r.if((0,codegen_1$1._)`typeof ${R} == "object" && !(${R} instanceof RegExp)`,()=>r.assign($,(0,codegen_1$1._)`${R}.type || "string"`).assign(_,(0,codegen_1$1._)`${R}.validate`),()=>r.assign($,(0,codegen_1$1._)`"string"`).assign(_,R)),e.fail$data((0,codegen_1$1.or)(k(),O()));function k(){return p.strictSchema===!1?codegen_1$1.nil:(0,codegen_1$1._)`${a} && !${_}`}function O(){const I=u.$async?(0,codegen_1$1._)`(${R}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,codegen_1$1._)`${_}(${n})`,A=(0,codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;return(0,codegen_1$1._)`${_} && ${_} !== true && ${$} === ${t} && !${A}`}}function T(){const v=g.formats[i];if(!v){k();return}if(v===!0)return;const[R,$,_]=O(v);R===t&&e.pass(I());function k(){if(p.strictSchema===!1){g.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${i}" ignored in schema at path "${d}"`}}function O(A){const w=A instanceof RegExp?(0,codegen_1$1.regexpCode)(A):p.code.formats?(0,codegen_1$1._)`${p.code.formats}${(0,codegen_1$1.getProperty)(i)}`:void 0,C=r.scopeValue("formats",{key:i,ref:A,code:w});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,codegen_1$1._)`${C}.validate`]:["string",A,C]}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 ${_}(${n})`}return typeof $=="function"?(0,codegen_1$1._)`${_}(${n})`:(0,codegen_1$1._)`${_}.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:i}=e,{oneOf:a}=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(!a)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 T=S();t.if(!1);for(const v in T)t.elseIf((0,codegen_1._)`${d} === ${v}`),t.assign(p,g(T[v]));t.else(),e.error(!1,{discrError:types_1.DiscrError.Mapping,tag:d,tagName:l}),t.endIf()}function g(T){const v=t.name("valid"),R=e.subschema({keyword:"oneOf",schemaProp:T},v);return e.mergeEvaluated(R,codegen_1.Name),v}function S(){var T;const v={},R=_(s);let $=!0;for(let I=0;I<a.length;I++){let A=a[I];A!=null&&A.$ref&&!(0,util_1.schemaHasRulesButRef)(A,i.self.RULES)&&(A=compile_1.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,A==null?void 0:A.$ref),A instanceof compile_1.SchemaEnv&&(A=A.schema));const w=(T=A==null?void 0:A.properties)===null||T===void 0?void 0:T[l];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);$=$&&(R||_(A)),k(w,I)}if(!$)throw new Error(`discriminator: "${l}" must be required`);return v;function _({required:I}){return Array.isArray(I)&&I.includes(l)}function k(I,A){if(I.const)O(I.const,A);else if(I.enum)for(const w of I.enum)O(w,A);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function O(I,A){if(typeof I!="string"||I in v)throw new Error(`discriminator: "${l}" values must be unique strings`);v[I]=A}}}};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,i=require$$3,a=["/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(i,a):i;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 g=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return g.default}});var S=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return S.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:
|
|
576
|
+
`;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(": "),i=n.substring(0,s).toLowerCase(),a=n.substring(s+2);i in r||(r[i]=[]),r[i].push(a)}return{headers:r,httpStatusCode:t.status}},vt=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])}},wt=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,Xt=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,Yt=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 H(this,Te))this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,H(this,Te)[e]])},Tt=new WeakSet,rr=function(e){const{key:t,name:r,type:n,data:s}=e,i=`/tmp/${Math.random().toFixed(20)}`;this.writeFile(i,s);const a=0;this[__private__dont__use].ccall("wasm_add_uploaded_file",null,[STRING,STRING,STRING,STRING,NUMBER,NUMBER],[t,r,n,i,a,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((i,a)=>{var p;t=u=>{const d=new Error("Rethrown");d.cause=u.error,d.betterMessage=u.message,a(d)},(p=H(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(i,a):i(l)})}catch(i){for(const u in this)typeof this[u]=="function"&&(this[u]=()=>{throw new Error("PHP runtime has crashed – see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=getFunctionsMaybeMissingFromAsyncify();const a=i,l="betterMessage"in a?a.betterMessage:a.message,p=new Error(l);throw p.cause=a,p}finally{(s=H(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(i=>i!=="."&&i!=="..");for(const i of s)recreateMemFS(e,t,joinPaths(r,i))}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(_,...k){const C=[_[0]];let I=0;for(;I<k.length;)l(C,k[I]),C.push(_[++I]);return new n(C)}e._=s;const i=new n("+");function a(_,...k){const C=[R(_[0])];let I=0;for(;I<k.length;)C.push(i),l(C,k[I]),C.push(i,R(_[++I]));return p(C),new n(C)}e.str=a;function l(_,k){k instanceof n?_.push(...k._items):k instanceof r?_.push(k):_.push($(k))}e.addCodeArg=l;function p(_){let k=1;for(;k<_.length-1;){if(_[k]===i){const C=u(_[k-1],_[k+1]);if(C!==void 0){_.splice(k-1,3,C);continue}_[k++]="+"}k++}}function u(_,k){if(k==='""')return _;if(_==='""')return k;if(typeof _=="string")return k instanceof r||_[_.length-1]!=='"'?void 0:typeof k!="string"?`${_.slice(0,-1)}${k}"`:k[0]==='"'?_.slice(0,-1)+k.slice(1):void 0;if(typeof k=="string"&&k[0]==='"'&&!(_ instanceof r))return`"${_}${k.slice(1)}`}function d(_,k){return k.emptyStr()?_:_.emptyStr()?k:a`${_}${k}`}e.strConcat=d;function $(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:R(Array.isArray(_)?_.join(","):_)}function E(_){return new n(R(_))}e.stringify=E;function R(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=R;function v(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new n(`.${_}`):s`[${_}]`}e.getProperty=v;function T(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new n(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=T;function g(_){return new n(_.toString())}e.regexpCode=g})(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(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.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:u,parent:d}={}){this._names={},this._prefixes=u,this._parent=d}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const d=this._names[u]||this._nameGroup(u);return`${u}${d.index++}`}_nameGroup(u){var d,$;if(!(($=(d=this._parent)===null||d===void 0?void 0:d._prefixes)===null||$===void 0)&&$.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,d){super(d),this.prefix=u}setValue(u,{property:d,itemIndex:$}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(d)}[${$}]`}}e.ValueScopeName=i;const a=(0,t._)`\n`;class l extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?a:t.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,d){var $;if(d.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const E=this.toName(u),{prefix:R}=E,v=($=d.key)!==null&&$!==void 0?$:d.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,E);const g=this._scope[R]||(this._scope[R]=[]),_=g.length;return g[_]=d.ref,E.setValue(d,{property:R,itemIndex:_}),E}getValue(u,d){const $=this._values[u];if($)return $.get(d)}scopeRefs(u,d=this._values){return this._reduceValues(d,$=>{if($.scopePath===void 0)throw new Error(`CodeGen: name "${$}" has no value`);return(0,t._)`${u}${$.scopePath}`})}scopeCode(u=this._values,d,$){return this._reduceValues(u,E=>{if(E.value===void 0)throw new Error(`CodeGen: name "${E}" has no value`);return E.value.code},d,$)}_reduceValues(u,d,$={},E){let R=t.nil;for(const v in u){const T=u[v];if(!T)continue;const g=$[v]=$[v]||new Map;T.forEach(_=>{if(g.has(_))return;g.set(_,n.Started);let k=d(_);if(k){const C=this.opts.es5?e.varKinds.var:e.varKinds.const;R=(0,t._)`${R}${C} ${_} = ${k};${this.opts._n}`}else if(k=E==null?void 0:E(_))R=(0,t._)`${R}${k}${this.opts._n}`;else throw new r(_);g.set(_,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 i{optimizeNodes(){return this}optimizeNames(o,h){return this}}class a extends i{constructor(o,h,N){super(),this.varKind=o,this.name=h,this.rhs=N}render({es5:o,_n:h}){const N=o?r.varKinds.var:this.varKind,M=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${M};`+h}optimizeNames(o,h){if(o[this.name.str])return this.rhs&&(this.rhs=oe(this.rhs,o,h)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends i{constructor(o,h,N){super(),this.lhs=o,this.rhs=h,this.sideEffects=N}render({_n:o}){return`${this.lhs} = ${this.rhs};`+o}optimizeNames(o,h){if(!(this.lhs instanceof t.Name&&!o[this.lhs.str]&&!this.sideEffects))return this.rhs=oe(this.rhs,o,h),this}get names(){const o=this.lhs instanceof t.Name?{}:{...this.lhs.names};return ue(o,this.rhs)}}class p extends l{constructor(o,h,N,M){super(o,N,M),this.op=h}render({_n:o}){return`${this.lhs} ${this.op}= ${this.rhs};`+o}}class u extends i{constructor(o){super(),this.label=o,this.names={}}render({_n:o}){return`${this.label}:`+o}}class d extends i{constructor(o){super(),this.label=o,this.names={}}render({_n:o}){return`break${this.label?` ${this.label}`:""};`+o}}class $ extends i{constructor(o){super(),this.error=o}render({_n:o}){return`throw ${this.error};`+o}get names(){return this.error.names}}class E extends i{constructor(o){super(),this.code=o}render({_n:o}){return`${this.code};`+o}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(o,h){return this.code=oe(this.code,o,h),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class R extends i{constructor(o=[]){super(),this.nodes=o}render(o){return this.nodes.reduce((h,N)=>h+N.render(o),"")}optimizeNodes(){const{nodes:o}=this;let h=o.length;for(;h--;){const N=o[h].optimizeNodes();Array.isArray(N)?o.splice(h,1,...N):N?o[h]=N:o.splice(h,1)}return o.length>0?this:void 0}optimizeNames(o,h){const{nodes:N}=this;let M=N.length;for(;M--;){const q=N[M];q.optimizeNames(o,h)||(ke(o,q.names),N.splice(M,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((o,h)=>K(o,h.names),{})}}class v extends R{render(o){return"{"+o._n+super.render(o)+"}"+o._n}}class T extends R{}class g extends v{}g.kind="else";class _ extends v{constructor(o,h){super(h),this.condition=o}render(o){let h=`if(${this.condition})`+super.render(o);return this.else&&(h+="else "+this.else.render(o)),h}optimizeNodes(){super.optimizeNodes();const o=this.condition;if(o===!0)return this.nodes;let h=this.else;if(h){const N=h.optimizeNodes();h=this.else=Array.isArray(N)?new g(N):N}if(h)return o===!1?h instanceof _?h:h.nodes:this.nodes.length?this:new _(Ce(o),h instanceof _?[h]:h.nodes);if(!(o===!1||!this.nodes.length))return this}optimizeNames(o,h){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(o,h),!!(super.optimizeNames(o,h)||this.else))return this.condition=oe(this.condition,o,h),this}get names(){const o=super.names;return ue(o,this.condition),this.else&&K(o,this.else.names),o}}_.kind="if";class k extends v{}k.kind="for";class C extends k{constructor(o){super(),this.iteration=o}render(o){return`for(${this.iteration})`+super.render(o)}optimizeNames(o,h){if(super.optimizeNames(o,h))return this.iteration=oe(this.iteration,o,h),this}get names(){return K(super.names,this.iteration.names)}}class I extends k{constructor(o,h,N,M){super(),this.varKind=o,this.name=h,this.from=N,this.to=M}render(o){const h=o.es5?r.varKinds.var:this.varKind,{name:N,from:M,to:q}=this;return`for(${h} ${N}=${M}; ${N}<${q}; ${N}++)`+super.render(o)}get names(){const o=ue(super.names,this.from);return ue(o,this.to)}}class A extends k{constructor(o,h,N,M){super(),this.loop=o,this.varKind=h,this.name=N,this.iterable=M}render(o){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(o)}optimizeNames(o,h){if(super.optimizeNames(o,h))return this.iterable=oe(this.iterable,o,h),this}get names(){return K(super.names,this.iterable.names)}}class w extends v{constructor(o,h,N){super(),this.name=o,this.args=h,this.async=N}render(o){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(o)}}w.kind="func";class O extends R{render(o){return"return "+super.render(o)}}O.kind="return";class D extends v{render(o){let h="try"+super.render(o);return this.catch&&(h+=this.catch.render(o)),this.finally&&(h+=this.finally.render(o)),h}optimizeNodes(){var o,h;return super.optimizeNodes(),(o=this.catch)===null||o===void 0||o.optimizeNodes(),(h=this.finally)===null||h===void 0||h.optimizeNodes(),this}optimizeNames(o,h){var N,M;return super.optimizeNames(o,h),(N=this.catch)===null||N===void 0||N.optimizeNames(o,h),(M=this.finally)===null||M===void 0||M.optimizeNames(o,h),this}get names(){const o=super.names;return this.catch&&K(o,this.catch.names),this.finally&&K(o,this.finally.names),o}}class z extends v{constructor(o){super(),this.error=o}render(o){return`catch(${this.error})`+super.render(o)}}z.kind="catch";class x extends v{render(o){return"finally"+super.render(o)}}x.kind="finally";class re{constructor(o,h={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...h,_n:h.lines?`
|
|
577
|
+
`:""},this._extScope=o,this._scope=new r.Scope({parent:o}),this._nodes=[new T]}toString(){return this._root.render(this.opts)}name(o){return this._scope.name(o)}scopeName(o){return this._extScope.name(o)}scopeValue(o,h){const N=this._extScope.value(o,h);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(o,h){return this._extScope.getValue(o,h)}scopeRefs(o){return this._extScope.scopeRefs(o,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(o,h,N,M){const q=this._scope.toName(h);return N!==void 0&&M&&(this._constants[q.str]=N),this._leafNode(new a(o,q,N)),q}const(o,h,N){return this._def(r.varKinds.const,o,h,N)}let(o,h,N){return this._def(r.varKinds.let,o,h,N)}var(o,h,N){return this._def(r.varKinds.var,o,h,N)}assign(o,h,N){return this._leafNode(new l(o,h,N))}add(o,h){return this._leafNode(new p(o,e.operators.ADD,h))}code(o){return typeof o=="function"?o():o!==t.nil&&this._leafNode(new E(o)),this}object(...o){const h=["{"];for(const[N,M]of o)h.length>1&&h.push(","),h.push(N),(N!==M||this.opts.es5)&&(h.push(":"),(0,t.addCodeArg)(h,M));return h.push("}"),new t._Code(h)}if(o,h,N){if(this._blockNode(new _(o)),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(o){return this._elseNode(new _(o))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(o,h){return this._blockNode(o),h&&this.code(h).endFor(),this}for(o,h){return this._for(new C(o),h)}forRange(o,h,N,M,q=this.opts.es5?r.varKinds.var:r.varKinds.let){const W=this._scope.toName(o);return this._for(new I(q,W,h,N),()=>M(W))}forOf(o,h,N,M=r.varKinds.const){const q=this._scope.toName(o);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(q,(0,t._)`${W}[${G}]`),N(q)})}return this._for(new A("of",M,q,h),()=>N(q))}forIn(o,h,N,M=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(o,(0,t._)`Object.keys(${h})`,N);const q=this._scope.toName(o);return this._for(new A("in",M,q,h),()=>N(q))}endFor(){return this._endBlockNode(k)}label(o){return this._leafNode(new u(o))}break(o){return this._leafNode(new d(o))}return(o){const h=new O;if(this._blockNode(h),this.code(o),h.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(O)}try(o,h,N){if(!h&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const M=new D;if(this._blockNode(M),this.code(o),h){const q=this.name("e");this._currNode=M.catch=new z(q),h(q)}return N&&(this._currNode=M.finally=new x,this.code(N)),this._endBlockNode(z,x)}throw(o){return this._leafNode(new $(o))}block(o,h){return this._blockStarts.push(this._nodes.length),o&&this.code(o).endBlock(h),this}endBlock(o){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||o!==void 0&&N!==o)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${o} expected`);return this._nodes.length=h,this}func(o,h=t.nil,N,M){return this._blockNode(new w(o,h,N)),M&&this.code(M).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(o=1){for(;o-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(o){return this._currNode.nodes.push(o),this}_blockNode(o){this._currNode.nodes.push(o),this._nodes.push(o)}_endBlockNode(o,h){const N=this._currNode;if(N instanceof o||h&&N instanceof h)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${h?`${o.kind}/${h.kind}`:o.kind}"`)}_elseNode(o){const h=this._currNode;if(!(h instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=h.else=o,this}get _root(){return this._nodes[0]}get _currNode(){const o=this._nodes;return o[o.length-1]}set _currNode(o){const h=this._nodes;h[h.length-1]=o}}e.CodeGen=re;function K(P,o){for(const h in o)P[h]=(P[h]||0)+(o[h]||0);return P}function ue(P,o){return o instanceof t._CodeOrName?K(P,o.names):P}function oe(P,o,h){if(P instanceof t.Name)return N(P);if(!M(P))return P;return new t._Code(P._items.reduce((q,W)=>(W instanceof t.Name&&(W=N(W)),W instanceof t._Code?q.push(...W._items):q.push(W),q),[]));function N(q){const W=h[q.str];return W===void 0||o[q.str]!==1?q:(delete o[q.str],W)}function M(q){return q instanceof t._Code&&q._items.some(W=>W instanceof t.Name&&o[W.str]===1&&h[W.str]!==void 0)}}function ke(P,o){for(const h in o)P[h]=(P[h]||0)-(o[h]||0)}function Ce(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:(0,t._)`!${j(P)}`}e.not=Ce;const qe=y(e.operators.AND);function et(...P){return P.reduce(qe)}e.and=et;const Ue=y(e.operators.OR);function F(...P){return P.reduce(Ue)}e.or=F;function y(P){return(o,h)=>o===t.nil?h:h===t.nil?o:(0,t._)`${j(o)} ${P} ${j(h)}`}function j(P){return P instanceof t.Name?P:(0,t._)`(${P})`}})(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(w){const O={};for(const D of w)O[D]=!0;return O}e.toHash=n;function s(w,O){return typeof O=="boolean"?O:Object.keys(O).length===0?!0:(i(w,O),!a(O,w.self.RULES.all))}e.alwaysValidSchema=s;function i(w,O=w.schema){const{opts:D,self:z}=w;if(!D.strictSchema||typeof O=="boolean")return;const x=z.RULES.keywords;for(const re in O)x[re]||A(w,`unknown keyword: "${re}"`)}e.checkUnknownRules=i;function a(w,O){if(typeof w=="boolean")return!w;for(const D in w)if(O[D])return!0;return!1}e.schemaHasRules=a;function l(w,O){if(typeof w=="boolean")return!w;for(const D in w)if(D!=="$ref"&&O.all[D])return!0;return!1}e.schemaHasRulesButRef=l;function p({topSchemaRef:w,schemaPath:O},D,z,x){if(!x){if(typeof D=="number"||typeof D=="boolean")return D;if(typeof D=="string")return(0,t._)`${D}`}return(0,t._)`${w}${O}${(0,t.getProperty)(z)}`}e.schemaRefOrVal=p;function u(w){return E(decodeURIComponent(w))}e.unescapeFragment=u;function d(w){return encodeURIComponent($(w))}e.escapeFragment=d;function $(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=$;function E(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=E;function R(w,O){if(Array.isArray(w))for(const D of w)O(D);else O(w)}e.eachItem=R;function v({mergeNames:w,mergeToName:O,mergeValues:D,resultToName:z}){return(x,re,K,ue)=>{const oe=K===void 0?re:K instanceof t.Name?(re instanceof t.Name?w(x,re,K):O(x,re,K),K):re instanceof t.Name?(O(x,K,re),re):D(re,K);return ue===t.Name&&!(oe instanceof t.Name)?z(x,oe):oe}}e.mergeEvaluated={props:v({mergeNames:(w,O,D)=>w.if((0,t._)`${D} !== true && ${O} !== undefined`,()=>{w.if((0,t._)`${O} === true`,()=>w.assign(D,!0),()=>w.assign(D,(0,t._)`${D} || {}`).code((0,t._)`Object.assign(${D}, ${O})`))}),mergeToName:(w,O,D)=>w.if((0,t._)`${D} !== true`,()=>{O===!0?w.assign(D,!0):(w.assign(D,(0,t._)`${D} || {}`),g(w,D,O))}),mergeValues:(w,O)=>w===!0?!0:{...w,...O},resultToName:T}),items:v({mergeNames:(w,O,D)=>w.if((0,t._)`${D} !== true && ${O} !== undefined`,()=>w.assign(D,(0,t._)`${O} === true ? true : ${D} > ${O} ? ${D} : ${O}`)),mergeToName:(w,O,D)=>w.if((0,t._)`${D} !== true`,()=>w.assign(D,O===!0?!0:(0,t._)`${D} > ${O} ? ${D} : ${O}`)),mergeValues:(w,O)=>w===!0?!0:Math.max(w,O),resultToName:(w,O)=>w.var("items",O)})};function T(w,O){if(O===!0)return w.var("props",!0);const D=w.var("props",(0,t._)`{}`);return O!==void 0&&g(w,D,O),D}e.evaluatedPropsToName=T;function g(w,O,D){Object.keys(D).forEach(z=>w.assign((0,t._)`${O}${(0,t.getProperty)(z)}`,!0))}e.setEvaluated=g;const _={};function k(w,O){return w.scopeValue("func",{ref:O,code:_[O.code]||(_[O.code]=new r._Code(O.code))})}e.useFunc=k;var C;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(C=e.Type||(e.Type={}));function I(w,O,D){if(w instanceof t.Name){const z=O===C.Num;return D?z?(0,t._)`"[" + ${w} + "]"`:(0,t._)`"['" + ${w} + "']"`:z?(0,t._)`"/" + ${w}`:(0,t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return D?(0,t.getProperty)(w).toString():"/"+$(w)}e.getErrorPath=I;function A(w,O,D=w.opts.strictSchema){if(D){if(O=`strict mode: ${O}`,D===!0)throw new Error(O);w.self.logger.warn(O)}}e.checkStrictMode=A})(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:g})=>(0,t.str)`must pass "${g}" keyword validation`},e.keyword$DataError={message:({keyword:g,schemaType:_})=>_?(0,t.str)`"${g}" keyword must be ${_} ($data)`:(0,t.str)`"${g}" keyword is invalid ($data)`};function s(g,_=e.keywordError,k,C){const{it:I}=g,{gen:A,compositeRule:w,allErrors:O}=I,D=$(g,_,k);C??(w||O)?p(A,D):u(I,(0,t._)`[${D}]`)}e.reportError=s;function i(g,_=e.keywordError,k){const{it:C}=g,{gen:I,compositeRule:A,allErrors:w}=C,O=$(g,_,k);p(I,O),A||w||u(C,n.default.vErrors)}e.reportExtraError=i;function a(g,_){g.assign(n.default.errors,_),g.if((0,t._)`${n.default.vErrors} !== null`,()=>g.if(_,()=>g.assign((0,t._)`${n.default.vErrors}.length`,_),()=>g.assign(n.default.vErrors,null)))}e.resetErrorsCount=a;function l({gen:g,keyword:_,schemaValue:k,data:C,errsCount:I,it:A}){if(I===void 0)throw new Error("ajv implementation error");const w=g.name("err");g.forRange("i",I,n.default.errors,O=>{g.const(w,(0,t._)`${n.default.vErrors}[${O}]`),g.if((0,t._)`${w}.instancePath === undefined`,()=>g.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,A.errorPath))),g.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${A.errSchemaPath}/${_}`),A.opts.verbose&&(g.assign((0,t._)`${w}.schema`,k),g.assign((0,t._)`${w}.data`,C))})}e.extendErrors=l;function p(g,_){const k=g.const("err",_);g.if((0,t._)`${n.default.vErrors} === null`,()=>g.assign(n.default.vErrors,(0,t._)`[${k}]`),(0,t._)`${n.default.vErrors}.push(${k})`),g.code((0,t._)`${n.default.errors}++`)}function u(g,_){const{gen:k,validateName:C,schemaEnv:I}=g;I.$async?k.throw((0,t._)`new ${g.ValidationError}(${_})`):(k.assign((0,t._)`${C}.errors`,_),k.return(!1))}const d={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 $(g,_,k){const{createErrors:C}=g.it;return C===!1?(0,t._)`{}`:E(g,_,k)}function E(g,_,k={}){const{gen:C,it:I}=g,A=[R(I,k),v(g,k)];return T(g,_,A),C.object(...A)}function R({errorPath:g},{instancePath:_}){const k=_?(0,t.str)`${g}${(0,r.getErrorPath)(_,r.Type.Str)}`:g;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,k)]}function v({keyword:g,it:{errSchemaPath:_}},{schemaPath:k,parentSchema:C}){let I=C?_:(0,t.str)`${_}/${g}`;return k&&(I=(0,t.str)`${I}${(0,r.getErrorPath)(k,r.Type.Str)}`),[d.schemaPath,I]}function T(g,{params:_,message:k},C){const{keyword:I,data:A,schemaValue:w,it:O}=g,{opts:D,propertyName:z,topSchemaRef:x,schemaPath:re}=O;C.push([d.keyword,I],[d.params,typeof _=="function"?_(g):_||(0,t._)`{}`]),D.messages&&C.push([d.message,typeof k=="function"?k(g):k]),D.verbose&&C.push([d.schema,w],[d.parentSchema,(0,t._)`${x}${re}`],[n.default.data,A]),z&&C.push([d.propertyName,z])}})(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,i=util;var a;(function(C){C[C.Correct=0]="Correct",C[C.Wrong=1]="Wrong"})(a=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 u(C,I){const{gen:A,data:w,opts:O}=C,D=$(I,O.coerceTypes),z=I.length>0&&!(D.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(C,I[0]));if(z){const x=T(I,w,O.strictNumbers,a.Wrong);A.if(x,()=>{D.length?E(C,I,D):_(C)})}return z}e.coerceAndCheckDataType=u;const d=new Set(["string","number","integer","boolean","null"]);function $(C,I){return I?C.filter(A=>d.has(A)||I==="array"&&A==="array"):[]}function E(C,I,A){const{gen:w,data:O,opts:D}=C,z=w.let("dataType",(0,s._)`typeof ${O}`),x=w.let("coerced",(0,s._)`undefined`);D.coerceTypes==="array"&&w.if((0,s._)`${z} == 'object' && Array.isArray(${O}) && ${O}.length == 1`,()=>w.assign(O,(0,s._)`${O}[0]`).assign(z,(0,s._)`typeof ${O}`).if(T(I,O,D.strictNumbers),()=>w.assign(x,O))),w.if((0,s._)`${x} !== undefined`);for(const K of A)(d.has(K)||K==="array"&&D.coerceTypes==="array")&&re(K);w.else(),_(C),w.endIf(),w.if((0,s._)`${x} !== undefined`,()=>{w.assign(O,x),R(C,x)});function re(K){switch(K){case"string":w.elseIf((0,s._)`${z} == "number" || ${z} == "boolean"`).assign(x,(0,s._)`"" + ${O}`).elseIf((0,s._)`${O} === null`).assign(x,(0,s._)`""`);return;case"number":w.elseIf((0,s._)`${z} == "boolean" || ${O} === null
|
|
578
|
+
|| (${z} == "string" && ${O} && ${O} == +${O})`).assign(x,(0,s._)`+${O}`);return;case"integer":w.elseIf((0,s._)`${z} === "boolean" || ${O} === null
|
|
579
|
+
|| (${z} === "string" && ${O} && ${O} == +${O} && !(${O} % 1))`).assign(x,(0,s._)`+${O}`);return;case"boolean":w.elseIf((0,s._)`${O} === "false" || ${O} === 0 || ${O} === null`).assign(x,!1).elseIf((0,s._)`${O} === "true" || ${O} === 1`).assign(x,!0);return;case"null":w.elseIf((0,s._)`${O} === "" || ${O} === 0 || ${O} === false`),w.assign(x,null);return;case"array":w.elseIf((0,s._)`${z} === "string" || ${z} === "number"
|
|
580
|
+
|| ${z} === "boolean" || ${O} === null`).assign(x,(0,s._)`[${O}]`)}}}function R({gen:C,parentData:I,parentDataProperty:A},w){C.if((0,s._)`${I} !== undefined`,()=>C.assign((0,s._)`${I}[${A}]`,w))}function v(C,I,A,w=a.Correct){const O=w===a.Correct?s.operators.EQ:s.operators.NEQ;let D;switch(C){case"null":return(0,s._)`${I} ${O} null`;case"array":D=(0,s._)`Array.isArray(${I})`;break;case"object":D=(0,s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":D=z((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":D=z();break;default:return(0,s._)`typeof ${I} ${O} ${C}`}return w===a.Correct?D:(0,s.not)(D);function z(x=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,x,A?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=v;function T(C,I,A,w){if(C.length===1)return v(C[0],I,A,w);let O;const D=(0,i.toHash)(C);if(D.array&&D.object){const z=(0,s._)`typeof ${I} != "object"`;O=D.null?z:(0,s._)`!${I} || ${z}`,delete D.null,delete D.array,delete D.object}else O=s.nil;D.number&&delete D.integer;for(const z in D)O=(0,s.and)(O,v(z,I,A,w));return O}e.checkDataTypes=T;const g={message:({schema:C})=>`must be ${C}`,params:({schema:C,schemaValue:I})=>typeof C=="string"?(0,s._)`{type: ${C}}`:(0,s._)`{type: ${I}}`};function _(C){const I=k(C);(0,n.reportError)(I,g)}e.reportTypeError=_;function k(C){const{gen:I,data:A,schema:w}=C,O=(0,i.schemaRefOrVal)(C,w,"type");return{gen:I,keyword:"type",data:A,schema:w.type,schemaCode:O,schemaValue:O,parentSchema:w,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,i)=>assignDefault(e,i,s.default))}defaults.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:s,data:i,opts:a}=e;if(r===void 0)return;const l=(0,codegen_1$r._)`${i}${(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`;a.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(i=>(0,codegen_1$q.and)(noPropertyInData(e,t,i,r.ownProperties),(0,codegen_1$q._)`${s} = ${i}`)))}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:i},it:a},l,p,u){const d=u?(0,codegen_1$q._)`${e}, ${t}, ${n}${s}`:t,$=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,i)],[names_1$5.default.parentData,a.parentData],[names_1$5.default.parentDataProperty,a.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];a.opts.dynamicRef&&$.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const E=(0,codegen_1$q._)`${d}, ${r.object(...$)}`;return p!==codegen_1$q.nil?(0,codegen_1$q._)`${l}.call(${p}, ${E})`:(0,codegen_1$q._)`${l}(${E})`}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,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,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,i=t.name("valid");if(s.allErrors){const l=t.let("valid",!0);return a(()=>t.assign(l,!1)),l}return t.var(i,!0),a(()=>t.break()),i;function a(l){const p=t.const("len",(0,codegen_1$q._)`${r}.length`);t.forRange("i",0,p,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:util_1$o.Type.Num},i),t.if((0,codegen_1$q.not)(i),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 a=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((p,u)=>{const d=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},l);t.assign(a,(0,codegen_1$q._)`${a} || ${l}`),e.mergeValidEvaluated(d,l)||t.if((0,codegen_1$q.not)(a))})),e.result(a,()=>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:i,it:a}=e,l=t.macro.call(a.self,s,i,a),p=useKeyword(r,n,l);a.opts.validateSchema!==!1&&a.self.validateSchema(l,!0);const u=r.name("valid");e.subschema({schema:l,schemaPath:codegen_1$p.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:p,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}keyword.macroKeywordCode=macroKeywordCode;function funcKeywordCode(e,t){var r;const{gen:n,keyword:s,schema:i,parentSchema:a,$data:l,it:p}=e;checkAsyncKeyword(p,t);const u=!l&&t.compile?t.compile.call(p.self,i,a,p):t.validate,d=useKeyword(n,s,u),$=n.let("valid");e.block$data($,E),e.ok((r=t.valid)!==null&&r!==void 0?r:$);function E(){if(t.errors===!1)T(),t.modifying&&modifyData(e),g(()=>e.error());else{const _=t.async?R():v();t.modifying&&modifyData(e),g(()=>addErrs(e,_))}}function R(){const _=n.let("ruleErrs",null);return n.try(()=>T((0,codegen_1$p._)`await `),k=>n.assign($,!1).if((0,codegen_1$p._)`${k} instanceof ${p.ValidationError}`,()=>n.assign(_,(0,codegen_1$p._)`${k}.errors`),()=>n.throw(k))),_}function v(){const _=(0,codegen_1$p._)`${d}.errors`;return n.assign(_,null),T(codegen_1$p.nil),_}function T(_=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($,(0,codegen_1$p._)`${_}${(0,code_1$9.callValidateCode)(e,d,k,C)}`,t.modifying)}function g(_){var k;n.if((0,codegen_1$p.not)((k=t.valid)!==null&&k!==void 0?k:$),_)}}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,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw new Error("ajv implementation error");const a=s.dependencies;if(a!=null&&a.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[i])){const p=`keyword "${i}" 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:i,topSchemaRef:a}){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||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}subschema.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:a}){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:d,opts:$}=t,E=l.let("data",(0,codegen_1$o._)`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0);p(E),e.errorPath=(0,codegen_1$o.str)`${u}${(0,util_1$n.getErrorPath)(r,n,$.jsPropertySyntax)}`,e.parentDataProperty=(0,codegen_1$o._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(s!==void 0){const u=s instanceof codegen_1$o.Name?s:l.let("data",s,!0);p(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function p(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}subschema.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(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}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,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 a=i[s];if(!e(t[a],r[a]))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,i,a,l,p,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,a,l,p,u);for(var d in n){var $=n[d];if(Array.isArray($)){if(d in traverse$1.arrayKeywords)for(var E=0;E<$.length;E++)_traverse(e,t,r,$[E],s+"/"+d+"/"+E,i,s,d,n,E)}else if(d in traverse$1.propsKeywords){if($&&typeof $=="object")for(var R in $)_traverse(e,t,r,$[R],s+"/"+d+"/"+escapeJsonPtr(R),i,s,d,n,R)}else(d in traverse$1.keywords||e.allKeys&&!(d in traverse$1.skipKeywords))&&_traverse(e,t,r,$,s+"/"+d,i,s,d,n)}r(n,s,i,a,l,p,u)}}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),i={"":s},a=getFullPath(n,s,!1),l={},p=new Set;return traverse(e,{allKeys:!0},($,E,R,v)=>{if(v===void 0)return;const T=a+E;let g=i[v];typeof $[r]=="string"&&(g=_.call(this,$[r])),k.call(this,$.$anchor),k.call(this,$.$dynamicAnchor),i[E]=g;function _(C){const I=this.opts.uriResolver.resolve;if(C=normalizeId(g?I(g,C):C),p.has(C))throw d(C);p.add(C);let A=this.refs[C];return typeof A=="string"&&(A=this.refs[A]),typeof A=="object"?u($,A.schema,C):C!==normalizeId(T)&&(C[0]==="#"?(u($,l[C],C),l[C]=$):this.refs[C]=T),C}function k(C){if(typeof C=="string"){if(!ANCHOR.test(C))throw new Error(`invalid anchor "${C}"`);_.call(this,`#${C}`)}}}),l;function u($,E,R){if(E!==void 0&&!equal$2($,E))throw d(R)}function d($){return new Error(`reference "${$}" 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},i){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(i)}):e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(s)}`,n.$async,()=>e.code(funcSourceUrl(r,s)).code(i))}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 i=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,i),n.var(t,(0,codegen_1$n._)`${i} === ${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 i=r.$comment;if(s.$comment===!0)e.code((0,codegen_1$n._)`${names_1$3.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){const a=(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(${i}, ${a}, ${l}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=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),i.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:i,data:a,allErrors:l,opts:p,self:u}=e,{RULES:d}=u;if(i.$ref&&(p.ignoreKeywordsWithRef||!(0,util_1$l.schemaHasRulesButRef)(i,d))){s.block(()=>keywordCode(e,"$ref",d.all.$ref.definition));return}p.jtd||checkStrictTypes(e,t),s.block(()=>{for(const E of d.rules)$(E);$(d.post)});function $(E){(0,applicability_1.shouldUseGroup)(i,E)&&(E.type?(s.if((0,dataType_2.checkDataType)(E.type,a,p.strictNumbers)),iterateKeywords(e,E),t.length===1&&t[0]===E.type&&r&&(s.else(),(0,dataType_2.reportTypeError)(e)),s.endIf()):iterateKeywords(e,E),l||s.if((0,codegen_1$n._)`${names_1$3.default.errors} === ${n||0}`))}}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 i of t.rules)(0,applicability_1.shouldUseRule)(n,i)&&keywordCode(e,i.keyword,i.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:i}=s.definition;i.length&&!i.some(a=>hasApplicableType(t,a))&&strictTypesError(e,`missing type "${i.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:i,def:a}=this;n.if((0,codegen_1$n.or)((0,codegen_1$n._)`${s} === undefined`,r)),t!==codegen_1$n.nil&&n.assign(t,!0),(i.length||a.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:i}=this;return(0,codegen_1$n.or)(a(),l());function a(){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,i.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,i;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,i=names_1$3.default.rootData}else{const u=RELATIVE_JSON_POINTER.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const d=+u[1];if(s=u[2],s==="#"){if(d>=t)throw new Error(p("property/index",d));return n[t-d]}if(d>t)throw new Error(p("data",d));if(i=r[t-d],!s)return i}let a=i;const l=s.split("/");for(const u of l)u&&(i=(0,codegen_1$n._)`${i}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(u))}`,a=(0,codegen_1$n._)`${a} && ${i}`);return a;function p(u,d){return`Cannot access ${u} ${d} 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:i}=this.opts,a=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let l;e.$async&&(l=a.scopeValue("Error",{ref:validation_error_1.default,code:(0,codegen_1$m._)`require("ajv/dist/runtime/validation_error").default`}));const p=a.scopeName("validate");e.validateName=p;const u={gen:a,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:a.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 d;try{this._compilations.add(e),(0,validate_1$1.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);const $=a.toString();d=`${a.scopeRefs(names_1$2.default.scope)}return ${$}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const R=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,d)(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:$,scopeValues:a._values}),this.opts.unevaluated){const{props:v,items:T}=u;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($){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),$}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 i=resolve.call(this,e,r);if(i===void 0){const a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;a&&(i=new SchemaEnv({schema:a,schemaId:l,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=inlineOrCompile.call(this,i)}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 i=(0,resolve_1.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){const l=resolveSchema.call(this,e,a);return typeof(l==null?void 0:l.schema)!="object"?void 0:getJsonPointer.call(this,r,l)}if(typeof(a==null?void 0:a.schema)=="object"){if(a.validate||compileSchema.call(this,a),i===(0,resolve_1.normalizeId)(t)){const{schema:l}=a,{schemaId:p}=this.opts,u=l[p];return u&&(s=(0,resolve_1.resolveUrl)(this.opts.uriResolver,s,u)),new SchemaEnv({schema:l,schemaId:p,root:e,baseId:s})}return getJsonPointer.call(this,r,a)}}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 u=typeof r=="object"&&r[this.opts.schemaId];!PREVENT_SCOPE_CHANGE.has(l)&&u&&(t=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,u))}let i;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);i=resolveSchema.call(this,n,l)}const{schemaId:a}=this.opts;if(i=i||new SchemaEnv({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}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),m=0;m<f;m++)c[m]=arguments[m];if(c.length>1){c[0]=c[0].slice(0,-1);for(var S=c.length-1,b=1;b<S;++b)c[b]=c[b].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 a(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 m=f;if(c)for(var S in c)m[S]=c[S];return m}function u(f){var c="[A-Za-z]",m="[0-9]",S=n(m,"[A-Fa-f]"),b=s(s("%[EFef]"+S+"%"+S+S+"%"+S+S)+"|"+s("%[89A-Fa-f]"+S+"%"+S+S)+"|"+s("%"+S+S)),U="[\\:\\/\\?\\#\\[\\]\\@]",L="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",J=n(U,L),X=f?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",se=f?"[\\uE000-\\uF8FF]":"[]",B=n(c,m,"[\\-\\.\\_\\~]",X);s(c+n(c,m,"[\\+\\-\\.]")+"*"),s(s(b+"|"+n(B,L,"[\\:]"))+"*");var Q=s(s("25[0-5]")+"|"+s("2[0-4]"+m)+"|"+s("1"+m+m)+"|"+s("0?[1-9]"+m)+"|0?0?"+m),ie=s(Q+"\\."+Q+"\\."+Q+"\\."+Q),V=s(S+"{1,4}"),Y=s(s(V+"\\:"+V)+"|"+ie),ae=s(s(V+"\\:")+"{6}"+Y),ee=s("\\:\\:"+s(V+"\\:")+"{5}"+Y),Ee=s(s(V)+"?\\:\\:"+s(V+"\\:")+"{4}"+Y),$e=s(s(s(V+"\\:")+"{0,1}"+V)+"?\\:\\:"+s(V+"\\:")+"{3}"+Y),ge=s(s(s(V+"\\:")+"{0,2}"+V)+"?\\:\\:"+s(V+"\\:")+"{2}"+Y),Be=s(s(s(V+"\\:")+"{0,3}"+V)+"?\\:\\:"+V+"\\:"+Y),Ie=s(s(s(V+"\\:")+"{0,4}"+V)+"?\\:\\:"+Y),fe=s(s(s(V+"\\:")+"{0,5}"+V)+"?\\:\\:"+V),ye=s(s(s(V+"\\:")+"{0,6}"+V)+"?\\:\\:"),je=s([ae,ee,Ee,$e,ge,Be,Ie,fe,ye].join("|")),we=s(s(B+"|"+b)+"+");s("[vV]"+S+"+\\."+n(B,L,"[\\:]")+"+"),s(s(b+"|"+n(B,L))+"*");var ct=s(b+"|"+n(B,L,"[\\:\\@]"));return s(s(b+"|"+n(B,L,"[\\@]"))+"+"),s(s(ct+"|"+n("[\\/\\?]",se))+"*"),{NOT_SCHEME:new RegExp(n("[^]",c,m,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",B,L),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",B,L),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",B,L),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",B,L),"g"),NOT_QUERY:new RegExp(n("[^\\%]",B,L,"[\\:\\@\\/\\?]",se),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",B,L,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",B,L),"g"),UNRESERVED:new RegExp(B,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",B,J),"g"),PCT_ENCODED:new RegExp(b,"g"),IPV4ADDRESS:new RegExp("^("+ie+")$"),IPV6ADDRESS:new RegExp("^\\[?("+je+")"+s(s("\\%25|\\%(?!"+S+"{2})")+"("+we+")")+"?\\]?$")}}var d=u(!1),$=u(!0),E=function(){function f(c,m){var S=[],b=!0,U=!1,L=void 0;try{for(var J=c[Symbol.iterator](),X;!(b=(X=J.next()).done)&&(S.push(X.value),!(m&&S.length===m));b=!0);}catch(se){U=!0,L=se}finally{try{!b&&J.return&&J.return()}finally{if(U)throw L}}return S}return function(c,m){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return f(c,m);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),R=function(f){if(Array.isArray(f)){for(var c=0,m=Array(f.length);c<f.length;c++)m[c]=f[c];return m}else return Array.from(f)},v=2147483647,T=36,g=1,_=26,k=38,C=700,I=72,A=128,w="-",O=/^xn--/,D=/[^\0-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},re=T-g,K=Math.floor,ue=String.fromCharCode;function oe(f){throw new RangeError(x[f])}function ke(f,c){for(var m=[],S=f.length;S--;)m[S]=c(f[S]);return m}function Ce(f,c){var m=f.split("@"),S="";m.length>1&&(S=m[0]+"@",f=m[1]),f=f.replace(z,".");var b=f.split("."),U=ke(b,c).join(".");return S+U}function qe(f){for(var c=[],m=0,S=f.length;m<S;){var b=f.charCodeAt(m++);if(b>=55296&&b<=56319&&m<S){var U=f.charCodeAt(m++);(U&64512)==56320?c.push(((b&1023)<<10)+(U&1023)+65536):(c.push(b),m--)}else c.push(b)}return c}var et=function(c){return String.fromCodePoint.apply(String,R(c))},Ue=function(c){return c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:T},F=function(c,m){return c+22+75*(c<26)-((m!=0)<<5)},y=function(c,m,S){var b=0;for(c=S?K(c/C):c>>1,c+=K(c/m);c>re*_>>1;b+=T)c=K(c/re);return K(b+(re+1)*c/(c+k))},j=function(c){var m=[],S=c.length,b=0,U=A,L=I,J=c.lastIndexOf(w);J<0&&(J=0);for(var X=0;X<J;++X)c.charCodeAt(X)>=128&&oe("not-basic"),m.push(c.charCodeAt(X));for(var se=J>0?J+1:0;se<S;){for(var B=b,Q=1,ie=T;;ie+=T){se>=S&&oe("invalid-input");var V=Ue(c.charCodeAt(se++));(V>=T||V>K((v-b)/Q))&&oe("overflow"),b+=V*Q;var Y=ie<=L?g:ie>=L+_?_:ie-L;if(V<Y)break;var ae=T-Y;Q>K(v/ae)&&oe("overflow"),Q*=ae}var ee=m.length+1;L=y(b-B,ee,B==0),K(b/ee)>v-U&&oe("overflow"),U+=K(b/ee),b%=ee,m.splice(b++,0,U)}return String.fromCodePoint.apply(String,m)},P=function(c){var m=[];c=qe(c);var S=c.length,b=A,U=0,L=I,J=!0,X=!1,se=void 0;try{for(var B=c[Symbol.iterator](),Q;!(J=(Q=B.next()).done);J=!0){var ie=Q.value;ie<128&&m.push(ue(ie))}}catch(lt){X=!0,se=lt}finally{try{!J&&B.return&&B.return()}finally{if(X)throw se}}var V=m.length,Y=V;for(V&&m.push(w);Y<S;){var ae=v,ee=!0,Ee=!1,$e=void 0;try{for(var ge=c[Symbol.iterator](),Be;!(ee=(Be=ge.next()).done);ee=!0){var Ie=Be.value;Ie>=b&&Ie<ae&&(ae=Ie)}}catch(lt){Ee=!0,$e=lt}finally{try{!ee&&ge.return&&ge.return()}finally{if(Ee)throw $e}}var fe=Y+1;ae-b>K((v-U)/fe)&&oe("overflow"),U+=(ae-b)*fe,b=ae;var ye=!0,je=!1,we=void 0;try{for(var ct=c[Symbol.iterator](),Lt;!(ye=(Lt=ct.next()).done);ye=!0){var Ht=Lt.value;if(Ht<b&&++U>v&&oe("overflow"),Ht==b){for(var pt=U,ft=T;;ft+=T){var ht=ft<=L?g:ft>=L+_?_:ft-L;if(pt<ht)break;var zt=pt-ht,Vt=T-ht;m.push(ue(F(ht+zt%Vt,0))),pt=K(zt/Vt)}m.push(ue(F(pt,0))),L=y(U,fe,Y==V),U=0,++Y}}}catch(lt){je=!0,we=lt}finally{try{!ye&&ct.return&&ct.return()}finally{if(je)throw we}}++U,++b}return m.join("")},o=function(c){return Ce(c,function(m){return O.test(m)?j(m.slice(4).toLowerCase()):m})},h=function(c){return Ce(c,function(m){return D.test(m)?"xn--"+P(m):m})},N={version:"2.1.0",ucs2:{decode:qe,encode:et},decode:j,encode:P,toASCII:h,toUnicode:o},M={};function q(f){var c=f.charCodeAt(0),m=void 0;return c<16?m="%0"+c.toString(16).toUpperCase():c<128?m="%"+c.toString(16).toUpperCase():c<2048?m="%"+(c>>6|192).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase():m="%"+(c>>12|224).toString(16).toUpperCase()+"%"+(c>>6&63|128).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase(),m}function W(f){for(var c="",m=0,S=f.length;m<S;){var b=parseInt(f.substr(m+1,2),16);if(b<128)c+=String.fromCharCode(b),m+=3;else if(b>=194&&b<224){if(S-m>=6){var U=parseInt(f.substr(m+4,2),16);c+=String.fromCharCode((b&31)<<6|U&63)}else c+=f.substr(m,6);m+=6}else if(b>=224){if(S-m>=9){var L=parseInt(f.substr(m+4,2),16),J=parseInt(f.substr(m+7,2),16);c+=String.fromCharCode((b&15)<<12|(L&63)<<6|J&63)}else c+=f.substr(m,9);m+=9}else c+=f.substr(m,3),m+=3}return c}function G(f,c){function m(S){var b=W(S);return b.match(c.UNRESERVED)?b:S}return f.scheme&&(f.scheme=String(f.scheme).replace(c.PCT_ENCODED,m).toLowerCase().replace(c.NOT_SCHEME,"")),f.userinfo!==void 0&&(f.userinfo=String(f.userinfo).replace(c.PCT_ENCODED,m).replace(c.NOT_USERINFO,q).replace(c.PCT_ENCODED,a)),f.host!==void 0&&(f.host=String(f.host).replace(c.PCT_ENCODED,m).toLowerCase().replace(c.NOT_HOST,q).replace(c.PCT_ENCODED,a)),f.path!==void 0&&(f.path=String(f.path).replace(c.PCT_ENCODED,m).replace(f.scheme?c.NOT_PATH:c.NOT_PATH_NOSCHEME,q).replace(c.PCT_ENCODED,a)),f.query!==void 0&&(f.query=String(f.query).replace(c.PCT_ENCODED,m).replace(c.NOT_QUERY,q).replace(c.PCT_ENCODED,a)),f.fragment!==void 0&&(f.fragment=String(f.fragment).replace(c.PCT_ENCODED,m).replace(c.NOT_FRAGMENT,q).replace(c.PCT_ENCODED,a)),f}function ne(f){return f.replace(/^0*(.*)/,"$1")||"0"}function he(f,c){var m=f.match(c.IPV4ADDRESS)||[],S=E(m,2),b=S[1];return b?b.split(".").map(ne).join("."):f}function Le(f,c){var m=f.match(c.IPV6ADDRESS)||[],S=E(m,3),b=S[1],U=S[2];if(b){for(var L=b.toLowerCase().split("::").reverse(),J=E(L,2),X=J[0],se=J[1],B=se?se.split(":").map(ne):[],Q=X.split(":").map(ne),ie=c.IPV4ADDRESS.test(Q[Q.length-1]),V=ie?7:8,Y=Q.length-V,ae=Array(V),ee=0;ee<V;++ee)ae[ee]=B[ee]||Q[Y+ee]||"";ie&&(ae[V-1]=he(ae[V-1],c));var Ee=ae.reduce(function(fe,ye,je){if(!ye||ye==="0"){var we=fe[fe.length-1];we&&we.index+we.length===je?we.length++:fe.push({index:je,length:1})}return fe},[]),$e=Ee.sort(function(fe,ye){return ye.length-fe.length})[0],ge=void 0;if($e&&$e.length>1){var Be=ae.slice(0,$e.index),Ie=ae.slice($e.index+$e.length);ge=Be.join(":")+"::"+Ie.join(":")}else ge=ae.join(":");return U&&(ge+="%"+U),ge}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]:{},m={},S=c.iri!==!1?$:d;c.reference==="suffix"&&(f=(c.scheme?c.scheme+":":"")+"//"+f);var b=f.match(tt);if(b){rt?(m.scheme=b[1],m.userinfo=b[3],m.host=b[4],m.port=parseInt(b[5],10),m.path=b[6]||"",m.query=b[7],m.fragment=b[8],isNaN(m.port)&&(m.port=b[5])):(m.scheme=b[1]||void 0,m.userinfo=f.indexOf("@")!==-1?b[3]:void 0,m.host=f.indexOf("//")!==-1?b[4]:void 0,m.port=parseInt(b[5],10),m.path=b[6]||"",m.query=f.indexOf("?")!==-1?b[7]:void 0,m.fragment=f.indexOf("#")!==-1?b[8]:void 0,isNaN(m.port)&&(m.port=f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?b[4]:void 0)),m.host&&(m.host=Le(he(m.host,S),S)),m.scheme===void 0&&m.userinfo===void 0&&m.host===void 0&&m.port===void 0&&!m.path&&m.query===void 0?m.reference="same-document":m.scheme===void 0?m.reference="relative":m.fragment===void 0?m.reference="absolute":m.reference="uri",c.reference&&c.reference!=="suffix"&&c.reference!==m.reference&&(m.error=m.error||"URI is not a "+c.reference+" reference.");var U=M[(c.scheme||m.scheme||"").toLowerCase()];if(!c.unicodeSupport&&(!U||!U.unicodeSupport)){if(m.host&&(c.domainHost||U&&U.domainHost))try{m.host=N.toASCII(m.host.replace(S.PCT_ENCODED,W).toLowerCase())}catch(L){m.error=m.error||"Host's domain name can not be converted to ASCII via punycode: "+L}G(m,d)}else G(m,S);U&&U.parse&&U.parse(m,c)}else m.error=m.error||"URI can not be parsed.";return m}function nt(f,c){var m=c.iri!==!1?$:d,S=[];return f.userinfo!==void 0&&(S.push(f.userinfo),S.push("@")),f.host!==void 0&&S.push(Le(he(String(f.host),m),m).replace(m.IPV6ADDRESS,function(b,U,L){return"["+U+(L?"%25"+L:"")+"]"})),(typeof f.port=="number"||typeof f.port=="string")&&(S.push(":"),S.push(String(f.port))),S.length?S.join(""):void 0}var He=/^\.\.?\//,ze=/^\/\.(\/|$)/,Ve=/^\/\.\.(\/|$)/,st=/^\/?(?:.|\n)*?(?=\/|$)/;function me(f){for(var c=[];f.length;)if(f.match(He))f=f.replace(He,"");else if(f.match(ze))f=f.replace(ze,"/");else if(f.match(Ve))f=f.replace(Ve,"/"),c.pop();else if(f==="."||f==="..")f="";else{var m=f.match(st);if(m){var S=m[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]:{},m=c.iri?$:d,S=[],b=M[(c.scheme||f.scheme||"").toLowerCase()];if(b&&b.serialize&&b.serialize(f,c),f.host&&!m.IPV6ADDRESS.test(f.host)){if(c.domainHost||b&&b.domainHost)try{f.host=c.iri?N.toUnicode(f.host):N.toASCII(f.host.replace(m.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,m),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 L=f.path;!c.absolutePath&&(!b||!b.absolutePath)&&(L=me(L)),U===void 0&&(L=L.replace(/^\/\//,"/%2F")),S.push(L)}return f.query!==void 0&&(S.push("?"),S.push(f.query)),f.fragment!==void 0&&(S.push("#"),S.push(f.fragment)),S.join("")}function xe(f,c){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=arguments[3],b={};return S||(f=de(le(f,m),m),c=de(le(c,m),m)),m=m||{},!m.tolerant&&c.scheme?(b.scheme=c.scheme,b.userinfo=c.userinfo,b.host=c.host,b.port=c.port,b.path=me(c.path||""),b.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(b.userinfo=c.userinfo,b.host=c.host,b.port=c.port,b.path=me(c.path||""),b.query=c.query):(c.path?(c.path.charAt(0)==="/"?b.path=me(c.path):((f.userinfo!==void 0||f.host!==void 0||f.port!==void 0)&&!f.path?b.path="/"+c.path:f.path?b.path=f.path.slice(0,f.path.lastIndexOf("/")+1)+c.path:b.path=c.path,b.path=me(b.path)),b.query=c.query):(b.path=f.path,c.query!==void 0?b.query=c.query:b.query=f.query),b.userinfo=f.userinfo,b.host=f.host,b.port=f.port),b.scheme=f.scheme),b.fragment=c.fragment,b}function it(f,c,m){var S=p({scheme:"null"},m);return le(xe(de(f,S),de(c,S),S,!0),S)}function Oe(f,c){return typeof f=="string"?f=le(de(f,c),c):i(f)==="object"&&(f=de(le(f,c),c)),f}function ot(f,c,m){return typeof f=="string"?f=le(de(f,m),m):i(f)==="object"&&(f=le(f,m)),typeof c=="string"?c=le(de(c,m),m):i(c)==="object"&&(c=le(c,m)),f===c}function ut(f,c){return f&&f.toString().replace(!c||!c.iri?d.ESCAPE:$.ESCAPE,q)}function pe(f,c){return f&&f.toString().replace(!c||!c.iri?d.PCT_ENCODED:$.PCT_ENCODED,W)}var Ne={scheme:"http",domainHost:!0,parse:function(c,m){return c.host||(c.error=c.error||"HTTP URIs must have a host."),c},serialize:function(c,m){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,m){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,m){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("?"),b=E(S,2),U=b[0],L=b[1];c.path=U&&U!=="/"?U:void 0,c.query=L,c.resourceName=void 0}return c.fragment=void 0,c}},Dt={scheme:"wss",domainHost:at.domainHost,parse:at.parse,serialize:at.serialize},ir={},At="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",_e="[0-9A-Fa-f]",or=s(s("%[EFef]"+_e+"%"+_e+_e+"%"+_e+_e)+"|"+s("%[89A-Fa-f]"+_e+"%"+_e+_e)+"|"+s("%"+_e+_e)),ar="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",cr="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",lr=n(cr,'[\\"\\\\]'),dr="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ur=new RegExp(At,"g"),We=new RegExp(or,"g"),pr=new RegExp(n("[^]",ar,"[\\.]",'[\\"]',lr),"g"),Ft=new RegExp(n("[^]",At,dr),"g"),fr=Ft;function Ot(f){var c=W(f);return c.match(ur)?c:f}var Mt={scheme:"mailto",parse:function(c,m){var S=c,b=S.to=S.path?S.path.split(","):[];if(S.path=void 0,S.query){for(var U=!1,L={},J=S.query.split("&"),X=0,se=J.length;X<se;++X){var B=J[X].split("=");switch(B[0]){case"to":for(var Q=B[1].split(","),ie=0,V=Q.length;ie<V;++ie)b.push(Q[ie]);break;case"subject":S.subject=pe(B[1],m);break;case"body":S.body=pe(B[1],m);break;default:U=!0,L[pe(B[0],m)]=pe(B[1],m);break}}U&&(S.headers=L)}S.query=void 0;for(var Y=0,ae=b.length;Y<ae;++Y){var ee=b[Y].split("@");if(ee[0]=pe(ee[0]),m.unicodeSupport)ee[1]=pe(ee[1],m).toLowerCase();else try{ee[1]=N.toASCII(pe(ee[1],m).toLowerCase())}catch(Ee){S.error=S.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ee}b[Y]=ee.join("@")}return S},serialize:function(c,m){var S=c,b=l(c.to);if(b){for(var U=0,L=b.length;U<L;++U){var J=String(b[U]),X=J.lastIndexOf("@"),se=J.slice(0,X).replace(We,Ot).replace(We,a).replace(pr,q),B=J.slice(X+1);try{B=m.iri?N.toUnicode(B):N.toASCII(pe(B,m).toLowerCase())}catch(Y){S.error=S.error||"Email address's domain name can not be converted to "+(m.iri?"Unicode":"ASCII")+" via punycode: "+Y}b[U]=se+"@"+B}S.path=b.join(",")}var Q=c.headers=c.headers||{};c.subject&&(Q.subject=c.subject),c.body&&(Q.body=c.body);var ie=[];for(var V in Q)Q[V]!==ir[V]&&ie.push(V.replace(We,Ot).replace(We,a).replace(Ft,q)+"="+Q[V].replace(We,Ot).replace(We,a).replace(fr,q));return ie.length&&(S.query=ie.join("&")),S}},hr=/^([^\:]+)\:(.*)/,qt={scheme:"urn",parse:function(c,m){var S=c.path&&c.path.match(hr),b=c;if(S){var U=m.scheme||b.scheme||"urn",L=S[1].toLowerCase(),J=S[2],X=U+":"+(m.nid||L),se=M[X];b.nid=L,b.nss=J,b.path=void 0,se&&(b=se.parse(b,m))}else b.error=b.error||"URN can not be parsed.";return b},serialize:function(c,m){var S=m.scheme||c.scheme||"urn",b=c.nid,U=S+":"+(m.nid||b),L=M[U];L&&(c=L.serialize(c,m));var J=c,X=c.nss;return J.path=(b||m.nid)+":"+X,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,m){var S=c;return S.uuid=S.nss,S.nss=void 0,!m.tolerant&&(!S.uuid||!S.uuid.match(mr))&&(S.error=S.error||"UUID is not valid."),S},serialize:function(c,m){var S=c;return S.nss=(c.uuid||"").toLowerCase(),S}};M[Ne.scheme]=Ne,M[It.scheme]=It,M[at.scheme]=at,M[Dt.scheme]=Dt,M[Mt.scheme]=Mt,M[qt.scheme]=qt,M[Ut.scheme]=Ut,r.SCHEMES=M,r.pctEncChar=q,r.pctDecChars=W,r.parse=de,r.removeDotSegments=me,r.serialize=le,r.resolveComponents=xe,r.resolve=it,r.normalize=Oe,r.equal=ot,r.escapeComponent=ut,r.unescapeComponent=pe,Object.defineProperty(r,"__esModule",{value:!0})})})(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,i=rules,a=compile,l=codegen,p=resolve$1,u=dataType,d=util,$=require$$9,E=uri$1,R=(F,y)=>new RegExp(F,y);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"]),g={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."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},k=200;function C(F){var y,j,P,o,h,N,M,q,W,G,ne,he,Le,tt,rt,de,nt,He,ze,Ve,st,me,le,xe,it;const Oe=F.strict,ot=(y=F.code)===null||y===void 0?void 0:y.optimize,ut=ot===!0||ot===void 0?1:ot||0,pe=(P=(j=F.code)===null||j===void 0?void 0:j.regExp)!==null&&P!==void 0?P:R,Ne=(o=F.uriResolver)!==null&&o!==void 0?o:E.default;return{strictSchema:(N=(h=F.strictSchema)!==null&&h!==void 0?h:Oe)!==null&&N!==void 0?N:!0,strictNumbers:(q=(M=F.strictNumbers)!==null&&M!==void 0?M:Oe)!==null&&q!==void 0?q:!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=(Le=F.strictRequired)!==null&&Le!==void 0?Le: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:(He=F.messages)!==null&&He!==void 0?He:!0,inlineRefs:(ze=F.inlineRefs)!==null&&ze!==void 0?ze:!0,schemaId:(Ve=F.schemaId)!==null&&Ve!==void 0?Ve:"$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:(xe=F.unicodeRegExp)!==null&&xe!==void 0?xe:!0,int32range:(it=F.int32range)!==null&&it!==void 0?it:!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:P}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:T,es5:j,lines:P}),this.logger=K(y.logger);const o=y.validateFormats;y.validateFormats=!1,this.RULES=(0,i.getRules)(),A.call(this,g,y,"NOT SUPPORTED"),A.call(this,_,y,"DEPRECATED","warn"),this._metaOpts=x.call(this),y.formats&&D.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),y.keywords&&z.call(this,y.keywords),typeof y.meta=="object"&&this.addMetaSchema(y.meta),O.call(this),y.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:y,meta:j,schemaId:P}=this.opts;let o=$;P==="id"&&(o={...$},o.id=o.$id,delete o.$id),j&&y&&this.addMetaSchema(o,o[P],!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 P;if(typeof y=="string"){if(P=this.getSchema(y),!P)throw new Error(`no schema with key or ref "${y}"`)}else P=this.compile(y);const o=P(j);return"$async"in P||(this.errors=P.errors),o}compile(y,j){const P=this._addSchema(y,j);return P.validate||this._compileSchemaEnv(P)}compileAsync(y,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:P}=this.opts;return o.call(this,y,j);async function o(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 o.call(this,{$ref:G},!0)}async function N(G){try{return this._compileSchemaEnv(G)}catch(ne){if(!(ne instanceof s.default))throw ne;return M.call(this,ne),await q.call(this,ne.missingSchema),N.call(this,G)}}function M({missingSchema:G,missingRef:ne}){if(this.refs[G])throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`)}async function q(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]=P(G))}finally{delete this._loading[G]}}}addSchema(y,j,P,o=this.opts.validateSchema){if(Array.isArray(y)){for(const N of y)this.addSchema(N,void 0,P,o);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,P,j,o,!0),this}addMetaSchema(y,j,P=this.opts.validateSchema){return this.addSchema(y,j,!0,P),this}validateSchema(y,j){if(typeof y=="boolean")return!0;let P;if(P=y.$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 o=this.validate(P,y);if(!o&&j){const h="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(h);else throw new Error(h)}return o}getSchema(y){let j;for(;typeof(j=w.call(this,y))=="string";)y=j;if(j===void 0){const{schemaId:P}=this.opts,o=new a.SchemaEnv({schema:{},schemaId:P});if(j=a.resolveSchema.call(this,o,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=w.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 P=y[this.opts.schemaId];return P&&(P=(0,p.normalizeId)(P),delete this.schemas[P],delete this.refs[P]),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 P;if(typeof y=="string")P=y,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=P);else if(typeof y=="object"&&j===void 0){if(j=y,P=j.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(oe.call(this,P,j),!j)return(0,d.eachItem)(P,h=>ke.call(this,h)),this;qe.call(this,j);const o={...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)};return(0,d.eachItem)(P,o.type.length===0?h=>ke.call(this,h,o):h=>o.type.forEach(N=>ke.call(this,h,o,N))),this}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 P of j.rules){const o=P.rules.findIndex(h=>h.keyword===y);o>=0&&P.rules.splice(o,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:P="data"}={}){return!y||y.length===0?"No errors":y.map(o=>`${P}${o.instancePath} ${o.message}`).reduce((o,h)=>o+j+h)}$dataMetaSchema(y,j){const P=this.RULES.all;y=JSON.parse(JSON.stringify(y));for(const o of j){const h=o.split("/").slice(1);let N=y;for(const M of h)N=N[M];for(const M in P){const q=P[M];if(typeof q!="object")continue;const{$data:W}=q.definition,G=N[M];W&&G&&(N[M]=Ue(G))}}return y}_removeAllSchemas(y,j){for(const P in y){const o=y[P];(!j||j.test(P))&&(typeof o=="string"?delete y[P]:o&&!o.meta&&(this._cache.delete(o.schema),delete y[P]))}}_addSchema(y,j,P,o=this.opts.validateSchema,h=this.opts.addUsedSchema){let N;const{schemaId:M}=this.opts;if(typeof y=="object")N=y[M];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 q=this._cache.get(y);if(q!==void 0)return q;P=(0,p.normalizeId)(N||P);const W=p.getSchemaRefs.call(this,y,P);return q=new a.SchemaEnv({schema:y,schemaId:M,meta:j,baseId:P,localRefs:W}),this._cache.set(q.schema,q),h&&!P.startsWith("#")&&(P&&this._checkUnique(P),this.refs[P]=q),o&&this.validateSchema(y,!0),q}_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):a.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{a.compileSchema.call(this,y)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function A(F,y,j,P="error"){for(const o in F){const h=o;h in y&&this.logger[P](`${j}: option ${o}. ${F[h]}`)}}function w(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 D(){for(const F in this.opts.formats){const y=this.opts.formats[F];y&&this.addFormat(F,y)}}function z(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 x(){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 oe(F,y){const{RULES:j}=this;if((0,d.eachItem)(F,P=>{if(j.keywords[P])throw new Error(`Keyword ${P} is already defined`);if(!ue.test(P))throw new Error(`Keyword ${P} 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 P;const o=y==null?void 0:y.post;if(j&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:h}=this;let N=o?h.post:h.rules.find(({type:q})=>q===j);if(N||(N={type:j,rules:[]},h.rules.push(N)),h.keywords[F]=!0,!y)return;const M={keyword:F,definition:{...y,type:(0,u.getJSONTypes)(y.type),schemaType:(0,u.getJSONTypes)(y.schemaType)}};y.before?Ce.call(this,N,M,y.before):N.rules.push(M),h.all[F]=M,(P=y.implements)===null||P===void 0||P.forEach(q=>this.addKeyword(q))}function Ce(F,y,j){const P=F.rules.findIndex(o=>o.keyword===j);P>=0?F.rules.splice(P,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=Ue(y)),F.validateSchema=this.compile(y,!0))}const et={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ue(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:i,validateName:a,opts:l,self:p}=n,{root:u}=i;if((r==="#"||r==="#/")&&s===u.baseId)return $();const d=compile_1$1.resolveRef.call(p,u,s,r);if(d===void 0)throw new ref_error_1.default(n.opts.uriResolver,s,r);if(d instanceof compile_1$1.SchemaEnv)return E(d);return R(d);function $(){if(i===u)return callRef(e,a,i,i.$async);const v=t.scopeValue("root",{ref:u});return callRef(e,(0,codegen_1$l._)`${v}.validate`,u,u.$async)}function E(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}),g=t.name("valid"),_=e.subschema({schema:v,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:T,errSchemaPath:r},g);e.mergeEvaluated(_),e.ok(g)}}};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:i}=e,{allErrors:a,schemaEnv:l,opts:p}=i,u=p.passContext?names_1$1.default.this:codegen_1$l.nil;n?d():$();function d(){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,u)}`),R(t),a||s.assign(v,!0)},T=>{s.if((0,codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`,()=>s.throw(T)),E(T),a||s.assign(v,!1)}),e.ok(v)}function $(){e.result((0,code_1$8.callValidateCode)(e,t,u),()=>R(t),()=>E(t))}function E(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(!i.opts.unevaluated)return;const g=(T=r==null?void 0:r.validate)===null||T===void 0?void 0:T.evaluated;if(i.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(i.props=util_1$j.mergeEvaluated.props(s,g.props,i.props));else{const _=s.var("props",(0,codegen_1$l._)`${v}.evaluated.props`);i.props=util_1$j.mergeEvaluated.props(s,_,i.props,codegen_1$l.Name)}if(i.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(i.items=util_1$j.mergeEvaluated.items(s,g.items,i.items));else{const _=s.var("items",(0,codegen_1$l._)`${v}.evaluated.items`);i.items=util_1$j.mergeEvaluated.items(s,_,i.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,i=s.opts.multipleOfPrecision,a=t.let("res"),l=i?(0,codegen_1$j._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,codegen_1$j._)`${a} !== parseInt(${a})`;e.fail$data((0,codegen_1$j._)`(${n} === 0 || (${a} = ${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,i=t==="maxLength"?codegen_1$i.operators.GT:codegen_1$i.operators.LT,a=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._)`${a} ${i} ${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:i}=e,a=i.opts.unicodeRegExp?"u":"",l=r?(0,codegen_1$h._)`(new RegExp(${s}, ${a}))`:(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:i,it:a}=e,{opts:l}=a;if(!i&&r.length===0)return;const p=r.length>=l.loopRequired;if(a.allErrors?u():d(),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 g=a.schemaEnv.baseId+a.errSchemaPath,_=`required property "${T}" is not defined at "${g}" (strictRequired)`;(0,util_1$h.checkStrictMode)(a,_,a.opts.strictRequired)}}function u(){if(p||i)e.block$data(codegen_1$f.nil,$);else for(const R of r)(0,code_1$6.checkReportMissingProp)(e,R)}function d(){const R=t.let("missing");if(p||i){const v=t.let("valid",!0);e.block$data(v,()=>E(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 $(){t.forOf("prop",n,R=>{e.setParams({missingProperty:R}),t.if((0,code_1$6.noPropertyInData)(t,s,R,l.ownProperties),()=>e.error())})}function E(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:i,schemaCode:a,it:l}=e;if(!n&&!s)return;const p=t.let("valid"),u=i.items?(0,dataType_1.getSchemaTypes)(i.items):[];e.block$data(p,d,(0,codegen_1$d._)`${a} === false`),e.ok(p);function d(){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`,()=>($()?E:R)(v,T))}function $(){return u.length>0&&!u.some(v=>v==="object"||v==="array")}function E(v,T){const g=t.name("item"),_=(0,dataType_1.checkDataTypes)(u,g,l.opts.strictNumbers,dataType_1.DataType.Wrong),k=t.const("indices",(0,codegen_1$d._)`{}`);t.for((0,codegen_1$d._)`;${v}--;`,()=>{t.let(g,(0,codegen_1$d._)`${r}[${v}]`),t.if(_,(0,codegen_1$d._)`continue`),u.length>1&&t.if((0,codegen_1$d._)`typeof ${g} == "string"`,(0,codegen_1$d._)`${g} += "_"`),t.if((0,codegen_1$d._)`typeof ${k}[${g}] == "number"`,()=>{t.assign(T,(0,codegen_1$d._)`${k}[${g}]`),e.error(),t.assign(p,!1).break()}).code((0,codegen_1$d._)`${k}[${g}] = ${v}`)})}function R(v,T){const g=(0,util_1$g.useFunc)(t,equal_1$2.default),_=t.name("outer");t.label(_).for((0,codegen_1$d._)`;${v}--;`,()=>t.for((0,codegen_1$d._)`${T} = ${v}; ${T}--;`,()=>t.if((0,codegen_1$d._)`${g}(${r}[${v}], ${r}[${T}])`,()=>{e.error(),t.assign(p,!1).break(_)})))}}};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:i}=e;n||i&&typeof i=="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._)`${i} !== ${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:i,it:a}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const l=s.length>=a.opts.loopEnum;let p;const u=()=>p??(p=(0,util_1$e.useFunc)(t,equal_1.default));let d;if(l||n)d=t.let("valid"),e.block$data(d,$);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const R=t.const("vSchema",i);d=(0,codegen_1$b.or)(...s.map((v,T)=>E(R,T)))}e.pass(d);function $(){t.assign(d,!1),t.forOf("v",i,R=>t.if((0,codegen_1$b._)`${u()}(${r}, ${R})`,()=>t.assign(d,!0).break()))}function E(R,v){const T=s[v];return typeof T=="object"&&T!==null?(0,codegen_1$b._)`${u()}(${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:i,it:a}=e;a.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)(a,n)){const u=r.var("valid",(0,codegen_1$a._)`${l} <= ${t.length}`);r.if((0,codegen_1$a.not)(u),()=>p(u)),e.ok(u)}function p(u){r.forRange("i",t.length,l,d=>{e.subschema({keyword:i,dataProp:d,dataPropType:util_1$d.Type.Num},u),a.allErrors||r.if((0,codegen_1$a.not)(u),()=>r.break())})}}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:i,keyword:a,it:l}=e;d(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"),u=n.const("len",(0,codegen_1$9._)`${i}.length`);r.forEach(($,E)=>{(0,util_1$c.alwaysValidSchema)(l,$)||(n.if((0,codegen_1$9._)`${u} > ${E}`,()=>e.subschema({keyword:a,schemaProp:E,dataProp:E},p)),e.ok(p))});function d($){const{opts:E,errSchemaPath:R}=l,v=r.length,T=v===$.minItems&&(v===$.maxItems||$[t]===!1);if(E.strictTuples&&!T){const g=`"${a}" is ${v}-tuple, but minItems or maxItems/${t} are not specified or different at path "${R}"`;(0,util_1$c.checkStrictMode)(l,g,E.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:i}=e;let a,l;const{minContains:p,maxContains:u}=n;i.opts.next?(a=p===void 0?1:p,l=u):a=1;const d=t.const("len",(0,codegen_1$7._)`${s}.length`);if(e.setParams({min:a,max:l}),l===void 0&&a===0){(0,util_1$a.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&a>l){(0,util_1$a.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,util_1$a.alwaysValidSchema)(i,r)){let T=(0,codegen_1$7._)`${d} >= ${a}`;l!==void 0&&(T=(0,codegen_1$7._)`${T} && ${d} <= ${l}`),e.pass(T);return}i.items=!0;const $=t.name("valid");l===void 0&&a===1?R($,()=>t.if($,()=>t.break())):a===0?(t.let($,!0),l!==void 0&&t.if((0,codegen_1$7._)`${s}.length > 0`,E)):(t.let($,!1),E()),e.result($,()=>e.reset());function E(){const T=t.name("_valid"),g=t.let("count",0);R(T,()=>t.if(T,()=>v(g)))}function R(T,g){t.forRange("i",0,d,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:util_1$a.Type.Num,compositeRule:!0},T),g()})}function v(T){t.code((0,codegen_1$7._)`${T}++`),l===void 0?t.if((0,codegen_1$7._)`${T} >= ${a}`,()=>t.assign($,!0).break()):(t.if((0,codegen_1$7._)`${T} > ${l}`,()=>t.assign($,!1).break()),a===1?t.assign($,!0):t.if((0,codegen_1$7._)`${T} >= ${a}`,()=>t.assign($,!0)))}}};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:u,deps:d}})=>{const $=u===1?"property":"properties";return(0,t.str)`must have ${$} ${d} when property ${p} is present`},params:({params:{property:p,depsCount:u,deps:d,missingProperty:$}})=>(0,t._)`{property: ${p},
|
|
581
|
+
missingProperty: ${$},
|
|
582
|
+
depsCount: ${u},
|
|
583
|
+
deps: ${d}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(p){const[u,d]=i(p);a(p,u),l(p,d)}};function i({schema:p}){const u={},d={};for(const $ in p){if($==="__proto__")continue;const E=Array.isArray(p[$])?u:d;E[$]=p[$]}return[u,d]}function a(p,u=p.schema){const{gen:d,data:$,it:E}=p;if(Object.keys(u).length===0)return;const R=d.let("missing");for(const v in u){const T=u[v];if(T.length===0)continue;const g=(0,n.propertyInData)(d,$,v,E.opts.ownProperties);p.setParams({property:v,depsCount:T.length,deps:T.join(", ")}),E.allErrors?d.if(g,()=>{for(const _ of T)(0,n.checkReportMissingProp)(p,_)}):(d.if((0,t._)`${g} && (${(0,n.checkMissingProp)(p,T,R)})`),(0,n.reportMissingProp)(p,R),d.else())}}e.validatePropertyDeps=a;function l(p,u=p.schema){const{gen:d,data:$,keyword:E,it:R}=p,v=d.name("valid");for(const T in u)(0,r.alwaysValidSchema)(R,u[T])||(d.if((0,n.propertyInData)(d,$,T,R.opts.ownProperties),()=>{const g=p.subschema({keyword:E,schemaProp:T},v);p.mergeValidEvaluated(g,v)},()=>d.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 i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,codegen_1$6.not)(i),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(i)}};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:i,it:a}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:l,opts:p}=a;if(a.props=!0,p.removeAdditional!=="all"&&(0,util_1$8.alwaysValidSchema)(a,r))return;const u=(0,code_1$3.allSchemaProperties)(n.properties),d=(0,code_1$3.allSchemaProperties)(n.patternProperties);$(),e.ok((0,codegen_1$5._)`${i} === ${names_1.default.errors}`);function $(){t.forIn("key",s,g=>{!u.length&&!d.length?v(g):t.if(E(g),()=>v(g))})}function E(g){let _;if(u.length>8){const k=(0,util_1$8.schemaRefOrVal)(a,n.properties,"properties");_=(0,code_1$3.isOwnProperty)(t,k,g)}else u.length?_=(0,codegen_1$5.or)(...u.map(k=>(0,codegen_1$5._)`${g} === ${k}`)):_=codegen_1$5.nil;return d.length&&(_=(0,codegen_1$5.or)(_,...d.map(k=>(0,codegen_1$5._)`${(0,code_1$3.usePattern)(e,k)}.test(${g})`))),(0,codegen_1$5.not)(_)}function R(g){t.code((0,codegen_1$5._)`delete ${s}[${g}]`)}function v(g){if(p.removeAdditional==="all"||p.removeAdditional&&r===!1){R(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),l||t.break();return}if(typeof r=="object"&&!(0,util_1$8.alwaysValidSchema)(a,r)){const _=t.name("valid");p.removeAdditional==="failing"?(T(g,_,!1),t.if((0,codegen_1$5.not)(_),()=>{e.reset(),R(g)})):(T(g,_),l||t.if((0,codegen_1$5.not)(_),()=>t.break()))}}function T(g,_,k){const C={keyword:"additionalProperties",dataProp:g,dataPropType:util_1$8.Type.Str};k===!1&&Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(C,_)}}};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:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i,additionalProperties_1$1.default,"additionalProperties"));const a=(0,code_1$2.allSchemaProperties)(r);for(const $ of a)i.definedProperties.add($);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(a),i.props));const l=a.filter($=>!(0,util_1$7.alwaysValidSchema)(i,r[$]));if(l.length===0)return;const p=t.name("valid");for(const $ of l)u($)?d($):(t.if((0,code_1$2.propertyInData)(t,s,$,i.opts.ownProperties)),d($),i.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add($),e.ok(p);function u($){return i.opts.useDefaults&&!i.compositeRule&&r[$].default!==void 0}function d($){e.subschema({keyword:"properties",schemaProp:$,dataProp:$},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:i}=e,{opts:a}=i,l=(0,code_1$1.allSchemaProperties)(r),p=l.filter(T=>(0,util_1$6.alwaysValidSchema)(i,r[T]));if(l.length===0||p.length===l.length&&(!i.opts.unevaluated||i.props===!0))return;const u=a.strictSchema&&!a.allowMatchingProperties&&s.properties,d=t.name("valid");i.props!==!0&&!(i.props instanceof codegen_1$4.Name)&&(i.props=(0,util_2.evaluatedPropsToName)(t,i.props));const{props:$}=i;E();function E(){for(const T of l)u&&R(T),i.allErrors?v(T):(t.var(d,!0),v(T),t.if(d))}function R(T){for(const g in u)new RegExp(T).test(g)&&(0,util_1$6.checkStrictMode)(i,`property ${g} matches pattern ${T} (use allowMatchingProperties)`)}function v(T){t.forIn("key",n,g=>{t.if((0,codegen_1$4._)`${(0,code_1$1.usePattern)(e,T)}.test(${g})`,()=>{const _=p.includes(T);_||e.subschema({keyword:"patternProperties",schemaProp:T,dataProp:g,dataPropType:util_2.Type.Str},d),i.opts.unevaluated&&$!==!0?t.assign((0,codegen_1$4._)`${$}[${g}]`,!0):!_&&!i.allErrors&&t.if((0,codegen_1$4.not)(d),()=>t.break())})})}}};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 i=r,a=t.let("valid",!1),l=t.let("passing",null),p=t.name("_valid");e.setParams({passing:l}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((d,$)=>{let E;(0,util_1$4.alwaysValidSchema)(s,d)?t.var(p,!0):E=e.subschema({keyword:"oneOf",schemaProp:$,compositeRule:!0},p),$>0&&t.if((0,codegen_1$3._)`${p} && ${a}`).assign(a,!1).assign(l,(0,codegen_1$3._)`[${l}, ${$}]`).else(),t.if(p,()=>{t.assign(a,!0),t.assign(l,$),E&&e.mergeEvaluated(E,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((i,a)=>{if((0,util_1$3.alwaysValidSchema)(n,i))return;const l=e.subschema({keyword:"allOf",schemaProp:a},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"),i=hasSchema(n,"else");if(!s&&!i)return;const a=t.let("valid",!0),l=t.name("_valid");if(p(),e.reset(),s&&i){const d=t.let("ifClause");e.setParams({ifClause:d}),t.if(l,u("then",d),u("else",d))}else s?t.if(l,u("then")):t.if((0,codegen_1$2.not)(l),u("else"));e.pass(a,()=>e.error(!0));function p(){const d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(d)}function u(d,$){return()=>{const E=e.subschema({keyword:d},l);t.assign(a,l),e.mergeValidEvaluated(E,a),$?t.assign($,(0,codegen_1$2._)`${d}`):e.setParams({ifClause:d})}}}};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:i,schemaCode:a,it:l}=e,{opts:p,errSchemaPath:u,schemaEnv:d,self:$}=l;if(!p.validateFormats)return;s?E():R();function E(){const v=r.scopeValue("formats",{ref:$.formats,code:p.code.formats}),T=r.const("fDef",(0,codegen_1$1._)`${v}[${a}]`),g=r.let("fType"),_=r.let("format");r.if((0,codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`,()=>r.assign(g,(0,codegen_1$1._)`${T}.type || "string"`).assign(_,(0,codegen_1$1._)`${T}.validate`),()=>r.assign(g,(0,codegen_1$1._)`"string"`).assign(_,T)),e.fail$data((0,codegen_1$1.or)(k(),C()));function k(){return p.strictSchema===!1?codegen_1$1.nil:(0,codegen_1$1._)`${a} && !${_}`}function C(){const I=d.$async?(0,codegen_1$1._)`(${T}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,codegen_1$1._)`${_}(${n})`,A=(0,codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;return(0,codegen_1$1._)`${_} && ${_} !== true && ${g} === ${t} && !${A}`}}function R(){const v=$.formats[i];if(!v){k();return}if(v===!0)return;const[T,g,_]=C(v);T===t&&e.pass(I());function k(){if(p.strictSchema===!1){$.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function C(A){const w=A instanceof RegExp?(0,codegen_1$1.regexpCode)(A):p.code.formats?(0,codegen_1$1._)`${p.code.formats}${(0,codegen_1$1.getProperty)(i)}`:void 0,O=r.scopeValue("formats",{key:i,ref:A,code:w});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,codegen_1$1._)`${O}.validate`]:["string",A,O]}function I(){if(typeof v=="object"&&!(v instanceof RegExp)&&v.async){if(!d.$async)throw new Error("async format in sync schema");return(0,codegen_1$1._)`await ${_}(${n})`}return typeof g=="function"?(0,codegen_1$1._)`${_}(${n})`:(0,codegen_1$1._)`${_}.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:i}=e,{oneOf:a}=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(!a)throw new Error("discriminator: requires oneOf keyword");const p=t.let("valid",!1),u=t.const("tag",(0,codegen_1._)`${r}${(0,codegen_1.getProperty)(l)}`);t.if((0,codegen_1._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:types_1.DiscrError.Tag,tag:u,tagName:l})),e.ok(p);function d(){const R=E();t.if(!1);for(const v in R)t.elseIf((0,codegen_1._)`${u} === ${v}`),t.assign(p,$(R[v]));t.else(),e.error(!1,{discrError:types_1.DiscrError.Mapping,tag:u,tagName:l}),t.endIf()}function $(R){const v=t.name("valid"),T=e.subschema({keyword:"oneOf",schemaProp:R},v);return e.mergeEvaluated(T,codegen_1.Name),v}function E(){var R;const v={},T=_(s);let g=!0;for(let I=0;I<a.length;I++){let A=a[I];A!=null&&A.$ref&&!(0,util_1.schemaHasRulesButRef)(A,i.self.RULES)&&(A=compile_1.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,A==null?void 0:A.$ref),A instanceof compile_1.SchemaEnv&&(A=A.schema));const w=(R=A==null?void 0:A.properties)===null||R===void 0?void 0:R[l];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);g=g&&(T||_(A)),k(w,I)}if(!g)throw new Error(`discriminator: "${l}" must be required`);return v;function _({required:I}){return Array.isArray(I)&&I.includes(l)}function k(I,A){if(I.const)C(I.const,A);else if(I.enum)for(const w of I.enum)C(w,A);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function C(I,A){if(typeof I!="string"||I in v)throw new Error(`discriminator: "${l}" values must be unique strings`);v[I]=A}}}};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,i=require$$3,a=["/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(i,a):i;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 u=validate;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=codegen;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var $=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return $.default}});var E=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return E.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:"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:
|
|
928
584
|
|
|
929
585
|
- 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.
|
|
930
586
|
- 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.
|
|
931
587
|
This option is only kept in here to avoid breaking Blueprint schema validation
|
|
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,g;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 S=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(...S)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login});const{valid:s,errors:i}=validateBlueprint(e);if(!s){const S=new Error(`Invalid blueprint: ${i[0].message} at ${i[0].instancePath}`);throw S.errors=i,S}const a=e.steps||[],l=a.reduce((S,T)=>{var v;return S+(((v=T.progress)==null?void 0:v.weight)||1)},0),p=a.map(S=>compileStep(S,{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:((g=e.features)==null?void 0:g.networking)??!1},run:async S=>{try{for(const{resources:T}of p)for(const v of T)v.setPlayground(S),v.isAsync&&v.resolve();for(const[T,{run:v,step:R}]of Object.entries(p))try{const $=await v(S);n($,R)}catch($){throw new Error(`Error when executing the blueprint step #${T} (${JSON.stringify(R)}). Inspect the cause of this error for more details`,{cause:$})}}finally{try{await S.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 i of blueprintValidator.errors)i.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(i.instancePath);const n=(s=blueprintValidator.errors)==null?void 0:s.filter(i=>!(i.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(i.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),i={};for(const g of Object.keys(e)){let S=e[g];isFileReference(S)&&(S=Resource.create(S,{semaphore:t})),i[g]=S}const a=async g=>{var S;try{return s.fillSlowly(),await stepHandlers[e.step](g,await resolveArguments(i),{tracker:s,initialCaption:(S=e.progress)==null?void 0:S.caption})}finally{s.finish()}},l=getResources(i),p=getResources(i).filter(g=>g.isAsync),d=1/(p.length+1);for(const g of p)g.progress=s.stage(d);return{run:a,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(){}exports.activatePlugin=activatePlugin;exports.activateTheme=activateTheme;exports.applyWordPressPatches=applyWordPressPatches;exports.compileBlueprint=compileBlueprint;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.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.unzip=unzip;exports.updateUserMeta=updateUserMeta;exports.wpContentFilesExcludedFromExport=wpContentFilesExcludedFromExport;exports.writeFile=writeFile;exports.zipWpContent=zipWpContent;
|
|
588
|
+
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 u,d,$;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 E=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(...E)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login});const{valid:s,errors:i}=validateBlueprint(e);if(!s){const E=new Error(`Invalid blueprint: ${i[0].message} at ${i[0].instancePath}`);throw E.errors=i,E}const a=e.steps||[],l=a.reduce((E,R)=>{var v;return E+(((v=R.progress)==null?void 0:v.weight)||1)},0),p=a.map(E=>compileStep(E,{semaphore:r,rootProgressTracker:t,totalProgressWeight:l}));return{versions:{php:compileVersion((u=e.preferredVersions)==null?void 0:u.php,SupportedPHPVersions,LatestSupportedPHPVersion),wp:((d=e.preferredVersions)==null?void 0:d.wp)||"latest"},phpExtensions:compilePHPExtensions([],e.phpExtensionBundles||[]),features:{networking:(($=e.features)==null?void 0:$.networking)??!1},run:async E=>{try{for(const{resources:R}of p)for(const v of R)v.setPlayground(E),v.isAsync&&v.resolve();for(const[R,{run:v,step:T}]of Object.entries(p))try{const g=await v(E);n(g,T)}catch(g){throw new Error(`Error when executing the blueprint step #${R} (${JSON.stringify(T)}). Inspect the cause of this error for more details`,{cause:g})}}finally{try{await E.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 i of blueprintValidator.errors)i.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(i.instancePath);const n=(s=blueprintValidator.errors)==null?void 0:s.filter(i=>!(i.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(i.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 d;const s=r.stage((((d=e.progress)==null?void 0:d.weight)||1)/n),i={};for(const $ of Object.keys(e)){let E=e[$];isFileReference(E)&&(E=Resource.create(E,{semaphore:t})),i[$]=E}const a=async $=>{var E;try{return s.fillSlowly(),await stepHandlers[e.step]($,await resolveArguments(i),{tracker:s,initialCaption:(E=e.progress)==null?void 0:E.caption})}finally{s.finish()}},l=getResources(i),p=getResources(i).filter($=>$.isAsync),u=1/(p.length+1);for(const $ of p)$.progress=s.stage(u);return{run:a,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(){}exports.activatePlugin=activatePlugin;exports.activateTheme=activateTheme;exports.compileBlueprint=compileBlueprint;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.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.unzip=unzip;exports.updateUserMeta=updateUserMeta;exports.wpContentFilesExcludedFromExport=wpContentFilesExcludedFromExport;exports.writeFile=writeFile;exports.zipWpContent=zipWpContent;
|