@jxsuite/compiler 7.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +133 -135
- package/dist/compiler.js +43 -43
- package/package.json +15 -8
- package/src/site/bundler-backend.bun.ts +84 -0
- package/src/site/bundler-backend.node.ts +58 -0
- package/src/site/bundler-backend.ts +53 -0
- package/src/site/bundler.ts +49 -110
- package/src/site/client-runtime.ts +6 -11
- package/src/site/format-host.ts +98 -48
- package/src/site/image-cache.ts +38 -12
- package/src/site/schema-command.ts +26 -28
package/dist/cli.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`,"\r"]);
|
|
4
|
-
`],["r","\r"],["t","\t"]])});function Ee(e){return e instanceof Error?e.message:String(e)}function
|
|
5
|
-
`,patched:!0}}function am(e,t){for(let[r,n]of Object.entries(t)){let s=r in e?e[r]:void 0;if(Array.isArray(n)){e[r]=lk(Array.isArray(s)?s:[],n);continue}if(Js(n)){if(Js(s))am(s,n);else if(s===void 0)e[r]=structuredClone(n);continue}if(s===void 0)e[r]=n}}function lk(e,t){let r=[...e];for(let n of t){if(!ok(n)){if(!r.some((a)=>JSON.stringify(a)===JSON.stringify(n)))r.push(structuredClone(n));continue}let s=r.findIndex((o)=>Js(o)&&o.binding===n.binding),i=r[s];if(Js(i))r[s]={...i,...n};else r.push(structuredClone(n))}return r}var lm=()=>{};function fm(e){if(!N(e))return null;let[t,...r]=e.split(";"),n=(t??"").indexOf("/");if(n===-1)return null;let s=(t??"").slice(0,n).trim().toLowerCase(),i=(t??"").slice(n+1).trim().toLowerCase();if(!cm.test(s)||!cm.test(i))return null;let o=i.lastIndexOf("+"),a=o===-1?null:i.slice(o+1),l=o===-1?i:i.slice(0,o);if(a==="")return null;let c=l.indexOf("."),d=c===-1?null:l.slice(0,c),p=d!==null&&ck.has(d)?d:null,h=p===null?l:l.slice(p.length+1);if(h==="")return null;let m={};for(let b of r){let g=b.indexOf("=");if(g===-1)return null;let y=b.slice(0,g).trim().toLowerCase(),v=b.slice(g+1).trim();if(y==="")return null;if(v.startsWith('"')&&v.endsWith('"')&&v.length>=2)v=v.slice(1,-1);m[y]=v}return{parameters:m,subtype:h,suffix:a,tree:p,type:s}}function pm(e){if(!N(e)||e.trim()==="")return"expected a media type string";if(!e.includes("/"))return`"${e}" has no "/" — a media type is type/subtype (RFC 6838 §4.2)`;if(fm(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function mm(e){let t=fm(e);if(t===null)return null;let r=t.tree===null?"":`${t.tree}.`,n=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${r}${t.subtype}${n}`}var cm,ck,um="text/markdown; variant=GFM",dm="application/yaml",hm;var Rc=q(()=>{ve();cm=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,ck=new Set(["vnd","prs","x"]);hm={".markdown":`${um}; charset=utf-8`,".md":`${um}; charset=utf-8`,".yaml":`${dm}; charset=utf-8`,".yml":`${dm}; charset=utf-8`}});function xm(e){if(e===null)throw TypeError("A class descriptor cannot be null");return ee(e)?e:{}}class ua{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,r,n){this.name=e,this.classPath=t,this.classDef=r,this.#t=n;let{format:s}=r;this.extensions=(s?.extensions??[]).map((i)=>i.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=mm(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=r.$studio??null,this.project=r.project??null,this.server=r.server??null,this.connector=r.connector??null,this.capabilities=dk(r)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#r(await this.implementation())}#r(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let r=this.capabilities[e];if(!r)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let n=this.#r(await this.implementation()),s=n?.[r.identifier];if(!vt(s)){let o=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${o}" has no static "${r.identifier}" method`)}return await s.call(n,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class da{#t;constructor(e){this.#t=e;for(let t of e){if(t.mediaType===null)continue;let r=pm(t.mediaType);if(r!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${r}`)}for(let t of ym){let r=new Map;for(let n of e){if(!n.capabilities[t])continue;for(let s of n.extensions){let i=r.get(s);if(i)throw Error(`Format conflict: "${i.name}" and "${n.name}" both claim "${s}" with the "${t}" capability`);r.set(s,n)}}}}get entries(){return this.#t}byExtension(e,t){let r=gm(e);return this.#t.find((n)=>n.extensions.includes(r)&&(!t||n.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#t.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let r of this.#t){if(e&&!r.documentKinds.includes(e))continue;for(let n of r.extensions)t.add(n)}return t.delete(".json"),[...t]}has(e){let t=gm(e);return this.#t.some((r)=>r.extensions.includes(t))}}function dk(e){let t={},r=e.$defs?.methods??{};for(let[n,s]of Object.entries(r)){let{role:i}=s;if(!pk(i))continue;let o={identifier:s.identifier??n,timing:s.timing??uk};if(N(s.discriminator))o.discriminator=s.discriminator;t[i]=o}return t}function pk(e){return e!==void 0&&fk.has(e)}function gm(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var ym,bm,uk,fk;var Ac=q(()=>{ve();Rc();ym=["parse","serialize","rewrite","discover","load"],bm=[...ym,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];uk=["compiler","server"];fk=new Set(bm)});class $m{#t;#e;#r;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let i of s.classes){let o=t.get(i.name);if(o&&o!==s.specifier)throw Error(`Extension conflict: "${o}" and "${s.specifier}" both provide a class named "${i.name}"`);t.set(i.name,s.specifier)}let r=new Map;for(let s of this.#e){if(!s.project)continue;let i=r.get(s.project.key);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both claim the project section "${s.project.key}"`);r.set(s.project.key,s)}let n=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:i}=s.server;if(!i.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${i}" must be under /_jx/`);let o=n.get(i);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both mount "${i}"`);n.set(i,s)}this.#r=new da(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#r}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function vm(e,t,r){let n=[];for(let s of e??[])n.push(await mk(s,t,r));return new $m(n)}async function mk(e,t,r){let n;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(r,e);n=t.resolvePath(`${l}/package.json`,`./${Fi}`)}else try{n=t.resolvePath(r,`${e}/${Fi}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Fi} (is the package installed, and does its exports map include it?): ${Oc(l)}`,{cause:l})}let s;try{s=await t.loadJson(n)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${n}: ${Oc(l)}`,{cause:l})}if(!ee(s)||!N(s.name))throw Error(`Extension "${e}": ${Fi} must declare a "name"`);let i=s;if(!e.startsWith(".")&&i.name!==e)throw Error(`Extension "${e}": manifest name "${i.name}" does not match the specifier`);let o=[];for(let[l,c]of Object.entries(i.classes??{})){let d=t.resolvePath(n,c),p;try{p=await t.loadJson(d)}catch(h){throw Error(`Extension "${e}": cannot read class "${l}" at ${d}: ${Oc(h)}`,{cause:h})}o.push(new ua(l,d,xm(p),t))}let a={};if(i.schemas?.project)a.project=t.resolvePath(n,i.schemas.project);if(i.schemas?.document)a.document=t.resolvePath(n,i.schemas.document);if(i.schemas?.fields)a.fields=t.resolvePath(n,i.schemas.fields);return{specifier:e,manifestPath:n,manifest:i,classes:o,schemas:a}}function Oc(e){return e instanceof Error?e.message:String(e)}var Fi="jx-extension.json";var wm=q(()=>{Ac();ve();Ac()});import{readFileSync as hk}from"node:fs";import{dirname as gk,isAbsolute as yk,resolve as Cc,sep as fa}from"node:path";import{pathToFileURL as bk}from"node:url";import{createRequire as Sm}from"node:module";async function Tc(e){let t=[e],r=`${fa}src${fa}`,n=`${fa}dist${fa}`;if(e.includes(r)){let i=e.replace(r,n);if(t.push(i),i.endsWith(".ts"))t.push(`${i.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let i of t)try{return await import(bk(i).href)}catch(o){s=o}throw s instanceof Error?s:Error(String(s))}function Nc(e){return{importModule:(t)=>Tc(t),loadJson:async(t)=>JSON.parse(hk(t,"utf8")),resolvePath:(t,r)=>{if(r.startsWith("./")||r.startsWith("../"))return Cc(gk(t),r);if(yk(r))return r;let n=Sm(Cc(e,"package.json"));try{return n.resolve(r)}catch{return Sm(import.meta.url).resolve(r)}}}}async function jn(e,t){return vm(t?.extensions,Nc(e),Cc(e,"project.json"))}function pa(e,t){return Error(`No format class registered for "${t}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`)}var sn=q(()=>{wm();ve()});import{existsSync as xk,readFileSync as $k}from"node:fs";import{resolve as Em}from"node:path";function kn(e){let t=Em(e,"project.json");if(!xk(t))throw Error(`project.json not found in ${e}`);let r;try{r=sm($k(t,"utf8"),t)}catch(o){throw Error(`Invalid project.json: ${Ee(o)}`,{cause:o})}let n={...qi,...r,build:{...qi.build,...r.build},defaults:{...qi.defaults,...r.defaults},images:{...qi.images,...r.images},url:r.url??qi.url};if(r.$head)n.$head=r.$head;if(r.$media)n.$media=r.$media;if(r.style)n.style=r.style;if(r.state)n.state=r.state;if(r.redirects)n.redirects=r.redirects;if(r.imports)n.imports=r.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(n.build.adapter==="static")delete n.build.adapter;if(n.build.adapter&&!s.includes(n.build.adapter))throw Error(`Unknown build adapter "${n.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let i=["build","cloudflare"];if(!i.includes(n.images.service))throw Error(`Unknown images.service "${n.images.service}" in project.json. Valid services: ${i.join(", ")}`);return{config:n,configPath:t,projectRoot:Em(e)}}var qi;var Hi=q(()=>{rr();qi={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["webp","avif"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80,png:80,webp:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as Ic,readFileSync as _m,writeFileSync as vk}from"node:fs";import{resolve as Pm}from"node:path";async function jm(e,t={}){let{dryRun:r=!1,connection:n}=t,{config:s}=kn(e),i=await jn(e,s),o=ee(s.connections)?s.connections:{},a=ee(s.data)?s.data:{},l=Object.keys(o).filter((b)=>!n||b===n);if(n&&l.length===0)throw Error(`Unknown connection "${n}" (no such connections entry in project.json)`);if(l.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let c={...process.env,...Sk(e),JX_PROJECT_ROOT:e},d=[],p=[];for(let b of l){let g=o[b],y=ee(g)?{...g,$name:b}:{$name:b},v=String(y.provider??""),j=wk(i.connectors(),v);if(!j)throw Error(`Connection "${b}" names provider "${v}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let S={};for(let[E,O]of Object.entries(a))if(ee(O)&&O.connection===b)S[E]=O;let P=await j.call("deploySchema",S,y,{dryRun:r,env:c});if(d.push({applied:P.applied??!r,connection:b,provider:v,statements:P.statements??[],tables:Object.keys(S),warnings:P.warnings??[]}),j.capabilities.bindings){let E=await j.call("bindings",y);if(ee(E)&&Object.keys(E).length>0)p.push(E)}}let h=Pm(e,"wrangler.jsonc"),m=!1;if(!r&&p.length>0&&Ic(h)){let b=_m(h,"utf8"),{content:g,patched:y}=om(b,p);if(y&&g!==b)vk(h,g,"utf8"),m=!0}return{bindingsPatched:m,results:d,wranglerPath:Ic(h)?h:null}}function wk(e,t){return e.find((r)=>r.connector?.provider===t)}function Sk(e){let t=Pm(e,".dev.vars");if(!Ic(t))return{};let r=new Map;for(let n of _m(t,"utf8").split(`
|
|
6
|
-
`)){let s=n.trim();if(s===""||s.startsWith("#"))continue;let i=s.indexOf("=");if(i===-1)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(o!=="")r.set(o,a)}return Object.fromEntries(r)}var
|
|
2
|
+
import{createRequire as Xj}from"node:module";var Wj=Object.create;var{getPrototypeOf:Uj,defineProperty:Bp,getOwnPropertyNames:zj}=Object;var Wp=Object.prototype.hasOwnProperty;function Gj(e){return this[e]}var Kj,Yj,Lt=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var s=t?Kj??=new WeakMap:Yj??=new WeakMap,i=s.get(e);if(i)return i}r=e!=null?Wj(Uj(e)):{};let o=t||!e||!e.__esModule||!Wp.call(e,"default")?Bp(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of zj(e))if(!Wp.call(o,a))Bp(o,a,{get:Gj.bind(e,a),enumerable:!0})}if(n)s.set(e,o);return o};var C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var q=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var Ne=Xj(import.meta.url);function T(e){return typeof e==="string"}function lr(e){return typeof e==="number"}function $t(e){return typeof e==="boolean"}function vt(e){return typeof e==="function"}function F(e){return typeof e==="object"&&e!==null}function ee(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ce(e){return ee(e)&&typeof e.$ref==="string"}function er(e){return ee(e)&&e.$prototype==="Function"}function tr(e){return ee(e)&&ee(e.$expression)}function ns(e){return tr(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function _n(e){return er(e)&&Array.isArray(e.body)}function Cr(e){return ee(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function tn(e){return ee(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Up(e){return ee(e)&&!e.$prototype&&!e.$expression&&"default"in e}function Pn(e){if(!ee(e))return!1;for(let t of Object.keys(e))if(!zp.has(t))return!1;return!0}function Qe(e){return ee(e)&&e.$prototype==="Array"}function _c(e){return(Array.isArray(e)?e:[e]).some((r)=>Qe(r))}function Gp(e){return ee(e)&&e.$prototype==="Class"}function Ft(e){return ee(e)}function pe(e){return typeof e==="string"&&e.includes("${")}function ss(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(e)}function is(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function rn(e){if(!e)return[];return e.map((t)=>T(t)?t:t.name)}function Zj(e){return typeof e==="string"}function Nr(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!ee(e.$expression))return!1;let t=e.$expression;if(t.operator==="?:")return typeof t.value==="string"&&typeof t.initial==="string";if(t.operator==="switch")return ee(t.cases)&&Object.values(t.cases).every((r)=>T(r))&&typeof t.default==="string";return!1}function Ms(e){if(Zj(e))return[e];if(!Nr(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}var zp;var ve=q(()=>{zp=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"])});function Yp(e){let t=[],r=[],n=null,s=0,i=()=>r.at(-1)?.path??"",o=()=>n===null?i():tk(i(),n),a=()=>{s+=1;let l="";while(s<e.length){let c=e[s];if(c==="\\"){let d=e[s+1]??"";if(d==="u")l+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else l+=Qj.get(d)??d,s+=2;continue}if(c==='"')return s+=1,l;l+=c,s+=1}return l};while(s<e.length){let l=e[s];if(Kp.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){r.push(l==="{"?{keys:new Set,kind:"object",path:o()}:{kind:"array",path:o()}),n=null,s+=1;continue}if(l==="}"||l==="]"){r.pop(),n=null,s+=1;continue}if(l==='"'){let d=a(),p=r.at(-1);if(p?.kind==="object"&&ek(e,s)===":"){if(p.keys.has(d))t.push({detail:d,kind:"duplicate-key",path:p.path});p.keys.add(d),n=d}else n=null;continue}if(l==="-"||l>="0"&&l<="9"){let d=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let p=e.slice(d,s);if(!rk(p))t.push({detail:p,kind:"unsafe-number",path:o()});n=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;n=null}return t}function ek(e,t){let r=t;while(r<e.length&&Kp.has(e[r]))r+=1;return e[r]??""}function tk(e,t){return e===""?t:`${e}.${t}`}function rk(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Xp(e){let t=e.path===""?"the document root":`"${e.path}"`;return e.kind==="duplicate-key"?`duplicate key "${e.detail}" in ${t} — JSON.parse keeps the last one and `+"silently discards the first (RFC 7493 §2.3)":`number ${e.detail} in ${t} cannot be represented exactly and will change when `+"the document is written back (RFC 7493 §2.2)"}var Kp,Qj;var Zp=q(()=>{Kp=new Set([" ","\t",`
|
|
3
|
+
`,"\r"]);Qj=new Map([["b","\b"],["f","\f"],["n",`
|
|
4
|
+
`],["r","\r"],["t","\t"]])});function Ee(e){return e instanceof Error?e.message:String(e)}function em(e){if(T(e))return Qp.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>em(t));if(ee(e))return tm(e);return e}function tm(e){let t={};for(let[r,n]of Object.entries(e))t[Qp.test(r)?r.normalize("NFC"):r]=em(n);return t}function Pc(e,t,r){let n;try{n=JSON.parse(e)}catch(i){throw Error(`Failed to parse ${r} at ${t}: ${Ee(i)}`,{cause:i})}if(!ee(n))throw Error(`Invalid ${r} at ${t}: expected a JSON object`);let s=Yp(e);if(s.length>0){let i=s.map((o)=>Xp(o)).join("; ");throw Error(`Invalid ${r} at ${t}: ${i}`)}return tm(n)}function jn(e,t){return Pc(e,t,"Jx document")}function rm(e,t){return Pc(e,t,"project config")}function nm(e,t){return Pc(e,t,"class definition")}var Qp;var rr=q(()=>{ve();Zp();Qp=/[^\p{ASCII}]/u});function nk(e){return JSON.parse(e)}function Js(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function sk(e){return Js(e)&&typeof e.binding==="string"}function ik(e){try{let t=nk(e);return Js(t)?t:void 0}catch{return}}function sm(e,t){if(t.length===0)return{content:e??"",patched:!1};let r={};if(e){let n=ik(e);if(n===void 0)return{content:e,patched:!1};r=n}for(let n of t)im(r,n);return{content:`${JSON.stringify(r,null,"\t")}
|
|
5
|
+
`,patched:!0}}function im(e,t){for(let[r,n]of Object.entries(t)){let s=r in e?e[r]:void 0;if(Array.isArray(n)){e[r]=ok(Array.isArray(s)?s:[],n);continue}if(Js(n)){if(Js(s))im(s,n);else if(s===void 0)e[r]=structuredClone(n);continue}if(s===void 0)e[r]=n}}function ok(e,t){let r=[...e];for(let n of t){if(!sk(n)){if(!r.some((a)=>JSON.stringify(a)===JSON.stringify(n)))r.push(structuredClone(n));continue}let s=r.findIndex((o)=>Js(o)&&o.binding===n.binding),i=r[s];if(Js(i))r[s]={...i,...n};else r.push(structuredClone(n))}return r}var om=()=>{};function um(e){if(!T(e))return null;let[t,...r]=e.split(";"),n=(t??"").indexOf("/");if(n===-1)return null;let s=(t??"").slice(0,n).trim().toLowerCase(),i=(t??"").slice(n+1).trim().toLowerCase();if(!am.test(s)||!am.test(i))return null;let o=i.lastIndexOf("+"),a=o===-1?null:i.slice(o+1),l=o===-1?i:i.slice(0,o);if(a==="")return null;let c=l.indexOf("."),d=c===-1?null:l.slice(0,c),p=d!==null&&ak.has(d)?d:null,h=p===null?l:l.slice(p.length+1);if(h==="")return null;let m={};for(let b of r){let g=b.indexOf("=");if(g===-1)return null;let y=b.slice(0,g).trim().toLowerCase(),v=b.slice(g+1).trim();if(y==="")return null;if(v.startsWith('"')&&v.endsWith('"')&&v.length>=2)v=v.slice(1,-1);m[y]=v}return{parameters:m,subtype:h,suffix:a,tree:p,type:s}}function dm(e){if(!T(e)||e.trim()==="")return"expected a media type string";if(!e.includes("/"))return`"${e}" has no "/" — a media type is type/subtype (RFC 6838 §4.2)`;if(um(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function fm(e){let t=um(e);if(t===null)return null;let r=t.tree===null?"":`${t.tree}.`,n=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${r}${t.subtype}${n}`}var am,ak,lm="text/markdown; variant=GFM",cm="application/yaml",pm;var jc=q(()=>{ve();am=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,ak=new Set(["vnd","prs","x"]);pm={".markdown":`${lm}; charset=utf-8`,".md":`${lm}; charset=utf-8`,".yaml":`${cm}; charset=utf-8`,".yml":`${cm}; charset=utf-8`}});function ym(e){if(e===null)throw TypeError("A class descriptor cannot be null");return ee(e)?e:{}}class oa{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,r,n){this.name=e,this.classPath=t,this.classDef=r,this.#t=n;let{format:s}=r;this.extensions=(s?.extensions??[]).map((i)=>i.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=fm(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=r.$studio??null,this.project=r.project??null,this.server=r.server??null,this.connector=r.connector??null,this.capabilities=ck(r)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#r(await this.implementation())}#r(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let r=this.capabilities[e];if(!r)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let n=this.#r(await this.implementation()),s=n?.[r.identifier];if(!vt(s)){let o=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${o}" has no static "${r.identifier}" method`)}return await s.call(n,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class aa{#t;constructor(e){this.#t=e;for(let t of e){if(t.mediaType===null)continue;let r=dm(t.mediaType);if(r!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${r}`)}for(let t of hm){let r=new Map;for(let n of e){if(!n.capabilities[t])continue;for(let s of n.extensions){let i=r.get(s);if(i)throw Error(`Format conflict: "${i.name}" and "${n.name}" both claim "${s}" with the "${t}" capability`);r.set(s,n)}}}}get entries(){return this.#t}byExtension(e,t){let r=mm(e);return this.#t.find((n)=>n.extensions.includes(r)&&(!t||n.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#t.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let r of this.#t){if(e&&!r.documentKinds.includes(e))continue;for(let n of r.extensions)t.add(n)}return t.delete(".json"),[...t]}has(e){let t=mm(e);return this.#t.some((r)=>r.extensions.includes(t))}}function ck(e){let t={},r=e.$defs?.methods??{};for(let[n,s]of Object.entries(r)){let{role:i}=s;if(!dk(i))continue;let o={identifier:s.identifier??n,timing:s.timing??lk};if(T(s.discriminator))o.discriminator=s.discriminator;t[i]=o}return t}function dk(e){return e!==void 0&&uk.has(e)}function mm(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var hm,gm,lk,uk;var kc=q(()=>{ve();jc();hm=["parse","serialize","rewrite","discover","load"],gm=[...hm,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];lk=["compiler","server"];uk=new Set(gm)});class bm{#t;#e;#r;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let i of s.classes){let o=t.get(i.name);if(o&&o!==s.specifier)throw Error(`Extension conflict: "${o}" and "${s.specifier}" both provide a class named "${i.name}"`);t.set(i.name,s.specifier)}let r=new Map;for(let s of this.#e){if(!s.project)continue;let i=r.get(s.project.key);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both claim the project section "${s.project.key}"`);r.set(s.project.key,s)}let n=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:i}=s.server;if(!i.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${i}" must be under /_jx/`);let o=n.get(i);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both mount "${i}"`);n.set(i,s)}this.#r=new aa(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#r}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function xm(e,t,r){let n=[];for(let s of e??[])n.push(await fk(s,t,r));return new bm(n)}async function fk(e,t,r){let n;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(r,e);n=t.resolvePath(`${l}/package.json`,`./${Fi}`)}else try{n=t.resolvePath(r,`${e}/${Fi}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Fi} (is the package installed, and does its exports map include it?): ${Rc(l)}`,{cause:l})}let s;try{s=await t.loadJson(n)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${n}: ${Rc(l)}`,{cause:l})}if(!ee(s)||!T(s.name))throw Error(`Extension "${e}": ${Fi} must declare a "name"`);let i=s;if(!e.startsWith(".")&&i.name!==e)throw Error(`Extension "${e}": manifest name "${i.name}" does not match the specifier`);let o=[];for(let[l,c]of Object.entries(i.classes??{})){let d=t.resolvePath(n,c),p;try{p=await t.loadJson(d)}catch(h){throw Error(`Extension "${e}": cannot read class "${l}" at ${d}: ${Rc(h)}`,{cause:h})}o.push(new oa(l,d,ym(p),t))}let a={};if(i.schemas?.project)a.project=t.resolvePath(n,i.schemas.project);if(i.schemas?.document)a.document=t.resolvePath(n,i.schemas.document);if(i.schemas?.fields)a.fields=t.resolvePath(n,i.schemas.fields);return{specifier:e,manifestPath:n,manifest:i,classes:o,schemas:a}}function Rc(e){return e instanceof Error?e.message:String(e)}var Fi="jx-extension.json";var $m=q(()=>{kc();ve();kc()});import{readFileSync as pk}from"node:fs";import{dirname as mk,isAbsolute as hk,resolve as Ac,sep as la}from"node:path";import{pathToFileURL as gk}from"node:url";import{createRequire as yk}from"node:module";async function Oc(e){let t=[e],r=`${la}src${la}`,n=`${la}dist${la}`;if(e.includes(r)){let i=e.replace(r,n);if(t.push(i),i.endsWith(".ts"))t.push(`${i.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let i of t)try{return await import(gk(i).href)}catch(o){s=o}throw s instanceof Error?s:Error(String(s))}function Cc(e,t){return yk(Ac(e,"package.json")).resolve(t)}function Nc(e){return{importModule:(t)=>Oc(t),loadJson:async(t)=>JSON.parse(pk(t,"utf8")),resolvePath:(t,r)=>{if(r.startsWith("./")||r.startsWith("../"))return Ac(mk(t),r);if(hk(r))return r;return Cc(e,r)}}}async function kn(e,t){return xm(t?.extensions,Nc(e),Ac(e,"project.json"))}function ca(e,t){return Error(`No format class registered for "${t}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`)}var nn=q(()=>{$m();ve()});import{existsSync as bk,readFileSync as xk}from"node:fs";import{resolve as vm}from"node:path";function Rn(e){let t=vm(e,"project.json");if(!bk(t))throw Error(`project.json not found in ${e}`);let r;try{r=rm(xk(t,"utf8"),t)}catch(o){throw Error(`Invalid project.json: ${Ee(o)}`,{cause:o})}let n={...qi,...r,build:{...qi.build,...r.build},defaults:{...qi.defaults,...r.defaults},images:{...qi.images,...r.images},url:r.url??qi.url};if(r.$head)n.$head=r.$head;if(r.$media)n.$media=r.$media;if(r.style)n.style=r.style;if(r.state)n.state=r.state;if(r.redirects)n.redirects=r.redirects;if(r.imports)n.imports=r.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(n.build.adapter==="static")delete n.build.adapter;if(n.build.adapter&&!s.includes(n.build.adapter))throw Error(`Unknown build adapter "${n.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let i=["build","cloudflare"];if(!i.includes(n.images.service))throw Error(`Unknown images.service "${n.images.service}" in project.json. Valid services: ${i.join(", ")}`);return{config:n,configPath:t,projectRoot:vm(e)}}var qi;var Hi=q(()=>{rr();qi={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["webp","avif"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80,png:80,webp:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as Tc,readFileSync as wm,writeFileSync as $k}from"node:fs";import{resolve as Sm}from"node:path";async function Em(e,t={}){let{dryRun:r=!1,connection:n}=t,{config:s}=Rn(e),i=await kn(e,s),o=ee(s.connections)?s.connections:{},a=ee(s.data)?s.data:{},l=Object.keys(o).filter((b)=>!n||b===n);if(n&&l.length===0)throw Error(`Unknown connection "${n}" (no such connections entry in project.json)`);if(l.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let c={...process.env,...wk(e),JX_PROJECT_ROOT:e},d=[],p=[];for(let b of l){let g=o[b],y=ee(g)?{...g,$name:b}:{$name:b},v=String(y.provider??""),j=vk(i.connectors(),v);if(!j)throw Error(`Connection "${b}" names provider "${v}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let S={};for(let[E,O]of Object.entries(a))if(ee(O)&&O.connection===b)S[E]=O;let P=await j.call("deploySchema",S,y,{dryRun:r,env:c});if(d.push({applied:P.applied??!r,connection:b,provider:v,statements:P.statements??[],tables:Object.keys(S),warnings:P.warnings??[]}),j.capabilities.bindings){let E=await j.call("bindings",y);if(ee(E)&&Object.keys(E).length>0)p.push(E)}}let h=Sm(e,"wrangler.jsonc"),m=!1;if(!r&&p.length>0&&Tc(h)){let b=wm(h,"utf8"),{content:g,patched:y}=sm(b,p);if(y&&g!==b)$k(h,g,"utf8"),m=!0}return{bindingsPatched:m,results:d,wranglerPath:Tc(h)?h:null}}function vk(e,t){return e.find((r)=>r.connector?.provider===t)}function wk(e){let t=Sm(e,".dev.vars");if(!Tc(t))return{};let r=new Map;for(let n of wm(t,"utf8").split(`
|
|
6
|
+
`)){let s=n.trim();if(s===""||s.startsWith("#"))continue;let i=s.indexOf("=");if(i===-1)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(o!=="")r.set(o,a)}return Object.fromEntries(r)}var _m=q(()=>{om();nn();Hi();ve()});function os(e){return e.startsWith(ua)}function Pm(e){let t=e;if(os(t))t=t.slice(ua.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Ic}${t}.js`}function jm(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",r=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Ic}${r}`:`${Ic}${r}.${t}`}function km(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function da(e){let t=km(e);return t.startsWith("/")?t:`/${t}`}function Sk(e,t){return[...e].toSorted((r,n)=>n[t].length-r[t].length)}function fa(e,t){let r=t.split("#")[0].split("?")[0];if(!r.startsWith("/"))return null;let n;try{n=decodeURIComponent(r)}catch{return null}if(/%2e|%2f/i.test(n))return null;for(let s of Sk(e,"urlPrefix")){let i=da(s.urlPrefix);if(!n.startsWith(`${i}/`))continue;let a=n.slice(i.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${km(s.dir)}/${a.join("/")}`}return null}function Rm(e,t){let r=new Set;for(let n of t){let s=da(n.urlPrefix),i=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${Ek}]+`,"g");for(let o of e.matchAll(i)){let a=o[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))r.add(a)}}return[...r].filter(Boolean)}function Mc(e){let t=[],r=0;while(r<e.length){while(r<e.length&&(/\s/.test(e[r])||e[r]===","))r+=1;if(r>=e.length)break;let n=r;while(r<e.length&&!/\s/.test(e[r]))r+=1;let s=e.slice(n,r);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(r<e.length&&/\s/.test(e[r]))r+=1;let i=r;while(r<e.length&&e[r]!==",")r+=1;let o=e.slice(i,r).trim();if(r+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:o,url:s})}return t}function Jc(e){return e.map(({url:t,descriptor:r})=>r?`${t} ${r}`:t).join(", ")}function as(e){if(!T(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let r=t.replace(/\/+$/,"");if(r===""||r==="/")return"";return r.startsWith("/")?r:`/${r}`}function Ie(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function An(e,t){let r=new URL(t);if(!r.pathname.endsWith("/"))r.pathname+="/";return new URL(e.replace(/^\/+/,""),r).href}var ua="npm:",Ic="/assets/",Ek;var nr=q(()=>{ve();Ek=String.raw`"'\s<>()\\`});function Am(e,t){return e.replaceAll(Rk,(r,n,s)=>{let i=s.trim(),o=Tk.exec(i),a=o?o[2]:i,l=Ie(t,a);if(l===a)return r;return`url(${n}${o?`${o[1]}${l}${o[1]}`:l}${n})`})}function Ik(e,t,r,n,s){let i=r.toLowerCase();if(_k.has(i))return Ie(s,n);if(Pk.has(i)){let o=Mc(n);return o.length===0?n:Jc(o.map((a)=>({descriptor:a.descriptor,url:Ie(s,a.url)})))}if(i==="style")return Am(n,s);if(i==="content"&&e==="meta"&&Nk.test(t))return Ie(s,n);return n}function Om(e,t){if(t==="")return e;let r=e.replaceAll(Ok,(n,s,i,o)=>{let a=i.replaceAll(Ak,(l,c)=>`"${Ie(t,c)}"`);return s+a+o});return r=r.replaceAll(Ck,(n,s,i,o)=>s+Am(i,t)+o),r.replaceAll(jk,(n,s,i)=>{if(i==="")return n;let o=s.toLowerCase(),a=i.replaceAll(kk,(l,c,d,p,h)=>{let m=p===void 0?"'":'"',b=p??h??"",g=Ik(o,i,c,b,t);return g===b?l:`${c}=${m}${g}${m}`});return a===i?n:`<${s}${a}>`})}var _k,Pk,jk,kk,Rk,Ak,Ok,Ck,Nk,Tk;var Cm=q(()=>{nr();_k=new Set(["href","src","poster","action","formaction","data"]),Pk=new Set(["srcset","imagesrcset"]),jk=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,kk=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,Rk=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,Ak=/"(\/[^"/][^"]*)"/g,Ok=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,Ck=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,Nk=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,Tk=/^("|"|'|')([\s\S]*)\1$/});var Ea=C(function(hz,nh){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:Hc,getOwnPropertyDescriptor:Mk,getOwnPropertyNames:Jk}=Object,Dk=Object.prototype.hasOwnProperty,Lk=(e,t)=>{for(var r in t)Hc(e,r,{get:t[r],enumerable:!0})},Fk=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of Jk(t))if(!Dk.call(e,s)&&s!==r)Hc(e,s,{get:()=>t[s],enumerable:!(n=Mk(t,s))||n.enumerable})}return e},qk=(e)=>Fk(Hc({},"__esModule",{value:!0}),e),Ui={};Lk(Ui,{analyzeMetafile:()=>bR,analyzeMetafileSync:()=>wR,build:()=>mR,buildSync:()=>xR,context:()=>hR,default:()=>PR,formatMessages:()=>yR,formatMessagesSync:()=>vR,initialize:()=>ER,stop:()=>SR,transform:()=>gR,transformSync:()=>$R,version:()=>pR});nh.exports=qk(Ui);function Nm(e){let t=(n)=>{if(n===null)r.write8(0);else if(typeof n==="boolean")r.write8(1),r.write8(+n);else if(typeof n==="number")r.write8(2),r.write32(n|0);else if(typeof n==="string")r.write8(3),r.write($r(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let s of n)t(s)}else{let s=Object.keys(n);r.write8(6),r.write32(s.length);for(let i of s)r.write($r(i)),t(n[i])}},r=new Vm;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Lc(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function Hk(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return fs(r.read());case 4:return r.read();case 5:{let o=r.read32(),a=[];for(let l=0;l<o;l++)a.push(t());return a}case 6:{let o=r.read32(),a={};for(let l=0;l<o;l++)a[fs(r.read())]=t();return a}default:throw Error("Invalid packet")}},r=new Vm(e),n=r.read32(),s=(n&1)===0;n>>>=1;let i=t();if(r.ptr!==e.length)throw Error("Invalid packet");return{id:n,isRequest:s,value:i}}var Vm=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);Lc(this.buf,e,t)}write(e){let t=this._write(4+e.length);Lc(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return Bm(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},$r,fs,Dc;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;$r=(r)=>e.encode(r),fs=(r)=>t.decode(r),Dc='new TextEncoder().encode("")'}else if(typeof Buffer<"u")$r=(e)=>Buffer.from(e),fs=(e)=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},Dc='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!($r("")instanceof Uint8Array))throw Error(`Invariant violation: "${Dc} instanceof Uint8Array" is incorrectly false
|
|
7
7
|
|
|
8
8
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
9
9
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
10
10
|
is not a problem with esbuild. You need to fix your environment instead.
|
|
11
|
-
`);function
|
|
12
|
-
`;break;case 114:d+="\r";break;case 116:d+="\t";break;case 117:{let p=0;for(let h=0;h<4;h++)if(c=e[l++],p<<=4,c>=48&&c<=57)p|=c-48;else if(c>=97&&c<=102)p|=c+-87;else if(c>=65&&c<=70)p|=c+-55;else cr(e,--l);d+=on(p);break}default:cr(e,--l);break}else if(c<=127)d+=on(c);else if((c&224)===192)d+=on((c&31)<<6|e[l++]&63);else if((c&240)===224)d+=on((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let p=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(p>65535)p-=65536,d+=on(p>>10&1023|55296),p=56320|p&1023;d+=on(p)}}d[0];break}case 91:{d=[],t.push(i),r.push(a),n.push(o),i=null,a=d,o=1;continue}case 123:{d={},t.push(i),r.push(a),n.push(o),i=null,a=d,o=2;continue}case 93:{if(o!==1)cr(e,--l);d=a,i=t.pop(),a=r.pop(),o=n.pop();break}case 125:{if(o!==2)cr(e,--l);d=a,i=t.pop(),a=r.pop(),o=n.pop();break}default:cr(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(o){case 0:{if(l===s)return d;break}case 1:{if(a.push(d),c===44){l++;continue}if(c===93)continue;break}case 2:{if(i===null){if(i=d,c===58){l++;continue}}else{if(a[i]=d,i=null,c===44){l++;continue}if(c===125)continue}break}}break}cr(e,l)}var it=JSON.stringify,Jm="warning",Dm="silent";function Ls(e,t){let r=[];for(let n of e){if(qt(n,t),n.indexOf(",")>=0)throw Error(`Invalid ${t}: ${n}`);r.push(n)}return r.join(",")}var xa=()=>null,Ge=(e)=>typeof e==="boolean"?null:"a boolean",re=(e)=>typeof e==="string"?null:"a string",$a=(e)=>e instanceof RegExp?null:"a RegExp object",ls=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",Bk=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Gm=(e)=>typeof e==="function"?null:"a function",an=(e)=>Array.isArray(e)?null:"an array",Ht=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",sr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",Uk=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",zk=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Lm=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Km=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",Gk=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Ym=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",Xm=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Kk=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function T(e,t,r,n){let s=e[r];if(t[r+""]=!0,s===void 0)return;let i=n(s);if(i!==null)throw Error(`${it(r)} must be ${i}`);return s}function tt(e,t,r){for(let n in e)if(!(n in t))throw Error(`Invalid option ${r}: ${it(n)}`)}function Yk(e){let t=Object.create(null),r=T(e,t,"wasmURL",Kk),n=T(e,t,"wasmModule",zk),s=T(e,t,"worker",Ge);return tt(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:s}}function Zm(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n==="string"||n===!1)t[r]=n;else throw Error(`Expected ${it(r)} in mangle cache to map to either a string or false`)}}return t}function _a(e,t,r,n,s){let i=T(t,r,"color",Ge),o=T(t,r,"logLevel",re),a=T(t,r,"logLimit",ls),l=T(t,r,"logStyle",re);if(i!==void 0)e.push(`--color=${i}`);else if(n)e.push("--color=true");if(e.push(`--log-level=${o||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function qt(e,t,r){if(typeof e!=="string")throw Error(`Expected value for ${t}${r!==void 0?" "+it(r):""} to be a string, got ${typeof e} instead`);return e}function Qm(e,t,r){let n=T(t,r,"legalComments",re),s=T(t,r,"sourceRoot",re),i=T(t,r,"sourcesContent",Ge),o=T(t,r,"target",Ym),a=T(t,r,"format",re),l=T(t,r,"globalName",re),c=T(t,r,"mangleProps",$a),d=T(t,r,"reserveProps",$a),p=T(t,r,"mangleQuoted",Ge),h=T(t,r,"minify",Ge),m=T(t,r,"minifySyntax",Ge),b=T(t,r,"minifyWhitespace",Ge),g=T(t,r,"minifyIdentifiers",Ge),y=T(t,r,"lineLimit",ls),v=T(t,r,"drop",Ht),j=T(t,r,"dropLabels",Ht),S=T(t,r,"charset",re),P=T(t,r,"treeShaking",Ge),E=T(t,r,"ignoreAnnotations",Ge),O=T(t,r,"jsx",re),R=T(t,r,"jsxFactory",re),k=T(t,r,"jsxFragment",re),I=T(t,r,"jsxImportSource",re),D=T(t,r,"jsxDev",Ge),M=T(t,r,"jsxSideEffects",Ge),L=T(t,r,"define",sr),B=T(t,r,"logOverride",sr),se=T(t,r,"supported",sr),ue=T(t,r,"pure",Ht),oe=T(t,r,"keepNames",Ge),Q=T(t,r,"platform",re),ae=T(t,r,"tsconfigRaw",Gk),ke=T(t,r,"absPaths",Ht);if(n)e.push(`--legal-comments=${n}`);if(s!==void 0)e.push(`--source-root=${s}`);if(i!==void 0)e.push(`--sources-content=${i}`);if(o)e.push(`--target=${Ls(Array.isArray(o)?o:[o],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(Q)e.push(`--platform=${Q}`);if(ae)e.push(`--tsconfig-raw=${typeof ae==="string"?ae:JSON.stringify(ae)}`);if(h)e.push("--minify");if(m)e.push("--minify-syntax");if(b)e.push("--minify-whitespace");if(g)e.push("--minify-identifiers");if(y)e.push(`--line-limit=${y}`);if(S)e.push(`--charset=${S}`);if(P!==void 0)e.push(`--tree-shaking=${P}`);if(E)e.push("--ignore-annotations");if(v)for(let U of v)e.push(`--drop:${qt(U,"drop")}`);if(j)e.push(`--drop-labels=${Ls(j,"drop label")}`);if(ke)e.push(`--abs-paths=${Ls(ke,"abs paths")}`);if(c)e.push(`--mangle-props=${va(c)}`);if(d)e.push(`--reserve-props=${va(d)}`);if(p!==void 0)e.push(`--mangle-quoted=${p}`);if(O)e.push(`--jsx=${O}`);if(R)e.push(`--jsx-factory=${R}`);if(k)e.push(`--jsx-fragment=${k}`);if(I)e.push(`--jsx-import-source=${I}`);if(D)e.push("--jsx-dev");if(M)e.push("--jsx-side-effects");if(L)for(let U in L){if(U.indexOf("=")>=0)throw Error(`Invalid define: ${U}`);e.push(`--define:${U}=${qt(L[U],"define",U)}`)}if(B)for(let U in B){if(U.indexOf("=")>=0)throw Error(`Invalid log override: ${U}`);e.push(`--log-override:${U}=${qt(B[U],"log override",U)}`)}if(se)for(let U in se){if(U.indexOf("=")>=0)throw Error(`Invalid supported: ${U}`);let le=se[U];if(typeof le!=="boolean")throw Error(`Expected value for supported ${it(U)} to be a boolean, got ${typeof le} instead`);e.push(`--supported:${U}=${le}`)}if(ue)for(let U of ue)e.push(`--pure:${qt(U,"pure")}`);if(oe)e.push("--keep-names")}function Xk(e,t,r,n,s){var i;let o=[],a=[],l=Object.create(null),c=null,d=null;_a(o,t,l,r,n),Qm(o,t,l);let p=T(t,l,"sourcemap",Km),h=T(t,l,"bundle",Ge),m=T(t,l,"splitting",Ge),b=T(t,l,"preserveSymlinks",Ge),g=T(t,l,"metafile",Ge),y=T(t,l,"outfile",re),v=T(t,l,"outdir",re),j=T(t,l,"outbase",re),S=T(t,l,"tsconfig",re),P=T(t,l,"resolveExtensions",Ht),E=T(t,l,"nodePaths",Ht),O=T(t,l,"mainFields",Ht),R=T(t,l,"conditions",Ht),k=T(t,l,"external",Ht),I=T(t,l,"packages",re),D=T(t,l,"alias",sr),M=T(t,l,"loader",sr),L=T(t,l,"outExtension",sr),B=T(t,l,"publicPath",re),se=T(t,l,"entryNames",re),ue=T(t,l,"chunkNames",re),oe=T(t,l,"assetNames",re),Q=T(t,l,"inject",Ht),ae=T(t,l,"banner",sr),ke=T(t,l,"footer",sr),U=T(t,l,"entryPoints",Uk),le=T(t,l,"absWorkingDir",re),z=T(t,l,"stdin",sr),te=(i=T(t,l,"write",Ge))!=null?i:s,Le=T(t,l,"allowOverwrite",Ge),fe=T(t,l,"mangleCache",sr);if(l.plugins=!0,tt(t,l,`in ${e}() call`),p)o.push(`--sourcemap${p===!0?"":`=${p}`}`);if(h)o.push("--bundle");if(Le)o.push("--allow-overwrite");if(m)o.push("--splitting");if(b)o.push("--preserve-symlinks");if(g)o.push("--metafile");if(y)o.push(`--outfile=${y}`);if(v)o.push(`--outdir=${v}`);if(j)o.push(`--outbase=${j}`);if(S)o.push(`--tsconfig=${S}`);if(I)o.push(`--packages=${I}`);if(P)o.push(`--resolve-extensions=${Ls(P,"resolve extension")}`);if(B)o.push(`--public-path=${B}`);if(se)o.push(`--entry-names=${se}`);if(ue)o.push(`--chunk-names=${ue}`);if(oe)o.push(`--asset-names=${oe}`);if(O)o.push(`--main-fields=${Ls(O,"main field")}`);if(R)o.push(`--conditions=${Ls(R,"condition")}`);if(k)for(let G of k)o.push(`--external:${qt(G,"external")}`);if(D)for(let G in D){if(G.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${G}`);o.push(`--alias:${G}=${qt(D[G],"alias",G)}`)}if(ae)for(let G in ae){if(G.indexOf("=")>=0)throw Error(`Invalid banner file type: ${G}`);o.push(`--banner:${G}=${qt(ae[G],"banner",G)}`)}if(ke)for(let G in ke){if(G.indexOf("=")>=0)throw Error(`Invalid footer file type: ${G}`);o.push(`--footer:${G}=${qt(ke[G],"footer",G)}`)}if(Q)for(let G of Q)o.push(`--inject:${qt(G,"inject")}`);if(M)for(let G in M){if(G.indexOf("=")>=0)throw Error(`Invalid loader extension: ${G}`);o.push(`--loader:${G}=${qt(M[G],"loader",G)}`)}if(L)for(let G in L){if(G.indexOf("=")>=0)throw Error(`Invalid out extension: ${G}`);o.push(`--out-extension:${G}=${qt(L[G],"out extension",G)}`)}if(U)if(Array.isArray(U))for(let G=0,Be=U.length;G<Be;G++){let Xe=U[G];if(typeof Xe==="object"&&Xe!==null){let pt=Object.create(null),ut=T(Xe,pt,"in",re),Ue=T(Xe,pt,"out",re);if(tt(Xe,pt,"in entry point at index "+G),ut===void 0)throw Error('Missing property "in" for entry point at index '+G);if(Ue===void 0)throw Error('Missing property "out" for entry point at index '+G);a.push([Ue,ut])}else a.push(["",qt(Xe,"entry point at index "+G)])}else for(let G in U)a.push([G,qt(U[G],"entry point",G)]);if(z){let G=Object.create(null),Be=T(z,G,"contents",Xm),Xe=T(z,G,"resolveDir",re),pt=T(z,G,"sourcefile",re),ut=T(z,G,"loader",re);if(tt(z,G,'in "stdin" object'),pt)o.push(`--sourcefile=${pt}`);if(ut)o.push(`--loader=${ut}`);if(Xe)d=Xe;if(typeof Be==="string")c=$r(Be);else if(Be instanceof Uint8Array)c=Be}let We=[];if(E)for(let G of E)G+="",We.push(G);return{entries:a,flags:o,write:te,stdinContents:c,stdinResolveDir:d,absWorkingDir:le,nodePaths:We,mangleCache:Zm(fe)}}function Zk(e,t,r,n){let s=[],i=Object.create(null);_a(s,t,i,r,n),Qm(s,t,i);let o=T(t,i,"sourcemap",Km),a=T(t,i,"sourcefile",re),l=T(t,i,"loader",re),c=T(t,i,"banner",re),d=T(t,i,"footer",re),p=T(t,i,"mangleCache",sr);if(tt(t,i,`in ${e}() call`),o)s.push(`--sourcemap=${o===!0?"external":o}`);if(a)s.push(`--sourcefile=${a}`);if(l)s.push(`--loader=${l}`);if(c)s.push(`--banner=${c}`);if(d)s.push(`--footer=${d}`);return{flags:s,mangleCache:Zm(p)}}function eh(e){let t={},r={didClose:!1,reason:""},n={},s=0,i=0,o=new Uint8Array(16384),a=0,l=(S)=>{let P=a+S.length;if(P>o.length){let O=new Uint8Array(P*2);O.set(o),o=O}o.set(S,a),a+=S.length;let E=0;while(E+4<=a){let O=zm(o,E);if(E+4+O>a)break;E+=4,b(o.subarray(E,E+O)),E+=O}if(E>0)o.copyWithin(0,E,a),a-=E},c=(S)=>{if(r.didClose=!0,S)r.reason=": "+(S.message||S);let P="The service was stopped"+r.reason;for(let E in n)n[E](P,null);n={}},d=(S,P,E)=>{if(r.didClose)return E("The service is no longer running"+r.reason,null);let O=s++;if(n[O]=(R,k)=>{try{E(R,k)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(Mm({id:O,isRequest:!0,value:P}))},p=(S,P)=>{if(r.didClose)throw Error("The service is no longer running"+r.reason);e.writeToStdin(Mm({id:S,isRequest:!1,value:P}))},h=async(S,P)=>{try{if(P.command==="ping"){p(S,{});return}if(typeof P.key==="number"){let E=t[P.key];if(!E)return;let O=E[P.command];if(O){await O(S,P);return}}throw Error("Invalid command: "+P.command)}catch(E){let O=[as(E,e,null,void 0,"")];try{p(S,{errors:O})}catch{}}},m=!0,b=(S)=>{if(m){m=!1;let E=String.fromCharCode(...S);if(E!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${it(E)}`);return}let P=Vk(S);if(P.isRequest)h(P.id,P.value);else{let E=n[P.id];if(delete n[P.id],P.value.error)E(P.value.error,{});else E(null,P.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:P,options:E,isTTY:O,defaultWD:R,callback:k})=>{let I=0,D=i++,M={},L={ref(){if(++I===1){if(P)P.ref()}},unref(){if(--I===0){if(delete t[D],P)P.unref()}}};t[D]=M,L.ref(),Qk(S,D,d,p,L,e,M,E,O,R,(B,se)=>{try{k(B,se)}finally{L.unref()}})},transform:({callName:S,refs:P,input:E,options:O,isTTY:R,fs:k,callback:I})=>{let D=th(),M=(L)=>{try{if(typeof E!=="string"&&!(E instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:B,mangleCache:se}=Zk(S,O,R,Dm),ue={command:"transform",flags:B,inputFS:L!==null,input:L!==null?$r(L):typeof E==="string"?$r(E):E};if(se)ue.mangleCache=se;d(P,ue,(oe,Q)=>{if(oe)return I(Error(oe),null);let ae=Fs(Q.errors,D),ke=Fs(Q.warnings,D),U=1,le=()=>{if(--U===0){let z={warnings:ke,code:Q.code,map:Q.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in Q)z.legalComments=Q==null?void 0:Q.legalComments;if(Q.mangleCache)z.mangleCache=Q==null?void 0:Q.mangleCache;I(null,z)}};if(ae.length>0)return I(Wi("Transform failed",ae,ke),null);if(Q.codeFS)U++,k.readFile(Q.code,(z,te)=>{if(z!==null)I(z,null);else Q.code=te,le()});if(Q.mapFS)U++,k.readFile(Q.map,(z,te)=>{if(z!==null)I(z,null);else Q.map=te,le()});le()})}catch(B){let se=[];try{_a(se,O,{},R,Dm)}catch{}let ue=as(B,e,D,void 0,"");d(P,{command:"error",flags:se,error:ue},()=>{ue.detail=D.load(ue.detail),I(Wi("Transform failed",[ue],[]),null)})}};if((typeof E==="string"||E instanceof Uint8Array)&&E.length>1048576){let L=M;M=()=>k.writeFile(E,L)}M(null)},formatMessages:({callName:S,refs:P,messages:E,options:O,callback:R})=>{if(!O)throw Error(`Missing second argument in ${S}() call`);let k={},I=T(O,k,"kind",re),D=T(O,k,"color",Ge),M=T(O,k,"terminalWidth",ls),L=T(O,k,"logStyle",re);if(tt(O,k,`in ${S}() call`),I===void 0)throw Error(`Missing "kind" in ${S}() call`);if(I!=="error"&&I!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${S}() call`);let B={command:"format-msgs",messages:ln(E,"messages",null,"",M),isWarning:I==="warning"};if(D!==void 0)B.color=D;if(M!==void 0)B.terminalWidth=M;if(L!==void 0)B.logStyle=L;d(P,B,(se,ue)=>{if(se)return R(Error(se),null);R(null,ue.messages)})},analyzeMetafile:({callName:S,refs:P,metafile:E,options:O,callback:R})=>{if(O===void 0)O={};let k={},I=T(O,k,"color",Ge),D=T(O,k,"verbose",Ge);tt(O,k,`in ${S}() call`);let M={command:"analyze-metafile",metafile:E};if(I!==void 0)M.color=I;if(D!==void 0)M.verbose=D;d(P,M,(L,B)=>{if(L)return R(Error(L),null);R(null,B.result)})}}}}function Qk(e,t,r,n,s,i,o,a,l,c,d){let p=th(),h=e==="context",m=(y,v)=>{let j=[];try{_a(j,a,{},l,Jm)}catch{}let S=as(y,i,p,void 0,v);r(s,{command:"error",flags:j,error:S},()=>{S.detail=p.load(S.detail),d(Wi(h?"Context failed":"Build failed",[S],[]),null)})},b;if(typeof a==="object"){let y=a.plugins;if(y!==void 0){if(!Array.isArray(y))return m(Error('"plugins" must be an array'),"");b=y}}if(b&&b.length>0){if(i.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");eR(t,r,n,s,i,o,a,b,p).then((y)=>{if(!y.ok)return m(y.error,y.pluginName);try{g(y.requestPlugins,y.runOnEndCallbacks,y.scheduleOnDisposeCallbacks)}catch(v){m(v,"")}},(y)=>m(y,""));return}try{g(null,(y,v)=>v([],[]),()=>{})}catch(y){m(y,"")}function g(y,v,j){let S=i.hasFS,{entries:P,flags:E,write:O,stdinContents:R,stdinResolveDir:k,absWorkingDir:I,nodePaths:D,mangleCache:M}=Xk(e,a,l,Jm,S);if(O&&!i.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:P,flags:E,write:O,stdinContents:R,stdinResolveDir:k,absWorkingDir:I||c,nodePaths:D,context:h};if(y)L.plugins=y;if(M)L.mangleCache=M;let B=(oe,Q)=>{let ae={errors:Fs(oe.errors,p),warnings:Fs(oe.warnings,p),outputFiles:void 0,metafile:void 0,mangleCache:void 0},ke=ae.errors.slice(),U=ae.warnings.slice();if(oe.outputFiles)ae.outputFiles=oe.outputFiles.map(rR);if(oe.metafile&&oe.metafile.length)ae.metafile=nR(oe.metafile);if(oe.mangleCache)ae.mangleCache=oe.mangleCache;if(oe.writeToStdout!==void 0)console.log(ds(oe.writeToStdout).replace(/\n$/,""));v(ae,(le,z)=>{if(ke.length>0||le.length>0){let te=Wi("Build failed",ke.concat(le),U.concat(z));return Q(te,null,le,z)}Q(null,ae,le,z)})},se,ue;if(h)o["on-end"]=(oe,Q)=>new Promise((ae)=>{B(Q,(ke,U,le,z)=>{let te={errors:le,warnings:z};if(ue)ue(ke,U);se=void 0,ue=void 0,n(oe,te),ae()})});r(s,L,(oe,Q)=>{if(oe)return d(Error(oe),null);if(!h)return B(Q,(U,le)=>(j(),d(U,le)));if(Q.errors.length>0)return d(Wi("Context failed",Q.errors,Q.warnings),null);let ae=!1,ke={rebuild:()=>{if(!se)se=new Promise((U,le)=>{let z;ue=(Le,fe)=>{if(!z)z=()=>Le?le(Le):U(fe)};let te=()=>{r(s,{command:"rebuild",key:t},(fe,We)=>{if(fe)le(Error(fe));else if(z)z();else te()})};te()});return se},watch:(U={})=>new Promise((le,z)=>{if(!i.hasFS)throw Error('Cannot use the "watch" API in this environment');let te={},Le=T(U,te,"delay",ls);tt(U,te,"in watch() call");let fe={command:"watch",key:t};if(Le)fe.delay=Le;r(s,fe,(We)=>{if(We)z(Error(We));else le(void 0)})}),serve:(U={})=>new Promise((le,z)=>{if(!i.hasFS)throw Error('Cannot use the "serve" API in this environment');let te={},Le=T(U,te,"port",Bk),fe=T(U,te,"host",re),We=T(U,te,"servedir",re),G=T(U,te,"keyfile",re),Be=T(U,te,"certfile",re),Xe=T(U,te,"fallback",re),pt=T(U,te,"cors",sr),ut=T(U,te,"onRequest",Gm);tt(U,te,"in serve() call");let Ue={command:"serve",key:t,onRequest:!!ut};if(Le!==void 0)Ue.port=Le;if(fe!==void 0)Ue.host=fe;if(We!==void 0)Ue.servedir=We;if(G!==void 0)Ue.keyfile=G;if(Be!==void 0)Ue.certfile=Be;if(Xe!==void 0)Ue.fallback=Xe;if(pt){let bt={},Jt=T(pt,bt,"origin",Ym);if(tt(pt,bt,'on "cors" object'),Array.isArray(Jt))Ue.corsOrigin=Jt;else if(Jt!==void 0)Ue.corsOrigin=[Jt]}r(s,Ue,(bt,Jt)=>{if(bt)return z(Error(bt));if(ut)o["serve-request"]=(Zr,Sn)=>{ut(Sn.args),n(Zr,{})};le(Jt)})}),cancel:()=>new Promise((U)=>{if(ae)return U();r(s,{command:"cancel",key:t},()=>{U()})}),dispose:()=>new Promise((U)=>{if(ae)return U();ae=!0,r(s,{command:"dispose",key:t},()=>{U(),j(),s.unref()})})};s.ref(),d(null,ke)})}}var eR=async(e,t,r,n,s,i,o,a,l)=>{let c=[],d=[],p={},h={},m=[],b=0,g=0,y=[],v=!1;a=[...a];for(let P of a){let E={};if(typeof P!=="object")throw Error(`Plugin at index ${g} must be an object`);let O=T(P,E,"name",re);if(typeof O!=="string"||O==="")throw Error(`Plugin at index ${g} is missing a name`);try{let R=T(P,E,"setup",Gm);if(typeof R!=="function")throw Error("Plugin is missing a setup function");tt(P,E,`on plugin ${it(O)}`);let k={name:O,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};g++;let D=R({initialOptions:o,resolve:(M,L={})=>{if(!v)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof M!=="string")throw Error("The path to resolve must be a string");let B=Object.create(null),se=T(L,B,"pluginName",re),ue=T(L,B,"importer",re),oe=T(L,B,"namespace",re),Q=T(L,B,"resolveDir",re),ae=T(L,B,"kind",re),ke=T(L,B,"pluginData",xa),U=T(L,B,"with",sr);return tt(L,B,"in resolve() call"),new Promise((le,z)=>{let te={command:"resolve",path:M,key:e,pluginName:O};if(se!=null)te.pluginName=se;if(ue!=null)te.importer=ue;if(oe!=null)te.namespace=oe;if(Q!=null)te.resolveDir=Q;if(ae!=null)te.kind=ae;else throw Error('Must specify "kind" when calling "resolve"');if(ke!=null)te.pluginData=l.store(ke);if(U!=null)te.with=tR(U,"with");t(n,te,(Le,fe)=>{if(Le!==null)z(Error(Le));else le({errors:Fs(fe.errors,l),warnings:Fs(fe.warnings,l),path:fe.path,external:fe.external,sideEffects:fe.sideEffects,namespace:fe.namespace,suffix:fe.suffix,pluginData:l.load(fe.pluginData)})})})},onStart(M){let B=ya(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:O,callback:M,note:B}),k.onStart=!0},onEnd(M){let B=ya(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");d.push({name:O,callback:M,note:B}),k.onEnd=!0},onResolve(M,L){let se=ya(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),ue={},oe=T(M,ue,"filter",$a),Q=T(M,ue,"namespace",re);if(tt(M,ue,`in onResolve() call for plugin ${it(O)}`),oe==null)throw Error("onResolve() call is missing a filter");let ae=b++;p[ae]={name:O,callback:L,note:se},k.onResolve.push({id:ae,filter:va(oe),namespace:Q||""})},onLoad(M,L){let se=ya(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),ue={},oe=T(M,ue,"filter",$a),Q=T(M,ue,"namespace",re);if(tt(M,ue,`in onLoad() call for plugin ${it(O)}`),oe==null)throw Error("onLoad() call is missing a filter");let ae=b++;h[ae]={name:O,callback:L,note:se},k.onLoad.push({id:ae,filter:va(oe),namespace:Q||""})},onDispose(M){m.push(M)},esbuild:s.esbuild});if(D)await D;y.push(k)}catch(R){return{ok:!1,error:R,pluginName:O}}}i["on-start"]=async(P,E)=>{l.clear();let O={errors:[],warnings:[]};await Promise.all(c.map(async({name:R,callback:k,note:I})=>{try{let D=await k();if(D!=null){if(typeof D!=="object")throw Error(`Expected onStart() callback in plugin ${it(R)} to return an object`);let M={},L=T(D,M,"errors",an),B=T(D,M,"warnings",an);if(tt(D,M,`from onStart() callback in plugin ${it(R)}`),L!=null)O.errors.push(...ln(L,"errors",l,R,void 0));if(B!=null)O.warnings.push(...ln(B,"warnings",l,R,void 0))}}catch(D){O.errors.push(as(D,s,l,I&&I(),R))}})),r(P,O)},i["on-resolve"]=async(P,E)=>{let O={},R="",k,I;for(let D of E.ids)try{({name:R,callback:k,note:I}=p[D]);let M=await k({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:l.load(E.pluginData),with:E.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onResolve() callback in plugin ${it(R)} to return an object`);let L={},B=T(M,L,"pluginName",re),se=T(M,L,"path",re),ue=T(M,L,"namespace",re),oe=T(M,L,"suffix",re),Q=T(M,L,"external",Ge),ae=T(M,L,"sideEffects",Ge),ke=T(M,L,"pluginData",xa),U=T(M,L,"errors",an),le=T(M,L,"warnings",an),z=T(M,L,"watchFiles",Ht),te=T(M,L,"watchDirs",Ht);if(tt(M,L,`from onResolve() callback in plugin ${it(R)}`),O.id=D,B!=null)O.pluginName=B;if(se!=null)O.path=se;if(ue!=null)O.namespace=ue;if(oe!=null)O.suffix=oe;if(Q!=null)O.external=Q;if(ae!=null)O.sideEffects=ae;if(ke!=null)O.pluginData=l.store(ke);if(U!=null)O.errors=ln(U,"errors",l,R,void 0);if(le!=null)O.warnings=ln(le,"warnings",l,R,void 0);if(z!=null)O.watchFiles=ba(z,"watchFiles");if(te!=null)O.watchDirs=ba(te,"watchDirs");break}}catch(M){O={id:D,errors:[as(M,s,l,I&&I(),R)]};break}r(P,O)},i["on-load"]=async(P,E)=>{let O={},R="",k,I;for(let D of E.ids)try{({name:R,callback:k,note:I}=h[D]);let M=await k({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:l.load(E.pluginData),with:E.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onLoad() callback in plugin ${it(R)} to return an object`);let L={},B=T(M,L,"pluginName",re),se=T(M,L,"contents",Xm),ue=T(M,L,"resolveDir",re),oe=T(M,L,"pluginData",xa),Q=T(M,L,"loader",re),ae=T(M,L,"errors",an),ke=T(M,L,"warnings",an),U=T(M,L,"watchFiles",Ht),le=T(M,L,"watchDirs",Ht);if(tt(M,L,`from onLoad() callback in plugin ${it(R)}`),O.id=D,B!=null)O.pluginName=B;if(se instanceof Uint8Array)O.contents=se;else if(se!=null)O.contents=$r(se);if(ue!=null)O.resolveDir=ue;if(oe!=null)O.pluginData=l.store(oe);if(Q!=null)O.loader=Q;if(ae!=null)O.errors=ln(ae,"errors",l,R,void 0);if(ke!=null)O.warnings=ln(ke,"warnings",l,R,void 0);if(U!=null)O.watchFiles=ba(U,"watchFiles");if(le!=null)O.watchDirs=ba(le,"watchDirs");break}}catch(M){O={id:D,errors:[as(M,s,l,I&&I(),R)]};break}r(P,O)};let j=(P,E)=>E([],[]);if(d.length>0)j=(P,E)=>{(async()=>{let O=[],R=[];for(let{name:k,callback:I,note:D}of d){let M,L;try{let B=await I(P);if(B!=null){if(typeof B!=="object")throw Error(`Expected onEnd() callback in plugin ${it(k)} to return an object`);let se={},ue=T(B,se,"errors",an),oe=T(B,se,"warnings",an);if(tt(B,se,`from onEnd() callback in plugin ${it(k)}`),ue!=null)M=ln(ue,"errors",l,k,void 0);if(oe!=null)L=ln(oe,"warnings",l,k,void 0)}}catch(B){M=[as(B,s,l,D&&D(),k)]}if(M){O.push(...M);try{P.errors.push(...M)}catch{}}if(L){R.push(...L);try{P.warnings.push(...L)}catch{}}}E(O,R)})()};let S=()=>{for(let P of m)setTimeout(()=>P(),0)};return v=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:j,scheduleOnDisposeCallbacks:S}};function th(){let e=new Map,t=0;return{clear(){e.clear()},load(r){return e.get(r)},store(r){if(r===void 0)return-1;let n=t++;return e.set(n,r),n}}}function ya(e,t,r){let n,s=!1;return()=>{if(s)return n;s=!0;try{let i=(e.stack+"").split(`
|
|
13
|
-
`);i.splice(1,1);let o=
|
|
14
|
-
`),"")}catch{}return{id:"",pluginName:s,text:i,location:o,notes:n?[n]:[],detail:r?r.store(e):-1}}function
|
|
11
|
+
`);function Bm(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Lc(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var sn=String.fromCharCode;function cr(e,t,r){let n=e[t],s=1,i=0;for(let o=0;o<t;o++)if(e[o]===10)s++,i=0;else i++;throw SyntaxError(r?r:t===e.length?"Unexpected end of input while parsing JSON":n>=32&&n<=126?`Unexpected character ${sn(n)} in JSON at position ${t} (line ${s}, column ${i})`:`Unexpected byte 0x${n.toString(16)} in JSON at position ${t} (line ${s}, column ${i})`)}function Vk(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],r=[],n=[],s=e.length,i=null,o=0,a,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let d;if(o===2&&i===null&&c!==34&&c!==125)cr(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)cr(e,--l);d=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)cr(e,--l);d=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)cr(e,--l);d=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let p=l;d=sn(c),c=e[l];while(!0){switch(c){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{d+=sn(c),c=e[++l];continue}}break}if(d=+d,isNaN(d))cr(e,--p,"Invalid number");break}case 34:{d="";while(!0){if(l>=s)cr(e,s);if(c=e[l++],c===34)break;else if(c===92)switch(e[l++]){case 34:d+='"';break;case 47:d+="/";break;case 92:d+="\\";break;case 98:d+="\b";break;case 102:d+="\f";break;case 110:d+=`
|
|
12
|
+
`;break;case 114:d+="\r";break;case 116:d+="\t";break;case 117:{let p=0;for(let h=0;h<4;h++)if(c=e[l++],p<<=4,c>=48&&c<=57)p|=c-48;else if(c>=97&&c<=102)p|=c+-87;else if(c>=65&&c<=70)p|=c+-55;else cr(e,--l);d+=sn(p);break}default:cr(e,--l);break}else if(c<=127)d+=sn(c);else if((c&224)===192)d+=sn((c&31)<<6|e[l++]&63);else if((c&240)===224)d+=sn((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let p=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(p>65535)p-=65536,d+=sn(p>>10&1023|55296),p=56320|p&1023;d+=sn(p)}}d[0];break}case 91:{d=[],t.push(i),r.push(a),n.push(o),i=null,a=d,o=1;continue}case 123:{d={},t.push(i),r.push(a),n.push(o),i=null,a=d,o=2;continue}case 93:{if(o!==1)cr(e,--l);d=a,i=t.pop(),a=r.pop(),o=n.pop();break}case 125:{if(o!==2)cr(e,--l);d=a,i=t.pop(),a=r.pop(),o=n.pop();break}default:cr(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(o){case 0:{if(l===s)return d;break}case 1:{if(a.push(d),c===44){l++;continue}if(c===93)continue;break}case 2:{if(i===null){if(i=d,c===58){l++;continue}}else{if(a[i]=d,i=null,c===44){l++;continue}if(c===125)continue}break}}break}cr(e,l)}var it=JSON.stringify,Tm="warning",Im="silent";function Ls(e,t){let r=[];for(let n of e){if(qt(n,t),n.indexOf(",")>=0)throw Error(`Invalid ${t}: ${n}`);r.push(n)}return r.join(",")}var ha=()=>null,Ge=(e)=>typeof e==="boolean"?null:"a boolean",re=(e)=>typeof e==="string"?null:"a string",ga=(e)=>e instanceof RegExp?null:"a RegExp object",cs=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",Bk=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Wm=(e)=>typeof e==="function"?null:"a function",on=(e)=>Array.isArray(e)?null:"an array",Ht=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",sr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",Wk=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",Uk=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Mm=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Um=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",zk=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",zm=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",Gm=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Gk=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function N(e,t,r,n){let s=e[r];if(t[r+""]=!0,s===void 0)return;let i=n(s);if(i!==null)throw Error(`${it(r)} must be ${i}`);return s}function tt(e,t,r){for(let n in e)if(!(n in t))throw Error(`Invalid option ${r}: ${it(n)}`)}function Kk(e){let t=Object.create(null),r=N(e,t,"wasmURL",Gk),n=N(e,t,"wasmModule",Uk),s=N(e,t,"worker",Ge);return tt(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:s}}function Km(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n==="string"||n===!1)t[r]=n;else throw Error(`Expected ${it(r)} in mangle cache to map to either a string or false`)}}return t}function va(e,t,r,n,s){let i=N(t,r,"color",Ge),o=N(t,r,"logLevel",re),a=N(t,r,"logLimit",cs),l=N(t,r,"logStyle",re);if(i!==void 0)e.push(`--color=${i}`);else if(n)e.push("--color=true");if(e.push(`--log-level=${o||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function qt(e,t,r){if(typeof e!=="string")throw Error(`Expected value for ${t}${r!==void 0?" "+it(r):""} to be a string, got ${typeof e} instead`);return e}function Ym(e,t,r){let n=N(t,r,"legalComments",re),s=N(t,r,"sourceRoot",re),i=N(t,r,"sourcesContent",Ge),o=N(t,r,"target",zm),a=N(t,r,"format",re),l=N(t,r,"globalName",re),c=N(t,r,"mangleProps",ga),d=N(t,r,"reserveProps",ga),p=N(t,r,"mangleQuoted",Ge),h=N(t,r,"minify",Ge),m=N(t,r,"minifySyntax",Ge),b=N(t,r,"minifyWhitespace",Ge),g=N(t,r,"minifyIdentifiers",Ge),y=N(t,r,"lineLimit",cs),v=N(t,r,"drop",Ht),j=N(t,r,"dropLabels",Ht),S=N(t,r,"charset",re),P=N(t,r,"treeShaking",Ge),E=N(t,r,"ignoreAnnotations",Ge),O=N(t,r,"jsx",re),R=N(t,r,"jsxFactory",re),k=N(t,r,"jsxFragment",re),I=N(t,r,"jsxImportSource",re),D=N(t,r,"jsxDev",Ge),M=N(t,r,"jsxSideEffects",Ge),L=N(t,r,"define",sr),W=N(t,r,"logOverride",sr),se=N(t,r,"supported",sr),ue=N(t,r,"pure",Ht),oe=N(t,r,"keepNames",Ge),Q=N(t,r,"platform",re),ae=N(t,r,"tsconfigRaw",zk),ke=N(t,r,"absPaths",Ht);if(n)e.push(`--legal-comments=${n}`);if(s!==void 0)e.push(`--source-root=${s}`);if(i!==void 0)e.push(`--sources-content=${i}`);if(o)e.push(`--target=${Ls(Array.isArray(o)?o:[o],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(Q)e.push(`--platform=${Q}`);if(ae)e.push(`--tsconfig-raw=${typeof ae==="string"?ae:JSON.stringify(ae)}`);if(h)e.push("--minify");if(m)e.push("--minify-syntax");if(b)e.push("--minify-whitespace");if(g)e.push("--minify-identifiers");if(y)e.push(`--line-limit=${y}`);if(S)e.push(`--charset=${S}`);if(P!==void 0)e.push(`--tree-shaking=${P}`);if(E)e.push("--ignore-annotations");if(v)for(let U of v)e.push(`--drop:${qt(U,"drop")}`);if(j)e.push(`--drop-labels=${Ls(j,"drop label")}`);if(ke)e.push(`--abs-paths=${Ls(ke,"abs paths")}`);if(c)e.push(`--mangle-props=${ya(c)}`);if(d)e.push(`--reserve-props=${ya(d)}`);if(p!==void 0)e.push(`--mangle-quoted=${p}`);if(O)e.push(`--jsx=${O}`);if(R)e.push(`--jsx-factory=${R}`);if(k)e.push(`--jsx-fragment=${k}`);if(I)e.push(`--jsx-import-source=${I}`);if(D)e.push("--jsx-dev");if(M)e.push("--jsx-side-effects");if(L)for(let U in L){if(U.indexOf("=")>=0)throw Error(`Invalid define: ${U}`);e.push(`--define:${U}=${qt(L[U],"define",U)}`)}if(W)for(let U in W){if(U.indexOf("=")>=0)throw Error(`Invalid log override: ${U}`);e.push(`--log-override:${U}=${qt(W[U],"log override",U)}`)}if(se)for(let U in se){if(U.indexOf("=")>=0)throw Error(`Invalid supported: ${U}`);let le=se[U];if(typeof le!=="boolean")throw Error(`Expected value for supported ${it(U)} to be a boolean, got ${typeof le} instead`);e.push(`--supported:${U}=${le}`)}if(ue)for(let U of ue)e.push(`--pure:${qt(U,"pure")}`);if(oe)e.push("--keep-names")}function Yk(e,t,r,n,s){var i;let o=[],a=[],l=Object.create(null),c=null,d=null;va(o,t,l,r,n),Ym(o,t,l);let p=N(t,l,"sourcemap",Um),h=N(t,l,"bundle",Ge),m=N(t,l,"splitting",Ge),b=N(t,l,"preserveSymlinks",Ge),g=N(t,l,"metafile",Ge),y=N(t,l,"outfile",re),v=N(t,l,"outdir",re),j=N(t,l,"outbase",re),S=N(t,l,"tsconfig",re),P=N(t,l,"resolveExtensions",Ht),E=N(t,l,"nodePaths",Ht),O=N(t,l,"mainFields",Ht),R=N(t,l,"conditions",Ht),k=N(t,l,"external",Ht),I=N(t,l,"packages",re),D=N(t,l,"alias",sr),M=N(t,l,"loader",sr),L=N(t,l,"outExtension",sr),W=N(t,l,"publicPath",re),se=N(t,l,"entryNames",re),ue=N(t,l,"chunkNames",re),oe=N(t,l,"assetNames",re),Q=N(t,l,"inject",Ht),ae=N(t,l,"banner",sr),ke=N(t,l,"footer",sr),U=N(t,l,"entryPoints",Wk),le=N(t,l,"absWorkingDir",re),z=N(t,l,"stdin",sr),te=(i=N(t,l,"write",Ge))!=null?i:s,Le=N(t,l,"allowOverwrite",Ge),fe=N(t,l,"mangleCache",sr);if(l.plugins=!0,tt(t,l,`in ${e}() call`),p)o.push(`--sourcemap${p===!0?"":`=${p}`}`);if(h)o.push("--bundle");if(Le)o.push("--allow-overwrite");if(m)o.push("--splitting");if(b)o.push("--preserve-symlinks");if(g)o.push("--metafile");if(y)o.push(`--outfile=${y}`);if(v)o.push(`--outdir=${v}`);if(j)o.push(`--outbase=${j}`);if(S)o.push(`--tsconfig=${S}`);if(I)o.push(`--packages=${I}`);if(P)o.push(`--resolve-extensions=${Ls(P,"resolve extension")}`);if(W)o.push(`--public-path=${W}`);if(se)o.push(`--entry-names=${se}`);if(ue)o.push(`--chunk-names=${ue}`);if(oe)o.push(`--asset-names=${oe}`);if(O)o.push(`--main-fields=${Ls(O,"main field")}`);if(R)o.push(`--conditions=${Ls(R,"condition")}`);if(k)for(let G of k)o.push(`--external:${qt(G,"external")}`);if(D)for(let G in D){if(G.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${G}`);o.push(`--alias:${G}=${qt(D[G],"alias",G)}`)}if(ae)for(let G in ae){if(G.indexOf("=")>=0)throw Error(`Invalid banner file type: ${G}`);o.push(`--banner:${G}=${qt(ae[G],"banner",G)}`)}if(ke)for(let G in ke){if(G.indexOf("=")>=0)throw Error(`Invalid footer file type: ${G}`);o.push(`--footer:${G}=${qt(ke[G],"footer",G)}`)}if(Q)for(let G of Q)o.push(`--inject:${qt(G,"inject")}`);if(M)for(let G in M){if(G.indexOf("=")>=0)throw Error(`Invalid loader extension: ${G}`);o.push(`--loader:${G}=${qt(M[G],"loader",G)}`)}if(L)for(let G in L){if(G.indexOf("=")>=0)throw Error(`Invalid out extension: ${G}`);o.push(`--out-extension:${G}=${qt(L[G],"out extension",G)}`)}if(U)if(Array.isArray(U))for(let G=0,We=U.length;G<We;G++){let Xe=U[G];if(typeof Xe==="object"&&Xe!==null){let pt=Object.create(null),ut=N(Xe,pt,"in",re),Ue=N(Xe,pt,"out",re);if(tt(Xe,pt,"in entry point at index "+G),ut===void 0)throw Error('Missing property "in" for entry point at index '+G);if(Ue===void 0)throw Error('Missing property "out" for entry point at index '+G);a.push([Ue,ut])}else a.push(["",qt(Xe,"entry point at index "+G)])}else for(let G in U)a.push([G,qt(U[G],"entry point",G)]);if(z){let G=Object.create(null),We=N(z,G,"contents",Gm),Xe=N(z,G,"resolveDir",re),pt=N(z,G,"sourcefile",re),ut=N(z,G,"loader",re);if(tt(z,G,'in "stdin" object'),pt)o.push(`--sourcefile=${pt}`);if(ut)o.push(`--loader=${ut}`);if(Xe)d=Xe;if(typeof We==="string")c=$r(We);else if(We instanceof Uint8Array)c=We}let Be=[];if(E)for(let G of E)G+="",Be.push(G);return{entries:a,flags:o,write:te,stdinContents:c,stdinResolveDir:d,absWorkingDir:le,nodePaths:Be,mangleCache:Km(fe)}}function Xk(e,t,r,n){let s=[],i=Object.create(null);va(s,t,i,r,n),Ym(s,t,i);let o=N(t,i,"sourcemap",Um),a=N(t,i,"sourcefile",re),l=N(t,i,"loader",re),c=N(t,i,"banner",re),d=N(t,i,"footer",re),p=N(t,i,"mangleCache",sr);if(tt(t,i,`in ${e}() call`),o)s.push(`--sourcemap=${o===!0?"external":o}`);if(a)s.push(`--sourcefile=${a}`);if(l)s.push(`--loader=${l}`);if(c)s.push(`--banner=${c}`);if(d)s.push(`--footer=${d}`);return{flags:s,mangleCache:Km(p)}}function Xm(e){let t={},r={didClose:!1,reason:""},n={},s=0,i=0,o=new Uint8Array(16384),a=0,l=(S)=>{let P=a+S.length;if(P>o.length){let O=new Uint8Array(P*2);O.set(o),o=O}o.set(S,a),a+=S.length;let E=0;while(E+4<=a){let O=Bm(o,E);if(E+4+O>a)break;E+=4,b(o.subarray(E,E+O)),E+=O}if(E>0)o.copyWithin(0,E,a),a-=E},c=(S)=>{if(r.didClose=!0,S)r.reason=": "+(S.message||S);let P="The service was stopped"+r.reason;for(let E in n)n[E](P,null);n={}},d=(S,P,E)=>{if(r.didClose)return E("The service is no longer running"+r.reason,null);let O=s++;if(n[O]=(R,k)=>{try{E(R,k)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(Nm({id:O,isRequest:!0,value:P}))},p=(S,P)=>{if(r.didClose)throw Error("The service is no longer running"+r.reason);e.writeToStdin(Nm({id:S,isRequest:!1,value:P}))},h=async(S,P)=>{try{if(P.command==="ping"){p(S,{});return}if(typeof P.key==="number"){let E=t[P.key];if(!E)return;let O=E[P.command];if(O){await O(S,P);return}}throw Error("Invalid command: "+P.command)}catch(E){let O=[ls(E,e,null,void 0,"")];try{p(S,{errors:O})}catch{}}},m=!0,b=(S)=>{if(m){m=!1;let E=String.fromCharCode(...S);if(E!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${it(E)}`);return}let P=Hk(S);if(P.isRequest)h(P.id,P.value);else{let E=n[P.id];if(delete n[P.id],P.value.error)E(P.value.error,{});else E(null,P.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:P,options:E,isTTY:O,defaultWD:R,callback:k})=>{let I=0,D=i++,M={},L={ref(){if(++I===1){if(P)P.ref()}},unref(){if(--I===0){if(delete t[D],P)P.unref()}}};t[D]=M,L.ref(),Zk(S,D,d,p,L,e,M,E,O,R,(W,se)=>{try{k(W,se)}finally{L.unref()}})},transform:({callName:S,refs:P,input:E,options:O,isTTY:R,fs:k,callback:I})=>{let D=Zm(),M=(L)=>{try{if(typeof E!=="string"&&!(E instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:W,mangleCache:se}=Xk(S,O,R,Im),ue={command:"transform",flags:W,inputFS:L!==null,input:L!==null?$r(L):typeof E==="string"?$r(E):E};if(se)ue.mangleCache=se;d(P,ue,(oe,Q)=>{if(oe)return I(Error(oe),null);let ae=Fs(Q.errors,D),ke=Fs(Q.warnings,D),U=1,le=()=>{if(--U===0){let z={warnings:ke,code:Q.code,map:Q.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in Q)z.legalComments=Q==null?void 0:Q.legalComments;if(Q.mangleCache)z.mangleCache=Q==null?void 0:Q.mangleCache;I(null,z)}};if(ae.length>0)return I(Bi("Transform failed",ae,ke),null);if(Q.codeFS)U++,k.readFile(Q.code,(z,te)=>{if(z!==null)I(z,null);else Q.code=te,le()});if(Q.mapFS)U++,k.readFile(Q.map,(z,te)=>{if(z!==null)I(z,null);else Q.map=te,le()});le()})}catch(W){let se=[];try{va(se,O,{},R,Im)}catch{}let ue=ls(W,e,D,void 0,"");d(P,{command:"error",flags:se,error:ue},()=>{ue.detail=D.load(ue.detail),I(Bi("Transform failed",[ue],[]),null)})}};if((typeof E==="string"||E instanceof Uint8Array)&&E.length>1048576){let L=M;M=()=>k.writeFile(E,L)}M(null)},formatMessages:({callName:S,refs:P,messages:E,options:O,callback:R})=>{if(!O)throw Error(`Missing second argument in ${S}() call`);let k={},I=N(O,k,"kind",re),D=N(O,k,"color",Ge),M=N(O,k,"terminalWidth",cs),L=N(O,k,"logStyle",re);if(tt(O,k,`in ${S}() call`),I===void 0)throw Error(`Missing "kind" in ${S}() call`);if(I!=="error"&&I!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${S}() call`);let W={command:"format-msgs",messages:an(E,"messages",null,"",M),isWarning:I==="warning"};if(D!==void 0)W.color=D;if(M!==void 0)W.terminalWidth=M;if(L!==void 0)W.logStyle=L;d(P,W,(se,ue)=>{if(se)return R(Error(se),null);R(null,ue.messages)})},analyzeMetafile:({callName:S,refs:P,metafile:E,options:O,callback:R})=>{if(O===void 0)O={};let k={},I=N(O,k,"color",Ge),D=N(O,k,"verbose",Ge);tt(O,k,`in ${S}() call`);let M={command:"analyze-metafile",metafile:E};if(I!==void 0)M.color=I;if(D!==void 0)M.verbose=D;d(P,M,(L,W)=>{if(L)return R(Error(L),null);R(null,W.result)})}}}}function Zk(e,t,r,n,s,i,o,a,l,c,d){let p=Zm(),h=e==="context",m=(y,v)=>{let j=[];try{va(j,a,{},l,Tm)}catch{}let S=ls(y,i,p,void 0,v);r(s,{command:"error",flags:j,error:S},()=>{S.detail=p.load(S.detail),d(Bi(h?"Context failed":"Build failed",[S],[]),null)})},b;if(typeof a==="object"){let y=a.plugins;if(y!==void 0){if(!Array.isArray(y))return m(Error('"plugins" must be an array'),"");b=y}}if(b&&b.length>0){if(i.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");Qk(t,r,n,s,i,o,a,b,p).then((y)=>{if(!y.ok)return m(y.error,y.pluginName);try{g(y.requestPlugins,y.runOnEndCallbacks,y.scheduleOnDisposeCallbacks)}catch(v){m(v,"")}},(y)=>m(y,""));return}try{g(null,(y,v)=>v([],[]),()=>{})}catch(y){m(y,"")}function g(y,v,j){let S=i.hasFS,{entries:P,flags:E,write:O,stdinContents:R,stdinResolveDir:k,absWorkingDir:I,nodePaths:D,mangleCache:M}=Yk(e,a,l,Tm,S);if(O&&!i.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:P,flags:E,write:O,stdinContents:R,stdinResolveDir:k,absWorkingDir:I||c,nodePaths:D,context:h};if(y)L.plugins=y;if(M)L.mangleCache=M;let W=(oe,Q)=>{let ae={errors:Fs(oe.errors,p),warnings:Fs(oe.warnings,p),outputFiles:void 0,metafile:void 0,mangleCache:void 0},ke=ae.errors.slice(),U=ae.warnings.slice();if(oe.outputFiles)ae.outputFiles=oe.outputFiles.map(tR);if(oe.metafile&&oe.metafile.length)ae.metafile=rR(oe.metafile);if(oe.mangleCache)ae.mangleCache=oe.mangleCache;if(oe.writeToStdout!==void 0)console.log(fs(oe.writeToStdout).replace(/\n$/,""));v(ae,(le,z)=>{if(ke.length>0||le.length>0){let te=Bi("Build failed",ke.concat(le),U.concat(z));return Q(te,null,le,z)}Q(null,ae,le,z)})},se,ue;if(h)o["on-end"]=(oe,Q)=>new Promise((ae)=>{W(Q,(ke,U,le,z)=>{let te={errors:le,warnings:z};if(ue)ue(ke,U);se=void 0,ue=void 0,n(oe,te),ae()})});r(s,L,(oe,Q)=>{if(oe)return d(Error(oe),null);if(!h)return W(Q,(U,le)=>(j(),d(U,le)));if(Q.errors.length>0)return d(Bi("Context failed",Q.errors,Q.warnings),null);let ae=!1,ke={rebuild:()=>{if(!se)se=new Promise((U,le)=>{let z;ue=(Le,fe)=>{if(!z)z=()=>Le?le(Le):U(fe)};let te=()=>{r(s,{command:"rebuild",key:t},(fe,Be)=>{if(fe)le(Error(fe));else if(z)z();else te()})};te()});return se},watch:(U={})=>new Promise((le,z)=>{if(!i.hasFS)throw Error('Cannot use the "watch" API in this environment');let te={},Le=N(U,te,"delay",cs);tt(U,te,"in watch() call");let fe={command:"watch",key:t};if(Le)fe.delay=Le;r(s,fe,(Be)=>{if(Be)z(Error(Be));else le(void 0)})}),serve:(U={})=>new Promise((le,z)=>{if(!i.hasFS)throw Error('Cannot use the "serve" API in this environment');let te={},Le=N(U,te,"port",Bk),fe=N(U,te,"host",re),Be=N(U,te,"servedir",re),G=N(U,te,"keyfile",re),We=N(U,te,"certfile",re),Xe=N(U,te,"fallback",re),pt=N(U,te,"cors",sr),ut=N(U,te,"onRequest",Wm);tt(U,te,"in serve() call");let Ue={command:"serve",key:t,onRequest:!!ut};if(Le!==void 0)Ue.port=Le;if(fe!==void 0)Ue.host=fe;if(Be!==void 0)Ue.servedir=Be;if(G!==void 0)Ue.keyfile=G;if(We!==void 0)Ue.certfile=We;if(Xe!==void 0)Ue.fallback=Xe;if(pt){let bt={},Mt=N(pt,bt,"origin",zm);if(tt(pt,bt,'on "cors" object'),Array.isArray(Mt))Ue.corsOrigin=Mt;else if(Mt!==void 0)Ue.corsOrigin=[Mt]}r(s,Ue,(bt,Mt)=>{if(bt)return z(Error(bt));if(ut)o["serve-request"]=(Xr,En)=>{ut(En.args),n(Xr,{})};le(Mt)})}),cancel:()=>new Promise((U)=>{if(ae)return U();r(s,{command:"cancel",key:t},()=>{U()})}),dispose:()=>new Promise((U)=>{if(ae)return U();ae=!0,r(s,{command:"dispose",key:t},()=>{U(),j(),s.unref()})})};s.ref(),d(null,ke)})}}var Qk=async(e,t,r,n,s,i,o,a,l)=>{let c=[],d=[],p={},h={},m=[],b=0,g=0,y=[],v=!1;a=[...a];for(let P of a){let E={};if(typeof P!=="object")throw Error(`Plugin at index ${g} must be an object`);let O=N(P,E,"name",re);if(typeof O!=="string"||O==="")throw Error(`Plugin at index ${g} is missing a name`);try{let R=N(P,E,"setup",Wm);if(typeof R!=="function")throw Error("Plugin is missing a setup function");tt(P,E,`on plugin ${it(O)}`);let k={name:O,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};g++;let D=R({initialOptions:o,resolve:(M,L={})=>{if(!v)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof M!=="string")throw Error("The path to resolve must be a string");let W=Object.create(null),se=N(L,W,"pluginName",re),ue=N(L,W,"importer",re),oe=N(L,W,"namespace",re),Q=N(L,W,"resolveDir",re),ae=N(L,W,"kind",re),ke=N(L,W,"pluginData",ha),U=N(L,W,"with",sr);return tt(L,W,"in resolve() call"),new Promise((le,z)=>{let te={command:"resolve",path:M,key:e,pluginName:O};if(se!=null)te.pluginName=se;if(ue!=null)te.importer=ue;if(oe!=null)te.namespace=oe;if(Q!=null)te.resolveDir=Q;if(ae!=null)te.kind=ae;else throw Error('Must specify "kind" when calling "resolve"');if(ke!=null)te.pluginData=l.store(ke);if(U!=null)te.with=eR(U,"with");t(n,te,(Le,fe)=>{if(Le!==null)z(Error(Le));else le({errors:Fs(fe.errors,l),warnings:Fs(fe.warnings,l),path:fe.path,external:fe.external,sideEffects:fe.sideEffects,namespace:fe.namespace,suffix:fe.suffix,pluginData:l.load(fe.pluginData)})})})},onStart(M){let W=pa(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:O,callback:M,note:W}),k.onStart=!0},onEnd(M){let W=pa(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");d.push({name:O,callback:M,note:W}),k.onEnd=!0},onResolve(M,L){let se=pa(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),ue={},oe=N(M,ue,"filter",ga),Q=N(M,ue,"namespace",re);if(tt(M,ue,`in onResolve() call for plugin ${it(O)}`),oe==null)throw Error("onResolve() call is missing a filter");let ae=b++;p[ae]={name:O,callback:L,note:se},k.onResolve.push({id:ae,filter:ya(oe),namespace:Q||""})},onLoad(M,L){let se=pa(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),ue={},oe=N(M,ue,"filter",ga),Q=N(M,ue,"namespace",re);if(tt(M,ue,`in onLoad() call for plugin ${it(O)}`),oe==null)throw Error("onLoad() call is missing a filter");let ae=b++;h[ae]={name:O,callback:L,note:se},k.onLoad.push({id:ae,filter:ya(oe),namespace:Q||""})},onDispose(M){m.push(M)},esbuild:s.esbuild});if(D)await D;y.push(k)}catch(R){return{ok:!1,error:R,pluginName:O}}}i["on-start"]=async(P,E)=>{l.clear();let O={errors:[],warnings:[]};await Promise.all(c.map(async({name:R,callback:k,note:I})=>{try{let D=await k();if(D!=null){if(typeof D!=="object")throw Error(`Expected onStart() callback in plugin ${it(R)} to return an object`);let M={},L=N(D,M,"errors",on),W=N(D,M,"warnings",on);if(tt(D,M,`from onStart() callback in plugin ${it(R)}`),L!=null)O.errors.push(...an(L,"errors",l,R,void 0));if(W!=null)O.warnings.push(...an(W,"warnings",l,R,void 0))}}catch(D){O.errors.push(ls(D,s,l,I&&I(),R))}})),r(P,O)},i["on-resolve"]=async(P,E)=>{let O={},R="",k,I;for(let D of E.ids)try{({name:R,callback:k,note:I}=p[D]);let M=await k({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:l.load(E.pluginData),with:E.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onResolve() callback in plugin ${it(R)} to return an object`);let L={},W=N(M,L,"pluginName",re),se=N(M,L,"path",re),ue=N(M,L,"namespace",re),oe=N(M,L,"suffix",re),Q=N(M,L,"external",Ge),ae=N(M,L,"sideEffects",Ge),ke=N(M,L,"pluginData",ha),U=N(M,L,"errors",on),le=N(M,L,"warnings",on),z=N(M,L,"watchFiles",Ht),te=N(M,L,"watchDirs",Ht);if(tt(M,L,`from onResolve() callback in plugin ${it(R)}`),O.id=D,W!=null)O.pluginName=W;if(se!=null)O.path=se;if(ue!=null)O.namespace=ue;if(oe!=null)O.suffix=oe;if(Q!=null)O.external=Q;if(ae!=null)O.sideEffects=ae;if(ke!=null)O.pluginData=l.store(ke);if(U!=null)O.errors=an(U,"errors",l,R,void 0);if(le!=null)O.warnings=an(le,"warnings",l,R,void 0);if(z!=null)O.watchFiles=ma(z,"watchFiles");if(te!=null)O.watchDirs=ma(te,"watchDirs");break}}catch(M){O={id:D,errors:[ls(M,s,l,I&&I(),R)]};break}r(P,O)},i["on-load"]=async(P,E)=>{let O={},R="",k,I;for(let D of E.ids)try{({name:R,callback:k,note:I}=h[D]);let M=await k({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:l.load(E.pluginData),with:E.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onLoad() callback in plugin ${it(R)} to return an object`);let L={},W=N(M,L,"pluginName",re),se=N(M,L,"contents",Gm),ue=N(M,L,"resolveDir",re),oe=N(M,L,"pluginData",ha),Q=N(M,L,"loader",re),ae=N(M,L,"errors",on),ke=N(M,L,"warnings",on),U=N(M,L,"watchFiles",Ht),le=N(M,L,"watchDirs",Ht);if(tt(M,L,`from onLoad() callback in plugin ${it(R)}`),O.id=D,W!=null)O.pluginName=W;if(se instanceof Uint8Array)O.contents=se;else if(se!=null)O.contents=$r(se);if(ue!=null)O.resolveDir=ue;if(oe!=null)O.pluginData=l.store(oe);if(Q!=null)O.loader=Q;if(ae!=null)O.errors=an(ae,"errors",l,R,void 0);if(ke!=null)O.warnings=an(ke,"warnings",l,R,void 0);if(U!=null)O.watchFiles=ma(U,"watchFiles");if(le!=null)O.watchDirs=ma(le,"watchDirs");break}}catch(M){O={id:D,errors:[ls(M,s,l,I&&I(),R)]};break}r(P,O)};let j=(P,E)=>E([],[]);if(d.length>0)j=(P,E)=>{(async()=>{let O=[],R=[];for(let{name:k,callback:I,note:D}of d){let M,L;try{let W=await I(P);if(W!=null){if(typeof W!=="object")throw Error(`Expected onEnd() callback in plugin ${it(k)} to return an object`);let se={},ue=N(W,se,"errors",on),oe=N(W,se,"warnings",on);if(tt(W,se,`from onEnd() callback in plugin ${it(k)}`),ue!=null)M=an(ue,"errors",l,k,void 0);if(oe!=null)L=an(oe,"warnings",l,k,void 0)}}catch(W){M=[ls(W,s,l,D&&D(),k)]}if(M){O.push(...M);try{P.errors.push(...M)}catch{}}if(L){R.push(...L);try{P.warnings.push(...L)}catch{}}}E(O,R)})()};let S=()=>{for(let P of m)setTimeout(()=>P(),0)};return v=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:j,scheduleOnDisposeCallbacks:S}};function Zm(){let e=new Map,t=0;return{clear(){e.clear()},load(r){return e.get(r)},store(r){if(r===void 0)return-1;let n=t++;return e.set(n,r),n}}}function pa(e,t,r){let n,s=!1;return()=>{if(s)return n;s=!0;try{let i=(e.stack+"").split(`
|
|
13
|
+
`);i.splice(1,1);let o=Qm(t,i,r);if(o)return n={text:e.message,location:o},n}catch{}}}function ls(e,t,r,n,s){let i="Internal error",o=null;try{i=(e&&e.message||e)+""}catch{}try{o=Qm(t,(e.stack+"").split(`
|
|
14
|
+
`),"")}catch{}return{id:"",pluginName:s,text:i,location:o,notes:n?[n]:[],detail:r?r.store(e):-1}}function Qm(e,t,r){let n=" at ";if(e.readFileSync&&!t[0].startsWith(n)&&t[1].startsWith(n))for(let s=1;s<t.length;s++){let i=t[s];if(!i.startsWith(n))continue;i=i.slice(n.length);while(!0){let o=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(o){i=o[1];continue}if(o=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),o){i=o[1];continue}if(o=/^(\S+):(\d+):(\d+)$/.exec(i),o){let a;try{a=e.readFileSync(o[1],"utf8")}catch{break}let l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+o[2]-1]||"",c=+o[3]-1,d=l.slice(c,c+r.length)===r?r.length:0;return{file:o[1],namespace:"file",line:+o[2],column:$r(l.slice(0,c)).length,length:$r(l.slice(c,c+d)).length,lineText:l+`
|
|
15
15
|
`+t.slice(1).join(`
|
|
16
|
-
`),suggestion:""}}break}}return null}function
|
|
16
|
+
`),suggestion:""}}break}}return null}function Bi(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((i,o)=>{if(o===n)return`
|
|
17
17
|
...`;if(!i.location)return`
|
|
18
18
|
error: ${i.text}`;let{file:a,line:l,column:c}=i.location,d=i.pluginName?`[plugin: ${i.pluginName}] `:"";return`
|
|
19
|
-
${a}:${l}:${c}: ERROR: ${d}${i.text}`}).join("");let s=Error(e);for(let[i,o]of[["errors",t],["warnings",r]])Object.defineProperty(s,i,{configurable:!0,enumerable:!0,get:()=>o,set:(a)=>Object.defineProperty(s,i,{configurable:!0,enumerable:!0,value:a})});return s}function Fs(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function
|
|
19
|
+
${a}:${l}:${c}: ERROR: ${d}${i.text}`}).join("");let s=Error(e);for(let[i,o]of[["errors",t],["warnings",r]])Object.defineProperty(s,i,{configurable:!0,enumerable:!0,get:()=>o,set:(a)=>Object.defineProperty(s,i,{configurable:!0,enumerable:!0,value:a})});return s}function Fs(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Jm(e,t,r){if(e==null)return null;let n={},s=N(e,n,"file",re),i=N(e,n,"namespace",re),o=N(e,n,"line",cs),a=N(e,n,"column",cs),l=N(e,n,"length",cs),c=N(e,n,"lineText",re),d=N(e,n,"suggestion",re);if(tt(e,n,t),c){let p=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(r&&r>0?r:80));if(!/[\x7F-\uFFFF]/.test(p)&&!/\n/.test(c))c=p}return{file:s||"",namespace:i||"",line:o||0,column:a||0,length:l||0,lineText:c||"",suggestion:d||""}}function an(e,t,r,n,s){let i=[],o=0;for(let a of e){let l={},c=N(a,l,"id",re),d=N(a,l,"pluginName",re),p=N(a,l,"text",re),h=N(a,l,"location",Mm),m=N(a,l,"notes",on),b=N(a,l,"detail",ha),g=`in element ${o} of "${t}"`;tt(a,l,g);let y=[];if(m)for(let v of m){let j={},S=N(v,j,"text",re),P=N(v,j,"location",Mm);tt(v,j,g),y.push({text:S||"",location:Jm(P,g,s)})}i.push({id:c||"",pluginName:d||n,text:p||"",location:Jm(h,g,s),notes:y,detail:r?r.store(b):-1}),o++}return i}function ma(e,t){let r=[];for(let n of e){if(typeof n!=="string")throw Error(`${it(t)} must be an array of strings`);r.push(n)}return r}function eR(e,t){let r=Object.create(null);for(let n in e){let s=e[n];if(typeof s!=="string")throw Error(`key ${it(n)} in object ${it(t)} must be a string`);r[n]=s}return r}function tR({path:e,contents:t,hash:r}){let n=null;return{path:e,contents:t,hash:r,get text(){let s=this.contents;if(n===null||s!==t)t=s,n=fs(s);return n}}}function ya(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function rR(e){let t;try{t=fs(e)}catch{return Vk(e)}return JSON.parse(t)}var On=Ne("fs"),Dm=Ne("os"),ur=Ne("path"),Ds=process.env.ESBUILD_BINARY_PATH||Ds,nR=(e)=>!!e&&e!=="/usr/bin/esbuild",Lm="@esbuild/darwin-arm64",Fm="@esbuild/darwin-x64",ba={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},xa={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},qm={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function sR(){let e,t,r=!1,n=`${process.platform} ${Dm.arch()} ${Dm.endianness()}`;if(n in ba)e=ba[n],t="esbuild.exe";else if(n in xa)e=xa[n],t="bin/esbuild";else if(n in qm)e=qm[n],t="bin/esbuild",r=!0;else throw Error(`Unsupported platform: ${n}`);return{pkg:e,subpath:t,isWASM:r}}function iR(){let e=Ne.resolve("esbuild"),t=ur.dirname(ur.dirname(ur.dirname(e)));if(ur.basename(t)==="node_modules"){for(let r in xa)try{let n=xa[r];if(On.existsSync(ur.join(t,n)))return n}catch{}for(let r in ba)try{let n=ba[r];if(On.existsSync(ur.join(t,n)))return n}catch{}}return null}function oR(e,t){let r=ur.dirname(Ne.resolve("esbuild"));return ur.join(r,`downloaded-${e.replace("/","-")}-${ur.basename(t)}`)}function aR(){if(nR(Ds))if(!On.existsSync(Ds))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${Ds}`);else return{binPath:Ds,isWASM:!1};let{pkg:e,subpath:t,isWASM:r}=sR(),n;try{n=Ne.resolve(`${e}/${t}`)}catch(s){if(n=oR(e,t),!On.existsSync(n)){try{Ne.resolve(e)}catch{let i=iR();if(i){let o=`
|
|
20
20
|
Specifically the "${i}" package is present but this platform
|
|
21
21
|
needs the "${e}" package instead. People often get into this
|
|
22
22
|
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
|
@@ -33,7 +33,7 @@ If you are installing with yarn, you can try listing both this platform and the
|
|
|
33
33
|
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
|
34
34
|
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
35
35
|
Keep in mind that this means multiple copies of esbuild will be present.
|
|
36
|
-
`;if(e===
|
|
36
|
+
`;if(e===Fm&&i===Lm||e===Lm&&i===Fm)o=`
|
|
37
37
|
Specifically the "${i}" package is present but this platform
|
|
38
38
|
needs the "${e}" package instead. People often get into this
|
|
39
39
|
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
|
@@ -65,44 +65,42 @@ want to do that.
|
|
|
65
65
|
If you are installing esbuild with npm, make sure that you don't specify the
|
|
66
66
|
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
|
67
67
|
of "package.json" is used by esbuild to install the correct binary executable
|
|
68
|
-
for your current platform.`)}throw s}}if(/\.zip\//.test(n)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(i){}if(s){let i=s.getPackageInformation(s.topLevel).packageLocation,o=ur.join(i,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${ur.basename(t)}`);if(!
|
|
68
|
+
for your current platform.`)}throw s}}if(/\.zip\//.test(n)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(i){}if(s){let i=s.getPackageInformation(s.topLevel).packageLocation,o=ur.join(i,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${ur.basename(t)}`);if(!On.existsSync(o))On.mkdirSync(ur.dirname(o),{recursive:!0}),On.copyFileSync(n,o),On.chmodSync(o,493);return{binPath:o,isWASM:r}}}return{binPath:n,isWASM:r}}var eh=Ne("child_process"),lR=Ne("crypto"),Fc=Ne("path"),us=Ne("fs"),cR=Ne("os"),uR=Ne("tty"),kt;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{kt=Ne("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)kt=void 0}var Hm,zi=((Hm=kt==null?void 0:kt.workerData)==null?void 0:Hm.esbuildVersion)==="0.28.2",th=()=>{if((!Ds||!1)&&(Fc.basename(__filename)!=="main.js"||Fc.basename(__dirname)!=="lib"))throw Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
|
|
69
69
|
|
|
70
|
-
More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=
|
|
71
|
-
error: ${c}`),p=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return d.errors=p,d.warnings=[],d},o=(c)=>{if(!c)return;let d=c.plugins;if(d&&d.length>0)throw i("Cannot use plugins in synchronous API calls")},a=(c,d)=>{for(let p in d)c[p]=d[p]},l=(c,d)=>{let p=s++,h=new SharedArrayBuffer(8),m=new Int32Array(h),b={sharedBuffer:h,id:p,command:c,args:d};n.postMessage(b);let g=Atomics.wait(m,0,0);if(g!=="ok"&&g!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+g);let{message:{id:y,resolve:v,reject:j,properties:S}}=e.receiveMessageOnPort(t);if(p!==y)throw Error(`Internal error: Expected id ${p} but got id ${y}`);if(j)throw a(j,S),j;return v};return n.unref(),{buildSync(c){return o(c),l("build",[c])},transformSync(c,d){return l("transform",[c,d])},formatMessagesSync(c,d){return l("formatMessages",[c,d])},analyzeMetafileSync(c,d){return l("analyzeMetafile",[c,d])},stop(){n.terminate(),
|
|
72
|
-
`);throw Error(`Bun.build failed for ${e.entryPath}:
|
|
73
|
-
${
|
|
74
|
-
`,{outfile:s,resolveDir:t},{...r,minify:!1,onFileLoaded:(i)=>n.push(i)})}catch{return}finally{ah(s,{force:!0})}return n.find((i)=>!Kc(i))}async function ps(e,{resolveDir:t,outfile:r},n){if(Ki()){let i=await Promise.resolve().then(() => kt(Gi(),1));await i.build({bundle:!0,...Bc(n),external:n.external??[],format:"esm",logLevel:"silent",minify:Wc(n),outfile:r,platform:dh(n.target),stdin:{contents:e,loader:"js",resolveDir:t,sourcefile:"jx-entry.js"}});return}let s=Uc(t,`${fh}${process.pid}.mjs`);lh(s,e,"utf8");try{await Gc({entryPath:s,outfile:r},n)}finally{ah(s,{force:!0})}}async function mh(e,{projectRoot:t,outfile:r,adapter:n}){await ps(e,{outfile:r,resolveDir:t},TR(n))}var ch,NR,fh=".jx-entry-";var Yc=q(()=>{nr();ch=["@vue/reactivity","lit-html"];NR={"process.env.NODE_ENV":'"production"'}});function JR(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function hh(e){let t=JR(e),r=t.slice(t.lastIndexOf("/")+1),n=r.lastIndexOf(".");if(n>0)t=t.slice(0,t.length-(r.length-n));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],i=!1,o=!1,a=t.replaceAll(MR,(l,c,d)=>{if(i=!0,c)return o=!0,s.push(c),"*";return s.push(d),`:${d}`});return{isCatchAll:o,isDynamic:i,params:s,urlPattern:a}}function gh(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var MR;var yh=q(()=>{MR=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function dr(e){if(!N(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Yi(e){let t=dr(e);if(t===null)return"ltr";let r=new Intl.Locale(t),n=r.script??r.maximize().script;return n!==void 0&&DR.has(n)?"rtl":"ltr"}function bh(e){let t=dr(e);if(t===null)return N(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Xc(e){let t=e.i18n,r=[];if(!F(t))return{errors:r,i18n:null};let n=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of n){let l=dr(a);if(l===null){r.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let i=dr(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&dr(t.defaultLocale)===null)r.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return r.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:r,i18n:null};if(!s.includes(i))s.unshift(i);let o=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:LR;return{errors:r,i18n:{defaultLocale:i,locales:s,routing:o}}}function Nr(e,t){if(t===null)return null;let r=e.split("/").find(Boolean);if(r===void 0)return t.defaultLocale;let n=dr(r);return n!==null&&t.locales.includes(n)?n:t.defaultLocale}var DR,ka="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",LR="prefix-except-default";var ms=q(()=>{ve();DR=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});function Vt(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function xh(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let r=e.slice(2,-1).trim();return FR.has(r.toLowerCase())?r:e.slice(1)}return null}function Xi(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Qi(e){return e.startsWith("@keyframes")}function $h(e,t){let r=[];for(let n of Zi(e))for(let s of Zi(t))r.push(qR(n,s));return r.join(", ")}function qR(e,t){let r=Aa(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Zc(e){let t=[],r=null,n=0;for(let s=0;s<e.length;s+=1){let i=e[s];if(r){if(i==="\\")s+=1;else if(i===r)r=null;continue}if(i==="\\")s+=1;else if(i==='"'||i==="'")r=i;else if(i==="[")n+=1;else if(i==="]")n=Math.max(0,n-1);else if(i==="&"&&n===0)t.push(s)}return t}function Aa(e,t){return Zc(e).length>0?HR(e,t):null}function HR(e,t){let r="",n=0;for(let s of Zc(e))r+=e.slice(n,s)+t,n=s+1;return r+e.slice(n)}function Zi(e){let t=[],r=0,n=null,s=0;for(let o=0;o<e.length;o+=1){let a=e[o];if(n){if(a==="\\")o+=1;else if(a===n)n=null;continue}if(a==='"'||a==="'")n=a;else if(a==="("||a==="[")r+=1;else if(a===")"||a==="]")r=Math.max(0,r-1);else if(a===","&&r===0)t.push(e.slice(s,o)),s=o+1}t.push(e.slice(s));let i=t.flatMap((o)=>{let a=o.trim();return a===""?[]:[a]});return i.length>0?i:[e]}function wr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Qc(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${vr}]))`,forced:`${e}:where([${vr}="${t}"])`};return{auto:`:where(:root:not([${vr}])) ${e}`,forced:`:where(:root[${vr}="${t}"]) ${e}`}}function On(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function eu(e){return e.startsWith("--")?e:Vt(e)}function Ra(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function vh(e,t,r){let n=r.map(([i,o])=>`${i}: ${o}`).join("; "),s=t===null?n:`${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function VR(e,t,r){let n=r.map(({selector:i,declarations:o})=>`${i} { ${o.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function WR(e){let t=Object.keys(e).filter((n)=>Qi(n));if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}function BR(e){let r=Zc(e).at(-1),n=r===void 0?e:e.slice(r+1);return n===""||n.startsWith(":")||n.startsWith(".")||n.startsWith("[")}function qs(e,t={}){let{scope:r=null,mediaQueries:n={},transposeValue:s=(y)=>y,transposeSelector:i=(y)=>y,resolveValue:o}=t,a=[],l=(y)=>y!==null&&typeof y==="object"&&!Array.isArray(y)&&!Ce(y),c=(y,v)=>{if(l(v))return[v];if(!Xi(y)||!Array.isArray(v)||v.length===0)return[];return v.every((j)=>l(j))?v:[]},d=(y,v,j,S)=>{if(v===void 0||v===null)return null;if(Ce(v))return j?o?.(y,v,S)??null:null;if(F(v))return null;let P=String(v);if(pe(P))return j?o?.(y,P,S)??null:null;return s(P)},p=(y,v,j=!0,S="self")=>{let P=[];for(let[E,O]of Object.entries(y)){if(c(E,O).length>0)continue;if(v&&(E.startsWith("@")||On(E)))continue;if(E.startsWith("$"))continue;let R=d(E,O,j,S);if(R!==null)P.push([eu(E),R])}return P},h=(y,v,j,S,P)=>{if(j.length===0)return;let E=v;if(E!==null){let k=i(E);if(k===null)return;E=k}let O=vh(y,E,j),R={text:O,conditions:[...y],selector:E,declarations:j,target:S,key:Ra(O)};if(N(P)&&P!=="")R.description=P;a.push(R)},m=(y,v,j)=>{let S=y.slice(10).trim();if(S==="")return;let P=[];for(let[O,R]of Object.entries(v)){if(!l(R))continue;let k=p(R,!0,!1,"unscoped");if(k.length>0)P.push({declarations:k,selector:O.trim()})}if(P.length===0)return;let E=VR(j,S,P);a.push({blocks:P,conditions:[...j],declarations:[],key:Ra(E),selector:null,target:"unscoped",text:E})},b=(y,v,j,S,P)=>{if(y==="@--")return;if(Xi(y)){h([...S,y],null,p(v,!1,!0,"unscoped"),"unscoped",v.$description);return}if(Qi(y)){m(y,v,S);return}let E=xh(y,n),O=E===null?y:`@media ${E}`,R=E===null?null:wr(E);if(R!==null&&j!==null){let{auto:k,forced:I}=Qc(j,R);g(v,k,[...S,O],P),g(WR(v),I,S,P);return}g(v,j,[...S,O],P)};function g(y,v,j,S){h(j,v,p(y,!0,!0,S),S,y.$description);for(let[P,E]of Object.entries(y))for(let O of c(P,E))if(P.startsWith("@"))b(P,O,v,j,S);else if(v!==null)g(O,$h(v,P),j,BR(P)?S:"descendant")}return g(e,r,[],"self"),a}var FR,vr="data-color-scheme",Oa="jx-color-scheme";var eo=q(()=>{ve();FR=new Set(["all","print","screen","speech"])});function Eh(){return`the Intl helpers ${ru.join(", ")}`}var Ir="en-US",tu="UTC",wh,ru,Sh;var nu=q(()=>{wh=[{api:"Intl.NumberFormat",params:["value","locale","options"],path:"Intl/formatNumber",summary:"Format a number for a locale — grouping, decimals, currency, percent, units."},{api:"Intl.DateTimeFormat",params:["value","locale","options"],path:"Intl/formatDate",summary:"Format a date or timestamp for a locale. Pass `timeZone` in options."},{api:"Intl.RelativeTimeFormat",params:["value","unit","locale","options"],path:"Intl/formatRelativeTime",summary:'Format a relative time — `-3, "day"` becomes "3 days ago".'},{api:"Intl.ListFormat",params:["values","locale","options"],path:"Intl/formatList",summary:'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'},{api:"Intl.PluralRules",params:["value","locale","options"],path:"Intl/plural",summary:'Which plural category a number falls in ("one", "few", "other") — many languages have '+"more than two, so a ternary on `n === 1` is wrong outside English."},{api:"Intl.Collator",params:["a","b","locale","options"],path:"Intl/compare",summary:'Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts "Zebra" before "apple" and sorts every accented word into the wrong place.'},{api:"Intl.DisplayNames",params:["code","type","locale","options"],path:"Intl/displayName",summary:'The name of a language, region, script or currency in a locale — "de" as "German" or '+'"Deutsch", from CLDR rather than a hand-kept table.'},{api:"Intl.Segmenter",params:["value","granularity","locale"],path:"Intl/segment",summary:"Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, so it cuts an emoji with a skin-tone modifier in half."}],ru=wh.map((e)=>e.path),Sh=Object.fromEntries(wh.map((e)=>[e.path,e.params.indexOf("locale")]))});function UR(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function dt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function cn(e){if(e==="")return[];return e.split("/").map((t)=>UR(t))}function mt(e,t){let r=e;for(let n of cn(t))r=r?.[n];return r}function Pe(e,t){let r=e;for(let n of cn(t))r+=su.test(n)?`.${n}`:`[${JSON.stringify(n)}]`;return r}function _h(e,t){let r=e;for(let[n,s]of cn(t).entries()){let i=n===0?"":"?.";r+=su.test(s)?`${n===0?".":i}${s}`:`${i}[${JSON.stringify(s)}]`}return r}function un(e){return su.test(e)?e:JSON.stringify(e)}function Ph(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var su;var Hs=q(()=>{su=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function iu(e){let t=e.$map;return F(t)?t:void 0}function Ah(e){return F(e)&&!Array.isArray(e)&&"operator"in e}function to(e){return F(e)&&!Array.isArray(e)&&"$ref"in e}function YR(e,t,r){let n=Sh[e];if(n===void 0||n<0||t[n]!=null)return t;let s=mt(r.$page,"locale");if(!N(s)||s==="")return t;let i=[...t];return i[n]=s,i}function Nh(e){return e.startsWith("window#/")&&GR.has(e.slice(8))}function dn(e){return Oh.has(e)}function Ke(e,t){if(!e)return;let r=(e.depth??0)+1;if(r>XR)return;return{depth:r,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Fe(e,t,r,n,s){if(e===null||e===void 0)return e;if(Ah(e))return ir(e,t,r,n,s);if(to(e)){let i=Ca(e.$ref,t,r,n);return s?.report(s.path??[],i),i}if(Array.isArray(e))return Ih(e,t,r,n,s);return s?.report(s.path??[],e),e}function Ih(e,t,r,n,s){return e.map((i,o)=>Fe(i,t,r,n,Ke(s,o)))}function ZR(e,t,r,n){let s=(i)=>{if(!e.slice(i.length).includes("/"))return t;return Ca(e.slice(0,e.lastIndexOf("/")),t,r,n)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?Ca(e.slice(0,e.lastIndexOf("/")),t,r,n):void 0;return}function Ca(e,t,r,n){if(e==="$reduce/acc")return n?.acc;if(e.startsWith("$reduce/"))return n?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),i=n?.args?.[s[0]];return s.length>1?mt(i,s.slice(1).join("/")):i}if(e.startsWith("event#/")){let s=e.slice(7);return mt(r,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=iu(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];return s.length>2?mt(o,s.slice(2).join("/")):o}if(e.startsWith("#/state/"))return mt(t,e.slice(8));if(e.startsWith("parent#/"))return mt(t,e.slice(8));if(e.startsWith("window#/"))return mt(globalThis.window,e.slice(8));if(e.startsWith("document#/"))return mt(globalThis.document,e.slice(10));return mt(t,e)??null}function QR(e,t,r,n){if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=iu(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];if(s.length>2){let l=s.slice(2),c=l.pop(),d=l.length>0?mt(o,l.join("/")):o;return{key:c,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:iu(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let o=cn(s),a=o.pop(),l=t;for(let c of o)l=l[c];return{key:a,obj:l}}return{key:e,obj:t}}function ir(e,t,r,n,s){let i=eA(e,t,r,n,s);return s?.report(s.path??[],i),i}function kh(e,t,r){switch(e){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;case"<":return t<r;case"<=":return t<=r;case">":return t>r;default:return t>=r}}function eA(e,t,r,n,s){let{operator:i,target:o,value:a,initial:l}=e;if(!zR.has(i))throw Error(`$expression: unknown operator "${i}"`);if(ou.has(i)&&!("value"in e)){let c=Fe(o,t,r,n,Ke(s,"target"));if(i==="!")return!c;if(i==="-")return-c}if(i==="call"){let c=to(o)?o.$ref:void 0;if(!N(c))throw TypeError("$expression: call target must be a $ref pointer");let d=(n?.callDepth??0)+1;if(d>jh)throw Error(`$expression: call depth exceeded (${jh})`);let p=Array.isArray(a)?a.map((m,b)=>Fe(m,t,r,n,Ke(s,["value",b]))):[];if(c.startsWith("window#/")){if(!Nh(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),b=KR.get(m);if(b)return b(...YR(m,p,t));let g=mt(globalThis.window,m),y=m.lastIndexOf("/"),v=y===-1?globalThis.window:mt(globalThis.window,m.slice(0,y));return g.apply(v,p)}let h=Ca(c,t,r,n);if(vt(h))return h.apply(ZR(c,t,r,n),p);if(F(h)&&"$expression"in h){let m=h,b={};for(let[g,y]of(m.parameters??[]).entries()){let v=N(y)?y:y?.name??"";if(!v)continue;b[v]=p[g]===void 0&&F(y)&&"default"in y?y.default:p[g]}return ir(m.$expression,t,r,{args:b,callDepth:d})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(cu.has(i)){if(i==="?:"){let m=Fe(o,t,r,n,Ke(s,"target"));if(s){let b=Fe(a,t,r,n,Ke(s,"value")),g=Fe(l,t,r,n,Ke(s,"initial"));return m?b:g}return m?Fe(a,t,r,n):Fe(l,t,r,n)}let c=Fe(o,t,r,n,Ke(s,"target")),d=String(c),p=e.cases??{},h=Object.hasOwn(p,d);if(s){let m;for(let[g,y]of Object.entries(p)){let v=Fe(y,t,r,n,Ke(s,["cases",g]));if(g===d)m=v}let b=Fe(e.default,t,r,n,Ke(s,"default"));return h?m:b}return h?Fe(p[d],t,r,n):Fe(e.default,t,r,n)}if(au.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=Fe(a,t,r,n,Ke(s,"value"));switch(i){case"===":return c===d;case"!==":return c!==d;case"&&":return c&&d;case"||":return c||d;case"??":return c??d;default:return kh(i,c,d)}}if(Ch.has(i)){let c=Fe(a,t,r,n,Ke(s,"value")),{obj:d,key:p}=QR(o.$ref,t,r,n);d[p]=i==="="?c:kh(i.slice(0,-1),d[p],c);return}if(Th.has(i)){let c=Fe(o,t,r,n,Ke(s,"target"));switch(i){case"push":return c.push(Fe(a,t,r,n,Ke(s,"value")));case"unshift":return c.unshift(Fe(a,t,r,n,Ke(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let d=Fe(a,t,r,n,Ke(s,"value"));return c.splice(...d)}default:break}}if(uu.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=a===void 0?[]:Array.isArray(a)?Ih(a,t,r,n,Ke(s,"value")):[Fe(a,t,r,n,Ke(s,"value"))],p=mt(c,i);if(!vt(p))return;return p.apply(c,d)}if(lu.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=a;if(i==="reduce"){let p=Fe(l,t,r,n,Ke(s,"initial"));for(let[h,m]of c.entries())p=ir(d,t,r,{acc:p,index:h,item:m},h===0?Ke(s,"value"):void 0);return p}if(i==="map")return c.map((p,h)=>ir(d,t,r,{...n,index:h,item:p},h===0?Ke(s,"value"):void 0));if(i==="filter")return c.filter((p,h)=>ir(d,t,r,{...n,index:h,item:p},h===0?Ke(s,"value"):void 0))}return}function Ze(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Ah(e))return Ot(e,t);if(to(e))return du(e.$ref,t);if(Array.isArray(e))return e.map((r)=>Ze(r,t)).join(", ");return JSON.stringify(e)}function tA(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function du(e,t){let r=t.statePrefix??"state",n=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Pe("_args",e.slice(6));if(e.startsWith("event#/"))return Pe(n,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s;if(i==="item")return s.length>2?Pe("_item",s.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(e.startsWith("#/state/"))return Pe(r,e.slice(8));if(e.startsWith("parent#/"))return Pe(r,e.slice(8));if(e.startsWith("window#/"))return Pe("window",e.slice(8));if(e.startsWith("document#/"))return Pe("document",e.slice(10));return Pe(r,e)}function Rh(e,t){if(to(e))return du(e.$ref,t);return Ze(e,t)}function rA(e,t,r){let n=(o)=>t[o]??"undefined",s=`(${r.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Ir)})`,i=JSON.stringify(tu);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${n(1)} ?? ${s}, {timeZone: ${i}, ...${n(2)}}).format(new Date(${n(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${n(2)} ?? ${s}, ${n(3)}).format(${n(0)}, ${n(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/plural":return`new Intl.PluralRules(${n(1)} ?? ${s}, ${n(2)}).select(${n(0)})`;case"Intl/compare":return`new Intl.Collator(${n(2)} ?? ${s}, ${n(3)}).compare(${n(0)}, ${n(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${n(2)} ?? ${s}, {...${n(3)}, type: ${n(1)} ?? 'language'}).of(${n(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${n(2)} ?? ${s}, {granularity: ${n(1)} ?? 'grapheme'}).segment(${n(0)})].map((p) => p.segment)`;default:return null}}function Ot(e,t={}){let{operator:r,target:n,value:s,initial:i}=e;if(ou.has(r)&&!("value"in e)){let o=Ze(n,t);if(r==="!")return`!(${o})`;if(r==="-")return`-(${o})`}if(r==="call"){let o=(to(n)?n.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>Ze(l,t)):[];if(o.startsWith("window#/")){if(!Nh(o))throw Error(`$expression: "${o}" is not a blessed pure global`);let l=rA(o.slice(8),a,t);if(l)return l;return`window.${o.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(o.startsWith("#/state/")){let l=o.slice(8),c=t.formulaParams?.[l];if(c){let d=c.map((p,h)=>`${JSON.stringify(p)}: ${a[h]??"undefined"}`).join(", ");return`${tA(l)}(${t.statePrefix??"state"}, { ${d} })`}}return`${du(o,t)}(${a.join(", ")})`}if(cu.has(r)){if(r==="?:"){let c=Ze(n,t),d=Ze(s,t),p=Ze(i,t);return`(${c} ? ${d} : ${p})`}let o=Ze(n,t),a=Object.entries(e.cases??{}).map(([c,d])=>`_d === ${JSON.stringify(c)} ? ${Ze(d,t)} : `).join(""),l="default"in e?Ze(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${o}))`}if(au.has(r)){let o=Ze(n,t),a=Ze(s,t);return`(${o} ${r} ${a})`}if(Ch.has(r)){let o=Rh(n,t),a=Ze(s,t);return`${o} ${r} ${a}`}if(Th.has(r)){let o=Rh(n,t);switch(r){case"push":return`${o}.push(${Ze(s,t)})`;case"unshift":return`${o}.unshift(${Ze(s,t)})`;case"pop":return`${o}.pop()`;case"shift":return`${o}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>Ze(l,t)).join(", "):Ze(s,t);return`${o}.splice(${a})`}default:break}}if(uu.has(r)){let o=Ze(n,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>Ze(l,t)).join(", "):Ze(s,t);return`(${o})?.${r}?.(${a})`}if(lu.has(r)){let o=Ze(n,t),a=Ot(s,t);if(r==="reduce"){let l=Ze(i,t);return`${o}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(r==="map")return`${o}.map((_item, _index) => ${a})`;if(r==="filter")return`${o}.filter((_item, _index) => ${a})`}return"undefined"}function Vs(e,t,r,n){return Fe(e,t,r,n)}function fn(e,t={}){return Ze(e,t)}var Oh,ou,au,Ch,Th,lu,cu,uu,zR,GR,KR,jh=64,XR=64;var ro=q(()=>{nu();ve();Hs();Oh=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),ou=new Set(["!","-"]),au=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Ch=new Set(["=","+=","-=","*=","/="]),Th=new Set(["push","pop","shift","unshift","splice"]),lu=new Set(["reduce","map","filter"]),cu=new Set(["?:","switch"]),uu=new Set(["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]),zR=new Set([...Oh,...ou,...au,...lu,...cu,...uu,"call"]),GR=new Set(["isNaN","isFinite","parseFloat","parseInt","encodeURIComponent","decodeURIComponent","structuredClone","Math/abs","Math/ceil","Math/floor","Math/round","Math/trunc","Math/sign","Math/sqrt","Math/cbrt","Math/pow","Math/exp","Math/log","Math/log2","Math/log10","Math/min","Math/max","Math/hypot","Number/isInteger","Number/isFinite","Number/isNaN","Number/parseFloat","Number/parseInt","JSON/parse","JSON/stringify","Object/keys","Object/values","Object/entries","Object/fromEntries","Array/from","Array/isArray","Array/of","String/fromCharCode","String/fromCodePoint",...ru]),KR=new Map([["Intl/compare",(e,t,r,n)=>new Intl.Collator(r??Ir,n).compare(e,t)],["Intl/displayName",(e,t,r,n)=>new Intl.DisplayNames(r??Ir,{...n,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,r)=>new Intl.DateTimeFormat(t??Ir,{timeZone:tu,...r}).format(new Date(e))],["Intl/formatList",(e,t,r)=>new Intl.ListFormat(t??Ir,r).format(e)],["Intl/formatNumber",(e,t,r)=>new Intl.NumberFormat(t??Ir,r).format(e)],["Intl/formatRelativeTime",(e,t,r,n)=>new Intl.RelativeTimeFormat(r??Ir,n).format(e,t)],["Intl/plural",(e,t,r)=>new Intl.PluralRules(t??Ir,r).select(e)],["Intl/segment",(e,t,r)=>[...new Intl.Segmenter(r??Ir,{granularity:t??"grapheme"}).segment(e)].map((n)=>n.segment)]])});function Mh(e){if("operator"in e)return{kind:"expression",node:e};if("if"in e)return{kind:"if",node:e};if("$switch"in e)return{kind:"switch",node:e};if("stopPropagation"in e)return{kind:"stopPropagation"};if("preventDefault"in e)return{kind:"preventDefault"};return{kind:"dispatch",node:e}}function nA(e){return(F(e)||vt(e))&&"then"in e&&vt(e.then)}async function Ws(e,t,r,n={}){let s=n.args?{args:n.args}:void 0;for(let i of e){let o=Mh(i);switch(o.kind){case"expression":{let a=ir(o.node,t,r,s);if(nA(a))await a;break}case"if":{let a=o.node,l=Vs(a.if,t,r,s)?a.then:a.else;if(Array.isArray(l))await Ws(l,t,r,n);break}case"switch":{let a=o.node,l=String(Vs(a.$switch,t,r,s)),c=a.cases??{},d=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(d))await Ws(d,t,r,n);break}case"dispatch":{let a=o.node,l=vt(n.target)?n.target():n.target,c=r?.currentTarget??l;if(!c)break;let d={};if("detail"in a)d.detail=Vs(a.detail,t,r,s);if(a.bubbles!==void 0)d.bubbles=a.bubbles;if(a.composed!==void 0)d.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,d));break}case"stopPropagation":{r?.stopPropagation();break}case"preventDefault":{r?.preventDefault();break}default:break}}}function fr(e,t={}){let r=t.indent??"",n=[];for(let s of e){let i=Mh(s);switch(i.kind){case"expression":{n.push(`${r}${Ot(i.node,t)};`);break}case"if":{let o=i.node,a=fn(o.if,t),l={...t,indent:`${r} `};if(n.push(`${r}if (${a}) {`,fr(o.then??[],l)),o.else)n.push(`${r}} else {`,fr(o.else,l));n.push(`${r}}`);break}case"switch":{let o=i.node,a=fn(o.$switch,t),l={...t,indent:`${r} `};n.push(`${r}switch (String(${a})) {`);for(let[c,d]of Object.entries(o.cases??{}))n.push(`${r} case ${JSON.stringify(c)}: {`,fr(d,l),`${r} break;`,`${r} }`);if(o.default)n.push(`${r} default: {`,fr(o.default,l),`${r} }`);n.push(`${r}}`);break}case"dispatch":{let o=i.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in o)c.push(`detail: ${fn(o.detail,t)}`);if(o.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(o.bubbles)}`);if(o.composed!==void 0)c.push(`composed: ${JSON.stringify(o.composed)}`);let d=c.length>0?`, { ${c.join(", ")} }`:"";n.push(`${r}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(o.dispatchEvent)}${d}));`);break}case"stopPropagation":{n.push(`${r}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{n.push(`${r}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return n.join(`
|
|
75
|
-
`)}
|
|
76
|
-
`)}
|
|
77
|
-
`
|
|
78
|
-
`)}function aA(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(r,n)=>`\${${n.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function qa(e){if(!F(e))return!1;if(e.state)for(let[t,r]of Object.entries(e.state)){if(t==="$site"||t==="$page")continue;if(!F(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(r.$prototype)return!0;if("default"in r)return!0;if(_n(r))continue;return!0}if(e.$switch)return!0;if(Qe(e)||jc(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>qa(t)))return!0;for(let[t,r]of Object.entries(e)){if(pn.has(t))continue;if(Ce(r))return!0;if(pe(r))return!0}if(F(e.style)){for(let t of Object.values(e.style))if(pe(t))return!0}if(F(e.attributes)){for(let t of Object.values(e.attributes))if(pe(t))return!0}return!1}function Uh(e){if(!F(e))return!1;if(e.$switch)return!0;if(Qe(e)||jc(e.children))return!0;for(let[t,r]of Object.entries(e)){if(pn.has(t))continue;if(Ce(r))return!0;if(pe(r))return!0}if(F(e.style)){for(let t of Object.values(e.style))if(pe(t))return!0}if(F(e.attributes)){for(let t of Object.values(e.attributes))if(pe(t))return!0}return!1}function Xs(e,t=null,r={},n={}){let s=e?.state?zs(e.state,t):t??zh();return{media:n,scope:s,scopeDefs:r}}function zh(e=null){return Object.create(e)}function Gh(e){return e[Bh]}function gu(e,t){if(N(e)){for(let i of e.matchAll(lA))t.add(i[1]);for(let i of e.matchAll(cA))t.add(i[1]);return}if(Array.isArray(e)){for(let i of e)gu(i,t);return}if(!F(e))return;let r=e,{operator:n,target:s}=r;if(N(n)&&dn(n)&&Ce(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let i of Object.values(r))gu(i,t)}function zs(e={},t=null){let r=zh(t),n=t?Gh(t):void 0,s=new Set(n);Object.defineProperty(r,Bh,{configurable:!0,enumerable:!1,value:s,writable:!0});let i=new Set;for(let c of Object.values(e))if(er(c)||tr(c))gu(c.body??c.$expression,i);for(let c of i)if(c in e)s.add(c);for(let[c,d]of Object.entries(e)){if(!F(d)||Array.isArray(d)){mn(r,c,Ma(d));continue}if("default"in d){mn(r,c,Ma(d.default));continue}if(rn(d)){s.add(c);continue}if(!d.$prototype&&!("$expression"in d)&&!_n(d))mn(r,c,Ma(d))}let o=[],a=[];for(let[c,d]of Object.entries(e)){if(pe(d)){o.push([c,d]);continue}if(!F(d))continue;if(tr(d)){let p=d.$expression;if(rs(d)){let h=d.parameters;mn(r,c,(...m)=>{let b={};for(let[g,y]of h.entries()){let v=Vh(y);if(!v)continue;b[v]=m[g]===void 0&&Wh(y)?y.default:m[g]}return ir(p,r,null,{args:b})})}else if(dn(p.operator))mn(r,c,(h,m)=>ir(p,h,m));else mu(r,c,()=>ir(p,r,null));continue}if(er(d)){if(En(d)){let{body:p}=d;mn(r,c,(h,m)=>{Ws(p,h??r,m??null)})}else if(N(d.body)){let p=d.parameters?nn(d.parameters):d.arguments??[],{body:h}=d,m=p.includes("state")?p:["state",...p],b=Function(...m,h),g=(y,v)=>b(...m.map((j)=>j==="state"?y:v));if(ns(h))mu(r,c,()=>g(r)),a.push([c,h]);else mn(r,c,g)}else mn(r,c,()=>{}),s.add(c);continue}if(Cr(d)&&(d.$prototype==="LocalStorage"||d.$prototype==="SessionStorage")){mn(r,c,Ma(d.default??null));continue}if(Cr(d)&&d.$prototype==="Request")s.add(c)}let l=!0;while(l){l=!1;for(let[c,d]of[...a,...o])if(!s.has(c)&&Kh(d,r))s.add(c),l=!0}for(let[c,d]of o)mu(r,c,()=>wt(d,r));return r}function mn(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function mu(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:r})}function Me(e,t){if(Ce(e))return xu(e.$ref,t);if(pe(e))return wt(e,t);return e}function Wt(e){return Ce(e)}function xu(e,t){if(!N(e))return e;if(e.startsWith("$map/")){let r=e.split("/"),n=r[1],i=t.$map?.[n]??t[`$map/${n}`];return r.length>2?hu(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return hu(t,e.slice(8));return hu(t,e)??null}function Kh(e,t){if(!t)return!1;let r=Gh(t);for(let n of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(n[2])continue;let s=n[1];if(r?.has(s))return!0;let i;try{i=t[s]}catch{continue}if(vt(i))return!0}return!1}function Ha(e){return Bs(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function wt(e,t){if(Kh(e,t))return null;let r=["state","$map","$site","$page"],n=[t,t?.$map,t?.$site,t?.$page];try{let s=Bs(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...r,s)(...n)}catch{return null}}function hu(e,t){return mt(e,t)}function Ma(e){if(!F(e))return e;return structuredClone(e)}function uA(e,t){if(!e||!t)return"";return Object.entries(e).filter(([r,n])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&pe(n)).map(([r,n])=>{let s=Me(n,t);return s==null?null:`${Vt(r)}: ${s}`}).filter(Boolean).join("; ")}function bs(e,t,r=""){let n="",s=Me(e.id,t),i=Me(e.className,t),o=Me(e.hidden,t),a=Me(e.tabIndex,t),l=Me(e.title,t),c=Me(e.lang,t),d=Me(e.dir,t);if(s)n+=` id="${$e(String(s))}"`;if(i)n+=` class="${$e(String(i))}"`;if(o)n+=" hidden";if(a!==void 0&&a!==null)n+=` tabindex="${$e(String(a))}"`;if(l)n+=` title="${$e(String(l))}"`;if(c)n+=` lang="${$e(String(c))}"`;if(d)n+=` dir="${$e(String(d))}"`;let p=[uA(e.style,t),r].filter(Boolean).join("; ");if(p)n+=` style="${$e(p)}"`;if(e.attributes)for(let[h,m]of Object.entries(e.attributes)){let b=Me(m,t);if($t(b)){let g=gs(h,b);if(g!==null)n+=g===""?` ${h}`:` ${h}="${$e(g)}"`;continue}if(N(b)||lr(b))n+=` ${h}="${$e(String(b))}"`}if(e.$static)n+=" data-jx-static";else if(e.$prerendered)n+=" data-jx-prerendered";return n}function oo(e,t=" "){return e?"":`
|
|
79
|
-
${t}`}function Zs(){let e=JSON.stringify(Oa),t=JSON.stringify(vr);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Ja(e,t,r,n){for(let s of qs(t,{mediaQueries:n,resolveValue:(i,o)=>Yh(i,o,r),scope:r}))e.push(s.text)}function Yh(e,t,r){let n=N(t)?t:t.$ref;return dA.push({property:e,selector:r,source:n}),null}function Va(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Dh())});
|
|
70
|
+
More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=aR();if(t)return["node",[e]];else return[e,[]]}},Wi=()=>uR.isatty(2),dR={readFile(e,t){try{let r=us.readFileSync(e,"utf8");try{us.unlinkSync(e)}catch{}t(null,r)}catch(r){t(r,null)}},writeFile(e,t){try{let r=rh();us.writeFileSync(r,e),t(r)}catch{t(null)}}},fR={readFile(e,t){try{us.readFile(e,"utf8",(r,n)=>{try{us.unlink(e,()=>t(r,n))}catch{t(r,n)}})}catch(r){t(r,null)}},writeFile(e,t){try{let r=rh();us.writeFile(r,e,(n)=>n!==null?t(null):t(r))}catch{t(null)}}},pR="0.28.2",mR=(e)=>ps().build(e),hR=(e)=>ps().context(e),gR=(e,t)=>ps().transform(e,t),yR=(e,t)=>ps().formatMessages(e,t),bR=(e,t)=>ps().analyzeMetafile(e,t),xR=(e)=>{if(kt&&!zi){if(!Rt)Rt=Sa(kt);return Rt.buildSync(e)}let t;return wa((r)=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Wi(),defaultWD:ds,callback:(n,s)=>{if(n)throw n;t=s}})),t},$R=(e,t)=>{if(kt&&!zi){if(!Rt)Rt=Sa(kt);return Rt.transformSync(e,t)}let r;return wa((n)=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Wi(),fs:dR,callback:(s,i)=>{if(s)throw s;r=i}})),r},vR=(e,t)=>{if(kt&&!zi){if(!Rt)Rt=Sa(kt);return Rt.formatMessagesSync(e,t)}let r;return wa((n)=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},wR=(e,t)=>{if(kt&&!zi){if(!Rt)Rt=Sa(kt);return Rt.analyzeMetafileSync(e,t)}let r;return wa((n)=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},SR=()=>{if($a)$a();if(Rt)Rt.stop();return Promise.resolve()},qc=!1,ER=(e)=>{if(e=Kk(e||{}),e.wasmURL)throw Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw Error('The "wasmModule" option only works in the browser');if(e.worker)throw Error('The "worker" option only works in the browser');if(qc)throw Error('Cannot call "initialize" more than once');return ps(),qc=!0,Promise.resolve()},ds=process.cwd(),Vi,$a,ps=()=>{if(Vi)return Vi;let[e,t]=th(),r=eh.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:ds}),{readFromStdout:n,afterClose:s,service:i}=Xm({writeToStdin(d){r.stdin.write(d,(p)=>{if(p)s(p)})},readFileSync:us.readFileSync,isSync:!1,hasFS:!0,esbuild:Ui});r.stdin.on("error",s),r.on("error",s);let{stdin:o,stdout:a}=r;a.on("data",n),a.on("end",s),$a=()=>{o.destroy(),a.destroy(),r.kill(),qc=!1,Vi=void 0,$a=void 0};let l=0;if(r.unref(),o.unref)o.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)r.ref()},unref(){if(--l===0)r.unref()}};return Vi={build:(d)=>new Promise((p,h)=>{i.buildOrContext({callName:"build",refs:c,options:d,isTTY:Wi(),defaultWD:ds,callback:(m,b)=>m?h(m):p(b)})}),context:(d)=>new Promise((p,h)=>i.buildOrContext({callName:"context",refs:c,options:d,isTTY:Wi(),defaultWD:ds,callback:(m,b)=>m?h(m):p(b)})),transform:(d,p)=>new Promise((h,m)=>i.transform({callName:"transform",refs:c,input:d,options:p||{},isTTY:Wi(),fs:fR,callback:(b,g)=>b?m(b):h(g)})),formatMessages:(d,p)=>new Promise((h,m)=>i.formatMessages({callName:"formatMessages",refs:c,messages:d,options:p,callback:(b,g)=>b?m(b):h(g)})),analyzeMetafile:(d,p)=>new Promise((h,m)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof d==="string"?d:JSON.stringify(d),options:p,callback:(b,g)=>b?m(b):h(g)}))},Vi},wa=(e)=>{let[t,r]=th(),n=new Uint8Array,{readFromStdout:s,afterClose:i,service:o}=Xm({writeToStdin(l){if(n.length!==0)throw Error("Must run at most one command");n=l},isSync:!0,hasFS:!0,esbuild:Ui});e(o);let a=eh.execFileSync(t,r.concat("--service=0.28.2"),{cwd:ds,windowsHide:!0,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),i(null)},rh=()=>Fc.join(cR.tmpdir(),`esbuild-${lR.randomBytes(32).toString("hex")}`),Rt=null,Sa=(e)=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:ds,esbuildVersion:"0.28.2"},transferList:[r],execArgv:[]}),s=0,i=(c)=>{let d=Error(`Build failed with 1 error:
|
|
71
|
+
error: ${c}`),p=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return d.errors=p,d.warnings=[],d},o=(c)=>{if(!c)return;let d=c.plugins;if(d&&d.length>0)throw i("Cannot use plugins in synchronous API calls")},a=(c,d)=>{for(let p in d)c[p]=d[p]},l=(c,d)=>{let p=s++,h=new SharedArrayBuffer(8),m=new Int32Array(h),b={sharedBuffer:h,id:p,command:c,args:d};n.postMessage(b);let g=Atomics.wait(m,0,0);if(g!=="ok"&&g!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+g);let{message:{id:y,resolve:v,reject:j,properties:S}}=e.receiveMessageOnPort(t);if(p!==y)throw Error(`Internal error: Expected id ${p} but got id ${y}`);if(j)throw a(j,S),j;return v};return n.unref(),{buildSync(c){return o(c),l("build",[c])},transformSync(c,d){return l("transform",[c,d])},formatMessagesSync(c,d){return l("formatMessages",[c,d])},analyzeMetafileSync(c,d){return l("analyzeMetafile",[c,d])},stop(){n.terminate(),Rt=null}}},_R=()=>{let e=kt.workerData.workerPort,t=kt.parentPort,r=(n)=>{let s={};if(n&&typeof n==="object")for(let i in n)s[i]=n[i];return s};try{let n=ps();ds=kt.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:i,id:o,command:a,args:l}=s,c=new Int32Array(i);try{switch(a){case"build":e.postMessage({id:o,resolve:await n.build(l[0])});break;case"transform":e.postMessage({id:o,resolve:await n.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:o,resolve:await n.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:o,resolve:await n.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(d){e.postMessage({id:o,reject:d,properties:r(d)})}Atomics.add(c,0,1),Atomics.notify(c,0,1/0)})()})}catch(n){t.on("message",(s)=>{let{sharedBuffer:i,id:o}=s,a=new Int32Array(i);e.postMessage({id:o,reject:n,properties:r(n)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(zi)_R();var PR=Ui});import{createRequire as jR}from"node:module";import{join as kR}from"node:path";function Vc(e,t){return jR(kR(t,"package.json")).resolve(e)}function RR(e){return e==="node"||e==="bun"?"node":"browser"}async function Bc(e){let t=await Promise.resolve().then(() => Lt(Ea(),1)),{entry:r}=e,n={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:RR(e.target),plugins:e.plugins,write:!1};if(e.conditions)n.conditions=e.conditions;if(e.define)n.define=e.define;if("path"in r)n.entryPoints=[r.path];else n.stdin={contents:r.source,loader:"js",resolveDir:r.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...n,write:!1})).outputFiles[0].text}var sh=()=>{};var ih=".jx-entry-";import{rmSync as OR,writeFileSync as oh}from"node:fs";import{tmpdir as CR}from"node:os";import{basename as NR,join as TR,resolve as IR}from"node:path";function lh(e){return os(e)||e.startsWith("./")||e.startsWith("../")}function Wc(e,t,r){if(os(e))return Vc(e.slice(ua.length),r);return IR(t,e)}function ch(e,t){return Vc(e,t)}function MR(e){let{onFileLoaded:t,resolver:r}=e;if(r===void 0&&t===void 0)return[];return[{name:"jx-bundle-hooks",setup:(s)=>{if(r!==void 0)s.onResolve({filter:r.filter},(i)=>r.resolve(i));if(t!==void 0)s.onLoad({filter:/.*/},(i)=>{t(i.path)})}}]}function JR(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function LR(e){return e.minify??e.target==="browser"}function FR(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...DR};return t}function uh(e){return{...FR(e),external:e.external??[],minify:LR(e),plugins:MR(e),target:e.target}}async function dh(e,t){let r=await Bc({entry:{path:e.entryPath},...uh(t)});oh(e.outfile,r,"utf8")}function Uc(e){return e==="<stdin>"||NR(e).startsWith(ih)}async function fh(e,t,r){let n=[],s=TR(CR(),`jx-resolve-${process.pid}.js`);try{await ms(`export * from ${JSON.stringify(e)};
|
|
72
|
+
`,{outfile:s,resolveDir:t},{...r,minify:!1,onFileLoaded:(i)=>n.push(i)})}catch{return}finally{OR(s,{force:!0})}return n.find((i)=>!Uc(i))}async function ms(e,{resolveDir:t,outfile:r},n){let s=await Bc({entry:{resolveDir:t,source:e},...uh(n)});oh(r,s,"utf8")}async function ph(e,{projectRoot:t,outfile:r,adapter:n}){await ms(e,{outfile:r,resolveDir:t},JR(n))}var ah,DR;var zc=q(()=>{nr();sh();ah=["@vue/reactivity","lit-html"];DR={"process.env.NODE_ENV":'"production"'}});function HR(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function mh(e){let t=HR(e),r=t.slice(t.lastIndexOf("/")+1),n=r.lastIndexOf(".");if(n>0)t=t.slice(0,t.length-(r.length-n));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],i=!1,o=!1,a=t.replaceAll(qR,(l,c,d)=>{if(i=!0,c)return o=!0,s.push(c),"*";return s.push(d),`:${d}`});return{isCatchAll:o,isDynamic:i,params:s,urlPattern:a}}function hh(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var qR;var gh=q(()=>{qR=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function dr(e){if(!T(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Gi(e){let t=dr(e);if(t===null)return"ltr";let r=new Intl.Locale(t),n=r.script??r.maximize().script;return n!==void 0&&VR.has(n)?"rtl":"ltr"}function yh(e){let t=dr(e);if(t===null)return T(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Gc(e){let t=e.i18n,r=[];if(!F(t))return{errors:r,i18n:null};let n=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of n){let l=dr(a);if(l===null){r.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let i=dr(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&dr(t.defaultLocale)===null)r.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return r.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:r,i18n:null};if(!s.includes(i))s.unshift(i);let o=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:BR;return{errors:r,i18n:{defaultLocale:i,locales:s,routing:o}}}function Tr(e,t){if(t===null)return null;let r=e.split("/").find(Boolean);if(r===void 0)return t.defaultLocale;let n=dr(r);return n!==null&&t.locales.includes(n)?n:t.defaultLocale}var VR,_a="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",BR="prefix-except-default";var hs=q(()=>{ve();VR=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});function Vt(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function bh(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let r=e.slice(2,-1).trim();return WR.has(r.toLowerCase())?r:e.slice(1)}return null}function Ki(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Xi(e){return e.startsWith("@keyframes")}function xh(e,t){let r=[];for(let n of Yi(e))for(let s of Yi(t))r.push(UR(n,s));return r.join(", ")}function UR(e,t){let r=ja(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Kc(e){let t=[],r=null,n=0;for(let s=0;s<e.length;s+=1){let i=e[s];if(r){if(i==="\\")s+=1;else if(i===r)r=null;continue}if(i==="\\")s+=1;else if(i==='"'||i==="'")r=i;else if(i==="[")n+=1;else if(i==="]")n=Math.max(0,n-1);else if(i==="&"&&n===0)t.push(s)}return t}function ja(e,t){return Kc(e).length>0?zR(e,t):null}function zR(e,t){let r="",n=0;for(let s of Kc(e))r+=e.slice(n,s)+t,n=s+1;return r+e.slice(n)}function Yi(e){let t=[],r=0,n=null,s=0;for(let o=0;o<e.length;o+=1){let a=e[o];if(n){if(a==="\\")o+=1;else if(a===n)n=null;continue}if(a==='"'||a==="'")n=a;else if(a==="("||a==="[")r+=1;else if(a===")"||a==="]")r=Math.max(0,r-1);else if(a===","&&r===0)t.push(e.slice(s,o)),s=o+1}t.push(e.slice(s));let i=t.flatMap((o)=>{let a=o.trim();return a===""?[]:[a]});return i.length>0?i:[e]}function wr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Yc(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${vr}]))`,forced:`${e}:where([${vr}="${t}"])`};return{auto:`:where(:root:not([${vr}])) ${e}`,forced:`:where(:root[${vr}="${t}"]) ${e}`}}function Cn(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Xc(e){return e.startsWith("--")?e:Vt(e)}function Pa(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function $h(e,t,r){let n=r.map(([i,o])=>`${i}: ${o}`).join("; "),s=t===null?n:`${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function GR(e,t,r){let n=r.map(({selector:i,declarations:o})=>`${i} { ${o.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function KR(e){let t=Object.keys(e).filter((n)=>Xi(n));if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}function YR(e){let r=Kc(e).at(-1),n=r===void 0?e:e.slice(r+1);return n===""||n.startsWith(":")||n.startsWith(".")||n.startsWith("[")}function qs(e,t={}){let{scope:r=null,mediaQueries:n={},transposeValue:s=(y)=>y,transposeSelector:i=(y)=>y,resolveValue:o}=t,a=[],l=(y)=>y!==null&&typeof y==="object"&&!Array.isArray(y)&&!Ce(y),c=(y,v)=>{if(l(v))return[v];if(!Ki(y)||!Array.isArray(v)||v.length===0)return[];return v.every((j)=>l(j))?v:[]},d=(y,v,j,S)=>{if(v===void 0||v===null)return null;if(Ce(v))return j?o?.(y,v,S)??null:null;if(F(v))return null;let P=String(v);if(pe(P))return j?o?.(y,P,S)??null:null;return s(P)},p=(y,v,j=!0,S="self")=>{let P=[];for(let[E,O]of Object.entries(y)){if(c(E,O).length>0)continue;if(v&&(E.startsWith("@")||Cn(E)))continue;if(E.startsWith("$"))continue;let R=d(E,O,j,S);if(R!==null)P.push([Xc(E),R])}return P},h=(y,v,j,S,P)=>{if(j.length===0)return;let E=v;if(E!==null){let k=i(E);if(k===null)return;E=k}let O=$h(y,E,j),R={text:O,conditions:[...y],selector:E,declarations:j,target:S,key:Pa(O)};if(T(P)&&P!=="")R.description=P;a.push(R)},m=(y,v,j)=>{let S=y.slice(10).trim();if(S==="")return;let P=[];for(let[O,R]of Object.entries(v)){if(!l(R))continue;let k=p(R,!0,!1,"unscoped");if(k.length>0)P.push({declarations:k,selector:O.trim()})}if(P.length===0)return;let E=GR(j,S,P);a.push({blocks:P,conditions:[...j],declarations:[],key:Pa(E),selector:null,target:"unscoped",text:E})},b=(y,v,j,S,P)=>{if(y==="@--")return;if(Ki(y)){h([...S,y],null,p(v,!1,!0,"unscoped"),"unscoped",v.$description);return}if(Xi(y)){m(y,v,S);return}let E=bh(y,n),O=E===null?y:`@media ${E}`,R=E===null?null:wr(E);if(R!==null&&j!==null){let{auto:k,forced:I}=Yc(j,R);g(v,k,[...S,O],P),g(KR(v),I,S,P);return}g(v,j,[...S,O],P)};function g(y,v,j,S){h(j,v,p(y,!0,!0,S),S,y.$description);for(let[P,E]of Object.entries(y))for(let O of c(P,E))if(P.startsWith("@"))b(P,O,v,j,S);else if(v!==null)g(O,xh(v,P),j,YR(P)?S:"descendant")}return g(e,r,[],"self"),a}var WR,vr="data-color-scheme",ka="jx-color-scheme";var Zi=q(()=>{ve();WR=new Set(["all","print","screen","speech"])});function Sh(){return`the Intl helpers ${Qc.join(", ")}`}var Ir="en-US",Zc="UTC",vh,Qc,wh;var eu=q(()=>{vh=[{api:"Intl.NumberFormat",params:["value","locale","options"],path:"Intl/formatNumber",summary:"Format a number for a locale — grouping, decimals, currency, percent, units."},{api:"Intl.DateTimeFormat",params:["value","locale","options"],path:"Intl/formatDate",summary:"Format a date or timestamp for a locale. Pass `timeZone` in options."},{api:"Intl.RelativeTimeFormat",params:["value","unit","locale","options"],path:"Intl/formatRelativeTime",summary:'Format a relative time — `-3, "day"` becomes "3 days ago".'},{api:"Intl.ListFormat",params:["values","locale","options"],path:"Intl/formatList",summary:'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'},{api:"Intl.PluralRules",params:["value","locale","options"],path:"Intl/plural",summary:'Which plural category a number falls in ("one", "few", "other") — many languages have '+"more than two, so a ternary on `n === 1` is wrong outside English."},{api:"Intl.Collator",params:["a","b","locale","options"],path:"Intl/compare",summary:'Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts "Zebra" before "apple" and sorts every accented word into the wrong place.'},{api:"Intl.DisplayNames",params:["code","type","locale","options"],path:"Intl/displayName",summary:'The name of a language, region, script or currency in a locale — "de" as "German" or '+'"Deutsch", from CLDR rather than a hand-kept table.'},{api:"Intl.Segmenter",params:["value","granularity","locale"],path:"Intl/segment",summary:"Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, so it cuts an emoji with a skin-tone modifier in half."}],Qc=vh.map((e)=>e.path),wh=Object.fromEntries(vh.map((e)=>[e.path,e.params.indexOf("locale")]))});function XR(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function dt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function cn(e){if(e==="")return[];return e.split("/").map((t)=>XR(t))}function mt(e,t){let r=e;for(let n of cn(t))r=r?.[n];return r}function Pe(e,t){let r=e;for(let n of cn(t))r+=tu.test(n)?`.${n}`:`[${JSON.stringify(n)}]`;return r}function Eh(e,t){let r=e;for(let[n,s]of cn(t).entries()){let i=n===0?"":"?.";r+=tu.test(s)?`${n===0?".":i}${s}`:`${i}[${JSON.stringify(s)}]`}return r}function un(e){return tu.test(e)?e:JSON.stringify(e)}function _h(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var tu;var Hs=q(()=>{tu=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function ru(e){let t=e.$map;return F(t)?t:void 0}function Rh(e){return F(e)&&!Array.isArray(e)&&"operator"in e}function Qi(e){return F(e)&&!Array.isArray(e)&&"$ref"in e}function tA(e,t,r){let n=wh[e];if(n===void 0||n<0||t[n]!=null)return t;let s=mt(r.$page,"locale");if(!T(s)||s==="")return t;let i=[...t];return i[n]=s,i}function Nh(e){return e.startsWith("window#/")&&QR.has(e.slice(8))}function dn(e){return Ah.has(e)}function Ke(e,t){if(!e)return;let r=(e.depth??0)+1;if(r>rA)return;return{depth:r,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Fe(e,t,r,n,s){if(e===null||e===void 0)return e;if(Rh(e))return ir(e,t,r,n,s);if(Qi(e)){let i=Ra(e.$ref,t,r,n);return s?.report(s.path??[],i),i}if(Array.isArray(e))return Th(e,t,r,n,s);return s?.report(s.path??[],e),e}function Th(e,t,r,n,s){return e.map((i,o)=>Fe(i,t,r,n,Ke(s,o)))}function nA(e,t,r,n){let s=(i)=>{if(!e.slice(i.length).includes("/"))return t;return Ra(e.slice(0,e.lastIndexOf("/")),t,r,n)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?Ra(e.slice(0,e.lastIndexOf("/")),t,r,n):void 0;return}function Ra(e,t,r,n){if(e==="$reduce/acc")return n?.acc;if(e.startsWith("$reduce/"))return n?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),i=n?.args?.[s[0]];return s.length>1?mt(i,s.slice(1).join("/")):i}if(e.startsWith("event#/")){let s=e.slice(7);return mt(r,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=ru(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];return s.length>2?mt(o,s.slice(2).join("/")):o}if(e.startsWith("#/state/"))return mt(t,e.slice(8));if(e.startsWith("parent#/"))return mt(t,e.slice(8));if(e.startsWith("window#/"))return mt(globalThis.window,e.slice(8));if(e.startsWith("document#/"))return mt(globalThis.document,e.slice(10));return mt(t,e)??null}function sA(e,t,r,n){if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=ru(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];if(s.length>2){let l=s.slice(2),c=l.pop(),d=l.length>0?mt(o,l.join("/")):o;return{key:c,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:ru(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let o=cn(s),a=o.pop(),l=t;for(let c of o)l=l[c];return{key:a,obj:l}}return{key:e,obj:t}}function ir(e,t,r,n,s){let i=iA(e,t,r,n,s);return s?.report(s.path??[],i),i}function jh(e,t,r){switch(e){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;case"<":return t<r;case"<=":return t<=r;case">":return t>r;default:return t>=r}}function iA(e,t,r,n,s){let{operator:i,target:o,value:a,initial:l}=e;if(!ZR.has(i))throw Error(`$expression: unknown operator "${i}"`);if(nu.has(i)&&!("value"in e)){let c=Fe(o,t,r,n,Ke(s,"target"));if(i==="!")return!c;if(i==="-")return-c}if(i==="call"){let c=Qi(o)?o.$ref:void 0;if(!T(c))throw TypeError("$expression: call target must be a $ref pointer");let d=(n?.callDepth??0)+1;if(d>Ph)throw Error(`$expression: call depth exceeded (${Ph})`);let p=Array.isArray(a)?a.map((m,b)=>Fe(m,t,r,n,Ke(s,["value",b]))):[];if(c.startsWith("window#/")){if(!Nh(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),b=eA.get(m);if(b)return b(...tA(m,p,t));let g=mt(globalThis.window,m),y=m.lastIndexOf("/"),v=y===-1?globalThis.window:mt(globalThis.window,m.slice(0,y));return g.apply(v,p)}let h=Ra(c,t,r,n);if(vt(h))return h.apply(nA(c,t,r,n),p);if(F(h)&&"$expression"in h){let m=h,b={};for(let[g,y]of(m.parameters??[]).entries()){let v=T(y)?y:y?.name??"";if(!v)continue;b[v]=p[g]===void 0&&F(y)&&"default"in y?y.default:p[g]}return ir(m.$expression,t,r,{args:b,callDepth:d})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(ou.has(i)){if(i==="?:"){let m=Fe(o,t,r,n,Ke(s,"target"));if(s){let b=Fe(a,t,r,n,Ke(s,"value")),g=Fe(l,t,r,n,Ke(s,"initial"));return m?b:g}return m?Fe(a,t,r,n):Fe(l,t,r,n)}let c=Fe(o,t,r,n,Ke(s,"target")),d=String(c),p=e.cases??{},h=Object.hasOwn(p,d);if(s){let m;for(let[g,y]of Object.entries(p)){let v=Fe(y,t,r,n,Ke(s,["cases",g]));if(g===d)m=v}let b=Fe(e.default,t,r,n,Ke(s,"default"));return h?m:b}return h?Fe(p[d],t,r,n):Fe(e.default,t,r,n)}if(su.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=Fe(a,t,r,n,Ke(s,"value"));switch(i){case"===":return c===d;case"!==":return c!==d;case"&&":return c&&d;case"||":return c||d;case"??":return c??d;default:return jh(i,c,d)}}if(Oh.has(i)){let c=Fe(a,t,r,n,Ke(s,"value")),{obj:d,key:p}=sA(o.$ref,t,r,n);d[p]=i==="="?c:jh(i.slice(0,-1),d[p],c);return}if(Ch.has(i)){let c=Fe(o,t,r,n,Ke(s,"target"));switch(i){case"push":return c.push(Fe(a,t,r,n,Ke(s,"value")));case"unshift":return c.unshift(Fe(a,t,r,n,Ke(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let d=Fe(a,t,r,n,Ke(s,"value"));return c.splice(...d)}default:break}}if(au.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=a===void 0?[]:Array.isArray(a)?Th(a,t,r,n,Ke(s,"value")):[Fe(a,t,r,n,Ke(s,"value"))],p=mt(c,i);if(!vt(p))return;return p.apply(c,d)}if(iu.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=a;if(i==="reduce"){let p=Fe(l,t,r,n,Ke(s,"initial"));for(let[h,m]of c.entries())p=ir(d,t,r,{acc:p,index:h,item:m},h===0?Ke(s,"value"):void 0);return p}if(i==="map")return c.map((p,h)=>ir(d,t,r,{...n,index:h,item:p},h===0?Ke(s,"value"):void 0));if(i==="filter")return c.filter((p,h)=>ir(d,t,r,{...n,index:h,item:p},h===0?Ke(s,"value"):void 0))}return}function Ze(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Rh(e))return At(e,t);if(Qi(e))return lu(e.$ref,t);if(Array.isArray(e))return e.map((r)=>Ze(r,t)).join(", ");return JSON.stringify(e)}function oA(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function lu(e,t){let r=t.statePrefix??"state",n=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Pe("_args",e.slice(6));if(e.startsWith("event#/"))return Pe(n,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s;if(i==="item")return s.length>2?Pe("_item",s.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(e.startsWith("#/state/"))return Pe(r,e.slice(8));if(e.startsWith("parent#/"))return Pe(r,e.slice(8));if(e.startsWith("window#/"))return Pe("window",e.slice(8));if(e.startsWith("document#/"))return Pe("document",e.slice(10));return Pe(r,e)}function kh(e,t){if(Qi(e))return lu(e.$ref,t);return Ze(e,t)}function aA(e,t,r){let n=(o)=>t[o]??"undefined",s=`(${r.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Ir)})`,i=JSON.stringify(Zc);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${n(1)} ?? ${s}, {timeZone: ${i}, ...${n(2)}}).format(new Date(${n(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${n(2)} ?? ${s}, ${n(3)}).format(${n(0)}, ${n(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/plural":return`new Intl.PluralRules(${n(1)} ?? ${s}, ${n(2)}).select(${n(0)})`;case"Intl/compare":return`new Intl.Collator(${n(2)} ?? ${s}, ${n(3)}).compare(${n(0)}, ${n(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${n(2)} ?? ${s}, {...${n(3)}, type: ${n(1)} ?? 'language'}).of(${n(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${n(2)} ?? ${s}, {granularity: ${n(1)} ?? 'grapheme'}).segment(${n(0)})].map((p) => p.segment)`;default:return null}}function At(e,t={}){let{operator:r,target:n,value:s,initial:i}=e;if(nu.has(r)&&!("value"in e)){let o=Ze(n,t);if(r==="!")return`!(${o})`;if(r==="-")return`-(${o})`}if(r==="call"){let o=(Qi(n)?n.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>Ze(l,t)):[];if(o.startsWith("window#/")){if(!Nh(o))throw Error(`$expression: "${o}" is not a blessed pure global`);let l=aA(o.slice(8),a,t);if(l)return l;return`window.${o.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(o.startsWith("#/state/")){let l=o.slice(8),c=t.formulaParams?.[l];if(c){let d=c.map((p,h)=>`${JSON.stringify(p)}: ${a[h]??"undefined"}`).join(", ");return`${oA(l)}(${t.statePrefix??"state"}, { ${d} })`}}return`${lu(o,t)}(${a.join(", ")})`}if(ou.has(r)){if(r==="?:"){let c=Ze(n,t),d=Ze(s,t),p=Ze(i,t);return`(${c} ? ${d} : ${p})`}let o=Ze(n,t),a=Object.entries(e.cases??{}).map(([c,d])=>`_d === ${JSON.stringify(c)} ? ${Ze(d,t)} : `).join(""),l="default"in e?Ze(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${o}))`}if(su.has(r)){let o=Ze(n,t),a=Ze(s,t);return`(${o} ${r} ${a})`}if(Oh.has(r)){let o=kh(n,t),a=Ze(s,t);return`${o} ${r} ${a}`}if(Ch.has(r)){let o=kh(n,t);switch(r){case"push":return`${o}.push(${Ze(s,t)})`;case"unshift":return`${o}.unshift(${Ze(s,t)})`;case"pop":return`${o}.pop()`;case"shift":return`${o}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>Ze(l,t)).join(", "):Ze(s,t);return`${o}.splice(${a})`}default:break}}if(au.has(r)){let o=Ze(n,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>Ze(l,t)).join(", "):Ze(s,t);return`(${o})?.${r}?.(${a})`}if(iu.has(r)){let o=Ze(n,t),a=At(s,t);if(r==="reduce"){let l=Ze(i,t);return`${o}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(r==="map")return`${o}.map((_item, _index) => ${a})`;if(r==="filter")return`${o}.filter((_item, _index) => ${a})`}return"undefined"}function Vs(e,t,r,n){return Fe(e,t,r,n)}function fn(e,t={}){return Ze(e,t)}var Ah,nu,su,Oh,Ch,iu,ou,au,ZR,QR,eA,Ph=64,rA=64;var eo=q(()=>{eu();ve();Hs();Ah=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),nu=new Set(["!","-"]),su=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Oh=new Set(["=","+=","-=","*=","/="]),Ch=new Set(["push","pop","shift","unshift","splice"]),iu=new Set(["reduce","map","filter"]),ou=new Set(["?:","switch"]),au=new Set(["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]),ZR=new Set([...Ah,...nu,...su,...iu,...ou,...au,"call"]),QR=new Set(["isNaN","isFinite","parseFloat","parseInt","encodeURIComponent","decodeURIComponent","structuredClone","Math/abs","Math/ceil","Math/floor","Math/round","Math/trunc","Math/sign","Math/sqrt","Math/cbrt","Math/pow","Math/exp","Math/log","Math/log2","Math/log10","Math/min","Math/max","Math/hypot","Number/isInteger","Number/isFinite","Number/isNaN","Number/parseFloat","Number/parseInt","JSON/parse","JSON/stringify","Object/keys","Object/values","Object/entries","Object/fromEntries","Array/from","Array/isArray","Array/of","String/fromCharCode","String/fromCodePoint",...Qc]),eA=new Map([["Intl/compare",(e,t,r,n)=>new Intl.Collator(r??Ir,n).compare(e,t)],["Intl/displayName",(e,t,r,n)=>new Intl.DisplayNames(r??Ir,{...n,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,r)=>new Intl.DateTimeFormat(t??Ir,{timeZone:Zc,...r}).format(new Date(e))],["Intl/formatList",(e,t,r)=>new Intl.ListFormat(t??Ir,r).format(e)],["Intl/formatNumber",(e,t,r)=>new Intl.NumberFormat(t??Ir,r).format(e)],["Intl/formatRelativeTime",(e,t,r,n)=>new Intl.RelativeTimeFormat(r??Ir,n).format(e,t)],["Intl/plural",(e,t,r)=>new Intl.PluralRules(t??Ir,r).select(e)],["Intl/segment",(e,t,r)=>[...new Intl.Segmenter(r??Ir,{granularity:t??"grapheme"}).segment(e)].map((n)=>n.segment)]])});function Ih(e){if("operator"in e)return{kind:"expression",node:e};if("if"in e)return{kind:"if",node:e};if("$switch"in e)return{kind:"switch",node:e};if("stopPropagation"in e)return{kind:"stopPropagation"};if("preventDefault"in e)return{kind:"preventDefault"};return{kind:"dispatch",node:e}}function lA(e){return(F(e)||vt(e))&&"then"in e&&vt(e.then)}async function Bs(e,t,r,n={}){let s=n.args?{args:n.args}:void 0;for(let i of e){let o=Ih(i);switch(o.kind){case"expression":{let a=ir(o.node,t,r,s);if(lA(a))await a;break}case"if":{let a=o.node,l=Vs(a.if,t,r,s)?a.then:a.else;if(Array.isArray(l))await Bs(l,t,r,n);break}case"switch":{let a=o.node,l=String(Vs(a.$switch,t,r,s)),c=a.cases??{},d=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(d))await Bs(d,t,r,n);break}case"dispatch":{let a=o.node,l=vt(n.target)?n.target():n.target,c=r?.currentTarget??l;if(!c)break;let d={};if("detail"in a)d.detail=Vs(a.detail,t,r,s);if(a.bubbles!==void 0)d.bubbles=a.bubbles;if(a.composed!==void 0)d.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,d));break}case"stopPropagation":{r?.stopPropagation();break}case"preventDefault":{r?.preventDefault();break}default:break}}}function fr(e,t={}){let r=t.indent??"",n=[];for(let s of e){let i=Ih(s);switch(i.kind){case"expression":{n.push(`${r}${At(i.node,t)};`);break}case"if":{let o=i.node,a=fn(o.if,t),l={...t,indent:`${r} `};if(n.push(`${r}if (${a}) {`,fr(o.then??[],l)),o.else)n.push(`${r}} else {`,fr(o.else,l));n.push(`${r}}`);break}case"switch":{let o=i.node,a=fn(o.$switch,t),l={...t,indent:`${r} `};n.push(`${r}switch (String(${a})) {`);for(let[c,d]of Object.entries(o.cases??{}))n.push(`${r} case ${JSON.stringify(c)}: {`,fr(d,l),`${r} break;`,`${r} }`);if(o.default)n.push(`${r} default: {`,fr(o.default,l),`${r} }`);n.push(`${r}}`);break}case"dispatch":{let o=i.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in o)c.push(`detail: ${fn(o.detail,t)}`);if(o.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(o.bubbles)}`);if(o.composed!==void 0)c.push(`composed: ${JSON.stringify(o.composed)}`);let d=c.length>0?`, { ${c.join(", ")} }`:"";n.push(`${r}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(o.dispatchEvent)}${d}));`);break}case"stopPropagation":{n.push(`${r}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{n.push(`${r}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return n.join(`
|
|
73
|
+
`)}var Aa=q(()=>{ve();eo()});function Ws(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let t=0;for(let r=1;r<e.length;r+=1){let n=e[r];if(n==="{")t+=1;else if(n==="}"){if(t-=1,t===0)return r===e.length-1}}return!1}function Jh(){return[...Mh].toSorted()}function gs(e,t){let r=e.toLowerCase();if(r.startsWith("aria-")||Mh.has(r))return String(t);return t?"":null}var pn,Mh,cu=32,Oa,Ca="jx-slot",to="data-jx-slots",uu="jx.slot.group",e8;var Us=q(()=>{Zi();eo();Hs();ve();nr();Aa();Zi();pn=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Mh=new Set(["contenteditable","draggable","spellcheck"]);Oa=/^[\t\n\f\r ]+$/u,e8=(()=>{let e=Symbol.for(uu),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function Dh(e,t,r,n,s=uA){let i=[],o=(p,h)=>{let m={mediaQueries:t,scope:h,transposeValue:r};if(n)m.resolveValue=(b,g)=>n(b,g,h);for(let b of qs(p,m))i.push(b.text)},a={},l={},c=[],d=[];for(let[p,h]of Object.entries(e)){if(F(h)&&!Array.isArray(h)){if(p.startsWith("@"))c.push([p,h]);else if(!p.startsWith("--"))d.push([p,h]);continue}if(Cn(p)||p.startsWith("@"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")a[p]=h;else l[p]=h}o(a,s.root),o(l,s.body);for(let[p,h]of d)if(p.startsWith("&"))o({[p]:h},s.root);else o(h,p);for(let[p,h]of c){if(Ki(p)||Xi(p)){o({[p]:h},null);continue}let m={},b={},g=[];for(let[y,v]of Object.entries(h)){if(F(v)&&!Array.isArray(v)){if(!y.startsWith("@"))g.push([y,v]);continue}if(y.startsWith("--"))m[y]=v;else b[y]=v}o({[p]:m},s.root),o({[p]:b},s.body);for(let[y,v]of g)o({[p]:v},y)}if(Object.values(t).some((p)=>wr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${vr}="light"]) { color-scheme: light }`,`${s.root}:where([${vr}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
74
|
+
`)}var uA;var Lh=q(()=>{Zi();ve();uA={body:"body",root:":root"}});function Fh(e){return e===!1||e==="open"||e==="closed"}function ys(e,t){let r=e?.$shadow;if(Fh(r))return r===!1?null:r;let n=t?.shadow;return Fh(n)&&n!==!1?n:null}function qh(e,t){return t===null?e:":host"}function no(e,t){let r=[];for(let[n,s]of(e.parameters??[]).entries()){let i=Hh(s);if(!i)continue;let o=Vh(s)?`_a[${n}] === undefined ? ${JSON.stringify(s.default)} : _a[${n}]`:`_a[${n}]`;r.push(`${JSON.stringify(i)}: ${o}`)}return`(..._a) => { const _args = { ${r.join(", ")} }; return ${t}; }`}function Hh(e){return T(e)?e:e?.name??""}function Vh(e){return F(e)&&"default"in e}function Ia(e,t){let r=hu(e,t);return r===e?e:`${r} as ${e}`}function hu(e,t){let r=t?.$export;return T(r)&&r!==""?r:e}function Ma(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i}=r,{url:o}=t,a=pe(o),l=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let c=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":o}`,i?`${i}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${fA(o,n)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(o)};`);let d=[];if(l!=="GET")d.push(`method: ${JSON.stringify(l)}`);if(t.headers)d.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let h=F(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);d.push(`body: ${h}`)}let p=d.length>0?`, { ${d.join(", ")} }`:"";return c.push(` fetch(url${p})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${n}.${e} = d; })`,` .catch(e => { ${n}.${e} = { error: String(e) }; });`,i?"}));":"});"),c.map((h)=>`${s}${h}`).join(`
|
|
75
|
+
`)}function Ja(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i,serverBaseUrl:o="/_jx/server"}=r,a=JSON.stringify(`${o}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([g,y])=>{if(!Ce(y))return`${un(g)}: ${JSON.stringify(y)}`;if(dA.some((v)=>y.$ref.startsWith(v)))throw Error(`Server function "${e}": argument "${g}" references "${y.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${un(g)}: ${fn({$ref:y.$ref},{statePrefix:n})}`}),d=l.some(([,g])=>Ce(g)),p=`${Yh}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,h=Pe(n,dt(e)),m=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(d?[`// ${e}: server function ${t.$export}, called again when an argument changes`,"{"," let _jxSeq = 0;",i?` ${i}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${p}`,` .then((d) => { if (_seq === _jxSeq) ${h} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,i?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,p,` .then((d) => { ${h} = d; })`,` .catch((e) => { ${m}; });`]).map((g)=>`${s}${g}`).join(`
|
|
76
|
+
`)}function fA(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(r,n)=>`\${${n.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Da(e){if(!F(e))return!1;if(e.state)for(let[t,r]of Object.entries(e.state)){if(t==="$site"||t==="$page")continue;if(!F(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(r.$prototype)return!0;if("default"in r)return!0;if(Pn(r))continue;return!0}if(e.$switch)return!0;if(Qe(e)||_c(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>Da(t)))return!0;for(let[t,r]of Object.entries(e)){if(pn.has(t))continue;if(Ce(r))return!0;if(pe(r))return!0}if(F(e.style)){for(let t of Object.values(e.style))if(pe(t))return!0}if(F(e.attributes)){for(let t of Object.values(e.attributes))if(pe(t))return!0}return!1}function Wh(e){if(!F(e))return!1;if(e.$switch)return!0;if(Qe(e)||_c(e.children))return!0;for(let[t,r]of Object.entries(e)){if(pn.has(t))continue;if(Ce(r))return!0;if(pe(r))return!0}if(F(e.style)){for(let t of Object.values(e.style))if(pe(t))return!0}if(F(e.attributes)){for(let t of Object.values(e.attributes))if(pe(t))return!0}return!1}function Xs(e,t=null,r={},n={}){let s=e?.state?zs(e.state,t):t??Uh();return{media:n,scope:s,scopeDefs:r}}function Uh(e=null){return Object.create(e)}function zh(e){return e[Bh]}function pu(e,t){if(T(e)){for(let i of e.matchAll(pA))t.add(i[1]);for(let i of e.matchAll(mA))t.add(i[1]);return}if(Array.isArray(e)){for(let i of e)pu(i,t);return}if(!F(e))return;let r=e,{operator:n,target:s}=r;if(T(n)&&dn(n)&&Ce(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let i of Object.values(r))pu(i,t)}function zs(e={},t=null){let r=Uh(t),n=t?zh(t):void 0,s=new Set(n);Object.defineProperty(r,Bh,{configurable:!0,enumerable:!1,value:s,writable:!0});let i=new Set;for(let c of Object.values(e))if(er(c)||tr(c))pu(c.body??c.$expression,i);for(let c of i)if(c in e)s.add(c);for(let[c,d]of Object.entries(e)){if(!F(d)||Array.isArray(d)){mn(r,c,Na(d));continue}if("default"in d){mn(r,c,Na(d.default));continue}if(tn(d)){s.add(c);continue}if(!d.$prototype&&!("$expression"in d)&&!Pn(d))mn(r,c,Na(d))}let o=[],a=[];for(let[c,d]of Object.entries(e)){if(pe(d)){o.push([c,d]);continue}if(!F(d))continue;if(tr(d)){let p=d.$expression;if(ns(d)){let h=d.parameters;mn(r,c,(...m)=>{let b={};for(let[g,y]of h.entries()){let v=Hh(y);if(!v)continue;b[v]=m[g]===void 0&&Vh(y)?y.default:m[g]}return ir(p,r,null,{args:b})})}else if(dn(p.operator))mn(r,c,(h,m)=>ir(p,h,m));else du(r,c,()=>ir(p,r,null));continue}if(er(d)){if(_n(d)){let{body:p}=d;mn(r,c,(h,m)=>{Bs(p,h??r,m??null)})}else if(T(d.body)){let p=d.parameters?rn(d.parameters):d.arguments??[],{body:h}=d,m=p.includes("state")?p:["state",...p],b=Function(...m,h),g=(y,v)=>b(...m.map((j)=>j==="state"?y:v));if(ss(h))du(r,c,()=>g(r)),a.push([c,h]);else mn(r,c,g)}else mn(r,c,()=>{}),s.add(c);continue}if(Cr(d)&&(d.$prototype==="LocalStorage"||d.$prototype==="SessionStorage")){mn(r,c,Na(d.default??null));continue}if(Cr(d)&&d.$prototype==="Request")s.add(c)}let l=!0;while(l){l=!1;for(let[c,d]of[...a,...o])if(!s.has(c)&&Gh(d,r))s.add(c),l=!0}for(let[c,d]of o)du(r,c,()=>wt(d,r));return r}function mn(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function du(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:r})}function Me(e,t){if(Ce(e))return gu(e.$ref,t);if(pe(e))return wt(e,t);return e}function Bt(e){return Ce(e)}function gu(e,t){if(!T(e))return e;if(e.startsWith("$map/")){let r=e.split("/"),n=r[1],i=t.$map?.[n]??t[`$map/${n}`];return r.length>2?fu(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return fu(t,e.slice(8));return fu(t,e)??null}function Gh(e,t){if(!t)return!1;let r=zh(t);for(let n of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(n[2])continue;let s=n[1];if(r?.has(s))return!0;let i;try{i=t[s]}catch{continue}if(vt(i))return!0}return!1}function La(e){return Ws(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function wt(e,t){if(Gh(e,t))return null;let r=["state","$map","$site","$page"],n=[t,t?.$map,t?.$site,t?.$page];try{let s=Ws(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...r,s)(...n)}catch{return null}}function fu(e,t){return mt(e,t)}function Na(e){if(!F(e))return e;return structuredClone(e)}function hA(e,t){if(!e||!t)return"";return Object.entries(e).filter(([r,n])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&pe(n)).map(([r,n])=>{let s=Me(n,t);return s==null?null:`${Vt(r)}: ${s}`}).filter(Boolean).join("; ")}function bs(e,t,r=""){let n="",s=Me(e.id,t),i=Me(e.className,t),o=Me(e.hidden,t),a=Me(e.tabIndex,t),l=Me(e.title,t),c=Me(e.lang,t),d=Me(e.dir,t);if(s)n+=` id="${$e(String(s))}"`;if(i)n+=` class="${$e(String(i))}"`;if(o)n+=" hidden";if(a!==void 0&&a!==null)n+=` tabindex="${$e(String(a))}"`;if(l)n+=` title="${$e(String(l))}"`;if(c)n+=` lang="${$e(String(c))}"`;if(d)n+=` dir="${$e(String(d))}"`;let p=[hA(e.style,t),r].filter(Boolean).join("; ");if(p)n+=` style="${$e(p)}"`;if(e.attributes)for(let[h,m]of Object.entries(e.attributes)){let b=Me(m,t);if($t(b)){let g=gs(h,b);if(g!==null)n+=g===""?` ${h}`:` ${h}="${$e(g)}"`;continue}if(T(b)||lr(b))n+=` ${h}="${$e(String(b))}"`}if(e.$static)n+=" data-jx-static";else if(e.$prerendered)n+=" data-jx-prerendered";return n}function so(e,t=" "){return e?"":`
|
|
77
|
+
${t}`}function Zs(){let e=JSON.stringify(ka),t=JSON.stringify(vr);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Ta(e,t,r,n){for(let s of qs(t,{mediaQueries:n,resolveValue:(i,o)=>Kh(i,o,r),scope:r}))e.push(s.text)}function Kh(e,t,r){let n=T(t)?t:t.$ref;return gA.push({property:e,selector:r,source:n}),null}function Fa(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Jh())});
|
|
80
78
|
function ${Qs}(n, v) {
|
|
81
79
|
if (typeof v !== 'boolean') return v;
|
|
82
80
|
const l = n.toLowerCase();
|
|
83
81
|
if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
|
|
84
82
|
return v ? '' : null;
|
|
85
|
-
}`}function
|
|
86
|
-
`)}function
|
|
87
|
-
`)}function
|
|
88
|
-
${
|
|
83
|
+
}`}function qa(){return[`async function ${Yh}(url, args) {`," const r = await fetch(url, {"," method: 'POST',"," headers: { 'Content-Type': 'application/json' },"," body: JSON.stringify(args),"," });"," const text = await r.text();"," let body = null;"," if (text !== '') {"," try { body = JSON.parse(text); } catch (e) { if (r.ok) throw e; }"," }"," if (!r.ok) throw new Error((body && body.error) || text || r.statusText);"," return body;","}"].join(`
|
|
84
|
+
`)}function Xh(){let e=`new RegExp(${JSON.stringify(Oa.source)}, ${JSON.stringify(Oa.flags)})`,t=`Symbol.for(${JSON.stringify(uu)})`,r=JSON.stringify(to),n=JSON.stringify(Ca);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${yu}(host) {`,` const id = host.getAttribute(${r});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${r});`,` const open = ${n} + ' ' + id + ' ';`,` const close = '/' + ${n} + ' ' + id;`," const openers = [];"," const w = host.ownerDocument.createTreeWalker(host, 128);"," for (let n = w.nextNode(); n; n = w.nextNode()) if (n.data.startsWith(open)) openers.push(n);"," const out = [];"," for (const o of openers) {"," const name = decodeURIComponent(o.data.slice(open.length));"," for (let n = o.nextSibling; n; n = n.nextSibling) {"," if (n.nodeType === 8 && n.data === close) break;"," __jxSlotRec.set(n, name);"," out.push(n);"," }"," }"," return out;","}",`function ${bu}(host, captured) {`," const slots = Array.from(host.querySelectorAll('slot'));"," if (slots.length === 0) return;"," const groups = new Map();"," for (const n of captured) {"," if (n.nodeType === 3 && __jxSlotWs.test(n.data)) continue;"," const r = __jxSlotRec.get(n);"," __jxSlotRec.delete(n);"," const name = r !== undefined ? r : n.nodeType === 1 ? n.getAttribute('slot') || '' : '';"," let g = groups.get(name);"," if (!g) { g = []; groups.set(name, g); }"," g.push(n);"," }"," const taken = new Set();"," for (const slot of slots) {"," const name = slot.getAttribute('name') || '';"," let g = [];"," if (!taken.has(name)) { taken.add(name); g = groups.get(name) || []; }"," const content = g.some((n) => n.nodeType === 1 || (n.nodeType === 3 && n.data !== ''));"," const placed = content ? g : g.concat(Array.from(slot.childNodes));"," const p = slot.parentElement;"," if (p && p !== host && p.localName.includes('-')) {"," const r = __jxSlotRec.get(slot);"," const f = r !== undefined ? r : slot.getAttribute('slot') || '';"," for (const n of placed) __jxSlotRec.set(n, f);"," }"," slot.replaceWith(...placed);"," }","}"].join(`
|
|
85
|
+
`)}function Nn(e){for(let t of xu(e)){if(Qe(t)){if(t.map&&Nn([t.map]))return!0;continue}if(!Ft(t))continue;if(t.tagName==="slot")return!0;let r=Object.values(t.cases??{}).filter((n)=>Ft(n)&&!Bt(n));if(Nn(r)||Nn(t.children))return!0}return!1}function xu(e){if(Qe(e))return[e];if(!Array.isArray(e))return[];return e}function ti(e,t={},r=null){let n=[],s=Dh(F(r)?r:{},t,(o)=>o,Kh);if(s!=="")n.push(s);if(Tn(e,n,t,"",{n:0}),n.length===0)return"";return`<style>
|
|
86
|
+
${Ha(n.join(`
|
|
89
87
|
`))}
|
|
90
|
-
</style>`}function
|
|
91
|
-
${l}`,c.content||=a;else s.set(o,{content:a,html:l})}return{groups:s,id:n,taken:new Set}}function
|
|
92
|
-
`);return""}function Gs(e,t,r=null,n=null){if(
|
|
93
|
-
`);if(!F(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",l=bs(e,t),c=Me(e.$switch,t),d=c==null?void 0:e.cases?.[String(c)],p=d!==void 0&&!
|
|
94
|
-
${p}`}let i=n?.componentDefs.get(s);if(i&&n)return
|
|
95
|
-
`):"";P=`<template shadowrootmode="${v}"><link rel="stylesheet" href="/components/${i}.css">${
|
|
88
|
+
</style>`}function Ha(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Tn(e,t,r,n="",s,i="jx"){let o=s??{n:0};if(!F(e))return;if(e.style&&!e.id&&!e.className)e.className=`${i}-${o.n}`,o.n+=1;let a=Ms(e.tagName).join(", ")||"*",l=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:a;if(e.style)Ta(t,e.style,l,r);if(Array.isArray(e.children))for(let c of e.children)Tn(c,t,r,l,o,i);if(F(e.cases))for(let c of Object.values(e.cases))Tn(c,t,r,l,o,i)}function $e(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Va(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Zh(e){let t=[];return Qh(e,t),t}function Qh(e,t){if(!F(e))return;if(e.state){for(let[r,n]of Object.entries(e.state))if(tn(n))t.push({exportName:n.$export,key:r,src:n.$src})}if(Array.isArray(e.children))for(let r of e.children)Qh(r,t)}function vu(e,t){if(T(e))return e;let r=Ms(e);if(r.length===0)return"div";if(!Nr(e))return r[0];let n=e.$expression,s=n.target;if(n.operator==="?:")return Me(s,t)?n.value:n.initial;let i=Me(s,t);return n.cases[String(i)]??n.default}function wu(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Su(e,t,r,n=null){let s=new Map;for(let i of xu(e)){let o="",a=!0,l;if(T(i)||lr(i)||$t(i)){if(l=r(i),Oa.test(l))continue;a=l!==""}else if(Qe(i))l="";else if(!Ft(i))l=r(i),a=l!=="";else{let d=Me(i.attributes?.slot,t),p=T(i.slot)?Me(i.slot,t):null;if(T(d)&&d!=="")o=d,l=r(i);else if(T(p)&&p!==""){o=p;let{slot:h,...m}=i;l=r({...m,attributes:{...m.attributes,slot:p}})}else l=r(i)}let c=s.get(o);if(c)c.html=c.html===""?l:`${c.html}
|
|
89
|
+
${l}`,c.content||=a;else s.set(o,{content:a,html:l})}return{groups:s,id:n,taken:new Set}}function eg(e,t,r){for(let n of xu(e)){if(Qe(n)||!Ft(n))continue;if(n.tagName==="slot"){let s=Me(n.attributes?.name,t);r.taken.add(T(s)?s:"")}eg(n.children,t,r)}}function Eu(e){let t=null,r={};for(let[n,s]of Object.entries(e??{}))if(n.startsWith("props.")&&n.length>6)t??={},t[n.slice(6)]=s;else r[n]=s;return{lifted:t,rest:r}}function Ba(e,t){if(!t)return zs(e.state??{},null);let r={...e.state};for(let[n,s]of Object.entries(t)){let i=r[n];r[n]=F(i)&&!Array.isArray(i)&&"default"in i?{...i,default:s}:s}return zs(r,null)}function _u(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([r,n])=>{if(!pe(n))return[];let s=Me(n,t);return s==null?[]:[[r,s]]}))}function ro(e,t,r,n){if(e.textContent!==void 0){let s=Me(e.textContent,t);return s!=null?$e(String(s)):""}if(e.innerHTML){let s=Me(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>Gs(s,t,r,n)).join(`
|
|
90
|
+
`);return""}function Gs(e,t,r=null,n=null){if(T(e)){if(pe(e)&&t){let a=wt(e,t);return a!=null?$e(String(a)):$e(e)}return $e(e)}if(lr(e)||$t(e))return $e(String(e));if(Array.isArray(e))return e.map((a)=>Gs(a,t,r,n)).join(`
|
|
91
|
+
`);if(!F(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",l=bs(e,t),c=Me(e.$switch,t),d=c==null?void 0:e.cases?.[String(c)],p=d!==void 0&&!Bt(d)?Gs(d,t,r,n):"";return`<${a}${l}>${p}</${a}>`}let s=vu(e.tagName,t);if(s==="slot"&&r){let a=Me(e.attributes?.name,t),l=T(a)?a:"",c;if(!r.taken.has(l))r.taken.add(l),c=r.groups.get(l);let d=c?.html??"";if(d!==""&&r.id!==null)d=`<!--${Ca} ${r.id} ${encodeURIComponent(l)}-->${d}<!--/${Ca} ${r.id}-->`;if(c?.content)return eg(e.children,t,r),d;let p=ro(e,t,r,n);return d===""?p:p===""?d:`${d}
|
|
92
|
+
${p}`}let i=n?.componentDefs.get(s);if(i&&n)return yA(e,i,t,r,n);let o=bs(e,t);if($u.has(s))return`<${s}${o}>`;return`<${s}${o}>${ro(e,t,r,n)}</${s}>`}function yA(e,t,r,n,s){let i=t.tagName,{lifted:o,rest:a}=Eu(e.attributes),l={...o,...e.$props},c={};for(let[k,I]of Object.entries(l))c[k]=Me(I,r)??I;let d=Object.keys(c).length>0,p=s.path??[],h={key:JSON.stringify(c),tag:i},m=[...p.map((k)=>k.tag),i].join(" → ");if(p.some((k)=>k.tag===h.tag&&k.key===h.key))throw Error(`Component <${i}> renders itself: ${m}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(p.length>=cu)throw Error(`Component nesting exceeds ${cu} levels: ${m}. A component that renders itself with changing props needs a case that stops.`);let b={...s,path:[...p,h]},{children:g}=e,y=(k)=>Gs(k,r,n,s),v=ys(t,s.defaults),j=Wa(t),S=Ba(t,d?c:null),P,E=null;if(v){let k=Array.isArray(g)?g.map((I)=>y(I)).join(`
|
|
93
|
+
`):"";P=`<template shadowrootmode="${v}"><link rel="stylesheet" href="/components/${i}.css">${ro(t,S,null,b)}</template>${k}`}else{E=!j&&Nn(t.children)?wu(s):null;let k=Su(g,r,y,E);P=ro(t,S,k,b)}let O=Object.entries(_u(t.style,S)).map(([k,I])=>`${Vt(k)}: ${I}`).join("; "),R={...e};if(delete R.$props,delete R.children,R.attributes=!j&&d?{...a,"data-jx-props":JSON.stringify(c)}:a,E!==null)R.attributes={...R.attributes,[to]:String(E)};if(j)R.$static=!0;else R.$prerendered=!0;return`<${i}${bs(R,r,O)}>${P}</${i}>`}function tg(e,t=null,r=null,n=null){return ro(e,Ba(e,t),r,n)}function Wa(e){return mu(e)}function mu(e){if(!F(e))return!0;if(Array.isArray(e))return e.every((t)=>mu(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!F(t)||Array.isArray(t))continue;if(t.$prototype)return!1;if(t.$ref)return!1}for(let t of Object.keys(e))if(t.startsWith("on")&&t!=="observedAttributes")return!1;if(Array.isArray(e.children))return e.children.every((t)=>mu(t));if(Qe(e.children))return!1;return!0}function xA(e,t){return Yi(e).map((r)=>$A(r,t)).join(", ")}function $A(e,t){let r=ja(e,t);if(r!==null)return r;if(e.startsWith(":host")){let n=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return n===void 0?t:`${t}${n}`}if(t===":host"&&bA.test(e))return e;return`${t}${e}`}function rg(e,t,r=null,n={},s=null){let i=[],o=qh(e,s);if(F(t)){let a={},l=[];for(let[c,d]of Object.entries(t))if(Ce(d))a[c]=d;else if(F(d)&&!Array.isArray(d))l.push([c,d]);else if(!c.startsWith("@")&&!Cn(c))a[c]=d;Ta(i,a,o,n);for(let[c,d]of l)if(c.startsWith("@"))Ta(i,{[c]:d},o,n);else if(Cn(c))Ta(i,d,xA(c,o),n)}if(r&&Array.isArray(r.children)){let a={n:0};for(let l of r.children)Tn(l,i,n,"",a,e)}return i.length>0?`${i.join(`
|
|
96
94
|
`)}
|
|
97
|
-
`:""}var
|
|
98
|
-
${e.slice(r)}`}function ag(e,t){return new URL(`/${gA(e,t).split(yA).join("/")}`,"http://localhost").pathname}var bA="/404";var Ru=q(()=>{Mr()});function lg(e,t){if(t===null||t.routing!=="prefix-always")return[];let r=[];for(let n of e){if(n.urlPattern==="/")continue;let s=n.urlPattern.split("/").find(Boolean),i=dr(s);if(i===null||!t.locales.includes(i))r.push(n.urlPattern)}return r}function cg(e,t){if(t===null)return null;let r=e.split("/").find(Boolean),n=dr(r);if(r===void 0||n===null||t.locales.includes(n))return null;let s=t.locales.find((i)=>i!==n&&i.split("-")[0]===n.split("-")[0]);return s===void 0?null:{meant:s,segment:r}}function $A(e,t){let r=e.split("/").filter(Boolean),n=dr(r[0]);if(t!==null&&n!==null&&t.locales.includes(n))return r.slice(1).join("/");return r.join("/")}function Au(e,t){let r=new Map,n=[];if(t===null)return{conflicts:n,sets:r};let s=new Map,i=new Set;for(let o of e){let a=o.translationKey===void 0?$A(o.urlPattern,t):o.translationKey.replaceAll(/^\/+|\/+$/g,"");if(o.translationKey!==void 0)i.add(o.urlPattern);let l=Nr(o.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],d=c.find((p)=>p.locale===l);if(d===void 0)c.push({locale:l,urlPattern:o.urlPattern});else n.push({declared:i.has(d.urlPattern)||o.translationKey!==void 0,key:a,locale:l,urlPatterns:[d.urlPattern,o.urlPattern]});s.set(a,c)}for(let o of s.values()){let a=o.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of o)r.set(l.urlPattern,a)}return{conflicts:n,sets:r}}function ug(e,t,r,n){let s=new Map;if(t===null||r==="")return s;let i=new Map;for(let[o,a]of Au(e,t).sets){if(a.length<2)continue;let l=i.get(a);if(l===void 0){l=a.map((d)=>({href:Rn(ri(d.urlPattern,n),r),hreflang:d.locale}));let c=a.find((d)=>d.locale===t.defaultLocale);if(c!==void 0)l.push({href:Rn(ri(c.urlPattern,n),r),hreflang:"x-default"});i.set(a,l)}s.set(o,l)}return s}function dg({pageLang:e,pageDir:t,routeLocale:r,defaults:n}){let s=e??r??n?.lang??"en",i=t??n?.dir;if(i!==void 0)return{dir:i,lang:s};return Yi(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var Ou=q(()=>{nr();ms();Ru();ms();ms()});import{readFileSync as Cu,readdirSync as vA}from"node:fs";import{extname as fg,join as wA,relative as SA,resolve as EA}from"node:path";async function xs(e,t){let r=Cu(e,"utf8");if(e.endsWith(".json"))return Pn(r,e);let n=fg(e).toLowerCase(),s=t?.byExtension(n,"parse");if(!s)throw Error(`No format class registered for "${n}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return await s.parseDocument(r)}async function pg(e,t){let r=new Map,n=new Map;for(let s of e){if(!n.has(s.sourcePath))n.set(s.sourcePath,await PA(s.sourcePath,t));let i=n.get(s.sourcePath);if(i!==null&&i!==void 0)r.set(s.urlPattern,_A(i,s._pathParams))}return r}function _A(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(r,n)=>t?.[n]??r)}async function PA(e,t){if(!Cu(e,"utf8").includes("$translationKey"))return null;let r;try{r=await xs(e,t)}catch{return null}return N(r.$translationKey)&&r.$translationKey!==""?r.$translationKey:null}async function mg(e,t){let r=[],n=new Set([".json",...t?.documentExtensions("page")??[]]);return await hg(e,e,r,n,t),r.sort(gh),r}async function hg(e,t,r,n,s){let i=vA(e,{withFileTypes:!0});for(let o of i){let a=wA(e,o.name);if(o.isDirectory()){if(o.name.startsWith("_"))continue;await hg(a,t,r,n,s);continue}let l=fg(o.name).toLowerCase();if(!n.has(l))continue;if(o.name.startsWith("_"))continue;let c=SA(t,a);r.push(await jA(c,a,s))}}async function jA(e,t,r){let{isCatchAll:n,isDynamic:s,params:i,urlPattern:o}=hh(e),a=null;try{let c=(await xs(t,r)).$layout;if(N(c))a=c}catch{}return{$layout:a,isCatchAll:n,isDynamic:s,params:i,relativePath:e,sourcePath:t,urlPattern:o}}function kA(e){let t=e[gg];if(!ee(t))return null;let{mtime:r}=t;return N(r)&&r!==""?r:null}function RA(e){if(e.includes("\x00"))return"has a NUL character";for(let t of e.split("/")){if(t==="."||t==="..")return'has a "." or ".." segment';if(t.includes("\\"))return"has a backslash"}return null}async function yg(e,t,r={},n,s,i){let o=[],a=e.flatMap((l)=>l.isDynamic?[l.urlPattern]:[]);for(let l of e){if(!l.isDynamic){o.push(l);continue}let c;try{c=await xs(l.sourcePath,n?.formats)}catch{o.push(l);continue}if(!c.$paths){console.warn(`Warning: dynamic route ${l.urlPattern} has no $paths — skipping`);continue}let d=await AA(c.$paths,t,r,n,s,Nr(l.urlPattern,i??null),l,a);for(let p of d){let h=l.urlPattern,m={};for(let[v,j]of Object.entries(p)){if(v===gg)continue;m[v]=String(j),h=h.replace(`:${v}`,m[v]),h=h.replace("*",m[v])}let b=RA(h);if(b!==null){console.warn(`Warning: $paths for ${l.urlPattern} produced "${h}", which ${b}; skipping it`);continue}let g=kA(p),y={...l,_pathParams:m,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:h};if(g!==null)y.sourceMtime=g;o.push(y)}}return o}async function AA(e,t,r,n,s,i,o,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=N(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&N(e.$ref)&&e.$ref){let l=e.$ref,c=EA(t,l),d;try{d=JSON.parse(Cu(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${Ee(m)}`),[]}if(!Array.isArray(d))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let p=N(e.param)?e.param:"id",h=N(e.field)?e.field:"id";return d.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[p]:(ee(m)?m[h]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=n?.byPathsDiscriminator(l);if(!c?.project)continue;let d={data:r[c.project.key],locale:i,projectConfig:s,root:t};if(o!==void 0)d.params=o.params,d.urlPattern=o.urlPattern;if(a!==void 0)d.patterns=a;return await c.call("resolvePaths",e,d)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var gg="_meta";var bg=q(()=>{ve();rr();yh();Ou()});import{createHash as OA}from"node:crypto";function xg(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function $s(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[2]??r?.[3]}function Tu(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function LA(e){return`'sha256-${OA("sha256").update(e,"utf8").digest("base64")}'`}function $g(e,t){for(let r of e.matchAll(TA)){let n=r[1]??"",s=$s(n,"src"),i=($s(n,"type")??"").trim().toLowerCase();if(s!==void 0){let o=Tu(s);if(o)t.scriptOrigins.add(o);continue}if(CA.has(i))t.scriptHashes.add(LA(r[2]??""))}for(let r of e.matchAll(NA)){let n=r[1]??"",s=($s(n,"rel")??"").toLowerCase(),i=$s(n,"href"),o=Tu(i);if(!o)continue;if(s.includes("stylesheet"))t.styleOrigins.add(o);if(DA.test(i??"")||($s(n,"as")??"")==="font")t.fontOrigins.add(o)}for(let[r,n]of[[IA,t.imgOrigins],[MA,t.imgOrigins],[JA,t.frameOrigins]])for(let s of e.matchAll(r)){let i=s[1]??"";for(let o of[$s(i,"src"),...FA($s(i,"srcset"))]){let a=Tu(o);if(a)n.add(a)}}}function FA(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function vg(e){let t=e?.csp;if(t===void 0||t===!1)return null;if(t===!0)return{};if(t==="report-only")return{mode:"report-only"};return t}function wg(e,t){let r=(o,a)=>[...o,...a].join(" "),n={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":"'self'","frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")n["report-to"]="csp-endpoint",n["report-uri"]=t.reportUri;for(let[o,a]of Object.entries(t.directives??{}))n[o]=a;let s=Object.entries(n).filter(([,o])=>o!==!1&&o!=="").toSorted(([o],[a])=>o<a?-1:1).map(([o,a])=>`${o} ${String(a)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":s}:{"Content-Security-Policy":s};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var CA,TA,NA,IA,MA,JA,DA;var Nu=q(()=>{CA=new Set(["","module","importmap","text/javascript","module-shim"]),TA=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,NA=/<link\b([^>]*)>/gi,IA=/<img\b([^>]*)>/gi,MA=/<source\b([^>]*)>/gi,JA=/<iframe\b([^>]*)>/gi,DA=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Ya,readFileSync as qA,writeFileSync as Eg}from"node:fs";import{join as Xa}from"node:path";function _g(e,t){let r=e?.headers??{},n=[];if(r.enabled===!1)return{errors:n,rules:[]};let s=r.security??{},i={};if(s.contentTypeOptions!==!1)i["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)i["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)i["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)i["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:o}=s;if(o){let d=o===!0?{}:o,p=d.maxAge??Sg,h=d.includeSubDomains??!0,m=d.preload??!1;if(m&&!h)n.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else i["Strict-Transport-Security"]=[`max-age=${p}`,h?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=vg(s);if(a)if(t===void 0)n.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else Object.assign(i,wg(t,a));let l=r.cache??"auto";if(l==="auto")i["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(i).length>0)c.push({headers:i,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${Sg}, immutable`},pattern:HA});for(let[d,p]of Object.entries(r.rules??{}))c.push({headers:p,pattern:d});return{errors:n,rules:c}}function Pg(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],r=[];for(let[n,s]of t)if(Ya(Xa(e,n)))r.push({headers:{"Content-Type":s},pattern:`/${n}`});if(Ya(Xa(e,"feed","archive")))r.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return r}function jg(e,t){if(t==="")return[...e];return e.map((r)=>({headers:r.headers,pattern:Ie(t,r.pattern)}))}function BA(e){let t=e.map((r)=>{let n=Object.entries(r.headers).map(([s,i])=>` ${s}: ${i}`);return[r.pattern,...n].join(`
|
|
99
|
-
`)});return`${[
|
|
95
|
+
`:""}var dA,Bh,Ks="https://esm.sh/@vue/reactivity@3.5.40",Ys="https://esm.sh/lit-html@3.3.0",pA,mA,In,gA,Qs="__jxAttrText",Yh="__jxServerCall",yu="__jxCaptureSlotted",bu="__jxDistributeSlots",ei="<!---->",$u,bA;var Mr=q(()=>{Us();Zi();eo();Aa();Lh();ve();Hs();Us();eo();Aa();ve();dA=["$map/","event#/","$args/","$reduce/"];Bh=Symbol("jx.runtimeOnlyStateKeys");pA=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,mA=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g;In=new Set(["pre","textarea","listing","plaintext","xmp"]);gA=[];$u=new Set(["input","br","hr","img","meta","link","area","col","source"]);bA=/^(?:::slotted\(|::part\()/});import{relative as vA,sep as wA}from"node:path";function io(e){return e===SA}function ri(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Ua(e,t){let r=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return r===null?null:r[1]??r[2]??r[3]??""}function ng(e){let t=e.search(/<\/head\s*>/i),r=t===-1?e:e.slice(0,t);for(let[n]of r.matchAll(/<meta\b[^>]*>/gi)){if(Ua(n,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Ua(n,"content")??"").toLowerCase().split(",").map((i)=>i.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function sg(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function EA(e,t){let r=t.trim().toLowerCase();for(let[n]of sg(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Ua(n,"rel")??"").toLowerCase().split(/\s+/),i=(Ua(n,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&i===r)return!0}return!1}function ig(e,t){let{end:r}=sg(e);if(r===-1||EA(e,t.type))return e;let n=`<link href="${$e(t.href)}" rel="alternate" type="${$e(t.type)}">`;return`${e.slice(0,r)}${n}
|
|
96
|
+
${e.slice(r)}`}function og(e,t){return new URL(`/${vA(e,t).split(wA).join("/")}`,"http://localhost").pathname}var SA="/404";var Pu=q(()=>{Mr()});function ag(e,t){if(t===null||t.routing!=="prefix-always")return[];let r=[];for(let n of e){if(n.urlPattern==="/")continue;let s=n.urlPattern.split("/").find(Boolean),i=dr(s);if(i===null||!t.locales.includes(i))r.push(n.urlPattern)}return r}function lg(e,t){if(t===null)return null;let r=e.split("/").find(Boolean),n=dr(r);if(r===void 0||n===null||t.locales.includes(n))return null;let s=t.locales.find((i)=>i!==n&&i.split("-")[0]===n.split("-")[0]);return s===void 0?null:{meant:s,segment:r}}function _A(e,t){let r=e.split("/").filter(Boolean),n=dr(r[0]);if(t!==null&&n!==null&&t.locales.includes(n))return r.slice(1).join("/");return r.join("/")}function ju(e,t){let r=new Map,n=[];if(t===null)return{conflicts:n,sets:r};let s=new Map,i=new Set;for(let o of e){let a=o.translationKey===void 0?_A(o.urlPattern,t):o.translationKey.replaceAll(/^\/+|\/+$/g,"");if(o.translationKey!==void 0)i.add(o.urlPattern);let l=Tr(o.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],d=c.find((p)=>p.locale===l);if(d===void 0)c.push({locale:l,urlPattern:o.urlPattern});else n.push({declared:i.has(d.urlPattern)||o.translationKey!==void 0,key:a,locale:l,urlPatterns:[d.urlPattern,o.urlPattern]});s.set(a,c)}for(let o of s.values()){let a=o.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of o)r.set(l.urlPattern,a)}return{conflicts:n,sets:r}}function cg(e,t,r,n){let s=new Map;if(t===null||r==="")return s;let i=new Map;for(let[o,a]of ju(e,t).sets){if(a.length<2)continue;let l=i.get(a);if(l===void 0){l=a.map((d)=>({href:An(ri(d.urlPattern,n),r),hreflang:d.locale}));let c=a.find((d)=>d.locale===t.defaultLocale);if(c!==void 0)l.push({href:An(ri(c.urlPattern,n),r),hreflang:"x-default"});i.set(a,l)}s.set(o,l)}return s}function ug({pageLang:e,pageDir:t,routeLocale:r,defaults:n}){let s=e??r??n?.lang??"en",i=t??n?.dir;if(i!==void 0)return{dir:i,lang:s};return Gi(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var ku=q(()=>{nr();hs();Pu();hs();hs()});import{readFileSync as Ru,readdirSync as PA}from"node:fs";import{extname as dg,join as jA,relative as kA,resolve as RA}from"node:path";async function xs(e,t){let r=Ru(e,"utf8");if(e.endsWith(".json"))return jn(r,e);let n=dg(e).toLowerCase(),s=t?.byExtension(n,"parse");if(!s)throw Error(`No format class registered for "${n}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return await s.parseDocument(r)}async function fg(e,t){let r=new Map,n=new Map;for(let s of e){if(!n.has(s.sourcePath))n.set(s.sourcePath,await OA(s.sourcePath,t));let i=n.get(s.sourcePath);if(i!==null&&i!==void 0)r.set(s.urlPattern,AA(i,s._pathParams))}return r}function AA(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(r,n)=>t?.[n]??r)}async function OA(e,t){if(!Ru(e,"utf8").includes("$translationKey"))return null;let r;try{r=await xs(e,t)}catch{return null}return T(r.$translationKey)&&r.$translationKey!==""?r.$translationKey:null}async function pg(e,t){let r=[],n=new Set([".json",...t?.documentExtensions("page")??[]]);return await mg(e,e,r,n,t),r.sort(hh),r}async function mg(e,t,r,n,s){let i=PA(e,{withFileTypes:!0});for(let o of i){let a=jA(e,o.name);if(o.isDirectory()){if(o.name.startsWith("_"))continue;await mg(a,t,r,n,s);continue}let l=dg(o.name).toLowerCase();if(!n.has(l))continue;if(o.name.startsWith("_"))continue;let c=kA(t,a);r.push(await CA(c,a,s))}}async function CA(e,t,r){let{isCatchAll:n,isDynamic:s,params:i,urlPattern:o}=mh(e),a=null;try{let c=(await xs(t,r)).$layout;if(T(c))a=c}catch{}return{$layout:a,isCatchAll:n,isDynamic:s,params:i,relativePath:e,sourcePath:t,urlPattern:o}}function NA(e){let t=e[hg];if(!ee(t))return null;let{mtime:r}=t;return T(r)&&r!==""?r:null}function TA(e){if(e.includes("\x00"))return"has a NUL character";for(let t of e.split("/")){if(t==="."||t==="..")return'has a "." or ".." segment';if(t.includes("\\"))return"has a backslash"}return null}async function gg(e,t,r={},n,s,i){let o=[],a=e.flatMap((l)=>l.isDynamic?[l.urlPattern]:[]);for(let l of e){if(!l.isDynamic){o.push(l);continue}let c;try{c=await xs(l.sourcePath,n?.formats)}catch{o.push(l);continue}if(!c.$paths){console.warn(`Warning: dynamic route ${l.urlPattern} has no $paths — skipping`);continue}let d=await IA(c.$paths,t,r,n,s,Tr(l.urlPattern,i??null),l,a);for(let p of d){let h=l.urlPattern,m={};for(let[v,j]of Object.entries(p)){if(v===hg)continue;m[v]=String(j),h=h.replace(`:${v}`,m[v]),h=h.replace("*",m[v])}let b=TA(h);if(b!==null){console.warn(`Warning: $paths for ${l.urlPattern} produced "${h}", which ${b}; skipping it`);continue}let g=NA(p),y={...l,_pathParams:m,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:h};if(g!==null)y.sourceMtime=g;o.push(y)}}return o}async function IA(e,t,r,n,s,i,o,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=T(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&T(e.$ref)&&e.$ref){let l=e.$ref,c=RA(t,l),d;try{d=JSON.parse(Ru(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${Ee(m)}`),[]}if(!Array.isArray(d))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let p=T(e.param)?e.param:"id",h=T(e.field)?e.field:"id";return d.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[p]:(ee(m)?m[h]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=n?.byPathsDiscriminator(l);if(!c?.project)continue;let d={data:r[c.project.key],locale:i,projectConfig:s,root:t};if(o!==void 0)d.params=o.params,d.urlPattern=o.urlPattern;if(a!==void 0)d.patterns=a;return await c.call("resolvePaths",e,d)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var hg="_meta";var yg=q(()=>{ve();rr();gh();ku()});import{createHash as MA}from"node:crypto";function bg(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function $s(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[2]??r?.[3]}function Au(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function BA(e){return`'sha256-${MA("sha256").update(e,"utf8").digest("base64")}'`}function xg(e,t){for(let r of e.matchAll(DA)){let n=r[1]??"",s=$s(n,"src"),i=($s(n,"type")??"").trim().toLowerCase();if(s!==void 0){let o=Au(s);if(o)t.scriptOrigins.add(o);continue}if(JA.has(i))t.scriptHashes.add(BA(r[2]??""))}for(let r of e.matchAll(LA)){let n=r[1]??"",s=($s(n,"rel")??"").toLowerCase(),i=$s(n,"href"),o=Au(i);if(!o)continue;if(s.includes("stylesheet"))t.styleOrigins.add(o);if(VA.test(i??"")||($s(n,"as")??"")==="font")t.fontOrigins.add(o)}for(let[r,n]of[[FA,t.imgOrigins],[qA,t.imgOrigins],[HA,t.frameOrigins]])for(let s of e.matchAll(r)){let i=s[1]??"";for(let o of[$s(i,"src"),...WA($s(i,"srcset"))]){let a=Au(o);if(a)n.add(a)}}}function WA(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function $g(e){let t=e?.csp;if(t===void 0||t===!1)return null;if(t===!0)return{};if(t==="report-only")return{mode:"report-only"};return t}function vg(e,t){let r=(o,a)=>[...o,...a].join(" "),n={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":"'self'","frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")n["report-to"]="csp-endpoint",n["report-uri"]=t.reportUri;for(let[o,a]of Object.entries(t.directives??{}))n[o]=a;let s=Object.entries(n).filter(([,o])=>o!==!1&&o!=="").toSorted(([o],[a])=>o<a?-1:1).map(([o,a])=>`${o} ${String(a)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":s}:{"Content-Security-Policy":s};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var JA,DA,LA,FA,qA,HA,VA;var Ou=q(()=>{JA=new Set(["","module","importmap","text/javascript","module-shim"]),DA=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,LA=/<link\b([^>]*)>/gi,FA=/<img\b([^>]*)>/gi,qA=/<source\b([^>]*)>/gi,HA=/<iframe\b([^>]*)>/gi,VA=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as za,readFileSync as UA,writeFileSync as Sg}from"node:fs";import{join as Ga}from"node:path";function Eg(e,t){let r=e?.headers??{},n=[];if(r.enabled===!1)return{errors:n,rules:[]};let s=r.security??{},i={};if(s.contentTypeOptions!==!1)i["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)i["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)i["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)i["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:o}=s;if(o){let d=o===!0?{}:o,p=d.maxAge??wg,h=d.includeSubDomains??!0,m=d.preload??!1;if(m&&!h)n.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else i["Strict-Transport-Security"]=[`max-age=${p}`,h?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=$g(s);if(a)if(t===void 0)n.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else Object.assign(i,vg(t,a));let l=r.cache??"auto";if(l==="auto")i["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(i).length>0)c.push({headers:i,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${wg}, immutable`},pattern:zA});for(let[d,p]of Object.entries(r.rules??{}))c.push({headers:p,pattern:d});return{errors:n,rules:c}}function _g(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],r=[];for(let[n,s]of t)if(za(Ga(e,n)))r.push({headers:{"Content-Type":s},pattern:`/${n}`});if(za(Ga(e,"feed","archive")))r.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return r}function Pg(e,t){if(t==="")return[...e];return e.map((r)=>({headers:r.headers,pattern:Ie(t,r.pattern)}))}function YA(e){let t=e.map((r)=>{let n=Object.entries(r.headers).map(([s,i])=>` ${s}: ${i}`);return[r.pattern,...n].join(`
|
|
97
|
+
`)});return`${[GA,"",...t].join(`
|
|
100
98
|
`)}
|
|
101
|
-
`}function
|
|
102
|
-
${
|
|
99
|
+
`}function jg(e,t){if(t.length===0)return 0;let r=Ga(e,"_headers"),n=za(r)?UA(r,"utf8").trim():"",s=YA(t),i=n===""?s:`${s}
|
|
100
|
+
${KA}
|
|
103
101
|
${n}
|
|
104
|
-
`;return
|
|
105
|
-
`)}function
|
|
102
|
+
`;return Sg(r,i,"utf8"),1}function kg(e){let t=Ga(e,".nojekyll");if(za(t))return 0;return Sg(t,"","utf8"),1}var zA="/images/_optimized/*",wg=31536000,GA="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",KA="# ─── public/_headers (hand-authored; these rules override the block above) ───";var Rg=q(()=>{nr();Ou()});async function Ag(e,t,r,n={}){let s={},i=Nc(e);for(let o of r.projectContributions()){let a=o.project?.key;if(!a||!o.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await o.call("projectData",t[a],{io:i,projectConfig:t,registry:r,root:e,...n.lazy===!0&&{lazy:!0}})}return s}var Og=q(()=>{nn()});import{cpSync as XA,existsSync as ZA,mkdirSync as QA}from"node:fs";import{dirname as eO,resolve as tO}from"node:path";async function Cg(e,t,r){let n=[],s=[],i=new Map;for(let o of e.assetProviders()){let a=o.project?.key,l=a?t[a]:void 0;if(a&&(l==null||F(l)&&Object.keys(l).length===0))continue;try{let c=await o.call("assets",l??null,{projectConfig:t,root:r});for(let d of c??[]){if(!F(d)||!d.urlPrefix||!d.dir)continue;let p={dir:d.dir,urlPrefix:da(d.urlPrefix)};if(vt(d.filter))p.filter=d.filter;let h=i.get(p.urlPrefix);if(h){if(h.dir!==p.dir)s.push(`Asset mount conflict: "${p.urlPrefix}" is claimed by both "${h.dir}" and "${p.dir}"`);continue}i.set(p.urlPrefix,p),n.push(p)}}catch(c){s.push(`Error in ${o.name}.assets: ${Ee(c)}`)}}return{errors:s,mounts:n}}function Cu(e,t,r){if(t.length===0||!e)return;for(let n of Rm(e,t))r.add(n)}function Ng(e,t,r){let n=0,s=[];for(let i of e){let o=fa(t,i);if(!o||!ZA(o)){s.push(i);continue}let a=tO(r,decodeURIComponent(i).replace(/^\//,""));QA(eO(a),{recursive:!0}),XA(o,a),n+=1}return{copied:n,missing:s}}var Tg=q(()=>{nr();ve();rr()});async function Nu(e,t,r){let n=e.$layout??t.defaults?.layout??null;if(!n)return e;let s=await r(n);if(s.$layout)s=await Nu(s,t,r);let i=e.children??[],o=T(i)?[i]:Array.isArray(i)?i:[],a=nO(s);if(rO(a,o),e.state)a.state={...a.state,...e.state};if(e.$media)a.$media={...a.$media,...e.$media};if(e.style)a.style={...a.style,...e.style};if(e.attributes)a.attributes={...a.attributes,...e.attributes};if(e.$head)a._pageHead=e.$head;if(e.title)a._pageTitle=e.title;return delete a.$layout,a}function rO(e,t){let r=new Map,n=[];for(let s of t){let i=F(s)?s.attributes?.slot:void 0;if(i){let o=r.get(i);if(!o)o=[],r.set(i,o);o.push(s)}else n.push(s)}Ig(e,r,n)}function Ig(e,t,r){if(!F(e))return;if(!Array.isArray(e.children))return;let n=[];for(let s of e.children)if(F(s)&&s.tagName==="slot"){let i=s.attributes?.name,o=i?t.get(i):void 0;if(i&&o)n.push(...o),t.delete(i);else if(!i&&r.length>0)n.push(...r);else if(Array.isArray(s.children))n.push(...s.children)}else Ig(s,t,r),n.push(s);e.children=n}function nO(e){return structuredClone(e)}var Mg=q(()=>{ve()});import{existsSync as sO,readFileSync as iO}from"node:fs";import{resolve as Jg}from"node:path";function Dg(e){return(t)=>{let r=Jg(e,t);if(!sO(r))throw Error(`Layout not found: ${t} (resolved to ${r})`);try{return jn(iO(r,"utf8"),r)}catch(n){throw Error(`Invalid layout JSON at ${r}: ${Ee(n)}`,{cause:n})}}}function Lg(e,t,r){return Nu(e,t,Dg(r))}function Fg(e,t,r){let n=Dg(r),s=[],i=e.$layout??t.defaults?.layout;while(i){let o=Jg(r,i);if(s.some((l)=>l.path===o))break;let a=n(i);s.push({doc:a,path:o}),i=a.$layout}return s}var qg=q(()=>{rr();Mg()});import{dirname as oO,relative as aO,resolve as lO,sep as cO}from"node:path";function Hg(e,t){return aO(t,e).split(cO).join("/")}function uO(e,t,r){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${Hg(lO(t,e),r)}`}function oo(e,t,r){let n=oO(t),s=Hg(t,r);return Zh(e).map((i)=>({exportName:i.exportName,src:uO(i.src,n,r),declaredIn:s}))}function Vg(e){let t=new Map;for(let{exportName:s,src:i,declaredIn:o}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(i))a.set(i,o)}let r=[],n=[];for(let[s,i]of t){let o=[...i];if(r.push({exportName:s,src:o[0][0]}),o.length>1){let a=o.map(([l,c])=>`${l} (declared in ${c})`);n.push(`Server function "${s}" is exported by ${o.length} different modules: ${a.join(", ")}. The site worker serves one function per export name, at /_jx/server/${s}, so a call meant for any but the first would get the first's answer. Rename the export in all but one module, and the $export that names it.`)}}return{entries:r,errors:n}}var Bg=q(()=>{Mr()});function Wg(e,t){if(!T(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function Ug(e=[],t=[],r=[],n={}){let s=[{attributes:{charset:n.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],i=new Map;for(let a of[...s,...e,...t,...r]){let l=Tu(a);i.set(l,a)}let o=n.title??n.siteName??"Jx Site";if(i.set("title",{children:[o],tagName:"title"}),n.pageUrl&&n.siteUrl){let a=An(n.pageUrl,n.siteUrl);if(![...i.values()].some((c)=>F(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};i.set(Tu(c),c)}if(!i.has("meta:og:url"))i.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(n.siteName&&!i.has("meta:og:site_name"))i.set("meta:og:site_name",{attributes:{content:n.siteName,property:"og:site_name"},tagName:"meta"});for(let a of n.alternates??[]){let l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=Tu(l);if(!i.has(c))i.set(c,l)}return[...i.values()]}function Tu(e){if(!F(e))return String(e);let t=e.tagName??"unknown",r=e.attributes??{};if(t==="title")return"title";if(r.charset)return"meta:charset";if(t==="meta"&&r.name)return`meta:${r.name}`;if(t==="meta"&&r.property)return`meta:${r.property}`;if(t==="link"&&r.rel){let n=r.hreflang??r.type??r.media??r.sizes??"";return`link:${r.rel}:${r.href??""}:${String(n)}`}if(t==="script"&&r.src)return`script:${r.src}`;if(t==="style"){let n=Array.isArray(e.children)?e.children.join(""):e.textContent,s=F(n)?JSON.stringify(n):n??"";return`style:${dO(s)}`}return`${t}:${JSON.stringify(e)}`}function dO(e){let t=0;for(let r=0;r<e.length;r++)t=Math.trunc((t<<5)-t+(e.codePointAt(r)??0));return t.toString(36)}function zg(e){return e.map((t)=>fO(t)).join(`
|
|
103
|
+
`)}function fO(e){if(T(e))return e;if(!F(e))return"";let t=e.tagName,r=e.attributes??{},n=Object.entries(r).map(([l,c])=>c===!0?l:`${l}="${pO(c)}"`).join(" "),s=n?`<${t} ${n}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let o=Array.isArray(e.children)?e.children.join(""):e.textContent,a=F(o)?JSON.stringify(o,null,2):o??"";return`${s}${a}</${t}>`}function pO(e){return String(e).replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}var Gg=q(()=>{nr();ve()});function gO(e){let t=e.indexOf(":");if(t===-1)return!1;if(t===e.length-1)return!1;try{return new URL(e).protocol!==""}catch{return!1}}function yO(e){if(!T(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let r=t.toLowerCase();return!mO.has(r)&&!hO.has(r)&&!gO(t)})}function Kg(e){let t=new Set;for(let r of e){if(!F(r)||r.tagName!=="link")continue;for(let n of yO(r.attributes?.rel))t.add(n)}return[...t]}var mO,hO;var Yg=q(()=>{ve();mO=new Set(["about","acl","alternate","amphtml","api-catalog","appendix","apple-touch-icon","apple-touch-startup-image","archives","author","blocked-by","bookmark","c2pa-manifest","canonical","chapter","cite-as","collection","compression-dictionary","contents","convertedfrom","copyright","create-form","current","deprecation","describedby","describes","disclosure","dns-prefetch","dpp","duplicate","edit","edit-form","edit-media","enclosure","external","first","geofeed","glossary","help","hosts","hub","ice-server","icon","index","intervalafter","intervalbefore","intervalcontains","intervaldisjoint","intervalduring","intervalequals","intervalfinishedby","intervalfinishes","intervalin","intervalmeets","intervalmetby","intervaloverlappedby","intervaloverlaps","intervalstartedby","intervalstarts","item","last","latest-version","license","linkset","lrdd","manifest","mask-icon","me","media-feed","memento","micropub","modulepreload","monitor","monitor-group","next","next-archive","nofollow","noopener","noreferrer","opener","openid2.local_id","openid2.provider","original","p3pv1","payment","pingback","preconnect","predecessor-version","prefetch","preload","prerender","prev","prev-archive","preview","previous","privacy-policy","profile","publication","rdap-active","rdap-bottom","rdap-down","rdap-top","rdap-up","related","replies","restconf","ruleinput","search","section","self","service","service-desc","service-doc","service-meta","sip-trunking-capability","sponsored","start","status","stylesheet","subsection","successor-version","sunset","tag","terms-of-service","timegate","timemap","type","ugc","up","version-history","via","webmention","working-copy","working-copy-of"]),hO=new Set(["shortcut"])});function Xg(e,t,r,n=null,s=null,i=[]){if(!e.state)e.state={};let o={};if(s!==null)o.defaultLocale=s.defaultLocale,o.locales=s.locales;e.state.$site={name:t.name??"Jx Site",url:t.url??"",...o,...t.state};let a=(T(e.$lang)?e.$lang:void 0)??Tr(r.urlPattern,s)??t.defaults?.lang,l=i.map((d)=>({code:d.locale,current:d.urlPattern===r.urlPattern,dir:Gi(d.locale),label:yh(d.locale),url:d.urlPattern})),c={params:r._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:r.urlPattern};if(l.length>0)c.alternates=l;if(a!==void 0)c.dir=Gi(a),c.locale=a;if(e.state.$page=c,t.state){for(let[d,p]of Object.entries(t.state))if(d!=="$site"&&d!=="$page"&&!(d in e.state))e.state[d]=p}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[d,p]of Object.entries(t.imports))if(!(d in e.imports))e.imports[d]=n&&(p.startsWith("./")||p.startsWith("../"))?n(p,r):p}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let d=new Set,p=[];for(let h of[...t.$elements,...e.$elements]){let m=T(h)?h:F(h)?h.$ref:void 0;if(m&&!d.has(m))d.add(m),p.push(h)}e.$elements=p}return e}var Zg=q(()=>{ve();hs()});import{dirname as bO,relative as xO,resolve as $O}from"node:path";function vO(e){return(t,r)=>{if(!r.sourcePath)return t;return`./${xO(bO(r.sourcePath),$O(e,t))}`}}function Qg(e,t,r,n=null,s=null,i=[]){return Xg(e,t,r,n===null?null:vO(n),s,i)}var ey=q(()=>{Zg()});async function Xa(e,t={}){let{resolveElementPath:r,$media:n,formats:s}=t,i=[],o=new Set;async function a(l,c){let d,p;if(T(l)){let{readFileSync:P}=await import("node:fs"),{resolve:E}=await import("node:path");if(p=c?E(c,l):E(l),o.has(p))return;if(o.add(p),p.endsWith(".json"))d=jn(P(p,"utf8"),p);else{let{extname:O}=await import("node:path"),R=O(p).toLowerCase(),k=s?.byExtension(R,"parse");if(!k){await Promise.resolve().then(() => nn());throw ca(p,R)}d=await k.parseDocument(P(p,"utf8"))}}else{if(d=l,p=null,d.tagName&&o.has(d.tagName))return;if(d.tagName)o.add(d.tagName)}let{tagName:h}=d;if(!h||!h.includes("-"))throw Error(`compileElement: tagName "${h}" must contain a hyphen`);let{dirname:m}=await import("node:path"),b=p?m(p):null,g=[];if(Array.isArray(d.$elements))for(let P of d.$elements){let E=Ce(P)?P.$ref:P;if(!T(E))continue;if(b)await a(E,b);let O=r?r(E,b):E.replace(/\.json$/,".js");g.push(O)}let y=Va(h);if(n)d.$media={...n,...d.$media};let{rewriteSrc:v}=t,j=ao(d,y,g,v?(P)=>v(P,b):void 0,ys(d,t.defaults),t.serverBaseUrl),S=p?p.replace(/\.json$/,".js"):`${h}.js`;i.push({content:j,path:S,tagName:h})}return await a(e,t.basePath??null),{files:i}}async function wO(e,t={}){let{title:r="Jx App",reactivitySrc:n="https://esm.sh/@vue/reactivity@3.5.13",litHtmlSrc:s="https://esm.sh/lit-html@3.3.0"}=t,i=await Xa(e,t),o=i.files.at(-1);if(!o)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(o.path),c=`<!DOCTYPE html>
|
|
106
104
|
<html lang="en">
|
|
107
105
|
<head>
|
|
108
106
|
<meta charset="utf-8">
|
|
@@ -121,11 +119,11 @@ ${n}
|
|
|
121
119
|
<${o.tagName}></${o.tagName}>
|
|
122
120
|
<script type="module" src="./${l}"></script>
|
|
123
121
|
</body>
|
|
124
|
-
</html>`;return{files:i.files,html:c}}function
|
|
125
|
-
`)}function
|
|
122
|
+
</html>`;return{files:i.files,html:c}}function SO(e){if(!F(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(Pn(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(tn(e))return"null";return JSON.stringify(e)}function EO(e){let t=new Set,r=new Set,n=(i)=>{if(i.startsWith("#/state/"))t.add(i.slice(8).split("/")[0])},s=(i)=>{if(T(i)){for(let a of i.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/g))t.add(a[1]);return}if(!F(i)||r.has(i))return;if(r.add(i),Array.isArray(i)){for(let a of i)s(a);return}let o=i;if(o.operator==="call"&&Ce(o.target))n(o.target.$ref);for(let[a,l]of Object.entries(o)){if(a.startsWith("on")&&a!=="observedAttributes"&&Ce(l))n(l.$ref);s(l)}};return s(e.children),s(e.state),t}function ao(e,t,r,n,s=null,i="/_jx/server"){let o=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)o.push(`// Source: ${e.$id}`);for(let R of r)o.push(`import '${R}';`);let a=new Map,l=new Map,c=e.state??{},d=EO(e);for(let[R,k]of Object.entries(c))if(er(k)&&k.$src){let I=k.$src;if(k.$lazy===!0){if(!d.has(R)&&!ty.has(R))throw Error(`"${R}" declares "$lazy": true but is used as a computed value, not called. A lazily loaded function resolves to a promise; a computed must resolve now. Remove "$lazy", or call ${R}() from a handler instead of binding its value.`);let M=l.get(I);if(!M)M=[],l.set(I,M);M.push({binding:R,exportName:hu(R,k)});continue}let D=a.get(I);if(!D)D=[],a.set(I,D);D.push(Ia(R,k))}for(let[R,k]of a){let I=n?n(R):R;o.push(`import { ${k.join(", ")} } from '${I}';`)}let p=Object.entries(c).flatMap(([R,k])=>Cr(k)&&k.$prototype==="Request"?[[R,k]]:[]),h=Object.entries(c).flatMap(([R,k])=>tn(k)?[[R,k]]:[]);if(o.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",Fa()),h.length>0)o.push(qa());let m=s===null&&Nn(e.children);if(m)o.push(Xh());let b=0;for(let[R,k]of l){let I=n?n(R):R,D=`_jxLazy${b}`;b+=1,o.push(`let ${D};`,`const ${D}Load = () => (${D} ??= import('${I}'));`,...k.map(({binding:M,exportName:L})=>`const ${M} = (...args) => ${D}Load().then((m) => m.${L}(...args));`))}o.push("",`class ${t} extends HTMLElement {`," #effects = [];",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let g=[],y=[],v=[],j=[],S=[];for(let[R,k]of Object.entries(c))if(tr(k))if(ns(k))j.push([R,k]);else if(dn(k.$expression.operator))v.push([R,k]);else y.push([R,k]);else if(er(k))if(k.$src&&!T(k.body))if(d.has(R)||ty.has(R))v.push([R,k]);else y.push([R,k]);else if(T(k.body)&&ss(k.body))y.push([R,k]);else v.push([R,k]);else if(T(k)&&k.includes("${"))S.push([R,k]);else{let I=SO(k);if(I!==void 0)g.push([R,I])}o.push(" this.state = reactive({");for(let[R,k]of g)o.push(` ${un(R)}: ${k},`);o.push(" });");for(let[R,k]of v)if(o.push(""),tr(k)){let I=At(k.$expression,{eventParam:"e",statePrefix:"s"});o.push(` ${Pe("this.state",dt(R))} = (s, e) => { ${I}; };`)}else if(_n(k)){let I=fr(k.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = (s, e) => {`,I," };")}else{let I=k.parameters?rn(k.parameters):k.arguments??["state"],D=I.join(", "),M=T(k.body)?k.body:"";if(I[0]==="state")if(k.$src)o.push(` ${Pe("this.state",dt(R))} = (${D}) => ${R}(${D});`);else o.push(` ${Pe("this.state",dt(R))} = (${D}) => {`,` ${M}`," };");else{let L=I.map((W)=>W==="state"?"state":"e").join(", ");if(k.$src)o.push(` ${Pe("this.state",dt(R))} = (state, e) => ${R}(${L});`);else o.push(` ${Pe("this.state",dt(R))} = (state, e) => {`,` const _fn = (${D}) => {`,` ${M}`," };",` return _fn(${L});`," };")}}for(let[R,k]of j){o.push("");let I=At(k.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = ${no(k,I)};`)}for(let[R,k]of S)o.push("",` ${Pe("this.state",dt(R))} = computed(() => ${La(k.replaceAll("state.","this.state."))});`);for(let[R,k]of y)if(o.push(""),tr(k)){let I=At(k.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = computed(() => ${I});`)}else if(k.$src)o.push(` ${Pe("this.state",dt(R))} = computed(() => ${R}(this.state));`);else{o.push(` ${Pe("this.state",dt(R))} = computed(() => {`);let I=(T(k.body)?k.body:"").replaceAll("state.","this.state.");o.push(` ${I}`," });")}o.push(" }","");let P=[];if(Array.isArray(e.children)){let R={n:0};for(let k of e.children)Tn(k,P,e.$media??{},"",R,e.tagName)}let E=sy(),O=!Array.isArray(e.children)&&e.textContent!==void 0?` ${Za(e.textContent)}`:Ya(e.children,e.style," ",!1,!1,E);o.push(" template() {"," const s = this.state;",...E.decls," return html`",O," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;"," if (k in this.state) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (_k in this.state) {"," this.state[_k] = this.getAttribute(_n);"," this.removeAttribute(_n);"," }"," }"," for (const key of Object.keys(this.state)) {"," if (key.startsWith('#')) continue;"," if (this.hasOwnProperty(key) && this[key] !== undefined) {"," this.state[key] = this[key];"," }"," }");for(let[R,k]of p)o.push(Ma(R,k,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[R,k]of h)o.push(Ja(R,k,{collect:"this.#effects",indent:" ",serverBaseUrl:i,statePrefix:"this.state"}));if(F(e.style)){let R=[];for(let[k,I]of Object.entries(e.style)){if(k.startsWith(":")||k.startsWith(".")||k.startsWith("&")||k.startsWith("[")||k.startsWith("@"))continue;if(T(I)&&I.includes("${"))R.push([Vt(k),I])}if(R.length>0){o.push(" this.#effects.push(effect(() => {");for(let[k,I]of R){let D=I.replaceAll(/\$\{([^}]+)\}/g,(M,L)=>`\${${L.replaceAll("state.","this.state.")}}`);o.push(` this.style['${k}'] = \`${D}\`;`)}o.push(" }));")}}if(m)o.push(` const _slotted = ${yu}(this);`);if(o.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)o.push(" this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else o.push(" const _root = this.#renderRoot();"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(m)o.push(` ${bu}(this, _slotted);`);return o.push(" if (typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount(this.state));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }","}","",`customElements.define('${e.tagName}', ${t});`,""),o.join(`
|
|
123
|
+
`)}function sy(){return{byText:new Map,decls:[]}}function iy(e,t){let r=e.byText.get(t);if(r)return r;let n=`_c${e.decls.length}`;e.decls.push(` const ${n} = html\`
|
|
126
124
|
${t}
|
|
127
|
-
\`;`);let s=`\${${n}}`;return e.byText.set(t,s),s}function
|
|
128
|
-
`)}function
|
|
125
|
+
\`;`);let s=`\${${n}}`;return e.byText.set(t,s),s}function Ya(e,t,r,n=!1,s=!1,i=null,o=!1){if(!e)return"";let a=o?ei:"";if(Qe(e))return`${ny(e,r)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(Qe(l))return`${ny(l,r)}${a}`;let c=Mu(l,n?"":r,n,s,i);return T(l)&&l.includes("${")||F(l)&&Nr(l.tagName)?`${c}${a}`:c}).join(n?"":`
|
|
126
|
+
`)}function Mu(e,t,r=!1,n=!1,s=null,i=null){if(T(e)){if(e.includes("${"))return`${t}${Za(e)}`;return`${t}${$e(e)}`}if(lr(e)||$t(e))return`${t}${$e(String(e))}`;if(!F(e))return"";if(Nr(e.tagName)){let g=e.tagName.$expression,y=fn(g.target,{eventParam:"e",statePrefix:"s"}),v=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],j=v.map(([,k])=>k),S=j.map((k)=>r||In.has(k)),P=null;if(s&&S.every((k)=>k===S[0])){let k=ry(e,`${t} `,S[0]===!0,n,s,j.some((I)=>I.includes("-")));if(k.trim()!=="")P=iy(s,k)}let E=v.map(([k,I])=>{let D={...e,tagName:I};return[k,Mu(D,`${t} `,r,n,s,P)]});if(g.operator==="?:"){let[,k]=E[0],[,I]=E[1];return`${t}\${${y}
|
|
129
127
|
? html\`
|
|
130
128
|
${k}
|
|
131
129
|
\`
|
|
@@ -138,25 +136,25 @@ ${O.join(`,
|
|
|
138
136
|
`)}
|
|
139
137
|
}[String(${y})] ?? html\`
|
|
140
138
|
${R}
|
|
141
|
-
\`}`}let o=e.tagName??"div",a=r||
|
|
139
|
+
\`}`}let o=e.tagName??"div",a=r||In.has(o),l=[];if(e.attributes)for(let[g,y]of Object.entries(e.attributes))if(Ce(y))l.push(`${g}="\${${Qs}('${g}', ${Jr(y.$ref)}) ?? nothing}"`);else if(T(y)&&_O(y))l.push(`${g}="\${${Qs}('${g}', ${or(y).slice(2,-1)}) ?? nothing}"`);else if(T(y)&&y.includes("${"))l.push(`${g}="${or(y)}"`);else if($t(y)){let v=gs(g,y);if(v!==null)l.push(v===""?g:`${g}="${v}"`)}else l.push(`${g}="${y}"`);if(e.id)l.push(`id="${or(String(e.id))}"`);if(e.className)l.push(`class="${or(String(e.className))}"`);for(let[g,y]of Object.entries(e)){if(pn.has(g)||g.startsWith("$")||g.startsWith("on")||g==="tagName"||g==="id"||g==="className"||g==="style"||g==="children"||g==="textContent"||g==="innerHTML"||g==="attributes")continue;if(Ka(y))l.push(`.${g}="\${${Jr(y.$ref)}}"`);else if(T(y)&&y.includes("${"))l.push(`.${g}="${or(y)}"`);else l.push(`.${g}="\${${JSON.stringify(y)}}"`)}if(e.$props)for(let[g,y]of Object.entries(e.$props))if(Ka(y))l.push(`.${g}="\${${Jr(y.$ref)}}"`);else if(T(y)&&y.includes("${"))l.push(`.${g}="${or(y)}"`);else l.push(`.${g}="\${${JSON.stringify(y)}}"`);let c=n?"s.$map = $map; ":"";for(let[g,y]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;let v=g.slice(2).toLowerCase();if(Ka(y))l.push(c?`@${v}="\${(e) => { ${c}${Jr(y.$ref)}(s, e); }}"`:`@${v}="\${(e) => ${Jr(y.$ref)}(s, e)}"`);else if(F(y)&&"$expression"in y){let j=At(y.$expression,{eventParam:"e",statePrefix:"s"});l.push(`@${v}="\${(e) => { ${c}${j}; }}"`)}else if(er(y))l.push(`@${v}="\${(e) => { ${c}${PO(y)} }}"`)}let d=ay(e.style);if(d)l.push(`style="${d}"`);let p=l.length>0?`
|
|
142
140
|
${t} ${l.join(`
|
|
143
141
|
${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(o))return`${t}<${o}${p}
|
|
144
|
-
${t}>`;let m=i??
|
|
145
|
-
${t}>${m}${b}</${o}>`}function
|
|
146
|
-
${l.map(([h,m])=>{let b=s&&d.has(m)?
|
|
142
|
+
${t}>`;let m=i??ry(e,t,a,n,s,o.includes("-")),b=o==="slot"?ei:"";return a?`${b}<${o}${p}>${m}${b}</${o}>`:`${t}${b}<${o}${p}
|
|
143
|
+
${t}>${m}${b}</${o}>`}function ry(e,t,r,n,s,i=!1){if(e.$switch){let o=Ce(e.$switch)?e.$switch.$ref:e.$switch,a=Jr(o),l=[];for(let[h,m]of Object.entries(e.cases??{})){if(!m||Ce(m))continue;l.push([h,Mu(m,`${t} `,!1,n,s)])}let c=l.map(([,h])=>h),d=new Set(c.filter((h,m)=>c.indexOf(h)!==m&&h.trim()!==""));return`\${{
|
|
144
|
+
${l.map(([h,m])=>{let b=s&&d.has(m)?iy(s,m):m;return` ${JSON.stringify(h)}: html\`
|
|
147
145
|
${b}
|
|
148
146
|
\``}).join(`,
|
|
149
147
|
`)}
|
|
150
|
-
}[${a}]}`}if(e.textContent!==void 0){let o=
|
|
151
|
-
${
|
|
152
|
-
${t}`;return""}function
|
|
148
|
+
}[${a}]}`}if(e.textContent!==void 0){let o=Za(e.textContent),a=Ce(e.textContent)||T(e.textContent)&&e.textContent.includes("${");return i&&a?`${o}${ei}`:o}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return r?Ya(e.children,e.style,"",!0,n,s,i):`
|
|
149
|
+
${Ya(e.children,e.style,`${t} `,!1,n,s,i)}
|
|
150
|
+
${t}`;return""}function ny(e,t){let r=Ce(e.items)?Jr(e.items.$ref):"ITEMS",n=e.map;if(!n)return"";let s=n.tagName??"div",i=[];if(n.attributes)for(let[m,b]of Object.entries(n.attributes))if(Ce(b))i.push(`${m}="\${${Iu(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`${m}="${or(b)}"`);else i.push(`${m}="${b}"`);if(n.id)i.push(`id="${or(String(n.id))}"`);if(n.className)i.push(`class="${or(String(n.className))}"`);for(let[m,b]of Object.entries(n)){if(pn.has(m)||m.startsWith("$")||m.startsWith("on")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(Ka(b))i.push(`.${m}="\${${Iu(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`.${m}="${or(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`)}if(n.$props)for(let[m,b]of Object.entries(n.$props))if(Ce(b))i.push(`.${m}="\${${Iu(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`.${m}="${or(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`);let o=ay(n.style);if(o)i.push(`style="${o}"`);for(let[m,b]of Object.entries(n)){if(!m.startsWith("on"))continue;let g=m.slice(2).toLowerCase();if(Ce(b))i.push(`@${g}="\${(e) => { s.$map = $map; ${Jr(b.$ref)}(s, e); }}"`);else if(tr(b)){let y=At(b.$expression,{eventParam:"e",statePrefix:"s"});i.push(`@${g}="\${(e) => { s.$map = $map; ${y}; }}"`)}}let a=i.length>0?`
|
|
153
151
|
${t} ${i.join(`
|
|
154
|
-
${t} `)}`:"",l=
|
|
155
|
-
${
|
|
152
|
+
${t} `)}`:"",l=sy(),c="";if(n.textContent!==void 0)c=Za(n.textContent);else if(n.children)c=`
|
|
153
|
+
${Ya(n.children,null,`${t} `,!1,!0,l)}
|
|
156
154
|
${t} `;let d=`html\`
|
|
157
155
|
${t} <${s}${a}
|
|
158
156
|
${t} >${c}</${s}>
|
|
159
|
-
${t}\``,p=(d.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((m)=>`${m.trim()} `).join(""),h=p?`(item, index) => { ${p}return ${d}; }`:`(item, index) => ${d}`;return`${t}\${${r}.map(${h})}`}function
|
|
157
|
+
${t}\``,p=(d.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((m)=>`${m.trim()} `).join(""),h=p?`(item, index) => { ${p}return ${d}; }`:`(item, index) => ${d}`;return`${t}\${${r}.map(${h})}`}function Ka(e){return Ce(e)&&e.$ref!==""}function Jr(e){if(e.startsWith("#/state/"))return Pe("s",e.slice(8));if(e.startsWith("$map/"))return oy(e.slice(5));if(e.startsWith("parent#/"))return Pe("s",e.slice(8));if(e.startsWith("window#/"))return Pe("window",e.slice(8));if(e.startsWith("document#/"))return Pe("document",e.slice(10));return Pe("s",e)}function oy(e){let[t,...r]=cn(e);return Pe(t??"",r.map((n)=>dt(n)).join("/"))}function Iu(e){if(e.startsWith("$map/"))return oy(e.slice(5));return Jr(e)}function or(e){return e.replaceAll("state.","s.")}function _O(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function Za(e){if(Ce(e))return`\${${Jr(e.$ref)}}`;if(T(e)&&e.includes("${"))return or(e);return String(e)}function PO(e){if(_n(e))return fr(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=T(e.body)?e.body:"",r=e.parameters?rn(e.parameters):e.arguments??[];if(r.length>0){let n=r.map((s)=>s==="state"?"s":"e").join(", ");return`((${r.join(", ")}) => { ${t} })(${n});`}return t.replaceAll(/(?<!this\.)state\./g,"s.").replaceAll(/(?<!this\.)state(?!\.)/g,"s")}function ay(e){if(!F(e))return"";let t=[];for(let[r,n]of Object.entries(e)){if(r.startsWith(":")||r.startsWith(".")||r.startsWith("&")||r.startsWith("[")||r.startsWith("@"))continue;if(T(n)&&n.includes("${")){let s=Vt(r);t.push(`${s}: ${or(n)}`)}}return t.join("; ")}var ty;var lo=q(()=>{Us();Mr();ve();rr();Hs();ty=new Set(["onMount","onUnmount","onAdopted"])});function ly(e,t){let{title:r="Jx App",reactivitySrc:n,litHtmlSrc:s}=t,i=Xs(e,null,e.state??{},e.$media??{}),o=ti(e,e.$media??{},t.projectStyle??null),a=[],l=cy(e,!1,i,a),c=[],d="",p="";if(a.length>0){for(let b of a){let g=ao(b.def,b.className,[],t.rewriteSrc);c.push({content:g,path:`_islands/${b.tagName}.js`,tagName:b.tagName})}d=`<script type="importmap">
|
|
160
158
|
{
|
|
161
159
|
"imports": {
|
|
162
160
|
"@vue/reactivity": "${n}",
|
|
@@ -178,9 +176,9 @@ ${t}\``,p=(d.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((
|
|
|
178
176
|
${l}
|
|
179
177
|
${p}
|
|
180
178
|
</body>
|
|
181
|
-
</html>`;return{files:c,html:m}}function
|
|
182
|
-
${
|
|
183
|
-
})()`)};`);else g.push([I,{args:["state","e"],body:
|
|
179
|
+
</html>`;return{files:c,html:m}}function cy(e,t,r,n){if(T(e))return $e(e);if(lr(e)||$t(e))return $e(String(e));if(!F(e))return"";let s=Xs(e,r.scope,e.state??r.scopeDefs,e.$media??r.media);if(t){let c=n.length,d=`jx-island-${c}`,p=`JxIsland${c}`,h={...e,tagName:d};return n.push({className:p,def:h,tagName:d}),`<${d}></${d}>`}let i=vu(e.tagName,s.scope),o=bs(e,s.scope);if($u.has(i))return`<${i}${o}>`;let a=r.preformatted===!0||In.has(i),l=jO(e,{...s,preformatted:a},n);return`<${i}${o}>${l}</${i}>`}function jO(e,t,r){if(e.textContent!==void 0){let n=Me(e.textContent,t.scope);return n==null?"":$e(String(n))}if(e.innerHTML){let n=Me(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>cy(n,Wh(n),t,r)).join(so(t.preformatted));return""}var uy=q(()=>{Mr();lo();ve()});function Fu(e,t){let{title:r="Jx App",reactivitySrc:n=Ks,litHtmlSrc:s=Ys,modulePath:i="app.js",serverBaseUrl:o="/_jx/server"}=t,a=Xs(e,null,e.state??{},e.$media??{}),l=ti(e,e.$media??{},t.projectStyle??null),c={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},d=new Map,p=new Map,h=[],m=[],b=[],g=[],y=[],v=[],j=new Map,S=e.state??{};for(let[I,D]of Object.entries(S)){if(!F(D)||Array.isArray(D)){if(pe(D))m.push([I,`() => ${La(D)}`]);else h.push([I,D]);continue}if(tr(D)){let M=D.$expression,L=At(M,{eventParam:"e",statePrefix:"state"});if(ns(D))y.push(`state[${JSON.stringify(I)}] = ${no(D,L)};`);else if(dn(M.operator))g.push([I,{args:["state","e"],body:L}]);else m.push([I,`() => ${L}`]);continue}if(er(D)){let M=D.parameters?rn(D.parameters):D.arguments,{body:L}=D;if(Array.isArray(L)){let W=fr(L,{eventParam:"e",statePrefix:"state"});if(D.parameters&&D.parameters.length>0)y.push(`state[${JSON.stringify(I)}] = ${no(D,`(() => {
|
|
180
|
+
${W}
|
|
181
|
+
})()`)};`);else g.push([I,{args:["state","e"],body:W}])}else if(D.$src){let W=j.get(D.$src);if(!W)W=new Set,j.set(D.$src,W);W.add(Ia(I,D)),m.push([I,`() => { return ${I}(state); }`])}else if(T(L)&&ss(L))m.push([I,`() => { ${L} }`]);else g.push([I,{args:M??["state"],body:L}]);continue}if(Pn(D))continue;if(Up(D)){h.push([I,D.default]);continue}if(Cr(D)){if(D.$prototype==="LocalStorage"||D.$prototype==="SessionStorage"){let M=D.$prototype==="LocalStorage"?"localStorage":"sessionStorage",L=D.key??I,W=D.default??null;h.push([I,null]),y.push(RO(I,M,L,W));continue}if(D.$prototype==="Request"){h.push([I,null]),y.push(Ma(I,D));continue}if(D.$prototype==="Cookie"){h.push([I,null]),y.push(AO(I,D.name??I,D.default??null));continue}}if(tn(D)){h.push([I,null]),v.push(Ja(I,D,{serverBaseUrl:o}));continue}h.push([I,D])}let P=dy(e,a,d,p,c);for(let[I,D]of d)if(!b.some(([M])=>M===I))b.push([I,D]);for(let[I,D]of p)if(!g.some(([M])=>M===I))g.push([I,D]);let E=kO(h,m,b,g,y,v,j,c,n,t.rewriteSrc),O=[` "@vue/reactivity": "${n}"`,` "lit-html": "${s}"`],R=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((I)=>wr(String(I))!==null)?`<script>${Zs()}</script>
|
|
184
182
|
`:"",k=`<!DOCTYPE html>
|
|
185
183
|
<html lang="en">
|
|
186
184
|
<head>
|
|
@@ -201,17 +199,17 @@ ${O.join(`,
|
|
|
201
199
|
<body>
|
|
202
200
|
${P}
|
|
203
201
|
</body>
|
|
204
|
-
</html>`;return{files:[{content:E,path:i}],html:k}}function
|
|
202
|
+
</html>`;return{files:[{content:E,path:i}],html:k}}function dy(e,t,r,n,s){if(T(e))return $e(e);if(lr(e)||$t(e))return $e(String(e));if(!F(e))return"";let i=Xs(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(Nr(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Ms(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let o=e.tagName??"div";i.preformatted=t.preformatted===!0||In.has(o);let a=[],l=!1;if(e.textContent!==void 0){let g=e.textContent;if(Bt(g)){let y=ni(g.$ref);a.push(`:text-content="${y}"`),Ju(r,y,g.$ref),l=!0}else if(pe(g)){let y=`_t${s.t}`;s.t+=1,a.push(`:text-content="${y}"`),r.set(y,`() => \`${g}\``),l=!0}}for(let[g,y]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;let v=g.slice(2).toLowerCase();if(Bt(y)){let j=ni(y.$ref);a.push(`@${v}="${j}"`),l=!0}else if(er(y)){let j=`_h${s.h}`;s.h+=1,a.push(`@${v}="${j}"`);let{body:S}=y;n.set(j,Array.isArray(S)?{args:["state","e"],body:fr(S,{eventParam:"e",statePrefix:"state"})}:{args:y.parameters?rn(y.parameters):y.arguments??["state","event"],body:S}),l=!0}else if(tr(y)){let j=`_h${s.h}`;s.h+=1,a.push(`@${v}="${j}"`);let S=At(y.$expression,{eventParam:"e",statePrefix:"state"});n.set(j,{args:["state","e"],body:S}),l=!0}}if(F(e.style))for(let[g,y]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(py(y))continue;if(pe(y)){let v=`_s${s.s}`;s.s+=1,a.push(`:style.${Vt(g)}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}if(F(e.attributes)){for(let[g,y]of Object.entries(e.attributes))if(Bt(y)){let v=ni(y.$ref);a.push(`:attr.${g}="${v}"`),Ju(r,v,y.$ref),l=!0}else if(pe(y)){let v=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}for(let[g,y]of Object.entries(e)){if(pn.has(g)||g.startsWith("on")||g.startsWith("$")||g==="tagName"||g==="id"||g==="className"||g==="style"||g==="children"||g==="textContent"||g==="innerHTML"||g==="attributes")continue;if(Bt(y)){let v=ni(y.$ref);a.push(`:${Vt(g)}="${v}"`),Ju(r,v,y.$ref),l=!0}else if(pe(y)){let v=`_t${s.t}`;s.t+=1,a.push(`:${Vt(g)}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}let c=bs(e,i.scope),d=l?" data-bind":"",p=a.length>0?` ${a.join(" ")}`:"",h="",m=e;if(m.$switch){s.needsLit=!0;let g=`_sw${s.sw}`;s.sw+=1;let y=Bt(m.$switch)?Lu(m.$switch.$ref):`\`${String(m.$switch)}\``,v=m.cases??{},j=Object.entries(v).filter(([,P])=>P&&!Bt(P)).map(([P,E])=>`${JSON.stringify(P)}: html\`${Du(E,i.preformatted)}\``);r.set(g,`() => ({${j.join(", ")}})[String(${y})] ?? html\`\``),a.push(`:render="${g}"`);let S=` ${a.join(" ")}`;return`<${o}${c} data-bind${S}></${o}>`}if(m.textContent!==void 0&&!l){let g=Me(m.textContent,i.scope);h=g==null?"":$e(String(g))}else if(m.textContent!==void 0&&l){let g=Me(m.textContent,i.scope);h=g==null?"":$e(String(g))}else if(m.innerHTML){let g=Me(m.innerHTML,i.scope);h=g==null?m.innerHTML:String(g)}else if(Qe(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let y=m.children,v=Bt(y.items)?Lu(y.items.$ref):JSON.stringify(y.items),j=qu(y.map);r.set(g,`() => (${v} ?? []).map((item, index) => html\`${j}\`)`),a.push(`:render="${g}"`),l=!0;let S=" data-bind",P=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${S}${P}>`;return`<${o}${c}${S}${P}></${o}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>Qe(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let y=m.children.map((j)=>Du(j,i.preformatted)).join(so(i.preformatted," "));r.set(g,i.preformatted?`() => html\`${y}\``:`() => html\`
|
|
205
203
|
${y}
|
|
206
|
-
\``),a.push(`:render="${g}"`),l=!0;let v=` ${a.join(" ")}`;return`<${o}${c} data-bind${v}></${o}>`}else if(Array.isArray(m.children))h=m.children.map((g)=>
|
|
207
|
-
${
|
|
208
|
-
`;else if(Array.isArray(e.children)){let l=e.children.map((c)=>{let d=
|
|
204
|
+
\``),a.push(`:render="${g}"`),l=!0;let v=` ${a.join(" ")}`;return`<${o}${c} data-bind${v}></${o}>`}else if(Array.isArray(m.children))h=m.children.map((g)=>dy(g,i,r,n,s)).join(so(i.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${d}${p}>`;return`<${o}${c}${d}${p}>${h}</${o}>`}function qu(e,t=!1){if(!e)return"";if(Nr(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Ms(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let r=e.tagName??"div",n=t||In.has(r),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${Mn(e.className)}"`;if(F(e.$props))for(let[l,c]of Object.entries(e.$props))if(Bt(c))s+=` .${l}="\${${OO(c.$ref)}}"`;else if(pe(c))s+=` .${l}="${Mn(c)}"`;else s+=` .${l}="\${${JSON.stringify(c)}}"`;if(F(e.attributes))for(let[l,c]of Object.entries(e.attributes)){if(pe(c)){s+=` ${l}="${Mn(c)}"`;continue}if($t(c)){let d=gs(l,c);if(d!==null)s+=d===""?` ${l}`:` ${l}="${$e(d)}"`;continue}s+=` ${l}="${$e(String(c))}"`}if(F(e.style)){let l=[];for(let[c,d]of Object.entries(e.style)){if(c.startsWith(":")||c.startsWith(".")||c.startsWith("&")||c.startsWith("[")||c.startsWith("@"))continue;if(py(d))continue;let p=Vt(c);if(pe(String(d)))l.push(`${p}: ${Mn(String(d))}`);else l.push(`${p}: ${d}`)}if(l.length>0)s+=` style="${l.join("; ")}"`}for(let[l,c]of Object.entries(e)){if(!l.startsWith("on")||l==="observedAttributes")continue;let d=l.slice(2).toLowerCase();if(Bt(c)){let p=ni(c.$ref);s+=` @${d}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(_n(c)){let p=fr(c.body,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(er(c)){let p=Mn(c.body);s+=` @${d}=\${(e) => { ${p} }}`}else if(F(c)&&"$expression"in c){let p=At(c.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=r.includes("-")?ei:"",o="";if(e.textContent!==void 0){let l=String(e.textContent);if(pe(l))o=`${Mn(l)}${i}`;else if(Bt(e.textContent))o=`\${state.${ni(e.textContent.$ref)}}${i}`;else o=$e(l)}else if(e.innerHTML)o=Mn(String(e.innerHTML));else if(Qe(e.children))o=`
|
|
205
|
+
${fy(e.children)}${i}
|
|
206
|
+
`;else if(Array.isArray(e.children)){let l=e.children.map((c)=>{let d=Du(c,n);return Qe(c)||T(c)&&pe(c)?`${d}${i}`:d});o=n?l.join(""):`
|
|
209
207
|
${l.join(`
|
|
210
208
|
`)}
|
|
211
|
-
`}if(new Set(["input","br","hr","img","meta","link"]).has(r))return`<${r}${s}>`;return`<${r}${s}>${o}</${r}>`}function
|
|
212
|
-
`)}function
|
|
213
|
-
`)}function
|
|
214
|
-
`)}function
|
|
209
|
+
`}if(new Set(["input","br","hr","img","meta","link"]).has(r))return`<${r}${s}>`;return`<${r}${s}>${o}</${r}>`}function Du(e,t=!1){if(T(e))return pe(e)?Mn(e):$e(e);if(lr(e)||$t(e))return $e(String(e));if(Qe(e))return fy(e);return qu(e,t)}function fy(e){let{items:t}=e,r=Bt(t)?Lu(t.$ref):JSON.stringify(t??[]),n=qu(e.map);return`\${(${r} ?? []).map((item, index) => html\`${n}\`)}`}function Mn(e){return e.replaceAll("$map.","")}function kO(e,t,r,n,s,i,o,a,l,c){let d=[],{needsLit:p}=a,h=t.length>0;d.push("// Generated by @jxsuite/compiler — do not edit manually");let m=["reactive","effect"];if(h)m.push("computed");if(d.push(`import { ${m.join(", ")} } from '@vue/reactivity';`),p)d.push("import { html, render } from 'lit-html';");for(let[b,g]of o){let y=c?c(b):b;d.push(`import { ${[...g].join(", ")} } from '${y}';`)}if(d.push("",Fa()),i.length>0)d.push("",qa());d.push("","const state = reactive({");for(let[b,g]of e)d.push(` ${un(b)}: ${JSON.stringify(g)},`);if(d.push("});",""),s.length>0){for(let b of s)d.push(b);d.push("")}if(t.length>0){for(let[b,g]of t)d.push(`${Pe("state",dt(b))} = computed(${g});`);d.push("")}if(i.length>0){for(let b of i)d.push(b);d.push("")}if(r.length>0){d.push("const bind = {");for(let[b,g]of r)d.push(` ${un(b)}: ${g},`);d.push("};")}else d.push("const bind = {};");if(d.push(""),n.length>0){d.push("const on = {");for(let[b,g]of n){let y=g.args??["state"],v=y.map((j)=>j==="state"?"state":"e").join(", ");d.push(` ${un(b)}: (e) => { const fn = (${y.join(", ")}) => { ${g.body} }; fn(${v}); },`)}d.push("};")}else d.push("const on = {};");if(d.push("","function hydrate(root) {"," root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),p)d.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else d.push(" if (parts[0] === 'style' && parts.length > 1) {");return d.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Qs}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });","}","","hydrate(document);",""),d.join(`
|
|
210
|
+
`)}function RO(e,t,r,n){return[`// ${e}: ${t} (key: "${r}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(r)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(n)};`,`} catch { state.${e} = ${JSON.stringify(n)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(r)});`,` else ${t}.setItem(${JSON.stringify(r)}, JSON.stringify(v));`," } catch {}","});"].join(`
|
|
211
|
+
`)}function AO(e,t,r){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(r)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(r)}; }`,"}"].join(`
|
|
212
|
+
`)}function py(e){return e===null||F(e)}function OO(e){if(e.startsWith("$map/")){let[t,...r]=cn(e.slice(5));return Pe(t??"",r.map((n)=>dt(n)).join("/"))}if(e.startsWith("#/state/"))return Pe("state",e.slice(8));return Pe("state",e)}function Lu(e){return Eh("state",e.startsWith("#/state/")?e.slice(8):e)}function ni(e){return _h(e.startsWith("#/state/")?e.slice(8):e)}function Ju(e,t,r){if(e.has(t))return;e.set(t,`() => ${Pe("state",r.startsWith("#/state/")?r.slice(8):r)}`)}var Hu=q(()=>{Us();Mr();ve();Hs()});function CO(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function my(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),r=JSON.stringify(e.defaultLocale),n=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,CO(s,e)])));return`
|
|
215
213
|
// ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
|
|
216
214
|
const JX_LOCALES = ${t}
|
|
217
215
|
const JX_DEFAULT_LOCALE = ${r}
|
|
@@ -280,12 +278,12 @@ app.use('/', async (c, next) => {
|
|
|
280
278
|
res.headers.set('Content-Language', locale)
|
|
281
279
|
c.res = res
|
|
282
280
|
})
|
|
283
|
-
`}function
|
|
284
|
-
`),c=
|
|
281
|
+
`}function Qa(e,t="/_jx/server"){return Ie(e,t)}function Vu(e,t={}){let{adapter:r=null,mounts:n=[],connectors:s=[],i18n:i=null,base:o=""}=t,a=Qa(o,t.baseUrl);if(e.length===0&&n.length===0&&!r)return null;let l=e.map(({exportName:m,src:b})=>`import { ${m} } from '${b}'`).join(`
|
|
282
|
+
`),c=NO(n,s),d=e.map(({exportName:m})=>TO(m,a)).join(`
|
|
285
283
|
`),p=r==="cloudflare-workers"||r==="cloudflare-pages"?`
|
|
286
284
|
app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
|
|
287
285
|
`:`
|
|
288
|
-
`,h=
|
|
286
|
+
`,h=my(i);return`// Generated by @jxsuite/compiler — do not edit manually
|
|
289
287
|
import { Hono } from 'hono'
|
|
290
288
|
${l}${c.imports}
|
|
291
289
|
|
|
@@ -293,11 +291,11 @@ const app = new Hono()
|
|
|
293
291
|
${h}${c.routes}${d}
|
|
294
292
|
${p}
|
|
295
293
|
export default app
|
|
296
|
-
`}function
|
|
294
|
+
`}function NO(e,t){if(e.length===0)return{imports:"",routes:""};let r=e.toSorted((i,o)=>i.order-o.order),n=[];for(let i of r)n.push(`import { ${i.className} } from '${i.module}'`);for(let i of t)n.push(`import { ${i.className} } from '${i.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((i)=>`${JSON.stringify(i.provider)}: ${i.className}`).join(", ")} }`];for(let[i,o]of r.entries()){let a=JSON.stringify(o.options);s.push(`const jxMount${i} = await ${o.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${o.basePath}/*', (c) => jxMount${i}(c.req.raw, c.env))`,`app.all('${o.basePath}', (c) => jxMount${i}(c.req.raw, c.env))`)}return{imports:`
|
|
297
295
|
${n.join(`
|
|
298
296
|
`)}`,routes:`${s.join(`
|
|
299
297
|
`)}
|
|
300
|
-
`}}function
|
|
298
|
+
`}}function TO(e,t){return`
|
|
301
299
|
app.post('${t}/${e}', async (c) => {
|
|
302
300
|
const args = await c.req.json().catch(() => ({}))
|
|
303
301
|
try {
|
|
@@ -305,9 +303,9 @@ app.post('${t}/${e}', async (c) => {
|
|
|
305
303
|
} catch (e) {
|
|
306
304
|
return c.json({ ok: false, error: e?.message ?? 'Server error' }, 500)
|
|
307
305
|
}
|
|
308
|
-
})`}var
|
|
309
|
-
`)}function
|
|
310
|
-
`):e.body??"").includes("await ")}var
|
|
306
|
+
})`}var Bu=q(()=>{nr()});function gy(e){let t=e.title;if(!t)throw Error("compileClassJson: missing title (class name)");let r=MO(e.extends),n=e.$defs,s=n?.fields??{},i=n?.constructor,o=IO(i)?i:void 0,a=n?.methods??{},l=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(e.$id)l.push(`// Source: ${e.$id}`);l.push("");let c=r!=="Object"?` extends ${r}`:"";l.push(`class ${t}${c} {`);for(let[d,p]of Object.entries(s)){if(p.scope!=="static")continue;let h=p.identifier??d,m=p.access==="private"?"#":"",b=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";l.push(` static ${m}${h} = ${b};`)}for(let[d,p]of Object.entries(s)){if(p.scope==="static")continue;if(p.access!=="private")continue;let h=p.identifier??d;l.push(` #${h};`)}if(Object.keys(s).length>0)l.push("");if(l.push(" constructor(config = {}) {"),o?.superCall||r!=="Object"){let d=o?.superCall?.arguments?o.superCall.arguments.join(", "):"";l.push(` super(${d});`)}for(let[d,p]of Object.entries(s)){if(p.scope==="static")continue;let h=p.identifier??d,m=p.access==="private"?"#":"",b=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";l.push(` this.${m}${h} = config.${h} !== undefined ? config.${h} : ${b};`)}if(o?.body){let d=Array.isArray(o.body)?o.body:[o.body];for(let p of d)l.push(` ${p}`)}l.push(" }");for(let[d,p]of Object.entries(a)){let h=p.identifier??d,m=p.scope==="static",g=p.access==="private"?"#":"",y=m?"static ":"",v=p.returnType?.$ref?.includes("Promise")||DO(p)?"async ":"",j=hy(p.parameters??[]),S=JO(p.body);if(l.push(""),p.role==="accessor"){if(p.getter)l.push(` ${y}get ${g}${h}() {`,` ${p.getter.body}`," }");if(p.setter){let P=hy(p.setter.parameters??[]);l.push(` ${y}set ${g}${h}(${P}) {`,` ${p.setter.body}`," }")}}else{l.push(` ${y}${v}${g}${h}(${j}) {`);for(let P of S)l.push(` ${P}`);l.push(" }")}}return l.push("}","",`export { ${t} };`,`export default ${t};`,""),l.join(`
|
|
307
|
+
`)}function IO(e){return typeof e==="object"}function MO(e){if(!e)return"Object";if(T(e))return e;if(e.$ref){let t=e.$ref.match(/([A-Za-z0-9_]+)\.class\.json/);return t?t[1]:"Object"}return"Object"}function hy(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let r=t.identifier??t.name;return T(r)?r:"arg"}).join(", ")}function JO(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function DO(e){return(Array.isArray(e.body)?e.body.join(`
|
|
308
|
+
`):e.body??"").includes("await ")}var yy=q(()=>{ve()});import{readFileSync as LO}from"node:fs";async function Wu(e,t={}){let{title:r="Jx App",reactivitySrc:n=Ks,litHtmlSrc:s=Ys,projectStyle:i=null}=t,o;if(T(e)){let l=LO(e,"utf8");if(e.endsWith(".json"))o=jn(l,e);else{let{extname:c}=await import("node:path"),d=c(e).toLowerCase(),p=t.formats?.byExtension(d,"parse");if(!p){await Promise.resolve().then(() => nn());throw ca(e,d)}o=await p.parseDocument(l)}}else o=e;if(Gp(o)){await Promise.resolve().then(() => yy());let c=gy(o),d=T(e)?e.replace(/\.class\.json$/,".js"):`${o.title}.js`;return{files:[{content:c,path:d}],html:""}}if(!Da(o))return ly(o,{litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...by(t),title:r});if(o.tagName&&o.tagName.includes("-")){let{tagName:l}=o,c=Va(l),p={content:ao(o,c,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${l}.js`,tagName:l},h=ti(o,o.$media??{},i),m=`<!DOCTYPE html>
|
|
311
309
|
<html lang="en">
|
|
312
310
|
<head>
|
|
313
311
|
<meta charset="utf-8">
|
|
@@ -327,47 +325,47 @@ app.post('${t}/${e}', async (c) => {
|
|
|
327
325
|
<${l}></${l}>
|
|
328
326
|
<script type="module" src="./${l}.js"></script>
|
|
329
327
|
</body>
|
|
330
|
-
</html>`;return{files:[p],html:m}}let a={litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...
|
|
328
|
+
</html>`;return{files:[p],html:m}}let a={litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...by(t),title:r};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;return Fu(o,a)}function by(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function G9(e,t){let r=await Wu(e),{writeFileSync:n,mkdirSync:s}=await import("node:fs"),{dirname:i,join:o}=await import("node:path");if(t){n(t,r.html,"utf8"),console.error(`Written to ${t}`);let a=i(t);for(let l of r.files){let c=o(a,l.path);s(i(c),{recursive:!0}),n(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(r.html)}var xy=q(()=>{Mr();lo();uy();Hu();ve();rr();Mr();Bu();lo();Hu()});import{readFileSync as FO}from"node:fs";import{dirname as Uu,resolve as el}from"node:path";import{createRequire as qO}from"node:module";function BO(e){return vt(e.resolve)}async function $y(e,t,r,n={}){let s=e.imports??{},{state:i}=e;if(!i)return;for(let[o,a]of Object.entries(i)){if(!Cr(a))continue;if(HO.has(a.$prototype))continue;if(a.timing&&a.timing!=="compiler"){let l=n.registry?.byName(a.$prototype);if(l?.capabilities.lower)try{let c=await l.call("lower",a,{projectConfig:n.config,root:r,route:t});if(ee(c)){let d=c.$bundle;if(Array.isArray(d)){for(let p of d)if(T(p))n.registerBundle?.(p)}delete c.$bundle}i[o]=c}catch(c){console.warn(`prototype-resolver: failed to lower "${o}" ($prototype: "${a.$prototype}"):`,Ee(c))}continue}if(!a.$src){let l=s[a.$prototype]??WO(n,a.$prototype);if(!l)continue;a.$src=l}try{let l=await UO(a,t,r,i,n);if(a.timing&&ee(l))l.timing=a.timing;i[o]=l}catch(l){console.warn(`prototype-resolver: failed to resolve "${o}" ($prototype: "${a.$prototype}"):`,Ee(l))}}}function WO(e,t){return e.registry?.byName(t)?.classPath}async function UO(e,t,r,n,s){let i=e.$src;if(!i)throw Error(`$prototype "${e.$prototype}" has no $src to resolve`);let o;if(i.startsWith("./")||i.startsWith("../"))o=t.sourcePath?el(Uu(t.sourcePath),i):el(r,i);else o=qO(el(r,"package.json")).resolve(i);let a=FO(o,"utf8"),l=nm(a,o);if(!l.$implementation)throw Error(`${i} has no $implementation field`);let c=el(Uu(o),l.$implementation),d=await Oc(c),p=e.$export??l.title??e.$prototype,h=d[p]??d.default?.[p];if(!h)throw Error(`Module ${l.$implementation} does not export "${p}"`);let m={};for(let[g,y]of Object.entries(e))if(!VO.has(g))m[g]=y;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=Uu(t.sourcePath);m._project={config:s.config??null,root:r,...s.sections},m._document={route:t,state:n};let b=new h(m);if(BO(b))return await b.resolve();return b}var HO,VO;var vy=q(()=>{nn();ve();rr();HO=new Set(["Function","LocalStorage","SessionStorage","Array"]),VO=new Set(["$prototype","$src","$export","timing","default","description"])});var wy=(e)=>typeof e<"u"&&e!==null,zO=(e)=>typeof e==="object",GO=(e)=>Object.prototype.toString.call(e)==="[object Object]",KO=(e)=>typeof e==="function",YO=(e)=>typeof e==="boolean",XO=(e)=>e instanceof Buffer,ZO=(e)=>{if(wy(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},QO=(e)=>e instanceof ArrayBuffer,eC=(e)=>typeof e==="string"&&e.length>0,tC=(e)=>typeof e==="number"&&Number.isFinite(e),rC=(e)=>Number.isInteger(e),nC=(e,t,r)=>e>=t&&e<=r,sC=(e,t)=>t.includes(e),iC=(e,t,r)=>{let n;try{n=String(r).slice(0,100)}catch{}return Error(`Expected ${t} for ${e} but received ${n} of type ${typeof r}`)},oC=(e,t)=>(t.message=e.message,t),u;var Dr=q(()=>{/*!
|
|
331
329
|
Copyright 2013 Lovell Fuller and others.
|
|
332
330
|
SPDX-License-Identifier: Apache-2.0
|
|
333
|
-
*/u={defined:Sy,object:HO,plainObject:VO,fn:WO,bool:BO,buffer:UO,typedArray:zO,arrayBuffer:GO,string:KO,number:YO,integer:XO,inRange:ZO,inArray:QO,invalidParameterError:eC,nativeError:tC}});var Py=C(function(X9,_y){var Ey=()=>process.platform==="linux",sl=null,rC=()=>{if(!sl)if(Ey()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,sl=process.report.getReport(),process.report.excludeNetwork=e}else sl={};return sl};_y.exports={isLinux:Ey,getReport:rC}});var ky=C(function(Z9,jy){var si=Te("fs"),nC=(e)=>{let t=si.openSync(e,"r"),r=Buffer.alloc(2048),n=si.readSync(t,r,0,2048,0);return si.close(t,()=>{}),r.subarray(0,n)},sC=(e)=>new Promise((t,r)=>{si.open(e,"r",(n,s)=>{if(n)r(n);else{let i=Buffer.alloc(2048);si.read(s,i,0,2048,0,(o,a)=>{t(i.subarray(0,a)),si.close(s,()=>{})})}})});jy.exports={LDD_PATH:"/usr/bin/ldd",SELF_PATH:"/proc/self/exe",readFileSync:nC,readFile:sC}});var Ay=C(function(Q9,Ry){var iC=(e)=>{if(e.length<64)return null;if(e.readUInt32BE(0)!==2135247942)return null;if(e.readUInt8(4)!==2)return null;if(e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let s=0;s<n;s++){let i=t+s*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),l=e.readUInt32LE(i+32);return e.subarray(a,a+l).toString().replace(/\0.*$/g,"")}}return null};Ry.exports={interpreterPath:iC}});var ol=C(function(eG,zy){var Cy=Te("child_process"),{isLinux:ii,getReport:Ty}=Py(),{LDD_PATH:il,SELF_PATH:Ny,readFile:Yu,readFileSync:Xu}=ky(),{interpreterPath:Iy}=Ay(),Lr,Fr,qr,Mn="",My=()=>{if(!Mn)return new Promise((e)=>{Cy.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{Mn=t?" ":r,e(Mn)})});return Mn},Jy=()=>{if(!Mn)try{Mn=Cy.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){Mn=" "}return Mn},hn="glibc",Dy=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,vs="musl",oC=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),Ly=()=>{let e=Ty();if(e.header&&e.header.glibcVersionRuntime)return hn;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(oC))return vs}return null},Fy=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(hn))return hn;if(r&&r.includes(vs))return vs;return null},qy=(e)=>{if(e){if(e.includes("/ld-musl-"))return vs;else if(e.includes("/ld-linux-"))return hn}return null},Hy=(e)=>{if(e=e.toString(),e.includes("musl"))return vs;if(e.includes("GNU C Library"))return hn;return null},aC=async()=>{if(Fr!==void 0)return Fr;Fr=null;try{let e=await Yu(il);Fr=Hy(e)}catch(e){}return Fr},lC=()=>{if(Fr!==void 0)return Fr;Fr=null;try{let e=Xu(il);Fr=Hy(e)}catch(e){}return Fr},cC=async()=>{if(Lr!==void 0)return Lr;Lr=null;try{let e=await Yu(Ny),t=Iy(e);Lr=qy(t)}catch(e){}return Lr},uC=()=>{if(Lr!==void 0)return Lr;Lr=null;try{let e=Xu(Ny),t=Iy(e);Lr=qy(t)}catch(e){}return Lr},Vy=async()=>{let e=null;if(ii()){if(e=await cC(),!e){if(e=await aC(),!e)e=Ly();if(!e){let t=await My();e=Fy(t)}}}return e},Wy=()=>{let e=null;if(ii()){if(e=uC(),!e){if(e=lC(),!e)e=Ly();if(!e){let t=Jy();e=Fy(t)}}}return e},dC=async()=>ii()&&await Vy()!==hn,fC=()=>ii()&&Wy()!==hn,pC=async()=>{if(qr!==void 0)return qr;qr=null;try{let t=(await Yu(il)).match(Dy);if(t)qr=t[1]}catch(e){}return qr},mC=()=>{if(qr!==void 0)return qr;qr=null;try{let t=Xu(il).match(Dy);if(t)qr=t[1]}catch(e){}return qr},By=()=>{let e=Ty();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},Oy=(e)=>e.trim().split(/\s+/)[1],Uy=(e)=>{let[t,r,n]=e.split(/[\r\n]+/);if(t&&t.includes(hn))return Oy(t);if(r&&n&&r.includes(vs))return Oy(n);return null},hC=async()=>{let e=null;if(ii()){if(e=await pC(),!e)e=By();if(!e){let t=await My();e=Uy(t)}}return e},gC=()=>{let e=null;if(ii()){if(e=mC(),!e)e=By();if(!e){let t=Jy();e=Uy(t)}}return e};zy.exports={GLIBC:hn,MUSL:vs,family:Vy,familySync:Wy,isNonGlibcLinux:dC,isNonGlibcLinuxSync:fC,version:hC,versionSync:gC}});var oi=C(function(tG,Gy){var yC=Number.MAX_SAFE_INTEGER||9007199254740991,bC=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Gy.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:yC,RELEASE_TYPES:bC,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var fo=C(function(rG,Ky){var xC=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Ky.exports=xC});var ai=C(function(Hr,Yy){var{MAX_SAFE_COMPONENT_LENGTH:Zu,MAX_SAFE_BUILD_LENGTH:$C,MAX_LENGTH:vC}=oi(),wC=fo();Hr=Yy.exports={};var SC=Hr.re=[],EC=Hr.safeRe=[],X=Hr.src=[],_C=Hr.safeSrc=[],Z=Hr.t={},PC=0,Qu="[a-zA-Z0-9-]",jC=[["\\s",1],["\\d",vC],[Qu,$C]],kC=(e)=>{for(let[t,r]of jC)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},be=(e,t,r)=>{let n=kC(t),s=PC++;wC(e,s,t),Z[e]=s,X[s]=t,_C[s]=n,SC[s]=new RegExp(t,r?"g":void 0),EC[s]=new RegExp(n,r?"g":void 0)};be("NUMERICIDENTIFIER","0|[1-9]\\d*");be("NUMERICIDENTIFIERLOOSE","\\d+");be("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Qu}*`);be("MAINVERSION",`(${X[Z.NUMERICIDENTIFIER]})\\.(${X[Z.NUMERICIDENTIFIER]})\\.(${X[Z.NUMERICIDENTIFIER]})`);be("MAINVERSIONLOOSE",`(${X[Z.NUMERICIDENTIFIERLOOSE]})\\.(${X[Z.NUMERICIDENTIFIERLOOSE]})\\.(${X[Z.NUMERICIDENTIFIERLOOSE]})`);be("PRERELEASEIDENTIFIER",`(?:${X[Z.NONNUMERICIDENTIFIER]}|${X[Z.NUMERICIDENTIFIER]})`);be("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Z.NONNUMERICIDENTIFIER]}|${X[Z.NUMERICIDENTIFIERLOOSE]})`);be("PRERELEASE",`(?:-(${X[Z.PRERELEASEIDENTIFIER]}(?:\\.${X[Z.PRERELEASEIDENTIFIER]})*))`);be("PRERELEASELOOSE",`(?:-?(${X[Z.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Z.PRERELEASEIDENTIFIERLOOSE]})*))`);be("BUILDIDENTIFIER",`${Qu}+`);be("BUILD",`(?:\\+(${X[Z.BUILDIDENTIFIER]}(?:\\.${X[Z.BUILDIDENTIFIER]})*))`);be("FULLPLAIN",`v?${X[Z.MAINVERSION]}${X[Z.PRERELEASE]}?${X[Z.BUILD]}?`);be("FULL",`^${X[Z.FULLPLAIN]}$`);be("LOOSEPLAIN",`[v=\\s]*${X[Z.MAINVERSIONLOOSE]}${X[Z.PRERELEASELOOSE]}?${X[Z.BUILD]}?`);be("LOOSE",`^${X[Z.LOOSEPLAIN]}$`);be("GTLT","((?:<|>)?=?)");be("XRANGEIDENTIFIERLOOSE",`${X[Z.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);be("XRANGEIDENTIFIER",`${X[Z.NUMERICIDENTIFIER]}|x|X|\\*`);be("XRANGEPLAIN",`[v=\\s]*(${X[Z.XRANGEIDENTIFIER]})(?:\\.(${X[Z.XRANGEIDENTIFIER]})(?:\\.(${X[Z.XRANGEIDENTIFIER]})(?:${X[Z.PRERELEASE]})?${X[Z.BUILD]}?)?)?`);be("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:${X[Z.PRERELEASELOOSE]})?${X[Z.BUILD]}?)?)?`);be("XRANGE",`^${X[Z.GTLT]}\\s*${X[Z.XRANGEPLAIN]}$`);be("XRANGELOOSE",`^${X[Z.GTLT]}\\s*${X[Z.XRANGEPLAINLOOSE]}$`);be("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Zu}})(?:\\.(\\d{1,${Zu}}))?(?:\\.(\\d{1,${Zu}}))?`);be("COERCE",`${X[Z.COERCEPLAIN]}(?:$|[^\\d])`);be("COERCEFULL",X[Z.COERCEPLAIN]+`(?:${X[Z.PRERELEASE]})?(?:${X[Z.BUILD]})?(?:$|[^\\d])`);be("COERCERTL",X[Z.COERCE],!0);be("COERCERTLFULL",X[Z.COERCEFULL],!0);be("LONETILDE","(?:~>?)");be("TILDETRIM",`(\\s*)${X[Z.LONETILDE]}\\s+`,!0);Hr.tildeTrimReplace="$1~";be("TILDE",`^${X[Z.LONETILDE]}${X[Z.XRANGEPLAIN]}$`);be("TILDELOOSE",`^${X[Z.LONETILDE]}${X[Z.XRANGEPLAINLOOSE]}$`);be("LONECARET","(?:\\^)");be("CARETTRIM",`(\\s*)${X[Z.LONECARET]}\\s+`,!0);Hr.caretTrimReplace="$1^";be("CARET",`^${X[Z.LONECARET]}${X[Z.XRANGEPLAIN]}$`);be("CARETLOOSE",`^${X[Z.LONECARET]}${X[Z.XRANGEPLAINLOOSE]}$`);be("COMPARATORLOOSE",`^${X[Z.GTLT]}\\s*(${X[Z.LOOSEPLAIN]})$|^$`);be("COMPARATOR",`^${X[Z.GTLT]}\\s*(${X[Z.FULLPLAIN]})$|^$`);be("COMPARATORTRIM",`(\\s*)${X[Z.GTLT]}\\s*(${X[Z.LOOSEPLAIN]}|${X[Z.XRANGEPLAIN]})`,!0);Hr.comparatorTrimReplace="$1$2$3";be("HYPHENRANGE",`^\\s*(${X[Z.XRANGEPLAIN]})\\s+-\\s+(${X[Z.XRANGEPLAIN]})\\s*$`);be("HYPHENRANGELOOSE",`^\\s*(${X[Z.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Z.XRANGEPLAINLOOSE]})\\s*$`);be("STAR","(<|>)?=?\\s*\\*");be("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");be("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var al=C(function(nG,Xy){var RC=Object.freeze({loose:!0}),AC=Object.freeze({}),OC=(e)=>{if(!e)return AC;if(typeof e!=="object")return RC;return e};Xy.exports=OC});var ed=C(function(sG,eb){var Zy=/^[0-9]+$/,Qy=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Zy.test(e),n=Zy.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},CC=(e,t)=>Qy(t,e);eb.exports={compareIdentifiers:Qy,rcompareIdentifiers:CC}});var ht=C(function(iG,rb){var ll=fo(),{MAX_LENGTH:tb,MAX_SAFE_INTEGER:cl}=oi(),{safeRe:ul,t:dl}=ai(),TC=al(),{compareIdentifiers:td}=ed(),NC=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(td(e[n],r[n])!==0)return!1;return!0};class Sr{constructor(e,t){if(t=TC(t),e instanceof Sr)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>tb)throw TypeError(`version is longer than ${tb} characters`);ll("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?ul[dl.LOOSE]:ul[dl.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>cl||this.major<0)throw TypeError("Invalid major version");if(this.minor>cl||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>cl||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<cl)return s}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(ll("SemVer.compare",this.version,this.options,e),!(e instanceof Sr)){if(typeof e==="string"&&e===this.version)return 0;e=new Sr(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Sr))e=new Sr(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Sr))e=new Sr(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(ll("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return td(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Sr))e=new Sr(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(ll("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return td(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?ul[dl.PRERELEASELOOSE]:ul[dl.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;while(--s>=0)if(typeof this.prerelease[s]==="number")this.prerelease[s]++,s=-2;if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];if(r===!1)s=[t];if(NC(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=s}else this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}rb.exports=Sr});var Jn=C(function(oG,sb){var nb=ht(),IC=(e,t,r=!1)=>{if(e instanceof nb)return e;try{return new nb(e,t)}catch(n){if(!r)return null;throw n}};sb.exports=IC});var ob=C(function(aG,ib){var MC=Jn(),JC=(e,t)=>{let r=MC(e,t);return r?r.version:null};ib.exports=JC});var lb=C(function(lG,ab){var DC=Jn(),LC=(e,t)=>{let r=DC(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};ab.exports=LC});var db=C(function(cG,ub){var cb=ht(),FC=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new cb(e instanceof cb?e.version:e,r).inc(t,n,s).version}catch(i){return null}};ub.exports=FC});var mb=C(function(uG,pb){var fb=Jn(),qC=(e,t)=>{let r=fb(e,null,!0),n=fb(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let d=l?"pre":"";if(r.major!==n.major)return d+"major";if(r.minor!==n.minor)return d+"minor";if(r.patch!==n.patch)return d+"patch";return"prerelease"};pb.exports=qC});var gb=C(function(dG,hb){var HC=ht(),VC=(e,t)=>new HC(e,t).major;hb.exports=VC});var bb=C(function(fG,yb){var WC=ht(),BC=(e,t)=>new WC(e,t).minor;yb.exports=BC});var $b=C(function(pG,xb){var UC=ht(),zC=(e,t)=>new UC(e,t).patch;xb.exports=zC});var wb=C(function(mG,vb){var GC=Jn(),KC=(e,t)=>{let r=GC(e,t);return r&&r.prerelease.length?r.prerelease:null};vb.exports=KC});var pr=C(function(hG,Eb){var Sb=ht(),YC=(e,t,r)=>new Sb(e,r).compare(new Sb(t,r));Eb.exports=YC});var Pb=C(function(gG,_b){var XC=pr(),ZC=(e,t,r)=>XC(t,e,r);_b.exports=ZC});var kb=C(function(yG,jb){var QC=pr(),eT=(e,t)=>QC(e,t,!0);jb.exports=eT});var fl=C(function(bG,Ab){var Rb=ht(),tT=(e,t,r)=>{let n=new Rb(e,r),s=new Rb(t,r);return n.compare(s)||n.compareBuild(s)};Ab.exports=tT});var Cb=C(function(xG,Ob){var rT=fl(),nT=(e,t)=>e.sort((r,n)=>rT(r,n,t));Ob.exports=nT});var Nb=C(function($G,Tb){var sT=fl(),iT=(e,t)=>e.sort((r,n)=>sT(n,r,t));Tb.exports=iT});var po=C(function(vG,Ib){var oT=pr(),aT=(e,t,r)=>oT(e,t,r)>0;Ib.exports=aT});var pl=C(function(wG,Mb){var lT=pr(),cT=(e,t,r)=>lT(e,t,r)<0;Mb.exports=cT});var rd=C(function(SG,Jb){var uT=pr(),dT=(e,t,r)=>uT(e,t,r)===0;Jb.exports=dT});var nd=C(function(EG,Db){var fT=pr(),pT=(e,t,r)=>fT(e,t,r)!==0;Db.exports=pT});var ml=C(function(_G,Lb){var mT=pr(),hT=(e,t,r)=>mT(e,t,r)>=0;Lb.exports=hT});var hl=C(function(PG,Fb){var gT=pr(),yT=(e,t,r)=>gT(e,t,r)<=0;Fb.exports=yT});var sd=C(function(jG,qb){var bT=rd(),xT=nd(),$T=po(),vT=ml(),wT=pl(),ST=hl(),ET=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return bT(e,r,n);case"!=":return xT(e,r,n);case">":return $T(e,r,n);case">=":return vT(e,r,n);case"<":return wT(e,r,n);case"<=":return ST(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};qb.exports=ET});var Vb=C(function(kG,Hb){var _T=ht(),PT=Jn(),{safeRe:gl,t:yl}=ai(),jT=(e,t)=>{if(e instanceof _T)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?gl[yl.COERCEFULL]:gl[yl.COERCE]);else{let l=t.includePrerelease?gl[yl.COERCERTLFULL]:gl[yl.COERCERTL],c;while((c=l.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;l.lastIndex=c.index+c[1].length+c[2].length}l.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return PT(`${n}.${s}.${i}${o}${a}`,t)};Hb.exports=jT});var Bb=C(function(RG,Wb){var kT=Jn(),RT=oi(),AT=ht(),OT=(e,t,r)=>{if(!RT.RELEASE_TYPES.includes(t))return null;let n=CT(e,r);return n&&TT(n,t)},CT=(e,t)=>{let r=e instanceof AT?e.version:e;return kT(r,t)},TT=(e,t)=>{if(NT(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},NT=(e)=>e.startsWith("pre");Wb.exports=OT});var Gb=C(function(AG,zb){class Ub{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}zb.exports=Ub});var mr=C(function(OG,Zb){var IT=/\s+/g;class mo{constructor(e,t){if(t=JT(t),e instanceof mo)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new mo(e.raw,t);if(e instanceof id)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(IT," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!Yb(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&UT(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(BT,"");let r=((this.options.includePrerelease&&VT)|(this.options.loose&&WT))+":"+e,n=Kb.get(r);if(n)return n;let s=this.options.loose,i=s?Ct[gt.HYPHENRANGELOOSE]:Ct[gt.HYPHENRANGE];e=e.replace(i,nN(this.options.includePrerelease)),qe("hyphen replace",e),e=e.replace(Ct[gt.COMPARATORTRIM],FT),qe("comparator trim",e),e=e.replace(Ct[gt.TILDETRIM],qT),qe("tilde trim",e),e=e.replace(Ct[gt.CARETTRIM],HT),qe("caret trim",e);let o=e.split(" ").map((d)=>zT(d,this.options)).join(" ").split(/\s+/).map((d)=>rN(d,this.options));if(s)o=o.filter((d)=>(qe("loose invalid filter",d,this.options),!!d.match(Ct[gt.COMPARATORLOOSE])));qe("range list",o);let a=new Map,l=o.map((d)=>new id(d,this.options));for(let d of l){if(Yb(d))return[d];a.set(d.value,d)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return Kb.set(r,c),c}intersects(e,t){if(!(e instanceof mo))throw TypeError("a Range is required");return this.set.some((r)=>Xb(r,t)&&e.set.some((n)=>Xb(n,t)&&r.every((s)=>n.every((i)=>s.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new DT(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(sN(this.set[t],e,this.options))return!0;return!1}}Zb.exports=mo;var MT=Gb(),Kb=new MT,JT=al(),id=ho(),qe=fo(),DT=ht(),{safeRe:Ct,src:LT,t:gt,comparatorTrimReplace:FT,tildeTrimReplace:qT,caretTrimReplace:HT}=ai(),{FLAG_INCLUDE_PRERELEASE:VT,FLAG_LOOSE:WT}=oi(),BT=new RegExp(LT[gt.BUILD],"g"),Yb=(e)=>e.value==="<0.0.0-0",UT=(e)=>e.value==="",Xb=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();while(r&&n.length)r=n.every((i)=>s.intersects(i,t)),s=n.pop();return r},zT=(e,t)=>(e=e.replace(Ct[gt.BUILD],""),qe("comp",e,t),e=XT(e,t),qe("caret",e),e=KT(e,t),qe("tildes",e),e=QT(e,t),qe("xrange",e),e=tN(e,t),qe("stars",e),e),at=(e)=>!e||e.toLowerCase()==="x"||e==="*",GT=(e,t,r)=>at(e)&&!at(t)||at(t)&&r&&!at(r),KT=(e,t)=>e.trim().split(/\s+/).map((r)=>YT(r,t)).join(" "),YT=(e,t)=>{let r=t.loose?Ct[gt.TILDELOOSE]:Ct[gt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{qe("tilde",e,s,i,o,a,l);let c;if(at(i))c="";else if(at(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(at(a))c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else if(l)qe("replaceTilde pr",l),c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;return qe("tilde return",c),c})},XT=(e,t)=>e.trim().split(/\s+/).map((r)=>ZT(r,t)).join(" "),ZT=(e,t)=>{qe("caret",e,t);let r=t.loose?Ct[gt.CARETLOOSE]:Ct[gt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{qe("caret",e,s,i,o,a,l);let c;if(at(i))c="";else if(at(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(at(a))if(i==="0")c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`;else if(l)if(qe("replaceCaret pr",l),i==="0")if(o==="0")c=`>=${i}.${o}.${a}-${l} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a}-${l} <${+i+1}.0.0-0`;else if(qe("no pr"),i==="0")if(o==="0")c=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${+i+1}.0.0-0`;return qe("caret return",c),c})},QT=(e,t)=>(qe("replaceXRanges",e,t),e.split(/\s+/).map((r)=>eN(r,t)).join(" ")),eN=(e,t)=>{e=e.trim();let r=t.loose?Ct[gt.XRANGELOOSE]:Ct[gt.XRANGE];return e.replace(r,(n,s,i,o,a,l)=>{if(qe("xRange",e,n,s,i,o,a,l),GT(i,o,a))return e;let c=at(i),d=c||at(o),p=d||at(a),h=p;if(s==="="&&h)s="";if(l=t.includePrerelease?"-0":"",c)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&h){if(d)o=0;if(a=0,s===">")if(s=">=",d)i=+i+1,o=0,a=0;else o=+o+1,a=0;else if(s==="<=")if(s="<",d)i=+i+1;else o=+o+1;if(s==="<")l="-0";n=`${s+i}.${o}.${a}${l}`}else if(d)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(p)n=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`;return qe("xRange return",n),n})},tN=(e,t)=>(qe("replaceStars",e,t),e.trim().replace(Ct[gt.STAR],"")),rN=(e,t)=>(qe("replaceGTE0",e,t),e.trim().replace(Ct[t.includePrerelease?gt.GTE0PRE:gt.GTE0],"")),nN=(e)=>(t,r,n,s,i,o,a,l,c,d,p,h)=>{if(at(n))r="";else if(at(s))r=`>=${n}.0.0${e?"-0":""}`;else if(at(i))r=`>=${n}.${s}.0${e?"-0":""}`;else if(o)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(at(c))l="";else if(at(d))l=`<${+c+1}.0.0-0`;else if(at(p))l=`<${c}.${+d+1}.0-0`;else if(h)l=`<=${c}.${d}.${p}-${h}`;else if(e)l=`<${c}.${d}.${+p+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},sN=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(qe(e[n].semver),e[n].semver===id.ANY)continue;if(e[n].semver.prerelease.length>0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}}return!1}return!0}});var ho=C(function(CG,sx){var go=Symbol("SemVer ANY");class bl{static get ANY(){return go}constructor(e,t){if(t=Qb(t),e instanceof bl)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),ad("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===go)this.value="";else this.value=this.operator+this.semver.version;ad("comp",this)}parse(e){let t=this.options.loose?ex[tx.COMPARATORLOOSE]:ex[tx.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=go;else this.semver=new rx(r[2],this.options.loose)}toString(){return this.value}test(e){if(ad("Comparator.test",e,this.options.loose),this.semver===go||e===go)return!0;if(typeof e==="string")try{e=new rx(e,this.options)}catch(t){return!1}return od(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof bl))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new nx(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new nx(this.value,t).test(e.semver)}if(t=Qb(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(od(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(od(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}sx.exports=bl;var Qb=al(),{safeRe:ex,t:tx}=ai(),od=sd(),ad=fo(),rx=ht(),nx=mr()});var yo=C(function(TG,ix){var iN=mr(),oN=(e,t,r)=>{try{t=new iN(t,r)}catch(n){return!1}return t.test(e)};ix.exports=oN});var ax=C(function(NG,ox){var aN=mr(),lN=(e,t)=>new aN(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));ox.exports=lN});var cx=C(function(IG,lx){var cN=ht(),uN=mr(),dN=(e,t,r)=>{let n=null,s=null,i=null;try{i=new uN(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===-1)n=o,s=new cN(n,r)}}),n};lx.exports=dN});var dx=C(function(MG,ux){var fN=ht(),pN=mr(),mN=(e,t,r)=>{let n=null,s=null,i=null;try{i=new pN(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===1)n=o,s=new fN(n,r)}}),n};ux.exports=mN});var mx=C(function(JG,px){var ld=ht(),hN=mr(),fx=po(),gN=(e,t)=>{e=new hN(e,t);let r=new ld("0.0.0");if(e.test(r))return r;if(r=new ld("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let s=e.set[n],i=null;if(s.forEach((o)=>{let a=new ld(o.semver.version);switch(o.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!i||fx(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||fx(r,i)))r=i}if(r&&e.test(r))return r;return null};px.exports=gN});var gx=C(function(DG,hx){var yN=mr(),bN=(e,t)=>{try{return new yN(e,t).range||"*"}catch(r){return null}};hx.exports=bN});var xl=C(function(LG,$x){var xN=ht(),xx=ho(),{ANY:$N}=xx,vN=mr(),wN=yo(),yx=po(),bx=pl(),SN=hl(),EN=ml(),_N=(e,t,r,n)=>{e=new xN(e,n),t=new vN(t,n);let s,i,o,a,l;switch(r){case">":s=yx,i=SN,o=bx,a=">",l=">=";break;case"<":s=bx,i=EN,o=yx,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(wN(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let d=t.set[c],p=null,h=null;if(d.forEach((m)=>{if(m.semver===$N)m=new xx(">=0.0.0");if(p=p||m,h=h||m,s(m.semver,p.semver,n))p=m;else if(o(m.semver,h.semver,n))h=m}),p.operator===a||p.operator===l)return!1;if((!h.operator||h.operator===a)&&i(e,h.semver))return!1;else if(h.operator===l&&o(e,h.semver))return!1}return!0};$x.exports=_N});var wx=C(function(FG,vx){var PN=xl(),jN=(e,t,r)=>PN(e,t,">",r);vx.exports=jN});var Ex=C(function(qG,Sx){var kN=xl(),RN=(e,t,r)=>kN(e,t,"<",r);Sx.exports=RN});var jx=C(function(HG,Px){var _x=mr(),AN=(e,t,r)=>(e=new _x(e,r),t=new _x(t,r),e.intersects(t,r));Px.exports=AN});var Rx=C(function(VG,kx){var ON=yo(),CN=pr();kx.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((d,p)=>CN(d,p,r));for(let d of o)if(ON(d,t,r)){if(i=d,!s)s=d}else{if(i)n.push([s,i]);i=null,s=null}if(s)n.push([s,null]);let a=[];for(let[d,p]of n)if(d===p)a.push(d);else if(!p&&d===o[0])a.push("*");else if(!p)a.push(`>=${d}`);else if(d===o[0])a.push(`<=${p}`);else a.push(`${d} - ${p}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var Ix=C(function(WG,Nx){var Ax=mr(),dd=ho(),{ANY:cd}=dd,ud=yo(),fd=pr(),TN=(e,t,r={})=>{if(e===t)return!0;e=new Ax(e,r),t=new Ax(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=IN(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},NN=[new dd(">=0.0.0-0")],Ox=[new dd(">=0.0.0")],IN=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===cd)if(t.length===1&&t[0].semver===cd)return!0;else if(r.includePrerelease)e=NN;else e=Ox;if(t.length===1&&t[0].semver===cd)if(r.includePrerelease)return!0;else t=Ox;let n=new Set,s,i;for(let m of e)if(m.operator===">"||m.operator===">=")s=Cx(s,m,r);else if(m.operator==="<"||m.operator==="<=")i=Tx(i,m,r);else n.add(m.semver);if(n.size>1)return null;let o;if(s&&i){if(o=fd(s.semver,i.semver,r),o>0)return null;else if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let m of n){if(s&&!ud(m,String(s),r))return null;if(i&&!ud(m,String(i),r))return null;for(let b of t)if(!ud(m,String(b),r))return!1;return!0}let a,l,c,d,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;if(p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0)p=!1;for(let m of t){if(d=d||m.operator===">"||m.operator===">=",c=c||m.operator==="<"||m.operator==="<=",s){if(h){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===h.major&&m.semver.minor===h.minor&&m.semver.patch===h.patch)h=!1}if(m.operator===">"||m.operator===">="){if(a=Cx(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!m.test(s.semver))return!1}if(i){if(p){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===p.major&&m.semver.minor===p.minor&&m.semver.patch===p.patch)p=!1}if(m.operator==="<"||m.operator==="<="){if(l=Tx(i,m,r),l===m&&l!==i)return!1}else if(i.operator==="<="&&!m.test(i.semver))return!1}if(!m.operator&&(i||s)&&o!==0)return!1}if(s&&c&&!i&&o!==0)return!1;if(i&&d&&!s&&o!==0)return!1;if(h||p)return!1;return!0},Cx=(e,t,r)=>{if(!e)return t;let n=fd(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Tx=(e,t,r)=>{if(!e)return t;let n=fd(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Nx.exports=TN});var Lx=C(function(BG,Dx){var pd=ai(),Mx=oi(),MN=ht(),Jx=ed(),JN=Jn(),DN=ob(),LN=lb(),FN=db(),qN=mb(),HN=gb(),VN=bb(),WN=$b(),BN=wb(),UN=pr(),zN=Pb(),GN=kb(),KN=fl(),YN=Cb(),XN=Nb(),ZN=po(),QN=pl(),eI=rd(),tI=nd(),rI=ml(),nI=hl(),sI=sd(),iI=Vb(),oI=Bb(),aI=ho(),lI=mr(),cI=yo(),uI=ax(),dI=cx(),fI=dx(),pI=mx(),mI=gx(),hI=xl(),gI=wx(),yI=Ex(),bI=jx(),xI=Rx(),$I=Ix();Dx.exports={parse:JN,valid:DN,clean:LN,inc:FN,diff:qN,major:HN,minor:VN,patch:WN,prerelease:BN,compare:UN,rcompare:zN,compareLoose:GN,compareBuild:KN,sort:YN,rsort:XN,gt:ZN,lt:QN,eq:eI,neq:tI,gte:rI,lte:nI,cmp:sI,coerce:iI,truncate:oI,Comparator:aI,Range:lI,satisfies:cI,toComparators:uI,maxSatisfying:dI,minSatisfying:fI,minVersion:pI,validRange:mI,outside:hI,gtr:gI,ltr:yI,intersects:bI,simplifyRange:xI,subset:$I,SemVer:MN,re:pd.re,src:pd.src,tokens:pd.t,SEMVER_SPEC_VERSION:Mx.SEMVER_SPEC_VERSION,RELEASE_TYPES:Mx.RELEASE_TYPES,compareIdentifiers:Jx.compareIdentifiers,rcompareIdentifiers:Jx.rcompareIdentifiers}});var gn;var $l=q(()=>{gn={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.35.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unnebäck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix Bünemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","Jérémy Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kotěšovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugué <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>","Dmytro Tiapukhin <cool.gegeg@gmail.com>","Florian Lefebvre <contact@florian-lefebvre.dev>"],scripts:{build:"node install/build.js","build:dist":"node scripts/build.mjs",clean:"rm -rf src/build/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types && npm run lint-publish","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-publish":"publint --strict","lint-types":"tsd --files ./test/types/sharp.test-d.{cts,mts}","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-wasm-wrappers":"node npm/wasm-wrappers.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",files:["dist","install","lib/index.d.ts","src/*.{cc,h,gyp}"],main:"./dist/index.cjs",module:"./dist/index.mjs",types:"./dist/index.d.mts",exports:{".":{import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}}},sideEffects:!0,repository:{type:"git",url:"git+https://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.1.0","detect-libc":"^2.1.2",semver:"^7.8.5"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.35.5","@img/sharp-darwin-x64":"0.35.5","@img/sharp-freebsd-wasm32":"0.35.5","@img/sharp-libvips-darwin-arm64":"1.3.4","@img/sharp-libvips-darwin-x64":"1.3.4","@img/sharp-libvips-linux-arm":"1.3.4","@img/sharp-libvips-linux-arm64":"1.3.4","@img/sharp-libvips-linux-ppc64":"1.3.4","@img/sharp-libvips-linux-riscv64":"1.3.4","@img/sharp-libvips-linux-s390x":"1.3.4","@img/sharp-libvips-linux-x64":"1.3.4","@img/sharp-libvips-linuxmusl-arm64":"1.3.4","@img/sharp-libvips-linuxmusl-x64":"1.3.4","@img/sharp-linux-arm":"0.35.5","@img/sharp-linux-arm64":"0.35.5","@img/sharp-linux-ppc64":"0.35.5","@img/sharp-linux-riscv64":"0.35.5","@img/sharp-linux-s390x":"0.35.5","@img/sharp-linux-x64":"0.35.5","@img/sharp-linuxmusl-arm64":"0.35.5","@img/sharp-linuxmusl-x64":"0.35.5","@img/sharp-webcontainers-wasm32":"0.35.5","@img/sharp-win32-arm64":"0.35.5","@img/sharp-win32-ia32":"0.35.5","@img/sharp-win32-x64":"0.35.5"},peerDependenciesMeta:{"@types/node":{optional:!0}},devDependencies:{"@biomejs/biome":"^2.5.14","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.11.3","@img/sharp-libvips-dev":"1.3.4","@img/sharp-libvips-dev-wasm32":"1.3.4","@img/sharp-libvips-win32-arm64":"1.3.4","@img/sharp-libvips-win32-ia32":"1.3.4","@img/sharp-libvips-win32-x64":"1.3.4","@types/node":"*",emnapi:"^1.11.3","exif-reader":"^2.0.3",icc:"^4.0.0","node-addon-api":"^8.9.2","node-gyp":"^12.4.0",publint:"^0.3.24","tar-fs":"^3.1.3",tsd:"^0.33.0",yauzl:"^3.4.0"},license:"Apache-2.0",engines:{node:">=20.9.0"},config:{libvips:">=8.18.7"},funding:{url:"https://opencollective.com/libvips"}}});import{spawnSync as bo}from"node:child_process";import{createHash as wI}from"node:crypto";var xo,hd,SI,qx,EI,gd,_I=(e)=>{if(e instanceof Error)console.error(`sharp: Installation error: ${e.message}`);else console.log(`sharp: ${e}`)},Hx=()=>hd.default.isNonGlibcLinuxSync()?hd.default.familySync():"",PI=()=>`${process.platform}${Hx()}-${process.arch}`,li=()=>{if(Vx())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r==="string"?r:Hx();return`${t||process.platform}${n}-${e||process.arch}`},jI=()=>{try{return Te(`@img/sharp-libvips-dev-${li()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},kI=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},RI=()=>{try{return Te(`@img/sharp-libvips-dev-${li()}/lib`)}catch{try{return Te(`@img/sharp-libvips-${li()}/lib`)}catch{}}return""},AI=()=>{if(process.release?.name==="node"&&process.versions){if(!xo.default.satisfies(process.versions.node,gn.engines.node))return{found:process.versions.node,expected:gn.engines.node}}},Vx=()=>{let{CC:e}=process.env;return Boolean(e?.endsWith("/emcc"))},OI=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(bo("sysctl sysctl.proc_translated",gd).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},Fx=(e)=>wI("sha512").update(e).digest("hex"),CI=()=>{try{let e=Fx(`imgsharp-libvips-${li()}`),t=xo.default.coerce(gn.optionalDependencies[`@img/sharp-libvips-${li()}`],{includePrerelease:!0}).version;return Fx(`${e}npm:${t}`).slice(0,10)}catch{}return""},TI=()=>bo(`node-gyp rebuild --directory=src ${Vx()?"--nodedir=emscripten":""}`,{...gd,stdio:"inherit"}).status,Wx=()=>{if(process.platform!=="win32")return(bo("pkg-config --modversion vips-cpp",{...gd,env:{...process.env,PKG_CONFIG_PATH:Bx()}}).stdout||"").trim();else return""},NI=()=>{try{let e=(bo("brew",["--prefix"],{encoding:"utf8"}).stdout||"").trim();if(e)return`${e}/lib/pkgconfig`}catch(e){}return},II=()=>{try{let e=(bo("pkg-config",["--variable","pc_path","pkg-config"],{encoding:"utf8"}).stdout||"").trim();if(e)return e}catch(e){}return},Bx=()=>{if(process.platform!=="win32")return[NI(),II(),process.env.PKG_CONFIG_PATH].filter(Boolean).join(":");else return""},md=(e,t,r)=>{if(r)r(`Detected ${t}, skipping search for globally-installed libvips`);return e},MI=(e)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return md(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return md(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(OI())return md(!1,"Rosetta",e);let t=Wx();return!!t&&xo.default.gte(t,qx)},vl;var yd=q(()=>{$l();xo=kt(Lx(),1),hd=kt(ol(),1);/*!
|
|
331
|
+
*/u={defined:wy,object:zO,plainObject:GO,fn:KO,bool:YO,buffer:XO,typedArray:ZO,arrayBuffer:QO,string:eC,number:tC,integer:rC,inRange:nC,inArray:sC,invalidParameterError:iC,nativeError:oC}});var _y=C(function(lG,Ey){var Sy=()=>process.platform==="linux",tl=null,aC=()=>{if(!tl)if(Sy()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,tl=process.report.getReport(),process.report.excludeNetwork=e}else tl={};return tl};Ey.exports={isLinux:Sy,getReport:aC}});var jy=C(function(cG,Py){var si=Ne("fs"),lC=(e)=>{let t=si.openSync(e,"r"),r=Buffer.alloc(2048),n=si.readSync(t,r,0,2048,0);return si.close(t,()=>{}),r.subarray(0,n)},cC=(e)=>new Promise((t,r)=>{si.open(e,"r",(n,s)=>{if(n)r(n);else{let i=Buffer.alloc(2048);si.read(s,i,0,2048,0,(o,a)=>{t(i.subarray(0,a)),si.close(s,()=>{})})}})});Py.exports={LDD_PATH:"/usr/bin/ldd",SELF_PATH:"/proc/self/exe",readFileSync:lC,readFile:cC}});var Ry=C(function(uG,ky){var uC=(e)=>{if(e.length<64)return null;if(e.readUInt32BE(0)!==2135247942)return null;if(e.readUInt8(4)!==2)return null;if(e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let s=0;s<n;s++){let i=t+s*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),l=e.readUInt32LE(i+32);return e.subarray(a,a+l).toString().replace(/\0.*$/g,"")}}return null};ky.exports={interpreterPath:uC}});var nl=C(function(dG,Uy){var Oy=Ne("child_process"),{isLinux:ii,getReport:Cy}=_y(),{LDD_PATH:rl,SELF_PATH:Ny,readFile:zu,readFileSync:Gu}=jy(),{interpreterPath:Ty}=Ry(),Lr,Fr,qr,Jn="",Iy=()=>{if(!Jn)return new Promise((e)=>{Oy.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{Jn=t?" ":r,e(Jn)})});return Jn},My=()=>{if(!Jn)try{Jn=Oy.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){Jn=" "}return Jn},hn="glibc",Jy=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,vs="musl",dC=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),Dy=()=>{let e=Cy();if(e.header&&e.header.glibcVersionRuntime)return hn;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(dC))return vs}return null},Ly=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(hn))return hn;if(r&&r.includes(vs))return vs;return null},Fy=(e)=>{if(e){if(e.includes("/ld-musl-"))return vs;else if(e.includes("/ld-linux-"))return hn}return null},qy=(e)=>{if(e=e.toString(),e.includes("musl"))return vs;if(e.includes("GNU C Library"))return hn;return null},fC=async()=>{if(Fr!==void 0)return Fr;Fr=null;try{let e=await zu(rl);Fr=qy(e)}catch(e){}return Fr},pC=()=>{if(Fr!==void 0)return Fr;Fr=null;try{let e=Gu(rl);Fr=qy(e)}catch(e){}return Fr},mC=async()=>{if(Lr!==void 0)return Lr;Lr=null;try{let e=await zu(Ny),t=Ty(e);Lr=Fy(t)}catch(e){}return Lr},hC=()=>{if(Lr!==void 0)return Lr;Lr=null;try{let e=Gu(Ny),t=Ty(e);Lr=Fy(t)}catch(e){}return Lr},Hy=async()=>{let e=null;if(ii()){if(e=await mC(),!e){if(e=await fC(),!e)e=Dy();if(!e){let t=await Iy();e=Ly(t)}}}return e},Vy=()=>{let e=null;if(ii()){if(e=hC(),!e){if(e=pC(),!e)e=Dy();if(!e){let t=My();e=Ly(t)}}}return e},gC=async()=>ii()&&await Hy()!==hn,yC=()=>ii()&&Vy()!==hn,bC=async()=>{if(qr!==void 0)return qr;qr=null;try{let t=(await zu(rl)).match(Jy);if(t)qr=t[1]}catch(e){}return qr},xC=()=>{if(qr!==void 0)return qr;qr=null;try{let t=Gu(rl).match(Jy);if(t)qr=t[1]}catch(e){}return qr},By=()=>{let e=Cy();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},Ay=(e)=>e.trim().split(/\s+/)[1],Wy=(e)=>{let[t,r,n]=e.split(/[\r\n]+/);if(t&&t.includes(hn))return Ay(t);if(r&&n&&r.includes(vs))return Ay(n);return null},$C=async()=>{let e=null;if(ii()){if(e=await bC(),!e)e=By();if(!e){let t=await Iy();e=Wy(t)}}return e},vC=()=>{let e=null;if(ii()){if(e=xC(),!e)e=By();if(!e){let t=My();e=Wy(t)}}return e};Uy.exports={GLIBC:hn,MUSL:vs,family:Hy,familySync:Vy,isNonGlibcLinux:gC,isNonGlibcLinuxSync:yC,version:$C,versionSync:vC}});var oi=C(function(fG,zy){var wC=Number.MAX_SAFE_INTEGER||9007199254740991,SC=["major","premajor","minor","preminor","patch","prepatch","prerelease"];zy.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:wC,RELEASE_TYPES:SC,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var co=C(function(pG,Gy){var EC=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Gy.exports=EC});var ai=C(function(Hr,Ky){var{MAX_SAFE_COMPONENT_LENGTH:Ku,MAX_SAFE_BUILD_LENGTH:_C,MAX_LENGTH:PC}=oi(),jC=co();Hr=Ky.exports={};var kC=Hr.re=[],RC=Hr.safeRe=[],X=Hr.src=[],AC=Hr.safeSrc=[],Z=Hr.t={},OC=0,Yu="[a-zA-Z0-9-]",CC=[["\\s",1],["\\d",PC],[Yu,_C]],NC=(e)=>{for(let[t,r]of CC)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},be=(e,t,r)=>{let n=NC(t),s=OC++;jC(e,s,t),Z[e]=s,X[s]=t,AC[s]=n,kC[s]=new RegExp(t,r?"g":void 0),RC[s]=new RegExp(n,r?"g":void 0)};be("NUMERICIDENTIFIER","0|[1-9]\\d*");be("NUMERICIDENTIFIERLOOSE","\\d+");be("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Yu}*`);be("MAINVERSION",`(${X[Z.NUMERICIDENTIFIER]})\\.(${X[Z.NUMERICIDENTIFIER]})\\.(${X[Z.NUMERICIDENTIFIER]})`);be("MAINVERSIONLOOSE",`(${X[Z.NUMERICIDENTIFIERLOOSE]})\\.(${X[Z.NUMERICIDENTIFIERLOOSE]})\\.(${X[Z.NUMERICIDENTIFIERLOOSE]})`);be("PRERELEASEIDENTIFIER",`(?:${X[Z.NONNUMERICIDENTIFIER]}|${X[Z.NUMERICIDENTIFIER]})`);be("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Z.NONNUMERICIDENTIFIER]}|${X[Z.NUMERICIDENTIFIERLOOSE]})`);be("PRERELEASE",`(?:-(${X[Z.PRERELEASEIDENTIFIER]}(?:\\.${X[Z.PRERELEASEIDENTIFIER]})*))`);be("PRERELEASELOOSE",`(?:-?(${X[Z.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Z.PRERELEASEIDENTIFIERLOOSE]})*))`);be("BUILDIDENTIFIER",`${Yu}+`);be("BUILD",`(?:\\+(${X[Z.BUILDIDENTIFIER]}(?:\\.${X[Z.BUILDIDENTIFIER]})*))`);be("FULLPLAIN",`v?${X[Z.MAINVERSION]}${X[Z.PRERELEASE]}?${X[Z.BUILD]}?`);be("FULL",`^${X[Z.FULLPLAIN]}$`);be("LOOSEPLAIN",`[v=\\s]*${X[Z.MAINVERSIONLOOSE]}${X[Z.PRERELEASELOOSE]}?${X[Z.BUILD]}?`);be("LOOSE",`^${X[Z.LOOSEPLAIN]}$`);be("GTLT","((?:<|>)?=?)");be("XRANGEIDENTIFIERLOOSE",`${X[Z.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);be("XRANGEIDENTIFIER",`${X[Z.NUMERICIDENTIFIER]}|x|X|\\*`);be("XRANGEPLAIN",`[v=\\s]*(${X[Z.XRANGEIDENTIFIER]})(?:\\.(${X[Z.XRANGEIDENTIFIER]})(?:\\.(${X[Z.XRANGEIDENTIFIER]})(?:${X[Z.PRERELEASE]})?${X[Z.BUILD]}?)?)?`);be("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:${X[Z.PRERELEASELOOSE]})?${X[Z.BUILD]}?)?)?`);be("XRANGE",`^${X[Z.GTLT]}\\s*${X[Z.XRANGEPLAIN]}$`);be("XRANGELOOSE",`^${X[Z.GTLT]}\\s*${X[Z.XRANGEPLAINLOOSE]}$`);be("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ku}})(?:\\.(\\d{1,${Ku}}))?(?:\\.(\\d{1,${Ku}}))?`);be("COERCE",`${X[Z.COERCEPLAIN]}(?:$|[^\\d])`);be("COERCEFULL",X[Z.COERCEPLAIN]+`(?:${X[Z.PRERELEASE]})?(?:${X[Z.BUILD]})?(?:$|[^\\d])`);be("COERCERTL",X[Z.COERCE],!0);be("COERCERTLFULL",X[Z.COERCEFULL],!0);be("LONETILDE","(?:~>?)");be("TILDETRIM",`(\\s*)${X[Z.LONETILDE]}\\s+`,!0);Hr.tildeTrimReplace="$1~";be("TILDE",`^${X[Z.LONETILDE]}${X[Z.XRANGEPLAIN]}$`);be("TILDELOOSE",`^${X[Z.LONETILDE]}${X[Z.XRANGEPLAINLOOSE]}$`);be("LONECARET","(?:\\^)");be("CARETTRIM",`(\\s*)${X[Z.LONECARET]}\\s+`,!0);Hr.caretTrimReplace="$1^";be("CARET",`^${X[Z.LONECARET]}${X[Z.XRANGEPLAIN]}$`);be("CARETLOOSE",`^${X[Z.LONECARET]}${X[Z.XRANGEPLAINLOOSE]}$`);be("COMPARATORLOOSE",`^${X[Z.GTLT]}\\s*(${X[Z.LOOSEPLAIN]})$|^$`);be("COMPARATOR",`^${X[Z.GTLT]}\\s*(${X[Z.FULLPLAIN]})$|^$`);be("COMPARATORTRIM",`(\\s*)${X[Z.GTLT]}\\s*(${X[Z.LOOSEPLAIN]}|${X[Z.XRANGEPLAIN]})`,!0);Hr.comparatorTrimReplace="$1$2$3";be("HYPHENRANGE",`^\\s*(${X[Z.XRANGEPLAIN]})\\s+-\\s+(${X[Z.XRANGEPLAIN]})\\s*$`);be("HYPHENRANGELOOSE",`^\\s*(${X[Z.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Z.XRANGEPLAINLOOSE]})\\s*$`);be("STAR","(<|>)?=?\\s*\\*");be("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");be("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var sl=C(function(mG,Yy){var TC=Object.freeze({loose:!0}),IC=Object.freeze({}),MC=(e)=>{if(!e)return IC;if(typeof e!=="object")return TC;return e};Yy.exports=MC});var Xu=C(function(hG,Qy){var Xy=/^[0-9]+$/,Zy=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Xy.test(e),n=Xy.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},JC=(e,t)=>Zy(t,e);Qy.exports={compareIdentifiers:Zy,rcompareIdentifiers:JC}});var ht=C(function(gG,tb){var il=co(),{MAX_LENGTH:eb,MAX_SAFE_INTEGER:ol}=oi(),{safeRe:al,t:ll}=ai(),DC=sl(),{compareIdentifiers:Zu}=Xu(),LC=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Zu(e[n],r[n])!==0)return!1;return!0};class Sr{constructor(e,t){if(t=DC(t),e instanceof Sr)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>eb)throw TypeError(`version is longer than ${eb} characters`);il("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?al[ll.LOOSE]:al[ll.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>ol||this.major<0)throw TypeError("Invalid major version");if(this.minor>ol||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>ol||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<ol)return s}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(il("SemVer.compare",this.version,this.options,e),!(e instanceof Sr)){if(typeof e==="string"&&e===this.version)return 0;e=new Sr(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Sr))e=new Sr(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Sr))e=new Sr(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(il("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Zu(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Sr))e=new Sr(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(il("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Zu(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?al[ll.PRERELEASELOOSE]:al[ll.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;while(--s>=0)if(typeof this.prerelease[s]==="number")this.prerelease[s]++,s=-2;if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];if(r===!1)s=[t];if(LC(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=s}else this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}tb.exports=Sr});var Dn=C(function(yG,nb){var rb=ht(),FC=(e,t,r=!1)=>{if(e instanceof rb)return e;try{return new rb(e,t)}catch(n){if(!r)return null;throw n}};nb.exports=FC});var ib=C(function(bG,sb){var qC=Dn(),HC=(e,t)=>{let r=qC(e,t);return r?r.version:null};sb.exports=HC});var ab=C(function(xG,ob){var VC=Dn(),BC=(e,t)=>{let r=VC(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};ob.exports=BC});var ub=C(function($G,cb){var lb=ht(),WC=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new lb(e instanceof lb?e.version:e,r).inc(t,n,s).version}catch(i){return null}};cb.exports=WC});var pb=C(function(vG,fb){var db=Dn(),UC=(e,t)=>{let r=db(e,null,!0),n=db(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let d=l?"pre":"";if(r.major!==n.major)return d+"major";if(r.minor!==n.minor)return d+"minor";if(r.patch!==n.patch)return d+"patch";return"prerelease"};fb.exports=UC});var hb=C(function(wG,mb){var zC=ht(),GC=(e,t)=>new zC(e,t).major;mb.exports=GC});var yb=C(function(SG,gb){var KC=ht(),YC=(e,t)=>new KC(e,t).minor;gb.exports=YC});var xb=C(function(EG,bb){var XC=ht(),ZC=(e,t)=>new XC(e,t).patch;bb.exports=ZC});var vb=C(function(_G,$b){var QC=Dn(),eN=(e,t)=>{let r=QC(e,t);return r&&r.prerelease.length?r.prerelease:null};$b.exports=eN});var pr=C(function(PG,Sb){var wb=ht(),tN=(e,t,r)=>new wb(e,r).compare(new wb(t,r));Sb.exports=tN});var _b=C(function(jG,Eb){var rN=pr(),nN=(e,t,r)=>rN(t,e,r);Eb.exports=nN});var jb=C(function(kG,Pb){var sN=pr(),iN=(e,t)=>sN(e,t,!0);Pb.exports=iN});var cl=C(function(RG,Rb){var kb=ht(),oN=(e,t,r)=>{let n=new kb(e,r),s=new kb(t,r);return n.compare(s)||n.compareBuild(s)};Rb.exports=oN});var Ob=C(function(AG,Ab){var aN=cl(),lN=(e,t)=>e.sort((r,n)=>aN(r,n,t));Ab.exports=lN});var Nb=C(function(OG,Cb){var cN=cl(),uN=(e,t)=>e.sort((r,n)=>cN(n,r,t));Cb.exports=uN});var uo=C(function(CG,Tb){var dN=pr(),fN=(e,t,r)=>dN(e,t,r)>0;Tb.exports=fN});var ul=C(function(NG,Ib){var pN=pr(),mN=(e,t,r)=>pN(e,t,r)<0;Ib.exports=mN});var Qu=C(function(TG,Mb){var hN=pr(),gN=(e,t,r)=>hN(e,t,r)===0;Mb.exports=gN});var ed=C(function(IG,Jb){var yN=pr(),bN=(e,t,r)=>yN(e,t,r)!==0;Jb.exports=bN});var dl=C(function(MG,Db){var xN=pr(),$N=(e,t,r)=>xN(e,t,r)>=0;Db.exports=$N});var fl=C(function(JG,Lb){var vN=pr(),wN=(e,t,r)=>vN(e,t,r)<=0;Lb.exports=wN});var td=C(function(DG,Fb){var SN=Qu(),EN=ed(),_N=uo(),PN=dl(),jN=ul(),kN=fl(),RN=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return SN(e,r,n);case"!=":return EN(e,r,n);case">":return _N(e,r,n);case">=":return PN(e,r,n);case"<":return jN(e,r,n);case"<=":return kN(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};Fb.exports=RN});var Hb=C(function(LG,qb){var AN=ht(),ON=Dn(),{safeRe:pl,t:ml}=ai(),CN=(e,t)=>{if(e instanceof AN)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?pl[ml.COERCEFULL]:pl[ml.COERCE]);else{let l=t.includePrerelease?pl[ml.COERCERTLFULL]:pl[ml.COERCERTL],c;while((c=l.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;l.lastIndex=c.index+c[1].length+c[2].length}l.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return ON(`${n}.${s}.${i}${o}${a}`,t)};qb.exports=CN});var Bb=C(function(FG,Vb){var NN=Dn(),TN=oi(),IN=ht(),MN=(e,t,r)=>{if(!TN.RELEASE_TYPES.includes(t))return null;let n=JN(e,r);return n&&DN(n,t)},JN=(e,t)=>{let r=e instanceof IN?e.version:e;return NN(r,t)},DN=(e,t)=>{if(LN(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},LN=(e)=>e.startsWith("pre");Vb.exports=MN});var zb=C(function(qG,Ub){class Wb{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}Ub.exports=Wb});var mr=C(function(HG,Xb){var FN=/\s+/g;class fo{constructor(e,t){if(t=HN(t),e instanceof fo)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new fo(e.raw,t);if(e instanceof rd)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(FN," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!Kb(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&XN(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(YN,"");let r=((this.options.includePrerelease&&GN)|(this.options.loose&&KN))+":"+e,n=Gb.get(r);if(n)return n;let s=this.options.loose,i=s?Ot[gt.HYPHENRANGELOOSE]:Ot[gt.HYPHENRANGE];e=e.replace(i,lT(this.options.includePrerelease)),qe("hyphen replace",e),e=e.replace(Ot[gt.COMPARATORTRIM],WN),qe("comparator trim",e),e=e.replace(Ot[gt.TILDETRIM],UN),qe("tilde trim",e),e=e.replace(Ot[gt.CARETTRIM],zN),qe("caret trim",e);let o=e.split(" ").map((d)=>ZN(d,this.options)).join(" ").split(/\s+/).map((d)=>aT(d,this.options));if(s)o=o.filter((d)=>(qe("loose invalid filter",d,this.options),!!d.match(Ot[gt.COMPARATORLOOSE])));qe("range list",o);let a=new Map,l=o.map((d)=>new rd(d,this.options));for(let d of l){if(Kb(d))return[d];a.set(d.value,d)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return Gb.set(r,c),c}intersects(e,t){if(!(e instanceof fo))throw TypeError("a Range is required");return this.set.some((r)=>Yb(r,t)&&e.set.some((n)=>Yb(n,t)&&r.every((s)=>n.every((i)=>s.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new VN(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(cT(this.set[t],e,this.options))return!0;return!1}}Xb.exports=fo;var qN=zb(),Gb=new qN,HN=sl(),rd=po(),qe=co(),VN=ht(),{safeRe:Ot,src:BN,t:gt,comparatorTrimReplace:WN,tildeTrimReplace:UN,caretTrimReplace:zN}=ai(),{FLAG_INCLUDE_PRERELEASE:GN,FLAG_LOOSE:KN}=oi(),YN=new RegExp(BN[gt.BUILD],"g"),Kb=(e)=>e.value==="<0.0.0-0",XN=(e)=>e.value==="",Yb=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();while(r&&n.length)r=n.every((i)=>s.intersects(i,t)),s=n.pop();return r},ZN=(e,t)=>(e=e.replace(Ot[gt.BUILD],""),qe("comp",e,t),e=rT(e,t),qe("caret",e),e=eT(e,t),qe("tildes",e),e=sT(e,t),qe("xrange",e),e=oT(e,t),qe("stars",e),e),at=(e)=>!e||e.toLowerCase()==="x"||e==="*",QN=(e,t,r)=>at(e)&&!at(t)||at(t)&&r&&!at(r),eT=(e,t)=>e.trim().split(/\s+/).map((r)=>tT(r,t)).join(" "),tT=(e,t)=>{let r=t.loose?Ot[gt.TILDELOOSE]:Ot[gt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{qe("tilde",e,s,i,o,a,l);let c;if(at(i))c="";else if(at(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(at(a))c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else if(l)qe("replaceTilde pr",l),c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;return qe("tilde return",c),c})},rT=(e,t)=>e.trim().split(/\s+/).map((r)=>nT(r,t)).join(" "),nT=(e,t)=>{qe("caret",e,t);let r=t.loose?Ot[gt.CARETLOOSE]:Ot[gt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{qe("caret",e,s,i,o,a,l);let c;if(at(i))c="";else if(at(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(at(a))if(i==="0")c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`;else if(l)if(qe("replaceCaret pr",l),i==="0")if(o==="0")c=`>=${i}.${o}.${a}-${l} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a}-${l} <${+i+1}.0.0-0`;else if(qe("no pr"),i==="0")if(o==="0")c=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${+i+1}.0.0-0`;return qe("caret return",c),c})},sT=(e,t)=>(qe("replaceXRanges",e,t),e.split(/\s+/).map((r)=>iT(r,t)).join(" ")),iT=(e,t)=>{e=e.trim();let r=t.loose?Ot[gt.XRANGELOOSE]:Ot[gt.XRANGE];return e.replace(r,(n,s,i,o,a,l)=>{if(qe("xRange",e,n,s,i,o,a,l),QN(i,o,a))return e;let c=at(i),d=c||at(o),p=d||at(a),h=p;if(s==="="&&h)s="";if(l=t.includePrerelease?"-0":"",c)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&h){if(d)o=0;if(a=0,s===">")if(s=">=",d)i=+i+1,o=0,a=0;else o=+o+1,a=0;else if(s==="<=")if(s="<",d)i=+i+1;else o=+o+1;if(s==="<")l="-0";n=`${s+i}.${o}.${a}${l}`}else if(d)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(p)n=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`;return qe("xRange return",n),n})},oT=(e,t)=>(qe("replaceStars",e,t),e.trim().replace(Ot[gt.STAR],"")),aT=(e,t)=>(qe("replaceGTE0",e,t),e.trim().replace(Ot[t.includePrerelease?gt.GTE0PRE:gt.GTE0],"")),lT=(e)=>(t,r,n,s,i,o,a,l,c,d,p,h)=>{if(at(n))r="";else if(at(s))r=`>=${n}.0.0${e?"-0":""}`;else if(at(i))r=`>=${n}.${s}.0${e?"-0":""}`;else if(o)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(at(c))l="";else if(at(d))l=`<${+c+1}.0.0-0`;else if(at(p))l=`<${c}.${+d+1}.0-0`;else if(h)l=`<=${c}.${d}.${p}-${h}`;else if(e)l=`<${c}.${d}.${+p+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},cT=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(qe(e[n].semver),e[n].semver===rd.ANY)continue;if(e[n].semver.prerelease.length>0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}}return!1}return!0}});var po=C(function(VG,nx){var mo=Symbol("SemVer ANY");class hl{static get ANY(){return mo}constructor(e,t){if(t=Zb(t),e instanceof hl)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),sd("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===mo)this.value="";else this.value=this.operator+this.semver.version;sd("comp",this)}parse(e){let t=this.options.loose?Qb[ex.COMPARATORLOOSE]:Qb[ex.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=mo;else this.semver=new tx(r[2],this.options.loose)}toString(){return this.value}test(e){if(sd("Comparator.test",e,this.options.loose),this.semver===mo||e===mo)return!0;if(typeof e==="string")try{e=new tx(e,this.options)}catch(t){return!1}return nd(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof hl))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new rx(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new rx(this.value,t).test(e.semver)}if(t=Zb(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(nd(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(nd(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}nx.exports=hl;var Zb=sl(),{safeRe:Qb,t:ex}=ai(),nd=td(),sd=co(),tx=ht(),rx=mr()});var ho=C(function(BG,sx){var uT=mr(),dT=(e,t,r)=>{try{t=new uT(t,r)}catch(n){return!1}return t.test(e)};sx.exports=dT});var ox=C(function(WG,ix){var fT=mr(),pT=(e,t)=>new fT(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));ix.exports=pT});var lx=C(function(UG,ax){var mT=ht(),hT=mr(),gT=(e,t,r)=>{let n=null,s=null,i=null;try{i=new hT(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===-1)n=o,s=new mT(n,r)}}),n};ax.exports=gT});var ux=C(function(zG,cx){var yT=ht(),bT=mr(),xT=(e,t,r)=>{let n=null,s=null,i=null;try{i=new bT(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===1)n=o,s=new yT(n,r)}}),n};cx.exports=xT});var px=C(function(GG,fx){var id=ht(),$T=mr(),dx=uo(),vT=(e,t)=>{e=new $T(e,t);let r=new id("0.0.0");if(e.test(r))return r;if(r=new id("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let s=e.set[n],i=null;if(s.forEach((o)=>{let a=new id(o.semver.version);switch(o.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!i||dx(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||dx(r,i)))r=i}if(r&&e.test(r))return r;return null};fx.exports=vT});var hx=C(function(KG,mx){var wT=mr(),ST=(e,t)=>{try{return new wT(e,t).range||"*"}catch(r){return null}};mx.exports=ST});var gl=C(function(YG,xx){var ET=ht(),bx=po(),{ANY:_T}=bx,PT=mr(),jT=ho(),gx=uo(),yx=ul(),kT=fl(),RT=dl(),AT=(e,t,r,n)=>{e=new ET(e,n),t=new PT(t,n);let s,i,o,a,l;switch(r){case">":s=gx,i=kT,o=yx,a=">",l=">=";break;case"<":s=yx,i=RT,o=gx,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(jT(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let d=t.set[c],p=null,h=null;if(d.forEach((m)=>{if(m.semver===_T)m=new bx(">=0.0.0");if(p=p||m,h=h||m,s(m.semver,p.semver,n))p=m;else if(o(m.semver,h.semver,n))h=m}),p.operator===a||p.operator===l)return!1;if((!h.operator||h.operator===a)&&i(e,h.semver))return!1;else if(h.operator===l&&o(e,h.semver))return!1}return!0};xx.exports=AT});var vx=C(function(XG,$x){var OT=gl(),CT=(e,t,r)=>OT(e,t,">",r);$x.exports=CT});var Sx=C(function(ZG,wx){var NT=gl(),TT=(e,t,r)=>NT(e,t,"<",r);wx.exports=TT});var Px=C(function(QG,_x){var Ex=mr(),IT=(e,t,r)=>(e=new Ex(e,r),t=new Ex(t,r),e.intersects(t,r));_x.exports=IT});var kx=C(function(eK,jx){var MT=ho(),JT=pr();jx.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((d,p)=>JT(d,p,r));for(let d of o)if(MT(d,t,r)){if(i=d,!s)s=d}else{if(i)n.push([s,i]);i=null,s=null}if(s)n.push([s,null]);let a=[];for(let[d,p]of n)if(d===p)a.push(d);else if(!p&&d===o[0])a.push("*");else if(!p)a.push(`>=${d}`);else if(d===o[0])a.push(`<=${p}`);else a.push(`${d} - ${p}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var Tx=C(function(tK,Nx){var Rx=mr(),ld=po(),{ANY:od}=ld,ad=ho(),cd=pr(),DT=(e,t,r={})=>{if(e===t)return!0;e=new Rx(e,r),t=new Rx(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=FT(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},LT=[new ld(">=0.0.0-0")],Ax=[new ld(">=0.0.0")],FT=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===od)if(t.length===1&&t[0].semver===od)return!0;else if(r.includePrerelease)e=LT;else e=Ax;if(t.length===1&&t[0].semver===od)if(r.includePrerelease)return!0;else t=Ax;let n=new Set,s,i;for(let m of e)if(m.operator===">"||m.operator===">=")s=Ox(s,m,r);else if(m.operator==="<"||m.operator==="<=")i=Cx(i,m,r);else n.add(m.semver);if(n.size>1)return null;let o;if(s&&i){if(o=cd(s.semver,i.semver,r),o>0)return null;else if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let m of n){if(s&&!ad(m,String(s),r))return null;if(i&&!ad(m,String(i),r))return null;for(let b of t)if(!ad(m,String(b),r))return!1;return!0}let a,l,c,d,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;if(p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0)p=!1;for(let m of t){if(d=d||m.operator===">"||m.operator===">=",c=c||m.operator==="<"||m.operator==="<=",s){if(h){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===h.major&&m.semver.minor===h.minor&&m.semver.patch===h.patch)h=!1}if(m.operator===">"||m.operator===">="){if(a=Ox(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!m.test(s.semver))return!1}if(i){if(p){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===p.major&&m.semver.minor===p.minor&&m.semver.patch===p.patch)p=!1}if(m.operator==="<"||m.operator==="<="){if(l=Cx(i,m,r),l===m&&l!==i)return!1}else if(i.operator==="<="&&!m.test(i.semver))return!1}if(!m.operator&&(i||s)&&o!==0)return!1}if(s&&c&&!i&&o!==0)return!1;if(i&&d&&!s&&o!==0)return!1;if(h||p)return!1;return!0},Ox=(e,t,r)=>{if(!e)return t;let n=cd(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Cx=(e,t,r)=>{if(!e)return t;let n=cd(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Nx.exports=DT});var Dx=C(function(rK,Jx){var ud=ai(),Ix=oi(),qT=ht(),Mx=Xu(),HT=Dn(),VT=ib(),BT=ab(),WT=ub(),UT=pb(),zT=hb(),GT=yb(),KT=xb(),YT=vb(),XT=pr(),ZT=_b(),QT=jb(),eI=cl(),tI=Ob(),rI=Nb(),nI=uo(),sI=ul(),iI=Qu(),oI=ed(),aI=dl(),lI=fl(),cI=td(),uI=Hb(),dI=Bb(),fI=po(),pI=mr(),mI=ho(),hI=ox(),gI=lx(),yI=ux(),bI=px(),xI=hx(),$I=gl(),vI=vx(),wI=Sx(),SI=Px(),EI=kx(),_I=Tx();Jx.exports={parse:HT,valid:VT,clean:BT,inc:WT,diff:UT,major:zT,minor:GT,patch:KT,prerelease:YT,compare:XT,rcompare:ZT,compareLoose:QT,compareBuild:eI,sort:tI,rsort:rI,gt:nI,lt:sI,eq:iI,neq:oI,gte:aI,lte:lI,cmp:cI,coerce:uI,truncate:dI,Comparator:fI,Range:pI,satisfies:mI,toComparators:hI,maxSatisfying:gI,minSatisfying:yI,minVersion:bI,validRange:xI,outside:$I,gtr:vI,ltr:wI,intersects:SI,simplifyRange:EI,subset:_I,SemVer:qT,re:ud.re,src:ud.src,tokens:ud.t,SEMVER_SPEC_VERSION:Ix.SEMVER_SPEC_VERSION,RELEASE_TYPES:Ix.RELEASE_TYPES,compareIdentifiers:Mx.compareIdentifiers,rcompareIdentifiers:Mx.rcompareIdentifiers}});var gn;var yl=q(()=>{gn={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.35.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unnebäck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix Bünemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","Jérémy Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kotěšovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugué <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>","Dmytro Tiapukhin <cool.gegeg@gmail.com>","Florian Lefebvre <contact@florian-lefebvre.dev>"],scripts:{build:"node install/build.js","build:dist":"node scripts/build.mjs",clean:"rm -rf src/build/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types && npm run lint-publish","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-publish":"publint --strict","lint-types":"tsd --files ./test/types/sharp.test-d.{cts,mts}","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-wasm-wrappers":"node npm/wasm-wrappers.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",files:["dist","install","lib/index.d.ts","src/*.{cc,h,gyp}"],main:"./dist/index.cjs",module:"./dist/index.mjs",types:"./dist/index.d.mts",exports:{".":{import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}}},sideEffects:!0,repository:{type:"git",url:"git+https://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.1.0","detect-libc":"^2.1.2",semver:"^7.8.5"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.35.5","@img/sharp-darwin-x64":"0.35.5","@img/sharp-freebsd-wasm32":"0.35.5","@img/sharp-libvips-darwin-arm64":"1.3.4","@img/sharp-libvips-darwin-x64":"1.3.4","@img/sharp-libvips-linux-arm":"1.3.4","@img/sharp-libvips-linux-arm64":"1.3.4","@img/sharp-libvips-linux-ppc64":"1.3.4","@img/sharp-libvips-linux-riscv64":"1.3.4","@img/sharp-libvips-linux-s390x":"1.3.4","@img/sharp-libvips-linux-x64":"1.3.4","@img/sharp-libvips-linuxmusl-arm64":"1.3.4","@img/sharp-libvips-linuxmusl-x64":"1.3.4","@img/sharp-linux-arm":"0.35.5","@img/sharp-linux-arm64":"0.35.5","@img/sharp-linux-ppc64":"0.35.5","@img/sharp-linux-riscv64":"0.35.5","@img/sharp-linux-s390x":"0.35.5","@img/sharp-linux-x64":"0.35.5","@img/sharp-linuxmusl-arm64":"0.35.5","@img/sharp-linuxmusl-x64":"0.35.5","@img/sharp-webcontainers-wasm32":"0.35.5","@img/sharp-win32-arm64":"0.35.5","@img/sharp-win32-ia32":"0.35.5","@img/sharp-win32-x64":"0.35.5"},peerDependenciesMeta:{"@types/node":{optional:!0}},devDependencies:{"@biomejs/biome":"^2.5.14","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.11.3","@img/sharp-libvips-dev":"1.3.4","@img/sharp-libvips-dev-wasm32":"1.3.4","@img/sharp-libvips-win32-arm64":"1.3.4","@img/sharp-libvips-win32-ia32":"1.3.4","@img/sharp-libvips-win32-x64":"1.3.4","@types/node":"*",emnapi:"^1.11.3","exif-reader":"^2.0.3",icc:"^4.0.0","node-addon-api":"^8.9.2","node-gyp":"^12.4.0",publint:"^0.3.24","tar-fs":"^3.1.3",tsd:"^0.33.0",yauzl:"^3.4.0"},license:"Apache-2.0",engines:{node:">=20.9.0"},config:{libvips:">=8.18.7"},funding:{url:"https://opencollective.com/libvips"}}});import{spawnSync as go}from"node:child_process";import{createHash as jI}from"node:crypto";var yo,fd,kI,Fx,RI,pd,AI=(e)=>{if(e instanceof Error)console.error(`sharp: Installation error: ${e.message}`);else console.log(`sharp: ${e}`)},qx=()=>fd.default.isNonGlibcLinuxSync()?fd.default.familySync():"",OI=()=>`${process.platform}${qx()}-${process.arch}`,li=()=>{if(Hx())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r==="string"?r:qx();return`${t||process.platform}${n}-${e||process.arch}`},CI=()=>{try{return Ne(`@img/sharp-libvips-dev-${li()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},NI=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},TI=()=>{try{return Ne(`@img/sharp-libvips-dev-${li()}/lib`)}catch{try{return Ne(`@img/sharp-libvips-${li()}/lib`)}catch{}}return""},II=()=>{if(process.release?.name==="node"&&process.versions){if(!yo.default.satisfies(process.versions.node,gn.engines.node))return{found:process.versions.node,expected:gn.engines.node}}},Hx=()=>{let{CC:e}=process.env;return Boolean(e?.endsWith("/emcc"))},MI=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(go("sysctl sysctl.proc_translated",pd).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},Lx=(e)=>jI("sha512").update(e).digest("hex"),JI=()=>{try{let e=Lx(`imgsharp-libvips-${li()}`),t=yo.default.coerce(gn.optionalDependencies[`@img/sharp-libvips-${li()}`],{includePrerelease:!0}).version;return Lx(`${e}npm:${t}`).slice(0,10)}catch{}return""},DI=()=>go(`node-gyp rebuild --directory=src ${Hx()?"--nodedir=emscripten":""}`,{...pd,stdio:"inherit"}).status,Vx=()=>{if(process.platform!=="win32")return(go("pkg-config --modversion vips-cpp",{...pd,env:{...process.env,PKG_CONFIG_PATH:Bx()}}).stdout||"").trim();else return""},LI=()=>{try{let e=(go("brew",["--prefix"],{encoding:"utf8"}).stdout||"").trim();if(e)return`${e}/lib/pkgconfig`}catch(e){}return},FI=()=>{try{let e=(go("pkg-config",["--variable","pc_path","pkg-config"],{encoding:"utf8"}).stdout||"").trim();if(e)return e}catch(e){}return},Bx=()=>{if(process.platform!=="win32")return[LI(),FI(),process.env.PKG_CONFIG_PATH].filter(Boolean).join(":");else return""},dd=(e,t,r)=>{if(r)r(`Detected ${t}, skipping search for globally-installed libvips`);return e},qI=(e)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return dd(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return dd(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(MI())return dd(!1,"Rosetta",e);let t=Vx();return!!t&&yo.default.gte(t,Fx)},bl;var md=q(()=>{yl();yo=Lt(Dx(),1),fd=Lt(nl(),1);/*!
|
|
334
332
|
Copyright 2013 Lovell Fuller and others.
|
|
335
333
|
SPDX-License-Identifier: Apache-2.0
|
|
336
|
-
*/
|
|
334
|
+
*/kI=process.env.npm_package_config_libvips||gn.config.libvips,Fx=yo.default.coerce(kI).version,RI=["darwin-arm64","darwin-x64","freebsd-arm64","freebsd-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-wasm32","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],pd={encoding:"utf8",shell:!0},bl={minimumLibvipsVersion:Fx,prebuiltPlatforms:RI,buildPlatformArch:li,buildSharpLibvipsIncludeDir:CI,buildSharpLibvipsCPlusPlusDir:NI,buildSharpLibvipsLibDir:TI,isUnsupportedNodeRuntime:II,runtimePlatformArch:OI,log:AI,yarnLocator:JI,spawnRebuild:DI,globalLibvipsVersion:Vx,pkgConfigPath:Bx,useGlobalLibvips:qI}});import{createRequire as HI}from"node:module";var xl,lt,Ux,VI,Wx,BI,WI,yn,Je,Ln,Oe;var bo=q(()=>{md();yl();xl=Lt(nl(),1);/*!
|
|
337
335
|
Copyright 2013 Lovell Fuller and others.
|
|
338
336
|
SPDX-License-Identifier: Apache-2.0
|
|
339
|
-
*/lt=
|
|
340
|
-
`))}Oe=Je});import
|
|
337
|
+
*/lt=HI(import.meta.url),{version:Ux}=gn,{runtimePlatformArch:VI,isUnsupportedNodeRuntime:Wx,prebuiltPlatforms:BI,minimumLibvipsVersion:WI}=bl,yn=VI(),Ln=[];try{Je=lt(`../src/build/Release/sharp-${yn}-${Ux}.node`)}catch(e){Ln.push(e)}if(!Je)try{Je=lt(`../src/build/Release/sharp-wasm32-${Ux}.node`)}catch(e){Ln.push(e)}if(!Je)try{switch(yn){case"darwin-arm64":Je=lt("@img/sharp-darwin-arm64/sharp.node");break;case"darwin-x64":Je=lt("@img/sharp-darwin-x64/sharp.node");break;case"linux-arm":Je=lt("@img/sharp-linux-arm/sharp.node");break;case"linux-arm64":Je=lt("@img/sharp-linux-arm64/sharp.node");break;case"linux-ppc64":Je=lt("@img/sharp-linux-ppc64/sharp.node");break;case"linux-riscv64":Je=lt("@img/sharp-linux-riscv64/sharp.node");break;case"linux-s390x":Je=lt("@img/sharp-linux-s390x/sharp.node");break;case"linux-x64":Je=lt("@img/sharp-linux-x64/sharp.node");break;case"linuxmusl-arm64":Je=lt("@img/sharp-linuxmusl-arm64/sharp.node");break;case"linuxmusl-x64":Je=lt("@img/sharp-linuxmusl-x64/sharp.node");break;case"win32-arm64":Je=lt("@img/sharp-win32-arm64/sharp.node");break;case"win32-ia32":Je=lt("@img/sharp-win32-ia32/sharp.node");break;case"win32-x64":Je=lt("@img/sharp-win32-x64/sharp.node");break;case"freebsd-arm64":case"freebsd-x64":Je=lt("@img/sharp-freebsd-wasm32/sharp.node");break;case"linux-wasm32":Je=lt("@img/sharp-webcontainers-wasm32/sharp.node");break}if(Je&&["linux-x64","linuxmusl-x64"].includes(yn)&&!Je._isUsingX64V2()){let e=Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");e.code="Unsupported CPU",Ln.push(e),Je=null}if(Je&&process.versions.electron&&yn.startsWith("linux"))process.emitWarning("Binaries provided by Electron for use on Linux may be incompatible with sharp - see https://sharp.pixelplumbing.com/install#electron-and-linux",{code:"SharpElectronLinux"})}catch(e){Ln.push(e)}if(!Je)try{Je=lt("@img/sharp-wasm32/sharp.node")}catch(e){Ln.push(e)}if(!Je){let[e,t,r]=["linux","darwin","win32"].map((i)=>yn.startsWith(i)),n=[`Could not load the "sharp" module using the ${yn} runtime`];Ln.forEach((i)=>{if(!i.code?.endsWith("MODULE_NOT_FOUND"))n.push(i.code?`${i.code}: ${i.message}`:i.message)});let s=Ln.map((i)=>i.message).join(" ");if(n.push("Possible solutions:"),Wx()){let{found:i,expected:o}=Wx();n.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(BI.includes(yn)&&!/libstdc\+\+\.so/.test(s)){let[i,o]=yn.split("-"),a=i.endsWith("musl")?" --libc=musl":"";n.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else n.push(`- Manually install libvips >= ${WI}`," See https://sharp.pixelplumbing.com/install#building-from-source","- Add WebAssembly-based dependencies:"," npm install sharp @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(s))try{let{config:i}=lt(`@img/sharp-libvips-${yn}/package`),o=`${xl.familySync()} ${xl.versionSync()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;n.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch(i){}if(e&&/\/snap\/core[0-9]{2}/.test(s))n.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node");if(t&&/Incompatible library version/.test(s))n.push("- Update Homebrew:"," brew update && brew upgrade vips");if(Ln.some((i)=>i.code==="ERR_DLOPEN_DISABLED"))n.push("- Run Node.js without using the --no-addons flag");if(r&&/The specified procedure could not be found/.test(s))n.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp");throw n.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),Error(n.join(`
|
|
338
|
+
`))}Oe=Je});import UI from"node:util";import hd from"node:stream";function KI(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...n}=this.options;if(e.options=structuredClone(n),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")});return e}var zI,GI=(e)=>{ws.queue.emit("change",e)},ws=function(e,t){if(arguments.length===1&&!u.defined(e))throw Error("Invalid input");if(!(this instanceof ws))return new ws(e,t);return hd.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:0.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,trimMargin:0,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,typedArrayOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",keepGainMap:!1,withGainMap:!1,resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,webpExact:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:0,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,heifTune:"auto",jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:(r)=>{this.emit("warning",r),zI(r)},queueListener:GI},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this},Vr;var zx=q(()=>{Dr();bo();/*!
|
|
341
339
|
Copyright 2013 Lovell Fuller and others.
|
|
342
340
|
SPDX-License-Identifier: Apache-2.0
|
|
343
|
-
*/HI=qI.debuglog("sharp");Object.setPrototypeOf(ws.prototype,bd.Duplex.prototype);Object.setPrototypeOf(ws,bd.Duplex);Object.assign(ws.prototype,{clone:WI});Vr=ws});function Kx(e){let t=UI.filter((r)=>u.defined(e[r])).map((r)=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function zI(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,limitInputChannels:5,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(u.string(e))n.file=e;else if(u.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(u.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(u.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");n.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(u.plainObject(e)&&!u.defined(t)){if(t=e,Kx(t))n.buffer=[]}else if(!u.defined(e)&&!u.defined(t)&&u.object(r)&&r.allowStream)n.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map((s)=>this._createInputDescriptor(s));else throw Error("Recursive join is unsupported");else throw Error("Expected at least two images to join");else throw Error(`Unsupported input '${e}' of type ${typeof e}${u.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(u.object(t)){if(u.defined(t.failOn))if(u.string(t.failOn)&&u.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw u.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(u.defined(t.autoOrient))if(u.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw u.invalidParameterError("autoOrient","boolean",t.autoOrient);if(u.defined(t.density))if(u.number(t.density)&&u.inRange(t.density,1,1e5))n.density=t.density;else throw u.invalidParameterError("density","number between 1 and 100000",t.density);if(u.defined(t.ignoreIcc))if(u.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw u.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(u.defined(t.limitInputPixels))if(u.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?268402689:0;else if(u.integer(t.limitInputPixels)&&u.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw u.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(u.defined(t.limitInputChannels))if(u.bool(t.limitInputChannels))n.limitInputChannels=t.limitInputChannels?5:0;else if(u.integer(t.limitInputChannels)&&u.inRange(t.limitInputChannels,0,Number.MAX_SAFE_INTEGER))n.limitInputChannels=t.limitInputChannels;else throw u.invalidParameterError("limitInputChannels","positive integer",t.limitInputChannels);if(u.defined(t.unlimited))if(u.bool(t.unlimited))n.unlimited=t.unlimited;else throw u.invalidParameterError("unlimited","boolean",t.unlimited);if(u.defined(t.sequentialRead))if(u.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw u.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(u.defined(t.raw)){if(u.object(t.raw)&&u.integer(t.raw.width)&&u.inRange(t.raw.width,1,1e8)&&u.integer(t.raw.height)&&u.inRange(t.raw.height,1,1e8)&&u.integer(t.raw.channels)&&u.inRange(t.raw.channels,1,4))switch(n.rawWidth=t.raw.width,n.rawHeight=t.raw.height,n.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:n.rawDepth="uchar";break;case Int8Array:n.rawDepth="char";break;case Uint16Array:n.rawDepth="ushort";break;case Int16Array:n.rawDepth="short";break;case Uint32Array:n.rawDepth="uint";break;case Int32Array:n.rawDepth="int";break;case Float32Array:n.rawDepth="float";break;case Float64Array:n.rawDepth="double";break;default:n.rawDepth="uchar";break}else throw Error("Expected width, height and channels for raw pixel input");if(n.rawPremultiplied=!1,u.defined(t.raw.premultiplied))if(u.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw u.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,u.defined(t.raw.pageHeight))if(u.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);n.rawPageHeight=t.raw.pageHeight}else throw u.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(u.defined(t.animated))if(u.bool(t.animated))n.pages=t.animated?-1:1;else throw u.invalidParameterError("animated","boolean",t.animated);if(u.defined(t.pages))if(u.integer(t.pages)&&u.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw u.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(u.defined(t.page))if(u.integer(t.page)&&u.inRange(t.page,0,1e5))n.page=t.page;else throw u.invalidParameterError("page","integer between 0 and 100000",t.page);if(u.object(t.openSlide)&&u.defined(t.openSlide.level))if(u.integer(t.openSlide.level)&&u.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw u.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(u.defined(t.level))if(u.integer(t.level)&&u.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw u.invalidParameterError("level","integer between 0 and 256",t.level);if(u.object(t.tiff)&&u.defined(t.tiff.subifd))if(u.integer(t.tiff.subifd)&&u.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw u.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(u.defined(t.subifd))if(u.integer(t.subifd)&&u.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw u.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(u.object(t.svg)){if(u.defined(t.svg.stylesheet))if(u.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw u.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(u.defined(t.svg.highBitdepth))if(u.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw u.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(u.object(t.pdf)&&u.defined(t.pdf.background))n.pdfBackground=this._getBackgroundColourOption(t.pdf.background);else if(u.defined(t.pdfBackground))n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground);if(u.object(t.jp2)&&u.defined(t.jp2.oneshot))if(u.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw u.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(u.defined(t.create))if(u.object(t.create)&&u.integer(t.create.width)&&u.inRange(t.create.width,1,1e8)&&u.integer(t.create.height)&&u.inRange(t.create.height,1,1e8)&&u.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,u.defined(t.create.pageHeight))if(u.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);n.createPageHeight=t.create.pageHeight}else throw u.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(u.defined(t.create.noise)){if(!u.object(t.create.noise))throw Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw Error("Only gaussian noise is supported at the moment");if(n.createNoiseType=t.create.noise.type,!u.inRange(t.create.channels,1,4))throw u.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,u.defined(t.create.noise.mean))if(u.number(t.create.noise.mean)&&u.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw u.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,u.defined(t.create.noise.sigma))if(u.number(t.create.noise.sigma)&&u.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw u.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(u.defined(t.create.background)){if(!u.inRange(t.create.channels,3,4))throw u.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);n.createBackground=this._getBackgroundColourOption(t.create.background)}else throw Error("Expected valid noise or background to create a new input image");delete n.buffer}else throw Error("Expected valid width, height and channels to create a new input image");if(u.defined(t.text))if(u.object(t.text)&&u.string(t.text.text)){if(n.textValue=t.text.text,u.defined(t.text.height)&&u.defined(t.text.dpi))throw Error("Expected only one of dpi or height");if(u.defined(t.text.font))if(u.string(t.text.font))n.textFont=t.text.font;else throw u.invalidParameterError("text.font","string",t.text.font);if(u.defined(t.text.fontfile))if(u.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw u.invalidParameterError("text.fontfile","string",t.text.fontfile);if(u.defined(t.text.width))if(u.integer(t.text.width)&&u.inRange(t.text.width,1,1e6))n.textWidth=t.text.width;else throw u.invalidParameterError("text.width","integer between 1 and 1000000",t.text.width);if(u.defined(t.text.height))if(u.integer(t.text.height)&&u.inRange(t.text.height,1,1e6))n.textHeight=t.text.height;else throw u.invalidParameterError("text.height","integer between 1 and 1000000",t.text.height);if(u.defined(t.text.align))if(u.string(t.text.align)&&u.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw u.invalidParameterError("text.align","valid alignment",t.text.align);if(u.defined(t.text.justify))if(u.bool(t.text.justify))n.textJustify=t.text.justify;else throw u.invalidParameterError("text.justify","boolean",t.text.justify);if(u.defined(t.text.dpi))if(u.integer(t.text.dpi)&&u.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw u.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(u.defined(t.text.rgba))if(u.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw u.invalidParameterError("text.rgba","bool",t.text.rgba);if(u.defined(t.text.spacing))if(u.integer(t.text.spacing)&&u.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw u.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(u.defined(t.text.wrap))if(u.string(t.text.wrap)&&u.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw u.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete n.buffer}else throw Error("Expected a valid string to create an image with text.");if(u.defined(t.join))if(u.defined(this.options.join)){if(u.defined(t.join.animated))if(u.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw u.invalidParameterError("join.animated","boolean",t.join.animated);if(u.defined(t.join.across))if(u.integer(t.join.across)&&u.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw u.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(u.defined(t.join.shim))if(u.integer(t.join.shim)&&u.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw u.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(u.defined(t.join.background))n.joinBackground=this._getBackgroundColourOption(t.join.background);if(u.defined(t.join.halign))if(u.string(t.join.halign)&&u.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw u.invalidParameterError("join.halign","valid alignment",t.join.halign);if(u.defined(t.join.valign))if(u.string(t.join.valign)&&u.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw u.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw Error("Expected input to be an array of images to join")}else if(u.defined(t))throw Error(`Invalid input options ${t}`);return n}function GI(e,t,r){if(Array.isArray(this.options.input.buffer))if(u.buffer(e))this.options.input.buffer.push(e),r();else r(Error("Non-Buffer data on Writable Stream"));else r(Error("Unexpected data on Writable Stream"))}function KI(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function YI(){return Array.isArray(this.options.input.buffer)}function XI(e){if(this.writableFinished)e();else this.once("finish",e)}function ZI(e){let t=Error();if(u.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.metadata(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)})});else Oe.metadata(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.metadata(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Oe.metadata(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})}function QI(e){let t=Error();if(u.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.stats(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)})});else Oe.stats(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.stats(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Oe.stats(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})}var BI,UI,Yx=(e)=>{Object.assign(e.prototype,{_inputOptionsFromObject:Kx,_createInputDescriptor:zI,_write:GI,_flattenBufferIn:KI,_isStreamInput:YI,_whenStreamInFinished:XI,metadata:ZI,stats:QI}),e.align=BI};var Xx=q(()=>{Dr();$o();/*!
|
|
341
|
+
*/zI=UI.debuglog("sharp");Object.setPrototypeOf(ws.prototype,hd.Duplex.prototype);Object.setPrototypeOf(ws,hd.Duplex);Object.assign(ws.prototype,{clone:KI});Vr=ws});function Gx(e){let t=XI.filter((r)=>u.defined(e[r])).map((r)=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function ZI(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,limitInputChannels:5,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(u.string(e))n.file=e;else if(u.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(u.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(u.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");n.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(u.plainObject(e)&&!u.defined(t)){if(t=e,Gx(t))n.buffer=[]}else if(!u.defined(e)&&!u.defined(t)&&u.object(r)&&r.allowStream)n.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map((s)=>this._createInputDescriptor(s));else throw Error("Recursive join is unsupported");else throw Error("Expected at least two images to join");else throw Error(`Unsupported input '${e}' of type ${typeof e}${u.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(u.object(t)){if(u.defined(t.failOn))if(u.string(t.failOn)&&u.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw u.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(u.defined(t.autoOrient))if(u.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw u.invalidParameterError("autoOrient","boolean",t.autoOrient);if(u.defined(t.density))if(u.number(t.density)&&u.inRange(t.density,1,1e5))n.density=t.density;else throw u.invalidParameterError("density","number between 1 and 100000",t.density);if(u.defined(t.ignoreIcc))if(u.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw u.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(u.defined(t.limitInputPixels))if(u.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?268402689:0;else if(u.integer(t.limitInputPixels)&&u.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw u.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(u.defined(t.limitInputChannels))if(u.bool(t.limitInputChannels))n.limitInputChannels=t.limitInputChannels?5:0;else if(u.integer(t.limitInputChannels)&&u.inRange(t.limitInputChannels,0,Number.MAX_SAFE_INTEGER))n.limitInputChannels=t.limitInputChannels;else throw u.invalidParameterError("limitInputChannels","positive integer",t.limitInputChannels);if(u.defined(t.unlimited))if(u.bool(t.unlimited))n.unlimited=t.unlimited;else throw u.invalidParameterError("unlimited","boolean",t.unlimited);if(u.defined(t.sequentialRead))if(u.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw u.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(u.defined(t.raw)){if(u.object(t.raw)&&u.integer(t.raw.width)&&u.inRange(t.raw.width,1,1e8)&&u.integer(t.raw.height)&&u.inRange(t.raw.height,1,1e8)&&u.integer(t.raw.channels)&&u.inRange(t.raw.channels,1,4))switch(n.rawWidth=t.raw.width,n.rawHeight=t.raw.height,n.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:n.rawDepth="uchar";break;case Int8Array:n.rawDepth="char";break;case Uint16Array:n.rawDepth="ushort";break;case Int16Array:n.rawDepth="short";break;case Uint32Array:n.rawDepth="uint";break;case Int32Array:n.rawDepth="int";break;case Float32Array:n.rawDepth="float";break;case Float64Array:n.rawDepth="double";break;default:n.rawDepth="uchar";break}else throw Error("Expected width, height and channels for raw pixel input");if(n.rawPremultiplied=!1,u.defined(t.raw.premultiplied))if(u.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw u.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,u.defined(t.raw.pageHeight))if(u.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);n.rawPageHeight=t.raw.pageHeight}else throw u.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(u.defined(t.animated))if(u.bool(t.animated))n.pages=t.animated?-1:1;else throw u.invalidParameterError("animated","boolean",t.animated);if(u.defined(t.pages))if(u.integer(t.pages)&&u.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw u.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(u.defined(t.page))if(u.integer(t.page)&&u.inRange(t.page,0,1e5))n.page=t.page;else throw u.invalidParameterError("page","integer between 0 and 100000",t.page);if(u.object(t.openSlide)&&u.defined(t.openSlide.level))if(u.integer(t.openSlide.level)&&u.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw u.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(u.defined(t.level))if(u.integer(t.level)&&u.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw u.invalidParameterError("level","integer between 0 and 256",t.level);if(u.object(t.tiff)&&u.defined(t.tiff.subifd))if(u.integer(t.tiff.subifd)&&u.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw u.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(u.defined(t.subifd))if(u.integer(t.subifd)&&u.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw u.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(u.object(t.svg)){if(u.defined(t.svg.stylesheet))if(u.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw u.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(u.defined(t.svg.highBitdepth))if(u.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw u.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(u.object(t.pdf)&&u.defined(t.pdf.background))n.pdfBackground=this._getBackgroundColourOption(t.pdf.background);else if(u.defined(t.pdfBackground))n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground);if(u.object(t.jp2)&&u.defined(t.jp2.oneshot))if(u.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw u.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(u.defined(t.create))if(u.object(t.create)&&u.integer(t.create.width)&&u.inRange(t.create.width,1,1e8)&&u.integer(t.create.height)&&u.inRange(t.create.height,1,1e8)&&u.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,u.defined(t.create.pageHeight))if(u.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);n.createPageHeight=t.create.pageHeight}else throw u.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(u.defined(t.create.noise)){if(!u.object(t.create.noise))throw Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw Error("Only gaussian noise is supported at the moment");if(n.createNoiseType=t.create.noise.type,!u.inRange(t.create.channels,1,4))throw u.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,u.defined(t.create.noise.mean))if(u.number(t.create.noise.mean)&&u.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw u.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,u.defined(t.create.noise.sigma))if(u.number(t.create.noise.sigma)&&u.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw u.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(u.defined(t.create.background)){if(!u.inRange(t.create.channels,3,4))throw u.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);n.createBackground=this._getBackgroundColourOption(t.create.background)}else throw Error("Expected valid noise or background to create a new input image");delete n.buffer}else throw Error("Expected valid width, height and channels to create a new input image");if(u.defined(t.text))if(u.object(t.text)&&u.string(t.text.text)){if(n.textValue=t.text.text,u.defined(t.text.height)&&u.defined(t.text.dpi))throw Error("Expected only one of dpi or height");if(u.defined(t.text.font))if(u.string(t.text.font))n.textFont=t.text.font;else throw u.invalidParameterError("text.font","string",t.text.font);if(u.defined(t.text.fontfile))if(u.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw u.invalidParameterError("text.fontfile","string",t.text.fontfile);if(u.defined(t.text.width))if(u.integer(t.text.width)&&u.inRange(t.text.width,1,1e6))n.textWidth=t.text.width;else throw u.invalidParameterError("text.width","integer between 1 and 1000000",t.text.width);if(u.defined(t.text.height))if(u.integer(t.text.height)&&u.inRange(t.text.height,1,1e6))n.textHeight=t.text.height;else throw u.invalidParameterError("text.height","integer between 1 and 1000000",t.text.height);if(u.defined(t.text.align))if(u.string(t.text.align)&&u.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw u.invalidParameterError("text.align","valid alignment",t.text.align);if(u.defined(t.text.justify))if(u.bool(t.text.justify))n.textJustify=t.text.justify;else throw u.invalidParameterError("text.justify","boolean",t.text.justify);if(u.defined(t.text.dpi))if(u.integer(t.text.dpi)&&u.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw u.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(u.defined(t.text.rgba))if(u.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw u.invalidParameterError("text.rgba","bool",t.text.rgba);if(u.defined(t.text.spacing))if(u.integer(t.text.spacing)&&u.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw u.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(u.defined(t.text.wrap))if(u.string(t.text.wrap)&&u.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw u.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete n.buffer}else throw Error("Expected a valid string to create an image with text.");if(u.defined(t.join))if(u.defined(this.options.join)){if(u.defined(t.join.animated))if(u.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw u.invalidParameterError("join.animated","boolean",t.join.animated);if(u.defined(t.join.across))if(u.integer(t.join.across)&&u.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw u.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(u.defined(t.join.shim))if(u.integer(t.join.shim)&&u.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw u.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(u.defined(t.join.background))n.joinBackground=this._getBackgroundColourOption(t.join.background);if(u.defined(t.join.halign))if(u.string(t.join.halign)&&u.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw u.invalidParameterError("join.halign","valid alignment",t.join.halign);if(u.defined(t.join.valign))if(u.string(t.join.valign)&&u.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw u.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw Error("Expected input to be an array of images to join")}else if(u.defined(t))throw Error(`Invalid input options ${t}`);return n}function QI(e,t,r){if(Array.isArray(this.options.input.buffer))if(u.buffer(e))this.options.input.buffer.push(e),r();else r(Error("Non-Buffer data on Writable Stream"));else r(Error("Unexpected data on Writable Stream"))}function e2(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function t2(){return Array.isArray(this.options.input.buffer)}function r2(e){if(this.writableFinished)e();else this.once("finish",e)}function n2(e){let t=Error();if(u.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.metadata(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)})});else Oe.metadata(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.metadata(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Oe.metadata(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})}function s2(e){let t=Error();if(u.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.stats(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)})});else Oe.stats(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.stats(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Oe.stats(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})}var YI,XI,Kx=(e)=>{Object.assign(e.prototype,{_inputOptionsFromObject:Gx,_createInputDescriptor:ZI,_write:QI,_flattenBufferIn:e2,_isStreamInput:t2,_whenStreamInFinished:r2,metadata:n2,stats:s2}),e.align=YI};var Yx=q(()=>{Dr();bo();/*!
|
|
344
342
|
Copyright 2013 Lovell Fuller and others.
|
|
345
343
|
SPDX-License-Identifier: Apache-2.0
|
|
346
|
-
*/
|
|
344
|
+
*/YI={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},XI=["failOn","limitInputPixels","limitInputChannels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","openSlideLevel","pdfBackground","tiffSubifd"]});function yd(e){return e.angle%360!==0||e.rotationAngle!==0}function $l(e){return e.width!==-1||e.height!==-1}function a2(e,t,r){if($l(this.options))this.options.debuglog("ignoring previous resize options");if(this.options.widthPost!==-1)this.options.debuglog("operation order will be: extract, resize, extract");if(u.defined(e))if(u.object(e)&&!u.defined(r))r=e;else if(u.integer(e)&&u.inRange(e,1,1e8))this.options.width=e;else throw u.invalidParameterError("width","positive integer between 1 and 100000000",e);else this.options.width=-1;if(u.defined(t))if(u.integer(t)&&u.inRange(t,1,1e8))this.options.height=t;else throw u.invalidParameterError("height","positive integer between 1 and 100000000",t);else this.options.height=-1;if(u.object(r)){if(u.defined(r.width))if(u.integer(r.width)&&u.inRange(r.width,1,1e8))this.options.width=r.width;else throw u.invalidParameterError("width","positive integer between 1 and 100000000",r.width);if(u.defined(r.height))if(u.integer(r.height)&&u.inRange(r.height,1,1e8))this.options.height=r.height;else throw u.invalidParameterError("height","positive integer between 1 and 100000000",r.height);if(u.defined(r.fit)){let n=o2[r.fit];if(u.string(n))this.options.canvas=n;else throw u.invalidParameterError("fit","valid fit",r.fit)}if(u.defined(r.position)){let n=u.integer(r.position)?r.position:e$[r.position]||Qx[r.position]||Zx[r.position];if(u.integer(n)&&(u.inRange(n,0,8)||u.inRange(n,16,17)))this.options.position=n;else throw u.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),u.defined(r.kernel))if(u.string(gd[r.kernel]))this.options.kernel=gd[r.kernel];else throw u.invalidParameterError("kernel","valid kernel name",r.kernel);if(u.defined(r.withoutEnlargement))this._setBooleanOption("withoutEnlargement",r.withoutEnlargement);if(u.defined(r.withoutReduction))this._setBooleanOption("withoutReduction",r.withoutReduction);if(u.defined(r.fastShrinkOnLoad))this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}if(yd(this.options)&&$l(this.options))this.options.rotateBefore=!0;return this}function l2(e){if(u.integer(e))if(u.inRange(e,1,1e8))this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else throw u.invalidParameterError("extend","integer between 1 and 100000000",e);else if(u.object(e)){if(u.defined(e.top))if(u.integer(e.top)&&u.inRange(e.top,0,1e8))this.options.extendTop=e.top;else throw u.invalidParameterError("top","integer between 0 and 100000000",e.top);if(u.defined(e.bottom))if(u.integer(e.bottom)&&u.inRange(e.bottom,0,1e8))this.options.extendBottom=e.bottom;else throw u.invalidParameterError("bottom","integer between 0 and 100000000",e.bottom);if(u.defined(e.left))if(u.integer(e.left)&&u.inRange(e.left,0,1e8))this.options.extendLeft=e.left;else throw u.invalidParameterError("left","integer between 0 and 100000000",e.left);if(u.defined(e.right))if(u.integer(e.right)&&u.inRange(e.right,0,1e8))this.options.extendRight=e.right;else throw u.invalidParameterError("right","integer between 0 and 100000000",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),u.defined(e.extendWith))if(u.string(Xx[e.extendWith]))this.options.extendWith=Xx[e.extendWith];else throw u.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw u.invalidParameterError("extend","integer or object",e);return this}function c2(e){let t=$l(this.options)||this.options.widthPre!==-1?"Post":"Pre";if(this.options[`width${t}`]!==-1)this.options.debuglog("ignoring previous extract options");if(["left","top","width","height"].forEach(function(r){let n=e[r];if(u.integer(n)&&u.inRange(n,0,1e8))this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=n;else throw u.invalidParameterError(r,"integer between 0 and 100000000",n)},this),yd(this.options)&&!$l(this.options)){if(this.options.widthPre===-1||this.options.widthPost===-1)this.options.rotateBefore=!0}if(this.options.input.autoOrient)this.options.orientBefore=!0;return this}function u2(e){if(this.options.trimThreshold=10,u.defined(e))if(u.object(e)){if(u.defined(e.background))this._setBackgroundColourOption("trimBackground",e.background);if(u.defined(e.threshold))if(u.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw u.invalidParameterError("threshold","positive number",e.threshold);if(u.defined(e.lineArt))this._setBooleanOption("trimLineArt",e.lineArt);if(u.defined(e.margin))if(u.integer(e.margin)&&u.inRange(e.margin,0,1e7))this.options.trimMargin=e.margin;else throw u.invalidParameterError("margin","integer between 0 and 10000000",e.margin)}else throw u.invalidParameterError("trim","object",e);if(yd(this.options))this.options.rotateBefore=!0;return this}var Zx,Qx,Xx,e$,gd,i2,o2,t$=(e)=>{Object.assign(e.prototype,{resize:a2,extend:l2,extract:c2,trim:u2}),e.gravity=Zx,e.strategy=e$,e.kernel=gd,e.fit=i2,e.position=Qx};var r$=q(()=>{Dr();/*!
|
|
347
345
|
Copyright 2013 Lovell Fuller and others.
|
|
348
346
|
SPDX-License-Identifier: Apache-2.0
|
|
349
|
-
*/
|
|
347
|
+
*/Zx={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},Qx={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},Xx={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},e$={entropy:16,attention:17},gd={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},i2={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},o2={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"}});function d2(e){if(!Array.isArray(e))throw u.invalidParameterError("images to composite","array",e);return this.options.composite=e.map((t)=>{if(!u.object(t))throw u.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),n={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(u.defined(t.blend))if(u.string(bd[t.blend]))n.blend=bd[t.blend];else throw u.invalidParameterError("blend","valid blend name",t.blend);if(u.defined(t.tile))if(u.bool(t.tile))n.tile=t.tile;else throw u.invalidParameterError("tile","boolean",t.tile);if(u.defined(t.left))if(u.integer(t.left)&&u.inRange(t.left,-1e8,1e8))n.left=t.left;else throw u.invalidParameterError("left","integer between -100000000 and 100000000",t.left);if(u.defined(t.top))if(u.integer(t.top)&&u.inRange(t.top,-1e8,1e8))n.top=t.top;else throw u.invalidParameterError("top","integer between -100000000 and 100000000",t.top);if(u.defined(t.top)!==u.defined(t.left))throw Error("Expected both left and top to be set");else n.hasOffset=u.integer(t.top)&&u.integer(t.left);if(u.defined(t.gravity))if(u.integer(t.gravity)&&u.inRange(t.gravity,0,8))n.gravity=t.gravity;else if(u.string(t.gravity)&&u.integer(this.constructor.gravity[t.gravity]))n.gravity=this.constructor.gravity[t.gravity];else throw u.invalidParameterError("gravity","valid gravity",t.gravity);if(u.defined(t.premultiplied))if(u.bool(t.premultiplied))n.premultiplied=t.premultiplied;else throw u.invalidParameterError("premultiplied","boolean",t.premultiplied);return n}),this}var bd,n$=(e)=>{e.prototype.composite=d2,e.blend=bd};var s$=q(()=>{Dr();/*!
|
|
350
348
|
Copyright 2013 Lovell Fuller and others.
|
|
351
349
|
SPDX-License-Identifier: Apache-2.0
|
|
352
|
-
*/vd={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"}});function a2(e,t){if(!u.defined(e))return this.autoOrient();if(this.options.angle||this.options.rotationAngle)this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0;if(u.integer(e)&&!(e%90))this.options.angle=e;else if(u.number(e)){if(this.options.rotationAngle=e,u.object(t)&&t.background)this._setBackgroundColourOption("rotationBackground",t.background)}else throw u.invalidParameterError("angle","numeric",e);return this}function l2(){return this.options.input.autoOrient=!0,this}function c2(e){return this.options.flip=u.bool(e)?e:!0,this}function u2(e){return this.options.flop=u.bool(e)?e:!0,this}function d2(e,t){let n=Array.isArray(e)&&(e.length===4&&e.every(u.number)||e.length===2&&e.every((s)=>Array.isArray(s)&&s.length===2))?e.flat():[];if(n.length===4&&n.every(u.number))this.options.affineMatrix=n;else throw u.invalidParameterError("matrix","1x4 or 2x2 array",e);if(u.defined(t))if(u.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),u.defined(t.idx))if(u.number(t.idx))this.options.affineIdx=t.idx;else throw u.invalidParameterError("options.idx","number",t.idx);if(u.defined(t.idy))if(u.number(t.idy))this.options.affineIdy=t.idy;else throw u.invalidParameterError("options.idy","number",t.idy);if(u.defined(t.odx))if(u.number(t.odx))this.options.affineOdx=t.odx;else throw u.invalidParameterError("options.odx","number",t.odx);if(u.defined(t.ody))if(u.number(t.ody))this.options.affineOdy=t.ody;else throw u.invalidParameterError("options.ody","number",t.ody);if(u.defined(t.interpolator))if(u.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw u.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw u.invalidParameterError("options","object",t);return this}function f2(e){if(u.plainObject(e)){if(u.number(e.sigma)&&u.inRange(e.sigma,0.000001,10))this.options.sharpenSigma=e.sigma;else throw u.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(u.defined(e.m1))if(u.number(e.m1)&&u.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw u.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(u.defined(e.m2))if(u.number(e.m2)&&u.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw u.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(u.defined(e.x1))if(u.number(e.x1)&&u.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw u.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(u.defined(e.y2))if(u.number(e.y2)&&u.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw u.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(u.defined(e.y3))if(u.number(e.y3)&&u.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw u.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else this.options.sharpenSigma=-1;return this}function p2(e){if(!u.defined(e))this.options.medianSize=3;else if(u.integer(e)&&u.inRange(e,1,1000))this.options.medianSize=e;else throw u.invalidParameterError("size","integer between 1 and 1000",e);return this}function m2(e){let t;if(u.number(e))t=e;else if(u.plainObject(e)){if(!u.number(e.sigma))throw u.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(u.string(o$[e.precision]))this.options.precision=o$[e.precision];else throw u.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(u.number(e.minAmplitude)&&u.inRange(e.minAmplitude,0.001,1))this.options.minAmpl=e.minAmplitude;else throw u.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!u.defined(e))this.options.blurSigma=-1;else if(u.bool(e))this.options.blurSigma=e?-1:0;else if(u.number(t)&&u.inRange(t,0.3,1000))this.options.blurSigma=t;else throw u.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function h2(e){if(!u.defined(e))this.options.dilateWidth=1;else if(u.integer(e)&&u.inRange(e,1,65536))this.options.dilateWidth=e;else throw u.invalidParameterError("width","integer between 1 and 65536",e);return this}function g2(e){if(!u.defined(e))this.options.erodeWidth=1;else if(u.integer(e)&&u.inRange(e,1,65536))this.options.erodeWidth=e;else throw u.invalidParameterError("width","integer between 1 and 65536",e);return this}function y2(e){if(this.options.flatten=u.bool(e)?e:!0,u.object(e))this._setBackgroundColourOption("flattenBackground",e.background);return this}function b2(){return this.options.unflatten=!0,this}function x2(e,t){if(!u.defined(e))this.options.gamma=2.2;else if(u.number(e)&&u.inRange(e,1,3))this.options.gamma=e;else throw u.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!u.defined(t))this.options.gammaOut=this.options.gamma;else if(u.number(t)&&u.inRange(t,1,3))this.options.gammaOut=t;else throw u.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function $2(e){if(this.options.negate=u.bool(e)?e:!0,u.plainObject(e)&&"alpha"in e)if(!u.bool(e.alpha))throw u.invalidParameterError("alpha","should be boolean value",e.alpha);else this.options.negateAlpha=e.alpha;return this}function v2(e){if(u.plainObject(e)){if(u.defined(e.lower))if(u.number(e.lower)&&u.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw u.invalidParameterError("lower","number between 0 and 99",e.lower);if(u.defined(e.upper))if(u.number(e.upper)&&u.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw u.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw u.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function w2(e){return this.normalise(e)}function S2(e){if(u.plainObject(e)){if(u.integer(e.width)&&u.inRange(e.width,1,65536))this.options.claheWidth=e.width;else throw u.invalidParameterError("width","integer between 1 and 65536",e.width);if(u.integer(e.height)&&u.inRange(e.height,1,65536))this.options.claheHeight=e.height;else throw u.invalidParameterError("height","integer between 1 and 65536",e.height);if(u.defined(e.maxSlope))if(u.integer(e.maxSlope)&&u.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw u.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw u.invalidParameterError("options","plain object",e);return this}function E2(e){if(!u.object(e)||!Array.isArray(e.kernel)||!u.integer(e.width)||!u.integer(e.height)||!u.inRange(e.width,3,1001)||!u.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length||!e.kernel.every(u.number))throw Error("Invalid convolution kernel");if(!u.integer(e.scale))e.scale=e.kernel.reduce((t,r)=>t+r,0);if(e.scale<1)e.scale=1;if(!u.integer(e.offset))e.offset=0;return this.options.convKernel=e,this}function _2(e,t){if(!u.defined(e))this.options.threshold=128;else if(u.bool(e))this.options.threshold=e?128:0;else if(u.integer(e)&&u.inRange(e,0,255))this.options.threshold=e;else throw u.invalidParameterError("threshold","integer between 0 and 255",e);if(!u.object(t)||t.greyscale===!0||t.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function P2(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),u.string(t)&&u.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw u.invalidParameterError("operator","one of: and, or, eor",t);return this}function j2(e,t){if(!u.defined(e)&&u.number(t))e=1;else if(u.number(e)&&!u.defined(t))t=0;if(!u.defined(e))this.options.linearA=[];else if(u.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&u.inRange(e.length,1,1e6)&&e.every(u.number))this.options.linearA=e;else throw u.invalidParameterError("a","number or array of numbers",e);if(!u.defined(t))this.options.linearB=[];else if(u.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&u.inRange(t.length,1,1e6)&&t.every(u.number))this.options.linearB=t;else throw u.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw Error("Expected a and b to be arrays of the same length");return this}function k2(e){if(!Array.isArray(e))throw u.invalidParameterError("inputMatrix","array",e);let t=e.length;if(t!==3&&t!==4)throw u.invalidParameterError("inputMatrix","3x3 or 4x4 array",t);if(!e.every((n)=>Array.isArray(n)&&n.length===t))throw u.invalidParameterError("inputMatrix",`array of ${t} arrays of length ${t}`,e);let r=e.flat();if(!r.every(u.number))throw u.invalidParameterError("inputMatrix","array of numbers",r);return this.options.recombMatrix=r,this}function R2(e){if(!u.plainObject(e))throw u.invalidParameterError("options","plain object",e);if("brightness"in e)if(u.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw u.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(u.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw u.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(u.integer(e.hue))this.options.hue=e.hue%360;else throw u.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(u.number(e.lightness))this.options.lightness=e.lightness;else throw u.invalidParameterError("lightness","number",e.lightness);return this}var o$,a$=(e)=>{Object.assign(e.prototype,{autoOrient:l2,rotate:a2,flip:c2,flop:u2,affine:d2,sharpen:f2,erode:g2,dilate:h2,median:p2,blur:m2,flatten:y2,unflatten:b2,gamma:x2,negate:$2,normalise:v2,normalize:w2,clahe:S2,convolve:E2,threshold:_2,boolean:P2,linear:j2,recomb:k2,modulate:R2})};var l$=q(()=>{Dr();/*!
|
|
350
|
+
*/bd={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"}});function f2(e,t){if(!u.defined(e))return this.autoOrient();if(this.options.angle||this.options.rotationAngle)this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0;if(u.integer(e)&&!(e%90))this.options.angle=e;else if(u.number(e)){if(this.options.rotationAngle=e,u.object(t)&&t.background)this._setBackgroundColourOption("rotationBackground",t.background)}else throw u.invalidParameterError("angle","numeric",e);return this}function p2(){return this.options.input.autoOrient=!0,this}function m2(e){return this.options.flip=u.bool(e)?e:!0,this}function h2(e){return this.options.flop=u.bool(e)?e:!0,this}function g2(e,t){let n=Array.isArray(e)&&(e.length===4&&e.every(u.number)||e.length===2&&e.every((s)=>Array.isArray(s)&&s.length===2))?e.flat():[];if(n.length===4&&n.every(u.number))this.options.affineMatrix=n;else throw u.invalidParameterError("matrix","1x4 or 2x2 array",e);if(u.defined(t))if(u.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),u.defined(t.idx))if(u.number(t.idx))this.options.affineIdx=t.idx;else throw u.invalidParameterError("options.idx","number",t.idx);if(u.defined(t.idy))if(u.number(t.idy))this.options.affineIdy=t.idy;else throw u.invalidParameterError("options.idy","number",t.idy);if(u.defined(t.odx))if(u.number(t.odx))this.options.affineOdx=t.odx;else throw u.invalidParameterError("options.odx","number",t.odx);if(u.defined(t.ody))if(u.number(t.ody))this.options.affineOdy=t.ody;else throw u.invalidParameterError("options.ody","number",t.ody);if(u.defined(t.interpolator))if(u.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw u.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw u.invalidParameterError("options","object",t);return this}function y2(e){if(u.plainObject(e)){if(u.number(e.sigma)&&u.inRange(e.sigma,0.000001,10))this.options.sharpenSigma=e.sigma;else throw u.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(u.defined(e.m1))if(u.number(e.m1)&&u.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw u.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(u.defined(e.m2))if(u.number(e.m2)&&u.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw u.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(u.defined(e.x1))if(u.number(e.x1)&&u.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw u.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(u.defined(e.y2))if(u.number(e.y2)&&u.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw u.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(u.defined(e.y3))if(u.number(e.y3)&&u.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw u.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else this.options.sharpenSigma=-1;return this}function b2(e){if(!u.defined(e))this.options.medianSize=3;else if(u.integer(e)&&u.inRange(e,1,1000))this.options.medianSize=e;else throw u.invalidParameterError("size","integer between 1 and 1000",e);return this}function x2(e){let t;if(u.number(e))t=e;else if(u.plainObject(e)){if(!u.number(e.sigma))throw u.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(u.string(i$[e.precision]))this.options.precision=i$[e.precision];else throw u.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(u.number(e.minAmplitude)&&u.inRange(e.minAmplitude,0.001,1))this.options.minAmpl=e.minAmplitude;else throw u.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!u.defined(e))this.options.blurSigma=-1;else if(u.bool(e))this.options.blurSigma=e?-1:0;else if(u.number(t)&&u.inRange(t,0.3,1000))this.options.blurSigma=t;else throw u.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function $2(e){if(!u.defined(e))this.options.dilateWidth=1;else if(u.integer(e)&&u.inRange(e,1,65536))this.options.dilateWidth=e;else throw u.invalidParameterError("width","integer between 1 and 65536",e);return this}function v2(e){if(!u.defined(e))this.options.erodeWidth=1;else if(u.integer(e)&&u.inRange(e,1,65536))this.options.erodeWidth=e;else throw u.invalidParameterError("width","integer between 1 and 65536",e);return this}function w2(e){if(this.options.flatten=u.bool(e)?e:!0,u.object(e))this._setBackgroundColourOption("flattenBackground",e.background);return this}function S2(){return this.options.unflatten=!0,this}function E2(e,t){if(!u.defined(e))this.options.gamma=2.2;else if(u.number(e)&&u.inRange(e,1,3))this.options.gamma=e;else throw u.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!u.defined(t))this.options.gammaOut=this.options.gamma;else if(u.number(t)&&u.inRange(t,1,3))this.options.gammaOut=t;else throw u.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function _2(e){if(this.options.negate=u.bool(e)?e:!0,u.plainObject(e)&&"alpha"in e)if(!u.bool(e.alpha))throw u.invalidParameterError("alpha","should be boolean value",e.alpha);else this.options.negateAlpha=e.alpha;return this}function P2(e){if(u.plainObject(e)){if(u.defined(e.lower))if(u.number(e.lower)&&u.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw u.invalidParameterError("lower","number between 0 and 99",e.lower);if(u.defined(e.upper))if(u.number(e.upper)&&u.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw u.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw u.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function j2(e){return this.normalise(e)}function k2(e){if(u.plainObject(e)){if(u.integer(e.width)&&u.inRange(e.width,1,65536))this.options.claheWidth=e.width;else throw u.invalidParameterError("width","integer between 1 and 65536",e.width);if(u.integer(e.height)&&u.inRange(e.height,1,65536))this.options.claheHeight=e.height;else throw u.invalidParameterError("height","integer between 1 and 65536",e.height);if(u.defined(e.maxSlope))if(u.integer(e.maxSlope)&&u.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw u.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw u.invalidParameterError("options","plain object",e);return this}function R2(e){if(!u.object(e)||!Array.isArray(e.kernel)||!u.integer(e.width)||!u.integer(e.height)||!u.inRange(e.width,3,1001)||!u.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length||!e.kernel.every(u.number))throw Error("Invalid convolution kernel");if(!u.integer(e.scale))e.scale=e.kernel.reduce((t,r)=>t+r,0);if(e.scale<1)e.scale=1;if(!u.integer(e.offset))e.offset=0;return this.options.convKernel=e,this}function A2(e,t){if(!u.defined(e))this.options.threshold=128;else if(u.bool(e))this.options.threshold=e?128:0;else if(u.integer(e)&&u.inRange(e,0,255))this.options.threshold=e;else throw u.invalidParameterError("threshold","integer between 0 and 255",e);if(!u.object(t)||t.greyscale===!0||t.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function O2(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),u.string(t)&&u.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw u.invalidParameterError("operator","one of: and, or, eor",t);return this}function C2(e,t){if(!u.defined(e)&&u.number(t))e=1;else if(u.number(e)&&!u.defined(t))t=0;if(!u.defined(e))this.options.linearA=[];else if(u.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&u.inRange(e.length,1,1e6)&&e.every(u.number))this.options.linearA=e;else throw u.invalidParameterError("a","number or array of numbers",e);if(!u.defined(t))this.options.linearB=[];else if(u.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&u.inRange(t.length,1,1e6)&&t.every(u.number))this.options.linearB=t;else throw u.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw Error("Expected a and b to be arrays of the same length");return this}function N2(e){if(!Array.isArray(e))throw u.invalidParameterError("inputMatrix","array",e);let t=e.length;if(t!==3&&t!==4)throw u.invalidParameterError("inputMatrix","3x3 or 4x4 array",t);if(!e.every((n)=>Array.isArray(n)&&n.length===t))throw u.invalidParameterError("inputMatrix",`array of ${t} arrays of length ${t}`,e);let r=e.flat();if(!r.every(u.number))throw u.invalidParameterError("inputMatrix","array of numbers",r);return this.options.recombMatrix=r,this}function T2(e){if(!u.plainObject(e))throw u.invalidParameterError("options","plain object",e);if("brightness"in e)if(u.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw u.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(u.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw u.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(u.integer(e.hue))this.options.hue=e.hue%360;else throw u.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(u.number(e.lightness))this.options.lightness=e.lightness;else throw u.invalidParameterError("lightness","number",e.lightness);return this}var i$,o$=(e)=>{Object.assign(e.prototype,{autoOrient:p2,rotate:f2,flip:m2,flop:h2,affine:g2,sharpen:y2,erode:v2,dilate:$2,median:b2,blur:x2,flatten:w2,unflatten:S2,gamma:E2,negate:_2,normalise:P2,normalize:j2,clahe:k2,convolve:R2,threshold:A2,boolean:O2,linear:C2,recomb:N2,modulate:T2})};var a$=q(()=>{Dr();/*!
|
|
353
351
|
Copyright 2013 Lovell Fuller and others.
|
|
354
352
|
SPDX-License-Identifier: Apache-2.0
|
|
355
|
-
*/o$={integer:"integer",float:"float",approximate:"approximate"}});var m$=C(function(gK,p$){var{defineProperty:Pd,getOwnPropertyDescriptor:A2,getOwnPropertyNames:O2}=Object,C2=Object.prototype.hasOwnProperty,T2=(e,t)=>{for(var r in t)Pd(e,r,{get:t[r],enumerable:!0})},N2=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of O2(t))if(!C2.call(e,s)&&s!==r)Pd(e,s,{get:()=>t[s],enumerable:!(n=A2(t,s))||n.enumerable})}return e},I2=(e)=>N2(Pd({},"__esModule",{value:!0}),e),c$={};T2(c$,{default:()=>K2});p$.exports=I2(c$);var wd={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in wd)Object.freeze(wd[e]);var Wr=Object.freeze(wd),u$=Object.create(null);for(let e in Wr)if(Object.hasOwn(Wr,e))u$[Wr[e]]=e;var Bt={to:{},get:{}};Bt.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=Bt.get.hsl(e),n="hsl";break}case"hwb":{r=Bt.get.hwb(e),n="hwb";break}default:{r=Bt.get.rgb(e),n="rgb";break}}if(!r)return null;return{model:n,value:r}};Bt.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,s=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,i=/^(\w+)$/,o=[0,0,0,1],a,l,c;if(a=e.match(r)){c=a[2],a=a[1];for(l=0;l<3;l++){let d=l*2;o[l]=Number.parseInt(a.slice(d,d+2),16)}if(c)o[3]=Number.parseInt(c,16)/255}else if(a=e.match(t)){a=a[1],c=a[3];for(l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);if(c)o[3]=Number.parseInt(c+c,16)/255}else if(a=e.match(n)){for(l=0;l<3;l++)o[l]=Number.parseFloat(a[l+1]);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.match(s)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.toLowerCase().match(i)){if(a[1]==="transparent")return[0,0,0,0];if(!Object.hasOwn(Wr,a[1]))return null;return o=Wr[a[1]].slice(),o[3]=1,o}else return null;for(l=0;l<3;l++)o[l]=Ln(o[l],0,255);return o[3]=Ln(o[3],0,1),o};Bt.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=Ln(Number.parseFloat(r[2]),0,100),o=Ln(Number.parseFloat(r[3]),0,100),a=Ln(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Bt.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=Ln(Number.parseFloat(r[2]),0,100),o=Ln(Number.parseFloat(r[3]),0,100),a=Ln(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Bt.to.hex=function(...e){return"#"+El(e[0])+El(e[1])+El(e[2])+(e[3]<1?El(Math.round(e[3]*255)):"")};Bt.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};Bt.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"};Bt.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};Bt.to.hwb=function(...e){let t="";if(e.length>=4&&e[3]!==1)t=", "+e[3];return"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};Bt.to.keyword=function(...e){return u$[e.slice(0,3)]};function Ln(e,t,r){return Math.min(Math.max(t,e),r)}function El(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var ci=Bt,d$={};for(let e of Object.keys(Wr))d$[Wr[e]]=e;var K={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},Ss=K,bn=0.008856451679035631;function di(e){let t=e>0.0031308?1.055*e**0.4166666666666667-0.055:e*12.92;return Math.min(Math.max(0,t),1)}function fi(e){return e>0.04045?((e+0.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(K)){if(!("channels"in K[e]))throw Error("missing channels property: "+e);if(!("labels"in K[e]))throw Error("missing channel labels property: "+e);if(K[e].labels.length!==K[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=K[e];delete K[e].channels,delete K[e].labels,Object.defineProperty(K[e],"channels",{value:t}),Object.defineProperty(K[e],"labels",{value:r})}K.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(t,r,n),i=Math.max(t,r,n),o=i-s,a,l;switch(i){case s:{a=0;break}case t:{a=(r-n)/o;break}case r:{a=2+(n-t)/o;break}case n:{a=4+(t-r)/o;break}}if(a=Math.min(a*60,360),a<0)a+=360;let c=(s+i)/2;if(i===s)l=0;else if(c<=0.5)l=o/(i+s);else l=o/(2-i-s);return[a,l*100,c*100]};K.rgb.hsv=function(e){let t,r,n,s,i,o=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(o,a,l),d=c-Math.min(o,a,l),p=function(h){return(c-h)/6/d+0.5};if(d===0)s=0,i=0;else{switch(i=d/c,t=p(o),r=p(a),n=p(l),c){case o:{s=n-r;break}case a:{s=0.3333333333333333+t-n;break}case l:{s=0.6666666666666666+r-t;break}}if(s<0)s+=1;else if(s>1)s-=1}return[s*360,i*100,c*100]};K.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],s=K.rgb.hsl(e)[0],i=0.00392156862745098*Math.min(t,Math.min(r,n));return n=1-0.00392156862745098*Math.max(t,Math.max(r,n)),[s,i*100,n*100]};K.rgb.oklab=function(e){let t=fi(e[0]/255),r=fi(e[1]/255),n=fi(e[2]/255),s=Math.cbrt(0.4122214708*t+0.5363325363*r+0.0514459929*n),i=Math.cbrt(0.2119034982*t+0.6806995451*r+0.1073969566*n),o=Math.cbrt(0.0883024619*t+0.2817188376*r+0.6299787005*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};K.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-r,1-n),i=(1-t-s)/(1-s)||0,o=(1-r-s)/(1-s)||0,a=(1-n-s)/(1-s)||0;return[i*100,o*100,a*100,s*100]};function M2(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}K.rgb.keyword=function(e){let t=d$[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let s of Object.keys(Wr)){let i=Wr[s],o=M2(e,i);if(o<r)r=o,n=s}return n};K.keyword.rgb=function(e){return[...Wr[e]]};K.rgb.xyz=function(e){let t=fi(e[0]/255),r=fi(e[1]/255),n=fi(e[2]/255),s=t*0.4124564+r*0.3575761+n*0.1804375,i=t*0.2126729+r*0.7151522+n*0.072175,o=t*0.0193339+r*0.119192+n*0.9503041;return[s*100,i*100,o*100]};K.rgb.lab=function(e){let t=K.rgb.xyz(e),r=t[0],n=t[1],s=t[2];r/=95.047,n/=100,s/=108.883,r=r>bn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>bn?n**0.3333333333333333:7.787*n+0.13793103448275862,s=s>bn?s**0.3333333333333333:7.787*s+0.13793103448275862;let i=116*n-16,o=500*(r-n),a=200*(n-s);return[i,o,a]};K.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s,i;if(r===0)return i=n*255,[i,i,i];let o=n<0.5?n*(1+r):n+r-n*r,a=2*n-o,l=[0,0,0];for(let c=0;c<3;c++){if(s=t+0.3333333333333333*-(c-1),s<0)s++;if(s>1)s--;if(6*s<1)i=a+(o-a)*6*s;else if(2*s<1)i=o;else if(3*s<2)i=a+(o-a)*(0.6666666666666666-s)*6;else i=a;l[c]=i*255}return l};K.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=r,i=Math.max(n,0.01);n*=2,r*=n<=1?n:2-n,s*=i<=1?i:2-i;let o=(n+r)/2,a=n===0?2*s/(i+s):2*r/(n+r);return[t,a*100,o*100]};K.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,s=Math.floor(t)%6,i=t-Math.floor(t),o=255*n*(1-r),a=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,s){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};K.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=Math.max(n,0.01),i,o;o=(2-r)*n;let a=(2-r)*s;return i=r*s,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};K.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s=r+n,i;if(s>1)r/=s,n/=s;let o=Math.floor(6*t),a=1-n;if(i=6*t-o,(o&1)!==0)i=1-i;let l=r+i*(a-r),c,d,p;switch(o){default:case 6:case 0:{c=a,d=l,p=r;break}case 1:{c=l,d=a,p=r;break}case 2:{c=r,d=a,p=l;break}case 3:{c=r,d=l,p=a;break}case 4:{c=l,d=r,p=a;break}case 5:{c=a,d=r,p=l;break}}return[c*255,d*255,p*255]};K.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=e[3]/100,i=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,r*(1-s)+s),a=1-Math.min(1,n*(1-s)+s);return[i*255,o*255,a*255]};K.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s,i,o;return s=t*3.2404542+r*-1.5371385+n*-0.4985314,i=t*-0.969266+r*1.8760108+n*0.041556,o=t*0.0556434+r*-0.2040259+n*1.0572252,s=di(s),i=di(i),o=di(o),[s*255,i*255,o*255]};K.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>bn?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>bn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>bn?n**0.3333333333333333:7.787*n+0.13793103448275862;let s=116*r-16,i=500*(t-r),o=200*(r-n);return[s,i,o]};K.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=Math.cbrt(0.8189330101*t+0.3618667424*r-0.1288597137*n),i=Math.cbrt(0.0329845436*t+0.9293118715*r+0.0361456387*n),o=Math.cbrt(0.0482003018*t+0.2643662691*r+0.633851707*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};K.oklab.oklch=function(e){return K.lab.lch(e)};K.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(0.999999998*t+0.396337792*r+0.215803758*n)**3,i=(1.000000008*t-0.105561342*r-0.063854175*n)**3,o=(1.000000055*t-0.089484182*r-1.291485538*n)**3,a=1.227013851*s-0.55779998*i+0.281256149*o,l=-0.040580178*s+1.11225687*i-0.071676679*o,c=-0.076381285*s-0.421481978*i+1.58616322*o;return[a*100,l*100,c*100]};K.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(t+0.3963377774*r+0.2158037573*n)**3,i=(t-0.1055613458*r-0.0638541728*n)**3,o=(t-0.0894841775*r-1.291485548*n)**3,a=di(4.0767416621*s-3.3077115913*i+0.2309699292*o),l=di(-1.2684380046*s+2.6097574011*i-0.3413193965*o),c=di(-0.0041960863*s-0.7034186147*i+1.707614701*o);return[a*255,l*255,c*255]};K.oklch.oklab=function(e){return K.lch.lab(e)};K.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],s,i,o;i=(t+16)/116,s=r/500+i,o=i-n/200;let a=i**3,l=s**3,c=o**3;return i=a>bn?a:(i-0.13793103448275862)/7.787,s=l>bn?l:(s-0.13793103448275862)/7.787,o=c>bn?c:(o-0.13793103448275862)/7.787,s*=95.047,i*=100,o*=108.883,[s,i,o]};K.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],s;if(s=Math.atan2(n,r)*360/2/Math.PI,s<0)s+=360;let o=Math.sqrt(r*r+n*n);return[t,o,s]};K.lch.lab=function(e){let t=e[0],r=e[1],s=e[2]/360*2*Math.PI,i=r*Math.cos(s),o=r*Math.sin(s);return[t,i,o]};K.rgb.ansi16=function(e,t=null){let[r,n,s]=e,i=t===null?K.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(r/255));if(i===2)o+=60;return o};K.hsv.ansi16=function(e){return K.rgb.ansi16(K.hsv.rgb(e),e[2])};K.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];if(t>>4===r>>4&&r>>4===n>>4){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};K.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let r=(Math.trunc(e>50)+1)*0.5,n=(t&1)*r*255,s=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,s,i]};K.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[r,n,s]};K.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};K.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];if(t[0].length===3)r=[...r].map((a)=>a+a).join("");let n=Number.parseInt(r,16),s=n>>16&255,i=n>>8&255,o=n&255;return[s,i,o]};K.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),o=s-i,a,l=o<1?i/(1-o):0;if(o<=0)a=0;else if(s===t)a=(r-n)/o%6;else if(s===r)a=2+(n-t)/o;else a=4+(t-r)/o;return a/=6,a%=1,[a*360,o*100,l*100]};K.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<0.5?2*t*r:2*t*(1-r),s=0;if(n<1)s=(r-0.5*n)/(1-n);return[e[0],n*100,s*100]};K.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,s=0;if(n<1)s=(r-n)/(1-n);return[e[0],n*100,s*100]};K.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let s=[0,0,0],i=t%1*6,o=i%1,a=1-o,l=0;switch(Math.floor(i)){case 0:{s[0]=1,s[1]=o,s[2]=0;break}case 1:{s[0]=a,s[1]=1,s[2]=0;break}case 2:{s[0]=0,s[1]=1,s[2]=o;break}case 3:{s[0]=0,s[1]=a,s[2]=1;break}case 4:{s[0]=o,s[1]=0,s[2]=1;break}default:s[0]=1,s[1]=0,s[2]=a}return l=(1-r)*n,[(r*s[0]+l)*255,(r*s[1]+l)*255,(r*s[2]+l)*255]};K.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),s=0;if(n>0)s=t/n;return[e[0],s*100,n*100]};K.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+0.5*t,s=0;if(n>0&&n<0.5)s=t/(2*n);else if(n>=0.5&&n<1)s=t/(2*(1-n));return[e[0],s*100,n*100]};K.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};K.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,s=n-t,i=0;if(s<1)i=(n-s)/(1-s);return[e[0],s*100,i*100]};K.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};K.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};K.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};K.gray.hsl=function(e){return[0,0,e[0]]};K.gray.hsv=K.gray.hsl;K.gray.hwb=function(e){return[0,100,e[0]]};K.gray.cmyk=function(e){return[0,0,0,e[0]]};K.gray.lab=function(e){return[e[0],0,0]};K.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(n.length)+n};K.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function J2(){let e={},t=Object.keys(Ss);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function D2(e){let t=J2(),r=[e];t[e].distance=0;while(r.length>0){let n=r.pop(),s=Object.keys(Ss[n]);for(let{length:i}=s,o=0;o<i;o++){let a=s[o],l=t[a];if(l.distance===-1)l.distance=t[n].distance+1,l.parent=n,r.unshift(a)}}return t}function L2(e,t){return function(r){return t(e(r))}}function F2(e,t){let r=[t[e].parent,e],n=Ss[t[e].parent][e],s=t[e].parent;while(t[s].parent)r.unshift(t[s].parent),n=L2(Ss[t[s].parent][s],n),s=t[s].parent;return n.conversion=r,n}function q2(e){let t=D2(e),r={},n=Object.keys(t);for(let{length:s}=n,i=0;i<s;i++){let o=n[i];if(t[o].parent===null)continue;r[o]=F2(o,t)}return r}var H2=q2,ui={},V2=Object.keys(Ss);function W2(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;return e(r)};if("conversion"in e)t.conversion=e.conversion;return t}function B2(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;let s=e(r);if(typeof s==="object")for(let{length:i}=s,o=0;o<i;o++)s[o]=Math.round(s[o]);return s};if("conversion"in e)t.conversion=e.conversion;return t}for(let e of V2){ui[e]={},Object.defineProperty(ui[e],"channels",{value:Ss[e].channels}),Object.defineProperty(ui[e],"labels",{value:Ss[e].labels});let t=H2(e),r=Object.keys(t);for(let n of r){let s=t[n];ui[e][n]=B2(s),ui[e][n].raw=W2(s)}}var ar=ui,f$=["keyword","gray","hex"],Sd={};for(let e of Object.keys(ar))Sd[[...ar[e].labels].sort().join("")]=e;var Ed={};function ft(e,t){if(!(this instanceof ft))return new ft(e,t);if(t&&t in f$)t=null;if(t&&!(t in ar))throw Error("Unknown model: "+t);let r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof ft)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==="string"){let s=ci.get(e);if(s===null)throw Error("Unable to parse color from string: "+e);this.model=s.model,n=ar[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]==="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=ar[this.model].channels;let s=Array.prototype.slice.call(e,0,n);this.color=_d(s,n),this.valpha=typeof e[n]==="number"?e[n]:1}else if(typeof e==="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let s=Object.keys(e);if("alpha"in e)s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha==="number"?e.alpha:0;let i=s.sort().join("");if(!(i in Sd))throw Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Sd[i];let{labels:o}=ar[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=_d(a)}if(Ed[this.model]){n=ar[this.model].channels;for(r=0;r<n;r++){let s=Ed[this.model][r];if(s)this.color[r]=s(this.color[r])}}if(this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze)Object.freeze(this)}ft.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in ci.to?this:this.rgb();t=t.round(typeof e==="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return ci.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e==="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return ci.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=ar[this.model],{labels:r}=ar[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];if(this.valpha!==1)e.alpha=this.valpha;return e},unitArray(){let e=this.rgb().color;if(e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1)e.push(this.valpha);return e},unitObject(){let e=this.rgb().object();if(e.r/=255,e.g/=255,e.b/=255,this.valpha!==1)e.alpha=this.valpha;return e},round(e){return e=Math.max(e||0,0),new ft([...this.color.map(z2(e)),this.valpha],this.model)},alpha(e){if(e!==void 0)return new ft([...this.color,Math.max(0,Math.min(1,e))],this.model);return this.valpha},red:et("rgb",0,ct(255)),green:et("rgb",1,ct(255)),blue:et("rgb",2,ct(255)),hue:et(["hsl","hsv","hsl","hwb","hcg"],0,(e)=>(e%360+360)%360),saturationl:et("hsl",1,ct(100)),lightness:et("hsl",2,ct(100)),saturationv:et("hsv",1,ct(100)),value:et("hsv",2,ct(100)),chroma:et("hcg",1,ct(100)),gray:et("hcg",2,ct(100)),white:et("hwb",1,ct(100)),wblack:et("hwb",2,ct(100)),cyan:et("cmyk",0,ct(100)),magenta:et("cmyk",1,ct(100)),yellow:et("cmyk",2,ct(100)),black:et("cmyk",3,ct(100)),x:et("xyz",0,ct(95.047)),y:et("xyz",1,ct(100)),z:et("xyz",2,ct(108.833)),l:et("lab",0,ct(100)),a:et("lab",1),b:et("lab",2),keyword(e){if(e!==void 0)return new ft(e);return ar[this.model].keyword(this.color)},hex(e){if(e!==void 0)return new ft(e);return ci.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new ft(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();if(r.length===1)r="0"+r;return ci.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,n]of e.entries()){let s=n/255;t[r]=s<=0.04045?s/12.92:((s+0.055)/1.055)**2.4}return 0.2126*t[0]+0.7152*t[1]+0.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();if(t>r)return(t+0.05)/(r+0.05);return(r+0.05)/(t+0.05)},level(e){let t=this.contrast(e);if(t>=7)return"AAA";return t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*0.3+e[1]*0.59+e[2]*0.11;return ft.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),n=this.rgb(),s=t===void 0?0.5:t,i=2*s-1,o=r.alpha()-n.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,l=1-a;return ft.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue(),r.alpha()*s+n.alpha()*(1-s))}};for(let e of Object.keys(ar)){if(f$.includes(e))continue;let{channels:t}=ar[e];ft.prototype[e]=function(...r){if(this.model===e)return new ft(this);if(r.length>0)return new ft(r,e);return new ft([...G2(ar[this.model][e].raw(this.color)),this.valpha],e)},ft[e]=function(...r){let n=r[0];if(typeof n==="number")n=_d(r,t);return new ft(n,e)}}function U2(e,t){return Number(e.toFixed(t))}function z2(e){return function(t){return U2(t,e)}}function et(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(Ed[n]||=[])[t]=r;return e=e[0],function(n){let s;if(n!==void 0){if(r)n=r(n);return s=this[e](),s.color[t]=n,s}if(s=this[e]().color[t],r)s=r(s);return s}}function ct(e){return function(t){return Math.max(0,Math.min(e,t))}}function G2(e){return Array.isArray(e)?e:[e]}function _d(e,t){for(let r=0;r<t;r++)if(typeof e[r]!=="number")e[r]=0;return e}var K2=ft});var g$=C(function(yK,h$){h$.exports=m$().default});function Y2(e){return this._setBackgroundColourOption("tint",e),this}function X2(e){return this.options.greyscale=u.bool(e)?e:!0,this}function Z2(e){return this.greyscale(e)}function Q2(e){if(!u.string(e))throw u.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function eM(e){return this.pipelineColourspace(e)}function tM(e){if(!u.string(e))throw u.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function rM(e){return this.toColourspace(e)}function x$(e){if(u.object(e)||u.string(e)&&e.length>=3&&e.length<=200){let t=b$.default(e),r=t.red(),n=t.green(),s=t.blue(),i=Math.round(t.alpha()*255);for(let[o,a]of[["red",r],["green",n],["blue",s],["alpha",i]])if(!u.number(a))throw u.invalidParameterError(`background.${o}`,"number",a);return[r,n,s,i]}else throw u.invalidParameterError("background","object or string",e)}function nM(e,t){if(u.defined(t))this.options[e]=x$(t)}var b$,y$,$$=(e)=>{Object.assign(e.prototype,{tint:Y2,greyscale:X2,grayscale:Z2,pipelineColourspace:Q2,pipelineColorspace:eM,toColourspace:tM,toColorspace:rM,_getBackgroundColourOption:x$,_setBackgroundColourOption:nM}),e.colourspace=y$,e.colorspace=y$};var v$=q(()=>{Dr();b$=kt(g$(),1);/*!
|
|
353
|
+
*/i$={integer:"integer",float:"float",approximate:"approximate"}});var p$=C(function(jK,f$){var{defineProperty:Sd,getOwnPropertyDescriptor:I2,getOwnPropertyNames:M2}=Object,J2=Object.prototype.hasOwnProperty,D2=(e,t)=>{for(var r in t)Sd(e,r,{get:t[r],enumerable:!0})},L2=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of M2(t))if(!J2.call(e,s)&&s!==r)Sd(e,s,{get:()=>t[s],enumerable:!(n=I2(t,s))||n.enumerable})}return e},F2=(e)=>L2(Sd({},"__esModule",{value:!0}),e),l$={};D2(l$,{default:()=>eM});f$.exports=F2(l$);var xd={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in xd)Object.freeze(xd[e]);var Br=Object.freeze(xd),c$=Object.create(null);for(let e in Br)if(Object.hasOwn(Br,e))c$[Br[e]]=e;var Wt={to:{},get:{}};Wt.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=Wt.get.hsl(e),n="hsl";break}case"hwb":{r=Wt.get.hwb(e),n="hwb";break}default:{r=Wt.get.rgb(e),n="rgb";break}}if(!r)return null;return{model:n,value:r}};Wt.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,s=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,i=/^(\w+)$/,o=[0,0,0,1],a,l,c;if(a=e.match(r)){c=a[2],a=a[1];for(l=0;l<3;l++){let d=l*2;o[l]=Number.parseInt(a.slice(d,d+2),16)}if(c)o[3]=Number.parseInt(c,16)/255}else if(a=e.match(t)){a=a[1],c=a[3];for(l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);if(c)o[3]=Number.parseInt(c+c,16)/255}else if(a=e.match(n)){for(l=0;l<3;l++)o[l]=Number.parseFloat(a[l+1]);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.match(s)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.toLowerCase().match(i)){if(a[1]==="transparent")return[0,0,0,0];if(!Object.hasOwn(Br,a[1]))return null;return o=Br[a[1]].slice(),o[3]=1,o}else return null;for(l=0;l<3;l++)o[l]=Fn(o[l],0,255);return o[3]=Fn(o[3],0,1),o};Wt.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=Fn(Number.parseFloat(r[2]),0,100),o=Fn(Number.parseFloat(r[3]),0,100),a=Fn(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Wt.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=Fn(Number.parseFloat(r[2]),0,100),o=Fn(Number.parseFloat(r[3]),0,100),a=Fn(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Wt.to.hex=function(...e){return"#"+vl(e[0])+vl(e[1])+vl(e[2])+(e[3]<1?vl(Math.round(e[3]*255)):"")};Wt.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};Wt.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"};Wt.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};Wt.to.hwb=function(...e){let t="";if(e.length>=4&&e[3]!==1)t=", "+e[3];return"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};Wt.to.keyword=function(...e){return c$[e.slice(0,3)]};function Fn(e,t,r){return Math.min(Math.max(t,e),r)}function vl(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var ci=Wt,u$={};for(let e of Object.keys(Br))u$[Br[e]]=e;var K={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},Ss=K,bn=0.008856451679035631;function di(e){let t=e>0.0031308?1.055*e**0.4166666666666667-0.055:e*12.92;return Math.min(Math.max(0,t),1)}function fi(e){return e>0.04045?((e+0.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(K)){if(!("channels"in K[e]))throw Error("missing channels property: "+e);if(!("labels"in K[e]))throw Error("missing channel labels property: "+e);if(K[e].labels.length!==K[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=K[e];delete K[e].channels,delete K[e].labels,Object.defineProperty(K[e],"channels",{value:t}),Object.defineProperty(K[e],"labels",{value:r})}K.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(t,r,n),i=Math.max(t,r,n),o=i-s,a,l;switch(i){case s:{a=0;break}case t:{a=(r-n)/o;break}case r:{a=2+(n-t)/o;break}case n:{a=4+(t-r)/o;break}}if(a=Math.min(a*60,360),a<0)a+=360;let c=(s+i)/2;if(i===s)l=0;else if(c<=0.5)l=o/(i+s);else l=o/(2-i-s);return[a,l*100,c*100]};K.rgb.hsv=function(e){let t,r,n,s,i,o=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(o,a,l),d=c-Math.min(o,a,l),p=function(h){return(c-h)/6/d+0.5};if(d===0)s=0,i=0;else{switch(i=d/c,t=p(o),r=p(a),n=p(l),c){case o:{s=n-r;break}case a:{s=0.3333333333333333+t-n;break}case l:{s=0.6666666666666666+r-t;break}}if(s<0)s+=1;else if(s>1)s-=1}return[s*360,i*100,c*100]};K.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],s=K.rgb.hsl(e)[0],i=0.00392156862745098*Math.min(t,Math.min(r,n));return n=1-0.00392156862745098*Math.max(t,Math.max(r,n)),[s,i*100,n*100]};K.rgb.oklab=function(e){let t=fi(e[0]/255),r=fi(e[1]/255),n=fi(e[2]/255),s=Math.cbrt(0.4122214708*t+0.5363325363*r+0.0514459929*n),i=Math.cbrt(0.2119034982*t+0.6806995451*r+0.1073969566*n),o=Math.cbrt(0.0883024619*t+0.2817188376*r+0.6299787005*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};K.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-r,1-n),i=(1-t-s)/(1-s)||0,o=(1-r-s)/(1-s)||0,a=(1-n-s)/(1-s)||0;return[i*100,o*100,a*100,s*100]};function q2(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}K.rgb.keyword=function(e){let t=u$[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let s of Object.keys(Br)){let i=Br[s],o=q2(e,i);if(o<r)r=o,n=s}return n};K.keyword.rgb=function(e){return[...Br[e]]};K.rgb.xyz=function(e){let t=fi(e[0]/255),r=fi(e[1]/255),n=fi(e[2]/255),s=t*0.4124564+r*0.3575761+n*0.1804375,i=t*0.2126729+r*0.7151522+n*0.072175,o=t*0.0193339+r*0.119192+n*0.9503041;return[s*100,i*100,o*100]};K.rgb.lab=function(e){let t=K.rgb.xyz(e),r=t[0],n=t[1],s=t[2];r/=95.047,n/=100,s/=108.883,r=r>bn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>bn?n**0.3333333333333333:7.787*n+0.13793103448275862,s=s>bn?s**0.3333333333333333:7.787*s+0.13793103448275862;let i=116*n-16,o=500*(r-n),a=200*(n-s);return[i,o,a]};K.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s,i;if(r===0)return i=n*255,[i,i,i];let o=n<0.5?n*(1+r):n+r-n*r,a=2*n-o,l=[0,0,0];for(let c=0;c<3;c++){if(s=t+0.3333333333333333*-(c-1),s<0)s++;if(s>1)s--;if(6*s<1)i=a+(o-a)*6*s;else if(2*s<1)i=o;else if(3*s<2)i=a+(o-a)*(0.6666666666666666-s)*6;else i=a;l[c]=i*255}return l};K.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=r,i=Math.max(n,0.01);n*=2,r*=n<=1?n:2-n,s*=i<=1?i:2-i;let o=(n+r)/2,a=n===0?2*s/(i+s):2*r/(n+r);return[t,a*100,o*100]};K.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,s=Math.floor(t)%6,i=t-Math.floor(t),o=255*n*(1-r),a=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,s){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};K.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=Math.max(n,0.01),i,o;o=(2-r)*n;let a=(2-r)*s;return i=r*s,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};K.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s=r+n,i;if(s>1)r/=s,n/=s;let o=Math.floor(6*t),a=1-n;if(i=6*t-o,(o&1)!==0)i=1-i;let l=r+i*(a-r),c,d,p;switch(o){default:case 6:case 0:{c=a,d=l,p=r;break}case 1:{c=l,d=a,p=r;break}case 2:{c=r,d=a,p=l;break}case 3:{c=r,d=l,p=a;break}case 4:{c=l,d=r,p=a;break}case 5:{c=a,d=r,p=l;break}}return[c*255,d*255,p*255]};K.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=e[3]/100,i=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,r*(1-s)+s),a=1-Math.min(1,n*(1-s)+s);return[i*255,o*255,a*255]};K.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s,i,o;return s=t*3.2404542+r*-1.5371385+n*-0.4985314,i=t*-0.969266+r*1.8760108+n*0.041556,o=t*0.0556434+r*-0.2040259+n*1.0572252,s=di(s),i=di(i),o=di(o),[s*255,i*255,o*255]};K.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>bn?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>bn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>bn?n**0.3333333333333333:7.787*n+0.13793103448275862;let s=116*r-16,i=500*(t-r),o=200*(r-n);return[s,i,o]};K.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=Math.cbrt(0.8189330101*t+0.3618667424*r-0.1288597137*n),i=Math.cbrt(0.0329845436*t+0.9293118715*r+0.0361456387*n),o=Math.cbrt(0.0482003018*t+0.2643662691*r+0.633851707*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};K.oklab.oklch=function(e){return K.lab.lch(e)};K.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(0.999999998*t+0.396337792*r+0.215803758*n)**3,i=(1.000000008*t-0.105561342*r-0.063854175*n)**3,o=(1.000000055*t-0.089484182*r-1.291485538*n)**3,a=1.227013851*s-0.55779998*i+0.281256149*o,l=-0.040580178*s+1.11225687*i-0.071676679*o,c=-0.076381285*s-0.421481978*i+1.58616322*o;return[a*100,l*100,c*100]};K.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(t+0.3963377774*r+0.2158037573*n)**3,i=(t-0.1055613458*r-0.0638541728*n)**3,o=(t-0.0894841775*r-1.291485548*n)**3,a=di(4.0767416621*s-3.3077115913*i+0.2309699292*o),l=di(-1.2684380046*s+2.6097574011*i-0.3413193965*o),c=di(-0.0041960863*s-0.7034186147*i+1.707614701*o);return[a*255,l*255,c*255]};K.oklch.oklab=function(e){return K.lch.lab(e)};K.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],s,i,o;i=(t+16)/116,s=r/500+i,o=i-n/200;let a=i**3,l=s**3,c=o**3;return i=a>bn?a:(i-0.13793103448275862)/7.787,s=l>bn?l:(s-0.13793103448275862)/7.787,o=c>bn?c:(o-0.13793103448275862)/7.787,s*=95.047,i*=100,o*=108.883,[s,i,o]};K.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],s;if(s=Math.atan2(n,r)*360/2/Math.PI,s<0)s+=360;let o=Math.sqrt(r*r+n*n);return[t,o,s]};K.lch.lab=function(e){let t=e[0],r=e[1],s=e[2]/360*2*Math.PI,i=r*Math.cos(s),o=r*Math.sin(s);return[t,i,o]};K.rgb.ansi16=function(e,t=null){let[r,n,s]=e,i=t===null?K.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(r/255));if(i===2)o+=60;return o};K.hsv.ansi16=function(e){return K.rgb.ansi16(K.hsv.rgb(e),e[2])};K.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];if(t>>4===r>>4&&r>>4===n>>4){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};K.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let r=(Math.trunc(e>50)+1)*0.5,n=(t&1)*r*255,s=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,s,i]};K.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[r,n,s]};K.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};K.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];if(t[0].length===3)r=[...r].map((a)=>a+a).join("");let n=Number.parseInt(r,16),s=n>>16&255,i=n>>8&255,o=n&255;return[s,i,o]};K.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),o=s-i,a,l=o<1?i/(1-o):0;if(o<=0)a=0;else if(s===t)a=(r-n)/o%6;else if(s===r)a=2+(n-t)/o;else a=4+(t-r)/o;return a/=6,a%=1,[a*360,o*100,l*100]};K.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<0.5?2*t*r:2*t*(1-r),s=0;if(n<1)s=(r-0.5*n)/(1-n);return[e[0],n*100,s*100]};K.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,s=0;if(n<1)s=(r-n)/(1-n);return[e[0],n*100,s*100]};K.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let s=[0,0,0],i=t%1*6,o=i%1,a=1-o,l=0;switch(Math.floor(i)){case 0:{s[0]=1,s[1]=o,s[2]=0;break}case 1:{s[0]=a,s[1]=1,s[2]=0;break}case 2:{s[0]=0,s[1]=1,s[2]=o;break}case 3:{s[0]=0,s[1]=a,s[2]=1;break}case 4:{s[0]=o,s[1]=0,s[2]=1;break}default:s[0]=1,s[1]=0,s[2]=a}return l=(1-r)*n,[(r*s[0]+l)*255,(r*s[1]+l)*255,(r*s[2]+l)*255]};K.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),s=0;if(n>0)s=t/n;return[e[0],s*100,n*100]};K.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+0.5*t,s=0;if(n>0&&n<0.5)s=t/(2*n);else if(n>=0.5&&n<1)s=t/(2*(1-n));return[e[0],s*100,n*100]};K.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};K.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,s=n-t,i=0;if(s<1)i=(n-s)/(1-s);return[e[0],s*100,i*100]};K.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};K.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};K.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};K.gray.hsl=function(e){return[0,0,e[0]]};K.gray.hsv=K.gray.hsl;K.gray.hwb=function(e){return[0,100,e[0]]};K.gray.cmyk=function(e){return[0,0,0,e[0]]};K.gray.lab=function(e){return[e[0],0,0]};K.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(n.length)+n};K.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function H2(){let e={},t=Object.keys(Ss);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function V2(e){let t=H2(),r=[e];t[e].distance=0;while(r.length>0){let n=r.pop(),s=Object.keys(Ss[n]);for(let{length:i}=s,o=0;o<i;o++){let a=s[o],l=t[a];if(l.distance===-1)l.distance=t[n].distance+1,l.parent=n,r.unshift(a)}}return t}function B2(e,t){return function(r){return t(e(r))}}function W2(e,t){let r=[t[e].parent,e],n=Ss[t[e].parent][e],s=t[e].parent;while(t[s].parent)r.unshift(t[s].parent),n=B2(Ss[t[s].parent][s],n),s=t[s].parent;return n.conversion=r,n}function U2(e){let t=V2(e),r={},n=Object.keys(t);for(let{length:s}=n,i=0;i<s;i++){let o=n[i];if(t[o].parent===null)continue;r[o]=W2(o,t)}return r}var z2=U2,ui={},G2=Object.keys(Ss);function K2(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;return e(r)};if("conversion"in e)t.conversion=e.conversion;return t}function Y2(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;let s=e(r);if(typeof s==="object")for(let{length:i}=s,o=0;o<i;o++)s[o]=Math.round(s[o]);return s};if("conversion"in e)t.conversion=e.conversion;return t}for(let e of G2){ui[e]={},Object.defineProperty(ui[e],"channels",{value:Ss[e].channels}),Object.defineProperty(ui[e],"labels",{value:Ss[e].labels});let t=z2(e),r=Object.keys(t);for(let n of r){let s=t[n];ui[e][n]=Y2(s),ui[e][n].raw=K2(s)}}var ar=ui,d$=["keyword","gray","hex"],$d={};for(let e of Object.keys(ar))$d[[...ar[e].labels].sort().join("")]=e;var vd={};function ft(e,t){if(!(this instanceof ft))return new ft(e,t);if(t&&t in d$)t=null;if(t&&!(t in ar))throw Error("Unknown model: "+t);let r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof ft)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==="string"){let s=ci.get(e);if(s===null)throw Error("Unable to parse color from string: "+e);this.model=s.model,n=ar[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]==="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=ar[this.model].channels;let s=Array.prototype.slice.call(e,0,n);this.color=wd(s,n),this.valpha=typeof e[n]==="number"?e[n]:1}else if(typeof e==="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let s=Object.keys(e);if("alpha"in e)s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha==="number"?e.alpha:0;let i=s.sort().join("");if(!(i in $d))throw Error("Unable to parse color from object: "+JSON.stringify(e));this.model=$d[i];let{labels:o}=ar[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=wd(a)}if(vd[this.model]){n=ar[this.model].channels;for(r=0;r<n;r++){let s=vd[this.model][r];if(s)this.color[r]=s(this.color[r])}}if(this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze)Object.freeze(this)}ft.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in ci.to?this:this.rgb();t=t.round(typeof e==="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return ci.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e==="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return ci.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=ar[this.model],{labels:r}=ar[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];if(this.valpha!==1)e.alpha=this.valpha;return e},unitArray(){let e=this.rgb().color;if(e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1)e.push(this.valpha);return e},unitObject(){let e=this.rgb().object();if(e.r/=255,e.g/=255,e.b/=255,this.valpha!==1)e.alpha=this.valpha;return e},round(e){return e=Math.max(e||0,0),new ft([...this.color.map(Z2(e)),this.valpha],this.model)},alpha(e){if(e!==void 0)return new ft([...this.color,Math.max(0,Math.min(1,e))],this.model);return this.valpha},red:et("rgb",0,ct(255)),green:et("rgb",1,ct(255)),blue:et("rgb",2,ct(255)),hue:et(["hsl","hsv","hsl","hwb","hcg"],0,(e)=>(e%360+360)%360),saturationl:et("hsl",1,ct(100)),lightness:et("hsl",2,ct(100)),saturationv:et("hsv",1,ct(100)),value:et("hsv",2,ct(100)),chroma:et("hcg",1,ct(100)),gray:et("hcg",2,ct(100)),white:et("hwb",1,ct(100)),wblack:et("hwb",2,ct(100)),cyan:et("cmyk",0,ct(100)),magenta:et("cmyk",1,ct(100)),yellow:et("cmyk",2,ct(100)),black:et("cmyk",3,ct(100)),x:et("xyz",0,ct(95.047)),y:et("xyz",1,ct(100)),z:et("xyz",2,ct(108.833)),l:et("lab",0,ct(100)),a:et("lab",1),b:et("lab",2),keyword(e){if(e!==void 0)return new ft(e);return ar[this.model].keyword(this.color)},hex(e){if(e!==void 0)return new ft(e);return ci.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new ft(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();if(r.length===1)r="0"+r;return ci.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,n]of e.entries()){let s=n/255;t[r]=s<=0.04045?s/12.92:((s+0.055)/1.055)**2.4}return 0.2126*t[0]+0.7152*t[1]+0.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();if(t>r)return(t+0.05)/(r+0.05);return(r+0.05)/(t+0.05)},level(e){let t=this.contrast(e);if(t>=7)return"AAA";return t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*0.3+e[1]*0.59+e[2]*0.11;return ft.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),n=this.rgb(),s=t===void 0?0.5:t,i=2*s-1,o=r.alpha()-n.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,l=1-a;return ft.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue(),r.alpha()*s+n.alpha()*(1-s))}};for(let e of Object.keys(ar)){if(d$.includes(e))continue;let{channels:t}=ar[e];ft.prototype[e]=function(...r){if(this.model===e)return new ft(this);if(r.length>0)return new ft(r,e);return new ft([...Q2(ar[this.model][e].raw(this.color)),this.valpha],e)},ft[e]=function(...r){let n=r[0];if(typeof n==="number")n=wd(r,t);return new ft(n,e)}}function X2(e,t){return Number(e.toFixed(t))}function Z2(e){return function(t){return X2(t,e)}}function et(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(vd[n]||=[])[t]=r;return e=e[0],function(n){let s;if(n!==void 0){if(r)n=r(n);return s=this[e](),s.color[t]=n,s}if(s=this[e]().color[t],r)s=r(s);return s}}function ct(e){return function(t){return Math.max(0,Math.min(e,t))}}function Q2(e){return Array.isArray(e)?e:[e]}function wd(e,t){for(let r=0;r<t;r++)if(typeof e[r]!=="number")e[r]=0;return e}var eM=ft});var h$=C(function(kK,m$){m$.exports=p$().default});function tM(e){return this._setBackgroundColourOption("tint",e),this}function rM(e){return this.options.greyscale=u.bool(e)?e:!0,this}function nM(e){return this.greyscale(e)}function sM(e){if(!u.string(e))throw u.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function iM(e){return this.pipelineColourspace(e)}function oM(e){if(!u.string(e))throw u.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function aM(e){return this.toColourspace(e)}function b$(e){if(u.object(e)||u.string(e)&&e.length>=3&&e.length<=200){let t=y$.default(e),r=t.red(),n=t.green(),s=t.blue(),i=Math.round(t.alpha()*255);for(let[o,a]of[["red",r],["green",n],["blue",s],["alpha",i]])if(!u.number(a))throw u.invalidParameterError(`background.${o}`,"number",a);return[r,n,s,i]}else throw u.invalidParameterError("background","object or string",e)}function lM(e,t){if(u.defined(t))this.options[e]=b$(t)}var y$,g$,x$=(e)=>{Object.assign(e.prototype,{tint:tM,greyscale:rM,grayscale:nM,pipelineColourspace:sM,pipelineColorspace:iM,toColourspace:oM,toColorspace:aM,_getBackgroundColourOption:b$,_setBackgroundColourOption:lM}),e.colourspace=g$,e.colorspace=g$};var $$=q(()=>{Dr();y$=Lt(h$(),1);/*!
|
|
356
354
|
Copyright 2013 Lovell Fuller and others.
|
|
357
355
|
SPDX-License-Identifier: Apache-2.0
|
|
358
|
-
*/
|
|
356
|
+
*/g$={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"}});function uM(){return this.options.removeAlpha=!0,this}function dM(e){if(u.defined(e))if(u.number(e)&&u.inRange(e,0,1))this.options.ensureAlpha=e;else throw u.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function fM(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e))e=t[e];if(u.integer(e)&&u.inRange(e,0,4))this.options.extractChannel=e;else throw u.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function pM(e,t){if(Array.isArray(e))e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this);else this.options.joinChannelIn.push(this._createInputDescriptor(e,t));return this}function mM(e){if(u.string(e)&&u.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw u.invalidParameterError("boolOp","one of: and, or, eor",e);return this}var cM,v$=(e)=>{Object.assign(e.prototype,{removeAlpha:uM,ensureAlpha:dM,extractChannel:fM,joinChannel:pM,bandbool:mM}),e.bool=cM};var w$=q(()=>{Dr();/*!
|
|
359
357
|
Copyright 2013 Lovell Fuller and others.
|
|
360
358
|
SPDX-License-Identifier: Apache-2.0
|
|
361
|
-
*/sM={and:"and",or:"or",eor:"eor"}});import jd from"node:path";function dM(e,t){let r;if(!u.string(e))r=Error("Missing output file path");else if(u.string(this.options.input.file)&&jd.resolve(this.options.input.file)===jd.resolve(e))r=Error("Cannot use same file for input and output");else if(uM.test(jd.extname(e))&&!this.constructor.format.jp2.output.file)r=_$();if(r)if(u.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function fM(e,t){if(u.object(e))this._setBooleanOption("resolveWithObject",e.resolveWithObject);else if(this.options.resolveWithObject)this.options.resolveWithObject=!1;this.options.fileOut="";let r=Error();return this._pipeline(u.fn(e)?e:t,r)}function pM(){this.options.resolveWithObject=!0,this.options.typedArrayOut=!0;let e=Error();return this._pipeline(null,e)}function mM(e){if(u.number(e)&&e>0)this.options.withMetadataDensity=e;else throw u.invalidParameterError("density","positive number",e);return this.keepExif()}function hM(){return this.options.keepMetadata|=1,this}function gM(e){if(u.object(e))for(let[t,r]of Object.entries(e))if(u.object(r))for(let[n,s]of Object.entries(r))if(u.string(s))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=s;else throw u.invalidParameterError(`${t}.${n}`,"string",s);else throw u.invalidParameterError(t,"object",r);else throw u.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function yM(e){return this.withExif(e),this.options.withExifMerge=!0,this}function bM(){return this.options.keepMetadata|=8,this}function xM(e,t){if(u.string(e))this.options.withIccProfile=e;else throw u.invalidParameterError("icc","string",e);if(this.keepIccProfile(),u.object(t)){if(u.defined(t.attach))if(u.bool(t.attach)){if(!t.attach)this.options.keepMetadata&=-9}else throw u.invalidParameterError("attach","boolean",t.attach)}return this}function $M(){return this.options.keepGainMap=!0,this.options.withGainMap=!1,this.options.keepMetadata|=32,this}function vM(){return this.options.withGainMap=!0,this.options.keepGainMap=!1,this.options.colourspace="scrgb",this}function wM(){return this.options.keepMetadata|=2,this}function SM(e){if(u.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw u.invalidParameterError("xmp","non-empty string",e);return this}function EM(){return this.options.keepMetadata|=31,this}function _M(e){if(this.keepMetadata(),this.withIccProfile("srgb"),u.object(e)){if(u.defined(e.orientation))if(u.integer(e.orientation)&&u.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw u.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(u.defined(e.density))if(u.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw u.invalidParameterError("density","positive number",e.density);if(u.defined(e.icc))this.withIccProfile(e.icc);if(u.defined(e.exif))this.withExifMerge(e.exif)}return this}function PM(e,t){let r=E$.get((u.object(e)&&u.string(e.id)?e.id:e).toLowerCase());if(!r)throw u.invalidParameterError("format",`one of: ${[...E$.keys()].join(", ")}`,e);return this[r](t)}function jM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.progressive))this._setBooleanOption("jpegProgressive",e.progressive);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=u.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(u.defined(t))this._setBooleanOption("jpegOptimiseCoding",t);if(u.defined(e.mozjpeg))if(u.bool(e.mozjpeg)){if(e.mozjpeg)this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3}else throw u.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=u.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;if(u.defined(r))this._setBooleanOption("jpegTrellisQuantisation",r);if(u.defined(e.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=u.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;if(u.defined(n)){if(this._setBooleanOption("jpegOptimiseScans",n),n)this.options.jpegProgressive=!0}let s=u.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(u.defined(s))if(u.integer(s)&&u.inRange(s,0,8))this.options.jpegQuantisationTable=s;else throw u.invalidParameterError("quantisationTable","integer between 0 and 8",s)}return this._updateFormatOut("jpeg",e)}function kM(e){if(u.object(e)){if(u.defined(e.progressive))this._setBooleanOption("pngProgressive",e.progressive);if(u.defined(e.compressionLevel))if(u.integer(e.compressionLevel)&&u.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw u.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);if(u.defined(e.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(u.defined(t))if(u.integer(t)&&u.inRange(t,2,256))this.options.pngBitdepth=P$(t);else throw u.invalidParameterError("colours","integer between 2 and 256",t);if(u.defined(e.palette))this._setBooleanOption("pngPalette",e.palette);else if([e.quality,e.effort,e.colours,e.colors,e.dither].some(u.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw u.invalidParameterError("quality","integer between 0 and 100",e.quality);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 10",e.effort);if(u.defined(e.dither))if(u.number(e.dither)&&u.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw u.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function RM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.alphaQuality))if(u.integer(e.alphaQuality)&&u.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw u.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(u.defined(e.lossless))this._setBooleanOption("webpLossless",e.lossless);if(u.defined(e.nearLossless))this._setBooleanOption("webpNearLossless",e.nearLossless);if(u.defined(e.smartSubsample))this._setBooleanOption("webpSmartSubsample",e.smartSubsample);if(u.defined(e.smartDeblock))this._setBooleanOption("webpSmartDeblock",e.smartDeblock);if(u.defined(e.preset))if(u.string(e.preset)&&u.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw u.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw u.invalidParameterError("effort","integer between 0 and 6",e.effort);if(u.defined(e.minSize))this._setBooleanOption("webpMinSize",e.minSize);if(u.defined(e.mixed))this._setBooleanOption("webpMixed",e.mixed);if(u.defined(e.exact))this._setBooleanOption("webpExact",e.exact)}return kd(e,this.options),this._updateFormatOut("webp",e)}function AM(e){if(u.object(e)){if(u.defined(e.reuse))this._setBooleanOption("gifReuse",e.reuse);if(u.defined(e.progressive))this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(u.defined(t))if(u.integer(t)&&u.inRange(t,2,256))this.options.gifBitdepth=P$(t);else throw u.invalidParameterError("colours","integer between 2 and 256",t);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 10",e.effort);if(u.defined(e.dither))if(u.number(e.dither)&&u.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw u.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(u.defined(e.interFrameMaxError))if(u.number(e.interFrameMaxError)&&u.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw u.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(u.defined(e.interPaletteMaxError))if(u.number(e.interPaletteMaxError)&&u.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw u.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(u.defined(e.keepDuplicateFrames))if(u.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw u.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return kd(e,this.options),this._updateFormatOut("gif",e)}function OM(e){if(!this.constructor.format.jp2.output.buffer)throw _$();if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.tileWidth))if(u.integer(e.tileWidth)&&u.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw u.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(u.defined(e.tileHeight))if(u.integer(e.tileHeight)&&u.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw u.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function kd(e,t){if(u.object(e)&&u.defined(e.loop))if(u.integer(e.loop)&&u.inRange(e.loop,0,65535))t.loop=e.loop;else throw u.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(u.object(e)&&u.defined(e.delay))if(u.integer(e.delay)&&u.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&u.inRange(e.delay.length,1,1e6)&&e.delay.every(u.integer)&&e.delay.every((r)=>u.inRange(r,0,65535)))t.delay=e.delay;else throw u.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function CM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.bitdepth))if(u.integer(e.bitdepth)&&u.inArray(e.bitdepth,[1,2,4]))this.options.tiffBitdepth=e.bitdepth;else throw u.invalidParameterError("bitdepth","1, 2 or 4",e.bitdepth);if(u.defined(e.tile))this._setBooleanOption("tiffTile",e.tile);if(u.defined(e.tileWidth))if(u.integer(e.tileWidth)&&u.inRange(e.tileWidth,1,32768))this.options.tiffTileWidth=e.tileWidth;else throw u.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(u.defined(e.tileHeight))if(u.integer(e.tileHeight)&&u.inRange(e.tileHeight,1,32768))this.options.tiffTileHeight=e.tileHeight;else throw u.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(u.defined(e.miniswhite))this._setBooleanOption("tiffMiniswhite",e.miniswhite);if(u.defined(e.pyramid))this._setBooleanOption("tiffPyramid",e.pyramid);if(u.defined(e.xres))if(u.number(e.xres)&&u.inRange(e.xres,0.001,1e6))this.options.tiffXres=e.xres;else throw u.invalidParameterError("xres","number between 0.001 and 1000000",e.xres);if(u.defined(e.yres))if(u.number(e.yres)&&u.inRange(e.yres,0.001,1e6))this.options.tiffYres=e.yres;else throw u.invalidParameterError("yres","number between 0.001 and 1000000",e.yres);if(u.defined(e.compression))if(u.string(e.compression)&&u.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw u.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(u.defined(e.bigtiff))this._setBooleanOption("tiffBigtiff",e.bigtiff);if(u.defined(e.predictor))if(u.string(e.predictor)&&u.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw u.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(u.defined(e.resolutionUnit))if(u.string(e.resolutionUnit)&&u.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw u.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function TM(e){return this.heif({...e,compression:"av1"})}function NM(e){if(u.object(e)){if(u.string(e.compression)&&u.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw u.invalidParameterError("compression","one of: av1, hevc",e.compression);if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.heifLossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw u.invalidParameterError("effort","integer between 0 and 9",e.effort);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(u.defined(e.bitdepth))if(u.integer(e.bitdepth)&&u.inArray(e.bitdepth,[8,10,12]))this.options.heifBitdepth=e.bitdepth;else throw u.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth);if(u.defined(e.tune))if(u.string(e.tune)&&u.inArray(e.tune,["auto","iq","psnr","ssim"]))if(this.options.heifLossless&&e.tune==="iq")this.options.heifTune="ssim";else this.options.heifTune=e.tune;else throw u.invalidParameterError("tune","one of: auto, iq, psnr, ssim",e.tune)}else throw u.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function IM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?0.1+(100-e.quality)*0.09:0.017666666666666667*e.quality*e.quality-1.15*e.quality+25;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(u.defined(e.distance))if(u.number(e.distance)&&u.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw u.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(u.defined(e.decodingTier))if(u.integer(e.decodingTier)&&u.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw u.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 9",e.effort)}return kd(e,this.options),this._updateFormatOut("jxl",e)}function MM(e){if(u.object(e)){if(u.defined(e.depth))if(u.string(e.depth)&&u.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw u.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth)}return this._updateFormatOut("raw")}function JM(e){if(u.object(e)){if(u.defined(e.size))if(u.integer(e.size)&&u.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw u.invalidParameterError("size","integer between 1 and 8192",e.size);if(u.defined(e.overlap))if(u.integer(e.overlap)&&u.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw u.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw u.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(u.defined(e.container))if(u.string(e.container)&&u.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw u.invalidParameterError("container","one of: fs, zip",e.container);if(u.defined(e.layout))if(u.string(e.layout)&&u.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw u.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(u.defined(e.angle))if(u.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw u.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),u.defined(e.depth))if(u.string(e.depth)&&u.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw u.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(u.defined(e.skipBlanks))if(u.integer(e.skipBlanks)&&u.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw u.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else if(u.defined(e.layout)&&e.layout==="google")this.options.tileSkipBlanks=5;let t=u.bool(e.center)?e.center:e.centre;if(u.defined(t))this._setBooleanOption("tileCentre",t);if(u.defined(e.id))if(u.string(e.id))this.options.tileId=e.id;else throw u.invalidParameterError("id","string",e.id);if(u.defined(e.basename))if(u.string(e.basename))this.options.tileBasename=e.basename;else throw u.invalidParameterError("basename","string",e.basename)}if(u.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw u.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function DM(e){if(!u.plainObject(e))throw u.invalidParameterError("options","object",e);if(u.integer(e.seconds)&&u.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw u.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function LM(e,t){if(!(u.object(t)&&t.force===!1))this.options.formatOut=e;return this}function FM(e,t){if(u.bool(t))this.options[e]=t;else throw u.invalidParameterError(e,"boolean",t)}function qM(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function HM(e,t){if(typeof e==="function"){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(r,n,s)=>{if(r)e(u.nativeError(r,t));else e(null,n,s)})});else Oe.pipeline(this.options,(r,n,s)=>{if(r)e(u.nativeError(r,t));else e(null,n,s)});return this}else if(this.options.streamOut){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",u.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))})});else Oe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",u.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(s,i,o)=>{if(s)n(u.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})});else return new Promise((r,n)=>{Oe.pipeline(this.options,(s,i,o)=>{if(s)n(u.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})}var E$,uM,_$=()=>Error("JP2 output requires libvips with support for OpenJPEG"),P$=(e)=>1<<32-Math.clz32(Math.ceil(Math.log2(e))-1),j$=(e)=>{Object.assign(e.prototype,{toFile:dM,toBuffer:fM,toUint8Array:pM,withDensity:mM,keepExif:hM,withExif:gM,withExifMerge:yM,keepIccProfile:bM,withIccProfile:xM,keepGainMap:$M,withGainMap:vM,keepXmp:wM,withXmp:SM,keepMetadata:EM,withMetadata:_M,toFormat:PM,jpeg:jM,jp2:OM,png:kM,webp:RM,tiff:CM,avif:TM,heif:NM,jxl:IM,gif:AM,raw:MM,tile:JM,timeout:DM,_updateFormatOut:LM,_setBooleanOption:FM,_read:qM,_pipeline:HM})};var k$=q(()=>{Dr();$o();/*!
|
|
359
|
+
*/cM={and:"and",or:"or",eor:"eor"}});import Ed from"node:path";function gM(e,t){let r;if(!u.string(e))r=Error("Missing output file path");else if(u.string(this.options.input.file)&&Ed.resolve(this.options.input.file)===Ed.resolve(e))r=Error("Cannot use same file for input and output");else if(hM.test(Ed.extname(e))&&!this.constructor.format.jp2.output.file)r=E$();if(r)if(u.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function yM(e,t){if(u.object(e))this._setBooleanOption("resolveWithObject",e.resolveWithObject);else if(this.options.resolveWithObject)this.options.resolveWithObject=!1;this.options.fileOut="";let r=Error();return this._pipeline(u.fn(e)?e:t,r)}function bM(){this.options.resolveWithObject=!0,this.options.typedArrayOut=!0;let e=Error();return this._pipeline(null,e)}function xM(e){if(u.number(e)&&e>0)this.options.withMetadataDensity=e;else throw u.invalidParameterError("density","positive number",e);return this.keepExif()}function $M(){return this.options.keepMetadata|=1,this}function vM(e){if(u.object(e))for(let[t,r]of Object.entries(e))if(u.object(r))for(let[n,s]of Object.entries(r))if(u.string(s))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=s;else throw u.invalidParameterError(`${t}.${n}`,"string",s);else throw u.invalidParameterError(t,"object",r);else throw u.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function wM(e){return this.withExif(e),this.options.withExifMerge=!0,this}function SM(){return this.options.keepMetadata|=8,this}function EM(e,t){if(u.string(e))this.options.withIccProfile=e;else throw u.invalidParameterError("icc","string",e);if(this.keepIccProfile(),u.object(t)){if(u.defined(t.attach))if(u.bool(t.attach)){if(!t.attach)this.options.keepMetadata&=-9}else throw u.invalidParameterError("attach","boolean",t.attach)}return this}function _M(){return this.options.keepGainMap=!0,this.options.withGainMap=!1,this.options.keepMetadata|=32,this}function PM(){return this.options.withGainMap=!0,this.options.keepGainMap=!1,this.options.colourspace="scrgb",this}function jM(){return this.options.keepMetadata|=2,this}function kM(e){if(u.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw u.invalidParameterError("xmp","non-empty string",e);return this}function RM(){return this.options.keepMetadata|=31,this}function AM(e){if(this.keepMetadata(),this.withIccProfile("srgb"),u.object(e)){if(u.defined(e.orientation))if(u.integer(e.orientation)&&u.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw u.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(u.defined(e.density))if(u.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw u.invalidParameterError("density","positive number",e.density);if(u.defined(e.icc))this.withIccProfile(e.icc);if(u.defined(e.exif))this.withExifMerge(e.exif)}return this}function OM(e,t){let r=S$.get((u.object(e)&&u.string(e.id)?e.id:e).toLowerCase());if(!r)throw u.invalidParameterError("format",`one of: ${[...S$.keys()].join(", ")}`,e);return this[r](t)}function CM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.progressive))this._setBooleanOption("jpegProgressive",e.progressive);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=u.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(u.defined(t))this._setBooleanOption("jpegOptimiseCoding",t);if(u.defined(e.mozjpeg))if(u.bool(e.mozjpeg)){if(e.mozjpeg)this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3}else throw u.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=u.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;if(u.defined(r))this._setBooleanOption("jpegTrellisQuantisation",r);if(u.defined(e.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=u.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;if(u.defined(n)){if(this._setBooleanOption("jpegOptimiseScans",n),n)this.options.jpegProgressive=!0}let s=u.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(u.defined(s))if(u.integer(s)&&u.inRange(s,0,8))this.options.jpegQuantisationTable=s;else throw u.invalidParameterError("quantisationTable","integer between 0 and 8",s)}return this._updateFormatOut("jpeg",e)}function NM(e){if(u.object(e)){if(u.defined(e.progressive))this._setBooleanOption("pngProgressive",e.progressive);if(u.defined(e.compressionLevel))if(u.integer(e.compressionLevel)&&u.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw u.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);if(u.defined(e.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(u.defined(t))if(u.integer(t)&&u.inRange(t,2,256))this.options.pngBitdepth=_$(t);else throw u.invalidParameterError("colours","integer between 2 and 256",t);if(u.defined(e.palette))this._setBooleanOption("pngPalette",e.palette);else if([e.quality,e.effort,e.colours,e.colors,e.dither].some(u.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw u.invalidParameterError("quality","integer between 0 and 100",e.quality);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 10",e.effort);if(u.defined(e.dither))if(u.number(e.dither)&&u.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw u.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function TM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.alphaQuality))if(u.integer(e.alphaQuality)&&u.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw u.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(u.defined(e.lossless))this._setBooleanOption("webpLossless",e.lossless);if(u.defined(e.nearLossless))this._setBooleanOption("webpNearLossless",e.nearLossless);if(u.defined(e.smartSubsample))this._setBooleanOption("webpSmartSubsample",e.smartSubsample);if(u.defined(e.smartDeblock))this._setBooleanOption("webpSmartDeblock",e.smartDeblock);if(u.defined(e.preset))if(u.string(e.preset)&&u.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw u.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw u.invalidParameterError("effort","integer between 0 and 6",e.effort);if(u.defined(e.minSize))this._setBooleanOption("webpMinSize",e.minSize);if(u.defined(e.mixed))this._setBooleanOption("webpMixed",e.mixed);if(u.defined(e.exact))this._setBooleanOption("webpExact",e.exact)}return _d(e,this.options),this._updateFormatOut("webp",e)}function IM(e){if(u.object(e)){if(u.defined(e.reuse))this._setBooleanOption("gifReuse",e.reuse);if(u.defined(e.progressive))this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(u.defined(t))if(u.integer(t)&&u.inRange(t,2,256))this.options.gifBitdepth=_$(t);else throw u.invalidParameterError("colours","integer between 2 and 256",t);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 10",e.effort);if(u.defined(e.dither))if(u.number(e.dither)&&u.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw u.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(u.defined(e.interFrameMaxError))if(u.number(e.interFrameMaxError)&&u.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw u.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(u.defined(e.interPaletteMaxError))if(u.number(e.interPaletteMaxError)&&u.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw u.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(u.defined(e.keepDuplicateFrames))if(u.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw u.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return _d(e,this.options),this._updateFormatOut("gif",e)}function MM(e){if(!this.constructor.format.jp2.output.buffer)throw E$();if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.tileWidth))if(u.integer(e.tileWidth)&&u.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw u.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(u.defined(e.tileHeight))if(u.integer(e.tileHeight)&&u.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw u.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function _d(e,t){if(u.object(e)&&u.defined(e.loop))if(u.integer(e.loop)&&u.inRange(e.loop,0,65535))t.loop=e.loop;else throw u.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(u.object(e)&&u.defined(e.delay))if(u.integer(e.delay)&&u.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&u.inRange(e.delay.length,1,1e6)&&e.delay.every(u.integer)&&e.delay.every((r)=>u.inRange(r,0,65535)))t.delay=e.delay;else throw u.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function JM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.bitdepth))if(u.integer(e.bitdepth)&&u.inArray(e.bitdepth,[1,2,4]))this.options.tiffBitdepth=e.bitdepth;else throw u.invalidParameterError("bitdepth","1, 2 or 4",e.bitdepth);if(u.defined(e.tile))this._setBooleanOption("tiffTile",e.tile);if(u.defined(e.tileWidth))if(u.integer(e.tileWidth)&&u.inRange(e.tileWidth,1,32768))this.options.tiffTileWidth=e.tileWidth;else throw u.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(u.defined(e.tileHeight))if(u.integer(e.tileHeight)&&u.inRange(e.tileHeight,1,32768))this.options.tiffTileHeight=e.tileHeight;else throw u.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(u.defined(e.miniswhite))this._setBooleanOption("tiffMiniswhite",e.miniswhite);if(u.defined(e.pyramid))this._setBooleanOption("tiffPyramid",e.pyramid);if(u.defined(e.xres))if(u.number(e.xres)&&u.inRange(e.xres,0.001,1e6))this.options.tiffXres=e.xres;else throw u.invalidParameterError("xres","number between 0.001 and 1000000",e.xres);if(u.defined(e.yres))if(u.number(e.yres)&&u.inRange(e.yres,0.001,1e6))this.options.tiffYres=e.yres;else throw u.invalidParameterError("yres","number between 0.001 and 1000000",e.yres);if(u.defined(e.compression))if(u.string(e.compression)&&u.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw u.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(u.defined(e.bigtiff))this._setBooleanOption("tiffBigtiff",e.bigtiff);if(u.defined(e.predictor))if(u.string(e.predictor)&&u.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw u.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(u.defined(e.resolutionUnit))if(u.string(e.resolutionUnit)&&u.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw u.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function DM(e){return this.heif({...e,compression:"av1"})}function LM(e){if(u.object(e)){if(u.string(e.compression)&&u.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw u.invalidParameterError("compression","one of: av1, hevc",e.compression);if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.heifLossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw u.invalidParameterError("effort","integer between 0 and 9",e.effort);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(u.defined(e.bitdepth))if(u.integer(e.bitdepth)&&u.inArray(e.bitdepth,[8,10,12]))this.options.heifBitdepth=e.bitdepth;else throw u.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth);if(u.defined(e.tune))if(u.string(e.tune)&&u.inArray(e.tune,["auto","iq","psnr","ssim"]))if(this.options.heifLossless&&e.tune==="iq")this.options.heifTune="ssim";else this.options.heifTune=e.tune;else throw u.invalidParameterError("tune","one of: auto, iq, psnr, ssim",e.tune)}else throw u.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function FM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?0.1+(100-e.quality)*0.09:0.017666666666666667*e.quality*e.quality-1.15*e.quality+25;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(u.defined(e.distance))if(u.number(e.distance)&&u.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw u.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(u.defined(e.decodingTier))if(u.integer(e.decodingTier)&&u.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw u.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 9",e.effort)}return _d(e,this.options),this._updateFormatOut("jxl",e)}function qM(e){if(u.object(e)){if(u.defined(e.depth))if(u.string(e.depth)&&u.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw u.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth)}return this._updateFormatOut("raw")}function HM(e){if(u.object(e)){if(u.defined(e.size))if(u.integer(e.size)&&u.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw u.invalidParameterError("size","integer between 1 and 8192",e.size);if(u.defined(e.overlap))if(u.integer(e.overlap)&&u.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw u.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw u.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(u.defined(e.container))if(u.string(e.container)&&u.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw u.invalidParameterError("container","one of: fs, zip",e.container);if(u.defined(e.layout))if(u.string(e.layout)&&u.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw u.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(u.defined(e.angle))if(u.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw u.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),u.defined(e.depth))if(u.string(e.depth)&&u.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw u.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(u.defined(e.skipBlanks))if(u.integer(e.skipBlanks)&&u.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw u.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else if(u.defined(e.layout)&&e.layout==="google")this.options.tileSkipBlanks=5;let t=u.bool(e.center)?e.center:e.centre;if(u.defined(t))this._setBooleanOption("tileCentre",t);if(u.defined(e.id))if(u.string(e.id))this.options.tileId=e.id;else throw u.invalidParameterError("id","string",e.id);if(u.defined(e.basename))if(u.string(e.basename))this.options.tileBasename=e.basename;else throw u.invalidParameterError("basename","string",e.basename)}if(u.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw u.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function VM(e){if(!u.plainObject(e))throw u.invalidParameterError("options","object",e);if(u.integer(e.seconds)&&u.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw u.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function BM(e,t){if(!(u.object(t)&&t.force===!1))this.options.formatOut=e;return this}function WM(e,t){if(u.bool(t))this.options[e]=t;else throw u.invalidParameterError(e,"boolean",t)}function UM(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function zM(e,t){if(typeof e==="function"){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(r,n,s)=>{if(r)e(u.nativeError(r,t));else e(null,n,s)})});else Oe.pipeline(this.options,(r,n,s)=>{if(r)e(u.nativeError(r,t));else e(null,n,s)});return this}else if(this.options.streamOut){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",u.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))})});else Oe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",u.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(s,i,o)=>{if(s)n(u.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})});else return new Promise((r,n)=>{Oe.pipeline(this.options,(s,i,o)=>{if(s)n(u.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})}var S$,hM,E$=()=>Error("JP2 output requires libvips with support for OpenJPEG"),_$=(e)=>1<<32-Math.clz32(Math.ceil(Math.log2(e))-1),P$=(e)=>{Object.assign(e.prototype,{toFile:gM,toBuffer:yM,toUint8Array:bM,withDensity:xM,keepExif:$M,withExif:vM,withExifMerge:wM,keepIccProfile:SM,withIccProfile:EM,keepGainMap:_M,withGainMap:PM,keepXmp:jM,withXmp:kM,keepMetadata:RM,withMetadata:AM,toFormat:OM,jpeg:CM,jp2:MM,png:NM,webp:TM,tiff:JM,avif:DM,heif:LM,jxl:FM,gif:IM,raw:qM,tile:HM,timeout:VM,_updateFormatOut:BM,_setBooleanOption:WM,_read:UM,_pipeline:zM})};var j$=q(()=>{Dr();bo();/*!
|
|
362
360
|
Copyright 2013 Lovell Fuller and others.
|
|
363
361
|
SPDX-License-Identifier: Apache-2.0
|
|
364
|
-
*/
|
|
362
|
+
*/S$=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),hM=/\.(jp[2x]|j2[kc])$/i});import GM from"node:events";import{createRequire as KM}from"node:module";import{availableParallelism as YM}from"node:os";function R$(e){if(u.bool(e))if(e)return Oe.cache(50,20,100);else return Oe.cache(0,0,0);else if(u.object(e)){for(let t of["memory","files","items"]){let r=e[t];if(u.defined(r)&&!(u.integer(r)&&r>=0))throw u.invalidParameterError(t,"a positive integer",r)}return Oe.cache(e.memory,e.files,e.items)}else return Oe.cache()}function ZM(e){return Oe.concurrency(u.integer(e)?e:null)}function eJ(){return Oe.counters()}function tJ(e){return Oe.simd(u.bool(e)?e:null)}function rJ(e){if(u.object(e))if(Array.isArray(e.operation)&&e.operation.every(u.string))Oe.block(e.operation,!0);else throw u.invalidParameterError("operation","Array<string>",e.operation);else throw u.invalidParameterError("options","object",e)}function nJ(e){if(u.object(e))if(Array.isArray(e.operation)&&e.operation.every(u.string))Oe.block(e.operation,!1);else throw u.invalidParameterError("operation","Array<string>",e.operation);else throw u.invalidParameterError("options","object",e)}var xo,Pd,k$,jd,qn,XM,pi,QM,A$=(e)=>{e.cache=R$,e.concurrency=ZM,e.counters=eJ,e.simd=tJ,e.format=qn,e.interpolators=XM,e.versions=pi,e.queue=QM,e.block=rJ,e.unblock=nJ};var O$=q(()=>{Dr();md();bo();yl();xo=Lt(nl(),1);/*!
|
|
365
363
|
Copyright 2013 Lovell Fuller and others.
|
|
366
364
|
SPDX-License-Identifier: Apache-2.0
|
|
367
|
-
*/
|
|
365
|
+
*/Pd=KM(import.meta.url),k$=bl.runtimePlatformArch(),jd=Oe.libvipsVersion(),qn=Oe.format();qn.heif.output.alias=["avif","heic"];qn.jpeg.output.alias=["jpe","jpg"];qn.tiff.output.alias=["tif"];qn.jp2.output.alias=["j2c","j2k","jp2","jpx"];XM={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},pi={vips:jd.semver};if(!jd.isGlobal)if(!jd.isWasm)try{pi=Pd(`@img/sharp-${k$}/versions`)}catch(e){try{pi=Pd(`@img/sharp-libvips-${k$}/versions`)}catch(t){}}else try{pi=Pd("@img/sharp-wasm32/versions")}catch(e){}pi.sharp=gn.version;if(pi.heif&&qn.heif)qn.heif.input.fileSuffix=[".avif"],qn.heif.output.alias=["avif"];R$(!0);if(!process.env.MALLOC_ARENA_MAX&&xo.default.familySync()===xo.default.GLIBC&&!Oe._isUsingJemalloc())Oe.concurrency(1);else if(xo.default.familySync()===xo.default.MUSL&&Oe.concurrency()===1024)Oe.concurrency(YM());QM=new GM.EventEmitter});var sJ;var C$=q(()=>{zx();Yx();r$();s$();a$();$$();w$();j$();O$();/*!
|
|
368
366
|
Copyright 2013 Lovell Fuller and others.
|
|
369
367
|
SPDX-License-Identifier: Apache-2.0
|
|
370
|
-
*/Yx(Vr);r$(Vr);s$(Vr);a$(Vr);$$(Vr);w$(Vr);j$(Vr);O$(Vr);QM=Vr});import{createHash as N$}from"node:crypto";import{existsSync as eJ,mkdirSync as tJ,readFileSync as rJ}from"node:fs";import{basename as nJ,extname as sJ,resolve as Od}from"node:path";import{createRequire as iJ}from"node:module";async function I$(){if(mi)return mi;try{let e=await Promise.resolve().then(() => (T$(),{}));return mi=QM,mi}catch{}try{return mi=iJ(Od(process.cwd(),"package.json"))("sharp"),mi}catch(e){throw Error(`Sharp is required for image optimization but failed to load: ${Ee(e)}`,{cause:e})}}async function Cd(e){let r=await(await I$())(e).metadata();return{format:r.format??"unknown",height:r.height??0,width:r.width??0}}function wo(e){let t=rJ(e);return N$("md5").update(t).digest("hex").slice(0,8)}function Td(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:aJ,widths:e.widths});return N$("md5").update(t).digest("hex").slice(0,8)}function lJ(e,t,r,n){return`${e}-${t}-${r}.${n}`}async function M$(e,t,r){let n=await I$(),s=await Cd(e),i=wo(e),o=nJ(e,sJ(e)),a=Od(t,"_optimized");tJ(a,{recursive:!0});let l=[],c=r.widths.length>0?Math.max(...r.widths):s.width,d=r.widths.filter((m)=>m<=s.width);if(s.width<c&&!d.includes(s.width))d.push(s.width);if(d.length===0)d.push(s.width);d.sort((m,b)=>m-b);let p=[];for(let m of d)for(let b of r.formats){let g=lJ(o,m,i,b),y=`/${oJ}/${g}`,v=Od(a,g);if(l.push({absolutePath:v,format:b,outputPath:y,width:m}),eJ(v))continue;let j=r.quality[b]??80,S=n(e).resize(m).toFormat(b,{quality:j}).toFile(v).then(()=>{});p.push(S)}let h=4;for(let m=0;m<p.length;m+=h)await Promise.all(p.slice(m,m+h));return{contentHash:i,original:{format:s.format,height:s.height,width:s.width},variants:l}}function J$(e,t){return e.flatMap((r)=>r.format===t?[`${r.outputPath} ${r.width}w`]:[]).join(", ")}var mi=null,oJ="images/_optimized",aJ=2;var Nd=q(()=>{rr()});import{existsSync as cJ,mkdirSync as uJ,readFileSync as dJ,rmSync as fJ,writeFileSync as pJ}from"node:fs";import{basename as mJ,resolve as _l}from"node:path";import{execSync as hJ}from"node:child_process";import{tmpdir as gJ}from"node:os";function hi(e){if(So===void 0)try{let t=hJ("npm config get cache",{cwd:gJ(),encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();So=t&&t!=="undefined"?t:null}catch{So=null}if(So)return _l(So,"jxsuite-images",mJ(e));return _l(e,".cache/images")}function D$(e){let t=_l(hi(e),"manifest.json");if(!cJ(t))return{entries:{},touched:new Set,version:1};try{let r=JSON.parse(dJ(t,"utf8"));return r.touched=new Set,r}catch{return{entries:{},touched:new Set,version:1}}}function L$(e,t,r={}){if(r.prune&&t.touched)yJ(t,t.touched);let n=hi(e);uJ(n,{recursive:!0}),pJ(_l(n,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function yJ(e,t){let r=new Set,n=Object.entries(e.entries);for(let[s,i]of n)if(t.has(s))for(let o of i.manifest.variants??[])r.add(o.absolutePath);for(let[s,i]of n){if(t.has(s))continue;for(let o of i.manifest.variants??[])if(!r.has(o.absolutePath))fJ(o.absolutePath,{force:!0});delete e.entries[s]}}function F$(e,t){e.touched?.add(t);let r=e.entries[t];if(!r)return null;return r.manifest}function q$(e,t,r,n){e.touched?.add(t),e.entries[t]={manifest:n,source:r,timestamp:Date.now()}}var So;var Id=q(()=>{Nd()});function Md(e,t){if(!t||H$(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return H$(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var H$=(e)=>e!==void 0&&e!==null&&e!=="";import{existsSync as G$}from"node:fs";import{basename as bJ,extname as K$,resolve as V$}from"node:path";async function $J(e,t){let r=t.get(e);if(!r){let n=wo(e);try{let s=await Cd(e);r={width:s.width,height:s.height,hash:n}}catch(s){if(!W$)W$=!0,console.warn(`Could not read image dimensions (${Ee(s)}) — `+"emitting srcsets without width/height attributes.");r={width:null,height:null,hash:n}}t.set(e,r)}return r}function B$(e,t,r,n){let s=t.quality.webp??80,i=e.startsWith("/")?"":"/",o=n?`?v=${n}`:"";return t.widths.filter((a)=>a<=r).toSorted((a,l)=>a-l).map((a)=>`/cdn-cgi/image/width=${a},quality=${s},fit=scale-down,format=auto${i}${e}${o} ${a}w`).join(", ")}async function vJ(e,t,r,n,s){let i=`${wo(e)}:${Td(r)}`,o=F$(s,i);if(o){if(o.variants.every((c)=>G$(c.absolutePath)))return o}if(!o)console.log(` Optimizing ${bJ(e)}...`);let a=await M$(e,hi(n),r);return q$(s,i,t,a),a}function wJ(e){if(!e)return!0;if(e.includes("${"))return!0;if(xJ.some((t)=>e.startsWith(t)))return!0;if(Y$.has(K$(e).toLowerCase()))return!0;return!1}function SJ(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let r=new URL(e);if(Y$.has(K$(r.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(r.hostname)}catch{return!1}}function EJ(e,t,r){let n=r?.length?ga(r,e):null;if(n)return n;if(e.startsWith("/"))return V$(t,"public",e.slice(1));return V$(t,e)}async function X$(e,t,r,n,s,i=[]){let o=new Map;return await Z$(e,t,r,n,s??new Map,o,i),{imageRefs:o}}async function Z$(e,t,r,n,s,i,o,a=null){if(e.tagName==="img"){if(await AJ(e,t,r,n,s,i,o,a))return}if(N(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await IJ(e.innerHTML,t,r,n,s,i,o);if(Array.isArray(e.children)){let l=ev(e,a);for(let c of e.children){if(!Ft(c))continue;await Z$(c,t,r,n,s,i,o,l)}}}async function Q$(e,t,r,n,s,i,o,a){if(!N(e)||t)return null;let l=SJ(e,r);if(!l&&wJ(e))return null;if(l)return{dims:null,sources:[],srcset:B$(e,r,1/0,null)};let c=EJ(e,n,a);if(!G$(c))return null;if(r.service==="cloudflare"){let g=await $J(c,i),y=B$(e,r,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:y}}let d=o.get(c);if(!d)d=await vJ(c,e,r,n,s),o.set(c,d);let h=[...U$.filter((g)=>r.formats.includes(g)),...r.formats.filter((g)=>!U$.includes(g))].flatMap((g)=>{let y=J$(d.variants,g);return y===""?[]:[{srcset:y,type:_J.get(g)??`image/${g}`}]}),m=d.original?.width&&d.original.height?{height:d.original.height,width:d.original.width}:null,b=r.picture!==!1&&h.length>1;return{dims:m,fallbackSrc:jJ(d.variants,r.formats),sources:b?h:[],srcset:h[0]?.srcset??""}}function jJ(e,t){let r=PJ.find((s)=>t.includes(s));if(r===void 0)return;let n;for(let s of e)if(s.format===r&&(n===void 0||s.width>n.width))n=s;return n?.outputPath}function z$(e){if(!N(e))return null;let t=kJ.exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2]==="rem"?r*16:r}function ev(e,t){let{style:r}=e;if(!F(r))return t;let n=z$(r.maxWidth)??z$(r.width);if(n===null)return t;return t===null?n:Math.min(t,n)}function RJ(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function AJ(e,t,r,n,s,i,o,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;if(l.src===void 0&&N(e.src))l.src=e.src,delete e.src;let c=t.optimize?await Q$(l.src,l["data-no-optimize"]!==void 0,t,r,n,s,i,o):null,d=ev(e,a),p=l.sizes??RJ(d)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,l.sizes=p,c.fallbackSrc!==void 0)l.src=c.fallbackSrc}if(c.dims&&l.width===void 0&&l.height===void 0)l.width=String(c.dims.width),l.height=String(c.dims.height)}if(Object.assign(l,Md(l,t.lazyLoad)),c&&c.sources.length>0)return OJ(e,c.sources,p),!0;return!1}function OJ(e,t,r){let n={...e.attributes},s=n.sizes??r;delete n.srcset,delete n.sizes;let i={attributes:n,tagName:"img"};if(e.style!==void 0)i.style=e.style,delete e.style;let o=t.map((a)=>{let l={};if(s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});o.push(i),e.tagName="picture",e.attributes={},e.children=o}async function IJ(e,t,r,n,s,i,o){let a=[];for(let c of e.matchAll(CJ)){let d=c[0],p=c[1],h=(Eo(p,"src")??"").replaceAll("&","&"),m=TJ.test(p),b=t.optimize&&h!==""&&!m?await Q$(h,NJ.test(p),t,r,n,s,i,o):null,g="";if(b&&b.srcset!=="")g+=` srcset="${b.srcset}" sizes="${t.sizes}"`;if(b?.dims&&!/\bwidth=/.test(p)&&!/\bheight=/.test(p))g+=` width="${b.dims.width}" height="${b.dims.height}"`;let y=Md({decoding:Eo(p,"decoding"),fetchpriority:Eo(p,"fetchpriority"),loading:Eo(p,"loading")},t.lazyLoad);for(let[j,S]of Object.entries(y))g+=` ${j}="${S}"`;if(g==="")continue;let v=b&&b.sources.length>0?MJ(p,b.sources,t.sizes,g):`<img${p}${g}>`;a.push({match:d,replacement:v})}let l=e;for(let{match:c,replacement:d}of a)l=l.replace(c,d);return l}function MJ(e,t,r,n){let s=Eo(e,"sizes")??r,i=n.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,"");return`<picture>${t.map((a)=>`<source type="${a.type}" srcset="${a.srcset}" sizes="${s}">`).join("")}<img${e}${i}></picture>`}function Eo(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var Y$,xJ,W$=!1,U$,_J,PJ,kJ,CJ,TJ,NJ;var tv=q(()=>{Nd();Id();nr();ve();rr();Y$=new Set([".svg",".gif"]),xJ=["http://","https://","data:","//"];U$=["avif","webp","jpeg","png"],_J=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);PJ=["jpeg","png"];kJ=/^(\d+(?:\.\d+)?)(px|rem)$/;CJ=/<img\b([^>]*)>/gi,TJ=/\bsrcset="/,NJ=/\bdata-no-optimize\b/});import{createHash as JJ}from"node:crypto";import{existsSync as DJ}from"node:fs";import{join as rv}from"node:path";function FJ(e,t){let r=e.replace(/^\//,"");return e.endsWith("/")||r===""?rv(t,r,"index.html"):rv(t,r)}function Dd(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function qJ(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return JJ("sha256").update(t,"utf8").digest("hex").slice(0,8)}function nv(e,t,r=""){let n=[],s=[],i=[...e.precache??[]],o=e.offlineFallback;if(o!==void 0&&!i.includes(o))i.push(o),n.push(`serviceWorker: "${o}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let h of i)if(!h.startsWith("/"))s.push(`serviceWorker.precache: "${h}" must be a site-absolute URL starting with /.`);else if(!DJ(FJ(h,t)))s.push(`serviceWorker.precache: "${h}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=i.map((h)=>Ie(r,h)),l=Ie(r,LJ),c=o===void 0?null:Ie(r,o),d=`jx-${qJ(e)}`,p=`/*
|
|
368
|
+
*/Kx(Vr);t$(Vr);n$(Vr);o$(Vr);x$(Vr);v$(Vr);P$(Vr);A$(Vr);sJ=Vr});import{createHash as N$}from"node:crypto";import{existsSync as iJ,mkdirSync as oJ,readFileSync as aJ}from"node:fs";import{basename as lJ,extname as cJ,resolve as kd}from"node:path";import{createRequire as uJ}from"node:module";async function T$(){if(mi)return mi;try{let e=await Promise.resolve().then(() => (C$(),{}));return mi=sJ,mi}catch{}try{return mi=uJ(kd(process.cwd(),"package.json"))("sharp"),mi}catch(e){throw Error(`Sharp is required for image optimization but failed to load: ${Ee(e)}`,{cause:e})}}async function Rd(e){let r=await(await T$())(e).metadata();return{format:r.format??"unknown",height:r.height??0,width:r.width??0}}function $o(e){let t=aJ(e);return N$("md5").update(t).digest("hex").slice(0,8)}function Ad(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:fJ,widths:e.widths});return N$("md5").update(t).digest("hex").slice(0,8)}function pJ(e,t,r,n){return`${e}-${t}-${r}.${n}`}async function I$(e,t,r){let n=await T$(),s=await Rd(e),i=$o(e),o=lJ(e,cJ(e)),a=kd(t,"_optimized");oJ(a,{recursive:!0});let l=[],c=r.widths.length>0?Math.max(...r.widths):s.width,d=r.widths.filter((m)=>m<=s.width);if(s.width<c&&!d.includes(s.width))d.push(s.width);if(d.length===0)d.push(s.width);d.sort((m,b)=>m-b);let p=[];for(let m of d)for(let b of r.formats){let g=pJ(o,m,i,b),y=`/${dJ}/${g}`,v=kd(a,g);if(l.push({absolutePath:v,format:b,outputPath:y,width:m}),iJ(v))continue;let j=r.quality[b]??80,S=n(e).resize(m).toFormat(b,{quality:j}).toFile(v).then(()=>{});p.push(S)}let h=4;for(let m=0;m<p.length;m+=h)await Promise.all(p.slice(m,m+h));return{contentHash:i,original:{format:s.format,height:s.height,width:s.width},variants:l}}function M$(e,t){return e.flatMap((r)=>r.format===t?[`${r.outputPath} ${r.width}w`]:[]).join(", ")}var mi=null,dJ="images/_optimized",fJ=2;var Od=q(()=>{rr()});import{existsSync as mJ,mkdirSync as hJ,readFileSync as gJ,rmSync as yJ,writeFileSync as bJ}from"node:fs";import{basename as xJ,resolve as Sl}from"node:path";import{execSync as $J}from"node:child_process";import{tmpdir as vJ}from"node:os";function SJ(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=$J("npm config get cache",{cwd:vJ(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:wJ}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function hi(e){if(wl===void 0)wl=SJ();if(wl)return Sl(wl,"jxsuite-images",xJ(e));return Sl(e,".cache/images")}function J$(e){let t=Sl(hi(e),"manifest.json");if(!mJ(t))return{entries:{},touched:new Set,version:1};try{let r=JSON.parse(gJ(t,"utf8"));return r.touched=new Set,r}catch{return{entries:{},touched:new Set,version:1}}}function D$(e,t,r={}){if(r.prune&&t.touched)EJ(t,t.touched);let n=hi(e);hJ(n,{recursive:!0}),bJ(Sl(n,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function EJ(e,t){let r=new Set,n=Object.entries(e.entries);for(let[s,i]of n)if(t.has(s))for(let o of i.manifest.variants??[])r.add(o.absolutePath);for(let[s,i]of n){if(t.has(s))continue;for(let o of i.manifest.variants??[])if(!r.has(o.absolutePath))yJ(o.absolutePath,{force:!0});delete e.entries[s]}}function L$(e,t){e.touched?.add(t);let r=e.entries[t];if(!r)return null;return r.manifest}function F$(e,t,r,n){e.touched?.add(t),e.entries[t]={manifest:n,source:r,timestamp:Date.now()}}var wl,wJ=3000;var Cd=q(()=>{Od()});function Nd(e,t){if(!t||q$(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return q$(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var q$=(e)=>e!==void 0&&e!==null&&e!=="";import{existsSync as z$}from"node:fs";import{basename as _J,extname as G$,resolve as H$}from"node:path";async function jJ(e,t){let r=t.get(e);if(!r){let n=$o(e);try{let s=await Rd(e);r={width:s.width,height:s.height,hash:n}}catch(s){if(!V$)V$=!0,console.warn(`Could not read image dimensions (${Ee(s)}) — `+"emitting srcsets without width/height attributes.");r={width:null,height:null,hash:n}}t.set(e,r)}return r}function B$(e,t,r,n){let s=t.quality.webp??80,i=e.startsWith("/")?"":"/",o=n?`?v=${n}`:"";return t.widths.filter((a)=>a<=r).toSorted((a,l)=>a-l).map((a)=>`/cdn-cgi/image/width=${a},quality=${s},fit=scale-down,format=auto${i}${e}${o} ${a}w`).join(", ")}async function kJ(e,t,r,n,s){let i=`${$o(e)}:${Ad(r)}`,o=L$(s,i);if(o){if(o.variants.every((c)=>z$(c.absolutePath)))return o}if(!o)console.log(` Optimizing ${_J(e)}...`);let a=await I$(e,hi(n),r);return F$(s,i,t,a),a}function RJ(e){if(!e)return!0;if(e.includes("${"))return!0;if(PJ.some((t)=>e.startsWith(t)))return!0;if(K$.has(G$(e).toLowerCase()))return!0;return!1}function AJ(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let r=new URL(e);if(K$.has(G$(r.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(r.hostname)}catch{return!1}}function OJ(e,t,r){let n=r?.length?fa(r,e):null;if(n)return n;if(e.startsWith("/"))return H$(t,"public",e.slice(1));return H$(t,e)}async function Y$(e,t,r,n,s,i=[]){let o=new Map;return await X$(e,t,r,n,s??new Map,o,i),{imageRefs:o}}async function X$(e,t,r,n,s,i,o,a=null){if(e.tagName==="img"){if(await JJ(e,t,r,n,s,i,o,a))return}if(T(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await HJ(e.innerHTML,t,r,n,s,i,o);if(Array.isArray(e.children)){let l=Q$(e,a);for(let c of e.children){if(!Ft(c))continue;await X$(c,t,r,n,s,i,o,l)}}}async function Z$(e,t,r,n,s,i,o,a){if(!T(e)||t)return null;let l=AJ(e,r);if(!l&&RJ(e))return null;if(l)return{dims:null,sources:[],srcset:B$(e,r,1/0,null)};let c=OJ(e,n,a);if(!z$(c))return null;if(r.service==="cloudflare"){let g=await jJ(c,i),y=B$(e,r,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:y}}let d=o.get(c);if(!d)d=await kJ(c,e,r,n,s),o.set(c,d);let h=[...W$.filter((g)=>r.formats.includes(g)),...r.formats.filter((g)=>!W$.includes(g))].flatMap((g)=>{let y=M$(d.variants,g);return y===""?[]:[{srcset:y,type:CJ.get(g)??`image/${g}`}]}),m=d.original?.width&&d.original.height?{height:d.original.height,width:d.original.width}:null,b=r.picture!==!1&&h.length>1;return{dims:m,fallbackSrc:TJ(d.variants,r.formats),sources:b?h:[],srcset:h[0]?.srcset??""}}function TJ(e,t){let r=NJ.find((s)=>t.includes(s));if(r===void 0)return;let n;for(let s of e)if(s.format===r&&(n===void 0||s.width>n.width))n=s;return n?.outputPath}function U$(e){if(!T(e))return null;let t=IJ.exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2]==="rem"?r*16:r}function Q$(e,t){let{style:r}=e;if(!F(r))return t;let n=U$(r.maxWidth)??U$(r.width);if(n===null)return t;return t===null?n:Math.min(t,n)}function MJ(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function JJ(e,t,r,n,s,i,o,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;if(l.src===void 0&&T(e.src))l.src=e.src,delete e.src;let c=t.optimize?await Z$(l.src,l["data-no-optimize"]!==void 0,t,r,n,s,i,o):null,d=Q$(e,a),p=l.sizes??MJ(d)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,l.sizes=p,c.fallbackSrc!==void 0)l.src=c.fallbackSrc}if(c.dims&&l.width===void 0&&l.height===void 0)l.width=String(c.dims.width),l.height=String(c.dims.height)}if(Object.assign(l,Nd(l,t.lazyLoad)),c&&c.sources.length>0)return DJ(e,c.sources,p),!0;return!1}function DJ(e,t,r){let n={...e.attributes},s=n.sizes??r;delete n.srcset,delete n.sizes;let i={attributes:n,tagName:"img"};if(e.style!==void 0)i.style=e.style,delete e.style;let o=t.map((a)=>{let l={};if(s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});o.push(i),e.tagName="picture",e.attributes={},e.children=o}async function HJ(e,t,r,n,s,i,o){let a=[];for(let c of e.matchAll(LJ)){let d=c[0],p=c[1],h=(vo(p,"src")??"").replaceAll("&","&"),m=FJ.test(p),b=t.optimize&&h!==""&&!m?await Z$(h,qJ.test(p),t,r,n,s,i,o):null,g="";if(b&&b.srcset!=="")g+=` srcset="${b.srcset}" sizes="${t.sizes}"`;if(b?.dims&&!/\bwidth=/.test(p)&&!/\bheight=/.test(p))g+=` width="${b.dims.width}" height="${b.dims.height}"`;let y=Nd({decoding:vo(p,"decoding"),fetchpriority:vo(p,"fetchpriority"),loading:vo(p,"loading")},t.lazyLoad);for(let[j,S]of Object.entries(y))g+=` ${j}="${S}"`;if(g==="")continue;let v=b&&b.sources.length>0?VJ(p,b.sources,t.sizes,g):`<img${p}${g}>`;a.push({match:d,replacement:v})}let l=e;for(let{match:c,replacement:d}of a)l=l.replace(c,d);return l}function VJ(e,t,r,n){let s=vo(e,"sizes")??r,i=n.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,"");return`<picture>${t.map((a)=>`<source type="${a.type}" srcset="${a.srcset}" sizes="${s}">`).join("")}<img${e}${i}></picture>`}function vo(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var K$,PJ,V$=!1,W$,CJ,NJ,IJ,LJ,FJ,qJ;var ev=q(()=>{Od();Cd();nr();ve();rr();K$=new Set([".svg",".gif"]),PJ=["http://","https://","data:","//"];W$=["avif","webp","jpeg","png"],CJ=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);NJ=["jpeg","png"];IJ=/^(\d+(?:\.\d+)?)(px|rem)$/;LJ=/<img\b([^>]*)>/gi,FJ=/\bsrcset="/,qJ=/\bdata-no-optimize\b/});import{createHash as BJ}from"node:crypto";import{existsSync as WJ}from"node:fs";import{join as tv}from"node:path";function zJ(e,t){let r=e.replace(/^\//,"");return e.endsWith("/")||r===""?tv(t,r,"index.html"):tv(t,r)}function Id(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function GJ(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return BJ("sha256").update(t,"utf8").digest("hex").slice(0,8)}function rv(e,t,r=""){let n=[],s=[],i=[...e.precache??[]],o=e.offlineFallback;if(o!==void 0&&!i.includes(o))i.push(o),n.push(`serviceWorker: "${o}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let h of i)if(!h.startsWith("/"))s.push(`serviceWorker.precache: "${h}" must be a site-absolute URL starting with /.`);else if(!WJ(zJ(h,t)))s.push(`serviceWorker.precache: "${h}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=i.map((h)=>Ie(r,h)),l=Ie(r,UJ),c=o===void 0?null:Ie(r,o),d=`jx-${GJ(e)}`,p=`/*
|
|
371
369
|
* Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
|
|
372
370
|
* Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
|
|
373
371
|
*/
|
|
@@ -457,7 +455,7 @@ self.addEventListener("fetch", (event) => {
|
|
|
457
455
|
})(),
|
|
458
456
|
);
|
|
459
457
|
});
|
|
460
|
-
`;return{errors:s,path:
|
|
458
|
+
`;return{errors:s,path:Td,source:p,warnings:n}}function nv(){return{errors:[],path:Td,source:`/*
|
|
461
459
|
* Generated by @jxsuite/compiler. This site had a service worker and no longer does.
|
|
462
460
|
*
|
|
463
461
|
* A worker is sticky: removing the file would leave every previous visitor running the old one
|
|
@@ -480,95 +478,95 @@ self.addEventListener("activate", (event) => {
|
|
|
480
478
|
})(),
|
|
481
479
|
);
|
|
482
480
|
});
|
|
483
|
-
`,warnings:[]}}function
|
|
484
|
-
`,path:"manifest.webmanifest"}],warnings:n}}function
|
|
481
|
+
`,warnings:[]}}function sv(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Ie(t,`/${Td}`)}',{scope:${JSON.stringify(Ie(t,e))}}).catch(function(){})})}`}var Td="sw.js",UJ="/images/_optimized/";var iv=q(()=>{nr()});import{mkdirSync as KJ,writeFileSync as YJ}from"node:fs";import{dirname as XJ,join as ZJ}from"node:path";function Hn(e,t,r){if(r!==void 0)e[t]=r}function ov(e){let t=e.manifest,r=[],n=[];if(t===void 0||t.enabled===!1)return{errors:r,files:[],warnings:n};let s=t.name??e.name??"Jx Site",i=as(e.url),o=[];for(let d of t.icons??[])o.push(T(d.src)?{...d,src:Ie(i,d.src)}:d);let a={display:t.display??"standalone",icons:o,name:s,short_name:t.shortName??s,start_url:Ie(i,t.startUrl??"/")};Hn(a,"description",t.description),Hn(a,"theme_color",t.themeColor),Hn(a,"background_color",t.backgroundColor),Hn(a,"scope",t.scope===void 0?void 0:Ie(i,t.scope)),Hn(a,"orientation",t.orientation),Hn(a,"lang",t.lang),Hn(a,"dir",t.dir),Hn(a,"categories",t.categories);let l=new Set(o.flatMap((d)=>(d.sizes??"").split(/\s+/).map((p)=>Math.trunc(Number(p.split("x")[0]))))),c=QJ.filter((d)=>!l.has(d));if(c.length>0)n.push(`manifest: no ${c.join("px and no ")}px icon declared — browsers will not offer to `+"install the site without one at each size.");return{errors:r,files:[{content:`${JSON.stringify(a,null,2)}
|
|
482
|
+
`,path:"manifest.webmanifest"}],warnings:n}}function av(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let r=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)r.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return r}function lv(e,t){let r=e.securityTxt,n=[],s=[];if(r===void 0||r.enabled===!1)return{errors:n,files:[],warnings:s};let i=r.contact??[];if(i.length===0)n.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(r.expires===void 0)n.push("securityTxt: `expires` is required (RFC 9116 §2.5.5) — a security.txt with no expiry "+"never goes stale visibly, which is how they end up pointing at people who left.");else{let l=new Date(r.expires);if(Number.isNaN(l.getTime()))n.push(`securityTxt: \`expires\` is not a valid date: "${r.expires}".`);else if(l.getTime()<=t.getTime())n.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let o=[];for(let l of r.preferredLanguages??[]){let c=dr(l);if(c===null)n.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else o.push(c)}if(n.length>0)return{errors:n,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...i.map((l)=>`Contact: ${l}`),`Expires: ${new Date(r.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(r.encryption??[]).map((l)=>`Encryption: ${l}`),...(r.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...o.length>0?[`Preferred-Languages: ${o.join(", ")}`]:[],...r.canonical===void 0?[]:[`Canonical: ${r.canonical}`],...(r.policy??[]).map((l)=>`Policy: ${l}`),...(r.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:n,files:[{content:`${a.join(`
|
|
485
483
|
`)}
|
|
486
|
-
`,path:".well-known/security.txt"}],warnings:s}}function
|
|
487
|
-
`,{outfile:a,resolveDir:r},{minify:n,target:"browser"}),i+=1}catch(l){s.push(`Bundling client runtime "${o.specifier}": ${Ee(l)}`)}}return{errors:s,written:i}}function
|
|
484
|
+
`,path:".well-known/security.txt"}],warnings:s}}function cv(e,t,r){let n=0,s=[];for(let i of e){let o=ZJ(t,i.path);if(r(o)){s.push(i.path);continue}KJ(XJ(o),{recursive:!0}),YJ(o,i.content,"utf8"),n+=1}return{skipped:s,written:n}}var QJ;var uv=q(()=>{nr();hs();ve();QJ=[192,512]});import{existsSync as eD,mkdirSync as Jd,readFileSync as tD,readdirSync as rD,writeFileSync as nD}from"node:fs";import{dirname as wo,join as sD,relative as iD,resolve as So}from"node:path";function oD(e){return e.endsWith("/")}function fv(e=Dd){let t={},r=[],n=[];for(let s of El)if(aD(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,n.push(s.assetPath);else t[s.specifier]=s.fallback,r.push(`Could not resolve "${s.specifier}" — the import map falls back to ${s.fallback}. Interactive pages will load it from a third party, and a \`default-src 'self'\` policy will block them.`);return{assetPaths:n,imports:t,warnings:r}}async function pv(e,t,r=Dd,n=!0){let s=[],i=0;for(let o of El){if(!e.assetPaths.includes(o.assetPath))continue;let a=So(t,o.assetPath.replace(/^\//,""));Jd(wo(a),{recursive:!0});try{await ms(`export * from ${JSON.stringify(o.specifier)};
|
|
485
|
+
`,{outfile:a,resolveDir:r},{minify:n,target:"browser"}),i+=1}catch(l){s.push(`Bundling client runtime "${o.specifier}": ${Ee(l)}`)}}return{errors:s,written:i}}function Ld(e){return Object.entries(e).filter(([t,r])=>!oD(t)&&r.startsWith("/")).map(([,t])=>t)}function mv(e){let t=[];for(let r of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let n;try{n=JSON.parse(r[1])}catch{continue}let s=ee(n)?n.imports:void 0;if(!F(s))continue;let i=Object.entries(s).flatMap(([o,a])=>T(a)?[[o,a]]:[]);t.push(...Ld(Object.fromEntries(i)))}return t}function hv(e){return`<script type="importmap">
|
|
488
486
|
{
|
|
489
487
|
"imports": {
|
|
490
488
|
${Object.entries(e).map(([r,n])=>` ${JSON.stringify(r)}: ${JSON.stringify(n)}`).join(`,
|
|
491
489
|
`)}
|
|
492
490
|
}
|
|
493
491
|
}
|
|
494
|
-
</script>`}function
|
|
495
|
-
`,{outfile:S,resolveDir:t},{minify:r,resolver:
|
|
496
|
-
`,"utf8"),s+=1}catch(a){r.push(`Writing shared core stub ${
|
|
497
|
-
`),v);for(let he of
|
|
498
|
-
`,"utf8"),z+=1}}if(j.size>0){i(`Bundling ${j.size} client runtime module(s)...`);let J=await
|
|
492
|
+
</script>`}function aD(e,t){try{return ch(e,t),!0}catch{return!1}}async function gv(e,t=Dd,r=!0){let n=[],s=new Set,i=new Map,o=new Map,a=So(e,"assets"),l=0,c=async(p)=>{if(!o.has(p.specifier))o.set(p.specifier,await fh(p.specifier,t,{target:"browser"}));return o.get(p.specifier)},d=async(p)=>[...tD(p,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let p=0;p<dv;p++){let h=0,m=[];try{m=rD(a,{recursive:!0}).map(String).filter((b)=>b.endsWith(".js")).map((b)=>sD(a,b))}catch{return Md(e,i,n,l)}for(let b of m){let g=[];try{g=await d(b)}catch{continue}for(let y of g){let v=El.find((P)=>y.startsWith(`${P.specifier}/`));if(!v||s.has(y))continue;s.add(y);let j=y.slice(v.specifier.length+1),S=So(e,`${v.assetDir.replace(/^\//,"")}${j}`);Jd(wo(S),{recursive:!0});try{await ms(`export * from ${JSON.stringify(y)};
|
|
493
|
+
`,{outfile:S,resolveDir:t},{minify:r,resolver:lD(v,S,await c(v),i),target:"browser"}),l+=1,h+=1}catch(P){n.push(`Bundling runtime subpath "${y}": ${Ee(P)}`)}}}if(h===0)return Md(e,i,n,l)}return n.push(`Runtime subpath resolution did not settle in ${dv} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Md(e,i,n,l)}function lD(e,t,r,n){return{filter:/.*/,resolve:({importer:s,path:i})=>{if(Uc(s))return;if(El.find((a)=>i===a.specifier||i.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:i};if(r===void 0||!i.startsWith("."))return;if(So(wo(s),i)!==r)return;return n.set(So(wo(t),i),e.specifier),{external:!0,path:i}}}}function Md(e,t,r,n){let s=n;for(let[i,o]of t){if(eD(i))continue;try{Jd(wo(i),{recursive:!0}),nD(i,`export * from ${JSON.stringify(o)};
|
|
494
|
+
`,"utf8"),s+=1}catch(a){r.push(`Writing shared core stub ${iD(e,i)}: ${Ee(a)}`)}}return{errors:r,written:s}}var El,Dd,dv=10;var yv=q(()=>{zc();Mr();ve();rr();El=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Ks,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Ys,specifier:"lit-html"}];Dd=import.meta.dirname});import{cpSync as _l,existsSync as xn,mkdirSync as Er,readFileSync as cD,readdirSync as uD,rmSync as dD,statSync as fD,writeFileSync as hr}from"node:fs";import{createHash as pD}from"node:crypto";import{basename as mD,dirname as Wr,join as Vn,relative as hD,resolve as Ye,sep as gD}from"node:path";async function vv(e,t={}){let{clean:r=!0,verbose:n=!1}=t,s=[],i=n?console.log.bind(console):()=>{};i("Loading project.json...");let{config:o}=Rn(e);if("contentTypes"in o)throw Error('project.json declares "contentTypes", which is no longer supported. Run `bun scripts/migrate-project-extensions.ts <project>` to migrate to "extensions" + "content", then `jx schema`.');let a=Ye(e,o.build.outDir),l=Ye(e,"pages"),c=Ye(e,"public"),d=o.build.trailingSlash??"always",p=o.build.minify!==!1,h=new Map,m=new Map,b=new Map,g=(J)=>{let H=J.toSorted(),ie=`/assets/elements-${pD("sha1").update(H.join("\x00")).digest("hex").slice(0,12)}.js`;return b.set(ie,H),ie},y=fv(),v=y.imports,j=new Set,S=bg(),{errors:P,i18n:E}=Gc(o);for(let J of P)s.push(J),console.error(J);for(let J of y.warnings)console.warn(J);let O=new Map,R=(J,H,V)=>{let ie=O.get(J);if(ie!==void 0&&ie.entryPath!==H)throw Error(`"${V}" and "${ie.specifier}" both map to ${J} — rename one`);O.set(J,{entryPath:H,specifier:V})},k=(J,H)=>{if(!lh(J))return J;try{let V=Wc(J,H??e,e);if(!os(J)&&!xn(V))return console.warn(`Sidecar "${J}" not found at ${V} — emitting unbundled`),J;let ie=os(J)?J:`./${hD(e,V)}`,Se=Pm(ie);return R(Se,V,J),h.set(Se,{entryPath:V,specifier:J}),Se}catch(V){return s.push(`Sidecar "${J}": ${Ee(V)}`),J}},I=(J)=>{let H=jm(J);try{let V=Wc(`npm:${J}`,e,e);return R(H,V,J),m.set(H,V),H}catch(V){return s.push(`$head specifier "${J}": ${Ee(V)}`),J}},D=await kn(e,o),M=D.formats;if(M.entries.length>0)i(` Registered ${M.entries.length} format(s): ${M.entries.map((J)=>J.name).join(", ")}`);let L=D.serverMounts().filter((J)=>{if(!J.project)return!0;let H=o[J.project.key];return F(H)&&Object.keys(H).length>0});if(L.length>0&&!o.build.adapter){let J=L.map((H)=>H.project?`"${H.project.key}"`:`"${H.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${J} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${bv}`)}if(r&&xn(a))dD(a,{force:!0,recursive:!0});if(Er(a,{recursive:!0}),!xn(l))throw Error(`pages/ directory not found in ${e}`);i("Discovering pages...");let W=await pg(l,M);i(` Found ${W.length} page(s)`),i("Loading project sections...");let se=await Ag(e,o,D),ue=Object.keys(se);if(ue.length>0)i(` Loaded ${ue.length} section(s): ${ue.join(", ")}`);let{errors:oe,mounts:Q}=await Cg(D,o,e);s.push(...oe);for(let J of oe)console.error(J);if(Q.length>0)i(` Mounted ${Q.length} asset dir(s): ${Q.map((J)=>J.urlPrefix).join(", ")}`);let ae=new Set,ke=await xD(D,o,e),le=(await gg(W,e,se,D,o,E)).map((J)=>Object.assign(J,{locale:Tr(J.urlPattern,E)}));i(` ${le.length} route(s) after expansion`);let z=0,te=Ye(e,"components"),Le=[],fe=new Map,Be=new Map,G=new Map;if(xn(te)){i("Compiling components...");let J=[".json",...M.documentExtensions("component")],H=uD(te).filter((ze)=>J.some((Te)=>ze.endsWith(Te))),V=Ye(a,"components");Er(V,{recursive:!0});let ie=new Map;for(let ze of H){let Te=Ye(te,ze);try{let{tagName:he}=await xs(Te,M);if(he)ie.set(Te,he)}catch{}}let Se=as(o.url),Or=Qa(Se);for(let ze of H)try{let Te=Ye(te,ze),he={formats:M,resolveElementPath:(ot,Zt)=>{let f=Zt?Ye(Zt,ot):Ye(ot),x=ie.get(f);return x?`./${x}.js`:ot.replace(/\.json$/,".js")},rewriteSrc:(ot,Zt)=>Ie(Se,k(ot,Zt)),serverBaseUrl:Or};if(o.$media)he.$media=o.$media;let xt=await Xa(Te,he);for(let ot of xt.files){let Zt=ot.tagName?`${ot.tagName}.js`:mD(ot.path);if(!Le.includes(ot.tagName))hr(Ye(V,Zt),ot.content,"utf8"),Le.push(ot.tagName),z+=1}let st=await xs(Te,M);if(st.tagName){Be.set(st.tagName,st),G.set(st.tagName,Te);let ot=ys(st,o.defaults),Zt=rg(st.tagName,st.style,st,o.$media??{},ot);if(Zt){if(ot===null)fe.set(st.tagName,Zt);Cu(Zt,Q,ae),hr(Ye(V,`${st.tagName}.css`),Zt,"utf8"),z+=1}}}catch(Te){let he=Ee(Te);s.push(`Error compiling component ${ze}: ${he}`),console.error(`Error compiling component ${ze}: ${he}`)}i(` Compiled ${Le.length} component(s): ${Le.join(", ")}`)}let We=[];for(let[J,H]of Be)We.push(...oo(H,G.get(J),e));if(o.state)We.push(...oo({state:o.state},Ye(e,"project.json"),e));let Xe=o.images.optimize&&o.images.service==="cloudflare",pt=o.images.optimize&&!Xe?J$(e):null,ut=Xe?new Map:null;if(Xe)console.log('images.service is "cloudflare" — srcsets use /cdn-cgi/image transform URLs. '+"Ensure Image Transformations are enabled for your zone (Cloudflare dashboard → "+"Images → Transformations); these URLs do not work on *.pages.dev / *.workers.dev previews.");let Ue=o.url,bt=as(Ue),Mt=Boolean(Ue)&&o.build.sitemap!==!1,Xr=[],En=le.filter((J)=>!J.urlPattern.includes(":")&&!J.urlPattern.includes("*")),Ii=E===null?new Map:await fg(En,M),Jt=En.map((J)=>({translationKey:Ii.get(J.urlPattern),urlPattern:J.urlPattern})),Zr=cg(Jt,E,Ue,d),{conflicts:Mi,sets:Ts}=ju(Jt,E);for(let J of Mi){let[H,V]=J.urlPatterns,ie=J.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",Se=`${V} and ${H} are both the "${J.locale}" version of "${J.key}". A translation set names one URL per language, so ${V} is `+`dropped from it — it carries no alternates and no switcher. ${ie}`;if(J.declared)s.push(Se),console.error(Se);else console.warn(Se)}let ts=ag(le,E);if(ts.length>0)console.warn(`i18n.routing is "prefix-always", but ${ts.length} route(s) sit outside the locale tree and are served as "${E?.defaultLocale}": ${ts.slice(0,10).join(", ")}${ts.length>10?`, and ${ts.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(E!==null&&E.routing==="prefix-always"&&!o.build.adapter&&!le.some((J)=>J.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${E.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Is=new Set,ia=new Set;for(let J of le){let H=lg(J.urlPattern,E);if(H&&!Is.has(H.segment))Is.add(H.segment),console.warn(`Routes under /${H.segment}/ are served as "${E?.defaultLocale}" — `+`i18n.locales declares "${H.meant}", not "${H.segment}". Rename the directory to "${H.meant.toLowerCase()}" or declare the shorter tag.`);try{i(` Compiling ${J.urlPattern} ...`);let V=await yD(J,o,e,se,pt,Be,ut,M,D,k,Q,ke,I,{alternates:Zr.get(J.urlPattern)??[],i18n:E,translations:Ts.get(J.urlPattern)??[]},v,g);We.push(...V.serverEntries);for(let he of V.unregisteredRelations)if(!ia.has(he))ia.add(he),console.warn(`<link rel="${he}"> — "${he}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");let ie=new Set;for(let[he,xt]of Be)if(Wa(xt))ie.add(he);if(Le.length>0)V.html=wD(V.html,Le,fe,ie,V.files.map((he)=>he.content).join(`
|
|
495
|
+
`),v);for(let he of mv(V.html))j.add(he);Cu(V.html,Q,ae),xg(V.html,S);let Se=_v(J.urlPattern,a,d);Er(Wr(Se),{recursive:!0});let Or=!J.urlPattern.includes(":")&&!J.urlPattern.includes("*"),ze=!io(J.urlPattern)&&!ng(V.html);if(Mt&&!V.excludeFromSitemap&&ze&&Or){let he=Zr.get(J.urlPattern)??[];Xr.push({lastmod:T(J.sourceMtime)&&J.sourceMtime!==""?J.sourceMtime:PD(fD(J.sourcePath).mtime),loc:An(ri(J.urlPattern,d),Ue),...he.length>0&&{alternates:he}})}let Te=[];for(let he of M.withCapability("serialize")){if(!he.exportTarget||io(J.urlPattern))continue;try{let xt=await he.call("serialize",V.doc,{buildScope:(st)=>zs(st,null),componentDefs:Be,evaluateTemplate:(st,ot)=>{if(!pe(st))return;return wt(st,ot)??st},mode:"export"});if(xt){let st=Se.replace(/\.html$/,he.extensions[0]);Te.push({content:xt,path:st,type:he.mediaTypeEssence})}}catch(xt){s.push(`Error exporting ${he.name} for ${J.urlPattern}: ${Ee(xt)}`)}}for(let he of Te)if(he.type!==null)V.html=ig(V.html,{href:og(a,he.path),type:he.type});hr(Se,Om(V.html,bt),"utf8"),z+=1;for(let he of Te)hr(he.path,he.content,"utf8"),z+=1;for(let he of V.files){let xt=Ye(Wr(Se),he.path);Er(Wr(xt),{recursive:!0}),hr(xt,he.content,"utf8"),z+=1}}catch(V){let ie=`Error compiling ${J.urlPattern}: ${Ee(V)}`;s.push(ie),console.error(ie)}}if(pt&&o.images.optimize){D$(e,pt,{prune:s.length===0});let J=Ye(hi(e),"_optimized");if(xn(J)){let V=Ye(a,"images/_optimized");Er(V,{recursive:!0}),_l(J,V,{recursive:!0})}let H=Object.keys(pt.entries).length;if(H>0)i(` Optimized ${H} image(s)`)}let Qr=[];if(!o.build.adapter&&We.length>0){let H=`timing: "server" entries ${[...new Set(We.map(({exportName:V,declaredIn:ie})=>`${V} (${ie})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${bv}`;s.push(H),console.error(H)}if(o.build.adapter){let{adapter:J}=o.build;i("Generating site-wide server worker...");let{entries:H,errors:V}=Vg(We);Qr=H;for(let Te of V)s.push(Te),console.error(Te);let{mounts:ie,connectors:Se}=bD(L,D,o);if(ie.length>0)i(` Mounting ${ie.length} extension route(s): ${ie.map((Te)=>Te.basePath).join(", ")}`);let ze=J==="cloudflare-pages"&&Qr.length===0&&ie.length===0?null:Vu(Qr,{adapter:J,base:bt,connectors:Se,i18n:E,mounts:ie});if(ze){let Te=J==="cloudflare-pages"?"_worker.js":"worker.js";try{await ph(ze,{adapter:J,outfile:Ye(a,Te),projectRoot:e}),z+=1,i(` Generated dist/${Te} (bundled, ${Qr.length} server function(s))`)}catch(he){let xt=`Error bundling dist/${Te}: ${Ee(he)}`;s.push(xt),console.error(xt)}if(J==="cloudflare-pages")hr(Ye(a,"_routes.json"),`${JSON.stringify({exclude:[],include:(E&&E.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((he)=>Ie(bt,he)),version:1},null,2)}
|
|
496
|
+
`,"utf8"),z+=1}}if(j.size>0){i(`Bundling ${j.size} client runtime module(s)...`);let J=await pv({...y,assetPaths:[...j]},a,void 0,p);z+=J.written;for(let H of J.errors)s.push(H),console.error(H)}if(m.size>0){i(`Copying ${m.size} package asset(s)...`);for(let[J,H]of m){let V=Ye(a,J.replace(/^\//,""));Er(Wr(V),{recursive:!0}),_l(H,V),z+=1,i(` ${H} → ${J}`)}}if(h.size>0){i(`Bundling ${h.size} client sidecar module(s)...`);for(let[J,H]of h)try{let V=Ye(a,J.replace(/^\//,""));Er(Wr(V),{recursive:!0}),await dh({entryPath:H.entryPath,outfile:V},{external:ah,minify:p,target:"browser"}),z+=1,i(` ${H.specifier} → ${J}`)}catch(V){let ie=`Error bundling sidecar "${H.specifier}": ${Ee(V)}`;s.push(ie),console.error(ie)}}if(b.size>0){i(`Bundling ${b.size} npm element set(s)...`);for(let[J,H]of b){let V=Ye(a,J.replace(/^\//,""));Er(Wr(V),{recursive:!0});try{await ms(`${H.map((ie)=>`import ${JSON.stringify(ie)};`).join(`
|
|
499
497
|
`)}
|
|
500
|
-
`,{outfile:V,resolveDir:e},{minify:p,target:"browser"}),z+=1,i(` ${H.length} element(s) → ${J}`)}catch(ie){let Se=`Error bundling npm $elements [${H.join(", ")}]: ${Ee(ie)}`;s.push(Se),console.error(Se)}}}if(j.size>0){let J=await
|
|
501
|
-
Build complete: ${le.length} routes, ${z} files`),s.length>0)i(` ${s.length} error(s)`);return{errors:s,files:z,routes:le.length,serverEntries:
|
|
502
|
-
${
|
|
498
|
+
`,{outfile:V,resolveDir:e},{minify:p,target:"browser"}),z+=1,i(` ${H.length} element(s) → ${J}`)}catch(ie){let Se=`Error bundling npm $elements [${H.join(", ")}]: ${Ee(ie)}`;s.push(Se),console.error(Se)}}}if(j.size>0){let J=await gv(a,void 0,p);if(J.written>0)i(`Bundling ${J.written} runtime subpath module(s)...`);z+=J.written;for(let H of J.errors)s.push(H),console.error(H)}for(let J of D.emitters()){let H=J.project?.key,V=H?o[H]:void 0;if(H&&(V==null||F(V)&&Object.keys(V).length===0))continue;try{let ie=await J.call("emit",V??null,{projectConfig:o,root:e,routes:le,sections:se});for(let Se of ie??[]){let Or=Ye(a,Se.path.replace(/^\//,""));if(!Or.startsWith(a+gD))throw Error(`emit path escapes outDir: ${Se.path}`);Er(Wr(Or),{recursive:!0}),hr(Or,Se.content),z+=1,i(` ${J.name} emitted ${Se.path}`)}}catch(ie){let Se=`Error in ${J.name}.emit: ${Ee(ie)}`;s.push(Se),console.error(Se)}}if(o.redirects&&Object.keys(o.redirects).length>0){i("Generating redirects...");let J=new Set(le.map((V)=>V.urlPattern)),H=_D(o.redirects,a,{basePath:bt,compiledUrls:J,trailingSlash:o.build.trailingSlash});z+=H.files,s.push(...H.errors)}if(Mt)i(`Generating sitemap (${Xr.length} URL(s))...`),z+=kD(Xr,a);else if(!Ue&&o.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(ae.size>0){let{copied:J,missing:H}=Ng(ae,Q,a);z+=J,i(`Copying ${J} mounted asset(s)...`);for(let V of H)console.warn(`Referenced asset not found: ${V}`)}if(xn(c))i("Copying public/ assets..."),_l(c,a,{recursive:!0});if(Mt)z+=RD(a,Ue);{let J=[ov(o),lv(o,new Date)];for(let ie of J){for(let Se of ie.errors)s.push(Se),console.error(Se);for(let Se of ie.warnings)console.warn(Se)}let{skipped:H,written:V}=cv(J.flatMap((ie)=>ie.files),a,xn);z+=V;for(let ie of H)i(` ${ie} — kept the copy from public/`)}{let J=Id(o.serviceWorker);if(J!==null){let H=J===!1?nv():rv(J,a,bt);for(let V of H.warnings)console.warn(V);for(let V of H.errors)s.push(V),console.error(V);if(H.path!==null)hr(Vn(a,H.path),H.source,"utf8"),z+=1,i(J===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:J,rules:H}=Eg(o.build,S);s.push(...J);let V=Pg([...H,..._g(a)],bt);if(V.length>0){i("Writing response headers..."),z+=jg(a,V);let{adapter:ie,deploy:Se}=o.build;if(ie==="node"||ie==="bun")console.warn(`The "${ie}" adapter serves no static assets, so dist/_headers is documentation `+"rather than configuration — apply these headers at the reverse proxy in front of it.");else if(ie===void 0&&Se===void 0)if(xn(Ye(c,"CNAME")))console.warn("GitHub Pages ignores dist/_headers and serves its own Cache-Control: max-age=600, so the generated caching and security rules will not take effect. Deploy behind a host that reads _headers (Cloudflare Pages, Cloudflare Workers assets, Netlify) to apply them.");else i(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}z+=kg(a)}if(o.copy){i("Copying mapped files...");for(let[J,H]of Object.entries(o.copy)){if(!T(H))throw TypeError(`project.json copy["${J}"] must be a destination path string`);let V=Ye(e,J),ie=Ye(a,H);Er(Wr(ie),{recursive:!0}),_l(V,ie)}}if(i(`
|
|
499
|
+
Build complete: ${le.length} routes, ${z} files`),s.length>0)i(` ${s.length} error(s)`);return{errors:s,files:z,routes:le.length,serverEntries:Qr}}async function yD(e,t,r,n,s,i,o,a,l,c,d,p,h,m,b,g){let y=as(t.url),v=await xs(e.sourcePath,a),j=await Lg(v,t,r),S=[...oo(v,e.sourcePath,r),...Fg(v,t,r).flatMap((fe)=>oo(fe.doc,fe.path,r))],P=Wg(v.$head??j._pageHead??[],v.description),E=j.$head??[],O=v.title??j._pageTitle??null;delete j._pageHead,delete j._pageTitle,Qg(j,t,e,r,m.i18n,m.translations);let R=ug({defaults:t.defaults,pageDir:T(v.$dir)?v.$dir:void 0,pageLang:T(v.$lang)?v.$lang:void 0,routeLocale:Tr(e.urlPattern,m.i18n)});await $y(j,e,r,{config:t,registerBundle:(fe)=>{c(fe,null)},registry:l,sections:n});let k=zs(j.state??{}),I=O??t.name;if(pe(I))I=wt(I,k)??I;let D=Fd(xv(P,k),h),M=Fd(xv(E,k),h);Eo(j,k);let L={counter:{n:0},media:{...t.$media,...j.$media},rules:[]},W={n:0};if(Wd(j,i,L,t.defaults,W),j.state){let fe=new Set;for(let[G,We]of Object.entries(j.state)){if(G==="$site"||G==="$page")continue;if(ee(We)&&We.timing==="compiler")delete j.state[G];else if(Array.isArray(We))fe.add(G)}let Be=!0;while(Be){Be=!1;let G={...j.state};for(let Xe of fe)delete G[Xe];let We=JSON.stringify({children:j.children,state:G});for(let Xe of fe)if(vD(We,Xe))fe.delete(Xe),Be=!0}for(let G of fe)delete j.state[G]}let se=Id(t.serviceWorker),ue=se===null||se===!1?[]:[{tagName:"script",textContent:sv(se.scope??"/",y)}],oe=[...av(t),...ue,...p,...Fd(t.$head??[],h)],Q=Ug(oe,M,D,{title:I,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!io(e.urlPattern)&&{pageUrl:ri(e.urlPattern,t.build.trailingSlash)}});if(t.$media)j.$media={...t.$media,...j.$media};if(Object.values(j.$media??{}).some((fe)=>wr(String(fe))!==null))Q.splice(2,0,{tagName:"script",textContent:Zs()});let ae=t.images;await Y$(j,ae,r,s,o??void 0,d);let ke={lang:R.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(fe)=>Ie(y,c(fe,Wr(e.sourcePath))),serverBaseUrl:Qa(y),title:I},U=b["@vue/reactivity"];if(U!==void 0)ke.reactivitySrc=U;let le=b["lit-html"];if(le!==void 0)ke.litHtmlSrc=le;let z=await Wu(j,ke);if(L.rules.length>0)z.html=z.html.replace("</head>",`<style>
|
|
500
|
+
${Ha(L.rules.join(`
|
|
503
501
|
`))}
|
|
504
502
|
</style>
|
|
505
|
-
</head>`);z.html=
|
|
506
|
-
`):null,g=
|
|
503
|
+
</head>`);z.html=ED(z.html,Q,R);let te=(fe)=>typeof fe==="string"&&!fe.startsWith("./")&&!fe.startsWith("../"),Le=[...new Set([...j.$elements??[],...v.$elements??[]].filter((fe)=>te(fe)))];if(Le.length>0)z.html=SD(z.html,g(Le));return{doc:j,excludeFromSitemap:v.$sitemap===!1,files:z.files,html:z.html,unregisteredRelations:Kg(Q),serverEntries:S}}function bD(e,t,r){if(e.length===0)return{connectors:[],mounts:[]};let n=as(r.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in r)s[c]=r[c]}let i=e.map((l)=>{let c=l.server,{module:d}=c;if(!T(d)||d==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let p=Ie(n,c.basePath);return{basePath:p,className:l.classDef.title??l.name,module:d,options:{basePath:p,sections:s},order:c.order??100}}),o=new Set;for(let l of Object.values(s)){if(!ee(l))continue;for(let c of Object.values(l)){let d=ee(c)?c.provider:void 0;if(T(d))o.add(d)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!o.has(c))continue;let{module:d}=l.connector;if(!T(d)||d==="")throw Error(`Connector class "${l.name}": connector.module (a bare import specifier) is required to generate a deployable worker`);a.push({className:l.classDef.title??l.name,module:d,provider:c})}return{connectors:a,mounts:i}}async function xD(e,t,r){let n=[];for(let s of e.headProviders()){let i=s.project?.key,o=i===void 0?null:t[i];if(i!==void 0&&(o===void 0||o===null))continue;try{let a=await s.call("head",o??null,{projectConfig:t,root:r});n.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${Ee(a)}`)}}return n}function Bd(e,t){if(Array.isArray(e))return e.map((r)=>Bd(r,t));if(ee(e))return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Bd(n,t)]));if(pe(e))return wt(e,t)??e;return e}function xv(e,t){return e.map((r)=>{if(!F(r))return r;let n={...r};if(n.attributes){n.attributes={...n.attributes};for(let[s,i]of Object.entries(n.attributes))if(pe(i))n.attributes[s]=wt(i,t)??i}if(pe(n.textContent))n.textContent=wt(n.textContent,t)??n.textContent;else if(F(n.textContent))n.textContent=Bd(n.textContent,t);return n})}function Fd(e,t){return e.map((r)=>{if(!F(r)||!r.attributes)return r;let n={...r,attributes:{...r.attributes}};for(let s of["href","src"]){let i=n.attributes[s];if(T(i)&&$D(i))n.attributes[s]=t(i)}return n})}function $D(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function wv(e){return Pv(e).replaceAll("${","${")}function Sv(e){return e.replaceAll("${","${")}function Ev(e,t){if(!F(e))return e;let r={};for(let[n,s]of Object.entries(e))if(n==="children"&&Array.isArray(e.children))r.children=e.children.map((i)=>{if(T(i))return i;return Ev(i,t)});else if(n==="style"&&F(e.style)){let i={...e.style};for(let[o,a]of Object.entries(i))if(pe(a))i[o]=Pl(a,t)??a;r.style=i}else if(n==="attributes"&&F(e.attributes)){let i={...e.attributes};for(let[o,a]of Object.entries(i))if(pe(a)){let l=Pl(a,t);i[o]=T(l)&&l.includes("${")?Sv(l):l??a}r.attributes=i}else if(n==="$props"&&F(e.$props)){let i={...e.$props};for(let[o,a]of Object.entries(i))if(pe(a)){let l=Pl(a,t);i[o]=l!==null?l??null:a}r.$props=i}else if(pe(s)){let i=Pl(s,t);if(n==="textContent"&&T(i)&&i.includes("${"))r.innerHTML=wv(i);else r[n]=i??s}else r[n]=s;return r}function Pl(e,t){try{let r=t.$map,n=F(r)&&"item"in r?r.item:void 0,s=F(r)&&"index"in r?r.index:void 0,i=Ws(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",i)(t,r,n,s)}catch{return null}}function Eo(e,t){if(!F(e))return;if(pe(e.innerHTML)){let s=wt(e.innerHTML,t);if(s!=null)e.innerHTML=String(s).replaceAll("${","${")}let r=e.textContent;if(pe(r)){let s=wt(r,t);if(T(s)&&s.includes("${"))e.innerHTML=wv(s),delete e.textContent;else e.textContent=s??r}if(F(e.style)){for(let[s,i]of Object.entries(e.style))if(pe(i))e.style[s]=wt(i,t)??i}if(F(e.attributes)){for(let[s,i]of Object.entries(e.attributes))if(pe(i)){let o=wt(i,t);e.attributes[s]=T(o)&&o.includes("${")?Sv(o):o??i}}if(F(e.$props)){let s=e.$props;for(let[i,o]of Object.entries(s))if(pe(o))s[i]=wt(o,t)??o}let n=e.children;if(Qe(n)){let s=$v(n,t);if(s&&s.length>0){e.children=s;return}}if(pe(n)){let s=wt(n,t);if(Array.isArray(s)){let i=s;e.children=i;for(let o of i)Eo(o,t)}}else if(Array.isArray(e.children)){let s=0;while(s<e.children.length){let i=e.children[s];if(pe(i)){let o=wt(i,t);if(Array.isArray(o)){let a=o;e.children.splice(s,1,...a);for(let l of a)Eo(l,t);s+=a.length;continue}}if(Qe(i)){let o=$v(i,t);if(o&&o.length>0){e.children.splice(s,1,...o),s+=o.length;continue}}Eo(i,t),s+=1}}}function vD(e,t){let r=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);return new RegExp(String.raw`\bstate\.${r}\b|#/state/${r}(?=["/])`).test(e)}function $v(e,t){let r=e.items,n=Ce(r)?gu(r.$ref,t):r,s=e.map;if(!Array.isArray(n)||!s)return null;return n.map((o,a)=>{let l=Object.create(t);l.$map={index:a,item:o},l["$map/item"]=o,l["$map/index"]=a;let c=Ev(s,l);return Eo(c,l),c})}function Wd(e,t,r,n,s){if(!F(e))return;if(Array.isArray(e)){for(let a of e)Wd(a,t,r,n,s);return}if(Array.isArray(e.children))for(let a of e.children)Wd(a,t,r,n,s);let{tagName:i}=e;if(!T(i))return;let o=t.get(i);if(o){if(e.attributes){let{lifted:v,rest:j}=Eu(e.attributes);if(v)e.attributes=j,e.$props={...v,...e.$props}}let a=(v)=>{if(r&&F(v)&&!Array.isArray(v))Tn(v,r.rules,r.media,"",r.counter,"jxs");return Gs(v,{},null)},l=ys(o,n),c=e.$props||null,d={componentDefs:t,defaults:n,path:[{key:JSON.stringify(c??{}),tag:i}],slotIds:s},p=Wa(o),{children:h}=e,m=!l&&!p&&Nn(o.children)?wu(d):null,b=l?(Array.isArray(h)?h:[]).map((v)=>a(v)).join(`
|
|
504
|
+
`):null,g=tg(o,c,l?null:Su(h,{},a,m),d);if(m!==null)e.attributes={...e.attributes,[to]:String(m)};e.innerHTML=l?`<template shadowrootmode="${l}"><link rel="stylesheet" href="/components/${i}.css">${g}</template>${b??""}`:g,delete e.children;let y=_u(o.style,Ba(o,c));if(Object.keys(y).length>0)e.style={...e.style,...y};if(!p&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,p)e.$static=!0;else e.$prerendered=!0}}function wD(e,t,r=new Map,n=new Set,s="",i={}){let o=(S)=>e.includes(`<${S}`),a=(S)=>s.includes(`<${S}`),l=t.filter((S)=>o(S)||a(S));if(l.length===0)return e;let c=l.flatMap((S)=>{let P=r.get(S);return P===void 0||P===""?[]:[P]}).join(`
|
|
507
505
|
`),d=c===""?"":`<style>
|
|
508
|
-
${
|
|
506
|
+
${Ha(c)}
|
|
509
507
|
</style>`,p=(S)=>{let P=S.filter(Boolean).join(`
|
|
510
508
|
`);return P===""?e:e.replace("</head>",` ${P}
|
|
511
|
-
</head>`)},h=l.filter((S)=>a(S)||!n.has(S));if(h.length===0)return p([d]);let m=
|
|
509
|
+
</head>`)},h=l.filter((S)=>a(S)||!n.has(S));if(h.length===0)return p([d]);let m=hv(i),g=[...Ld(i),...h.map((S)=>`/components/${S}.js`)].map((S)=>`<link rel="modulepreload" href="${S}">`).join(`
|
|
512
510
|
`),y=e.includes('<script type="importmap">'),v=p([y?"":m,g,d]),j=h.map((S)=>`<script type="module" src="/components/${S}.js"></script>`).join(`
|
|
513
511
|
`);return v.replace("</body>",` ${j}
|
|
514
|
-
</body>`)}function
|
|
515
|
-
</body>`)}function
|
|
512
|
+
</body>`)}function SD(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
|
|
513
|
+
</body>`)}function ED(e,t,r){let n=zg(t),s=/<head>([\s\S]*?)<\/head>/i,i=e.match(s),o="";if(i){let l=i[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)o+=`
|
|
516
514
|
${l.join(`
|
|
517
515
|
`)}`;let c=i[1].match(/<script[\s\S]*?<\/script>/gi);if(c)o+=`
|
|
518
516
|
${c.join(`
|
|
519
517
|
`)}`}let a=e;if(s.test(a))a=a.replace(s,`<head>
|
|
520
518
|
${n}${o}
|
|
521
|
-
</head>`);return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,`lang="${r.lang}"`):l.replace("<html",`<html lang="${r.lang}"`);if(r.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${r.dir}"`):c.replace("<html",`<html dir="${r.dir}"`);return c}),a}function
|
|
522
|
-
<link rel="canonical" href="${
|
|
519
|
+
</head>`);return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,`lang="${r.lang}"`):l.replace("<html",`<html lang="${r.lang}"`);if(r.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${r.dir}"`):c.replace("<html",`<html dir="${r.dir}"`);return c}),a}function _v(e,t,r){if(e==="/")return Vn(t,"index.html");if(io(e))return Vn(t,"404.html");let n=e.replace(/^\//,"");if(r==="always")return Vn(t,n,"index.html");return Vn(t,`${n}.html`)}function _D(e,t,r={}){let n=0,s=[],i=[],o=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...r.compiledUrls??[]].map((c)=>o(c))),l=r.trailingSlash??"always";for(let[c,d]of Object.entries(e)){let p=T(d)?d:d.destination,h=!T(d)&&"rewrite"in d&&d.rewrite,m=h?200:!T(d)&&("status"in d)?d.status??301:301;if(!h&&!qd.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...qd.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let b=r.basePath??"";if(i.push(`${Ie(b,c)} ${Ie(b,p)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(o(c)))console.warn(`The ${h?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(h)continue;let g=qd.get(String(m));if(!g.html)continue;let y=_v(c,t,l),v=g.canonical?`
|
|
520
|
+
<link rel="canonical" href="${Hd(p)}">`:`
|
|
523
521
|
<meta name="robots" content="noindex">`,j=`<!DOCTYPE html>
|
|
524
522
|
<html>
|
|
525
523
|
<head>
|
|
526
524
|
<meta charset="utf-8">
|
|
527
|
-
<meta http-equiv="refresh" content="0;url=${
|
|
525
|
+
<meta http-equiv="refresh" content="0;url=${Hd(p)}">${v}
|
|
528
526
|
<title>Redirecting...</title>
|
|
529
527
|
</head>
|
|
530
528
|
<body>
|
|
531
|
-
<p>Redirecting to <a href="${
|
|
529
|
+
<p>Redirecting to <a href="${Hd(p)}">${Pv(p)}</a>...</p>
|
|
532
530
|
</body>
|
|
533
|
-
</html>`;Er(
|
|
531
|
+
</html>`;Er(Wr(y),{recursive:!0}),hr(y,j,"utf8"),n+=1}if(i.length>0)hr(Vn(t,"_redirects"),`${i.join(`
|
|
534
532
|
`)}
|
|
535
|
-
`,"utf8"),n+=1;return{errors:s,files:n}}function
|
|
533
|
+
`,"utf8"),n+=1;return{errors:s,files:n}}function Pv(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function Hd(e){return String(e).replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}function Vd(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function PD(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function kD(e,t){if(e.length===0)return 0;let r=e.map((i)=>{let o=(i.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${Vd(a.hreflang)}" href="${Vd(a.href)}"/>`).join(`
|
|
536
534
|
`);return` <url>
|
|
537
|
-
<loc>${
|
|
535
|
+
<loc>${Vd(i.loc)}</loc>
|
|
538
536
|
<lastmod>${i.lastmod}</lastmod>
|
|
539
537
|
${o===""?"":`${o}
|
|
540
538
|
`} </url>`}).join(`
|
|
541
539
|
`),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
542
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((i)=>(i.alternates?.length??0)>0)?` xmlns:xhtml="${
|
|
540
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((i)=>(i.alternates?.length??0)>0)?` xmlns:xhtml="${jD}"`:""}>
|
|
543
541
|
${r}
|
|
544
542
|
</urlset>
|
|
545
|
-
`;return hr(
|
|
543
|
+
`;return hr(Vn(t,"sitemap.xml"),s,"utf8"),1}function RD(e,t){let r=Vn(e,"robots.txt"),n=xn(r),s=n?cD(r,"utf8"):`User-agent: *
|
|
546
544
|
Allow: /
|
|
547
545
|
`;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
|
|
548
546
|
`))s+=`
|
|
549
547
|
`;return s+=`
|
|
550
|
-
Sitemap: ${
|
|
551
|
-
`,hr(r,s,"utf8"),n?0:1}var $v='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',Wd,$D="http://www.w3.org/1999/xhtml";var Rv=q(()=>{ve();rr();nr();Im();Yc();Hi();bg();Ag();sn();Cg();Ig();Hg();Bg();Kg();Xg();ty();$y();uo();zu();Mr();Us();wy();tv();Nu();ov();Ru();dv();Ou();xv();Id();Wd=new Map([["301",{canonical:!0,html:!0,why:""}],["302",{canonical:!1,html:!0,why:""}],["303",{canonical:!1,html:!0,why:""}],["307",{canonical:!1,html:!1,why:"307 preserves the request method and body; a meta-refresh silently converts POST to GET"}],["308",{canonical:!1,html:!1,why:"308 preserves the request method and body; a meta-refresh silently converts POST to GET"}]])});import{createRequire as SD}from"node:module";import{join as ED}from"node:path";import{spawn as _D}from"node:child_process";function PD(e){try{return SD(ED(e,"package.json")).resolve("@jxsuite/server/dev")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function Av(e,t,r=_D,n=process){let i=[PD(e),"--root",e];if(t!==void 0)i.push("--port",String(t));let o=r("bun",i,{stdio:"inherit"});return o.on("error",(a)=>{if(a.code==="ENOENT")console.error("The Jx dev server runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.");else console.error(`Failed to start the dev server: ${a.message}`);n.exitCode=1}),n.on("SIGINT",()=>{o.kill("SIGINT")}),n.on("SIGTERM",()=>{o.kill("SIGTERM")}),o.on("exit",(a)=>{n.exitCode=a??0}),o}var Ov=()=>{};import{createServer as jD}from"node:http";import{existsSync as Rl,readFileSync as Cv,statSync as kD}from"node:fs";import{extname as RD,join as Kd,normalize as AD,resolve as Tv,sep as OD}from"node:path";function TD(e,t){let r=AD(t).replaceAll("\\","/"),n=Tv(e,`.${r.startsWith("/")?r:`/${r}`}`);if(n!==e&&!n.startsWith(e+OD))return null;if(Rl(n)){if(kD(n).isDirectory()){let i=Kd(n,"index.html");return Rl(i)?i:null}return n}let s=Kd(n,"index.html");return Rl(s)?s:null}function Nv(e,t){let r=Tv(e),n=jD((s,i)=>{let o=new URL(s.url??"/","http://localhost"),a=TD(r,decodeURIComponent(o.pathname));if(a){i.writeHead(200,{"Content-Type":CD.get(RD(a).toLowerCase())??"application/octet-stream"}),i.end(Cv(a));return}let l=Kd(r,"404.html");if(Rl(l)){i.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),i.end(Cv(l));return}i.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),i.end("Not found")});return n.listen(t),n}var CD;var Iv=q(()=>{Rc();CD=new Map(Object.entries({".avif":"image/avif",".css":"text/css; charset=utf-8",".gif":"image/gif",".html":"text/html; charset=utf-8",".ico":"image/x-icon",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".svg":"image/svg+xml",".txt":"text/plain; charset=utf-8",".webp":"image/webp",".woff2":"font/woff2",".xml":"application/xml; charset=utf-8",...hm}))});var ko="https://jxsuite.com/schema/project/fields/v2",Es="https://jxsuite.com/schema/document/paths/v2",Mv,Jv,Ro,Yd;var Al=q(()=>{Mv={description:"A single field definition inside a section entry schema — a small, recursive subset of "+"JSON Schema. Recursive positions reference the effective field union via the well-known fields resource $id.",properties:{default:{},description:{type:"string"},enum:{type:"array"},format:{type:"string"},items:{$ref:"https://jxsuite.com/schema/project/fields/v2"},properties:{additionalProperties:{$ref:"https://jxsuite.com/schema/project/fields/v2"},type:"object"},required:{items:{type:"string"},type:"array"},type:{enum:["string","number","integer","boolean","array","object"],type:"string"}},required:["type"],type:"object"},Jv={description:`Relationship reference field: points at a named entry of a referenceable section via "#/<sectionKey>/<name>" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.`,properties:{$ref:{pattern:"^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",type:"string"},description:{type:"string"}},required:["$ref"],type:"object"},Ro=[{additionalProperties:!1,description:'Explicit value list: generates one page per value, bound to `param` (default "value").',properties:{param:{description:'Route parameter to fill (default "value").',type:"string"},values:{description:"The values to expand.",type:"array"}},required:["values"],type:"object"},{additionalProperties:!1,description:"JSON data-file source: loads a project-relative file that must contain an array, and generates one page per item.",properties:{$ref:{description:"Project-relative path to a .json file containing an array.",type:"string"},field:{description:'Item field providing the parameter value (default "id").',type:"string"},param:{description:'Route parameter to fill (default "id").',type:"string"}},required:["$ref"],type:"object"},{description:"Legacy explicit form: an array of ready-made parameter objects, used as-is with no expansion. Prefer one of the source shapes above.",items:{additionalProperties:{type:"string"},type:"object"},type:"array"}],Yd={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});function ND(e){let{corePath:t,fragments:r,fieldSchemaRefs:n=[]}=e;return{$comment:qv,$defs:{Fields:{$id:ko,anyOf:[{$ref:`${Dv}#/$defs/JxFieldSchema`},{$ref:`${Dv}#/$defs/RelationshipRef`},...n.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...r.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function Oo(e,t,r,n=[]){let s=structuredClone(e),i=new Map,o=new Set;Xd(s,o);let a=0,l=async(d)=>{let p=Ao(d),h=i.get(p);if(h!==void 0)return h;let m;try{m=structuredClone(await t(p))}catch(v){throw Error(`bundleSchema: cannot load $ref target "${p}": ${qD(v)}`,{cause:v})}let b=N(m.$id)&&Vn(m.$id)?m.$id:null;a+=b===null?1:0;let g=b??`urn:jx:bundled:${a}`;if(i.set(p,g),o.has(g))return g;o.add(g),m.$id=g,await c(m,FD(p),!0);let y=s.$defs??={};return y[g]=m,g},c=async(d,p,h=!1)=>{if(Array.isArray(d)){for(let y of d)await c(y,p);return}if(!ee(d))return;let m=d,b=p;if(!h&&N(m.$id)&&Vn(m.$id))b=null;let g=m.$ref;if(N(g)&&b!==null&&!g.startsWith("#")&&!Vn(g)){let y=g.indexOf("#"),v=y===-1?g:g.slice(0,y),j=y===-1?"":g.slice(y);if(v){let S=await l(`${b}/${v}`);m.$ref=`${S}${j}`}}for(let y of Object.values(m))await c(y,b)};await c(s,Ao(r),!0);for(let d of n)await l(`${Ao(r)}/${d}`);return s}function DD(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*Lv(e,t){for(let r of ID){let n=e[r];if(Array.isArray(n)){for(let[s,i]of n.entries())if(ee(i))yield[i,`${t}/${r}/${s}`]}else if(ee(n))yield[n,`${t}/${r}`]}for(let r of MD){let n=e[r];if(!ee(n))continue;for(let[s,i]of Object.entries(n))if(ee(i))yield[i,`${t}/${r}/${DD(s)}`]}for(let r of JD){let n=e[r];if(!Array.isArray(n))continue;for(let[s,i]of n.entries())if(ee(i))yield[i,`${t}/${r}/${s}`]}}function LD(e,t){let r=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(r.startsWith("//")){let i=r.indexOf("/",2);r=i===-1?"":r.slice(i+1)}r=r.replace(/^schema\//,"");let n=r.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=n;for(let i=2;t.has(s);i+=1)s=`${n}-${i}`;return t.add(s),s}function Co(e){let t=structuredClone(e);if(ee(t.$defs)){let i=new Set(Object.keys(t.$defs).filter((a)=>!Vn(a))),o={};for(let[a,l]of Object.entries(t.$defs)){let c=ee(l)&&N(l.$id)?l.$id:a;o[Vn(a)?LD(c,i):a]=l}t.$defs=o}let r=new Map,n=(i,o)=>{let{$id:a}=i;if(N(a)&&Vn(a)&&!r.has(a))r.set(a,o);for(let[l,c]of Lv(i,o))n(l,c)};n(t,"#");let s=(i,o)=>{let a=o,{$id:l}=i;if(N(l)&&Vn(l)){if(a=r.get(l)??o,a!=="#")delete i.$id}let c=i.$ref;if(N(c)){let d=c.indexOf("#"),p=d===-1?c:c.slice(0,d),h=d===-1?"":c.slice(d+1);if(p===""){if(h.startsWith("/"))i.$ref=`${a}${h}`}else{let m=r.get(p);if(m!==void 0)i.$ref=h?`${m}${h}`:m}}for(let[d]of Lv(i,a))s(d,a)};return s(t,"#"),t}function Xd(e,t){if(Array.isArray(e)){for(let n of e)Xd(n,t);return}if(!ee(e))return;let r=e;if(N(r.$id)&&Vn(r.$id))t.add(r.$id);for(let n of Object.values(r))Xd(n,t)}function Vn(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function Ao(e){let t=e.replaceAll("\\","/"),r=t.startsWith("/"),n=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(n.length>0&&n.at(-1)!=="..")n.pop();else if(!r)n.push("..");continue}n.push(s)}return(r?"/":"")+n.join("/")}function FD(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function qD(e){return e instanceof Error?e.message:String(e)}function HD(e){let{corePath:t,pathsValueRefs:r}=e;return{$comment:qv,$defs:{PathsValue:{$id:Es,anyOf:[...Ro,...r.map((n)=>({$ref:n}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function Hv(e){let{baseDir:t,coreDocumentRef:r,coreProjectRef:n,extensions:s,loadJson:i}=e,o=[],a=[],l=[],c=[];for(let h of s){if(h.project)o.push(h.project);if(h.document){let m=await Fv(h.document,i,t);if(a.push(...m),m.length>0)l.push(h.document)}if(h.fields)c.push(...await Fv(h.fields,i,t)),o.push(h.fields)}let d=ND({corePath:n,fieldSchemaRefs:c,fragments:o}),p=HD({corePath:r,pathsValueRefs:a});return{document:Co(await Oo(p,i,t,l)),project:Co(await Oo(d,i,t))}}async function Fv(e,t,r){let n;try{n=await t(Ao(`${Ao(r)}/${e}`))}catch{return[]}let{$id:s}=n;if(!N(s)||!n.$defs)return[];return Object.keys(n.$defs).map((i)=>`${s}#/$defs/${i}`)}var Dv="https://jxsuite.com/schema/project/core/v2",qv="Generated by `jx schema` from project.json#/extensions — do not edit.",ID,MD,JD;var Vv=q(()=>{Al();ve();Al();ID=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],MD=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],JD=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as Uv,readFileSync as VD,statSync as Wv,writeFileSync as Ol}from"node:fs";import{createRequire as No}from"node:module";import{dirname as WD,isAbsolute as BD,relative as Qd,resolve as Ur,sep as ef}from"node:path";async function zv(e){let{config:t}=kn(e),r=await jn(e,t),n=Ur(e),{document:s,project:i}=await Hv({baseDir:n,coreDocumentRef:Bv(e,zD),coreProjectRef:Bv(e,UD),extensions:r.extensions.map((o)=>({document:o.schemas.document&&Zd(e,o,o.schemas.document),fields:o.schemas.fields&&Zd(e,o,o.schemas.fields),project:o.schemas.project&&Zd(e,o,o.schemas.project)})),loadJson:Yv(n)});return{documentSchema:s,projectSchema:i}}async function Gv(e){let{documentSchema:t,projectSchema:r}=await zv(e),n=Ur(e,"project.schema.json"),s=Ur(e,"document.schema.json");return Ol(n,`${JSON.stringify(r,null,2)}
|
|
552
|
-
`,"utf8"),
|
|
553
|
-
`,"utf8"),{documentSchemaPath:s,projectSchemaPath:n}}async function
|
|
554
|
-
`,"utf8"),
|
|
555
|
-
`,"utf8");let d=
|
|
556
|
-
`);return
|
|
548
|
+
Sitemap: ${An("/sitemap.xml",t)}
|
|
549
|
+
`,hr(r,s,"utf8"),n?0:1}var bv='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',qd,jD="http://www.w3.org/1999/xhtml";var jv=q(()=>{ve();rr();nr();Cm();zc();Hi();yg();Rg();nn();Og();Tg();qg();Bg();Gg();Yg();ey();xy();lo();Bu();Mr();Us();vy();ev();Ou();iv();Pu();uv();ku();yv();Cd();qd=new Map([["301",{canonical:!0,html:!0,why:""}],["302",{canonical:!1,html:!0,why:""}],["303",{canonical:!1,html:!0,why:""}],["307",{canonical:!1,html:!1,why:"307 preserves the request method and body; a meta-refresh silently converts POST to GET"}],["308",{canonical:!1,html:!1,why:"308 preserves the request method and body; a meta-refresh silently converts POST to GET"}]])});import{createRequire as AD}from"node:module";import{join as OD}from"node:path";import{spawn as CD}from"node:child_process";function ND(e){try{return AD(OD(e,"package.json")).resolve("@jxsuite/server/dev")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function kv(e,t,r=CD,n=process){let i=[ND(e),"--root",e];if(t!==void 0)i.push("--port",String(t));let o=r("bun",i,{stdio:"inherit"});return o.on("error",(a)=>{if(a.code==="ENOENT")console.error("The Jx dev server runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.");else console.error(`Failed to start the dev server: ${a.message}`);n.exitCode=1}),n.on("SIGINT",()=>{o.kill("SIGINT")}),n.on("SIGTERM",()=>{o.kill("SIGTERM")}),o.on("exit",(a)=>{n.exitCode=a??0}),o}var Rv=()=>{};import{createServer as TD}from"node:http";import{existsSync as jl,readFileSync as Av,statSync as ID}from"node:fs";import{extname as MD,join as Ud,normalize as JD,resolve as Ov,sep as DD}from"node:path";function FD(e,t){let r=JD(t).replaceAll("\\","/"),n=Ov(e,`.${r.startsWith("/")?r:`/${r}`}`);if(n!==e&&!n.startsWith(e+DD))return null;if(jl(n)){if(ID(n).isDirectory()){let i=Ud(n,"index.html");return jl(i)?i:null}return n}let s=Ud(n,"index.html");return jl(s)?s:null}function Cv(e,t){let r=Ov(e),n=TD((s,i)=>{let o=new URL(s.url??"/","http://localhost"),a=FD(r,decodeURIComponent(o.pathname));if(a){i.writeHead(200,{"Content-Type":LD.get(MD(a).toLowerCase())??"application/octet-stream"}),i.end(Av(a));return}let l=Ud(r,"404.html");if(jl(l)){i.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),i.end(Av(l));return}i.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),i.end("Not found")});return n.listen(t),n}var LD;var Nv=q(()=>{jc();LD=new Map(Object.entries({".avif":"image/avif",".css":"text/css; charset=utf-8",".gif":"image/gif",".html":"text/html; charset=utf-8",".ico":"image/x-icon",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".svg":"image/svg+xml",".txt":"text/plain; charset=utf-8",".webp":"image/webp",".woff2":"font/woff2",".xml":"application/xml; charset=utf-8",...pm}))});var _o="https://jxsuite.com/schema/project/fields/v2",Es="https://jxsuite.com/schema/document/paths/v2",Tv,Iv,Po,zd;var kl=q(()=>{Tv={description:"A single field definition inside a section entry schema — a small, recursive subset of "+"JSON Schema. Recursive positions reference the effective field union via the well-known fields resource $id.",properties:{default:{},description:{type:"string"},enum:{type:"array"},format:{type:"string"},items:{$ref:"https://jxsuite.com/schema/project/fields/v2"},properties:{additionalProperties:{$ref:"https://jxsuite.com/schema/project/fields/v2"},type:"object"},required:{items:{type:"string"},type:"array"},type:{enum:["string","number","integer","boolean","array","object"],type:"string"}},required:["type"],type:"object"},Iv={description:`Relationship reference field: points at a named entry of a referenceable section via "#/<sectionKey>/<name>" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.`,properties:{$ref:{pattern:"^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",type:"string"},description:{type:"string"}},required:["$ref"],type:"object"},Po=[{additionalProperties:!1,description:'Explicit value list: generates one page per value, bound to `param` (default "value").',properties:{param:{description:'Route parameter to fill (default "value").',type:"string"},values:{description:"The values to expand.",type:"array"}},required:["values"],type:"object"},{additionalProperties:!1,description:"JSON data-file source: loads a project-relative file that must contain an array, and generates one page per item.",properties:{$ref:{description:"Project-relative path to a .json file containing an array.",type:"string"},field:{description:'Item field providing the parameter value (default "id").',type:"string"},param:{description:'Route parameter to fill (default "id").',type:"string"}},required:["$ref"],type:"object"},{description:"Legacy explicit form: an array of ready-made parameter objects, used as-is with no expansion. Prefer one of the source shapes above.",items:{additionalProperties:{type:"string"},type:"object"},type:"array"}],zd={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});function qD(e){let{corePath:t,fragments:r,fieldSchemaRefs:n=[]}=e;return{$comment:Lv,$defs:{Fields:{$id:_o,anyOf:[{$ref:`${Mv}#/$defs/JxFieldSchema`},{$ref:`${Mv}#/$defs/RelationshipRef`},...n.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...r.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function ko(e,t,r,n=[]){let s=structuredClone(e),i=new Map,o=new Set;Gd(s,o);let a=0,l=async(d)=>{let p=jo(d),h=i.get(p);if(h!==void 0)return h;let m;try{m=structuredClone(await t(p))}catch(v){throw Error(`bundleSchema: cannot load $ref target "${p}": ${GD(v)}`,{cause:v})}let b=T(m.$id)&&Bn(m.$id)?m.$id:null;a+=b===null?1:0;let g=b??`urn:jx:bundled:${a}`;if(i.set(p,g),o.has(g))return g;o.add(g),m.$id=g,await c(m,zD(p),!0);let y=s.$defs??={};return y[g]=m,g},c=async(d,p,h=!1)=>{if(Array.isArray(d)){for(let y of d)await c(y,p);return}if(!ee(d))return;let m=d,b=p;if(!h&&T(m.$id)&&Bn(m.$id))b=null;let g=m.$ref;if(T(g)&&b!==null&&!g.startsWith("#")&&!Bn(g)){let y=g.indexOf("#"),v=y===-1?g:g.slice(0,y),j=y===-1?"":g.slice(y);if(v){let S=await l(`${b}/${v}`);m.$ref=`${S}${j}`}}for(let y of Object.values(m))await c(y,b)};await c(s,jo(r),!0);for(let d of n)await l(`${jo(r)}/${d}`);return s}function WD(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*Jv(e,t){for(let r of HD){let n=e[r];if(Array.isArray(n)){for(let[s,i]of n.entries())if(ee(i))yield[i,`${t}/${r}/${s}`]}else if(ee(n))yield[n,`${t}/${r}`]}for(let r of VD){let n=e[r];if(!ee(n))continue;for(let[s,i]of Object.entries(n))if(ee(i))yield[i,`${t}/${r}/${WD(s)}`]}for(let r of BD){let n=e[r];if(!Array.isArray(n))continue;for(let[s,i]of n.entries())if(ee(i))yield[i,`${t}/${r}/${s}`]}}function UD(e,t){let r=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(r.startsWith("//")){let i=r.indexOf("/",2);r=i===-1?"":r.slice(i+1)}r=r.replace(/^schema\//,"");let n=r.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=n;for(let i=2;t.has(s);i+=1)s=`${n}-${i}`;return t.add(s),s}function Ro(e){let t=structuredClone(e);if(ee(t.$defs)){let i=new Set(Object.keys(t.$defs).filter((a)=>!Bn(a))),o={};for(let[a,l]of Object.entries(t.$defs)){let c=ee(l)&&T(l.$id)?l.$id:a;o[Bn(a)?UD(c,i):a]=l}t.$defs=o}let r=new Map,n=(i,o)=>{let{$id:a}=i;if(T(a)&&Bn(a)&&!r.has(a))r.set(a,o);for(let[l,c]of Jv(i,o))n(l,c)};n(t,"#");let s=(i,o)=>{let a=o,{$id:l}=i;if(T(l)&&Bn(l)){if(a=r.get(l)??o,a!=="#")delete i.$id}let c=i.$ref;if(T(c)){let d=c.indexOf("#"),p=d===-1?c:c.slice(0,d),h=d===-1?"":c.slice(d+1);if(p===""){if(h.startsWith("/"))i.$ref=`${a}${h}`}else{let m=r.get(p);if(m!==void 0)i.$ref=h?`${m}${h}`:m}}for(let[d]of Jv(i,a))s(d,a)};return s(t,"#"),t}function Gd(e,t){if(Array.isArray(e)){for(let n of e)Gd(n,t);return}if(!ee(e))return;let r=e;if(T(r.$id)&&Bn(r.$id))t.add(r.$id);for(let n of Object.values(r))Gd(n,t)}function Bn(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function jo(e){let t=e.replaceAll("\\","/"),r=t.startsWith("/"),n=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(n.length>0&&n.at(-1)!=="..")n.pop();else if(!r)n.push("..");continue}n.push(s)}return(r?"/":"")+n.join("/")}function zD(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function GD(e){return e instanceof Error?e.message:String(e)}function KD(e){let{corePath:t,pathsValueRefs:r}=e;return{$comment:Lv,$defs:{PathsValue:{$id:Es,anyOf:[...Po,...r.map((n)=>({$ref:n}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function Fv(e){let{baseDir:t,coreDocumentRef:r,coreProjectRef:n,extensions:s,loadJson:i}=e,o=[],a=[],l=[],c=[];for(let h of s){if(h.project)o.push(h.project);if(h.document){let m=await Dv(h.document,i,t);if(a.push(...m),m.length>0)l.push(h.document)}if(h.fields)c.push(...await Dv(h.fields,i,t)),o.push(h.fields)}let d=qD({corePath:n,fieldSchemaRefs:c,fragments:o}),p=KD({corePath:r,pathsValueRefs:a});return{document:Ro(await ko(p,i,t,l)),project:Ro(await ko(d,i,t))}}async function Dv(e,t,r){let n;try{n=await t(jo(`${jo(r)}/${e}`))}catch{return[]}let{$id:s}=n;if(!T(s)||!n.$defs)return[];return Object.keys(n.$defs).map((i)=>`${s}#/$defs/${i}`)}var Mv="https://jxsuite.com/schema/project/core/v2",Lv="Generated by `jx schema` from project.json#/extensions — do not edit.",HD,VD,BD;var qv=q(()=>{kl();ve();kl();HD=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],VD=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],BD=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as Bv,readFileSync as YD,statSync as Hv,writeFileSync as Rl}from"node:fs";import{createRequire as Yd}from"node:module";import{dirname as XD,isAbsolute as ZD,relative as Xd,resolve as $n,sep as Zd}from"node:path";async function Wv(e){let{config:t}=Rn(e),r=await kn(e,t),n=$n(e),{document:s,project:i}=await Fv({baseDir:n,coreDocumentRef:Vv(e,eL),coreProjectRef:Vv(e,QD),extensions:r.extensions.map((o)=>({document:o.schemas.document&&Kd(e,o,o.schemas.document),fields:o.schemas.fields&&Kd(e,o,o.schemas.fields),project:o.schemas.project&&Kd(e,o,o.schemas.project)})),loadJson:Gv(n)});return{documentSchema:s,projectSchema:i}}async function Uv(e){let{documentSchema:t,projectSchema:r}=await Wv(e),n=$n(e,"project.schema.json"),s=$n(e,"document.schema.json");return Rl(n,`${JSON.stringify(r,null,2)}
|
|
550
|
+
`,"utf8"),Rl(s,`${JSON.stringify(t,null,2)}
|
|
551
|
+
`,"utf8"),{documentSchemaPath:s,projectSchemaPath:n}}async function zv(e,t={}){let{write:r=!0}=t,n=$n(e),s=$n(n,"project.json"),i=$n(n,"project.schema.json"),o=$n(n,"document.schema.json"),a=(g)=>{if(!Bv(g))return!0;try{return Hv(s).mtimeMs>Hv(g).mtimeMs}catch{return!1}},c=a(i)||a(o)?await Wv(n):null;if(c&&r)Rl(i,`${JSON.stringify(c.projectSchema,null,2)}
|
|
552
|
+
`,"utf8"),Rl(o,`${JSON.stringify(c.documentSchema,null,2)}
|
|
553
|
+
`,"utf8");let d=Gv(n),p=c?.projectSchema??Ao(i),h=c?.documentSchema??Ao(o),m=Ro(await ko(p,d,n));return{document:Ro(await ko(h,d,n)),project:m}}function Ao(e){let t=JSON.parse(YD(e,"utf8"));if(!ee(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function rL(e){return e.startsWith(tL)&&e.endsWith(".json")}function nL(e,t){try{return Yd(import.meta.url).resolve(e)}catch(r){throw Error(`Schema ref "${t}" names the core schema "${e}", which must resolve from the host workspace and does not. The project's own copy is deliberately not consulted, so the host install is missing "${e.split("/").slice(0,2).join("/")}" — check that `+"the package ships with this build",{cause:r})}}function Gv(e){return async(t)=>{let r=$n(t),n=Xd(e,r);if(n.startsWith("..")||ZD(n))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=n.split(Zd).join("/"),i="node_modules/",o=s.lastIndexOf(i),a=o===-1?null:s.slice(o+i.length);if(a!==null&&rL(a))return Ao(nL(a,t));if(Bv(r))return Ao(r);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=Cc(e,a)}catch(c){throw Error(`Schema ref "${t}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:c})}return Ao(l)}}function Vv(e,t){let r=null;try{r=Yd($n(e,"package.json")).resolve(t)}catch{try{r=Yd(import.meta.url).resolve(t)}catch{r=null}}let n=`./node_modules/${t}`;return r?Kv(e,r,n):n}function Kd(e,t,r){let n=Xd(XD(t.manifestPath),r).split(Zd).join("/"),s=`./node_modules/${t.specifier}/${n}`;return Kv(e,r,s)}function Kv(e,t,r){let n=Xd(e,t).split(Zd).join("/");if(n.startsWith(".."))return r;return n.startsWith("./")?n:`./${n}`}var QD="@jxsuite/schema/schemas/project.core.schema.json",eL="@jxsuite/schema/schema.json",tL="@jxsuite/schema/";var Qd=q(()=>{qv();ve();nn();Hi()});var Qv=C(function(BY,Zv){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",Yv=Ne("fs").promises,Xv=Ne("path");async function sL({folder:e=__dirname}={}){let t={},r=await Yv.readdir(e);for(let n of r)if(n.endsWith(".json")&&n!=="package.json"){let s=await Yv.readFile(Xv.join(e,n),"utf8");t[Xv.basename(n,".json")]=JSON.parse(s)}return t}Zv.exports={listAll:sL}});var rw=C(function(WY,tw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",iL=Ne("fs").promises,oL=Ne("path");async function ew({folder:e=__dirname}={}){let t=await iL.readFile(oL.join(e,"css.json"),"utf8");return JSON.parse(t)}async function aL({folder:e=__dirname}={}){let t=await ew(e),r={};for(let[n,s]of Object.entries(t)){r[n]={};for(let i of s){let o=i.name,a=null;if(i.for)a=s.find((l)=>l!==i&&l.name===i.name);if(a)o+=" for "+i.for[0];if(r[n][o]=i,i.descriptors){let l=i.descriptors;i.descriptors={};for(let c of l)i.descriptors[c.name]=c}}}return r}tw.exports={listAll:ew,index:aL}});var nw=C(function(Al,ef){(function(e,t){typeof Al=="object"&&typeof ef=="object"?ef.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Al=="object"?Al.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,x)=>{for(var w in x)e.o(x,w)&&!e.o(f,w)&&Object.defineProperty(f,w,{enumerable:!0,get:x[w]})},o:(f,x)=>Object.prototype.hasOwnProperty.call(f,x),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function r(f,x,w,_,A,{level:B="error",autofix:Y,ruleName:de}={}){function ce(Qt){return Qt>0?f.slice(x,x+Qt):f.slice(Math.max(x+Qt,0),x)}function ge(Qt,{precedes:rs}={}){let en=Qt.map((Li)=>Li.trivia+Li.value).join(""),Di=f[x];return Di.type==="eof"?en:rs?en+Di.trivia:en.slice(Di.trivia.length)}let _e=f[x].type!=="eof"?f[x].line:f.length>1?f[x-1].line:1,Ae=function(Qt){let rs=Qt.split(`
|
|
554
|
+
`);return rs[rs.length-1]}(ge(ce(-5),{precedes:!0})),jt=ce(5),Dt=ge(jt),Ji=Ae+Dt.split(`
|
|
557
555
|
`)[0]+`
|
|
558
|
-
`+(" ".repeat(Ae.length)+"^"),
|
|
559
|
-
${Ji}`;return{message:`${Wp} ${_}`,bareMessage:_,context:Wp,line:_e,sourceName:f.name,level:W,ruleName:de,autofix:Y,input:Lt,tokens:jt}}function n(f,x,w,_){return r(f,x,w,_,"Syntax")}function s(f,x,w,_,A={}){return A.ruleName=w,r(x.source,f.index,x,_,"Validation",A)}e.r(t),e.d(t,{WebIDLParseError:()=>Ue,parse:()=>Or,validate:()=>Zt,write:()=>xt});class i{constructor({source:f,tokens:x}){Object.defineProperties(this,{source:{value:f},tokens:{value:x,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},x=this;for(;x!==Object.prototype;){let w=Object.getOwnPropertyDescriptors(x);for(let[_,A]of Object.entries(w))(A.enumerable||A.get)&&(f[_]=this[_]);x=Object.getPrototypeOf(x)}return f}}function o(f,x,{useNullableInner:w}={}){if(!f.union){let _=x.unique.get(f.idlType);if(!_)return;if(_.type==="typedef"){let{typedefIncludesDictionary:A}=x.cache;if(A.has(_))return A.get(_);x.cache.typedefIncludesDictionary.set(_,void 0);let W=o(_.idlType,x);if(x.cache.typedefIncludesDictionary.set(_,W),W)return{reference:f,dictionary:W.dictionary}}if(_.type==="dictionary"&&(w||!f.nullable))return{reference:f,dictionary:_}}for(let _ of f.subtype){let A=o(_,x);if(A)return _.union?A:{reference:_,dictionary:A.dictionary}}}function a(f,x){if(x.cache.dictionaryIncludesRequiredField.has(f))return x.cache.dictionaryIncludesRequiredField.get(f);x.cache.dictionaryIncludesRequiredField.set(f,void 0);let w=f.members.some((_)=>_.required);if(!w&&f.inheritance){let _=x.unique.get(f.inheritance);_?a(_,x)&&(w=!0):w=!0}return x.cache.dictionaryIncludesRequiredField.set(f,w),w}class l extends Array{constructor({source:f,tokens:x}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:x},parent:{value:null,writable:!0}})}}class c extends i{static parser(f,x){return()=>{let w=f.consumeKind(x);if(w)return new c({source:f.source,tokens:{value:w}})}}get value(){return M(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class d extends c{static parse(f){let x=f.consumeKind("eof");if(x)return new d({source:f.source,tokens:{value:x}})}get type(){return"eof"}}function p(f,x){return L(f,{parser:c.parser(f,x),listName:x+" list"})}let h=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function b(f){for(let x of h){let w=p(f,x);if(w.length)return w}f.error("Expected identifiers, strings, decimals, or integers but none found")}class g extends i{static parse(f){let x={assign:f.consume("=")},w=te(new g({source:f.source,tokens:x}));if(w.list=[],x.assign){if(x.asterisk=f.consume("*"),x.asterisk)return w.this;x.secondaryName=f.consumeKind(...h)}return x.open=f.consume("("),x.open?(w.list=w.rhsIsList?b(f):oe(f),x.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):x.assign&&!x.secondaryName&&f.error("No right hand side to extended attribute assignment"),w.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:x}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((w)=>x==="identifier-list"?f.identifier(w,this.parent):w.write(f)),f.token(this.tokens.close)])}}class y extends i{static parse(f){let x=f.consumeKind("identifier");if(x)return new y({source:f.source,tokens:{name:x},params:g.parse(f)})}constructor({source:f,tokens:x,params:w}){super({source:f,tokens:x}),w.parent=this,Object.defineProperty(this,"params",{value:w})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:x,list:w}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?w:this.params.tokens.secondaryName?M(x.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:x}=this.params;return!x||f?[]:x}*validate(f){let{name:x}=this;if(x==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(x)){let _=`\`[${x}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(x)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",_,{level:"warning",autofix:(w=this,()=>{let{name:A}=w;w.tokens.name.value=m.get(A),A==="TreatNullAs"&&(w.params.tokens={})})})}var w;for(let _ of this.arguments)yield*_.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class v extends l{static parse(f){let x={};x.open=f.consume("[");let w=new v({source:f.source,tokens:x});return x.open?(w.push(...L(f,{parser:y.parse,listName:"extended attribute"})),x.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),w.length||(f.unconsume(x.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),w):w}*validate(f){for(let x of this)yield*x.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((x)=>x.write(f)),f.token(this.tokens.close)]):""}}function j(f,x){let w=f.consume("?");w&&(x.tokens.nullable=w),f.probe("?")&&f.error("Can't nullable more than once")}function S(f,x){let w=function(_,A){let W=_.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!W)return;let Y=te(new P({source:_.source,tokens:{base:W}}));switch(Y.tokens.open=_.consume("<")||_.error(`No opening bracket after ${W.value}`),W.value){case"Promise":{_.probe("[")&&_.error("Promise type cannot have extended attribute");let de=ae(_,A)||_.error("Missing Promise subtype");Y.subtype.push(de);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let de=Q(_,A)||_.error(`Missing ${W.value} subtype`);Y.subtype.push(de);break}case"record":{_.probe("[")&&_.error("Record key cannot have extended attribute");let de=_.consume(...We)||_.error(`Record key must be one of: ${We.join(", ")}`),ce=new P({source:_.source,tokens:{base:de}});ce.tokens.separator=_.consume(",")||_.error("Missing comma after record key type"),ce.type=A;let ge=Q(_,A)||_.error("Error parsing generic type record");Y.subtype.push(ce,ge);break}}return Y.idlType||_.error(`Error parsing generic type ${W.value}`),Y.tokens.close=_.consume(">")||_.error(`Missing closing bracket after ${W.value}`),Y.this}(f,x)||ue(f);if(!w){let _=f.consumeKind("identifier")||f.consume(...We,...fe);if(!_)return;w=new P({source:f.source,tokens:{base:_}}),f.probe("<")&&f.error(`Unsupported generic type ${_.value}`)}return w.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),w.type=x||null,j(f,w),w.nullable&&w.idlType==="any"&&f.error("Type `any` cannot be made nullable"),w}class P extends i{static parse(f,x){return S(f,x)||function(w,_){let A={};if(A.open=w.consume("("),!A.open)return;let W=te(new P({source:w.source,tokens:A}));for(W.type=_||null;;){let Y=Q(w,_)||w.error("No type after open parenthesis or 'or' in union type");Y.idlType==="any"&&w.error("Type `any` cannot be included in a union type"),Y.generic==="Promise"&&w.error("Type `Promise` cannot be included in a union type"),W.subtype.push(Y);let de=w.consume("or");if(!de)break;Y.tokens.separator=de}return W.idlType.length<2&&w.error("At least two types are expected in a union type but found less"),A.close=w.consume(")")||w.error("Unterminated union type"),j(w,W),W.this}(f,x)}constructor({source:f,tokens:x}){super({source:f,tokens:x}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new v({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return M([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let A of[this.extAttrs,this.parent?.extAttrs])for(let W of A){if(W.name!=="AllowShared")continue;let Y="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",Y,{autofix:E(this,W,A)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(x=this,()=>{x.tokens.base.value="undefined"})});var x;let w=!this.union&&f.unique.get(this.idlType),_=this.union?this:w&&w.type==="typedef"?w.idlType:void 0;if(_&&this.nullable){let{reference:A}=o(_,f)||{};if(A){let W=(this.union?A:this).tokens.base;yield s(W,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let A of this.subtype)yield*A.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((A)=>A.write(f)),f.token(this.tokens.close)]);let x=this.tokens.prefix||this.tokens.base,w=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],_=f.reference(f.ts.wrap([...w,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(x.trivia),_])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function E(f,x,w){return()=>{let _=w.indexOf(x);w.splice(_,1),!w.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class O extends i{static parse(f){let x=f.consume("=");if(!x)return null;let w=B(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),_=[w];if(w.value==="["){let A=f.consume("]")||f.error("Default sequence value must be empty");_.push(A)}else if(w.value==="{"){let A=f.consume("}")||f.error("Default dictionary value must be empty");_.push(A)}return new O({source:f.source,tokens:{assign:x},expression:_})}constructor({source:f,tokens:x,expression:w}){super({source:f,tokens:x}),w.parent=this,Object.defineProperty(this,"expression",{value:w})}get type(){return se(this.expression[0]).type}get value(){return se(this.expression[0]).value}get negative(){return se(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((x)=>f.token(x))])}}class R extends i{static parse(f){let x=f.position,w={},_=te(new R({source:f.source,tokens:w}));return _.extAttrs=v.parse(f),w.optional=f.consume("optional"),_.idlType=Q(f,"argument-type"),_.idlType?(w.optional||(w.variadic=f.consume("...")),w.name=f.consumeKind("identifier")||f.consume(...G),w.name?(_.default=w.optional?O.parse(f):null,_.this):f.unconsume(x)):f.unconsume(x)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let x=o(this.idlType,f,{useNullableInner:!0});if(x){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:k(this)})}else if(this.parent&&!a(x.dictionary,f)&&function(_){let A=_.parent.arguments||_.parent.list,W=A.indexOf(_);return!A.slice(W+1).some((de)=>!de.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(w=this,()=>{let A=z(w.idlType);w.tokens.optional={...A,type:"optional",value:"optional"},A.trivia=" ",k(w)()})})}var w}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function k(f){return()=>{f.default=O.parse(new ut(" = {}"))}}class I extends i{static parse(f,{special:x,regular:w}={}){let _={special:x},A=te(new I({source:f.source,tokens:_}));return x&&x.value==="stringifier"&&(_.termination=f.consume(";"),_.termination)?(A.arguments=[],A):(x||w||(_.special=f.consume("getter","setter","deleter")),A.idlType=ae(f)||f.error("Missing return type"),_.name=f.consumeKind("identifier")||f.consume("includes"),_.open=f.consume("(")||f.error("Invalid operation"),A.arguments=oe(f),_.close=f.consume(")")||f.error("Unterminated operation"),_.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),A.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?M(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let x of this.arguments)yield*x.validate(f)}write(f){let{parent:x}=this,w=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((_)=>_.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:x}),...w,f.token(this.tokens.termination)]),{data:this,parent:x})}}class D extends i{static parse(f,{special:x,noInherit:w=!1,readonly:_=!1}={}){let A=f.position,W={special:x},Y=te(new D({source:f.source,tokens:W}));if(x||w||(W.special=f.consume("inherit")),Y.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),W.readonly=f.consume("readonly"),_&&!W.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),W.base=f.consume("attribute"),W.base)return Y.idlType=Q(f,"attribute-type")||f.error("Attribute lacks a type"),W.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),W.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),Y.this;f.unconsume(A)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return M(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let x=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",x)}{let{reference:x}=o(this.idlType,f)||{};if(x){let w=(this.idlType.union?x:this.idlType).tokens.base;yield s(w,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(x,w){if(x.union)return!1;if(x.extAttrs.some((A)=>A.name==="EnforceRange"))return!0;let _=w.unique.get(x.idlType);return _?.type==="typedef"&&_.idlType.extAttrs.some((A)=>A.name==="EnforceRange")}(this.idlType,f)){let x=this.idlType.tokens.base;yield s(x,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),f.token(this.tokens.termination)]),{data:this,parent:x})}}function M(f){return f.startsWith("_")?f.slice(1):f}function L(f,{parser:x,allowDangler:w,listName:_="list"}){let A=x(f);if(!A)return[];A.tokens.separator=f.consume(",");let W=[A];for(;A.tokens.separator;){let Y=x(f);if(!Y){w||f.error(`Trailing comma in ${_}`);break}if(Y.tokens.separator=f.consume(","),W.push(Y),!Y.tokens.separator)break}return W}function B(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function se({type:f,value:x}){switch(f){case"decimal":case"integer":return{type:"number",value:x};case"string":return{type:"string",value:x.slice(1,-1)}}switch(x){case"true":case"false":return{type:"boolean",value:x==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:x.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:x}}}function ue(f){let{source:x}=f,w=function(){let A=f.consume("unsigned"),W=f.consume("short","long");if(W){let Y=f.consume("long");return new P({source:x,tokens:{prefix:A,base:W,postfix:Y}})}A&&f.error("Failed to parse integer type")}()||function(){let A=f.consume("unrestricted"),W=f.consume("float","double");if(W)return new P({source:x,tokens:{prefix:A,base:W}});A&&f.error("Failed to parse float type")}();if(w)return w;let _=f.consume("bigint","boolean","byte","octet","undefined");return _?new P({source:x,tokens:{base:_}}):void 0}function oe(f){return L(f,{parser:R.parse,listName:"arguments list"})}function Q(f,x){let w=v.parse(f),_=P.parse(f,x);return _&&(te(_).extAttrs=w),_}function ae(f,x){let w=P.parse(f,x||"return-type");if(w)return w;let _=f.consume("void");if(_){let A=new P({source:f.source,tokens:{base:_}});return A.type="return-type",A}}function ke(f){let x=f.consume("stringifier");if(!x)return;return D.parse(f,{special:x})||I.parse(f,{special:x})||f.error("Unterminated stringifier")}function U(f){let x=f.split(`
|
|
556
|
+
`+(" ".repeat(Ae.length)+"^"),Ec=A==="Syntax"?"since":"inside",Hp=`${A} error at line ${_e}${f.name?` in ${f.name}`:""}${w&&w.name?`, ${Ec} \`${w.partial?"partial ":""}${function(Qt){let rs=[Qt];for(;Qt&&Qt.parent;){let{parent:en}=Qt;rs.unshift(en),Qt=en}return rs.map((en)=>function(Di,Li){let Vp=Di;return Li&&(Vp+=` ${Li}`),Vp}(en.type,en.name)).join(" -> ")}(w)}\``:""}:
|
|
557
|
+
${Ji}`;return{message:`${Hp} ${_}`,bareMessage:_,context:Hp,line:_e,sourceName:f.name,level:B,ruleName:de,autofix:Y,input:Dt,tokens:jt}}function n(f,x,w,_){return r(f,x,w,_,"Syntax")}function s(f,x,w,_,A={}){return A.ruleName=w,r(x.source,f.index,x,_,"Validation",A)}e.r(t),e.d(t,{WebIDLParseError:()=>Ue,parse:()=>Or,validate:()=>Zt,write:()=>xt});class i{constructor({source:f,tokens:x}){Object.defineProperties(this,{source:{value:f},tokens:{value:x,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},x=this;for(;x!==Object.prototype;){let w=Object.getOwnPropertyDescriptors(x);for(let[_,A]of Object.entries(w))(A.enumerable||A.get)&&(f[_]=this[_]);x=Object.getPrototypeOf(x)}return f}}function o(f,x,{useNullableInner:w}={}){if(!f.union){let _=x.unique.get(f.idlType);if(!_)return;if(_.type==="typedef"){let{typedefIncludesDictionary:A}=x.cache;if(A.has(_))return A.get(_);x.cache.typedefIncludesDictionary.set(_,void 0);let B=o(_.idlType,x);if(x.cache.typedefIncludesDictionary.set(_,B),B)return{reference:f,dictionary:B.dictionary}}if(_.type==="dictionary"&&(w||!f.nullable))return{reference:f,dictionary:_}}for(let _ of f.subtype){let A=o(_,x);if(A)return _.union?A:{reference:_,dictionary:A.dictionary}}}function a(f,x){if(x.cache.dictionaryIncludesRequiredField.has(f))return x.cache.dictionaryIncludesRequiredField.get(f);x.cache.dictionaryIncludesRequiredField.set(f,void 0);let w=f.members.some((_)=>_.required);if(!w&&f.inheritance){let _=x.unique.get(f.inheritance);_?a(_,x)&&(w=!0):w=!0}return x.cache.dictionaryIncludesRequiredField.set(f,w),w}class l extends Array{constructor({source:f,tokens:x}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:x},parent:{value:null,writable:!0}})}}class c extends i{static parser(f,x){return()=>{let w=f.consumeKind(x);if(w)return new c({source:f.source,tokens:{value:w}})}}get value(){return M(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class d extends c{static parse(f){let x=f.consumeKind("eof");if(x)return new d({source:f.source,tokens:{value:x}})}get type(){return"eof"}}function p(f,x){return L(f,{parser:c.parser(f,x),listName:x+" list"})}let h=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function b(f){for(let x of h){let w=p(f,x);if(w.length)return w}f.error("Expected identifiers, strings, decimals, or integers but none found")}class g extends i{static parse(f){let x={assign:f.consume("=")},w=te(new g({source:f.source,tokens:x}));if(w.list=[],x.assign){if(x.asterisk=f.consume("*"),x.asterisk)return w.this;x.secondaryName=f.consumeKind(...h)}return x.open=f.consume("("),x.open?(w.list=w.rhsIsList?b(f):oe(f),x.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):x.assign&&!x.secondaryName&&f.error("No right hand side to extended attribute assignment"),w.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:x}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((w)=>x==="identifier-list"?f.identifier(w,this.parent):w.write(f)),f.token(this.tokens.close)])}}class y extends i{static parse(f){let x=f.consumeKind("identifier");if(x)return new y({source:f.source,tokens:{name:x},params:g.parse(f)})}constructor({source:f,tokens:x,params:w}){super({source:f,tokens:x}),w.parent=this,Object.defineProperty(this,"params",{value:w})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:x,list:w}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?w:this.params.tokens.secondaryName?M(x.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:x}=this.params;return!x||f?[]:x}*validate(f){let{name:x}=this;if(x==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(x)){let _=`\`[${x}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(x)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",_,{level:"warning",autofix:(w=this,()=>{let{name:A}=w;w.tokens.name.value=m.get(A),A==="TreatNullAs"&&(w.params.tokens={})})})}var w;for(let _ of this.arguments)yield*_.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class v extends l{static parse(f){let x={};x.open=f.consume("[");let w=new v({source:f.source,tokens:x});return x.open?(w.push(...L(f,{parser:y.parse,listName:"extended attribute"})),x.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),w.length||(f.unconsume(x.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),w):w}*validate(f){for(let x of this)yield*x.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((x)=>x.write(f)),f.token(this.tokens.close)]):""}}function j(f,x){let w=f.consume("?");w&&(x.tokens.nullable=w),f.probe("?")&&f.error("Can't nullable more than once")}function S(f,x){let w=function(_,A){let B=_.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!B)return;let Y=te(new P({source:_.source,tokens:{base:B}}));switch(Y.tokens.open=_.consume("<")||_.error(`No opening bracket after ${B.value}`),B.value){case"Promise":{_.probe("[")&&_.error("Promise type cannot have extended attribute");let de=ae(_,A)||_.error("Missing Promise subtype");Y.subtype.push(de);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let de=Q(_,A)||_.error(`Missing ${B.value} subtype`);Y.subtype.push(de);break}case"record":{_.probe("[")&&_.error("Record key cannot have extended attribute");let de=_.consume(...Be)||_.error(`Record key must be one of: ${Be.join(", ")}`),ce=new P({source:_.source,tokens:{base:de}});ce.tokens.separator=_.consume(",")||_.error("Missing comma after record key type"),ce.type=A;let ge=Q(_,A)||_.error("Error parsing generic type record");Y.subtype.push(ce,ge);break}}return Y.idlType||_.error(`Error parsing generic type ${B.value}`),Y.tokens.close=_.consume(">")||_.error(`Missing closing bracket after ${B.value}`),Y.this}(f,x)||ue(f);if(!w){let _=f.consumeKind("identifier")||f.consume(...Be,...fe);if(!_)return;w=new P({source:f.source,tokens:{base:_}}),f.probe("<")&&f.error(`Unsupported generic type ${_.value}`)}return w.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),w.type=x||null,j(f,w),w.nullable&&w.idlType==="any"&&f.error("Type `any` cannot be made nullable"),w}class P extends i{static parse(f,x){return S(f,x)||function(w,_){let A={};if(A.open=w.consume("("),!A.open)return;let B=te(new P({source:w.source,tokens:A}));for(B.type=_||null;;){let Y=Q(w,_)||w.error("No type after open parenthesis or 'or' in union type");Y.idlType==="any"&&w.error("Type `any` cannot be included in a union type"),Y.generic==="Promise"&&w.error("Type `Promise` cannot be included in a union type"),B.subtype.push(Y);let de=w.consume("or");if(!de)break;Y.tokens.separator=de}return B.idlType.length<2&&w.error("At least two types are expected in a union type but found less"),A.close=w.consume(")")||w.error("Unterminated union type"),j(w,B),B.this}(f,x)}constructor({source:f,tokens:x}){super({source:f,tokens:x}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new v({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return M([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let A of[this.extAttrs,this.parent?.extAttrs])for(let B of A){if(B.name!=="AllowShared")continue;let Y="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",Y,{autofix:E(this,B,A)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(x=this,()=>{x.tokens.base.value="undefined"})});var x;let w=!this.union&&f.unique.get(this.idlType),_=this.union?this:w&&w.type==="typedef"?w.idlType:void 0;if(_&&this.nullable){let{reference:A}=o(_,f)||{};if(A){let B=(this.union?A:this).tokens.base;yield s(B,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let A of this.subtype)yield*A.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((A)=>A.write(f)),f.token(this.tokens.close)]);let x=this.tokens.prefix||this.tokens.base,w=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],_=f.reference(f.ts.wrap([...w,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(x.trivia),_])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function E(f,x,w){return()=>{let _=w.indexOf(x);w.splice(_,1),!w.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class O extends i{static parse(f){let x=f.consume("=");if(!x)return null;let w=W(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),_=[w];if(w.value==="["){let A=f.consume("]")||f.error("Default sequence value must be empty");_.push(A)}else if(w.value==="{"){let A=f.consume("}")||f.error("Default dictionary value must be empty");_.push(A)}return new O({source:f.source,tokens:{assign:x},expression:_})}constructor({source:f,tokens:x,expression:w}){super({source:f,tokens:x}),w.parent=this,Object.defineProperty(this,"expression",{value:w})}get type(){return se(this.expression[0]).type}get value(){return se(this.expression[0]).value}get negative(){return se(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((x)=>f.token(x))])}}class R extends i{static parse(f){let x=f.position,w={},_=te(new R({source:f.source,tokens:w}));return _.extAttrs=v.parse(f),w.optional=f.consume("optional"),_.idlType=Q(f,"argument-type"),_.idlType?(w.optional||(w.variadic=f.consume("...")),w.name=f.consumeKind("identifier")||f.consume(...G),w.name?(_.default=w.optional?O.parse(f):null,_.this):f.unconsume(x)):f.unconsume(x)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let x=o(this.idlType,f,{useNullableInner:!0});if(x){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:k(this)})}else if(this.parent&&!a(x.dictionary,f)&&function(_){let A=_.parent.arguments||_.parent.list,B=A.indexOf(_);return!A.slice(B+1).some((de)=>!de.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(w=this,()=>{let A=z(w.idlType);w.tokens.optional={...A,type:"optional",value:"optional"},A.trivia=" ",k(w)()})})}var w}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function k(f){return()=>{f.default=O.parse(new ut(" = {}"))}}class I extends i{static parse(f,{special:x,regular:w}={}){let _={special:x},A=te(new I({source:f.source,tokens:_}));return x&&x.value==="stringifier"&&(_.termination=f.consume(";"),_.termination)?(A.arguments=[],A):(x||w||(_.special=f.consume("getter","setter","deleter")),A.idlType=ae(f)||f.error("Missing return type"),_.name=f.consumeKind("identifier")||f.consume("includes"),_.open=f.consume("(")||f.error("Invalid operation"),A.arguments=oe(f),_.close=f.consume(")")||f.error("Unterminated operation"),_.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),A.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?M(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let x of this.arguments)yield*x.validate(f)}write(f){let{parent:x}=this,w=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((_)=>_.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:x}),...w,f.token(this.tokens.termination)]),{data:this,parent:x})}}class D extends i{static parse(f,{special:x,noInherit:w=!1,readonly:_=!1}={}){let A=f.position,B={special:x},Y=te(new D({source:f.source,tokens:B}));if(x||w||(B.special=f.consume("inherit")),Y.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),B.readonly=f.consume("readonly"),_&&!B.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),B.base=f.consume("attribute"),B.base)return Y.idlType=Q(f,"attribute-type")||f.error("Attribute lacks a type"),B.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),B.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),Y.this;f.unconsume(A)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return M(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let x=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",x)}{let{reference:x}=o(this.idlType,f)||{};if(x){let w=(this.idlType.union?x:this.idlType).tokens.base;yield s(w,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(x,w){if(x.union)return!1;if(x.extAttrs.some((A)=>A.name==="EnforceRange"))return!0;let _=w.unique.get(x.idlType);return _?.type==="typedef"&&_.idlType.extAttrs.some((A)=>A.name==="EnforceRange")}(this.idlType,f)){let x=this.idlType.tokens.base;yield s(x,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),f.token(this.tokens.termination)]),{data:this,parent:x})}}function M(f){return f.startsWith("_")?f.slice(1):f}function L(f,{parser:x,allowDangler:w,listName:_="list"}){let A=x(f);if(!A)return[];A.tokens.separator=f.consume(",");let B=[A];for(;A.tokens.separator;){let Y=x(f);if(!Y){w||f.error(`Trailing comma in ${_}`);break}if(Y.tokens.separator=f.consume(","),B.push(Y),!Y.tokens.separator)break}return B}function W(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function se({type:f,value:x}){switch(f){case"decimal":case"integer":return{type:"number",value:x};case"string":return{type:"string",value:x.slice(1,-1)}}switch(x){case"true":case"false":return{type:"boolean",value:x==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:x.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:x}}}function ue(f){let{source:x}=f,w=function(){let A=f.consume("unsigned"),B=f.consume("short","long");if(B){let Y=f.consume("long");return new P({source:x,tokens:{prefix:A,base:B,postfix:Y}})}A&&f.error("Failed to parse integer type")}()||function(){let A=f.consume("unrestricted"),B=f.consume("float","double");if(B)return new P({source:x,tokens:{prefix:A,base:B}});A&&f.error("Failed to parse float type")}();if(w)return w;let _=f.consume("bigint","boolean","byte","octet","undefined");return _?new P({source:x,tokens:{base:_}}):void 0}function oe(f){return L(f,{parser:R.parse,listName:"arguments list"})}function Q(f,x){let w=v.parse(f),_=P.parse(f,x);return _&&(te(_).extAttrs=w),_}function ae(f,x){let w=P.parse(f,x||"return-type");if(w)return w;let _=f.consume("void");if(_){let A=new P({source:f.source,tokens:{base:_}});return A.type="return-type",A}}function ke(f){let x=f.consume("stringifier");if(!x)return;return D.parse(f,{special:x})||I.parse(f,{special:x})||f.error("Unterminated stringifier")}function U(f){let x=f.split(`
|
|
560
558
|
`);if(x.length){let w=x[x.length-1].match(/^\s+/);if(w)return w[0]}return""}function le(f){return()=>{if(f.extAttrs.length){let x=new ut("Exposed=Window,"),w=y.parse(x);w.tokens.separator=x.consume(",");let _=f.extAttrs[0];/^\s/.test(_.tokens.name.trivia)||(_.tokens.name.trivia=` ${_.tokens.name.trivia}`),f.extAttrs.unshift(w)}else{te(f).extAttrs=v.parse(new ut("[Exposed=Window]"));let x=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=x,f.tokens.base.trivia=`
|
|
561
|
-
${U(x)}`}}}function z(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return z(f.idlType);return Object.values(f.tokens).sort((x,w)=>x.index-w.index)[0]}function te(f,x){if(x||(x=f),!f)return f;return new Proxy(f,{get(w,_){let A=w[_];return Array.isArray(A)&&_!=="source"?te(A,w):A},set(w,_,A){if(w[_]=A,!A)return!0;if(Array.isArray(A))for(let W of A)W.parent!==void 0&&(W.parent=x);else A.parent!==void 0&&(A.parent=x);return!0}})}let Le={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},fe=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],We=["ByteString","DOMString","USVString"],G=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Be=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(G,We,fe),Xe=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],pt=["_constructor","toString","_toString"];class ut{constructor(f){this.source=function(x){let w=[],_=0,A="",W=1,Y=0;for(;_<x.length;){let ce=x.charAt(_),ge=-1;if(/[\t\n\r ]/.test(ce)?ge=de("whitespace",{noFlushTrivia:!0}):ce==="/"&&(ge=de("comment",{noFlushTrivia:!0})),ge!==-1){let _e=w.pop().value;W+=(_e.match(/\n/g)||[]).length,A+=_e,Y-=1}else if(/[-0-9.A-Z_a-z]/.test(ce)){if(ge=de("decimal"),ge===-1&&(ge=de("integer")),ge===-1){ge=de("identifier");let _e=w.length-1,Ae=w[_e];if(ge!==-1){if(pt.includes(Ae.value)){let jt=`${M(Ae.value)} is a reserved identifier and must not be used.`;throw new Ue(n(w,_e,null,jt))}Be.includes(Ae.value)&&(Ae.type="inline")}}}else ce==='"'&&(ge=de("string"));for(let _e of Xe)if(x.startsWith(_e,_)){w.push({type:"inline",value:_e,trivia:A,line:W,index:Y}),A="",_+=_e.length,ge=_;break}if(ge===-1&&(ge=de("other")),ge===-1)throw Error("Token stream not progressing");_=ge,Y+=1}return w.push({type:"eof",value:"",trivia:A,line:W,index:Y}),w;function de(ce,{noFlushTrivia:ge}={}){let _e=Le[ce];_e.lastIndex=_;let Ae=_e.exec(x);return Ae?(w.push({type:ce,value:Ae[0],trivia:A,line:W,index:Y}),ge||(A=""),_e.lastIndex):-1}}(f),this.position=0}error(f){throw new Ue(n(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let x of f){if(!this.probeKind(x))continue;let w=this.source[this.position];return this.position++,w}}consume(...f){if(!this.probeKind("inline"))return;let x=this.source[this.position];for(let w of f)if(x.value===w)return this.position++,x}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class Ue extends Error{constructor({message:f,bareMessage:x,context:w,line:_,sourceName:A,input:W,tokens:Y}){super(f),this.name="WebIDLParseError",this.bareMessage=x,this.context=w,this.line=_,this.sourceName=A,this.input=W,this.tokens=Y}}class bt extends c{static parse(f){let x=f.consumeKind("string");if(x)return new bt({source:f.source,tokens:{value:x}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:x}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:x}),'"']),{data:this,parent:x}),f.token(this.tokens.separator)])}}class Jt extends i{static parse(f){let x={};if(x.base=f.consume("enum"),!x.base)return;x.name=f.consumeKind("identifier")||f.error("No name for enum");let w=te(new Jt({source:f.source,tokens:x}));return f.current=w.this,x.open=f.consume("{")||f.error("Bodyless enum"),w.values=L(f,{parser:bt.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),x.close=f.consume("}")||f.error("Unexpected value in enum"),w.values.length||f.error("No value in enum"),x.termination=f.consume(";")||f.error("No semicolon after enum"),w.this}get type(){return"enum"}get name(){return M(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Zr extends i{static parse(f){let x=f.consumeKind("identifier");if(!x)return;let w={target:x};if(w.includes=f.consume("includes"),w.includes)return w.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),w.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Zr({source:f.source,tokens:w});f.unconsume(x.index)}get type(){return"includes"}get target(){return M(this.tokens.target.value)}get includes(){return M(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class Sn extends i{static parse(f){let x={},w=te(new Sn({source:f.source,tokens:x}));if(x.base=f.consume("typedef"),x.base)return w.idlType=Q(f,"typedef-type")||f.error("Typedef lacks a type"),x.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=w.this,x.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),w.this}get type(){return"typedef"}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class Ii extends i{static parse(f,x){let w={base:x},_=te(new Ii({source:f.source,tokens:w}));return w.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=_.this,w.assign=f.consume("=")||f.error("Callback lacks an assignment"),_.idlType=ae(f)||f.error("Callback lacks a return type"),w.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),_.arguments=oe(f),w.close=f.consume(")")||f.error("Unterminated callback"),w.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),_.this}get type(){return"callback"}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let x of this.arguments)if(yield*x.validate(f),x.idlType.generic==="async_sequence")yield s(x.tokens.name,x,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((x)=>x.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Dt extends i{static parse(f,x,{inheritable:w,allowedMembers:_}){let{tokens:A,type:W}=x;for(A.name=f.consumeKind("identifier")||f.error(`Missing name in ${W}`),f.current=x,x=te(x),w&&Object.assign(A,function(Y){let de=Y.consume(":");return de?{colon:de,inheritance:Y.consumeKind("identifier")||Y.error("Inheritance lacks a type")}:{}}(f)),A.open=f.consume("{")||f.error(`Bodyless ${W}`),x.members=[];;){if(A.close=f.consume("}"),A.close)return A.termination=f.consume(";")||f.error(`Missing semicolon after ${W}`),x.this;let Y=v.parse(f),de;for(let[ce,...ge]of _)if(de=te(ce(f,...ge)),de)break;de||f.error("Unknown member"),de.extAttrs=Y,x.members.push(de.this)}}get partial(){return!!this.tokens.partial}get name(){return M(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?M(this.tokens.inheritance.value):null}*validate(f){for(let x of this.members)x.validate&&(yield*x.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Qr extends i{static parse(f){let x={};if(x.base=f.consume("const"),!x.base)return;let w=ue(f);if(!w){let A=f.consumeKind("identifier")||f.error("Const lacks a type");w=new P({source:f.source,tokens:{base:A}})}f.probe("?")&&f.error("Unexpected nullable constant type"),w.type="const-type",x.name=f.consumeKind("identifier")||f.error("Const lacks a name"),x.assign=f.consume("=")||f.error("Const lacks value assignment"),x.value=B(f)||f.error("Const lacks a value"),x.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let _=new Qr({source:f.source,tokens:x});return te(_).idlType=w,_}get type(){return"const"}get name(){return M(this.tokens.name.value)}get value(){return se(this.tokens.value)}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:x})}}class Mi extends i{static parse(f){let x=f.position,w=te(new Mi({source:f.source,tokens:{}})),{tokens:_}=w;if(_.readonly=f.consume("readonly"),_.readonly||(_.async=f.consume("async")),_.base=_.readonly?f.consume("maplike","setlike"):_.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!_.base)return void f.unconsume(x);let{type:A}=w,W=A==="maplike",Y=W||A==="iterable"||A==="async_iterable",de=A==="async_iterable"||w.async&&A==="iterable";_.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${A} declaration`);let ce=Q(f)||f.error(`Missing a type argument in ${A} declaration`);return w.idlType=[ce],w.arguments=[],Y&&(ce.tokens.separator=f.consume(","),ce.tokens.separator?w.idlType.push(Q(f)):W&&f.error(`Missing second type argument in ${A} declaration`)),_.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${A} declaration`),f.probe("(")&&(de?(_.argsOpen=f.consume("("),w.arguments.push(...oe(f)),_.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),_.termination=f.consume(";")||f.error(`Missing semicolon after ${A} declaration`),w.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(x=this,()=>{let _=x.tokens.async;x.tokens.base={..._,type:"async_iterable",value:"async_iterable"},delete x.tokens.async})});var x;for(let w of this.idlType)yield*w.validate(f);for(let w of this.arguments)yield*w.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((x)=>x.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Ns extends i{static parse(f){let x=f.consume("constructor");if(!x)return;let w={base:x};w.open=f.consume("(")||f.error("No argument list in constructor");let _=oe(f);w.close=f.consume(")")||f.error("Unterminated constructor"),w.termination=f.consume(";")||f.error("No semicolon after constructor");let A=new Ns({source:f.source,tokens:w});return te(A).arguments=_,A}get type(){return"constructor"}*validate(f){for(let x of this.arguments)yield*x.validate(f)}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:x}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((w)=>w.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:x})}}function es(f){let x=f.consume("static");if(!x)return;return D.parse(f,{special:x})||I.parse(f,{special:x})||f.error("No body in static member")}class Is extends Dt{static parse(f,x,{extMembers:w=[],partial:_=null}={}){let A={partial:_,base:x};return Dt.parse(f,new Is({source:f.source,tokens:A}),{inheritable:!_,allowedMembers:[...w,[Qr.parse],[Ns.parse],[es],[ke],[Mi.parse],[D.parse],[I.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((w)=>w.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:le(this)});let x=this.extAttrs.filter((w)=>w.name==="Constructor");for(let w of x)yield s(w.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:ca(this,w)});if(this.extAttrs.some((w)=>w.name==="Global")){let w=this.extAttrs.filter((A)=>A.name==="LegacyFactoryFunction");for(let A of w)yield s(A.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let _=this.members.filter((A)=>A.type==="constructor");for(let A of _)yield s(A.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(w,_){let A=function(ge){let _e=ce(ge);return{statics:new Set(_e.filter((Ae)=>Ae.special==="static").map((Ae)=>Ae.name)),nonstatics:new Set(_e.filter((Ae)=>Ae.special!=="static").map((Ae)=>Ae.name))}}(_),W=w.partials.get(_.name)||[],Y=w.mixinMap.get(_.name)||[];for(let ge of[...W,...Y]){let _e=ce(ge),Ae=_e.filter((Lt)=>Lt.special==="static"),jt=_e.filter((Lt)=>Lt.special!=="static");yield*de(Ae,A.statics,ge,_),yield*de(jt,A.nonstatics,ge,_),Ae.forEach((Lt)=>A.statics.add(Lt.name)),jt.forEach((Lt)=>A.nonstatics.add(Lt.name))}function*de(ge,_e,Ae,jt){for(let Lt of ge){let{name:Ji}=Lt;if(Ji&&_e.has(Ji)){let Pc=`The ${Lt.special==="static"?"static ":""}operation "${Ji}" has already been defined for the base interface "${jt.name}" either in itself or in a mixin`;yield s(Lt.tokens.name,Ae,"no-cross-overload",Pc)}}}function ce(ge){return ge.members.filter(({type:_e})=>_e==="operation")}}(f,this))}}function ca(f,x){return f=te(f),()=>{let w=U(f.extAttrs.tokens.open.trivia),_=f.members.length?U(z(f.members[0]).trivia):function(_e){let Ae=U(_e),jt=Ae.includes("\t")?"\t":" ";return Ae+jt}(w),A=Ns.parse(new ut(`
|
|
562
|
-
${_}constructor();`));A.extAttrs=new v({source:f.source,tokens:{}}),te(A).arguments=x.arguments;let
|
|
559
|
+
${U(x)}`}}}function z(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return z(f.idlType);return Object.values(f.tokens).sort((x,w)=>x.index-w.index)[0]}function te(f,x){if(x||(x=f),!f)return f;return new Proxy(f,{get(w,_){let A=w[_];return Array.isArray(A)&&_!=="source"?te(A,w):A},set(w,_,A){if(w[_]=A,!A)return!0;if(Array.isArray(A))for(let B of A)B.parent!==void 0&&(B.parent=x);else A.parent!==void 0&&(A.parent=x);return!0}})}let Le={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},fe=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Be=["ByteString","DOMString","USVString"],G=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],We=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(G,Be,fe),Xe=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],pt=["_constructor","toString","_toString"];class ut{constructor(f){this.source=function(x){let w=[],_=0,A="",B=1,Y=0;for(;_<x.length;){let ce=x.charAt(_),ge=-1;if(/[\t\n\r ]/.test(ce)?ge=de("whitespace",{noFlushTrivia:!0}):ce==="/"&&(ge=de("comment",{noFlushTrivia:!0})),ge!==-1){let _e=w.pop().value;B+=(_e.match(/\n/g)||[]).length,A+=_e,Y-=1}else if(/[-0-9.A-Z_a-z]/.test(ce)){if(ge=de("decimal"),ge===-1&&(ge=de("integer")),ge===-1){ge=de("identifier");let _e=w.length-1,Ae=w[_e];if(ge!==-1){if(pt.includes(Ae.value)){let jt=`${M(Ae.value)} is a reserved identifier and must not be used.`;throw new Ue(n(w,_e,null,jt))}We.includes(Ae.value)&&(Ae.type="inline")}}}else ce==='"'&&(ge=de("string"));for(let _e of Xe)if(x.startsWith(_e,_)){w.push({type:"inline",value:_e,trivia:A,line:B,index:Y}),A="",_+=_e.length,ge=_;break}if(ge===-1&&(ge=de("other")),ge===-1)throw Error("Token stream not progressing");_=ge,Y+=1}return w.push({type:"eof",value:"",trivia:A,line:B,index:Y}),w;function de(ce,{noFlushTrivia:ge}={}){let _e=Le[ce];_e.lastIndex=_;let Ae=_e.exec(x);return Ae?(w.push({type:ce,value:Ae[0],trivia:A,line:B,index:Y}),ge||(A=""),_e.lastIndex):-1}}(f),this.position=0}error(f){throw new Ue(n(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let x of f){if(!this.probeKind(x))continue;let w=this.source[this.position];return this.position++,w}}consume(...f){if(!this.probeKind("inline"))return;let x=this.source[this.position];for(let w of f)if(x.value===w)return this.position++,x}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class Ue extends Error{constructor({message:f,bareMessage:x,context:w,line:_,sourceName:A,input:B,tokens:Y}){super(f),this.name="WebIDLParseError",this.bareMessage=x,this.context=w,this.line=_,this.sourceName=A,this.input=B,this.tokens=Y}}class bt extends c{static parse(f){let x=f.consumeKind("string");if(x)return new bt({source:f.source,tokens:{value:x}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:x}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:x}),'"']),{data:this,parent:x}),f.token(this.tokens.separator)])}}class Mt extends i{static parse(f){let x={};if(x.base=f.consume("enum"),!x.base)return;x.name=f.consumeKind("identifier")||f.error("No name for enum");let w=te(new Mt({source:f.source,tokens:x}));return f.current=w.this,x.open=f.consume("{")||f.error("Bodyless enum"),w.values=L(f,{parser:bt.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),x.close=f.consume("}")||f.error("Unexpected value in enum"),w.values.length||f.error("No value in enum"),x.termination=f.consume(";")||f.error("No semicolon after enum"),w.this}get type(){return"enum"}get name(){return M(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Xr extends i{static parse(f){let x=f.consumeKind("identifier");if(!x)return;let w={target:x};if(w.includes=f.consume("includes"),w.includes)return w.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),w.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Xr({source:f.source,tokens:w});f.unconsume(x.index)}get type(){return"includes"}get target(){return M(this.tokens.target.value)}get includes(){return M(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class En extends i{static parse(f){let x={},w=te(new En({source:f.source,tokens:x}));if(x.base=f.consume("typedef"),x.base)return w.idlType=Q(f,"typedef-type")||f.error("Typedef lacks a type"),x.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=w.this,x.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),w.this}get type(){return"typedef"}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class Ii extends i{static parse(f,x){let w={base:x},_=te(new Ii({source:f.source,tokens:w}));return w.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=_.this,w.assign=f.consume("=")||f.error("Callback lacks an assignment"),_.idlType=ae(f)||f.error("Callback lacks a return type"),w.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),_.arguments=oe(f),w.close=f.consume(")")||f.error("Unterminated callback"),w.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),_.this}get type(){return"callback"}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let x of this.arguments)if(yield*x.validate(f),x.idlType.generic==="async_sequence")yield s(x.tokens.name,x,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((x)=>x.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Jt extends i{static parse(f,x,{inheritable:w,allowedMembers:_}){let{tokens:A,type:B}=x;for(A.name=f.consumeKind("identifier")||f.error(`Missing name in ${B}`),f.current=x,x=te(x),w&&Object.assign(A,function(Y){let de=Y.consume(":");return de?{colon:de,inheritance:Y.consumeKind("identifier")||Y.error("Inheritance lacks a type")}:{}}(f)),A.open=f.consume("{")||f.error(`Bodyless ${B}`),x.members=[];;){if(A.close=f.consume("}"),A.close)return A.termination=f.consume(";")||f.error(`Missing semicolon after ${B}`),x.this;let Y=v.parse(f),de;for(let[ce,...ge]of _)if(de=te(ce(f,...ge)),de)break;de||f.error("Unknown member"),de.extAttrs=Y,x.members.push(de.this)}}get partial(){return!!this.tokens.partial}get name(){return M(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?M(this.tokens.inheritance.value):null}*validate(f){for(let x of this.members)x.validate&&(yield*x.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Zr extends i{static parse(f){let x={};if(x.base=f.consume("const"),!x.base)return;let w=ue(f);if(!w){let A=f.consumeKind("identifier")||f.error("Const lacks a type");w=new P({source:f.source,tokens:{base:A}})}f.probe("?")&&f.error("Unexpected nullable constant type"),w.type="const-type",x.name=f.consumeKind("identifier")||f.error("Const lacks a name"),x.assign=f.consume("=")||f.error("Const lacks value assignment"),x.value=W(f)||f.error("Const lacks a value"),x.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let _=new Zr({source:f.source,tokens:x});return te(_).idlType=w,_}get type(){return"const"}get name(){return M(this.tokens.name.value)}get value(){return se(this.tokens.value)}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:x})}}class Mi extends i{static parse(f){let x=f.position,w=te(new Mi({source:f.source,tokens:{}})),{tokens:_}=w;if(_.readonly=f.consume("readonly"),_.readonly||(_.async=f.consume("async")),_.base=_.readonly?f.consume("maplike","setlike"):_.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!_.base)return void f.unconsume(x);let{type:A}=w,B=A==="maplike",Y=B||A==="iterable"||A==="async_iterable",de=A==="async_iterable"||w.async&&A==="iterable";_.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${A} declaration`);let ce=Q(f)||f.error(`Missing a type argument in ${A} declaration`);return w.idlType=[ce],w.arguments=[],Y&&(ce.tokens.separator=f.consume(","),ce.tokens.separator?w.idlType.push(Q(f)):B&&f.error(`Missing second type argument in ${A} declaration`)),_.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${A} declaration`),f.probe("(")&&(de?(_.argsOpen=f.consume("("),w.arguments.push(...oe(f)),_.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),_.termination=f.consume(";")||f.error(`Missing semicolon after ${A} declaration`),w.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(x=this,()=>{let _=x.tokens.async;x.tokens.base={..._,type:"async_iterable",value:"async_iterable"},delete x.tokens.async})});var x;for(let w of this.idlType)yield*w.validate(f);for(let w of this.arguments)yield*w.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((x)=>x.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Ts extends i{static parse(f){let x=f.consume("constructor");if(!x)return;let w={base:x};w.open=f.consume("(")||f.error("No argument list in constructor");let _=oe(f);w.close=f.consume(")")||f.error("Unterminated constructor"),w.termination=f.consume(";")||f.error("No semicolon after constructor");let A=new Ts({source:f.source,tokens:w});return te(A).arguments=_,A}get type(){return"constructor"}*validate(f){for(let x of this.arguments)yield*x.validate(f)}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:x}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((w)=>w.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:x})}}function ts(f){let x=f.consume("static");if(!x)return;return D.parse(f,{special:x})||I.parse(f,{special:x})||f.error("No body in static member")}class Is extends Jt{static parse(f,x,{extMembers:w=[],partial:_=null}={}){let A={partial:_,base:x};return Jt.parse(f,new Is({source:f.source,tokens:A}),{inheritable:!_,allowedMembers:[...w,[Zr.parse],[Ts.parse],[ts],[ke],[Mi.parse],[D.parse],[I.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((w)=>w.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:le(this)});let x=this.extAttrs.filter((w)=>w.name==="Constructor");for(let w of x)yield s(w.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:ia(this,w)});if(this.extAttrs.some((w)=>w.name==="Global")){let w=this.extAttrs.filter((A)=>A.name==="LegacyFactoryFunction");for(let A of w)yield s(A.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let _=this.members.filter((A)=>A.type==="constructor");for(let A of _)yield s(A.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(w,_){let A=function(ge){let _e=ce(ge);return{statics:new Set(_e.filter((Ae)=>Ae.special==="static").map((Ae)=>Ae.name)),nonstatics:new Set(_e.filter((Ae)=>Ae.special!=="static").map((Ae)=>Ae.name))}}(_),B=w.partials.get(_.name)||[],Y=w.mixinMap.get(_.name)||[];for(let ge of[...B,...Y]){let _e=ce(ge),Ae=_e.filter((Dt)=>Dt.special==="static"),jt=_e.filter((Dt)=>Dt.special!=="static");yield*de(Ae,A.statics,ge,_),yield*de(jt,A.nonstatics,ge,_),Ae.forEach((Dt)=>A.statics.add(Dt.name)),jt.forEach((Dt)=>A.nonstatics.add(Dt.name))}function*de(ge,_e,Ae,jt){for(let Dt of ge){let{name:Ji}=Dt;if(Ji&&_e.has(Ji)){let Ec=`The ${Dt.special==="static"?"static ":""}operation "${Ji}" has already been defined for the base interface "${jt.name}" either in itself or in a mixin`;yield s(Dt.tokens.name,Ae,"no-cross-overload",Ec)}}}function ce(ge){return ge.members.filter(({type:_e})=>_e==="operation")}}(f,this))}}function ia(f,x){return f=te(f),()=>{let w=U(f.extAttrs.tokens.open.trivia),_=f.members.length?U(z(f.members[0]).trivia):function(_e){let Ae=U(_e),jt=Ae.includes("\t")?"\t":" ";return Ae+jt}(w),A=Ts.parse(new ut(`
|
|
560
|
+
${_}constructor();`));A.extAttrs=new v({source:f.source,tokens:{}}),te(A).arguments=x.arguments;let B=function(_e,Ae){let jt=_e.slice().reverse().findIndex(Ae);return jt===-1?jt:_e.length-jt-1}(f.members,(_e)=>_e.type==="constructor");f.members.splice(B+1,0,A);let{close:Y}=f.tokens;Y.trivia.includes(`
|
|
563
561
|
`)||(Y.trivia+=`
|
|
564
|
-
${w}`);let{extAttrs:de}=f,ce=de.indexOf(x),ge=de.splice(ce,1);de.length?de.length===ce?de[ce-1].tokens.separator=void 0:de[ce].tokens.name.trivia.trim()||(de[ce].tokens.name.trivia=ge[0].tokens.name.trivia):de.tokens.open=de.tokens.close=void 0}}class en extends Dt{static parse(f,x,{extMembers:w=[],partial:_}={}){let A={partial:_,base:x};if(A.mixin=f.consume("mixin"),A.mixin)return Dt.parse(f,new en({source:f.source,tokens:A}),{allowedMembers:[...w,[Qr.parse],[ke],[D.parse,{noInherit:!0}],[I.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class J extends i{static parse(f){let x={},w=te(new J({source:f.source,tokens:x}));return w.extAttrs=v.parse(f),x.required=f.consume("required"),w.idlType=Q(f,"dictionary-type")||f.error("Dictionary member lacks a type"),x.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),w.default=O.parse(f),x.required&&w.default&&f.error("Required member must not have a default"),x.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),w.this}get type(){return"field"}get name(){return M(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:x})}}class H extends Dt{static parse(f,{extMembers:x=[],partial:w}={}){let _={partial:w};if(_.base=f.consume("dictionary"),_.base)return Dt.parse(f,new H({source:f.source,tokens:_}),{inheritable:!w,allowedMembers:[...x,[J.parse]]})}get type(){return"dictionary"}}class V extends Dt{static parse(f,{extMembers:x=[],partial:w}={}){let _={partial:w};if(_.base=f.consume("namespace"),_.base)return Dt.parse(f,new V({source:f.source,tokens:_}),{allowedMembers:[...x,[D.parse,{noInherit:!0,readonly:!0}],[Qr.parse],[I.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((x)=>x.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:le(this)});yield*super.validate(f)}}class ie extends Dt{static parse(f,x,{extMembers:w=[]}={}){let _={callback:x};if(_.base=f.consume("interface"),_.base)return Dt.parse(f,new ie({source:f.source,tokens:_}),{allowedMembers:[...w,[Qr.parse],[I.parse,{regular:!0}]]})}get type(){return"callback interface"}}function Se(f,x){let w=f.source;function _(ce){f.error(ce)}function A(...ce){return f.consume(...ce)}function W(ce){let ge=A("interface");if(ge)return en.parse(f,ge,{...ce,...x?.extensions?.mixin})||Is.parse(f,ge,{...ce,...x?.extensions?.interface})||_("Interface has no proper body")}function Y(){if(x.productions)for(let ce of x.productions){let ge=ce(f);if(ge)return ge}return function(){let ce=A("callback");if(ce)return f.probe("interface")?ie.parse(f,ce,{...x?.extensions?.callbackInterface}):Ii.parse(f,ce)}()||W()||function(){let ce=A("partial");if(ce)return H.parse(f,{partial:ce,...x?.extensions?.dictionary})||W({partial:ce})||V.parse(f,{partial:ce,...x?.extensions?.namespace})||_("Partial doesn't apply to anything")}()||H.parse(f,x?.extensions?.dictionary)||Jt.parse(f)||Sn.parse(f)||Zr.parse(f)||V.parse(f,x?.extensions?.namespace)}let de=function(){if(!w.length)return[];let ce=[];for(;;){let _e=v.parse(f),Ae=Y();if(!Ae){_e.length&&_("Stray extended attributes");break}te(Ae).extAttrs=_e,ce.push(Ae)}let ge=d.parse(f);return x.concrete&&ce.push(ge),ce}();return f.position<w.length&&_("Unrecognised tokens"),de}function Or(f,x={}){let w=new ut(f);return x.sourceName!==void 0&&(w.source.name=x.sourceName),Se(w,x)}function ze(f){return f}let Ne={wrap:(f)=>f.join(""),trivia:ze,name:ze,reference:ze,type:ze,generic:ze,nameless:ze,inheritance:ze,definition:ze,extendedAttribute:ze,extendedAttributeReference:ze};class he{constructor(f){this.ts=Object.assign({},Ne,f)}reference(f,{unescaped:x,context:w}){return x||(x=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,x,w)}token(f,x=ze,...w){if(!f)return"";let _=x(f.value,...w);return this.ts.wrap([this.ts.trivia(f.trivia),_])}reference_token(f,x){return this.token(f,this.reference.bind(this),{context:x})}name_token(f,x){return this.token(f,this.ts.name,x)}identifier(f,x){return this.ts.wrap([this.reference_token(f.tokens.value,x),this.token(f.tokens.separator)])}}function xt(f,{templates:x=Ne}={}){x=Object.assign({},Ne,x);let w=new he(x);return x.wrap(f.map((_)=>_.write(w)))}function st(f,x){let w=new Map,_=f.filter((A)=>A.type==="includes");for(let A of _){let W=x.get(A.includes);if(!W)continue;let Y=w.get(A.target);Y?Y.push(W):w.set(A.target,[W])}return w}function*ot(f){let x=function(w){let _=new Map,A=new Set,W=new Map;for(let Y of w)if(Y.partial){let de=W.get(Y.name);de?de.push(Y):W.set(Y.name,[Y])}else Y.name&&(_.has(Y.name)?A.add(Y):_.set(Y.name,Y));return{all:w,unique:_,partials:W,duplicates:A,mixinMap:st(w,_),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let w of x.all)w.validate&&(yield*w.validate(x));yield*function*({unique:w,duplicates:_}){for(let A of _){let{name:W}=A,Y=`The name "${W}" of type "${w.get(W).type}" was already seen`;yield s(A.tokens.name,A,"no-duplicate",Y)}}(x)}function Zt(f){return[...ot((x=f,x.flat?x.flat():[].concat(...x)))];var x}return t})())});var dw=C(function(MY,uw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",ow=Te("fs").promises,aw=Te("path"),tL=iw();class lw{constructor(e,t){this.filename=t,this.shortname=aw.basename(t,".idl"),this.path=aw.join(e,t)}async text(){return await ow.readFile(this.path,"utf8")}async parse(){let e=await this.text();return tL.parse(e)}}async function cw({folder:e=__dirname}={}){let t={},r=await ow.readdir(e);for(let n of r)if(n.endsWith(".idl")){let s=new lw(e,n);t[s.shortname]=s}return t}async function rL(e){let t=await cw(e);for(let[r,n]of Object.entries(t))t[r]=await n.parse();return t}uw.exports={listAll:cw,parseAll:rL}});var fw,pw;var mw=q(()=>{fw={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},pw={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var hw;var gw=q(()=>{hw={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"}});var yw,bw,xw;var $w=q(()=>{yw={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},bw={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},xw={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var vw;var ww=q(()=>{vw={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"}});var Sw,Ew;var _w=q(()=>{Sw={description:"A CEM-compatible parameter definition for a function. Follows the Custom Elements Manifest Parameter shape.",properties:{default:{description:"Default value for the parameter."},description:{description:"Parameter documentation.",type:"string"},name:{description:"Parameter name.",type:"string"},optional:{description:"Whether the parameter is optional.",type:"boolean"},type:{description:"Parameter type (JSON Schema or CEM { text } format)."}},required:["name"],type:"object"},Ew={description:"A CEM-compatible event definition. Describes a CustomEvent the function dispatches.",properties:{deprecated:{description:"Deprecation notice.",oneOf:[{type:"boolean"},{type:"string"}]},description:{description:"Event documentation.",type:"string"},name:{description:"Event name (e.g. 'task-toggled').",type:"string"},type:{description:"Event type (e.g. { text: 'CustomEvent' })."}},required:["name"],type:"object"}});var Pw;var jw=q(()=>{Pw={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var kw,Rw,Aw,Ow,Cw,Tw,Nw,Iw,Mw;var Jw=q(()=>{kw={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Rw={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Aw={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Ow={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Cw={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Tw={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},Nw={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Iw={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"},Mw={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Tl;var Dw=q(()=>{Tl={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"}});var Lw,Fw;var qw=q(()=>{Lw={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Fw={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]}});var Hw,Vw,Ww,Bw,Uw,nf;var zw=q(()=>{Hw={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Vw={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},Ww={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Bw={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"},Uw={properties:{$switch:{$ref:"#/$defs/SwitchDef"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},type:"object"},tagName:{$ref:"#/$defs/TagName"}},required:["$switch","cases"],type:"object"},nf={additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"A Jx element definition. Maps directly to a DOM element.",properties:{"$map/index":{$ref:"#/$defs/RefObject"},"$map/item":{$ref:"#/$defs/RefObject"},$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"},$switch:{$ref:"#/$defs/SwitchDef"},alt:{$ref:"#/$defs/StringOrRef"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases for this element. Maps case values to element definitions or external component refs, rendered according to the reactive $switch discriminant.",type:"object"},checked:{$ref:"#/$defs/BoolOrRef"},children:{$ref:"#/$defs/ChildrenValue"},className:{$ref:"#/$defs/StringOrRef"},dir:{enum:["ltr","rtl","auto"],type:"string"},disabled:{$ref:"#/$defs/BoolOrRef"},hidden:{$ref:"#/$defs/BoolOrRef"},href:{$ref:"#/$defs/StringOrRef"},id:{type:"string"},innerHTML:{$ref:"#/$defs/StringOrRef"},innerText:{$ref:"#/$defs/StringOrRef"},lang:{$ref:"#/$defs/StringOrRef"},name:{$ref:"#/$defs/StringOrRef"},placeholder:{$ref:"#/$defs/StringOrRef"},selected:{$ref:"#/$defs/BoolOrRef"},src:{$ref:"#/$defs/StringOrRef"},style:{$ref:"#/$defs/StyleObject"},tabIndex:{$ref:"#/$defs/NumberOrRef"},tagName:{$ref:"#/$defs/ElementTagName"},textContent:{$ref:"#/$defs/StringOrRef"},title:{$ref:"#/$defs/StringOrRef"},type:{$ref:"#/$defs/StringOrRef"},value:{$ref:"#/$defs/StringOrRef"}},required:["tagName"],type:"object"}});var Gw;var Kw=q(()=>{Gw={description:"A typed reactive state variable with explicit type and default value. The type property is a JSON Schema or $ref to a $defs type definition. The default property is the initial runtime value.",not:{required:["$prototype"]},properties:{$ref:{description:"Reference to a shared type definition.",type:"string"},attribute:{description:"Linked HTML attribute name for CEM extraction.",type:"string"},default:{description:"Initial state value."},deprecated:{description:"Deprecation notice for CEM extraction.",oneOf:[{type:"boolean"},{type:"string"}]},description:{type:"string"},examples:{type:"array"},reflects:{description:"Whether property changes reflect back to the HTML attribute.",type:"boolean"},type:{description:"JSON Schema type definition, $ref to a $defs type, or JSON Schema type string.",oneOf:[{type:"string"},{type:"object"}]}},required:["default"],type:"object"}});var Yw;var Xw=q(()=>{Yw={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive. First parameter is always state (the reactive scope).',properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: an opaque JS source string (first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → JS string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var Zw,Qw;var e0=q(()=>{Zw={description:"One statement of a structured function body. Either a bare expression node in statement position (a mutation like =/push, or a call — its result discarded unless captured by an assignment), an if/then/else branch (JSON Schema conditional keywords; if holds a pure expression, then/else hold statement lists), a $switch multiway branch (discriminant matched by string form against cases keys, like element-level $switch), a dispatchEvent statement (WHATWG DOM: dispatches a CustomEvent from the handler's current target, with CustomEventInit members detail/bubbles/composed), or the two WHATWG event verbs stopPropagation and preventDefault, each spelled as the member set to true.",oneOf:[{$ref:"#/$defs/ExpressionNode"},{additionalProperties:!1,properties:{else:{items:{$ref:"#/$defs/Statement"},type:"array"},if:{$ref:"#/$defs/ExpressionOperand"},then:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["if","then"],title:"if / then / else — conditional branch (JSON Schema keyword triple)",type:"object"},{additionalProperties:!1,properties:{$switch:{$ref:"#/$defs/ExpressionOperand"},cases:{additionalProperties:{items:{$ref:"#/$defs/Statement"},type:"array"},type:"object"},default:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["$switch","cases"],title:"$switch / cases — multiway branch (element-level convention, ECMA switch semantics)",type:"object"},{additionalProperties:!1,properties:{bubbles:{type:"boolean"},composed:{type:"boolean"},detail:{$ref:"#/$defs/ExpressionOperand"},dispatchEvent:{description:"The CustomEvent type to dispatch (WHATWG DOM dispatchEvent).",type:"string"}},required:["dispatchEvent"],title:"dispatchEvent — emit a CustomEvent (WHATWG naming, CustomEventInit members)",type:"object"},{additionalProperties:!1,properties:{stopPropagation:{const:!0,description:"Stop the handler's event at the current target (WHATWG DOM stopPropagation), so an ancestor's handler for the same event does not run. A body run without an event has nothing to stop."}},required:["stopPropagation"],title:"stopPropagation — stop the event here (WHATWG DOM)",type:"object"},{additionalProperties:!1,properties:{preventDefault:{const:!0,description:"Cancel the handler's event's default action (WHATWG DOM preventDefault): a link's navigation, a form's submission, a key's scroll."}},required:["preventDefault"],title:"preventDefault — cancel the event's default action (WHATWG DOM)",type:"object"}]},Qw={description:"A structured function body: statements executed sequentially (one yielding a promise is awaited before the next, per ECMA async/await semantics).",items:{$ref:"#/$defs/Statement"},type:"array"}});var t0;var r0=q(()=>{t0={description:'An external class / data source. $prototype is a constructor name (not "Function"). When $prototype is not in the built-in registry, $src is required. All state entries are reactive by default.',properties:{$export:{description:"Named export in $src module. Defaults to the $prototype value.",type:"string"},$prototype:{description:"Constructor name — built-in Web API class or external class name.",examples:["Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream","MarkdownCollection","MyParser"],not:{const:"Function"},type:"string"},$src:{description:"External module specifier. Required when $prototype is not a built-in.",examples:["@jxsuite/md","./lib/my-parser.js","npm:@myorg/data"],type:"string"},autoIncrement:{type:"boolean"},body:{},database:{type:"string"},debounce:{minimum:0,type:"integer"},default:{},description:{type:"string"},domain:{type:"string"},filter:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single filter object, e.g. an equality shorthand.",type:"object"},{description:'Ordered filter rules, e.g. [{ field: "Slug", op: "not empty" }].',items:{type:"object"},type:"array"}],description:"Filter configuration: a reactive $ref binding, a single filter object, or an ordered array of rules."},headers:{additionalProperties:{type:"string"},type:"object"},indexes:{items:{properties:{keyPath:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},name:{type:"string"},unique:{type:"boolean"}},required:["name","keyPath"],type:"object"},type:"array"},items:{},key:{type:"string"},keyPath:{type:"string"},manual:{type:"boolean"},map:{$ref:"#/$defs/ElementDef"},maxAge:{type:"integer"},method:{enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],type:"string"},name:{type:"string"},path:{type:"string"},responseType:{enum:["json","text","blob","arraybuffer","document",""],type:"string"},sameSite:{enum:["strict","lax","none"],type:"string"},secure:{type:"boolean"},sort:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single sort rule, e.g. { field, order }.",type:"object"},{description:'Ordered sort rules, e.g. [{ field: "date", order: "desc" }].',items:{type:"object"},type:"array"}],description:"Sort configuration: a reactive $ref binding, a single { field, order } rule, or an ordered array of rules."},src:{description:"Configuration property passed to external class constructor.",type:"string"},store:{type:"string"},timing:{enum:["compiler","server","client"],type:"string"},url:{$ref:"#/$defs/StringOrRef"},version:{minimum:1,type:"integer"}},required:["$prototype"],type:"object"}});var n0;var s0=q(()=>{n0={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});var i0,o0,a0,l0,c0,u0,d0,f0,p0,m0,h0,g0,y0,b0,x0,$0,v0;var w0=q(()=>{nu();i0={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},o0={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."},a0={anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"},{$ref:"#/$defs/ExpressionLiteral"}],description:"Anything that may appear in target or value: a pointer, a literal, or a nested expression node."},l0={enum:["!","-"]},c0={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},u0={const:"?:"},d0={const:"switch"},f0={const:"call"},p0={description:"A genuine pure String.prototype / Array.prototype / Number.prototype method (spec §19.4d). The ES2023 change-by-copy family (toSorted, toReversed, toSpliced, with) stands in where mutation would otherwise occur. Receiver in target; value carries the argument (bare scalar) or argument list (array).",enum:["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]},m0={enum:["=","+=","-=","*=","/="]},h0={enum:["pop","shift"]},g0={enum:["push","unshift"]},y0={const:"splice"},b0={const:"reduce"},x0={enum:["map","filter"]},$0={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${Eh()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},v0={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"}});var S0,E0,_0,P0;var j0=q(()=>{S0={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]},E0={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},_0={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},P0={description:"A $defs type definition entry. Must be a pure JSON Schema type definition or a class definition (.class.json format).",oneOf:[{$ref:"#/$defs/PureTypeDef"},{$ref:"#/$defs/ClassDef"}]}});var nL,sf,of,af,lf,cf,uf,df,ff,pf,k0;var R0=q(()=>{nL=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],sf={description:"A typed parameter definition for a class.",properties:{default:{},description:{type:"string"},examples:{type:"array"},format:{description:`When "json-schema", this parameter's value is itself a JSON Schema.`,type:"string"},identifier:{type:"string"},type:{}},required:["identifier"],type:"object"},of={description:"A class field definition with access control and scope.",properties:{$prototype:{description:'Data source prototype for this field (e.g., "Request").',type:"string"},access:{enum:["public","private","protected"],type:"string"},default:{},description:{type:"string"},examples:{type:"array"},identifier:{type:"string"},initializer:{},role:{const:"field",type:"string"},scope:{enum:["instance","static"],type:"string"},type:{}},type:"object"},af={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},lf={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:nL,type:"string"},scope:{enum:["instance","static"],type:"string"},setter:{properties:{body:{type:"string"},parameters:{type:"array"}},type:"object"},timing:{description:"Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",items:{enum:["compiler","server","client"],type:"string"},type:"array"}},type:"object"},cf={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},uf={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},df={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},ff={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"},pf={description:"Studio control-surface hints for a format class: editor modes, document-mode rules, templates, and the element/nesting constraints that gate structural editing.",properties:{documentMode:{properties:{componentWhen:{description:"Treat the document as a component when this top-level/frontmatter key matches the regex.",properties:{frontmatterKey:{type:"string"},matches:{type:"string"}},type:"object"},default:{enum:["content","component"],type:"string"}},type:"object"},elements:{description:"Element allowlist and nesting constraints for structural editing.",properties:{block:{items:{type:"string"},type:"array"},inline:{items:{type:"string"},type:"array"},nesting:{additionalProperties:{properties:{block:{type:"boolean"},directive:{type:"boolean"},inline:{type:"boolean"},only:{items:{type:"string"},type:"array"}},type:"object"},description:'Per-parent child rules keyed by tag (or "_root"): { block, inline, directive } booleans or { only: [tags] }.',type:"object"},textOnly:{items:{type:"string"},type:"array"},void:{items:{type:"string"},type:"array"}},type:"object"},icon:{type:"string"},modes:{description:"Editor modes the studio offers for documents of this format.",items:{type:"string"},type:"array"},newFileTemplate:{description:"Initial source text for newly created files of this format.",type:"string"}},type:"object"},k0={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});var A0;var O0=q(()=>{A0={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"}});var Nl;var C0=q(()=>{Nl={description:"Image optimization configuration for the project.",properties:{formats:{items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" runs Sharp at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var sL,mf;var T0=q(()=>{ms();sL=[301,302,303,307,308],mf={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:ka,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:ka,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:ka,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...sL],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});function iL(){return N0??=oL(),N0}async function oL(){let[e,t,r]=await Promise.all([M0.listAll(),J0.default.listAll(),D0.default.parseAll()]),n=new Set;for(let{elements:c}of Object.values(e))for(let d of c)if(!d.obsolete)n.add(d.name);let s=[...n].toSorted(),i=new Set;for(let c of t.properties)for(let d of c.styleDeclaration??[])i.add(d);let o=[...i].toSorted(),a=new Set;for(let c of Object.values(r))for(let d of c){if(d.type!=="interface"&&d.type!=="interface mixin")continue;if(!d.members)continue;for(let p of d.members)if(p.type==="attribute"&&p.name?.startsWith("on")&&p.idlType?.idlType==="EventHandler")a.add(p.name)}let l=[...a].toSorted();return{cssProps:o,eventHandlers:l,tagExamples:s}}function aL(e){let t={};for(let r of e)t[r]={description:`Event handler for the "${r.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function lL(e){let t={...Tl.properties};for(let r of e)t[r]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function cL(){let{tagExamples:e,cssProps:t,eventHandlers:r}=await iL();return{$defs:{DefsMap:_0,TypeDefEntry:P0,StateMap:E0,StateEntry:S0,TypedStateDef:Gw,PureTypeDef:n0,FunctionDef:Yw,ClassDef:k0,ClassParameterDef:sf,ClassFieldDef:of,ClassConstructorDef:af,ClassMethodDef:lf,FormatDef:cf,ProjectBlockDef:uf,ServerBlockDef:df,ConnectorBlockDef:ff,StudioHints:pf,ExternalClassDef:t0,ExpressionPointer:i0,ExpressionLiteral:o0,ExpressionOperand:a0,UnaryOperator:l0,BinaryOperator:c0,ConditionalOperator:u0,SwitchOperator:d0,CallOperator:f0,PureMethod:p0,AssignmentOperator:m0,NoArgMethod:h0,OneArgMethod:g0,SpliceMethod:y0,ReduceMethod:b0,MapFilterMethod:x0,ExpressionNode:$0,ExpressionEntry:v0,Statement:Zw,StatementList:Qw,ElementDef:{...nf,properties:{...nf.properties,...aL(r)}},ChildrenValue:Fw,ArrayNamespace:Lw,SwitchDef:Bw,SwitchNode:Uw,StyleObject:{...Tl,properties:lL(t)},AttributesObject:Hw,PropsObject:Vw,RefObject:Iw,AnyRef:Nw,InternalRef:kw,StateRef:Rw,ExternalRef:Aw,ExternalComponentRef:Mw,GlobalRef:Ow,ParentRef:Cw,MapRef:Tw,ElementPropertyValue:Ww,StringOrRef:yw,BoolOrRef:bw,NumberOrRef:xw,CemParameter:Sw,CemEvent:Ew,TagName:{...hw,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:fw,ElementTagName:pw,JsonSchemaType:Pw,HeadEntry:vw,ImageConfig:Nl,PathsValue:{$id:Es,anyOf:[...Ro,Yd],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:Es,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function uL(){return{$defs:{ImageConfig:Nl,StyleObject:L0},$id:"https://jxsuite.com/schema/project/v1",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:mf.properties,title:"Jx Project",type:"object"}}function dL(){return{$defs:{ImageConfig:Nl,JxFieldSchema:Mv,RelationshipRef:Jv,StyleObject:L0},$id:"https://jxsuite.com/schema/project/core/v2",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Core fragment of the Jx project.json schema. Open by design: extension fragments contribute their own top-level sections and the generated per-project entry document "+"(project.schema.json) closes the composition. See specs/extensions.md §5.",properties:mf.properties,title:"Jx Project Core",type:"object"}}function fL(){return{$id:ko,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/JxFieldSchema"},{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/RelationshipRef"}],description:"Default field-schema union for section entry schemas: the core field shape plus relationship references. Per-project entry documents override this resource with the "+"effective union. See specs/extensions.md §5.3.",title:"Jx Project Field Union"}}function pL(){return{$id:Es,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...Ro,Yd],description:"Default $paths-value union for documents: the core source shapes. Per-project entry documents override this resource with those members PLUS every extension-contributed paths shape.",title:"Jx Document Paths Union"}}function mL(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...A0}}function hf(){return{$defs:{ClassConstructorDef:af,ClassFieldDef:of,ClassMethodDef:lf,ClassParameterDef:sf,ConnectorBlockDef:ff,FormatDef:cf,ProjectBlockDef:uf,ServerBlockDef:df,StudioHints:pf},$id:"https://jxsuite.com/schema/class/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:!1,description:"Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",examples:["./md.js","./lib/calculator.js"],type:"string"},$prototype:{const:"Class",description:'Must be "Class" for class definition files.',type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",examples:["MarkdownFile","DataSource","Calculator"],type:"string"}},required:["$prototype","title"],title:"Jx Class Definition",type:"object"}}async function hL(e){let{mkdirSync:t,writeFileSync:r}=await import("node:fs"),{resolve:n,dirname:s}=await import("node:path"),i=s(n(e,"..")),o=await cL(),a=uL(),l=hf(),c=dL(),d=mL(),p=fL(),h=pL(),m=JSON.stringify(o,null,2),b=JSON.stringify(a,null,2),g=JSON.stringify(l,null,2),y=JSON.stringify(c,null,2),v=JSON.stringify(d,null,2),j=JSON.stringify(p,null,2),S=JSON.stringify(h,null,2),[P]=process.argv.slice(2);if(P)r(P,m,"utf8"),console.error(`Jx component schema written to ${P}`);else{r(n(i,"schema.json"),m,"utf8"),r(n(i,"project-schema.json"),b,"utf8"),r(n(i,"class-schema.json"),g,"utf8"),t(n(i,"schemas"),{recursive:!0}),r(n(i,"schemas","project.core.schema.json"),y,"utf8"),r(n(i,"schemas","project.fields.schema.json"),j,"utf8"),r(n(i,"schemas","document.paths.schema.json"),S,"utf8"),r(n(i,"extension-manifest.schema.json"),v,"utf8");let E=Bun.spawnSync(["bunx","oxfmt",n(i,"schemas","project.core.schema.json"),n(i,"schemas","project.fields.schema.json"),n(i,"schemas","document.paths.schema.json")],{cwd:i});if(E.exitCode!==0){let O=E.stderr.toString()||E.stdout.toString()||`exit ${E.exitCode}${E.signalCode?`, signal ${E.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${O})`)}console.error("Generated:"),console.error(" schema.json (component)"),console.error(" project-schema.json"),console.error(" class-schema.json"),console.error(" schemas/project.core.schema.json"),console.error(" schemas/project.fields.schema.json"),console.error(" schemas/document.paths.schema.json"),console.error(" extension-manifest.schema.json")}}var M0,J0,D0,N0=null,L0,I0,kX;var F0=q(()=>{mw();gw();$w();ww();_w();jw();Jw();Dw();qw();zw();Kw();Xw();e0();r0();s0();w0();j0();R0();O0();Al();C0();T0();M0=kt(tw(),1),J0=kt(sw(),1),D0=kt(dw(),1);L0={...Tl,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,I0]=process.argv,kX=I0?.endsWith("schema.ts")?hL(I0):void 0});var Mo=C(function(V0){Object.defineProperty(V0,"__esModule",{value:!0});V0.regexpCode=V0.getEsmExportName=V0.getProperty=V0.safeStringify=V0.stringify=V0.strConcat=V0.addCodeArg=V0.str=V0._=V0.nil=V0._Code=V0.Name=V0.IDENTIFIER=V0._CodeOrName=void 0;class Il{}V0._CodeOrName=Il;V0.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class gi extends Il{constructor(e){super();if(!V0.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}V0.Name=gi;class _r extends Il{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof gi)t[r.str]=(t[r.str]||0)+1;return t},{})}}V0._Code=_r;V0.nil=new _r("");function q0(e,...t){let r=[e[0]],n=0;while(n<t.length)yf(r,t[n]),r.push(e[++n]);return new _r(r)}V0._=q0;var gf=new _r("+");function H0(e,...t){let r=[Io(e[0])],n=0;while(n<t.length)r.push(gf),yf(r,t[n]),r.push(gf,Io(e[++n]));return gL(r),new _r(r)}V0.str=H0;function yf(e,t){if(t instanceof _r)e.push(...t._items);else if(t instanceof gi)e.push(t);else e.push(xL(t))}V0.addCodeArg=yf;function gL(e){let t=1;while(t<e.length-1){if(e[t]===gf){let r=yL(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function yL(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof gi||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof gi))return`"${e}${t.slice(1)}`;return}function bL(e,t){return t.emptyStr()?e:e.emptyStr()?t:H0`${e}${t}`}V0.strConcat=bL;function xL(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Io(Array.isArray(e)?e.join(","):e)}function $L(e){return new _r(Io(e))}V0.stringify=$L;function Io(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}V0.safeStringify=Io;function vL(e){return typeof e=="string"&&V0.IDENTIFIER.test(e)?new _r(`.${e}`):q0`[${e}]`}V0.getProperty=vL;function wL(e){if(typeof e=="string"&&V0.IDENTIFIER.test(e))return new _r(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}V0.getEsmExportName=wL;function SL(e){return new _r(e.toString())}V0.regexpCode=SL});var vf=C(function(z0){Object.defineProperty(z0,"__esModule",{value:!0});z0.ValueScope=z0.ValueScopeName=z0.Scope=z0.varKinds=z0.UsedValueState=void 0;var Ut=Mo();class B0 extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Jl;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Jl||(z0.UsedValueState=Jl={}));z0.varKinds={const:new Ut.Name("const"),let:new Ut.Name("let"),var:new Ut.Name("var")};class xf{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ut.Name?e:this.name(e)}name(e){return new Ut.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}z0.Scope=xf;class $f extends Ut.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ut._`.${new Ut.Name(t)}[${r}]`}}z0.ValueScopeName=$f;var ML=Ut._`\n`;class U0 extends xf{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?ML:Ut.nil}}get(){return this._scope}name(e){return new $f(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(r=t.key)!==null&&r!==void 0?r:t.ref,o=this._values[s];if(o){let c=o.get(i);if(c)return c}else o=this._values[s]=new Map;o.set(i,n);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,n.setValue(t,{property:s,itemIndex:l}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ut._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let s=Ut.nil;for(let i in e){let o=e[i];if(!o)continue;let a=r[i]=r[i]||new Map;o.forEach((l)=>{if(a.has(l))return;a.set(l,Jl.Started);let c=t(l);if(c){let d=this.opts.es5?z0.varKinds.var:z0.varKinds.const;s=Ut._`${s}${d} ${l} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(l))s=Ut._`${s}${c}${this.opts._n}`;else throw new B0(l);a.set(l,Jl.Completed)})}return s}}z0.ValueScope=U0});var ye=C(function(zt){Object.defineProperty(zt,"__esModule",{value:!0});zt.or=zt.and=zt.not=zt.CodeGen=zt.operators=zt.varKinds=zt.ValueScopeName=zt.ValueScope=zt.Scope=zt.Name=zt.regexpCode=zt.stringify=zt.getProperty=zt.nil=zt.strConcat=zt.str=zt._=void 0;var je=Mo(),Pr=vf(),Wn=Mo();Object.defineProperty(zt,"_",{enumerable:!0,get:function(){return Wn._}});Object.defineProperty(zt,"str",{enumerable:!0,get:function(){return Wn.str}});Object.defineProperty(zt,"strConcat",{enumerable:!0,get:function(){return Wn.strConcat}});Object.defineProperty(zt,"nil",{enumerable:!0,get:function(){return Wn.nil}});Object.defineProperty(zt,"getProperty",{enumerable:!0,get:function(){return Wn.getProperty}});Object.defineProperty(zt,"stringify",{enumerable:!0,get:function(){return Wn.stringify}});Object.defineProperty(zt,"regexpCode",{enumerable:!0,get:function(){return Wn.regexpCode}});Object.defineProperty(zt,"Name",{enumerable:!0,get:function(){return Wn.Name}});var Vl=vf();Object.defineProperty(zt,"Scope",{enumerable:!0,get:function(){return Vl.Scope}});Object.defineProperty(zt,"ValueScope",{enumerable:!0,get:function(){return Vl.ValueScope}});Object.defineProperty(zt,"ValueScopeName",{enumerable:!0,get:function(){return Vl.ValueScopeName}});Object.defineProperty(zt,"varKinds",{enumerable:!0,get:function(){return Vl.varKinds}});zt.operators={GT:new je._Code(">"),GTE:new je._Code(">="),LT:new je._Code("<"),LTE:new je._Code("<="),EQ:new je._Code("==="),NEQ:new je._Code("!=="),NOT:new je._Code("!"),OR:new je._Code("||"),AND:new je._Code("&&"),ADD:new je._Code("+")};class Bn{optimizeNodes(){return this}optimizeNames(e,t){return this}}class K0 extends Bn{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?Pr.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=bi(this.rhs,e,t);return this}get names(){return this.rhs instanceof je._CodeOrName?this.rhs.names:{}}}class Ef extends Bn{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof je.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=bi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof je.Name?{}:{...this.lhs.names};return Hl(e,this.rhs)}}class Y0 extends Ef{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class X0 extends Bn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Z0 extends Bn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Q0 extends Bn{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class eS extends Bn{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=bi(this.code,e,t),this}get names(){return this.code instanceof je._CodeOrName?this.code.names:{}}}class Wl extends Bn{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let s=r[n];if(s.optimizeNames(e,t))continue;FL(e,s.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>_s(e,t.names),{})}}class Un extends Wl{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class tS extends Wl{}class Jo extends Un{}Jo.kind="else";class $n extends Un{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new Jo(r):r}if(t){if(e===!1)return t instanceof $n?t:t.nodes;if(this.nodes.length)return this;return new $n(oS(e),t instanceof $n?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=bi(this.condition,e,t),this}get names(){let e=super.names;if(Hl(e,this.condition),this.else)_s(e,this.else.names);return e}}$n.kind="if";class yi extends Un{}yi.kind="for";class rS extends yi{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=bi(this.iteration,e,t),this}get names(){return _s(super.names,this.iteration.names)}}class nS extends yi{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?Pr.varKinds.var:this.varKind,{name:r,from:n,to:s}=this;return`for(${t} ${r}=${n}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=Hl(super.names,this.from);return Hl(e,this.to)}}class wf extends yi{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=bi(this.iterable,e,t),this}get names(){return _s(super.names,this.iterable.names)}}class Dl extends Un{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Dl.kind="func";class Ll extends Wl{render(e){return"return "+super.render(e)}}Ll.kind="return";class sS extends Un{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)_s(e,this.catch.names);if(this.finally)_s(e,this.finally.names);return e}}class Fl extends Un{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Fl.kind="catch";class ql extends Un{render(e){return"finally"+super.render(e)}}ql.kind="finally";class iS{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
565
|
-
`:""},this._extScope=e,this._scope=new Pr.Scope({parent:e}),this._nodes=[new tS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let s=this._scope.toName(t);if(r!==void 0&&n)this._constants[s.str]=r;return this._leafNode(new K0(e,s,r)),s}const(e,t,r){return this._def(Pr.varKinds.const,e,t,r)}let(e,t,r){return this._def(Pr.varKinds.let,e,t,r)}var(e,t,r){return this._def(Pr.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Ef(e,t,r))}add(e,t){return this._leafNode(new Y0(e,zt.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==je.nil)this._leafNode(new eS(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),je.addCodeArg(t,n)}return t.push("}"),new je._Code(t)}if(e,t,r){if(this._blockNode(new $n(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new $n(e))}else(){return this._elseNode(new Jo)}endIf(){return this._endBlockNode($n,Jo)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new rS(e),t)}forRange(e,t,r,n,s=this.opts.es5?Pr.varKinds.var:Pr.varKinds.let){let i=this._scope.toName(e);return this._for(new nS(s,i,t,r),()=>n(i))}forOf(e,t,r,n=Pr.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=t instanceof je.Name?t:this.var("_arr",t);return this.forRange("_i",0,je._`${i}.length`,(o)=>{this.var(s,je._`${i}[${o}]`),r(s)})}return this._for(new wf("of",n,s,t),()=>r(s))}forIn(e,t,r,n=this.opts.es5?Pr.varKinds.var:Pr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,je._`Object.keys(${t})`,r);let s=this._scope.toName(e);return this._for(new wf("in",n,s,t),()=>r(s))}endFor(){return this._endBlockNode(yi)}label(e){return this._leafNode(new X0(e))}break(e){return this._leafNode(new Z0(e))}return(e){let t=new Ll;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Ll)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new sS;if(this._blockNode(n),this.code(e),t){let s=this.name("e");this._currNode=n.catch=new Fl(s),t(s)}if(r)this._currNode=n.finally=new ql,this.code(r);return this._endBlockNode(Fl,ql)}throw(e){return this._leafNode(new Q0(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=je.nil,r,n){if(this._blockNode(new Dl(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Dl)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof $n))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}zt.CodeGen=iS;function _s(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Hl(e,t){return t instanceof je._CodeOrName?_s(e,t.names):e}function bi(e,t,r){if(e instanceof je.Name)return n(e);if(!s(e))return e;return new je._Code(e._items.reduce((i,o)=>{if(o instanceof je.Name)o=n(o);if(o instanceof je._Code)i.push(...o._items);else i.push(o);return i},[]));function n(i){let o=r[i.str];if(o===void 0||t[i.str]!==1)return i;return delete t[i.str],o}function s(i){return i instanceof je._Code&&i._items.some((o)=>o instanceof je.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function FL(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function oS(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:je._`!${Sf(e)}`}zt.not=oS;var qL=aS(zt.operators.AND);function HL(...e){return e.reduce(qL)}zt.and=HL;var VL=aS(zt.operators.OR);function WL(...e){return e.reduce(VL)}zt.or=WL;function aS(e){return(t,r)=>t===je.nil?r:r===je.nil?t:je._`${Sf(t)} ${e} ${Sf(r)}`}function Sf(e){return e instanceof je.Name?e:je._`(${e})`}});var we=C(function(gS){Object.defineProperty(gS,"__esModule",{value:!0});gS.checkStrictMode=gS.getErrorPath=gS.Type=gS.useFunc=gS.setEvaluated=gS.evaluatedPropsToName=gS.mergeEvaluated=gS.eachItem=gS.unescapeJsonPointer=gS.escapeJsonPointer=gS.escapeFragment=gS.unescapeFragment=gS.schemaRefOrVal=gS.schemaHasRulesButRef=gS.schemaHasRules=gS.checkUnknownRules=gS.alwaysValidSchema=gS.toHash=void 0;var De=ye(),GL=Mo();function KL(e){let t={};for(let r of e)t[r]=!0;return t}gS.toHash=KL;function YL(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return dS(e,t),!fS(t,e.self.RULES.all)}gS.alwaysValidSchema=YL;function dS(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let s=n.RULES.keywords;for(let i in t)if(!s[i])hS(e,`unknown keyword: "${i}"`)}gS.checkUnknownRules=dS;function fS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}gS.schemaHasRules=fS;function XL(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}gS.schemaHasRulesButRef=XL;function ZL({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return De._`${r}`}return De._`${e}${t}${De.getProperty(n)}`}gS.schemaRefOrVal=ZL;function QL(e){return pS(decodeURIComponent(e))}gS.unescapeFragment=QL;function eF(e){return encodeURIComponent(Pf(e))}gS.escapeFragment=eF;function Pf(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}gS.escapeJsonPointer=Pf;function pS(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}gS.unescapeJsonPointer=pS;function tF(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}gS.eachItem=tF;function cS({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let l=o===void 0?i:o instanceof De.Name?(i instanceof De.Name?e(s,i,o):t(s,i,o),o):i instanceof De.Name?(t(s,o,i),i):r(i,o);return a===De.Name&&!(l instanceof De.Name)?n(s,l):l}}gS.mergeEvaluated={props:cS({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>{e.if(De._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,De._`${r} || {}`).code(De._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,De._`${r} || {}`),jf(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:mS}),items:cS({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,De._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>e.assign(r,t===!0?!0:De._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function mS(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",De._`{}`);if(t!==void 0)jf(e,r,t);return r}gS.evaluatedPropsToName=mS;function jf(e,t,r){Object.keys(r).forEach((n)=>e.assign(De._`${t}${De.getProperty(n)}`,!0))}gS.setEvaluated=jf;var uS={};function rF(e,t){return e.scopeValue("func",{ref:t,code:uS[t.code]||(uS[t.code]=new GL._Code(t.code))})}gS.useFunc=rF;var _f;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(_f||(gS.Type=_f={}));function nF(e,t,r){if(e instanceof De.Name){let n=t===_f.Num;return r?n?De._`"[" + ${e} + "]"`:De._`"['" + ${e} + "']"`:n?De._`"/" + ${e}`:De._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?De.getProperty(e).toString():"/"+Pf(e)}gS.getErrorPath=nF;function hS(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}gS.checkStrictMode=hS});var gr=C(function(bS){Object.defineProperty(bS,"__esModule",{value:!0});var St=ye(),vF={data:new St.Name("data"),valCxt:new St.Name("valCxt"),instancePath:new St.Name("instancePath"),parentData:new St.Name("parentData"),parentDataProperty:new St.Name("parentDataProperty"),rootData:new St.Name("rootData"),dynamicAnchors:new St.Name("dynamicAnchors"),vErrors:new St.Name("vErrors"),errors:new St.Name("errors"),this:new St.Name("this"),self:new St.Name("self"),scope:new St.Name("scope"),json:new St.Name("json"),jsonPos:new St.Name("jsonPos"),jsonLen:new St.Name("jsonLen"),jsonPart:new St.Name("jsonPart")};bS.default=vF});var Do=C(function(wS){Object.defineProperty(wS,"__esModule",{value:!0});wS.extendErrors=wS.resetErrorsCount=wS.reportExtraError=wS.reportError=wS.keyword$DataError=wS.keywordError=void 0;var Re=ye(),Ul=we(),Tt=gr();wS.keywordError={message:({keyword:e})=>Re.str`must pass "${e}" keyword validation`};wS.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Re.str`"${e}" keyword must be ${t} ($data)`:Re.str`"${e}" keyword is invalid ($data)`};function SF(e,t=wS.keywordError,r,n){let{it:s}=e,{gen:i,compositeRule:o,allErrors:a}=s,l=vS(e,t,r);if(n!==null&&n!==void 0?n:o||a)xS(i,l);else $S(s,Re._`[${l}]`)}wS.reportError=SF;function EF(e,t=wS.keywordError,r){let{it:n}=e,{gen:s,compositeRule:i,allErrors:o}=n,a=vS(e,t,r);if(xS(s,a),!(i||o))$S(n,Tt.default.vErrors)}wS.reportExtraError=EF;function _F(e,t){e.assign(Tt.default.errors,t),e.if(Re._`${Tt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Re._`${Tt.default.vErrors}.length`,t),()=>e.assign(Tt.default.vErrors,null)))}wS.resetErrorsCount=_F;function PF({gen:e,keyword:t,schemaValue:r,data:n,errsCount:s,it:i}){if(s===void 0)throw Error("ajv implementation error");let o=e.name("err");e.forRange("i",s,Tt.default.errors,(a)=>{if(e.const(o,Re._`${Tt.default.vErrors}[${a}]`),e.if(Re._`${o}.instancePath === undefined`,()=>e.assign(Re._`${o}.instancePath`,Re.strConcat(Tt.default.instancePath,i.errorPath))),e.assign(Re._`${o}.schemaPath`,Re.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(Re._`${o}.schema`,r),e.assign(Re._`${o}.data`,n)})}wS.extendErrors=PF;function xS(e,t){let r=e.const("err",t);e.if(Re._`${Tt.default.vErrors} === null`,()=>e.assign(Tt.default.vErrors,Re._`[${r}]`),Re._`${Tt.default.vErrors}.push(${r})`),e.code(Re._`${Tt.default.errors}++`)}function $S(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;if(s.$async)r.throw(Re._`new ${e.ValidationError}(${t})`);else r.assign(Re._`${n}.errors`,t),r.return(!1)}var Ps={keyword:new Re.Name("keyword"),schemaPath:new Re.Name("schemaPath"),params:new Re.Name("params"),propertyName:new Re.Name("propertyName"),message:new Re.Name("message"),schema:new Re.Name("schema"),parentSchema:new Re.Name("parentSchema")};function vS(e,t,r){let{createErrors:n}=e.it;if(n===!1)return Re._`{}`;return jF(e,t,r)}function jF(e,t,r={}){let{gen:n,it:s}=e,i=[kF(s,r),RF(e,r)];return AF(e,t,i),n.object(...i)}function kF({errorPath:e},{instancePath:t}){let r=t?Re.str`${e}${Ul.getErrorPath(t,Ul.Type.Str)}`:e;return[Tt.default.instancePath,Re.strConcat(Tt.default.instancePath,r)]}function RF({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:Re.str`${t}/${e}`;if(r)s=Re.str`${s}${Ul.getErrorPath(r,Ul.Type.Str)}`;return[Ps.schemaPath,s]}function AF(e,{params:t,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=e,{opts:l,propertyName:c,topSchemaRef:d,schemaPath:p}=a;if(n.push([Ps.keyword,s],[Ps.params,typeof t=="function"?t(e):t||Re._`{}`]),l.messages)n.push([Ps.message,typeof r=="function"?r(e):r]);if(l.verbose)n.push([Ps.schema,o],[Ps.parentSchema,Re._`${d}${p}`],[Tt.default.data,i]);if(c)n.push([Ps.propertyName,c])}});var jS=C(function(_S){Object.defineProperty(_S,"__esModule",{value:!0});_S.boolOrEmptySchema=_S.topBoolOrEmptySchema=void 0;var IF=Do(),MF=ye(),JF=gr(),DF={message:"boolean schema is false"};function LF(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)ES(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(JF.default.data);else t.assign(MF._`${n}.errors`,null),t.return(!0)}_S.topBoolOrEmptySchema=LF;function FF(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),ES(e);else r.var(t,!0)}_S.boolOrEmptySchema=FF;function ES(e,t){let{gen:r,data:n}=e;IF.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},DF,void 0,t)}});var Rf=C(function(kS){Object.defineProperty(kS,"__esModule",{value:!0});kS.getRules=kS.isJSONType=void 0;var HF=["string","number","integer","boolean","null","object","array"],VF=new Set(HF);function WF(e){return typeof e=="string"&&VF.has(e)}kS.isJSONType=WF;function BF(){let 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:{}}}kS.getRules=BF});var Af=C(function(CS){Object.defineProperty(CS,"__esModule",{value:!0});CS.shouldUseRule=CS.shouldUseGroup=CS.schemaHasRulesForType=void 0;function zF({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&AS(e,n)}CS.schemaHasRulesForType=zF;function AS(e,t){return t.rules.some((r)=>OS(e,r))}CS.shouldUseGroup=AS;function OS(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))}CS.shouldUseRule=OS});var Lo=C(function(JS){Object.defineProperty(JS,"__esModule",{value:!0});JS.reportTypeError=JS.checkDataTypes=JS.checkDataType=JS.coerceAndCheckDataType=JS.getJSONTypes=JS.getSchemaTypes=JS.DataType=void 0;var YF=Rf(),XF=Af(),ZF=Do(),xe=ye(),NS=we(),xi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(xi||(JS.DataType=xi={}));function QF(e){let t=IS(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}JS.getSchemaTypes=QF;function IS(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(YF.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}JS.getJSONTypes=IS;function eq(e,t){let{gen:r,data:n,opts:s}=e,i=tq(t,s.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&XF.schemaHasRulesForType(e,t[0]));if(o){let a=Cf(t,n,s.strictNumbers,xi.Wrong);r.if(a,()=>{if(i.length)rq(e,t,i);else Tf(e)})}return o}JS.coerceAndCheckDataType=eq;var MS=new Set(["string","number","integer","boolean","null"]);function tq(e,t){return t?e.filter((r)=>MS.has(r)||t==="array"&&r==="array"):[]}function rq(e,t,r){let{gen:n,data:s,opts:i}=e,o=n.let("dataType",xe._`typeof ${s}`),a=n.let("coerced",xe._`undefined`);if(i.coerceTypes==="array")n.if(xe._`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,xe._`${s}[0]`).assign(o,xe._`typeof ${s}`).if(Cf(t,s,i.strictNumbers),()=>n.assign(a,s)));n.if(xe._`${a} !== undefined`);for(let c of r)if(MS.has(c)||c==="array"&&i.coerceTypes==="array")l(c);n.else(),Tf(e),n.endIf(),n.if(xe._`${a} !== undefined`,()=>{n.assign(s,a),nq(e,a)});function l(c){switch(c){case"string":n.elseIf(xe._`${o} == "number" || ${o} == "boolean"`).assign(a,xe._`"" + ${s}`).elseIf(xe._`${s} === null`).assign(a,xe._`""`);return;case"number":n.elseIf(xe._`${o} == "boolean" || ${s} === null
|
|
562
|
+
${w}`);let{extAttrs:de}=f,ce=de.indexOf(x),ge=de.splice(ce,1);de.length?de.length===ce?de[ce-1].tokens.separator=void 0:de[ce].tokens.name.trivia.trim()||(de[ce].tokens.name.trivia=ge[0].tokens.name.trivia):de.tokens.open=de.tokens.close=void 0}}class Qr extends Jt{static parse(f,x,{extMembers:w=[],partial:_}={}){let A={partial:_,base:x};if(A.mixin=f.consume("mixin"),A.mixin)return Jt.parse(f,new Qr({source:f.source,tokens:A}),{allowedMembers:[...w,[Zr.parse],[ke],[D.parse,{noInherit:!0}],[I.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class J extends i{static parse(f){let x={},w=te(new J({source:f.source,tokens:x}));return w.extAttrs=v.parse(f),x.required=f.consume("required"),w.idlType=Q(f,"dictionary-type")||f.error("Dictionary member lacks a type"),x.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),w.default=O.parse(f),x.required&&w.default&&f.error("Required member must not have a default"),x.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),w.this}get type(){return"field"}get name(){return M(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:x})}}class H extends Jt{static parse(f,{extMembers:x=[],partial:w}={}){let _={partial:w};if(_.base=f.consume("dictionary"),_.base)return Jt.parse(f,new H({source:f.source,tokens:_}),{inheritable:!w,allowedMembers:[...x,[J.parse]]})}get type(){return"dictionary"}}class V extends Jt{static parse(f,{extMembers:x=[],partial:w}={}){let _={partial:w};if(_.base=f.consume("namespace"),_.base)return Jt.parse(f,new V({source:f.source,tokens:_}),{allowedMembers:[...x,[D.parse,{noInherit:!0,readonly:!0}],[Zr.parse],[I.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((x)=>x.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:le(this)});yield*super.validate(f)}}class ie extends Jt{static parse(f,x,{extMembers:w=[]}={}){let _={callback:x};if(_.base=f.consume("interface"),_.base)return Jt.parse(f,new ie({source:f.source,tokens:_}),{allowedMembers:[...w,[Zr.parse],[I.parse,{regular:!0}]]})}get type(){return"callback interface"}}function Se(f,x){let w=f.source;function _(ce){f.error(ce)}function A(...ce){return f.consume(...ce)}function B(ce){let ge=A("interface");if(ge)return Qr.parse(f,ge,{...ce,...x?.extensions?.mixin})||Is.parse(f,ge,{...ce,...x?.extensions?.interface})||_("Interface has no proper body")}function Y(){if(x.productions)for(let ce of x.productions){let ge=ce(f);if(ge)return ge}return function(){let ce=A("callback");if(ce)return f.probe("interface")?ie.parse(f,ce,{...x?.extensions?.callbackInterface}):Ii.parse(f,ce)}()||B()||function(){let ce=A("partial");if(ce)return H.parse(f,{partial:ce,...x?.extensions?.dictionary})||B({partial:ce})||V.parse(f,{partial:ce,...x?.extensions?.namespace})||_("Partial doesn't apply to anything")}()||H.parse(f,x?.extensions?.dictionary)||Mt.parse(f)||En.parse(f)||Xr.parse(f)||V.parse(f,x?.extensions?.namespace)}let de=function(){if(!w.length)return[];let ce=[];for(;;){let _e=v.parse(f),Ae=Y();if(!Ae){_e.length&&_("Stray extended attributes");break}te(Ae).extAttrs=_e,ce.push(Ae)}let ge=d.parse(f);return x.concrete&&ce.push(ge),ce}();return f.position<w.length&&_("Unrecognised tokens"),de}function Or(f,x={}){let w=new ut(f);return x.sourceName!==void 0&&(w.source.name=x.sourceName),Se(w,x)}function ze(f){return f}let Te={wrap:(f)=>f.join(""),trivia:ze,name:ze,reference:ze,type:ze,generic:ze,nameless:ze,inheritance:ze,definition:ze,extendedAttribute:ze,extendedAttributeReference:ze};class he{constructor(f){this.ts=Object.assign({},Te,f)}reference(f,{unescaped:x,context:w}){return x||(x=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,x,w)}token(f,x=ze,...w){if(!f)return"";let _=x(f.value,...w);return this.ts.wrap([this.ts.trivia(f.trivia),_])}reference_token(f,x){return this.token(f,this.reference.bind(this),{context:x})}name_token(f,x){return this.token(f,this.ts.name,x)}identifier(f,x){return this.ts.wrap([this.reference_token(f.tokens.value,x),this.token(f.tokens.separator)])}}function xt(f,{templates:x=Te}={}){x=Object.assign({},Te,x);let w=new he(x);return x.wrap(f.map((_)=>_.write(w)))}function st(f,x){let w=new Map,_=f.filter((A)=>A.type==="includes");for(let A of _){let B=x.get(A.includes);if(!B)continue;let Y=w.get(A.target);Y?Y.push(B):w.set(A.target,[B])}return w}function*ot(f){let x=function(w){let _=new Map,A=new Set,B=new Map;for(let Y of w)if(Y.partial){let de=B.get(Y.name);de?de.push(Y):B.set(Y.name,[Y])}else Y.name&&(_.has(Y.name)?A.add(Y):_.set(Y.name,Y));return{all:w,unique:_,partials:B,duplicates:A,mixinMap:st(w,_),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let w of x.all)w.validate&&(yield*w.validate(x));yield*function*({unique:w,duplicates:_}){for(let A of _){let{name:B}=A,Y=`The name "${B}" of type "${w.get(B).type}" was already seen`;yield s(A.tokens.name,A,"no-duplicate",Y)}}(x)}function Zt(f){return[...ot((x=f,x.flat?x.flat():[].concat(...x)))];var x}return t})())});var cw=C(function(UY,lw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",sw=Ne("fs").promises,iw=Ne("path"),lL=nw();class ow{constructor(e,t){this.filename=t,this.shortname=iw.basename(t,".idl"),this.path=iw.join(e,t)}async text(){return await sw.readFile(this.path,"utf8")}async parse(){let e=await this.text();return lL.parse(e)}}async function aw({folder:e=__dirname}={}){let t={},r=await sw.readdir(e);for(let n of r)if(n.endsWith(".idl")){let s=new ow(e,n);t[s.shortname]=s}return t}async function cL(e){let t=await aw(e);for(let[r,n]of Object.entries(t))t[r]=await n.parse();return t}lw.exports={listAll:aw,parseAll:cL}});var uw,dw;var fw=q(()=>{uw={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},dw={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var pw;var mw=q(()=>{pw={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"}});var hw,gw,yw;var bw=q(()=>{hw={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},gw={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},yw={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var xw;var $w=q(()=>{xw={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"}});var vw,ww;var Sw=q(()=>{vw={description:"A CEM-compatible parameter definition for a function. Follows the Custom Elements Manifest Parameter shape.",properties:{default:{description:"Default value for the parameter."},description:{description:"Parameter documentation.",type:"string"},name:{description:"Parameter name.",type:"string"},optional:{description:"Whether the parameter is optional.",type:"boolean"},type:{description:"Parameter type (JSON Schema or CEM { text } format)."}},required:["name"],type:"object"},ww={description:"A CEM-compatible event definition. Describes a CustomEvent the function dispatches.",properties:{deprecated:{description:"Deprecation notice.",oneOf:[{type:"boolean"},{type:"string"}]},description:{description:"Event documentation.",type:"string"},name:{description:"Event name (e.g. 'task-toggled').",type:"string"},type:{description:"Event type (e.g. { text: 'CustomEvent' })."}},required:["name"],type:"object"}});var Ew;var _w=q(()=>{Ew={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Pw,jw,kw,Rw,Aw,Ow,Cw,Nw,Tw;var Iw=q(()=>{Pw={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},jw={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},kw={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Rw={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Aw={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Ow={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},Cw={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Nw={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"},Tw={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Ol;var Mw=q(()=>{Ol={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"}});var Jw,Dw;var Lw=q(()=>{Jw={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Dw={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]}});var Fw,qw,Hw,Vw,Bw,tf;var Ww=q(()=>{Fw={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},qw={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},Hw={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Vw={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"},Bw={properties:{$switch:{$ref:"#/$defs/SwitchDef"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},type:"object"},tagName:{$ref:"#/$defs/TagName"}},required:["$switch","cases"],type:"object"},tf={additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"A Jx element definition. Maps directly to a DOM element.",properties:{"$map/index":{$ref:"#/$defs/RefObject"},"$map/item":{$ref:"#/$defs/RefObject"},$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"},$switch:{$ref:"#/$defs/SwitchDef"},alt:{$ref:"#/$defs/StringOrRef"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases for this element. Maps case values to element definitions or external component refs, rendered according to the reactive $switch discriminant.",type:"object"},checked:{$ref:"#/$defs/BoolOrRef"},children:{$ref:"#/$defs/ChildrenValue"},className:{$ref:"#/$defs/StringOrRef"},dir:{enum:["ltr","rtl","auto"],type:"string"},disabled:{$ref:"#/$defs/BoolOrRef"},hidden:{$ref:"#/$defs/BoolOrRef"},href:{$ref:"#/$defs/StringOrRef"},id:{type:"string"},innerHTML:{$ref:"#/$defs/StringOrRef"},innerText:{$ref:"#/$defs/StringOrRef"},lang:{$ref:"#/$defs/StringOrRef"},name:{$ref:"#/$defs/StringOrRef"},placeholder:{$ref:"#/$defs/StringOrRef"},selected:{$ref:"#/$defs/BoolOrRef"},src:{$ref:"#/$defs/StringOrRef"},style:{$ref:"#/$defs/StyleObject"},tabIndex:{$ref:"#/$defs/NumberOrRef"},tagName:{$ref:"#/$defs/ElementTagName"},textContent:{$ref:"#/$defs/StringOrRef"},title:{$ref:"#/$defs/StringOrRef"},type:{$ref:"#/$defs/StringOrRef"},value:{$ref:"#/$defs/StringOrRef"}},required:["tagName"],type:"object"}});var Uw;var zw=q(()=>{Uw={description:"A typed reactive state variable with explicit type and default value. The type property is a JSON Schema or $ref to a $defs type definition. The default property is the initial runtime value.",not:{required:["$prototype"]},properties:{$ref:{description:"Reference to a shared type definition.",type:"string"},attribute:{description:"Linked HTML attribute name for CEM extraction.",type:"string"},default:{description:"Initial state value."},deprecated:{description:"Deprecation notice for CEM extraction.",oneOf:[{type:"boolean"},{type:"string"}]},description:{type:"string"},examples:{type:"array"},reflects:{description:"Whether property changes reflect back to the HTML attribute.",type:"boolean"},type:{description:"JSON Schema type definition, $ref to a $defs type, or JSON Schema type string.",oneOf:[{type:"string"},{type:"object"}]}},required:["default"],type:"object"}});var Gw;var Kw=q(()=>{Gw={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive. First parameter is always state (the reactive scope).',properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: an opaque JS source string (first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → JS string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var Yw,Xw;var Zw=q(()=>{Yw={description:"One statement of a structured function body. Either a bare expression node in statement position (a mutation like =/push, or a call — its result discarded unless captured by an assignment), an if/then/else branch (JSON Schema conditional keywords; if holds a pure expression, then/else hold statement lists), a $switch multiway branch (discriminant matched by string form against cases keys, like element-level $switch), a dispatchEvent statement (WHATWG DOM: dispatches a CustomEvent from the handler's current target, with CustomEventInit members detail/bubbles/composed), or the two WHATWG event verbs stopPropagation and preventDefault, each spelled as the member set to true.",oneOf:[{$ref:"#/$defs/ExpressionNode"},{additionalProperties:!1,properties:{else:{items:{$ref:"#/$defs/Statement"},type:"array"},if:{$ref:"#/$defs/ExpressionOperand"},then:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["if","then"],title:"if / then / else — conditional branch (JSON Schema keyword triple)",type:"object"},{additionalProperties:!1,properties:{$switch:{$ref:"#/$defs/ExpressionOperand"},cases:{additionalProperties:{items:{$ref:"#/$defs/Statement"},type:"array"},type:"object"},default:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["$switch","cases"],title:"$switch / cases — multiway branch (element-level convention, ECMA switch semantics)",type:"object"},{additionalProperties:!1,properties:{bubbles:{type:"boolean"},composed:{type:"boolean"},detail:{$ref:"#/$defs/ExpressionOperand"},dispatchEvent:{description:"The CustomEvent type to dispatch (WHATWG DOM dispatchEvent).",type:"string"}},required:["dispatchEvent"],title:"dispatchEvent — emit a CustomEvent (WHATWG naming, CustomEventInit members)",type:"object"},{additionalProperties:!1,properties:{stopPropagation:{const:!0,description:"Stop the handler's event at the current target (WHATWG DOM stopPropagation), so an ancestor's handler for the same event does not run. A body run without an event has nothing to stop."}},required:["stopPropagation"],title:"stopPropagation — stop the event here (WHATWG DOM)",type:"object"},{additionalProperties:!1,properties:{preventDefault:{const:!0,description:"Cancel the handler's event's default action (WHATWG DOM preventDefault): a link's navigation, a form's submission, a key's scroll."}},required:["preventDefault"],title:"preventDefault — cancel the event's default action (WHATWG DOM)",type:"object"}]},Xw={description:"A structured function body: statements executed sequentially (one yielding a promise is awaited before the next, per ECMA async/await semantics).",items:{$ref:"#/$defs/Statement"},type:"array"}});var Qw;var e0=q(()=>{Qw={description:'An external class / data source. $prototype is a constructor name (not "Function"). When $prototype is not in the built-in registry, $src is required. All state entries are reactive by default.',properties:{$export:{description:"Named export in $src module. Defaults to the $prototype value.",type:"string"},$prototype:{description:"Constructor name — built-in Web API class or external class name.",examples:["Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream","MarkdownCollection","MyParser"],not:{const:"Function"},type:"string"},$src:{description:"External module specifier. Required when $prototype is not a built-in.",examples:["@jxsuite/md","./lib/my-parser.js","npm:@myorg/data"],type:"string"},autoIncrement:{type:"boolean"},body:{},database:{type:"string"},debounce:{minimum:0,type:"integer"},default:{},description:{type:"string"},domain:{type:"string"},filter:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single filter object, e.g. an equality shorthand.",type:"object"},{description:'Ordered filter rules, e.g. [{ field: "Slug", op: "not empty" }].',items:{type:"object"},type:"array"}],description:"Filter configuration: a reactive $ref binding, a single filter object, or an ordered array of rules."},headers:{additionalProperties:{type:"string"},type:"object"},indexes:{items:{properties:{keyPath:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},name:{type:"string"},unique:{type:"boolean"}},required:["name","keyPath"],type:"object"},type:"array"},items:{},key:{type:"string"},keyPath:{type:"string"},manual:{type:"boolean"},map:{$ref:"#/$defs/ElementDef"},maxAge:{type:"integer"},method:{enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],type:"string"},name:{type:"string"},path:{type:"string"},responseType:{enum:["json","text","blob","arraybuffer","document",""],type:"string"},sameSite:{enum:["strict","lax","none"],type:"string"},secure:{type:"boolean"},sort:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single sort rule, e.g. { field, order }.",type:"object"},{description:'Ordered sort rules, e.g. [{ field: "date", order: "desc" }].',items:{type:"object"},type:"array"}],description:"Sort configuration: a reactive $ref binding, a single { field, order } rule, or an ordered array of rules."},src:{description:"Configuration property passed to external class constructor.",type:"string"},store:{type:"string"},timing:{enum:["compiler","server","client"],type:"string"},url:{$ref:"#/$defs/StringOrRef"},version:{minimum:1,type:"integer"}},required:["$prototype"],type:"object"}});var t0;var r0=q(()=>{t0={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});var n0,s0,i0,o0,a0,l0,c0,u0,d0,f0,p0,m0,h0,g0,y0,b0,x0;var $0=q(()=>{eu();n0={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},s0={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."},i0={anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"},{$ref:"#/$defs/ExpressionLiteral"}],description:"Anything that may appear in target or value: a pointer, a literal, or a nested expression node."},o0={enum:["!","-"]},a0={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},l0={const:"?:"},c0={const:"switch"},u0={const:"call"},d0={description:"A genuine pure String.prototype / Array.prototype / Number.prototype method (spec §19.4d). The ES2023 change-by-copy family (toSorted, toReversed, toSpliced, with) stands in where mutation would otherwise occur. Receiver in target; value carries the argument (bare scalar) or argument list (array).",enum:["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]},f0={enum:["=","+=","-=","*=","/="]},p0={enum:["pop","shift"]},m0={enum:["push","unshift"]},h0={const:"splice"},g0={const:"reduce"},y0={enum:["map","filter"]},b0={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${Sh()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},x0={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"}});var v0,w0,S0,E0;var _0=q(()=>{v0={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]},w0={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},S0={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},E0={description:"A $defs type definition entry. Must be a pure JSON Schema type definition or a class definition (.class.json format).",oneOf:[{$ref:"#/$defs/PureTypeDef"},{$ref:"#/$defs/ClassDef"}]}});var uL,rf,nf,sf,of,af,lf,cf,uf,df,P0;var j0=q(()=>{uL=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],rf={description:"A typed parameter definition for a class.",properties:{default:{},description:{type:"string"},examples:{type:"array"},format:{description:`When "json-schema", this parameter's value is itself a JSON Schema.`,type:"string"},identifier:{type:"string"},type:{}},required:["identifier"],type:"object"},nf={description:"A class field definition with access control and scope.",properties:{$prototype:{description:'Data source prototype for this field (e.g., "Request").',type:"string"},access:{enum:["public","private","protected"],type:"string"},default:{},description:{type:"string"},examples:{type:"array"},identifier:{type:"string"},initializer:{},role:{const:"field",type:"string"},scope:{enum:["instance","static"],type:"string"},type:{}},type:"object"},sf={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},of={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:uL,type:"string"},scope:{enum:["instance","static"],type:"string"},setter:{properties:{body:{type:"string"},parameters:{type:"array"}},type:"object"},timing:{description:"Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",items:{enum:["compiler","server","client"],type:"string"},type:"array"}},type:"object"},af={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},lf={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},cf={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},uf={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"},df={description:"Studio control-surface hints for a format class: editor modes, document-mode rules, templates, and the element/nesting constraints that gate structural editing.",properties:{documentMode:{properties:{componentWhen:{description:"Treat the document as a component when this top-level/frontmatter key matches the regex.",properties:{frontmatterKey:{type:"string"},matches:{type:"string"}},type:"object"},default:{enum:["content","component"],type:"string"}},type:"object"},elements:{description:"Element allowlist and nesting constraints for structural editing.",properties:{block:{items:{type:"string"},type:"array"},inline:{items:{type:"string"},type:"array"},nesting:{additionalProperties:{properties:{block:{type:"boolean"},directive:{type:"boolean"},inline:{type:"boolean"},only:{items:{type:"string"},type:"array"}},type:"object"},description:'Per-parent child rules keyed by tag (or "_root"): { block, inline, directive } booleans or { only: [tags] }.',type:"object"},textOnly:{items:{type:"string"},type:"array"},void:{items:{type:"string"},type:"array"}},type:"object"},icon:{type:"string"},modes:{description:"Editor modes the studio offers for documents of this format.",items:{type:"string"},type:"array"},newFileTemplate:{description:"Initial source text for newly created files of this format.",type:"string"}},type:"object"},P0={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});var k0;var R0=q(()=>{k0={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"}});var Cl;var A0=q(()=>{Cl={description:"Image optimization configuration for the project.",properties:{formats:{items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" runs Sharp at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var dL,ff;var O0=q(()=>{hs();dL=[301,302,303,307,308],ff={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:_a,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:_a,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:_a,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...dL],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});function fL(){return C0??=pL(),C0}async function pL(){let[e,t,r]=await Promise.all([T0.listAll(),I0.default.listAll(),M0.default.parseAll()]),n=new Set;for(let{elements:c}of Object.values(e))for(let d of c)if(!d.obsolete)n.add(d.name);let s=[...n].toSorted(),i=new Set;for(let c of t.properties)for(let d of c.styleDeclaration??[])i.add(d);let o=[...i].toSorted(),a=new Set;for(let c of Object.values(r))for(let d of c){if(d.type!=="interface"&&d.type!=="interface mixin")continue;if(!d.members)continue;for(let p of d.members)if(p.type==="attribute"&&p.name?.startsWith("on")&&p.idlType?.idlType==="EventHandler")a.add(p.name)}let l=[...a].toSorted();return{cssProps:o,eventHandlers:l,tagExamples:s}}function mL(e){let t={};for(let r of e)t[r]={description:`Event handler for the "${r.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function hL(e){let t={...Ol.properties};for(let r of e)t[r]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function gL(){let{tagExamples:e,cssProps:t,eventHandlers:r}=await fL();return{$defs:{DefsMap:S0,TypeDefEntry:E0,StateMap:w0,StateEntry:v0,TypedStateDef:Uw,PureTypeDef:t0,FunctionDef:Gw,ClassDef:P0,ClassParameterDef:rf,ClassFieldDef:nf,ClassConstructorDef:sf,ClassMethodDef:of,FormatDef:af,ProjectBlockDef:lf,ServerBlockDef:cf,ConnectorBlockDef:uf,StudioHints:df,ExternalClassDef:Qw,ExpressionPointer:n0,ExpressionLiteral:s0,ExpressionOperand:i0,UnaryOperator:o0,BinaryOperator:a0,ConditionalOperator:l0,SwitchOperator:c0,CallOperator:u0,PureMethod:d0,AssignmentOperator:f0,NoArgMethod:p0,OneArgMethod:m0,SpliceMethod:h0,ReduceMethod:g0,MapFilterMethod:y0,ExpressionNode:b0,ExpressionEntry:x0,Statement:Yw,StatementList:Xw,ElementDef:{...tf,properties:{...tf.properties,...mL(r)}},ChildrenValue:Dw,ArrayNamespace:Jw,SwitchDef:Vw,SwitchNode:Bw,StyleObject:{...Ol,properties:hL(t)},AttributesObject:Fw,PropsObject:qw,RefObject:Nw,AnyRef:Cw,InternalRef:Pw,StateRef:jw,ExternalRef:kw,ExternalComponentRef:Tw,GlobalRef:Rw,ParentRef:Aw,MapRef:Ow,ElementPropertyValue:Hw,StringOrRef:hw,BoolOrRef:gw,NumberOrRef:yw,CemParameter:vw,CemEvent:ww,TagName:{...pw,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:uw,ElementTagName:dw,JsonSchemaType:Ew,HeadEntry:xw,ImageConfig:Cl,PathsValue:{$id:Es,anyOf:[...Po,zd],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:Es,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function yL(){return{$defs:{ImageConfig:Cl,StyleObject:J0},$id:"https://jxsuite.com/schema/project/v1",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:ff.properties,title:"Jx Project",type:"object"}}function bL(){return{$defs:{ImageConfig:Cl,JxFieldSchema:Tv,RelationshipRef:Iv,StyleObject:J0},$id:"https://jxsuite.com/schema/project/core/v2",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Core fragment of the Jx project.json schema. Open by design: extension fragments contribute their own top-level sections and the generated per-project entry document "+"(project.schema.json) closes the composition. See specs/extensions.md §5.",properties:ff.properties,title:"Jx Project Core",type:"object"}}function xL(){return{$id:_o,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/JxFieldSchema"},{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/RelationshipRef"}],description:"Default field-schema union for section entry schemas: the core field shape plus relationship references. Per-project entry documents override this resource with the "+"effective union. See specs/extensions.md §5.3.",title:"Jx Project Field Union"}}function $L(){return{$id:Es,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...Po,zd],description:"Default $paths-value union for documents: the core source shapes. Per-project entry documents override this resource with those members PLUS every extension-contributed paths shape.",title:"Jx Document Paths Union"}}function vL(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...k0}}function pf(){return{$defs:{ClassConstructorDef:sf,ClassFieldDef:nf,ClassMethodDef:of,ClassParameterDef:rf,ConnectorBlockDef:uf,FormatDef:af,ProjectBlockDef:lf,ServerBlockDef:cf,StudioHints:df},$id:"https://jxsuite.com/schema/class/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:!1,description:"Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",examples:["./md.js","./lib/calculator.js"],type:"string"},$prototype:{const:"Class",description:'Must be "Class" for class definition files.',type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",examples:["MarkdownFile","DataSource","Calculator"],type:"string"}},required:["$prototype","title"],title:"Jx Class Definition",type:"object"}}async function wL(e){let{mkdirSync:t,writeFileSync:r}=await import("node:fs"),{resolve:n,dirname:s}=await import("node:path"),i=s(n(e,"..")),o=await gL(),a=yL(),l=pf(),c=bL(),d=vL(),p=xL(),h=$L(),m=JSON.stringify(o,null,2),b=JSON.stringify(a,null,2),g=JSON.stringify(l,null,2),y=JSON.stringify(c,null,2),v=JSON.stringify(d,null,2),j=JSON.stringify(p,null,2),S=JSON.stringify(h,null,2),[P]=process.argv.slice(2);if(P)r(P,m,"utf8"),console.error(`Jx component schema written to ${P}`);else{r(n(i,"schema.json"),m,"utf8"),r(n(i,"project-schema.json"),b,"utf8"),r(n(i,"class-schema.json"),g,"utf8"),t(n(i,"schemas"),{recursive:!0}),r(n(i,"schemas","project.core.schema.json"),y,"utf8"),r(n(i,"schemas","project.fields.schema.json"),j,"utf8"),r(n(i,"schemas","document.paths.schema.json"),S,"utf8"),r(n(i,"extension-manifest.schema.json"),v,"utf8");let E=Bun.spawnSync(["bunx","oxfmt",n(i,"schemas","project.core.schema.json"),n(i,"schemas","project.fields.schema.json"),n(i,"schemas","document.paths.schema.json")],{cwd:i});if(E.exitCode!==0){let O=E.stderr.toString()||E.stdout.toString()||`exit ${E.exitCode}${E.signalCode?`, signal ${E.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${O})`)}console.error("Generated:"),console.error(" schema.json (component)"),console.error(" project-schema.json"),console.error(" class-schema.json"),console.error(" schemas/project.core.schema.json"),console.error(" schemas/project.fields.schema.json"),console.error(" schemas/document.paths.schema.json"),console.error(" extension-manifest.schema.json")}}var T0,I0,M0,C0=null,J0,N0,DX;var D0=q(()=>{fw();mw();bw();$w();Sw();_w();Iw();Mw();Lw();Ww();zw();Kw();Zw();e0();r0();$0();_0();j0();R0();kl();A0();O0();T0=Lt(Qv(),1),I0=Lt(rw(),1),M0=Lt(cw(),1);J0={...Ol,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,N0]=process.argv,DX=N0?.endsWith("schema.ts")?wL(N0):void 0});var Co=C(function(q0){Object.defineProperty(q0,"__esModule",{value:!0});q0.regexpCode=q0.getEsmExportName=q0.getProperty=q0.safeStringify=q0.stringify=q0.strConcat=q0.addCodeArg=q0.str=q0._=q0.nil=q0._Code=q0.Name=q0.IDENTIFIER=q0._CodeOrName=void 0;class Nl{}q0._CodeOrName=Nl;q0.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class gi extends Nl{constructor(e){super();if(!q0.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}q0.Name=gi;class _r extends Nl{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof gi)t[r.str]=(t[r.str]||0)+1;return t},{})}}q0._Code=_r;q0.nil=new _r("");function L0(e,...t){let r=[e[0]],n=0;while(n<t.length)hf(r,t[n]),r.push(e[++n]);return new _r(r)}q0._=L0;var mf=new _r("+");function F0(e,...t){let r=[Oo(e[0])],n=0;while(n<t.length)r.push(mf),hf(r,t[n]),r.push(mf,Oo(e[++n]));return SL(r),new _r(r)}q0.str=F0;function hf(e,t){if(t instanceof _r)e.push(...t._items);else if(t instanceof gi)e.push(t);else e.push(PL(t))}q0.addCodeArg=hf;function SL(e){let t=1;while(t<e.length-1){if(e[t]===mf){let r=EL(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function EL(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof gi||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof gi))return`"${e}${t.slice(1)}`;return}function _L(e,t){return t.emptyStr()?e:e.emptyStr()?t:F0`${e}${t}`}q0.strConcat=_L;function PL(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Oo(Array.isArray(e)?e.join(","):e)}function jL(e){return new _r(Oo(e))}q0.stringify=jL;function Oo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q0.safeStringify=Oo;function kL(e){return typeof e=="string"&&q0.IDENTIFIER.test(e)?new _r(`.${e}`):L0`[${e}]`}q0.getProperty=kL;function RL(e){if(typeof e=="string"&&q0.IDENTIFIER.test(e))return new _r(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}q0.getEsmExportName=RL;function AL(e){return new _r(e.toString())}q0.regexpCode=AL});var xf=C(function(W0){Object.defineProperty(W0,"__esModule",{value:!0});W0.ValueScope=W0.ValueScopeName=W0.Scope=W0.varKinds=W0.UsedValueState=void 0;var Ut=Co();class V0 extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Il;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Il||(W0.UsedValueState=Il={}));W0.varKinds={const:new Ut.Name("const"),let:new Ut.Name("let"),var:new Ut.Name("var")};class yf{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ut.Name?e:this.name(e)}name(e){return new Ut.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}W0.Scope=yf;class bf extends Ut.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ut._`.${new Ut.Name(t)}[${r}]`}}W0.ValueScopeName=bf;var VL=Ut._`\n`;class B0 extends yf{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?VL:Ut.nil}}get(){return this._scope}name(e){return new bf(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(r=t.key)!==null&&r!==void 0?r:t.ref,o=this._values[s];if(o){let c=o.get(i);if(c)return c}else o=this._values[s]=new Map;o.set(i,n);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,n.setValue(t,{property:s,itemIndex:l}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ut._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let s=Ut.nil;for(let i in e){let o=e[i];if(!o)continue;let a=r[i]=r[i]||new Map;o.forEach((l)=>{if(a.has(l))return;a.set(l,Il.Started);let c=t(l);if(c){let d=this.opts.es5?W0.varKinds.var:W0.varKinds.const;s=Ut._`${s}${d} ${l} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(l))s=Ut._`${s}${c}${this.opts._n}`;else throw new V0(l);a.set(l,Il.Completed)})}return s}}W0.ValueScope=B0});var ye=C(function(zt){Object.defineProperty(zt,"__esModule",{value:!0});zt.or=zt.and=zt.not=zt.CodeGen=zt.operators=zt.varKinds=zt.ValueScopeName=zt.ValueScope=zt.Scope=zt.Name=zt.regexpCode=zt.stringify=zt.getProperty=zt.nil=zt.strConcat=zt.str=zt._=void 0;var je=Co(),Pr=xf(),Wn=Co();Object.defineProperty(zt,"_",{enumerable:!0,get:function(){return Wn._}});Object.defineProperty(zt,"str",{enumerable:!0,get:function(){return Wn.str}});Object.defineProperty(zt,"strConcat",{enumerable:!0,get:function(){return Wn.strConcat}});Object.defineProperty(zt,"nil",{enumerable:!0,get:function(){return Wn.nil}});Object.defineProperty(zt,"getProperty",{enumerable:!0,get:function(){return Wn.getProperty}});Object.defineProperty(zt,"stringify",{enumerable:!0,get:function(){return Wn.stringify}});Object.defineProperty(zt,"regexpCode",{enumerable:!0,get:function(){return Wn.regexpCode}});Object.defineProperty(zt,"Name",{enumerable:!0,get:function(){return Wn.Name}});var ql=xf();Object.defineProperty(zt,"Scope",{enumerable:!0,get:function(){return ql.Scope}});Object.defineProperty(zt,"ValueScope",{enumerable:!0,get:function(){return ql.ValueScope}});Object.defineProperty(zt,"ValueScopeName",{enumerable:!0,get:function(){return ql.ValueScopeName}});Object.defineProperty(zt,"varKinds",{enumerable:!0,get:function(){return ql.varKinds}});zt.operators={GT:new je._Code(">"),GTE:new je._Code(">="),LT:new je._Code("<"),LTE:new je._Code("<="),EQ:new je._Code("==="),NEQ:new je._Code("!=="),NOT:new je._Code("!"),OR:new je._Code("||"),AND:new je._Code("&&"),ADD:new je._Code("+")};class Un{optimizeNodes(){return this}optimizeNames(e,t){return this}}class z0 extends Un{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?Pr.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=bi(this.rhs,e,t);return this}get names(){return this.rhs instanceof je._CodeOrName?this.rhs.names:{}}}class wf extends Un{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof je.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=bi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof je.Name?{}:{...this.lhs.names};return Fl(e,this.rhs)}}class G0 extends wf{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class K0 extends Un{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Y0 extends Un{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class X0 extends Un{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Z0 extends Un{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=bi(this.code,e,t),this}get names(){return this.code instanceof je._CodeOrName?this.code.names:{}}}class Hl extends Un{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let s=r[n];if(s.optimizeNames(e,t))continue;zL(e,s.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>_s(e,t.names),{})}}class zn extends Hl{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Q0 extends Hl{}class No extends zn{}No.kind="else";class vn extends zn{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new No(r):r}if(t){if(e===!1)return t instanceof vn?t:t.nodes;if(this.nodes.length)return this;return new vn(sS(e),t instanceof vn?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=bi(this.condition,e,t),this}get names(){let e=super.names;if(Fl(e,this.condition),this.else)_s(e,this.else.names);return e}}vn.kind="if";class yi extends zn{}yi.kind="for";class eS extends yi{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=bi(this.iteration,e,t),this}get names(){return _s(super.names,this.iteration.names)}}class tS extends yi{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?Pr.varKinds.var:this.varKind,{name:r,from:n,to:s}=this;return`for(${t} ${r}=${n}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=Fl(super.names,this.from);return Fl(e,this.to)}}class $f extends yi{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=bi(this.iterable,e,t),this}get names(){return _s(super.names,this.iterable.names)}}class Ml extends zn{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Ml.kind="func";class Jl extends Hl{render(e){return"return "+super.render(e)}}Jl.kind="return";class rS extends zn{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)_s(e,this.catch.names);if(this.finally)_s(e,this.finally.names);return e}}class Dl extends zn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Dl.kind="catch";class Ll extends zn{render(e){return"finally"+super.render(e)}}Ll.kind="finally";class nS{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
563
|
+
`:""},this._extScope=e,this._scope=new Pr.Scope({parent:e}),this._nodes=[new Q0]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let s=this._scope.toName(t);if(r!==void 0&&n)this._constants[s.str]=r;return this._leafNode(new z0(e,s,r)),s}const(e,t,r){return this._def(Pr.varKinds.const,e,t,r)}let(e,t,r){return this._def(Pr.varKinds.let,e,t,r)}var(e,t,r){return this._def(Pr.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new wf(e,t,r))}add(e,t){return this._leafNode(new G0(e,zt.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==je.nil)this._leafNode(new Z0(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),je.addCodeArg(t,n)}return t.push("}"),new je._Code(t)}if(e,t,r){if(this._blockNode(new vn(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new vn(e))}else(){return this._elseNode(new No)}endIf(){return this._endBlockNode(vn,No)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new eS(e),t)}forRange(e,t,r,n,s=this.opts.es5?Pr.varKinds.var:Pr.varKinds.let){let i=this._scope.toName(e);return this._for(new tS(s,i,t,r),()=>n(i))}forOf(e,t,r,n=Pr.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=t instanceof je.Name?t:this.var("_arr",t);return this.forRange("_i",0,je._`${i}.length`,(o)=>{this.var(s,je._`${i}[${o}]`),r(s)})}return this._for(new $f("of",n,s,t),()=>r(s))}forIn(e,t,r,n=this.opts.es5?Pr.varKinds.var:Pr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,je._`Object.keys(${t})`,r);let s=this._scope.toName(e);return this._for(new $f("in",n,s,t),()=>r(s))}endFor(){return this._endBlockNode(yi)}label(e){return this._leafNode(new K0(e))}break(e){return this._leafNode(new Y0(e))}return(e){let t=new Jl;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Jl)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new rS;if(this._blockNode(n),this.code(e),t){let s=this.name("e");this._currNode=n.catch=new Dl(s),t(s)}if(r)this._currNode=n.finally=new Ll,this.code(r);return this._endBlockNode(Dl,Ll)}throw(e){return this._leafNode(new X0(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=je.nil,r,n){if(this._blockNode(new Ml(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Ml)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof vn))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}zt.CodeGen=nS;function _s(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Fl(e,t){return t instanceof je._CodeOrName?_s(e,t.names):e}function bi(e,t,r){if(e instanceof je.Name)return n(e);if(!s(e))return e;return new je._Code(e._items.reduce((i,o)=>{if(o instanceof je.Name)o=n(o);if(o instanceof je._Code)i.push(...o._items);else i.push(o);return i},[]));function n(i){let o=r[i.str];if(o===void 0||t[i.str]!==1)return i;return delete t[i.str],o}function s(i){return i instanceof je._Code&&i._items.some((o)=>o instanceof je.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function zL(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function sS(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:je._`!${vf(e)}`}zt.not=sS;var GL=iS(zt.operators.AND);function KL(...e){return e.reduce(GL)}zt.and=KL;var YL=iS(zt.operators.OR);function XL(...e){return e.reduce(YL)}zt.or=XL;function iS(e){return(t,r)=>t===je.nil?r:r===je.nil?t:je._`${vf(t)} ${e} ${vf(r)}`}function vf(e){return e instanceof je.Name?e:je._`(${e})`}});var we=C(function(mS){Object.defineProperty(mS,"__esModule",{value:!0});mS.checkStrictMode=mS.getErrorPath=mS.Type=mS.useFunc=mS.setEvaluated=mS.evaluatedPropsToName=mS.mergeEvaluated=mS.eachItem=mS.unescapeJsonPointer=mS.escapeJsonPointer=mS.escapeFragment=mS.unescapeFragment=mS.schemaRefOrVal=mS.schemaHasRulesButRef=mS.schemaHasRules=mS.checkUnknownRules=mS.alwaysValidSchema=mS.toHash=void 0;var De=ye(),tF=Co();function rF(e){let t={};for(let r of e)t[r]=!0;return t}mS.toHash=rF;function nF(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return cS(e,t),!uS(t,e.self.RULES.all)}mS.alwaysValidSchema=nF;function cS(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let s=n.RULES.keywords;for(let i in t)if(!s[i])pS(e,`unknown keyword: "${i}"`)}mS.checkUnknownRules=cS;function uS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}mS.schemaHasRules=uS;function sF(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}mS.schemaHasRulesButRef=sF;function iF({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return De._`${r}`}return De._`${e}${t}${De.getProperty(n)}`}mS.schemaRefOrVal=iF;function oF(e){return dS(decodeURIComponent(e))}mS.unescapeFragment=oF;function aF(e){return encodeURIComponent(Ef(e))}mS.escapeFragment=aF;function Ef(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}mS.escapeJsonPointer=Ef;function dS(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}mS.unescapeJsonPointer=dS;function lF(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}mS.eachItem=lF;function aS({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let l=o===void 0?i:o instanceof De.Name?(i instanceof De.Name?e(s,i,o):t(s,i,o),o):i instanceof De.Name?(t(s,o,i),i):r(i,o);return a===De.Name&&!(l instanceof De.Name)?n(s,l):l}}mS.mergeEvaluated={props:aS({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>{e.if(De._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,De._`${r} || {}`).code(De._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,De._`${r} || {}`),_f(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:fS}),items:aS({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,De._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>e.assign(r,t===!0?!0:De._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function fS(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",De._`{}`);if(t!==void 0)_f(e,r,t);return r}mS.evaluatedPropsToName=fS;function _f(e,t,r){Object.keys(r).forEach((n)=>e.assign(De._`${t}${De.getProperty(n)}`,!0))}mS.setEvaluated=_f;var lS={};function cF(e,t){return e.scopeValue("func",{ref:t,code:lS[t.code]||(lS[t.code]=new tF._Code(t.code))})}mS.useFunc=cF;var Sf;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Sf||(mS.Type=Sf={}));function uF(e,t,r){if(e instanceof De.Name){let n=t===Sf.Num;return r?n?De._`"[" + ${e} + "]"`:De._`"['" + ${e} + "']"`:n?De._`"/" + ${e}`:De._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?De.getProperty(e).toString():"/"+Ef(e)}mS.getErrorPath=uF;function pS(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}mS.checkStrictMode=pS});var gr=C(function(gS){Object.defineProperty(gS,"__esModule",{value:!0});var St=ye(),kF={data:new St.Name("data"),valCxt:new St.Name("valCxt"),instancePath:new St.Name("instancePath"),parentData:new St.Name("parentData"),parentDataProperty:new St.Name("parentDataProperty"),rootData:new St.Name("rootData"),dynamicAnchors:new St.Name("dynamicAnchors"),vErrors:new St.Name("vErrors"),errors:new St.Name("errors"),this:new St.Name("this"),self:new St.Name("self"),scope:new St.Name("scope"),json:new St.Name("json"),jsonPos:new St.Name("jsonPos"),jsonLen:new St.Name("jsonLen"),jsonPart:new St.Name("jsonPart")};gS.default=kF});var To=C(function($S){Object.defineProperty($S,"__esModule",{value:!0});$S.extendErrors=$S.resetErrorsCount=$S.reportExtraError=$S.reportError=$S.keyword$DataError=$S.keywordError=void 0;var Re=ye(),Bl=we(),Ct=gr();$S.keywordError={message:({keyword:e})=>Re.str`must pass "${e}" keyword validation`};$S.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Re.str`"${e}" keyword must be ${t} ($data)`:Re.str`"${e}" keyword is invalid ($data)`};function AF(e,t=$S.keywordError,r,n){let{it:s}=e,{gen:i,compositeRule:o,allErrors:a}=s,l=xS(e,t,r);if(n!==null&&n!==void 0?n:o||a)yS(i,l);else bS(s,Re._`[${l}]`)}$S.reportError=AF;function OF(e,t=$S.keywordError,r){let{it:n}=e,{gen:s,compositeRule:i,allErrors:o}=n,a=xS(e,t,r);if(yS(s,a),!(i||o))bS(n,Ct.default.vErrors)}$S.reportExtraError=OF;function CF(e,t){e.assign(Ct.default.errors,t),e.if(Re._`${Ct.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Re._`${Ct.default.vErrors}.length`,t),()=>e.assign(Ct.default.vErrors,null)))}$S.resetErrorsCount=CF;function NF({gen:e,keyword:t,schemaValue:r,data:n,errsCount:s,it:i}){if(s===void 0)throw Error("ajv implementation error");let o=e.name("err");e.forRange("i",s,Ct.default.errors,(a)=>{if(e.const(o,Re._`${Ct.default.vErrors}[${a}]`),e.if(Re._`${o}.instancePath === undefined`,()=>e.assign(Re._`${o}.instancePath`,Re.strConcat(Ct.default.instancePath,i.errorPath))),e.assign(Re._`${o}.schemaPath`,Re.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(Re._`${o}.schema`,r),e.assign(Re._`${o}.data`,n)})}$S.extendErrors=NF;function yS(e,t){let r=e.const("err",t);e.if(Re._`${Ct.default.vErrors} === null`,()=>e.assign(Ct.default.vErrors,Re._`[${r}]`),Re._`${Ct.default.vErrors}.push(${r})`),e.code(Re._`${Ct.default.errors}++`)}function bS(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;if(s.$async)r.throw(Re._`new ${e.ValidationError}(${t})`);else r.assign(Re._`${n}.errors`,t),r.return(!1)}var Ps={keyword:new Re.Name("keyword"),schemaPath:new Re.Name("schemaPath"),params:new Re.Name("params"),propertyName:new Re.Name("propertyName"),message:new Re.Name("message"),schema:new Re.Name("schema"),parentSchema:new Re.Name("parentSchema")};function xS(e,t,r){let{createErrors:n}=e.it;if(n===!1)return Re._`{}`;return TF(e,t,r)}function TF(e,t,r={}){let{gen:n,it:s}=e,i=[IF(s,r),MF(e,r)];return JF(e,t,i),n.object(...i)}function IF({errorPath:e},{instancePath:t}){let r=t?Re.str`${e}${Bl.getErrorPath(t,Bl.Type.Str)}`:e;return[Ct.default.instancePath,Re.strConcat(Ct.default.instancePath,r)]}function MF({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:Re.str`${t}/${e}`;if(r)s=Re.str`${s}${Bl.getErrorPath(r,Bl.Type.Str)}`;return[Ps.schemaPath,s]}function JF(e,{params:t,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=e,{opts:l,propertyName:c,topSchemaRef:d,schemaPath:p}=a;if(n.push([Ps.keyword,s],[Ps.params,typeof t=="function"?t(e):t||Re._`{}`]),l.messages)n.push([Ps.message,typeof r=="function"?r(e):r]);if(l.verbose)n.push([Ps.schema,o],[Ps.parentSchema,Re._`${d}${p}`],[Ct.default.data,i]);if(c)n.push([Ps.propertyName,c])}});var _S=C(function(SS){Object.defineProperty(SS,"__esModule",{value:!0});SS.boolOrEmptySchema=SS.topBoolOrEmptySchema=void 0;var HF=To(),VF=ye(),BF=gr(),WF={message:"boolean schema is false"};function UF(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)wS(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(BF.default.data);else t.assign(VF._`${n}.errors`,null),t.return(!0)}SS.topBoolOrEmptySchema=UF;function zF(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),wS(e);else r.var(t,!0)}SS.boolOrEmptySchema=zF;function wS(e,t){let{gen:r,data:n}=e;HF.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},WF,void 0,t)}});var jf=C(function(PS){Object.defineProperty(PS,"__esModule",{value:!0});PS.getRules=PS.isJSONType=void 0;var KF=["string","number","integer","boolean","null","object","array"],YF=new Set(KF);function XF(e){return typeof e=="string"&&YF.has(e)}PS.isJSONType=XF;function ZF(){let 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:{}}}PS.getRules=ZF});var kf=C(function(AS){Object.defineProperty(AS,"__esModule",{value:!0});AS.shouldUseRule=AS.shouldUseGroup=AS.schemaHasRulesForType=void 0;function eq({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&kS(e,n)}AS.schemaHasRulesForType=eq;function kS(e,t){return t.rules.some((r)=>RS(e,r))}AS.shouldUseGroup=kS;function RS(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))}AS.shouldUseRule=RS});var Io=C(function(IS){Object.defineProperty(IS,"__esModule",{value:!0});IS.reportTypeError=IS.checkDataTypes=IS.checkDataType=IS.coerceAndCheckDataType=IS.getJSONTypes=IS.getSchemaTypes=IS.DataType=void 0;var nq=jf(),sq=kf(),iq=To(),xe=ye(),CS=we(),xi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(xi||(IS.DataType=xi={}));function oq(e){let t=NS(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}IS.getSchemaTypes=oq;function NS(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(nq.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}IS.getJSONTypes=NS;function aq(e,t){let{gen:r,data:n,opts:s}=e,i=lq(t,s.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&sq.schemaHasRulesForType(e,t[0]));if(o){let a=Af(t,n,s.strictNumbers,xi.Wrong);r.if(a,()=>{if(i.length)cq(e,t,i);else Of(e)})}return o}IS.coerceAndCheckDataType=aq;var TS=new Set(["string","number","integer","boolean","null"]);function lq(e,t){return t?e.filter((r)=>TS.has(r)||t==="array"&&r==="array"):[]}function cq(e,t,r){let{gen:n,data:s,opts:i}=e,o=n.let("dataType",xe._`typeof ${s}`),a=n.let("coerced",xe._`undefined`);if(i.coerceTypes==="array")n.if(xe._`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,xe._`${s}[0]`).assign(o,xe._`typeof ${s}`).if(Af(t,s,i.strictNumbers),()=>n.assign(a,s)));n.if(xe._`${a} !== undefined`);for(let c of r)if(TS.has(c)||c==="array"&&i.coerceTypes==="array")l(c);n.else(),Of(e),n.endIf(),n.if(xe._`${a} !== undefined`,()=>{n.assign(s,a),uq(e,a)});function l(c){switch(c){case"string":n.elseIf(xe._`${o} == "number" || ${o} == "boolean"`).assign(a,xe._`"" + ${s}`).elseIf(xe._`${s} === null`).assign(a,xe._`""`);return;case"number":n.elseIf(xe._`${o} == "boolean" || ${s} === null
|
|
566
564
|
|| (${o} == "string" && ${s} && ${s} == +${s})`).assign(a,xe._`+${s}`);return;case"integer":n.elseIf(xe._`${o} === "boolean" || ${s} === null
|
|
567
565
|
|| (${o} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,xe._`+${s}`);return;case"boolean":n.elseIf(xe._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(xe._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf(xe._`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf(xe._`${o} === "string" || ${o} === "number"
|
|
568
|
-
|| ${o} === "boolean" || ${s} === null`).assign(a,xe._`[${s}]`)}}}function nq({gen:e,parentData:t,parentDataProperty:r},n){e.if(xe._`${t} !== undefined`,()=>e.assign(xe._`${t}[${r}]`,n))}function Of(e,t,r,n=xi.Correct){let s=n===xi.Correct?xe.operators.EQ:xe.operators.NEQ,i;switch(e){case"null":return xe._`${t} ${s} null`;case"array":i=xe._`Array.isArray(${t})`;break;case"object":i=xe._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o(xe._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return xe._`typeof ${t} ${s} ${e}`}return n===xi.Correct?i:xe.not(i);function o(a=xe.nil){return xe.and(xe._`typeof ${t} == "number"`,a,r?xe._`isFinite(${t})`:xe.nil)}}JS.checkDataType=Of;function Cf(e,t,r,n){if(e.length===1)return Of(e[0],t,r,n);let s,i=NS.toHash(e);if(i.array&&i.object){let o=xe._`typeof ${t} != "object"`;s=i.null?o:xe._`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else s=xe.nil;if(i.number)delete i.integer;for(let o in i)s=xe.and(s,Of(o,t,r,n));return s}JS.checkDataTypes=Cf;var sq={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?xe._`{type: ${e}}`:xe._`{type: ${t}}`};function Tf(e){let t=iq(e);ZF.reportError(t,sq)}JS.reportTypeError=Tf;function iq(e){let{gen:t,data:r,schema:n}=e,s=NS.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var HS=C(function(FS){Object.defineProperty(FS,"__esModule",{value:!0});FS.assignDefaults=void 0;var $i=ye(),fq=we();function pq(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)LS(e,s,r[s].default);else if(t==="array"&&Array.isArray(n))n.forEach((s,i)=>LS(e,i,s.default))}FS.assignDefaults=pq;function LS(e,t,r){let{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;let a=$i._`${i}${$i.getProperty(t)}`;if(s){fq.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=$i._`${a} === undefined`;if(o.useDefaults==="empty")l=$i._`${l} || ${a} === null || ${a} === ""`;n.if(l,$i._`${a} = ${$i.stringify(r)}`)}});var yr=C(function(BS){Object.defineProperty(BS,"__esModule",{value:!0});BS.validateUnion=BS.validateArray=BS.usePattern=BS.callValidateCode=BS.schemaProperties=BS.allSchemaProperties=BS.noPropertyInData=BS.propertyInData=BS.isOwnProperty=BS.hasPropFunc=BS.reportMissingProp=BS.checkMissingProp=BS.checkReportMissingProp=void 0;var He=ye(),Nf=we(),zn=gr(),mq=we();function hq(e,t){let{gen:r,data:n,it:s}=e;r.if(Mf(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:He._`${t}`},!0),e.error()})}BS.checkReportMissingProp=hq;function gq({gen:e,data:t,it:{opts:r}},n,s){return He.or(...n.map((i)=>He.and(Mf(e,t,i,r.ownProperties),He._`${s} = ${i}`)))}BS.checkMissingProp=gq;function yq(e,t){e.setParams({missingProperty:t},!0),e.error()}BS.reportMissingProp=yq;function VS(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:He._`Object.prototype.hasOwnProperty`})}BS.hasPropFunc=VS;function If(e,t,r){return He._`${VS(e)}.call(${t}, ${r})`}BS.isOwnProperty=If;function bq(e,t,r,n){let s=He._`${t}${He.getProperty(r)} !== undefined`;return n?He._`${s} && ${If(e,t,r)}`:s}BS.propertyInData=bq;function Mf(e,t,r,n){let s=He._`${t}${He.getProperty(r)} === undefined`;return n?He.or(s,He.not(If(e,t,r))):s}BS.noPropertyInData=Mf;function WS(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}BS.allSchemaProperties=WS;function xq(e,t){return WS(t).filter((r)=>!Nf.alwaysValidSchema(e,t[r]))}BS.schemaProperties=xq;function $q({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,l,c){let d=c?He._`${e}, ${t}, ${n}${s}`:t,p=[[zn.default.instancePath,He.strConcat(zn.default.instancePath,i)],[zn.default.parentData,o.parentData],[zn.default.parentDataProperty,o.parentDataProperty],[zn.default.rootData,zn.default.rootData]];if(o.opts.dynamicRef)p.push([zn.default.dynamicAnchors,zn.default.dynamicAnchors]);let h=He._`${d}, ${r.object(...p)}`;return l!==He.nil?He._`${a}.call(${l}, ${h})`:He._`${a}(${h})`}BS.callValidateCode=$q;var vq=He._`new RegExp`;function wq({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:He._`${s.code==="new RegExp"?vq:mq.useFunc(e,s)}(${r}, ${n})`})}BS.usePattern=wq;function Sq(e){let{gen:t,data:r,keyword:n,it:s}=e,i=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return o(()=>t.assign(a,!1)),a}return t.var(i,!0),o(()=>t.break()),i;function o(a){let l=t.const("len",He._`${r}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:Nf.Type.Num},i),t.if(He.not(i),a)})}}BS.validateArray=Sq;function Eq(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((l)=>Nf.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let o=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let d=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(o,He._`${o} || ${a}`),!e.mergeValidEvaluated(d,a))t.if(He.not(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}BS.validateUnion=Eq});var XS=C(function(KS){Object.defineProperty(KS,"__esModule",{value:!0});KS.validateKeywordUsage=KS.validSchemaType=KS.funcKeywordCode=KS.macroKeywordCode=void 0;var Nt=ye(),js=gr(),Jq=yr(),Dq=Do();function Lq(e,t){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,a=t.macro.call(o.self,s,i,o),l=GS(r,n,a);if(o.opts.validateSchema!==!1)o.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:Nt.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}KS.macroKeywordCode=Lq;function Fq(e,t){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:l}=e;Hq(l,t);let c=!a&&t.compile?t.compile.call(l.self,i,o,l):t.validate,d=GS(n,s,c),p=n.let("valid");e.block$data(p,h),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function h(){if(t.errors===!1){if(g(),t.modifying)zS(e);y(()=>e.error())}else{let v=t.async?m():b();if(t.modifying)zS(e);y(()=>qq(e,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>g(Nt._`await `),(j)=>n.assign(p,!1).if(Nt._`${j} instanceof ${l.ValidationError}`,()=>n.assign(v,Nt._`${j}.errors`),()=>n.throw(j))),v}function b(){let v=Nt._`${d}.errors`;return n.assign(v,null),g(Nt.nil),v}function g(v=t.async?Nt._`await `:Nt.nil){let j=l.opts.passContext?js.default.this:js.default.self,S=!(("compile"in t)&&!a||t.schema===!1);n.assign(p,Nt._`${v}${Jq.callValidateCode(e,d,j,S)}`,t.modifying)}function y(v){var j;n.if(Nt.not((j=t.valid)!==null&&j!==void 0?j:p),v)}}KS.funcKeywordCode=Fq;function zS(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Nt._`${n.parentData}[${n.parentDataProperty}]`))}function qq(e,t){let{gen:r}=e;r.if(Nt._`Array.isArray(${t})`,()=>{r.assign(js.default.vErrors,Nt._`${js.default.vErrors} === null ? ${t} : ${js.default.vErrors}.concat(${t})`).assign(js.default.errors,Nt._`${js.default.vErrors}.length`),Dq.extendErrors(e)},()=>e.error())}function Hq({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function GS(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:Nt.stringify(r)})}function Vq(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")}KS.validSchemaType=Vq;function Wq({schema:e,opts:t,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw Error("ajv implementation error");let o=s.dependencies;if(o===null||o===void 0?void 0:o.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[i])){let l=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(l);else throw Error(l)}}}KS.validateKeywordUsage=Wq});var t1=C(function(QS){Object.defineProperty(QS,"__esModule",{value:!0});QS.extendSubschemaMode=QS.extendSubschemaData=QS.getSubschema=void 0;var zr=ye(),ZS=we();function Gq(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:zr._`${e.schemaPath}${zr.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:zr._`${e.schemaPath}${zr.getProperty(t)}${zr.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${ZS.escapeFragment(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}QS.getSubschema=Gq;function Kq(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:d,opts:p}=t,h=a.let("data",zr._`${t.data}${zr.getProperty(r)}`,!0);l(h),e.errorPath=zr.str`${c}${ZS.getErrorPath(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=zr._`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(s!==void 0){let c=s instanceof zr.Name?s:a.let("data",s,!0);if(l(c),o!==void 0)e.propertyName=o}if(i)e.dataTypes=i;function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}QS.extendSubschemaData=Kq;function Yq(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){if(n!==void 0)e.compositeRule=n;if(s!==void 0)e.createErrors=s;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}QS.extendSubschemaMode=Yq});var Jf=C(function(rZ,r1){r1.exports=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}});var s1=C(function(nZ,n1){var Gn=n1.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};zl(t,n,s,e,"",e)};Gn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Gn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Gn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Gn.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 zl(e,t,r,n,s,i,o,a,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,a,l,c);for(var d in n){var p=n[d];if(Array.isArray(p)){if(d in Gn.arrayKeywords)for(var h=0;h<p.length;h++)zl(e,t,r,p[h],s+"/"+d+"/"+h,i,s,d,n,h)}else if(d in Gn.propsKeywords){if(p&&typeof p=="object")for(var m in p)zl(e,t,r,p[m],s+"/"+d+"/"+Qq(m),i,s,d,n,m)}else if(d in Gn.keywords||e.allKeys&&!(d in Gn.skipKeywords))zl(e,t,r,p,s+"/"+d,i,s,d,n)}r(n,s,i,o,a,l,c)}}function Qq(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Fo=C(function(l1){Object.defineProperty(l1,"__esModule",{value:!0});l1.getSchemaRefs=l1.resolveUrl=l1.normalizeId=l1._getFullPath=l1.getFullPath=l1.inlineRef=void 0;var e5=we(),t5=Jf(),r5=s1(),n5=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s5(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Df(e);if(!t)return!1;return i1(e)<=t}l1.inlineRef=s5;var i5=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Df(e){for(let t in e){if(i5.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Df))return!0;if(typeof r=="object"&&Df(r))return!0}return!1}function i1(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,n5.has(r))continue;if(typeof e[r]=="object")e5.eachItem(e[r],(n)=>t+=i1(n));if(t===1/0)return 1/0}return t}function o1(e,t="",r){if(r!==!1)t=vi(t);let n=e.parse(t);return a1(e,n)}l1.getFullPath=o1;function a1(e,t){return e.serialize(t).split("#")[0]+"#"}l1._getFullPath=a1;var o5=/#\/?$/;function vi(e){return e?e.replace(o5,""):""}l1.normalizeId=vi;function a5(e,t,r){return r=vi(r),e.resolve(t,r)}l1.resolveUrl=a5;var l5=/^[a-z_][-a-z0-9._]*$/i;function c5(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=vi(e[r]||t),i={"":s},o=o1(n,s,!1),a={},l=new Set;return r5(e,{allKeys:!0},(p,h,m,b)=>{if(b===void 0)return;let g=o+h,y=i[b];if(typeof p[r]=="string")y=v.call(this,p[r]);j.call(this,p.$anchor),j.call(this,p.$dynamicAnchor),i[h]=y;function v(S){let P=this.opts.uriResolver.resolve;if(S=vi(y?P(y,S):S),l.has(S))throw d(S);l.add(S);let E=this.refs[S];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")c(p,E.schema,S);else if(S!==vi(g))if(S[0]==="#")c(p,a[S],S),a[S]=p;else this.refs[S]=g;return S}function j(S){if(typeof S=="string"){if(!l5.test(S))throw Error(`invalid anchor "${S}"`);v.call(this,`#${S}`)}}}),a;function c(p,h,m){if(h!==void 0&&!t5(p,h))throw d(m)}function d(p){return Error(`reference "${p}" resolves to more than one schema`)}}l1.getSchemaRefs=c5});var wi=C(function(E1){Object.defineProperty(E1,"__esModule",{value:!0});E1.getData=E1.KeywordCxt=E1.validateFunctionCode=void 0;var p1=jS(),m1=Lo(),Lf=Af(),Gl=Lo(),h5=HS(),qo=XS(),Ff=t1(),ne=ye(),me=gr(),g5=Fo(),vn=we(),Ho=Do();function y5(e){if(y1(e)){if(b1(e),g1(e)){$5(e);return}}h1(e,()=>p1.topBoolOrEmptySchema(e))}E1.validateFunctionCode=y5;function h1({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){if(s.code.es5)e.func(t,ne._`${me.default.data}, ${me.default.valCxt}`,n.$async,()=>{e.code(ne._`"use strict"; ${u1(r,s)}`),x5(e,s),e.code(i)});else e.func(t,ne._`${me.default.data}, ${b5(s)}`,n.$async,()=>e.code(u1(r,s)).code(i))}function b5(e){return ne._`{${me.default.instancePath}="", ${me.default.parentData}, ${me.default.parentDataProperty}, ${me.default.rootData}=${me.default.data}${e.dynamicRef?ne._`, ${me.default.dynamicAnchors}={}`:ne.nil}}={}`}function x5(e,t){e.if(me.default.valCxt,()=>{if(e.var(me.default.instancePath,ne._`${me.default.valCxt}.${me.default.instancePath}`),e.var(me.default.parentData,ne._`${me.default.valCxt}.${me.default.parentData}`),e.var(me.default.parentDataProperty,ne._`${me.default.valCxt}.${me.default.parentDataProperty}`),e.var(me.default.rootData,ne._`${me.default.valCxt}.${me.default.rootData}`),t.dynamicRef)e.var(me.default.dynamicAnchors,ne._`${me.default.valCxt}.${me.default.dynamicAnchors}`)},()=>{if(e.var(me.default.instancePath,ne._`""`),e.var(me.default.parentData,ne._`undefined`),e.var(me.default.parentDataProperty,ne._`undefined`),e.var(me.default.rootData,me.default.data),t.dynamicRef)e.var(me.default.dynamicAnchors,ne._`{}`)})}function $5(e){let{schema:t,opts:r,gen:n}=e;h1(e,()=>{if(r.$comment&&t.$comment)$1(e);if(_5(e),n.let(me.default.vErrors,null),n.let(me.default.errors,0),r.unevaluated)v5(e);x1(e),k5(e)});return}function v5(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",ne._`${r}.evaluated`),t.if(ne._`${e.evaluated}.dynamicProps`,()=>t.assign(ne._`${e.evaluated}.props`,ne._`undefined`)),t.if(ne._`${e.evaluated}.dynamicItems`,()=>t.assign(ne._`${e.evaluated}.items`,ne._`undefined`))}function u1(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?ne._`/*# sourceURL=${r} */`:ne.nil}function w5(e,t){if(y1(e)){if(b1(e),g1(e)){S5(e,t);return}}p1.boolOrEmptySchema(e,t)}function g1({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function y1(e){return typeof e.schema!="boolean"}function S5(e,t){let{schema:r,gen:n,opts:s}=e;if(s.$comment&&r.$comment)$1(e);P5(e),j5(e);let i=n.const("_errs",me.default.errors);x1(e,i),n.var(t,ne._`${i} === ${me.default.errors}`)}function b1(e){vn.checkUnknownRules(e),E5(e)}function x1(e,t){if(e.opts.jtd)return d1(e,[],!1,t);let r=m1.getSchemaTypes(e.schema),n=m1.coerceAndCheckDataType(e,r);d1(e,r,!n,t)}function E5(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&vn.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function _5(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)vn.checkStrictMode(e,"default is ignored in the schema root")}function P5(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=g5.resolveUrl(e.opts.uriResolver,e.baseId,t)}function j5(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function $1({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)e.code(ne._`${me.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=ne.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(ne._`${me.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function k5(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;if(r.$async)t.if(ne._`${me.default.errors} === 0`,()=>t.return(me.default.data),()=>t.throw(ne._`new ${s}(${me.default.vErrors})`));else{if(t.assign(ne._`${n}.errors`,me.default.vErrors),i.unevaluated)R5(e);t.return(ne._`${me.default.errors} === 0`)}}function R5({gen:e,evaluated:t,props:r,items:n}){if(r instanceof ne.Name)e.assign(ne._`${t}.props`,r);if(n instanceof ne.Name)e.assign(ne._`${t}.items`,n)}function d1(e,t,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:l,self:c}=e,{RULES:d}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!vn.schemaHasRulesButRef(i,d))){s.block(()=>w1(e,"$ref",d.all.$ref.definition));return}if(!l.jtd)A5(e,t);s.block(()=>{for(let h of d.rules)p(h);p(d.post)});function p(h){if(!Lf.shouldUseGroup(i,h))return;if(h.type){if(s.if(Gl.checkDataType(h.type,o,l.strictNumbers)),f1(e,h),t.length===1&&t[0]===h.type&&r)s.else(),Gl.reportTypeError(e);s.endIf()}else f1(e,h);if(!a)s.if(ne._`${me.default.errors} === ${n||0}`)}}function f1(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;if(s)h5.assignDefaults(e,t.type);r.block(()=>{for(let i of t.rules)if(Lf.shouldUseRule(n,i))w1(e,i.keyword,i.definition,t.type)})}function A5(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(O5(e,t),!e.opts.allowUnionTypes)C5(e,t);T5(e,e.dataTypes)}function O5(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!v1(e.dataTypes,r))qf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),I5(e,t)}function C5(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))qf(e,"use allowUnionTypes to allow union type keyword")}function T5(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&Lf.shouldUseRule(e.schema,s)){let{type:i}=s.definition;if(i.length&&!i.some((o)=>N5(t,o)))qf(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function N5(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function v1(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function I5(e,t){let r=[];for(let n of e.dataTypes)if(v1(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function qf(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,vn.checkStrictMode(e,t,e.opts.strictTypes)}class Hf{constructor(e,t,r){if(qo.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=vn.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",S1(this.$data,e));else if(this.schemaCode=this.schemaValue,!qo.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",me.default.errors)}result(e,t,r){this.failResult(ne.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(ne.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(ne._`${t} !== undefined && (${ne.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Ho.reportExtraError:Ho.reportError)(this,this.def.error,t)}$dataError(){Ho.reportError(this,this.def.$dataError||Ho.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Ho.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=ne.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=ne.nil,t=ne.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:s,def:i}=this;if(r.if(ne.or(ne._`${n} === undefined`,t)),e!==ne.nil)r.assign(e,!0);if(s.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:s}=this;return ne.or(i(),o());function i(){if(r.length){if(!(t instanceof ne.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return ne._`${Gl.checkDataTypes(a,t,s.opts.strictNumbers,Gl.DataType.Wrong)}`}return ne.nil}function o(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return ne._`!${a}(${t})`}return ne.nil}}subschema(e,t){let r=Ff.getSubschema(this.it,e);Ff.extendSubschemaData(r,this.it,e),Ff.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return w5(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=vn.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=vn.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,ne.Name)),!0}}E1.KeywordCxt=Hf;function w1(e,t,r,n){let s=new Hf(e,r,t);if("code"in r)r.code(s,n);else if(s.$data&&r.validate)qo.funcKeywordCode(s,r);else if("macro"in r)qo.macroKeywordCode(s,r);else if(r.compile||r.validate)qo.funcKeywordCode(s,r)}var M5=/^\/(?:[^~]|~0|~1)*$/,J5=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function S1(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return me.default.rootData;if(e[0]==="/"){if(!M5.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=me.default.rootData}else{let c=J5.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let d=+c[1];if(s=c[2],s==="#"){if(d>=t)throw Error(l("property/index",d));return n[t-d]}if(d>t)throw Error(l("data",d));if(i=r[t-d],!s)return i}let o=i,a=s.split("/");for(let c of a)if(c)i=ne._`${i}${ne.getProperty(vn.unescapeJsonPointer(c))}`,o=ne._`${o} && ${i}`;return o;function l(c,d){return`Cannot access ${c} ${d} levels up, current level is ${t}`}}E1.getData=S1});var Vo=C(function(j1){Object.defineProperty(j1,"__esModule",{value:!0});class P1 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}j1.default=P1});var Si=C(function(R1){Object.defineProperty(R1,"__esModule",{value:!0});var Vf=Fo();class k1 extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Vf.resolveUrl(e,t,r),this.missingSchema=Vf.normalizeId(Vf.getFullPath(e,this.missingRef))}}R1.default=k1});var Bo=C(function(C1){Object.defineProperty(C1,"__esModule",{value:!0});C1.resolveSchema=C1.getCompilingSchema=C1.resolveRef=C1.compileSchema=C1.SchemaEnv=void 0;var jr=ye(),H5=Vo(),ks=gr(),kr=Fo(),A1=we(),V5=wi();class Wo{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:kr.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}C1.SchemaEnv=Wo;function Bf(e){let t=O1.call(this,e);if(t)return t;let r=kr.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new jr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;if(e.$async)a=o.scopeValue("Error",{ref:H5.default,code:jr._`require("ajv/dist/runtime/validation_error").default`});let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:ks.default.data,parentData:ks.default.parentData,parentDataProperty:ks.default.parentDataProperty,dataNames:[ks.default.data],dataPathArr:[jr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:jr.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:jr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:jr._`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),V5.validateFunctionCode(c),o.optimize(this.opts.code.optimize);let p=o.toString();if(d=`${o.scopeRefs(ks.default.scope)}return ${p}`,this.opts.code.process)d=this.opts.code.process(d,e);let m=Function(`${ks.default.self}`,`${ks.default.scope}`,d)(this,this.scope.get());if(this.scope.value(l,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:l,validateCode:p,scopeValues:o._values};if(this.opts.unevaluated){let{props:b,items:g}=c;if(m.evaluated={props:b instanceof jr.Name?void 0:b,items:g instanceof jr.Name?void 0:g,dynamicProps:b instanceof jr.Name,dynamicItems:g instanceof jr.Name},m.source)m.source.evaluated=jr.stringify(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,d)this.logger.error("Error compiling schema, function code:",d);throw p}finally{this._compilations.delete(e)}}C1.compileSchema=Bf;function W5(e,t,r){var n;r=kr.resolveUrl(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=z5.call(this,e,r);if(i===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(o)i=new Wo({schema:o,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=B5.call(this,i)}C1.resolveRef=W5;function B5(e){if(kr.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Bf.call(this,e)}function O1(e){for(let t of this._compilations)if(U5(t,e))return t}C1.getCompilingSchema=O1;function U5(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function z5(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Kl.call(this,e,t)}function Kl(e,t){let r=this.opts.uriResolver.parse(t),n=kr._getFullPath(this.opts.uriResolver,r),s=kr.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Wf.call(this,r,e);let i=kr.normalizeId(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=Kl.call(this,e,o);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Wf.call(this,r,a)}if(typeof(o===null||o===void 0?void 0:o.schema)!=="object")return;if(!o.validate)Bf.call(this,o);if(i===kr.normalizeId(t)){let{schema:a}=o,{schemaId:l}=this.opts,c=a[l];if(c)s=kr.resolveUrl(this.opts.uriResolver,s,c);return new Wo({schema:a,schemaId:l,root:e,baseId:s})}return Wf.call(this,r,o)}C1.resolveSchema=Kl;var G5=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Wf(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let l=r[A1.unescapeFragment(a)];if(l===void 0)return;r=l;let c=typeof r==="object"&&r[this.opts.schemaId];if(!G5.has(a)&&c)t=kr.resolveUrl(this.opts.uriResolver,t,c)}let i;if(typeof r!="boolean"&&r.$ref&&!A1.schemaHasRulesButRef(r,this.RULES)){let a=kr.resolveUrl(this.opts.uriResolver,t,r.$ref);i=Kl.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new Wo({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i;return}});var N1=C(function(cZ,Q5){Q5.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Xf=C(function(uZ,H1){var e3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),zf=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),t3=RegExp.prototype.test.bind(/^\d*$/u),Rs=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Gf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),M1=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Kf=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),r3=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Gt=Array(256);for(let t=0;t<256;t++)Gt[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Et(e){if(e<2048)return Gt[192|e>>6]+Gt[128|e&63];if(e<65536)return Gt[224|e>>12]+Gt[128|e>>6&63]+Gt[128|e&63];return Gt[240|e>>18]+Gt[128|e>>12&63]+Gt[128|e>>6&63]+Gt[128|e&63]}function n3(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var s3=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),i3=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),o3=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),a3=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l3(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(o3(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Rs(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function I1(e){let t=-1,r=0,n=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(s++,s>r)r=s,t=n}else n=-1,s=0;if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),o=e.slice(t+r).join(":");return i+"::"+o}function c3(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let s=r.concat(n),i=0;for(let a=0;a<s.length;a++){let l=s[a];if(l==="")return;if(l.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&n.length===0||!zf(l))return;i+=2;continue}if(!s3(l))return;s[a]=parseInt(l,16).toString(16),i++}if(t===-1){if(i!==8)return;return I1(s)}if(i>=8)return;let o=s.slice(0,r.length);for(let a=i;a<8;a++)o.push("0");for(let a=r.length;a<s.length;a++)o.push(s[a]);return I1(o)}function Uf(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&i3(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(u3(n,":")<2)return{host:e,isIPV6:!1,error:t};let s="",i=n.indexOf("%");if(i!==-1){let a=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(s=n.slice(i+a),!l3(s))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let o=c3(n);if(o===void 0)return{host:e,isIPV6:!1,error:!0};return{host:o+(s?"%"+s:""),escapedHost:o+(s?"%25"+s:""),isIPV6:!0}}function u3(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function J1(e){let t=e,r=[],n=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(s===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function d3(e){if(e===""||e[0]==="/")return J1(e);let t=e.split("/"),r=t.length-1,n=[],s=!1;for(let i=0;i<=r;i++){let o=t[i];if(o==="."||o===".."){if(o==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");s=i===r}else n.push(o)}if(s&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var f3={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},p3=/[@/?#:]/g,m3=/[@/?#]/g;function D1(e,t){let r=t?m3:p3;return r.lastIndex=0,e.replace(r,(n)=>f3[n])}function L1(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(t&&Gf(o))r+=o;else r+="%"+i;n+=2;continue}}r+=e[n]}return r}function h3(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(o!=="."&&Gf(o))t+=o;else t+="%"+i;r+=2;continue}}if(M1(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=q1(s)?n:Gt[s];else if(s<55296||s>57343)t+=Et(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Et(65536+(s-55296<<10)+(i-56320)),r++;else t+=Et(65533)}else t+=Et(65533)}}return t}function g3(e,t=!1){let r="",n=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let i=e[s];if(i==="%"&&s+2<e.length){let o=e.slice(s+1,s+3);if(Rs(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(i==="/")n=!1;if(M1(i)&&(i!==":"||!n))r+=i;else{let o=e.charCodeAt(s);if(o<128)r+=Gt[o];else if(o<55296||o>57343)r+=Et(o);else if(o<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)r+=Et(65536+(o-55296<<10)+(a-56320)),s++;else r+=Et(65533)}else r+=Et(65533)}}return r}function Yf(e,t){let r="";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Rs(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(s))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Gt[i];else if(i<55296||i>57343)r+=Et(i);else if(i<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)r+=Et(65536+(i-55296<<10)+(o-56320)),n++;else r+=Et(65533)}else r+=Et(65533)}}return r}function F1(e){return Yf(e,r3)}function y3(e){return Yf(e,Kf)}function b3(e){return Yf(e,Kf)}function q1(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function x3(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(Gf(o))t+=o;else t+="%"+i;r+=2;continue}}if(Kf(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=q1(s)?n:Gt[s];else if(s<55296||s>57343)t+=Et(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Et(65536+(s-55296<<10)+(i-56320)),r++;else t+=Et(65533)}else t+=Et(65533)}}return t}function $3(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Rs(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function v3(e){let t=[];if(e.userinfo!==void 0)t.push(F1(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!zf(r)){let n=Uf(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=L1(r,!0),n=Uf(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=D1(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!t3(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}H1.exports={nonSimpleDomain:a3,recomposeAuthority:v3,reescapeHostDelimiters:D1,normalizePercentEncoding:L1,normalizePathEncoding:h3,serializePathEncoding:g3,normalizeQueryFragmentEncoding:x3,encodeUserinfo:F1,encodeQuery:y3,encodeFragment:b3,escapePreservingEscapes:$3,removeDotSegments:J1,removeDotSegmentsRelative:d3,isIPv4:zf,isUUID:e3,normalizeIPv6:Uf,stringArrayToHexStripped:n3}});var z1=C(function(dZ,U1){var{isUUID:w3}=Xf(),S3=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,E3=["http","https","ws","wss","urn","urn:uuid"];function _3(e){return E3.indexOf(e)!==-1}function Zf(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function V1(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function W1(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function P3(e){return e.secure=Zf(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function j3(e){if(e.port===(Zf(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function k3(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(S3);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=`${n}:${t.nid||e.nid}`,i=Qf(s);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function R3(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,i=Qf(s);if(i)e=i.serialize(e,t);let o=e,a=e.nss;return o.path=`${n||t.nid}:${a}`,t.skipEscape=!0,o}function A3(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!w3(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function O3(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var B1={scheme:"http",domainHost:!0,parse:V1,serialize:W1},C3={scheme:"https",domainHost:B1.domainHost,parse:V1,serialize:W1},Yl={scheme:"ws",domainHost:!0,parse:P3,serialize:j3},T3={scheme:"wss",domainHost:Yl.domainHost,parse:Yl.parse,serialize:Yl.serialize},N3={scheme:"urn",parse:k3,serialize:R3,skipNormalize:!0},I3={scheme:"urn:uuid",parse:A3,serialize:O3,skipNormalize:!0},Xl={http:B1,https:C3,ws:Yl,wss:T3,urn:N3,"urn:uuid":I3};Object.setPrototypeOf(Xl,null);function Qf(e){return e&&(Xl[e]||Xl[e.toLowerCase()])||void 0}U1.exports={wsIsSecure:Zf,SCHEMES:Xl,isValidSchemeName:_3,getSchemeHandler:Qf}});var aE=C(function(fZ,tc){var{normalizeIPv6:Z1,removeDotSegments:zo,removeDotSegmentsRelative:Q1,recomposeAuthority:M3,normalizePercentEncoding:ep,normalizePathEncoding:J3,serializePathEncoding:G1,normalizeQueryFragmentEncoding:K1,encodeQuery:D3,encodeFragment:L3,reescapeHostDelimiters:F3,isIPv4:eE,nonSimpleDomain:q3}=Xf(),{SCHEMES:tE,getSchemeHandler:tp}=z1(),rE=/^[A-Za-z][A-Za-z0-9+.-]*$/u,H3=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function Y1(e){let t=String(e);if(!rE.test(t))throw TypeError("URI scheme is malformed.");return t}function V3(e,t){if(typeof e==="string")e=Z3(e,t);else if(typeof e==="object")e=Ql(As(e,t),t);return e}function W3(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=Zl(e,n),{parsed:d,malformedAuthorityOrPort:p,malformedPercentEncoding:h,malformedSchemeSpecific:m,malformedHost:b,malformedScheme:g}=Zl(t,n);if(i||p||o||h||a||m||l||b||c||g)throw Error(s.error||d.error||"URI is malformed.");let y=nE(s,d,n,!0),v=tp(r&&r.scheme||y.scheme),j=y.host,S=j!==void 0&&j!==""&&(eE(j)||Z1(j).isIPV6);if(iE(y,r||{},v,S))throw Error("URI host is malformed.");sE(y,r||{},v,S);let P=j&&j.indexOf("%")!==-1&&!/\P{ASCII}/u.test(j);if(y.error&&!P)throw Error(y.error);return n.skipEscape=!0,As(y,n)}function nE(e,t,r,n){let s={};if(!n)e=Ql(As(e,r),r),t=Ql(As(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=zo(t.path||""),s.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=zo(t.path||""),s.query=t.query;else{if(!t.path)if(s.path=e.path,t.query!==void 0)s.query=t.query;else s.query=e.query;else{if(t.path[0]==="/")s.path=zo(t.path);else{let i=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(i&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!i&&s.path[0]!=="/"?Q1(s.path):zo(s.path)}s.query=t.query}s.userinfo=e.userinfo,s.host=e.host,s.port=e.port}s.scheme=e.scheme}return s.fragment=t.fragment,s}function B3(e,t,r){let n=X1(e,r),s=X1(t,r);return n!==void 0&&s!==void 0&&n===s}function As(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),s=[];if(r.scheme)r.scheme=Y1(r.scheme);let i=tp(n.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,n);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!o,l=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=G1(r.path,l);else r.path=ep(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=Y1(r.scheme),s.push(r.scheme,":");let c=M3(r);if(c!==void 0){if(n.reference!=="suffix")s.push("//");if(s.push(c),r.path&&r.path[0]!=="/")s.push("/")}if(r.path!==void 0){let d=r.path;if(!n.absolutePath&&(!i||!i.absolutePath))d=a&&d[0]!=="/"?Q1(d):zo(d);if(a)d=G1(d,!0);if(c===void 0&&d[0]==="/"&&d[1]==="/")d="/%2F"+d.slice(2);s.push(d)}if(r.query!==void 0)s.push("?",D3(r.query));if(r.fragment!==void 0)s.push("#",L3(r.fragment));return s.join("")}var U3=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,z3=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,G3=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function K3(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function Uo(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function ec(e){return e[0]==="["&&e[e.length-1]==="]"}function Y3(e){let t=e[4];return Uo(e[3])||t!==void 0&&!ec(t)&&Uo(t)||Uo(e[6])||Uo(e[7])||Uo(e[8])}function sE(e,t,r,n){if(iE(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!ec(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&q3(e.host)){let s;try{s=new URL("http://"+e.host)}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}if(!X3(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function iE(e,t,r,n){return Boolean(e.host&&n===!1&&!ec(e.host)&&(t.domainHost||r&&r.domainHost)&&H3.test(e.host))}function X3(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Zl(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,d=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let p=e.match(z3);if(p!==null&&p[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",s=!0;let h=e.match(G3);if(h!==null){let b=h[1],g=b.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",s=!0;else if(b.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(U3);if(m){if(n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],n.scheme!==void 0)if(rE.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(i=Y3(m),i)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let b=K3(n,m);if(b!==void 0)n.error=n.error||b,s=!0;if(n.host)if(eE(n.host)===!1){let v=ec(n.host),j=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=Z1(n.host);if(d=S.isIPV6||S.isIPVFuture===!0,l=j&&(!v||S.error===!0),n.host=d?S.host:S.host.toLowerCase(),l)n.error=n.error||"URI host is malformed.",s=!0}else d=!0;if(n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path)n.reference="same-document";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let g=tp(r.scheme||n.scheme);if(!l)a=sE(n,r,g,d);if(e.indexOf("%")!==-1&&n.host!==void 0&&!l){let y=d?n.host:ep(n.host,!0);if(!d)y=ep(y.toLowerCase());n.host=d||r.scheme!=="null"?F3(y,d):y}if(!g||g&&!g.skipNormalize){if(n.path)n.path=J3(n.path);if(n.query)n.query=K1(n.query);if(n.fragment)n.fragment=K1(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===tE.urn&&n.nid===void 0)o=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:c}}function Ql(e,t){return Zl(e,t).parsed}function Z3(e,t){return oE(e,t).normalized}function oE(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}=Zl(e,t);return{normalized:n||s||i||o||a?e:As(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}}function X1(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:As(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}=oE(r,t);return s||i||o||a||l?void 0:n}var rp={SCHEMES:tE,normalize:V3,resolve:W3,resolveComponent:nE,equal:B3,serialize:As,parse:Ql};tc.exports=rp;tc.exports.default=rp;tc.exports.fastUri=rp});var uE=C(function(cE){Object.defineProperty(cE,"__esModule",{value:!0});var lE=aE();lE.code='require("ajv/dist/runtime/uri").default';cE.default=lE});var ip=C(function(wn){Object.defineProperty(wn,"__esModule",{value:!0});wn.CodeGen=wn.Name=wn.nil=wn.stringify=wn.str=wn._=wn.KeywordCxt=void 0;var eH=wi();Object.defineProperty(wn,"KeywordCxt",{enumerable:!0,get:function(){return eH.KeywordCxt}});var Ei=ye();Object.defineProperty(wn,"_",{enumerable:!0,get:function(){return Ei._}});Object.defineProperty(wn,"str",{enumerable:!0,get:function(){return Ei.str}});Object.defineProperty(wn,"stringify",{enumerable:!0,get:function(){return Ei.stringify}});Object.defineProperty(wn,"nil",{enumerable:!0,get:function(){return Ei.nil}});Object.defineProperty(wn,"Name",{enumerable:!0,get:function(){return Ei.Name}});Object.defineProperty(wn,"CodeGen",{enumerable:!0,get:function(){return Ei.CodeGen}});var tH=Vo(),hE=Si(),rH=Rf(),Ko=Bo(),nH=ye(),Go=Fo(),rc=Lo(),sp=we(),dE=N1(),sH=uE(),gE=(e,t)=>new RegExp(e,t);gE.code="new RegExp";var iH=["removeAdditional","useDefaults","coerceTypes"],oH=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),aH={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."},lH={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},fE=200;function cH(e){var t,r,n,s,i,o,a,l,c,d,p,h,m,b,g,y,v,j,S,P,E,O,R,k,I;let D=e.strict,M=(t=e.code)===null||t===void 0?void 0:t.optimize,L=M===!0||M===void 0?1:M||0,B=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:gE,se=(s=e.uriResolver)!==null&&s!==void 0?s:sH.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:D)!==null&&o!==void 0?o:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:D)!==null&&l!==void 0?l:!0,strictTypes:(d=(c=e.strictTypes)!==null&&c!==void 0?c:D)!==null&&d!==void 0?d:"log",strictTuples:(h=(p=e.strictTuples)!==null&&p!==void 0?p:D)!==null&&h!==void 0?h:"log",strictRequired:(b=(m=e.strictRequired)!==null&&m!==void 0?m:D)!==null&&b!==void 0?b:!1,code:e.code?{...e.code,optimize:L,regExp:B}:{optimize:L,regExp:B},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:fE,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:fE,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(P=e.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(O=e.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(k=e.unicodeRegExp)!==null&&k!==void 0?k:!0,int32range:(I=e.int32range)!==null&&I!==void 0?I:!0,uriResolver:se}}class nc{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...cH(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new nH.ValueScope({scope:{},prefixes:oH,es5:t,lines:r}),this.logger=hH(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=rH.getRules(),pE.call(this,aH,e,"NOT SUPPORTED"),pE.call(this,lH,e,"DEPRECATED","warn"),this._metaOpts=pH.call(this),e.formats)dH.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)fH.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);uH.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=dE;if(r==="id")n={...dE},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(c,d){await s.call(this,c.$schema);let p=this._addSchema(c,d);return p.validate||i.call(this,p)}async function s(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function i(c){try{return this._compileSchemaEnv(c)}catch(d){if(!(d instanceof hE.default))throw d;return o.call(this,d),await a.call(this,d.missingSchema),i.call(this,c)}}function o({missingSchema:c,missingRef:d}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${d} cannot be resolved`)}async function a(c){let d=await l.call(this,c);if(!this.refs[c])await s.call(this,d.$schema);if(!this.refs[c])this.addSchema(d,c,t)}async function l(c){let d=this._loading[c];if(d)return d;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,n);return this}let s;if(typeof e==="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw Error(`schema ${i} must be string`)}return t=Go.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return n}getSchema(e){let t;while(typeof(t=mE.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new Ko.SchemaEnv({schema:{},schemaId:r});if(t=Ko.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=mE.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Go.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(yH.call(this,r,t),!t)return sp.eachItem(r,(s)=>np.call(this,s)),this;xH.call(this,t);let n={...t,type:rc.getJSONTypes(t.type),schemaType:rc.getJSONTypes(t.schemaType)};return sp.eachItem(r,n.type.length===0?(s)=>np.call(this,s,n):(s)=>n.type.forEach((i)=>np.call(this,s,n,i))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((s)=>s.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,s)=>n+t+s)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let s=n.split("/").slice(1),i=e;for(let o of s)i=i[o];for(let o in r){let a=r[o];if(typeof a!="object")continue;let{$data:l}=a.definition,c=i[o];if(l&&c)i[o]=yE(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:o}=this.opts;if(typeof e=="object")i=e[o];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=Go.normalizeId(i||r);let l=Go.getSchemaRefs.call(this,e,r);if(a=new Ko.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:l}),this._cache.set(a.schema,a),s&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Ko.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Ko.compileSchema.call(this,e)}finally{this.opts=t}}}nc.ValidationError=tH.default;nc.MissingRefError=hE.default;wn.default=nc;function pE(e,t,r,n="error"){for(let s in e){let i=s;if(i in t)this.logger[n](`${r}: option ${s}. ${e[i]}`)}}function mE(e){return e=Go.normalizeId(e),this.schemas[e]||this.refs[e]}function uH(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function dH(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function fH(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function pH(){let e={...this.opts};for(let t of iH)delete e[t];return e}var mH={log(){},warn(){},error(){}};function hH(e){if(e===!1)return mH;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var gH=/^[a-z_$][a-z0-9_$:-]*$/i;function yH(e,t){let{RULES:r}=this;if(sp.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!gH.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function np(e,t,r){var n;let s=t===null||t===void 0?void 0:t.post;if(r&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=s?i.post:i.rules.find(({type:l})=>l===r);if(!o)o={type:r,rules:[]},i.rules.push(o);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:rc.getJSONTypes(t.type),schemaType:rc.getJSONTypes(t.schemaType)}};if(t.before)bH.call(this,o,a,t.before);else o.rules.push(a);i.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((l)=>this.addKeyword(l))}function bH(e,t,r){let n=e.rules.findIndex((s)=>s.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function xH(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=yE(t);e.validateSchema=this.compile(t,!0)}var $H={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function yE(e){return{anyOf:[e,$H]}}});var xE=C(function(bE){Object.defineProperty(bE,"__esModule",{value:!0});var SH={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};bE.default=SH});var oc=C(function(SE){Object.defineProperty(SE,"__esModule",{value:!0});SE.callRef=SE.getValidate=void 0;var _H=Si(),$E=yr(),Kt=ye(),_i=gr(),vE=Bo(),sc=we(),PH={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:a,self:l}=n,{root:c}=i;if((r==="#"||r==="#/")&&s===c.baseId)return p();let d=vE.resolveRef.call(l,c,s,r);if(d===void 0)throw new _H.default(n.opts.uriResolver,s,r);if(d instanceof vE.SchemaEnv)return h(d);return m(d);function p(){if(i===c)return ic(e,o,i,i.$async);let b=t.scopeValue("root",{ref:c});return ic(e,Kt._`${b}.validate`,c,c.$async)}function h(b){let g=wE(e,b);ic(e,g,b,b.$async)}function m(b){let g=t.scopeValue("schema",a.code.source===!0?{ref:b,code:Kt.stringify(b)}:{ref:b}),y=t.name("valid"),v=e.subschema({schema:b,dataTypes:[],schemaPath:Kt.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function wE(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Kt._`${r.scopeValue("wrapper",{ref:t})}.validate`}SE.getValidate=wE;function ic(e,t,r,n){let{gen:s,it:i}=e,{allErrors:o,schemaEnv:a,opts:l}=i,c=l.passContext?_i.default.this:Kt.nil;if(n)d();else p();function d(){if(!a.$async)throw Error("async schema referenced by sync schema");let b=s.let("valid");s.try(()=>{if(s.code(Kt._`await ${$E.callValidateCode(e,t,c)}`),m(t),!o)s.assign(b,!0)},(g)=>{if(s.if(Kt._`!(${g} instanceof ${i.ValidationError})`,()=>s.throw(g)),h(g),!o)s.assign(b,!1)}),e.ok(b)}function p(){e.result($E.callValidateCode(e,t,c),()=>m(t),()=>h(t))}function h(b){let g=Kt._`${b}.errors`;s.assign(_i.default.vErrors,Kt._`${_i.default.vErrors} === null ? ${g} : ${_i.default.vErrors}.concat(${g})`),s.assign(_i.default.errors,Kt._`${_i.default.vErrors}.length`)}function m(b){var g;if(!i.opts.unevaluated)return;let y=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)i.props=sc.mergeEvaluated.props(s,y.props,i.props)}else{let v=s.var("props",Kt._`${b}.evaluated.props`);i.props=sc.mergeEvaluated.props(s,v,i.props,Kt.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=sc.mergeEvaluated.items(s,y.items,i.items)}else{let v=s.var("items",Kt._`${b}.evaluated.items`);i.items=sc.mergeEvaluated.items(s,v,i.items,Kt.Name)}}}SE.callRef=ic;SE.default=PH});var op=C(function(_E){Object.defineProperty(_E,"__esModule",{value:!0});var RH=xE(),AH=oc(),OH=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",RH.default,AH.default];_E.default=OH});var jE=C(function(PE){Object.defineProperty(PE,"__esModule",{value:!0});var lc=ye(),Kn=lc.operators,ac={maximum:{okStr:"<=",ok:Kn.LTE,fail:Kn.GT},minimum:{okStr:">=",ok:Kn.GTE,fail:Kn.LT},exclusiveMaximum:{okStr:"<",ok:Kn.LT,fail:Kn.GTE},exclusiveMinimum:{okStr:">",ok:Kn.GT,fail:Kn.LTE}},TH={message:({keyword:e,schemaCode:t})=>lc.str`must be ${ac[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>lc._`{comparison: ${ac[e].okStr}, limit: ${t}}`},NH={keyword:Object.keys(ac),type:"number",schemaType:"number",$data:!0,error:TH,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(lc._`${r} ${ac[t].fail} ${n} || isNaN(${r})`)}};PE.default=NH});var RE=C(function(kE){Object.defineProperty(kE,"__esModule",{value:!0});var Yo=ye(),MH={message:({schemaCode:e})=>Yo.str`must be multiple of ${e}`,params:({schemaCode:e})=>Yo._`{multipleOf: ${e}}`},JH={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:MH,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),a=i?Yo._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:Yo._`${o} !== parseInt(${o})`;e.fail$data(Yo._`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};kE.default=JH});var CE=C(function(OE){Object.defineProperty(OE,"__esModule",{value:!0});function AE(e){let t=e.length,r=0,n=0,s;while(n<t)if(r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t){if(s=e.charCodeAt(n),(s&64512)===56320)n++}return r}OE.default=AE;AE.code='require("ajv/dist/runtime/ucs2length").default'});var NE=C(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});var Os=ye(),FH=we(),qH=CE(),HH={message({keyword:e,schemaCode:t}){return Os.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Os._`{limit: ${e}}`},VH={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:HH,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?Os.operators.GT:Os.operators.LT,o=s.opts.unicode===!1?Os._`${r}.length`:Os._`${FH.useFunc(e.gen,qH.default)}(${r})`;e.fail$data(Os._`${o} ${i} ${n}`)}};TE.default=VH});var ME=C(function(IE){Object.defineProperty(IE,"__esModule",{value:!0});var BH=yr(),UH=we(),Pi=ye(),zH={message:({schemaCode:e})=>Pi.str`must match pattern "${e}"`,params:({schemaCode:e})=>Pi._`{pattern: ${e}}`},GH={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:zH,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e,a=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:l}=o.opts.code,c=l.code==="new RegExp"?Pi._`new RegExp`:UH.useFunc(t,l),d=t.let("valid");t.try(()=>t.assign(d,Pi._`${c}(${i}, ${a}).test(${r})`),()=>t.assign(d,!1)),e.fail$data(Pi._`!${d}`)}else{let l=BH.usePattern(e,s);e.fail$data(Pi._`!${l}.test(${r})`)}}};IE.default=GH});var DE=C(function(JE){Object.defineProperty(JE,"__esModule",{value:!0});var Xo=ye(),YH={message({keyword:e,schemaCode:t}){return Xo.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Xo._`{limit: ${e}}`},XH={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:YH,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Xo.operators.GT:Xo.operators.LT;e.fail$data(Xo._`Object.keys(${r}).length ${s} ${n}`)}};JE.default=XH});var FE=C(function(LE){Object.defineProperty(LE,"__esModule",{value:!0});var Qo=yr(),Zo=ye(),QH=we(),eV={message:({params:{missingProperty:e}})=>Zo.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Zo._`{missingProperty: ${e}}`},tV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:eV,code(e){let{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:o}=e,{opts:a}=o;if(!i&&r.length===0)return;let l=r.length>=a.loopRequired;if(o.allErrors)c();else d();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:b}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!b.has(g)){let y=o.schemaEnv.baseId+o.errSchemaPath,v=`required property "${g}" is not defined at "${y}" (strictRequired)`;QH.checkStrictMode(o,v,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(Zo.nil,p);else for(let m of r)Qo.checkReportMissingProp(e,m)}function d(){let m=t.let("missing");if(l||i){let b=t.let("valid",!0);e.block$data(b,()=>h(m,b)),e.ok(b)}else t.if(Qo.checkMissingProp(e,r,m)),Qo.reportMissingProp(e,m),t.else()}function p(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(Qo.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function h(m,b){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(b,Qo.propertyInData(t,s,m,a.ownProperties)),t.if(Zo.not(b),()=>{e.error(),t.break()})},Zo.nil)}}};LE.default=tV});var HE=C(function(qE){Object.defineProperty(qE,"__esModule",{value:!0});var ea=ye(),nV={message({keyword:e,schemaCode:t}){return ea.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>ea._`{limit: ${e}}`},sV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:nV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?ea.operators.GT:ea.operators.LT;e.fail$data(ea._`${r}.length ${s} ${n}`)}};qE.default=sV});var cc=C(function(WE){Object.defineProperty(WE,"__esModule",{value:!0});var VE=Jf();VE.code='require("ajv/dist/runtime/equal").default';WE.default=VE});var UE=C(function(BE){Object.defineProperty(BE,"__esModule",{value:!0});var ap=Lo(),yt=ye(),aV=we(),lV=cc(),cV={message:({params:{i:e,j:t}})=>yt.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>yt._`{i: ${e}, j: ${t}}`},uV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:cV,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:a}=e;if(!n&&!s)return;let l=t.let("valid"),c=i.items?ap.getSchemaTypes(i.items):[];e.block$data(l,d,yt._`${o} === false`),e.ok(l);function d(){let b=t.let("i",yt._`${r}.length`),g=t.let("j");e.setParams({i:b,j:g}),t.assign(l,!0),t.if(yt._`${b} > 1`,()=>(p()?h:m)(b,g))}function p(){return c.length>0&&!c.some((b)=>b==="object"||b==="array")}function h(b,g){let y=t.name("item"),v=ap.checkDataTypes(c,y,a.opts.strictNumbers,ap.DataType.Wrong),j=t.const("indices",yt._`{}`);t.for(yt._`;${b}--;`,()=>{if(t.let(y,yt._`${r}[${b}]`),t.if(v,yt._`continue`),c.length>1)t.if(yt._`typeof ${y} == "string"`,yt._`${y} += "_"`);t.if(yt._`typeof ${j}[${y}] == "number"`,()=>{t.assign(g,yt._`${j}[${y}]`),e.error(),t.assign(l,!1).break()}).code(yt._`${j}[${y}] = ${b}`)})}function m(b,g){let y=aV.useFunc(t,lV.default),v=t.name("outer");t.label(v).for(yt._`;${b}--;`,()=>t.for(yt._`${g} = ${b}; ${g}--;`,()=>t.if(yt._`${y}(${r}[${b}], ${r}[${g}])`,()=>{e.error(),t.assign(l,!1).break(v)})))}}};BE.default=uV});var GE=C(function(zE){Object.defineProperty(zE,"__esModule",{value:!0});var lp=ye(),fV=we(),pV=cc(),mV={message:"must be equal to constant",params:({schemaCode:e})=>lp._`{allowedValue: ${e}}`},hV={keyword:"const",$data:!0,error:mV,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;if(n||i&&typeof i=="object")e.fail$data(lp._`!${fV.useFunc(t,pV.default)}(${r}, ${s})`);else e.fail(lp._`${i} !== ${r}`)}};zE.default=hV});var YE=C(function(KE){Object.defineProperty(KE,"__esModule",{value:!0});var ta=ye(),yV=we(),bV=cc(),xV={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>ta._`{allowedValues: ${e}}`},$V={keyword:"enum",schemaType:"array",$data:!0,error:xV,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e;if(!n&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=o.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=yV.useFunc(t,bV.default),d;if(a||n)d=t.let("valid"),e.block$data(d,p);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",i);d=ta.or(...s.map((b,g)=>h(m,g)))}e.pass(d);function p(){t.assign(d,!1),t.forOf("v",i,(m)=>t.if(ta._`${c()}(${r}, ${m})`,()=>t.assign(d,!0).break()))}function h(m,b){let g=s[b];return typeof g==="object"&&g!==null?ta._`${c()}(${r}, ${m}[${b}])`:ta._`${r} === ${g}`}}};KE.default=$V});var cp=C(function(XE){Object.defineProperty(XE,"__esModule",{value:!0});var wV=jE(),SV=RE(),EV=NE(),_V=ME(),PV=DE(),jV=FE(),kV=HE(),RV=UE(),AV=GE(),OV=YE(),CV=[wV.default,SV.default,EV.default,_V.default,PV.default,jV.default,kV.default,RV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},AV.default,OV.default];XE.default=CV});var dp=C(function(QE){Object.defineProperty(QE,"__esModule",{value:!0});QE.validateAdditionalItems=void 0;var Cs=ye(),up=we(),NV={message:({params:{len:e}})=>Cs.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Cs._`{limit: ${e}}`},IV={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:NV,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){up.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ZE(e,n)}};function ZE(e,t){let{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;let a=r.const("len",Cs._`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Cs._`${a} <= ${t.length}`);else if(typeof n=="object"&&!up.alwaysValidSchema(o,n)){let c=r.var("valid",Cs._`${a} <= ${t.length}`);r.if(Cs.not(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,a,(d)=>{if(e.subschema({keyword:i,dataProp:d,dataPropType:up.Type.Num},c),!o.allErrors)r.if(Cs.not(c),()=>r.break())})}}QE.validateAdditionalItems=ZE;QE.default=IV});var fp=C(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});n_.validateTuple=void 0;var t_=ye(),uc=we(),JV=yr(),DV={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return r_(e,"additionalItems",t);if(r.items=!0,uc.alwaysValidSchema(r,t))return;e.ok(JV.validateArray(e))}};function r_(e,t,r=e.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=e;if(d(s),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=uc.mergeEvaluated.items(n,r.length,a.items);let l=n.name("valid"),c=n.const("len",t_._`${i}.length`);r.forEach((p,h)=>{if(uc.alwaysValidSchema(a,p))return;n.if(t_._`${c} > ${h}`,()=>e.subschema({keyword:o,schemaProp:h,dataProp:h},l)),e.ok(l)});function d(p){let{opts:h,errSchemaPath:m}=a,b=r.length,g=b===p.minItems&&(b===p.maxItems||p[t]===!1);if(h.strictTuples&&!g){let y=`"${o}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;uc.checkStrictMode(a,y,h.strictTuples)}}}n_.validateTuple=r_;n_.default=DV});var o_=C(function(i_){Object.defineProperty(i_,"__esModule",{value:!0});var FV=fp(),qV={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>FV.validateTuple(e,"items")};i_.default=qV});var c_=C(function(l_){Object.defineProperty(l_,"__esModule",{value:!0});var a_=ye(),VV=we(),WV=yr(),BV=dp(),UV={message:({params:{len:e}})=>a_.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>a_._`{limit: ${e}}`},zV={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:UV,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;if(n.items=!0,VV.alwaysValidSchema(n,t))return;if(s)BV.validateAdditionalItems(e,s);else e.ok(WV.validateArray(e))}};l_.default=zV});var d_=C(function(u_){Object.defineProperty(u_,"__esModule",{value:!0});var br=ye(),dc=we(),KV={message:({params:{min:e,max:t}})=>t===void 0?br.str`must contain at least ${e} valid item(s)`:br.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?br._`{minContains: ${e}}`:br._`{minContains: ${e}, maxContains: ${t}}`},YV={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:KV,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e,o,a,{minContains:l,maxContains:c}=n;if(i.opts.next)o=l===void 0?1:l,a=c;else o=1;let d=t.const("len",br._`${s}.length`);if(e.setParams({min:o,max:a}),a===void 0&&o===0){dc.checkStrictMode(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){dc.checkStrictMode(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(dc.alwaysValidSchema(i,r)){let g=br._`${d} >= ${o}`;if(a!==void 0)g=br._`${g} && ${d} <= ${a}`;e.pass(g);return}i.items=!0;let p=t.name("valid");if(a===void 0&&o===1)m(p,()=>t.if(p,()=>t.break()));else if(o===0){if(t.let(p,!0),a!==void 0)t.if(br._`${s}.length > 0`,h)}else t.let(p,!1),h();e.result(p,()=>e.reset());function h(){let g=t.name("_valid"),y=t.let("count",0);m(g,()=>t.if(g,()=>b(y)))}function m(g,y){t.forRange("i",0,d,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:dc.Type.Num,compositeRule:!0},g),y()})}function b(g){if(t.code(br._`${g}++`),a===void 0)t.if(br._`${g} >= ${o}`,()=>t.assign(p,!0).break());else if(t.if(br._`${g} > ${a}`,()=>t.assign(p,!1).break()),o===1)t.assign(p,!0);else t.if(br._`${g} >= ${o}`,()=>t.assign(p,!0))}}};u_.default=YV});var fc=C(function(m_){Object.defineProperty(m_,"__esModule",{value:!0});m_.validateSchemaDeps=m_.validatePropertyDeps=m_.error=void 0;var pp=ye(),ZV=we(),ra=yr();m_.error={message:({params:{property:e,depsCount:t,deps:r}})=>pp.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>pp._`{property: ${e},
|
|
566
|
+
|| ${o} === "boolean" || ${s} === null`).assign(a,xe._`[${s}]`)}}}function uq({gen:e,parentData:t,parentDataProperty:r},n){e.if(xe._`${t} !== undefined`,()=>e.assign(xe._`${t}[${r}]`,n))}function Rf(e,t,r,n=xi.Correct){let s=n===xi.Correct?xe.operators.EQ:xe.operators.NEQ,i;switch(e){case"null":return xe._`${t} ${s} null`;case"array":i=xe._`Array.isArray(${t})`;break;case"object":i=xe._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o(xe._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return xe._`typeof ${t} ${s} ${e}`}return n===xi.Correct?i:xe.not(i);function o(a=xe.nil){return xe.and(xe._`typeof ${t} == "number"`,a,r?xe._`isFinite(${t})`:xe.nil)}}IS.checkDataType=Rf;function Af(e,t,r,n){if(e.length===1)return Rf(e[0],t,r,n);let s,i=CS.toHash(e);if(i.array&&i.object){let o=xe._`typeof ${t} != "object"`;s=i.null?o:xe._`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else s=xe.nil;if(i.number)delete i.integer;for(let o in i)s=xe.and(s,Rf(o,t,r,n));return s}IS.checkDataTypes=Af;var dq={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?xe._`{type: ${e}}`:xe._`{type: ${t}}`};function Of(e){let t=fq(e);iq.reportError(t,dq)}IS.reportTypeError=Of;function fq(e){let{gen:t,data:r,schema:n}=e,s=CS.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var FS=C(function(DS){Object.defineProperty(DS,"__esModule",{value:!0});DS.assignDefaults=void 0;var $i=ye(),xq=we();function $q(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)JS(e,s,r[s].default);else if(t==="array"&&Array.isArray(n))n.forEach((s,i)=>JS(e,i,s.default))}DS.assignDefaults=$q;function JS(e,t,r){let{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;let a=$i._`${i}${$i.getProperty(t)}`;if(s){xq.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=$i._`${a} === undefined`;if(o.useDefaults==="empty")l=$i._`${l} || ${a} === null || ${a} === ""`;n.if(l,$i._`${a} = ${$i.stringify(r)}`)}});var yr=C(function(VS){Object.defineProperty(VS,"__esModule",{value:!0});VS.validateUnion=VS.validateArray=VS.usePattern=VS.callValidateCode=VS.schemaProperties=VS.allSchemaProperties=VS.noPropertyInData=VS.propertyInData=VS.isOwnProperty=VS.hasPropFunc=VS.reportMissingProp=VS.checkMissingProp=VS.checkReportMissingProp=void 0;var He=ye(),Cf=we(),Gn=gr(),vq=we();function wq(e,t){let{gen:r,data:n,it:s}=e;r.if(Tf(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:He._`${t}`},!0),e.error()})}VS.checkReportMissingProp=wq;function Sq({gen:e,data:t,it:{opts:r}},n,s){return He.or(...n.map((i)=>He.and(Tf(e,t,i,r.ownProperties),He._`${s} = ${i}`)))}VS.checkMissingProp=Sq;function Eq(e,t){e.setParams({missingProperty:t},!0),e.error()}VS.reportMissingProp=Eq;function qS(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:He._`Object.prototype.hasOwnProperty`})}VS.hasPropFunc=qS;function Nf(e,t,r){return He._`${qS(e)}.call(${t}, ${r})`}VS.isOwnProperty=Nf;function _q(e,t,r,n){let s=He._`${t}${He.getProperty(r)} !== undefined`;return n?He._`${s} && ${Nf(e,t,r)}`:s}VS.propertyInData=_q;function Tf(e,t,r,n){let s=He._`${t}${He.getProperty(r)} === undefined`;return n?He.or(s,He.not(Nf(e,t,r))):s}VS.noPropertyInData=Tf;function HS(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}VS.allSchemaProperties=HS;function Pq(e,t){return HS(t).filter((r)=>!Cf.alwaysValidSchema(e,t[r]))}VS.schemaProperties=Pq;function jq({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,l,c){let d=c?He._`${e}, ${t}, ${n}${s}`:t,p=[[Gn.default.instancePath,He.strConcat(Gn.default.instancePath,i)],[Gn.default.parentData,o.parentData],[Gn.default.parentDataProperty,o.parentDataProperty],[Gn.default.rootData,Gn.default.rootData]];if(o.opts.dynamicRef)p.push([Gn.default.dynamicAnchors,Gn.default.dynamicAnchors]);let h=He._`${d}, ${r.object(...p)}`;return l!==He.nil?He._`${a}.call(${l}, ${h})`:He._`${a}(${h})`}VS.callValidateCode=jq;var kq=He._`new RegExp`;function Rq({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:He._`${s.code==="new RegExp"?kq:vq.useFunc(e,s)}(${r}, ${n})`})}VS.usePattern=Rq;function Aq(e){let{gen:t,data:r,keyword:n,it:s}=e,i=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return o(()=>t.assign(a,!1)),a}return t.var(i,!0),o(()=>t.break()),i;function o(a){let l=t.const("len",He._`${r}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:Cf.Type.Num},i),t.if(He.not(i),a)})}}VS.validateArray=Aq;function Oq(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((l)=>Cf.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let o=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let d=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(o,He._`${o} || ${a}`),!e.mergeValidEvaluated(d,a))t.if(He.not(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}VS.validateUnion=Oq});var KS=C(function(zS){Object.defineProperty(zS,"__esModule",{value:!0});zS.validateKeywordUsage=zS.validSchemaType=zS.funcKeywordCode=zS.macroKeywordCode=void 0;var Nt=ye(),js=gr(),Bq=yr(),Wq=To();function Uq(e,t){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,a=t.macro.call(o.self,s,i,o),l=US(r,n,a);if(o.opts.validateSchema!==!1)o.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:Nt.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}zS.macroKeywordCode=Uq;function zq(e,t){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:l}=e;Kq(l,t);let c=!a&&t.compile?t.compile.call(l.self,i,o,l):t.validate,d=US(n,s,c),p=n.let("valid");e.block$data(p,h),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function h(){if(t.errors===!1){if(g(),t.modifying)WS(e);y(()=>e.error())}else{let v=t.async?m():b();if(t.modifying)WS(e);y(()=>Gq(e,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>g(Nt._`await `),(j)=>n.assign(p,!1).if(Nt._`${j} instanceof ${l.ValidationError}`,()=>n.assign(v,Nt._`${j}.errors`),()=>n.throw(j))),v}function b(){let v=Nt._`${d}.errors`;return n.assign(v,null),g(Nt.nil),v}function g(v=t.async?Nt._`await `:Nt.nil){let j=l.opts.passContext?js.default.this:js.default.self,S=!(("compile"in t)&&!a||t.schema===!1);n.assign(p,Nt._`${v}${Bq.callValidateCode(e,d,j,S)}`,t.modifying)}function y(v){var j;n.if(Nt.not((j=t.valid)!==null&&j!==void 0?j:p),v)}}zS.funcKeywordCode=zq;function WS(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Nt._`${n.parentData}[${n.parentDataProperty}]`))}function Gq(e,t){let{gen:r}=e;r.if(Nt._`Array.isArray(${t})`,()=>{r.assign(js.default.vErrors,Nt._`${js.default.vErrors} === null ? ${t} : ${js.default.vErrors}.concat(${t})`).assign(js.default.errors,Nt._`${js.default.vErrors}.length`),Wq.extendErrors(e)},()=>e.error())}function Kq({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function US(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:Nt.stringify(r)})}function Yq(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")}zS.validSchemaType=Yq;function Xq({schema:e,opts:t,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw Error("ajv implementation error");let o=s.dependencies;if(o===null||o===void 0?void 0:o.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[i])){let l=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(l);else throw Error(l)}}}zS.validateKeywordUsage=Xq});var QS=C(function(XS){Object.defineProperty(XS,"__esModule",{value:!0});XS.extendSubschemaMode=XS.extendSubschemaData=XS.getSubschema=void 0;var Ur=ye(),YS=we();function t5(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Ur._`${e.schemaPath}${Ur.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Ur._`${e.schemaPath}${Ur.getProperty(t)}${Ur.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${YS.escapeFragment(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}XS.getSubschema=t5;function r5(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:d,opts:p}=t,h=a.let("data",Ur._`${t.data}${Ur.getProperty(r)}`,!0);l(h),e.errorPath=Ur.str`${c}${YS.getErrorPath(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=Ur._`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Ur.Name?s:a.let("data",s,!0);if(l(c),o!==void 0)e.propertyName=o}if(i)e.dataTypes=i;function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}XS.extendSubschemaData=r5;function n5(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){if(n!==void 0)e.compositeRule=n;if(s!==void 0)e.createErrors=s;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}XS.extendSubschemaMode=n5});var If=C(function(fZ,e1){e1.exports=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}});var r1=C(function(pZ,t1){var Kn=t1.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Wl(t,n,s,e,"",e)};Kn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Kn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Kn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Kn.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 Wl(e,t,r,n,s,i,o,a,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,a,l,c);for(var d in n){var p=n[d];if(Array.isArray(p)){if(d in Kn.arrayKeywords)for(var h=0;h<p.length;h++)Wl(e,t,r,p[h],s+"/"+d+"/"+h,i,s,d,n,h)}else if(d in Kn.propsKeywords){if(p&&typeof p=="object")for(var m in p)Wl(e,t,r,p[m],s+"/"+d+"/"+o5(m),i,s,d,n,m)}else if(d in Kn.keywords||e.allKeys&&!(d in Kn.skipKeywords))Wl(e,t,r,p,s+"/"+d,i,s,d,n)}r(n,s,i,o,a,l,c)}}function o5(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Mo=C(function(o1){Object.defineProperty(o1,"__esModule",{value:!0});o1.getSchemaRefs=o1.resolveUrl=o1.normalizeId=o1._getFullPath=o1.getFullPath=o1.inlineRef=void 0;var a5=we(),l5=If(),c5=r1(),u5=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function d5(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Mf(e);if(!t)return!1;return n1(e)<=t}o1.inlineRef=d5;var f5=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Mf(e){for(let t in e){if(f5.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Mf))return!0;if(typeof r=="object"&&Mf(r))return!0}return!1}function n1(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,u5.has(r))continue;if(typeof e[r]=="object")a5.eachItem(e[r],(n)=>t+=n1(n));if(t===1/0)return 1/0}return t}function s1(e,t="",r){if(r!==!1)t=vi(t);let n=e.parse(t);return i1(e,n)}o1.getFullPath=s1;function i1(e,t){return e.serialize(t).split("#")[0]+"#"}o1._getFullPath=i1;var p5=/#\/?$/;function vi(e){return e?e.replace(p5,""):""}o1.normalizeId=vi;function m5(e,t,r){return r=vi(r),e.resolve(t,r)}o1.resolveUrl=m5;var h5=/^[a-z_][-a-z0-9._]*$/i;function g5(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=vi(e[r]||t),i={"":s},o=s1(n,s,!1),a={},l=new Set;return c5(e,{allKeys:!0},(p,h,m,b)=>{if(b===void 0)return;let g=o+h,y=i[b];if(typeof p[r]=="string")y=v.call(this,p[r]);j.call(this,p.$anchor),j.call(this,p.$dynamicAnchor),i[h]=y;function v(S){let P=this.opts.uriResolver.resolve;if(S=vi(y?P(y,S):S),l.has(S))throw d(S);l.add(S);let E=this.refs[S];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")c(p,E.schema,S);else if(S!==vi(g))if(S[0]==="#")c(p,a[S],S),a[S]=p;else this.refs[S]=g;return S}function j(S){if(typeof S=="string"){if(!h5.test(S))throw Error(`invalid anchor "${S}"`);v.call(this,`#${S}`)}}}),a;function c(p,h,m){if(h!==void 0&&!l5(p,h))throw d(m)}function d(p){return Error(`reference "${p}" resolves to more than one schema`)}}o1.getSchemaRefs=g5});var wi=C(function(w1){Object.defineProperty(w1,"__esModule",{value:!0});w1.getData=w1.KeywordCxt=w1.validateFunctionCode=void 0;var d1=_S(),f1=Io(),Jf=kf(),Ul=Io(),w5=FS(),Jo=KS(),Df=QS(),ne=ye(),me=gr(),S5=Mo(),wn=we(),Do=To();function E5(e){if(h1(e)){if(g1(e),m1(e)){j5(e);return}}p1(e,()=>d1.topBoolOrEmptySchema(e))}w1.validateFunctionCode=E5;function p1({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){if(s.code.es5)e.func(t,ne._`${me.default.data}, ${me.default.valCxt}`,n.$async,()=>{e.code(ne._`"use strict"; ${l1(r,s)}`),P5(e,s),e.code(i)});else e.func(t,ne._`${me.default.data}, ${_5(s)}`,n.$async,()=>e.code(l1(r,s)).code(i))}function _5(e){return ne._`{${me.default.instancePath}="", ${me.default.parentData}, ${me.default.parentDataProperty}, ${me.default.rootData}=${me.default.data}${e.dynamicRef?ne._`, ${me.default.dynamicAnchors}={}`:ne.nil}}={}`}function P5(e,t){e.if(me.default.valCxt,()=>{if(e.var(me.default.instancePath,ne._`${me.default.valCxt}.${me.default.instancePath}`),e.var(me.default.parentData,ne._`${me.default.valCxt}.${me.default.parentData}`),e.var(me.default.parentDataProperty,ne._`${me.default.valCxt}.${me.default.parentDataProperty}`),e.var(me.default.rootData,ne._`${me.default.valCxt}.${me.default.rootData}`),t.dynamicRef)e.var(me.default.dynamicAnchors,ne._`${me.default.valCxt}.${me.default.dynamicAnchors}`)},()=>{if(e.var(me.default.instancePath,ne._`""`),e.var(me.default.parentData,ne._`undefined`),e.var(me.default.parentDataProperty,ne._`undefined`),e.var(me.default.rootData,me.default.data),t.dynamicRef)e.var(me.default.dynamicAnchors,ne._`{}`)})}function j5(e){let{schema:t,opts:r,gen:n}=e;p1(e,()=>{if(r.$comment&&t.$comment)b1(e);if(C5(e),n.let(me.default.vErrors,null),n.let(me.default.errors,0),r.unevaluated)k5(e);y1(e),I5(e)});return}function k5(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",ne._`${r}.evaluated`),t.if(ne._`${e.evaluated}.dynamicProps`,()=>t.assign(ne._`${e.evaluated}.props`,ne._`undefined`)),t.if(ne._`${e.evaluated}.dynamicItems`,()=>t.assign(ne._`${e.evaluated}.items`,ne._`undefined`))}function l1(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?ne._`/*# sourceURL=${r} */`:ne.nil}function R5(e,t){if(h1(e)){if(g1(e),m1(e)){A5(e,t);return}}d1.boolOrEmptySchema(e,t)}function m1({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function h1(e){return typeof e.schema!="boolean"}function A5(e,t){let{schema:r,gen:n,opts:s}=e;if(s.$comment&&r.$comment)b1(e);N5(e),T5(e);let i=n.const("_errs",me.default.errors);y1(e,i),n.var(t,ne._`${i} === ${me.default.errors}`)}function g1(e){wn.checkUnknownRules(e),O5(e)}function y1(e,t){if(e.opts.jtd)return c1(e,[],!1,t);let r=f1.getSchemaTypes(e.schema),n=f1.coerceAndCheckDataType(e,r);c1(e,r,!n,t)}function O5(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&wn.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function C5(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)wn.checkStrictMode(e,"default is ignored in the schema root")}function N5(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=S5.resolveUrl(e.opts.uriResolver,e.baseId,t)}function T5(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function b1({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)e.code(ne._`${me.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=ne.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(ne._`${me.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function I5(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;if(r.$async)t.if(ne._`${me.default.errors} === 0`,()=>t.return(me.default.data),()=>t.throw(ne._`new ${s}(${me.default.vErrors})`));else{if(t.assign(ne._`${n}.errors`,me.default.vErrors),i.unevaluated)M5(e);t.return(ne._`${me.default.errors} === 0`)}}function M5({gen:e,evaluated:t,props:r,items:n}){if(r instanceof ne.Name)e.assign(ne._`${t}.props`,r);if(n instanceof ne.Name)e.assign(ne._`${t}.items`,n)}function c1(e,t,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:l,self:c}=e,{RULES:d}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!wn.schemaHasRulesButRef(i,d))){s.block(()=>$1(e,"$ref",d.all.$ref.definition));return}if(!l.jtd)J5(e,t);s.block(()=>{for(let h of d.rules)p(h);p(d.post)});function p(h){if(!Jf.shouldUseGroup(i,h))return;if(h.type){if(s.if(Ul.checkDataType(h.type,o,l.strictNumbers)),u1(e,h),t.length===1&&t[0]===h.type&&r)s.else(),Ul.reportTypeError(e);s.endIf()}else u1(e,h);if(!a)s.if(ne._`${me.default.errors} === ${n||0}`)}}function u1(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;if(s)w5.assignDefaults(e,t.type);r.block(()=>{for(let i of t.rules)if(Jf.shouldUseRule(n,i))$1(e,i.keyword,i.definition,t.type)})}function J5(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(D5(e,t),!e.opts.allowUnionTypes)L5(e,t);F5(e,e.dataTypes)}function D5(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!x1(e.dataTypes,r))Lf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),H5(e,t)}function L5(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Lf(e,"use allowUnionTypes to allow union type keyword")}function F5(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&Jf.shouldUseRule(e.schema,s)){let{type:i}=s.definition;if(i.length&&!i.some((o)=>q5(t,o)))Lf(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function q5(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function x1(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function H5(e,t){let r=[];for(let n of e.dataTypes)if(x1(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Lf(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,wn.checkStrictMode(e,t,e.opts.strictTypes)}class Ff{constructor(e,t,r){if(Jo.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=wn.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",v1(this.$data,e));else if(this.schemaCode=this.schemaValue,!Jo.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",me.default.errors)}result(e,t,r){this.failResult(ne.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(ne.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(ne._`${t} !== undefined && (${ne.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Do.reportExtraError:Do.reportError)(this,this.def.error,t)}$dataError(){Do.reportError(this,this.def.$dataError||Do.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Do.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=ne.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=ne.nil,t=ne.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:s,def:i}=this;if(r.if(ne.or(ne._`${n} === undefined`,t)),e!==ne.nil)r.assign(e,!0);if(s.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:s}=this;return ne.or(i(),o());function i(){if(r.length){if(!(t instanceof ne.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return ne._`${Ul.checkDataTypes(a,t,s.opts.strictNumbers,Ul.DataType.Wrong)}`}return ne.nil}function o(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return ne._`!${a}(${t})`}return ne.nil}}subschema(e,t){let r=Df.getSubschema(this.it,e);Df.extendSubschemaData(r,this.it,e),Df.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return R5(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=wn.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=wn.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,ne.Name)),!0}}w1.KeywordCxt=Ff;function $1(e,t,r,n){let s=new Ff(e,r,t);if("code"in r)r.code(s,n);else if(s.$data&&r.validate)Jo.funcKeywordCode(s,r);else if("macro"in r)Jo.macroKeywordCode(s,r);else if(r.compile||r.validate)Jo.funcKeywordCode(s,r)}var V5=/^\/(?:[^~]|~0|~1)*$/,B5=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function v1(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return me.default.rootData;if(e[0]==="/"){if(!V5.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=me.default.rootData}else{let c=B5.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let d=+c[1];if(s=c[2],s==="#"){if(d>=t)throw Error(l("property/index",d));return n[t-d]}if(d>t)throw Error(l("data",d));if(i=r[t-d],!s)return i}let o=i,a=s.split("/");for(let c of a)if(c)i=ne._`${i}${ne.getProperty(wn.unescapeJsonPointer(c))}`,o=ne._`${o} && ${i}`;return o;function l(c,d){return`Cannot access ${c} ${d} levels up, current level is ${t}`}}w1.getData=v1});var Lo=C(function(_1){Object.defineProperty(_1,"__esModule",{value:!0});class E1 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}_1.default=E1});var Si=C(function(j1){Object.defineProperty(j1,"__esModule",{value:!0});var qf=Mo();class P1 extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=qf.resolveUrl(e,t,r),this.missingSchema=qf.normalizeId(qf.getFullPath(e,this.missingRef))}}j1.default=P1});var qo=C(function(A1){Object.defineProperty(A1,"__esModule",{value:!0});A1.resolveSchema=A1.getCompilingSchema=A1.resolveRef=A1.compileSchema=A1.SchemaEnv=void 0;var jr=ye(),K5=Lo(),ks=gr(),kr=Mo(),k1=we(),Y5=wi();class Fo{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:kr.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}A1.SchemaEnv=Fo;function Vf(e){let t=R1.call(this,e);if(t)return t;let r=kr.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new jr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;if(e.$async)a=o.scopeValue("Error",{ref:K5.default,code:jr._`require("ajv/dist/runtime/validation_error").default`});let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:ks.default.data,parentData:ks.default.parentData,parentDataProperty:ks.default.parentDataProperty,dataNames:[ks.default.data],dataPathArr:[jr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:jr.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:jr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:jr._`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),Y5.validateFunctionCode(c),o.optimize(this.opts.code.optimize);let p=o.toString();if(d=`${o.scopeRefs(ks.default.scope)}return ${p}`,this.opts.code.process)d=this.opts.code.process(d,e);let m=Function(`${ks.default.self}`,`${ks.default.scope}`,d)(this,this.scope.get());if(this.scope.value(l,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:l,validateCode:p,scopeValues:o._values};if(this.opts.unevaluated){let{props:b,items:g}=c;if(m.evaluated={props:b instanceof jr.Name?void 0:b,items:g instanceof jr.Name?void 0:g,dynamicProps:b instanceof jr.Name,dynamicItems:g instanceof jr.Name},m.source)m.source.evaluated=jr.stringify(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,d)this.logger.error("Error compiling schema, function code:",d);throw p}finally{this._compilations.delete(e)}}A1.compileSchema=Vf;function X5(e,t,r){var n;r=kr.resolveUrl(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=e3.call(this,e,r);if(i===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(o)i=new Fo({schema:o,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=Z5.call(this,i)}A1.resolveRef=X5;function Z5(e){if(kr.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Vf.call(this,e)}function R1(e){for(let t of this._compilations)if(Q5(t,e))return t}A1.getCompilingSchema=R1;function Q5(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function e3(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||zl.call(this,e,t)}function zl(e,t){let r=this.opts.uriResolver.parse(t),n=kr._getFullPath(this.opts.uriResolver,r),s=kr.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Hf.call(this,r,e);let i=kr.normalizeId(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=zl.call(this,e,o);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Hf.call(this,r,a)}if(typeof(o===null||o===void 0?void 0:o.schema)!=="object")return;if(!o.validate)Vf.call(this,o);if(i===kr.normalizeId(t)){let{schema:a}=o,{schemaId:l}=this.opts,c=a[l];if(c)s=kr.resolveUrl(this.opts.uriResolver,s,c);return new Fo({schema:a,schemaId:l,root:e,baseId:s})}return Hf.call(this,r,o)}A1.resolveSchema=zl;var t3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Hf(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let l=r[k1.unescapeFragment(a)];if(l===void 0)return;r=l;let c=typeof r==="object"&&r[this.opts.schemaId];if(!t3.has(a)&&c)t=kr.resolveUrl(this.opts.uriResolver,t,c)}let i;if(typeof r!="boolean"&&r.$ref&&!k1.schemaHasRulesButRef(r,this.RULES)){let a=kr.resolveUrl(this.opts.uriResolver,t,r.$ref);i=zl.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new Fo({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i;return}});var C1=C(function(xZ,o3){o3.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Kf=C(function($Z,F1){var a3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Wf=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),l3=RegExp.prototype.test.bind(/^\d*$/u),Rs=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Uf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),T1=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),zf=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),c3=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Gt=Array(256);for(let t=0;t<256;t++)Gt[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Et(e){if(e<2048)return Gt[192|e>>6]+Gt[128|e&63];if(e<65536)return Gt[224|e>>12]+Gt[128|e>>6&63]+Gt[128|e&63];return Gt[240|e>>18]+Gt[128|e>>12&63]+Gt[128|e>>6&63]+Gt[128|e&63]}function u3(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var d3=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),f3=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),p3=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),m3=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function h3(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(p3(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Rs(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function N1(e){let t=-1,r=0,n=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(s++,s>r)r=s,t=n}else n=-1,s=0;if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),o=e.slice(t+r).join(":");return i+"::"+o}function g3(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let s=r.concat(n),i=0;for(let a=0;a<s.length;a++){let l=s[a];if(l==="")return;if(l.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&n.length===0||!Wf(l))return;i+=2;continue}if(!d3(l))return;s[a]=parseInt(l,16).toString(16),i++}if(t===-1){if(i!==8)return;return N1(s)}if(i>=8)return;let o=s.slice(0,r.length);for(let a=i;a<8;a++)o.push("0");for(let a=r.length;a<s.length;a++)o.push(s[a]);return N1(o)}function Bf(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&f3(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(y3(n,":")<2)return{host:e,isIPV6:!1,error:t};let s="",i=n.indexOf("%");if(i!==-1){let a=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(s=n.slice(i+a),!h3(s))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let o=g3(n);if(o===void 0)return{host:e,isIPV6:!1,error:!0};return{host:o+(s?"%"+s:""),escapedHost:o+(s?"%25"+s:""),isIPV6:!0}}function y3(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function I1(e){let t=e,r=[],n=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(s===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function b3(e){if(e===""||e[0]==="/")return I1(e);let t=e.split("/"),r=t.length-1,n=[],s=!1;for(let i=0;i<=r;i++){let o=t[i];if(o==="."||o===".."){if(o==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");s=i===r}else n.push(o)}if(s&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var x3={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},$3=/[@/?#:]/g,v3=/[@/?#]/g;function M1(e,t){let r=t?v3:$3;return r.lastIndex=0,e.replace(r,(n)=>x3[n])}function J1(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(t&&Uf(o))r+=o;else r+="%"+i;n+=2;continue}}r+=e[n]}return r}function w3(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(o!=="."&&Uf(o))t+=o;else t+="%"+i;r+=2;continue}}if(T1(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=L1(s)?n:Gt[s];else if(s<55296||s>57343)t+=Et(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Et(65536+(s-55296<<10)+(i-56320)),r++;else t+=Et(65533)}else t+=Et(65533)}}return t}function S3(e,t=!1){let r="",n=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let i=e[s];if(i==="%"&&s+2<e.length){let o=e.slice(s+1,s+3);if(Rs(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(i==="/")n=!1;if(T1(i)&&(i!==":"||!n))r+=i;else{let o=e.charCodeAt(s);if(o<128)r+=Gt[o];else if(o<55296||o>57343)r+=Et(o);else if(o<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)r+=Et(65536+(o-55296<<10)+(a-56320)),s++;else r+=Et(65533)}else r+=Et(65533)}}return r}function Gf(e,t){let r="";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Rs(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(s))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Gt[i];else if(i<55296||i>57343)r+=Et(i);else if(i<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)r+=Et(65536+(i-55296<<10)+(o-56320)),n++;else r+=Et(65533)}else r+=Et(65533)}}return r}function D1(e){return Gf(e,c3)}function E3(e){return Gf(e,zf)}function _3(e){return Gf(e,zf)}function L1(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function P3(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(Uf(o))t+=o;else t+="%"+i;r+=2;continue}}if(zf(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=L1(s)?n:Gt[s];else if(s<55296||s>57343)t+=Et(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Et(65536+(s-55296<<10)+(i-56320)),r++;else t+=Et(65533)}else t+=Et(65533)}}return t}function j3(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Rs(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function k3(e){let t=[];if(e.userinfo!==void 0)t.push(D1(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Wf(r)){let n=Bf(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=J1(r,!0),n=Bf(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=M1(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!l3(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}F1.exports={nonSimpleDomain:m3,recomposeAuthority:k3,reescapeHostDelimiters:M1,normalizePercentEncoding:J1,normalizePathEncoding:w3,serializePathEncoding:S3,normalizeQueryFragmentEncoding:P3,encodeUserinfo:D1,encodeQuery:E3,encodeFragment:_3,escapePreservingEscapes:j3,removeDotSegments:I1,removeDotSegmentsRelative:b3,isIPv4:Wf,isUUID:a3,normalizeIPv6:Bf,stringArrayToHexStripped:u3}});var W1=C(function(vZ,B1){var{isUUID:R3}=Kf(),A3=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,O3=["http","https","ws","wss","urn","urn:uuid"];function C3(e){return O3.indexOf(e)!==-1}function Yf(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function q1(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function H1(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function N3(e){return e.secure=Yf(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function T3(e){if(e.port===(Yf(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function I3(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(A3);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=`${n}:${t.nid||e.nid}`,i=Xf(s);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function M3(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,i=Xf(s);if(i)e=i.serialize(e,t);let o=e,a=e.nss;return o.path=`${n||t.nid}:${a}`,t.skipEscape=!0,o}function J3(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!R3(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function D3(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var V1={scheme:"http",domainHost:!0,parse:q1,serialize:H1},L3={scheme:"https",domainHost:V1.domainHost,parse:q1,serialize:H1},Gl={scheme:"ws",domainHost:!0,parse:N3,serialize:T3},F3={scheme:"wss",domainHost:Gl.domainHost,parse:Gl.parse,serialize:Gl.serialize},q3={scheme:"urn",parse:I3,serialize:M3,skipNormalize:!0},H3={scheme:"urn:uuid",parse:J3,serialize:D3,skipNormalize:!0},Kl={http:V1,https:L3,ws:Gl,wss:F3,urn:q3,"urn:uuid":H3};Object.setPrototypeOf(Kl,null);function Xf(e){return e&&(Kl[e]||Kl[e.toLowerCase()])||void 0}B1.exports={wsIsSecure:Yf,SCHEMES:Kl,isValidSchemeName:C3,getSchemeHandler:Xf}});var iE=C(function(wZ,Ql){var{normalizeIPv6:Y1,removeDotSegments:Vo,removeDotSegmentsRelative:X1,recomposeAuthority:V3,normalizePercentEncoding:Zf,normalizePathEncoding:B3,serializePathEncoding:U1,normalizeQueryFragmentEncoding:z1,encodeQuery:W3,encodeFragment:U3,reescapeHostDelimiters:z3,isIPv4:Z1,nonSimpleDomain:G3}=Kf(),{SCHEMES:Q1,getSchemeHandler:Qf}=W1(),eE=/^[A-Za-z][A-Za-z0-9+.-]*$/u,K3=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function G1(e){let t=String(e);if(!eE.test(t))throw TypeError("URI scheme is malformed.");return t}function Y3(e,t){if(typeof e==="string")e=iH(e,t);else if(typeof e==="object")e=Xl(As(e,t),t);return e}function X3(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=Yl(e,n),{parsed:d,malformedAuthorityOrPort:p,malformedPercentEncoding:h,malformedSchemeSpecific:m,malformedHost:b,malformedScheme:g}=Yl(t,n);if(i||p||o||h||a||m||l||b||c||g)throw Error(s.error||d.error||"URI is malformed.");let y=tE(s,d,n,!0),v=Qf(r&&r.scheme||y.scheme),j=y.host,S=j!==void 0&&j!==""&&(Z1(j)||Y1(j).isIPV6);if(nE(y,r||{},v,S))throw Error("URI host is malformed.");rE(y,r||{},v,S);let P=j&&j.indexOf("%")!==-1&&!/\P{ASCII}/u.test(j);if(y.error&&!P)throw Error(y.error);return n.skipEscape=!0,As(y,n)}function tE(e,t,r,n){let s={};if(!n)e=Xl(As(e,r),r),t=Xl(As(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Vo(t.path||""),s.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Vo(t.path||""),s.query=t.query;else{if(!t.path)if(s.path=e.path,t.query!==void 0)s.query=t.query;else s.query=e.query;else{if(t.path[0]==="/")s.path=Vo(t.path);else{let i=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(i&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!i&&s.path[0]!=="/"?X1(s.path):Vo(s.path)}s.query=t.query}s.userinfo=e.userinfo,s.host=e.host,s.port=e.port}s.scheme=e.scheme}return s.fragment=t.fragment,s}function Z3(e,t,r){let n=K1(e,r),s=K1(t,r);return n!==void 0&&s!==void 0&&n===s}function As(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),s=[];if(r.scheme)r.scheme=G1(r.scheme);let i=Qf(n.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,n);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!o,l=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=U1(r.path,l);else r.path=Zf(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=G1(r.scheme),s.push(r.scheme,":");let c=V3(r);if(c!==void 0){if(n.reference!=="suffix")s.push("//");if(s.push(c),r.path&&r.path[0]!=="/")s.push("/")}if(r.path!==void 0){let d=r.path;if(!n.absolutePath&&(!i||!i.absolutePath))d=a&&d[0]!=="/"?X1(d):Vo(d);if(a)d=U1(d,!0);if(c===void 0&&d[0]==="/"&&d[1]==="/")d="/%2F"+d.slice(2);s.push(d)}if(r.query!==void 0)s.push("?",W3(r.query));if(r.fragment!==void 0)s.push("#",U3(r.fragment));return s.join("")}var Q3=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,eH=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,tH=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function rH(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function Ho(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Zl(e){return e[0]==="["&&e[e.length-1]==="]"}function nH(e){let t=e[4];return Ho(e[3])||t!==void 0&&!Zl(t)&&Ho(t)||Ho(e[6])||Ho(e[7])||Ho(e[8])}function rE(e,t,r,n){if(nE(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Zl(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&G3(e.host)){let s;try{s=new URL("http://"+e.host)}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}if(!sH(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function nE(e,t,r,n){return Boolean(e.host&&n===!1&&!Zl(e.host)&&(t.domainHost||r&&r.domainHost)&&K3.test(e.host))}function sH(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Yl(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,d=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let p=e.match(eH);if(p!==null&&p[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",s=!0;let h=e.match(tH);if(h!==null){let b=h[1],g=b.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",s=!0;else if(b.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(Q3);if(m){if(n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],n.scheme!==void 0)if(eE.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(i=nH(m),i)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let b=rH(n,m);if(b!==void 0)n.error=n.error||b,s=!0;if(n.host)if(Z1(n.host)===!1){let v=Zl(n.host),j=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=Y1(n.host);if(d=S.isIPV6||S.isIPVFuture===!0,l=j&&(!v||S.error===!0),n.host=d?S.host:S.host.toLowerCase(),l)n.error=n.error||"URI host is malformed.",s=!0}else d=!0;if(n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path)n.reference="same-document";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let g=Qf(r.scheme||n.scheme);if(!l)a=rE(n,r,g,d);if(e.indexOf("%")!==-1&&n.host!==void 0&&!l){let y=d?n.host:Zf(n.host,!0);if(!d)y=Zf(y.toLowerCase());n.host=d||r.scheme!=="null"?z3(y,d):y}if(!g||g&&!g.skipNormalize){if(n.path)n.path=B3(n.path);if(n.query)n.query=z1(n.query);if(n.fragment)n.fragment=z1(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===Q1.urn&&n.nid===void 0)o=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:c}}function Xl(e,t){return Yl(e,t).parsed}function iH(e,t){return sE(e,t).normalized}function sE(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}=Yl(e,t);return{normalized:n||s||i||o||a?e:As(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}}function K1(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:As(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}=sE(r,t);return s||i||o||a||l?void 0:n}var ep={SCHEMES:Q1,normalize:Y3,resolve:X3,resolveComponent:tE,equal:Z3,serialize:As,parse:Xl};Ql.exports=ep;Ql.exports.default=ep;Ql.exports.fastUri=ep});var lE=C(function(aE){Object.defineProperty(aE,"__esModule",{value:!0});var oE=iE();oE.code='require("ajv/dist/runtime/uri").default';aE.default=oE});var np=C(function(Sn){Object.defineProperty(Sn,"__esModule",{value:!0});Sn.CodeGen=Sn.Name=Sn.nil=Sn.stringify=Sn.str=Sn._=Sn.KeywordCxt=void 0;var aH=wi();Object.defineProperty(Sn,"KeywordCxt",{enumerable:!0,get:function(){return aH.KeywordCxt}});var Ei=ye();Object.defineProperty(Sn,"_",{enumerable:!0,get:function(){return Ei._}});Object.defineProperty(Sn,"str",{enumerable:!0,get:function(){return Ei.str}});Object.defineProperty(Sn,"stringify",{enumerable:!0,get:function(){return Ei.stringify}});Object.defineProperty(Sn,"nil",{enumerable:!0,get:function(){return Ei.nil}});Object.defineProperty(Sn,"Name",{enumerable:!0,get:function(){return Ei.Name}});Object.defineProperty(Sn,"CodeGen",{enumerable:!0,get:function(){return Ei.CodeGen}});var lH=Lo(),pE=Si(),cH=jf(),Wo=qo(),uH=ye(),Bo=Mo(),ec=Io(),rp=we(),cE=C1(),dH=lE(),mE=(e,t)=>new RegExp(e,t);mE.code="new RegExp";var fH=["removeAdditional","useDefaults","coerceTypes"],pH=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),mH={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."},hH={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},uE=200;function gH(e){var t,r,n,s,i,o,a,l,c,d,p,h,m,b,g,y,v,j,S,P,E,O,R,k,I;let D=e.strict,M=(t=e.code)===null||t===void 0?void 0:t.optimize,L=M===!0||M===void 0?1:M||0,W=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:mE,se=(s=e.uriResolver)!==null&&s!==void 0?s:dH.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:D)!==null&&o!==void 0?o:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:D)!==null&&l!==void 0?l:!0,strictTypes:(d=(c=e.strictTypes)!==null&&c!==void 0?c:D)!==null&&d!==void 0?d:"log",strictTuples:(h=(p=e.strictTuples)!==null&&p!==void 0?p:D)!==null&&h!==void 0?h:"log",strictRequired:(b=(m=e.strictRequired)!==null&&m!==void 0?m:D)!==null&&b!==void 0?b:!1,code:e.code?{...e.code,optimize:L,regExp:W}:{optimize:L,regExp:W},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:uE,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:uE,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(P=e.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(O=e.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(k=e.unicodeRegExp)!==null&&k!==void 0?k:!0,int32range:(I=e.int32range)!==null&&I!==void 0?I:!0,uriResolver:se}}class tc{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...gH(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new uH.ValueScope({scope:{},prefixes:pH,es5:t,lines:r}),this.logger=wH(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=cH.getRules(),dE.call(this,mH,e,"NOT SUPPORTED"),dE.call(this,hH,e,"DEPRECATED","warn"),this._metaOpts=$H.call(this),e.formats)bH.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)xH.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);yH.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=cE;if(r==="id")n={...cE},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(c,d){await s.call(this,c.$schema);let p=this._addSchema(c,d);return p.validate||i.call(this,p)}async function s(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function i(c){try{return this._compileSchemaEnv(c)}catch(d){if(!(d instanceof pE.default))throw d;return o.call(this,d),await a.call(this,d.missingSchema),i.call(this,c)}}function o({missingSchema:c,missingRef:d}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${d} cannot be resolved`)}async function a(c){let d=await l.call(this,c);if(!this.refs[c])await s.call(this,d.$schema);if(!this.refs[c])this.addSchema(d,c,t)}async function l(c){let d=this._loading[c];if(d)return d;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,n);return this}let s;if(typeof e==="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw Error(`schema ${i} must be string`)}return t=Bo.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return n}getSchema(e){let t;while(typeof(t=fE.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new Wo.SchemaEnv({schema:{},schemaId:r});if(t=Wo.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=fE.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Bo.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(EH.call(this,r,t),!t)return rp.eachItem(r,(s)=>tp.call(this,s)),this;PH.call(this,t);let n={...t,type:ec.getJSONTypes(t.type),schemaType:ec.getJSONTypes(t.schemaType)};return rp.eachItem(r,n.type.length===0?(s)=>tp.call(this,s,n):(s)=>n.type.forEach((i)=>tp.call(this,s,n,i))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((s)=>s.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,s)=>n+t+s)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let s=n.split("/").slice(1),i=e;for(let o of s)i=i[o];for(let o in r){let a=r[o];if(typeof a!="object")continue;let{$data:l}=a.definition,c=i[o];if(l&&c)i[o]=hE(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:o}=this.opts;if(typeof e=="object")i=e[o];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=Bo.normalizeId(i||r);let l=Bo.getSchemaRefs.call(this,e,r);if(a=new Wo.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:l}),this._cache.set(a.schema,a),s&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Wo.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Wo.compileSchema.call(this,e)}finally{this.opts=t}}}tc.ValidationError=lH.default;tc.MissingRefError=pE.default;Sn.default=tc;function dE(e,t,r,n="error"){for(let s in e){let i=s;if(i in t)this.logger[n](`${r}: option ${s}. ${e[i]}`)}}function fE(e){return e=Bo.normalizeId(e),this.schemas[e]||this.refs[e]}function yH(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function bH(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function xH(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function $H(){let e={...this.opts};for(let t of fH)delete e[t];return e}var vH={log(){},warn(){},error(){}};function wH(e){if(e===!1)return vH;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var SH=/^[a-z_$][a-z0-9_$:-]*$/i;function EH(e,t){let{RULES:r}=this;if(rp.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!SH.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function tp(e,t,r){var n;let s=t===null||t===void 0?void 0:t.post;if(r&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=s?i.post:i.rules.find(({type:l})=>l===r);if(!o)o={type:r,rules:[]},i.rules.push(o);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:ec.getJSONTypes(t.type),schemaType:ec.getJSONTypes(t.schemaType)}};if(t.before)_H.call(this,o,a,t.before);else o.rules.push(a);i.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((l)=>this.addKeyword(l))}function _H(e,t,r){let n=e.rules.findIndex((s)=>s.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function PH(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=hE(t);e.validateSchema=this.compile(t,!0)}var jH={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function hE(e){return{anyOf:[e,jH]}}});var yE=C(function(gE){Object.defineProperty(gE,"__esModule",{value:!0});var AH={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};gE.default=AH});var sc=C(function(vE){Object.defineProperty(vE,"__esModule",{value:!0});vE.callRef=vE.getValidate=void 0;var CH=Si(),bE=yr(),Kt=ye(),_i=gr(),xE=qo(),rc=we(),NH={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:a,self:l}=n,{root:c}=i;if((r==="#"||r==="#/")&&s===c.baseId)return p();let d=xE.resolveRef.call(l,c,s,r);if(d===void 0)throw new CH.default(n.opts.uriResolver,s,r);if(d instanceof xE.SchemaEnv)return h(d);return m(d);function p(){if(i===c)return nc(e,o,i,i.$async);let b=t.scopeValue("root",{ref:c});return nc(e,Kt._`${b}.validate`,c,c.$async)}function h(b){let g=$E(e,b);nc(e,g,b,b.$async)}function m(b){let g=t.scopeValue("schema",a.code.source===!0?{ref:b,code:Kt.stringify(b)}:{ref:b}),y=t.name("valid"),v=e.subschema({schema:b,dataTypes:[],schemaPath:Kt.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function $E(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Kt._`${r.scopeValue("wrapper",{ref:t})}.validate`}vE.getValidate=$E;function nc(e,t,r,n){let{gen:s,it:i}=e,{allErrors:o,schemaEnv:a,opts:l}=i,c=l.passContext?_i.default.this:Kt.nil;if(n)d();else p();function d(){if(!a.$async)throw Error("async schema referenced by sync schema");let b=s.let("valid");s.try(()=>{if(s.code(Kt._`await ${bE.callValidateCode(e,t,c)}`),m(t),!o)s.assign(b,!0)},(g)=>{if(s.if(Kt._`!(${g} instanceof ${i.ValidationError})`,()=>s.throw(g)),h(g),!o)s.assign(b,!1)}),e.ok(b)}function p(){e.result(bE.callValidateCode(e,t,c),()=>m(t),()=>h(t))}function h(b){let g=Kt._`${b}.errors`;s.assign(_i.default.vErrors,Kt._`${_i.default.vErrors} === null ? ${g} : ${_i.default.vErrors}.concat(${g})`),s.assign(_i.default.errors,Kt._`${_i.default.vErrors}.length`)}function m(b){var g;if(!i.opts.unevaluated)return;let y=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)i.props=rc.mergeEvaluated.props(s,y.props,i.props)}else{let v=s.var("props",Kt._`${b}.evaluated.props`);i.props=rc.mergeEvaluated.props(s,v,i.props,Kt.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=rc.mergeEvaluated.items(s,y.items,i.items)}else{let v=s.var("items",Kt._`${b}.evaluated.items`);i.items=rc.mergeEvaluated.items(s,v,i.items,Kt.Name)}}}vE.callRef=nc;vE.default=NH});var sp=C(function(SE){Object.defineProperty(SE,"__esModule",{value:!0});var MH=yE(),JH=sc(),DH=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",MH.default,JH.default];SE.default=DH});var _E=C(function(EE){Object.defineProperty(EE,"__esModule",{value:!0});var oc=ye(),Yn=oc.operators,ic={maximum:{okStr:"<=",ok:Yn.LTE,fail:Yn.GT},minimum:{okStr:">=",ok:Yn.GTE,fail:Yn.LT},exclusiveMaximum:{okStr:"<",ok:Yn.LT,fail:Yn.GTE},exclusiveMinimum:{okStr:">",ok:Yn.GT,fail:Yn.LTE}},FH={message:({keyword:e,schemaCode:t})=>oc.str`must be ${ic[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>oc._`{comparison: ${ic[e].okStr}, limit: ${t}}`},qH={keyword:Object.keys(ic),type:"number",schemaType:"number",$data:!0,error:FH,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(oc._`${r} ${ic[t].fail} ${n} || isNaN(${r})`)}};EE.default=qH});var jE=C(function(PE){Object.defineProperty(PE,"__esModule",{value:!0});var Uo=ye(),VH={message:({schemaCode:e})=>Uo.str`must be multiple of ${e}`,params:({schemaCode:e})=>Uo._`{multipleOf: ${e}}`},BH={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:VH,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),a=i?Uo._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:Uo._`${o} !== parseInt(${o})`;e.fail$data(Uo._`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};PE.default=BH});var AE=C(function(RE){Object.defineProperty(RE,"__esModule",{value:!0});function kE(e){let t=e.length,r=0,n=0,s;while(n<t)if(r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t){if(s=e.charCodeAt(n),(s&64512)===56320)n++}return r}RE.default=kE;kE.code='require("ajv/dist/runtime/ucs2length").default'});var CE=C(function(OE){Object.defineProperty(OE,"__esModule",{value:!0});var Os=ye(),zH=we(),GH=AE(),KH={message({keyword:e,schemaCode:t}){return Os.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Os._`{limit: ${e}}`},YH={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:KH,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?Os.operators.GT:Os.operators.LT,o=s.opts.unicode===!1?Os._`${r}.length`:Os._`${zH.useFunc(e.gen,GH.default)}(${r})`;e.fail$data(Os._`${o} ${i} ${n}`)}};OE.default=YH});var TE=C(function(NE){Object.defineProperty(NE,"__esModule",{value:!0});var ZH=yr(),QH=we(),Pi=ye(),eV={message:({schemaCode:e})=>Pi.str`must match pattern "${e}"`,params:({schemaCode:e})=>Pi._`{pattern: ${e}}`},tV={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:eV,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e,a=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:l}=o.opts.code,c=l.code==="new RegExp"?Pi._`new RegExp`:QH.useFunc(t,l),d=t.let("valid");t.try(()=>t.assign(d,Pi._`${c}(${i}, ${a}).test(${r})`),()=>t.assign(d,!1)),e.fail$data(Pi._`!${d}`)}else{let l=ZH.usePattern(e,s);e.fail$data(Pi._`!${l}.test(${r})`)}}};NE.default=tV});var ME=C(function(IE){Object.defineProperty(IE,"__esModule",{value:!0});var zo=ye(),nV={message({keyword:e,schemaCode:t}){return zo.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>zo._`{limit: ${e}}`},sV={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:nV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?zo.operators.GT:zo.operators.LT;e.fail$data(zo._`Object.keys(${r}).length ${s} ${n}`)}};IE.default=sV});var DE=C(function(JE){Object.defineProperty(JE,"__esModule",{value:!0});var Ko=yr(),Go=ye(),oV=we(),aV={message:({params:{missingProperty:e}})=>Go.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Go._`{missingProperty: ${e}}`},lV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:aV,code(e){let{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:o}=e,{opts:a}=o;if(!i&&r.length===0)return;let l=r.length>=a.loopRequired;if(o.allErrors)c();else d();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:b}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!b.has(g)){let y=o.schemaEnv.baseId+o.errSchemaPath,v=`required property "${g}" is not defined at "${y}" (strictRequired)`;oV.checkStrictMode(o,v,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(Go.nil,p);else for(let m of r)Ko.checkReportMissingProp(e,m)}function d(){let m=t.let("missing");if(l||i){let b=t.let("valid",!0);e.block$data(b,()=>h(m,b)),e.ok(b)}else t.if(Ko.checkMissingProp(e,r,m)),Ko.reportMissingProp(e,m),t.else()}function p(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(Ko.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function h(m,b){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(b,Ko.propertyInData(t,s,m,a.ownProperties)),t.if(Go.not(b),()=>{e.error(),t.break()})},Go.nil)}}};JE.default=lV});var FE=C(function(LE){Object.defineProperty(LE,"__esModule",{value:!0});var Yo=ye(),uV={message({keyword:e,schemaCode:t}){return Yo.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Yo._`{limit: ${e}}`},dV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:uV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Yo.operators.GT:Yo.operators.LT;e.fail$data(Yo._`${r}.length ${s} ${n}`)}};LE.default=dV});var ac=C(function(HE){Object.defineProperty(HE,"__esModule",{value:!0});var qE=If();qE.code='require("ajv/dist/runtime/equal").default';HE.default=qE});var BE=C(function(VE){Object.defineProperty(VE,"__esModule",{value:!0});var ip=Io(),yt=ye(),mV=we(),hV=ac(),gV={message:({params:{i:e,j:t}})=>yt.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>yt._`{i: ${e}, j: ${t}}`},yV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:gV,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:a}=e;if(!n&&!s)return;let l=t.let("valid"),c=i.items?ip.getSchemaTypes(i.items):[];e.block$data(l,d,yt._`${o} === false`),e.ok(l);function d(){let b=t.let("i",yt._`${r}.length`),g=t.let("j");e.setParams({i:b,j:g}),t.assign(l,!0),t.if(yt._`${b} > 1`,()=>(p()?h:m)(b,g))}function p(){return c.length>0&&!c.some((b)=>b==="object"||b==="array")}function h(b,g){let y=t.name("item"),v=ip.checkDataTypes(c,y,a.opts.strictNumbers,ip.DataType.Wrong),j=t.const("indices",yt._`{}`);t.for(yt._`;${b}--;`,()=>{if(t.let(y,yt._`${r}[${b}]`),t.if(v,yt._`continue`),c.length>1)t.if(yt._`typeof ${y} == "string"`,yt._`${y} += "_"`);t.if(yt._`typeof ${j}[${y}] == "number"`,()=>{t.assign(g,yt._`${j}[${y}]`),e.error(),t.assign(l,!1).break()}).code(yt._`${j}[${y}] = ${b}`)})}function m(b,g){let y=mV.useFunc(t,hV.default),v=t.name("outer");t.label(v).for(yt._`;${b}--;`,()=>t.for(yt._`${g} = ${b}; ${g}--;`,()=>t.if(yt._`${y}(${r}[${b}], ${r}[${g}])`,()=>{e.error(),t.assign(l,!1).break(v)})))}}};VE.default=yV});var UE=C(function(WE){Object.defineProperty(WE,"__esModule",{value:!0});var op=ye(),xV=we(),$V=ac(),vV={message:"must be equal to constant",params:({schemaCode:e})=>op._`{allowedValue: ${e}}`},wV={keyword:"const",$data:!0,error:vV,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;if(n||i&&typeof i=="object")e.fail$data(op._`!${xV.useFunc(t,$V.default)}(${r}, ${s})`);else e.fail(op._`${i} !== ${r}`)}};WE.default=wV});var GE=C(function(zE){Object.defineProperty(zE,"__esModule",{value:!0});var Xo=ye(),EV=we(),_V=ac(),PV={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Xo._`{allowedValues: ${e}}`},jV={keyword:"enum",schemaType:"array",$data:!0,error:PV,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e;if(!n&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=o.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=EV.useFunc(t,_V.default),d;if(a||n)d=t.let("valid"),e.block$data(d,p);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",i);d=Xo.or(...s.map((b,g)=>h(m,g)))}e.pass(d);function p(){t.assign(d,!1),t.forOf("v",i,(m)=>t.if(Xo._`${c()}(${r}, ${m})`,()=>t.assign(d,!0).break()))}function h(m,b){let g=s[b];return typeof g==="object"&&g!==null?Xo._`${c()}(${r}, ${m}[${b}])`:Xo._`${r} === ${g}`}}};zE.default=jV});var ap=C(function(KE){Object.defineProperty(KE,"__esModule",{value:!0});var RV=_E(),AV=jE(),OV=CE(),CV=TE(),NV=ME(),TV=DE(),IV=FE(),MV=BE(),JV=UE(),DV=GE(),LV=[RV.default,AV.default,OV.default,CV.default,NV.default,TV.default,IV.default,MV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},JV.default,DV.default];KE.default=LV});var cp=C(function(XE){Object.defineProperty(XE,"__esModule",{value:!0});XE.validateAdditionalItems=void 0;var Cs=ye(),lp=we(),qV={message:({params:{len:e}})=>Cs.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Cs._`{limit: ${e}}`},HV={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:qV,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){lp.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}YE(e,n)}};function YE(e,t){let{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;let a=r.const("len",Cs._`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Cs._`${a} <= ${t.length}`);else if(typeof n=="object"&&!lp.alwaysValidSchema(o,n)){let c=r.var("valid",Cs._`${a} <= ${t.length}`);r.if(Cs.not(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,a,(d)=>{if(e.subschema({keyword:i,dataProp:d,dataPropType:lp.Type.Num},c),!o.allErrors)r.if(Cs.not(c),()=>r.break())})}}XE.validateAdditionalItems=YE;XE.default=HV});var up=C(function(t_){Object.defineProperty(t_,"__esModule",{value:!0});t_.validateTuple=void 0;var QE=ye(),lc=we(),BV=yr(),WV={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return e_(e,"additionalItems",t);if(r.items=!0,lc.alwaysValidSchema(r,t))return;e.ok(BV.validateArray(e))}};function e_(e,t,r=e.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=e;if(d(s),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=lc.mergeEvaluated.items(n,r.length,a.items);let l=n.name("valid"),c=n.const("len",QE._`${i}.length`);r.forEach((p,h)=>{if(lc.alwaysValidSchema(a,p))return;n.if(QE._`${c} > ${h}`,()=>e.subschema({keyword:o,schemaProp:h,dataProp:h},l)),e.ok(l)});function d(p){let{opts:h,errSchemaPath:m}=a,b=r.length,g=b===p.minItems&&(b===p.maxItems||p[t]===!1);if(h.strictTuples&&!g){let y=`"${o}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;lc.checkStrictMode(a,y,h.strictTuples)}}}t_.validateTuple=e_;t_.default=WV});var s_=C(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});var zV=up(),GV={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>zV.validateTuple(e,"items")};n_.default=GV});var a_=C(function(o_){Object.defineProperty(o_,"__esModule",{value:!0});var i_=ye(),YV=we(),XV=yr(),ZV=cp(),QV={message:({params:{len:e}})=>i_.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i_._`{limit: ${e}}`},e4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:QV,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;if(n.items=!0,YV.alwaysValidSchema(n,t))return;if(s)ZV.validateAdditionalItems(e,s);else e.ok(XV.validateArray(e))}};o_.default=e4});var c_=C(function(l_){Object.defineProperty(l_,"__esModule",{value:!0});var br=ye(),cc=we(),r4={message:({params:{min:e,max:t}})=>t===void 0?br.str`must contain at least ${e} valid item(s)`:br.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?br._`{minContains: ${e}}`:br._`{minContains: ${e}, maxContains: ${t}}`},n4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:r4,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e,o,a,{minContains:l,maxContains:c}=n;if(i.opts.next)o=l===void 0?1:l,a=c;else o=1;let d=t.const("len",br._`${s}.length`);if(e.setParams({min:o,max:a}),a===void 0&&o===0){cc.checkStrictMode(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){cc.checkStrictMode(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(cc.alwaysValidSchema(i,r)){let g=br._`${d} >= ${o}`;if(a!==void 0)g=br._`${g} && ${d} <= ${a}`;e.pass(g);return}i.items=!0;let p=t.name("valid");if(a===void 0&&o===1)m(p,()=>t.if(p,()=>t.break()));else if(o===0){if(t.let(p,!0),a!==void 0)t.if(br._`${s}.length > 0`,h)}else t.let(p,!1),h();e.result(p,()=>e.reset());function h(){let g=t.name("_valid"),y=t.let("count",0);m(g,()=>t.if(g,()=>b(y)))}function m(g,y){t.forRange("i",0,d,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:cc.Type.Num,compositeRule:!0},g),y()})}function b(g){if(t.code(br._`${g}++`),a===void 0)t.if(br._`${g} >= ${o}`,()=>t.assign(p,!0).break());else if(t.if(br._`${g} > ${a}`,()=>t.assign(p,!1).break()),o===1)t.assign(p,!0);else t.if(br._`${g} >= ${o}`,()=>t.assign(p,!0))}}};l_.default=n4});var uc=C(function(f_){Object.defineProperty(f_,"__esModule",{value:!0});f_.validateSchemaDeps=f_.validatePropertyDeps=f_.error=void 0;var dp=ye(),i4=we(),Zo=yr();f_.error={message:({params:{property:e,depsCount:t,deps:r}})=>dp.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>dp._`{property: ${e},
|
|
569
567
|
missingProperty: ${n},
|
|
570
568
|
depsCount: ${t},
|
|
571
|
-
deps: ${r}}`};var QV={keyword:"dependencies",type:"object",schemaType:"object",error:m_.error,code(e){let[t,r]=e4(e);f_(e,t),p_(e,r)}};function e4({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n]}return[t,r]}function f_(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let a=t[o];if(a.length===0)continue;let l=ra.propertyInData(r,n,o,s.opts.ownProperties);if(e.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),s.allErrors)r.if(l,()=>{for(let c of a)ra.checkReportMissingProp(e,c)});else r.if(pp._`${l} && (${ra.checkMissingProp(e,a,i)})`),ra.reportMissingProp(e,i),r.else()}}m_.validatePropertyDeps=f_;function p_(e,t=e.schema){let{gen:r,data:n,keyword:s,it:i}=e,o=r.name("valid");for(let a in t){if(ZV.alwaysValidSchema(i,t[a]))continue;r.if(ra.propertyInData(r,n,a,i.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},o);e.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),e.ok(o)}}m_.validateSchemaDeps=p_;m_.default=QV});var x_=C(function(b_){Object.defineProperty(b_,"__esModule",{value:!0});var y_=ye(),n4=we(),s4={message:"property name must be valid",params:({params:e})=>y_._`{propertyName: ${e.propertyName}}`},i4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:s4,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(n4.alwaysValidSchema(s,r))return;let 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(y_.not(i),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(i)}};b_.default=i4});var mp=C(function($_){Object.defineProperty($_,"__esModule",{value:!0});var pc=yr(),Rr=ye(),a4=gr(),mc=we(),l4={message:"must NOT have additional properties",params:({params:e})=>Rr._`{additionalProperty: ${e.additionalProperty}}`},c4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:l4,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&mc.alwaysValidSchema(o,r))return;let c=pc.allSchemaProperties(n.properties),d=pc.allSchemaProperties(n.patternProperties);p(),e.ok(Rr._`${i} === ${a4.default.errors}`);function p(){t.forIn("key",s,(y)=>{if(!c.length&&!d.length)b(y);else t.if(h(y),()=>b(y))})}function h(y){let v;if(c.length>8){let j=mc.schemaRefOrVal(o,n.properties,"properties");v=pc.isOwnProperty(t,j,y)}else if(c.length)v=Rr.or(...c.map((j)=>Rr._`${y} === ${j}`));else v=Rr.nil;if(d.length)v=Rr.or(v,...d.map((j)=>Rr._`${pc.usePattern(e,j)}.test(${y})`));return Rr.not(v)}function m(y){t.code(Rr._`delete ${s}[${y}]`)}function b(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){m(y);return}if(r===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof r=="object"&&!mc.alwaysValidSchema(o,r)){let v=t.name("valid");if(l.removeAdditional==="failing")g(y,v,!1),t.if(Rr.not(v),()=>{e.reset(),m(y)});else if(g(y,v),!a)t.if(Rr.not(v),()=>t.break())}}function g(y,v,j){let S={keyword:"additionalProperties",dataProp:y,dataPropType:mc.Type.Str};if(j===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,v)}}};$_.default=c4});var E_=C(function(S_){Object.defineProperty(S_,"__esModule",{value:!0});var d4=wi(),w_=yr(),hp=we(),v_=mp(),f4={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;if(i.opts.removeAdditional==="all"&&n.additionalProperties===void 0)v_.default.code(new d4.KeywordCxt(i,v_.default,"additionalProperties"));let o=w_.allSchemaProperties(r);for(let p of o)i.definedProperties.add(p);if(i.opts.unevaluated&&o.length&&i.props!==!0)i.props=hp.mergeEvaluated.props(t,hp.toHash(o),i.props);let a=o.filter((p)=>!hp.alwaysValidSchema(i,r[p]));if(a.length===0)return;let l=t.name("valid");for(let p of a){if(c(p))d(p);else{if(t.if(w_.propertyInData(t,s,p,i.opts.ownProperties)),d(p),!i.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(l)}function c(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function d(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};S_.default=f4});var R_=C(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});var __=yr(),hc=ye(),P_=we(),j_=we(),m4={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,a=__.allSchemaProperties(r),l=a.filter((g)=>P_.alwaysValidSchema(i,r[g]));if(a.length===0||l.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&s.properties,d=t.name("valid");if(i.props!==!0&&!(i.props instanceof hc.Name))i.props=j_.evaluatedPropsToName(t,i.props);let{props:p}=i;h();function h(){for(let g of a){if(c)m(g);if(i.allErrors)b(g);else t.var(d,!0),b(g),t.if(d)}}function m(g){for(let y in c)if(new RegExp(g).test(y))P_.checkStrictMode(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function b(g){t.forIn("key",n,(y)=>{t.if(hc._`${__.usePattern(e,g)}.test(${y})`,()=>{let v=l.includes(g);if(!v)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:j_.Type.Str},d);if(i.opts.unevaluated&&p!==!0)t.assign(hc._`${p}[${y}]`,!0);else if(!v&&!i.allErrors)t.if(hc.not(d),()=>t.break())})})}}};k_.default=m4});var O_=C(function(A_){Object.defineProperty(A_,"__esModule",{value:!0});var g4=we(),y4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(g4.alwaysValidSchema(n,r)){e.fail();return}let 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"}};A_.default=y4});var T_=C(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});var x4=yr(),$4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:x4.validateUnion,error:{message:"must match a schema in anyOf"}};C_.default=$4});var I_=C(function(N_){Object.defineProperty(N_,"__esModule",{value:!0});var gc=ye(),w4=we(),S4={message:"must match exactly one schema in oneOf",params:({params:e})=>gc._`{passingSchemas: ${e.passing}}`},E4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:S4,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let i=r,o=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((d,p)=>{let h;if(w4.alwaysValidSchema(s,d))t.var(l,!0);else h=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l);if(p>0)t.if(gc._`${l} && ${o}`).assign(o,!1).assign(a,gc._`[${a}, ${p}]`).else();t.if(l,()=>{if(t.assign(o,!0),t.assign(a,p),h)e.mergeEvaluated(h,gc.Name)})})}}};N_.default=E4});var J_=C(function(M_){Object.defineProperty(M_,"__esModule",{value:!0});var P4=we(),j4={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let s=t.name("valid");r.forEach((i,o)=>{if(P4.alwaysValidSchema(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(a)})}};M_.default=j4});var q_=C(function(F_){Object.defineProperty(F_,"__esModule",{value:!0});var yc=ye(),L_=we(),R4={message:({params:e})=>yc.str`must match "${e.ifClause}" schema`,params:({params:e})=>yc._`{failingKeyword: ${e.ifClause}}`},A4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:R4,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)L_.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=D_(n,"then"),i=D_(n,"else");if(!s&&!i)return;let o=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&i){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,c("then",d),c("else",d))}else if(s)t.if(a,c("then"));else t.if(yc.not(a),c("else"));e.pass(o,()=>e.error(!0));function l(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function c(d,p){return()=>{let h=e.subschema({keyword:d},a);if(t.assign(o,a),e.mergeValidEvaluated(h,o),p)t.assign(p,yc._`${d}`);else e.setParams({ifClause:d})}}}};function D_(e,t){let r=e.schema[t];return r!==void 0&&!L_.alwaysValidSchema(e,r)}F_.default=A4});var V_=C(function(H_){Object.defineProperty(H_,"__esModule",{value:!0});var C4=we(),T4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)C4.checkStrictMode(r,`"${e}" without "if" is ignored`)}};H_.default=T4});var gp=C(function(W_){Object.defineProperty(W_,"__esModule",{value:!0});var I4=dp(),M4=o_(),J4=fp(),D4=c_(),L4=d_(),F4=fc(),q4=x_(),H4=mp(),V4=E_(),W4=R_(),B4=O_(),U4=T_(),z4=I_(),G4=J_(),K4=q_(),Y4=V_();function X4(e=!1){let t=[B4.default,U4.default,z4.default,G4.default,K4.default,Y4.default,q4.default,H4.default,F4.default,V4.default,W4.default];if(e)t.push(M4.default,D4.default);else t.push(I4.default,J4.default);return t.push(L4.default),t}W_.default=X4});var bp=C(function(z_){Object.defineProperty(z_,"__esModule",{value:!0});z_.dynamicAnchor=void 0;var yp=ye(),Q4=gr(),B_=Bo(),eW=oc(),tW={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>U_(e,e.schema)};function U_(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let s=yp._`${Q4.default.dynamicAnchors}${yp.getProperty(t)}`,i=n.errSchemaPath==="#"?n.validateName:rW(e);r.if(yp._`!${s}`,()=>r.assign(s,i))}z_.dynamicAnchor=U_;function rW(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:i,localRefs:o,meta:a}=t.root,{schemaId:l}=n.opts,c=new B_.SchemaEnv({schema:r,schemaId:l,root:s,baseId:i,localRefs:o,meta:a});return B_.compileSchema.call(n,c),eW.getValidate(e,c)}z_.default=tW});var xp=C(function(Z_){Object.defineProperty(Z_,"__esModule",{value:!0});Z_.dynamicRef=void 0;var Y_=ye(),sW=gr(),K_=oc(),iW={keyword:"$dynamicRef",schemaType:"string",code:(e)=>X_(e,e.schema)};function X_(e,t){let{gen:r,keyword:n,it:s}=e;if(t[0]!=="#")throw Error(`"${n}" only supports hash fragment reference`);let i=t.slice(1);if(s.allErrors)o();else{let l=r.let("valid",!1);o(l),e.ok(l)}function o(l){if(s.schemaEnv.root.dynamicAnchors[i]){let c=r.let("_v",Y_._`${sW.default.dynamicAnchors}${Y_.getProperty(i)}`);r.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>r.block(()=>{K_.callRef(e,l),r.let(c,!0)}):()=>K_.callRef(e,l)}}Z_.dynamicRef=X_;Z_.default=iW});var tP=C(function(eP){Object.defineProperty(eP,"__esModule",{value:!0});var aW=bp(),lW=we(),cW={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)aW.dynamicAnchor(e,"");else lW.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};eP.default=cW});var nP=C(function(rP){Object.defineProperty(rP,"__esModule",{value:!0});var dW=xp(),fW={keyword:"$recursiveRef",schemaType:"string",code:(e)=>dW.dynamicRef(e,e.schema)};rP.default=fW});var iP=C(function(sP){Object.defineProperty(sP,"__esModule",{value:!0});var mW=bp(),hW=xp(),gW=tP(),yW=nP(),bW=[mW.default,hW.default,gW.default,yW.default];sP.default=bW});var lP=C(function(aP){Object.defineProperty(aP,"__esModule",{value:!0});var oP=fc(),$W={keyword:"dependentRequired",type:"object",schemaType:"object",error:oP.error,code:(e)=>oP.validatePropertyDeps(e)};aP.default=$W});var uP=C(function(cP){Object.defineProperty(cP,"__esModule",{value:!0});var wW=fc(),SW={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>wW.validateSchemaDeps(e)};cP.default=SW});var fP=C(function(dP){Object.defineProperty(dP,"__esModule",{value:!0});var _W=we(),PW={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)_W.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};dP.default=PW});var mP=C(function(pP){Object.defineProperty(pP,"__esModule",{value:!0});var kW=lP(),RW=uP(),AW=fP(),OW=[kW.default,RW.default,AW.default];pP.default=OW});var yP=C(function(gP){Object.defineProperty(gP,"__esModule",{value:!0});var Yn=ye(),hP=we(),TW=gr(),NW={message:"must NOT have unevaluated properties",params:({params:e})=>Yn._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},IW={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:NW,code(e){let{gen:t,schema:r,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:o,props:a}=i;if(a instanceof Yn.Name)t.if(Yn._`${a} !== true`,()=>t.forIn("key",n,(p)=>t.if(c(a,p),()=>l(p))));else if(a!==!0)t.forIn("key",n,(p)=>a===void 0?l(p):t.if(d(a,p),()=>l(p)));i.props=!0,e.ok(Yn._`${s} === ${TW.default.errors}`);function l(p){if(r===!1){if(e.setParams({unevaluatedProperty:p}),e.error(),!o)t.break();return}if(!hP.alwaysValidSchema(i,r)){let h=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:p,dataPropType:hP.Type.Str},h),!o)t.if(Yn.not(h),()=>t.break())}}function c(p,h){return Yn._`!${p} || !${p}[${h}]`}function d(p,h){let m=[];for(let b in p)if(p[b]===!0)m.push(Yn._`${h} !== ${b}`);return Yn.and(...m)}}};gP.default=IW});var $P=C(function(xP){Object.defineProperty(xP,"__esModule",{value:!0});var Ts=ye(),bP=we(),JW={message:({params:{len:e}})=>Ts.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ts._`{limit: ${e}}`},DW={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:JW,code(e){let{gen:t,schema:r,data:n,it:s}=e,i=s.items||0;if(i===!0)return;let o=t.const("len",Ts._`${n}.length`);if(r===!1)e.setParams({len:i}),e.fail(Ts._`${o} > ${i}`);else if(typeof r=="object"&&!bP.alwaysValidSchema(s,r)){let l=t.var("valid",Ts._`${o} <= ${i}`);t.if(Ts.not(l),()=>a(l,i)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,o,(d)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:d,dataPropType:bP.Type.Num},l),!s.allErrors)t.if(Ts.not(l),()=>t.break())})}}};xP.default=DW});var wP=C(function(vP){Object.defineProperty(vP,"__esModule",{value:!0});var FW=yP(),qW=$P(),HW=[FW.default,qW.default];vP.default=HW});var EP=C(function(SP){Object.defineProperty(SP,"__esModule",{value:!0});var rt=ye(),WW={message:({schemaCode:e})=>rt.str`must match format "${e}"`,params:({schemaCode:e})=>rt._`{format: ${e}}`},BW={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:WW,code(e,t){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:d,self:p}=a;if(!l.validateFormats)return;if(s)h();else m();function h(){let b=r.scopeValue("formats",{ref:p.formats,code:l.code.formats}),g=r.const("fDef",rt._`${b}[${o}]`),y=r.let("fType"),v=r.let("format");r.if(rt._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,rt._`${g}.type || "string"`).assign(v,rt._`${g}.validate`),()=>r.assign(y,rt._`"string"`).assign(v,g)),e.fail$data(rt.or(j(),S()));function j(){if(l.strictSchema===!1)return rt.nil;return rt._`${o} && !${v}`}function S(){let P=d.$async?rt._`(${g}.async ? await ${v}(${n}) : ${v}(${n}))`:rt._`${v}(${n})`,E=rt._`(typeof ${v} == "function" ? ${P} : ${v}.test(${n}))`;return rt._`${v} && ${v} !== true && ${y} === ${t} && !${E}`}}function m(){let b=p.formats[i];if(!b){j();return}if(b===!0)return;let[g,y,v]=S(b);if(g===t)e.pass(P());function j(){if(l.strictSchema===!1){p.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function S(E){let O=E instanceof RegExp?rt.regexpCode(E):l.code.formats?rt._`${l.code.formats}${rt.getProperty(i)}`:void 0,R=r.scopeValue("formats",{key:i,ref:E,code:O});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,rt._`${R}.validate`];return["string",E,R]}function P(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!d.$async)throw Error("async format in sync schema");return rt._`await ${v}(${n})`}return typeof y=="function"?rt._`${v}(${n})`:rt._`${v}.test(${n})`}}}};SP.default=BW});var $p=C(function(_P){Object.defineProperty(_P,"__esModule",{value:!0});var zW=EP(),GW=[zW.default];_P.default=GW});var vp=C(function(PP){Object.defineProperty(PP,"__esModule",{value:!0});PP.contentVocabulary=PP.metadataVocabulary=void 0;PP.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];PP.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var AP=C(function(RP){Object.defineProperty(RP,"__esModule",{value:!0});var XW=op(),ZW=cp(),QW=gp(),eB=iP(),tB=mP(),rB=wP(),nB=$p(),kP=vp(),sB=[eB.default,XW.default,ZW.default,(0,QW.default)(!0),nB.default,kP.metadataVocabulary,kP.contentVocabulary,tB.default,rB.default];RP.default=sB});var NP=C(function(CP){Object.defineProperty(CP,"__esModule",{value:!0});CP.DiscrError=void 0;var OP;(function(e){e.Tag="tag",e.Mapping="mapping"})(OP||(CP.DiscrError=OP={}))});var Sp=C(function(MP){Object.defineProperty(MP,"__esModule",{value:!0});var ji=ye(),wp=NP(),IP=Bo(),oB=Si(),aB=we(),lB={message:({params:{discrError:e,tagName:t}})=>e===wp.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>ji._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},cB={keyword:"discriminator",type:"object",schemaType:"object",error:lB,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!o)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",ji._`${r}${ji.getProperty(a)}`);t.if(ji._`typeof ${c} == "string"`,()=>d(),()=>e.error(!1,{discrError:wp.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function d(){let m=h();t.if(!1);for(let b in m)t.elseIf(ji._`${c} === ${b}`),t.assign(l,p(m[b]));t.else(),e.error(!1,{discrError:wp.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function p(m){let b=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},b);return e.mergeEvaluated(g,ji.Name),b}function h(){var m;let b={},g=v(s),y=!0;for(let P=0;P<o.length;P++){let E=o[P];if((E===null||E===void 0?void 0:E.$ref)&&!aB.schemaHasRulesButRef(E,i.self.RULES)){let R=E.$ref;if(E=IP.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,R),E instanceof IP.SchemaEnv)E=E.schema;if(E===void 0)throw new oB.default(i.opts.uriResolver,i.baseId,R)}let O=(m=E===null||E===void 0?void 0:E.properties)===null||m===void 0?void 0:m[a];if(typeof O!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||v(E)),j(O,P)}if(!y)throw Error(`discriminator: "${a}" must be required`);return b;function v({required:P}){return Array.isArray(P)&&P.includes(a)}function j(P,E){if(P.const)S(P.const,E);else if(P.enum)for(let O of P.enum)S(O,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(P,E){if(typeof P!="string"||P in b)throw Error(`discriminator: "${a}" values must be unique strings`);b[P]=E}}}};MP.default=cB});var JP=C(function(bQ,dB){dB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var DP=C(function(xQ,fB){fB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var LP=C(function($Q,pB){pB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var FP=C(function(vQ,mB){mB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var qP=C(function(wQ,hB){hB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var HP=C(function(SQ,gB){gB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var VP=C(function(EQ,yB){yB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var WP=C(function(_Q,bB){bB.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var UP=C(function(BP){Object.defineProperty(BP,"__esModule",{value:!0});var xB=JP(),$B=DP(),vB=LP(),wB=FP(),SB=qP(),EB=HP(),_B=VP(),PB=WP(),jB=["/properties"];function kB(e){return[xB,$B,vB,wB,SB,t(this,EB),_B,t(this,PB)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,jB):n}}BP.default=kB});var Pp=C(function(Yt,_p){Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MissingRefError=Yt.ValidationError=Yt.CodeGen=Yt.Name=Yt.nil=Yt.stringify=Yt.str=Yt._=Yt.KeywordCxt=Yt.Ajv2020=void 0;var AB=ip(),OB=AP(),CB=Sp(),TB=UP(),Ep="https://json-schema.org/draft/2020-12/schema";class na extends AB.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),OB.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(CB.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;TB.default.call(this,e),this.refs["http://json-schema.org/schema"]=Ep}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ep)?Ep:void 0)}}Yt.Ajv2020=na;_p.exports=Yt=na;_p.exports.Ajv2020=na;Object.defineProperty(Yt,"__esModule",{value:!0});Yt.default=na;var NB=wi();Object.defineProperty(Yt,"KeywordCxt",{enumerable:!0,get:function(){return NB.KeywordCxt}});var ki=ye();Object.defineProperty(Yt,"_",{enumerable:!0,get:function(){return ki._}});Object.defineProperty(Yt,"str",{enumerable:!0,get:function(){return ki.str}});Object.defineProperty(Yt,"stringify",{enumerable:!0,get:function(){return ki.stringify}});Object.defineProperty(Yt,"nil",{enumerable:!0,get:function(){return ki.nil}});Object.defineProperty(Yt,"Name",{enumerable:!0,get:function(){return ki.Name}});Object.defineProperty(Yt,"CodeGen",{enumerable:!0,get:function(){return ki.CodeGen}});var IB=Vo();Object.defineProperty(Yt,"ValidationError",{enumerable:!0,get:function(){return IB.default}});var MB=Si();Object.defineProperty(Yt,"MissingRefError",{enumerable:!0,get:function(){return MB.default}})});import{existsSync as xc,readFileSync as LB}from"node:fs";import{createRequire as zP}from"node:module";import{isAbsolute as FB,relative as qB,resolve as bc}from"node:path";import{fileURLToPath as GP,pathToFileURL as HB}from"node:url";function sa(e){return JSON.parse(LB(e,"utf8"))}async function KP(e){let t=bc(e),r=bc(t,"project.json"),n=bc(t,"project.schema.json");if(!xc(r))throw Error(`project.json not found in ${t}`);if(!xc(n))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"project.json#/extensions");let s=sa(r),i=sa(n);i.$id=HB(n).href;let o;try{({default:o}=await Promise.resolve().then(() => kt(Pp(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new o({allErrors:!0,loadSchema:(d)=>VB(d,t),strict:!1}).compileAsync(i),c=l(s);return{errors:l.errors??null,valid:c}}async function VB(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let r=GP(e),n=qB(t,r);if(n.startsWith("..")||FB(n))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(xc(r))return sa(r);let s=n.split("\\").join("/"),i="node_modules/",o=s.lastIndexOf(i);if(o===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(o+i.length),l;try{l=zP(bc(t,"package.json")).resolve(a)}catch{try{l=zP(import.meta.url).resolve(a)}catch(c){if(a.startsWith("@jxsuite/schema/")){let p=GP(new URL(`../${a.slice(16)}`,import.meta.url));if(xc(p))return sa(p)}throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or the host`,{cause:c})}}return sa(l)}var YP=()=>{};function Kr(e){return ee(e.attributes)?e.attributes:{}}function _t(e,t){let r=Kr(e)[t];return N(r)?r:null}function nt(e){return N(e.tagName)?e.tagName.toLowerCase():""}function Mt(e,t="the popover"){let r=N(e.id)?e.id:_t(e,"id");if(r)return`#${r}`;let n=nt(e);return n===""?t:`the <${n}>`}function UB(e){let t=Kr(e).popover;return N(t)?t:null}function ZP(e){let t=new Set,r=new Set;for(let n of e){let s=n!==null&&N(n.tagName)?n.tagName:"";if(n===null||!s.includes("-"))continue;if(jp(n))t.add(s);let i=n.observedAttributes;if(Array.isArray(i)&&zB.every((o)=>i.includes(o)))r.add(s)}return{invokerTags:r,popoverTags:t}}function jp(e){return"popover"in Kr(e)||"popover"in e}function ia(e,t){return jp(e)||(t?.popoverTags?.has(nt(e))??!1)}function Xn(e){if(N(e.id)&&e.id!=="")return e.id;let t=_t(e,"id");return t===""?null:t}function*Gr(e,t=[],r=null,n){yield{enclosing:r,node:e,path:t};let s=ia(e,n)?e:r,{children:i}=e;if(Array.isArray(i)){for(let[l,c]of i.entries())if(F(c))yield*Gr(c,[...t,"children",l],s,n)}else if(ee(i)&&Ft(i.map))yield*Gr(i.map,[...t,"children","map"],s,n);let o=Ft(e.map)?e.map:null;if(o)yield*Gr(o,[...t,"map"],s,n);let a=ee(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(F(c))yield*Gr(c,[...t,"cases",l],s,n)}function kp(e,t){let r=[];for(let{node:n}of Gr(e,[],null,t)){if(!ia(n,t))continue;let s=Xn(n);if(s!==null&&!r.includes(s))r.push(s)}return r}function $c(e){return e.startsWith("@")}function QP(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function It(e,t){let r=e?.[t];if(r===void 0||ss(r)||Array.isArray(r))return null;return String(r)}function ej(e){for(let[t,r]of Object.entries(e??{})){if(!ss(r))continue;if(QP(t)&&t.includes(":popover-open")&&It(r,"display")!==null)return!0;if($c(t)&&ej(r))return!0}return!1}function tj(e){for(let[t,r]of Object.entries(e??{})){if(!ss(r))continue;if(QP(t)&&t.includes(":popover-open"))return!0;if($c(t)&&tj(r))return!0}return!1}function KB(e){return GB.some((t)=>It(e,t)!==null)}function YB(e){if(!e)return[];let t=[];for(let[r,n]of Object.entries(e))if($c(r)&&ss(n)&&It(n,"display")!==null)t.push(r);return t}function rj(e){if(!e)return[];let t=[],r=It(e,"transition");if(r!==null)t.push(r);for(let[n,s]of Object.entries(e))if($c(n)&&ss(s))t.push(...rj(s));return t}function XB(e){if(!e)return!1;if(It(e,"positionAnchor")!==null||It(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(It(e,t)??"").includes("anchor("))}function ZB(e){if(!e)return!1;if(It(e,"positionArea")!==null||It(e,"position-area")!==null||It(e,"positionTryFallbacks")!==null||It(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function nj(e,t){let r=[...Gr(e,[],null,t)],n=kp(e,t),s=r.some(({node:a})=>ia(a,t)),i=new Set;for(let{node:a}of r)if(XP.has(nt(a))){let l=_t(a,"popovertarget");if(l!==null)i.add(l)}let o=[];for(let{enclosing:a,node:l,path:c}of r)if(o.push(...QB(l,c,a,n,s,t)),jp(l))o.push(...eU(l,c,i));return o}function QB(e,t,r,n,s,i){let o=[],a=nt(e),l=_t(e,"popovertarget"),c=XP.has(a)||(i?.invokerTags?.has(a)??!1);if(l!==null&&!c)return o.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${Ve}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),o;if(l!==null){if(s&&!n.includes(l)){let d=n.length>0?`The popovers here are: ${n.map((p)=>`"${p}"`).join(", ")}. `:"";o.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${d}A target that names nothing does nothing, silently. ${Ve}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(r!==null&&Xn(r)!==null&&Xn(r)!==l)o.push({detail:`This control is inside ${Mt(r)} but targets "${l}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${Ve}`,message:`A control inside ${Mt(r)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&r!==null&&l===null){let d=_t(e,"href")??(N(e.href)?e.href:null),p=_t(e,"target")==="_blank",h=d!==null&&d.includes("#");if(p||h){let m=p?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";o.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${Ve}`,message:`A link inside ${Mt(r)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return o}function eU(e,t,r){let n=[],{style:s}=e,i=Mt(e),o=UB(e);if(o!==null&&o!==""&&!BB.some((c)=>c===o))n.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${Ve}`,fix:"mode",message:`${i} declares popover="${o}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if($t(Kr(e).popover))n.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${Ve}`,fix:"mode",message:`${i} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=It(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")n.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${Ve}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of YB(s))n.push({detail:`The same defect as a base \`display\`, arriving through \`${c}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${Ve}`,fix:"display",message:`${i} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(It(s,"visibility")!==null)n.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${Ve}`,fix:"display",message:`${i} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!tj(s))n.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${Ve}`,message:`${i} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!ej(s)&&a===null&&KB(s))n.push({detail:`${i} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${Ve}`,fix:"open-display",message:`${i} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of rj(s))if(c.includes("display")&&!c.includes("overlay")){n.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${Ve}`,message:`${i} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(XB(s)&&!ZB(s))n.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${Ve}`,message:`${i} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=Xn(e);if(l!==null&&!r.has(l))n.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${Ve}`,message:`${i} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return n}var BB,XP,zB,GB,Ve="See docs/framework/concepts/overlays.";var vc=q(()=>{ve();BB=["auto","manual","hint"],XP=new Set(["button","input"]);zB=["popovertarget","popovertargetaction","command","commandfor"];GB=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function Ci(e,t){let r=Kr(e),n=t in r?r[t]:e[t];if(n===void 0||n===null)return{kind:"absent"};if(Ce(n)||ee(n))return{kind:"bound"};if(N(n))return n.includes("${")?{kind:"bound"}:{kind:"text",text:n};return{isTrue:n===!0,kind:"other"}}function Ai(e,t){let r=Ci(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Pt(e,t){return Ci(e,t).kind!=="absent"}function Zn(e){let t=Ci(e,"role");if(t.kind==="bound")return Oi;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function wc(e){let t=Ci(e,"id");if(t.kind==="bound")return Oi;return t.kind==="text"&&t.text!==""?t.text:null}function xr(e,t){let r=Ci(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function Sc(e){let t=e.textContent;if(N(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(xr(e,"aria-label")||Pt(e,"aria-labelledby"))return!0;if(nt(e)==="img"&&(xr(e,"alt")||xr(e,"title")))return!0;if(nt(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let s of r)if(N(s)){if(s.trim()!=="")return!0}else if(F(s)&&Sc(s))return!0}else if(r!=null)return!0;if(ee(e.map))return!0;return(ee(e.cases)?Object.values(e.cases):[]).some((s)=>Ft(s)&&Sc(s))}function*Ri(e,t=[],r=[],n=[]){yield{node:e,path:t,roles:r,tags:n};let s=[...r,Zn(e)],i=[...n,nt(e)],{children:o}=e;if(Array.isArray(o)){for(let[a,l]of o.entries())if(F(l))yield*Ri(l,[...t,"children",a],s,i)}else if(ee(o)&&Ft(o.map))yield*Ri(o.map,[...t,"children","map"],s,i);if(Ft(e.map))yield*Ri(e.map,[...t,"map"],s,i);if(ee(e.cases)){for(let[a,l]of Object.entries(e.cases))if(F(l))yield*Ri(l,[...t,"cases",a],s,i)}}function oU(e){return e.some((t)=>t.includes("-"))}function Yr(e,t,r,n,s,i="error"){return{criterion:s,detail:`${n} ${tU}`,message:r,path:t,rule:e,severity:i}}function sj(e,t,r){if(r.includes("label"))return!0;if(e===Oi||t.bound)return!0;return e!==null&&t.ids.has(e)}function aU(e,t){let{node:r,path:n,tags:s}=e,i=nt(r),o=Zn(r);if(o==="bound")return null;if(xr(r,"aria-label")||Pt(r,"aria-labelledby")||xr(r,"title"))return null;let l=Mt(r,"the control"),c=(p)=>Yr("interactive-unnamed",n,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${p}`,"4.1.2"),d=lU(r,i,t,s);if(d==="named"||d==="exempt")return null;if(o!==null&&rU.has(o))return Sc(r)?null:c("Give it text content, or an aria-label.");if(o!==null&&nU.has(o))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(o!==null)return null;if(i==="button"||i==="summary"||i==="a"&&Pt(r,"href"))return Sc(r)?null:c("Give it text content, or an aria-label.");if(d==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(d==="unnamed-value")return c("Give it a value, or an aria-label.");if(d==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function lU(e,t,r,n){if(t==="area"){if(!Pt(e,"href"))return"none";return xr(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return sj(wc(e),r,n)||xr(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(Ai(e,"type")??"text").toLowerCase();if(s==="hidden"||Pt(e,"type")&&Ai(e,"type")===null)return"exempt";if(sU.has(s))return xr(e,"value")?"named":"unnamed-value";if(s==="image")return xr(e,"alt")?"named":"unnamed-alt";return sj(wc(e),r,n)||xr(e,"placeholder")?"named":"unnamed"}function uU(e){let{node:t,path:r,tags:n}=e,s=nt(t);if(!s.includes("-")||!n.some((i)=>cU.has(i)))return null;return Yr("custom-element-in-select",r,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function dU(e){let{node:t,path:r}=e;if(nt(t)!=="img")return null;let n=Zn(t);if(n==="bound"||n==="presentation"||n==="none")return null;if(Pt(t,"alt")||xr(t,"aria-label")||Pt(t,"aria-labelledby"))return null;return Yr("img-alt-missing",r,`${Mt(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}function pU(e,t){let{node:r,path:n}=e,s=[];for(let i of fU){let o=Ai(r,i);if(o===null)continue;for(let a of o.split(/\s+/))if(a!==""&&!t.has(a))s.push(Yr("aria-target-missing",n,`${Mt(r,"the element")} points ${i} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function mU(e,t,r){for(let n of ij.get(t)??[]){let s=r.get(n);if(s===void 0)continue;if(s.bound)return!0;if(e===Oi&&s.ids.size>0)return!0;if(e!==null&&e!==Oi&&s.ids.has(e))return!0}return!1}function hU(e,t){let{node:r,path:n,roles:s,tags:i}=e,o=Zn(r);if(o===null||o==="bound"||n.length===0||oU(i))return null;if(s.includes("bound")||mU(wc(r),o,t))return null;let a=Mt(r,"the element");if(o==="tab"&&!s.includes("tablist"))return Yr("tab-outside-tablist",n,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((o==="menuitem"||o==="menuitemcheckbox"||o==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Yr("menuitem-outside-menu",n,`${a} is a ${o} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(o==="option"&&!s.includes("listbox")&&!i.includes("select")&&!i.includes("datalist"))return Yr("option-outside-listbox",n,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function gU(e){let t=[];for(let{node:r}of Ri(e)){if(Zn(r)!=="tab")continue;let n=Ci(r,"aria-selected");if(n.kind==="bound")return null;t.push(n.kind==="other"&&n.isTrue||n.kind==="text"&&n.text==="true")}return t}function yU(e){let{node:t,path:r}=e;if(Zn(t)!=="tablist")return null;let n=gU(t);if(n===null||n.length===0||n.includes(!0))return null;return Yr("tablist-none-selected",r,`${Mt(t,"the tablist")} has ${n.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function bU(e){let{node:t,path:r}=e,n=Zn(t);if(!(nt(t)==="dialog"||n==="dialog"||n==="alertdialog")||n==="bound")return null;if(xr(t,"aria-label")||Pt(t,"aria-labelledby"))return null;return Yr("dialog-unnamed",r,`${Mt(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}function $U(e){let{node:t,path:r}=e;if(!Pt(t,"aria-activedescendant"))return null;let n=nt(t);if(xU.has(n)||n==="a"&&Pt(t,"href")||Pt(t,"tabIndex")||Pt(t,"tabindex")||Pt(t,"contenteditable"))return null;return Yr("activedescendant-not-focusable",r,`${Mt(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function oj(e){let t=[...Ri(e)],r=new Set,n={bound:!1,ids:new Set},s=new Map,i=!1;for(let{node:a}of t){let l=Zn(a);if(l!==null&&iU.has(l)){let d=s.get(l)??{bound:!1,ids:new Set},p=Ai(a,"aria-owns");if(p===null)d.bound||=Pt(a,"aria-owns");else for(let h of p.split(/\s+/))if(h!=="")d.ids.add(h);s.set(l,d)}let c=wc(a);if(c===Oi)i=!0;else if(c!==null)r.add(c);if(nt(a)==="label"){let d=Ai(a,"for")??Ai(a,"htmlFor");if(d===null)n.bound||=Pt(a,"for")||Pt(a,"htmlFor");else n.ids.add(d)}}let o=[];for(let a of t){let l=[aU(a,n),dU(a),hU(a,s),uU(a),yU(a),bU(a),$U(a)];for(let c of l)if(c)o.push(c);if(!i)o.push(...pU(a,r))}return o}var tU="See docs/framework/concepts/accessibility.",Oi="bound",rU,nU,sU,ij,iU,cU,fU,xU;var aj=q(()=>{ve();vc();rU=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),nU=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),sU=new Set(["button","reset","submit"]),ij=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),iU=new Set([...ij.values()].flat());cU=new Set(["select","jx-select"]);fU=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];xU=new Set(["button","input","select","textarea"])});function Rp(e){return nt(e)==="dialog"}function lj(e){return e.startsWith("--")}function jU(e){let t=[];for(let{node:r}of Gr(e)){let n=Xn(r);if(Rp(r)&&n!==null&&!t.includes(n))t.push(n)}return t}function kU(e){let t=e.oncommand;return t!==void 0&&t!==null}function RU(e,t){for(let{node:r}of Gr(e)){if(r===e)continue;let n=nt(r);if(n==="button"){let s=_t(r,"command"),i=_t(r,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(i===null||i===t))return!0}if(n==="form"&&_t(r,"method")?.toLowerCase()==="dialog")return!0}return!1}function uj(e,t){let r=[...Gr(e,[],null,t)],n=jU(e),s=kp(e,t),i=n.length>0||s.length>0,o=new Map,a=new Map;for(let{node:c}of r){let d=Xn(c);if(d!==null&&!o.has(d))o.set(d,c);if(nt(c)==="button"){let p=_t(c,"commandfor"),h=_t(c,"command");if(p!==null){let m=a.get(p)??new Set;m.add(h??""),a.set(p,m)}}}let l=[];for(let{node:c,path:d}of r)if(l.push(...AU(c,d,o,n,s,i,t)),Rp(c))l.push(...OU(c,d,a));return l}function AU(e,t,r,n,s,i,o){let a=[],l=nt(e),c=o?.invokerTags?.has(l)??!1,d=_t(e,"command"),p=_t(e,"commandfor");if(!(d!==null||p!==null||("command"in Kr(e))||("commandfor"in Kr(e))))return a;let m=Mt(e,"the element");if(!PU.has(l)&&!c)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${Ve}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(d!==null&&!EU.has(d)&&!lj(d))return a.push({detail:`\`command\` is an enumerated attribute taking ${cj.map((b)=>`\`${b}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${Ve}`,message:`${m} declares command="${d}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(p!==null){let b=r.get(p),g=n.includes(p),y=s.includes(p);if(!b&&i){let v=[...n,...s].map((j)=>`"${j}"`).join(", ");return a.push({detail:`No element in this document has the id "${p}". The dialogs and popovers here are: ${v}. A commandfor that names nothing does nothing, silently. ${Ve}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(d!==null&&b){if(vU.has(d)&&!Rp(b))a.push({detail:`\`${d}\` acts on a <dialog>, and "${p}" is ${y?"a popover":`a <${nt(b)||"element"}>`}. The click is ignored. ${y?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${Ve}`,message:`${m} sends ${d} to "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(wU.has(d)&&!ia(b,o))a.push({detail:`\`${d}\` acts on a popover, and "${p}" is ${g?"a dialog":`a <${nt(b)||"element"}>`} that declares no \`popover\`. The click is ignored. ${g?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${Ve}`,message:`${m} sends ${d} to "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(lj(d)&&!kU(b))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${p}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${Ve}`,message:`${m} sends ${d} to "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function OU(e,t,r){let n=[],s=Mt(e,"the dialog"),i=Xn(e),{style:o}=e,a=_t(e,"closedby");if(a!==null&&!_U.has(a))n.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${Ve}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(It(o,"display")!==null)n.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${Ve}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=i===null?void 0:r.get(i),c=_t(e,"open")!==null||Kr(e).open===!0||e.open===!0;if(i!==null&&!l?.has("show-modal")&&!c)n.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${Ve}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!RU(e,i))n.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${Ve}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return n}var cj,vU,wU,SU,EU,_U,PU;var dj=q(()=>{ve();vc();cj=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],vU=new Set(["show-modal","close","request-close"]),wU=new Set(["toggle-popover","show-popover","hide-popover"]),SU=["any","closerequest","none"],EU=new Set(cj),_U=new Set(SU),PU=new Set(["button"])});var vj=C(function(xj){Object.defineProperty(xj,"__esModule",{value:!0});xj.formatNames=xj.fastFormats=xj.fullFormats=void 0;function Xr(e,t){return{validate:e,compare:t}}xj.fullFormats={date:Xr(hj,Tp),time:Xr(Op(!0),Np),"date-time":Xr(fj(!0),yj),"iso-time":Xr(Op(),gj),"iso-date-time":Xr(fj(),bj),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:JU,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:WU,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:DU,int32:{type:"number",validate:qU},int64:{type:"number",validate:HU},float:{type:"number",validate:mj},double:{type:"number",validate:mj},password:!0,binary:!0};xj.fastFormats={...xj.fullFormats,date:Xr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Tp),time:Xr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Np),"date-time":Xr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,yj),"iso-time":Xr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,gj),"iso-date-time":Xr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,bj),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};xj.formatNames=Object.keys(xj.fullFormats);function CU(e){return e%4===0&&(e%100!==0||e%400===0)}var TU=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,NU=[0,31,28,31,30,31,30,31,31,30,31,30,31];function hj(e){let t=TU.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],s=+t[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&CU(r)?29:NU[n])}function Tp(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Ap=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Op(e){return function(r){let n=Ap.exec(r);if(!n)return!1;let s=+n[1],i=+n[2],o=+n[3],a=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),d=+(n[7]||0);if(c>23||d>59||e&&!a)return!1;if(s<=23&&i<=59&&o<60)return!0;let p=i-d*l,h=s-c*l-(p<0?1:0);return(h===23||h===-1)&&(p===59||p===-1)&&o<61}}function Np(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function gj(e,t){if(!(e&&t))return;let r=Ap.exec(e),n=Ap.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var Cp=/t|\s/i;function fj(e){let t=Op(e);return function(n){let s=n.split(Cp);return s.length===2&&hj(s[0])&&t(s[1])}}function yj(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function bj(e,t){if(!(e&&t))return;let[r,n]=e.split(Cp),[s,i]=t.split(Cp),o=Tp(r,s);if(o===void 0)return;return o||Np(n,i)}var IU=/\/|:/,MU=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function JU(e){return IU.test(e)&&MU.test(e)}var pj=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function DU(e){return pj.lastIndex=0,pj.test(e)}var LU=-2147483648,FU=2147483647;function qU(e){return Number.isInteger(e)&&e<=FU&&e>=LU}function HU(e){return Number.isInteger(e)}function mj(){return!0}var VU=/[^\\]\\Z/;function WU(e){if(VU.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Ej=C(function(Sj){Object.defineProperty(Sj,"__esModule",{value:!0});var UU=op(),zU=cp(),GU=gp(),KU=$p(),wj=vp(),YU=[UU.default,zU.default,(0,GU.default)(),KU.default,wj.metadataVocabulary,wj.contentVocabulary];Sj.default=YU});var _j=C(function(YQ,ZU){ZU.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{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:"#"}},default:!0}});var jj=C(function(Xt,Mp){Object.defineProperty(Xt,"__esModule",{value:!0});Xt.MissingRefError=Xt.ValidationError=Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=Xt.Ajv=void 0;var QU=ip(),e6=Ej(),t6=Sp(),Pj=_j(),r6=["/properties"],Ec="http://json-schema.org/draft-07/schema";class oa extends QU.default{_addVocabularies(){if(super._addVocabularies(),e6.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(t6.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Pj,r6):Pj;this.addMetaSchema(e,Ec,!1),this.refs["http://json-schema.org/schema"]=Ec}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ec)?Ec:void 0)}}Xt.Ajv=oa;Mp.exports=Xt=oa;Mp.exports.Ajv=oa;Object.defineProperty(Xt,"__esModule",{value:!0});Xt.default=oa;var n6=wi();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return n6.KeywordCxt}});var Ti=ye();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Ti._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Ti.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Ti.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Ti.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Ti.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Ti.CodeGen}});var s6=Vo();Object.defineProperty(Xt,"ValidationError",{enumerable:!0,get:function(){return s6.default}});var i6=Si();Object.defineProperty(Xt,"MissingRefError",{enumerable:!0,get:function(){return i6.default}})});var Rj=C(function(kj){Object.defineProperty(kj,"__esModule",{value:!0});kj.formatLimitDefinition=void 0;var l6=jj(),Ar=ye(),Qn=Ar.operators,_c={formatMaximum:{okStr:"<=",ok:Qn.LTE,fail:Qn.GT},formatMinimum:{okStr:">=",ok:Qn.GTE,fail:Qn.LT},formatExclusiveMaximum:{okStr:"<",ok:Qn.LT,fail:Qn.GTE},formatExclusiveMinimum:{okStr:">",ok:Qn.GT,fail:Qn.LTE}},c6={message:({keyword:e,schemaCode:t})=>Ar.str`should be ${_c[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ar._`{comparison: ${_c[e].okStr}, limit: ${t}}`};kj.formatLimitDefinition={keyword:Object.keys(_c),type:"string",schemaType:"string",$data:!0,error:c6,code(e){let{gen:t,data:r,schemaCode:n,keyword:s,it:i}=e,{opts:o,self:a}=i;if(!o.validateFormats)return;let l=new l6.KeywordCxt(i,a.RULES.all.format.definition,"format");if(l.$data)c();else d();function c(){let h=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),m=t.const("fmt",Ar._`${h}[${l.schemaCode}]`);e.fail$data(Ar.or(Ar._`typeof ${m} != "object"`,Ar._`${m} instanceof RegExp`,Ar._`typeof ${m}.compare != "function"`,p(m)))}function d(){let h=l.schema,m=a.formats[h];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${h}" does not define "compare" function`);let b=t.scopeValue("formats",{key:h,ref:m,code:o.code.formats?Ar._`${o.code.formats}${Ar.getProperty(h)}`:void 0});e.fail$data(p(b))}function p(h){return Ar._`${h}.compare(${r}, ${n}) ${_c[s].fail} 0`}},dependencies:["format"]};var u6=(e)=>(e.addKeyword(kj.formatLimitDefinition),e);kj.default=u6});var Tj=C(function(aa,Cj){Object.defineProperty(aa,"__esModule",{value:!0});var Ni=vj(),f6=Rj(),Dp=ye(),Aj=new Dp.Name("fullFormats"),p6=new Dp.Name("fastFormats"),Lp=(e,t={keywords:!0})=>{if(Array.isArray(t))return Oj(e,t,Ni.fullFormats,Aj),e;let[r,n]=t.mode==="fast"?[Ni.fastFormats,p6]:[Ni.fullFormats,Aj],s=t.formats||Ni.formatNames;if(Oj(e,s,r,n),t.keywords)(0,f6.default)(e);return e};Lp.get=(e,t="full")=>{let n=(t==="fast"?Ni.fastFormats:Ni.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function Oj(e,t,r,n){var s,i;(s=(i=e.opts.code).formats)!==null&&s!==void 0||(i.formats=Dp._`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}Cj.exports=aa=Lp;Object.defineProperty(aa,"__esModule",{value:!0});aa.default=Lp});import{existsSync as Ij,readFileSync as Mj,readdirSync as Jj,statSync as Dj}from"node:fs";import{createRequire as m6}from"node:module";import{join as Lj,relative as Fp,resolve as qp}from"node:path";async function b6(){try{let{default:e}=await Promise.resolve().then(() => kt(Pp(),1)),{default:t}=await Promise.resolve().then(() => kt(Tj(),1));return{addFormats:t,Ajv:e}}catch(e){throw Error("Project validation requires ajv and ajv-formats: bun add ajv ajv-formats",{cause:e})}}async function Fj(e,t={}){let r=qp(e),n=[],s=[],i=0;for(let S of["project.schema.json","document.schema.json"]){let P=qp(r,S);if(!Ij(P))continue;i+=1;let E=la(P),O=$6(E);if(O.length>0)n.push({errors:O.map(({reason:R,ref:k})=>({message:`$ref "${k}" ${R} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:S})}if(n.length>0)return{checked:i,issues:n,lint:s,valid:!1};let o=await KP(r);if(i+=1,!o.valid)n.push({errors:o.errors??[],file:"project.json"});let{addFormats:a,Ajv:l}=await b6(),{document:c}=await Kv(r,{write:!1}),d=new l({allErrors:!0,ownProperties:!0,strict:!1});a(d);let p=d.compile(c),h=ZP(Nj(r).flatMap((S)=>{try{return[JSON.parse(Mj(S,"utf8"))]}catch{return[]}}));for(let S of h6)for(let P of Vj(qp(r,S))){if(P.endsWith(".class.json"))continue;i+=1;let E=la(P);if(p(E))s.push(...x6(E,Fp(r,P),h));else n.push({errors:p.errors??[],file:Fp(r,P)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let b=m.compile(hf());for(let S of Nj(r)){i+=1;let P=la(S);if(!b(P))n.push({errors:b.errors??[],file:Fp(r,S)})}let{config:g}=kn(r),y=await jn(r,g),v=m6(import.meta.url);for(let S of y.extensions)for(let P of["project","document","fields"]){let E=S.schemas[P];if(!E)continue;i+=1;let O=new l({allErrors:!0,ownProperties:!0,strict:!1});a(O);for(let R of y6){let k=v.resolve(R);O.addSchema(la(k))}try{O.compile(la(E))}catch(R){n.push({errors:[{message:R instanceof Error?R.message:String(R)}],file:`${S.specifier} (${P} fragment)`})}}let j=t.strict===!0&&s.some((S)=>S.severity==="error");return{checked:i,issues:n,lint:s,valid:n.length===0&&!j}}function la(e){return JSON.parse(Mj(e,"utf8"))}function x6(e,t,r){let n=[];for(let s of nj(e,r))n.push({...Hp(s),file:t,source:"popover"});for(let s of uj(e,r))n.push({...Hp(s),file:t,source:"dialog"});for(let s of oj(e))n.push({...Hp(s),criterion:s.criterion,file:t,source:"accessibility"});return n}function Hp(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function qj(e){return e.lint.map((t)=>{let r=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${r}]`})}function $6(e){let t=[],r=new Set,n=(i)=>{let o=e;for(let a of i.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!F(o))return!1;if(o=o[l],o===void 0)return!1}return!0},s=(i)=>{if(!ee(i)||r.has(i))return;r.add(i);let o=i.$ref;if(N(o)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(o))t.push({reason:"is an absolute URI editors resolve over the network",ref:o});else if(!o.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:o});else if(o.length>1&&!o.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:o});else if(o.length>1&&!n(o.slice(1)))t.push({reason:"points at no node in this document",ref:o})}for(let[a,l]of Object.entries(i)){if(!v6.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(ee(l)){if(s(l),Hj.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function Vj(e){if(!Ij(e))return[];let t=[];for(let r of Jj(e)){let n=Lj(e,r);if(Dj(n).isDirectory())t.push(...Vj(n));else if(r.endsWith(".json"))t.push(n)}return t.toSorted()}function Nj(e){let t=[],r=(n)=>{for(let s of Jj(n)){if(g6.has(s))continue;let i=Lj(n,s);if(Dj(i).isDirectory())r(i);else if(s.endsWith(".class.json"))t.push(i)}};return r(e),t.toSorted()}function Wj(e){let t=[];for(let r of e.issues){t.push(`${r.file}:`);for(let n of r.errors){let s=ee(n)?n:{},{instancePath:i,message:o}=s;t.push(` - ${i||"/"}: ${o??JSON.stringify(n)}`)}}return t}var h6,g6,y6,Hj,v6;var Bj=q(()=>{F0();YP();aj();dj();vc();ve();sn();Hi();tf();h6=["components","pages","layouts"],g6=new Set(["node_modules","dist",".git"]),y6=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];Hj=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),v6=new Set([...Hj,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});rr();import{relative as Vp,resolve as Uj}from"node:path";async function w6(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
|
|
569
|
+
deps: ${r}}`};var o4={keyword:"dependencies",type:"object",schemaType:"object",error:f_.error,code(e){let[t,r]=a4(e);u_(e,t),d_(e,r)}};function a4({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n]}return[t,r]}function u_(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let a=t[o];if(a.length===0)continue;let l=Zo.propertyInData(r,n,o,s.opts.ownProperties);if(e.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),s.allErrors)r.if(l,()=>{for(let c of a)Zo.checkReportMissingProp(e,c)});else r.if(dp._`${l} && (${Zo.checkMissingProp(e,a,i)})`),Zo.reportMissingProp(e,i),r.else()}}f_.validatePropertyDeps=u_;function d_(e,t=e.schema){let{gen:r,data:n,keyword:s,it:i}=e,o=r.name("valid");for(let a in t){if(i4.alwaysValidSchema(i,t[a]))continue;r.if(Zo.propertyInData(r,n,a,i.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},o);e.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),e.ok(o)}}f_.validateSchemaDeps=d_;f_.default=o4});var y_=C(function(g_){Object.defineProperty(g_,"__esModule",{value:!0});var h_=ye(),u4=we(),d4={message:"property name must be valid",params:({params:e})=>h_._`{propertyName: ${e.propertyName}}`},f4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:d4,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(u4.alwaysValidSchema(s,r))return;let 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(h_.not(i),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(i)}};g_.default=f4});var fp=C(function(b_){Object.defineProperty(b_,"__esModule",{value:!0});var dc=yr(),Rr=ye(),m4=gr(),fc=we(),h4={message:"must NOT have additional properties",params:({params:e})=>Rr._`{additionalProperty: ${e.additionalProperty}}`},g4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:h4,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&fc.alwaysValidSchema(o,r))return;let c=dc.allSchemaProperties(n.properties),d=dc.allSchemaProperties(n.patternProperties);p(),e.ok(Rr._`${i} === ${m4.default.errors}`);function p(){t.forIn("key",s,(y)=>{if(!c.length&&!d.length)b(y);else t.if(h(y),()=>b(y))})}function h(y){let v;if(c.length>8){let j=fc.schemaRefOrVal(o,n.properties,"properties");v=dc.isOwnProperty(t,j,y)}else if(c.length)v=Rr.or(...c.map((j)=>Rr._`${y} === ${j}`));else v=Rr.nil;if(d.length)v=Rr.or(v,...d.map((j)=>Rr._`${dc.usePattern(e,j)}.test(${y})`));return Rr.not(v)}function m(y){t.code(Rr._`delete ${s}[${y}]`)}function b(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){m(y);return}if(r===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof r=="object"&&!fc.alwaysValidSchema(o,r)){let v=t.name("valid");if(l.removeAdditional==="failing")g(y,v,!1),t.if(Rr.not(v),()=>{e.reset(),m(y)});else if(g(y,v),!a)t.if(Rr.not(v),()=>t.break())}}function g(y,v,j){let S={keyword:"additionalProperties",dataProp:y,dataPropType:fc.Type.Str};if(j===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,v)}}};b_.default=g4});var w_=C(function(v_){Object.defineProperty(v_,"__esModule",{value:!0});var b4=wi(),$_=yr(),pp=we(),x_=fp(),x4={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;if(i.opts.removeAdditional==="all"&&n.additionalProperties===void 0)x_.default.code(new b4.KeywordCxt(i,x_.default,"additionalProperties"));let o=$_.allSchemaProperties(r);for(let p of o)i.definedProperties.add(p);if(i.opts.unevaluated&&o.length&&i.props!==!0)i.props=pp.mergeEvaluated.props(t,pp.toHash(o),i.props);let a=o.filter((p)=>!pp.alwaysValidSchema(i,r[p]));if(a.length===0)return;let l=t.name("valid");for(let p of a){if(c(p))d(p);else{if(t.if($_.propertyInData(t,s,p,i.opts.ownProperties)),d(p),!i.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(l)}function c(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function d(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};v_.default=x4});var j_=C(function(P_){Object.defineProperty(P_,"__esModule",{value:!0});var S_=yr(),pc=ye(),E_=we(),__=we(),v4={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,a=S_.allSchemaProperties(r),l=a.filter((g)=>E_.alwaysValidSchema(i,r[g]));if(a.length===0||l.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&s.properties,d=t.name("valid");if(i.props!==!0&&!(i.props instanceof pc.Name))i.props=__.evaluatedPropsToName(t,i.props);let{props:p}=i;h();function h(){for(let g of a){if(c)m(g);if(i.allErrors)b(g);else t.var(d,!0),b(g),t.if(d)}}function m(g){for(let y in c)if(new RegExp(g).test(y))E_.checkStrictMode(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function b(g){t.forIn("key",n,(y)=>{t.if(pc._`${S_.usePattern(e,g)}.test(${y})`,()=>{let v=l.includes(g);if(!v)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:__.Type.Str},d);if(i.opts.unevaluated&&p!==!0)t.assign(pc._`${p}[${y}]`,!0);else if(!v&&!i.allErrors)t.if(pc.not(d),()=>t.break())})})}}};P_.default=v4});var R_=C(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});var S4=we(),E4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(S4.alwaysValidSchema(n,r)){e.fail();return}let 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"}};k_.default=E4});var O_=C(function(A_){Object.defineProperty(A_,"__esModule",{value:!0});var P4=yr(),j4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:P4.validateUnion,error:{message:"must match a schema in anyOf"}};A_.default=j4});var N_=C(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});var mc=ye(),R4=we(),A4={message:"must match exactly one schema in oneOf",params:({params:e})=>mc._`{passingSchemas: ${e.passing}}`},O4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:A4,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let i=r,o=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((d,p)=>{let h;if(R4.alwaysValidSchema(s,d))t.var(l,!0);else h=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l);if(p>0)t.if(mc._`${l} && ${o}`).assign(o,!1).assign(a,mc._`[${a}, ${p}]`).else();t.if(l,()=>{if(t.assign(o,!0),t.assign(a,p),h)e.mergeEvaluated(h,mc.Name)})})}}};C_.default=O4});var I_=C(function(T_){Object.defineProperty(T_,"__esModule",{value:!0});var N4=we(),T4={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let s=t.name("valid");r.forEach((i,o)=>{if(N4.alwaysValidSchema(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(a)})}};T_.default=T4});var L_=C(function(D_){Object.defineProperty(D_,"__esModule",{value:!0});var hc=ye(),J_=we(),M4={message:({params:e})=>hc.str`must match "${e.ifClause}" schema`,params:({params:e})=>hc._`{failingKeyword: ${e.ifClause}}`},J4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:M4,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)J_.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=M_(n,"then"),i=M_(n,"else");if(!s&&!i)return;let o=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&i){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,c("then",d),c("else",d))}else if(s)t.if(a,c("then"));else t.if(hc.not(a),c("else"));e.pass(o,()=>e.error(!0));function l(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function c(d,p){return()=>{let h=e.subschema({keyword:d},a);if(t.assign(o,a),e.mergeValidEvaluated(h,o),p)t.assign(p,hc._`${d}`);else e.setParams({ifClause:d})}}}};function M_(e,t){let r=e.schema[t];return r!==void 0&&!J_.alwaysValidSchema(e,r)}D_.default=J4});var q_=C(function(F_){Object.defineProperty(F_,"__esModule",{value:!0});var L4=we(),F4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)L4.checkStrictMode(r,`"${e}" without "if" is ignored`)}};F_.default=F4});var mp=C(function(H_){Object.defineProperty(H_,"__esModule",{value:!0});var H4=cp(),V4=s_(),B4=up(),W4=a_(),U4=c_(),z4=uc(),G4=y_(),K4=fp(),Y4=w_(),X4=j_(),Z4=R_(),Q4=O_(),eB=N_(),tB=I_(),rB=L_(),nB=q_();function sB(e=!1){let t=[Z4.default,Q4.default,eB.default,tB.default,rB.default,nB.default,G4.default,K4.default,z4.default,Y4.default,X4.default];if(e)t.push(V4.default,W4.default);else t.push(H4.default,B4.default);return t.push(U4.default),t}H_.default=sB});var gp=C(function(W_){Object.defineProperty(W_,"__esModule",{value:!0});W_.dynamicAnchor=void 0;var hp=ye(),oB=gr(),V_=qo(),aB=sc(),lB={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>B_(e,e.schema)};function B_(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let s=hp._`${oB.default.dynamicAnchors}${hp.getProperty(t)}`,i=n.errSchemaPath==="#"?n.validateName:cB(e);r.if(hp._`!${s}`,()=>r.assign(s,i))}W_.dynamicAnchor=B_;function cB(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:i,localRefs:o,meta:a}=t.root,{schemaId:l}=n.opts,c=new V_.SchemaEnv({schema:r,schemaId:l,root:s,baseId:i,localRefs:o,meta:a});return V_.compileSchema.call(n,c),aB.getValidate(e,c)}W_.default=lB});var yp=C(function(Y_){Object.defineProperty(Y_,"__esModule",{value:!0});Y_.dynamicRef=void 0;var G_=ye(),dB=gr(),z_=sc(),fB={keyword:"$dynamicRef",schemaType:"string",code:(e)=>K_(e,e.schema)};function K_(e,t){let{gen:r,keyword:n,it:s}=e;if(t[0]!=="#")throw Error(`"${n}" only supports hash fragment reference`);let i=t.slice(1);if(s.allErrors)o();else{let l=r.let("valid",!1);o(l),e.ok(l)}function o(l){if(s.schemaEnv.root.dynamicAnchors[i]){let c=r.let("_v",G_._`${dB.default.dynamicAnchors}${G_.getProperty(i)}`);r.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>r.block(()=>{z_.callRef(e,l),r.let(c,!0)}):()=>z_.callRef(e,l)}}Y_.dynamicRef=K_;Y_.default=fB});var Q_=C(function(Z_){Object.defineProperty(Z_,"__esModule",{value:!0});var mB=gp(),hB=we(),gB={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)mB.dynamicAnchor(e,"");else hB.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};Z_.default=gB});var tP=C(function(eP){Object.defineProperty(eP,"__esModule",{value:!0});var bB=yp(),xB={keyword:"$recursiveRef",schemaType:"string",code:(e)=>bB.dynamicRef(e,e.schema)};eP.default=xB});var nP=C(function(rP){Object.defineProperty(rP,"__esModule",{value:!0});var vB=gp(),wB=yp(),SB=Q_(),EB=tP(),_B=[vB.default,wB.default,SB.default,EB.default];rP.default=_B});var oP=C(function(iP){Object.defineProperty(iP,"__esModule",{value:!0});var sP=uc(),jB={keyword:"dependentRequired",type:"object",schemaType:"object",error:sP.error,code:(e)=>sP.validatePropertyDeps(e)};iP.default=jB});var lP=C(function(aP){Object.defineProperty(aP,"__esModule",{value:!0});var RB=uc(),AB={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>RB.validateSchemaDeps(e)};aP.default=AB});var uP=C(function(cP){Object.defineProperty(cP,"__esModule",{value:!0});var CB=we(),NB={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)CB.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};cP.default=NB});var fP=C(function(dP){Object.defineProperty(dP,"__esModule",{value:!0});var IB=oP(),MB=lP(),JB=uP(),DB=[IB.default,MB.default,JB.default];dP.default=DB});var hP=C(function(mP){Object.defineProperty(mP,"__esModule",{value:!0});var Xn=ye(),pP=we(),FB=gr(),qB={message:"must NOT have unevaluated properties",params:({params:e})=>Xn._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},HB={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:qB,code(e){let{gen:t,schema:r,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:o,props:a}=i;if(a instanceof Xn.Name)t.if(Xn._`${a} !== true`,()=>t.forIn("key",n,(p)=>t.if(c(a,p),()=>l(p))));else if(a!==!0)t.forIn("key",n,(p)=>a===void 0?l(p):t.if(d(a,p),()=>l(p)));i.props=!0,e.ok(Xn._`${s} === ${FB.default.errors}`);function l(p){if(r===!1){if(e.setParams({unevaluatedProperty:p}),e.error(),!o)t.break();return}if(!pP.alwaysValidSchema(i,r)){let h=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:p,dataPropType:pP.Type.Str},h),!o)t.if(Xn.not(h),()=>t.break())}}function c(p,h){return Xn._`!${p} || !${p}[${h}]`}function d(p,h){let m=[];for(let b in p)if(p[b]===!0)m.push(Xn._`${h} !== ${b}`);return Xn.and(...m)}}};mP.default=HB});var bP=C(function(yP){Object.defineProperty(yP,"__esModule",{value:!0});var Ns=ye(),gP=we(),BB={message:({params:{len:e}})=>Ns.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ns._`{limit: ${e}}`},WB={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:BB,code(e){let{gen:t,schema:r,data:n,it:s}=e,i=s.items||0;if(i===!0)return;let o=t.const("len",Ns._`${n}.length`);if(r===!1)e.setParams({len:i}),e.fail(Ns._`${o} > ${i}`);else if(typeof r=="object"&&!gP.alwaysValidSchema(s,r)){let l=t.var("valid",Ns._`${o} <= ${i}`);t.if(Ns.not(l),()=>a(l,i)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,o,(d)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:d,dataPropType:gP.Type.Num},l),!s.allErrors)t.if(Ns.not(l),()=>t.break())})}}};yP.default=WB});var $P=C(function(xP){Object.defineProperty(xP,"__esModule",{value:!0});var zB=hP(),GB=bP(),KB=[zB.default,GB.default];xP.default=KB});var wP=C(function(vP){Object.defineProperty(vP,"__esModule",{value:!0});var rt=ye(),XB={message:({schemaCode:e})=>rt.str`must match format "${e}"`,params:({schemaCode:e})=>rt._`{format: ${e}}`},ZB={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:XB,code(e,t){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:d,self:p}=a;if(!l.validateFormats)return;if(s)h();else m();function h(){let b=r.scopeValue("formats",{ref:p.formats,code:l.code.formats}),g=r.const("fDef",rt._`${b}[${o}]`),y=r.let("fType"),v=r.let("format");r.if(rt._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,rt._`${g}.type || "string"`).assign(v,rt._`${g}.validate`),()=>r.assign(y,rt._`"string"`).assign(v,g)),e.fail$data(rt.or(j(),S()));function j(){if(l.strictSchema===!1)return rt.nil;return rt._`${o} && !${v}`}function S(){let P=d.$async?rt._`(${g}.async ? await ${v}(${n}) : ${v}(${n}))`:rt._`${v}(${n})`,E=rt._`(typeof ${v} == "function" ? ${P} : ${v}.test(${n}))`;return rt._`${v} && ${v} !== true && ${y} === ${t} && !${E}`}}function m(){let b=p.formats[i];if(!b){j();return}if(b===!0)return;let[g,y,v]=S(b);if(g===t)e.pass(P());function j(){if(l.strictSchema===!1){p.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function S(E){let O=E instanceof RegExp?rt.regexpCode(E):l.code.formats?rt._`${l.code.formats}${rt.getProperty(i)}`:void 0,R=r.scopeValue("formats",{key:i,ref:E,code:O});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,rt._`${R}.validate`];return["string",E,R]}function P(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!d.$async)throw Error("async format in sync schema");return rt._`await ${v}(${n})`}return typeof y=="function"?rt._`${v}(${n})`:rt._`${v}.test(${n})`}}}};vP.default=ZB});var bp=C(function(SP){Object.defineProperty(SP,"__esModule",{value:!0});var eW=wP(),tW=[eW.default];SP.default=tW});var xp=C(function(EP){Object.defineProperty(EP,"__esModule",{value:!0});EP.contentVocabulary=EP.metadataVocabulary=void 0;EP.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];EP.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var kP=C(function(jP){Object.defineProperty(jP,"__esModule",{value:!0});var sW=sp(),iW=ap(),oW=mp(),aW=nP(),lW=fP(),cW=$P(),uW=bp(),PP=xp(),dW=[aW.default,sW.default,iW.default,(0,oW.default)(!0),uW.default,PP.metadataVocabulary,PP.contentVocabulary,lW.default,cW.default];jP.default=dW});var CP=C(function(AP){Object.defineProperty(AP,"__esModule",{value:!0});AP.DiscrError=void 0;var RP;(function(e){e.Tag="tag",e.Mapping="mapping"})(RP||(AP.DiscrError=RP={}))});var vp=C(function(TP){Object.defineProperty(TP,"__esModule",{value:!0});var ji=ye(),$p=CP(),NP=qo(),pW=Si(),mW=we(),hW={message:({params:{discrError:e,tagName:t}})=>e===$p.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>ji._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},gW={keyword:"discriminator",type:"object",schemaType:"object",error:hW,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!o)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",ji._`${r}${ji.getProperty(a)}`);t.if(ji._`typeof ${c} == "string"`,()=>d(),()=>e.error(!1,{discrError:$p.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function d(){let m=h();t.if(!1);for(let b in m)t.elseIf(ji._`${c} === ${b}`),t.assign(l,p(m[b]));t.else(),e.error(!1,{discrError:$p.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function p(m){let b=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},b);return e.mergeEvaluated(g,ji.Name),b}function h(){var m;let b={},g=v(s),y=!0;for(let P=0;P<o.length;P++){let E=o[P];if((E===null||E===void 0?void 0:E.$ref)&&!mW.schemaHasRulesButRef(E,i.self.RULES)){let R=E.$ref;if(E=NP.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,R),E instanceof NP.SchemaEnv)E=E.schema;if(E===void 0)throw new pW.default(i.opts.uriResolver,i.baseId,R)}let O=(m=E===null||E===void 0?void 0:E.properties)===null||m===void 0?void 0:m[a];if(typeof O!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||v(E)),j(O,P)}if(!y)throw Error(`discriminator: "${a}" must be required`);return b;function v({required:P}){return Array.isArray(P)&&P.includes(a)}function j(P,E){if(P.const)S(P.const,E);else if(P.enum)for(let O of P.enum)S(O,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(P,E){if(typeof P!="string"||P in b)throw Error(`discriminator: "${a}" values must be unique strings`);b[P]=E}}}};TP.default=gW});var IP=C(function(kQ,bW){bW.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var MP=C(function(RQ,xW){xW.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var JP=C(function(AQ,$W){$W.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var DP=C(function(OQ,vW){vW.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var LP=C(function(CQ,wW){wW.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var FP=C(function(NQ,SW){SW.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var qP=C(function(TQ,EW){EW.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var HP=C(function(IQ,_W){_W.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var BP=C(function(VP){Object.defineProperty(VP,"__esModule",{value:!0});var PW=IP(),jW=MP(),kW=JP(),RW=DP(),AW=LP(),OW=FP(),CW=qP(),NW=HP(),TW=["/properties"];function IW(e){return[PW,jW,kW,RW,AW,t(this,OW),CW,t(this,NW)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,TW):n}}VP.default=IW});var Ep=C(function(Yt,Sp){Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MissingRefError=Yt.ValidationError=Yt.CodeGen=Yt.Name=Yt.nil=Yt.stringify=Yt.str=Yt._=Yt.KeywordCxt=Yt.Ajv2020=void 0;var JW=np(),DW=kP(),LW=vp(),FW=BP(),wp="https://json-schema.org/draft/2020-12/schema";class Qo extends JW.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),DW.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(LW.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;FW.default.call(this,e),this.refs["http://json-schema.org/schema"]=wp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(wp)?wp:void 0)}}Yt.Ajv2020=Qo;Sp.exports=Yt=Qo;Sp.exports.Ajv2020=Qo;Object.defineProperty(Yt,"__esModule",{value:!0});Yt.default=Qo;var qW=wi();Object.defineProperty(Yt,"KeywordCxt",{enumerable:!0,get:function(){return qW.KeywordCxt}});var ki=ye();Object.defineProperty(Yt,"_",{enumerable:!0,get:function(){return ki._}});Object.defineProperty(Yt,"str",{enumerable:!0,get:function(){return ki.str}});Object.defineProperty(Yt,"stringify",{enumerable:!0,get:function(){return ki.stringify}});Object.defineProperty(Yt,"nil",{enumerable:!0,get:function(){return ki.nil}});Object.defineProperty(Yt,"Name",{enumerable:!0,get:function(){return ki.Name}});Object.defineProperty(Yt,"CodeGen",{enumerable:!0,get:function(){return ki.CodeGen}});var HW=Lo();Object.defineProperty(Yt,"ValidationError",{enumerable:!0,get:function(){return HW.default}});var VW=Si();Object.defineProperty(Yt,"MissingRefError",{enumerable:!0,get:function(){return VW.default}})});import{existsSync as yc,readFileSync as UW}from"node:fs";import{createRequire as WP}from"node:module";import{isAbsolute as zW,relative as GW,resolve as gc}from"node:path";import{fileURLToPath as UP,pathToFileURL as KW}from"node:url";function ea(e){return JSON.parse(UW(e,"utf8"))}async function zP(e){let t=gc(e),r=gc(t,"project.json"),n=gc(t,"project.schema.json");if(!yc(r))throw Error(`project.json not found in ${t}`);if(!yc(n))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"project.json#/extensions");let s=ea(r),i=ea(n);i.$id=KW(n).href;let o;try{({default:o}=await Promise.resolve().then(() => Lt(Ep(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new o({allErrors:!0,loadSchema:(d)=>YW(d,t),strict:!1}).compileAsync(i),c=l(s);return{errors:l.errors??null,valid:c}}async function YW(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let r=UP(e),n=GW(t,r);if(n.startsWith("..")||zW(n))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(yc(r))return ea(r);let s=n.split("\\").join("/"),i="node_modules/",o=s.lastIndexOf(i);if(o===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(o+i.length),l="@jxsuite/schema/",c;try{c=WP(gc(t,"package.json")).resolve(a)}catch(d){if(!a.startsWith(l))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:d});try{c=WP(import.meta.url).resolve(a)}catch(p){let h=UP(new URL(`../${a.slice(l.length)}`,import.meta.url));if(yc(h))return ea(h);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:p})}}return ea(c)}var GP=()=>{};function Gr(e){return ee(e.attributes)?e.attributes:{}}function _t(e,t){let r=Gr(e)[t];return T(r)?r:null}function nt(e){return T(e.tagName)?e.tagName.toLowerCase():""}function It(e,t="the popover"){let r=T(e.id)?e.id:_t(e,"id");if(r)return`#${r}`;let n=nt(e);return n===""?t:`the <${n}>`}function QW(e){let t=Gr(e).popover;return T(t)?t:null}function YP(e){let t=new Set,r=new Set;for(let n of e){let s=n!==null&&T(n.tagName)?n.tagName:"";if(n===null||!s.includes("-"))continue;if(_p(n))t.add(s);let i=n.observedAttributes;if(Array.isArray(i)&&eU.every((o)=>i.includes(o)))r.add(s)}return{invokerTags:r,popoverTags:t}}function _p(e){return"popover"in Gr(e)||"popover"in e}function ta(e,t){return _p(e)||(t?.popoverTags?.has(nt(e))??!1)}function Zn(e){if(T(e.id)&&e.id!=="")return e.id;let t=_t(e,"id");return t===""?null:t}function*zr(e,t=[],r=null,n){yield{enclosing:r,node:e,path:t};let s=ta(e,n)?e:r,{children:i}=e;if(Array.isArray(i)){for(let[l,c]of i.entries())if(F(c))yield*zr(c,[...t,"children",l],s,n)}else if(ee(i)&&Ft(i.map))yield*zr(i.map,[...t,"children","map"],s,n);let o=Ft(e.map)?e.map:null;if(o)yield*zr(o,[...t,"map"],s,n);let a=ee(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(F(c))yield*zr(c,[...t,"cases",l],s,n)}function Pp(e,t){let r=[];for(let{node:n}of zr(e,[],null,t)){if(!ta(n,t))continue;let s=Zn(n);if(s!==null&&!r.includes(s))r.push(s)}return r}function bc(e){return e.startsWith("@")}function XP(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function Tt(e,t){let r=e?.[t];if(r===void 0||is(r)||Array.isArray(r))return null;return String(r)}function ZP(e){for(let[t,r]of Object.entries(e??{})){if(!is(r))continue;if(XP(t)&&t.includes(":popover-open")&&Tt(r,"display")!==null)return!0;if(bc(t)&&ZP(r))return!0}return!1}function QP(e){for(let[t,r]of Object.entries(e??{})){if(!is(r))continue;if(XP(t)&&t.includes(":popover-open"))return!0;if(bc(t)&&QP(r))return!0}return!1}function rU(e){return tU.some((t)=>Tt(e,t)!==null)}function nU(e){if(!e)return[];let t=[];for(let[r,n]of Object.entries(e))if(bc(r)&&is(n)&&Tt(n,"display")!==null)t.push(r);return t}function ej(e){if(!e)return[];let t=[],r=Tt(e,"transition");if(r!==null)t.push(r);for(let[n,s]of Object.entries(e))if(bc(n)&&is(s))t.push(...ej(s));return t}function sU(e){if(!e)return!1;if(Tt(e,"positionAnchor")!==null||Tt(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(Tt(e,t)??"").includes("anchor("))}function iU(e){if(!e)return!1;if(Tt(e,"positionArea")!==null||Tt(e,"position-area")!==null||Tt(e,"positionTryFallbacks")!==null||Tt(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function tj(e,t){let r=[...zr(e,[],null,t)],n=Pp(e,t),s=r.some(({node:a})=>ta(a,t)),i=new Set;for(let{node:a}of r)if(KP.has(nt(a))){let l=_t(a,"popovertarget");if(l!==null)i.add(l)}let o=[];for(let{enclosing:a,node:l,path:c}of r)if(o.push(...oU(l,c,a,n,s,t)),_p(l))o.push(...aU(l,c,i));return o}function oU(e,t,r,n,s,i){let o=[],a=nt(e),l=_t(e,"popovertarget"),c=KP.has(a)||(i?.invokerTags?.has(a)??!1);if(l!==null&&!c)return o.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${Ve}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),o;if(l!==null){if(s&&!n.includes(l)){let d=n.length>0?`The popovers here are: ${n.map((p)=>`"${p}"`).join(", ")}. `:"";o.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${d}A target that names nothing does nothing, silently. ${Ve}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(r!==null&&Zn(r)!==null&&Zn(r)!==l)o.push({detail:`This control is inside ${It(r)} but targets "${l}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${Ve}`,message:`A control inside ${It(r)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&r!==null&&l===null){let d=_t(e,"href")??(T(e.href)?e.href:null),p=_t(e,"target")==="_blank",h=d!==null&&d.includes("#");if(p||h){let m=p?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";o.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${Ve}`,message:`A link inside ${It(r)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return o}function aU(e,t,r){let n=[],{style:s}=e,i=It(e),o=QW(e);if(o!==null&&o!==""&&!ZW.some((c)=>c===o))n.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${Ve}`,fix:"mode",message:`${i} declares popover="${o}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if($t(Gr(e).popover))n.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${Ve}`,fix:"mode",message:`${i} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=Tt(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")n.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${Ve}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of nU(s))n.push({detail:`The same defect as a base \`display\`, arriving through \`${c}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${Ve}`,fix:"display",message:`${i} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(Tt(s,"visibility")!==null)n.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${Ve}`,fix:"display",message:`${i} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!QP(s))n.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${Ve}`,message:`${i} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!ZP(s)&&a===null&&rU(s))n.push({detail:`${i} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${Ve}`,fix:"open-display",message:`${i} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of ej(s))if(c.includes("display")&&!c.includes("overlay")){n.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${Ve}`,message:`${i} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(sU(s)&&!iU(s))n.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${Ve}`,message:`${i} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=Zn(e);if(l!==null&&!r.has(l))n.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${Ve}`,message:`${i} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return n}var ZW,KP,eU,tU,Ve="See docs/framework/concepts/overlays.";var xc=q(()=>{ve();ZW=["auto","manual","hint"],KP=new Set(["button","input"]);eU=["popovertarget","popovertargetaction","command","commandfor"];tU=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function Ci(e,t){let r=Gr(e),n=t in r?r[t]:e[t];if(n===void 0||n===null)return{kind:"absent"};if(Ce(n)||ee(n))return{kind:"bound"};if(T(n))return n.includes("${")?{kind:"bound"}:{kind:"text",text:n};return{isTrue:n===!0,kind:"other"}}function Ai(e,t){let r=Ci(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Pt(e,t){return Ci(e,t).kind!=="absent"}function Qn(e){let t=Ci(e,"role");if(t.kind==="bound")return Oi;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function $c(e){let t=Ci(e,"id");if(t.kind==="bound")return Oi;return t.kind==="text"&&t.text!==""?t.text:null}function xr(e,t){let r=Ci(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function vc(e){let t=e.textContent;if(T(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(xr(e,"aria-label")||Pt(e,"aria-labelledby"))return!0;if(nt(e)==="img"&&(xr(e,"alt")||xr(e,"title")))return!0;if(nt(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let s of r)if(T(s)){if(s.trim()!=="")return!0}else if(F(s)&&vc(s))return!0}else if(r!=null)return!0;if(ee(e.map))return!0;return(ee(e.cases)?Object.values(e.cases):[]).some((s)=>Ft(s)&&vc(s))}function*Ri(e,t=[],r=[],n=[]){yield{node:e,path:t,roles:r,tags:n};let s=[...r,Qn(e)],i=[...n,nt(e)],{children:o}=e;if(Array.isArray(o)){for(let[a,l]of o.entries())if(F(l))yield*Ri(l,[...t,"children",a],s,i)}else if(ee(o)&&Ft(o.map))yield*Ri(o.map,[...t,"children","map"],s,i);if(Ft(e.map))yield*Ri(e.map,[...t,"map"],s,i);if(ee(e.cases)){for(let[a,l]of Object.entries(e.cases))if(F(l))yield*Ri(l,[...t,"cases",a],s,i)}}function pU(e){return e.some((t)=>t.includes("-"))}function Kr(e,t,r,n,s,i="error"){return{criterion:s,detail:`${n} ${lU}`,message:r,path:t,rule:e,severity:i}}function rj(e,t,r){if(r.includes("label"))return!0;if(e===Oi||t.bound)return!0;return e!==null&&t.ids.has(e)}function mU(e,t){let{node:r,path:n,tags:s}=e,i=nt(r),o=Qn(r);if(o==="bound")return null;if(xr(r,"aria-label")||Pt(r,"aria-labelledby")||xr(r,"title"))return null;let l=It(r,"the control"),c=(p)=>Kr("interactive-unnamed",n,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${p}`,"4.1.2"),d=hU(r,i,t,s);if(d==="named"||d==="exempt")return null;if(o!==null&&cU.has(o))return vc(r)?null:c("Give it text content, or an aria-label.");if(o!==null&&uU.has(o))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(o!==null)return null;if(i==="button"||i==="summary"||i==="a"&&Pt(r,"href"))return vc(r)?null:c("Give it text content, or an aria-label.");if(d==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(d==="unnamed-value")return c("Give it a value, or an aria-label.");if(d==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function hU(e,t,r,n){if(t==="area"){if(!Pt(e,"href"))return"none";return xr(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return rj($c(e),r,n)||xr(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(Ai(e,"type")??"text").toLowerCase();if(s==="hidden"||Pt(e,"type")&&Ai(e,"type")===null)return"exempt";if(dU.has(s))return xr(e,"value")?"named":"unnamed-value";if(s==="image")return xr(e,"alt")?"named":"unnamed-alt";return rj($c(e),r,n)||xr(e,"placeholder")?"named":"unnamed"}function yU(e){let{node:t,path:r,tags:n}=e,s=nt(t);if(!s.includes("-")||!n.some((i)=>gU.has(i)))return null;return Kr("custom-element-in-select",r,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function bU(e){let{node:t,path:r}=e;if(nt(t)!=="img")return null;let n=Qn(t);if(n==="bound"||n==="presentation"||n==="none")return null;if(Pt(t,"alt")||xr(t,"aria-label")||Pt(t,"aria-labelledby"))return null;return Kr("img-alt-missing",r,`${It(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}function $U(e,t){let{node:r,path:n}=e,s=[];for(let i of xU){let o=Ai(r,i);if(o===null)continue;for(let a of o.split(/\s+/))if(a!==""&&!t.has(a))s.push(Kr("aria-target-missing",n,`${It(r,"the element")} points ${i} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function vU(e,t,r){for(let n of nj.get(t)??[]){let s=r.get(n);if(s===void 0)continue;if(s.bound)return!0;if(e===Oi&&s.ids.size>0)return!0;if(e!==null&&e!==Oi&&s.ids.has(e))return!0}return!1}function wU(e,t){let{node:r,path:n,roles:s,tags:i}=e,o=Qn(r);if(o===null||o==="bound"||n.length===0||pU(i))return null;if(s.includes("bound")||vU($c(r),o,t))return null;let a=It(r,"the element");if(o==="tab"&&!s.includes("tablist"))return Kr("tab-outside-tablist",n,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((o==="menuitem"||o==="menuitemcheckbox"||o==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Kr("menuitem-outside-menu",n,`${a} is a ${o} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(o==="option"&&!s.includes("listbox")&&!i.includes("select")&&!i.includes("datalist"))return Kr("option-outside-listbox",n,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function SU(e){let t=[];for(let{node:r}of Ri(e)){if(Qn(r)!=="tab")continue;let n=Ci(r,"aria-selected");if(n.kind==="bound")return null;t.push(n.kind==="other"&&n.isTrue||n.kind==="text"&&n.text==="true")}return t}function EU(e){let{node:t,path:r}=e;if(Qn(t)!=="tablist")return null;let n=SU(t);if(n===null||n.length===0||n.includes(!0))return null;return Kr("tablist-none-selected",r,`${It(t,"the tablist")} has ${n.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function _U(e){let{node:t,path:r}=e,n=Qn(t);if(!(nt(t)==="dialog"||n==="dialog"||n==="alertdialog")||n==="bound")return null;if(xr(t,"aria-label")||Pt(t,"aria-labelledby"))return null;return Kr("dialog-unnamed",r,`${It(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}function jU(e){let{node:t,path:r}=e;if(!Pt(t,"aria-activedescendant"))return null;let n=nt(t);if(PU.has(n)||n==="a"&&Pt(t,"href")||Pt(t,"tabIndex")||Pt(t,"tabindex")||Pt(t,"contenteditable"))return null;return Kr("activedescendant-not-focusable",r,`${It(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function sj(e){let t=[...Ri(e)],r=new Set,n={bound:!1,ids:new Set},s=new Map,i=!1;for(let{node:a}of t){let l=Qn(a);if(l!==null&&fU.has(l)){let d=s.get(l)??{bound:!1,ids:new Set},p=Ai(a,"aria-owns");if(p===null)d.bound||=Pt(a,"aria-owns");else for(let h of p.split(/\s+/))if(h!=="")d.ids.add(h);s.set(l,d)}let c=$c(a);if(c===Oi)i=!0;else if(c!==null)r.add(c);if(nt(a)==="label"){let d=Ai(a,"for")??Ai(a,"htmlFor");if(d===null)n.bound||=Pt(a,"for")||Pt(a,"htmlFor");else n.ids.add(d)}}let o=[];for(let a of t){let l=[mU(a,n),bU(a),wU(a,s),yU(a),EU(a),_U(a),jU(a)];for(let c of l)if(c)o.push(c);if(!i)o.push(...$U(a,r))}return o}var lU="See docs/framework/concepts/accessibility.",Oi="bound",cU,uU,dU,nj,fU,gU,xU,PU;var ij=q(()=>{ve();xc();cU=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),uU=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),dU=new Set(["button","reset","submit"]),nj=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),fU=new Set([...nj.values()].flat());gU=new Set(["select","jx-select"]);xU=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];PU=new Set(["button","input","select","textarea"])});function jp(e){return nt(e)==="dialog"}function oj(e){return e.startsWith("--")}function TU(e){let t=[];for(let{node:r}of zr(e)){let n=Zn(r);if(jp(r)&&n!==null&&!t.includes(n))t.push(n)}return t}function IU(e){let t=e.oncommand;return t!==void 0&&t!==null}function MU(e,t){for(let{node:r}of zr(e)){if(r===e)continue;let n=nt(r);if(n==="button"){let s=_t(r,"command"),i=_t(r,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(i===null||i===t))return!0}if(n==="form"&&_t(r,"method")?.toLowerCase()==="dialog")return!0}return!1}function lj(e,t){let r=[...zr(e,[],null,t)],n=TU(e),s=Pp(e,t),i=n.length>0||s.length>0,o=new Map,a=new Map;for(let{node:c}of r){let d=Zn(c);if(d!==null&&!o.has(d))o.set(d,c);if(nt(c)==="button"){let p=_t(c,"commandfor"),h=_t(c,"command");if(p!==null){let m=a.get(p)??new Set;m.add(h??""),a.set(p,m)}}}let l=[];for(let{node:c,path:d}of r)if(l.push(...JU(c,d,o,n,s,i,t)),jp(c))l.push(...DU(c,d,a));return l}function JU(e,t,r,n,s,i,o){let a=[],l=nt(e),c=o?.invokerTags?.has(l)??!1,d=_t(e,"command"),p=_t(e,"commandfor");if(!(d!==null||p!==null||("command"in Gr(e))||("commandfor"in Gr(e))))return a;let m=It(e,"the element");if(!NU.has(l)&&!c)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${Ve}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(d!==null&&!OU.has(d)&&!oj(d))return a.push({detail:`\`command\` is an enumerated attribute taking ${aj.map((b)=>`\`${b}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${Ve}`,message:`${m} declares command="${d}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(p!==null){let b=r.get(p),g=n.includes(p),y=s.includes(p);if(!b&&i){let v=[...n,...s].map((j)=>`"${j}"`).join(", ");return a.push({detail:`No element in this document has the id "${p}". The dialogs and popovers here are: ${v}. A commandfor that names nothing does nothing, silently. ${Ve}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(d!==null&&b){if(kU.has(d)&&!jp(b))a.push({detail:`\`${d}\` acts on a <dialog>, and "${p}" is ${y?"a popover":`a <${nt(b)||"element"}>`}. The click is ignored. ${y?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${Ve}`,message:`${m} sends ${d} to "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(RU.has(d)&&!ta(b,o))a.push({detail:`\`${d}\` acts on a popover, and "${p}" is ${g?"a dialog":`a <${nt(b)||"element"}>`} that declares no \`popover\`. The click is ignored. ${g?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${Ve}`,message:`${m} sends ${d} to "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(oj(d)&&!IU(b))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${p}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${Ve}`,message:`${m} sends ${d} to "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function DU(e,t,r){let n=[],s=It(e,"the dialog"),i=Zn(e),{style:o}=e,a=_t(e,"closedby");if(a!==null&&!CU.has(a))n.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${Ve}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(Tt(o,"display")!==null)n.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${Ve}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=i===null?void 0:r.get(i),c=_t(e,"open")!==null||Gr(e).open===!0||e.open===!0;if(i!==null&&!l?.has("show-modal")&&!c)n.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${Ve}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!MU(e,i))n.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${Ve}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return n}var aj,kU,RU,AU,OU,CU,NU;var cj=q(()=>{ve();xc();aj=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],kU=new Set(["show-modal","close","request-close"]),RU=new Set(["toggle-popover","show-popover","hide-popover"]),AU=["any","closerequest","none"],OU=new Set(aj),CU=new Set(AU),NU=new Set(["button"])});var xj=C(function(yj){Object.defineProperty(yj,"__esModule",{value:!0});yj.formatNames=yj.fastFormats=yj.fullFormats=void 0;function Yr(e,t){return{validate:e,compare:t}}yj.fullFormats={date:Yr(pj,Op),time:Yr(Rp(!0),Cp),"date-time":Yr(uj(!0),hj),"iso-time":Yr(Rp(),mj),"iso-date-time":Yr(uj(),gj),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:BU,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:XU,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:WU,int32:{type:"number",validate:GU},int64:{type:"number",validate:KU},float:{type:"number",validate:fj},double:{type:"number",validate:fj},password:!0,binary:!0};yj.fastFormats={...yj.fullFormats,date:Yr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Op),time:Yr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Cp),"date-time":Yr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,hj),"iso-time":Yr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,mj),"iso-date-time":Yr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,gj),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};yj.formatNames=Object.keys(yj.fullFormats);function LU(e){return e%4===0&&(e%100!==0||e%400===0)}var FU=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,qU=[0,31,28,31,30,31,30,31,31,30,31,30,31];function pj(e){let t=FU.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],s=+t[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&LU(r)?29:qU[n])}function Op(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var kp=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Rp(e){return function(r){let n=kp.exec(r);if(!n)return!1;let s=+n[1],i=+n[2],o=+n[3],a=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),d=+(n[7]||0);if(c>23||d>59||e&&!a)return!1;if(s<=23&&i<=59&&o<60)return!0;let p=i-d*l,h=s-c*l-(p<0?1:0);return(h===23||h===-1)&&(p===59||p===-1)&&o<61}}function Cp(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function mj(e,t){if(!(e&&t))return;let r=kp.exec(e),n=kp.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var Ap=/t|\s/i;function uj(e){let t=Rp(e);return function(n){let s=n.split(Ap);return s.length===2&&pj(s[0])&&t(s[1])}}function hj(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function gj(e,t){if(!(e&&t))return;let[r,n]=e.split(Ap),[s,i]=t.split(Ap),o=Op(r,s);if(o===void 0)return;return o||Cp(n,i)}var HU=/\/|:/,VU=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function BU(e){return HU.test(e)&&VU.test(e)}var dj=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function WU(e){return dj.lastIndex=0,dj.test(e)}var UU=-2147483648,zU=2147483647;function GU(e){return Number.isInteger(e)&&e<=zU&&e>=UU}function KU(e){return Number.isInteger(e)}function fj(){return!0}var YU=/[^\\]\\Z/;function XU(e){if(YU.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var wj=C(function(vj){Object.defineProperty(vj,"__esModule",{value:!0});var QU=sp(),e6=ap(),t6=mp(),r6=bp(),$j=xp(),n6=[QU.default,e6.default,(0,t6.default)(),r6.default,$j.metadataVocabulary,$j.contentVocabulary];vj.default=n6});var Sj=C(function(oee,i6){i6.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{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:"#"}},default:!0}});var _j=C(function(Xt,Tp){Object.defineProperty(Xt,"__esModule",{value:!0});Xt.MissingRefError=Xt.ValidationError=Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=Xt.Ajv=void 0;var o6=np(),a6=wj(),l6=vp(),Ej=Sj(),c6=["/properties"],wc="http://json-schema.org/draft-07/schema";class ra extends o6.default{_addVocabularies(){if(super._addVocabularies(),a6.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(l6.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Ej,c6):Ej;this.addMetaSchema(e,wc,!1),this.refs["http://json-schema.org/schema"]=wc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(wc)?wc:void 0)}}Xt.Ajv=ra;Tp.exports=Xt=ra;Tp.exports.Ajv=ra;Object.defineProperty(Xt,"__esModule",{value:!0});Xt.default=ra;var u6=wi();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return u6.KeywordCxt}});var Ni=ye();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Ni._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Ni.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Ni.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Ni.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Ni.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Ni.CodeGen}});var d6=Lo();Object.defineProperty(Xt,"ValidationError",{enumerable:!0,get:function(){return d6.default}});var f6=Si();Object.defineProperty(Xt,"MissingRefError",{enumerable:!0,get:function(){return f6.default}})});var jj=C(function(Pj){Object.defineProperty(Pj,"__esModule",{value:!0});Pj.formatLimitDefinition=void 0;var h6=_j(),Ar=ye(),es=Ar.operators,Sc={formatMaximum:{okStr:"<=",ok:es.LTE,fail:es.GT},formatMinimum:{okStr:">=",ok:es.GTE,fail:es.LT},formatExclusiveMaximum:{okStr:"<",ok:es.LT,fail:es.GTE},formatExclusiveMinimum:{okStr:">",ok:es.GT,fail:es.LTE}},g6={message:({keyword:e,schemaCode:t})=>Ar.str`should be ${Sc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ar._`{comparison: ${Sc[e].okStr}, limit: ${t}}`};Pj.formatLimitDefinition={keyword:Object.keys(Sc),type:"string",schemaType:"string",$data:!0,error:g6,code(e){let{gen:t,data:r,schemaCode:n,keyword:s,it:i}=e,{opts:o,self:a}=i;if(!o.validateFormats)return;let l=new h6.KeywordCxt(i,a.RULES.all.format.definition,"format");if(l.$data)c();else d();function c(){let h=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),m=t.const("fmt",Ar._`${h}[${l.schemaCode}]`);e.fail$data(Ar.or(Ar._`typeof ${m} != "object"`,Ar._`${m} instanceof RegExp`,Ar._`typeof ${m}.compare != "function"`,p(m)))}function d(){let h=l.schema,m=a.formats[h];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${h}" does not define "compare" function`);let b=t.scopeValue("formats",{key:h,ref:m,code:o.code.formats?Ar._`${o.code.formats}${Ar.getProperty(h)}`:void 0});e.fail$data(p(b))}function p(h){return Ar._`${h}.compare(${r}, ${n}) ${Sc[s].fail} 0`}},dependencies:["format"]};var y6=(e)=>(e.addKeyword(Pj.formatLimitDefinition),e);Pj.default=y6});var Oj=C(function(na,Aj){Object.defineProperty(na,"__esModule",{value:!0});var Ti=xj(),x6=jj(),Mp=ye(),kj=new Mp.Name("fullFormats"),$6=new Mp.Name("fastFormats"),Jp=(e,t={keywords:!0})=>{if(Array.isArray(t))return Rj(e,t,Ti.fullFormats,kj),e;let[r,n]=t.mode==="fast"?[Ti.fastFormats,$6]:[Ti.fullFormats,kj],s=t.formats||Ti.formatNames;if(Rj(e,s,r,n),t.keywords)(0,x6.default)(e);return e};Jp.get=(e,t="full")=>{let n=(t==="fast"?Ti.fastFormats:Ti.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function Rj(e,t,r,n){var s,i;(s=(i=e.opts.code).formats)!==null&&s!==void 0||(i.formats=Mp._`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}Aj.exports=na=Jp;Object.defineProperty(na,"__esModule",{value:!0});na.default=Jp});import{existsSync as Nj,readFileSync as Tj,readdirSync as Ij,statSync as Mj}from"node:fs";import{createRequire as v6}from"node:module";import{join as Jj,relative as Dp,resolve as Lp}from"node:path";async function _6(){try{let{default:e}=await Promise.resolve().then(() => Lt(Ep(),1)),{default:t}=await Promise.resolve().then(() => Lt(Oj(),1));return{addFormats:t,Ajv:e}}catch(e){throw Error("Project validation requires ajv and ajv-formats: bun add ajv ajv-formats",{cause:e})}}async function Dj(e,t={}){let r=Lp(e),n=[],s=[],i=0;for(let S of["project.schema.json","document.schema.json"]){let P=Lp(r,S);if(!Nj(P))continue;i+=1;let E=sa(P),O=j6(E);if(O.length>0)n.push({errors:O.map(({reason:R,ref:k})=>({message:`$ref "${k}" ${R} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:S})}if(n.length>0)return{checked:i,issues:n,lint:s,valid:!1};let o=await zP(r);if(i+=1,!o.valid)n.push({errors:o.errors??[],file:"project.json"});let{addFormats:a,Ajv:l}=await _6(),{document:c}=await zv(r,{write:!1}),d=new l({allErrors:!0,ownProperties:!0,strict:!1});a(d);let p=d.compile(c),h=YP(Cj(r).flatMap((S)=>{try{return[JSON.parse(Tj(S,"utf8"))]}catch{return[]}}));for(let S of w6)for(let P of qj(Lp(r,S))){if(P.endsWith(".class.json"))continue;i+=1;let E=sa(P);if(p(E))s.push(...P6(E,Dp(r,P),h));else n.push({errors:p.errors??[],file:Dp(r,P)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let b=m.compile(pf());for(let S of Cj(r)){i+=1;let P=sa(S);if(!b(P))n.push({errors:b.errors??[],file:Dp(r,S)})}let{config:g}=Rn(r),y=await kn(r,g),v=v6(import.meta.url);for(let S of y.extensions)for(let P of["project","document","fields"]){let E=S.schemas[P];if(!E)continue;i+=1;let O=new l({allErrors:!0,ownProperties:!0,strict:!1});a(O);for(let R of E6){let k=v.resolve(R);O.addSchema(sa(k))}try{O.compile(sa(E))}catch(R){n.push({errors:[{message:R instanceof Error?R.message:String(R)}],file:`${S.specifier} (${P} fragment)`})}}let j=t.strict===!0&&s.some((S)=>S.severity==="error");return{checked:i,issues:n,lint:s,valid:n.length===0&&!j}}function sa(e){return JSON.parse(Tj(e,"utf8"))}function P6(e,t,r){let n=[];for(let s of tj(e,r))n.push({...Fp(s),file:t,source:"popover"});for(let s of lj(e,r))n.push({...Fp(s),file:t,source:"dialog"});for(let s of sj(e))n.push({...Fp(s),criterion:s.criterion,file:t,source:"accessibility"});return n}function Fp(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function Lj(e){return e.lint.map((t)=>{let r=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${r}]`})}function j6(e){let t=[],r=new Set,n=(i)=>{let o=e;for(let a of i.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!F(o))return!1;if(o=o[l],o===void 0)return!1}return!0},s=(i)=>{if(!ee(i)||r.has(i))return;r.add(i);let o=i.$ref;if(T(o)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(o))t.push({reason:"is an absolute URI editors resolve over the network",ref:o});else if(!o.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:o});else if(o.length>1&&!o.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:o});else if(o.length>1&&!n(o.slice(1)))t.push({reason:"points at no node in this document",ref:o})}for(let[a,l]of Object.entries(i)){if(!k6.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(ee(l)){if(s(l),Fj.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function qj(e){if(!Nj(e))return[];let t=[];for(let r of Ij(e)){let n=Jj(e,r);if(Mj(n).isDirectory())t.push(...qj(n));else if(r.endsWith(".json"))t.push(n)}return t.toSorted()}function Cj(e){let t=[],r=(n)=>{for(let s of Ij(n)){if(S6.has(s))continue;let i=Jj(n,s);if(Mj(i).isDirectory())r(i);else if(s.endsWith(".class.json"))t.push(i)}};return r(e),t.toSorted()}function Hj(e){let t=[];for(let r of e.issues){t.push(`${r.file}:`);for(let n of r.errors){let s=ee(n)?n:{},{instancePath:i,message:o}=s;t.push(` - ${i||"/"}: ${o??JSON.stringify(n)}`)}}return t}var w6,S6,E6,Fj,k6;var Vj=q(()=>{D0();GP();ij();cj();xc();ve();nn();Hi();Qd();w6=["components","pages","layouts"],S6=new Set(["node_modules","dist",".git"]),E6=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];Fj=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),k6=new Set([...Fj,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});rr();import{relative as qp,resolve as Bj}from"node:path";async function R6(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
|
|
572
570
|
|
|
573
571
|
Commands:
|
|
574
572
|
build [root] Build a Jx site to dist/
|
|
@@ -584,8 +582,8 @@ Options:
|
|
|
584
582
|
--port <n> dev/preview: port to listen on (default 3000 / 4173)
|
|
585
583
|
--dry-run db push: print the statements without executing them
|
|
586
584
|
--connection db push: restrict to one connection name
|
|
587
|
-
--strict validate: fail on an overlay or accessibility lint error, not only a schema error`),process.exit(0);let r=t==="db",n=r?e[1]:null,s=e.slice(r?2:1),i=new Set,o=[],a,l;for(let p=0;p<s.length;p+=1){let h=s[p];if(h==="--connection")p+=1,a=s[p];else if(h==="--port"){p+=1;let m=Math.trunc(Number(s[p]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(h.startsWith("--"))i.add(h);else o.push(h)}let[c]=o,d=
|
|
588
|
-
Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let p=i.has("--dry-run");try{await Promise.resolve().then(() =>
|
|
585
|
+
--strict validate: fail on an overlay or accessibility lint error, not only a schema error`),process.exit(0);let r=t==="db",n=r?e[1]:null,s=e.slice(r?2:1),i=new Set,o=[],a,l;for(let p=0;p<s.length;p+=1){let h=s[p];if(h==="--connection")p+=1,a=s[p];else if(h==="--port"){p+=1;let m=Math.trunc(Number(s[p]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(h.startsWith("--"))i.add(h);else o.push(h)}let[c]=o,d=Bj(c??".");if(r){if(n!=="push")console.error(`Unknown db subcommand: ${n??"(none)"}
|
|
586
|
+
Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let p=i.has("--dry-run");try{await Promise.resolve().then(() => _m());let m={dryRun:p};if(a!==void 0)m.connection=a;let{results:b,bindingsPatched:g,wranglerPath:y}=await Em(d,m);for(let v of b){let j=v.applied?"applied":"dry-run";console.log(`${v.connection} (${v.provider}) — ${v.tables.length} table(s), ${v.statements.length} statement(s) [${j}]`);for(let S of v.statements)console.log(` ${S}`);for(let S of v.warnings)console.warn(` warning: ${S}`)}if(g&&y)console.log(`Updated bindings in ${qp(d,y)}`)}catch(h){console.error(`db push failed: ${Ee(h)}`),process.exit(1)}return}if(t==="build"){let p=i.has("--verbose"),h=!i.has("--no-clean");console.log(`Building site from ${d}...`);try{await Promise.resolve().then(() => jv());let b=await vv(d,{clean:h,verbose:p});if(b.errors.length>0){console.error(`
|
|
589
587
|
Build completed with ${b.errors.length} error(s):`);for(let g of b.errors)console.error(` - ${g}`);process.exit(1)}console.log(`
|
|
590
|
-
Done: ${b.routes} routes → ${b.files} files`)}catch(m){console.error(`Build failed: ${Ee(m)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() =>
|
|
591
|
-
Run "jx --help" for usage.`),process.exit(1)}var
|
|
588
|
+
Done: ${b.routes} routes → ${b.files} files`)}catch(m){console.error(`Build failed: ${Ee(m)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => Rv());kv(d,l)}catch(p){console.error(Ee(p)),process.exit(1)}else if(t==="preview"){let{existsSync:p}=await import("node:fs"),h=Bj(d,"dist");if(!p(h))console.error(`No build output at ${h} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => Nv());let b=l??4173;Cv(h,b),console.log(`Previewing ${h} at http://localhost:${b}`)}else if(t==="schema")try{await Promise.resolve().then(() => Qd());let{projectSchemaPath:h,documentSchemaPath:m}=await Uv(d);console.log(`Wrote ${qp(d,h)}`),console.log(`Wrote ${qp(d,m)}`)}catch(p){console.error(`Schema generation failed: ${Ee(p)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => Vj());let b=await Dj(d,{strict:i.has("--strict")}),g=Lj(b);if(b.valid){console.log(`Project is valid (${b.checked} files checked in ${d})`);for(let y of g)console.log(y)}else{console.error(`Project is INVALID (${d}):`);for(let y of[...Hj(b),...g])console.error(y);process.exit(1)}}catch(p){console.error(`Validation failed: ${Ee(p)}`),process.exit(1)}else console.error(`Unknown command: ${t}
|
|
589
|
+
Run "jx --help" for usage.`),process.exit(1)}var Oee=R6();export{Oee as ready};
|