@wp-playground/client 0.7.20 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +70 -105
- package/index.d.ts +919 -677
- package/index.js +3250 -3904
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
`):JSON.stringify(e,null,2),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qs=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"}();if(Qs==="NODE"){let e=function(r){return new Promise(function(n,s){r.onload=r.onerror=function(i){r.onload=r.onerror=null,i.type==="load"?n(r.result):s(new Error("Failed to read the blob/file"))}})},t=function(){const r=new Uint8Array([1,2,3,4]),s=new File([r],"test").stream();try{return s.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class r extends Blob{constructor(s,i,o){super(s);let u;o!=null&&o.lastModified&&(u=new Date),(!u||isNaN(u.getFullYear()))&&(u=new Date),this.lastModifiedDate=u,this.lastModified=u.getMilliseconds(),this.name=i||""}}global.File=r}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const n=new FileReader;return n.readAsArrayBuffer(this),e(n)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const n=new FileReader;return n.readAsText(this),e(n)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let r=0;const n=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(s){const i=s.byobRequest.view,u=await n.slice(r,r+i.byteLength).arrayBuffer(),f=new Uint8Array(u);new Uint8Array(i.buffer).set(f);const l=f.byteLength;s.byobRequest.respond(l),r+=l,r>=n.size&&s.close()}})})}if(Qs==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const pn=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/0-playground.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"],Ys=Symbol("SleepFinished");function Io(e){return new Promise(t=>{setTimeout(()=>t(Ys),e)})}class jo extends Error{constructor(){super("Acquiring lock timed out")}}class Ao{constructor({concurrency:t,timeout:r}){this._running=0,this.concurrency=t,this.timeout=r,this.queue=[]}get remaining(){return this.concurrency-this.running}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency){const t=new Promise(r=>{this.queue.push(r)});this.timeout!==void 0?await Promise.race([t,Io(this.timeout)]).then(r=>{if(r===Ys)throw new jo}):await 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 ue(...e){let t=e.join("/");const r=t[0]==="/",n=t.substring(t.length-1)==="/";return t=Xs(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function Zs(e){if(e==="/")return"/";e=Xs(e);const t=e.lastIndexOf("/");return t===-1?"":t===0?"/":e.substr(0,t)}function Xs(e){const t=e[0]==="/";return e=Do(e.split("/").filter(r=>!!r),!t).join("/"),(t?"/":"")+e.replace(/\/$/,"")}function Do(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 ei(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 Mo(){return ei(36,"-_")}function pe(e){return`json_decode(base64_decode('${Lo(JSON.stringify(e))}'), true)`}function Zt(e){const t={};for(const r in e)t[r]=pe(e[r]);return t}function Lo(e){return Fo(new TextEncoder().encode(e))}function Fo(e){const t=String.fromCodePoint(...e);return btoa(t)}const qo="playground-log",$s=(e,...t)=>{ye.dispatchEvent(new CustomEvent(qo,{detail:{log:e,args:t}}))},Uo=(e,...t)=>{switch(typeof e.message=="string"?e.message=rn(e.message):e.message.message&&typeof e.message.message=="string"&&(e.message.message=rn(e.message.message)),e.severity){case"Debug":console.debug(e.message,...t);break;case"Info":console.info(e.message,...t);break;case"Warn":console.warn(e.message,...t);break;case"Error":console.error(e.message,...t);break;case"Fatal":console.error(e.message,...t);break;default:console.log(e.message,...t)}},Vo=e=>e instanceof Error?[e.message,e.stack].join(`
|
|
2
|
+
`):JSON.stringify(e,null,2),ti=[],_s=e=>{ti.push(e)},tn=e=>{if(e.raw===!0)_s(e.message);else{const t=Ho(typeof e.message=="object"?Vo(e.message):e.message,e.severity??"Info",e.prefix??"JavaScript");_s(t)}};class zo extends EventTarget{constructor(t=[]){super(),this.handlers=t,this.fatalErrorEvent="playground-fatal-error"}getLogs(){return this.handlers.includes(tn)?[...ti]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
3
3
|
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
4
|
-
`),[])}logMessage(t,...r){for(const n of this.handlers)n(t,...r)}log(t,...r){this.logMessage({message:t,severity:void 0,prefix:"JavaScript",raw:!1},...r)}debug(t,...r){this.logMessage({message:t,severity:"Debug",prefix:"JavaScript",raw:!1},...r)}info(t,...r){this.logMessage({message:t,severity:"Info",prefix:"JavaScript",raw:!1},...r)}warn(t,...r){this.logMessage({message:t,severity:"Warn",prefix:"JavaScript",raw:!1},...r)}error(t,...r){this.logMessage({message:t,severity:"Error",prefix:"JavaScript",raw:!1},...r)}}const
|
|
4
|
+
`),[])}logMessage(t,...r){for(const n of this.handlers)n(t,...r)}log(t,...r){this.logMessage({message:t,severity:void 0,prefix:"JavaScript",raw:!1},...r)}debug(t,...r){this.logMessage({message:t,severity:"Debug",prefix:"JavaScript",raw:!1},...r)}info(t,...r){this.logMessage({message:t,severity:"Info",prefix:"JavaScript",raw:!1},...r)}warn(t,...r){this.logMessage({message:t,severity:"Warn",prefix:"JavaScript",raw:!1},...r)}error(t,...r){this.logMessage({message:t,severity:"Error",prefix:"JavaScript",raw:!1},...r)}}const Wo=()=>{try{if(process.env.NODE_ENV==="test")return[tn,$s]}catch{}return[tn,Uo,$s]},ye=new zo(Wo()),rn=e=>e.replace(/\t/g,""),Ho=(e,t,r)=>{const n=new Date,s=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),o=s+" "+i;return e=rn(e),`[${o}] ${r} ${t}: ${e}`};let Hr=0;const ws="/wordpress/wp-content/debug.log",xo=async e=>await e.fileExists(ws)?await e.readFileAsText(ws):"",Bo=(e,t)=>{t.addEventListener("request.end",async()=>{const r=await xo(t);if(r.length>Hr){const n=r.substring(Hr);e.logMessage({message:n,raw:!0}),Hr=r.length}}),t.addEventListener("request.error",r=>{r=r,r.error&&(e.logMessage({message:`${r.error.message} ${r.error.stack}`,severity:"Fatal",prefix:r.source==="request"?"PHP":"WASM Crash"}),e.dispatchEvent(new CustomEvent(e.fatalErrorEvent,{detail:{logs:e.getLogs(),source:r.source}})))})},Ar=async(e,{pluginPath:t,pluginName:r},n)=>{n==null||n.tracker.setCaption(`Activating ${r||t}`);const s=await e.documentRoot,i=await e.run({code:`<?php
|
|
5
5
|
define( 'WP_ADMIN', true );
|
|
6
|
-
require_once( ${
|
|
7
|
-
require_once( ${
|
|
6
|
+
require_once( ${pe(s)}. "/wp-load.php" );
|
|
7
|
+
require_once( ${pe(s)}. "/wp-admin/includes/plugin.php" );
|
|
8
8
|
|
|
9
9
|
// Set current user to admin
|
|
10
10
|
wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
|
|
11
11
|
|
|
12
|
-
$plugin_path = ${
|
|
12
|
+
$plugin_path = ${pe(t)};
|
|
13
13
|
$response = false;
|
|
14
14
|
if (!is_dir($plugin_path)) {
|
|
15
15
|
$response = activate_plugin($plugin_path);
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
throw new Exception( 'Unable to activate plugin' );
|
|
36
|
-
`});if(
|
|
36
|
+
`});if(i.text!=="Plugin activated successfully")throw ye.debug(i),new Error(`Plugin ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`)},hn=async(e,{themeFolderName:t},r)=>{r==null||r.tracker.setCaption(`Activating ${t}`);const n=await e.documentRoot,s=`${n}/wp-content/themes/${t}`;if(!await e.fileExists(s))throw new Error(`
|
|
37
37
|
Couldn't activate theme ${t}.
|
|
38
38
|
Theme not found at the provided theme path: ${s}.
|
|
39
39
|
Check the theme path to ensure it's correct.
|
|
40
40
|
If the theme is not installed, you can install it using the installTheme step.
|
|
41
41
|
More info can be found in the Blueprint documentation: https://wordpress.github.io/wordpress-playground/blueprints-api/steps/#ActivateThemeStep
|
|
42
|
-
`);const
|
|
42
|
+
`);const i=await e.run({code:`<?php
|
|
43
43
|
define( 'WP_ADMIN', true );
|
|
44
44
|
require_once( getenv('docroot') . "/wp-load.php" );
|
|
45
45
|
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
throw new Exception( 'Theme ' . getenv('themeFolderName') . ' could not be activated.' );
|
|
53
53
|
}
|
|
54
54
|
die('Theme activated successfully');
|
|
55
|
-
`,env:{docroot:n,themeFolderName:t}});if(
|
|
56
|
-
require_once ${
|
|
55
|
+
`,env:{docroot:n,themeFolderName:t}});if(i.text!=="Theme activated successfully")throw ye.debug(i),new Error(`Theme ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`)},ri=async(e,{code:t})=>await e.run({code:t}),ni=async(e,{options:t})=>await e.run(t),mn=async(e,{path:t})=>{await e.unlink(t)},si=async(e,{sql:t},r)=>{r==null||r.tracker.setCaption("Executing SQL Queries");const n=`/tmp/${Mo()}.sql`;await e.writeFile(n,new Uint8Array(await t.arrayBuffer()));const s=await e.documentRoot,i=Zt({docroot:s,sqlFilename:n}),o=await e.run({code:`<?php
|
|
56
|
+
require_once ${i.docroot} . '/wp-load.php';
|
|
57
57
|
|
|
58
|
-
$handle = fopen(${
|
|
58
|
+
$handle = fopen(${i.sqlFilename}, 'r');
|
|
59
59
|
$buffer = '';
|
|
60
60
|
|
|
61
61
|
global $wpdb;
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
$wpdb->query($buffer);
|
|
72
72
|
$buffer = '';
|
|
73
73
|
}
|
|
74
|
-
`});return await
|
|
74
|
+
`});return await mn(e,{path:n}),o},br=async(e,{request:t})=>{ye.warn('Deprecated: The Blueprint step "request" is deprecated and will be removed in a future release.');const r=await e.request(t);if(r.httpStatusCode>399||r.httpStatusCode<200)throw ye.warn("WordPress response was",{response:r}),new Error(`Request failed with status ${r.httpStatusCode}`);return r},Go=`<?php
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Rewrites the wp-config.php file to ensure specific constants are defined
|
|
@@ -402,33 +402,33 @@ function skip_whitespace($tokens) {
|
|
|
402
402
|
}
|
|
403
403
|
return $output;
|
|
404
404
|
}
|
|
405
|
-
`,
|
|
405
|
+
`,Qt=async(e,{consts:t,method:r="define-before-run"})=>{switch(r){case"define-before-run":await Ko(e,t);break;case"rewrite-wp-config":{const n=await e.documentRoot,s=ue(n,"/wp-config.php"),i=await e.readFileAsText(s),o=await Jo(e,i,t);await e.writeFile(s,o);break}default:throw new Error(`Invalid method: ${r}`)}};async function Ko(e,t){for(const r in t)await e.defineConstant(r,t[r])}async function Jo(e,t,r){await e.writeFile("/tmp/code.php",t);const n=Zt({consts:r});return await e.run({code:`${Go}
|
|
406
406
|
$wp_config_path = '/tmp/code.php';
|
|
407
407
|
$wp_config = file_get_contents($wp_config_path);
|
|
408
408
|
$new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${n.consts});
|
|
409
409
|
file_put_contents($wp_config_path, $new_wp_config);
|
|
410
|
-
`}),await e.readFileAsText("/tmp/code.php")}const
|
|
411
|
-
include ${
|
|
412
|
-
$site_options = ${
|
|
410
|
+
`}),await e.readFileAsText("/tmp/code.php")}const Er=async(e,{username:t="admin",password:r="password"}={},n)=>{var i,o,u;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",body:{log:t,pwd:r,rememberme:"forever"}});if(!((u=(o=(i=s.headers)==null?void 0:i.location)==null?void 0:o[0])!=null&&u.includes("/wp-admin/")))throw ye.warn("WordPress response was",{response:s,text:s.text}),new Error(`Failed to log in as ${t} with password ${r}`)},yn=async(e,{options:t})=>{const r=await e.documentRoot;await e.run({code:`<?php
|
|
411
|
+
include ${pe(r)} . '/wp-load.php';
|
|
412
|
+
$site_options = ${pe(t)};
|
|
413
413
|
foreach($site_options as $name => $value) {
|
|
414
414
|
update_option($name, $value);
|
|
415
415
|
}
|
|
416
416
|
echo "Success";
|
|
417
|
-
`})},
|
|
418
|
-
include ${
|
|
419
|
-
$meta = ${
|
|
417
|
+
`})},ii=async(e,{meta:t,userId:r})=>{const n=await e.documentRoot;await e.run({code:`<?php
|
|
418
|
+
include ${pe(n)} . '/wp-load.php';
|
|
419
|
+
$meta = ${pe(t)};
|
|
420
420
|
foreach($meta as $name => $value) {
|
|
421
|
-
update_user_meta(${
|
|
421
|
+
update_user_meta(${pe(r)}, $name, $value);
|
|
422
422
|
}
|
|
423
|
-
`})};function
|
|
423
|
+
`})};function oi(e){return e.pathname.startsWith("/scope:")}function Qo(e){return oi(e)?e.pathname.split("/")[1].split(":")[1]:null}const ai=async e=>{var b;await Qt(e,{consts:{WP_ALLOW_MULTISITE:1}});const t=new URL(await e.absoluteUrl);if(t.port!==""){let E=`The current host is ${t.host}, but WordPress multisites do not support custom ports.`;throw t.hostname==="localhost"&&(E+=" For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code."),new Error(E)}const r=t.pathname.replace(/\/$/,"")+"/",n=`${t.protocol}//${t.hostname}${r}`;await yn(e,{options:{siteurl:n,home:n}}),await Er(e,{});const s=await e.documentRoot,o=(await e.run({code:`<?php
|
|
424
424
|
define( 'WP_ADMIN', true );
|
|
425
|
-
require_once(${
|
|
425
|
+
require_once(${pe(s)} . "/wp-load.php");
|
|
426
426
|
|
|
427
427
|
// Set current user to admin
|
|
428
428
|
( get_users(array('role' => 'Administrator') )[0] );
|
|
429
429
|
|
|
430
|
-
require_once(${
|
|
431
|
-
$plugins_root = ${
|
|
430
|
+
require_once(${pe(s)} . "/wp-admin/includes/plugin.php");
|
|
431
|
+
$plugins_root = ${pe(s)} . "/wp-content/plugins";
|
|
432
432
|
$plugins = glob($plugins_root . "/*");
|
|
433
433
|
|
|
434
434
|
$deactivated_plugins = [];
|
|
@@ -452,9 +452,9 @@ foreach($plugins as $plugin_path) {
|
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
echo json_encode($deactivated_plugins);
|
|
455
|
-
`})).json,
|
|
456
|
-
$_SERVER['HTTP_HOST'] = ${
|
|
457
|
-
$folder = ${
|
|
455
|
+
`})).json,f=(b=(await br(e,{request:{url:"/wp-admin/network.php"}})).text.match(/name="_wpnonce"\s+value="([^"]+)"/))==null?void 0:b[1],l=await br(e,{request:{url:"/wp-admin/network.php",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Yo({_wpnonce:f,_wp_http_referer:r+"wp-admin/network.php",sitename:"My WordPress Website Sites",email:"admin@localhost.com",submit:"Install"})}});if(l.httpStatusCode!==200)throw ye.warn("WordPress response was",{response:l,text:l.text,headers:l.headers}),new Error(`Failed to enable multisite. Response code was ${l.httpStatusCode}`);await Qt(e,{consts:{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),p=oi(d)?"scope:"+Qo(d):null;await e.writeFile("/internal/shared/preload/sunrise.php",`<?php
|
|
456
|
+
$_SERVER['HTTP_HOST'] = ${pe(d.hostname)};
|
|
457
|
+
$folder = ${pe(p)};
|
|
458
458
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
459
459
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
460
460
|
}
|
|
@@ -462,13 +462,13 @@ echo json_encode($deactivated_plugins);
|
|
|
462
462
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
463
463
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
464
464
|
}
|
|
465
|
-
`),await
|
|
466
|
-
require ${
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
465
|
+
`),await Er(e,{});for(const E of o)await Ar(e,{pluginPath:E})};function Yo(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}const ci=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},li=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},ui=async(e,{path:t})=>{await e.mkdir(t)},di=async(e,{path:t})=>{await e.rmdir(t)},gn=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),t.startsWith("/wordpress/wp-content/mu-plugins")&&!await e.fileExists("/wordpress/wp-content/mu-plugins")&&await e.mkdir("/wordpress/wp-content/mu-plugins"),await e.writeFile(t,r)},$n=async(e,{siteUrl:t})=>{await Qt(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},fi=async(e,{file:t},r)=>{var s;(s=r==null?void 0:r.tracker)==null||s.setCaption("Importing content"),await gn(e,{path:"/tmp/import.wxr",data:t});const n=await e.documentRoot;await e.run({code:`<?php
|
|
466
|
+
require ${pe(n)} . '/wp-load.php';
|
|
467
|
+
require ${pe(n)} . '/wp-admin/includes/admin.php';
|
|
468
|
+
|
|
470
469
|
kses_remove_filters();
|
|
471
|
-
$admin_id = get_users(array('role' => 'Administrator') )[0];
|
|
470
|
+
$admin_id = get_users(array('role' => 'Administrator') )[0]->ID;
|
|
471
|
+
wp_set_current_user( $admin_id );
|
|
472
472
|
$importer = new WXR_Importer( array(
|
|
473
473
|
'fetch_attachments' => true,
|
|
474
474
|
'default_author' => $admin_id
|
|
@@ -482,7 +482,7 @@ echo json_encode($deactivated_plugins);
|
|
|
482
482
|
});
|
|
483
483
|
|
|
484
484
|
$result = $importer->import( '/tmp/import.wxr' );
|
|
485
|
-
`})},
|
|
485
|
+
`})},xr="/tmp/file.zip",Zo=async(e,t,r)=>{if(t instanceof File){const s=t;t=xr,await e.writeFile(t,new Uint8Array(await s.arrayBuffer()))}const n=Zt({zipPath:t,extractToPath:r});await e.run({code:`<?php
|
|
486
486
|
function unzip($zipPath, $extractTo, $overwrite = true)
|
|
487
487
|
{
|
|
488
488
|
if (!is_dir($extractTo)) {
|
|
@@ -499,14 +499,28 @@ echo json_encode($deactivated_plugins);
|
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
unzip(${n.zipPath}, ${n.extractToPath});
|
|
502
|
-
`}),await e.fileExists(
|
|
502
|
+
`}),await e.fileExists(xr)&&await e.unlink(xr)},Dr=async(e,{zipFile:t,zipPath:r,extractToPath:n})=>{if(r)ye.warn('The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.');else if(!t)throw new Error("Either zipPath or zipFile must be provided");await Zo(e,t||r,n)},pi=async(e,{wordPressFilesZip:t,pathInZip:r=""})=>{const n=await e.documentRoot;let s=ue("/tmp","import");await e.mkdir(s),await Dr(e,{zipFile:t,extractToPath:s}),s=ue(s,r);const i=ue(s,"wp-content"),o=ue(n,"wp-content");for(const d of pn){const p=ue(i,d);await vs(e,p);const b=ue(o,d);await e.fileExists(b)&&(await e.mkdir(Zs(p)),await e.mv(b,p))}const u=ue(s,"wp-content","database");await e.fileExists(u)||await e.mv(ue(n,"wp-content","database"),u);const f=await e.listFiles(s);for(const d of f)await vs(e,ue(n,d)),await e.mv(ue(s,d),ue(n,d));await e.rmdir(s),await $n(e,{siteUrl:await e.absoluteUrl});const l=pe(ue(n,"wp-admin","upgrade.php"));await e.run({code:`<?php
|
|
503
503
|
$_GET['step'] = 'upgrade_db';
|
|
504
504
|
require ${l};
|
|
505
|
-
`})};async function
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
505
|
+
`})};async function vs(e,t){await e.fileExists(t)&&(await e.isDir(t)?await e.rmdir(t):await e.unlink(t))}async function hi(e){const t=await e.request({url:"/wp-admin/export.php?download=true&content=all"});return new File([t.bytes],"export.xml")}async function mi(e,{targetPath:t,zipFile:r,ifAlreadyInstalled:n="overwrite"}){const i=r.name.replace(/\.zip$/,""),o=ue(await e.documentRoot,"wp-content"),u=ue(o,ei()),f=ue(u,"assets",i);await e.fileExists(f)&&await e.rmdir(u,{recursive:!0}),await e.mkdir(u);try{await Dr(e,{zipFile:r,extractToPath:f});let l=await e.listFiles(f,{prependPath:!0});l=l.filter(P=>!P.endsWith("/__MACOSX"));const d=l.length===1&&await e.isDir(l[0]);let p,b="";d?(b=l[0],p=l[0].split("/").pop()):(b=f,p=i);const E=`${t}/${p}`;if(await e.fileExists(E)){if(!await e.isDir(E))throw new Error(`Cannot install asset ${p} to ${E} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?`);if(n==="overwrite")await e.rmdir(E,{recursive:!0});else{if(n==="skip")return{assetFolderPath:E,assetFolderName:p};throw new Error(`Cannot install asset ${p} to ${t} because it already exists and the ifAlreadyInstalled option was set to ${n}`)}}return await e.mv(b,E),{assetFolderPath:E,assetFolderName:p}}finally{await e.rmdir(u,{recursive:!0})}}function Mr(e){const t=e.split(".").shift().replace(/-/g," ");return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const yi=async(e,{pluginZipFile:t,ifAlreadyInstalled:r,options:n={}},s)=>{const i=t.name.split("/").pop()||"plugin.zip",o=Mr(i);s==null||s.tracker.setCaption(`Installing the ${o} plugin`);const{assetFolderPath:u}=await mi(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/plugins`});("activate"in n?n.activate:!0)&&await Ar(e,{pluginPath:u,pluginName:o},s)},gi=async(e,{themeZipFile:t,ifAlreadyInstalled:r,options:n={}},s)=>{const i=Mr(t.name);s==null||s.tracker.setCaption(`Installing the ${i} theme`);const{assetFolderName:o}=await mi(e,{ifAlreadyInstalled:r,zipFile:t,targetPath:`${await e.documentRoot}/wp-content/themes`});("activate"in n?n.activate:!0)&&await hn(e,{themeFolderName:o},s)},$i=async(e,t,r)=>{var s;(s=r==null?void 0:r.tracker)==null||s.setCaption("Resetting WordPress data");const n=await e.documentRoot;await e.run({env:{DOCROOT:n},code:`<?php
|
|
506
|
+
require getenv('DOCROOT') . '/wp-load.php';
|
|
507
|
+
|
|
508
|
+
$GLOBALS['@pdo']->query('DELETE FROM wp_posts WHERE id > 0');
|
|
509
|
+
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_posts'");
|
|
510
|
+
|
|
511
|
+
$GLOBALS['@pdo']->query('DELETE FROM wp_postmeta WHERE post_id > 1');
|
|
512
|
+
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=20 WHERE NAME='wp_postmeta'");
|
|
513
|
+
|
|
514
|
+
$GLOBALS['@pdo']->query('DELETE FROM wp_comments');
|
|
515
|
+
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_comments'");
|
|
516
|
+
|
|
517
|
+
$GLOBALS['@pdo']->query('DELETE FROM wp_commentmeta');
|
|
518
|
+
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_commentmeta'");
|
|
519
|
+
`})},_i=async(e,{options:t})=>{await e.request({url:"/wp-admin/install.php?step=2",method:"POST",body:{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"}})},wi=async(e,{selfContained:t=!1}={})=>{const r="/tmp/wordpress-playground.zip",n=await e.documentRoot,s=ue(n,"wp-content");let i=pn;t&&(i=i.filter(f=>!f.startsWith("themes/twenty")).filter(f=>f!=="mu-plugins/sqlite-database-integration"));const o=Zt({zipPath:r,wpContentPath:s,documentRoot:n,exceptPaths:i.map(f=>ue(n,"wp-content",f)),additionalPaths:t?{[ue(n,"wp-config.php")]:"wp-config.php"}:{}});await ea(e,`zipDir(${o.wpContentPath}, ${o.zipPath}, array(
|
|
520
|
+
'exclude_paths' => ${o.exceptPaths},
|
|
521
|
+
'zip_root' => ${o.documentRoot},
|
|
522
|
+
'additional_paths' => ${o.additionalPaths}
|
|
523
|
+
));`);const u=await e.readFileAsBuffer(r);return e.unlink(r),u},Xo=`<?php
|
|
510
524
|
|
|
511
525
|
function zipDir($root, $output, $options = array())
|
|
512
526
|
{
|
|
@@ -565,7 +579,7 @@ function join_paths()
|
|
|
565
579
|
|
|
566
580
|
return preg_replace('#/+#', '/', join('/', $paths));
|
|
567
581
|
}
|
|
568
|
-
`;async function
|
|
582
|
+
`;async function ea(e,t){return await e.run({code:Xo+t})}const vi=async(e,{command:t,wpCliPath:r="/tmp/wp-cli.phar"})=>{if(!await e.fileExists(r))throw new Error(`wp-cli.phar not found at ${r}`);let n;if(typeof t=="string"?(t=t.trim(),n=ta(t)):n=t,n.shift()!=="wp")throw new Error('The first argument must be "wp".');await e.writeFile("/tmp/stdout",""),await e.writeFile("/tmp/stderr",""),await e.writeFile("/wordpress/run-cli.php",`<?php
|
|
569
583
|
// Set up the environment to emulate a shell script
|
|
570
584
|
// call.
|
|
571
585
|
|
|
@@ -578,67 +592,18 @@ function join_paths()
|
|
|
578
592
|
$GLOBALS['argv'] = array_merge([
|
|
579
593
|
"/tmp/wp-cli.phar",
|
|
580
594
|
"--path=/wordpress"
|
|
581
|
-
], ${
|
|
595
|
+
], ${pe(n)});
|
|
582
596
|
|
|
583
597
|
// Provide stdin, stdout, stderr streams outside of
|
|
584
598
|
// the CLI SAPI.
|
|
585
599
|
define('STDIN', fopen('php://stdin', 'rb'));
|
|
586
600
|
define('STDOUT', fopen('php://stdout', 'wb'));
|
|
587
|
-
define('STDERR', fopen('
|
|
588
|
-
|
|
589
|
-
require( ${
|
|
590
|
-
`);const o=await e.run({scriptPath:"/wordpress/run-cli.php"});if(o.errors)throw new Error(o.errors);return o};function splitShellCommand(e){let n=0,s="";const o=[];let i="";for(let c=0;c<e.length;c++){const u=e[c];n===0?u==='"'||u==="'"?(n=1,s=u):u.match(/\s/)?(i&&o.push(i),i=""):i+=u:n===1&&(u==="\\"?(c++,i+=e[c]):u===s?(n=0,s=""):i+=u)}return i&&o.push(i),o}const allStepHandlers=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin,activateTheme,cp,defineSiteUrl,defineWpConfigConsts,enableMultisite,exportWXR,importWordPressFiles,importWxr,installPlugin,installTheme,login,mkdir,mv,request,rm,rmdir,runPHP,runPHPWithOptions,runSql,runWpInstallationWizard,setSiteOptions,unzip,updateUserMeta,wpCLI:wpCLI$1,writeFile,zipWpContent},Symbol.toStringTag,{value:"Module"})),FALLBACK_FILE_SIZE=5*1024*1024;function cloneResponseMonitorProgress(e,t){const r=e.headers.get("content-length")||"",n=parseInt(r,10)||FALLBACK_FILE_SIZE;function s(o,i){t(new CustomEvent("progress",{detail:{loaded:o,total:i}}))}return new Response(new ReadableStream({async start(o){if(!e.body){o.close();return}const i=e.body.getReader();let c=0;for(;;)try{const{done:u,value:l}=await i.read();if(l&&(c+=l.byteLength),u){s(c,c),o.close();break}else s(c,n),o.enqueue(l)}catch(u){logger.error({e:u}),o.error(u);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 responseTexts={500:"Internal Server Error",502:"Bad Gateway",404:"Not Found",403:"Forbidden",401:"Unauthorized",400:"Bad Request",301:"Moved Permanently",302:"Found",307:"Temporary Redirect",308:"Permanent Redirect",204:"No Content",201:"Created",200:"OK"};class PHPResponse{constructor(t,r,n,s="",o=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=o,this.errors=s}static forHttpCode(t,r=""){return new PHPResponse(t,{},new TextEncoder().encode(r||responseTexts[t]||""))}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 FileErrorCodes={0:"No error occurred. System call completed successfully.",1:"Argument list too long.",2:"Permission denied.",3:"Address in use.",4:"Address not available.",5:"Address family not supported.",6:"Resource unavailable, or operation would block.",7:"Connection already in progress.",8:"Bad file descriptor.",9:"Bad message.",10:"Device or resource busy.",11:"Operation canceled.",12:"No child processes.",13:"Connection aborted.",14:"Connection refused.",15:"Connection reset.",16:"Resource deadlock would occur.",17:"Destination address required.",18:"Mathematics argument out of domain of function.",19:"Reserved.",20:"File exists.",21:"Bad address.",22:"File too large.",23:"Host is unreachable.",24:"Identifier removed.",25:"Illegal byte sequence.",26:"Operation in progress.",27:"Interrupted function.",28:"Invalid argument.",29:"I/O error.",30:"Socket is connected.",31:"There is a directory under that path.",32:"Too many levels of symbolic links.",33:"File descriptor value too large.",34:"Too many links.",35:"Message too large.",36:"Reserved.",37:"Filename too long.",38:"Network is down.",39:"Connection aborted by network.",40:"Network unreachable.",41:"Too many files open in system.",42:"No buffer space available.",43:"No such device.",44:"There is no such file or directory OR the parent directory does not exist.",45:"Executable file format error.",46:"No locks available.",47:"Reserved.",48:"Not enough space.",49:"No message of the desired type.",50:"Protocol not available.",51:"No space left on device.",52:"Function not supported.",53:"The socket is not connected.",54:"Not a directory or a symbolic link to a directory.",55:"Directory not empty.",56:"State not recoverable.",57:"Not a socket.",58:"Not supported, or operation not supported on socket.",59:"Inappropriate I/O control operation.",60:"No such device or address.",61:"Value too large to be stored in data type.",62:"Previous owner died.",63:"Operation not permitted.",64:"Broken pipe.",65:"Protocol error.",66:"Protocol not supported.",67:"Protocol wrong type for socket.",68:"Result too large.",69:"Read-only file system.",70:"Invalid seek.",71:"No such process.",72:"Reserved.",73:"Connection timed out.",74:"Text file busy.",75:"Cross-device link.",76:"Extension: Capabilities insufficient."};function getEmscriptenFsError(e){const t=typeof e=="object"?e==null?void 0:e.errno:null;if(t in FileErrorCodes)return FileErrorCodes[t]}function rethrowFileSystemError(e=""){return function(r,n,s){const o=s.value;s.value=function(...i){try{return o.apply(this,i)}catch(c){const u=typeof c=="object"?c==null?void 0:c.errno:null;if(u in FileErrorCodes){const l=FileErrorCodes[u],p=typeof i[0]=="string"?i[0]:null,f=p!==null?e.replaceAll("{path}",p):e;throw new Error(`${f}: ${l}`,{cause:c})}throw c}}}}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"})();const kError=Symbol("error"),kMessage=Symbol("message");class ErrorEvent2 extends Event{constructor(t,r={}){super(t),this[kError]=r.error===void 0?null:r.error,this[kMessage]=r.message===void 0?"":r.message}get error(){return this[kError]}get message(){return this[kMessage]}}Object.defineProperty(ErrorEvent2.prototype,"error",{enumerable:!0});Object.defineProperty(ErrorEvent2.prototype,"message",{enumerable:!0});const ErrorEvent=typeof globalThis.ErrorEvent=="function"?globalThis.ErrorEvent:ErrorEvent2;function isExitCodeZero(e){return e instanceof Error?"exitCode"in e&&(e==null?void 0:e.exitCode)===0||(e==null?void 0:e.name)==="ExitStatus"&&"status"in e&&e.status===0:!1}class UnhandledRejectionsTarget extends EventTarget{constructor(){super(...arguments),this.listenersCount=0}addEventListener(t,r){++this.listenersCount,super.addEventListener(t,r)}removeEventListener(t,r){--this.listenersCount,super.removeEventListener(t,r)}hasListeners(){return this.listenersCount>0}}function improveWASMErrorReporting(e){e.asm={...e.asm};const t=new UnhandledRejectionsTarget;for(const r in e.asm)if(typeof e.asm[r]=="function"){const n=e.asm[r];e.asm[r]=function(...s){var o;try{return n(...s)}catch(i){if(!(i instanceof Error))throw i;const c=clarifyErrorMessage(i,(o=e.lastAsyncifyStackSource)==null?void 0:o.stack);if(e.lastAsyncifyStackSource&&(i.cause=e.lastAsyncifyStackSource),t.hasListeners()){t.dispatchEvent(new ErrorEvent("error",{error:i,message:c}));return}throw isExitCodeZero(i)||showCriticalErrorBox(c),i}}}return t}let functionsMaybeMissingFromAsyncify=[];function getFunctionsMaybeMissingFromAsyncify(){return functionsMaybeMissingFromAsyncify}function clarifyErrorMessage(e,t){if(e.message==="unreachable"){let r=UNREACHABLE_ERROR;t||(r+=`
|
|
591
|
-
|
|
592
|
-
This stack trace is lacking. For a better one initialize
|
|
593
|
-
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
594
|
-
|
|
595
|
-
`),functionsMaybeMissingFromAsyncify=extractPHPFunctionsFromStack(t||e.stack||"");for(const n of functionsMaybeMissingFromAsyncify)r+=` * ${n}
|
|
596
|
-
`;return r}return e.message}const UNREACHABLE_ERROR=`
|
|
597
|
-
"unreachable" WASM instruction executed.
|
|
598
|
-
|
|
599
|
-
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
600
|
-
list when building PHP.wasm.
|
|
601
|
-
|
|
602
|
-
You will need to file a new issue in the WordPress Playground repository
|
|
603
|
-
and paste this error message there:
|
|
604
|
-
|
|
605
|
-
https://github.com/WordPress/wordpress-playground/issues/new
|
|
606
|
-
|
|
607
|
-
If you're a core developer, the typical fix is to:
|
|
608
|
-
|
|
609
|
-
* Isolate a minimal reproduction of the error
|
|
610
|
-
* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
|
|
611
|
-
* Run 'npm run fix-asyncify'
|
|
612
|
-
* Commit the changes, push to the repo, release updated NPM packages
|
|
613
|
-
|
|
614
|
-
Below is a list of all the PHP functions found in the stack trace to
|
|
615
|
-
help with the minimal reproduction. If they're all already listed in
|
|
616
|
-
the Dockerfile, you'll need to trigger this error again with long stack
|
|
617
|
-
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
618
|
-
CLI option:
|
|
619
|
-
|
|
620
|
-
`,redBg="\x1B[41m",bold="\x1B[1m",reset="\x1B[0m",eol="\x1B[K";let logged=!1;function showCriticalErrorBox(e){if(!logged&&(logged=!0,!(e!=null&&e.trim().startsWith("Program terminated with exit")))){logger.log(`${redBg}
|
|
621
|
-
${eol}
|
|
622
|
-
${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
|
|
623
|
-
`))logger.log(`${eol} ${t} `);logger.log(`${reset}`)}}function extractPHPFunctionsFromStack(e){try{const t=e.split(`
|
|
624
|
-
`).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[]}}var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(e,t,r,n)=>{for(var s=n>1?void 0:n?__getOwnPropDesc(t,r):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(n?i(t,r,s):i(s))||s);return n&&s&&__defProp(t,r,s),s};const STRING="string",NUMBER="number",__private__dont__use=Symbol("__private__dont__use");class PHPExecutionFailureError extends Error{constructor(t,r,n){super(t),this.response=r,this.source=n}}const PHP_INI_PATH="/internal/shared/php.ini",AUTO_PREPEND_SCRIPT="/internal/shared/auto_prepend_file.php";var xe,be,Ee,we,Ue,nt,Nt,st,It,ot,jt,it,At,at,Dt,ct,Ft,lt,Mt,dt,Lt,ut,qt,pt,xt,Ze,yt,ft,Ut,ht,Vt,mt,Ht;class BasePHP{constructor(e){oe(this,nt);oe(this,st);oe(this,ot);oe(this,it);oe(this,at);oe(this,ct);oe(this,lt);oe(this,dt);oe(this,ut);oe(this,pt);oe(this,Ze);oe(this,ft);oe(this,ht);oe(this,mt);oe(this,xe,void 0);oe(this,be,void 0);oe(this,Ee,void 0);oe(this,we,void 0);oe(this,Ue,void 0);$e(this,be,!1),$e(this,Ee,null),$e(this,we,new Map),$e(this,Ue,[]),this.semaphore=new Semaphore({concurrency:1}),e!==void 0&&this.initializeRuntime(e)}addEventListener(e,t){ce(this,we).has(e)||ce(this,we).set(e,new Set),ce(this,we).get(e).add(t)}removeEventListener(e,t){var r;(r=ce(this,we).get(e))==null||r.delete(t)}dispatchEvent(e){const t=ce(this,we).get(e.type);if(t)for(const r of t)r(e)}async onMessage(e){ce(this,Ue).push(e)}async setSpawnHandler(handler){typeof handler=="string"&&(handler=createSpawnHandler(eval(handler))),this[__private__dont__use].spawnProcess=handler}get absoluteUrl(){return this.requestHandler.absoluteUrl}get documentRoot(){return this.requestHandler.documentRoot}pathToInternalUrl(e){return this.requestHandler.pathToInternalUrl(e)}internalUrlToPath(e){return this.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,this[__private__dont__use].ccall("wasm_set_phpini_path",null,["string"],[PHP_INI_PATH]),this.fileExists(PHP_INI_PATH)||this.writeFile(PHP_INI_PATH,["auto_prepend_file="+AUTO_PREPEND_SCRIPT,"memory_limit=256M","ignore_repeated_errors = 1","error_reporting = E_ALL","display_errors = 1","html_errors = 1","display_startup_errors = On","log_errors = 1","always_populate_raw_post_data = -1","upload_max_filesize = 2000M","post_max_size = 2000M","disable_functions = curl_exec,curl_multi_exec","allow_url_fopen = Off","allow_url_include = Off","session.save_path = /home/web_user","implicit_flush = 1","output_buffering = 0","max_execution_time = 0","max_input_time = -1"].join(`
|
|
625
|
-
`)),this.fileExists(AUTO_PREPEND_SCRIPT)||this.writeFile(AUTO_PREPEND_SCRIPT,`<?php
|
|
626
|
-
// Define constants set via defineConstant() calls
|
|
627
|
-
if(file_exists('/internal/shared/consts.json')) {
|
|
628
|
-
$consts = json_decode(file_get_contents('/internal/shared/consts.json'), true);
|
|
629
|
-
foreach ($consts as $const => $value) {
|
|
630
|
-
if (!defined($const) && is_scalar($value)) {
|
|
631
|
-
define($const, $value);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
// Preload all the files from /internal/shared/preload
|
|
636
|
-
foreach (glob('/internal/shared/preload/*.php') as $file) {
|
|
637
|
-
require_once $file;
|
|
638
|
-
}
|
|
639
|
-
`),t.onMessage=async r=>{for(const n of ce(this,Ue)){const s=await n(r);if(s)return s}return""},$e(this,Ee,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?");$e(this,xe,e)}chdir(e){this[__private__dont__use].FS.chdir(e)}async request(e){if(logger.warn("PHP.request() is deprecated. Please use new PHPRequestHandler() instead."),!this.requestHandler)throw new Error("No request handler available.");return this.requestHandler.request(e)}async run(e){const t=await this.semaphore.acquire();let r;try{if(ce(this,be)||(ie(this,st,It).call(this),$e(this,be,!0)),e.scriptPath&&!this.fileExists(e.scriptPath))throw new Error(`The script path "${e.scriptPath}" does not exist.`);ie(this,it,At).call(this,e.relativeUri||""),ie(this,dt,Lt).call(this,e.method||"GET");const n=normalizeHeaders(e.headers||{}),s=n.host||"example.com:443",o=ie(this,lt,Mt).call(this,s,e.protocol||"http");ie(this,at,Dt).call(this,s),ie(this,ct,Ft).call(this,o),ie(this,ut,qt).call(this,n),e.body&&(r=ie(this,pt,xt).call(this,e.body)),typeof e.code=="string"?(this.writeFile("/internal/eval.php",e.code),ie(this,Ze,yt).call(this,"/internal/eval.php")):ie(this,Ze,yt).call(this,e.scriptPath||"");const i=ie(this,nt,Nt).call(this,e.$_SERVER,n,o);for(const l in i)ie(this,ft,Ut).call(this,l,i[l]);const c=e.env||{};for(const l in c)ie(this,ht,Vt).call(this,l,c[l]);const u=await ie(this,mt,Ht).call(this);if(u.exitCode!==0){logger.warn("PHP.run() output was:",u.text);const l=new PHPExecutionFailureError(`PHP.run() failed with exit code ${u.exitCode} and the following output: `+u.errors,u,"request");throw logger.error(l),l}return u}catch(n){throw this.dispatchEvent({type:"request.error",error:n,source:n.source??"php-wasm"}),n}finally{try{r&&this[__private__dont__use].free(r)}finally{t(),this.dispatchEvent({type:"request.end"})}}}defineConstant(e,t){let r={};try{r=JSON.parse(this.fileExists("/internal/shared/consts.json")&&this.readFileAsText("/internal/shared/consts.json")||"{}")}catch{}this.writeFile("/internal/shared/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){const r=this[__private__dont__use].FS;try{const n=r.lookupPath(e).node.mount,s=this.fileExists(t)?r.lookupPath(t).node.mount:r.lookupPath(dirname(t)).node.mount;n.mountpoint!==s.mountpoint?(copyRecursive(r,e,t),this.rmdir(e,{recursive:!0})):r.rename(e,t)}catch(n){const s=getEmscriptenFsError(n);throw s?new Error(`Could not move ${e} to ${t}: ${s}`,{cause:n}):n}}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 logger.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,t){const r=this[__private__dont__use].FS;try{this.exit()}catch{}this.initializeRuntime(e),ce(this,xe)&&this.setSapiName(ce(this,xe)),t&©FS(r,this[__private__dont__use].FS,t)}exit(e=0){this.dispatchEvent({type:"runtime.beforedestroy"});try{this[__private__dont__use]._exit(e)}catch{}$e(this,be,!1),$e(this,Ee,null),delete this[__private__dont__use].onMessage,delete this[__private__dont__use]}[Symbol.dispose](){ce(this,be)&&this.exit(0)}}xe=new WeakMap,be=new WeakMap,Ee=new WeakMap,we=new WeakMap,Ue=new WeakMap,nt=new WeakSet,Nt=function(e,t,r){const n={...e||{}};n.HTTPS=n.HTTPS||r===443?"on":"off";for(const s in t){let o="HTTP_";["content-type","content-length"].includes(s.toLowerCase())&&(o=""),n[`${o}${s.toUpperCase().replace(/-/g,"_")}`]=t[s]}return n},st=new WeakSet,It=function(){this[__private__dont__use].ccall("php_wasm_init",null,[],[])},ot=new WeakSet,jt=function(){const e="/internal/headers.json";if(!this.fileExists(e))throw new Error("SAPI Error: Could not find response headers file.");const t=JSON.parse(this.readFileAsText(e)),r={};for(const n of t.headers){if(!n.includes(": "))continue;const s=n.indexOf(": "),o=n.substring(0,s).toLowerCase(),i=n.substring(s+2);o in r||(r[o]=[]),r[o].push(i)}return{headers:r,httpStatusCode:t.status}},it=new WeakSet,At=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])}},at=new WeakSet,Dt=function(e){this[__private__dont__use].ccall("wasm_set_request_host",null,[STRING],[e])},ct=new WeakSet,Ft=function(e){this[__private__dont__use].ccall("wasm_set_request_port",null,[NUMBER],[e])},lt=new WeakSet,Mt=function(e,t){let r;try{r=parseInt(new URL(e).port,10)}catch{}return(!r||isNaN(r)||r===80)&&(r=t==="https"?443:80),r},dt=new WeakSet,Lt=function(e){this[__private__dont__use].ccall("wasm_set_request_method",null,[STRING],[e])},ut=new WeakSet,qt=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)])},pt=new WeakSet,xt=function(e){let t,r;typeof e=="string"?(logger.warn("Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"),r=this[__private__dont__use].lengthBytesUTF8(e),t=r+1):(r=e.byteLength,t=e.byteLength);const n=this[__private__dont__use].malloc(t);if(!n)throw new Error("Could not allocate memory for the request body.");return typeof e=="string"?this[__private__dont__use].stringToUTF8(e,n,t+1):this[__private__dont__use].HEAPU8.set(e,n),this[__private__dont__use].ccall("wasm_set_request_body",null,[NUMBER],[n]),this[__private__dont__use].ccall("wasm_set_content_length",null,[NUMBER],[r]),n},Ze=new WeakSet,yt=function(e){this[__private__dont__use].ccall("wasm_set_path_translated",null,[STRING],[e])},ft=new WeakSet,Ut=function(e,t){this[__private__dont__use].ccall("wasm_add_SERVER_entry",null,[STRING,STRING],[e,t])},ht=new WeakSet,Vt=function(e,t){this[__private__dont__use].ccall("wasm_add_ENV_entry",null,[STRING,STRING],[e,t])},mt=new WeakSet,Ht=async function(){var s;let e,t;try{e=await new Promise((o,i)=>{var u;t=l=>{logger.error(l),logger.error(l.error);const p=new Error("Rethrown");p.cause=l.error,p.betterMessage=l.message,i(p)},(u=ce(this,Ee))==null||u.addEventListener("error",t);const c=this[__private__dont__use].ccall("wasm_sapi_handle_request",NUMBER,[],[],{async:!0});return c instanceof Promise?c.then(o,i):o(c)})}catch(o){for(const l in this)typeof this[l]=="function"&&(this[l]=()=>{throw new Error("PHP runtime has crashed – see the earlier error for details.")});this.functionsMaybeMissingFromAsyncify=getFunctionsMaybeMissingFromAsyncify();const i=o,c="betterMessage"in i?i.betterMessage:i.message,u=new Error(c);throw u.cause=i,logger.error(u),u}finally{(s=ce(this,Ee))==null||s.removeEventListener("error",t)}const{headers:r,httpStatusCode:n}=ie(this,ot,jt).call(this);return new PHPResponse(e===0?n:500,r,this.readFileAsBuffer("/internal/stdout"),this.readFileAsText("/internal/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 copyFS(e,t,r){let n;try{n=e.lookupPath(r)}catch{return}if(!("contents"in n.node))return;if(!e.isDir(n.node.mode)){t.writeFile(r,e.readFile(r));return}t.mkdirTree(r);const s=e.readdir(r).filter(o=>o!=="."&&o!=="..");for(const o of s)copyFS(e,t,joinPaths(r,o))}function copyRecursive(e,t,r){const n=e.lookupPath(t).node;if(e.isDir(n.mode)){e.mkdirTree(r);const s=e.readdir(t).filter(o=>o!=="."&&o!=="..");for(const o of s)copyRecursive(e,joinPaths(t,o),joinPaths(r,o))}else e.writeFile(r,e.readFile(t))}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}const{hasOwnProperty}=Object.prototype,encode=(e,t={})=>{typeof t=="string"&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;const r=t.platform==="win32"?`\r
|
|
601
|
+
define('STDERR', fopen('php://stderr', 'wb'));
|
|
602
|
+
|
|
603
|
+
require( ${pe(r)} );
|
|
604
|
+
`);const i=await e.run({scriptPath:"/wordpress/run-cli.php"});if(i.errors)throw new Error(i.errors);return i};function ta(e){let n=0,s="";const i=[];let o="";for(let u=0;u<e.length;u++){const f=e[u];n===0?f==='"'||f==="'"?(n=1,s=f):f.match(/\s/)?(o&&i.push(o),o=""):o+=f:n===1&&(f==="\\"?(u++,o+=e[u]):f===s?(n=0,s=""):o+=f)}return o&&i.push(o),i}const ra=Object.freeze(Object.defineProperty({__proto__:null,activatePlugin:Ar,activateTheme:hn,cp:ci,defineSiteUrl:$n,defineWpConfigConsts:Qt,enableMultisite:ai,exportWXR:hi,importWordPressFiles:pi,importWxr:fi,installPlugin:yi,installTheme:gi,login:Er,mkdir:ui,mv:li,request:br,resetData:$i,rm:mn,rmdir:di,runPHP:ri,runPHPWithOptions:ni,runSql:si,runWpInstallationWizard:_i,setSiteOptions:yn,unzip:Dr,updateUserMeta:ii,wpCLI:vi,writeFile:gn,zipWpContent:wi},Symbol.toStringTag,{value:"Module"})),na=5*1024*1024;function sa(e,t){const r=e.headers.get("content-length")||"",n=parseInt(r,10)||na;function s(i,o){t(new CustomEvent("progress",{detail:{loaded:i,total:o}}))}return new Response(new ReadableStream({async start(i){if(!e.body){i.close();return}const o=e.body.getReader();let u=0;for(;;)try{const{done:f,value:l}=await o.read();if(l&&(u+=l.byteLength),f){s(u,u),i.close();break}else s(u,n),i.enqueue(l)}catch(f){ye.error({e:f}),i.error(f);break}}}),{status:e.status,statusText:e.statusText,headers:e.headers})}const Br=1e-5;class Lr 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<-Br)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 Lr({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+Br>=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+Br>=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 Pr={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 ia(e){const t=typeof e=="object"?e==null?void 0:e.errno:null;if(t in Pr)return Pr[t]}function Ue(e=""){return function(r,n,s){const i=s.value;s.value=function(...o){try{return i.apply(this,o)}catch(u){const f=typeof u=="object"?u==null?void 0:u.errno:null;if(f in Pr){const l=Pr[f],d=typeof o[1]=="string"?o[1]:null,p=d!==null?e.replaceAll("{path}",d):e;throw new Error(`${p}: ${l}`,{cause:u})}throw u}}}}var oa=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,Ve=(e,t,r,n)=>{for(var s=n>1?void 0:n?aa(t,r):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(n?o(t,r,s):o(s))||s);return n&&s&&oa(t,r,s),s};const ze=class Te{static readFileAsText(t,r){return new TextDecoder().decode(Te.readFileAsBuffer(t,r))}static readFileAsBuffer(t,r){return t.readFile(r)}static writeFile(t,r,n){t.writeFile(r,n)}static unlink(t,r){t.unlink(r)}static mv(t,r,n){try{const s=t.lookupPath(r).node.mount,i=Te.fileExists(t,n)?t.lookupPath(n).node.mount:t.lookupPath(Zs(n)).node.mount;s.mountpoint!==i.mountpoint?(Te.copyRecursive(t,r,n),Te.rmdir(t,r,{recursive:!0})):t.rename(r,n)}catch(s){const i=ia(s);throw i?new Error(`Could not move ${r} to ${n}: ${i}`,{cause:s}):s}}static rmdir(t,r,n={recursive:!0}){n!=null&&n.recursive&&Te.listFiles(t,r).forEach(s=>{const i=`${r}/${s}`;Te.isDir(t,i)?Te.rmdir(t,i,n):Te.unlink(t,i)}),t.rmdir(r)}static listFiles(t,r,n={prependPath:!1}){if(!Te.fileExists(t,r))return[];try{const s=t.readdir(r).filter(i=>i!=="."&&i!=="..");if(n.prependPath){const i=r.replace(/\/$/,"");return s.map(o=>`${i}/${o}`)}return s}catch(s){return ye.error(s,{path:r}),[]}}static isDir(t,r){return Te.fileExists(t,r)?t.isDir(t.lookupPath(r).node.mode):!1}static fileExists(t,r){try{return t.lookupPath(r),!0}catch{return!1}}static mkdir(t,r){t.mkdirTree(r)}static copyRecursive(t,r,n){const s=t.lookupPath(r).node;if(t.isDir(s.mode)){t.mkdirTree(n);const i=t.readdir(r).filter(o=>o!=="."&&o!=="..");for(const o of i)Te.copyRecursive(t,ue(r,o),ue(n,o))}else t.writeFile(n,t.readFile(r))}};Ve([Ue('Could not read "{path}"')],ze,"readFileAsText",1);Ve([Ue('Could not read "{path}"')],ze,"readFileAsBuffer",1);Ve([Ue('Could not write to "{path}"')],ze,"writeFile",1);Ve([Ue('Could not unlink "{path}"')],ze,"unlink",1);Ve([Ue('Could not remove directory "{path}"')],ze,"rmdir",1);Ve([Ue('Could not list files in "{path}"')],ze,"listFiles",1);Ve([Ue('Could not stat "{path}"')],ze,"isDir",1);Ve([Ue('Could not stat "{path}"')],ze,"fileExists",1);Ve([Ue('Could not create directory "{path}"')],ze,"mkdir",1);Ve([Ue('Could not copy files from "{path}"')],ze,"copyRecursive",1);const ca={500:"Internal Server Error",502:"Bad Gateway",404:"Not Found",403:"Forbidden",401:"Unauthorized",400:"Bad Request",301:"Moved Permanently",302:"Found",307:"Temporary Redirect",308:"Permanent Redirect",204:"No Content",201:"Created",200:"OK"};class Sr{constructor(t,r,n,s="",i=0){this.httpStatusCode=t,this.headers=r,this.bytes=n,this.exitCode=i,this.errors=s}static forHttpCode(t,r=""){return new Sr(t,{},new TextEncoder().encode(r||ca[t]||""))}static fromRawData(t){return new Sr(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)}}(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"})();const bs="/internal/shared/php.ini";var la=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ua(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const{hasOwnProperty:Gr}=Object.prototype,nn=(e,t={})=>{typeof t=="string"&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<"u"&&process.platform,t.bracketedArray=t.bracketedArray!==!1;const r=t.platform==="win32"?`\r
|
|
640
605
|
`:`
|
|
641
|
-
`,n=t.whitespace?" = ":"=",s=[],
|
|
606
|
+
`,n=t.whitespace?" = ":"=",s=[],i=t.sort?Object.keys(e).sort():Object.keys(e);let o=0;t.align&&(o=xe(i.filter(l=>e[l]===null||Array.isArray(e[l])||typeof e[l]!="object").map(l=>Array.isArray(e[l])?`${l}[]`:l).concat([""]).reduce((l,d)=>xe(l).length>=xe(d).length?l:d)).length);let u="";const f=t.bracketedArray?"[]":"";for(const l of i){const d=e[l];if(d&&Array.isArray(d))for(const p of d)u+=xe(`${l}${f}`).padEnd(o," ")+n+xe(p)+r;else d&&typeof d=="object"?s.push(l):u+=xe(l).padEnd(o," ")+n+xe(d)+r}t.section&&u.length&&(u="["+xe(t.section)+"]"+(t.newline?r+r:r)+u);for(const l of s){const d=bi(l,".").join("\\."),p=(t.section?t.section+".":"")+d,b=nn(e[l],{...t,section:p});u.length&&b.length&&(u+=r),u+=b}return u};function bi(e,t){var r=0,n=0,s=0,i=[];do if(s=e.indexOf(t,r),s!==-1){if(r=s+t.length,s>0&&e[s-1]==="\\")continue;i.push(e.slice(n,s)),n=s+t.length}while(s!==-1);return i.push(e.slice(n)),i}const Es=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;const r=Object.create(null);let n=r,s=null;const i=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g),u={};for(const l of o){if(!l||l.match(/^\s*[;#]/)||l.match(/^\s*$/))continue;const d=l.match(i);if(!d)continue;if(d[1]!==void 0){if(s=mr(d[1]),s==="__proto__"){n=Object.create(null);continue}n=r[s]=r[s]||Object.create(null);continue}const p=mr(d[2]);let b;t.bracketedArray?b=p.length>2&&p.slice(-2)==="[]":(u[p]=((u==null?void 0:u[p])||0)+1,b=u[p]>1);const E=b?p.slice(0,-2):p;if(E==="__proto__")continue;const P=d[3]?mr(d[4]):!0,O=P==="true"||P==="false"||P==="null"?JSON.parse(P):P;b&&(Gr.call(n,E)?Array.isArray(n[E])||(n[E]=[n[E]]):n[E]=[]),Array.isArray(n[E])?n[E].push(O):n[E]=O}const f=[];for(const l of Object.keys(r)){if(!Gr.call(r,l)||typeof r[l]!="object"||Array.isArray(r[l]))continue;const d=bi(l,".");n=r;const p=d.pop(),b=p.replace(/\\\./g,".");for(const E of d)E!=="__proto__"&&((!Gr.call(n,E)||typeof n[E]!="object")&&(n[E]=Object.create(null)),n=n[E]);n===r&&b===p||(n[b]=r[l],f.push(l))}for(const l of f)delete r[l];return r},Ei=e=>e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"),xe=e=>typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&Ei(e)||e!==e.trim()?JSON.stringify(e):e.split(";").join("\\;").split("#").join("\\#"),mr=e=>{if(e=(e||"").trim(),Ei(e)){e.charAt(0)==="'"&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,r="";for(let n=0,s=e.length;n<s;n++){const i=e.charAt(n);if(t)"\\;#".indexOf(i)!==-1?r+=i:r+="\\"+i,t=!1;else{if(";#".indexOf(i)!==-1)break;i==="\\"?t=!0:r+=i}}return t&&(r+="\\"),r.trim()}return e};var Ps={parse:Es,decode:Es,stringify:nn,encode:nn,safe:xe,unsafe:mr};async function da(e,t){const r=Ps.parse(await e.readFileAsText(bs));for(const[n,s]of Object.entries(t))s==null?delete r[n]:r[n]=s;await e.writeFile(bs,Ps.stringify(r))}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]);const Fr=["8.3","8.2","8.1","8.0","7.4","7.3","7.2","7.1","7.0"],Pi=Fr[0],fa=Fr,Si=["iconv","mbstring","xml-bundle","gd"],Ss={"kitchen-sink":Si,light:[]},pa=["vfs","literal","wordpress.org/themes","wordpress.org/plugins","url"];function ha(e){return e&&typeof e=="object"&&typeof e.resource=="string"&&pa.includes(e.resource)}class ft{static create(t,{semaphore:r,progress:n}){let s;switch(t.resource){case"vfs":s=new ma(t,n);break;case"literal":s=new ya(t,n);break;case"wordpress.org/themes":s=new _a(t,n);break;case"wordpress.org/plugins":s=new wa(t,n);break;case"url":s=new $a(t,n);break;default:throw new Error(`Invalid resource: ${t}`)}return s=new va(s),r&&(s=new ba(s,r)),s}setPlayground(t){this.playground=t}get isAsync(){return!1}}class ma extends ft{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 ya extends ft{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 _n extends ft{constructor(t){super(),this.progress=t}async resolve(){var r,n;(r=this.progress)==null||r.setCaption(this.caption);const t=this.getURL();try{let s=await fetch(t);if(!s.ok)throw new Error(`Could not download "${t}"`);if(s=await sa(s,((n=this.progress)==null?void 0:n.loadingListener)??ga),s.status!==200)throw new Error(`Could not download "${t}"`);return new File([await s.blob()],this.name)}catch(s){throw new Error(`Could not download "${t}".
|
|
642
607
|
Check if the URL is correct and the server is reachable.
|
|
643
608
|
If it is reachable, the server might be blocking the request.
|
|
644
609
|
Check the browser console and network tabs for more information.
|
|
@@ -662,21 +627,21 @@ ${bold} WASM ERROR${reset}${redBg}`);for(const t of e.split(`
|
|
|
662
627
|
https://raw.githubusercontent.com/username/repository/branch/filename
|
|
663
628
|
|
|
664
629
|
Error:
|
|
665
|
-
${s}`)}}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 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(y){if(super(),!e.IDENTIFIER.test(y))throw new Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(y){super(),this._items=typeof y=="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((S,I)=>`${S}${I}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((S,I)=>(I instanceof r&&(S[I.str]=(S[I.str]||0)+1),S),{})}}e._Code=n,e.nil=new n("");function s(_,...y){const S=[_[0]];let I=0;for(;I<y.length;)c(S,y[I]),S.push(_[++I]);return new n(S)}e._=s;const o=new n("+");function i(_,...y){const S=[P(_[0])];let I=0;for(;I<y.length;)S.push(o),c(S,y[I]),S.push(o,P(_[++I]));return u(S),new n(S)}e.str=i;function c(_,y){y instanceof n?_.push(...y._items):y instanceof r?_.push(y):_.push(f(y))}e.addCodeArg=c;function u(_){let y=1;for(;y<_.length-1;){if(_[y]===o){const S=l(_[y-1],_[y+1]);if(S!==void 0){_.splice(y-1,3,S);continue}_[y++]="+"}y++}}function l(_,y){if(y==='""')return _;if(_==='""')return y;if(typeof _=="string")return y instanceof r||_[_.length-1]!=='"'?void 0:typeof y!="string"?`${_.slice(0,-1)}${y}"`:y[0]==='"'?_.slice(0,-1)+y.slice(1):void 0;if(typeof y=="string"&&y[0]==='"'&&!(_ instanceof r))return`"${_}${y.slice(1)}`}function p(_,y){return y.emptyStr()?_:_.emptyStr()?y:i`${_}${y}`}e.strConcat=p;function f(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:P(Array.isArray(_)?_.join(","):_)}function b(_){return new n(P(_))}e.stringify=b;function P(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=P;function E(_){return typeof _=="string"&&e.IDENTIFIER.test(_)?new n(`.${_}`):s`[${_}]`}e.getProperty=E;function C(_){if(typeof _=="string"&&e.IDENTIFIER.test(_))return new n(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}e.getEsmExportName=C;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(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var n;(function(u){u[u.Started=0]="Started",u[u.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:l,parent:p}={}){this._names={},this._prefixes=l,this._parent=p}toName(l){return l instanceof t.Name?l:this.name(l)}name(l){return new t.Name(this._newName(l))}_newName(l){const p=this._names[l]||this._nameGroup(l);return`${l}${p.index++}`}_nameGroup(l){var p,f;if(!((f=(p=this._parent)===null||p===void 0?void 0:p._prefixes)===null||f===void 0)&&f.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}e.Scope=s;class o extends t.Name{constructor(l,p){super(p),this.prefix=l}setValue(l,{property:p,itemIndex:f}){this.value=l,this.scopePath=(0,t._)`.${new t.Name(p)}[${f}]`}}e.ValueScopeName=o;const i=(0,t._)`\n`;class c extends s{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?i:t.nil}}get(){return this._scope}name(l){return new o(l,this._newName(l))}value(l,p){var f;if(p.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const b=this.toName(l),{prefix:P}=b,E=(f=p.key)!==null&&f!==void 0?f:p.ref;let C=this._values[P];if(C){const y=C.get(E);if(y)return y}else C=this._values[P]=new Map;C.set(E,b);const $=this._scope[P]||(this._scope[P]=[]),_=$.length;return $[_]=p.ref,b.setValue(p,{property:P,itemIndex:_}),b}getValue(l,p){const f=this._values[l];if(f)return f.get(p)}scopeRefs(l,p=this._values){return this._reduceValues(p,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${l}${f.scopePath}`})}scopeCode(l=this._values,p,f){return this._reduceValues(l,b=>{if(b.value===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return b.value.code},p,f)}_reduceValues(l,p,f={},b){let P=t.nil;for(const E in l){const C=l[E];if(!C)continue;const $=f[E]=f[E]||new Map;C.forEach(_=>{if($.has(_))return;$.set(_,n.Started);let y=p(_);if(y){const S=this.opts.es5?e.varKinds.var:e.varKinds.const;P=(0,t._)`${P}${S} ${_} = ${y};${this.opts._n}`}else if(y=b==null?void 0:b(_))P=(0,t._)`${P}${y}${this.opts._n}`;else throw new r(_);$.set(_,n.Completed)})}return P}}e.ValueScope=c})(scope);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=code$1,r=scope;var n=code$1;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=scope;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(a,m){return this}}class i extends o{constructor(a,m,N){super(),this.varKind=a,this.name=m,this.rhs=N}render({es5:a,_n:m}){const N=a?r.varKinds.var:this.varKind,M=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${M};`+m}optimizeNames(a,m){if(a[this.name.str])return this.rhs&&(this.rhs=ne(this.rhs,a,m)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends o{constructor(a,m,N){super(),this.lhs=a,this.rhs=m,this.sideEffects=N}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,m){if(!(this.lhs instanceof t.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=ne(this.rhs,a,m),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return de(a,this.rhs)}}class u extends c{constructor(a,m,N,M){super(a,N,M),this.op=m}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}}class l extends o{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}}class p extends o{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}}class f extends o{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}}class b extends o{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,m){return this.code=ne(this.code,a,m),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class P extends o{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((m,N)=>m+N.render(a),"")}optimizeNodes(){const{nodes:a}=this;let m=a.length;for(;m--;){const N=a[m].optimizeNodes();Array.isArray(N)?a.splice(m,1,...N):N?a[m]=N:a.splice(m,1)}return a.length>0?this:void 0}optimizeNames(a,m){const{nodes:N}=this;let M=N.length;for(;M--;){const L=N[M];L.optimizeNames(a,m)||(Se(a,L.names),N.splice(M,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((a,m)=>G(a,m.names),{})}}class E extends P{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class C extends P{}class $ extends E{}$.kind="else";class _ extends E{constructor(a,m){super(m),this.condition=a}render(a){let m=`if(${this.condition})`+super.render(a);return this.else&&(m+="else "+this.else.render(a)),m}optimizeNodes(){super.optimizeNodes();const a=this.condition;if(a===!0)return this.nodes;let m=this.else;if(m){const N=m.optimizeNodes();m=this.else=Array.isArray(N)?new $(N):N}if(m)return a===!1?m instanceof _?m:m.nodes:this.nodes.length?this:new _(Te(a),m instanceof _?[m]:m.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,m){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(a,m),!!(super.optimizeNames(a,m)||this.else))return this.condition=ne(this.condition,a,m),this}get names(){const a=super.names;return de(a,this.condition),this.else&&G(a,this.else.names),a}}_.kind="if";class y extends E{}y.kind="for";class S extends y{constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,m){if(super.optimizeNames(a,m))return this.iteration=ne(this.iteration,a,m),this}get names(){return G(super.names,this.iteration.names)}}class I extends y{constructor(a,m,N,M){super(),this.varKind=a,this.name=m,this.from=N,this.to=M}render(a){const m=a.es5?r.varKinds.var:this.varKind,{name:N,from:M,to:L}=this;return`for(${m} ${N}=${M}; ${N}<${L}; ${N}++)`+super.render(a)}get names(){const a=de(super.names,this.from);return de(a,this.to)}}class D extends y{constructor(a,m,N,M){super(),this.loop=a,this.varKind=m,this.name=N,this.iterable=M}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,m){if(super.optimizeNames(a,m))return this.iterable=ne(this.iterable,a,m),this}get names(){return G(super.names,this.iterable.names)}}class w extends E{constructor(a,m,N){super(),this.name=a,this.args=m,this.async=N}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}w.kind="func";class O extends P{render(a){return"return "+super.render(a)}}O.kind="return";class A extends E{render(a){let m="try"+super.render(a);return this.catch&&(m+=this.catch.render(a)),this.finally&&(m+=this.finally.render(a)),m}optimizeNodes(){var a,m;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(m=this.finally)===null||m===void 0||m.optimizeNodes(),this}optimizeNames(a,m){var N,M;return super.optimizeNames(a,m),(N=this.catch)===null||N===void 0||N.optimizeNames(a,m),(M=this.finally)===null||M===void 0||M.optimizeNames(a,m),this}get names(){const a=super.names;return this.catch&&G(a,this.catch.names),this.finally&&G(a,this.finally.names),a}}class U extends E{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}U.kind="catch";class H extends E{render(a){return"finally"+super.render(a)}}H.kind="finally";class X{constructor(a,m={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...m,_n:m.lines?`
|
|
666
|
-
`:""},this._extScope=a,this._scope=new r.Scope({parent:a}),this._nodes=[new C]}toString(){return this._root.render(this.opts)}name(a){return this._scope.name(a)}scopeName(a){return this._extScope.name(a)}scopeValue(a,m){const N=this._extScope.value(a,m);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(a,m){return this._extScope.getValue(a,m)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,m,N,M){const L=this._scope.toName(m);return N!==void 0&&M&&(this._constants[L.str]=N),this._leafNode(new i(a,L,N)),L}const(a,m,N){return this._def(r.varKinds.const,a,m,N)}let(a,m,N){return this._def(r.varKinds.let,a,m,N)}var(a,m,N){return this._def(r.varKinds.var,a,m,N)}assign(a,m,N){return this._leafNode(new c(a,m,N))}add(a,m){return this._leafNode(new u(a,e.operators.ADD,m))}code(a){return typeof a=="function"?a():a!==t.nil&&this._leafNode(new b(a)),this}object(...a){const m=["{"];for(const[N,M]of a)m.length>1&&m.push(","),m.push(N),(N!==M||this.opts.es5)&&(m.push(":"),(0,t.addCodeArg)(m,M));return m.push("}"),new t._Code(m)}if(a,m,N){if(this._blockNode(new _(a)),m&&N)this.code(m).else().code(N).endIf();else if(m)this.code(m).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new _(a))}else(){return this._elseNode(new $)}endIf(){return this._endBlockNode(_,$)}_for(a,m){return this._blockNode(a),m&&this.code(m).endFor(),this}for(a,m){return this._for(new S(a),m)}forRange(a,m,N,M,L=this.opts.es5?r.varKinds.var:r.varKinds.let){const z=this._scope.toName(a);return this._for(new I(L,z,m,N),()=>M(z))}forOf(a,m,N,M=r.varKinds.const){const L=this._scope.toName(a);if(this.opts.es5){const z=m instanceof t.Name?m:this.var("_arr",m);return this.forRange("_i",0,(0,t._)`${z}.length`,B=>{this.var(L,(0,t._)`${z}[${B}]`),N(L)})}return this._for(new D("of",M,L,m),()=>N(L))}forIn(a,m,N,M=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${m})`,N);const L=this._scope.toName(a);return this._for(new D("in",M,L,m),()=>N(L))}endFor(){return this._endBlockNode(y)}label(a){return this._leafNode(new l(a))}break(a){return this._leafNode(new p(a))}return(a){const m=new O;if(this._blockNode(m),this.code(a),m.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(O)}try(a,m,N){if(!m&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const M=new A;if(this._blockNode(M),this.code(a),m){const L=this.name("e");this._currNode=M.catch=new U(L),m(L)}return N&&(this._currNode=M.finally=new H,this.code(N)),this._endBlockNode(U,H)}throw(a){return this._leafNode(new f(a))}block(a,m){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(m),this}endBlock(a){const m=this._blockStarts.pop();if(m===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-m;if(N<0||a!==void 0&&N!==a)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${a} expected`);return this._nodes.length=m,this}func(a,m=t.nil,N,M){return this._blockNode(new w(a,m,N)),M&&this.code(M).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(a=1){for(;a-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(a){return this._currNode.nodes.push(a),this}_blockNode(a){this._currNode.nodes.push(a),this._nodes.push(a)}_endBlockNode(a,m){const N=this._currNode;if(N instanceof a||m&&N instanceof m)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${m?`${a.kind}/${m.kind}`:a.kind}"`)}_elseNode(a){const m=this._currNode;if(!(m instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=m.else=a,this}get _root(){return this._nodes[0]}get _currNode(){const a=this._nodes;return a[a.length-1]}set _currNode(a){const m=this._nodes;m[m.length-1]=a}}e.CodeGen=X;function G(T,a){for(const m in a)T[m]=(T[m]||0)+(a[m]||0);return T}function de(T,a){return a instanceof t._CodeOrName?G(T,a.names):T}function ne(T,a,m){if(T instanceof t.Name)return N(T);if(!M(T))return T;return new t._Code(T._items.reduce((L,z)=>(z instanceof t.Name&&(z=N(z)),z instanceof t._Code?L.push(...z._items):L.push(z),L),[]));function N(L){const z=m[L.str];return z===void 0||a[L.str]!==1?L:(delete a[L.str],z)}function M(L){return L instanceof t._Code&&L._items.some(z=>z instanceof t.Name&&a[z.str]===1&&m[z.str]!==void 0)}}function Se(T,a){for(const m in a)T[m]=(T[m]||0)-(a[m]||0)}function Te(T){return typeof T=="boolean"||typeof T=="number"||T===null?!T:(0,t._)`!${j(T)}`}e.not=Te;const Ne=v(e.operators.AND);function Ve(...T){return T.reduce(Ne)}e.and=Ve;const Ie=v(e.operators.OR);function F(...T){return T.reduce(Ie)}e.or=F;function v(T){return(a,m)=>a===t.nil?m:m===t.nil?a:(0,t._)`${j(a)} ${T} ${j(m)}`}function j(T){return T instanceof t.Name?T:(0,t._)`(${T})`}})(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 A of w)O[A]=!0;return O}e.toHash=n;function s(w,O){return typeof O=="boolean"?O:Object.keys(O).length===0?!0:(o(w,O),!i(O,w.self.RULES.all))}e.alwaysValidSchema=s;function o(w,O=w.schema){const{opts:A,self:U}=w;if(!A.strictSchema||typeof O=="boolean")return;const H=U.RULES.keywords;for(const X in O)H[X]||D(w,`unknown keyword: "${X}"`)}e.checkUnknownRules=o;function i(w,O){if(typeof w=="boolean")return!w;for(const A in w)if(O[A])return!0;return!1}e.schemaHasRules=i;function c(w,O){if(typeof w=="boolean")return!w;for(const A in w)if(A!=="$ref"&&O.all[A])return!0;return!1}e.schemaHasRulesButRef=c;function u({topSchemaRef:w,schemaPath:O},A,U,H){if(!H){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,t._)`${A}`}return(0,t._)`${w}${O}${(0,t.getProperty)(U)}`}e.schemaRefOrVal=u;function l(w){return b(decodeURIComponent(w))}e.unescapeFragment=l;function p(w){return encodeURIComponent(f(w))}e.escapeFragment=p;function f(w){return typeof w=="number"?`${w}`:w.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=f;function b(w){return w.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=b;function P(w,O){if(Array.isArray(w))for(const A of w)O(A);else O(w)}e.eachItem=P;function E({mergeNames:w,mergeToName:O,mergeValues:A,resultToName:U}){return(H,X,G,de)=>{const ne=G===void 0?X:G instanceof t.Name?(X instanceof t.Name?w(H,X,G):O(H,X,G),G):X instanceof t.Name?(O(H,G,X),X):A(X,G);return de===t.Name&&!(ne instanceof t.Name)?U(H,ne):ne}}e.mergeEvaluated={props:E({mergeNames:(w,O,A)=>w.if((0,t._)`${A} !== true && ${O} !== undefined`,()=>{w.if((0,t._)`${O} === true`,()=>w.assign(A,!0),()=>w.assign(A,(0,t._)`${A} || {}`).code((0,t._)`Object.assign(${A}, ${O})`))}),mergeToName:(w,O,A)=>w.if((0,t._)`${A} !== true`,()=>{O===!0?w.assign(A,!0):(w.assign(A,(0,t._)`${A} || {}`),$(w,A,O))}),mergeValues:(w,O)=>w===!0?!0:{...w,...O},resultToName:C}),items:E({mergeNames:(w,O,A)=>w.if((0,t._)`${A} !== true && ${O} !== undefined`,()=>w.assign(A,(0,t._)`${O} === true ? true : ${A} > ${O} ? ${A} : ${O}`)),mergeToName:(w,O,A)=>w.if((0,t._)`${A} !== true`,()=>w.assign(A,O===!0?!0:(0,t._)`${A} > ${O} ? ${A} : ${O}`)),mergeValues:(w,O)=>w===!0?!0:Math.max(w,O),resultToName:(w,O)=>w.var("items",O)})};function C(w,O){if(O===!0)return w.var("props",!0);const A=w.var("props",(0,t._)`{}`);return O!==void 0&&$(w,A,O),A}e.evaluatedPropsToName=C;function $(w,O,A){Object.keys(A).forEach(U=>w.assign((0,t._)`${O}${(0,t.getProperty)(U)}`,!0))}e.setEvaluated=$;const _={};function y(w,O){return w.scopeValue("func",{ref:O,code:_[O.code]||(_[O.code]=new r._Code(O.code))})}e.useFunc=y;var S;(function(w){w[w.Num=0]="Num",w[w.Str=1]="Str"})(S=e.Type||(e.Type={}));function I(w,O,A){if(w instanceof t.Name){const U=O===S.Num;return A?U?(0,t._)`"[" + ${w} + "]"`:(0,t._)`"['" + ${w} + "']"`:U?(0,t._)`"/" + ${w}`:(0,t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(w).toString():"/"+f(w)}e.getErrorPath=I;function D(w,O,A=w.opts.strictSchema){if(A){if(O=`strict mode: ${O}`,A===!0)throw new Error(O);w.self.logger.warn(O)}}e.checkStrictMode=D})(util);var names$1={};Object.defineProperty(names$1,"__esModule",{value:!0});const codegen_1$t=codegen,names={data:new codegen_1$t.Name("data"),valCxt:new codegen_1$t.Name("valCxt"),instancePath:new codegen_1$t.Name("instancePath"),parentData:new codegen_1$t.Name("parentData"),parentDataProperty:new codegen_1$t.Name("parentDataProperty"),rootData:new codegen_1$t.Name("rootData"),dynamicAnchors:new codegen_1$t.Name("dynamicAnchors"),vErrors:new codegen_1$t.Name("vErrors"),errors:new codegen_1$t.Name("errors"),this:new codegen_1$t.Name("this"),self:new codegen_1$t.Name("self"),scope:new codegen_1$t.Name("scope"),json:new codegen_1$t.Name("json"),jsonPos:new codegen_1$t.Name("jsonPos"),jsonLen:new codegen_1$t.Name("jsonLen"),jsonPart:new codegen_1$t.Name("jsonPart")};names$1.default=names;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=codegen,r=util,n=names$1;e.keywordError={message:({keyword:$})=>(0,t.str)`must pass "${$}" keyword validation`},e.keyword$DataError={message:({keyword:$,schemaType:_})=>_?(0,t.str)`"${$}" keyword must be ${_} ($data)`:(0,t.str)`"${$}" keyword is invalid ($data)`};function s($,_=e.keywordError,y,S){const{it:I}=$,{gen:D,compositeRule:w,allErrors:O}=I,A=f($,_,y);S??(w||O)?u(D,A):l(I,(0,t._)`[${A}]`)}e.reportError=s;function o($,_=e.keywordError,y){const{it:S}=$,{gen:I,compositeRule:D,allErrors:w}=S,O=f($,_,y);u(I,O),D||w||l(S,n.default.vErrors)}e.reportExtraError=o;function i($,_){$.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=i;function c({gen:$,keyword:_,schemaValue:y,data:S,errsCount:I,it:D}){if(I===void 0)throw new Error("ajv implementation error");const w=$.name("err");$.forRange("i",I,n.default.errors,O=>{$.const(w,(0,t._)`${n.default.vErrors}[${O}]`),$.if((0,t._)`${w}.instancePath === undefined`,()=>$.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,D.errorPath))),$.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${D.errSchemaPath}/${_}`),D.opts.verbose&&($.assign((0,t._)`${w}.schema`,y),$.assign((0,t._)`${w}.data`,S))})}e.extendErrors=c;function u($,_){const y=$.const("err",_);$.if((0,t._)`${n.default.vErrors} === null`,()=>$.assign(n.default.vErrors,(0,t._)`[${y}]`),(0,t._)`${n.default.vErrors}.push(${y})`),$.code((0,t._)`${n.default.errors}++`)}function l($,_){const{gen:y,validateName:S,schemaEnv:I}=$;I.$async?y.throw((0,t._)`new ${$.ValidationError}(${_})`):(y.assign((0,t._)`${S}.errors`,_),y.return(!1))}const p={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f($,_,y){const{createErrors:S}=$.it;return S===!1?(0,t._)`{}`:b($,_,y)}function b($,_,y={}){const{gen:S,it:I}=$,D=[P(I,y),E($,y)];return C($,_,D),S.object(...D)}function P({errorPath:$},{instancePath:_}){const y=_?(0,t.str)`${$}${(0,r.getErrorPath)(_,r.Type.Str)}`:$;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,y)]}function E({keyword:$,it:{errSchemaPath:_}},{schemaPath:y,parentSchema:S}){let I=S?_:(0,t.str)`${_}/${$}`;return y&&(I=(0,t.str)`${I}${(0,r.getErrorPath)(y,r.Type.Str)}`),[p.schemaPath,I]}function C($,{params:_,message:y},S){const{keyword:I,data:D,schemaValue:w,it:O}=$,{opts:A,propertyName:U,topSchemaRef:H,schemaPath:X}=O;S.push([p.keyword,I],[p.params,typeof _=="function"?_($):_||(0,t._)`{}`]),A.messages&&S.push([p.message,typeof y=="function"?y($):y]),A.verbose&&S.push([p.schema,w],[p.parentSchema,(0,t._)`${H}${X}`],[n.default.data,D]),U&&S.push([p.propertyName,U])}})(errors);Object.defineProperty(boolSchema,"__esModule",{value:!0});boolSchema.boolOrEmptySchema=boolSchema.topBoolOrEmptySchema=void 0;const errors_1$2=errors,codegen_1$s=codegen,names_1$6=names$1,boolError={message:"boolean schema is false"};function topBoolOrEmptySchema(e){const{gen:t,schema:r,validateName:n}=e;r===!1?falseSchemaError(e,!1):typeof r=="object"&&r.$async===!0?t.return(names_1$6.default.data):(t.assign((0,codegen_1$s._)`${n}.errors`,null),t.return(!0))}boolSchema.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),falseSchemaError(e)):r.var(t,!0)}boolSchema.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(e,t){const{gen:r,data:n}=e,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,errors_1$2.reportError)(s,boolError,void 0,t)}var dataType={},rules={};Object.defineProperty(rules,"__esModule",{value:!0});rules.getRules=rules.isJSONType=void 0;const _jsonTypes=["string","number","integer","boolean","null","object","array"],jsonTypes=new Set(_jsonTypes);function isJSONType(e){return typeof e=="string"&&jsonTypes.has(e)}rules.isJSONType=isJSONType;function getRules(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}rules.getRules=getRules;var applicability={};Object.defineProperty(applicability,"__esModule",{value:!0});applicability.shouldUseRule=applicability.shouldUseGroup=applicability.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&shouldUseGroup(e,n)}applicability.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(e,t){return t.rules.some(r=>shouldUseRule(e,r))}applicability.shouldUseGroup=shouldUseGroup;function shouldUseRule(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}applicability.shouldUseRule=shouldUseRule;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;const t=rules,r=applicability,n=errors,s=codegen,o=util;var i;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(i=e.DataType||(e.DataType={}));function c(S){const I=u(S.type);if(I.includes("null")){if(S.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!I.length&&S.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');S.nullable===!0&&I.push("null")}return I}e.getSchemaTypes=c;function u(S){const I=Array.isArray(S)?S:S?[S]:[];if(I.every(t.isJSONType))return I;throw new Error("type must be JSONType or JSONType[]: "+I.join(","))}e.getJSONTypes=u;function l(S,I){const{gen:D,data:w,opts:O}=S,A=f(I,O.coerceTypes),U=I.length>0&&!(A.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(S,I[0]));if(U){const H=C(I,w,O.strictNumbers,i.Wrong);D.if(H,()=>{A.length?b(S,I,A):_(S)})}return U}e.coerceAndCheckDataType=l;const p=new Set(["string","number","integer","boolean","null"]);function f(S,I){return I?S.filter(D=>p.has(D)||I==="array"&&D==="array"):[]}function b(S,I,D){const{gen:w,data:O,opts:A}=S,U=w.let("dataType",(0,s._)`typeof ${O}`),H=w.let("coerced",(0,s._)`undefined`);A.coerceTypes==="array"&&w.if((0,s._)`${U} == 'object' && Array.isArray(${O}) && ${O}.length == 1`,()=>w.assign(O,(0,s._)`${O}[0]`).assign(U,(0,s._)`typeof ${O}`).if(C(I,O,A.strictNumbers),()=>w.assign(H,O))),w.if((0,s._)`${H} !== undefined`);for(const G of D)(p.has(G)||G==="array"&&A.coerceTypes==="array")&&X(G);w.else(),_(S),w.endIf(),w.if((0,s._)`${H} !== undefined`,()=>{w.assign(O,H),P(S,H)});function X(G){switch(G){case"string":w.elseIf((0,s._)`${U} == "number" || ${U} == "boolean"`).assign(H,(0,s._)`"" + ${O}`).elseIf((0,s._)`${O} === null`).assign(H,(0,s._)`""`);return;case"number":w.elseIf((0,s._)`${U} == "boolean" || ${O} === null
|
|
667
|
-
|| (${
|
|
668
|
-
|| (${
|
|
669
|
-
|| ${U} === "boolean" || ${O} === null`).assign(H,(0,s._)`[${O}]`)}}}function P({gen:S,parentData:I,parentDataProperty:D},w){S.if((0,s._)`${I} !== undefined`,()=>S.assign((0,s._)`${I}[${D}]`,w))}function E(S,I,D,w=i.Correct){const O=w===i.Correct?s.operators.EQ:s.operators.NEQ;let A;switch(S){case"null":return(0,s._)`${I} ${O} null`;case"array":A=(0,s._)`Array.isArray(${I})`;break;case"object":A=(0,s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":A=U((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":A=U();break;default:return(0,s._)`typeof ${I} ${O} ${S}`}return w===i.Correct?A:(0,s.not)(A);function U(H=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,H,D?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=E;function C(S,I,D,w){if(S.length===1)return E(S[0],I,D,w);let O;const A=(0,o.toHash)(S);if(A.array&&A.object){const U=(0,s._)`typeof ${I} != "object"`;O=A.null?U:(0,s._)`!${I} || ${U}`,delete A.null,delete A.array,delete A.object}else O=s.nil;A.number&&delete A.integer;for(const U in A)O=(0,s.and)(O,E(U,I,D,w));return O}e.checkDataTypes=C;const $={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:I})=>typeof S=="string"?(0,s._)`{type: ${S}}`:(0,s._)`{type: ${I}}`};function _(S){const I=y(S);(0,n.reportError)(I,$)}e.reportTypeError=_;function y(S){const{gen:I,data:D,schema:w}=S,O=(0,o.schemaRefOrVal)(S,w,"type");return{gen:I,keyword:"type",data:D,schema:w.type,schemaCode:O,schemaValue:O,parentSchema:w,params:{},it:S}}})(dataType);var defaults={};Object.defineProperty(defaults,"__esModule",{value:!0});defaults.assignDefaults=void 0;const codegen_1$r=codegen,util_1$p=util;function assignDefaults(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)assignDefault(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>assignDefault(e,o,s.default))}defaults.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:s,data:o,opts:i}=e;if(r===void 0)return;const c=(0,codegen_1$r._)`${o}${(0,codegen_1$r.getProperty)(t)}`;if(s){(0,util_1$p.checkStrictMode)(e,`default is ignored for: ${c}`);return}let u=(0,codegen_1$r._)`${c} === undefined`;i.useDefaults==="empty"&&(u=(0,codegen_1$r._)`${u} || ${c} === null || ${c} === ""`),n.if(u,(0,codegen_1$r._)`${c} = ${(0,codegen_1$r.stringify)(r)}`)}var keyword={},code={};Object.defineProperty(code,"__esModule",{value:!0});code.validateUnion=code.validateArray=code.usePattern=code.callValidateCode=code.schemaProperties=code.allSchemaProperties=code.noPropertyInData=code.propertyInData=code.isOwnProperty=code.hasPropFunc=code.reportMissingProp=code.checkMissingProp=code.checkReportMissingProp=void 0;const codegen_1$q=codegen,util_1$o=util,names_1$5=names$1,util_2$1=util;function checkReportMissingProp(e,t){const{gen:r,data:n,it:s}=e;r.if(noPropertyInData(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,codegen_1$q._)`${t}`},!0),e.error()})}code.checkReportMissingProp=checkReportMissingProp;function checkMissingProp({gen:e,data:t,it:{opts:r}},n,s){return(0,codegen_1$q.or)(...n.map(o=>(0,codegen_1$q.and)(noPropertyInData(e,t,o,r.ownProperties),(0,codegen_1$q._)`${s} = ${o}`)))}code.checkMissingProp=checkMissingProp;function reportMissingProp(e,t){e.setParams({missingProperty:t},!0),e.error()}code.reportMissingProp=reportMissingProp;function hasPropFunc(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,codegen_1$q._)`Object.prototype.hasOwnProperty`})}code.hasPropFunc=hasPropFunc;function isOwnProperty(e,t,r){return(0,codegen_1$q._)`${hasPropFunc(e)}.call(${t}, ${r})`}code.isOwnProperty=isOwnProperty;function propertyInData(e,t,r,n){const s=(0,codegen_1$q._)`${t}${(0,codegen_1$q.getProperty)(r)} !== undefined`;return n?(0,codegen_1$q._)`${s} && ${isOwnProperty(e,t,r)}`:s}code.propertyInData=propertyInData;function noPropertyInData(e,t,r,n){const s=(0,codegen_1$q._)`${t}${(0,codegen_1$q.getProperty)(r)} === undefined`;return n?(0,codegen_1$q.or)(s,(0,codegen_1$q.not)(isOwnProperty(e,t,r))):s}code.noPropertyInData=noPropertyInData;function allSchemaProperties(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}code.allSchemaProperties=allSchemaProperties;function schemaProperties(e,t){return allSchemaProperties(t).filter(r=>!(0,util_1$o.alwaysValidSchema)(e,t[r]))}code.schemaProperties=schemaProperties;function callValidateCode({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},c,u,l){const p=l?(0,codegen_1$q._)`${e}, ${t}, ${n}${s}`:t,f=[[names_1$5.default.instancePath,(0,codegen_1$q.strConcat)(names_1$5.default.instancePath,o)],[names_1$5.default.parentData,i.parentData],[names_1$5.default.parentDataProperty,i.parentDataProperty],[names_1$5.default.rootData,names_1$5.default.rootData]];i.opts.dynamicRef&&f.push([names_1$5.default.dynamicAnchors,names_1$5.default.dynamicAnchors]);const b=(0,codegen_1$q._)`${p}, ${r.object(...f)}`;return u!==codegen_1$q.nil?(0,codegen_1$q._)`${c}.call(${u}, ${b})`:(0,codegen_1$q._)`${c}(${b})`}code.callValidateCode=callValidateCode;const newRegExp=(0,codegen_1$q._)`new RegExp`;function usePattern({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,codegen_1$q._)`${s.code==="new RegExp"?newRegExp:(0,util_2$1.useFunc)(e,s)}(${r}, ${n})`})}code.usePattern=usePattern;function validateArray(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const c=t.let("valid",!0);return i(()=>t.assign(c,!1)),c}return t.var(o,!0),i(()=>t.break()),o;function i(c){const u=t.const("len",(0,codegen_1$q._)`${r}.length`);t.forRange("i",0,u,l=>{e.subschema({keyword:n,dataProp:l,dataPropType:util_1$o.Type.Num},o),t.if((0,codegen_1$q.not)(o),c)})}}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(u=>(0,util_1$o.alwaysValidSchema)(s,u))&&!s.opts.unevaluated)return;const i=t.let("valid",!1),c=t.name("_valid");t.block(()=>r.forEach((u,l)=>{const p=e.subschema({keyword:n,schemaProp:l,compositeRule:!0},c);t.assign(i,(0,codegen_1$q._)`${i} || ${c}`),e.mergeValidEvaluated(p,c)||t.if((0,codegen_1$q.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}code.validateUnion=validateUnion;Object.defineProperty(keyword,"__esModule",{value:!0});keyword.validateKeywordUsage=keyword.validSchemaType=keyword.funcKeywordCode=keyword.macroKeywordCode=void 0;const codegen_1$p=codegen,names_1$4=names$1,code_1$9=code,errors_1$1=errors;function macroKeywordCode(e,t){const{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=e,c=t.macro.call(i.self,s,o,i),u=useKeyword(r,n,c);i.opts.validateSchema!==!1&&i.self.validateSchema(c,!0);const l=r.name("valid");e.subschema({schema:c,schemaPath:codegen_1$p.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}keyword.macroKeywordCode=macroKeywordCode;function funcKeywordCode(e,t){var r;const{gen:n,keyword:s,schema:o,parentSchema:i,$data:c,it:u}=e;checkAsyncKeyword(u,t);const l=!c&&t.compile?t.compile.call(u.self,o,i,u):t.validate,p=useKeyword(n,s,l),f=n.let("valid");e.block$data(f,b),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function b(){if(t.errors===!1)C(),t.modifying&&modifyData(e),$(()=>e.error());else{const _=t.async?P():E();t.modifying&&modifyData(e),$(()=>addErrs(e,_))}}function P(){const _=n.let("ruleErrs",null);return n.try(()=>C((0,codegen_1$p._)`await `),y=>n.assign(f,!1).if((0,codegen_1$p._)`${y} instanceof ${u.ValidationError}`,()=>n.assign(_,(0,codegen_1$p._)`${y}.errors`),()=>n.throw(y))),_}function E(){const _=(0,codegen_1$p._)`${p}.errors`;return n.assign(_,null),C(codegen_1$p.nil),_}function C(_=t.async?(0,codegen_1$p._)`await `:codegen_1$p.nil){const y=u.opts.passContext?names_1$4.default.this:names_1$4.default.self,S=!("compile"in t&&!c||t.schema===!1);n.assign(f,(0,codegen_1$p._)`${_}${(0,code_1$9.callValidateCode)(e,p,y,S)}`,t.modifying)}function $(_){var y;n.if((0,codegen_1$p.not)((y=t.valid)!==null&&y!==void 0?y:f),_)}}keyword.funcKeywordCode=funcKeywordCode;function modifyData(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,codegen_1$p._)`${n.parentData}[${n.parentDataProperty}]`))}function addErrs(e,t){const{gen:r}=e;r.if((0,codegen_1$p._)`Array.isArray(${t})`,()=>{r.assign(names_1$4.default.vErrors,(0,codegen_1$p._)`${names_1$4.default.vErrors} === null ? ${t} : ${names_1$4.default.vErrors}.concat(${t})`).assign(names_1$4.default.errors,(0,codegen_1$p._)`${names_1$4.default.vErrors}.length`),(0,errors_1$1.extendErrors)(e)},()=>e.error())}function checkAsyncKeyword({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function useKeyword(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,codegen_1$p.stringify)(r)})}function validSchemaType(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}keyword.validSchemaType=validSchemaType;function validateKeywordUsage({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");const i=s.dependencies;if(i!=null&&i.some(c=>!Object.prototype.hasOwnProperty.call(e,c)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){const u=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}keyword.validateKeywordUsage=validateKeywordUsage;var subschema={};Object.defineProperty(subschema,"__esModule",{value:!0});subschema.extendSubschemaMode=subschema.extendSubschemaData=subschema.getSubschema=void 0;const codegen_1$o=codegen,util_1$n=util;function getSubschema(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const c=e.schema[t];return r===void 0?{schema:c,schemaPath:(0,codegen_1$o._)`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:c[r],schemaPath:(0,codegen_1$o._)`${e.schemaPath}${(0,codegen_1$o.getProperty)(t)}${(0,codegen_1$o.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,util_1$n.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}subschema.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(r!==void 0){const{errorPath:l,dataPathArr:p,opts:f}=t,b=c.let("data",(0,codegen_1$o._)`${t.data}${(0,codegen_1$o.getProperty)(r)}`,!0);u(b),e.errorPath=(0,codegen_1$o.str)`${l}${(0,util_1$n.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,codegen_1$o._)`${r}`,e.dataPathArr=[...p,e.parentDataProperty]}if(s!==void 0){const l=s instanceof codegen_1$o.Name?s:c.let("data",s,!0);u(l),i!==void 0&&(e.propertyName=i)}o&&(e.dataTypes=o);function u(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}subschema.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}subschema.extendSubschemaMode=extendSubschemaMode;var resolve$1={},fastDeepEqual=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r},jsonSchemaTraverse={exports:{}},traverse$1=jsonSchemaTraverse.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};_traverse(t,n,s,e,"",e)};traverse$1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};traverse$1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};traverse$1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};traverse$1.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function _traverse(e,t,r,n,s,o,i,c,u,l){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,i,c,u,l);for(var p in n){var f=n[p];if(Array.isArray(f)){if(p in traverse$1.arrayKeywords)for(var b=0;b<f.length;b++)_traverse(e,t,r,f[b],s+"/"+p+"/"+b,o,s,p,n,b)}else if(p in traverse$1.propsKeywords){if(f&&typeof f=="object")for(var P in f)_traverse(e,t,r,f[P],s+"/"+p+"/"+escapeJsonPtr(P),o,s,p,n,P)}else(p in traverse$1.keywords||e.allKeys&&!(p in traverse$1.skipKeywords))&&_traverse(e,t,r,f,s+"/"+p,o,s,p,n)}r(n,s,o,i,c,u,l)}}function escapeJsonPtr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var jsonSchemaTraverseExports=jsonSchemaTraverse.exports;Object.defineProperty(resolve$1,"__esModule",{value:!0});resolve$1.getSchemaRefs=resolve$1.resolveUrl=resolve$1.normalizeId=resolve$1._getFullPath=resolve$1.getFullPath=resolve$1.inlineRef=void 0;const util_1$m=util,equal$2=fastDeepEqual,traverse=jsonSchemaTraverseExports,SIMPLE_INLINED=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(e,t=!0){return typeof e=="boolean"?!0:t===!0?!hasRef(e):t?countKeys(e)<=t:!1}resolve$1.inlineRef=inlineRef;const REF_KEYWORDS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(e){for(const t in e){if(REF_KEYWORDS.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(hasRef)||typeof r=="object"&&hasRef(r))return!0}return!1}function countKeys(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!SIMPLE_INLINED.has(r)&&(typeof e[r]=="object"&&(0,util_1$m.eachItem)(e[r],n=>t+=countKeys(n)),t===1/0))return 1/0}return t}function getFullPath(e,t="",r){r!==!1&&(t=normalizeId(t));const n=e.parse(t);return _getFullPath(e,n)}resolve$1.getFullPath=getFullPath;function _getFullPath(e,t){return e.serialize(t).split("#")[0]+"#"}resolve$1._getFullPath=_getFullPath;const TRAILING_SLASH_HASH=/#\/?$/;function normalizeId(e){return e?e.replace(TRAILING_SLASH_HASH,""):""}resolve$1.normalizeId=normalizeId;function resolveUrl(e,t,r){return r=normalizeId(r),e.resolve(t,r)}resolve$1.resolveUrl=resolveUrl;const ANCHOR=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=normalizeId(e[r]||t),o={"":s},i=getFullPath(n,s,!1),c={},u=new Set;return traverse(e,{allKeys:!0},(f,b,P,E)=>{if(E===void 0)return;const C=i+b;let $=o[E];typeof f[r]=="string"&&($=_.call(this,f[r])),y.call(this,f.$anchor),y.call(this,f.$dynamicAnchor),o[b]=$;function _(S){const I=this.opts.uriResolver.resolve;if(S=normalizeId($?I($,S):S),u.has(S))throw p(S);u.add(S);let D=this.refs[S];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?l(f,D.schema,S):S!==normalizeId(C)&&(S[0]==="#"?(l(f,c[S],S),c[S]=f):this.refs[S]=C),S}function y(S){if(typeof S=="string"){if(!ANCHOR.test(S))throw new Error(`invalid anchor "${S}"`);_.call(this,`#${S}`)}}}),c;function l(f,b,P){if(b!==void 0&&!equal$2(f,b))throw p(P)}function p(f){return new Error(`reference "${f}" resolves to more than one schema`)}}resolve$1.getSchemaRefs=getSchemaRefs;Object.defineProperty(validate,"__esModule",{value:!0});validate.getData=validate.KeywordCxt=validate.validateFunctionCode=void 0;const boolSchema_1=boolSchema,dataType_1$1=dataType,applicability_1=applicability,dataType_2=dataType,defaults_1=defaults,keyword_1=keyword,subschema_1=subschema,codegen_1$n=codegen,names_1$3=names$1,resolve_1$2=resolve$1,util_1$l=util,errors_1=errors;function validateFunctionCode(e){if(isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))){topSchemaObjCode(e);return}validateFunction(e,()=>(0,boolSchema_1.topBoolOrEmptySchema)(e))}validate.validateFunctionCode=validateFunctionCode;function validateFunction({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${names_1$3.default.valCxt}`,n.$async,()=>{e.code((0,codegen_1$n._)`"use strict"; ${funcSourceUrl(r,s)}`),destructureValCxtES5(e,s),e.code(o)}):e.func(t,(0,codegen_1$n._)`${names_1$3.default.data}, ${destructureValCxt(s)}`,n.$async,()=>e.code(funcSourceUrl(r,s)).code(o))}function destructureValCxt(e){return(0,codegen_1$n._)`{${names_1$3.default.instancePath}="", ${names_1$3.default.parentData}, ${names_1$3.default.parentDataProperty}, ${names_1$3.default.rootData}=${names_1$3.default.data}${e.dynamicRef?(0,codegen_1$n._)`, ${names_1$3.default.dynamicAnchors}={}`:codegen_1$n.nil}}={}`}function destructureValCxtES5(e,t){e.if(names_1$3.default.valCxt,()=>{e.var(names_1$3.default.instancePath,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.instancePath}`),e.var(names_1$3.default.parentData,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentData}`),e.var(names_1$3.default.parentDataProperty,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.parentDataProperty}`),e.var(names_1$3.default.rootData,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.rootData}`),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,(0,codegen_1$n._)`${names_1$3.default.valCxt}.${names_1$3.default.dynamicAnchors}`)},()=>{e.var(names_1$3.default.instancePath,(0,codegen_1$n._)`""`),e.var(names_1$3.default.parentData,(0,codegen_1$n._)`undefined`),e.var(names_1$3.default.parentDataProperty,(0,codegen_1$n._)`undefined`),e.var(names_1$3.default.rootData,names_1$3.default.data),t.dynamicRef&&e.var(names_1$3.default.dynamicAnchors,(0,codegen_1$n._)`{}`)})}function topSchemaObjCode(e){const{schema:t,opts:r,gen:n}=e;validateFunction(e,()=>{r.$comment&&t.$comment&&commentKeyword(e),checkNoDefault(e),n.let(names_1$3.default.vErrors,null),n.let(names_1$3.default.errors,0),r.unevaluated&&resetEvaluated(e),typeAndKeywords(e),returnResults(e)})}function resetEvaluated(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,codegen_1$n._)`${r}.evaluated`),t.if((0,codegen_1$n._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,codegen_1$n._)`${e.evaluated}.props`,(0,codegen_1$n._)`undefined`)),t.if((0,codegen_1$n._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,codegen_1$n._)`${e.evaluated}.items`,(0,codegen_1$n._)`undefined`))}function funcSourceUrl(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,codegen_1$n._)`/*# sourceURL=${r} */`:codegen_1$n.nil}function subschemaCode(e,t){if(isSchemaObj(e)&&(checkKeywords(e),schemaCxtHasRules(e))){subSchemaObjCode(e,t);return}(0,boolSchema_1.boolOrEmptySchema)(e,t)}function schemaCxtHasRules({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function isSchemaObj(e){return typeof e.schema!="boolean"}function subSchemaObjCode(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&commentKeyword(e),updateContext(e),checkAsyncSchema(e);const o=n.const("_errs",names_1$3.default.errors);typeAndKeywords(e,o),n.var(t,(0,codegen_1$n._)`${o} === ${names_1$3.default.errors}`)}function checkKeywords(e){(0,util_1$l.checkUnknownRules)(e),checkRefsAndKeywords(e)}function typeAndKeywords(e,t){if(e.opts.jtd)return schemaKeywords(e,[],!1,t);const r=(0,dataType_1$1.getSchemaTypes)(e.schema),n=(0,dataType_1$1.coerceAndCheckDataType)(e,r);schemaKeywords(e,r,!n,t)}function checkRefsAndKeywords(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,util_1$l.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function checkNoDefault(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,util_1$l.checkStrictMode)(e,"default is ignored in the schema root")}function updateContext(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,resolve_1$2.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function checkAsyncSchema(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const o=r.$comment;if(s.$comment===!0)e.code((0,codegen_1$n._)`${names_1$3.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){const i=(0,codegen_1$n.str)`${n}/$comment`,c=e.scopeValue("root",{ref:t.root});e.code((0,codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${o}, ${i}, ${c}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0,codegen_1$n._)`${names_1$3.default.errors} === 0`,()=>t.return(names_1$3.default.data),()=>t.throw((0,codegen_1$n._)`new ${s}(${names_1$3.default.vErrors})`)):(t.assign((0,codegen_1$n._)`${n}.errors`,names_1$3.default.vErrors),o.unevaluated&&assignEvaluated(e),t.return((0,codegen_1$n._)`${names_1$3.default.errors} === 0`))}function assignEvaluated({gen:e,evaluated:t,props:r,items:n}){r instanceof codegen_1$n.Name&&e.assign((0,codegen_1$n._)`${t}.props`,r),n instanceof codegen_1$n.Name&&e.assign((0,codegen_1$n._)`${t}.items`,n)}function schemaKeywords(e,t,r,n){const{gen:s,schema:o,data:i,allErrors:c,opts:u,self:l}=e,{RULES:p}=l;if(o.$ref&&(u.ignoreKeywordsWithRef||!(0,util_1$l.schemaHasRulesButRef)(o,p))){s.block(()=>keywordCode(e,"$ref",p.all.$ref.definition));return}u.jtd||checkStrictTypes(e,t),s.block(()=>{for(const b of p.rules)f(b);f(p.post)});function f(b){(0,applicability_1.shouldUseGroup)(o,b)&&(b.type?(s.if((0,dataType_2.checkDataType)(b.type,i,u.strictNumbers)),iterateKeywords(e,b),t.length===1&&t[0]===b.type&&r&&(s.else(),(0,dataType_2.reportTypeError)(e)),s.endIf()):iterateKeywords(e,b),c||s.if((0,codegen_1$n._)`${names_1$3.default.errors} === ${n||0}`))}}function iterateKeywords(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,defaults_1.assignDefaults)(e,t.type),r.block(()=>{for(const o of t.rules)(0,applicability_1.shouldUseRule)(n,o)&&keywordCode(e,o.keyword,o.definition,t.type)})}function checkStrictTypes(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(checkContextTypes(e,t),e.opts.allowUnionTypes||checkMultipleTypes(e,t),checkKeywordTypes(e,e.dataTypes))}function checkContextTypes(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{includesType(e.dataTypes,r)||strictTypesError(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),narrowSchemaTypes(e,t)}}function checkMultipleTypes(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&strictTypesError(e,"use allowUnionTypes to allow union type keyword")}function checkKeywordTypes(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,applicability_1.shouldUseRule)(e.schema,s)){const{type:o}=s.definition;o.length&&!o.some(i=>hasApplicableType(t,i))&&strictTypesError(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function hasApplicableType(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function includesType(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function narrowSchemaTypes(e,t){const r=[];for(const n of e.dataTypes)includesType(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function strictTypesError(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,util_1$l.checkStrictMode)(e,t,e.opts.strictTypes)}class KeywordCxt{constructor(t,r,n){if((0,keyword_1.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,util_1$l.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",getData(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,keyword_1.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",names_1$3.default.errors))}result(t,r,n){this.failResult((0,codegen_1$n.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,codegen_1$n.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:r}=this;this.fail((0,codegen_1$n._)`${r} !== undefined && (${(0,codegen_1$n.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?errors_1.reportExtraError:errors_1.reportError)(this,this.def.error,r)}$dataError(){(0,errors_1.reportError)(this,this.def.$dataError||errors_1.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,errors_1.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=codegen_1$n.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=codegen_1$n.nil,r=codegen_1$n.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,codegen_1$n.or)((0,codegen_1$n._)`${s} === undefined`,r)),t!==codegen_1$n.nil&&n.assign(t,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==codegen_1$n.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,codegen_1$n.or)(i(),c());function i(){if(n.length){if(!(r instanceof codegen_1$n.Name))throw new Error("ajv implementation error");const u=Array.isArray(n)?n:[n];return(0,codegen_1$n._)`${(0,dataType_2.checkDataTypes)(u,r,o.opts.strictNumbers,dataType_2.DataType.Wrong)}`}return codegen_1$n.nil}function c(){if(s.validateSchema){const u=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,codegen_1$n._)`!${u}(${r})`}return codegen_1$n.nil}}subschema(t,r){const n=(0,subschema_1.getSubschema)(this.it,t);(0,subschema_1.extendSubschemaData)(n,this.it,t),(0,subschema_1.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return subschemaCode(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=util_1$l.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=util_1$l.mergeEvaluated.items(s,t.items,n.items,r)))}mergeValidEvaluated(t,r){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(t,codegen_1$n.Name)),!0}}validate.KeywordCxt=KeywordCxt;function keywordCode(e,t,r,n){const s=new KeywordCxt(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,keyword_1.funcKeywordCode)(s,r):"macro"in r?(0,keyword_1.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,keyword_1.funcKeywordCode)(s,r)}const JSON_POINTER=/^\/(?:[^~]|~0|~1)*$/,RELATIVE_JSON_POINTER=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return names_1$3.default.rootData;if(e[0]==="/"){if(!JSON_POINTER.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=names_1$3.default.rootData}else{const l=RELATIVE_JSON_POINTER.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);const p=+l[1];if(s=l[2],s==="#"){if(p>=t)throw new Error(u("property/index",p));return n[t-p]}if(p>t)throw new Error(u("data",p));if(o=r[t-p],!s)return o}let i=o;const c=s.split("/");for(const l of c)l&&(o=(0,codegen_1$n._)`${o}${(0,codegen_1$n.getProperty)((0,util_1$l.unescapeJsonPointer)(l))}`,i=(0,codegen_1$n._)`${i} && ${o}`);return i;function u(l,p){return`Cannot access ${l} ${p} levels up, current level is ${t}`}}validate.getData=getData;var validation_error={};Object.defineProperty(validation_error,"__esModule",{value:!0});class ValidationError extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}validation_error.default=ValidationError;var ref_error={};Object.defineProperty(ref_error,"__esModule",{value:!0});const resolve_1$1=resolve$1;class MissingRefError extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,resolve_1$1.resolveUrl)(t,r,n),this.missingSchema=(0,resolve_1$1.normalizeId)((0,resolve_1$1.getFullPath)(t,this.missingRef))}}ref_error.default=MissingRefError;var compile={};Object.defineProperty(compile,"__esModule",{value:!0});compile.resolveSchema=compile.getCompilingSchema=compile.resolveRef=compile.compileSchema=compile.SchemaEnv=void 0;const codegen_1$m=codegen,validation_error_1=validation_error,names_1$2=names$1,resolve_1=resolve$1,util_1$k=util,validate_1$1=validate;class SchemaEnv{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,resolve_1.normalizeId)(n==null?void 0:n[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n==null?void 0:n.$async,this.refs={}}}compile.SchemaEnv=SchemaEnv;function compileSchema(e){const t=getCompilingSchema.call(this,e);if(t)return t;const r=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new codegen_1$m.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let c;e.$async&&(c=i.scopeValue("Error",{ref:validation_error_1.default,code:(0,codegen_1$m._)`require("ajv/dist/runtime/validation_error").default`}));const u=i.scopeName("validate");e.validateName=u;const l={gen:i,allErrors:this.opts.allErrors,data:names_1$2.default.data,parentData:names_1$2.default.parentData,parentDataProperty:names_1$2.default.parentDataProperty,dataNames:[names_1$2.default.data],dataPathArr:[codegen_1$m.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,codegen_1$m.stringify)(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:c,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 p;try{this._compilations.add(e),(0,validate_1$1.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);const f=i.toString();p=`${i.scopeRefs(names_1$2.default.scope)}return ${f}`,this.opts.code.process&&(p=this.opts.code.process(p,e));const P=new Function(`${names_1$2.default.self}`,`${names_1$2.default.scope}`,p)(this,this.scope.get());if(this.scope.value(u,{ref:P}),P.errors=null,P.schema=e.schema,P.schemaEnv=e,e.$async&&(P.$async=!0),this.opts.code.source===!0&&(P.source={validateName:u,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:E,items:C}=l;P.evaluated={props:E instanceof codegen_1$m.Name?void 0:E,items:C instanceof codegen_1$m.Name?void 0:C,dynamicProps:E instanceof codegen_1$m.Name,dynamicItems:C instanceof codegen_1$m.Name},P.source&&(P.source.evaluated=(0,codegen_1$m.stringify)(P.evaluated))}return e.validate=P,e}catch(f){throw delete e.validate,delete e.validateName,p&&this.logger.error("Error compiling schema, function code:",p),f}finally{this._compilations.delete(e)}}compile.compileSchema=compileSchema;function resolveRef(e,t,r){var n;r=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=resolve.call(this,e,r);if(o===void 0){const i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:c}=this.opts;i&&(o=new SchemaEnv({schema:i,schemaId:c,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=inlineOrCompile.call(this,o)}compile.resolveRef=resolveRef;function inlineOrCompile(e){return(0,resolve_1.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:compileSchema.call(this,e)}function getCompilingSchema(e){for(const t of this._compilations)if(sameSchemaEnv(t,e))return t}compile.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function resolve(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||resolveSchema.call(this,e,t)}function resolveSchema(e,t){const r=this.opts.uriResolver.parse(t),n=(0,resolve_1._getFullPath)(this.opts.uriResolver,r);let s=(0,resolve_1.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return getJsonPointer.call(this,r,e);const o=(0,resolve_1.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const c=resolveSchema.call(this,e,i);return typeof(c==null?void 0:c.schema)!="object"?void 0:getJsonPointer.call(this,r,c)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||compileSchema.call(this,i),o===(0,resolve_1.normalizeId)(t)){const{schema:c}=i,{schemaId:u}=this.opts,l=c[u];return l&&(s=(0,resolve_1.resolveUrl)(this.opts.uriResolver,s,l)),new SchemaEnv({schema:c,schemaId:u,root:e,baseId:s})}return getJsonPointer.call(this,r,i)}}compile.resolveSchema=resolveSchema;const PREVENT_SCOPE_CHANGE=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const c of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const u=r[(0,util_1$k.unescapeFragment)(c)];if(u===void 0)return;r=u;const l=typeof r=="object"&&r[this.opts.schemaId];!PREVENT_SCOPE_CHANGE.has(c)&&l&&(t=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,util_1$k.schemaHasRulesButRef)(r,this.RULES)){const c=(0,resolve_1.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=resolveSchema.call(this,n,c)}const{schemaId:i}=this.opts;if(o=o||new SchemaEnv({schema:r,schemaId:i,root:n,baseId:t}),o.schema!==o.root.schema)return o}const $id$1="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description="Meta-schema for $data reference (JSON AnySchema extension proposal)",type$1="object",required$1=["$data"],properties$2={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties$1=!1,require$$9={$id:$id$1,description,type:type$1,required:required$1,properties:properties$2,additionalProperties:additionalProperties$1};var uri$1={},uri_all={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(e,t){(function(r,n){n(t)})(commonjsGlobal,function(r){function n(){for(var h=arguments.length,d=Array(h),g=0;g<h;g++)d[g]=arguments[g];if(d.length>1){d[0]=d[0].slice(0,-1);for(var k=d.length-1,R=1;R<k;++R)d[R]=d[R].slice(1,-1);return d[k]=d[k].slice(1),d.join("")}else return d[0]}function s(h){return"(?:"+h+")"}function o(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function i(h){return h.toUpperCase()}function c(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function u(h,d){var g=h;if(d)for(var k in d)g[k]=d[k];return g}function l(h){var d="[A-Za-z]",g="[0-9]",k=n(g,"[A-Fa-f]"),R=s(s("%[EFef]"+k+"%"+k+k+"%"+k+k)+"|"+s("%[89A-Fa-f]"+k+"%"+k+k)+"|"+s("%"+k+k)),q="[\\:\\/\\?\\#\\[\\]\\@]",x="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",K=n(q,x),Q=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",te=h?"[\\uE000-\\uF8FF]":"[]",W=n(d,g,"[\\-\\.\\_\\~]",Q);s(d+n(d,g,"[\\+\\-\\.]")+"*"),s(s(R+"|"+n(W,x,"[\\:]"))+"*");var J=s(s("25[0-5]")+"|"+s("2[0-4]"+g)+"|"+s("1"+g+g)+"|"+s("0?[1-9]"+g)+"|0?0?"+g),re=s(J+"\\."+J+"\\."+J+"\\."+J),V=s(k+"{1,4}"),Y=s(s(V+"\\:"+V)+"|"+re),se=s(s(V+"\\:")+"{6}"+Y),Z=s("\\:\\:"+s(V+"\\:")+"{5}"+Y),Pe=s(s(V)+"?\\:\\:"+s(V+"\\:")+"{4}"+Y),ge=s(s(s(V+"\\:")+"{0,1}"+V)+"?\\:\\:"+s(V+"\\:")+"{3}"+Y),_e=s(s(s(V+"\\:")+"{0,2}"+V)+"?\\:\\:"+s(V+"\\:")+"{2}"+Y),qe=s(s(s(V+"\\:")+"{0,3}"+V)+"?\\:\\:"+V+"\\:"+Y),Ce=s(s(s(V+"\\:")+"{0,4}"+V)+"?\\:\\:"+Y),pe=s(s(s(V+"\\:")+"{0,5}"+V)+"?\\:\\:"+V),ye=s(s(s(V+"\\:")+"{0,6}"+V)+"?\\:\\:"),Oe=s([se,Z,Pe,ge,_e,qe,Ce,pe,ye].join("|")),ve=s(s(W+"|"+R)+"+");s("[vV]"+k+"+\\."+n(W,x,"[\\:]")+"+"),s(s(R+"|"+n(W,x))+"*");var Qe=s(R+"|"+n(W,x,"[\\:\\@]"));return s(s(R+"|"+n(W,x,"[\\@]"))+"+"),s(s(Qe+"|"+n("[\\/\\?]",te))+"*"),{NOT_SCHEME:new RegExp(n("[^]",d,g,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",W,x),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",W,x),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",W,x),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",W,x),"g"),NOT_QUERY:new RegExp(n("[^\\%]",W,x,"[\\:\\@\\/\\?]",te),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",W,x,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",W,x),"g"),UNRESERVED:new RegExp(W,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",W,K),"g"),PCT_ENCODED:new RegExp(R,"g"),IPV4ADDRESS:new RegExp("^("+re+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Oe+")"+s(s("\\%25|\\%(?!"+k+"{2})")+"("+ve+")")+"?\\]?$")}}var p=l(!1),f=l(!0),b=function(){function h(d,g){var k=[],R=!0,q=!1,x=void 0;try{for(var K=d[Symbol.iterator](),Q;!(R=(Q=K.next()).done)&&(k.push(Q.value),!(g&&k.length===g));R=!0);}catch(te){q=!0,x=te}finally{try{!R&&K.return&&K.return()}finally{if(q)throw x}}return k}return function(d,g){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return h(d,g);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),P=function(h){if(Array.isArray(h)){for(var d=0,g=Array(h.length);d<h.length;d++)g[d]=h[d];return g}else return Array.from(h)},E=2147483647,C=36,$=1,_=26,y=38,S=700,I=72,D=128,w="-",O=/^xn--/,A=/[^\0-\x7E]/,U=/[\x2E\u3002\uFF0E\uFF61]/g,H={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},X=C-$,G=Math.floor,de=String.fromCharCode;function ne(h){throw new RangeError(H[h])}function Se(h,d){for(var g=[],k=h.length;k--;)g[k]=d(h[k]);return g}function Te(h,d){var g=h.split("@"),k="";g.length>1&&(k=g[0]+"@",h=g[1]),h=h.replace(U,".");var R=h.split("."),q=Se(R,d).join(".");return k+q}function Ne(h){for(var d=[],g=0,k=h.length;g<k;){var R=h.charCodeAt(g++);if(R>=55296&&R<=56319&&g<k){var q=h.charCodeAt(g++);(q&64512)==56320?d.push(((R&1023)<<10)+(q&1023)+65536):(d.push(R),g--)}else d.push(R)}return d}var Ve=function(d){return String.fromCodePoint.apply(String,P(d))},Ie=function(d){return d-48<10?d-22:d-65<26?d-65:d-97<26?d-97:C},F=function(d,g){return d+22+75*(d<26)-((g!=0)<<5)},v=function(d,g,k){var R=0;for(d=k?G(d/S):d>>1,d+=G(d/g);d>X*_>>1;R+=C)d=G(d/X);return G(R+(X+1)*d/(d+y))},j=function(d){var g=[],k=d.length,R=0,q=D,x=I,K=d.lastIndexOf(w);K<0&&(K=0);for(var Q=0;Q<K;++Q)d.charCodeAt(Q)>=128&&ne("not-basic"),g.push(d.charCodeAt(Q));for(var te=K>0?K+1:0;te<k;){for(var W=R,J=1,re=C;;re+=C){te>=k&&ne("invalid-input");var V=Ie(d.charCodeAt(te++));(V>=C||V>G((E-R)/J))&&ne("overflow"),R+=V*J;var Y=re<=x?$:re>=x+_?_:re-x;if(V<Y)break;var se=C-Y;J>G(E/se)&&ne("overflow"),J*=se}var Z=g.length+1;x=v(R-W,Z,W==0),G(R/Z)>E-q&&ne("overflow"),q+=G(R/Z),R%=Z,g.splice(R++,0,q)}return String.fromCodePoint.apply(String,g)},T=function(d){var g=[];d=Ne(d);var k=d.length,R=D,q=0,x=I,K=!0,Q=!1,te=void 0;try{for(var W=d[Symbol.iterator](),J;!(K=(J=W.next()).done);K=!0){var re=J.value;re<128&&g.push(de(re))}}catch(Ye){Q=!0,te=Ye}finally{try{!K&&W.return&&W.return()}finally{if(Q)throw te}}var V=g.length,Y=V;for(V&&g.push(w);Y<k;){var se=E,Z=!0,Pe=!1,ge=void 0;try{for(var _e=d[Symbol.iterator](),qe;!(Z=(qe=_e.next()).done);Z=!0){var Ce=qe.value;Ce>=R&&Ce<se&&(se=Ce)}}catch(Ye){Pe=!0,ge=Ye}finally{try{!Z&&_e.return&&_e.return()}finally{if(Pe)throw ge}}var pe=Y+1;se-R>G((E-q)/pe)&&ne("overflow"),q+=(se-R)*pe,R=se;var ye=!0,Oe=!1,ve=void 0;try{for(var Qe=d[Symbol.iterator](),Rt;!(ye=(Rt=Qe.next()).done);ye=!0){var kt=Rt.value;if(kt<R&&++q>E&&ne("overflow"),kt==R){for(var et=q,tt=C;;tt+=C){var rt=tt<=x?$:tt>=x+_?_:tt-x;if(et<rt)break;var Ct=et-rt,Ot=C-rt;g.push(de(F(rt+Ct%Ot,0))),et=G(Ct/Ot)}g.push(de(F(et,0))),x=v(q,pe,Y==V),q=0,++Y}}}catch(Ye){Oe=!0,ve=Ye}finally{try{!ye&&Qe.return&&Qe.return()}finally{if(Oe)throw ve}}++q,++R}return g.join("")},a=function(d){return Te(d,function(g){return O.test(g)?j(g.slice(4).toLowerCase()):g})},m=function(d){return Te(d,function(g){return A.test(g)?"xn--"+T(g):g})},N={version:"2.1.0",ucs2:{decode:Ne,encode:Ve},decode:j,encode:T,toASCII:m,toUnicode:a},M={};function L(h){var d=h.charCodeAt(0),g=void 0;return d<16?g="%0"+d.toString(16).toUpperCase():d<128?g="%"+d.toString(16).toUpperCase():d<2048?g="%"+(d>>6|192).toString(16).toUpperCase()+"%"+(d&63|128).toString(16).toUpperCase():g="%"+(d>>12|224).toString(16).toUpperCase()+"%"+(d>>6&63|128).toString(16).toUpperCase()+"%"+(d&63|128).toString(16).toUpperCase(),g}function z(h){for(var d="",g=0,k=h.length;g<k;){var R=parseInt(h.substr(g+1,2),16);if(R<128)d+=String.fromCharCode(R),g+=3;else if(R>=194&&R<224){if(k-g>=6){var q=parseInt(h.substr(g+4,2),16);d+=String.fromCharCode((R&31)<<6|q&63)}else d+=h.substr(g,6);g+=6}else if(R>=224){if(k-g>=9){var x=parseInt(h.substr(g+4,2),16),K=parseInt(h.substr(g+7,2),16);d+=String.fromCharCode((R&15)<<12|(x&63)<<6|K&63)}else d+=h.substr(g,9);g+=9}else d+=h.substr(g,3),g+=3}return d}function B(h,d){function g(k){var R=z(k);return R.match(d.UNRESERVED)?R:k}return h.scheme&&(h.scheme=String(h.scheme).replace(d.PCT_ENCODED,g).toLowerCase().replace(d.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(d.PCT_ENCODED,g).replace(d.NOT_USERINFO,L).replace(d.PCT_ENCODED,i)),h.host!==void 0&&(h.host=String(h.host).replace(d.PCT_ENCODED,g).toLowerCase().replace(d.NOT_HOST,L).replace(d.PCT_ENCODED,i)),h.path!==void 0&&(h.path=String(h.path).replace(d.PCT_ENCODED,g).replace(h.scheme?d.NOT_PATH:d.NOT_PATH_NOSCHEME,L).replace(d.PCT_ENCODED,i)),h.query!==void 0&&(h.query=String(h.query).replace(d.PCT_ENCODED,g).replace(d.NOT_QUERY,L).replace(d.PCT_ENCODED,i)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(d.PCT_ENCODED,g).replace(d.NOT_FRAGMENT,L).replace(d.PCT_ENCODED,i)),h}function ee(h){return h.replace(/^0*(.*)/,"$1")||"0"}function fe(h,d){var g=h.match(d.IPV4ADDRESS)||[],k=b(g,2),R=k[1];return R?R.split(".").map(ee).join("."):h}function je(h,d){var g=h.match(d.IPV6ADDRESS)||[],k=b(g,3),R=k[1],q=k[2];if(R){for(var x=R.toLowerCase().split("::").reverse(),K=b(x,2),Q=K[0],te=K[1],W=te?te.split(":").map(ee):[],J=Q.split(":").map(ee),re=d.IPV4ADDRESS.test(J[J.length-1]),V=re?7:8,Y=J.length-V,se=Array(V),Z=0;Z<V;++Z)se[Z]=W[Z]||J[Y+Z]||"";re&&(se[V-1]=fe(se[V-1],d));var Pe=se.reduce(function(pe,ye,Oe){if(!ye||ye==="0"){var ve=pe[pe.length-1];ve&&ve.index+ve.length===Oe?ve.length++:pe.push({index:Oe,length:1})}return pe},[]),ge=Pe.sort(function(pe,ye){return ye.length-pe.length})[0],_e=void 0;if(ge&&ge.length>1){var qe=se.slice(0,ge.index),Ce=se.slice(ge.index+ge.length);_e=qe.join(":")+"::"+Ce.join(":")}else _e=se.join(":");return q&&(_e+="%"+q),_e}else return h}var He=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ze="".match(/(){0}/)[1]===void 0;function le(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g={},k=d.iri!==!1?f:p;d.reference==="suffix"&&(h=(d.scheme?d.scheme+":":"")+"//"+h);var R=h.match(He);if(R){ze?(g.scheme=R[1],g.userinfo=R[3],g.host=R[4],g.port=parseInt(R[5],10),g.path=R[6]||"",g.query=R[7],g.fragment=R[8],isNaN(g.port)&&(g.port=R[5])):(g.scheme=R[1]||void 0,g.userinfo=h.indexOf("@")!==-1?R[3]:void 0,g.host=h.indexOf("//")!==-1?R[4]:void 0,g.port=parseInt(R[5],10),g.path=R[6]||"",g.query=h.indexOf("?")!==-1?R[7]:void 0,g.fragment=h.indexOf("#")!==-1?R[8]:void 0,isNaN(g.port)&&(g.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),g.host&&(g.host=je(fe(g.host,k),k)),g.scheme===void 0&&g.userinfo===void 0&&g.host===void 0&&g.port===void 0&&!g.path&&g.query===void 0?g.reference="same-document":g.scheme===void 0?g.reference="relative":g.fragment===void 0?g.reference="absolute":g.reference="uri",d.reference&&d.reference!=="suffix"&&d.reference!==g.reference&&(g.error=g.error||"URI is not a "+d.reference+" reference.");var q=M[(d.scheme||g.scheme||"").toLowerCase()];if(!d.unicodeSupport&&(!q||!q.unicodeSupport)){if(g.host&&(d.domainHost||q&&q.domainHost))try{g.host=N.toASCII(g.host.replace(k.PCT_ENCODED,z).toLowerCase())}catch(x){g.error=g.error||"Host's domain name can not be converted to ASCII via punycode: "+x}B(g,p)}else B(g,k);q&&q.parse&&q.parse(g,d)}else g.error=g.error||"URI can not be parsed.";return g}function We(h,d){var g=d.iri!==!1?f:p,k=[];return h.userinfo!==void 0&&(k.push(h.userinfo),k.push("@")),h.host!==void 0&&k.push(je(fe(String(h.host),g),g).replace(g.IPV6ADDRESS,function(R,q,x){return"["+q+(x?"%25"+x:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(k.push(":"),k.push(String(h.port))),k.length?k.join(""):void 0}var Ae=/^\.\.?\//,De=/^\/\.(\/|$)/,Fe=/^\/\.\.(\/|$)/,Be=/^\/?(?:.|\n)*?(?=\/|$)/;function he(h){for(var d=[];h.length;)if(h.match(Ae))h=h.replace(Ae,"");else if(h.match(De))h=h.replace(De,"/");else if(h.match(Fe))h=h.replace(Fe,"/"),d.pop();else if(h==="."||h==="..")h="";else{var g=h.match(Be);if(g){var k=g[0];h=h.slice(k.length),d.push(k)}else throw new Error("Unexpected dot segment condition")}return d.join("")}function ae(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=d.iri?f:p,k=[],R=M[(d.scheme||h.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(h,d),h.host&&!g.IPV6ADDRESS.test(h.host)){if(d.domainHost||R&&R.domainHost)try{h.host=d.iri?N.toUnicode(h.host):N.toASCII(h.host.replace(g.PCT_ENCODED,z).toLowerCase())}catch(K){h.error=h.error||"Host's domain name can not be converted to "+(d.iri?"Unicode":"ASCII")+" via punycode: "+K}}B(h,g),d.reference!=="suffix"&&h.scheme&&(k.push(h.scheme),k.push(":"));var q=We(h,d);if(q!==void 0&&(d.reference!=="suffix"&&k.push("//"),k.push(q),h.path&&h.path.charAt(0)!=="/"&&k.push("/")),h.path!==void 0){var x=h.path;!d.absolutePath&&(!R||!R.absolutePath)&&(x=he(x)),q===void 0&&(x=x.replace(/^\/\//,"/%2F")),k.push(x)}return h.query!==void 0&&(k.push("?"),k.push(h.query)),h.fragment!==void 0&&(k.push("#"),k.push(h.fragment)),k.join("")}function Me(h,d){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=arguments[3],R={};return k||(h=le(ae(h,g),g),d=le(ae(d,g),g)),g=g||{},!g.tolerant&&d.scheme?(R.scheme=d.scheme,R.userinfo=d.userinfo,R.host=d.host,R.port=d.port,R.path=he(d.path||""),R.query=d.query):(d.userinfo!==void 0||d.host!==void 0||d.port!==void 0?(R.userinfo=d.userinfo,R.host=d.host,R.port=d.port,R.path=he(d.path||""),R.query=d.query):(d.path?(d.path.charAt(0)==="/"?R.path=he(d.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?R.path="/"+d.path:h.path?R.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+d.path:R.path=d.path,R.path=he(R.path)),R.query=d.query):(R.path=h.path,d.query!==void 0?R.query=d.query:R.query=h.query),R.userinfo=h.userinfo,R.host=h.host,R.port=h.port),R.scheme=h.scheme),R.fragment=d.fragment,R}function Ge(h,d,g){var k=u({scheme:"null"},g);return ae(Me(le(h,k),le(d,k),k,!0),k)}function Re(h,d){return typeof h=="string"?h=ae(le(h,d),d):o(h)==="object"&&(h=le(ae(h,d),d)),h}function Ke(h,d,g){return typeof h=="string"?h=ae(le(h,g),g):o(h)==="object"&&(h=ae(h,g)),typeof d=="string"?d=ae(le(d,g),g):o(d)==="object"&&(d=ae(d,g)),h===d}function Xe(h,d){return h&&h.toString().replace(!d||!d.iri?p.ESCAPE:f.ESCAPE,L)}function ue(h,d){return h&&h.toString().replace(!d||!d.iri?p.PCT_ENCODED:f.PCT_ENCODED,z)}var ke={scheme:"http",domainHost:!0,parse:function(d,g){return d.host||(d.error=d.error||"HTTP URIs must have a host."),d},serialize:function(d,g){var k=String(d.scheme).toLowerCase()==="https";return(d.port===(k?443:80)||d.port==="")&&(d.port=void 0),d.path||(d.path="/"),d}},$t={scheme:"https",domainHost:ke.domainHost,parse:ke.parse,serialize:ke.serialize};function vt(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var Je={scheme:"ws",domainHost:!0,parse:function(d,g){var k=d;return k.secure=vt(k),k.resourceName=(k.path||"/")+(k.query?"?"+k.query:""),k.path=void 0,k.query=void 0,k},serialize:function(d,g){if((d.port===(vt(d)?443:80)||d.port==="")&&(d.port=void 0),typeof d.secure=="boolean"&&(d.scheme=d.secure?"wss":"ws",d.secure=void 0),d.resourceName){var k=d.resourceName.split("?"),R=b(k,2),q=R[0],x=R[1];d.path=q&&q!=="/"?q:void 0,d.query=x,d.resourceName=void 0}return d.fragment=void 0,d}},wt={scheme:"wss",domainHost:Je.domainHost,parse:Je.parse,serialize:Je.serialize},zt={},Pt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",me="[0-9A-Fa-f]",Wt=s(s("%[EFef]"+me+"%"+me+me+"%"+me+me)+"|"+s("%[89A-Fa-f]"+me+"%"+me+me)+"|"+s("%"+me+me)),Bt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Gt="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Kt=n(Gt,'[\\"\\\\]'),Jt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Qt=new RegExp(Pt,"g"),Le=new RegExp(Wt,"g"),Yt=new RegExp(n("[^]",Bt,"[\\.]",'[\\"]',Kt),"g"),bt=new RegExp(n("[^]",Pt,Jt),"g"),Zt=bt;function gt(h){var d=z(h);return d.match(Qt)?d:h}var Et={scheme:"mailto",parse:function(d,g){var k=d,R=k.to=k.path?k.path.split(","):[];if(k.path=void 0,k.query){for(var q=!1,x={},K=k.query.split("&"),Q=0,te=K.length;Q<te;++Q){var W=K[Q].split("=");switch(W[0]){case"to":for(var J=W[1].split(","),re=0,V=J.length;re<V;++re)R.push(J[re]);break;case"subject":k.subject=ue(W[1],g);break;case"body":k.body=ue(W[1],g);break;default:q=!0,x[ue(W[0],g)]=ue(W[1],g);break}}q&&(k.headers=x)}k.query=void 0;for(var Y=0,se=R.length;Y<se;++Y){var Z=R[Y].split("@");if(Z[0]=ue(Z[0]),g.unicodeSupport)Z[1]=ue(Z[1],g).toLowerCase();else try{Z[1]=N.toASCII(ue(Z[1],g).toLowerCase())}catch(Pe){k.error=k.error||"Email address's domain name can not be converted to ASCII via punycode: "+Pe}R[Y]=Z.join("@")}return k},serialize:function(d,g){var k=d,R=c(d.to);if(R){for(var q=0,x=R.length;q<x;++q){var K=String(R[q]),Q=K.lastIndexOf("@"),te=K.slice(0,Q).replace(Le,gt).replace(Le,i).replace(Yt,L),W=K.slice(Q+1);try{W=g.iri?N.toUnicode(W):N.toASCII(ue(W,g).toLowerCase())}catch(Y){k.error=k.error||"Email address's domain name can not be converted to "+(g.iri?"Unicode":"ASCII")+" via punycode: "+Y}R[q]=te+"@"+W}k.path=R.join(",")}var J=d.headers=d.headers||{};d.subject&&(J.subject=d.subject),d.body&&(J.body=d.body);var re=[];for(var V in J)J[V]!==zt[V]&&re.push(V.replace(Le,gt).replace(Le,i).replace(bt,L)+"="+J[V].replace(Le,gt).replace(Le,i).replace(Zt,L));return re.length&&(k.query=re.join("&")),k}},Xt=/^([^\:]+)\:(.*)/,St={scheme:"urn",parse:function(d,g){var k=d.path&&d.path.match(Xt),R=d;if(k){var q=g.scheme||R.scheme||"urn",x=k[1].toLowerCase(),K=k[2],Q=q+":"+(g.nid||x),te=M[Q];R.nid=x,R.nss=K,R.path=void 0,te&&(R=te.parse(R,g))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(d,g){var k=g.scheme||d.scheme||"urn",R=d.nid,q=k+":"+(g.nid||R),x=M[q];x&&(d=x.serialize(d,g));var K=d,Q=d.nss;return K.path=(R||g.nid)+":"+Q,K}},er=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Tt={scheme:"urn:uuid",parse:function(d,g){var k=d;return k.uuid=k.nss,k.nss=void 0,!g.tolerant&&(!k.uuid||!k.uuid.match(er))&&(k.error=k.error||"UUID is not valid."),k},serialize:function(d,g){var k=d;return k.nss=(d.uuid||"").toLowerCase(),k}};M[ke.scheme]=ke,M[$t.scheme]=$t,M[Je.scheme]=Je,M[wt.scheme]=wt,M[Et.scheme]=Et,M[St.scheme]=St,M[Tt.scheme]=Tt,r.SCHEMES=M,r.pctEncChar=L,r.pctDecChars=z,r.parse=le,r.removeDotSegments=he,r.serialize=ae,r.resolveComponents=Me,r.resolve=Ge,r.normalize=Re,r.equal=Ke,r.escapeComponent=Xe,r.unescapeComponent=ue,Object.defineProperty(r,"__esModule",{value:!0})})})(uri_all,uri_all.exports);var uri_allExports=uri_all.exports;Object.defineProperty(uri$1,"__esModule",{value:!0});const uri=uri_allExports;uri.code='require("ajv/dist/runtime/uri").default';uri$1.default=uri;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=validate;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=codegen;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=validation_error,s=ref_error,o=rules,i=compile,c=codegen,u=resolve$1,l=dataType,p=util,f=require$$9,b=uri$1,P=(F,v)=>new RegExp(F,v);P.code="new RegExp";const E=["removeAdditional","useDefaults","coerceTypes"],C=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.'},y=200;function S(F){var v,j,T,a,m,N,M,L,z,B,ee,fe,je,He,ze,le,We,Ae,De,Fe,Be,he,ae,Me,Ge;const Re=F.strict,Ke=(v=F.code)===null||v===void 0?void 0:v.optimize,Xe=Ke===!0||Ke===void 0?1:Ke||0,ue=(T=(j=F.code)===null||j===void 0?void 0:j.regExp)!==null&&T!==void 0?T:P,ke=(a=F.uriResolver)!==null&&a!==void 0?a:b.default;return{strictSchema:(N=(m=F.strictSchema)!==null&&m!==void 0?m:Re)!==null&&N!==void 0?N:!0,strictNumbers:(L=(M=F.strictNumbers)!==null&&M!==void 0?M:Re)!==null&&L!==void 0?L:!0,strictTypes:(B=(z=F.strictTypes)!==null&&z!==void 0?z:Re)!==null&&B!==void 0?B:"log",strictTuples:(fe=(ee=F.strictTuples)!==null&&ee!==void 0?ee:Re)!==null&&fe!==void 0?fe:"log",strictRequired:(He=(je=F.strictRequired)!==null&&je!==void 0?je:Re)!==null&&He!==void 0?He:!1,code:F.code?{...F.code,optimize:Xe,regExp:ue}:{optimize:Xe,regExp:ue},loopRequired:(ze=F.loopRequired)!==null&&ze!==void 0?ze:y,loopEnum:(le=F.loopEnum)!==null&&le!==void 0?le:y,meta:(We=F.meta)!==null&&We!==void 0?We:!0,messages:(Ae=F.messages)!==null&&Ae!==void 0?Ae:!0,inlineRefs:(De=F.inlineRefs)!==null&&De!==void 0?De:!0,schemaId:(Fe=F.schemaId)!==null&&Fe!==void 0?Fe:"$id",addUsedSchema:(Be=F.addUsedSchema)!==null&&Be!==void 0?Be:!0,validateSchema:(he=F.validateSchema)!==null&&he!==void 0?he:!0,validateFormats:(ae=F.validateFormats)!==null&&ae!==void 0?ae:!0,unicodeRegExp:(Me=F.unicodeRegExp)!==null&&Me!==void 0?Me:!0,int32range:(Ge=F.int32range)!==null&&Ge!==void 0?Ge:!0,uriResolver:ke}}class I{constructor(v={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,v=this.opts={...v,...S(v)};const{es5:j,lines:T}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:C,es5:j,lines:T}),this.logger=G(v.logger);const a=v.validateFormats;v.validateFormats=!1,this.RULES=(0,o.getRules)(),D.call(this,$,v,"NOT SUPPORTED"),D.call(this,_,v,"DEPRECATED","warn"),this._metaOpts=H.call(this),v.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),v.keywords&&U.call(this,v.keywords),typeof v.meta=="object"&&this.addMetaSchema(v.meta),O.call(this),v.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:v,meta:j,schemaId:T}=this.opts;let a=f;T==="id"&&(a={...f},a.id=a.$id,delete a.$id),j&&v&&this.addMetaSchema(a,a[T],!1)}defaultMeta(){const{meta:v,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof v=="object"?v[j]||v:void 0}validate(v,j){let T;if(typeof v=="string"){if(T=this.getSchema(v),!T)throw new Error(`no schema with key or ref "${v}"`)}else T=this.compile(v);const a=T(j);return"$async"in T||(this.errors=T.errors),a}compile(v,j){const T=this._addSchema(v,j);return T.validate||this._compileSchemaEnv(T)}compileAsync(v,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:T}=this.opts;return a.call(this,v,j);async function a(B,ee){await m.call(this,B.$schema);const fe=this._addSchema(B,ee);return fe.validate||N.call(this,fe)}async function m(B){B&&!this.getSchema(B)&&await a.call(this,{$ref:B},!0)}async function N(B){try{return this._compileSchemaEnv(B)}catch(ee){if(!(ee instanceof s.default))throw ee;return M.call(this,ee),await L.call(this,ee.missingSchema),N.call(this,B)}}function M({missingSchema:B,missingRef:ee}){if(this.refs[B])throw new Error(`AnySchema ${B} is loaded but ${ee} cannot be resolved`)}async function L(B){const ee=await z.call(this,B);this.refs[B]||await m.call(this,ee.$schema),this.refs[B]||this.addSchema(ee,B,j)}async function z(B){const ee=this._loading[B];if(ee)return ee;try{return await(this._loading[B]=T(B))}finally{delete this._loading[B]}}}addSchema(v,j,T,a=this.opts.validateSchema){if(Array.isArray(v)){for(const N of v)this.addSchema(N,void 0,T,a);return this}let m;if(typeof v=="object"){const{schemaId:N}=this.opts;if(m=v[N],m!==void 0&&typeof m!="string")throw new Error(`schema ${N} must be string`)}return j=(0,u.normalizeId)(j||m),this._checkUnique(j),this.schemas[j]=this._addSchema(v,T,j,a,!0),this}addMetaSchema(v,j,T=this.opts.validateSchema){return this.addSchema(v,j,!0,T),this}validateSchema(v,j){if(typeof v=="boolean")return!0;let T;if(T=v.$schema,T!==void 0&&typeof T!="string")throw new Error("$schema must be a string");if(T=T||this.opts.defaultMeta||this.defaultMeta(),!T)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(T,v);if(!a&&j){const m="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(m);else throw new Error(m)}return a}getSchema(v){let j;for(;typeof(j=w.call(this,v))=="string";)v=j;if(j===void 0){const{schemaId:T}=this.opts,a=new i.SchemaEnv({schema:{},schemaId:T});if(j=i.resolveSchema.call(this,a,v),!j)return;this.refs[v]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(v){if(v instanceof RegExp)return this._removeAllSchemas(this.schemas,v),this._removeAllSchemas(this.refs,v),this;switch(typeof v){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=w.call(this,v);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[v],delete this.refs[v],this}case"object":{const j=v;this._cache.delete(j);let T=v[this.opts.schemaId];return T&&(T=(0,u.normalizeId)(T),delete this.schemas[T],delete this.refs[T]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(v){for(const j of v)this.addKeyword(j);return this}addKeyword(v,j){let T;if(typeof v=="string")T=v,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=T);else if(typeof v=="object"&&j===void 0){if(j=v,T=j.keyword,Array.isArray(T)&&!T.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(ne.call(this,T,j),!j)return(0,p.eachItem)(T,m=>Se.call(this,m)),this;Ne.call(this,j);const a={...j,type:(0,l.getJSONTypes)(j.type),schemaType:(0,l.getJSONTypes)(j.schemaType)};return(0,p.eachItem)(T,a.type.length===0?m=>Se.call(this,m,a):m=>a.type.forEach(N=>Se.call(this,m,a,N))),this}getKeyword(v){const j=this.RULES.all[v];return typeof j=="object"?j.definition:!!j}removeKeyword(v){const{RULES:j}=this;delete j.keywords[v],delete j.all[v];for(const T of j.rules){const a=T.rules.findIndex(m=>m.keyword===v);a>=0&&T.rules.splice(a,1)}return this}addFormat(v,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[v]=j,this}errorsText(v=this.errors,{separator:j=", ",dataVar:T="data"}={}){return!v||v.length===0?"No errors":v.map(a=>`${T}${a.instancePath} ${a.message}`).reduce((a,m)=>a+j+m)}$dataMetaSchema(v,j){const T=this.RULES.all;v=JSON.parse(JSON.stringify(v));for(const a of j){const m=a.split("/").slice(1);let N=v;for(const M of m)N=N[M];for(const M in T){const L=T[M];if(typeof L!="object")continue;const{$data:z}=L.definition,B=N[M];z&&B&&(N[M]=Ie(B))}}return v}_removeAllSchemas(v,j){for(const T in v){const a=v[T];(!j||j.test(T))&&(typeof a=="string"?delete v[T]:a&&!a.meta&&(this._cache.delete(a.schema),delete v[T]))}}_addSchema(v,j,T,a=this.opts.validateSchema,m=this.opts.addUsedSchema){let N;const{schemaId:M}=this.opts;if(typeof v=="object")N=v[M];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof v!="boolean")throw new Error("schema must be object or boolean")}let L=this._cache.get(v);if(L!==void 0)return L;T=(0,u.normalizeId)(N||T);const z=u.getSchemaRefs.call(this,v,T);return L=new i.SchemaEnv({schema:v,schemaId:M,meta:j,baseId:T,localRefs:z}),this._cache.set(L.schema,L),m&&!T.startsWith("#")&&(T&&this._checkUnique(T),this.refs[T]=L),a&&this.validateSchema(v,!0),L}_checkUnique(v){if(this.schemas[v]||this.refs[v])throw new Error(`schema with key or id "${v}" already exists`)}_compileSchemaEnv(v){if(v.meta?this._compileMetaSchema(v):i.compileSchema.call(this,v),!v.validate)throw new Error("ajv implementation error");return v.validate}_compileMetaSchema(v){const j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,v)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function D(F,v,j,T="error"){for(const a in F){const m=a;m in v&&this.logger[T](`${j}: option ${a}. ${F[m]}`)}}function w(F){return F=(0,u.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 v in F)this.addSchema(F[v],v)}function A(){for(const F in this.opts.formats){const v=this.opts.formats[F];v&&this.addFormat(F,v)}}function U(F){if(Array.isArray(F)){this.addVocabulary(F);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const v in F){const j=F[v];j.keyword||(j.keyword=v),this.addKeyword(j)}}function H(){const F={...this.opts};for(const v of E)delete F[v];return F}const X={log(){},warn(){},error(){}};function G(F){if(F===!1)return X;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 de=/^[a-z_$][a-z0-9_$:-]*$/i;function ne(F,v){const{RULES:j}=this;if((0,p.eachItem)(F,T=>{if(j.keywords[T])throw new Error(`Keyword ${T} is already defined`);if(!de.test(T))throw new Error(`Keyword ${T} has invalid name`)}),!!v&&v.$data&&!("code"in v||"validate"in v))throw new Error('$data keyword must have "code" or "validate" function')}function Se(F,v,j){var T;const a=v==null?void 0:v.post;if(j&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:m}=this;let N=a?m.post:m.rules.find(({type:L})=>L===j);if(N||(N={type:j,rules:[]},m.rules.push(N)),m.keywords[F]=!0,!v)return;const M={keyword:F,definition:{...v,type:(0,l.getJSONTypes)(v.type),schemaType:(0,l.getJSONTypes)(v.schemaType)}};v.before?Te.call(this,N,M,v.before):N.rules.push(M),m.all[F]=M,(T=v.implements)===null||T===void 0||T.forEach(L=>this.addKeyword(L))}function Te(F,v,j){const T=F.rules.findIndex(a=>a.keyword===j);T>=0?F.rules.splice(T,0,v):(F.rules.push(v),this.logger.warn(`rule ${j} is not defined`))}function Ne(F){let{metaSchema:v}=F;v!==void 0&&(F.$data&&this.opts.$data&&(v=Ie(v)),F.validateSchema=this.compile(v,!0))}const Ve={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ie(F){return{anyOf:[F,Ve]}}})(core$2);var draft7={},core$1={},id={};Object.defineProperty(id,"__esModule",{value:!0});const def$s={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};id.default=def$s;var ref={};Object.defineProperty(ref,"__esModule",{value:!0});ref.callRef=ref.getValidate=void 0;const ref_error_1=ref_error,code_1$8=code,codegen_1$l=codegen,names_1$1=names$1,compile_1$1=compile,util_1$j=util,def$r={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:i,opts:c,self:u}=n,{root:l}=o;if((r==="#"||r==="#/")&&s===l.baseId)return f();const p=compile_1$1.resolveRef.call(u,l,s,r);if(p===void 0)throw new ref_error_1.default(n.opts.uriResolver,s,r);if(p instanceof compile_1$1.SchemaEnv)return b(p);return P(p);function f(){if(o===l)return callRef(e,i,o,o.$async);const E=t.scopeValue("root",{ref:l});return callRef(e,(0,codegen_1$l._)`${E}.validate`,l,l.$async)}function b(E){const C=getValidate(e,E);callRef(e,C,E,E.$async)}function P(E){const C=t.scopeValue("schema",c.code.source===!0?{ref:E,code:(0,codegen_1$l.stringify)(E)}:{ref:E}),$=t.name("valid"),_=e.subschema({schema:E,dataTypes:[],schemaPath:codegen_1$l.nil,topSchemaRef:C,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:o}=e,{allErrors:i,schemaEnv:c,opts:u}=o,l=u.passContext?names_1$1.default.this:codegen_1$l.nil;n?p():f();function p(){if(!c.$async)throw new Error("async schema referenced by sync schema");const E=s.let("valid");s.try(()=>{s.code((0,codegen_1$l._)`await ${(0,code_1$8.callValidateCode)(e,t,l)}`),P(t),i||s.assign(E,!0)},C=>{s.if((0,codegen_1$l._)`!(${C} instanceof ${o.ValidationError})`,()=>s.throw(C)),b(C),i||s.assign(E,!1)}),e.ok(E)}function f(){e.result((0,code_1$8.callValidateCode)(e,t,l),()=>P(t),()=>b(t))}function b(E){const C=(0,codegen_1$l._)`${E}.errors`;s.assign(names_1$1.default.vErrors,(0,codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${C} : ${names_1$1.default.vErrors}.concat(${C})`),s.assign(names_1$1.default.errors,(0,codegen_1$l._)`${names_1$1.default.vErrors}.length`)}function P(E){var C;if(!o.opts.unevaluated)return;const $=(C=r==null?void 0:r.validate)===null||C===void 0?void 0:C.evaluated;if(o.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(o.props=util_1$j.mergeEvaluated.props(s,$.props,o.props));else{const _=s.var("props",(0,codegen_1$l._)`${E}.evaluated.props`);o.props=util_1$j.mergeEvaluated.props(s,_,o.props,codegen_1$l.Name)}if(o.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(o.items=util_1$j.mergeEvaluated.items(s,$.items,o.items));else{const _=s.var("items",(0,codegen_1$l._)`${E}.evaluated.items`);o.items=util_1$j.mergeEvaluated.items(s,_,o.items,codegen_1$l.Name)}}}ref.callRef=callRef;ref.default=def$r;Object.defineProperty(core$1,"__esModule",{value:!0});const id_1=id,ref_1=ref,core=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",id_1.default,ref_1.default];core$1.default=core;var validation$1={},limitNumber={};Object.defineProperty(limitNumber,"__esModule",{value:!0});const codegen_1$k=codegen,ops=codegen_1$k.operators,KWDs={maximum:{okStr:"<=",ok:ops.LTE,fail:ops.GT},minimum:{okStr:">=",ok:ops.GTE,fail:ops.LT},exclusiveMaximum:{okStr:"<",ok:ops.LT,fail:ops.GTE},exclusiveMinimum:{okStr:">",ok:ops.GT,fail:ops.LTE}},error$i={message:({keyword:e,schemaCode:t})=>(0,codegen_1$k.str)`must be ${KWDs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,codegen_1$k._)`{comparison: ${KWDs[e].okStr}, limit: ${t}}`},def$q={keyword:Object.keys(KWDs),type:"number",schemaType:"number",$data:!0,error:error$i,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,codegen_1$k._)`${r} ${KWDs[t].fail} ${n} || isNaN(${r})`)}};limitNumber.default=def$q;var multipleOf={};Object.defineProperty(multipleOf,"__esModule",{value:!0});const codegen_1$j=codegen,error$h={message:({schemaCode:e})=>(0,codegen_1$j.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,codegen_1$j._)`{multipleOf: ${e}}`},def$p={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:error$h,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),c=o?(0,codegen_1$j._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,codegen_1$j._)`${i} !== parseInt(${i})`;e.fail$data((0,codegen_1$j._)`(${n} === 0 || (${i} = ${r}/${n}, ${c}))`)}};multipleOf.default=def$p;var limitLength={},ucs2length$1={};Object.defineProperty(ucs2length$1,"__esModule",{value:!0});function ucs2length(e){const t=e.length;let r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}ucs2length$1.default=ucs2length;ucs2length.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(limitLength,"__esModule",{value:!0});const codegen_1$i=codegen,util_1$i=util,ucs2length_1=ucs2length$1,error$g={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,codegen_1$i.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,codegen_1$i._)`{limit: ${e}}`},def$o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:error$g,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?codegen_1$i.operators.GT:codegen_1$i.operators.LT,i=s.opts.unicode===!1?(0,codegen_1$i._)`${r}.length`:(0,codegen_1$i._)`${(0,util_1$i.useFunc)(e.gen,ucs2length_1.default)}(${r})`;e.fail$data((0,codegen_1$i._)`${i} ${o} ${n}`)}};limitLength.default=def$o;var pattern={};Object.defineProperty(pattern,"__esModule",{value:!0});const code_1$7=code,codegen_1$h=codegen,error$f={message:({schemaCode:e})=>(0,codegen_1$h.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,codegen_1$h._)`{pattern: ${e}}`},def$n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:error$f,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,i=o.opts.unicodeRegExp?"u":"",c=r?(0,codegen_1$h._)`(new RegExp(${s}, ${i}))`:(0,code_1$7.usePattern)(e,n);e.fail$data((0,codegen_1$h._)`!${c}.test(${t})`)}};pattern.default=def$n;var limitProperties={};Object.defineProperty(limitProperties,"__esModule",{value:!0});const codegen_1$g=codegen,error$e={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,codegen_1$g.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,codegen_1$g._)`{limit: ${e}}`},def$m={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:error$e,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?codegen_1$g.operators.GT:codegen_1$g.operators.LT;e.fail$data((0,codegen_1$g._)`Object.keys(${r}).length ${s} ${n}`)}};limitProperties.default=def$m;var required={};Object.defineProperty(required,"__esModule",{value:!0});const code_1$6=code,codegen_1$f=codegen,util_1$h=util,error$d={message:({params:{missingProperty:e}})=>(0,codegen_1$f.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,codegen_1$f._)`{missingProperty: ${e}}`},def$l={keyword:"required",type:"object",schemaType:"array",$data:!0,error:error$d,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:i}=e,{opts:c}=i;if(!o&&r.length===0)return;const u=r.length>=c.loopRequired;if(i.allErrors?l():p(),c.strictRequired){const P=e.parentSchema.properties,{definedProperties:E}=e.it;for(const C of r)if((P==null?void 0:P[C])===void 0&&!E.has(C)){const $=i.schemaEnv.baseId+i.errSchemaPath,_=`required property "${C}" is not defined at "${$}" (strictRequired)`;(0,util_1$h.checkStrictMode)(i,_,i.opts.strictRequired)}}function l(){if(u||o)e.block$data(codegen_1$f.nil,f);else for(const P of r)(0,code_1$6.checkReportMissingProp)(e,P)}function p(){const P=t.let("missing");if(u||o){const E=t.let("valid",!0);e.block$data(E,()=>b(P,E)),e.ok(E)}else t.if((0,code_1$6.checkMissingProp)(e,r,P)),(0,code_1$6.reportMissingProp)(e,P),t.else()}function f(){t.forOf("prop",n,P=>{e.setParams({missingProperty:P}),t.if((0,code_1$6.noPropertyInData)(t,s,P,c.ownProperties),()=>e.error())})}function b(P,E){e.setParams({missingProperty:P}),t.forOf(P,n,()=>{t.assign(E,(0,code_1$6.propertyInData)(t,s,P,c.ownProperties)),t.if((0,codegen_1$f.not)(E),()=>{e.error(),t.break()})},codegen_1$f.nil)}}};required.default=def$l;var limitItems={};Object.defineProperty(limitItems,"__esModule",{value:!0});const codegen_1$e=codegen,error$c={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,codegen_1$e.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,codegen_1$e._)`{limit: ${e}}`},def$k={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:error$c,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?codegen_1$e.operators.GT:codegen_1$e.operators.LT;e.fail$data((0,codegen_1$e._)`${r}.length ${s} ${n}`)}};limitItems.default=def$k;var uniqueItems={},equal$1={};Object.defineProperty(equal$1,"__esModule",{value:!0});const equal=fastDeepEqual;equal.code='require("ajv/dist/runtime/equal").default';equal$1.default=equal;Object.defineProperty(uniqueItems,"__esModule",{value:!0});const dataType_1=dataType,codegen_1$d=codegen,util_1$g=util,equal_1$2=equal$1,error$b={message:({params:{i:e,j:t}})=>(0,codegen_1$d.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,codegen_1$d._)`{i: ${e}, j: ${t}}`},def$j={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:error$b,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:c}=e;if(!n&&!s)return;const u=t.let("valid"),l=o.items?(0,dataType_1.getSchemaTypes)(o.items):[];e.block$data(u,p,(0,codegen_1$d._)`${i} === false`),e.ok(u);function p(){const E=t.let("i",(0,codegen_1$d._)`${r}.length`),C=t.let("j");e.setParams({i:E,j:C}),t.assign(u,!0),t.if((0,codegen_1$d._)`${E} > 1`,()=>(f()?b:P)(E,C))}function f(){return l.length>0&&!l.some(E=>E==="object"||E==="array")}function b(E,C){const $=t.name("item"),_=(0,dataType_1.checkDataTypes)(l,$,c.opts.strictNumbers,dataType_1.DataType.Wrong),y=t.const("indices",(0,codegen_1$d._)`{}`);t.for((0,codegen_1$d._)`;${E}--;`,()=>{t.let($,(0,codegen_1$d._)`${r}[${E}]`),t.if(_,(0,codegen_1$d._)`continue`),l.length>1&&t.if((0,codegen_1$d._)`typeof ${$} == "string"`,(0,codegen_1$d._)`${$} += "_"`),t.if((0,codegen_1$d._)`typeof ${y}[${$}] == "number"`,()=>{t.assign(C,(0,codegen_1$d._)`${y}[${$}]`),e.error(),t.assign(u,!1).break()}).code((0,codegen_1$d._)`${y}[${$}] = ${E}`)})}function P(E,C){const $=(0,util_1$g.useFunc)(t,equal_1$2.default),_=t.name("outer");t.label(_).for((0,codegen_1$d._)`;${E}--;`,()=>t.for((0,codegen_1$d._)`${C} = ${E}; ${C}--;`,()=>t.if((0,codegen_1$d._)`${$}(${r}[${E}], ${r}[${C}])`,()=>{e.error(),t.assign(u,!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:o}=e;n||o&&typeof o=="object"?e.fail$data((0,codegen_1$c._)`!${(0,util_1$f.useFunc)(t,equal_1$1.default)}(${r}, ${s})`):e.fail((0,codegen_1$c._)`${o} !== ${r}`)}};_const.default=def$i;var _enum={};Object.defineProperty(_enum,"__esModule",{value:!0});const codegen_1$b=codegen,util_1$e=util,equal_1=equal$1,error$9={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,codegen_1$b._)`{allowedValues: ${e}}`},def$h={keyword:"enum",schemaType:"array",$data:!0,error:error$9,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:i}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const c=s.length>=i.opts.loopEnum;let u;const l=()=>u??(u=(0,util_1$e.useFunc)(t,equal_1.default));let p;if(c||n)p=t.let("valid"),e.block$data(p,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const P=t.const("vSchema",o);p=(0,codegen_1$b.or)(...s.map((E,C)=>b(P,C)))}e.pass(p);function f(){t.assign(p,!1),t.forOf("v",o,P=>t.if((0,codegen_1$b._)`${l()}(${r}, ${P})`,()=>t.assign(p,!0).break()))}function b(P,E){const C=s[E];return typeof C=="object"&&C!==null?(0,codegen_1$b._)`${l()}(${r}, ${P}[${E}])`:(0,codegen_1$b._)`${r} === ${C}`}}};_enum.default=def$h;Object.defineProperty(validation$1,"__esModule",{value:!0});const limitNumber_1=limitNumber,multipleOf_1=multipleOf,limitLength_1=limitLength,pattern_1=pattern,limitProperties_1=limitProperties,required_1=required,limitItems_1=limitItems,uniqueItems_1=uniqueItems,const_1=_const,enum_1=_enum,validation=[limitNumber_1.default,multipleOf_1.default,limitLength_1.default,pattern_1.default,limitProperties_1.default,required_1.default,limitItems_1.default,uniqueItems_1.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},const_1.default,enum_1.default];validation$1.default=validation;var applicator={},additionalItems={};Object.defineProperty(additionalItems,"__esModule",{value:!0});additionalItems.validateAdditionalItems=void 0;const codegen_1$a=codegen,util_1$d=util,error$8={message:({params:{len:e}})=>(0,codegen_1$a.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,codegen_1$a._)`{limit: ${e}}`},def$g={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:error$8,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,util_1$d.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(e,n)}};function validateAdditionalItems(e,t){const{gen:r,schema:n,data:s,keyword:o,it:i}=e;i.items=!0;const c=r.const("len",(0,codegen_1$a._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,codegen_1$a._)`${c} <= ${t.length}`);else if(typeof n=="object"&&!(0,util_1$d.alwaysValidSchema)(i,n)){const l=r.var("valid",(0,codegen_1$a._)`${c} <= ${t.length}`);r.if((0,codegen_1$a.not)(l),()=>u(l)),e.ok(l)}function u(l){r.forRange("i",t.length,c,p=>{e.subschema({keyword:o,dataProp:p,dataPropType:util_1$d.Type.Num},l),i.allErrors||r.if((0,codegen_1$a.not)(l),()=>r.break())})}}additionalItems.validateAdditionalItems=validateAdditionalItems;additionalItems.default=def$g;var prefixItems={},items={};Object.defineProperty(items,"__esModule",{value:!0});items.validateTuple=void 0;const codegen_1$9=codegen,util_1$c=util,code_1$5=code,def$f={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return validateTuple(e,"additionalItems",t);r.items=!0,!(0,util_1$c.alwaysValidSchema)(r,t)&&e.ok((0,code_1$5.validateArray)(e))}};function validateTuple(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:c}=e;p(s),c.opts.unevaluated&&r.length&&c.items!==!0&&(c.items=util_1$c.mergeEvaluated.items(n,r.length,c.items));const u=n.name("valid"),l=n.const("len",(0,codegen_1$9._)`${o}.length`);r.forEach((f,b)=>{(0,util_1$c.alwaysValidSchema)(c,f)||(n.if((0,codegen_1$9._)`${l} > ${b}`,()=>e.subschema({keyword:i,schemaProp:b,dataProp:b},u)),e.ok(u))});function p(f){const{opts:b,errSchemaPath:P}=c,E=r.length,C=E===f.minItems&&(E===f.maxItems||f[t]===!1);if(b.strictTuples&&!C){const $=`"${i}" is ${E}-tuple, but minItems or maxItems/${t} are not specified or different at path "${P}"`;(0,util_1$c.checkStrictMode)(c,$,b.strictTuples)}}}items.validateTuple=validateTuple;items.default=def$f;Object.defineProperty(prefixItems,"__esModule",{value:!0});const items_1$1=items,def$e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,items_1$1.validateTuple)(e,"items")};prefixItems.default=def$e;var items2020={};Object.defineProperty(items2020,"__esModule",{value:!0});const codegen_1$8=codegen,util_1$b=util,code_1$4=code,additionalItems_1$1=additionalItems,error$7={message:({params:{len:e}})=>(0,codegen_1$8.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,codegen_1$8._)`{limit: ${e}}`},def$d={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:error$7,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,util_1$b.alwaysValidSchema)(n,t)&&(s?(0,additionalItems_1$1.validateAdditionalItems)(e,s):e.ok((0,code_1$4.validateArray)(e)))}};items2020.default=def$d;var contains={};Object.defineProperty(contains,"__esModule",{value:!0});const codegen_1$7=codegen,util_1$a=util,error$6={message:({params:{min:e,max:t}})=>t===void 0?(0,codegen_1$7.str)`must contain at least ${e} valid item(s)`:(0,codegen_1$7.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,codegen_1$7._)`{minContains: ${e}}`:(0,codegen_1$7._)`{minContains: ${e}, maxContains: ${t}}`},def$c={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:error$6,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let i,c;const{minContains:u,maxContains:l}=n;o.opts.next?(i=u===void 0?1:u,c=l):i=1;const p=t.const("len",(0,codegen_1$7._)`${s}.length`);if(e.setParams({min:i,max:c}),c===void 0&&i===0){(0,util_1$a.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(c!==void 0&&i>c){(0,util_1$a.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,util_1$a.alwaysValidSchema)(o,r)){let C=(0,codegen_1$7._)`${p} >= ${i}`;c!==void 0&&(C=(0,codegen_1$7._)`${C} && ${p} <= ${c}`),e.pass(C);return}o.items=!0;const f=t.name("valid");c===void 0&&i===1?P(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),c!==void 0&&t.if((0,codegen_1$7._)`${s}.length > 0`,b)):(t.let(f,!1),b()),e.result(f,()=>e.reset());function b(){const C=t.name("_valid"),$=t.let("count",0);P(C,()=>t.if(C,()=>E($)))}function P(C,$){t.forRange("i",0,p,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:util_1$a.Type.Num,compositeRule:!0},C),$()})}function E(C){t.code((0,codegen_1$7._)`${C}++`),c===void 0?t.if((0,codegen_1$7._)`${C} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,codegen_1$7._)`${C} > ${c}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,codegen_1$7._)`${C} >= ${i}`,()=>t.assign(f,!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:u,depsCount:l,deps:p}})=>{const f=l===1?"property":"properties";return(0,t.str)`must have ${f} ${p} when property ${u} is present`},params:({params:{property:u,depsCount:l,deps:p,missingProperty:f}})=>(0,t._)`{property: ${u},
|
|
670
|
-
missingProperty: ${
|
|
630
|
+
${s}`)}}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 ga=()=>{};class $a extends _n{constructor(t,r){super(r),this.resource=t}getURL(){return this.resource.url}get caption(){return this.resource.caption??super.caption}}class _a extends _n{constructor(t,r){super(r),this.resource=t}get name(){return Mr(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/theme/${Ti(this.resource.slug)}`}}class wa extends _n{constructor(t,r){super(r),this.resource=t}get name(){return Mr(this.resource.slug)}getURL(){return`https://downloads.wordpress.org/plugin/${Ti(this.resource.slug)}`}}function Ti(e){return!e||e.endsWith(".zip")?e:e+".latest-stable.zip"}class Ri extends ft{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 va extends Ri{async resolve(){return this.promise||(this.promise=super.resolve()),this.promise}}class ba extends Ri{constructor(t,r){super(t),this.semaphore=r}async resolve(){return this.isAsync?this.semaphore.run(()=>super.resolve()):super.resolve()}}var sn={exports:{}},ki={},Ne={},kt={},Xt={},B={},Yt={};(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($){if(super(),!e.IDENTIFIER.test($))throw new Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor($){super(),this._items=typeof $=="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((S,I)=>`${S}${I}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((S,I)=>(I instanceof r&&(S[I.str]=(S[I.str]||0)+1),S),{})}}e._Code=n,e.nil=new n("");function s(g,...$){const S=[g[0]];let I=0;for(;I<$.length;)u(S,$[I]),S.push(g[++I]);return new n(S)}e._=s;const i=new n("+");function o(g,...$){const S=[E(g[0])];let I=0;for(;I<$.length;)S.push(i),u(S,$[I]),S.push(i,E(g[++I]));return f(S),new n(S)}e.str=o;function u(g,$){$ instanceof n?g.push(...$._items):$ instanceof r?g.push($):g.push(p($))}e.addCodeArg=u;function f(g){let $=1;for(;$<g.length-1;){if(g[$]===i){const S=l(g[$-1],g[$+1]);if(S!==void 0){g.splice($-1,3,S);continue}g[$++]="+"}$++}}function l(g,$){if($==='""')return g;if(g==='""')return $;if(typeof g=="string")return $ instanceof r||g[g.length-1]!=='"'?void 0:typeof $!="string"?`${g.slice(0,-1)}${$}"`:$[0]==='"'?g.slice(0,-1)+$.slice(1):void 0;if(typeof $=="string"&&$[0]==='"'&&!(g instanceof r))return`"${g}${$.slice(1)}`}function d(g,$){return $.emptyStr()?g:g.emptyStr()?$:o`${g}${$}`}e.strConcat=d;function p(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:E(Array.isArray(g)?g.join(","):g)}function b(g){return new n(E(g))}e.stringify=b;function E(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=E;function P(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new n(`.${g}`):s`[${g}]`}e.getProperty=P;function O(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new n(`${g}`);throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=O;function _(g){return new n(g.toString())}e.regexpCode=_})(Yt);var on={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Yt;class r extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var n;(function(f){f[f.Started=0]="Started",f[f.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:l,parent:d}={}){this._names={},this._prefixes=l,this._parent=d}toName(l){return l instanceof t.Name?l:this.name(l)}name(l){return new t.Name(this._newName(l))}_newName(l){const d=this._names[l]||this._nameGroup(l);return`${l}${d.index++}`}_nameGroup(l){var d,p;if(!((p=(d=this._parent)===null||d===void 0?void 0:d._prefixes)===null||p===void 0)&&p.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}e.Scope=s;class i extends t.Name{constructor(l,d){super(d),this.prefix=l}setValue(l,{property:d,itemIndex:p}){this.value=l,this.scopePath=(0,t._)`.${new t.Name(d)}[${p}]`}}e.ValueScopeName=i;const o=(0,t._)`\n`;class u extends s{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?o:t.nil}}get(){return this._scope}name(l){return new i(l,this._newName(l))}value(l,d){var p;if(d.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const b=this.toName(l),{prefix:E}=b,P=(p=d.key)!==null&&p!==void 0?p:d.ref;let O=this._values[E];if(O){const $=O.get(P);if($)return $}else O=this._values[E]=new Map;O.set(P,b);const _=this._scope[E]||(this._scope[E]=[]),g=_.length;return _[g]=d.ref,b.setValue(d,{property:E,itemIndex:g}),b}getValue(l,d){const p=this._values[l];if(p)return p.get(d)}scopeRefs(l,d=this._values){return this._reduceValues(d,p=>{if(p.scopePath===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return(0,t._)`${l}${p.scopePath}`})}scopeCode(l=this._values,d,p){return this._reduceValues(l,b=>{if(b.value===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return b.value.code},d,p)}_reduceValues(l,d,p={},b){let E=t.nil;for(const P in l){const O=l[P];if(!O)continue;const _=p[P]=p[P]||new Map;O.forEach(g=>{if(_.has(g))return;_.set(g,n.Started);let $=d(g);if($){const S=this.opts.es5?e.varKinds.var:e.varKinds.const;E=(0,t._)`${E}${S} ${g} = ${$};${this.opts._n}`}else if($=b==null?void 0:b(g))E=(0,t._)`${E}${$}${this.opts._n}`;else throw new r(g);_.set(g,n.Completed)})}return E}}e.ValueScope=u})(on);(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=Yt,r=on;var n=Yt;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=on;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(a,m){return this}}class o extends i{constructor(a,m,N){super(),this.varKind=a,this.name=m,this.rhs=N}render({es5:a,_n:m}){const N=a?r.varKinds.var:this.varKind,L=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${L};`+m}optimizeNames(a,m){if(a[this.name.str])return this.rhs&&(this.rhs=de(this.rhs,a,m)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class u extends i{constructor(a,m,N){super(),this.lhs=a,this.rhs=m,this.sideEffects=N}render({_n:a}){return`${this.lhs} = ${this.rhs};`+a}optimizeNames(a,m){if(!(this.lhs instanceof t.Name&&!a[this.lhs.str]&&!this.sideEffects))return this.rhs=de(this.rhs,a,m),this}get names(){const a=this.lhs instanceof t.Name?{}:{...this.lhs.names};return Ee(a,this.rhs)}}class f extends u{constructor(a,m,N,L){super(a,N,L),this.op=m}render({_n:a}){return`${this.lhs} ${this.op}= ${this.rhs};`+a}}class l extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`${this.label}:`+a}}class d extends i{constructor(a){super(),this.label=a,this.names={}}render({_n:a}){return`break${this.label?` ${this.label}`:""};`+a}}class p extends i{constructor(a){super(),this.error=a}render({_n:a}){return`throw ${this.error};`+a}get names(){return this.error.names}}class b extends i{constructor(a){super(),this.code=a}render({_n:a}){return`${this.code};`+a}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(a,m){return this.code=de(this.code,a,m),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class E extends i{constructor(a=[]){super(),this.nodes=a}render(a){return this.nodes.reduce((m,N)=>m+N.render(a),"")}optimizeNodes(){const{nodes:a}=this;let m=a.length;for(;m--;){const N=a[m].optimizeNodes();Array.isArray(N)?a.splice(m,1,...N):N?a[m]=N:a.splice(m,1)}return a.length>0?this:void 0}optimizeNames(a,m){const{nodes:N}=this;let L=N.length;for(;L--;){const F=N[L];F.optimizeNames(a,m)||(Xe(a,F.names),N.splice(L,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((a,m)=>Y(a,m.names),{})}}class P extends E{render(a){return"{"+a._n+super.render(a)+"}"+a._n}}class O extends E{}class _ extends P{}_.kind="else";class g extends P{constructor(a,m){super(m),this.condition=a}render(a){let m=`if(${this.condition})`+super.render(a);return this.else&&(m+="else "+this.else.render(a)),m}optimizeNodes(){super.optimizeNodes();const a=this.condition;if(a===!0)return this.nodes;let m=this.else;if(m){const N=m.optimizeNodes();m=this.else=Array.isArray(N)?new _(N):N}if(m)return a===!1?m instanceof g?m:m.nodes:this.nodes.length?this:new g(et(a),m instanceof g?[m]:m.nodes);if(!(a===!1||!this.nodes.length))return this}optimizeNames(a,m){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(a,m),!!(super.optimizeNames(a,m)||this.else))return this.condition=de(this.condition,a,m),this}get names(){const a=super.names;return Ee(a,this.condition),this.else&&Y(a,this.else.names),a}}g.kind="if";class $ extends P{}$.kind="for";class S extends ${constructor(a){super(),this.iteration=a}render(a){return`for(${this.iteration})`+super.render(a)}optimizeNames(a,m){if(super.optimizeNames(a,m))return this.iteration=de(this.iteration,a,m),this}get names(){return Y(super.names,this.iteration.names)}}class I extends ${constructor(a,m,N,L){super(),this.varKind=a,this.name=m,this.from=N,this.to=L}render(a){const m=a.es5?r.varKinds.var:this.varKind,{name:N,from:L,to:F}=this;return`for(${m} ${N}=${L}; ${N}<${F}; ${N}++)`+super.render(a)}get names(){const a=Ee(super.names,this.from);return Ee(a,this.to)}}class D extends ${constructor(a,m,N,L){super(),this.loop=a,this.varKind=m,this.name=N,this.iterable=L}render(a){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(a)}optimizeNames(a,m){if(super.optimizeNames(a,m))return this.iterable=de(this.iterable,a,m),this}get names(){return Y(super.names,this.iterable.names)}}class v extends P{constructor(a,m,N){super(),this.name=a,this.args=m,this.async=N}render(a){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(a)}}v.kind="func";class C extends E{render(a){return"return "+super.render(a)}}C.kind="return";class A extends P{render(a){let m="try"+super.render(a);return this.catch&&(m+=this.catch.render(a)),this.finally&&(m+=this.finally.render(a)),m}optimizeNodes(){var a,m;return super.optimizeNodes(),(a=this.catch)===null||a===void 0||a.optimizeNodes(),(m=this.finally)===null||m===void 0||m.optimizeNodes(),this}optimizeNames(a,m){var N,L;return super.optimizeNames(a,m),(N=this.catch)===null||N===void 0||N.optimizeNames(a,m),(L=this.finally)===null||L===void 0||L.optimizeNames(a,m),this}get names(){const a=super.names;return this.catch&&Y(a,this.catch.names),this.finally&&Y(a,this.finally.names),a}}class W extends P{constructor(a){super(),this.error=a}render(a){return`catch(${this.error})`+super.render(a)}}W.kind="catch";class G extends P{render(a){return"finally"+super.render(a)}}G.kind="finally";class ie{constructor(a,m={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...m,_n:m.lines?`
|
|
631
|
+
`:""},this._extScope=a,this._scope=new r.Scope({parent:a}),this._nodes=[new O]}toString(){return this._root.render(this.opts)}name(a){return this._scope.name(a)}scopeName(a){return this._extScope.name(a)}scopeValue(a,m){const N=this._extScope.value(a,m);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(a,m){return this._extScope.getValue(a,m)}scopeRefs(a){return this._extScope.scopeRefs(a,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(a,m,N,L){const F=this._scope.toName(m);return N!==void 0&&L&&(this._constants[F.str]=N),this._leafNode(new o(a,F,N)),F}const(a,m,N){return this._def(r.varKinds.const,a,m,N)}let(a,m,N){return this._def(r.varKinds.let,a,m,N)}var(a,m,N){return this._def(r.varKinds.var,a,m,N)}assign(a,m,N){return this._leafNode(new u(a,m,N))}add(a,m){return this._leafNode(new f(a,e.operators.ADD,m))}code(a){return typeof a=="function"?a():a!==t.nil&&this._leafNode(new b(a)),this}object(...a){const m=["{"];for(const[N,L]of a)m.length>1&&m.push(","),m.push(N),(N!==L||this.opts.es5)&&(m.push(":"),(0,t.addCodeArg)(m,L));return m.push("}"),new t._Code(m)}if(a,m,N){if(this._blockNode(new g(a)),m&&N)this.code(m).else().code(N).endIf();else if(m)this.code(m).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(a){return this._elseNode(new g(a))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(g,_)}_for(a,m){return this._blockNode(a),m&&this.code(m).endFor(),this}for(a,m){return this._for(new S(a),m)}forRange(a,m,N,L,F=this.opts.es5?r.varKinds.var:r.varKinds.let){const K=this._scope.toName(a);return this._for(new I(F,K,m,N),()=>L(K))}forOf(a,m,N,L=r.varKinds.const){const F=this._scope.toName(a);if(this.opts.es5){const K=m instanceof t.Name?m:this.var("_arr",m);return this.forRange("_i",0,(0,t._)`${K}.length`,Q=>{this.var(F,(0,t._)`${K}[${Q}]`),N(F)})}return this._for(new D("of",L,F,m),()=>N(F))}forIn(a,m,N,L=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(a,(0,t._)`Object.keys(${m})`,N);const F=this._scope.toName(a);return this._for(new D("in",L,F,m),()=>N(F))}endFor(){return this._endBlockNode($)}label(a){return this._leafNode(new l(a))}break(a){return this._leafNode(new d(a))}return(a){const m=new C;if(this._blockNode(m),this.code(a),m.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(C)}try(a,m,N){if(!m&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const L=new A;if(this._blockNode(L),this.code(a),m){const F=this.name("e");this._currNode=L.catch=new W(F),m(F)}return N&&(this._currNode=L.finally=new G,this.code(N)),this._endBlockNode(W,G)}throw(a){return this._leafNode(new p(a))}block(a,m){return this._blockStarts.push(this._nodes.length),a&&this.code(a).endBlock(m),this}endBlock(a){const m=this._blockStarts.pop();if(m===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-m;if(N<0||a!==void 0&&N!==a)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${a} expected`);return this._nodes.length=m,this}func(a,m=t.nil,N,L){return this._blockNode(new v(a,m,N)),L&&this.code(L).endFunc(),this}endFunc(){return this._endBlockNode(v)}optimize(a=1){for(;a-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(a){return this._currNode.nodes.push(a),this}_blockNode(a){this._currNode.nodes.push(a),this._nodes.push(a)}_endBlockNode(a,m){const N=this._currNode;if(N instanceof a||m&&N instanceof m)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${m?`${a.kind}/${m.kind}`:a.kind}"`)}_elseNode(a){const m=this._currNode;if(!(m instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=m.else=a,this}get _root(){return this._nodes[0]}get _currNode(){const a=this._nodes;return a[a.length-1]}set _currNode(a){const m=this._nodes;m[m.length-1]=a}}e.CodeGen=ie;function Y(T,a){for(const m in a)T[m]=(T[m]||0)+(a[m]||0);return T}function Ee(T,a){return a instanceof t._CodeOrName?Y(T,a.names):T}function de(T,a,m){if(T instanceof t.Name)return N(T);if(!L(T))return T;return new t._Code(T._items.reduce((F,K)=>(K instanceof t.Name&&(K=N(K)),K instanceof t._Code?F.push(...K._items):F.push(K),F),[]));function N(F){const K=m[F.str];return K===void 0||a[F.str]!==1?F:(delete a[F.str],K)}function L(F){return F instanceof t._Code&&F._items.some(K=>K instanceof t.Name&&a[K.str]===1&&m[K.str]!==void 0)}}function Xe(T,a){for(const m in a)T[m]=(T[m]||0)-(a[m]||0)}function et(T){return typeof T=="boolean"||typeof T=="number"||T===null?!T:(0,t._)`!${j(T)}`}e.not=et;const pt=w(e.operators.AND);function It(...T){return T.reduce(pt)}e.and=It;const ht=w(e.operators.OR);function M(...T){return T.reduce(ht)}e.or=M;function w(T){return(a,m)=>a===t.nil?m:m===t.nil?a:(0,t._)`${j(a)} ${T} ${j(m)}`}function j(T){return T instanceof t.Name?T:(0,t._)`(${T})`}})(B);var X={};(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=B,r=Yt;function n(v){const C={};for(const A of v)C[A]=!0;return C}e.toHash=n;function s(v,C){return typeof C=="boolean"?C:Object.keys(C).length===0?!0:(i(v,C),!o(C,v.self.RULES.all))}e.alwaysValidSchema=s;function i(v,C=v.schema){const{opts:A,self:W}=v;if(!A.strictSchema||typeof C=="boolean")return;const G=W.RULES.keywords;for(const ie in C)G[ie]||D(v,`unknown keyword: "${ie}"`)}e.checkUnknownRules=i;function o(v,C){if(typeof v=="boolean")return!v;for(const A in v)if(C[A])return!0;return!1}e.schemaHasRules=o;function u(v,C){if(typeof v=="boolean")return!v;for(const A in v)if(A!=="$ref"&&C.all[A])return!0;return!1}e.schemaHasRulesButRef=u;function f({topSchemaRef:v,schemaPath:C},A,W,G){if(!G){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return(0,t._)`${A}`}return(0,t._)`${v}${C}${(0,t.getProperty)(W)}`}e.schemaRefOrVal=f;function l(v){return b(decodeURIComponent(v))}e.unescapeFragment=l;function d(v){return encodeURIComponent(p(v))}e.escapeFragment=d;function p(v){return typeof v=="number"?`${v}`:v.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=p;function b(v){return v.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=b;function E(v,C){if(Array.isArray(v))for(const A of v)C(A);else C(v)}e.eachItem=E;function P({mergeNames:v,mergeToName:C,mergeValues:A,resultToName:W}){return(G,ie,Y,Ee)=>{const de=Y===void 0?ie:Y instanceof t.Name?(ie instanceof t.Name?v(G,ie,Y):C(G,ie,Y),Y):ie instanceof t.Name?(C(G,Y,ie),ie):A(ie,Y);return Ee===t.Name&&!(de instanceof t.Name)?W(G,de):de}}e.mergeEvaluated={props:P({mergeNames:(v,C,A)=>v.if((0,t._)`${A} !== true && ${C} !== undefined`,()=>{v.if((0,t._)`${C} === true`,()=>v.assign(A,!0),()=>v.assign(A,(0,t._)`${A} || {}`).code((0,t._)`Object.assign(${A}, ${C})`))}),mergeToName:(v,C,A)=>v.if((0,t._)`${A} !== true`,()=>{C===!0?v.assign(A,!0):(v.assign(A,(0,t._)`${A} || {}`),_(v,A,C))}),mergeValues:(v,C)=>v===!0?!0:{...v,...C},resultToName:O}),items:P({mergeNames:(v,C,A)=>v.if((0,t._)`${A} !== true && ${C} !== undefined`,()=>v.assign(A,(0,t._)`${C} === true ? true : ${A} > ${C} ? ${A} : ${C}`)),mergeToName:(v,C,A)=>v.if((0,t._)`${A} !== true`,()=>v.assign(A,C===!0?!0:(0,t._)`${A} > ${C} ? ${A} : ${C}`)),mergeValues:(v,C)=>v===!0?!0:Math.max(v,C),resultToName:(v,C)=>v.var("items",C)})};function O(v,C){if(C===!0)return v.var("props",!0);const A=v.var("props",(0,t._)`{}`);return C!==void 0&&_(v,A,C),A}e.evaluatedPropsToName=O;function _(v,C,A){Object.keys(A).forEach(W=>v.assign((0,t._)`${C}${(0,t.getProperty)(W)}`,!0))}e.setEvaluated=_;const g={};function $(v,C){return v.scopeValue("func",{ref:C,code:g[C.code]||(g[C.code]=new r._Code(C.code))})}e.useFunc=$;var S;(function(v){v[v.Num=0]="Num",v[v.Str=1]="Str"})(S=e.Type||(e.Type={}));function I(v,C,A){if(v instanceof t.Name){const W=C===S.Num;return A?W?(0,t._)`"[" + ${v} + "]"`:(0,t._)`"['" + ${v} + "']"`:W?(0,t._)`"/" + ${v}`:(0,t._)`"/" + ${v}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,t.getProperty)(v).toString():"/"+p(v)}e.getErrorPath=I;function D(v,C,A=v.opts.strictSchema){if(A){if(C=`strict mode: ${C}`,A===!0)throw new Error(C);v.self.logger.warn(C)}}e.checkStrictMode=D})(X);var We={};Object.defineProperty(We,"__esModule",{value:!0});const ge=B,Ea={data:new ge.Name("data"),valCxt:new ge.Name("valCxt"),instancePath:new ge.Name("instancePath"),parentData:new ge.Name("parentData"),parentDataProperty:new ge.Name("parentDataProperty"),rootData:new ge.Name("rootData"),dynamicAnchors:new ge.Name("dynamicAnchors"),vErrors:new ge.Name("vErrors"),errors:new ge.Name("errors"),this:new ge.Name("this"),self:new ge.Name("self"),scope:new ge.Name("scope"),json:new ge.Name("json"),jsonPos:new ge.Name("jsonPos"),jsonLen:new ge.Name("jsonLen"),jsonPart:new ge.Name("jsonPart")};We.default=Ea;(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=B,r=X,n=We;e.keywordError={message:({keyword:_})=>(0,t.str)`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:g})=>g?(0,t.str)`"${_}" keyword must be ${g} ($data)`:(0,t.str)`"${_}" keyword is invalid ($data)`};function s(_,g=e.keywordError,$,S){const{it:I}=_,{gen:D,compositeRule:v,allErrors:C}=I,A=p(_,g,$);S??(v||C)?f(D,A):l(I,(0,t._)`[${A}]`)}e.reportError=s;function i(_,g=e.keywordError,$){const{it:S}=_,{gen:I,compositeRule:D,allErrors:v}=S,C=p(_,g,$);f(I,C),D||v||l(S,n.default.vErrors)}e.reportExtraError=i;function o(_,g){_.assign(n.default.errors,g),_.if((0,t._)`${n.default.vErrors} !== null`,()=>_.if(g,()=>_.assign((0,t._)`${n.default.vErrors}.length`,g),()=>_.assign(n.default.vErrors,null)))}e.resetErrorsCount=o;function u({gen:_,keyword:g,schemaValue:$,data:S,errsCount:I,it:D}){if(I===void 0)throw new Error("ajv implementation error");const v=_.name("err");_.forRange("i",I,n.default.errors,C=>{_.const(v,(0,t._)`${n.default.vErrors}[${C}]`),_.if((0,t._)`${v}.instancePath === undefined`,()=>_.assign((0,t._)`${v}.instancePath`,(0,t.strConcat)(n.default.instancePath,D.errorPath))),_.assign((0,t._)`${v}.schemaPath`,(0,t.str)`${D.errSchemaPath}/${g}`),D.opts.verbose&&(_.assign((0,t._)`${v}.schema`,$),_.assign((0,t._)`${v}.data`,S))})}e.extendErrors=u;function f(_,g){const $=_.const("err",g);_.if((0,t._)`${n.default.vErrors} === null`,()=>_.assign(n.default.vErrors,(0,t._)`[${$}]`),(0,t._)`${n.default.vErrors}.push(${$})`),_.code((0,t._)`${n.default.errors}++`)}function l(_,g){const{gen:$,validateName:S,schemaEnv:I}=_;I.$async?$.throw((0,t._)`new ${_.ValidationError}(${g})`):($.assign((0,t._)`${S}.errors`,g),$.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 p(_,g,$){const{createErrors:S}=_.it;return S===!1?(0,t._)`{}`:b(_,g,$)}function b(_,g,$={}){const{gen:S,it:I}=_,D=[E(I,$),P(_,$)];return O(_,g,D),S.object(...D)}function E({errorPath:_},{instancePath:g}){const $=g?(0,t.str)`${_}${(0,r.getErrorPath)(g,r.Type.Str)}`:_;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,$)]}function P({keyword:_,it:{errSchemaPath:g}},{schemaPath:$,parentSchema:S}){let I=S?g:(0,t.str)`${g}/${_}`;return $&&(I=(0,t.str)`${I}${(0,r.getErrorPath)($,r.Type.Str)}`),[d.schemaPath,I]}function O(_,{params:g,message:$},S){const{keyword:I,data:D,schemaValue:v,it:C}=_,{opts:A,propertyName:W,topSchemaRef:G,schemaPath:ie}=C;S.push([d.keyword,I],[d.params,typeof g=="function"?g(_):g||(0,t._)`{}`]),A.messages&&S.push([d.message,typeof $=="function"?$(_):$]),A.verbose&&S.push([d.schema,v],[d.parentSchema,(0,t._)`${G}${ie}`],[n.default.data,D]),W&&S.push([d.propertyName,W])}})(Xt);Object.defineProperty(kt,"__esModule",{value:!0});kt.boolOrEmptySchema=kt.topBoolOrEmptySchema=void 0;const Pa=Xt,Sa=B,Ta=We,Ra={message:"boolean schema is false"};function ka(e){const{gen:t,schema:r,validateName:n}=e;r===!1?Oi(e,!1):typeof r=="object"&&r.$async===!0?t.return(Ta.default.data):(t.assign((0,Sa._)`${n}.errors`,null),t.return(!0))}kt.topBoolOrEmptySchema=ka;function Oa(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Oi(e)):r.var(t,!0)}kt.boolOrEmptySchema=Oa;function Oi(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,Pa.reportError)(s,Ra,void 0,t)}var er={},ut={};Object.defineProperty(ut,"__esModule",{value:!0});ut.getRules=ut.isJSONType=void 0;const Ca=["string","number","integer","boolean","null","object","array"],Na=new Set(Ca);function Ia(e){return typeof e=="string"&&Na.has(e)}ut.isJSONType=Ia;function ja(){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:{}}}ut.getRules=ja;var Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.shouldUseRule=Be.shouldUseGroup=Be.schemaHasRulesForType=void 0;function Aa({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&Ci(e,n)}Be.schemaHasRulesForType=Aa;function Ci(e,t){return t.rules.some(r=>Ni(e,r))}Be.shouldUseGroup=Ci;function Ni(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))}Be.shouldUseRule=Ni;(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=ut,r=Be,n=Xt,s=B,i=X;var o;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(o=e.DataType||(e.DataType={}));function u(S){const I=f(S.type);if(I.includes("null")){if(S.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!I.length&&S.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');S.nullable===!0&&I.push("null")}return I}e.getSchemaTypes=u;function f(S){const I=Array.isArray(S)?S:S?[S]:[];if(I.every(t.isJSONType))return I;throw new Error("type must be JSONType or JSONType[]: "+I.join(","))}e.getJSONTypes=f;function l(S,I){const{gen:D,data:v,opts:C}=S,A=p(I,C.coerceTypes),W=I.length>0&&!(A.length===0&&I.length===1&&(0,r.schemaHasRulesForType)(S,I[0]));if(W){const G=O(I,v,C.strictNumbers,o.Wrong);D.if(G,()=>{A.length?b(S,I,A):g(S)})}return W}e.coerceAndCheckDataType=l;const d=new Set(["string","number","integer","boolean","null"]);function p(S,I){return I?S.filter(D=>d.has(D)||I==="array"&&D==="array"):[]}function b(S,I,D){const{gen:v,data:C,opts:A}=S,W=v.let("dataType",(0,s._)`typeof ${C}`),G=v.let("coerced",(0,s._)`undefined`);A.coerceTypes==="array"&&v.if((0,s._)`${W} == 'object' && Array.isArray(${C}) && ${C}.length == 1`,()=>v.assign(C,(0,s._)`${C}[0]`).assign(W,(0,s._)`typeof ${C}`).if(O(I,C,A.strictNumbers),()=>v.assign(G,C))),v.if((0,s._)`${G} !== undefined`);for(const Y of D)(d.has(Y)||Y==="array"&&A.coerceTypes==="array")&&ie(Y);v.else(),g(S),v.endIf(),v.if((0,s._)`${G} !== undefined`,()=>{v.assign(C,G),E(S,G)});function ie(Y){switch(Y){case"string":v.elseIf((0,s._)`${W} == "number" || ${W} == "boolean"`).assign(G,(0,s._)`"" + ${C}`).elseIf((0,s._)`${C} === null`).assign(G,(0,s._)`""`);return;case"number":v.elseIf((0,s._)`${W} == "boolean" || ${C} === null
|
|
632
|
+
|| (${W} == "string" && ${C} && ${C} == +${C})`).assign(G,(0,s._)`+${C}`);return;case"integer":v.elseIf((0,s._)`${W} === "boolean" || ${C} === null
|
|
633
|
+
|| (${W} === "string" && ${C} && ${C} == +${C} && !(${C} % 1))`).assign(G,(0,s._)`+${C}`);return;case"boolean":v.elseIf((0,s._)`${C} === "false" || ${C} === 0 || ${C} === null`).assign(G,!1).elseIf((0,s._)`${C} === "true" || ${C} === 1`).assign(G,!0);return;case"null":v.elseIf((0,s._)`${C} === "" || ${C} === 0 || ${C} === false`),v.assign(G,null);return;case"array":v.elseIf((0,s._)`${W} === "string" || ${W} === "number"
|
|
634
|
+
|| ${W} === "boolean" || ${C} === null`).assign(G,(0,s._)`[${C}]`)}}}function E({gen:S,parentData:I,parentDataProperty:D},v){S.if((0,s._)`${I} !== undefined`,()=>S.assign((0,s._)`${I}[${D}]`,v))}function P(S,I,D,v=o.Correct){const C=v===o.Correct?s.operators.EQ:s.operators.NEQ;let A;switch(S){case"null":return(0,s._)`${I} ${C} null`;case"array":A=(0,s._)`Array.isArray(${I})`;break;case"object":A=(0,s._)`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":A=W((0,s._)`!(${I} % 1) && !isNaN(${I})`);break;case"number":A=W();break;default:return(0,s._)`typeof ${I} ${C} ${S}`}return v===o.Correct?A:(0,s.not)(A);function W(G=s.nil){return(0,s.and)((0,s._)`typeof ${I} == "number"`,G,D?(0,s._)`isFinite(${I})`:s.nil)}}e.checkDataType=P;function O(S,I,D,v){if(S.length===1)return P(S[0],I,D,v);let C;const A=(0,i.toHash)(S);if(A.array&&A.object){const W=(0,s._)`typeof ${I} != "object"`;C=A.null?W:(0,s._)`!${I} || ${W}`,delete A.null,delete A.array,delete A.object}else C=s.nil;A.number&&delete A.integer;for(const W in A)C=(0,s.and)(C,P(W,I,D,v));return C}e.checkDataTypes=O;const _={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:I})=>typeof S=="string"?(0,s._)`{type: ${S}}`:(0,s._)`{type: ${I}}`};function g(S){const I=$(S);(0,n.reportError)(I,_)}e.reportTypeError=g;function $(S){const{gen:I,data:D,schema:v}=S,C=(0,i.schemaRefOrVal)(S,v,"type");return{gen:I,keyword:"type",data:D,schema:v.type,schemaCode:C,schemaValue:C,parentSchema:v,params:{},it:S}}})(er);var qr={};Object.defineProperty(qr,"__esModule",{value:!0});qr.assignDefaults=void 0;const bt=B,Da=X;function Ma(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)Ts(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,i)=>Ts(e,i,s.default))}qr.assignDefaults=Ma;function Ts(e,t,r){const{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;const u=(0,bt._)`${i}${(0,bt.getProperty)(t)}`;if(s){(0,Da.checkStrictMode)(e,`default is ignored for: ${u}`);return}let f=(0,bt._)`${u} === undefined`;o.useDefaults==="empty"&&(f=(0,bt._)`${f} || ${u} === null || ${u} === ""`),n.if(f,(0,bt._)`${u} = ${(0,bt.stringify)(r)}`)}var qe={},x={};Object.defineProperty(x,"__esModule",{value:!0});x.validateUnion=x.validateArray=x.usePattern=x.callValidateCode=x.schemaProperties=x.allSchemaProperties=x.noPropertyInData=x.propertyInData=x.isOwnProperty=x.hasPropFunc=x.reportMissingProp=x.checkMissingProp=x.checkReportMissingProp=void 0;const re=B,wn=X,Je=We,La=X;function Fa(e,t){const{gen:r,data:n,it:s}=e;r.if(bn(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,re._)`${t}`},!0),e.error()})}x.checkReportMissingProp=Fa;function qa({gen:e,data:t,it:{opts:r}},n,s){return(0,re.or)(...n.map(i=>(0,re.and)(bn(e,t,i,r.ownProperties),(0,re._)`${s} = ${i}`)))}x.checkMissingProp=qa;function Ua(e,t){e.setParams({missingProperty:t},!0),e.error()}x.reportMissingProp=Ua;function Ii(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,re._)`Object.prototype.hasOwnProperty`})}x.hasPropFunc=Ii;function vn(e,t,r){return(0,re._)`${Ii(e)}.call(${t}, ${r})`}x.isOwnProperty=vn;function Va(e,t,r,n){const s=(0,re._)`${t}${(0,re.getProperty)(r)} !== undefined`;return n?(0,re._)`${s} && ${vn(e,t,r)}`:s}x.propertyInData=Va;function bn(e,t,r,n){const s=(0,re._)`${t}${(0,re.getProperty)(r)} === undefined`;return n?(0,re.or)(s,(0,re.not)(vn(e,t,r))):s}x.noPropertyInData=bn;function ji(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}x.allSchemaProperties=ji;function za(e,t){return ji(t).filter(r=>!(0,wn.alwaysValidSchema)(e,t[r]))}x.schemaProperties=za;function Wa({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},u,f,l){const d=l?(0,re._)`${e}, ${t}, ${n}${s}`:t,p=[[Je.default.instancePath,(0,re.strConcat)(Je.default.instancePath,i)],[Je.default.parentData,o.parentData],[Je.default.parentDataProperty,o.parentDataProperty],[Je.default.rootData,Je.default.rootData]];o.opts.dynamicRef&&p.push([Je.default.dynamicAnchors,Je.default.dynamicAnchors]);const b=(0,re._)`${d}, ${r.object(...p)}`;return f!==re.nil?(0,re._)`${u}.call(${f}, ${b})`:(0,re._)`${u}(${b})`}x.callValidateCode=Wa;const Ha=(0,re._)`new RegExp`;function xa({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,re._)`${s.code==="new RegExp"?Ha:(0,La.useFunc)(e,s)}(${r}, ${n})`})}x.usePattern=xa;function Ba(e){const{gen:t,data:r,keyword:n,it:s}=e,i=t.name("valid");if(s.allErrors){const u=t.let("valid",!0);return o(()=>t.assign(u,!1)),u}return t.var(i,!0),o(()=>t.break()),i;function o(u){const f=t.const("len",(0,re._)`${r}.length`);t.forRange("i",0,f,l=>{e.subschema({keyword:n,dataProp:l,dataPropType:wn.Type.Num},i),t.if((0,re.not)(i),u)})}}x.validateArray=Ba;function Ga(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(f=>(0,wn.alwaysValidSchema)(s,f))&&!s.opts.unevaluated)return;const o=t.let("valid",!1),u=t.name("_valid");t.block(()=>r.forEach((f,l)=>{const d=e.subschema({keyword:n,schemaProp:l,compositeRule:!0},u);t.assign(o,(0,re._)`${o} || ${u}`),e.mergeValidEvaluated(d,u)||t.if((0,re.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}x.validateUnion=Ga;Object.defineProperty(qe,"__esModule",{value:!0});qe.validateKeywordUsage=qe.validSchemaType=qe.funcKeywordCode=qe.macroKeywordCode=void 0;const $e=B,ot=We,Ka=x,Ja=Xt;function Qa(e,t){const{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,u=t.macro.call(o.self,s,i,o),f=Ai(r,n,u);o.opts.validateSchema!==!1&&o.self.validateSchema(u,!0);const l=r.name("valid");e.subschema({schema:u,schemaPath:$e.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:f,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}qe.macroKeywordCode=Qa;function Ya(e,t){var r;const{gen:n,keyword:s,schema:i,parentSchema:o,$data:u,it:f}=e;Xa(f,t);const l=!u&&t.compile?t.compile.call(f.self,i,o,f):t.validate,d=Ai(n,s,l),p=n.let("valid");e.block$data(p,b),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function b(){if(t.errors===!1)O(),t.modifying&&Rs(e),_(()=>e.error());else{const g=t.async?E():P();t.modifying&&Rs(e),_(()=>Za(e,g))}}function E(){const g=n.let("ruleErrs",null);return n.try(()=>O((0,$e._)`await `),$=>n.assign(p,!1).if((0,$e._)`${$} instanceof ${f.ValidationError}`,()=>n.assign(g,(0,$e._)`${$}.errors`),()=>n.throw($))),g}function P(){const g=(0,$e._)`${d}.errors`;return n.assign(g,null),O($e.nil),g}function O(g=t.async?(0,$e._)`await `:$e.nil){const $=f.opts.passContext?ot.default.this:ot.default.self,S=!("compile"in t&&!u||t.schema===!1);n.assign(p,(0,$e._)`${g}${(0,Ka.callValidateCode)(e,d,$,S)}`,t.modifying)}function _(g){var $;n.if((0,$e.not)(($=t.valid)!==null&&$!==void 0?$:p),g)}}qe.funcKeywordCode=Ya;function Rs(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,$e._)`${n.parentData}[${n.parentDataProperty}]`))}function Za(e,t){const{gen:r}=e;r.if((0,$e._)`Array.isArray(${t})`,()=>{r.assign(ot.default.vErrors,(0,$e._)`${ot.default.vErrors} === null ? ${t} : ${ot.default.vErrors}.concat(${t})`).assign(ot.default.errors,(0,$e._)`${ot.default.vErrors}.length`),(0,Ja.extendErrors)(e)},()=>e.error())}function Xa({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Ai(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,$e.stringify)(r)})}function ec(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")}qe.validSchemaType=ec;function tc({schema:e,opts:t,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw new Error("ajv implementation error");const o=s.dependencies;if(o!=null&&o.some(u=>!Object.prototype.hasOwnProperty.call(e,u)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[i])){const f=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(f);else throw new Error(f)}}qe.validateKeywordUsage=tc;var Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extendSubschemaMode=Ze.extendSubschemaData=Ze.getSubschema=void 0;const Fe=B,Di=X;function rc(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const u=e.schema[t];return r===void 0?{schema:u,schemaPath:(0,Fe._)`${e.schemaPath}${(0,Fe.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:u[r],schemaPath:(0,Fe._)`${e.schemaPath}${(0,Fe.getProperty)(t)}${(0,Fe.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Di.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}Ze.getSubschema=rc;function nc(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=t;if(r!==void 0){const{errorPath:l,dataPathArr:d,opts:p}=t,b=u.let("data",(0,Fe._)`${t.data}${(0,Fe.getProperty)(r)}`,!0);f(b),e.errorPath=(0,Fe.str)`${l}${(0,Di.getErrorPath)(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=(0,Fe._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(s!==void 0){const l=s instanceof Fe.Name?s:u.let("data",s,!0);f(l),o!==void 0&&(e.propertyName=o)}i&&(e.dataTypes=i);function f(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}Ze.extendSubschemaData=nc;function sc(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}Ze.extendSubschemaMode=sc;var me={},Mi=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r},Li={exports:{}},Ye=Li.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(){};yr(t,n,s,e,"",e)};Ye.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ye.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ye.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ye.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 yr(e,t,r,n,s,i,o,u,f,l){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,u,f,l);for(var d in n){var p=n[d];if(Array.isArray(p)){if(d in Ye.arrayKeywords)for(var b=0;b<p.length;b++)yr(e,t,r,p[b],s+"/"+d+"/"+b,i,s,d,n,b)}else if(d in Ye.propsKeywords){if(p&&typeof p=="object")for(var E in p)yr(e,t,r,p[E],s+"/"+d+"/"+ic(E),i,s,d,n,E)}else(d in Ye.keywords||e.allKeys&&!(d in Ye.skipKeywords))&&yr(e,t,r,p,s+"/"+d,i,s,d,n)}r(n,s,i,o,u,f,l)}}function ic(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var oc=Li.exports;Object.defineProperty(me,"__esModule",{value:!0});me.getSchemaRefs=me.resolveUrl=me.normalizeId=me._getFullPath=me.getFullPath=me.inlineRef=void 0;const ac=X,cc=Mi,lc=oc,uc=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function dc(e,t=!0){return typeof e=="boolean"?!0:t===!0?!an(e):t?Fi(e)<=t:!1}me.inlineRef=dc;const fc=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function an(e){for(const t in e){if(fc.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(an)||typeof r=="object"&&an(r))return!0}return!1}function Fi(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!uc.has(r)&&(typeof e[r]=="object"&&(0,ac.eachItem)(e[r],n=>t+=Fi(n)),t===1/0))return 1/0}return t}function qi(e,t="",r){r!==!1&&(t=Rt(t));const n=e.parse(t);return Ui(e,n)}me.getFullPath=qi;function Ui(e,t){return e.serialize(t).split("#")[0]+"#"}me._getFullPath=Ui;const pc=/#\/?$/;function Rt(e){return e?e.replace(pc,""):""}me.normalizeId=Rt;function hc(e,t,r){return r=Rt(r),e.resolve(t,r)}me.resolveUrl=hc;const mc=/^[a-z_][-a-z0-9._]*$/i;function yc(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Rt(e[r]||t),i={"":s},o=qi(n,s,!1),u={},f=new Set;return lc(e,{allKeys:!0},(p,b,E,P)=>{if(P===void 0)return;const O=o+b;let _=i[P];typeof p[r]=="string"&&(_=g.call(this,p[r])),$.call(this,p.$anchor),$.call(this,p.$dynamicAnchor),i[b]=_;function g(S){const I=this.opts.uriResolver.resolve;if(S=Rt(_?I(_,S):S),f.has(S))throw d(S);f.add(S);let D=this.refs[S];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?l(p,D.schema,S):S!==Rt(O)&&(S[0]==="#"?(l(p,u[S],S),u[S]=p):this.refs[S]=O),S}function $(S){if(typeof S=="string"){if(!mc.test(S))throw new Error(`invalid anchor "${S}"`);g.call(this,`#${S}`)}}}),u;function l(p,b,E){if(b!==void 0&&!cc(p,b))throw d(E)}function d(p){return new Error(`reference "${p}" resolves to more than one schema`)}}me.getSchemaRefs=yc;Object.defineProperty(Ne,"__esModule",{value:!0});Ne.getData=Ne.KeywordCxt=Ne.validateFunctionCode=void 0;const Vi=kt,ks=er,En=Be,Tr=er,gc=qr,xt=qe,Kr=Ze,q=B,z=We,$c=me,Ge=X,zt=Xt;function _c(e){if(Hi(e)&&(xi(e),Wi(e))){bc(e);return}zi(e,()=>(0,Vi.topBoolOrEmptySchema)(e))}Ne.validateFunctionCode=_c;function zi({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){s.code.es5?e.func(t,(0,q._)`${z.default.data}, ${z.default.valCxt}`,n.$async,()=>{e.code((0,q._)`"use strict"; ${Os(r,s)}`),vc(e,s),e.code(i)}):e.func(t,(0,q._)`${z.default.data}, ${wc(s)}`,n.$async,()=>e.code(Os(r,s)).code(i))}function wc(e){return(0,q._)`{${z.default.instancePath}="", ${z.default.parentData}, ${z.default.parentDataProperty}, ${z.default.rootData}=${z.default.data}${e.dynamicRef?(0,q._)`, ${z.default.dynamicAnchors}={}`:q.nil}}={}`}function vc(e,t){e.if(z.default.valCxt,()=>{e.var(z.default.instancePath,(0,q._)`${z.default.valCxt}.${z.default.instancePath}`),e.var(z.default.parentData,(0,q._)`${z.default.valCxt}.${z.default.parentData}`),e.var(z.default.parentDataProperty,(0,q._)`${z.default.valCxt}.${z.default.parentDataProperty}`),e.var(z.default.rootData,(0,q._)`${z.default.valCxt}.${z.default.rootData}`),t.dynamicRef&&e.var(z.default.dynamicAnchors,(0,q._)`${z.default.valCxt}.${z.default.dynamicAnchors}`)},()=>{e.var(z.default.instancePath,(0,q._)`""`),e.var(z.default.parentData,(0,q._)`undefined`),e.var(z.default.parentDataProperty,(0,q._)`undefined`),e.var(z.default.rootData,z.default.data),t.dynamicRef&&e.var(z.default.dynamicAnchors,(0,q._)`{}`)})}function bc(e){const{schema:t,opts:r,gen:n}=e;zi(e,()=>{r.$comment&&t.$comment&&Gi(e),Rc(e),n.let(z.default.vErrors,null),n.let(z.default.errors,0),r.unevaluated&&Ec(e),Bi(e),Cc(e)})}function Ec(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,q._)`${r}.evaluated`),t.if((0,q._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,q._)`${e.evaluated}.props`,(0,q._)`undefined`)),t.if((0,q._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,q._)`${e.evaluated}.items`,(0,q._)`undefined`))}function Os(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,q._)`/*# sourceURL=${r} */`:q.nil}function Pc(e,t){if(Hi(e)&&(xi(e),Wi(e))){Sc(e,t);return}(0,Vi.boolOrEmptySchema)(e,t)}function Wi({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 Hi(e){return typeof e.schema!="boolean"}function Sc(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&Gi(e),kc(e),Oc(e);const i=n.const("_errs",z.default.errors);Bi(e,i),n.var(t,(0,q._)`${i} === ${z.default.errors}`)}function xi(e){(0,Ge.checkUnknownRules)(e),Tc(e)}function Bi(e,t){if(e.opts.jtd)return Cs(e,[],!1,t);const r=(0,ks.getSchemaTypes)(e.schema),n=(0,ks.coerceAndCheckDataType)(e,r);Cs(e,r,!n,t)}function Tc(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ge.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Rc(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ge.checkStrictMode)(e,"default is ignored in the schema root")}function kc(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,$c.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function Oc(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Gi({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const i=r.$comment;if(s.$comment===!0)e.code((0,q._)`${z.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){const o=(0,q.str)`${n}/$comment`,u=e.scopeValue("root",{ref:t.root});e.code((0,q._)`${z.default.self}.opts.$comment(${i}, ${o}, ${u}.schema)`)}}function Cc(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;r.$async?t.if((0,q._)`${z.default.errors} === 0`,()=>t.return(z.default.data),()=>t.throw((0,q._)`new ${s}(${z.default.vErrors})`)):(t.assign((0,q._)`${n}.errors`,z.default.vErrors),i.unevaluated&&Nc(e),t.return((0,q._)`${z.default.errors} === 0`))}function Nc({gen:e,evaluated:t,props:r,items:n}){r instanceof q.Name&&e.assign((0,q._)`${t}.props`,r),n instanceof q.Name&&e.assign((0,q._)`${t}.items`,n)}function Cs(e,t,r,n){const{gen:s,schema:i,data:o,allErrors:u,opts:f,self:l}=e,{RULES:d}=l;if(i.$ref&&(f.ignoreKeywordsWithRef||!(0,Ge.schemaHasRulesButRef)(i,d))){s.block(()=>Qi(e,"$ref",d.all.$ref.definition));return}f.jtd||Ic(e,t),s.block(()=>{for(const b of d.rules)p(b);p(d.post)});function p(b){(0,En.shouldUseGroup)(i,b)&&(b.type?(s.if((0,Tr.checkDataType)(b.type,o,f.strictNumbers)),Ns(e,b),t.length===1&&t[0]===b.type&&r&&(s.else(),(0,Tr.reportTypeError)(e)),s.endIf()):Ns(e,b),u||s.if((0,q._)`${z.default.errors} === ${n||0}`))}}function Ns(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,gc.assignDefaults)(e,t.type),r.block(()=>{for(const i of t.rules)(0,En.shouldUseRule)(n,i)&&Qi(e,i.keyword,i.definition,t.type)})}function Ic(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(jc(e,t),e.opts.allowUnionTypes||Ac(e,t),Dc(e,e.dataTypes))}function jc(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Ki(e.dataTypes,r)||Pn(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Lc(e,t)}}function Ac(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Pn(e,"use allowUnionTypes to allow union type keyword")}function Dc(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,En.shouldUseRule)(e.schema,s)){const{type:i}=s.definition;i.length&&!i.some(o=>Mc(t,o))&&Pn(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function Mc(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Ki(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Lc(e,t){const r=[];for(const n of e.dataTypes)Ki(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Pn(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ge.checkStrictMode)(e,t,e.opts.strictTypes)}class Ji{constructor(t,r,n){if((0,xt.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,Ge.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",Yi(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,xt.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",z.default.errors))}result(t,r,n){this.failResult((0,q.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,q.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,q._)`${r} !== undefined && (${(0,q.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?zt.reportExtraError:zt.reportError)(this,this.def.error,r)}$dataError(){(0,zt.reportError)(this,this.def.$dataError||zt.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,zt.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=q.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=q.nil,r=q.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:i,def:o}=this;n.if((0,q.or)((0,q._)`${s} === undefined`,r)),t!==q.nil&&n.assign(t,!0),(i.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==q.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:i}=this;return(0,q.or)(o(),u());function o(){if(n.length){if(!(r instanceof q.Name))throw new Error("ajv implementation error");const f=Array.isArray(n)?n:[n];return(0,q._)`${(0,Tr.checkDataTypes)(f,r,i.opts.strictNumbers,Tr.DataType.Wrong)}`}return q.nil}function u(){if(s.validateSchema){const f=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,q._)`!${f}(${r})`}return q.nil}}subschema(t,r){const n=(0,Kr.getSubschema)(this.it,t);(0,Kr.extendSubschemaData)(n,this.it,t),(0,Kr.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return Pc(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ge.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ge.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,q.Name)),!0}}Ne.KeywordCxt=Ji;function Qi(e,t,r,n){const s=new Ji(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,xt.funcKeywordCode)(s,r):"macro"in r?(0,xt.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,xt.funcKeywordCode)(s,r)}const Fc=/^\/(?:[^~]|~0|~1)*$/,qc=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yi(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return z.default.rootData;if(e[0]==="/"){if(!Fc.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,i=z.default.rootData}else{const l=qc.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);const d=+l[1];if(s=l[2],s==="#"){if(d>=t)throw new Error(f("property/index",d));return n[t-d]}if(d>t)throw new Error(f("data",d));if(i=r[t-d],!s)return i}let o=i;const u=s.split("/");for(const l of u)l&&(i=(0,q._)`${i}${(0,q.getProperty)((0,Ge.unescapeJsonPointer)(l))}`,o=(0,q._)`${o} && ${i}`);return o;function f(l,d){return`Cannot access ${l} ${d} levels up, current level is ${t}`}}Ne.getData=Yi;var tr={};Object.defineProperty(tr,"__esModule",{value:!0});class Uc extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}tr.default=Uc;var rr={};Object.defineProperty(rr,"__esModule",{value:!0});const Jr=me;class Vc extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Jr.resolveUrl)(t,r,n),this.missingSchema=(0,Jr.normalizeId)((0,Jr.getFullPath)(t,this.missingRef))}}rr.default=Vc;var ve={};Object.defineProperty(ve,"__esModule",{value:!0});ve.resolveSchema=ve.getCompilingSchema=ve.resolveRef=ve.compileSchema=ve.SchemaEnv=void 0;const ke=B,zc=tr,it=We,Ce=me,Is=X,Wc=Ne;class Ur{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,Ce.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={}}}ve.SchemaEnv=Ur;function Sn(e){const t=Zi.call(this,e);if(t)return t;const r=(0,Ce.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new ke.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i});let u;e.$async&&(u=o.scopeValue("Error",{ref:zc.default,code:(0,ke._)`require("ajv/dist/runtime/validation_error").default`}));const f=o.scopeName("validate");e.validateName=f;const l={gen:o,allErrors:this.opts.allErrors,data:it.default.data,parentData:it.default.parentData,parentDataProperty:it.default.parentDataProperty,dataNames:[it.default.data],dataPathArr:[ke.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,ke.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:u,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ke.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ke._)`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,Wc.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);const p=o.toString();d=`${o.scopeRefs(it.default.scope)}return ${p}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const E=new Function(`${it.default.self}`,`${it.default.scope}`,d)(this,this.scope.get());if(this.scope.value(f,{ref:E}),E.errors=null,E.schema=e.schema,E.schemaEnv=e,e.$async&&(E.$async=!0),this.opts.code.source===!0&&(E.source={validateName:f,validateCode:p,scopeValues:o._values}),this.opts.unevaluated){const{props:P,items:O}=l;E.evaluated={props:P instanceof ke.Name?void 0:P,items:O instanceof ke.Name?void 0:O,dynamicProps:P instanceof ke.Name,dynamicItems:O instanceof ke.Name},E.source&&(E.source.evaluated=(0,ke.stringify)(E.evaluated))}return e.validate=E,e}catch(p){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),p}finally{this._compilations.delete(e)}}ve.compileSchema=Sn;function Hc(e,t,r){var n;r=(0,Ce.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let i=Gc.call(this,e,r);if(i===void 0){const o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:u}=this.opts;o&&(i=new Ur({schema:o,schemaId:u,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=xc.call(this,i)}ve.resolveRef=Hc;function xc(e){return(0,Ce.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Sn.call(this,e)}function Zi(e){for(const t of this._compilations)if(Bc(t,e))return t}ve.getCompilingSchema=Zi;function Bc(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Gc(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Vr.call(this,e,t)}function Vr(e,t){const r=this.opts.uriResolver.parse(t),n=(0,Ce._getFullPath)(this.opts.uriResolver,r);let s=(0,Ce.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Qr.call(this,r,e);const i=(0,Ce.normalizeId)(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){const u=Vr.call(this,e,o);return typeof(u==null?void 0:u.schema)!="object"?void 0:Qr.call(this,r,u)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||Sn.call(this,o),i===(0,Ce.normalizeId)(t)){const{schema:u}=o,{schemaId:f}=this.opts,l=u[f];return l&&(s=(0,Ce.resolveUrl)(this.opts.uriResolver,s,l)),new Ur({schema:u,schemaId:f,root:e,baseId:s})}return Qr.call(this,r,o)}}ve.resolveSchema=Vr;const Kc=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Qr(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const u of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const f=r[(0,Is.unescapeFragment)(u)];if(f===void 0)return;r=f;const l=typeof r=="object"&&r[this.opts.schemaId];!Kc.has(u)&&l&&(t=(0,Ce.resolveUrl)(this.opts.uriResolver,t,l))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Is.schemaHasRulesButRef)(r,this.RULES)){const u=(0,Ce.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Vr.call(this,n,u)}const{schemaId:o}=this.opts;if(i=i||new Ur({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i}const Jc="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Qc="Meta-schema for $data reference (JSON AnySchema extension proposal)",Yc="object",Zc=["$data"],Xc={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},el=!1,tl={$id:Jc,description:Qc,type:Yc,required:Zc,properties:Xc,additionalProperties:el};var Tn={},cn={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)})(la,function(r){function n(){for(var h=arguments.length,c=Array(h),y=0;y<h;y++)c[y]=arguments[y];if(c.length>1){c[0]=c[0].slice(0,-1);for(var k=c.length-1,R=1;R<k;++R)c[R]=c[R].slice(1,-1);return c[k]=c[k].slice(1),c.join("")}else return c[0]}function s(h){return"(?:"+h+")"}function i(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function o(h){return h.toUpperCase()}function u(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function f(h,c){var y=h;if(c)for(var k in c)y[k]=c[k];return y}function l(h){var c="[A-Za-z]",y="[0-9]",k=n(y,"[A-Fa-f]"),R=s(s("%[EFef]"+k+"%"+k+k+"%"+k+k)+"|"+s("%[89A-Fa-f]"+k+"%"+k+k)+"|"+s("%"+k+k)),U="[\\:\\/\\?\\#\\[\\]\\@]",V="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Z=n(U,V),te=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",ae=h?"[\\uE000-\\uF8FF]":"[]",J=n(c,y,"[\\-\\.\\_\\~]",te);s(c+n(c,y,"[\\+\\-\\.]")+"*"),s(s(R+"|"+n(J,V,"[\\:]"))+"*");var ee=s(s("25[0-5]")+"|"+s("2[0-4]"+y)+"|"+s("1"+y+y)+"|"+s("0?[1-9]"+y)+"|0?0?"+y),ce=s(ee+"\\."+ee+"\\."+ee+"\\."+ee),H=s(k+"{1,4}"),ne=s(s(H+"\\:"+H)+"|"+ce),fe=s(s(H+"\\:")+"{6}"+ne),se=s("\\:\\:"+s(H+"\\:")+"{5}"+ne),Ke=s(s(H)+"?\\:\\:"+s(H+"\\:")+"{4}"+ne),De=s(s(s(H+"\\:")+"{0,1}"+H)+"?\\:\\:"+s(H+"\\:")+"{3}"+ne),Me=s(s(s(H+"\\:")+"{0,2}"+H)+"?\\:\\:"+s(H+"\\:")+"{2}"+ne),vt=s(s(s(H+"\\:")+"{0,3}"+H)+"?\\:\\:"+H+"\\:"+ne),nt=s(s(s(H+"\\:")+"{0,4}"+H)+"?\\:\\:"+ne),Se=s(s(s(H+"\\:")+"{0,5}"+H)+"?\\:\\:"+H),Le=s(s(s(H+"\\:")+"{0,6}"+H)+"?\\:\\:"),st=s([fe,se,Ke,De,Me,vt,nt,Se,Le].join("|")),He=s(s(J+"|"+R)+"+");s("[vV]"+k+"+\\."+n(J,V,"[\\:]")+"+"),s(s(R+"|"+n(J,V))+"*");var Ut=s(R+"|"+n(J,V,"[\\:\\@]"));return s(s(R+"|"+n(J,V,"[\\@]"))+"+"),s(s(Ut+"|"+n("[\\/\\?]",ae))+"*"),{NOT_SCHEME:new RegExp(n("[^]",c,y,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(n("[^\\%\\:]",J,V),"g"),NOT_HOST:new RegExp(n("[^\\%\\[\\]\\:]",J,V),"g"),NOT_PATH:new RegExp(n("[^\\%\\/\\:\\@]",J,V),"g"),NOT_PATH_NOSCHEME:new RegExp(n("[^\\%\\/\\@]",J,V),"g"),NOT_QUERY:new RegExp(n("[^\\%]",J,V,"[\\:\\@\\/\\?]",ae),"g"),NOT_FRAGMENT:new RegExp(n("[^\\%]",J,V,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(n("[^]",J,V),"g"),UNRESERVED:new RegExp(J,"g"),OTHER_CHARS:new RegExp(n("[^\\%]",J,Z),"g"),PCT_ENCODED:new RegExp(R,"g"),IPV4ADDRESS:new RegExp("^("+ce+")$"),IPV6ADDRESS:new RegExp("^\\[?("+st+")"+s(s("\\%25|\\%(?!"+k+"{2})")+"("+He+")")+"?\\]?$")}}var d=l(!1),p=l(!0),b=function(){function h(c,y){var k=[],R=!0,U=!1,V=void 0;try{for(var Z=c[Symbol.iterator](),te;!(R=(te=Z.next()).done)&&(k.push(te.value),!(y&&k.length===y));R=!0);}catch(ae){U=!0,V=ae}finally{try{!R&&Z.return&&Z.return()}finally{if(U)throw V}}return k}return function(c,y){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return h(c,y);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),E=function(h){if(Array.isArray(h)){for(var c=0,y=Array(h.length);c<h.length;c++)y[c]=h[c];return y}else return Array.from(h)},P=2147483647,O=36,_=1,g=26,$=38,S=700,I=72,D=128,v="-",C=/^xn--/,A=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,G={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ie=O-_,Y=Math.floor,Ee=String.fromCharCode;function de(h){throw new RangeError(G[h])}function Xe(h,c){for(var y=[],k=h.length;k--;)y[k]=c(h[k]);return y}function et(h,c){var y=h.split("@"),k="";y.length>1&&(k=y[0]+"@",h=y[1]),h=h.replace(W,".");var R=h.split("."),U=Xe(R,c).join(".");return k+U}function pt(h){for(var c=[],y=0,k=h.length;y<k;){var R=h.charCodeAt(y++);if(R>=55296&&R<=56319&&y<k){var U=h.charCodeAt(y++);(U&64512)==56320?c.push(((R&1023)<<10)+(U&1023)+65536):(c.push(R),y--)}else c.push(R)}return c}var It=function(c){return String.fromCodePoint.apply(String,E(c))},ht=function(c){return c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:O},M=function(c,y){return c+22+75*(c<26)-((y!=0)<<5)},w=function(c,y,k){var R=0;for(c=k?Y(c/S):c>>1,c+=Y(c/y);c>ie*g>>1;R+=O)c=Y(c/ie);return Y(R+(ie+1)*c/(c+$))},j=function(c){var y=[],k=c.length,R=0,U=D,V=I,Z=c.lastIndexOf(v);Z<0&&(Z=0);for(var te=0;te<Z;++te)c.charCodeAt(te)>=128&&de("not-basic"),y.push(c.charCodeAt(te));for(var ae=Z>0?Z+1:0;ae<k;){for(var J=R,ee=1,ce=O;;ce+=O){ae>=k&&de("invalid-input");var H=ht(c.charCodeAt(ae++));(H>=O||H>Y((P-R)/ee))&&de("overflow"),R+=H*ee;var ne=ce<=V?_:ce>=V+g?g:ce-V;if(H<ne)break;var fe=O-ne;ee>Y(P/fe)&&de("overflow"),ee*=fe}var se=y.length+1;V=w(R-J,se,J==0),Y(R/se)>P-U&&de("overflow"),U+=Y(R/se),R%=se,y.splice(R++,0,U)}return String.fromCodePoint.apply(String,y)},T=function(c){var y=[];c=pt(c);var k=c.length,R=D,U=0,V=I,Z=!0,te=!1,ae=void 0;try{for(var J=c[Symbol.iterator](),ee;!(Z=(ee=J.next()).done);Z=!0){var ce=ee.value;ce<128&&y.push(Ee(ce))}}catch(Vt){te=!0,ae=Vt}finally{try{!Z&&J.return&&J.return()}finally{if(te)throw ae}}var H=y.length,ne=H;for(H&&y.push(v);ne<k;){var fe=P,se=!0,Ke=!1,De=void 0;try{for(var Me=c[Symbol.iterator](),vt;!(se=(vt=Me.next()).done);se=!0){var nt=vt.value;nt>=R&&nt<fe&&(fe=nt)}}catch(Vt){Ke=!0,De=Vt}finally{try{!se&&Me.return&&Me.return()}finally{if(Ke)throw De}}var Se=ne+1;fe-R>Y((P-U)/Se)&&de("overflow"),U+=(fe-R)*Se,R=fe;var Le=!0,st=!1,He=void 0;try{for(var Ut=c[Symbol.iterator](),hs;!(Le=(hs=Ut.next()).done);Le=!0){var ms=hs.value;if(ms<R&&++U>P&&de("overflow"),ms==R){for(var ir=U,or=O;;or+=O){var ar=or<=V?_:or>=V+g?g:or-V;if(ir<ar)break;var ys=ir-ar,gs=O-ar;y.push(Ee(M(ar+ys%gs,0))),ir=Y(ys/gs)}y.push(Ee(M(ir,0))),V=w(U,Se,ne==H),U=0,++ne}}}catch(Vt){st=!0,He=Vt}finally{try{!Le&&Ut.return&&Ut.return()}finally{if(st)throw He}}++U,++R}return y.join("")},a=function(c){return et(c,function(y){return C.test(y)?j(y.slice(4).toLowerCase()):y})},m=function(c){return et(c,function(y){return A.test(y)?"xn--"+T(y):y})},N={version:"2.1.0",ucs2:{decode:pt,encode:It},decode:j,encode:T,toASCII:m,toUnicode:a},L={};function F(h){var c=h.charCodeAt(0),y=void 0;return c<16?y="%0"+c.toString(16).toUpperCase():c<128?y="%"+c.toString(16).toUpperCase():c<2048?y="%"+(c>>6|192).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase():y="%"+(c>>12|224).toString(16).toUpperCase()+"%"+(c>>6&63|128).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase(),y}function K(h){for(var c="",y=0,k=h.length;y<k;){var R=parseInt(h.substr(y+1,2),16);if(R<128)c+=String.fromCharCode(R),y+=3;else if(R>=194&&R<224){if(k-y>=6){var U=parseInt(h.substr(y+4,2),16);c+=String.fromCharCode((R&31)<<6|U&63)}else c+=h.substr(y,6);y+=6}else if(R>=224){if(k-y>=9){var V=parseInt(h.substr(y+4,2),16),Z=parseInt(h.substr(y+7,2),16);c+=String.fromCharCode((R&15)<<12|(V&63)<<6|Z&63)}else c+=h.substr(y,9);y+=9}else c+=h.substr(y,3),y+=3}return c}function Q(h,c){function y(k){var R=K(k);return R.match(c.UNRESERVED)?R:k}return h.scheme&&(h.scheme=String(h.scheme).replace(c.PCT_ENCODED,y).toLowerCase().replace(c.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(c.PCT_ENCODED,y).replace(c.NOT_USERINFO,F).replace(c.PCT_ENCODED,o)),h.host!==void 0&&(h.host=String(h.host).replace(c.PCT_ENCODED,y).toLowerCase().replace(c.NOT_HOST,F).replace(c.PCT_ENCODED,o)),h.path!==void 0&&(h.path=String(h.path).replace(c.PCT_ENCODED,y).replace(h.scheme?c.NOT_PATH:c.NOT_PATH_NOSCHEME,F).replace(c.PCT_ENCODED,o)),h.query!==void 0&&(h.query=String(h.query).replace(c.PCT_ENCODED,y).replace(c.NOT_QUERY,F).replace(c.PCT_ENCODED,o)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(c.PCT_ENCODED,y).replace(c.NOT_FRAGMENT,F).replace(c.PCT_ENCODED,o)),h}function oe(h){return h.replace(/^0*(.*)/,"$1")||"0"}function Ie(h,c){var y=h.match(c.IPV4ADDRESS)||[],k=b(y,2),R=k[1];return R?R.split(".").map(oe).join("."):h}function mt(h,c){var y=h.match(c.IPV6ADDRESS)||[],k=b(y,3),R=k[1],U=k[2];if(R){for(var V=R.toLowerCase().split("::").reverse(),Z=b(V,2),te=Z[0],ae=Z[1],J=ae?ae.split(":").map(oe):[],ee=te.split(":").map(oe),ce=c.IPV4ADDRESS.test(ee[ee.length-1]),H=ce?7:8,ne=ee.length-H,fe=Array(H),se=0;se<H;++se)fe[se]=J[se]||ee[ne+se]||"";ce&&(fe[H-1]=Ie(fe[H-1],c));var Ke=fe.reduce(function(Se,Le,st){if(!Le||Le==="0"){var He=Se[Se.length-1];He&&He.index+He.length===st?He.length++:Se.push({index:st,length:1})}return Se},[]),De=Ke.sort(function(Se,Le){return Le.length-Se.length})[0],Me=void 0;if(De&&De.length>1){var vt=fe.slice(0,De.index),nt=fe.slice(De.index+De.length);Me=vt.join(":")+"::"+nt.join(":")}else Me=fe.join(":");return U&&(Me+="%"+U),Me}else return h}var jt=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,At="".match(/(){0}/)[1]===void 0;function be(h){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={},k=c.iri!==!1?p:d;c.reference==="suffix"&&(h=(c.scheme?c.scheme+":":"")+"//"+h);var R=h.match(jt);if(R){At?(y.scheme=R[1],y.userinfo=R[3],y.host=R[4],y.port=parseInt(R[5],10),y.path=R[6]||"",y.query=R[7],y.fragment=R[8],isNaN(y.port)&&(y.port=R[5])):(y.scheme=R[1]||void 0,y.userinfo=h.indexOf("@")!==-1?R[3]:void 0,y.host=h.indexOf("//")!==-1?R[4]:void 0,y.port=parseInt(R[5],10),y.path=R[6]||"",y.query=h.indexOf("?")!==-1?R[7]:void 0,y.fragment=h.indexOf("#")!==-1?R[8]:void 0,isNaN(y.port)&&(y.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),y.host&&(y.host=mt(Ie(y.host,k),k)),y.scheme===void 0&&y.userinfo===void 0&&y.host===void 0&&y.port===void 0&&!y.path&&y.query===void 0?y.reference="same-document":y.scheme===void 0?y.reference="relative":y.fragment===void 0?y.reference="absolute":y.reference="uri",c.reference&&c.reference!=="suffix"&&c.reference!==y.reference&&(y.error=y.error||"URI is not a "+c.reference+" reference.");var U=L[(c.scheme||y.scheme||"").toLowerCase()];if(!c.unicodeSupport&&(!U||!U.unicodeSupport)){if(y.host&&(c.domainHost||U&&U.domainHost))try{y.host=N.toASCII(y.host.replace(k.PCT_ENCODED,K).toLowerCase())}catch(V){y.error=y.error||"Host's domain name can not be converted to ASCII via punycode: "+V}Q(y,d)}else Q(y,k);U&&U.parse&&U.parse(y,c)}else y.error=y.error||"URI can not be parsed.";return y}function Dt(h,c){var y=c.iri!==!1?p:d,k=[];return h.userinfo!==void 0&&(k.push(h.userinfo),k.push("@")),h.host!==void 0&&k.push(mt(Ie(String(h.host),y),y).replace(y.IPV6ADDRESS,function(R,U,V){return"["+U+(V?"%25"+V:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(k.push(":"),k.push(String(h.port))),k.length?k.join(""):void 0}var yt=/^\.\.?\//,gt=/^\/\.(\/|$)/,$t=/^\/\.\.(\/|$)/,Mt=/^\/?(?:.|\n)*?(?=\/|$)/;function je(h){for(var c=[];h.length;)if(h.match(yt))h=h.replace(yt,"");else if(h.match(gt))h=h.replace(gt,"/");else if(h.match($t))h=h.replace($t,"/"),c.pop();else if(h==="."||h==="..")h="";else{var y=h.match(Mt);if(y){var k=y[0];h=h.slice(k.length),c.push(k)}else throw new Error("Unexpected dot segment condition")}return c.join("")}function _e(h){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=c.iri?p:d,k=[],R=L[(c.scheme||h.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(h,c),h.host&&!y.IPV6ADDRESS.test(h.host)){if(c.domainHost||R&&R.domainHost)try{h.host=c.iri?N.toUnicode(h.host):N.toASCII(h.host.replace(y.PCT_ENCODED,K).toLowerCase())}catch(Z){h.error=h.error||"Host's domain name can not be converted to "+(c.iri?"Unicode":"ASCII")+" via punycode: "+Z}}Q(h,y),c.reference!=="suffix"&&h.scheme&&(k.push(h.scheme),k.push(":"));var U=Dt(h,c);if(U!==void 0&&(c.reference!=="suffix"&&k.push("//"),k.push(U),h.path&&h.path.charAt(0)!=="/"&&k.push("/")),h.path!==void 0){var V=h.path;!c.absolutePath&&(!R||!R.absolutePath)&&(V=je(V)),U===void 0&&(V=V.replace(/^\/\//,"/%2F")),k.push(V)}return h.query!==void 0&&(k.push("?"),k.push(h.query)),h.fragment!==void 0&&(k.push("#"),k.push(h.fragment)),k.join("")}function _t(h,c){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=arguments[3],R={};return k||(h=be(_e(h,y),y),c=be(_e(c,y),y)),y=y||{},!y.tolerant&&c.scheme?(R.scheme=c.scheme,R.userinfo=c.userinfo,R.host=c.host,R.port=c.port,R.path=je(c.path||""),R.query=c.query):(c.userinfo!==void 0||c.host!==void 0||c.port!==void 0?(R.userinfo=c.userinfo,R.host=c.host,R.port=c.port,R.path=je(c.path||""),R.query=c.query):(c.path?(c.path.charAt(0)==="/"?R.path=je(c.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?R.path="/"+c.path:h.path?R.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+c.path:R.path=c.path,R.path=je(R.path)),R.query=c.query):(R.path=h.path,c.query!==void 0?R.query=c.query:R.query=h.query),R.userinfo=h.userinfo,R.host=h.host,R.port=h.port),R.scheme=h.scheme),R.fragment=c.fragment,R}function Lt(h,c,y){var k=f({scheme:"null"},y);return _e(_t(be(h,k),be(c,k),k,!0),k)}function tt(h,c){return typeof h=="string"?h=_e(be(h,c),c):i(h)==="object"&&(h=be(_e(h,c),c)),h}function Ft(h,c,y){return typeof h=="string"?h=_e(be(h,y),y):i(h)==="object"&&(h=_e(h,y)),typeof c=="string"?c=_e(be(c,y),y):i(c)==="object"&&(c=_e(c,y)),h===c}function sr(h,c){return h&&h.toString().replace(!c||!c.iri?d.ESCAPE:p.ESCAPE,F)}function Pe(h,c){return h&&h.toString().replace(!c||!c.iri?d.PCT_ENCODED:p.PCT_ENCODED,K)}var rt={scheme:"http",domainHost:!0,parse:function(c,y){return c.host||(c.error=c.error||"HTTP URIs must have a host."),c},serialize:function(c,y){var k=String(c.scheme).toLowerCase()==="https";return(c.port===(k?443:80)||c.port==="")&&(c.port=void 0),c.path||(c.path="/"),c}},os={scheme:"https",domainHost:rt.domainHost,parse:rt.parse,serialize:rt.serialize};function as(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var qt={scheme:"ws",domainHost:!0,parse:function(c,y){var k=c;return k.secure=as(k),k.resourceName=(k.path||"/")+(k.query?"?"+k.query:""),k.path=void 0,k.query=void 0,k},serialize:function(c,y){if((c.port===(as(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 k=c.resourceName.split("?"),R=b(k,2),U=R[0],V=R[1];c.path=U&&U!=="/"?U:void 0,c.query=V,c.resourceName=void 0}return c.fragment=void 0,c}},cs={scheme:"wss",domainHost:qt.domainHost,parse:qt.parse,serialize:qt.serialize},vo={},ls="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Ae="[0-9A-Fa-f]",bo=s(s("%[EFef]"+Ae+"%"+Ae+Ae+"%"+Ae+Ae)+"|"+s("%[89A-Fa-f]"+Ae+"%"+Ae+Ae)+"|"+s("%"+Ae+Ae)),Eo="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Po="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",So=n(Po,'[\\"\\\\]'),To="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Ro=new RegExp(ls,"g"),wt=new RegExp(bo,"g"),ko=new RegExp(n("[^]",Eo,"[\\.]",'[\\"]',So),"g"),us=new RegExp(n("[^]",ls,To),"g"),Oo=us;function Wr(h){var c=K(h);return c.match(Ro)?c:h}var ds={scheme:"mailto",parse:function(c,y){var k=c,R=k.to=k.path?k.path.split(","):[];if(k.path=void 0,k.query){for(var U=!1,V={},Z=k.query.split("&"),te=0,ae=Z.length;te<ae;++te){var J=Z[te].split("=");switch(J[0]){case"to":for(var ee=J[1].split(","),ce=0,H=ee.length;ce<H;++ce)R.push(ee[ce]);break;case"subject":k.subject=Pe(J[1],y);break;case"body":k.body=Pe(J[1],y);break;default:U=!0,V[Pe(J[0],y)]=Pe(J[1],y);break}}U&&(k.headers=V)}k.query=void 0;for(var ne=0,fe=R.length;ne<fe;++ne){var se=R[ne].split("@");if(se[0]=Pe(se[0]),y.unicodeSupport)se[1]=Pe(se[1],y).toLowerCase();else try{se[1]=N.toASCII(Pe(se[1],y).toLowerCase())}catch(Ke){k.error=k.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ke}R[ne]=se.join("@")}return k},serialize:function(c,y){var k=c,R=u(c.to);if(R){for(var U=0,V=R.length;U<V;++U){var Z=String(R[U]),te=Z.lastIndexOf("@"),ae=Z.slice(0,te).replace(wt,Wr).replace(wt,o).replace(ko,F),J=Z.slice(te+1);try{J=y.iri?N.toUnicode(J):N.toASCII(Pe(J,y).toLowerCase())}catch(ne){k.error=k.error||"Email address's domain name can not be converted to "+(y.iri?"Unicode":"ASCII")+" via punycode: "+ne}R[U]=ae+"@"+J}k.path=R.join(",")}var ee=c.headers=c.headers||{};c.subject&&(ee.subject=c.subject),c.body&&(ee.body=c.body);var ce=[];for(var H in ee)ee[H]!==vo[H]&&ce.push(H.replace(wt,Wr).replace(wt,o).replace(us,F)+"="+ee[H].replace(wt,Wr).replace(wt,o).replace(Oo,F));return ce.length&&(k.query=ce.join("&")),k}},Co=/^([^\:]+)\:(.*)/,fs={scheme:"urn",parse:function(c,y){var k=c.path&&c.path.match(Co),R=c;if(k){var U=y.scheme||R.scheme||"urn",V=k[1].toLowerCase(),Z=k[2],te=U+":"+(y.nid||V),ae=L[te];R.nid=V,R.nss=Z,R.path=void 0,ae&&(R=ae.parse(R,y))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(c,y){var k=y.scheme||c.scheme||"urn",R=c.nid,U=k+":"+(y.nid||R),V=L[U];V&&(c=V.serialize(c,y));var Z=c,te=c.nss;return Z.path=(R||y.nid)+":"+te,Z}},No=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ps={scheme:"urn:uuid",parse:function(c,y){var k=c;return k.uuid=k.nss,k.nss=void 0,!y.tolerant&&(!k.uuid||!k.uuid.match(No))&&(k.error=k.error||"UUID is not valid."),k},serialize:function(c,y){var k=c;return k.nss=(c.uuid||"").toLowerCase(),k}};L[rt.scheme]=rt,L[os.scheme]=os,L[qt.scheme]=qt,L[cs.scheme]=cs,L[ds.scheme]=ds,L[fs.scheme]=fs,L[ps.scheme]=ps,r.SCHEMES=L,r.pctEncChar=F,r.pctDecChars=K,r.parse=be,r.removeDotSegments=je,r.serialize=_e,r.resolveComponents=_t,r.resolve=Lt,r.normalize=tt,r.equal=Ft,r.escapeComponent=sr,r.unescapeComponent=Pe,Object.defineProperty(r,"__esModule",{value:!0})})})(cn,cn.exports);var rl=cn.exports;Object.defineProperty(Tn,"__esModule",{value:!0});const Xi=rl;Xi.code='require("ajv/dist/runtime/uri").default';Tn.default=Xi;(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=Ne;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=B;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=tr,s=rr,i=ut,o=ve,u=B,f=me,l=er,d=X,p=tl,b=Tn,E=(M,w)=>new RegExp(M,w);E.code="new RegExp";const P=["removeAdditional","useDefaults","coerceTypes"],O=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$=200;function S(M){var w,j,T,a,m,N,L,F,K,Q,oe,Ie,mt,jt,At,be,Dt,yt,gt,$t,Mt,je,_e,_t,Lt;const tt=M.strict,Ft=(w=M.code)===null||w===void 0?void 0:w.optimize,sr=Ft===!0||Ft===void 0?1:Ft||0,Pe=(T=(j=M.code)===null||j===void 0?void 0:j.regExp)!==null&&T!==void 0?T:E,rt=(a=M.uriResolver)!==null&&a!==void 0?a:b.default;return{strictSchema:(N=(m=M.strictSchema)!==null&&m!==void 0?m:tt)!==null&&N!==void 0?N:!0,strictNumbers:(F=(L=M.strictNumbers)!==null&&L!==void 0?L:tt)!==null&&F!==void 0?F:!0,strictTypes:(Q=(K=M.strictTypes)!==null&&K!==void 0?K:tt)!==null&&Q!==void 0?Q:"log",strictTuples:(Ie=(oe=M.strictTuples)!==null&&oe!==void 0?oe:tt)!==null&&Ie!==void 0?Ie:"log",strictRequired:(jt=(mt=M.strictRequired)!==null&&mt!==void 0?mt:tt)!==null&&jt!==void 0?jt:!1,code:M.code?{...M.code,optimize:sr,regExp:Pe}:{optimize:sr,regExp:Pe},loopRequired:(At=M.loopRequired)!==null&&At!==void 0?At:$,loopEnum:(be=M.loopEnum)!==null&&be!==void 0?be:$,meta:(Dt=M.meta)!==null&&Dt!==void 0?Dt:!0,messages:(yt=M.messages)!==null&&yt!==void 0?yt:!0,inlineRefs:(gt=M.inlineRefs)!==null&>!==void 0?gt:!0,schemaId:($t=M.schemaId)!==null&&$t!==void 0?$t:"$id",addUsedSchema:(Mt=M.addUsedSchema)!==null&&Mt!==void 0?Mt:!0,validateSchema:(je=M.validateSchema)!==null&&je!==void 0?je:!0,validateFormats:(_e=M.validateFormats)!==null&&_e!==void 0?_e:!0,unicodeRegExp:(_t=M.unicodeRegExp)!==null&&_t!==void 0?_t:!0,int32range:(Lt=M.int32range)!==null&&Lt!==void 0?Lt:!0,uriResolver:rt}}class I{constructor(w={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,w=this.opts={...w,...S(w)};const{es5:j,lines:T}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:O,es5:j,lines:T}),this.logger=Y(w.logger);const a=w.validateFormats;w.validateFormats=!1,this.RULES=(0,i.getRules)(),D.call(this,_,w,"NOT SUPPORTED"),D.call(this,g,w,"DEPRECATED","warn"),this._metaOpts=G.call(this),w.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),w.keywords&&W.call(this,w.keywords),typeof w.meta=="object"&&this.addMetaSchema(w.meta),C.call(this),w.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:w,meta:j,schemaId:T}=this.opts;let a=p;T==="id"&&(a={...p},a.id=a.$id,delete a.$id),j&&w&&this.addMetaSchema(a,a[T],!1)}defaultMeta(){const{meta:w,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof w=="object"?w[j]||w:void 0}validate(w,j){let T;if(typeof w=="string"){if(T=this.getSchema(w),!T)throw new Error(`no schema with key or ref "${w}"`)}else T=this.compile(w);const a=T(j);return"$async"in T||(this.errors=T.errors),a}compile(w,j){const T=this._addSchema(w,j);return T.validate||this._compileSchemaEnv(T)}compileAsync(w,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:T}=this.opts;return a.call(this,w,j);async function a(Q,oe){await m.call(this,Q.$schema);const Ie=this._addSchema(Q,oe);return Ie.validate||N.call(this,Ie)}async function m(Q){Q&&!this.getSchema(Q)&&await a.call(this,{$ref:Q},!0)}async function N(Q){try{return this._compileSchemaEnv(Q)}catch(oe){if(!(oe instanceof s.default))throw oe;return L.call(this,oe),await F.call(this,oe.missingSchema),N.call(this,Q)}}function L({missingSchema:Q,missingRef:oe}){if(this.refs[Q])throw new Error(`AnySchema ${Q} is loaded but ${oe} cannot be resolved`)}async function F(Q){const oe=await K.call(this,Q);this.refs[Q]||await m.call(this,oe.$schema),this.refs[Q]||this.addSchema(oe,Q,j)}async function K(Q){const oe=this._loading[Q];if(oe)return oe;try{return await(this._loading[Q]=T(Q))}finally{delete this._loading[Q]}}}addSchema(w,j,T,a=this.opts.validateSchema){if(Array.isArray(w)){for(const N of w)this.addSchema(N,void 0,T,a);return this}let m;if(typeof w=="object"){const{schemaId:N}=this.opts;if(m=w[N],m!==void 0&&typeof m!="string")throw new Error(`schema ${N} must be string`)}return j=(0,f.normalizeId)(j||m),this._checkUnique(j),this.schemas[j]=this._addSchema(w,T,j,a,!0),this}addMetaSchema(w,j,T=this.opts.validateSchema){return this.addSchema(w,j,!0,T),this}validateSchema(w,j){if(typeof w=="boolean")return!0;let T;if(T=w.$schema,T!==void 0&&typeof T!="string")throw new Error("$schema must be a string");if(T=T||this.opts.defaultMeta||this.defaultMeta(),!T)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const a=this.validate(T,w);if(!a&&j){const m="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(m);else throw new Error(m)}return a}getSchema(w){let j;for(;typeof(j=v.call(this,w))=="string";)w=j;if(j===void 0){const{schemaId:T}=this.opts,a=new o.SchemaEnv({schema:{},schemaId:T});if(j=o.resolveSchema.call(this,a,w),!j)return;this.refs[w]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(w){if(w instanceof RegExp)return this._removeAllSchemas(this.schemas,w),this._removeAllSchemas(this.refs,w),this;switch(typeof w){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=v.call(this,w);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[w],delete this.refs[w],this}case"object":{const j=w;this._cache.delete(j);let T=w[this.opts.schemaId];return T&&(T=(0,f.normalizeId)(T),delete this.schemas[T],delete this.refs[T]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(w){for(const j of w)this.addKeyword(j);return this}addKeyword(w,j){let T;if(typeof w=="string")T=w,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=T);else if(typeof w=="object"&&j===void 0){if(j=w,T=j.keyword,Array.isArray(T)&&!T.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(de.call(this,T,j),!j)return(0,d.eachItem)(T,m=>Xe.call(this,m)),this;pt.call(this,j);const a={...j,type:(0,l.getJSONTypes)(j.type),schemaType:(0,l.getJSONTypes)(j.schemaType)};return(0,d.eachItem)(T,a.type.length===0?m=>Xe.call(this,m,a):m=>a.type.forEach(N=>Xe.call(this,m,a,N))),this}getKeyword(w){const j=this.RULES.all[w];return typeof j=="object"?j.definition:!!j}removeKeyword(w){const{RULES:j}=this;delete j.keywords[w],delete j.all[w];for(const T of j.rules){const a=T.rules.findIndex(m=>m.keyword===w);a>=0&&T.rules.splice(a,1)}return this}addFormat(w,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[w]=j,this}errorsText(w=this.errors,{separator:j=", ",dataVar:T="data"}={}){return!w||w.length===0?"No errors":w.map(a=>`${T}${a.instancePath} ${a.message}`).reduce((a,m)=>a+j+m)}$dataMetaSchema(w,j){const T=this.RULES.all;w=JSON.parse(JSON.stringify(w));for(const a of j){const m=a.split("/").slice(1);let N=w;for(const L of m)N=N[L];for(const L in T){const F=T[L];if(typeof F!="object")continue;const{$data:K}=F.definition,Q=N[L];K&&Q&&(N[L]=ht(Q))}}return w}_removeAllSchemas(w,j){for(const T in w){const a=w[T];(!j||j.test(T))&&(typeof a=="string"?delete w[T]:a&&!a.meta&&(this._cache.delete(a.schema),delete w[T]))}}_addSchema(w,j,T,a=this.opts.validateSchema,m=this.opts.addUsedSchema){let N;const{schemaId:L}=this.opts;if(typeof w=="object")N=w[L];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof w!="boolean")throw new Error("schema must be object or boolean")}let F=this._cache.get(w);if(F!==void 0)return F;T=(0,f.normalizeId)(N||T);const K=f.getSchemaRefs.call(this,w,T);return F=new o.SchemaEnv({schema:w,schemaId:L,meta:j,baseId:T,localRefs:K}),this._cache.set(F.schema,F),m&&!T.startsWith("#")&&(T&&this._checkUnique(T),this.refs[T]=F),a&&this.validateSchema(w,!0),F}_checkUnique(w){if(this.schemas[w]||this.refs[w])throw new Error(`schema with key or id "${w}" already exists`)}_compileSchemaEnv(w){if(w.meta?this._compileMetaSchema(w):o.compileSchema.call(this,w),!w.validate)throw new Error("ajv implementation error");return w.validate}_compileMetaSchema(w){const j=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,w)}finally{this.opts=j}}}e.default=I,I.ValidationError=n.default,I.MissingRefError=s.default;function D(M,w,j,T="error"){for(const a in M){const m=a;m in w&&this.logger[T](`${j}: option ${a}. ${M[m]}`)}}function v(M){return M=(0,f.normalizeId)(M),this.schemas[M]||this.refs[M]}function C(){const M=this.opts.schemas;if(M)if(Array.isArray(M))this.addSchema(M);else for(const w in M)this.addSchema(M[w],w)}function A(){for(const M in this.opts.formats){const w=this.opts.formats[M];w&&this.addFormat(M,w)}}function W(M){if(Array.isArray(M)){this.addVocabulary(M);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const w in M){const j=M[w];j.keyword||(j.keyword=w),this.addKeyword(j)}}function G(){const M={...this.opts};for(const w of P)delete M[w];return M}const ie={log(){},warn(){},error(){}};function Y(M){if(M===!1)return ie;if(M===void 0)return console;if(M.log&&M.warn&&M.error)return M;throw new Error("logger must implement log, warn and error methods")}const Ee=/^[a-z_$][a-z0-9_$:-]*$/i;function de(M,w){const{RULES:j}=this;if((0,d.eachItem)(M,T=>{if(j.keywords[T])throw new Error(`Keyword ${T} is already defined`);if(!Ee.test(T))throw new Error(`Keyword ${T} has invalid name`)}),!!w&&w.$data&&!("code"in w||"validate"in w))throw new Error('$data keyword must have "code" or "validate" function')}function Xe(M,w,j){var T;const a=w==null?void 0:w.post;if(j&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:m}=this;let N=a?m.post:m.rules.find(({type:F})=>F===j);if(N||(N={type:j,rules:[]},m.rules.push(N)),m.keywords[M]=!0,!w)return;const L={keyword:M,definition:{...w,type:(0,l.getJSONTypes)(w.type),schemaType:(0,l.getJSONTypes)(w.schemaType)}};w.before?et.call(this,N,L,w.before):N.rules.push(L),m.all[M]=L,(T=w.implements)===null||T===void 0||T.forEach(F=>this.addKeyword(F))}function et(M,w,j){const T=M.rules.findIndex(a=>a.keyword===j);T>=0?M.rules.splice(T,0,w):(M.rules.push(w),this.logger.warn(`rule ${j} is not defined`))}function pt(M){let{metaSchema:w}=M;w!==void 0&&(M.$data&&this.opts.$data&&(w=ht(w)),M.validateSchema=this.compile(w,!0))}const It={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ht(M){return{anyOf:[M,It]}}})(ki);var Rn={},kn={},On={};Object.defineProperty(On,"__esModule",{value:!0});const nl={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};On.default=nl;var dt={};Object.defineProperty(dt,"__esModule",{value:!0});dt.callRef=dt.getValidate=void 0;const sl=rr,js=x,we=B,Et=We,As=ve,cr=X,il={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:u,self:f}=n,{root:l}=i;if((r==="#"||r==="#/")&&s===l.baseId)return p();const d=As.resolveRef.call(f,l,s,r);if(d===void 0)throw new sl.default(n.opts.uriResolver,s,r);if(d instanceof As.SchemaEnv)return b(d);return E(d);function p(){if(i===l)return gr(e,o,i,i.$async);const P=t.scopeValue("root",{ref:l});return gr(e,(0,we._)`${P}.validate`,l,l.$async)}function b(P){const O=eo(e,P);gr(e,O,P,P.$async)}function E(P){const O=t.scopeValue("schema",u.code.source===!0?{ref:P,code:(0,we.stringify)(P)}:{ref:P}),_=t.name("valid"),g=e.subschema({schema:P,dataTypes:[],schemaPath:we.nil,topSchemaRef:O,errSchemaPath:r},_);e.mergeEvaluated(g),e.ok(_)}}};function eo(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,we._)`${r.scopeValue("wrapper",{ref:t})}.validate`}dt.getValidate=eo;function gr(e,t,r,n){const{gen:s,it:i}=e,{allErrors:o,schemaEnv:u,opts:f}=i,l=f.passContext?Et.default.this:we.nil;n?d():p();function d(){if(!u.$async)throw new Error("async schema referenced by sync schema");const P=s.let("valid");s.try(()=>{s.code((0,we._)`await ${(0,js.callValidateCode)(e,t,l)}`),E(t),o||s.assign(P,!0)},O=>{s.if((0,we._)`!(${O} instanceof ${i.ValidationError})`,()=>s.throw(O)),b(O),o||s.assign(P,!1)}),e.ok(P)}function p(){e.result((0,js.callValidateCode)(e,t,l),()=>E(t),()=>b(t))}function b(P){const O=(0,we._)`${P}.errors`;s.assign(Et.default.vErrors,(0,we._)`${Et.default.vErrors} === null ? ${O} : ${Et.default.vErrors}.concat(${O})`),s.assign(Et.default.errors,(0,we._)`${Et.default.vErrors}.length`)}function E(P){var O;if(!i.opts.unevaluated)return;const _=(O=r==null?void 0:r.validate)===null||O===void 0?void 0:O.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=cr.mergeEvaluated.props(s,_.props,i.props));else{const g=s.var("props",(0,we._)`${P}.evaluated.props`);i.props=cr.mergeEvaluated.props(s,g,i.props,we.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=cr.mergeEvaluated.items(s,_.items,i.items));else{const g=s.var("items",(0,we._)`${P}.evaluated.items`);i.items=cr.mergeEvaluated.items(s,g,i.items,we.Name)}}}dt.callRef=gr;dt.default=il;Object.defineProperty(kn,"__esModule",{value:!0});const ol=On,al=dt,cl=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",ol.default,al.default];kn.default=cl;var Cn={},Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});const Rr=B,Qe=Rr.operators,kr={maximum:{okStr:"<=",ok:Qe.LTE,fail:Qe.GT},minimum:{okStr:">=",ok:Qe.GTE,fail:Qe.LT},exclusiveMaximum:{okStr:"<",ok:Qe.LT,fail:Qe.GTE},exclusiveMinimum:{okStr:">",ok:Qe.GT,fail:Qe.LTE}},ll={message:({keyword:e,schemaCode:t})=>(0,Rr.str)`must be ${kr[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Rr._)`{comparison: ${kr[e].okStr}, limit: ${t}}`},ul={keyword:Object.keys(kr),type:"number",schemaType:"number",$data:!0,error:ll,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Rr._)`${r} ${kr[t].fail} ${n} || isNaN(${r})`)}};Nn.default=ul;var In={};Object.defineProperty(In,"__esModule",{value:!0});const Bt=B,dl={message:({schemaCode:e})=>(0,Bt.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Bt._)`{multipleOf: ${e}}`},fl={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:dl,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),u=i?(0,Bt._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,Bt._)`${o} !== parseInt(${o})`;e.fail$data((0,Bt._)`(${n} === 0 || (${o} = ${r}/${n}, ${u}))`)}};In.default=fl;var jn={},An={};Object.defineProperty(An,"__esModule",{value:!0});function to(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}An.default=to;to.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(jn,"__esModule",{value:!0});const at=B,pl=X,hl=An,ml={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,at.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,at._)`{limit: ${e}}`},yl={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ml,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?at.operators.GT:at.operators.LT,o=s.opts.unicode===!1?(0,at._)`${r}.length`:(0,at._)`${(0,pl.useFunc)(e.gen,hl.default)}(${r})`;e.fail$data((0,at._)`${o} ${i} ${n}`)}};jn.default=yl;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});const gl=x,Or=B,$l={message:({schemaCode:e})=>(0,Or.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Or._)`{pattern: ${e}}`},_l={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:$l,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:i}=e,o=i.opts.unicodeRegExp?"u":"",u=r?(0,Or._)`(new RegExp(${s}, ${o}))`:(0,gl.usePattern)(e,n);e.fail$data((0,Or._)`!${u}.test(${t})`)}};Dn.default=_l;var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});const Gt=B,wl={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,Gt.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Gt._)`{limit: ${e}}`},vl={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:wl,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Gt.operators.GT:Gt.operators.LT;e.fail$data((0,Gt._)`Object.keys(${r}).length ${s} ${n}`)}};Mn.default=vl;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});const Wt=x,Kt=B,bl=X,El={message:({params:{missingProperty:e}})=>(0,Kt.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Kt._)`{missingProperty: ${e}}`},Pl={keyword:"required",type:"object",schemaType:"array",$data:!0,error:El,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:o}=e,{opts:u}=o;if(!i&&r.length===0)return;const f=r.length>=u.loopRequired;if(o.allErrors?l():d(),u.strictRequired){const E=e.parentSchema.properties,{definedProperties:P}=e.it;for(const O of r)if((E==null?void 0:E[O])===void 0&&!P.has(O)){const _=o.schemaEnv.baseId+o.errSchemaPath,g=`required property "${O}" is not defined at "${_}" (strictRequired)`;(0,bl.checkStrictMode)(o,g,o.opts.strictRequired)}}function l(){if(f||i)e.block$data(Kt.nil,p);else for(const E of r)(0,Wt.checkReportMissingProp)(e,E)}function d(){const E=t.let("missing");if(f||i){const P=t.let("valid",!0);e.block$data(P,()=>b(E,P)),e.ok(P)}else t.if((0,Wt.checkMissingProp)(e,r,E)),(0,Wt.reportMissingProp)(e,E),t.else()}function p(){t.forOf("prop",n,E=>{e.setParams({missingProperty:E}),t.if((0,Wt.noPropertyInData)(t,s,E,u.ownProperties),()=>e.error())})}function b(E,P){e.setParams({missingProperty:E}),t.forOf(E,n,()=>{t.assign(P,(0,Wt.propertyInData)(t,s,E,u.ownProperties)),t.if((0,Kt.not)(P),()=>{e.error(),t.break()})},Kt.nil)}}};Ln.default=Pl;var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});const Jt=B,Sl={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,Jt.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Jt._)`{limit: ${e}}`},Tl={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Sl,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Jt.operators.GT:Jt.operators.LT;e.fail$data((0,Jt._)`${r}.length ${s} ${n}`)}};Fn.default=Tl;var qn={},nr={};Object.defineProperty(nr,"__esModule",{value:!0});const ro=Mi;ro.code='require("ajv/dist/runtime/equal").default';nr.default=ro;Object.defineProperty(qn,"__esModule",{value:!0});const Yr=er,he=B,Rl=X,kl=nr,Ol={message:({params:{i:e,j:t}})=>(0,he.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,he._)`{i: ${e}, j: ${t}}`},Cl={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Ol,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:u}=e;if(!n&&!s)return;const f=t.let("valid"),l=i.items?(0,Yr.getSchemaTypes)(i.items):[];e.block$data(f,d,(0,he._)`${o} === false`),e.ok(f);function d(){const P=t.let("i",(0,he._)`${r}.length`),O=t.let("j");e.setParams({i:P,j:O}),t.assign(f,!0),t.if((0,he._)`${P} > 1`,()=>(p()?b:E)(P,O))}function p(){return l.length>0&&!l.some(P=>P==="object"||P==="array")}function b(P,O){const _=t.name("item"),g=(0,Yr.checkDataTypes)(l,_,u.opts.strictNumbers,Yr.DataType.Wrong),$=t.const("indices",(0,he._)`{}`);t.for((0,he._)`;${P}--;`,()=>{t.let(_,(0,he._)`${r}[${P}]`),t.if(g,(0,he._)`continue`),l.length>1&&t.if((0,he._)`typeof ${_} == "string"`,(0,he._)`${_} += "_"`),t.if((0,he._)`typeof ${$}[${_}] == "number"`,()=>{t.assign(O,(0,he._)`${$}[${_}]`),e.error(),t.assign(f,!1).break()}).code((0,he._)`${$}[${_}] = ${P}`)})}function E(P,O){const _=(0,Rl.useFunc)(t,kl.default),g=t.name("outer");t.label(g).for((0,he._)`;${P}--;`,()=>t.for((0,he._)`${O} = ${P}; ${O}--;`,()=>t.if((0,he._)`${_}(${r}[${P}], ${r}[${O}])`,()=>{e.error(),t.assign(f,!1).break(g)})))}}};qn.default=Cl;var Un={};Object.defineProperty(Un,"__esModule",{value:!0});const ln=B,Nl=X,Il=nr,jl={message:"must be equal to constant",params:({schemaCode:e})=>(0,ln._)`{allowedValue: ${e}}`},Al={keyword:"const",$data:!0,error:jl,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,ln._)`!${(0,Nl.useFunc)(t,Il.default)}(${r}, ${s})`):e.fail((0,ln._)`${i} !== ${r}`)}};Un.default=Al;var Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});const Ht=B,Dl=X,Ml=nr,Ll={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ht._)`{allowedValues: ${e}}`},Fl={keyword:"enum",schemaType:"array",$data:!0,error:Ll,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const u=s.length>=o.opts.loopEnum;let f;const l=()=>f??(f=(0,Dl.useFunc)(t,Ml.default));let d;if(u||n)d=t.let("valid"),e.block$data(d,p);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const E=t.const("vSchema",i);d=(0,Ht.or)(...s.map((P,O)=>b(E,O)))}e.pass(d);function p(){t.assign(d,!1),t.forOf("v",i,E=>t.if((0,Ht._)`${l()}(${r}, ${E})`,()=>t.assign(d,!0).break()))}function b(E,P){const O=s[P];return typeof O=="object"&&O!==null?(0,Ht._)`${l()}(${r}, ${E}[${P}])`:(0,Ht._)`${r} === ${O}`}}};Vn.default=Fl;Object.defineProperty(Cn,"__esModule",{value:!0});const ql=Nn,Ul=In,Vl=jn,zl=Dn,Wl=Mn,Hl=Ln,xl=Fn,Bl=qn,Gl=Un,Kl=Vn,Jl=[ql.default,Ul.default,Vl.default,zl.default,Wl.default,Hl.default,xl.default,Bl.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Gl.default,Kl.default];Cn.default=Jl;var zn={},Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.validateAdditionalItems=void 0;const ct=B,un=X,Ql={message:({params:{len:e}})=>(0,ct.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ct._)`{limit: ${e}}`},Yl={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Ql,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,un.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}no(e,n)}};function no(e,t){const{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;const u=r.const("len",(0,ct._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,ct._)`${u} <= ${t.length}`);else if(typeof n=="object"&&!(0,un.alwaysValidSchema)(o,n)){const l=r.var("valid",(0,ct._)`${u} <= ${t.length}`);r.if((0,ct.not)(l),()=>f(l)),e.ok(l)}function f(l){r.forRange("i",t.length,u,d=>{e.subschema({keyword:i,dataProp:d,dataPropType:un.Type.Num},l),o.allErrors||r.if((0,ct.not)(l),()=>r.break())})}}Ct.validateAdditionalItems=no;Ct.default=Yl;var Wn={},Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.validateTuple=void 0;const Ds=B,$r=X,Zl=x,Xl={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return so(e,"additionalItems",t);r.items=!0,!(0,$r.alwaysValidSchema)(r,t)&&e.ok((0,Zl.validateArray)(e))}};function so(e,t,r=e.schema){const{gen:n,parentSchema:s,data:i,keyword:o,it:u}=e;d(s),u.opts.unevaluated&&r.length&&u.items!==!0&&(u.items=$r.mergeEvaluated.items(n,r.length,u.items));const f=n.name("valid"),l=n.const("len",(0,Ds._)`${i}.length`);r.forEach((p,b)=>{(0,$r.alwaysValidSchema)(u,p)||(n.if((0,Ds._)`${l} > ${b}`,()=>e.subschema({keyword:o,schemaProp:b,dataProp:b},f)),e.ok(f))});function d(p){const{opts:b,errSchemaPath:E}=u,P=r.length,O=P===p.minItems&&(P===p.maxItems||p[t]===!1);if(b.strictTuples&&!O){const _=`"${o}" is ${P}-tuple, but minItems or maxItems/${t} are not specified or different at path "${E}"`;(0,$r.checkStrictMode)(u,_,b.strictTuples)}}}Nt.validateTuple=so;Nt.default=Xl;Object.defineProperty(Wn,"__esModule",{value:!0});const eu=Nt,tu={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,eu.validateTuple)(e,"items")};Wn.default=tu;var Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});const Ms=B,ru=X,nu=x,su=Ct,iu={message:({params:{len:e}})=>(0,Ms.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ms._)`{limit: ${e}}`},ou={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:iu,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,ru.alwaysValidSchema)(n,t)&&(s?(0,su.validateAdditionalItems)(e,s):e.ok((0,nu.validateArray)(e)))}};Hn.default=ou;var xn={};Object.defineProperty(xn,"__esModule",{value:!0});const Re=B,lr=X,au={message:({params:{min:e,max:t}})=>t===void 0?(0,Re.str)`must contain at least ${e} valid item(s)`:(0,Re.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Re._)`{minContains: ${e}}`:(0,Re._)`{minContains: ${e}, maxContains: ${t}}`},cu={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:au,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;let o,u;const{minContains:f,maxContains:l}=n;i.opts.next?(o=f===void 0?1:f,u=l):o=1;const d=t.const("len",(0,Re._)`${s}.length`);if(e.setParams({min:o,max:u}),u===void 0&&o===0){(0,lr.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(u!==void 0&&o>u){(0,lr.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,lr.alwaysValidSchema)(i,r)){let O=(0,Re._)`${d} >= ${o}`;u!==void 0&&(O=(0,Re._)`${O} && ${d} <= ${u}`),e.pass(O);return}i.items=!0;const p=t.name("valid");u===void 0&&o===1?E(p,()=>t.if(p,()=>t.break())):o===0?(t.let(p,!0),u!==void 0&&t.if((0,Re._)`${s}.length > 0`,b)):(t.let(p,!1),b()),e.result(p,()=>e.reset());function b(){const O=t.name("_valid"),_=t.let("count",0);E(O,()=>t.if(O,()=>P(_)))}function E(O,_){t.forRange("i",0,d,g=>{e.subschema({keyword:"contains",dataProp:g,dataPropType:lr.Type.Num,compositeRule:!0},O),_()})}function P(O){t.code((0,Re._)`${O}++`),u===void 0?t.if((0,Re._)`${O} >= ${o}`,()=>t.assign(p,!0).break()):(t.if((0,Re._)`${O} > ${u}`,()=>t.assign(p,!1).break()),o===1?t.assign(p,!0):t.if((0,Re._)`${O} >= ${o}`,()=>t.assign(p,!0)))}}};xn.default=cu;var io={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=B,r=X,n=x;e.error={message:({params:{property:f,depsCount:l,deps:d}})=>{const p=l===1?"property":"properties";return(0,t.str)`must have ${p} ${d} when property ${f} is present`},params:({params:{property:f,depsCount:l,deps:d,missingProperty:p}})=>(0,t._)`{property: ${f},
|
|
635
|
+
missingProperty: ${p},
|
|
671
636
|
depsCount: ${l},
|
|
672
|
-
deps: ${p}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[l,p]=o(u);i(u,l),c(u,p)}};function o({schema:u}){const l={},p={};for(const f in u){if(f==="__proto__")continue;const b=Array.isArray(u[f])?l:p;b[f]=u[f]}return[l,p]}function i(u,l=u.schema){const{gen:p,data:f,it:b}=u;if(Object.keys(l).length===0)return;const P=p.let("missing");for(const E in l){const C=l[E];if(C.length===0)continue;const $=(0,n.propertyInData)(p,f,E,b.opts.ownProperties);u.setParams({property:E,depsCount:C.length,deps:C.join(", ")}),b.allErrors?p.if($,()=>{for(const _ of C)(0,n.checkReportMissingProp)(u,_)}):(p.if((0,t._)`${$} && (${(0,n.checkMissingProp)(u,C,P)})`),(0,n.reportMissingProp)(u,P),p.else())}}e.validatePropertyDeps=i;function c(u,l=u.schema){const{gen:p,data:f,keyword:b,it:P}=u,E=p.name("valid");for(const C in l)(0,r.alwaysValidSchema)(P,l[C])||(p.if((0,n.propertyInData)(p,f,C,P.opts.ownProperties),()=>{const $=u.subschema({keyword:b,schemaProp:C},E);u.mergeValidEvaluated($,E)},()=>p.var(E,!0)),u.ok(E))}e.validateSchemaDeps=c,e.default=s})(dependencies);var propertyNames={};Object.defineProperty(propertyNames,"__esModule",{value:!0});const codegen_1$6=codegen,util_1$9=util,error$5={message:"property name must be valid",params:({params:e})=>(0,codegen_1$6._)`{propertyName: ${e.propertyName}}`},def$b={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:error$5,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,util_1$9.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if((0,codegen_1$6.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};propertyNames.default=def$b;var additionalProperties={};Object.defineProperty(additionalProperties,"__esModule",{value:!0});const code_1$3=code,codegen_1$5=codegen,names_1=names$1,util_1$8=util,error$4={message:"must NOT have additional properties",params:({params:e})=>(0,codegen_1$5._)`{additionalProperty: ${e.additionalProperty}}`},def$a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:error$4,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:c,opts:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&(0,util_1$8.alwaysValidSchema)(i,r))return;const l=(0,code_1$3.allSchemaProperties)(n.properties),p=(0,code_1$3.allSchemaProperties)(n.patternProperties);f(),e.ok((0,codegen_1$5._)`${o} === ${names_1.default.errors}`);function f(){t.forIn("key",s,$=>{!l.length&&!p.length?E($):t.if(b($),()=>E($))})}function b($){let _;if(l.length>8){const y=(0,util_1$8.schemaRefOrVal)(i,n.properties,"properties");_=(0,code_1$3.isOwnProperty)(t,y,$)}else l.length?_=(0,codegen_1$5.or)(...l.map(y=>(0,codegen_1$5._)`${$} === ${y}`)):_=codegen_1$5.nil;return p.length&&(_=(0,codegen_1$5.or)(_,...p.map(y=>(0,codegen_1$5._)`${(0,code_1$3.usePattern)(e,y)}.test(${$})`))),(0,codegen_1$5.not)(_)}function P($){t.code((0,codegen_1$5._)`delete ${s}[${$}]`)}function E($){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){P($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),c||t.break();return}if(typeof r=="object"&&!(0,util_1$8.alwaysValidSchema)(i,r)){const _=t.name("valid");u.removeAdditional==="failing"?(C($,_,!1),t.if((0,codegen_1$5.not)(_),()=>{e.reset(),P($)})):(C($,_),c||t.if((0,codegen_1$5.not)(_),()=>t.break()))}}function C($,_,y){const S={keyword:"additionalProperties",dataProp:$,dataPropType:util_1$8.Type.Str};y===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,_)}}};additionalProperties.default=def$a;var properties$1={};Object.defineProperty(properties$1,"__esModule",{value:!0});const validate_1=validate,code_1$2=code,util_1$7=util,additionalProperties_1$1=additionalProperties,def$9={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&additionalProperties_1$1.default.code(new validate_1.KeywordCxt(o,additionalProperties_1$1.default,"additionalProperties"));const i=(0,code_1$2.allSchemaProperties)(r);for(const f of i)o.definedProperties.add(f);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=util_1$7.mergeEvaluated.props(t,(0,util_1$7.toHash)(i),o.props));const c=i.filter(f=>!(0,util_1$7.alwaysValidSchema)(o,r[f]));if(c.length===0)return;const u=t.name("valid");for(const f of c)l(f)?p(f):(t.if((0,code_1$2.propertyInData)(t,s,f,o.opts.ownProperties)),p(f),o.allErrors||t.else().var(u,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(u);function l(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function p(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},u)}}};properties$1.default=def$9;var patternProperties={};Object.defineProperty(patternProperties,"__esModule",{value:!0});const code_1$1=code,codegen_1$4=codegen,util_1$6=util,util_2=util,def$8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,c=(0,code_1$1.allSchemaProperties)(r),u=c.filter(C=>(0,util_1$6.alwaysValidSchema)(o,r[C]));if(c.length===0||u.length===c.length&&(!o.opts.unevaluated||o.props===!0))return;const l=i.strictSchema&&!i.allowMatchingProperties&&s.properties,p=t.name("valid");o.props!==!0&&!(o.props instanceof codegen_1$4.Name)&&(o.props=(0,util_2.evaluatedPropsToName)(t,o.props));const{props:f}=o;b();function b(){for(const C of c)l&&P(C),o.allErrors?E(C):(t.var(p,!0),E(C),t.if(p))}function P(C){for(const $ in l)new RegExp(C).test($)&&(0,util_1$6.checkStrictMode)(o,`property ${$} matches pattern ${C} (use allowMatchingProperties)`)}function E(C){t.forIn("key",n,$=>{t.if((0,codegen_1$4._)`${(0,code_1$1.usePattern)(e,C)}.test(${$})`,()=>{const _=u.includes(C);_||e.subschema({keyword:"patternProperties",schemaProp:C,dataProp:$,dataPropType:util_2.Type.Str},p),o.opts.unevaluated&&f!==!0?t.assign((0,codegen_1$4._)`${f}[${$}]`,!0):!_&&!o.allErrors&&t.if((0,codegen_1$4.not)(p),()=>t.break())})})}}};patternProperties.default=def$8;var not={};Object.defineProperty(not,"__esModule",{value:!0});const util_1$5=util,def$7={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,util_1$5.alwaysValidSchema)(n,r)){e.fail();return}const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};not.default=def$7;var anyOf={};Object.defineProperty(anyOf,"__esModule",{value:!0});const code_1=code,def$6={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:code_1.validateUnion,error:{message:"must match a schema in anyOf"}};anyOf.default=def$6;var oneOf={};Object.defineProperty(oneOf,"__esModule",{value:!0});const codegen_1$3=codegen,util_1$4=util,error$3={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,codegen_1$3._)`{passingSchemas: ${e.passing}}`},def$5={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:error$3,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,i=t.let("valid",!1),c=t.let("passing",null),u=t.name("_valid");e.setParams({passing:c}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((p,f)=>{let b;(0,util_1$4.alwaysValidSchema)(s,p)?t.var(u,!0):b=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},u),f>0&&t.if((0,codegen_1$3._)`${u} && ${i}`).assign(i,!1).assign(c,(0,codegen_1$3._)`[${c}, ${f}]`).else(),t.if(u,()=>{t.assign(i,!0),t.assign(c,f),b&&e.mergeEvaluated(b,codegen_1$3.Name)})})}}};oneOf.default=def$5;var allOf={};Object.defineProperty(allOf,"__esModule",{value:!0});const util_1$3=util,def$4={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,i)=>{if((0,util_1$3.alwaysValidSchema)(n,o))return;const c=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(c)})}};allOf.default=def$4;var _if={};Object.defineProperty(_if,"__esModule",{value:!0});const codegen_1$2=codegen,util_1$2=util,error$2={message:({params:e})=>(0,codegen_1$2.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,codegen_1$2._)`{failingKeyword: ${e.ifClause}}`},def$3={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:error$2,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,util_1$2.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=hasSchema(n,"then"),o=hasSchema(n,"else");if(!s&&!o)return;const i=t.let("valid",!0),c=t.name("_valid");if(u(),e.reset(),s&&o){const p=t.let("ifClause");e.setParams({ifClause:p}),t.if(c,l("then",p),l("else",p))}else s?t.if(c,l("then")):t.if((0,codegen_1$2.not)(c),l("else"));e.pass(i,()=>e.error(!0));function u(){const p=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c);e.mergeEvaluated(p)}function l(p,f){return()=>{const b=e.subschema({keyword:p},c);t.assign(i,c),e.mergeValidEvaluated(b,i),f?t.assign(f,(0,codegen_1$2._)`${p}`):e.setParams({ifClause:p})}}}};function hasSchema(e,t){const r=e.schema[t];return r!==void 0&&!(0,util_1$2.alwaysValidSchema)(e,r)}_if.default=def$3;var thenElse={};Object.defineProperty(thenElse,"__esModule",{value:!0});const util_1$1=util,def$2={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,util_1$1.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};thenElse.default=def$2;Object.defineProperty(applicator,"__esModule",{value:!0});const additionalItems_1=additionalItems,prefixItems_1=prefixItems,items_1=items,items2020_1=items2020,contains_1=contains,dependencies_1=dependencies,propertyNames_1=propertyNames,additionalProperties_1=additionalProperties,properties_1=properties$1,patternProperties_1=patternProperties,not_1=not,anyOf_1=anyOf,oneOf_1=oneOf,allOf_1=allOf,if_1=_if,thenElse_1=thenElse;function getApplicator(e=!1){const t=[not_1.default,anyOf_1.default,oneOf_1.default,allOf_1.default,if_1.default,thenElse_1.default,propertyNames_1.default,additionalProperties_1.default,dependencies_1.default,properties_1.default,patternProperties_1.default];return e?t.push(prefixItems_1.default,items2020_1.default):t.push(additionalItems_1.default,items_1.default),t.push(contains_1.default),t}applicator.default=getApplicator;var format$2={},format$1={};Object.defineProperty(format$1,"__esModule",{value:!0});const codegen_1$1=codegen,error$1={message:({schemaCode:e})=>(0,codegen_1$1.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,codegen_1$1._)`{format: ${e}}`},def$1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:error$1,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:c}=e,{opts:u,errSchemaPath:l,schemaEnv:p,self:f}=c;if(!u.validateFormats)return;s?b():P();function b(){const E=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),C=r.const("fDef",(0,codegen_1$1._)`${E}[${i}]`),$=r.let("fType"),_=r.let("format");r.if((0,codegen_1$1._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`,()=>r.assign($,(0,codegen_1$1._)`${C}.type || "string"`).assign(_,(0,codegen_1$1._)`${C}.validate`),()=>r.assign($,(0,codegen_1$1._)`"string"`).assign(_,C)),e.fail$data((0,codegen_1$1.or)(y(),S()));function y(){return u.strictSchema===!1?codegen_1$1.nil:(0,codegen_1$1._)`${i} && !${_}`}function S(){const I=p.$async?(0,codegen_1$1._)`(${C}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,codegen_1$1._)`${_}(${n})`,D=(0,codegen_1$1._)`(typeof ${_} == "function" ? ${I} : ${_}.test(${n}))`;return(0,codegen_1$1._)`${_} && ${_} !== true && ${$} === ${t} && !${D}`}}function P(){const E=f.formats[o];if(!E){y();return}if(E===!0)return;const[C,$,_]=S(E);C===t&&e.pass(I());function y(){if(u.strictSchema===!1){f.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function S(D){const w=D instanceof RegExp?(0,codegen_1$1.regexpCode)(D):u.code.formats?(0,codegen_1$1._)`${u.code.formats}${(0,codegen_1$1.getProperty)(o)}`:void 0,O=r.scopeValue("formats",{key:o,ref:D,code:w});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,codegen_1$1._)`${O}.validate`]:["string",D,O]}function I(){if(typeof E=="object"&&!(E instanceof RegExp)&&E.async){if(!p.$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:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const c=n.propertyName;if(typeof c!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const u=t.let("valid",!1),l=t.const("tag",(0,codegen_1._)`${r}${(0,codegen_1.getProperty)(c)}`);t.if((0,codegen_1._)`typeof ${l} == "string"`,()=>p(),()=>e.error(!1,{discrError:types_1.DiscrError.Tag,tag:l,tagName:c})),e.ok(u);function p(){const P=b();t.if(!1);for(const E in P)t.elseIf((0,codegen_1._)`${l} === ${E}`),t.assign(u,f(P[E]));t.else(),e.error(!1,{discrError:types_1.DiscrError.Mapping,tag:l,tagName:c}),t.endIf()}function f(P){const E=t.name("valid"),C=e.subschema({keyword:"oneOf",schemaProp:P},E);return e.mergeEvaluated(C,codegen_1.Name),E}function b(){var P;const E={},C=_(s);let $=!0;for(let I=0;I<i.length;I++){let D=i[I];D!=null&&D.$ref&&!(0,util_1.schemaHasRulesButRef)(D,o.self.RULES)&&(D=compile_1.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,D==null?void 0:D.$ref),D instanceof compile_1.SchemaEnv&&(D=D.schema));const w=(P=D==null?void 0:D.properties)===null||P===void 0?void 0:P[c];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);$=$&&(C||_(D)),y(w,I)}if(!$)throw new Error(`discriminator: "${c}" must be required`);return E;function _({required:I}){return Array.isArray(I)&&I.includes(c)}function y(I,D){if(I.const)S(I.const,D);else if(I.enum)for(const w of I.enum)S(w,D);else throw new Error(`discriminator: "properties/${c}" must have "const" or "enum"`)}function S(I,D){if(typeof I!="string"||I in E)throw new Error(`discriminator: "${c}" values must be unique strings`);E[I]=D}}}};discriminator.default=def;const $schema$1="http://json-schema.org/draft-07/schema#",$id="http://json-schema.org/draft-07/schema#",title="Core schema meta-schema",definitions$1={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type=["object","boolean"],properties={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},require$$3={$schema:$schema$1,$id,title,definitions:definitions$1,type,properties,default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=core$2,n=draft7,s=discriminator,o=require$$3,i=["/properties"],c="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(E=>this.addVocabulary(E)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const E=this.opts.$data?this.$dataMetaSchema(o,i):o;this.addMetaSchema(E,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}e.exports=t=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var l=validate;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var p=codegen;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});var f=validation_error;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var b=ref_error;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return b.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.",deprecated:"Use meta.description instead."},meta:{type:"object",properties:{title:{type:"string",description:"A clear and concise name for your Blueprint."},description:{type:"string",description:"A brief explanation of what your Blueprint offers."},author:{type:"string",description:"A GitHub username of the author of this Blueprint."},categories:{type:"array",items:{type:"string"},description:"Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."}},required:["title","author"],additionalProperties:!1,description:"Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"},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",enum:["kitchen-sink","light"]},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 in wp-config.php. Possible values are:
|
|
637
|
+
deps: ${d}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(f){const[l,d]=i(f);o(f,l),u(f,d)}};function i({schema:f}){const l={},d={};for(const p in f){if(p==="__proto__")continue;const b=Array.isArray(f[p])?l:d;b[p]=f[p]}return[l,d]}function o(f,l=f.schema){const{gen:d,data:p,it:b}=f;if(Object.keys(l).length===0)return;const E=d.let("missing");for(const P in l){const O=l[P];if(O.length===0)continue;const _=(0,n.propertyInData)(d,p,P,b.opts.ownProperties);f.setParams({property:P,depsCount:O.length,deps:O.join(", ")}),b.allErrors?d.if(_,()=>{for(const g of O)(0,n.checkReportMissingProp)(f,g)}):(d.if((0,t._)`${_} && (${(0,n.checkMissingProp)(f,O,E)})`),(0,n.reportMissingProp)(f,E),d.else())}}e.validatePropertyDeps=o;function u(f,l=f.schema){const{gen:d,data:p,keyword:b,it:E}=f,P=d.name("valid");for(const O in l)(0,r.alwaysValidSchema)(E,l[O])||(d.if((0,n.propertyInData)(d,p,O,E.opts.ownProperties),()=>{const _=f.subschema({keyword:b,schemaProp:O},P);f.mergeValidEvaluated(_,P)},()=>d.var(P,!0)),f.ok(P))}e.validateSchemaDeps=u,e.default=s})(io);var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});const oo=B,lu=X,uu={message:"property name must be valid",params:({params:e})=>(0,oo._)`{propertyName: ${e.propertyName}}`},du={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:uu,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,lu.alwaysValidSchema)(s,r))return;const i=t.name("valid");t.forIn("key",n,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if((0,oo.not)(i),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(i)}};Bn.default=du;var zr={};Object.defineProperty(zr,"__esModule",{value:!0});const ur=x,Oe=B,fu=We,dr=X,pu={message:"must NOT have additional properties",params:({params:e})=>(0,Oe._)`{additionalProperty: ${e.additionalProperty}}`},hu={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:pu,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:u,opts:f}=o;if(o.props=!0,f.removeAdditional!=="all"&&(0,dr.alwaysValidSchema)(o,r))return;const l=(0,ur.allSchemaProperties)(n.properties),d=(0,ur.allSchemaProperties)(n.patternProperties);p(),e.ok((0,Oe._)`${i} === ${fu.default.errors}`);function p(){t.forIn("key",s,_=>{!l.length&&!d.length?P(_):t.if(b(_),()=>P(_))})}function b(_){let g;if(l.length>8){const $=(0,dr.schemaRefOrVal)(o,n.properties,"properties");g=(0,ur.isOwnProperty)(t,$,_)}else l.length?g=(0,Oe.or)(...l.map($=>(0,Oe._)`${_} === ${$}`)):g=Oe.nil;return d.length&&(g=(0,Oe.or)(g,...d.map($=>(0,Oe._)`${(0,ur.usePattern)(e,$)}.test(${_})`))),(0,Oe.not)(g)}function E(_){t.code((0,Oe._)`delete ${s}[${_}]`)}function P(_){if(f.removeAdditional==="all"||f.removeAdditional&&r===!1){E(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),u||t.break();return}if(typeof r=="object"&&!(0,dr.alwaysValidSchema)(o,r)){const g=t.name("valid");f.removeAdditional==="failing"?(O(_,g,!1),t.if((0,Oe.not)(g),()=>{e.reset(),E(_)})):(O(_,g),u||t.if((0,Oe.not)(g),()=>t.break()))}}function O(_,g,$){const S={keyword:"additionalProperties",dataProp:_,dataPropType:dr.Type.Str};$===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,g)}}};zr.default=hu;var Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});const mu=Ne,Ls=x,Zr=X,Fs=zr,yu={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&&Fs.default.code(new mu.KeywordCxt(i,Fs.default,"additionalProperties"));const o=(0,Ls.allSchemaProperties)(r);for(const p of o)i.definedProperties.add(p);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=Zr.mergeEvaluated.props(t,(0,Zr.toHash)(o),i.props));const u=o.filter(p=>!(0,Zr.alwaysValidSchema)(i,r[p]));if(u.length===0)return;const f=t.name("valid");for(const p of u)l(p)?d(p):(t.if((0,Ls.propertyInData)(t,s,p,i.opts.ownProperties)),d(p),i.allErrors||t.else().var(f,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(f);function l(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function d(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},f)}}};Gn.default=yu;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});const qs=x,fr=B,Us=X,Vs=X,gu={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,u=(0,qs.allSchemaProperties)(r),f=u.filter(O=>(0,Us.alwaysValidSchema)(i,r[O]));if(u.length===0||f.length===u.length&&(!i.opts.unevaluated||i.props===!0))return;const l=o.strictSchema&&!o.allowMatchingProperties&&s.properties,d=t.name("valid");i.props!==!0&&!(i.props instanceof fr.Name)&&(i.props=(0,Vs.evaluatedPropsToName)(t,i.props));const{props:p}=i;b();function b(){for(const O of u)l&&E(O),i.allErrors?P(O):(t.var(d,!0),P(O),t.if(d))}function E(O){for(const _ in l)new RegExp(O).test(_)&&(0,Us.checkStrictMode)(i,`property ${_} matches pattern ${O} (use allowMatchingProperties)`)}function P(O){t.forIn("key",n,_=>{t.if((0,fr._)`${(0,qs.usePattern)(e,O)}.test(${_})`,()=>{const g=f.includes(O);g||e.subschema({keyword:"patternProperties",schemaProp:O,dataProp:_,dataPropType:Vs.Type.Str},d),i.opts.unevaluated&&p!==!0?t.assign((0,fr._)`${p}[${_}]`,!0):!g&&!i.allErrors&&t.if((0,fr.not)(d),()=>t.break())})})}}};Kn.default=gu;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});const $u=X,_u={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,$u.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"}};Jn.default=_u;var Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});const wu=x,vu={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:wu.validateUnion,error:{message:"must match a schema in anyOf"}};Qn.default=vu;var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});const _r=B,bu=X,Eu={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,_r._)`{passingSchemas: ${e.passing}}`},Pu={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Eu,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const i=r,o=t.let("valid",!1),u=t.let("passing",null),f=t.name("_valid");e.setParams({passing:u}),t.block(l),e.result(o,()=>e.reset(),()=>e.error(!0));function l(){i.forEach((d,p)=>{let b;(0,bu.alwaysValidSchema)(s,d)?t.var(f,!0):b=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},f),p>0&&t.if((0,_r._)`${f} && ${o}`).assign(o,!1).assign(u,(0,_r._)`[${u}, ${p}]`).else(),t.if(f,()=>{t.assign(o,!0),t.assign(u,p),b&&e.mergeEvaluated(b,_r.Name)})})}}};Yn.default=Pu;var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0});const Su=X,Tu={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((i,o)=>{if((0,Su.alwaysValidSchema)(n,i))return;const u=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(u)})}};Zn.default=Tu;var Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});const Cr=B,ao=X,Ru={message:({params:e})=>(0,Cr.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Cr._)`{failingKeyword: ${e.ifClause}}`},ku={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Ru,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,ao.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=zs(n,"then"),i=zs(n,"else");if(!s&&!i)return;const o=t.let("valid",!0),u=t.name("_valid");if(f(),e.reset(),s&&i){const d=t.let("ifClause");e.setParams({ifClause:d}),t.if(u,l("then",d),l("else",d))}else s?t.if(u,l("then")):t.if((0,Cr.not)(u),l("else"));e.pass(o,()=>e.error(!0));function f(){const d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(d)}function l(d,p){return()=>{const b=e.subschema({keyword:d},u);t.assign(o,u),e.mergeValidEvaluated(b,o),p?t.assign(p,(0,Cr._)`${d}`):e.setParams({ifClause:d})}}}};function zs(e,t){const r=e.schema[t];return r!==void 0&&!(0,ao.alwaysValidSchema)(e,r)}Xn.default=ku;var es={};Object.defineProperty(es,"__esModule",{value:!0});const Ou=X,Cu={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Ou.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};es.default=Cu;Object.defineProperty(zn,"__esModule",{value:!0});const Nu=Ct,Iu=Wn,ju=Nt,Au=Hn,Du=xn,Mu=io,Lu=Bn,Fu=zr,qu=Gn,Uu=Kn,Vu=Jn,zu=Qn,Wu=Yn,Hu=Zn,xu=Xn,Bu=es;function Gu(e=!1){const t=[Vu.default,zu.default,Wu.default,Hu.default,xu.default,Bu.default,Lu.default,Fu.default,Mu.default,qu.default,Uu.default];return e?t.push(Iu.default,Au.default):t.push(Nu.default,ju.default),t.push(Du.default),t}zn.default=Gu;var ts={},rs={};Object.defineProperty(rs,"__esModule",{value:!0});const le=B,Ku={message:({schemaCode:e})=>(0,le.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,le._)`{format: ${e}}`},Ju={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Ku,code(e,t){const{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:u}=e,{opts:f,errSchemaPath:l,schemaEnv:d,self:p}=u;if(!f.validateFormats)return;s?b():E();function b(){const P=r.scopeValue("formats",{ref:p.formats,code:f.code.formats}),O=r.const("fDef",(0,le._)`${P}[${o}]`),_=r.let("fType"),g=r.let("format");r.if((0,le._)`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>r.assign(_,(0,le._)`${O}.type || "string"`).assign(g,(0,le._)`${O}.validate`),()=>r.assign(_,(0,le._)`"string"`).assign(g,O)),e.fail$data((0,le.or)($(),S()));function $(){return f.strictSchema===!1?le.nil:(0,le._)`${o} && !${g}`}function S(){const I=d.$async?(0,le._)`(${O}.async ? await ${g}(${n}) : ${g}(${n}))`:(0,le._)`${g}(${n})`,D=(0,le._)`(typeof ${g} == "function" ? ${I} : ${g}.test(${n}))`;return(0,le._)`${g} && ${g} !== true && ${_} === ${t} && !${D}`}}function E(){const P=p.formats[i];if(!P){$();return}if(P===!0)return;const[O,_,g]=S(P);O===t&&e.pass(I());function $(){if(f.strictSchema===!1){p.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${i}" ignored in schema at path "${l}"`}}function S(D){const v=D instanceof RegExp?(0,le.regexpCode)(D):f.code.formats?(0,le._)`${f.code.formats}${(0,le.getProperty)(i)}`:void 0,C=r.scopeValue("formats",{key:i,ref:D,code:v});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,le._)`${C}.validate`]:["string",D,C]}function I(){if(typeof P=="object"&&!(P instanceof RegExp)&&P.async){if(!d.$async)throw new Error("async format in sync schema");return(0,le._)`await ${g}(${n})`}return typeof _=="function"?(0,le._)`${g}(${n})`:(0,le._)`${g}.test(${n})`}}}};rs.default=Ju;Object.defineProperty(ts,"__esModule",{value:!0});const Qu=rs,Yu=[Qu.default];ts.default=Yu;var Ot={};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.contentVocabulary=Ot.metadataVocabulary=void 0;Ot.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ot.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Rn,"__esModule",{value:!0});const Zu=kn,Xu=Cn,ed=zn,td=ts,Ws=Ot,rd=[Zu.default,Xu.default,(0,ed.default)(),td.default,Ws.metadataVocabulary,Ws.contentVocabulary];Rn.default=rd;var ns={},co={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0,function(t){t.Tag="tag",t.Mapping="mapping"}(e.DiscrError||(e.DiscrError={}))})(co);Object.defineProperty(ns,"__esModule",{value:!0});const Pt=B,dn=co,Hs=ve,nd=X,sd={message:({params:{discrError:e,tagName:t}})=>e===dn.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Pt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},id={keyword:"discriminator",type:"object",schemaType:"object",error:sd,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const u=n.propertyName;if(typeof u!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const f=t.let("valid",!1),l=t.const("tag",(0,Pt._)`${r}${(0,Pt.getProperty)(u)}`);t.if((0,Pt._)`typeof ${l} == "string"`,()=>d(),()=>e.error(!1,{discrError:dn.DiscrError.Tag,tag:l,tagName:u})),e.ok(f);function d(){const E=b();t.if(!1);for(const P in E)t.elseIf((0,Pt._)`${l} === ${P}`),t.assign(f,p(E[P]));t.else(),e.error(!1,{discrError:dn.DiscrError.Mapping,tag:l,tagName:u}),t.endIf()}function p(E){const P=t.name("valid"),O=e.subschema({keyword:"oneOf",schemaProp:E},P);return e.mergeEvaluated(O,Pt.Name),P}function b(){var E;const P={},O=g(s);let _=!0;for(let I=0;I<o.length;I++){let D=o[I];D!=null&&D.$ref&&!(0,nd.schemaHasRulesButRef)(D,i.self.RULES)&&(D=Hs.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,D==null?void 0:D.$ref),D instanceof Hs.SchemaEnv&&(D=D.schema));const v=(E=D==null?void 0:D.properties)===null||E===void 0?void 0:E[u];if(typeof v!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${u}"`);_=_&&(O||g(D)),$(v,I)}if(!_)throw new Error(`discriminator: "${u}" must be required`);return P;function g({required:I}){return Array.isArray(I)&&I.includes(u)}function $(I,D){if(I.const)S(I.const,D);else if(I.enum)for(const v of I.enum)S(v,D);else throw new Error(`discriminator: "properties/${u}" must have "const" or "enum"`)}function S(I,D){if(typeof I!="string"||I in P)throw new Error(`discriminator: "${u}" values must be unique strings`);P[I]=D}}}};ns.default=id;const od="http://json-schema.org/draft-07/schema#",ad="http://json-schema.org/draft-07/schema#",cd="Core schema meta-schema",ld={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:[]}},ud=["object","boolean"],dd={$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:"#"}},fd={$schema:od,$id:ad,title:cd,definitions:ld,type:ud,properties:dd,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=ki,n=Rn,s=ns,i=fd,o=["/properties"],u="http://json-schema.org/draft-07/schema";class f extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(P=>this.addVocabulary(P)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const P=this.opts.$data?this.$dataMetaSchema(i,o):i;this.addMetaSchema(P,u,!1),this.refs["http://json-schema.org/schema"]=u}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}}e.exports=t=f,Object.defineProperty(t,"__esModule",{value:!0}),t.default=f;var l=Ne;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var d=B;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 p=tr;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var b=rr;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return b.default}})})(sn,sn.exports);var pd=sn.exports;const hd=ua(pd),md="http://json-schema.org/schema",yd="#/definitions/Blueprint",gd={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.",deprecated:"Use meta.description instead."},meta:{type:"object",properties:{title:{type:"string",description:"A clear and concise name for your Blueprint."},description:{type:"string",description:"A brief explanation of what your Blueprint offers."},author:{type:"string",description:"A GitHub username of the author of this Blueprint."},categories:{type:"array",items:{type:"string"},description:"Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."}},required:["title","author"],additionalProperties:!1,description:"Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"},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"},siteOptions:{type:"object",additionalProperties:{type:"string"},properties:{blogname:{type:"string",description:"The site title"}},description:"WordPress site options to define"},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",enum:["kitchen-sink","light"]},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 in wp-config.php. Possible values are:
|
|
673
638
|
|
|
674
639
|
- 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.
|
|
675
640
|
|
|
676
641
|
- 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.
|
|
677
642
|
This option is only kept in here to avoid breaking Blueprint schema validation
|
|
678
|
-
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:"importWxr"},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},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},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},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},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:"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"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"wp-cli",description:"The step identifier."},command:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The WP CLI command to run."},wpCliPath:{type:"string",description:"wp-cli.phar path"}},required:["command","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."},body:{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"}},{type:"object",additionalProperties:{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"}},{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:"Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."}},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:{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:"Request body."},env:{type:"object",additionalProperties:{type:"string"},description:"Environment variables to set for this run."},$_SERVER:{type:"object",additionalProperties:{type:"string"},description:"$_SERVER entries to set for this run."},code:{type:"string",description:"The code snippet to eval instead of a php file."}},additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},blueprintSchema={$schema,$ref,definitions},{wpCLI,...otherStepHandlers}=allStepHandlers,keyedStepHandlers={...otherStepHandlers,"wp-cli":wpCLI,importFile:otherStepHandlers.importWxr};function compileBlueprint(e,{progress:t=new ProgressTracker,semaphore:r=new Semaphore({concurrency:3}),onStepCompleted:n=()=>{}}={}){var f,b,P,E,C,$,_;e={...e,steps:(e.steps||[]).filter(isStepDefinition).filter(isStepStillSupported)};for(const y of e.steps)typeof y=="object"&&y.step==="importFile"&&(y.step="importWxr",logger.warn('The "importFile" step is deprecated. Use "importWxr" instead.'));if(e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const y=e.plugins.map(S=>typeof S=="string"?S.startsWith("https://")?{resource:"url",url:S}:{resource:"wordpress.org/plugins",slug:S}:S).map(S=>({step:"installPlugin",pluginZipFile:S}));e.steps.unshift(...y)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login}),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles.length===0&&e.phpExtensionBundles.push("kitchen-sink");const s=(f=e.steps)==null?void 0:f.findIndex(y=>typeof y=="object"&&(y==null?void 0:y.step)==="wp-cli");s!==void 0&&s>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter(y=>y!=="light"),logger.warn("The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(b=e.steps)==null||b.splice(s,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const o=(P=e.steps)==null?void 0:P.findIndex(y=>typeof y=="object"&&(y==null?void 0:y.step)==="importWxr");o!==void 0&&o>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter(y=>y!=="light"),logger.warn("The importWxr step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(E=e.steps)==null||E.splice(o,0,{step:"installPlugin",pluginZipFile:{resource:"url",url:"https://playground.wordpress.net/wordpress-importer.zip",caption:"Downloading the WordPress Importer plugin"}}));const{valid:i,errors:c}=validateBlueprint(e);if(!i){const y=new Error(`Invalid blueprint: ${c[0].message} at ${c[0].instancePath}`);throw y.errors=c,y}const u=e.steps||[],l=u.reduce((y,S)=>{var I;return y+(((I=S.progress)==null?void 0:I.weight)||1)},0),p=u.map(y=>compileStep(y,{semaphore:r,rootProgressTracker:t,totalProgressWeight:l}));return{versions:{php:compileVersion((C=e.preferredVersions)==null?void 0:C.php,SupportedPHPVersions,LatestSupportedPHPVersion),wp:(($=e.preferredVersions)==null?void 0:$.wp)||"latest"},phpExtensions:compilePHPExtensions([],e.phpExtensionBundles||[]),features:{networking:((_=e.features)==null?void 0:_.networking)??!1},run:async y=>{try{for(const{resources:S}of p)for(const I of S)I.setPlayground(y),I.isAsync&&I.resolve();for(const[S,{run:I,step:D}]of Object.entries(p))try{const w=await I(y);n(w,D)}catch(w){throw logger.error(w),new Error(`Error when executing the blueprint step #${S} (${JSON.stringify(D)}) ${w instanceof Error?`: ${w.message}`:w}`,{cause:w})}}finally{try{await y.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const ajv=new Ajv({discriminator:!0});let blueprintValidator;function validateBlueprint(e){var s;blueprintValidator=ajv.compile(blueprintSchema);const t=blueprintValidator(e);if(t)return{valid:t};const r=new Set;for(const o of blueprintValidator.errors)o.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(o.instancePath);const n=(s=blueprintValidator.errors)==null?void 0:s.filter(o=>!(o.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(o.instancePath)));return{valid:t,errors:n}}function compileVersion(e,t,r){return e&&t.includes(e)?e:r}function compilePHPExtensions(e,t){const r=SupportedPHPExtensionsList.filter(s=>e.includes(s)),n=t.flatMap(s=>s in SupportedPHPExtensionBundles?SupportedPHPExtensionBundles[s]:[]);return Array.from(new Set([...r,...n]))}function isStepDefinition(e){return!!(typeof e=="object"&&e)}function isStepStillSupported(e){return e.step==="setPhpIniEntry"?(logger.warn('The "setPhpIniEntry" Blueprint is no longer supported and you can remove it from your Blueprint.'),!1):!0}function compileStep(e,{semaphore:t,rootProgressTracker:r,totalProgressWeight:n}){var p;const s=r.stage((((p=e.progress)==null?void 0:p.weight)||1)/n),o={};for(const f of Object.keys(e)){let b=e[f];isFileReference(b)&&(b=Resource.create(b,{semaphore:t})),o[f]=b}const i=async f=>{var b;try{return s.fillSlowly(),await keyedStepHandlers[e.step](f,await resolveArguments(o),{tracker:s,initialCaption:(b=e.progress)==null?void 0:b.caption})}finally{s.finish()}},c=getResources(o),u=getResources(o).filter(f=>f.isAsync),l=1/(u.length+1);for(const f of u)f.progress=s.stage(l);return{run:i,step:e,resources:c}}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(){}/**
|
|
643
|
+
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:"importWxr"},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},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},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},ifAlreadyInstalled:{type:"string",enum:["overwrite","skip","error"],description:"What to do if the asset already exists."},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:"resetData"}},required:["step"]},{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:"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"]},{type:"object",additionalProperties:!1,properties:{progress:{type:"object",properties:{weight:{type:"number"},caption:{type:"string"}},additionalProperties:!1},step:{type:"string",const:"wp-cli",description:"The step identifier."},command:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The WP CLI command to run."},wpCliPath:{type:"string",description:"wp-cli.phar path"}},required:["command","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."},body:{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"}},{type:"object",additionalProperties:{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"}},{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:"Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."}},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:{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:"Request body."},env:{type:"object",additionalProperties:{type:"string"},description:"Environment variables to set for this run."},$_SERVER:{type:"object",additionalProperties:{type:"string"},description:"$_SERVER entries to set for this run."},code:{type:"string",description:"The code snippet to eval instead of a php file."}},additionalProperties:!1},WordPressInstallationOptions:{type:"object",properties:{adminUsername:{type:"string"},adminPassword:{type:"string"}},additionalProperties:!1}},$d={$schema:md,$ref:yd,definitions:gd},{wpCLI:_d,...xs}=ra,wd={...xs,"wp-cli":_d,importFile:xs.importWxr};function lo(e,{progress:t=new Lr,semaphore:r=new Ao({concurrency:3}),onStepCompleted:n=()=>{}}={}){var p,b,E,P,O,_,g;e={...e,steps:(e.steps||[]).filter(Sd).filter(Td)};for(const $ of e.steps)typeof $=="object"&&$.step==="importFile"&&($.step="importWxr",ye.warn('The "importFile" step is deprecated. Use "importWxr" instead.'));if(e.constants&&e.steps.unshift({step:"defineWpConfigConsts",consts:e.constants}),e.siteOptions&&e.steps.unshift({step:"setSiteOptions",options:e.siteOptions}),e.plugins){const $=e.plugins.map(S=>typeof S=="string"?S.startsWith("https://")?{resource:"url",url:S}:{resource:"wordpress.org/plugins",slug:S}:S).map(S=>({step:"installPlugin",pluginZipFile:S}));e.steps.unshift(...$)}e.login&&e.steps.push({step:"login",...e.login===!0?{username:"admin",password:"password"}:e.login}),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles||(e.phpExtensionBundles=[]),e.phpExtensionBundles.length===0&&e.phpExtensionBundles.push("kitchen-sink");const s=(p=e.steps)==null?void 0:p.findIndex($=>typeof $=="object"&&($==null?void 0:$.step)==="wp-cli");s!==void 0&&s>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter($=>$!=="light"),ye.warn("The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(b=e.steps)==null||b.splice(s,0,{step:"writeFile",data:{resource:"url",url:"https://playground.wordpress.net/wp-cli.phar"},path:"/tmp/wp-cli.phar"}));const i=(E=e.steps)==null?void 0:E.findIndex($=>typeof $=="object"&&($==null?void 0:$.step)==="importWxr");i!==void 0&&i>-1&&(e.phpExtensionBundles.includes("light")&&(e.phpExtensionBundles=e.phpExtensionBundles.filter($=>$!=="light"),ye.warn("The importWxr step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. ")),(P=e.steps)==null||P.splice(i,0,{step:"installPlugin",pluginZipFile:{resource:"url",url:"https://playground.wordpress.net/wordpress-importer.zip",caption:"Downloading the WordPress Importer plugin"}}));const{valid:o,errors:u}=bd(e);if(!o){const $=new Error(`Invalid blueprint: ${u[0].message} at ${u[0].instancePath}`);throw $.errors=u,$}const f=e.steps||[],l=f.reduce(($,S)=>{var I;return $+(((I=S.progress)==null?void 0:I.weight)||1)},0),d=f.map($=>Rd($,{semaphore:r,rootProgressTracker:t,totalProgressWeight:l}));return{versions:{php:Ed((O=e.preferredVersions)==null?void 0:O.php,Fr,Pi),wp:((_=e.preferredVersions)==null?void 0:_.wp)||"latest"},phpExtensions:Pd([],e.phpExtensionBundles||[]),features:{networking:((g=e.features)==null?void 0:g.networking)??!1},run:async $=>{try{for(const{resources:S}of d)for(const I of S)I.setPlayground($),I.isAsync&&I.resolve();for(const[S,{run:I,step:D}]of Object.entries(d))try{const v=await I($);n(v,D)}catch(v){throw ye.error(v),new Error(`Error when executing the blueprint step #${S} (${JSON.stringify(D)}) ${v instanceof Error?`: ${v.message}`:v}`,{cause:v})}}finally{try{await $.goTo(e.landingPage||"/")}catch{}t.finish()}}}}const vd=new hd({discriminator:!0});let pr;function bd(e){var s;pr=vd.compile($d);const t=pr(e);if(t)return{valid:t};const r=new Set;for(const i of pr.errors)i.schemaPath.startsWith("#/properties/steps/items/anyOf")||r.add(i.instancePath);const n=(s=pr.errors)==null?void 0:s.filter(i=>!(i.schemaPath.startsWith("#/properties/steps/items/anyOf")&&r.has(i.instancePath)));return{valid:t,errors:n}}function Ed(e,t,r){return e&&t.includes(e)?e:r}function Pd(e,t){const r=Si.filter(s=>e.includes(s)),n=t.flatMap(s=>s in Ss?Ss[s]:[]);return Array.from(new Set([...r,...n]))}function Sd(e){return!!(typeof e=="object"&&e)}function Td(e){return["setPhpIniEntry","request"].includes(e.step)?(ye.warn(`The "${e.step}" Blueprint is no longer supported and you can remove it from your Blueprint.`),!1):!0}function Rd(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 p of Object.keys(e)){let b=e[p];ha(b)&&(b=ft.create(b,{semaphore:t})),i[p]=b}const o=async p=>{var b;try{return s.fillSlowly(),await wd[e.step](p,await kd(i),{tracker:s,initialCaption:(b=e.progress)==null?void 0:b.caption})}finally{s.finish()}},u=Bs(i),f=Bs(i).filter(p=>p.isAsync),l=1/(f.length+1);for(const p of f)p.progress=s.stage(l);return{run:o,step:e,resources:u}}function Bs(e){const t=[];for(const r in e){const n=e[r];n instanceof ft&&t.push(n)}return t}async function kd(e){const t={};for(const r in e){const n=e[r];n instanceof ft?t[r]=await n.resolve():t[r]=n}return t}async function uo(e,t){await e.run(t)}function Od(){}/**
|
|
679
644
|
* @license
|
|
680
645
|
* Copyright 2019 Google LLC
|
|
681
646
|
* SPDX-License-Identifier: Apache-2.0
|
|
682
|
-
*/const proxyMarker=Symbol("Comlink.proxy"),createEndpoint=Symbol("Comlink.endpoint"),releaseProxy=Symbol("Comlink.releaseProxy"),finalizer=Symbol("Comlink.finalizer"),throwMarker=Symbol("Comlink.thrown"),isObject=e=>typeof e=="object"&&e!==null||typeof e=="function",proxyTransferHandler={canHandle:e=>isObject(e)&&e[proxyMarker],serialize(e){const{port1:t,port2:r}=new MessageChannel;return expose(e,t),[r,[r]]},deserialize(e){return e.start(),wrap(e)}},throwTransferHandler={canHandle:e=>isObject(e)&&throwMarker in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},transferHandlers=new Map([["proxy",proxyTransferHandler],["throw",throwTransferHandler]]);function isAllowedOrigin(e,t){for(const r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function expose(e,t=globalThis,r=["*"]){t.addEventListener("message",function n(s){if(!s||!s.data)return;if(!isAllowedOrigin(r,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:o,type:i,path:c}=Object.assign({path:[]},s.data),u=(s.data.argumentList||[]).map(fromWireValue);let l;try{const p=c.slice(0,-1).reduce((b,P)=>b[P],e),f=c.reduce((b,P)=>b[P],e);switch(i){case"GET":l=f;break;case"SET":p[c.slice(-1)[0]]=fromWireValue(s.data.value),l=!0;break;case"APPLY":l=f.apply(p,u);break;case"CONSTRUCT":{const b=new f(...u);l=proxy(b)}break;case"ENDPOINT":{const{port1:b,port2:P}=new MessageChannel;expose(e,P),l=transfer(b,[b])}break;case"RELEASE":l=void 0;break;default:return}}catch(p){l={value:p,[throwMarker]:0}}Promise.resolve(l).catch(p=>({value:p,[throwMarker]:0})).then(p=>{const[f,b]=toWireValue(p);t.postMessage(Object.assign(Object.assign({},f),{id:o}),b),i==="RELEASE"&&(t.removeEventListener("message",n),closeEndPoint(t),finalizer in e&&typeof e[finalizer]=="function"&&e[finalizer]())}).catch(p=>{const[f,b]=toWireValue({value:new TypeError("Unserializable return value"),[throwMarker]:0});t.postMessage(Object.assign(Object.assign({},f),{id:o}),b)})}),t.start&&t.start()}function isMessagePort(e){return e.constructor.name==="MessagePort"}function closeEndPoint(e){isMessagePort(e)&&e.close()}function wrap(e,t){return createProxy(e,[],t)}function throwIfProxyReleased(e){if(e)throw new Error("Proxy has been released and is not useable")}function releaseEndpoint(e){return requestResponseMessage(e,{type:"RELEASE"}).then(()=>{closeEndPoint(e)})}const proxyCounter=new WeakMap,proxyFinalizers="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(proxyCounter.get(e)||0)-1;proxyCounter.set(e,t),t===0&&releaseEndpoint(e)});function registerProxy(e,t){const r=(proxyCounter.get(t)||0)+1;proxyCounter.set(t,r),proxyFinalizers&&proxyFinalizers.register(e,t,e)}function unregisterProxy(e){proxyFinalizers&&proxyFinalizers.unregister(e)}function createProxy(e,t=[],r=function(){}){let n=!1;const s=new Proxy(r,{get(o,i){if(throwIfProxyReleased(n),i===releaseProxy)return()=>{unregisterProxy(s),releaseEndpoint(e),n=!0};if(i==="then"){if(t.length===0)return{then:()=>s};const c=requestResponseMessage(e,{type:"GET",path:t.map(u=>u.toString())}).then(fromWireValue);return c.then.bind(c)}return createProxy(e,[...t,i])},set(o,i,c){throwIfProxyReleased(n);const[u,l]=toWireValue(c);return requestResponseMessage(e,{type:"SET",path:[...t,i].map(p=>p.toString()),value:u},l).then(fromWireValue)},apply(o,i,c){throwIfProxyReleased(n);const u=t[t.length-1];if(u===createEndpoint)return requestResponseMessage(e,{type:"ENDPOINT"}).then(fromWireValue);if(u==="bind")return createProxy(e,t.slice(0,-1));const[l,p]=processArguments(c);return requestResponseMessage(e,{type:"APPLY",path:t.map(f=>f.toString()),argumentList:l},p).then(fromWireValue)},construct(o,i){throwIfProxyReleased(n);const[c,u]=processArguments(i);return requestResponseMessage(e,{type:"CONSTRUCT",path:t.map(l=>l.toString()),argumentList:c},u).then(fromWireValue)}});return registerProxy(s,e),s}function myFlat(e){return Array.prototype.concat.apply([],e)}function processArguments(e){const t=e.map(toWireValue);return[t.map(r=>r[0]),myFlat(t.map(r=>r[1]))]}const transferCache=new WeakMap;function transfer(e,t){return transferCache.set(e,t),e}function proxy(e){return Object.assign(e,{[proxyMarker]:!0})}function windowEndpoint(e,t=globalThis,r="*"){return{postMessage:(n,s)=>e.postMessage(n,r,s),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function toWireValue(e){for(const[t,r]of transferHandlers)if(r.canHandle(e)){const[n,s]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},s]}return[{type:"RAW",value:e},transferCache.get(e)||[]]}function fromWireValue(e){switch(e.type){case"HANDLER":return transferHandlers.get(e.name).deserialize(e.value);case"RAW":return e.value}}function requestResponseMessage(e,t,r){return new Promise(n=>{const s=generateUUID();e.addEventListener("message",function o(i){!i.data||!i.data.id||i.data.id!==s||(e.removeEventListener("message",o),n(i.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),r)})}function generateUUID(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function consumeAPI(e,t=void 0){setupTransferHandlers();const r=e instanceof Worker?e:windowEndpoint(e,t),n=wrap(r),s=proxyClone(n);return new Proxy(s,{get:(o,i)=>i==="isConnected"?async()=>{for(;;)try{await runWithTimeout(n.isConnected(),200);break}catch{}}:n[i]})}async function runWithTimeout(e,t){return new Promise((r,n)=>{setTimeout(n,t),e.then(r)})}let isTransferHandlersSetup=!1;function setupTransferHandlers(){if(isTransferHandlersSetup)return;isTransferHandlersSetup=!0,transferHandlers.set("EVENT",{canHandle:r=>r instanceof CustomEvent,serialize:r=>[{detail:r.detail},[]],deserialize:r=>r}),transferHandlers.set("FUNCTION",{canHandle:r=>typeof r=="function",serialize(r){const{port1:n,port2:s}=new MessageChannel;return expose(r,n),[s,[s]]},deserialize(r){return r.start(),wrap(r)}}),transferHandlers.set("PHPResponse",{canHandle:r=>typeof r=="object"&&r!==null&&"headers"in r&&"bytes"in r&&"errors"in r&&"exitCode"in r&&"httpStatusCode"in r,serialize(r){return[r.toRawData(),[]]},deserialize(r){return PHPResponse.fromRawData(r)}});const e=transferHandlers.get("throw"),t=e==null?void 0:e.serialize;e.serialize=({value:r})=>{const n=t({value:r});return r.response&&(n[0].value.response=r.response),r.source&&(n[0].value.source=r.source),n}}function proxyClone(e){return new Proxy(e,{get(t,r){switch(typeof t[r]){case"function":return(...n)=>t[r](...n);case"object":return t[r]===null?t[r]:proxyClone(t[r]);case"undefined":case"number":case"string":return t[r];default:return proxy(t[r])}}})}async function startPlaygroundWeb({iframe:e,blueprint:t,remoteUrl:r,progressTracker:n=new ProgressTracker,disableProgressBar:s,onBlueprintStepCompleted:o,onClientConnected:i=()=>{},sapiName:c}){if(assertValidRemote(r),allowStorageAccessByUserActivation(e),r=setQueryParams(r,{progressbar:!s}),n.setCaption("Preparing WordPress"),!t){const p=await doStartPlaygroundWeb(e,setQueryParams(r,{"php-extension":"kitchen-sink"}),n);return i(p),p}const u=compileBlueprint(t,{progress:n.stage(.5),onStepCompleted:o}),l=await doStartPlaygroundWeb(e,setQueryParams(r,{php:u.versions.php,wp:u.versions.wp,"sapi-name":c,"php-extension":u.phpExtensions,networking:u.features.networking?"yes":"no"}),n);return collectPhpLogs(logger,l),i(l),await runBlueprintSteps(u,l),n.finish(),l}function allowStorageAccessByUserActivation(e){var t,r;(t=e.sandbox)!=null&&t.length&&!((r=e.sandbox)!=null&&r.contains("allow-storage-access-by-user-activation"))&&e.sandbox.add("allow-storage-access-by-user-activation")}async function doStartPlaygroundWeb(e,t,r){await new Promise(o=>{e.src=t,e.addEventListener("load",o,!1)});const n=consumeAPI(e.contentWindow,e.ownerDocument.defaultView);await n.isConnected(),r.pipe(n);const s=r.stage();return await n.onDownloadProgress(s.loadingListener),await n.isReady(),s.finish(),n}const officialRemoteOrigin="https://playground.wordpress.net";function assertValidRemote(e){const t=new URL(e,officialRemoteOrigin);if((t.origin===officialRemoteOrigin||t.hostname==="localhost")&&t.pathname!=="/remote.html")throw new Error(`Invalid remote URL: ${t}. Expected origin to be ${officialRemoteOrigin}/remote.html.`)}function setQueryParams(e,t){const r=new URL(e,officialRemoteOrigin),n=new URLSearchParams(r.search);for(const[s,o]of Object.entries(t))if(o!=null&&o!==!1)if(Array.isArray(o))for(const i of o)n.append(s,i.toString());else n.set(s,o.toString());return r.search=n.toString(),r.toString()}async function connectPlayground(e,t){if(logger.warn("`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."),t!=null&&t.loadRemote)return startPlaygroundWeb({iframe:e,remoteUrl:t.loadRemote});const r=consumeAPI(e.contentWindow,e.ownerDocument.defaultView);return await r.isConnected(),r}exports.LatestSupportedPHPVersion=LatestSupportedPHPVersion;exports.SupportedPHPVersions=SupportedPHPVersions;exports.SupportedPHPVersionsList=SupportedPHPVersionsList;exports.activatePlugin=activatePlugin;exports.activateTheme=activateTheme;exports.compileBlueprint=compileBlueprint;exports.connectPlayground=connectPlayground;exports.cp=cp;exports.defineSiteUrl=defineSiteUrl;exports.defineWpConfigConsts=defineWpConfigConsts;exports.enableMultisite=enableMultisite;exports.exportWXR=exportWXR;exports.importWordPressFiles=importWordPressFiles;exports.importWxr=importWxr;exports.installPlugin=installPlugin;exports.installTheme=installTheme;exports.login=login;exports.mkdir=mkdir;exports.mv=mv;exports.phpVar=phpVar;exports.phpVars=phpVars;exports.request=request;exports.rm=rm;exports.rmdir=rmdir;exports.runBlueprintSteps=runBlueprintSteps;exports.runPHP=runPHP;exports.runPHPWithOptions=runPHPWithOptions;exports.runSql=runSql;exports.runWpInstallationWizard=runWpInstallationWizard;exports.setPhpIniEntries=setPhpIniEntries;exports.setPluginProxyURL=setPluginProxyURL;exports.setSiteOptions=setSiteOptions;exports.startPlaygroundWeb=startPlaygroundWeb;exports.unzip=unzip;exports.updateUserMeta=updateUserMeta;exports.wpCLI=wpCLI$1;exports.wpContentFilesExcludedFromExport=wpContentFilesExcludedFromExport;exports.writeFile=writeFile;exports.zipWpContent=zipWpContent;
|
|
647
|
+
*/const fo=Symbol("Comlink.proxy"),Cd=Symbol("Comlink.endpoint"),Nd=Symbol("Comlink.releaseProxy"),Xr=Symbol("Comlink.finalizer"),wr=Symbol("Comlink.thrown"),po=e=>typeof e=="object"&&e!==null||typeof e=="function",Id={canHandle:e=>po(e)&&e[fo],serialize(e){const{port1:t,port2:r}=new MessageChannel;return ss(e,t),[r,[r]]},deserialize(e){return e.start(),is(e)}},jd={canHandle:e=>po(e)&&wr in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},Tt=new Map([["proxy",Id],["throw",jd]]);function Ad(e,t){for(const r of e)if(t===r||r==="*"||r instanceof RegExp&&r.test(t))return!0;return!1}function ss(e,t=globalThis,r=["*"]){t.addEventListener("message",function n(s){if(!s||!s.data)return;if(!Ad(r,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:i,type:o,path:u}=Object.assign({path:[]},s.data),f=(s.data.argumentList||[]).map(lt);let l;try{const d=u.slice(0,-1).reduce((b,E)=>b[E],e),p=u.reduce((b,E)=>b[E],e);switch(o){case"GET":l=p;break;case"SET":d[u.slice(-1)[0]]=lt(s.data.value),l=!0;break;case"APPLY":l=p.apply(d,f);break;case"CONSTRUCT":{const b=new p(...f);l=go(b)}break;case"ENDPOINT":{const{port1:b,port2:E}=new MessageChannel;ss(e,E),l=qd(b,[b])}break;case"RELEASE":l=void 0;break;default:return}}catch(d){l={value:d,[wr]:0}}Promise.resolve(l).catch(d=>({value:d,[wr]:0})).then(d=>{const[p,b]=jr(d);t.postMessage(Object.assign(Object.assign({},p),{id:i}),b),o==="RELEASE"&&(t.removeEventListener("message",n),ho(t),Xr in e&&typeof e[Xr]=="function"&&e[Xr]())}).catch(d=>{const[p,b]=jr({value:new TypeError("Unserializable return value"),[wr]:0});t.postMessage(Object.assign(Object.assign({},p),{id:i}),b)})}),t.start&&t.start()}function Dd(e){return e.constructor.name==="MessagePort"}function ho(e){Dd(e)&&e.close()}function is(e,t){return fn(e,[],t)}function hr(e){if(e)throw new Error("Proxy has been released and is not useable")}function mo(e){return St(e,{type:"RELEASE"}).then(()=>{ho(e)})}const Nr=new WeakMap,Ir="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(Nr.get(e)||0)-1;Nr.set(e,t),t===0&&mo(e)});function Md(e,t){const r=(Nr.get(t)||0)+1;Nr.set(t,r),Ir&&Ir.register(e,t,e)}function Ld(e){Ir&&Ir.unregister(e)}function fn(e,t=[],r=function(){}){let n=!1;const s=new Proxy(r,{get(i,o){if(hr(n),o===Nd)return()=>{Ld(s),mo(e),n=!0};if(o==="then"){if(t.length===0)return{then:()=>s};const u=St(e,{type:"GET",path:t.map(f=>f.toString())}).then(lt);return u.then.bind(u)}return fn(e,[...t,o])},set(i,o,u){hr(n);const[f,l]=jr(u);return St(e,{type:"SET",path:[...t,o].map(d=>d.toString()),value:f},l).then(lt)},apply(i,o,u){hr(n);const f=t[t.length-1];if(f===Cd)return St(e,{type:"ENDPOINT"}).then(lt);if(f==="bind")return fn(e,t.slice(0,-1));const[l,d]=Gs(u);return St(e,{type:"APPLY",path:t.map(p=>p.toString()),argumentList:l},d).then(lt)},construct(i,o){hr(n);const[u,f]=Gs(o);return St(e,{type:"CONSTRUCT",path:t.map(l=>l.toString()),argumentList:u},f).then(lt)}});return Md(s,e),s}function Fd(e){return Array.prototype.concat.apply([],e)}function Gs(e){const t=e.map(jr);return[t.map(r=>r[0]),Fd(t.map(r=>r[1]))]}const yo=new WeakMap;function qd(e,t){return yo.set(e,t),e}function go(e){return Object.assign(e,{[fo]:!0})}function Ud(e,t=globalThis,r="*"){return{postMessage:(n,s)=>e.postMessage(n,r,s),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function jr(e){for(const[t,r]of Tt)if(r.canHandle(e)){const[n,s]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},s]}return[{type:"RAW",value:e},yo.get(e)||[]]}function lt(e){switch(e.type){case"HANDLER":return Tt.get(e.name).deserialize(e.value);case"RAW":return e.value}}function St(e,t,r){return new Promise(n=>{const s=Vd();e.addEventListener("message",function i(o){!o.data||!o.data.id||o.data.id!==s||(e.removeEventListener("message",i),n(o.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),r)})}function Vd(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function $o(e,t=void 0){Wd();const r=e instanceof Worker?e:Ud(e,t),n=is(r),s=_o(n);return new Proxy(s,{get:(i,o)=>o==="isConnected"?async()=>{for(;;)try{await zd(n.isConnected(),200);break}catch{}}:n[o]})}async function zd(e,t){return new Promise((r,n)=>{setTimeout(n,t),e.then(r)})}let Ks=!1;function Wd(){if(Ks)return;Ks=!0,Tt.set("EVENT",{canHandle:r=>r instanceof CustomEvent,serialize:r=>[{detail:r.detail},[]],deserialize:r=>r}),Tt.set("FUNCTION",{canHandle:r=>typeof r=="function",serialize(r){const{port1:n,port2:s}=new MessageChannel;return ss(r,n),[s,[s]]},deserialize(r){return r.start(),is(r)}}),Tt.set("PHPResponse",{canHandle:r=>typeof r=="object"&&r!==null&&"headers"in r&&"bytes"in r&&"errors"in r&&"exitCode"in r&&"httpStatusCode"in r,serialize(r){return[r.toRawData(),[]]},deserialize(r){return Sr.fromRawData(r)}});const e=Tt.get("throw"),t=e==null?void 0:e.serialize;e.serialize=({value:r})=>{const n=t({value:r});return r.response&&(n[0].value.response=r.response),r.source&&(n[0].value.source=r.source),n}}function _o(e){return new Proxy(e,{get(t,r){switch(typeof t[r]){case"function":return(...n)=>t[r](...n);case"object":return t[r]===null?t[r]:_o(t[r]);case"undefined":case"number":case"string":return t[r];default:return go(t[r])}}})}async function wo({iframe:e,blueprint:t,remoteUrl:r,progressTracker:n=new Lr,disableProgressBar:s,onBlueprintStepCompleted:i,onClientConnected:o=()=>{},sapiName:u,onBeforeBlueprint:f,siteSlug:l}){if(xd(r),Hd(e),r=en(r,{progressbar:!s}),n.setCaption("Preparing WordPress"),!t){const b=await Js(e,en(r,{"php-extension":"kitchen-sink","site-slug":l}),n);return o(b),b}const d=lo(t,{progress:n.stage(.5),onStepCompleted:i}),p=await Js(e,en(r,{php:d.versions.php,wp:d.versions.wp,"sapi-name":u,"php-extension":d.phpExtensions,networking:d.features.networking?"yes":"no","site-slug":l}),n);return Bo(ye,p),o(p),f&&await f(),await uo(d,p),n.finish(),p}function Hd(e){var t,r;(t=e.sandbox)!=null&&t.length&&!((r=e.sandbox)!=null&&r.contains("allow-storage-access-by-user-activation"))&&e.sandbox.add("allow-storage-access-by-user-activation")}async function Js(e,t,r){await new Promise(i=>{e.src=t,e.addEventListener("load",i,!1)});const n=$o(e.contentWindow,e.ownerDocument.defaultView);await n.isConnected(),r.pipe(n);const s=r.stage();return await n.onDownloadProgress(s.loadingListener),await n.isReady(),s.finish(),n}const vr="https://playground.wordpress.net";function xd(e){const t=new URL(e,vr);if((t.origin===vr||t.hostname==="localhost")&&t.pathname!=="/remote.html")throw new Error(`Invalid remote URL: ${t}. Expected origin to be ${vr}/remote.html.`)}function en(e,t){const r=new URL(e,vr),n=new URLSearchParams(r.search);for(const[s,i]of Object.entries(t))if(i!=null&&i!==!1)if(Array.isArray(i))for(const o of i)n.append(s,o.toString());else n.set(s,i.toString());return r.search=n.toString(),r.toString()}async function Bd(e,t){if(ye.warn("`connectPlayground` is deprecated and will be removed. Use `startPlayground` instead."),t!=null&&t.loadRemote)return wo({iframe:e,remoteUrl:t.loadRemote});const r=$o(e.contentWindow,e.ownerDocument.defaultView);return await r.isConnected(),r}exports.LatestSupportedPHPVersion=Pi;exports.SupportedPHPVersions=Fr;exports.SupportedPHPVersionsList=fa;exports.activatePlugin=Ar;exports.activateTheme=hn;exports.compileBlueprint=lo;exports.connectPlayground=Bd;exports.cp=ci;exports.defineSiteUrl=$n;exports.defineWpConfigConsts=Qt;exports.enableMultisite=ai;exports.exportWXR=hi;exports.importWordPressFiles=pi;exports.importWxr=fi;exports.installPlugin=yi;exports.installTheme=gi;exports.login=Er;exports.mkdir=ui;exports.mv=li;exports.phpVar=pe;exports.phpVars=Zt;exports.request=br;exports.resetData=$i;exports.rm=mn;exports.rmdir=di;exports.runBlueprintSteps=uo;exports.runPHP=ri;exports.runPHPWithOptions=ni;exports.runSql=si;exports.runWpInstallationWizard=_i;exports.setPhpIniEntries=da;exports.setPluginProxyURL=Od;exports.setSiteOptions=yn;exports.startPlaygroundWeb=wo;exports.unzip=Dr;exports.updateUserMeta=ii;exports.wpCLI=vi;exports.wpContentFilesExcludedFromExport=pn;exports.writeFile=gn;exports.zipWpContent=wi;
|