@jxsuite/compiler 8.2.0 → 8.3.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 CHANGED
@@ -1,22 +1,66 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as eR}from"node:module";var G_=Object.create;var{getPrototypeOf:K_,defineProperty:jm,getOwnPropertyNames:Y_}=Object;var km=Object.prototype.hasOwnProperty;function X_(e){return this[e]}var Z_,Q_,Yt=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var s=t?Z_??=new WeakMap:Q_??=new WeakMap,i=s.get(e);if(i)return i}r=e!=null?G_(K_(e)):{};let o=t||!e||!e.__esModule||!km.call(e,"default")?jm(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Y_(e))if(!km.call(o,a))jm(o,a,{get:X_.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 H=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var De=eR(import.meta.url);function T(e){return typeof e==="string"}function Xt(e){return typeof e==="number"}function Tt(e){return typeof e==="boolean"}function It(e){return typeof e==="function"}function q(e){return typeof e==="object"&&e!==null}function X(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Je(e){return X(e)&&typeof e.$ref==="string"}function pr(e){return X(e)&&e.$prototype==="Function"}function mr(e){return X(e)&&X(e.$expression)}function Ns(e){return mr(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function Wn(e){return pr(e)&&Array.isArray(e.body)}function Vr(e){return X(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function En(e){return X(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function _m(e){return X(e)&&!e.$prototype&&!e.$expression&&"default"in e}function Un(e){if(!X(e))return!1;for(let t of Object.keys(e))if(!Rm.has(t))return!1;return!0}function rt(e){return X(e)&&e.$prototype==="Array"}function bu(e){return(Array.isArray(e)?e:[e]).some((r)=>rt(r))}function Am(e){return X(e)&&e.$prototype==="Class"}function Zt(e){return X(e)}function ye(e){return typeof e==="string"&&e.includes("${")}function Ts(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(e)}function Is(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Pn(e){if(!e)return[];return e.map((t)=>T(t)?t:t.name)}function tR(e){return typeof e==="string"}function Br(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!X(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 X(t.cases)&&Object.values(t.cases).every((r)=>T(r))&&typeof t.default==="string";return!1}function di(e){if(tR(e))return[e];if(!Br(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 Rm;var Pe=H(()=>{Rm=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"])});function Cm(e){let t=[],r=[],n=null,s=0,i=()=>r.at(-1)?.path??"",o=()=>n===null?i():sR(i(),n),a=()=>{s+=1;let l="";while(s<e.length){let c=e[s];if(c==="\\"){let u=e[s+1]??"";if(u==="u")l+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else l+=rR.get(u)??u,s+=2;continue}if(c==='"')return s+=1,l;l+=c,s+=1}return l};while(s<e.length){let l=e[s];if(Om.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 u=a(),p=r.at(-1);if(p?.kind==="object"&&nR(e,s)===":"){if(p.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:p.path});p.keys.add(u),n=u}else n=null;continue}if(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let p=e.slice(u,s);if(!iR(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 nR(e,t){let r=t;while(r<e.length&&Om.has(e[r]))r+=1;return e[r]??""}function sR(e,t){return e===""?t:`${e}.${t}`}function iR(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Nm(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 Om,rR;var Tm=H(()=>{Om=new Set([" ","\t",`
3
- `,"\r"]);rR=new Map([["b","\b"],["f","\f"],["n",`
4
- `],["r","\r"],["t","\t"]])});function ke(e){return e instanceof Error?e.message:String(e)}function Mm(e){if(T(e))return Im.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>Mm(t));if(X(e))return Jm(e);return e}function Jm(e){let t={};for(let[r,n]of Object.entries(e))t[Im.test(r)?r.normalize("NFC"):r]=Mm(n);return t}function xu(e,t,r){let n;try{n=JSON.parse(e)}catch(i){throw Error(`Failed to parse ${r} at ${t}: ${ke(i)}`,{cause:i})}if(!X(n))throw Error(`Invalid ${r} at ${t}: expected a JSON object`);let s=Cm(e);if(s.length>0){let i=s.map((o)=>Nm(o)).join("; ");throw Error(`Invalid ${r} at ${t}: ${i}`)}return Jm(n)}function zn(e,t){return xu(e,t,"Jx document")}function Dm(e,t){return xu(e,t,"project config")}function Lm(e,t){return xu(e,t,"class definition")}var Im;var hr=H(()=>{Pe();Tm();Im=/[^\p{ASCII}]/u});function oR(e){return JSON.parse(e)}function pi(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function aR(e){return pi(e)&&typeof e.binding==="string"}function lR(e){try{let t=oR(e);return pi(t)?t:void 0}catch{return}}function Fm(e,t){if(t.length===0)return{content:e??"",patched:!1};let r={};if(e){let n=lR(e);if(n===void 0)return{content:e,patched:!1};r=n}for(let n of t)qm(r,n);return{content:`${JSON.stringify(r,null,"\t")}
5
- `,patched:!0}}function qm(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]=cR(Array.isArray(s)?s:[],n);continue}if(pi(n)){if(pi(s))qm(s,n);else if(s===void 0)e[r]=structuredClone(n);continue}if(s===void 0)e[r]=n}}function cR(e,t){let r=[...e];for(let n of t){if(!aR(n)){if(!r.some((a)=>JSON.stringify(a)===JSON.stringify(n)))r.push(structuredClone(n));continue}let s=r.findIndex((o)=>pi(o)&&o.binding===n.binding),i=r[s];if(pi(i))r[s]={...i,...n};else r.push(structuredClone(n))}return r}var Hm=()=>{};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(!Vm.test(s)||!Vm.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("."),u=c===-1?null:l.slice(0,c),p=u!==null&&uR.has(u)?u:null,g=p===null?l:l.slice(p.length+1);if(g==="")return null;let m={};for(let b of r){let h=b.indexOf("=");if(h===-1)return null;let y=b.slice(0,h).trim().toLowerCase(),v=b.slice(h+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:g,suffix:a,tree:p,type:s}}function zm(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 Gm(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 Vm,uR,Bm="text/markdown; variant=GFM",Wm="application/yaml",Km;var $u=H(()=>{Pe();Vm=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,uR=new Set(["vnd","prs","x"]);Km={".markdown":`${Bm}; charset=utf-8`,".md":`${Bm}; charset=utf-8`,".yaml":`${Wm}; charset=utf-8`,".yml":`${Wm}; charset=utf-8`}});function Qm(e){if(e===null)throw TypeError("A class descriptor cannot be null");return X(e)?e:{}}class Ca{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=Gm(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=dR(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(!It(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 Na{#t;constructor(e){this.#t=e;for(let t of e){if(t.mediaType===null)continue;let r=zm(t.mediaType);if(r!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${r}`)}for(let t of Xm){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=Ym(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=Ym(e);return this.#t.some((r)=>r.extensions.includes(t))}}function dR(e){let t={},r=e.$defs?.methods??{};for(let[n,s]of Object.entries(r)){let{role:i}=s;if(!mR(i))continue;let o={identifier:s.identifier??n,timing:s.timing??fR};if(T(s.discriminator))o.discriminator=s.discriminator;t[i]=o}return t}function mR(e){return e!==void 0&&pR.has(e)}function Ym(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var Xm,Zm,fR,pR;var vu=H(()=>{Pe();$u();Xm=["parse","serialize","rewrite","discover","load"],Zm=[...Xm,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];fR=["compiler","server"];pR=new Set(Zm)});class eh{#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 Na(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 th(e,t,r){let n=[];for(let s of e??[])n.push(await hR(s,t,r));return new eh(n)}async function hR(e,t,r){let n;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(r,e);n=t.resolvePath(`${l}/package.json`,`./${Eo}`)}else try{n=t.resolvePath(r,`${e}/${Eo}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Eo} (is the package installed, and does its exports map include it?): ${wu(l)}`,{cause:l})}let s;try{s=await t.loadJson(n)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${n}: ${wu(l)}`,{cause:l})}if(!X(s)||!T(s.name))throw Error(`Extension "${e}": ${Eo} 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 u=t.resolvePath(n,c),p;try{p=await t.loadJson(u)}catch(g){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${wu(g)}`,{cause:g})}o.push(new Ca(l,u,Qm(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 wu(e){return e instanceof Error?e.message:String(e)}var Eo="jx-extension.json";var rh=H(()=>{vu();Pe();vu()});import{readFileSync as gR}from"node:fs";import{dirname as yR,isAbsolute as bR,resolve as Su,sep as Ta}from"node:path";import{pathToFileURL as xR}from"node:url";import{createRequire as $R}from"node:module";async function Eu(e){let t=[e],r=`${Ta}src${Ta}`,n=`${Ta}dist${Ta}`;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(xR(i).href)}catch(o){s=o}throw s instanceof Error?s:Error(String(s))}function Pu(e,t){return $R(Su(e,"package.json")).resolve(t)}function ju(e){return{importModule:(t)=>Eu(t),loadJson:async(t)=>JSON.parse(gR(t,"utf8")),resolvePath:(t,r)=>{if(r.startsWith("./")||r.startsWith("../"))return Su(yR(t),r);if(bR(r))return r;return Pu(e,r)}}}async function Gn(e,t){return th(t?.extensions,ju(e),Su(e,"project.json"))}function Ia(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 jn=H(()=>{rh();Pe()});import{existsSync as vR,readFileSync as wR}from"node:fs";import{resolve as nh}from"node:path";function Kn(e){let t=nh(e,"project.json");if(!vR(t))throw Error(`project.json not found in ${e}`);let r;try{r=Dm(wR(t,"utf8"),t)}catch(o){throw Error(`Invalid project.json: ${ke(o)}`,{cause:o})}let n={...Po,...r,build:{...Po.build,...r.build},defaults:{...Po.defaults,...r.defaults},images:{...Po.images,...r.images},url:r.url??Po.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:nh(e)}}var Po;var jo=H(()=>{hr();Po={$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 ku,readFileSync as sh,writeFileSync as SR}from"node:fs";import{resolve as ih}from"node:path";async function oh(e,t={}){let{dryRun:r=!1,connection:n}=t,{config:s}=Kn(e),i=await Gn(e,s),o=X(s.connections)?s.connections:{},a=X(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,...PR(e),JX_PROJECT_ROOT:e},u=[],p=[];for(let b of l){let h=o[b],y=X(h)?{...h,$name:b}:{$name:b},v=String(y.provider??""),k=ER(i.connectors(),v);if(!k)throw Error(`Connection "${b}" names provider "${v}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let S={};for(let[j,R]of Object.entries(a))if(X(R)&&R.connection===b)S[j]=R;let E=await k.call("deploySchema",S,y,{dryRun:r,env:c});if(u.push({applied:E.applied??!r,connection:b,provider:v,statements:E.statements??[],tables:Object.keys(S),warnings:E.warnings??[]}),k.capabilities.bindings){let j=await k.call("bindings",y);if(X(j)&&Object.keys(j).length>0)p.push(j)}}let g=ih(e,"wrangler.jsonc"),m=!1;if(!r&&p.length>0&&ku(g)){let b=sh(g,"utf8"),{content:h,patched:y}=Fm(b,p);if(y&&h!==b)SR(g,h,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:ku(g)?g:null}}function ER(e,t){return e.find((r)=>r.connector?.provider===t)}function PR(e){let t=ih(e,".dev.vars");if(!ku(t))return{};let r=new Map;for(let n of sh(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 ah=H(()=>{Hm();jn();jo();Pe()});function Ms(e){return e.startsWith(Ma)}function lh(e){let t=e;if(Ms(t))t=t.slice(Ma.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${_u}${t}.js`}function ch(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",r=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${_u}${r}`:`${_u}${r}.${t}`}function uh(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Ja(e){let t=uh(e);return t.startsWith("/")?t:`/${t}`}function jR(e,t){return[...e].toSorted((r,n)=>n[t].length-r[t].length)}function Da(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 jR(e,"urlPrefix")){let i=Ja(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`${uh(s.dir)}/${a.join("/")}`}return null}function fh(e,t){let r=new Set;for(let n of t){let s=Ja(n.urlPrefix),i=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${kR}]+`,"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 Ru(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 Au(e){return e.map(({url:t,descriptor:r})=>r?`${t} ${r}`:t).join(", ")}function Js(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 He(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Yn(e,t){let r=new URL(t);if(!r.pathname.endsWith("/"))r.pathname+="/";return new URL(e.replace(/^\/+/,""),r).href}var Ma="npm:",_u="/assets/",kR;var gr=H(()=>{Pe();kR=String.raw`"'\s<>()\\`});function dh(e,t){return e.replaceAll(CR,(r,n,s)=>{let i=s.trim(),o=JR.exec(i),a=o?o[2]:i,l=He(t,a);if(l===a)return r;return`url(${n}${o?`${o[1]}${l}${o[1]}`:l}${n})`})}function DR(e,t,r,n,s){let i=r.toLowerCase();if(_R.has(i))return He(s,n);if(RR.has(i)){let o=Ru(n);return o.length===0?n:Au(o.map((a)=>({descriptor:a.descriptor,url:He(s,a.url)})))}if(i==="style")return dh(n,s);if(i==="content"&&e==="meta"&&MR.test(t))return He(s,n);return n}function ph(e,t){if(t==="")return e;let r=e.replaceAll(TR,(n,s,i,o)=>{let a=i.replaceAll(NR,(l,c)=>`"${He(t,c)}"`);return s+a+o});return r=r.replaceAll(IR,(n,s,i,o)=>s+dh(i,t)+o),r.replaceAll(AR,(n,s,i)=>{if(i==="")return n;let o=s.toLowerCase(),a=i.replaceAll(OR,(l,c,u,p,g)=>{let m=p===void 0?"'":'"',b=p??g??"",h=DR(o,i,c,b,t);return h===b?l:`${c}=${m}${h}${m}`});return a===i?n:`<${s}${a}>`})}var _R,RR,AR,OR,CR,NR,TR,IR,MR,JR;var mh=H(()=>{gr();_R=new Set(["href","src","poster","action","formaction","data"]),RR=new Set(["srcset","imagesrcset"]),AR=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,OR=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,CR=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,NR=/"(\/[^"/][^"]*)"/g,TR=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,IR=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,MR=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,JR=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var Ya=C(function(_z,Lh){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:Iu,getOwnPropertyDescriptor:LR,getOwnPropertyNames:FR}=Object,qR=Object.prototype.hasOwnProperty,HR=(e,t)=>{for(var r in t)Iu(e,r,{get:t[r],enumerable:!0})},VR=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of FR(t))if(!qR.call(e,s)&&s!==r)Iu(e,s,{get:()=>t[s],enumerable:!(n=LR(t,s))||n.enumerable})}return e},BR=(e)=>VR(Iu({},"__esModule",{value:!0}),e),Ao={};HR(Ao,{analyzeMetafile:()=>vA,analyzeMetafileSync:()=>PA,build:()=>yA,buildSync:()=>wA,context:()=>bA,default:()=>RA,formatMessages:()=>$A,formatMessagesSync:()=>EA,initialize:()=>kA,stop:()=>jA,transform:()=>xA,transformSync:()=>SA,version:()=>gA});Lh.exports=BR(Ao);function hh(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(Mr(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(Mr(i)),t(n[i])}},r=new Ph;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Cu(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function WR(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return Hs(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[Hs(r.read())]=t();return a}default:throw Error("Invalid packet")}},r=new Ph(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 Ph=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);Cu(this.buf,e,t)}write(e){let t=this._write(4+e.length);Cu(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 jh(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}},Mr,Hs,Ou;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;Mr=(r)=>e.encode(r),Hs=(r)=>t.decode(r),Ou='new TextEncoder().encode("")'}else if(typeof Buffer<"u")Mr=(e)=>Buffer.from(e),Hs=(e)=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},Ou='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(Mr("")instanceof Uint8Array))throw Error(`Invariant violation: "${Ou} instanceof Uint8Array" is incorrectly false
2
+ import{createRequire as QC}from"node:module";var zC=Object.create;var{getPrototypeOf:GC,defineProperty:vy,getOwnPropertyNames:KC}=Object;var Sy=Object.prototype.hasOwnProperty;function YC(e){return this[e]}var XC,ZC,gr=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var s=t?XC??=new WeakMap:ZC??=new WeakMap,i=s.get(e);if(i)return i}r=e!=null?zC(GC(e)):{};let o=t||!e||!e.__esModule||!Sy.call(e,"default")?vy(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of KC(e))if(!Sy.call(o,a))vy(o,a,{get:YC.bind(e,a),enumerable:!0})}if(n)s.set(e,o);return o};var N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var D=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var He=QC(import.meta.url);function O(e){return typeof e==="string"}function Nt(e){return typeof e==="number"}function Yt(e){return typeof e==="boolean"}function Vt(e){return typeof e==="function"}function V(e){return typeof e==="object"&&e!==null}function B(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function We(e){return B(e)&&typeof e.$ref==="string"}function Ir(e){return B(e)&&e.$prototype==="Function"}function Jr(e){return B(e)&&B(e.$expression)}function ji(e){return Jr(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function Os(e){return Ir(e)&&Array.isArray(e.body)}function wn(e){return B(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function os(e){return B(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Ey(e){return B(e)&&!e.$prototype&&!e.$expression&&"default"in e}function Cs(e){if(!B(e))return!1;for(let t of Object.keys(e))if(!Py.has(t))return!1;return!0}function dt(e){return B(e)&&e.$prototype==="Array"}function Rd(e){return(Array.isArray(e)?e:[e]).some((r)=>dt(r))}function jy(e){return B(e)&&e.$prototype==="Class"}function yr(e){return B(e)}function ye(e){return typeof e==="string"&&e.includes("${")}function ki(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(e)}function _i(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function as(e){if(!e)return[];return e.map((t)=>O(t)?t:t.name)}function eN(e){return typeof e==="string"}function vn(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!B(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 B(t.cases)&&Object.values(t.cases).every((r)=>O(r))&&typeof t.default==="string";return!1}function bo(e){if(eN(e))return[e];if(!vn(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 Py;var ve=D(()=>{Py=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"])});function _y(e){let t=[],r=[],n=null,s=0,i=()=>r.at(-1)?.path??"",o=()=>n===null?i():nN(i(),n),a=()=>{s+=1;let l="";while(s<e.length){let c=e[s];if(c==="\\"){let u=e[s+1]??"";if(u==="u")l+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else l+=tN.get(u)??u,s+=2;continue}if(c==='"')return s+=1,l;l+=c,s+=1}return l};while(s<e.length){let l=e[s];if(ky.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 u=a(),p=r.at(-1);if(p?.kind==="object"&&rN(e,s)===":"){if(p.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:p.path});p.keys.add(u),n=u}else n=null;continue}if(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let p=e.slice(u,s);if(!sN(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 rN(e,t){let r=t;while(r<e.length&&ky.has(e[r]))r+=1;return e[r]??""}function nN(e,t){return e===""?t:`${e}.${t}`}function sN(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Ay(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 ky,tN;var Ry=D(()=>{ky=new Set([" ","\t",`
3
+ `,"\r"]);tN=new Map([["b","\b"],["f","\f"],["n",`
4
+ `],["r","\r"],["t","\t"]])});function je(e){return e instanceof Error?e.message:String(e)}function Cy(e){if(O(e))return Oy.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>Cy(t));if(B(e))return pc(e);return e}function pc(e){let t={};for(let[r,n]of Object.entries(e))t[Oy.test(r)?r.normalize("NFC"):r]=Cy(n);return t}function Od(e,t,r){let n;try{n=JSON.parse(e)}catch(i){throw Error(`Failed to parse ${r} at ${t}: ${je(i)}`,{cause:i})}if(!B(n))throw Error(`Invalid ${r} at ${t}: expected a JSON object`);let s=_y(e);if(s.length>0){let i=s.map((o)=>Ay(o)).join("; ");throw Error(`Invalid ${r} at ${t}: ${i}`)}return pc(n)}function Ny(e,t){return Od(e,t,"Jx document")}function Cd(e,t){return Od(e,t,"project config")}function Ty(e,t){return Od(e,t,"class definition")}var Oy;var ir=D(()=>{ve();Ry();Oy=/[^\p{ASCII}]/u});import{spawn as iN}from"node:child_process";import{createRequire as oN}from"node:module";import{join as aN}from"node:path";function lN(e){try{return oN(aN(e,"package.json")).resolve("@jxsuite/server/convert")}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function Iy(e,t,r=iN,n=process){let s=lN(e),i=r("bun",[s,"--root",e,...t],{stdio:"inherit"});return i.on("error",(o)=>{console.error(o.code==="ENOENT"?"jx convert runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.":`Failed to start jx convert: ${o.message}`),n.exitCode=1}),i.on("exit",(o)=>{n.exitCode=o??0}),i}var Jy=()=>{};function cN(e){return JSON.parse(e)}function xo(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function uN(e){return xo(e)&&typeof e.binding==="string"}function fN(e){try{let t=cN(e);return xo(t)?t:void 0}catch{return}}function My(e,t){if(t.length===0)return{content:e??"",patched:!1};let r={};if(e){let n=fN(e);if(n===void 0)return{content:e,patched:!1};r=n}for(let n of t)Dy(r,n);return{content:`${JSON.stringify(r,null,"\t")}
5
+ `,patched:!0}}function Dy(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]=dN(Array.isArray(s)?s:[],n);continue}if(xo(n)){if(xo(s))Dy(s,n);else if(s===void 0)e[r]=structuredClone(n);continue}if(s===void 0)e[r]=n}}function dN(e,t){let r=[...e];for(let n of t){if(!uN(n)){if(!r.some((a)=>JSON.stringify(a)===JSON.stringify(n)))r.push(structuredClone(n));continue}let s=r.findIndex((o)=>xo(o)&&o.binding===n.binding),i=r[s];if(xo(i))r[s]={...i,...n};else r.push(structuredClone(n))}return r}var Ly=()=>{};function Wy(e){if(!O(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(!Fy.test(s)||!Fy.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("."),u=c===-1?null:l.slice(0,c),p=u!==null&&pN.has(u)?u: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(),w=b.slice(g+1).trim();if(y==="")return null;if(w.startsWith('"')&&w.endsWith('"')&&w.length>=2)w=w.slice(1,-1);m[y]=w}return{parameters:m,subtype:h,suffix:a,tree:p,type:s}}function Hy(e){if(!O(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(Wy(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function By(e){let t=Wy(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 Fy,pN,qy="text/markdown; variant=GFM",Vy="application/yaml",Uy;var Nd=D(()=>{ve();Fy=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,pN=new Set(["vnd","prs","x"]);Uy={".jxn":"text/plain; charset=utf-8",".markdown":`${qy}; charset=utf-8`,".md":`${qy}; charset=utf-8`,".yaml":`${Vy}; charset=utf-8`,".yml":`${Vy}; charset=utf-8`}});class zy{index;text;constructor(e){this.text=e,this.index=e.codePointAt(0)===65279?1:0}get done(){return this.index>=this.text.length}startsWith(e){return this.text.startsWith(e,this.index)}skipLine(){let e=this.text.indexOf(`
6
+ `,this.index);this.index=e===-1?this.text.length:e}skipBlock(){let e=1;this.index+=2;while(!this.done&&e>0)if(this.startsWith("/*"))e+=1,this.index+=2;else if(this.startsWith("*/"))e-=1,this.index+=2;else this.index+=1}skipTrivia(){for(;;){while(!this.done&&/[\s;]/u.test(this.text.charAt(this.index)))this.index+=1;if(this.startsWith("//"))this.skipLine();else if(this.startsWith("/*"))this.skipBlock();else if(this.startsWith("/-"))this.index+=2,this.skipNode();else return}}skipString(){let e=0,t=this.index;while(this.text.charAt(t)==="#")e+=1,t+=1;let r=this.text.startsWith('"""',t),n=r?'"""':'"',s=n+"#".repeat(e);t+=n.length;while(t<this.text.length)if(e===0&&this.text.charAt(t)==="\\")t+=2;else if(this.text.startsWith(s,t))return this.index=t+s.length,!0;else if(!r&&this.text.charAt(t)===`
7
+ `)return!1;else t+=1;return!1}skipNode(){let e=0;while(!this.done){let t=this.text.charAt(this.index);if(t==='"'||t==="#"&&/^#+"/u.test(this.text.slice(this.index,this.index+16))){if(!this.skipString())return!1}else if(this.startsWith("//"))this.skipLine();else if(this.startsWith("/*"))this.skipBlock();else if(t==="{")e+=1,this.index+=1;else if(t==="}"){if(e===0)return!1;e-=1,this.index+=1}else if((t===`
8
+ `||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function Td(e){if(mN.test(e))return"unreadable";let t=new zy(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let r=e.indexOf(")",t.index);if(r===-1)return"unreadable";t.index=r+1}else{let[r]=hN.exec(e.slice(t.index,t.index+256))??[];if(!r)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!r.startsWith("$"))return r==="project"?"project":"document";if(t.index+=r.length,!t.skipNode())return"unreadable"}}}var mN,hN;var Id=D(()=>{mN=/\0/u,hN=/^[^\s\\/(){};[\]"#=]+/u});function za(e){switch(e){case 9:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:return!0}return!1}function Js(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Ec(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function rt(e){return!isNaN(e)&&!za(e)&&!Js(e)&&e!==61&&e!==92&&e!==47&&e!==40&&e!==41&&e!==123&&e!==125&&e!==59&&e!==91&&e!==93&&e!==34&&e!==35&&!0}function Gy(e){return e>=65&&e<91||e>=97&&e<123||!1}function Jd(e){return e>=48&&e<64||e>=65&&e<71||e>=97&&e<103||!1}function Md(e){return Jd(e)||e===95}function cs(e){return e>=48&&e<58}function Ci(e){return cs(e)||e===95}function Dd(e){return e>=48&&e<56}function Ky(e){return Dd(e)||e===95}function Ld(e){return e===48||e===49}function Yy(e){return Ld(e)||e===95}function Xy(e){return e===45||e===43}var Ns=1,$o=2,Ai=3,mc=4,hc=5,Ba=6,gc=7,yc=8,Ua=9,Ts=10,Xt=11,wo=12,vo=13,bc=14,ls=15,xc=16,$c=17,Ri=18,Is=19,wc=20,vc=21,Sc=22,So=23,Oi=24,Sn=28;function*yN(e){for(let t of(gN??=new Intl.Segmenter("en")).segment(e))yield t.segment}function bN(e){return e[Symbol.iterator]()}function Zy(e,{flags:t,graphemeLocations:r=!1}){let n=r?yN(e):bN(e),s=n.next();return{text:e,graphemeLocations:r,line:1,column:1,offset:0,length:e.length,iterator:n,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*Qy(e){if(Ie(e,65279))e.column=1,yield ke(e,$o);if(Ec(e.current))throw En(e,`Invalid character \\u${e.current.toString(16)}`)}function wt(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),r=e.current=t.done?NaN:t.value.codePointAt(0);if(Ec(r))if(r>=55296&&r<=57343||r>1114111)Ga(e,`Invalid character \\u${r.toString(16)}`);else Ga(e,`Invalid character \\u${r.toString(16)}, this character is not allowed but can be included in strings as \\u{${r.toString(16)}}`);return r}function cn(e,t){if(t(e.current)){let r=e.current;return wt(e),r}}function Ie(e,t){if(e.current===t)return wt(e),t}function Eo(e){if(!Js(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return wt(e),e.column=1,e.line++,!0}function Fd(e,t){while(e.current===t)wt(e)}function Ue(e,t){while(t(e.current))wt(e)}function ke(e,t,r){let{line:n,column:s,offset:i}=e,o={line:n,column:s,offset:i},a=e.start;e.start=o;let l=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(a.offset,o.offset),start:a,end:o,errors:l};if(r){if(!c.errors)c.errors=[];c.errors.push(new Me(r,{token:c}))}return c}function En(e,t){if(t instanceof Me)return t;let{line:r,column:n,offset:s}=e,i={line:r,column:n,offset:s},o;if(s<e.length)if(Js(e.current))o={line:r+1,column:1,offset:s+1};else o={line:r,column:n+1,offset:s+1};return new Me(`${t}`,{start:i,end:o})}function Ga(e,t){(e.errorsInToken??=[]).push(En(e,t))}var gN;var eb=D(()=>{Ni()});function Ti(e){return(t)=>(wt(t),ke(t,e))}function Ka(e){return Ue(e,za),ke(e,Ri)}function Ii(e){return Eo(e),ke(e,Is)}function xN(e){wt(e);let t=!1,r=!1;if(Ie(e,34)){if(!Ie(e,34))return ke(e,Ua);if(r=!0,e.current===34)throw En(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Ie(e,34)){if(Ie(e,34)&&Ie(e,34))t=!0}else Ie(e,92),Eo(e)||wt(e)}else while(!t&&e.offset<e.length)if(Ie(e,34))t=!0;else Ie(e,92),Eo(e)||wt(e);if(!t)throw En(e,"Unexpected EOF inside string");return ke(e,r?So:Ua)}function tb(e){if(wt(e),e.current===35||e.current===34){let t=1;while(Ie(e,35))t++;if(!Ie(e,34))throw En(e,`Expected a quote after ${"#".repeat(t)}`);let r=!1;if(Ie(e,34))if(Ie(e,34)){if(e.current===34)throw En(e,"Multiline strings must start with exactly three quotes");r=!0}else{let n=0;while(Ie(e,35))n++;if(n===t)return ke(e,Ts)}while(!0){if(e.offset>=e.length)throw En(e,"Unexpected EOF while parsing raw string");if(Ie(e,34)){if(r){if(!Ie(e,34)||!Ie(e,34))continue}let n=0;while(n<t&&Ie(e,35))n++;if(n===t)return ke(e,r?Oi:Ts)}else Eo(e)||wt(e)}}else{let t;if(e.current<255){let r=Ae[e.current];t=r(e)}else if(za(e.current))t=Ka(e);else if(Js(e.current))t=Ii(e);else t=Vd(e);if(t.type!==Xt)(t.errors??=[]).push(new Me("Expected a valid identifier",{token:t}));return t.type=vo,t}}function $N(e){if(wt(e),cn(e,cs))return Ue(e,rt),ke(e,Xt,"Invalid identifier, identifiers that start with a sign and a dot must be quoted if the next character is a digit to prevent confusion with decimal numbers");return Ue(e,rt),ke(e,Xt)}function wN(e){if(wt(e),Ie(e,45))return ke(e,Ai);else if(Ie(e,47)){while(e.offset<e.length&&!Js(e.current))wt(e);return ke(e,vc)}else if(Ie(e,42)){let t=1;while(e.offset<e.length)if(Ie(e,42)){if(Ie(e,47)){if(t--,t===0)return ke(e,Sc)}}else if(Ie(e,47)){if(Ie(e,42))t++}else Eo(e)||wt(e);throw En(e,"Unexpected EOF in multiline comment")}else jc(e)}function rb(e){return wt(e),vN(e)}function vN(e){if(cs(e.current))return un(e);else if(Ie(e,46)){if(cn(e,cs))return Ue(e,rt),ke(e,Xt,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Ue(e,rt),ke(e,Xt)}else return Ue(e,rt),ke(e,Xt)}function qd(e,t,r,n){return(s)=>{let i=wt(s);if(cn(s,r))return Ue(s,n),ke(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Ie(s,95)){if(Ue(s,n),!rt(s.current))return ke(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(i)} cannot be an underscore`)}return Ue(s,rt),ke(s,Xt,`Invalid ${e} number`)}else if(Ie(s,95)){if(Fd(s,95),r(s.current)){if(Ue(s,n),!rt(s.current))return ke(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(i)} cannot be an underscore`)}return Ue(s,rt),ke(s,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(cs(s.current))return ke(s,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Ue(s,rt),ke(s,Sn)}}function un(e){if(Ie(e,48)){let t=Pc[e.current];if(t)return t(e)}if(Ue(e,Ci),Ie(e,46)){if(!cn(e,cs))if(e.current===95)Ga(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else Ga(e,"Invalid decimal number, a decimal point must be followed by a digit");Ue(e,Ci)}if(Ie(e,101)||Ie(e,69))if(cn(e,Xy),cn(e,cs)){if(Ue(e,Ci),rt(e.current))return Ue(e,rt),ke(e,Xt,"Invalid number with suffix, a number with an exponent cannot have a suffix");return ke(e,ls)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Ue(e,Ci),ke(e,ls,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Ue(e,rt),ke(e,ls,"Invalid decimal number, missing a number after the exponent");else if(Ie(e,95)){if(Fd(e,95),cs(e.current)){if(Ue(e,Ci),!rt(e.current))return ke(e,ls,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Ue(e,rt),ke(e,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Ue(e,rt),ke(e,Sn);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){wt(e);let t=null;if(cn(e,Md))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Ue(e,rt),ke(e,Sn,t)}else if(cn(e,Gy)){let t=null;if(cn(e,Ci))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Ue(e,rt),ke(e,Sn,t)}else if(Ie(e,44))return Ue(e,rt),ke(e,Sn,"Invalid number with suffix, a suffix cannot start with a comma");else if(Ie(e,46))return Ue(e,rt),ke(e,Sn,"Invalid number with suffix, a suffix cannot start with a dot");else if(cn(e,rt))return Ue(e,rt),ke(e,Sn);else return ke(e,ls);else return ke(e,ls)}function SN(e){if(wt(e),e.current!=35)return Ue(e,rt),ke(e,Xt);let t=tb(e);t.start.offset--,t.start.column--;let r;switch(t.type){case Ts:case Oi:r='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:r="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Me(r,{token:t})),t}function Vd(e){return wt(e),Ue(e,rt),ke(e,Xt)}function jc(e){throw En(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Ya(e,t){let r=Zy(e,t);yield*Qy(r);while(!r.currentIter.done){if(r.current<255){let n=Ae[r.current];yield n(r);continue}if(za(r.current)){yield Ka(r);continue}if(Js(r.current)){yield Ii(r);continue}yield Vd(r)}yield ke(r,Ns)}var Pc,Ae;var nb=D(()=>{Ni();eb();Pc=Array(256).fill(null);Pc[98]=qd("binary",$c,Ld,Yy);Pc[111]=qd("octal",xc,Dd,Ky);Pc[120]=qd("hexadecimal",bc,Jd,Md);Ae=Array(255);Ae.fill(Vd);for(let e=0;e<32;e++)Ae[e]=jc;Ae[9]=Ka;Ae[10]=Ii;Ae[11]=Ii;Ae[12]=Ii;Ae[13]=Ii;Ae[32]=Ka;Ae[34]=xN;Ae[35]=tb;Ae[40]=Ti(mc);Ae[41]=Ti(Ba);Ae[43]=rb;Ae[45]=rb;Ae[46]=$N;Ae[47]=wN;Ae[48]=un;Ae[49]=un;Ae[50]=un;Ae[51]=un;Ae[52]=un;Ae[53]=un;Ae[54]=un;Ae[55]=un;Ae[56]=un;Ae[57]=un;Ae[59]=Ti(yc);Ae[61]=Ti(wo);Ae[91]=jc;Ae[92]=Ti(wc);Ae[93]=jc;Ae[114]=SN;Ae[123]=Ti(hc);Ae[125]=Ti(gc);Ae[133]=Ii;Ae[160]=Ka});var Po=D(()=>{nb()});var Me;var Ni=D(()=>{Po();Me=class Me extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:r=t?.start,end:n=t?.end,errors:s,...i}={}){if(t?.type===Ns)e=`${e} at end of input`;else if(r)e=`${e} at ${r.line}:${r.column}`;super(e,i);this.token=t,this.start=r,this.end=n,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function jo(e){return sb.get(e)}function ib(e,{start:t},{end:r}){sb.set(e,{start:t,end:r})}var sb;var Wd=D(()=>{sb=new WeakMap});function ob({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class fn{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new fn(this.name);return e.representation=this.representation,e}}class Pn{type="tag";static type="tag";representation;leading;trailing;suffix;constructor(e){this.name,Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!1,value:e})}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Pn(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class dn{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new dn(this.value);return e.tag=this.tag?.clone()??null,e.betweenTagAndValue=this.betweenTagAndValue,e.representation=this.representation,e}getValue(){return this.value}setValue(e){if(e!==this.value)this.value=e,this.representation=void 0}getTag(){return this.tag?this.tag.name:null}setTag(e){if(e==null)this.tag=null;else if(this.tag!=null)this.tag.setName(e);else this.tag=new Pn(e)}}var Hd=()=>{};class Mr{static createArgument(e){return new Mr(new dn(e),null)}static createProperty(e,t){return new Mr(new dn(t),new fn(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Mr(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new fn(e):null}getValue(){return this.value.value}setValue(e){this.value=new dn(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Bd=D(()=>{Hd()});function*ko(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function Ud(e){return e.children??(e.children=new Ms)}class _o{static create(e){return new _o(new fn(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],r=null){this.name=e,this.entries=t,this.children=r}clone({shallow:e=!1}={}){let t=new _o(this.name.clone(),e?[]:this.entries.map((r)=>r.clone()),this.children?.clone({shallow:e}));if(this.tag)t.tag=this.tag.clone();return t.leading=this.leading,t.betweenTagAndName=this.betweenTagAndName,t.beforeChildren=this.beforeChildren,t.trailing=this.trailing,t}getTag(){return this.tag?this.tag.name:null}setTag(e){this.tag=e!=null?new Pn(e):null}getName(){return this.name.name}setName(e){this.name.setName(e)}hasArguments(){return this.entries.some((e)=>e.isArgument())}getArguments(){return this.getArgumentEntries().map((e)=>e.getValue())}getArgumentEntries(){return this.entries.filter((e)=>e.isArgument())}hasArgument(e){return this.getArgumentEntry(e)!=null}getArgument(e){return this.getArgumentEntry(e)?.getValue()}getArgumentEntry(e){for(let t of this.entries){if(!t.isArgument())continue;if(e===0)return t;e--}}addArgument(e,t,r){let n=Mr.createArgument(e);if(n.value.setTag(t),r!=null)for(let[s,i]of this.entries.entries()){if(!i.isArgument())continue;if(r===0){this.entries.splice(s,0,i);return}r--}this.entries.push(n)}removeArgument(e){for(let[t,r]of this.entries.entries()){if(!r.isArgument())continue;if(e===0){this.entries.splice(t,1);return}e--}}hasProperties(){return this.entries.some((e)=>e.isProperty())}getProperties(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e.getValue()]))}getPropertyEntries(){return this.entries.filter((e)=>e.isProperty())}getPropertyEntryMap(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e]))}hasProperty(e){return this.getPropertyEntry(e)!=null}getProperty(e){return this.getPropertyEntry(e)?.getValue()}getPropertyEntry(e){for(let t of ko(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,r){for(let s of ko(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(r);return}let n=Mr.createProperty(e,t);n.value.setTag(r),this.entries.push(n)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){Ud(this).appendNode(e)}insertNodeBefore(e,t){Ud(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){Ud(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var ab=D(()=>{zd();Bd()});function*Ao(e){if(e instanceof Ms)yield*e.nodes;else yield e}class Ms{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new Ms(e?[]:this.nodes.map((r)=>r.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...Ao(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...Ao(e));return}let r=this.nodes.indexOf(t);if(r===-1)throw Error("Reference node is not in document");this.nodes.splice(r,0,...Ao(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...Ao(e));return}let r=this.nodes.indexOf(t);if(r===-1)throw Error("Reference node is not in document");this.nodes.splice(r+1,0,...Ao(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let r=this.nodes.indexOf(e);if(r===-1)throw Error("Node to replace is not in document");this.nodes.splice(r,1,...Ao(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of ko(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let r of ko(this.nodes)){if(r.name.name!==e)continue;let n=r.getArguments();if(n.length!==1||t!==void 0&&n[0]!==t)continue;return r}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var zd=()=>{};var lb=D(()=>{zd();Bd();ab();Hd()});function cb(e,t,r){let n;while(n=PN.exec(t)){let s=Xa(r,t,n.index);e.push(new Me("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:r,start:s,end:{offset:s.offset+n[0].length,line:s.line+1,column:1}}))}return t}function ub(e,t,r){if(!Ro.test(t))return e.push(new Me("Raw strings with three quotes must be multiline strings",{token:r})),t;if(!Ro.test(t[0]))return e.push(new Me("Multi-line strings must start with a newline",{token:r})),t;let n=_N.exec(t)?.[1];if(n==null)return e.push(new Me("The final line in a multiline string may only contain whitespace",{token:r})),t;return t.replace(RN,(s,i,o,a,l)=>{if(!a)return`
9
+ `;if(!o.startsWith(n)){let c=Xa(r,t,l+i.length);return e.push(new Me("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:r,start:c,end:{offset:c.offset+n.length,line:c.line,column:c.column+n.length}})),`
10
+ `}return`
11
+ `+o.slice(n.length)+a}).slice(1,-1)}function fb(e,t,r){let n;while(n=kN.exec(t)){let s=Xa(r,t,n.indices[1][0]);e.push(new Me("Strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:r,start:s,end:{offset:s.offset+n[1].length,line:s.line+1,column:1}}))}return t.replace(CN,(s,i,o,a,l)=>pb(e,t,r,s,i,o,a,l))}function db(e,t,r){if(!jN.test(t))return e.push(new Me("Strings with three quotes must be multiline strings",{token:r})),t;if(!Ro.test(t[0]))return e.push(new Me("Multi-line strings must start with a newline",{token:r})),t;let n=AN.exec(t)?.[1];if(n==null){let s=ON.exec(t),i=s?Xa(r,t,s.index):void 0,o="The final line in a multiline string may only contain whitespace";if(s?.[0][0]==="\\")o+=" after removing escaped whitespace";return e.push(new Me(o,{token:r,start:i,end:i&&{offset:i.offset,line:i.line,column:i.column+1}})),t}return t.replace(NN,(s,i,o,a,l,c,u)=>{if(!i)return pb(e,t,r,s,a,l,c,u);let p=t[u+i.length+(o?o.length:0)];if(Ro.test(p))return`
12
+ `;if(!o.startsWith(n)){let h=Xa(r,t,u+i.length);return e.push(new Me("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:r,start:h,end:{offset:h.offset+n.length,line:h.line,column:h.column+n.length}})),`
13
+ `}return`
14
+ `+o.slice(n.length)}).slice(1,-1)}function pb(e,t,r,n,s,i,o,a){if(o)return"";if(i){let l=r.text.startsWith('"""'),c=t.slice(0,a).split(Ro),u={offset:r.start.offset+(l?3:1)+a,line:r.start.line+(c.length-1),column:c.length===1?r.start.column+(l?3:1)+a:c.at(-1).length},p={offset:u.offset+n.length,line:u.line,column:u.column+n.length};if(!i.startsWith("{"))e.push(new Me(String.raw`Invalid unicode escape "\u${i}", did you forget to use {}? "\u{${i}}"`,{token:r,start:u,end:p}));else e.push(new Me(String.raw`Invalid unicode escape "\u${i.endsWith("}")?i:`${i}...`}"`,{token:r,start:u,end:p}));return""}else if(s){let l=parseInt(s,16);if(l>=55296&&l<=57343)e.push(new Me(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:r}));return String.fromCodePoint(l)}else{let l=EN.get(n);if(l==null)return e.push(new Me(n.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${n}"`,{token:r})),"";return l}}function Xa(e,t,r){let n=1;switch(e.type){case So:n=3;break;case Ts:n=e.text.indexOf('"')+1;break;case Oi:n=e.text.indexOf('"')+3;break}let s=t.slice(0,r).split(Ro);return{offset:e.start.offset+n+r,line:e.start.line+(s.length-1),column:s.length===1?e.start.column+n+r:1+s[s.length-1].length}}var eY,EN,Ro,PN,jN,kN,_N,AN,RN,ON,CN,NN;var mb=D(()=>{Ni();Po();eY=new Map([...Array.from({length:32},(e,t)=>[t,`\\u{${t.toString(16).padStart(2,"0")}}`]),[127,"\\u{7f}"],[8206,"\\u{200e}"],[8207,"\\u{200f}"],[8234,"\\u{202a}"],[8235,"\\u{202b}"],[8236,"\\u{202c}"],[8237,"\\u{202d}"],[8238,"\\u{202e}"],[8294,"\\u{2066}"],[8295,"\\u{2067}"],[8296,"\\u{2068}"],[8297,"\\u{2069}"],[65279,"\\u{feff}"],[34,"\\\""],[92,"\\\\"],[10,"\\n"],[11,"\\u{0b}"],[12,"\\f"],[13,"\\r"],[133,"\\u{85}"],[8232,"\\u{2028}"],[8233,"\\u{2029}"],[8,"\\b"],[9,"\\t"]]),EN=new Map([["\\n",`
15
+ `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),Ro=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,PN=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,jN=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/s,kN=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/dgs;_N=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,AN=/(?:^|[^\\\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])(?:\\\\)*[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(?:\\[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)*$/,RN=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]?)/g,ON=/([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*$/;CN=/\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g;NN=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)|\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g});function us(e){if(!e.current.done)e.lastToken=e.current.value;e.current=e.tokens.next();let t=!e.current.done&&e.current.value.errors;if(t)e.errors.push(...t)}function ze(e,t){if(!e.current.done&&e.current.value.type===t){let r=e.current.value;return us(e),r}}function Re(e,t){let r="current"in e?e.current.value??e.lastToken:e;return new Me(t,{token:r})}function br(e,t,r,n=r){if(e.storeLocations)ib(t,r,n)}function Zt(e="",t="",r=""){return e+t+r||void 0}function Ac(e,t,{storeLocations:r=!1,flags:n}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},i={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:r,lastToken:s,errors:[],flags:n};return us(i),i}function Kd(e,t){if(!t&&!e.current.done&&e.current.value.type!==Ns)t=Re(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let r=e.errors??[];if(t!=null)if(t instanceof Me)if(t.errors)r.push(...t.errors);else r.push(t);else r.push(new Me(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(r.length)if(r.length===1)throw r[0];else throw new Me("Encountered multiple errors",{errors:r})}function kc(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function hb(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Yd(e){let{value:t}=e.current,r,n,s,i,o,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")o=t.text[0];switch(t?.type){case Sn:{if(!e.flags.experimentalSuffixedNumbers)throw new Me("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=o?t.text.slice(1):t.text,p=u.search(/[^0-9._]/);if(n=(o??"")+u.slice(0,p),r=Number.parseFloat(n.replaceAll("_","")),i=s=u.slice(p),hb(s))e.errors.push(Re(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case $c:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),2);break;case xc:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),8);break;case ls:a=!0,r=Number.parseFloat(t.text.replaceAll("_",""));break;case bc:a=!0,r=(o==="-"?-1:1)*Number.parseInt(t.text.slice(o?3:2).replaceAll("_",""),16);break;case vo:if(r=kc(t.text),r===void 0)if(r=null,kc(t.text.toLowerCase())!==void 0)e.errors.push(Re(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(Re(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(Re(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}us(e);let l=e.flags.experimentalSuffixedNumbers&&ze(e,vo);if(l)if(a){if(i=l.text,kc(i)!==void 0)e.errors.push(Re(l,`Invalid number suffix ${i}, did you forget a space between the number and the keyword?`));s=i.slice(1)}else if(s)e.errors.push(Re(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof r==="number")e.errors.push(Re(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(Re(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new dn(r);if(c.representation=n??t.text,br(e,c,t),s){let u=new Pn(s);u.representation=i,u.suffix=!0,br(e,u,e.lastToken),c.tag=u}return c}function Za(e){if(e.current.done)return;let{value:t}=e.current,r;switch(t.type){case Xt:if(us(e),hb(t.text))e.errors.push(Re(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));r=[t.text,t.text,t];break;case Ua:us(e),r=[fb(e.errors,t.text.slice(1,-1),t),t.text,t];break;case So:us(e),r=[db(e.errors,t.text.slice(3,-3),t),t.text,t];break;case Ts:{us(e);let n=t.text,s=n.indexOf('"');r=[cb(e.errors,n.slice(s+1,-(s+1)),t),n,t];break}case Oi:{us(e);let n=t.text,s=n.indexOf('"');r=[ub(e.errors,n.slice(s+3,-(s+3)),t),n,t];break}default:return}if(ze(e,vo))e.errors.push(Re(e.lastToken,kc(e.lastToken.text)===void 0?"Unexpected hashed suffix on a string, you can only place suffixes on numbers":"Unexpected keyword, did you forget to add whitespace?"));return r}function Xd(e){let t=Za(e);if(!t)return;let r=new fn(t[0]);return r.representation=t[1],br(e,r,t[2],e.lastToken),r}function _c(e){let t=Yd(e);if(t)return t;let r=Za(e);if(!r)return;let n=new dn(r[0]);return n.representation=r[1],br(e,n,r[2],e.lastToken),n}function Qa(e){let t=ze(e,vc);if(!t)return;let{value:r}=e.current;return us(e),t.text+(r?.text??"")}function Rc(e){return ze(e,Sc)?.text}function Zd(e){return ze(e,Ri)??Rc(e)}function Oc(e){let t=ze(e,wc);if(!t)return;while(Zd(e));if(!Qa(e)&&!ze(e,Is)&&!ze(e,Ns))e.errors.push(Re(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function Ds(e){let t=e.lastToken.end;while(ze(e,Is)?.text??Qa(e)??Zd(e)??Oc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function _t(e){let t=e.lastToken.end;while(Zd(e)??Oc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Gd(e){let t=ze(e,mc);if(!t)return;let r=_t(e),n=Za(e);if(!n&&e.current.value){let a=e.current.value;if(Ds(e))e.errors.push(Re(a,"This type of whitespace is not allowed inside a tag"));n=Za(e)}if(!n){if(Yd(e))e.errors.push(Re(e,"Invalid tag, did you forget to quote a string?")),n=["error","error"]}if(!n)throw Re(e,"Invalid tag, did you forget to quote a string?");let s=_t(e),i=ze(e,Ba);if(!i&&e.current.value){let a=e.current.value;if(Ds(e))e.errors.push(Re(a,"This type of whitespace is not allowed inside a tag"));i=ze(e,Ba)}if(!i)throw Re(e,"Invalid tag, did you forget to quote a string?");let o=new Pn(n[0]);return o.representation=n[1],o.leading=r,o.trailing=s,br(e,o,t,e.lastToken),o}function Cc(e){return Qa(e)??ze(e,Is)?.text??ze(e,yc)?.text??ze(e,Ns)?.text}function Qd(e){if(!ze(e,hc))return;let t=xb(e);if(!ze(e,gc))throw Re(e,"Invalid node children");return t}function Oo(e){let t=e.current.value;{let p=Gd(e);if(p){let h=_t(e),m=_c(e);if(!m)throw Re(e,"Invalid argument");if(m.tag)e.errors.push(Re(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=p,m.betweenTagAndValue=h;let b=new Mr(m,null);br(e,m,t,e.lastToken),br(e,b,t,e.lastToken);let g=_t(e);if(ze(e,wo))e.errors.push(Re(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),g=Zt(g,_t(e))||" ";return[b,g]}}{let p=Yd(e);if(p){let h=new Mr(p,null);br(e,h,t,e.lastToken);let m=_t(e);if(ze(e,wo))e.errors.push(Re(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Zt(m,_t(e))||" ";return[h,m]}}let r=Za(e);if(!r)return;let n=_t(e),s=ze(e,wo);if(!s){let p=new dn(r[0]);p.representation=r[1],br(e,p,r[2]);let h=new Mr(p,null);return br(e,h,t,e.lastToken),[h,n]}let i=new fn(r[0]);i.representation=r[1],br(e,i,r[2]);let o=_t(e),a=Gd(e),l=a&&_t(e),c=_c(e);if(!c)throw Re(e,"Expected a value");if(a){if(c.tag)e.errors.push(Re(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new Mr(c,i);return br(e,u,t,e.lastToken),u.equals=Zt(n,s.text,o),[u,void 0]}function gb(e){let t=_t(e)??"",r;while(r=Ji(e)){let o=e.lastToken.end,a=Oo(e);if(!a)throw Re(e,"Expected a property or argument");if(!(a[1]??_t(e)))throw Re(e,"Expected space after slashdashed property or argument");t=t+r+e.text.slice(o.offset,e.lastToken.end.offset)}let n=Oo(e);if(!n)return;let s=n[1]??_t(e)??"";while(r=Ji(e)){let o=e.lastToken.end,a=Oo(e);if(!a)throw Re(e,"Expected a property or argument");if(!(a[1]??_t(e)))break;s=s+r+e.text.slice(o.offset,e.lastToken.end.offset)}let i=n[0];return i.leading=t,i.trailing=s,i}function Ji(e){let t=ze(e,Ai)?.text;if(!t)return;return Zt(t,Ds(e))}function Nc(e){let t=e.current.value,r=Gd(e),n=r&&_t(e),s=Xd(e);if(!s)if(r)throw Re(e,"Couldn't find node name");else return;let i=_t(e),o=i!=null,a=Ji(e),l=[];while(o||a){let h=e.lastToken.end,m=Oo(e);if(!m)break;if(a)o=(m[1]||_t(e))!=null,i=Zt(i,a,e.text.slice(h.offset,e.lastToken.end.offset)),a=Ji(e);else{let b=m[0];b.leading=i,l.push(b),i=m[1]||_t(e),o=i!=null,a=Ji(e)}}let c,u;while(!0){a??=Ji(e);let h=e.lastToken.end,m=Qd(e);if(!m){if(a)throw Re(e,"Unexpected slashdash");break}if(a)i=Zt(i,a,e.text.slice(h.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(Re(e,"A node can only have one children block"));c=m,u=i??"",i=void 0}i=Zt(i,_t(e))}let p=new _o(s,l,c);return p.tag=r??null,p.betweenTagAndName=n,p.beforeChildren=u,p.trailing=i??"",br(e,p,t,e.lastToken),p}function yb(e){let t=Ds(e),r=Nc(e);if(!r)return;let n=Zt(Cc(e),Ds(e));return r.leading=Zt(t,r.leading),r.trailing=Zt(r.trailing,n),r}function bb(e){let t=ze(e,$o)?.text,r=xb(e);if(!t)return r;if(r.nodes[0])r.nodes[0].leading=Zt(t,r.nodes[0].leading);else r.trailing=Zt(t,r.trailing);return r}function xb(e){let t=e.current.value,r=[],n=!0,s=Ds(e);while(n){let o=e.lastToken.end,a=Ji(e),l=Nc(e);if(!l){if(a)throw Re(e,"Unexpected slashdash");break}let c=_t(e),u=Cc(e);if(a)s=Zt(s,e.text.slice(o.offset,e.lastToken.end.offset),Ds(e));else l.trailing=Zt(l.trailing,c,u)??"",r.push(l),l.leading=s??"",s=Ds(e);n=u!=null}let i=new Ms(r);return br(e,i,t,e.lastToken),i.trailing=s??"",i}var ep=D(()=>{Ni();Wd();lb();mb();Po()});function $b(e,t){let r=[],n;while(n=t(e))r.push(n);return r.length>0?r:void 0}function TN(e){{let t=ze(e,$o);if(t)return{type:"bom",text:t.text}}{let t=ze(e,Is);if(t)return{type:"newline",text:t.text}}{let t=ze(e,Ri);if(t)return{type:"space",text:t.text}}{let t=Qa(e);if(t)return{type:"singleline",text:t}}{let t=Rc(e);if(t)return{type:"multiline",text:t}}return}function Tc(e){{let t=Oc(e);if(t)return{type:"line-escape",text:t}}{let t=ze(e,Ri);if(t)return{type:"space",text:t.text}}{let t=Rc(e);if(t)return{type:"multiline",text:t}}return}function wb(e){let t=[];while(!0){{let r=TN(e);if(r){t.push(r);continue}}if(ze(e,Ai)?.text){let n,s=$b(e,Tc)??[],i=Nc(e);if(!i)throw Re(e,"Invalid slashdash, expected a commented node");i.trailing=Zt(i.trailing,$b(e,Tc)?.map((o)=>o.text).join(""),Cc(e)),t.push({type:"slashdash",preface:s,value:i});continue}break}return t}function IN(e){let t=ze(e,Ai);if(t==null)return;let r,n=[];while(r=Tc(e))n.push(r);let s,i,o="";if(i=Oo(e)){if(s=i[0],i[1])o=i[1]}else if(i=Qd(e))s=i;else throw Re(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:n,value:s},o]}function tp(e){let t=[];while(!0){let r=Tc(e);if(!r)break;let n=!0;t.push(r);while(n){let s=IN(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...tp(Ac(s[1][0],Ya(s[1][0],{flags:e.flags}),{flags:e.flags})));n=!!s[1][0]}}return t}var vb=D(()=>{Po();ep()});function Ls(e,{as:t="document",flags:r,...n}={}){let s=JN[t];if(s==null)throw TypeError(`Invalid "as" target passed: ${JSON.stringify(t)}`);if(typeof e!=="string"){if(typeof TextDecoder!=="function")throw TypeError("Uint8Array input is only supported on platforms that include TextDecoder");e=new TextDecoder("utf-8",{fatal:!0}).decode(e)}let i=ob(r),o=Ya(e,{...n,flags:i}),a=Ac(e,o,{...n,flags:i}),l;try{l=s(a)}catch(c){Kd(a,c)}if(Kd(a),!l)throw new Me(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var JN;var Sb=D(()=>{Ni();Po();ep();vb();JN={value:_c,identifier:Xd,node:yb,entry:gb,document:bb,"whitespace in document":wb,"whitespace in node":tp}});var Ic=D(()=>{Ni();Wd();Sb()});function Co(e,t){let r=e.slice(0,t),n=r.split(`
16
+ `).length;return{column:t-r.lastIndexOf(`
17
+ `),line:n,offset:t}}var xr;var el=D(()=>{xr=class xr extends Error{column;line;offset;reason;constructor(e,t=null){super(t?`${e} (line ${t.line}, column ${t.column})`:e);this.name="JxnError",this.column=t?.column??null,this.line=t?.line??null,this.offset=t?.offset??null,this.reason=e}inFile(e){let t=this.line!==null&&this.column!==null&&this.offset!==null?{column:this.column,line:this.line,offset:this.offset}:null;return new xr(`${e}: ${this.reason}`,t)}}});var Eb;var Pb=D(()=>{Eb=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function Fe(e,t,r,n,s){let i=t.normalize("NFC");if(i==="__proto__")throw Ge(n,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,i))throw Ge(n,s,`"${i}" is written twice, and one of them would be lost`);e[i]=r}function Ge(e,t,r){let n=jb(t)?.start;return new xr(r,n===void 0?null:Co(e.text,n))}function jb(e){let t=jo(e);return t?{end:t.end.offset,start:t.start.offset}:null}function $r(e,t,r){let n=e.spans?jb(r):null;if(n)e.spans?.set(t,n)}function pn(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Mc(e,t){let r=t.getTag();if(r!==null&&!DN.has(r))throw Ge(e,t,`(${r}) is not an annotation Jx Notation has`);if(r==="ref")throw Ge(e,t,"(ref) annotates a value, and this is a name");return r}function No(e,t){let r=t.getTag(),n=t.getValue();if(r!==null&&r!=="ref")throw Ge(e,t,`(${r}) cannot annotate a value here; only (ref) can`);if(Nt(n)){if(!Number.isFinite(n))throw Ge(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw Ge(e,t,"This number is too large to survive being read as JSON")}if(r==="ref"){if(!O(n))throw Ge(e,t,"(ref) needs a string");return{$ref:n}}return n}function Mi(e,t){return t.entries.filter((r)=>!r.name).map((r)=>No(e,r))}function Di(e){return e.entries.filter((t)=>t.name)}function Hr(e){return e.children?.nodes??[]}function tl(e){return e.getName()??""}function FN(e,t,r){let n={$prototype:"Function"},s=Mi(e,t),i=Hr(t);for(let o of Di(t))Fe(n,tl(o),No(e,o),e,o);if(i.length>0){if(s.length>0)Fe(n,"parameters",s,e,t);Fe(n,"body",rp(e,i,`${r}/body`),e,t)}else if(s.length>0){let o=s.at(-1)??null,a=s.slice(0,-1);if(a.length>0)Fe(n,"parameters",a,e,t);Fe(n,"body",o,e,t)}return $r(e,r,t),n}function rp(e,t,r){return t.map((n,s)=>{if(n.getName()!=="-")throw Ge(e,n,`A list holds only "-" items, and this is "${n.getName()}"`);return jn(e,n,`${r}/${s}`)})}function jn(e,t,r){let n=Mc(e,t);if($r(e,r,t),n==="fn")return FN(e,t,r);let s=Mi(e,t),i=Di(t),o=Hr(t);if(n==="array"){if(i.length>0)throw Ge(e,t,"(array) holds items, and these are named");return[...s,...rp(e,o,r)]}if(n!=="object"){if(s.length>1){if(i.length>0||o.length>0)throw Ge(e,t,"A list of values cannot also have names or a block");return s}if(s.length===1){if(i.length>0||o.length>0)throw Ge(e,t,"A value cannot also have names or a block");return s[0]??null}if(o.length>0&&i.length===0&&o.every((l)=>l.getName()==="-"))return rp(e,o,r)}else if(s.length>0)throw Ge(e,t,"(object) holds names, and this is a value");let a={};for(let l of i){let c=tl(l);Fe(a,c,No(e,l),e,l),$r(e,`${r}/${pn(c)}`,l)}for(let l of o){let c=l.getName();Fe(a,c,jn(e,l,`${r}/${pn(c)}`),e,l)}return a}function kb(e,t,r){let n={};if($r(e,r,t),Mi(e,t).length>0)throw Ge(e,t,"A style block holds declarations, and this is a value");for(let s of Di(t)){let i=tl(s);Fe(n,i,No(e,s),e,s),$r(e,`${r}/${pn(i)}`,s)}for(let s of Hr(t)){let i=s.getName(),o=`${r}/${pn(i)}`,a=Hr(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){Fe(n,i,jn(e,s,o),e,s);continue}let l=Mi(e,s);if(l.length>1)throw Ge(e,s,`"${i}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(Di(s).length>0||Hr(s).length>0)throw Ge(e,s,`"${i}" has a value and names. A selector with a space in it needs quotes`);Fe(n,i,l[0]??null,e,s),$r(e,o,s)}else Fe(n,i,kb(e,s,o),e,s)}return n}function Jc(e,t,r){let n=Hr(t);if(n.length!==1||!n[0])throw Ge(e,t,`"${t.getName()}" holds one element`);return Ab(e,n[0],r)}function _b(e,t,r){let n={$prototype:"Array"};if($r(e,r,t),Mi(e,t).length>0)throw Ge(e,t,"$array holds names and one element, and this is a value");for(let s of Di(t)){let i=tl(s);Fe(n,i.startsWith(".")?i.slice(1):i,No(e,s),e,s)}if(Hr(t).length>0)Fe(n,"map",Jc(e,t,`${r}/map`),e,t);return n}function Ab(e,t,r){let n=t.getName();if(n==="-"){let s=Mi(e,t);if(s.length!==1||Di(t).length>0||Hr(t).length>0)throw Ge(e,t,'"-" is one piece of text or one (ref)');return $r(e,r,t),s[0]??null}if(n==="$array")return _b(e,t,r);return np(e,t,r)}function qN(e,t,r,n){let s=Mc(e,r);if(t==="map")return Jc(e,r,n);if(t==="cases"){let i={};for(let o of Hr(r)){let a=o.getName();Fe(i,a,Jc(e,o,`${n}/${pn(a)}`),e,o)}return i}if(t==="children"&&s!=="array"&&Hr(r).length>0)return Jc(e,r,n);return jn(e,r,n)}function np(e,t,r){let n={},s=t.getName(),i=Mc(e,t);if($r(e,r,t),i!==null)throw Ge(e,t,`(${i}) cannot annotate an element`);let o=Mi(e,t);if(s==="$element"){let[l,c,...u]=o;if(u.length>0)throw Ge(e,t,"$element takes at most a tag and a text value");if(l!==void 0)Fe(n,"tagName",l,e,t);if(c!==void 0)Fe(n,"textContent",c,e,t)}else{if(s.startsWith("$"))throw Ge(e,t,`"${s}" is not a kind of element`);if(Fe(n,"tagName",s,e,t),o.length>1)throw Ge(e,t,"An element has one text value. A list of them needs a block");if(o[0]!==void 0)Fe(n,"textContent",o[0],e,t),$r(e,`${r}/textContent`,t)}VN(e,t,n,r);let a=[];for(let l of Hr(t))WN(e,l,n,a,r);if(a.length>0)Fe(n,"children",a,e,t);return n}function Rb(e){let{attributes:t}=e;if(B(t))return t;let r={};return e.attributes=r,r}function VN(e,t,r,n){for(let s of Di(t)){let i=tl(s),o=s.getTag();if(o==="fn")throw Ge(e,s,"A function has a block form: (fn)name, on a line of its own");let a=No(e,s);if(i.startsWith(".")||i.startsWith("$")){let l=i.startsWith(".")?i.slice(1):i;Fe(r,l,a,e,s),$r(e,`${n}/${pn(l)}`,s)}else if(i.startsWith("on")&&o==="ref")Fe(r,i,a,e,s),$r(e,`${n}/${pn(i)}`,s);else if(i.startsWith("on")&&Eb.has(i))throw Ge(e,s,`${i} needs (ref)"pointer", or a function on a line of its own: (fn)${i} "…"`);else Fe(Rb(r),i,a,e,s),$r(e,`${n}/attributes/${pn(i)}`,s)}}function WN(e,t,r,n,s){let i=t.getName(),o=Mc(e,t),a=(l)=>`${s}/${pn(l)}`;if(o==="fn"||o==="on"){if(!i.startsWith("on"))throw Ge(e,t,`(${o}) in an element marks a handler, and "${i}" is not one`);Fe(r,i,jn(e,t,a(i)),e,t)}else if(i==="script")throw Ge(e,t,'"script" is reserved. A <script> element is $element "script"');else if(i==="state")Fe(r,"state",jn(e,t,a("state")),e,t);else if(i==="style")Fe(r,"style",kb(e,t,a("style")),e,t);else if(i==="attributes"){let l=jn(e,t,a("attributes"));if(B(l))for(let[c,u]of Object.entries(l))Fe(Rb(r),c,u,e,t);else Fe(r,"attributes",l,e,t)}else if(i.startsWith(".")){let l=i.slice(1);Fe(r,l,qN(e,l,t,a(l)),e,t)}else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")Fe(r,i,jn(e,t,a(i)),e,t);else{if(LN.has(i))throw Ge(e,t,`"${i}" is reserved here`);n.push(Ab(e,t,`${s}/children/${n.length}`))}}function HN(e,t){return Hr(t).map((r,n)=>{let s=`/$head/${n}`;return r.getName()==="-"?jn(e,r,s):np(e,r,s)})}function BN(e){let t=MN.exec(e);if(t)throw new xr(`A raw control character (U+${t[0].codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be in a Jx Notation file. Escape it, as \\u{1b}`,Co(e,t.index));try{return Ls(e,{storeLocations:!0})}catch(r){let s=(r instanceof Me?r.errors?.[0]??r:null)?.start,i=r instanceof Error?r.message:String(r);throw new xr(i.split(`
18
+ `)[0]??i,s?Co(e,s.offset):null)}}function Ob(e){if(Td(e.text)==="project")throw new xr('This is a project file: its first node is "project". A document has an element there, and a <project> element is $element "project"');let r=BN(e.text),n={},s=null;for(let i of r.nodes){let o=i.getName();if(o==="$head"&&i.getTag()===null)Fe(n,o,HN(e,i),e,i);else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")Fe(n,o,jn(e,i,`/${pn(o)}`),e,i),$r(e,`/${pn(o)}`,i);else if(s)throw Ge(e,i,"A document has one root element, and this is a second");else s=i}if(s){let i=s.getName()==="$array"?_b(e,s,""):np(e,s,"");for(let[o,a]of Object.entries(i))Fe(n,o,a,e,s)}return pc(n)}function Li(e,t){try{return Ob({spans:null,text:e})}catch(r){throw t!==void 0&&r instanceof xr?r.inFile(t):r}}function sp(e){let t=new Map;return{document:Ob({spans:t,text:e}),spans:t}}var MN,DN,LN;var Dc=D(()=>{Ic();ve();ir();Id();el();Pb();MN=/(?![\t\n\v\f\r])\p{Cc}/u,DN=new Set(["array","fn","object","on","ref"]),LN=new Set(["attributes","script","state","style"])});function rl(e){return e.toLowerCase().endsWith(".jxn")}function fs(e){return e.endsWith(".json")||rl(e)}function ds(e,t){return rl(t)?Li(e,t):Ny(e,t)}var Cb=D(()=>{ir();Dc()});function zN(e){let t={comments:0,escapes:[]},r=0;while(r<e.length)if(e.startsWith("//",r)){t.comments+=1;let n=e.indexOf(`
19
+ `,r);r=n===-1?e.length:n}else if(e.startsWith("/*",r)){t.comments+=1;let n=e.indexOf("*/",r+2);r=n===-1?e.length:n+2}else if(e.startsWith("/-",r))t.comments+=1,r+=2;else if(e.charAt(r)==="#"&&/^#+"/u.test(e.slice(r,r+16))){let[n=""]=/^#+/u.exec(e.slice(r))??[],s=r+n.length,i=e.startsWith('"""',s)?'"""':'"',o=e.indexOf(i+n,s+i.length);r=o===-1?e.length:o+i.length+n.length}else if(e.charAt(r)==='"'){let n=e.startsWith('"""',r)?'"""':'"';r+=n.length;while(r<e.length&&!e.startsWith(n,r))if(e.charAt(r)==="\\")t.escapes.push(r),r+=2;else r+=1;r+=n.length}else r+=1;return t}function ip(e){return zN(e).escapes.flatMap((t)=>{let r=UN.get(e.charAt(t+1));return r?[{...Co(e,t),message:r}]:[]})}var UN;var Nb=D(()=>{el();UN=new Map([["b",String.raw`\b in a quoted string is a backspace, not a word boundary. Use a raw string, like #"…"#, if this is a pattern.`],["s",String.raw`\s in a quoted string is a space, not whitespace. Use a raw string, like #"…"#, if this is a pattern.`]])});function To(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>To(s,t)).join(",")}]`;if(!B(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${To(e[s],t||s==="style")}`).join(",")}}`}function GN(e,t){let r=e;for(let n of t.split("/").slice(1)){let s=n.replaceAll("~1","/").replaceAll("~0","~");if(Array.isArray(r))r=r[Number(s)];else r=B(r)?r[s]:void 0}return r}function KN({spans:e}){let t=new Map;for(let[r,n]of e){let s=t.get(n.start);if(s===void 0||r.length<s.length)t.set(n.start,r)}return t}function Tb(e,t){let r=KN(e),n=new Map;for(let[s,i]of r)n.set(s,To(GN(e.document,i)));return{meanings:n,pointers:r,text:t}}function ps(e){let t=jo(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function Fc(e,t){let{end:r,start:n}=ps(e);return t.slice(n,r).trimEnd()}function Lc(e,t){let{end:r,start:n}=ps(e);return`${e.leading??" "}${t.slice(n,r).trimEnd()}`}function cp(e){return e.children?.nodes??[]}function op(e){let t=e.entries.map((i)=>`${i.getName()??""}=(${i.getTag()??""})${JSON.stringify(i.getValue())}`),r=t.filter((i)=>!i.startsWith("=")).toSorted(),n=t.filter((i)=>i.startsWith("=")),s=cp(e).map((i)=>op(i));return`(${e.getTag()??""})${e.getName()} ${[...r,...n].join(" ")} {${s.join(";")}}`}function ap(e,t,r){if(op(t)===op(r))return!0;let n=e.previous.meanings.get(ps(t).start);return n!==void 0&&n===e.next.meanings.get(ps(r).start)}function Ib(e){let r=e.entries.filter((n)=>["$id","key"].includes(n.getName()??"")).map((n)=>JSON.stringify(n.getValue()));return`(${e.getTag()??""})${e.getName()} ${r.join(" ")}`}function Jb(e,t,r){let n=e.length+1,s=t.length+1,i=new Int32Array(n*s);for(let c=e.length-1;c>=0;c-=1)for(let u=t.length-1;u>=0;u-=1){let p=e[c],h=t[u];i[c*s+u]=p!==void 0&&h!==void 0&&r(p,h)?(i[(c+1)*s+u+1]??0)+1:Math.max(i[(c+1)*s+u]??0,i[c*s+u+1]??0)}let o=[],a=0,l=0;while(a<e.length&&l<t.length){let c=e[a],u=t[l];if(c!==void 0&&u!==void 0&&r(c,u))o.push([a,l]),a+=1,l+=1;else if((i[(a+1)*s+l]??0)>=(i[a*s+l+1]??0))a+=1;else l+=1}return o}function YN(e,t,r){let n=new Map,s=new Set,i=(c,u)=>{let p=t[c];if(p)n.set(u,p),s.add(c)},o=Jb(t,r,(c,u)=>ap(e,c,u)),a=0,l=0;for(let[c,u]of[...o,[t.length,r.length]]){let p=Jb(t.slice(a,c),r.slice(l,u),(h,m)=>Ib(h)===Ib(m));for(let[h,m]of p)i(a+h,l+m);if(c<t.length)i(c,u);a=c+1,l=u+1}for(let[c,u]of r.entries())if(!n.has(c)){let p=t.findIndex((h,m)=>!s.has(m)&&ap(e,h,u));if(p!==-1)i(p,c)}return n}function up(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
20
+ `)+1)}function XN(e,t,r){return e.split(`
21
+ `).map((n,s)=>s>0&&n.startsWith(t)?r+n.slice(t.length):n).join(`
22
+ `)}function ZN(e,t,r){let n=[...r],s=(o)=>{let a=o.getName(),l=n.findIndex((c)=>c.getName()===a);return l===-1?void 0:n.splice(l,1)[0]},i="";for(let o of t.entries){let a=s(o);if(a){let l=a.getTag()===o.getTag()&&a.getValue()===o.getValue();i+=l?Lc(o,e.previous.text):`${o.leading??" "}${Lc(a,e.next.text).trimStart()}`}}for(let o of n)i+=` ${Lc(o,e.next.text).trimStart()}`;return i}function QN(e,t,r){let n=new Map;for(let i of cp(t)){let o=e.previous.pointers.get(ps(i).start);if(o!==void 0)n.set(o,i)}let s=new Map;for(let i of r.entries){let o=e.next.pointers.get(ps(i).start),a=o===void 0?void 0:n.get(o);if(a&&i.getName()!==null)s.set(a,i)}return s}function eT(e,t,r){let{text:n}=e.previous,s=Lc(r,e.next.text).trimStart().slice(`${r.getName()}=`.length),[i]=t.entries;if(i?.getName()===null&&t.entries.length===1&&!t.children){if(i.getValue()===r.getValue()&&i.getTag()===r.getTag())return Fc(t,n);return`${lp(t,n)}${i.leading??" "}${s}`}return`${lp(t,n)} ${s}`}function lp(e,t){let{start:r}=ps(e),[n]=e.entries;if(n)return t.slice(r,ps(n).start-(n.leading??"").length);let s=e.children&&jo(e.children);if(s)return t.slice(r,s.start.offset-1).trimEnd();return Fc(e,t)}function tT(e,t,r,n){let s=QN(e,t,r),i=new Set(s.values()),o=r.entries.filter((m)=>!i.has(m)),a=`${lp(t,e.previous.text)}${ZN(e,t,o)}`,l=cp(r);if(l.length===0&&s.size===0)return a;let c=l[0]?up(l[0]):`${n} `,u=t.children,p=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&nT(u,e.previous.text,t)){let m=`${n}${rT(u,n)}`;return`${a}${p}{${Db(e,u,l,m,c,s)}}`}let h=l.map((m)=>Mb(e,m,c,`${n} `));return`${a}${p}{
23
+ ${h.join("")}${n}}`}function rT(e,t){let[r]=e.nodes,n=r?up(r):"";return n.startsWith(t)?n.slice(t.length):" "}function nT(e,t,r){let{end:n,start:s}=ps(r),[i]=e.nodes;return i!==void 0&&(i.leading??"").includes(`
24
+ `)&&t.slice(s,n).includes(`
25
+ `)}function Mb(e,t,r,n){return`${n}${XN(Fc(t,e.next.text),r,n)}
26
+ `}function Db(e,t,r,n,s,i){let o=t.nodes.filter((y)=>!i.has(y)),a=YN(e,o,r),l=t.nodes[0]?.leading??"",c=l.indexOf(`
27
+ `),u=c===-1?"":l.slice(0,c+1),p=u,h=-1,m=()=>{if(p!==""&&!p.endsWith(`
28
+ `)&&!p.endsWith(";"))p+=`
29
+ `},b=(y,w)=>{let P=t.nodes.indexOf(y),S=P===h+1||P>h;h=Math.max(h,P);let E=y===t.nodes[0]?l.slice(u.length):y.leading??"";if(S&&(E.includes(`
30
+ `)||p===u||p.endsWith(";"))){p+=`${E}${w}${y.trailing??""}`;return}if(!p.endsWith(`
31
+ `))p+=`
32
+ `;let k=(y.trailing??"").replace(/^;/u,"");p+=`${E.includes(`
33
+ `)?E:n}${w}${k}`},g=(y)=>{for(let[w,P]of t.nodes.entries()){let S=i.get(P);if(S&&w<y&&w>h)m(),b(P,eT(e,P,S))}};for(let[y,w]of r.entries()){let P=a.get(y);if(P){g(t.nodes.indexOf(P)),m();let S=ap(e,P,w)?Fc(P,e.previous.text):tT(e,P,w,up(P));b(P,S)}else m(),p+=Mb(e,w,s,n)}return g(t.nodes.length),`${p}${t.trailing??""}`}function fp(e,t,r){let n;try{n=r(e)}catch{return t}let s=r(t),i=To(s.document);if(To(n.document)===i)return e;let o={next:Tb(s,t),previous:Tb(n,e)},a=Db(o,Ls(e,{storeLocations:!0}),Ls(t,{storeLocations:!0}).nodes,"","",new Map);try{return To(r(a).document)===i?a:t}catch{return t}}var dp=D(()=>{Ic();ve()});function Vb(e){return!/\p{Cs}/u.test(e)}function Wb(e,t){try{return Ls(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function Vc(e){let t='"';for(let r of e)if(r==='"')t+=String.raw`\"`;else if(r==="\\")t+=String.raw`\\`;else if(r===`
34
+ `)t+=String.raw`\n`;else if(r==="\t")t+=String.raw`\t`;else if(r==="\r")t+=String.raw`\r`;else if(qb.test(r))t+=`\\u{${r.codePointAt(0)?.toString(16)}}`;else t+=r;return`${t}"`}function Hb(e,t){let r="#";while(e.includes(t+r))r+="#";return r}function oT(e,t){if(sT.test(e))return null;let r=Hb(e,'"""'),n=`${t}${or}`,s=e.split(`
35
+ `).map((o)=>o===""?"":n+o),i=`${r}"""
36
+ ${s.join(`
37
+ `)}
38
+ ${n}"""${r}`;return Wb(i,e)?i:null}function mp(e,t,r){if(!Vb(e))throw new xr(`${r} holds a lone surrogate, which Jx Notation has no way to spell`);if(Fb.test(e))return e;if(e.includes(`
39
+ `)){let n=oT(e,t);if(n)return n}else if((e.includes("\\")||e.includes('"'))&&!qb.test(e)){let n=Hb(e,'"'),s=`${n}"${e}"${n}`;if(Wb(s,e))return s}return Vc(e)}function Dr(e,t){if(!Vb(e))throw new xr(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return Fb.test(e)?e:Vc(e)}function ar(e,t,r){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(Nt(e))return Object.is(e,-0)?"-0":String(e);if(O(e))return mp(e,t,r);return qc(e)?`(ref)${Vc(e.$ref)}`:null}function Bb(e){if(!Ur(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:r,parameters:n,...s}=e,i=Object.values(s).every((c)=>ar(c,"","")!==null),o=n===void 0||Array.isArray(n)&&n.length>0&&n.every((c)=>O(c))&&r!==void 0,a=r===void 0||O(r)||Array.isArray(r),l=Array.isArray(r)&&r.length===0;return i&&o&&a&&!l}function Ub(e,t,r,n){let{$prototype:s,body:i,parameters:o,...a}=t,l=[`${r}(fn)${Dr(e,n)}`];for(let[c,u]of Object.entries(a))l.push(`${Dr(c,n)}=${ar(u,r,vt(n,c))}`);if(Array.isArray(o))for(let c of o)l.push(mp(String(c),r,vt(n,"parameters")));if(O(i))l.push(mp(i,r,vt(n,"body")));else if(Array.isArray(i))return[`${l.join(" ")} {`,...i.flatMap((c,u)=>Br("-",c,r+or,vt(vt(n,"body"),u))),`${r}}`];return[l.join(" ")]}function Br(e,t,r,n){let s=Dr(e,n),i=r+s,o=ar(t,r,n);if(o!==null)return[`${i} ${o}`];if(Bb(t))return Ub(e,t,r,n);if(Array.isArray(t)){if(t.length===0)return[`${r}(array)${s}`];let u=t.map((h,m)=>ar(h,r,vt(n,m)));if(t.length>1&&u.every((h)=>h!==null&&!h.includes(`
40
+ `))){let h=`${i} ${u.join(" ")}`;if(h.length<=pp)return[h]}return[`${i} {`,...t.flatMap((h,m)=>Br("-",h,r+or,vt(n,m))),`${r}}`]}let a=Ur(t)?Object.entries(t):[];if(a.length===0)return[`${i} {}`];let l=a.every(([u])=>u==="-")?`${r}(object)${s}`:i,c=a.map(([u,p])=>{let h=ar(p,r,vt(n,u));return h===null||h.includes(`
41
+ `)?null:`${Dr(u,n)}=${h}`});if(c.every((u)=>u!==null)){let u=`${l} ${c.join(" ")}`;if(u.length<=pp)return[u]}return[`${l} {`,...a.flatMap(([u,p])=>Br(u,p,r+or,vt(n,u))),`${r}}`]}function zb(e,t,r,n){let s=Object.entries(t),i=r+Dr(e,n);if(s.length===0)return[`${i} {}`];let o=[],a=0;for(let[h,m]of s){let b=ar(m,r,vt(n,h));if(b===null||b.includes(`
42
+ `))break;o.push(`${Dr(h,n)}=${b}`),a+=1}let l=`${i} ${o.join(" ")}`,c=o.length>0&&l.length<=pp,u=c?a:0,p=s.slice(u).flatMap(([h,m])=>{if(Ur(m)&&!qc(m))return zb(h,m,r+or,vt(n,h));return Br(h,m,r+or,vt(n,h))});if(c&&p.length===0)return[l];return[`${c?l:i} {`,...p,`${r}}`]}function aT(e){if(!Ur(e)||e.$prototype!=="Array"||!Ur(e.map))return!1;let{$prototype:t,map:r,...n}=e;return Object.values(n).every((s)=>{let i=ar(s,"","");return i!==null&&!i.includes(`
43
+ `)})}function lT(e,t,r){let{$prototype:n,map:s,...i}=e,o=[`${t}$array`];for(let[a,l]of Object.entries(i))o.push(`${Dr(a,r)}=${ar(l,t,vt(r,a))}`);return[`${o.join(" ")} {`,...nl(s??null,t+or,vt(r,"map")),`${t}}`]}function nl(e,t,r){let n=ar(e,t,r);if(n!==null)return[`${t}- ${n}`];if(aT(e))return lT(e,t,r);if(Ur(e))return hp(e,t,r);throw new xr(`${r} is a list inside a list of children, which has no spelling`)}function cT(e,t,r){let{tagName:n}=e;if(!O(n))return`${t}$element`;if(iT.has(n)||n.startsWith("$")||n.startsWith("."))return`${t}$element ${Vc(n)}`;return t+Dr(n,r)}function uT(e,t){return t!==null&&!t.includes(`
44
+ `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function hp(e,t,r){let n=[cT(e,t,r)],s=t+or,i=[],o={},a=null;for(let[l,c]of Object.entries(e)){let u=vt(r,l);if(l==="tagName"&&O(c))continue;if(l==="children")continue;if(l==="textContent"){let p=ar(c,t,u);if(p===null||!O(e.tagName))Lb(n,i,l,c,s,t,u);else a=p}else if(l==="attributes"&&Ur(c))for(let[p,h]of Object.entries(c)){let m=ar(h,t,vt(u,p));if(uT(p,m))n.push(`${Dr(p,u)}=${m}`);else o[p]=h}else if(l==="state")i.push(...Br("state",c,s,u));else if(l==="style"&&Ur(c))i.push(...zb("style",c,s,u));else if(l.startsWith("on")&&qc(c))n.push(`${Dr(l,u)}=${ar(c,t,u)}`);else if(l.startsWith("on"))i.push(...Bb(c)?Ub(l,c,s,u):Br(l,c,s,u).map((p,h)=>h===0?p.replace(s,`${s}(on)`):p));else if(l.startsWith("$")){let p=ar(c,t,u);if(p===null||p.includes(`
45
+ `))i.push(...Br(l,c,s,u));else n.push(`${Dr(l,u)}=${p}`)}else Lb(n,i,l,c,s,t,u)}if(Object.keys(o).length>0)i.push(...Br("attributes",o,s,vt(r,"attributes")));if(i.push(...fT(e.children,s,vt(r,"children"))),a!==null)n.push(a);return i.length===0?[n.join(" ")]:[`${n.join(" ")} {`,...i,`${t}}`]}function fT(e,t,r){if(e===void 0)return[];if(Array.isArray(e)){if(e.length===0)return[`${t}(array).children`];return e.flatMap((s,i)=>nl(s,t,vt(r,i)))}let n=ar(e,t,r);if(n!==null)return[`${t}.children ${n}`];return[`${t}.children {`,...nl(e,t+or,r),`${t}}`]}function Lb(e,t,r,n,s,i,o){let a=Dr(`.${r}`,o);if(r==="map"&&Ur(n)){t.push(`${s}${a} {`,...nl(n,s+or,o),`${s}}`);return}if(r==="cases"&&Ur(n)){t.push(`${s}${a} {`);for(let[c,u]of Object.entries(n))t.push(`${s}${or}${Dr(c,o)} {`,...nl(u,s+or+or,vt(o,c)),`${s}${or}}`);t.push(`${s}}`);return}let l=ar(n,i,o);if(l===null||l.includes(`
46
+ `))t.push(...Br(`.${r}`,n,s,o));else e.push(`${a}=${l}`)}function dT(e,t){return["$head {",...e.flatMap((r,n)=>Ur(r)&&!qc(r)&&O(r.tagName)&&!r.$ref?hp(r,t,`/$head/${n}`):Br("-",r,t,`/$head/${n}`)),"}"]}function pT(e){let{document:t,spans:r}=sp(e);return{document:B(t)?t:null,spans:r}}function gp(e,t){let r=mT(e);return t===void 0?r:fp(t,r,pT)}function mT(e){if(!B(e))throw new xr("A document is an object");let t=e,r=["/- kdl-version 2"],n={};for(let[s,i]of Object.entries(t))if(s==="$head"&&Array.isArray(i))r.push(...dT(i,or));else if(s==="$head")r.push(`(object)${Br(s,i,"","/$head").join(`
47
+ `)}`);else if(s.startsWith("$"))r.push(...Br(s,i,"",vt("",s)));else n[s]=i;if(Object.keys(n).length>0)r.push("",...hp(n,"",""));return`${r.join(`
48
+ `)}
49
+ `}var or=" ",pp=100,Fb,qb,sT,iT,Ur=(e)=>B(e),qc=(e)=>Ur(e)&&O(e.$ref)&&Object.keys(e).length===1,vt=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`;var Gb=D(()=>{Ic();ve();el();Dc();dp();Fb=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,qb=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,sT=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,iT=new Set(["-","attributes","script","state","style"])});var Fi=D(()=>{Id();Cb();el();Nb();Dc();dp();Gb()});function Zb(e){if(e===null)throw TypeError("A class descriptor cannot be null");return B(e)?e:{}}class sl{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=By(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=gT(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 Wc{#t;get#e(){return[...this.#t,$T]}constructor(e){this.#t=e;for(let t of e)if(t.extensions.includes(".jxn"))throw Error(`Format "${t.name}" claims ".jxn", which is built in`);for(let t of e){if(t.mediaType===null)continue;let r=Hy(t.mediaType);if(r!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${r}`)}for(let t of Yb){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=Kb(e);return this.#e.find((n)=>n.extensions.includes(r)&&(!t||n.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#e.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let r of this.#e){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=Kb(e);return this.#e.some((r)=>r.extensions.includes(t))}}function gT(e){let t={},r=e.$defs?.methods??{};for(let[n,s]of Object.entries(r)){let{role:i}=s;if(!bT(i))continue;let o={identifier:s.identifier??n,timing:s.timing??hT};if(O(s.discriminator))o.discriminator=s.discriminator;t[i]=o}return t}function bT(e){return e!==void 0&&yT.has(e)}function Kb(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var Yb,Xb,hT,yT,xT,$T;var yp=D(()=>{ve();Nd();Yb=["parse","serialize","rewrite","discover","load"],Xb=[...Yb,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];hT=["compiler","server"];yT=new Set(Xb);xT={importModule:async()=>{await Promise.resolve().then(() => Fi());return{JxNotation:{parse:(r)=>Li(r),serialize:(r)=>gp(r)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},$T=new sl("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},xT)});class Qb{#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 Wc(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 e0(e,t,r){let n=[];for(let s of e??[])n.push(await wT(s,t,r));return new Qb(n)}async function wT(e,t,r){let n;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(r,e);n=t.resolvePath(`${l}/package.json`,`./${il}`)}else try{n=t.resolvePath(r,`${e}/${il}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${il} (is the package installed, and does its exports map include it?): ${bp(l)}`,{cause:l})}let s;try{s=await t.loadJson(n)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${n}: ${bp(l)}`,{cause:l})}if(!B(s)||!O(s.name))throw Error(`Extension "${e}": ${il} 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 u=t.resolvePath(n,c),p;try{p=await t.loadJson(u)}catch(h){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${bp(h)}`,{cause:h})}o.push(new sl(l,u,Zb(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 bp(e){return e instanceof Error?e.message:String(e)}var il="jx-extension.json";var t0=D(()=>{yp();ve();yp()});var r0=D(()=>{ve()});var Hc="project.json";var xp=D(()=>{ve();r0();ir()});import{dirname as _X,join as vT}from"node:path";function kn(e){return vT(e,Hc)}var Io=D(()=>{xp()});import{readFileSync as ST}from"node:fs";import{dirname as ET,isAbsolute as PT,resolve as n0,sep as Bc}from"node:path";import{pathToFileURL as jT}from"node:url";import{createRequire as kT}from"node:module";async function $p(e){let t=[e],r=`${Bc}src${Bc}`,n=`${Bc}dist${Bc}`;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(jT(i).href)}catch(o){s=o}throw s instanceof Error?s:Error(String(s))}function wp(e,t){return kT(n0(e,"package.json")).resolve(t)}function vp(e){return{importModule:(t)=>$p(t),loadJson:async(t)=>JSON.parse(ST(t,"utf8")),resolvePath:(t,r)=>{if(r.startsWith("./")||r.startsWith("../"))return n0(ET(t),r);if(PT(r))return r;return wp(e,r)}}}async function Fs(e,t){return e0(t?.extensions,vp(e),kn(e))}function Uc(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 ms=D(()=>{t0();ve();Io()});import{existsSync as _T,readFileSync as AT}from"node:fs";import{resolve as RT}from"node:path";function qs(e){let t=kn(e);if(!_T(t))throw Error(`project.json not found in ${e}`);let r;try{r=Cd(AT(t,"utf8"),t)}catch(o){throw Error(`Invalid project.json: ${je(o)}`,{cause:o})}let n={...ol,...r,build:{...ol.build,...r.build},defaults:{...ol.defaults,...r.defaults},images:{...ol.images,...r.images},url:r.url??ol.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:RT(e)}}var ol;var al=D(()=>{ir();Io();ol={$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 Sp,readFileSync as s0,writeFileSync as OT}from"node:fs";import{resolve as i0}from"node:path";async function o0(e,t={}){let{dryRun:r=!1,connection:n}=t,{config:s}=qs(e),i=await Fs(e,s),o=B(s.connections)?s.connections:{},a=B(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,...NT(e),JX_PROJECT_ROOT:e},u=[],p=[];for(let b of l){let g=o[b],y=B(g)?{...g,$name:b}:{$name:b},w=String(y.provider??""),P=CT(i.connectors(),w);if(!P)throw Error(`Connection "${b}" names provider "${w}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let S={};for(let[k,A]of Object.entries(a))if(B(A)&&A.connection===b)S[k]=A;let E=await P.call("deploySchema",S,y,{dryRun:r,env:c});if(u.push({applied:E.applied??!r,connection:b,provider:w,statements:E.statements??[],tables:Object.keys(S),warnings:E.warnings??[]}),P.capabilities.bindings){let k=await P.call("bindings",y);if(B(k)&&Object.keys(k).length>0)p.push(k)}}let h=i0(e,"wrangler.jsonc"),m=!1;if(!r&&p.length>0&&Sp(h)){let b=s0(h,"utf8"),{content:g,patched:y}=My(b,p);if(y&&g!==b)OT(h,g,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:Sp(h)?h:null}}function CT(e,t){return e.find((r)=>r.connector?.provider===t)}function NT(e){let t=i0(e,".dev.vars");if(!Sp(t))return{};let r=new Map;for(let n of s0(t,"utf8").split(`
50
+ `)){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 a0=D(()=>{Ly();ms();al();ve()});function qi(e){return e.startsWith(zc)}function l0(e){let t=e;if(qi(t))t=t.slice(zc.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Ep}${t}.js`}function c0(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",r=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Ep}${r}`:`${Ep}${r}.${t}`}function u0(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Gc(e){let t=u0(e);return t.startsWith("/")?t:`/${t}`}function TT(e,t){return[...e].toSorted((r,n)=>n[t].length-r[t].length)}function Kc(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 TT(e,"urlPrefix")){let i=Gc(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`${u0(s.dir)}/${a.join("/")}`}return null}function f0(e,t){let r=new Set;for(let n of t){let s=Gc(n.urlPrefix),i=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${IT}]+`,"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 Pp(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 jp(e){return e.map(({url:t,descriptor:r})=>r?`${t} ${r}`:t).join(", ")}function Vi(e){if(!O(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 Xe(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Vs(e,t){let r=new URL(t);if(!r.pathname.endsWith("/"))r.pathname+="/";return new URL(e.replace(/^\/+/,""),r).href}var zc="npm:",Ep="/assets/",IT;var Lr=D(()=>{ve();IT=String.raw`"'\s<>()\\`});function d0(e,t){return e.replaceAll(FT,(r,n,s)=>{let i=s.trim(),o=BT.exec(i),a=o?o[2]:i,l=Xe(t,a);if(l===a)return r;return`url(${n}${o?`${o[1]}${l}${o[1]}`:l}${n})`})}function UT(e,t,r,n,s){let i=r.toLowerCase();if(JT.has(i))return Xe(s,n);if(MT.has(i)){let o=Pp(n);return o.length===0?n:jp(o.map((a)=>({descriptor:a.descriptor,url:Xe(s,a.url)})))}if(i==="style")return d0(n,s);if(i==="content"&&e==="meta"&&HT.test(t))return Xe(s,n);return n}function p0(e,t){if(t==="")return e;let r=e.replaceAll(VT,(n,s,i,o)=>{let a=i.replaceAll(qT,(l,c)=>`"${Xe(t,c)}"`);return s+a+o});return r=r.replaceAll(WT,(n,s,i,o)=>s+d0(i,t)+o),r.replaceAll(DT,(n,s,i)=>{if(i==="")return n;let o=s.toLowerCase(),a=i.replaceAll(LT,(l,c,u,p,h)=>{let m=p===void 0?"'":'"',b=p??h??"",g=UT(o,i,c,b,t);return g===b?l:`${c}=${m}${g}${m}`});return a===i?n:`<${s}${a}>`})}var JT,MT,DT,LT,FT,qT,VT,WT,HT,BT;var m0=D(()=>{Lr();JT=new Set(["href","src","poster","action","formaction","data"]),MT=new Set(["srcset","imagesrcset"]),DT=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,LT=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,FT=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,qT=/"(\/[^"/][^"]*)"/g,VT=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,WT=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,HT=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,BT=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var au=N(function(tZ,L0){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:Op,getOwnPropertyDescriptor:zT,getOwnPropertyNames:GT}=Object,KT=Object.prototype.hasOwnProperty,YT=(e,t)=>{for(var r in t)Op(e,r,{get:t[r],enumerable:!0})},XT=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of GT(t))if(!KT.call(e,s)&&s!==r)Op(e,s,{get:()=>t[s],enumerable:!(n=zT(t,s))||n.enumerable})}return e},ZT=(e)=>XT(Op({},"__esModule",{value:!0}),e),fl={};YT(fl,{analyzeMetafile:()=>A2,analyzeMetafileSync:()=>N2,build:()=>P2,buildSync:()=>R2,context:()=>j2,default:()=>M2,formatMessages:()=>_2,formatMessagesSync:()=>C2,initialize:()=>I2,stop:()=>T2,transform:()=>k2,transformSync:()=>O2,version:()=>E2});L0.exports=ZT(fl);function h0(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(mn(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(mn(i)),t(n[i])}},r=new P0;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),_p(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function QT(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return zi(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[zi(r.read())]=t();return a}default:throw Error("Invalid packet")}},r=new P0(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 P0=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);_p(this.buf,e,t)}write(e){let t=this._write(4+e.length);_p(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 j0(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}},mn,zi,kp;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;mn=(r)=>e.encode(r),zi=(r)=>t.decode(r),kp='new TextEncoder().encode("")'}else if(typeof Buffer<"u")mn=(e)=>Buffer.from(e),zi=(e)=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},kp='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(mn("")instanceof Uint8Array))throw Error(`Invariant violation: "${kp} instanceof Uint8Array" is incorrectly false
7
51
 
8
52
  This indicates that your JavaScript environment is broken. You cannot use
9
53
  esbuild in this environment because esbuild relies on this invariant. This
10
54
  is not a problem with esbuild. You need to fix your environment instead.
11
- `);function jh(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Cu(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var kn=String.fromCharCode;function vr(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 ${kn(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 UR(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 u;if(o===2&&i===null&&c!==34&&c!==125)vr(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)vr(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)vr(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)vr(e,--l);u=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;u=kn(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:{u+=kn(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))vr(e,--p,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)vr(e,s);if(c=e[l++],c===34)break;else if(c===92)switch(e[l++]){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
12
- `;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let p=0;for(let g=0;g<4;g++)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 vr(e,--l);u+=kn(p);break}default:vr(e,--l);break}else if(c<=127)u+=kn(c);else if((c&224)===192)u+=kn((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=kn((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,u+=kn(p>>10&1023|55296),p=56320|p&1023;u+=kn(p)}}u[0];break}case 91:{u=[],t.push(i),r.push(a),n.push(o),i=null,a=u,o=1;continue}case 123:{u={},t.push(i),r.push(a),n.push(o),i=null,a=u,o=2;continue}case 93:{if(o!==1)vr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}case 125:{if(o!==2)vr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}default:vr(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(o){case 0:{if(l===s)return u;break}case 1:{if(a.push(u),c===44){l++;continue}if(c===93)continue;break}case 2:{if(i===null){if(i=u,c===58){l++;continue}}else{if(a[i]=u,i=null,c===44){l++;continue}if(c===125)continue}break}}break}vr(e,l)}var gt=JSON.stringify,gh="warning",yh="silent";function hi(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 qa=()=>null,Xe=(e)=>typeof e==="boolean"?null:"a boolean",ie=(e)=>typeof e==="string"?null:"a string",Ha=(e)=>e instanceof RegExp?null:"a RegExp object",Ls=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",zR=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",kh=(e)=>typeof e==="function"?null:"a function",_n=(e)=>Array.isArray(e)?null:"an array",er=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",yr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",GR=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",KR=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",bh=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",_h=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",YR=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Rh=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",Ah=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",XR=(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(`${gt(r)} must be ${i}`);return s}function ft(e,t,r){for(let n in e)if(!(n in t))throw Error(`Invalid option ${r}: ${gt(n)}`)}function ZR(e){let t=Object.create(null),r=N(e,t,"wasmURL",XR),n=N(e,t,"wasmModule",KR),s=N(e,t,"worker",Xe);return ft(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:s}}function Oh(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 ${gt(r)} in mangle cache to map to either a string or false`)}}return t}function za(e,t,r,n,s){let i=N(t,r,"color",Xe),o=N(t,r,"logLevel",ie),a=N(t,r,"logLimit",Ls),l=N(t,r,"logStyle",ie);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?" "+gt(r):""} to be a string, got ${typeof e} instead`);return e}function Ch(e,t,r){let n=N(t,r,"legalComments",ie),s=N(t,r,"sourceRoot",ie),i=N(t,r,"sourcesContent",Xe),o=N(t,r,"target",Rh),a=N(t,r,"format",ie),l=N(t,r,"globalName",ie),c=N(t,r,"mangleProps",Ha),u=N(t,r,"reserveProps",Ha),p=N(t,r,"mangleQuoted",Xe),g=N(t,r,"minify",Xe),m=N(t,r,"minifySyntax",Xe),b=N(t,r,"minifyWhitespace",Xe),h=N(t,r,"minifyIdentifiers",Xe),y=N(t,r,"lineLimit",Ls),v=N(t,r,"drop",er),k=N(t,r,"dropLabels",er),S=N(t,r,"charset",ie),E=N(t,r,"treeShaking",Xe),j=N(t,r,"ignoreAnnotations",Xe),R=N(t,r,"jsx",ie),A=N(t,r,"jsxFactory",ie),_=N(t,r,"jsxFragment",ie),I=N(t,r,"jsxImportSource",ie),D=N(t,r,"jsxDev",Xe),M=N(t,r,"jsxSideEffects",Xe),L=N(t,r,"define",yr),G=N(t,r,"logOverride",yr),ae=N(t,r,"supported",yr),me=N(t,r,"pure",er),ce=N(t,r,"keepNames",Xe),se=N(t,r,"platform",ie),ue=N(t,r,"tsconfigRaw",YR),Re=N(t,r,"absPaths",er);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=${hi(Array.isArray(o)?o:[o],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(se)e.push(`--platform=${se}`);if(ue)e.push(`--tsconfig-raw=${typeof ue==="string"?ue:JSON.stringify(ue)}`);if(g)e.push("--minify");if(m)e.push("--minify-syntax");if(b)e.push("--minify-whitespace");if(h)e.push("--minify-identifiers");if(y)e.push(`--line-limit=${y}`);if(S)e.push(`--charset=${S}`);if(E!==void 0)e.push(`--tree-shaking=${E}`);if(j)e.push("--ignore-annotations");if(v)for(let K of v)e.push(`--drop:${Qt(K,"drop")}`);if(k)e.push(`--drop-labels=${hi(k,"drop label")}`);if(Re)e.push(`--abs-paths=${hi(Re,"abs paths")}`);if(c)e.push(`--mangle-props=${Va(c)}`);if(u)e.push(`--reserve-props=${Va(u)}`);if(p!==void 0)e.push(`--mangle-quoted=${p}`);if(R)e.push(`--jsx=${R}`);if(A)e.push(`--jsx-factory=${A}`);if(_)e.push(`--jsx-fragment=${_}`);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 K in L){if(K.indexOf("=")>=0)throw Error(`Invalid define: ${K}`);e.push(`--define:${K}=${Qt(L[K],"define",K)}`)}if(G)for(let K in G){if(K.indexOf("=")>=0)throw Error(`Invalid log override: ${K}`);e.push(`--log-override:${K}=${Qt(G[K],"log override",K)}`)}if(ae)for(let K in ae){if(K.indexOf("=")>=0)throw Error(`Invalid supported: ${K}`);let Se=ae[K];if(typeof Se!=="boolean")throw Error(`Expected value for supported ${gt(K)} to be a boolean, got ${typeof Se} instead`);e.push(`--supported:${K}=${Se}`)}if(me)for(let K of me)e.push(`--pure:${Qt(K,"pure")}`);if(ce)e.push("--keep-names")}function QR(e,t,r,n,s){var i;let o=[],a=[],l=Object.create(null),c=null,u=null;za(o,t,l,r,n),Ch(o,t,l);let p=N(t,l,"sourcemap",_h),g=N(t,l,"bundle",Xe),m=N(t,l,"splitting",Xe),b=N(t,l,"preserveSymlinks",Xe),h=N(t,l,"metafile",Xe),y=N(t,l,"outfile",ie),v=N(t,l,"outdir",ie),k=N(t,l,"outbase",ie),S=N(t,l,"tsconfig",ie),E=N(t,l,"resolveExtensions",er),j=N(t,l,"nodePaths",er),R=N(t,l,"mainFields",er),A=N(t,l,"conditions",er),_=N(t,l,"external",er),I=N(t,l,"packages",ie),D=N(t,l,"alias",yr),M=N(t,l,"loader",yr),L=N(t,l,"outExtension",yr),G=N(t,l,"publicPath",ie),ae=N(t,l,"entryNames",ie),me=N(t,l,"chunkNames",ie),ce=N(t,l,"assetNames",ie),se=N(t,l,"inject",er),ue=N(t,l,"banner",yr),Re=N(t,l,"footer",yr),K=N(t,l,"entryPoints",GR),Se=N(t,l,"absWorkingDir",ie),oe=N(t,l,"stdin",yr),V=(i=N(t,l,"write",Xe))!=null?i:s,Ye=N(t,l,"allowOverwrite",Xe),de=N(t,l,"mangleCache",yr);if(l.plugins=!0,ft(t,l,`in ${e}() call`),p)o.push(`--sourcemap${p===!0?"":`=${p}`}`);if(g)o.push("--bundle");if(Ye)o.push("--allow-overwrite");if(m)o.push("--splitting");if(b)o.push("--preserve-symlinks");if(h)o.push("--metafile");if(y)o.push(`--outfile=${y}`);if(v)o.push(`--outdir=${v}`);if(k)o.push(`--outbase=${k}`);if(S)o.push(`--tsconfig=${S}`);if(I)o.push(`--packages=${I}`);if(E)o.push(`--resolve-extensions=${hi(E,"resolve extension")}`);if(G)o.push(`--public-path=${G}`);if(ae)o.push(`--entry-names=${ae}`);if(me)o.push(`--chunk-names=${me}`);if(ce)o.push(`--asset-names=${ce}`);if(R)o.push(`--main-fields=${hi(R,"main field")}`);if(A)o.push(`--conditions=${hi(A,"condition")}`);if(_)for(let Y of _)o.push(`--external:${Qt(Y,"external")}`);if(D)for(let Y in D){if(Y.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${Y}`);o.push(`--alias:${Y}=${Qt(D[Y],"alias",Y)}`)}if(ue)for(let Y in ue){if(Y.indexOf("=")>=0)throw Error(`Invalid banner file type: ${Y}`);o.push(`--banner:${Y}=${Qt(ue[Y],"banner",Y)}`)}if(Re)for(let Y in Re){if(Y.indexOf("=")>=0)throw Error(`Invalid footer file type: ${Y}`);o.push(`--footer:${Y}=${Qt(Re[Y],"footer",Y)}`)}if(se)for(let Y of se)o.push(`--inject:${Qt(Y,"inject")}`);if(M)for(let Y in M){if(Y.indexOf("=")>=0)throw Error(`Invalid loader extension: ${Y}`);o.push(`--loader:${Y}=${Qt(M[Y],"loader",Y)}`)}if(L)for(let Y in L){if(Y.indexOf("=")>=0)throw Error(`Invalid out extension: ${Y}`);o.push(`--out-extension:${Y}=${Qt(L[Y],"out extension",Y)}`)}if(K)if(Array.isArray(K))for(let Y=0,pt=K.length;Y<pt;Y++){let We=K[Y];if(typeof We==="object"&&We!==null){let At=Object.create(null),ut=N(We,At,"in",ie),bt=N(We,At,"out",ie);if(ft(We,At,"in entry point at index "+Y),ut===void 0)throw Error('Missing property "in" for entry point at index '+Y);if(bt===void 0)throw Error('Missing property "out" for entry point at index '+Y);a.push([bt,ut])}else a.push(["",Qt(We,"entry point at index "+Y)])}else for(let Y in K)a.push([Y,Qt(K[Y],"entry point",Y)]);if(oe){let Y=Object.create(null),pt=N(oe,Y,"contents",Ah),We=N(oe,Y,"resolveDir",ie),At=N(oe,Y,"sourcefile",ie),ut=N(oe,Y,"loader",ie);if(ft(oe,Y,'in "stdin" object'),At)o.push(`--sourcefile=${At}`);if(ut)o.push(`--loader=${ut}`);if(We)u=We;if(typeof pt==="string")c=Mr(pt);else if(pt instanceof Uint8Array)c=pt}let ct=[];if(j)for(let Y of j)Y+="",ct.push(Y);return{entries:a,flags:o,write:V,stdinContents:c,stdinResolveDir:u,absWorkingDir:Se,nodePaths:ct,mangleCache:Oh(de)}}function eA(e,t,r,n){let s=[],i=Object.create(null);za(s,t,i,r,n),Ch(s,t,i);let o=N(t,i,"sourcemap",_h),a=N(t,i,"sourcefile",ie),l=N(t,i,"loader",ie),c=N(t,i,"banner",ie),u=N(t,i,"footer",ie),p=N(t,i,"mangleCache",yr);if(ft(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(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:Oh(p)}}function Nh(e){let t={},r={didClose:!1,reason:""},n={},s=0,i=0,o=new Uint8Array(16384),a=0,l=(S)=>{let E=a+S.length;if(E>o.length){let R=new Uint8Array(E*2);R.set(o),o=R}o.set(S,a),a+=S.length;let j=0;while(j+4<=a){let R=jh(o,j);if(j+4+R>a)break;j+=4,b(o.subarray(j,j+R)),j+=R}if(j>0)o.copyWithin(0,j,a),a-=j},c=(S)=>{if(r.didClose=!0,S)r.reason=": "+(S.message||S);let E="The service was stopped"+r.reason;for(let j in n)n[j](E,null);n={}},u=(S,E,j)=>{if(r.didClose)return j("The service is no longer running"+r.reason,null);let R=s++;if(n[R]=(A,_)=>{try{j(A,_)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(hh({id:R,isRequest:!0,value:E}))},p=(S,E)=>{if(r.didClose)throw Error("The service is no longer running"+r.reason);e.writeToStdin(hh({id:S,isRequest:!1,value:E}))},g=async(S,E)=>{try{if(E.command==="ping"){p(S,{});return}if(typeof E.key==="number"){let j=t[E.key];if(!j)return;let R=j[E.command];if(R){await R(S,E);return}}throw Error("Invalid command: "+E.command)}catch(j){let R=[Ds(j,e,null,void 0,"")];try{p(S,{errors:R})}catch{}}},m=!0,b=(S)=>{if(m){m=!1;let j=String.fromCharCode(...S);if(j!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${gt(j)}`);return}let E=WR(S);if(E.isRequest)g(E.id,E.value);else{let j=n[E.id];if(delete n[E.id],E.value.error)j(E.value.error,{});else j(null,E.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:E,options:j,isTTY:R,defaultWD:A,callback:_})=>{let I=0,D=i++,M={},L={ref(){if(++I===1){if(E)E.ref()}},unref(){if(--I===0){if(delete t[D],E)E.unref()}}};t[D]=M,L.ref(),tA(S,D,u,p,L,e,M,j,R,A,(G,ae)=>{try{_(G,ae)}finally{L.unref()}})},transform:({callName:S,refs:E,input:j,options:R,isTTY:A,fs:_,callback:I})=>{let D=Th(),M=(L)=>{try{if(typeof j!=="string"&&!(j instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:G,mangleCache:ae}=eA(S,R,A,yh),me={command:"transform",flags:G,inputFS:L!==null,input:L!==null?Mr(L):typeof j==="string"?Mr(j):j};if(ae)me.mangleCache=ae;u(E,me,(ce,se)=>{if(ce)return I(Error(ce),null);let ue=gi(se.errors,D),Re=gi(se.warnings,D),K=1,Se=()=>{if(--K===0){let oe={warnings:Re,code:se.code,map:se.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in se)oe.legalComments=se==null?void 0:se.legalComments;if(se.mangleCache)oe.mangleCache=se==null?void 0:se.mangleCache;I(null,oe)}};if(ue.length>0)return I(_o("Transform failed",ue,Re),null);if(se.codeFS)K++,_.readFile(se.code,(oe,V)=>{if(oe!==null)I(oe,null);else se.code=V,Se()});if(se.mapFS)K++,_.readFile(se.map,(oe,V)=>{if(oe!==null)I(oe,null);else se.map=V,Se()});Se()})}catch(G){let ae=[];try{za(ae,R,{},A,yh)}catch{}let me=Ds(G,e,D,void 0,"");u(E,{command:"error",flags:ae,error:me},()=>{me.detail=D.load(me.detail),I(_o("Transform failed",[me],[]),null)})}};if((typeof j==="string"||j instanceof Uint8Array)&&j.length>1048576){let L=M;M=()=>_.writeFile(j,L)}M(null)},formatMessages:({callName:S,refs:E,messages:j,options:R,callback:A})=>{if(!R)throw Error(`Missing second argument in ${S}() call`);let _={},I=N(R,_,"kind",ie),D=N(R,_,"color",Xe),M=N(R,_,"terminalWidth",Ls),L=N(R,_,"logStyle",ie);if(ft(R,_,`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 G={command:"format-msgs",messages:Rn(j,"messages",null,"",M),isWarning:I==="warning"};if(D!==void 0)G.color=D;if(M!==void 0)G.terminalWidth=M;if(L!==void 0)G.logStyle=L;u(E,G,(ae,me)=>{if(ae)return A(Error(ae),null);A(null,me.messages)})},analyzeMetafile:({callName:S,refs:E,metafile:j,options:R,callback:A})=>{if(R===void 0)R={};let _={},I=N(R,_,"color",Xe),D=N(R,_,"verbose",Xe);ft(R,_,`in ${S}() call`);let M={command:"analyze-metafile",metafile:j};if(I!==void 0)M.color=I;if(D!==void 0)M.verbose=D;u(E,M,(L,G)=>{if(L)return A(Error(L),null);A(null,G.result)})}}}}function tA(e,t,r,n,s,i,o,a,l,c,u){let p=Th(),g=e==="context",m=(y,v)=>{let k=[];try{za(k,a,{},l,gh)}catch{}let S=Ds(y,i,p,void 0,v);r(s,{command:"error",flags:k,error:S},()=>{S.detail=p.load(S.detail),u(_o(g?"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"),"");rA(t,r,n,s,i,o,a,b,p).then((y)=>{if(!y.ok)return m(y.error,y.pluginName);try{h(y.requestPlugins,y.runOnEndCallbacks,y.scheduleOnDisposeCallbacks)}catch(v){m(v,"")}},(y)=>m(y,""));return}try{h(null,(y,v)=>v([],[]),()=>{})}catch(y){m(y,"")}function h(y,v,k){let S=i.hasFS,{entries:E,flags:j,write:R,stdinContents:A,stdinResolveDir:_,absWorkingDir:I,nodePaths:D,mangleCache:M}=QR(e,a,l,gh,S);if(R&&!i.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:E,flags:j,write:R,stdinContents:A,stdinResolveDir:_,absWorkingDir:I||c,nodePaths:D,context:g};if(y)L.plugins=y;if(M)L.mangleCache=M;let G=(ce,se)=>{let ue={errors:gi(ce.errors,p),warnings:gi(ce.warnings,p),outputFiles:void 0,metafile:void 0,mangleCache:void 0},Re=ue.errors.slice(),K=ue.warnings.slice();if(ce.outputFiles)ue.outputFiles=ce.outputFiles.map(sA);if(ce.metafile&&ce.metafile.length)ue.metafile=iA(ce.metafile);if(ce.mangleCache)ue.mangleCache=ce.mangleCache;if(ce.writeToStdout!==void 0)console.log(Hs(ce.writeToStdout).replace(/\n$/,""));v(ue,(Se,oe)=>{if(Re.length>0||Se.length>0){let V=_o("Build failed",Re.concat(Se),K.concat(oe));return se(V,null,Se,oe)}se(null,ue,Se,oe)})},ae,me;if(g)o["on-end"]=(ce,se)=>new Promise((ue)=>{G(se,(Re,K,Se,oe)=>{let V={errors:Se,warnings:oe};if(me)me(Re,K);ae=void 0,me=void 0,n(ce,V),ue()})});r(s,L,(ce,se)=>{if(ce)return u(Error(ce),null);if(!g)return G(se,(K,Se)=>(k(),u(K,Se)));if(se.errors.length>0)return u(_o("Context failed",se.errors,se.warnings),null);let ue=!1,Re={rebuild:()=>{if(!ae)ae=new Promise((K,Se)=>{let oe;me=(Ye,de)=>{if(!oe)oe=()=>Ye?Se(Ye):K(de)};let V=()=>{r(s,{command:"rebuild",key:t},(de,ct)=>{if(de)Se(Error(de));else if(oe)oe();else V()})};V()});return ae},watch:(K={})=>new Promise((Se,oe)=>{if(!i.hasFS)throw Error('Cannot use the "watch" API in this environment');let V={},Ye=N(K,V,"delay",Ls);ft(K,V,"in watch() call");let de={command:"watch",key:t};if(Ye)de.delay=Ye;r(s,de,(ct)=>{if(ct)oe(Error(ct));else Se(void 0)})}),serve:(K={})=>new Promise((Se,oe)=>{if(!i.hasFS)throw Error('Cannot use the "serve" API in this environment');let V={},Ye=N(K,V,"port",zR),de=N(K,V,"host",ie),ct=N(K,V,"servedir",ie),Y=N(K,V,"keyfile",ie),pt=N(K,V,"certfile",ie),We=N(K,V,"fallback",ie),At=N(K,V,"cors",yr),ut=N(K,V,"onRequest",kh);ft(K,V,"in serve() call");let bt={command:"serve",key:t,onRequest:!!ut};if(Ye!==void 0)bt.port=Ye;if(de!==void 0)bt.host=de;if(ct!==void 0)bt.servedir=ct;if(Y!==void 0)bt.keyfile=Y;if(pt!==void 0)bt.certfile=pt;if(We!==void 0)bt.fallback=We;if(At){let Ot={},jt=N(At,Ot,"origin",Rh);if(ft(At,Ot,'on "cors" object'),Array.isArray(jt))bt.corsOrigin=jt;else if(jt!==void 0)bt.corsOrigin=[jt]}r(s,bt,(Ot,jt)=>{if(Ot)return oe(Error(Ot));if(ut)o["serve-request"]=(bn,xn)=>{ut(xn.args),n(bn,{})};Se(jt)})}),cancel:()=>new Promise((K)=>{if(ue)return K();r(s,{command:"cancel",key:t},()=>{K()})}),dispose:()=>new Promise((K)=>{if(ue)return K();ue=!0,r(s,{command:"dispose",key:t},()=>{K(),k(),s.unref()})})};s.ref(),u(null,Re)})}}var rA=async(e,t,r,n,s,i,o,a,l)=>{let c=[],u=[],p={},g={},m=[],b=0,h=0,y=[],v=!1;a=[...a];for(let E of a){let j={};if(typeof E!=="object")throw Error(`Plugin at index ${h} must be an object`);let R=N(E,j,"name",ie);if(typeof R!=="string"||R==="")throw Error(`Plugin at index ${h} is missing a name`);try{let A=N(E,j,"setup",kh);if(typeof A!=="function")throw Error("Plugin is missing a setup function");ft(E,j,`on plugin ${gt(R)}`);let _={name:R,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};h++;let D=A({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 G=Object.create(null),ae=N(L,G,"pluginName",ie),me=N(L,G,"importer",ie),ce=N(L,G,"namespace",ie),se=N(L,G,"resolveDir",ie),ue=N(L,G,"kind",ie),Re=N(L,G,"pluginData",qa),K=N(L,G,"with",yr);return ft(L,G,"in resolve() call"),new Promise((Se,oe)=>{let V={command:"resolve",path:M,key:e,pluginName:R};if(ae!=null)V.pluginName=ae;if(me!=null)V.importer=me;if(ce!=null)V.namespace=ce;if(se!=null)V.resolveDir=se;if(ue!=null)V.kind=ue;else throw Error('Must specify "kind" when calling "resolve"');if(Re!=null)V.pluginData=l.store(Re);if(K!=null)V.with=nA(K,"with");t(n,V,(Ye,de)=>{if(Ye!==null)oe(Error(Ye));else Se({errors:gi(de.errors,l),warnings:gi(de.warnings,l),path:de.path,external:de.external,sideEffects:de.sideEffects,namespace:de.namespace,suffix:de.suffix,pluginData:l.load(de.pluginData)})})})},onStart(M){let G=La(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:R,callback:M,note:G}),_.onStart=!0},onEnd(M){let G=La(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:R,callback:M,note:G}),_.onEnd=!0},onResolve(M,L){let ae=La(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),me={},ce=N(M,me,"filter",Ha),se=N(M,me,"namespace",ie);if(ft(M,me,`in onResolve() call for plugin ${gt(R)}`),ce==null)throw Error("onResolve() call is missing a filter");let ue=b++;p[ue]={name:R,callback:L,note:ae},_.onResolve.push({id:ue,filter:Va(ce),namespace:se||""})},onLoad(M,L){let ae=La(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),me={},ce=N(M,me,"filter",Ha),se=N(M,me,"namespace",ie);if(ft(M,me,`in onLoad() call for plugin ${gt(R)}`),ce==null)throw Error("onLoad() call is missing a filter");let ue=b++;g[ue]={name:R,callback:L,note:ae},_.onLoad.push({id:ue,filter:Va(ce),namespace:se||""})},onDispose(M){m.push(M)},esbuild:s.esbuild});if(D)await D;y.push(_)}catch(A){return{ok:!1,error:A,pluginName:R}}}i["on-start"]=async(E,j)=>{l.clear();let R={errors:[],warnings:[]};await Promise.all(c.map(async({name:A,callback:_,note:I})=>{try{let D=await _();if(D!=null){if(typeof D!=="object")throw Error(`Expected onStart() callback in plugin ${gt(A)} to return an object`);let M={},L=N(D,M,"errors",_n),G=N(D,M,"warnings",_n);if(ft(D,M,`from onStart() callback in plugin ${gt(A)}`),L!=null)R.errors.push(...Rn(L,"errors",l,A,void 0));if(G!=null)R.warnings.push(...Rn(G,"warnings",l,A,void 0))}}catch(D){R.errors.push(Ds(D,s,l,I&&I(),A))}})),r(E,R)},i["on-resolve"]=async(E,j)=>{let R={},A="",_,I;for(let D of j.ids)try{({name:A,callback:_,note:I}=p[D]);let M=await _({path:j.path,importer:j.importer,namespace:j.namespace,resolveDir:j.resolveDir,kind:j.kind,pluginData:l.load(j.pluginData),with:j.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onResolve() callback in plugin ${gt(A)} to return an object`);let L={},G=N(M,L,"pluginName",ie),ae=N(M,L,"path",ie),me=N(M,L,"namespace",ie),ce=N(M,L,"suffix",ie),se=N(M,L,"external",Xe),ue=N(M,L,"sideEffects",Xe),Re=N(M,L,"pluginData",qa),K=N(M,L,"errors",_n),Se=N(M,L,"warnings",_n),oe=N(M,L,"watchFiles",er),V=N(M,L,"watchDirs",er);if(ft(M,L,`from onResolve() callback in plugin ${gt(A)}`),R.id=D,G!=null)R.pluginName=G;if(ae!=null)R.path=ae;if(me!=null)R.namespace=me;if(ce!=null)R.suffix=ce;if(se!=null)R.external=se;if(ue!=null)R.sideEffects=ue;if(Re!=null)R.pluginData=l.store(Re);if(K!=null)R.errors=Rn(K,"errors",l,A,void 0);if(Se!=null)R.warnings=Rn(Se,"warnings",l,A,void 0);if(oe!=null)R.watchFiles=Fa(oe,"watchFiles");if(V!=null)R.watchDirs=Fa(V,"watchDirs");break}}catch(M){R={id:D,errors:[Ds(M,s,l,I&&I(),A)]};break}r(E,R)},i["on-load"]=async(E,j)=>{let R={},A="",_,I;for(let D of j.ids)try{({name:A,callback:_,note:I}=g[D]);let M=await _({path:j.path,namespace:j.namespace,suffix:j.suffix,pluginData:l.load(j.pluginData),with:j.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onLoad() callback in plugin ${gt(A)} to return an object`);let L={},G=N(M,L,"pluginName",ie),ae=N(M,L,"contents",Ah),me=N(M,L,"resolveDir",ie),ce=N(M,L,"pluginData",qa),se=N(M,L,"loader",ie),ue=N(M,L,"errors",_n),Re=N(M,L,"warnings",_n),K=N(M,L,"watchFiles",er),Se=N(M,L,"watchDirs",er);if(ft(M,L,`from onLoad() callback in plugin ${gt(A)}`),R.id=D,G!=null)R.pluginName=G;if(ae instanceof Uint8Array)R.contents=ae;else if(ae!=null)R.contents=Mr(ae);if(me!=null)R.resolveDir=me;if(ce!=null)R.pluginData=l.store(ce);if(se!=null)R.loader=se;if(ue!=null)R.errors=Rn(ue,"errors",l,A,void 0);if(Re!=null)R.warnings=Rn(Re,"warnings",l,A,void 0);if(K!=null)R.watchFiles=Fa(K,"watchFiles");if(Se!=null)R.watchDirs=Fa(Se,"watchDirs");break}}catch(M){R={id:D,errors:[Ds(M,s,l,I&&I(),A)]};break}r(E,R)};let k=(E,j)=>j([],[]);if(u.length>0)k=(E,j)=>{(async()=>{let R=[],A=[];for(let{name:_,callback:I,note:D}of u){let M,L;try{let G=await I(E);if(G!=null){if(typeof G!=="object")throw Error(`Expected onEnd() callback in plugin ${gt(_)} to return an object`);let ae={},me=N(G,ae,"errors",_n),ce=N(G,ae,"warnings",_n);if(ft(G,ae,`from onEnd() callback in plugin ${gt(_)}`),me!=null)M=Rn(me,"errors",l,_,void 0);if(ce!=null)L=Rn(ce,"warnings",l,_,void 0)}}catch(G){M=[Ds(G,s,l,D&&D(),_)]}if(M){R.push(...M);try{E.errors.push(...M)}catch{}}if(L){A.push(...L);try{E.warnings.push(...L)}catch{}}}j(R,A)})()};let S=()=>{for(let E of m)setTimeout(()=>E(),0)};return v=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:k,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 La(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=Ih(t,i,r);if(o)return n={text:e.message,location:o},n}catch{}}}function Ds(e,t,r,n,s){let i="Internal error",o=null;try{i=(e&&e.message||e)+""}catch{}try{o=Ih(t,(e.stack+"").split(`
14
- `),"")}catch{}return{id:"",pluginName:s,text:i,location:o,notes:n?[n]:[],detail:r?r.store(e):-1}}function Ih(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,u=l.slice(c,c+r.length)===r?r.length:0;return{file:o[1],namespace:"file",line:+o[2],column:Mr(l.slice(0,c)).length,length:Mr(l.slice(c,c+u)).length,lineText:l+`
55
+ `);function j0(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function _p(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var hs=String.fromCharCode;function zr(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 ${hs(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 e2(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 u;if(o===2&&i===null&&c!==34&&c!==125)zr(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)zr(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)zr(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)zr(e,--l);u=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;u=hs(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:{u+=hs(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))zr(e,--p,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)zr(e,s);if(c=e[l++],c===34)break;else if(c===92)switch(e[l++]){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
56
+ `;break;case 114:u+="\r";break;case 116:u+="\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 zr(e,--l);u+=hs(p);break}default:zr(e,--l);break}else if(c<=127)u+=hs(c);else if((c&224)===192)u+=hs((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=hs((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,u+=hs(p>>10&1023|55296),p=56320|p&1023;u+=hs(p)}}u[0];break}case 91:{u=[],t.push(i),r.push(a),n.push(o),i=null,a=u,o=1;continue}case 123:{u={},t.push(i),r.push(a),n.push(o),i=null,a=u,o=2;continue}case 93:{if(o!==1)zr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}case 125:{if(o!==2)zr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}default:zr(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(o){case 0:{if(l===s)return u;break}case 1:{if(a.push(u),c===44){l++;continue}if(c===93)continue;break}case 2:{if(i===null){if(i=u,c===58){l++;continue}}else{if(a[i]=u,i=null,c===44){l++;continue}if(c===125)continue}break}}break}zr(e,l)}var At=JSON.stringify,g0="warning",y0="silent";function Mo(e,t){let r=[];for(let n of e){if(wr(n,t),n.indexOf(",")>=0)throw Error(`Invalid ${t}: ${n}`);r.push(n)}return r.join(",")}var Zc=()=>null,at=(e)=>typeof e==="boolean"?null:"a boolean",ie=(e)=>typeof e==="string"?null:"a string",Qc=(e)=>e instanceof RegExp?null:"a RegExp object",Hi=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",t2=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",k0=(e)=>typeof e==="function"?null:"a function",gs=(e)=>Array.isArray(e)?null:"an array",vr=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Fr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",r2=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",n2=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",b0=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",_0=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",s2=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",A0=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",R0=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",i2=(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(`${At(r)} must be ${i}`);return s}function St(e,t,r){for(let n in e)if(!(n in t))throw Error(`Invalid option ${r}: ${At(n)}`)}function o2(e){let t=Object.create(null),r=T(e,t,"wasmURL",i2),n=T(e,t,"wasmModule",n2),s=T(e,t,"worker",at);return St(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:s}}function O0(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 ${At(r)} in mangle cache to map to either a string or false`)}}return t}function su(e,t,r,n,s){let i=T(t,r,"color",at),o=T(t,r,"logLevel",ie),a=T(t,r,"logLimit",Hi),l=T(t,r,"logStyle",ie);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 wr(e,t,r){if(typeof e!=="string")throw Error(`Expected value for ${t}${r!==void 0?" "+At(r):""} to be a string, got ${typeof e} instead`);return e}function C0(e,t,r){let n=T(t,r,"legalComments",ie),s=T(t,r,"sourceRoot",ie),i=T(t,r,"sourcesContent",at),o=T(t,r,"target",A0),a=T(t,r,"format",ie),l=T(t,r,"globalName",ie),c=T(t,r,"mangleProps",Qc),u=T(t,r,"reserveProps",Qc),p=T(t,r,"mangleQuoted",at),h=T(t,r,"minify",at),m=T(t,r,"minifySyntax",at),b=T(t,r,"minifyWhitespace",at),g=T(t,r,"minifyIdentifiers",at),y=T(t,r,"lineLimit",Hi),w=T(t,r,"drop",vr),P=T(t,r,"dropLabels",vr),S=T(t,r,"charset",ie),E=T(t,r,"treeShaking",at),k=T(t,r,"ignoreAnnotations",at),A=T(t,r,"jsx",ie),R=T(t,r,"jsxFactory",ie),_=T(t,r,"jsxFragment",ie),I=T(t,r,"jsxImportSource",ie),L=T(t,r,"jsxDev",at),J=T(t,r,"jsxSideEffects",at),F=T(t,r,"define",Fr),K=T(t,r,"logOverride",Fr),ae=T(t,r,"supported",Fr),me=T(t,r,"pure",vr),ce=T(t,r,"keepNames",at),se=T(t,r,"platform",ie),ue=T(t,r,"tsconfigRaw",s2),Ce=T(t,r,"absPaths",vr);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=${Mo(Array.isArray(o)?o:[o],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(se)e.push(`--platform=${se}`);if(ue)e.push(`--tsconfig-raw=${typeof ue==="string"?ue:JSON.stringify(ue)}`);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(E!==void 0)e.push(`--tree-shaking=${E}`);if(k)e.push("--ignore-annotations");if(w)for(let Y of w)e.push(`--drop:${wr(Y,"drop")}`);if(P)e.push(`--drop-labels=${Mo(P,"drop label")}`);if(Ce)e.push(`--abs-paths=${Mo(Ce,"abs paths")}`);if(c)e.push(`--mangle-props=${eu(c)}`);if(u)e.push(`--reserve-props=${eu(u)}`);if(p!==void 0)e.push(`--mangle-quoted=${p}`);if(A)e.push(`--jsx=${A}`);if(R)e.push(`--jsx-factory=${R}`);if(_)e.push(`--jsx-fragment=${_}`);if(I)e.push(`--jsx-import-source=${I}`);if(L)e.push("--jsx-dev");if(J)e.push("--jsx-side-effects");if(F)for(let Y in F){if(Y.indexOf("=")>=0)throw Error(`Invalid define: ${Y}`);e.push(`--define:${Y}=${wr(F[Y],"define",Y)}`)}if(K)for(let Y in K){if(Y.indexOf("=")>=0)throw Error(`Invalid log override: ${Y}`);e.push(`--log-override:${Y}=${wr(K[Y],"log override",Y)}`)}if(ae)for(let Y in ae){if(Y.indexOf("=")>=0)throw Error(`Invalid supported: ${Y}`);let Ee=ae[Y];if(typeof Ee!=="boolean")throw Error(`Expected value for supported ${At(Y)} to be a boolean, got ${typeof Ee} instead`);e.push(`--supported:${Y}=${Ee}`)}if(me)for(let Y of me)e.push(`--pure:${wr(Y,"pure")}`);if(ce)e.push("--keep-names")}function a2(e,t,r,n,s){var i;let o=[],a=[],l=Object.create(null),c=null,u=null;su(o,t,l,r,n),C0(o,t,l);let p=T(t,l,"sourcemap",_0),h=T(t,l,"bundle",at),m=T(t,l,"splitting",at),b=T(t,l,"preserveSymlinks",at),g=T(t,l,"metafile",at),y=T(t,l,"outfile",ie),w=T(t,l,"outdir",ie),P=T(t,l,"outbase",ie),S=T(t,l,"tsconfig",ie),E=T(t,l,"resolveExtensions",vr),k=T(t,l,"nodePaths",vr),A=T(t,l,"mainFields",vr),R=T(t,l,"conditions",vr),_=T(t,l,"external",vr),I=T(t,l,"packages",ie),L=T(t,l,"alias",Fr),J=T(t,l,"loader",Fr),F=T(t,l,"outExtension",Fr),K=T(t,l,"publicPath",ie),ae=T(t,l,"entryNames",ie),me=T(t,l,"chunkNames",ie),ce=T(t,l,"assetNames",ie),se=T(t,l,"inject",vr),ue=T(t,l,"banner",Fr),Ce=T(t,l,"footer",Fr),Y=T(t,l,"entryPoints",r2),Ee=T(t,l,"absWorkingDir",ie),oe=T(t,l,"stdin",Fr),W=(i=T(t,l,"write",at))!=null?i:s,ot=T(t,l,"allowOverwrite",at),de=T(t,l,"mangleCache",Fr);if(l.plugins=!0,St(t,l,`in ${e}() call`),p)o.push(`--sourcemap${p===!0?"":`=${p}`}`);if(h)o.push("--bundle");if(ot)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(w)o.push(`--outdir=${w}`);if(P)o.push(`--outbase=${P}`);if(S)o.push(`--tsconfig=${S}`);if(I)o.push(`--packages=${I}`);if(E)o.push(`--resolve-extensions=${Mo(E,"resolve extension")}`);if(K)o.push(`--public-path=${K}`);if(ae)o.push(`--entry-names=${ae}`);if(me)o.push(`--chunk-names=${me}`);if(ce)o.push(`--asset-names=${ce}`);if(A)o.push(`--main-fields=${Mo(A,"main field")}`);if(R)o.push(`--conditions=${Mo(R,"condition")}`);if(_)for(let X of _)o.push(`--external:${wr(X,"external")}`);if(L)for(let X in L){if(X.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${X}`);o.push(`--alias:${X}=${wr(L[X],"alias",X)}`)}if(ue)for(let X in ue){if(X.indexOf("=")>=0)throw Error(`Invalid banner file type: ${X}`);o.push(`--banner:${X}=${wr(ue[X],"banner",X)}`)}if(Ce)for(let X in Ce){if(X.indexOf("=")>=0)throw Error(`Invalid footer file type: ${X}`);o.push(`--footer:${X}=${wr(Ce[X],"footer",X)}`)}if(se)for(let X of se)o.push(`--inject:${wr(X,"inject")}`);if(J)for(let X in J){if(X.indexOf("=")>=0)throw Error(`Invalid loader extension: ${X}`);o.push(`--loader:${X}=${wr(J[X],"loader",X)}`)}if(F)for(let X in F){if(X.indexOf("=")>=0)throw Error(`Invalid out extension: ${X}`);o.push(`--out-extension:${X}=${wr(F[X],"out extension",X)}`)}if(Y)if(Array.isArray(Y))for(let X=0,Pt=Y.length;X<Pt;X++){let et=Y[X];if(typeof et==="object"&&et!==null){let Ut=Object.create(null),$t=T(et,Ut,"in",ie),Ot=T(et,Ut,"out",ie);if(St(et,Ut,"in entry point at index "+X),$t===void 0)throw Error('Missing property "in" for entry point at index '+X);if(Ot===void 0)throw Error('Missing property "out" for entry point at index '+X);a.push([Ot,$t])}else a.push(["",wr(et,"entry point at index "+X)])}else for(let X in Y)a.push([X,wr(Y[X],"entry point",X)]);if(oe){let X=Object.create(null),Pt=T(oe,X,"contents",R0),et=T(oe,X,"resolveDir",ie),Ut=T(oe,X,"sourcefile",ie),$t=T(oe,X,"loader",ie);if(St(oe,X,'in "stdin" object'),Ut)o.push(`--sourcefile=${Ut}`);if($t)o.push(`--loader=${$t}`);if(et)u=et;if(typeof Pt==="string")c=mn(Pt);else if(Pt instanceof Uint8Array)c=Pt}let xt=[];if(k)for(let X of k)X+="",xt.push(X);return{entries:a,flags:o,write:W,stdinContents:c,stdinResolveDir:u,absWorkingDir:Ee,nodePaths:xt,mangleCache:O0(de)}}function l2(e,t,r,n){let s=[],i=Object.create(null);su(s,t,i,r,n),C0(s,t,i);let o=T(t,i,"sourcemap",_0),a=T(t,i,"sourcefile",ie),l=T(t,i,"loader",ie),c=T(t,i,"banner",ie),u=T(t,i,"footer",ie),p=T(t,i,"mangleCache",Fr);if(St(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(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:O0(p)}}function N0(e){let t={},r={didClose:!1,reason:""},n={},s=0,i=0,o=new Uint8Array(16384),a=0,l=(S)=>{let E=a+S.length;if(E>o.length){let A=new Uint8Array(E*2);A.set(o),o=A}o.set(S,a),a+=S.length;let k=0;while(k+4<=a){let A=j0(o,k);if(k+4+A>a)break;k+=4,b(o.subarray(k,k+A)),k+=A}if(k>0)o.copyWithin(0,k,a),a-=k},c=(S)=>{if(r.didClose=!0,S)r.reason=": "+(S.message||S);let E="The service was stopped"+r.reason;for(let k in n)n[k](E,null);n={}},u=(S,E,k)=>{if(r.didClose)return k("The service is no longer running"+r.reason,null);let A=s++;if(n[A]=(R,_)=>{try{k(R,_)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(h0({id:A,isRequest:!0,value:E}))},p=(S,E)=>{if(r.didClose)throw Error("The service is no longer running"+r.reason);e.writeToStdin(h0({id:S,isRequest:!1,value:E}))},h=async(S,E)=>{try{if(E.command==="ping"){p(S,{});return}if(typeof E.key==="number"){let k=t[E.key];if(!k)return;let A=k[E.command];if(A){await A(S,E);return}}throw Error("Invalid command: "+E.command)}catch(k){let A=[Wi(k,e,null,void 0,"")];try{p(S,{errors:A})}catch{}}},m=!0,b=(S)=>{if(m){m=!1;let k=String.fromCharCode(...S);if(k!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${At(k)}`);return}let E=QT(S);if(E.isRequest)h(E.id,E.value);else{let k=n[E.id];if(delete n[E.id],E.value.error)k(E.value.error,{});else k(null,E.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:E,options:k,isTTY:A,defaultWD:R,callback:_})=>{let I=0,L=i++,J={},F={ref(){if(++I===1){if(E)E.ref()}},unref(){if(--I===0){if(delete t[L],E)E.unref()}}};t[L]=J,F.ref(),c2(S,L,u,p,F,e,J,k,A,R,(K,ae)=>{try{_(K,ae)}finally{F.unref()}})},transform:({callName:S,refs:E,input:k,options:A,isTTY:R,fs:_,callback:I})=>{let L=T0(),J=(F)=>{try{if(typeof k!=="string"&&!(k instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:K,mangleCache:ae}=l2(S,A,R,y0),me={command:"transform",flags:K,inputFS:F!==null,input:F!==null?mn(F):typeof k==="string"?mn(k):k};if(ae)me.mangleCache=ae;u(E,me,(ce,se)=>{if(ce)return I(Error(ce),null);let ue=Do(se.errors,L),Ce=Do(se.warnings,L),Y=1,Ee=()=>{if(--Y===0){let oe={warnings:Ce,code:se.code,map:se.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in se)oe.legalComments=se==null?void 0:se.legalComments;if(se.mangleCache)oe.mangleCache=se==null?void 0:se.mangleCache;I(null,oe)}};if(ue.length>0)return I(cl("Transform failed",ue,Ce),null);if(se.codeFS)Y++,_.readFile(se.code,(oe,W)=>{if(oe!==null)I(oe,null);else se.code=W,Ee()});if(se.mapFS)Y++,_.readFile(se.map,(oe,W)=>{if(oe!==null)I(oe,null);else se.map=W,Ee()});Ee()})}catch(K){let ae=[];try{su(ae,A,{},R,y0)}catch{}let me=Wi(K,e,L,void 0,"");u(E,{command:"error",flags:ae,error:me},()=>{me.detail=L.load(me.detail),I(cl("Transform failed",[me],[]),null)})}};if((typeof k==="string"||k instanceof Uint8Array)&&k.length>1048576){let F=J;J=()=>_.writeFile(k,F)}J(null)},formatMessages:({callName:S,refs:E,messages:k,options:A,callback:R})=>{if(!A)throw Error(`Missing second argument in ${S}() call`);let _={},I=T(A,_,"kind",ie),L=T(A,_,"color",at),J=T(A,_,"terminalWidth",Hi),F=T(A,_,"logStyle",ie);if(St(A,_,`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 K={command:"format-msgs",messages:ys(k,"messages",null,"",J),isWarning:I==="warning"};if(L!==void 0)K.color=L;if(J!==void 0)K.terminalWidth=J;if(F!==void 0)K.logStyle=F;u(E,K,(ae,me)=>{if(ae)return R(Error(ae),null);R(null,me.messages)})},analyzeMetafile:({callName:S,refs:E,metafile:k,options:A,callback:R})=>{if(A===void 0)A={};let _={},I=T(A,_,"color",at),L=T(A,_,"verbose",at);St(A,_,`in ${S}() call`);let J={command:"analyze-metafile",metafile:k};if(I!==void 0)J.color=I;if(L!==void 0)J.verbose=L;u(E,J,(F,K)=>{if(F)return R(Error(F),null);R(null,K.result)})}}}}function c2(e,t,r,n,s,i,o,a,l,c,u){let p=T0(),h=e==="context",m=(y,w)=>{let P=[];try{su(P,a,{},l,g0)}catch{}let S=Wi(y,i,p,void 0,w);r(s,{command:"error",flags:P,error:S},()=>{S.detail=p.load(S.detail),u(cl(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"),"");u2(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(w){m(w,"")}},(y)=>m(y,""));return}try{g(null,(y,w)=>w([],[]),()=>{})}catch(y){m(y,"")}function g(y,w,P){let S=i.hasFS,{entries:E,flags:k,write:A,stdinContents:R,stdinResolveDir:_,absWorkingDir:I,nodePaths:L,mangleCache:J}=a2(e,a,l,g0,S);if(A&&!i.hasFS)throw Error('The "write" option is unavailable in this environment');let F={command:"build",key:t,entries:E,flags:k,write:A,stdinContents:R,stdinResolveDir:_,absWorkingDir:I||c,nodePaths:L,context:h};if(y)F.plugins=y;if(J)F.mangleCache=J;let K=(ce,se)=>{let ue={errors:Do(ce.errors,p),warnings:Do(ce.warnings,p),outputFiles:void 0,metafile:void 0,mangleCache:void 0},Ce=ue.errors.slice(),Y=ue.warnings.slice();if(ce.outputFiles)ue.outputFiles=ce.outputFiles.map(d2);if(ce.metafile&&ce.metafile.length)ue.metafile=p2(ce.metafile);if(ce.mangleCache)ue.mangleCache=ce.mangleCache;if(ce.writeToStdout!==void 0)console.log(zi(ce.writeToStdout).replace(/\n$/,""));w(ue,(Ee,oe)=>{if(Ce.length>0||Ee.length>0){let W=cl("Build failed",Ce.concat(Ee),Y.concat(oe));return se(W,null,Ee,oe)}se(null,ue,Ee,oe)})},ae,me;if(h)o["on-end"]=(ce,se)=>new Promise((ue)=>{K(se,(Ce,Y,Ee,oe)=>{let W={errors:Ee,warnings:oe};if(me)me(Ce,Y);ae=void 0,me=void 0,n(ce,W),ue()})});r(s,F,(ce,se)=>{if(ce)return u(Error(ce),null);if(!h)return K(se,(Y,Ee)=>(P(),u(Y,Ee)));if(se.errors.length>0)return u(cl("Context failed",se.errors,se.warnings),null);let ue=!1,Ce={rebuild:()=>{if(!ae)ae=new Promise((Y,Ee)=>{let oe;me=(ot,de)=>{if(!oe)oe=()=>ot?Ee(ot):Y(de)};let W=()=>{r(s,{command:"rebuild",key:t},(de,xt)=>{if(de)Ee(Error(de));else if(oe)oe();else W()})};W()});return ae},watch:(Y={})=>new Promise((Ee,oe)=>{if(!i.hasFS)throw Error('Cannot use the "watch" API in this environment');let W={},ot=T(Y,W,"delay",Hi);St(Y,W,"in watch() call");let de={command:"watch",key:t};if(ot)de.delay=ot;r(s,de,(xt)=>{if(xt)oe(Error(xt));else Ee(void 0)})}),serve:(Y={})=>new Promise((Ee,oe)=>{if(!i.hasFS)throw Error('Cannot use the "serve" API in this environment');let W={},ot=T(Y,W,"port",t2),de=T(Y,W,"host",ie),xt=T(Y,W,"servedir",ie),X=T(Y,W,"keyfile",ie),Pt=T(Y,W,"certfile",ie),et=T(Y,W,"fallback",ie),Ut=T(Y,W,"cors",Fr),$t=T(Y,W,"onRequest",k0);St(Y,W,"in serve() call");let Ot={command:"serve",key:t,onRequest:!!$t};if(ot!==void 0)Ot.port=ot;if(de!==void 0)Ot.host=de;if(xt!==void 0)Ot.servedir=xt;if(X!==void 0)Ot.keyfile=X;if(Pt!==void 0)Ot.certfile=Pt;if(et!==void 0)Ot.fallback=et;if(Ut){let zt={},qt=T(Ut,zt,"origin",A0);if(St(Ut,zt,'on "cors" object'),Array.isArray(qt))Ot.corsOrigin=qt;else if(qt!==void 0)Ot.corsOrigin=[qt]}r(s,Ot,(zt,qt)=>{if(zt)return oe(Error(zt));if($t)o["serve-request"]=(es,ts)=>{$t(ts.args),n(es,{})};Ee(qt)})}),cancel:()=>new Promise((Y)=>{if(ue)return Y();r(s,{command:"cancel",key:t},()=>{Y()})}),dispose:()=>new Promise((Y)=>{if(ue)return Y();ue=!0,r(s,{command:"dispose",key:t},()=>{Y(),P(),s.unref()})})};s.ref(),u(null,Ce)})}}var u2=async(e,t,r,n,s,i,o,a,l)=>{let c=[],u=[],p={},h={},m=[],b=0,g=0,y=[],w=!1;a=[...a];for(let E of a){let k={};if(typeof E!=="object")throw Error(`Plugin at index ${g} must be an object`);let A=T(E,k,"name",ie);if(typeof A!=="string"||A==="")throw Error(`Plugin at index ${g} is missing a name`);try{let R=T(E,k,"setup",k0);if(typeof R!=="function")throw Error("Plugin is missing a setup function");St(E,k,`on plugin ${At(A)}`);let _={name:A,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};g++;let L=R({initialOptions:o,resolve:(J,F={})=>{if(!w)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof J!=="string")throw Error("The path to resolve must be a string");let K=Object.create(null),ae=T(F,K,"pluginName",ie),me=T(F,K,"importer",ie),ce=T(F,K,"namespace",ie),se=T(F,K,"resolveDir",ie),ue=T(F,K,"kind",ie),Ce=T(F,K,"pluginData",Zc),Y=T(F,K,"with",Fr);return St(F,K,"in resolve() call"),new Promise((Ee,oe)=>{let W={command:"resolve",path:J,key:e,pluginName:A};if(ae!=null)W.pluginName=ae;if(me!=null)W.importer=me;if(ce!=null)W.namespace=ce;if(se!=null)W.resolveDir=se;if(ue!=null)W.kind=ue;else throw Error('Must specify "kind" when calling "resolve"');if(Ce!=null)W.pluginData=l.store(Ce);if(Y!=null)W.with=f2(Y,"with");t(n,W,(ot,de)=>{if(ot!==null)oe(Error(ot));else Ee({errors:Do(de.errors,l),warnings:Do(de.warnings,l),path:de.path,external:de.external,sideEffects:de.sideEffects,namespace:de.namespace,suffix:de.suffix,pluginData:l.load(de.pluginData)})})})},onStart(J){let K=Yc(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:A,callback:J,note:K}),_.onStart=!0},onEnd(J){let K=Yc(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:A,callback:J,note:K}),_.onEnd=!0},onResolve(J,F){let ae=Yc(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),me={},ce=T(J,me,"filter",Qc),se=T(J,me,"namespace",ie);if(St(J,me,`in onResolve() call for plugin ${At(A)}`),ce==null)throw Error("onResolve() call is missing a filter");let ue=b++;p[ue]={name:A,callback:F,note:ae},_.onResolve.push({id:ue,filter:eu(ce),namespace:se||""})},onLoad(J,F){let ae=Yc(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),me={},ce=T(J,me,"filter",Qc),se=T(J,me,"namespace",ie);if(St(J,me,`in onLoad() call for plugin ${At(A)}`),ce==null)throw Error("onLoad() call is missing a filter");let ue=b++;h[ue]={name:A,callback:F,note:ae},_.onLoad.push({id:ue,filter:eu(ce),namespace:se||""})},onDispose(J){m.push(J)},esbuild:s.esbuild});if(L)await L;y.push(_)}catch(R){return{ok:!1,error:R,pluginName:A}}}i["on-start"]=async(E,k)=>{l.clear();let A={errors:[],warnings:[]};await Promise.all(c.map(async({name:R,callback:_,note:I})=>{try{let L=await _();if(L!=null){if(typeof L!=="object")throw Error(`Expected onStart() callback in plugin ${At(R)} to return an object`);let J={},F=T(L,J,"errors",gs),K=T(L,J,"warnings",gs);if(St(L,J,`from onStart() callback in plugin ${At(R)}`),F!=null)A.errors.push(...ys(F,"errors",l,R,void 0));if(K!=null)A.warnings.push(...ys(K,"warnings",l,R,void 0))}}catch(L){A.errors.push(Wi(L,s,l,I&&I(),R))}})),r(E,A)},i["on-resolve"]=async(E,k)=>{let A={},R="",_,I;for(let L of k.ids)try{({name:R,callback:_,note:I}=p[L]);let J=await _({path:k.path,importer:k.importer,namespace:k.namespace,resolveDir:k.resolveDir,kind:k.kind,pluginData:l.load(k.pluginData),with:k.with});if(J!=null){if(typeof J!=="object")throw Error(`Expected onResolve() callback in plugin ${At(R)} to return an object`);let F={},K=T(J,F,"pluginName",ie),ae=T(J,F,"path",ie),me=T(J,F,"namespace",ie),ce=T(J,F,"suffix",ie),se=T(J,F,"external",at),ue=T(J,F,"sideEffects",at),Ce=T(J,F,"pluginData",Zc),Y=T(J,F,"errors",gs),Ee=T(J,F,"warnings",gs),oe=T(J,F,"watchFiles",vr),W=T(J,F,"watchDirs",vr);if(St(J,F,`from onResolve() callback in plugin ${At(R)}`),A.id=L,K!=null)A.pluginName=K;if(ae!=null)A.path=ae;if(me!=null)A.namespace=me;if(ce!=null)A.suffix=ce;if(se!=null)A.external=se;if(ue!=null)A.sideEffects=ue;if(Ce!=null)A.pluginData=l.store(Ce);if(Y!=null)A.errors=ys(Y,"errors",l,R,void 0);if(Ee!=null)A.warnings=ys(Ee,"warnings",l,R,void 0);if(oe!=null)A.watchFiles=Xc(oe,"watchFiles");if(W!=null)A.watchDirs=Xc(W,"watchDirs");break}}catch(J){A={id:L,errors:[Wi(J,s,l,I&&I(),R)]};break}r(E,A)},i["on-load"]=async(E,k)=>{let A={},R="",_,I;for(let L of k.ids)try{({name:R,callback:_,note:I}=h[L]);let J=await _({path:k.path,namespace:k.namespace,suffix:k.suffix,pluginData:l.load(k.pluginData),with:k.with});if(J!=null){if(typeof J!=="object")throw Error(`Expected onLoad() callback in plugin ${At(R)} to return an object`);let F={},K=T(J,F,"pluginName",ie),ae=T(J,F,"contents",R0),me=T(J,F,"resolveDir",ie),ce=T(J,F,"pluginData",Zc),se=T(J,F,"loader",ie),ue=T(J,F,"errors",gs),Ce=T(J,F,"warnings",gs),Y=T(J,F,"watchFiles",vr),Ee=T(J,F,"watchDirs",vr);if(St(J,F,`from onLoad() callback in plugin ${At(R)}`),A.id=L,K!=null)A.pluginName=K;if(ae instanceof Uint8Array)A.contents=ae;else if(ae!=null)A.contents=mn(ae);if(me!=null)A.resolveDir=me;if(ce!=null)A.pluginData=l.store(ce);if(se!=null)A.loader=se;if(ue!=null)A.errors=ys(ue,"errors",l,R,void 0);if(Ce!=null)A.warnings=ys(Ce,"warnings",l,R,void 0);if(Y!=null)A.watchFiles=Xc(Y,"watchFiles");if(Ee!=null)A.watchDirs=Xc(Ee,"watchDirs");break}}catch(J){A={id:L,errors:[Wi(J,s,l,I&&I(),R)]};break}r(E,A)};let P=(E,k)=>k([],[]);if(u.length>0)P=(E,k)=>{(async()=>{let A=[],R=[];for(let{name:_,callback:I,note:L}of u){let J,F;try{let K=await I(E);if(K!=null){if(typeof K!=="object")throw Error(`Expected onEnd() callback in plugin ${At(_)} to return an object`);let ae={},me=T(K,ae,"errors",gs),ce=T(K,ae,"warnings",gs);if(St(K,ae,`from onEnd() callback in plugin ${At(_)}`),me!=null)J=ys(me,"errors",l,_,void 0);if(ce!=null)F=ys(ce,"warnings",l,_,void 0)}}catch(K){J=[Wi(K,s,l,L&&L(),_)]}if(J){A.push(...J);try{E.errors.push(...J)}catch{}}if(F){R.push(...F);try{E.warnings.push(...F)}catch{}}}k(A,R)})()};let S=()=>{for(let E of m)setTimeout(()=>E(),0)};return w=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:P,scheduleOnDisposeCallbacks:S}};function T0(){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 Yc(e,t,r){let n,s=!1;return()=>{if(s)return n;s=!0;try{let i=(e.stack+"").split(`
57
+ `);i.splice(1,1);let o=I0(t,i,r);if(o)return n={text:e.message,location:o},n}catch{}}}function Wi(e,t,r,n,s){let i="Internal error",o=null;try{i=(e&&e.message||e)+""}catch{}try{o=I0(t,(e.stack+"").split(`
58
+ `),"")}catch{}return{id:"",pluginName:s,text:i,location:o,notes:n?[n]:[],detail:r?r.store(e):-1}}function I0(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,u=l.slice(c,c+r.length)===r?r.length:0;return{file:o[1],namespace:"file",line:+o[2],column:mn(l.slice(0,c)).length,length:mn(l.slice(c,c+u)).length,lineText:l+`
15
59
  `+t.slice(1).join(`
16
- `),suggestion:""}}break}}return null}function _o(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`
60
+ `),suggestion:""}}break}}return null}function cl(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
61
  ...`;if(!i.location)return`
18
62
  error: ${i.text}`;let{file:a,line:l,column:c}=i.location,u=i.pluginName?`[plugin: ${i.pluginName}] `:"";return`
19
- ${a}:${l}:${c}: ERROR: ${u}${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 gi(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function xh(e,t,r){if(e==null)return null;let n={},s=N(e,n,"file",ie),i=N(e,n,"namespace",ie),o=N(e,n,"line",Ls),a=N(e,n,"column",Ls),l=N(e,n,"length",Ls),c=N(e,n,"lineText",ie),u=N(e,n,"suggestion",ie);if(ft(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:u||""}}function Rn(e,t,r,n,s){let i=[],o=0;for(let a of e){let l={},c=N(a,l,"id",ie),u=N(a,l,"pluginName",ie),p=N(a,l,"text",ie),g=N(a,l,"location",bh),m=N(a,l,"notes",_n),b=N(a,l,"detail",qa),h=`in element ${o} of "${t}"`;ft(a,l,h);let y=[];if(m)for(let v of m){let k={},S=N(v,k,"text",ie),E=N(v,k,"location",bh);ft(v,k,h),y.push({text:S||"",location:xh(E,h,s)})}i.push({id:c||"",pluginName:u||n,text:p||"",location:xh(g,h,s),notes:y,detail:r?r.store(b):-1}),o++}return i}function Fa(e,t){let r=[];for(let n of e){if(typeof n!=="string")throw Error(`${gt(t)} must be an array of strings`);r.push(n)}return r}function nA(e,t){let r=Object.create(null);for(let n in e){let s=e[n];if(typeof s!=="string")throw Error(`key ${gt(n)} in object ${gt(t)} must be a string`);r[n]=s}return r}function sA({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=Hs(s);return n}}}function Va(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function iA(e){let t;try{t=Hs(e)}catch{return UR(e)}return JSON.parse(t)}var Xn=De("fs"),$h=De("os"),wr=De("path"),mi=process.env.ESBUILD_BINARY_PATH||mi,oA=(e)=>!!e&&e!=="/usr/bin/esbuild",vh="@esbuild/darwin-arm64",wh="@esbuild/darwin-x64",Ba={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Wa={"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"},Sh={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function aA(){let e,t,r=!1,n=`${process.platform} ${$h.arch()} ${$h.endianness()}`;if(n in Ba)e=Ba[n],t="esbuild.exe";else if(n in Wa)e=Wa[n],t="bin/esbuild";else if(n in Sh)e=Sh[n],t="bin/esbuild",r=!0;else throw Error(`Unsupported platform: ${n}`);return{pkg:e,subpath:t,isWASM:r}}function lA(){let e=De.resolve("esbuild"),t=wr.dirname(wr.dirname(wr.dirname(e)));if(wr.basename(t)==="node_modules"){for(let r in Wa)try{let n=Wa[r];if(Xn.existsSync(wr.join(t,n)))return n}catch{}for(let r in Ba)try{let n=Ba[r];if(Xn.existsSync(wr.join(t,n)))return n}catch{}}return null}function cA(e,t){let r=wr.dirname(De.resolve("esbuild"));return wr.join(r,`downloaded-${e.replace("/","-")}-${wr.basename(t)}`)}function uA(){if(oA(mi))if(!Xn.existsSync(mi))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${mi}`);else return{binPath:mi,isWASM:!1};let{pkg:e,subpath:t,isWASM:r}=aA(),n;try{n=De.resolve(`${e}/${t}`)}catch(s){if(n=cA(e,t),!Xn.existsSync(n)){try{De.resolve(e)}catch{let i=lA();if(i){let o=`
63
+ ${a}:${l}:${c}: ERROR: ${u}${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 Do(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function x0(e,t,r){if(e==null)return null;let n={},s=T(e,n,"file",ie),i=T(e,n,"namespace",ie),o=T(e,n,"line",Hi),a=T(e,n,"column",Hi),l=T(e,n,"length",Hi),c=T(e,n,"lineText",ie),u=T(e,n,"suggestion",ie);if(St(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:u||""}}function ys(e,t,r,n,s){let i=[],o=0;for(let a of e){let l={},c=T(a,l,"id",ie),u=T(a,l,"pluginName",ie),p=T(a,l,"text",ie),h=T(a,l,"location",b0),m=T(a,l,"notes",gs),b=T(a,l,"detail",Zc),g=`in element ${o} of "${t}"`;St(a,l,g);let y=[];if(m)for(let w of m){let P={},S=T(w,P,"text",ie),E=T(w,P,"location",b0);St(w,P,g),y.push({text:S||"",location:x0(E,g,s)})}i.push({id:c||"",pluginName:u||n,text:p||"",location:x0(h,g,s),notes:y,detail:r?r.store(b):-1}),o++}return i}function Xc(e,t){let r=[];for(let n of e){if(typeof n!=="string")throw Error(`${At(t)} must be an array of strings`);r.push(n)}return r}function f2(e,t){let r=Object.create(null);for(let n in e){let s=e[n];if(typeof s!=="string")throw Error(`key ${At(n)} in object ${At(t)} must be a string`);r[n]=s}return r}function d2({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=zi(s);return n}}}function eu(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function p2(e){let t;try{t=zi(e)}catch{return e2(e)}return JSON.parse(t)}var Ws=He("fs"),$0=He("os"),Gr=He("path"),Jo=process.env.ESBUILD_BINARY_PATH||Jo,m2=(e)=>!!e&&e!=="/usr/bin/esbuild",w0="@esbuild/darwin-arm64",v0="@esbuild/darwin-x64",tu={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},ru={"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"},S0={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function h2(){let e,t,r=!1,n=`${process.platform} ${$0.arch()} ${$0.endianness()}`;if(n in tu)e=tu[n],t="esbuild.exe";else if(n in ru)e=ru[n],t="bin/esbuild";else if(n in S0)e=S0[n],t="bin/esbuild",r=!0;else throw Error(`Unsupported platform: ${n}`);return{pkg:e,subpath:t,isWASM:r}}function g2(){let e=He.resolve("esbuild"),t=Gr.dirname(Gr.dirname(Gr.dirname(e)));if(Gr.basename(t)==="node_modules"){for(let r in ru)try{let n=ru[r];if(Ws.existsSync(Gr.join(t,n)))return n}catch{}for(let r in tu)try{let n=tu[r];if(Ws.existsSync(Gr.join(t,n)))return n}catch{}}return null}function y2(e,t){let r=Gr.dirname(He.resolve("esbuild"));return Gr.join(r,`downloaded-${e.replace("/","-")}-${Gr.basename(t)}`)}function b2(){if(m2(Jo))if(!Ws.existsSync(Jo))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${Jo}`);else return{binPath:Jo,isWASM:!1};let{pkg:e,subpath:t,isWASM:r}=h2(),n;try{n=He.resolve(`${e}/${t}`)}catch(s){if(n=y2(e,t),!Ws.existsSync(n)){try{He.resolve(e)}catch{let i=g2();if(i){let o=`
20
64
  Specifically the "${i}" package is present but this platform
21
65
  needs the "${e}" package instead. People often get into this
22
66
  situation by installing esbuild on Windows or macOS and copying "node_modules"
@@ -33,7 +77,7 @@ If you are installing with yarn, you can try listing both this platform and the
33
77
  other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
34
78
  feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
35
79
  Keep in mind that this means multiple copies of esbuild will be present.
36
- `;if(e===wh&&i===vh||e===vh&&i===wh)o=`
80
+ `;if(e===v0&&i===w0||e===w0&&i===v0)o=`
37
81
  Specifically the "${i}" package is present but this platform
38
82
  needs the "${e}" package instead. People often get into this
39
83
  situation by installing esbuild with npm running inside of Rosetta 2 and then
@@ -65,47 +109,47 @@ want to do that.
65
109
  If you are installing esbuild with npm, make sure that you don't specify the
66
110
  "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
67
111
  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=wr.join(i,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${wr.basename(t)}`);if(!Xn.existsSync(o))Xn.mkdirSync(wr.dirname(o),{recursive:!0}),Xn.copyFileSync(n,o),Xn.chmodSync(o,493);return{binPath:o,isWASM:r}}}return{binPath:n,isWASM:r}}var Mh=De("child_process"),fA=De("crypto"),Nu=De("path"),Fs=De("fs"),dA=De("os"),pA=De("tty"),Ht;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{Ht=De("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)Ht=void 0}var Eh,Oo=((Eh=Ht==null?void 0:Ht.workerData)==null?void 0:Eh.esbuildVersion)==="0.28.2",Jh=()=>{if((!mi||!1)&&(Nu.basename(__filename)!=="main.js"||Nu.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.
112
+ 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=Gr.join(i,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Gr.basename(t)}`);if(!Ws.existsSync(o))Ws.mkdirSync(Gr.dirname(o),{recursive:!0}),Ws.copyFileSync(n,o),Ws.chmodSync(o,493);return{binPath:o,isWASM:r}}}return{binPath:n,isWASM:r}}var J0=He("child_process"),x2=He("crypto"),Ap=He("path"),Bi=He("fs"),$2=He("os"),w2=He("tty"),lr;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{lr=He("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)lr=void 0}var E0,dl=((E0=lr==null?void 0:lr.workerData)==null?void 0:E0.esbuildVersion)==="0.28.2",M0=()=>{if((!Jo||!1)&&(Ap.basename(__filename)!=="main.js"||Ap.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
113
 
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}=uA();if(t)return["node",[e]];else return[e,[]]}},Ro=()=>pA.isatty(2),mA={readFile(e,t){try{let r=Fs.readFileSync(e,"utf8");try{Fs.unlinkSync(e)}catch{}t(null,r)}catch(r){t(r,null)}},writeFile(e,t){try{let r=Dh();Fs.writeFileSync(r,e),t(r)}catch{t(null)}}},hA={readFile(e,t){try{Fs.readFile(e,"utf8",(r,n)=>{try{Fs.unlink(e,()=>t(r,n))}catch{t(r,n)}})}catch(r){t(r,null)}},writeFile(e,t){try{let r=Dh();Fs.writeFile(r,e,(n)=>n!==null?t(null):t(r))}catch{t(null)}}},gA="0.28.2",yA=(e)=>Vs().build(e),bA=(e)=>Vs().context(e),xA=(e,t)=>Vs().transform(e,t),$A=(e,t)=>Vs().formatMessages(e,t),vA=(e,t)=>Vs().analyzeMetafile(e,t),wA=(e)=>{if(Ht&&!Oo){if(!Vt)Vt=Ka(Ht);return Vt.buildSync(e)}let t;return Ga((r)=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Ro(),defaultWD:qs,callback:(n,s)=>{if(n)throw n;t=s}})),t},SA=(e,t)=>{if(Ht&&!Oo){if(!Vt)Vt=Ka(Ht);return Vt.transformSync(e,t)}let r;return Ga((n)=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Ro(),fs:mA,callback:(s,i)=>{if(s)throw s;r=i}})),r},EA=(e,t)=>{if(Ht&&!Oo){if(!Vt)Vt=Ka(Ht);return Vt.formatMessagesSync(e,t)}let r;return Ga((n)=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},PA=(e,t)=>{if(Ht&&!Oo){if(!Vt)Vt=Ka(Ht);return Vt.analyzeMetafileSync(e,t)}let r;return Ga((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},jA=()=>{if(Ua)Ua();if(Vt)Vt.stop();return Promise.resolve()},Tu=!1,kA=(e)=>{if(e=ZR(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(Tu)throw Error('Cannot call "initialize" more than once');return Vs(),Tu=!0,Promise.resolve()},qs=process.cwd(),ko,Ua,Vs=()=>{if(ko)return ko;let[e,t]=Jh(),r=Mh.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:qs}),{readFromStdout:n,afterClose:s,service:i}=Nh({writeToStdin(u){r.stdin.write(u,(p)=>{if(p)s(p)})},readFileSync:Fs.readFileSync,isSync:!1,hasFS:!0,esbuild:Ao});r.stdin.on("error",s),r.on("error",s);let{stdin:o,stdout:a}=r;a.on("data",n),a.on("end",s),Ua=()=>{o.destroy(),a.destroy(),r.kill(),Tu=!1,ko=void 0,Ua=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 ko={build:(u)=>new Promise((p,g)=>{i.buildOrContext({callName:"build",refs:c,options:u,isTTY:Ro(),defaultWD:qs,callback:(m,b)=>m?g(m):p(b)})}),context:(u)=>new Promise((p,g)=>i.buildOrContext({callName:"context",refs:c,options:u,isTTY:Ro(),defaultWD:qs,callback:(m,b)=>m?g(m):p(b)})),transform:(u,p)=>new Promise((g,m)=>i.transform({callName:"transform",refs:c,input:u,options:p||{},isTTY:Ro(),fs:hA,callback:(b,h)=>b?m(b):g(h)})),formatMessages:(u,p)=>new Promise((g,m)=>i.formatMessages({callName:"formatMessages",refs:c,messages:u,options:p,callback:(b,h)=>b?m(b):g(h)})),analyzeMetafile:(u,p)=>new Promise((g,m)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:p,callback:(b,h)=>b?m(b):g(h)}))},ko},Ga=(e)=>{let[t,r]=Jh(),n=new Uint8Array,{readFromStdout:s,afterClose:i,service:o}=Nh({writeToStdin(l){if(n.length!==0)throw Error("Must run at most one command");n=l},isSync:!0,hasFS:!0,esbuild:Ao});e(o);let a=Mh.execFileSync(t,r.concat("--service=0.28.2"),{cwd:qs,windowsHide:!0,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),i(null)},Dh=()=>Nu.join(dA.tmpdir(),`esbuild-${fA.randomBytes(32).toString("hex")}`),Vt=null,Ka=(e)=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:qs,esbuildVersion:"0.28.2"},transferList:[r],execArgv:[]}),s=0,i=(c)=>{let u=Error(`Build failed with 1 error:
71
- error: ${c}`),p=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=p,u.warnings=[],u},o=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw i("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let p in u)c[p]=u[p]},l=(c,u)=>{let p=s++,g=new SharedArrayBuffer(8),m=new Int32Array(g),b={sharedBuffer:g,id:p,command:c,args:u};n.postMessage(b);let h=Atomics.wait(m,0,0);if(h!=="ok"&&h!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+h);let{message:{id:y,resolve:v,reject:k,properties:S}}=e.receiveMessageOnPort(t);if(p!==y)throw Error(`Internal error: Expected id ${p} but got id ${y}`);if(k)throw a(k,S),k;return v};return n.unref(),{buildSync(c){return o(c),l("build",[c])},transformSync(c,u){return l("transform",[c,u])},formatMessagesSync(c,u){return l("formatMessages",[c,u])},analyzeMetafileSync(c,u){return l("analyzeMetafile",[c,u])},stop(){n.terminate(),Vt=null}}},_A=()=>{let e=Ht.workerData.workerPort,t=Ht.parentPort,r=(n)=>{let s={};if(n&&typeof n==="object")for(let i in n)s[i]=n[i];return s};try{let n=Vs();qs=Ht.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(u){e.postMessage({id:o,reject:u,properties:r(u)})}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(Oo)_A();var RA=Ao});import{createRequire as AA}from"node:module";import{join as OA}from"node:path";function Mu(e,t){return AA(OA(t,"package.json")).resolve(e)}function CA(e){return e==="node"||e==="bun"?"node":"browser"}async function Ju(e){let t=await Promise.resolve().then(() => Yt(Ya(),1)),{entry:r}=e,n={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:CA(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 Fh=()=>{};var qh=".jx-entry-";import{rmSync as TA,writeFileSync as Hh}from"node:fs";import{tmpdir as IA}from"node:os";import{basename as MA,join as JA,resolve as DA}from"node:path";function Bh(e){return Ms(e)||e.startsWith("./")||e.startsWith("../")}function Du(e,t,r){if(Ms(e))return Mu(e.slice(Ma.length),r);return DA(t,e)}function Wh(e,t){return Mu(e,t)}function LA(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 FA(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function HA(e){return e.minify??e.target==="browser"}function VA(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...qA};return t}function Uh(e){return{...VA(e),external:e.external??[],minify:HA(e),plugins:LA(e),target:e.target}}async function zh(e,t){let r=await Ju({entry:{path:e.entryPath},...Uh(t)});Hh(e.outfile,r,"utf8")}function Lu(e){return e==="<stdin>"||MA(e).startsWith(qh)}async function Gh(e,t,r){let n=[],s=JA(IA(),`jx-resolve-${process.pid}.js`);try{await Bs(`export * from ${JSON.stringify(e)};
72
- `,{outfile:s,resolveDir:t},{...r,minify:!1,onFileLoaded:(i)=>n.push(i)})}catch{return}finally{TA(s,{force:!0})}return n.find((i)=>!Lu(i))}async function Bs(e,{resolveDir:t,outfile:r},n){let s=await Ju({entry:{resolveDir:t,source:e},...Uh(n)});Hh(r,s,"utf8")}async function Kh(e,{projectRoot:t,outfile:r,adapter:n}){await Bs(e,{outfile:r,resolveDir:t},FA(n))}var Vh,qA;var Fu=H(()=>{gr();Fh();Vh=["@vue/reactivity","lit-html"];qA={"process.env.NODE_ENV":'"production"'}});function WA(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Yh(e){let t=WA(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(BA,(l,c,u)=>{if(i=!0,c)return o=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:o,isDynamic:i,params:s,urlPattern:a}}function Xh(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 BA;var Zh=H(()=>{BA=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function zA(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Qh(e){if(!X(e)||!("paginate"in e))return null;let{each:t,pageSize:r,paginate:n}=e,s=X(n)?n.$ref:void 0,i=T(s)?UA.exec(s)?.[1]:void 0;if(i===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Xt(r)||!Number.isInteger(r)||r<1)throw TypeError("$paths.pageSize must be a positive integer");let o={key:zA(i),pageSize:r};if(t!==void 0){if(!X(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(X(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");o.each=t}return o}function qu(e,t){return Math.max(1,Math.ceil(e/t))}function eg(e,t,r){let n=(t-1)*r;return e.slice(n,n+r)}function Ws(e,t){if(e.endsWith("*")){if(t===1){let r=e.slice(0,-1).replace(/\/$/,"");return r===""?"/":r}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function tg(e,t,r,n){let s=qu(n,r),i=[];for(let o=1;o<=s;o++)i.push({current:o===t,number:o,url:Ws(e,o)});return{first:Ws(e,1),itemCount:n,last:Ws(e,s),next:t<s?Ws(e,t+1):null,number:t,pageCount:s,pageSize:r,pages:i,prev:t>1?Ws(e,t-1):null}}var UA;var rg=H(()=>{Pe();UA=/^#\/state\/([^/]+)$/});function Sr(e){if(!T(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Co(e){let t=Sr(e);if(t===null)return"ltr";let r=new Intl.Locale(t),n=r.script??r.maximize().script;return n!==void 0&&GA.has(n)?"rtl":"ltr"}function ng(e){let t=Sr(e);if(t===null)return T(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Hu(e){let t=e.i18n,r=[];if(!q(t))return{errors:r,i18n:null};let n=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of n){let l=Sr(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=Sr(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Sr(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:KA;return{errors:r,i18n:{defaultLocale:i,locales:s,routing:o}}}function Jr(e,t){if(t===null)return null;let r=e.split("/").find(Boolean);if(r===void 0)return t.defaultLocale;let n=Sr(r);return n!==null&&t.locales.includes(n)?n:t.defaultLocale}var GA,Xa="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",KA="prefix-except-default";var Us=H(()=>{Pe();GA=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 tr(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function sg(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let r=e.slice(2,-1).trim();return YA.has(r.toLowerCase())?r:e.slice(1)}return null}function No(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Io(e){return e.startsWith("@keyframes")}function ig(e,t){let r=[];for(let n of To(e))for(let s of To(t))r.push(XA(n,s));return r.join(", ")}function XA(e,t){let r=Qa(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Vu(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 Qa(e,t){return Vu(e).length>0?ZA(e,t):null}function ZA(e,t){let r="",n=0;for(let s of Vu(e))r+=e.slice(n,s)+t,n=s+1;return r+e.slice(n)}function To(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 Lr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Bu(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${Dr}]))`,forced:`${e}:where([${Dr}="${t}"])`};return{auto:`:where(:root:not([${Dr}])) ${e}`,forced:`:where(:root[${Dr}="${t}"]) ${e}`}}function Zn(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Wu(e){return e.startsWith("--")?e:tr(e)}function Za(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 og(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 QA(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 eO(e){let t=Object.keys(e).filter((n)=>Io(n));if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}function tO(e){let r=Vu(e).at(-1),n=r===void 0?e:e.slice(r+1);return n===""||n.startsWith(":")||n.startsWith(".")||n.startsWith("[")}function yi(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)&&!Je(y),c=(y,v)=>{if(l(v))return[v];if(!No(y)||!Array.isArray(v)||v.length===0)return[];return v.every((k)=>l(k))?v:[]},u=(y,v,k,S)=>{if(v===void 0||v===null)return null;if(Je(v))return k?o?.(y,v,S)??null:null;if(q(v))return null;let E=String(v);if(ye(E))return k?o?.(y,E,S)??null:null;return s(E)},p=(y,v,k=!0,S="self")=>{let E=[];for(let[j,R]of Object.entries(y)){if(c(j,R).length>0)continue;if(v&&(j.startsWith("@")||Zn(j)))continue;if(j.startsWith("$"))continue;let A=u(j,R,k,S);if(A!==null)E.push([Wu(j),A])}return E},g=(y,v,k,S,E)=>{if(k.length===0)return;let j=v;if(j!==null){let _=i(j);if(_===null)return;j=_}let R=og(y,j,k),A={text:R,conditions:[...y],selector:j,declarations:k,target:S,key:Za(R)};if(T(E)&&E!=="")A.description=E;a.push(A)},m=(y,v,k)=>{let S=y.slice(10).trim();if(S==="")return;let E=[];for(let[R,A]of Object.entries(v)){if(!l(A))continue;let _=p(A,!0,!1,"unscoped");if(_.length>0)E.push({declarations:_,selector:R.trim()})}if(E.length===0)return;let j=QA(k,S,E);a.push({blocks:E,conditions:[...k],declarations:[],key:Za(j),selector:null,target:"unscoped",text:j})},b=(y,v,k,S,E)=>{if(y==="@--")return;if(No(y)){g([...S,y],null,p(v,!1,!0,"unscoped"),"unscoped",v.$description);return}if(Io(y)){m(y,v,S);return}let j=sg(y,n),R=j===null?y:`@media ${j}`,A=j===null?null:Lr(j);if(A!==null&&k!==null){let{auto:_,forced:I}=Bu(k,A);h(v,_,[...S,R],E),h(eO(v),I,S,E);return}h(v,k,[...S,R],E)};function h(y,v,k,S){g(k,v,p(y,!0,!0,S),S,y.$description);for(let[E,j]of Object.entries(y))for(let R of c(E,j))if(E.startsWith("@"))b(E,R,v,k,S);else if(v!==null)h(R,ig(v,E),k,tO(E)?S:"descendant")}return h(e,r,[],"self"),a}var YA,Dr="data-color-scheme",el="jx-color-scheme";var Mo=H(()=>{Pe();YA=new Set(["all","print","screen","speech"])});function cg(){return`the Intl helpers ${zu.join(", ")}`}var Wr="en-US",Uu="UTC",ag,zu,lg;var Gu=H(()=>{ag=[{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."}],zu=ag.map((e)=>e.path),lg=Object.fromEntries(ag.map((e)=>[e.path,e.params.indexOf("locale")]))});function rO(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function St(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function On(e){if(e==="")return[];return e.split("/").map((t)=>rO(t))}function kt(e,t){let r=e;for(let n of On(t))r=r?.[n];return r}function Ce(e,t){let r=e;for(let n of On(t))r+=Ku.test(n)?`.${n}`:`[${JSON.stringify(n)}]`;return r}function ug(e,t){let r=e;for(let[n,s]of On(t).entries()){let i=n===0?"":"?.";r+=Ku.test(s)?`${n===0?".":i}${s}`:`${i}[${JSON.stringify(s)}]`}return r}function Cn(e){return Ku.test(e)?e:JSON.stringify(e)}function fg(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Ku;var bi=H(()=>{Ku=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Yu(e){let t=e.$map;return q(t)?t:void 0}function hg(e){return q(e)&&!Array.isArray(e)&&"operator"in e}function Jo(e){return q(e)&&!Array.isArray(e)&&"$ref"in e}function oO(e,t,r){let n=lg[e];if(n===void 0||n<0||t[n]!=null)return t;let s=kt(r.$page,"locale");if(!T(s)||s==="")return t;let i=[...t];return i[n]=s,i}function xg(e){return e.startsWith("window#/")&&sO.has(e.slice(8))}function Nn(e){return gg.has(e)}function Ze(e,t){if(!e)return;let r=(e.depth??0)+1;if(r>aO)return;return{depth:r,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function ze(e,t,r,n,s){if(e===null||e===void 0)return e;if(hg(e))return br(e,t,r,n,s);if(Jo(e)){let i=tl(e.$ref,t,r,n);return s?.report(s.path??[],i),i}if(Array.isArray(e))return $g(e,t,r,n,s);return s?.report(s.path??[],e),e}function $g(e,t,r,n,s){return e.map((i,o)=>ze(i,t,r,n,Ze(s,o)))}function lO(e,t,r,n){let s=(i)=>{if(!e.slice(i.length).includes("/"))return t;return tl(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?tl(e.slice(0,e.lastIndexOf("/")),t,r,n):void 0;return}function tl(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?kt(i,s.slice(1).join("/")):i}if(e.startsWith("event#/")){let s=e.slice(7);return kt(r,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=Yu(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?kt(o,s.slice(2).join("/")):o}if(e.startsWith("#/state/"))return kt(t,e.slice(8));if(e.startsWith("parent#/"))return kt(t,e.slice(8));if(e.startsWith("window#/"))return kt(globalThis.window,e.slice(8));if(e.startsWith("document#/"))return kt(globalThis.document,e.slice(10));return kt(t,e)??null}function cO(e,t,r,n){if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=Yu(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(),u=l.length>0?kt(o,l.join("/")):o;return{key:c,obj:u}}return{key:i==="item"?"$map/item":"$map/index",obj:Yu(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let o=On(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 br(e,t,r,n,s){let i=uO(e,t,r,n,s);return s?.report(s.path??[],i),i}function pg(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 uO(e,t,r,n,s){let{operator:i,target:o,value:a,initial:l}=e;if(!nO.has(i))throw Error(`$expression: unknown operator "${i}"`);if(Xu.has(i)&&!("value"in e)){let c=ze(o,t,r,n,Ze(s,"target"));if(i==="!")return!c;if(i==="-")return-c}if(i==="call"){let c=Jo(o)?o.$ref:void 0;if(!T(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(n?.callDepth??0)+1;if(u>dg)throw Error(`$expression: call depth exceeded (${dg})`);let p=Array.isArray(a)?a.map((m,b)=>ze(m,t,r,n,Ze(s,["value",b]))):[];if(c.startsWith("window#/")){if(!xg(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),b=iO.get(m);if(b)return b(...oO(m,p,t));let h=kt(globalThis.window,m),y=m.lastIndexOf("/"),v=y===-1?globalThis.window:kt(globalThis.window,m.slice(0,y));return h.apply(v,p)}let g=tl(c,t,r,n);if(It(g))return g.apply(lO(c,t,r,n),p);if(q(g)&&"$expression"in g){let m=g,b={};for(let[h,y]of(m.parameters??[]).entries()){let v=T(y)?y:y?.name??"";if(!v)continue;b[v]=p[h]===void 0&&q(y)&&"default"in y?y.default:p[h]}return br(m.$expression,t,r,{args:b,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(ef.has(i)){if(i==="?:"){let m=ze(o,t,r,n,Ze(s,"target"));if(s){let b=ze(a,t,r,n,Ze(s,"value")),h=ze(l,t,r,n,Ze(s,"initial"));return m?b:h}return m?ze(a,t,r,n):ze(l,t,r,n)}let c=ze(o,t,r,n,Ze(s,"target")),u=String(c),p=e.cases??{},g=Object.hasOwn(p,u);if(s){let m;for(let[h,y]of Object.entries(p)){let v=ze(y,t,r,n,Ze(s,["cases",h]));if(h===u)m=v}let b=ze(e.default,t,r,n,Ze(s,"default"));return g?m:b}return g?ze(p[u],t,r,n):ze(e.default,t,r,n)}if(Zu.has(i)){let c=ze(o,t,r,n,Ze(s,"target")),u=ze(a,t,r,n,Ze(s,"value"));switch(i){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return pg(i,c,u)}}if(yg.has(i)){let c=ze(a,t,r,n,Ze(s,"value")),{obj:u,key:p}=cO(o.$ref,t,r,n);u[p]=i==="="?c:pg(i.slice(0,-1),u[p],c);return}if(bg.has(i)){let c=ze(o,t,r,n,Ze(s,"target"));switch(i){case"push":return c.push(ze(a,t,r,n,Ze(s,"value")));case"unshift":return c.unshift(ze(a,t,r,n,Ze(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=ze(a,t,r,n,Ze(s,"value"));return c.splice(...u)}default:break}}if(tf.has(i)){let c=ze(o,t,r,n,Ze(s,"target")),u=a===void 0?[]:Array.isArray(a)?$g(a,t,r,n,Ze(s,"value")):[ze(a,t,r,n,Ze(s,"value"))],p=kt(c,i);if(!It(p))return;return p.apply(c,u)}if(Qu.has(i)){let c=ze(o,t,r,n,Ze(s,"target")),u=a;if(i==="reduce"){let p=ze(l,t,r,n,Ze(s,"initial"));for(let[g,m]of c.entries())p=br(u,t,r,{acc:p,index:g,item:m},g===0?Ze(s,"value"):void 0);return p}if(i==="map")return c.map((p,g)=>br(u,t,r,{...n,index:g,item:p},g===0?Ze(s,"value"):void 0));if(i==="filter")return c.filter((p,g)=>br(u,t,r,{...n,index:g,item:p},g===0?Ze(s,"value"):void 0))}return}function tt(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(hg(e))return Bt(e,t);if(Jo(e))return rf(e.$ref,t);if(Array.isArray(e))return e.map((r)=>tt(r,t)).join(", ");return JSON.stringify(e)}function fO(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function rf(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 Ce("_args",e.slice(6));if(e.startsWith("event#/"))return Ce(n,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s;if(i==="item")return s.length>2?Ce("_item",s.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(e.startsWith("#/state/"))return Ce(r,e.slice(8));if(e.startsWith("parent#/"))return Ce(r,e.slice(8));if(e.startsWith("window#/"))return Ce("window",e.slice(8));if(e.startsWith("document#/"))return Ce("document",e.slice(10));return Ce(r,e)}function mg(e,t){if(Jo(e))return rf(e.$ref,t);return tt(e,t)}function dO(e,t,r){let n=(o)=>t[o]??"undefined",s=`(${r.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Wr)})`,i=JSON.stringify(Uu);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 Bt(e,t={}){let{operator:r,target:n,value:s,initial:i}=e;if(Xu.has(r)&&!("value"in e)){let o=tt(n,t);if(r==="!")return`!(${o})`;if(r==="-")return`-(${o})`}if(r==="call"){let o=(Jo(n)?n.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>tt(l,t)):[];if(o.startsWith("window#/")){if(!xg(o))throw Error(`$expression: "${o}" is not a blessed pure global`);let l=dO(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 u=c.map((p,g)=>`${JSON.stringify(p)}: ${a[g]??"undefined"}`).join(", ");return`${fO(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${rf(o,t)}(${a.join(", ")})`}if(ef.has(r)){if(r==="?:"){let c=tt(n,t),u=tt(s,t),p=tt(i,t);return`(${c} ? ${u} : ${p})`}let o=tt(n,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${tt(u,t)} : `).join(""),l="default"in e?tt(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${o}))`}if(Zu.has(r)){let o=tt(n,t),a=tt(s,t);return`(${o} ${r} ${a})`}if(yg.has(r)){let o=mg(n,t),a=tt(s,t);return`${o} ${r} ${a}`}if(bg.has(r)){let o=mg(n,t);switch(r){case"push":return`${o}.push(${tt(s,t)})`;case"unshift":return`${o}.unshift(${tt(s,t)})`;case"pop":return`${o}.pop()`;case"shift":return`${o}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>tt(l,t)).join(", "):tt(s,t);return`${o}.splice(${a})`}default:break}}if(tf.has(r)){let o=tt(n,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>tt(l,t)).join(", "):tt(s,t);return`(${o})?.${r}?.(${a})`}if(Qu.has(r)){let o=tt(n,t),a=Bt(s,t);if(r==="reduce"){let l=tt(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 xi(e,t,r,n){return ze(e,t,r,n)}function Tn(e,t={}){return tt(e,t)}var gg,Xu,Zu,yg,bg,Qu,ef,tf,nO,sO,iO,dg=64,aO=64;var Do=H(()=>{Gu();Pe();bi();gg=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Xu=new Set(["!","-"]),Zu=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),yg=new Set(["=","+=","-=","*=","/="]),bg=new Set(["push","pop","shift","unshift","splice"]),Qu=new Set(["reduce","map","filter"]),ef=new Set(["?:","switch"]),tf=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"]),nO=new Set([...gg,...Xu,...Zu,...Qu,...ef,...tf,"call"]),sO=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",...zu]),iO=new Map([["Intl/compare",(e,t,r,n)=>new Intl.Collator(r??Wr,n).compare(e,t)],["Intl/displayName",(e,t,r,n)=>new Intl.DisplayNames(r??Wr,{...n,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,r)=>new Intl.DateTimeFormat(t??Wr,{timeZone:Uu,...r}).format(new Date(e))],["Intl/formatList",(e,t,r)=>new Intl.ListFormat(t??Wr,r).format(e)],["Intl/formatNumber",(e,t,r)=>new Intl.NumberFormat(t??Wr,r).format(e)],["Intl/formatRelativeTime",(e,t,r,n)=>new Intl.RelativeTimeFormat(r??Wr,n).format(e,t)],["Intl/plural",(e,t,r)=>new Intl.PluralRules(t??Wr,r).select(e)],["Intl/segment",(e,t,r)=>[...new Intl.Segmenter(r??Wr,{granularity:t??"grapheme"}).segment(e)].map((n)=>n.segment)]])});function vg(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 pO(e){return(q(e)||It(e))&&"then"in e&&It(e.then)}async function $i(e,t,r,n={}){let s=n.args?{args:n.args}:void 0;for(let i of e){let o=vg(i);switch(o.kind){case"expression":{let a=br(o.node,t,r,s);if(pO(a))await a;break}case"if":{let a=o.node,l=xi(a.if,t,r,s)?a.then:a.else;if(Array.isArray(l))await $i(l,t,r,n);break}case"switch":{let a=o.node,l=String(xi(a.$switch,t,r,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await $i(u,t,r,n);break}case"dispatch":{let a=o.node,l=It(n.target)?n.target():n.target,c=r?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=xi(a.detail,t,r,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{r?.stopPropagation();break}case"preventDefault":{r?.preventDefault();break}default:break}}}function Er(e,t={}){let r=t.indent??"",n=[];for(let s of e){let i=vg(s);switch(i.kind){case"expression":{n.push(`${r}${Bt(i.node,t)};`);break}case"if":{let o=i.node,a=Tn(o.if,t),l={...t,indent:`${r} `};if(n.push(`${r}if (${a}) {`,Er(o.then??[],l)),o.else)n.push(`${r}} else {`,Er(o.else,l));n.push(`${r}}`);break}case"switch":{let o=i.node,a=Tn(o.$switch,t),l={...t,indent:`${r} `};n.push(`${r}switch (String(${a})) {`);for(let[c,u]of Object.entries(o.cases??{}))n.push(`${r} case ${JSON.stringify(c)}: {`,Er(u,l),`${r} break;`,`${r} }`);if(o.default)n.push(`${r} default: {`,Er(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: ${Tn(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 u=c.length>0?`, { ${c.join(", ")} }`:"";n.push(`${r}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(o.dispatchEvent)}${u}));`);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 rl=H(()=>{Pe();Do()});function vi(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 Sg(){return[...wg].toSorted()}function zs(e,t){let r=e.toLowerCase();if(r.startsWith("aria-")||wg.has(r))return String(t);return t?"":null}var In,wg,nf=32,nl,sl="jx-slot",Lo="data-jx-slots",sf="jx.slot.group",h8;var wi=H(()=>{Mo();Do();bi();Pe();gr();rl();Mo();In=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"]),wg=new Set(["contenteditable","draggable","spellcheck"]);nl=/^[\t\n\f\r ]+$/u,h8=(()=>{let e=Symbol.for(sf),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function Eg(e,t,r,n,s=hO){let i=[],o=(p,g)=>{let m={mediaQueries:t,scope:g,transposeValue:r};if(n)m.resolveValue=(b,h)=>n(b,h,g);for(let b of yi(p,m))i.push(b.text)},a={},l={},c=[],u=[];for(let[p,g]of Object.entries(e)){if(q(g)&&!Array.isArray(g)){if(p.startsWith("@"))c.push([p,g]);else if(!p.startsWith("--"))u.push([p,g]);continue}if(Zn(p)||p.startsWith("@"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")a[p]=g;else l[p]=g}o(a,s.root),o(l,s.body);for(let[p,g]of u)if(p.startsWith("&"))o({[p]:g},s.root);else o(g,p);for(let[p,g]of c){if(No(p)||Io(p)){o({[p]:g},null);continue}let m={},b={},h=[];for(let[y,v]of Object.entries(g)){if(q(v)&&!Array.isArray(v)){if(!y.startsWith("@"))h.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 h)o({[p]:v},y)}if(Object.values(t).some((p)=>Lr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${Dr}="light"]) { color-scheme: light }`,`${s.root}:where([${Dr}="dark"]) { color-scheme: dark }`);return i.join(`
74
- `)}var hO;var Pg=H(()=>{Mo();Pe();hO={body:"body",root:":root"}});function jg(e){return e===!1||e==="open"||e==="closed"}function Gs(e,t){let r=e?.$shadow;if(jg(r))return r===!1?null:r;let n=t?.shadow;return jg(n)&&n!==!1?n:null}function kg(e,t){return t===null?e:":host"}function qo(e,t){let r=[];for(let[n,s]of(e.parameters??[]).entries()){let i=_g(s);if(!i)continue;let o=Rg(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 _g(e){return T(e)?e:e?.name??""}function Rg(e){return q(e)&&"default"in e}function al(e,t){let r=uf(e,t);return r===e?e:`${r} as ${e}`}function uf(e,t){let r=t?.$export;return T(r)&&r!==""?r:e}function ll(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i}=r,{url:o}=t,a=ye(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 = \`${yO(o,n)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(o)};`);let u=[];if(l!=="GET")u.push(`method: ${JSON.stringify(l)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let g=q(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${g}`)}let p=u.length>0?`, { ${u.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((g)=>`${s}${g}`).join(`
75
- `)}function cl(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(([h,y])=>{if(!Je(y))return`${Cn(h)}: ${JSON.stringify(y)}`;if(gO.some((v)=>y.$ref.startsWith(v)))throw Error(`Server function "${e}": argument "${h}" references "${y.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${Cn(h)}: ${Tn({$ref:y.$ref},{statePrefix:n})}`}),u=l.some(([,h])=>Je(h)),p=`${Mg}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,g=Ce(n,St(e)),m=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(u?[`// ${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) ${g} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,i?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,p,` .then((d) => { ${g} = d; })`,` .catch((e) => { ${m}; });`]).map((h)=>`${s}${h}`).join(`
76
- `)}function yO(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(r,n)=>`\${${n.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function ul(e){if(!q(e))return!1;if(e.state)for(let[t,r]of Object.entries(e.state)){if(t==="$site"||t==="$page")continue;if(!q(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(r.$prototype)return!0;if("default"in r)return!0;if(Un(r))continue;return!0}if(e.$switch)return!0;if(rt(e)||bu(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>ul(t)))return!0;for(let[t,r]of Object.entries(e)){if(In.has(t))continue;if(Je(r))return!0;if(ye(r))return!0}if(q(e.style)){for(let t of Object.values(e.style))if(ye(t))return!0}if(q(e.attributes)){for(let t of Object.values(e.attributes))if(ye(t))return!0}return!1}function Og(e){if(!q(e))return!1;if(e.$switch)return!0;if(rt(e)||bu(e.children))return!0;for(let[t,r]of Object.entries(e)){if(In.has(t))continue;if(Je(r))return!0;if(ye(r))return!0}if(q(e.style)){for(let t of Object.values(e.style))if(ye(t))return!0}if(q(e.attributes)){for(let t of Object.values(e.attributes))if(ye(t))return!0}return!1}function ki(e,t=null,r={},n={}){let s=e?.state?Si(e.state,t):t??Cg();return{media:n,scope:s,scopeDefs:r}}function Cg(e=null){return Object.create(e)}function Ng(e){return e[Ag]}function lf(e,t){if(T(e)){for(let i of e.matchAll(bO))t.add(i[1]);for(let i of e.matchAll(xO))t.add(i[1]);return}if(Array.isArray(e)){for(let i of e)lf(i,t);return}if(!q(e))return;let r=e,{operator:n,target:s}=r;if(T(n)&&Nn(n)&&Je(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let i of Object.values(r))lf(i,t)}function Si(e={},t=null){let r=Cg(t),n=t?Ng(t):void 0,s=new Set(n);Object.defineProperty(r,Ag,{configurable:!0,enumerable:!1,value:s,writable:!0});let i=new Set;for(let c of Object.values(e))if(pr(c)||mr(c))lf(c.body??c.$expression,i);for(let c of i)if(c in e)s.add(c);for(let[c,u]of Object.entries(e)){if(!q(u)||Array.isArray(u)){Mn(r,c,il(u));continue}if("default"in u){Mn(r,c,il(u.default));continue}if(En(u)){s.add(c);continue}if(!u.$prototype&&!("$expression"in u)&&!Un(u))Mn(r,c,il(u))}let o=[],a=[];for(let[c,u]of Object.entries(e)){if(ye(u)){o.push([c,u]);continue}if(!q(u))continue;if(mr(u)){let p=u.$expression;if(Ns(u)){let g=u.parameters;Mn(r,c,(...m)=>{let b={};for(let[h,y]of g.entries()){let v=_g(y);if(!v)continue;b[v]=m[h]===void 0&&Rg(y)?y.default:m[h]}return br(p,r,null,{args:b})})}else if(Nn(p.operator))Mn(r,c,(g,m)=>br(p,g,m));else of(r,c,()=>br(p,r,null));continue}if(pr(u)){if(Wn(u)){let{body:p}=u;Mn(r,c,(g,m)=>{$i(p,g??r,m??null)})}else if(T(u.body)){let p=u.parameters?Pn(u.parameters):u.arguments??[],{body:g}=u,m=p.includes("state")?p:["state",...p],b=Function(...m,g),h=(y,v)=>b(...m.map((k)=>k==="state"?y:v));if(Ts(g))of(r,c,()=>h(r)),a.push([c,g]);else Mn(r,c,h)}else Mn(r,c,()=>{}),s.add(c);continue}if(Vr(u)&&(u.$prototype==="LocalStorage"||u.$prototype==="SessionStorage")){Mn(r,c,il(u.default??null));continue}if(Vr(u)&&u.$prototype==="Request")s.add(c)}let l=!0;while(l){l=!1;for(let[c,u]of[...a,...o])if(!s.has(c)&&Tg(u,r))s.add(c),l=!0}for(let[c,u]of o)of(r,c,()=>Mt(u,r));return r}function Mn(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function of(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:r})}function Ve(e,t){if(Je(e))return ff(e.$ref,t);if(ye(e))return Mt(e,t);return e}function rr(e){return Je(e)}function ff(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?af(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return af(t,e.slice(8));return af(t,e)??null}function Tg(e,t){if(!t)return!1;let r=Ng(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(It(i))return!0}return!1}function fl(e){return vi(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Mt(e,t){if(Tg(e,t))return null;let r=["state","$map","$site","$page"],n=[t,t?.$map,t?.$site,t?.$page];try{let s=vi(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...r,s)(...n)}catch{return null}}function af(e,t){return kt(e,t)}function il(e){if(!q(e))return e;return structuredClone(e)}function $O(e,t){if(!e||!t)return"";return Object.entries(e).filter(([r,n])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&ye(n)).map(([r,n])=>{let s=Ve(n,t);return s==null?null:`${tr(r)}: ${s}`}).filter(Boolean).join("; ")}function Ks(e,t,r=""){let n="",s=Ve(e.id,t),i=Ve(e.className,t),o=Ve(e.hidden,t),a=Ve(e.tabIndex,t),l=Ve(e.title,t),c=Ve(e.lang,t),u=Ve(e.dir,t);if(s)n+=` id="${je(String(s))}"`;if(i)n+=` class="${je(String(i))}"`;if(o)n+=" hidden";if(a!==void 0&&a!==null)n+=` tabindex="${je(String(a))}"`;if(l)n+=` title="${je(String(l))}"`;if(c)n+=` lang="${je(String(c))}"`;if(u)n+=` dir="${je(String(u))}"`;let p=[$O(e.style,t),r].filter(Boolean).join("; ");if(p)n+=` style="${je(p)}"`;if(e.attributes)for(let[g,m]of Object.entries(e.attributes)){let b=Ve(m,t);if(Tt(b)){let h=zs(g,b);if(h!==null)n+=h===""?` ${g}`:` ${g}="${je(h)}"`;continue}if(T(b)||Xt(b))n+=` ${g}="${je(String(b))}"`}if(e.$static)n+=" data-jx-static";else if(e.$prerendered)n+=" data-jx-prerendered";return n}function Ho(e,t=" "){return e?"":`
77
- ${t}`}function _i(){let e=JSON.stringify(el),t=JSON.stringify(Dr);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function ol(e,t,r,n){for(let s of yi(t,{mediaQueries:n,resolveValue:(i,o)=>Ig(i,o,r),scope:r}))e.push(s.text)}function Ig(e,t,r){let n=T(t)?t:t.$ref;return vO.push({property:e,selector:r,source:n}),null}function dl(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Sg())});
78
- function ${Ri}(n, v) {
114
+ 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}=b2();if(t)return["node",[e]];else return[e,[]]}},ul=()=>w2.isatty(2),v2={readFile(e,t){try{let r=Bi.readFileSync(e,"utf8");try{Bi.unlinkSync(e)}catch{}t(null,r)}catch(r){t(r,null)}},writeFile(e,t){try{let r=D0();Bi.writeFileSync(r,e),t(r)}catch{t(null)}}},S2={readFile(e,t){try{Bi.readFile(e,"utf8",(r,n)=>{try{Bi.unlink(e,()=>t(r,n))}catch{t(r,n)}})}catch(r){t(r,null)}},writeFile(e,t){try{let r=D0();Bi.writeFile(r,e,(n)=>n!==null?t(null):t(r))}catch{t(null)}}},E2="0.28.2",P2=(e)=>Gi().build(e),j2=(e)=>Gi().context(e),k2=(e,t)=>Gi().transform(e,t),_2=(e,t)=>Gi().formatMessages(e,t),A2=(e,t)=>Gi().analyzeMetafile(e,t),R2=(e)=>{if(lr&&!dl){if(!cr)cr=ou(lr);return cr.buildSync(e)}let t;return iu((r)=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:ul(),defaultWD:Ui,callback:(n,s)=>{if(n)throw n;t=s}})),t},O2=(e,t)=>{if(lr&&!dl){if(!cr)cr=ou(lr);return cr.transformSync(e,t)}let r;return iu((n)=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:ul(),fs:v2,callback:(s,i)=>{if(s)throw s;r=i}})),r},C2=(e,t)=>{if(lr&&!dl){if(!cr)cr=ou(lr);return cr.formatMessagesSync(e,t)}let r;return iu((n)=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},N2=(e,t)=>{if(lr&&!dl){if(!cr)cr=ou(lr);return cr.analyzeMetafileSync(e,t)}let r;return iu((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},T2=()=>{if(nu)nu();if(cr)cr.stop();return Promise.resolve()},Rp=!1,I2=(e)=>{if(e=o2(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(Rp)throw Error('Cannot call "initialize" more than once');return Gi(),Rp=!0,Promise.resolve()},Ui=process.cwd(),ll,nu,Gi=()=>{if(ll)return ll;let[e,t]=M0(),r=J0.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:Ui}),{readFromStdout:n,afterClose:s,service:i}=N0({writeToStdin(u){r.stdin.write(u,(p)=>{if(p)s(p)})},readFileSync:Bi.readFileSync,isSync:!1,hasFS:!0,esbuild:fl});r.stdin.on("error",s),r.on("error",s);let{stdin:o,stdout:a}=r;a.on("data",n),a.on("end",s),nu=()=>{o.destroy(),a.destroy(),r.kill(),Rp=!1,ll=void 0,nu=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 ll={build:(u)=>new Promise((p,h)=>{i.buildOrContext({callName:"build",refs:c,options:u,isTTY:ul(),defaultWD:Ui,callback:(m,b)=>m?h(m):p(b)})}),context:(u)=>new Promise((p,h)=>i.buildOrContext({callName:"context",refs:c,options:u,isTTY:ul(),defaultWD:Ui,callback:(m,b)=>m?h(m):p(b)})),transform:(u,p)=>new Promise((h,m)=>i.transform({callName:"transform",refs:c,input:u,options:p||{},isTTY:ul(),fs:S2,callback:(b,g)=>b?m(b):h(g)})),formatMessages:(u,p)=>new Promise((h,m)=>i.formatMessages({callName:"formatMessages",refs:c,messages:u,options:p,callback:(b,g)=>b?m(b):h(g)})),analyzeMetafile:(u,p)=>new Promise((h,m)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:p,callback:(b,g)=>b?m(b):h(g)}))},ll},iu=(e)=>{let[t,r]=M0(),n=new Uint8Array,{readFromStdout:s,afterClose:i,service:o}=N0({writeToStdin(l){if(n.length!==0)throw Error("Must run at most one command");n=l},isSync:!0,hasFS:!0,esbuild:fl});e(o);let a=J0.execFileSync(t,r.concat("--service=0.28.2"),{cwd:Ui,windowsHide:!0,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),i(null)},D0=()=>Ap.join($2.tmpdir(),`esbuild-${x2.randomBytes(32).toString("hex")}`),cr=null,ou=(e)=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:Ui,esbuildVersion:"0.28.2"},transferList:[r],execArgv:[]}),s=0,i=(c)=>{let u=Error(`Build failed with 1 error:
115
+ error: ${c}`),p=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=p,u.warnings=[],u},o=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw i("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let p in u)c[p]=u[p]},l=(c,u)=>{let p=s++,h=new SharedArrayBuffer(8),m=new Int32Array(h),b={sharedBuffer:h,id:p,command:c,args:u};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:w,reject:P,properties:S}}=e.receiveMessageOnPort(t);if(p!==y)throw Error(`Internal error: Expected id ${p} but got id ${y}`);if(P)throw a(P,S),P;return w};return n.unref(),{buildSync(c){return o(c),l("build",[c])},transformSync(c,u){return l("transform",[c,u])},formatMessagesSync(c,u){return l("formatMessages",[c,u])},analyzeMetafileSync(c,u){return l("analyzeMetafile",[c,u])},stop(){n.terminate(),cr=null}}},J2=()=>{let e=lr.workerData.workerPort,t=lr.parentPort,r=(n)=>{let s={};if(n&&typeof n==="object")for(let i in n)s[i]=n[i];return s};try{let n=Gi();Ui=lr.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(u){e.postMessage({id:o,reject:u,properties:r(u)})}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(dl)J2();var M2=fl});import{createRequire as D2}from"node:module";import{join as L2}from"node:path";function Cp(e,t){return D2(L2(t,"package.json")).resolve(e)}function F2(e){return e==="node"||e==="bun"?"node":"browser"}async function Np(e){let t=await Promise.resolve().then(() => gr(au(),1)),{entry:r}=e,n={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:F2(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 F0=()=>{};var q0=".jx-entry-";import{rmSync as V2,writeFileSync as V0}from"node:fs";import{tmpdir as W2}from"node:os";import{basename as H2,join as B2,resolve as U2}from"node:path";function H0(e){return qi(e)||e.startsWith("./")||e.startsWith("../")}function Tp(e,t,r){if(qi(e))return Cp(e.slice(zc.length),r);return U2(t,e)}function B0(e,t){return Cp(e,t)}function z2(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 G2(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function Y2(e){return e.minify??e.target==="browser"}function X2(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...K2};return t}function U0(e){return{...X2(e),external:e.external??[],minify:Y2(e),plugins:z2(e),target:e.target}}async function z0(e,t){let r=await Np({entry:{path:e.entryPath},...U0(t)});V0(e.outfile,r,"utf8")}function Ip(e){return e==="<stdin>"||H2(e).startsWith(q0)}async function G0(e,t,r){let n=[],s=B2(W2(),`jx-resolve-${process.pid}.js`);try{await Ki(`export * from ${JSON.stringify(e)};
116
+ `,{outfile:s,resolveDir:t},{...r,minify:!1,onFileLoaded:(i)=>n.push(i)})}catch{return}finally{V2(s,{force:!0})}return n.find((i)=>!Ip(i))}async function Ki(e,{resolveDir:t,outfile:r},n){let s=await Np({entry:{resolveDir:t,source:e},...U0(n)});V0(r,s,"utf8")}async function K0(e,{projectRoot:t,outfile:r,adapter:n}){await Ki(e,{outfile:r,resolveDir:t},G2(n))}var W0,K2;var Jp=D(()=>{Lr();F0();W0=["@vue/reactivity","lit-html"];K2={"process.env.NODE_ENV":'"production"'}});function Q2(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Y0(e){let t=Q2(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(Z2,(l,c,u)=>{if(i=!0,c)return o=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:o,isDynamic:i,params:s,urlPattern:a}}function X0(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 Z2;var Z0=D(()=>{Z2=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function tI(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Q0(e){if(!B(e)||!("paginate"in e))return null;let{each:t,pageSize:r,paginate:n}=e,s=B(n)?n.$ref:void 0,i=O(s)?eI.exec(s)?.[1]:void 0;if(i===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Nt(r)||!Number.isInteger(r)||r<1)throw TypeError("$paths.pageSize must be a positive integer");let o={key:tI(i),pageSize:r};if(t!==void 0){if(!B(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(B(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");o.each=t}return o}function Mp(e,t){return Math.max(1,Math.ceil(e/t))}function ex(e,t,r){let n=(t-1)*r;return e.slice(n,n+r)}function Yi(e,t){if(e.endsWith("*")){if(t===1){let r=e.slice(0,-1).replace(/\/$/,"");return r===""?"/":r}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function tx(e,t,r,n){let s=Mp(n,r),i=[];for(let o=1;o<=s;o++)i.push({current:o===t,number:o,url:Yi(e,o)});return{first:Yi(e,1),itemCount:n,last:Yi(e,s),next:t<s?Yi(e,t+1):null,number:t,pageCount:s,pageSize:r,pages:i,prev:t>1?Yi(e,t-1):null}}var eI;var rx=D(()=>{ve();eI=/^#\/state\/([^/]+)$/});function Kr(e){if(!O(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function pl(e){let t=Kr(e);if(t===null)return"ltr";let r=new Intl.Locale(t),n=r.script??r.maximize().script;return n!==void 0&&rI.has(n)?"rtl":"ltr"}function nx(e){let t=Kr(e);if(t===null)return O(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Dp(e){let t=e.i18n,r=[];if(!V(t))return{errors:r,i18n:null};let n=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of n){let l=Kr(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=Kr(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Kr(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:nI;return{errors:r,i18n:{defaultLocale:i,locales:s,routing:o}}}function hn(e,t){if(t===null)return null;let r=e.split("/").find(Boolean);if(r===void 0)return t.defaultLocale;let n=Kr(r);return n!==null&&t.locales.includes(n)?n:t.defaultLocale}var rI,lu="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",nI="prefix-except-default";var Xi=D(()=>{ve();rI=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 Sr(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function sx(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let r=e.slice(2,-1).trim();return sI.has(r.toLowerCase())?r:e.slice(1)}return null}function ml(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function gl(e){return e.startsWith("@keyframes")}function ix(e,t){let r=[];for(let n of hl(e))for(let s of hl(t))r.push(iI(n,s));return r.join(", ")}function iI(e,t){let r=uu(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Lp(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 uu(e,t){return Lp(e).length>0?oI(e,t):null}function oI(e,t){let r="",n=0;for(let s of Lp(e))r+=e.slice(n,s)+t,n=s+1;return r+e.slice(n)}function hl(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 yn(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Fp(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${gn}]))`,forced:`${e}:where([${gn}="${t}"])`};return{auto:`:where(:root:not([${gn}])) ${e}`,forced:`:where(:root[${gn}="${t}"]) ${e}`}}function Hs(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function qp(e){return e.startsWith("--")?e:Sr(e)}function cu(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 ox(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 aI(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 lI(e){let t=Object.keys(e).filter((n)=>gl(n));if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}function cI(e){let r=Lp(e).at(-1),n=r===void 0?e:e.slice(r+1);return n===""||n.startsWith(":")||n.startsWith(".")||n.startsWith("[")}function Lo(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)&&!We(y),c=(y,w)=>{if(l(w))return[w];if(!ml(y)||!Array.isArray(w)||w.length===0)return[];return w.every((P)=>l(P))?w:[]},u=(y,w,P,S)=>{if(w===void 0||w===null)return null;if(We(w))return P?o?.(y,w,S)??null:null;if(V(w))return null;let E=String(w);if(ye(E))return P?o?.(y,E,S)??null:null;return s(E)},p=(y,w,P=!0,S="self")=>{let E=[];for(let[k,A]of Object.entries(y)){if(c(k,A).length>0)continue;if(w&&(k.startsWith("@")||Hs(k)))continue;if(k.startsWith("$"))continue;let R=u(k,A,P,S);if(R!==null)E.push([qp(k),R])}return E},h=(y,w,P,S,E)=>{if(P.length===0)return;let k=w;if(k!==null){let _=i(k);if(_===null)return;k=_}let A=ox(y,k,P),R={text:A,conditions:[...y],selector:k,declarations:P,target:S,key:cu(A)};if(O(E)&&E!=="")R.description=E;a.push(R)},m=(y,w,P)=>{let S=y.slice(10).trim();if(S==="")return;let E=[];for(let[A,R]of Object.entries(w)){if(!l(R))continue;let _=p(R,!0,!1,"unscoped");if(_.length>0)E.push({declarations:_,selector:A.trim()})}if(E.length===0)return;let k=aI(P,S,E);a.push({blocks:E,conditions:[...P],declarations:[],key:cu(k),selector:null,target:"unscoped",text:k})},b=(y,w,P,S,E)=>{if(y==="@--")return;if(ml(y)){h([...S,y],null,p(w,!1,!0,"unscoped"),"unscoped",w.$description);return}if(gl(y)){m(y,w,S);return}let k=sx(y,n),A=k===null?y:`@media ${k}`,R=k===null?null:yn(k);if(R!==null&&P!==null){let{auto:_,forced:I}=Fp(P,R);g(w,_,[...S,A],E),g(lI(w),I,S,E);return}g(w,P,[...S,A],E)};function g(y,w,P,S){h(P,w,p(y,!0,!0,S),S,y.$description);for(let[E,k]of Object.entries(y))for(let A of c(E,k))if(E.startsWith("@"))b(E,A,w,P,S);else if(w!==null)g(A,ix(w,E),P,cI(E)?S:"descendant")}return g(e,r,[],"self"),a}var sI,gn="data-color-scheme",fu="jx-color-scheme";var yl=D(()=>{ve();sI=new Set(["all","print","screen","speech"])});function cx(){return`the Intl helpers ${Wp.join(", ")}`}var _n="en-US",Vp="UTC",ax,Wp,lx;var Hp=D(()=>{ax=[{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."}],Wp=ax.map((e)=>e.path),lx=Object.fromEntries(ax.map((e)=>[e.path,e.params.indexOf("locale")]))});function uI(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Dt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function bs(e){if(e==="")return[];return e.split("/").map((t)=>uI(t))}function Wt(e,t){let r=e;for(let n of bs(t))r=r?.[n];return r}function Je(e,t){let r=e;for(let n of bs(t))r+=Bp.test(n)?`.${n}`:`[${JSON.stringify(n)}]`;return r}function ux(e,t){let r=e;for(let[n,s]of bs(t).entries()){let i=n===0?"":"?.";r+=Bp.test(s)?`${n===0?".":i}${s}`:`${i}[${JSON.stringify(s)}]`}return r}function xs(e){return Bp.test(e)?e:JSON.stringify(e)}function fx(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Bp;var Fo=D(()=>{Bp=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Up(e){let t=e.$map;return V(t)?t:void 0}function hx(e){return V(e)&&!Array.isArray(e)&&"operator"in e}function bl(e){return V(e)&&!Array.isArray(e)&&"$ref"in e}function mI(e,t,r){let n=lx[e];if(n===void 0||n<0||t[n]!=null)return t;let s=Wt(r.$page,"locale");if(!O(s)||s==="")return t;let i=[...t];return i[n]=s,i}function xx(e){return e.startsWith("window#/")&&dI.has(e.slice(8))}function $s(e){return gx.has(e)}function lt(e,t){if(!e)return;let r=(e.depth??0)+1;if(r>hI)return;return{depth:r,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function nt(e,t,r,n,s){if(e===null||e===void 0)return e;if(hx(e))return qr(e,t,r,n,s);if(bl(e)){let i=du(e.$ref,t,r,n);return s?.report(s.path??[],i),i}if(Array.isArray(e))return $x(e,t,r,n,s);return s?.report(s.path??[],e),e}function $x(e,t,r,n,s){return e.map((i,o)=>nt(i,t,r,n,lt(s,o)))}function gI(e,t,r,n){let s=(i)=>{if(!e.slice(i.length).includes("/"))return t;return du(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?du(e.slice(0,e.lastIndexOf("/")),t,r,n):void 0;return}function du(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?Wt(i,s.slice(1).join("/")):i}if(e.startsWith("event#/")){let s=e.slice(7);return Wt(r,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=Up(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?Wt(o,s.slice(2).join("/")):o}if(e.startsWith("#/state/"))return Wt(t,e.slice(8));if(e.startsWith("parent#/"))return Wt(t,e.slice(8));if(e.startsWith("window#/"))return Wt(globalThis.window,e.slice(8));if(e.startsWith("document#/"))return Wt(globalThis.document,e.slice(10));return Wt(t,e)??null}function yI(e,t,r,n){if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=Up(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(),u=l.length>0?Wt(o,l.join("/")):o;return{key:c,obj:u}}return{key:i==="item"?"$map/item":"$map/index",obj:Up(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let o=bs(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 qr(e,t,r,n,s){let i=bI(e,t,r,n,s);return s?.report(s.path??[],i),i}function px(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 bI(e,t,r,n,s){let{operator:i,target:o,value:a,initial:l}=e;if(!fI.has(i))throw Error(`$expression: unknown operator "${i}"`);if(zp.has(i)&&!("value"in e)){let c=nt(o,t,r,n,lt(s,"target"));if(i==="!")return!c;if(i==="-")return-c}if(i==="call"){let c=bl(o)?o.$ref:void 0;if(!O(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(n?.callDepth??0)+1;if(u>dx)throw Error(`$expression: call depth exceeded (${dx})`);let p=Array.isArray(a)?a.map((m,b)=>nt(m,t,r,n,lt(s,["value",b]))):[];if(c.startsWith("window#/")){if(!xx(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),b=pI.get(m);if(b)return b(...mI(m,p,t));let g=Wt(globalThis.window,m),y=m.lastIndexOf("/"),w=y===-1?globalThis.window:Wt(globalThis.window,m.slice(0,y));return g.apply(w,p)}let h=du(c,t,r,n);if(Vt(h))return h.apply(gI(c,t,r,n),p);if(V(h)&&"$expression"in h){let m=h,b={};for(let[g,y]of(m.parameters??[]).entries()){let w=O(y)?y:y?.name??"";if(!w)continue;b[w]=p[g]===void 0&&V(y)&&"default"in y?y.default:p[g]}return qr(m.$expression,t,r,{args:b,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Yp.has(i)){if(i==="?:"){let m=nt(o,t,r,n,lt(s,"target"));if(s){let b=nt(a,t,r,n,lt(s,"value")),g=nt(l,t,r,n,lt(s,"initial"));return m?b:g}return m?nt(a,t,r,n):nt(l,t,r,n)}let c=nt(o,t,r,n,lt(s,"target")),u=String(c),p=e.cases??{},h=Object.hasOwn(p,u);if(s){let m;for(let[g,y]of Object.entries(p)){let w=nt(y,t,r,n,lt(s,["cases",g]));if(g===u)m=w}let b=nt(e.default,t,r,n,lt(s,"default"));return h?m:b}return h?nt(p[u],t,r,n):nt(e.default,t,r,n)}if(Gp.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=nt(a,t,r,n,lt(s,"value"));switch(i){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return px(i,c,u)}}if(yx.has(i)){let c=nt(a,t,r,n,lt(s,"value")),{obj:u,key:p}=yI(o.$ref,t,r,n);u[p]=i==="="?c:px(i.slice(0,-1),u[p],c);return}if(bx.has(i)){let c=nt(o,t,r,n,lt(s,"target"));switch(i){case"push":return c.push(nt(a,t,r,n,lt(s,"value")));case"unshift":return c.unshift(nt(a,t,r,n,lt(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=nt(a,t,r,n,lt(s,"value"));return c.splice(...u)}default:break}}if(Xp.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=a===void 0?[]:Array.isArray(a)?$x(a,t,r,n,lt(s,"value")):[nt(a,t,r,n,lt(s,"value"))],p=Wt(c,i);if(!Vt(p))return;return p.apply(c,u)}if(Kp.has(i)){let c=nt(o,t,r,n,lt(s,"target")),u=a;if(i==="reduce"){let p=nt(l,t,r,n,lt(s,"initial"));for(let[h,m]of c.entries())p=qr(u,t,r,{acc:p,index:h,item:m},h===0?lt(s,"value"):void 0);return p}if(i==="map")return c.map((p,h)=>qr(u,t,r,{...n,index:h,item:p},h===0?lt(s,"value"):void 0));if(i==="filter")return c.filter((p,h)=>qr(u,t,r,{...n,index:h,item:p},h===0?lt(s,"value"):void 0))}return}function ut(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(hx(e))return ur(e,t);if(bl(e))return Zp(e.$ref,t);if(Array.isArray(e))return e.map((r)=>ut(r,t)).join(", ");return JSON.stringify(e)}function xI(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function Zp(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 Je("_args",e.slice(6));if(e.startsWith("event#/"))return Je(n,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s;if(i==="item")return s.length>2?Je("_item",s.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(e.startsWith("#/state/"))return Je(r,e.slice(8));if(e.startsWith("parent#/"))return Je(r,e.slice(8));if(e.startsWith("window#/"))return Je("window",e.slice(8));if(e.startsWith("document#/"))return Je("document",e.slice(10));return Je(r,e)}function mx(e,t){if(bl(e))return Zp(e.$ref,t);return ut(e,t)}function $I(e,t,r){let n=(o)=>t[o]??"undefined",s=`(${r.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(_n)})`,i=JSON.stringify(Vp);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 ur(e,t={}){let{operator:r,target:n,value:s,initial:i}=e;if(zp.has(r)&&!("value"in e)){let o=ut(n,t);if(r==="!")return`!(${o})`;if(r==="-")return`-(${o})`}if(r==="call"){let o=(bl(n)?n.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>ut(l,t)):[];if(o.startsWith("window#/")){if(!xx(o))throw Error(`$expression: "${o}" is not a blessed pure global`);let l=$I(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 u=c.map((p,h)=>`${JSON.stringify(p)}: ${a[h]??"undefined"}`).join(", ");return`${xI(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${Zp(o,t)}(${a.join(", ")})`}if(Yp.has(r)){if(r==="?:"){let c=ut(n,t),u=ut(s,t),p=ut(i,t);return`(${c} ? ${u} : ${p})`}let o=ut(n,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${ut(u,t)} : `).join(""),l="default"in e?ut(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${o}))`}if(Gp.has(r)){let o=ut(n,t),a=ut(s,t);return`(${o} ${r} ${a})`}if(yx.has(r)){let o=mx(n,t),a=ut(s,t);return`${o} ${r} ${a}`}if(bx.has(r)){let o=mx(n,t);switch(r){case"push":return`${o}.push(${ut(s,t)})`;case"unshift":return`${o}.unshift(${ut(s,t)})`;case"pop":return`${o}.pop()`;case"shift":return`${o}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>ut(l,t)).join(", "):ut(s,t);return`${o}.splice(${a})`}default:break}}if(Xp.has(r)){let o=ut(n,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>ut(l,t)).join(", "):ut(s,t);return`(${o})?.${r}?.(${a})`}if(Kp.has(r)){let o=ut(n,t),a=ur(s,t);if(r==="reduce"){let l=ut(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 qo(e,t,r,n){return nt(e,t,r,n)}function ws(e,t={}){return ut(e,t)}var gx,zp,Gp,yx,bx,Kp,Yp,Xp,fI,dI,pI,dx=64,hI=64;var xl=D(()=>{Hp();ve();Fo();gx=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),zp=new Set(["!","-"]),Gp=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),yx=new Set(["=","+=","-=","*=","/="]),bx=new Set(["push","pop","shift","unshift","splice"]),Kp=new Set(["reduce","map","filter"]),Yp=new Set(["?:","switch"]),Xp=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"]),fI=new Set([...gx,...zp,...Gp,...Kp,...Yp,...Xp,"call"]),dI=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",...Wp]),pI=new Map([["Intl/compare",(e,t,r,n)=>new Intl.Collator(r??_n,n).compare(e,t)],["Intl/displayName",(e,t,r,n)=>new Intl.DisplayNames(r??_n,{...n,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,r)=>new Intl.DateTimeFormat(t??_n,{timeZone:Vp,...r}).format(new Date(e))],["Intl/formatList",(e,t,r)=>new Intl.ListFormat(t??_n,r).format(e)],["Intl/formatNumber",(e,t,r)=>new Intl.NumberFormat(t??_n,r).format(e)],["Intl/formatRelativeTime",(e,t,r,n)=>new Intl.RelativeTimeFormat(r??_n,n).format(e,t)],["Intl/plural",(e,t,r)=>new Intl.PluralRules(t??_n,r).select(e)],["Intl/segment",(e,t,r)=>[...new Intl.Segmenter(r??_n,{granularity:t??"grapheme"}).segment(e)].map((n)=>n.segment)]])});function wx(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 wI(e){return(V(e)||Vt(e))&&"then"in e&&Vt(e.then)}async function Vo(e,t,r,n={}){let s=n.args?{args:n.args}:void 0;for(let i of e){let o=wx(i);switch(o.kind){case"expression":{let a=qr(o.node,t,r,s);if(wI(a))await a;break}case"if":{let a=o.node,l=qo(a.if,t,r,s)?a.then:a.else;if(Array.isArray(l))await Vo(l,t,r,n);break}case"switch":{let a=o.node,l=String(qo(a.$switch,t,r,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await Vo(u,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 u={};if("detail"in a)u.detail=qo(a.detail,t,r,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{r?.stopPropagation();break}case"preventDefault":{r?.preventDefault();break}default:break}}}function Yr(e,t={}){let r=t.indent??"",n=[];for(let s of e){let i=wx(s);switch(i.kind){case"expression":{n.push(`${r}${ur(i.node,t)};`);break}case"if":{let o=i.node,a=ws(o.if,t),l={...t,indent:`${r} `};if(n.push(`${r}if (${a}) {`,Yr(o.then??[],l)),o.else)n.push(`${r}} else {`,Yr(o.else,l));n.push(`${r}}`);break}case"switch":{let o=i.node,a=ws(o.$switch,t),l={...t,indent:`${r} `};n.push(`${r}switch (String(${a})) {`);for(let[c,u]of Object.entries(o.cases??{}))n.push(`${r} case ${JSON.stringify(c)}: {`,Yr(u,l),`${r} break;`,`${r} }`);if(o.default)n.push(`${r} default: {`,Yr(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: ${ws(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 u=c.length>0?`, { ${c.join(", ")} }`:"";n.push(`${r}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(o.dispatchEvent)}${u}));`);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(`
117
+ `)}var pu=D(()=>{ve();xl()});function Wo(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 Sx(){return[...vx].toSorted()}function Zi(e,t){let r=e.toLowerCase();if(r.startsWith("aria-")||vx.has(r))return String(t);return t?"":null}var vs,vx,Qp=32,mu,hu="jx-slot",$l="data-jx-slots",em="jx.slot.group",VZ;var Ho=D(()=>{yl();xl();Fo();ve();Lr();pu();yl();vs=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"]),vx=new Set(["contenteditable","draggable","spellcheck"]);mu=/^[\t\n\f\r ]+$/u,VZ=(()=>{let e=Symbol.for(em),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function Ex(e,t,r,n,s=SI){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 Lo(p,m))i.push(b.text)},a={},l={},c=[],u=[];for(let[p,h]of Object.entries(e)){if(V(h)&&!Array.isArray(h)){if(p.startsWith("@"))c.push([p,h]);else if(!p.startsWith("--"))u.push([p,h]);continue}if(Hs(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 u)if(p.startsWith("&"))o({[p]:h},s.root);else o(h,p);for(let[p,h]of c){if(ml(p)||gl(p)){o({[p]:h},null);continue}let m={},b={},g=[];for(let[y,w]of Object.entries(h)){if(V(w)&&!Array.isArray(w)){if(!y.startsWith("@"))g.push([y,w]);continue}if(y.startsWith("--"))m[y]=w;else b[y]=w}o({[p]:m},s.root),o({[p]:b},s.body);for(let[y,w]of g)o({[p]:w},y)}if(Object.values(t).some((p)=>yn(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${gn}="light"]) { color-scheme: light }`,`${s.root}:where([${gn}="dark"]) { color-scheme: dark }`);return i.join(`
118
+ `)}var SI;var Px=D(()=>{yl();ve();SI={body:"body",root:":root"}});function jx(e){return e===!1||e==="open"||e==="closed"}function Qi(e,t){let r=e?.$shadow;if(jx(r))return r===!1?null:r;let n=t?.shadow;return jx(n)&&n!==!1?n:null}function kx(e,t){return t===null?e:":host"}function vl(e,t){let r=[];for(let[n,s]of(e.parameters??[]).entries()){let i=_x(s);if(!i)continue;let o=Ax(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 _x(e){return O(e)?e:e?.name??""}function Ax(e){return V(e)&&"default"in e}function bu(e,t){let r=im(e,t);return r===e?e:`${r} as ${e}`}function im(e,t){let r=t?.$export;return O(r)&&r!==""?r:e}function xu(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i}=r,{url:o}=t,a=ye(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 = \`${PI(o,n)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(o)};`);let u=[];if(l!=="GET")u.push(`method: ${JSON.stringify(l)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let h=V(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${h}`)}let p=u.length>0?`, { ${u.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(`
119
+ `)}function $u(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(!We(y))return`${xs(g)}: ${JSON.stringify(y)}`;if(EI.some((w)=>y.$ref.startsWith(w)))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`${xs(g)}: ${ws({$ref:y.$ref},{statePrefix:n})}`}),u=l.some(([,g])=>We(g)),p=`${Jx}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,h=Je(n,Dt(e)),m=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(u?[`// ${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(`
120
+ `)}function PI(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(r,n)=>`\${${n.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function wu(e){if(!V(e))return!1;if(e.state)for(let[t,r]of Object.entries(e.state)){if(t==="$site"||t==="$page")continue;if(!V(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(r.$prototype)return!0;if("default"in r)return!0;if(Cs(r))continue;return!0}if(e.$switch)return!0;if(dt(e)||Rd(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>wu(t)))return!0;for(let[t,r]of Object.entries(e)){if(vs.has(t))continue;if(We(r))return!0;if(ye(r))return!0}if(V(e.style)){for(let t of Object.values(e.style))if(ye(t))return!0}if(V(e.attributes)){for(let t of Object.values(e.attributes))if(ye(t))return!0}return!1}function Ox(e){if(!V(e))return!1;if(e.$switch)return!0;if(dt(e)||Rd(e.children))return!0;for(let[t,r]of Object.entries(e)){if(vs.has(t))continue;if(We(r))return!0;if(ye(r))return!0}if(V(e.style)){for(let t of Object.values(e.style))if(ye(t))return!0}if(V(e.attributes)){for(let t of Object.values(e.attributes))if(ye(t))return!0}return!1}function Ko(e,t=null,r={},n={}){let s=e?.state?Bo(e.state,t):t??Cx();return{media:n,scope:s,scopeDefs:r}}function Cx(e=null){return Object.create(e)}function Nx(e){return e[Rx]}function nm(e,t){if(O(e)){for(let i of e.matchAll(jI))t.add(i[1]);for(let i of e.matchAll(kI))t.add(i[1]);return}if(Array.isArray(e)){for(let i of e)nm(i,t);return}if(!V(e))return;let r=e,{operator:n,target:s}=r;if(O(n)&&$s(n)&&We(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let i of Object.values(r))nm(i,t)}function Bo(e={},t=null){let r=Cx(t),n=t?Nx(t):void 0,s=new Set(n);Object.defineProperty(r,Rx,{configurable:!0,enumerable:!1,value:s,writable:!0});let i=new Set;for(let c of Object.values(e))if(Ir(c)||Jr(c))nm(c.body??c.$expression,i);for(let c of i)if(c in e)s.add(c);for(let[c,u]of Object.entries(e)){if(!V(u)||Array.isArray(u)){Ss(r,c,gu(u));continue}if("default"in u){Ss(r,c,gu(u.default));continue}if(os(u)){s.add(c);continue}if(!u.$prototype&&!("$expression"in u)&&!Cs(u))Ss(r,c,gu(u))}let o=[],a=[];for(let[c,u]of Object.entries(e)){if(ye(u)){o.push([c,u]);continue}if(!V(u))continue;if(Jr(u)){let p=u.$expression;if(ji(u)){let h=u.parameters;Ss(r,c,(...m)=>{let b={};for(let[g,y]of h.entries()){let w=_x(y);if(!w)continue;b[w]=m[g]===void 0&&Ax(y)?y.default:m[g]}return qr(p,r,null,{args:b})})}else if($s(p.operator))Ss(r,c,(h,m)=>qr(p,h,m));else tm(r,c,()=>qr(p,r,null));continue}if(Ir(u)){if(Os(u)){let{body:p}=u;Ss(r,c,(h,m)=>{Vo(p,h??r,m??null)})}else if(O(u.body)){let p=u.parameters?as(u.parameters):u.arguments??[],{body:h}=u,m=p.includes("state")?p:["state",...p],b=Function(...m,h),g=(y,w)=>b(...m.map((P)=>P==="state"?y:w));if(ki(h))tm(r,c,()=>g(r)),a.push([c,h]);else Ss(r,c,g)}else Ss(r,c,()=>{}),s.add(c);continue}if(wn(u)&&(u.$prototype==="LocalStorage"||u.$prototype==="SessionStorage")){Ss(r,c,gu(u.default??null));continue}if(wn(u)&&u.$prototype==="Request")s.add(c)}let l=!0;while(l){l=!1;for(let[c,u]of[...a,...o])if(!s.has(c)&&Tx(u,r))s.add(c),l=!0}for(let[c,u]of o)tm(r,c,()=>Qt(u,r));return r}function Ss(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function tm(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:r})}function Ze(e,t){if(We(e))return om(e.$ref,t);if(ye(e))return Qt(e,t);return e}function Er(e){return We(e)}function om(e,t){if(!O(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?rm(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return rm(t,e.slice(8));return rm(t,e)??null}function Tx(e,t){if(!t)return!1;let r=Nx(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 vu(e){return Wo(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Qt(e,t){if(Tx(e,t))return null;let r=["state","$map","$site","$page"],n=[t,t?.$map,t?.$site,t?.$page];try{let s=Wo(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...r,s)(...n)}catch{return null}}function rm(e,t){return Wt(e,t)}function gu(e){if(!V(e))return e;return structuredClone(e)}function _I(e,t){if(!e||!t)return"";return Object.entries(e).filter(([r,n])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&ye(n)).map(([r,n])=>{let s=Ze(n,t);return s==null?null:`${Sr(r)}: ${s}`}).filter(Boolean).join("; ")}function eo(e,t,r=""){let n="",s=Ze(e.id,t),i=Ze(e.className,t),o=Ze(e.hidden,t),a=Ze(e.tabIndex,t),l=Ze(e.title,t),c=Ze(e.lang,t),u=Ze(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(u)n+=` dir="${_e(String(u))}"`;let p=[_I(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=Ze(m,t);if(Yt(b)){let g=Zi(h,b);if(g!==null)n+=g===""?` ${h}`:` ${h}="${_e(g)}"`;continue}if(O(b)||Nt(b))n+=` ${h}="${_e(String(b))}"`}if(e.$static)n+=" data-jx-static";else if(e.$prerendered)n+=" data-jx-prerendered";return n}function Sl(e,t=" "){return e?"":`
121
+ ${t}`}function Yo(){let e=JSON.stringify(fu),t=JSON.stringify(gn);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function yu(e,t,r,n){for(let s of Lo(t,{mediaQueries:n,resolveValue:(i,o)=>Ix(i,o,r),scope:r}))e.push(s.text)}function Ix(e,t,r){let n=O(t)?t:t.$ref;return AI.push({property:e,selector:r,source:n}),null}function Su(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Sx())});
122
+ function ${Xo}(n, v) {
79
123
  if (typeof v !== 'boolean') return v;
80
124
  const l = n.toLowerCase();
81
125
  if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
82
126
  return v ? '' : null;
83
- }`}function pl(){return[`async function ${Mg}(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 Jg(){let e=`new RegExp(${JSON.stringify(nl.source)}, ${JSON.stringify(nl.flags)})`,t=`Symbol.for(${JSON.stringify(sf)})`,r=JSON.stringify(Lo),n=JSON.stringify(sl);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${df}(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 ${pf}(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 Qn(e){for(let t of mf(e)){if(rt(t)){if(t.map&&Qn([t.map]))return!0;continue}if(!Zt(t))continue;if(t.tagName==="slot")return!0;let r=Object.values(t.cases??{}).filter((n)=>Zt(n)&&!rr(n));if(Qn(r)||Qn(t.children))return!0}return!1}function mf(e){if(rt(e))return[e];if(!Array.isArray(e))return[];return e}function Oi(e,t={},r=null){let n=[],s=Eg(q(r)?r:{},t,(o)=>o,Ig);if(s!=="")n.push(s);if(es(e,n,t,"",{n:0}),n.length===0)return"";return`<style>
86
- ${ml(n.join(`
127
+ }`}function Eu(){return[`async function ${Jx}(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(`
128
+ `)}function Mx(){let e=`new RegExp(${JSON.stringify(mu.source)}, ${JSON.stringify(mu.flags)})`,t=`Symbol.for(${JSON.stringify(em)})`,r=JSON.stringify($l),n=JSON.stringify(hu);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${am}(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 ${lm}(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(`
129
+ `)}function Bs(e){for(let t of cm(e)){if(dt(t)){if(t.map&&Bs([t.map]))return!0;continue}if(!yr(t))continue;if(t.tagName==="slot")return!0;let r=Object.values(t.cases??{}).filter((n)=>yr(n)&&!Er(n));if(Bs(r)||Bs(t.children))return!0}return!1}function cm(e){if(dt(e))return[e];if(!Array.isArray(e))return[];return e}function Qo(e,t={},r=null){let n=[],s=Ex(V(r)?r:{},t,(o)=>o,Ix);if(s!=="")n.push(s);if(Us(e,n,t,"",{n:0}),n.length===0)return"";return`<style>
130
+ ${Pu(n.join(`
87
131
  `))}
88
- </style>`}function ml(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function es(e,t,r,n="",s,i="jx"){let o=s??{n:0};if(!q(e))return;if(e.style&&!e.id&&!e.className)e.className=`${i}-${o.n}`,o.n+=1;let a=di(e.tagName).join(", ")||"*",l=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:a;if(e.style)ol(t,e.style,l,r);if(Array.isArray(e.children))for(let c of e.children)es(c,t,r,l,o,i);if(q(e.cases))for(let c of Object.values(e.cases))es(c,t,r,l,o,i)}function je(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function hl(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Dg(e){let t=[];return Lg(e,t),t}function Lg(e,t){if(!q(e))return;if(e.state){for(let[r,n]of Object.entries(e.state))if(En(n))t.push({exportName:n.$export,key:r,src:n.$src})}if(Array.isArray(e.children))for(let r of e.children)Lg(r,t)}function gf(e,t){if(T(e))return e;let r=di(e);if(r.length===0)return"div";if(!Br(e))return r[0];let n=e.$expression,s=n.target;if(n.operator==="?:")return Ve(s,t)?n.value:n.initial;let i=Ve(s,t);return n.cases[String(i)]??n.default}function yf(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function bf(e,t,r,n=null){let s=new Map;for(let i of mf(e)){let o="",a=!0,l;if(T(i)||Xt(i)||Tt(i)){if(l=r(i),nl.test(l))continue;a=l!==""}else if(rt(i))l="";else if(!Zt(i))l=r(i),a=l!=="";else{let u=Ve(i.attributes?.slot,t),p=T(i.slot)?Ve(i.slot,t):null;if(T(u)&&u!=="")o=u,l=r(i);else if(T(p)&&p!==""){o=p;let{slot:g,...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 Fg(e,t,r){for(let n of mf(e)){if(rt(n)||!Zt(n))continue;if(n.tagName==="slot"){let s=Ve(n.attributes?.name,t);r.taken.add(T(s)?s:"")}Fg(n.children,t,r)}}function xf(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 gl(e,t){if(!t)return Si(e.state??{},null);let r={...e.state};for(let[n,s]of Object.entries(t)){let i=r[n];r[n]=q(i)&&!Array.isArray(i)&&"default"in i?{...i,default:s}:s}return Si(r,null)}function $f(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([r,n])=>{if(!ye(n))return[];let s=Ve(n,t);return s==null?[]:[[r,s]]}))}function Fo(e,t,r,n){if(e.textContent!==void 0){let s=Ve(e.textContent,t);return s!=null?je(String(s)):""}if(e.innerHTML){let s=Ve(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>Ei(s,t,r,n)).join(`
90
- `);return""}function Ei(e,t,r=null,n=null){if(T(e)){if(ye(e)&&t){let a=Mt(e,t);return a!=null?je(String(a)):je(e)}return je(e)}if(Xt(e)||Tt(e))return je(String(e));if(Array.isArray(e))return e.map((a)=>Ei(a,t,r,n)).join(`
91
- `);if(!q(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",l=Ks(e,t),c=Ve(e.$switch,t),u=c==null?void 0:e.cases?.[String(c)],p=u!==void 0&&!rr(u)?Ei(u,t,r,n):"";return`<${a}${l}>${p}</${a}>`}let s=gf(e.tagName,t);if(s==="slot"&&r){let a=Ve(e.attributes?.name,t),l=T(a)?a:"",c;if(!r.taken.has(l))r.taken.add(l),c=r.groups.get(l);let u=c?.html??"";if(u!==""&&r.id!==null)u=`<!--${sl} ${r.id} ${encodeURIComponent(l)}-->${u}<!--/${sl} ${r.id}-->`;if(c?.content)return Fg(e.children,t,r),u;let p=Fo(e,t,r,n);return u===""?p:p===""?u:`${u}
92
- ${p}`}let i=n?.componentDefs.get(s);if(i&&n)return wO(e,i,t,r,n);let o=Ks(e,t);if(hf.has(s))return`<${s}${o}>`;return`<${s}${o}>${Fo(e,t,r,n)}</${s}>`}function wO(e,t,r,n,s){let i=t.tagName,{lifted:o,rest:a}=xf(e.attributes),l={...o,...e.$props},c={};for(let[_,I]of Object.entries(l))c[_]=Ve(I,r)??I;let u=Object.keys(c).length>0,p=s.path??[],g={key:JSON.stringify(c),tag:i},m=[...p.map((_)=>_.tag),i].join(" → ");if(p.some((_)=>_.tag===g.tag&&_.key===g.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>=nf)throw Error(`Component nesting exceeds ${nf} levels: ${m}. A component that renders itself with changing props needs a case that stops.`);let b={...s,path:[...p,g]},{children:h}=e,y=(_)=>Ei(_,r,n,s),v=Gs(t,s.defaults),k=yl(t),S=gl(t,u?c:null),E,j=null;if(v){let _=Array.isArray(h)?h.map((I)=>y(I)).join(`
93
- `):"";E=`<template shadowrootmode="${v}"><link rel="stylesheet" href="/components/${i}.css">${Fo(t,S,null,b)}</template>${_}`}else{j=!k&&Qn(t.children)?yf(s):null;let _=bf(h,r,y,j);E=Fo(t,S,_,b)}let R=Object.entries($f(t.style,S)).map(([_,I])=>`${tr(_)}: ${I}`).join("; "),A={...e};if(delete A.$props,delete A.children,A.attributes=!k&&u?{...a,"data-jx-props":JSON.stringify(c)}:a,j!==null)A.attributes={...A.attributes,[Lo]:String(j)};if(k)A.$static=!0;else A.$prerendered=!0;return`<${i}${Ks(A,r,R)}>${E}</${i}>`}function qg(e,t=null,r=null,n=null){return Fo(e,gl(e,t),r,n)}function yl(e){return cf(e)}function cf(e){if(!q(e))return!0;if(Array.isArray(e))return e.every((t)=>cf(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!q(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)=>cf(t));if(rt(e.children))return!1;return!0}function EO(e,t){return To(e).map((r)=>PO(r,t)).join(", ")}function PO(e,t){let r=Qa(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"&&SO.test(e))return e;return`${t}${e}`}function Hg(e,t,r=null,n={},s=null){let i=[],o=kg(e,s);if(q(t)){let a={},l=[];for(let[c,u]of Object.entries(t))if(Je(u))a[c]=u;else if(q(u)&&!Array.isArray(u))l.push([c,u]);else if(!c.startsWith("@")&&!Zn(c))a[c]=u;ol(i,a,o,n);for(let[c,u]of l)if(c.startsWith("@"))ol(i,{[c]:u},o,n);else if(Zn(c))ol(i,u,EO(c,o),n)}if(r&&Array.isArray(r.children)){let a={n:0};for(let l of r.children)es(l,i,n,"",a,e)}return i.length>0?`${i.join(`
132
+ </style>`}function Pu(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Us(e,t,r,n="",s,i="jx"){let o=s??{n:0};if(!V(e))return;if(e.style&&!e.id&&!e.className)e.className=`${i}-${o.n}`,o.n+=1;let a=bo(e.tagName).join(", ")||"*",l=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:a;if(e.style)yu(t,e.style,l,r);if(Array.isArray(e.children))for(let c of e.children)Us(c,t,r,l,o,i);if(V(e.cases))for(let c of Object.values(e.cases))Us(c,t,r,l,o,i)}function _e(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function ju(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Dx(e){let t=[];return Lx(e,t),t}function Lx(e,t){if(!V(e))return;if(e.state){for(let[r,n]of Object.entries(e.state))if(os(n))t.push({exportName:n.$export,key:r,src:n.$src})}if(Array.isArray(e.children))for(let r of e.children)Lx(r,t)}function fm(e,t){if(O(e))return e;let r=bo(e);if(r.length===0)return"div";if(!vn(e))return r[0];let n=e.$expression,s=n.target;if(n.operator==="?:")return Ze(s,t)?n.value:n.initial;let i=Ze(s,t);return n.cases[String(i)]??n.default}function dm(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function pm(e,t,r,n=null){let s=new Map;for(let i of cm(e)){let o="",a=!0,l;if(O(i)||Nt(i)||Yt(i)){if(l=r(i),mu.test(l))continue;a=l!==""}else if(dt(i))l="";else if(!yr(i))l=r(i),a=l!=="";else{let u=Ze(i.attributes?.slot,t),p=O(i.slot)?Ze(i.slot,t):null;if(O(u)&&u!=="")o=u,l=r(i);else if(O(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}
133
+ ${l}`,c.content||=a;else s.set(o,{content:a,html:l})}return{groups:s,id:n,taken:new Set}}function Fx(e,t,r){for(let n of cm(e)){if(dt(n)||!yr(n))continue;if(n.tagName==="slot"){let s=Ze(n.attributes?.name,t);r.taken.add(O(s)?s:"")}Fx(n.children,t,r)}}function mm(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 ku(e,t){if(!t)return Bo(e.state??{},null);let r={...e.state};for(let[n,s]of Object.entries(t)){let i=r[n];r[n]=V(i)&&!Array.isArray(i)&&"default"in i?{...i,default:s}:s}return Bo(r,null)}function hm(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([r,n])=>{if(!ye(n))return[];let s=Ze(n,t);return s==null?[]:[[r,s]]}))}function wl(e,t,r,n){if(e.textContent!==void 0){let s=Ze(e.textContent,t);return s!=null?_e(String(s)):""}if(e.innerHTML){let s=Ze(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>Uo(s,t,r,n)).join(`
134
+ `);return""}function Uo(e,t,r=null,n=null){if(O(e)){if(ye(e)&&t){let a=Qt(e,t);return a!=null?_e(String(a)):_e(e)}return _e(e)}if(Nt(e)||Yt(e))return _e(String(e));if(Array.isArray(e))return e.map((a)=>Uo(a,t,r,n)).join(`
135
+ `);if(!V(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",l=eo(e,t),c=Ze(e.$switch,t),u=c==null?void 0:e.cases?.[String(c)],p=u!==void 0&&!Er(u)?Uo(u,t,r,n):"";return`<${a}${l}>${p}</${a}>`}let s=fm(e.tagName,t);if(s==="slot"&&r){let a=Ze(e.attributes?.name,t),l=O(a)?a:"",c;if(!r.taken.has(l))r.taken.add(l),c=r.groups.get(l);let u=c?.html??"";if(u!==""&&r.id!==null)u=`<!--${hu} ${r.id} ${encodeURIComponent(l)}-->${u}<!--/${hu} ${r.id}-->`;if(c?.content)return Fx(e.children,t,r),u;let p=wl(e,t,r,n);return u===""?p:p===""?u:`${u}
136
+ ${p}`}let i=n?.componentDefs.get(s);if(i&&n)return RI(e,i,t,r,n);let o=eo(e,t);if(um.has(s))return`<${s}${o}>`;return`<${s}${o}>${wl(e,t,r,n)}</${s}>`}function RI(e,t,r,n,s){let i=t.tagName,{lifted:o,rest:a}=mm(e.attributes),l={...o,...e.$props},c={};for(let[_,I]of Object.entries(l))c[_]=Ze(I,r)??I;let u=Object.keys(c).length>0,p=s.path??[],h={key:JSON.stringify(c),tag:i},m=[...p.map((_)=>_.tag),i].join(" → ");if(p.some((_)=>_.tag===h.tag&&_.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>=Qp)throw Error(`Component nesting exceeds ${Qp} 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=(_)=>Uo(_,r,n,s),w=Qi(t,s.defaults),P=_u(t),S=ku(t,u?c:null),E,k=null;if(w){let _=Array.isArray(g)?g.map((I)=>y(I)).join(`
137
+ `):"";E=`<template shadowrootmode="${w}"><link rel="stylesheet" href="/components/${i}.css">${wl(t,S,null,b)}</template>${_}`}else{k=!P&&Bs(t.children)?dm(s):null;let _=pm(g,r,y,k);E=wl(t,S,_,b)}let A=Object.entries(hm(t.style,S)).map(([_,I])=>`${Sr(_)}: ${I}`).join("; "),R={...e};if(delete R.$props,delete R.children,R.attributes=!P&&u?{...a,"data-jx-props":JSON.stringify(c)}:a,k!==null)R.attributes={...R.attributes,[$l]:String(k)};if(P)R.$static=!0;else R.$prerendered=!0;return`<${i}${eo(R,r,A)}>${E}</${i}>`}function qx(e,t=null,r=null,n=null){return wl(e,ku(e,t),r,n)}function _u(e){return sm(e)}function sm(e){if(!V(e))return!0;if(Array.isArray(e))return e.every((t)=>sm(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!V(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)=>sm(t));if(dt(e.children))return!1;return!0}function CI(e,t){return hl(e).map((r)=>NI(r,t)).join(", ")}function NI(e,t){let r=uu(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"&&OI.test(e))return e;return`${t}${e}`}function Vx(e,t,r=null,n={},s=null){let i=[],o=kx(e,s);if(V(t)){let a={},l=[];for(let[c,u]of Object.entries(t))if(We(u))a[c]=u;else if(V(u)&&!Array.isArray(u))l.push([c,u]);else if(!c.startsWith("@")&&!Hs(c))a[c]=u;yu(i,a,o,n);for(let[c,u]of l)if(c.startsWith("@"))yu(i,{[c]:u},o,n);else if(Hs(c))yu(i,u,CI(c,o),n)}if(r&&Array.isArray(r.children)){let a={n:0};for(let l of r.children)Us(l,i,n,"",a,e)}return i.length>0?`${i.join(`
94
138
  `)}
95
- `:""}var gO,Ag,Pi="https://esm.sh/@vue/reactivity@3.5.40",ji="https://esm.sh/lit-html@3.3.0",bO,xO,ts,vO,Ri="__jxAttrText",Mg="__jxServerCall",df="__jxCaptureSlotted",pf="__jxDistributeSlots",Ai="<!---->",hf,SO;var Ur=H(()=>{wi();Mo();Do();rl();Pg();Pe();bi();wi();Do();rl();Pe();gO=["$map/","event#/","$args/","$reduce/"];Ag=Symbol("jx.runtimeOnlyStateKeys");bO=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,xO=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g;ts=new Set(["pre","textarea","listing","plaintext","xmp"]);vO=[];hf=new Set(["input","br","hr","img","meta","link","area","col","source"]);SO=/^(?:::slotted\(|::part\()/});import{relative as jO,sep as kO}from"node:path";function Vo(e){return e===_O}function Ci(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function bl(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 Vg(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(bl(n,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((bl(n,"content")??"").toLowerCase().split(",").map((i)=>i.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function Bg(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function RO(e,t){let r=t.trim().toLowerCase();for(let[n]of Bg(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(bl(n,"rel")??"").toLowerCase().split(/\s+/),i=(bl(n,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&i===r)return!0}return!1}function Wg(e,t){let{end:r}=Bg(e);if(r===-1||RO(e,t.type))return e;let n=`<link href="${je(t.href)}" rel="alternate" type="${je(t.type)}">`;return`${e.slice(0,r)}${n}
96
- ${e.slice(r)}`}function Ug(e,t){return new URL(`/${jO(e,t).split(kO).join("/")}`,"http://localhost").pathname}var _O="/404";var vf=H(()=>{Ur()});function zg(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=Sr(s);if(i===null||!t.locales.includes(i))r.push(n.urlPattern)}return r}function Gg(e,t){if(t===null)return null;let r=e.split("/").find(Boolean),n=Sr(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 AO(e,t){let r=e.split("/").filter(Boolean),n=Sr(r[0]);if(t!==null&&n!==null&&t.locales.includes(n))return r.slice(1).join("/");return r.join("/")}function wf(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?AO(o.urlPattern,t):o.translationKey.replaceAll(/^\/+|\/+$/g,"");if(o.translationKey!==void 0)i.add(o.urlPattern);let l=Jr(o.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((p)=>p.locale===l);if(u===void 0)c.push({locale:l,urlPattern:o.urlPattern});else n.push({declared:i.has(u.urlPattern)||o.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.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 Kg(e,t,r,n){let s=new Map;if(t===null||r==="")return s;let i=new Map;for(let[o,a]of wf(e,t).sets){if(a.length<2)continue;let l=i.get(a);if(l===void 0){l=a.map((u)=>({href:Yn(Ci(u.urlPattern,n),r),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:Yn(Ci(c.urlPattern,n),r),hreflang:"x-default"});i.set(a,l)}s.set(o,l)}return s}function Yg({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 Co(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var Sf=H(()=>{gr();Us();vf();Us();Us()});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)??Jr(r.urlPattern,s)??t.defaults?.lang,l=i.map((u)=>({code:u.locale,current:u.urlPattern===r.urlPattern,dir:Co(u.locale),label:ng(u.locale),url:u.urlPattern})),c={params:r._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:r.urlPattern};if(l.length>0)c.alternates=l;if(r.pagination){let{first:u,itemCount:p,last:g,next:m,number:b,pageCount:h,pageSize:y,pages:v,prev:k}=r.pagination;c.pagination={first:u,itemCount:p,last:g,next:m,number:b,pageCount:h,pageSize:y,pages:v.map(({current:S,number:E,url:j})=>({current:S,number:E,url:j})),prev:k}}if(a!==void 0)c.dir=Co(a),c.locale=a;if(e.state.$page=c,t.state){for(let[u,p]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=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[u,p]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=n&&(p.startsWith("./")||p.startsWith("../"))?n(p,r):p}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,p=[];for(let g of[...t.$elements,...e.$elements]){let m=T(g)?g:q(g)?g.$ref:void 0;if(m&&!u.has(m))u.add(m),p.push(g)}e.$elements=p}return e}var Zg=H(()=>{Pe();Us()});import{dirname as OO,relative as CO,resolve as NO}from"node:path";function Ef(e){return(t,r)=>{if(!r.sourcePath)return t;return`./${CO(OO(r.sourcePath),NO(e,t))}`}}function Qg(e,t,r,n=null,s=null,i=[]){return Xg(e,t,r,n===null?null:Ef(n),s,i)}var Pf=H(()=>{Zg()});import{readFileSync as TO}from"node:fs";import{dirname as jf,resolve as xl}from"node:path";import{createRequire as IO}from"node:module";function DO(e){return It(e.resolve)}async function $l(e,t,r,n={}){let s=e.imports??{},{state:i}=e;if(!i)return;for(let[o,a]of Object.entries(i)){if(!Vr(a))continue;if(MO.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(X(c)){let u=c.$bundle;if(Array.isArray(u)){for(let p of u)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}"):`,ke(c))}continue}if(!a.$src){let l=s[a.$prototype]??LO(n,a.$prototype);if(!l)continue;a.$src=l}try{let l=await FO(a,t,r,i,n);if(a.timing&&X(l))l.timing=a.timing;i[o]=l}catch(l){console.warn(`prototype-resolver: failed to resolve "${o}" ($prototype: "${a.$prototype}"):`,ke(l))}}}function LO(e,t){return e.registry?.byName(t)?.classPath}async function FO(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?xl(jf(t.sourcePath),i):xl(r,i);else o=IO(xl(r,"package.json")).resolve(i);let a=TO(o,"utf8"),l=Lm(a,o);if(!l.$implementation)throw Error(`${i} has no $implementation field`);let c=xl(jf(o),l.$implementation),u=await Eu(c),p=e.$export??l.title??e.$prototype,g=u[p]??u.default?.[p];if(!g)throw Error(`Module ${l.$implementation} does not export "${p}"`);let m={};for(let[h,y]of Object.entries(e))if(!JO.has(h))m[h]=y;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=jf(t.sourcePath);m._project={config:s.config??null,root:r,...s.sections},m._document={route:t,state:n};let b=new g(m);if(DO(b))return await b.resolve();return b}var MO,JO;var kf=H(()=>{jn();Pe();hr();MO=new Set(["Function","LocalStorage","SessionStorage","Array"]),JO=new Set(["$prototype","$src","$export","timing","default","description"])});import{readFileSync as _f,readdirSync as qO,statSync as HO}from"node:fs";import{extname as ty,join as VO,relative as BO,resolve as WO}from"node:path";async function Ys(e,t){let r=_f(e,"utf8");if(e.endsWith(".json"))return zn(r,e);let n=ty(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 ry(e,t){let r=new Map,n=new Map;for(let s of e){if(!n.has(s.sourcePath))n.set(s.sourcePath,await zO(s.sourcePath,t));let i=n.get(s.sourcePath);if(i!==null&&i!==void 0)r.set(s.urlPattern,UO(i,s._pathParams))}return r}function UO(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(r,n)=>t?.[n]??r)}async function zO(e,t){if(!_f(e,"utf8").includes("$translationKey"))return null;let r;try{r=await Ys(e,t)}catch{return null}return T(r.$translationKey)&&r.$translationKey!==""?r.$translationKey:null}async function ny(e,t){let r=[],n=new Set([".json",...t?.documentExtensions("page")??[]]);return await sy(e,e,r,n,t),r.sort(Xh),r}async function sy(e,t,r,n,s){let i=qO(e,{withFileTypes:!0});for(let o of i){let a=VO(e,o.name);if(o.isDirectory()){if(o.name.startsWith("_"))continue;await sy(a,t,r,n,s);continue}let l=ty(o.name).toLowerCase();if(!n.has(l))continue;if(o.name.startsWith("_"))continue;let c=BO(t,a);r.push(await GO(c,a,s))}}async function GO(e,t,r){let{isCatchAll:n,isDynamic:s,params:i,urlPattern:o}=Yh(e),a=null;try{let c=(await Ys(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 KO(e){let t=e[vl];if(!X(t))return null;let{mtime:r}=t;return T(r)&&r!==""?r:null}function iy(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 oy(e,t,r={},n,s,i,o={}){let a=[],l=(u,p)=>{let g=`Dynamic route ${u.urlPattern}: ${p}`;if(o.errors===void 0)throw Error(g);o.errors.push(g)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let p;try{p=await Ys(u.sourcePath,n?.formats)}catch{a.push(u);continue}if(!p.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let g;try{g=Qh(p.$paths)}catch(b){l(u,ke(b));continue}if(g!==null){let b=Jr(u.urlPattern,i??null),h=g.each===void 0?[{}]:await ey(g.each,t,r,n,s,b,u,c);for(let y of h){let v=await YO(u,p,g,y,{locale:b,projectConfig:s,projectRoot:t,registry:n,report:l,sections:r});a.push(...v)}continue}let m=await ey(p.$paths,t,r,n,s,Jr(u.urlPattern,i??null),u,c);for(let b of m){let h=u.urlPattern,y={};for(let[E,j]of Object.entries(b)){if(E===vl)continue;y[E]=String(j),h=h.replace(`:${E}`,y[E]),h=h.replace("*",y[E])}let v=iy(h);if(v!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${h}", which ${v}; skipping it`);continue}let k=KO(b),S={...u,_pathParams:y,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:h};if(k!==null)S.sourceMtime=k;a.push(S)}}return a}function ay(e,t){let r=e;for(let[n,s]of Object.entries(t)){let i=new RegExp(`:${n.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);r=i.test(r)?r.replace(i,()=>s):r.replace("*",()=>s)}return r}async function YO(e,t,r,n,s){let i={};for(let[b,h]of Object.entries(n))if(b!==vl)i[b]=String(h);let o=e.params.filter((b)=>!(b in i));if(o.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${o.length}`),[];let a=o[0];if(t.state?.[r.key]===void 0)return s.report(e,`$paths.paginate names state entry "${r.key}", which this page does not declare`),[];let l=ay(e.urlPattern,i),c=iy(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u=await ZO(t,r.key,e,i,s);if(!Array.isArray(u))return s.report(e,`state entry "${r.key}" did not resolve to an array at build time`),[];let p=XO(u,e.sourcePath),g=qu(u.length,r.pageSize),m=[];for(let b=1;b<=g;b++){let h={...e,_pathParams:{...i,[a]:String(b)},isCatchAll:!1,isDynamic:!1,pagedState:{items:eg(u,b,r.pageSize),key:r.key},pagination:tg(l,b,r.pageSize,u.length),params:[],urlPattern:Ws(l,b)};if(p!==null)h.sourceMtime=p;m.push(h)}return m}function XO(e,t){let r=null,n=HO(t).mtime.getTime();for(let s of e){let i=X(s)?s[vl]:void 0,o=X(i)?i.mtime:void 0;if(T(o)&&Date.parse(o)>n)n=Date.parse(o),r=o}return r}async function ZO(e,t,r,n,s){let i=e.state?.[t];if(i===void 0||Array.isArray(i))return i;let o={},a=Ef(s.projectRoot);for(let[u,p]of Object.entries(s.projectConfig?.imports??{}))o[u]=p.startsWith("./")||p.startsWith("../")?a(p,r):p;Object.assign(o,e.imports);let l={imports:o,state:{[t]:structuredClone(i)}},c={_pathParams:n,locale:s.locale,sourcePath:r.sourcePath,urlPattern:ay(r.urlPattern,n)};return await $l(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function ey(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=WO(t,l),u;try{u=JSON.parse(_f(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${ke(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let p=T(e.param)?e.param:"id",g=T(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[p]:(X(m)?m[g]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=n?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:r[c.project.key],locale:i,projectConfig:s,root:t};if(o!==void 0)u.params=o.params,u.urlPattern=o.urlPattern;if(a!==void 0)u.patterns=a;return await c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var vl="_meta";var ly=H(()=>{Pe();hr();Zh();rg();Sf();Pf();kf()});import{createHash as QO}from"node:crypto";function cy(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Xs(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[2]??r?.[3]}function Rf(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function aC(e){return`'sha256-${QO("sha256").update(e,"utf8").digest("base64")}'`}function uy(e,t){for(let r of e.matchAll(tC)){let n=r[1]??"",s=Xs(n,"src"),i=(Xs(n,"type")??"").trim().toLowerCase();if(s!==void 0){let o=Rf(s);if(o)t.scriptOrigins.add(o);continue}if(eC.has(i))t.scriptHashes.add(aC(r[2]??""))}for(let r of e.matchAll(rC)){let n=r[1]??"",s=(Xs(n,"rel")??"").toLowerCase(),i=Xs(n,"href"),o=Rf(i);if(!o)continue;if(s.includes("stylesheet"))t.styleOrigins.add(o);if(oC.test(i??"")||(Xs(n,"as")??"")==="font")t.fontOrigins.add(o)}for(let[r,n]of[[nC,t.imgOrigins],[sC,t.imgOrigins],[iC,t.frameOrigins]])for(let s of e.matchAll(r)){let i=s[1]??"";for(let o of[Xs(i,"src"),...lC(Xs(i,"srcset"))]){let a=Rf(o);if(a)n.add(a)}}}function lC(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function fy(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 dy(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 eC,tC,rC,nC,sC,iC,oC;var Af=H(()=>{eC=new Set(["","module","importmap","text/javascript","module-shim"]),tC=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,rC=/<link\b([^>]*)>/gi,nC=/<img\b([^>]*)>/gi,sC=/<source\b([^>]*)>/gi,iC=/<iframe\b([^>]*)>/gi,oC=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as wl,readFileSync as cC,writeFileSync as my}from"node:fs";import{join as Sl}from"node:path";function hy(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 u=o===!0?{}:o,p=u.maxAge??py,g=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!g)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}`,g?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=fy(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,dy(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=${py}, immutable`},pattern:uC});for(let[u,p]of Object.entries(r.rules??{}))c.push({headers:p,pattern:u});return{errors:n,rules:c}}function gy(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(wl(Sl(e,n)))r.push({headers:{"Content-Type":s},pattern:`/${n}`});if(wl(Sl(e,"feed","archive")))r.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return r}function yy(e,t){if(t==="")return[...e];return e.map((r)=>({headers:r.headers,pattern:He(t,r.pattern)}))}function pC(e){let t=e.map((r)=>{let n=Object.entries(r.headers).map(([s,i])=>` ${s}: ${i}`);return[r.pattern,...n].join(`
97
- `)});return`${[fC,"",...t].join(`
139
+ `:""}var EI,Rx,zo="https://esm.sh/@vue/reactivity@3.5.40",Go="https://esm.sh/lit-html@3.3.0",jI,kI,zs,AI,Xo="__jxAttrText",Jx="__jxServerCall",am="__jxCaptureSlotted",lm="__jxDistributeSlots",Zo="<!---->",um,OI;var An=D(()=>{Ho();yl();xl();pu();Px();ve();Fo();Ho();xl();pu();ve();EI=["$map/","event#/","$args/","$reduce/"];Rx=Symbol("jx.runtimeOnlyStateKeys");jI=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,kI=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g;zs=new Set(["pre","textarea","listing","plaintext","xmp"]);AI=[];um=new Set(["input","br","hr","img","meta","link","area","col","source"]);OI=/^(?:::slotted\(|::part\()/});import{relative as TI,sep as II}from"node:path";function El(e){return e===JI}function ea(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Au(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 Wx(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(Au(n,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Au(n,"content")??"").toLowerCase().split(",").map((i)=>i.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function Hx(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function MI(e,t){let r=t.trim().toLowerCase();for(let[n]of Hx(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Au(n,"rel")??"").toLowerCase().split(/\s+/),i=(Au(n,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&i===r)return!0}return!1}function Bx(e,t){let{end:r}=Hx(e);if(r===-1||MI(e,t.type))return e;let n=`<link href="${_e(t.href)}" rel="alternate" type="${_e(t.type)}">`;return`${e.slice(0,r)}${n}
140
+ ${e.slice(r)}`}function Ux(e,t){return new URL(`/${TI(e,t).split(II).join("/")}`,"http://localhost").pathname}var JI="/404";var gm=D(()=>{An()});function zx(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=Kr(s);if(i===null||!t.locales.includes(i))r.push(n.urlPattern)}return r}function Gx(e,t){if(t===null)return null;let r=e.split("/").find(Boolean),n=Kr(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 DI(e,t){let r=e.split("/").filter(Boolean),n=Kr(r[0]);if(t!==null&&n!==null&&t.locales.includes(n))return r.slice(1).join("/");return r.join("/")}function ym(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?DI(o.urlPattern,t):o.translationKey.replaceAll(/^\/+|\/+$/g,"");if(o.translationKey!==void 0)i.add(o.urlPattern);let l=hn(o.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((p)=>p.locale===l);if(u===void 0)c.push({locale:l,urlPattern:o.urlPattern});else n.push({declared:i.has(u.urlPattern)||o.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.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 Kx(e,t,r,n){let s=new Map;if(t===null||r==="")return s;let i=new Map;for(let[o,a]of ym(e,t).sets){if(a.length<2)continue;let l=i.get(a);if(l===void 0){l=a.map((u)=>({href:Vs(ea(u.urlPattern,n),r),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:Vs(ea(c.urlPattern,n),r),hreflang:"x-default"});i.set(a,l)}s.set(o,l)}return s}function Yx({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 pl(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var bm=D(()=>{Lr();Xi();gm();Xi();Xi()});function Xx(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=(O(e.$lang)?e.$lang:void 0)??hn(r.urlPattern,s)??t.defaults?.lang,l=i.map((u)=>({code:u.locale,current:u.urlPattern===r.urlPattern,dir:pl(u.locale),label:nx(u.locale),url:u.urlPattern})),c={params:r._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:r.urlPattern};if(l.length>0)c.alternates=l;if(r.pagination){let{first:u,itemCount:p,last:h,next:m,number:b,pageCount:g,pageSize:y,pages:w,prev:P}=r.pagination;c.pagination={first:u,itemCount:p,last:h,next:m,number:b,pageCount:g,pageSize:y,pages:w.map(({current:S,number:E,url:k})=>({current:S,number:E,url:k})),prev:P}}if(a!==void 0)c.dir=pl(a),c.locale=a;if(e.state.$page=c,t.state){for(let[u,p]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=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[u,p]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=n&&(p.startsWith("./")||p.startsWith("../"))?n(p,r):p}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,p=[];for(let h of[...t.$elements,...e.$elements]){let m=O(h)?h:V(h)?h.$ref:void 0;if(m&&!u.has(m))u.add(m),p.push(h)}e.$elements=p}return e}var Zx=D(()=>{ve();Xi()});import{dirname as LI,relative as FI,resolve as qI}from"node:path";function xm(e){return(t,r)=>{if(!r.sourcePath)return t;return`./${FI(LI(r.sourcePath),qI(e,t))}`}}function Qx(e,t,r,n=null,s=null,i=[]){return Xx(e,t,r,n===null?null:xm(n),s,i)}var $m=D(()=>{Zx()});import{readFileSync as VI}from"node:fs";import{dirname as wm,resolve as Ru}from"node:path";import{createRequire as WI}from"node:module";function UI(e){return Vt(e.resolve)}async function Ou(e,t,r,n={}){let s=e.imports??{},{state:i}=e;if(!i)return;for(let[o,a]of Object.entries(i)){if(!wn(a))continue;if(HI.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(B(c)){let u=c.$bundle;if(Array.isArray(u)){for(let p of u)if(O(p))n.registerBundle?.(p)}delete c.$bundle}i[o]=c}catch(c){console.warn(`prototype-resolver: failed to lower "${o}" ($prototype: "${a.$prototype}"):`,je(c))}continue}if(!a.$src){let l=s[a.$prototype]??zI(n,a.$prototype);if(!l)continue;a.$src=l}try{let l=await GI(a,t,r,i,n);if(a.timing&&B(l))l.timing=a.timing;i[o]=l}catch(l){console.warn(`prototype-resolver: failed to resolve "${o}" ($prototype: "${a.$prototype}"):`,je(l))}}}function zI(e,t){return e.registry?.byName(t)?.classPath}async function GI(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?Ru(wm(t.sourcePath),i):Ru(r,i);else o=WI(Ru(r,"package.json")).resolve(i);let a=VI(o,"utf8"),l=Ty(a,o);if(!l.$implementation)throw Error(`${i} has no $implementation field`);let c=Ru(wm(o),l.$implementation),u=await $p(c),p=e.$export??l.title??e.$prototype,h=u[p]??u.default?.[p];if(!h)throw Error(`Module ${l.$implementation} does not export "${p}"`);let m={};for(let[g,y]of Object.entries(e))if(!BI.has(g))m[g]=y;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=wm(t.sourcePath);m._project={config:s.config??null,root:r,...s.sections},m._document={route:t,state:n};let b=new h(m);if(UI(b))return await b.resolve();return b}var HI,BI;var vm=D(()=>{ms();ve();ir();HI=new Set(["Function","LocalStorage","SessionStorage","Array"]),BI=new Set(["$prototype","$src","$export","timing","default","description"])});import{readFileSync as Sm,readdirSync as KI,statSync as YI}from"node:fs";import{extname as t$,join as XI,relative as ZI,resolve as QI}from"node:path";async function to(e,t){let r=Sm(e,"utf8");if(fs(e))return ds(r,e);let n=t$(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 r$(e,t){let r=new Map,n=new Map;for(let s of e){if(!n.has(s.sourcePath))n.set(s.sourcePath,await tJ(s.sourcePath,t));let i=n.get(s.sourcePath);if(i!==null&&i!==void 0)r.set(s.urlPattern,eJ(i,s._pathParams))}return r}function eJ(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(r,n)=>t?.[n]??r)}async function tJ(e,t){if(!Sm(e,"utf8").includes("$translationKey"))return null;let r;try{r=await to(e,t)}catch{return null}return O(r.$translationKey)&&r.$translationKey!==""?r.$translationKey:null}async function n$(e,t){let r=[],n=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await s$(e,e,r,n,t),r.sort(X0),r}async function s$(e,t,r,n,s){let i=KI(e,{withFileTypes:!0});for(let o of i){let a=XI(e,o.name);if(o.isDirectory()){if(o.name.startsWith("_"))continue;await s$(a,t,r,n,s);continue}let l=t$(o.name).toLowerCase();if(!n.has(l))continue;if(o.name.startsWith("_"))continue;let c=ZI(t,a);r.push(await rJ(c,a,s))}}async function rJ(e,t,r){let{isCatchAll:n,isDynamic:s,params:i,urlPattern:o}=Y0(e),a=null;try{let c=(await to(t,r)).$layout;if(O(c))a=c}catch{}return{$layout:a,isCatchAll:n,isDynamic:s,params:i,relativePath:e,sourcePath:t,urlPattern:o}}function nJ(e){let t=e[Cu];if(!B(t))return null;let{mtime:r}=t;return O(r)&&r!==""?r:null}function i$(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 o$(e,t,r={},n,s,i,o={}){let a=[],l=(u,p)=>{let h=`Dynamic route ${u.urlPattern}: ${p}`;if(o.errors===void 0)throw Error(h);o.errors.push(h)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let p;try{p=await to(u.sourcePath,n?.formats)}catch{a.push(u);continue}if(!p.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let h;try{h=Q0(p.$paths)}catch(b){l(u,je(b));continue}if(h!==null){let b=hn(u.urlPattern,i??null),g=h.each===void 0?[{}]:await e$(h.each,t,r,n,s,b,u,c);for(let y of g){let w=await sJ(u,p,h,y,{locale:b,projectConfig:s,projectRoot:t,registry:n,report:l,sections:r});a.push(...w)}continue}let m=await e$(p.$paths,t,r,n,s,hn(u.urlPattern,i??null),u,c);for(let b of m){let g=u.urlPattern,y={};for(let[E,k]of Object.entries(b)){if(E===Cu)continue;y[E]=String(k),g=g.replace(`:${E}`,y[E]),g=g.replace("*",y[E])}let w=i$(g);if(w!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${g}", which ${w}; skipping it`);continue}let P=nJ(b),S={...u,_pathParams:y,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:g};if(P!==null)S.sourceMtime=P;a.push(S)}}return a}function a$(e,t){let r=e;for(let[n,s]of Object.entries(t)){let i=new RegExp(`:${n.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);r=i.test(r)?r.replace(i,()=>s):r.replace("*",()=>s)}return r}async function sJ(e,t,r,n,s){let i={};for(let[b,g]of Object.entries(n))if(b!==Cu)i[b]=String(g);let o=e.params.filter((b)=>!(b in i));if(o.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${o.length}`),[];let a=o[0];if(t.state?.[r.key]===void 0)return s.report(e,`$paths.paginate names state entry "${r.key}", which this page does not declare`),[];let l=a$(e.urlPattern,i),c=i$(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u=await oJ(t,r.key,e,i,s);if(!Array.isArray(u))return s.report(e,`state entry "${r.key}" did not resolve to an array at build time`),[];let p=iJ(u,e.sourcePath),h=Mp(u.length,r.pageSize),m=[];for(let b=1;b<=h;b++){let g={...e,_pathParams:{...i,[a]:String(b)},isCatchAll:!1,isDynamic:!1,pagedState:{items:ex(u,b,r.pageSize),key:r.key},pagination:tx(l,b,r.pageSize,u.length),params:[],urlPattern:Yi(l,b)};if(p!==null)g.sourceMtime=p;m.push(g)}return m}function iJ(e,t){let r=null,n=YI(t).mtime.getTime();for(let s of e){let i=B(s)?s[Cu]:void 0,o=B(i)?i.mtime:void 0;if(O(o)&&Date.parse(o)>n)n=Date.parse(o),r=o}return r}async function oJ(e,t,r,n,s){let i=e.state?.[t];if(i===void 0||Array.isArray(i))return i;let o={},a=xm(s.projectRoot);for(let[u,p]of Object.entries(s.projectConfig?.imports??{}))o[u]=p.startsWith("./")||p.startsWith("../")?a(p,r):p;Object.assign(o,e.imports);let l={imports:o,state:{[t]:structuredClone(i)}},c={_pathParams:n,locale:s.locale,sourcePath:r.sourcePath,urlPattern:a$(r.urlPattern,n)};return await Ou(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function e$(e,t,r,n,s,i,o,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=O(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&O(e.$ref)&&e.$ref){let l=e.$ref,c=QI(t,l),u;try{u=JSON.parse(Sm(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${je(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let p=O(e.param)?e.param:"id",h=O(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[p]:(B(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 u={data:r[c.project.key],locale:i,projectConfig:s,root:t};if(o!==void 0)u.params=o.params,u.urlPattern=o.urlPattern;if(a!==void 0)u.patterns=a;return await c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var Cu="_meta";var l$=D(()=>{ve();Fi();ir();Z0();rx();bm();$m();vm()});import{createHash as aJ}from"node:crypto";function c$(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function ro(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[2]??r?.[3]}function Em(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function hJ(e){return`'sha256-${aJ("sha256").update(e,"utf8").digest("base64")}'`}function u$(e,t){for(let r of e.matchAll(cJ)){let n=r[1]??"",s=ro(n,"src"),i=(ro(n,"type")??"").trim().toLowerCase();if(s!==void 0){let o=Em(s);if(o)t.scriptOrigins.add(o);continue}if(lJ.has(i))t.scriptHashes.add(hJ(r[2]??""))}for(let r of e.matchAll(uJ)){let n=r[1]??"",s=(ro(n,"rel")??"").toLowerCase(),i=ro(n,"href"),o=Em(i);if(!o)continue;if(s.includes("stylesheet"))t.styleOrigins.add(o);if(mJ.test(i??"")||(ro(n,"as")??"")==="font")t.fontOrigins.add(o)}for(let[r,n]of[[fJ,t.imgOrigins],[dJ,t.imgOrigins],[pJ,t.frameOrigins]])for(let s of e.matchAll(r)){let i=s[1]??"";for(let o of[ro(i,"src"),...gJ(ro(i,"srcset"))]){let a=Em(o);if(a)n.add(a)}}}function gJ(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function f$(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 d$(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 lJ,cJ,uJ,fJ,dJ,pJ,mJ;var Pm=D(()=>{lJ=new Set(["","module","importmap","text/javascript","module-shim"]),cJ=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,uJ=/<link\b([^>]*)>/gi,fJ=/<img\b([^>]*)>/gi,dJ=/<source\b([^>]*)>/gi,pJ=/<iframe\b([^>]*)>/gi,mJ=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Nu,readFileSync as yJ,writeFileSync as m$}from"node:fs";import{join as Tu}from"node:path";function h$(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 u=o===!0?{}:o,p=u.maxAge??p$,h=u.includeSubDomains??!0,m=u.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=f$(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,d$(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=${p$}, immutable`},pattern:bJ});for(let[u,p]of Object.entries(r.rules??{}))c.push({headers:p,pattern:u});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(Nu(Tu(e,n)))r.push({headers:{"Content-Type":s},pattern:`/${n}`});if(Nu(Tu(e,"feed","archive")))r.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return r}function y$(e,t){if(t==="")return[...e];return e.map((r)=>({headers:r.headers,pattern:Xe(t,r.pattern)}))}function wJ(e){let t=e.map((r)=>{let n=Object.entries(r.headers).map(([s,i])=>` ${s}: ${i}`);return[r.pattern,...n].join(`
141
+ `)});return`${[xJ,"",...t].join(`
98
142
  `)}
99
- `}function by(e,t){if(t.length===0)return 0;let r=Sl(e,"_headers"),n=wl(r)?cC(r,"utf8").trim():"",s=pC(t),i=n===""?s:`${s}
100
- ${dC}
143
+ `}function b$(e,t){if(t.length===0)return 0;let r=Tu(e,"_headers"),n=Nu(r)?yJ(r,"utf8").trim():"",s=wJ(t),i=n===""?s:`${s}
144
+ ${$J}
101
145
  ${n}
102
- `;return my(r,i,"utf8"),1}function xy(e){let t=Sl(e,".nojekyll");if(wl(t))return 0;return my(t,"","utf8"),1}var uC="/images/_optimized/*",py=31536000,fC="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",dC="# ─── public/_headers (hand-authored; these rules override the block above) ───";var $y=H(()=>{gr();Af()});async function vy(e,t,r,n={}){let s={},i=ju(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},...n.includeHeld===!0&&{includeHeld:!0}})}return s}var wy=H(()=>{jn()});import{cpSync as mC,existsSync as hC,mkdirSync as gC}from"node:fs";import{dirname as yC,resolve as bC}from"node:path";async function Sy(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||q(l)&&Object.keys(l).length===0))continue;try{let c=await o.call("assets",l??null,{projectConfig:t,root:r});for(let u of c??[]){if(!q(u)||!u.urlPrefix||!u.dir)continue;let p={dir:u.dir,urlPrefix:Ja(u.urlPrefix)};if(It(u.filter))p.filter=u.filter;let g=i.get(p.urlPrefix);if(g){if(g.dir!==p.dir)s.push(`Asset mount conflict: "${p.urlPrefix}" is claimed by both "${g.dir}" and "${p.dir}"`);continue}i.set(p.urlPrefix,p),n.push(p)}}catch(c){s.push(`Error in ${o.name}.assets: ${ke(c)}`)}}return{errors:s,mounts:n}}function Of(e,t,r){if(t.length===0||!e)return;for(let n of fh(e,t))r.add(n)}function Ey(e,t,r){let n=0,s=[];for(let i of e){let o=Da(t,i);if(!o||!hC(o)){s.push(i);continue}let a=bC(r,decodeURIComponent(i).replace(/^\//,""));gC(yC(a),{recursive:!0}),mC(o,a),n+=1}return{copied:n,missing:s}}var Py=H(()=>{gr();Pe();hr()});async function Cf(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 Cf(s,t,r);let i=e.children??[],o=T(i)?[i]:Array.isArray(i)?i:[],a=$C(s);if(xC(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 xC(e,t){let r=new Map,n=[];for(let s of t){let i=q(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)}jy(e,r,n)}function jy(e,t,r){if(!q(e))return;if(!Array.isArray(e.children))return;let n=[];for(let s of e.children)if(q(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 jy(s,t,r),n.push(s);e.children=n}function $C(e){return structuredClone(e)}var ky=H(()=>{Pe()});import{existsSync as vC,readFileSync as wC}from"node:fs";import{resolve as _y}from"node:path";function Ry(e){return(t)=>{let r=_y(e,t);if(!vC(r))throw Error(`Layout not found: ${t} (resolved to ${r})`);try{return zn(wC(r,"utf8"),r)}catch(n){throw Error(`Invalid layout JSON at ${r}: ${ke(n)}`,{cause:n})}}}function Ay(e,t,r){return Cf(e,t,Ry(r))}function Oy(e,t,r){let n=Ry(r),s=[],i=e.$layout??t.defaults?.layout;while(i){let o=_y(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 Cy=H(()=>{hr();ky()});import{dirname as SC,relative as EC,resolve as PC,sep as jC}from"node:path";function Ny(e,t){return EC(t,e).split(jC).join("/")}function kC(e,t,r){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${Ny(PC(t,e),r)}`}function Bo(e,t,r){let n=SC(t),s=Ny(t,r);return Dg(e).map((i)=>({exportName:i.exportName,src:kC(i.src,n,r),declaredIn:s}))}function Ty(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 Iy=H(()=>{Ur()});function My(e,t){if(!T(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function Jy(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=Nf(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=Yn(n.pageUrl,n.siteUrl);if(![...i.values()].some((c)=>q(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};i.set(Nf(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=Nf(l);if(!i.has(c))i.set(c,l)}return[...i.values()]}function Nf(e){if(!q(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=q(n)?JSON.stringify(n):n??"";return`style:${_C(s)}`}return`${t}:${JSON.stringify(e)}`}function _C(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 Dy(e){return e.map((t)=>RC(t)).join(`
103
- `)}function RC(e){if(T(e))return e;if(!q(e))return"";let t=e.tagName,r=e.attributes??{},n=Object.entries(r).map(([l,c])=>c===!0?l:`${l}="${AC(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=q(o)?JSON.stringify(o,null,2):o??"";return`${s}${a}</${t}>`}function AC(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var Ly=H(()=>{gr();Pe()});function NC(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 TC(e){if(!T(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let r=t.toLowerCase();return!OC.has(r)&&!CC.has(r)&&!NC(t)})}function Fy(e){let t=new Set;for(let r of e){if(!q(r)||r.tagName!=="link")continue;for(let n of TC(r.attributes?.rel))t.add(n)}return[...t]}var OC,CC;var qy=H(()=>{Pe();OC=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"]),CC=new Set(["shortcut"])});async function jl(e,t={}){let{resolveElementPath:r,$media:n,formats:s}=t,i=[],o=new Set;async function a(l,c){let u,p;if(T(l)){let{readFileSync:E}=await import("node:fs"),{resolve:j}=await import("node:path");if(p=c?j(c,l):j(l),o.has(p))return;if(o.add(p),p.endsWith(".json"))u=zn(E(p,"utf8"),p);else{let{extname:R}=await import("node:path"),A=R(p).toLowerCase(),_=s?.byExtension(A,"parse");if(!_){await Promise.resolve().then(() => jn());throw Ia(p,A)}u=await _.parseDocument(E(p,"utf8"))}}else{if(u=l,p=null,u.tagName&&o.has(u.tagName))return;if(u.tagName)o.add(u.tagName)}let{tagName:g}=u;if(!g||!g.includes("-"))throw Error(`compileElement: tagName "${g}" must contain a hyphen`);let{dirname:m}=await import("node:path"),b=p?m(p):null,h=[];if(Array.isArray(u.$elements))for(let E of u.$elements){let j=Je(E)?E.$ref:E;if(!T(j))continue;if(b)await a(j,b);let R=r?r(j,b):j.replace(/\.json$/,".js");h.push(R)}let y=hl(g);if(n)u.$media={...n,...u.$media};let{rewriteSrc:v}=t,k=Wo(u,y,h,v?(E)=>v(E,b):void 0,Gs(u,t.defaults),t.serverBaseUrl),S=p?p.replace(/\.json$/,".js"):`${g}.js`;i.push({content:k,path:S,tagName:g})}return await a(e,t.basePath??null),{files:i}}async function IC(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 jl(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>
146
+ `;return m$(r,i,"utf8"),1}function x$(e){let t=Tu(e,".nojekyll");if(Nu(t))return 0;return m$(t,"","utf8"),1}var bJ="/images/_optimized/*",p$=31536000,xJ="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",$J="# ─── public/_headers (hand-authored; these rules override the block above) ───";var $$=D(()=>{Lr();Pm()});async function w$(e,t,r,n={}){let s={},i=vp(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},...n.includeHeld===!0&&{includeHeld:!0}})}return s}var v$=D(()=>{ms()});import{cpSync as vJ,existsSync as SJ,mkdirSync as EJ}from"node:fs";import{dirname as PJ,resolve as jJ}from"node:path";async function S$(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||V(l)&&Object.keys(l).length===0))continue;try{let c=await o.call("assets",l??null,{projectConfig:t,root:r});for(let u of c??[]){if(!V(u)||!u.urlPrefix||!u.dir)continue;let p={dir:u.dir,urlPrefix:Gc(u.urlPrefix)};if(Vt(u.filter))p.filter=u.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: ${je(c)}`)}}return{errors:s,mounts:n}}function jm(e,t,r){if(t.length===0||!e)return;for(let n of f0(e,t))r.add(n)}function E$(e,t,r){let n=0,s=[];for(let i of e){let o=Kc(t,i);if(!o||!SJ(o)){s.push(i);continue}let a=jJ(r,decodeURIComponent(i).replace(/^\//,""));EJ(PJ(a),{recursive:!0}),vJ(o,a),n+=1}return{copied:n,missing:s}}var P$=D(()=>{Lr();ve();ir()});async function km(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 km(s,t,r);let i=e.children??[],o=O(i)?[i]:Array.isArray(i)?i:[],a=_J(s);if(kJ(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 kJ(e,t){let r=new Map,n=[];for(let s of t){let i=V(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)}j$(e,r,n)}function j$(e,t,r){if(!V(e))return;if(!Array.isArray(e.children))return;let n=[];for(let s of e.children)if(V(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 j$(s,t,r),n.push(s);e.children=n}function _J(e){return structuredClone(e)}var k$=D(()=>{ve()});import{existsSync as AJ,readFileSync as RJ}from"node:fs";import{resolve as _$}from"node:path";function A$(e){return(t)=>{let r=_$(e,t);if(!AJ(r))throw Error(`Layout not found: ${t} (resolved to ${r})`);try{return ds(RJ(r,"utf8"),r)}catch(n){throw Error(`Invalid layout at ${r}: ${je(n)}`,{cause:n})}}}function R$(e,t,r){return km(e,t,A$(r))}function O$(e,t,r){let n=A$(r),s=[],i=e.$layout??t.defaults?.layout;while(i){let o=_$(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 C$=D(()=>{Fi();ir();k$()});import{dirname as OJ,relative as CJ,resolve as NJ,sep as TJ}from"node:path";function N$(e,t){return CJ(t,e).split(TJ).join("/")}function IJ(e,t,r){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${N$(NJ(t,e),r)}`}function Pl(e,t,r){let n=OJ(t),s=N$(t,r);return Dx(e).map((i)=>({exportName:i.exportName,src:IJ(i.src,n,r),declaredIn:s}))}function T$(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 I$=D(()=>{An()});function J$(e,t){if(!O(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function M$(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=_m(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=Vs(n.pageUrl,n.siteUrl);if(![...i.values()].some((c)=>V(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};i.set(_m(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=_m(l);if(!i.has(c))i.set(c,l)}return[...i.values()]}function _m(e){if(!V(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=V(n)?JSON.stringify(n):n??"";return`style:${JJ(s)}`}return`${t}:${JSON.stringify(e)}`}function JJ(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 D$(e){return e.map((t)=>MJ(t)).join(`
147
+ `)}function MJ(e){if(O(e))return e;if(!V(e))return"";let t=e.tagName,r=e.attributes??{},n=Object.entries(r).map(([l,c])=>c===!0?l:`${l}="${DJ(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=V(o)?JSON.stringify(o,null,2):o??"";return`${s}${a}</${t}>`}function DJ(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var L$=D(()=>{Lr();ve()});function qJ(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 VJ(e){if(!O(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let r=t.toLowerCase();return!LJ.has(r)&&!FJ.has(r)&&!qJ(t)})}function F$(e){let t=new Set;for(let r of e){if(!V(r)||r.tagName!=="link")continue;for(let n of VJ(r.attributes?.rel))t.add(n)}return[...t]}var LJ,FJ;var q$=D(()=>{ve();LJ=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"]),FJ=new Set(["shortcut"])});async function Mu(e,t={}){let{resolveElementPath:r,$media:n,formats:s}=t,i=[],o=new Set;async function a(l,c){let u,p;if(O(l)){let{readFileSync:E}=await import("node:fs"),{resolve:k}=await import("node:path");if(p=c?k(c,l):k(l),o.has(p))return;if(o.add(p),fs(p))u=ds(E(p,"utf8"),p);else{let{extname:A}=await import("node:path"),R=A(p).toLowerCase(),_=s?.byExtension(R,"parse");if(!_){await Promise.resolve().then(() => ms());throw Uc(p,R)}u=await _.parseDocument(E(p,"utf8"))}}else{if(u=l,p=null,u.tagName&&o.has(u.tagName))return;if(u.tagName)o.add(u.tagName)}let{tagName:h}=u;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(u.$elements))for(let E of u.$elements){let k=We(E)?E.$ref:E;if(!O(k))continue;if(b)await a(k,b);let A=r?r(k,b):k.replace(/\.(?:json|jxn)$/i,".js");g.push(A)}let y=ju(h);if(n)u.$media={...n,...u.$media};let{rewriteSrc:w}=t,P=jl(u,y,g,w?(E)=>w(E,b):void 0,Qi(u,t.defaults),t.serverBaseUrl),S=p?p.replace(/\.(?:json|jxn)$/i,".js"):`${h}.js`;i.push({content:P,path:S,tagName:h})}return await a(e,t.basePath??null),{files:i}}async function WJ(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 Mu(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>
104
148
  <html lang="en">
105
149
  <head>
106
150
  <meta charset="utf-8">
107
151
  <meta name="viewport" content="width=device-width, initial-scale=1">
108
- <title>${je(r)}</title>
152
+ <title>${_e(r)}</title>
109
153
  <script type="importmap">
110
154
  {
111
155
  "imports": {
@@ -119,42 +163,42 @@ ${n}
119
163
  <${o.tagName}></${o.tagName}>
120
164
  <script type="module" src="./${l}"></script>
121
165
  </body>
122
- </html>`;return{files:i.files,html:c}}function MC(e){if(!q(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(Un(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(En(e))return"null";return JSON.stringify(e)}function JC(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(!q(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"&&Je(o.target))n(o.target.$ref);for(let[a,l]of Object.entries(o)){if(a.startsWith("on")&&a!=="observedAttributes"&&Je(l))n(l.$ref);s(l)}};return s(e.children),s(e.state),t}function Wo(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 A of r)o.push(`import '${A}';`);let a=new Map,l=new Map,c=e.state??{},u=JC(e);for(let[A,_]of Object.entries(c))if(pr(_)&&_.$src){let I=_.$src;if(_.$lazy===!0){if(!u.has(A)&&!Hy.has(A))throw Error(`"${A}" 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 ${A}() from a handler instead of binding its value.`);let M=l.get(I);if(!M)M=[],l.set(I,M);M.push({binding:A,exportName:uf(A,_)});continue}let D=a.get(I);if(!D)D=[],a.set(I,D);D.push(al(A,_))}for(let[A,_]of a){let I=n?n(A):A;o.push(`import { ${_.join(", ")} } from '${I}';`)}let p=Object.entries(c).flatMap(([A,_])=>Vr(_)&&_.$prototype==="Request"?[[A,_]]:[]),g=Object.entries(c).flatMap(([A,_])=>En(_)?[[A,_]]:[]);if(o.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",dl()),g.length>0)o.push(pl());let m=s===null&&Qn(e.children);if(m)o.push(Jg());let b=0;for(let[A,_]of l){let I=n?n(A):A,D=`_jxLazy${b}`;b+=1,o.push(`let ${D};`,`const ${D}Load = () => (${D} ??= import('${I}'));`,..._.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 h=[],y=[],v=[],k=[],S=[];for(let[A,_]of Object.entries(c))if(mr(_))if(Ns(_))k.push([A,_]);else if(Nn(_.$expression.operator))v.push([A,_]);else y.push([A,_]);else if(pr(_))if(_.$src&&!T(_.body))if(u.has(A)||Hy.has(A))v.push([A,_]);else y.push([A,_]);else if(T(_.body)&&Ts(_.body))y.push([A,_]);else v.push([A,_]);else if(T(_)&&_.includes("${"))S.push([A,_]);else{let I=MC(_);if(I!==void 0)h.push([A,I])}o.push(" this.state = reactive({");for(let[A,_]of h)o.push(` ${Cn(A)}: ${_},`);o.push(" });");for(let[A,_]of v)if(o.push(""),mr(_)){let I=Bt(_.$expression,{eventParam:"e",statePrefix:"s"});o.push(` ${Ce("this.state",St(A))} = (s, e) => { ${I}; };`)}else if(Wn(_)){let I=Er(_.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});o.push(` ${Ce("this.state",St(A))} = (s, e) => {`,I," };")}else{let I=_.parameters?Pn(_.parameters):_.arguments??["state"],D=I.join(", "),M=T(_.body)?_.body:"";if(I[0]==="state")if(_.$src)o.push(` ${Ce("this.state",St(A))} = (${D}) => ${A}(${D});`);else o.push(` ${Ce("this.state",St(A))} = (${D}) => {`,` ${M}`," };");else{let L=I.map((G)=>G==="state"?"state":"e").join(", ");if(_.$src)o.push(` ${Ce("this.state",St(A))} = (state, e) => ${A}(${L});`);else o.push(` ${Ce("this.state",St(A))} = (state, e) => {`,` const _fn = (${D}) => {`,` ${M}`," };",` return _fn(${L});`," };")}}for(let[A,_]of k){o.push("");let I=Bt(_.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Ce("this.state",St(A))} = ${qo(_,I)};`)}for(let[A,_]of S)o.push("",` ${Ce("this.state",St(A))} = computed(() => ${fl(_.replaceAll("state.","this.state."))});`);for(let[A,_]of y)if(o.push(""),mr(_)){let I=Bt(_.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Ce("this.state",St(A))} = computed(() => ${I});`)}else if(_.$src)o.push(` ${Ce("this.state",St(A))} = computed(() => ${A}(this.state));`);else{o.push(` ${Ce("this.state",St(A))} = computed(() => {`);let I=(T(_.body)?_.body:"").replaceAll("state.","this.state.");o.push(` ${I}`," });")}o.push(" }","");let E=[];if(Array.isArray(e.children)){let A={n:0};for(let _ of e.children)es(_,E,e.$media??{},"",A,e.tagName)}let j=Wy(),R=!Array.isArray(e.children)&&e.textContent!==void 0?` ${kl(e.textContent)}`:Pl(e.children,e.style," ",!1,!1,j);o.push(" template() {"," const s = this.state;",...j.decls," return html`",R," `;"," }","",...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[A,_]of p)o.push(ll(A,_,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[A,_]of g)o.push(cl(A,_,{collect:"this.#effects",indent:" ",serverBaseUrl:i,statePrefix:"this.state"}));if(q(e.style)){let A=[];for(let[_,I]of Object.entries(e.style)){if(_.startsWith(":")||_.startsWith(".")||_.startsWith("&")||_.startsWith("[")||_.startsWith("@"))continue;if(T(I)&&I.includes("${"))A.push([tr(_),I])}if(A.length>0){o.push(" this.#effects.push(effect(() => {");for(let[_,I]of A){let D=I.replaceAll(/\$\{([^}]+)\}/g,(M,L)=>`\${${L.replaceAll("state.","this.state.")}}`);o.push(` this.style['${_}'] = \`${D}\`;`)}o.push(" }));")}}if(m)o.push(` const _slotted = ${df}(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(` ${pf}(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 Wy(){return{byText:new Map,decls:[]}}function Uy(e,t){let r=e.byText.get(t);if(r)return r;let n=`_c${e.decls.length}`;e.decls.push(` const ${n} = html\`
166
+ </html>`;return{files:i.files,html:c}}function HJ(e){if(!V(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(Cs(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(os(e))return"null";return JSON.stringify(e)}function BJ(e){let t=new Set,r=new Set,n=(i)=>{if(i.startsWith("#/state/"))t.add(i.slice(8).split("/")[0])},s=(i)=>{if(O(i)){for(let a of i.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/g))t.add(a[1]);return}if(!V(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"&&We(o.target))n(o.target.$ref);for(let[a,l]of Object.entries(o)){if(a.startsWith("on")&&a!=="observedAttributes"&&We(l))n(l.$ref);s(l)}};return s(e.children),s(e.state),t}function jl(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??{},u=BJ(e);for(let[R,_]of Object.entries(c))if(Ir(_)&&_.$src){let I=_.$src;if(_.$lazy===!0){if(!u.has(R)&&!V$.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 J=l.get(I);if(!J)J=[],l.set(I,J);J.push({binding:R,exportName:im(R,_)});continue}let L=a.get(I);if(!L)L=[],a.set(I,L);L.push(bu(R,_))}for(let[R,_]of a){let I=n?n(R):R;o.push(`import { ${_.join(", ")} } from '${I}';`)}let p=Object.entries(c).flatMap(([R,_])=>wn(_)&&_.$prototype==="Request"?[[R,_]]:[]),h=Object.entries(c).flatMap(([R,_])=>os(_)?[[R,_]]:[]);if(o.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",Su()),h.length>0)o.push(Eu());let m=s===null&&Bs(e.children);if(m)o.push(Mx());let b=0;for(let[R,_]of l){let I=n?n(R):R,L=`_jxLazy${b}`;b+=1,o.push(`let ${L};`,`const ${L}Load = () => (${L} ??= import('${I}'));`,..._.map(({binding:J,exportName:F})=>`const ${J} = (...args) => ${L}Load().then((m) => m.${F}(...args));`))}o.push("",`class ${t} extends HTMLElement {`," #effects = [];",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let g=[],y=[],w=[],P=[],S=[];for(let[R,_]of Object.entries(c))if(Jr(_))if(ji(_))P.push([R,_]);else if($s(_.$expression.operator))w.push([R,_]);else y.push([R,_]);else if(Ir(_))if(_.$src&&!O(_.body))if(u.has(R)||V$.has(R))w.push([R,_]);else y.push([R,_]);else if(O(_.body)&&ki(_.body))y.push([R,_]);else w.push([R,_]);else if(O(_)&&_.includes("${"))S.push([R,_]);else{let I=HJ(_);if(I!==void 0)g.push([R,I])}o.push(" this.state = reactive({");for(let[R,_]of g)o.push(` ${xs(R)}: ${_},`);o.push(" });");for(let[R,_]of w)if(o.push(""),Jr(_)){let I=ur(_.$expression,{eventParam:"e",statePrefix:"s"});o.push(` ${Je("this.state",Dt(R))} = (s, e) => { ${I}; };`)}else if(Os(_)){let I=Yr(_.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});o.push(` ${Je("this.state",Dt(R))} = (s, e) => {`,I," };")}else{let I=_.parameters?as(_.parameters):_.arguments??["state"],L=I.join(", "),J=O(_.body)?_.body:"";if(I[0]==="state")if(_.$src)o.push(` ${Je("this.state",Dt(R))} = (${L}) => ${R}(${L});`);else o.push(` ${Je("this.state",Dt(R))} = (${L}) => {`,` ${J}`," };");else{let F=I.map((K)=>K==="state"?"state":"e").join(", ");if(_.$src)o.push(` ${Je("this.state",Dt(R))} = (state, e) => ${R}(${F});`);else o.push(` ${Je("this.state",Dt(R))} = (state, e) => {`,` const _fn = (${L}) => {`,` ${J}`," };",` return _fn(${F});`," };")}}for(let[R,_]of P){o.push("");let I=ur(_.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Je("this.state",Dt(R))} = ${vl(_,I)};`)}for(let[R,_]of S)o.push("",` ${Je("this.state",Dt(R))} = computed(() => ${vu(_.replaceAll("state.","this.state."))});`);for(let[R,_]of y)if(o.push(""),Jr(_)){let I=ur(_.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Je("this.state",Dt(R))} = computed(() => ${I});`)}else if(_.$src)o.push(` ${Je("this.state",Dt(R))} = computed(() => ${R}(this.state));`);else{o.push(` ${Je("this.state",Dt(R))} = computed(() => {`);let I=(O(_.body)?_.body:"").replaceAll("state.","this.state.");o.push(` ${I}`," });")}o.push(" }","");let E=[];if(Array.isArray(e.children)){let R={n:0};for(let _ of e.children)Us(_,E,e.$media??{},"",R,e.tagName)}let k=B$(),A=!Array.isArray(e.children)&&e.textContent!==void 0?` ${Du(e.textContent)}`:Ju(e.children,e.style," ",!1,!1,k);o.push(" template() {"," const s = this.state;",...k.decls," return html`",A," `;"," }","",...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,_]of p)o.push(xu(R,_,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[R,_]of h)o.push($u(R,_,{collect:"this.#effects",indent:" ",serverBaseUrl:i,statePrefix:"this.state"}));if(V(e.style)){let R=[];for(let[_,I]of Object.entries(e.style)){if(_.startsWith(":")||_.startsWith(".")||_.startsWith("&")||_.startsWith("[")||_.startsWith("@"))continue;if(O(I)&&I.includes("${"))R.push([Sr(_),I])}if(R.length>0){o.push(" this.#effects.push(effect(() => {");for(let[_,I]of R){let L=I.replaceAll(/\$\{([^}]+)\}/g,(J,F)=>`\${${F.replaceAll("state.","this.state.")}}`);o.push(` this.style['${_}'] = \`${L}\`;`)}o.push(" }));")}}if(m)o.push(` const _slotted = ${am}(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(` ${lm}(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(`
167
+ `)}function B$(){return{byText:new Map,decls:[]}}function U$(e,t){let r=e.byText.get(t);if(r)return r;let n=`_c${e.decls.length}`;e.decls.push(` const ${n} = html\`
124
168
  ${t}
125
- \`;`);let s=`\${${n}}`;return e.byText.set(t,s),s}function Pl(e,t,r,n=!1,s=!1,i=null,o=!1){if(!e)return"";let a=o?Ai:"";if(rt(e))return`${By(e,r)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(rt(l))return`${By(l,r)}${a}`;let c=If(l,n?"":r,n,s,i);return T(l)&&l.includes("${")||q(l)&&Br(l.tagName)?`${c}${a}`:c}).join(n?"":`
126
- `)}function If(e,t,r=!1,n=!1,s=null,i=null){if(T(e)){if(e.includes("${"))return`${t}${kl(e)}`;return`${t}${je(e)}`}if(Xt(e)||Tt(e))return`${t}${je(String(e))}`;if(!q(e))return"";if(Br(e.tagName)){let h=e.tagName.$expression,y=Tn(h.target,{eventParam:"e",statePrefix:"s"}),v=h.operator==="?:"?[[!0,h.value],[!1,h.initial]]:[...Object.entries(h.cases),["__default__",h.default]],k=v.map(([,_])=>_),S=k.map((_)=>r||ts.has(_)),E=null;if(s&&S.every((_)=>_===S[0])){let _=Vy(e,`${t} `,S[0]===!0,n,s,k.some((I)=>I.includes("-")));if(_.trim()!=="")E=Uy(s,_)}let j=v.map(([_,I])=>{let D={...e,tagName:I};return[_,If(D,`${t} `,r,n,s,E)]});if(h.operator==="?:"){let[,_]=j[0],[,I]=j[1];return`${t}\${${y}
169
+ \`;`);let s=`\${${n}}`;return e.byText.set(t,s),s}function Ju(e,t,r,n=!1,s=!1,i=null,o=!1){if(!e)return"";let a=o?Zo:"";if(dt(e))return`${H$(e,r)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(dt(l))return`${H$(l,r)}${a}`;let c=Rm(l,n?"":r,n,s,i);return O(l)&&l.includes("${")||V(l)&&vn(l.tagName)?`${c}${a}`:c}).join(n?"":`
170
+ `)}function Rm(e,t,r=!1,n=!1,s=null,i=null){if(O(e)){if(e.includes("${"))return`${t}${Du(e)}`;return`${t}${_e(e)}`}if(Nt(e)||Yt(e))return`${t}${_e(String(e))}`;if(!V(e))return"";if(vn(e.tagName)){let g=e.tagName.$expression,y=ws(g.target,{eventParam:"e",statePrefix:"s"}),w=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],P=w.map(([,_])=>_),S=P.map((_)=>r||zs.has(_)),E=null;if(s&&S.every((_)=>_===S[0])){let _=W$(e,`${t} `,S[0]===!0,n,s,P.some((I)=>I.includes("-")));if(_.trim()!=="")E=U$(s,_)}let k=w.map(([_,I])=>{let L={...e,tagName:I};return[_,Rm(L,`${t} `,r,n,s,E)]});if(g.operator==="?:"){let[,_]=k[0],[,I]=k[1];return`${t}\${${y}
127
171
  ? html\`
128
172
  ${_}
129
173
  \`
130
174
  : html\`
131
175
  ${I}
132
- \`}`}let R=j.flatMap(([_,I])=>_==="__default__"?[]:[` ${JSON.stringify(_)}: html\`
176
+ \`}`}let A=k.flatMap(([_,I])=>_==="__default__"?[]:[` ${JSON.stringify(_)}: html\`
133
177
  ${I}
134
- \``]),[,A]=j.at(-1);return`${t}\${{
135
- ${R.join(`,
178
+ \``]),[,R]=k.at(-1);return`${t}\${{
179
+ ${A.join(`,
136
180
  `)}
137
181
  }[String(${y})] ?? html\`
138
- ${A}
139
- \`}`}let o=e.tagName??"div",a=r||ts.has(o),l=[];if(e.attributes)for(let[h,y]of Object.entries(e.attributes))if(Je(y))l.push(`${h}="\${${Ri}('${h}', ${zr(y.$ref)}) ?? nothing}"`);else if(T(y)&&DC(y))l.push(`${h}="\${${Ri}('${h}', ${xr(y).slice(2,-1)}) ?? nothing}"`);else if(T(y)&&y.includes("${"))l.push(`${h}="${xr(y)}"`);else if(Tt(y)){let v=zs(h,y);if(v!==null)l.push(v===""?h:`${h}="${v}"`)}else l.push(`${h}="${y}"`);if(e.id)l.push(`id="${xr(String(e.id))}"`);if(e.className)l.push(`class="${xr(String(e.className))}"`);for(let[h,y]of Object.entries(e)){if(In.has(h)||h.startsWith("$")||h.startsWith("on")||h==="tagName"||h==="id"||h==="className"||h==="style"||h==="children"||h==="textContent"||h==="innerHTML"||h==="attributes")continue;if(El(y))l.push(`.${h}="\${${zr(y.$ref)}}"`);else if(T(y)&&y.includes("${"))l.push(`.${h}="${xr(y)}"`);else l.push(`.${h}="\${${JSON.stringify(y)}}"`)}if(e.$props)for(let[h,y]of Object.entries(e.$props))if(El(y))l.push(`.${h}="\${${zr(y.$ref)}}"`);else if(T(y)&&y.includes("${"))l.push(`.${h}="${xr(y)}"`);else l.push(`.${h}="\${${JSON.stringify(y)}}"`);let c=n?"s.$map = $map; ":"";for(let[h,y]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;let v=h.slice(2).toLowerCase();if(El(y))l.push(c?`@${v}="\${(e) => { ${c}${zr(y.$ref)}(s, e); }}"`:`@${v}="\${(e) => ${zr(y.$ref)}(s, e)}"`);else if(q(y)&&"$expression"in y){let k=Bt(y.$expression,{eventParam:"e",statePrefix:"s"});l.push(`@${v}="\${(e) => { ${c}${k}; }}"`)}else if(pr(y))l.push(`@${v}="\${(e) => { ${c}${LC(y)} }}"`)}let u=Gy(e.style);if(u)l.push(`style="${u}"`);let p=l.length>0?`
182
+ ${R}
183
+ \`}`}let o=e.tagName??"div",a=r||zs.has(o),l=[];if(e.attributes)for(let[g,y]of Object.entries(e.attributes))if(We(y))l.push(`${g}="\${${Xo}('${g}', ${Rn(y.$ref)}) ?? nothing}"`);else if(O(y)&&UJ(y))l.push(`${g}="\${${Xo}('${g}', ${Vr(y).slice(2,-1)}) ?? nothing}"`);else if(O(y)&&y.includes("${"))l.push(`${g}="${Vr(y)}"`);else if(Yt(y)){let w=Zi(g,y);if(w!==null)l.push(w===""?g:`${g}="${w}"`)}else l.push(`${g}="${y}"`);if(e.id)l.push(`id="${Vr(String(e.id))}"`);if(e.className)l.push(`class="${Vr(String(e.className))}"`);for(let[g,y]of Object.entries(e)){if(vs.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(Iu(y))l.push(`.${g}="\${${Rn(y.$ref)}}"`);else if(O(y)&&y.includes("${"))l.push(`.${g}="${Vr(y)}"`);else l.push(`.${g}="\${${JSON.stringify(y)}}"`)}if(e.$props)for(let[g,y]of Object.entries(e.$props))if(Iu(y))l.push(`.${g}="\${${Rn(y.$ref)}}"`);else if(O(y)&&y.includes("${"))l.push(`.${g}="${Vr(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 w=g.slice(2).toLowerCase();if(Iu(y))l.push(c?`@${w}="\${(e) => { ${c}${Rn(y.$ref)}(s, e); }}"`:`@${w}="\${(e) => ${Rn(y.$ref)}(s, e)}"`);else if(V(y)&&"$expression"in y){let P=ur(y.$expression,{eventParam:"e",statePrefix:"s"});l.push(`@${w}="\${(e) => { ${c}${P}; }}"`)}else if(Ir(y))l.push(`@${w}="\${(e) => { ${c}${zJ(y)} }}"`)}let u=G$(e.style);if(u)l.push(`style="${u}"`);let p=l.length>0?`
140
184
  ${t} ${l.join(`
141
185
  ${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(o))return`${t}<${o}${p}
142
- ${t}>`;let m=i??Vy(e,t,a,n,s,o.includes("-")),b=o==="slot"?Ai:"";return a?`${b}<${o}${p}>${m}${b}</${o}>`:`${t}${b}<${o}${p}
143
- ${t}>${m}${b}</${o}>`}function Vy(e,t,r,n,s,i=!1){if(e.$switch){let o=Je(e.$switch)?e.$switch.$ref:e.$switch,a=zr(o),l=[];for(let[g,m]of Object.entries(e.cases??{})){if(!m||Je(m))continue;l.push([g,If(m,`${t} `,!1,n,s)])}let c=l.map(([,g])=>g),u=new Set(c.filter((g,m)=>c.indexOf(g)!==m&&g.trim()!==""));return`\${{
144
- ${l.map(([g,m])=>{let b=s&&u.has(m)?Uy(s,m):m;return` ${JSON.stringify(g)}: html\`
186
+ ${t}>`;let m=i??W$(e,t,a,n,s,o.includes("-")),b=o==="slot"?Zo:"";return a?`${b}<${o}${p}>${m}${b}</${o}>`:`${t}${b}<${o}${p}
187
+ ${t}>${m}${b}</${o}>`}function W$(e,t,r,n,s,i=!1){if(e.$switch){let o=We(e.$switch)?e.$switch.$ref:e.$switch,a=Rn(o),l=[];for(let[h,m]of Object.entries(e.cases??{})){if(!m||We(m))continue;l.push([h,Rm(m,`${t} `,!1,n,s)])}let c=l.map(([,h])=>h),u=new Set(c.filter((h,m)=>c.indexOf(h)!==m&&h.trim()!==""));return`\${{
188
+ ${l.map(([h,m])=>{let b=s&&u.has(m)?U$(s,m):m;return` ${JSON.stringify(h)}: html\`
145
189
  ${b}
146
190
  \``}).join(`,
147
191
  `)}
148
- }[${a}]}`}if(e.textContent!==void 0){let o=kl(e.textContent),a=Je(e.textContent)||T(e.textContent)&&e.textContent.includes("${");return i&&a?`${o}${Ai}`:o}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return r?Pl(e.children,e.style,"",!0,n,s,i):`
149
- ${Pl(e.children,e.style,`${t} `,!1,n,s,i)}
150
- ${t}`;return""}function By(e,t){let r=Je(e.items)?zr(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(Je(b))i.push(`${m}="\${${Tf(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`${m}="${xr(b)}"`);else i.push(`${m}="${b}"`);if(n.id)i.push(`id="${xr(String(n.id))}"`);if(n.className)i.push(`class="${xr(String(n.className))}"`);for(let[m,b]of Object.entries(n)){if(In.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(El(b))i.push(`.${m}="\${${Tf(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`.${m}="${xr(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`)}if(n.$props)for(let[m,b]of Object.entries(n.$props))if(Je(b))i.push(`.${m}="\${${Tf(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`.${m}="${xr(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`);let o=Gy(n.style);if(o)i.push(`style="${o}"`);for(let[m,b]of Object.entries(n)){if(!m.startsWith("on"))continue;let h=m.slice(2).toLowerCase();if(Je(b))i.push(`@${h}="\${(e) => { s.$map = $map; ${zr(b.$ref)}(s, e); }}"`);else if(mr(b)){let y=Bt(b.$expression,{eventParam:"e",statePrefix:"s"});i.push(`@${h}="\${(e) => { s.$map = $map; ${y}; }}"`)}}let a=i.length>0?`
192
+ }[${a}]}`}if(e.textContent!==void 0){let o=Du(e.textContent),a=We(e.textContent)||O(e.textContent)&&e.textContent.includes("${");return i&&a?`${o}${Zo}`:o}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return r?Ju(e.children,e.style,"",!0,n,s,i):`
193
+ ${Ju(e.children,e.style,`${t} `,!1,n,s,i)}
194
+ ${t}`;return""}function H$(e,t){let r=We(e.items)?Rn(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(We(b))i.push(`${m}="\${${Am(b.$ref)}}"`);else if(O(b)&&b.includes("${"))i.push(`${m}="${Vr(b)}"`);else i.push(`${m}="${b}"`);if(n.id)i.push(`id="${Vr(String(n.id))}"`);if(n.className)i.push(`class="${Vr(String(n.className))}"`);for(let[m,b]of Object.entries(n)){if(vs.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(Iu(b))i.push(`.${m}="\${${Am(b.$ref)}}"`);else if(O(b)&&b.includes("${"))i.push(`.${m}="${Vr(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`)}if(n.$props)for(let[m,b]of Object.entries(n.$props))if(We(b))i.push(`.${m}="\${${Am(b.$ref)}}"`);else if(O(b)&&b.includes("${"))i.push(`.${m}="${Vr(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`);let o=G$(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(We(b))i.push(`@${g}="\${(e) => { s.$map = $map; ${Rn(b.$ref)}(s, e); }}"`);else if(Jr(b)){let y=ur(b.$expression,{eventParam:"e",statePrefix:"s"});i.push(`@${g}="\${(e) => { s.$map = $map; ${y}; }}"`)}}let a=i.length>0?`
151
195
  ${t} ${i.join(`
152
- ${t} `)}`:"",l=Wy(),c="";if(n.textContent!==void 0)c=kl(n.textContent);else if(n.children)c=`
153
- ${Pl(n.children,null,`${t} `,!1,!0,l)}
196
+ ${t} `)}`:"",l=B$(),c="";if(n.textContent!==void 0)c=Du(n.textContent);else if(n.children)c=`
197
+ ${Ju(n.children,null,`${t} `,!1,!0,l)}
154
198
  ${t} `;let u=`html\`
155
199
  ${t} <${s}${a}
156
200
  ${t} >${c}</${s}>
157
- ${t}\``,p=(u.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((m)=>`${m.trim()} `).join(""),g=p?`(item, index) => { ${p}return ${u}; }`:`(item, index) => ${u}`;return`${t}\${${r}.map(${g})}`}function El(e){return Je(e)&&e.$ref!==""}function zr(e){if(e.startsWith("#/state/"))return Ce("s",e.slice(8));if(e.startsWith("$map/"))return zy(e.slice(5));if(e.startsWith("parent#/"))return Ce("s",e.slice(8));if(e.startsWith("window#/"))return Ce("window",e.slice(8));if(e.startsWith("document#/"))return Ce("document",e.slice(10));return Ce("s",e)}function zy(e){let[t,...r]=On(e);return Ce(t??"",r.map((n)=>St(n)).join("/"))}function Tf(e){if(e.startsWith("$map/"))return zy(e.slice(5));return zr(e)}function xr(e){return e.replaceAll("state.","s.")}function DC(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function kl(e){if(Je(e))return`\${${zr(e.$ref)}}`;if(T(e)&&e.includes("${"))return xr(e);return String(e)}function LC(e){if(Wn(e))return Er(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=T(e.body)?e.body:"",r=e.parameters?Pn(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 Gy(e){if(!q(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=tr(r);t.push(`${s}: ${xr(n)}`)}}return t.join("; ")}var Hy;var Uo=H(()=>{wi();Ur();Pe();hr();bi();Hy=new Set(["onMount","onUnmount","onAdopted"])});function Ky(e,t){let{title:r="Jx App",reactivitySrc:n,litHtmlSrc:s}=t,i=ki(e,null,e.state??{},e.$media??{}),o=Oi(e,e.$media??{},t.projectStyle??null),a=[],l=Yy(e,!1,i,a),c=[],u="",p="";if(a.length>0){for(let b of a){let h=Wo(b.def,b.className,[],t.rewriteSrc);c.push({content:h,path:`_islands/${b.tagName}.js`,tagName:b.tagName})}u=`<script type="importmap">
201
+ ${t}\``,p=(u.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((m)=>`${m.trim()} `).join(""),h=p?`(item, index) => { ${p}return ${u}; }`:`(item, index) => ${u}`;return`${t}\${${r}.map(${h})}`}function Iu(e){return We(e)&&e.$ref!==""}function Rn(e){if(e.startsWith("#/state/"))return Je("s",e.slice(8));if(e.startsWith("$map/"))return z$(e.slice(5));if(e.startsWith("parent#/"))return Je("s",e.slice(8));if(e.startsWith("window#/"))return Je("window",e.slice(8));if(e.startsWith("document#/"))return Je("document",e.slice(10));return Je("s",e)}function z$(e){let[t,...r]=bs(e);return Je(t??"",r.map((n)=>Dt(n)).join("/"))}function Am(e){if(e.startsWith("$map/"))return z$(e.slice(5));return Rn(e)}function Vr(e){return e.replaceAll("state.","s.")}function UJ(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function Du(e){if(We(e))return`\${${Rn(e.$ref)}}`;if(O(e)&&e.includes("${"))return Vr(e);return String(e)}function zJ(e){if(Os(e))return Yr(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=O(e.body)?e.body:"",r=e.parameters?as(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 G$(e){if(!V(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(O(n)&&n.includes("${")){let s=Sr(r);t.push(`${s}: ${Vr(n)}`)}}return t.join("; ")}var V$;var kl=D(()=>{Ho();An();ve();Fi();Fo();V$=new Set(["onMount","onUnmount","onAdopted"])});function K$(e,t){let{title:r="Jx App",reactivitySrc:n,litHtmlSrc:s}=t,i=Ko(e,null,e.state??{},e.$media??{}),o=Qo(e,e.$media??{},t.projectStyle??null),a=[],l=Y$(e,!1,i,a),c=[],u="",p="";if(a.length>0){for(let b of a){let g=jl(b.def,b.className,[],t.rewriteSrc);c.push({content:g,path:`_islands/${b.tagName}.js`,tagName:b.tagName})}u=`<script type="importmap">
158
202
  {
159
203
  "imports": {
160
204
  "@vue/reactivity": "${n}",
@@ -162,33 +206,33 @@ ${t}\``,p=(u.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((
162
206
  }
163
207
  }
164
208
  </script>`,p=c.map((b)=>`<script type="module" src="./${b.path}"></script>`).join(`
165
- `)}let g=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((b)=>Lr(String(b))!==null)?`<script>${_i()}</script>
209
+ `)}let h=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((b)=>yn(String(b))!==null)?`<script>${Yo()}</script>
166
210
  `:"",m=`<!DOCTYPE html>
167
211
  <html lang="en">
168
212
  <head>
169
213
  <meta charset="utf-8">
170
214
  <meta name="viewport" content="width=device-width, initial-scale=1">
171
- <title>${je(r)}</title>
172
- ${g}${u}
215
+ <title>${_e(r)}</title>
216
+ ${h}${u}
173
217
  ${o}
174
218
  </head>
175
219
  <body>
176
220
  ${l}
177
221
  ${p}
178
222
  </body>
179
- </html>`;return{files:c,html:m}}function Yy(e,t,r,n){if(T(e))return je(e);if(Xt(e)||Tt(e))return je(String(e));if(!q(e))return"";let s=ki(e,r.scope,e.state??r.scopeDefs,e.$media??r.media);if(t){let c=n.length,u=`jx-island-${c}`,p=`JxIsland${c}`,g={...e,tagName:u};return n.push({className:p,def:g,tagName:u}),`<${u}></${u}>`}let i=gf(e.tagName,s.scope),o=Ks(e,s.scope);if(hf.has(i))return`<${i}${o}>`;let a=r.preformatted===!0||ts.has(i),l=FC(e,{...s,preformatted:a},n);return`<${i}${o}>${l}</${i}>`}function FC(e,t,r){if(e.textContent!==void 0){let n=Ve(e.textContent,t.scope);return n==null?"":je(String(n))}if(e.innerHTML){let n=Ve(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>Yy(n,Og(n),t,r)).join(Ho(t.preformatted));return""}var Xy=H(()=>{Ur();Uo();Pe()});function Lf(e,t){let{title:r="Jx App",reactivitySrc:n=Pi,litHtmlSrc:s=ji,modulePath:i="app.js",serverBaseUrl:o="/_jx/server"}=t,a=ki(e,null,e.state??{},e.$media??{}),l=Oi(e,e.$media??{},t.projectStyle??null),c={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},u=new Map,p=new Map,g=[],m=[],b=[],h=[],y=[],v=[],k=new Map,S=e.state??{};for(let[I,D]of Object.entries(S)){if(!q(D)||Array.isArray(D)){if(ye(D))m.push([I,`() => ${fl(D)}`]);else g.push([I,D]);continue}if(mr(D)){let M=D.$expression,L=Bt(M,{eventParam:"e",statePrefix:"state"});if(Ns(D))y.push(`state[${JSON.stringify(I)}] = ${qo(D,L)};`);else if(Nn(M.operator))h.push([I,{args:["state","e"],body:L}]);else m.push([I,`() => ${L}`]);continue}if(pr(D)){let M=D.parameters?Pn(D.parameters):D.arguments,{body:L}=D;if(Array.isArray(L)){let G=Er(L,{eventParam:"e",statePrefix:"state"});if(D.parameters&&D.parameters.length>0)y.push(`state[${JSON.stringify(I)}] = ${qo(D,`(() => {
180
- ${G}
181
- })()`)};`);else h.push([I,{args:["state","e"],body:G}])}else if(D.$src){let G=k.get(D.$src);if(!G)G=new Set,k.set(D.$src,G);G.add(al(I,D)),m.push([I,`() => { return ${I}(state); }`])}else if(T(L)&&Ts(L))m.push([I,`() => { ${L} }`]);else h.push([I,{args:M??["state"],body:L}]);continue}if(Un(D))continue;if(_m(D)){g.push([I,D.default]);continue}if(Vr(D)){if(D.$prototype==="LocalStorage"||D.$prototype==="SessionStorage"){let M=D.$prototype==="LocalStorage"?"localStorage":"sessionStorage",L=D.key??I,G=D.default??null;g.push([I,null]),y.push(HC(I,M,L,G));continue}if(D.$prototype==="Request"){g.push([I,null]),y.push(ll(I,D));continue}if(D.$prototype==="Cookie"){g.push([I,null]),y.push(VC(I,D.name??I,D.default??null));continue}}if(En(D)){g.push([I,null]),v.push(cl(I,D,{serverBaseUrl:o}));continue}g.push([I,D])}let E=Zy(e,a,u,p,c);for(let[I,D]of u)if(!b.some(([M])=>M===I))b.push([I,D]);for(let[I,D]of p)if(!h.some(([M])=>M===I))h.push([I,D]);let j=qC(g,m,b,h,y,v,k,c,n,t.rewriteSrc),R=[` "@vue/reactivity": "${n}"`,` "lit-html": "${s}"`],A=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((I)=>Lr(String(I))!==null)?`<script>${_i()}</script>
223
+ </html>`;return{files:c,html:m}}function Y$(e,t,r,n){if(O(e))return _e(e);if(Nt(e)||Yt(e))return _e(String(e));if(!V(e))return"";let s=Ko(e,r.scope,e.state??r.scopeDefs,e.$media??r.media);if(t){let c=n.length,u=`jx-island-${c}`,p=`JxIsland${c}`,h={...e,tagName:u};return n.push({className:p,def:h,tagName:u}),`<${u}></${u}>`}let i=fm(e.tagName,s.scope),o=eo(e,s.scope);if(um.has(i))return`<${i}${o}>`;let a=r.preformatted===!0||zs.has(i),l=GJ(e,{...s,preformatted:a},n);return`<${i}${o}>${l}</${i}>`}function GJ(e,t,r){if(e.textContent!==void 0){let n=Ze(e.textContent,t.scope);return n==null?"":_e(String(n))}if(e.innerHTML){let n=Ze(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>Y$(n,Ox(n),t,r)).join(Sl(t.preformatted));return""}var X$=D(()=>{An();kl();ve()});function Tm(e,t){let{title:r="Jx App",reactivitySrc:n=zo,litHtmlSrc:s=Go,modulePath:i="app.js",serverBaseUrl:o="/_jx/server"}=t,a=Ko(e,null,e.state??{},e.$media??{}),l=Qo(e,e.$media??{},t.projectStyle??null),c={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},u=new Map,p=new Map,h=[],m=[],b=[],g=[],y=[],w=[],P=new Map,S=e.state??{};for(let[I,L]of Object.entries(S)){if(!V(L)||Array.isArray(L)){if(ye(L))m.push([I,`() => ${vu(L)}`]);else h.push([I,L]);continue}if(Jr(L)){let J=L.$expression,F=ur(J,{eventParam:"e",statePrefix:"state"});if(ji(L))y.push(`state[${JSON.stringify(I)}] = ${vl(L,F)};`);else if($s(J.operator))g.push([I,{args:["state","e"],body:F}]);else m.push([I,`() => ${F}`]);continue}if(Ir(L)){let J=L.parameters?as(L.parameters):L.arguments,{body:F}=L;if(Array.isArray(F)){let K=Yr(F,{eventParam:"e",statePrefix:"state"});if(L.parameters&&L.parameters.length>0)y.push(`state[${JSON.stringify(I)}] = ${vl(L,`(() => {
224
+ ${K}
225
+ })()`)};`);else g.push([I,{args:["state","e"],body:K}])}else if(L.$src){let K=P.get(L.$src);if(!K)K=new Set,P.set(L.$src,K);K.add(bu(I,L)),m.push([I,`() => { return ${I}(state); }`])}else if(O(F)&&ki(F))m.push([I,`() => { ${F} }`]);else g.push([I,{args:J??["state"],body:F}]);continue}if(Cs(L))continue;if(Ey(L)){h.push([I,L.default]);continue}if(wn(L)){if(L.$prototype==="LocalStorage"||L.$prototype==="SessionStorage"){let J=L.$prototype==="LocalStorage"?"localStorage":"sessionStorage",F=L.key??I,K=L.default??null;h.push([I,null]),y.push(YJ(I,J,F,K));continue}if(L.$prototype==="Request"){h.push([I,null]),y.push(xu(I,L));continue}if(L.$prototype==="Cookie"){h.push([I,null]),y.push(XJ(I,L.name??I,L.default??null));continue}}if(os(L)){h.push([I,null]),w.push($u(I,L,{serverBaseUrl:o}));continue}h.push([I,L])}let E=Z$(e,a,u,p,c);for(let[I,L]of u)if(!b.some(([J])=>J===I))b.push([I,L]);for(let[I,L]of p)if(!g.some(([J])=>J===I))g.push([I,L]);let k=KJ(h,m,b,g,y,w,P,c,n,t.rewriteSrc),A=[` "@vue/reactivity": "${n}"`,` "lit-html": "${s}"`],R=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((I)=>yn(String(I))!==null)?`<script>${Yo()}</script>
182
226
  `:"",_=`<!DOCTYPE html>
183
227
  <html lang="en">
184
228
  <head>
185
229
  <meta charset="utf-8">
186
230
  <meta name="viewport" content="width=device-width, initial-scale=1">
187
- <title>${je(r)}</title>
188
- ${A}<script type="importmap">
231
+ <title>${_e(r)}</title>
232
+ ${R}<script type="importmap">
189
233
  {
190
234
  "imports": {
191
- ${R.join(`,
235
+ ${A.join(`,
192
236
  `)}
193
237
  }
194
238
  }
@@ -199,17 +243,17 @@ ${R.join(`,
199
243
  <body>
200
244
  ${E}
201
245
  </body>
202
- </html>`;return{files:[{content:j,path:i}],html:_}}function Zy(e,t,r,n,s){if(T(e))return je(e);if(Xt(e)||Tt(e))return je(String(e));if(!q(e))return"";let i=ki(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(Br(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${di(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||ts.has(o);let a=[],l=!1;if(e.textContent!==void 0){let h=e.textContent;if(rr(h)){let y=Ni(h.$ref);a.push(`:text-content="${y}"`),Mf(r,y,h.$ref),l=!0}else if(ye(h)){let y=`_t${s.t}`;s.t+=1,a.push(`:text-content="${y}"`),r.set(y,`() => \`${h}\``),l=!0}}for(let[h,y]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;let v=h.slice(2).toLowerCase();if(rr(y)){let k=Ni(y.$ref);a.push(`@${v}="${k}"`),l=!0}else if(pr(y)){let k=`_h${s.h}`;s.h+=1,a.push(`@${v}="${k}"`);let{body:S}=y;n.set(k,Array.isArray(S)?{args:["state","e"],body:Er(S,{eventParam:"e",statePrefix:"state"})}:{args:y.parameters?Pn(y.parameters):y.arguments??["state","event"],body:S}),l=!0}else if(mr(y)){let k=`_h${s.h}`;s.h+=1,a.push(`@${v}="${k}"`);let S=Bt(y.$expression,{eventParam:"e",statePrefix:"state"});n.set(k,{args:["state","e"],body:S}),l=!0}}if(q(e.style))for(let[h,y]of Object.entries(e.style)){if(h.startsWith(":")||h.startsWith(".")||h.startsWith("&")||h.startsWith("[")||h.startsWith("@"))continue;if(eb(y))continue;if(ye(y)){let v=`_s${s.s}`;s.s+=1,a.push(`:style.${tr(h)}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}if(q(e.attributes)){for(let[h,y]of Object.entries(e.attributes))if(rr(y)){let v=Ni(y.$ref);a.push(`:attr.${h}="${v}"`),Mf(r,v,y.$ref),l=!0}else if(ye(y)){let v=`_t${s.t}`;s.t+=1,a.push(`:attr.${h}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}for(let[h,y]of Object.entries(e)){if(In.has(h)||h.startsWith("on")||h.startsWith("$")||h==="tagName"||h==="id"||h==="className"||h==="style"||h==="children"||h==="textContent"||h==="innerHTML"||h==="attributes")continue;if(rr(y)){let v=Ni(y.$ref);a.push(`:${tr(h)}="${v}"`),Mf(r,v,y.$ref),l=!0}else if(ye(y)){let v=`_t${s.t}`;s.t+=1,a.push(`:${tr(h)}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}let c=Ks(e,i.scope),u=l?" data-bind":"",p=a.length>0?` ${a.join(" ")}`:"",g="",m=e;if(m.$switch){s.needsLit=!0;let h=`_sw${s.sw}`;s.sw+=1;let y=rr(m.$switch)?Df(m.$switch.$ref):`\`${String(m.$switch)}\``,v=m.cases??{},k=Object.entries(v).filter(([,E])=>E&&!rr(E)).map(([E,j])=>`${JSON.stringify(E)}: html\`${Jf(j,i.preformatted)}\``);r.set(h,`() => ({${k.join(", ")}})[String(${y})] ?? html\`\``),a.push(`:render="${h}"`);let S=` ${a.join(" ")}`;return`<${o}${c} data-bind${S}></${o}>`}if(m.textContent!==void 0&&!l){let h=Ve(m.textContent,i.scope);g=h==null?"":je(String(h))}else if(m.textContent!==void 0&&l){let h=Ve(m.textContent,i.scope);g=h==null?"":je(String(h))}else if(m.innerHTML){let h=Ve(m.innerHTML,i.scope);g=h==null?m.innerHTML:String(h)}else if(rt(m.children)){s.needsLit=!0;let h=`_list${s.l}`;s.l+=1;let y=m.children,v=rr(y.items)?Df(y.items.$ref):JSON.stringify(y.items),k=Ff(y.map);r.set(h,`() => (${v} ?? []).map((item, index) => html\`${k}\`)`),a.push(`:render="${h}"`),l=!0;let S=" data-bind",E=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${S}${E}>`;return`<${o}${c}${S}${E}></${o}>`}else if(Array.isArray(m.children)&&m.children.some((h)=>rt(h))){s.needsLit=!0;let h=`_children${s.l}`;s.l+=1;let y=m.children.map((k)=>Jf(k,i.preformatted)).join(Ho(i.preformatted," "));r.set(h,i.preformatted?`() => html\`${y}\``:`() => html\`
246
+ </html>`;return{files:[{content:k,path:i}],html:_}}function Z$(e,t,r,n,s){if(O(e))return _e(e);if(Nt(e)||Yt(e))return _e(String(e));if(!V(e))return"";let i=Ko(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(vn(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${bo(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||zs.has(o);let a=[],l=!1;if(e.textContent!==void 0){let g=e.textContent;if(Er(g)){let y=ta(g.$ref);a.push(`:text-content="${y}"`),Om(r,y,g.$ref),l=!0}else if(ye(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 w=g.slice(2).toLowerCase();if(Er(y)){let P=ta(y.$ref);a.push(`@${w}="${P}"`),l=!0}else if(Ir(y)){let P=`_h${s.h}`;s.h+=1,a.push(`@${w}="${P}"`);let{body:S}=y;n.set(P,Array.isArray(S)?{args:["state","e"],body:Yr(S,{eventParam:"e",statePrefix:"state"})}:{args:y.parameters?as(y.parameters):y.arguments??["state","event"],body:S}),l=!0}else if(Jr(y)){let P=`_h${s.h}`;s.h+=1,a.push(`@${w}="${P}"`);let S=ur(y.$expression,{eventParam:"e",statePrefix:"state"});n.set(P,{args:["state","e"],body:S}),l=!0}}if(V(e.style))for(let[g,y]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(ew(y))continue;if(ye(y)){let w=`_s${s.s}`;s.s+=1,a.push(`:style.${Sr(g)}="${w}"`),r.set(w,`() => \`${y}\``),l=!0}}if(V(e.attributes)){for(let[g,y]of Object.entries(e.attributes))if(Er(y)){let w=ta(y.$ref);a.push(`:attr.${g}="${w}"`),Om(r,w,y.$ref),l=!0}else if(ye(y)){let w=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${w}"`),r.set(w,`() => \`${y}\``),l=!0}}for(let[g,y]of Object.entries(e)){if(vs.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(Er(y)){let w=ta(y.$ref);a.push(`:${Sr(g)}="${w}"`),Om(r,w,y.$ref),l=!0}else if(ye(y)){let w=`_t${s.t}`;s.t+=1,a.push(`:${Sr(g)}="${w}"`),r.set(w,`() => \`${y}\``),l=!0}}let c=eo(e,i.scope),u=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=Er(m.$switch)?Nm(m.$switch.$ref):`\`${String(m.$switch)}\``,w=m.cases??{},P=Object.entries(w).filter(([,E])=>E&&!Er(E)).map(([E,k])=>`${JSON.stringify(E)}: html\`${Cm(k,i.preformatted)}\``);r.set(g,`() => ({${P.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=Ze(m.textContent,i.scope);h=g==null?"":_e(String(g))}else if(m.textContent!==void 0&&l){let g=Ze(m.textContent,i.scope);h=g==null?"":_e(String(g))}else if(m.innerHTML){let g=Ze(m.innerHTML,i.scope);h=g==null?m.innerHTML:String(g)}else if(dt(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let y=m.children,w=Er(y.items)?Nm(y.items.$ref):JSON.stringify(y.items),P=Im(y.map);r.set(g,`() => (${w} ?? []).map((item, index) => html\`${P}\`)`),a.push(`:render="${g}"`),l=!0;let S=" data-bind",E=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${S}${E}>`;return`<${o}${c}${S}${E}></${o}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>dt(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let y=m.children.map((P)=>Cm(P,i.preformatted)).join(Sl(i.preformatted," "));r.set(g,i.preformatted?`() => html\`${y}\``:`() => html\`
203
247
  ${y}
204
- \``),a.push(`:render="${h}"`),l=!0;let v=` ${a.join(" ")}`;return`<${o}${c} data-bind${v}></${o}>`}else if(Array.isArray(m.children))g=m.children.map((h)=>Zy(h,i,r,n,s)).join(Ho(i.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${u}${p}>`;return`<${o}${c}${u}${p}>${g}</${o}>`}function Ff(e,t=!1){if(!e)return"";if(Br(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${di(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let r=e.tagName??"div",n=t||ts.has(r),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${rs(e.className)}"`;if(q(e.$props))for(let[l,c]of Object.entries(e.$props))if(rr(c))s+=` .${l}="\${${BC(c.$ref)}}"`;else if(ye(c))s+=` .${l}="${rs(c)}"`;else s+=` .${l}="\${${JSON.stringify(c)}}"`;if(q(e.attributes))for(let[l,c]of Object.entries(e.attributes)){if(ye(c)){s+=` ${l}="${rs(c)}"`;continue}if(Tt(c)){let u=zs(l,c);if(u!==null)s+=u===""?` ${l}`:` ${l}="${je(u)}"`;continue}s+=` ${l}="${je(String(c))}"`}if(q(e.style)){let l=[];for(let[c,u]of Object.entries(e.style)){if(c.startsWith(":")||c.startsWith(".")||c.startsWith("&")||c.startsWith("[")||c.startsWith("@"))continue;if(eb(u))continue;let p=tr(c);if(ye(String(u)))l.push(`${p}: ${rs(String(u))}`);else l.push(`${p}: ${u}`)}if(l.length>0)s+=` style="${l.join("; ")}"`}for(let[l,c]of Object.entries(e)){if(!l.startsWith("on")||l==="observedAttributes")continue;let u=l.slice(2).toLowerCase();if(rr(c)){let p=Ni(c.$ref);s+=` @${u}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(Wn(c)){let p=Er(c.body,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(pr(c)){let p=rs(c.body);s+=` @${u}=\${(e) => { ${p} }}`}else if(q(c)&&"$expression"in c){let p=Bt(c.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=r.includes("-")?Ai:"",o="";if(e.textContent!==void 0){let l=String(e.textContent);if(ye(l))o=`${rs(l)}${i}`;else if(rr(e.textContent))o=`\${state.${Ni(e.textContent.$ref)}}${i}`;else o=je(l)}else if(e.innerHTML)o=rs(String(e.innerHTML));else if(rt(e.children))o=`
205
- ${Qy(e.children)}${i}
206
- `;else if(Array.isArray(e.children)){let l=e.children.map((c)=>{let u=Jf(c,n);return rt(c)||T(c)&&ye(c)?`${u}${i}`:u});o=n?l.join(""):`
248
+ \``),a.push(`:render="${g}"`),l=!0;let w=` ${a.join(" ")}`;return`<${o}${c} data-bind${w}></${o}>`}else if(Array.isArray(m.children))h=m.children.map((g)=>Z$(g,i,r,n,s)).join(Sl(i.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${u}${p}>`;return`<${o}${c}${u}${p}>${h}</${o}>`}function Im(e,t=!1){if(!e)return"";if(vn(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${bo(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let r=e.tagName??"div",n=t||zs.has(r),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${Gs(e.className)}"`;if(V(e.$props))for(let[l,c]of Object.entries(e.$props))if(Er(c))s+=` .${l}="\${${ZJ(c.$ref)}}"`;else if(ye(c))s+=` .${l}="${Gs(c)}"`;else s+=` .${l}="\${${JSON.stringify(c)}}"`;if(V(e.attributes))for(let[l,c]of Object.entries(e.attributes)){if(ye(c)){s+=` ${l}="${Gs(c)}"`;continue}if(Yt(c)){let u=Zi(l,c);if(u!==null)s+=u===""?` ${l}`:` ${l}="${_e(u)}"`;continue}s+=` ${l}="${_e(String(c))}"`}if(V(e.style)){let l=[];for(let[c,u]of Object.entries(e.style)){if(c.startsWith(":")||c.startsWith(".")||c.startsWith("&")||c.startsWith("[")||c.startsWith("@"))continue;if(ew(u))continue;let p=Sr(c);if(ye(String(u)))l.push(`${p}: ${Gs(String(u))}`);else l.push(`${p}: ${u}`)}if(l.length>0)s+=` style="${l.join("; ")}"`}for(let[l,c]of Object.entries(e)){if(!l.startsWith("on")||l==="observedAttributes")continue;let u=l.slice(2).toLowerCase();if(Er(c)){let p=ta(c.$ref);s+=` @${u}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(Os(c)){let p=Yr(c.body,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(Ir(c)){let p=Gs(c.body);s+=` @${u}=\${(e) => { ${p} }}`}else if(V(c)&&"$expression"in c){let p=ur(c.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=r.includes("-")?Zo:"",o="";if(e.textContent!==void 0){let l=String(e.textContent);if(ye(l))o=`${Gs(l)}${i}`;else if(Er(e.textContent))o=`\${state.${ta(e.textContent.$ref)}}${i}`;else o=_e(l)}else if(e.innerHTML)o=Gs(String(e.innerHTML));else if(dt(e.children))o=`
249
+ ${Q$(e.children)}${i}
250
+ `;else if(Array.isArray(e.children)){let l=e.children.map((c)=>{let u=Cm(c,n);return dt(c)||O(c)&&ye(c)?`${u}${i}`:u});o=n?l.join(""):`
207
251
  ${l.join(`
208
252
  `)}
209
- `}if(new Set(["input","br","hr","img","meta","link"]).has(r))return`<${r}${s}>`;return`<${r}${s}>${o}</${r}>`}function Jf(e,t=!1){if(T(e))return ye(e)?rs(e):je(e);if(Xt(e)||Tt(e))return je(String(e));if(rt(e))return Qy(e);return Ff(e,t)}function Qy(e){let{items:t}=e,r=rr(t)?Df(t.$ref):JSON.stringify(t??[]),n=Ff(e.map);return`\${(${r} ?? []).map((item, index) => html\`${n}\`)}`}function rs(e){return e.replaceAll("$map.","")}function qC(e,t,r,n,s,i,o,a,l,c){let u=[],{needsLit:p}=a,g=t.length>0;u.push("// Generated by @jxsuite/compiler — do not edit manually");let m=["reactive","effect"];if(g)m.push("computed");if(u.push(`import { ${m.join(", ")} } from '@vue/reactivity';`),p)u.push("import { html, render } from 'lit-html';");for(let[b,h]of o){let y=c?c(b):b;u.push(`import { ${[...h].join(", ")} } from '${y}';`)}if(u.push("",dl()),i.length>0)u.push("",pl());u.push("","const state = reactive({");for(let[b,h]of e)u.push(` ${Cn(b)}: ${JSON.stringify(h)},`);if(u.push("});",""),s.length>0){for(let b of s)u.push(b);u.push("")}if(t.length>0){for(let[b,h]of t)u.push(`${Ce("state",St(b))} = computed(${h});`);u.push("")}if(i.length>0){for(let b of i)u.push(b);u.push("")}if(r.length>0){u.push("const bind = {");for(let[b,h]of r)u.push(` ${Cn(b)}: ${h},`);u.push("};")}else u.push("const bind = {};");if(u.push(""),n.length>0){u.push("const on = {");for(let[b,h]of n){let y=h.args??["state"],v=y.map((k)=>k==="state"?"state":"e").join(", ");u.push(` ${Cn(b)}: (e) => { const fn = (${y.join(", ")}) => { ${h.body} }; fn(${v}); },`)}u.push("};")}else u.push("const on = {};");if(u.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)u.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else u.push(" if (parts[0] === 'style' && parts.length > 1) {");return u.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Ri}(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);",""),u.join(`
210
- `)}function HC(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 VC(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 eb(e){return e===null||q(e)}function BC(e){if(e.startsWith("$map/")){let[t,...r]=On(e.slice(5));return Ce(t??"",r.map((n)=>St(n)).join("/"))}if(e.startsWith("#/state/"))return Ce("state",e.slice(8));return Ce("state",e)}function Df(e){return ug("state",e.startsWith("#/state/")?e.slice(8):e)}function Ni(e){return fg(e.startsWith("#/state/")?e.slice(8):e)}function Mf(e,t,r){if(e.has(t))return;e.set(t,`() => ${Ce("state",r.startsWith("#/state/")?r.slice(8):r)}`)}var qf=H(()=>{wi();Ur();Pe();bi()});function WC(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function tb(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,WC(s,e)])));return`
253
+ `}if(new Set(["input","br","hr","img","meta","link"]).has(r))return`<${r}${s}>`;return`<${r}${s}>${o}</${r}>`}function Cm(e,t=!1){if(O(e))return ye(e)?Gs(e):_e(e);if(Nt(e)||Yt(e))return _e(String(e));if(dt(e))return Q$(e);return Im(e,t)}function Q$(e){let{items:t}=e,r=Er(t)?Nm(t.$ref):JSON.stringify(t??[]),n=Im(e.map);return`\${(${r} ?? []).map((item, index) => html\`${n}\`)}`}function Gs(e){return e.replaceAll("$map.","")}function KJ(e,t,r,n,s,i,o,a,l,c){let u=[],{needsLit:p}=a,h=t.length>0;u.push("// Generated by @jxsuite/compiler — do not edit manually");let m=["reactive","effect"];if(h)m.push("computed");if(u.push(`import { ${m.join(", ")} } from '@vue/reactivity';`),p)u.push("import { html, render } from 'lit-html';");for(let[b,g]of o){let y=c?c(b):b;u.push(`import { ${[...g].join(", ")} } from '${y}';`)}if(u.push("",Su()),i.length>0)u.push("",Eu());u.push("","const state = reactive({");for(let[b,g]of e)u.push(` ${xs(b)}: ${JSON.stringify(g)},`);if(u.push("});",""),s.length>0){for(let b of s)u.push(b);u.push("")}if(t.length>0){for(let[b,g]of t)u.push(`${Je("state",Dt(b))} = computed(${g});`);u.push("")}if(i.length>0){for(let b of i)u.push(b);u.push("")}if(r.length>0){u.push("const bind = {");for(let[b,g]of r)u.push(` ${xs(b)}: ${g},`);u.push("};")}else u.push("const bind = {};");if(u.push(""),n.length>0){u.push("const on = {");for(let[b,g]of n){let y=g.args??["state"],w=y.map((P)=>P==="state"?"state":"e").join(", ");u.push(` ${xs(b)}: (e) => { const fn = (${y.join(", ")}) => { ${g.body} }; fn(${w}); },`)}u.push("};")}else u.push("const on = {};");if(u.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)u.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else u.push(" if (parts[0] === 'style' && parts.length > 1) {");return u.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Xo}(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);",""),u.join(`
254
+ `)}function YJ(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(`
255
+ `)}function XJ(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(`
256
+ `)}function ew(e){return e===null||V(e)}function ZJ(e){if(e.startsWith("$map/")){let[t,...r]=bs(e.slice(5));return Je(t??"",r.map((n)=>Dt(n)).join("/"))}if(e.startsWith("#/state/"))return Je("state",e.slice(8));return Je("state",e)}function Nm(e){return ux("state",e.startsWith("#/state/")?e.slice(8):e)}function ta(e){return fx(e.startsWith("#/state/")?e.slice(8):e)}function Om(e,t,r){if(e.has(t))return;e.set(t,`() => ${Je("state",r.startsWith("#/state/")?r.slice(8):r)}`)}var Jm=D(()=>{Ho();An();ve();Fo()});function QJ(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function tw(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,QJ(s,e)])));return`
213
257
  // ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
214
258
  const JX_LOCALES = ${t}
215
259
  const JX_DEFAULT_LOCALE = ${r}
@@ -278,24 +322,24 @@ app.use('/', async (c, next) => {
278
322
  res.headers.set('Content-Language', locale)
279
323
  c.res = res
280
324
  })
281
- `}function _l(e,t="/_jx/server"){return He(e,t)}function Hf(e,t={}){let{adapter:r=null,mounts:n=[],connectors:s=[],i18n:i=null,base:o=""}=t,a=_l(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=UC(n,s),u=e.map(({exportName:m})=>zC(m,a)).join(`
325
+ `}function Lu(e,t="/_jx/server"){return Xe(e,t)}function Mm(e,t={}){let{adapter:r=null,mounts:n=[],connectors:s=[],i18n:i=null,base:o=""}=t,a=Lu(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(`
326
+ `),c=eM(n,s),u=e.map(({exportName:m})=>tM(m,a)).join(`
283
327
  `),p=r==="cloudflare-workers"||r==="cloudflare-pages"?`
284
328
  app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
285
329
  `:`
286
- `,g=tb(i);return`// Generated by @jxsuite/compiler — do not edit manually
330
+ `,h=tw(i);return`// Generated by @jxsuite/compiler — do not edit manually
287
331
  import { Hono } from 'hono'
288
332
  ${l}${c.imports}
289
333
 
290
334
  const app = new Hono()
291
- ${g}${c.routes}${u}
335
+ ${h}${c.routes}${u}
292
336
  ${p}
293
337
  export default app
294
- `}function UC(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:`
338
+ `}function eM(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:`
295
339
  ${n.join(`
296
340
  `)}`,routes:`${s.join(`
297
341
  `)}
298
- `}}function zC(e,t){return`
342
+ `}}function tM(e,t){return`
299
343
  app.post('${t}/${e}', async (c) => {
300
344
  const args = await c.req.json().catch(() => ({}))
301
345
  try {
@@ -303,14 +347,14 @@ app.post('${t}/${e}', async (c) => {
303
347
  } catch (e) {
304
348
  return c.json({ ok: false, error: e?.message ?? 'Server error' }, 500)
305
349
  }
306
- })`}var Vf=H(()=>{gr()});function nb(e){let t=e.title;if(!t)throw Error("compileClassJson: missing title (class name)");let r=KC(e.extends),n=e.$defs,s=n?.fields??{},i=n?.constructor,o=GC(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[u,p]of Object.entries(s)){if(p.scope!=="static")continue;let g=p.identifier??u,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}${g} = ${b};`)}for(let[u,p]of Object.entries(s)){if(p.scope==="static")continue;if(p.access!=="private")continue;let g=p.identifier??u;l.push(` #${g};`)}if(Object.keys(s).length>0)l.push("");if(l.push(" constructor(config = {}) {"),o?.superCall||r!=="Object"){let u=o?.superCall?.arguments?o.superCall.arguments.join(", "):"";l.push(` super(${u});`)}for(let[u,p]of Object.entries(s)){if(p.scope==="static")continue;let g=p.identifier??u,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}${g} = config.${g} !== undefined ? config.${g} : ${b};`)}if(o?.body){let u=Array.isArray(o.body)?o.body:[o.body];for(let p of u)l.push(` ${p}`)}l.push(" }");for(let[u,p]of Object.entries(a)){let g=p.identifier??u,m=p.scope==="static",h=p.access==="private"?"#":"",y=m?"static ":"",v=p.returnType?.$ref?.includes("Promise")||XC(p)?"async ":"",k=rb(p.parameters??[]),S=YC(p.body);if(l.push(""),p.role==="accessor"){if(p.getter)l.push(` ${y}get ${h}${g}() {`,` ${p.getter.body}`," }");if(p.setter){let E=rb(p.setter.parameters??[]);l.push(` ${y}set ${h}${g}(${E}) {`,` ${p.setter.body}`," }")}}else{l.push(` ${y}${v}${h}${g}(${k}) {`);for(let E of S)l.push(` ${E}`);l.push(" }")}}return l.push("}","",`export { ${t} };`,`export default ${t};`,""),l.join(`
307
- `)}function GC(e){return typeof e==="object"}function KC(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 rb(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 YC(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function XC(e){return(Array.isArray(e.body)?e.body.join(`
308
- `):e.body??"").includes("await ")}var sb=H(()=>{Pe()});import{readFileSync as ZC}from"node:fs";async function Bf(e,t={}){let{title:r="Jx App",reactivitySrc:n=Pi,litHtmlSrc:s=ji,projectStyle:i=null}=t,o;if(T(e)){let l=ZC(e,"utf8");if(e.endsWith(".json"))o=zn(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),p=t.formats?.byExtension(u,"parse");if(!p){await Promise.resolve().then(() => jn());throw Ia(e,u)}o=await p.parseDocument(l)}}else o=e;if(Am(o)){await Promise.resolve().then(() => sb());let c=nb(o),u=T(e)?e.replace(/\.class\.json$/,".js"):`${o.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!ul(o))return Ky(o,{litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...ib(t),title:r});if(o.tagName&&o.tagName.includes("-")){let{tagName:l}=o,c=hl(l),p={content:Wo(o,c,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${l}.js`,tagName:l},g=Oi(o,o.$media??{},i),m=`<!DOCTYPE html>
350
+ })`}var Dm=D(()=>{Lr()});function nw(e){let t=e.title;if(!t)throw Error("compileClassJson: missing title (class name)");let r=nM(e.extends),n=e.$defs,s=n?.fields??{},i=n?.constructor,o=rM(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[u,p]of Object.entries(s)){if(p.scope!=="static")continue;let h=p.identifier??u,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[u,p]of Object.entries(s)){if(p.scope==="static")continue;if(p.access!=="private")continue;let h=p.identifier??u;l.push(` #${h};`)}if(Object.keys(s).length>0)l.push("");if(l.push(" constructor(config = {}) {"),o?.superCall||r!=="Object"){let u=o?.superCall?.arguments?o.superCall.arguments.join(", "):"";l.push(` super(${u});`)}for(let[u,p]of Object.entries(s)){if(p.scope==="static")continue;let h=p.identifier??u,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 u=Array.isArray(o.body)?o.body:[o.body];for(let p of u)l.push(` ${p}`)}l.push(" }");for(let[u,p]of Object.entries(a)){let h=p.identifier??u,m=p.scope==="static",g=p.access==="private"?"#":"",y=m?"static ":"",w=p.returnType?.$ref?.includes("Promise")||iM(p)?"async ":"",P=rw(p.parameters??[]),S=sM(p.body);if(l.push(""),p.role==="accessor"){if(p.getter)l.push(` ${y}get ${g}${h}() {`,` ${p.getter.body}`," }");if(p.setter){let E=rw(p.setter.parameters??[]);l.push(` ${y}set ${g}${h}(${E}) {`,` ${p.setter.body}`," }")}}else{l.push(` ${y}${w}${g}${h}(${P}) {`);for(let E of S)l.push(` ${E}`);l.push(" }")}}return l.push("}","",`export { ${t} };`,`export default ${t};`,""),l.join(`
351
+ `)}function rM(e){return typeof e==="object"}function nM(e){if(!e)return"Object";if(O(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 rw(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let r=t.identifier??t.name;return O(r)?r:"arg"}).join(", ")}function sM(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function iM(e){return(Array.isArray(e.body)?e.body.join(`
352
+ `):e.body??"").includes("await ")}var sw=D(()=>{ve()});import{readFileSync as oM}from"node:fs";async function Lm(e,t={}){let{title:r="Jx App",reactivitySrc:n=zo,litHtmlSrc:s=Go,projectStyle:i=null}=t,o;if(O(e)){let l=oM(e,"utf8");if(fs(e))o=ds(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),p=t.formats?.byExtension(u,"parse");if(!p){await Promise.resolve().then(() => ms());throw Uc(e,u)}o=await p.parseDocument(l)}}else o=e;if(jy(o)){await Promise.resolve().then(() => sw());let c=nw(o),u=O(e)?e.replace(/\.class\.json$/,".js"):`${o.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!wu(o))return K$(o,{litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...iw(t),title:r});if(o.tagName&&o.tagName.includes("-")){let{tagName:l}=o,c=ju(l),p={content:jl(o,c,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${l}.js`,tagName:l},h=Qo(o,o.$media??{},i),m=`<!DOCTYPE html>
309
353
  <html lang="en">
310
354
  <head>
311
355
  <meta charset="utf-8">
312
356
  <meta name="viewport" content="width=device-width, initial-scale=1">
313
- <title>${je(r)}</title>
357
+ <title>${_e(r)}</title>
314
358
  <script type="importmap">
315
359
  {
316
360
  "imports": {
@@ -319,53 +363,53 @@ app.post('${t}/${e}', async (c) => {
319
363
  }
320
364
  }
321
365
  </script>
322
- ${g}
366
+ ${h}
323
367
  </head>
324
368
  <body>
325
369
  <${l}></${l}>
326
370
  <script type="module" src="./${l}.js"></script>
327
371
  </body>
328
- </html>`;return{files:[p],html:m}}let a={litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...ib(t),title:r};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;return Lf(o,a)}function ib(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function xG(e,t){let r=await Bf(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 ob=H(()=>{Ur();Uo();Xy();qf();Pe();hr();Ur();Vf();Uo();qf()});var ab=(e)=>typeof e<"u"&&e!==null,QC=(e)=>typeof e==="object",eN=(e)=>Object.prototype.toString.call(e)==="[object Object]",tN=(e)=>typeof e==="function",rN=(e)=>typeof e==="boolean",nN=(e)=>e instanceof Buffer,sN=(e)=>{if(ab(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},iN=(e)=>e instanceof ArrayBuffer,oN=(e)=>typeof e==="string"&&e.length>0,aN=(e)=>typeof e==="number"&&Number.isFinite(e),lN=(e)=>Number.isInteger(e),cN=(e,t,r)=>e>=t&&e<=r,uN=(e,t)=>t.includes(e),fN=(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}`)},dN=(e,t)=>(t.message=e.message,t),f;var Gr=H(()=>{/*!
372
+ </html>`;return{files:[p],html:m}}let a={litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...iw(t),title:r};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;return Tm(o,a)}function iw(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function Gee(e,t){let r=await Lm(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 ow=D(()=>{An();kl();X$();Jm();ve();Fi();An();Dm();kl();Jm()});var aw=(e)=>typeof e<"u"&&e!==null,aM=(e)=>typeof e==="object",lM=(e)=>Object.prototype.toString.call(e)==="[object Object]",cM=(e)=>typeof e==="function",uM=(e)=>typeof e==="boolean",fM=(e)=>e instanceof Buffer,dM=(e)=>{if(aw(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},pM=(e)=>e instanceof ArrayBuffer,mM=(e)=>typeof e==="string"&&e.length>0,hM=(e)=>typeof e==="number"&&Number.isFinite(e),gM=(e)=>Number.isInteger(e),yM=(e,t,r)=>e>=t&&e<=r,bM=(e,t)=>t.includes(e),xM=(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}`)},$M=(e,t)=>(t.message=e.message,t),f;var On=D(()=>{/*!
329
373
  Copyright 2013 Lovell Fuller and others.
330
374
  SPDX-License-Identifier: Apache-2.0
331
- */f={defined:ab,object:QC,plainObject:eN,fn:tN,bool:rN,buffer:nN,typedArray:sN,arrayBuffer:iN,string:oN,number:aN,integer:lN,inRange:cN,inArray:uN,invalidParameterError:fN,nativeError:dN}});var ub=C(function(jG,cb){var lb=()=>process.platform==="linux",Rl=null,pN=()=>{if(!Rl)if(lb()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,Rl=process.report.getReport(),process.report.excludeNetwork=e}else Rl={};return Rl};cb.exports={isLinux:lb,getReport:pN}});var db=C(function(kG,fb){var Pr=De("fs"),mN=(e)=>{let t=Pr.openSync(e,"r"),r=Buffer.alloc(2048),n=Pr.readSync(t,r,0,2048,0);return Pr.close(t,()=>{}),r.subarray(0,n)},hN=(e)=>new Promise((t,r)=>{Pr.open(e,"r",(n,s)=>{if(n)r(n);else{let i=Buffer.alloc(2048);Pr.read(s,i,0,2048,0,(o,a)=>{t(i.subarray(0,a)),Pr.close(s,()=>{})})}})});fb.exports={LDD_PATH:"/usr/bin/ldd",SELF_PATH:"/proc/self/exe",readFileSync:mN,readFile:hN}});var mb=C(function(_G,pb){var gN=(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};pb.exports={interpreterPath:gN}});var Cl=C(function(RG,Ab){var Al=De("child_process"),{isLinux:Ti,getReport:gb}=ub(),{LDD_PATH:Ol,SELF_PATH:yb,readFile:Wf,readFileSync:Uf}=db(),{interpreterPath:bb}=mb(),Kr,Yr,Xr,ns="",xb=()=>{if(!ns)return new Promise((e)=>{Al.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{ns=t?" ":r,e(ns)})});return ns},$b=()=>{if(!ns)try{ns=Al.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){ns=" "}return ns},Jn="glibc",vb=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,Zs="musl",yN=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),wb=()=>{let e=gb();if(e.header&&e.header.glibcVersionRuntime)return Jn;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(yN))return Zs}return null},Sb=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(Jn))return Jn;if(r&&r.includes(Zs))return Zs;return null},Eb=(e)=>{if(e){if(e.includes("/ld-musl-"))return Zs;else if(e.includes("/ld-linux-"))return Jn}return null},Pb=(e)=>{if(e=e.toString(),e.includes("musl"))return Zs;if(e.includes("GNU C Library"))return Jn;return null},bN=async()=>{if(Yr!==void 0)return Yr;Yr=null;try{let e=await Wf(Ol);Yr=Pb(e)}catch(e){}return Yr},xN=()=>{if(Yr!==void 0)return Yr;Yr=null;try{let e=Uf(Ol);Yr=Pb(e)}catch(e){}return Yr},$N=async()=>{if(Kr!==void 0)return Kr;Kr=null;try{let e=await Wf(yb),t=bb(e);Kr=Eb(t)}catch(e){}return Kr},vN=()=>{if(Kr!==void 0)return Kr;Kr=null;try{let e=Uf(yb),t=bb(e);Kr=Eb(t)}catch(e){}return Kr},jb=async()=>{let e=null;if(Ti()){if(e=await $N(),!e){if(e=await bN(),!e)e=wb();if(!e){let t=await xb();e=Sb(t)}}}return e},kb=()=>{let e=null;if(Ti()){if(e=vN(),!e){if(e=xN(),!e)e=wb();if(!e){let t=$b();e=Sb(t)}}}return e},wN=async()=>Ti()&&await jb()!==Jn,SN=()=>Ti()&&kb()!==Jn,EN=async()=>{if(Xr!==void 0)return Xr;Xr=null;try{let t=(await Wf(Ol)).match(vb);if(t)Xr=t[1]}catch(e){}return Xr},PN=()=>{if(Xr!==void 0)return Xr;Xr=null;try{let t=Uf(Ol).match(vb);if(t)Xr=t[1]}catch(e){}return Xr},_b=()=>{let e=gb();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},hb=(e)=>e.trim().split(/\s+/)[1],Rb=(e)=>{let[t,r,n]=e.split(/[\r\n]+/);if(t&&t.includes(Jn))return hb(t);if(r&&n&&r.includes(Zs))return hb(n);return null},jN=async()=>{let e=null;if(Ti()){if(e=await EN(),!e)e=_b();if(!e){let t=await xb();e=Rb(t)}}return e},kN=()=>{let e=null;if(Ti()){if(e=PN(),!e)e=_b();if(!e){let t=$b();e=Rb(t)}}return e};Ab.exports={GLIBC:Jn,MUSL:Zs,family:jb,familySync:kb,isNonGlibcLinux:wN,isNonGlibcLinuxSync:SN,version:jN,versionSync:kN}});var Ii=C(function(AG,Ob){var _N=Number.MAX_SAFE_INTEGER||9007199254740991,RN=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ob.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:_N,RELEASE_TYPES:RN,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zo=C(function(OG,Cb){var AN=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Cb.exports=AN});var Mi=C(function(Zr,Nb){var{MAX_SAFE_COMPONENT_LENGTH:zf,MAX_SAFE_BUILD_LENGTH:ON,MAX_LENGTH:CN}=Ii(),NN=zo();Zr=Nb.exports={};var TN=Zr.re=[],IN=Zr.safeRe=[],te=Zr.src=[],MN=Zr.safeSrc=[],re=Zr.t={},JN=0,Gf="[a-zA-Z0-9-]",DN=[["\\s",1],["\\d",CN],[Gf,ON]],LN=(e)=>{for(let[t,r]of DN)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},we=(e,t,r)=>{let n=LN(t),s=JN++;NN(e,s,t),re[e]=s,te[s]=t,MN[s]=n,TN[s]=new RegExp(t,r?"g":void 0),IN[s]=new RegExp(n,r?"g":void 0)};we("NUMERICIDENTIFIER","0|[1-9]\\d*");we("NUMERICIDENTIFIERLOOSE","\\d+");we("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Gf}*`);we("MAINVERSION",`(${te[re.NUMERICIDENTIFIER]})\\.(${te[re.NUMERICIDENTIFIER]})\\.(${te[re.NUMERICIDENTIFIER]})`);we("MAINVERSIONLOOSE",`(${te[re.NUMERICIDENTIFIERLOOSE]})\\.(${te[re.NUMERICIDENTIFIERLOOSE]})\\.(${te[re.NUMERICIDENTIFIERLOOSE]})`);we("PRERELEASEIDENTIFIER",`(?:${te[re.NONNUMERICIDENTIFIER]}|${te[re.NUMERICIDENTIFIER]})`);we("PRERELEASEIDENTIFIERLOOSE",`(?:${te[re.NONNUMERICIDENTIFIER]}|${te[re.NUMERICIDENTIFIERLOOSE]})`);we("PRERELEASE",`(?:-(${te[re.PRERELEASEIDENTIFIER]}(?:\\.${te[re.PRERELEASEIDENTIFIER]})*))`);we("PRERELEASELOOSE",`(?:-?(${te[re.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${te[re.PRERELEASEIDENTIFIERLOOSE]})*))`);we("BUILDIDENTIFIER",`${Gf}+`);we("BUILD",`(?:\\+(${te[re.BUILDIDENTIFIER]}(?:\\.${te[re.BUILDIDENTIFIER]})*))`);we("FULLPLAIN",`v?${te[re.MAINVERSION]}${te[re.PRERELEASE]}?${te[re.BUILD]}?`);we("FULL",`^${te[re.FULLPLAIN]}$`);we("LOOSEPLAIN",`[v=\\s]*${te[re.MAINVERSIONLOOSE]}${te[re.PRERELEASELOOSE]}?${te[re.BUILD]}?`);we("LOOSE",`^${te[re.LOOSEPLAIN]}$`);we("GTLT","((?:<|>)?=?)");we("XRANGEIDENTIFIERLOOSE",`${te[re.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);we("XRANGEIDENTIFIER",`${te[re.NUMERICIDENTIFIER]}|x|X|\\*`);we("XRANGEPLAIN",`[v=\\s]*(${te[re.XRANGEIDENTIFIER]})(?:\\.(${te[re.XRANGEIDENTIFIER]})(?:\\.(${te[re.XRANGEIDENTIFIER]})(?:${te[re.PRERELEASE]})?${te[re.BUILD]}?)?)?`);we("XRANGEPLAINLOOSE",`[v=\\s]*(${te[re.XRANGEIDENTIFIERLOOSE]})(?:\\.(${te[re.XRANGEIDENTIFIERLOOSE]})(?:\\.(${te[re.XRANGEIDENTIFIERLOOSE]})(?:${te[re.PRERELEASELOOSE]})?${te[re.BUILD]}?)?)?`);we("XRANGE",`^${te[re.GTLT]}\\s*${te[re.XRANGEPLAIN]}$`);we("XRANGELOOSE",`^${te[re.GTLT]}\\s*${te[re.XRANGEPLAINLOOSE]}$`);we("COERCEPLAIN",`(^|[^\\d])(\\d{1,${zf}})(?:\\.(\\d{1,${zf}}))?(?:\\.(\\d{1,${zf}}))?`);we("COERCE",`${te[re.COERCEPLAIN]}(?:$|[^\\d])`);we("COERCEFULL",te[re.COERCEPLAIN]+`(?:${te[re.PRERELEASE]})?(?:${te[re.BUILD]})?(?:$|[^\\d])`);we("COERCERTL",te[re.COERCE],!0);we("COERCERTLFULL",te[re.COERCEFULL],!0);we("LONETILDE","(?:~>?)");we("TILDETRIM",`(\\s*)${te[re.LONETILDE]}\\s+`,!0);Zr.tildeTrimReplace="$1~";we("TILDE",`^${te[re.LONETILDE]}${te[re.XRANGEPLAIN]}$`);we("TILDELOOSE",`^${te[re.LONETILDE]}${te[re.XRANGEPLAINLOOSE]}$`);we("LONECARET","(?:\\^)");we("CARETTRIM",`(\\s*)${te[re.LONECARET]}\\s+`,!0);Zr.caretTrimReplace="$1^";we("CARET",`^${te[re.LONECARET]}${te[re.XRANGEPLAIN]}$`);we("CARETLOOSE",`^${te[re.LONECARET]}${te[re.XRANGEPLAINLOOSE]}$`);we("COMPARATORLOOSE",`^${te[re.GTLT]}\\s*(${te[re.LOOSEPLAIN]})$|^$`);we("COMPARATOR",`^${te[re.GTLT]}\\s*(${te[re.FULLPLAIN]})$|^$`);we("COMPARATORTRIM",`(\\s*)${te[re.GTLT]}\\s*(${te[re.LOOSEPLAIN]}|${te[re.XRANGEPLAIN]})`,!0);Zr.comparatorTrimReplace="$1$2$3";we("HYPHENRANGE",`^\\s*(${te[re.XRANGEPLAIN]})\\s+-\\s+(${te[re.XRANGEPLAIN]})\\s*$`);we("HYPHENRANGELOOSE",`^\\s*(${te[re.XRANGEPLAINLOOSE]})\\s+-\\s+(${te[re.XRANGEPLAINLOOSE]})\\s*$`);we("STAR","(<|>)?=?\\s*\\*");we("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");we("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Nl=C(function(CG,Tb){var FN=Object.freeze({loose:!0}),qN=Object.freeze({}),HN=(e)=>{if(!e)return qN;if(typeof e!=="object")return FN;return e};Tb.exports=HN});var Kf=C(function(NG,Jb){var Ib=/^[0-9]+$/,Mb=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Ib.test(e),n=Ib.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},VN=(e,t)=>Mb(t,e);Jb.exports={compareIdentifiers:Mb,rcompareIdentifiers:VN}});var _t=C(function(TG,Lb){var Tl=zo(),{MAX_LENGTH:Db,MAX_SAFE_INTEGER:Il}=Ii(),{safeRe:Ml,t:Jl}=Mi(),BN=Nl(),{compareIdentifiers:Yf}=Kf(),WN=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Yf(e[n],r[n])!==0)return!1;return!0};class Fr{constructor(e,t){if(t=BN(t),e instanceof Fr)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>Db)throw TypeError(`version is longer than ${Db} characters`);Tl("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Ml[Jl.LOOSE]:Ml[Jl.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>Il||this.major<0)throw TypeError("Invalid major version");if(this.minor>Il||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Il||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<Il)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(Tl("SemVer.compare",this.version,this.options,e),!(e instanceof Fr)){if(typeof e==="string"&&e===this.version)return 0;e=new Fr(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Fr))e=new Fr(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 Fr))e=new Fr(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(Tl("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 Yf(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Fr))e=new Fr(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(Tl("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 Yf(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?Ml[Jl.PRERELEASELOOSE]:Ml[Jl.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(WN(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}}Lb.exports=Fr});var ss=C(function(IG,qb){var Fb=_t(),UN=(e,t,r=!1)=>{if(e instanceof Fb)return e;try{return new Fb(e,t)}catch(n){if(!r)return null;throw n}};qb.exports=UN});var Vb=C(function(MG,Hb){var zN=ss(),GN=(e,t)=>{let r=zN(e,t);return r?r.version:null};Hb.exports=GN});var Wb=C(function(JG,Bb){var KN=ss(),YN=(e,t)=>{let r=KN(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Bb.exports=YN});var Gb=C(function(DG,zb){var Ub=_t(),XN=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new Ub(e instanceof Ub?e.version:e,r).inc(t,n,s).version}catch(i){return null}};zb.exports=XN});var Xb=C(function(LG,Yb){var Kb=ss(),ZN=(e,t)=>{let r=Kb(e,null,!0),n=Kb(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 u=l?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};Yb.exports=ZN});var Qb=C(function(FG,Zb){var QN=_t(),eT=(e,t)=>new QN(e,t).major;Zb.exports=eT});var tx=C(function(qG,ex){var tT=_t(),rT=(e,t)=>new tT(e,t).minor;ex.exports=rT});var nx=C(function(HG,rx){var nT=_t(),sT=(e,t)=>new nT(e,t).patch;rx.exports=sT});var ix=C(function(VG,sx){var iT=ss(),oT=(e,t)=>{let r=iT(e,t);return r&&r.prerelease.length?r.prerelease:null};sx.exports=oT});var jr=C(function(BG,ax){var ox=_t(),aT=(e,t,r)=>new ox(e,r).compare(new ox(t,r));ax.exports=aT});var cx=C(function(WG,lx){var lT=jr(),cT=(e,t,r)=>lT(t,e,r);lx.exports=cT});var fx=C(function(UG,ux){var uT=jr(),fT=(e,t)=>uT(e,t,!0);ux.exports=fT});var Dl=C(function(zG,px){var dx=_t(),dT=(e,t,r)=>{let n=new dx(e,r),s=new dx(t,r);return n.compare(s)||n.compareBuild(s)};px.exports=dT});var hx=C(function(GG,mx){var pT=Dl(),mT=(e,t)=>e.sort((r,n)=>pT(r,n,t));mx.exports=mT});var yx=C(function(KG,gx){var hT=Dl(),gT=(e,t)=>e.sort((r,n)=>hT(n,r,t));gx.exports=gT});var Go=C(function(YG,bx){var yT=jr(),bT=(e,t,r)=>yT(e,t,r)>0;bx.exports=bT});var Ll=C(function(XG,xx){var xT=jr(),$T=(e,t,r)=>xT(e,t,r)<0;xx.exports=$T});var Xf=C(function(ZG,$x){var vT=jr(),wT=(e,t,r)=>vT(e,t,r)===0;$x.exports=wT});var Zf=C(function(QG,vx){var ST=jr(),ET=(e,t,r)=>ST(e,t,r)!==0;vx.exports=ET});var Fl=C(function(eK,wx){var PT=jr(),jT=(e,t,r)=>PT(e,t,r)>=0;wx.exports=jT});var ql=C(function(tK,Sx){var kT=jr(),_T=(e,t,r)=>kT(e,t,r)<=0;Sx.exports=_T});var Qf=C(function(rK,Ex){var RT=Xf(),AT=Zf(),OT=Go(),CT=Fl(),NT=Ll(),TT=ql(),IT=(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 RT(e,r,n);case"!=":return AT(e,r,n);case">":return OT(e,r,n);case">=":return CT(e,r,n);case"<":return NT(e,r,n);case"<=":return TT(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};Ex.exports=IT});var jx=C(function(nK,Px){var MT=_t(),JT=ss(),{safeRe:Hl,t:Vl}=Mi(),DT=(e,t)=>{if(e instanceof MT)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?Hl[Vl.COERCEFULL]:Hl[Vl.COERCE]);else{let l=t.includePrerelease?Hl[Vl.COERCERTLFULL]:Hl[Vl.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 JT(`${n}.${s}.${i}${o}${a}`,t)};Px.exports=DT});var Rx=C(function(sK,_x){var LT=ss(),kx=Ii(),FT=_t(),qT=(e,t,r)=>{if(!kx.RELEASE_TYPES.includes(t))return null;let n=HT(e,r);return n&&VT(n,t)},HT=(e,t)=>{let r=e instanceof FT?e.version:e;return LT(r,t)},VT=(e,t)=>{if(BT(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()},BT=(e)=>e.startsWith("pre");_x.exports=qT});var Cx=C(function(iK,Ox){class Ax{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}}Ox.exports=Ax});var kr=C(function(oK,Mx){var WT=/\s+/g;class Ko{constructor(e,t){if(t=zT(t),e instanceof Ko)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new Ko(e.raw,t);if(e instanceof Bl)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(WT," "),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)=>!Tx(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&&rI(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(tI,"");let r=((this.options.includePrerelease&&QT)|(this.options.loose&&eI))+":"+e,n=Nx.get(r);if(n)return n;let s=this.options.loose,i=s?Wt[Rt.HYPHENRANGELOOSE]:Wt[Rt.HYPHENRANGE];e=e.replace(i,pI(this.options.includePrerelease)),Ge("hyphen replace",e),e=e.replace(Wt[Rt.COMPARATORTRIM],YT),Ge("comparator trim",e),e=e.replace(Wt[Rt.TILDETRIM],XT),Ge("tilde trim",e),e=e.replace(Wt[Rt.CARETTRIM],ZT),Ge("caret trim",e);let o=e.split(" ").map((u)=>nI(u,this.options)).join(" ").split(/\s+/).map((u)=>dI(u,this.options));if(s)o=o.filter((u)=>(Ge("loose invalid filter",u,this.options),!!u.match(Wt[Rt.COMPARATORLOOSE])));Ge("range list",o);let a=new Map,l=o.map((u)=>new Bl(u,this.options));for(let u of l){if(Tx(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return Nx.set(r,c),c}intersects(e,t){if(!(e instanceof Ko))throw TypeError("a Range is required");return this.set.some((r)=>Ix(r,t)&&e.set.some((n)=>Ix(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 GT(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(mI(this.set[t],e,this.options))return!0;return!1}}Mx.exports=Ko;var UT=Cx(),Nx=new UT,zT=Nl(),Bl=Yo(),Ge=zo(),GT=_t(),{safeRe:Wt,src:KT,t:Rt,comparatorTrimReplace:YT,tildeTrimReplace:XT,caretTrimReplace:ZT}=Mi(),{FLAG_INCLUDE_PRERELEASE:QT,FLAG_LOOSE:eI}=Ii(),tI=new RegExp(KT[Rt.BUILD],"g"),Tx=(e)=>e.value==="<0.0.0-0",rI=(e)=>e.value==="",Ix=(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},nI=(e,t)=>(e=e.replace(Wt[Rt.BUILD],""),Ge("comp",e,t),e=aI(e,t),Ge("caret",e),e=iI(e,t),Ge("tildes",e),e=cI(e,t),Ge("xrange",e),e=fI(e,t),Ge("stars",e),e),$t=(e)=>!e||e.toLowerCase()==="x"||e==="*",sI=(e,t,r)=>$t(e)&&!$t(t)||$t(t)&&r&&!$t(r),iI=(e,t)=>e.trim().split(/\s+/).map((r)=>oI(r,t)).join(" "),oI=(e,t)=>{let r=t.loose?Wt[Rt.TILDELOOSE]:Wt[Rt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{Ge("tilde",e,s,i,o,a,l);let c;if($t(i))c="";else if($t(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if($t(a))c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else if(l)Ge("replaceTilde pr",l),c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;return Ge("tilde return",c),c})},aI=(e,t)=>e.trim().split(/\s+/).map((r)=>lI(r,t)).join(" "),lI=(e,t)=>{Ge("caret",e,t);let r=t.loose?Wt[Rt.CARETLOOSE]:Wt[Rt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{Ge("caret",e,s,i,o,a,l);let c;if($t(i))c="";else if($t(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if($t(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(Ge("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(Ge("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 Ge("caret return",c),c})},cI=(e,t)=>(Ge("replaceXRanges",e,t),e.split(/\s+/).map((r)=>uI(r,t)).join(" ")),uI=(e,t)=>{e=e.trim();let r=t.loose?Wt[Rt.XRANGELOOSE]:Wt[Rt.XRANGE];return e.replace(r,(n,s,i,o,a,l)=>{if(Ge("xRange",e,n,s,i,o,a,l),sI(i,o,a))return e;let c=$t(i),u=c||$t(o),p=u||$t(a),g=p;if(s==="="&&g)s="";if(l=t.includePrerelease?"-0":"",c)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&g){if(u)o=0;if(a=0,s===">")if(s=">=",u)i=+i+1,o=0,a=0;else o=+o+1,a=0;else if(s==="<=")if(s="<",u)i=+i+1;else o=+o+1;if(s==="<")l="-0";n=`${s+i}.${o}.${a}${l}`}else if(u)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(p)n=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`;return Ge("xRange return",n),n})},fI=(e,t)=>(Ge("replaceStars",e,t),e.trim().replace(Wt[Rt.STAR],"")),dI=(e,t)=>(Ge("replaceGTE0",e,t),e.trim().replace(Wt[t.includePrerelease?Rt.GTE0PRE:Rt.GTE0],"")),pI=(e)=>(t,r,n,s,i,o,a,l,c,u,p,g)=>{if($t(n))r="";else if($t(s))r=`>=${n}.0.0${e?"-0":""}`;else if($t(i))r=`>=${n}.${s}.0${e?"-0":""}`;else if(o)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if($t(c))l="";else if($t(u))l=`<${+c+1}.0.0-0`;else if($t(p))l=`<${c}.${+u+1}.0-0`;else if(g)l=`<=${c}.${u}.${p}-${g}`;else if(e)l=`<${c}.${u}.${+p+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},mI=(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(Ge(e[n].semver),e[n].semver===Bl.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 Yo=C(function(aK,Hx){var Xo=Symbol("SemVer ANY");class Wl{static get ANY(){return Xo}constructor(e,t){if(t=Jx(t),e instanceof Wl)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),td("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Xo)this.value="";else this.value=this.operator+this.semver.version;td("comp",this)}parse(e){let t=this.options.loose?Dx[Lx.COMPARATORLOOSE]:Dx[Lx.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=Xo;else this.semver=new Fx(r[2],this.options.loose)}toString(){return this.value}test(e){if(td("Comparator.test",e,this.options.loose),this.semver===Xo||e===Xo)return!0;if(typeof e==="string")try{e=new Fx(e,this.options)}catch(t){return!1}return ed(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Wl))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new qx(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new qx(this.value,t).test(e.semver)}if(t=Jx(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(ed(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(ed(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}Hx.exports=Wl;var Jx=Nl(),{safeRe:Dx,t:Lx}=Mi(),ed=Qf(),td=zo(),Fx=_t(),qx=kr()});var Zo=C(function(lK,Vx){var hI=kr(),gI=(e,t,r)=>{try{t=new hI(t,r)}catch(n){return!1}return t.test(e)};Vx.exports=gI});var Wx=C(function(cK,Bx){var yI=kr(),bI=(e,t)=>new yI(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));Bx.exports=bI});var zx=C(function(uK,Ux){var xI=_t(),$I=kr(),vI=(e,t,r)=>{let n=null,s=null,i=null;try{i=new $I(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===-1)n=o,s=new xI(n,r)}}),n};Ux.exports=vI});var Kx=C(function(fK,Gx){var wI=_t(),SI=kr(),EI=(e,t,r)=>{let n=null,s=null,i=null;try{i=new SI(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===1)n=o,s=new wI(n,r)}}),n};Gx.exports=EI});var Zx=C(function(dK,Xx){var rd=_t(),PI=kr(),Yx=Go(),jI=(e,t)=>{e=new PI(e,t);let r=new rd("0.0.0");if(e.test(r))return r;if(r=new rd("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 rd(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||Yx(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||Yx(r,i)))r=i}if(r&&e.test(r))return r;return null};Xx.exports=jI});var e$=C(function(pK,Qx){var kI=kr(),_I=(e,t)=>{try{return new kI(e,t).range||"*"}catch(r){return null}};Qx.exports=_I});var Ul=C(function(mK,s$){var RI=_t(),n$=Yo(),{ANY:AI}=n$,OI=kr(),CI=Zo(),t$=Go(),r$=Ll(),NI=ql(),TI=Fl(),II=(e,t,r,n)=>{e=new RI(e,n),t=new OI(t,n);let s,i,o,a,l;switch(r){case">":s=t$,i=NI,o=r$,a=">",l=">=";break;case"<":s=r$,i=TI,o=t$,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(CI(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let u=t.set[c],p=null,g=null;if(u.forEach((m)=>{if(m.semver===AI)m=new n$(">=0.0.0");if(p=p||m,g=g||m,s(m.semver,p.semver,n))p=m;else if(o(m.semver,g.semver,n))g=m}),p.operator===a||p.operator===l)return!1;if((!g.operator||g.operator===a)&&i(e,g.semver))return!1;else if(g.operator===l&&o(e,g.semver))return!1}return!0};s$.exports=II});var o$=C(function(hK,i$){var MI=Ul(),JI=(e,t,r)=>MI(e,t,">",r);i$.exports=JI});var l$=C(function(gK,a$){var DI=Ul(),LI=(e,t,r)=>DI(e,t,"<",r);a$.exports=LI});var f$=C(function(yK,u$){var c$=kr(),FI=(e,t,r)=>(e=new c$(e,r),t=new c$(t,r),e.intersects(t,r));u$.exports=FI});var p$=C(function(bK,d$){var qI=Zo(),HI=jr();d$.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((u,p)=>HI(u,p,r));for(let u of o)if(qI(u,t,r)){if(i=u,!s)s=u}else{if(i)n.push([s,i]);i=null,s=null}if(s)n.push([s,null]);let a=[];for(let[u,p]of n)if(u===p)a.push(u);else if(!p&&u===o[0])a.push("*");else if(!p)a.push(`>=${u}`);else if(u===o[0])a.push(`<=${p}`);else a.push(`${u} - ${p}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var x$=C(function(xK,b$){var m$=kr(),id=Yo(),{ANY:nd}=id,sd=Zo(),od=jr(),VI=(e,t,r={})=>{if(e===t)return!0;e=new m$(e,r),t=new m$(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=WI(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},BI=[new id(">=0.0.0-0")],h$=[new id(">=0.0.0")],WI=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===nd)if(t.length===1&&t[0].semver===nd)return!0;else if(r.includePrerelease)e=BI;else e=h$;if(t.length===1&&t[0].semver===nd)if(r.includePrerelease)return!0;else t=h$;let n=new Set,s,i;for(let m of e)if(m.operator===">"||m.operator===">=")s=g$(s,m,r);else if(m.operator==="<"||m.operator==="<=")i=y$(i,m,r);else n.add(m.semver);if(n.size>1)return null;let o;if(s&&i){if(o=od(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&&!sd(m,String(s),r))return null;if(i&&!sd(m,String(i),r))return null;for(let b of t)if(!sd(m,String(b),r))return!1;return!0}let a,l,c,u,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,g=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(u=u||m.operator===">"||m.operator===">=",c=c||m.operator==="<"||m.operator==="<=",s){if(g){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===g.major&&m.semver.minor===g.minor&&m.semver.patch===g.patch)g=!1}if(m.operator===">"||m.operator===">="){if(a=g$(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=y$(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&&u&&!s&&o!==0)return!1;if(g||p)return!1;return!0},g$=(e,t,r)=>{if(!e)return t;let n=od(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},y$=(e,t,r)=>{if(!e)return t;let n=od(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};b$.exports=VI});var v$=C(function($K,$$){var Ji=Mi(),zl=Ii(),UI=_t(),Gl=Kf(),zI=ss(),GI=Vb(),KI=Wb(),YI=Gb(),XI=Xb(),ZI=Qb(),QI=tx(),eM=nx(),tM=ix(),rM=jr(),nM=cx(),sM=fx(),iM=Dl(),oM=hx(),aM=yx(),lM=Go(),cM=Ll(),uM=Xf(),fM=Zf(),dM=Fl(),pM=ql(),mM=Qf(),hM=jx(),gM=Rx(),yM=Yo(),bM=kr(),xM=Zo(),$M=Wx(),vM=zx(),wM=Kx(),SM=Zx(),EM=e$(),PM=Ul(),jM=o$(),kM=l$(),_M=f$(),RM=p$(),AM=x$();$$.exports={parse:zI,valid:GI,clean:KI,inc:YI,diff:XI,major:ZI,minor:QI,patch:eM,prerelease:tM,compare:rM,rcompare:nM,compareLoose:sM,compareBuild:iM,sort:oM,rsort:aM,gt:lM,lt:cM,eq:uM,neq:fM,gte:dM,lte:pM,cmp:mM,coerce:hM,truncate:gM,Comparator:yM,Range:bM,satisfies:xM,toComparators:$M,maxSatisfying:vM,minSatisfying:wM,minVersion:SM,validRange:EM,outside:PM,gtr:jM,ltr:kM,intersects:_M,simplifyRange:RM,subset:AM,SemVer:UI,re:Ji.re,src:Ji.src,tokens:Ji.t,SEMVER_SPEC_VERSION:zl.SEMVER_SPEC_VERSION,RELEASE_TYPES:zl.RELEASE_TYPES,compareIdentifiers:Gl.compareIdentifiers,rcompareIdentifiers:Gl.rcompareIdentifiers}});var Dn;var Kl=H(()=>{Dn={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 Qo}from"node:child_process";import{createHash as CM}from"node:crypto";var ea,ld,NM,S$,TM,cd,IM=(e)=>{if(e instanceof Error)console.error(`sharp: Installation error: ${e.message}`);else console.log(`sharp: ${e}`)},E$=()=>ld.default.isNonGlibcLinuxSync()?ld.default.familySync():"",MM=()=>`${process.platform}${E$()}-${process.arch}`,Di=()=>{if(P$())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r==="string"?r:E$();return`${t||process.platform}${n}-${e||process.arch}`},JM=()=>{try{return De(`@img/sharp-libvips-dev-${Di()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},DM=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},LM=()=>{try{return De(`@img/sharp-libvips-dev-${Di()}/lib`)}catch{try{return De(`@img/sharp-libvips-${Di()}/lib`)}catch{}}return""},FM=()=>{if(process.release?.name==="node"&&process.versions){if(!ea.default.satisfies(process.versions.node,Dn.engines.node))return{found:process.versions.node,expected:Dn.engines.node}}},P$=()=>{let{CC:e}=process.env;return Boolean(e?.endsWith("/emcc"))},qM=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(Qo("sysctl sysctl.proc_translated",cd).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},w$=(e)=>CM("sha512").update(e).digest("hex"),HM=()=>{try{let e=w$(`imgsharp-libvips-${Di()}`),t=ea.default.coerce(Dn.optionalDependencies[`@img/sharp-libvips-${Di()}`],{includePrerelease:!0}).version;return w$(`${e}npm:${t}`).slice(0,10)}catch{}return""},VM=()=>Qo(`node-gyp rebuild --directory=src ${P$()?"--nodedir=emscripten":""}`,{...cd,stdio:"inherit"}).status,j$=()=>{if(process.platform!=="win32")return(Qo("pkg-config --modversion vips-cpp",{...cd,env:{...process.env,PKG_CONFIG_PATH:k$()}}).stdout||"").trim();else return""},BM=()=>{try{let e=(Qo("brew",["--prefix"],{encoding:"utf8"}).stdout||"").trim();if(e)return`${e}/lib/pkgconfig`}catch(e){}return},WM=()=>{try{let e=(Qo("pkg-config",["--variable","pc_path","pkg-config"],{encoding:"utf8"}).stdout||"").trim();if(e)return e}catch(e){}return},k$=()=>{if(process.platform!=="win32")return[BM(),WM(),process.env.PKG_CONFIG_PATH].filter(Boolean).join(":");else return""},ad=(e,t,r)=>{if(r)r(`Detected ${t}, skipping search for globally-installed libvips`);return e},UM=(e)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return ad(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return ad(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(qM())return ad(!1,"Rosetta",e);let t=j$();return!!t&&ea.default.gte(t,S$)},Yl;var ud=H(()=>{Kl();ea=Yt(v$(),1),ld=Yt(Cl(),1);/*!
375
+ */f={defined:aw,object:aM,plainObject:lM,fn:cM,bool:uM,buffer:fM,typedArray:dM,arrayBuffer:pM,string:mM,number:hM,integer:gM,inRange:yM,inArray:bM,invalidParameterError:xM,nativeError:$M}});var uw=N(function(tte,cw){var lw=()=>process.platform==="linux",Fu=null,wM=()=>{if(!Fu)if(lw()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,Fu=process.report.getReport(),process.report.excludeNetwork=e}else Fu={};return Fu};cw.exports={isLinux:lw,getReport:wM}});var dw=N(function(rte,fw){var Xr=He("fs"),vM=(e)=>{let t=Xr.openSync(e,"r"),r=Buffer.alloc(2048),n=Xr.readSync(t,r,0,2048,0);return Xr.close(t,()=>{}),r.subarray(0,n)},SM=(e)=>new Promise((t,r)=>{Xr.open(e,"r",(n,s)=>{if(n)r(n);else{let i=Buffer.alloc(2048);Xr.read(s,i,0,2048,0,(o,a)=>{t(i.subarray(0,a)),Xr.close(s,()=>{})})}})});fw.exports={LDD_PATH:"/usr/bin/ldd",SELF_PATH:"/proc/self/exe",readFileSync:vM,readFile:SM}});var mw=N(function(nte,pw){var EM=(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};pw.exports={interpreterPath:EM}});var Wu=N(function(ste,Rw){var qu=He("child_process"),{isLinux:ra,getReport:gw}=uw(),{LDD_PATH:Vu,SELF_PATH:yw,readFile:Fm,readFileSync:qm}=dw(),{interpreterPath:bw}=mw(),Cn,Nn,Tn,Ks="",xw=()=>{if(!Ks)return new Promise((e)=>{qu.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{Ks=t?" ":r,e(Ks)})});return Ks},$w=()=>{if(!Ks)try{Ks=qu.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){Ks=" "}return Ks},Es="glibc",ww=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,no="musl",PM=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),vw=()=>{let e=gw();if(e.header&&e.header.glibcVersionRuntime)return Es;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(PM))return no}return null},Sw=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(Es))return Es;if(r&&r.includes(no))return no;return null},Ew=(e)=>{if(e){if(e.includes("/ld-musl-"))return no;else if(e.includes("/ld-linux-"))return Es}return null},Pw=(e)=>{if(e=e.toString(),e.includes("musl"))return no;if(e.includes("GNU C Library"))return Es;return null},jM=async()=>{if(Nn!==void 0)return Nn;Nn=null;try{let e=await Fm(Vu);Nn=Pw(e)}catch(e){}return Nn},kM=()=>{if(Nn!==void 0)return Nn;Nn=null;try{let e=qm(Vu);Nn=Pw(e)}catch(e){}return Nn},_M=async()=>{if(Cn!==void 0)return Cn;Cn=null;try{let e=await Fm(yw),t=bw(e);Cn=Ew(t)}catch(e){}return Cn},AM=()=>{if(Cn!==void 0)return Cn;Cn=null;try{let e=qm(yw),t=bw(e);Cn=Ew(t)}catch(e){}return Cn},jw=async()=>{let e=null;if(ra()){if(e=await _M(),!e){if(e=await jM(),!e)e=vw();if(!e){let t=await xw();e=Sw(t)}}}return e},kw=()=>{let e=null;if(ra()){if(e=AM(),!e){if(e=kM(),!e)e=vw();if(!e){let t=$w();e=Sw(t)}}}return e},RM=async()=>ra()&&await jw()!==Es,OM=()=>ra()&&kw()!==Es,CM=async()=>{if(Tn!==void 0)return Tn;Tn=null;try{let t=(await Fm(Vu)).match(ww);if(t)Tn=t[1]}catch(e){}return Tn},NM=()=>{if(Tn!==void 0)return Tn;Tn=null;try{let t=qm(Vu).match(ww);if(t)Tn=t[1]}catch(e){}return Tn},_w=()=>{let e=gw();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},hw=(e)=>e.trim().split(/\s+/)[1],Aw=(e)=>{let[t,r,n]=e.split(/[\r\n]+/);if(t&&t.includes(Es))return hw(t);if(r&&n&&r.includes(no))return hw(n);return null},TM=async()=>{let e=null;if(ra()){if(e=await CM(),!e)e=_w();if(!e){let t=await xw();e=Aw(t)}}return e},IM=()=>{let e=null;if(ra()){if(e=NM(),!e)e=_w();if(!e){let t=$w();e=Aw(t)}}return e};Rw.exports={GLIBC:Es,MUSL:no,family:jw,familySync:kw,isNonGlibcLinux:RM,isNonGlibcLinuxSync:OM,version:TM,versionSync:IM}});var na=N(function(ite,Ow){var JM=Number.MAX_SAFE_INTEGER||9007199254740991,MM=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ow.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:JM,RELEASE_TYPES:MM,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var _l=N(function(ote,Cw){var DM=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Cw.exports=DM});var sa=N(function(In,Nw){var{MAX_SAFE_COMPONENT_LENGTH:Vm,MAX_SAFE_BUILD_LENGTH:LM,MAX_LENGTH:FM}=na(),qM=_l();In=Nw.exports={};var VM=In.re=[],WM=In.safeRe=[],te=In.src=[],HM=In.safeSrc=[],re=In.t={},BM=0,Wm="[a-zA-Z0-9-]",UM=[["\\s",1],["\\d",FM],[Wm,LM]],zM=(e)=>{for(let[t,r]of UM)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Se=(e,t,r)=>{let n=zM(t),s=BM++;qM(e,s,t),re[e]=s,te[s]=t,HM[s]=n,VM[s]=new RegExp(t,r?"g":void 0),WM[s]=new RegExp(n,r?"g":void 0)};Se("NUMERICIDENTIFIER","0|[1-9]\\d*");Se("NUMERICIDENTIFIERLOOSE","\\d+");Se("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Wm}*`);Se("MAINVERSION",`(${te[re.NUMERICIDENTIFIER]})\\.(${te[re.NUMERICIDENTIFIER]})\\.(${te[re.NUMERICIDENTIFIER]})`);Se("MAINVERSIONLOOSE",`(${te[re.NUMERICIDENTIFIERLOOSE]})\\.(${te[re.NUMERICIDENTIFIERLOOSE]})\\.(${te[re.NUMERICIDENTIFIERLOOSE]})`);Se("PRERELEASEIDENTIFIER",`(?:${te[re.NONNUMERICIDENTIFIER]}|${te[re.NUMERICIDENTIFIER]})`);Se("PRERELEASEIDENTIFIERLOOSE",`(?:${te[re.NONNUMERICIDENTIFIER]}|${te[re.NUMERICIDENTIFIERLOOSE]})`);Se("PRERELEASE",`(?:-(${te[re.PRERELEASEIDENTIFIER]}(?:\\.${te[re.PRERELEASEIDENTIFIER]})*))`);Se("PRERELEASELOOSE",`(?:-?(${te[re.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${te[re.PRERELEASEIDENTIFIERLOOSE]})*))`);Se("BUILDIDENTIFIER",`${Wm}+`);Se("BUILD",`(?:\\+(${te[re.BUILDIDENTIFIER]}(?:\\.${te[re.BUILDIDENTIFIER]})*))`);Se("FULLPLAIN",`v?${te[re.MAINVERSION]}${te[re.PRERELEASE]}?${te[re.BUILD]}?`);Se("FULL",`^${te[re.FULLPLAIN]}$`);Se("LOOSEPLAIN",`[v=\\s]*${te[re.MAINVERSIONLOOSE]}${te[re.PRERELEASELOOSE]}?${te[re.BUILD]}?`);Se("LOOSE",`^${te[re.LOOSEPLAIN]}$`);Se("GTLT","((?:<|>)?=?)");Se("XRANGEIDENTIFIERLOOSE",`${te[re.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Se("XRANGEIDENTIFIER",`${te[re.NUMERICIDENTIFIER]}|x|X|\\*`);Se("XRANGEPLAIN",`[v=\\s]*(${te[re.XRANGEIDENTIFIER]})(?:\\.(${te[re.XRANGEIDENTIFIER]})(?:\\.(${te[re.XRANGEIDENTIFIER]})(?:${te[re.PRERELEASE]})?${te[re.BUILD]}?)?)?`);Se("XRANGEPLAINLOOSE",`[v=\\s]*(${te[re.XRANGEIDENTIFIERLOOSE]})(?:\\.(${te[re.XRANGEIDENTIFIERLOOSE]})(?:\\.(${te[re.XRANGEIDENTIFIERLOOSE]})(?:${te[re.PRERELEASELOOSE]})?${te[re.BUILD]}?)?)?`);Se("XRANGE",`^${te[re.GTLT]}\\s*${te[re.XRANGEPLAIN]}$`);Se("XRANGELOOSE",`^${te[re.GTLT]}\\s*${te[re.XRANGEPLAINLOOSE]}$`);Se("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Vm}})(?:\\.(\\d{1,${Vm}}))?(?:\\.(\\d{1,${Vm}}))?`);Se("COERCE",`${te[re.COERCEPLAIN]}(?:$|[^\\d])`);Se("COERCEFULL",te[re.COERCEPLAIN]+`(?:${te[re.PRERELEASE]})?(?:${te[re.BUILD]})?(?:$|[^\\d])`);Se("COERCERTL",te[re.COERCE],!0);Se("COERCERTLFULL",te[re.COERCEFULL],!0);Se("LONETILDE","(?:~>?)");Se("TILDETRIM",`(\\s*)${te[re.LONETILDE]}\\s+`,!0);In.tildeTrimReplace="$1~";Se("TILDE",`^${te[re.LONETILDE]}${te[re.XRANGEPLAIN]}$`);Se("TILDELOOSE",`^${te[re.LONETILDE]}${te[re.XRANGEPLAINLOOSE]}$`);Se("LONECARET","(?:\\^)");Se("CARETTRIM",`(\\s*)${te[re.LONECARET]}\\s+`,!0);In.caretTrimReplace="$1^";Se("CARET",`^${te[re.LONECARET]}${te[re.XRANGEPLAIN]}$`);Se("CARETLOOSE",`^${te[re.LONECARET]}${te[re.XRANGEPLAINLOOSE]}$`);Se("COMPARATORLOOSE",`^${te[re.GTLT]}\\s*(${te[re.LOOSEPLAIN]})$|^$`);Se("COMPARATOR",`^${te[re.GTLT]}\\s*(${te[re.FULLPLAIN]})$|^$`);Se("COMPARATORTRIM",`(\\s*)${te[re.GTLT]}\\s*(${te[re.LOOSEPLAIN]}|${te[re.XRANGEPLAIN]})`,!0);In.comparatorTrimReplace="$1$2$3";Se("HYPHENRANGE",`^\\s*(${te[re.XRANGEPLAIN]})\\s+-\\s+(${te[re.XRANGEPLAIN]})\\s*$`);Se("HYPHENRANGELOOSE",`^\\s*(${te[re.XRANGEPLAINLOOSE]})\\s+-\\s+(${te[re.XRANGEPLAINLOOSE]})\\s*$`);Se("STAR","(<|>)?=?\\s*\\*");Se("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Se("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Hu=N(function(ate,Tw){var GM=Object.freeze({loose:!0}),KM=Object.freeze({}),YM=(e)=>{if(!e)return KM;if(typeof e!=="object")return GM;return e};Tw.exports=YM});var Hm=N(function(lte,Mw){var Iw=/^[0-9]+$/,Jw=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Iw.test(e),n=Iw.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},XM=(e,t)=>Jw(t,e);Mw.exports={compareIdentifiers:Jw,rcompareIdentifiers:XM}});var Ht=N(function(cte,Lw){var Bu=_l(),{MAX_LENGTH:Dw,MAX_SAFE_INTEGER:Uu}=na(),{safeRe:zu,t:Gu}=sa(),ZM=Hu(),{compareIdentifiers:Bm}=Hm(),QM=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Bm(e[n],r[n])!==0)return!1;return!0};class bn{constructor(e,t){if(t=ZM(t),e instanceof bn)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>Dw)throw TypeError(`version is longer than ${Dw} characters`);Bu("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?zu[Gu.LOOSE]:zu[Gu.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>Uu||this.major<0)throw TypeError("Invalid major version");if(this.minor>Uu||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Uu||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<Uu)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(Bu("SemVer.compare",this.version,this.options,e),!(e instanceof bn)){if(typeof e==="string"&&e===this.version)return 0;e=new bn(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof bn))e=new bn(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 bn))e=new bn(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(Bu("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 Bm(r,n)}while(++t)}compareBuild(e){if(!(e instanceof bn))e=new bn(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(Bu("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 Bm(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?zu[Gu.PRERELEASELOOSE]:zu[Gu.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(QM(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}}Lw.exports=bn});var Ys=N(function(ute,qw){var Fw=Ht(),eD=(e,t,r=!1)=>{if(e instanceof Fw)return e;try{return new Fw(e,t)}catch(n){if(!r)return null;throw n}};qw.exports=eD});var Ww=N(function(fte,Vw){var tD=Ys(),rD=(e,t)=>{let r=tD(e,t);return r?r.version:null};Vw.exports=rD});var Bw=N(function(dte,Hw){var nD=Ys(),sD=(e,t)=>{let r=nD(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Hw.exports=sD});var Gw=N(function(pte,zw){var Uw=Ht(),iD=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new Uw(e instanceof Uw?e.version:e,r).inc(t,n,s).version}catch(i){return null}};zw.exports=iD});var Xw=N(function(mte,Yw){var Kw=Ys(),oD=(e,t)=>{let r=Kw(e,null,!0),n=Kw(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 u=l?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};Yw.exports=oD});var Qw=N(function(hte,Zw){var aD=Ht(),lD=(e,t)=>new aD(e,t).major;Zw.exports=lD});var tv=N(function(gte,ev){var cD=Ht(),uD=(e,t)=>new cD(e,t).minor;ev.exports=uD});var nv=N(function(yte,rv){var fD=Ht(),dD=(e,t)=>new fD(e,t).patch;rv.exports=dD});var iv=N(function(bte,sv){var pD=Ys(),mD=(e,t)=>{let r=pD(e,t);return r&&r.prerelease.length?r.prerelease:null};sv.exports=mD});var Zr=N(function(xte,av){var ov=Ht(),hD=(e,t,r)=>new ov(e,r).compare(new ov(t,r));av.exports=hD});var cv=N(function($te,lv){var gD=Zr(),yD=(e,t,r)=>gD(t,e,r);lv.exports=yD});var fv=N(function(wte,uv){var bD=Zr(),xD=(e,t)=>bD(e,t,!0);uv.exports=xD});var Ku=N(function(vte,pv){var dv=Ht(),$D=(e,t,r)=>{let n=new dv(e,r),s=new dv(t,r);return n.compare(s)||n.compareBuild(s)};pv.exports=$D});var hv=N(function(Ste,mv){var wD=Ku(),vD=(e,t)=>e.sort((r,n)=>wD(r,n,t));mv.exports=vD});var yv=N(function(Ete,gv){var SD=Ku(),ED=(e,t)=>e.sort((r,n)=>SD(n,r,t));gv.exports=ED});var Al=N(function(Pte,bv){var PD=Zr(),jD=(e,t,r)=>PD(e,t,r)>0;bv.exports=jD});var Yu=N(function(jte,xv){var kD=Zr(),_D=(e,t,r)=>kD(e,t,r)<0;xv.exports=_D});var Um=N(function(kte,$v){var AD=Zr(),RD=(e,t,r)=>AD(e,t,r)===0;$v.exports=RD});var zm=N(function(_te,wv){var OD=Zr(),CD=(e,t,r)=>OD(e,t,r)!==0;wv.exports=CD});var Xu=N(function(Ate,vv){var ND=Zr(),TD=(e,t,r)=>ND(e,t,r)>=0;vv.exports=TD});var Zu=N(function(Rte,Sv){var ID=Zr(),JD=(e,t,r)=>ID(e,t,r)<=0;Sv.exports=JD});var Gm=N(function(Ote,Ev){var MD=Um(),DD=zm(),LD=Al(),FD=Xu(),qD=Yu(),VD=Zu(),WD=(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 MD(e,r,n);case"!=":return DD(e,r,n);case">":return LD(e,r,n);case">=":return FD(e,r,n);case"<":return qD(e,r,n);case"<=":return VD(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};Ev.exports=WD});var jv=N(function(Cte,Pv){var HD=Ht(),BD=Ys(),{safeRe:Qu,t:ef}=sa(),UD=(e,t)=>{if(e instanceof HD)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?Qu[ef.COERCEFULL]:Qu[ef.COERCE]);else{let l=t.includePrerelease?Qu[ef.COERCERTLFULL]:Qu[ef.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 BD(`${n}.${s}.${i}${o}${a}`,t)};Pv.exports=UD});var Av=N(function(Nte,_v){var zD=Ys(),kv=na(),GD=Ht(),KD=(e,t,r)=>{if(!kv.RELEASE_TYPES.includes(t))return null;let n=YD(e,r);return n&&XD(n,t)},YD=(e,t)=>{let r=e instanceof GD?e.version:e;return zD(r,t)},XD=(e,t)=>{if(ZD(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()},ZD=(e)=>e.startsWith("pre");_v.exports=KD});var Cv=N(function(Tte,Ov){class Rv{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}}Ov.exports=Rv});var Qr=N(function(Ite,Jv){var QD=/\s+/g;class Rl{constructor(e,t){if(t=tL(t),e instanceof Rl)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new Rl(e.raw,t);if(e instanceof tf)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(QD," "),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)=>!Tv(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&&uL(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(cL,"");let r=((this.options.includePrerelease&&aL)|(this.options.loose&&lL))+":"+e,n=Nv.get(r);if(n)return n;let s=this.options.loose,i=s?fr[Bt.HYPHENRANGELOOSE]:fr[Bt.HYPHENRANGE];e=e.replace(i,wL(this.options.includePrerelease)),st("hyphen replace",e),e=e.replace(fr[Bt.COMPARATORTRIM],sL),st("comparator trim",e),e=e.replace(fr[Bt.TILDETRIM],iL),st("tilde trim",e),e=e.replace(fr[Bt.CARETTRIM],oL),st("caret trim",e);let o=e.split(" ").map((u)=>fL(u,this.options)).join(" ").split(/\s+/).map((u)=>$L(u,this.options));if(s)o=o.filter((u)=>(st("loose invalid filter",u,this.options),!!u.match(fr[Bt.COMPARATORLOOSE])));st("range list",o);let a=new Map,l=o.map((u)=>new tf(u,this.options));for(let u of l){if(Tv(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return Nv.set(r,c),c}intersects(e,t){if(!(e instanceof Rl))throw TypeError("a Range is required");return this.set.some((r)=>Iv(r,t)&&e.set.some((n)=>Iv(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 rL(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(vL(this.set[t],e,this.options))return!0;return!1}}Jv.exports=Rl;var eL=Cv(),Nv=new eL,tL=Hu(),tf=Ol(),st=_l(),rL=Ht(),{safeRe:fr,src:nL,t:Bt,comparatorTrimReplace:sL,tildeTrimReplace:iL,caretTrimReplace:oL}=sa(),{FLAG_INCLUDE_PRERELEASE:aL,FLAG_LOOSE:lL}=na(),cL=new RegExp(nL[Bt.BUILD],"g"),Tv=(e)=>e.value==="<0.0.0-0",uL=(e)=>e.value==="",Iv=(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},fL=(e,t)=>(e=e.replace(fr[Bt.BUILD],""),st("comp",e,t),e=hL(e,t),st("caret",e),e=pL(e,t),st("tildes",e),e=yL(e,t),st("xrange",e),e=xL(e,t),st("stars",e),e),It=(e)=>!e||e.toLowerCase()==="x"||e==="*",dL=(e,t,r)=>It(e)&&!It(t)||It(t)&&r&&!It(r),pL=(e,t)=>e.trim().split(/\s+/).map((r)=>mL(r,t)).join(" "),mL=(e,t)=>{let r=t.loose?fr[Bt.TILDELOOSE]:fr[Bt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{st("tilde",e,s,i,o,a,l);let c;if(It(i))c="";else if(It(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(It(a))c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else if(l)st("replaceTilde pr",l),c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;return st("tilde return",c),c})},hL=(e,t)=>e.trim().split(/\s+/).map((r)=>gL(r,t)).join(" "),gL=(e,t)=>{st("caret",e,t);let r=t.loose?fr[Bt.CARETLOOSE]:fr[Bt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{st("caret",e,s,i,o,a,l);let c;if(It(i))c="";else if(It(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(It(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(st("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(st("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 st("caret return",c),c})},yL=(e,t)=>(st("replaceXRanges",e,t),e.split(/\s+/).map((r)=>bL(r,t)).join(" ")),bL=(e,t)=>{e=e.trim();let r=t.loose?fr[Bt.XRANGELOOSE]:fr[Bt.XRANGE];return e.replace(r,(n,s,i,o,a,l)=>{if(st("xRange",e,n,s,i,o,a,l),dL(i,o,a))return e;let c=It(i),u=c||It(o),p=u||It(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(u)o=0;if(a=0,s===">")if(s=">=",u)i=+i+1,o=0,a=0;else o=+o+1,a=0;else if(s==="<=")if(s="<",u)i=+i+1;else o=+o+1;if(s==="<")l="-0";n=`${s+i}.${o}.${a}${l}`}else if(u)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(p)n=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`;return st("xRange return",n),n})},xL=(e,t)=>(st("replaceStars",e,t),e.trim().replace(fr[Bt.STAR],"")),$L=(e,t)=>(st("replaceGTE0",e,t),e.trim().replace(fr[t.includePrerelease?Bt.GTE0PRE:Bt.GTE0],"")),wL=(e)=>(t,r,n,s,i,o,a,l,c,u,p,h)=>{if(It(n))r="";else if(It(s))r=`>=${n}.0.0${e?"-0":""}`;else if(It(i))r=`>=${n}.${s}.0${e?"-0":""}`;else if(o)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(It(c))l="";else if(It(u))l=`<${+c+1}.0.0-0`;else if(It(p))l=`<${c}.${+u+1}.0-0`;else if(h)l=`<=${c}.${u}.${p}-${h}`;else if(e)l=`<${c}.${u}.${+p+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},vL=(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(st(e[n].semver),e[n].semver===tf.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 Ol=N(function(Jte,Vv){var Cl=Symbol("SemVer ANY");class rf{static get ANY(){return Cl}constructor(e,t){if(t=Mv(t),e instanceof rf)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Ym("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Cl)this.value="";else this.value=this.operator+this.semver.version;Ym("comp",this)}parse(e){let t=this.options.loose?Dv[Lv.COMPARATORLOOSE]:Dv[Lv.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=Cl;else this.semver=new Fv(r[2],this.options.loose)}toString(){return this.value}test(e){if(Ym("Comparator.test",e,this.options.loose),this.semver===Cl||e===Cl)return!0;if(typeof e==="string")try{e=new Fv(e,this.options)}catch(t){return!1}return Km(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof rf))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new qv(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new qv(this.value,t).test(e.semver)}if(t=Mv(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(Km(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Km(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}Vv.exports=rf;var Mv=Hu(),{safeRe:Dv,t:Lv}=sa(),Km=Gm(),Ym=_l(),Fv=Ht(),qv=Qr()});var Nl=N(function(Mte,Wv){var SL=Qr(),EL=(e,t,r)=>{try{t=new SL(t,r)}catch(n){return!1}return t.test(e)};Wv.exports=EL});var Bv=N(function(Dte,Hv){var PL=Qr(),jL=(e,t)=>new PL(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));Hv.exports=jL});var zv=N(function(Lte,Uv){var kL=Ht(),_L=Qr(),AL=(e,t,r)=>{let n=null,s=null,i=null;try{i=new _L(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===-1)n=o,s=new kL(n,r)}}),n};Uv.exports=AL});var Kv=N(function(Fte,Gv){var RL=Ht(),OL=Qr(),CL=(e,t,r)=>{let n=null,s=null,i=null;try{i=new OL(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===1)n=o,s=new RL(n,r)}}),n};Gv.exports=CL});var Zv=N(function(qte,Xv){var Xm=Ht(),NL=Qr(),Yv=Al(),TL=(e,t)=>{e=new NL(e,t);let r=new Xm("0.0.0");if(e.test(r))return r;if(r=new Xm("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 Xm(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||Yv(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||Yv(r,i)))r=i}if(r&&e.test(r))return r;return null};Xv.exports=TL});var eS=N(function(Vte,Qv){var IL=Qr(),JL=(e,t)=>{try{return new IL(e,t).range||"*"}catch(r){return null}};Qv.exports=JL});var nf=N(function(Wte,sS){var ML=Ht(),nS=Ol(),{ANY:DL}=nS,LL=Qr(),FL=Nl(),tS=Al(),rS=Yu(),qL=Zu(),VL=Xu(),WL=(e,t,r,n)=>{e=new ML(e,n),t=new LL(t,n);let s,i,o,a,l;switch(r){case">":s=tS,i=qL,o=rS,a=">",l=">=";break;case"<":s=rS,i=VL,o=tS,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(FL(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let u=t.set[c],p=null,h=null;if(u.forEach((m)=>{if(m.semver===DL)m=new nS(">=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};sS.exports=WL});var oS=N(function(Hte,iS){var HL=nf(),BL=(e,t,r)=>HL(e,t,">",r);iS.exports=BL});var lS=N(function(Bte,aS){var UL=nf(),zL=(e,t,r)=>UL(e,t,"<",r);aS.exports=zL});var fS=N(function(Ute,uS){var cS=Qr(),GL=(e,t,r)=>(e=new cS(e,r),t=new cS(t,r),e.intersects(t,r));uS.exports=GL});var pS=N(function(zte,dS){var KL=Nl(),YL=Zr();dS.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((u,p)=>YL(u,p,r));for(let u of o)if(KL(u,t,r)){if(i=u,!s)s=u}else{if(i)n.push([s,i]);i=null,s=null}if(s)n.push([s,null]);let a=[];for(let[u,p]of n)if(u===p)a.push(u);else if(!p&&u===o[0])a.push("*");else if(!p)a.push(`>=${u}`);else if(u===o[0])a.push(`<=${p}`);else a.push(`${u} - ${p}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var xS=N(function(Gte,bS){var mS=Qr(),eh=Ol(),{ANY:Zm}=eh,Qm=Nl(),th=Zr(),XL=(e,t,r={})=>{if(e===t)return!0;e=new mS(e,r),t=new mS(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=QL(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},ZL=[new eh(">=0.0.0-0")],hS=[new eh(">=0.0.0")],QL=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Zm)if(t.length===1&&t[0].semver===Zm)return!0;else if(r.includePrerelease)e=ZL;else e=hS;if(t.length===1&&t[0].semver===Zm)if(r.includePrerelease)return!0;else t=hS;let n=new Set,s,i;for(let m of e)if(m.operator===">"||m.operator===">=")s=gS(s,m,r);else if(m.operator==="<"||m.operator==="<=")i=yS(i,m,r);else n.add(m.semver);if(n.size>1)return null;let o;if(s&&i){if(o=th(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&&!Qm(m,String(s),r))return null;if(i&&!Qm(m,String(i),r))return null;for(let b of t)if(!Qm(m,String(b),r))return!1;return!0}let a,l,c,u,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(u=u||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=gS(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=yS(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&&u&&!s&&o!==0)return!1;if(h||p)return!1;return!0},gS=(e,t,r)=>{if(!e)return t;let n=th(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},yS=(e,t,r)=>{if(!e)return t;let n=th(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};bS.exports=XL});var wS=N(function(Kte,$S){var ia=sa(),sf=na(),eF=Ht(),of=Hm(),tF=Ys(),rF=Ww(),nF=Bw(),sF=Gw(),iF=Xw(),oF=Qw(),aF=tv(),lF=nv(),cF=iv(),uF=Zr(),fF=cv(),dF=fv(),pF=Ku(),mF=hv(),hF=yv(),gF=Al(),yF=Yu(),bF=Um(),xF=zm(),$F=Xu(),wF=Zu(),vF=Gm(),SF=jv(),EF=Av(),PF=Ol(),jF=Qr(),kF=Nl(),_F=Bv(),AF=zv(),RF=Kv(),OF=Zv(),CF=eS(),NF=nf(),TF=oS(),IF=lS(),JF=fS(),MF=pS(),DF=xS();$S.exports={parse:tF,valid:rF,clean:nF,inc:sF,diff:iF,major:oF,minor:aF,patch:lF,prerelease:cF,compare:uF,rcompare:fF,compareLoose:dF,compareBuild:pF,sort:mF,rsort:hF,gt:gF,lt:yF,eq:bF,neq:xF,gte:$F,lte:wF,cmp:vF,coerce:SF,truncate:EF,Comparator:PF,Range:jF,satisfies:kF,toComparators:_F,maxSatisfying:AF,minSatisfying:RF,minVersion:OF,validRange:CF,outside:NF,gtr:TF,ltr:IF,intersects:JF,simplifyRange:MF,subset:DF,SemVer:eF,re:ia.re,src:ia.src,tokens:ia.t,SEMVER_SPEC_VERSION:sf.SEMVER_SPEC_VERSION,RELEASE_TYPES:sf.RELEASE_TYPES,compareIdentifiers:of.compareIdentifiers,rcompareIdentifiers:of.rcompareIdentifiers}});var Ps;var af=D(()=>{Ps={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 Tl}from"node:child_process";import{createHash as FF}from"node:crypto";var Il,nh,qF,SS,VF,sh,WF=(e)=>{if(e instanceof Error)console.error(`sharp: Installation error: ${e.message}`);else console.log(`sharp: ${e}`)},ES=()=>nh.default.isNonGlibcLinuxSync()?nh.default.familySync():"",HF=()=>`${process.platform}${ES()}-${process.arch}`,oa=()=>{if(PS())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r==="string"?r:ES();return`${t||process.platform}${n}-${e||process.arch}`},BF=()=>{try{return He(`@img/sharp-libvips-dev-${oa()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},UF=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},zF=()=>{try{return He(`@img/sharp-libvips-dev-${oa()}/lib`)}catch{try{return He(`@img/sharp-libvips-${oa()}/lib`)}catch{}}return""},GF=()=>{if(process.release?.name==="node"&&process.versions){if(!Il.default.satisfies(process.versions.node,Ps.engines.node))return{found:process.versions.node,expected:Ps.engines.node}}},PS=()=>{let{CC:e}=process.env;return Boolean(e?.endsWith("/emcc"))},KF=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(Tl("sysctl sysctl.proc_translated",sh).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},vS=(e)=>FF("sha512").update(e).digest("hex"),YF=()=>{try{let e=vS(`imgsharp-libvips-${oa()}`),t=Il.default.coerce(Ps.optionalDependencies[`@img/sharp-libvips-${oa()}`],{includePrerelease:!0}).version;return vS(`${e}npm:${t}`).slice(0,10)}catch{}return""},XF=()=>Tl(`node-gyp rebuild --directory=src ${PS()?"--nodedir=emscripten":""}`,{...sh,stdio:"inherit"}).status,jS=()=>{if(process.platform!=="win32")return(Tl("pkg-config --modversion vips-cpp",{...sh,env:{...process.env,PKG_CONFIG_PATH:kS()}}).stdout||"").trim();else return""},ZF=()=>{try{let e=(Tl("brew",["--prefix"],{encoding:"utf8"}).stdout||"").trim();if(e)return`${e}/lib/pkgconfig`}catch(e){}return},QF=()=>{try{let e=(Tl("pkg-config",["--variable","pc_path","pkg-config"],{encoding:"utf8"}).stdout||"").trim();if(e)return e}catch(e){}return},kS=()=>{if(process.platform!=="win32")return[ZF(),QF(),process.env.PKG_CONFIG_PATH].filter(Boolean).join(":");else return""},rh=(e,t,r)=>{if(r)r(`Detected ${t}, skipping search for globally-installed libvips`);return e},e5=(e)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return rh(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return rh(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(KF())return rh(!1,"Rosetta",e);let t=jS();return!!t&&Il.default.gte(t,SS)},lf;var ih=D(()=>{af();Il=gr(wS(),1),nh=gr(Wu(),1);/*!
332
376
  Copyright 2013 Lovell Fuller and others.
333
377
  SPDX-License-Identifier: Apache-2.0
334
- */NM=process.env.npm_package_config_libvips||Dn.config.libvips,S$=ea.default.coerce(NM).version,TM=["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"],cd={encoding:"utf8",shell:!0},Yl={minimumLibvipsVersion:S$,prebuiltPlatforms:TM,buildPlatformArch:Di,buildSharpLibvipsIncludeDir:JM,buildSharpLibvipsCPlusPlusDir:DM,buildSharpLibvipsLibDir:LM,isUnsupportedNodeRuntime:FM,runtimePlatformArch:MM,log:IM,yarnLocator:HM,spawnRebuild:VM,globalLibvipsVersion:j$,pkgConfigPath:k$,useGlobalLibvips:UM}});import{createRequire as zM}from"node:module";var Xl,vt,R$,GM,_$,KM,YM,Ln,Be,is,Ie;var ta=H(()=>{ud();Kl();Xl=Yt(Cl(),1);/*!
378
+ */qF=process.env.npm_package_config_libvips||Ps.config.libvips,SS=Il.default.coerce(qF).version,VF=["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"],sh={encoding:"utf8",shell:!0},lf={minimumLibvipsVersion:SS,prebuiltPlatforms:VF,buildPlatformArch:oa,buildSharpLibvipsIncludeDir:BF,buildSharpLibvipsCPlusPlusDir:UF,buildSharpLibvipsLibDir:zF,isUnsupportedNodeRuntime:GF,runtimePlatformArch:HF,log:WF,yarnLocator:YF,spawnRebuild:XF,globalLibvipsVersion:jS,pkgConfigPath:kS,useGlobalLibvips:e5}});import{createRequire as t5}from"node:module";var cf,Jt,AS,r5,_S,n5,s5,js,Qe,Xs,qe;var Jl=D(()=>{ih();af();cf=gr(Wu(),1);/*!
335
379
  Copyright 2013 Lovell Fuller and others.
336
380
  SPDX-License-Identifier: Apache-2.0
337
- */vt=zM(import.meta.url),{version:R$}=Dn,{runtimePlatformArch:GM,isUnsupportedNodeRuntime:_$,prebuiltPlatforms:KM,minimumLibvipsVersion:YM}=Yl,Ln=GM(),is=[];try{Be=vt(`../src/build/Release/sharp-${Ln}-${R$}.node`)}catch(e){is.push(e)}if(!Be)try{Be=vt(`../src/build/Release/sharp-wasm32-${R$}.node`)}catch(e){is.push(e)}if(!Be)try{switch(Ln){case"darwin-arm64":Be=vt("@img/sharp-darwin-arm64/sharp.node");break;case"darwin-x64":Be=vt("@img/sharp-darwin-x64/sharp.node");break;case"linux-arm":Be=vt("@img/sharp-linux-arm/sharp.node");break;case"linux-arm64":Be=vt("@img/sharp-linux-arm64/sharp.node");break;case"linux-ppc64":Be=vt("@img/sharp-linux-ppc64/sharp.node");break;case"linux-riscv64":Be=vt("@img/sharp-linux-riscv64/sharp.node");break;case"linux-s390x":Be=vt("@img/sharp-linux-s390x/sharp.node");break;case"linux-x64":Be=vt("@img/sharp-linux-x64/sharp.node");break;case"linuxmusl-arm64":Be=vt("@img/sharp-linuxmusl-arm64/sharp.node");break;case"linuxmusl-x64":Be=vt("@img/sharp-linuxmusl-x64/sharp.node");break;case"win32-arm64":Be=vt("@img/sharp-win32-arm64/sharp.node");break;case"win32-ia32":Be=vt("@img/sharp-win32-ia32/sharp.node");break;case"win32-x64":Be=vt("@img/sharp-win32-x64/sharp.node");break;case"freebsd-arm64":case"freebsd-x64":Be=vt("@img/sharp-freebsd-wasm32/sharp.node");break;case"linux-wasm32":Be=vt("@img/sharp-webcontainers-wasm32/sharp.node");break}if(Be&&["linux-x64","linuxmusl-x64"].includes(Ln)&&!Be._isUsingX64V2()){let e=Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");e.code="Unsupported CPU",is.push(e),Be=null}if(Be&&process.versions.electron&&Ln.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){is.push(e)}if(!Be)try{Be=vt("@img/sharp-wasm32/sharp.node")}catch(e){is.push(e)}if(!Be){let[e,t,r]=["linux","darwin","win32"].map((i)=>Ln.startsWith(i)),n=[`Could not load the "sharp" module using the ${Ln} runtime`];is.forEach((i)=>{if(!i.code?.endsWith("MODULE_NOT_FOUND"))n.push(i.code?`${i.code}: ${i.message}`:i.message)});let s=is.map((i)=>i.message).join(" ");if(n.push("Possible solutions:"),_$()){let{found:i,expected:o}=_$();n.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(KM.includes(Ln)&&!/libstdc\+\+\.so/.test(s)){let[i,o]=Ln.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 >= ${YM}`," 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}=vt(`@img/sharp-libvips-${Ln}/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(is.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
- `))}Ie=Be});import XM from"node:util";import fd from"node:stream";function eJ(){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 ZM,QM=(e)=>{Qs.queue.emit("change",e)},Qs=function(e,t){if(arguments.length===1&&!f.defined(e))throw Error("Invalid input");if(!(this instanceof Qs))return new Qs(e,t);return fd.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),ZM(r)},queueListener:QM},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this},Qr;var A$=H(()=>{Gr();ta();/*!
381
+ */Jt=t5(import.meta.url),{version:AS}=Ps,{runtimePlatformArch:r5,isUnsupportedNodeRuntime:_S,prebuiltPlatforms:n5,minimumLibvipsVersion:s5}=lf,js=r5(),Xs=[];try{Qe=Jt(`../src/build/Release/sharp-${js}-${AS}.node`)}catch(e){Xs.push(e)}if(!Qe)try{Qe=Jt(`../src/build/Release/sharp-wasm32-${AS}.node`)}catch(e){Xs.push(e)}if(!Qe)try{switch(js){case"darwin-arm64":Qe=Jt("@img/sharp-darwin-arm64/sharp.node");break;case"darwin-x64":Qe=Jt("@img/sharp-darwin-x64/sharp.node");break;case"linux-arm":Qe=Jt("@img/sharp-linux-arm/sharp.node");break;case"linux-arm64":Qe=Jt("@img/sharp-linux-arm64/sharp.node");break;case"linux-ppc64":Qe=Jt("@img/sharp-linux-ppc64/sharp.node");break;case"linux-riscv64":Qe=Jt("@img/sharp-linux-riscv64/sharp.node");break;case"linux-s390x":Qe=Jt("@img/sharp-linux-s390x/sharp.node");break;case"linux-x64":Qe=Jt("@img/sharp-linux-x64/sharp.node");break;case"linuxmusl-arm64":Qe=Jt("@img/sharp-linuxmusl-arm64/sharp.node");break;case"linuxmusl-x64":Qe=Jt("@img/sharp-linuxmusl-x64/sharp.node");break;case"win32-arm64":Qe=Jt("@img/sharp-win32-arm64/sharp.node");break;case"win32-ia32":Qe=Jt("@img/sharp-win32-ia32/sharp.node");break;case"win32-x64":Qe=Jt("@img/sharp-win32-x64/sharp.node");break;case"freebsd-arm64":case"freebsd-x64":Qe=Jt("@img/sharp-freebsd-wasm32/sharp.node");break;case"linux-wasm32":Qe=Jt("@img/sharp-webcontainers-wasm32/sharp.node");break}if(Qe&&["linux-x64","linuxmusl-x64"].includes(js)&&!Qe._isUsingX64V2()){let e=Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");e.code="Unsupported CPU",Xs.push(e),Qe=null}if(Qe&&process.versions.electron&&js.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){Xs.push(e)}if(!Qe)try{Qe=Jt("@img/sharp-wasm32/sharp.node")}catch(e){Xs.push(e)}if(!Qe){let[e,t,r]=["linux","darwin","win32"].map((i)=>js.startsWith(i)),n=[`Could not load the "sharp" module using the ${js} runtime`];Xs.forEach((i)=>{if(!i.code?.endsWith("MODULE_NOT_FOUND"))n.push(i.code?`${i.code}: ${i.message}`:i.message)});let s=Xs.map((i)=>i.message).join(" ");if(n.push("Possible solutions:"),_S()){let{found:i,expected:o}=_S();n.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(n5.includes(js)&&!/libstdc\+\+\.so/.test(s)){let[i,o]=js.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 >= ${s5}`," 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}=Jt(`@img/sharp-libvips-${js}/package`),o=`${cf.familySync()} ${cf.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(Xs.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(`
382
+ `))}qe=Qe});import i5 from"node:util";import oh from"node:stream";function l5(){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 o5,a5=(e)=>{so.queue.emit("change",e)},so=function(e,t){if(arguments.length===1&&!f.defined(e))throw Error("Invalid input");if(!(this instanceof so))return new so(e,t);return oh.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),o5(r)},queueListener:a5},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this},Jn;var RS=D(()=>{On();Jl();/*!
339
383
  Copyright 2013 Lovell Fuller and others.
340
384
  SPDX-License-Identifier: Apache-2.0
341
- */ZM=XM.debuglog("sharp");Object.setPrototypeOf(Qs.prototype,fd.Duplex.prototype);Object.setPrototypeOf(Qs,fd.Duplex);Object.assign(Qs.prototype,{clone:eJ});Qr=Qs});function O$(e){let t=rJ.filter((r)=>f.defined(e[r])).map((r)=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function nJ(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,limitInputChannels:5,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(f.string(e))n.file=e;else if(f.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(f.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(f.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(f.plainObject(e)&&!f.defined(t)){if(t=e,O$(t))n.buffer=[]}else if(!f.defined(e)&&!f.defined(t)&&f.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}${f.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(f.object(t)){if(f.defined(t.failOn))if(f.string(t.failOn)&&f.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw f.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(f.defined(t.autoOrient))if(f.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw f.invalidParameterError("autoOrient","boolean",t.autoOrient);if(f.defined(t.density))if(f.number(t.density)&&f.inRange(t.density,1,1e5))n.density=t.density;else throw f.invalidParameterError("density","number between 1 and 100000",t.density);if(f.defined(t.ignoreIcc))if(f.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw f.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(f.defined(t.limitInputPixels))if(f.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?268402689:0;else if(f.integer(t.limitInputPixels)&&f.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw f.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(f.defined(t.limitInputChannels))if(f.bool(t.limitInputChannels))n.limitInputChannels=t.limitInputChannels?5:0;else if(f.integer(t.limitInputChannels)&&f.inRange(t.limitInputChannels,0,Number.MAX_SAFE_INTEGER))n.limitInputChannels=t.limitInputChannels;else throw f.invalidParameterError("limitInputChannels","positive integer",t.limitInputChannels);if(f.defined(t.unlimited))if(f.bool(t.unlimited))n.unlimited=t.unlimited;else throw f.invalidParameterError("unlimited","boolean",t.unlimited);if(f.defined(t.sequentialRead))if(f.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw f.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(f.defined(t.raw)){if(f.object(t.raw)&&f.integer(t.raw.width)&&f.inRange(t.raw.width,1,1e8)&&f.integer(t.raw.height)&&f.inRange(t.raw.height,1,1e8)&&f.integer(t.raw.channels)&&f.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,f.defined(t.raw.premultiplied))if(f.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw f.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,f.defined(t.raw.pageHeight))if(f.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 f.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(f.defined(t.animated))if(f.bool(t.animated))n.pages=t.animated?-1:1;else throw f.invalidParameterError("animated","boolean",t.animated);if(f.defined(t.pages))if(f.integer(t.pages)&&f.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw f.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(f.defined(t.page))if(f.integer(t.page)&&f.inRange(t.page,0,1e5))n.page=t.page;else throw f.invalidParameterError("page","integer between 0 and 100000",t.page);if(f.object(t.openSlide)&&f.defined(t.openSlide.level))if(f.integer(t.openSlide.level)&&f.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw f.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(f.defined(t.level))if(f.integer(t.level)&&f.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw f.invalidParameterError("level","integer between 0 and 256",t.level);if(f.object(t.tiff)&&f.defined(t.tiff.subifd))if(f.integer(t.tiff.subifd)&&f.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw f.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(f.defined(t.subifd))if(f.integer(t.subifd)&&f.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw f.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(f.object(t.svg)){if(f.defined(t.svg.stylesheet))if(f.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw f.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(f.defined(t.svg.highBitdepth))if(f.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw f.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(f.object(t.pdf)&&f.defined(t.pdf.background))n.pdfBackground=this._getBackgroundColourOption(t.pdf.background);else if(f.defined(t.pdfBackground))n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground);if(f.object(t.jp2)&&f.defined(t.jp2.oneshot))if(f.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw f.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(f.defined(t.create))if(f.object(t.create)&&f.integer(t.create.width)&&f.inRange(t.create.width,1,1e8)&&f.integer(t.create.height)&&f.inRange(t.create.height,1,1e8)&&f.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,f.defined(t.create.pageHeight))if(f.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 f.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(f.defined(t.create.noise)){if(!f.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,!f.inRange(t.create.channels,1,4))throw f.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,f.defined(t.create.noise.mean))if(f.number(t.create.noise.mean)&&f.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw f.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,f.defined(t.create.noise.sigma))if(f.number(t.create.noise.sigma)&&f.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw f.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(f.defined(t.create.background)){if(!f.inRange(t.create.channels,3,4))throw f.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(f.defined(t.text))if(f.object(t.text)&&f.string(t.text.text)){if(n.textValue=t.text.text,f.defined(t.text.height)&&f.defined(t.text.dpi))throw Error("Expected only one of dpi or height");if(f.defined(t.text.font))if(f.string(t.text.font))n.textFont=t.text.font;else throw f.invalidParameterError("text.font","string",t.text.font);if(f.defined(t.text.fontfile))if(f.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw f.invalidParameterError("text.fontfile","string",t.text.fontfile);if(f.defined(t.text.width))if(f.integer(t.text.width)&&f.inRange(t.text.width,1,1e6))n.textWidth=t.text.width;else throw f.invalidParameterError("text.width","integer between 1 and 1000000",t.text.width);if(f.defined(t.text.height))if(f.integer(t.text.height)&&f.inRange(t.text.height,1,1e6))n.textHeight=t.text.height;else throw f.invalidParameterError("text.height","integer between 1 and 1000000",t.text.height);if(f.defined(t.text.align))if(f.string(t.text.align)&&f.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw f.invalidParameterError("text.align","valid alignment",t.text.align);if(f.defined(t.text.justify))if(f.bool(t.text.justify))n.textJustify=t.text.justify;else throw f.invalidParameterError("text.justify","boolean",t.text.justify);if(f.defined(t.text.dpi))if(f.integer(t.text.dpi)&&f.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw f.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(f.defined(t.text.rgba))if(f.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw f.invalidParameterError("text.rgba","bool",t.text.rgba);if(f.defined(t.text.spacing))if(f.integer(t.text.spacing)&&f.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw f.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(f.defined(t.text.wrap))if(f.string(t.text.wrap)&&f.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw f.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(f.defined(t.join))if(f.defined(this.options.join)){if(f.defined(t.join.animated))if(f.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw f.invalidParameterError("join.animated","boolean",t.join.animated);if(f.defined(t.join.across))if(f.integer(t.join.across)&&f.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw f.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(f.defined(t.join.shim))if(f.integer(t.join.shim)&&f.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw f.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(f.defined(t.join.background))n.joinBackground=this._getBackgroundColourOption(t.join.background);if(f.defined(t.join.halign))if(f.string(t.join.halign)&&f.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw f.invalidParameterError("join.halign","valid alignment",t.join.halign);if(f.defined(t.join.valign))if(f.string(t.join.valign)&&f.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw f.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw Error("Expected input to be an array of images to join")}else if(f.defined(t))throw Error(`Invalid input options ${t}`);return n}function sJ(e,t,r){if(Array.isArray(this.options.input.buffer))if(f.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 iJ(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function oJ(){return Array.isArray(this.options.input.buffer)}function aJ(e){if(this.writableFinished)e();else this.once("finish",e)}function lJ(e){let t=Error();if(f.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ie.metadata(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)})});else Ie.metadata(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ie.metadata(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Ie.metadata(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})}function cJ(e){let t=Error();if(f.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ie.stats(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)})});else Ie.stats(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ie.stats(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Ie.stats(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})}var tJ,rJ,C$=(e)=>{Object.assign(e.prototype,{_inputOptionsFromObject:O$,_createInputDescriptor:nJ,_write:sJ,_flattenBufferIn:iJ,_isStreamInput:oJ,_whenStreamInFinished:aJ,metadata:lJ,stats:cJ}),e.align=tJ};var N$=H(()=>{Gr();ta();/*!
385
+ */o5=i5.debuglog("sharp");Object.setPrototypeOf(so.prototype,oh.Duplex.prototype);Object.setPrototypeOf(so,oh.Duplex);Object.assign(so.prototype,{clone:l5});Jn=so});function OS(e){let t=u5.filter((r)=>f.defined(e[r])).map((r)=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function f5(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,limitInputChannels:5,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(f.string(e))n.file=e;else if(f.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(f.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(f.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(f.plainObject(e)&&!f.defined(t)){if(t=e,OS(t))n.buffer=[]}else if(!f.defined(e)&&!f.defined(t)&&f.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}${f.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(f.object(t)){if(f.defined(t.failOn))if(f.string(t.failOn)&&f.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw f.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(f.defined(t.autoOrient))if(f.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw f.invalidParameterError("autoOrient","boolean",t.autoOrient);if(f.defined(t.density))if(f.number(t.density)&&f.inRange(t.density,1,1e5))n.density=t.density;else throw f.invalidParameterError("density","number between 1 and 100000",t.density);if(f.defined(t.ignoreIcc))if(f.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw f.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(f.defined(t.limitInputPixels))if(f.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?268402689:0;else if(f.integer(t.limitInputPixels)&&f.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw f.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(f.defined(t.limitInputChannels))if(f.bool(t.limitInputChannels))n.limitInputChannels=t.limitInputChannels?5:0;else if(f.integer(t.limitInputChannels)&&f.inRange(t.limitInputChannels,0,Number.MAX_SAFE_INTEGER))n.limitInputChannels=t.limitInputChannels;else throw f.invalidParameterError("limitInputChannels","positive integer",t.limitInputChannels);if(f.defined(t.unlimited))if(f.bool(t.unlimited))n.unlimited=t.unlimited;else throw f.invalidParameterError("unlimited","boolean",t.unlimited);if(f.defined(t.sequentialRead))if(f.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw f.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(f.defined(t.raw)){if(f.object(t.raw)&&f.integer(t.raw.width)&&f.inRange(t.raw.width,1,1e8)&&f.integer(t.raw.height)&&f.inRange(t.raw.height,1,1e8)&&f.integer(t.raw.channels)&&f.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,f.defined(t.raw.premultiplied))if(f.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw f.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,f.defined(t.raw.pageHeight))if(f.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 f.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(f.defined(t.animated))if(f.bool(t.animated))n.pages=t.animated?-1:1;else throw f.invalidParameterError("animated","boolean",t.animated);if(f.defined(t.pages))if(f.integer(t.pages)&&f.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw f.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(f.defined(t.page))if(f.integer(t.page)&&f.inRange(t.page,0,1e5))n.page=t.page;else throw f.invalidParameterError("page","integer between 0 and 100000",t.page);if(f.object(t.openSlide)&&f.defined(t.openSlide.level))if(f.integer(t.openSlide.level)&&f.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw f.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(f.defined(t.level))if(f.integer(t.level)&&f.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw f.invalidParameterError("level","integer between 0 and 256",t.level);if(f.object(t.tiff)&&f.defined(t.tiff.subifd))if(f.integer(t.tiff.subifd)&&f.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw f.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(f.defined(t.subifd))if(f.integer(t.subifd)&&f.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw f.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(f.object(t.svg)){if(f.defined(t.svg.stylesheet))if(f.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw f.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(f.defined(t.svg.highBitdepth))if(f.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw f.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(f.object(t.pdf)&&f.defined(t.pdf.background))n.pdfBackground=this._getBackgroundColourOption(t.pdf.background);else if(f.defined(t.pdfBackground))n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground);if(f.object(t.jp2)&&f.defined(t.jp2.oneshot))if(f.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw f.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(f.defined(t.create))if(f.object(t.create)&&f.integer(t.create.width)&&f.inRange(t.create.width,1,1e8)&&f.integer(t.create.height)&&f.inRange(t.create.height,1,1e8)&&f.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,f.defined(t.create.pageHeight))if(f.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 f.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(f.defined(t.create.noise)){if(!f.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,!f.inRange(t.create.channels,1,4))throw f.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,f.defined(t.create.noise.mean))if(f.number(t.create.noise.mean)&&f.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw f.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,f.defined(t.create.noise.sigma))if(f.number(t.create.noise.sigma)&&f.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw f.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(f.defined(t.create.background)){if(!f.inRange(t.create.channels,3,4))throw f.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(f.defined(t.text))if(f.object(t.text)&&f.string(t.text.text)){if(n.textValue=t.text.text,f.defined(t.text.height)&&f.defined(t.text.dpi))throw Error("Expected only one of dpi or height");if(f.defined(t.text.font))if(f.string(t.text.font))n.textFont=t.text.font;else throw f.invalidParameterError("text.font","string",t.text.font);if(f.defined(t.text.fontfile))if(f.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw f.invalidParameterError("text.fontfile","string",t.text.fontfile);if(f.defined(t.text.width))if(f.integer(t.text.width)&&f.inRange(t.text.width,1,1e6))n.textWidth=t.text.width;else throw f.invalidParameterError("text.width","integer between 1 and 1000000",t.text.width);if(f.defined(t.text.height))if(f.integer(t.text.height)&&f.inRange(t.text.height,1,1e6))n.textHeight=t.text.height;else throw f.invalidParameterError("text.height","integer between 1 and 1000000",t.text.height);if(f.defined(t.text.align))if(f.string(t.text.align)&&f.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw f.invalidParameterError("text.align","valid alignment",t.text.align);if(f.defined(t.text.justify))if(f.bool(t.text.justify))n.textJustify=t.text.justify;else throw f.invalidParameterError("text.justify","boolean",t.text.justify);if(f.defined(t.text.dpi))if(f.integer(t.text.dpi)&&f.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw f.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(f.defined(t.text.rgba))if(f.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw f.invalidParameterError("text.rgba","bool",t.text.rgba);if(f.defined(t.text.spacing))if(f.integer(t.text.spacing)&&f.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw f.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(f.defined(t.text.wrap))if(f.string(t.text.wrap)&&f.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw f.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(f.defined(t.join))if(f.defined(this.options.join)){if(f.defined(t.join.animated))if(f.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw f.invalidParameterError("join.animated","boolean",t.join.animated);if(f.defined(t.join.across))if(f.integer(t.join.across)&&f.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw f.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(f.defined(t.join.shim))if(f.integer(t.join.shim)&&f.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw f.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(f.defined(t.join.background))n.joinBackground=this._getBackgroundColourOption(t.join.background);if(f.defined(t.join.halign))if(f.string(t.join.halign)&&f.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw f.invalidParameterError("join.halign","valid alignment",t.join.halign);if(f.defined(t.join.valign))if(f.string(t.join.valign)&&f.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw f.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw Error("Expected input to be an array of images to join")}else if(f.defined(t))throw Error(`Invalid input options ${t}`);return n}function d5(e,t,r){if(Array.isArray(this.options.input.buffer))if(f.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 p5(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function m5(){return Array.isArray(this.options.input.buffer)}function h5(e){if(this.writableFinished)e();else this.once("finish",e)}function g5(e){let t=Error();if(f.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),qe.metadata(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)})});else qe.metadata(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),qe.metadata(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{qe.metadata(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})}function y5(e){let t=Error();if(f.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),qe.stats(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)})});else qe.stats(this.options,(r,n)=>{if(r)e(f.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),qe.stats(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{qe.stats(this.options,(s,i)=>{if(s)n(f.nativeError(s,t));else r(i)})})}var c5,u5,CS=(e)=>{Object.assign(e.prototype,{_inputOptionsFromObject:OS,_createInputDescriptor:f5,_write:d5,_flattenBufferIn:p5,_isStreamInput:m5,_whenStreamInFinished:h5,metadata:g5,stats:y5}),e.align=c5};var NS=D(()=>{On();Jl();/*!
342
386
  Copyright 2013 Lovell Fuller and others.
343
387
  SPDX-License-Identifier: Apache-2.0
344
- */tJ={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},rJ=["failOn","limitInputPixels","limitInputChannels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","openSlideLevel","pdfBackground","tiffSubifd"]});function pd(e){return e.angle%360!==0||e.rotationAngle!==0}function Zl(e){return e.width!==-1||e.height!==-1}function dJ(e,t,r){if(Zl(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(f.defined(e))if(f.object(e)&&!f.defined(r))r=e;else if(f.integer(e)&&f.inRange(e,1,1e8))this.options.width=e;else throw f.invalidParameterError("width","positive integer between 1 and 100000000",e);else this.options.width=-1;if(f.defined(t))if(f.integer(t)&&f.inRange(t,1,1e8))this.options.height=t;else throw f.invalidParameterError("height","positive integer between 1 and 100000000",t);else this.options.height=-1;if(f.object(r)){if(f.defined(r.width))if(f.integer(r.width)&&f.inRange(r.width,1,1e8))this.options.width=r.width;else throw f.invalidParameterError("width","positive integer between 1 and 100000000",r.width);if(f.defined(r.height))if(f.integer(r.height)&&f.inRange(r.height,1,1e8))this.options.height=r.height;else throw f.invalidParameterError("height","positive integer between 1 and 100000000",r.height);if(f.defined(r.fit)){let n=fJ[r.fit];if(f.string(n))this.options.canvas=n;else throw f.invalidParameterError("fit","valid fit",r.fit)}if(f.defined(r.position)){let n=f.integer(r.position)?r.position:J$[r.position]||M$[r.position]||I$[r.position];if(f.integer(n)&&(f.inRange(n,0,8)||f.inRange(n,16,17)))this.options.position=n;else throw f.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),f.defined(r.kernel))if(f.string(dd[r.kernel]))this.options.kernel=dd[r.kernel];else throw f.invalidParameterError("kernel","valid kernel name",r.kernel);if(f.defined(r.withoutEnlargement))this._setBooleanOption("withoutEnlargement",r.withoutEnlargement);if(f.defined(r.withoutReduction))this._setBooleanOption("withoutReduction",r.withoutReduction);if(f.defined(r.fastShrinkOnLoad))this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}if(pd(this.options)&&Zl(this.options))this.options.rotateBefore=!0;return this}function pJ(e){if(f.integer(e))if(f.inRange(e,1,1e8))this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else throw f.invalidParameterError("extend","integer between 1 and 100000000",e);else if(f.object(e)){if(f.defined(e.top))if(f.integer(e.top)&&f.inRange(e.top,0,1e8))this.options.extendTop=e.top;else throw f.invalidParameterError("top","integer between 0 and 100000000",e.top);if(f.defined(e.bottom))if(f.integer(e.bottom)&&f.inRange(e.bottom,0,1e8))this.options.extendBottom=e.bottom;else throw f.invalidParameterError("bottom","integer between 0 and 100000000",e.bottom);if(f.defined(e.left))if(f.integer(e.left)&&f.inRange(e.left,0,1e8))this.options.extendLeft=e.left;else throw f.invalidParameterError("left","integer between 0 and 100000000",e.left);if(f.defined(e.right))if(f.integer(e.right)&&f.inRange(e.right,0,1e8))this.options.extendRight=e.right;else throw f.invalidParameterError("right","integer between 0 and 100000000",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),f.defined(e.extendWith))if(f.string(T$[e.extendWith]))this.options.extendWith=T$[e.extendWith];else throw f.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw f.invalidParameterError("extend","integer or object",e);return this}function mJ(e){let t=Zl(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(f.integer(n)&&f.inRange(n,0,1e8))this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=n;else throw f.invalidParameterError(r,"integer between 0 and 100000000",n)},this),pd(this.options)&&!Zl(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 hJ(e){if(this.options.trimThreshold=10,f.defined(e))if(f.object(e)){if(f.defined(e.background))this._setBackgroundColourOption("trimBackground",e.background);if(f.defined(e.threshold))if(f.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw f.invalidParameterError("threshold","positive number",e.threshold);if(f.defined(e.lineArt))this._setBooleanOption("trimLineArt",e.lineArt);if(f.defined(e.margin))if(f.integer(e.margin)&&f.inRange(e.margin,0,1e7))this.options.trimMargin=e.margin;else throw f.invalidParameterError("margin","integer between 0 and 10000000",e.margin)}else throw f.invalidParameterError("trim","object",e);if(pd(this.options))this.options.rotateBefore=!0;return this}var I$,M$,T$,J$,dd,uJ,fJ,D$=(e)=>{Object.assign(e.prototype,{resize:dJ,extend:pJ,extract:mJ,trim:hJ}),e.gravity=I$,e.strategy=J$,e.kernel=dd,e.fit=uJ,e.position=M$};var L$=H(()=>{Gr();/*!
388
+ */c5={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},u5=["failOn","limitInputPixels","limitInputChannels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","openSlideLevel","pdfBackground","tiffSubifd"]});function lh(e){return e.angle%360!==0||e.rotationAngle!==0}function uf(e){return e.width!==-1||e.height!==-1}function $5(e,t,r){if(uf(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(f.defined(e))if(f.object(e)&&!f.defined(r))r=e;else if(f.integer(e)&&f.inRange(e,1,1e8))this.options.width=e;else throw f.invalidParameterError("width","positive integer between 1 and 100000000",e);else this.options.width=-1;if(f.defined(t))if(f.integer(t)&&f.inRange(t,1,1e8))this.options.height=t;else throw f.invalidParameterError("height","positive integer between 1 and 100000000",t);else this.options.height=-1;if(f.object(r)){if(f.defined(r.width))if(f.integer(r.width)&&f.inRange(r.width,1,1e8))this.options.width=r.width;else throw f.invalidParameterError("width","positive integer between 1 and 100000000",r.width);if(f.defined(r.height))if(f.integer(r.height)&&f.inRange(r.height,1,1e8))this.options.height=r.height;else throw f.invalidParameterError("height","positive integer between 1 and 100000000",r.height);if(f.defined(r.fit)){let n=x5[r.fit];if(f.string(n))this.options.canvas=n;else throw f.invalidParameterError("fit","valid fit",r.fit)}if(f.defined(r.position)){let n=f.integer(r.position)?r.position:MS[r.position]||JS[r.position]||IS[r.position];if(f.integer(n)&&(f.inRange(n,0,8)||f.inRange(n,16,17)))this.options.position=n;else throw f.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),f.defined(r.kernel))if(f.string(ah[r.kernel]))this.options.kernel=ah[r.kernel];else throw f.invalidParameterError("kernel","valid kernel name",r.kernel);if(f.defined(r.withoutEnlargement))this._setBooleanOption("withoutEnlargement",r.withoutEnlargement);if(f.defined(r.withoutReduction))this._setBooleanOption("withoutReduction",r.withoutReduction);if(f.defined(r.fastShrinkOnLoad))this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}if(lh(this.options)&&uf(this.options))this.options.rotateBefore=!0;return this}function w5(e){if(f.integer(e))if(f.inRange(e,1,1e8))this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else throw f.invalidParameterError("extend","integer between 1 and 100000000",e);else if(f.object(e)){if(f.defined(e.top))if(f.integer(e.top)&&f.inRange(e.top,0,1e8))this.options.extendTop=e.top;else throw f.invalidParameterError("top","integer between 0 and 100000000",e.top);if(f.defined(e.bottom))if(f.integer(e.bottom)&&f.inRange(e.bottom,0,1e8))this.options.extendBottom=e.bottom;else throw f.invalidParameterError("bottom","integer between 0 and 100000000",e.bottom);if(f.defined(e.left))if(f.integer(e.left)&&f.inRange(e.left,0,1e8))this.options.extendLeft=e.left;else throw f.invalidParameterError("left","integer between 0 and 100000000",e.left);if(f.defined(e.right))if(f.integer(e.right)&&f.inRange(e.right,0,1e8))this.options.extendRight=e.right;else throw f.invalidParameterError("right","integer between 0 and 100000000",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),f.defined(e.extendWith))if(f.string(TS[e.extendWith]))this.options.extendWith=TS[e.extendWith];else throw f.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw f.invalidParameterError("extend","integer or object",e);return this}function v5(e){let t=uf(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(f.integer(n)&&f.inRange(n,0,1e8))this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=n;else throw f.invalidParameterError(r,"integer between 0 and 100000000",n)},this),lh(this.options)&&!uf(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 S5(e){if(this.options.trimThreshold=10,f.defined(e))if(f.object(e)){if(f.defined(e.background))this._setBackgroundColourOption("trimBackground",e.background);if(f.defined(e.threshold))if(f.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw f.invalidParameterError("threshold","positive number",e.threshold);if(f.defined(e.lineArt))this._setBooleanOption("trimLineArt",e.lineArt);if(f.defined(e.margin))if(f.integer(e.margin)&&f.inRange(e.margin,0,1e7))this.options.trimMargin=e.margin;else throw f.invalidParameterError("margin","integer between 0 and 10000000",e.margin)}else throw f.invalidParameterError("trim","object",e);if(lh(this.options))this.options.rotateBefore=!0;return this}var IS,JS,TS,MS,ah,b5,x5,DS=(e)=>{Object.assign(e.prototype,{resize:$5,extend:w5,extract:v5,trim:S5}),e.gravity=IS,e.strategy=MS,e.kernel=ah,e.fit=b5,e.position=JS};var LS=D(()=>{On();/*!
345
389
  Copyright 2013 Lovell Fuller and others.
346
390
  SPDX-License-Identifier: Apache-2.0
347
- */I$={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},M$={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},T$={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},J$={entropy:16,attention:17},dd={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},uJ={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},fJ={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"}});function gJ(e){if(!Array.isArray(e))throw f.invalidParameterError("images to composite","array",e);return this.options.composite=e.map((t)=>{if(!f.object(t))throw f.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(f.defined(t.blend))if(f.string(md[t.blend]))n.blend=md[t.blend];else throw f.invalidParameterError("blend","valid blend name",t.blend);if(f.defined(t.tile))if(f.bool(t.tile))n.tile=t.tile;else throw f.invalidParameterError("tile","boolean",t.tile);if(f.defined(t.left))if(f.integer(t.left)&&f.inRange(t.left,-1e8,1e8))n.left=t.left;else throw f.invalidParameterError("left","integer between -100000000 and 100000000",t.left);if(f.defined(t.top))if(f.integer(t.top)&&f.inRange(t.top,-1e8,1e8))n.top=t.top;else throw f.invalidParameterError("top","integer between -100000000 and 100000000",t.top);if(f.defined(t.top)!==f.defined(t.left))throw Error("Expected both left and top to be set");else n.hasOffset=f.integer(t.top)&&f.integer(t.left);if(f.defined(t.gravity))if(f.integer(t.gravity)&&f.inRange(t.gravity,0,8))n.gravity=t.gravity;else if(f.string(t.gravity)&&f.integer(this.constructor.gravity[t.gravity]))n.gravity=this.constructor.gravity[t.gravity];else throw f.invalidParameterError("gravity","valid gravity",t.gravity);if(f.defined(t.premultiplied))if(f.bool(t.premultiplied))n.premultiplied=t.premultiplied;else throw f.invalidParameterError("premultiplied","boolean",t.premultiplied);return n}),this}var md,F$=(e)=>{e.prototype.composite=gJ,e.blend=md};var q$=H(()=>{Gr();/*!
391
+ */IS={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},JS={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},TS={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},MS={entropy:16,attention:17},ah={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},b5={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},x5={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"}});function E5(e){if(!Array.isArray(e))throw f.invalidParameterError("images to composite","array",e);return this.options.composite=e.map((t)=>{if(!f.object(t))throw f.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(f.defined(t.blend))if(f.string(ch[t.blend]))n.blend=ch[t.blend];else throw f.invalidParameterError("blend","valid blend name",t.blend);if(f.defined(t.tile))if(f.bool(t.tile))n.tile=t.tile;else throw f.invalidParameterError("tile","boolean",t.tile);if(f.defined(t.left))if(f.integer(t.left)&&f.inRange(t.left,-1e8,1e8))n.left=t.left;else throw f.invalidParameterError("left","integer between -100000000 and 100000000",t.left);if(f.defined(t.top))if(f.integer(t.top)&&f.inRange(t.top,-1e8,1e8))n.top=t.top;else throw f.invalidParameterError("top","integer between -100000000 and 100000000",t.top);if(f.defined(t.top)!==f.defined(t.left))throw Error("Expected both left and top to be set");else n.hasOffset=f.integer(t.top)&&f.integer(t.left);if(f.defined(t.gravity))if(f.integer(t.gravity)&&f.inRange(t.gravity,0,8))n.gravity=t.gravity;else if(f.string(t.gravity)&&f.integer(this.constructor.gravity[t.gravity]))n.gravity=this.constructor.gravity[t.gravity];else throw f.invalidParameterError("gravity","valid gravity",t.gravity);if(f.defined(t.premultiplied))if(f.bool(t.premultiplied))n.premultiplied=t.premultiplied;else throw f.invalidParameterError("premultiplied","boolean",t.premultiplied);return n}),this}var ch,FS=(e)=>{e.prototype.composite=E5,e.blend=ch};var qS=D(()=>{On();/*!
348
392
  Copyright 2013 Lovell Fuller and others.
349
393
  SPDX-License-Identifier: Apache-2.0
350
- */md={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 yJ(e,t){if(!f.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(f.integer(e)&&!(e%90))this.options.angle=e;else if(f.number(e)){if(this.options.rotationAngle=e,f.object(t)&&t.background)this._setBackgroundColourOption("rotationBackground",t.background)}else throw f.invalidParameterError("angle","numeric",e);return this}function bJ(){return this.options.input.autoOrient=!0,this}function xJ(e){return this.options.flip=f.bool(e)?e:!0,this}function $J(e){return this.options.flop=f.bool(e)?e:!0,this}function vJ(e,t){let n=Array.isArray(e)&&(e.length===4&&e.every(f.number)||e.length===2&&e.every((s)=>Array.isArray(s)&&s.length===2))?e.flat():[];if(n.length===4&&n.every(f.number))this.options.affineMatrix=n;else throw f.invalidParameterError("matrix","1x4 or 2x2 array",e);if(f.defined(t))if(f.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),f.defined(t.idx))if(f.number(t.idx))this.options.affineIdx=t.idx;else throw f.invalidParameterError("options.idx","number",t.idx);if(f.defined(t.idy))if(f.number(t.idy))this.options.affineIdy=t.idy;else throw f.invalidParameterError("options.idy","number",t.idy);if(f.defined(t.odx))if(f.number(t.odx))this.options.affineOdx=t.odx;else throw f.invalidParameterError("options.odx","number",t.odx);if(f.defined(t.ody))if(f.number(t.ody))this.options.affineOdy=t.ody;else throw f.invalidParameterError("options.ody","number",t.ody);if(f.defined(t.interpolator))if(f.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw f.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw f.invalidParameterError("options","object",t);return this}function wJ(e){if(f.plainObject(e)){if(f.number(e.sigma)&&f.inRange(e.sigma,0.000001,10))this.options.sharpenSigma=e.sigma;else throw f.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(f.defined(e.m1))if(f.number(e.m1)&&f.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw f.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(f.defined(e.m2))if(f.number(e.m2)&&f.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw f.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(f.defined(e.x1))if(f.number(e.x1)&&f.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw f.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(f.defined(e.y2))if(f.number(e.y2)&&f.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw f.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(f.defined(e.y3))if(f.number(e.y3)&&f.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw f.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else this.options.sharpenSigma=-1;return this}function SJ(e){if(!f.defined(e))this.options.medianSize=3;else if(f.integer(e)&&f.inRange(e,1,1000))this.options.medianSize=e;else throw f.invalidParameterError("size","integer between 1 and 1000",e);return this}function EJ(e){let t;if(f.number(e))t=e;else if(f.plainObject(e)){if(!f.number(e.sigma))throw f.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(f.string(H$[e.precision]))this.options.precision=H$[e.precision];else throw f.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(f.number(e.minAmplitude)&&f.inRange(e.minAmplitude,0.001,1))this.options.minAmpl=e.minAmplitude;else throw f.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!f.defined(e))this.options.blurSigma=-1;else if(f.bool(e))this.options.blurSigma=e?-1:0;else if(f.number(t)&&f.inRange(t,0.3,1000))this.options.blurSigma=t;else throw f.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function PJ(e){if(!f.defined(e))this.options.dilateWidth=1;else if(f.integer(e)&&f.inRange(e,1,65536))this.options.dilateWidth=e;else throw f.invalidParameterError("width","integer between 1 and 65536",e);return this}function jJ(e){if(!f.defined(e))this.options.erodeWidth=1;else if(f.integer(e)&&f.inRange(e,1,65536))this.options.erodeWidth=e;else throw f.invalidParameterError("width","integer between 1 and 65536",e);return this}function kJ(e){if(this.options.flatten=f.bool(e)?e:!0,f.object(e))this._setBackgroundColourOption("flattenBackground",e.background);return this}function _J(){return this.options.unflatten=!0,this}function RJ(e,t){if(!f.defined(e))this.options.gamma=2.2;else if(f.number(e)&&f.inRange(e,1,3))this.options.gamma=e;else throw f.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!f.defined(t))this.options.gammaOut=this.options.gamma;else if(f.number(t)&&f.inRange(t,1,3))this.options.gammaOut=t;else throw f.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function AJ(e){if(this.options.negate=f.bool(e)?e:!0,f.plainObject(e)&&"alpha"in e)if(!f.bool(e.alpha))throw f.invalidParameterError("alpha","should be boolean value",e.alpha);else this.options.negateAlpha=e.alpha;return this}function OJ(e){if(f.plainObject(e)){if(f.defined(e.lower))if(f.number(e.lower)&&f.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw f.invalidParameterError("lower","number between 0 and 99",e.lower);if(f.defined(e.upper))if(f.number(e.upper)&&f.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw f.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw f.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function CJ(e){return this.normalise(e)}function NJ(e){if(f.plainObject(e)){if(f.integer(e.width)&&f.inRange(e.width,1,65536))this.options.claheWidth=e.width;else throw f.invalidParameterError("width","integer between 1 and 65536",e.width);if(f.integer(e.height)&&f.inRange(e.height,1,65536))this.options.claheHeight=e.height;else throw f.invalidParameterError("height","integer between 1 and 65536",e.height);if(f.defined(e.maxSlope))if(f.integer(e.maxSlope)&&f.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw f.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw f.invalidParameterError("options","plain object",e);return this}function TJ(e){if(!f.object(e)||!Array.isArray(e.kernel)||!f.integer(e.width)||!f.integer(e.height)||!f.inRange(e.width,3,1001)||!f.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length||!e.kernel.every(f.number))throw Error("Invalid convolution kernel");if(!f.integer(e.scale))e.scale=e.kernel.reduce((t,r)=>t+r,0);if(e.scale<1)e.scale=1;if(!f.integer(e.offset))e.offset=0;return this.options.convKernel=e,this}function IJ(e,t){if(!f.defined(e))this.options.threshold=128;else if(f.bool(e))this.options.threshold=e?128:0;else if(f.integer(e)&&f.inRange(e,0,255))this.options.threshold=e;else throw f.invalidParameterError("threshold","integer between 0 and 255",e);if(!f.object(t)||t.greyscale===!0||t.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function MJ(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),f.string(t)&&f.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw f.invalidParameterError("operator","one of: and, or, eor",t);return this}function JJ(e,t){if(!f.defined(e)&&f.number(t))e=1;else if(f.number(e)&&!f.defined(t))t=0;if(!f.defined(e))this.options.linearA=[];else if(f.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&f.inRange(e.length,1,1e6)&&e.every(f.number))this.options.linearA=e;else throw f.invalidParameterError("a","number or array of numbers",e);if(!f.defined(t))this.options.linearB=[];else if(f.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&f.inRange(t.length,1,1e6)&&t.every(f.number))this.options.linearB=t;else throw f.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 DJ(e){if(!Array.isArray(e))throw f.invalidParameterError("inputMatrix","array",e);let t=e.length;if(t!==3&&t!==4)throw f.invalidParameterError("inputMatrix","3x3 or 4x4 array",t);if(!e.every((n)=>Array.isArray(n)&&n.length===t))throw f.invalidParameterError("inputMatrix",`array of ${t} arrays of length ${t}`,e);let r=e.flat();if(!r.every(f.number))throw f.invalidParameterError("inputMatrix","array of numbers",r);return this.options.recombMatrix=r,this}function LJ(e){if(!f.plainObject(e))throw f.invalidParameterError("options","plain object",e);if("brightness"in e)if(f.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw f.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(f.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw f.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(f.integer(e.hue))this.options.hue=e.hue%360;else throw f.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(f.number(e.lightness))this.options.lightness=e.lightness;else throw f.invalidParameterError("lightness","number",e.lightness);return this}var H$,V$=(e)=>{Object.assign(e.prototype,{autoOrient:bJ,rotate:yJ,flip:xJ,flop:$J,affine:vJ,sharpen:wJ,erode:jJ,dilate:PJ,median:SJ,blur:EJ,flatten:kJ,unflatten:_J,gamma:RJ,negate:AJ,normalise:OJ,normalize:CJ,clahe:NJ,convolve:TJ,threshold:IJ,boolean:MJ,linear:JJ,recomb:DJ,modulate:LJ})};var B$=H(()=>{Gr();/*!
394
+ */ch={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 P5(e,t){if(!f.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(f.integer(e)&&!(e%90))this.options.angle=e;else if(f.number(e)){if(this.options.rotationAngle=e,f.object(t)&&t.background)this._setBackgroundColourOption("rotationBackground",t.background)}else throw f.invalidParameterError("angle","numeric",e);return this}function j5(){return this.options.input.autoOrient=!0,this}function k5(e){return this.options.flip=f.bool(e)?e:!0,this}function _5(e){return this.options.flop=f.bool(e)?e:!0,this}function A5(e,t){let n=Array.isArray(e)&&(e.length===4&&e.every(f.number)||e.length===2&&e.every((s)=>Array.isArray(s)&&s.length===2))?e.flat():[];if(n.length===4&&n.every(f.number))this.options.affineMatrix=n;else throw f.invalidParameterError("matrix","1x4 or 2x2 array",e);if(f.defined(t))if(f.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),f.defined(t.idx))if(f.number(t.idx))this.options.affineIdx=t.idx;else throw f.invalidParameterError("options.idx","number",t.idx);if(f.defined(t.idy))if(f.number(t.idy))this.options.affineIdy=t.idy;else throw f.invalidParameterError("options.idy","number",t.idy);if(f.defined(t.odx))if(f.number(t.odx))this.options.affineOdx=t.odx;else throw f.invalidParameterError("options.odx","number",t.odx);if(f.defined(t.ody))if(f.number(t.ody))this.options.affineOdy=t.ody;else throw f.invalidParameterError("options.ody","number",t.ody);if(f.defined(t.interpolator))if(f.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw f.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw f.invalidParameterError("options","object",t);return this}function R5(e){if(f.plainObject(e)){if(f.number(e.sigma)&&f.inRange(e.sigma,0.000001,10))this.options.sharpenSigma=e.sigma;else throw f.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(f.defined(e.m1))if(f.number(e.m1)&&f.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw f.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(f.defined(e.m2))if(f.number(e.m2)&&f.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw f.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(f.defined(e.x1))if(f.number(e.x1)&&f.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw f.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(f.defined(e.y2))if(f.number(e.y2)&&f.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw f.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(f.defined(e.y3))if(f.number(e.y3)&&f.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw f.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else this.options.sharpenSigma=-1;return this}function O5(e){if(!f.defined(e))this.options.medianSize=3;else if(f.integer(e)&&f.inRange(e,1,1000))this.options.medianSize=e;else throw f.invalidParameterError("size","integer between 1 and 1000",e);return this}function C5(e){let t;if(f.number(e))t=e;else if(f.plainObject(e)){if(!f.number(e.sigma))throw f.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(f.string(VS[e.precision]))this.options.precision=VS[e.precision];else throw f.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(f.number(e.minAmplitude)&&f.inRange(e.minAmplitude,0.001,1))this.options.minAmpl=e.minAmplitude;else throw f.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!f.defined(e))this.options.blurSigma=-1;else if(f.bool(e))this.options.blurSigma=e?-1:0;else if(f.number(t)&&f.inRange(t,0.3,1000))this.options.blurSigma=t;else throw f.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function N5(e){if(!f.defined(e))this.options.dilateWidth=1;else if(f.integer(e)&&f.inRange(e,1,65536))this.options.dilateWidth=e;else throw f.invalidParameterError("width","integer between 1 and 65536",e);return this}function T5(e){if(!f.defined(e))this.options.erodeWidth=1;else if(f.integer(e)&&f.inRange(e,1,65536))this.options.erodeWidth=e;else throw f.invalidParameterError("width","integer between 1 and 65536",e);return this}function I5(e){if(this.options.flatten=f.bool(e)?e:!0,f.object(e))this._setBackgroundColourOption("flattenBackground",e.background);return this}function J5(){return this.options.unflatten=!0,this}function M5(e,t){if(!f.defined(e))this.options.gamma=2.2;else if(f.number(e)&&f.inRange(e,1,3))this.options.gamma=e;else throw f.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!f.defined(t))this.options.gammaOut=this.options.gamma;else if(f.number(t)&&f.inRange(t,1,3))this.options.gammaOut=t;else throw f.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function D5(e){if(this.options.negate=f.bool(e)?e:!0,f.plainObject(e)&&"alpha"in e)if(!f.bool(e.alpha))throw f.invalidParameterError("alpha","should be boolean value",e.alpha);else this.options.negateAlpha=e.alpha;return this}function L5(e){if(f.plainObject(e)){if(f.defined(e.lower))if(f.number(e.lower)&&f.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw f.invalidParameterError("lower","number between 0 and 99",e.lower);if(f.defined(e.upper))if(f.number(e.upper)&&f.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw f.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw f.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function F5(e){return this.normalise(e)}function q5(e){if(f.plainObject(e)){if(f.integer(e.width)&&f.inRange(e.width,1,65536))this.options.claheWidth=e.width;else throw f.invalidParameterError("width","integer between 1 and 65536",e.width);if(f.integer(e.height)&&f.inRange(e.height,1,65536))this.options.claheHeight=e.height;else throw f.invalidParameterError("height","integer between 1 and 65536",e.height);if(f.defined(e.maxSlope))if(f.integer(e.maxSlope)&&f.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw f.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw f.invalidParameterError("options","plain object",e);return this}function V5(e){if(!f.object(e)||!Array.isArray(e.kernel)||!f.integer(e.width)||!f.integer(e.height)||!f.inRange(e.width,3,1001)||!f.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length||!e.kernel.every(f.number))throw Error("Invalid convolution kernel");if(!f.integer(e.scale))e.scale=e.kernel.reduce((t,r)=>t+r,0);if(e.scale<1)e.scale=1;if(!f.integer(e.offset))e.offset=0;return this.options.convKernel=e,this}function W5(e,t){if(!f.defined(e))this.options.threshold=128;else if(f.bool(e))this.options.threshold=e?128:0;else if(f.integer(e)&&f.inRange(e,0,255))this.options.threshold=e;else throw f.invalidParameterError("threshold","integer between 0 and 255",e);if(!f.object(t)||t.greyscale===!0||t.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function H5(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),f.string(t)&&f.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw f.invalidParameterError("operator","one of: and, or, eor",t);return this}function B5(e,t){if(!f.defined(e)&&f.number(t))e=1;else if(f.number(e)&&!f.defined(t))t=0;if(!f.defined(e))this.options.linearA=[];else if(f.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&f.inRange(e.length,1,1e6)&&e.every(f.number))this.options.linearA=e;else throw f.invalidParameterError("a","number or array of numbers",e);if(!f.defined(t))this.options.linearB=[];else if(f.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&f.inRange(t.length,1,1e6)&&t.every(f.number))this.options.linearB=t;else throw f.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 U5(e){if(!Array.isArray(e))throw f.invalidParameterError("inputMatrix","array",e);let t=e.length;if(t!==3&&t!==4)throw f.invalidParameterError("inputMatrix","3x3 or 4x4 array",t);if(!e.every((n)=>Array.isArray(n)&&n.length===t))throw f.invalidParameterError("inputMatrix",`array of ${t} arrays of length ${t}`,e);let r=e.flat();if(!r.every(f.number))throw f.invalidParameterError("inputMatrix","array of numbers",r);return this.options.recombMatrix=r,this}function z5(e){if(!f.plainObject(e))throw f.invalidParameterError("options","plain object",e);if("brightness"in e)if(f.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw f.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(f.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw f.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(f.integer(e.hue))this.options.hue=e.hue%360;else throw f.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(f.number(e.lightness))this.options.lightness=e.lightness;else throw f.invalidParameterError("lightness","number",e.lightness);return this}var VS,WS=(e)=>{Object.assign(e.prototype,{autoOrient:j5,rotate:P5,flip:k5,flop:_5,affine:A5,sharpen:R5,erode:T5,dilate:N5,median:O5,blur:C5,flatten:I5,unflatten:J5,gamma:M5,negate:D5,normalise:L5,normalize:F5,clahe:q5,convolve:V5,threshold:W5,boolean:H5,linear:B5,recomb:U5,modulate:z5})};var HS=D(()=>{On();/*!
351
395
  Copyright 2013 Lovell Fuller and others.
352
396
  SPDX-License-Identifier: Apache-2.0
353
- */H$={integer:"integer",float:"float",approximate:"approximate"}});var Y$=C(function(WK,K$){var{defineProperty:xd,getOwnPropertyDescriptor:FJ,getOwnPropertyNames:qJ}=Object,HJ=Object.prototype.hasOwnProperty,VJ=(e,t)=>{for(var r in t)xd(e,r,{get:t[r],enumerable:!0})},BJ=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of qJ(t))if(!HJ.call(e,s)&&s!==r)xd(e,s,{get:()=>t[s],enumerable:!(n=FJ(t,s))||n.enumerable})}return e},WJ=(e)=>BJ(xd({},"__esModule",{value:!0}),e),W$={};VJ(W$,{default:()=>i2});K$.exports=WJ(W$);var hd={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 hd)Object.freeze(hd[e]);var en=Object.freeze(hd),U$=Object.create(null);for(let e in en)if(Object.hasOwn(en,e))U$[en[e]]=e;var nr={to:{},get:{}};nr.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=nr.get.hsl(e),n="hsl";break}case"hwb":{r=nr.get.hwb(e),n="hwb";break}default:{r=nr.get.rgb(e),n="rgb";break}}if(!r)return null;return{model:n,value:r}};nr.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 u=l*2;o[l]=Number.parseInt(a.slice(u,u+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(en,a[1]))return null;return o=en[a[1]].slice(),o[3]=1,o}else return null;for(l=0;l<3;l++)o[l]=os(o[l],0,255);return o[3]=os(o[3],0,1),o};nr.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=os(Number.parseFloat(r[2]),0,100),o=os(Number.parseFloat(r[3]),0,100),a=os(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};nr.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=os(Number.parseFloat(r[2]),0,100),o=os(Number.parseFloat(r[3]),0,100),a=os(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};nr.to.hex=function(...e){return"#"+Ql(e[0])+Ql(e[1])+Ql(e[2])+(e[3]<1?Ql(Math.round(e[3]*255)):"")};nr.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]+")"};nr.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]+")"};nr.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]+")"};nr.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+")"};nr.to.keyword=function(...e){return U$[e.slice(0,3)]};function os(e,t,r){return Math.min(Math.max(t,e),r)}function Ql(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var Li=nr,z$={};for(let e of Object.keys(en))z$[en[e]]=e;var Q={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"]}},ei=Q,Fn=0.008856451679035631;function qi(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 Hi(e){return e>0.04045?((e+0.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(Q)){if(!("channels"in Q[e]))throw Error("missing channels property: "+e);if(!("labels"in Q[e]))throw Error("missing channel labels property: "+e);if(Q[e].labels.length!==Q[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=Q[e];delete Q[e].channels,delete Q[e].labels,Object.defineProperty(Q[e],"channels",{value:t}),Object.defineProperty(Q[e],"labels",{value:r})}Q.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]};Q.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),u=c-Math.min(o,a,l),p=function(g){return(c-g)/6/u+0.5};if(u===0)s=0,i=0;else{switch(i=u/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]};Q.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],s=Q.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]};Q.rgb.oklab=function(e){let t=Hi(e[0]/255),r=Hi(e[1]/255),n=Hi(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]};Q.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 UJ(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Q.rgb.keyword=function(e){let t=z$[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let s of Object.keys(en)){let i=en[s],o=UJ(e,i);if(o<r)r=o,n=s}return n};Q.keyword.rgb=function(e){return[...en[e]]};Q.rgb.xyz=function(e){let t=Hi(e[0]/255),r=Hi(e[1]/255),n=Hi(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]};Q.rgb.lab=function(e){let t=Q.rgb.xyz(e),r=t[0],n=t[1],s=t[2];r/=95.047,n/=100,s/=108.883,r=r>Fn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>Fn?n**0.3333333333333333:7.787*n+0.13793103448275862,s=s>Fn?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]};Q.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};Q.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]};Q.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]}};Q.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]};Q.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,u,p;switch(o){default:case 6:case 0:{c=a,u=l,p=r;break}case 1:{c=l,u=a,p=r;break}case 2:{c=r,u=a,p=l;break}case 3:{c=r,u=l,p=a;break}case 4:{c=l,u=r,p=a;break}case 5:{c=a,u=r,p=l;break}}return[c*255,u*255,p*255]};Q.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]};Q.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=qi(s),i=qi(i),o=qi(o),[s*255,i*255,o*255]};Q.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>Fn?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>Fn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>Fn?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]};Q.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]};Q.oklab.oklch=function(e){return Q.lab.lch(e)};Q.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]};Q.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=qi(4.0767416621*s-3.3077115913*i+0.2309699292*o),l=qi(-1.2684380046*s+2.6097574011*i-0.3413193965*o),c=qi(-0.0041960863*s-0.7034186147*i+1.707614701*o);return[a*255,l*255,c*255]};Q.oklch.oklab=function(e){return Q.lch.lab(e)};Q.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>Fn?a:(i-0.13793103448275862)/7.787,s=l>Fn?l:(s-0.13793103448275862)/7.787,o=c>Fn?c:(o-0.13793103448275862)/7.787,s*=95.047,i*=100,o*=108.883,[s,i,o]};Q.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]};Q.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]};Q.rgb.ansi16=function(e,t=null){let[r,n,s]=e,i=t===null?Q.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};Q.hsv.ansi16=function(e){return Q.rgb.ansi16(Q.hsv.rgb(e),e[2])};Q.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)};Q.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]};Q.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]};Q.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};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};Q.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};Q.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};Q.gray.hsl=function(e){return[0,0,e[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(e){return[0,100,e[0]]};Q.gray.cmyk=function(e){return[0,0,0,e[0]]};Q.gray.lab=function(e){return[e[0],0,0]};Q.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};Q.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function zJ(){let e={},t=Object.keys(ei);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function GJ(e){let t=zJ(),r=[e];t[e].distance=0;while(r.length>0){let n=r.pop(),s=Object.keys(ei[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 KJ(e,t){return function(r){return t(e(r))}}function YJ(e,t){let r=[t[e].parent,e],n=ei[t[e].parent][e],s=t[e].parent;while(t[s].parent)r.unshift(t[s].parent),n=KJ(ei[t[s].parent][s],n),s=t[s].parent;return n.conversion=r,n}function XJ(e){let t=GJ(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]=YJ(o,t)}return r}var ZJ=XJ,Fi={},QJ=Object.keys(ei);function e2(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 t2(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 QJ){Fi[e]={},Object.defineProperty(Fi[e],"channels",{value:ei[e].channels}),Object.defineProperty(Fi[e],"labels",{value:ei[e].labels});let t=ZJ(e),r=Object.keys(t);for(let n of r){let s=t[n];Fi[e][n]=t2(s),Fi[e][n].raw=e2(s)}}var $r=Fi,G$=["keyword","gray","hex"],gd={};for(let e of Object.keys($r))gd[[...$r[e].labels].sort().join("")]=e;var yd={};function Et(e,t){if(!(this instanceof Et))return new Et(e,t);if(t&&t in G$)t=null;if(t&&!(t in $r))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 Et)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==="string"){let s=Li.get(e);if(s===null)throw Error("Unable to parse color from string: "+e);this.model=s.model,n=$r[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=$r[this.model].channels;let s=Array.prototype.slice.call(e,0,n);this.color=bd(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 gd))throw Error("Unable to parse color from object: "+JSON.stringify(e));this.model=gd[i];let{labels:o}=$r[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=bd(a)}if(yd[this.model]){n=$r[this.model].channels;for(r=0;r<n;r++){let s=yd[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)}Et.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in Li.to?this:this.rgb();t=t.round(typeof e==="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return Li.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 Li.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=$r[this.model],{labels:r}=$r[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 Et([...this.color.map(n2(e)),this.valpha],this.model)},alpha(e){if(e!==void 0)return new Et([...this.color,Math.max(0,Math.min(1,e))],this.model);return this.valpha},red:nt("rgb",0,wt(255)),green:nt("rgb",1,wt(255)),blue:nt("rgb",2,wt(255)),hue:nt(["hsl","hsv","hsl","hwb","hcg"],0,(e)=>(e%360+360)%360),saturationl:nt("hsl",1,wt(100)),lightness:nt("hsl",2,wt(100)),saturationv:nt("hsv",1,wt(100)),value:nt("hsv",2,wt(100)),chroma:nt("hcg",1,wt(100)),gray:nt("hcg",2,wt(100)),white:nt("hwb",1,wt(100)),wblack:nt("hwb",2,wt(100)),cyan:nt("cmyk",0,wt(100)),magenta:nt("cmyk",1,wt(100)),yellow:nt("cmyk",2,wt(100)),black:nt("cmyk",3,wt(100)),x:nt("xyz",0,wt(95.047)),y:nt("xyz",1,wt(100)),z:nt("xyz",2,wt(108.833)),l:nt("lab",0,wt(100)),a:nt("lab",1),b:nt("lab",2),keyword(e){if(e!==void 0)return new Et(e);return $r[this.model].keyword(this.color)},hex(e){if(e!==void 0)return new Et(e);return Li.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new Et(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();if(r.length===1)r="0"+r;return Li.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 Et.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 Et.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($r)){if(G$.includes(e))continue;let{channels:t}=$r[e];Et.prototype[e]=function(...r){if(this.model===e)return new Et(this);if(r.length>0)return new Et(r,e);return new Et([...s2($r[this.model][e].raw(this.color)),this.valpha],e)},Et[e]=function(...r){let n=r[0];if(typeof n==="number")n=bd(r,t);return new Et(n,e)}}function r2(e,t){return Number(e.toFixed(t))}function n2(e){return function(t){return r2(t,e)}}function nt(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(yd[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 wt(e){return function(t){return Math.max(0,Math.min(e,t))}}function s2(e){return Array.isArray(e)?e:[e]}function bd(e,t){for(let r=0;r<t;r++)if(typeof e[r]!=="number")e[r]=0;return e}var i2=Et});var Z$=C(function(UK,X$){X$.exports=Y$().default});function o2(e){return this._setBackgroundColourOption("tint",e),this}function a2(e){return this.options.greyscale=f.bool(e)?e:!0,this}function l2(e){return this.greyscale(e)}function c2(e){if(!f.string(e))throw f.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function u2(e){return this.pipelineColourspace(e)}function f2(e){if(!f.string(e))throw f.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function d2(e){return this.toColourspace(e)}function tv(e){if(f.object(e)||f.string(e)&&e.length>=3&&e.length<=200){let t=ev.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(!f.number(a))throw f.invalidParameterError(`background.${o}`,"number",a);return[r,n,s,i]}else throw f.invalidParameterError("background","object or string",e)}function p2(e,t){if(f.defined(t))this.options[e]=tv(t)}var ev,Q$,rv=(e)=>{Object.assign(e.prototype,{tint:o2,greyscale:a2,grayscale:l2,pipelineColourspace:c2,pipelineColorspace:u2,toColourspace:f2,toColorspace:d2,_getBackgroundColourOption:tv,_setBackgroundColourOption:p2}),e.colourspace=Q$,e.colorspace=Q$};var nv=H(()=>{Gr();ev=Yt(Z$(),1);/*!
397
+ */VS={integer:"integer",float:"float",approximate:"approximate"}});var YS=N(function($re,KS){var{defineProperty:mh,getOwnPropertyDescriptor:G5,getOwnPropertyNames:K5}=Object,Y5=Object.prototype.hasOwnProperty,X5=(e,t)=>{for(var r in t)mh(e,r,{get:t[r],enumerable:!0})},Z5=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of K5(t))if(!Y5.call(e,s)&&s!==r)mh(e,s,{get:()=>t[s],enumerable:!(n=G5(t,s))||n.enumerable})}return e},Q5=(e)=>Z5(mh({},"__esModule",{value:!0}),e),BS={};X5(BS,{default:()=>pq});KS.exports=Q5(BS);var uh={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 uh)Object.freeze(uh[e]);var Mn=Object.freeze(uh),US=Object.create(null);for(let e in Mn)if(Object.hasOwn(Mn,e))US[Mn[e]]=e;var Pr={to:{},get:{}};Pr.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=Pr.get.hsl(e),n="hsl";break}case"hwb":{r=Pr.get.hwb(e),n="hwb";break}default:{r=Pr.get.rgb(e),n="rgb";break}}if(!r)return null;return{model:n,value:r}};Pr.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 u=l*2;o[l]=Number.parseInt(a.slice(u,u+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(Mn,a[1]))return null;return o=Mn[a[1]].slice(),o[3]=1,o}else return null;for(l=0;l<3;l++)o[l]=Zs(o[l],0,255);return o[3]=Zs(o[3],0,1),o};Pr.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=Zs(Number.parseFloat(r[2]),0,100),o=Zs(Number.parseFloat(r[3]),0,100),a=Zs(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Pr.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=Zs(Number.parseFloat(r[2]),0,100),o=Zs(Number.parseFloat(r[3]),0,100),a=Zs(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Pr.to.hex=function(...e){return"#"+ff(e[0])+ff(e[1])+ff(e[2])+(e[3]<1?ff(Math.round(e[3]*255)):"")};Pr.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]+")"};Pr.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]+")"};Pr.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]+")"};Pr.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+")"};Pr.to.keyword=function(...e){return US[e.slice(0,3)]};function Zs(e,t,r){return Math.min(Math.max(t,e),r)}function ff(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var aa=Pr,zS={};for(let e of Object.keys(Mn))zS[Mn[e]]=e;var Q={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"]}},io=Q,ks=0.008856451679035631;function ca(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 ua(e){return e>0.04045?((e+0.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(Q)){if(!("channels"in Q[e]))throw Error("missing channels property: "+e);if(!("labels"in Q[e]))throw Error("missing channel labels property: "+e);if(Q[e].labels.length!==Q[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=Q[e];delete Q[e].channels,delete Q[e].labels,Object.defineProperty(Q[e],"channels",{value:t}),Object.defineProperty(Q[e],"labels",{value:r})}Q.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]};Q.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),u=c-Math.min(o,a,l),p=function(h){return(c-h)/6/u+0.5};if(u===0)s=0,i=0;else{switch(i=u/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]};Q.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],s=Q.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]};Q.rgb.oklab=function(e){let t=ua(e[0]/255),r=ua(e[1]/255),n=ua(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]};Q.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 eq(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Q.rgb.keyword=function(e){let t=zS[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let s of Object.keys(Mn)){let i=Mn[s],o=eq(e,i);if(o<r)r=o,n=s}return n};Q.keyword.rgb=function(e){return[...Mn[e]]};Q.rgb.xyz=function(e){let t=ua(e[0]/255),r=ua(e[1]/255),n=ua(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]};Q.rgb.lab=function(e){let t=Q.rgb.xyz(e),r=t[0],n=t[1],s=t[2];r/=95.047,n/=100,s/=108.883,r=r>ks?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>ks?n**0.3333333333333333:7.787*n+0.13793103448275862,s=s>ks?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]};Q.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};Q.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]};Q.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]}};Q.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]};Q.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,u,p;switch(o){default:case 6:case 0:{c=a,u=l,p=r;break}case 1:{c=l,u=a,p=r;break}case 2:{c=r,u=a,p=l;break}case 3:{c=r,u=l,p=a;break}case 4:{c=l,u=r,p=a;break}case 5:{c=a,u=r,p=l;break}}return[c*255,u*255,p*255]};Q.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]};Q.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=ca(s),i=ca(i),o=ca(o),[s*255,i*255,o*255]};Q.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>ks?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>ks?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>ks?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]};Q.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]};Q.oklab.oklch=function(e){return Q.lab.lch(e)};Q.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]};Q.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=ca(4.0767416621*s-3.3077115913*i+0.2309699292*o),l=ca(-1.2684380046*s+2.6097574011*i-0.3413193965*o),c=ca(-0.0041960863*s-0.7034186147*i+1.707614701*o);return[a*255,l*255,c*255]};Q.oklch.oklab=function(e){return Q.lch.lab(e)};Q.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>ks?a:(i-0.13793103448275862)/7.787,s=l>ks?l:(s-0.13793103448275862)/7.787,o=c>ks?c:(o-0.13793103448275862)/7.787,s*=95.047,i*=100,o*=108.883,[s,i,o]};Q.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]};Q.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]};Q.rgb.ansi16=function(e,t=null){let[r,n,s]=e,i=t===null?Q.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};Q.hsv.ansi16=function(e){return Q.rgb.ansi16(Q.hsv.rgb(e),e[2])};Q.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)};Q.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]};Q.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]};Q.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};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};Q.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};Q.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};Q.gray.hsl=function(e){return[0,0,e[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(e){return[0,100,e[0]]};Q.gray.cmyk=function(e){return[0,0,0,e[0]]};Q.gray.lab=function(e){return[e[0],0,0]};Q.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};Q.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function tq(){let e={},t=Object.keys(io);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function rq(e){let t=tq(),r=[e];t[e].distance=0;while(r.length>0){let n=r.pop(),s=Object.keys(io[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 nq(e,t){return function(r){return t(e(r))}}function sq(e,t){let r=[t[e].parent,e],n=io[t[e].parent][e],s=t[e].parent;while(t[s].parent)r.unshift(t[s].parent),n=nq(io[t[s].parent][s],n),s=t[s].parent;return n.conversion=r,n}function iq(e){let t=rq(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]=sq(o,t)}return r}var oq=iq,la={},aq=Object.keys(io);function lq(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 cq(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 aq){la[e]={},Object.defineProperty(la[e],"channels",{value:io[e].channels}),Object.defineProperty(la[e],"labels",{value:io[e].labels});let t=oq(e),r=Object.keys(t);for(let n of r){let s=t[n];la[e][n]=cq(s),la[e][n].raw=lq(s)}}var Wr=la,GS=["keyword","gray","hex"],fh={};for(let e of Object.keys(Wr))fh[[...Wr[e].labels].sort().join("")]=e;var dh={};function Lt(e,t){if(!(this instanceof Lt))return new Lt(e,t);if(t&&t in GS)t=null;if(t&&!(t in Wr))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 Lt)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==="string"){let s=aa.get(e);if(s===null)throw Error("Unable to parse color from string: "+e);this.model=s.model,n=Wr[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=Wr[this.model].channels;let s=Array.prototype.slice.call(e,0,n);this.color=ph(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 fh))throw Error("Unable to parse color from object: "+JSON.stringify(e));this.model=fh[i];let{labels:o}=Wr[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=ph(a)}if(dh[this.model]){n=Wr[this.model].channels;for(r=0;r<n;r++){let s=dh[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)}Lt.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in aa.to?this:this.rgb();t=t.round(typeof e==="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return aa.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 aa.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=Wr[this.model],{labels:r}=Wr[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 Lt([...this.color.map(fq(e)),this.valpha],this.model)},alpha(e){if(e!==void 0)return new Lt([...this.color,Math.max(0,Math.min(1,e))],this.model);return this.valpha},red:pt("rgb",0,Mt(255)),green:pt("rgb",1,Mt(255)),blue:pt("rgb",2,Mt(255)),hue:pt(["hsl","hsv","hsl","hwb","hcg"],0,(e)=>(e%360+360)%360),saturationl:pt("hsl",1,Mt(100)),lightness:pt("hsl",2,Mt(100)),saturationv:pt("hsv",1,Mt(100)),value:pt("hsv",2,Mt(100)),chroma:pt("hcg",1,Mt(100)),gray:pt("hcg",2,Mt(100)),white:pt("hwb",1,Mt(100)),wblack:pt("hwb",2,Mt(100)),cyan:pt("cmyk",0,Mt(100)),magenta:pt("cmyk",1,Mt(100)),yellow:pt("cmyk",2,Mt(100)),black:pt("cmyk",3,Mt(100)),x:pt("xyz",0,Mt(95.047)),y:pt("xyz",1,Mt(100)),z:pt("xyz",2,Mt(108.833)),l:pt("lab",0,Mt(100)),a:pt("lab",1),b:pt("lab",2),keyword(e){if(e!==void 0)return new Lt(e);return Wr[this.model].keyword(this.color)},hex(e){if(e!==void 0)return new Lt(e);return aa.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new Lt(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();if(r.length===1)r="0"+r;return aa.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 Lt.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 Lt.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(Wr)){if(GS.includes(e))continue;let{channels:t}=Wr[e];Lt.prototype[e]=function(...r){if(this.model===e)return new Lt(this);if(r.length>0)return new Lt(r,e);return new Lt([...dq(Wr[this.model][e].raw(this.color)),this.valpha],e)},Lt[e]=function(...r){let n=r[0];if(typeof n==="number")n=ph(r,t);return new Lt(n,e)}}function uq(e,t){return Number(e.toFixed(t))}function fq(e){return function(t){return uq(t,e)}}function pt(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(dh[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 Mt(e){return function(t){return Math.max(0,Math.min(e,t))}}function dq(e){return Array.isArray(e)?e:[e]}function ph(e,t){for(let r=0;r<t;r++)if(typeof e[r]!=="number")e[r]=0;return e}var pq=Lt});var ZS=N(function(wre,XS){XS.exports=YS().default});function mq(e){return this._setBackgroundColourOption("tint",e),this}function hq(e){return this.options.greyscale=f.bool(e)?e:!0,this}function gq(e){return this.greyscale(e)}function yq(e){if(!f.string(e))throw f.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function bq(e){return this.pipelineColourspace(e)}function xq(e){if(!f.string(e))throw f.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function $q(e){return this.toColourspace(e)}function tE(e){if(f.object(e)||f.string(e)&&e.length>=3&&e.length<=200){let t=eE.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(!f.number(a))throw f.invalidParameterError(`background.${o}`,"number",a);return[r,n,s,i]}else throw f.invalidParameterError("background","object or string",e)}function wq(e,t){if(f.defined(t))this.options[e]=tE(t)}var eE,QS,rE=(e)=>{Object.assign(e.prototype,{tint:mq,greyscale:hq,grayscale:gq,pipelineColourspace:yq,pipelineColorspace:bq,toColourspace:xq,toColorspace:$q,_getBackgroundColourOption:tE,_setBackgroundColourOption:wq}),e.colourspace=QS,e.colorspace=QS};var nE=D(()=>{On();eE=gr(ZS(),1);/*!
354
398
  Copyright 2013 Lovell Fuller and others.
355
399
  SPDX-License-Identifier: Apache-2.0
356
- */Q$={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"}});function h2(){return this.options.removeAlpha=!0,this}function g2(e){if(f.defined(e))if(f.number(e)&&f.inRange(e,0,1))this.options.ensureAlpha=e;else throw f.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function y2(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e))e=t[e];if(f.integer(e)&&f.inRange(e,0,4))this.options.extractChannel=e;else throw f.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function b2(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 x2(e){if(f.string(e)&&f.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw f.invalidParameterError("boolOp","one of: and, or, eor",e);return this}var m2,sv=(e)=>{Object.assign(e.prototype,{removeAlpha:h2,ensureAlpha:g2,extractChannel:y2,joinChannel:b2,bandbool:x2}),e.bool=m2};var iv=H(()=>{Gr();/*!
400
+ */QS={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"}});function Sq(){return this.options.removeAlpha=!0,this}function Eq(e){if(f.defined(e))if(f.number(e)&&f.inRange(e,0,1))this.options.ensureAlpha=e;else throw f.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function Pq(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e))e=t[e];if(f.integer(e)&&f.inRange(e,0,4))this.options.extractChannel=e;else throw f.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function jq(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 kq(e){if(f.string(e)&&f.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw f.invalidParameterError("boolOp","one of: and, or, eor",e);return this}var vq,sE=(e)=>{Object.assign(e.prototype,{removeAlpha:Sq,ensureAlpha:Eq,extractChannel:Pq,joinChannel:jq,bandbool:kq}),e.bool=vq};var iE=D(()=>{On();/*!
357
401
  Copyright 2013 Lovell Fuller and others.
358
402
  SPDX-License-Identifier: Apache-2.0
359
- */m2={and:"and",or:"or",eor:"eor"}});import $d from"node:path";function v2(e,t){let r;if(!f.string(e))r=Error("Missing output file path");else if(f.string(this.options.input.file)&&$d.resolve(this.options.input.file)===$d.resolve(e))r=Error("Cannot use same file for input and output");else if($2.test($d.extname(e))&&!this.constructor.format.jp2.output.file)r=av();if(r)if(f.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 w2(e,t){if(f.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(f.fn(e)?e:t,r)}function S2(){this.options.resolveWithObject=!0,this.options.typedArrayOut=!0;let e=Error();return this._pipeline(null,e)}function E2(e){if(f.number(e)&&e>0)this.options.withMetadataDensity=e;else throw f.invalidParameterError("density","positive number",e);return this.keepExif()}function P2(){return this.options.keepMetadata|=1,this}function j2(e){if(f.object(e))for(let[t,r]of Object.entries(e))if(f.object(r))for(let[n,s]of Object.entries(r))if(f.string(s))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=s;else throw f.invalidParameterError(`${t}.${n}`,"string",s);else throw f.invalidParameterError(t,"object",r);else throw f.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function k2(e){return this.withExif(e),this.options.withExifMerge=!0,this}function _2(){return this.options.keepMetadata|=8,this}function R2(e,t){if(f.string(e))this.options.withIccProfile=e;else throw f.invalidParameterError("icc","string",e);if(this.keepIccProfile(),f.object(t)){if(f.defined(t.attach))if(f.bool(t.attach)){if(!t.attach)this.options.keepMetadata&=-9}else throw f.invalidParameterError("attach","boolean",t.attach)}return this}function A2(){return this.options.keepGainMap=!0,this.options.withGainMap=!1,this.options.keepMetadata|=32,this}function O2(){return this.options.withGainMap=!0,this.options.keepGainMap=!1,this.options.colourspace="scrgb",this}function C2(){return this.options.keepMetadata|=2,this}function N2(e){if(f.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw f.invalidParameterError("xmp","non-empty string",e);return this}function T2(){return this.options.keepMetadata|=31,this}function I2(e){if(this.keepMetadata(),this.withIccProfile("srgb"),f.object(e)){if(f.defined(e.orientation))if(f.integer(e.orientation)&&f.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw f.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(f.defined(e.density))if(f.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw f.invalidParameterError("density","positive number",e.density);if(f.defined(e.icc))this.withIccProfile(e.icc);if(f.defined(e.exif))this.withExifMerge(e.exif)}return this}function M2(e,t){let r=ov.get((f.object(e)&&f.string(e.id)?e.id:e).toLowerCase());if(!r)throw f.invalidParameterError("format",`one of: ${[...ov.keys()].join(", ")}`,e);return this[r](t)}function J2(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.progressive))this._setBooleanOption("jpegProgressive",e.progressive);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=f.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(f.defined(t))this._setBooleanOption("jpegOptimiseCoding",t);if(f.defined(e.mozjpeg))if(f.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 f.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=f.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;if(f.defined(r))this._setBooleanOption("jpegTrellisQuantisation",r);if(f.defined(e.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=f.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;if(f.defined(n)){if(this._setBooleanOption("jpegOptimiseScans",n),n)this.options.jpegProgressive=!0}let s=f.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(f.defined(s))if(f.integer(s)&&f.inRange(s,0,8))this.options.jpegQuantisationTable=s;else throw f.invalidParameterError("quantisationTable","integer between 0 and 8",s)}return this._updateFormatOut("jpeg",e)}function D2(e){if(f.object(e)){if(f.defined(e.progressive))this._setBooleanOption("pngProgressive",e.progressive);if(f.defined(e.compressionLevel))if(f.integer(e.compressionLevel)&&f.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw f.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);if(f.defined(e.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(f.defined(t))if(f.integer(t)&&f.inRange(t,2,256))this.options.pngBitdepth=lv(t);else throw f.invalidParameterError("colours","integer between 2 and 256",t);if(f.defined(e.palette))this._setBooleanOption("pngPalette",e.palette);else if([e.quality,e.effort,e.colours,e.colors,e.dither].some(f.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw f.invalidParameterError("quality","integer between 0 and 100",e.quality);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 10",e.effort);if(f.defined(e.dither))if(f.number(e.dither)&&f.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw f.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function L2(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.alphaQuality))if(f.integer(e.alphaQuality)&&f.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw f.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(f.defined(e.lossless))this._setBooleanOption("webpLossless",e.lossless);if(f.defined(e.nearLossless))this._setBooleanOption("webpNearLossless",e.nearLossless);if(f.defined(e.smartSubsample))this._setBooleanOption("webpSmartSubsample",e.smartSubsample);if(f.defined(e.smartDeblock))this._setBooleanOption("webpSmartDeblock",e.smartDeblock);if(f.defined(e.preset))if(f.string(e.preset)&&f.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw f.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw f.invalidParameterError("effort","integer between 0 and 6",e.effort);if(f.defined(e.minSize))this._setBooleanOption("webpMinSize",e.minSize);if(f.defined(e.mixed))this._setBooleanOption("webpMixed",e.mixed);if(f.defined(e.exact))this._setBooleanOption("webpExact",e.exact)}return vd(e,this.options),this._updateFormatOut("webp",e)}function F2(e){if(f.object(e)){if(f.defined(e.reuse))this._setBooleanOption("gifReuse",e.reuse);if(f.defined(e.progressive))this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(f.defined(t))if(f.integer(t)&&f.inRange(t,2,256))this.options.gifBitdepth=lv(t);else throw f.invalidParameterError("colours","integer between 2 and 256",t);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 10",e.effort);if(f.defined(e.dither))if(f.number(e.dither)&&f.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw f.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(f.defined(e.interFrameMaxError))if(f.number(e.interFrameMaxError)&&f.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw f.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(f.defined(e.interPaletteMaxError))if(f.number(e.interPaletteMaxError)&&f.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw f.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(f.defined(e.keepDuplicateFrames))if(f.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw f.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return vd(e,this.options),this._updateFormatOut("gif",e)}function q2(e){if(!this.constructor.format.jp2.output.buffer)throw av();if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.tileWidth))if(f.integer(e.tileWidth)&&f.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw f.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(f.defined(e.tileHeight))if(f.integer(e.tileHeight)&&f.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw f.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function vd(e,t){if(f.object(e)&&f.defined(e.loop))if(f.integer(e.loop)&&f.inRange(e.loop,0,65535))t.loop=e.loop;else throw f.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(f.object(e)&&f.defined(e.delay))if(f.integer(e.delay)&&f.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&f.inRange(e.delay.length,1,1e6)&&e.delay.every(f.integer)&&e.delay.every((r)=>f.inRange(r,0,65535)))t.delay=e.delay;else throw f.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function H2(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.bitdepth))if(f.integer(e.bitdepth)&&f.inArray(e.bitdepth,[1,2,4]))this.options.tiffBitdepth=e.bitdepth;else throw f.invalidParameterError("bitdepth","1, 2 or 4",e.bitdepth);if(f.defined(e.tile))this._setBooleanOption("tiffTile",e.tile);if(f.defined(e.tileWidth))if(f.integer(e.tileWidth)&&f.inRange(e.tileWidth,1,32768))this.options.tiffTileWidth=e.tileWidth;else throw f.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(f.defined(e.tileHeight))if(f.integer(e.tileHeight)&&f.inRange(e.tileHeight,1,32768))this.options.tiffTileHeight=e.tileHeight;else throw f.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(f.defined(e.miniswhite))this._setBooleanOption("tiffMiniswhite",e.miniswhite);if(f.defined(e.pyramid))this._setBooleanOption("tiffPyramid",e.pyramid);if(f.defined(e.xres))if(f.number(e.xres)&&f.inRange(e.xres,0.001,1e6))this.options.tiffXres=e.xres;else throw f.invalidParameterError("xres","number between 0.001 and 1000000",e.xres);if(f.defined(e.yres))if(f.number(e.yres)&&f.inRange(e.yres,0.001,1e6))this.options.tiffYres=e.yres;else throw f.invalidParameterError("yres","number between 0.001 and 1000000",e.yres);if(f.defined(e.compression))if(f.string(e.compression)&&f.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw f.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(f.defined(e.bigtiff))this._setBooleanOption("tiffBigtiff",e.bigtiff);if(f.defined(e.predictor))if(f.string(e.predictor)&&f.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw f.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(f.defined(e.resolutionUnit))if(f.string(e.resolutionUnit)&&f.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw f.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function V2(e){return this.heif({...e,compression:"av1"})}function B2(e){if(f.object(e)){if(f.string(e.compression)&&f.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw f.invalidParameterError("compression","one of: av1, hevc",e.compression);if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.heifLossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw f.invalidParameterError("effort","integer between 0 and 9",e.effort);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(f.defined(e.bitdepth))if(f.integer(e.bitdepth)&&f.inArray(e.bitdepth,[8,10,12]))this.options.heifBitdepth=e.bitdepth;else throw f.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth);if(f.defined(e.tune))if(f.string(e.tune)&&f.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 f.invalidParameterError("tune","one of: auto, iq, psnr, ssim",e.tune)}else throw f.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function W2(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.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 f.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(f.defined(e.distance))if(f.number(e.distance)&&f.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw f.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(f.defined(e.decodingTier))if(f.integer(e.decodingTier)&&f.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw f.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 9",e.effort)}return vd(e,this.options),this._updateFormatOut("jxl",e)}function U2(e){if(f.object(e)){if(f.defined(e.depth))if(f.string(e.depth)&&f.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw f.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth)}return this._updateFormatOut("raw")}function z2(e){if(f.object(e)){if(f.defined(e.size))if(f.integer(e.size)&&f.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw f.invalidParameterError("size","integer between 1 and 8192",e.size);if(f.defined(e.overlap))if(f.integer(e.overlap)&&f.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw f.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw f.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(f.defined(e.container))if(f.string(e.container)&&f.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw f.invalidParameterError("container","one of: fs, zip",e.container);if(f.defined(e.layout))if(f.string(e.layout)&&f.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw f.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(f.defined(e.angle))if(f.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw f.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),f.defined(e.depth))if(f.string(e.depth)&&f.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw f.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(f.defined(e.skipBlanks))if(f.integer(e.skipBlanks)&&f.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw f.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else if(f.defined(e.layout)&&e.layout==="google")this.options.tileSkipBlanks=5;let t=f.bool(e.center)?e.center:e.centre;if(f.defined(t))this._setBooleanOption("tileCentre",t);if(f.defined(e.id))if(f.string(e.id))this.options.tileId=e.id;else throw f.invalidParameterError("id","string",e.id);if(f.defined(e.basename))if(f.string(e.basename))this.options.tileBasename=e.basename;else throw f.invalidParameterError("basename","string",e.basename)}if(f.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw f.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function G2(e){if(!f.plainObject(e))throw f.invalidParameterError("options","object",e);if(f.integer(e.seconds)&&f.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw f.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function K2(e,t){if(!(f.object(t)&&t.force===!1))this.options.formatOut=e;return this}function Y2(e,t){if(f.bool(t))this.options[e]=t;else throw f.invalidParameterError(e,"boolean",t)}function X2(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function Z2(e,t){if(typeof e==="function"){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ie.pipeline(this.options,(r,n,s)=>{if(r)e(f.nativeError(r,t));else e(null,n,s)})});else Ie.pipeline(this.options,(r,n,s)=>{if(r)e(f.nativeError(r,t));else e(null,n,s)});return this}else if(this.options.streamOut){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Ie.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",f.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))})});else Ie.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",f.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(),Ie.pipeline(this.options,(s,i,o)=>{if(s)n(f.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})});else return new Promise((r,n)=>{Ie.pipeline(this.options,(s,i,o)=>{if(s)n(f.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})}var ov,$2,av=()=>Error("JP2 output requires libvips with support for OpenJPEG"),lv=(e)=>1<<32-Math.clz32(Math.ceil(Math.log2(e))-1),cv=(e)=>{Object.assign(e.prototype,{toFile:v2,toBuffer:w2,toUint8Array:S2,withDensity:E2,keepExif:P2,withExif:j2,withExifMerge:k2,keepIccProfile:_2,withIccProfile:R2,keepGainMap:A2,withGainMap:O2,keepXmp:C2,withXmp:N2,keepMetadata:T2,withMetadata:I2,toFormat:M2,jpeg:J2,jp2:q2,png:D2,webp:L2,tiff:H2,avif:V2,heif:B2,jxl:W2,gif:F2,raw:U2,tile:z2,timeout:G2,_updateFormatOut:K2,_setBooleanOption:Y2,_read:X2,_pipeline:Z2})};var uv=H(()=>{Gr();ta();/*!
403
+ */vq={and:"and",or:"or",eor:"eor"}});import hh from"node:path";function Aq(e,t){let r;if(!f.string(e))r=Error("Missing output file path");else if(f.string(this.options.input.file)&&hh.resolve(this.options.input.file)===hh.resolve(e))r=Error("Cannot use same file for input and output");else if(_q.test(hh.extname(e))&&!this.constructor.format.jp2.output.file)r=aE();if(r)if(f.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 Rq(e,t){if(f.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(f.fn(e)?e:t,r)}function Oq(){this.options.resolveWithObject=!0,this.options.typedArrayOut=!0;let e=Error();return this._pipeline(null,e)}function Cq(e){if(f.number(e)&&e>0)this.options.withMetadataDensity=e;else throw f.invalidParameterError("density","positive number",e);return this.keepExif()}function Nq(){return this.options.keepMetadata|=1,this}function Tq(e){if(f.object(e))for(let[t,r]of Object.entries(e))if(f.object(r))for(let[n,s]of Object.entries(r))if(f.string(s))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=s;else throw f.invalidParameterError(`${t}.${n}`,"string",s);else throw f.invalidParameterError(t,"object",r);else throw f.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function Iq(e){return this.withExif(e),this.options.withExifMerge=!0,this}function Jq(){return this.options.keepMetadata|=8,this}function Mq(e,t){if(f.string(e))this.options.withIccProfile=e;else throw f.invalidParameterError("icc","string",e);if(this.keepIccProfile(),f.object(t)){if(f.defined(t.attach))if(f.bool(t.attach)){if(!t.attach)this.options.keepMetadata&=-9}else throw f.invalidParameterError("attach","boolean",t.attach)}return this}function Dq(){return this.options.keepGainMap=!0,this.options.withGainMap=!1,this.options.keepMetadata|=32,this}function Lq(){return this.options.withGainMap=!0,this.options.keepGainMap=!1,this.options.colourspace="scrgb",this}function Fq(){return this.options.keepMetadata|=2,this}function qq(e){if(f.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw f.invalidParameterError("xmp","non-empty string",e);return this}function Vq(){return this.options.keepMetadata|=31,this}function Wq(e){if(this.keepMetadata(),this.withIccProfile("srgb"),f.object(e)){if(f.defined(e.orientation))if(f.integer(e.orientation)&&f.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw f.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(f.defined(e.density))if(f.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw f.invalidParameterError("density","positive number",e.density);if(f.defined(e.icc))this.withIccProfile(e.icc);if(f.defined(e.exif))this.withExifMerge(e.exif)}return this}function Hq(e,t){let r=oE.get((f.object(e)&&f.string(e.id)?e.id:e).toLowerCase());if(!r)throw f.invalidParameterError("format",`one of: ${[...oE.keys()].join(", ")}`,e);return this[r](t)}function Bq(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.progressive))this._setBooleanOption("jpegProgressive",e.progressive);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=f.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(f.defined(t))this._setBooleanOption("jpegOptimiseCoding",t);if(f.defined(e.mozjpeg))if(f.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 f.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=f.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;if(f.defined(r))this._setBooleanOption("jpegTrellisQuantisation",r);if(f.defined(e.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=f.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;if(f.defined(n)){if(this._setBooleanOption("jpegOptimiseScans",n),n)this.options.jpegProgressive=!0}let s=f.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(f.defined(s))if(f.integer(s)&&f.inRange(s,0,8))this.options.jpegQuantisationTable=s;else throw f.invalidParameterError("quantisationTable","integer between 0 and 8",s)}return this._updateFormatOut("jpeg",e)}function Uq(e){if(f.object(e)){if(f.defined(e.progressive))this._setBooleanOption("pngProgressive",e.progressive);if(f.defined(e.compressionLevel))if(f.integer(e.compressionLevel)&&f.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw f.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);if(f.defined(e.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(f.defined(t))if(f.integer(t)&&f.inRange(t,2,256))this.options.pngBitdepth=lE(t);else throw f.invalidParameterError("colours","integer between 2 and 256",t);if(f.defined(e.palette))this._setBooleanOption("pngPalette",e.palette);else if([e.quality,e.effort,e.colours,e.colors,e.dither].some(f.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw f.invalidParameterError("quality","integer between 0 and 100",e.quality);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 10",e.effort);if(f.defined(e.dither))if(f.number(e.dither)&&f.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw f.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function zq(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.alphaQuality))if(f.integer(e.alphaQuality)&&f.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw f.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(f.defined(e.lossless))this._setBooleanOption("webpLossless",e.lossless);if(f.defined(e.nearLossless))this._setBooleanOption("webpNearLossless",e.nearLossless);if(f.defined(e.smartSubsample))this._setBooleanOption("webpSmartSubsample",e.smartSubsample);if(f.defined(e.smartDeblock))this._setBooleanOption("webpSmartDeblock",e.smartDeblock);if(f.defined(e.preset))if(f.string(e.preset)&&f.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw f.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw f.invalidParameterError("effort","integer between 0 and 6",e.effort);if(f.defined(e.minSize))this._setBooleanOption("webpMinSize",e.minSize);if(f.defined(e.mixed))this._setBooleanOption("webpMixed",e.mixed);if(f.defined(e.exact))this._setBooleanOption("webpExact",e.exact)}return gh(e,this.options),this._updateFormatOut("webp",e)}function Gq(e){if(f.object(e)){if(f.defined(e.reuse))this._setBooleanOption("gifReuse",e.reuse);if(f.defined(e.progressive))this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(f.defined(t))if(f.integer(t)&&f.inRange(t,2,256))this.options.gifBitdepth=lE(t);else throw f.invalidParameterError("colours","integer between 2 and 256",t);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 10",e.effort);if(f.defined(e.dither))if(f.number(e.dither)&&f.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw f.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(f.defined(e.interFrameMaxError))if(f.number(e.interFrameMaxError)&&f.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw f.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(f.defined(e.interPaletteMaxError))if(f.number(e.interPaletteMaxError)&&f.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw f.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(f.defined(e.keepDuplicateFrames))if(f.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw f.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return gh(e,this.options),this._updateFormatOut("gif",e)}function Kq(e){if(!this.constructor.format.jp2.output.buffer)throw aE();if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.tileWidth))if(f.integer(e.tileWidth)&&f.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw f.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(f.defined(e.tileHeight))if(f.integer(e.tileHeight)&&f.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw f.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function gh(e,t){if(f.object(e)&&f.defined(e.loop))if(f.integer(e.loop)&&f.inRange(e.loop,0,65535))t.loop=e.loop;else throw f.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(f.object(e)&&f.defined(e.delay))if(f.integer(e.delay)&&f.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&f.inRange(e.delay.length,1,1e6)&&e.delay.every(f.integer)&&e.delay.every((r)=>f.inRange(r,0,65535)))t.delay=e.delay;else throw f.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function Yq(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.bitdepth))if(f.integer(e.bitdepth)&&f.inArray(e.bitdepth,[1,2,4]))this.options.tiffBitdepth=e.bitdepth;else throw f.invalidParameterError("bitdepth","1, 2 or 4",e.bitdepth);if(f.defined(e.tile))this._setBooleanOption("tiffTile",e.tile);if(f.defined(e.tileWidth))if(f.integer(e.tileWidth)&&f.inRange(e.tileWidth,1,32768))this.options.tiffTileWidth=e.tileWidth;else throw f.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(f.defined(e.tileHeight))if(f.integer(e.tileHeight)&&f.inRange(e.tileHeight,1,32768))this.options.tiffTileHeight=e.tileHeight;else throw f.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(f.defined(e.miniswhite))this._setBooleanOption("tiffMiniswhite",e.miniswhite);if(f.defined(e.pyramid))this._setBooleanOption("tiffPyramid",e.pyramid);if(f.defined(e.xres))if(f.number(e.xres)&&f.inRange(e.xres,0.001,1e6))this.options.tiffXres=e.xres;else throw f.invalidParameterError("xres","number between 0.001 and 1000000",e.xres);if(f.defined(e.yres))if(f.number(e.yres)&&f.inRange(e.yres,0.001,1e6))this.options.tiffYres=e.yres;else throw f.invalidParameterError("yres","number between 0.001 and 1000000",e.yres);if(f.defined(e.compression))if(f.string(e.compression)&&f.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw f.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(f.defined(e.bigtiff))this._setBooleanOption("tiffBigtiff",e.bigtiff);if(f.defined(e.predictor))if(f.string(e.predictor)&&f.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw f.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(f.defined(e.resolutionUnit))if(f.string(e.resolutionUnit)&&f.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw f.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function Xq(e){return this.heif({...e,compression:"av1"})}function Zq(e){if(f.object(e)){if(f.string(e.compression)&&f.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw f.invalidParameterError("compression","one of: av1, hevc",e.compression);if(f.defined(e.quality))if(f.integer(e.quality)&&f.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw f.invalidParameterError("quality","integer between 1 and 100",e.quality);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.heifLossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw f.invalidParameterError("effort","integer between 0 and 9",e.effort);if(f.defined(e.chromaSubsampling))if(f.string(e.chromaSubsampling)&&f.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw f.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(f.defined(e.bitdepth))if(f.integer(e.bitdepth)&&f.inArray(e.bitdepth,[8,10,12]))this.options.heifBitdepth=e.bitdepth;else throw f.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth);if(f.defined(e.tune))if(f.string(e.tune)&&f.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 f.invalidParameterError("tune","one of: auto, iq, psnr, ssim",e.tune)}else throw f.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function Qq(e){if(f.object(e)){if(f.defined(e.quality))if(f.integer(e.quality)&&f.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 f.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(f.defined(e.distance))if(f.number(e.distance)&&f.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw f.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(f.defined(e.decodingTier))if(f.integer(e.decodingTier)&&f.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw f.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(f.defined(e.lossless))if(f.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw f.invalidParameterError("lossless","boolean",e.lossless);if(f.defined(e.effort))if(f.integer(e.effort)&&f.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw f.invalidParameterError("effort","integer between 1 and 9",e.effort)}return gh(e,this.options),this._updateFormatOut("jxl",e)}function e3(e){if(f.object(e)){if(f.defined(e.depth))if(f.string(e.depth)&&f.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw f.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth)}return this._updateFormatOut("raw")}function t3(e){if(f.object(e)){if(f.defined(e.size))if(f.integer(e.size)&&f.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw f.invalidParameterError("size","integer between 1 and 8192",e.size);if(f.defined(e.overlap))if(f.integer(e.overlap)&&f.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw f.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw f.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(f.defined(e.container))if(f.string(e.container)&&f.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw f.invalidParameterError("container","one of: fs, zip",e.container);if(f.defined(e.layout))if(f.string(e.layout)&&f.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw f.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(f.defined(e.angle))if(f.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw f.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),f.defined(e.depth))if(f.string(e.depth)&&f.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw f.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(f.defined(e.skipBlanks))if(f.integer(e.skipBlanks)&&f.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw f.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else if(f.defined(e.layout)&&e.layout==="google")this.options.tileSkipBlanks=5;let t=f.bool(e.center)?e.center:e.centre;if(f.defined(t))this._setBooleanOption("tileCentre",t);if(f.defined(e.id))if(f.string(e.id))this.options.tileId=e.id;else throw f.invalidParameterError("id","string",e.id);if(f.defined(e.basename))if(f.string(e.basename))this.options.tileBasename=e.basename;else throw f.invalidParameterError("basename","string",e.basename)}if(f.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw f.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function r3(e){if(!f.plainObject(e))throw f.invalidParameterError("options","object",e);if(f.integer(e.seconds)&&f.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw f.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function n3(e,t){if(!(f.object(t)&&t.force===!1))this.options.formatOut=e;return this}function s3(e,t){if(f.bool(t))this.options[e]=t;else throw f.invalidParameterError(e,"boolean",t)}function i3(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function o3(e,t){if(typeof e==="function"){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),qe.pipeline(this.options,(r,n,s)=>{if(r)e(f.nativeError(r,t));else e(null,n,s)})});else qe.pipeline(this.options,(r,n,s)=>{if(r)e(f.nativeError(r,t));else e(null,n,s)});return this}else if(this.options.streamOut){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),qe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",f.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))})});else qe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",f.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(),qe.pipeline(this.options,(s,i,o)=>{if(s)n(f.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})});else return new Promise((r,n)=>{qe.pipeline(this.options,(s,i,o)=>{if(s)n(f.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})}var oE,_q,aE=()=>Error("JP2 output requires libvips with support for OpenJPEG"),lE=(e)=>1<<32-Math.clz32(Math.ceil(Math.log2(e))-1),cE=(e)=>{Object.assign(e.prototype,{toFile:Aq,toBuffer:Rq,toUint8Array:Oq,withDensity:Cq,keepExif:Nq,withExif:Tq,withExifMerge:Iq,keepIccProfile:Jq,withIccProfile:Mq,keepGainMap:Dq,withGainMap:Lq,keepXmp:Fq,withXmp:qq,keepMetadata:Vq,withMetadata:Wq,toFormat:Hq,jpeg:Bq,jp2:Kq,png:Uq,webp:zq,tiff:Yq,avif:Xq,heif:Zq,jxl:Qq,gif:Gq,raw:e3,tile:t3,timeout:r3,_updateFormatOut:n3,_setBooleanOption:s3,_read:i3,_pipeline:o3})};var uE=D(()=>{On();Jl();/*!
360
404
  Copyright 2013 Lovell Fuller and others.
361
405
  SPDX-License-Identifier: Apache-2.0
362
- */ov=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"]]),$2=/\.(jp[2x]|j2[kc])$/i});import Q2 from"node:events";import{createRequire as eD}from"node:module";import{availableParallelism as tD}from"node:os";function dv(e){if(f.bool(e))if(e)return Ie.cache(50,20,100);else return Ie.cache(0,0,0);else if(f.object(e)){for(let t of["memory","files","items"]){let r=e[t];if(f.defined(r)&&!(f.integer(r)&&r>=0))throw f.invalidParameterError(t,"a positive integer",r)}return Ie.cache(e.memory,e.files,e.items)}else return Ie.cache()}function nD(e){return Ie.concurrency(f.integer(e)?e:null)}function iD(){return Ie.counters()}function oD(e){return Ie.simd(f.bool(e)?e:null)}function aD(e){if(f.object(e))if(Array.isArray(e.operation)&&e.operation.every(f.string))Ie.block(e.operation,!0);else throw f.invalidParameterError("operation","Array<string>",e.operation);else throw f.invalidParameterError("options","object",e)}function lD(e){if(f.object(e))if(Array.isArray(e.operation)&&e.operation.every(f.string))Ie.block(e.operation,!1);else throw f.invalidParameterError("operation","Array<string>",e.operation);else throw f.invalidParameterError("options","object",e)}var ra,wd,fv,Sd,as,rD,Vi,sD,pv=(e)=>{e.cache=dv,e.concurrency=nD,e.counters=iD,e.simd=oD,e.format=as,e.interpolators=rD,e.versions=Vi,e.queue=sD,e.block=aD,e.unblock=lD};var mv=H(()=>{Gr();ud();ta();Kl();ra=Yt(Cl(),1);/*!
406
+ */oE=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"]]),_q=/\.(jp[2x]|j2[kc])$/i});import a3 from"node:events";import{createRequire as l3}from"node:module";import{availableParallelism as c3}from"node:os";function dE(e){if(f.bool(e))if(e)return qe.cache(50,20,100);else return qe.cache(0,0,0);else if(f.object(e)){for(let t of["memory","files","items"]){let r=e[t];if(f.defined(r)&&!(f.integer(r)&&r>=0))throw f.invalidParameterError(t,"a positive integer",r)}return qe.cache(e.memory,e.files,e.items)}else return qe.cache()}function f3(e){return qe.concurrency(f.integer(e)?e:null)}function p3(){return qe.counters()}function m3(e){return qe.simd(f.bool(e)?e:null)}function h3(e){if(f.object(e))if(Array.isArray(e.operation)&&e.operation.every(f.string))qe.block(e.operation,!0);else throw f.invalidParameterError("operation","Array<string>",e.operation);else throw f.invalidParameterError("options","object",e)}function g3(e){if(f.object(e))if(Array.isArray(e.operation)&&e.operation.every(f.string))qe.block(e.operation,!1);else throw f.invalidParameterError("operation","Array<string>",e.operation);else throw f.invalidParameterError("options","object",e)}var Ml,yh,fE,bh,Qs,u3,fa,d3,pE=(e)=>{e.cache=dE,e.concurrency=f3,e.counters=p3,e.simd=m3,e.format=Qs,e.interpolators=u3,e.versions=fa,e.queue=d3,e.block=h3,e.unblock=g3};var mE=D(()=>{On();ih();Jl();af();Ml=gr(Wu(),1);/*!
363
407
  Copyright 2013 Lovell Fuller and others.
364
408
  SPDX-License-Identifier: Apache-2.0
365
- */wd=eD(import.meta.url),fv=Yl.runtimePlatformArch(),Sd=Ie.libvipsVersion(),as=Ie.format();as.heif.output.alias=["avif","heic"];as.jpeg.output.alias=["jpe","jpg"];as.tiff.output.alias=["tif"];as.jp2.output.alias=["j2c","j2k","jp2","jpx"];rD={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},Vi={vips:Sd.semver};if(!Sd.isGlobal)if(!Sd.isWasm)try{Vi=wd(`@img/sharp-${fv}/versions`)}catch(e){try{Vi=wd(`@img/sharp-libvips-${fv}/versions`)}catch(t){}}else try{Vi=wd("@img/sharp-wasm32/versions")}catch(e){}Vi.sharp=Dn.version;if(Vi.heif&&as.heif)as.heif.input.fileSuffix=[".avif"],as.heif.output.alias=["avif"];dv(!0);if(!process.env.MALLOC_ARENA_MAX&&ra.default.familySync()===ra.default.GLIBC&&!Ie._isUsingJemalloc())Ie.concurrency(1);else if(ra.default.familySync()===ra.default.MUSL&&Ie.concurrency()===1024)Ie.concurrency(tD());sD=new Q2.EventEmitter});var cD;var hv=H(()=>{A$();N$();L$();q$();B$();nv();iv();uv();mv();/*!
409
+ */yh=l3(import.meta.url),fE=lf.runtimePlatformArch(),bh=qe.libvipsVersion(),Qs=qe.format();Qs.heif.output.alias=["avif","heic"];Qs.jpeg.output.alias=["jpe","jpg"];Qs.tiff.output.alias=["tif"];Qs.jp2.output.alias=["j2c","j2k","jp2","jpx"];u3={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},fa={vips:bh.semver};if(!bh.isGlobal)if(!bh.isWasm)try{fa=yh(`@img/sharp-${fE}/versions`)}catch(e){try{fa=yh(`@img/sharp-libvips-${fE}/versions`)}catch(t){}}else try{fa=yh("@img/sharp-wasm32/versions")}catch(e){}fa.sharp=Ps.version;if(fa.heif&&Qs.heif)Qs.heif.input.fileSuffix=[".avif"],Qs.heif.output.alias=["avif"];dE(!0);if(!process.env.MALLOC_ARENA_MAX&&Ml.default.familySync()===Ml.default.GLIBC&&!qe._isUsingJemalloc())qe.concurrency(1);else if(Ml.default.familySync()===Ml.default.MUSL&&qe.concurrency()===1024)qe.concurrency(c3());d3=new a3.EventEmitter});var y3;var hE=D(()=>{RS();NS();LS();qS();HS();nE();iE();uE();mE();/*!
366
410
  Copyright 2013 Lovell Fuller and others.
367
411
  SPDX-License-Identifier: Apache-2.0
368
- */C$(Qr);D$(Qr);F$(Qr);V$(Qr);rv(Qr);sv(Qr);cv(Qr);pv(Qr);cD=Qr});import{createHash as gv}from"node:crypto";import{existsSync as uD,mkdirSync as fD,readFileSync as dD}from"node:fs";import{basename as pD,extname as mD,resolve as Ed}from"node:path";import{createRequire as hD}from"node:module";async function yv(){if(Bi)return Bi;try{let e=await Promise.resolve().then(() => (hv(),{}));return Bi=cD,Bi}catch{}try{return Bi=hD(Ed(process.cwd(),"package.json"))("sharp"),Bi}catch(e){throw Error(`Sharp is required for image optimization but failed to load: ${ke(e)}`,{cause:e})}}async function Pd(e){let r=await(await yv())(e).metadata();return{format:r.format??"unknown",height:r.height??0,width:r.width??0}}function na(e){let t=dD(e);return gv("md5").update(t).digest("hex").slice(0,8)}function jd(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:yD,widths:e.widths});return gv("md5").update(t).digest("hex").slice(0,8)}function bD(e,t,r,n){return`${e}-${t}-${r}.${n}`}async function bv(e,t,r){let n=await yv(),s=await Pd(e),i=na(e),o=pD(e,mD(e)),a=Ed(t,"_optimized");fD(a,{recursive:!0});let l=[],c=r.widths.length>0?Math.max(...r.widths):s.width,u=r.widths.filter((m)=>m<=s.width);if(s.width<c&&!u.includes(s.width))u.push(s.width);if(u.length===0)u.push(s.width);u.sort((m,b)=>m-b);let p=[];for(let m of u)for(let b of r.formats){let h=bD(o,m,i,b),y=`/${gD}/${h}`,v=Ed(a,h);if(l.push({absolutePath:v,format:b,outputPath:y,width:m}),uD(v))continue;let k=r.quality[b]??80,S=n(e).resize(m).toFormat(b,{quality:k}).toFile(v).then(()=>{});p.push(S)}let g=4;for(let m=0;m<p.length;m+=g)await Promise.all(p.slice(m,m+g));return{contentHash:i,original:{format:s.format,height:s.height,width:s.width},variants:l}}function xv(e,t){return e.flatMap((r)=>r.format===t?[`${r.outputPath} ${r.width}w`]:[]).join(", ")}var Bi=null,gD="images/_optimized",yD=2;var kd=H(()=>{hr()});import{existsSync as xD,mkdirSync as $D,readFileSync as vD,rmSync as wD,writeFileSync as SD}from"node:fs";import{basename as ED,resolve as tc}from"node:path";import{execSync as PD}from"node:child_process";import{tmpdir as jD}from"node:os";function _D(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=PD("npm config get cache",{cwd:jD(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:kD}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function Wi(e){if(ec===void 0)ec=_D();if(ec)return tc(ec,"jxsuite-images",ED(e));return tc(e,".cache/images")}function $v(e){let t=tc(Wi(e),"manifest.json");if(!xD(t))return{entries:{},touched:new Set,version:1};try{let r=JSON.parse(vD(t,"utf8"));return r.touched=new Set,r}catch{return{entries:{},touched:new Set,version:1}}}function vv(e,t,r={}){if(r.prune&&t.touched)RD(t,t.touched);let n=Wi(e);$D(n,{recursive:!0}),SD(tc(n,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function RD(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))wD(o.absolutePath,{force:!0});delete e.entries[s]}}function wv(e,t){e.touched?.add(t);let r=e.entries[t];if(!r)return null;return r.manifest}function Sv(e,t,r,n){e.touched?.add(t),e.entries[t]={manifest:n,source:r,timestamp:Date.now()}}var ec,kD=3000;var _d=H(()=>{kd()});function Rd(e,t){if(!t||Ev(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return Ev(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var Ev=(e)=>e!==void 0&&e!==null&&e!=="";import{existsSync as Av}from"node:fs";import{basename as AD,extname as Ov,resolve as Pv}from"node:path";async function CD(e,t){let r=t.get(e);if(!r){let n=na(e);try{let s=await Pd(e);r={width:s.width,height:s.height,hash:n}}catch(s){if(!jv)jv=!0,console.warn(`Could not read image dimensions (${ke(s)}) — `+"emitting srcsets without width/height attributes.");r={width:null,height:null,hash:n}}t.set(e,r)}return r}function kv(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 ND(e,t,r,n,s){let i=`${na(e)}:${jd(r)}`,o=wv(s,i);if(o){if(o.variants.every((c)=>Av(c.absolutePath)))return o}if(!o)console.log(` Optimizing ${AD(e)}...`);let a=await bv(e,Wi(n),r);return Sv(s,i,t,a),a}function TD(e){if(!e)return!0;if(e.includes("${"))return!0;if(OD.some((t)=>e.startsWith(t)))return!0;if(Cv.has(Ov(e).toLowerCase()))return!0;return!1}function ID(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(Cv.has(Ov(r.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(r.hostname)}catch{return!1}}function MD(e,t,r){let n=r?.length?Da(r,e):null;if(n)return n;if(e.startsWith("/"))return Pv(t,"public",e.slice(1));return Pv(t,e)}async function Nv(e,t,r,n,s,i=[]){let o=new Map;return await Tv(e,t,r,n,s??new Map,o,i),{imageRefs:o}}async function Tv(e,t,r,n,s,i,o,a=null){if(e.tagName==="img"){if(await HD(e,t,r,n,s,i,o,a))return}if(T(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await zD(e.innerHTML,t,r,n,s,i,o);if(Array.isArray(e.children)){let l=Mv(e,a);for(let c of e.children){if(!Zt(c))continue;await Tv(c,t,r,n,s,i,o,l)}}}async function Iv(e,t,r,n,s,i,o,a){if(!T(e)||t)return null;let l=ID(e,r);if(!l&&TD(e))return null;if(l)return{dims:null,sources:[],srcset:kv(e,r,1/0,null)};let c=MD(e,n,a);if(!Av(c))return null;if(r.service==="cloudflare"){let h=await CD(c,i),y=kv(e,r,h.width??1/0,h.hash);return{dims:h.width&&h.height?{height:h.height,width:h.width}:null,sources:[],srcset:y}}let u=o.get(c);if(!u)u=await ND(c,e,r,n,s),o.set(c,u);let g=[..._v.filter((h)=>r.formats.includes(h)),...r.formats.filter((h)=>!_v.includes(h))].flatMap((h)=>{let y=xv(u.variants,h);return y===""?[]:[{srcset:y,type:JD.get(h)??`image/${h}`}]}),m=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,b=r.picture!==!1&&g.length>1;return{dims:m,fallbackSrc:LD(u.variants,r.formats),sources:b?g:[],srcset:g[0]?.srcset??""}}function LD(e,t){let r=DD.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 Rv(e){if(!T(e))return null;let t=FD.exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2]==="rem"?r*16:r}function Mv(e,t){let{style:r}=e;if(!q(r))return t;let n=Rv(r.maxWidth)??Rv(r.width);if(n===null)return t;return t===null?n:Math.min(t,n)}function qD(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function HD(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 Iv(l.src,l["data-no-optimize"]!==void 0,t,r,n,s,i,o):null,u=Mv(e,a),p=l.sizes??qD(u)??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,Rd(l,t.lazyLoad)),c&&c.sources.length>0)return VD(e,c.sources,p),!0;return!1}function VD(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 zD(e,t,r,n,s,i,o){let a=[];for(let c of e.matchAll(BD)){let u=c[0],p=c[1],g=(sa(p,"src")??"").replaceAll("&amp;","&"),m=WD.test(p),b=t.optimize&&g!==""&&!m?await Iv(g,UD.test(p),t,r,n,s,i,o):null,h="";if(b&&b.srcset!=="")h+=` srcset="${b.srcset}" sizes="${t.sizes}"`;if(b?.dims&&!/\bwidth=/.test(p)&&!/\bheight=/.test(p))h+=` width="${b.dims.width}" height="${b.dims.height}"`;let y=Rd({decoding:sa(p,"decoding"),fetchpriority:sa(p,"fetchpriority"),loading:sa(p,"loading")},t.lazyLoad);for(let[k,S]of Object.entries(y))h+=` ${k}="${S}"`;if(h==="")continue;let v=b&&b.sources.length>0?GD(p,b.sources,t.sizes,h):`<img${p}${h}>`;a.push({match:u,replacement:v})}let l=e;for(let{match:c,replacement:u}of a)l=l.replace(c,u);return l}function GD(e,t,r,n){let s=sa(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 sa(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var Cv,OD,jv=!1,_v,JD,DD,FD,BD,WD,UD;var Jv=H(()=>{kd();_d();gr();Pe();hr();Cv=new Set([".svg",".gif"]),OD=["http://","https://","data:","//"];_v=["avif","webp","jpeg","png"],JD=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);DD=["jpeg","png"];FD=/^(\d+(?:\.\d+)?)(px|rem)$/;BD=/<img\b([^>]*)>/gi,WD=/\bsrcset="/,UD=/\bdata-no-optimize\b/});import{createHash as KD}from"node:crypto";import{existsSync as YD}from"node:fs";import{join as Dv}from"node:path";function ZD(e,t){let r=e.replace(/^\//,"");return e.endsWith("/")||r===""?Dv(t,r,"index.html"):Dv(t,r)}function Od(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function QD(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return KD("sha256").update(t,"utf8").digest("hex").slice(0,8)}function Lv(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 g of i)if(!g.startsWith("/"))s.push(`serviceWorker.precache: "${g}" must be a site-absolute URL starting with /.`);else if(!YD(ZD(g,t)))s.push(`serviceWorker.precache: "${g}" 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((g)=>He(r,g)),l=He(r,XD),c=o===void 0?null:He(r,o),u=`jx-${QD(e)}`,p=`/*
412
+ */CS(Jn);DS(Jn);FS(Jn);WS(Jn);rE(Jn);sE(Jn);cE(Jn);pE(Jn);y3=Jn});import{createHash as gE}from"node:crypto";import{existsSync as b3,mkdirSync as x3,readFileSync as $3}from"node:fs";import{basename as w3,extname as v3,resolve as xh}from"node:path";import{createRequire as S3}from"node:module";async function yE(){if(da)return da;try{let e=await Promise.resolve().then(() => (hE(),{}));return da=y3,da}catch{}try{return da=S3(xh(process.cwd(),"package.json"))("sharp"),da}catch(e){throw Error(`Sharp is required for image optimization but failed to load: ${je(e)}`,{cause:e})}}async function $h(e){let r=await(await yE())(e).metadata();return{format:r.format??"unknown",height:r.height??0,width:r.width??0}}function Dl(e){let t=$3(e);return gE("md5").update(t).digest("hex").slice(0,8)}function wh(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:P3,widths:e.widths});return gE("md5").update(t).digest("hex").slice(0,8)}function j3(e,t,r,n){return`${e}-${t}-${r}.${n}`}async function bE(e,t,r){let n=await yE(),s=await $h(e),i=Dl(e),o=w3(e,v3(e)),a=xh(t,"_optimized");x3(a,{recursive:!0});let l=[],c=r.widths.length>0?Math.max(...r.widths):s.width,u=r.widths.filter((m)=>m<=s.width);if(s.width<c&&!u.includes(s.width))u.push(s.width);if(u.length===0)u.push(s.width);u.sort((m,b)=>m-b);let p=[];for(let m of u)for(let b of r.formats){let g=j3(o,m,i,b),y=`/${E3}/${g}`,w=xh(a,g);if(l.push({absolutePath:w,format:b,outputPath:y,width:m}),b3(w))continue;let P=r.quality[b]??80,S=n(e).resize(m).toFormat(b,{quality:P}).toFile(w).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 xE(e,t){return e.flatMap((r)=>r.format===t?[`${r.outputPath} ${r.width}w`]:[]).join(", ")}var da=null,E3="images/_optimized",P3=2;var vh=D(()=>{ir()});import{existsSync as k3,mkdirSync as _3,readFileSync as A3,rmSync as R3,writeFileSync as O3}from"node:fs";import{basename as C3,resolve as pf}from"node:path";import{execSync as N3}from"node:child_process";import{tmpdir as T3}from"node:os";function J3(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=N3("npm config get cache",{cwd:T3(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:I3}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function pa(e){if(df===void 0)df=J3();if(df)return pf(df,"jxsuite-images",C3(e));return pf(e,".cache/images")}function $E(e){let t=pf(pa(e),"manifest.json");if(!k3(t))return{entries:{},touched:new Set,version:1};try{let r=JSON.parse(A3(t,"utf8"));return r.touched=new Set,r}catch{return{entries:{},touched:new Set,version:1}}}function wE(e,t,r={}){if(r.prune&&t.touched)M3(t,t.touched);let n=pa(e);_3(n,{recursive:!0}),O3(pf(n,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function M3(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))R3(o.absolutePath,{force:!0});delete e.entries[s]}}function vE(e,t){e.touched?.add(t);let r=e.entries[t];if(!r)return null;return r.manifest}function SE(e,t,r,n){e.touched?.add(t),e.entries[t]={manifest:n,source:r,timestamp:Date.now()}}var df,I3=3000;var Sh=D(()=>{vh()});function Eh(e,t){if(!t||EE(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return EE(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var EE=(e)=>e!==void 0&&e!==null&&e!=="";import{existsSync as RE}from"node:fs";import{basename as D3,extname as OE,resolve as PE}from"node:path";async function F3(e,t){let r=t.get(e);if(!r){let n=Dl(e);try{let s=await $h(e);r={width:s.width,height:s.height,hash:n}}catch(s){if(!jE)jE=!0,console.warn(`Could not read image dimensions (${je(s)}) — `+"emitting srcsets without width/height attributes.");r={width:null,height:null,hash:n}}t.set(e,r)}return r}function kE(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 q3(e,t,r,n,s){let i=`${Dl(e)}:${wh(r)}`,o=vE(s,i);if(o){if(o.variants.every((c)=>RE(c.absolutePath)))return o}if(!o)console.log(` Optimizing ${D3(e)}...`);let a=await bE(e,pa(n),r);return SE(s,i,t,a),a}function V3(e){if(!e)return!0;if(e.includes("${"))return!0;if(L3.some((t)=>e.startsWith(t)))return!0;if(CE.has(OE(e).toLowerCase()))return!0;return!1}function W3(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(CE.has(OE(r.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(r.hostname)}catch{return!1}}function H3(e,t,r){let n=r?.length?Kc(r,e):null;if(n)return n;if(e.startsWith("/"))return PE(t,"public",e.slice(1));return PE(t,e)}async function NE(e,t,r,n,s,i=[]){let o=new Map;return await TE(e,t,r,n,s??new Map,o,i),{imageRefs:o}}async function TE(e,t,r,n,s,i,o,a=null){if(e.tagName==="img"){if(await Y3(e,t,r,n,s,i,o,a))return}if(O(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await tV(e.innerHTML,t,r,n,s,i,o);if(Array.isArray(e.children)){let l=JE(e,a);for(let c of e.children){if(!yr(c))continue;await TE(c,t,r,n,s,i,o,l)}}}async function IE(e,t,r,n,s,i,o,a){if(!O(e)||t)return null;let l=W3(e,r);if(!l&&V3(e))return null;if(l)return{dims:null,sources:[],srcset:kE(e,r,1/0,null)};let c=H3(e,n,a);if(!RE(c))return null;if(r.service==="cloudflare"){let g=await F3(c,i),y=kE(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 u=o.get(c);if(!u)u=await q3(c,e,r,n,s),o.set(c,u);let h=[..._E.filter((g)=>r.formats.includes(g)),...r.formats.filter((g)=>!_E.includes(g))].flatMap((g)=>{let y=xE(u.variants,g);return y===""?[]:[{srcset:y,type:B3.get(g)??`image/${g}`}]}),m=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,b=r.picture!==!1&&h.length>1;return{dims:m,fallbackSrc:z3(u.variants,r.formats),sources:b?h:[],srcset:h[0]?.srcset??""}}function z3(e,t){let r=U3.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 AE(e){if(!O(e))return null;let t=G3.exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2]==="rem"?r*16:r}function JE(e,t){let{style:r}=e;if(!V(r))return t;let n=AE(r.maxWidth)??AE(r.width);if(n===null)return t;return t===null?n:Math.min(t,n)}function K3(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function Y3(e,t,r,n,s,i,o,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;if(l.src===void 0&&O(e.src))l.src=e.src,delete e.src;let c=t.optimize?await IE(l.src,l["data-no-optimize"]!==void 0,t,r,n,s,i,o):null,u=JE(e,a),p=l.sizes??K3(u)??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,Eh(l,t.lazyLoad)),c&&c.sources.length>0)return X3(e,c.sources,p),!0;return!1}function X3(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 tV(e,t,r,n,s,i,o){let a=[];for(let c of e.matchAll(Z3)){let u=c[0],p=c[1],h=(Ll(p,"src")??"").replaceAll("&amp;","&"),m=Q3.test(p),b=t.optimize&&h!==""&&!m?await IE(h,eV.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=Eh({decoding:Ll(p,"decoding"),fetchpriority:Ll(p,"fetchpriority"),loading:Ll(p,"loading")},t.lazyLoad);for(let[P,S]of Object.entries(y))g+=` ${P}="${S}"`;if(g==="")continue;let w=b&&b.sources.length>0?rV(p,b.sources,t.sizes,g):`<img${p}${g}>`;a.push({match:u,replacement:w})}let l=e;for(let{match:c,replacement:u}of a)l=l.replace(c,u);return l}function rV(e,t,r,n){let s=Ll(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 Ll(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var CE,L3,jE=!1,_E,B3,U3,G3,Z3,Q3,eV;var ME=D(()=>{vh();Sh();Lr();ve();ir();CE=new Set([".svg",".gif"]),L3=["http://","https://","data:","//"];_E=["avif","webp","jpeg","png"],B3=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);U3=["jpeg","png"];G3=/^(\d+(?:\.\d+)?)(px|rem)$/;Z3=/<img\b([^>]*)>/gi,Q3=/\bsrcset="/,eV=/\bdata-no-optimize\b/});import{createHash as nV}from"node:crypto";import{existsSync as sV}from"node:fs";import{join as DE}from"node:path";function oV(e,t){let r=e.replace(/^\//,"");return e.endsWith("/")||r===""?DE(t,r,"index.html"):DE(t,r)}function jh(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function aV(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return nV("sha256").update(t,"utf8").digest("hex").slice(0,8)}function LE(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(!sV(oV(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)=>Xe(r,h)),l=Xe(r,iV),c=o===void 0?null:Xe(r,o),u=`jx-${aV(e)}`,p=`/*
369
413
  * Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
370
414
  * Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
371
415
  */
@@ -455,7 +499,7 @@ self.addEventListener("fetch", (event) => {
455
499
  })(),
456
500
  );
457
501
  });
458
- `;return{errors:s,path:Ad,source:p,warnings:n}}function Fv(){return{errors:[],path:Ad,source:`/*
502
+ `;return{errors:s,path:Ph,source:p,warnings:n}}function FE(){return{errors:[],path:Ph,source:`/*
459
503
  * Generated by @jxsuite/compiler. This site had a service worker and no longer does.
460
504
  *
461
505
  * A worker is sticky: removing the file would leave every previous visitor running the old one
@@ -478,95 +522,95 @@ self.addEventListener("activate", (event) => {
478
522
  })(),
479
523
  );
480
524
  });
481
- `,warnings:[]}}function qv(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${He(t,`/${Ad}`)}',{scope:${JSON.stringify(He(t,e))}}).catch(function(){})})}`}var Ad="sw.js",XD="/images/_optimized/";var Hv=H(()=>{gr()});import{mkdirSync as eL,writeFileSync as tL}from"node:fs";import{dirname as rL,join as nL}from"node:path";function ls(e,t,r){if(r!==void 0)e[t]=r}function Vv(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=Js(e.url),o=[];for(let u of t.icons??[])o.push(T(u.src)?{...u,src:He(i,u.src)}:u);let a={display:t.display??"standalone",icons:o,name:s,short_name:t.shortName??s,start_url:He(i,t.startUrl??"/")};ls(a,"description",t.description),ls(a,"theme_color",t.themeColor),ls(a,"background_color",t.backgroundColor),ls(a,"scope",t.scope===void 0?void 0:He(i,t.scope)),ls(a,"orientation",t.orientation),ls(a,"lang",t.lang),ls(a,"dir",t.dir),ls(a,"categories",t.categories);let l=new Set(o.flatMap((u)=>(u.sizes??"").split(/\s+/).map((p)=>Math.trunc(Number(p.split("x")[0]))))),c=sL.filter((u)=>!l.has(u));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 Bv(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 Wv(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=Sr(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(`
525
+ `,warnings:[]}}function qE(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Xe(t,`/${Ph}`)}',{scope:${JSON.stringify(Xe(t,e))}}).catch(function(){})})}`}var Ph="sw.js",iV="/images/_optimized/";var VE=D(()=>{Lr()});import{mkdirSync as lV,writeFileSync as cV}from"node:fs";import{dirname as uV,join as fV}from"node:path";function ei(e,t,r){if(r!==void 0)e[t]=r}function WE(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=Vi(e.url),o=[];for(let u of t.icons??[])o.push(O(u.src)?{...u,src:Xe(i,u.src)}:u);let a={display:t.display??"standalone",icons:o,name:s,short_name:t.shortName??s,start_url:Xe(i,t.startUrl??"/")};ei(a,"description",t.description),ei(a,"theme_color",t.themeColor),ei(a,"background_color",t.backgroundColor),ei(a,"scope",t.scope===void 0?void 0:Xe(i,t.scope)),ei(a,"orientation",t.orientation),ei(a,"lang",t.lang),ei(a,"dir",t.dir),ei(a,"categories",t.categories);let l=new Set(o.flatMap((u)=>(u.sizes??"").split(/\s+/).map((p)=>Math.trunc(Number(p.split("x")[0]))))),c=dV.filter((u)=>!l.has(u));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)}
526
+ `,path:"manifest.webmanifest"}],warnings:n}}function HE(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 BE(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=Kr(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(`
483
527
  `)}
484
- `,path:".well-known/security.txt"}],warnings:s}}function Uv(e,t,r){let n=0,s=[];for(let i of e){let o=nL(t,i.path);if(r(o)){s.push(i.path);continue}eL(rL(o),{recursive:!0}),tL(o,i.content,"utf8"),n+=1}return{skipped:s,written:n}}var sL;var zv=H(()=>{gr();Us();Pe();sL=[192,512]});import{existsSync as iL,mkdirSync as Nd,readFileSync as oL,readdirSync as aL,writeFileSync as lL}from"node:fs";import{dirname as ia,join as cL,relative as uL,resolve as oa}from"node:path";function fL(e){return e.endsWith("/")}function Kv(e=Td){let t={},r=[],n=[];for(let s of rc)if(dL(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 Yv(e,t,r=Td,n=!0){let s=[],i=0;for(let o of rc){if(!e.assetPaths.includes(o.assetPath))continue;let a=oa(t,o.assetPath.replace(/^\//,""));Nd(ia(a),{recursive:!0});try{await Bs(`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}": ${ke(l)}`)}}return{errors:s,written:i}}function Id(e){return Object.entries(e).filter(([t,r])=>!fL(t)&&r.startsWith("/")).map(([,t])=>t)}function Xv(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=X(n)?n.imports:void 0;if(!q(s))continue;let i=Object.entries(s).flatMap(([o,a])=>T(a)?[[o,a]]:[]);t.push(...Id(Object.fromEntries(i)))}return t}function Zv(e){return`<script type="importmap">
528
+ `,path:".well-known/security.txt"}],warnings:s}}function UE(e,t,r){let n=0,s=[];for(let i of e){let o=fV(t,i.path);if(r(o)){s.push(i.path);continue}lV(uV(o),{recursive:!0}),cV(o,i.content,"utf8"),n+=1}return{skipped:s,written:n}}var dV;var zE=D(()=>{Lr();Xi();ve();dV=[192,512]});import{existsSync as pV,mkdirSync as _h,readFileSync as mV,readdirSync as hV,writeFileSync as gV}from"node:fs";import{dirname as Fl,join as yV,relative as bV,resolve as ql}from"node:path";function xV(e){return e.endsWith("/")}function KE(e=Ah){let t={},r=[],n=[];for(let s of mf)if($V(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 YE(e,t,r=Ah,n=!0){let s=[],i=0;for(let o of mf){if(!e.assetPaths.includes(o.assetPath))continue;let a=ql(t,o.assetPath.replace(/^\//,""));_h(Fl(a),{recursive:!0});try{await Ki(`export * from ${JSON.stringify(o.specifier)};
529
+ `,{outfile:a,resolveDir:r},{minify:n,target:"browser"}),i+=1}catch(l){s.push(`Bundling client runtime "${o.specifier}": ${je(l)}`)}}return{errors:s,written:i}}function Rh(e){return Object.entries(e).filter(([t,r])=>!xV(t)&&r.startsWith("/")).map(([,t])=>t)}function XE(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=B(n)?n.imports:void 0;if(!V(s))continue;let i=Object.entries(s).flatMap(([o,a])=>O(a)?[[o,a]]:[]);t.push(...Rh(Object.fromEntries(i)))}return t}function ZE(e){return`<script type="importmap">
486
530
  {
487
531
  "imports": {
488
532
  ${Object.entries(e).map(([r,n])=>` ${JSON.stringify(r)}: ${JSON.stringify(n)}`).join(`,
489
533
  `)}
490
534
  }
491
535
  }
492
- </script>`}function dL(e,t){try{return Wh(e,t),!0}catch{return!1}}async function Qv(e,t=Td,r=!0){let n=[],s=new Set,i=new Map,o=new Map,a=oa(e,"assets"),l=0,c=async(p)=>{if(!o.has(p.specifier))o.set(p.specifier,await Gh(p.specifier,t,{target:"browser"}));return o.get(p.specifier)},u=async(p)=>[...oL(p,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let p=0;p<Gv;p++){let g=0,m=[];try{m=aL(a,{recursive:!0}).map(String).filter((b)=>b.endsWith(".js")).map((b)=>cL(a,b))}catch{return Cd(e,i,n,l)}for(let b of m){let h=[];try{h=await u(b)}catch{continue}for(let y of h){let v=rc.find((E)=>y.startsWith(`${E.specifier}/`));if(!v||s.has(y))continue;s.add(y);let k=y.slice(v.specifier.length+1),S=oa(e,`${v.assetDir.replace(/^\//,"")}${k}`);Nd(ia(S),{recursive:!0});try{await Bs(`export * from ${JSON.stringify(y)};
493
- `,{outfile:S,resolveDir:t},{minify:r,resolver:pL(v,S,await c(v),i),target:"browser"}),l+=1,g+=1}catch(E){n.push(`Bundling runtime subpath "${y}": ${ke(E)}`)}}}if(g===0)return Cd(e,i,n,l)}return n.push(`Runtime subpath resolution did not settle in ${Gv} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Cd(e,i,n,l)}function pL(e,t,r,n){return{filter:/.*/,resolve:({importer:s,path:i})=>{if(Lu(s))return;if(rc.find((a)=>i===a.specifier||i.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:i};if(r===void 0||!i.startsWith("."))return;if(oa(ia(s),i)!==r)return;return n.set(oa(ia(t),i),e.specifier),{external:!0,path:i}}}}function Cd(e,t,r,n){let s=n;for(let[i,o]of t){if(iL(i))continue;try{Nd(ia(i),{recursive:!0}),lL(i,`export * from ${JSON.stringify(o)};
494
- `,"utf8"),s+=1}catch(a){r.push(`Writing shared core stub ${uL(e,i)}: ${ke(a)}`)}}return{errors:r,written:s}}var rc,Td,Gv=10;var ew=H(()=>{Fu();Ur();Pe();hr();rc=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Pi,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:ji,specifier:"lit-html"}];Td=import.meta.dirname});import{cpSync as nc,existsSync as qn,mkdirSync as qr,readFileSync as mL,readdirSync as hL,rmSync as gL,statSync as yL,writeFileSync as _r}from"node:fs";import{createHash as bL}from"node:crypto";import{basename as xL,dirname as tn,join as cs,relative as $L,resolve as Qe,sep as vL}from"node:path";async function sw(e,t={}){let{clean:r=!0,includeHeld:n=!1,verbose:s=!1}=t,i=[],o=s?console.log.bind(console):()=>{};o("Loading project.json...");let{config:a}=Kn(e);if("contentTypes"in a)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 l=Qe(e,a.build.outDir),c=Qe(e,"pages"),u=Qe(e,"public"),p=a.build.trailingSlash??"always",g=a.build.minify!==!1,m=new Map,b=new Map,h=new Map,y=(J)=>{let B=J.toSorted(),le=`/assets/elements-${bL("sha1").update(B.join("\x00")).digest("hex").slice(0,12)}.js`;return h.set(le,B),le},v=Kv(),k=v.imports,S=new Set,E=cy(),{errors:j,i18n:R}=Hu(a);for(let J of j)i.push(J),console.error(J);for(let J of v.warnings)console.warn(J);let A=new Map,_=(J,B,W)=>{let le=A.get(J);if(le!==void 0&&le.entryPath!==B)throw Error(`"${W}" and "${le.specifier}" both map to ${J} — rename one`);A.set(J,{entryPath:B,specifier:W})},I=(J,B)=>{if(!Bh(J))return J;try{let W=Du(J,B??e,e);if(!Ms(J)&&!qn(W))return console.warn(`Sidecar "${J}" not found at ${W} — emitting unbundled`),J;let le=Ms(J)?J:`./${$L(e,W)}`,Ae=lh(le);return _(Ae,W,J),m.set(Ae,{entryPath:W,specifier:J}),Ae}catch(W){return i.push(`Sidecar "${J}": ${ke(W)}`),J}},D=(J)=>{let B=ch(J);try{let W=Du(`npm:${J}`,e,e);return _(B,W,J),b.set(B,W),B}catch(W){return i.push(`$head specifier "${J}": ${ke(W)}`),J}},M=await Gn(e,a),L=M.formats;if(L.entries.length>0)o(` Registered ${L.entries.length} format(s): ${L.entries.map((J)=>J.name).join(", ")}`);let G=M.serverMounts().filter((J)=>{if(!J.project)return!0;let B=a[J.project.key];return q(B)&&Object.keys(B).length>0});if(G.length>0&&!a.build.adapter){let J=G.map((B)=>B.project?`"${B.project.key}"`:`"${B.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 — ${tw}`)}if(r&&qn(l))gL(l,{force:!0,recursive:!0});if(qr(l,{recursive:!0}),!qn(c))throw Error(`pages/ directory not found in ${e}`);o("Discovering pages...");let ae=await ny(c,L);o(` Found ${ae.length} page(s)`),o("Loading project sections...");let me=await vy(e,a,M,{includeHeld:n}),ce=Object.keys(me);if(ce.length>0)o(` Loaded ${ce.length} section(s): ${ce.join(", ")}`);let{errors:se,mounts:ue}=await Sy(M,a,e);i.push(...se);for(let J of se)console.error(J);if(ue.length>0)o(` Mounted ${ue.length} asset dir(s): ${ue.map((J)=>J.urlPrefix).join(", ")}`);let Re=new Set,K=await EL(M,a,e),oe=(await oy(ae,e,me,M,a,R,{errors:i})).map((J)=>Object.assign(J,{locale:Jr(J.urlPattern,R)}));o(` ${oe.length} route(s) after expansion`);let V=0,Ye=Qe(e,"components"),de=[],ct=new Map,Y=new Map,pt=new Map;if(qn(Ye)){o("Compiling components...");let J=[".json",...L.documentExtensions("component")],B=hL(Ye).filter((Ct)=>J.some((Ue)=>Ct.endsWith(Ue))),W=Qe(l,"components");qr(W,{recursive:!0});let le=new Map;for(let Ct of B){let Ue=Qe(Ye,Ct);try{let{tagName:ve}=await Ys(Ue,L);if(ve)le.set(Ue,ve)}catch{}}let Ae=Js(a.url),mt=_l(Ae);for(let Ct of B)try{let Ue=Qe(Ye,Ct),ve={formats:L,resolveElementPath:(xt,d)=>{let x=d?Qe(d,xt):Qe(xt),w=le.get(x);return w?`./${w}.js`:xt.replace(/\.json$/,".js")},rewriteSrc:(xt,d)=>He(Ae,I(xt,d)),serverBaseUrl:mt};if(a.$media)ve.$media=a.$media;let Nt=await jl(Ue,ve);for(let xt of Nt.files){let d=xt.tagName?`${xt.tagName}.js`:xL(xt.path);if(!de.includes(xt.tagName))_r(Qe(W,d),xt.content,"utf8"),de.push(xt.tagName),V+=1}let ht=await Ys(Ue,L);if(ht.tagName){Y.set(ht.tagName,ht),pt.set(ht.tagName,Ue);let xt=Gs(ht,a.defaults),d=Hg(ht.tagName,ht.style,ht,a.$media??{},xt);if(d){if(xt===null)ct.set(ht.tagName,d);Of(d,ue,Re),_r(Qe(W,`${ht.tagName}.css`),d,"utf8"),V+=1}}}catch(Ue){let ve=ke(Ue);i.push(`Error compiling component ${Ct}: ${ve}`),console.error(`Error compiling component ${Ct}: ${ve}`)}o(` Compiled ${de.length} component(s): ${de.join(", ")}`)}let We=[];for(let[J,B]of Y)We.push(...Bo(B,pt.get(J),e));if(a.state)We.push(...Bo({state:a.state},Qe(e,"project.json"),e));let At=a.images.optimize&&a.images.service==="cloudflare",ut=a.images.optimize&&!At?$v(e):null,bt=At?new Map:null;if(At)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 Ot=a.url,jt=Js(Ot),bn=Boolean(Ot)&&a.build.sitemap!==!1,xn=[],li=oe.filter((J)=>!J.urlPattern.includes(":")&&!J.urlPattern.includes("*")),fr=R===null?new Map:await ry(li,L),$n=li.map((J)=>({translationKey:fr.get(J.urlPattern),urlPattern:J.urlPattern})),ci=Kg($n,R,Ot,p),{conflicts:ui,sets:gu}=wf($n,R);for(let J of ui){let[B,W]=J.urlPatterns,le=J.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",Ae=`${W} and ${B} are both the "${J.locale}" version of "${J.key}". A translation set names one URL per language, so ${W} is `+`dropped from it — it carries no alternates and no switcher. ${le}`;if(J.declared)i.push(Ae),console.error(Ae);else console.warn(Ae)}let vn=zg(oe,R);if(vn.length>0)console.warn(`i18n.routing is "prefix-always", but ${vn.length} route(s) sit outside the locale tree and are served as "${R?.defaultLocale}": ${vn.slice(0,10).join(", ")}${vn.length>10?`, and ${vn.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(R!==null&&R.routing==="prefix-always"&&!a.build.adapter&&!oe.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 "/${R.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Oa=new Set,fi=new Set;for(let J of oe){let B=Gg(J.urlPattern,R);if(B&&!Oa.has(B.segment))Oa.add(B.segment),console.warn(`Routes under /${B.segment}/ are served as "${R?.defaultLocale}" — `+`i18n.locales declares "${B.meant}", not "${B.segment}". Rename the directory to "${B.meant.toLowerCase()}" or declare the shorter tag.`);try{o(` Compiling ${J.urlPattern} ...`);let W=await wL(J,a,e,me,ut,Y,bt,L,M,I,ue,K,D,{alternates:ci.get(J.urlPattern)??[],i18n:R,translations:gu.get(J.urlPattern)??[]},k,y);We.push(...W.serverEntries);for(let ve of W.unregisteredRelations)if(!fi.has(ve))fi.add(ve),console.warn(`<link rel="${ve}"> — "${ve}" 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 le=new Set;for(let[ve,Nt]of Y)if(yl(Nt))le.add(ve);if(de.length>0)W.html=kL(W.html,de,ct,le,W.files.map((ve)=>ve.content).join(`
495
- `),k);for(let ve of Xv(W.html))S.add(ve);Of(W.html,ue,Re),uy(W.html,E);let Ae=lw(J.urlPattern,l,p);qr(tn(Ae),{recursive:!0});let mt=!J.urlPattern.includes(":")&&!J.urlPattern.includes("*"),Ct=!Vo(J.urlPattern)&&!Vg(W.html);if(bn&&!W.excludeFromSitemap&&Ct&&mt){let ve=ci.get(J.urlPattern)??[];xn.push({lastmod:T(J.sourceMtime)&&J.sourceMtime!==""?J.sourceMtime:OL(yL(J.sourcePath).mtime),loc:Yn(Ci(J.urlPattern,p),Ot),...ve.length>0&&{alternates:ve}})}let Ue=[];for(let ve of L.withCapability("serialize")){if(!ve.exportTarget||Vo(J.urlPattern))continue;try{let Nt=await ve.call("serialize",W.doc,{buildScope:(ht)=>Si(ht,null),componentDefs:Y,evaluateTemplate:(ht,xt)=>{if(!ye(ht))return;return Mt(ht,xt)??ht},mode:"export"});if(Nt){let ht=Ae.replace(/\.html$/,ve.extensions[0]);Ue.push({content:Nt,path:ht,type:ve.mediaTypeEssence})}}catch(Nt){i.push(`Error exporting ${ve.name} for ${J.urlPattern}: ${ke(Nt)}`)}}for(let ve of Ue)if(ve.type!==null)W.html=Wg(W.html,{href:Ug(l,ve.path),type:ve.type});_r(Ae,ph(W.html,jt),"utf8"),V+=1;for(let ve of Ue)_r(ve.path,ve.content,"utf8"),V+=1;for(let ve of W.files){let Nt=Qe(tn(Ae),ve.path);qr(tn(Nt),{recursive:!0}),_r(Nt,ve.content,"utf8"),V+=1}}catch(W){let le=`Error compiling ${J.urlPattern}: ${ke(W)}`;i.push(le),console.error(le)}}if(ut&&a.images.optimize){vv(e,ut,{prune:i.length===0});let J=Qe(Wi(e),"_optimized");if(qn(J)){let W=Qe(l,"images/_optimized");qr(W,{recursive:!0}),nc(J,W,{recursive:!0})}let B=Object.keys(ut.entries).length;if(B>0)o(` Optimized ${B} image(s)`)}let wn=[];if(!a.build.adapter&&We.length>0){let B=`timing: "server" entries ${[...new Set(We.map(({exportName:W,declaredIn:le})=>`${W} (${le})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${tw}`;i.push(B),console.error(B)}if(a.build.adapter){let{adapter:J}=a.build;o("Generating site-wide server worker...");let{entries:B,errors:W}=Ty(We);wn=B;for(let Ue of W)i.push(Ue),console.error(Ue);let{mounts:le,connectors:Ae}=SL(G,M,a);if(le.length>0)o(` Mounting ${le.length} extension route(s): ${le.map((Ue)=>Ue.basePath).join(", ")}`);let Ct=J==="cloudflare-pages"&&wn.length===0&&le.length===0?null:Hf(wn,{adapter:J,base:jt,connectors:Ae,i18n:R,mounts:le});if(Ct){let Ue=J==="cloudflare-pages"?"_worker.js":"worker.js";try{await Kh(Ct,{adapter:J,outfile:Qe(l,Ue),projectRoot:e}),V+=1,o(` Generated dist/${Ue} (bundled, ${wn.length} server function(s))`)}catch(ve){let Nt=`Error bundling dist/${Ue}: ${ke(ve)}`;i.push(Nt),console.error(Nt)}if(J==="cloudflare-pages")_r(Qe(l,"_routes.json"),`${JSON.stringify({exclude:[],include:(R&&R.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((ve)=>He(jt,ve)),version:1},null,2)}
496
- `,"utf8"),V+=1}}if(S.size>0){o(`Bundling ${S.size} client runtime module(s)...`);let J=await Yv({...v,assetPaths:[...S]},l,void 0,g);V+=J.written;for(let B of J.errors)i.push(B),console.error(B)}if(b.size>0){o(`Copying ${b.size} package asset(s)...`);for(let[J,B]of b){let W=Qe(l,J.replace(/^\//,""));qr(tn(W),{recursive:!0}),nc(B,W),V+=1,o(` ${B} → ${J}`)}}if(m.size>0){o(`Bundling ${m.size} client sidecar module(s)...`);for(let[J,B]of m)try{let W=Qe(l,J.replace(/^\//,""));qr(tn(W),{recursive:!0}),await zh({entryPath:B.entryPath,outfile:W},{external:Vh,minify:g,target:"browser"}),V+=1,o(` ${B.specifier} → ${J}`)}catch(W){let le=`Error bundling sidecar "${B.specifier}": ${ke(W)}`;i.push(le),console.error(le)}}if(h.size>0){o(`Bundling ${h.size} npm element set(s)...`);for(let[J,B]of h){let W=Qe(l,J.replace(/^\//,""));qr(tn(W),{recursive:!0});try{await Bs(`${B.map((le)=>`import ${JSON.stringify(le)};`).join(`
536
+ </script>`}function $V(e,t){try{return B0(e,t),!0}catch{return!1}}async function QE(e,t=Ah,r=!0){let n=[],s=new Set,i=new Map,o=new Map,a=ql(e,"assets"),l=0,c=async(p)=>{if(!o.has(p.specifier))o.set(p.specifier,await G0(p.specifier,t,{target:"browser"}));return o.get(p.specifier)},u=async(p)=>[...mV(p,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let p=0;p<GE;p++){let h=0,m=[];try{m=hV(a,{recursive:!0}).map(String).filter((b)=>b.endsWith(".js")).map((b)=>yV(a,b))}catch{return kh(e,i,n,l)}for(let b of m){let g=[];try{g=await u(b)}catch{continue}for(let y of g){let w=mf.find((E)=>y.startsWith(`${E.specifier}/`));if(!w||s.has(y))continue;s.add(y);let P=y.slice(w.specifier.length+1),S=ql(e,`${w.assetDir.replace(/^\//,"")}${P}`);_h(Fl(S),{recursive:!0});try{await Ki(`export * from ${JSON.stringify(y)};
537
+ `,{outfile:S,resolveDir:t},{minify:r,resolver:wV(w,S,await c(w),i),target:"browser"}),l+=1,h+=1}catch(E){n.push(`Bundling runtime subpath "${y}": ${je(E)}`)}}}if(h===0)return kh(e,i,n,l)}return n.push(`Runtime subpath resolution did not settle in ${GE} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),kh(e,i,n,l)}function wV(e,t,r,n){return{filter:/.*/,resolve:({importer:s,path:i})=>{if(Ip(s))return;if(mf.find((a)=>i===a.specifier||i.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:i};if(r===void 0||!i.startsWith("."))return;if(ql(Fl(s),i)!==r)return;return n.set(ql(Fl(t),i),e.specifier),{external:!0,path:i}}}}function kh(e,t,r,n){let s=n;for(let[i,o]of t){if(pV(i))continue;try{_h(Fl(i),{recursive:!0}),gV(i,`export * from ${JSON.stringify(o)};
538
+ `,"utf8"),s+=1}catch(a){r.push(`Writing shared core stub ${bV(e,i)}: ${je(a)}`)}}return{errors:r,written:s}}var mf,Ah,GE=10;var e1=D(()=>{Jp();An();ve();ir();mf=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:zo,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Go,specifier:"lit-html"}];Ah=import.meta.dirname});import{cpSync as hf,existsSync as _s,mkdirSync as xn,readFileSync as vV,readdirSync as SV,rmSync as EV,statSync as PV,writeFileSync as en}from"node:fs";import{createHash as jV}from"node:crypto";import{basename as kV,dirname as Dn,join as ti,relative as _V,resolve as ft,sep as AV}from"node:path";async function s1(e,t={}){let{clean:r=!0,includeHeld:n=!1,verbose:s=!1}=t,i=[],o=s?console.log.bind(console):()=>{};o("Loading project.json...");let{config:a}=qs(e);if("contentTypes"in a)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 l=ft(e,a.build.outDir),c=ft(e,"pages"),u=ft(e,"public"),p=a.build.trailingSlash??"always",h=a.build.minify!==!1,m=new Map,b=new Map,g=new Map,y=(M)=>{let H=M.toSorted(),le=`/assets/elements-${jV("sha1").update(H.join("\x00")).digest("hex").slice(0,12)}.js`;return g.set(le,H),le},w=KE(),P=w.imports,S=new Set,E=c$(),{errors:k,i18n:A}=Dp(a);for(let M of k)i.push(M),console.error(M);for(let M of w.warnings)console.warn(M);let R=new Map,_=(M,H,U)=>{let le=R.get(M);if(le!==void 0&&le.entryPath!==H)throw Error(`"${U}" and "${le.specifier}" both map to ${M} — rename one`);R.set(M,{entryPath:H,specifier:U})},I=(M,H)=>{if(!H0(M))return M;try{let U=Tp(M,H??e,e);if(!qi(M)&&!_s(U))return console.warn(`Sidecar "${M}" not found at ${U} — emitting unbundled`),M;let le=qi(M)?M:`./${_V(e,U)}`,Ne=l0(le);return _(Ne,U,M),m.set(Ne,{entryPath:U,specifier:M}),Ne}catch(U){return i.push(`Sidecar "${M}": ${je(U)}`),M}},L=(M)=>{let H=c0(M);try{let U=Tp(`npm:${M}`,e,e);return _(H,U,M),b.set(H,U),H}catch(U){return i.push(`$head specifier "${M}": ${je(U)}`),M}},J=await Fs(e,a),F=J.formats;if(F.entries.length>0)o(` Registered ${F.entries.length} format(s): ${F.entries.map((M)=>M.name).join(", ")}`);let K=J.serverMounts().filter((M)=>{if(!M.project)return!0;let H=a[M.project.key];return V(H)&&Object.keys(H).length>0});if(K.length>0&&!a.build.adapter){let M=K.map((H)=>H.project?`"${H.project.key}"`:`"${H.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${M} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${t1}`)}if(r&&_s(l))EV(l,{force:!0,recursive:!0});if(xn(l,{recursive:!0}),!_s(c))throw Error(`pages/ directory not found in ${e}`);o("Discovering pages...");let ae=await n$(c,F);o(` Found ${ae.length} page(s)`),o("Loading project sections...");let me=await w$(e,a,J,{includeHeld:n}),ce=Object.keys(me);if(ce.length>0)o(` Loaded ${ce.length} section(s): ${ce.join(", ")}`);let{errors:se,mounts:ue}=await S$(J,a,e);i.push(...se);for(let M of se)console.error(M);if(ue.length>0)o(` Mounted ${ue.length} asset dir(s): ${ue.map((M)=>M.urlPrefix).join(", ")}`);let Ce=new Set,Y=await CV(J,a,e),oe=(await o$(ae,e,me,J,a,A,{errors:i})).map((M)=>Object.assign(M,{locale:hn(M.urlPattern,A)}));o(` ${oe.length} route(s) after expansion`);let W=0,ot=ft(e,"components"),de=[],xt=new Map,X=new Map,Pt=new Map;if(_s(ot)){o("Compiling components...");let M=[".json",...F.documentExtensions("component")],H=SV(ot).filter((Gt)=>M.some((tt)=>Gt.endsWith(tt))).toSorted(),U=ft(l,"components");xn(U,{recursive:!0});let le=new Map;for(let Gt of H){let tt=ft(ot,Gt);try{let{tagName:we}=await to(tt,F);if(we)le.set(tt,we)}catch{}}let Ne=Vi(a.url),jt=Lu(Ne);for(let Gt of H)try{let tt=ft(ot,Gt),we={formats:F,resolveElementPath:(Ct,d)=>{let x=d?ft(d,Ct):ft(Ct),v=le.get(x);return v?`./${v}.js`:Ct.replace(/\.(?:json|jxn)$/i,".js")},rewriteSrc:(Ct,d)=>Xe(Ne,I(Ct,d)),serverBaseUrl:jt};if(a.$media)we.$media=a.$media;let Kt=await Mu(tt,we);for(let Ct of Kt.files){let d=Ct.tagName?`${Ct.tagName}.js`:kV(Ct.path);if(!de.includes(Ct.tagName))en(ft(U,d),Ct.content,"utf8"),de.push(Ct.tagName),W+=1}let kt=await to(tt,F);if(kt.tagName){X.set(kt.tagName,kt),Pt.set(kt.tagName,tt);let Ct=Qi(kt,a.defaults),d=Vx(kt.tagName,kt.style,kt,a.$media??{},Ct);if(d){if(Ct===null)xt.set(kt.tagName,d);jm(d,ue,Ce),en(ft(U,`${kt.tagName}.css`),d,"utf8"),W+=1}}}catch(tt){let we=je(tt);i.push(`Error compiling component ${Gt}: ${we}`),console.error(`Error compiling component ${Gt}: ${we}`)}o(` Compiled ${de.length} component(s): ${de.join(", ")}`)}let et=[];for(let[M,H]of X)et.push(...Pl(H,Pt.get(M),e));if(a.state)et.push(...Pl({state:a.state},kn(e),e));let Ut=a.images.optimize&&a.images.service==="cloudflare",$t=a.images.optimize&&!Ut?$E(e):null,Ot=Ut?new Map:null;if(Ut)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 zt=a.url,qt=Vi(zt),es=Boolean(zt)&&a.build.sitemap!==!1,ts=[],mo=oe.filter((M)=>!M.urlPattern.includes(":")&&!M.urlPattern.includes("*")),Nr=A===null?new Map:await r$(mo,F),rs=mo.map((M)=>({translationKey:Nr.get(M.urlPattern),urlPattern:M.urlPattern})),ho=Kx(rs,A,zt,p),{conflicts:go,sets:_d}=ym(rs,A);for(let M of go){let[H,U]=M.urlPatterns,le=M.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",Ne=`${U} and ${H} are both the "${M.locale}" version of "${M.key}". A translation set names one URL per language, so ${U} is `+`dropped from it — it carries no alternates and no switcher. ${le}`;if(M.declared)i.push(Ne),console.error(Ne);else console.warn(Ne)}let ns=zx(oe,A);if(ns.length>0)console.warn(`i18n.routing is "prefix-always", but ${ns.length} route(s) sit outside the locale tree and are served as "${A?.defaultLocale}": ${ns.slice(0,10).join(", ")}${ns.length>10?`, and ${ns.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(A!==null&&A.routing==="prefix-always"&&!a.build.adapter&&!oe.some((M)=>M.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 "/${A.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let dc=new Set,yo=new Set;for(let M of oe){let H=Gx(M.urlPattern,A);if(H&&!dc.has(H.segment))dc.add(H.segment),console.warn(`Routes under /${H.segment}/ are served as "${A?.defaultLocale}" — `+`i18n.locales declares "${H.meant}", not "${H.segment}". Rename the directory to "${H.meant.toLowerCase()}" or declare the shorter tag.`);try{o(` Compiling ${M.urlPattern} ...`);let U=await RV(M,a,e,me,$t,X,Ot,F,J,I,ue,Y,L,{alternates:ho.get(M.urlPattern)??[],i18n:A,translations:_d.get(M.urlPattern)??[]},P,y);et.push(...U.serverEntries);for(let we of U.unregisteredRelations)if(!yo.has(we))yo.add(we),console.warn(`<link rel="${we}"> — "${we}" 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 le=new Set;for(let[we,Kt]of X)if(_u(Kt))le.add(we);if(de.length>0)U.html=IV(U.html,de,xt,le,U.files.map((we)=>we.content).join(`
539
+ `),P);for(let we of XE(U.html))S.add(we);jm(U.html,ue,Ce),u$(U.html,E);let Ne=l1(M.urlPattern,l,p);xn(Dn(Ne),{recursive:!0});let jt=!M.urlPattern.includes(":")&&!M.urlPattern.includes("*"),Gt=!El(M.urlPattern)&&!Wx(U.html);if(es&&!U.excludeFromSitemap&&Gt&&jt){let we=ho.get(M.urlPattern)??[];ts.push({lastmod:O(M.sourceMtime)&&M.sourceMtime!==""?M.sourceMtime:LV(PV(M.sourcePath).mtime),loc:Vs(ea(M.urlPattern,p),zt),...we.length>0&&{alternates:we}})}let tt=[];for(let we of F.withCapability("serialize")){if(!we.exportTarget||El(M.urlPattern))continue;try{let Kt=await we.call("serialize",U.doc,{buildScope:(kt)=>Bo(kt,null),componentDefs:X,evaluateTemplate:(kt,Ct)=>{if(!ye(kt))return;return Qt(kt,Ct)??kt},mode:"export"});if(Kt){let kt=Ne.replace(/\.html$/,we.extensions[0]);tt.push({content:Kt,path:kt,type:we.mediaTypeEssence})}}catch(Kt){i.push(`Error exporting ${we.name} for ${M.urlPattern}: ${je(Kt)}`)}}for(let we of tt)if(we.type!==null)U.html=Bx(U.html,{href:Ux(l,we.path),type:we.type});en(Ne,p0(U.html,qt),"utf8"),W+=1;for(let we of tt)en(we.path,we.content,"utf8"),W+=1;for(let we of U.files){let Kt=ft(Dn(Ne),we.path);xn(Dn(Kt),{recursive:!0}),en(Kt,we.content,"utf8"),W+=1}}catch(U){let le=`Error compiling ${M.urlPattern}: ${je(U)}`;i.push(le),console.error(le)}}if($t&&a.images.optimize){wE(e,$t,{prune:i.length===0});let M=ft(pa(e),"_optimized");if(_s(M)){let U=ft(l,"images/_optimized");xn(U,{recursive:!0}),hf(M,U,{recursive:!0})}let H=Object.keys($t.entries).length;if(H>0)o(` Optimized ${H} image(s)`)}let ss=[];if(!a.build.adapter&&et.length>0){let H=`timing: "server" entries ${[...new Set(et.map(({exportName:U,declaredIn:le})=>`${U} (${le})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${t1}`;i.push(H),console.error(H)}if(a.build.adapter){let{adapter:M}=a.build;o("Generating site-wide server worker...");let{entries:H,errors:U}=T$(et);ss=H;for(let tt of U)i.push(tt),console.error(tt);let{mounts:le,connectors:Ne}=OV(K,J,a);if(le.length>0)o(` Mounting ${le.length} extension route(s): ${le.map((tt)=>tt.basePath).join(", ")}`);let Gt=M==="cloudflare-pages"&&ss.length===0&&le.length===0?null:Mm(ss,{adapter:M,base:qt,connectors:Ne,i18n:A,mounts:le});if(Gt){let tt=M==="cloudflare-pages"?"_worker.js":"worker.js";try{await K0(Gt,{adapter:M,outfile:ft(l,tt),projectRoot:e}),W+=1,o(` Generated dist/${tt} (bundled, ${ss.length} server function(s))`)}catch(we){let Kt=`Error bundling dist/${tt}: ${je(we)}`;i.push(Kt),console.error(Kt)}if(M==="cloudflare-pages")en(ft(l,"_routes.json"),`${JSON.stringify({exclude:[],include:(A&&A.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((we)=>Xe(qt,we)),version:1},null,2)}
540
+ `,"utf8"),W+=1}}if(S.size>0){o(`Bundling ${S.size} client runtime module(s)...`);let M=await YE({...w,assetPaths:[...S]},l,void 0,h);W+=M.written;for(let H of M.errors)i.push(H),console.error(H)}if(b.size>0){o(`Copying ${b.size} package asset(s)...`);for(let[M,H]of b){let U=ft(l,M.replace(/^\//,""));xn(Dn(U),{recursive:!0}),hf(H,U),W+=1,o(` ${H} → ${M}`)}}if(m.size>0){o(`Bundling ${m.size} client sidecar module(s)...`);for(let[M,H]of m)try{let U=ft(l,M.replace(/^\//,""));xn(Dn(U),{recursive:!0}),await z0({entryPath:H.entryPath,outfile:U},{external:W0,minify:h,target:"browser"}),W+=1,o(` ${H.specifier} → ${M}`)}catch(U){let le=`Error bundling sidecar "${H.specifier}": ${je(U)}`;i.push(le),console.error(le)}}if(g.size>0){o(`Bundling ${g.size} npm element set(s)...`);for(let[M,H]of g){let U=ft(l,M.replace(/^\//,""));xn(Dn(U),{recursive:!0});try{await Ki(`${H.map((le)=>`import ${JSON.stringify(le)};`).join(`
497
541
  `)}
498
- `,{outfile:W,resolveDir:e},{minify:g,target:"browser"}),V+=1,o(` ${B.length} element(s) → ${J}`)}catch(le){let Ae=`Error bundling npm $elements [${B.join(", ")}]: ${ke(le)}`;i.push(Ae),console.error(Ae)}}}if(S.size>0){let J=await Qv(l,void 0,g);if(J.written>0)o(`Bundling ${J.written} runtime subpath module(s)...`);V+=J.written;for(let B of J.errors)i.push(B),console.error(B)}for(let J of M.emitters()){let B=J.project?.key,W=B?a[B]:void 0;if(B&&(W==null||q(W)&&Object.keys(W).length===0))continue;try{let le=await J.call("emit",W??null,{projectConfig:a,root:e,routes:oe,sections:me});for(let Ae of le??[]){let mt=Qe(l,Ae.path.replace(/^\//,""));if(!mt.startsWith(l+vL))throw Error(`emit path escapes outDir: ${Ae.path}`);qr(tn(mt),{recursive:!0}),_r(mt,Ae.content),V+=1,o(` ${J.name} emitted ${Ae.path}`)}}catch(le){let Ae=`Error in ${J.name}.emit: ${ke(le)}`;i.push(Ae),console.error(Ae)}}if(a.redirects&&Object.keys(a.redirects).length>0){o("Generating redirects...");let J=new Set(oe.map((W)=>W.urlPattern)),B=AL(a.redirects,l,{basePath:jt,compiledUrls:J,trailingSlash:a.build.trailingSlash});V+=B.files,i.push(...B.errors)}if(bn)o(`Generating sitemap (${xn.length} URL(s))...`),V+=NL(xn,l);else if(!Ot&&a.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(Re.size>0){let{copied:J,missing:B}=Ey(Re,ue,l);V+=J,o(`Copying ${J} mounted asset(s)...`);for(let W of B)console.warn(`Referenced asset not found: ${W}`)}if(qn(u))o("Copying public/ assets..."),nc(u,l,{recursive:!0});if(bn)V+=TL(l,Ot);{let J=[Vv(a),Wv(a,new Date)];for(let le of J){for(let Ae of le.errors)i.push(Ae),console.error(Ae);for(let Ae of le.warnings)console.warn(Ae)}let{skipped:B,written:W}=Uv(J.flatMap((le)=>le.files),l,qn);V+=W;for(let le of B)o(` ${le} — kept the copy from public/`)}{let J=Od(a.serviceWorker);if(J!==null){let B=J===!1?Fv():Lv(J,l,jt);for(let W of B.warnings)console.warn(W);for(let W of B.errors)i.push(W),console.error(W);if(B.path!==null)_r(cs(l,B.path),B.source,"utf8"),V+=1,o(J===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:J,rules:B}=hy(a.build,E);i.push(...J);let W=yy([...B,...gy(l)],jt);if(W.length>0){o("Writing response headers..."),V+=by(l,W);let{adapter:le,deploy:Ae}=a.build;if(le==="node"||le==="bun")console.warn(`The "${le}" 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(le===void 0&&Ae===void 0)if(qn(Qe(u,"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 o(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}V+=xy(l)}if(a.copy){o("Copying mapped files...");for(let[J,B]of Object.entries(a.copy)){if(!T(B))throw TypeError(`project.json copy["${J}"] must be a destination path string`);let W=Qe(e,J),le=Qe(l,B);qr(tn(le),{recursive:!0}),nc(W,le)}}if(o(`
499
- Build complete: ${oe.length} routes, ${V} files`),i.length>0)o(` ${i.length} error(s)`);return{errors:i,files:V,routes:oe.length,serverEntries:wn}}async function wL(e,t,r,n,s,i,o,a,l,c,u,p,g,m,b,h){let y=Js(t.url),v=await Ys(e.sourcePath,a),k=await Ay(v,t,r),S=[...Bo(v,e.sourcePath,r),...Oy(v,t,r).flatMap((de)=>Bo(de.doc,de.path,r))],E=My(v.$head??k._pageHead??[],v.description),j=k.$head??[],R=v.title??k._pageTitle??null;delete k._pageHead,delete k._pageTitle,Qg(k,t,e,r,m.i18n,m.translations);let A=Yg({defaults:t.defaults,pageDir:T(v.$dir)?v.$dir:void 0,pageLang:T(v.$lang)?v.$lang:void 0,routeLocale:Jr(e.urlPattern,m.i18n)});if(e.pagedState&&k.state&&e.pagedState.key in k.state)k.state[e.pagedState.key]=e.pagedState.items;await $l(k,e,r,{config:t,registerBundle:(de)=>{c(de,null)},registry:l,sections:n});let _=Si(k.state??{}),I=R??t.name;if(ye(I))I=Mt(I,_)??I;let D=Md(rw(E,_),g),M=Md(rw(j,_),g);aa(k,_);let L={counter:{n:0},media:{...t.$media,...k.$media},rules:[]},G={n:0};if(qd(k,i,L,t.defaults,G),k.state){let de=new Set;for(let[Y,pt]of Object.entries(k.state)){if(Y==="$site"||Y==="$page")continue;if(X(pt)&&pt.timing==="compiler")delete k.state[Y];else if(Array.isArray(pt))de.add(Y)}let ct=!0;while(ct){ct=!1;let Y={...k.state};for(let We of de)delete Y[We];let pt=JSON.stringify({children:k.children,state:Y});for(let We of de)if(jL(pt,We))de.delete(We),ct=!0}for(let Y of de)delete k.state[Y]}let ae=Od(t.serviceWorker),me=ae===null||ae===!1?[]:[{tagName:"script",textContent:qv(ae.scope??"/",y)}],ce=[...Bv(t),...me,...p,...Md(t.$head??[],g)],se=Jy(ce,M,D,{title:I,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!Vo(e.urlPattern)&&{pageUrl:Ci(e.urlPattern,t.build.trailingSlash)}});if(t.$media)k.$media={...t.$media,...k.$media};if(Object.values(k.$media??{}).some((de)=>Lr(String(de))!==null))se.splice(2,0,{tagName:"script",textContent:_i()});let ue=t.images;await Nv(k,ue,r,s,o??void 0,u);let Re={lang:A.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(de)=>He(y,c(de,tn(e.sourcePath))),serverBaseUrl:_l(y),title:I},K=b["@vue/reactivity"];if(K!==void 0)Re.reactivitySrc=K;let Se=b["lit-html"];if(Se!==void 0)Re.litHtmlSrc=Se;let oe=await Bf(k,Re);if(L.rules.length>0)oe.html=oe.html.replace("</head>",`<style>
500
- ${ml(L.rules.join(`
542
+ `,{outfile:U,resolveDir:e},{minify:h,target:"browser"}),W+=1,o(` ${H.length} element(s) → ${M}`)}catch(le){let Ne=`Error bundling npm $elements [${H.join(", ")}]: ${je(le)}`;i.push(Ne),console.error(Ne)}}}if(S.size>0){let M=await QE(l,void 0,h);if(M.written>0)o(`Bundling ${M.written} runtime subpath module(s)...`);W+=M.written;for(let H of M.errors)i.push(H),console.error(H)}for(let M of J.emitters()){let H=M.project?.key,U=H?a[H]:void 0;if(H&&(U==null||V(U)&&Object.keys(U).length===0))continue;try{let le=await M.call("emit",U??null,{projectConfig:a,root:e,routes:oe,sections:me});for(let Ne of le??[]){let jt=ft(l,Ne.path.replace(/^\//,""));if(!jt.startsWith(l+AV))throw Error(`emit path escapes outDir: ${Ne.path}`);xn(Dn(jt),{recursive:!0}),en(jt,Ne.content),W+=1,o(` ${M.name} emitted ${Ne.path}`)}}catch(le){let Ne=`Error in ${M.name}.emit: ${je(le)}`;i.push(Ne),console.error(Ne)}}if(a.redirects&&Object.keys(a.redirects).length>0){o("Generating redirects...");let M=new Set(oe.map((U)=>U.urlPattern)),H=DV(a.redirects,l,{basePath:qt,compiledUrls:M,trailingSlash:a.build.trailingSlash});W+=H.files,i.push(...H.errors)}if(es)o(`Generating sitemap (${ts.length} URL(s))...`),W+=qV(ts,l);else if(!zt&&a.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(Ce.size>0){let{copied:M,missing:H}=E$(Ce,ue,l);W+=M,o(`Copying ${M} mounted asset(s)...`);for(let U of H)console.warn(`Referenced asset not found: ${U}`)}if(_s(u))o("Copying public/ assets..."),hf(u,l,{recursive:!0});if(es)W+=VV(l,zt);{let M=[WE(a),BE(a,new Date)];for(let le of M){for(let Ne of le.errors)i.push(Ne),console.error(Ne);for(let Ne of le.warnings)console.warn(Ne)}let{skipped:H,written:U}=UE(M.flatMap((le)=>le.files),l,_s);W+=U;for(let le of H)o(` ${le} — kept the copy from public/`)}{let M=jh(a.serviceWorker);if(M!==null){let H=M===!1?FE():LE(M,l,qt);for(let U of H.warnings)console.warn(U);for(let U of H.errors)i.push(U),console.error(U);if(H.path!==null)en(ti(l,H.path),H.source,"utf8"),W+=1,o(M===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:M,rules:H}=h$(a.build,E);i.push(...M);let U=y$([...H,...g$(l)],qt);if(U.length>0){o("Writing response headers..."),W+=b$(l,U);let{adapter:le,deploy:Ne}=a.build;if(le==="node"||le==="bun")console.warn(`The "${le}" 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(le===void 0&&Ne===void 0)if(_s(ft(u,"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 o(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}W+=x$(l)}if(a.copy){o("Copying mapped files...");for(let[M,H]of Object.entries(a.copy)){if(!O(H))throw TypeError(`project.json copy["${M}"] must be a destination path string`);let U=ft(e,M),le=ft(l,H);xn(Dn(le),{recursive:!0}),hf(U,le)}}if(o(`
543
+ Build complete: ${oe.length} routes, ${W} files`),i.length>0)o(` ${i.length} error(s)`);return{errors:i,files:W,routes:oe.length,serverEntries:ss}}async function RV(e,t,r,n,s,i,o,a,l,c,u,p,h,m,b,g){let y=Vi(t.url),w=await to(e.sourcePath,a),P=await R$(w,t,r),S=[...Pl(w,e.sourcePath,r),...O$(w,t,r).flatMap((de)=>Pl(de.doc,de.path,r))],E=J$(w.$head??P._pageHead??[],w.description),k=P.$head??[],A=w.title??P._pageTitle??null;delete P._pageHead,delete P._pageTitle,Qx(P,t,e,r,m.i18n,m.translations);let R=Yx({defaults:t.defaults,pageDir:O(w.$dir)?w.$dir:void 0,pageLang:O(w.$lang)?w.$lang:void 0,routeLocale:hn(e.urlPattern,m.i18n)});if(e.pagedState&&P.state&&e.pagedState.key in P.state)P.state[e.pagedState.key]=e.pagedState.items;await Ou(P,e,r,{config:t,registerBundle:(de)=>{c(de,null)},registry:l,sections:n});let _=Bo(P.state??{}),I=A??t.name;if(ye(I))I=Qt(I,_)??I;let L=Oh(r1(E,_),h),J=Oh(r1(k,_),h);Vl(P,_);let F={counter:{n:0},media:{...t.$media,...P.$media},rules:[]},K={n:0};if(Jh(P,i,F,t.defaults,K),P.state){let de=new Set;for(let[X,Pt]of Object.entries(P.state)){if(X==="$site"||X==="$page")continue;if(B(Pt)&&Pt.timing==="compiler")delete P.state[X];else if(Array.isArray(Pt))de.add(X)}let xt=!0;while(xt){xt=!1;let X={...P.state};for(let et of de)delete X[et];let Pt=JSON.stringify({children:P.children,state:X});for(let et of de)if(TV(Pt,et))de.delete(et),xt=!0}for(let X of de)delete P.state[X]}let ae=jh(t.serviceWorker),me=ae===null||ae===!1?[]:[{tagName:"script",textContent:qE(ae.scope??"/",y)}],ce=[...HE(t),...me,...p,...Oh(t.$head??[],h)],se=M$(ce,J,L,{title:I,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!El(e.urlPattern)&&{pageUrl:ea(e.urlPattern,t.build.trailingSlash)}});if(t.$media)P.$media={...t.$media,...P.$media};if(Object.values(P.$media??{}).some((de)=>yn(String(de))!==null))se.splice(2,0,{tagName:"script",textContent:Yo()});let ue=t.images;await NE(P,ue,r,s,o??void 0,u);let Ce={lang:R.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(de)=>Xe(y,c(de,Dn(e.sourcePath))),serverBaseUrl:Lu(y),title:I},Y=b["@vue/reactivity"];if(Y!==void 0)Ce.reactivitySrc=Y;let Ee=b["lit-html"];if(Ee!==void 0)Ce.litHtmlSrc=Ee;let oe=await Lm(P,Ce);if(F.rules.length>0)oe.html=oe.html.replace("</head>",`<style>
544
+ ${Pu(F.rules.join(`
501
545
  `))}
502
546
  </style>
503
- </head>`);oe.html=RL(oe.html,se,A);let V=(de)=>typeof de==="string"&&!de.startsWith("./")&&!de.startsWith("../"),Ye=[...new Set([...k.$elements??[],...v.$elements??[]].filter((de)=>V(de)))];if(Ye.length>0)oe.html=_L(oe.html,h(Ye));return{doc:k,excludeFromSitemap:v.$sitemap===!1,files:oe.files,html:oe.html,unregisteredRelations:Fy(se),serverEntries:S}}function SL(e,t,r){if(e.length===0)return{connectors:[],mounts:[]};let n=Js(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:u}=c;if(!T(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let p=He(n,c.basePath);return{basePath:p,className:l.classDef.title??l.name,module:u,options:{basePath:p,sections:s},order:c.order??100}}),o=new Set;for(let l of Object.values(s)){if(!X(l))continue;for(let c of Object.values(l)){let u=X(c)?c.provider:void 0;if(T(u))o.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!o.has(c))continue;let{module:u}=l.connector;if(!T(u)||u==="")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:u,provider:c})}return{connectors:a,mounts:i}}async function EL(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: ${ke(a)}`)}}return n}function Fd(e,t){if(Array.isArray(e))return e.map((r)=>Fd(r,t));if(X(e))return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Fd(n,t)]));if(ye(e))return Mt(e,t)??e;return e}function rw(e,t){return e.map((r)=>{if(!q(r))return r;let n={...r};if(n.attributes){n.attributes={...n.attributes};for(let[s,i]of Object.entries(n.attributes))if(ye(i))n.attributes[s]=Mt(i,t)??i}if(ye(n.textContent))n.textContent=Mt(n.textContent,t)??n.textContent;else if(q(n.textContent))n.textContent=Fd(n.textContent,t);return n})}function Md(e,t){return e.map((r)=>{if(!q(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)&&PL(i))n.attributes[s]=t(i)}return n})}function PL(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function iw(e){return cw(e).replaceAll("${","&#36;{")}function ow(e){return e.replaceAll("${","$​{")}function aw(e,t){if(!q(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 aw(i,t)});else if(n==="style"&&q(e.style)){let i={...e.style};for(let[o,a]of Object.entries(i))if(ye(a))i[o]=sc(a,t)??a;r.style=i}else if(n==="attributes"&&q(e.attributes)){let i={...e.attributes};for(let[o,a]of Object.entries(i))if(ye(a)){let l=sc(a,t);i[o]=T(l)&&l.includes("${")?ow(l):l??a}r.attributes=i}else if(n==="$props"&&q(e.$props)){let i={...e.$props};for(let[o,a]of Object.entries(i))if(ye(a)){let l=sc(a,t);i[o]=l!==null?l??null:a}r.$props=i}else if(ye(s)){let i=sc(s,t);if(n==="textContent"&&T(i)&&i.includes("${"))r.innerHTML=iw(i);else r[n]=i??s}else r[n]=s;return r}function sc(e,t){try{let r=t.$map,n=q(r)&&"item"in r?r.item:void 0,s=q(r)&&"index"in r?r.index:void 0,i=vi(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",i)(t,r,n,s)}catch{return null}}function aa(e,t){if(!q(e))return;if(ye(e.innerHTML)){let s=Mt(e.innerHTML,t);if(s!=null)e.innerHTML=String(s).replaceAll("${","&#36;{")}let r=e.textContent;if(ye(r)){let s=Mt(r,t);if(T(s)&&s.includes("${"))e.innerHTML=iw(s),delete e.textContent;else e.textContent=s??r}if(q(e.style)){for(let[s,i]of Object.entries(e.style))if(ye(i))e.style[s]=Mt(i,t)??i}if(q(e.attributes)){for(let[s,i]of Object.entries(e.attributes))if(ye(i)){let o=Mt(i,t);e.attributes[s]=T(o)&&o.includes("${")?ow(o):o??i}}if(q(e.$props)){let s=e.$props;for(let[i,o]of Object.entries(s))if(ye(o))s[i]=Mt(o,t)??o}let n=e.children;if(rt(n)){let s=nw(n,t);if(s&&s.length>0){e.children=s;return}}if(ye(n)){let s=Mt(n,t);if(Array.isArray(s)){let i=s;e.children=i;for(let o of i)aa(o,t)}}else if(Array.isArray(e.children)){let s=0;while(s<e.children.length){let i=e.children[s];if(ye(i)){let o=Mt(i,t);if(Array.isArray(o)){let a=o;e.children.splice(s,1,...a);for(let l of a)aa(l,t);s+=a.length;continue}}if(rt(i)){let o=nw(i,t);if(o&&o.length>0){e.children.splice(s,1,...o),s+=o.length;continue}}aa(i,t),s+=1}}}function jL(e,t){let r=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);return new RegExp(String.raw`\bstate\.${r}\b|#/state/${r}(?=["/])`).test(e)}function nw(e,t){let r=e.items,n=Je(r)?ff(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=aw(s,l);return aa(c,l),c})}function qd(e,t,r,n,s){if(!q(e))return;if(Array.isArray(e)){for(let a of e)qd(a,t,r,n,s);return}if(Array.isArray(e.children))for(let a of e.children)qd(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:k}=xf(e.attributes);if(v)e.attributes=k,e.$props={...v,...e.$props}}let a=(v)=>{if(r&&q(v)&&!Array.isArray(v))es(v,r.rules,r.media,"",r.counter,"jxs");return Ei(v,{},null)},l=Gs(o,n),c=e.$props||null,u={componentDefs:t,defaults:n,path:[{key:JSON.stringify(c??{}),tag:i}],slotIds:s},p=yl(o),{children:g}=e,m=!l&&!p&&Qn(o.children)?yf(u):null,b=l?(Array.isArray(g)?g:[]).map((v)=>a(v)).join(`
504
- `):null,h=qg(o,c,l?null:bf(g,{},a,m),u);if(m!==null)e.attributes={...e.attributes,[Lo]:String(m)};e.innerHTML=l?`<template shadowrootmode="${l}"><link rel="stylesheet" href="/components/${i}.css">${h}</template>${b??""}`:h,delete e.children;let y=$f(o.style,gl(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 kL(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 E=r.get(S);return E===void 0||E===""?[]:[E]}).join(`
547
+ </head>`);oe.html=MV(oe.html,se,R);let W=(de)=>typeof de==="string"&&!de.startsWith("./")&&!de.startsWith("../"),ot=[...new Set([...P.$elements??[],...w.$elements??[]].filter((de)=>W(de)))];if(ot.length>0)oe.html=JV(oe.html,g(ot));return{doc:P,excludeFromSitemap:w.$sitemap===!1,files:oe.files,html:oe.html,unregisteredRelations:F$(se),serverEntries:S}}function OV(e,t,r){if(e.length===0)return{connectors:[],mounts:[]};let n=Vi(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:u}=c;if(!O(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let p=Xe(n,c.basePath);return{basePath:p,className:l.classDef.title??l.name,module:u,options:{basePath:p,sections:s},order:c.order??100}}),o=new Set;for(let l of Object.values(s)){if(!B(l))continue;for(let c of Object.values(l)){let u=B(c)?c.provider:void 0;if(O(u))o.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!o.has(c))continue;let{module:u}=l.connector;if(!O(u)||u==="")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:u,provider:c})}return{connectors:a,mounts:i}}async function CV(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: ${je(a)}`)}}return n}function Ih(e,t){if(Array.isArray(e))return e.map((r)=>Ih(r,t));if(B(e))return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Ih(n,t)]));if(ye(e))return Qt(e,t)??e;return e}function r1(e,t){return e.map((r)=>{if(!V(r))return r;let n={...r};if(n.attributes){n.attributes={...n.attributes};for(let[s,i]of Object.entries(n.attributes))if(ye(i))n.attributes[s]=Qt(i,t)??i}if(ye(n.textContent))n.textContent=Qt(n.textContent,t)??n.textContent;else if(V(n.textContent))n.textContent=Ih(n.textContent,t);return n})}function Oh(e,t){return e.map((r)=>{if(!V(r)||!r.attributes)return r;let n={...r,attributes:{...r.attributes}};for(let s of["href","src"]){let i=n.attributes[s];if(O(i)&&NV(i))n.attributes[s]=t(i)}return n})}function NV(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function i1(e){return c1(e).replaceAll("${","&#36;{")}function o1(e){return e.replaceAll("${","$​{")}function a1(e,t){if(!V(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(O(i))return i;return a1(i,t)});else if(n==="style"&&V(e.style)){let i={...e.style};for(let[o,a]of Object.entries(i))if(ye(a))i[o]=gf(a,t)??a;r.style=i}else if(n==="attributes"&&V(e.attributes)){let i={...e.attributes};for(let[o,a]of Object.entries(i))if(ye(a)){let l=gf(a,t);i[o]=O(l)&&l.includes("${")?o1(l):l??a}r.attributes=i}else if(n==="$props"&&V(e.$props)){let i={...e.$props};for(let[o,a]of Object.entries(i))if(ye(a)){let l=gf(a,t);i[o]=l!==null?l??null:a}r.$props=i}else if(ye(s)){let i=gf(s,t);if(n==="textContent"&&O(i)&&i.includes("${"))r.innerHTML=i1(i);else r[n]=i??s}else r[n]=s;return r}function gf(e,t){try{let r=t.$map,n=V(r)&&"item"in r?r.item:void 0,s=V(r)&&"index"in r?r.index:void 0,i=Wo(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",i)(t,r,n,s)}catch{return null}}function Vl(e,t){if(!V(e))return;if(ye(e.innerHTML)){let s=Qt(e.innerHTML,t);if(s!=null)e.innerHTML=String(s).replaceAll("${","&#36;{")}let r=e.textContent;if(ye(r)){let s=Qt(r,t);if(O(s)&&s.includes("${"))e.innerHTML=i1(s),delete e.textContent;else e.textContent=s??r}if(V(e.style)){for(let[s,i]of Object.entries(e.style))if(ye(i))e.style[s]=Qt(i,t)??i}if(V(e.attributes)){for(let[s,i]of Object.entries(e.attributes))if(ye(i)){let o=Qt(i,t);e.attributes[s]=O(o)&&o.includes("${")?o1(o):o??i}}if(V(e.$props)){let s=e.$props;for(let[i,o]of Object.entries(s))if(ye(o))s[i]=Qt(o,t)??o}let n=e.children;if(dt(n)){let s=n1(n,t);if(s&&s.length>0){e.children=s;return}}if(ye(n)){let s=Qt(n,t);if(Array.isArray(s)){let i=s;e.children=i;for(let o of i)Vl(o,t)}}else if(Array.isArray(e.children)){let s=0;while(s<e.children.length){let i=e.children[s];if(ye(i)){let o=Qt(i,t);if(Array.isArray(o)){let a=o;e.children.splice(s,1,...a);for(let l of a)Vl(l,t);s+=a.length;continue}}if(dt(i)){let o=n1(i,t);if(o&&o.length>0){e.children.splice(s,1,...o),s+=o.length;continue}}Vl(i,t),s+=1}}}function TV(e,t){let r=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);return new RegExp(String.raw`\bstate\.${r}\b|#/state/${r}(?=["/])`).test(e)}function n1(e,t){let r=e.items,n=We(r)?om(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=a1(s,l);return Vl(c,l),c})}function Jh(e,t,r,n,s){if(!V(e))return;if(Array.isArray(e)){for(let a of e)Jh(a,t,r,n,s);return}if(Array.isArray(e.children))for(let a of e.children)Jh(a,t,r,n,s);let{tagName:i}=e;if(!O(i))return;let o=t.get(i);if(o){if(e.attributes){let{lifted:w,rest:P}=mm(e.attributes);if(w)e.attributes=P,e.$props={...w,...e.$props}}let a=(w)=>{if(r&&V(w)&&!Array.isArray(w))Us(w,r.rules,r.media,"",r.counter,"jxs");return Uo(w,{},null)},l=Qi(o,n),c=e.$props||null,u={componentDefs:t,defaults:n,path:[{key:JSON.stringify(c??{}),tag:i}],slotIds:s},p=_u(o),{children:h}=e,m=!l&&!p&&Bs(o.children)?dm(u):null,b=l?(Array.isArray(h)?h:[]).map((w)=>a(w)).join(`
548
+ `):null,g=qx(o,c,l?null:pm(h,{},a,m),u);if(m!==null)e.attributes={...e.attributes,[$l]:String(m)};e.innerHTML=l?`<template shadowrootmode="${l}"><link rel="stylesheet" href="/components/${i}.css">${g}</template>${b??""}`:g,delete e.children;let y=hm(o.style,ku(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 IV(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 E=r.get(S);return E===void 0||E===""?[]:[E]}).join(`
505
549
  `),u=c===""?"":`<style>
506
- ${ml(c)}
550
+ ${Pu(c)}
507
551
  </style>`,p=(S)=>{let E=S.filter(Boolean).join(`
508
552
  `);return E===""?e:e.replace("</head>",` ${E}
509
- </head>`)},g=l.filter((S)=>a(S)||!n.has(S));if(g.length===0)return p([u]);let m=Zv(i),h=[...Id(i),...g.map((S)=>`/components/${S}.js`)].map((S)=>`<link rel="modulepreload" href="${S}">`).join(`
510
- `),y=e.includes('<script type="importmap">'),v=p([y?"":m,h,u]),k=g.map((S)=>`<script type="module" src="/components/${S}.js"></script>`).join(`
511
- `);return v.replace("</body>",` ${k}
512
- </body>`)}function _L(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
513
- </body>`)}function RL(e,t,r){let n=Dy(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+=`
553
+ </head>`)},h=l.filter((S)=>a(S)||!n.has(S));if(h.length===0)return p([u]);let m=ZE(i),g=[...Rh(i),...h.map((S)=>`/components/${S}.js`)].map((S)=>`<link rel="modulepreload" href="${S}">`).join(`
554
+ `),y=e.includes('<script type="importmap">'),w=p([y?"":m,g,u]),P=h.map((S)=>`<script type="module" src="/components/${S}.js"></script>`).join(`
555
+ `);return w.replace("</body>",` ${P}
556
+ </body>`)}function JV(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
557
+ </body>`)}function MV(e,t,r){let n=D$(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+=`
514
558
  ${l.join(`
515
559
  `)}`;let c=i[1].match(/<script[\s\S]*?<\/script>/gi);if(c)o+=`
516
560
  ${c.join(`
517
561
  `)}`}let a=e;if(s.test(a))a=a.replace(s,`<head>
518
562
  ${n}${o}
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 lw(e,t,r){if(e==="/")return cs(t,"index.html");if(Vo(e))return cs(t,"404.html");let n=e.replace(/^\//,"");if(r==="always")return cs(t,n,"index.html");return cs(t,`${n}.html`)}function AL(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,u]of Object.entries(e)){let p=T(u)?u:u.destination,g=!T(u)&&"rewrite"in u&&u.rewrite,m=g?200:!T(u)&&("status"in u)?u.status??301:301;if(!g&&!Jd.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...Jd.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let b=r.basePath??"";if(i.push(`${He(b,c)} ${He(b,p)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(o(c)))console.warn(`The ${g?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(g)continue;let h=Jd.get(String(m));if(!h.html)continue;let y=lw(c,t,l),v=h.canonical?`
520
- <link rel="canonical" href="${Dd(p)}">`:`
521
- <meta name="robots" content="noindex">`,k=`<!DOCTYPE html>
563
+ </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 l1(e,t,r){if(e==="/")return ti(t,"index.html");if(El(e))return ti(t,"404.html");let n=e.replace(/^\//,"");if(r==="always")return ti(t,n,"index.html");return ti(t,`${n}.html`)}function DV(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,u]of Object.entries(e)){let p=O(u)?u:u.destination,h=!O(u)&&"rewrite"in u&&u.rewrite,m=h?200:!O(u)&&("status"in u)?u.status??301:301;if(!h&&!Ch.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...Ch.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let b=r.basePath??"";if(i.push(`${Xe(b,c)} ${Xe(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=Ch.get(String(m));if(!g.html)continue;let y=l1(c,t,l),w=g.canonical?`
564
+ <link rel="canonical" href="${Nh(p)}">`:`
565
+ <meta name="robots" content="noindex">`,P=`<!DOCTYPE html>
522
566
  <html>
523
567
  <head>
524
568
  <meta charset="utf-8">
525
- <meta http-equiv="refresh" content="0;url=${Dd(p)}">${v}
569
+ <meta http-equiv="refresh" content="0;url=${Nh(p)}">${w}
526
570
  <title>Redirecting...</title>
527
571
  </head>
528
572
  <body>
529
- <p>Redirecting to <a href="${Dd(p)}">${cw(p)}</a>...</p>
573
+ <p>Redirecting to <a href="${Nh(p)}">${c1(p)}</a>...</p>
530
574
  </body>
531
- </html>`;qr(tn(y),{recursive:!0}),_r(y,k,"utf8"),n+=1}if(i.length>0)_r(cs(t,"_redirects"),`${i.join(`
575
+ </html>`;xn(Dn(y),{recursive:!0}),en(y,P,"utf8"),n+=1}if(i.length>0)en(ti(t,"_redirects"),`${i.join(`
532
576
  `)}
533
- `,"utf8"),n+=1;return{errors:s,files:n}}function cw(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Dd(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function Ld(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function OL(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function NL(e,t){if(e.length===0)return 0;let r=e.map((i)=>{let o=(i.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${Ld(a.hreflang)}" href="${Ld(a.href)}"/>`).join(`
577
+ `,"utf8"),n+=1;return{errors:s,files:n}}function c1(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Nh(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function Th(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function LV(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function qV(e,t){if(e.length===0)return 0;let r=e.map((i)=>{let o=(i.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${Th(a.hreflang)}" href="${Th(a.href)}"/>`).join(`
534
578
  `);return` <url>
535
- <loc>${Ld(i.loc)}</loc>
579
+ <loc>${Th(i.loc)}</loc>
536
580
  <lastmod>${i.lastmod}</lastmod>
537
581
  ${o===""?"":`${o}
538
582
  `} </url>`}).join(`
539
583
  `),s=`<?xml version="1.0" encoding="UTF-8"?>
540
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((i)=>(i.alternates?.length??0)>0)?` xmlns:xhtml="${CL}"`:""}>
584
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((i)=>(i.alternates?.length??0)>0)?` xmlns:xhtml="${FV}"`:""}>
541
585
  ${r}
542
586
  </urlset>
543
- `;return _r(cs(t,"sitemap.xml"),s,"utf8"),1}function TL(e,t){let r=cs(e,"robots.txt"),n=qn(r),s=n?mL(r,"utf8"):`User-agent: *
587
+ `;return en(ti(t,"sitemap.xml"),s,"utf8"),1}function VV(e,t){let r=ti(e,"robots.txt"),n=_s(r),s=n?vV(r,"utf8"):`User-agent: *
544
588
  Allow: /
545
589
  `;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
546
590
  `))s+=`
547
591
  `;return s+=`
548
- Sitemap: ${Yn("/sitemap.xml",t)}
549
- `,_r(r,s,"utf8"),n?0:1}var tw='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',Jd,CL="http://www.w3.org/1999/xhtml";var uw=H(()=>{Pe();hr();gr();mh();Fu();jo();ly();$y();jn();wy();Py();Cy();Iy();Ly();qy();Pf();ob();Uo();Vf();Ur();wi();kf();Jv();Af();Hv();vf();zv();Sf();ew();_d();Jd=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 IL}from"node:module";import{join as ML}from"node:path";import{spawn as JL}from"node:child_process";function DL(e){try{return IL(ML(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 fw(e,t,r=JL,n=process){let i=[DL(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 dw=()=>{};import{createServer as LL}from"node:http";import{existsSync as ic,readFileSync as pw,statSync as FL}from"node:fs";import{extname as qL,join as Hd,normalize as HL,resolve as mw,sep as VL}from"node:path";function WL(e,t){let r=HL(t).replaceAll("\\","/"),n=mw(e,`.${r.startsWith("/")?r:`/${r}`}`);if(n!==e&&!n.startsWith(e+VL))return null;if(ic(n)){if(FL(n).isDirectory()){let i=Hd(n,"index.html");return ic(i)?i:null}return n}let s=Hd(n,"index.html");return ic(s)?s:null}function hw(e,t){let r=mw(e),n=LL((s,i)=>{let o=new URL(s.url??"/","http://localhost"),a=WL(r,decodeURIComponent(o.pathname));if(a){i.writeHead(200,{"Content-Type":BL.get(qL(a).toLowerCase())??"application/octet-stream"}),i.end(pw(a));return}let l=Hd(r,"404.html");if(ic(l)){i.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),i.end(pw(l));return}i.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),i.end("Not found")});return n.listen(t),n}var BL;var gw=H(()=>{$u();BL=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",...Km}))});var la="https://jxsuite.com/schema/project/fields/v2",ti="https://jxsuite.com/schema/document/paths/v2",yw,bw,ca,Vd;var oc=H(()=>{yw={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"},bw={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"},ca=[{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"},{additionalProperties:!1,description:"Paged list: one route per `pageSize` items of an entry of this page's own state, which must resolve to an array at build time. The page number fills the route's one parameter that `each` does not.",properties:{each:{description:"Another `$paths` source for the route's other parameter: the list is paged once per value of it, as a paged archive per tag is.",type:["object","array"]},pageSize:{description:"Items on each page.",minimum:1,type:"integer"},paginate:{additionalProperties:!1,description:"The state entry to page.",properties:{$ref:{description:"A pointer to an entry of this page's state: `#/state/<key>`.",pattern:"^#/state/[^/]+$",type:"string"}},required:["$ref"],type:"object"}},required:["paginate","pageSize"],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"}],Vd={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 UL(e){let{corePath:t,fragments:r,fieldSchemaRefs:n=[]}=e;return{$comment:ww,$defs:{Fields:{$id:la,anyOf:[{$ref:`${xw}#/$defs/JxFieldSchema`},{$ref:`${xw}#/$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 fa(e,t,r,n=[]){let s=structuredClone(e),i=new Map,o=new Set;Bd(s,o);let a=0,l=async(u)=>{let p=ua(u),g=i.get(p);if(g!==void 0)return g;let m;try{m=structuredClone(await t(p))}catch(v){throw Error(`bundleSchema: cannot load $ref target "${p}": ${QL(v)}`,{cause:v})}let b=T(m.$id)&&us(m.$id)?m.$id:null;a+=b===null?1:0;let h=b??`urn:jx:bundled:${a}`;if(i.set(p,h),o.has(h))return h;o.add(h),m.$id=h,await c(m,ZL(p),!0);let y=s.$defs??={};return y[h]=m,h},c=async(u,p,g=!1)=>{if(Array.isArray(u)){for(let y of u)await c(y,p);return}if(!X(u))return;let m=u,b=p;if(!g&&T(m.$id)&&us(m.$id))b=null;let h=m.$ref;if(T(h)&&b!==null&&!h.startsWith("#")&&!us(h)){let y=h.indexOf("#"),v=y===-1?h:h.slice(0,y),k=y===-1?"":h.slice(y);if(v){let S=await l(`${b}/${v}`);m.$ref=`${S}${k}`}}for(let y of Object.values(m))await c(y,b)};await c(s,ua(r),!0);for(let u of n)await l(`${ua(r)}/${u}`);return s}function YL(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*$w(e,t){for(let r of zL){let n=e[r];if(Array.isArray(n)){for(let[s,i]of n.entries())if(X(i))yield[i,`${t}/${r}/${s}`]}else if(X(n))yield[n,`${t}/${r}`]}for(let r of GL){let n=e[r];if(!X(n))continue;for(let[s,i]of Object.entries(n))if(X(i))yield[i,`${t}/${r}/${YL(s)}`]}for(let r of KL){let n=e[r];if(!Array.isArray(n))continue;for(let[s,i]of n.entries())if(X(i))yield[i,`${t}/${r}/${s}`]}}function XL(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 da(e){let t=structuredClone(e);if(X(t.$defs)){let i=new Set(Object.keys(t.$defs).filter((a)=>!us(a))),o={};for(let[a,l]of Object.entries(t.$defs)){let c=X(l)&&T(l.$id)?l.$id:a;o[us(a)?XL(c,i):a]=l}t.$defs=o}let r=new Map,n=(i,o)=>{let{$id:a}=i;if(T(a)&&us(a)&&!r.has(a))r.set(a,o);for(let[l,c]of $w(i,o))n(l,c)};n(t,"#");let s=(i,o)=>{let a=o,{$id:l}=i;if(T(l)&&us(l)){if(a=r.get(l)??o,a!=="#")delete i.$id}let c=i.$ref;if(T(c)){let u=c.indexOf("#"),p=u===-1?c:c.slice(0,u),g=u===-1?"":c.slice(u+1);if(p===""){if(g.startsWith("/"))i.$ref=`${a}${g}`}else{let m=r.get(p);if(m!==void 0)i.$ref=g?`${m}${g}`:m}}for(let[u]of $w(i,a))s(u,a)};return s(t,"#"),t}function Bd(e,t){if(Array.isArray(e)){for(let n of e)Bd(n,t);return}if(!X(e))return;let r=e;if(T(r.$id)&&us(r.$id))t.add(r.$id);for(let n of Object.values(r))Bd(n,t)}function us(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function ua(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 ZL(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function QL(e){return e instanceof Error?e.message:String(e)}function eF(e){let{corePath:t,pathsValueRefs:r}=e;return{$comment:ww,$defs:{PathsValue:{$id:ti,anyOf:[...ca,...r.map((n)=>({$ref:n}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function Sw(e){let{baseDir:t,coreDocumentRef:r,coreProjectRef:n,extensions:s,loadJson:i}=e,o=[],a=[],l=[],c=[];for(let g of s){if(g.project)o.push(g.project);if(g.document){let m=await vw(g.document,i,t);if(a.push(...m),m.length>0)l.push(g.document)}if(g.fields)c.push(...await vw(g.fields,i,t)),o.push(g.fields)}let u=UL({corePath:n,fieldSchemaRefs:c,fragments:o}),p=eF({corePath:r,pathsValueRefs:a});return{document:da(await fa(p,i,t,l)),project:da(await fa(u,i,t))}}async function vw(e,t,r){let n;try{n=await t(ua(`${ua(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 xw="https://jxsuite.com/schema/project/core/v2",ww="Generated by `jx schema` from project.json#/extensions — do not edit.",zL,GL,KL;var Ew=H(()=>{oc();Pe();oc();zL=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],GL=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],KL=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as kw,readFileSync as tF,statSync as Pw,writeFileSync as ac}from"node:fs";import{createRequire as Ud}from"node:module";import{dirname as rF,isAbsolute as nF,relative as zd,resolve as Hn,sep as Gd}from"node:path";async function _w(e){let{config:t}=Kn(e),r=await Gn(e,t),n=Hn(e),{document:s,project:i}=await Sw({baseDir:n,coreDocumentRef:jw(e,iF),coreProjectRef:jw(e,sF),extensions:r.extensions.map((o)=>({document:o.schemas.document&&Wd(e,o,o.schemas.document),fields:o.schemas.fields&&Wd(e,o,o.schemas.fields),project:o.schemas.project&&Wd(e,o,o.schemas.project)})),loadJson:Ow(n)});return{documentSchema:s,projectSchema:i}}async function Rw(e){let{documentSchema:t,projectSchema:r}=await _w(e),n=Hn(e,"project.schema.json"),s=Hn(e,"document.schema.json");return ac(n,`${JSON.stringify(r,null,2)}
550
- `,"utf8"),ac(s,`${JSON.stringify(t,null,2)}
551
- `,"utf8"),{documentSchemaPath:s,projectSchemaPath:n}}async function Aw(e,t={}){let{write:r=!0}=t,n=Hn(e),s=Hn(n,"project.json"),i=Hn(n,"project.schema.json"),o=Hn(n,"document.schema.json"),a=(h)=>{if(!kw(h))return!0;try{return Pw(s).mtimeMs>Pw(h).mtimeMs}catch{return!1}},c=a(i)||a(o)?await _w(n):null;if(c&&r)ac(i,`${JSON.stringify(c.projectSchema,null,2)}
552
- `,"utf8"),ac(o,`${JSON.stringify(c.documentSchema,null,2)}
553
- `,"utf8");let u=Ow(n),p=c?.projectSchema??pa(i),g=c?.documentSchema??pa(o),m=da(await fa(p,u,n));return{document:da(await fa(g,u,n)),project:m}}function pa(e){let t=JSON.parse(tF(e,"utf8"));if(!X(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function aF(e){return e.startsWith(oF)&&e.endsWith(".json")}function lF(e,t){try{return Ud(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 Ow(e){return async(t)=>{let r=Hn(t),n=zd(e,r);if(n.startsWith("..")||nF(n))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=n.split(Gd).join("/"),i="node_modules/",o=s.lastIndexOf(i),a=o===-1?null:s.slice(o+i.length);if(a!==null&&aF(a))return pa(lF(a,t));if(kw(r))return pa(r);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=Pu(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 pa(l)}}function jw(e,t){let r=null;try{r=Ud(Hn(e,"package.json")).resolve(t)}catch{try{r=Ud(import.meta.url).resolve(t)}catch{r=null}}let n=`./node_modules/${t}`;return r?Cw(e,r,n):n}function Wd(e,t,r){let n=zd(rF(t.manifestPath),r).split(Gd).join("/"),s=`./node_modules/${t.specifier}/${n}`;return Cw(e,r,s)}function Cw(e,t,r){let n=zd(e,t).split(Gd).join("/");if(n.startsWith(".."))return r;return n.startsWith("./")?n:`./${n}`}var sF="@jxsuite/schema/schemas/project.core.schema.json",iF="@jxsuite/schema/schema.json",oF="@jxsuite/schema/";var Kd=H(()=>{Ew();Pe();jn();jo()});var Iw=C(function(lX,Tw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",Nw=De("fs").promises,lc=De("path");async function cF({folder:e=__dirname}={}){let t={},r=await Nw.readdir(e);for(let n of r)if(n.endsWith(".json")&&n!=="package.json"){let s=await Nw.readFile(lc.join(e,n),"utf8");t[lc.basename(n,".json")]=JSON.parse(s)}return t}Tw.exports={listAll:cF}});var Lw=C(function(cX,Dw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",uF=De("fs").promises,Mw=De("path");async function Jw({folder:e=__dirname}={}){let t=await uF.readFile(Mw.join(e,"css.json"),"utf8");return JSON.parse(t)}async function fF({folder:e=__dirname}={}){let t=await Jw(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}Dw.exports={listAll:Jw,index:fF}});var Fw=C(function(cc,Yd){(function(e,t){typeof cc=="object"&&typeof Yd=="object"?Yd.exports=t():typeof define=="function"&&define.amd?define([],t):typeof cc=="object"?cc.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(d,x)=>{for(var w in x)e.o(x,w)&&!e.o(d,w)&&Object.defineProperty(d,w,{enumerable:!0,get:x[w]})},o:(d,x)=>Object.prototype.hasOwnProperty.call(d,x),r:(d)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})}},t={};function r(d,x,w,P,O,{level:z="error",autofix:ee,ruleName:ge}={}){function pe(dr){return dr>0?d.slice(x,x+dr):d.slice(Math.max(x+dr,0),x)}function xe(dr,{precedes:Cs}={}){let Sn=dr.map((So)=>So.trivia+So.value).join(""),wo=d[x];return wo.type==="eof"?Sn:Cs?Sn+wo.trivia:Sn.slice(wo.trivia.length)}let Oe=d[x].type!=="eof"?d[x].line:d.length>1?d[x-1].line:1,Te=function(dr){let Cs=dr.split(`
554
- `);return Cs[Cs.length-1]}(xe(pe(-5),{precedes:!0})),qt=pe(5),Kt=xe(qt),vo=Te+Kt.split(`
592
+ Sitemap: ${Vs("/sitemap.xml",t)}
593
+ `,en(r,s,"utf8"),n?0:1}var t1='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',Ch,FV="http://www.w3.org/1999/xhtml";var u1=D(()=>{ve();ir();Lr();m0();Jp();al();l$();$$();ms();v$();P$();C$();I$();L$();q$();$m();ow();kl();Dm();An();Ho();vm();ME();Pm();VE();gm();zE();bm();e1();Sh();Io();Ch=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 WV}from"node:module";import{join as HV}from"node:path";import{spawn as BV}from"node:child_process";function UV(e){try{return WV(HV(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 f1(e,t,r=BV,n=process){let i=[UV(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 d1=()=>{};import{createServer as zV}from"node:http";import{existsSync as yf,readFileSync as p1,statSync as GV}from"node:fs";import{extname as KV,join as Mh,normalize as YV,resolve as m1,sep as XV}from"node:path";function QV(e,t){let r=YV(t).replaceAll("\\","/"),n=m1(e,`.${r.startsWith("/")?r:`/${r}`}`);if(n!==e&&!n.startsWith(e+XV))return null;if(yf(n)){if(GV(n).isDirectory()){let i=Mh(n,"index.html");return yf(i)?i:null}return n}let s=Mh(n,"index.html");return yf(s)?s:null}function h1(e,t){let r=m1(e),n=zV((s,i)=>{let o=new URL(s.url??"/","http://localhost"),a=QV(r,decodeURIComponent(o.pathname));if(a){i.writeHead(200,{"Content-Type":ZV.get(KV(a).toLowerCase())??"application/octet-stream"}),i.end(p1(a));return}let l=Mh(r,"404.html");if(yf(l)){i.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),i.end(p1(l));return}i.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),i.end("Not found")});return n.listen(t),n}var ZV;var g1=D(()=>{Nd();ZV=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",...Uy}))});var Wl="https://jxsuite.com/schema/project/fields/v2",oo="https://jxsuite.com/schema/document/paths/v2",y1,b1,Hl,Dh;var bf=D(()=>{y1={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"},b1={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"},Hl=[{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"},{additionalProperties:!1,description:"Paged list: one route per `pageSize` items of an entry of this page's own state, which must resolve to an array at build time. The page number fills the route's one parameter that `each` does not.",properties:{each:{description:"Another `$paths` source for the route's other parameter: the list is paged once per value of it, as a paged archive per tag is.",type:["object","array"]},pageSize:{description:"Items on each page.",minimum:1,type:"integer"},paginate:{additionalProperties:!1,description:"The state entry to page.",properties:{$ref:{description:"A pointer to an entry of this page's state: `#/state/<key>`.",pattern:"^#/state/[^/]+$",type:"string"}},required:["$ref"],type:"object"}},required:["paginate","pageSize"],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"}],Dh={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 eW(e){let{corePath:t,fragments:r,fieldSchemaRefs:n=[]}=e;return{$comment:v1,$defs:{Fields:{$id:Wl,anyOf:[{$ref:`${x1}#/$defs/JxFieldSchema`},{$ref:`${x1}#/$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 Ul(e,t,r,n=[]){let s=structuredClone(e),i=new Map,o=new Set;Lh(s,o);let a=0,l=async(u)=>{let p=Bl(u),h=i.get(p);if(h!==void 0)return h;let m;try{m=structuredClone(await t(p))}catch(w){throw Error(`bundleSchema: cannot load $ref target "${p}": ${aW(w)}`,{cause:w})}let b=O(m.$id)&&ri(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,oW(p),!0);let y=s.$defs??={};return y[g]=m,g},c=async(u,p,h=!1)=>{if(Array.isArray(u)){for(let y of u)await c(y,p);return}if(!B(u))return;let m=u,b=p;if(!h&&O(m.$id)&&ri(m.$id))b=null;let g=m.$ref;if(O(g)&&b!==null&&!g.startsWith("#")&&!ri(g)){let y=g.indexOf("#"),w=y===-1?g:g.slice(0,y),P=y===-1?"":g.slice(y);if(w){let S=await l(`${b}/${w}`);m.$ref=`${S}${P}`}}for(let y of Object.values(m))await c(y,b)};await c(s,Bl(r),!0);for(let u of n)await l(`${Bl(r)}/${u}`);return s}function sW(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*$1(e,t){for(let r of tW){let n=e[r];if(Array.isArray(n)){for(let[s,i]of n.entries())if(B(i))yield[i,`${t}/${r}/${s}`]}else if(B(n))yield[n,`${t}/${r}`]}for(let r of rW){let n=e[r];if(!B(n))continue;for(let[s,i]of Object.entries(n))if(B(i))yield[i,`${t}/${r}/${sW(s)}`]}for(let r of nW){let n=e[r];if(!Array.isArray(n))continue;for(let[s,i]of n.entries())if(B(i))yield[i,`${t}/${r}/${s}`]}}function iW(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 zl(e){let t=structuredClone(e);if(B(t.$defs)){let i=new Set(Object.keys(t.$defs).filter((a)=>!ri(a))),o={};for(let[a,l]of Object.entries(t.$defs)){let c=B(l)&&O(l.$id)?l.$id:a;o[ri(a)?iW(c,i):a]=l}t.$defs=o}let r=new Map,n=(i,o)=>{let{$id:a}=i;if(O(a)&&ri(a)&&!r.has(a))r.set(a,o);for(let[l,c]of $1(i,o))n(l,c)};n(t,"#");let s=(i,o)=>{let a=o,{$id:l}=i;if(O(l)&&ri(l)){if(a=r.get(l)??o,a!=="#")delete i.$id}let c=i.$ref;if(O(c)){let u=c.indexOf("#"),p=u===-1?c:c.slice(0,u),h=u===-1?"":c.slice(u+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[u]of $1(i,a))s(u,a)};return s(t,"#"),t}function Lh(e,t){if(Array.isArray(e)){for(let n of e)Lh(n,t);return}if(!B(e))return;let r=e;if(O(r.$id)&&ri(r.$id))t.add(r.$id);for(let n of Object.values(r))Lh(n,t)}function ri(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function Bl(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 oW(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function aW(e){return e instanceof Error?e.message:String(e)}function lW(e){let{corePath:t,pathsValueRefs:r}=e;return{$comment:v1,$defs:{PathsValue:{$id:oo,anyOf:[...Hl,...r.map((n)=>({$ref:n}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function S1(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 w1(h.document,i,t);if(a.push(...m),m.length>0)l.push(h.document)}if(h.fields)c.push(...await w1(h.fields,i,t)),o.push(h.fields)}let u=eW({corePath:n,fieldSchemaRefs:c,fragments:o}),p=lW({corePath:r,pathsValueRefs:a});return{document:zl(await Ul(p,i,t,l)),project:zl(await Ul(u,i,t))}}async function w1(e,t,r){let n;try{n=await t(Bl(`${Bl(r)}/${e}`))}catch{return[]}let{$id:s}=n;if(!O(s)||!n.$defs)return[];return Object.keys(n.$defs).map((i)=>`${s}#/$defs/${i}`)}var x1="https://jxsuite.com/schema/project/core/v2",v1="Generated by `jx schema` from project.json#/extensions — do not edit.",tW,rW,nW;var E1=D(()=>{bf();ve();bf();tW=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],rW=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],nW=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as k1,readFileSync as cW,statSync as P1,writeFileSync as xf}from"node:fs";import{createRequire as qh}from"node:module";import{dirname as uW,isAbsolute as fW,relative as Vh,resolve as ni,sep as Wh}from"node:path";async function _1(e){let{config:t}=qs(e),r=await Fs(e,t),n=ni(e),{document:s,project:i}=await S1({baseDir:n,coreDocumentRef:j1(e,pW),coreProjectRef:j1(e,dW),extensions:r.extensions.map((o)=>({document:o.schemas.document&&Fh(e,o,o.schemas.document),fields:o.schemas.fields&&Fh(e,o,o.schemas.fields),project:o.schemas.project&&Fh(e,o,o.schemas.project)})),loadJson:O1(n)});return{documentSchema:s,projectSchema:i}}async function A1(e){let{documentSchema:t,projectSchema:r}=await _1(e),n=ni(e,"project.schema.json"),s=ni(e,"document.schema.json");return xf(n,`${JSON.stringify(r,null,2)}
594
+ `,"utf8"),xf(s,`${JSON.stringify(t,null,2)}
595
+ `,"utf8"),{documentSchemaPath:s,projectSchemaPath:n}}async function R1(e,t={}){let{write:r=!0}=t,n=ni(e),s=kn(n),i=ni(n,"project.schema.json"),o=ni(n,"document.schema.json"),a=(g)=>{if(!k1(g))return!0;try{return P1(s).mtimeMs>P1(g).mtimeMs}catch{return!1}},c=a(i)||a(o)?await _1(n):null;if(c&&r)xf(i,`${JSON.stringify(c.projectSchema,null,2)}
596
+ `,"utf8"),xf(o,`${JSON.stringify(c.documentSchema,null,2)}
597
+ `,"utf8");let u=O1(n),p=c?.projectSchema??Gl(i),h=c?.documentSchema??Gl(o),m=zl(await Ul(p,u,n));return{document:zl(await Ul(h,u,n)),project:m}}function Gl(e){let t=JSON.parse(cW(e,"utf8"));if(!B(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function hW(e){return e.startsWith(mW)&&e.endsWith(".json")}function gW(e,t){try{return qh(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 O1(e){return async(t)=>{let r=ni(t),n=Vh(e,r);if(n.startsWith("..")||fW(n))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=n.split(Wh).join("/"),i="node_modules/",o=s.lastIndexOf(i),a=o===-1?null:s.slice(o+i.length);if(a!==null&&hW(a))return Gl(gW(a,t));if(k1(r))return Gl(r);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=wp(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 Gl(l)}}function j1(e,t){let r=null;try{r=qh(ni(e,"package.json")).resolve(t)}catch{try{r=qh(import.meta.url).resolve(t)}catch{r=null}}let n=`./node_modules/${t}`;return r?C1(e,r,n):n}function Fh(e,t,r){let n=Vh(uW(t.manifestPath),r).split(Wh).join("/"),s=`./node_modules/${t.specifier}/${n}`;return C1(e,r,s)}function C1(e,t,r){let n=Vh(e,t).split(Wh).join("/");if(n.startsWith(".."))return r;return n.startsWith("./")?n:`./${n}`}var dW="@jxsuite/schema/schemas/project.core.schema.json",pW="@jxsuite/schema/schema.json",mW="@jxsuite/schema/";var Hh=D(()=>{E1();ve();ms();al();Io()});var I1=N(function(Lse,T1){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",N1=He("fs").promises,$f=He("path");async function yW({folder:e=__dirname}={}){let t={},r=await N1.readdir(e);for(let n of r)if(n.endsWith(".json")&&n!=="package.json"){let s=await N1.readFile($f.join(e,n),"utf8");t[$f.basename(n,".json")]=JSON.parse(s)}return t}T1.exports={listAll:yW}});var L1=N(function(Fse,D1){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",bW=He("fs").promises,J1=He("path");async function M1({folder:e=__dirname}={}){let t=await bW.readFile(J1.join(e,"css.json"),"utf8");return JSON.parse(t)}async function xW({folder:e=__dirname}={}){let t=await M1(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}D1.exports={listAll:M1,index:xW}});var F1=N(function(wf,Bh){(function(e,t){typeof wf=="object"&&typeof Bh=="object"?Bh.exports=t():typeof define=="function"&&define.amd?define([],t):typeof wf=="object"?wf.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(d,x)=>{for(var v in x)e.o(x,v)&&!e.o(d,v)&&Object.defineProperty(d,v,{enumerable:!0,get:x[v]})},o:(d,x)=>Object.prototype.hasOwnProperty.call(d,x),r:(d)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})}},t={};function r(d,x,v,j,C,{level:G="error",autofix:ee,ruleName:ge}={}){function pe(Tr){return Tr>0?d.slice(x,x+Tr):d.slice(Math.max(x+Tr,0),x)}function xe(Tr,{precedes:Pi}={}){let is=Tr.map((Ha)=>Ha.trivia+Ha.value).join(""),Wa=d[x];return Wa.type==="eof"?is:Pi?is+Wa.trivia:is.slice(Wa.trivia.length)}let Te=d[x].type!=="eof"?d[x].line:d.length>1?d[x-1].line:1,Le=function(Tr){let Pi=Tr.split(`
598
+ `);return Pi[Pi.length-1]}(xe(pe(-5),{precedes:!0})),sr=pe(5),hr=xe(sr),Va=Le+hr.split(`
555
599
  `)[0]+`
556
- `+(" ".repeat(Te.length)+"^"),yu=O==="Syntax"?"since":"inside",Em=`${O} error at line ${Oe}${d.name?` in ${d.name}`:""}${w&&w.name?`, ${yu} \`${w.partial?"partial ":""}${function(dr){let Cs=[dr];for(;dr&&dr.parent;){let{parent:Sn}=dr;Cs.unshift(Sn),dr=Sn}return Cs.map((Sn)=>function(wo,So){let Pm=wo;return So&&(Pm+=` ${So}`),Pm}(Sn.type,Sn.name)).join(" -> ")}(w)}\``:""}:
557
- ${vo}`;return{message:`${Em} ${P}`,bareMessage:P,context:Em,line:Oe,sourceName:d.name,level:z,ruleName:ge,autofix:ee,input:Kt,tokens:qt}}function n(d,x,w,P){return r(d,x,w,P,"Syntax")}function s(d,x,w,P,O={}){return O.ruleName=w,r(x.source,d.index,x,P,"Validation",O)}e.r(t),e.d(t,{WebIDLParseError:()=>bt,parse:()=>Ae,validate:()=>xt,write:()=>ve});class i{constructor({source:d,tokens:x}){Object.defineProperties(this,{source:{value:d},tokens:{value:x,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let d={type:void 0,name:void 0,inheritance:void 0},x=this;for(;x!==Object.prototype;){let w=Object.getOwnPropertyDescriptors(x);for(let[P,O]of Object.entries(w))(O.enumerable||O.get)&&(d[P]=this[P]);x=Object.getPrototypeOf(x)}return d}}function o(d,x,{useNullableInner:w}={}){if(!d.union){let P=x.unique.get(d.idlType);if(!P)return;if(P.type==="typedef"){let{typedefIncludesDictionary:O}=x.cache;if(O.has(P))return O.get(P);x.cache.typedefIncludesDictionary.set(P,void 0);let z=o(P.idlType,x);if(x.cache.typedefIncludesDictionary.set(P,z),z)return{reference:d,dictionary:z.dictionary}}if(P.type==="dictionary"&&(w||!d.nullable))return{reference:d,dictionary:P}}for(let P of d.subtype){let O=o(P,x);if(O)return P.union?O:{reference:P,dictionary:O.dictionary}}}function a(d,x){if(x.cache.dictionaryIncludesRequiredField.has(d))return x.cache.dictionaryIncludesRequiredField.get(d);x.cache.dictionaryIncludesRequiredField.set(d,void 0);let w=d.members.some((P)=>P.required);if(!w&&d.inheritance){let P=x.unique.get(d.inheritance);P?a(P,x)&&(w=!0):w=!0}return x.cache.dictionaryIncludesRequiredField.set(d,w),w}class l extends Array{constructor({source:d,tokens:x}){super(),Object.defineProperties(this,{source:{value:d},tokens:{value:x},parent:{value:null,writable:!0}})}}class c extends i{static parser(d,x){return()=>{let w=d.consumeKind(x);if(w)return new c({source:d.source,tokens:{value:w}})}}get value(){return M(this.tokens.value.value)}write(d){return d.ts.wrap([d.token(this.tokens.value),d.token(this.tokens.separator)])}}class u extends c{static parse(d){let x=d.consumeKind("eof");if(x)return new u({source:d.source,tokens:{value:x}})}get type(){return"eof"}}function p(d,x){return L(d,{parser:c.parser(d,x),listName:x+" list"})}let g=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((d)=>[d,`Legacy${d}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function b(d){for(let x of g){let w=p(d,x);if(w.length)return w}d.error("Expected identifiers, strings, decimals, or integers but none found")}class h extends i{static parse(d){let x={assign:d.consume("=")},w=V(new h({source:d.source,tokens:x}));if(w.list=[],x.assign){if(x.asterisk=d.consume("*"),x.asterisk)return w.this;x.secondaryName=d.consumeKind(...g)}return x.open=d.consume("("),x.open?(w.list=w.rhsIsList?b(d):ce(d),x.close=d.consume(")")||d.error("Unexpected token in extended attribute argument list")):x.assign&&!x.secondaryName&&d.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(d){let{rhsType:x}=this;return d.ts.wrap([d.token(this.tokens.assign),d.token(this.tokens.asterisk),d.reference_token(this.tokens.secondaryName,this.parent),d.token(this.tokens.open),...this.list.map((w)=>x==="identifier-list"?d.identifier(w,this.parent):w.write(d)),d.token(this.tokens.close)])}}class y extends i{static parse(d){let x=d.consumeKind("identifier");if(x)return new y({source:d.source,tokens:{name:x},params:h.parse(d)})}constructor({source:d,tokens:x,params:w}){super({source:d,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:d,tokens:x,list:w}=this.params;if(!d)return null;return{type:d,value:this.params.rhsIsList?w:this.params.tokens.secondaryName?M(x.secondaryName.value):null}}get arguments(){let{rhsIsList:d,list:x}=this.params;return!x||d?[]:x}*validate(d){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 P=`\`[${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",P,{level:"warning",autofix:(w=this,()=>{let{name:O}=w;w.tokens.name.value=m.get(O),O==="TreatNullAs"&&(w.params.tokens={})})})}var w;for(let P of this.arguments)yield*P.validate(d)}write(d){return d.ts.wrap([d.ts.trivia(this.tokens.name.trivia),d.ts.extendedAttribute(d.ts.wrap([d.ts.extendedAttributeReference(this.name),this.params.write(d)])),d.token(this.tokens.separator)])}}class v extends l{static parse(d){let x={};x.open=d.consume("[");let w=new v({source:d.source,tokens:x});return x.open?(w.push(...L(d,{parser:y.parse,listName:"extended attribute"})),x.close=d.consume("]")||d.error("Expected a closing token for the extended attribute list"),w.length||(d.unconsume(x.close.index),d.error("An extended attribute list must not be empty")),d.probe("[")&&d.error("Illegal double extended attribute lists, consider merging them"),w):w}*validate(d){for(let x of this)yield*x.validate(d)}write(d){return this.length?d.ts.wrap([d.token(this.tokens.open),...this.map((x)=>x.write(d)),d.token(this.tokens.close)]):""}}function k(d,x){let w=d.consume("?");w&&(x.tokens.nullable=w),d.probe("?")&&d.error("Can't nullable more than once")}function S(d,x){let w=function(P,O){let z=P.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!z)return;let ee=V(new E({source:P.source,tokens:{base:z}}));switch(ee.tokens.open=P.consume("<")||P.error(`No opening bracket after ${z.value}`),z.value){case"Promise":{P.probe("[")&&P.error("Promise type cannot have extended attribute");let ge=ue(P,O)||P.error("Missing Promise subtype");ee.subtype.push(ge);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let ge=se(P,O)||P.error(`Missing ${z.value} subtype`);ee.subtype.push(ge);break}case"record":{P.probe("[")&&P.error("Record key cannot have extended attribute");let ge=P.consume(...ct)||P.error(`Record key must be one of: ${ct.join(", ")}`),pe=new E({source:P.source,tokens:{base:ge}});pe.tokens.separator=P.consume(",")||P.error("Missing comma after record key type"),pe.type=O;let xe=se(P,O)||P.error("Error parsing generic type record");ee.subtype.push(pe,xe);break}}return ee.idlType||P.error(`Error parsing generic type ${z.value}`),ee.tokens.close=P.consume(">")||P.error(`Missing closing bracket after ${z.value}`),ee.this}(d,x)||me(d);if(!w){let P=d.consumeKind("identifier")||d.consume(...ct,...de);if(!P)return;w=new E({source:d.source,tokens:{base:P}}),d.probe("<")&&d.error(`Unsupported generic type ${P.value}`)}return w.generic==="Promise"&&d.probe("?")&&d.error("Promise type cannot be nullable"),w.type=x||null,k(d,w),w.nullable&&w.idlType==="any"&&d.error("Type `any` cannot be made nullable"),w}class E extends i{static parse(d,x){return S(d,x)||function(w,P){let O={};if(O.open=w.consume("("),!O.open)return;let z=V(new E({source:w.source,tokens:O}));for(z.type=P||null;;){let ee=se(w,P)||w.error("No type after open parenthesis or 'or' in union type");ee.idlType==="any"&&w.error("Type `any` cannot be included in a union type"),ee.generic==="Promise"&&w.error("Type `Promise` cannot be included in a union type"),z.subtype.push(ee);let ge=w.consume("or");if(!ge)break;ee.tokens.separator=ge}return z.idlType.length<2&&w.error("At least two types are expected in a union type but found less"),O.close=w.consume(")")||w.error("Unterminated union type"),k(w,z),z.this}(d,x)}constructor({source:d,tokens:x}){super({source:d,tokens:x}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new v({source:d,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((d)=>d).map((d)=>d.value).join(" "))}*validate(d){if(yield*this.extAttrs.validate(d),this.idlType==="BufferSource")for(let O of[this.extAttrs,this.parent?.extAttrs])for(let z of O){if(z.name!=="AllowShared")continue;let ee="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",ee,{autofix:j(this,z,O)})}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&&d.unique.get(this.idlType),P=this.union?this:w&&w.type==="typedef"?w.idlType:void 0;if(P&&this.nullable){let{reference:O}=o(P,d)||{};if(O){let z=(this.union?O:this).tokens.base;yield s(z,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let O of this.subtype)yield*O.validate(d)}write(d){return d.ts.wrap([this.extAttrs.write(d),(()=>{if(this.union||this.generic)return d.ts.wrap([d.token(this.tokens.base,d.ts.generic),d.token(this.tokens.open),...this.subtype.map((O)=>O.write(d)),d.token(this.tokens.close)]);let x=this.tokens.prefix||this.tokens.base,w=this.tokens.prefix?[this.tokens.prefix.value,d.ts.trivia(this.tokens.base.trivia)]:[],P=d.reference(d.ts.wrap([...w,this.tokens.base.value,d.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return d.ts.wrap([d.ts.trivia(x.trivia),P])})(),d.token(this.tokens.nullable),d.token(this.tokens.separator)])}}function j(d,x,w){return()=>{let P=w.indexOf(x);w.splice(P,1),!w.length&&d.tokens.base.trivia.match(/^\s$/)&&(d.tokens.base.trivia=""),d.tokens.base.value="AllowSharedBufferSource"}}class R extends i{static parse(d){let x=d.consume("=");if(!x)return null;let w=G(d)||d.consumeKind("string")||d.consume("null","[","{")||d.error("No value for default"),P=[w];if(w.value==="["){let O=d.consume("]")||d.error("Default sequence value must be empty");P.push(O)}else if(w.value==="{"){let O=d.consume("}")||d.error("Default dictionary value must be empty");P.push(O)}return new R({source:d.source,tokens:{assign:x},expression:P})}constructor({source:d,tokens:x,expression:w}){super({source:d,tokens:x}),w.parent=this,Object.defineProperty(this,"expression",{value:w})}get type(){return ae(this.expression[0]).type}get value(){return ae(this.expression[0]).value}get negative(){return ae(this.expression[0]).negative}write(d){return d.ts.wrap([d.token(this.tokens.assign),...this.expression.map((x)=>d.token(x))])}}class A extends i{static parse(d){let x=d.position,w={},P=V(new A({source:d.source,tokens:w}));return P.extAttrs=v.parse(d),w.optional=d.consume("optional"),P.idlType=se(d,"argument-type"),P.idlType?(w.optional||(w.variadic=d.consume("...")),w.name=d.consumeKind("identifier")||d.consume(...Y),w.name?(P.default=w.optional?R.parse(d):null,P.this):d.unconsume(x)):d.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(d){yield*this.extAttrs.validate(d),yield*this.idlType.validate(d);let x=o(this.idlType,d,{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:_(this)})}else if(this.parent&&!a(x.dictionary,d)&&function(P){let O=P.parent.arguments||P.parent.list,z=O.indexOf(P);return!O.slice(z+1).some((ge)=>!ge.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 O=oe(w.idlType);w.tokens.optional={...O,type:"optional",value:"optional"},O.trivia=" ",_(w)()})})}var w}write(d){return d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.optional),d.ts.type(this.idlType.write(d)),d.token(this.tokens.variadic),d.name_token(this.tokens.name,{data:this}),this.default?this.default.write(d):"",d.token(this.tokens.separator)])}}function _(d){return()=>{d.default=R.parse(new ut(" = {}"))}}class I extends i{static parse(d,{special:x,regular:w}={}){let P={special:x},O=V(new I({source:d.source,tokens:P}));return x&&x.value==="stringifier"&&(P.termination=d.consume(";"),P.termination)?(O.arguments=[],O):(x||w||(P.special=d.consume("getter","setter","deleter")),O.idlType=ue(d)||d.error("Missing return type"),P.name=d.consumeKind("identifier")||d.consume("includes"),P.open=d.consume("(")||d.error("Invalid operation"),O.arguments=ce(d),P.close=d.consume(")")||d.error("Unterminated operation"),P.termination=d.consume(";")||d.error("Unterminated operation, expected `;`"),O.this)}get type(){return"operation"}get name(){let{name:d}=this.tokens;return d?M(d.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(d){if(yield*this.extAttrs.validate(d),!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(d)}for(let x of this.arguments)yield*x.validate(d)}write(d){let{parent:x}=this,w=this.idlType?[d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.open),d.ts.wrap(this.arguments.map((P)=>P.write(d))),d.token(this.tokens.close)]:[];return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),this.tokens.name?d.token(this.tokens.special):d.token(this.tokens.special,d.ts.nameless,{data:this,parent:x}),...w,d.token(this.tokens.termination)]),{data:this,parent:x})}}class D extends i{static parse(d,{special:x,noInherit:w=!1,readonly:P=!1}={}){let O=d.position,z={special:x},ee=V(new D({source:d.source,tokens:z}));if(x||w||(z.special=d.consume("inherit")),ee.special==="inherit"&&d.probe("readonly")&&d.error("Inherited attributes cannot be read-only"),z.readonly=d.consume("readonly"),P&&!z.readonly&&d.probe("attribute")&&d.error("Attributes must be readonly in this context"),z.base=d.consume("attribute"),z.base)return ee.idlType=se(d,"attribute-type")||d.error("Attribute lacks a type"),z.name=d.consumeKind("identifier")||d.consume("async","required")||d.error("Attribute lacks a name"),z.termination=d.consume(";")||d.error("Unterminated attribute, expected `;`"),ee.this;d.unconsume(O)}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(d){if(yield*this.extAttrs.validate(d),yield*this.idlType.validate(d),["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,d)||{};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((O)=>O.name==="EnforceRange"))return!0;let P=w.unique.get(x.idlType);return P?.type==="typedef"&&P.idlType.extAttrs.some((O)=>O.name==="EnforceRange")}(this.idlType,d)){let x=this.idlType.tokens.base;yield s(x,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.special),d.token(this.tokens.readonly),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.termination)]),{data:this,parent:x})}}function M(d){return d.startsWith("_")?d.slice(1):d}function L(d,{parser:x,allowDangler:w,listName:P="list"}){let O=x(d);if(!O)return[];O.tokens.separator=d.consume(",");let z=[O];for(;O.tokens.separator;){let ee=x(d);if(!ee){w||d.error(`Trailing comma in ${P}`);break}if(ee.tokens.separator=d.consume(","),z.push(ee),!ee.tokens.separator)break}return z}function G(d){return d.consumeKind("decimal","integer")||d.consume("true","false","Infinity","-Infinity","NaN")}function ae({type:d,value:x}){switch(d){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 me(d){let{source:x}=d,w=function(){let O=d.consume("unsigned"),z=d.consume("short","long");if(z){let ee=d.consume("long");return new E({source:x,tokens:{prefix:O,base:z,postfix:ee}})}O&&d.error("Failed to parse integer type")}()||function(){let O=d.consume("unrestricted"),z=d.consume("float","double");if(z)return new E({source:x,tokens:{prefix:O,base:z}});O&&d.error("Failed to parse float type")}();if(w)return w;let P=d.consume("bigint","boolean","byte","octet","undefined");return P?new E({source:x,tokens:{base:P}}):void 0}function ce(d){return L(d,{parser:A.parse,listName:"arguments list"})}function se(d,x){let w=v.parse(d),P=E.parse(d,x);return P&&(V(P).extAttrs=w),P}function ue(d,x){let w=E.parse(d,x||"return-type");if(w)return w;let P=d.consume("void");if(P){let O=new E({source:d.source,tokens:{base:P}});return O.type="return-type",O}}function Re(d){let x=d.consume("stringifier");if(!x)return;return D.parse(d,{special:x})||I.parse(d,{special:x})||d.error("Unterminated stringifier")}function K(d){let x=d.split(`
558
- `);if(x.length){let w=x[x.length-1].match(/^\s+/);if(w)return w[0]}return""}function Se(d){return()=>{if(d.extAttrs.length){let x=new ut("Exposed=Window,"),w=y.parse(x);w.tokens.separator=x.consume(",");let P=d.extAttrs[0];/^\s/.test(P.tokens.name.trivia)||(P.tokens.name.trivia=` ${P.tokens.name.trivia}`),d.extAttrs.unshift(w)}else{V(d).extAttrs=v.parse(new ut("[Exposed=Window]"));let x=d.tokens.base.trivia;d.extAttrs.tokens.open.trivia=x,d.tokens.base.trivia=`
559
- ${K(x)}`}}}function oe(d){if(d.extAttrs.length)return d.extAttrs.tokens.open;if(d.type==="operation"&&!d.special)return oe(d.idlType);return Object.values(d.tokens).sort((x,w)=>x.index-w.index)[0]}function V(d,x){if(x||(x=d),!d)return d;return new Proxy(d,{get(w,P){let O=w[P];return Array.isArray(O)&&P!=="source"?V(O,w):O},set(w,P,O){if(w[P]=O,!O)return!0;if(Array.isArray(O))for(let z of O)z.parent!==void 0&&(z.parent=x);else O.parent!==void 0&&(O.parent=x);return!0}})}let Ye={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},de=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],ct=["ByteString","DOMString","USVString"],Y=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],pt=["-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(Y,ct,de),We=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],At=["_constructor","toString","_toString"];class ut{constructor(d){this.source=function(x){let w=[],P=0,O="",z=1,ee=0;for(;P<x.length;){let pe=x.charAt(P),xe=-1;if(/[\t\n\r ]/.test(pe)?xe=ge("whitespace",{noFlushTrivia:!0}):pe==="/"&&(xe=ge("comment",{noFlushTrivia:!0})),xe!==-1){let Oe=w.pop().value;z+=(Oe.match(/\n/g)||[]).length,O+=Oe,ee-=1}else if(/[-0-9.A-Z_a-z]/.test(pe)){if(xe=ge("decimal"),xe===-1&&(xe=ge("integer")),xe===-1){xe=ge("identifier");let Oe=w.length-1,Te=w[Oe];if(xe!==-1){if(At.includes(Te.value)){let qt=`${M(Te.value)} is a reserved identifier and must not be used.`;throw new bt(n(w,Oe,null,qt))}pt.includes(Te.value)&&(Te.type="inline")}}}else pe==='"'&&(xe=ge("string"));for(let Oe of We)if(x.startsWith(Oe,P)){w.push({type:"inline",value:Oe,trivia:O,line:z,index:ee}),O="",P+=Oe.length,xe=P;break}if(xe===-1&&(xe=ge("other")),xe===-1)throw Error("Token stream not progressing");P=xe,ee+=1}return w.push({type:"eof",value:"",trivia:O,line:z,index:ee}),w;function ge(pe,{noFlushTrivia:xe}={}){let Oe=Ye[pe];Oe.lastIndex=P;let Te=Oe.exec(x);return Te?(w.push({type:pe,value:Te[0],trivia:O,line:z,index:ee}),xe||(O=""),Oe.lastIndex):-1}}(d),this.position=0}error(d){throw new bt(n(this.source,this.position,this.current,d))}probeKind(d){return this.source.length>this.position&&this.source[this.position].type===d}probe(d){return this.probeKind("inline")&&this.source[this.position].value===d}consumeKind(...d){for(let x of d){if(!this.probeKind(x))continue;let w=this.source[this.position];return this.position++,w}}consume(...d){if(!this.probeKind("inline"))return;let x=this.source[this.position];for(let w of d)if(x.value===w)return this.position++,x}consumeIdentifier(d){if(this.probeKind("identifier")&&this.source[this.position].value===d)return this.consumeKind("identifier")}unconsume(d){this.position=d}}class bt extends Error{constructor({message:d,bareMessage:x,context:w,line:P,sourceName:O,input:z,tokens:ee}){super(d),this.name="WebIDLParseError",this.bareMessage=x,this.context=w,this.line=P,this.sourceName=O,this.input=z,this.tokens=ee}}class Ot extends c{static parse(d){let x=d.consumeKind("string");if(x)return new Ot({source:d.source,tokens:{value:x}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(d){let{parent:x}=this;return d.ts.wrap([d.ts.trivia(this.tokens.value.trivia),d.ts.definition(d.ts.wrap(['"',d.ts.name(this.value,{data:this,parent:x}),'"']),{data:this,parent:x}),d.token(this.tokens.separator)])}}class jt extends i{static parse(d){let x={};if(x.base=d.consume("enum"),!x.base)return;x.name=d.consumeKind("identifier")||d.error("No name for enum");let w=V(new jt({source:d.source,tokens:x}));return d.current=w.this,x.open=d.consume("{")||d.error("Bodyless enum"),w.values=L(d,{parser:Ot.parse,allowDangler:!0,listName:"enumeration"}),d.probeKind("string")&&d.error("No comma between enum values"),x.close=d.consume("}")||d.error("Unexpected value in enum"),w.values.length||d.error("No value in enum"),x.termination=d.consume(";")||d.error("No semicolon after enum"),w.this}get type(){return"enum"}get name(){return M(this.tokens.name.value)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.open),d.ts.wrap(this.values.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class bn extends i{static parse(d){let x=d.consumeKind("identifier");if(!x)return;let w={target:x};if(w.includes=d.consume("includes"),w.includes)return w.mixin=d.consumeKind("identifier")||d.error("Incomplete includes statement"),w.termination=d.consume(";")||d.error("No terminating ; for includes statement"),new bn({source:d.source,tokens:w});d.unconsume(x.index)}get type(){return"includes"}get target(){return M(this.tokens.target.value)}get includes(){return M(this.tokens.mixin.value)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.reference_token(this.tokens.target,this),d.token(this.tokens.includes),d.reference_token(this.tokens.mixin,this),d.token(this.tokens.termination)]),{data:this})}}class xn extends i{static parse(d){let x={},w=V(new xn({source:d.source,tokens:x}));if(x.base=d.consume("typedef"),x.base)return w.idlType=se(d,"typedef-type")||d.error("Typedef lacks a type"),x.name=d.consumeKind("identifier")||d.error("Typedef lacks a name"),d.current=w.this,x.termination=d.consume(";")||d.error("Unterminated typedef, expected `;`"),w.this}get type(){return"typedef"}get name(){return M(this.tokens.name.value)}*validate(d){yield*this.idlType.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.termination)]),{data:this})}}class li extends i{static parse(d,x){let w={base:x},P=V(new li({source:d.source,tokens:w}));return w.name=d.consumeKind("identifier")||d.error("Callback lacks a name"),d.current=P.this,w.assign=d.consume("=")||d.error("Callback lacks an assignment"),P.idlType=ue(d)||d.error("Callback lacks a return type"),w.open=d.consume("(")||d.error("Callback lacks parentheses for arguments"),P.arguments=ce(d),w.close=d.consume(")")||d.error("Unterminated callback"),w.termination=d.consume(";")||d.error("Unterminated callback, expected `;`"),P.this}get type(){return"callback"}get name(){return M(this.tokens.name.value)}*validate(d){yield*this.extAttrs.validate(d);for(let x of this.arguments)if(yield*x.validate(d),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(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.assign),d.ts.type(this.idlType.write(d)),d.token(this.tokens.open),...this.arguments.map((x)=>x.write(d)),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class fr extends i{static parse(d,x,{inheritable:w,allowedMembers:P}){let{tokens:O,type:z}=x;for(O.name=d.consumeKind("identifier")||d.error(`Missing name in ${z}`),d.current=x,x=V(x),w&&Object.assign(O,function(ee){let ge=ee.consume(":");return ge?{colon:ge,inheritance:ee.consumeKind("identifier")||ee.error("Inheritance lacks a type")}:{}}(d)),O.open=d.consume("{")||d.error(`Bodyless ${z}`),x.members=[];;){if(O.close=d.consume("}"),O.close)return O.termination=d.consume(";")||d.error(`Missing semicolon after ${z}`),x.this;let ee=v.parse(d),ge;for(let[pe,...xe]of P)if(ge=V(pe(d,...xe)),ge)break;ge||d.error("Unknown member"),ge.extAttrs=ee,x.members.push(ge.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(d){for(let x of this.members)x.validate&&(yield*x.validate(d))}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.callback),d.token(this.tokens.partial),d.token(this.tokens.base),d.token(this.tokens.mixin),d.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?d.ts.wrap([d.token(this.tokens.colon),d.ts.trivia(this.tokens.inheritance.trivia),d.ts.inheritance(d.reference(this.tokens.inheritance.value,{context:this}))]):"")(),d.token(this.tokens.open),d.ts.wrap(this.members.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class $n extends i{static parse(d){let x={};if(x.base=d.consume("const"),!x.base)return;let w=me(d);if(!w){let O=d.consumeKind("identifier")||d.error("Const lacks a type");w=new E({source:d.source,tokens:{base:O}})}d.probe("?")&&d.error("Unexpected nullable constant type"),w.type="const-type",x.name=d.consumeKind("identifier")||d.error("Const lacks a name"),x.assign=d.consume("=")||d.error("Const lacks value assignment"),x.value=G(d)||d.error("Const lacks a value"),x.termination=d.consume(";")||d.error("Unterminated const, expected `;`");let P=new $n({source:d.source,tokens:x});return V(P).idlType=w,P}get type(){return"const"}get name(){return M(this.tokens.name.value)}get value(){return ae(this.tokens.value)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.assign),d.token(this.tokens.value),d.token(this.tokens.termination)]),{data:this,parent:x})}}class ci extends i{static parse(d){let x=d.position,w=V(new ci({source:d.source,tokens:{}})),{tokens:P}=w;if(P.readonly=d.consume("readonly"),P.readonly||(P.async=d.consume("async")),P.base=P.readonly?d.consume("maplike","setlike"):P.async?d.consume("iterable"):d.consume("iterable","async_iterable","maplike","setlike"),!P.base)return void d.unconsume(x);let{type:O}=w,z=O==="maplike",ee=z||O==="iterable"||O==="async_iterable",ge=O==="async_iterable"||w.async&&O==="iterable";P.open=d.consume("<")||d.error(`Missing less-than sign \`<\` in ${O} declaration`);let pe=se(d)||d.error(`Missing a type argument in ${O} declaration`);return w.idlType=[pe],w.arguments=[],ee&&(pe.tokens.separator=d.consume(","),pe.tokens.separator?w.idlType.push(se(d)):z&&d.error(`Missing second type argument in ${O} declaration`)),P.close=d.consume(">")||d.error(`Missing greater-than sign \`>\` in ${O} declaration`),d.probe("(")&&(ge?(P.argsOpen=d.consume("("),w.arguments.push(...ce(d)),P.argsClose=d.consume(")")||d.error("Unterminated async iterable argument list")):d.error("Arguments are only allowed for `async iterable`")),P.termination=d.consume(";")||d.error(`Missing semicolon after ${O} declaration`),w.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(d){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 P=x.tokens.async;x.tokens.base={...P,type:"async_iterable",value:"async_iterable"},delete x.tokens.async})});var x;for(let w of this.idlType)yield*w.validate(d);for(let w of this.arguments)yield*w.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.readonly),d.token(this.tokens.async),d.token(this.tokens.base,d.ts.generic),d.token(this.tokens.open),d.ts.wrap(this.idlType.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.argsOpen),d.ts.wrap(this.arguments.map((x)=>x.write(d))),d.token(this.tokens.argsClose),d.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class ui extends i{static parse(d){let x=d.consume("constructor");if(!x)return;let w={base:x};w.open=d.consume("(")||d.error("No argument list in constructor");let P=ce(d);w.close=d.consume(")")||d.error("Unterminated constructor"),w.termination=d.consume(";")||d.error("No semicolon after constructor");let O=new ui({source:d.source,tokens:w});return V(O).arguments=P,O}get type(){return"constructor"}*validate(d){for(let x of this.arguments)yield*x.validate(d)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base,d.ts.nameless,{data:this,parent:x}),d.token(this.tokens.open),d.ts.wrap(this.arguments.map((w)=>w.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this,parent:x})}}function gu(d){let x=d.consume("static");if(!x)return;return D.parse(d,{special:x})||I.parse(d,{special:x})||d.error("No body in static member")}class vn extends fr{static parse(d,x,{extMembers:w=[],partial:P=null}={}){let O={partial:P,base:x};return fr.parse(d,new vn({source:d.source,tokens:O}),{inheritable:!P,allowedMembers:[...w,[$n.parse],[ui.parse],[gu],[Re],[ci.parse],[D.parse],[I.parse]]})}get type(){return"interface"}*validate(d){if(yield*this.extAttrs.validate(d),!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:Se(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:Oa(this,w)});if(this.extAttrs.some((w)=>w.name==="Global")){let w=this.extAttrs.filter((O)=>O.name==="LegacyFactoryFunction");for(let O of w)yield s(O.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let P=this.members.filter((O)=>O.type==="constructor");for(let O of P)yield s(O.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(d),this.partial||(yield*function*(w,P){let O=function(xe){let Oe=pe(xe);return{statics:new Set(Oe.filter((Te)=>Te.special==="static").map((Te)=>Te.name)),nonstatics:new Set(Oe.filter((Te)=>Te.special!=="static").map((Te)=>Te.name))}}(P),z=w.partials.get(P.name)||[],ee=w.mixinMap.get(P.name)||[];for(let xe of[...z,...ee]){let Oe=pe(xe),Te=Oe.filter((Kt)=>Kt.special==="static"),qt=Oe.filter((Kt)=>Kt.special!=="static");yield*ge(Te,O.statics,xe,P),yield*ge(qt,O.nonstatics,xe,P),Te.forEach((Kt)=>O.statics.add(Kt.name)),qt.forEach((Kt)=>O.nonstatics.add(Kt.name))}function*ge(xe,Oe,Te,qt){for(let Kt of xe){let{name:vo}=Kt;if(vo&&Oe.has(vo)){let yu=`The ${Kt.special==="static"?"static ":""}operation "${vo}" has already been defined for the base interface "${qt.name}" either in itself or in a mixin`;yield s(Kt.tokens.name,Te,"no-cross-overload",yu)}}}function pe(xe){return xe.members.filter(({type:Oe})=>Oe==="operation")}}(d,this))}}function Oa(d,x){return d=V(d),()=>{let w=K(d.extAttrs.tokens.open.trivia),P=d.members.length?K(oe(d.members[0]).trivia):function(Oe){let Te=K(Oe),qt=Te.includes("\t")?"\t":" ";return Te+qt}(w),O=ui.parse(new ut(`
560
- ${P}constructor();`));O.extAttrs=new v({source:d.source,tokens:{}}),V(O).arguments=x.arguments;let z=function(Oe,Te){let qt=Oe.slice().reverse().findIndex(Te);return qt===-1?qt:Oe.length-qt-1}(d.members,(Oe)=>Oe.type==="constructor");d.members.splice(z+1,0,O);let{close:ee}=d.tokens;ee.trivia.includes(`
600
+ `+(" ".repeat(Le.length)+"^"),Ad=C==="Syntax"?"since":"inside",$y=`${C} error at line ${Te}${d.name?` in ${d.name}`:""}${v&&v.name?`, ${Ad} \`${v.partial?"partial ":""}${function(Tr){let Pi=[Tr];for(;Tr&&Tr.parent;){let{parent:is}=Tr;Pi.unshift(is),Tr=is}return Pi.map((is)=>function(Wa,Ha){let wy=Wa;return Ha&&(wy+=` ${Ha}`),wy}(is.type,is.name)).join(" -> ")}(v)}\``:""}:
601
+ ${Va}`;return{message:`${$y} ${j}`,bareMessage:j,context:$y,line:Te,sourceName:d.name,level:G,ruleName:ge,autofix:ee,input:hr,tokens:sr}}function n(d,x,v,j){return r(d,x,v,j,"Syntax")}function s(d,x,v,j,C={}){return C.ruleName=v,r(x.source,d.index,x,j,"Validation",C)}e.r(t),e.d(t,{WebIDLParseError:()=>Ot,parse:()=>Ne,validate:()=>Ct,write:()=>we});class i{constructor({source:d,tokens:x}){Object.defineProperties(this,{source:{value:d},tokens:{value:x,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let d={type:void 0,name:void 0,inheritance:void 0},x=this;for(;x!==Object.prototype;){let v=Object.getOwnPropertyDescriptors(x);for(let[j,C]of Object.entries(v))(C.enumerable||C.get)&&(d[j]=this[j]);x=Object.getPrototypeOf(x)}return d}}function o(d,x,{useNullableInner:v}={}){if(!d.union){let j=x.unique.get(d.idlType);if(!j)return;if(j.type==="typedef"){let{typedefIncludesDictionary:C}=x.cache;if(C.has(j))return C.get(j);x.cache.typedefIncludesDictionary.set(j,void 0);let G=o(j.idlType,x);if(x.cache.typedefIncludesDictionary.set(j,G),G)return{reference:d,dictionary:G.dictionary}}if(j.type==="dictionary"&&(v||!d.nullable))return{reference:d,dictionary:j}}for(let j of d.subtype){let C=o(j,x);if(C)return j.union?C:{reference:j,dictionary:C.dictionary}}}function a(d,x){if(x.cache.dictionaryIncludesRequiredField.has(d))return x.cache.dictionaryIncludesRequiredField.get(d);x.cache.dictionaryIncludesRequiredField.set(d,void 0);let v=d.members.some((j)=>j.required);if(!v&&d.inheritance){let j=x.unique.get(d.inheritance);j?a(j,x)&&(v=!0):v=!0}return x.cache.dictionaryIncludesRequiredField.set(d,v),v}class l extends Array{constructor({source:d,tokens:x}){super(),Object.defineProperties(this,{source:{value:d},tokens:{value:x},parent:{value:null,writable:!0}})}}class c extends i{static parser(d,x){return()=>{let v=d.consumeKind(x);if(v)return new c({source:d.source,tokens:{value:v}})}}get value(){return J(this.tokens.value.value)}write(d){return d.ts.wrap([d.token(this.tokens.value),d.token(this.tokens.separator)])}}class u extends c{static parse(d){let x=d.consumeKind("eof");if(x)return new u({source:d.source,tokens:{value:x}})}get type(){return"eof"}}function p(d,x){return F(d,{parser:c.parser(d,x),listName:x+" list"})}let h=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((d)=>[d,`Legacy${d}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function b(d){for(let x of h){let v=p(d,x);if(v.length)return v}d.error("Expected identifiers, strings, decimals, or integers but none found")}class g extends i{static parse(d){let x={assign:d.consume("=")},v=W(new g({source:d.source,tokens:x}));if(v.list=[],x.assign){if(x.asterisk=d.consume("*"),x.asterisk)return v.this;x.secondaryName=d.consumeKind(...h)}return x.open=d.consume("("),x.open?(v.list=v.rhsIsList?b(d):ce(d),x.close=d.consume(")")||d.error("Unexpected token in extended attribute argument list")):x.assign&&!x.secondaryName&&d.error("No right hand side to extended attribute assignment"),v.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(d){let{rhsType:x}=this;return d.ts.wrap([d.token(this.tokens.assign),d.token(this.tokens.asterisk),d.reference_token(this.tokens.secondaryName,this.parent),d.token(this.tokens.open),...this.list.map((v)=>x==="identifier-list"?d.identifier(v,this.parent):v.write(d)),d.token(this.tokens.close)])}}class y extends i{static parse(d){let x=d.consumeKind("identifier");if(x)return new y({source:d.source,tokens:{name:x},params:g.parse(d)})}constructor({source:d,tokens:x,params:v}){super({source:d,tokens:x}),v.parent=this,Object.defineProperty(this,"params",{value:v})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:d,tokens:x,list:v}=this.params;if(!d)return null;return{type:d,value:this.params.rhsIsList?v:this.params.tokens.secondaryName?J(x.secondaryName.value):null}}get arguments(){let{rhsIsList:d,list:x}=this.params;return!x||d?[]:x}*validate(d){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 j=`\`[${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",j,{level:"warning",autofix:(v=this,()=>{let{name:C}=v;v.tokens.name.value=m.get(C),C==="TreatNullAs"&&(v.params.tokens={})})})}var v;for(let j of this.arguments)yield*j.validate(d)}write(d){return d.ts.wrap([d.ts.trivia(this.tokens.name.trivia),d.ts.extendedAttribute(d.ts.wrap([d.ts.extendedAttributeReference(this.name),this.params.write(d)])),d.token(this.tokens.separator)])}}class w extends l{static parse(d){let x={};x.open=d.consume("[");let v=new w({source:d.source,tokens:x});return x.open?(v.push(...F(d,{parser:y.parse,listName:"extended attribute"})),x.close=d.consume("]")||d.error("Expected a closing token for the extended attribute list"),v.length||(d.unconsume(x.close.index),d.error("An extended attribute list must not be empty")),d.probe("[")&&d.error("Illegal double extended attribute lists, consider merging them"),v):v}*validate(d){for(let x of this)yield*x.validate(d)}write(d){return this.length?d.ts.wrap([d.token(this.tokens.open),...this.map((x)=>x.write(d)),d.token(this.tokens.close)]):""}}function P(d,x){let v=d.consume("?");v&&(x.tokens.nullable=v),d.probe("?")&&d.error("Can't nullable more than once")}function S(d,x){let v=function(j,C){let G=j.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!G)return;let ee=W(new E({source:j.source,tokens:{base:G}}));switch(ee.tokens.open=j.consume("<")||j.error(`No opening bracket after ${G.value}`),G.value){case"Promise":{j.probe("[")&&j.error("Promise type cannot have extended attribute");let ge=ue(j,C)||j.error("Missing Promise subtype");ee.subtype.push(ge);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let ge=se(j,C)||j.error(`Missing ${G.value} subtype`);ee.subtype.push(ge);break}case"record":{j.probe("[")&&j.error("Record key cannot have extended attribute");let ge=j.consume(...xt)||j.error(`Record key must be one of: ${xt.join(", ")}`),pe=new E({source:j.source,tokens:{base:ge}});pe.tokens.separator=j.consume(",")||j.error("Missing comma after record key type"),pe.type=C;let xe=se(j,C)||j.error("Error parsing generic type record");ee.subtype.push(pe,xe);break}}return ee.idlType||j.error(`Error parsing generic type ${G.value}`),ee.tokens.close=j.consume(">")||j.error(`Missing closing bracket after ${G.value}`),ee.this}(d,x)||me(d);if(!v){let j=d.consumeKind("identifier")||d.consume(...xt,...de);if(!j)return;v=new E({source:d.source,tokens:{base:j}}),d.probe("<")&&d.error(`Unsupported generic type ${j.value}`)}return v.generic==="Promise"&&d.probe("?")&&d.error("Promise type cannot be nullable"),v.type=x||null,P(d,v),v.nullable&&v.idlType==="any"&&d.error("Type `any` cannot be made nullable"),v}class E extends i{static parse(d,x){return S(d,x)||function(v,j){let C={};if(C.open=v.consume("("),!C.open)return;let G=W(new E({source:v.source,tokens:C}));for(G.type=j||null;;){let ee=se(v,j)||v.error("No type after open parenthesis or 'or' in union type");ee.idlType==="any"&&v.error("Type `any` cannot be included in a union type"),ee.generic==="Promise"&&v.error("Type `Promise` cannot be included in a union type"),G.subtype.push(ee);let ge=v.consume("or");if(!ge)break;ee.tokens.separator=ge}return G.idlType.length<2&&v.error("At least two types are expected in a union type but found less"),C.close=v.consume(")")||v.error("Unterminated union type"),P(v,G),G.this}(d,x)}constructor({source:d,tokens:x}){super({source:d,tokens:x}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new w({source:d,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 J([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((d)=>d).map((d)=>d.value).join(" "))}*validate(d){if(yield*this.extAttrs.validate(d),this.idlType==="BufferSource")for(let C of[this.extAttrs,this.parent?.extAttrs])for(let G of C){if(G.name!=="AllowShared")continue;let ee="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",ee,{autofix:k(this,G,C)})}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 v=!this.union&&d.unique.get(this.idlType),j=this.union?this:v&&v.type==="typedef"?v.idlType:void 0;if(j&&this.nullable){let{reference:C}=o(j,d)||{};if(C){let G=(this.union?C:this).tokens.base;yield s(G,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let C of this.subtype)yield*C.validate(d)}write(d){return d.ts.wrap([this.extAttrs.write(d),(()=>{if(this.union||this.generic)return d.ts.wrap([d.token(this.tokens.base,d.ts.generic),d.token(this.tokens.open),...this.subtype.map((C)=>C.write(d)),d.token(this.tokens.close)]);let x=this.tokens.prefix||this.tokens.base,v=this.tokens.prefix?[this.tokens.prefix.value,d.ts.trivia(this.tokens.base.trivia)]:[],j=d.reference(d.ts.wrap([...v,this.tokens.base.value,d.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return d.ts.wrap([d.ts.trivia(x.trivia),j])})(),d.token(this.tokens.nullable),d.token(this.tokens.separator)])}}function k(d,x,v){return()=>{let j=v.indexOf(x);v.splice(j,1),!v.length&&d.tokens.base.trivia.match(/^\s$/)&&(d.tokens.base.trivia=""),d.tokens.base.value="AllowSharedBufferSource"}}class A extends i{static parse(d){let x=d.consume("=");if(!x)return null;let v=K(d)||d.consumeKind("string")||d.consume("null","[","{")||d.error("No value for default"),j=[v];if(v.value==="["){let C=d.consume("]")||d.error("Default sequence value must be empty");j.push(C)}else if(v.value==="{"){let C=d.consume("}")||d.error("Default dictionary value must be empty");j.push(C)}return new A({source:d.source,tokens:{assign:x},expression:j})}constructor({source:d,tokens:x,expression:v}){super({source:d,tokens:x}),v.parent=this,Object.defineProperty(this,"expression",{value:v})}get type(){return ae(this.expression[0]).type}get value(){return ae(this.expression[0]).value}get negative(){return ae(this.expression[0]).negative}write(d){return d.ts.wrap([d.token(this.tokens.assign),...this.expression.map((x)=>d.token(x))])}}class R extends i{static parse(d){let x=d.position,v={},j=W(new R({source:d.source,tokens:v}));return j.extAttrs=w.parse(d),v.optional=d.consume("optional"),j.idlType=se(d,"argument-type"),j.idlType?(v.optional||(v.variadic=d.consume("...")),v.name=d.consumeKind("identifier")||d.consume(...X),v.name?(j.default=v.optional?A.parse(d):null,j.this):d.unconsume(x)):d.unconsume(x)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return J(this.tokens.name.value)}*validate(d){yield*this.extAttrs.validate(d),yield*this.idlType.validate(d);let x=o(this.idlType,d,{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:_(this)})}else if(this.parent&&!a(x.dictionary,d)&&function(j){let C=j.parent.arguments||j.parent.list,G=C.indexOf(j);return!C.slice(G+1).some((ge)=>!ge.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(v=this,()=>{let C=oe(v.idlType);v.tokens.optional={...C,type:"optional",value:"optional"},C.trivia=" ",_(v)()})})}var v}write(d){return d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.optional),d.ts.type(this.idlType.write(d)),d.token(this.tokens.variadic),d.name_token(this.tokens.name,{data:this}),this.default?this.default.write(d):"",d.token(this.tokens.separator)])}}function _(d){return()=>{d.default=A.parse(new $t(" = {}"))}}class I extends i{static parse(d,{special:x,regular:v}={}){let j={special:x},C=W(new I({source:d.source,tokens:j}));return x&&x.value==="stringifier"&&(j.termination=d.consume(";"),j.termination)?(C.arguments=[],C):(x||v||(j.special=d.consume("getter","setter","deleter")),C.idlType=ue(d)||d.error("Missing return type"),j.name=d.consumeKind("identifier")||d.consume("includes"),j.open=d.consume("(")||d.error("Invalid operation"),C.arguments=ce(d),j.close=d.consume(")")||d.error("Unterminated operation"),j.termination=d.consume(";")||d.error("Unterminated operation, expected `;`"),C.this)}get type(){return"operation"}get name(){let{name:d}=this.tokens;return d?J(d.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(d){if(yield*this.extAttrs.validate(d),!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(d)}for(let x of this.arguments)yield*x.validate(d)}write(d){let{parent:x}=this,v=this.idlType?[d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.open),d.ts.wrap(this.arguments.map((j)=>j.write(d))),d.token(this.tokens.close)]:[];return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),this.tokens.name?d.token(this.tokens.special):d.token(this.tokens.special,d.ts.nameless,{data:this,parent:x}),...v,d.token(this.tokens.termination)]),{data:this,parent:x})}}class L extends i{static parse(d,{special:x,noInherit:v=!1,readonly:j=!1}={}){let C=d.position,G={special:x},ee=W(new L({source:d.source,tokens:G}));if(x||v||(G.special=d.consume("inherit")),ee.special==="inherit"&&d.probe("readonly")&&d.error("Inherited attributes cannot be read-only"),G.readonly=d.consume("readonly"),j&&!G.readonly&&d.probe("attribute")&&d.error("Attributes must be readonly in this context"),G.base=d.consume("attribute"),G.base)return ee.idlType=se(d,"attribute-type")||d.error("Attribute lacks a type"),G.name=d.consumeKind("identifier")||d.consume("async","required")||d.error("Attribute lacks a name"),G.termination=d.consume(";")||d.error("Unterminated attribute, expected `;`"),ee.this;d.unconsume(C)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return J(this.tokens.name.value)}*validate(d){if(yield*this.extAttrs.validate(d),yield*this.idlType.validate(d),["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,d)||{};if(x){let v=(this.idlType.union?x:this.idlType).tokens.base;yield s(v,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(x,v){if(x.union)return!1;if(x.extAttrs.some((C)=>C.name==="EnforceRange"))return!0;let j=v.unique.get(x.idlType);return j?.type==="typedef"&&j.idlType.extAttrs.some((C)=>C.name==="EnforceRange")}(this.idlType,d)){let x=this.idlType.tokens.base;yield s(x,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.special),d.token(this.tokens.readonly),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.termination)]),{data:this,parent:x})}}function J(d){return d.startsWith("_")?d.slice(1):d}function F(d,{parser:x,allowDangler:v,listName:j="list"}){let C=x(d);if(!C)return[];C.tokens.separator=d.consume(",");let G=[C];for(;C.tokens.separator;){let ee=x(d);if(!ee){v||d.error(`Trailing comma in ${j}`);break}if(ee.tokens.separator=d.consume(","),G.push(ee),!ee.tokens.separator)break}return G}function K(d){return d.consumeKind("decimal","integer")||d.consume("true","false","Infinity","-Infinity","NaN")}function ae({type:d,value:x}){switch(d){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 me(d){let{source:x}=d,v=function(){let C=d.consume("unsigned"),G=d.consume("short","long");if(G){let ee=d.consume("long");return new E({source:x,tokens:{prefix:C,base:G,postfix:ee}})}C&&d.error("Failed to parse integer type")}()||function(){let C=d.consume("unrestricted"),G=d.consume("float","double");if(G)return new E({source:x,tokens:{prefix:C,base:G}});C&&d.error("Failed to parse float type")}();if(v)return v;let j=d.consume("bigint","boolean","byte","octet","undefined");return j?new E({source:x,tokens:{base:j}}):void 0}function ce(d){return F(d,{parser:R.parse,listName:"arguments list"})}function se(d,x){let v=w.parse(d),j=E.parse(d,x);return j&&(W(j).extAttrs=v),j}function ue(d,x){let v=E.parse(d,x||"return-type");if(v)return v;let j=d.consume("void");if(j){let C=new E({source:d.source,tokens:{base:j}});return C.type="return-type",C}}function Ce(d){let x=d.consume("stringifier");if(!x)return;return L.parse(d,{special:x})||I.parse(d,{special:x})||d.error("Unterminated stringifier")}function Y(d){let x=d.split(`
602
+ `);if(x.length){let v=x[x.length-1].match(/^\s+/);if(v)return v[0]}return""}function Ee(d){return()=>{if(d.extAttrs.length){let x=new $t("Exposed=Window,"),v=y.parse(x);v.tokens.separator=x.consume(",");let j=d.extAttrs[0];/^\s/.test(j.tokens.name.trivia)||(j.tokens.name.trivia=` ${j.tokens.name.trivia}`),d.extAttrs.unshift(v)}else{W(d).extAttrs=w.parse(new $t("[Exposed=Window]"));let x=d.tokens.base.trivia;d.extAttrs.tokens.open.trivia=x,d.tokens.base.trivia=`
603
+ ${Y(x)}`}}}function oe(d){if(d.extAttrs.length)return d.extAttrs.tokens.open;if(d.type==="operation"&&!d.special)return oe(d.idlType);return Object.values(d.tokens).sort((x,v)=>x.index-v.index)[0]}function W(d,x){if(x||(x=d),!d)return d;return new Proxy(d,{get(v,j){let C=v[j];return Array.isArray(C)&&j!=="source"?W(C,v):C},set(v,j,C){if(v[j]=C,!C)return!0;if(Array.isArray(C))for(let G of C)G.parent!==void 0&&(G.parent=x);else C.parent!==void 0&&(C.parent=x);return!0}})}let ot={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},de=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],xt=["ByteString","DOMString","USVString"],X=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Pt=["-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(X,xt,de),et=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],Ut=["_constructor","toString","_toString"];class $t{constructor(d){this.source=function(x){let v=[],j=0,C="",G=1,ee=0;for(;j<x.length;){let pe=x.charAt(j),xe=-1;if(/[\t\n\r ]/.test(pe)?xe=ge("whitespace",{noFlushTrivia:!0}):pe==="/"&&(xe=ge("comment",{noFlushTrivia:!0})),xe!==-1){let Te=v.pop().value;G+=(Te.match(/\n/g)||[]).length,C+=Te,ee-=1}else if(/[-0-9.A-Z_a-z]/.test(pe)){if(xe=ge("decimal"),xe===-1&&(xe=ge("integer")),xe===-1){xe=ge("identifier");let Te=v.length-1,Le=v[Te];if(xe!==-1){if(Ut.includes(Le.value)){let sr=`${J(Le.value)} is a reserved identifier and must not be used.`;throw new Ot(n(v,Te,null,sr))}Pt.includes(Le.value)&&(Le.type="inline")}}}else pe==='"'&&(xe=ge("string"));for(let Te of et)if(x.startsWith(Te,j)){v.push({type:"inline",value:Te,trivia:C,line:G,index:ee}),C="",j+=Te.length,xe=j;break}if(xe===-1&&(xe=ge("other")),xe===-1)throw Error("Token stream not progressing");j=xe,ee+=1}return v.push({type:"eof",value:"",trivia:C,line:G,index:ee}),v;function ge(pe,{noFlushTrivia:xe}={}){let Te=ot[pe];Te.lastIndex=j;let Le=Te.exec(x);return Le?(v.push({type:pe,value:Le[0],trivia:C,line:G,index:ee}),xe||(C=""),Te.lastIndex):-1}}(d),this.position=0}error(d){throw new Ot(n(this.source,this.position,this.current,d))}probeKind(d){return this.source.length>this.position&&this.source[this.position].type===d}probe(d){return this.probeKind("inline")&&this.source[this.position].value===d}consumeKind(...d){for(let x of d){if(!this.probeKind(x))continue;let v=this.source[this.position];return this.position++,v}}consume(...d){if(!this.probeKind("inline"))return;let x=this.source[this.position];for(let v of d)if(x.value===v)return this.position++,x}consumeIdentifier(d){if(this.probeKind("identifier")&&this.source[this.position].value===d)return this.consumeKind("identifier")}unconsume(d){this.position=d}}class Ot extends Error{constructor({message:d,bareMessage:x,context:v,line:j,sourceName:C,input:G,tokens:ee}){super(d),this.name="WebIDLParseError",this.bareMessage=x,this.context=v,this.line=j,this.sourceName=C,this.input=G,this.tokens=ee}}class zt extends c{static parse(d){let x=d.consumeKind("string");if(x)return new zt({source:d.source,tokens:{value:x}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(d){let{parent:x}=this;return d.ts.wrap([d.ts.trivia(this.tokens.value.trivia),d.ts.definition(d.ts.wrap(['"',d.ts.name(this.value,{data:this,parent:x}),'"']),{data:this,parent:x}),d.token(this.tokens.separator)])}}class qt extends i{static parse(d){let x={};if(x.base=d.consume("enum"),!x.base)return;x.name=d.consumeKind("identifier")||d.error("No name for enum");let v=W(new qt({source:d.source,tokens:x}));return d.current=v.this,x.open=d.consume("{")||d.error("Bodyless enum"),v.values=F(d,{parser:zt.parse,allowDangler:!0,listName:"enumeration"}),d.probeKind("string")&&d.error("No comma between enum values"),x.close=d.consume("}")||d.error("Unexpected value in enum"),v.values.length||d.error("No value in enum"),x.termination=d.consume(";")||d.error("No semicolon after enum"),v.this}get type(){return"enum"}get name(){return J(this.tokens.name.value)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.open),d.ts.wrap(this.values.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class es extends i{static parse(d){let x=d.consumeKind("identifier");if(!x)return;let v={target:x};if(v.includes=d.consume("includes"),v.includes)return v.mixin=d.consumeKind("identifier")||d.error("Incomplete includes statement"),v.termination=d.consume(";")||d.error("No terminating ; for includes statement"),new es({source:d.source,tokens:v});d.unconsume(x.index)}get type(){return"includes"}get target(){return J(this.tokens.target.value)}get includes(){return J(this.tokens.mixin.value)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.reference_token(this.tokens.target,this),d.token(this.tokens.includes),d.reference_token(this.tokens.mixin,this),d.token(this.tokens.termination)]),{data:this})}}class ts extends i{static parse(d){let x={},v=W(new ts({source:d.source,tokens:x}));if(x.base=d.consume("typedef"),x.base)return v.idlType=se(d,"typedef-type")||d.error("Typedef lacks a type"),x.name=d.consumeKind("identifier")||d.error("Typedef lacks a name"),d.current=v.this,x.termination=d.consume(";")||d.error("Unterminated typedef, expected `;`"),v.this}get type(){return"typedef"}get name(){return J(this.tokens.name.value)}*validate(d){yield*this.idlType.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.termination)]),{data:this})}}class mo extends i{static parse(d,x){let v={base:x},j=W(new mo({source:d.source,tokens:v}));return v.name=d.consumeKind("identifier")||d.error("Callback lacks a name"),d.current=j.this,v.assign=d.consume("=")||d.error("Callback lacks an assignment"),j.idlType=ue(d)||d.error("Callback lacks a return type"),v.open=d.consume("(")||d.error("Callback lacks parentheses for arguments"),j.arguments=ce(d),v.close=d.consume(")")||d.error("Unterminated callback"),v.termination=d.consume(";")||d.error("Unterminated callback, expected `;`"),j.this}get type(){return"callback"}get name(){return J(this.tokens.name.value)}*validate(d){yield*this.extAttrs.validate(d);for(let x of this.arguments)if(yield*x.validate(d),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(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.name_token(this.tokens.name,{data:this}),d.token(this.tokens.assign),d.ts.type(this.idlType.write(d)),d.token(this.tokens.open),...this.arguments.map((x)=>x.write(d)),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class Nr extends i{static parse(d,x,{inheritable:v,allowedMembers:j}){let{tokens:C,type:G}=x;for(C.name=d.consumeKind("identifier")||d.error(`Missing name in ${G}`),d.current=x,x=W(x),v&&Object.assign(C,function(ee){let ge=ee.consume(":");return ge?{colon:ge,inheritance:ee.consumeKind("identifier")||ee.error("Inheritance lacks a type")}:{}}(d)),C.open=d.consume("{")||d.error(`Bodyless ${G}`),x.members=[];;){if(C.close=d.consume("}"),C.close)return C.termination=d.consume(";")||d.error(`Missing semicolon after ${G}`),x.this;let ee=w.parse(d),ge;for(let[pe,...xe]of j)if(ge=W(pe(d,...xe)),ge)break;ge||d.error("Unknown member"),ge.extAttrs=ee,x.members.push(ge.this)}}get partial(){return!!this.tokens.partial}get name(){return J(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?J(this.tokens.inheritance.value):null}*validate(d){for(let x of this.members)x.validate&&(yield*x.validate(d))}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.callback),d.token(this.tokens.partial),d.token(this.tokens.base),d.token(this.tokens.mixin),d.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?d.ts.wrap([d.token(this.tokens.colon),d.ts.trivia(this.tokens.inheritance.trivia),d.ts.inheritance(d.reference(this.tokens.inheritance.value,{context:this}))]):"")(),d.token(this.tokens.open),d.ts.wrap(this.members.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this})}}class rs extends i{static parse(d){let x={};if(x.base=d.consume("const"),!x.base)return;let v=me(d);if(!v){let C=d.consumeKind("identifier")||d.error("Const lacks a type");v=new E({source:d.source,tokens:{base:C}})}d.probe("?")&&d.error("Unexpected nullable constant type"),v.type="const-type",x.name=d.consumeKind("identifier")||d.error("Const lacks a name"),x.assign=d.consume("=")||d.error("Const lacks value assignment"),x.value=K(d)||d.error("Const lacks a value"),x.termination=d.consume(";")||d.error("Unterminated const, expected `;`");let j=new rs({source:d.source,tokens:x});return W(j).idlType=v,j}get type(){return"const"}get name(){return J(this.tokens.name.value)}get value(){return ae(this.tokens.value)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),d.token(this.tokens.assign),d.token(this.tokens.value),d.token(this.tokens.termination)]),{data:this,parent:x})}}class ho extends i{static parse(d){let x=d.position,v=W(new ho({source:d.source,tokens:{}})),{tokens:j}=v;if(j.readonly=d.consume("readonly"),j.readonly||(j.async=d.consume("async")),j.base=j.readonly?d.consume("maplike","setlike"):j.async?d.consume("iterable"):d.consume("iterable","async_iterable","maplike","setlike"),!j.base)return void d.unconsume(x);let{type:C}=v,G=C==="maplike",ee=G||C==="iterable"||C==="async_iterable",ge=C==="async_iterable"||v.async&&C==="iterable";j.open=d.consume("<")||d.error(`Missing less-than sign \`<\` in ${C} declaration`);let pe=se(d)||d.error(`Missing a type argument in ${C} declaration`);return v.idlType=[pe],v.arguments=[],ee&&(pe.tokens.separator=d.consume(","),pe.tokens.separator?v.idlType.push(se(d)):G&&d.error(`Missing second type argument in ${C} declaration`)),j.close=d.consume(">")||d.error(`Missing greater-than sign \`>\` in ${C} declaration`),d.probe("(")&&(ge?(j.argsOpen=d.consume("("),v.arguments.push(...ce(d)),j.argsClose=d.consume(")")||d.error("Unterminated async iterable argument list")):d.error("Arguments are only allowed for `async iterable`")),j.termination=d.consume(";")||d.error(`Missing semicolon after ${C} declaration`),v.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(d){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 j=x.tokens.async;x.tokens.base={...j,type:"async_iterable",value:"async_iterable"},delete x.tokens.async})});var x;for(let v of this.idlType)yield*v.validate(d);for(let v of this.arguments)yield*v.validate(d)}write(d){return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.readonly),d.token(this.tokens.async),d.token(this.tokens.base,d.ts.generic),d.token(this.tokens.open),d.ts.wrap(this.idlType.map((x)=>x.write(d))),d.token(this.tokens.close),d.token(this.tokens.argsOpen),d.ts.wrap(this.arguments.map((x)=>x.write(d))),d.token(this.tokens.argsClose),d.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class go extends i{static parse(d){let x=d.consume("constructor");if(!x)return;let v={base:x};v.open=d.consume("(")||d.error("No argument list in constructor");let j=ce(d);v.close=d.consume(")")||d.error("Unterminated constructor"),v.termination=d.consume(";")||d.error("No semicolon after constructor");let C=new go({source:d.source,tokens:v});return W(C).arguments=j,C}get type(){return"constructor"}*validate(d){for(let x of this.arguments)yield*x.validate(d)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.base,d.ts.nameless,{data:this,parent:x}),d.token(this.tokens.open),d.ts.wrap(this.arguments.map((v)=>v.write(d))),d.token(this.tokens.close),d.token(this.tokens.termination)]),{data:this,parent:x})}}function _d(d){let x=d.consume("static");if(!x)return;return L.parse(d,{special:x})||I.parse(d,{special:x})||d.error("No body in static member")}class ns extends Nr{static parse(d,x,{extMembers:v=[],partial:j=null}={}){let C={partial:j,base:x};return Nr.parse(d,new ns({source:d.source,tokens:C}),{inheritable:!j,allowedMembers:[...v,[rs.parse],[go.parse],[_d],[Ce],[ho.parse],[L.parse],[I.parse]]})}get type(){return"interface"}*validate(d){if(yield*this.extAttrs.validate(d),!this.partial&&this.extAttrs.every((v)=>v.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:Ee(this)});let x=this.extAttrs.filter((v)=>v.name==="Constructor");for(let v of x)yield s(v.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:dc(this,v)});if(this.extAttrs.some((v)=>v.name==="Global")){let v=this.extAttrs.filter((C)=>C.name==="LegacyFactoryFunction");for(let C of v)yield s(C.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let j=this.members.filter((C)=>C.type==="constructor");for(let C of j)yield s(C.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(d),this.partial||(yield*function*(v,j){let C=function(xe){let Te=pe(xe);return{statics:new Set(Te.filter((Le)=>Le.special==="static").map((Le)=>Le.name)),nonstatics:new Set(Te.filter((Le)=>Le.special!=="static").map((Le)=>Le.name))}}(j),G=v.partials.get(j.name)||[],ee=v.mixinMap.get(j.name)||[];for(let xe of[...G,...ee]){let Te=pe(xe),Le=Te.filter((hr)=>hr.special==="static"),sr=Te.filter((hr)=>hr.special!=="static");yield*ge(Le,C.statics,xe,j),yield*ge(sr,C.nonstatics,xe,j),Le.forEach((hr)=>C.statics.add(hr.name)),sr.forEach((hr)=>C.nonstatics.add(hr.name))}function*ge(xe,Te,Le,sr){for(let hr of xe){let{name:Va}=hr;if(Va&&Te.has(Va)){let Ad=`The ${hr.special==="static"?"static ":""}operation "${Va}" has already been defined for the base interface "${sr.name}" either in itself or in a mixin`;yield s(hr.tokens.name,Le,"no-cross-overload",Ad)}}}function pe(xe){return xe.members.filter(({type:Te})=>Te==="operation")}}(d,this))}}function dc(d,x){return d=W(d),()=>{let v=Y(d.extAttrs.tokens.open.trivia),j=d.members.length?Y(oe(d.members[0]).trivia):function(Te){let Le=Y(Te),sr=Le.includes("\t")?"\t":" ";return Le+sr}(v),C=go.parse(new $t(`
604
+ ${j}constructor();`));C.extAttrs=new w({source:d.source,tokens:{}}),W(C).arguments=x.arguments;let G=function(Te,Le){let sr=Te.slice().reverse().findIndex(Le);return sr===-1?sr:Te.length-sr-1}(d.members,(Te)=>Te.type==="constructor");d.members.splice(G+1,0,C);let{close:ee}=d.tokens;ee.trivia.includes(`
561
605
  `)||(ee.trivia+=`
562
- ${w}`);let{extAttrs:ge}=d,pe=ge.indexOf(x),xe=ge.splice(pe,1);ge.length?ge.length===pe?ge[pe-1].tokens.separator=void 0:ge[pe].tokens.name.trivia.trim()||(ge[pe].tokens.name.trivia=xe[0].tokens.name.trivia):ge.tokens.open=ge.tokens.close=void 0}}class fi extends fr{static parse(d,x,{extMembers:w=[],partial:P}={}){let O={partial:P,base:x};if(O.mixin=d.consume("mixin"),O.mixin)return fr.parse(d,new fi({source:d.source,tokens:O}),{allowedMembers:[...w,[$n.parse],[Re],[D.parse,{noInherit:!0}],[I.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class wn extends i{static parse(d){let x={},w=V(new wn({source:d.source,tokens:x}));return w.extAttrs=v.parse(d),x.required=d.consume("required"),w.idlType=se(d,"dictionary-type")||d.error("Dictionary member lacks a type"),x.name=d.consumeKind("identifier")||d.error("Dictionary member lacks a name"),w.default=R.parse(d),x.required&&w.default&&d.error("Required member must not have a default"),x.termination=d.consume(";")||d.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(d){yield*this.idlType.validate(d)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.required),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),this.default?this.default.write(d):"",d.token(this.tokens.termination)]),{data:this,parent:x})}}class J extends fr{static parse(d,{extMembers:x=[],partial:w}={}){let P={partial:w};if(P.base=d.consume("dictionary"),P.base)return fr.parse(d,new J({source:d.source,tokens:P}),{inheritable:!w,allowedMembers:[...x,[wn.parse]]})}get type(){return"dictionary"}}class B extends fr{static parse(d,{extMembers:x=[],partial:w}={}){let P={partial:w};if(P.base=d.consume("namespace"),P.base)return fr.parse(d,new B({source:d.source,tokens:P}),{allowedMembers:[...x,[D.parse,{noInherit:!0,readonly:!0}],[$n.parse],[I.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(d){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:Se(this)});yield*super.validate(d)}}class W extends fr{static parse(d,x,{extMembers:w=[]}={}){let P={callback:x};if(P.base=d.consume("interface"),P.base)return fr.parse(d,new W({source:d.source,tokens:P}),{allowedMembers:[...w,[$n.parse],[I.parse,{regular:!0}]]})}get type(){return"callback interface"}}function le(d,x){let w=d.source;function P(pe){d.error(pe)}function O(...pe){return d.consume(...pe)}function z(pe){let xe=O("interface");if(xe)return fi.parse(d,xe,{...pe,...x?.extensions?.mixin})||vn.parse(d,xe,{...pe,...x?.extensions?.interface})||P("Interface has no proper body")}function ee(){if(x.productions)for(let pe of x.productions){let xe=pe(d);if(xe)return xe}return function(){let pe=O("callback");if(pe)return d.probe("interface")?W.parse(d,pe,{...x?.extensions?.callbackInterface}):li.parse(d,pe)}()||z()||function(){let pe=O("partial");if(pe)return J.parse(d,{partial:pe,...x?.extensions?.dictionary})||z({partial:pe})||B.parse(d,{partial:pe,...x?.extensions?.namespace})||P("Partial doesn't apply to anything")}()||J.parse(d,x?.extensions?.dictionary)||jt.parse(d)||xn.parse(d)||bn.parse(d)||B.parse(d,x?.extensions?.namespace)}let ge=function(){if(!w.length)return[];let pe=[];for(;;){let Oe=v.parse(d),Te=ee();if(!Te){Oe.length&&P("Stray extended attributes");break}V(Te).extAttrs=Oe,pe.push(Te)}let xe=u.parse(d);return x.concrete&&pe.push(xe),pe}();return d.position<w.length&&P("Unrecognised tokens"),ge}function Ae(d,x={}){let w=new ut(d);return x.sourceName!==void 0&&(w.source.name=x.sourceName),le(w,x)}function mt(d){return d}let Ct={wrap:(d)=>d.join(""),trivia:mt,name:mt,reference:mt,type:mt,generic:mt,nameless:mt,inheritance:mt,definition:mt,extendedAttribute:mt,extendedAttributeReference:mt};class Ue{constructor(d){this.ts=Object.assign({},Ct,d)}reference(d,{unescaped:x,context:w}){return x||(x=d.startsWith("_")?d.slice(1):d),this.ts.reference(d,x,w)}token(d,x=mt,...w){if(!d)return"";let P=x(d.value,...w);return this.ts.wrap([this.ts.trivia(d.trivia),P])}reference_token(d,x){return this.token(d,this.reference.bind(this),{context:x})}name_token(d,x){return this.token(d,this.ts.name,x)}identifier(d,x){return this.ts.wrap([this.reference_token(d.tokens.value,x),this.token(d.tokens.separator)])}}function ve(d,{templates:x=Ct}={}){x=Object.assign({},Ct,x);let w=new Ue(x);return x.wrap(d.map((P)=>P.write(w)))}function Nt(d,x){let w=new Map,P=d.filter((O)=>O.type==="includes");for(let O of P){let z=x.get(O.includes);if(!z)continue;let ee=w.get(O.target);ee?ee.push(z):w.set(O.target,[z])}return w}function*ht(d){let x=function(w){let P=new Map,O=new Set,z=new Map;for(let ee of w)if(ee.partial){let ge=z.get(ee.name);ge?ge.push(ee):z.set(ee.name,[ee])}else ee.name&&(P.has(ee.name)?O.add(ee):P.set(ee.name,ee));return{all:w,unique:P,partials:z,duplicates:O,mixinMap:Nt(w,P),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(d);for(let w of x.all)w.validate&&(yield*w.validate(x));yield*function*({unique:w,duplicates:P}){for(let O of P){let{name:z}=O,ee=`The name "${z}" of type "${w.get(z).type}" was already seen`;yield s(O.tokens.name,O,"no-duplicate",ee)}}(x)}function xt(d){return[...ht((x=d,x.flat?x.flat():[].concat(...x)))];var x}return t})())});var Uw=C(function(uX,Ww){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",qw=De("fs").promises,uc=De("path"),Hw=Fw();class Vw{constructor(e,t){this.filename=t,this.shortname=uc.basename(t,".idl"),this.path=uc.join(e,t)}async text(){return await qw.readFile(this.path,"utf8")}async parse(){let e=await this.text();return Hw.parse(e)}}async function Bw({folder:e=__dirname}={}){let t={},r=await qw.readdir(e);for(let n of r)if(n.endsWith(".idl")){let s=new Vw(e,n);t[s.shortname]=s}return t}async function dF(e){let t=await Bw(e);for(let[r,n]of Object.entries(t))t[r]=await n.parse();return t}Ww.exports={listAll:Bw,parseAll:dF}});var zw,Gw;var Kw=H(()=>{zw={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."},Gw={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var Yw;var Xw=H(()=>{Yw={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 Zw,Qw,e0;var t0=H(()=>{Zw={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Qw={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},e0={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var r0;var n0=H(()=>{r0={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 s0,i0;var o0=H(()=>{s0={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"},i0={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 a0;var l0=H(()=>{a0={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var c0,u0,f0,d0,p0,m0,h0,g0,y0;var b0=H(()=>{c0={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},u0={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},f0={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},d0={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},p0={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},m0={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"},h0={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},g0={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"},y0={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var fc;var x0=H(()=>{fc={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 $0,v0;var w0=H(()=>{$0={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"},v0={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 S0,E0,P0,j0,k0,Xd;var _0=H(()=>{S0={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},E0={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"},P0={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},j0={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"},k0={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"},Xd={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 R0;var A0=H(()=>{R0={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 O0;var C0=H(()=>{O0={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 N0,T0;var I0=H(()=>{N0={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"}]},T0={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 M0;var J0=H(()=>{M0={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 D0;var L0=H(()=>{D0={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 F0,q0,H0,V0,B0,W0,U0,z0,G0,K0,Y0,X0,Z0,Q0,eS,tS,rS;var nS=H(()=>{Gu();F0={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"},q0={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."},H0={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."},V0={enum:["!","-"]},B0={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},W0={const:"?:"},U0={const:"switch"},z0={const:"call"},G0={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"]},K0={enum:["=","+=","-=","*=","/="]},Y0={enum:["pop","shift"]},X0={enum:["push","unshift"]},Z0={const:"splice"},Q0={const:"reduce"},eS={enum:["map","filter"]},tS={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 "+`${cg()}) — 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"},rS={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 sS,iS,oS,aS;var lS=H(()=>{sS={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"}]},iS={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},oS={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},aS={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 pF,Zd,Qd,ep,tp,rp,np,sp,ip,op,cS;var uS=H(()=>{pF=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],Zd={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"},Qd={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"},ep={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"},tp={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:pF,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"},rp={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"},np={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"},sp={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"},ip={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"},op={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"},cS={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 fS;var dS=H(()=>{fS={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 dc;var pS=H(()=>{dc={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 mF,ap;var mS=H(()=>{Us();mF=[301,302,303,307,308],ap={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:Xa,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:Xa,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Xa,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:[...mF],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 hF(){return hS??=gF(),hS}async function gF(){let[e,t,r]=await Promise.all([yS.listAll(),bS.default.listAll(),xS.default.parseAll()]),n=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)n.add(u.name);let s=[...n].toSorted(),i=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])i.add(u);let o=[...i].toSorted(),a=new Set;for(let c of Object.values(r))for(let u of c){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let p of u.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 yF(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 bF(e){let t={...fc.properties};for(let r of e)t[r]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function xF(){let{tagExamples:e,cssProps:t,eventHandlers:r}=await hF();return{$defs:{DefsMap:oS,TypeDefEntry:aS,StateMap:iS,StateEntry:sS,TypedStateDef:R0,PureTypeDef:D0,FunctionDef:O0,ClassDef:cS,ClassParameterDef:Zd,ClassFieldDef:Qd,ClassConstructorDef:ep,ClassMethodDef:tp,FormatDef:rp,ProjectBlockDef:np,ServerBlockDef:sp,ConnectorBlockDef:ip,StudioHints:op,ExternalClassDef:M0,ExpressionPointer:F0,ExpressionLiteral:q0,ExpressionOperand:H0,UnaryOperator:V0,BinaryOperator:B0,ConditionalOperator:W0,SwitchOperator:U0,CallOperator:z0,PureMethod:G0,AssignmentOperator:K0,NoArgMethod:Y0,OneArgMethod:X0,SpliceMethod:Z0,ReduceMethod:Q0,MapFilterMethod:eS,ExpressionNode:tS,ExpressionEntry:rS,Statement:N0,StatementList:T0,ElementDef:{...Xd,properties:{...Xd.properties,...yF(r)}},ChildrenValue:v0,ArrayNamespace:$0,SwitchDef:j0,SwitchNode:k0,StyleObject:{...fc,properties:bF(t)},AttributesObject:S0,PropsObject:E0,RefObject:g0,AnyRef:h0,InternalRef:c0,StateRef:u0,ExternalRef:f0,ExternalComponentRef:y0,GlobalRef:d0,ParentRef:p0,MapRef:m0,ElementPropertyValue:P0,StringOrRef:Zw,BoolOrRef:Qw,NumberOrRef:e0,CemParameter:s0,CemEvent:i0,TagName:{...Yw,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:zw,ElementTagName:Gw,JsonSchemaType:a0,HeadEntry:r0,ImageConfig:dc,PathsValue:{$id:ti,anyOf:[...ca,Vd],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:ti,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 $F(){return{$defs:{ImageConfig:dc,StyleObject:$S},$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:ap.properties,title:"Jx Project",type:"object"}}function vF(){return{$defs:{ImageConfig:dc,JxFieldSchema:yw,RelationshipRef:bw,StyleObject:$S},$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:ap.properties,title:"Jx Project Core",type:"object"}}function wF(){return{$id:la,$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 SF(){return{$id:ti,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...ca,Vd],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 EF(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...fS}}function lp(){return{$defs:{ClassConstructorDef:ep,ClassFieldDef:Qd,ClassMethodDef:tp,ClassParameterDef:Zd,ConnectorBlockDef:ip,FormatDef:rp,ProjectBlockDef:np,ServerBlockDef:sp,StudioHints:op},$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 PF(e){let{mkdirSync:t,writeFileSync:r}=await import("node:fs"),{resolve:n,dirname:s}=await import("node:path"),i=s(n(e,"..")),o=await xF(),a=$F(),l=lp(),c=vF(),u=EF(),p=wF(),g=SF(),m=JSON.stringify(o,null,2),b=JSON.stringify(a,null,2),h=JSON.stringify(l,null,2),y=JSON.stringify(c,null,2),v=JSON.stringify(u,null,2),k=JSON.stringify(p,null,2),S=JSON.stringify(g,null,2),[E]=process.argv.slice(2);if(E)r(E,m,"utf8"),console.error(`Jx component schema written to ${E}`);else{r(n(i,"schema.json"),m,"utf8"),r(n(i,"project-schema.json"),b,"utf8"),r(n(i,"class-schema.json"),h,"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"),k,"utf8"),r(n(i,"schemas","document.paths.schema.json"),S,"utf8"),r(n(i,"extension-manifest.schema.json"),v,"utf8");let j=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(j.exitCode!==0){let R=j.stderr.toString()||j.stdout.toString()||`exit ${j.exitCode}${j.signalCode?`, signal ${j.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${R})`)}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 yS,bS,xS,hS=null,$S,gS,rZ;var vS=H(()=>{Kw();Xw();t0();n0();o0();l0();b0();x0();w0();_0();A0();C0();I0();J0();L0();nS();lS();uS();dS();oc();pS();mS();yS=Yt(Iw(),1),bS=Yt(Lw(),1),xS=Yt(Uw(),1);$S={...fc,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,gS]=process.argv,rZ=gS?.endsWith("schema.ts")?PF(gS):void 0});var ha=C(function(ES){Object.defineProperty(ES,"__esModule",{value:!0});ES.regexpCode=ES.getEsmExportName=ES.getProperty=ES.safeStringify=ES.stringify=ES.strConcat=ES.addCodeArg=ES.str=ES._=ES.nil=ES._Code=ES.Name=ES.IDENTIFIER=ES._CodeOrName=void 0;class pc{}ES._CodeOrName=pc;ES.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Ui extends pc{constructor(e){super();if(!ES.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}}}ES.Name=Ui;class Hr extends pc{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 Ui)t[r.str]=(t[r.str]||0)+1;return t},{})}}ES._Code=Hr;ES.nil=new Hr("");function wS(e,...t){let r=[e[0]],n=0;while(n<t.length)up(r,t[n]),r.push(e[++n]);return new Hr(r)}ES._=wS;var cp=new Hr("+");function SS(e,...t){let r=[ma(e[0])],n=0;while(n<t.length)r.push(cp),up(r,t[n]),r.push(cp,ma(e[++n]));return jF(r),new Hr(r)}ES.str=SS;function up(e,t){if(t instanceof Hr)e.push(...t._items);else if(t instanceof Ui)e.push(t);else e.push(RF(t))}ES.addCodeArg=up;function jF(e){let t=1;while(t<e.length-1){if(e[t]===cp){let r=kF(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function kF(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Ui||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 Ui))return`"${e}${t.slice(1)}`;return}function _F(e,t){return t.emptyStr()?e:e.emptyStr()?t:SS`${e}${t}`}ES.strConcat=_F;function RF(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ma(Array.isArray(e)?e.join(","):e)}function AF(e){return new Hr(ma(e))}ES.stringify=AF;function ma(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ES.safeStringify=ma;function OF(e){return typeof e=="string"&&ES.IDENTIFIER.test(e)?new Hr(`.${e}`):wS`[${e}]`}ES.getProperty=OF;function CF(e){if(typeof e=="string"&&ES.IDENTIFIER.test(e))return new Hr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ES.getEsmExportName=CF;function NF(e){return new Hr(e.toString())}ES.regexpCode=NF});var mp=C(function(_S){Object.defineProperty(_S,"__esModule",{value:!0});_S.ValueScope=_S.ValueScopeName=_S.Scope=_S.varKinds=_S.UsedValueState=void 0;var Fe=ha();class jS extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var hc;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(hc||(_S.UsedValueState=hc={}));_S.varKinds={const:new Fe.Name("const"),let:new Fe.Name("let"),var:new Fe.Name("var")};class dp{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Fe.Name?e:this.name(e)}name(e){return new Fe.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}}}_S.Scope=dp;class pp extends Fe.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Fe._`.${new Fe.Name(t)}[${r}]`}}_S.ValueScopeName=pp;var UF=Fe._`\n`;class kS extends dp{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?UF:Fe.nil}}get(){return this._scope}name(e){return new pp(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 Fe._`${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=Fe.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,hc.Started);let c=t(l);if(c){let u=this.opts.es5?_S.varKinds.var:_S.varKinds.const;s=Fe._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(l))s=Fe._`${s}${c}${this.opts._n}`;else throw new jS(l);a.set(l,hc.Completed)})}return s}}_S.ValueScope=kS});var $e=C(function(sr){Object.defineProperty(sr,"__esModule",{value:!0});sr.or=sr.and=sr.not=sr.CodeGen=sr.operators=sr.varKinds=sr.ValueScopeName=sr.ValueScope=sr.Scope=sr.Name=sr.regexpCode=sr.stringify=sr.getProperty=sr.nil=sr.strConcat=sr.str=sr._=void 0;var Z=ha(),st=mp(),fs=ha();Object.defineProperty(sr,"_",{enumerable:!0,get:function(){return fs._}});Object.defineProperty(sr,"str",{enumerable:!0,get:function(){return fs.str}});Object.defineProperty(sr,"strConcat",{enumerable:!0,get:function(){return fs.strConcat}});Object.defineProperty(sr,"nil",{enumerable:!0,get:function(){return fs.nil}});Object.defineProperty(sr,"getProperty",{enumerable:!0,get:function(){return fs.getProperty}});Object.defineProperty(sr,"stringify",{enumerable:!0,get:function(){return fs.stringify}});Object.defineProperty(sr,"regexpCode",{enumerable:!0,get:function(){return fs.regexpCode}});Object.defineProperty(sr,"Name",{enumerable:!0,get:function(){return fs.Name}});var vc=mp();Object.defineProperty(sr,"Scope",{enumerable:!0,get:function(){return vc.Scope}});Object.defineProperty(sr,"ValueScope",{enumerable:!0,get:function(){return vc.ValueScope}});Object.defineProperty(sr,"ValueScopeName",{enumerable:!0,get:function(){return vc.ValueScopeName}});Object.defineProperty(sr,"varKinds",{enumerable:!0,get:function(){return vc.varKinds}});sr.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};class ds{optimizeNodes(){return this}optimizeNames(e,t){return this}}class AS extends ds{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?st.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=Gi(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class yp extends ds{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 Z.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Gi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return $c(e,this.rhs)}}class OS extends yp{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class CS extends ds{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class NS extends ds{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class TS extends ds{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class IS extends ds{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=Gi(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class wc extends ds{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;YF(e,s.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ri(e,t.names),{})}}class ps extends wc{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class MS extends wc{}class ga extends ps{}ga.kind="else";class Vn extends ps{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 ga(r):r}if(t){if(e===!1)return t instanceof Vn?t:t.nodes;if(this.nodes.length)return this;return new Vn(qS(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=Gi(this.condition,e,t),this}get names(){let e=super.names;if($c(e,this.condition),this.else)ri(e,this.else.names);return e}}Vn.kind="if";class zi extends ps{}zi.kind="for";class JS extends zi{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=Gi(this.iteration,e,t),this}get names(){return ri(super.names,this.iteration.names)}}class DS extends zi{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?st.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=$c(super.names,this.from);return $c(e,this.to)}}class hp extends zi{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=Gi(this.iterable,e,t),this}get names(){return ri(super.names,this.iterable.names)}}class gc extends ps{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)}}gc.kind="func";class yc extends wc{render(e){return"return "+super.render(e)}}yc.kind="return";class LS extends ps{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)ri(e,this.catch.names);if(this.finally)ri(e,this.finally.names);return e}}class bc extends ps{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}bc.kind="catch";class xc extends ps{render(e){return"finally"+super.render(e)}}xc.kind="finally";class FS{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
563
- `:""},this._extScope=e,this._scope=new st.Scope({parent:e}),this._nodes=[new MS]}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 AS(e,s,r)),s}const(e,t,r){return this._def(st.varKinds.const,e,t,r)}let(e,t,r){return this._def(st.varKinds.let,e,t,r)}var(e,t,r){return this._def(st.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new yp(e,t,r))}add(e,t){return this._leafNode(new OS(e,sr.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new IS(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(":"),Z.addCodeArg(t,n)}return t.push("}"),new Z._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 ga)}endIf(){return this._endBlockNode(Vn,ga)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new JS(e),t)}forRange(e,t,r,n,s=this.opts.es5?st.varKinds.var:st.varKinds.let){let i=this._scope.toName(e);return this._for(new DS(s,i,t,r),()=>n(i))}forOf(e,t,r,n=st.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=t instanceof Z.Name?t:this.var("_arr",t);return this.forRange("_i",0,Z._`${i}.length`,(o)=>{this.var(s,Z._`${i}[${o}]`),r(s)})}return this._for(new hp("of",n,s,t),()=>r(s))}forIn(e,t,r,n=this.opts.es5?st.varKinds.var:st.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Z._`Object.keys(${t})`,r);let s=this._scope.toName(e);return this._for(new hp("in",n,s,t),()=>r(s))}endFor(){return this._endBlockNode(zi)}label(e){return this._leafNode(new CS(e))}break(e){return this._leafNode(new NS(e))}return(e){let t=new yc;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(yc)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new LS;if(this._blockNode(n),this.code(e),t){let s=this.name("e");this._currNode=n.catch=new bc(s),t(s)}if(r)this._currNode=n.finally=new xc,this.code(r);return this._endBlockNode(bc,xc)}throw(e){return this._leafNode(new TS(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=Z.nil,r,n){if(this._blockNode(new gc(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(gc)}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}}sr.CodeGen=FS;function ri(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function $c(e,t){return t instanceof Z._CodeOrName?ri(e,t.names):e}function Gi(e,t,r){if(e instanceof Z.Name)return n(e);if(!s(e))return e;return new Z._Code(e._items.reduce((i,o)=>{if(o instanceof Z.Name)o=n(o);if(o instanceof Z._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 Z._Code&&i._items.some((o)=>o instanceof Z.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function YF(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function qS(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${gp(e)}`}sr.not=qS;var XF=HS(sr.operators.AND);function ZF(...e){return e.reduce(XF)}sr.and=ZF;var QF=HS(sr.operators.OR);function eq(...e){return e.reduce(QF)}sr.or=eq;function HS(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:Z._`${gp(t)} ${e} ${gp(r)}`}function gp(e){return e instanceof Z.Name?e:Z._`(${e})`}});var _e=C(function(ZS){Object.defineProperty(ZS,"__esModule",{value:!0});ZS.checkStrictMode=ZS.getErrorPath=ZS.Type=ZS.useFunc=ZS.setEvaluated=ZS.evaluatedPropsToName=ZS.mergeEvaluated=ZS.eachItem=ZS.unescapeJsonPointer=ZS.escapeJsonPointer=ZS.escapeFragment=ZS.unescapeFragment=ZS.schemaRefOrVal=ZS.schemaHasRulesButRef=ZS.schemaHasRules=ZS.checkUnknownRules=ZS.alwaysValidSchema=ZS.toHash=void 0;var fe=$e(),US=ha();function sq(e){let t={};for(let r of e)t[r]=!0;return t}ZS.toHash=sq;function iq(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return zS(e,t),!GS(t,e.self.RULES.all)}ZS.alwaysValidSchema=iq;function zS(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])XS(e,`unknown keyword: "${i}"`)}ZS.checkUnknownRules=zS;function GS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}ZS.schemaHasRules=GS;function oq(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}ZS.schemaHasRulesButRef=oq;function aq({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return fe._`${r}`}return fe._`${e}${t}${fe.getProperty(n)}`}ZS.schemaRefOrVal=aq;function lq(e){return KS(decodeURIComponent(e))}ZS.unescapeFragment=lq;function cq(e){return encodeURIComponent(xp(e))}ZS.escapeFragment=cq;function xp(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}ZS.escapeJsonPointer=xp;function KS(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}ZS.unescapeJsonPointer=KS;function uq(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}ZS.eachItem=uq;function BS({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let l=o===void 0?i:o instanceof fe.Name?(i instanceof fe.Name?e(s,i,o):t(s,i,o),o):i instanceof fe.Name?(t(s,o,i),i):r(i,o);return a===fe.Name&&!(l instanceof fe.Name)?n(s,l):l}}ZS.mergeEvaluated={props:BS({mergeNames:(e,t,r)=>e.if(fe._`${r} !== true && ${t} !== undefined`,()=>{e.if(fe._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,fe._`${r} || {}`).code(fe._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(fe._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,fe._`${r} || {}`),$p(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:YS}),items:BS({mergeNames:(e,t,r)=>e.if(fe._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,fe._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(fe._`${r} !== true`,()=>e.assign(r,t===!0?!0:fe._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function YS(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",fe._`{}`);if(t!==void 0)$p(e,r,t);return r}ZS.evaluatedPropsToName=YS;function $p(e,t,r){Object.keys(r).forEach((n)=>e.assign(fe._`${t}${fe.getProperty(n)}`,!0))}ZS.setEvaluated=$p;var WS={};function fq(e,t){return e.scopeValue("func",{ref:t,code:WS[t.code]||(WS[t.code]=new US._Code(t.code))})}ZS.useFunc=fq;var bp;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(bp||(ZS.Type=bp={}));function dq(e,t,r){if(e instanceof fe.Name){let n=t===bp.Num;return r?n?fe._`"[" + ${e} + "]"`:fe._`"['" + ${e} + "']"`:n?fe._`"/" + ${e}`:fe._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?fe.getProperty(e).toString():"/"+xp(e)}ZS.getErrorPath=dq;function XS(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}ZS.checkStrictMode=XS});var Rr=C(function(eE){Object.defineProperty(eE,"__esModule",{value:!0});var Me=$e(),Aq={data:new Me.Name("data"),valCxt:new Me.Name("valCxt"),instancePath:new Me.Name("instancePath"),parentData:new Me.Name("parentData"),parentDataProperty:new Me.Name("parentDataProperty"),rootData:new Me.Name("rootData"),dynamicAnchors:new Me.Name("dynamicAnchors"),vErrors:new Me.Name("vErrors"),errors:new Me.Name("errors"),this:new Me.Name("this"),self:new Me.Name("self"),scope:new Me.Name("scope"),json:new Me.Name("json"),jsonPos:new Me.Name("jsonPos"),jsonLen:new Me.Name("jsonLen"),jsonPart:new Me.Name("jsonPart")};eE.default=Aq});var ya=C(function(sE){Object.defineProperty(sE,"__esModule",{value:!0});sE.extendErrors=sE.resetErrorsCount=sE.reportExtraError=sE.reportError=sE.keyword$DataError=sE.keywordError=void 0;var ne=$e(),ms=_e(),Ut=Rr();sE.keywordError={message:({keyword:e})=>ne.str`must pass "${e}" keyword validation`};sE.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ne.str`"${e}" keyword must be ${t} ($data)`:ne.str`"${e}" keyword is invalid ($data)`};function Cq(e,t=sE.keywordError,r,n){let{it:s}=e,{gen:i,compositeRule:o,allErrors:a}=s,l=nE(e,t,r);if(n!==null&&n!==void 0?n:o||a)tE(i,l);else rE(s,ne._`[${l}]`)}sE.reportError=Cq;function Nq(e,t=sE.keywordError,r){let{it:n}=e,{gen:s,compositeRule:i,allErrors:o}=n,a=nE(e,t,r);if(tE(s,a),!(i||o))rE(n,Ut.default.vErrors)}sE.reportExtraError=Nq;function Tq(e,t){e.assign(Ut.default.errors,t),e.if(ne._`${Ut.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${Ut.default.vErrors}.length`,t),()=>e.assign(Ut.default.vErrors,null)))}sE.resetErrorsCount=Tq;function Iq({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,Ut.default.errors,(a)=>{if(e.const(o,ne._`${Ut.default.vErrors}[${a}]`),e.if(ne._`${o}.instancePath === undefined`,()=>e.assign(ne._`${o}.instancePath`,ne.strConcat(Ut.default.instancePath,i.errorPath))),e.assign(ne._`${o}.schemaPath`,ne.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(ne._`${o}.schema`,r),e.assign(ne._`${o}.data`,n)})}sE.extendErrors=Iq;function tE(e,t){let r=e.const("err",t);e.if(ne._`${Ut.default.vErrors} === null`,()=>e.assign(Ut.default.vErrors,ne._`[${r}]`),ne._`${Ut.default.vErrors}.push(${r})`),e.code(ne._`${Ut.default.errors}++`)}function rE(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;if(s.$async)r.throw(ne._`new ${e.ValidationError}(${t})`);else r.assign(ne._`${n}.errors`,t),r.return(!1)}var ni={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function nE(e,t,r){let{createErrors:n}=e.it;if(n===!1)return ne._`{}`;return Mq(e,t,r)}function Mq(e,t,r={}){let{gen:n,it:s}=e,i=[Jq(s,r),Dq(e,r)];return Lq(e,t,i),n.object(...i)}function Jq({errorPath:e},{instancePath:t}){let r=t?ne.str`${e}${ms.getErrorPath(t,ms.Type.Str)}`:e;return[Ut.default.instancePath,ne.strConcat(Ut.default.instancePath,r)]}function Dq({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:ne.str`${t}/${e}`;if(r)s=ne.str`${s}${ms.getErrorPath(r,ms.Type.Str)}`;return[ni.schemaPath,s]}function Lq(e,{params:t,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:p}=a;if(n.push([ni.keyword,s],[ni.params,typeof t=="function"?t(e):t||ne._`{}`]),l.messages)n.push([ni.message,typeof r=="function"?r(e):r]);if(l.verbose)n.push([ni.schema,o],[ni.parentSchema,ne._`${u}${p}`],[Ut.default.data,i]);if(c)n.push([ni.propertyName,c])}});var fE=C(function(cE){Object.defineProperty(cE,"__esModule",{value:!0});cE.boolOrEmptySchema=cE.topBoolOrEmptySchema=void 0;var oE=ya(),aE=$e(),Bq=Rr(),Wq={message:"boolean schema is false"};function Uq(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)lE(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Bq.default.data);else t.assign(aE._`${n}.errors`,null),t.return(!0)}cE.topBoolOrEmptySchema=Uq;function zq(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),lE(e);else r.var(t,!0)}cE.boolOrEmptySchema=zq;function lE(e,t){let{gen:r,data:n}=e;oE.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},Wq,void 0,t)}});var wp=C(function(dE){Object.defineProperty(dE,"__esModule",{value:!0});dE.getRules=dE.isJSONType=void 0;var Kq=["string","number","integer","boolean","null","object","array"],Yq=new Set(Kq);function Xq(e){return typeof e=="string"&&Yq.has(e)}dE.isJSONType=Xq;function Zq(){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:{}}}dE.getRules=Zq});var Sp=C(function(gE){Object.defineProperty(gE,"__esModule",{value:!0});gE.shouldUseRule=gE.shouldUseGroup=gE.schemaHasRulesForType=void 0;function e5({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&mE(e,n)}gE.schemaHasRulesForType=e5;function mE(e,t){return t.rules.some((r)=>hE(e,r))}gE.shouldUseGroup=mE;function hE(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))}gE.shouldUseRule=hE});var ba=C(function(SE){Object.defineProperty(SE,"__esModule",{value:!0});SE.reportTypeError=SE.checkDataTypes=SE.checkDataType=SE.coerceAndCheckDataType=SE.getJSONTypes=SE.getSchemaTypes=SE.DataType=void 0;var bE=wp(),xE=Sp(),$E=ya(),U=$e(),Ec=_e(),Ki;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ki||(SE.DataType=Ki={}));function n5(e){let t=vE(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}SE.getSchemaTypes=n5;function vE(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(bE.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}SE.getJSONTypes=vE;function s5(e,t){let{gen:r,data:n,opts:s}=e,i=i5(t,s.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&xE.schemaHasRulesForType(e,t[0]));if(o){let a=Pp(t,n,s.strictNumbers,Ki.Wrong);r.if(a,()=>{if(i.length)o5(e,t,i);else jp(e)})}return o}SE.coerceAndCheckDataType=s5;var wE=new Set(["string","number","integer","boolean","null"]);function i5(e,t){return t?e.filter((r)=>wE.has(r)||t==="array"&&r==="array"):[]}function o5(e,t,r){let{gen:n,data:s,opts:i}=e,o=n.let("dataType",U._`typeof ${s}`),a=n.let("coerced",U._`undefined`);if(i.coerceTypes==="array")n.if(U._`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,U._`${s}[0]`).assign(o,U._`typeof ${s}`).if(Pp(t,s,i.strictNumbers),()=>n.assign(a,s)));n.if(U._`${a} !== undefined`);for(let c of r)if(wE.has(c)||c==="array"&&i.coerceTypes==="array")l(c);n.else(),jp(e),n.endIf(),n.if(U._`${a} !== undefined`,()=>{n.assign(s,a),a5(e,a)});function l(c){switch(c){case"string":n.elseIf(U._`${o} == "number" || ${o} == "boolean"`).assign(a,U._`"" + ${s}`).elseIf(U._`${s} === null`).assign(a,U._`""`);return;case"number":n.elseIf(U._`${o} == "boolean" || ${s} === null
564
- || (${o} == "string" && ${s} && ${s} == +${s})`).assign(a,U._`+${s}`);return;case"integer":n.elseIf(U._`${o} === "boolean" || ${s} === null
565
- || (${o} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,U._`+${s}`);return;case"boolean":n.elseIf(U._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(U._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf(U._`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf(U._`${o} === "string" || ${o} === "number"
566
- || ${o} === "boolean" || ${s} === null`).assign(a,U._`[${s}]`)}}}function a5({gen:e,parentData:t,parentDataProperty:r},n){e.if(U._`${t} !== undefined`,()=>e.assign(U._`${t}[${r}]`,n))}function Ep(e,t,r,n=Ki.Correct){let s=n===Ki.Correct?U.operators.EQ:U.operators.NEQ,i;switch(e){case"null":return U._`${t} ${s} null`;case"array":i=U._`Array.isArray(${t})`;break;case"object":i=U._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o(U._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return U._`typeof ${t} ${s} ${e}`}return n===Ki.Correct?i:U.not(i);function o(a=U.nil){return U.and(U._`typeof ${t} == "number"`,a,r?U._`isFinite(${t})`:U.nil)}}SE.checkDataType=Ep;function Pp(e,t,r,n){if(e.length===1)return Ep(e[0],t,r,n);let s,i=Ec.toHash(e);if(i.array&&i.object){let o=U._`typeof ${t} != "object"`;s=i.null?o:U._`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else s=U.nil;if(i.number)delete i.integer;for(let o in i)s=U.and(s,Ep(o,t,r,n));return s}SE.checkDataTypes=Pp;var l5={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?U._`{type: ${e}}`:U._`{type: ${t}}`};function jp(e){let t=c5(e);$E.reportError(t,l5)}SE.reportTypeError=jp;function c5(e){let{gen:t,data:r,schema:n}=e,s=Ec.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var RE=C(function(kE){Object.defineProperty(kE,"__esModule",{value:!0});kE.assignDefaults=void 0;var Ar=$e(),jE=_e();function g5(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)PE(e,s,r[s].default);else if(t==="array"&&Array.isArray(n))n.forEach((s,i)=>PE(e,i,s.default))}kE.assignDefaults=g5;function PE(e,t,r){let{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;let a=Ar._`${i}${Ar.getProperty(t)}`;if(s){jE.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=Ar._`${a} === undefined`;if(o.useDefaults==="empty")l=Ar._`${l} || ${a} === null || ${a} === ""`;n.if(l,Ar._`${a} = ${Ar.stringify(r)}`)}});var Or=C(function(NE){Object.defineProperty(NE,"__esModule",{value:!0});NE.validateUnion=NE.validateArray=NE.usePattern=NE.callValidateCode=NE.schemaProperties=NE.allSchemaProperties=NE.noPropertyInData=NE.propertyInData=NE.isOwnProperty=NE.hasPropFunc=NE.reportMissingProp=NE.checkMissingProp=NE.checkReportMissingProp=void 0;var he=$e(),Yi=_e(),hs=Rr(),AE=_e();function y5(e,t){let{gen:r,data:n,it:s}=e;r.if(_p(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}NE.checkReportMissingProp=y5;function b5({gen:e,data:t,it:{opts:r}},n,s){return he.or(...n.map((i)=>he.and(_p(e,t,i,r.ownProperties),he._`${s} = ${i}`)))}NE.checkMissingProp=b5;function x5(e,t){e.setParams({missingProperty:t},!0),e.error()}NE.reportMissingProp=x5;function OE(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}NE.hasPropFunc=OE;function kp(e,t,r){return he._`${OE(e)}.call(${t}, ${r})`}NE.isOwnProperty=kp;function $5(e,t,r,n){let s=he._`${t}${he.getProperty(r)} !== undefined`;return n?he._`${s} && ${kp(e,t,r)}`:s}NE.propertyInData=$5;function _p(e,t,r,n){let s=he._`${t}${he.getProperty(r)} === undefined`;return n?he.or(s,he.not(kp(e,t,r))):s}NE.noPropertyInData=_p;function CE(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}NE.allSchemaProperties=CE;function v5(e,t){return CE(t).filter((r)=>!Yi.alwaysValidSchema(e,t[r]))}NE.schemaProperties=v5;function w5({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,l,c){let u=c?he._`${e}, ${t}, ${n}${s}`:t,p=[[hs.default.instancePath,he.strConcat(hs.default.instancePath,i)],[hs.default.parentData,o.parentData],[hs.default.parentDataProperty,o.parentDataProperty],[hs.default.rootData,hs.default.rootData]];if(o.opts.dynamicRef)p.push([hs.default.dynamicAnchors,hs.default.dynamicAnchors]);let g=he._`${u}, ${r.object(...p)}`;return l!==he.nil?he._`${a}.call(${l}, ${g})`:he._`${a}(${g})`}NE.callValidateCode=w5;var S5=he._`new RegExp`;function E5({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"?S5:AE.useFunc(e,s)}(${r}, ${n})`})}NE.usePattern=E5;function P5(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:Yi.Type.Num},i),t.if(he.not(i),a)})}}NE.validateArray=P5;function j5(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((l)=>Yi.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let o=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let u=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(o,he._`${o} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}NE.validateUnion=j5});var qE=C(function(LE){Object.defineProperty(LE,"__esModule",{value:!0});LE.validateKeywordUsage=LE.validSchemaType=LE.funcKeywordCode=LE.macroKeywordCode=void 0;var Le=$e(),si=Rr(),ME=Or(),JE=ya();function L5(e,t){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,a=t.macro.call(o.self,s,i,o),l=DE(r,n,a);if(o.opts.validateSchema!==!1)o.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:Le.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}LE.macroKeywordCode=L5;function F5(e,t){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:l}=e;H5(l,t);let c=!a&&t.compile?t.compile.call(l.self,i,o,l):t.validate,u=DE(n,s,c),p=n.let("valid");e.block$data(p,g),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function g(){if(t.errors===!1){if(h(),t.modifying)IE(e);y(()=>e.error())}else{let v=t.async?m():b();if(t.modifying)IE(e);y(()=>q5(e,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>h(Le._`await `),(k)=>n.assign(p,!1).if(Le._`${k} instanceof ${l.ValidationError}`,()=>n.assign(v,Le._`${k}.errors`),()=>n.throw(k))),v}function b(){let v=Le._`${u}.errors`;return n.assign(v,null),h(Le.nil),v}function h(v=t.async?Le._`await `:Le.nil){let k=l.opts.passContext?si.default.this:si.default.self,S=!(("compile"in t)&&!a||t.schema===!1);n.assign(p,Le._`${v}${ME.callValidateCode(e,u,k,S)}`,t.modifying)}function y(v){var k;n.if(Le.not((k=t.valid)!==null&&k!==void 0?k:p),v)}}LE.funcKeywordCode=F5;function IE(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Le._`${n.parentData}[${n.parentDataProperty}]`))}function q5(e,t){let{gen:r}=e;r.if(Le._`Array.isArray(${t})`,()=>{r.assign(si.default.vErrors,Le._`${si.default.vErrors} === null ? ${t} : ${si.default.vErrors}.concat(${t})`).assign(si.default.errors,Le._`${si.default.vErrors}.length`),JE.extendErrors(e)},()=>e.error())}function H5({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function DE(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:Le.stringify(r)})}function V5(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")}LE.validSchemaType=V5;function B5({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)}}}LE.validateKeywordUsage=B5});var BE=C(function(HE){Object.defineProperty(HE,"__esModule",{value:!0});HE.extendSubschemaMode=HE.extendSubschemaData=HE.getSubschema=void 0;var yt=$e(),Pc=_e();function G5(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:yt._`${e.schemaPath}${yt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:yt._`${e.schemaPath}${yt.getProperty(t)}${yt.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${Pc.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')}HE.getSubschema=G5;function K5(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:u,opts:p}=t,g=a.let("data",yt._`${t.data}${yt.getProperty(r)}`,!0);l(g),e.errorPath=yt.str`${c}${Pc.getErrorPath(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=yt._`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof yt.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]}}HE.extendSubschemaData=K5;function Y5(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}HE.extendSubschemaMode=Y5});var Rp=C(function(AZ,WE){WE.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 zE=C(function(OZ,UE){var gs=UE.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(){};jc(t,n,s,e,"",e)};gs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};gs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};gs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};gs.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 jc(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 u in n){var p=n[u];if(Array.isArray(p)){if(u in gs.arrayKeywords)for(var g=0;g<p.length;g++)jc(e,t,r,p[g],s+"/"+u+"/"+g,i,s,u,n,g)}else if(u in gs.propsKeywords){if(p&&typeof p=="object")for(var m in p)jc(e,t,r,p[m],s+"/"+u+"/"+Q5(m),i,s,u,n,m)}else if(u in gs.keywords||e.allKeys&&!(u in gs.skipKeywords))jc(e,t,r,p,s+"/"+u,i,s,u,n)}r(n,s,i,o,a,l,c)}}function Q5(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var xa=C(function(ZE){Object.defineProperty(ZE,"__esModule",{value:!0});ZE.getSchemaRefs=ZE.resolveUrl=ZE.normalizeId=ZE._getFullPath=ZE.getFullPath=ZE.inlineRef=void 0;var GE=_e(),e3=Rp(),t3=zE(),r3=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function n3(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Ap(e);if(!t)return!1;return KE(e)<=t}ZE.inlineRef=n3;var s3=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ap(e){for(let t in e){if(s3.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ap))return!0;if(typeof r=="object"&&Ap(r))return!0}return!1}function KE(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,r3.has(r))continue;if(typeof e[r]=="object")GE.eachItem(e[r],(n)=>t+=KE(n));if(t===1/0)return 1/0}return t}function YE(e,t="",r){if(r!==!1)t=Xi(t);let n=e.parse(t);return XE(e,n)}ZE.getFullPath=YE;function XE(e,t){return e.serialize(t).split("#")[0]+"#"}ZE._getFullPath=XE;var i3=/#\/?$/;function Xi(e){return e?e.replace(i3,""):""}ZE.normalizeId=Xi;function o3(e,t,r){return r=Xi(r),e.resolve(t,r)}ZE.resolveUrl=o3;var a3=/^[a-z_][-a-z0-9._]*$/i;function l3(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=Xi(e[r]||t),i={"":s},o=YE(n,s,!1),a={},l=new Set;return t3(e,{allKeys:!0},(p,g,m,b)=>{if(b===void 0)return;let h=o+g,y=i[b];if(typeof p[r]=="string")y=v.call(this,p[r]);k.call(this,p.$anchor),k.call(this,p.$dynamicAnchor),i[g]=y;function v(S){let E=this.opts.uriResolver.resolve;if(S=Xi(y?E(y,S):S),l.has(S))throw u(S);l.add(S);let j=this.refs[S];if(typeof j=="string")j=this.refs[j];if(typeof j=="object")c(p,j.schema,S);else if(S!==Xi(h))if(S[0]==="#")c(p,a[S],S),a[S]=p;else this.refs[S]=h;return S}function k(S){if(typeof S=="string"){if(!a3.test(S))throw Error(`invalid anchor "${S}"`);v.call(this,`#${S}`)}}}),a;function c(p,g,m){if(g!==void 0&&!e3(p,g))throw u(m)}function u(p){return Error(`reference "${p}" resolves to more than one schema`)}}ZE.getSchemaRefs=l3});var eo=C(function(mP){Object.defineProperty(mP,"__esModule",{value:!0});mP.getData=mP.KeywordCxt=mP.validateFunctionCode=void 0;var _c=fE(),kc=ba(),Qi=Sp(),ys=ba(),nP=RE(),nn=qE(),Zi=BE(),F=$e(),be=Rr(),sP=xa(),Pt=_e(),rn=ya();function m3(e){if(aP(e)){if(lP(e),oP(e)){y3(e);return}}iP(e,()=>_c.topBoolOrEmptySchema(e))}mP.validateFunctionCode=m3;function iP({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){if(s.code.es5)e.func(t,F._`${be.default.data}, ${be.default.valCxt}`,n.$async,()=>{e.code(F._`"use strict"; ${eP(r,s)}`),g3(e,s),e.code(i)});else e.func(t,F._`${be.default.data}, ${h3(s)}`,n.$async,()=>e.code(eP(r,s)).code(i))}function h3(e){return F._`{${be.default.instancePath}="", ${be.default.parentData}, ${be.default.parentDataProperty}, ${be.default.rootData}=${be.default.data}${e.dynamicRef?F._`, ${be.default.dynamicAnchors}={}`:F.nil}}={}`}function g3(e,t){e.if(be.default.valCxt,()=>{if(e.var(be.default.instancePath,F._`${be.default.valCxt}.${be.default.instancePath}`),e.var(be.default.parentData,F._`${be.default.valCxt}.${be.default.parentData}`),e.var(be.default.parentDataProperty,F._`${be.default.valCxt}.${be.default.parentDataProperty}`),e.var(be.default.rootData,F._`${be.default.valCxt}.${be.default.rootData}`),t.dynamicRef)e.var(be.default.dynamicAnchors,F._`${be.default.valCxt}.${be.default.dynamicAnchors}`)},()=>{if(e.var(be.default.instancePath,F._`""`),e.var(be.default.parentData,F._`undefined`),e.var(be.default.parentDataProperty,F._`undefined`),e.var(be.default.rootData,be.default.data),t.dynamicRef)e.var(be.default.dynamicAnchors,F._`{}`)})}function y3(e){let{schema:t,opts:r,gen:n}=e;iP(e,()=>{if(r.$comment&&t.$comment)uP(e);if(w3(e),n.let(be.default.vErrors,null),n.let(be.default.errors,0),r.unevaluated)b3(e);cP(e),P3(e)});return}function b3(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",F._`${r}.evaluated`),t.if(F._`${e.evaluated}.dynamicProps`,()=>t.assign(F._`${e.evaluated}.props`,F._`undefined`)),t.if(F._`${e.evaluated}.dynamicItems`,()=>t.assign(F._`${e.evaluated}.items`,F._`undefined`))}function eP(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?F._`/*# sourceURL=${r} */`:F.nil}function x3(e,t){if(aP(e)){if(lP(e),oP(e)){$3(e,t);return}}_c.boolOrEmptySchema(e,t)}function oP({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 aP(e){return typeof e.schema!="boolean"}function $3(e,t){let{schema:r,gen:n,opts:s}=e;if(s.$comment&&r.$comment)uP(e);S3(e),E3(e);let i=n.const("_errs",be.default.errors);cP(e,i),n.var(t,F._`${i} === ${be.default.errors}`)}function lP(e){Pt.checkUnknownRules(e),v3(e)}function cP(e,t){if(e.opts.jtd)return tP(e,[],!1,t);let r=kc.getSchemaTypes(e.schema),n=kc.coerceAndCheckDataType(e,r);tP(e,r,!n,t)}function v3(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&Pt.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function w3(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Pt.checkStrictMode(e,"default is ignored in the schema root")}function S3(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=sP.resolveUrl(e.opts.uriResolver,e.baseId,t)}function E3(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function uP({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)e.code(F._`${be.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=F.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(F._`${be.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function P3(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;if(r.$async)t.if(F._`${be.default.errors} === 0`,()=>t.return(be.default.data),()=>t.throw(F._`new ${s}(${be.default.vErrors})`));else{if(t.assign(F._`${n}.errors`,be.default.vErrors),i.unevaluated)j3(e);t.return(F._`${be.default.errors} === 0`)}}function j3({gen:e,evaluated:t,props:r,items:n}){if(r instanceof F.Name)e.assign(F._`${t}.props`,r);if(n instanceof F.Name)e.assign(F._`${t}.items`,n)}function tP(e,t,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!Pt.schemaHasRulesButRef(i,u))){s.block(()=>dP(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)k3(e,t);s.block(()=>{for(let g of u.rules)p(g);p(u.post)});function p(g){if(!Qi.shouldUseGroup(i,g))return;if(g.type){if(s.if(ys.checkDataType(g.type,o,l.strictNumbers)),rP(e,g),t.length===1&&t[0]===g.type&&r)s.else(),ys.reportTypeError(e);s.endIf()}else rP(e,g);if(!a)s.if(F._`${be.default.errors} === ${n||0}`)}}function rP(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;if(s)nP.assignDefaults(e,t.type);r.block(()=>{for(let i of t.rules)if(Qi.shouldUseRule(n,i))dP(e,i.keyword,i.definition,t.type)})}function k3(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(_3(e,t),!e.opts.allowUnionTypes)R3(e,t);A3(e,e.dataTypes)}function _3(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!fP(e.dataTypes,r))Op(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),C3(e,t)}function R3(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Op(e,"use allowUnionTypes to allow union type keyword")}function A3(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&Qi.shouldUseRule(e.schema,s)){let{type:i}=s.definition;if(i.length&&!i.some((o)=>O3(t,o)))Op(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function O3(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function fP(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function C3(e,t){let r=[];for(let n of e.dataTypes)if(fP(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Op(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Pt.checkStrictMode(e,t,e.opts.strictTypes)}class Cp{constructor(e,t,r){if(nn.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=Pt.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",pP(this.$data,e));else if(this.schemaCode=this.schemaValue,!nn.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",be.default.errors)}result(e,t,r){this.failResult(F.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(F.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(F._`${t} !== undefined && (${F.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?rn.reportExtraError:rn.reportError)(this,this.def.error,t)}$dataError(){rn.reportError(this,this.def.$dataError||rn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');rn.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=F.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=F.nil,t=F.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:s,def:i}=this;if(r.if(F.or(F._`${n} === undefined`,t)),e!==F.nil)r.assign(e,!0);if(s.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==F.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:s}=this;return F.or(i(),o());function i(){if(r.length){if(!(t instanceof F.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return F._`${ys.checkDataTypes(a,t,s.opts.strictNumbers,ys.DataType.Wrong)}`}return F.nil}function o(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return F._`!${a}(${t})`}return F.nil}}subschema(e,t){let r=Zi.getSubschema(this.it,e);Zi.extendSubschemaData(r,this.it,e),Zi.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return x3(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=Pt.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Pt.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,F.Name)),!0}}mP.KeywordCxt=Cp;function dP(e,t,r,n){let s=new Cp(e,r,t);if("code"in r)r.code(s,n);else if(s.$data&&r.validate)nn.funcKeywordCode(s,r);else if("macro"in r)nn.macroKeywordCode(s,r);else if(r.compile||r.validate)nn.funcKeywordCode(s,r)}var N3=/^\/(?:[^~]|~0|~1)*$/,T3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function pP(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return be.default.rootData;if(e[0]==="/"){if(!N3.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=be.default.rootData}else{let c=T3.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(s=c[2],s==="#"){if(u>=t)throw Error(l("property/index",u));return n[t-u]}if(u>t)throw Error(l("data",u));if(i=r[t-u],!s)return i}let o=i,a=s.split("/");for(let c of a)if(c)i=F._`${i}${F.getProperty(Pt.unescapeJsonPointer(c))}`,o=F._`${o} && ${i}`;return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}mP.getData=pP});var $a=C(function(yP){Object.defineProperty(yP,"__esModule",{value:!0});class gP extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}yP.default=gP});var ro=C(function(xP){Object.defineProperty(xP,"__esModule",{value:!0});var to=xa();class bP extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=to.resolveUrl(e,t,r),this.missingSchema=to.normalizeId(to.getFullPath(e,this.missingRef))}}xP.default=bP});var wa=C(function(wP){Object.defineProperty(wP,"__esModule",{value:!0});wP.resolveSchema=wP.getCompilingSchema=wP.resolveRef=wP.compileSchema=wP.SchemaEnv=void 0;var it=$e(),L3=$a(),ii=Rr(),ot=xa(),Rc=_e(),$P=eo();class va{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:ot.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={}}}wP.SchemaEnv=va;function Tp(e){let t=vP.call(this,e);if(t)return t;let r=ot.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new it.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;if(e.$async)a=o.scopeValue("Error",{ref:L3.default,code:it._`require("ajv/dist/runtime/validation_error").default`});let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:ii.default.data,parentData:ii.default.parentData,parentDataProperty:ii.default.parentDataProperty,dataNames:[ii.default.data],dataPathArr:[it.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:it.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:it.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:it._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),$P.validateFunctionCode(c),o.optimize(this.opts.code.optimize);let p=o.toString();if(u=`${o.scopeRefs(ii.default.scope)}return ${p}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${ii.default.self}`,`${ii.default.scope}`,u)(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:h}=c;if(m.evaluated={props:b instanceof it.Name?void 0:b,items:h instanceof it.Name?void 0:h,dynamicProps:b instanceof it.Name,dynamicItems:h instanceof it.Name},m.source)m.source.evaluated=it.stringify(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw p}finally{this._compilations.delete(e)}}wP.compileSchema=Tp;function F3(e,t,r){var n;r=ot.resolveUrl(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=V3.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 va({schema:o,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=q3.call(this,i)}wP.resolveRef=F3;function q3(e){if(ot.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Tp.call(this,e)}function vP(e){for(let t of this._compilations)if(H3(t,e))return t}wP.getCompilingSchema=vP;function H3(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function V3(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Ac.call(this,e,t)}function Ac(e,t){let r=this.opts.uriResolver.parse(t),n=ot._getFullPath(this.opts.uriResolver,r),s=ot.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Np.call(this,r,e);let i=ot.normalizeId(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=Ac.call(this,e,o);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Np.call(this,r,a)}if(typeof(o===null||o===void 0?void 0:o.schema)!=="object")return;if(!o.validate)Tp.call(this,o);if(i===ot.normalizeId(t)){let{schema:a}=o,{schemaId:l}=this.opts,c=a[l];if(c)s=ot.resolveUrl(this.opts.uriResolver,s,c);return new va({schema:a,schemaId:l,root:e,baseId:s})}return Np.call(this,r,o)}wP.resolveSchema=Ac;var B3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Np(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[Rc.unescapeFragment(a)];if(l===void 0)return;r=l;let c=typeof r==="object"&&r[this.opts.schemaId];if(!B3.has(a)&&c)t=ot.resolveUrl(this.opts.uriResolver,t,c)}let i;if(typeof r!="boolean"&&r.$ref&&!Rc.schemaHasRulesButRef(r,this.RULES)){let a=ot.resolveUrl(this.opts.uriResolver,t,r.$ref);i=Ac.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new va({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i;return}});var EP=C(function(JZ,K3){K3.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 Fp=C(function(DZ,CP){var Y3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Mp=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),X3=RegExp.prototype.test.bind(/^\d*$/u),oi=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Jp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),jP=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Dp=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Z3=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),ir=Array(256);for(let t=0;t<256;t++)ir[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Jt(e){if(e<2048)return ir[192|e>>6]+ir[128|e&63];if(e<65536)return ir[224|e>>12]+ir[128|e>>6&63]+ir[128|e&63];return ir[240|e>>18]+ir[128|e>>12&63]+ir[128|e>>6&63]+ir[128|e&63]}function Q3(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 eH=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),tH=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),rH=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),nH=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function sH(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(rH(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&oi(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function PP(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 iH(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||!Mp(l))return;i+=2;continue}if(!eH(l))return;s[a]=parseInt(l,16).toString(16),i++}if(t===-1){if(i!==8)return;return PP(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 PP(o)}function Ip(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&&tH(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(oH(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),!sH(s))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let o=iH(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 oH(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function kP(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 aH(e){if(e===""||e[0]==="/")return kP(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 lH={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},cH=/[@/?#:]/g,uH=/[@/?#]/g;function _P(e,t){let r=t?uH:cH;return r.lastIndex=0,e.replace(r,(n)=>lH[n])}function RP(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(oi(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(t&&Jp(o))r+=o;else r+="%"+i;n+=2;continue}}r+=e[n]}return r}function fH(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(oi(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(o!=="."&&Jp(o))t+=o;else t+="%"+i;r+=2;continue}}if(jP(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=OP(s)?n:ir[s];else if(s<55296||s>57343)t+=Jt(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Jt(65536+(s-55296<<10)+(i-56320)),r++;else t+=Jt(65533)}else t+=Jt(65533)}}return t}function dH(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(oi(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(i==="/")n=!1;if(jP(i)&&(i!==":"||!n))r+=i;else{let o=e.charCodeAt(s);if(o<128)r+=ir[o];else if(o<55296||o>57343)r+=Jt(o);else if(o<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)r+=Jt(65536+(o-55296<<10)+(a-56320)),s++;else r+=Jt(65533)}else r+=Jt(65533)}}return r}function Lp(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(oi(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(s))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=ir[i];else if(i<55296||i>57343)r+=Jt(i);else if(i<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)r+=Jt(65536+(i-55296<<10)+(o-56320)),n++;else r+=Jt(65533)}else r+=Jt(65533)}}return r}function AP(e){return Lp(e,Z3)}function pH(e){return Lp(e,Dp)}function mH(e){return Lp(e,Dp)}function OP(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 hH(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(oi(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(Jp(o))t+=o;else t+="%"+i;r+=2;continue}}if(Dp(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=OP(s)?n:ir[s];else if(s<55296||s>57343)t+=Jt(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Jt(65536+(s-55296<<10)+(i-56320)),r++;else t+=Jt(65533)}else t+=Jt(65533)}}return t}function gH(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(oi(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function yH(e){let t=[];if(e.userinfo!==void 0)t.push(AP(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Mp(r)){let n=Ip(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=RP(r,!0),n=Ip(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=_P(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!X3(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}CP.exports={nonSimpleDomain:nH,recomposeAuthority:yH,reescapeHostDelimiters:_P,normalizePercentEncoding:RP,normalizePathEncoding:fH,serializePathEncoding:dH,normalizeQueryFragmentEncoding:hH,encodeUserinfo:AP,encodeQuery:pH,encodeFragment:mH,escapePreservingEscapes:gH,removeDotSegments:kP,removeDotSegmentsRelative:aH,isIPv4:Mp,isUUID:Y3,normalizeIPv6:Ip,stringArrayToHexStripped:Q3}});var JP=C(function(LZ,MP){var{isUUID:bH}=Fp(),xH=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,$H=["http","https","ws","wss","urn","urn:uuid"];function vH(e){return $H.indexOf(e)!==-1}function qp(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 NP(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function TP(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 wH(e){return e.secure=qp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function SH(e){if(e.port===(qp(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 EH(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(xH);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=Hp(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 PH(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=Hp(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 jH(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!bH(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function kH(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var IP={scheme:"http",domainHost:!0,parse:NP,serialize:TP},_H={scheme:"https",domainHost:IP.domainHost,parse:NP,serialize:TP},Oc={scheme:"ws",domainHost:!0,parse:wH,serialize:SH},RH={scheme:"wss",domainHost:Oc.domainHost,parse:Oc.parse,serialize:Oc.serialize},AH={scheme:"urn",parse:EH,serialize:PH,skipNormalize:!0},OH={scheme:"urn:uuid",parse:jH,serialize:kH,skipNormalize:!0},Cc={http:IP,https:_H,ws:Oc,wss:RH,urn:AH,"urn:uuid":OH};Object.setPrototypeOf(Cc,null);function Hp(e){return e&&(Cc[e]||Cc[e.toLowerCase()])||void 0}MP.exports={wsIsSecure:qp,SCHEMES:Cc,isValidSchemeName:vH,getSchemeHandler:Hp}});var XP=C(function(FZ,Mc){var{normalizeIPv6:HP,removeDotSegments:Ea,removeDotSegmentsRelative:VP,recomposeAuthority:CH,normalizePercentEncoding:Vp,normalizePathEncoding:NH,serializePathEncoding:DP,normalizeQueryFragmentEncoding:LP,encodeQuery:TH,encodeFragment:IH,reescapeHostDelimiters:MH,isIPv4:BP,nonSimpleDomain:JH}=Fp(),{SCHEMES:WP,getSchemeHandler:Bp}=JP(),UP=/^[A-Za-z][A-Za-z0-9+.-]*$/u,DH=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function FP(e){let t=String(e);if(!UP.test(t))throw TypeError("URI scheme is malformed.");return t}function LH(e,t){if(typeof e==="string")e=GH(e,t);else if(typeof e==="object")e=Tc(ai(e,t),t);return e}function FH(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}=Nc(e,n),{parsed:u,malformedAuthorityOrPort:p,malformedPercentEncoding:g,malformedSchemeSpecific:m,malformedHost:b,malformedScheme:h}=Nc(t,n);if(i||p||o||g||a||m||l||b||c||h)throw Error(s.error||u.error||"URI is malformed.");let y=zP(s,u,n,!0),v=Bp(r&&r.scheme||y.scheme),k=y.host,S=k!==void 0&&k!==""&&(BP(k)||HP(k).isIPV6);if(KP(y,r||{},v,S))throw Error("URI host is malformed.");GP(y,r||{},v,S);let E=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(y.error&&!E)throw Error(y.error);return n.skipEscape=!0,ai(y,n)}function zP(e,t,r,n){let s={};if(!n)e=Tc(ai(e,r),r),t=Tc(ai(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=Ea(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=Ea(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=Ea(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]!=="/"?VP(s.path):Ea(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 qH(e,t,r){let n=qP(e,r),s=qP(t,r);return n!==void 0&&s!==void 0&&n===s}function ai(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=FP(r.scheme);let i=Bp(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=DP(r.path,l);else r.path=Vp(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=FP(r.scheme),s.push(r.scheme,":");let c=CH(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 u=r.path;if(!n.absolutePath&&(!i||!i.absolutePath))u=a&&u[0]!=="/"?VP(u):Ea(u);if(a)u=DP(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(r.query!==void 0)s.push("?",TH(r.query));if(r.fragment!==void 0)s.push("#",IH(r.fragment));return s.join("")}var HH=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,VH=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,BH=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function WH(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 Sa(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 Ic(e){return e[0]==="["&&e[e.length-1]==="]"}function UH(e){let t=e[4];return Sa(e[3])||t!==void 0&&!Ic(t)&&Sa(t)||Sa(e[6])||Sa(e[7])||Sa(e[8])}function GP(e,t,r,n){if(KP(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Ic(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&JH(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(!zH(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function KP(e,t,r,n){return Boolean(e.host&&n===!1&&!Ic(e.host)&&(t.domainHost||r&&r.domainHost)&&DH.test(e.host))}function zH(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Nc(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,u=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let p=e.match(VH);if(p!==null&&p[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",s=!0;let g=e.match(BH);if(g!==null){let b=g[1],h=b.replace(/[\t\n\r]/g,"");if(h.length>=2){if(h.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",s=!0;else if(b.length!==h.length)n.error=n.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(HH);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(UP.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(i=UH(m),i)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let b=WH(n,m);if(b!==void 0)n.error=n.error||b,s=!0;if(n.host)if(BP(n.host)===!1){let v=Ic(n.host),k=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=HP(n.host);if(u=S.isIPV6||S.isIPVFuture===!0,l=k&&(!v||S.error===!0),n.host=u?S.host:S.host.toLowerCase(),l)n.error=n.error||"URI host is malformed.",s=!0}else u=!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 h=Bp(r.scheme||n.scheme);if(!l)a=GP(n,r,h,u);if(e.indexOf("%")!==-1&&n.host!==void 0&&!l){let y=u?n.host:Vp(n.host,!0);if(!u)y=Vp(y.toLowerCase());n.host=u||r.scheme!=="null"?MH(y,u):y}if(!h||h&&!h.skipNormalize){if(n.path)n.path=NH(n.path);if(n.query)n.query=LP(n.query);if(n.fragment)n.fragment=LP(n.fragment)}if(h&&h.parse){if(h.parse(n,r),h===WP.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 Tc(e,t){return Nc(e,t).parsed}function GH(e,t){return YP(e,t).normalized}function YP(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}=Nc(e,t);return{normalized:n||s||i||o||a?e:ai(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}}function qP(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:ai(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}=YP(r,t);return s||i||o||a||l?void 0:n}var Wp={SCHEMES:WP,normalize:LH,resolve:FH,resolveComponent:zP,equal:qH,serialize:ai,parse:Tc};Mc.exports=Wp;Mc.exports.default=Wp;Mc.exports.fastUri=Wp});var ej=C(function(QP){Object.defineProperty(QP,"__esModule",{value:!0});var ZP=XP();ZP.code='require("ajv/dist/runtime/uri").default';QP.default=ZP});var zp=C(function(Bn){Object.defineProperty(Bn,"__esModule",{value:!0});Bn.CodeGen=Bn.Name=Bn.nil=Bn.stringify=Bn.str=Bn._=Bn.KeywordCxt=void 0;var YH=eo();Object.defineProperty(Bn,"KeywordCxt",{enumerable:!0,get:function(){return YH.KeywordCxt}});var so=$e();Object.defineProperty(Bn,"_",{enumerable:!0,get:function(){return so._}});Object.defineProperty(Bn,"str",{enumerable:!0,get:function(){return so.str}});Object.defineProperty(Bn,"stringify",{enumerable:!0,get:function(){return so.stringify}});Object.defineProperty(Bn,"nil",{enumerable:!0,get:function(){return so.nil}});Object.defineProperty(Bn,"Name",{enumerable:!0,get:function(){return so.Name}});Object.defineProperty(Bn,"CodeGen",{enumerable:!0,get:function(){return so.CodeGen}});var XH=$a(),ij=ro(),oj=wp(),sn=wa(),aj=$e(),on=xa(),bs=ba(),no=_e(),tj=EP(),ZH=ej(),lj=(e,t)=>new RegExp(e,t);lj.code="new RegExp";var QH=["removeAdditional","useDefaults","coerceTypes"],eV=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),tV={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."},rV={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},rj=200;function nV(e){var t,r,n,s,i,o,a,l,c,u,p,g,m,b,h,y,v,k,S,E,j,R,A,_,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,G=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:lj,ae=(s=e.uriResolver)!==null&&s!==void 0?s:ZH.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:(u=(c=e.strictTypes)!==null&&c!==void 0?c:D)!==null&&u!==void 0?u:"log",strictTuples:(g=(p=e.strictTuples)!==null&&p!==void 0?p:D)!==null&&g!==void 0?g:"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:G}:{optimize:L,regExp:G},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:rj,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:rj,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(j=e.addUsedSchema)!==null&&j!==void 0?j:!0,validateSchema:(R=e.validateSchema)!==null&&R!==void 0?R:!0,validateFormats:(A=e.validateFormats)!==null&&A!==void 0?A:!0,unicodeRegExp:(_=e.unicodeRegExp)!==null&&_!==void 0?_:!0,int32range:(I=e.int32range)!==null&&I!==void 0?I:!0,uriResolver:ae}}class Jc{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,...nV(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new aj.ValueScope({scope:{},prefixes:eV,es5:t,lines:r}),this.logger=cV(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=oj.getRules(),nj.call(this,tV,e,"NOT SUPPORTED"),nj.call(this,rV,e,"DEPRECATED","warn"),this._metaOpts=aV.call(this),e.formats)iV.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)oV.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);sV.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=tj;if(r==="id")n={...tj},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,u){await s.call(this,c.$schema);let p=this._addSchema(c,u);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(u){if(!(u instanceof ij.default))throw u;return o.call(this,u),await a.call(this,u.missingSchema),i.call(this,c)}}function o({missingSchema:c,missingRef:u}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${u} cannot be resolved`)}async function a(c){let u=await l.call(this,c);if(!this.refs[c])await s.call(this,u.$schema);if(!this.refs[c])this.addSchema(u,c,t)}async function l(c){let u=this._loading[c];if(u)return u;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=on.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=sj.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new sn.SchemaEnv({schema:{},schemaId:r});if(t=sn.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=sj.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=on.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(fV.call(this,r,t),!t)return no.eachItem(r,(s)=>Up.call(this,s)),this;pV.call(this,t);let n={...t,type:bs.getJSONTypes(t.type),schemaType:bs.getJSONTypes(t.schemaType)};return no.eachItem(r,n.type.length===0?(s)=>Up.call(this,s,n):(s)=>n.type.forEach((i)=>Up.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]=cj(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=on.normalizeId(i||r);let l=on.getSchemaRefs.call(this,e,r);if(a=new sn.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 sn.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{sn.compileSchema.call(this,e)}finally{this.opts=t}}}Jc.ValidationError=XH.default;Jc.MissingRefError=ij.default;Bn.default=Jc;function nj(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 sj(e){return e=on.normalizeId(e),this.schemas[e]||this.refs[e]}function sV(){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 iV(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function oV(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 aV(){let e={...this.opts};for(let t of QH)delete e[t];return e}var lV={log(){},warn(){},error(){}};function cV(e){if(e===!1)return lV;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 uV=/^[a-z_$][a-z0-9_$:-]*$/i;function fV(e,t){let{RULES:r}=this;if(no.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!uV.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 Up(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:bs.getJSONTypes(t.type),schemaType:bs.getJSONTypes(t.schemaType)}};if(t.before)dV.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 dV(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 pV(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=cj(t);e.validateSchema=this.compile(t,!0)}var mV={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function cj(e){return{anyOf:[e,mV]}}});var fj=C(function(uj){Object.defineProperty(uj,"__esModule",{value:!0});var yV={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};uj.default=yV});var qc=C(function(pj){Object.defineProperty(pj,"__esModule",{value:!0});pj.callRef=pj.getValidate=void 0;var xV=ro(),Lc=Or(),qe=$e(),io=Rr(),Fc=wa(),xs=_e(),$V={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 u=Fc.resolveRef.call(l,c,s,r);if(u===void 0)throw new xV.default(n.opts.uriResolver,s,r);if(u instanceof Fc.SchemaEnv)return g(u);return m(u);function p(){if(i===c)return Dc(e,o,i,i.$async);let b=t.scopeValue("root",{ref:c});return Dc(e,qe._`${b}.validate`,c,c.$async)}function g(b){let h=dj(e,b);Dc(e,h,b,b.$async)}function m(b){let h=t.scopeValue("schema",a.code.source===!0?{ref:b,code:qe.stringify(b)}:{ref:b}),y=t.name("valid"),v=e.subschema({schema:b,dataTypes:[],schemaPath:qe.nil,topSchemaRef:h,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function dj(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):qe._`${r.scopeValue("wrapper",{ref:t})}.validate`}pj.getValidate=dj;function Dc(e,t,r,n){let{gen:s,it:i}=e,{allErrors:o,schemaEnv:a,opts:l}=i,c=l.passContext?io.default.this:qe.nil;if(n)u();else p();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let b=s.let("valid");s.try(()=>{if(s.code(qe._`await ${Lc.callValidateCode(e,t,c)}`),m(t),!o)s.assign(b,!0)},(h)=>{if(s.if(qe._`!(${h} instanceof ${i.ValidationError})`,()=>s.throw(h)),g(h),!o)s.assign(b,!1)}),e.ok(b)}function p(){e.result(Lc.callValidateCode(e,t,c),()=>m(t),()=>g(t))}function g(b){let h=qe._`${b}.errors`;s.assign(io.default.vErrors,qe._`${io.default.vErrors} === null ? ${h} : ${io.default.vErrors}.concat(${h})`),s.assign(io.default.errors,qe._`${io.default.vErrors}.length`)}function m(b){var h;if(!i.opts.unevaluated)return;let y=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)i.props=xs.mergeEvaluated.props(s,y.props,i.props)}else{let v=s.var("props",qe._`${b}.evaluated.props`);i.props=xs.mergeEvaluated.props(s,v,i.props,qe.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=xs.mergeEvaluated.items(s,y.items,i.items)}else{let v=s.var("items",qe._`${b}.evaluated.items`);i.items=xs.mergeEvaluated.items(s,v,i.items,qe.Name)}}}pj.callRef=Dc;pj.default=$V});var Gp=C(function(hj){Object.defineProperty(hj,"__esModule",{value:!0});var SV=fj(),EV=qc(),PV=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",SV.default,EV.default];hj.default=PV});var yj=C(function(gj){Object.defineProperty(gj,"__esModule",{value:!0});var vs=$e(),$s=vs.operators,Hc={maximum:{okStr:"<=",ok:$s.LTE,fail:$s.GT},minimum:{okStr:">=",ok:$s.GTE,fail:$s.LT},exclusiveMaximum:{okStr:"<",ok:$s.LT,fail:$s.GTE},exclusiveMinimum:{okStr:">",ok:$s.GT,fail:$s.LTE}},kV={message:({keyword:e,schemaCode:t})=>vs.str`must be ${Hc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>vs._`{comparison: ${Hc[e].okStr}, limit: ${t}}`},_V={keyword:Object.keys(Hc),type:"number",schemaType:"number",$data:!0,error:kV,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(vs._`${r} ${Hc[t].fail} ${n} || isNaN(${r})`)}};gj.default=_V});var xj=C(function(bj){Object.defineProperty(bj,"__esModule",{value:!0});var an=$e(),AV={message:({schemaCode:e})=>an.str`must be multiple of ${e}`,params:({schemaCode:e})=>an._`{multipleOf: ${e}}`},OV={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:AV,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),a=i?an._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:an._`${o} !== parseInt(${o})`;e.fail$data(an._`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};bj.default=OV});var wj=C(function(vj){Object.defineProperty(vj,"__esModule",{value:!0});function $j(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}vj.default=$j;$j.code='require("ajv/dist/runtime/ucs2length").default'});var Pj=C(function(Ej){Object.defineProperty(Ej,"__esModule",{value:!0});var or=$e(),Sj=_e(),TV=wj(),IV={message({keyword:e,schemaCode:t}){return or.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>or._`{limit: ${e}}`},MV={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:IV,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?or.operators.GT:or.operators.LT,o=s.opts.unicode===!1?or._`${r}.length`:or._`${Sj.useFunc(e.gen,TV.default)}(${r})`;e.fail$data(or._`${o} ${i} ${n}`)}};Ej.default=MV});var Rj=C(function(_j){Object.defineProperty(_j,"__esModule",{value:!0});var jj=Or(),kj=_e(),Cr=$e(),DV={message:({schemaCode:e})=>Cr.str`must match pattern "${e}"`,params:({schemaCode:e})=>Cr._`{pattern: ${e}}`},LV={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:DV,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"?Cr._`new RegExp`:kj.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,Cr._`${c}(${i}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data(Cr._`!${u}`)}else{let l=jj.usePattern(e,s);e.fail$data(Cr._`!${l}.test(${r})`)}}};_j.default=LV});var Oj=C(function(Aj){Object.defineProperty(Aj,"__esModule",{value:!0});var ln=$e(),qV={message({keyword:e,schemaCode:t}){return ln.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>ln._`{limit: ${e}}`},HV={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:qV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?ln.operators.GT:ln.operators.LT;e.fail$data(ln._`Object.keys(${r}).length ${s} ${n}`)}};Aj.default=HV});var Tj=C(function(Nj){Object.defineProperty(Nj,"__esModule",{value:!0});var cn=Or(),un=$e(),Cj=_e(),BV={message:({params:{missingProperty:e}})=>un.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>un._`{missingProperty: ${e}}`},WV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:BV,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 u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:b}=e.it;for(let h of r)if((m===null||m===void 0?void 0:m[h])===void 0&&!b.has(h)){let y=o.schemaEnv.baseId+o.errSchemaPath,v=`required property "${h}" is not defined at "${y}" (strictRequired)`;Cj.checkStrictMode(o,v,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(un.nil,p);else for(let m of r)cn.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||i){let b=t.let("valid",!0);e.block$data(b,()=>g(m,b)),e.ok(b)}else t.if(cn.checkMissingProp(e,r,m)),cn.reportMissingProp(e,m),t.else()}function p(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(cn.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function g(m,b){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(b,cn.propertyInData(t,s,m,a.ownProperties)),t.if(un.not(b),()=>{e.error(),t.break()})},un.nil)}}};Nj.default=WV});var Mj=C(function(Ij){Object.defineProperty(Ij,"__esModule",{value:!0});var fn=$e(),zV={message({keyword:e,schemaCode:t}){return fn.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>fn._`{limit: ${e}}`},GV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:zV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?fn.operators.GT:fn.operators.LT;e.fail$data(fn._`${r}.length ${s} ${n}`)}};Ij.default=GV});var Vc=C(function(Dj){Object.defineProperty(Dj,"__esModule",{value:!0});var Jj=Rp();Jj.code='require("ajv/dist/runtime/equal").default';Dj.default=Jj});var qj=C(function(Fj){Object.defineProperty(Fj,"__esModule",{value:!0});var oo=ba(),Ne=$e(),Lj=_e(),XV=Vc(),ZV={message:({params:{i:e,j:t}})=>Ne.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ne._`{i: ${e}, j: ${t}}`},QV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:ZV,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?oo.getSchemaTypes(i.items):[];e.block$data(l,u,Ne._`${o} === false`),e.ok(l);function u(){let b=t.let("i",Ne._`${r}.length`),h=t.let("j");e.setParams({i:b,j:h}),t.assign(l,!0),t.if(Ne._`${b} > 1`,()=>(p()?g:m)(b,h))}function p(){return c.length>0&&!c.some((b)=>b==="object"||b==="array")}function g(b,h){let y=t.name("item"),v=oo.checkDataTypes(c,y,a.opts.strictNumbers,oo.DataType.Wrong),k=t.const("indices",Ne._`{}`);t.for(Ne._`;${b}--;`,()=>{if(t.let(y,Ne._`${r}[${b}]`),t.if(v,Ne._`continue`),c.length>1)t.if(Ne._`typeof ${y} == "string"`,Ne._`${y} += "_"`);t.if(Ne._`typeof ${k}[${y}] == "number"`,()=>{t.assign(h,Ne._`${k}[${y}]`),e.error(),t.assign(l,!1).break()}).code(Ne._`${k}[${y}] = ${b}`)})}function m(b,h){let y=Lj.useFunc(t,XV.default),v=t.name("outer");t.label(v).for(Ne._`;${b}--;`,()=>t.for(Ne._`${h} = ${b}; ${h}--;`,()=>t.if(Ne._`${y}(${r}[${b}], ${r}[${h}])`,()=>{e.error(),t.assign(l,!1).break(v)})))}}};Fj.default=QV});var Bj=C(function(Vj){Object.defineProperty(Vj,"__esModule",{value:!0});var ao=$e(),Hj=_e(),t4=Vc(),r4={message:"must be equal to constant",params:({schemaCode:e})=>ao._`{allowedValue: ${e}}`},n4={keyword:"const",$data:!0,error:r4,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;if(n||i&&typeof i=="object")e.fail$data(ao._`!${Hj.useFunc(t,t4.default)}(${r}, ${s})`);else e.fail(ao._`${i} !== ${r}`)}};Vj.default=n4});var zj=C(function(Uj){Object.defineProperty(Uj,"__esModule",{value:!0});var dn=$e(),Wj=_e(),i4=Vc(),o4={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>dn._`{allowedValues: ${e}}`},a4={keyword:"enum",schemaType:"array",$data:!0,error:o4,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=Wj.useFunc(t,i4.default),u;if(a||n)u=t.let("valid"),e.block$data(u,p);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",i);u=dn.or(...s.map((b,h)=>g(m,h)))}e.pass(u);function p(){t.assign(u,!1),t.forOf("v",i,(m)=>t.if(dn._`${c()}(${r}, ${m})`,()=>t.assign(u,!0).break()))}function g(m,b){let h=s[b];return typeof h==="object"&&h!==null?dn._`${c()}(${r}, ${m}[${b}])`:dn._`${r} === ${h}`}}};Uj.default=a4});var Kp=C(function(Gj){Object.defineProperty(Gj,"__esModule",{value:!0});var c4=yj(),u4=xj(),f4=Pj(),d4=Rj(),p4=Oj(),m4=Tj(),h4=Mj(),g4=qj(),y4=Bj(),b4=zj(),x4=[c4.default,u4.default,f4.default,d4.default,p4.default,m4.default,h4.default,g4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},y4.default,b4.default];Gj.default=x4});var Yp=C(function(Yj){Object.defineProperty(Yj,"__esModule",{value:!0});Yj.validateAdditionalItems=void 0;var ar=$e(),lo=_e(),v4={message:({params:{len:e}})=>ar.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>ar._`{limit: ${e}}`},w4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:v4,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){lo.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Kj(e,n)}};function Kj(e,t){let{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;let a=r.const("len",ar._`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(ar._`${a} <= ${t.length}`);else if(typeof n=="object"&&!lo.alwaysValidSchema(o,n)){let c=r.var("valid",ar._`${a} <= ${t.length}`);r.if(ar.not(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:i,dataProp:u,dataPropType:lo.Type.Num},c),!o.allErrors)r.if(ar.not(c),()=>r.break())})}}Yj.validateAdditionalItems=Kj;Yj.default=w4});var Xp=C(function(e1){Object.defineProperty(e1,"__esModule",{value:!0});e1.validateTuple=void 0;var Bc=$e(),ws=_e(),Zj=Or(),E4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Qj(e,"additionalItems",t);if(r.items=!0,ws.alwaysValidSchema(r,t))return;e.ok(Zj.validateArray(e))}};function Qj(e,t,r=e.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=e;if(u(s),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=ws.mergeEvaluated.items(n,r.length,a.items);let l=n.name("valid"),c=n.const("len",Bc._`${i}.length`);r.forEach((p,g)=>{if(ws.alwaysValidSchema(a,p))return;n.if(Bc._`${c} > ${g}`,()=>e.subschema({keyword:o,schemaProp:g,dataProp:g},l)),e.ok(l)});function u(p){let{opts:g,errSchemaPath:m}=a,b=r.length,h=b===p.minItems&&(b===p.maxItems||p[t]===!1);if(g.strictTuples&&!h){let y=`"${o}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;ws.checkStrictMode(a,y,g.strictTuples)}}}e1.validateTuple=Qj;e1.default=E4});var s1=C(function(n1){Object.defineProperty(n1,"__esModule",{value:!0});var r1=Xp(),j4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>r1.validateTuple(e,"items")};n1.default=j4});var c1=C(function(l1){Object.defineProperty(l1,"__esModule",{value:!0});var Wc=$e(),i1=_e(),o1=Or(),a1=Yp(),_4={message:({params:{len:e}})=>Wc.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Wc._`{limit: ${e}}`},R4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_4,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;if(n.items=!0,i1.alwaysValidSchema(n,t))return;if(s)a1.validateAdditionalItems(e,s);else e.ok(o1.validateArray(e))}};l1.default=R4});var f1=C(function(u1){Object.defineProperty(u1,"__esModule",{value:!0});var et=$e(),Ss=_e(),O4={message:({params:{min:e,max:t}})=>t===void 0?et.str`must contain at least ${e} valid item(s)`:et.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?et._`{minContains: ${e}}`:et._`{minContains: ${e}, maxContains: ${t}}`},C4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:O4,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 u=t.const("len",et._`${s}.length`);if(e.setParams({min:o,max:a}),a===void 0&&o===0){Ss.checkStrictMode(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){Ss.checkStrictMode(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Ss.alwaysValidSchema(i,r)){let h=et._`${u} >= ${o}`;if(a!==void 0)h=et._`${h} && ${u} <= ${a}`;e.pass(h);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(et._`${s}.length > 0`,g)}else t.let(p,!1),g();e.result(p,()=>e.reset());function g(){let h=t.name("_valid"),y=t.let("count",0);m(h,()=>t.if(h,()=>b(y)))}function m(h,y){t.forRange("i",0,u,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Ss.Type.Num,compositeRule:!0},h),y()})}function b(h){if(t.code(et._`${h}++`),a===void 0)t.if(et._`${h} >= ${o}`,()=>t.assign(p,!0).break());else if(t.if(et._`${h} > ${a}`,()=>t.assign(p,!1).break()),o===1)t.assign(p,!0);else t.if(et._`${h} >= ${o}`,()=>t.assign(p,!0))}}};u1.default=C4});var Uc=C(function(h1){Object.defineProperty(h1,"__esModule",{value:!0});h1.validateSchemaDeps=h1.validatePropertyDeps=h1.error=void 0;var co=$e(),d1=_e(),pn=Or();h1.error={message:({params:{property:e,depsCount:t,deps:r}})=>co.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>co._`{property: ${e},
606
+ ${v}`);let{extAttrs:ge}=d,pe=ge.indexOf(x),xe=ge.splice(pe,1);ge.length?ge.length===pe?ge[pe-1].tokens.separator=void 0:ge[pe].tokens.name.trivia.trim()||(ge[pe].tokens.name.trivia=xe[0].tokens.name.trivia):ge.tokens.open=ge.tokens.close=void 0}}class yo extends Nr{static parse(d,x,{extMembers:v=[],partial:j}={}){let C={partial:j,base:x};if(C.mixin=d.consume("mixin"),C.mixin)return Nr.parse(d,new yo({source:d.source,tokens:C}),{allowedMembers:[...v,[rs.parse],[Ce],[L.parse,{noInherit:!0}],[I.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class ss extends i{static parse(d){let x={},v=W(new ss({source:d.source,tokens:x}));return v.extAttrs=w.parse(d),x.required=d.consume("required"),v.idlType=se(d,"dictionary-type")||d.error("Dictionary member lacks a type"),x.name=d.consumeKind("identifier")||d.error("Dictionary member lacks a name"),v.default=A.parse(d),x.required&&v.default&&d.error("Required member must not have a default"),x.termination=d.consume(";")||d.error("Unterminated dictionary member, expected `;`"),v.this}get type(){return"field"}get name(){return J(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(d){yield*this.idlType.validate(d)}write(d){let{parent:x}=this;return d.ts.definition(d.ts.wrap([this.extAttrs.write(d),d.token(this.tokens.required),d.ts.type(this.idlType.write(d)),d.name_token(this.tokens.name,{data:this,parent:x}),this.default?this.default.write(d):"",d.token(this.tokens.termination)]),{data:this,parent:x})}}class M extends Nr{static parse(d,{extMembers:x=[],partial:v}={}){let j={partial:v};if(j.base=d.consume("dictionary"),j.base)return Nr.parse(d,new M({source:d.source,tokens:j}),{inheritable:!v,allowedMembers:[...x,[ss.parse]]})}get type(){return"dictionary"}}class H extends Nr{static parse(d,{extMembers:x=[],partial:v}={}){let j={partial:v};if(j.base=d.consume("namespace"),j.base)return Nr.parse(d,new H({source:d.source,tokens:j}),{allowedMembers:[...x,[L.parse,{noInherit:!0,readonly:!0}],[rs.parse],[I.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(d){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:Ee(this)});yield*super.validate(d)}}class U extends Nr{static parse(d,x,{extMembers:v=[]}={}){let j={callback:x};if(j.base=d.consume("interface"),j.base)return Nr.parse(d,new U({source:d.source,tokens:j}),{allowedMembers:[...v,[rs.parse],[I.parse,{regular:!0}]]})}get type(){return"callback interface"}}function le(d,x){let v=d.source;function j(pe){d.error(pe)}function C(...pe){return d.consume(...pe)}function G(pe){let xe=C("interface");if(xe)return yo.parse(d,xe,{...pe,...x?.extensions?.mixin})||ns.parse(d,xe,{...pe,...x?.extensions?.interface})||j("Interface has no proper body")}function ee(){if(x.productions)for(let pe of x.productions){let xe=pe(d);if(xe)return xe}return function(){let pe=C("callback");if(pe)return d.probe("interface")?U.parse(d,pe,{...x?.extensions?.callbackInterface}):mo.parse(d,pe)}()||G()||function(){let pe=C("partial");if(pe)return M.parse(d,{partial:pe,...x?.extensions?.dictionary})||G({partial:pe})||H.parse(d,{partial:pe,...x?.extensions?.namespace})||j("Partial doesn't apply to anything")}()||M.parse(d,x?.extensions?.dictionary)||qt.parse(d)||ts.parse(d)||es.parse(d)||H.parse(d,x?.extensions?.namespace)}let ge=function(){if(!v.length)return[];let pe=[];for(;;){let Te=w.parse(d),Le=ee();if(!Le){Te.length&&j("Stray extended attributes");break}W(Le).extAttrs=Te,pe.push(Le)}let xe=u.parse(d);return x.concrete&&pe.push(xe),pe}();return d.position<v.length&&j("Unrecognised tokens"),ge}function Ne(d,x={}){let v=new $t(d);return x.sourceName!==void 0&&(v.source.name=x.sourceName),le(v,x)}function jt(d){return d}let Gt={wrap:(d)=>d.join(""),trivia:jt,name:jt,reference:jt,type:jt,generic:jt,nameless:jt,inheritance:jt,definition:jt,extendedAttribute:jt,extendedAttributeReference:jt};class tt{constructor(d){this.ts=Object.assign({},Gt,d)}reference(d,{unescaped:x,context:v}){return x||(x=d.startsWith("_")?d.slice(1):d),this.ts.reference(d,x,v)}token(d,x=jt,...v){if(!d)return"";let j=x(d.value,...v);return this.ts.wrap([this.ts.trivia(d.trivia),j])}reference_token(d,x){return this.token(d,this.reference.bind(this),{context:x})}name_token(d,x){return this.token(d,this.ts.name,x)}identifier(d,x){return this.ts.wrap([this.reference_token(d.tokens.value,x),this.token(d.tokens.separator)])}}function we(d,{templates:x=Gt}={}){x=Object.assign({},Gt,x);let v=new tt(x);return x.wrap(d.map((j)=>j.write(v)))}function Kt(d,x){let v=new Map,j=d.filter((C)=>C.type==="includes");for(let C of j){let G=x.get(C.includes);if(!G)continue;let ee=v.get(C.target);ee?ee.push(G):v.set(C.target,[G])}return v}function*kt(d){let x=function(v){let j=new Map,C=new Set,G=new Map;for(let ee of v)if(ee.partial){let ge=G.get(ee.name);ge?ge.push(ee):G.set(ee.name,[ee])}else ee.name&&(j.has(ee.name)?C.add(ee):j.set(ee.name,ee));return{all:v,unique:j,partials:G,duplicates:C,mixinMap:Kt(v,j),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(d);for(let v of x.all)v.validate&&(yield*v.validate(x));yield*function*({unique:v,duplicates:j}){for(let C of j){let{name:G}=C,ee=`The name "${G}" of type "${v.get(G).type}" was already seen`;yield s(C.tokens.name,C,"no-duplicate",ee)}}(x)}function Ct(d){return[...kt((x=d,x.flat?x.flat():[].concat(...x)))];var x}return t})())});var U1=N(function(qse,B1){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",q1=He("fs").promises,vf=He("path"),V1=F1();class W1{constructor(e,t){this.filename=t,this.shortname=vf.basename(t,".idl"),this.path=vf.join(e,t)}async text(){return await q1.readFile(this.path,"utf8")}async parse(){let e=await this.text();return V1.parse(e)}}async function H1({folder:e=__dirname}={}){let t={},r=await q1.readdir(e);for(let n of r)if(n.endsWith(".idl")){let s=new W1(e,n);t[s.shortname]=s}return t}async function $W(e){let t=await H1(e);for(let[r,n]of Object.entries(t))t[r]=await n.parse();return t}B1.exports={listAll:H1,parseAll:$W}});var z1,G1;var K1=D(()=>{z1={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."},G1={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var Y1;var X1=D(()=>{Y1={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 Z1,Q1,eP;var tP=D(()=>{Z1={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Q1={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},eP={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var rP;var nP=D(()=>{rP={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 sP,iP;var oP=D(()=>{sP={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"},iP={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 aP;var lP=D(()=>{aP={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var cP,uP,fP,dP,pP,mP,hP,gP,yP;var bP=D(()=>{cP={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},uP={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},fP={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},dP={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},pP={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},mP={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"},hP={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},gP={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"},yP={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Sf;var xP=D(()=>{Sf={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 $P,wP;var vP=D(()=>{$P={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"},wP={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 SP,EP,PP,jP,kP,Uh;var _P=D(()=>{SP={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},EP={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"},PP={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},jP={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"},kP={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"},Uh={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 AP;var RP=D(()=>{AP={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 OP;var CP=D(()=>{OP={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 NP,TP;var IP=D(()=>{NP={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"}]},TP={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 JP;var MP=D(()=>{JP={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 DP;var LP=D(()=>{DP={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 FP,qP,VP,WP,HP,BP,UP,zP,GP,KP,YP,XP,ZP,QP,ej,tj,rj;var nj=D(()=>{Hp();FP={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"},qP={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."},VP={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."},WP={enum:["!","-"]},HP={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},BP={const:"?:"},UP={const:"switch"},zP={const:"call"},GP={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"]},KP={enum:["=","+=","-=","*=","/="]},YP={enum:["pop","shift"]},XP={enum:["push","unshift"]},ZP={const:"splice"},QP={const:"reduce"},ej={enum:["map","filter"]},tj={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 "+`${cx()}) — 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"},rj={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 sj,ij,oj,aj;var lj=D(()=>{sj={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"}]},ij={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},oj={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},aj={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 wW,zh,Gh,Kh,Yh,Xh,Zh,Qh,eg,tg,cj;var uj=D(()=>{wW=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],zh={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"},Gh={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"},Kh={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"},Yh={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:wW,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"},Xh={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"},Zh={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"},Qh={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"},eg={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"},tg={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"},cj={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 fj;var dj=D(()=>{fj={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 Ef;var pj=D(()=>{Ef={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 vW,rg;var mj=D(()=>{Xi();vW=[301,302,303,307,308],rg={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:lu,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:lu,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:lu,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:[...vW],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 SW(){return hj??=EW(),hj}async function EW(){let[e,t,r]=await Promise.all([yj.listAll(),bj.default.listAll(),xj.default.parseAll()]),n=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)n.add(u.name);let s=[...n].toSorted(),i=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])i.add(u);let o=[...i].toSorted(),a=new Set;for(let c of Object.values(r))for(let u of c){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let p of u.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 PW(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 jW(e){let t={...Sf.properties};for(let r of e)t[r]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function kW(){let{tagExamples:e,cssProps:t,eventHandlers:r}=await SW();return{$defs:{DefsMap:oj,TypeDefEntry:aj,StateMap:ij,StateEntry:sj,TypedStateDef:AP,PureTypeDef:DP,FunctionDef:OP,ClassDef:cj,ClassParameterDef:zh,ClassFieldDef:Gh,ClassConstructorDef:Kh,ClassMethodDef:Yh,FormatDef:Xh,ProjectBlockDef:Zh,ServerBlockDef:Qh,ConnectorBlockDef:eg,StudioHints:tg,ExternalClassDef:JP,ExpressionPointer:FP,ExpressionLiteral:qP,ExpressionOperand:VP,UnaryOperator:WP,BinaryOperator:HP,ConditionalOperator:BP,SwitchOperator:UP,CallOperator:zP,PureMethod:GP,AssignmentOperator:KP,NoArgMethod:YP,OneArgMethod:XP,SpliceMethod:ZP,ReduceMethod:QP,MapFilterMethod:ej,ExpressionNode:tj,ExpressionEntry:rj,Statement:NP,StatementList:TP,ElementDef:{...Uh,properties:{...Uh.properties,...PW(r)}},ChildrenValue:wP,ArrayNamespace:$P,SwitchDef:jP,SwitchNode:kP,StyleObject:{...Sf,properties:jW(t)},AttributesObject:SP,PropsObject:EP,RefObject:gP,AnyRef:hP,InternalRef:cP,StateRef:uP,ExternalRef:fP,ExternalComponentRef:yP,GlobalRef:dP,ParentRef:pP,MapRef:mP,ElementPropertyValue:PP,StringOrRef:Z1,BoolOrRef:Q1,NumberOrRef:eP,CemParameter:sP,CemEvent:iP,TagName:{...Y1,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:z1,ElementTagName:G1,JsonSchemaType:aP,HeadEntry:rP,ImageConfig:Ef,PathsValue:{$id:oo,anyOf:[...Hl,Dh],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:oo,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 _W(){return{$defs:{ImageConfig:Ef,StyleObject:$j},$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:rg.properties,title:"Jx Project",type:"object"}}function AW(){return{$defs:{ImageConfig:Ef,JxFieldSchema:y1,RelationshipRef:b1,StyleObject:$j},$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:rg.properties,title:"Jx Project Core",type:"object"}}function RW(){return{$id:Wl,$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 OW(){return{$id:oo,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...Hl,Dh],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 CW(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...fj}}function ng(){return{$defs:{ClassConstructorDef:Kh,ClassFieldDef:Gh,ClassMethodDef:Yh,ClassParameterDef:zh,ConnectorBlockDef:eg,FormatDef:Xh,ProjectBlockDef:Zh,ServerBlockDef:Qh,StudioHints:tg},$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 NW(e){let{mkdirSync:t,writeFileSync:r}=await import("node:fs"),{resolve:n,dirname:s}=await import("node:path"),i=s(n(e,"..")),o=await kW(),a=_W(),l=ng(),c=AW(),u=CW(),p=RW(),h=OW(),m=JSON.stringify(o,null,2),b=JSON.stringify(a,null,2),g=JSON.stringify(l,null,2),y=JSON.stringify(c,null,2),w=JSON.stringify(u,null,2),P=JSON.stringify(p,null,2),S=JSON.stringify(h,null,2),[E]=process.argv.slice(2);if(E)r(E,m,"utf8"),console.error(`Jx component schema written to ${E}`);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"),P,"utf8"),r(n(i,"schemas","document.paths.schema.json"),S,"utf8"),r(n(i,"extension-manifest.schema.json"),w,"utf8");let k=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(k.exitCode!==0){let A=k.stderr.toString()||k.stdout.toString()||`exit ${k.exitCode}${k.signalCode?`, signal ${k.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${A})`)}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 yj,bj,xj,hj=null,$j,gj,Nie;var wj=D(()=>{K1();X1();tP();nP();oP();lP();bP();xP();vP();_P();RP();CP();IP();MP();LP();nj();lj();uj();dj();bf();pj();mj();yj=gr(I1(),1),bj=gr(L1(),1),xj=gr(U1(),1);$j={...Sf,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,gj]=process.argv,Nie=gj?.endsWith("schema.ts")?NW(gj):void 0});var Yl=N(function(Ej){Object.defineProperty(Ej,"__esModule",{value:!0});Ej.regexpCode=Ej.getEsmExportName=Ej.getProperty=Ej.safeStringify=Ej.stringify=Ej.strConcat=Ej.addCodeArg=Ej.str=Ej._=Ej.nil=Ej._Code=Ej.Name=Ej.IDENTIFIER=Ej._CodeOrName=void 0;class Pf{}Ej._CodeOrName=Pf;Ej.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class ma extends Pf{constructor(e){super();if(!Ej.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}}}Ej.Name=ma;class $n extends Pf{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 ma)t[r.str]=(t[r.str]||0)+1;return t},{})}}Ej._Code=$n;Ej.nil=new $n("");function vj(e,...t){let r=[e[0]],n=0;while(n<t.length)ig(r,t[n]),r.push(e[++n]);return new $n(r)}Ej._=vj;var sg=new $n("+");function Sj(e,...t){let r=[Kl(e[0])],n=0;while(n<t.length)r.push(sg),ig(r,t[n]),r.push(sg,Kl(e[++n]));return TW(r),new $n(r)}Ej.str=Sj;function ig(e,t){if(t instanceof $n)e.push(...t._items);else if(t instanceof ma)e.push(t);else e.push(MW(t))}Ej.addCodeArg=ig;function TW(e){let t=1;while(t<e.length-1){if(e[t]===sg){let r=IW(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function IW(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof ma||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 ma))return`"${e}${t.slice(1)}`;return}function JW(e,t){return t.emptyStr()?e:e.emptyStr()?t:Sj`${e}${t}`}Ej.strConcat=JW;function MW(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Kl(Array.isArray(e)?e.join(","):e)}function DW(e){return new $n(Kl(e))}Ej.stringify=DW;function Kl(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ej.safeStringify=Kl;function LW(e){return typeof e=="string"&&Ej.IDENTIFIER.test(e)?new $n(`.${e}`):vj`[${e}]`}Ej.getProperty=LW;function FW(e){if(typeof e=="string"&&Ej.IDENTIFIER.test(e))return new $n(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Ej.getEsmExportName=FW;function qW(e){return new $n(e.toString())}Ej.regexpCode=qW});var cg=N(function(_j){Object.defineProperty(_j,"__esModule",{value:!0});_j.ValueScope=_j.ValueScopeName=_j.Scope=_j.varKinds=_j.UsedValueState=void 0;var Ke=Yl();class jj extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var kf;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(kf||(_j.UsedValueState=kf={}));_j.varKinds={const:new Ke.Name("const"),let:new Ke.Name("let"),var:new Ke.Name("var")};class ag{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ke.Name?e:this.name(e)}name(e){return new Ke.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}}}_j.Scope=ag;class lg extends Ke.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ke._`.${new Ke.Name(t)}[${r}]`}}_j.ValueScopeName=lg;var eH=Ke._`\n`;class kj extends ag{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?eH:Ke.nil}}get(){return this._scope}name(e){return new lg(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 Ke._`${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=Ke.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,kf.Started);let c=t(l);if(c){let u=this.opts.es5?_j.varKinds.var:_j.varKinds.const;s=Ke._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(l))s=Ke._`${s}${c}${this.opts._n}`;else throw new jj(l);a.set(l,kf.Completed)})}return s}}_j.ValueScope=kj});var $e=N(function(jr){Object.defineProperty(jr,"__esModule",{value:!0});jr.or=jr.and=jr.not=jr.CodeGen=jr.operators=jr.varKinds=jr.ValueScopeName=jr.ValueScope=jr.Scope=jr.Name=jr.regexpCode=jr.stringify=jr.getProperty=jr.nil=jr.strConcat=jr.str=jr._=void 0;var Z=Yl(),mt=cg(),si=Yl();Object.defineProperty(jr,"_",{enumerable:!0,get:function(){return si._}});Object.defineProperty(jr,"str",{enumerable:!0,get:function(){return si.str}});Object.defineProperty(jr,"strConcat",{enumerable:!0,get:function(){return si.strConcat}});Object.defineProperty(jr,"nil",{enumerable:!0,get:function(){return si.nil}});Object.defineProperty(jr,"getProperty",{enumerable:!0,get:function(){return si.getProperty}});Object.defineProperty(jr,"stringify",{enumerable:!0,get:function(){return si.stringify}});Object.defineProperty(jr,"regexpCode",{enumerable:!0,get:function(){return si.regexpCode}});Object.defineProperty(jr,"Name",{enumerable:!0,get:function(){return si.Name}});var Nf=cg();Object.defineProperty(jr,"Scope",{enumerable:!0,get:function(){return Nf.Scope}});Object.defineProperty(jr,"ValueScope",{enumerable:!0,get:function(){return Nf.ValueScope}});Object.defineProperty(jr,"ValueScopeName",{enumerable:!0,get:function(){return Nf.ValueScopeName}});Object.defineProperty(jr,"varKinds",{enumerable:!0,get:function(){return Nf.varKinds}});jr.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};class ii{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Rj extends ii{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?mt.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=ga(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class dg extends ii{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 Z.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=ga(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return Cf(e,this.rhs)}}class Oj extends dg{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Cj extends ii{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Nj extends ii{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Tj extends ii{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Ij extends ii{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=ga(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class Tf extends ii{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;sH(e,s.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ao(e,t.names),{})}}class oi extends Tf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Jj extends Tf{}class Xl extends oi{}Xl.kind="else";class As extends oi{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 Xl(r):r}if(t){if(e===!1)return t instanceof As?t:t.nodes;if(this.nodes.length)return this;return new As(qj(e),t instanceof As?[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=ga(this.condition,e,t),this}get names(){let e=super.names;if(Cf(e,this.condition),this.else)ao(e,this.else.names);return e}}As.kind="if";class ha extends oi{}ha.kind="for";class Mj extends ha{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=ga(this.iteration,e,t),this}get names(){return ao(super.names,this.iteration.names)}}class Dj extends ha{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?mt.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=Cf(super.names,this.from);return Cf(e,this.to)}}class ug extends ha{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=ga(this.iterable,e,t),this}get names(){return ao(super.names,this.iterable.names)}}class _f extends oi{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)}}_f.kind="func";class Af extends Tf{render(e){return"return "+super.render(e)}}Af.kind="return";class Lj extends oi{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)ao(e,this.catch.names);if(this.finally)ao(e,this.finally.names);return e}}class Rf extends oi{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Rf.kind="catch";class Of extends oi{render(e){return"finally"+super.render(e)}}Of.kind="finally";class Fj{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
607
+ `:""},this._extScope=e,this._scope=new mt.Scope({parent:e}),this._nodes=[new Jj]}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 Rj(e,s,r)),s}const(e,t,r){return this._def(mt.varKinds.const,e,t,r)}let(e,t,r){return this._def(mt.varKinds.let,e,t,r)}var(e,t,r){return this._def(mt.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new dg(e,t,r))}add(e,t){return this._leafNode(new Oj(e,jr.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new Ij(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(":"),Z.addCodeArg(t,n)}return t.push("}"),new Z._Code(t)}if(e,t,r){if(this._blockNode(new As(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 As(e))}else(){return this._elseNode(new Xl)}endIf(){return this._endBlockNode(As,Xl)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new Mj(e),t)}forRange(e,t,r,n,s=this.opts.es5?mt.varKinds.var:mt.varKinds.let){let i=this._scope.toName(e);return this._for(new Dj(s,i,t,r),()=>n(i))}forOf(e,t,r,n=mt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=t instanceof Z.Name?t:this.var("_arr",t);return this.forRange("_i",0,Z._`${i}.length`,(o)=>{this.var(s,Z._`${i}[${o}]`),r(s)})}return this._for(new ug("of",n,s,t),()=>r(s))}forIn(e,t,r,n=this.opts.es5?mt.varKinds.var:mt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Z._`Object.keys(${t})`,r);let s=this._scope.toName(e);return this._for(new ug("in",n,s,t),()=>r(s))}endFor(){return this._endBlockNode(ha)}label(e){return this._leafNode(new Cj(e))}break(e){return this._leafNode(new Nj(e))}return(e){let t=new Af;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Af)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new Lj;if(this._blockNode(n),this.code(e),t){let s=this.name("e");this._currNode=n.catch=new Rf(s),t(s)}if(r)this._currNode=n.finally=new Of,this.code(r);return this._endBlockNode(Rf,Of)}throw(e){return this._leafNode(new Tj(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=Z.nil,r,n){if(this._blockNode(new _f(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(_f)}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 As))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}}jr.CodeGen=Fj;function ao(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Cf(e,t){return t instanceof Z._CodeOrName?ao(e,t.names):e}function ga(e,t,r){if(e instanceof Z.Name)return n(e);if(!s(e))return e;return new Z._Code(e._items.reduce((i,o)=>{if(o instanceof Z.Name)o=n(o);if(o instanceof Z._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 Z._Code&&i._items.some((o)=>o instanceof Z.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function sH(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function qj(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${fg(e)}`}jr.not=qj;var iH=Vj(jr.operators.AND);function oH(...e){return e.reduce(iH)}jr.and=oH;var aH=Vj(jr.operators.OR);function lH(...e){return e.reduce(aH)}jr.or=lH;function Vj(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:Z._`${fg(t)} ${e} ${fg(r)}`}function fg(e){return e instanceof Z.Name?e:Z._`(${e})`}});var Oe=N(function(Zj){Object.defineProperty(Zj,"__esModule",{value:!0});Zj.checkStrictMode=Zj.getErrorPath=Zj.Type=Zj.useFunc=Zj.setEvaluated=Zj.evaluatedPropsToName=Zj.mergeEvaluated=Zj.eachItem=Zj.unescapeJsonPointer=Zj.escapeJsonPointer=Zj.escapeFragment=Zj.unescapeFragment=Zj.schemaRefOrVal=Zj.schemaHasRulesButRef=Zj.schemaHasRules=Zj.checkUnknownRules=Zj.alwaysValidSchema=Zj.toHash=void 0;var fe=$e(),Uj=Yl();function dH(e){let t={};for(let r of e)t[r]=!0;return t}Zj.toHash=dH;function pH(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return zj(e,t),!Gj(t,e.self.RULES.all)}Zj.alwaysValidSchema=pH;function zj(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])Xj(e,`unknown keyword: "${i}"`)}Zj.checkUnknownRules=zj;function Gj(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Zj.schemaHasRules=Gj;function mH(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Zj.schemaHasRulesButRef=mH;function hH({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return fe._`${r}`}return fe._`${e}${t}${fe.getProperty(n)}`}Zj.schemaRefOrVal=hH;function gH(e){return Kj(decodeURIComponent(e))}Zj.unescapeFragment=gH;function yH(e){return encodeURIComponent(mg(e))}Zj.escapeFragment=yH;function mg(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Zj.escapeJsonPointer=mg;function Kj(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Zj.unescapeJsonPointer=Kj;function bH(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Zj.eachItem=bH;function Hj({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let l=o===void 0?i:o instanceof fe.Name?(i instanceof fe.Name?e(s,i,o):t(s,i,o),o):i instanceof fe.Name?(t(s,o,i),i):r(i,o);return a===fe.Name&&!(l instanceof fe.Name)?n(s,l):l}}Zj.mergeEvaluated={props:Hj({mergeNames:(e,t,r)=>e.if(fe._`${r} !== true && ${t} !== undefined`,()=>{e.if(fe._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,fe._`${r} || {}`).code(fe._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(fe._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,fe._`${r} || {}`),hg(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Yj}),items:Hj({mergeNames:(e,t,r)=>e.if(fe._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,fe._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(fe._`${r} !== true`,()=>e.assign(r,t===!0?!0:fe._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Yj(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",fe._`{}`);if(t!==void 0)hg(e,r,t);return r}Zj.evaluatedPropsToName=Yj;function hg(e,t,r){Object.keys(r).forEach((n)=>e.assign(fe._`${t}${fe.getProperty(n)}`,!0))}Zj.setEvaluated=hg;var Bj={};function xH(e,t){return e.scopeValue("func",{ref:t,code:Bj[t.code]||(Bj[t.code]=new Uj._Code(t.code))})}Zj.useFunc=xH;var pg;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(pg||(Zj.Type=pg={}));function $H(e,t,r){if(e instanceof fe.Name){let n=t===pg.Num;return r?n?fe._`"[" + ${e} + "]"`:fe._`"['" + ${e} + "']"`:n?fe._`"/" + ${e}`:fe._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?fe.getProperty(e).toString():"/"+mg(e)}Zj.getErrorPath=$H;function Xj(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Zj.checkStrictMode=Xj});var tn=N(function(ek){Object.defineProperty(ek,"__esModule",{value:!0});var Ve=$e(),DH={data:new Ve.Name("data"),valCxt:new Ve.Name("valCxt"),instancePath:new Ve.Name("instancePath"),parentData:new Ve.Name("parentData"),parentDataProperty:new Ve.Name("parentDataProperty"),rootData:new Ve.Name("rootData"),dynamicAnchors:new Ve.Name("dynamicAnchors"),vErrors:new Ve.Name("vErrors"),errors:new Ve.Name("errors"),this:new Ve.Name("this"),self:new Ve.Name("self"),scope:new Ve.Name("scope"),json:new Ve.Name("json"),jsonPos:new Ve.Name("jsonPos"),jsonLen:new Ve.Name("jsonLen"),jsonPart:new Ve.Name("jsonPart")};ek.default=DH});var Zl=N(function(sk){Object.defineProperty(sk,"__esModule",{value:!0});sk.extendErrors=sk.resetErrorsCount=sk.reportExtraError=sk.reportError=sk.keyword$DataError=sk.keywordError=void 0;var ne=$e(),ai=Oe(),dr=tn();sk.keywordError={message:({keyword:e})=>ne.str`must pass "${e}" keyword validation`};sk.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ne.str`"${e}" keyword must be ${t} ($data)`:ne.str`"${e}" keyword is invalid ($data)`};function FH(e,t=sk.keywordError,r,n){let{it:s}=e,{gen:i,compositeRule:o,allErrors:a}=s,l=nk(e,t,r);if(n!==null&&n!==void 0?n:o||a)tk(i,l);else rk(s,ne._`[${l}]`)}sk.reportError=FH;function qH(e,t=sk.keywordError,r){let{it:n}=e,{gen:s,compositeRule:i,allErrors:o}=n,a=nk(e,t,r);if(tk(s,a),!(i||o))rk(n,dr.default.vErrors)}sk.reportExtraError=qH;function VH(e,t){e.assign(dr.default.errors,t),e.if(ne._`${dr.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${dr.default.vErrors}.length`,t),()=>e.assign(dr.default.vErrors,null)))}sk.resetErrorsCount=VH;function WH({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,dr.default.errors,(a)=>{if(e.const(o,ne._`${dr.default.vErrors}[${a}]`),e.if(ne._`${o}.instancePath === undefined`,()=>e.assign(ne._`${o}.instancePath`,ne.strConcat(dr.default.instancePath,i.errorPath))),e.assign(ne._`${o}.schemaPath`,ne.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(ne._`${o}.schema`,r),e.assign(ne._`${o}.data`,n)})}sk.extendErrors=WH;function tk(e,t){let r=e.const("err",t);e.if(ne._`${dr.default.vErrors} === null`,()=>e.assign(dr.default.vErrors,ne._`[${r}]`),ne._`${dr.default.vErrors}.push(${r})`),e.code(ne._`${dr.default.errors}++`)}function rk(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;if(s.$async)r.throw(ne._`new ${e.ValidationError}(${t})`);else r.assign(ne._`${n}.errors`,t),r.return(!1)}var lo={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function nk(e,t,r){let{createErrors:n}=e.it;if(n===!1)return ne._`{}`;return HH(e,t,r)}function HH(e,t,r={}){let{gen:n,it:s}=e,i=[BH(s,r),UH(e,r)];return zH(e,t,i),n.object(...i)}function BH({errorPath:e},{instancePath:t}){let r=t?ne.str`${e}${ai.getErrorPath(t,ai.Type.Str)}`:e;return[dr.default.instancePath,ne.strConcat(dr.default.instancePath,r)]}function UH({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:ne.str`${t}/${e}`;if(r)s=ne.str`${s}${ai.getErrorPath(r,ai.Type.Str)}`;return[lo.schemaPath,s]}function zH(e,{params:t,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:p}=a;if(n.push([lo.keyword,s],[lo.params,typeof t=="function"?t(e):t||ne._`{}`]),l.messages)n.push([lo.message,typeof r=="function"?r(e):r]);if(l.verbose)n.push([lo.schema,o],[lo.parentSchema,ne._`${u}${p}`],[dr.default.data,i]);if(c)n.push([lo.propertyName,c])}});var fk=N(function(ck){Object.defineProperty(ck,"__esModule",{value:!0});ck.boolOrEmptySchema=ck.topBoolOrEmptySchema=void 0;var ok=Zl(),ak=$e(),ZH=tn(),QH={message:"boolean schema is false"};function eB(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)lk(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(ZH.default.data);else t.assign(ak._`${n}.errors`,null),t.return(!0)}ck.topBoolOrEmptySchema=eB;function tB(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),lk(e);else r.var(t,!0)}ck.boolOrEmptySchema=tB;function lk(e,t){let{gen:r,data:n}=e;ok.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},QH,void 0,t)}});var yg=N(function(dk){Object.defineProperty(dk,"__esModule",{value:!0});dk.getRules=dk.isJSONType=void 0;var nB=["string","number","integer","boolean","null","object","array"],sB=new Set(nB);function iB(e){return typeof e=="string"&&sB.has(e)}dk.isJSONType=iB;function oB(){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:{}}}dk.getRules=oB});var bg=N(function(gk){Object.defineProperty(gk,"__esModule",{value:!0});gk.shouldUseRule=gk.shouldUseGroup=gk.schemaHasRulesForType=void 0;function lB({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&mk(e,n)}gk.schemaHasRulesForType=lB;function mk(e,t){return t.rules.some((r)=>hk(e,r))}gk.shouldUseGroup=mk;function hk(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))}gk.shouldUseRule=hk});var Ql=N(function(Sk){Object.defineProperty(Sk,"__esModule",{value:!0});Sk.reportTypeError=Sk.checkDataTypes=Sk.checkDataType=Sk.coerceAndCheckDataType=Sk.getJSONTypes=Sk.getSchemaTypes=Sk.DataType=void 0;var bk=yg(),xk=bg(),$k=Zl(),z=$e(),Jf=Oe(),ya;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ya||(Sk.DataType=ya={}));function fB(e){let t=wk(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}Sk.getSchemaTypes=fB;function wk(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(bk.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Sk.getJSONTypes=wk;function dB(e,t){let{gen:r,data:n,opts:s}=e,i=pB(t,s.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&xk.schemaHasRulesForType(e,t[0]));if(o){let a=$g(t,n,s.strictNumbers,ya.Wrong);r.if(a,()=>{if(i.length)mB(e,t,i);else wg(e)})}return o}Sk.coerceAndCheckDataType=dB;var vk=new Set(["string","number","integer","boolean","null"]);function pB(e,t){return t?e.filter((r)=>vk.has(r)||t==="array"&&r==="array"):[]}function mB(e,t,r){let{gen:n,data:s,opts:i}=e,o=n.let("dataType",z._`typeof ${s}`),a=n.let("coerced",z._`undefined`);if(i.coerceTypes==="array")n.if(z._`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,z._`${s}[0]`).assign(o,z._`typeof ${s}`).if($g(t,s,i.strictNumbers),()=>n.assign(a,s)));n.if(z._`${a} !== undefined`);for(let c of r)if(vk.has(c)||c==="array"&&i.coerceTypes==="array")l(c);n.else(),wg(e),n.endIf(),n.if(z._`${a} !== undefined`,()=>{n.assign(s,a),hB(e,a)});function l(c){switch(c){case"string":n.elseIf(z._`${o} == "number" || ${o} == "boolean"`).assign(a,z._`"" + ${s}`).elseIf(z._`${s} === null`).assign(a,z._`""`);return;case"number":n.elseIf(z._`${o} == "boolean" || ${s} === null
608
+ || (${o} == "string" && ${s} && ${s} == +${s})`).assign(a,z._`+${s}`);return;case"integer":n.elseIf(z._`${o} === "boolean" || ${s} === null
609
+ || (${o} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,z._`+${s}`);return;case"boolean":n.elseIf(z._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(z._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf(z._`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf(z._`${o} === "string" || ${o} === "number"
610
+ || ${o} === "boolean" || ${s} === null`).assign(a,z._`[${s}]`)}}}function hB({gen:e,parentData:t,parentDataProperty:r},n){e.if(z._`${t} !== undefined`,()=>e.assign(z._`${t}[${r}]`,n))}function xg(e,t,r,n=ya.Correct){let s=n===ya.Correct?z.operators.EQ:z.operators.NEQ,i;switch(e){case"null":return z._`${t} ${s} null`;case"array":i=z._`Array.isArray(${t})`;break;case"object":i=z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o(z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return z._`typeof ${t} ${s} ${e}`}return n===ya.Correct?i:z.not(i);function o(a=z.nil){return z.and(z._`typeof ${t} == "number"`,a,r?z._`isFinite(${t})`:z.nil)}}Sk.checkDataType=xg;function $g(e,t,r,n){if(e.length===1)return xg(e[0],t,r,n);let s,i=Jf.toHash(e);if(i.array&&i.object){let o=z._`typeof ${t} != "object"`;s=i.null?o:z._`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else s=z.nil;if(i.number)delete i.integer;for(let o in i)s=z.and(s,xg(o,t,r,n));return s}Sk.checkDataTypes=$g;var gB={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?z._`{type: ${e}}`:z._`{type: ${t}}`};function wg(e){let t=yB(e);$k.reportError(t,gB)}Sk.reportTypeError=wg;function yB(e){let{gen:t,data:r,schema:n}=e,s=Jf.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var Ak=N(function(kk){Object.defineProperty(kk,"__esModule",{value:!0});kk.assignDefaults=void 0;var rn=$e(),jk=Oe();function EB(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)Pk(e,s,r[s].default);else if(t==="array"&&Array.isArray(n))n.forEach((s,i)=>Pk(e,i,s.default))}kk.assignDefaults=EB;function Pk(e,t,r){let{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;let a=rn._`${i}${rn.getProperty(t)}`;if(s){jk.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=rn._`${a} === undefined`;if(o.useDefaults==="empty")l=rn._`${l} || ${a} === null || ${a} === ""`;n.if(l,rn._`${a} = ${rn.stringify(r)}`)}});var nn=N(function(Nk){Object.defineProperty(Nk,"__esModule",{value:!0});Nk.validateUnion=Nk.validateArray=Nk.usePattern=Nk.callValidateCode=Nk.schemaProperties=Nk.allSchemaProperties=Nk.noPropertyInData=Nk.propertyInData=Nk.isOwnProperty=Nk.hasPropFunc=Nk.reportMissingProp=Nk.checkMissingProp=Nk.checkReportMissingProp=void 0;var he=$e(),ba=Oe(),li=tn(),Rk=Oe();function PB(e,t){let{gen:r,data:n,it:s}=e;r.if(Sg(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}Nk.checkReportMissingProp=PB;function jB({gen:e,data:t,it:{opts:r}},n,s){return he.or(...n.map((i)=>he.and(Sg(e,t,i,r.ownProperties),he._`${s} = ${i}`)))}Nk.checkMissingProp=jB;function kB(e,t){e.setParams({missingProperty:t},!0),e.error()}Nk.reportMissingProp=kB;function Ok(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}Nk.hasPropFunc=Ok;function vg(e,t,r){return he._`${Ok(e)}.call(${t}, ${r})`}Nk.isOwnProperty=vg;function _B(e,t,r,n){let s=he._`${t}${he.getProperty(r)} !== undefined`;return n?he._`${s} && ${vg(e,t,r)}`:s}Nk.propertyInData=_B;function Sg(e,t,r,n){let s=he._`${t}${he.getProperty(r)} === undefined`;return n?he.or(s,he.not(vg(e,t,r))):s}Nk.noPropertyInData=Sg;function Ck(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Nk.allSchemaProperties=Ck;function AB(e,t){return Ck(t).filter((r)=>!ba.alwaysValidSchema(e,t[r]))}Nk.schemaProperties=AB;function RB({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,l,c){let u=c?he._`${e}, ${t}, ${n}${s}`:t,p=[[li.default.instancePath,he.strConcat(li.default.instancePath,i)],[li.default.parentData,o.parentData],[li.default.parentDataProperty,o.parentDataProperty],[li.default.rootData,li.default.rootData]];if(o.opts.dynamicRef)p.push([li.default.dynamicAnchors,li.default.dynamicAnchors]);let h=he._`${u}, ${r.object(...p)}`;return l!==he.nil?he._`${a}.call(${l}, ${h})`:he._`${a}(${h})`}Nk.callValidateCode=RB;var OB=he._`new RegExp`;function CB({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"?OB:Rk.useFunc(e,s)}(${r}, ${n})`})}Nk.usePattern=CB;function NB(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:ba.Type.Num},i),t.if(he.not(i),a)})}}Nk.validateArray=NB;function TB(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((l)=>ba.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let o=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let u=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(o,he._`${o} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}Nk.validateUnion=TB});var qk=N(function(Lk){Object.defineProperty(Lk,"__esModule",{value:!0});Lk.validateKeywordUsage=Lk.validSchemaType=Lk.funcKeywordCode=Lk.macroKeywordCode=void 0;var Be=$e(),co=tn(),Jk=nn(),Mk=Zl();function zB(e,t){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,a=t.macro.call(o.self,s,i,o),l=Dk(r,n,a);if(o.opts.validateSchema!==!1)o.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:Be.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}Lk.macroKeywordCode=zB;function GB(e,t){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:l}=e;YB(l,t);let c=!a&&t.compile?t.compile.call(l.self,i,o,l):t.validate,u=Dk(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)Ik(e);y(()=>e.error())}else{let w=t.async?m():b();if(t.modifying)Ik(e);y(()=>KB(e,w))}}function m(){let w=n.let("ruleErrs",null);return n.try(()=>g(Be._`await `),(P)=>n.assign(p,!1).if(Be._`${P} instanceof ${l.ValidationError}`,()=>n.assign(w,Be._`${P}.errors`),()=>n.throw(P))),w}function b(){let w=Be._`${u}.errors`;return n.assign(w,null),g(Be.nil),w}function g(w=t.async?Be._`await `:Be.nil){let P=l.opts.passContext?co.default.this:co.default.self,S=!(("compile"in t)&&!a||t.schema===!1);n.assign(p,Be._`${w}${Jk.callValidateCode(e,u,P,S)}`,t.modifying)}function y(w){var P;n.if(Be.not((P=t.valid)!==null&&P!==void 0?P:p),w)}}Lk.funcKeywordCode=GB;function Ik(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Be._`${n.parentData}[${n.parentDataProperty}]`))}function KB(e,t){let{gen:r}=e;r.if(Be._`Array.isArray(${t})`,()=>{r.assign(co.default.vErrors,Be._`${co.default.vErrors} === null ? ${t} : ${co.default.vErrors}.concat(${t})`).assign(co.default.errors,Be._`${co.default.vErrors}.length`),Mk.extendErrors(e)},()=>e.error())}function YB({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Dk(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:Be.stringify(r)})}function XB(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")}Lk.validSchemaType=XB;function ZB({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)}}}Lk.validateKeywordUsage=ZB});var Hk=N(function(Vk){Object.defineProperty(Vk,"__esModule",{value:!0});Vk.extendSubschemaMode=Vk.extendSubschemaData=Vk.getSubschema=void 0;var Rt=$e(),Mf=Oe();function rU(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:Rt._`${e.schemaPath}${Rt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}${Rt.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${Mf.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')}Vk.getSubschema=rU;function nU(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:u,opts:p}=t,h=a.let("data",Rt._`${t.data}${Rt.getProperty(r)}`,!0);l(h),e.errorPath=Rt.str`${c}${Mf.getErrorPath(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=Rt._`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Rt.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]}}Vk.extendSubschemaData=nU;function sU(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}Vk.extendSubschemaMode=sU});var Eg=N(function(aoe,Bk){Bk.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 zk=N(function(loe,Uk){var ci=Uk.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(){};Df(t,n,s,e,"",e)};ci.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ci.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ci.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ci.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 Df(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 u in n){var p=n[u];if(Array.isArray(p)){if(u in ci.arrayKeywords)for(var h=0;h<p.length;h++)Df(e,t,r,p[h],s+"/"+u+"/"+h,i,s,u,n,h)}else if(u in ci.propsKeywords){if(p&&typeof p=="object")for(var m in p)Df(e,t,r,p[m],s+"/"+u+"/"+aU(m),i,s,u,n,m)}else if(u in ci.keywords||e.allKeys&&!(u in ci.skipKeywords))Df(e,t,r,p,s+"/"+u,i,s,u,n)}r(n,s,i,o,a,l,c)}}function aU(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ec=N(function(Zk){Object.defineProperty(Zk,"__esModule",{value:!0});Zk.getSchemaRefs=Zk.resolveUrl=Zk.normalizeId=Zk._getFullPath=Zk.getFullPath=Zk.inlineRef=void 0;var Gk=Oe(),lU=Eg(),cU=zk(),uU=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function fU(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Pg(e);if(!t)return!1;return Kk(e)<=t}Zk.inlineRef=fU;var dU=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Pg(e){for(let t in e){if(dU.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Pg))return!0;if(typeof r=="object"&&Pg(r))return!0}return!1}function Kk(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,uU.has(r))continue;if(typeof e[r]=="object")Gk.eachItem(e[r],(n)=>t+=Kk(n));if(t===1/0)return 1/0}return t}function Yk(e,t="",r){if(r!==!1)t=xa(t);let n=e.parse(t);return Xk(e,n)}Zk.getFullPath=Yk;function Xk(e,t){return e.serialize(t).split("#")[0]+"#"}Zk._getFullPath=Xk;var pU=/#\/?$/;function xa(e){return e?e.replace(pU,""):""}Zk.normalizeId=xa;function mU(e,t,r){return r=xa(r),e.resolve(t,r)}Zk.resolveUrl=mU;var hU=/^[a-z_][-a-z0-9._]*$/i;function gU(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=xa(e[r]||t),i={"":s},o=Yk(n,s,!1),a={},l=new Set;return cU(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=w.call(this,p[r]);P.call(this,p.$anchor),P.call(this,p.$dynamicAnchor),i[h]=y;function w(S){let E=this.opts.uriResolver.resolve;if(S=xa(y?E(y,S):S),l.has(S))throw u(S);l.add(S);let k=this.refs[S];if(typeof k=="string")k=this.refs[k];if(typeof k=="object")c(p,k.schema,S);else if(S!==xa(g))if(S[0]==="#")c(p,a[S],S),a[S]=p;else this.refs[S]=g;return S}function P(S){if(typeof S=="string"){if(!hU.test(S))throw Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),a;function c(p,h,m){if(h!==void 0&&!lU(p,h))throw u(m)}function u(p){return Error(`reference "${p}" resolves to more than one schema`)}}Zk.getSchemaRefs=gU});var va=N(function(m_){Object.defineProperty(m_,"__esModule",{value:!0});m_.getData=m_.KeywordCxt=m_.validateFunctionCode=void 0;var Ff=fk(),Lf=Ql(),wa=bg(),ui=Ql(),n_=Ak(),Fn=qk(),$a=Hk(),q=$e(),be=tn(),s_=ec(),Ft=Oe(),Ln=Zl();function vU(e){if(a_(e)){if(l_(e),o_(e)){PU(e);return}}i_(e,()=>Ff.topBoolOrEmptySchema(e))}m_.validateFunctionCode=vU;function i_({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){if(s.code.es5)e.func(t,q._`${be.default.data}, ${be.default.valCxt}`,n.$async,()=>{e.code(q._`"use strict"; ${e_(r,s)}`),EU(e,s),e.code(i)});else e.func(t,q._`${be.default.data}, ${SU(s)}`,n.$async,()=>e.code(e_(r,s)).code(i))}function SU(e){return q._`{${be.default.instancePath}="", ${be.default.parentData}, ${be.default.parentDataProperty}, ${be.default.rootData}=${be.default.data}${e.dynamicRef?q._`, ${be.default.dynamicAnchors}={}`:q.nil}}={}`}function EU(e,t){e.if(be.default.valCxt,()=>{if(e.var(be.default.instancePath,q._`${be.default.valCxt}.${be.default.instancePath}`),e.var(be.default.parentData,q._`${be.default.valCxt}.${be.default.parentData}`),e.var(be.default.parentDataProperty,q._`${be.default.valCxt}.${be.default.parentDataProperty}`),e.var(be.default.rootData,q._`${be.default.valCxt}.${be.default.rootData}`),t.dynamicRef)e.var(be.default.dynamicAnchors,q._`${be.default.valCxt}.${be.default.dynamicAnchors}`)},()=>{if(e.var(be.default.instancePath,q._`""`),e.var(be.default.parentData,q._`undefined`),e.var(be.default.parentDataProperty,q._`undefined`),e.var(be.default.rootData,be.default.data),t.dynamicRef)e.var(be.default.dynamicAnchors,q._`{}`)})}function PU(e){let{schema:t,opts:r,gen:n}=e;i_(e,()=>{if(r.$comment&&t.$comment)u_(e);if(RU(e),n.let(be.default.vErrors,null),n.let(be.default.errors,0),r.unevaluated)jU(e);c_(e),NU(e)});return}function jU(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",q._`${r}.evaluated`),t.if(q._`${e.evaluated}.dynamicProps`,()=>t.assign(q._`${e.evaluated}.props`,q._`undefined`)),t.if(q._`${e.evaluated}.dynamicItems`,()=>t.assign(q._`${e.evaluated}.items`,q._`undefined`))}function e_(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?q._`/*# sourceURL=${r} */`:q.nil}function kU(e,t){if(a_(e)){if(l_(e),o_(e)){_U(e,t);return}}Ff.boolOrEmptySchema(e,t)}function o_({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 a_(e){return typeof e.schema!="boolean"}function _U(e,t){let{schema:r,gen:n,opts:s}=e;if(s.$comment&&r.$comment)u_(e);OU(e),CU(e);let i=n.const("_errs",be.default.errors);c_(e,i),n.var(t,q._`${i} === ${be.default.errors}`)}function l_(e){Ft.checkUnknownRules(e),AU(e)}function c_(e,t){if(e.opts.jtd)return t_(e,[],!1,t);let r=Lf.getSchemaTypes(e.schema),n=Lf.coerceAndCheckDataType(e,r);t_(e,r,!n,t)}function AU(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&Ft.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function RU(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Ft.checkStrictMode(e,"default is ignored in the schema root")}function OU(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=s_.resolveUrl(e.opts.uriResolver,e.baseId,t)}function CU(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function u_({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)e.code(q._`${be.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=q.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(q._`${be.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function NU(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;if(r.$async)t.if(q._`${be.default.errors} === 0`,()=>t.return(be.default.data),()=>t.throw(q._`new ${s}(${be.default.vErrors})`));else{if(t.assign(q._`${n}.errors`,be.default.vErrors),i.unevaluated)TU(e);t.return(q._`${be.default.errors} === 0`)}}function TU({gen:e,evaluated:t,props:r,items:n}){if(r instanceof q.Name)e.assign(q._`${t}.props`,r);if(n instanceof q.Name)e.assign(q._`${t}.items`,n)}function t_(e,t,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!Ft.schemaHasRulesButRef(i,u))){s.block(()=>d_(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)IU(e,t);s.block(()=>{for(let h of u.rules)p(h);p(u.post)});function p(h){if(!wa.shouldUseGroup(i,h))return;if(h.type){if(s.if(ui.checkDataType(h.type,o,l.strictNumbers)),r_(e,h),t.length===1&&t[0]===h.type&&r)s.else(),ui.reportTypeError(e);s.endIf()}else r_(e,h);if(!a)s.if(q._`${be.default.errors} === ${n||0}`)}}function r_(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;if(s)n_.assignDefaults(e,t.type);r.block(()=>{for(let i of t.rules)if(wa.shouldUseRule(n,i))d_(e,i.keyword,i.definition,t.type)})}function IU(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(JU(e,t),!e.opts.allowUnionTypes)MU(e,t);DU(e,e.dataTypes)}function JU(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!f_(e.dataTypes,r))jg(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),FU(e,t)}function MU(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))jg(e,"use allowUnionTypes to allow union type keyword")}function DU(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&wa.shouldUseRule(e.schema,s)){let{type:i}=s.definition;if(i.length&&!i.some((o)=>LU(t,o)))jg(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function LU(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function f_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function FU(e,t){let r=[];for(let n of e.dataTypes)if(f_(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function jg(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Ft.checkStrictMode(e,t,e.opts.strictTypes)}class kg{constructor(e,t,r){if(Fn.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=Ft.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",p_(this.$data,e));else if(this.schemaCode=this.schemaValue,!Fn.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",be.default.errors)}result(e,t,r){this.failResult(q.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(q.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(q._`${t} !== undefined && (${q.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?Ln.reportExtraError:Ln.reportError)(this,this.def.error,t)}$dataError(){Ln.reportError(this,this.def.$dataError||Ln.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Ln.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=q.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=q.nil,t=q.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:s,def:i}=this;if(r.if(q.or(q._`${n} === undefined`,t)),e!==q.nil)r.assign(e,!0);if(s.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==q.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:s}=this;return q.or(i(),o());function i(){if(r.length){if(!(t instanceof q.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return q._`${ui.checkDataTypes(a,t,s.opts.strictNumbers,ui.DataType.Wrong)}`}return q.nil}function o(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return q._`!${a}(${t})`}return q.nil}}subschema(e,t){let r=$a.getSubschema(this.it,e);$a.extendSubschemaData(r,this.it,e),$a.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return kU(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=Ft.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Ft.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,q.Name)),!0}}m_.KeywordCxt=kg;function d_(e,t,r,n){let s=new kg(e,r,t);if("code"in r)r.code(s,n);else if(s.$data&&r.validate)Fn.funcKeywordCode(s,r);else if("macro"in r)Fn.macroKeywordCode(s,r);else if(r.compile||r.validate)Fn.funcKeywordCode(s,r)}var qU=/^\/(?:[^~]|~0|~1)*$/,VU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function p_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return be.default.rootData;if(e[0]==="/"){if(!qU.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=be.default.rootData}else{let c=VU.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(s=c[2],s==="#"){if(u>=t)throw Error(l("property/index",u));return n[t-u]}if(u>t)throw Error(l("data",u));if(i=r[t-u],!s)return i}let o=i,a=s.split("/");for(let c of a)if(c)i=q._`${i}${q.getProperty(Ft.unescapeJsonPointer(c))}`,o=q._`${o} && ${i}`;return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}m_.getData=p_});var tc=N(function(y_){Object.defineProperty(y_,"__esModule",{value:!0});class g_ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}y_.default=g_});var Ea=N(function(x_){Object.defineProperty(x_,"__esModule",{value:!0});var Sa=ec();class b_ extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Sa.resolveUrl(e,t,r),this.missingSchema=Sa.normalizeId(Sa.getFullPath(e,this.missingRef))}}x_.default=b_});var nc=N(function(v_){Object.defineProperty(v_,"__esModule",{value:!0});v_.resolveSchema=v_.getCompilingSchema=v_.resolveRef=v_.compileSchema=v_.SchemaEnv=void 0;var ht=$e(),zU=tc(),uo=tn(),gt=ec(),qf=Oe(),$_=va();class rc{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:gt.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={}}}v_.SchemaEnv=rc;function Ag(e){let t=w_.call(this,e);if(t)return t;let r=gt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new ht.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;if(e.$async)a=o.scopeValue("Error",{ref:zU.default,code:ht._`require("ajv/dist/runtime/validation_error").default`});let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:uo.default.data,parentData:uo.default.parentData,parentDataProperty:uo.default.parentDataProperty,dataNames:[uo.default.data],dataPathArr:[ht.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ht.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ht.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ht._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),$_.validateFunctionCode(c),o.optimize(this.opts.code.optimize);let p=o.toString();if(u=`${o.scopeRefs(uo.default.scope)}return ${p}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${uo.default.self}`,`${uo.default.scope}`,u)(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 ht.Name?void 0:b,items:g instanceof ht.Name?void 0:g,dynamicProps:b instanceof ht.Name,dynamicItems:g instanceof ht.Name},m.source)m.source.evaluated=ht.stringify(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw p}finally{this._compilations.delete(e)}}v_.compileSchema=Ag;function GU(e,t,r){var n;r=gt.resolveUrl(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=XU.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 rc({schema:o,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=KU.call(this,i)}v_.resolveRef=GU;function KU(e){if(gt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Ag.call(this,e)}function w_(e){for(let t of this._compilations)if(YU(t,e))return t}v_.getCompilingSchema=w_;function YU(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function XU(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Vf.call(this,e,t)}function Vf(e,t){let r=this.opts.uriResolver.parse(t),n=gt._getFullPath(this.opts.uriResolver,r),s=gt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return _g.call(this,r,e);let i=gt.normalizeId(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=Vf.call(this,e,o);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return _g.call(this,r,a)}if(typeof(o===null||o===void 0?void 0:o.schema)!=="object")return;if(!o.validate)Ag.call(this,o);if(i===gt.normalizeId(t)){let{schema:a}=o,{schemaId:l}=this.opts,c=a[l];if(c)s=gt.resolveUrl(this.opts.uriResolver,s,c);return new rc({schema:a,schemaId:l,root:e,baseId:s})}return _g.call(this,r,o)}v_.resolveSchema=Vf;var ZU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function _g(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[qf.unescapeFragment(a)];if(l===void 0)return;r=l;let c=typeof r==="object"&&r[this.opts.schemaId];if(!ZU.has(a)&&c)t=gt.resolveUrl(this.opts.uriResolver,t,c)}let i;if(typeof r!="boolean"&&r.$ref&&!qf.schemaHasRulesButRef(r,this.RULES)){let a=gt.resolveUrl(this.opts.uriResolver,t,r.$ref);i=Vf.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new rc({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i;return}});var E_=N(function(moe,n4){n4.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 Ig=N(function(hoe,C_){var s4=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Og=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),i4=RegExp.prototype.test.bind(/^\d*$/u),fo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Cg=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),j_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Ng=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),o4=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),kr=Array(256);for(let t=0;t<256;t++)kr[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function er(e){if(e<2048)return kr[192|e>>6]+kr[128|e&63];if(e<65536)return kr[224|e>>12]+kr[128|e>>6&63]+kr[128|e&63];return kr[240|e>>18]+kr[128|e>>12&63]+kr[128|e>>6&63]+kr[128|e&63]}function a4(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 l4=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),c4=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),u4=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),f4=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function d4(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(u4(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&fo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function P_(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 p4(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||!Og(l))return;i+=2;continue}if(!l4(l))return;s[a]=parseInt(l,16).toString(16),i++}if(t===-1){if(i!==8)return;return P_(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 P_(o)}function Rg(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&&c4(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(m4(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),!d4(s))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let o=p4(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 m4(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function k_(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 h4(e){if(e===""||e[0]==="/")return k_(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 g4={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},y4=/[@/?#:]/g,b4=/[@/?#]/g;function __(e,t){let r=t?b4:y4;return r.lastIndex=0,e.replace(r,(n)=>g4[n])}function A_(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(fo(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(t&&Cg(o))r+=o;else r+="%"+i;n+=2;continue}}r+=e[n]}return r}function x4(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(fo(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(o!=="."&&Cg(o))t+=o;else t+="%"+i;r+=2;continue}}if(j_(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=O_(s)?n:kr[s];else if(s<55296||s>57343)t+=er(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=er(65536+(s-55296<<10)+(i-56320)),r++;else t+=er(65533)}else t+=er(65533)}}return t}function $4(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(fo(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(i==="/")n=!1;if(j_(i)&&(i!==":"||!n))r+=i;else{let o=e.charCodeAt(s);if(o<128)r+=kr[o];else if(o<55296||o>57343)r+=er(o);else if(o<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)r+=er(65536+(o-55296<<10)+(a-56320)),s++;else r+=er(65533)}else r+=er(65533)}}return r}function Tg(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(fo(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(s))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=kr[i];else if(i<55296||i>57343)r+=er(i);else if(i<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)r+=er(65536+(i-55296<<10)+(o-56320)),n++;else r+=er(65533)}else r+=er(65533)}}return r}function R_(e){return Tg(e,o4)}function w4(e){return Tg(e,Ng)}function v4(e){return Tg(e,Ng)}function O_(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 S4(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(fo(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(Cg(o))t+=o;else t+="%"+i;r+=2;continue}}if(Ng(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=O_(s)?n:kr[s];else if(s<55296||s>57343)t+=er(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=er(65536+(s-55296<<10)+(i-56320)),r++;else t+=er(65533)}else t+=er(65533)}}return t}function E4(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(fo(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function P4(e){let t=[];if(e.userinfo!==void 0)t.push(R_(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Og(r)){let n=Rg(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=A_(r,!0),n=Rg(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=__(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!i4(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}C_.exports={nonSimpleDomain:f4,recomposeAuthority:P4,reescapeHostDelimiters:__,normalizePercentEncoding:A_,normalizePathEncoding:x4,serializePathEncoding:$4,normalizeQueryFragmentEncoding:S4,encodeUserinfo:R_,encodeQuery:w4,encodeFragment:v4,escapePreservingEscapes:E4,removeDotSegments:k_,removeDotSegmentsRelative:h4,isIPv4:Og,isUUID:s4,normalizeIPv6:Rg,stringArrayToHexStripped:a4}});var M_=N(function(goe,J_){var{isUUID:j4}=Ig(),k4=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,_4=["http","https","ws","wss","urn","urn:uuid"];function A4(e){return _4.indexOf(e)!==-1}function Jg(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 N_(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function T_(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 R4(e){return e.secure=Jg(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function O4(e){if(e.port===(Jg(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 C4(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(k4);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=Mg(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 N4(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=Mg(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 T4(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!j4(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function I4(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var I_={scheme:"http",domainHost:!0,parse:N_,serialize:T_},J4={scheme:"https",domainHost:I_.domainHost,parse:N_,serialize:T_},Wf={scheme:"ws",domainHost:!0,parse:R4,serialize:O4},M4={scheme:"wss",domainHost:Wf.domainHost,parse:Wf.parse,serialize:Wf.serialize},D4={scheme:"urn",parse:C4,serialize:N4,skipNormalize:!0},L4={scheme:"urn:uuid",parse:T4,serialize:I4,skipNormalize:!0},Hf={http:I_,https:J4,ws:Wf,wss:M4,urn:D4,"urn:uuid":L4};Object.setPrototypeOf(Hf,null);function Mg(e){return e&&(Hf[e]||Hf[e.toLowerCase()])||void 0}J_.exports={wsIsSecure:Jg,SCHEMES:Hf,isValidSchemeName:A4,getSchemeHandler:Mg}});var X_=N(function(yoe,Gf){var{normalizeIPv6:V_,removeDotSegments:ic,removeDotSegmentsRelative:W_,recomposeAuthority:F4,normalizePercentEncoding:Dg,normalizePathEncoding:q4,serializePathEncoding:D_,normalizeQueryFragmentEncoding:L_,encodeQuery:V4,encodeFragment:W4,reescapeHostDelimiters:H4,isIPv4:H_,nonSimpleDomain:B4}=Ig(),{SCHEMES:B_,getSchemeHandler:Lg}=M_(),U_=/^[A-Za-z][A-Za-z0-9+.-]*$/u,U4=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function F_(e){let t=String(e);if(!U_.test(t))throw TypeError("URI scheme is malformed.");return t}function z4(e,t){if(typeof e==="string")e=r6(e,t);else if(typeof e==="object")e=Uf(po(e,t),t);return e}function G4(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}=Bf(e,n),{parsed:u,malformedAuthorityOrPort:p,malformedPercentEncoding:h,malformedSchemeSpecific:m,malformedHost:b,malformedScheme:g}=Bf(t,n);if(i||p||o||h||a||m||l||b||c||g)throw Error(s.error||u.error||"URI is malformed.");let y=z_(s,u,n,!0),w=Lg(r&&r.scheme||y.scheme),P=y.host,S=P!==void 0&&P!==""&&(H_(P)||V_(P).isIPV6);if(K_(y,r||{},w,S))throw Error("URI host is malformed.");G_(y,r||{},w,S);let E=P&&P.indexOf("%")!==-1&&!/\P{ASCII}/u.test(P);if(y.error&&!E)throw Error(y.error);return n.skipEscape=!0,po(y,n)}function z_(e,t,r,n){let s={};if(!n)e=Uf(po(e,r),r),t=Uf(po(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=ic(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=ic(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=ic(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]!=="/"?W_(s.path):ic(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 K4(e,t,r){let n=q_(e,r),s=q_(t,r);return n!==void 0&&s!==void 0&&n===s}function po(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=F_(r.scheme);let i=Lg(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=D_(r.path,l);else r.path=Dg(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=F_(r.scheme),s.push(r.scheme,":");let c=F4(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 u=r.path;if(!n.absolutePath&&(!i||!i.absolutePath))u=a&&u[0]!=="/"?W_(u):ic(u);if(a)u=D_(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(r.query!==void 0)s.push("?",V4(r.query));if(r.fragment!==void 0)s.push("#",W4(r.fragment));return s.join("")}var Y4=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,X4=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Z4=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Q4(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 sc(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 zf(e){return e[0]==="["&&e[e.length-1]==="]"}function e6(e){let t=e[4];return sc(e[3])||t!==void 0&&!zf(t)&&sc(t)||sc(e[6])||sc(e[7])||sc(e[8])}function G_(e,t,r,n){if(K_(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!zf(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&B4(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(!t6(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function K_(e,t,r,n){return Boolean(e.host&&n===!1&&!zf(e.host)&&(t.domainHost||r&&r.domainHost)&&U4.test(e.host))}function t6(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Bf(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,u=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let p=e.match(X4);if(p!==null&&p[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",s=!0;let h=e.match(Z4);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(Y4);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(U_.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(i=e6(m),i)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let b=Q4(n,m);if(b!==void 0)n.error=n.error||b,s=!0;if(n.host)if(H_(n.host)===!1){let w=zf(n.host),P=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=V_(n.host);if(u=S.isIPV6||S.isIPVFuture===!0,l=P&&(!w||S.error===!0),n.host=u?S.host:S.host.toLowerCase(),l)n.error=n.error||"URI host is malformed.",s=!0}else u=!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=Lg(r.scheme||n.scheme);if(!l)a=G_(n,r,g,u);if(e.indexOf("%")!==-1&&n.host!==void 0&&!l){let y=u?n.host:Dg(n.host,!0);if(!u)y=Dg(y.toLowerCase());n.host=u||r.scheme!=="null"?H4(y,u):y}if(!g||g&&!g.skipNormalize){if(n.path)n.path=q4(n.path);if(n.query)n.query=L_(n.query);if(n.fragment)n.fragment=L_(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===B_.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 Uf(e,t){return Bf(e,t).parsed}function r6(e,t){return Y_(e,t).normalized}function Y_(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}=Bf(e,t);return{normalized:n||s||i||o||a?e:po(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}}function q_(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:po(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}=Y_(r,t);return s||i||o||a||l?void 0:n}var Fg={SCHEMES:B_,normalize:z4,resolve:G4,resolveComponent:z_,equal:K4,serialize:po,parse:Uf};Gf.exports=Fg;Gf.exports.default=Fg;Gf.exports.fastUri=Fg});var eA=N(function(Q_){Object.defineProperty(Q_,"__esModule",{value:!0});var Z_=X_();Z_.code='require("ajv/dist/runtime/uri").default';Q_.default=Z_});var Vg=N(function(Rs){Object.defineProperty(Rs,"__esModule",{value:!0});Rs.CodeGen=Rs.Name=Rs.nil=Rs.stringify=Rs.str=Rs._=Rs.KeywordCxt=void 0;var s6=va();Object.defineProperty(Rs,"KeywordCxt",{enumerable:!0,get:function(){return s6.KeywordCxt}});var ja=$e();Object.defineProperty(Rs,"_",{enumerable:!0,get:function(){return ja._}});Object.defineProperty(Rs,"str",{enumerable:!0,get:function(){return ja.str}});Object.defineProperty(Rs,"stringify",{enumerable:!0,get:function(){return ja.stringify}});Object.defineProperty(Rs,"nil",{enumerable:!0,get:function(){return ja.nil}});Object.defineProperty(Rs,"Name",{enumerable:!0,get:function(){return ja.Name}});Object.defineProperty(Rs,"CodeGen",{enumerable:!0,get:function(){return ja.CodeGen}});var i6=tc(),iA=Ea(),oA=yg(),qn=nc(),aA=$e(),Vn=ec(),fi=Ql(),Pa=Oe(),tA=E_(),o6=eA(),lA=(e,t)=>new RegExp(e,t);lA.code="new RegExp";var a6=["removeAdditional","useDefaults","coerceTypes"],l6=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),c6={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."},u6={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},rA=200;function f6(e){var t,r,n,s,i,o,a,l,c,u,p,h,m,b,g,y,w,P,S,E,k,A,R,_,I;let L=e.strict,J=(t=e.code)===null||t===void 0?void 0:t.optimize,F=J===!0||J===void 0?1:J||0,K=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:lA,ae=(s=e.uriResolver)!==null&&s!==void 0?s:o6.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:L)!==null&&o!==void 0?o:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:L)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:L)!==null&&u!==void 0?u:"log",strictTuples:(h=(p=e.strictTuples)!==null&&p!==void 0?p:L)!==null&&h!==void 0?h:"log",strictRequired:(b=(m=e.strictRequired)!==null&&m!==void 0?m:L)!==null&&b!==void 0?b:!1,code:e.code?{...e.code,optimize:F,regExp:K}:{optimize:F,regExp:K},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:rA,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:rA,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(k=e.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:(A=e.validateSchema)!==null&&A!==void 0?A:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(_=e.unicodeRegExp)!==null&&_!==void 0?_:!0,int32range:(I=e.int32range)!==null&&I!==void 0?I:!0,uriResolver:ae}}class Kf{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,...f6(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new aA.ValueScope({scope:{},prefixes:l6,es5:t,lines:r}),this.logger=y6(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=oA.getRules(),nA.call(this,c6,e,"NOT SUPPORTED"),nA.call(this,u6,e,"DEPRECATED","warn"),this._metaOpts=h6.call(this),e.formats)p6.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)m6.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);d6.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=tA;if(r==="id")n={...tA},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,u){await s.call(this,c.$schema);let p=this._addSchema(c,u);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(u){if(!(u instanceof iA.default))throw u;return o.call(this,u),await a.call(this,u.missingSchema),i.call(this,c)}}function o({missingSchema:c,missingRef:u}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${u} cannot be resolved`)}async function a(c){let u=await l.call(this,c);if(!this.refs[c])await s.call(this,u.$schema);if(!this.refs[c])this.addSchema(u,c,t)}async function l(c){let u=this._loading[c];if(u)return u;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=Vn.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=sA.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new qn.SchemaEnv({schema:{},schemaId:r});if(t=qn.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=sA.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=Vn.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(x6.call(this,r,t),!t)return Pa.eachItem(r,(s)=>qg.call(this,s)),this;w6.call(this,t);let n={...t,type:fi.getJSONTypes(t.type),schemaType:fi.getJSONTypes(t.schemaType)};return Pa.eachItem(r,n.type.length===0?(s)=>qg.call(this,s,n):(s)=>n.type.forEach((i)=>qg.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]=cA(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=Vn.normalizeId(i||r);let l=Vn.getSchemaRefs.call(this,e,r);if(a=new qn.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 qn.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{qn.compileSchema.call(this,e)}finally{this.opts=t}}}Kf.ValidationError=i6.default;Kf.MissingRefError=iA.default;Rs.default=Kf;function nA(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 sA(e){return e=Vn.normalizeId(e),this.schemas[e]||this.refs[e]}function d6(){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 p6(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function m6(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 h6(){let e={...this.opts};for(let t of a6)delete e[t];return e}var g6={log(){},warn(){},error(){}};function y6(e){if(e===!1)return g6;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 b6=/^[a-z_$][a-z0-9_$:-]*$/i;function x6(e,t){let{RULES:r}=this;if(Pa.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!b6.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 qg(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:fi.getJSONTypes(t.type),schemaType:fi.getJSONTypes(t.schemaType)}};if(t.before)$6.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 $6(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 w6(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=cA(t);e.validateSchema=this.compile(t,!0)}var v6={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function cA(e){return{anyOf:[e,v6]}}});var fA=N(function(uA){Object.defineProperty(uA,"__esModule",{value:!0});var P6={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};uA.default=P6});var Qf=N(function(pA){Object.defineProperty(pA,"__esModule",{value:!0});pA.callRef=pA.getValidate=void 0;var k6=Ea(),Xf=nn(),Ye=$e(),ka=tn(),Zf=nc(),di=Oe(),_6={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 u=Zf.resolveRef.call(l,c,s,r);if(u===void 0)throw new k6.default(n.opts.uriResolver,s,r);if(u instanceof Zf.SchemaEnv)return h(u);return m(u);function p(){if(i===c)return Yf(e,o,i,i.$async);let b=t.scopeValue("root",{ref:c});return Yf(e,Ye._`${b}.validate`,c,c.$async)}function h(b){let g=dA(e,b);Yf(e,g,b,b.$async)}function m(b){let g=t.scopeValue("schema",a.code.source===!0?{ref:b,code:Ye.stringify(b)}:{ref:b}),y=t.name("valid"),w=e.subschema({schema:b,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated(w),e.ok(y)}}};function dA(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Ye._`${r.scopeValue("wrapper",{ref:t})}.validate`}pA.getValidate=dA;function Yf(e,t,r,n){let{gen:s,it:i}=e,{allErrors:o,schemaEnv:a,opts:l}=i,c=l.passContext?ka.default.this:Ye.nil;if(n)u();else p();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let b=s.let("valid");s.try(()=>{if(s.code(Ye._`await ${Xf.callValidateCode(e,t,c)}`),m(t),!o)s.assign(b,!0)},(g)=>{if(s.if(Ye._`!(${g} instanceof ${i.ValidationError})`,()=>s.throw(g)),h(g),!o)s.assign(b,!1)}),e.ok(b)}function p(){e.result(Xf.callValidateCode(e,t,c),()=>m(t),()=>h(t))}function h(b){let g=Ye._`${b}.errors`;s.assign(ka.default.vErrors,Ye._`${ka.default.vErrors} === null ? ${g} : ${ka.default.vErrors}.concat(${g})`),s.assign(ka.default.errors,Ye._`${ka.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=di.mergeEvaluated.props(s,y.props,i.props)}else{let w=s.var("props",Ye._`${b}.evaluated.props`);i.props=di.mergeEvaluated.props(s,w,i.props,Ye.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=di.mergeEvaluated.items(s,y.items,i.items)}else{let w=s.var("items",Ye._`${b}.evaluated.items`);i.items=di.mergeEvaluated.items(s,w,i.items,Ye.Name)}}}pA.callRef=Yf;pA.default=_6});var Wg=N(function(hA){Object.defineProperty(hA,"__esModule",{value:!0});var O6=fA(),C6=Qf(),N6=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",O6.default,C6.default];hA.default=N6});var yA=N(function(gA){Object.defineProperty(gA,"__esModule",{value:!0});var mi=$e(),pi=mi.operators,ed={maximum:{okStr:"<=",ok:pi.LTE,fail:pi.GT},minimum:{okStr:">=",ok:pi.GTE,fail:pi.LT},exclusiveMaximum:{okStr:"<",ok:pi.LT,fail:pi.GTE},exclusiveMinimum:{okStr:">",ok:pi.GT,fail:pi.LTE}},I6={message:({keyword:e,schemaCode:t})=>mi.str`must be ${ed[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>mi._`{comparison: ${ed[e].okStr}, limit: ${t}}`},J6={keyword:Object.keys(ed),type:"number",schemaType:"number",$data:!0,error:I6,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(mi._`${r} ${ed[t].fail} ${n} || isNaN(${r})`)}};gA.default=J6});var xA=N(function(bA){Object.defineProperty(bA,"__esModule",{value:!0});var Wn=$e(),D6={message:({schemaCode:e})=>Wn.str`must be multiple of ${e}`,params:({schemaCode:e})=>Wn._`{multipleOf: ${e}}`},L6={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:D6,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),a=i?Wn._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:Wn._`${o} !== parseInt(${o})`;e.fail$data(Wn._`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};bA.default=L6});var vA=N(function(wA){Object.defineProperty(wA,"__esModule",{value:!0});function $A(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}wA.default=$A;$A.code='require("ajv/dist/runtime/ucs2length").default'});var PA=N(function(EA){Object.defineProperty(EA,"__esModule",{value:!0});var _r=$e(),SA=Oe(),V6=vA(),W6={message({keyword:e,schemaCode:t}){return _r.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>_r._`{limit: ${e}}`},H6={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:W6,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?_r.operators.GT:_r.operators.LT,o=s.opts.unicode===!1?_r._`${r}.length`:_r._`${SA.useFunc(e.gen,V6.default)}(${r})`;e.fail$data(_r._`${o} ${i} ${n}`)}};EA.default=H6});var AA=N(function(_A){Object.defineProperty(_A,"__esModule",{value:!0});var jA=nn(),kA=Oe(),sn=$e(),U6={message:({schemaCode:e})=>sn.str`must match pattern "${e}"`,params:({schemaCode:e})=>sn._`{pattern: ${e}}`},z6={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:U6,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"?sn._`new RegExp`:kA.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,sn._`${c}(${i}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data(sn._`!${u}`)}else{let l=jA.usePattern(e,s);e.fail$data(sn._`!${l}.test(${r})`)}}};_A.default=z6});var OA=N(function(RA){Object.defineProperty(RA,"__esModule",{value:!0});var Hn=$e(),K6={message({keyword:e,schemaCode:t}){return Hn.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Hn._`{limit: ${e}}`},Y6={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:K6,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Hn.operators.GT:Hn.operators.LT;e.fail$data(Hn._`Object.keys(${r}).length ${s} ${n}`)}};RA.default=Y6});var TA=N(function(NA){Object.defineProperty(NA,"__esModule",{value:!0});var Bn=nn(),Un=$e(),CA=Oe(),Z6={message:({params:{missingProperty:e}})=>Un.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Un._`{missingProperty: ${e}}`},Q6={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Z6,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 u();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,w=`required property "${g}" is not defined at "${y}" (strictRequired)`;CA.checkStrictMode(o,w,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(Un.nil,p);else for(let m of r)Bn.checkReportMissingProp(e,m)}function u(){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(Bn.checkMissingProp(e,r,m)),Bn.reportMissingProp(e,m),t.else()}function p(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(Bn.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function h(m,b){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(b,Bn.propertyInData(t,s,m,a.ownProperties)),t.if(Un.not(b),()=>{e.error(),t.break()})},Un.nil)}}};NA.default=Q6});var JA=N(function(IA){Object.defineProperty(IA,"__esModule",{value:!0});var zn=$e(),tz={message({keyword:e,schemaCode:t}){return zn.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>zn._`{limit: ${e}}`},rz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:tz,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?zn.operators.GT:zn.operators.LT;e.fail$data(zn._`${r}.length ${s} ${n}`)}};IA.default=rz});var td=N(function(DA){Object.defineProperty(DA,"__esModule",{value:!0});var MA=Eg();MA.code='require("ajv/dist/runtime/equal").default';DA.default=MA});var qA=N(function(FA){Object.defineProperty(FA,"__esModule",{value:!0});var _a=Ql(),De=$e(),LA=Oe(),iz=td(),oz={message:({params:{i:e,j:t}})=>De.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>De._`{i: ${e}, j: ${t}}`},az={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:oz,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?_a.getSchemaTypes(i.items):[];e.block$data(l,u,De._`${o} === false`),e.ok(l);function u(){let b=t.let("i",De._`${r}.length`),g=t.let("j");e.setParams({i:b,j:g}),t.assign(l,!0),t.if(De._`${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"),w=_a.checkDataTypes(c,y,a.opts.strictNumbers,_a.DataType.Wrong),P=t.const("indices",De._`{}`);t.for(De._`;${b}--;`,()=>{if(t.let(y,De._`${r}[${b}]`),t.if(w,De._`continue`),c.length>1)t.if(De._`typeof ${y} == "string"`,De._`${y} += "_"`);t.if(De._`typeof ${P}[${y}] == "number"`,()=>{t.assign(g,De._`${P}[${y}]`),e.error(),t.assign(l,!1).break()}).code(De._`${P}[${y}] = ${b}`)})}function m(b,g){let y=LA.useFunc(t,iz.default),w=t.name("outer");t.label(w).for(De._`;${b}--;`,()=>t.for(De._`${g} = ${b}; ${g}--;`,()=>t.if(De._`${y}(${r}[${b}], ${r}[${g}])`,()=>{e.error(),t.assign(l,!1).break(w)})))}}};FA.default=az});var HA=N(function(WA){Object.defineProperty(WA,"__esModule",{value:!0});var Aa=$e(),VA=Oe(),cz=td(),uz={message:"must be equal to constant",params:({schemaCode:e})=>Aa._`{allowedValue: ${e}}`},fz={keyword:"const",$data:!0,error:uz,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;if(n||i&&typeof i=="object")e.fail$data(Aa._`!${VA.useFunc(t,cz.default)}(${r}, ${s})`);else e.fail(Aa._`${i} !== ${r}`)}};WA.default=fz});var zA=N(function(UA){Object.defineProperty(UA,"__esModule",{value:!0});var Gn=$e(),BA=Oe(),pz=td(),mz={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Gn._`{allowedValues: ${e}}`},hz={keyword:"enum",schemaType:"array",$data:!0,error:mz,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=BA.useFunc(t,pz.default),u;if(a||n)u=t.let("valid"),e.block$data(u,p);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",i);u=Gn.or(...s.map((b,g)=>h(m,g)))}e.pass(u);function p(){t.assign(u,!1),t.forOf("v",i,(m)=>t.if(Gn._`${c()}(${r}, ${m})`,()=>t.assign(u,!0).break()))}function h(m,b){let g=s[b];return typeof g==="object"&&g!==null?Gn._`${c()}(${r}, ${m}[${b}])`:Gn._`${r} === ${g}`}}};UA.default=hz});var Hg=N(function(GA){Object.defineProperty(GA,"__esModule",{value:!0});var yz=yA(),bz=xA(),xz=PA(),$z=AA(),wz=OA(),vz=TA(),Sz=JA(),Ez=qA(),Pz=HA(),jz=zA(),kz=[yz.default,bz.default,xz.default,$z.default,wz.default,vz.default,Sz.default,Ez.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Pz.default,jz.default];GA.default=kz});var Bg=N(function(YA){Object.defineProperty(YA,"__esModule",{value:!0});YA.validateAdditionalItems=void 0;var Ar=$e(),Ra=Oe(),Az={message:({params:{len:e}})=>Ar.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ar._`{limit: ${e}}`},Rz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Az,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){Ra.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}KA(e,n)}};function KA(e,t){let{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;let a=r.const("len",Ar._`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Ar._`${a} <= ${t.length}`);else if(typeof n=="object"&&!Ra.alwaysValidSchema(o,n)){let c=r.var("valid",Ar._`${a} <= ${t.length}`);r.if(Ar.not(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:i,dataProp:u,dataPropType:Ra.Type.Num},c),!o.allErrors)r.if(Ar.not(c),()=>r.break())})}}YA.validateAdditionalItems=KA;YA.default=Rz});var Ug=N(function(eR){Object.defineProperty(eR,"__esModule",{value:!0});eR.validateTuple=void 0;var rd=$e(),hi=Oe(),ZA=nn(),Cz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return QA(e,"additionalItems",t);if(r.items=!0,hi.alwaysValidSchema(r,t))return;e.ok(ZA.validateArray(e))}};function QA(e,t,r=e.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=e;if(u(s),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=hi.mergeEvaluated.items(n,r.length,a.items);let l=n.name("valid"),c=n.const("len",rd._`${i}.length`);r.forEach((p,h)=>{if(hi.alwaysValidSchema(a,p))return;n.if(rd._`${c} > ${h}`,()=>e.subschema({keyword:o,schemaProp:h,dataProp:h},l)),e.ok(l)});function u(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}"`;hi.checkStrictMode(a,y,h.strictTuples)}}}eR.validateTuple=QA;eR.default=Cz});var sR=N(function(nR){Object.defineProperty(nR,"__esModule",{value:!0});var rR=Ug(),Tz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>rR.validateTuple(e,"items")};nR.default=Tz});var cR=N(function(lR){Object.defineProperty(lR,"__esModule",{value:!0});var nd=$e(),iR=Oe(),oR=nn(),aR=Bg(),Jz={message:({params:{len:e}})=>nd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>nd._`{limit: ${e}}`},Mz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Jz,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;if(n.items=!0,iR.alwaysValidSchema(n,t))return;if(s)aR.validateAdditionalItems(e,s);else e.ok(oR.validateArray(e))}};lR.default=Mz});var fR=N(function(uR){Object.defineProperty(uR,"__esModule",{value:!0});var ct=$e(),gi=Oe(),Lz={message:({params:{min:e,max:t}})=>t===void 0?ct.str`must contain at least ${e} valid item(s)`:ct.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ct._`{minContains: ${e}}`:ct._`{minContains: ${e}, maxContains: ${t}}`},Fz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Lz,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 u=t.const("len",ct._`${s}.length`);if(e.setParams({min:o,max:a}),a===void 0&&o===0){gi.checkStrictMode(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){gi.checkStrictMode(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(gi.alwaysValidSchema(i,r)){let g=ct._`${u} >= ${o}`;if(a!==void 0)g=ct._`${g} && ${u} <= ${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(ct._`${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,u,(w)=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:gi.Type.Num,compositeRule:!0},g),y()})}function b(g){if(t.code(ct._`${g}++`),a===void 0)t.if(ct._`${g} >= ${o}`,()=>t.assign(p,!0).break());else if(t.if(ct._`${g} > ${a}`,()=>t.assign(p,!1).break()),o===1)t.assign(p,!0);else t.if(ct._`${g} >= ${o}`,()=>t.assign(p,!0))}}};uR.default=Fz});var sd=N(function(hR){Object.defineProperty(hR,"__esModule",{value:!0});hR.validateSchemaDeps=hR.validatePropertyDeps=hR.error=void 0;var Oa=$e(),dR=Oe(),Kn=nn();hR.error={message:({params:{property:e,depsCount:t,deps:r}})=>Oa.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Oa._`{property: ${e},
567
611
  missingProperty: ${n},
568
612
  depsCount: ${t},
569
- deps: ${r}}`};var T4={keyword:"dependencies",type:"object",schemaType:"object",error:h1.error,code(e){let[t,r]=I4(e);p1(e,t),m1(e,r)}};function I4({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 p1(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=pn.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)pn.checkReportMissingProp(e,c)});else r.if(co._`${l} && (${pn.checkMissingProp(e,a,i)})`),pn.reportMissingProp(e,i),r.else()}}h1.validatePropertyDeps=p1;function m1(e,t=e.schema){let{gen:r,data:n,keyword:s,it:i}=e,o=r.name("valid");for(let a in t){if(d1.alwaysValidSchema(i,t[a]))continue;r.if(pn.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)}}h1.validateSchemaDeps=m1;h1.default=T4});var $1=C(function(x1){Object.defineProperty(x1,"__esModule",{value:!0});var zc=$e(),b1=_e(),D4={message:"property name must be valid",params:({params:e})=>zc._`{propertyName: ${e.propertyName}}`},L4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:D4,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(b1.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(zc.not(i),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(i)}};x1.default=L4});var Zp=C(function(v1){Object.defineProperty(v1,"__esModule",{value:!0});var Es=Or(),at=$e(),q4=Rr(),Ps=_e(),H4={message:"must NOT have additional properties",params:({params:e})=>at._`{additionalProperty: ${e.additionalProperty}}`},V4={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"&&Ps.alwaysValidSchema(o,r))return;let c=Es.allSchemaProperties(n.properties),u=Es.allSchemaProperties(n.patternProperties);p(),e.ok(at._`${i} === ${q4.default.errors}`);function p(){t.forIn("key",s,(y)=>{if(!c.length&&!u.length)b(y);else t.if(g(y),()=>b(y))})}function g(y){let v;if(c.length>8){let k=Ps.schemaRefOrVal(o,n.properties,"properties");v=Es.isOwnProperty(t,k,y)}else if(c.length)v=at.or(...c.map((k)=>at._`${y} === ${k}`));else v=at.nil;if(u.length)v=at.or(v,...u.map((k)=>at._`${Es.usePattern(e,k)}.test(${y})`));return at.not(v)}function m(y){t.code(at._`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"&&!Ps.alwaysValidSchema(o,r)){let v=t.name("valid");if(l.removeAdditional==="failing")h(y,v,!1),t.if(at.not(v),()=>{e.reset(),m(y)});else if(h(y,v),!a)t.if(at.not(v),()=>t.break())}}function h(y,v,k){let S={keyword:"additionalProperties",dataProp:y,dataPropType:Ps.Type.Str};if(k===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,v)}}};v1.default=V4});var P1=C(function(E1){Object.defineProperty(E1,"__esModule",{value:!0});var S1=eo(),Gc=Or(),uo=_e(),w1=Zp(),W4={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)w1.default.code(new S1.KeywordCxt(i,w1.default,"additionalProperties"));let o=Gc.allSchemaProperties(r);for(let p of o)i.definedProperties.add(p);if(i.opts.unevaluated&&o.length&&i.props!==!0)i.props=uo.mergeEvaluated.props(t,uo.toHash(o),i.props);let a=o.filter((p)=>!uo.alwaysValidSchema(i,r[p]));if(a.length===0)return;let l=t.name("valid");for(let p of a){if(c(p))u(p);else{if(t.if(Gc.propertyInData(t,s,p,i.opts.ownProperties)),u(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 u(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};E1.default=W4});var k1=C(function(j1){Object.defineProperty(j1,"__esModule",{value:!0});var Kc=Or(),js=$e(),Yc=_e(),Xc=_e(),z4={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,a=Kc.allSchemaProperties(r),l=a.filter((h)=>Yc.alwaysValidSchema(i,r[h]));if(a.length===0||l.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&s.properties,u=t.name("valid");if(i.props!==!0&&!(i.props instanceof js.Name))i.props=Xc.evaluatedPropsToName(t,i.props);let{props:p}=i;g();function g(){for(let h of a){if(c)m(h);if(i.allErrors)b(h);else t.var(u,!0),b(h),t.if(u)}}function m(h){for(let y in c)if(new RegExp(h).test(y))Yc.checkStrictMode(i,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function b(h){t.forIn("key",n,(y)=>{t.if(js._`${Kc.usePattern(e,h)}.test(${y})`,()=>{let v=l.includes(h);if(!v)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:Xc.Type.Str},u);if(i.opts.unevaluated&&p!==!0)t.assign(js._`${p}[${y}]`,!0);else if(!v&&!i.allErrors)t.if(js.not(u),()=>t.break())})})}}};j1.default=z4});var A1=C(function(R1){Object.defineProperty(R1,"__esModule",{value:!0});var _1=_e(),K4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(_1.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"}};R1.default=K4});var N1=C(function(C1){Object.defineProperty(C1,"__esModule",{value:!0});var O1=Or(),X4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:O1.validateUnion,error:{message:"must match a schema in anyOf"}};C1.default=X4});var M1=C(function(I1){Object.defineProperty(I1,"__esModule",{value:!0});var ks=$e(),T1=_e(),Q4={message:"must match exactly one schema in oneOf",params:({params:e})=>ks._`{passingSchemas: ${e.passing}}`},eB={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Q4,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((u,p)=>{let g;if(T1.alwaysValidSchema(s,u))t.var(l,!0);else g=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l);if(p>0)t.if(ks._`${l} && ${o}`).assign(o,!1).assign(a,ks._`[${a}, ${p}]`).else();t.if(l,()=>{if(t.assign(o,!0),t.assign(a,p),g)e.mergeEvaluated(g,ks.Name)})})}}};I1.default=eB});var L1=C(function(D1){Object.defineProperty(D1,"__esModule",{value:!0});var J1=_e(),rB={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(J1.alwaysValidSchema(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(a)})}};D1.default=rB});var H1=C(function(q1){Object.defineProperty(q1,"__esModule",{value:!0});var _s=$e(),Zc=_e(),sB={message:({params:e})=>_s.str`must match "${e.ifClause}" schema`,params:({params:e})=>_s._`{failingKeyword: ${e.ifClause}}`},iB={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:sB,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Zc.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=F1(n,"then"),i=F1(n,"else");if(!s&&!i)return;let o=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&i){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,c("then",u),c("else",u))}else if(s)t.if(a,c("then"));else t.if(_s.not(a),c("else"));e.pass(o,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,p){return()=>{let g=e.subschema({keyword:u},a);if(t.assign(o,a),e.mergeValidEvaluated(g,o),p)t.assign(p,_s._`${u}`);else e.setParams({ifClause:u})}}}};function F1(e,t){let r=e.schema[t];return r!==void 0&&!Zc.alwaysValidSchema(e,r)}q1.default=iB});var W1=C(function(B1){Object.defineProperty(B1,"__esModule",{value:!0});var V1=_e(),aB={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)V1.checkStrictMode(r,`"${e}" without "if" is ignored`)}};B1.default=aB});var Qp=C(function(U1){Object.defineProperty(U1,"__esModule",{value:!0});var cB=Yp(),uB=s1(),fB=Xp(),dB=c1(),pB=f1(),mB=Uc(),hB=$1(),gB=Zp(),yB=P1(),bB=k1(),xB=A1(),$B=N1(),vB=M1(),wB=L1(),SB=H1(),EB=W1();function PB(e=!1){let t=[xB.default,$B.default,vB.default,wB.default,SB.default,EB.default,hB.default,gB.default,mB.default,yB.default,bB.default];if(e)t.push(uB.default,dB.default);else t.push(cB.default,fB.default);return t.push(pB.default),t}U1.default=PB});var em=C(function(K1){Object.defineProperty(K1,"__esModule",{value:!0});K1.dynamicAnchor=void 0;var fo=$e(),kB=Rr(),Qc=wa(),z1=qc(),_B={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>G1(e,e.schema)};function G1(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let s=fo._`${kB.default.dynamicAnchors}${fo.getProperty(t)}`,i=n.errSchemaPath==="#"?n.validateName:RB(e);r.if(fo._`!${s}`,()=>r.assign(s,i))}K1.dynamicAnchor=G1;function RB(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 Qc.SchemaEnv({schema:r,schemaId:l,root:s,baseId:i,localRefs:o,meta:a});return Qc.compileSchema.call(n,c),z1.getValidate(e,c)}K1.default=_B});var tm=C(function(Z1){Object.defineProperty(Z1,"__esModule",{value:!0});Z1.dynamicRef=void 0;var eu=$e(),OB=Rr(),tu=qc(),CB={keyword:"$dynamicRef",schemaType:"string",code:(e)=>X1(e,e.schema)};function X1(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",eu._`${OB.default.dynamicAnchors}${eu.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(()=>{tu.callRef(e,l),r.let(c,!0)}):()=>tu.callRef(e,l)}}Z1.dynamicRef=X1;Z1.default=CB});var nk=C(function(rk){Object.defineProperty(rk,"__esModule",{value:!0});var ek=em(),tk=_e(),TB={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)ek.dynamicAnchor(e,"");else tk.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};rk.default=TB});var ok=C(function(ik){Object.defineProperty(ik,"__esModule",{value:!0});var sk=tm(),MB={keyword:"$recursiveRef",schemaType:"string",code:(e)=>sk.dynamicRef(e,e.schema)};ik.default=MB});var lk=C(function(ak){Object.defineProperty(ak,"__esModule",{value:!0});var DB=em(),LB=tm(),FB=nk(),qB=ok(),HB=[DB.default,LB.default,FB.default,qB.default];ak.default=HB});var uk=C(function(ck){Object.defineProperty(ck,"__esModule",{value:!0});var ru=Uc(),BB={keyword:"dependentRequired",type:"object",schemaType:"object",error:ru.error,code:(e)=>ru.validatePropertyDeps(e)};ck.default=BB});var pk=C(function(dk){Object.defineProperty(dk,"__esModule",{value:!0});var fk=Uc(),UB={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>fk.validateSchemaDeps(e)};dk.default=UB});var gk=C(function(hk){Object.defineProperty(hk,"__esModule",{value:!0});var mk=_e(),GB={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)mk.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};hk.default=GB});var bk=C(function(yk){Object.defineProperty(yk,"__esModule",{value:!0});var YB=uk(),XB=pk(),ZB=gk(),QB=[YB.default,XB.default,ZB.default];yk.default=QB});var $k=C(function(xk){Object.defineProperty(xk,"__esModule",{value:!0});var Dt=$e(),nu=_e(),tW=Rr(),rW={message:"must NOT have unevaluated properties",params:({params:e})=>Dt._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},nW={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:rW,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 Dt.Name)t.if(Dt._`${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(u(a,p),()=>l(p)));i.props=!0,e.ok(Dt._`${s} === ${tW.default.errors}`);function l(p){if(r===!1){if(e.setParams({unevaluatedProperty:p}),e.error(),!o)t.break();return}if(!nu.alwaysValidSchema(i,r)){let g=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:p,dataPropType:nu.Type.Str},g),!o)t.if(Dt.not(g),()=>t.break())}}function c(p,g){return Dt._`!${p} || !${p}[${g}]`}function u(p,g){let m=[];for(let b in p)if(p[b]===!0)m.push(Dt._`${g} !== ${b}`);return Dt.and(...m)}}};xk.default=nW});var wk=C(function(vk){Object.defineProperty(vk,"__esModule",{value:!0});var lr=$e(),su=_e(),iW={message:({params:{len:e}})=>lr.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>lr._`{limit: ${e}}`},oW={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:iW,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",lr._`${n}.length`);if(r===!1)e.setParams({len:i}),e.fail(lr._`${o} > ${i}`);else if(typeof r=="object"&&!su.alwaysValidSchema(s,r)){let l=t.var("valid",lr._`${o} <= ${i}`);t.if(lr.not(l),()=>a(l,i)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,o,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:su.Type.Num},l),!s.allErrors)t.if(lr.not(l),()=>t.break())})}}};vk.default=oW});var Ek=C(function(Sk){Object.defineProperty(Sk,"__esModule",{value:!0});var lW=$k(),cW=wk(),uW=[lW.default,cW.default];Sk.default=uW});var jk=C(function(Pk){Object.defineProperty(Pk,"__esModule",{value:!0});var Ee=$e(),dW={message:({schemaCode:e})=>Ee.str`must match format "${e}"`,params:({schemaCode:e})=>Ee._`{format: ${e}}`},pW={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dW,code(e,t){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:p}=a;if(!l.validateFormats)return;if(s)g();else m();function g(){let b=r.scopeValue("formats",{ref:p.formats,code:l.code.formats}),h=r.const("fDef",Ee._`${b}[${o}]`),y=r.let("fType"),v=r.let("format");r.if(Ee._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,Ee._`${h}.type || "string"`).assign(v,Ee._`${h}.validate`),()=>r.assign(y,Ee._`"string"`).assign(v,h)),e.fail$data(Ee.or(k(),S()));function k(){if(l.strictSchema===!1)return Ee.nil;return Ee._`${o} && !${v}`}function S(){let E=u.$async?Ee._`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:Ee._`${v}(${n})`,j=Ee._`(typeof ${v} == "function" ? ${E} : ${v}.test(${n}))`;return Ee._`${v} && ${v} !== true && ${y} === ${t} && !${j}`}}function m(){let b=p.formats[i];if(!b){k();return}if(b===!0)return;let[h,y,v]=S(b);if(h===t)e.pass(E());function k(){if(l.strictSchema===!1){p.logger.warn(j());return}throw Error(j());function j(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function S(j){let R=j instanceof RegExp?Ee.regexpCode(j):l.code.formats?Ee._`${l.code.formats}${Ee.getProperty(i)}`:void 0,A=r.scopeValue("formats",{key:i,ref:j,code:R});if(typeof j=="object"&&!(j instanceof RegExp))return[j.type||"string",j.validate,Ee._`${A}.validate`];return["string",j,A]}function E(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!u.$async)throw Error("async format in sync schema");return Ee._`await ${v}(${n})`}return typeof y=="function"?Ee._`${v}(${n})`:Ee._`${v}.test(${n})`}}}};Pk.default=pW});var rm=C(function(kk){Object.defineProperty(kk,"__esModule",{value:!0});var hW=jk(),gW=[hW.default];kk.default=gW});var nm=C(function(_k){Object.defineProperty(_k,"__esModule",{value:!0});_k.contentVocabulary=_k.metadataVocabulary=void 0;_k.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];_k.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ok=C(function(Ak){Object.defineProperty(Ak,"__esModule",{value:!0});var xW=Gp(),$W=Kp(),vW=Qp(),wW=lk(),SW=bk(),EW=Ek(),PW=rm(),iu=nm(),jW=[wW.default,xW.default,$W.default,(0,vW.default)(!0),PW.default,iu.metadataVocabulary,iu.contentVocabulary,SW.default,EW.default];Ak.default=jW});var Ik=C(function(Nk){Object.defineProperty(Nk,"__esModule",{value:!0});Nk.DiscrError=void 0;var Ck;(function(e){e.Tag="tag",e.Mapping="mapping"})(Ck||(Nk.DiscrError=Ck={}))});var sm=C(function(Jk){Object.defineProperty(Jk,"__esModule",{value:!0});var Nr=$e(),po=Ik(),ou=wa(),_W=ro(),Mk=_e(),RW={message:({params:{discrError:e,tagName:t}})=>e===po.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Nr._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},AW={keyword:"discriminator",type:"object",schemaType:"object",error:RW,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",Nr._`${r}${Nr.getProperty(a)}`);t.if(Nr._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:po.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=g();t.if(!1);for(let b in m)t.elseIf(Nr._`${c} === ${b}`),t.assign(l,p(m[b]));t.else(),e.error(!1,{discrError:po.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function p(m){let b=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:m},b);return e.mergeEvaluated(h,Nr.Name),b}function g(){var m;let b={},h=v(s),y=!0;for(let E=0;E<o.length;E++){let j=o[E];if((j===null||j===void 0?void 0:j.$ref)&&!Mk.schemaHasRulesButRef(j,i.self.RULES)){let A=j.$ref;if(j=ou.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,A),j instanceof ou.SchemaEnv)j=j.schema;if(j===void 0)throw new _W.default(i.opts.uriResolver,i.baseId,A)}let R=(m=j===null||j===void 0?void 0:j.properties)===null||m===void 0?void 0:m[a];if(typeof R!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||v(j)),k(R,E)}if(!y)throw Error(`discriminator: "${a}" must be required`);return b;function v({required:E}){return Array.isArray(E)&&E.includes(a)}function k(E,j){if(E.const)S(E.const,j);else if(E.enum)for(let R of E.enum)S(R,j);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(E,j){if(typeof E!="string"||E in b)throw Error(`discriminator: "${a}" values must be unique strings`);b[E]=j}}}};Jk.default=AW});var Dk=C(function(UQ,CW){CW.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 Lk=C(function(zQ,NW){NW.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 Fk=C(function(GQ,TW){TW.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 qk=C(function(KQ,IW){IW.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 Hk=C(function(YQ,MW){MW.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 Vk=C(function(XQ,JW){JW.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 Bk=C(function(ZQ,DW){DW.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 Wk=C(function(QQ,LW){LW.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 zk=C(function(Uk){Object.defineProperty(Uk,"__esModule",{value:!0});var FW=Dk(),qW=Lk(),HW=Fk(),VW=qk(),BW=Hk(),WW=Vk(),UW=Bk(),zW=Wk(),GW=["/properties"];function KW(e){return[FW,qW,HW,VW,BW,t(this,WW),UW,t(this,zW)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,GW):n}}Uk.default=KW});var am=C(function(cr,om){Object.defineProperty(cr,"__esModule",{value:!0});cr.MissingRefError=cr.ValidationError=cr.CodeGen=cr.Name=cr.nil=cr.stringify=cr.str=cr._=cr.KeywordCxt=cr.Ajv2020=void 0;var XW=zp(),ZW=Ok(),QW=sm(),eU=zk(),im="https://json-schema.org/draft/2020-12/schema";class Pa extends XW.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),ZW.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(QW.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;eU.default.call(this,e),this.refs["http://json-schema.org/schema"]=im}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(im)?im:void 0)}}cr.Ajv2020=Pa;om.exports=cr=Pa;om.exports.Ajv2020=Pa;Object.defineProperty(cr,"__esModule",{value:!0});cr.default=Pa;var tU=eo();Object.defineProperty(cr,"KeywordCxt",{enumerable:!0,get:function(){return tU.KeywordCxt}});var mo=$e();Object.defineProperty(cr,"_",{enumerable:!0,get:function(){return mo._}});Object.defineProperty(cr,"str",{enumerable:!0,get:function(){return mo.str}});Object.defineProperty(cr,"stringify",{enumerable:!0,get:function(){return mo.stringify}});Object.defineProperty(cr,"nil",{enumerable:!0,get:function(){return mo.nil}});Object.defineProperty(cr,"Name",{enumerable:!0,get:function(){return mo.Name}});Object.defineProperty(cr,"CodeGen",{enumerable:!0,get:function(){return mo.CodeGen}});var rU=$a();Object.defineProperty(cr,"ValidationError",{enumerable:!0,get:function(){return rU.default}});var nU=ro();Object.defineProperty(cr,"MissingRefError",{enumerable:!0,get:function(){return nU.default}})});import{existsSync as lu,readFileSync as oU}from"node:fs";import{createRequire as Gk}from"node:module";import{isAbsolute as aU,relative as lU,resolve as au}from"node:path";import{fileURLToPath as Kk,pathToFileURL as cU}from"node:url";function ja(e){return JSON.parse(oU(e,"utf8"))}async function Yk(e){let t=au(e),r=au(t,"project.json"),n=au(t,"project.schema.json");if(!lu(r))throw Error(`project.json not found in ${t}`);if(!lu(n))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"project.json#/extensions");let s=ja(r),i=ja(n);i.$id=cU(n).href;let o;try{({default:o}=await Promise.resolve().then(() => Yt(am(),1)))}catch(u){throw Error("Project validation requires ajv: bun add ajv",{cause:u})}let l=await new o({allErrors:!0,loadSchema:(u)=>uU(u,t),strict:!1}).compileAsync(i),c=l(s);return{errors:l.errors??null,valid:c}}async function uU(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=Kk(e),n=lU(t,r);if(n.startsWith("..")||aU(n))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(lu(r))return ja(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=Gk(au(t,"package.json")).resolve(a)}catch(u){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:u});try{c=Gk(import.meta.url).resolve(a)}catch(p){let g=Kk(new URL(`../${a.slice(l.length)}`,import.meta.url));if(lu(g))return ja(g);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:p})}}return ja(c)}var Xk=()=>{};function hn(e){return X(e.attributes)?e.attributes:{}}function Lt(e,t){let r=hn(e)[t];return T(r)?r:null}function dt(e){return T(e.tagName)?e.tagName.toLowerCase():""}function Gt(e,t="the popover"){let r=T(e.id)?e.id:Lt(e,"id");if(r)return`#${r}`;let n=dt(e);return n===""?t:`the <${n}>`}function pU(e){let t=hn(e).popover;return T(t)?t:null}function Qk(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(lm(n))t.add(s);let i=n.observedAttributes;if(Array.isArray(i)&&mU.every((o)=>i.includes(o)))r.add(s)}return{invokerTags:r,popoverTags:t}}function lm(e){return"popover"in hn(e)||"popover"in e}function ka(e,t){return lm(e)||(t?.popoverTags?.has(dt(e))??!1)}function Rs(e){if(T(e.id)&&e.id!=="")return e.id;let t=Lt(e,"id");return t===""?null:t}function*mn(e,t=[],r=null,n){yield{enclosing:r,node:e,path:t};let s=ka(e,n)?e:r,{children:i}=e;if(Array.isArray(i)){for(let[l,c]of i.entries())if(q(c))yield*mn(c,[...t,"children",l],s,n)}else if(X(i)&&Zt(i.map))yield*mn(i.map,[...t,"children","map"],s,n);let o=Zt(e.map)?e.map:null;if(o)yield*mn(o,[...t,"map"],s,n);let a=X(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(q(c))yield*mn(c,[...t,"cases",l],s,n)}function cm(e,t){let r=[];for(let{node:n}of mn(e,[],null,t)){if(!ka(n,t))continue;let s=Rs(n);if(s!==null&&!r.includes(s))r.push(s)}return r}function cu(e){return e.startsWith("@")}function e_(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function zt(e,t){let r=e?.[t];if(r===void 0||Is(r)||Array.isArray(r))return null;return String(r)}function t_(e){for(let[t,r]of Object.entries(e??{})){if(!Is(r))continue;if(e_(t)&&t.includes(":popover-open")&&zt(r,"display")!==null)return!0;if(cu(t)&&t_(r))return!0}return!1}function r_(e){for(let[t,r]of Object.entries(e??{})){if(!Is(r))continue;if(e_(t)&&t.includes(":popover-open"))return!0;if(cu(t)&&r_(r))return!0}return!1}function gU(e){return hU.some((t)=>zt(e,t)!==null)}function yU(e){if(!e)return[];let t=[];for(let[r,n]of Object.entries(e))if(cu(r)&&Is(n)&&zt(n,"display")!==null)t.push(r);return t}function n_(e){if(!e)return[];let t=[],r=zt(e,"transition");if(r!==null)t.push(r);for(let[n,s]of Object.entries(e))if(cu(n)&&Is(s))t.push(...n_(s));return t}function bU(e){if(!e)return!1;if(zt(e,"positionAnchor")!==null||zt(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(zt(e,t)??"").includes("anchor("))}function xU(e){if(!e)return!1;if(zt(e,"positionArea")!==null||zt(e,"position-area")!==null||zt(e,"positionTryFallbacks")!==null||zt(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function s_(e,t){let r=[...mn(e,[],null,t)],n=cm(e,t),s=r.some(({node:a})=>ka(a,t)),i=new Set;for(let{node:a}of r)if(Zk.has(dt(a))){let l=Lt(a,"popovertarget");if(l!==null)i.add(l)}let o=[];for(let{enclosing:a,node:l,path:c}of r)if(o.push(...$U(l,c,a,n,s,t)),lm(l))o.push(...vU(l,c,i));return o}function $U(e,t,r,n,s,i){let o=[],a=dt(e),l=Lt(e,"popovertarget"),c=Zk.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. ${Ke}`,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 u=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}". ${u}A target that names nothing does nothing, silently. ${Ke}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(r!==null&&Rs(r)!==null&&Rs(r)!==l)o.push({detail:`This control is inside ${Gt(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. ${Ke}`,message:`A control inside ${Gt(r)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&r!==null&&l===null){let u=Lt(e,"href")??(T(e.href)?e.href:null),p=Lt(e,"target")==="_blank",g=u!==null&&u.includes("#");if(p||g){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. ${Ke}`,message:`A link inside ${Gt(r)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return o}function vU(e,t,r){let n=[],{style:s}=e,i=Gt(e),o=pU(e);if(o!==null&&o!==""&&!dU.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". ${Ke}`,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(Tt(hn(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". ${Ke}`,fix:"mode",message:`${i} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=zt(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. ${Ke}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of yU(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. ${Ke}`,fix:"display",message:`${i} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(zt(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. ${Ke}`,fix:"display",message:`${i} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!r_(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. ${Ke}`,message:`${i} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!t_(s)&&a===null&&gU(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\`. ${Ke}`,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 n_(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. ${Ke}`,message:`${i} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(bU(s)&&!xU(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. ${Ke}`,message:`${i} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=Rs(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. ${Ke}`,message:`${i} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return n}var dU,Zk,mU,hU,Ke="See docs/framework/concepts/overlays.";var uu=H(()=>{Pe();dU=["auto","manual","hint"],Zk=new Set(["button","input"]);mU=["popovertarget","popovertargetaction","command","commandfor"];hU=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function bo(e,t){let r=hn(e),n=t in r?r[t]:e[t];if(n===void 0||n===null)return{kind:"absent"};if(Je(n)||X(n))return{kind:"bound"};if(T(n))return n.includes("${")?{kind:"bound"}:{kind:"text",text:n};return{isTrue:n===!0,kind:"other"}}function go(e,t){let r=bo(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Ft(e,t){return bo(e,t).kind!=="absent"}function As(e){let t=bo(e,"role");if(t.kind==="bound")return yo;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function fu(e){let t=bo(e,"id");if(t.kind==="bound")return yo;return t.kind==="text"&&t.text!==""?t.text:null}function Tr(e,t){let r=bo(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function du(e){let t=e.textContent;if(T(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Tr(e,"aria-label")||Ft(e,"aria-labelledby"))return!0;if(dt(e)==="img"&&(Tr(e,"alt")||Tr(e,"title")))return!0;if(dt(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(q(s)&&du(s))return!0}else if(r!=null)return!0;if(X(e.map))return!0;return(X(e.cases)?Object.values(e.cases):[]).some((s)=>Zt(s)&&du(s))}function*ho(e,t=[],r=[],n=[]){yield{node:e,path:t,roles:r,tags:n};let s=[...r,As(e)],i=[...n,dt(e)],{children:o}=e;if(Array.isArray(o)){for(let[a,l]of o.entries())if(q(l))yield*ho(l,[...t,"children",a],s,i)}else if(X(o)&&Zt(o.map))yield*ho(o.map,[...t,"children","map"],s,i);if(Zt(e.map))yield*ho(e.map,[...t,"map"],s,i);if(X(e.cases)){for(let[a,l]of Object.entries(e.cases))if(q(l))yield*ho(l,[...t,"cases",a],s,i)}}function kU(e){return e.some((t)=>t.includes("-"))}function gn(e,t,r,n,s,i="error"){return{criterion:s,detail:`${n} ${wU}`,message:r,path:t,rule:e,severity:i}}function i_(e,t,r){if(r.includes("label"))return!0;if(e===yo||t.bound)return!0;return e!==null&&t.ids.has(e)}function _U(e,t){let{node:r,path:n,tags:s}=e,i=dt(r),o=As(r);if(o==="bound")return null;if(Tr(r,"aria-label")||Ft(r,"aria-labelledby")||Tr(r,"title"))return null;let l=Gt(r,"the control"),c=(p)=>gn("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"),u=RU(r,i,t,s);if(u==="named"||u==="exempt")return null;if(o!==null&&SU.has(o))return du(r)?null:c("Give it text content, or an aria-label.");if(o!==null&&EU.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"&&Ft(r,"href"))return du(r)?null:c("Give it text content, or an aria-label.");if(u==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return c("Give it a value, or an aria-label.");if(u==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function RU(e,t,r,n){if(t==="area"){if(!Ft(e,"href"))return"none";return Tr(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return i_(fu(e),r,n)||Tr(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(go(e,"type")??"text").toLowerCase();if(s==="hidden"||Ft(e,"type")&&go(e,"type")===null)return"exempt";if(PU.has(s))return Tr(e,"value")?"named":"unnamed-value";if(s==="image")return Tr(e,"alt")?"named":"unnamed-alt";return i_(fu(e),r,n)||Tr(e,"placeholder")?"named":"unnamed"}function OU(e){let{node:t,path:r,tags:n}=e,s=dt(t);if(!s.includes("-")||!n.some((i)=>AU.has(i)))return null;return gn("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 CU(e){let{node:t,path:r}=e;if(dt(t)!=="img")return null;let n=As(t);if(n==="bound"||n==="presentation"||n==="none")return null;if(Ft(t,"alt")||Tr(t,"aria-label")||Ft(t,"aria-labelledby"))return null;return gn("img-alt-missing",r,`${Gt(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 TU(e,t){let{node:r,path:n}=e,s=[];for(let i of NU){let o=go(r,i);if(o===null)continue;for(let a of o.split(/\s+/))if(a!==""&&!t.has(a))s.push(gn("aria-target-missing",n,`${Gt(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 IU(e,t,r){for(let n of o_.get(t)??[]){let s=r.get(n);if(s===void 0)continue;if(s.bound)return!0;if(e===yo&&s.ids.size>0)return!0;if(e!==null&&e!==yo&&s.ids.has(e))return!0}return!1}function MU(e,t){let{node:r,path:n,roles:s,tags:i}=e,o=As(r);if(o===null||o==="bound"||n.length===0||kU(i))return null;if(s.includes("bound")||IU(fu(r),o,t))return null;let a=Gt(r,"the element");if(o==="tab"&&!s.includes("tablist"))return gn("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 gn("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 gn("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 JU(e){let t=[];for(let{node:r}of ho(e)){if(As(r)!=="tab")continue;let n=bo(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 DU(e){let{node:t,path:r}=e;if(As(t)!=="tablist")return null;let n=JU(t);if(n===null||n.length===0||n.includes(!0))return null;return gn("tablist-none-selected",r,`${Gt(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 LU(e){let{node:t,path:r}=e,n=As(t);if(!(dt(t)==="dialog"||n==="dialog"||n==="alertdialog")||n==="bound")return null;if(Tr(t,"aria-label")||Ft(t,"aria-labelledby"))return null;return gn("dialog-unnamed",r,`${Gt(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 qU(e){let{node:t,path:r}=e;if(!Ft(t,"aria-activedescendant"))return null;let n=dt(t);if(FU.has(n)||n==="a"&&Ft(t,"href")||Ft(t,"tabIndex")||Ft(t,"tabindex")||Ft(t,"contenteditable"))return null;return gn("activedescendant-not-focusable",r,`${Gt(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 a_(e){let t=[...ho(e)],r=new Set,n={bound:!1,ids:new Set},s=new Map,i=!1;for(let{node:a}of t){let l=As(a);if(l!==null&&jU.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},p=go(a,"aria-owns");if(p===null)u.bound||=Ft(a,"aria-owns");else for(let g of p.split(/\s+/))if(g!=="")u.ids.add(g);s.set(l,u)}let c=fu(a);if(c===yo)i=!0;else if(c!==null)r.add(c);if(dt(a)==="label"){let u=go(a,"for")??go(a,"htmlFor");if(u===null)n.bound||=Ft(a,"for")||Ft(a,"htmlFor");else n.ids.add(u)}}let o=[];for(let a of t){let l=[_U(a,n),CU(a),MU(a,s),OU(a),DU(a),LU(a),qU(a)];for(let c of l)if(c)o.push(c);if(!i)o.push(...TU(a,r))}return o}var wU="See docs/framework/concepts/accessibility.",yo="bound",SU,EU,PU,o_,jU,AU,NU,FU;var l_=H(()=>{Pe();uu();SU=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),EU=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),PU=new Set(["button","reset","submit"]),o_=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),jU=new Set([...o_.values()].flat());AU=new Set(["select","jx-select"]);NU=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];FU=new Set(["button","input","select","textarea"])});function um(e){return dt(e)==="dialog"}function c_(e){return e.startsWith("--")}function GU(e){let t=[];for(let{node:r}of mn(e)){let n=Rs(r);if(um(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 YU(e,t){for(let{node:r}of mn(e)){if(r===e)continue;let n=dt(r);if(n==="button"){let s=Lt(r,"command"),i=Lt(r,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(i===null||i===t))return!0}if(n==="form"&&Lt(r,"method")?.toLowerCase()==="dialog")return!0}return!1}function f_(e,t){let r=[...mn(e,[],null,t)],n=GU(e),s=cm(e,t),i=n.length>0||s.length>0,o=new Map,a=new Map;for(let{node:c}of r){let u=Rs(c);if(u!==null&&!o.has(u))o.set(u,c);if(dt(c)==="button"){let p=Lt(c,"commandfor"),g=Lt(c,"command");if(p!==null){let m=a.get(p)??new Set;m.add(g??""),a.set(p,m)}}}let l=[];for(let{node:c,path:u}of r)if(l.push(...XU(c,u,o,n,s,i,t)),um(c))l.push(...ZU(c,u,a));return l}function XU(e,t,r,n,s,i,o){let a=[],l=dt(e),c=o?.invokerTags?.has(l)??!1,u=Lt(e,"command"),p=Lt(e,"commandfor");if(!(u!==null||p!==null||("command"in hn(e))||("commandfor"in hn(e))))return a;let m=Gt(e,"the element");if(!zU.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. ${Ke}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!WU.has(u)&&!c_(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${u_.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. ${Ke}`,message:`${m} declares command="${u}", 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),h=n.includes(p),y=s.includes(p);if(!b&&i){let v=[...n,...s].map((k)=>`"${k}"`).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. ${Ke}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&b){if(HU.has(u)&&!um(b))a.push({detail:`\`${u}\` acts on a <dialog>, and "${p}" is ${y?"a popover":`a <${dt(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."} ${Ke}`,message:`${m} sends ${u} to "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(VU.has(u)&&!ka(b,o))a.push({detail:`\`${u}\` acts on a popover, and "${p}" is ${h?"a dialog":`a <${dt(b)||"element"}>`} that declares no \`popover\`. The click is ignored. ${h?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${Ke}`,message:`${m} sends ${u} to "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(c_(u)&&!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. ${Ke}`,message:`${m} sends ${u} to "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function ZU(e,t,r){let n=[],s=Gt(e,"the dialog"),i=Rs(e),{style:o}=e,a=Lt(e,"closedby");if(a!==null&&!UU.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. ${Ke}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(zt(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. ${Ke}`,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=Lt(e,"open")!==null||hn(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. ${Ke}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!YU(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"\`. ${Ke}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return n}var u_,HU,VU,BU,WU,UU,zU;var d_=H(()=>{Pe();uu();u_=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],HU=new Set(["show-modal","close","request-close"]),VU=new Set(["toggle-popover","show-popover","hide-popover"]),BU=["any","closerequest","none"],WU=new Set(u_),UU=new Set(BU),zU=new Set(["button"])});var w_=C(function($_){Object.defineProperty($_,"__esModule",{value:!0});$_.formatNames=$_.fastFormats=$_.fullFormats=void 0;function yn(e,t){return{validate:e,compare:t}}$_.fullFormats={date:yn(g_,mm),time:yn(dm(!0),hm),"date-time":yn(p_(!0),b_),"iso-time":yn(dm(),y_),"iso-date-time":yn(p_(),x_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:s6,"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:f6,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:i6,int32:{type:"number",validate:l6},int64:{type:"number",validate:c6},float:{type:"number",validate:h_},double:{type:"number",validate:h_},password:!0,binary:!0};$_.fastFormats={...$_.fullFormats,date:yn(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,mm),time:yn(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,hm),"date-time":yn(/^\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,b_),"iso-time":yn(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,y_),"iso-date-time":yn(/^\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,x_),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};$_.formatNames=Object.keys($_.fullFormats);function QU(e){return e%4===0&&(e%100!==0||e%400===0)}var e6=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,t6=[0,31,28,31,30,31,30,31,31,30,31,30,31];function g_(e){let t=e6.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&&QU(r)?29:t6[n])}function mm(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var fm=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function dm(e){return function(r){let n=fm.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),u=+(n[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&i<=59&&o<60)return!0;let p=i-u*l,g=s-c*l-(p<0?1:0);return(g===23||g===-1)&&(p===59||p===-1)&&o<61}}function hm(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 y_(e,t){if(!(e&&t))return;let r=fm.exec(e),n=fm.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 pm=/t|\s/i;function p_(e){let t=dm(e);return function(n){let s=n.split(pm);return s.length===2&&g_(s[0])&&t(s[1])}}function b_(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 x_(e,t){if(!(e&&t))return;let[r,n]=e.split(pm),[s,i]=t.split(pm),o=mm(r,s);if(o===void 0)return;return o||hm(n,i)}var r6=/\/|:/,n6=/^(?:[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 s6(e){return r6.test(e)&&n6.test(e)}var m_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function i6(e){return m_.lastIndex=0,m_.test(e)}var o6=-2147483648,a6=2147483647;function l6(e){return Number.isInteger(e)&&e<=a6&&e>=o6}function c6(e){return Number.isInteger(e)}function h_(){return!0}var u6=/[^\\]\\Z/;function f6(e){if(u6.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var E_=C(function(S_){Object.defineProperty(S_,"__esModule",{value:!0});var p6=Gp(),m6=Kp(),h6=Qp(),g6=rm(),pu=nm(),y6=[p6.default,m6.default,(0,h6.default)(),g6.default,pu.metadataVocabulary,pu.contentVocabulary];S_.default=y6});var P_=C(function(Eee,x6){x6.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 k_=C(function(ur,ym){Object.defineProperty(ur,"__esModule",{value:!0});ur.MissingRefError=ur.ValidationError=ur.CodeGen=ur.Name=ur.nil=ur.stringify=ur.str=ur._=ur.KeywordCxt=ur.Ajv=void 0;var $6=zp(),v6=E_(),w6=sm(),j_=P_(),S6=["/properties"],mu="http://json-schema.org/draft-07/schema";class _a extends $6.default{_addVocabularies(){if(super._addVocabularies(),v6.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(w6.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(j_,S6):j_;this.addMetaSchema(e,mu,!1),this.refs["http://json-schema.org/schema"]=mu}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(mu)?mu:void 0)}}ur.Ajv=_a;ym.exports=ur=_a;ym.exports.Ajv=_a;Object.defineProperty(ur,"__esModule",{value:!0});ur.default=_a;var E6=eo();Object.defineProperty(ur,"KeywordCxt",{enumerable:!0,get:function(){return E6.KeywordCxt}});var xo=$e();Object.defineProperty(ur,"_",{enumerable:!0,get:function(){return xo._}});Object.defineProperty(ur,"str",{enumerable:!0,get:function(){return xo.str}});Object.defineProperty(ur,"stringify",{enumerable:!0,get:function(){return xo.stringify}});Object.defineProperty(ur,"nil",{enumerable:!0,get:function(){return xo.nil}});Object.defineProperty(ur,"Name",{enumerable:!0,get:function(){return xo.Name}});Object.defineProperty(ur,"CodeGen",{enumerable:!0,get:function(){return xo.CodeGen}});var P6=$a();Object.defineProperty(ur,"ValidationError",{enumerable:!0,get:function(){return P6.default}});var j6=ro();Object.defineProperty(ur,"MissingRefError",{enumerable:!0,get:function(){return j6.default}})});var A_=C(function(R_){Object.defineProperty(R_,"__esModule",{value:!0});R_.formatLimitDefinition=void 0;var __=k_(),lt=$e(),Os=lt.operators,hu={formatMaximum:{okStr:"<=",ok:Os.LTE,fail:Os.GT},formatMinimum:{okStr:">=",ok:Os.GTE,fail:Os.LT},formatExclusiveMaximum:{okStr:"<",ok:Os.LT,fail:Os.GTE},formatExclusiveMinimum:{okStr:">",ok:Os.GT,fail:Os.LTE}},R6={message:({keyword:e,schemaCode:t})=>lt.str`should be ${hu[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>lt._`{comparison: ${hu[e].okStr}, limit: ${t}}`};R_.formatLimitDefinition={keyword:Object.keys(hu),type:"string",schemaType:"string",$data:!0,error:R6,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 __.KeywordCxt(i,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let g=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),m=t.const("fmt",lt._`${g}[${l.schemaCode}]`);e.fail$data(lt.or(lt._`typeof ${m} != "object"`,lt._`${m} instanceof RegExp`,lt._`typeof ${m}.compare != "function"`,p(m)))}function u(){let g=l.schema,m=a.formats[g];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${g}" does not define "compare" function`);let b=t.scopeValue("formats",{key:g,ref:m,code:o.code.formats?lt._`${o.code.formats}${lt.getProperty(g)}`:void 0});e.fail$data(p(b))}function p(g){return lt._`${g}.compare(${r}, ${n}) ${hu[s].fail} 0`}},dependencies:["format"]};var A6=(e)=>(e.addKeyword(R_.formatLimitDefinition),e);R_.default=A6});var T_=C(function(Ra,N_){Object.defineProperty(Ra,"__esModule",{value:!0});var Ir=w_(),C6=A_(),$o=$e(),O_=new $o.Name("fullFormats"),N6=new $o.Name("fastFormats"),xm=(e,t={keywords:!0})=>{if(Array.isArray(t))return C_(e,t,Ir.fullFormats,O_),e;let[r,n]=t.mode==="fast"?[Ir.fastFormats,N6]:[Ir.fullFormats,O_],s=t.formats||Ir.formatNames;if(C_(e,s,r,n),t.keywords)(0,C6.default)(e);return e};xm.get=(e,t="full")=>{let n=(t==="fast"?Ir.fastFormats:Ir.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function C_(e,t,r,n){var s,i;(s=(i=e.opts.code).formats)!==null&&s!==void 0||(i.formats=$o._`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}N_.exports=Ra=xm;Object.defineProperty(Ra,"__esModule",{value:!0});Ra.default=xm});import{existsSync as M_,readFileSync as J_,readdirSync as D_,statSync as L_}from"node:fs";import{createRequire as T6}from"node:module";import{join as F_,relative as $m,resolve as vm}from"node:path";async function D6(){try{let{default:e}=await Promise.resolve().then(() => Yt(am(),1)),{default:t}=await Promise.resolve().then(() => Yt(T_(),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 q_(e,t={}){let r=vm(e),n=[],s=[],i=0;for(let S of["project.schema.json","document.schema.json"]){let E=vm(r,S);if(!M_(E))continue;i+=1;let j=Aa(E),R=F6(j);if(R.length>0)n.push({errors:R.map(({reason:A,ref:_})=>({message:`$ref "${_}" ${A} — 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 Yk(r);if(i+=1,!o.valid)n.push({errors:o.errors??[],file:"project.json"});let{addFormats:a,Ajv:l}=await D6(),{document:c}=await Aw(r,{write:!1}),u=new l({allErrors:!0,ownProperties:!0,strict:!1});a(u);let p=u.compile(c),g=Qk(I_(r).flatMap((S)=>{try{return[JSON.parse(J_(S,"utf8"))]}catch{return[]}}));for(let S of I6)for(let E of B_(vm(r,S))){if(E.endsWith(".class.json"))continue;i+=1;let j=Aa(E);if(p(j))s.push(...L6(j,$m(r,E),g));else n.push({errors:p.errors??[],file:$m(r,E)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let b=m.compile(lp());for(let S of I_(r)){i+=1;let E=Aa(S);if(!b(E))n.push({errors:b.errors??[],file:$m(r,S)})}let{config:h}=Kn(r),y=await Gn(r,h),v=T6(import.meta.url);for(let S of y.extensions)for(let E of["project","document","fields"]){let j=S.schemas[E];if(!j)continue;i+=1;let R=new l({allErrors:!0,ownProperties:!0,strict:!1});a(R);for(let A of J6){let _=v.resolve(A);R.addSchema(Aa(_))}try{R.compile(Aa(j))}catch(A){n.push({errors:[{message:A instanceof Error?A.message:String(A)}],file:`${S.specifier} (${E} fragment)`})}}let k=t.strict===!0&&s.some((S)=>S.severity==="error");return{checked:i,issues:n,lint:s,valid:n.length===0&&!k}}function Aa(e){return JSON.parse(J_(e,"utf8"))}function L6(e,t,r){let n=[];for(let s of s_(e,r))n.push({...wm(s),file:t,source:"popover"});for(let s of f_(e,r))n.push({...wm(s),file:t,source:"dialog"});for(let s of a_(e))n.push({...wm(s),criterion:s.criterion,file:t,source:"accessibility"});return n}function wm(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function H_(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 F6(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(!q(o))return!1;if(o=o[l],o===void 0)return!1}return!0},s=(i)=>{if(!X(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(!q6.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(X(l)){if(s(l),V_.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function B_(e){if(!M_(e))return[];let t=[];for(let r of D_(e)){let n=F_(e,r);if(L_(n).isDirectory())t.push(...B_(n));else if(r.endsWith(".json"))t.push(n)}return t.toSorted()}function I_(e){let t=[],r=(n)=>{for(let s of D_(n)){if(M6.has(s))continue;let i=F_(n,s);if(L_(i).isDirectory())r(i);else if(s.endsWith(".class.json"))t.push(i)}};return r(e),t.toSorted()}function W_(e){let t=[];for(let r of e.issues){t.push(`${r.file}:`);for(let n of r.errors){let s=X(n)?n:{},{instancePath:i,message:o}=s;t.push(` - ${i||"/"}: ${o??JSON.stringify(n)}`)}}return t}var I6,M6,J6,V_,q6;var U_=H(()=>{vS();Xk();l_();d_();uu();Pe();jn();jo();Kd();I6=["components","pages","layouts"],M6=new Set(["node_modules","dist",".git"]),J6=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];V_=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),q6=new Set([...V_,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});hr();import{relative as Sm,resolve as z_}from"node:path";async function H6(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
613
+ deps: ${r}}`};var Vz={keyword:"dependencies",type:"object",schemaType:"object",error:hR.error,code(e){let[t,r]=Wz(e);pR(e,t),mR(e,r)}};function Wz({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 pR(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=Kn.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)Kn.checkReportMissingProp(e,c)});else r.if(Oa._`${l} && (${Kn.checkMissingProp(e,a,i)})`),Kn.reportMissingProp(e,i),r.else()}}hR.validatePropertyDeps=pR;function mR(e,t=e.schema){let{gen:r,data:n,keyword:s,it:i}=e,o=r.name("valid");for(let a in t){if(dR.alwaysValidSchema(i,t[a]))continue;r.if(Kn.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)}}hR.validateSchemaDeps=mR;hR.default=Vz});var $R=N(function(xR){Object.defineProperty(xR,"__esModule",{value:!0});var id=$e(),bR=Oe(),Uz={message:"property name must be valid",params:({params:e})=>id._`{propertyName: ${e.propertyName}}`},zz={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Uz,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(bR.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(id.not(i),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(i)}};xR.default=zz});var zg=N(function(wR){Object.defineProperty(wR,"__esModule",{value:!0});var yi=nn(),yt=$e(),Kz=tn(),bi=Oe(),Yz={message:"must NOT have additional properties",params:({params:e})=>yt._`{additionalProperty: ${e.additionalProperty}}`},Xz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Yz,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"&&bi.alwaysValidSchema(o,r))return;let c=yi.allSchemaProperties(n.properties),u=yi.allSchemaProperties(n.patternProperties);p(),e.ok(yt._`${i} === ${Kz.default.errors}`);function p(){t.forIn("key",s,(y)=>{if(!c.length&&!u.length)b(y);else t.if(h(y),()=>b(y))})}function h(y){let w;if(c.length>8){let P=bi.schemaRefOrVal(o,n.properties,"properties");w=yi.isOwnProperty(t,P,y)}else if(c.length)w=yt.or(...c.map((P)=>yt._`${y} === ${P}`));else w=yt.nil;if(u.length)w=yt.or(w,...u.map((P)=>yt._`${yi.usePattern(e,P)}.test(${y})`));return yt.not(w)}function m(y){t.code(yt._`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"&&!bi.alwaysValidSchema(o,r)){let w=t.name("valid");if(l.removeAdditional==="failing")g(y,w,!1),t.if(yt.not(w),()=>{e.reset(),m(y)});else if(g(y,w),!a)t.if(yt.not(w),()=>t.break())}}function g(y,w,P){let S={keyword:"additionalProperties",dataProp:y,dataPropType:bi.Type.Str};if(P===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,w)}}};wR.default=Xz});var PR=N(function(ER){Object.defineProperty(ER,"__esModule",{value:!0});var SR=va(),od=nn(),Ca=Oe(),vR=zg(),Qz={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)vR.default.code(new SR.KeywordCxt(i,vR.default,"additionalProperties"));let o=od.allSchemaProperties(r);for(let p of o)i.definedProperties.add(p);if(i.opts.unevaluated&&o.length&&i.props!==!0)i.props=Ca.mergeEvaluated.props(t,Ca.toHash(o),i.props);let a=o.filter((p)=>!Ca.alwaysValidSchema(i,r[p]));if(a.length===0)return;let l=t.name("valid");for(let p of a){if(c(p))u(p);else{if(t.if(od.propertyInData(t,s,p,i.opts.ownProperties)),u(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 u(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};ER.default=Qz});var kR=N(function(jR){Object.defineProperty(jR,"__esModule",{value:!0});var ad=nn(),xi=$e(),ld=Oe(),cd=Oe(),t8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,a=ad.allSchemaProperties(r),l=a.filter((g)=>ld.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,u=t.name("valid");if(i.props!==!0&&!(i.props instanceof xi.Name))i.props=cd.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(u,!0),b(g),t.if(u)}}function m(g){for(let y in c)if(new RegExp(g).test(y))ld.checkStrictMode(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function b(g){t.forIn("key",n,(y)=>{t.if(xi._`${ad.usePattern(e,g)}.test(${y})`,()=>{let w=l.includes(g);if(!w)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:cd.Type.Str},u);if(i.opts.unevaluated&&p!==!0)t.assign(xi._`${p}[${y}]`,!0);else if(!w&&!i.allErrors)t.if(xi.not(u),()=>t.break())})})}}};jR.default=t8});var RR=N(function(AR){Object.defineProperty(AR,"__esModule",{value:!0});var _R=Oe(),n8={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(_R.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"}};AR.default=n8});var NR=N(function(CR){Object.defineProperty(CR,"__esModule",{value:!0});var OR=nn(),i8={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:OR.validateUnion,error:{message:"must match a schema in anyOf"}};CR.default=i8});var JR=N(function(IR){Object.defineProperty(IR,"__esModule",{value:!0});var $i=$e(),TR=Oe(),a8={message:"must match exactly one schema in oneOf",params:({params:e})=>$i._`{passingSchemas: ${e.passing}}`},l8={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:a8,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((u,p)=>{let h;if(TR.alwaysValidSchema(s,u))t.var(l,!0);else h=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l);if(p>0)t.if($i._`${l} && ${o}`).assign(o,!1).assign(a,$i._`[${a}, ${p}]`).else();t.if(l,()=>{if(t.assign(o,!0),t.assign(a,p),h)e.mergeEvaluated(h,$i.Name)})})}}};IR.default=l8});var LR=N(function(DR){Object.defineProperty(DR,"__esModule",{value:!0});var MR=Oe(),u8={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(MR.alwaysValidSchema(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(a)})}};DR.default=u8});var VR=N(function(qR){Object.defineProperty(qR,"__esModule",{value:!0});var wi=$e(),ud=Oe(),d8={message:({params:e})=>wi.str`must match "${e.ifClause}" schema`,params:({params:e})=>wi._`{failingKeyword: ${e.ifClause}}`},p8={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:d8,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)ud.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=FR(n,"then"),i=FR(n,"else");if(!s&&!i)return;let o=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&i){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,c("then",u),c("else",u))}else if(s)t.if(a,c("then"));else t.if(wi.not(a),c("else"));e.pass(o,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,p){return()=>{let h=e.subschema({keyword:u},a);if(t.assign(o,a),e.mergeValidEvaluated(h,o),p)t.assign(p,wi._`${u}`);else e.setParams({ifClause:u})}}}};function FR(e,t){let r=e.schema[t];return r!==void 0&&!ud.alwaysValidSchema(e,r)}qR.default=p8});var BR=N(function(HR){Object.defineProperty(HR,"__esModule",{value:!0});var WR=Oe(),h8={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)WR.checkStrictMode(r,`"${e}" without "if" is ignored`)}};HR.default=h8});var Gg=N(function(UR){Object.defineProperty(UR,"__esModule",{value:!0});var y8=Bg(),b8=sR(),x8=Ug(),$8=cR(),w8=fR(),v8=sd(),S8=$R(),E8=zg(),P8=PR(),j8=kR(),k8=RR(),_8=NR(),A8=JR(),R8=LR(),O8=VR(),C8=BR();function N8(e=!1){let t=[k8.default,_8.default,A8.default,R8.default,O8.default,C8.default,S8.default,E8.default,v8.default,P8.default,j8.default];if(e)t.push(b8.default,$8.default);else t.push(y8.default,x8.default);return t.push(w8.default),t}UR.default=N8});var Kg=N(function(KR){Object.defineProperty(KR,"__esModule",{value:!0});KR.dynamicAnchor=void 0;var Na=$e(),I8=tn(),fd=nc(),zR=Qf(),J8={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>GR(e,e.schema)};function GR(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let s=Na._`${I8.default.dynamicAnchors}${Na.getProperty(t)}`,i=n.errSchemaPath==="#"?n.validateName:M8(e);r.if(Na._`!${s}`,()=>r.assign(s,i))}KR.dynamicAnchor=GR;function M8(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 fd.SchemaEnv({schema:r,schemaId:l,root:s,baseId:i,localRefs:o,meta:a});return fd.compileSchema.call(n,c),zR.getValidate(e,c)}KR.default=J8});var Yg=N(function(ZR){Object.defineProperty(ZR,"__esModule",{value:!0});ZR.dynamicRef=void 0;var dd=$e(),L8=tn(),pd=Qf(),F8={keyword:"$dynamicRef",schemaType:"string",code:(e)=>XR(e,e.schema)};function XR(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",dd._`${L8.default.dynamicAnchors}${dd.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(()=>{pd.callRef(e,l),r.let(c,!0)}):()=>pd.callRef(e,l)}}ZR.dynamicRef=XR;ZR.default=F8});var nO=N(function(rO){Object.defineProperty(rO,"__esModule",{value:!0});var eO=Kg(),tO=Oe(),V8={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)eO.dynamicAnchor(e,"");else tO.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};rO.default=V8});var oO=N(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});var sO=Yg(),H8={keyword:"$recursiveRef",schemaType:"string",code:(e)=>sO.dynamicRef(e,e.schema)};iO.default=H8});var lO=N(function(aO){Object.defineProperty(aO,"__esModule",{value:!0});var U8=Kg(),z8=Yg(),G8=nO(),K8=oO(),Y8=[U8.default,z8.default,G8.default,K8.default];aO.default=Y8});var uO=N(function(cO){Object.defineProperty(cO,"__esModule",{value:!0});var md=sd(),Z8={keyword:"dependentRequired",type:"object",schemaType:"object",error:md.error,code:(e)=>md.validatePropertyDeps(e)};cO.default=Z8});var pO=N(function(dO){Object.defineProperty(dO,"__esModule",{value:!0});var fO=sd(),e9={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>fO.validateSchemaDeps(e)};dO.default=e9});var gO=N(function(hO){Object.defineProperty(hO,"__esModule",{value:!0});var mO=Oe(),r9={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)mO.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};hO.default=r9});var bO=N(function(yO){Object.defineProperty(yO,"__esModule",{value:!0});var s9=uO(),i9=pO(),o9=gO(),a9=[s9.default,i9.default,o9.default];yO.default=a9});var $O=N(function(xO){Object.defineProperty(xO,"__esModule",{value:!0});var tr=$e(),hd=Oe(),c9=tn(),u9={message:"must NOT have unevaluated properties",params:({params:e})=>tr._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},f9={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:u9,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 tr.Name)t.if(tr._`${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(u(a,p),()=>l(p)));i.props=!0,e.ok(tr._`${s} === ${c9.default.errors}`);function l(p){if(r===!1){if(e.setParams({unevaluatedProperty:p}),e.error(),!o)t.break();return}if(!hd.alwaysValidSchema(i,r)){let h=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:p,dataPropType:hd.Type.Str},h),!o)t.if(tr.not(h),()=>t.break())}}function c(p,h){return tr._`!${p} || !${p}[${h}]`}function u(p,h){let m=[];for(let b in p)if(p[b]===!0)m.push(tr._`${h} !== ${b}`);return tr.and(...m)}}};xO.default=f9});var vO=N(function(wO){Object.defineProperty(wO,"__esModule",{value:!0});var Rr=$e(),gd=Oe(),p9={message:({params:{len:e}})=>Rr.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Rr._`{limit: ${e}}`},m9={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:p9,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",Rr._`${n}.length`);if(r===!1)e.setParams({len:i}),e.fail(Rr._`${o} > ${i}`);else if(typeof r=="object"&&!gd.alwaysValidSchema(s,r)){let l=t.var("valid",Rr._`${o} <= ${i}`);t.if(Rr.not(l),()=>a(l,i)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,o,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:gd.Type.Num},l),!s.allErrors)t.if(Rr.not(l),()=>t.break())})}}};wO.default=m9});var EO=N(function(SO){Object.defineProperty(SO,"__esModule",{value:!0});var g9=$O(),y9=vO(),b9=[g9.default,y9.default];SO.default=b9});var jO=N(function(PO){Object.defineProperty(PO,"__esModule",{value:!0});var Pe=$e(),$9={message:({schemaCode:e})=>Pe.str`must match format "${e}"`,params:({schemaCode:e})=>Pe._`{format: ${e}}`},w9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:$9,code(e,t){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,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",Pe._`${b}[${o}]`),y=r.let("fType"),w=r.let("format");r.if(Pe._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,Pe._`${g}.type || "string"`).assign(w,Pe._`${g}.validate`),()=>r.assign(y,Pe._`"string"`).assign(w,g)),e.fail$data(Pe.or(P(),S()));function P(){if(l.strictSchema===!1)return Pe.nil;return Pe._`${o} && !${w}`}function S(){let E=u.$async?Pe._`(${g}.async ? await ${w}(${n}) : ${w}(${n}))`:Pe._`${w}(${n})`,k=Pe._`(typeof ${w} == "function" ? ${E} : ${w}.test(${n}))`;return Pe._`${w} && ${w} !== true && ${y} === ${t} && !${k}`}}function m(){let b=p.formats[i];if(!b){P();return}if(b===!0)return;let[g,y,w]=S(b);if(g===t)e.pass(E());function P(){if(l.strictSchema===!1){p.logger.warn(k());return}throw Error(k());function k(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function S(k){let A=k instanceof RegExp?Pe.regexpCode(k):l.code.formats?Pe._`${l.code.formats}${Pe.getProperty(i)}`:void 0,R=r.scopeValue("formats",{key:i,ref:k,code:A});if(typeof k=="object"&&!(k instanceof RegExp))return[k.type||"string",k.validate,Pe._`${R}.validate`];return["string",k,R]}function E(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!u.$async)throw Error("async format in sync schema");return Pe._`await ${w}(${n})`}return typeof y=="function"?Pe._`${w}(${n})`:Pe._`${w}.test(${n})`}}}};PO.default=w9});var Xg=N(function(kO){Object.defineProperty(kO,"__esModule",{value:!0});var S9=jO(),E9=[S9.default];kO.default=E9});var Zg=N(function(_O){Object.defineProperty(_O,"__esModule",{value:!0});_O.contentVocabulary=_O.metadataVocabulary=void 0;_O.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];_O.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var OO=N(function(RO){Object.defineProperty(RO,"__esModule",{value:!0});var k9=Wg(),_9=Hg(),A9=Gg(),R9=lO(),O9=bO(),C9=EO(),N9=Xg(),yd=Zg(),T9=[R9.default,k9.default,_9.default,(0,A9.default)(!0),N9.default,yd.metadataVocabulary,yd.contentVocabulary,O9.default,C9.default];RO.default=T9});var IO=N(function(NO){Object.defineProperty(NO,"__esModule",{value:!0});NO.DiscrError=void 0;var CO;(function(e){e.Tag="tag",e.Mapping="mapping"})(CO||(NO.DiscrError=CO={}))});var Qg=N(function(MO){Object.defineProperty(MO,"__esModule",{value:!0});var on=$e(),Ta=IO(),bd=nc(),J9=Ea(),JO=Oe(),M9={message:({params:{discrError:e,tagName:t}})=>e===Ta.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>on._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},D9={keyword:"discriminator",type:"object",schemaType:"object",error:M9,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",on._`${r}${on.getProperty(a)}`);t.if(on._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:Ta.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=h();t.if(!1);for(let b in m)t.elseIf(on._`${c} === ${b}`),t.assign(l,p(m[b]));t.else(),e.error(!1,{discrError:Ta.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,on.Name),b}function h(){var m;let b={},g=w(s),y=!0;for(let E=0;E<o.length;E++){let k=o[E];if((k===null||k===void 0?void 0:k.$ref)&&!JO.schemaHasRulesButRef(k,i.self.RULES)){let R=k.$ref;if(k=bd.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,R),k instanceof bd.SchemaEnv)k=k.schema;if(k===void 0)throw new J9.default(i.opts.uriResolver,i.baseId,R)}let A=(m=k===null||k===void 0?void 0:k.properties)===null||m===void 0?void 0:m[a];if(typeof A!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||w(k)),P(A,E)}if(!y)throw Error(`discriminator: "${a}" must be required`);return b;function w({required:E}){return Array.isArray(E)&&E.includes(a)}function P(E,k){if(E.const)S(E.const,k);else if(E.enum)for(let A of E.enum)S(A,k);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(E,k){if(typeof E!="string"||E in b)throw Error(`discriminator: "${a}" values must be unique strings`);b[E]=k}}}};MO.default=D9});var DO=N(function(Sae,F9){F9.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 LO=N(function(Eae,q9){q9.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 FO=N(function(Pae,V9){V9.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 qO=N(function(jae,W9){W9.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 VO=N(function(kae,H9){H9.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 WO=N(function(_ae,B9){B9.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 HO=N(function(Aae,U9){U9.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 BO=N(function(Rae,z9){z9.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 zO=N(function(UO){Object.defineProperty(UO,"__esModule",{value:!0});var G9=DO(),K9=LO(),Y9=FO(),X9=qO(),Z9=VO(),Q9=WO(),eG=HO(),tG=BO(),rG=["/properties"];function nG(e){return[G9,K9,Y9,X9,Z9,t(this,Q9),eG,t(this,tG)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,rG):n}}UO.default=nG});var ry=N(function(Or,ty){Object.defineProperty(Or,"__esModule",{value:!0});Or.MissingRefError=Or.ValidationError=Or.CodeGen=Or.Name=Or.nil=Or.stringify=Or.str=Or._=Or.KeywordCxt=Or.Ajv2020=void 0;var iG=Vg(),oG=OO(),aG=Qg(),lG=zO(),ey="https://json-schema.org/draft/2020-12/schema";class oc extends iG.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),oG.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(aG.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;lG.default.call(this,e),this.refs["http://json-schema.org/schema"]=ey}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ey)?ey:void 0)}}Or.Ajv2020=oc;ty.exports=Or=oc;ty.exports.Ajv2020=oc;Object.defineProperty(Or,"__esModule",{value:!0});Or.default=oc;var cG=va();Object.defineProperty(Or,"KeywordCxt",{enumerable:!0,get:function(){return cG.KeywordCxt}});var Ia=$e();Object.defineProperty(Or,"_",{enumerable:!0,get:function(){return Ia._}});Object.defineProperty(Or,"str",{enumerable:!0,get:function(){return Ia.str}});Object.defineProperty(Or,"stringify",{enumerable:!0,get:function(){return Ia.stringify}});Object.defineProperty(Or,"nil",{enumerable:!0,get:function(){return Ia.nil}});Object.defineProperty(Or,"Name",{enumerable:!0,get:function(){return Ia.Name}});Object.defineProperty(Or,"CodeGen",{enumerable:!0,get:function(){return Ia.CodeGen}});var uG=tc();Object.defineProperty(Or,"ValidationError",{enumerable:!0,get:function(){return uG.default}});var fG=Ea();Object.defineProperty(Or,"MissingRefError",{enumerable:!0,get:function(){return fG.default}})});import{existsSync as xd,readFileSync as mG}from"node:fs";import{createRequire as GO}from"node:module";import{isAbsolute as hG,relative as gG,resolve as ny}from"node:path";import{fileURLToPath as KO,pathToFileURL as yG}from"node:url";function ac(e){return JSON.parse(mG(e,"utf8"))}async function YO(e){let t=ny(e),r=kn(t),n=ny(t,"project.schema.json");if(!xd(r))throw Error(`project.json not found in ${t}`);if(!xd(n))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"project.json#/extensions");let s=ac(r),i=ac(n);i.$id=yG(n).href;let o;try{({default:o}=await Promise.resolve().then(() => gr(ry(),1)))}catch(u){throw Error("Project validation requires ajv: bun add ajv",{cause:u})}let l=await new o({allErrors:!0,loadSchema:(u)=>bG(u,t),strict:!1}).compileAsync(i),c=l(s);return{errors:l.errors??null,valid:c}}async function bG(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=KO(e),n=gG(t,r);if(n.startsWith("..")||hG(n))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(xd(r))return ac(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=GO(ny(t,"package.json")).resolve(a)}catch(u){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:u});try{c=GO(import.meta.url).resolve(a)}catch(p){let h=KO(new URL(`../${a.slice(l.length)}`,import.meta.url));if(xd(h))return ac(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 ac(c)}var XO=D(()=>{Io()});function Xn(e){return B(e.attributes)?e.attributes:{}}function rr(e,t){let r=Xn(e)[t];return O(r)?r:null}function Et(e){return O(e.tagName)?e.tagName.toLowerCase():""}function mr(e,t="the popover"){let r=O(e.id)?e.id:rr(e,"id");if(r)return`#${r}`;let n=Et(e);return n===""?t:`the <${n}>`}function wG(e){let t=Xn(e).popover;return O(t)?t:null}function QO(e){let t=new Set,r=new Set;for(let n of e){let s=n!==null&&O(n.tagName)?n.tagName:"";if(n===null||!s.includes("-"))continue;if(sy(n))t.add(s);let i=n.observedAttributes;if(Array.isArray(i)&&vG.every((o)=>i.includes(o)))r.add(s)}return{invokerTags:r,popoverTags:t}}function sy(e){return"popover"in Xn(e)||"popover"in e}function lc(e,t){return sy(e)||(t?.popoverTags?.has(Et(e))??!1)}function vi(e){if(O(e.id)&&e.id!=="")return e.id;let t=rr(e,"id");return t===""?null:t}function*Yn(e,t=[],r=null,n){yield{enclosing:r,node:e,path:t};let s=lc(e,n)?e:r,{children:i}=e;if(Array.isArray(i)){for(let[l,c]of i.entries())if(V(c))yield*Yn(c,[...t,"children",l],s,n)}else if(B(i)&&yr(i.map))yield*Yn(i.map,[...t,"children","map"],s,n);let o=yr(e.map)?e.map:null;if(o)yield*Yn(o,[...t,"map"],s,n);let a=B(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(V(c))yield*Yn(c,[...t,"cases",l],s,n)}function iy(e,t){let r=[];for(let{node:n}of Yn(e,[],null,t)){if(!lc(n,t))continue;let s=vi(n);if(s!==null&&!r.includes(s))r.push(s)}return r}function $d(e){return e.startsWith("@")}function eC(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function pr(e,t){let r=e?.[t];if(r===void 0||_i(r)||Array.isArray(r))return null;return String(r)}function tC(e){for(let[t,r]of Object.entries(e??{})){if(!_i(r))continue;if(eC(t)&&t.includes(":popover-open")&&pr(r,"display")!==null)return!0;if($d(t)&&tC(r))return!0}return!1}function rC(e){for(let[t,r]of Object.entries(e??{})){if(!_i(r))continue;if(eC(t)&&t.includes(":popover-open"))return!0;if($d(t)&&rC(r))return!0}return!1}function EG(e){return SG.some((t)=>pr(e,t)!==null)}function PG(e){if(!e)return[];let t=[];for(let[r,n]of Object.entries(e))if($d(r)&&_i(n)&&pr(n,"display")!==null)t.push(r);return t}function nC(e){if(!e)return[];let t=[],r=pr(e,"transition");if(r!==null)t.push(r);for(let[n,s]of Object.entries(e))if($d(n)&&_i(s))t.push(...nC(s));return t}function jG(e){if(!e)return!1;if(pr(e,"positionAnchor")!==null||pr(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(pr(e,t)??"").includes("anchor("))}function kG(e){if(!e)return!1;if(pr(e,"positionArea")!==null||pr(e,"position-area")!==null||pr(e,"positionTryFallbacks")!==null||pr(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function sC(e,t){let r=[...Yn(e,[],null,t)],n=iy(e,t),s=r.some(({node:a})=>lc(a,t)),i=new Set;for(let{node:a}of r)if(ZO.has(Et(a))){let l=rr(a,"popovertarget");if(l!==null)i.add(l)}let o=[];for(let{enclosing:a,node:l,path:c}of r)if(o.push(..._G(l,c,a,n,s,t)),sy(l))o.push(...AG(l,c,i));return o}function _G(e,t,r,n,s,i){let o=[],a=Et(e),l=rr(e,"popovertarget"),c=ZO.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. ${it}`,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 u=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}". ${u}A target that names nothing does nothing, silently. ${it}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(r!==null&&vi(r)!==null&&vi(r)!==l)o.push({detail:`This control is inside ${mr(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. ${it}`,message:`A control inside ${mr(r)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&r!==null&&l===null){let u=rr(e,"href")??(O(e.href)?e.href:null),p=rr(e,"target")==="_blank",h=u!==null&&u.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. ${it}`,message:`A link inside ${mr(r)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return o}function AG(e,t,r){let n=[],{style:s}=e,i=mr(e),o=wG(e);if(o!==null&&o!==""&&!$G.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". ${it}`,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(Yt(Xn(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". ${it}`,fix:"mode",message:`${i} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=pr(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. ${it}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of PG(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. ${it}`,fix:"display",message:`${i} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(pr(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. ${it}`,fix:"display",message:`${i} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!rC(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. ${it}`,message:`${i} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!tC(s)&&a===null&&EG(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\`. ${it}`,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 nC(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. ${it}`,message:`${i} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(jG(s)&&!kG(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. ${it}`,message:`${i} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=vi(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. ${it}`,message:`${i} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return n}var $G,ZO,vG,SG,it="See docs/framework/concepts/overlays.";var wd=D(()=>{ve();$G=["auto","manual","hint"],ZO=new Set(["button","input"]);vG=["popovertarget","popovertargetaction","command","commandfor"];SG=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function La(e,t){let r=Xn(e),n=t in r?r[t]:e[t];if(n===void 0||n===null)return{kind:"absent"};if(We(n)||B(n))return{kind:"bound"};if(O(n))return n.includes("${")?{kind:"bound"}:{kind:"text",text:n};return{isTrue:n===!0,kind:"other"}}function Ma(e,t){let r=La(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function nr(e,t){return La(e,t).kind!=="absent"}function Si(e){let t=La(e,"role");if(t.kind==="bound")return Da;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function vd(e){let t=La(e,"id");if(t.kind==="bound")return Da;return t.kind==="text"&&t.text!==""?t.text:null}function an(e,t){let r=La(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function Sd(e){let t=e.textContent;if(O(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(an(e,"aria-label")||nr(e,"aria-labelledby"))return!0;if(Et(e)==="img"&&(an(e,"alt")||an(e,"title")))return!0;if(Et(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let s of r)if(O(s)){if(s.trim()!=="")return!0}else if(V(s)&&Sd(s))return!0}else if(r!=null)return!0;if(B(e.map))return!0;return(B(e.cases)?Object.values(e.cases):[]).some((s)=>yr(s)&&Sd(s))}function*Ja(e,t=[],r=[],n=[]){yield{node:e,path:t,roles:r,tags:n};let s=[...r,Si(e)],i=[...n,Et(e)],{children:o}=e;if(Array.isArray(o)){for(let[a,l]of o.entries())if(V(l))yield*Ja(l,[...t,"children",a],s,i)}else if(B(o)&&yr(o.map))yield*Ja(o.map,[...t,"children","map"],s,i);if(yr(e.map))yield*Ja(e.map,[...t,"map"],s,i);if(B(e.cases)){for(let[a,l]of Object.entries(e.cases))if(V(l))yield*Ja(l,[...t,"cases",a],s,i)}}function IG(e){return e.some((t)=>t.includes("-"))}function Zn(e,t,r,n,s,i="error"){return{criterion:s,detail:`${n} ${RG}`,message:r,path:t,rule:e,severity:i}}function iC(e,t,r){if(r.includes("label"))return!0;if(e===Da||t.bound)return!0;return e!==null&&t.ids.has(e)}function JG(e,t){let{node:r,path:n,tags:s}=e,i=Et(r),o=Si(r);if(o==="bound")return null;if(an(r,"aria-label")||nr(r,"aria-labelledby")||an(r,"title"))return null;let l=mr(r,"the control"),c=(p)=>Zn("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"),u=MG(r,i,t,s);if(u==="named"||u==="exempt")return null;if(o!==null&&OG.has(o))return Sd(r)?null:c("Give it text content, or an aria-label.");if(o!==null&&CG.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"&&nr(r,"href"))return Sd(r)?null:c("Give it text content, or an aria-label.");if(u==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return c("Give it a value, or an aria-label.");if(u==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function MG(e,t,r,n){if(t==="area"){if(!nr(e,"href"))return"none";return an(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return iC(vd(e),r,n)||an(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(Ma(e,"type")??"text").toLowerCase();if(s==="hidden"||nr(e,"type")&&Ma(e,"type")===null)return"exempt";if(NG.has(s))return an(e,"value")?"named":"unnamed-value";if(s==="image")return an(e,"alt")?"named":"unnamed-alt";return iC(vd(e),r,n)||an(e,"placeholder")?"named":"unnamed"}function LG(e){let{node:t,path:r,tags:n}=e,s=Et(t);if(!s.includes("-")||!n.some((i)=>DG.has(i)))return null;return Zn("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 FG(e){let{node:t,path:r}=e;if(Et(t)!=="img")return null;let n=Si(t);if(n==="bound"||n==="presentation"||n==="none")return null;if(nr(t,"alt")||an(t,"aria-label")||nr(t,"aria-labelledby"))return null;return Zn("img-alt-missing",r,`${mr(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 VG(e,t){let{node:r,path:n}=e,s=[];for(let i of qG){let o=Ma(r,i);if(o===null)continue;for(let a of o.split(/\s+/))if(a!==""&&!t.has(a))s.push(Zn("aria-target-missing",n,`${mr(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 WG(e,t,r){for(let n of oC.get(t)??[]){let s=r.get(n);if(s===void 0)continue;if(s.bound)return!0;if(e===Da&&s.ids.size>0)return!0;if(e!==null&&e!==Da&&s.ids.has(e))return!0}return!1}function HG(e,t){let{node:r,path:n,roles:s,tags:i}=e,o=Si(r);if(o===null||o==="bound"||n.length===0||IG(i))return null;if(s.includes("bound")||WG(vd(r),o,t))return null;let a=mr(r,"the element");if(o==="tab"&&!s.includes("tablist"))return Zn("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 Zn("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 Zn("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 BG(e){let t=[];for(let{node:r}of Ja(e)){if(Si(r)!=="tab")continue;let n=La(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 UG(e){let{node:t,path:r}=e;if(Si(t)!=="tablist")return null;let n=BG(t);if(n===null||n.length===0||n.includes(!0))return null;return Zn("tablist-none-selected",r,`${mr(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 zG(e){let{node:t,path:r}=e,n=Si(t);if(!(Et(t)==="dialog"||n==="dialog"||n==="alertdialog")||n==="bound")return null;if(an(t,"aria-label")||nr(t,"aria-labelledby"))return null;return Zn("dialog-unnamed",r,`${mr(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 KG(e){let{node:t,path:r}=e;if(!nr(t,"aria-activedescendant"))return null;let n=Et(t);if(GG.has(n)||n==="a"&&nr(t,"href")||nr(t,"tabIndex")||nr(t,"tabindex")||nr(t,"contenteditable"))return null;return Zn("activedescendant-not-focusable",r,`${mr(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 aC(e){let t=[...Ja(e)],r=new Set,n={bound:!1,ids:new Set},s=new Map,i=!1;for(let{node:a}of t){let l=Si(a);if(l!==null&&TG.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},p=Ma(a,"aria-owns");if(p===null)u.bound||=nr(a,"aria-owns");else for(let h of p.split(/\s+/))if(h!=="")u.ids.add(h);s.set(l,u)}let c=vd(a);if(c===Da)i=!0;else if(c!==null)r.add(c);if(Et(a)==="label"){let u=Ma(a,"for")??Ma(a,"htmlFor");if(u===null)n.bound||=nr(a,"for")||nr(a,"htmlFor");else n.ids.add(u)}}let o=[];for(let a of t){let l=[JG(a,n),FG(a),HG(a,s),LG(a),UG(a),zG(a),KG(a)];for(let c of l)if(c)o.push(c);if(!i)o.push(...VG(a,r))}return o}var RG="See docs/framework/concepts/accessibility.",Da="bound",OG,CG,NG,oC,TG,DG,qG,GG;var lC=D(()=>{ve();wd();OG=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),CG=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),NG=new Set(["button","reset","submit"]),oC=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),TG=new Set([...oC.values()].flat());DG=new Set(["select","jx-select"]);qG=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];GG=new Set(["button","input","select","textarea"])});function oy(e){return Et(e)==="dialog"}function cC(e){return e.startsWith("--")}function rK(e){let t=[];for(let{node:r}of Yn(e)){let n=vi(r);if(oy(r)&&n!==null&&!t.includes(n))t.push(n)}return t}function nK(e){let t=e.oncommand;return t!==void 0&&t!==null}function sK(e,t){for(let{node:r}of Yn(e)){if(r===e)continue;let n=Et(r);if(n==="button"){let s=rr(r,"command"),i=rr(r,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(i===null||i===t))return!0}if(n==="form"&&rr(r,"method")?.toLowerCase()==="dialog")return!0}return!1}function fC(e,t){let r=[...Yn(e,[],null,t)],n=rK(e),s=iy(e,t),i=n.length>0||s.length>0,o=new Map,a=new Map;for(let{node:c}of r){let u=vi(c);if(u!==null&&!o.has(u))o.set(u,c);if(Et(c)==="button"){let p=rr(c,"commandfor"),h=rr(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:u}of r)if(l.push(...iK(c,u,o,n,s,i,t)),oy(c))l.push(...oK(c,u,a));return l}function iK(e,t,r,n,s,i,o){let a=[],l=Et(e),c=o?.invokerTags?.has(l)??!1,u=rr(e,"command"),p=rr(e,"commandfor");if(!(u!==null||p!==null||("command"in Xn(e))||("commandfor"in Xn(e))))return a;let m=mr(e,"the element");if(!tK.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. ${it}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!QG.has(u)&&!cC(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${uC.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. ${it}`,message:`${m} declares command="${u}", 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 w=[...n,...s].map((P)=>`"${P}"`).join(", ");return a.push({detail:`No element in this document has the id "${p}". The dialogs and popovers here are: ${w}. A commandfor that names nothing does nothing, silently. ${it}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&b){if(YG.has(u)&&!oy(b))a.push({detail:`\`${u}\` acts on a <dialog>, and "${p}" is ${y?"a popover":`a <${Et(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."} ${it}`,message:`${m} sends ${u} to "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(XG.has(u)&&!lc(b,o))a.push({detail:`\`${u}\` acts on a popover, and "${p}" is ${g?"a dialog":`a <${Et(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."} ${it}`,message:`${m} sends ${u} to "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(cC(u)&&!nK(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. ${it}`,message:`${m} sends ${u} to "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function oK(e,t,r){let n=[],s=mr(e,"the dialog"),i=vi(e),{style:o}=e,a=rr(e,"closedby");if(a!==null&&!eK.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. ${it}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(pr(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. ${it}`,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=rr(e,"open")!==null||Xn(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. ${it}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!sK(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"\`. ${it}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return n}var uC,YG,XG,ZG,QG,eK,tK;var dC=D(()=>{ve();wd();uC=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],YG=new Set(["show-modal","close","request-close"]),XG=new Set(["toggle-popover","show-popover","hide-popover"]),ZG=["any","closerequest","none"],QG=new Set(uC),eK=new Set(ZG),tK=new Set(["button"])});var vC=N(function($C){Object.defineProperty($C,"__esModule",{value:!0});$C.formatNames=$C.fastFormats=$C.fullFormats=void 0;function Qn(e,t){return{validate:e,compare:t}}$C.fullFormats={date:Qn(gC,uy),time:Qn(ly(!0),fy),"date-time":Qn(pC(!0),bC),"iso-time":Qn(ly(),yC),"iso-date-time":Qn(pC(),xC),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:dK,"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:xK,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:pK,int32:{type:"number",validate:gK},int64:{type:"number",validate:yK},float:{type:"number",validate:hC},double:{type:"number",validate:hC},password:!0,binary:!0};$C.fastFormats={...$C.fullFormats,date:Qn(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,uy),time:Qn(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,fy),"date-time":Qn(/^\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,bC),"iso-time":Qn(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,yC),"iso-date-time":Qn(/^\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,xC),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};$C.formatNames=Object.keys($C.fullFormats);function aK(e){return e%4===0&&(e%100!==0||e%400===0)}var lK=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,cK=[0,31,28,31,30,31,30,31,31,30,31,30,31];function gC(e){let t=lK.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&&aK(r)?29:cK[n])}function uy(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var ay=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function ly(e){return function(r){let n=ay.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),u=+(n[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&i<=59&&o<60)return!0;let p=i-u*l,h=s-c*l-(p<0?1:0);return(h===23||h===-1)&&(p===59||p===-1)&&o<61}}function fy(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 yC(e,t){if(!(e&&t))return;let r=ay.exec(e),n=ay.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 cy=/t|\s/i;function pC(e){let t=ly(e);return function(n){let s=n.split(cy);return s.length===2&&gC(s[0])&&t(s[1])}}function bC(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 xC(e,t){if(!(e&&t))return;let[r,n]=e.split(cy),[s,i]=t.split(cy),o=uy(r,s);if(o===void 0)return;return o||fy(n,i)}var uK=/\/|:/,fK=/^(?:[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 dK(e){return uK.test(e)&&fK.test(e)}var mC=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function pK(e){return mC.lastIndex=0,mC.test(e)}var mK=-2147483648,hK=2147483647;function gK(e){return Number.isInteger(e)&&e<=hK&&e>=mK}function yK(e){return Number.isInteger(e)}function hC(){return!0}var bK=/[^\\]\\Z/;function xK(e){if(bK.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var EC=N(function(SC){Object.defineProperty(SC,"__esModule",{value:!0});var wK=Wg(),vK=Hg(),SK=Gg(),EK=Xg(),Ed=Zg(),PK=[wK.default,vK.default,(0,SK.default)(),EK.default,Ed.metadataVocabulary,Ed.contentVocabulary];SC.default=PK});var PC=N(function(rle,kK){kK.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 kC=N(function(Cr,py){Object.defineProperty(Cr,"__esModule",{value:!0});Cr.MissingRefError=Cr.ValidationError=Cr.CodeGen=Cr.Name=Cr.nil=Cr.stringify=Cr.str=Cr._=Cr.KeywordCxt=Cr.Ajv=void 0;var _K=Vg(),AK=EC(),RK=Qg(),jC=PC(),OK=["/properties"],Pd="http://json-schema.org/draft-07/schema";class cc extends _K.default{_addVocabularies(){if(super._addVocabularies(),AK.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(RK.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(jC,OK):jC;this.addMetaSchema(e,Pd,!1),this.refs["http://json-schema.org/schema"]=Pd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Pd)?Pd:void 0)}}Cr.Ajv=cc;py.exports=Cr=cc;py.exports.Ajv=cc;Object.defineProperty(Cr,"__esModule",{value:!0});Cr.default=cc;var CK=va();Object.defineProperty(Cr,"KeywordCxt",{enumerable:!0,get:function(){return CK.KeywordCxt}});var Fa=$e();Object.defineProperty(Cr,"_",{enumerable:!0,get:function(){return Fa._}});Object.defineProperty(Cr,"str",{enumerable:!0,get:function(){return Fa.str}});Object.defineProperty(Cr,"stringify",{enumerable:!0,get:function(){return Fa.stringify}});Object.defineProperty(Cr,"nil",{enumerable:!0,get:function(){return Fa.nil}});Object.defineProperty(Cr,"Name",{enumerable:!0,get:function(){return Fa.Name}});Object.defineProperty(Cr,"CodeGen",{enumerable:!0,get:function(){return Fa.CodeGen}});var NK=tc();Object.defineProperty(Cr,"ValidationError",{enumerable:!0,get:function(){return NK.default}});var TK=Ea();Object.defineProperty(Cr,"MissingRefError",{enumerable:!0,get:function(){return TK.default}})});var RC=N(function(AC){Object.defineProperty(AC,"__esModule",{value:!0});AC.formatLimitDefinition=void 0;var _C=kC(),bt=$e(),Ei=bt.operators,jd={formatMaximum:{okStr:"<=",ok:Ei.LTE,fail:Ei.GT},formatMinimum:{okStr:">=",ok:Ei.GTE,fail:Ei.LT},formatExclusiveMaximum:{okStr:"<",ok:Ei.LT,fail:Ei.GTE},formatExclusiveMinimum:{okStr:">",ok:Ei.GT,fail:Ei.LTE}},MK={message:({keyword:e,schemaCode:t})=>bt.str`should be ${jd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>bt._`{comparison: ${jd[e].okStr}, limit: ${t}}`};AC.formatLimitDefinition={keyword:Object.keys(jd),type:"string",schemaType:"string",$data:!0,error:MK,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 _C.KeywordCxt(i,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let h=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),m=t.const("fmt",bt._`${h}[${l.schemaCode}]`);e.fail$data(bt.or(bt._`typeof ${m} != "object"`,bt._`${m} instanceof RegExp`,bt._`typeof ${m}.compare != "function"`,p(m)))}function u(){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?bt._`${o.code.formats}${bt.getProperty(h)}`:void 0});e.fail$data(p(b))}function p(h){return bt._`${h}.compare(${r}, ${n}) ${jd[s].fail} 0`}},dependencies:["format"]};var DK=(e)=>(e.addKeyword(AC.formatLimitDefinition),e);AC.default=DK});var TC=N(function(uc,NC){Object.defineProperty(uc,"__esModule",{value:!0});var ln=vC(),FK=RC(),qa=$e(),OC=new qa.Name("fullFormats"),qK=new qa.Name("fastFormats"),hy=(e,t={keywords:!0})=>{if(Array.isArray(t))return CC(e,t,ln.fullFormats,OC),e;let[r,n]=t.mode==="fast"?[ln.fastFormats,qK]:[ln.fullFormats,OC],s=t.formats||ln.formatNames;if(CC(e,s,r,n),t.keywords)(0,FK.default)(e);return e};hy.get=(e,t="full")=>{let n=(t==="fast"?ln.fastFormats:ln.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function CC(e,t,r,n){var s,i;(s=(i=e.opts.code).formats)!==null&&s!==void 0||(i.formats=qa._`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}NC.exports=uc=hy;Object.defineProperty(uc,"__esModule",{value:!0});uc.default=hy});import{existsSync as JC,readFileSync as by,readdirSync as MC,statSync as DC}from"node:fs";import{createRequire as VK}from"node:module";import{join as LC,relative as kd,resolve as gy}from"node:path";async function UK(){try{let{default:e}=await Promise.resolve().then(() => gr(ry(),1)),{default:t}=await Promise.resolve().then(() => gr(TC(),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 FC(e,t={}){let r=gy(e),n=[],s=[],i=0;for(let S of["project.schema.json","document.schema.json"]){let E=gy(r,S);if(!JC(E))continue;i+=1;let k=fc(E),A=YK(k);if(A.length>0)n.push({errors:A.map(({reason:R,ref:_})=>({message:`$ref "${_}" ${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 YO(r);if(i+=1,!o.valid)n.push({errors:o.errors??[],file:Hc});let{addFormats:a,Ajv:l}=await UK(),{document:c}=await R1(r,{write:!1}),u=new l({allErrors:!0,ownProperties:!0,strict:!1});a(u);let p=u.compile(c),h=QO(IC(r).flatMap((S)=>{try{return[JSON.parse(by(S,"utf8"))]}catch{return[]}}));for(let S of WK)for(let E of WC(gy(r,S))){if(E.endsWith(".class.json"))continue;i+=1;let k=zK(E,kd(r,E));if(s.push(...k.warnings),k.failure!==null){n.push(k.failure);continue}let A=k.document;if(p(A))s.push(...KK(A,kd(r,E),h));else n.push({errors:p.errors??[],file:kd(r,E)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let b=m.compile(ng());for(let S of IC(r)){i+=1;let E=fc(S);if(!b(E))n.push({errors:b.errors??[],file:kd(r,S)})}let{config:g}=qs(r),y=await Fs(r,g),w=VK(import.meta.url);for(let S of y.extensions)for(let E of["project","document","fields"]){let k=S.schemas[E];if(!k)continue;i+=1;let A=new l({allErrors:!0,ownProperties:!0,strict:!1});a(A);for(let R of BK){let _=w.resolve(R);A.addSchema(fc(_))}try{A.compile(fc(k))}catch(R){n.push({errors:[{message:R instanceof Error?R.message:String(R)}],file:`${S.specifier} (${E} fragment)`})}}let P=t.strict===!0&&s.some((S)=>S.severity==="error");return{checked:i,issues:n,lint:s,valid:n.length===0&&!P}}function zK(e,t){if(!rl(e))return{document:fc(e),failure:null,warnings:[]};let r=by(e,"utf8"),n=ip(r).map((s)=>({detail:s.message,file:t,message:`line ${s.line}, column ${s.column}: ${s.message}`,path:[],rule:"escape",severity:"warn",source:"notation"}));try{return{document:GK(r),failure:null,warnings:n}}catch(s){return{document:null,failure:{errors:[{message:je(s)}],file:t},warnings:n}}}function GK(e){let t=Li(e);return B(t)?t:null}function fc(e){return JSON.parse(by(e,"utf8"))}function KK(e,t,r){let n=[];for(let s of sC(e,r))n.push({...yy(s),file:t,source:"popover"});for(let s of fC(e,r))n.push({...yy(s),file:t,source:"dialog"});for(let s of aC(e))n.push({...yy(s),criterion:s.criterion,file:t,source:"accessibility"});return n}function yy(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function qC(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 YK(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(!V(o))return!1;if(o=o[l],o===void 0)return!1}return!0},s=(i)=>{if(!B(i)||r.has(i))return;r.add(i);let o=i.$ref;if(O(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(!XK.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(B(l)){if(s(l),VC.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function WC(e){if(!JC(e))return[];let t=[];for(let r of MC(e)){let n=LC(e,r);if(DC(n).isDirectory())t.push(...WC(n));else if(fs(r))t.push(n)}return t.toSorted()}function IC(e){let t=[],r=(n)=>{for(let s of MC(n)){if(HK.has(s))continue;let i=LC(n,s);if(DC(i).isDirectory())r(i);else if(s.endsWith(".class.json"))t.push(i)}};return r(e),t.toSorted()}function HC(e){let t=[];for(let r of e.issues){t.push(`${r.file}:`);for(let n of r.errors){let s=B(n)?n:{},{instancePath:i,message:o}=s;t.push(` - ${i||"/"}: ${o??JSON.stringify(n)}`)}}return t}var WK,HK,BK,VC,XK;var BC=D(()=>{Fi();ir();wj();XO();lC();dC();wd();ve();ms();al();Hh();xp();WK=["components","pages","layouts"],HK=new Set(["node_modules","dist",".git"]),BK=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];VC=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),XK=new Set([...VC,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});ir();import{relative as xy,resolve as UC}from"node:path";async function ZK(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
570
614
 
571
615
  Commands:
572
616
  build [root] Build a Jx site to dist/
@@ -574,6 +618,7 @@ Commands:
574
618
  preview [root] Serve an already-built dist/ directory
575
619
  schema [root] Generate project.schema.json + document.schema.json from project.json#/extensions
576
620
  validate [root] Validate the whole project: project.json, documents, classes, and fragments
621
+ convert <paths…> Move documents between .json and .jxn, repairing every reference to them
577
622
  db push [root] Sync the data section's tables to their connections (additive-only)
578
623
 
579
624
  Options:
@@ -583,8 +628,10 @@ Options:
583
628
  --port <n> dev/preview: port to listen on (default 3000 / 4173)
584
629
  --dry-run db push: print the statements without executing them
585
630
  --connection db push: restrict to one connection name
586
- --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 g=s[p];if(g==="--connection")p+=1,a=s[p];else if(g==="--port"){p+=1;let m=Math.trunc(Number(s[p]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(g.startsWith("--"))i.add(g);else o.push(g)}let[c]=o,u=z_(c??".");if(r){if(n!=="push")console.error(`Unknown db subcommand: ${n??"(none)"}
587
- Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let p=i.has("--dry-run");try{await Promise.resolve().then(() => ah());let m={dryRun:p};if(a!==void 0)m.connection=a;let{results:b,bindingsPatched:h,wranglerPath:y}=await oh(u,m);for(let v of b){let k=v.applied?"applied":"dry-run";console.log(`${v.connection} (${v.provider}) — ${v.tables.length} table(s), ${v.statements.length} statement(s) [${k}]`);for(let S of v.statements)console.log(` ${S}`);for(let S of v.warnings)console.warn(` warning: ${S}`)}if(h&&y)console.log(`Updated bindings in ${Sm(u,y)}`)}catch(g){console.error(`db push failed: ${ke(g)}`),process.exit(1)}return}if(t==="build"){let p=i.has("--verbose"),g=!i.has("--no-clean"),m=i.has("--include-held");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => uw());let h=await sw(u,{clean:g,includeHeld:m,verbose:p});if(h.errors.length>0){console.error(`
588
- Build completed with ${h.errors.length} error(s):`);for(let y of h.errors)console.error(` - ${y}`);process.exit(1)}console.log(`
589
- Done: ${h.routes} routes → ${h.files} files`)}catch(b){console.error(`Build failed: ${ke(b)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => dw());fw(u,l)}catch(p){console.error(ke(p)),process.exit(1)}else if(t==="preview"){let{existsSync:p}=await import("node:fs"),g=z_(u,"dist");if(!p(g))console.error(`No build output at ${g} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => gw());let b=l??4173;hw(g,b),console.log(`Previewing ${g} at http://localhost:${b}`)}else if(t==="schema")try{await Promise.resolve().then(() => Kd());let{projectSchemaPath:g,documentSchemaPath:m}=await Rw(u);console.log(`Wrote ${Sm(u,g)}`),console.log(`Wrote ${Sm(u,m)}`)}catch(p){console.error(`Schema generation failed: ${ke(p)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => U_());let b=await q_(u,{strict:i.has("--strict")}),h=H_(b);if(b.valid){console.log(`Project is valid (${b.checked} files checked in ${u})`);for(let y of h)console.log(y)}else{console.error(`Project is INVALID (${u}):`);for(let y of[...W_(b),...h])console.error(y);process.exit(1)}}catch(p){console.error(`Validation failed: ${ke(p)}`),process.exit(1)}else console.error(`Unknown command: ${t}
590
- Run "jx --help" for usage.`),process.exit(1)}var Kee=H6();export{Kee as ready};
631
+ --strict validate: fail on an overlay or accessibility lint error, not only a schema error
632
+ --to <format> convert: jxn or json
633
+ --drop-comments convert: convert a .jxn file to .json even though it has comments`),process.exit(0);if(t==="convert"){try{await Promise.resolve().then(() => Jy());Iy(process.cwd(),e.slice(1))}catch(p){console.error(je(p)),process.exit(1)}return}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,u=UC(c??".");if(r){if(n!=="push")console.error(`Unknown db subcommand: ${n??"(none)"}
634
+ Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let p=i.has("--dry-run");try{await Promise.resolve().then(() => a0());let m={dryRun:p};if(a!==void 0)m.connection=a;let{results:b,bindingsPatched:g,wranglerPath:y}=await o0(u,m);for(let w of b){let P=w.applied?"applied":"dry-run";console.log(`${w.connection} (${w.provider}) — ${w.tables.length} table(s), ${w.statements.length} statement(s) [${P}]`);for(let S of w.statements)console.log(` ${S}`);for(let S of w.warnings)console.warn(` warning: ${S}`)}if(g&&y)console.log(`Updated bindings in ${xy(u,y)}`)}catch(h){console.error(`db push failed: ${je(h)}`),process.exit(1)}return}if(t==="build"){let p=i.has("--verbose"),h=!i.has("--no-clean"),m=i.has("--include-held");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => u1());let g=await s1(u,{clean:h,includeHeld:m,verbose:p});if(g.errors.length>0){console.error(`
635
+ Build completed with ${g.errors.length} error(s):`);for(let y of g.errors)console.error(` - ${y}`);process.exit(1)}console.log(`
636
+ Done: ${g.routes} routes → ${g.files} files`)}catch(b){console.error(`Build failed: ${je(b)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => d1());f1(u,l)}catch(p){console.error(je(p)),process.exit(1)}else if(t==="preview"){let{existsSync:p}=await import("node:fs"),h=UC(u,"dist");if(!p(h))console.error(`No build output at ${h} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => g1());let b=l??4173;h1(h,b),console.log(`Previewing ${h} at http://localhost:${b}`)}else if(t==="schema")try{await Promise.resolve().then(() => Hh());let{projectSchemaPath:h,documentSchemaPath:m}=await A1(u);console.log(`Wrote ${xy(u,h)}`),console.log(`Wrote ${xy(u,m)}`)}catch(p){console.error(`Schema generation failed: ${je(p)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => BC());let b=await FC(u,{strict:i.has("--strict")}),g=qC(b);if(b.valid){console.log(`Project is valid (${b.checked} files checked in ${u})`);for(let y of g)console.log(y)}else{console.error(`Project is INVALID (${u}):`);for(let y of[...HC(b),...g])console.error(y);process.exit(1)}}catch(p){console.error(`Validation failed: ${je(p)}`),process.exit(1)}else console.error(`Unknown command: ${t}
637
+ Run "jx --help" for usage.`),process.exit(1)}var Rle=ZK();export{Rle as ready};