@jxsuite/compiler 9.1.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +258 -242
- package/dist/compiler.js +181 -158
- package/package.json +9 -8
- package/src/compiler.ts +13 -8
- package/src/shadow.ts +6 -33
- package/src/shared.ts +1301 -176
- package/src/site/base-path.ts +88 -2
- package/src/site/client-runtime.ts +13 -14
- package/src/site/image-transform.ts +122 -29
- package/src/site/site-build.ts +248 -93
- package/src/targets/compile-client.ts +143 -37
- package/src/targets/compile-element.ts +388 -48
- package/src/targets/compile-pack.ts +234 -0
- package/src/targets/compile-static.ts +15 -3
package/dist/cli.js
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)return-1;if(s==="\\")r+=1;else if(s==="[")n=!0;else if(s==="]")n=!1;else if(s==="/"&&!n)return r+1}return-1}function
|
|
4
|
-
`)n[
|
|
5
|
-
`)r(
|
|
6
|
-
`){if(e.charAt(
|
|
7
|
-
`,"\r"]);
|
|
8
|
-
`],["r","\r"],["t","\t"]])});function
|
|
9
|
-
`,patched:!0}}function
|
|
2
|
+
import{createRequire as LN}from"node:module";var NN=Object.create;var{getPrototypeOf:TN,defineProperty:Tb,getOwnPropertyNames:JN}=Object;var Jb=Object.prototype.hasOwnProperty;function MN(e){return this[e]}var IN,DN,Sr=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?IN??=new WeakMap:DN??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?NN(TN(e)):{};let i=t||!e||!e.__esModule||!Jb.call(e,"default")?Tb(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of JN(e))if(!Jb.call(i,a))Tb(i,a,{get:MN.bind(e,a),enumerable:!0})}if(r)s.set(e,i);return i};var W=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var J=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var pt=LN(import.meta.url);function k(e){return typeof e==="string"}function Ie(e){return typeof e==="number"}function Ge(e){return typeof e==="boolean"}function _t(e){return typeof e==="function"}function D(e){return typeof e==="object"&&e!==null}function L(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function me(e){return L(e)&&typeof e.$ref==="string"}function kt(e){return L(e)&&e.$prototype==="Function"}function fn(e){return L(e)&&L(e.$expression)}function wr(e){return fn(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function vr(e){return kt(e)&&Array.isArray(e.body)}function Pn(e){return L(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function Zr(e){return L(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function jc(e){return L(e)&&!e.$prototype&&!e.$expression&&"default"in e}function $s(e){if(!L(e))return!1;for(let t of Object.keys(e))if(!hp.has(t))return!1;return!0}function Db(e){if(!L(e))return!1;for(let t of Object.keys(e))if(hp.has(t))return!0;return!1}function Le(e){return L(e)&&e.$prototype==="Array"}function Lb(e){return(Array.isArray(e)?e:[e]).some((n)=>Le(n))}function Fb(e){return L(e)&&e.$prototype==="Class"}function Ot(e){return L(e)}function le(e){return typeof e==="string"&&e.includes("${")}function Vb(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(po(e))}function gp(e){return e.$prototype==="Function"||k(e.role)&&e.role!=="field"}function po(e){if(!/[/'"`]/u.test(e))return e;let t=vc.get(e);if(t!==void 0)return t;let n=Wb(e);if(vc.size>=qb)vc.clear();return vc.set(e,n),n}function Hb(e){if(!e.includes("${"))return FN;let t=Ec.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];Wb(e.slice(r),s);let o=-1;for(let a=0;a<s.length;a+=2){let l=r+(s[a]??0),c=s[a+1]??-1;if(c===-1){o=l;break}n.push(Mb(e,l,r+c))}if(o===-1)break;let i=VN(e,o);if(i===-1)r=o+2;else n.push(Mb(e,o,i)),r=i}if(Ec.size>=qb)Ec.clear();return Ec.set(e,n),n}function Mb(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function VN(e,t){let n=0;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s==="{")n+=1;else if(s==="}"){if(n-=1,n===0)return r+1}}return-1}function HN(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function Ib(e,t){let n=!1;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s===`
|
|
3
|
+
`)return-1;if(s==="\\")r+=1;else if(s==="[")n=!0;else if(s==="]")n=!1;else if(s==="/"&&!n)return r+1}return-1}function Wb(e,t){let n=e.split(""),r=(c)=>{if(n[c]!==void 0&&n[c]!==`
|
|
4
|
+
`)n[c]=" "},s=[],o=t!==void 0,i="",a=-1,l=0;while(l<e.length){let c=e.charAt(l);if(o)if(c==="\\")r(l),r(l+1),l+=2;else if(c==="`"&&!(t&&s.length===0))o=!1,i=c,l+=1;else if(c==="$"&&e.charAt(l+1)==="{"){if(s.length===0)t?.push(l,-1);s.push(0),o=!1,i="{",l+=2}else r(l),l+=1;else if(c==="/"&&e.charAt(l+1)==="/")while(l<e.length&&e.charAt(l)!==`
|
|
5
|
+
`)r(l),l+=1;else if(c==="/"&&e.charAt(l+1)==="*"){let u=e.indexOf("*/",l+2),d=u===-1?e.length:u+2;for(;l<d;l+=1)r(l)}else if(c==="'"||c==='"'){l+=1;while(l<e.length&&e.charAt(l)!==c&&e.charAt(l)!==`
|
|
6
|
+
`){if(e.charAt(l)==="\\")r(l),l+=1;r(l),l+=1}i=c,l+=1}else if(c==="`")o=!0,l+=1;else if(t&&c==="/"&&qN.has(i)&&!HN(e,i,a)&&Ib(e,l)>0){let u=Ib(e,l);for(l+=1;l<u-1;l+=1)r(l);i="/",l=u}else{let u=s.length-1;if(u>=0&&c==="{")s[u]=(s[u]??0)+1;else if(u>=0&&c==="}")if(s[u]===0){if(s.pop(),o=!0,t&&s.length===0)t[t.length-1]=l+1}else s[u]=(s[u]??1)-1;if(c.trim()!=="")i=c,a=l;l+=1}}return n.join("")}function mo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Pc(e){if(!e)return[];return e.map((t)=>k(t)?t:t.name)}function WN(e){return typeof e==="string"}function rr(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!L(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 L(t.cases)&&Object.values(t.cases).every((n)=>k(n))&&typeof t.default==="string";return!1}function Yo(e){if(WN(e))return[e];if(!rr(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])]}function Zo(e){return e.startsWith("#")}function Qo(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}var hp,vc,qb=2048,FN,Ec,qN;var ce=J(()=>{hp=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);vc=new Map;FN=[],Ec=new Map;qN=new Set("(,=:[!&|?{;+-*%<>~^")});function Ub(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():zN(o(),r),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+=BN.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(Bb.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){n.push(l==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(l==="}"||l==="]"){n.pop(),r=null,s+=1;continue}if(l==='"'){let u=a(),d=n.at(-1);if(d?.kind==="object"&&UN(e,s)===":"){if(d.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:d.path});d.keys.add(u),r=u}else r=null;continue}if(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let d=e.slice(u,s);if(!KN(d))t.push({detail:d,kind:"unsafe-number",path:i()});r=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;r=null}return t}function UN(e,t){let n=t;while(n<e.length&&Bb.has(e[n]))n+=1;return e[n]??""}function zN(e,t){return e===""?t:`${e}.${t}`}function KN(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function zb(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 Bb,BN;var Kb=J(()=>{Bb=new Set([" ","\t",`
|
|
7
|
+
`,"\r"]);BN=new Map([["b","\b"],["f","\f"],["n",`
|
|
8
|
+
`],["r","\r"],["t","\t"]])});function be(e){return e instanceof Error?e.message:String(e)}function Xb(e){if(k(e))return Gb.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>Xb(t));if(L(e))return ei(e);return e}function ei(e){let t={};for(let[n,r]of Object.entries(e))t[Gb.test(n)?n.normalize("NFC"):n]=Xb(r);return t}function yp(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${be(o)}`,{cause:o})}if(!L(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Ub(e);if(s.length>0){let o=s.map((i)=>zb(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return ei(r)}function Yb(e,t){return yp(e,t,"Jx document")}function Zb(e,t){return yp(e,t,"project config")}function Qb(e,t){return yp(e,t,"class definition")}var Gb;var Lt=J(()=>{ce();Kb();Gb=/[^\p{ASCII}]/u});import{spawn as GN}from"node:child_process";import{createRequire as XN}from"node:module";import{join as YN}from"node:path";function e$(e,t){try{return XN(YN(e,"package.json")).resolve(`@jxsuite/server/${t}`)}catch{throw Error(`@jxsuite/server is not installed in ${e}. Add it to devDependencies (e.g. \`bun add -d @jxsuite/server\`) and retry.`)}}function _c(e,t,n,r=GN,s=process){let o=e$(t,e),i=r("bun",[o,"--root",t,...n],{stdio:"inherit"});return i.on("error",(a)=>{console.error(a.code==="ENOENT"?`jx ${e} runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.`:`Failed to start jx ${e}: ${a.message}`),s.exitCode=1}),i.on("exit",(a)=>{s.exitCode=a??0}),i}var xp=()=>{};import{spawn as ZN}from"node:child_process";function t$(e,t,n=ZN,r=process){return _c("convert",e,t,n,r)}var n$=J(()=>{xp()});import{spawn as QN}from"node:child_process";function r$(e,t,n=QN,r=process){return _c("format",e,t,n,r)}var s$=J(()=>{xp()});function eT(e){return JSON.parse(e)}function ti(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function tT(e){return ti(e)&&typeof e.binding==="string"}function nT(e){try{let t=eT(e);return ti(t)?t:void 0}catch{return}}function o$(e,t){if(t.length===0)return{content:e??"",patched:!1};let n={};if(e){let r=nT(e);if(r===void 0)return{content:e,patched:!1};n=r}for(let r of t)i$(n,r);return{content:`${JSON.stringify(n,null,"\t")}
|
|
9
|
+
`,patched:!0}}function i$(e,t){for(let[n,r]of Object.entries(t)){let s=n in e?e[n]:void 0;if(Array.isArray(r)){e[n]=rT(Array.isArray(s)?s:[],r);continue}if(ti(r)){if(ti(s))i$(s,r);else if(s===void 0)e[n]=structuredClone(r);continue}if(s===void 0)e[n]=r}}function rT(e,t){let n=[...e];for(let r of t){if(!tT(r)){if(!n.some((a)=>JSON.stringify(a)===JSON.stringify(r)))n.push(structuredClone(r));continue}let s=n.findIndex((i)=>ti(i)&&i.binding===r.binding),o=n[s];if(ti(o))n[s]={...o,...r};else n.push(structuredClone(r))}return n}var a$=()=>{};function f$(e){if(!k(e))return null;let[t,...n]=e.split(";"),r=(t??"").indexOf("/");if(r===-1)return null;let s=(t??"").slice(0,r).trim().toLowerCase(),o=(t??"").slice(r+1).trim().toLowerCase();if(!l$.test(s)||!l$.test(o))return null;let i=o.lastIndexOf("+"),a=i===-1?null:o.slice(i+1),l=i===-1?o:o.slice(0,i);if(a==="")return null;let c=l.indexOf("."),u=c===-1?null:l.slice(0,c),d=u!==null&&sT.has(u)?u:null,p=d===null?l:l.slice(d.length+1);if(p==="")return null;let m={};for(let y of n){let S=y.indexOf("=");if(S===-1)return null;let g=y.slice(0,S).trim().toLowerCase(),x=y.slice(S+1).trim();if(g==="")return null;if(x.startsWith('"')&&x.endsWith('"')&&x.length>=2)x=x.slice(1,-1);m[g]=x}return{parameters:m,subtype:p,suffix:a,tree:d,type:s}}function d$(e){if(!k(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(f$(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function p$(e){let t=f$(e);if(t===null)return null;let n=t.tree===null?"":`${t.tree}.`,r=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${n}${t.subtype}${r}`}var l$,sT,c$="text/markdown; variant=GFM",u$="application/yaml",m$;var bp=J(()=>{ce();l$=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,sT=new Set(["vnd","prs","x"]);m$={".jxn":"text/plain; charset=utf-8",".markdown":`${c$}; charset=utf-8`,".md":`${c$}; charset=utf-8`,".yaml":`${u$}; charset=utf-8`,".yml":`${u$}; charset=utf-8`}});class h${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(`
|
|
10
10
|
`,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 n=this.text.startsWith('"""',t),r=n?'"""':'"',s=r+"#".repeat(e);t+=r.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(!n&&this.text.charAt(t)===`
|
|
11
11
|
`)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===`
|
|
12
|
-
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function Wo(e){if(JR.test(e))return"unreadable";let t=new pb(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let n=e.indexOf(")",t.index);if(n===-1)return"unreadable";t.index=n+1}else{let[n]=IR.exec(e.slice(t.index,t.index+256))??[];if(!n)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!n.startsWith("$"))return n==="project"?"project":"document";if(t.index+=n.length,!t.skipNode())return"unreadable"}}}var JR,IR;var ba=R(()=>{JR=/\0/u,IR=/^[^\s\\/(){};[\]"#=]+/u});function wa(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 ls(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function ll(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 He(e){return!isNaN(e)&&!wa(e)&&!ls(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 mb(e){return e>=65&&e<91||e>=97&&e<123||!1}function Rd(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Nd(e){return Rd(e)||e===95}function Lr(e){return e>=48&&e<58}function co(e){return Lr(e)||e===95}function Td(e){return e>=48&&e<56}function hb(e){return Td(e)||e===95}function Jd(e){return e===48||e===49}function gb(e){return Jd(e)||e===95}function yb(e){return e===45||e===43}var is=1,Ho=2,oo=3,Qc=4,el=5,$a=6,tl=7,nl=8,Sa=9,as=10,Lt=11,Uo=12,Bo=13,rl=14,Fr=15,sl=16,ol=17,io=18,cs=19,il=20,al=21,cl=22,zo=23,ao=24,ur=28;function*MR(e){for(let t of(DR??=new Intl.Segmenter("en")).segment(e))yield t.segment}function FR(e){return e[Symbol.iterator]()}function xb(e,{flags:t,graphemeLocations:n=!1}){let r=n?MR(e):FR(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*bb(e){if(ke(e,65279))e.column=1,yield Se(e,Ho);if(ll(e.current))throw fr(e,`Invalid character \\u${e.current.toString(16)}`)}function pt(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(ll(n))if(n>=55296&&n<=57343||n>1114111)va(e,`Invalid character \\u${n.toString(16)}`);else va(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function qn(e,t){if(t(e.current)){let n=e.current;return pt(e),n}}function ke(e,t){if(e.current===t)return pt(e),t}function Ko(e){if(!ls(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return pt(e),e.column=1,e.line++,!0}function Id(e,t){while(e.current===t)pt(e)}function Me(e,t){while(t(e.current))pt(e)}function Se(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},a=e.start;e.start=i;let c=e.errorsInToken;e.errorsInToken=null;let l={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:c};if(n){if(!l.errors)l.errors=[];l.errors.push(new Oe(n,{token:l}))}return l}function fr(e,t){if(t instanceof Oe)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(ls(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Oe(`${t}`,{start:o,end:i})}function va(e,t){(e.errorsInToken??=[]).push(fr(e,t))}var DR;var $b=R(()=>{lo()});function uo(e){return(t)=>(pt(t),Se(t,e))}function Ea(e){return Me(e,wa),Se(e,io)}function fo(e){return Ko(e),Se(e,cs)}function LR(e){pt(e);let t=!1,n=!1;if(ke(e,34)){if(!ke(e,34))return Se(e,Sa);if(n=!0,e.current===34)throw fr(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(ke(e,34)){if(ke(e,34)&&ke(e,34))t=!0}else ke(e,92),Ko(e)||pt(e)}else while(!t&&e.offset<e.length)if(ke(e,34))t=!0;else ke(e,92),Ko(e)||pt(e);if(!t)throw fr(e,"Unexpected EOF inside string");return Se(e,n?zo:Sa)}function Sb(e){if(pt(e),e.current===35||e.current===34){let t=1;while(ke(e,35))t++;if(!ke(e,34))throw fr(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(ke(e,34))if(ke(e,34)){if(e.current===34)throw fr(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(ke(e,35))r++;if(r===t)return Se(e,as)}while(!0){if(e.offset>=e.length)throw fr(e,"Unexpected EOF while parsing raw string");if(ke(e,34)){if(n){if(!ke(e,34)||!ke(e,34))continue}let r=0;while(r<t&&ke(e,35))r++;if(r===t)return Se(e,n?ao:as)}else Ko(e)||pt(e)}}else{let t;if(e.current<255){let n=Ee[e.current];t=n(e)}else if(wa(e.current))t=Ea(e);else if(ls(e.current))t=fo(e);else t=Md(e);if(t.type!==Lt)(t.errors??=[]).push(new Oe("Expected a valid identifier",{token:t}));return t.type=Bo,t}}function VR(e){if(pt(e),qn(e,Lr))return Me(e,He),Se(e,Lt,"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 Me(e,He),Se(e,Lt)}function qR(e){if(pt(e),ke(e,45))return Se(e,oo);else if(ke(e,47)){while(e.offset<e.length&&!ls(e.current))pt(e);return Se(e,al)}else if(ke(e,42)){let t=1;while(e.offset<e.length)if(ke(e,42)){if(ke(e,47)){if(t--,t===0)return Se(e,cl)}}else if(ke(e,47)){if(ke(e,42))t++}else Ko(e)||pt(e);throw fr(e,"Unexpected EOF in multiline comment")}else fl(e)}function wb(e){return pt(e),WR(e)}function WR(e){if(Lr(e.current))return Wn(e);else if(ke(e,46)){if(qn(e,Lr))return Me(e,He),Se(e,Lt,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Me(e,He),Se(e,Lt)}else return Me(e,He),Se(e,Lt)}function Dd(e,t,n,r){return(s)=>{let o=pt(s);if(qn(s,n))return Me(s,r),Se(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(ke(s,95)){if(Me(s,r),!He(s.current))return Se(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Me(s,He),Se(s,Lt,`Invalid ${e} number`)}else if(ke(s,95)){if(Id(s,95),n(s.current)){if(Me(s,r),!He(s.current))return Se(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Me(s,He),Se(s,Lt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(Lr(s.current))return Se(s,Lt,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Me(s,He),Se(s,ur)}}function Wn(e){if(ke(e,48)){let t=ul[e.current];if(t)return t(e)}if(Me(e,co),ke(e,46)){if(!qn(e,Lr))if(e.current===95)va(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else va(e,"Invalid decimal number, a decimal point must be followed by a digit");Me(e,co)}if(ke(e,101)||ke(e,69))if(qn(e,yb),qn(e,Lr)){if(Me(e,co),He(e.current))return Me(e,He),Se(e,Lt,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Se(e,Fr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Me(e,co),Se(e,Fr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Me(e,He),Se(e,Fr,"Invalid decimal number, missing a number after the exponent");else if(ke(e,95)){if(Id(e,95),Lr(e.current)){if(Me(e,co),!He(e.current))return Se(e,Fr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Me(e,He),Se(e,Lt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Me(e,He),Se(e,ur);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){pt(e);let t=null;if(qn(e,Nd))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Me(e,He),Se(e,ur,t)}else if(qn(e,mb)){let t=null;if(qn(e,co))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Me(e,He),Se(e,ur,t)}else if(ke(e,44))return Me(e,He),Se(e,ur,"Invalid number with suffix, a suffix cannot start with a comma");else if(ke(e,46))return Me(e,He),Se(e,ur,"Invalid number with suffix, a suffix cannot start with a dot");else if(qn(e,He))return Me(e,He),Se(e,ur);else return Se(e,Fr);else return Se(e,Fr)}function HR(e){if(pt(e),e.current!=35)return Me(e,He),Se(e,Lt);let t=Sb(e);t.start.offset--,t.start.column--;let n;switch(t.type){case as:case ao:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Oe(n,{token:t})),t}function Md(e){return pt(e),Me(e,He),Se(e,Lt)}function fl(e){throw fr(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*ja(e,t){let n=xb(e,t);yield*bb(n);while(!n.currentIter.done){if(n.current<255){let r=Ee[n.current];yield r(n);continue}if(wa(n.current)){yield Ea(n);continue}if(ls(n.current)){yield fo(n);continue}yield Md(n)}yield Se(n,is)}var ul,Ee;var vb=R(()=>{lo();$b();ul=Array(256).fill(null);ul[98]=Dd("binary",ol,Jd,gb);ul[111]=Dd("octal",sl,Td,hb);ul[120]=Dd("hexadecimal",rl,Rd,Nd);Ee=Array(255);Ee.fill(Md);for(let e=0;e<32;e++)Ee[e]=fl;Ee[9]=Ea;Ee[10]=fo;Ee[11]=fo;Ee[12]=fo;Ee[13]=fo;Ee[32]=Ea;Ee[34]=LR;Ee[35]=Sb;Ee[40]=uo(Qc);Ee[41]=uo($a);Ee[43]=wb;Ee[45]=wb;Ee[46]=VR;Ee[47]=qR;Ee[48]=Wn;Ee[49]=Wn;Ee[50]=Wn;Ee[51]=Wn;Ee[52]=Wn;Ee[53]=Wn;Ee[54]=Wn;Ee[55]=Wn;Ee[56]=Wn;Ee[57]=Wn;Ee[59]=uo(nl);Ee[61]=uo(Uo);Ee[91]=fl;Ee[92]=uo(il);Ee[93]=fl;Ee[114]=HR;Ee[123]=uo(el);Ee[125]=uo(tl);Ee[133]=fo;Ee[160]=Ea});var Go=R(()=>{vb()});var Oe;var lo=R(()=>{Go();Oe=class Oe extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===is)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function Xo(e){return Eb.get(e)}function jb(e,{start:t},{end:n}){Eb.set(e,{start:t,end:n})}var Eb;var Fd=R(()=>{Eb=new WeakMap});function Pb({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class Hn{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 Hn(this.name);return e.representation=this.representation,e}}class dr{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 dr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class Un{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new Un(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 dr(e)}}var Ld=()=>{};class xn{static createArgument(e){return new xn(new Un(e),null)}static createProperty(e,t){return new xn(new Un(t),new Hn(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new xn(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 Hn(e):null}getValue(){return this.value.value}setValue(e){this.value=new Un(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Vd=R(()=>{Ld()});function*Yo(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function qd(e){return e.children??(e.children=new us)}class Zo{static create(e){return new Zo(new Hn(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new Zo(this.name.clone(),e?[]:this.entries.map((n)=>n.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 dr(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,n){let r=xn.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.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 Yo(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of Yo(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=xn.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){qd(this).appendNode(e)}insertNodeBefore(e,t){qd(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){qd(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 _b=R(()=>{Wd();Vd()});function*Qo(e){if(e instanceof us)yield*e.nodes;else yield e}class us{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new us(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...Qo(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...Qo(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...Qo(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...Qo(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...Qo(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 n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...Qo(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of Yo(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of Yo(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var Wd=()=>{};var kb=R(()=>{Wd();Vd();_b();Ld()});function Ob(e,t,n){let r;while(r=BR.exec(t)){let s=Pa(n,t,r.index);e.push(new Oe("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function Ab(e,t,n){if(!ei.test(t))return e.push(new Oe("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!ei.test(t[0]))return e.push(new Oe("Multi-line strings must start with a newline",{token:n})),t;let r=GR.exec(t)?.[1];if(r==null)return e.push(new Oe("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(YR,(s,o,i,a,c)=>{if(!a)return`
|
|
13
|
-
`;if(!i.startsWith(r)){let
|
|
12
|
+
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function ni(e){if(oT.test(e))return"unreadable";let t=new h$(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let n=e.indexOf(")",t.index);if(n===-1)return"unreadable";t.index=n+1}else{let[n]=iT.exec(e.slice(t.index,t.index+256))??[];if(!n)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!n.startsWith("$"))return n==="project"?"project":"document";if(t.index+=n.length,!t.skipNode())return"unreadable"}}}var oT,iT;var Ta=J(()=>{oT=/\0/u,iT=/^[^\s\\/(){};[\]"#=]+/u});function Ia(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 Es(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Dc(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 Qe(e){return!isNaN(e)&&!Ia(e)&&!Es(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 g$(e){return e>=65&&e<91||e>=97&&e<123||!1}function $p(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Sp(e){return $p(e)||e===95}function es(e){return e>=48&&e<58}function xo(e){return es(e)||e===95}function wp(e){return e>=48&&e<56}function y$(e){return wp(e)||e===95}function vp(e){return e===48||e===49}function x$(e){return vp(e)||e===95}function b$(e){return e===45||e===43}var Ss=1,ri=2,ho=3,kc=4,Oc=5,Ja=6,Ac=7,Cc=8,Ma=9,ws=10,zt=11,si=12,oi=13,Rc=14,Qr=15,Nc=16,Tc=17,go=18,vs=19,Jc=20,Mc=21,Ic=22,ii=23,yo=24,Er=28;function*lT(e){for(let t of(aT??=new Intl.Segmenter("en")).segment(e))yield t.segment}function cT(e){return e[Symbol.iterator]()}function $$(e,{flags:t,graphemeLocations:n=!1}){let r=n?lT(e):cT(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*S$(e){if(Ae(e,65279))e.column=1,yield Ee(e,ri);if(Dc(e.current))throw jr(e,`Invalid character \\u${e.current.toString(16)}`)}function St(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(Dc(n))if(n>=55296&&n<=57343||n>1114111)Da(e,`Invalid character \\u${n.toString(16)}`);else Da(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function sr(e,t){if(t(e.current)){let n=e.current;return St(e),n}}function Ae(e,t){if(e.current===t)return St(e),t}function ai(e){if(!Es(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return St(e),e.column=1,e.line++,!0}function Ep(e,t){while(e.current===t)St(e)}function Be(e,t){while(t(e.current))St(e)}function Ee(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},a=e.start;e.start=i;let l=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:l};if(n){if(!c.errors)c.errors=[];c.errors.push(new Ce(n,{token:c}))}return c}function jr(e,t){if(t instanceof Ce)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(Es(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Ce(`${t}`,{start:o,end:i})}function Da(e,t){(e.errorsInToken??=[]).push(jr(e,t))}var aT;var w$=J(()=>{bo()});function $o(e){return(t)=>(St(t),Ee(t,e))}function La(e){return Be(e,Ia),Ee(e,go)}function So(e){return ai(e),Ee(e,vs)}function uT(e){St(e);let t=!1,n=!1;if(Ae(e,34)){if(!Ae(e,34))return Ee(e,Ma);if(n=!0,e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Ae(e,34)){if(Ae(e,34)&&Ae(e,34))t=!0}else Ae(e,92),ai(e)||St(e)}else while(!t&&e.offset<e.length)if(Ae(e,34))t=!0;else Ae(e,92),ai(e)||St(e);if(!t)throw jr(e,"Unexpected EOF inside string");return Ee(e,n?ii:Ma)}function v$(e){if(St(e),e.current===35||e.current===34){let t=1;while(Ae(e,35))t++;if(!Ae(e,34))throw jr(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(Ae(e,34))if(Ae(e,34)){if(e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(Ae(e,35))r++;if(r===t)return Ee(e,ws)}while(!0){if(e.offset>=e.length)throw jr(e,"Unexpected EOF while parsing raw string");if(Ae(e,34)){if(n){if(!Ae(e,34)||!Ae(e,34))continue}let r=0;while(r<t&&Ae(e,35))r++;if(r===t)return Ee(e,n?yo:ws)}else ai(e)||St(e)}}else{let t;if(e.current<255){let n=Pe[e.current];t=n(e)}else if(Ia(e.current))t=La(e);else if(Es(e.current))t=So(e);else t=Pp(e);if(t.type!==zt)(t.errors??=[]).push(new Ce("Expected a valid identifier",{token:t}));return t.type=oi,t}}function fT(e){if(St(e),sr(e,es))return Be(e,Qe),Ee(e,zt,"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 Be(e,Qe),Ee(e,zt)}function dT(e){if(St(e),Ae(e,45))return Ee(e,ho);else if(Ae(e,47)){while(e.offset<e.length&&!Es(e.current))St(e);return Ee(e,Mc)}else if(Ae(e,42)){let t=1;while(e.offset<e.length)if(Ae(e,42)){if(Ae(e,47)){if(t--,t===0)return Ee(e,Ic)}}else if(Ae(e,47)){if(Ae(e,42))t++}else ai(e)||St(e);throw jr(e,"Unexpected EOF in multiline comment")}else Fc(e)}function E$(e){return St(e),pT(e)}function pT(e){if(es(e.current))return or(e);else if(Ae(e,46)){if(sr(e,es))return Be(e,Qe),Ee(e,zt,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Be(e,Qe),Ee(e,zt)}else return Be(e,Qe),Ee(e,zt)}function jp(e,t,n,r){return(s)=>{let o=St(s);if(sr(s,n))return Be(s,r),Ee(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Ae(s,95)){if(Be(s,r),!Qe(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,Qe),Ee(s,zt,`Invalid ${e} number`)}else if(Ae(s,95)){if(Ep(s,95),n(s.current)){if(Be(s,r),!Qe(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,Qe),Ee(s,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(es(s.current))return Ee(s,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Be(s,Qe),Ee(s,Er)}}function or(e){if(Ae(e,48)){let t=Lc[e.current];if(t)return t(e)}if(Be(e,xo),Ae(e,46)){if(!sr(e,es))if(e.current===95)Da(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else Da(e,"Invalid decimal number, a decimal point must be followed by a digit");Be(e,xo)}if(Ae(e,101)||Ae(e,69))if(sr(e,b$),sr(e,es)){if(Be(e,xo),Qe(e.current))return Be(e,Qe),Ee(e,zt,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Ee(e,Qr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Be(e,xo),Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Be(e,Qe),Ee(e,Qr,"Invalid decimal number, missing a number after the exponent");else if(Ae(e,95)){if(Ep(e,95),es(e.current)){if(Be(e,xo),!Qe(e.current))return Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Be(e,Qe),Ee(e,zt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Be(e,Qe),Ee(e,Er);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){St(e);let t=null;if(sr(e,Sp))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Be(e,Qe),Ee(e,Er,t)}else if(sr(e,g$)){let t=null;if(sr(e,xo))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Be(e,Qe),Ee(e,Er,t)}else if(Ae(e,44))return Be(e,Qe),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a comma");else if(Ae(e,46))return Be(e,Qe),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a dot");else if(sr(e,Qe))return Be(e,Qe),Ee(e,Er);else return Ee(e,Qr);else return Ee(e,Qr)}function mT(e){if(St(e),e.current!=35)return Be(e,Qe),Ee(e,zt);let t=v$(e);t.start.offset--,t.start.column--;let n;switch(t.type){case ws:case yo:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Ce(n,{token:t})),t}function Pp(e){return St(e),Be(e,Qe),Ee(e,zt)}function Fc(e){throw jr(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Fa(e,t){let n=$$(e,t);yield*S$(n);while(!n.currentIter.done){if(n.current<255){let r=Pe[n.current];yield r(n);continue}if(Ia(n.current)){yield La(n);continue}if(Es(n.current)){yield So(n);continue}yield Pp(n)}yield Ee(n,Ss)}var Lc,Pe;var j$=J(()=>{bo();w$();Lc=Array(256).fill(null);Lc[98]=jp("binary",Tc,vp,x$);Lc[111]=jp("octal",Nc,wp,y$);Lc[120]=jp("hexadecimal",Rc,$p,Sp);Pe=Array(255);Pe.fill(Pp);for(let e=0;e<32;e++)Pe[e]=Fc;Pe[9]=La;Pe[10]=So;Pe[11]=So;Pe[12]=So;Pe[13]=So;Pe[32]=La;Pe[34]=uT;Pe[35]=v$;Pe[40]=$o(kc);Pe[41]=$o(Ja);Pe[43]=E$;Pe[45]=E$;Pe[46]=fT;Pe[47]=dT;Pe[48]=or;Pe[49]=or;Pe[50]=or;Pe[51]=or;Pe[52]=or;Pe[53]=or;Pe[54]=or;Pe[55]=or;Pe[56]=or;Pe[57]=or;Pe[59]=$o(Cc);Pe[61]=$o(si);Pe[91]=Fc;Pe[92]=$o(Jc);Pe[93]=Fc;Pe[114]=mT;Pe[123]=$o(Oc);Pe[125]=$o(Ac);Pe[133]=So;Pe[160]=La});var li=J(()=>{j$()});var Ce;var bo=J(()=>{li();Ce=class Ce extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===Ss)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function ci(e){return P$.get(e)}function _$(e,{start:t},{end:n}){P$.set(e,{start:t,end:n})}var P$;var _p=J(()=>{P$=new WeakMap});function k$({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class ir{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 ir(this.name);return e.representation=this.representation,e}}class Pr{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 Pr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class ar{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new ar(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 Pr(e)}}var kp=()=>{};class _n{static createArgument(e){return new _n(new ar(e),null)}static createProperty(e,t){return new _n(new ar(t),new ir(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new _n(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 ir(e):null}getValue(){return this.value.value}setValue(e){this.value=new ar(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Op=J(()=>{kp()});function*ui(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function Ap(e){return e.children??(e.children=new js)}class fi{static create(e){return new fi(new ir(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new fi(this.name.clone(),e?[]:this.entries.map((n)=>n.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 Pr(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,n){let r=_n.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.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 ui(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of ui(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=_n.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){Ap(this).appendNode(e)}insertNodeBefore(e,t){Ap(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){Ap(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 O$=J(()=>{Cp();Op()});function*di(e){if(e instanceof js)yield*e.nodes;else yield e}class js{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new js(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...di(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...di(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...di(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...di(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...di(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 n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...di(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of ui(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of ui(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var Cp=()=>{};var A$=J(()=>{Cp();Op();O$();kp()});function C$(e,t,n){let r;while(r=gT.exec(t)){let s=Va(n,t,r.index);e.push(new Ce("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function R$(e,t,n){if(!pi.test(t))return e.push(new Ce("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!pi.test(t[0]))return e.push(new Ce("Multi-line strings must start with a newline",{token:n})),t;let r=bT.exec(t)?.[1];if(r==null)return e.push(new Ce("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(ST,(s,o,i,a,l)=>{if(!a)return`
|
|
13
|
+
`;if(!i.startsWith(r)){let c=Va(n,t,l+o.length);return e.push(new Ce("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:c,end:{offset:c.offset+r.length,line:c.line,column:c.column+r.length}})),`
|
|
14
14
|
`}return`
|
|
15
|
-
`+i.slice(r.length)+a}).slice(1,-1)}function
|
|
16
|
-
`;if(!i.startsWith(r)){let p=
|
|
15
|
+
`+i.slice(r.length)+a}).slice(1,-1)}function N$(e,t,n){let r;while(r=xT.exec(t)){let s=Va(n,t,r.indices[1][0]);e.push(new Ce("Strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[1].length,line:s.line+1,column:1}}))}return t.replace(vT,(s,o,i,a,l)=>J$(e,t,n,s,o,i,a,l))}function T$(e,t,n){if(!yT.test(t))return e.push(new Ce("Strings with three quotes must be multiline strings",{token:n})),t;if(!pi.test(t[0]))return e.push(new Ce("Multi-line strings must start with a newline",{token:n})),t;let r=$T.exec(t)?.[1];if(r==null){let s=wT.exec(t),o=s?Va(n,t,s.index):void 0,i="The final line in a multiline string may only contain whitespace";if(s?.[0][0]==="\\")i+=" after removing escaped whitespace";return e.push(new Ce(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(ET,(s,o,i,a,l,c,u)=>{if(!o)return J$(e,t,n,s,a,l,c,u);let d=t[u+o.length+(i?i.length:0)];if(pi.test(d))return`
|
|
16
|
+
`;if(!i.startsWith(r)){let p=Va(n,t,u+o.length);return e.push(new Ce("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:p,end:{offset:p.offset+r.length,line:p.line,column:p.column+r.length}})),`
|
|
17
17
|
`}return`
|
|
18
|
-
`+i.slice(r.length)}).slice(1,-1)}function
|
|
19
|
-
`],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),ei=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,BR=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,zR=/(?:^|[^\\\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,KR=/(?:^|[^\\\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;GR=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,XR=/(?:^|[^\\\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]*)*$/,YR=/(\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,ZR=/([^\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]*$/;QR=/\\(?:$|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;eN=/(\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 Vr(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 Fe(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return Vr(e),n}}function je(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Oe(t,{token:n})}function nn(e,t,n,r=n){if(e.storeLocations)jb(t,n,r)}function Vt(e="",t="",n=""){return e+t+n||void 0}function ml(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return Vr(o),o}function Ud(e,t){if(!t&&!e.current.done&&e.current.value.type!==is)t=je(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof Oe)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Oe(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new Oe("Encountered multiple errors",{errors:n})}function dl(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 Jb(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Bd(e){let{value:t}=e.current,n,r,s,o,i,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case ur:{if(!e.flags.experimentalSuffixedNumbers)throw new Oe("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,d=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,d),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(d),Jb(s))e.errors.push(je(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case ol:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case sl:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Fr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case rl:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case Bo:if(n=dl(t.text),n===void 0)if(n=null,dl(t.text.toLowerCase())!==void 0)e.errors.push(je(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(je(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(je(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(je(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}Vr(e);let c=e.flags.experimentalSuffixedNumbers&&Fe(e,Bo);if(c)if(a){if(o=c.text,dl(o)!==void 0)e.errors.push(je(c,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(je(c,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(je(c,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(je(c,"Unexpected hashed suffix, you can only place suffixes on numbers"));let l=new Un(n);if(l.representation=r??t.text,nn(e,l,t),s){let u=new dr(s);u.representation=o,u.suffix=!0,nn(e,u,e.lastToken),l.tag=u}return l}function _a(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case Lt:if(Vr(e),Jb(t.text))e.errors.push(je(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case Sa:Vr(e),n=[Cb(e.errors,t.text.slice(1,-1),t),t.text,t];break;case zo:Vr(e),n=[Rb(e.errors,t.text.slice(3,-3),t),t.text,t];break;case as:{Vr(e);let r=t.text,s=r.indexOf('"');n=[Ob(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case ao:{Vr(e);let r=t.text,s=r.indexOf('"');n=[Ab(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Fe(e,Bo))e.errors.push(je(e.lastToken,dl(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 n}function zd(e){let t=_a(e);if(!t)return;let n=new Hn(t[0]);return n.representation=t[1],nn(e,n,t[2],e.lastToken),n}function pl(e){let t=Bd(e);if(t)return t;let n=_a(e);if(!n)return;let r=new Un(n[0]);return r.representation=n[1],nn(e,r,n[2],e.lastToken),r}function ka(e){let t=Fe(e,al);if(!t)return;let{value:n}=e.current;return Vr(e),t.text+(n?.text??"")}function hl(e){return Fe(e,cl)?.text}function Kd(e){return Fe(e,io)??hl(e)}function gl(e){let t=Fe(e,il);if(!t)return;while(Kd(e));if(!ka(e)&&!Fe(e,cs)&&!Fe(e,is))e.errors.push(je(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 fs(e){let t=e.lastToken.end;while(Fe(e,cs)?.text??ka(e)??Kd(e)??gl(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(Kd(e)??gl(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Hd(e){let t=Fe(e,Qc);if(!t)return;let n=$t(e),r=_a(e);if(!r&&e.current.value){let a=e.current.value;if(fs(e))e.errors.push(je(a,"This type of whitespace is not allowed inside a tag"));r=_a(e)}if(!r){if(Bd(e))e.errors.push(je(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw je(e,"Invalid tag, did you forget to quote a string?");let s=$t(e),o=Fe(e,$a);if(!o&&e.current.value){let a=e.current.value;if(fs(e))e.errors.push(je(a,"This type of whitespace is not allowed inside a tag"));o=Fe(e,$a)}if(!o)throw je(e,"Invalid tag, did you forget to quote a string?");let i=new dr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,nn(e,i,t,e.lastToken),i}function yl(e){return ka(e)??Fe(e,cs)?.text??Fe(e,nl)?.text??Fe(e,is)?.text}function Gd(e){if(!Fe(e,el))return;let t=Fb(e);if(!Fe(e,tl))throw je(e,"Invalid node children");return t}function ti(e){let t=e.current.value;{let d=Hd(e);if(d){let p=$t(e),m=pl(e);if(!m)throw je(e,"Invalid argument");if(m.tag)e.errors.push(je(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let x=new xn(m,null);nn(e,m,t,e.lastToken),nn(e,x,t,e.lastToken);let g=$t(e);if(Fe(e,Uo))e.errors.push(je(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),g=Vt(g,$t(e))||" ";return[x,g]}}{let d=Bd(e);if(d){let p=new xn(d,null);nn(e,p,t,e.lastToken);let m=$t(e);if(Fe(e,Uo))e.errors.push(je(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Vt(m,$t(e))||" ";return[p,m]}}let n=_a(e);if(!n)return;let r=$t(e),s=Fe(e,Uo);if(!s){let d=new Un(n[0]);d.representation=n[1],nn(e,d,n[2]);let p=new xn(d,null);return nn(e,p,t,e.lastToken),[p,r]}let o=new Hn(n[0]);o.representation=n[1],nn(e,o,n[2]);let i=$t(e),a=Hd(e),c=a&&$t(e),l=pl(e);if(!l)throw je(e,"Expected a value");if(a){if(l.tag)e.errors.push(je(e.lastToken,"A number suffix cannot be combined with a regular tag"));l.tag=a,l.betweenTagAndValue=c}let u=new xn(l,o);return nn(e,u,t,e.lastToken),u.equals=Vt(r,s.text,i),[u,void 0]}function Ib(e){let t=$t(e)??"",n;while(n=po(e)){let i=e.lastToken.end,a=ti(e);if(!a)throw je(e,"Expected a property or argument");if(!(a[1]??$t(e)))throw je(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=ti(e);if(!r)return;let s=r[1]??$t(e)??"";while(n=po(e)){let i=e.lastToken.end,a=ti(e);if(!a)throw je(e,"Expected a property or argument");if(!(a[1]??$t(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function po(e){let t=Fe(e,oo)?.text;if(!t)return;return Vt(t,fs(e))}function xl(e){let t=e.current.value,n=Hd(e),r=n&&$t(e),s=zd(e);if(!s)if(n)throw je(e,"Couldn't find node name");else return;let o=$t(e),i=o!=null,a=po(e),c=[];while(i||a){let p=e.lastToken.end,m=ti(e);if(!m)break;if(a)i=(m[1]||$t(e))!=null,o=Vt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=po(e);else{let x=m[0];x.leading=o,c.push(x),o=m[1]||$t(e),i=o!=null,a=po(e)}}let l,u;while(!0){a??=po(e);let p=e.lastToken.end,m=Gd(e);if(!m){if(a)throw je(e,"Unexpected slashdash");break}if(a)o=Vt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(l)e.errors.push(je(e,"A node can only have one children block"));l=m,u=o??"",o=void 0}o=Vt(o,$t(e))}let d=new Zo(s,c,l);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",nn(e,d,t,e.lastToken),d}function Db(e){let t=fs(e),n=xl(e);if(!n)return;let r=Vt(yl(e),fs(e));return n.leading=Vt(t,n.leading),n.trailing=Vt(n.trailing,r),n}function Mb(e){let t=Fe(e,Ho)?.text,n=Fb(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Vt(t,n.nodes[0].leading);else n.trailing=Vt(t,n.trailing);return n}function Fb(e){let t=e.current.value,n=[],r=!0,s=fs(e);while(r){let i=e.lastToken.end,a=po(e),c=xl(e);if(!c){if(a)throw je(e,"Unexpected slashdash");break}let l=$t(e),u=yl(e);if(a)s=Vt(s,e.text.slice(i.offset,e.lastToken.end.offset),fs(e));else c.trailing=Vt(c.trailing,l,u)??"",n.push(c),c.leading=s??"",s=fs(e);r=u!=null}let o=new us(n);return nn(e,o,t,e.lastToken),o.trailing=s??"",o}var Xd=R(()=>{lo();Fd();kb();Tb();Go()});function Lb(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function tN(e){{let t=Fe(e,Ho);if(t)return{type:"bom",text:t.text}}{let t=Fe(e,cs);if(t)return{type:"newline",text:t.text}}{let t=Fe(e,io);if(t)return{type:"space",text:t.text}}{let t=ka(e);if(t)return{type:"singleline",text:t}}{let t=hl(e);if(t)return{type:"multiline",text:t}}return}function bl(e){{let t=gl(e);if(t)return{type:"line-escape",text:t}}{let t=Fe(e,io);if(t)return{type:"space",text:t.text}}{let t=hl(e);if(t)return{type:"multiline",text:t}}return}function Vb(e){let t=[];while(!0){{let n=tN(e);if(n){t.push(n);continue}}if(Fe(e,oo)?.text){let r,s=Lb(e,bl)??[],o=xl(e);if(!o)throw je(e,"Invalid slashdash, expected a commented node");o.trailing=Vt(o.trailing,Lb(e,bl)?.map((i)=>i.text).join(""),yl(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function nN(e){let t=Fe(e,oo);if(t==null)return;let n,r=[];while(n=bl(e))r.push(n);let s,o,i="";if(o=ti(e)){if(s=o[0],o[1])i=o[1]}else if(o=Gd(e))s=o;else throw je(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Yd(e){let t=[];while(!0){let n=bl(e);if(!n)break;let r=!0;t.push(n);while(r){let s=nN(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Yd(ml(s[1][0],ja(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var qb=R(()=>{Go();Xd()});function ds(e,{as:t="document",flags:n,...r}={}){let s=rN[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 o=Pb(n),i=ja(e,{...r,flags:o}),a=ml(e,i,{...r,flags:o}),c;try{c=s(a)}catch(l){Ud(a,l)}if(Ud(a),!c)throw new Oe(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return c}var rN;var Wb=R(()=>{lo();Go();Xd();qb();rN={value:pl,identifier:zd,node:Db,entry:Ib,document:Mb,"whitespace in document":Vb,"whitespace in node":Yd}});var $l=R(()=>{lo();Fd();Wb()});function ni(e,t){let n=e.slice(0,t),r=n.split(`
|
|
18
|
+
`+i.slice(r.length)}).slice(1,-1)}function J$(e,t,n,r,s,o,i,a){if(i)return"";if(o){let l=n.text.startsWith('"""'),c=t.slice(0,a).split(pi),u={offset:n.start.offset+(l?3:1)+a,line:n.start.line+(c.length-1),column:c.length===1?n.start.column+(l?3:1)+a:c.at(-1).length},d={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new Ce(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:d}));else e.push(new Ce(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:d}));return""}else if(s){let l=parseInt(s,16);if(l>=55296&&l<=57343)e.push(new Ce(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(l)}else{let l=hT.get(r);if(l==null)return e.push(new Ce(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return l}}function Va(e,t,n){let r=1;switch(e.type){case ii:r=3;break;case ws:r=e.text.indexOf('"')+1;break;case yo:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(pi);return{offset:e.start.offset+r+n,line:e.start.line+(s.length-1),column:s.length===1?e.start.column+r+n:1+s[s.length-1].length}}var w6,hT,pi,gT,yT,xT,bT,$T,ST,wT,vT,ET;var M$=J(()=>{bo();li();w6=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"]]),hT=new Map([["\\n",`
|
|
19
|
+
`],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),pi=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,gT=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,yT=/(?:^|[^\\\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,xT=/(?:^|[^\\\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;bT=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,$T=/(?:^|[^\\\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]*)*$/,ST=/(\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,wT=/([^\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]*$/;vT=/\\(?:$|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;ET=/(\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 ts(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 Ue(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return ts(e),n}}function _e(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Ce(t,{token:n})}function dn(e,t,n,r=n){if(e.storeLocations)_$(t,n,r)}function Kt(e="",t="",n=""){return e+t+n||void 0}function Hc(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return ts(o),o}function Np(e,t){if(!t&&!e.current.done&&e.current.value.type!==Ss)t=_e(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof Ce)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Ce(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new Ce("Encountered multiple errors",{errors:n})}function Vc(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 I$(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Tp(e){let{value:t}=e.current,n,r,s,o,i,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case Er:{if(!e.flags.experimentalSuffixedNumbers)throw new Ce("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,d=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,d),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(d),I$(s))e.errors.push(_e(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Tc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Nc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Qr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Rc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case oi:if(n=Vc(t.text),n===void 0)if(n=null,Vc(t.text.toLowerCase())!==void 0)e.errors.push(_e(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(_e(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(_e(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(_e(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}ts(e);let l=e.flags.experimentalSuffixedNumbers&&Ue(e,oi);if(l)if(a){if(o=l.text,Vc(o)!==void 0)e.errors.push(_e(l,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(_e(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(_e(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(_e(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new ar(n);if(c.representation=r??t.text,dn(e,c,t),s){let u=new Pr(s);u.representation=o,u.suffix=!0,dn(e,u,e.lastToken),c.tag=u}return c}function qa(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case zt:if(ts(e),I$(t.text))e.errors.push(_e(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case Ma:ts(e),n=[N$(e.errors,t.text.slice(1,-1),t),t.text,t];break;case ii:ts(e),n=[T$(e.errors,t.text.slice(3,-3),t),t.text,t];break;case ws:{ts(e);let r=t.text,s=r.indexOf('"');n=[C$(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case yo:{ts(e);let r=t.text,s=r.indexOf('"');n=[R$(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Ue(e,oi))e.errors.push(_e(e.lastToken,Vc(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 n}function Jp(e){let t=qa(e);if(!t)return;let n=new ir(t[0]);return n.representation=t[1],dn(e,n,t[2],e.lastToken),n}function qc(e){let t=Tp(e);if(t)return t;let n=qa(e);if(!n)return;let r=new ar(n[0]);return r.representation=n[1],dn(e,r,n[2],e.lastToken),r}function Ha(e){let t=Ue(e,Mc);if(!t)return;let{value:n}=e.current;return ts(e),t.text+(n?.text??"")}function Wc(e){return Ue(e,Ic)?.text}function Mp(e){return Ue(e,go)??Wc(e)}function Bc(e){let t=Ue(e,Jc);if(!t)return;while(Mp(e));if(!Ha(e)&&!Ue(e,vs)&&!Ue(e,Ss))e.errors.push(_e(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 Ps(e){let t=e.lastToken.end;while(Ue(e,vs)?.text??Ha(e)??Mp(e)??Bc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function At(e){let t=e.lastToken.end;while(Mp(e)??Bc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Rp(e){let t=Ue(e,kc);if(!t)return;let n=At(e),r=qa(e);if(!r&&e.current.value){let a=e.current.value;if(Ps(e))e.errors.push(_e(a,"This type of whitespace is not allowed inside a tag"));r=qa(e)}if(!r){if(Tp(e))e.errors.push(_e(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw _e(e,"Invalid tag, did you forget to quote a string?");let s=At(e),o=Ue(e,Ja);if(!o&&e.current.value){let a=e.current.value;if(Ps(e))e.errors.push(_e(a,"This type of whitespace is not allowed inside a tag"));o=Ue(e,Ja)}if(!o)throw _e(e,"Invalid tag, did you forget to quote a string?");let i=new Pr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,dn(e,i,t,e.lastToken),i}function Uc(e){return Ha(e)??Ue(e,vs)?.text??Ue(e,Cc)?.text??Ue(e,Ss)?.text}function Ip(e){if(!Ue(e,Oc))return;let t=V$(e);if(!Ue(e,Ac))throw _e(e,"Invalid node children");return t}function mi(e){let t=e.current.value;{let d=Rp(e);if(d){let p=At(e),m=qc(e);if(!m)throw _e(e,"Invalid argument");if(m.tag)e.errors.push(_e(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let y=new _n(m,null);dn(e,m,t,e.lastToken),dn(e,y,t,e.lastToken);let S=At(e);if(Ue(e,si))e.errors.push(_e(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),S=Kt(S,At(e))||" ";return[y,S]}}{let d=Tp(e);if(d){let p=new _n(d,null);dn(e,p,t,e.lastToken);let m=At(e);if(Ue(e,si))e.errors.push(_e(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Kt(m,At(e))||" ";return[p,m]}}let n=qa(e);if(!n)return;let r=At(e),s=Ue(e,si);if(!s){let d=new ar(n[0]);d.representation=n[1],dn(e,d,n[2]);let p=new _n(d,null);return dn(e,p,t,e.lastToken),[p,r]}let o=new ir(n[0]);o.representation=n[1],dn(e,o,n[2]);let i=At(e),a=Rp(e),l=a&&At(e),c=qc(e);if(!c)throw _e(e,"Expected a value");if(a){if(c.tag)e.errors.push(_e(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new _n(c,o);return dn(e,u,t,e.lastToken),u.equals=Kt(r,s.text,i),[u,void 0]}function D$(e){let t=At(e)??"",n;while(n=wo(e)){let i=e.lastToken.end,a=mi(e);if(!a)throw _e(e,"Expected a property or argument");if(!(a[1]??At(e)))throw _e(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=mi(e);if(!r)return;let s=r[1]??At(e)??"";while(n=wo(e)){let i=e.lastToken.end,a=mi(e);if(!a)throw _e(e,"Expected a property or argument");if(!(a[1]??At(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function wo(e){let t=Ue(e,ho)?.text;if(!t)return;return Kt(t,Ps(e))}function zc(e){let t=e.current.value,n=Rp(e),r=n&&At(e),s=Jp(e);if(!s)if(n)throw _e(e,"Couldn't find node name");else return;let o=At(e),i=o!=null,a=wo(e),l=[];while(i||a){let p=e.lastToken.end,m=mi(e);if(!m)break;if(a)i=(m[1]||At(e))!=null,o=Kt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=wo(e);else{let y=m[0];y.leading=o,l.push(y),o=m[1]||At(e),i=o!=null,a=wo(e)}}let c,u;while(!0){a??=wo(e);let p=e.lastToken.end,m=Ip(e);if(!m){if(a)throw _e(e,"Unexpected slashdash");break}if(a)o=Kt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(_e(e,"A node can only have one children block"));c=m,u=o??"",o=void 0}o=Kt(o,At(e))}let d=new fi(s,l,c);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",dn(e,d,t,e.lastToken),d}function L$(e){let t=Ps(e),n=zc(e);if(!n)return;let r=Kt(Uc(e),Ps(e));return n.leading=Kt(t,n.leading),n.trailing=Kt(n.trailing,r),n}function F$(e){let t=Ue(e,ri)?.text,n=V$(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Kt(t,n.nodes[0].leading);else n.trailing=Kt(t,n.trailing);return n}function V$(e){let t=e.current.value,n=[],r=!0,s=Ps(e);while(r){let i=e.lastToken.end,a=wo(e),l=zc(e);if(!l){if(a)throw _e(e,"Unexpected slashdash");break}let c=At(e),u=Uc(e);if(a)s=Kt(s,e.text.slice(i.offset,e.lastToken.end.offset),Ps(e));else l.trailing=Kt(l.trailing,c,u)??"",n.push(l),l.leading=s??"",s=Ps(e);r=u!=null}let o=new js(n);return dn(e,o,t,e.lastToken),o.trailing=s??"",o}var Dp=J(()=>{bo();_p();A$();M$();li()});function q$(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function jT(e){{let t=Ue(e,ri);if(t)return{type:"bom",text:t.text}}{let t=Ue(e,vs);if(t)return{type:"newline",text:t.text}}{let t=Ue(e,go);if(t)return{type:"space",text:t.text}}{let t=Ha(e);if(t)return{type:"singleline",text:t}}{let t=Wc(e);if(t)return{type:"multiline",text:t}}return}function Kc(e){{let t=Bc(e);if(t)return{type:"line-escape",text:t}}{let t=Ue(e,go);if(t)return{type:"space",text:t.text}}{let t=Wc(e);if(t)return{type:"multiline",text:t}}return}function H$(e){let t=[];while(!0){{let n=jT(e);if(n){t.push(n);continue}}if(Ue(e,ho)?.text){let r,s=q$(e,Kc)??[],o=zc(e);if(!o)throw _e(e,"Invalid slashdash, expected a commented node");o.trailing=Kt(o.trailing,q$(e,Kc)?.map((i)=>i.text).join(""),Uc(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function PT(e){let t=Ue(e,ho);if(t==null)return;let n,r=[];while(n=Kc(e))r.push(n);let s,o,i="";if(o=mi(e)){if(s=o[0],o[1])i=o[1]}else if(o=Ip(e))s=o;else throw _e(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Lp(e){let t=[];while(!0){let n=Kc(e);if(!n)break;let r=!0;t.push(n);while(r){let s=PT(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Lp(Hc(s[1][0],Fa(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var W$=J(()=>{li();Dp()});function _s(e,{as:t="document",flags:n,...r}={}){let s=_T[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 o=k$(n),i=Fa(e,{...r,flags:o}),a=Hc(e,i,{...r,flags:o}),l;try{l=s(a)}catch(c){Np(a,c)}if(Np(a),!l)throw new Ce(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var _T;var B$=J(()=>{bo();li();Dp();W$();_T={value:qc,identifier:Jp,node:L$,entry:D$,document:F$,"whitespace in document":H$,"whitespace in node":Lp}});var Gc=J(()=>{bo();_p();B$()});function hi(e,t){let n=e.slice(0,t),r=n.split(`
|
|
20
20
|
`).length;return{column:t-n.lastIndexOf(`
|
|
21
|
-
`),line:r,offset:t}}var Nt;var ri=R(()=>{Nt=class Nt 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 Nt(`${e}: ${this.reason}`,t)}}});var Hb;var Ub=R(()=>{Hb=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","oncsrcchange","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","onicecandidatepairadd","onicecandidatepairnominate","onicecandidatepairremove","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","onssrcchange","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 we(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw Pe(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw Pe(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function Pe(e,t,n){let r=wl(t)?.start;return new Nt(n,r===void 0?null:ni(e.text,r))}function wl(e){let t=Xo(e);return t?{end:t.end.offset,start:t.start.offset}:null}function mt(e,t,n){let r=e.spans?wl(n):null;if(r)e.spans?.set(t,r)}function Bb(e,t,n){let r=e.tokens&&n?wl(n):null;if(r)e.tokens?.names.set(t,r)}function Ot(e,t,n){let r=e.tokens&&n?wl(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function ps(e){return e.entries.filter((t)=>!t.name)}function ze(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function si(e,t){let n=t.getTag();if(n!==null&&!Gb.has(n))throw Pe(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw Pe(e,t,"(ref) annotates a value, and this is a name");return n}function qr(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw Pe(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(We(r)){if(!Number.isFinite(r))throw Pe(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw Pe(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!k(r))throw Pe(e,t,"(ref) needs a string");return{$ref:r}}return r}function kn(e,t){return t.entries.filter((n)=>!n.name).map((n)=>qr(e,n))}function On(e){return e.entries.filter((t)=>t.name)}function Tt(e){return e.children?.nodes??[]}function pr(e){return e.getName()??""}function iN(e,t,n){let r={$prototype:"Function"},s=kn(e,t),o=Tt(t);for(let a of On(t))we(r,pr(a),qr(e,a),e,a),Ot(e,`${n}/${ze(pr(a))}`,a);let i=e.tokens?ps(t):[];if(o.length>0){if(s.length>0)we(r,"parameters",s,e,t);we(r,"body",Zd(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,c=s.slice(0,-1);if(c.length>0)we(r,"parameters",c,e,t);we(r,"body",a,e,t),Ot(e,`${n}/body`,i.pop())}for(let[a,c]of i.entries())Ot(e,`${n}/parameters/${a}`,c);return mt(e,n,t),r}function aN(e,t,n){let r={$prototype:"Function",$src:"#client"};if(kn(e,t).length>0||Tt(t).length>0)throw Pe(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of On(t))we(r,pr(s),qr(e,s),e,s),Ot(e,`${n}/${ze(pr(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return mt(e,n,t),r}function cN(e,t,n){if(kn(e,t).length>0||Tt(t).length>0)throw Pe(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=On(t);if(s.length>0){let o={};for(let i of s){let a=pr(i);we(o,a,qr(e,i),e,i),mt(e,`${n}/arguments/${ze(a)}`,i),Ot(e,`${n}/arguments/${ze(a)}`,i)}r.arguments=o}return mt(e,n,t),r}function lN(e,t,n){let r={};for(let c of On(t)){let l=pr(c);if(we(r,l,qr(e,c),e,c),l!=="timing"||r[l]!=="server")throw Pe(e,c,"A script takes timing=server, and nothing else")}let s=kn(e,t),[o]=s;if(s.length!==1||!k(o)||Tt(t).length>0)throw Pe(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",a=n.$script;if(!L(a)||!zb.has(a))a={},zb.add(a),we(n,"$script",a,e,t);we(a,i,o,e,t),mt(e,`/$script/${i}`,t),Ot(e,`/$script/${i}`,ps(t)[0])}function Kb(e,t,n){for(let[r,s]of(e.tokens?ps(n):[]).entries())Ot(e,`${t}/${r}`,s)}function Zd(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw Pe(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return _n(e,s,`${n}/${r+o}`)})}function _n(e,t,n){let r=si(e,t);if(mt(e,n,t),r==="fn")return iN(e,t,n);if(r==="export")return aN(e,t,n);if(r==="server")return cN(e,t,n);let s=kn(e,t),o=On(t),i=Tt(t);if(r==="array"){if(o.length>0)throw Pe(e,t,"(array) holds items, and these are named");return Kb(e,n,t),[...s,...Zd(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw Pe(e,t,"A list of values cannot also have names or a block");return Kb(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw Pe(e,t,"A value cannot also have names or a block");return Ot(e,n,ps(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((c)=>c.getName()==="-"))return Zd(e,i,n)}else if(s.length>0)throw Pe(e,t,"(object) holds names, and this is a value");let a={};for(let c of o){let l=pr(c);we(a,l,qr(e,c),e,c),mt(e,`${n}/${ze(l)}`,c),Bb(e,`${n}/${ze(l)}`,c.name),Ot(e,`${n}/${ze(l)}`,c)}for(let c of i){let l=c.getName();we(a,l,_n(e,c,`${n}/${ze(l)}`),e,c),Bb(e,`${n}/${ze(l)}`,c.name)}return a}function vl(e,t,n){let r={};if(mt(e,n,t),kn(e,t).length>0)throw Pe(e,t,"A style block holds declarations, and this is a value");for(let s of On(t)){let o=pr(s);we(r,o,qr(e,s),e,s),mt(e,`${n}/${ze(o)}`,s),Ot(e,`${n}/${ze(o)}`,s)}for(let s of Tt(t)){let o=s.getName(),i=`${n}/${ze(o)}`,a=Tt(s);if(s.getTag()==="array"||a.length>0&&a.every((l)=>l.getName()==="-")){we(r,o,_n(e,s,i),e,s);continue}let c=kn(e,s);if(c.length>1)throw Pe(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(c.length===1){if(On(s).length>0||Tt(s).length>0)throw Pe(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);we(r,o,c[0]??null,e,s),mt(e,i,s),Ot(e,i,ps(s)[0])}else we(r,o,vl(e,s,i),e,s)}return r}function Sl(e,t,n){let r=Tt(t);if(r.length!==1||!r[0])throw Pe(e,t,`"${t.getName()}" holds one element`);return Yb(e,r[0],n)}function Xb(e,t,n){let r={$prototype:"Array"};if(mt(e,n,t),kn(e,t).length>0)throw Pe(e,t,"$array holds names and one element, and this is a value");for(let s of On(t)){let o=pr(s),i=o.startsWith(".")?o.slice(1):o;we(r,i,qr(e,s),e,s),Ot(e,`${n}/${ze(i)}`,s)}if(Tt(t).length>0)we(r,"map",Sl(e,t,`${n}/map`),e,t);return r}function Yb(e,t,n){let r=t.getName();if(r==="-"){let s=kn(e,t);if(s.length!==1||On(t).length>0||Tt(t).length>0)throw Pe(e,t,'"-" is one piece of text or one (ref)');return mt(e,n,t),Ot(e,n,ps(t)[0]),s[0]??null}if(r==="$array")return Xb(e,t,n);return Qd(e,t,n)}function uN(e,t,n,r){let s=si(e,n);if(t==="map")return Sl(e,n,r);if(t==="cases"){let o={};for(let i of Tt(n)){let a=i.getName();we(o,a,Sl(e,i,`${r}/${ze(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Tt(n).length>0)return Sl(e,n,r);return _n(e,n,r)}function Qd(e,t,n){let r={},s=t.getName(),o=si(e,t);if(mt(e,n,t),o!==null)throw Pe(e,t,`(${o}) cannot annotate an element`);let i=kn(e,t);if(s==="$element"){let[c,l,...u]=i;if(u.length>0)throw Pe(e,t,"$element takes at most a tag and a text value");if(c!==void 0)we(r,"tagName",c,e,t);if(l!==void 0)we(r,"textContent",l,e,t),Ot(e,`${n}/textContent`,ps(t)[1])}else{if(s.startsWith("$"))throw Pe(e,t,`"${s}" is not a kind of element`);if(we(r,"tagName",s,e,t),i.length>1)throw Pe(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)we(r,"textContent",i[0],e,t),mt(e,`${n}/textContent`,t),Ot(e,`${n}/textContent`,ps(t)[0])}fN(e,t,r,n);let a=[];for(let c of Tt(t))dN(e,c,r,a,n);if(a.length>0)we(r,"children",a,e,t);return r}function Zb(e){let{attributes:t}=e;if(L(t))return t;let n={};return e.attributes=n,n}function fN(e,t,n,r){for(let s of On(t)){let o=pr(s),i=s.getTag();if(i==="fn")throw Pe(e,s,"A function has a block form: (fn)name, on a line of its own");let a=qr(e,s);if(o.startsWith(".")||o.startsWith("$")){let c=o.startsWith(".")?o.slice(1):o;we(n,c,a,e,s),mt(e,`${r}/${ze(c)}`,s),Ot(e,`${r}/${ze(c)}`,s)}else if(o.startsWith("on")&&i==="ref")we(n,o,a,e,s),mt(e,`${r}/${ze(o)}`,s),Ot(e,`${r}/${ze(o)}`,s);else if(o.startsWith("on")&&Hb.has(o))throw Pe(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else we(Zb(n),o,a,e,s),mt(e,`${r}/attributes/${ze(o)}`,s),Ot(e,`${r}/attributes/${ze(o)}`,s)}}function dN(e,t,n,r,s){let o=t.getName(),i=si(e,t),a=(c)=>`${s}/${ze(c)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw Pe(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);we(n,o,_n(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw Pe(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw Pe(e,t,`(${i}) cannot annotate a script`);lN(e,t,n)}else if(o==="state")we(n,"state",_n(e,t,a("state")),e,t);else if(o==="style")we(n,"style",vl(e,t,a("style")),e,t);else if(o==="attributes"){let c=_n(e,t,a("attributes"));if(L(c))for(let[l,u]of Object.entries(c))we(Zb(n),l,u,e,t);else we(n,"attributes",c,e,t)}else if(o.startsWith(".")){let c=o.slice(1);we(n,c,uN(e,c,t,a(c)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")we(n,o,_n(e,t,a(o)),e,t);else{if(oN.has(o))throw Pe(e,t,`"${o}" is reserved here`);r.push(Yb(e,t,`${s}/children/${r.length}`))}}function ep(e,t){return Tt(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?_n(e,n,s):Qd(e,n,s)})}function tp(e){let t=sN.exec(e);if(t)throw new Nt(`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}`,ni(e,t.index));try{return ds(e,{storeLocations:!0})}catch(n){let s=(n instanceof Oe?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new Nt(o.split(`
|
|
22
|
-
`)[0]??o,s?
|
|
23
|
-
`,n);n=r===-1?e.length:r}else if(e.startsWith("/*",n)){t.comments+=1;let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(e.startsWith("/-",n))t.comments+=1,n+=2;else if(e.charAt(n)==="#"&&/^#+"/u.test(e.slice(n,n+16))){let[r=""]=/^#+/u.exec(e.slice(n))??[],s=n+r.length,o=e.startsWith('"""',s)?'"""':'"',i=e.indexOf(o+r,s+o.length);n=i===-1?e.length:i+o.length+r.length}else if(e.charAt(n)==='"'){let r=e.startsWith('"""',n)?'"""':'"';n+=r.length;while(n<e.length&&!e.startsWith(r,n))if(e.charAt(n)==="\\")t.escapes.push(n),n+=2;else n+=1;n+=r.length}else n+=1;return t}function
|
|
24
|
-
`)+1)}function
|
|
21
|
+
`),line:r,offset:t}}var Ft;var gi=J(()=>{Ft=class Ft 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 Ft(`${e}: ${this.reason}`,t)}}});var U$;var z$=J(()=>{U$=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","oncsrcchange","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","onicecandidatepairadd","onicecandidatepairnominate","onicecandidatepairremove","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","onssrcchange","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 je(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw ke(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw ke(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function ke(e,t,n){let r=Yc(t)?.start;return new Ft(n,r===void 0?null:hi(e.text,r))}function Yc(e){let t=ci(e);return t?{end:t.end.offset,start:t.start.offset}:null}function wt(e,t,n){let r=e.spans?Yc(n):null;if(r)e.spans?.set(t,r)}function K$(e,t,n){let r=e.tokens&&n?Yc(n):null;if(r)e.tokens?.names.set(t,r)}function Jt(e,t,n){let r=e.tokens&&n?Yc(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function ks(e){return e.entries.filter((t)=>!t.name)}function nt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function yi(e,t){let n=t.getTag();if(n!==null&&!Y$.has(n))throw ke(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw ke(e,t,"(ref) annotates a value, and this is a name");return n}function ns(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw ke(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(Ie(r)){if(!Number.isFinite(r))throw ke(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw ke(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!k(r))throw ke(e,t,"(ref) needs a string");return{$ref:r}}return r}function Ln(e,t){return t.entries.filter((n)=>!n.name).map((n)=>ns(e,n))}function Fn(e){return e.entries.filter((t)=>t.name)}function Vt(e){return e.children?.nodes??[]}function _r(e){return e.getName()??""}function AT(e,t,n){let r={$prototype:"Function"},s=Ln(e,t),o=Vt(t);for(let a of Fn(t))je(r,_r(a),ns(e,a),e,a),Jt(e,`${n}/${nt(_r(a))}`,a);let i=e.tokens?ks(t):[];if(o.length>0){if(s.length>0)je(r,"parameters",s,e,t);je(r,"body",Fp(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,l=s.slice(0,-1);if(l.length>0)je(r,"parameters",l,e,t);je(r,"body",a,e,t),Jt(e,`${n}/body`,i.pop())}for(let[a,l]of i.entries())Jt(e,`${n}/parameters/${a}`,l);return wt(e,n,t),r}function CT(e,t,n){let r={$prototype:"Function",$src:"#client"};if(Ln(e,t).length>0||Vt(t).length>0)throw ke(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of Fn(t))je(r,_r(s),ns(e,s),e,s),Jt(e,`${n}/${nt(_r(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return wt(e,n,t),r}function RT(e,t,n){if(Ln(e,t).length>0||Vt(t).length>0)throw ke(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=Fn(t);if(s.length>0){let o={};for(let i of s){let a=_r(i);je(o,a,ns(e,i),e,i),wt(e,`${n}/arguments/${nt(a)}`,i),Jt(e,`${n}/arguments/${nt(a)}`,i)}r.arguments=o}return wt(e,n,t),r}function NT(e,t,n){let r={};for(let l of Fn(t)){let c=_r(l);if(je(r,c,ns(e,l),e,l),c!=="timing"||r[c]!=="server")throw ke(e,l,"A script takes timing=server, and nothing else")}let s=Ln(e,t),[o]=s;if(s.length!==1||!k(o)||Vt(t).length>0)throw ke(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",a=n.$script;if(!L(a)||!G$.has(a))a={},G$.add(a),je(n,"$script",a,e,t);je(a,i,o,e,t),wt(e,`/$script/${i}`,t),Jt(e,`/$script/${i}`,ks(t)[0])}function X$(e,t,n){for(let[r,s]of(e.tokens?ks(n):[]).entries())Jt(e,`${t}/${r}`,s)}function Fp(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw ke(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return Dn(e,s,`${n}/${r+o}`)})}function Dn(e,t,n){let r=yi(e,t);if(wt(e,n,t),r==="fn")return AT(e,t,n);if(r==="export")return CT(e,t,n);if(r==="server")return RT(e,t,n);let s=Ln(e,t),o=Fn(t),i=Vt(t);if(r==="array"){if(o.length>0)throw ke(e,t,"(array) holds items, and these are named");return X$(e,n,t),[...s,...Fp(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw ke(e,t,"A list of values cannot also have names or a block");return X$(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw ke(e,t,"A value cannot also have names or a block");return Jt(e,n,ks(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((l)=>l.getName()==="-"))return Fp(e,i,n)}else if(s.length>0)throw ke(e,t,"(object) holds names, and this is a value");let a={};for(let l of o){let c=_r(l);je(a,c,ns(e,l),e,l),wt(e,`${n}/${nt(c)}`,l),K$(e,`${n}/${nt(c)}`,l.name),Jt(e,`${n}/${nt(c)}`,l)}for(let l of i){let c=l.getName();je(a,c,Dn(e,l,`${n}/${nt(c)}`),e,l),K$(e,`${n}/${nt(c)}`,l.name)}return a}function Zc(e,t,n){let r={};if(wt(e,n,t),Ln(e,t).length>0)throw ke(e,t,"A style block holds declarations, and this is a value");for(let s of Fn(t)){let o=_r(s);je(r,o,ns(e,s),e,s),wt(e,`${n}/${nt(o)}`,s),Jt(e,`${n}/${nt(o)}`,s)}for(let s of Vt(t)){let o=s.getName(),i=`${n}/${nt(o)}`,a=Vt(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){je(r,o,Dn(e,s,i),e,s);continue}let l=Ln(e,s);if(l.length>1)throw ke(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(Fn(s).length>0||Vt(s).length>0)throw ke(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);je(r,o,l[0]??null,e,s),wt(e,i,s),Jt(e,i,ks(s)[0])}else je(r,o,Zc(e,s,i),e,s)}return r}function Xc(e,t,n){let r=Vt(t);if(r.length!==1||!r[0])throw ke(e,t,`"${t.getName()}" holds one element`);return Q$(e,r[0],n)}function Z$(e,t,n){let r={$prototype:"Array"};if(wt(e,n,t),Ln(e,t).length>0)throw ke(e,t,"$array holds names and one element, and this is a value");for(let s of Fn(t)){let o=_r(s),i=o.startsWith(".")?o.slice(1):o;je(r,i,ns(e,s),e,s),Jt(e,`${n}/${nt(i)}`,s)}if(Vt(t).length>0)je(r,"map",Xc(e,t,`${n}/map`),e,t);return r}function Q$(e,t,n){let r=t.getName();if(r==="-"){let s=Ln(e,t);if(s.length!==1||Fn(t).length>0||Vt(t).length>0)throw ke(e,t,'"-" is one piece of text or one (ref)');return wt(e,n,t),Jt(e,n,ks(t)[0]),s[0]??null}if(r==="$array")return Z$(e,t,n);return Vp(e,t,n)}function TT(e,t,n,r){let s=yi(e,n);if(t==="map")return Xc(e,n,r);if(t==="cases"){let o={};for(let i of Vt(n)){let a=i.getName();je(o,a,Xc(e,i,`${r}/${nt(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Vt(n).length>0)return Xc(e,n,r);return Dn(e,n,r)}function Vp(e,t,n){let r={},s=t.getName(),o=yi(e,t);if(wt(e,n,t),o!==null)throw ke(e,t,`(${o}) cannot annotate an element`);let i=Ln(e,t);if(s==="$element"){let[l,c,...u]=i;if(u.length>0)throw ke(e,t,"$element takes at most a tag and a text value");if(l!==void 0)je(r,"tagName",l,e,t);if(c!==void 0)je(r,"textContent",c,e,t),Jt(e,`${n}/textContent`,ks(t)[1])}else{if(s.startsWith("$"))throw ke(e,t,`"${s}" is not a kind of element`);if(je(r,"tagName",s,e,t),i.length>1)throw ke(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)je(r,"textContent",i[0],e,t),wt(e,`${n}/textContent`,t),Jt(e,`${n}/textContent`,ks(t)[0])}JT(e,t,r,n);let a=[];for(let l of Vt(t))MT(e,l,r,a,n);if(a.length>0)je(r,"children",a,e,t);return r}function eS(e){let{attributes:t}=e;if(L(t))return t;let n={};return e.attributes=n,n}function JT(e,t,n,r){for(let s of Fn(t)){let o=_r(s),i=s.getTag();if(i==="fn")throw ke(e,s,"A function has a block form: (fn)name, on a line of its own");let a=ns(e,s);if(o.startsWith(".")||o.startsWith("$")){let l=o.startsWith(".")?o.slice(1):o;je(n,l,a,e,s),wt(e,`${r}/${nt(l)}`,s),Jt(e,`${r}/${nt(l)}`,s)}else if(o.startsWith("on")&&i==="ref")je(n,o,a,e,s),wt(e,`${r}/${nt(o)}`,s),Jt(e,`${r}/${nt(o)}`,s);else if(o.startsWith("on")&&U$.has(o))throw ke(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else je(eS(n),o,a,e,s),wt(e,`${r}/attributes/${nt(o)}`,s),Jt(e,`${r}/attributes/${nt(o)}`,s)}}function MT(e,t,n,r,s){let o=t.getName(),i=yi(e,t),a=(l)=>`${s}/${nt(l)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw ke(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);je(n,o,Dn(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw ke(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw ke(e,t,`(${i}) cannot annotate a script`);NT(e,t,n)}else if(o==="state")je(n,"state",Dn(e,t,a("state")),e,t);else if(o==="style")je(n,"style",Zc(e,t,a("style")),e,t);else if(o==="attributes"){let l=Dn(e,t,a("attributes"));if(L(l))for(let[c,u]of Object.entries(l))je(eS(n),c,u,e,t);else je(n,"attributes",l,e,t)}else if(o.startsWith(".")){let l=o.slice(1);je(n,l,TT(e,l,t,a(l)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")je(n,o,Dn(e,t,a(o)),e,t);else{if(OT.has(o))throw ke(e,t,`"${o}" is reserved here`);r.push(Q$(e,t,`${s}/children/${r.length}`))}}function qp(e,t){return Vt(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?Dn(e,n,s):Vp(e,n,s)})}function Hp(e){let t=kT.exec(e);if(t)throw new Ft(`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}`,hi(e,t.index));try{return _s(e,{storeLocations:!0})}catch(n){let s=(n instanceof Ce?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new Ft(o.split(`
|
|
22
|
+
`)[0]??o,s?hi(e,s.offset):null)}}function tS(e){if(ni(e.text)==="project")throw new Ft('This is a project file: its first node is "project". A document has an element there, and a <project> element is $element "project"');let n=Hp(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)je(r,i,qp(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")je(r,i,Dn(e,o,`/${nt(i)}`),e,o),wt(e,`/${nt(i)}`,o);else if(s)throw ke(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?Z$(e,s,""):Vp(e,s,"");for(let[i,a]of Object.entries(o))je(r,i,a,e,s)}return ei(r)}function vo(e,t){try{return tS({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Ft?n.inFile(t):n}}function Wp(e){let t=new Map;return{document:tS({spans:t,text:e}),spans:t}}var kT,Y$,OT,G$;var Wa=J(()=>{Gc();ce();Lt();Ta();gi();z$();kT=/(?![\t\n\v\f\r])\p{Cc}/u,Y$=new Set(["array","export","fn","object","on","ref","server"]),OT=new Set(["attributes","script","state","style"]);G$=new WeakSet});function rs(e){return e.toLowerCase().endsWith(".jxn")}function Vn(e){return e.endsWith(".json")||rs(e)}function kn(e,t){return rs(t)?vo(e,t):Yb(e,t)}var Qc=J(()=>{Lt();Wa()});function LT(e){let t={comments:0,escapes:[]},n=DT.exec(e)?.[0].length??0;while(n<e.length)if(e.startsWith("//",n)){t.comments+=1;let r=e.indexOf(`
|
|
23
|
+
`,n);n=r===-1?e.length:r}else if(e.startsWith("/*",n)){t.comments+=1;let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(e.startsWith("/-",n))t.comments+=1,n+=2;else if(e.charAt(n)==="#"&&/^#+"/u.test(e.slice(n,n+16))){let[r=""]=/^#+/u.exec(e.slice(n))??[],s=n+r.length,o=e.startsWith('"""',s)?'"""':'"',i=e.indexOf(o+r,s+o.length);n=i===-1?e.length:i+o.length+r.length}else if(e.charAt(n)==='"'){let r=e.startsWith('"""',n)?'"""':'"';n+=r.length;while(n<e.length&&!e.startsWith(r,n))if(e.charAt(n)==="\\")t.escapes.push(n),n+=2;else n+=1;n+=r.length}else n+=1;return t}function Bp(e){return LT(e).escapes.flatMap((t)=>{let n=IT.get(e.charAt(t+1));return n?[{...hi(e,t),message:n}]:[]})}var IT,DT;var nS=J(()=>{gi();IT=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.`]]),DT=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function xi(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>xi(s,t)).join(",")}]`;if(!L(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${xi(e[s],t||s==="style")}`).join(",")}}`}function FT(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");if(Array.isArray(n))n=n[Number(s)];else n=L(n)?n[s]:void 0}return n}function VT({spans:e}){let t=new Map;for(let[n,r]of e){let s=t.get(r.start);if(s===void 0||n.length<s.length)t.set(r.start,n)}return t}function rS(e,t){let n=VT(e),r=new Map;for(let[s,o]of n)r.set(s,xi(FT(e.document,o)));return{meanings:r,pointers:n,text:t}}function ss(e){let t=ci(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function tu(e,t){let{end:n,start:r}=ss(e);return t.slice(r,n).trimEnd()}function eu(e,t){let{end:n,start:r}=ss(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function Gp(e){return e.children?.nodes??[]}function Up(e){let t=e.entries.map((o)=>`${o.getName()??""}=(${o.getTag()??""})${JSON.stringify(o.getValue())}`),n=t.filter((o)=>!o.startsWith("=")).toSorted(),r=t.filter((o)=>o.startsWith("=")),s=Gp(e).map((o)=>Up(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function zp(e,t,n){if(Up(t)===Up(n))return!0;let r=e.previous.meanings.get(ss(t).start);return r!==void 0&&r===e.next.meanings.get(ss(n).start)}function sS(e){let n=e.entries.filter((r)=>["$id","key"].includes(r.getName()??"")).map((r)=>JSON.stringify(r.getValue()));return`(${e.getTag()??""})${e.getName()} ${n.join(" ")}`}function oS(e,t,n){let r=e.length+1,s=t.length+1,o=new Int32Array(r*s);for(let c=e.length-1;c>=0;c-=1)for(let u=t.length-1;u>=0;u-=1){let d=e[c],p=t[u];o[c*s+u]=d!==void 0&&p!==void 0&&n(d,p)?(o[(c+1)*s+u+1]??0)+1:Math.max(o[(c+1)*s+u]??0,o[c*s+u+1]??0)}let i=[],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&&n(c,u))i.push([a,l]),a+=1,l+=1;else if((o[(a+1)*s+l]??0)>=(o[a*s+l+1]??0))a+=1;else l+=1}return i}function qT(e,t,n){let r=new Map,s=new Set,o=(c,u)=>{let d=t[c];if(d)r.set(u,d),s.add(c)},i=oS(t,n,(c,u)=>zp(e,c,u)),a=0,l=0;for(let[c,u]of[...i,[t.length,n.length]]){let d=oS(t.slice(a,c),n.slice(l,u),(p,m)=>sS(p)===sS(m));for(let[p,m]of d)o(a+p,l+m);if(c<t.length)o(c,u);a=c+1,l=u+1}for(let[c,u]of n.entries())if(!r.has(c)){let d=t.findIndex((p,m)=>!s.has(m)&&zp(e,p,u));if(d!==-1)o(d,c)}return r}function Xp(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
|
|
24
|
+
`)+1)}function HT(e,t,n){return e.split(`
|
|
25
25
|
`).map((r,s)=>s>0&&r.startsWith(t)?n+r.slice(t.length):r).join(`
|
|
26
|
-
`)}function
|
|
27
|
-
${p.join("")}${r}}`}function
|
|
26
|
+
`)}function WT(e,t,n){let r=[...n],s=(i)=>{let a=i.getName(),l=r.findIndex((c)=>c.getName()===a);return l===-1?void 0:r.splice(l,1)[0]},o="";for(let i of t.entries){let a=s(i);if(a){let l=a.getTag()===i.getTag()&&a.getValue()===i.getValue();o+=l?eu(i,e.previous.text):`${i.leading??" "}${eu(a,e.next.text).trimStart()}`}}for(let i of r)o+=` ${eu(i,e.next.text).trimStart()}`;return o}function BT(e,t,n){let r=new Map;for(let o of Gp(t)){let i=e.previous.pointers.get(ss(o).start);if(i!==void 0)r.set(i,o)}let s=new Map;for(let o of n.entries){let i=e.next.pointers.get(ss(o).start),a=i===void 0?void 0:r.get(i);if(a&&o.getName()!==null)s.set(a,o)}return s}function UT(e,t,n){let{text:r}=e.previous,s=eu(n,e.next.text).trimStart().slice(`${n.getName()}=`.length),[o]=t.entries;if(o?.getName()===null&&t.entries.length===1&&!t.children){if(o.getValue()===n.getValue()&&o.getTag()===n.getTag())return tu(t,r);return`${Kp(t,r)}${o.leading??" "}${s}`}return`${Kp(t,r)} ${s}`}function Kp(e,t){let{start:n}=ss(e),[r]=e.entries;if(r)return t.slice(n,ss(r).start-(r.leading??"").length);let s=e.children&&ci(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return tu(e,t)}function zT(e,t,n,r){let s=BT(e,t,n),o=new Set(s.values()),i=n.entries.filter((m)=>!o.has(m)),a=`${Kp(t,e.previous.text)}${WT(e,t,i)}`,l=Gp(n);if(l.length===0&&s.size===0)return a;let c=l[0]?Xp(l[0]):`${r} `,u=t.children,d=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&>(u,e.previous.text,t)){let m=`${r}${KT(u,r)}`;return`${a}${d}{${aS(e,u,l,m,c,s)}}`}let p=l.map((m)=>iS(e,m,c,`${r} `));return`${a}${d}{
|
|
27
|
+
${p.join("")}${r}}`}function KT(e,t){let[n]=e.nodes,r=n?Xp(n):"";return r.startsWith(t)?r.slice(t.length):" "}function GT(e,t,n){let{end:r,start:s}=ss(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
|
|
28
28
|
`)&&t.slice(s,r).includes(`
|
|
29
|
-
`)}function
|
|
30
|
-
`}function
|
|
31
|
-
`),u=
|
|
29
|
+
`)}function iS(e,t,n,r){return`${r}${HT(tu(t,e.next.text),n,r)}
|
|
30
|
+
`}function aS(e,t,n,r,s,o){let i=t.nodes.filter((g)=>!o.has(g)),a=qT(e,i,n),l=t.nodes[0]?.leading??"",c=l.indexOf(`
|
|
31
|
+
`),u=c===-1?"":l.slice(0,c+1),d=u,p=-1,m=()=>{if(d!==""&&!d.endsWith(`
|
|
32
32
|
`)&&!d.endsWith(";"))d+=`
|
|
33
|
-
`},
|
|
34
|
-
`)||d===u||d.endsWith(";"))){d+=`${
|
|
33
|
+
`},y=(g,x)=>{let P=t.nodes.indexOf(g),w=P===p+1||P>p;p=Math.max(p,P);let E=g===t.nodes[0]?l.slice(u.length):g.leading??"";if(w&&(E.includes(`
|
|
34
|
+
`)||d===u||d.endsWith(";"))){d+=`${E}${x}${g.trailing??""}`;return}if(!d.endsWith(`
|
|
35
35
|
`))d+=`
|
|
36
|
-
`;let
|
|
37
|
-
`)?
|
|
38
|
-
`)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(
|
|
36
|
+
`;let j=(g.trailing??"").replace(/^;/u,"");d+=`${E.includes(`
|
|
37
|
+
`)?E:r}${x}${j}`},S=(g)=>{for(let[x,P]of t.nodes.entries()){let w=o.get(P);if(w&&x<g&&x>p)m(),y(P,UT(e,P,w))}};for(let[g,x]of n.entries()){let P=a.get(g);if(P){S(t.nodes.indexOf(P)),m();let w=zp(e,P,x)?tu(P,e.previous.text):zT(e,P,x,Xp(P));y(P,w)}else m(),d+=iS(e,x,s,r)}return S(t.nodes.length),`${d}${t.trailing??""}`}function nu(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=xi(s.document);if(xi(r.document)===o)return e;let i={next:rS(s,t),previous:rS(r,e)},a=aS(i,_s(e,{storeLocations:!0}),_s(t,{storeLocations:!0}).nodes,"","",new Map);try{return xi(n(a).document)===o?a:t}catch{return t}}var ru=J(()=>{Gc();ce()});function fS(e){return!/\p{Cs}/u.test(e)}function dS(e,t){try{return _s(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function ou(e){let t='"';for(let n of e)if(n==='"')t+=String.raw`\"`;else if(n==="\\")t+=String.raw`\\`;else if(n===`
|
|
38
|
+
`)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(uS.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function pS(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function ZT(e,t){if(XT.test(e))return null;let n=pS(e,'"""'),r=`${t}${qt}`,s=e.split(`
|
|
39
39
|
`).map((i)=>i===""?"":r+i),o=`${n}"""
|
|
40
40
|
${s.join(`
|
|
41
41
|
`)}
|
|
42
|
-
${r}"""${n}`;return
|
|
43
|
-
`)){let r=
|
|
44
|
-
`))){let p=`${o} ${u.join(" ")}`;if(p.length<=
|
|
45
|
-
`)?null:`${
|
|
46
|
-
`))break;i.push(`${
|
|
47
|
-
`)})}function
|
|
48
|
-
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function
|
|
49
|
-
`))i.push(...
|
|
50
|
-
`))t.push(...
|
|
51
|
-
`)}`);else if(i.startsWith("$"))n.push(...
|
|
42
|
+
${r}"""${n}`;return dS(o,e)?o:null}function su(e,t,n){if(!fS(e))throw new Ft(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(cS.test(e))return e;if(e.includes(`
|
|
43
|
+
`)){let r=ZT(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!uS.test(e)){let r=pS(e,'"'),s=`${r}"${e}"${r}`;if(dS(s,e))return s}return ou(e)}function Mt(e,t){if(!fS(e))throw new Ft(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return cS.test(e)?e:ou(e)}function ft(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(Ie(e))return Object.is(e,-0)?"-0":String(e);if(k(e))return su(e,t,n);return Ua(e)?`(ref)${ou(e.$ref)}`:null}function mS(e){if(!Ht(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((c)=>ft(c,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((c)=>k(c))&&n!==void 0,a=n===void 0||k(n)||Array.isArray(n),l=Array.isArray(n)&&n.length===0;return o&&i&&a&&!l}function hS(e,t,n,r){let{$prototype:s,body:o,parameters:i,...a}=t,l=[`${n}(fn)${Mt(e,r)}`];for(let[c,u]of Object.entries(a))l.push(`${Mt(c,r)}=${ft(u,n,et(r,c))}`);if(Array.isArray(i))for(let c of i)l.push(su(String(c),n,et(r,"parameters")));if(k(o))l.push(su(o,n,et(r,"body")));else if(Array.isArray(o))return[`${l.join(" ")} {`,...o.flatMap((c,u)=>On("-",c,n+qt,et(et(r,"body"),u))),`${n}}`];return[l.join(" ")]}function QT(e){if(!Ht(e)||e.$prototype!=="Function"||e.$src!=="#client"||!k(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>ft(t,"","")!==null)}function eJ(e,t,n,r){let{$export:s,$prototype:o,$src:i,...a}=t,l=[`${n}(export)${Mt(e,r)}`];if(s!==e)l.push(`$export=${ft(s,n,et(r,"$export"))}`);for(let[c,u]of Object.entries(a))l.push(`${Mt(c,r)}=${ft(u,n,et(r,c))}`);return[l.join(" ")]}function nJ(e,t){if(!Ht(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>tJ.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=Ht(n)?Object.values(n):[];return r.length>0&&r.every((s)=>ft(s,"","")!==null)}function rJ(e,t,n,r){let s=[`${n}(server)${Mt(e,r)}`],o=et(r,"arguments"),i=Ht(t.arguments)?t.arguments:{};for(let[a,l]of Object.entries(i))s.push(`${Mt(a,o)}=${ft(l,n,et(o,a))}`);return[s.join(" ")]}function On(e,t,n,r){let s=Mt(e,r),o=n+s,i=ft(t,n,r);if(i!==null)return[`${o} ${i}`];if(QT(t))return eJ(e,t,n,r);if(nJ(e,t))return rJ(e,t,n,r);if(mS(t))return hS(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,m)=>ft(p,n,et(r,m)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
|
|
44
|
+
`))){let p=`${o} ${u.join(" ")}`;if(p.length<=Yp)return[p]}return[`${o} {`,...t.flatMap((p,m)=>On("-",p,n+qt,et(r,m))),`${n}}`]}let a=Ht(t)?Object.entries(t):[];if(a.length===0)return[`${o} {}`];let l=a.every(([u])=>u==="-")?`${n}(object)${s}`:o,c=a.map(([u,d])=>{let p=ft(d,n,et(r,u));return p===null||p.includes(`
|
|
45
|
+
`)?null:`${Mt(u,r)}=${p}`});if(c.every((u)=>u!==null)){let u=`${l} ${c.join(" ")}`;if(u.length<=Yp)return[u]}return[`${l} {`,...a.flatMap(([u,d])=>On(u,d,n+qt,et(r,u))),`${n}}`]}function gS(e,t,n,r){let s=Object.entries(t),o=n+Mt(e,r);if(s.length===0)return[`${o} {}`];let i=[],a=0;for(let[p,m]of s){let y=ft(m,n,et(r,p));if(y===null||y.includes(`
|
|
46
|
+
`))break;i.push(`${Mt(p,r)}=${y}`),a+=1}let l=`${o} ${i.join(" ")}`,c=i.length>0&&l.length<=Yp,u=c?a:0,d=s.slice(u).flatMap(([p,m])=>{if(Ht(m)&&!Ua(m))return gS(p,m,n+qt,et(r,p));return On(p,m,n+qt,et(r,p))});if(c&&d.length===0)return[l];return[`${c?l:o} {`,...d,`${n}}`]}function sJ(e){if(!Ht(e)||e.$prototype!=="Array"||!Ht(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=ft(s,"","");return o!==null&&!o.includes(`
|
|
47
|
+
`)})}function oJ(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[a,l]of Object.entries(o))i.push(`${Mt(a,n)}=${ft(l,t,et(n,a))}`);return[`${i.join(" ")} {`,...Ba(s??null,t+qt,et(n,"map")),`${t}}`]}function Ba(e,t,n){let r=ft(e,t,n);if(r!==null)return[`${t}- ${r}`];if(sJ(e))return oJ(e,t,n);if(Ht(e))return Zp(e,t,n);throw new Ft(`${n} is a list inside a list of children, which has no spelling`)}function iJ(e,t,n){let{tagName:r}=e;if(!k(r))return`${t}$element`;if(YT.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${ou(r)}`;return t+Mt(r,n)}function aJ(e,t){return t!==null&&!t.includes(`
|
|
48
|
+
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function lJ(e,t){let n=Ht(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!k(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${su(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function Zp(e,t,n,r=[]){let s=[iJ(e,t,n)],o=t+qt,i=[...r],a={},l=null;for(let[c,u]of Object.entries(e)){let d=et(n,c);if(c==="tagName"&&k(u))continue;if(c==="children")continue;if(c==="textContent"){let p=ft(u,t,d);if(p===null||!k(e.tagName))lS(s,i,c,u,o,t,d);else l=p}else if(c==="attributes"&&Ht(u))for(let[p,m]of Object.entries(u)){let y=ft(m,t,et(d,p));if(aJ(p,y))s.push(`${Mt(p,d)}=${y}`);else a[p]=m}else if(c==="state")i.push(...On("state",u,o,d));else if(c==="style"&&Ht(u))i.push(...gS("style",u,o,d));else if(c.startsWith("on")&&Ua(u))s.push(`${Mt(c,d)}=${ft(u,t,d)}`);else if(c.startsWith("on"))i.push(...mS(u)?hS(c,u,o,d):On(c,u,o,d).map((p,m)=>m===0?p.replace(o,`${o}(on)`):p));else if(c.startsWith("$")){let p=ft(u,t,d);if(p===null||p.includes(`
|
|
49
|
+
`))i.push(...On(c,u,o,d));else s.push(`${Mt(c,d)}=${p}`)}else lS(s,i,c,u,o,t,d)}if(Object.keys(a).length>0)i.push(...On("attributes",a,o,et(n,"attributes")));if(i.push(...cJ(e.children,o,et(n,"children"))),l!==null)s.push(l);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function cJ(e,t,n){if(e===void 0)return[];if(Array.isArray(e)){if(e.length===0)return[`${t}(array).children`];return e.flatMap((s,o)=>Ba(s,t,et(n,o)))}let r=ft(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Ba(e,t+qt,n),`${t}}`]}function lS(e,t,n,r,s,o,i){let a=Mt(`.${n}`,i);if(n==="map"&&Ht(r)){t.push(`${s}${a} {`,...Ba(r,s+qt,i),`${s}}`);return}if(n==="cases"&&Ht(r)){t.push(`${s}${a} {`);for(let[c,u]of Object.entries(r))t.push(`${s}${qt}${Mt(c,i)} {`,...Ba(u,s+qt+qt,et(i,c)),`${s}${qt}}`);t.push(`${s}}`);return}let l=ft(r,o,i);if(l===null||l.includes(`
|
|
50
|
+
`))t.push(...On(`.${n}`,r,s,i));else e.push(`${a}=${l}`)}function yS(e,t){return["$head {",...e.flatMap((n,r)=>Ht(n)&&!Ua(n)&&k(n.tagName)&&!n.$ref?Zp(n,t,`/$head/${r}`):On("-",n,t,`/$head/${r}`)),"}"]}function uJ(e){let{document:t,spans:n}=Wp(e);return{document:L(t)?t:null,spans:n}}function Qp(e,t){let n=fJ(e);return t===void 0?n:nu(t,n,uJ)}function fJ(e){if(!L(e))throw new Ft("A document is an object");let t=e,n=["/- kdl-version 2"],r={},s=Object.keys(t).some((i)=>!i.startsWith("$")),o=[];for(let[i,a]of Object.entries(t)){let l=i==="$script"&&s?lJ(a,qt):null;if(l)o=l;else if(i==="$head"&&Array.isArray(a))n.push(...yS(a,qt));else if(i==="$head")n.push(`(object)${On(i,a,"","/$head").join(`
|
|
51
|
+
`)}`);else if(i.startsWith("$"))n.push(...On(i,a,"",et("",i)));else r[i]=a}if(Object.keys(r).length>0)n.push("",...Zp(r,"","",o));return`${n.join(`
|
|
52
52
|
`)}
|
|
53
|
-
`}var Jt=" ",lp=100,a$,c$,PN,_N,It=(e)=>L(e),Ca=(e)=>It(e)&&k(e.$ref)&&Object.keys(e).length===1,Ue=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,CN;var Cl=R(()=>{$l();le();ri();Oa();kl();a$=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,c$=/[\p{Cc}\p{Zl}\p{Zp}--]/u,PN=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,_N=new Set(["-","attributes","script","state","style"]);CN=new Set(["$export","$src","arguments","timing"])});function HN(e,t,n){if(si(e,t)!==null)throw Pe(e,t,`"project" names the file's kind, and takes no annotation`);let r=kn(e,t);if(r.length>1||On(t).length>0||Tt(t).length>0)throw Pe(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)we(n,"name",r[0],e,t),mt(e,"/name",t)}function UN(e,t,n){let r=t.getName(),s=`/${ze(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=ep(e,t),mt(e,s,t);else if(WN.has(r)&&o)i=vl(e,t,s);else i=_n(e,t,s);we(n,r,i,e,t)}function BN(e){if(Wo(e.text)==="document")throw new Nt('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=tp(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===qN){if(r)throw Pe(e,s,'"project" is written twice, and a file declares one project');HN(e,s,n),r=!0}else UN(e,s,n);return Vo(n)}function dp(e,t){try{return BN({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Nt?n.inFile(t):n}}var qN="project",WN;var pp=R(()=>{le();Rt();ba();ri();Oa();kl();Cl();WN=new Set(["$media","style"])});var ms=R(()=>{ba();El();ri();e$();Oa();kl();Cl();pp()});function b$(e){if(e===null)throw TypeError("A class descriptor cannot be null");return L(e)?e:{}}class Ra{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=fb(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=GN(n)}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.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!_t(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class Rl{#t;get#e(){return[...this.#t,QN]}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 n=ub(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of y$){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=g$(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.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 n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=g$(e);return this.#e.some((n)=>n.extensions.includes(t))}}function GN(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!YN(o))continue;let i={identifier:s.identifier??r,timing:s.timing??KN};if(k(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function YN(e){return e!==void 0&&XN.has(e)}function g$(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var y$,x$,KN,XN,ZN,QN;var mp=R(()=>{le();Cd();y$=["parse","serialize","rewrite","discover","load"],x$=[...y$,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];KN=["compiler","server"];XN=new Set(x$);ZN={importModule:async()=>{await Promise.resolve().then(() => ms());return{JxNotation:{parse:(n)=>mo(n),serialize:(n)=>fp(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},QN=new Ra("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},ZN)});class $${#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new Rl(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}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 S$(e,t,n){let r=[];for(let s of e??[])r.push(await eT(s,t,n));return new $$(r)}async function eT(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let c=t.resolvePath(n,e);r=t.resolvePath(`${c}/package.json`,`./${Na}`)}else try{r=t.resolvePath(n,`${e}/${Na}`)}catch(c){throw Error(`Extension "${e}" is not resolvable: it must export ${Na} (is the package installed, and does its exports map include it?): ${hp(c)}`,{cause:c})}let s;try{s=await t.loadJson(r)}catch(c){throw Error(`Extension "${e}": cannot read manifest ${r}: ${hp(c)}`,{cause:c})}if(!L(s)||!k(s.name))throw Error(`Extension "${e}": ${Na} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[c,l]of Object.entries(o.classes??{})){let u=t.resolvePath(r,l),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${c}" at ${u}: ${hp(p)}`,{cause:p})}i.push(new Ra(c,u,b$(d),t))}let a={};if(o.schemas?.project)a.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)a.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)a.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:a}}function hp(e){return e instanceof Error?e.message:String(e)}var Na="jx-extension.json";var w$=R(()=>{mp();le();mp()});var v$=R(()=>{le()});function nT(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function j$(e){let t=tT.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function Nl(e,t){return Wr(t)?dp(e,t):Xx(e,t)}var tT,E$="project.jxn",gp;var Tl=R(()=>{le();v$();ba();El();pp();Rt();tT=["project.jxn","project.json"];gp=class gp extends Error{constructor(e){super(nT(e));this.name="ProjectFileConflictError"}}});import{accessSync as x6,closeSync as b6,constants as $6,existsSync as rT,fstatSync as S6,lstatSync as w6,openSync as v6,readFileSync as E6,statSync as j6}from"node:fs";import{dirname as _6,join as P$}from"node:path";function sT(e){return j$((t)=>rT(P$(e,t)))}function An(e){let t=sT(e);if(t==="conflict")throw new gp(e);return P$(e,t??E$)}var ho=R(()=>{Tl()});import{existsSync as oT,readFileSync as iT}from"node:fs";import{dirname as Il,isAbsolute as aT,resolve as _$,sep as Jl}from"node:path";import{pathToFileURL as cT}from"node:url";import{createRequire as lT}from"node:module";function k$(e){let t=[e],n=`${Jl}src${Jl}`,r=`${Jl}dist${Jl}`;if(e.includes(n)){let s=e.replace(n,r);if(t.push(s),s.endsWith(".ts"))t.push(`${s.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);return t}function O$(e){let t=k$(e),n=Il(e),r=[...t.filter((o)=>Il(o)===n),...t.filter((o)=>Il(o)!==n)],s=r.find((o)=>oT(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function yp(e){let t=k$(e),n;for(let r of t)try{return await import(cT(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function xp(e,t){return lT(_$(e,"package.json")).resolve(t)}function bp(e){return{importModule:(t)=>yp(t),loadJson:async(t)=>JSON.parse(iT(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return _$(Il(t),n);if(aT(n))return n;return xp(e,n)}}}async function hs(e,t){return S$(t?.extensions,bp(e),An(e))}function Dl(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 Br=R(()=>{w$();le();ho()});import{existsSync as uT,readFileSync as fT}from"node:fs";import{basename as dT,resolve as pT}from"node:path";function gs(e){let t=An(e);if(!uT(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=Nl(fT(t,"utf8"),t)}catch(i){throw Error(`Invalid ${dT(t)}: ${ge(i)}`,{cause:i})}let r={...Ta,...n,build:{...Ta.build,...n.build},defaults:{...Ta.defaults,...n.defaults},images:{...Ta.images,...n.images},url:n.url??Ta.url};if(n.$head)r.$head=n.$head;if(n.$media)r.$media=n.$media;if(n.style)r.style=n.style;if(n.state)r.state=n.state;if(n.redirects)r.redirects=n.redirects;if(n.imports)r.imports=n.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(r.build.adapter==="static")delete r.build.adapter;if(r.build.adapter&&!s.includes(r.build.adapter))throw Error(`Unknown build adapter "${r.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let o=["build","cloudflare"];if(!o.includes(r.images.service))throw Error(`Unknown images.service "${r.images.service}" in project.json. Valid services: ${o.join(", ")}`);return{config:r,configPath:t,projectRoot:pT(e)}}function A$(e){return["0","false","no","off"].includes((e??"").trim().toLowerCase())}var Ta;var ii=R(()=>{Rt();Tl();ho();Ta={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["avif","jpeg"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg: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 $p,readFileSync as C$,writeFileSync as mT}from"node:fs";import{resolve as R$}from"node:path";async function N$(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=gs(e),o=await hs(e,s),i=L(s.connections)?s.connections:{},a=L(s.data)?s.data:{},c=Object.keys(i).filter((x)=>!r||x===r);if(r&&c.length===0)throw Error(`Unknown connection "${r}" (no such connections entry in project.json)`);if(c.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 l={...process.env,...gT(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let x of c){let g=i[x],y=L(g)?{...g,$name:x}:{$name:x},S=String(y.provider??""),E=hT(o.connectors(),S);if(!E)throw Error(`Connection "${x}" names provider "${S}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let v={};for(let[P,O]of Object.entries(a))if(L(O)&&O.connection===x)v[P]=O;let j=await E.call("deploySchema",v,y,{dryRun:n,env:l});if(u.push({applied:j.applied??!n,connection:x,provider:S,statements:j.statements??[],tables:Object.keys(v),warnings:j.warnings??[]}),E.capabilities.bindings){let P=await E.call("bindings",y);if(L(P)&&Object.keys(P).length>0)d.push(P)}}let p=R$(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&$p(p)){let x=C$(p,"utf8"),{content:g,patched:y}=rb(x,d);if(y&&g!==x)mT(p,g,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:$p(p)?p:null}}function hT(e,t){return e.find((n)=>n.connector?.provider===t)}function gT(e){let t=R$(e,".dev.vars");if(!$p(t))return{};let n=new Map;for(let r of C$(t,"utf8").split(`
|
|
54
|
-
`)){let s=r.trim();if(s===""||s.startsWith("#"))continue;let o=s.indexOf("=");if(o===-1)continue;let i=s.slice(0,o).trim(),a=s.slice(o+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(i!=="")n.set(i,a)}return Object.fromEntries(n)}var
|
|
53
|
+
`}var qt=" ",Yp=100,cS,uS,XT,YT,Ht=(e)=>L(e),Ua=(e)=>Ht(e)&&k(e.$ref)&&Object.keys(e).length===1,et=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,tJ;var iu=J(()=>{Gc();ce();gi();Wa();ru();cS=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,uS=/[\p{Cc}\p{Zl}\p{Zp}--]/u,XT=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,YT=new Set(["-","attributes","script","state","style"]);tJ=new Set(["$export","$src","arguments","timing"])});function mJ(e,t,n){if(yi(e,t)!==null)throw ke(e,t,`"project" names the file's kind, and takes no annotation`);let r=Ln(e,t);if(r.length>1||Fn(t).length>0||Vt(t).length>0)throw ke(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)je(n,"name",r[0],e,t),wt(e,"/name",t)}function hJ(e,t,n){let r=t.getName(),s=`/${nt(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=qp(e,t),wt(e,s,t);else if(pJ.has(r)&&o)i=Zc(e,t,s);else i=Dn(e,t,s);je(n,r,i,e,t)}function gJ(e){if(ni(e.text)==="document")throw new Ft('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=Hp(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===dJ){if(r)throw ke(e,s,'"project" is written twice, and a file declares one project');mJ(e,s,n),r=!0}else hJ(e,s,n);return ei(n)}function em(e,t){try{return gJ({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof Ft?n.inFile(t):n}}var dJ="project",pJ;var tm=J(()=>{ce();Lt();Ta();gi();Wa();ru();iu();pJ=new Set(["$media","style"])});var os=J(()=>{Ta();Qc();gi();nS();Wa();ru();iu();tm()});function SS(e){if(e===null)throw TypeError("A class descriptor cannot be null");return L(e)?e:{}}class za{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=p$(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=bJ(n)}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.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!_t(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class au{#t;get#e(){return[...this.#t,vJ]}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 n=d$(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of bS){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=xS(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.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 n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=xS(e);return this.#e.some((n)=>n.extensions.includes(t))}}function bJ(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!SJ(o))continue;let i={identifier:s.identifier??r,timing:s.timing??xJ};if(k(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function SJ(e){return e!==void 0&&$J.has(e)}function xS(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var bS,$S,xJ,$J,wJ,vJ;var nm=J(()=>{ce();bp();bS=["parse","serialize","rewrite","discover","load"],$S=[...bS,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];xJ=["compiler","server"];$J=new Set($S);wJ={importModule:async()=>{await Promise.resolve().then(() => os());return{JxNotation:{parse:(n)=>vo(n),serialize:(n)=>Qp(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},vJ=new za("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},wJ)});class wS{#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new au(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}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 vS(e,t,n){let r=[];for(let s of e??[])r.push(await EJ(s,t,n));return new wS(r)}async function EJ(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(n,e);r=t.resolvePath(`${l}/package.json`,`./${Ka}`)}else try{r=t.resolvePath(n,`${e}/${Ka}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Ka} (is the package installed, and does its exports map include it?): ${rm(l)}`,{cause:l})}let s;try{s=await t.loadJson(r)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${r}: ${rm(l)}`,{cause:l})}if(!L(s)||!k(s.name))throw Error(`Extension "${e}": ${Ka} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[l,c]of Object.entries(o.classes??{})){let u=t.resolvePath(r,c),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${rm(p)}`,{cause:p})}i.push(new za(l,u,SS(d),t))}let a={};if(o.schemas?.project)a.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)a.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)a.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:a}}function rm(e){return e instanceof Error?e.message:String(e)}var Ka="jx-extension.json";var ES=J(()=>{nm();ce();nm()});var jS=J(()=>{ce()});function PJ(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function _S(e){let t=jJ.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function lu(e,t){return rs(t)?em(e,t):Zb(e,t)}var jJ,PS="project.jxn",sm;var cu=J(()=>{ce();jS();Ta();Qc();tm();Lt();jJ=["project.jxn","project.json"];sm=class sm extends Error{constructor(e){super(PJ(e));this.name="ProjectFileConflictError"}}});import{accessSync as dG,closeSync as pG,constants as mG,existsSync as _J,fstatSync as hG,lstatSync as gG,openSync as yG,readFileSync as xG,statSync as bG}from"node:fs";import{dirname as SG,join as kS}from"node:path";function kJ(e){return _S((t)=>_J(kS(e,t)))}function qn(e){let t=kJ(e);if(t==="conflict")throw new sm(e);return kS(e,t??PS)}var Eo=J(()=>{cu()});import{existsSync as OJ,readFileSync as AJ}from"node:fs";import{dirname as fu,isAbsolute as CJ,resolve as OS,sep as uu}from"node:path";import{pathToFileURL as RJ}from"node:url";import{createRequire as NJ}from"node:module";function AS(e){let t=[e],n=`${uu}src${uu}`,r=`${uu}dist${uu}`;if(e.includes(n)){let s=e.replace(n,r);if(t.push(s),s.endsWith(".ts"))t.push(`${s.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);return t}function CS(e){let t=AS(e),n=fu(e),r=[...t.filter((o)=>fu(o)===n),...t.filter((o)=>fu(o)!==n)],s=r.find((o)=>OJ(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function om(e){let t=AS(e),n;for(let r of t)try{return await import(RJ(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function im(e,t){return NJ(OS(e,"package.json")).resolve(t)}function am(e){return{importModule:(t)=>om(t),loadJson:async(t)=>JSON.parse(AJ(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return OS(fu(t),n);if(CJ(n))return n;return im(e,n)}}}async function Os(e,t){return vS(t?.extensions,am(e),qn(e))}function du(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 is=J(()=>{ES();ce();Eo()});import{existsSync as TJ,readFileSync as JJ}from"node:fs";import{basename as MJ,resolve as IJ}from"node:path";function As(e){let t=qn(e);if(!TJ(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=lu(JJ(t,"utf8"),t)}catch(i){throw Error(`Invalid ${MJ(t)}: ${be(i)}`,{cause:i})}let r={...Ga,...n,build:{...Ga.build,...n.build},defaults:{...Ga.defaults,...n.defaults},images:{...Ga.images,...n.images},url:n.url??Ga.url};if(n.$head)r.$head=n.$head;if(n.$media)r.$media=n.$media;if(n.style)r.style=n.style;if(n.state)r.state=n.state;if(n.redirects)r.redirects=n.redirects;if(n.imports)r.imports=n.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(r.build.adapter==="static")delete r.build.adapter;if(r.build.adapter&&!s.includes(r.build.adapter))throw Error(`Unknown build adapter "${r.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let o=["build","cloudflare"];if(!o.includes(r.images.service))throw Error(`Unknown images.service "${r.images.service}" in project.json. Valid services: ${o.join(", ")}`);return{config:r,configPath:t,projectRoot:IJ(e)}}function RS(e){return["0","false","no","off"].includes((e??"").trim().toLowerCase())}var Ga;var bi=J(()=>{Lt();cu();Eo();Ga={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["avif","jpeg"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg: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 lm,readFileSync as NS,writeFileSync as DJ}from"node:fs";import{resolve as TS}from"node:path";async function JS(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=As(e),o=await Os(e,s),i=L(s.connections)?s.connections:{},a=L(s.data)?s.data:{},l=Object.keys(i).filter((y)=>!r||y===r);if(r&&l.length===0)throw Error(`Unknown connection "${r}" (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,...FJ(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let y of l){let S=i[y],g=L(S)?{...S,$name:y}:{$name:y},x=String(g.provider??""),P=LJ(o.connectors(),x);if(!P)throw Error(`Connection "${y}" names provider "${x}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let w={};for(let[j,A]of Object.entries(a))if(L(A)&&A.connection===y)w[j]=A;let E=await P.call("deploySchema",w,g,{dryRun:n,env:c});if(u.push({applied:E.applied??!n,connection:y,provider:x,statements:E.statements??[],tables:Object.keys(w),warnings:E.warnings??[]}),P.capabilities.bindings){let j=await P.call("bindings",g);if(L(j)&&Object.keys(j).length>0)d.push(j)}}let p=TS(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&lm(p)){let y=NS(p,"utf8"),{content:S,patched:g}=o$(y,d);if(g&&S!==y)DJ(p,S,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:lm(p)?p:null}}function LJ(e,t){return e.find((n)=>n.connector?.provider===t)}function FJ(e){let t=TS(e,".dev.vars");if(!lm(t))return{};let n=new Map;for(let r of NS(t,"utf8").split(`
|
|
54
|
+
`)){let s=r.trim();if(s===""||s.startsWith("#"))continue;let o=s.indexOf("=");if(o===-1)continue;let i=s.slice(0,o).trim(),a=s.slice(o+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(i!=="")n.set(i,a)}return Object.fromEntries(n)}var MS=J(()=>{a$();is();bi();ce()});function cm(e,t=[]){if(!L(e))return t;let{children:n}=e;if(e.tagName==="slot"){let r=e.attributes,s=L(r)?r.name:void 0,o={name:k(s)?s.trim():""};if(Array.isArray(n)&&n.length>0)o.fallback=n;t.push(o)}if(Array.isArray(n))for(let r of n)cm(r,t);return t}var IS=J(()=>{ce()});function VJ(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(k(o)){for(let i of o.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/gu))t.add(i[1]);return}if(Array.isArray(o)){if(!n.has(o)){n.add(o);for(let i of o)s(i)}return}if(!L(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&me(o.target))r(o.target.$ref);if(o.$prototype==="Array"){for(let i of[o.filter,o.sort])if(me(i))r(i.$ref)}for(let[i,a]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&me(a))r(a.$ref);s(a)}};s(e);for(let o of um)if(L(e.state)&&o in e.state)t.add(o);return t}function fm(e){return"body"in e&&"$src"in e}function Xa(e){return Pc(e.parameters??e.arguments).length>0}function kr(e){let t=["state"];for(let n of Pc(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function qJ(e,t,n){if(vr(t))return"callable";if(Pc(t.parameters??t.arguments).length>0)return"callable";if(k(t.body))return Vb(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function Or(e){let t=new Map,n=null,r=()=>n??=VJ(e);for(let[s,o]of Object.entries(e.state??{}))if(kt(o))t.set(s,qJ(s,o,r));return t}var um;var $i=J(()=>{ce();um=new Set(["onMount","onUnmount","onAdopted"])});function DS(e){if(e===null||e===void 0)return"null";if(Array.isArray(e))return"array";if(k(e))return"string";if(Ie(e))return"number";return Ge(e)?"boolean":"object"}function HJ(e){if(k(e))return e;if(!L(e))return;if(k(e.text))return e.text;if(k(e.type))return e.type;if(Array.isArray(e.type))return e.type.filter((t)=>k(t)).join(" | ");return k(e.$ref)?e.$ref.slice(e.$ref.lastIndexOf("/")+1):void 0}function Ya(e){let t=HJ(e);return t===void 0||t===""?void 0:{text:t}}function FS(e){if(k(e)&&e!=="")return e;return e===!0?!0:void 0}function WJ(e,t){let n={kind:"field",name:e};if(jc(t)){let r=Ya(t.type)??Ya(k(t.$ref)?{$ref:t.$ref}:void 0);if(n.type=r??{text:DS(t.default)},n.default=JSON.stringify(t.default),k(t.description))n.description=t.description;let s=FS(t.deprecated);if(s!==void 0)n.deprecated=s;return n}if(L(t)){if(Object.keys(t).some((s)=>s.startsWith("$"))||Db(t))return null}else if(le(t))return null;return n.type={text:DS(t)},n.default=JSON.stringify(t),n}function BJ(e){if(k(e))return{name:e};if(!L(e)||!k(e.name))return null;let t={name:e.name},n=Ya(e.type);if(n)t.type=n;if(k(e.description))t.description=e.description;if(Ge(e.optional))t.optional=e.optional;if(e.default!==void 0)t.default=JSON.stringify(e.default);return t}function UJ(e,t){let n={kind:"method",name:e};if(k(t.description))n.description=t.description;let s=(t.parameters??t.arguments??[]).map((i)=>BJ(i)).filter((i)=>i!==null&&i.name!=="state");if(s.length>0)n.parameters=s;let o=Ya(t.type);if(o)n.return={type:o};return n}function LS(e,t){if(!Array.isArray(e))return;for(let n of e){if(!L(n)||!k(n.name)||t.has(n.name))continue;let r={name:n.name,type:Ya(n.type)??{text:"Event"}};if(k(n.description))r.description=n.description;let s=FS(n.deprecated);if(s!==void 0)r.deprecated=s;t.set(n.name,r)}}function zJ(e){let t=new Set,n=(s)=>{if(!L(s))return;let o=L(s.attributes)?s.attributes.part:void 0;if(k(o)){for(let i of o.split(/\s+/u))if(i!=="")t.add(i)}r(s)},r=(s)=>{if(Array.isArray(s.children))for(let o of s.children)n(o)};return r(e),[...t]}function KJ(e){let t=e.doc,n=L(t.state)?t.state:{},r=Or(e.doc),s=[],o=[],i=new Map,a=new Map;LS(t.emits,a);for(let[x,P]of Object.entries(n)){if(Zo(x))continue;if(kt(P)){if(LS(P.emits,a),!um.has(x)&&r.get(x)!=="computed")o.push(UJ(x,P));continue}let w=WJ(x,P);if(w)o.push(w),i.set(x,w)}let l=[],c=new Set,u=Array.isArray(t.observedAttributes)?t.observedAttributes:[];for(let x of new Set(u.filter((P)=>k(P)))){let P={name:x},w=Qo(x),E=i.get(w);if(E){P.fieldName=w;for(let j of["type","default","description","deprecated"])if(E[j]!==void 0)Object.assign(P,{[j]:E[j]});if(!c.has(w)){c.add(w),E.attribute=x;let j=n[w];if(L(j)&&j.reflects===!0)E.reflects=!0}}l.push(P)}for(let[x,P]of Object.entries(n)){if(Zo(x)||!L(P)||!k(P.attribute))continue;if(i.get(x)?.attribute!==P.attribute)s.push(`${e.tagName}: state entry "${x}" declares attribute "${P.attribute}", but the `+"element does not observe it into that entry (spec.md §16.5); add it to "+"observedAttributes or remove it")}let d={customElement:!0,kind:"class",members:o,name:e.className,tagName:e.tagName},p=k(t.description)?t.description:t.$description;if(k(p))d.description=p;if(l.length>0)d.attributes=l;if(a.size>0)d.events=[...a.values()];let m=cm(t).map((x)=>({name:x.name}));if(m.length>0)d.slots=m;let y=L(t.style)?t.style:{},S=Object.entries(y).filter(([x])=>x.startsWith("--")).map(([x,P])=>({default:String(P),name:x}));if(S.length>0)d.cssProperties=S;let g=e.shadow?zJ(e.doc).map((x)=>({name:x})):[];if(g.length>0)d.cssParts=g;return{module:{declarations:[d],exports:[{declaration:{name:e.className},kind:"custom-element-definition",name:e.tagName}],kind:"javascript-module",path:e.modulePath},warnings:s}}function pu(e){let n=e.toSorted((r,s)=>r.tagName<s.tagName?-1:1).map((r)=>KJ(r));return{manifest:{modules:n.map((r)=>r.module),schemaVersion:"2.1.0"},warnings:n.flatMap((r)=>r.warnings)}}function mu(e){return`${JSON.stringify(e,null,2)}
|
|
55
|
+
`}var dm=J(()=>{IS();$i();ce()});function jo(e){return e.startsWith(hu)}function gu(e){let t=e;if(jo(t))t=t.slice(hu.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${pm}${t}.js`}function VS(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${pm}${n}`:`${pm}${n}.${t}`}function qS(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function yu(e){let t=qS(e);return t.startsWith("/")?t:`/${t}`}function GJ(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function xu(e,t){let n=t.split("#")[0].split("?")[0];if(!n.startsWith("/"))return null;let r;try{r=decodeURIComponent(n)}catch{return null}if(/%2e|%2f/i.test(r))return null;for(let s of GJ(e,"urlPrefix")){let o=yu(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let a=r.slice(o.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${qS(s.dir)}/${a.join("/")}`}return null}function HS(e,t){let n=new Set;for(let r of t){let s=yu(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${XJ}]+`,"g");for(let i of e.matchAll(o)){let a=i[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))n.add(a)}}return[...n].filter(Boolean)}function mm(e){let t=[],n=0;while(n<e.length){while(n<e.length&&(/\s/.test(e[n])||e[n]===","))n+=1;if(n>=e.length)break;let r=n;while(n<e.length&&!/\s/.test(e[n]))n+=1;let s=e.slice(r,n);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(n<e.length&&/\s/.test(e[n]))n+=1;let o=n;while(n<e.length&&e[n]!==",")n+=1;let i=e.slice(o,n).trim();if(n+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:i,url:s})}return t}function hm(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function Po(e){if(!k(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let n=t.replace(/\/+$/,"");if(n===""||n==="/")return"";return n.startsWith("/")?n:`/${n}`}function Fe(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Cs(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var hu="npm:",pm="/assets/",XJ;var An=J(()=>{ce();XJ=String.raw`"'\s<>()\\`});function Qa(e,t){return e.replaceAll(QJ,(n,r,s)=>{let o=s.trim(),i=sM.exec(o),a=i?i[2]:o,l=Fe(t,a);if(l===a)return n;return`url(${r}${i?`${i[1]}${l}${i[1]}`:l}${r})`})}function gm(e,t,n,r,s){let o=n.toLowerCase();if(WS.has(o))return Fe(s,r);if(BS.has(o)){let i=mm(r);return i.length===0?r:hm(i.map((a)=>({descriptor:a.descriptor,url:Fe(s,a.url)})))}if(o==="style")return Qa(r,s);if(o==="content"&&e==="meta"&&rM.test(t))return Fe(s,r);return r}function ym(e,t){if(t==="")return e;let n=e.replaceAll(tM,(r,s,o,i)=>{let a=o.replaceAll(eM,(l,c)=>`"${Fe(t,c)}"`);return s+a+i});return n=n.replaceAll(nM,(r,s,o,i)=>s+Qa(o,t)+i),n.replaceAll(YJ,(r,s,o)=>{if(o==="")return r;let i=s.toLowerCase(),a=o.replaceAll(ZJ,(l,c,u,d,p)=>{let m=d===void 0?"'":'"',y=d??p??"",S=gm(i,o,c,y,t);return S===y?l:`${c}=${m}${S}${m}`});return a===o?r:`<${s}${a}>`})}function oM(e,t){let n=k(e.tagName)?e.tagName.toLowerCase():"",{attributes:r}=e;if(D(r)){for(let[s,o]of Object.entries(r))if(k(o))r[s]=gm(n,"",s,o,t)}for(let s of Object.keys(e)){let o=s.toLowerCase(),i=e[s];if(k(i)&&(WS.has(o)||BS.has(o)))e[s]=gm(n,"",o,i,t)}if(k(e.innerHTML))e.innerHTML=ym(e.innerHTML,t)}function Za(e,t){if(!D(e)||Array.isArray(e))return;if(Le(e)){Za(e.map,t);return}let n=e;oM(n,t);let{cases:r,children:s}=n;if(Array.isArray(s))for(let o of s)Za(o,t);else Za(s,t);if(D(r))for(let o of Object.values(r))Za(o,t)}function US(e,t){if(t!=="")Za(e,t)}var WS,BS,YJ,ZJ,QJ,eM,tM,nM,rM,sM;var zS=J(()=>{An();ce();WS=new Set(["href","src","poster","action","formaction","data"]),BS=new Set(["srcset","imagesrcset"]),YJ=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,ZJ=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,QJ=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,eM=/"(\/[^"/][^"]*)"/g,tM=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,nM=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,rM=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,sM=/^("|"|'|')([\s\S]*)\1$/});var ol=W(function(sX,xw){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:wm,getOwnPropertyDescriptor:iM,getOwnPropertyNames:aM}=Object,lM=Object.prototype.hasOwnProperty,cM=(e,t)=>{for(var n in t)wm(e,n,{get:t[n],enumerable:!0})},uM=(e,t,n,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of aM(t))if(!lM.call(e,s)&&s!==n)wm(e,s,{get:()=>t[s],enumerable:!(r=iM(t,s))||r.enumerable})}return e},fM=(e)=>uM(wm({},"__esModule",{value:!0}),e),rl={};cM(rl,{analyzeMetafile:()=>qM,analyzeMetafileSync:()=>UM,build:()=>DM,buildSync:()=>HM,context:()=>LM,default:()=>XM,formatMessages:()=>VM,formatMessagesSync:()=>BM,initialize:()=>KM,stop:()=>zM,transform:()=>FM,transformSync:()=>WM,version:()=>IM});xw.exports=fM(rl);function KS(e){let t=(r)=>{if(r===null)n.write8(0);else if(typeof r==="boolean")n.write8(1),n.write8(+r);else if(typeof r==="number")n.write8(2),n.write32(r|0);else if(typeof r==="string")n.write8(3),n.write(lr(r));else if(r instanceof Uint8Array)n.write8(4),n.write(r);else if(r instanceof Array){n.write8(5),n.write32(r.length);for(let s of r)t(s)}else{let s=Object.keys(r);n.write8(6),n.write32(s.length);for(let o of s)n.write(lr(o)),t(r[o])}},n=new sw;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),bm(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function dM(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return Co(n.read());case 4:return n.read();case 5:{let i=n.read32(),a=[];for(let l=0;l<i;l++)a.push(t());return a}case 6:{let i=n.read32(),a={};for(let l=0;l<i;l++)a[Co(n.read())]=t();return a}default:throw Error("Invalid packet")}},n=new sw(e),r=n.read32(),s=(r&1)===0;r>>>=1;let o=t();if(n.ptr!==e.length)throw Error("Invalid packet");return{id:r,isRequest:s,value:o}}var sw=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);bm(this.buf,e,t)}write(e){let t=this._write(4+e.length);bm(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 ow(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},lr,Co,xm;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;lr=(n)=>e.encode(n),Co=(n)=>t.decode(n),xm='new TextEncoder().encode("")'}else if(typeof Buffer<"u")lr=(e)=>Buffer.from(e),Co=(e)=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},xm='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(lr("")instanceof Uint8Array))throw Error(`Invariant violation: "${xm} instanceof Uint8Array" is incorrectly false
|
|
55
56
|
|
|
56
57
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
57
58
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
58
59
|
is not a problem with esbuild. You need to fix your environment instead.
|
|
59
|
-
`);function
|
|
60
|
-
`;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(l=e[c++],d<<=4,l>=48&&l<=57)d|=l-48;else if(l>=97&&l<=102)d|=l+-87;else if(l>=65&&l<=70)d|=l+-55;else Cn(e,--c);u+=zr(d);break}default:Cn(e,--c);break}else if(l<=127)u+=zr(l);else if((l&224)===192)u+=zr((l&31)<<6|e[c++]&63);else if((l&240)===224)u+=zr((l&15)<<12|(e[c++]&63)<<6|e[c++]&63);else if((l&248)==240){let d=(l&7)<<18|(e[c++]&63)<<12|(e[c++]&63)<<6|e[c++]&63;if(d>65535)d-=65536,u+=zr(d>>10&1023|55296),d=56320|d&1023;u+=zr(d)}}u[0];break}case 91:{u=[],t.push(o),n.push(a),r.push(i),o=null,a=u,i=1;continue}case 123:{u={},t.push(o),n.push(a),r.push(i),o=null,a=u,i=2;continue}case 93:{if(i!==1)Cn(e,--c);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Cn(e,--c);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Cn(e,--c)}l=e[c];while(l<=32)l=e[++c];switch(i){case 0:{if(c===s)return u;break}case 1:{if(a.push(u),l===44){c++;continue}if(l===93)continue;break}case 2:{if(o===null){if(o=u,l===58){c++;continue}}else{if(a[o]=u,o=null,l===44){c++;continue}if(l===125)continue}break}}break}Cn(e,c)}var St=JSON.stringify,q$="warning",W$="silent";function ci(e,t){let n=[];for(let r of e){if(rn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Hl=()=>null,Ye=(e)=>typeof e==="boolean"?null:"a boolean",se=(e)=>typeof e==="string"?null:"a string",Ul=(e)=>e instanceof RegExp?null:"a RegExp object",bo=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",MT=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Q$=(e)=>typeof e==="function"?null:"a function",Kr=(e)=>Array.isArray(e)?null:"an array",sn=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Sn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",FT=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",LT=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",H$=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",eS=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",VT=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",tS=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",nS=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",qT=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function C(e,t,n,r){let s=e[n];if(t[n+""]=!0,s===void 0)return;let o=r(s);if(o!==null)throw Error(`${St(n)} must be ${o}`);return s}function ht(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${St(r)}`)}function WT(e){let t=Object.create(null),n=C(e,t,"wasmURL",qT),r=C(e,t,"wasmModule",LT),s=C(e,t,"worker",Ye);return ht(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function rS(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let r=e[n];if(typeof r==="string"||r===!1)t[n]=r;else throw Error(`Expected ${St(n)} in mangle cache to map to either a string or false`)}}return t}function Xl(e,t,n,r,s){let o=C(t,n,"color",Ye),i=C(t,n,"logLevel",se),a=C(t,n,"logLimit",bo),c=C(t,n,"logStyle",se);if(o!==void 0)e.push(`--color=${o}`);else if(r)e.push("--color=true");if(e.push(`--log-level=${i||s}`),e.push(`--log-limit=${a||0}`),c)e.push(`--log-style=${c}`)}function rn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+St(n):""} to be a string, got ${typeof e} instead`);return e}function sS(e,t,n){let r=C(t,n,"legalComments",se),s=C(t,n,"sourceRoot",se),o=C(t,n,"sourcesContent",Ye),i=C(t,n,"target",tS),a=C(t,n,"format",se),c=C(t,n,"globalName",se),l=C(t,n,"mangleProps",Ul),u=C(t,n,"reserveProps",Ul),d=C(t,n,"mangleQuoted",Ye),p=C(t,n,"minify",Ye),m=C(t,n,"minifySyntax",Ye),x=C(t,n,"minifyWhitespace",Ye),g=C(t,n,"minifyIdentifiers",Ye),y=C(t,n,"lineLimit",bo),S=C(t,n,"drop",sn),E=C(t,n,"dropLabels",sn),v=C(t,n,"charset",se),j=C(t,n,"treeShaking",Ye),P=C(t,n,"ignoreAnnotations",Ye),O=C(t,n,"jsx",se),T=C(t,n,"jsxFactory",se),U=C(t,n,"jsxFragment",se),F=C(t,n,"jsxImportSource",se),H=C(t,n,"jsxDev",Ye),A=C(t,n,"jsxSideEffects",Ye),N=C(t,n,"define",Sn),B=C(t,n,"logOverride",Sn),M=C(t,n,"supported",Sn),D=C(t,n,"pure",sn),X=C(t,n,"keepNames",Ye),re=C(t,n,"platform",se),ue=C(t,n,"tsconfigRaw",VT),xe=C(t,n,"absPaths",sn);if(r)e.push(`--legal-comments=${r}`);if(s!==void 0)e.push(`--source-root=${s}`);if(o!==void 0)e.push(`--sources-content=${o}`);if(i)e.push(`--target=${ci(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(c)e.push(`--global-name=${c}`);if(re)e.push(`--platform=${re}`);if(ue)e.push(`--tsconfig-raw=${typeof ue==="string"?ue:JSON.stringify(ue)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(x)e.push("--minify-whitespace");if(g)e.push("--minify-identifiers");if(y)e.push(`--line-limit=${y}`);if(v)e.push(`--charset=${v}`);if(j!==void 0)e.push(`--tree-shaking=${j}`);if(P)e.push("--ignore-annotations");if(S)for(let z of S)e.push(`--drop:${rn(z,"drop")}`);if(E)e.push(`--drop-labels=${ci(E,"drop label")}`);if(xe)e.push(`--abs-paths=${ci(xe,"abs paths")}`);if(l)e.push(`--mangle-props=${Bl(l)}`);if(u)e.push(`--reserve-props=${Bl(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(O)e.push(`--jsx=${O}`);if(T)e.push(`--jsx-factory=${T}`);if(U)e.push(`--jsx-fragment=${U}`);if(F)e.push(`--jsx-import-source=${F}`);if(H)e.push("--jsx-dev");if(A)e.push("--jsx-side-effects");if(N)for(let z in N){if(z.indexOf("=")>=0)throw Error(`Invalid define: ${z}`);e.push(`--define:${z}=${rn(N[z],"define",z)}`)}if(B)for(let z in B){if(z.indexOf("=")>=0)throw Error(`Invalid log override: ${z}`);e.push(`--log-override:${z}=${rn(B[z],"log override",z)}`)}if(M)for(let z in M){if(z.indexOf("=")>=0)throw Error(`Invalid supported: ${z}`);let be=M[z];if(typeof be!=="boolean")throw Error(`Expected value for supported ${St(z)} to be a boolean, got ${typeof be} instead`);e.push(`--supported:${z}=${be}`)}if(D)for(let z of D)e.push(`--pure:${rn(z,"pure")}`);if(X)e.push("--keep-names")}function HT(e,t,n,r,s){var o;let i=[],a=[],c=Object.create(null),l=null,u=null;Xl(i,t,c,n,r),sS(i,t,c);let d=C(t,c,"sourcemap",eS),p=C(t,c,"bundle",Ye),m=C(t,c,"splitting",Ye),x=C(t,c,"preserveSymlinks",Ye),g=C(t,c,"metafile",Ye),y=C(t,c,"outfile",se),S=C(t,c,"outdir",se),E=C(t,c,"outbase",se),v=C(t,c,"tsconfig",se),j=C(t,c,"resolveExtensions",sn),P=C(t,c,"nodePaths",sn),O=C(t,c,"mainFields",sn),T=C(t,c,"conditions",sn),U=C(t,c,"external",sn),F=C(t,c,"packages",se),H=C(t,c,"alias",Sn),A=C(t,c,"loader",Sn),N=C(t,c,"outExtension",Sn),B=C(t,c,"publicPath",se),M=C(t,c,"entryNames",se),D=C(t,c,"chunkNames",se),X=C(t,c,"assetNames",se),re=C(t,c,"inject",sn),ue=C(t,c,"banner",Sn),xe=C(t,c,"footer",Sn),z=C(t,c,"entryPoints",FT),be=C(t,c,"absWorkingDir",se),ae=C(t,c,"stdin",Sn),ee=(o=C(t,c,"write",Ye))!=null?o:s,ot=C(t,c,"allowOverwrite",Ye),Te=C(t,c,"mangleCache",Sn);if(c.plugins=!0,ht(t,c,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(ot)i.push("--allow-overwrite");if(m)i.push("--splitting");if(x)i.push("--preserve-symlinks");if(g)i.push("--metafile");if(y)i.push(`--outfile=${y}`);if(S)i.push(`--outdir=${S}`);if(E)i.push(`--outbase=${E}`);if(v)i.push(`--tsconfig=${v}`);if(F)i.push(`--packages=${F}`);if(j)i.push(`--resolve-extensions=${ci(j,"resolve extension")}`);if(B)i.push(`--public-path=${B}`);if(M)i.push(`--entry-names=${M}`);if(D)i.push(`--chunk-names=${D}`);if(X)i.push(`--asset-names=${X}`);if(O)i.push(`--main-fields=${ci(O,"main field")}`);if(T)i.push(`--conditions=${ci(T,"condition")}`);if(U)for(let te of U)i.push(`--external:${rn(te,"external")}`);if(H)for(let te in H){if(te.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${te}`);i.push(`--alias:${te}=${rn(H[te],"alias",te)}`)}if(ue)for(let te in ue){if(te.indexOf("=")>=0)throw Error(`Invalid banner file type: ${te}`);i.push(`--banner:${te}=${rn(ue[te],"banner",te)}`)}if(xe)for(let te in xe){if(te.indexOf("=")>=0)throw Error(`Invalid footer file type: ${te}`);i.push(`--footer:${te}=${rn(xe[te],"footer",te)}`)}if(re)for(let te of re)i.push(`--inject:${rn(te,"inject")}`);if(A)for(let te in A){if(te.indexOf("=")>=0)throw Error(`Invalid loader extension: ${te}`);i.push(`--loader:${te}=${rn(A[te],"loader",te)}`)}if(N)for(let te in N){if(te.indexOf("=")>=0)throw Error(`Invalid out extension: ${te}`);i.push(`--out-extension:${te}=${rn(N[te],"out extension",te)}`)}if(z)if(Array.isArray(z))for(let te=0,tt=z.length;te<tt;te++){let Xe=z[te];if(typeof Xe==="object"&&Xe!==null){let xt=Object.create(null),de=C(Xe,xt,"in",se),dt=C(Xe,xt,"out",se);if(ht(Xe,xt,"in entry point at index "+te),de===void 0)throw Error('Missing property "in" for entry point at index '+te);if(dt===void 0)throw Error('Missing property "out" for entry point at index '+te);a.push([dt,de])}else a.push(["",rn(Xe,"entry point at index "+te)])}else for(let te in z)a.push([te,rn(z[te],"entry point",te)]);if(ae){let te=Object.create(null),tt=C(ae,te,"contents",nS),Xe=C(ae,te,"resolveDir",se),xt=C(ae,te,"sourcefile",se),de=C(ae,te,"loader",se);if(ht(ae,te,'in "stdin" object'),xt)i.push(`--sourcefile=${xt}`);if(de)i.push(`--loader=${de}`);if(Xe)u=Xe;if(typeof tt==="string")l=zn(tt);else if(tt instanceof Uint8Array)l=tt}let et=[];if(P)for(let te of P)te+="",et.push(te);return{entries:a,flags:i,write:ee,stdinContents:l,stdinResolveDir:u,absWorkingDir:be,nodePaths:et,mangleCache:rS(Te)}}function UT(e,t,n,r){let s=[],o=Object.create(null);Xl(s,t,o,n,r),sS(s,t,o);let i=C(t,o,"sourcemap",eS),a=C(t,o,"sourcefile",se),c=C(t,o,"loader",se),l=C(t,o,"banner",se),u=C(t,o,"footer",se),d=C(t,o,"mangleCache",Sn);if(ht(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);if(a)s.push(`--sourcefile=${a}`);if(c)s.push(`--loader=${c}`);if(l)s.push(`--banner=${l}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:rS(d)}}function oS(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,c=(v)=>{let j=a+v.length;if(j>i.length){let O=new Uint8Array(j*2);O.set(i),i=O}i.set(v,a),a+=v.length;let P=0;while(P+4<=a){let O=Z$(i,P);if(P+4+O>a)break;P+=4,x(i.subarray(P,P+O)),P+=O}if(P>0)i.copyWithin(0,P,a),a-=P},l=(v)=>{if(n.didClose=!0,v)n.reason=": "+(v.message||v);let j="The service was stopped"+n.reason;for(let P in r)r[P](j,null);r={}},u=(v,j,P)=>{if(n.didClose)return P("The service is no longer running"+n.reason,null);let O=s++;if(r[O]=(T,U)=>{try{P(T,U)}finally{if(v)v.unref()}},v)v.ref();e.writeToStdin(V$({id:O,isRequest:!0,value:j}))},d=(v,j)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(V$({id:v,isRequest:!1,value:j}))},p=async(v,j)=>{try{if(j.command==="ping"){d(v,{});return}if(typeof j.key==="number"){let P=t[j.key];if(!P)return;let O=P[j.command];if(O){await O(v,j);return}}throw Error("Invalid command: "+j.command)}catch(P){let O=[xo(P,e,null,void 0,"")];try{d(v,{errors:O})}catch{}}},m=!0,x=(v)=>{if(m){m=!1;let P=String.fromCharCode(...v);if(P!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${St(P)}`);return}let j=IT(v);if(j.isRequest)p(j.id,j.value);else{let P=r[j.id];if(delete r[j.id],j.value.error)P(j.value.error,{});else P(null,j.value)}};return{readFromStdout:c,afterClose:l,service:{buildOrContext:({callName:v,refs:j,options:P,isTTY:O,defaultWD:T,callback:U})=>{let F=0,H=o++,A={},N={ref(){if(++F===1){if(j)j.ref()}},unref(){if(--F===0){if(delete t[H],j)j.unref()}}};t[H]=A,N.ref(),BT(v,H,u,d,N,e,A,P,O,T,(B,M)=>{try{U(B,M)}finally{N.unref()}})},transform:({callName:v,refs:j,input:P,options:O,isTTY:T,fs:U,callback:F})=>{let H=iS(),A=(N)=>{try{if(typeof P!=="string"&&!(P instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:B,mangleCache:M}=UT(v,O,T,W$),D={command:"transform",flags:B,inputFS:N!==null,input:N!==null?zn(N):typeof P==="string"?zn(P):P};if(M)D.mangleCache=M;u(j,D,(X,re)=>{if(X)return F(Error(X),null);let ue=li(re.errors,H),xe=li(re.warnings,H),z=1,be=()=>{if(--z===0){let ae={warnings:xe,code:re.code,map:re.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in re)ae.legalComments=re==null?void 0:re.legalComments;if(re.mangleCache)ae.mangleCache=re==null?void 0:re.mangleCache;F(null,ae)}};if(ue.length>0)return F(Ia("Transform failed",ue,xe),null);if(re.codeFS)z++,U.readFile(re.code,(ae,ee)=>{if(ae!==null)F(ae,null);else re.code=ee,be()});if(re.mapFS)z++,U.readFile(re.map,(ae,ee)=>{if(ae!==null)F(ae,null);else re.map=ee,be()});be()})}catch(B){let M=[];try{Xl(M,O,{},T,W$)}catch{}let D=xo(B,e,H,void 0,"");u(j,{command:"error",flags:M,error:D},()=>{D.detail=H.load(D.detail),F(Ia("Transform failed",[D],[]),null)})}};if((typeof P==="string"||P instanceof Uint8Array)&&P.length>1048576){let N=A;A=()=>U.writeFile(P,N)}A(null)},formatMessages:({callName:v,refs:j,messages:P,options:O,callback:T})=>{if(!O)throw Error(`Missing second argument in ${v}() call`);let U={},F=C(O,U,"kind",se),H=C(O,U,"color",Ye),A=C(O,U,"terminalWidth",bo),N=C(O,U,"logStyle",se);if(ht(O,U,`in ${v}() call`),F===void 0)throw Error(`Missing "kind" in ${v}() call`);if(F!=="error"&&F!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let B={command:"format-msgs",messages:Gr(P,"messages",null,"",A),isWarning:F==="warning"};if(H!==void 0)B.color=H;if(A!==void 0)B.terminalWidth=A;if(N!==void 0)B.logStyle=N;u(j,B,(M,D)=>{if(M)return T(Error(M),null);T(null,D.messages)})},analyzeMetafile:({callName:v,refs:j,metafile:P,options:O,callback:T})=>{if(O===void 0)O={};let U={},F=C(O,U,"color",Ye),H=C(O,U,"verbose",Ye);ht(O,U,`in ${v}() call`);let A={command:"analyze-metafile",metafile:P};if(F!==void 0)A.color=F;if(H!==void 0)A.verbose=H;u(j,A,(N,B)=>{if(N)return T(Error(N),null);T(null,B.result)})}}}}function BT(e,t,n,r,s,o,i,a,c,l,u){let d=iS(),p=e==="context",m=(y,S)=>{let E=[];try{Xl(E,a,{},c,q$)}catch{}let v=xo(y,o,d,void 0,S);n(s,{command:"error",flags:E,error:v},()=>{v.detail=d.load(v.detail),u(Ia(p?"Context failed":"Build failed",[v],[]),null)})},x;if(typeof a==="object"){let y=a.plugins;if(y!==void 0){if(!Array.isArray(y))return m(Error('"plugins" must be an array'),"");x=y}}if(x&&x.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");zT(t,n,r,s,o,i,a,x,d).then((y)=>{if(!y.ok)return m(y.error,y.pluginName);try{g(y.requestPlugins,y.runOnEndCallbacks,y.scheduleOnDisposeCallbacks)}catch(S){m(S,"")}},(y)=>m(y,""));return}try{g(null,(y,S)=>S([],[]),()=>{})}catch(y){m(y,"")}function g(y,S,E){let v=o.hasFS,{entries:j,flags:P,write:O,stdinContents:T,stdinResolveDir:U,absWorkingDir:F,nodePaths:H,mangleCache:A}=HT(e,a,c,q$,v);if(O&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let N={command:"build",key:t,entries:j,flags:P,write:O,stdinContents:T,stdinResolveDir:U,absWorkingDir:F||l,nodePaths:H,context:p};if(y)N.plugins=y;if(A)N.mangleCache=A;let B=(X,re)=>{let ue={errors:li(X.errors,d),warnings:li(X.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=ue.errors.slice(),z=ue.warnings.slice();if(X.outputFiles)ue.outputFiles=X.outputFiles.map(GT);if(X.metafile&&X.metafile.length)ue.metafile=XT(X.metafile);if(X.mangleCache)ue.mangleCache=X.mangleCache;if(X.writeToStdout!==void 0)console.log(wo(X.writeToStdout).replace(/\n$/,""));S(ue,(be,ae)=>{if(xe.length>0||be.length>0){let ee=Ia("Build failed",xe.concat(be),z.concat(ae));return re(ee,null,be,ae)}re(null,ue,be,ae)})},M,D;if(p)i["on-end"]=(X,re)=>new Promise((ue)=>{B(re,(xe,z,be,ae)=>{let ee={errors:be,warnings:ae};if(D)D(xe,z);M=void 0,D=void 0,r(X,ee),ue()})});n(s,N,(X,re)=>{if(X)return u(Error(X),null);if(!p)return B(re,(z,be)=>(E(),u(z,be)));if(re.errors.length>0)return u(Ia("Context failed",re.errors,re.warnings),null);let ue=!1,xe={rebuild:()=>{if(!M)M=new Promise((z,be)=>{let ae;D=(ot,Te)=>{if(!ae)ae=()=>ot?be(ot):z(Te)};let ee=()=>{n(s,{command:"rebuild",key:t},(Te,et)=>{if(Te)be(Error(Te));else if(ae)ae();else ee()})};ee()});return M},watch:(z={})=>new Promise((be,ae)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let ee={},ot=C(z,ee,"delay",bo);ht(z,ee,"in watch() call");let Te={command:"watch",key:t};if(ot)Te.delay=ot;n(s,Te,(et)=>{if(et)ae(Error(et));else be(void 0)})}),serve:(z={})=>new Promise((be,ae)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let ee={},ot=C(z,ee,"port",MT),Te=C(z,ee,"host",se),et=C(z,ee,"servedir",se),te=C(z,ee,"keyfile",se),tt=C(z,ee,"certfile",se),Xe=C(z,ee,"fallback",se),xt=C(z,ee,"cors",Sn),de=C(z,ee,"onRequest",Q$);ht(z,ee,"in serve() call");let dt={command:"serve",key:t,onRequest:!!de};if(ot!==void 0)dt.port=ot;if(Te!==void 0)dt.host=Te;if(et!==void 0)dt.servedir=et;if(te!==void 0)dt.keyfile=te;if(tt!==void 0)dt.certfile=tt;if(Xe!==void 0)dt.fallback=Xe;if(xt){let Be={},ce=C(xt,Be,"origin",tS);if(ht(xt,Be,'on "cors" object'),Array.isArray(ce))dt.corsOrigin=ce;else if(ce!==void 0)dt.corsOrigin=[ce]}n(s,dt,(Be,ce)=>{if(Be)return ae(Error(Be));if(de)i["serve-request"]=(Et,Jr)=>{de(Jr.args),r(Et,{})};be(ce)})}),cancel:()=>new Promise((z)=>{if(ue)return z();n(s,{command:"cancel",key:t},()=>{z()})}),dispose:()=>new Promise((z)=>{if(ue)return z();ue=!0,n(s,{command:"dispose",key:t},()=>{z(),E(),s.unref()})})};s.ref(),u(null,xe)})}}var zT=async(e,t,n,r,s,o,i,a,c)=>{let l=[],u=[],d={},p={},m=[],x=0,g=0,y=[],S=!1;a=[...a];for(let j of a){let P={};if(typeof j!=="object")throw Error(`Plugin at index ${g} must be an object`);let O=C(j,P,"name",se);if(typeof O!=="string"||O==="")throw Error(`Plugin at index ${g} is missing a name`);try{let T=C(j,P,"setup",Q$);if(typeof T!=="function")throw Error("Plugin is missing a setup function");ht(j,P,`on plugin ${St(O)}`);let U={name:O,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};g++;let H=T({initialOptions:i,resolve:(A,N={})=>{if(!S)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof A!=="string")throw Error("The path to resolve must be a string");let B=Object.create(null),M=C(N,B,"pluginName",se),D=C(N,B,"importer",se),X=C(N,B,"namespace",se),re=C(N,B,"resolveDir",se),ue=C(N,B,"kind",se),xe=C(N,B,"pluginData",Hl),z=C(N,B,"with",Sn);return ht(N,B,"in resolve() call"),new Promise((be,ae)=>{let ee={command:"resolve",path:A,key:e,pluginName:O};if(M!=null)ee.pluginName=M;if(D!=null)ee.importer=D;if(X!=null)ee.namespace=X;if(re!=null)ee.resolveDir=re;if(ue!=null)ee.kind=ue;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)ee.pluginData=c.store(xe);if(z!=null)ee.with=KT(z,"with");t(r,ee,(ot,Te)=>{if(ot!==null)ae(Error(ot));else be({errors:li(Te.errors,c),warnings:li(Te.warnings,c),path:Te.path,external:Te.external,sideEffects:Te.sideEffects,namespace:Te.namespace,suffix:Te.suffix,pluginData:c.load(Te.pluginData)})})})},onStart(A){let B=ql(Error('This error came from the "onStart" callback registered here:'),s,"onStart");l.push({name:O,callback:A,note:B}),U.onStart=!0},onEnd(A){let B=ql(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:O,callback:A,note:B}),U.onEnd=!0},onResolve(A,N){let M=ql(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),D={},X=C(A,D,"filter",Ul),re=C(A,D,"namespace",se);if(ht(A,D,`in onResolve() call for plugin ${St(O)}`),X==null)throw Error("onResolve() call is missing a filter");let ue=x++;d[ue]={name:O,callback:N,note:M},U.onResolve.push({id:ue,filter:Bl(X),namespace:re||""})},onLoad(A,N){let M=ql(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),D={},X=C(A,D,"filter",Ul),re=C(A,D,"namespace",se);if(ht(A,D,`in onLoad() call for plugin ${St(O)}`),X==null)throw Error("onLoad() call is missing a filter");let ue=x++;p[ue]={name:O,callback:N,note:M},U.onLoad.push({id:ue,filter:Bl(X),namespace:re||""})},onDispose(A){m.push(A)},esbuild:s.esbuild});if(H)await H;y.push(U)}catch(T){return{ok:!1,error:T,pluginName:O}}}o["on-start"]=async(j,P)=>{c.clear();let O={errors:[],warnings:[]};await Promise.all(l.map(async({name:T,callback:U,note:F})=>{try{let H=await U();if(H!=null){if(typeof H!=="object")throw Error(`Expected onStart() callback in plugin ${St(T)} to return an object`);let A={},N=C(H,A,"errors",Kr),B=C(H,A,"warnings",Kr);if(ht(H,A,`from onStart() callback in plugin ${St(T)}`),N!=null)O.errors.push(...Gr(N,"errors",c,T,void 0));if(B!=null)O.warnings.push(...Gr(B,"warnings",c,T,void 0))}}catch(H){O.errors.push(xo(H,s,c,F&&F(),T))}})),n(j,O)},o["on-resolve"]=async(j,P)=>{let O={},T="",U,F;for(let H of P.ids)try{({name:T,callback:U,note:F}=d[H]);let A=await U({path:P.path,importer:P.importer,namespace:P.namespace,resolveDir:P.resolveDir,kind:P.kind,pluginData:c.load(P.pluginData),with:P.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onResolve() callback in plugin ${St(T)} to return an object`);let N={},B=C(A,N,"pluginName",se),M=C(A,N,"path",se),D=C(A,N,"namespace",se),X=C(A,N,"suffix",se),re=C(A,N,"external",Ye),ue=C(A,N,"sideEffects",Ye),xe=C(A,N,"pluginData",Hl),z=C(A,N,"errors",Kr),be=C(A,N,"warnings",Kr),ae=C(A,N,"watchFiles",sn),ee=C(A,N,"watchDirs",sn);if(ht(A,N,`from onResolve() callback in plugin ${St(T)}`),O.id=H,B!=null)O.pluginName=B;if(M!=null)O.path=M;if(D!=null)O.namespace=D;if(X!=null)O.suffix=X;if(re!=null)O.external=re;if(ue!=null)O.sideEffects=ue;if(xe!=null)O.pluginData=c.store(xe);if(z!=null)O.errors=Gr(z,"errors",c,T,void 0);if(be!=null)O.warnings=Gr(be,"warnings",c,T,void 0);if(ae!=null)O.watchFiles=Wl(ae,"watchFiles");if(ee!=null)O.watchDirs=Wl(ee,"watchDirs");break}}catch(A){O={id:H,errors:[xo(A,s,c,F&&F(),T)]};break}n(j,O)},o["on-load"]=async(j,P)=>{let O={},T="",U,F;for(let H of P.ids)try{({name:T,callback:U,note:F}=p[H]);let A=await U({path:P.path,namespace:P.namespace,suffix:P.suffix,pluginData:c.load(P.pluginData),with:P.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onLoad() callback in plugin ${St(T)} to return an object`);let N={},B=C(A,N,"pluginName",se),M=C(A,N,"contents",nS),D=C(A,N,"resolveDir",se),X=C(A,N,"pluginData",Hl),re=C(A,N,"loader",se),ue=C(A,N,"errors",Kr),xe=C(A,N,"warnings",Kr),z=C(A,N,"watchFiles",sn),be=C(A,N,"watchDirs",sn);if(ht(A,N,`from onLoad() callback in plugin ${St(T)}`),O.id=H,B!=null)O.pluginName=B;if(M instanceof Uint8Array)O.contents=M;else if(M!=null)O.contents=zn(M);if(D!=null)O.resolveDir=D;if(X!=null)O.pluginData=c.store(X);if(re!=null)O.loader=re;if(ue!=null)O.errors=Gr(ue,"errors",c,T,void 0);if(xe!=null)O.warnings=Gr(xe,"warnings",c,T,void 0);if(z!=null)O.watchFiles=Wl(z,"watchFiles");if(be!=null)O.watchDirs=Wl(be,"watchDirs");break}}catch(A){O={id:H,errors:[xo(A,s,c,F&&F(),T)]};break}n(j,O)};let E=(j,P)=>P([],[]);if(u.length>0)E=(j,P)=>{(async()=>{let O=[],T=[];for(let{name:U,callback:F,note:H}of u){let A,N;try{let B=await F(j);if(B!=null){if(typeof B!=="object")throw Error(`Expected onEnd() callback in plugin ${St(U)} to return an object`);let M={},D=C(B,M,"errors",Kr),X=C(B,M,"warnings",Kr);if(ht(B,M,`from onEnd() callback in plugin ${St(U)}`),D!=null)A=Gr(D,"errors",c,U,void 0);if(X!=null)N=Gr(X,"warnings",c,U,void 0)}}catch(B){A=[xo(B,s,c,H&&H(),U)]}if(A){O.push(...A);try{j.errors.push(...A)}catch{}}if(N){T.push(...N);try{j.warnings.push(...N)}catch{}}}P(O,T)})()};let v=()=>{for(let j of m)setTimeout(()=>j(),0)};return S=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:E,scheduleOnDisposeCallbacks:v}};function iS(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let r=t++;return e.set(r,n),r}}}function ql(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
|
|
61
|
-
`);o.splice(1,1);let i=
|
|
62
|
-
`),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function
|
|
60
|
+
`);function ow(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function bm(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var as=String.fromCharCode;function Hn(e,t,n){let r=e[t],s=1,o=0;for(let i=0;i<t;i++)if(e[i]===10)s++,o=0;else o++;throw SyntaxError(n?n:t===e.length?"Unexpected end of input while parsing JSON":r>=32&&r<=126?`Unexpected character ${as(r)} in JSON at position ${t} (line ${s}, column ${o})`:`Unexpected byte 0x${r.toString(16)} in JSON at position ${t} (line ${s}, column ${o})`)}function pM(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],n=[],r=[],s=e.length,o=null,i=0,a,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let u;if(i===2&&o===null&&c!==34&&c!==125)Hn(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)Hn(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)Hn(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)Hn(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 d=l;u=as(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+=as(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))Hn(e,--d,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)Hn(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+=`
|
|
61
|
+
`;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(c=e[l++],d<<=4,c>=48&&c<=57)d|=c-48;else if(c>=97&&c<=102)d|=c+-87;else if(c>=65&&c<=70)d|=c+-55;else Hn(e,--l);u+=as(d);break}default:Hn(e,--l);break}else if(c<=127)u+=as(c);else if((c&224)===192)u+=as((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=as((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let d=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(d>65535)d-=65536,u+=as(d>>10&1023|55296),d=56320|d&1023;u+=as(d)}}u[0];break}case 91:{u=[],t.push(o),n.push(a),r.push(i),o=null,a=u,i=1;continue}case 123:{u={},t.push(o),n.push(a),r.push(i),o=null,a=u,i=2;continue}case 93:{if(i!==1)Hn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Hn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Hn(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(i){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(o===null){if(o=u,c===58){l++;continue}}else{if(a[o]=u,o=null,c===44){l++;continue}if(c===125)continue}break}}break}Hn(e,l)}var Ct=JSON.stringify,GS="warning",XS="silent";function wi(e,t){let n=[];for(let r of e){if(pn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Su=()=>null,ot=(e)=>typeof e==="boolean"?null:"a boolean",se=(e)=>typeof e==="string"?null:"a string",wu=(e)=>e instanceof RegExp?null:"a RegExp object",ko=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",mM=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",iw=(e)=>typeof e==="function"?null:"a function",ls=(e)=>Array.isArray(e)?null:"an array",mn=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Cn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",hM=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",gM=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",YS=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",aw=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",yM=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",lw=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",cw=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",xM=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function R(e,t,n,r){let s=e[n];if(t[n+""]=!0,s===void 0)return;let o=r(s);if(o!==null)throw Error(`${Ct(n)} must be ${o}`);return s}function vt(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${Ct(r)}`)}function bM(e){let t=Object.create(null),n=R(e,t,"wasmURL",xM),r=R(e,t,"wasmModule",gM),s=R(e,t,"worker",ot);return vt(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function uw(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let r=e[n];if(typeof r==="string"||r===!1)t[n]=r;else throw Error(`Expected ${Ct(n)} in mangle cache to map to either a string or false`)}}return t}function _u(e,t,n,r,s){let o=R(t,n,"color",ot),i=R(t,n,"logLevel",se),a=R(t,n,"logLimit",ko),l=R(t,n,"logStyle",se);if(o!==void 0)e.push(`--color=${o}`);else if(r)e.push("--color=true");if(e.push(`--log-level=${i||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function pn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+Ct(n):""} to be a string, got ${typeof e} instead`);return e}function fw(e,t,n){let r=R(t,n,"legalComments",se),s=R(t,n,"sourceRoot",se),o=R(t,n,"sourcesContent",ot),i=R(t,n,"target",lw),a=R(t,n,"format",se),l=R(t,n,"globalName",se),c=R(t,n,"mangleProps",wu),u=R(t,n,"reserveProps",wu),d=R(t,n,"mangleQuoted",ot),p=R(t,n,"minify",ot),m=R(t,n,"minifySyntax",ot),y=R(t,n,"minifyWhitespace",ot),S=R(t,n,"minifyIdentifiers",ot),g=R(t,n,"lineLimit",ko),x=R(t,n,"drop",mn),P=R(t,n,"dropLabels",mn),w=R(t,n,"charset",se),E=R(t,n,"treeShaking",ot),j=R(t,n,"ignoreAnnotations",ot),A=R(t,n,"jsx",se),T=R(t,n,"jsxFactory",se),I=R(t,n,"jsxFragment",se),V=R(t,n,"jsxImportSource",se),H=R(t,n,"jsxDev",ot),O=R(t,n,"jsxSideEffects",ot),N=R(t,n,"define",Cn),G=R(t,n,"logOverride",Cn),Q=R(t,n,"supported",Cn),re=R(t,n,"pure",mn),ue=R(t,n,"keepNames",ot),ne=R(t,n,"platform",se),fe=R(t,n,"tsconfigRaw",yM),xe=R(t,n,"absPaths",mn);if(r)e.push(`--legal-comments=${r}`);if(s!==void 0)e.push(`--source-root=${s}`);if(o!==void 0)e.push(`--sources-content=${o}`);if(i)e.push(`--target=${wi(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(ne)e.push(`--platform=${ne}`);if(fe)e.push(`--tsconfig-raw=${typeof fe==="string"?fe:JSON.stringify(fe)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(y)e.push("--minify-whitespace");if(S)e.push("--minify-identifiers");if(g)e.push(`--line-limit=${g}`);if(w)e.push(`--charset=${w}`);if(E!==void 0)e.push(`--tree-shaking=${E}`);if(j)e.push("--ignore-annotations");if(x)for(let X of x)e.push(`--drop:${pn(X,"drop")}`);if(P)e.push(`--drop-labels=${wi(P,"drop label")}`);if(xe)e.push(`--abs-paths=${wi(xe,"abs paths")}`);if(c)e.push(`--mangle-props=${vu(c)}`);if(u)e.push(`--reserve-props=${vu(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(A)e.push(`--jsx=${A}`);if(T)e.push(`--jsx-factory=${T}`);if(I)e.push(`--jsx-fragment=${I}`);if(V)e.push(`--jsx-import-source=${V}`);if(H)e.push("--jsx-dev");if(O)e.push("--jsx-side-effects");if(N)for(let X in N){if(X.indexOf("=")>=0)throw Error(`Invalid define: ${X}`);e.push(`--define:${X}=${pn(N[X],"define",X)}`)}if(G)for(let X in G){if(X.indexOf("=")>=0)throw Error(`Invalid log override: ${X}`);e.push(`--log-override:${X}=${pn(G[X],"log override",X)}`)}if(Q)for(let X in Q){if(X.indexOf("=")>=0)throw Error(`Invalid supported: ${X}`);let B=Q[X];if(typeof B!=="boolean")throw Error(`Expected value for supported ${Ct(X)} to be a boolean, got ${typeof B} instead`);e.push(`--supported:${X}=${B}`)}if(re)for(let X of re)e.push(`--pure:${pn(X,"pure")}`);if(ue)e.push("--keep-names")}function $M(e,t,n,r,s){var o;let i=[],a=[],l=Object.create(null),c=null,u=null;_u(i,t,l,n,r),fw(i,t,l);let d=R(t,l,"sourcemap",aw),p=R(t,l,"bundle",ot),m=R(t,l,"splitting",ot),y=R(t,l,"preserveSymlinks",ot),S=R(t,l,"metafile",ot),g=R(t,l,"outfile",se),x=R(t,l,"outdir",se),P=R(t,l,"outbase",se),w=R(t,l,"tsconfig",se),E=R(t,l,"resolveExtensions",mn),j=R(t,l,"nodePaths",mn),A=R(t,l,"mainFields",mn),T=R(t,l,"conditions",mn),I=R(t,l,"external",mn),V=R(t,l,"packages",se),H=R(t,l,"alias",Cn),O=R(t,l,"loader",Cn),N=R(t,l,"outExtension",Cn),G=R(t,l,"publicPath",se),Q=R(t,l,"entryNames",se),re=R(t,l,"chunkNames",se),ue=R(t,l,"assetNames",se),ne=R(t,l,"inject",mn),fe=R(t,l,"banner",Cn),xe=R(t,l,"footer",Cn),X=R(t,l,"entryPoints",hM),B=R(t,l,"absWorkingDir",se),q=R(t,l,"stdin",Cn),z=(o=R(t,l,"write",ot))!=null?o:s,We=R(t,l,"allowOverwrite",ot),qe=R(t,l,"mangleCache",Cn);if(l.plugins=!0,vt(t,l,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(We)i.push("--allow-overwrite");if(m)i.push("--splitting");if(y)i.push("--preserve-symlinks");if(S)i.push("--metafile");if(g)i.push(`--outfile=${g}`);if(x)i.push(`--outdir=${x}`);if(P)i.push(`--outbase=${P}`);if(w)i.push(`--tsconfig=${w}`);if(V)i.push(`--packages=${V}`);if(E)i.push(`--resolve-extensions=${wi(E,"resolve extension")}`);if(G)i.push(`--public-path=${G}`);if(Q)i.push(`--entry-names=${Q}`);if(re)i.push(`--chunk-names=${re}`);if(ue)i.push(`--asset-names=${ue}`);if(A)i.push(`--main-fields=${wi(A,"main field")}`);if(T)i.push(`--conditions=${wi(T,"condition")}`);if(I)for(let te of I)i.push(`--external:${pn(te,"external")}`);if(H)for(let te in H){if(te.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${te}`);i.push(`--alias:${te}=${pn(H[te],"alias",te)}`)}if(fe)for(let te in fe){if(te.indexOf("=")>=0)throw Error(`Invalid banner file type: ${te}`);i.push(`--banner:${te}=${pn(fe[te],"banner",te)}`)}if(xe)for(let te in xe){if(te.indexOf("=")>=0)throw Error(`Invalid footer file type: ${te}`);i.push(`--footer:${te}=${pn(xe[te],"footer",te)}`)}if(ne)for(let te of ne)i.push(`--inject:${pn(te,"inject")}`);if(O)for(let te in O){if(te.indexOf("=")>=0)throw Error(`Invalid loader extension: ${te}`);i.push(`--loader:${te}=${pn(O[te],"loader",te)}`)}if(N)for(let te in N){if(te.indexOf("=")>=0)throw Error(`Invalid out extension: ${te}`);i.push(`--out-extension:${te}=${pn(N[te],"out extension",te)}`)}if(X)if(Array.isArray(X))for(let te=0,Ut=X.length;te<Ut;te++){let Je=X[te];if(typeof Je==="object"&&Je!==null){let jt=Object.create(null),bt=R(Je,jt,"in",se),pe=R(Je,jt,"out",se);if(vt(Je,jt,"in entry point at index "+te),bt===void 0)throw Error('Missing property "in" for entry point at index '+te);if(pe===void 0)throw Error('Missing property "out" for entry point at index '+te);a.push([pe,bt])}else a.push(["",pn(Je,"entry point at index "+te)])}else for(let te in X)a.push([te,pn(X[te],"entry point",te)]);if(q){let te=Object.create(null),Ut=R(q,te,"contents",cw),Je=R(q,te,"resolveDir",se),jt=R(q,te,"sourcefile",se),bt=R(q,te,"loader",se);if(vt(q,te,'in "stdin" object'),jt)i.push(`--sourcefile=${jt}`);if(bt)i.push(`--loader=${bt}`);if(Je)u=Je;if(typeof Ut==="string")c=lr(Ut);else if(Ut instanceof Uint8Array)c=Ut}let Ye=[];if(j)for(let te of j)te+="",Ye.push(te);return{entries:a,flags:i,write:z,stdinContents:c,stdinResolveDir:u,absWorkingDir:B,nodePaths:Ye,mangleCache:uw(qe)}}function SM(e,t,n,r){let s=[],o=Object.create(null);_u(s,t,o,n,r),fw(s,t,o);let i=R(t,o,"sourcemap",aw),a=R(t,o,"sourcefile",se),l=R(t,o,"loader",se),c=R(t,o,"banner",se),u=R(t,o,"footer",se),d=R(t,o,"mangleCache",Cn);if(vt(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);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:uw(d)}}function dw(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,l=(w)=>{let E=a+w.length;if(E>i.length){let A=new Uint8Array(E*2);A.set(i),i=A}i.set(w,a),a+=w.length;let j=0;while(j+4<=a){let A=ow(i,j);if(j+4+A>a)break;j+=4,y(i.subarray(j,j+A)),j+=A}if(j>0)i.copyWithin(0,j,a),a-=j},c=(w)=>{if(n.didClose=!0,w)n.reason=": "+(w.message||w);let E="The service was stopped"+n.reason;for(let j in r)r[j](E,null);r={}},u=(w,E,j)=>{if(n.didClose)return j("The service is no longer running"+n.reason,null);let A=s++;if(r[A]=(T,I)=>{try{j(T,I)}finally{if(w)w.unref()}},w)w.ref();e.writeToStdin(KS({id:A,isRequest:!0,value:E}))},d=(w,E)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(KS({id:w,isRequest:!1,value:E}))},p=async(w,E)=>{try{if(E.command==="ping"){d(w,{});return}if(typeof E.key==="number"){let j=t[E.key];if(!j)return;let A=j[E.command];if(A){await A(w,E);return}}throw Error("Invalid command: "+E.command)}catch(j){let A=[_o(j,e,null,void 0,"")];try{d(w,{errors:A})}catch{}}},m=!0,y=(w)=>{if(m){m=!1;let j=String.fromCharCode(...w);if(j!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${Ct(j)}`);return}let E=dM(w);if(E.isRequest)p(E.id,E.value);else{let j=r[E.id];if(delete r[E.id],E.value.error)j(E.value.error,{});else j(null,E.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:w,refs:E,options:j,isTTY:A,defaultWD:T,callback:I})=>{let V=0,H=o++,O={},N={ref(){if(++V===1){if(E)E.ref()}},unref(){if(--V===0){if(delete t[H],E)E.unref()}}};t[H]=O,N.ref(),wM(w,H,u,d,N,e,O,j,A,T,(G,Q)=>{try{I(G,Q)}finally{N.unref()}})},transform:({callName:w,refs:E,input:j,options:A,isTTY:T,fs:I,callback:V})=>{let H=pw(),O=(N)=>{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:Q}=SM(w,A,T,XS),re={command:"transform",flags:G,inputFS:N!==null,input:N!==null?lr(N):typeof j==="string"?lr(j):j};if(Q)re.mangleCache=Q;u(E,re,(ue,ne)=>{if(ue)return V(Error(ue),null);let fe=vi(ne.errors,H),xe=vi(ne.warnings,H),X=1,B=()=>{if(--X===0){let q={warnings:xe,code:ne.code,map:ne.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in ne)q.legalComments=ne==null?void 0:ne.legalComments;if(ne.mangleCache)q.mangleCache=ne==null?void 0:ne.mangleCache;V(null,q)}};if(fe.length>0)return V(tl("Transform failed",fe,xe),null);if(ne.codeFS)X++,I.readFile(ne.code,(q,z)=>{if(q!==null)V(q,null);else ne.code=z,B()});if(ne.mapFS)X++,I.readFile(ne.map,(q,z)=>{if(q!==null)V(q,null);else ne.map=z,B()});B()})}catch(G){let Q=[];try{_u(Q,A,{},T,XS)}catch{}let re=_o(G,e,H,void 0,"");u(E,{command:"error",flags:Q,error:re},()=>{re.detail=H.load(re.detail),V(tl("Transform failed",[re],[]),null)})}};if((typeof j==="string"||j instanceof Uint8Array)&&j.length>1048576){let N=O;O=()=>I.writeFile(j,N)}O(null)},formatMessages:({callName:w,refs:E,messages:j,options:A,callback:T})=>{if(!A)throw Error(`Missing second argument in ${w}() call`);let I={},V=R(A,I,"kind",se),H=R(A,I,"color",ot),O=R(A,I,"terminalWidth",ko),N=R(A,I,"logStyle",se);if(vt(A,I,`in ${w}() call`),V===void 0)throw Error(`Missing "kind" in ${w}() call`);if(V!=="error"&&V!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${w}() call`);let G={command:"format-msgs",messages:cs(j,"messages",null,"",O),isWarning:V==="warning"};if(H!==void 0)G.color=H;if(O!==void 0)G.terminalWidth=O;if(N!==void 0)G.logStyle=N;u(E,G,(Q,re)=>{if(Q)return T(Error(Q),null);T(null,re.messages)})},analyzeMetafile:({callName:w,refs:E,metafile:j,options:A,callback:T})=>{if(A===void 0)A={};let I={},V=R(A,I,"color",ot),H=R(A,I,"verbose",ot);vt(A,I,`in ${w}() call`);let O={command:"analyze-metafile",metafile:j};if(V!==void 0)O.color=V;if(H!==void 0)O.verbose=H;u(E,O,(N,G)=>{if(N)return T(Error(N),null);T(null,G.result)})}}}}function wM(e,t,n,r,s,o,i,a,l,c,u){let d=pw(),p=e==="context",m=(g,x)=>{let P=[];try{_u(P,a,{},l,GS)}catch{}let w=_o(g,o,d,void 0,x);n(s,{command:"error",flags:P,error:w},()=>{w.detail=d.load(w.detail),u(tl(p?"Context failed":"Build failed",[w],[]),null)})},y;if(typeof a==="object"){let g=a.plugins;if(g!==void 0){if(!Array.isArray(g))return m(Error('"plugins" must be an array'),"");y=g}}if(y&&y.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");vM(t,n,r,s,o,i,a,y,d).then((g)=>{if(!g.ok)return m(g.error,g.pluginName);try{S(g.requestPlugins,g.runOnEndCallbacks,g.scheduleOnDisposeCallbacks)}catch(x){m(x,"")}},(g)=>m(g,""));return}try{S(null,(g,x)=>x([],[]),()=>{})}catch(g){m(g,"")}function S(g,x,P){let w=o.hasFS,{entries:E,flags:j,write:A,stdinContents:T,stdinResolveDir:I,absWorkingDir:V,nodePaths:H,mangleCache:O}=$M(e,a,l,GS,w);if(A&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let N={command:"build",key:t,entries:E,flags:j,write:A,stdinContents:T,stdinResolveDir:I,absWorkingDir:V||c,nodePaths:H,context:p};if(g)N.plugins=g;if(O)N.mangleCache=O;let G=(ue,ne)=>{let fe={errors:vi(ue.errors,d),warnings:vi(ue.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=fe.errors.slice(),X=fe.warnings.slice();if(ue.outputFiles)fe.outputFiles=ue.outputFiles.map(jM);if(ue.metafile&&ue.metafile.length)fe.metafile=PM(ue.metafile);if(ue.mangleCache)fe.mangleCache=ue.mangleCache;if(ue.writeToStdout!==void 0)console.log(Co(ue.writeToStdout).replace(/\n$/,""));x(fe,(B,q)=>{if(xe.length>0||B.length>0){let z=tl("Build failed",xe.concat(B),X.concat(q));return ne(z,null,B,q)}ne(null,fe,B,q)})},Q,re;if(p)i["on-end"]=(ue,ne)=>new Promise((fe)=>{G(ne,(xe,X,B,q)=>{let z={errors:B,warnings:q};if(re)re(xe,X);Q=void 0,re=void 0,r(ue,z),fe()})});n(s,N,(ue,ne)=>{if(ue)return u(Error(ue),null);if(!p)return G(ne,(X,B)=>(P(),u(X,B)));if(ne.errors.length>0)return u(tl("Context failed",ne.errors,ne.warnings),null);let fe=!1,xe={rebuild:()=>{if(!Q)Q=new Promise((X,B)=>{let q;re=(We,qe)=>{if(!q)q=()=>We?B(We):X(qe)};let z=()=>{n(s,{command:"rebuild",key:t},(qe,Ye)=>{if(qe)B(Error(qe));else if(q)q();else z()})};z()});return Q},watch:(X={})=>new Promise((B,q)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let z={},We=R(X,z,"delay",ko);vt(X,z,"in watch() call");let qe={command:"watch",key:t};if(We)qe.delay=We;n(s,qe,(Ye)=>{if(Ye)q(Error(Ye));else B(void 0)})}),serve:(X={})=>new Promise((B,q)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let z={},We=R(X,z,"port",mM),qe=R(X,z,"host",se),Ye=R(X,z,"servedir",se),te=R(X,z,"keyfile",se),Ut=R(X,z,"certfile",se),Je=R(X,z,"fallback",se),jt=R(X,z,"cors",Cn),bt=R(X,z,"onRequest",iw);vt(X,z,"in serve() call");let pe={command:"serve",key:t,onRequest:!!bt};if(We!==void 0)pe.port=We;if(qe!==void 0)pe.host=qe;if(Ye!==void 0)pe.servedir=Ye;if(te!==void 0)pe.keyfile=te;if(Ut!==void 0)pe.certfile=Ut;if(Je!==void 0)pe.fallback=Je;if(jt){let ct={},Se=R(jt,ct,"origin",lw);if(vt(jt,ct,'on "cors" object'),Array.isArray(Se))pe.corsOrigin=Se;else if(Se!==void 0)pe.corsOrigin=[Se]}n(s,pe,(ct,Se)=>{if(ct)return q(Error(ct));if(bt)i["serve-request"]=(Ze,Nt)=>{bt(Nt.args),r(Ze,{})};B(Se)})}),cancel:()=>new Promise((X)=>{if(fe)return X();n(s,{command:"cancel",key:t},()=>{X()})}),dispose:()=>new Promise((X)=>{if(fe)return X();fe=!0,n(s,{command:"dispose",key:t},()=>{X(),P(),s.unref()})})};s.ref(),u(null,xe)})}}var vM=async(e,t,n,r,s,o,i,a,l)=>{let c=[],u=[],d={},p={},m=[],y=0,S=0,g=[],x=!1;a=[...a];for(let E of a){let j={};if(typeof E!=="object")throw Error(`Plugin at index ${S} must be an object`);let A=R(E,j,"name",se);if(typeof A!=="string"||A==="")throw Error(`Plugin at index ${S} is missing a name`);try{let T=R(E,j,"setup",iw);if(typeof T!=="function")throw Error("Plugin is missing a setup function");vt(E,j,`on plugin ${Ct(A)}`);let I={name:A,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};S++;let H=T({initialOptions:i,resolve:(O,N={})=>{if(!x)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof O!=="string")throw Error("The path to resolve must be a string");let G=Object.create(null),Q=R(N,G,"pluginName",se),re=R(N,G,"importer",se),ue=R(N,G,"namespace",se),ne=R(N,G,"resolveDir",se),fe=R(N,G,"kind",se),xe=R(N,G,"pluginData",Su),X=R(N,G,"with",Cn);return vt(N,G,"in resolve() call"),new Promise((B,q)=>{let z={command:"resolve",path:O,key:e,pluginName:A};if(Q!=null)z.pluginName=Q;if(re!=null)z.importer=re;if(ue!=null)z.namespace=ue;if(ne!=null)z.resolveDir=ne;if(fe!=null)z.kind=fe;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)z.pluginData=l.store(xe);if(X!=null)z.with=EM(X,"with");t(r,z,(We,qe)=>{if(We!==null)q(Error(We));else B({errors:vi(qe.errors,l),warnings:vi(qe.warnings,l),path:qe.path,external:qe.external,sideEffects:qe.sideEffects,namespace:qe.namespace,suffix:qe.suffix,pluginData:l.load(qe.pluginData)})})})},onStart(O){let G=bu(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:A,callback:O,note:G}),I.onStart=!0},onEnd(O){let G=bu(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:A,callback:O,note:G}),I.onEnd=!0},onResolve(O,N){let Q=bu(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),re={},ue=R(O,re,"filter",wu),ne=R(O,re,"namespace",se);if(vt(O,re,`in onResolve() call for plugin ${Ct(A)}`),ue==null)throw Error("onResolve() call is missing a filter");let fe=y++;d[fe]={name:A,callback:N,note:Q},I.onResolve.push({id:fe,filter:vu(ue),namespace:ne||""})},onLoad(O,N){let Q=bu(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),re={},ue=R(O,re,"filter",wu),ne=R(O,re,"namespace",se);if(vt(O,re,`in onLoad() call for plugin ${Ct(A)}`),ue==null)throw Error("onLoad() call is missing a filter");let fe=y++;p[fe]={name:A,callback:N,note:Q},I.onLoad.push({id:fe,filter:vu(ue),namespace:ne||""})},onDispose(O){m.push(O)},esbuild:s.esbuild});if(H)await H;g.push(I)}catch(T){return{ok:!1,error:T,pluginName:A}}}o["on-start"]=async(E,j)=>{l.clear();let A={errors:[],warnings:[]};await Promise.all(c.map(async({name:T,callback:I,note:V})=>{try{let H=await I();if(H!=null){if(typeof H!=="object")throw Error(`Expected onStart() callback in plugin ${Ct(T)} to return an object`);let O={},N=R(H,O,"errors",ls),G=R(H,O,"warnings",ls);if(vt(H,O,`from onStart() callback in plugin ${Ct(T)}`),N!=null)A.errors.push(...cs(N,"errors",l,T,void 0));if(G!=null)A.warnings.push(...cs(G,"warnings",l,T,void 0))}}catch(H){A.errors.push(_o(H,s,l,V&&V(),T))}})),n(E,A)},o["on-resolve"]=async(E,j)=>{let A={},T="",I,V;for(let H of j.ids)try{({name:T,callback:I,note:V}=d[H]);let O=await I({path:j.path,importer:j.importer,namespace:j.namespace,resolveDir:j.resolveDir,kind:j.kind,pluginData:l.load(j.pluginData),with:j.with});if(O!=null){if(typeof O!=="object")throw Error(`Expected onResolve() callback in plugin ${Ct(T)} to return an object`);let N={},G=R(O,N,"pluginName",se),Q=R(O,N,"path",se),re=R(O,N,"namespace",se),ue=R(O,N,"suffix",se),ne=R(O,N,"external",ot),fe=R(O,N,"sideEffects",ot),xe=R(O,N,"pluginData",Su),X=R(O,N,"errors",ls),B=R(O,N,"warnings",ls),q=R(O,N,"watchFiles",mn),z=R(O,N,"watchDirs",mn);if(vt(O,N,`from onResolve() callback in plugin ${Ct(T)}`),A.id=H,G!=null)A.pluginName=G;if(Q!=null)A.path=Q;if(re!=null)A.namespace=re;if(ue!=null)A.suffix=ue;if(ne!=null)A.external=ne;if(fe!=null)A.sideEffects=fe;if(xe!=null)A.pluginData=l.store(xe);if(X!=null)A.errors=cs(X,"errors",l,T,void 0);if(B!=null)A.warnings=cs(B,"warnings",l,T,void 0);if(q!=null)A.watchFiles=$u(q,"watchFiles");if(z!=null)A.watchDirs=$u(z,"watchDirs");break}}catch(O){A={id:H,errors:[_o(O,s,l,V&&V(),T)]};break}n(E,A)},o["on-load"]=async(E,j)=>{let A={},T="",I,V;for(let H of j.ids)try{({name:T,callback:I,note:V}=p[H]);let O=await I({path:j.path,namespace:j.namespace,suffix:j.suffix,pluginData:l.load(j.pluginData),with:j.with});if(O!=null){if(typeof O!=="object")throw Error(`Expected onLoad() callback in plugin ${Ct(T)} to return an object`);let N={},G=R(O,N,"pluginName",se),Q=R(O,N,"contents",cw),re=R(O,N,"resolveDir",se),ue=R(O,N,"pluginData",Su),ne=R(O,N,"loader",se),fe=R(O,N,"errors",ls),xe=R(O,N,"warnings",ls),X=R(O,N,"watchFiles",mn),B=R(O,N,"watchDirs",mn);if(vt(O,N,`from onLoad() callback in plugin ${Ct(T)}`),A.id=H,G!=null)A.pluginName=G;if(Q instanceof Uint8Array)A.contents=Q;else if(Q!=null)A.contents=lr(Q);if(re!=null)A.resolveDir=re;if(ue!=null)A.pluginData=l.store(ue);if(ne!=null)A.loader=ne;if(fe!=null)A.errors=cs(fe,"errors",l,T,void 0);if(xe!=null)A.warnings=cs(xe,"warnings",l,T,void 0);if(X!=null)A.watchFiles=$u(X,"watchFiles");if(B!=null)A.watchDirs=$u(B,"watchDirs");break}}catch(O){A={id:H,errors:[_o(O,s,l,V&&V(),T)]};break}n(E,A)};let P=(E,j)=>j([],[]);if(u.length>0)P=(E,j)=>{(async()=>{let A=[],T=[];for(let{name:I,callback:V,note:H}of u){let O,N;try{let G=await V(E);if(G!=null){if(typeof G!=="object")throw Error(`Expected onEnd() callback in plugin ${Ct(I)} to return an object`);let Q={},re=R(G,Q,"errors",ls),ue=R(G,Q,"warnings",ls);if(vt(G,Q,`from onEnd() callback in plugin ${Ct(I)}`),re!=null)O=cs(re,"errors",l,I,void 0);if(ue!=null)N=cs(ue,"warnings",l,I,void 0)}}catch(G){O=[_o(G,s,l,H&&H(),I)]}if(O){A.push(...O);try{E.errors.push(...O)}catch{}}if(N){T.push(...N);try{E.warnings.push(...N)}catch{}}}j(A,T)})()};let w=()=>{for(let E of m)setTimeout(()=>E(),0)};return x=!0,{ok:!0,requestPlugins:g,runOnEndCallbacks:P,scheduleOnDisposeCallbacks:w}};function pw(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let r=t++;return e.set(r,n),r}}}function bu(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
|
|
62
|
+
`);o.splice(1,1);let i=mw(t,o,n);if(i)return r={text:e.message,location:i},r}catch{}}}function _o(e,t,n,r,s){let o="Internal error",i=null;try{o=(e&&e.message||e)+""}catch{}try{i=mw(t,(e.stack+"").split(`
|
|
63
|
+
`),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function mw(e,t,n){let r=" at ";if(e.readFileSync&&!t[0].startsWith(r)&&t[1].startsWith(r))for(let s=1;s<t.length;s++){let o=t[s];if(!o.startsWith(r))continue;o=o.slice(r.length);while(!0){let i=/^(?:new |async )?\S+ \((.*)\)$/.exec(o);if(i){o=i[1];continue}if(i=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(o),i){o=i[1];continue}if(i=/^(\S+):(\d+):(\d+)$/.exec(o),i){let a;try{a=e.readFileSync(i[1],"utf8")}catch{break}let l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+i[2]-1]||"",c=+i[3]-1,u=l.slice(c,c+n.length)===n?n.length:0;return{file:i[1],namespace:"file",line:+i[2],column:lr(l.slice(0,c)).length,length:lr(l.slice(c,c+u)).length,lineText:l+`
|
|
63
64
|
`+t.slice(1).join(`
|
|
64
|
-
`),suggestion:""}}break}}return null}function
|
|
65
|
+
`),suggestion:""}}break}}return null}function tl(e,t,n){let r=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,r+1).map((o,i)=>{if(i===r)return`
|
|
65
66
|
...`;if(!o.location)return`
|
|
66
|
-
error: ${o.text}`;let{file:a,line:
|
|
67
|
-
${a}:${
|
|
67
|
+
error: ${o.text}`;let{file:a,line:l,column:c}=o.location,u=o.pluginName?`[plugin: ${o.pluginName}] `:"";return`
|
|
68
|
+
${a}:${l}:${c}: ERROR: ${u}${o.text}`}).join("");let s=Error(e);for(let[o,i]of[["errors",t],["warnings",n]])Object.defineProperty(s,o,{configurable:!0,enumerable:!0,get:()=>i,set:(a)=>Object.defineProperty(s,o,{configurable:!0,enumerable:!0,value:a})});return s}function vi(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function ZS(e,t,n){if(e==null)return null;let r={},s=R(e,r,"file",se),o=R(e,r,"namespace",se),i=R(e,r,"line",ko),a=R(e,r,"column",ko),l=R(e,r,"length",ko),c=R(e,r,"lineText",se),u=R(e,r,"suggestion",se);if(vt(e,r,t),c){let d=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(n&&n>0?n:80));if(!/[\x7F-\uFFFF]/.test(d)&&!/\n/.test(c))c=d}return{file:s||"",namespace:o||"",line:i||0,column:a||0,length:l||0,lineText:c||"",suggestion:u||""}}function cs(e,t,n,r,s){let o=[],i=0;for(let a of e){let l={},c=R(a,l,"id",se),u=R(a,l,"pluginName",se),d=R(a,l,"text",se),p=R(a,l,"location",YS),m=R(a,l,"notes",ls),y=R(a,l,"detail",Su),S=`in element ${i} of "${t}"`;vt(a,l,S);let g=[];if(m)for(let x of m){let P={},w=R(x,P,"text",se),E=R(x,P,"location",YS);vt(x,P,S),g.push({text:w||"",location:ZS(E,S,s)})}o.push({id:c||"",pluginName:u||r,text:d||"",location:ZS(p,S,s),notes:g,detail:n?n.store(y):-1}),i++}return o}function $u(e,t){let n=[];for(let r of e){if(typeof r!=="string")throw Error(`${Ct(t)} must be an array of strings`);n.push(r)}return n}function EM(e,t){let n=Object.create(null);for(let r in e){let s=e[r];if(typeof s!=="string")throw Error(`key ${Ct(r)} in object ${Ct(t)} must be a string`);n[r]=s}return n}function jM({path:e,contents:t,hash:n}){let r=null;return{path:e,contents:t,hash:n,get text(){let s=this.contents;if(r===null||s!==t)t=s,r=Co(s);return r}}}function vu(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function PM(e){let t;try{t=Co(e)}catch{return pM(e)}return JSON.parse(t)}var Rs=pt("fs"),QS=pt("os"),Wn=pt("path"),Si=process.env.ESBUILD_BINARY_PATH||Si,_M=(e)=>!!e&&e!=="/usr/bin/esbuild",ew="@esbuild/darwin-arm64",tw="@esbuild/darwin-x64",Eu={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},ju={"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"},nw={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function kM(){let e,t,n=!1,r=`${process.platform} ${QS.arch()} ${QS.endianness()}`;if(r in Eu)e=Eu[r],t="esbuild.exe";else if(r in ju)e=ju[r],t="bin/esbuild";else if(r in nw)e=nw[r],t="bin/esbuild",n=!0;else throw Error(`Unsupported platform: ${r}`);return{pkg:e,subpath:t,isWASM:n}}function OM(){let e=pt.resolve("esbuild"),t=Wn.dirname(Wn.dirname(Wn.dirname(e)));if(Wn.basename(t)==="node_modules"){for(let n in ju)try{let r=ju[n];if(Rs.existsSync(Wn.join(t,r)))return r}catch{}for(let n in Eu)try{let r=Eu[n];if(Rs.existsSync(Wn.join(t,r)))return r}catch{}}return null}function AM(e,t){let n=Wn.dirname(pt.resolve("esbuild"));return Wn.join(n,`downloaded-${e.replace("/","-")}-${Wn.basename(t)}`)}function CM(){if(_M(Si))if(!Rs.existsSync(Si))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${Si}`);else return{binPath:Si,isWASM:!1};let{pkg:e,subpath:t,isWASM:n}=kM(),r;try{r=pt.resolve(`${e}/${t}`)}catch(s){if(r=AM(e,t),!Rs.existsSync(r)){try{pt.resolve(e)}catch{let o=OM();if(o){let i=`
|
|
68
69
|
Specifically the "${o}" package is present but this platform
|
|
69
70
|
needs the "${e}" package instead. People often get into this
|
|
70
71
|
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
|
@@ -81,7 +82,7 @@ If you are installing with yarn, you can try listing both this platform and the
|
|
|
81
82
|
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
|
82
83
|
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
83
84
|
Keep in mind that this means multiple copies of esbuild will be present.
|
|
84
|
-
`;if(e===
|
|
85
|
+
`;if(e===tw&&o===ew||e===ew&&o===tw)i=`
|
|
85
86
|
Specifically the "${o}" package is present but this platform
|
|
86
87
|
needs the "${e}" package instead. People often get into this
|
|
87
88
|
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
|
@@ -113,161 +114,187 @@ want to do that.
|
|
|
113
114
|
If you are installing esbuild with npm, make sure that you don't specify the
|
|
114
115
|
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
|
115
116
|
of "package.json" is used by esbuild to install the correct binary executable
|
|
116
|
-
for your current platform.`)}throw s}}if(/\.zip\//.test(r)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(o){}if(s){let o=s.getPackageInformation(s.topLevel).packageLocation,i=
|
|
117
|
+
for your current platform.`)}throw s}}if(/\.zip\//.test(r)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(o){}if(s){let o=s.getPackageInformation(s.topLevel).packageLocation,i=Wn.join(o,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${Wn.basename(t)}`);if(!Rs.existsSync(i))Rs.mkdirSync(Wn.dirname(i),{recursive:!0}),Rs.copyFileSync(r,i),Rs.chmodSync(i,493);return{binPath:i,isWASM:n}}}return{binPath:r,isWASM:n}}var hw=pt("child_process"),RM=pt("crypto"),$m=pt("path"),Oo=pt("fs"),NM=pt("os"),TM=pt("tty"),nn;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{nn=pt("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)nn=void 0}var rw,sl=((rw=nn==null?void 0:nn.workerData)==null?void 0:rw.esbuildVersion)==="0.28.2",gw=()=>{if((!Si||!1)&&($m.basename(__filename)!=="main.js"||$m.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.
|
|
117
118
|
|
|
118
|
-
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}=
|
|
119
|
-
error: ${
|
|
120
|
-
`,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{
|
|
119
|
+
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}=CM();if(t)return["node",[e]];else return[e,[]]}},nl=()=>TM.isatty(2),JM={readFile(e,t){try{let n=Oo.readFileSync(e,"utf8");try{Oo.unlinkSync(e)}catch{}t(null,n)}catch(n){t(n,null)}},writeFile(e,t){try{let n=yw();Oo.writeFileSync(n,e),t(n)}catch{t(null)}}},MM={readFile(e,t){try{Oo.readFile(e,"utf8",(n,r)=>{try{Oo.unlink(e,()=>t(n,r))}catch{t(n,r)}})}catch(n){t(n,null)}},writeFile(e,t){try{let n=yw();Oo.writeFile(n,e,(r)=>r!==null?t(null):t(n))}catch{t(null)}}},IM="0.28.2",DM=(e)=>Ro().build(e),LM=(e)=>Ro().context(e),FM=(e,t)=>Ro().transform(e,t),VM=(e,t)=>Ro().formatMessages(e,t),qM=(e,t)=>Ro().analyzeMetafile(e,t),HM=(e)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.buildSync(e)}let t;return ku((n)=>n.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:nl(),defaultWD:Ao,callback:(r,s)=>{if(r)throw r;t=s}})),t},WM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.transformSync(e,t)}let n;return ku((r)=>r.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:nl(),fs:JM,callback:(s,o)=>{if(s)throw s;n=o}})),n},BM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.formatMessagesSync(e,t)}let n;return ku((r)=>r.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},UM=(e,t)=>{if(nn&&!sl){if(!rn)rn=Ou(nn);return rn.analyzeMetafileSync(e,t)}let n;return ku((r)=>r.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},zM=()=>{if(Pu)Pu();if(rn)rn.stop();return Promise.resolve()},Sm=!1,KM=(e)=>{if(e=bM(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(Sm)throw Error('Cannot call "initialize" more than once');return Ro(),Sm=!0,Promise.resolve()},Ao=process.cwd(),el,Pu,Ro=()=>{if(el)return el;let[e,t]=gw(),n=hw.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:Ao}),{readFromStdout:r,afterClose:s,service:o}=dw({writeToStdin(u){n.stdin.write(u,(d)=>{if(d)s(d)})},readFileSync:Oo.readFileSync,isSync:!1,hasFS:!0,esbuild:rl});n.stdin.on("error",s),n.on("error",s);let{stdin:i,stdout:a}=n;a.on("data",r),a.on("end",s),Pu=()=>{i.destroy(),a.destroy(),n.kill(),Sm=!1,el=void 0,Pu=void 0};let l=0;if(n.unref(),i.unref)i.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)n.ref()},unref(){if(--l===0)n.unref()}};return el={build:(u)=>new Promise((d,p)=>{o.buildOrContext({callName:"build",refs:c,options:u,isTTY:nl(),defaultWD:Ao,callback:(m,y)=>m?p(m):d(y)})}),context:(u)=>new Promise((d,p)=>o.buildOrContext({callName:"context",refs:c,options:u,isTTY:nl(),defaultWD:Ao,callback:(m,y)=>m?p(m):d(y)})),transform:(u,d)=>new Promise((p,m)=>o.transform({callName:"transform",refs:c,input:u,options:d||{},isTTY:nl(),fs:MM,callback:(y,S)=>y?m(y):p(S)})),formatMessages:(u,d)=>new Promise((p,m)=>o.formatMessages({callName:"formatMessages",refs:c,messages:u,options:d,callback:(y,S)=>y?m(y):p(S)})),analyzeMetafile:(u,d)=>new Promise((p,m)=>o.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:d,callback:(y,S)=>y?m(y):p(S)}))},el},ku=(e)=>{let[t,n]=gw(),r=new Uint8Array,{readFromStdout:s,afterClose:o,service:i}=dw({writeToStdin(l){if(r.length!==0)throw Error("Must run at most one command");r=l},isSync:!0,hasFS:!0,esbuild:rl});e(i);let a=hw.execFileSync(t,n.concat("--service=0.28.2"),{cwd:Ao,windowsHide:!0,input:r,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),o(null)},yw=()=>$m.join(NM.tmpdir(),`esbuild-${RM.randomBytes(32).toString("hex")}`),rn=null,Ou=(e)=>{let{port1:t,port2:n}=new e.MessageChannel,r=new e.Worker(__filename,{workerData:{workerPort:n,defaultWD:Ao,esbuildVersion:"0.28.2"},transferList:[n],execArgv:[]}),s=0,o=(c)=>{let u=Error(`Build failed with 1 error:
|
|
120
|
+
error: ${c}`),d=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=d,u.warnings=[],u},i=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw o("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let d in u)c[d]=u[d]},l=(c,u)=>{let d=s++,p=new SharedArrayBuffer(8),m=new Int32Array(p),y={sharedBuffer:p,id:d,command:c,args:u};r.postMessage(y);let S=Atomics.wait(m,0,0);if(S!=="ok"&&S!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+S);let{message:{id:g,resolve:x,reject:P,properties:w}}=e.receiveMessageOnPort(t);if(d!==g)throw Error(`Internal error: Expected id ${d} but got id ${g}`);if(P)throw a(P,w),P;return x};return r.unref(),{buildSync(c){return i(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(){r.terminate(),rn=null}}},GM=()=>{let e=nn.workerData.workerPort,t=nn.parentPort,n=(r)=>{let s={};if(r&&typeof r==="object")for(let o in r)s[o]=r[o];return s};try{let r=Ro();Ao=nn.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:o,id:i,command:a,args:l}=s,c=new Int32Array(o);try{switch(a){case"build":e.postMessage({id:i,resolve:await r.build(l[0])});break;case"transform":e.postMessage({id:i,resolve:await r.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:i,resolve:await r.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:i,resolve:await r.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:i,reject:u,properties:n(u)})}Atomics.add(c,0,1),Atomics.notify(c,0,1/0)})()})}catch(r){t.on("message",(s)=>{let{sharedBuffer:o,id:i}=s,a=new Int32Array(o);e.postMessage({id:i,reject:r,properties:n(r)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(sl)GM();var XM=rl});import{createRequire as YM}from"node:module";import{mkdirSync as ZM,writeFileSync as QM}from"node:fs";import{dirname as eI,join as tI}from"node:path";function vm(e,t){return YM(tI(t,"package.json")).resolve(e)}function bw(e){return e==="node"||e==="bun"?"node":"browser"}function nI(e){return new RegExp(`^${e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}$`)}function rI(e,t){let n=nI(e);return{name:"jx-in-memory-entry",setup:(r)=>{r.onResolve({filter:n},()=>({path:e})),r.onLoad({filter:n},()=>({contents:t,loader:"ts"}))}}}async function Em(e){let t=await Promise.resolve().then(() => Sr(ol(),1)),{entry:n}=e,r={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:bw(e.target),plugins:e.plugins,write:!1};if(e.conditions)r.conditions=e.conditions;if(e.define)r.define=e.define;if("path"in n){if(r.entryPoints=[n.path],n.contents!==void 0)r.plugins=[rI(n.path,n.contents),...e.plugins]}else r.stdin={contents:n.source,loader:"js",resolveDir:n.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...r,write:!1})).outputFiles[0].text}async function $w(e){let t=await Promise.resolve().then(() => Sr(ol(),1)),n={bundle:!0,chunkNames:"chunk-[hash]",entryNames:"[name]",entryPoints:e.entries,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,outdir:e.outdir,platform:bw(e.target),plugins:e.plugins,splitting:!0};if(e.conditions)n.conditions=e.conditions;if(e.define)n.define=e.define;return(await t.build({...n,write:!1})).outputFiles.map((s)=>(ZM(eI(s.path),{recursive:!0}),QM(s.path,s.contents),s.path))}var Sw=()=>{};var ww=".jx-entry-";import{rmSync as oI,writeFileSync as vw}from"node:fs";import{builtinModules as iI}from"node:module";import{tmpdir as aI}from"node:os";import{basename as lI,join as cI,resolve as uI}from"node:path";function Ew(e){return jo(e)||e.startsWith("./")||e.startsWith("../")}function Pm(e,t,n){if(jo(e))return vm(e.slice(hu.length),n);return uI(t,e)}function jw(e,t){return vm(e,t)}function fI(e){let{onFileLoaded:t,resolver:n}=e,r=e.plugins??[];if(n===void 0&&t===void 0)return[...r];return[{name:"jx-bundle-hooks",setup:(o)=>{if(n!==void 0)o.onResolve({filter:n.filter},(i)=>n.resolve(i));if(t!==void 0)o.onLoad({filter:/.*/},(i)=>{t(i.path)})}},...r]}function pI(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],plugins:[dI],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function hI(e){return e.minify??e.target==="browser"}function gI(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...mI};return t}function _m(e){return{...gI(e),external:e.external??[],minify:hI(e),plugins:fI(e),target:e.target}}async function Pw(e,t){let n={path:e.entryPath};if(e.contents!==void 0)n.contents=e.contents;let r=await Em({entry:n,..._m(t)});vw(e.outfile,r,"utf8")}async function _w(e,t,n){return $w({entries:e,outdir:t,..._m(n)})}function km(e){return e==="<stdin>"||lI(e).startsWith(ww)}async function kw(e,t,n){let r=[],s=cI(aI(),`jx-resolve-${process.pid}.js`);try{await No(`export * from ${JSON.stringify(e)};
|
|
121
|
+
`,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{oI(s,{force:!0})}return r.find((o)=>!km(o))}async function No(e,{resolveDir:t,outfile:n},r){let s=await Em({entry:{resolveDir:t,source:e},..._m(r)});vw(n,s,"utf8")}async function Ow(e,{projectRoot:t,outfile:n,adapter:r,plugins:s}){let o=pI(r);if(s!==void 0)o.plugins=[...o.plugins??[],...s];await No(e,{outfile:n,resolveDir:t},o)}var jm,dI,mI;var Om=J(()=>{An();Sw();jm=["@vue/reactivity","lit-html"];dI={name:"jx-bare-node-builtins",setup(e){let t=iI.filter((r)=>!r.startsWith("_")&&!r.includes(":")),n=new RegExp(`^(${t.map((r)=>r.replaceAll("/",String.raw`\/`)).join("|")})$`);e.onResolve({filter:n},(r)=>({external:!0,path:`node:${r.path}`}))}};mI={"process.env.NODE_ENV":'"production"'}});function yI(e,t){let n=e.slice(0,t),r=n.split(`
|
|
121
122
|
`).length;return{column:t-n.lastIndexOf(`
|
|
122
|
-
`),line:r}}function
|
|
123
|
+
`),line:r}}function Cm(e,t,n,r){return{...yI(e,t),kind:n,message:r,offset:t}}function xI(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function Nw(e){for(let t of[e,`return async function () {
|
|
123
124
|
${e}
|
|
124
|
-
}`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function
|
|
125
|
+
}`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function Tw(e){Rm=e,Au=null}function $I(e,t){if(!Au){if(!Rm)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");Au=Rm()}return Au(e,t)}function Jw(e,t,n){return $I(e,(r)=>{let s=xI(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(Cm(e,s,"unsupported",`\`${o}\` is TypeScript that has to be compiled rather than erased. ${t} may use only types that can be removed: no enum, value namespace or parameter property`))})}function SI(e){return po(e).includes("<")||!Nw(e)}function wI(e){let t=Am.get(e);if(t)return t;if(!SI(e)){let i={code:e,problems:[]};return Am.set(e,i),i}let n=[],r=Jw(e,"A function body",n),s=po(r);for(let i of s.matchAll(bI)){let a=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(Cm(e,a,"unsupported",`A function body cannot ${i[3]??"import"}. Move code that needs a module into one of its own, named by $src`))}if(r!==e&&n.length===0&&Nw(e)){let i=[...e].findIndex((a,l)=>a!==r[l]);n.push(Cm(e,Math.max(i,0),"meaning","This was already JavaScript, and reading it as TypeScript changes it: `a < b > (c)` is a generic call in TypeScript and two comparisons in JavaScript. Add parentheses if a comparison is meant"))}let o={code:r,problems:n};return Am.set(e,o),o}function Mw(e){let t=Aw.get(e);if(t)return t;let n=[],s={code:Jw(e,"A script",n),problems:n};return Aw.set(e,s),s}function vI(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function Cw(e,t,n){if(k(e))return Rw(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>k(r)))return Rw(e.join(`
|
|
125
126
|
`),t,n).split(`
|
|
126
|
-
`);return e}function
|
|
127
|
-
${e.text}`}function a1(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,c])=>`${a}: ${c}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function c1(e){let t=Object.keys(e).filter((r)=>za(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function l1(e){let n=Hp(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function fi(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(S)=>S,transposeSelector:o=(S)=>S,resolveValue:i}=t,a=[],c=(S)=>S!==null&&typeof S==="object"&&!Array.isArray(S)&&!Ce(S),l=(S,E)=>{if(c(E))return[E];if(!Ua(S)||!Array.isArray(E)||E.length===0)return[];return E.every((v)=>c(v))?E:[]},u=(S,E,v,j)=>{if(E===void 0||E===null)return null;if(Ce(E))return v?i?.(S,E,j)??null:null;if(I(E))return null;let P=String(E);if(me(P))return v?i?.(S,P,j)??null:null;return s(P)},d=(S,E,v=!0,j="self")=>{let P=[];for(let[O,T]of Object.entries(S)){if(l(O,T).length>0)continue;if(E&&(O.startsWith("@")||bs(O)))continue;if(O.startsWith("$"))continue;let U=u(O,T,v,j);if(U!==null)P.push([Bp(O),U])}return P},p=(S)=>k(S)&&S!==""?{description:S}:{},m=(S,E,v,j,P)=>{if(v.length===0)return;let O=E;if(O!==null){let F=o(O);if(F===null)return;O=F}let T=HS(S,O,v),U={text:T,conditions:[...S],selector:O,declarations:v,target:j,key:ru(T)};a.push({...U,...p(P)})},x=(S,E,v)=>{let j=S.slice(10).trim();if(j==="")return;let P=[];for(let[T,U]of Object.entries(E)){if(!c(U))continue;let F=d(U,!0,!1,"unscoped");if(F.length>0)P.push({declarations:F,selector:T.trim()})}if(P.length===0)return;let O=a1(v,j,P);a.push({blocks:P,conditions:[...v],declarations:[],key:ru(O),selector:null,target:"unscoped",text:O,...p(E.$description)})},g=(S,E,v,j,P)=>{if(S==="@--")return;if(Ua(S)){m([...j,S],null,d(E,!1,!0,"unscoped"),"unscoped",E.$description);return}if(za(S)){x(S,E,j);return}let O=qS(S,r),T=O===null?S:`@media ${O}`,U=O===null?null:Xn(O);if(U!==null&&v!==null){let{auto:F,forced:H}=Up(v,U);y(E,F,[...j,T],P),y(c1(E),H,j,P);return}y(E,v,[...j,T],P)};function y(S,E,v,j){m(v,E,d(S,!0,!0,j),j,S.$description);for(let[P,O]of Object.entries(S))for(let T of l(P,O))if(P.startsWith("@"))g(P,T,E,v,j);else if(E!==null)y(T,WS(E,P),v,l1(P)?j:"descendant")}return y(e,n,[],"self"),a}var s1,Gn="data-color-scheme",ou="jx-color-scheme";var Ga=R(()=>{le();s1=new Set(["all","print","screen","speech"])});function zS(){return`the Intl helpers ${Kp.join(", ")}`}var gr="en-US",zp="UTC",US,Kp,BS;var Gp=R(()=>{US=[{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."}],Kp=US.map((e)=>e.path),BS=Object.fromEntries(US.map((e)=>[e.path,e.params.indexOf("locale")]))});function u1(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function qt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function yr(e){if(e==="")return[];return e.split("/").map((t)=>u1(t))}function Dt(e,t){let n=e;for(let r of yr(t))n=n?.[r];return n}function Re(e,t){let n=e;for(let r of yr(t))n+=Xp.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function KS(e,t){let n=e;for(let[r,s]of yr(t).entries()){let o=r===0?"":"?.";n+=Xp.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function Xr(e){return Xp.test(e)?e:JSON.stringify(e)}function GS(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Xp;var di=R(()=>{Xp=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Yp(e){let t=e.$map;return I(t)?t:void 0}function cu(e){return I(e)&&!Array.isArray(e)&&"operator"in e}function pi(e){return I(e)&&!Array.isArray(e)&&"$ref"in e}function m1(e,t,n){let r=BS[e];if(r===void 0||r<0||t[r]!=null)return t;let s=Dt(n.$page,"locale");if(!k(s)||s==="")return t;let o=[...t];return o[r]=s,o}function nw(){return globalThis.window??globalThis}function rw(e){return e.startsWith("window#/")&&d1.has(e.slice(8))}function xr(e){return QS.has(e)}function iu(e){if(Array.isArray(e))return e.some((t)=>iu(t));if(e===void 0||!cu(e))return!1;return xr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>iu(t))||Object.values(e.cases??{}).some((t)=>iu(t))}function ko(e){return Dr(e)&&!iu(e.$expression)}function Zp(e,t){if(Array.isArray(e)){for(let n of e)Zp(n,t);return}if(e===void 0||!I(e))return;if(pi(e)){if(!h1.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(yr(n)[0]??"")}return}if(cu(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Zp(r,t)}}function sm(e){let t=new Set;return Zp(e.$expression,t),[...t]}function om(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&ko(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(sm(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function Ze(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>g1)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Ke(e,t,n,r,s){if(e===null||e===void 0)return e;if(cu(e))return wn(e,t,n,r,s);if(pi(e)){let o=au(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return sw(e,t,n,r,s);return s?.report(s.path??[],e),e}function sw(e,t,n,r,s){return e.map((o,i)=>Ke(o,t,n,r,Ze(s,i)))}function y1(e,t,n,r){let s=(o)=>{if(!e.slice(o.length).includes("/"))return t;return au(e.slice(0,e.lastIndexOf("/")),t,n,r)};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?au(e.slice(0,e.lastIndexOf("/")),t,n,r):void 0;return}function au(e,t,n,r){if(e==="$reduce/acc")return r?.acc;if(e.startsWith("$reduce/"))return r?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),o=r?.args?.[s[0]];return s.length>1?Dt(o,s.slice(1).join("/")):o}if(e.startsWith("event#/")){let s=e.slice(7);return Dt(n,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,a=Yp(t);if(o==="item")i=r?.item??a?.item??t["$map/item"];else if(o==="index")i=r?.index??a?.index??t["$map/index"];else i=a?.[o]??t[`$map/${o}`];return s.length>2?Dt(i,s.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Dt(t,e.slice(8));if(e.startsWith("parent#/"))return Dt(t,e.slice(8));if(e.startsWith("window#/"))return Dt(nw(),e.slice(8));if(e.startsWith("document#/"))return Dt(globalThis.document,e.slice(10));return Dt(t,e)??null}function x1(e,t,n,r){if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,a=Yp(t);if(o==="item")i=r?.item??a?.item??t["$map/item"];else if(o==="index")i=r?.index??a?.index??t["$map/index"];else i=a?.[o]??t[`$map/${o}`];if(s.length>2){let c=s.slice(2),l=c.pop(),u=c.length>0?Dt(i,c.join("/")):i;return{key:l,obj:u}}return{key:o==="item"?"$map/item":"$map/index",obj:Yp(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let i=yr(s),a=i.pop(),c=t;for(let l of i)c=c[l];return{key:a,obj:c}}return{key:e,obj:t}}function wn(e,t,n,r,s){let o=b1(e,t,n,r,s);return s?.report(s.path??[],o),o}function YS(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function b1(e,t,n,r,s){let{operator:o,target:i,value:a,initial:c}=e;if(!f1.has(o))throw Error(`$expression: unknown operator "${o}"`);if(Qp.has(o)&&!("value"in e)){let l=Ke(i,t,n,r,Ze(s,"target"));if(o==="!")return!l;if(o==="-")return-l}if(o==="call"){let l=pi(i)?i.$ref:void 0;if(!k(l))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>XS)throw Error(`$expression: call depth exceeded (${XS})`);let d=Array.isArray(a)?a.map((m,x)=>Ke(m,t,n,r,Ze(s,["value",x]))):[];if(l.startsWith("window#/")){if(!rw(l))throw Error(`$expression: "${l}" is not a blessed pure global`);let m=l.slice(8),x=p1.get(m);if(x)return x(...m1(m,d,t));let g=nw(),y=Dt(g,m),S=m.lastIndexOf("/"),E=S===-1?g:Dt(g,m.slice(0,S));return y.apply(E,d)}let p=au(l,t,n,r);if(_t(p))return p.apply(y1(l,t,n,r),d);if(I(p)&&"$expression"in p){let m=p,x={};for(let[g,y]of(m.parameters??[]).entries()){let S=k(y)?y:y?.name??"";if(!S)continue;x[S]=d[g]===void 0&&I(y)&&"default"in y?y.default:d[g]}return wn(m.$expression,t,n,{args:x,callDepth:u})}throw TypeError(`$expression: call target "${l}" is not callable`)}if(nm.has(o)){if(o==="?:"){let m=Ke(i,t,n,r,Ze(s,"target"));if(s){let x=Ke(a,t,n,r,Ze(s,"value")),g=Ke(c,t,n,r,Ze(s,"initial"));return m?x:g}return m?Ke(a,t,n,r):Ke(c,t,n,r)}let l=Ke(i,t,n,r,Ze(s,"target")),u=String(l),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[g,y]of Object.entries(d)){let S=Ke(y,t,n,r,Ze(s,["cases",g]));if(g===u)m=S}let x=Ke(e.default,t,n,r,Ze(s,"default"));return p?m:x}return p?Ke(d[u],t,n,r):Ke(e.default,t,n,r)}if(em.has(o)){let l=Ke(i,t,n,r,Ze(s,"target")),u=Ke(a,t,n,r,Ze(s,"value"));switch(o){case"===":return l===u;case"!==":return l!==u;case"&&":return l&&u;case"||":return l||u;case"??":return l??u;default:return YS(o,l,u)}}if(ew.has(o)){let l=Ke(a,t,n,r,Ze(s,"value")),{obj:u,key:d}=x1(i.$ref,t,n,r);u[d]=o==="="?l:YS(o.slice(0,-1),u[d],l);return}if(tw.has(o)){let l=Ke(i,t,n,r,Ze(s,"target"));switch(o){case"push":return l.push(Ke(a,t,n,r,Ze(s,"value")));case"unshift":return l.unshift(Ke(a,t,n,r,Ze(s,"value")));case"pop":return l.pop();case"shift":return l.shift();case"splice":{let u=Ke(a,t,n,r,Ze(s,"value"));return l.splice(...u)}default:break}}if(rm.has(o)){let l=Ke(i,t,n,r,Ze(s,"target")),u=a===void 0?[]:Array.isArray(a)?sw(a,t,n,r,Ze(s,"value")):[Ke(a,t,n,r,Ze(s,"value"))],d=Dt(l,o);if(!_t(d))return;return d.apply(l,u)}if(tm.has(o)){let l=Ke(i,t,n,r,Ze(s,"target")),u=a;if(o==="reduce"){let d=Ke(c,t,n,r,Ze(s,"initial"));for(let[p,m]of l.entries())d=wn(u,t,n,{acc:d,index:p,item:m},p===0?Ze(s,"value"):void 0);return d}if(o==="map")return l.map((d,p)=>wn(u,t,n,{...r,index:p,item:d},p===0?Ze(s,"value"):void 0));if(o==="filter")return l.filter((d,p)=>wn(u,t,n,{...r,index:p,item:d},p===0?Ze(s,"value"):void 0))}return}function st(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(cu(e))return Xt(e,t);if(pi(e))return im(e.$ref,t);if(Array.isArray(e))return e.map((n)=>st(n,t)).join(", ");return JSON.stringify(e)}function $1(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function im(e,t){let n=t.statePrefix??"state",r=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Re("_args",e.slice(6));if(e.startsWith("event#/"))return Re(r,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s;if(o==="item")return s.length>2?Re("_item",s.slice(2).join("/")):"_item";if(o==="index")return"_index";return`_${o}`}if(e.startsWith("#/state/"))return Re(n,e.slice(8));if(e.startsWith("parent#/"))return Re(n,e.slice(8));if(e.startsWith("window#/"))return Re("window",e.slice(8));if(e.startsWith("document#/"))return Re("document",e.slice(10));return Re(n,e)}function ZS(e,t){if(pi(e))return im(e.$ref,t);return st(e,t)}function S1(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(gr)})`,o=JSON.stringify(zp);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function Xt(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(Qp.has(n)&&!("value"in e)){let i=st(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(pi(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((c)=>st(c,t)):[];if(i.startsWith("window#/")){if(!rw(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let c=S1(i.slice(8),a,t);if(c)return c;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let c=i.slice(8),l=t.formulaParams?.[c];if(l){let u=l.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${$1(c)}(${t.statePrefix??"state"}, { ${u} })`}}return`${im(i,t)}(${a.join(", ")})`}if(nm.has(n)){if(n==="?:"){let l=st(r,t),u=st(s,t),d=st(o,t);return`(${l} ? ${u} : ${d})`}let i=st(r,t),a=Object.entries(e.cases??{}).map(([l,u])=>`_d === ${JSON.stringify(l)} ? ${st(u,t)} : `).join(""),c="default"in e?st(e.default,t):"undefined";return`((_d) => ${a}${c})(String(${i}))`}if(em.has(n)){let i=st(r,t),a=st(s,t);return`(${i} ${n} ${a})`}if(ew.has(n)){let i=ZS(r,t),a=st(s,t);return`${i} ${n} ${a}`}if(tw.has(n)){let i=ZS(r,t);switch(n){case"push":return`${i}.push(${st(s,t)})`;case"unshift":return`${i}.unshift(${st(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((c)=>st(c,t)).join(", "):st(s,t);return`${i}.splice(${a})`}default:break}}if(rm.has(n)){let i=st(r,t),a=s===void 0?"":Array.isArray(s)?s.map((c)=>st(c,t)).join(", "):st(s,t);return`(${i})?.${n}?.(${a})`}if(tm.has(n)){let i=st(r,t),a=Xt(s,t);if(n==="reduce"){let c=st(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${c})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function mi(e,t,n,r){return Ke(e,t,n,r)}function Yr(e,t={}){return st(e,t)}var QS,Qp,em,ew,tw,tm,nm,rm,f1,d1,p1,h1,XS=64,g1=64;var hi=R(()=>{Gp();le();di();QS=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Qp=new Set(["!","-"]),em=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),ew=new Set(["=","+=","-=","*=","/="]),tw=new Set(["push","pop","shift","unshift","splice"]),tm=new Set(["reduce","map","filter"]),nm=new Set(["?:","switch"]),rm=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"]),f1=new Set([...QS,...Qp,...em,...tm,...nm,...rm,"call"]),d1=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",...Kp]),p1=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??gr,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??gr,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??gr,{timeZone:zp,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??gr,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??gr,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??gr,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??gr,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??gr,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);h1=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function ow(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 w1(e){return(I(e)||_t(e))&&"then"in e&&_t(e.then)}async function gi(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=ow(o);switch(i.kind){case"expression":{let a=wn(i.node,t,n,s);if(w1(a))await a;break}case"if":{let a=i.node,c=mi(a.if,t,n,s)?a.then:a.else;if(Array.isArray(c))await gi(c,t,n,r);break}case"switch":{let a=i.node,c=String(mi(a.$switch,t,n,s)),l=a.cases??{},u=Object.hasOwn(l,c)?l[c]:a.default;if(Array.isArray(u))await gi(u,t,n,r);break}case"dispatch":{let a=i.node,c=_t(r.target)?r.target():r.target,l=n?.currentTarget??c;if(!l)break;let u={};if("detail"in a)u.detail=mi(a.detail,t,n,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;l.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function Tn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=ow(s);switch(o.kind){case"expression":{r.push(`${n}${Xt(o.node,t)};`);break}case"if":{let i=o.node,a=Yr(i.if,t),c={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,Tn(i.then??[],c)),i.else)r.push(`${n}} else {`,Tn(i.else,c));r.push(`${n}}`);break}case"switch":{let i=o.node,a=Yr(i.$switch,t),c={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[l,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(l)}: {`,Tn(u,c),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,Tn(i.default,c),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",c=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,l=[];if("detail"in i)l.push(`detail: ${Yr(i.detail,t)}`);if(i.bubbles!==void 0)l.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)l.push(`composed: ${JSON.stringify(i.composed)}`);let u=l.length>0?`, { ${l.join(", ")} }`:"";r.push(`${n}${c}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
|
|
128
|
-
`)}var lu=R(()=>{le();hi()});var am=R(()=>{le()});function yi(e){if(e===v1)return"client";if(e===E1)return"server";return null}function j1(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function aw(e,t){return`${um}${j1(e)}#${t}`}function uu(e){return e.startsWith(um)}function xi(e){if(!uu(e))return null;let t=e.slice(um.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function cm(e,t){if(Array.isArray(e)){let r=e.map((s)=>cm(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!L(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&k(s)){let i=yi(s);o=i===null?s:aw(t,i)}else if(r!=="$script")o=cm(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function Xa(e,t){return cm(e,t)}function k1(e){return P1.test(e)&&!_1.test(e)}function iw(e){return yi(e)==="client"||xi(e)?.side==="client"}function lm(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())lm(s,[...t,r],n);return n}if(!L(e))return n;if(k(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")lm(s,[...t,r],n);return n}function O1(e){let t=e.at(-1);return k(t)?`"${t}"`:"this entry"}function cw(e){let t=lm(e,[],[]),n=t.some((s)=>!s.lazy&&iw(s.src)),r=[];for(let s of t){let o=O1(s.path);if(!s.lazy&&k1(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&iw(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var um="jx-script:",v1="#client",E1="#server",P1,_1;var bi=R(()=>{le();P1=/^\.{1,2}\//u,_1=/\.json$/iu});function N1(e){for(let t of Object.keys(e))if(R1.has(t))return!0;return!1}function $i(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Vx(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function uw(){return[...lw].toSorted()}function Ss(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||lw.has(n))return String(t);return t?"":null}function fw(e,t,n,r){let s=t.replaceAll(/-([a-z])/g,(i,a)=>a.toUpperCase());if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(bt(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?We(o)?0:"":i;return}e[s]=We(o)?Number(n):n}function fm(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(k(r)&&me(r)){t.set(n,void 0);continue}if(I(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(T1.some((s)=>(s in r))){t.set(n,void 0);continue}if(N1(r))continue}t.set(n,r)}return t}var R1,$s,lw,mG,T1,dm=32,fu,du="jx-slot",Ya="data-jx-slots",pm="jx.slot.group",hG;var Si=R(()=>{Ga();hi();di();le();Ha();$n();lu();am();bi();am();Ga();R1=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);$s=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),lw=new Set(["contenteditable","draggable","spellcheck"]);mG=Object.freeze({emptyRow:!0});T1=["$expression","$prototype","$ref","$src"],fu=/^[\t\n\f\r ]+$/u,hG=(()=>{let e=Symbol.for(pm),t=globalThis;return t[e]??=new WeakMap,t[e]})()});var mm,hm;var gm=R(()=>{mm={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."},hm={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var ym;var xm=R(()=>{ym={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 bm,$m,Sm;var wm=R(()=>{bm={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},$m={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},Sm={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var vm;var Em=R(()=>{vm={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 jm,Pm;var _m=R(()=>{jm={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"},Pm={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 Za;var km=R(()=>{Za={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',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:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",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" encodes variants 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 Om;var Am=R(()=>{Om={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Cm,Rm,Nm,Tm,Jm,Im,Dm,Mm,Fm;var Lm=R(()=>{Cm={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Rm={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Nm={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Tm={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Jm={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Im={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"},Dm={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Mm={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"},Fm={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Qa;var Vm=R(()=>{Qa={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 qm,Wm;var Hm=R(()=>{qm={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"},Wm={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 Um,Bm,zm,Km,Gm,pu;var Xm=R(()=>{Um={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Bm={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"},zm={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Km={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"},Gm={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"},pu={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 Ym;var Zm=R(()=>{Ym={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 Qm;var eh=R(()=>{Qm={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},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: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; 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 → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{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 th,nh;var rh=R(()=>{th={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"}]},nh={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 sh,oh;var ih=R(()=>{sh=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],oh={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 ah;var ch=R(()=>{ah={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 lh,uh,fh,dh,ph,mh,hh,gh,yh,xh,bh,$h,Sh,wh,vh,Eh,jh;var Ph=R(()=>{Gp();lh={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"},uh={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."},fh={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."},dh={enum:["!","-"]},ph={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},mh={const:"?:"},hh={const:"switch"},gh={const:"call"},yh={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"]},xh={enum:["=","+=","-=","*=","/="]},bh={enum:["pop","shift"]},$h={enum:["push","unshift"]},Sh={const:"splice"},wh={const:"reduce"},vh={enum:["map","filter"]},Eh={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 "+`${zS()}) — 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"},jh={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 _h,kh,Oh,Ah;var Ch=R(()=>{_h={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"}]},kh={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Oh={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Ah={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 dw,mu,hu,gu,yu,xu,bu,$u,Su,wu,Rh;var Nh=R(()=>{dw=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],mu={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"},hu={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"},gu={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",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"},yu={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:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",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:dw,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"},xu={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"},bu={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"},$u={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"},Su={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"},wu={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"},Rh={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 pw,vu;var Th=R(()=>{Po();pw=[301,302,303,307,308],vu={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:nu,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:nu,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:nu,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:[...pw],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"}});var Jh;var Ih=R(()=>{Jh={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 ec="https://jxsuite.com/schema/project/fields/v2",Oo="https://jxsuite.com/schema/document/paths/v2",Dh,Mh,tc,Fh;var nc=R(()=>{Dh={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"},Mh={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"},tc=[{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"}],Fh={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"}});var mw=R(()=>{gm();xm();wm();Em();_m();km();Am();Lm();Vm();Hm();Xm();Zm();eh();rh();ih();ch();Ph();Ch();Nh();Th();Ih();nc()});function hw(e,t,n){let r=e.$description;if(k(r))(Object.keys(t).length>0?t:n).$description=r}function gw(e,t,n,r,s=J1,o={}){let i=[],a=(p,m)=>{let x={mediaQueries:t,scope:m,transposeValue:n};if(r)x.resolveValue=(g,y)=>r(g,y,m);for(let g of fi(p,x))i.push(o.comments===!0?Ka(g):g.text)},c={},l={},u=[],d=[];for(let[p,m]of Object.entries(e)){if(I(m)&&!Array.isArray(m)){if(p.startsWith("@"))u.push([p,m]);else if(!p.startsWith("--"))d.push([p,m]);continue}if(bs(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")c[p]=m;else l[p]=m}hw(e,c,l),a(c,s.root),a(l,s.body);for(let[p,m]of d)if(p.startsWith("&"))a({[p]:m},s.root);else a(m,p);for(let[p,m]of u){if(Ua(p)||za(p)){a({[p]:m},null);continue}let x={},g={},y=[];for(let[S,E]of Object.entries(m)){if(I(E)&&!Array.isArray(E)){if(!S.startsWith("@"))y.push([S,E]);continue}if(S.startsWith("$"))continue;if(S.startsWith("--"))x[S]=E;else g[S]=E}hw(m,x,g),a({[p]:x},s.root),a({[p]:g},s.body);for(let[S,E]of y)a({[p]:E},S)}if(Object.values(t).some((p)=>Xn(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(`
|
|
129
|
-
`)}var
|
|
130
|
-
`)}function
|
|
131
|
-
`)}function
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
`);return e}function Rw(e,t,n){let{code:r,problems:s}=wI(e),[o,...i]=s.filter((a)=>a.kind==="unsupported");if(o)throw new Cu(t,[o,...i]);for(let a of s)n.push({...t,problem:a});return r}function Nm(e,t,n){if(Array.isArray(e))return e.map((i,a)=>Nm(i,{...t,pointer:`${t.pointer}/${a}`},n));if(!L(e))return e;let r=gp(e),s=[],o={set:(i,a)=>{s.push([i,a])}};for(let[i,a]of Object.entries(e)){let l={...t,pointer:`${t.pointer}/${vI(i)}`};if(r&&i==="body")o.set(i,Cw(a,l,n));else if(r&&(i==="getter"||i==="setter")&&L(a)){let c={...a};if(a.body!==void 0)c.body=Cw(a.body,{...l,pointer:`${l.pointer}/body`},n);o.set(i,c)}else o.set(i,Nm(a,l,n))}return Object.fromEntries(s)}function il(e,t,n=[]){return Nm(e,{path:t,pointer:""},n)}function Iw(e,t,n=[]){return il(e,t,n)}var bI,Am,Au=null,Rm=null,Aw,Cu;var Tm=J(()=>{ce();bI=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;Am=new Map;Aw=new Map;Cu=class Cu extends Error{problems;site;constructor(e,t){let[n]=t;super(`${e.path}${e.pointer}: ${n.message} (line ${n.line}, column ${n.column})`);this.name="EraseError",this.problems=t,this.site=e}}});import{createRequire as EI}from"node:module";var Ru=J(()=>{Tm();Tm();Tw(()=>EI(import.meta.url)("ts-blank-space").default)});function Lw(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!Dw.has(s))Dw.add(s),console.warn(`Warning: ${s}`)}}function Ar(e,t){let n=[],r=il(e,t,n);return Lw(n),r}function Fw(e,t){let n=[],r=Iw(e,t,n);return Lw(n),r}var Dw;var Ei=J(()=>{Ru();Dw=new Set});function PI(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Vw(e){let t=PI(e),n=t.slice(t.lastIndexOf("/")+1),r=n.lastIndexOf(".");if(r>0)t=t.slice(0,t.length-(n.length-r));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],o=!1,i=!1,a=t.replaceAll(jI,(l,c,u)=>{if(o=!0,c)return i=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:i,isDynamic:o,params:s,urlPattern:a}}function qw(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 jI;var Hw=J(()=>{jI=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function kI(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Ww(e){if(!L(e)||!("paginate"in e))return null;let{each:t,pageSize:n,paginate:r}=e,s=L(r)?r.$ref:void 0,o=k(s)?_I.exec(s)?.[1]:void 0;if(o===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Ie(n)||!Number.isInteger(n)||n<1)throw TypeError("$paths.pageSize must be a positive integer");let i={key:kI(o),pageSize:n};if(t!==void 0){if(!L(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(L(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");i.each=t}return i}function Jm(e,t){return Math.max(1,Math.ceil(e/t))}function Bw(e,t,n){let r=(t-1)*n;return e.slice(r,r+n)}function To(e,t){if(e.endsWith("*")){if(t===1){let n=e.slice(0,-1).replace(/\/$/,"");return n===""?"/":n}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function Uw(e,t,n,r){let s=Jm(r,n),o=[];for(let i=1;i<=s;i++)o.push({current:i===t,number:i,url:To(e,i)});return{first:To(e,1),itemCount:r,last:To(e,s),next:t<s?To(e,t+1):null,number:t,pageCount:s,pageSize:n,pages:o,prev:t>1?To(e,t-1):null}}var _I;var zw=J(()=>{ce();_I=/^#\/state\/([^/]+)$/});function Bn(e){if(!k(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function al(e){let t=Bn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&OI.has(r)?"rtl":"ltr"}function Kw(e){let t=Bn(e);if(t===null)return k(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Mm(e){let t=e.i18n,n=[];if(!D(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of r){let l=Bn(a);if(l===null){n.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let o=Bn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Bn(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!s.includes(o))s.unshift(o);let i=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:AI;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function cr(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=Bn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var OI,Nu="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",AI="prefix-except-default";var Jo=J(()=>{ce();OI=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 hn(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Xw(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return CI.has(n.toLowerCase())?n:e.slice(1)}return null}function ll(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function cl(e){return e.startsWith("@keyframes")}function Yw(e,t){let n=[];for(let r of ji(e))for(let s of ji(t))n.push(Im(r,s));return n.join(", ")}function Im(e,t){let n=NI(e,t);if(n!==null)return n;let r=rv(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Zw(e,t){let n=0,r=null;for(let s=t;s<e.length;s+=1){let o=e[s];if(o==="\\")s+=1;else if(r)r=o===r?null:r;else if(o==='"'||o==="'")r=o;else if(o==="(")n+=1;else if(o===")"){if(n-=1,n===0)return s+1}}return-1}function Qw(e){if(e.endsWith(":host"))return{inner:"",prefix:e.slice(0,-5)};let t=e.lastIndexOf(":host(");if(t===-1||Zw(e,t+5)!==e.length)return null;return{inner:e.slice(t+6,-1),prefix:e.slice(0,t)}}function ev(e){if(!e.startsWith(":host"))return null;let t=e.slice(5);if(t.startsWith("(")){let n=Zw(t,0);return n===-1?null:{inner:t.slice(1,n-1),rest:t.slice(n)}}return/^[\w-]/u.test(t)?null:{inner:null,rest:t}}function tv(e){let t=0,n=null;for(let r=0;r<e.length;r+=1){let s=e[r];if(s==="\\")r+=1;else if(n)n=s===n?null:n;else if(s==='"'||s==="'")n=s;else if(s==="("||s==="[")t+=1;else if(s===")"||s==="]")t-=1;else if(t===0){if(/[\s>+~]/u.test(s)||e.startsWith("::",r))return r;if(s===":"&&RI.test(e.slice(r)))return r}}return e.length}function NI(e,t){let n=Qw(e);if(n===null||!Fm(t))return null;let r=Ju(t);if(r.length>1||r.length===1&&r[0]!==0)return null;let s=r.length===1?t.slice(1):t,o=tv(s);if(o===0)return`${e}${s}`;return`${n.prefix}:host(${n.inner}${s.slice(0,o)})${s.slice(o)}`}function JI(e,t,n){let r=ev(e);if(r===null)return n==="shadow"&&TI.test(e)?e:Im(t,e);let{inner:s,rest:o}=r;if(n==="light")return`${t}${s??""}${o}`;let a=`${Qw(t)?.prefix??""}:host${s===null?"":`(${s})`}`;if(o==="")return a;return/^[\s>+~]/u.test(o)?`${a}${o}`:Im(a,o)}function nv(e,t,n){let r=[];for(let s of ji(t))for(let o of ji(e))r.push(JI(o,s,n));return r.join(", ")}function MI(e){return ji(e).every((t)=>{let n=ev(t);if(n===null)return Fm(t);let r=tv(n.rest);return n.rest.slice(r).replace(/^::?[\w-]+(?:\([^)]*\))?/u,"")===""})}function Ju(e){let t=[],n=null,r=0;for(let s=0;s<e.length;s+=1){let o=e[s];if(n){if(o==="\\")s+=1;else if(o===n)n=null;continue}if(o==="\\")s+=1;else if(o==='"'||o==="'")n=o;else if(o==="[")r+=1;else if(o==="]")r=Math.max(0,r-1);else if(o==="&"&&r===0)t.push(s)}return t}function rv(e,t){return Ju(e).length>0?II(e,t):null}function II(e,t){let n="",r=0;for(let s of Ju(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function ji(e){let t=[],n=0,r=null,s=0;for(let i=0;i<e.length;i+=1){let a=e[i];if(r){if(a==="\\")i+=1;else if(a===r)r=null;continue}if(a==='"'||a==="'")r=a;else if(a==="("||a==="[")n+=1;else if(a===")"||a==="]")n=Math.max(0,n-1);else if(a===","&&n===0)t.push(e.slice(s,i)),s=i+1}t.push(e.slice(s));let o=t.flatMap((i)=>{let a=i.trim();return a===""?[]:[a]});return o.length>0?o:[e]}function fr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Dm(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${ur}]))`,forced:`${e}:where([${ur}="${t}"])`};return{auto:`:where(:root:not([${ur}])) ${e}`,forced:`:where(:root[${ur}="${t}"]) ${e}`}}function ul(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Lm(e){return e.startsWith("--")?e:hn(e)}function Tu(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function sv(e,t,n){let r=n.map(([o,i])=>`${o}: ${i}`).join("; "),s=t===null?r:`${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function fl(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
|
|
128
|
+
${e.text}`}function DI(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function LI(e){let t=Object.keys(e).filter((r)=>cl(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function Fm(e){let n=Ju(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function Pi(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(w)=>w,transposeSelector:o=(w)=>w,resolveValue:i,host:a,shadowTree:l=!1}=t,c=[],u=(w)=>w!==null&&typeof w==="object"&&!Array.isArray(w)&&!me(w),d=(w,E)=>{if(u(E))return[E];if(!ll(w)||!Array.isArray(E)||E.length===0)return[];return E.every((j)=>u(j))?E:[]},p=(w,E,j,A)=>{if(E===void 0||E===null)return null;if(me(E))return j?i?.(w,E,A)??null:null;if(D(E))return null;let T=String(E);if(le(T))return j?i?.(w,T,A)??null:null;return s(T)},m=(w,E,j=!0,A="self")=>{let T=[];for(let[I,V]of Object.entries(w)){if(d(I,V).length>0)continue;if(E&&(I.startsWith("@")||ul(I)))continue;if(I.startsWith("$"))continue;let H=p(I,V,j,A);if(H!==null)T.push([Lm(I),H])}return T},y=(w)=>k(w)&&w!==""?{description:w}:{},S=(w,E,j,A,T)=>{if(j.length===0)return;let I=E;if(I!==null){let O=o(I);if(O===null)return;I=O}let V=sv(w,I,j),H={text:V,conditions:[...w],selector:I,declarations:j,target:A,key:Tu(V)};c.push({...H,...y(T)})},g=(w,E,j)=>{let A=w.slice(10).trim();if(A==="")return;let T=[];for(let[V,H]of Object.entries(E)){if(!u(H))continue;let O=m(H,!0,!1,"unscoped");if(O.length>0)T.push({declarations:O,selector:V.trim()})}if(T.length===0)return;let I=DI(j,A,T);c.push({blocks:T,conditions:[...j],declarations:[],key:Tu(I),selector:null,target:"unscoped",text:I,...y(E.$description)})},x=(w,E,j,A,T,I)=>{if(w==="@--")return;if(ll(w)){S([...A,w],null,m(E,!1,!0,"unscoped"),"unscoped",E.$description);return}if(cl(w)){g(w,E,A);return}let V=Xw(w,r),H=V===null?w:`@media ${V}`,O=V===null?null:fr(V);if(O!==null&&j!==null&&!l){let{auto:N,forced:G}=Dm(j,O);P(E,N,[...A,H],T,I),P(LI(E),G,A,T,I);return}P(E,j,[...A,H],T,I)};function P(w,E,j,A,T){S(j,E,m(w,!0,!0,A),A,w.$description);for(let[I,V]of Object.entries(w))for(let H of d(I,V))if(I.startsWith("@"))x(I,H,E,j,A,T);else if(E!==null&&T&&a!==void 0)P(H,nv(I,E,a),j,MI(I)?A:"descendant",!1);else if(E!==null)P(H,Yw(E,I),j,Fm(I)?A:"descendant",!1)}return P(e,n,[],"self",!0),c}function Gw(e){return e===!1||e==="open"||e==="closed"}function Rn(e,t){let n=e?.$shadow;if(Gw(n))return n===!1?null:n;let r=t?.shadow;return Gw(r)&&r!==!1?r:null}var CI,RI,TI,ur="data-color-scheme",Mu="jx-color-scheme";var dl=J(()=>{ce();CI=new Set(["all","print","screen","speech"]);RI=/^:(?:before|after|first-line|first-letter)(?![\w-])/u;TI=/^::(?:slotted|part)\(/u});function av(){return`the Intl helpers ${qm.join(", ")}`}var Cr="en-US",Vm="UTC",ov,qm,iv;var Hm=J(()=>{ov=[{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."}],qm=ov.map((e)=>e.path),iv=Object.fromEntries(ov.map((e)=>[e.path,e.params.indexOf("locale")]))});function FI(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Wt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function sn(e){return e.startsWith("#/$map/")?e.slice(2):e}function Un(e){if(e==="")return[];return e.split("/").map((t)=>FI(t))}function Bt(e,t){let n=e;for(let r of Un(t))n=n?.[r];return n}function Re(e,t){let n=e;for(let r of Un(t))n+=Wm.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function lv(e,t){let n=e;for(let[r,s]of Un(t).entries()){let o=r===0?"":"?.";n+=Wm.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function us(e){return Wm.test(e)?e:JSON.stringify(e)}function cv(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Wm;var _i=J(()=>{Wm=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Bm(e){let t=e.$map;return D(t)?t:void 0}function Lu(e){return D(e)&&!Array.isArray(e)&&"operator"in e}function ki(e){return D(e)&&!Array.isArray(e)&&"$ref"in e}function WI(e,t,n){let r=iv[e];if(r===void 0||r<0||t[r]!=null)return t;let s=Bt(n.$page,"locale");if(!k(s)||s==="")return t;let o=[...t];return o[r]=s,o}function gv(){return globalThis.window??globalThis}function yv(e){return e.startsWith("window#/")&&qI.has(e.slice(8))}function dr(e){return pv.has(e)}function Iu(e){if(Array.isArray(e))return e.some((t)=>Iu(t));if(e===void 0||!Lu(e))return!1;return dr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>Iu(t))||Object.values(e.cases??{}).some((t)=>Iu(t))}function Mo(e){return wr(e)&&!Iu(e.$expression)}function Um(e,t){if(Array.isArray(e)){for(let n of e)Um(n,t);return}if(e===void 0||!D(e))return;if(ki(e)){if(!BI.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Un(n)[0]??"")}return}if(Lu(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Um(r,t)}}function Zm(e){let t=new Set;return Um(e.$expression,t),[...t]}function Qm(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Mo(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Zm(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function it(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>UI)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function rt(e,t,n,r,s){if(e===null||e===void 0)return e;if(Lu(e))return Nn(e,t,n,r,s);if(ki(e)){let o=Du(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return xv(e,t,n,r,s);return s?.report(s.path??[],e),e}function xv(e,t,n,r,s){return e.map((o,i)=>rt(o,t,n,r,it(s,i)))}function zI(e,t,n,r){let s=sn(e),o=(i)=>{if(!s.slice(i.length).includes("/"))return t;return Du(s.slice(0,s.lastIndexOf("/")),t,n,r)};if(s.startsWith("#/state/"))return o("#/state/");if(s.startsWith("parent#/"))return o("parent#/");if(s.startsWith("$map/")||s.startsWith("$args/"))return s.split("/").length>2?Du(s.slice(0,s.lastIndexOf("/")),t,n,r):void 0;return}function Du(e,t,n,r){let s=sn(e);if(s==="$reduce/acc")return r?.acc;if(s.startsWith("$reduce/"))return r?.acc;if(s.startsWith("$args/")){let o=s.slice(6).split("/"),i=r?.args?.[o[0]];return o.length>1?Bt(i,o.slice(1).join("/")):i}if(s.startsWith("event#/")){let o=s.slice(7);return Bt(n,o)}if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Bm(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];return o.length>2?Bt(a,o.slice(2).join("/")):a}if(s.startsWith("#/state/"))return Bt(t,s.slice(8));if(s.startsWith("parent#/"))return Bt(t,s.slice(8));if(s.startsWith("window#/"))return Bt(gv(),s.slice(8));if(s.startsWith("document#/"))return Bt(globalThis.document,s.slice(10));return Bt(t,s)??null}function KI(e,t,n,r){let s=sn(e);if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Bm(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];if(o.length>2){let c=o.slice(2),u=c.pop(),d=c.length>0?Bt(a,c.join("/")):a;return{key:u,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:Bm(t)??t}}if(s.startsWith("#/state/")){let o=s.slice(8);if(o.indexOf("/")===-1)return{key:o,obj:t};let a=Un(o),l=a.pop(),c=t;for(let u of a)c=c[u];return{key:l,obj:c}}return{key:s,obj:t}}function Nn(e,t,n,r,s){let o=GI(e,t,n,r,s);return s?.report(s.path??[],o),o}function fv(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function GI(e,t,n,r,s){let{operator:o,target:i,value:a,initial:l}=e;if(!VI.has(o))throw Error(`$expression: unknown operator "${o}"`);if(zm.has(o)&&!("value"in e)){let c=rt(i,t,n,r,it(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=ki(i)?i.$ref:void 0;if(!k(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>uv)throw Error(`$expression: call depth exceeded (${uv})`);let d=Array.isArray(a)?a.map((m,y)=>rt(m,t,n,r,it(s,["value",y]))):[];if(c.startsWith("window#/")){if(!yv(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),y=HI.get(m);if(y)return y(...WI(m,d,t));let S=gv(),g=Bt(S,m),x=m.lastIndexOf("/"),P=x===-1?S:Bt(S,m.slice(0,x));return g.apply(P,d)}let p=Du(c,t,n,r);if(_t(p))return p.apply(zI(c,t,n,r),d);if(D(p)&&"$expression"in p){let m=p,y={};for(let[S,g]of(m.parameters??[]).entries()){let x=k(g)?g:g?.name??"";if(!x)continue;y[x]=d[S]===void 0&&D(g)&&"default"in g?g.default:d[S]}return Nn(m.$expression,t,n,{args:y,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Xm.has(o)){if(o==="?:"){let m=rt(i,t,n,r,it(s,"target"));if(s){let y=rt(a,t,n,r,it(s,"value")),S=rt(l,t,n,r,it(s,"initial"));return m?y:S}return m?rt(a,t,n,r):rt(l,t,n,r)}let c=rt(i,t,n,r,it(s,"target")),u=String(c),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[S,g]of Object.entries(d)){let x=rt(g,t,n,r,it(s,["cases",S]));if(S===u)m=x}let y=rt(e.default,t,n,r,it(s,"default"));return p?m:y}return p?rt(d[u],t,n,r):rt(e.default,t,n,r)}if(Km.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=rt(a,t,n,r,it(s,"value"));switch(o){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return fv(o,c,u)}}if(mv.has(o)){let c=rt(a,t,n,r,it(s,"value")),{obj:u,key:d}=KI(i.$ref,t,n,r);u[d]=o==="="?c:fv(o.slice(0,-1),u[d],c);return}if(hv.has(o)){let c=rt(i,t,n,r,it(s,"target"));switch(o){case"push":return c.push(rt(a,t,n,r,it(s,"value")));case"unshift":return c.unshift(rt(a,t,n,r,it(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=rt(a,t,n,r,it(s,"value"));return c.splice(...u)}default:break}}if(Ym.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=a===void 0?[]:Array.isArray(a)?xv(a,t,n,r,it(s,"value")):[rt(a,t,n,r,it(s,"value"))],d=Bt(c,o);if(!_t(d))return;return d.apply(c,u)}if(Gm.has(o)){let c=rt(i,t,n,r,it(s,"target")),u=a;if(o==="reduce"){let d=rt(l,t,n,r,it(s,"initial"));for(let[p,m]of c.entries())d=Nn(u,t,n,{acc:d,index:p,item:m},p===0?it(s,"value"):void 0);return d}if(o==="map")return c.map((d,p)=>Nn(u,t,n,{...r,index:p,item:d},p===0?it(s,"value"):void 0));if(o==="filter")return c.filter((d,p)=>Nn(u,t,n,{...r,index:p,item:d},p===0?it(s,"value"):void 0))}return}function dt(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Lu(e))return gn(e,t);if(ki(e))return eh(e.$ref,t);if(Array.isArray(e))return e.map((n)=>dt(n,t)).join(", ");return JSON.stringify(e)}function XI(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function eh(e,t){let n=sn(e),r=t.statePrefix??"state",s=t.eventParam??"event";if(n==="$reduce/acc")return"_acc";if(n.startsWith("$reduce/"))return"_acc";if(n.startsWith("$args/"))return Re("_args",n.slice(6));if(n.startsWith("event#/"))return Re(s,n.slice(7));if(n.startsWith("$map/")){let o=n.split("/"),[,i]=o;if(i==="item")return o.length>2?Re("_item",o.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(n.startsWith("#/state/"))return Re(r,n.slice(8));if(n.startsWith("parent#/"))return Re(r,n.slice(8));if(n.startsWith("window#/"))return Re("window",n.slice(8));if(n.startsWith("document#/"))return Re("document",n.slice(10));return Re(r,n)}function dv(e,t){if(ki(e))return eh(e.$ref,t);return dt(e,t)}function YI(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Cr)})`,o=JSON.stringify(Vm);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function gn(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(zm.has(n)&&!("value"in e)){let i=dt(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(ki(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>dt(l,t)):[];if(i.startsWith("window#/")){if(!yv(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let l=YI(i.slice(8),a,t);if(l)return l;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let l=i.slice(8),c=t.formulaParams?.[l];if(c){let u=c.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${XI(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${eh(i,t)}(${a.join(", ")})`}if(Xm.has(n)){if(n==="?:"){let c=dt(r,t),u=dt(s,t),d=dt(o,t);return`(${c} ? ${u} : ${d})`}let i=dt(r,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${dt(u,t)} : `).join(""),l="default"in e?dt(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${i}))`}if(Km.has(n)){let i=dt(r,t),a=dt(s,t);return`(${i} ${n} ${a})`}if(mv.has(n)){let i=dv(r,t),a=dt(s,t);return`${i} ${n} ${a}`}if(hv.has(n)){let i=dv(r,t);switch(n){case"push":return`${i}.push(${dt(s,t)})`;case"unshift":return`${i}.unshift(${dt(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>dt(l,t)).join(", "):dt(s,t);return`${i}.splice(${a})`}default:break}}if(Ym.has(n)){let i=dt(r,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>dt(l,t)).join(", "):dt(s,t);return`(${i})?.${n}?.(${a})`}if(Gm.has(n)){let i=dt(r,t),a=gn(s,t);if(n==="reduce"){let l=dt(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function Oi(e,t,n,r){return rt(e,t,n,r)}function fs(e,t={}){return dt(e,t)}var pv,zm,Km,mv,hv,Gm,Xm,Ym,VI,qI,HI,BI,uv=64,UI=64;var Ai=J(()=>{Hm();ce();_i();pv=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),zm=new Set(["!","-"]),Km=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),mv=new Set(["=","+=","-=","*=","/="]),hv=new Set(["push","pop","shift","unshift","splice"]),Gm=new Set(["reduce","map","filter"]),Xm=new Set(["?:","switch"]),Ym=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"]),VI=new Set([...pv,...zm,...Km,...Gm,...Xm,...Ym,"call"]),qI=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",...qm]),HI=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??Cr,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??Cr,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??Cr,{timeZone:Vm,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??Cr,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??Cr,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??Cr,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??Cr,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??Cr,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);BI=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function bv(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 ZI(e){return(D(e)||_t(e))&&"then"in e&&_t(e.then)}async function Ci(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=bv(o);switch(i.kind){case"expression":{let a=Nn(i.node,t,n,s);if(ZI(a))await a;break}case"if":{let a=i.node,l=Oi(a.if,t,n,s)?a.then:a.else;if(Array.isArray(l))await Ci(l,t,n,r);break}case"switch":{let a=i.node,l=String(Oi(a.$switch,t,n,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await Ci(u,t,n,r);break}case"dispatch":{let a=i.node,l=_t(r.target)?r.target():r.target,c=n?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=Oi(a.detail,t,n,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":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function zn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=bv(s);switch(o.kind){case"expression":{r.push(`${n}${gn(o.node,t)};`);break}case"if":{let i=o.node,a=fs(i.if,t),l={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,zn(i.then??[],l)),i.else)r.push(`${n}} else {`,zn(i.else,l));r.push(`${n}}`);break}case"switch":{let i=o.node,a=fs(i.$switch,t),l={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[c,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(c)}: {`,zn(u,l),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,zn(i.default,l),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in i)c.push(`detail: ${fs(i.detail,t)}`);if(i.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)c.push(`composed: ${JSON.stringify(i.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";r.push(`${n}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
|
|
129
|
+
`)}var Fu=J(()=>{ce();Ai()});var th=J(()=>{ce()});function Ri(e){if(e===QI)return"client";if(e===e1)return"server";return null}function t1(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function Sv(e,t){return`${sh}${t1(e)}#${t}`}function Vu(e){return e.startsWith(sh)}function Ni(e){if(!Vu(e))return null;let t=e.slice(sh.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function nh(e,t){if(Array.isArray(e)){let r=e.map((s)=>nh(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!L(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&k(s)){let i=Ri(s);o=i===null?s:Sv(t,i)}else if(r!=="$script")o=nh(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function pl(e,t){return nh(e,t)}function s1(e){return n1.test(e)&&!r1.test(e)}function $v(e){return Ri(e)==="client"||Ni(e)?.side==="client"}function rh(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())rh(s,[...t,r],n);return n}if(!L(e))return n;if(k(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")rh(s,[...t,r],n);return n}function o1(e){let t=e.at(-1);return k(t)?`"${t}"`:"this entry"}function wv(e){let t=rh(e,[],[]),n=t.some((s)=>!s.lazy&&$v(s.src)),r=[];for(let s of t){let o=o1(s.path);if(!s.lazy&&s1(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&$v(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var sh="jx-script:",QI="#client",e1="#server",n1,r1;var Ti=J(()=>{ce();n1=/^\.{1,2}\//u,r1=/\.json$/iu});function u1(e){for(let t of Object.keys(e))if(c1.has(t))return!0;return!1}function Ji(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Hb(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function jv(){return[...Ev].toSorted()}function Rr(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||Ev.has(n))return String(t);return t?"":null}function Pv(e,t,n){if(!Array.isArray(e))return[];let r=e;if(_t(t))r=r.filter(t);if(_t(n))r=[...r].toSorted(n);return r}function _v(e,t,n,r){let s=Qo(t);if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(Ge(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?Ie(o)?0:"":i;return}e[s]=Ie(o)?Number(n):n}function oh(e){let t=vv.get(e);if(t)return t;let n=new Set,r=Or(e);for(let[s,o]of Object.entries(e.state??{}))if(k(o)?le(o):fn(o)?!wr(o)&&!dr(o.$expression.operator):r.get(s)==="computed")n.add(s);return vv.set(e,n),n}function kv(e){let t=e.state??{},n=oh(e),r=(s)=>(s in t)&&!n.has(s);return{checked:r("checked"),disabled:r("disabled"),required:r("required"),value:r("value")}}function ih(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(k(r)&&le(r)){t.set(n,void 0);continue}if(D(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(f1.some((s)=>(s in r))){t.set(n,void 0);continue}if(u1(r))continue}t.set(n,r)}return t}var c1,pr,Ev,yY,vv,f1,ah=32,qu,Hu="jx-slot",ml="data-jx-slots",lh="jx.slot.group",xY;var Mi=J(()=>{dl();Ai();_i();ce();$i();An();Fu();th();Ti();th();dl();c1=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);pr=new Set(["$schema","$shadow","formAssociated","formValue","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Ev=new Set(["contenteditable","draggable","spellcheck"]);yY=Object.freeze({emptyRow:!0});vv=new WeakMap;f1=["$expression","$prototype","$ref","$src"],qu=/^[\t\n\f\r ]+$/u,xY=(()=>{let e=Symbol.for(lh),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function m1(){if(!hl){hl=new Map;for(let[e,t,n]of p1){let r=hl.get(e);if(!r)r=new Map,hl.set(e,r);for(let s of t.split(" "))r.set(s,n)}}return hl}function Bu(e,t){return Ov??=new Map(d1),Ov.get(t)??m1().get(t)?.get(e.toLowerCase())??null}function ch(e,t){if(t==="innerText")return!0;if(t==="value"||t==="defaultValue")return h1.has(e.toLowerCase());return t==="text"&&g1.has(e.toLowerCase())}var C=(e,t={})=>({attribute:e,kind:"text",...t}),we=(e,t={})=>({attribute:e,kind:"boolean",...t}),Wu,d1,p1,Ov,hl,h1,g1;var uh=J(()=>{Wu={live:!0},d1=[["accessKey",C("accesskey")],["ariaAtomic",C("aria-atomic")],["ariaAutoComplete",C("aria-autocomplete")],["ariaBrailleLabel",C("aria-braillelabel")],["ariaBrailleRoleDescription",C("aria-brailleroledescription")],["ariaBusy",C("aria-busy")],["ariaChecked",C("aria-checked")],["ariaColCount",C("aria-colcount")],["ariaColIndex",C("aria-colindex")],["ariaColIndexText",C("aria-colindextext")],["ariaColSpan",C("aria-colspan")],["ariaCurrent",C("aria-current")],["ariaDescription",C("aria-description")],["ariaDisabled",C("aria-disabled")],["ariaExpanded",C("aria-expanded")],["ariaHasPopup",C("aria-haspopup")],["ariaHidden",C("aria-hidden")],["ariaInvalid",C("aria-invalid")],["ariaKeyShortcuts",C("aria-keyshortcuts")],["ariaLabel",C("aria-label")],["ariaLevel",C("aria-level")],["ariaLive",C("aria-live")],["ariaModal",C("aria-modal")],["ariaMultiLine",C("aria-multiline")],["ariaMultiSelectable",C("aria-multiselectable")],["ariaOrientation",C("aria-orientation")],["ariaPlaceholder",C("aria-placeholder")],["ariaPosInSet",C("aria-posinset")],["ariaPressed",C("aria-pressed")],["ariaReadOnly",C("aria-readonly")],["ariaRelevant",C("aria-relevant")],["ariaRequired",C("aria-required")],["ariaRoleDescription",C("aria-roledescription")],["ariaRowCount",C("aria-rowcount")],["ariaRowIndex",C("aria-rowindex")],["ariaRowIndexText",C("aria-rowindextext")],["ariaRowSpan",C("aria-rowspan")],["ariaSelected",C("aria-selected")],["ariaSetSize",C("aria-setsize")],["ariaSort",C("aria-sort")],["ariaValueMax",C("aria-valuemax")],["ariaValueMin",C("aria-valuemin")],["ariaValueNow",C("aria-valuenow")],["ariaValueText",C("aria-valuetext")],["autocapitalize",C("autocapitalize")],["autocorrect",we("autocorrect",{keywords:["on","off"]})],["autofocus",we("autofocus")],["className",C("class")],["contentEditable",C("contenteditable")],["dir",C("dir")],["draggable",we("draggable")],["enterKeyHint",C("enterkeyhint")],["headingOffset",C("headingoffset")],["headingReset",we("headingreset")],["hidden",{attribute:"hidden",kind:"hidden"}],["id",C("id")],["inert",we("inert")],["inputMode",C("inputmode")],["lang",C("lang")],["popover",C("popover")],["role",C("role")],["slot",C("slot")],["spellcheck",we("spellcheck")],["tabIndex",C("tabindex")],["title",C("title")],["translate",we("translate",{keywords:["yes","no"]})],["writingSuggestions",C("writingsuggestions")]],p1=[["aLink","body",C("alink")],["abbr","td th",C("abbr")],["accept","input",C("accept")],["acceptCharset","form",C("accept-charset")],["action","form",C("action")],["align","caption col colgroup div embed h1 h2 h3 h4 h5 h6 hr iframe img input legend object p table tbody td tfoot th thead tr",C("align")],["allow","iframe",C("allow")],["allowFullscreen","iframe",we("allowfullscreen")],["alpha","input",we("alpha")],["alt","area img input",C("alt")],["archive","object",C("archive")],["as","link",C("as")],["async","script",we("async")],["autocomplete","form input select textarea",C("autocomplete")],["autoplay","audio video",we("autoplay")],["axis","td th",C("axis")],["background","body",C("background")],["behavior","marquee",C("behavior")],["bgColor","body marquee table td th tr",C("bgcolor")],["border","img object table",C("border")],["cellPadding","table",C("cellpadding")],["cellSpacing","table",C("cellspacing")],["ch","col colgroup tbody td tfoot th thead tr",C("char")],["chOff","col colgroup tbody td tfoot th thead tr",C("charoff")],["charset","a link script",C("charset")],["checked","input",we("checked",Wu)],["cite","blockquote del ins q",C("cite")],["clear","br",C("clear")],["closedBy","dialog",C("closedby")],["code","object",C("code")],["codeBase","object",C("codebase")],["codeType","object",C("codetype")],["colSpan","td th",C("colspan")],["color","font hr",C("color")],["colorSpace","input",C("colorspace")],["cols","frameset textarea",C("cols")],["command","button",C("command")],["compact","dir dl menu ol ul",we("compact")],["content","meta",C("content")],["controls","audio img video",we("controls")],["coords","a area",C("coords")],["crossOrigin","audio img link script video",C("crossorigin")],["data","object",C("data")],["dateTime","del ins time",C("datetime")],["declare","object",we("declare")],["decoding","img",C("decoding")],["default","track",we("default")],["defaultChecked","input",we("checked")],["defaultMuted","audio video",we("muted")],["defaultSelected","option",we("selected")],["defaultValue","input",C("value")],["defer","script",we("defer")],["dirName","input textarea",C("dirname")],["direction","marquee",C("direction")],["disabled","button fieldset input link optgroup option select textarea",we("disabled")],["download","a area",C("download")],["encoding","form",C("enctype")],["enctype","form",C("enctype")],["event","script",C("event")],["face","font",C("face")],["fetchPriority","img link script",C("fetchpriority")],["formAction","button input",C("formaction")],["formEnctype","button input",C("formenctype")],["formMethod","button input",C("formmethod")],["formNoValidate","button input",we("formnovalidate")],["formTarget","button input",C("formtarget")],["frame","table",C("frame")],["frameBorder","frame iframe",C("frameborder")],["headers","td th",C("headers")],["height","canvas embed iframe img input marquee object source td th video",C("height")],["high","meter",C("high")],["href","a area base link",C("href")],["hreflang","a area link",C("hreflang")],["hspace","embed img input marquee object",C("hspace")],["htmlFor","label script template",C("for")],["httpEquiv","meta",C("http-equiv")],["imageSizes","link",C("imagesizes")],["imageSrcset","link",C("imagesrcset")],["integrity","link script",C("integrity")],["isMap","img",we("ismap")],["kind","track",C("kind")],["label","optgroup option track",C("label")],["link","body",C("link")],["loading","audio iframe img video",C("loading")],["longDesc","frame iframe img",C("longdesc")],["loop","audio video",we("loop")],["low","meter",C("low")],["lowsrc","img",C("lowsrc")],["marginHeight","frame iframe",C("marginheight")],["marginWidth","frame iframe",C("marginwidth")],["max","input meter progress",C("max")],["maxLength","input textarea",C("maxlength")],["media","link meta source style",C("media")],["method","form",C("method")],["min","input meter",C("min")],["minLength","input textarea",C("minlength")],["multiple","input select",we("multiple")],["muted","audio video",we("muted",Wu)],["name","a button details embed fieldset form frame iframe img input map meta object output param select slot textarea",C("name")],["noHref","area",we("nohref")],["noModule","script",we("nomodule")],["noResize","frame",we("noresize")],["noShade","hr",we("noshade")],["noValidate","form",we("novalidate")],["noWrap","td th",we("nowrap")],["open","details dialog",we("open")],["optimum","meter",C("optimum")],["pattern","input",C("pattern")],["ping","a area",C("ping")],["placeholder","input textarea",C("placeholder")],["playsInline","video",we("playsinline")],["popoverTargetAction","button input",C("popovertargetaction")],["poster","video",C("poster")],["preload","audio video",C("preload")],["readOnly","input textarea",we("readonly")],["referrerPolicy","a area iframe img link script",C("referrerpolicy")],["rel","a area form link",C("rel")],["required","input select textarea",we("required")],["rev","a link",C("rev")],["reversed","ol",we("reversed")],["rowSpan","td th",C("rowspan")],["rows","frameset textarea",C("rows")],["rules","table",C("rules")],["scheme","meta",C("scheme")],["scope","td th",C("scope")],["scrollAmount","marquee",C("scrollamount")],["scrollDelay","marquee",C("scrolldelay")],["scrolling","frame iframe",C("scrolling")],["selected","option",we("selected",Wu)],["shadowRootClonable","template",we("shadowrootclonable")],["shadowRootCustomElementRegistry","template",C("shadowrootcustomelementregistry")],["shadowRootDelegatesFocus","template",we("shadowrootdelegatesfocus")],["shadowRootMode","template",C("shadowrootmode")],["shadowRootSerializable","template",we("shadowrootserializable")],["shadowRootSlotAssignment","template",C("shadowrootslotassignment")],["shape","a area",C("shape")],["size","font hr input select",C("size")],["sizes","img source",C("sizes")],["span","col colgroup",C("span")],["src","audio embed frame iframe img input source track video",C("src")],["srcdoc","iframe",C("srcdoc")],["srclang","track",C("srclang")],["srcset","img source",C("srcset")],["standby","object",C("standby")],["start","ol",C("start")],["step","input",C("step")],["summary","table",C("summary")],["target","a area base form link",C("target")],["text","body",C("text")],["trueSpeed","marquee",we("truespeed")],["type","a area button embed input li link object ol param script source style ul",C("type")],["useMap","img input object",C("usemap")],["vAlign","col colgroup tbody td tfoot th thead tr",C("valign")],["vLink","body",C("vlink")],["value","button data li meter option param progress",C("value")],["value","input",C("value",Wu)],["valueType","param",C("valuetype")],["version","html",C("version")],["vspace","embed img input marquee object",C("vspace")],["width","canvas col colgroup embed hr iframe img input listing marquee object pre source table td th video xmp",C("width")],["wrap","textarea",C("wrap")]];h1=new Set(["output","textarea"]),g1=new Set(["a","option","title"])});var fh,dh;var ph=J(()=>{fh={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."},dh={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var mh;var hh=J(()=>{mh={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 gh,yh,xh;var bh=J(()=>{gh={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},yh={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},xh={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var $h;var Sh=J(()=>{$h={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 wh,vh;var Eh=J(()=>{wh={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"},vh={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 gl;var jh=J(()=>{gl={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',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:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",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" encodes variants 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 Ph;var _h=J(()=>{Ph={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var kh,Oh,Ah,Ch,Rh,Nh,Th,Jh,Mh;var Ih=J(()=>{kh={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Oh={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Ah={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Ch={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Rh={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Nh={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done","#/$map/item/text"],pattern:String.raw`^(#/)?\$map/(item|index)(/.*)?$`,type:"string"},Th={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Jh={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"},Mh={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var yl;var Dh=J(()=>{yl={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 Lh,Fh;var Vh=J(()=>{Lh={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, in either spelling ($map/item/id or #/$map/item/id). 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"},Fh={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 qh,Hh,Wh,Bh,Uh,Uu;var zh=J(()=>{qh={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Hh={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"},Wh={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Bh={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"},Uh={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"},Uu={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 Kh;var Gh=J(()=>{Kh={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 Xh;var Yh=J(()=>{Xh={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},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: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; 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 → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{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 Zh,Qh;var eg=J(()=>{Zh={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"}]},Qh={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 tg,ng;var rg=J(()=>{tg=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],ng={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 sg;var og=J(()=>{sg={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 ig,ag,lg,cg,ug,fg,dg,pg,mg,hg,gg,yg,xg,bg,$g,Sg,wg;var vg=J(()=>{Hm();ig={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"},ag={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."},lg={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."},cg={enum:["!","-"]},ug={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},fg={const:"?:"},dg={const:"switch"},pg={const:"call"},mg={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"]},hg={enum:["=","+=","-=","*=","/="]},gg={enum:["pop","shift"]},yg={enum:["push","unshift"]},xg={const:"splice"},bg={const:"reduce"},$g={enum:["map","filter"]},Sg={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 "+`${av()}) — 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"},wg={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 Eg,jg,Pg,_g;var kg=J(()=>{Eg={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"}]},jg={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Pg={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},_g={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 Av,zu,Ku,Gu,Xu,Yu,Zu,Qu,ef,tf,Og;var Ag=J(()=>{Av=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],zu={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"},Ku={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"},Gu={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",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"},Xu={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:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",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:Av,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"},Yu={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"},Zu={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"},Qu={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"},ef={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"},tf={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"},Og={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 Cv,nf;var Cg=J(()=>{Jo();Cv=[301,302,303,307,308],nf={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:Nu,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:Nu,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Nu,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:[...Cv],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"}});var Rg;var Ng=J(()=>{Rg={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 xl="https://jxsuite.com/schema/project/fields/v2",Io="https://jxsuite.com/schema/document/paths/v2",Tg,Jg,bl,Mg;var $l=J(()=>{Tg={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"},Jg={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"},bl=[{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"}],Mg={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"}});var Rv=J(()=>{ph();hh();bh();Sh();Eh();jh();_h();Ih();Dh();Vh();zh();Gh();Yh();eg();rg();og();vg();kg();Ag();Cg();Ng();$l()});function Nv(e,t,n){let r=e.$description;if(k(r))(Object.keys(t).length>0?t:n).$description=r}function Tv(e,t,n,r,s=y1,o={}){let i=[],a=(p,m)=>{let y={mediaQueries:t,scope:m,transposeValue:n};if(r)y.resolveValue=(S,g)=>r(S,g,m);for(let S of Pi(p,y))i.push(o.comments===!0?fl(S):S.text)},l={},c={},u=[],d=[];for(let[p,m]of Object.entries(e)){if(D(m)&&!Array.isArray(m)){if(p.startsWith("@"))u.push([p,m]);else if(!p.startsWith("--"))d.push([p,m]);continue}if(ul(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")l[p]=m;else c[p]=m}Nv(e,l,c),a(l,s.root),a(c,s.body);for(let[p,m]of d)if(p.startsWith("&"))a({[p]:m},s.root);else a(m,p);for(let[p,m]of u){if(ll(p)||cl(p)){a({[p]:m},null);continue}let y={},S={},g=[];for(let[x,P]of Object.entries(m)){if(D(P)&&!Array.isArray(P)){if(!x.startsWith("@"))g.push([x,P]);continue}if(x.startsWith("$"))continue;if(x.startsWith("--"))y[x]=P;else S[x]=P}Nv(m,y,S),a({[p]:y},s.root),a({[p]:S},s.body);for(let[x,P]of g)a({[p]:P},x)}if(Object.values(t).some((p)=>fr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${ur}="light"]) { color-scheme: light }`,`${s.root}:where([${ur}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
130
|
+
`)}var y1;var Jv=J(()=>{dl();ce();y1={body:"body",root:":root"}});function Mv(e,t){return t===null?e:":host"}var Sl=J(()=>{dl()});function kl(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=Iv(s);if(!o)continue;let i=Dv(s)?`_a[${r}] === undefined ? ${JSON.stringify(s.default)} : _a[${r}]`:`_a[${r}]`;n.push(`${JSON.stringify(o)}: ${i}`)}return`(..._a) => { const _args = { ${n.join(", ")} }; return ${t}; }`}function Iv(e){return k(e)?e:e?.name??""}function Dv(e){return D(e)&&"default"in e}function x1(e,t){let n=Lv(e,t);return n===e?e:`${n} as ${e}`}function Lv(e,t){let n=t?.$export;return k(n)&&n!==""?n:e}function cf(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,a=le(i),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)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${$1(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(i)};`);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 p=D(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${p}`)}let d=u.length>0?`, { ${u.join(", ")} }`:"";return c.push(` fetch(url${d})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${r}.${e} = d; })`,` .catch(e => { ${r}.${e} = { error: String(e) }; });`,o?"}));":"});"),c.map((p)=>`${s}${p}`).join(`
|
|
131
|
+
`)}function uf(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,a=JSON.stringify(`${i}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([S,g])=>{if(!me(g))return`${us(S)}: ${JSON.stringify(g)}`;if(b1.some((x)=>g.$ref.startsWith(x)))throw Error(`Server function "${e}": argument "${S}" references "${g.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${us(S)}: ${fs({$ref:g.$ref},{statePrefix:r})}`}),u=l.some(([,S])=>me(S)),d=`${Qv}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,p=Re(r,Wt(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;",o?` ${o}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${d}`,` .then((d) => { if (_seq === _jxSeq) ${p} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,o?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,d,` .then((d) => { ${p} = d; })`,` .catch((e) => { ${m}; });`]).map((S)=>`${s}${S}`).join(`
|
|
132
|
+
`)}function $1(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Pl(e){return`<script type="importmap">
|
|
133
|
+
{
|
|
134
|
+
"imports": {
|
|
135
|
+
${Object.entries(e).map(([n,r])=>` ${JSON.stringify(n)}: ${JSON.stringify(r)}`).join(`,
|
|
136
|
+
`)}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</script>`}function Ii(e){if(e.runtimeImports!==void 0)return Pl(e.runtimeImports);let t={"@vue/reactivity":e.reactivitySrc,"lit-html":e.litHtmlSrc};return Pl(e.litHtmlSrc===Nr?{...t,"lit-html/":`${Nr}/`}:t)}function ff(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${vl}\??\.${vl}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${vl}(?:\?\.)?\[${vl}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||S1.test(e)}function df(e,t){let n=Qm(t),r=e.state??{},s=Object.keys(n).filter((c)=>!(c in r));if(s.length===0)return e;let o=JSON.stringify(e),i=Object.values(r).some((c)=>D(c)&&!Array.isArray(c)&&k(c.$src)),a=new Set(s.filter((c)=>i||ff(o,c)));for(let c of a)for(let u of Zm(n[c]))if(!(u in r))a.add(u);if(a.size===0)return e;let l=Object.fromEntries(s.filter((c)=>a.has(c)).map((c)=>[c,n[c]]));return{...e,state:{...l,...r}}}function w1(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Mo(n)));return JSON.stringify({...e,state:t})}function pf(e){if(k(e))return le(e);if(!D(e))return!1;if(e.state){let n;for(let[r,s]of Object.entries(e.state)){if(r==="$site"||r==="$page")continue;if(!D(s)||Array.isArray(s))return!0;if(s.timing==="compiler")continue;if(Mo(s)){if(n??=w1(e),ff(n,r))return!0;continue}if(s.$prototype)return!0;if("default"in s)return!0;if($s(s))continue;return!0}}if(e.$switch)return!0;if(Le(e)||Lb(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((n)=>pf(n)))return!0;let t=Di(e);for(let[n,r]of Object.entries(e)){if(pr.has(n)||t&&n==="innerHTML")continue;if(me(r))return!0;if(le(r))return!0}if(D(e.style)){for(let n of Object.values(e.style))if(le(n))return!0}if(D(e.attributes)){for(let n of Object.values(e.attributes))if(le(n))return!0}return!1}function Di(e){return e.$static===!0||e.$prerendered===!0}function Li(e,t=null,n={},r={}){let s=e?.state?Do(e.state,t):t??of();return{media:r,scope:s,scopeDefs:n}}function of(e=null){return Object.create(e)}function Fg(e){return e[Fv]}function Vg(e,t){return Fg(e)?.has(t)??!1}function Ol(e,t){if(!e.startsWith("#/state/"))return!1;let[n=""]=e.slice(8).split("/");return Vg(t,n.replaceAll("~1","/").replaceAll("~0","~"))}function Lg(e,t,n){if(t>0&&j1.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!P1.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function Vv(e){for(let t=e.indexOf("state");t!==-1;t=e.indexOf("state",t+1))if(Lg(e,t,!0)&&!Lg(e,t,!1))return!0;return!1}function Fi(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:po(e),o="",i=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(Lg(s,a,r))o+=e.slice(i,a)+t,i=a+5;return o+e.slice(i)}function af(e,t){if(k(e)){if(!e.includes("state."))return;let o=po(e);for(let i of o.matchAll(v1))t.add(i[1]);for(let i of o.matchAll(E1))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)af(o,t);return}if(!D(e))return;let n=e,{operator:r,target:s}=n;if(k(r)&&dr(r)&&me(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))af(o,t)}function sf(e,t){for(let n of Bi(e)){if(Le(n)){sf(n.map?[n.map]:[],t);continue}if(!Ot(n))continue;for(let[r,s]of Object.entries(n))if(r.startsWith("on")&&(kt(s)||fn(s)))af(s.body??s.$expression,t);sf(Object.values(n.cases??{}).filter((r)=>Ot(r)&&!Xe(r)),t),sf(n.children,t)}}function ps(e,t){if(kt(t)&&fm(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function mf(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(ps(`state entry "${r}"`,s),!kt(s)||!s.$src)continue;if(s.$lazy===!0){if(t.get(r)==="computed")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 i=n.lazy.get(s.$src);if(!i)i=[],n.lazy.set(s.$src,i);i.push({binding:r,exportName:Lv(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(x1(r,s))}return n}function hf(e,t){let n=[];for(let[o,i]of e.eager)n.push(`import { ${[...i].join(", ")} } from '${t?t(o):o}';`);let r=[],s=0;for(let[o,i]of e.lazy){let a=`_jxLazy${s}`;s+=1,r.push(`let ${a};`,`const ${a}Load = () => (${a} ??= import('${t?t(o):o}'));`,...i.map(({binding:l,exportName:c})=>`const ${l} = (...args) => ${a}Load().then((m) => m.${c}(...args));`))}return{imports:n,loaders:r}}function Do(e={},t=null,n={}){let r=of(t),s=t?Fg(t):void 0,o=new Set(s);if(Object.defineProperty(r,Fv,{configurable:!0,enumerable:!1,value:o,writable:!0}),n.holdMutable===!0){let d=new Set;for(let p of Object.values(e))if(kt(p)||fn(p))af(p.body??p.$expression,d);if(n.document)sf([n.document],d);for(let p of d)if(p in e)o.add(p)}let i=Or({state:e});for(let[d,p]of Object.entries(e)){if(!D(p)||Array.isArray(p)){ds(r,d,rf(p));continue}if("default"in p){ds(r,d,rf(p.default));continue}if(Zr(p)){o.add(d);continue}if(!p.$prototype&&!("$expression"in p)&&!$s(p))ds(r,d,rf(p))}let a=[],l=[],c=[];for(let[d,p]of Object.entries(e)){if(le(p)){a.push([d,p]);continue}if(!D(p))continue;if(fn(p)){let m=p.$expression;if(c.push([d,JSON.stringify(m)]),wr(p)){let y=p.parameters;ds(r,d,(...S)=>{let g={};for(let[x,P]of y.entries()){let w=Iv(P);if(!w)continue;g[w]=S[x]===void 0&&Dv(P)?P.default:S[x]}return Nn(m,r,null,{args:g})})}else if(dr(m.operator))ds(r,d,(y,S)=>Nn(m,y,S));else Ig(r,d,()=>Nn(m,r,null));continue}if(kt(p)){if(ps(`state entry "${d}"`,p),vr(p)){let{body:m}=p;c.push([d,JSON.stringify(m)]),ds(r,d,(y,S)=>{Ci(m,y??r,S??null)})}else if(k(p.body)){let{body:m}=p,y=Function(...kr(p),m);if(i.get(d)==="computed")Ig(r,d,()=>y(r)),l.push([d,m]);else ds(r,d,y),c.push([d,m])}else ds(r,d,()=>{}),o.add(d);continue}if(Pn(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){ds(r,d,rf(p.default??null));continue}if(Pn(p)&&p.$prototype==="Request")o.add(d);if(Hi(p))o.add(d)}let u=!0;while(u){u=!1;for(let[d,p]of[...l,...a])if(!o.has(d)&&Hv(p,r))o.add(d),u=!0;for(let[d,p]of c)if(!o.has(d)&&_1(p,o))o.add(d),u=!0}for(let[d,p]of a)Ig(r,d,()=>Gt(p,r));return r}function ds(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Ig(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function tt(e,t){if(me(e))return qv(e.$ref,t);if(le(e))return Gt(e,t);return e}function Xe(e){return me(e)}function qv(e,t){if(!k(e))return e;let n=sn(e);if(n.startsWith("$map/")){let r=n.split("/"),s=r[1],i=t.$map?.[s]??t[`$map/${s}`];return r.length>2?Dg(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Dg(t,e.slice(8));return Dg(t,e)??null}function Hv(e,t){if(!t)return!1;let n=Fg(t);for(let r of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(r[2])continue;let s=r[1];if(n?.has(s))return!0;let o;try{o=t[s]}catch{continue}if(_t(o))return!0}return!1}function _1(e,t){for(let n of e.matchAll(/#\/state\/([^"/\\]+)|\bstate\.([A-Za-z_$][\w$]*)/g)){let[,r,s]=n,o=r===void 0?s:r.replaceAll("~1","/").replaceAll("~0","~");if(o!==void 0&&t.has(o))return!0}return!1}function gf(e){return Ji(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Gt(e,t){if(Hv(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page],s=t?.$map;if(D(s)&&!Array.isArray(s)){n.push("item","index");let o=s;r.push(o.item,o.index)}try{let o=Ji(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,o)(...r)}catch{return null}}function Dg(e,t){return Bt(e,t)}function rf(e){if(!D(e))return e;return structuredClone(e)}function k1(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&le(r)).map(([n,r])=>{let s=tt(r,t);return s==null?null:`${hn(n)}: ${s}`}).filter(Boolean).join("; ")}function qg(e,t){if(!k(t)&&!Ie(t)&&!Ge(t))return null;if(e.kind==="text")return String(t);if(e.kind==="hidden"){if(k(t)&&t.toLowerCase()==="until-found")return"until-found";return t?"":null}let n=Boolean(t);if(e.keywords)return e.keywords[n?0:1];return Rr(e.attribute,n)}function Bv(e,t){if(me(e)&&(t===null||Ol(e.$ref,t)))return;try{return tt(e,t)}catch{return}}function wl(e,t,n){return n&&t===""?` ${e}`:` ${e}="${Ne(t)}"`}function Lo(e,t,n=""){let r=Il(e.tagName,t),s=new Map,o,i=tt(e.id,t);if(i)s.set("id",wl("id",String(i),!1));let a=Jl(e),l=a?tt(Ml(e),t):null,c=[k(l)||Ie(l)?String(l):"",Js(e)??""].filter((S)=>S!=="").join(" ");if(c)s.set("class",wl("class",c,!1));let u=(S,g)=>{if(g===void 0)return;let x=Bu(r,S);if(!x)return;let P=Bv(g,t);if(x.live&&P!==void 0)o??=new Set,o.add(x.attribute);let w=qg(x,P);if(w!==null)s.set(x.attribute,wl(x.attribute,w,x.kind!=="text"))};for(let S of Wv)u(S,e[S]);let d=e;for(let S of Object.keys(d)){if(A1.has(S)||S.startsWith("$")||S.startsWith("on")||ch(r,S))continue;u(S,d[S])}let p="";if(e.attributes)for(let[S,g]of Object.entries(e.attributes)){if(a&&S==="class")continue;let x=tt(g,t),P=null;if(Ge(x)){let E=Rr(S,x);P=E===null?null:wl(S,E,!0)}else if(k(x)||Ie(x))P=wl(S,String(x),!1);let w=S.toLowerCase();if(o?.has(w))continue;if(s.has(w)){if(P===null&&(x===null||x===void 0||Ge(x)))s.delete(w);else if(P!==null)s.set(w,P);continue}p+=P??""}let m="";for(let S of s.values())m+=S;let y=[k1(e.style,t),n].filter(Boolean).join("; ");if(y)m+=` style="${Ne(y)}"`;if(m+=p,e.$static)m+=" data-jx-static";else if(e.$prerendered)m+=" data-jx-prerendered";return m}function Al(e,t,n){if(Di(e))return;if(!(("innerText"in e)||("value"in e)||("defaultValue"in e)||("text"in e)))return;for(let[r,s]of Object.entries(e)){if(s===void 0||!ch(t,r))continue;let o=Bv(s,n),i=o===null||o===void 0?"":Ne(String(o));return r==="innerText"?i.replaceAll(/\r\n|\r|\n/gu,"<br>"):i}return}function Cl(e,t=" "){return e?"":`
|
|
140
|
+
${t}`}function Vi(){let e=JSON.stringify(Mu),t=JSON.stringify(ur);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Uv(e,t,n,r,s={}){for(let o of Pi(t,{...s,mediaQueries:r,resolveValue:(i,a)=>zv(i,a,n),scope:n}))e.push(fl(o))}function zv(e,t,n){let r=k(t)?t:t.$ref;return C1.push({property:e,selector:n,source:r}),null}function yf(){return`const __jxEnumAttrs = new Set(${JSON.stringify(jv())});
|
|
141
|
+
function ${Vo}(n, v) {
|
|
134
142
|
if (typeof v !== 'boolean') return v;
|
|
135
143
|
const l = n.toLowerCase();
|
|
136
144
|
if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
|
|
137
145
|
return v ? '' : null;
|
|
138
|
-
}`}function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
${
|
|
146
|
+
}`}function xf(e){let t={keyed:!1,arranged:!1},n=(r)=>{for(let s of Bi(r)){if(Le(s)){t.arranged||=me(s.filter)||me(s.sort),t.keyed||=me(s.key),n(s.map?[s.map]:[]);continue}if(!Ot(s))continue;n(Object.values(s.cases??{}).filter((o)=>Ot(o)&&!Xe(o))),n(s.children)}};return n([e]),t}function Hg(e,t){for(let r of[e.items,e.filter,e.sort])if(me(r)&&Ol(r.$ref,t))return!1;let n=(r)=>{for(let s of Bi(r)){if(Le(s)){if(!Hg(s,t))return!1;continue}if(!Ot(s))continue;let o=Object.values(s.cases??{}).filter((i)=>Ot(i)&&!Xe(i));if(!n(o)||!n(s.children))return!1}return!0};return n(e.map?[e.map]:[])}function qo(e){let{items:t}=e;if(le(t))throw Error(`A repeater's items must be a $ref or a literal array, not the template string ${JSON.stringify(t)}. A template is not read as a list: bind items to a state entry by $ref, and compute the list in that entry.`)}function bf(e){let t=sn(e);if(t==="$map/item")return[];return t.startsWith("$map/item/")?Un(t.slice(10)):null}function $f(){return`function ${qi}(items, filter, sort) {
|
|
147
|
+
if (!Array.isArray(items)) return [];
|
|
148
|
+
let list = items;
|
|
149
|
+
if (typeof filter === 'function') list = list.filter(filter);
|
|
150
|
+
if (typeof sort === 'function') list = [...list].sort(sort);
|
|
151
|
+
return list;
|
|
152
|
+
}
|
|
153
|
+
function ${Kv}(list, path, pointer, warn) {
|
|
154
|
+
const keys = list.map((item, index) => {
|
|
155
|
+
if (pointer === null) return index;
|
|
156
|
+
if (path === null) {
|
|
157
|
+
`+' warn(`key "${pointer}" is not a $map/item pointer — rows fall back to their index`);\n'+` return index;
|
|
158
|
+
}
|
|
159
|
+
if (path.length === 0) return item;
|
|
160
|
+
let key = item;
|
|
161
|
+
for (const name of path) key = key?.[name];
|
|
162
|
+
if (key === undefined || key === null) {
|
|
163
|
+
`+' warn(`key "${pointer}" is empty for some items — those rows fall back to their index`);\n'+` return index;
|
|
164
|
+
}
|
|
165
|
+
return key;
|
|
166
|
+
});
|
|
167
|
+
const seen = new Set();
|
|
168
|
+
for (let i = 0; i < keys.length; i++) {
|
|
169
|
+
if (seen.has(keys[i])) {
|
|
170
|
+
`+" warn(`duplicate key ${String(keys[i])} — every occurrence after the first is rebuilt on each change`);\n"+` keys[i] = { duplicate: i };
|
|
171
|
+
} else {
|
|
172
|
+
seen.add(keys[i]);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return keys;
|
|
176
|
+
}`}function wf(){return["class __JxKeyedList extends AsyncDirective {"," #args = null;"," #runner = null;"," #queued = false;"," #warned = false;"," #snap = shallowRef({ list: [], keys: [] });"," #warn = (message) => {"," if (this.#warned) return;"," this.#warned = true;"," console.warn(`Jx $map: ${message}`);"," };"," #compute = () => {"," const [items, filter, sort, path, pointer] = this.#args;",` const list = Array.from(${qi}(items, filter, sort));`,` this.#snap.value = { list, keys: ${Kv}(list, path, pointer, this.#warn) };`," };"," #schedule = () => {"," if (this.#queued) return;"," this.#queued = true;"," queueMicrotask(() => {"," this.#queued = false;"," if (this.#runner) this.#runner();"," });"," };"," #start(lazy) {"," this.#runner = effect(this.#compute, { lazy, scheduler: this.#schedule });"," if (lazy) this.#schedule();"," }"," render() {}"," update(_part, args) {"," const previous = this.#args;"," this.#args = args;"," if (!this.#runner) {"," if (this.isConnected) this.#start(false);"," } else if (previous[0] !== args[0] || previous[1] !== args[1] || previous[2] !== args[2]) {"," this.#schedule();"," }"," const snap = this.#snap.value;"," return repeat(snap.list, (_item, index) => snap.keys[index], args[5]);"," }"," disconnected() {"," if (this.#runner) stop(this.#runner);"," this.#runner = null;"," }"," reconnected() {"," if (!this.#runner && this.#args) this.#start(true);"," }","}",`const ${Nl} = directive(__JxKeyedList);`,"const __jxLiterals = new Map();",`function ${Rl}(text) {`," if (!__jxLiterals.has(text)) __jxLiterals.set(text, JSON.parse(text));"," return __jxLiterals.get(text);","}"].join(`
|
|
177
|
+
`)}function Gv(){return[`function ${Wg}(el, k) {`," if (Object.hasOwn(el, k)) return true;"," if (el.hasAttribute(k)) return true;"," const kebab = k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase());"," return kebab !== k && el.hasAttribute(kebab);","}",`function ${Bg}(el, k) {`," for (let p = Object.getPrototypeOf(el); p; p = Object.getPrototypeOf(p)) {"," const d = Object.getOwnPropertyDescriptor(p, k);"," if (d) return d.set;"," }"," return undefined;","}"].join(`
|
|
178
|
+
`)}function Xv(){return[`function ${vf}(state, name, value, defaults) {`," const key = name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," if (defaults && defaults.has(key) && defaults.get(key) === undefined) return;"," const current = state[key];"," if (typeof current === 'boolean') {"," state[key] = value !== null && value !== 'false';"," return;"," }"," if (value === null) {"," const declared = defaults ? defaults.get(key) : undefined;"," state[key] = declared === undefined ? (typeof current === 'number' ? 0 : '') : declared;"," return;"," }"," state[key] = typeof current === 'number' ? Number(value) : value;","}"].join(`
|
|
179
|
+
`)}function Yv(e){return Qo(e)}function Tl(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>k(n)):[]}function Zv(e){let t=ih(e),n=new Set(Tl(e).map((s)=>Yv(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function Ef(){return[`async function ${Qv}(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(`
|
|
180
|
+
`)}function Ug(e){let t={};for(let[n,r]of Object.entries(e))if(!R1.has(n)&&r!==void 0)t[n]=r;return t}function zg(e){return Pn(e)&&!N1.has(e.$prototype)}function Hi(e){return zg(e)&&e.timing==="client"}function jf(){return[`async function ${e0}(C, name, config) {`,` if (typeof C !== 'function') throw new TypeError('Jx: "' + name + '" is not a class');`," const i = new C(config);"," const v = typeof i.resolve === 'function' ? await i.resolve() : 'value' in i ? i.value : i;"," return [v, i];","}"].join(`
|
|
181
|
+
`)}function Pf(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!Hi(o))continue;if(t===void 0)throw Error(`"${s}": external class "${o.$prototype}" with timing "client" compiles only in a site build`);let i=t(o),a=r.get(i);if(a===void 0)a=`_JxClass${r.size}`,r.set(i,a);n.push({binding:a,config:Ug(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function _f(e,t){let{indent:n,instances:r,statePrefix:s}=t,o=["Promise.all(["];for(let{binding:i,config:a,key:l,name:c}of e){let u=Re(s,Wt(l)),d=JSON.stringify(l);o.push(`${n} ${e0}(${i}, ${JSON.stringify(c)}, ${JSON.stringify(a)}).then(([v, i]) => {`,`${n} ${u} = v;`,`${n} ${r}.set(${d}, i);`,`${n} if (typeof i.subscribe === 'function') i.subscribe((n) => { ${u} = n; });`,`${n} }).catch((e) => { console.error(${JSON.stringify(`Jx: external class "${l}" failed`)}, e); }),`)}return o.push(`${n}])`),o.join(`
|
|
182
|
+
`)}function t0(){return[`function ${Kg}(host, internals, state, keys, root, formValue, watch) {`," const initial = { checked: state.checked, value: state.value };"," let ownDisabled = state.disabled;"," let forced = false;"," const control = () => root().querySelector('input, textarea, select');"," const mayBeLabelled = () => {"," if (host.closest('label')) return true;"," const id = host.id;"," if (id === '') return false;"," const tree = host.getRootNode();"," const scope = tree instanceof DocumentFragment ? tree : host.ownerDocument;"," return Array.from(scope.querySelectorAll('label[for]'))"," .some((label) => label.getAttribute('for') === id);"," };"," const nameControl = () => {"," if (!mayBeLabelled()) return;"," const target = control();"," const labels = internals.labels;"," if (target && labels.length > 0 && 'ariaLabelledByElements' in target &&"," !target.hasAttribute('aria-label') && !target.getAttribute('aria-labelledby')) {"," target.ariaLabelledByElements = Array.from(labels).filter((l) => l instanceof Element);"," }"," };"," host.addEventListener('click', (event) => {"," const target = control();"," if (event.target !== host || !target || target.disabled) return;"," target.focus();"," if (target.type === 'checkbox' || target.type === 'radio') target.click();"," });"," host.addEventListener('focusin', nameControl);"," const valueMissingMessage = () => {"," const probe = host.ownerDocument.createElement('input');"," probe.required = true;"," if (keys.checked) probe.type = 'checkbox';"," return probe.validationMessage || 'Please fill out this field.';"," };"," return {"," disabled(flag) {"," if (!keys.disabled) return;"," if (flag) {"," if (!forced) { ownDisabled = host.hasAttribute('disabled') ? false : state.disabled; forced = true; }"," state.disabled = true;"," } else if (forced) {"," forced = false;"," state.disabled = ownDisabled;"," }"," },"," reset() {"," if (keys.value) state.value = initial.value;"," if (keys.checked) state.checked = initial.checked;"," },"," start() {"," if (formValue) {"," watch(() => {"," const value = formValue();"," if (value === null || value === undefined) internals.setFormValue(null);"," else if (value instanceof File || value instanceof FormData) internals.setFormValue(value);"," else internals.setFormValue(String(value));"," });"," }"," if (keys.required) {"," watch(() => {"," const empty = keys.checked"," ? !state.checked"," : state.value === null || state.value === undefined || state.value === '';"," if (state.required && empty) {"," internals.setValidity({ valueMissing: true }, valueMissingMessage(), control() ?? undefined);"," } else {"," internals.setValidity({});"," }"," });"," }"," nameControl();"," },"," };","}"].join(`
|
|
183
|
+
`)}function n0(){let e=`new RegExp(${JSON.stringify(qu.source)}, ${JSON.stringify(qu.flags)})`,t=`Symbol.for(${JSON.stringify(lh)})`,n=JSON.stringify(ml),r=JSON.stringify(Hu);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${Gg}(host) {`,` const id = host.getAttribute(${n});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${n});`,` const open = ${r} + ' ' + id + ' ';`,` const close = '/' + ${r} + ' ' + 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 ${Xg}(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(`
|
|
184
|
+
`)}function Ns(e){for(let t of Bi(e)){if(Le(t)){if(t.map&&Ns([t.map]))return!0;continue}if(!Ot(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>Ot(r)&&!Xe(r));if(Ns(n)||Ns(t.children))return!0}return!1}function Bi(e){if(Le(e))return[e];if(!Array.isArray(e))return[];return e}function Ui(e,t={},n=null){let r=[],s=Tv(D(n)?n:{},t,(i)=>i,zv,void 0,{comments:!0});if(s!=="")r.push(s);if(Af(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
|
|
185
|
+
${kf(r.join(`
|
|
146
186
|
`))}
|
|
147
|
-
</style>`}function
|
|
148
|
-
${
|
|
149
|
-
`);return""}function
|
|
150
|
-
`)
|
|
151
|
-
|
|
152
|
-
|
|
187
|
+
</style>`}function kf(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Js(e){return e[r0]}function s0(e,t,n){let r=Js(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[r0]=s,s}function Of(e){let{children:t}=e;if(Array.isArray(t))return t;return Le(t)?[t]:[]}function jl(e,t){if(!D(e))return;if(Le(e)){if(e.map)jl(e.map,t);return}t(e);for(let n of Of(e))jl(n,t);if(D(e.cases))for(let n of Object.values(e.cases))jl(n,t)}function o0(e,t,n){jl(e,(r)=>{if(r.style)s0(r,t,n)})}function Jl(e){return Js(e)!==void 0||Boolean(e.className)}function Ml(e){let{attributes:t}=e;return D(t)&&Object.hasOwn(t,"class")?t.class:e.className}function Af(e,t,n,r="",s,o="jx",i={}){let a=s??{n:0};jl(e,(l)=>{if(l.style)Uv(t,l.style,`.${s0(l,a,o)}`,n,i)})}function Ne(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Ms(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function i0(e){let t=new Set;return a0(e,t),[...t]}function a0(e,t){if(!D(e))return;if(e.state){for(let n of Object.values(e.state))if(kt(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)a0(n,t)}function l0(e){let t=[];return c0(e,t),t}function c0(e,t){if(!D(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(Zr(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)c0(n,t)}function Il(e,t){if(k(e))return e;let n=Yo(e);if(n.length===0)return"div";if(!rr(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return tt(s,t)?r.value:r.initial;let o=tt(s,t);return r.cases[String(o)]??r.default}function Zg(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Qg(e,t,n,r=null){let s=new Map;for(let o of Bi(e)){let i="",a=!0,l;if(k(o)||Ie(o)||Ge(o)){if(l=n(o),qu.test(l))continue;a=l!==""}else if(Le(o))l=n(o);else if(!Ot(o))l=n(o),a=l!=="";else{let u=tt(o.attributes?.slot,t),d=k(o.slot)?tt(o.slot,t):null;if(k(u)&&u!=="")i=u,l=n(o);else if(k(d)&&d!==""){i=d;let{slot:p,...m}=o;l=n({...m,attributes:{...m.attributes,slot:d}})}else l=n(o)}let c=s.get(i);if(c)c.html=c.html===""?l:`${c.html}
|
|
188
|
+
${l}`,c.content||=a;else s.set(i,{content:a,html:l})}return{groups:s,id:r,taken:new Set}}function u0(e,t,n){for(let r of Bi(e)){if(Le(r)||!Ot(r))continue;if(r.tagName==="slot"){let s=tt(r.attributes?.name,t);n.taken.add(k(s)?s:"")}u0(r.children,t,n)}}function ey(e){let t=null,n={};for(let[r,s]of Object.entries(e??{}))if(r.startsWith("props.")&&r.length>6)t??={},t[r.slice(6)]=s;else n[r]=s;return{lifted:t,rest:n}}function Dl(e,t){if(!t)return Do(e.state??{},null);let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=D(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return Do(n,null)}function ty(e,t,n){let r=Tl(e).filter((a)=>Object.hasOwn(t??{},a));if(!t||r.length===0)return null;let s=ih(e),o=Dl(e,null),i=null;for(let a of r){let l=tt(t[a],n),c=null;if(Ge(l))c=Rr(a,l);else if(k(l)||Ie(l))c=String(l);let u=Yv(a);if(c===null||s.has(u)&&s.get(u)===void 0)continue;_v(o,a,c,s),i??={},i[u]=o[u]}return i}function ny(e,t){let n={};for(let[r,s]of Object.entries(e??{})){if(me(s)&&Ol(s.$ref,t))continue;let o;try{o=tt(s,t)}catch{continue}if(k(o)||Ie(o)||Ge(o))n[r]=o}return n}function ry(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!le(r))return[];let s=tt(r,t);return s==null?[]:[[n,s]]}))}function _l(e,t,n,r,s=!1){if(e.textContent!==void 0){let i=tt(e.textContent,t);return i!=null?Ne(String(i)):""}if(e.innerHTML){let i=tt(e.innerHTML,t);return i!=null?String(i):e.innerHTML}let o=Al(e,Il(e.tagName,t),t);if(o!==void 0)return o;if(Le(e.children))return f0(e.children,t,n,r,s);if(Array.isArray(e.children))return e.children.map((i)=>Fo(i,t,n,r,s)).join(s?"":`
|
|
189
|
+
`);return""}function f0(e,t,n=null,r=null,s=!1){let o=e.map;if(!o)return"";qo(e);let i=t??of(),a=sy(e,i);if(a===null)return"";return a.map((l,c)=>{let u=of(i);return u.$map={index:c,item:l},u["$map/item"]=l,u["$map/index"]=c,Fo(o,u,n,r,s)}).join(s?"":`
|
|
190
|
+
`)}function sy(e,t){let n=(r)=>me(r)?qv(r.$ref,t):void 0;for(let r of[e.items,e.filter,e.sort])if(me(r)&&Ol(r.$ref,t))return null;try{let r=me(e.items)?n(e.items):e.items;if(!Array.isArray(r))return null;return Pv(r,n(e.filter),n(e.sort))}catch{return null}}function Fo(e,t,n=null,r=null,s=!1){if(k(e)){if(le(e)&&t){let c=Gt(e,t);if(c!=null)return Ne(String(c));return r?"":Ne(e)}return Ne(e)}if(Ie(e)||Ge(e))return Ne(String(e));if(Array.isArray(e))return e.map((c)=>Fo(c,t,n,r,s)).join(s?"":`
|
|
191
|
+
`);if(!D(e))return"";if(Le(e))return f0(e,t,n,r,s);if(e.$switch){let c=e.tagName??"div",u=Lo(e,t),p=me(e.$switch)&&t!==null&&Ol(e.$switch.$ref,t)?null:tt(e.$switch,t),m=p==null?void 0:e.cases?.[String(p)],y=m!==void 0&&!Xe(m)?Fo(m,t,n,r,s):"";return`<${c}${u}>${y}</${c}>`}let o=Il(e.tagName,t);if(o==="slot"&&n){let c=tt(e.attributes?.name,t),u=k(c)?c:"",d;if(!n.taken.has(u))n.taken.add(u),d=n.groups.get(u);let p=d?.html??"";if(p!==""&&n.id!==null)p=`<!--${Hu} ${n.id} ${encodeURIComponent(u)}-->${p}<!--/${Hu} ${n.id}-->`;if(d?.content)return u0(e.children,t,n),p;let m=_l(e,t,n,r,s);return p===""?m:m===""?p:`${p}
|
|
192
|
+
${m}`}let i=r?.componentDefs.get(o);if(i&&r)return T1(e,i,t,n,r);let a=Lo(e,t);if(Yg.has(o))return`<${o}${a}>`;let l=_l(e,t,n,r,s||ms.has(o));return`<${o}${a}>${l}</${o}>`}function T1(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:a}=ey(e.attributes),l={...i,...e.$props},c={};for(let[O,N]of Object.entries(l))c[O]=tt(N,n)??N;let u=Object.keys(c).length>0,d={...ty(t,a,n),...c},p=Object.keys(d).length>0,m=s.path??[],y={key:JSON.stringify(d),tag:o},S=[...m.map((O)=>O.tag),o].join(" → ");if(m.some((O)=>O.tag===y.tag&&O.key===y.key))throw Error(`Component <${o}> renders itself: ${S}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(m.length>=ah)throw Error(`Component nesting exceeds ${ah} levels: ${S}. A component that renders itself with changing props needs a case that stops.`);let g={...s,path:[...m,y]},{children:x}=e,P=(O)=>Fo(O,n,r,s),w=Rn(t,s.defaults),E=!oy(o,t,s.liveTags),j=Dl(t,p?d:null),A,T=null;if(w){let O=Array.isArray(x)?x.map((N)=>P(N)).join(`
|
|
193
|
+
`):"";A=`<template shadowrootmode="${w}"><link rel="stylesheet" href="${Rf(o)}">${_l(t,j,null,g)}</template>${O}`}else{T=!E&&Ns(t.children)?Zg(s):null;let O=Qg(x,n,P,T);A=_l(t,j,O,g)}let I=Object.entries(ry(t.style,j)).map(([O,N])=>`${hn(O)}: ${N}`).join("; "),V={...e};delete V.$props,delete V.children;let H={...a,...ny(t.attributes,j)};if(V.attributes=!E&&u?{...H,"data-jx-props":JSON.stringify(c)}:H,T!==null)V.attributes={...V.attributes,[ml]:String(T)};if(E)V.$static=!0;else V.$prerendered=!0;return`<${o}${Lo(V,n,I)}>${A}</${o}>`}function d0(e,t=null,n=null,r=null){return _l(e,Dl(e,t),n,r)}function oy(e,t,n){return n?n.has(e):!m0(t)}function lf(e,t){let n=new Set,r=(s,o)=>{if(Array.isArray(s)){for(let i of s)r(i,!1);return}if(!D(s))return;if(Le(s)){r(s.map,!1);return}if(!o){for(let i of Yo(s.tagName))if(t.has(i))n.add(i)}r(s.children,!1);for(let i of Object.values(s.cases??{}))if(!Xe(i))r(i,!1)};return r(e,!0),n}function p0(e,t){let n=(i)=>{let a=new Set(i),l=[...a];for(let c=l.pop();c!==void 0;c=l.pop())for(let u of lf(e.get(c),e))if(!a.has(u))a.add(u),l.push(u);return a},r=t?n(lf(t,e)):void 0,s=new Set,o=[];for(let[i,a]of e)if(!m0(a)){if(s.add(i),!r||r.has(i))o.push(i)}for(let i of n(o))s.add(i);return s}function Cf(e,t){let n=new Set(e),r=new Set,s=[],o=(i)=>{if(r.has(i))return;r.add(i);let a=t.get(i);if(a)for(let l of[...lf(a,t)].toSorted())o(l);if(n.has(i))s.push(i)};for(let i of[...e].toSorted())o(i);return s}function m0(e){if(Tl(e).length>0)return!1;return El(e)}function El(e){if(!D(e))return!0;if(Array.isArray(e))return e.every((t)=>El(t));if(Le(e))return Array.isArray(e.items)&&e.filter===void 0&&e.sort===void 0&&e.key===void 0&&(e.map===void 0||El(e.map));if(e.$prototype)return!1;if(e.$switch!==void 0||rr(e.tagName))return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!D(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)=>El(t));if(Le(e.children))return El(e.children);return!0}function Rf(e){return`/components/${e}.css`}function h0(e,t,n,r){let s=new Set([e]),o=[n.get(e)??""],i=(a)=>{for(let l of lf(t.get(a)??{},t)){if(s.has(l)||r.has(l))continue;s.add(l),o.push(n.get(l)??""),i(l)}};return i(e),o.join("")}function Nf(e,t,n=null,r={},s=null){let o=[],i=Mv(e,s),a={host:s===null?"light":"shadow"};if(s!==null)a.shadowTree=!0;let l=D(t)?t:{};if(Uv(o,"display"in l?l:{display:"block",...l},i,r,a),n){let c={n:0};for(let u of Of(n))Af(u,o,r,"",c,e,{shadowTree:s!==null})}return o.length>0?`${o.join(`
|
|
153
194
|
`)}
|
|
154
|
-
`:""}var
|
|
155
|
-
${e.slice(n)}`}function
|
|
156
|
-
`)}function
|
|
157
|
-
`):e.body??"").includes("await ")}var
|
|
158
|
-
`)}var ov;var dg=R(()=>{le();Rt();fg();Br();ov=new Map});import{dirname as dv}from"node:path";async function mc(e,t,n,r={}){let s={},{state:o}=e;if(!o)return s;let i=[],a={docDir:t.sourcePath?dv(t.sourcePath):null,imports:e.imports,projectRoot:n,registry:r.registry};for(let[c,l]of Object.entries(o)){if(!yn(l))continue;if(jI.has(l.$prototype))continue;let u=`"${c}" ($prototype "${l.$prototype}")`;if(l.timing&&l.timing!=="compiler"){let d=r.registry?.byName(l.$prototype);if(d?.capabilities.lower)try{let p=await d.call("lower",l,{projectConfig:r.config,root:n,route:t});if(L(p)){let m=p.$bundle;if(Array.isArray(m)){for(let x of m)if(k(x))r.registerBundle?.(x)}delete p.$bundle}o[c]=p,s[c]=p}catch(p){i.push(`${u}: its class could not lower it: ${ge(p)}`)}continue}try{let d=zu(l,a);if(d===void 0){if(l.timing==="compiler"&&Gh(l))i.push(`${u} names no class: give it a $src or an imports entry, or enable the extension that provides "${l.$prototype}"`);continue}let p=await cv(d),{value:m}=await lv(p,PI(l,t,n,o,r));if(r.asInitialValues)o[c]={default:m??null};else{if(l.timing&&L(m))m.timing=l.timing;o[c]=m}s[c]=o[c]}catch(d){let p=l.timing?"":' (set "timing": "client" if it must run in the browser)';i.push(`${u}: ${ge(d)}${p}`)}}if(i.length>0)throw Error(i.length===1?`state entry ${i[0]}`:`${i.length} state entries could not be resolved: ${i.join("; ")}`);return s}function PI(e,t,n,r,s){let o={...Kh(e)};if(o.src&&!o.basePath&&t.sourcePath)o.basePath=dv(t.sourcePath);return o._project={config:s.config??null,root:n,...s.sections},o._document={route:t,state:r},o}var jI;var pg=R(()=>{le();Rt();Yn();dg();jI=new Set(["Function","LocalStorage","SessionStorage","Array"])});import{readFileSync as mg,readdirSync as _I,statSync as kI}from"node:fs";import{extname as mv,join as OI,relative as AI,resolve as CI}from"node:path";async function Qr(e,t){let n=mg(e,"utf8");if(Hr(e))return mr(Bn(n,e),e);let r=mv(e).toLowerCase(),s=t?.byExtension(r,"parse");if(!s)throw Error(`No format class registered for "${r}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return mr(await s.parseDocument(n),e)}async function hv(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await NI(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,RI(o,s._pathParams))}return n}function RI(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function NI(e,t){if(!mg(e,"utf8").includes("$translationKey"))return null;let n;try{n=await Qr(e,t)}catch{return null}return k(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function gv(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await yv(e,e,n,r,t),n.sort(JS),n}async function yv(e,t,n,r,s){let o=_I(e,{withFileTypes:!0});for(let i of o){let a=OI(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await yv(a,t,n,r,s);continue}let c=mv(i.name).toLowerCase();if(!r.has(c))continue;if(i.name.startsWith("_"))continue;let l=AI(t,a);n.push(await TI(l,a,s))}}async function TI(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=TS(e),a=null;try{let l=(await Qr(t,n)).$layout;if(k(l))a=l}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function JI(e){let t=e[Ku];if(!L(t))return null;let{mtime:n}=t;return k(n)&&n!==""?n:null}function xv(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 bv(e,t,n={},r,s,o,i={}){let a=[],c=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},l=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await Qr(u.sourcePath,r?.formats)}catch{a.push(u);continue}if(!d.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let p;try{p=DS(d.$paths)}catch(x){c(u,ge(x));continue}if(p!==null){let x=Kn(u.urlPattern,o??null),g=p.each===void 0?[{}]:await pv(p.each,t,n,r,s,x,u,l);for(let y of g){let S=await II(u,d,p,y,{locale:x,projectConfig:s,projectRoot:t,registry:r,report:c,sections:n});a.push(...S)}continue}let m=await pv(d.$paths,t,n,r,s,Kn(u.urlPattern,o??null),u,l);for(let x of m){let g=u.urlPattern,y={};for(let[j,P]of Object.entries(x)){if(j===Ku)continue;y[j]=String(P),g=g.replace(`:${j}`,y[j]),g=g.replace("*",y[j])}let S=xv(g);if(S!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${g}", which ${S}; skipping it`);continue}let E=JI(x),v={...u,_pathParams:y,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:g};if(E!==null)v.sourceMtime=E;a.push(v)}}return a}function $v(e,t){let n=e;for(let[r,s]of Object.entries(t)){let o=new RegExp(`:${r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);n=o.test(n)?n.replace(o,()=>s):n.replace("*",()=>s)}return n}async function II(e,t,n,r,s){let o={};for(let[x,g]of Object.entries(r))if(x!==Ku)o[x]=String(g);let i=e.params.filter((x)=>!(x in o));if(i.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${i.length}`),[];let a=i[0];if(t.state?.[n.key]===void 0)return s.report(e,`$paths.paginate names state entry "${n.key}", which this page does not declare`),[];let c=$v(e.urlPattern,o),l=xv(c);if(l!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${c}", which ${l}; skipping it`),[];let u;try{u=await MI(t,n.key,e,o,s)}catch(x){return s.report(e,ge(x)),[]}if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=DI(u,e.sourcePath),p=Vp(u.length,n.pageSize),m=[];for(let x=1;x<=p;x++){let g={...e,_pathParams:{...o,[a]:String(x)},isCatchAll:!1,isDynamic:!1,pagedState:{items:MS(u,x,n.pageSize),key:n.key},pagination:FS(c,x,n.pageSize,u.length),params:[],urlPattern:jo(c,x)};if(d!==null)g.sourceMtime=d;m.push(g)}return m}function DI(e,t){let n=null,r=kI(t).mtime.getTime();for(let s of e){let o=L(s)?s[Ku]:void 0,i=L(o)?o.mtime:void 0;if(k(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function MI(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=lg(s.projectRoot);for(let[u,d]of Object.entries(s.projectConfig?.imports??{}))i[u]=d.startsWith("./")||d.startsWith("../")?a(d,n):d;Object.assign(i,e.imports);let c={imports:i,state:{[t]:structuredClone(o)}},l={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:$v(n.urlPattern,r)};return await mc(c,l,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),c.state?.[t]}async function pv(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let c=k(e.param)?e.param:"value";return e.values.map((l)=>({[c]:l}))}if("$ref"in e&&k(e.$ref)&&e.$ref){let c=e.$ref,l=CI(t,c),u;try{u=JSON.parse(mg(l,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${c}": ${ge(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${c}" must be a JSON array`),[];let d=k(e.param)?e.param:"id",p=k(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${c}" contains a null entry`);return{[d]:(L(m)?m[p]??m.id:void 0)??String(m)}})}for(let c of Object.keys(e)){let l=r?.byPathsDiscriminator(c);if(!l?.project)continue;let u={data:n[l.project.key],locale:o,projectConfig:s,root:t};if(i!==void 0)u.params=i.params,u.urlPattern=i.urlPattern;if(a!==void 0)u.patterns=a;return await l.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var Ku="_meta";var hg=R(()=>{ui();le();ms();Rt();IS();LS();cg();ug();pg()});import{createHash as FI}from"node:crypto";function Sv(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Ro(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function gg(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function zI(e){return`'sha256-${FI("sha256").update(e,"utf8").digest("base64")}'`}function wv(e,t){for(let n of e.matchAll(VI)){let r=n[1]??"",s=Ro(r,"src"),o=(Ro(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=gg(s);if(i)t.scriptOrigins.add(i);continue}if(LI.has(o))t.scriptHashes.add(zI(n[2]??""))}for(let n of e.matchAll(qI)){let r=n[1]??"",s=(Ro(r,"rel")??"").toLowerCase(),o=Ro(r,"href"),i=gg(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(BI.test(o??"")||(Ro(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[WI,t.imgOrigins],[HI,t.imgOrigins],[UI,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Ro(o,"src"),...KI(Ro(o,"srcset"))]){let a=gg(i);if(a)r.add(a)}}}function KI(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function GI(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function vv(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 Ev(e,t,n="SAMEORIGIN"){let r=(a,c)=>[...a,...c].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":GI(n),"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!=="")s["report-to"]="csp-endpoint",s["report-uri"]=t.reportUri;for(let[a,c]of Object.entries(t.directives??{}))s[a]=c;let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[c])=>a<c?-1:1).map(([a,c])=>`${a} ${String(c)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":o}:{"Content-Security-Policy":o};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var LI,VI,qI,WI,HI,UI,BI;var yg=R(()=>{LI=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),VI=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,qI=/<link\b([^>]*)>/gi,WI=/<img\b([^>]*)>/gi,HI=/<source\b([^>]*)>/gi,UI=/<iframe\b([^>]*)>/gi,BI=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Gu,readFileSync as XI,writeFileSync as Pv}from"node:fs";import{join as Xu}from"node:path";function _v(e,t){let n=e?.headers??{},r=[];if(n.enabled===!1)return{errors:r,rules:[]};let s=n.security??{},o={};if(s.contentTypeOptions!==!1)o["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)o["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)o["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)o["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:i}=s;if(i){let u=i===!0?{}:i,d=u.maxAge??jv,p=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!p)r.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else o["Strict-Transport-Security"]=[`max-age=${d}`,p?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=vv(s);if(a)if(t===void 0)r.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(o,Ev(t,a,s.frameOptions));let c=n.cache??"auto";if(c==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let l=[];if(Object.keys(o).length>0)l.push({headers:o,pattern:"/*"});if(c==="auto")l.push({headers:{"Cache-Control":`public, max-age=${jv}, immutable`},pattern:YI});for(let[u,d]of Object.entries(n.rules??{}))l.push({headers:d,pattern:u});return{errors:r,rules:l}}function kv(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"]],n=[];for(let[r,s]of t)if(Gu(Xu(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if(Gu(Xu(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function Ov(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:Ie(t,n.pattern)}))}function eD(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
|
|
159
|
-
`)});return`${[
|
|
195
|
+
`:""}var b1,Fv,Ts="https://esm.sh/@vue/reactivity@3.5.40",Nr="https://esm.sh/lit-html@3.3.0",vl,S1,v1,E1,j1,P1,Wv,O1,A1,ms,C1,Vo="__jxAttrText",qi="__jxListItems",Kv="__jxRowKeys",Rl="__jxLiteral",Nl="__jxKeyed",Sf,Wg="__jxSupplies",Bg="__jxNativeSetter",vf="__jxAbsorbAttr",Qv="__jxServerCall",R1,N1,e0="__jxInstantiate",Kg="__jxAssociateForm",Gg="__jxCaptureSlotted",Xg="__jxDistributeSlots",Wi="<!---->",r0,Yg;var yn=J(()=>{$i();Mi();uh();Ai();Fu();Rv();Jv();ce();Sl();_i();Mi();Ai();Fu();ce();Ai();b1=["$map/","event#/","$args/","$reduce/"];Fv=Symbol("jx.runtimeOnlyStateKeys");vl=String.raw`(?:\s|\\[nrt])*`,S1=new RegExp(String.raw`(?:=|\.\.\.)${vl}state[ \t]*(?:[;,)}\]"]|\\[nr])`);v1=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,E1=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,j1=/[\w$.]/u,P1=/[\w$]/u;Wv=["hidden","tabIndex","title","lang","dir"],O1=new Set([...Wv,"id","className"]),A1=new Set([...pr,...O1,"textContent","innerHTML"]);ms=new Set(["pre","textarea","listing","plaintext","xmp"]);C1=[];Sf=["import { AsyncDirective, directive } from 'lit-html/async-directive.js';","import { repeat } from 'lit-html/directives/repeat.js';"];R1=new Set(["$prototype","$src","$export","timing","default","description"]);N1=new Set(tg);r0=Symbol("jx.styleHandle");Yg=new Set(["input","br","hr","img","meta","link","area","col","source"])});import{relative as J1,sep as M1}from"node:path";function Ll(e){return e===I1}function zi(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Tf(e,t){let n=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return n===null?null:n[1]??n[2]??n[3]??""}function g0(e){let t=e.search(/<\/head\s*>/i),n=t===-1?e:e.slice(0,t);for(let[r]of n.matchAll(/<meta\b[^>]*>/gi)){if(Tf(r,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Tf(r,"content")??"").toLowerCase().split(",").map((o)=>o.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function y0(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function D1(e,t){let n=t.trim().toLowerCase();for(let[r]of y0(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Tf(r,"rel")??"").toLowerCase().split(/\s+/),o=(Tf(r,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&o===n)return!0}return!1}function x0(e,t){let{end:n}=y0(e);if(n===-1||D1(e,t.type))return e;let r=`<link href="${Ne(t.href)}" rel="alternate" type="${Ne(t.type)}">`;return`${e.slice(0,n)}${r}
|
|
196
|
+
${e.slice(n)}`}function b0(e,t){return new URL(`/${J1(e,t).split(M1).join("/")}`,"http://localhost").pathname}var I1="/404";var iy=J(()=>{yn()});function $0(e,t){if(t===null||t.routing!=="prefix-always")return[];let n=[];for(let r of e){if(r.urlPattern==="/")continue;let s=r.urlPattern.split("/").find(Boolean),o=Bn(s);if(o===null||!t.locales.includes(o))n.push(r.urlPattern)}return n}function S0(e,t){if(t===null)return null;let n=e.split("/").find(Boolean),r=Bn(n);if(n===void 0||r===null||t.locales.includes(r))return null;let s=t.locales.find((o)=>o!==r&&o.split("-")[0]===r.split("-")[0]);return s===void 0?null:{meant:s,segment:n}}function L1(e,t){let n=e.split("/").filter(Boolean),r=Bn(n[0]);if(t!==null&&r!==null&&t.locales.includes(r))return n.slice(1).join("/");return n.join("/")}function ay(e,t){let n=new Map,r=[];if(t===null)return{conflicts:r,sets:n};let s=new Map,o=new Set;for(let i of e){let a=i.translationKey===void 0?L1(i.urlPattern,t):i.translationKey.replaceAll(/^\/+|\/+$/g,"");if(i.translationKey!==void 0)o.add(i.urlPattern);let l=cr(i.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((d)=>d.locale===l);if(u===void 0)c.push({locale:l,urlPattern:i.urlPattern});else r.push({declared:o.has(u.urlPattern)||i.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.urlPattern,i.urlPattern]});s.set(a,c)}for(let i of s.values()){let a=i.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of i)n.set(l.urlPattern,a)}return{conflicts:r,sets:n}}function w0(e,t,n,r){let s=new Map;if(t===null||n==="")return s;let o=new Map;for(let[i,a]of ay(e,t).sets){if(a.length<2)continue;let l=o.get(a);if(l===void 0){l=a.map((u)=>({href:Cs(zi(u.urlPattern,r),n),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:Cs(zi(c.urlPattern,r),n),hreflang:"x-default"});o.set(a,l)}s.set(i,l)}return s}function v0({pageLang:e,pageDir:t,routeLocale:n,defaults:r}){let s=e??n??r?.lang??"en",o=t??r?.dir;if(o!==void 0)return{dir:o,lang:s};return al(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var ly=J(()=>{An();Jo();iy();Jo();Jo()});function E0(e,t,n,r=null,s=null,o=[]){if(!e.state)e.state={};let i={};if(s!==null)i.defaultLocale=s.defaultLocale,i.locales=s.locales;e.state.$site={...Object.fromEntries(Object.entries(t.state??{}).filter(([u])=>!F1.has(u))),name:t.name??"Jx Site",url:t.url??"",...i};let a=(k(e.$lang)?e.$lang:void 0)??cr(n.urlPattern,s)??t.defaults?.lang,l=o.map((u)=>({code:u.locale,current:u.urlPattern===n.urlPattern,dir:al(u.locale),label:Kw(u.locale),url:u.urlPattern})),c={params:n._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:n.urlPattern};if(l.length>0)c.alternates=l;if(n.pagination){let{first:u,itemCount:d,last:p,next:m,number:y,pageCount:S,pageSize:g,pages:x,prev:P}=n.pagination;c.pagination={first:u,itemCount:d,last:p,next:m,number:y,pageCount:S,pageSize:g,pages:x.map(({current:w,number:E,url:j})=>({current:w,number:E,url:j})),prev:P}}if(a!==void 0)c.dir=al(a),c.locale=a;if(e.state.$page=c,t.state){for(let[u,d]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=d}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,d]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=r&&(d.startsWith("./")||d.startsWith("../"))?r(d,n):d}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,d=[];for(let p of[...t.$elements,...e.$elements]){let m=k(p)?p:D(p)?p.$ref:void 0;if(m&&!u.has(m))u.add(m),d.push(p)}e.$elements=d}return e}var F1;var j0=J(()=>{ce();Jo();F1=new Set(["defaultLocale","locales","name","url"])});import{dirname as V1,relative as q1,resolve as H1}from"node:path";function cy(e){return(t,n)=>{if(!n.sourcePath)return t;return`./${q1(V1(n.sourcePath),H1(e,t))}`}}function P0(e,t,n,r=null,s=null,o=[]){return E0(e,t,n,r===null?null:cy(r),s,o)}var uy=J(()=>{j0()});function Fl(e){let t=Fw(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=B1(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,a=W1(i)?i:void 0,l=s?.methods??{},c=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(t.$id)c.push(`// Source: ${t.$id}`);c.push("");let u=U1(t.extends);if(u!==null)c.push(u,"");let d=r!=="Object"?` extends ${r}`:"";c.push(`class ${n}${d} {`);for(let[p,m]of Object.entries(o)){if(m.scope!=="static")continue;let y=m.identifier??p,S=m.access==="private"?"#":"",g=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` static ${S}${y} = ${g};`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;if(m.access!=="private")continue;let y=m.identifier??p;c.push(` #${y};`)}if(Object.keys(o).length>0)c.push("");if(c.push(" constructor(config = {}) {"),a?.superCall||r!=="Object"){let p=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";c.push(` super(${p});`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;let y=m.identifier??p,S=m.access==="private"?"#":"",g=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` this.${S}${y} = config.${y} !== undefined ? config.${y} : ${g};`)}if(a?.body){let p=Array.isArray(a.body)?a.body:[a.body];for(let m of p)c.push(` ${m}`)}c.push(" }");for(let[p,m]of Object.entries(l)){let y=m.identifier??p,S=m.scope==="static",x=m.access==="private"?"#":"",P=S?"static ":"",w=m.returnType?.$ref?.includes("Promise")||K1(m)?"async ":"",E=_0(m.parameters??[]),j=z1(m.body);if(c.push(""),m.role==="accessor"){if(m.getter)c.push(` ${P}get ${x}${y}() {`,` ${m.getter.body}`," }");if(m.setter){let A=_0(m.setter.parameters??[])||"v";c.push(` ${P}set ${x}${y}(${A}) {`,` ${m.setter.body}`," }")}}else{c.push(` ${P}${w}${x}${y}(${E}) {`);for(let A of j)c.push(` ${A}`);c.push(" }")}}return c.push("}","",`export { ${n} };`,`export default ${n};`,""),c.join(`
|
|
197
|
+
`)}function W1(e){return typeof e==="object"}function B1(e){if(!e)return"Object";if(k(e))return e;if(e.$ref){let t=e.$ref.match(k0);return t?t[1]:"Object"}return"Object"}function U1(e){if(!e||k(e)||!e.$ref)return null;let t=e.$ref.match(k0);if(!t)return null;let[n=""]=e.$ref.split("#"),r=n.replace(/\.class\.json$/,".js"),s=/^(?:\.{0,2}\/|[a-z][a-z0-9+.-]*:)/i.test(r)?r:`./${r}`;return`import ${t[1]} from ${JSON.stringify(s)};`}function _0(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return k(n)?n:"arg"}).join(", ")}function z1(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function K1(e){return(Array.isArray(e.body)?e.body.join(`
|
|
198
|
+
`):e.body??"").includes("await ")}var k0;var fy=J(()=>{Ei();ce();k0=/([A-Za-z0-9_]+)\.class\.json/});import{createHash as G1}from"node:crypto";import{mkdirSync as X1,readFileSync as Y1,rmSync as Z1,writeFileSync as Q1}from"node:fs";import{createRequire as eD}from"node:module";import{tmpdir as tD}from"node:os";import{dirname as C0,join as O0,resolve as Jf}from"node:path";import{pathToFileURL as nD}from"node:url";function Mf(e,t){let n=e.$src??t.imports?.[e.$prototype]??t.registry?.byName(e.$prototype)?.classPath;if(!n)return;let r;if(n.startsWith("./")||n.startsWith("../"))r=Jf(t.docDir??t.projectRoot,n);else r=eD(Jf(t.projectRoot,"package.json")).resolve(n);let s=Qb(Y1(r,"utf8"),r);return{classDef:s,classJsonPath:r,exportName:e.$export??s.title??e.$prototype}}function R0(e){let t=e.classDef.extends;if(t!==void 0&&!k(t))throw Error(`${e.classJsonPath} has no $implementation and extends another class document ("${t.$ref}"), which a site build does not compile: give it an $implementation`)}function rD(e){R0(e);let t=Fl(e.classDef),n=G1("sha256").update(t).digest("hex").slice(0,16),r=A0.get(n);if(r===void 0){let s=O0(tD(),`jx-class-${process.pid}`);X1(s,{recursive:!0});let o=O0(s,`${e.classDef.title}-${n}.mjs`);Q1(o,t,"utf8"),r=import(nD(o).href).then((i)=>i.default).finally(()=>{Z1(o,{force:!0})}),A0.set(n,r)}return r}async function N0(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return rD(e);let s=await om(Jf(C0(n),t.$implementation)),o=s[r]??s.default?.[r];if(!_t(o))throw Error(`Module ${t.$implementation} does not export "${r}"`);return o}function sD(e){return"resolve"in e&&_t(e.resolve)}function oD(e){return"value"in e}async function T0(e,t){let n=new e(t);if(sD(n))return{instance:n,value:await n.resolve()};if(oD(n))return{instance:n,value:n.value};return{instance:n,value:n}}function J0(e){return JSON.stringify(e).includes('"#/$context/')}function M0(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return R0(e),Fl(t);let s=CS(Jf(C0(n),t.$implementation)),o=JSON.stringify(r);return[`import * as m from ${JSON.stringify(s)};`,`export default m[${o}] ?? m.default?.[${o}];`,""].join(`
|
|
199
|
+
`)}var A0;var dy=J(()=>{ce();Lt();fy();is();A0=new Map});import{dirname as I0}from"node:path";async function Vl(e,t,n,r={}){let s={},{state:o}=e;if(!o)return s;let i=[],a={docDir:t.sourcePath?I0(t.sourcePath):null,imports:e.imports,projectRoot:n,registry:r.registry};for(let[l,c]of Object.entries(o)){if(!Pn(c))continue;if(iD.has(c.$prototype))continue;let u=`"${l}" ($prototype "${c.$prototype}")`;if(c.timing&&c.timing!=="compiler"){let d=r.registry?.byName(c.$prototype);if(d?.capabilities.lower)try{let p=await d.call("lower",c,{projectConfig:r.config,root:n,route:t});if(L(p)){let m=p.$bundle;if(Array.isArray(m)){for(let y of m)if(k(y))r.registerBundle?.(y)}delete p.$bundle}o[l]=p,s[l]=p}catch(p){i.push(`${u}: its class could not lower it: ${be(p)}`)}continue}try{let d=Mf(c,a);if(d===void 0){if(c.timing==="compiler"&&zg(c))i.push(`${u} names no class: give it a $src or an imports entry, or enable the extension that provides "${c.$prototype}"`);continue}let p=await N0(d),{value:m}=await T0(p,aD(c,t,n,o,r));if(r.asInitialValues)o[l]={default:m??null};else{if(c.timing&&L(m))m.timing=c.timing;o[l]=m}s[l]=o[l]}catch(d){let p=c.timing?"":' (set "timing": "client" if it must run in the browser)';i.push(`${u}: ${be(d)}${p}`)}}if(i.length>0)throw Error(i.length===1?`state entry ${i[0]}`:`${i.length} state entries could not be resolved: ${i.join("; ")}`);return s}function aD(e,t,n,r,s){let o={...Ug(e)};if(o.src&&!o.basePath&&t.sourcePath)o.basePath=I0(t.sourcePath);return o._project={config:s.config??null,root:n,...s.sections},o._document={route:t,state:r},o}var iD;var py=J(()=>{ce();Lt();yn();dy();iD=new Set(["Function","LocalStorage","SessionStorage","Array"])});import{readFileSync as my,readdirSync as lD,statSync as cD}from"node:fs";import{extname as L0,join as uD,relative as fD,resolve as dD}from"node:path";async function hs(e,t){let n=my(e,"utf8");if(Vn(e))return Ar(kn(n,e),e);let r=L0(e).toLowerCase(),s=t?.byExtension(r,"parse");if(!s)throw Error(`No format class registered for "${r}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return Ar(await s.parseDocument(n),e)}async function F0(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await mD(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,pD(o,s._pathParams))}return n}function pD(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function mD(e,t){if(!my(e,"utf8").includes("$translationKey"))return null;let n;try{n=await hs(e,t)}catch{return null}return k(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function V0(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await q0(e,e,n,r,t),n.sort(qw),n}async function q0(e,t,n,r,s){let o=lD(e,{withFileTypes:!0});for(let i of o){let a=uD(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await q0(a,t,n,r,s);continue}let l=L0(i.name).toLowerCase();if(!r.has(l))continue;if(i.name.startsWith("_"))continue;let c=fD(t,a);n.push(await hD(c,a,s))}}async function hD(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=Vw(e),a=null;try{let c=(await hs(t,n)).$layout;if(k(c))a=c}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function gD(e){let t=e[If];if(!L(t))return null;let{mtime:n}=t;return k(n)&&n!==""?n:null}function H0(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 W0(e,t,n={},r,s,o,i={}){let a=[],l=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await hs(u.sourcePath,r?.formats)}catch{a.push(u);continue}if(!d.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let p;try{p=Ww(d.$paths)}catch(y){l(u,be(y));continue}if(p!==null){let y=cr(u.urlPattern,o??null),S=p.each===void 0?[{}]:await D0(p.each,t,n,r,s,y,u,c);for(let g of S){let x=await yD(u,d,p,g,{locale:y,projectConfig:s,projectRoot:t,registry:r,report:l,sections:n});a.push(...x)}continue}let m=await D0(d.$paths,t,n,r,s,cr(u.urlPattern,o??null),u,c);for(let y of m){let S=u.urlPattern,g={};for(let[E,j]of Object.entries(y)){if(E===If)continue;g[E]=String(j),S=S.replace(`:${E}`,g[E]),S=S.replace("*",g[E])}let x=H0(S);if(x!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${S}", which ${x}; skipping it`);continue}let P=gD(y),w={...u,_pathParams:g,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:S};if(P!==null)w.sourceMtime=P;a.push(w)}}return a}function B0(e,t){let n=e;for(let[r,s]of Object.entries(t)){let o=new RegExp(`:${r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);n=o.test(n)?n.replace(o,()=>s):n.replace("*",()=>s)}return n}async function yD(e,t,n,r,s){let o={};for(let[y,S]of Object.entries(r))if(y!==If)o[y]=String(S);let i=e.params.filter((y)=>!(y in o));if(i.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${i.length}`),[];let a=i[0];if(t.state?.[n.key]===void 0)return s.report(e,`$paths.paginate names state entry "${n.key}", which this page does not declare`),[];let l=B0(e.urlPattern,o),c=H0(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u;try{u=await bD(t,n.key,e,o,s)}catch(y){return s.report(e,be(y)),[]}if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=xD(u,e.sourcePath),p=Jm(u.length,n.pageSize),m=[];for(let y=1;y<=p;y++){let S={...e,_pathParams:{...o,[a]:String(y)},isCatchAll:!1,isDynamic:!1,pagedState:{items:Bw(u,y,n.pageSize),key:n.key},pagination:Uw(l,y,n.pageSize,u.length),params:[],urlPattern:To(l,y)};if(d!==null)S.sourceMtime=d;m.push(S)}return m}function xD(e,t){let n=null,r=cD(t).mtime.getTime();for(let s of e){let o=L(s)?s[If]:void 0,i=L(o)?o.mtime:void 0;if(k(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function bD(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=cy(s.projectRoot);for(let[u,d]of Object.entries(s.projectConfig?.imports??{}))i[u]=d.startsWith("./")||d.startsWith("../")?a(d,n):d;Object.assign(i,e.imports);let l={imports:i,state:{[t]:structuredClone(o)}},c={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:B0(n.urlPattern,r)};return await Vl(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function D0(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=k(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&k(e.$ref)&&e.$ref){let l=e.$ref,c=dD(t,l),u;try{u=JSON.parse(my(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${be(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let d=k(e.param)?e.param:"id",p=k(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[d]:(L(m)?m[p]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=r?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:n[c.project.key],locale:o,projectConfig:s,root:t};if(i!==void 0)u.params=i.params,u.urlPattern=i.urlPattern;if(a!==void 0)u.patterns=a;return await c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var If="_meta";var hy=J(()=>{Ei();ce();os();Lt();Hw();zw();ly();uy();py()});import{createHash as $D}from"node:crypto";function U0(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Ho(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function gy(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function kD(e){return`'sha256-${$D("sha256").update(e,"utf8").digest("base64")}'`}function z0(e,t){for(let n of e.matchAll(wD)){let r=n[1]??"",s=Ho(r,"src"),o=(Ho(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=gy(s);if(i)t.scriptOrigins.add(i);continue}if(SD.has(o))t.scriptHashes.add(kD(n[2]??""))}for(let n of e.matchAll(vD)){let r=n[1]??"",s=(Ho(r,"rel")??"").toLowerCase(),o=Ho(r,"href"),i=gy(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(_D.test(o??"")||(Ho(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[ED,t.imgOrigins],[jD,t.imgOrigins],[PD,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Ho(o,"src"),...OD(Ho(o,"srcset"))]){let a=gy(i);if(a)r.add(a)}}}function OD(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function AD(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function K0(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 G0(e,t,n="SAMEORIGIN"){let r=(a,l)=>[...a,...l].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":AD(n),"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!=="")s["report-to"]="csp-endpoint",s["report-uri"]=t.reportUri;for(let[a,l]of Object.entries(t.directives??{}))s[a]=l;let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[l])=>a<l?-1:1).map(([a,l])=>`${a} ${String(l)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":o}:{"Content-Security-Policy":o};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var SD,wD,vD,ED,jD,PD,_D;var yy=J(()=>{SD=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),wD=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,vD=/<link\b([^>]*)>/gi,ED=/<img\b([^>]*)>/gi,jD=/<source\b([^>]*)>/gi,PD=/<iframe\b([^>]*)>/gi,_D=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Df,readFileSync as CD,writeFileSync as Y0}from"node:fs";import{join as Lf}from"node:path";function Z0(e,t){let n=e?.headers??{},r=[];if(n.enabled===!1)return{errors:r,rules:[]};let s=n.security??{},o={};if(s.contentTypeOptions!==!1)o["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)o["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)o["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)o["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:i}=s;if(i){let u=i===!0?{}:i,d=u.maxAge??X0,p=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!p)r.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else o["Strict-Transport-Security"]=[`max-age=${d}`,p?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=K0(s);if(a)if(t===void 0)r.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(o,G0(t,a,s.frameOptions));let l=n.cache??"auto";if(l==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(o).length>0)c.push({headers:o,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${X0}, immutable`},pattern:RD});for(let[u,d]of Object.entries(n.rules??{}))c.push({headers:d,pattern:u});return{errors:r,rules:c}}function Q0(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"]],n=[];for(let[r,s]of t)if(Df(Lf(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if(Df(Lf(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function eE(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:Fe(t,n.pattern)}))}function JD(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
|
|
200
|
+
`)});return`${[ND,"",...t].join(`
|
|
160
201
|
`)}
|
|
161
|
-
`}function
|
|
162
|
-
${
|
|
202
|
+
`}function tE(e,t){if(t.length===0)return 0;let n=Lf(e,"_headers"),r=Df(n)?CD(n,"utf8").trim():"",s=JD(t),o=r===""?s:`${s}
|
|
203
|
+
${TD}
|
|
163
204
|
${r}
|
|
164
|
-
`;return
|
|
165
|
-
`)}function
|
|
205
|
+
`;return Y0(n,o,"utf8"),1}function nE(e){let t=Lf(e,".nojekyll");if(Df(t))return 0;return Y0(t,"","utf8"),1}var RD="/images/_optimized/*",X0=31536000,ND="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",TD="# ─── public/_headers (hand-authored; these rules override the block above) ───";var rE=J(()=>{An();yy()});async function sE(e,t,n,r={}){let s={},o=am(e);for(let i of n.projectContributions()){let a=i.project?.key;if(!a||!i.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await i.call("projectData",t[a],{io:o,projectConfig:t,registry:n,root:e,...r.lazy===!0&&{lazy:!0},...r.includeHeld===!0&&{includeHeld:!0}})}return s}var oE=J(()=>{is()});import{cpSync as MD,existsSync as ID,mkdirSync as DD}from"node:fs";import{dirname as LD,resolve as FD}from"node:path";async function iE(e,t,n){let r=[],s=[],o=new Map;for(let i of e.assetProviders()){let a=i.project?.key,l=a?t[a]:void 0;if(a&&(l==null||D(l)&&Object.keys(l).length===0))continue;try{let c=await i.call("assets",l??null,{projectConfig:t,root:n});for(let u of c??[]){if(!D(u)||!u.urlPrefix||!u.dir)continue;let d={dir:u.dir,urlPrefix:yu(u.urlPrefix)};if(_t(u.filter))d.filter=u.filter;let p=o.get(d.urlPrefix);if(p){if(p.dir!==d.dir)s.push(`Asset mount conflict: "${d.urlPrefix}" is claimed by both "${p.dir}" and "${d.dir}"`);continue}o.set(d.urlPrefix,d),r.push(d)}}catch(c){s.push(`Error in ${i.name}.assets: ${be(c)}`)}}return{errors:s,mounts:r}}function Ff(e,t,n){if(t.length===0||!e)return;for(let r of HS(e,t))n.add(r)}function aE(e,t,n){let r=0,s=[];for(let o of e){let i=xu(t,o);if(!i||!ID(i)){s.push(o);continue}let a=FD(n,decodeURIComponent(o).replace(/^\//,""));DD(LD(a),{recursive:!0}),MD(i,a),r+=1}return{copied:r,missing:s}}var lE=J(()=>{An();ce();Lt()});import{readFileSync as VD}from"node:fs";import{dirname as qD,isAbsolute as HD,relative as WD,resolve as cE,sep as BD}from"node:path";function Vf(e,t){return`${e}${t==="client"?xy:by}`}function GD(e){if(e.endsWith(xy))return{documentPath:e.slice(0,-xy.length),side:"client"};if(e.endsWith(by))return{documentPath:e.slice(0,-by.length),side:"server"};return null}function Ki(e,t,n){return pl(e,uE(t,n))}function uE(e,t){return WD(t,e).split(BD).join("/")}function XD(e){return kn(VD(e,"utf8"),e)}function fE(e,t=XD){let n=new Map,r=(c)=>uE(c,e),s=(c)=>{let u=n.get(c);if(u===void 0)u=(async()=>t(c))(),n.set(c,u);return u},o=async(c,u)=>{let d;try{d=await s(c)}catch(S){throw Error(`Cannot read ${r(c)} for its ${u} script`,{cause:S})}let p=d.$script?.[u];if(p===void 0)throw Error(`${r(c)} has no ${u} script: nothing in it is $script.${u}, but something names its ${u} module`);let[m,...y]=Mw(p).problems;if(m!==void 0)throw new Cu({path:r(c),pointer:`/$script/${u}`},[m,...y]);return p},i=(c)=>{let u=Ni(c);if(u===null)return null;return{documentPath:cE(e,u.path),side:u.side}},a=(c)=>({name:`jx-document-scripts-${c}`,setup:(u)=>{u.onResolve({filter:zD},({path:d})=>{let p=i(d);if(p===null)return;if(p.side==="server"&&c==="client")throw Error(`${r(p.documentPath)}: its server script cannot be imported by code a browser runs`);return{path:Vf(p.documentPath,p.side)}}),u.onResolve({filter:KD},({importer:d,path:p})=>{if(HD(p))return{path:Vf(p,"client")};return p.startsWith("./")||p.startsWith("../")?{path:Vf(cE(qD(d),p),"client")}:void 0}),u.onLoad({filter:UD},async({path:d})=>{let p=GD(d);return{contents:await o(p.documentPath,p.side),loader:"ts"}})}}),l=async(c)=>{let u=i(c);if(u===null)throw Error(`"${c}" does not name a document's script`);return{contents:await o(u.documentPath,u.side),path:Vf(u.documentPath,u.side)}};return{clientPlugin:a("client"),module:l,serverPlugin:a("server")}}var xy=".jx-client.ts",by=".jx-server.ts",UD,zD,KD;var qf=J(()=>{Ru();Ti();os();UD=/\.jx-(?:client|server)\.ts$/,zD=/^jx-script:/,KD=/\.jxn$/});async function $y(e,t,n){let r=e.$layout??t.defaults?.layout??null;if(!r)return e;let s=await n(r);if(s.$layout)s=await $y(s,t,n);let o=e.children??[],i=k(o)?[o]:Array.isArray(o)?o:[],a=ZD(s);if(YD(a,i),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 YD(e,t){let n=new Map,r=[];for(let s of t){let o=D(s)?s.attributes?.slot:void 0;if(o){let i=n.get(o);if(!i)i=[],n.set(o,i);i.push(s)}else r.push(s)}dE(e,n,r)}function dE(e,t,n){if(!D(e))return;if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(D(s)&&s.tagName==="slot"){let o=s.attributes?.name,i=o?t.get(o):void 0;if(o&&i)r.push(...i),t.delete(o);else if(!o&&n.length>0)r.push(...n);else if(Array.isArray(s.children))r.push(...s.children)}else dE(s,t,n),r.push(s);e.children=r}function ZD(e){return structuredClone(e)}var pE=J(()=>{ce()});import{existsSync as QD,readFileSync as eL}from"node:fs";import{resolve as mE}from"node:path";function hE(e){return(t)=>{let n=mE(e,t);if(!QD(n))throw Error(`Layout not found: ${t} (resolved to ${n})`);try{let r=kn(eL(n,"utf8"),n);return Ki(Ar(r,n),n,e)}catch(r){throw Error(`Invalid layout at ${n}: ${be(r)}`,{cause:r})}}}function gE(e,t,n){return $y(e,t,hE(n))}function Hf(e,t,n){let r=hE(n),s=[],o=e.$layout??t.defaults?.layout;while(o){let i=mE(n,o);if(s.some((l)=>l.path===i))break;let a=r(o);s.push({doc:a,path:i}),o=a.$layout}return s}var Sy=J(()=>{Ei();qf();os();Lt();pE()});import{existsSync as yE,readdirSync as tL}from"node:fs";import{dirname as nL,isAbsolute as rL,relative as sL,resolve as wy}from"node:path";function oL(e){let{$elements:t}=e;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(L(r)&&k(r.$ref)&&r.$ref!=="")n.push(r.$ref);return n}async function xE(e){let{formatRegistry:t,pageSources:n,projectConfig:r,projectRoot:s}=e,o=[],i=[],a=new Set,l=new Map,c=(m)=>sL(s,m).replaceAll("\\","/"),u=async(m,y)=>{if(a.has(m))return;let S=c(m),g=y?`${y.declarer}: $elements entry "${y.ref}" names`:"";if(y){if(S.startsWith("..")||rL(S)){a.add(m),i.push(`${g} ${S}, outside the project`);return}if(!yE(m)){a.add(m),i.push(`${g} no file (${S})`);return}}a.add(m);let x;try{x=Ki(await hs(m,t),m,s)}catch(E){i.push(`Error compiling component ${S}: ${be(E)}`);return}let P=k(x.tagName)?x.tagName:"";if(!P.includes("-")){i.push(y?`${g} ${S}, which is not a component (no hyphenated tagName)`:`Error compiling component ${S}: tagName "${P}" must contain a hyphen`);return}let w=l.get(P);if(w!==void 0){i.push(`${c(w)} and ${S} both declare tagName "${P}"; rename one`);return}l.set(P,m),o.push({doc:x,path:m,tagName:P}),await d(x,m)},d=async(m,y,S=nL(y))=>{for(let g of oL(m))await u(wy(S,g),{declarer:c(y),ref:g})},p=wy(s,"components");if(yE(p)){let m=[".json",...t.documentExtensions("component")],y=tL(p).filter((S)=>m.some((g)=>S.endsWith(g))).toSorted();for(let S of y)await u(wy(p,S),null)}await d(r,qn(s),s);for(let m of new Set(n))try{let y=await hs(m,t),S=Hf(y,r,s);await d(y,m);for(let g of S)await d(g.doc,g.path)}catch{}return{components:o,errors:i}}var bE=J(()=>{ce();Lt();Eo();qf();Sy();hy()});import{dirname as iL,relative as aL,resolve as lL,sep as cL}from"node:path";function $E(e,t){return aL(t,e).split(cL).join("/")}function uL(e,t,n){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${$E(lL(t,e),n)}`}function ql(e,t,n){let r=iL(t),s=$E(t,n);return l0(e).map((o)=>({exportName:o.exportName,src:uL(o.src,r,n),declaredIn:s}))}function SE(e){let t=new Map;for(let{exportName:s,src:o,declaredIn:i}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(o))a.set(o,i)}let n=[],r=[];for(let[s,o]of t){let i=[...o];if(n.push({exportName:s,src:i[0][0]}),i.length>1){let a=i.map(([l,c])=>`${l} (declared in ${c})`);r.push(`Server function "${s}" is exported by ${i.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:n,errors:r}}var wE=J(()=>{yn()});function vE(e,t){if(!k(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function EE(e=[],t=[],n=[],r={}){let s=[{attributes:{charset:r.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],o=new Map;for(let a of[...s,...e,...t,...n]){let l=vy(a);o.set(l,a)}let i=r.title??r.siteName??"Jx Site";if(o.set("title",{children:[i],tagName:"title"}),r.pageUrl&&r.siteUrl){let a=Cs(r.pageUrl,r.siteUrl);if(![...o.values()].some((c)=>D(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};o.set(vy(c),c)}if(!o.has("meta:og:url"))o.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(r.siteName&&!o.has("meta:og:site_name"))o.set("meta:og:site_name",{attributes:{content:r.siteName,property:"og:site_name"},tagName:"meta"});for(let a of r.alternates??[]){let l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=vy(l);if(!o.has(c))o.set(c,l)}return[...o.values()]}function vy(e){if(!D(e))return String(e);let t=e.tagName??"unknown",n=e.attributes??{};if(t==="title")return"title";if(n.charset)return"meta:charset";if(t==="meta"&&n.name)return`meta:${n.name}`;if(t==="meta"&&n.property)return`meta:${n.property}`;if(t==="link"&&n.rel){let r=n.hreflang??n.type??n.media??n.sizes??"";return`link:${n.rel}:${n.href??""}:${String(r)}`}if(t==="script"&&n.src)return`script:${n.src}`;if(t==="style"){let r=Array.isArray(e.children)?e.children.join(""):e.textContent,s=D(r)?JSON.stringify(r):r??"";return`style:${fL(s)}`}return`${t}:${JSON.stringify(e)}`}function fL(e){let t=0;for(let n=0;n<e.length;n++)t=Math.trunc((t<<5)-t+(e.codePointAt(n)??0));return t.toString(36)}function jE(e){return e.map((t)=>dL(t)).join(`
|
|
206
|
+
`)}function dL(e){if(k(e))return e;if(!D(e))return"";let t=e.tagName,n=e.attributes??{},r=Object.entries(n).map(([l,c])=>c===!0?l:`${l}="${pL(c)}"`).join(" "),s=r?`<${t} ${r}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let i=Array.isArray(e.children)?e.children.join(""):e.textContent,a=D(i)?JSON.stringify(i,null,2):i??"";return`${s}${a}</${t}>`}function pL(e){return String(e).replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}var PE=J(()=>{An();ce()});function gL(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 yL(e){if(!k(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let n=t.toLowerCase();return!mL.has(n)&&!hL.has(n)&&!gL(t)})}function _E(e){let t=new Set;for(let n of e){if(!D(n)||n.tagName!=="link")continue;for(let r of yL(n.attributes?.rel))t.add(r)}return[...t]}var mL,hL;var kE=J(()=>{ce();mL=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"]),hL=new Set(["shortcut"])});function bL(e){let t=JSON.stringify(e);return/^\.{1,2}\//u.test(e)?`new URL(${t}, import.meta.url).href`:t}async function Gi(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function a(l,c){let u,d;if(k(l)){let{readFileSync:T}=await import("node:fs"),{resolve:I}=await import("node:path");if(d=c?I(c,l):I(l),i.has(d))return;if(i.add(d),Vn(d))u=kn(T(d,"utf8"),d);else{let{extname:V}=await import("node:path"),H=V(d).toLowerCase(),O=s?.byExtension(H,"parse");if(!O){await Promise.resolve().then(() => is());throw du(d,H)}u=await O.parseDocument(T(d,"utf8"))}if(u=Ar(u,d),t.projectRoot!==void 0){let{relative:V}=await import("node:path");u=pl(u,V(t.projectRoot,d))}}else{if(u=Ar(l,l.tagName??"a component"),d=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}await t.prepareDocument?.(u,d);let p=u.state??{};u=df(u,t.projectState);let{tagName:m}=u;if(!m||!m.includes("-"))throw Error(`compileElement: tagName "${m}" must contain a hyphen`);let{dirname:y}=await import("node:path"),S=d?y(d):null,g=[];if(Array.isArray(u.$elements))for(let T of u.$elements){let I=me(T)?T.$ref:T;if(!k(I))continue;if(S)await a(I,S);let V=n?n(I,S):I.replace(/\.(?:json|jxn)$/i,".js");g.push(V)}let x=Ms(m);if(r)u.$media={...r,...u.$media};let{resolveClass:P,rewriteSrc:w}=t,E=u.imports??{},j=Ey(u,x,g,w?(T)=>w(T,S):void 0,Rn(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((T)=>!(T in p)),P?(T)=>P(T,S,E):void 0,t.stylesheetHref?.(m)??null),A=d?d.replace(/\.(?:json|jxn)$/i,".js"):`${m}.js`;o.push({content:j,path:A,tagName:m})}return await a(e,t.basePath??null),{files:o}}async function $L(e,t={}){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr}=t,o=await Gi(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(i.path),c=`<!DOCTYPE html>
|
|
166
207
|
<html lang="en">
|
|
167
208
|
<head>
|
|
168
209
|
<meta charset="utf-8">
|
|
169
210
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
170
|
-
<title>${
|
|
171
|
-
|
|
172
|
-
{
|
|
173
|
-
"imports": {
|
|
174
|
-
"@vue/reactivity": "${r}",
|
|
175
|
-
"lit-html": "${s}"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
</script>
|
|
211
|
+
<title>${Ne(n)}</title>
|
|
212
|
+
${Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
179
213
|
</head>
|
|
180
214
|
<body>
|
|
181
215
|
<${i.tagName}></${i.tagName}>
|
|
182
|
-
<script type="module" src="./${
|
|
216
|
+
<script type="module" src="./${l}"></script>
|
|
183
217
|
</body>
|
|
184
|
-
</html>`;return{files:o.files,html:l}}function FD(e){if(!I(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(os(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(ki(e))return"null";if(Mr(e))return"null";return JSON.stringify(e)}function jg(e,t,n,r,s=null,o="/_jx/server",i=[],a){let c=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)c.push(`// Source: ${e.$id}`);for(let M of n)c.push(`import '${M}';`);let l=e.state??{},u=_o(e),d=Ru(Cu(l,u),r);c.push(...d.imports);let p=Mu(l,a),m=p.entries.length>0;c.push(...p.imports);let x=Object.entries(l).flatMap(([M,D])=>yn(D)&&D.$prototype==="Request"?[[M,D]]:[]),g=Object.entries(l).flatMap(([M,D])=>Mr(D)?[[M,D]]:[]);c.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",Tu());let y=Object.keys(l).filter((M)=>!kd(M)),S=y.filter((M)=>!DD.has(M)),E=S.filter((M)=>i.includes(M)),v=E.length>0;if(c.push(`const __jxProps = ${JSON.stringify(y)};`),S.length>0)c.push(`const __jxBridged = ${JSON.stringify(S)};`,kw());if(v)c.push(`const __jxInherited = new Set(${JSON.stringify(E)});`);let j=cc(e);if(j.length>0)c.push(Ow(),`const __jxObserved = ${JSON.stringify(j)};`,`const __jxObservedDefaults = () => ${Cw(e)};`);if(g.length>0)c.push(Iu());if(m)c.push(Du());let P=s===null&&ws(e.children);if(P)c.push(Tw());c.push(...d.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...s===null?[]:[" #root = null;"],...m?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...j.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[]," constructor() {"," super();");let O=[],T=[],U=[],F=[],H=[];for(let[M,D]of Object.entries(l))if(gn(D))if(Dr(D))F.push([M,D]);else if(xr(D.$expression.operator))U.push([M,D]);else T.push([M,D]);else if(kt(D))(u.get(M)==="computed"?T:U).push([M,D]);else if(k(D)&&D.includes("${"))H.push([M,D]);else{let X=FD(D);if(X!==void 0)O.push([M,X])}c.push(" this.state = reactive({");for(let[M,D]of O)c.push(` ${Xr(M)}: ${D},`);c.push(" });");for(let[M,D]of U)if(c.push(""),gn(D)){let X=Xt(D.$expression,{eventParam:"e",statePrefix:"s"});c.push(` ${Re("this.state",qt(M))} = (s, e) => { ${X}; };`)}else if(cr(D)){let X=Tn(D.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});c.push(` ${Re("this.state",qt(M))} = (s, e) => {`,X," };")}else{let X=Re("this.state",qt(M));if(D.$src)c.push(` ${X} = ${M};`);else{let re=k(D.body)?D.body:"";c.push(` ${X} = (${hr(D).join(", ")}) => {`,` ${re}`," };")}}for(let[M,D]of F){c.push("");let X=Xt(D.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",qt(M))} = ${ic(D,X)};`)}for(let[M,D]of H)c.push("",` ${Re("this.state",qt(M))} = computed(() => ${Nu(ji(D,"this.state",{code:!1}))});`);for(let[M,D]of T)if(c.push(""),gn(D)){let X=Xt(D.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",qt(M))} = computed(() => ${X});`)}else if(D.$src)c.push(` ${Re("this.state",qt(M))} = computed(() => ${M}(this.state));`);else{c.push(` ${Re("this.state",qt(M))} = computed(() => {`);let X=ji(k(D.body)?D.body:"","this.state");c.push(` ${X}`," });")}c.push(" }","");let A={n:0};for(let M of Vu(e))Dw(M,A,e.tagName??"jx");let N=i0(),B=!Array.isArray(e.children)&&e.textContent!==void 0?` ${sf(e.textContent)}`:nf(e.children,e.style," ",!1,!1,N);if(c.push(" template() {"," const s = this.state;",...N.decls," return html`",B," `;"," }","",...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 _first = !this.#rendered;"," this.#rendered = true;",...v?[" const _given = new Set();"]:[],...j.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${Ju}(this.state, _a, this.getAttribute(_a), _d);`," }"," }"]:[]," 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;",v?" if (__jxProps.includes(k)) { this.state[k] = v; _given.add(k); }":" if (__jxProps.includes(k)) 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 (__jxProps.includes(_k)) {"," this.state[_k] = this.getAttribute(_n);",...v?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),S.length>0)c.push(" if (_first) {"," for (const _k of __jxBridged) {",` if (_k in this && this[_k] !== undefined && ${Bh}(this, _k)) {`," this.state[_k] = this[_k];",...v?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...v?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],` const _set = ${zh}(this, _k);`," Object.defineProperty(this, _k, {"," configurable: true,"," get: () => this.state[_k],"," set: (v) => { if (_set) _set.call(this, v); this.state[_k] = v; },"," });"," }"," }");if(m)c.push(` this.#jxReady ??= ${Fu(p.entries,{indent:" ",instances:"this.#jxInstances",statePrefix:"this.state"})};`," const _c = ++this.#jxConnection;"," this.#jxReady.then(() => {"," if (_c === this.#jxConnection && this.isConnected) this.#jxRender();"," });"," }",""," #jxRender() {"," const _first = !this.#jxDrawn;"," this.#jxDrawn = true;");for(let[M,D]of x)c.push(Pu(M,D,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[M,D]of g)c.push(_u(M,D,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(I(e.style)){let M=[];for(let[D,X]of Object.entries(e.style)){if(D.startsWith(":")||D.startsWith(".")||D.startsWith("&")||D.startsWith("[")||D.startsWith("@"))continue;if(k(X)&&X.includes("${"))M.push([on(D),X])}if(M.length>0){c.push(" this.#effects.push(effect(() => {");for(let[D,X]of M){let re=X.replaceAll(/\$\{([^}]+)\}/g,(ue,xe)=>`\${${ji(xe,"this.state")}}`);c.push(` this.style['${D}'] = \`${re}\`;`)}c.push(" }));")}}if(P)c.push(` const _slotted = _first ? ${Xh}(this) : null;`);if(c.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)c.push(" if (_first) this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else c.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(P)c.push(` if (_first) ${Yh}(this, _slotted);`);if(c.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }"),"onAdopted"in l)c.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(j.length>0)c.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${Ju}(this.state, name, newVal, __jxObservedDefaults());`," }");return c.push("}","",`customElements.define('${e.tagName}', ${t});`,""),c.join(`
|
|
185
|
-
`)}function
|
|
218
|
+
</html>`;return{files:o.files,html:c}}function SL(e){if(!D(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if($s(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Hi(e))return"null";if(Zr(e))return"null";return JSON.stringify(e)}function Ey(e,t,n,r,s=null,o="/_jx/server",i=[],a,l=null){let c=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)c.push(`// Source: ${e.$id}`);for(let B of n)c.push(`import '${B}';`);let u=e.state??{},d=Or(e),p=hf(mf(u,d),r);c.push(...p.imports);let m=Pf(u,a),y=m.entries.length>0;c.push(...m.imports);let S=Object.entries(u).flatMap(([B,q])=>Pn(q)&&q.$prototype==="Request"?[[B,q]]:[]),g=Object.entries(u).flatMap(([B,q])=>Zr(q)?[[B,q]]:[]),x=xf(e);if(c.push(x.keyed?"import { reactive, computed, effect, stop, shallowRef } from '@vue/reactivity';":"import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",...x.keyed?Sf:[],yf()),x.arranged||x.keyed)c.push($f());if(x.keyed)c.push(wf());let P=Object.keys(u).filter((B)=>!Zo(B)),w=P.filter((B)=>!xL.has(B)),E=w.filter((B)=>i.includes(B)),j=E.length>0;c.push(`const __jxProps = ${JSON.stringify(P)};`);let A=oh(e),T=w.filter((B)=>A.has(B));if(w.length>0)c.push(`const __jxBridged = ${JSON.stringify(w)};`,Gv());if(T.length>0)c.push(`const __jxDerived = new Set(${JSON.stringify(T)});`);if(j)c.push(`const __jxInherited = new Set(${JSON.stringify(E)});`);let I=Tl(e);if(I.length>0)c.push(Xv(),`const __jxObserved = ${JSON.stringify(I)};`,`const __jxObservedDefaults = () => ${Zv(e)};`);if(g.length>0)c.push(Ef());if(y)c.push(jf());let V=s===null&&Ns(e.children);if(V)c.push(n0());let H=e.formAssociated===!0;if(H)c.push(t0());c.push(...p.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...x.keyed?[" #part = null;"]:[],...s===null?[]:[" #root = null;"],...H?[" #internals;"," #form = null;"]:[],...y?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...I.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[],...H?[" static formAssociated = true;",""," #attach() {"," if (this.#internals === undefined) {"," this.#internals = typeof this.attachInternals === 'function' ? this.attachInternals() : null;"," }"," return this.#internals;"," }",""]:[]," constructor() {"," super();");let O=[],N=[],G=[],Q=[],re=[];for(let[B,q]of Object.entries(u))if(fn(q))if(wr(q))Q.push([B,q]);else if(dr(q.$expression.operator))G.push([B,q]);else N.push([B,q]);else if(kt(q))(d.get(B)==="computed"?N:G).push([B,q]);else if(k(q)&&q.includes("${"))re.push([B,q]);else{let z=SL(q);if(z!==void 0)O.push([B,z])}c.push(" this.state = reactive({");for(let[B,q]of O)c.push(` ${us(B)}: ${q},`);c.push(" });");for(let[B,q]of G)if(c.push(""),fn(q)){let z=gn(q.$expression,{eventParam:"e",statePrefix:"s"});c.push(` ${Re("this.state",Wt(B))} = (s, e) => { ${z}; };`)}else if(vr(q)){let z=zn(q.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = (s, e) => {`,z," };")}else{let z=Re("this.state",Wt(B));if(q.$src)c.push(` ${z} = ${B};`);else{let We=k(q.body)?q.body:"";c.push(` ${z} = (${kr(q).join(", ")}) => {`,` ${We}`," };")}}for(let[B,q]of Q){c.push("");let z=gn(q.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = ${kl(q,z)};`)}for(let[B,q]of re){let z=Fi(q,"this.state",{code:!1}),We=gf(z);c.push("",zf(z)?` ${Re("this.state",Wt(B))} = computed(() => { const state = this.state; return ${We}; });`:` ${Re("this.state",Wt(B))} = computed(() => ${We});`)}for(let[B,q]of N)if(c.push(""),fn(q)){let z=gn(q.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Re("this.state",Wt(B))} = computed(() => ${z});`)}else if(q.$src)c.push(` ${Re("this.state",Wt(B))} = computed(() => ${B}(this.state));`);else{c.push(` ${Re("this.state",Wt(B))} = computed(() => {`);let z=Fi(k(q.body)?q.body:"","this.state");c.push(` ${z}`," });")}let ue=wL(e);if(ue.length>0){c.push(""," {"," const s = this.state;");for(let{type:B,source:q}of ue)c.push(` this.addEventListener(${JSON.stringify(B)}, ${q});`);c.push(" }")}c.push(" }","");let ne={n:0};for(let B of Of(e))o0(B,ne,e.tagName??"jx");let fe=CE(),xe=!Array.isArray(e.children)&&e.textContent!==void 0?` ${Kf(e.textContent)}`:Bf(e.children,e.style," ",!1,!1,fe),X=[xe,...fe.decls].some((B)=>zf(B));if(c.push(" template() {"," const s = this.state;",...X?[" const state = s;"]:[],...fe.decls," return html`",xe," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?H?" const _a = this.#attach()?.shadowRoot ?? null;":" const _a = this.attachInternals().shadowRoot;":" const _a = this.shadowRoot;",` this.#root = _a ?? this.attachShadow({ mode: '${s}' });`,...l===null?[]:[` if (!_a) this.#root.append(Object.assign(document.createElement('link'), { rel: 'stylesheet', href: ${bL(l)} }));`]," return this.#root;"," }",""]," connectedCallback() {"," const _first = !this.#rendered;"," this.#rendered = true;",...x.keyed?[" this.#part?.setConnected(true);"]:[],...j?[" const _given = new Set();"]:[],...I.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${vf}(this.state, _a, this.getAttribute(_a), _d);`," }"," }"]:[]," 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;",j?" if (__jxProps.includes(k)) { this.state[k] = v; _given.add(k); }":" if (__jxProps.includes(k)) 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 (__jxProps.includes(_k)) {"," this.state[_k] = this.getAttribute(_n);",...j?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),w.length>0)c.push(" if (_first) {"," for (const _k of __jxBridged) {",...T.length>0?[" if (__jxDerived.has(_k)) continue;"]:[],` if (_k in this && this[_k] !== undefined && ${Wg}(this, _k)) {`," this.state[_k] = this[_k];",...j?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...j?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],...T.length>0?[" if (__jxDerived.has(_k)) {"," Object.defineProperty(this, _k, { configurable: true, get: () => this.state[_k] });"," continue;"," }"]:[],` const _set = ${Bg}(this, _k);`," Object.defineProperty(this, _k, {"," configurable: true,"," get: () => this.state[_k],"," set: (v) => { if (_set) _set.call(this, v); this.state[_k] = v; },"," });"," }"," }");if(y)c.push(` this.#jxReady ??= ${_f(m.entries,{indent:" ",instances:"this.#jxInstances",statePrefix:"this.state"})};`," const _c = ++this.#jxConnection;"," this.#jxReady.then(() => {"," if (_c === this.#jxConnection && this.isConnected) this.#jxRender();"," });"," }",""," #jxRender() {"," const _first = !this.#jxDrawn;"," this.#jxDrawn = true;");for(let[B,q]of S)c.push(cf(B,q,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[B,q]of g)c.push(uf(B,q,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(c.push(...vL(e)),D(e.style)){let B=[];for(let[q,z]of Object.entries(e.style)){if(q.startsWith(":")||q.startsWith(".")||q.startsWith("&")||q.startsWith("[")||q.startsWith("@"))continue;if(k(z)&&z.includes("${"))B.push([hn(q),z])}if(B.length>0){c.push(" this.#effects.push(effect(() => {");for(let[q,z]of B){let We=z.replaceAll(/\$\{([^}]+)\}/g,(qe,Ye)=>`\${${Fi(Ye,"this.state")}}`);c.push(` this.style['${q}'] = \`${We}\`;`)}c.push(" }));")}}if(V)c.push(` const _slotted = _first ? ${Gg}(this) : null;`);if(c.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)c.push(" if (_first) this.replaceChildren();",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), this); }));":" this.#effects.push(effect(() => render(this.template(), this)));");else c.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), _root); }));":" this.#effects.push(effect(() => render(this.template(), _root)));");if(V)c.push(` if (_first) ${Xg}(this, _slotted);`);if(H)c.push(" if (_first) {"," const _i = this.#attach();"," if (_i) {",` this.#form = ${Kg}(this, _i, this.state, ${JSON.stringify(kv(e))}, () => ${s===null?"this":"this.#renderRoot()"}, ${EL(e.formValue)}, (fn) => { this.#effects.push(effect(fn)); });`," }"," }"," if (this.#form) this.#form.start();");if(c.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {",...x.keyed?[" this.#part?.setConnected(false);"]:[]," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }"),"onAdopted"in u)c.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(H)c.push(""," formResetCallback() { if (this.#form) this.#form.reset(); }",""," formDisabledCallback(disabled) { if (this.#form) this.#form.disabled(disabled); }");if(I.length>0)c.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${vf}(this.state, name, newVal, __jxObservedDefaults());`," }");return c.push("}","",`customElements.define('${e.tagName}', ${t});`,""),c.join(`
|
|
219
|
+
`)}function CE(){return{byText:new Map,decls:[]}}function RE(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
|
|
186
220
|
${t}
|
|
187
|
-
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function
|
|
188
|
-
`)}function
|
|
221
|
+
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function Bf(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let a=i?Wi:"";if(Le(e))return`${AE(e,n)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(Le(l))return`${AE(l,n)}${a}`;let c=jy(l,r?"":n,r,s,o);return k(l)&&l.includes("${")||D(l)&&rr(l.tagName)?`${c}${a}`:c}).join(r?"":`
|
|
222
|
+
`)}function jy(e,t,n=!1,r=!1,s=null,o=null){if(k(e)){if(e.includes("${"))return`${t}${Kf(e)}`;return`${t}${Ne(e)}`}if(Ie(e)||Ge(e))return`${t}${Ne(String(e))}`;if(!D(e))return"";if(rr(e.tagName)){let g=e.tagName.$expression,x=fs(g.target,{eventParam:"e",statePrefix:"s"}),P=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],w=P.map(([,V])=>V),E=w.map((V)=>n||ms.has(V)),j=null;if(s&&E.every((V)=>V===E[0])){let V=OE(e,`${t} `,E[0]===!0,r,s,w.some((H)=>H.includes("-")));if(V.trim()!=="")j=RE(s,V)}let A=P.map(([V,H])=>{let O={...e,tagName:H};return[V,jy(O,`${t} `,n,r,s,j)]});if(g.operator==="?:"){let[,V]=A[0],[,H]=A[1];return`${t}\${${x}
|
|
189
223
|
? html\`
|
|
190
|
-
${
|
|
224
|
+
${V}
|
|
191
225
|
\`
|
|
192
226
|
: html\`
|
|
193
227
|
${H}
|
|
194
|
-
\`}`}let T=
|
|
228
|
+
\`}`}let T=A.flatMap(([V,H])=>V==="__default__"?[]:[` ${JSON.stringify(V)}: html\`
|
|
195
229
|
${H}
|
|
196
|
-
\``]),[,
|
|
230
|
+
\``]),[,I]=A.at(-1);return`${t}\${{
|
|
197
231
|
${T.join(`,
|
|
198
232
|
`)}
|
|
199
|
-
}[String(${
|
|
200
|
-
${
|
|
201
|
-
\`}`}let i=e.tagName??"div",a=n||
|
|
202
|
-
${t} ${
|
|
233
|
+
}[String(${x})] ?? html\`
|
|
234
|
+
${I}
|
|
235
|
+
\`}`}let i=e.tagName??"div",a=n||ms.has(i),l=[],c=NE(e,Xt,xn);if(e.attributes)for(let[g,x]of Object.entries(e.attributes)){if(g==="class"&&c!==null)continue;if(me(x))l.push(`${g}="\${${Vo}('${g}', ${xn(x.$ref)}) ?? nothing}"`);else if(k(x)&&Py(x))l.push(`${g}="\${${Vo}('${g}', ${Xt(x).slice(2,-1)}) ?? nothing}"`);else if(k(x)&&x.includes("${"))l.push(`${g}="${Xt(x)}"`);else if(Ge(x)){let P=Rr(g,x);if(P!==null)l.push(P===""?g:`${g}="${P}"`)}else l.push(`${g}="${x}"`)}if(e.id)l.push(`id="${Xt(String(e.id))}"`);if(c!==null)l.push(c);for(let[g,x]of Object.entries(e)){if(pr.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(Uf(x))l.push(`.${g}="\${${xn(x.$ref)}}"`);else if(k(x)&&x.includes("${"))l.push(`.${g}="${Xt(x)}"`);else l.push(`.${g}="\${${JSON.stringify(x)}}"`)}if(e.$props)for(let[g,x]of Object.entries(e.$props))if(Uf(x))l.push(`.${g}="\${${xn(x.$ref)}}"`);else if(k(x)&&x.includes("${"))l.push(`.${g}="${Xt(x)}"`);else l.push(`.${g}="\${${JSON.stringify(x)}}"`);let u=r?"s.$map = $map; ":"";for(let[g,x]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ps(`inline "${g}" handler`,x);let P=g.slice(2).toLowerCase(),w=_y(x,u);if(w!==null)l.push(`@${P}="\${${w}}"`)}let d=JE(e.style);if(d)l.push(`style="${d}"`);let p=l.length>0?`
|
|
236
|
+
${t} ${l.join(`
|
|
203
237
|
${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${p}
|
|
204
|
-
${t}>`;let
|
|
205
|
-
${t}>${
|
|
206
|
-
${
|
|
207
|
-
${
|
|
238
|
+
${t}>`;let y=o??OE(e,t,a,r,s,i.includes("-")),S=i==="slot"?Wi:"";return a?`${S}<${i}${p}>${y}${S}</${i}>`:`${t}${S}<${i}${p}
|
|
239
|
+
${t}>${y}${S}</${i}>`}function OE(e,t,n,r,s,o=!1){if(e.$switch){let i=me(e.$switch)?e.$switch.$ref:e.$switch,a=xn(i),l=[];for(let[p,m]of Object.entries(e.cases??{})){if(!m||me(m))continue;l.push([p,jy(m,`${t} `,!1,r,s)])}let c=l.map(([,p])=>p),u=new Set(c.filter((p,m)=>c.indexOf(p)!==m&&p.trim()!==""));return`\${{
|
|
240
|
+
${l.map(([p,m])=>{let y=s&&u.has(m)?RE(s,m):m;return` ${JSON.stringify(p)}: html\`
|
|
241
|
+
${y}
|
|
208
242
|
\``}).join(`,
|
|
209
243
|
`)}
|
|
210
|
-
}[${a}]}`}if(e.textContent!==void 0){let i=
|
|
211
|
-
${
|
|
212
|
-
${t}`;return""}function
|
|
213
|
-
${t} ${
|
|
214
|
-
${t} `)}`:"",
|
|
215
|
-
${
|
|
216
|
-
${t} `;let
|
|
217
|
-
${t} <${
|
|
218
|
-
${t} >${
|
|
219
|
-
${t}\``,
|
|
220
|
-
})(s, e);`;return`${
|
|
221
|
-
`}function
|
|
222
|
-
`:"",
|
|
244
|
+
}[${a}]}`}if(e.textContent!==void 0){let i=Kf(e.textContent),a=me(e.textContent)||k(e.textContent)&&e.textContent.includes("${");return o&&a?`${i}${Wi}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?Bf(e.children,e.style,"",!0,r,s,o):`
|
|
245
|
+
${Bf(e.children,e.style,`${t} `,!1,r,s,o)}
|
|
246
|
+
${t}`;return""}function AE(e,t){qo(e);let n=me(e.key),r=JSON.stringify(Array.isArray(e.items)?e.items:[]),s=n?`${Rl}(${JSON.stringify(r)})`:r;if(me(e.items))s=`(${xn(e.items.$ref)} ?? [])`;let o=me(e.filter)?xn(e.filter.$ref):"undefined",i=me(e.sort)?xn(e.sort.$ref):"undefined",a=me(e.filter)||me(e.sort),l=e.map;if(!l)return"";let c=l.tagName??"div",u=[],d=NE(l,Xt,Wf);if(l.attributes)for(let[E,j]of Object.entries(l.attributes)){if(E==="class"&&d!==null)continue;if(me(j))u.push(`${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`${E}="${Xt(j)}"`);else u.push(`${E}="${j}"`)}if(l.id)u.push(`id="${Xt(String(l.id))}"`);if(d!==null)u.push(d);for(let[E,j]of Object.entries(l)){if(pr.has(E)||E.startsWith("$")||E.startsWith("on")||E==="tagName"||E==="id"||E==="className"||E==="style"||E==="children"||E==="textContent"||E==="innerHTML"||E==="attributes")continue;if(Uf(j))u.push(`.${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`.${E}="${Xt(j)}"`);else u.push(`.${E}="\${${JSON.stringify(j)}}"`)}if(l.$props)for(let[E,j]of Object.entries(l.$props))if(me(j))u.push(`.${E}="\${${Wf(j.$ref)}}"`);else if(k(j)&&j.includes("${"))u.push(`.${E}="${Xt(j)}"`);else u.push(`.${E}="\${${JSON.stringify(j)}}"`);let p=JE(l.style);if(p)u.push(`style="${p}"`);for(let[E,j]of Object.entries(l)){if(!E.startsWith("on"))continue;ps(`inline "${E}" handler`,j);let A=E.slice(2).toLowerCase(),T=_y(j,"s.$map = $map; ");if(T!==null)u.push(`@${A}="\${${T}}"`)}let m=u.length>0?`
|
|
247
|
+
${t} ${u.join(`
|
|
248
|
+
${t} `)}`:"",y=CE(),S="";if(l.textContent!==void 0)S=Kf(l.textContent);else if(l.children)S=`
|
|
249
|
+
${Bf(l.children,null,`${t} `,!1,!0,y)}
|
|
250
|
+
${t} `;let g=`html\`
|
|
251
|
+
${t} <${c}${m}
|
|
252
|
+
${t} >${S}</${c}>
|
|
253
|
+
${t}\``,x=(g.includes("$map")?"const $map = { item, index }; ":"")+y.decls.map((E)=>`${E.trim()} `).join(""),P=x?`(item, index) => { ${x}return ${g}; }`:`(item, index) => ${g}`;if(me(e.key)){let E=e.key.$ref,j=[s,o,i,JSON.stringify(bf(E)),JSON.stringify(E),P];return`${t}\${${Nl}(${j.join(", ")})}`}let w=a?`${qi}(${s}, ${o}, ${i})`:s;return`${t}\${${w}.map(${P})}`}function NE(e,t,n){if(!Jl(e))return null;let r=Ml(e),s="";if(me(r))s=`\${${n(r.$ref)} ?? ""}`;else if(k(r))s=t(r);else if(Ie(r))s=String(r);let o=Js(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function Uf(e){return me(e)&&e.$ref!==""}function xn(e){let t=sn(e);if(t.startsWith("#/state/"))return Re("s",t.slice(8));if(t.startsWith("$map/"))return TE(t.slice(5));if(t.startsWith("parent#/"))return Re("s",t.slice(8));if(t.startsWith("window#/"))return Re("window",t.slice(8));if(t.startsWith("document#/"))return Re("document",t.slice(10));return Re("s",t)}function TE(e){let[t,...n]=Un(e);return Re(t??"",n.map((r)=>Wt(r)).join("/"))}function Wf(e){let t=sn(e);if(t.startsWith("$map/"))return TE(t.slice(5));return xn(t)}function Xt(e){return Fi(e,"s",{code:!1})}function Py(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function Kf(e){if(me(e))return`\${${xn(e.$ref)}}`;if(k(e)&&e.includes("${"))return Xt(e);return String(e)}function zf(e){let t=0,n="";for(let r=0;r<e.length;r++){let s=e.charAt(r);if(t===0){if(s==="$"&&e.charAt(r+1)==="{")t=1,n="",r+=1;continue}if(s==="{")t+=1;else if(s==="}"){if(t-=1,t===0){if(Vv(n))return!0;continue}}n+=s}return!1}function _y(e,t){if(Uf(e))return t?`(e) => { ${t}${xn(e.$ref)}(s, e); }`:`(e) => ${xn(e.$ref)}(s, e)`;if(D(e)&&"$expression"in e){let n=gn(e.$expression,{eventParam:"e",statePrefix:"s"});return`(e) => { ${t}${n}; }`}if(kt(e))return`(e) => { ${t}${jL(e)} }`;return null}function wL(e){let t=[];for(let[n,r]of Object.entries(e)){if(!n.startsWith("on")||pr.has(n))continue;ps(`root "${n}" handler`,r);let s=_y(r,"");if(s!==null)t.push({source:s,type:n.slice(2).toLowerCase()})}return t}function vL(e){let t=[],n=(r,s,o)=>[" this.#effects.push(effect(() => {",o?" const s = this.state, state = s;":" const s = this.state;",` const _v = ${Vo}(${r}, ${s});`,` if (_v === null || _v === undefined) this.removeAttribute(${r});`,` else this.setAttribute(${r}, String(_v));`," }));"];for(let[r,s]of Object.entries(e.attributes??{})){let o=JSON.stringify(r);if(me(s))t.push(...n(o,xn(s.$ref),!1));else if(k(s)&&Py(s)){let i=Xt(s);t.push(...n(o,i.slice(2,-1),zf(i)))}else if(k(s)&&s.includes("${")){let i=Xt(s);t.push(...n(o,`\`${i}\``,zf(i)))}else if(Ge(s)){let i=Rr(r,s);if(i!==null)t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(i)});`)}else if(k(s)||Ie(s))t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(String(s))});`)}return t}function EL(e){if(e===void 0)return"null";if(me(e))return`() => { const s = this.state; return ${xn(e.$ref)}; }`;if(k(e)&&e.includes("${")){let t=Xt(e);return`() => { const s = this.state, state = s; try { return ${Py(e)?t.slice(2,-1):`\`${t}\``}; } catch { return null; } }`}return`() => ${JSON.stringify(e)}`}function jL(e){if(vr(e))return zn(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=k(e.body)?e.body:"";if(Xa(e))return`((${kr(e).join(", ")}) => { ${t}
|
|
254
|
+
})(s, e);`;return`${Fi(t,"s",{bare:!0})}
|
|
255
|
+
`}function JE(e){if(!D(e))return"";let t=[];for(let[n,r]of Object.entries(e)){if(n.startsWith(":")||n.startsWith(".")||n.startsWith("&")||n.startsWith("[")||n.startsWith("@"))continue;if(k(r)&&r.includes("${")){let s=hn(n);t.push(`${s}: ${Xt(r)}`)}}return t.join("; ")}var xL;var Hl=J(()=>{Ei();Ti();$i();Mi();yn();ce();os();Sl();_i();xL=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formResetCallback","formDisabledCallback"])});function ME(e,t){let{title:n="Jx App"}=t,r=Li(e,null,e.state??{},e.$media??{}),s=Ui(e,e.$media??{},t.projectStyle??null),o=IE(e,r),i=[],a=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((c)=>fr(String(c))!==null)?`<script>${Vi()}</script>
|
|
256
|
+
`:"",l=`<!DOCTYPE html>
|
|
223
257
|
<html lang="en">
|
|
224
258
|
<head>
|
|
225
259
|
<meta charset="utf-8">
|
|
226
260
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
227
|
-
<title>${
|
|
261
|
+
<title>${Ne(n)}</title>
|
|
228
262
|
${a}
|
|
229
263
|
${s}
|
|
230
264
|
</head>
|
|
231
265
|
<body>
|
|
232
266
|
${o}
|
|
233
267
|
</body>
|
|
234
|
-
</html>`;return{files:i,html:
|
|
235
|
-
${
|
|
236
|
-
})()`)};`);else
|
|
268
|
+
</html>`;return{files:i,html:l}}function IE(e,t){if(k(e))return Ne(e);if(Ie(e)||Ge(e))return Ne(String(e));if(!D(e))return"";let n=Li(e,t.scope,e.state??t.scopeDefs,e.$media??t.media),r=Il(e.tagName,n.scope),s=Lo(e,n.scope);if(Yg.has(r))return`<${r}${s}>`;let o=t.preformatted===!0||ms.has(r),i=PL(e,r,{...n,preformatted:o});return`<${r}${s}>${i}</${r}>`}function PL(e,t,n){if(e.textContent!==void 0){let s=tt(e.textContent,n.scope);return s==null?"":Ne(String(s))}if(e.innerHTML){if(Di(e))return e.innerHTML;let s=tt(e.innerHTML,n.scope);return s==null?e.innerHTML:String(s)}let r=Al(e,t,n.scope);if(r!==void 0)return r;if(Array.isArray(e.children))return e.children.map((s)=>IE(s,n)).join(Cl(n.preformatted));return""}var DE=J(()=>{yn();ce()});function Ry(e,t){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,a=Li(e,null,e.state??{},e.$media??{}),l=Or(e),c=Ui(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0,textParts:!1},d=new Map,p=new Map,m=[],y=[],S=[],g=[],x=[],P=[],w=e.state??{},E=Pf(w,t.resolveClass);for(let[O,N]of Object.entries(w)){if(!D(N)||Array.isArray(N)){if(le(N))y.push([O,`() => ${gf(N)}`]);else m.push([O,N]);continue}if(fn(N)){let G=N.$expression,Q=gn(G,{eventParam:"e",statePrefix:"state"});if(wr(N))x.push(`state[${JSON.stringify(O)}] = ${kl(N,Q)};`);else if(dr(G.operator))g.push([O,{args:["state","e"],body:Q}]);else y.push([O,`() => ${Q}`]);continue}if(kt(N)){let{body:G}=N;if(Array.isArray(G)){let Q=zn(G,{eventParam:"e",statePrefix:"state"});if(N.parameters&&N.parameters.length>0)x.push(`state[${JSON.stringify(O)}] = ${kl(N,`(() => {
|
|
269
|
+
${Q}
|
|
270
|
+
})()`)};`);else g.push([O,{args:["state","e"],body:Q}])}else if(N.$src)if(l.get(O)==="computed")y.push([O,`() => { return ${O}(state); }`]);else x.push(`state[${JSON.stringify(O)}] = ${O};`),g.push([O,{args:["state","event"],body:`return ${O}(state, event);`}]);else if(k(G)&&l.get(O)==="computed")y.push([O,`() => { ${G} }`]);else g.push([O,{args:kr(N),body:G}]);continue}if($s(N))continue;if(jc(N)){m.push([O,N.default]);continue}if(Pn(N)){if(N.$prototype==="LocalStorage"||N.$prototype==="SessionStorage"){let G=N.$prototype==="LocalStorage"?"localStorage":"sessionStorage",Q=N.key??O,re=N.default??null;m.push([O,null]),x.push(AL(O,G,Q,re));continue}if(N.$prototype==="Request"){m.push([O,null]),x.push(cf(O,N));continue}if(N.$prototype==="Cookie"){m.push([O,null]),x.push(CL(O,N.name??O,N.default??null));continue}if(Hi(N)){m.push([O,null]);continue}}if(Zr(N)){m.push([O,null]),P.push(uf(O,N,{serverBaseUrl:i}));continue}m.push([O,N])}let j=LE(e,a,d,p,u);for(let[O,N]of d)if(!S.some(([G])=>G===O))S.push([O,N]);for(let[O,N]of p)if(!g.some(([G])=>G===O))g.push([O,N]);let A=mf(w,l),T=OL(m,y,S,g,x,P,A,u,r,t.rewriteSrc,E,xf(e)),I=Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports}),V=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((O)=>fr(String(O))!==null)?`<script>${Vi()}</script>
|
|
237
271
|
`:"",H=`<!DOCTYPE html>
|
|
238
272
|
<html lang="en">
|
|
239
273
|
<head>
|
|
240
274
|
<meta charset="utf-8">
|
|
241
275
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
242
|
-
<title>${
|
|
243
|
-
${
|
|
244
|
-
{
|
|
245
|
-
"imports": {
|
|
246
|
-
${U.join(`,
|
|
247
|
-
`)}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
</script>
|
|
251
|
-
${l}
|
|
276
|
+
<title>${Ne(n)}</title>
|
|
277
|
+
${V}${I}
|
|
278
|
+
${c}
|
|
252
279
|
<script type="module" src="./${o}"></script>
|
|
253
280
|
</head>
|
|
254
281
|
<body>
|
|
255
|
-
${
|
|
282
|
+
${j}
|
|
256
283
|
</body>
|
|
257
|
-
</html>`;return{files:[{content:T,path:o}],html:H}}function
|
|
258
|
-
${
|
|
259
|
-
\``),a.push(`:render="${g}"`),
|
|
284
|
+
</html>`;return{files:[{content:T,path:o}],html:H}}function LE(e,t,n,r,s){if(k(e)){if(!le(e))return Ne(e);let g=`_t${s.t}`;s.t+=1,s.textParts=!0,n.set(g,`() => \`${e}\``);let x=tt(e,t.scope),P=x==null?"":Ne(String(x));return`<!--jx-text:${g}-->${P}<!--/jx-text-->`}if(Ie(e)||Ge(e))return Ne(String(e));if(!D(e))return"";let o=Li(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(rr(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Yo(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let i=e.tagName??"div";o.preformatted=t.preformatted===!0||ms.has(i);let a=[],l=!1;if(e.textContent!==void 0){let g=e.textContent;if(Xe(g)){let x=Wl(g.$ref);a.push(`:text-content="${x}"`),Oy(n,x,g.$ref),l=!0}else if(le(g)){let x=`_t${s.t}`;s.t+=1,a.push(`:text-content="${x}"`),n.set(x,`() => \`${g}\``),l=!0}}for(let[g,x]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ps(`inline "${g}" handler`,x);let P=g.slice(2).toLowerCase();if(Xe(x)){let w=Wl(x.$ref);a.push(`@${P}="${w}"`),l=!0}else if(kt(x)){let w=`_h${s.h}`;s.h+=1,a.push(`@${P}="${w}"`);let{body:E}=x;r.set(w,Array.isArray(E)?{args:["state","e"],body:zn(E,{eventParam:"e",statePrefix:"state"})}:{args:Xa(x)?kr(x):["state","event"],body:E}),l=!0}else if(fn(x)){let w=`_h${s.h}`;s.h+=1,a.push(`@${P}="${w}"`);let E=gn(x.$expression,{eventParam:"e",statePrefix:"state"});r.set(w,{args:["state","e"],body:E}),l=!0}}if(D(e.style))for(let[g,x]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(HE(x))continue;if(le(x)){let P=`_s${s.s}`;s.s+=1,a.push(`:style.${hn(g)}="${P}"`),n.set(P,`() => \`${x}\``),l=!0}}if(D(e.attributes))for(let[g,x]of Object.entries(e.attributes)){let P=g==="class"?Js(e):void 0;if(P!==void 0&&(Xe(x)||le(x))){let w=`_t${s.t}`;s.t+=1;let E=Xe(x)?Cy(x.$ref):`\`${x}\``;a.push(`:attr.class="${w}"`),n.set(w,`() => [${E}, ${JSON.stringify(P)}].filter((c) => c != null && c !== "").join(" ")`),l=!0;continue}if(Xe(x)){let w=Wl(x.$ref);a.push(`:attr.${g}="${w}"`),Oy(n,w,x.$ref),l=!0}else if(le(x)){let w=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${w}"`),n.set(w,`() => \`${x}\``),l=!0}}for(let[g,x]of Object.entries(e)){if(pr.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(Xe(x)){let P=Wl(x.$ref);a.push(`:${hn(g)}="${P}"`),Oy(n,P,x.$ref),l=!0}else if(le(x)){let P=`_t${s.t}`;s.t+=1,a.push(`:${hn(g)}="${P}"`),n.set(P,`() => \`${x}\``),l=!0}}let c=Lo(e,o.scope),u=l?" data-bind":"",d=a.length>0?` ${a.join(" ")}`:"",p="",m=e;if(m.$switch){s.needsLit=!0;let g=`_sw${s.sw}`;s.sw+=1;let x=Xe(m.$switch)?Cy(m.$switch.$ref):`\`${String(m.$switch)}\``,P=m.cases??{},w=Object.entries(P).filter(([,j])=>j&&!Xe(j)).map(([j,A])=>`${JSON.stringify(j)}: html\`${Ay(A,o.preformatted)}\``);n.set(g,`() => ({${w.join(", ")}})[String(${x})] ?? html\`\``),a.push(`:render="${g}"`);let E=` ${a.join(" ")}`;return`<${i}${c} data-bind${E}></${i}>`}let y=Al(m,i,o.scope);if(m.textContent!==void 0&&!l){let g=tt(m.textContent,o.scope);p=g==null?"":Ne(String(g))}else if(m.textContent!==void 0&&l){let g=tt(m.textContent,o.scope);p=g==null?"":Ne(String(g))}else if(m.innerHTML){let g=Di(m)?m.innerHTML:tt(m.innerHTML,o.scope);p=g==null?m.innerHTML:String(g)}else if(y!==void 0)p=y;else if(Le(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let x=m.children;n.set(g,`() => ${qE(x)}`),a.push(`:render="${g}"`),l=!0;let P=" data-bind",w=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${P}${w}>`;return`<${i}${c}${P}${w}></${i}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>Le(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let x=m.children.map((w)=>Ay(w,o.preformatted)).join(Cl(o.preformatted," "));n.set(g,o.preformatted?`() => html\`${x}\``:`() => html\`
|
|
285
|
+
${x}
|
|
286
|
+
\``),a.push(`:render="${g}"`),l=!0;let P=` ${a.join(" ")}`;return`<${i}${c} data-bind${P}></${i}>`}else if(Array.isArray(m.children)){if(_L.has(i)&&m.children.some((g)=>le(g)))throw Error(`A template text child of <${i}> cannot be bound: HTML reads its content as text. Write it as the element's textContent.`);p=m.children.map((g)=>LE(g,o,n,r,s)).join(Cl(o.preformatted))}if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${u}${d}>`;return`<${i}${c}${u}${d}>${p}</${i}>`}function FE(e,t=!1){if(!e)return"";if(rr(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Yo(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||ms.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=Jl(e);if(o){let c=Ml(e),u="";if(Xe(c))u=`\${${Xi(c.$ref)} ?? ""}`;else if(k(c))u=Is(c);else if(Ie(c))u=String(c);let d=[u,Js(e)??""].filter((p)=>p!=="").join(" ");s+=` class="${d}"`}if(D(e.$props))for(let[c,u]of Object.entries(e.$props))if(Xe(u))s+=` .${c}="\${${Xi(u.$ref)}}"`;else if(le(u))s+=` .${c}="${Is(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`;if(D(e.attributes))for(let[c,u]of Object.entries(e.attributes)){if(o&&c==="class")continue;if(le(u)){s+=` ${c}="${Is(u)}"`;continue}if(Xe(u)){s+=` ${c}="\${${Xi(u.$ref)}}"`;continue}if(Ge(u)){let d=Rr(c,u);if(d!==null)s+=d===""?` ${c}`:` ${c}="${Ne(d)}"`;continue}s+=` ${c}="${Ne(String(u))}"`}if(D(e.style)){let c=[];for(let[u,d]of Object.entries(e.style)){if(u.startsWith(":")||u.startsWith(".")||u.startsWith("&")||u.startsWith("[")||u.startsWith("@"))continue;if(HE(d))continue;if(le(String(d)))c.push(`${hn(u)}: ${Is(String(d))}`)}if(c.length>0)s+=` style="${c.join("; ")}"`}for(let[c,u]of Object.entries(e)){if(!c.startsWith("on")||c==="observedAttributes")continue;ps(`inline "${c}" handler`,u);let d=c.slice(2).toLowerCase();if(Xe(u)){let p=Wl(u.$ref);s+=` @${d}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(vr(u)){let p=zn(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(kt(u)){let p=kL(u.body),m=Xa(u)?`((${kr(u).join(", ")}) => { ${p}
|
|
260
287
|
})(state, e);`:`${p}
|
|
261
|
-
`;s+=` @${d}=\${(e) => { state.$map = { item, index }; ${m}}}`}else if(
|
|
262
|
-
${
|
|
263
|
-
`;else if(Array.isArray(e.children)){let
|
|
264
|
-
${
|
|
288
|
+
`;s+=` @${d}=\${(e) => { state.$map = { item, index }; ${m}}}`}else if(D(u)&&"$expression"in u){let p=gn(u.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}for(let[c,u]of Object.entries(e)){if(pr.has(c)||c.startsWith("$")||c.startsWith("on")||c==="tagName"||c==="id"||c==="className"||c==="style"||c==="children"||c==="textContent"||c==="innerHTML"||c==="attributes")continue;if(Xe(u))s+=` .${c}="\${${Xi(u.$ref)}}"`;else if(le(u))s+=` .${c}="${Is(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`}let i=n.includes("-")?Wi:"",a="";if(e.textContent!==void 0){let c=String(e.textContent);if(le(c))a=`${Is(c)}${i}`;else if(Xe(e.textContent))a=`\${${Xi(e.textContent.$ref)}}${i}`;else a=Ne(c)}else if(e.innerHTML)a=Is(String(e.innerHTML));else if(Le(e.children))a=`
|
|
289
|
+
${VE(e.children)}${i}
|
|
290
|
+
`;else if(Array.isArray(e.children)){let c=e.children.map((u)=>{let d=Ay(u,r);return Le(u)||k(u)&&le(u)?`${d}${i}`:d});a=r?c.join(""):`
|
|
291
|
+
${c.join(`
|
|
265
292
|
`)}
|
|
266
|
-
`}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${a}</${n}>`}function
|
|
267
|
-
}; fn(state, e); },`);
|
|
268
|
-
`)}function
|
|
269
|
-
`)}function
|
|
270
|
-
`)}function
|
|
293
|
+
`}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${a}</${n}>`}function Ay(e,t=!1){if(k(e))return le(e)?Is(e):Ne(e);if(Ie(e)||Ge(e))return Ne(String(e));if(Le(e))return VE(e);return FE(e,t)}function VE(e){return`\${${qE(e)}}`}function ky(e){return sn(e).startsWith("$map/")?Xi(e):Cy(e)}function qE(e){qo(e);let{items:t,filter:n,sort:r,key:s}=e,o=Xe(s),i=JSON.stringify(t??[]),a=o?`${Rl}(${JSON.stringify(i)})`:i;if(Xe(t))a=ky(t.$ref);let l=Xe(n)?ky(n.$ref):"undefined",c=Xe(r)?ky(r.$ref):"undefined",u=`(item, index) => html\`${FE(e.map)}\``;if(o){let d=s.$ref,p=[`(${a} ?? [])`,l,c,JSON.stringify(bf(d)),JSON.stringify(d),u];return`${Nl}(${p.join(", ")})`}if(Xe(n)||Xe(r))return`${qi}(${a}, ${l}, ${c}).map(${u})`;return`(${a} ?? []).map(${u})`}function Is(e){return e.replaceAll("$map.","")}function kL(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function OL(e,t,n,r,s,o,i,a,l,c,u,d){let p=[],{needsLit:m,textParts:y}=a,S=t.length>0;p.push("// Generated by @jxsuite/compiler — do not edit manually");let g=["reactive","effect"];if(S)g.push("computed");if(d.keyed)g.push("stop","shallowRef");if(p.push(`import { ${g.join(", ")} } from '@vue/reactivity';`),m)p.push("import { html, render } from 'lit-html';");if(d.keyed)p.push(...Sf);let x=hf(i,c);if(p.push(...x.imports,...u.imports,...x.loaders,"",yf()),d.arranged||d.keyed)p.push($f());if(d.keyed)p.push(wf());if(o.length>0)p.push("",Ef());let P=u.entries.length>0;if(P)p.push("",jf(),"const _jxInstances = new Map();");p.push("","const state = reactive({");for(let[w,E]of e)p.push(` ${us(w)}: ${JSON.stringify(E)},`);if(p.push("});",""),s.length>0){for(let w of s)p.push(w);p.push("")}if(t.length>0){for(let[w,E]of t)p.push(`${Re("state",Wt(w))} = computed(${E});`);p.push("")}if(o.length>0){for(let w of o)p.push(w);p.push("")}if(n.length>0){p.push("const bind = {");for(let[w,E]of n)p.push(` ${us(w)}: ${E},`);p.push("};")}else p.push("const bind = {};");if(p.push(""),r.length>0){p.push("const on = {");for(let[w,E]of r)p.push(` ${us(w)}: (e) => { const fn = (${E.args.join(", ")}) => { ${E.body}
|
|
294
|
+
}; fn(state, e); },`);p.push("};")}else p.push("const on = {};");if(p.push("","function hydrate(root) {"),y)p.push(" const texts = [];"," const walker = document.createTreeWalker(root, 128);"," while (walker.nextNode()) {"," const c = walker.currentNode;"," if (c.data.startsWith('jx-text:') && c.data.slice(8) in bind) { texts.push(c); }"," }");if(p.push(" 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;"),m)p.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else p.push(" if (parts[0] === 'style' && parts.length > 1) {");if(p.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Vo}(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]);"," }"," });"," });"),y)p.push(" texts.forEach(c => {"," const key = c.data.slice(8);"," let text = c.nextSibling;"," if (!text || text.nodeType !== 3) {"," text = document.createTextNode('');"," c.after(text);"," }"," effect(() => { text.data = bind[key](); });"," });");if(p.push("}",""),P)p.push(`await ${_f(u.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return p.push("hydrate(document);",""),p.join(`
|
|
295
|
+
`)}function AL(e,t,n,r){return[`// ${e}: ${t} (key: "${n}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(n)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(r)};`,`} catch { state.${e} = ${JSON.stringify(r)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(n)});`,` else ${t}.setItem(${JSON.stringify(n)}, JSON.stringify(v));`," } catch {}","});"].join(`
|
|
296
|
+
`)}function CL(e,t,n){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(n)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(n)}; }`,"}"].join(`
|
|
297
|
+
`)}function HE(e){return e===null||D(e)}function Xi(e){let t=sn(e);if(t.startsWith("$map/")){let[n,...r]=Un(t.slice(5));return Re(n??"",r.map((s)=>Wt(s)).join("/"))}if(t.startsWith("#/state/"))return Re("state",t.slice(8));return Re("state",t)}function Cy(e){return lv("state",e.startsWith("#/state/")?e.slice(8):e)}function Wl(e){return cv(e.startsWith("#/state/")?e.slice(8):e)}function Oy(e,t,n){if(e.has(t))return;e.set(t,`() => ${Re("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var _L;var Ny=J(()=>{$i();Mi();yn();ce();_i();_L=new Set(["script","style","textarea","title"])});function RL(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function WE(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),n=JSON.stringify(e.defaultLocale),r=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,RL(s,e)])));return`
|
|
271
298
|
// ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
|
|
272
299
|
const JX_LOCALES = ${t}
|
|
273
300
|
const JX_DEFAULT_LOCALE = ${n}
|
|
@@ -336,24 +363,24 @@ app.use('/', async (c, next) => {
|
|
|
336
363
|
res.headers.set('Content-Language', locale)
|
|
337
364
|
c.res = res
|
|
338
365
|
})
|
|
339
|
-
`}function
|
|
340
|
-
`),
|
|
366
|
+
`}function Gf(e,t="/_jx/server"){return Fe(e,t)}function Ty(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,a=Gf(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let l=e.map(({exportName:y,src:S})=>`import { ${y} } from '${S}'`).join(`
|
|
367
|
+
`),c=NL(r,s),u=e.map(({exportName:y})=>ML(y,a)).join(`
|
|
341
368
|
`),d=n==="cloudflare-workers"||n==="cloudflare-pages"?`
|
|
342
369
|
app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
|
|
343
370
|
`:`
|
|
344
|
-
`,p=
|
|
371
|
+
`,p=WE(o),m=e.length===0&&r.length===0?"":JL(i,a);return`// Generated by @jxsuite/compiler — do not edit manually
|
|
345
372
|
import { Hono } from 'hono'
|
|
346
|
-
${
|
|
373
|
+
${l}${c.imports}
|
|
347
374
|
|
|
348
375
|
const app = new Hono()
|
|
349
|
-
${p}${m}${
|
|
376
|
+
${p}${m}${c.routes}${u}
|
|
350
377
|
${d}
|
|
351
378
|
export default app
|
|
352
|
-
`}function
|
|
379
|
+
`}function NL(e,t){if(e.length===0)return{imports:"",routes:""};let n=e.toSorted((o,i)=>o.order-i.order),r=[];for(let o of n)r.push(`import { ${o.className} } from '${o.module}'`);for(let o of t)r.push(`import { ${o.className} } from '${o.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((o)=>`${JSON.stringify(o.provider)}: ${o.className}`).join(", ")} }`];for(let[o,i]of n.entries()){let a=JSON.stringify(i.options);s.push(`const jxMount${o} = await ${i.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${i.basePath}/*', (c) => jxMount${o}(c.req.raw, c.env))`,`app.all('${i.basePath}', (c) => jxMount${o}(c.req.raw, c.env))`)}return{imports:`
|
|
353
380
|
${r.join(`
|
|
354
381
|
`)}`,routes:`${s.join(`
|
|
355
382
|
`)}
|
|
356
|
-
`}}function
|
|
383
|
+
`}}function JL(e,t){let n=Fe(e,TL);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
|
|
357
384
|
const jxGate = async (c, next) => {
|
|
358
385
|
const site = c.req.header('sec-fetch-site')
|
|
359
386
|
const foreign = site !== undefined && site !== 'same-origin' && site !== 'none'
|
|
@@ -370,7 +397,7 @@ const jxGate = async (c, next) => {
|
|
|
370
397
|
}
|
|
371
398
|
${(t===n||t.startsWith(`${n}/`)?[n]:[n,t]).map((o)=>`app.use('${o}/*', jxGate)`).join(`
|
|
372
399
|
`)}
|
|
373
|
-
`}function
|
|
400
|
+
`}function ML(e,t){return`
|
|
374
401
|
app.post('${t}/${e}', async (c) => {
|
|
375
402
|
if (!/^application\\/([\\w.-]+\\+)?json\\b/i.test(c.req.header('content-type') ?? '')) {
|
|
376
403
|
return c.json({ ok: false, error: 'Expected an application/json body' }, 415)
|
|
@@ -382,37 +409,33 @@ app.post('${t}/${e}', async (c) => {
|
|
|
382
409
|
console.error('jx: server function ${e} threw:', e)
|
|
383
410
|
return c.json({ ok: false, error: 'Server error' }, 500)
|
|
384
411
|
}
|
|
385
|
-
})`}var
|
|
412
|
+
})`}var TL="/_jx";var Jy=J(()=>{An()});async function FL(e){let{readdirSync:t}=await import("node:fs"),{resolve:n}=await import("node:path");if(!k(e))return e.map((r)=>n(r));return t(e).filter((r)=>Vn(r)).toSorted().map((r)=>n(e,r))}async function VL(e){let{readFileSync:t}=await import("node:fs");if(!Vn(e))throw Error(`compileElementPack: ${e} is not a .json or .jxn document, the two a pack compiles`);return kn(t(e,"utf8"),e)}async function qL(e){let{resolve:t}=await import("node:path"),n=(e.packDir??"dist").replaceAll(/^\.?\/+|\/+$/gu,""),r=await FL(e.components),s=new Map,o=new Map;for(let y of r){let S=await VL(y),{tagName:g}=S;if(!k(g)||!g.includes("-"))throw Error(`compileElementPack: ${y} is not a component: its tagName must contain a hyphen`);let x=[...o].find(([,P])=>P===g);if(x)throw Error(`compileElementPack: ${x[0]} and ${y} both declare the tagName "${g}"`);s.set(g,S),o.set(y,g)}let i={stylesheetHref:(y)=>`./${y}.css`,resolveElementPath:(y,S)=>{let g=S===null?t(y):t(S,y),x=o.get(g);if(x===void 0)throw Error(`compileElementPack: "${y}" names a component outside the pack (${g})`);return`./${x}.js`}};if(e.rewriteSrc)i.rewriteSrc=e.rewriteSrc;if(e.$media)i.$media=e.$media;if(e.defaults)i.defaults=e.defaults;let a=new Map;for(let y of r){let{files:S}=await Gi(y,i);for(let g of S)if(!a.has(g.tagName))a.set(g.tagName,g.content)}let l=Cf([...s.keys()],s),c=[],u=[],d=[];for(let y of l){let S=s.get(y),g=a.get(y);if(!S||g===void 0)continue;c.push({content:g,path:`${y}.js`});let x=Rn(S,e.defaults),P=Nf(y,S.style,S,e.$media??S.$media??{},x);if(P!==""){if(c.push({content:P,path:`${y}.css`}),x===null)u.push(P)}d.push({className:Ms(y),doc:S,modulePath:n===""?`${y}.js`:`${n}/${y}.js`,shadow:x!==null,tagName:y})}let{manifest:p,warnings:m}=pu(d);return c.push({content:`// Generated by @jxsuite/compiler — do not edit manually
|
|
413
|
+
${l.map((y)=>`import './${y}.js';`).join(`
|
|
414
|
+
`)}
|
|
415
|
+
`,path:IL},{content:u.join(""),path:DL},{content:mu(p),path:LL}),{files:c,manifest:p,tags:l,warnings:m}}async function HL(e,t){let{mkdirSync:n,writeFileSync:r}=await import("node:fs"),{dirname:s,resolve:o}=await import("node:path");return e.files.map((i)=>{let a=o(t,i.path);return n(s(a),{recursive:!0}),r(a,i.content,"utf8"),a})}var IL="index.js",DL="elements.css",LL="custom-elements.json";var BE=J(()=>{dm();ce();os();Sl();yn();Hl()});import{readFileSync as WL}from"node:fs";async function My(e,t={}){let{title:n="Jx App",reactivitySrc:r=Ts,litHtmlSrc:s=Nr,projectStyle:o=null}=t,i;if(k(e)){let l=WL(e,"utf8");if(Vn(e))i=kn(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),d=t.formats?.byExtension(u,"parse");if(!d){await Promise.resolve().then(() => is());throw du(e,u)}i=await d.parseDocument(l)}}else i=e;if(i=Ar(i,k(e)?e:"the document"),Fb(i)){await Promise.resolve().then(() => fy());let c=Fl(i),u=k(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!pf(i)){let l={projectStyle:o,title:n};if(t.prePaintScheme===!1)l.prePaintScheme=!1;return ME(i,l)}if(i.tagName&&i.tagName.includes("-")){let{tagName:l}=i,c=Ms(l),d={content:Ey(i,c,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass),path:`${l}.js`,tagName:l},p=Ui(i,i.$media??{},o),m=`<!DOCTYPE html>
|
|
386
416
|
<html lang="en">
|
|
387
417
|
<head>
|
|
388
418
|
<meta charset="utf-8">
|
|
389
419
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
390
|
-
<title>${
|
|
391
|
-
|
|
392
|
-
{
|
|
393
|
-
"imports": {
|
|
394
|
-
"@vue/reactivity": "${r}",
|
|
395
|
-
"lit-html": "${s}"
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
</script>
|
|
420
|
+
<title>${Ne(n)}</title>
|
|
421
|
+
${Ii({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
399
422
|
${p}
|
|
400
423
|
</head>
|
|
401
424
|
<body>
|
|
402
|
-
<${
|
|
403
|
-
<script type="module" src="./${
|
|
425
|
+
<${l}></${l}>
|
|
426
|
+
<script type="module" src="./${l}.js"></script>
|
|
404
427
|
</body>
|
|
405
|
-
</html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...
|
|
428
|
+
</html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...BL(t),title:n};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;if(t.resolveClass!==void 0)a.resolveClass=t.resolveClass;if(t.runtimeImports!==void 0)a.runtimeImports=t.runtimeImports;return Ry(i,a)}function BL(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function uee(e,t){let n=await My(e),{writeFileSync:r,mkdirSync:s}=await import("node:fs"),{dirname:o,join:i}=await import("node:path");if(t){r(t,n.html,"utf8"),console.error(`Written to ${t}`);let a=o(t);for(let l of n.files){let c=i(a,l.path);s(o(c),{recursive:!0}),r(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(n.html)}var UE=J(()=>{Ei();yn();Hl();DE();Ny();ce();os();yn();Jy();Hl();BE();Ny()});function zE(e){let t=e.arch==="x64"||e.arch==="arm64"?e.arch:null;if(!t)return[];if(e.platform==="linux"){let[n,r]=e.musl?["musl","gnu"]:["gnu","musl"];return[`linux-${t}-${n}`,`linux-${t}-${r}`]}if(e.platform==="darwin")return[`darwin-${t}`];if(e.platform==="win32")return[`win32-${t}-msvc`];return[]}function KE(e){return`jx-compiler.${e}.node`}function GE(e){return`@jxsuite/compiler-binding-${e}`}var XE=()=>{};import{createRequire as UL}from"node:module";import{existsSync as zL}from"node:fs";import{dirname as QE,join as KL}from"node:path";function GL(e,t){return e==="linux"&&t!==void 0&&!t.header?.glibcVersionRuntime}function XL(e){try{return[QE(e("@jxsuite/compiler-binding/package.json"))]}catch{return[]}}function YL(){return{arch:process.arch,exists:zL,load:(e)=>{let t=YE(e);return ZL(t)?t:void 0},localDirs:[...new Set([QE(import.meta.dirname),import.meta.dirname,...XL((e)=>YE.resolve(e))])],musl:GL(process.platform,process.report.getReport()),platform:process.platform}}function ZL(e){return typeof e==="object"&&e!==null&&"processImage"in e&&typeof e.processImage==="function"}function QL(e){let t=zE(e);if(t.length===0)throw Error(`@jxsuite/compiler-binding has no build for ${e.platform}-${e.arch}. Image optimization needs one; set images.optimize to false to build without it.`);let n=[];for(let s of t){let o=[...e.localDirs.map((i)=>KL(i,KE(s))).filter((i)=>e.exists(i)),GE(s)];for(let i of o)try{let a=e.load(i);if(a)return a;n.push(`${i}: loaded, but it is not the Jx compiler addon`)}catch(a){n.push(`${i}: ${a instanceof Error?a.message:String(a)}`)}}let r=n.map((s)=>` - ${s}`).join(`
|
|
406
429
|
`);throw Error(`The Jx compiler's native addon could not be loaded.
|
|
407
430
|
${r}
|
|
408
|
-
In a checkout of the Jx repository, build it with \`bun run build:addon\` (needs Rust). In a project, reinstall dependencies without --no-optional so the package for this platform is installed.`)}function O0(){return P0??=aM(oM()),P0}async function A0(e){return O0().imageMetadata(e)}async function C0(e){return O0().processImage(e)}var k0,j0,P0;var R0=R(()=>{E0();k0={avif:65,jpeg:80},j0=eM(import.meta.url)});import{createHash as Jg}from"node:crypto";import{readFileSync as cM}from"node:fs";import{basename as lM,extname as uM,resolve as N0}from"node:path";async function T0(e){return A0(e)}function Ti(e){let t=cM(e);return Jg("md5").update(t).digest("hex").slice(0,8)}function pM(e,t){let n=new Map(Object.entries(e)).get(t);if(n!==void 0)return n;return new Map(Object.entries(k0)).get(t)??dM}function mM(e,t,n){return Jg("md5").update(`${Ti(e)}:${J0}:${t}:${n}`).digest("hex").slice(0,8)}function I0(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:J0,widths:e.widths});return Jg("md5").update(t).digest("hex").slice(0,8)}async function D0(e,t,n){let r=N0(t,"_optimized"),s={};if(n.quality.avif!==void 0)s.avif=n.quality.avif;if(n.quality.jpeg!==void 0)s.jpeg=n.quality.jpeg;let o=await C0({formats:n.formats,hashes:Object.fromEntries(n.formats.map((i)=>[i,mM(e,i,pM(n.quality,i))])),outDir:r,quality:s,source:e,stem:lM(e,uM(e)),widths:n.widths});return{contentHash:Ti(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:N0(r,i.fileName),format:i.format,outputPath:`/${fM}/${i.fileName}`,width:i.width}))}}function M0(e,t){return e.flatMap((n)=>n.format===t?[`${Ig(n.outputPath)} ${n.width}w`]:[]).join(", ")}function Ig(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var fM="images/_optimized",J0=4,dM=100;var Dg=R(()=>{R0()});import{existsSync as hM,mkdirSync as gM,readFileSync as yM,rmSync as xM,writeFileSync as bM}from"node:fs";import{basename as F0,extname as $M,resolve as gc}from"node:path";import{execSync as SM}from"node:child_process";import{createHash as wM}from"node:crypto";import{tmpdir as vM}from"node:os";function jM(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=SM("npm config get cache",{cwd:vM(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:EM}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function uf(e){if(lf===void 0)lf=jM();if(lf){let t=gc(e),n=wM("md5").update(t).digest("hex").slice(0,8);return gc(lf,"jxsuite-images",`${F0(t)}-${n}`)}return gc(e,".cache/images")}function L0(e,t){return`${Ti(e)}:${I0(t)}:${F0(e,$M(e))}`}function V0(e){let t=gc(uf(e),"manifest.json");if(!hM(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(yM(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function q0(e,t,n={}){if(n.prune&&t.touched)PM(t,t.touched);let r=uf(e);gM(r,{recursive:!0}),bM(gc(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function PM(e,t){let n=new Set,r=Object.entries(e.entries);for(let[s,o]of r)if(t.has(s))for(let i of o.manifest.variants??[])n.add(i.absolutePath);for(let[s,o]of r){if(t.has(s))continue;for(let i of o.manifest.variants??[])if(!n.has(i.absolutePath))xM(i.absolutePath,{force:!0});delete e.entries[s]}}function W0(e){let t=new Set,n=new Map(Object.entries(e.entries));for(let r of e.touched??[])for(let s of n.get(r)?.manifest.variants??[])t.add(s.absolutePath);return[...t]}function H0(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function U0(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var lf,EM=3000;var Mg=R(()=>{Dg()});function Fg(e,t){if(!t||B0(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return B0(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var B0=(e)=>e!==void 0&&e!==null&&e!=="";function K0(e){let t=e.lastIndexOf(".");return _M.get(t>0?e.slice(t).toLowerCase():"")??null}function df(e){try{return OM.decode(e)}catch{throw new En("The metadata is not valid UTF-8.")}}function ff(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function yc(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function G0(e,t){switch(t){case"jpeg":return RM(e).packet;case"png":return IM(e).packet;case"webp":return MM(e).packet;default:return qM(df(e)).packet}}function AM(e){if(e[0]!==255||e[1]!==216)throw new En("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new En("The JPEG's markers are damaged.");let r=e[n+1]??0;if(r===255){n+=1;continue}if(r===218||r===217)break;let s=ff(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new En("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function CM(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=Lg.length&&Lg.every((r,s)=>e[n+s]===r)}function RM(e){let t=AM(e),n=t.find((s)=>CM(e,s));return{packet:n===void 0?null:df(e.subarray(n.start+4+Lg.length,n.end)),parts:t}}function TM(e){if(!z0.every((r,s)=>e[s]===r))throw new En("Not a PNG file.");let t=[],n=z0.length;while(n+12<=e.length){let r=ff(e).getUint32(n),s=n+12+r;if(s>e.length)throw new En("The PNG's chunks are damaged.");let o=yc(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function JM(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||yc(n,0,r)!==NM)return null;if(n[r+1]!==0)throw new En("The PNG's metadata is compressed, which Studio does not rewrite.");let s=n.indexOf(0,r+3),o=s===-1?-1:n.indexOf(0,s+1);if(o===-1)throw new En("The PNG's metadata chunk is damaged.");return df(n.subarray(o+1))}function IM(e){let t=TM(e);return{packet:t.map((r)=>JM(e,r)).find((r)=>r!==null)??null,parts:t}}function DM(e){if(yc(e,0,4)!=="RIFF"||yc(e,8,4)!=="WEBP")throw new En("Not a WebP file.");let t=Math.min(e.length,8+ff(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=ff(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new En("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:yc(e,r,4),size:s,start:r}),r=i}return n}function MM(e){let t=DM(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:df(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function LM(e,t){let n=null;for(let r=t+1;r<e.length;r++){let s=e[r];if(n!==null){if(s===n)n=null}else if(s==='"'||s==="'")n=s;else if(s===">")return r}return-1}function VM(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new En("Not an SVG file.");let n=LM(e,t.index);if(n===-1)throw new En("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function qM(e){VM(e);let t=FM.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var En,_M,kM,OM,Lg,z0,NM="XML:com.adobe.xmp",FM;var X0=R(()=>{En=class En extends Error{name="XmpContainerError"};_M=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);kM=new TextEncoder,OM=new TextDecoder("utf-8",{fatal:!0});Lg=kM.encode("http://ns.adobe.com/xap/1.0/\x00");z0=Uint8Array.of(137,80,78,71,13,10,26,10);FM=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function Y0(){return{alt:"",focus:null,tags:[]}}function HM(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function Vg(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=HM(n),s=r===null?WM.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new jn(`Unknown entity ${t}`);return s})}function UM(e){let t={attrs:[],children:[],name:"#root",type:"element"},n=[t],r=0,s=()=>n.at(-1)??t;while(r<e.length){let o=e.indexOf("<",r);if(o===-1){s().children.push({type:"text",value:Vg(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:Vg(e.slice(r,o))});let i=e.slice(o,o+9),a;if(i.startsWith("<!--"))a=e.indexOf("-->",o),a=a===-1?-1:a+3;else if(i.startsWith("<![CDATA["))a=e.indexOf("]]>",o),a=a===-1?-1:a+3;else if(i.startsWith("<?"))a=e.indexOf("?>",o),a=a===-1?-1:a+2;else if(i.startsWith("<!"))throw new jn("A packet may not declare a document type.");else if(i.startsWith("</")){let c=e.indexOf(">",o);if(c===-1)throw new jn("Unclosed end tag.");let l=e.slice(o+2,c).trim(),u=n.pop();if(u===void 0||u===t||u.name!==l)throw new jn(`Unexpected </${l}>.`);r=c+1;continue}else{r=BM(e,o,n);continue}if(a===-1)throw new jn("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new jn(`<${s().name}> is never closed.`);return t.children}function BM(e,t,n){let r=t+1,s=Z0.exec(e.slice(r));if(s===null)throw new jn("A tag has no name.");let o={attrs:[],children:[],name:s[0],type:"element"};r+=s[0].length;for(;;){while(/\s/.test(e[r]??""))r+=1;let i=e[r];if(i===void 0)throw new jn(`<${o.name}> is never finished.`);if(i===">"||e.startsWith("/>",r)){if(n.at(-1)?.children.push(o),i===">")return n.push(o),r+1;return r+2}let a=Z0.exec(e.slice(r));if(a===null)throw new jn(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new jn(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let c=e[r];if(c!=='"'&&c!=="'")throw new jn(`${a[0]} is not quoted.`);let l=e.indexOf(c,r+1);if(l===-1)throw new jn(`${a[0]} is never closed.`);o.attrs.push([a[0],Vg(e.slice(r+1,l))]),r=l+1}}function Ji(e,t){let n=e.attrs.filter(([s])=>s==="xmlns"||s.startsWith("xmlns:"));if(n.length===0)return t;let r=new Map(t);for(let[s,o]of n)r.set(s==="xmlns"?"":s.slice(6),o);return r}function zM(e,t,n=!1){let r=e.indexOf(":");if(r===-1)return n?["",e]:[t.get("")??"",e];let s=e.slice(0,r),o=s==="xml"?"http://www.w3.org/XML/1998/namespace":t.get(s);return o===void 0?null:[o,e.slice(r+1)]}function Qn(e,t,n,r,s=!1){let o=zM(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function Ii(e){return e.filter((t)=>t.type==="element")}function Di(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?Di(t):"").join("")}function eE(e,t=new Map){let n=[];for(let r of Ii(e)){let s=Ji(r,t);if(Qn(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...eE(r.children,s))}return n}function Mi(e,t){let n=[];for(let r of Ii(e.children)){let s=Ji(r,t);for(let o of Ii(r.children)){let i=Ji(o,s);if(Qn(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function KM(e,t){let n=e.attrs.find(([r])=>Qn(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function GM(e,t){let n=Mi(e,t),r=n.find(([s,o])=>KM(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?Di(e).trim():Di(r[0])}function pf(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&Qn(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of Ii(e.children)){let s=Ji(r,t);if(Qn(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function bc(e,t,n,r){for(let s of Ii(e.children)){let o=Ji(s,t);if(Qn(s.name,o,n,r))return[s,o]}return null}function xc(e,t,n,r){let s=e.attrs.find(([i])=>Qn(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=bc(e,t,n,r);return o===null?null:Di(o[0]).trim()}function Q0(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function XM(e,t){let n=bc(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return Mi(...n).some(([r,s])=>{let[o,i]=pf(r,s),a=bc(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[xc(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:Mi(...a).map(([l])=>Di(l).trim())).some((l)=>l.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function YM(e,t){let[n,r]=pf(e,t),s=bc(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!XM(n,r))return null;let[o,i]=pf(...s),a=bc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(xc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||xc(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let c=Mi(...a);if(c.length!==1)return null;let[l,u]=pf(...c[0]),d=Q0(xc(l,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=Q0(xc(l,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function ZM(e){let t=new Set,n=[];for(let r of e){let s=r.trim(),o=s.toLowerCase();if(s!==""&&!t.has(o))t.add(o),n.push(s)}return n}function tE(e){if(e===null)return Y0();let t=Y0(),n=!1;for(let[r,s]of eE(UM(e))){for(let[o,i]of r.attrs)if(!n&&Qn(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of Ii(r.children)){let i=Ji(o,s);if(!n&&Qn(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=GM(o,i),n=!0;else if(Qn(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...Mi(o,i).map(([a])=>Di(a)));else if(t.focus===null&&Qn(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,c]of Mi(o,i))t.focus??=YM(a,c)}}return t.tags=ZM(t.tags),t.alt=t.alt.trim(),t}var jn,WM,Z0;var nE=R(()=>{jn=class jn extends Error{name="XmpParseError"};WM=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);Z0=/^[A-Za-z_][\w.:-]*/});import{existsSync as uE,readFileSync as QM,statSync as eF}from"node:fs";import{basename as tF,extname as Hg,resolve as rE}from"node:path";async function sF(e,t){let n=t.get(e);if(!n){let r=Ti(e);try{let s=await T0(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!sE)sE=!0,console.warn(`Could not read image dimensions (${ge(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function oE(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=oF(e);return t.widths.filter((c)=>c<=n).toSorted((c,l)=>c-l).map((c)=>`/cdn-cgi/image/width=${c},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${c}w`).join(", ")}function oF(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function iF(e,t,n,r,s){let o=L0(e,n),i=H0(s,o);if(i){if(i.variants.every((l)=>uE(l.absolutePath)))return i}if(!i)console.log(` Optimizing ${tF(e)}...`);let a=await D0(e,uf(r),n);return U0(s,o,t,a),a}function aF(e){if(!e)return!0;if(e.includes("${"))return!0;if(dE.some((n)=>e.startsWith(n)))return!0;let t=Hg(e).toLowerCase();return!nF.has(t)&&!fE.has(t)}function cF(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 n=new URL(e);if(rF.has(Hg(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function pE(e,t,n){let r=n?.length?Vl(n,e):null;if(r)return r;if(e.startsWith("/"))return rE(t,"public",e.slice(1));return rE(t,e)}function aE(e){return`${Math.round(e*1000)/10}%`}function lF(e){let t=K0(e);if(t===null)return null;let n;try{let o=eF(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=iE.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(QM(e)),{focus:i}=tE(G0(o,t));s=i===null?null:`${aE(i.x)} ${aE(i.y)}`}catch{s=null}return iE.set(n,s),s}function uF(e,t,n,r){if(!k(t)||t===""||t.includes("${"))return;if(dE.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!I(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=lF(pE(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}async function mE(e,t,n,r,s,o=[]){let i=new Map;return await hE(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function hE(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await gF(e,t,n,r,s,o,i,a))return}if(k(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await wF(e.innerHTML,t,n,r,s,o,i,Wg(e,a));if(Array.isArray(e.children)){let c=Wg(e,a);for(let l of e.children){if(!tn(l))continue;await hE(l,t,n,r,s,o,i,c)}}}async function gE(e,t,n,r,s,o,i,a){if(!k(e)||t)return null;let c=cF(e,n);if(!c&&aF(e))return null;if(c)return{dims:null,sources:[],srcset:oE(e,n,1/0,null)};let l=pE(e,r,a);if(!uE(l))return null;if(n.service==="cloudflare"){let y=await sF(l,o),S=oE(e,n,y.width??1/0,y.hash);return{dims:y.width&&y.height?{height:y.height,width:y.width}:null,sources:[],srcset:S}}if(fE.has(Hg(l).toLowerCase()))return null;let u=i.get(l);if(!u)u=await iF(l,e,n,r,s),i.set(l,u);let d=dF(n.formats,u.variants),m=[...cE.filter((y)=>d.includes(y)),...d.filter((y)=>!cE.includes(y))].flatMap((y)=>{let S=M0(u.variants,y);return S===""?[]:[{srcset:S,type:fF.get(y)??`image/${y}`}]}),x=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,g=n.picture!==!1&&m.length>1;return{dims:x,fallbackSrc:mF(u.variants,d),sources:g?m:[],srcset:m[0]?.srcset??""}}function dF(e,t){return e.includes("jpeg")&&!e.includes("png")&&t.some((r)=>r.format==="png")&&!t.some((r)=>r.format==="jpeg")?[...e,"png"]:e}function mF(e,t){let n=pF.find((s)=>t.includes(s)&&e.some((o)=>o.format===s));if(n===void 0)return;let r;for(let s of e)if(s.format===n&&(r===void 0||s.width>r.width))r=s;return r&&Ig(r.outputPath)}function lE(e){if(!k(e))return null;let t=hF.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function Wg(e,t){let{style:n}=e;if(!I(n))return t;let r=t;for(let s of[lE(n.maxWidth),lE(n.width)])if(s!==null&&(r===null||s<r))r=s;return r}function yE(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function gF(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let c=e.attributes;if(c.src===void 0&&k(e.src))c.src=e.src,delete e.src;uF(e,c.src,n,i);let l=t.optimize?await gE(c.src,c["data-no-optimize"]!==void 0||c.srcset!==void 0,t,n,r,s,o,i):null,u=Wg(e,a),d=c.sizes??yE(u)??t.sizes;if(l){if(l.srcset!==""){if(c.srcset=l.srcset,d!==void 0)c.sizes=d;if(l.fallbackSrc!==void 0)c.src=l.fallbackSrc}if(l.dims&&c.width===void 0&&c.height===void 0)c.width=String(l.dims.width),c.height=String(l.dims.height)}if(Object.assign(c,Fg(c,t.lazyLoad)),l&&l.sources.length>0)return yF(e,l.sources,d),!0;return!1}function yF(e,t,n){let r={...e.attributes},s=r.sizes??n;delete r.srcset,delete r.sizes;let o={attributes:r,tagName:"img"};if(e.style!==void 0)o.style=e.style,delete e.style;let i=t.map((a)=>{let c={};if(s!==void 0&&s!=="")c.sizes=s;return c.srcset=a.srcset,c.type=a.type,{attributes:c,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function wF(e,t,n,r,s,o,i,a){let c=[];for(let u of e.matchAll(xF)){let d=u[0],p=u[1],m=($c(p,"src")??"").replaceAll("&","&"),x=t.optimize&&m!==""?await gE(m,bF.test(p)||qg(p,"srcset"),t,n,r,s,o,i):null,g=$c(p,"sizes"),y=g??yE(a)??t.sizes,S=p,E="";if(x&&x.srcset!==""){if(E+=` srcset="${x.srcset}"`,g===void 0&&y!==void 0&&y!=="")E+=` sizes="${y}"`;let{fallbackSrc:P}=x;if(P!==void 0)S=p.replace($F,(O,T)=>`${T}src="${P}"`)}if(x?.dims&&!qg(p,"width")&&!qg(p,"height"))E+=` width="${x.dims.width}" height="${x.dims.height}"`;let v=Fg({decoding:$c(p,"decoding"),fetchpriority:$c(p,"fetchpriority"),loading:$c(p,"loading")},t.lazyLoad);for(let[P,O]of Object.entries(v))E+=` ${P}="${O}"`;if(E==="")continue;let j=x&&x.sources.length>0?vF(S,x.sources,y,E):`<img${S}${E}>`;c.push({match:d,replacement:j})}let l=e;for(let{match:u,replacement:d}of c)l=l.replace(u,d);return l}function vF(e,t,n,r){let s=e.replace(SF,""),o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,""),i=n===void 0||n===""?"":` sizes="${n}"`;return`<picture>${t.map((c)=>`<source type="${c.type}" srcset="${c.srcset}"${i}>`).join("")}<img${s}${o}></picture>`}function $c(e,t){return new RegExp(`(?:^|\\s)${t}="([^"]*)"`,"i").exec(e)?.[1]}function qg(e,t){return new RegExp(`(?:^|\\s)${t}=`,"i").test(e)}var nF,fE,rF,dE,sE=!1,iE,cE,fF,pF,hF,xF,bF,$F,SF;var xE=R(()=>{Dg();Mg();$n();le();Rt();X0();nE();nF=new Set([".jpg",".jpeg",".png",".webp",".tif",".tiff",".bmp"]),fE=new Set([".avif"]),rF=new Set([".svg",".gif"]),dE=["http://","https://","data:","//"];iE=new Map;cE=["avif","webp","jpeg","png"],fF=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);pF=["jpeg","png"];hF=/^(\d+(?:\.\d+)?)(px|rem)$/;xF=/<img\b([^>]*)>/gi,bF=/\bdata-no-optimize\b/,$F=/(^|\s)src="[^"]*"/i,SF=/(?:^|\s)sizes="[^"]*"/i});import{createHash as EF}from"node:crypto";import{existsSync as jF}from"node:fs";import{join as bE}from"node:path";function kF(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?bE(t,n,"index.html"):bE(t,n)}function Bg(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function OF(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return EF("sha256").update(t,"utf8").digest("hex").slice(0,8)}function $E(e,t,n=""){let r=[],s=[],o=[...e.precache??[]],i=e.offlineFallback;if(i!==void 0&&!o.includes(i))o.push(i),r.push(`serviceWorker: "${i}" 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 m of o)if(!m.startsWith("/"))s.push(`serviceWorker.precache: "${m}" must be a site-absolute URL starting with /.`);else if(!jF(kF(m,t)))s.push(`serviceWorker.precache: "${m}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=o.map((m)=>Ie(n,m)),c=Ie(n,PF),l=i===void 0?null:Ie(n,i),u=`${Ie(n,_F)}/`,d=`jx-${OF(e)}`,p=`/*
|
|
431
|
+
In a checkout of the Jx repository, build it with \`bun run build:addon\` (needs Rust). In a project, reinstall dependencies without --no-optional so the package for this platform is installed.`)}function tj(){return ZE??=QL(YL()),ZE}async function nj(e){return tj().imageMetadata(e)}async function rj(e){return tj().processImage(e)}var ej,YE,ZE;var sj=J(()=>{XE();ej={avif:65,jpeg:80},YE=UL(import.meta.url)});import{createHash as Iy}from"node:crypto";import{readFileSync as eF}from"node:fs";import{basename as tF,extname as nF,resolve as oj}from"node:path";async function ij(e){return nj(e)}function Yi(e){let t=eF(e);return Iy("md5").update(t).digest("hex").slice(0,8)}function oF(e,t){let n=new Map(Object.entries(e)).get(t);if(n!==void 0)return n;return new Map(Object.entries(ej)).get(t)??sF}function iF(e,t,n){return Iy("md5").update(`${Yi(e)}:${aj}:${t}:${n}`).digest("hex").slice(0,8)}function lj(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:aj,widths:e.widths});return Iy("md5").update(t).digest("hex").slice(0,8)}async function cj(e,t,n){let r=oj(t,"_optimized"),s={};if(n.quality.avif!==void 0)s.avif=n.quality.avif;if(n.quality.jpeg!==void 0)s.jpeg=n.quality.jpeg;let o=await rj({formats:n.formats,hashes:Object.fromEntries(n.formats.map((i)=>[i,iF(e,i,oF(n.quality,i))])),outDir:r,quality:s,source:e,stem:tF(e,nF(e)),widths:n.widths});return{contentHash:Yi(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:oj(r,i.fileName),format:i.format,outputPath:`/${rF}/${i.fileName}`,width:i.width}))}}function uj(e,t){return e.flatMap((n)=>n.format===t?[`${Dy(n.outputPath)} ${n.width}w`]:[]).join(", ")}function Dy(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var rF="images/_optimized",aj=4,sF=100;var Ly=J(()=>{sj()});import{existsSync as aF,mkdirSync as lF,readFileSync as cF,rmSync as uF,writeFileSync as fF}from"node:fs";import{basename as fj,extname as dF,resolve as Bl}from"node:path";import{execSync as pF}from"node:child_process";import{createHash as mF}from"node:crypto";import{tmpdir as hF}from"node:os";function yF(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=pF("npm config get cache",{cwd:hF(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:gF}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function Yf(e){if(Xf===void 0)Xf=yF();if(Xf){let t=Bl(e),n=mF("md5").update(t).digest("hex").slice(0,8);return Bl(Xf,"jxsuite-images",`${fj(t)}-${n}`)}return Bl(e,".cache/images")}function dj(e,t){return`${Yi(e)}:${lj(t)}:${fj(e,dF(e))}`}function pj(e){let t=Bl(Yf(e),"manifest.json");if(!aF(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(cF(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function mj(e,t,n={}){if(n.prune&&t.touched)xF(t,t.touched);let r=Yf(e);lF(r,{recursive:!0}),fF(Bl(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function xF(e,t){let n=new Set,r=Object.entries(e.entries);for(let[s,o]of r)if(t.has(s))for(let i of o.manifest.variants??[])n.add(i.absolutePath);for(let[s,o]of r){if(t.has(s))continue;for(let i of o.manifest.variants??[])if(!n.has(i.absolutePath))uF(i.absolutePath,{force:!0});delete e.entries[s]}}function hj(e){let t=new Set,n=new Map(Object.entries(e.entries));for(let r of e.touched??[])for(let s of n.get(r)?.manifest.variants??[])t.add(s.absolutePath);return[...t]}function gj(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function yj(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var Xf,gF=3000;var Fy=J(()=>{Ly()});function Vy(e,t){if(!t||xj(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return xj(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var xj=(e)=>e!==void 0&&e!==null&&e!=="";function $j(e){let t=e.lastIndexOf(".");return bF.get(t>0?e.slice(t).toLowerCase():"")??null}function Qf(e){try{return SF.decode(e)}catch{throw new Tn("The metadata is not valid UTF-8.")}}function Zf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ul(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function Sj(e,t){switch(t){case"jpeg":return EF(e).packet;case"png":return kF(e).packet;case"webp":return AF(e).packet;default:return TF(Qf(e)).packet}}function wF(e){if(e[0]!==255||e[1]!==216)throw new Tn("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new Tn("The JPEG's markers are damaged.");let r=e[n+1]??0;if(r===255){n+=1;continue}if(r===218||r===217)break;let s=Zf(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new Tn("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function vF(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=qy.length&&qy.every((r,s)=>e[n+s]===r)}function EF(e){let t=wF(e),n=t.find((s)=>vF(e,s));return{packet:n===void 0?null:Qf(e.subarray(n.start+4+qy.length,n.end)),parts:t}}function PF(e){if(!bj.every((r,s)=>e[s]===r))throw new Tn("Not a PNG file.");let t=[],n=bj.length;while(n+12<=e.length){let r=Zf(e).getUint32(n),s=n+12+r;if(s>e.length)throw new Tn("The PNG's chunks are damaged.");let o=Ul(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function _F(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||Ul(n,0,r)!==jF)return null;if(n[r+1]!==0)throw new Tn("The PNG's metadata is compressed, which Studio does not rewrite.");let s=n.indexOf(0,r+3),o=s===-1?-1:n.indexOf(0,s+1);if(o===-1)throw new Tn("The PNG's metadata chunk is damaged.");return Qf(n.subarray(o+1))}function kF(e){let t=PF(e);return{packet:t.map((r)=>_F(e,r)).find((r)=>r!==null)??null,parts:t}}function OF(e){if(Ul(e,0,4)!=="RIFF"||Ul(e,8,4)!=="WEBP")throw new Tn("Not a WebP file.");let t=Math.min(e.length,8+Zf(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=Zf(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new Tn("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:Ul(e,r,4),size:s,start:r}),r=i}return n}function AF(e){let t=OF(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:Qf(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function RF(e,t){let n=null;for(let r=t+1;r<e.length;r++){let s=e[r];if(n!==null){if(s===n)n=null}else if(s==='"'||s==="'")n=s;else if(s===">")return r}return-1}function NF(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new Tn("Not an SVG file.");let n=RF(e,t.index);if(n===-1)throw new Tn("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function TF(e){NF(e);let t=CF.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var Tn,bF,$F,SF,qy,bj,jF="XML:com.adobe.xmp",CF;var wj=J(()=>{Tn=class Tn extends Error{name="XmpContainerError"};bF=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);$F=new TextEncoder,SF=new TextDecoder("utf-8",{fatal:!0});qy=$F.encode("http://ns.adobe.com/xap/1.0/\x00");bj=Uint8Array.of(137,80,78,71,13,10,26,10);CF=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function vj(){return{alt:"",focus:null,tags:[]}}function MF(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function Hy(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=MF(n),s=r===null?JF.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new Jn(`Unknown entity ${t}`);return s})}function IF(e){let t={attrs:[],children:[],name:"#root",type:"element"},n=[t],r=0,s=()=>n.at(-1)??t;while(r<e.length){let o=e.indexOf("<",r);if(o===-1){s().children.push({type:"text",value:Hy(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:Hy(e.slice(r,o))});let i=e.slice(o,o+9),a;if(i.startsWith("<!--"))a=e.indexOf("-->",o),a=a===-1?-1:a+3;else if(i.startsWith("<![CDATA["))a=e.indexOf("]]>",o),a=a===-1?-1:a+3;else if(i.startsWith("<?"))a=e.indexOf("?>",o),a=a===-1?-1:a+2;else if(i.startsWith("<!"))throw new Jn("A packet may not declare a document type.");else if(i.startsWith("</")){let l=e.indexOf(">",o);if(l===-1)throw new Jn("Unclosed end tag.");let c=e.slice(o+2,l).trim(),u=n.pop();if(u===void 0||u===t||u.name!==c)throw new Jn(`Unexpected </${c}>.`);r=l+1;continue}else{r=DF(e,o,n);continue}if(a===-1)throw new Jn("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new Jn(`<${s().name}> is never closed.`);return t.children}function DF(e,t,n){let r=t+1,s=Ej.exec(e.slice(r));if(s===null)throw new Jn("A tag has no name.");let o={attrs:[],children:[],name:s[0],type:"element"};r+=s[0].length;for(;;){while(/\s/.test(e[r]??""))r+=1;let i=e[r];if(i===void 0)throw new Jn(`<${o.name}> is never finished.`);if(i===">"||e.startsWith("/>",r)){if(n.at(-1)?.children.push(o),i===">")return n.push(o),r+1;return r+2}let a=Ej.exec(e.slice(r));if(a===null)throw new Jn(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new Jn(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let l=e[r];if(l!=='"'&&l!=="'")throw new Jn(`${a[0]} is not quoted.`);let c=e.indexOf(l,r+1);if(c===-1)throw new Jn(`${a[0]} is never closed.`);o.attrs.push([a[0],Hy(e.slice(r+1,c))]),r=c+1}}function Zi(e,t){let n=e.attrs.filter(([s])=>s==="xmlns"||s.startsWith("xmlns:"));if(n.length===0)return t;let r=new Map(t);for(let[s,o]of n)r.set(s==="xmlns"?"":s.slice(6),o);return r}function LF(e,t,n=!1){let r=e.indexOf(":");if(r===-1)return n?["",e]:[t.get("")??"",e];let s=e.slice(0,r),o=s==="xml"?"http://www.w3.org/XML/1998/namespace":t.get(s);return o===void 0?null:[o,e.slice(r+1)]}function mr(e,t,n,r,s=!1){let o=LF(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function Qi(e){return e.filter((t)=>t.type==="element")}function ea(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?ea(t):"").join("")}function Pj(e,t=new Map){let n=[];for(let r of Qi(e)){let s=Zi(r,t);if(mr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...Pj(r.children,s))}return n}function ta(e,t){let n=[];for(let r of Qi(e.children)){let s=Zi(r,t);for(let o of Qi(r.children)){let i=Zi(o,s);if(mr(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function FF(e,t){let n=e.attrs.find(([r])=>mr(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function VF(e,t){let n=ta(e,t),r=n.find(([s,o])=>FF(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?ea(e).trim():ea(r[0])}function ed(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&mr(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of Qi(e.children)){let s=Zi(r,t);if(mr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function Kl(e,t,n,r){for(let s of Qi(e.children)){let o=Zi(s,t);if(mr(s.name,o,n,r))return[s,o]}return null}function zl(e,t,n,r){let s=e.attrs.find(([i])=>mr(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=Kl(e,t,n,r);return o===null?null:ea(o[0]).trim()}function jj(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function qF(e,t){let n=Kl(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return ta(...n).some(([r,s])=>{let[o,i]=ed(r,s),a=Kl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[zl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:ta(...a).map(([c])=>ea(c).trim())).some((c)=>c.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function HF(e,t){let[n,r]=ed(e,t),s=Kl(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!qF(n,r))return null;let[o,i]=ed(...s),a=Kl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(zl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||zl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let l=ta(...a);if(l.length!==1)return null;let[c,u]=ed(...l[0]),d=jj(zl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=jj(zl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function WF(e){let t=new Set,n=[];for(let r of e){let s=r.trim(),o=s.toLowerCase();if(s!==""&&!t.has(o))t.add(o),n.push(s)}return n}function _j(e){if(e===null)return vj();let t=vj(),n=!1;for(let[r,s]of Pj(IF(e))){for(let[o,i]of r.attrs)if(!n&&mr(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of Qi(r.children)){let i=Zi(o,s);if(!n&&mr(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=VF(o,i),n=!0;else if(mr(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...ta(o,i).map(([a])=>ea(a)));else if(t.focus===null&&mr(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,l]of ta(o,i))t.focus??=HF(a,l)}}return t.tags=WF(t.tags),t.alt=t.alt.trim(),t}var Jn,JF,Ej;var kj=J(()=>{Jn=class Jn extends Error{name="XmpParseError"};JF=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);Ej=/^[A-Za-z_][\w.:-]*/});import{existsSync as Mj,readFileSync as BF,statSync as UF}from"node:fs";import{basename as zF,extname as Uy,resolve as Oj}from"node:path";async function XF(e,t){let n=t.get(e);if(!n){let r=Yi(e);try{let s=await ij(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!Aj)Aj=!0,console.warn(`Could not read image dimensions (${be(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function Cj(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=YF(e);return t.widths.filter((l)=>l<=n).toSorted((l,c)=>l-c).map((l)=>`/cdn-cgi/image/width=${l},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${l}w`).join(", ")}function YF(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function ZF(e,t,n,r,s){let o=dj(e,n),i=gj(s,o);if(i){if(i.variants.every((c)=>Mj(c.absolutePath)))return i}if(!i)console.log(` Optimizing ${zF(e)}...`);let a=await cj(e,Yf(r),n);return yj(s,o,t,a),a}function QF(e){if(!e)return!0;if(e.includes("${"))return!0;if(Dj.some((n)=>e.startsWith(n)))return!0;let t=Uy(e).toLowerCase();return!KF.has(t)&&!Ij.has(t)}function e2(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 n=new URL(e);if(GF.has(Uy(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function Lj(e,t,n){let r=n?.length?xu(n,e):null;if(r)return r;if(e.startsWith("/"))return Oj(t,"public",e.slice(1));return Oj(t,e)}function Nj(e){return`${Math.round(e*1000)/10}%`}function t2(e){let t=$j(e);if(t===null)return null;let n;try{let o=UF(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=Rj.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(BF(e)),{focus:i}=_j(Sj(o,t));s=i===null?null:`${Nj(i.x)} ${Nj(i.y)}`}catch{s=null}return Rj.set(n,s),s}function n2(e,t,n,r){if(!k(t)||t===""||t.includes("${"))return;if(Dj.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!D(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=t2(Lj(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}function gs(e){return e.replaceAll("$","$$$$")}async function zy(e,t,n,r,s,o=[]){let i=new Map;return await Fj(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function Fj(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await u2(e,t,n,r,s,o,i,a))return}if(k(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await g2(e.innerHTML,t,n,r,s,o,i,By(e,a));let l=By(e,a);for(let c of r2(e))await Fj(c,t,n,r,s,o,i,l)}function r2(e){let t=[],n=(s)=>{if(!Ot(s))return;if(s.$prototype==="Array"){n(s.map);return}t.push(s)};if(Array.isArray(e.children))for(let s of e.children)n(s);else n(e.children);let r=e.cases??{};for(let s of Object.values(r))n(s);return t}async function Vj(e,t,n,r,s,o,i,a){if(!k(e)||t)return null;let l=e2(e,n);if(!l&&QF(e))return null;if(l)return{dims:null,sources:[],srcset:Cj(e,n,1/0,null)};let c=Lj(e,r,a);if(!Mj(c))return null;if(n.service==="cloudflare"){let g=await XF(c,o),x=Cj(e,n,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:x}}if(Ij.has(Uy(c).toLowerCase()))return null;let u=i.get(c);if(!u)u=await ZF(c,e,n,r,s),i.set(c,u);let d=o2(n.formats,u.variants),m=[...Tj.filter((g)=>d.includes(g)),...d.filter((g)=>!Tj.includes(g))].flatMap((g)=>{let x=uj(u.variants,g);return x===""?[]:[{srcset:x,type:s2.get(g)??`image/${g}`}]}),y=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,S=n.picture!==!1&&m.length>1;return{dims:y,fallbackSrc:a2(u.variants,d),sources:S?m:[],srcset:m[0]?.srcset??""}}function o2(e,t){return e.includes("jpeg")&&!e.includes("png")&&t.some((r)=>r.format==="png")&&!t.some((r)=>r.format==="jpeg")?[...e,"png"]:e}function a2(e,t){let n=i2.find((s)=>t.includes(s)&&e.some((o)=>o.format===s));if(n===void 0)return;let r;for(let s of e)if(s.format===n&&(r===void 0||s.width>r.width))r=s;return r&&Dy(r.outputPath)}function Jj(e){if(!k(e))return null;let t=l2.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function By(e,t){let{style:n}=e;if(!D(n))return t;let r=t;for(let s of[Jj(n.maxWidth),Jj(n.width)])if(s!==null&&(r===null||s<r))r=s;return r}function qj(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}function c2(e,t){for(let[n,r]of Object.entries(e)){if(n==="id"||n==="className")continue;let s=Bu("img",n);if(!s)continue;if(delete e[n],t[s.attribute]!==void 0)continue;if(me(r)||le(r)){t[s.attribute]=r;continue}let o=qg(s,r);if(o===null)continue;t[s.attribute]=o===""&&s.kind!=="text"?!0:o}}async function u2(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;c2(e,l),n2(e,l.src,n,i);let c=t.optimize?await Vj(l.src,l["data-no-optimize"]!==void 0||l.srcset!==void 0,t,n,r,s,o,i):null,u=By(e,a),d=l.sizes??qj(u)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,d!==void 0)l.sizes=d;if(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,Vy(l,t.lazyLoad)),c&&c.sources.length>0)return f2(e,c.sources,d),!0;return!1}function f2(e,t,n){let r={...e.attributes},s=r.sizes??n;delete r.srcset,delete r.sizes;let o={attributes:r,tagName:"img"};if(e.style!==void 0)o.style=e.style,delete e.style;let i=t.map((a)=>{let l={};if(s!==void 0&&s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function g2(e,t,n,r,s,o,i,a){let l=[];for(let u of e.matchAll(d2)){let d=u[0],p=u[1],m=(Gl(p,"src")??"").replaceAll("&","&"),y=t.optimize&&m!==""?await Vj(m,p2.test(p)||Wy(p,"srcset")||y2(e,u.index),t,n,r,s,o,i):null,S=Gl(p,"sizes"),g=S??qj(a)??t.sizes,x=p,P="";if(y&&y.srcset!==""){if(P+=` srcset="${y.srcset}"`,S===void 0&&g!==void 0&&g!=="")P+=` sizes="${g}"`;let{fallbackSrc:j}=y;if(j!==void 0)x=p.replace(m2,(A,T)=>`${T}src="${j}"`)}if(y?.dims&&!Wy(p,"width")&&!Wy(p,"height"))P+=` width="${y.dims.width}" height="${y.dims.height}"`;let w=Vy({decoding:Gl(p,"decoding"),fetchpriority:Gl(p,"fetchpriority"),loading:Gl(p,"loading")},t.lazyLoad);for(let[j,A]of Object.entries(w))P+=` ${j}="${A}"`;if(P==="")continue;let E=y&&y.sources.length>0?x2(x,y.sources,g,P):`<img${x}${P}>`;l.push({match:d,replacement:E})}let c=e;for(let{match:u,replacement:d}of l)c=c.replace(u,gs(d));return c}function y2(e,t){let n=e.slice(0,t).toLowerCase();return n.lastIndexOf("<picture")>n.lastIndexOf("</picture>")}function x2(e,t,n,r){let s=e.replace(h2,""),o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,""),i=n===void 0||n===""?"":` sizes="${n}"`;return`<picture>${t.map((l)=>`<source type="${l.type}" srcset="${l.srcset}"${i}>`).join("")}<img${s}${o}></picture>`}function Gl(e,t){return new RegExp(`(?:^|\\s)${t}="([^"]*)"`,"i").exec(e)?.[1]}function Wy(e,t){return new RegExp(`(?:^|\\s)${t}=`,"i").test(e)}var KF,Ij,GF,Dj,Aj=!1,Rj,Tj,s2,i2,l2,d2,p2,m2,h2;var Hj=J(()=>{Ly();Fy();An();uh();ce();yn();Lt();wj();kj();KF=new Set([".jpg",".jpeg",".png",".webp",".tif",".tiff",".bmp"]),Ij=new Set([".avif"]),GF=new Set([".svg",".gif"]),Dj=["http://","https://","data:","//"];Rj=new Map;Tj=["avif","webp","jpeg","png"],s2=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);i2=["jpeg","png"];l2=/^(\d+(?:\.\d+)?)(px|rem)$/;d2=/<img\b([^>]*)>/gi,p2=/\bdata-no-optimize\b/,m2=/(^|\s)src="[^"]*"/i,h2=/(?:^|\s)sizes="[^"]*"/i});import{createHash as b2}from"node:crypto";import{existsSync as $2}from"node:fs";import{join as Wj}from"node:path";function v2(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?Wj(t,n,"index.html"):Wj(t,n)}function Gy(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function E2(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return b2("sha256").update(t,"utf8").digest("hex").slice(0,8)}function Bj(e,t,n=""){let r=[],s=[],o=[...e.precache??[]],i=e.offlineFallback;if(i!==void 0&&!o.includes(i))o.push(i),r.push(`serviceWorker: "${i}" 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 m of o)if(!m.startsWith("/"))s.push(`serviceWorker.precache: "${m}" must be a site-absolute URL starting with /.`);else if(!$2(v2(m,t)))s.push(`serviceWorker.precache: "${m}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=o.map((m)=>Fe(n,m)),l=Fe(n,S2),c=i===void 0?null:Fe(n,i),u=`${Fe(n,w2)}/`,d=`jx-${E2(e)}`,p=`/*
|
|
409
432
|
* Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
|
|
410
433
|
* Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
|
|
411
434
|
*/
|
|
412
435
|
const CACHE = ${JSON.stringify(d)};
|
|
413
436
|
const PRECACHE = ${JSON.stringify(a)};
|
|
414
|
-
const CACHE_FIRST = ${JSON.stringify(
|
|
415
|
-
const OFFLINE_FALLBACK = ${JSON.stringify(
|
|
437
|
+
const CACHE_FIRST = ${JSON.stringify(l)};
|
|
438
|
+
const OFFLINE_FALLBACK = ${JSON.stringify(c)};
|
|
416
439
|
const DYNAMIC = ${JSON.stringify(u)};
|
|
417
440
|
|
|
418
441
|
// A response its server marked as one visitor's, or as not to be kept, is never written to a cache.
|
|
@@ -506,7 +529,7 @@ self.addEventListener("fetch", (event) => {
|
|
|
506
529
|
})(),
|
|
507
530
|
);
|
|
508
531
|
});
|
|
509
|
-
`;return{errors:s,path:
|
|
532
|
+
`;return{errors:s,path:Ky,source:p,warnings:r}}function Uj(){return{errors:[],path:Ky,source:`/*
|
|
510
533
|
* Generated by @jxsuite/compiler. This site had a service worker and no longer does.
|
|
511
534
|
*
|
|
512
535
|
* A worker is sticky: removing the file would leave every previous visitor running the old one
|
|
@@ -529,96 +552,89 @@ self.addEventListener("activate", (event) => {
|
|
|
529
552
|
})(),
|
|
530
553
|
);
|
|
531
554
|
});
|
|
532
|
-
`,warnings:[]}}function
|
|
533
|
-
`,path:"manifest.webmanifest"}],warnings:r}}function
|
|
555
|
+
`,warnings:[]}}function zj(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Fe(t,`/${Ky}`)}',{scope:${JSON.stringify(Fe(t,e))}}).catch(function(){})})}`}var Ky="sw.js",S2="/images/_optimized/",w2="/_jx";var Kj=J(()=>{An()});import{mkdirSync as j2,writeFileSync as P2}from"node:fs";import{dirname as _2,join as k2}from"node:path";function Ds(e,t,n){if(n!==void 0)e[t]=n}function Gj(e){let t=e.manifest,n=[],r=[];if(t===void 0||t.enabled===!1)return{errors:n,files:[],warnings:r};let s=t.name??e.name??"Jx Site",o=Po(e.url),i=[];for(let u of t.icons??[])i.push(k(u.src)?{...u,src:Fe(o,u.src)}:u);let a={display:t.display??"standalone",icons:i,name:s,short_name:t.shortName??s,start_url:Fe(o,t.startUrl??"/")};Ds(a,"description",t.description),Ds(a,"theme_color",t.themeColor),Ds(a,"background_color",t.backgroundColor),Ds(a,"scope",t.scope===void 0?void 0:Fe(o,t.scope)),Ds(a,"orientation",t.orientation),Ds(a,"lang",t.lang),Ds(a,"dir",t.dir),Ds(a,"categories",t.categories);let l=new Set(i.flatMap((u)=>(u.sizes??"").split(/\s+/).map((d)=>Math.trunc(Number(d.split("x")[0]))))),c=O2.filter((u)=>!l.has(u));if(c.length>0)r.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:n,files:[{content:`${JSON.stringify(a,null,2)}
|
|
556
|
+
`,path:"manifest.webmanifest"}],warnings:r}}function Xj(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let n=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)n.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return n}function Yj(e,t){let n=e.securityTxt,r=[],s=[];if(n===void 0||n.enabled===!1)return{errors:r,files:[],warnings:s};let o=n.contact??[];if(o.length===0)r.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(n.expires===void 0)r.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(n.expires);if(Number.isNaN(l.getTime()))r.push(`securityTxt: \`expires\` is not a valid date: "${n.expires}".`);else if(l.getTime()<=t.getTime())r.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let i=[];for(let l of n.preferredLanguages??[]){let c=Bn(l);if(c===null)r.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else i.push(c)}if(r.length>0)return{errors:r,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...o.map((l)=>`Contact: ${l}`),`Expires: ${new Date(n.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(n.encryption??[]).map((l)=>`Encryption: ${l}`),...(n.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...i.length>0?[`Preferred-Languages: ${i.join(", ")}`]:[],...n.canonical===void 0?[]:[`Canonical: ${n.canonical}`],...(n.policy??[]).map((l)=>`Policy: ${l}`),...(n.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:r,files:[{content:`${a.join(`
|
|
534
557
|
`)}
|
|
535
|
-
`,path:".well-known/security.txt"}],warnings:s}}function
|
|
536
|
-
`,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(
|
|
537
|
-
|
|
538
|
-
"imports": {
|
|
539
|
-
${Object.entries(
|
|
540
|
-
`)}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
</script>`}function qF(e,t){try{return xS(e,t),!0}catch{return!1}}async function TE(e,t=Gg,n=!0){let r=[],s=new Set,o=new Map,i=new Map,a=wc(e,"assets"),c=0,l=async(d)=>{if(!i.has(d.specifier))i.set(d.specifier,await SS(d.specifier,t,{target:"browser"}));return i.get(d.specifier)},u=async(d)=>[...IF(d,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let d=0;d<OE;d++){let p=0,m=[];try{m=DF(a,{recursive:!0}).map(String).filter((x)=>x.endsWith(".js")).map((x)=>FF(a,x))}catch{return zg(e,o,r,c)}for(let x of m){let g=[];try{g=await u(x)}catch{continue}for(let y of g){let S=mf.find((j)=>y.startsWith(`${j.specifier}/`));if(!S||s.has(y))continue;s.add(y);let E=y.slice(S.specifier.length+1),v=wc(e,`${S.assetDir.replace(/^\//,"")}${E}`);Kg(Sc(v),{recursive:!0});try{await Eo(`export * from ${JSON.stringify(y)};
|
|
544
|
-
`,{outfile:v,resolveDir:t},{minify:n,resolver:WF(S,v,await l(S),o),target:"browser"}),c+=1,p+=1}catch(j){r.push(`Bundling runtime subpath "${y}": ${ge(j)}`)}}}if(p===0)return zg(e,o,r,c)}return r.push(`Runtime subpath resolution did not settle in ${OE} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),zg(e,o,r,c)}function WF(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(Tp(s))return;if(mf.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(wc(Sc(s),o)!==n)return;return r.set(wc(Sc(t),o),e.specifier),{external:!0,path:o}}}}function zg(e,t,n,r){let s=r;for(let[o,i]of t){if(JF(o))continue;try{Kg(Sc(o),{recursive:!0}),MF(o,`export * from ${JSON.stringify(i)};
|
|
545
|
-
`,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${LF(e,o)}: ${ge(a)}`)}}return{errors:n,written:s}}var mf,Gg,OE=10;var JE=R(()=>{Jp();Yn();le();Rt();mf=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:vs,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Es,specifier:"lit-html"}];Gg=import.meta.dirname});import{copyFileSync as HF,cpSync as Yg,existsSync as Os,mkdirSync as er,mkdtempSync as UF,readFileSync as BF,rmSync as IE,statSync as zF,writeFileSync as Pn}from"node:fs";import{createHash as KF}from"node:crypto";import{tmpdir as GF}from"node:os";import{basename as Zg,dirname as tr,join as br,relative as DE,resolve as gt,sep as XF}from"node:path";async function VE(e,t={}){let{clean:n=!0,includeHeld:r=!1,optimizeImages:s=!0,verbose:o=!1}=t,i=[],a=o?console.log.bind(console):()=>{},c={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},l=performance.now(),u=l,d=(f)=>{let h=performance.now();c[f]=h-u,u=h};a("Loading project.json...");let{config:p}=gs(e);if(!s&&p.images.optimize)p.images={...p.images,optimize:!1},console.log("Image optimization is off for this build: images are published as they are.");if("contentTypes"in p)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 m=gt(e,p.build.outDir),x=gt(e,"pages"),g=gt(e,"public"),y=p.build.trailingSlash??"always",S=p.build.minify!==!1,E=new Map,v=new Map,j=new Map,P=(f)=>{let h=f.toSorted(),w=`/assets/elements-${KF("sha1").update(h.join("\x00")).digest("hex").slice(0,12)}.js`;return j.set(w,h),w},O=AE(),T=O.imports,U=new Set,F=Sv(),{errors:H,i18n:A}=qp(p);for(let f of H)i.push(f),console.error(f);for(let f of O.warnings)console.warn(f);let N=new Map,B=(f,h,b)=>{let w=N.get(f);if(w!==void 0&&w.entryPath!==h)throw Error(`"${b}" and "${w.specifier}" both map to ${f} — rename one`);N.set(f,{entryPath:h,specifier:b})},M=new Set,D=(f)=>{if(!M.has(f))M.add(f),i.push(f),console.error(f)},X=(f)=>{let h=xi(f);if(h===null)return D(`$src "${f}" is not a document script specifier`),f;if(h.side==="server")return D(`${h.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),f;try{let b=Fl(`./${h.path}`);return B(b,f,f),E.set(b,{entryPath:f,script:!0,specifier:f}),b}catch(b){return D(`Script of ${h.path}: ${ge(b)}`),f}},re=(f,h)=>{if(uu(f))return X(f);if(yi(f)!==null)return D(`$src "${f}" names its own document's script, but it is not in a document: project.json has no $script. Move the entry into the page, layout or component that carries the script`),f;if(!yS(f))return f;try{let b=Rp(f,h??e,e);if(!go(f)&&!Os(b))return console.warn(`Sidecar "${f}" not found at ${b} — emitting unbundled`),f;let w=go(f)?f:`./${DE(e,b)}`,_=Fl(w);return B(_,b,f),E.set(_,{entryPath:b,specifier:f}),_}catch(b){return i.push(`Sidecar "${f}": ${ge(b)}`),f}},ue=(f)=>{let h=J$(f);try{let b=Rp(`npm:${f}`,e,e);return B(h,b,f),v.set(h,b),h}catch(b){return i.push(`$head specifier "${f}": ${ge(b)}`),f}},xe=await hs(e,p),z=new Map,be=(f,h,b)=>{let w=zu(f,{docDir:h,imports:b,projectRoot:e,registry:xe});if(w===void 0)throw Error(`external class "${f.$prototype}" names no class: give it a $src or an imports entry, or enable the extension that provides "${f.$prototype}"`);if(uv(w.classDef))throw Error(`external class "${f.$prototype}" reads the build's context (#/$context/) and cannot run in a browser: use "timing": "compiler"`);let _=fv(w),W=Fl(`class:${w.exportName}`);return B(W,w.classJsonPath,f.$prototype),z.set(W,_),W},ae=xe.formats,ee=Lv(e,(f)=>Qr(f,ae));if(ae.entries.length>0)a(` Registered ${ae.entries.length} format(s): ${ae.entries.map((f)=>f.name).join(", ")}`);let ot=xe.serverMounts().filter((f)=>{if(!f.project)return!0;let h=p[f.project.key];return I(h)&&Object.keys(h).length>0});if(ot.length>0&&!p.build.adapter){let f=ot.map((h)=>h.project?`"${h.project.key}"`:`"${h.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${f} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${ME}`)}if(d("setup"),n&&Os(m))IE(m,{force:!0,recursive:!0});if(er(m,{recursive:!0}),!Os(x))throw Error(`pages/ directory not found in ${e}`);a("Discovering pages...");let Te=await gv(x,ae);a(` Found ${Te.length} page(s)`),a("Loading project sections...");let et=await Nv(e,p,xe,{includeHeld:r}),te=Object.keys(et);if(te.length>0)a(` Loaded ${te.length} section(s): ${te.join(", ")}`);let{errors:tt,mounts:Xe}=await Jv(xe,p,e);i.push(...tt);for(let f of tt)console.error(f);if(Xe.length>0)a(` Mounted ${Xe.length} asset dir(s): ${Xe.map((f)=>f.urlPrefix).join(", ")}`);let xt=new Set,de=await QF(xe,p,e),Be=(await bv(Te,e,et,xe,p,A,{errors:i})).map((f)=>Object.assign(f,{locale:Kn(f.urlPattern,A)}));a(` ${Be.length} route(s) after expansion`);let ce=0;d("content");let Et=[],Jr=new Map,rr=new Map,Ft=new Map,{components:mn,errors:Qs}=await zv({formatRegistry:ae,pageSources:Be.map((f)=>f.sourcePath),projectConfig:p,projectRoot:e});for(let f of Qs)i.push(f),console.error(f);if(mn.length>0){a("Compiling components...");let f=gt(m,"components");er(f,{recursive:!0});let h=new Map(mn.map((K)=>[K.path,K.tagName])),b=yo(p.url),w=cf(b),_=new Map,W=async(K,Y)=>{let V=Y??"",ne=_.get(V);if(ne===void 0){let oe=mc(K,Y===null?{}:{sourcePath:Y},e,{asInitialValues:!0,config:p,registerBundle:(Je)=>{re(Je,null)},registry:xe,sections:et});_.set(V,oe),await oe;return}let fe=await ne;if(K.state)Object.assign(K.state,fe)};for(let{doc:K,path:Y}of mn){let V=Ou(K,p.state);try{await W(V,Y);let ne={formats:ae,prepareDocument:W,resolveClass:(oe,Je,Pt)=>Ie(b,be(oe,Je,Pt)),resolveElementPath:(oe,Je)=>{let Pt=Je?gt(Je,oe):gt(oe),ss=h.get(Pt);return ss?`./${ss}.js`:oe.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:p.state,rewriteSrc:(oe,Je)=>Ie(b,re(oe,Je)),serverBaseUrl:w};if(p.$media)ne.$media=p.$media;let fe=await rf(Y,ne);for(let oe of fe.files){let Je=oe.tagName?`${oe.tagName}.js`:Zg(oe.path);if(!Et.includes(oe.tagName))Pn(gt(f,Je),oe.content,"utf8"),Et.push(oe.tagName),ce+=1}if(V.tagName){rr.set(V.tagName,V),Ft.set(V.tagName,Y);let oe=Ao(V,p.defaults),Je=Hw(V.tagName,V.style,V,p.$media??{},oe);if(Je){if(oe===null)Jr.set(V.tagName,Je);xg(Je,Xe,xt),Pn(gt(f,`${V.tagName}.css`),Je,"utf8"),ce+=1}}}catch(ne){let fe=ge(ne),oe=DE(e,Y).replaceAll("\\","/");i.push(`Error compiling component ${oe}: ${fe}`),console.error(`Error compiling component ${oe}: ${fe}`)}}a(` Compiled ${Et.length} component(s): ${Et.join(", ")}`)}let jt=[];for(let[f,h]of rr)jt.push(...hc(h,Ft.get(f),e));if(p.state){let f=hc({state:p.state},An(e),e);for(let h of f)if(yi(h.src)===null)jt.push(h);else D(`Server function "${h.exportName}" in ${h.declaredIn} names "${h.src}", its own document's script, but project.json has no $script. Move the entry into the page, layout or component that carries the script`)}d("components");let ma=p.images.optimize&&p.images.service==="cloudflare",sr=p.images.optimize&&!ma?V0(e):null,Ed=ma?new Map:null;if(sr&&p.images.formats?.includes("webp"))console.warn('images.formats lists "webp", which this compiler writes losslessly: its files are several times the size of AVIF or JPEG. Keep it only for pixel-exact output; ["avif", "jpeg"] is the default.');if(ma)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 or=p.url,ir=yo(or),ns=Boolean(or)&&p.build.sitemap!==!1,rs=[],Lo=Be.filter((f)=>!f.urlPattern.includes(":")&&!f.urlPattern.includes("*")),jd=A===null?new Map:await hv(Lo,ae),Uc=Lo.map((f)=>({translationKey:jd.get(f.urlPattern),urlPattern:f.urlPattern})),en=Yw(Uc,A,or,y),{conflicts:ha,sets:Bc}=ag(Uc,A);for(let f of ha){let[h,b]=f.urlPatterns,w=f.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",_=`${b} and ${h} are both the "${f.locale}" version of "${f.key}". A translation set names one URL per language, so ${b} is `+`dropped from it — it carries no alternates and no switcher. ${w}`;if(f.declared)i.push(_),console.error(_);else console.warn(_)}let eo=Gw(Be,A);if(eo.length>0)console.warn(`i18n.routing is "prefix-always", but ${eo.length} route(s) sit outside the locale tree and are served as "${A?.defaultLocale}": ${eo.slice(0,10).join(", ")}${eo.length>10?`, and ${eo.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(A!==null&&A.routing==="prefix-always"&&!p.build.adapter&&!Be.some((f)=>f.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 zc=new Set,Kc=new Set;for(let f of Be){let h=Xw(f.urlPattern,A);if(h&&!zc.has(h.segment))zc.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{a(` Compiling ${f.urlPattern} ...`);let b=await YF(f,p,e,et,sr,rr,Ed,ae,xe,re,Xe,de,ue,{alternates:en.get(f.urlPattern)??[],i18n:A,translations:Bc.get(f.urlPattern)??[]},T,P,be);jt.push(...b.serverEntries);for(let V of b.unregisteredRelations)if(!Kc.has(V))Kc.add(V),console.warn(`<link rel="${V}"> — "${V}" 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 w=new Set;for(let[V,ne]of rr)if(Hu(ne))w.add(V);if(Et.length>0)b.html=rL(b.html,Et,Jr,w,b.files.map((V)=>V.content).join(`
|
|
546
|
-
`),T);for(let V of RE(b.html))U.add(V);xg(b.html,Xe,xt),wv(b.html,F);let _=BE(f.urlPattern,m,y);er(tr(_),{recursive:!0});let W=!f.urlPattern.includes(":")&&!f.urlPattern.includes("*"),K=!dc(f.urlPattern)&&!Uw(b.html);if(ns&&!b.excludeFromSitemap&&K&&W){let V=en.get(f.urlPattern)??[];rs.push({lastmod:k(f.sourceMtime)&&f.sourceMtime!==""?f.sourceMtime:aL(zF(f.sourcePath).mtime),loc:ys(Ci(f.urlPattern,y),or),...V.length>0&&{alternates:V}})}let Y=[];for(let V of ae.withCapability("serialize")){if(!V.exportTarget||dc(f.urlPattern))continue;try{let ne=await V.call("serialize",b.doc,{buildScope:(fe)=>wi(fe,null),componentDefs:rr,evaluateTemplate:(fe,oe)=>{if(!me(fe))return;return Wt(fe,oe)??fe},mode:"export"});if(ne){let fe=_.replace(/\.html$/,V.extensions[0]);Y.push({content:ne,path:fe,type:V.mediaTypeEssence})}}catch(ne){i.push(`Error exporting ${V.name} for ${f.urlPattern}: ${ge(ne)}`)}}for(let V of Y)if(V.type!==null)b.html=zw(b.html,{href:Kw(m,V.path),type:V.type});Pn(_,F$(b.html,ir),"utf8"),ce+=1;for(let V of Y)Pn(V.path,V.content,"utf8"),ce+=1;for(let V of b.files){let ne=gt(tr(_),V.path);er(tr(ne),{recursive:!0}),Pn(ne,V.content,"utf8"),ce+=1}}catch(b){let w=`Error compiling ${f.urlPattern}: ${ge(b)}`;i.push(w),console.error(w)}}if(d("routes"),sr&&p.images.optimize){q0(e,sr,{prune:i.length===0});let f=W0(sr).filter((b)=>Os(b));if(f.length>0){let b=gt(m,"images/_optimized");er(b,{recursive:!0});for(let w of f)HF(w,gt(b,Zg(w)))}let h=Object.keys(sr.entries).length;if(h>0)a(` Optimized ${h} image(s)`)}let to=[];if(!p.build.adapter&&jt.length>0){let h=`timing: "server" entries ${[...new Set(jt.map(({exportName:b,declaredIn:w})=>`${b} (${w})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${ME}`;i.push(h),console.error(h)}if(p.build.adapter){let{adapter:f}=p.build;a("Generating site-wide server worker...");let{entries:h,errors:b}=Xv(jt);to=h;for(let Y of b)i.push(Y),console.error(Y);let{mounts:w,connectors:_}=ZF(ot,xe,p);if(w.length>0)a(` Mounting ${w.length} extension route(s): ${w.map((Y)=>Y.basePath).join(", ")}`);let K=f==="cloudflare-pages"&&to.length===0&&w.length===0?null:Rg(to,{adapter:f,base:ir,connectors:_,i18n:A,mounts:w});if(K){let Y=f==="cloudflare-pages"?"_worker.js":"worker.js";try{await wS(K,{adapter:f,outfile:gt(m,Y),plugins:[ee.serverPlugin],projectRoot:e}),ce+=1,a(` Generated dist/${Y} (bundled, ${to.length} server function(s))`)}catch(V){let ne=`Error bundling dist/${Y}: ${ge(V)}`;i.push(ne),console.error(ne)}if(f==="cloudflare-pages")Pn(gt(m,"_routes.json"),`${JSON.stringify({exclude:[],include:(A&&A.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((V)=>Ie(ir,V)),version:1},null,2)}
|
|
547
|
-
`,"utf8"),ce+=1}}if(U.size>0){a(`Bundling ${U.size} client runtime module(s)...`);let f=await CE({...O,assetPaths:[...U]},m,void 0,S);ce+=f.written;for(let h of f.errors)i.push(h),console.error(h)}if(v.size>0){a(`Copying ${v.size} package asset(s)...`);for(let[f,h]of v){let b=gt(m,f.replace(/^\//,""));er(tr(b),{recursive:!0}),Yg(h,b),ce+=1,a(` ${h} → ${f}`)}}if(E.size>0){a(`Bundling ${E.size} client sidecar module(s)...`);for(let[f,h]of E)try{let b=gt(m,f.replace(/^\//,""));er(tr(b),{recursive:!0});let w={entryPath:h.entryPath,outfile:b};if(h.script){let _=await ee.module(h.specifier);w.entryPath=_.path,w.contents=_.contents}await bS(w,{external:Cp,minify:S,plugins:[ee.clientPlugin],target:"browser"}),ce+=1,a(` ${h.specifier} → ${f}`)}catch(b){let w=`Error bundling sidecar "${h.specifier}": ${ge(b)}`;i.push(w),console.error(w)}}if(z.size>0){a(`Bundling ${z.size} external class module(s)...`);let f=UF(br(GF(),"jx-class-entries-"));try{let h=[...z].map(([w,_])=>{let W=br(f,Zg(w));return Pn(W,_,"utf8"),W}),b=await $S(h,gt(m,"assets"),{external:Cp,minify:S,target:"browser"});ce+=b.length;for(let w of z.keys())a(` ${w}`)}catch(h){let b=`Error bundling external classes: ${ge(h)}`;i.push(b),console.error(b)}finally{IE(f,{force:!0,recursive:!0})}}if(j.size>0){a(`Bundling ${j.size} npm element set(s)...`);for(let[f,h]of j){let b=gt(m,f.replace(/^\//,""));er(tr(b),{recursive:!0});try{await Eo(`${h.map((w)=>`import ${JSON.stringify(w)};`).join(`
|
|
558
|
+
`,path:".well-known/security.txt"}],warnings:s}}function Zj(e,t,n){let r=0,s=[];for(let o of e){let i=k2(t,o.path);if(n(i)){s.push(o.path);continue}j2(_2(i),{recursive:!0}),P2(i,o.content,"utf8"),r+=1}return{skipped:s,written:r}}var O2;var Qj=J(()=>{An();Jo();ce();O2=[192,512]});import{existsSync as A2,mkdirSync as Yy,readFileSync as C2,readdirSync as R2,writeFileSync as N2}from"node:fs";import{dirname as Xl,join as T2,relative as J2,resolve as td}from"node:path";function M2(e){return e.endsWith("/")}function tP(e=Zy){let t={},n=[],r=[];for(let s of nd)if(I2(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,r.push(s.assetPath);else t[s.specifier]=s.fallback,t[`${s.specifier}/`]=`${s.fallback}/`,n.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:r,imports:t,warnings:n}}async function nP(e,t,n=Zy,r=!0){let s=[],o=0;for(let i of nd){if(!e.assetPaths.includes(i.assetPath))continue;let a=td(t,i.assetPath.replace(/^\//,""));Yy(Xl(a),{recursive:!0});try{await No(`export * from ${JSON.stringify(i.specifier)};
|
|
559
|
+
`,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(l){s.push(`Bundling client runtime "${i.specifier}": ${be(l)}`)}}return{errors:s,written:o}}function Qy(e){return Object.entries(e).filter(([t,n])=>!M2(t)&&n.startsWith("/")).map(([,t])=>t)}function rP(e){let t=[];for(let n of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let r;try{r=JSON.parse(n[1])}catch{continue}let s=L(r)?r.imports:void 0;if(!D(s))continue;let o=Object.entries(s).flatMap(([i,a])=>k(a)?[[i,a]]:[]);t.push(...Qy(Object.fromEntries(o)))}return t}function I2(e,t){try{return jw(e,t),!0}catch{return!1}}async function sP(e,t=Zy,n=!0){let r=[],s=new Set,o=new Map,i=new Map,a=0,l=async(u)=>{if(!i.has(u.specifier))i.set(u.specifier,await kw(u.specifier,t,{target:"browser"}));return i.get(u.specifier)},c=async(u)=>[...C2(u,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((p)=>p[1]);for(let u=0;u<eP;u++){let d=0,p=[];try{p=R2(e,{recursive:!0}).map(String).filter((m)=>m.endsWith(".js")).map((m)=>T2(e,m))}catch{return Xy(e,o,r,a)}for(let m of p){let y=[];try{y=await c(m)}catch{continue}for(let S of y){let g=nd.find((w)=>S.startsWith(`${w.specifier}/`));if(!g||s.has(S))continue;s.add(S);let x=S.slice(g.specifier.length+1),P=td(e,`${g.assetDir.replace(/^\//,"")}${x}`);Yy(Xl(P),{recursive:!0});try{await No(`export * from ${JSON.stringify(S)};
|
|
560
|
+
`,{outfile:P,resolveDir:t},{minify:n,resolver:D2(g,P,await l(g),o),target:"browser"}),a+=1,d+=1}catch(w){r.push(`Bundling runtime subpath "${S}": ${be(w)}`)}}}if(d===0)return Xy(e,o,r,a)}return r.push(`Runtime subpath resolution did not settle in ${eP} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Xy(e,o,r,a)}function D2(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(km(s))return;if(nd.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(td(Xl(s),o)!==n)return;return r.set(td(Xl(t),o),e.specifier),{external:!0,path:o}}}}function Xy(e,t,n,r){let s=r;for(let[o,i]of t){if(A2(o))continue;try{Yy(Xl(o),{recursive:!0}),N2(o,`export * from ${JSON.stringify(i)};
|
|
561
|
+
`,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${J2(e,o)}: ${be(a)}`)}}return{errors:n,written:s}}var nd,Zy,eP=10;var oP=J(()=>{Om();yn();ce();Lt();yn();nd=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Ts,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Nr,specifier:"lit-html"}];Zy=import.meta.dirname});import{copyFileSync as L2,cpSync as ex,existsSync as Ls,mkdirSync as hr,mkdtempSync as F2,readFileSync as V2,rmSync as iP,statSync as q2,writeFileSync as on}from"node:fs";import{createHash as H2}from"node:crypto";import{tmpdir as W2}from"node:os";import{basename as tx,dirname as gr,join as Tr,relative as nx,resolve as at,sep as aP}from"node:path";async function fP(e,t={}){let{clean:n=!0,includeHeld:r=!1,optimizeImages:s=!0,verbose:o=!1}=t,i=[],a=o?console.log.bind(console):()=>{},l={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},c=performance.now(),u=c,d=(h)=>{let b=performance.now();l[h]=b-u,u=b};a("Loading project.json...");let{config:p}=As(e);if(!s&&p.images.optimize)p.images={...p.images,optimize:!1},console.log("Image optimization is off for this build: images are published as they are.");if("contentTypes"in p)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 m=at(e,p.build.outDir),y=at(e,"pages"),S=at(e,"public"),g=p.build.trailingSlash??"always",x=p.build.minify!==!1,P=new Map,w=new Map,E=new Map,j=(h)=>{let b=h.toSorted(),_=`/assets/elements-${H2("sha1").update(b.join("\x00")).digest("hex").slice(0,12)}.js`;return E.set(_,b),_},A=tP(),T=A.imports,I=new Set,V=U0(),{errors:H,i18n:O}=Mm(p);for(let h of H)i.push(h),console.error(h);for(let h of A.warnings)console.warn(h);let N=new Map,G=(h,b,v)=>{let _=N.get(h);if(_!==void 0&&_.entryPath!==b)throw Error(`"${v}" and "${_.specifier}" both map to ${h} — rename one`);N.set(h,{entryPath:b,specifier:v})},Q=new Set,re=(h)=>{if(!Q.has(h))Q.add(h),i.push(h),console.error(h)},ue=(h)=>{let b=Ni(h);if(b===null)return re(`$src "${h}" is not a document script specifier`),h;if(b.side==="server")return re(`${b.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),h;try{let v=gu(`./${b.path}`);return G(v,h,h),P.set(v,{entryPath:h,script:!0,specifier:h}),v}catch(v){return re(`Script of ${b.path}: ${be(v)}`),h}},ne=(h,b)=>{if(Vu(h))return ue(h);if(Ri(h)!==null)return re(`$src "${h}" names its own document's script, but it is not in a document: project.json has no $script. Move the entry into the page, layout or component that carries the script`),h;if(!Ew(h))return h;try{let v=Pm(h,b??e,e);if(!jo(h)&&!Ls(v))return console.warn(`Sidecar "${h}" not found at ${v} — emitting unbundled`),h;let _=jo(h)?h:`./${nx(e,v)}`,M=gu(_);return G(M,v,h),P.set(M,{entryPath:v,specifier:h}),M}catch(v){return i.push(`Sidecar "${h}": ${be(v)}`),h}},fe=(h)=>{let b=VS(h);try{let v=Pm(`npm:${h}`,e,e);return G(b,v,h),w.set(b,v),b}catch(v){return i.push(`$head specifier "${h}": ${be(v)}`),h}},xe=await Os(e,p),X=new Map,B=(h,b,v)=>{let _=Mf(h,{docDir:b,imports:v,projectRoot:e,registry:xe});if(_===void 0)throw Error(`external class "${h.$prototype}" names no class: give it a $src or an imports entry, or enable the extension that provides "${h.$prototype}"`);if(J0(_.classDef))throw Error(`external class "${h.$prototype}" reads the build's context (#/$context/) and cannot run in a browser: use "timing": "compiler"`);let M=M0(_),K=gu(`class:${_.exportName}`);return G(K,_.classJsonPath,h.$prototype),X.set(K,M),K},q=xe.formats,z=fE(e,(h)=>hs(h,q));if(q.entries.length>0)a(` Registered ${q.entries.length} format(s): ${q.entries.map((h)=>h.name).join(", ")}`);let We=xe.serverMounts().filter((h)=>{if(!h.project)return!0;let b=p[h.project.key];return D(b)&&Object.keys(b).length>0});if(We.length>0&&!p.build.adapter){let h=We.map((b)=>b.project?`"${b.project.key}"`:`"${b.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${h} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${lP}`)}if(d("setup"),n&&Ls(m))iP(m,{force:!0,recursive:!0});if(hr(m,{recursive:!0}),!Ls(y))throw Error(`pages/ directory not found in ${e}`);a("Discovering pages...");let qe=await V0(y,q);a(` Found ${qe.length} page(s)`),a("Loading project sections...");let Ye=await sE(e,p,xe,{includeHeld:r}),te=Object.keys(Ye);if(te.length>0)a(` Loaded ${te.length} section(s): ${te.join(", ")}`);let{errors:Ut,mounts:Je}=await iE(xe,p,e);i.push(...Ut);for(let h of Ut)console.error(h);if(Je.length>0)a(` Mounted ${Je.length} asset dir(s): ${Je.map((h)=>h.urlPrefix).join(", ")}`);let jt=new Set,bt=await z2(xe,p,e),ct=(await W0(qe,e,Ye,xe,p,O,{errors:i})).map((h)=>Object.assign(h,{locale:cr(h.urlPattern,O)}));a(` ${ct.length} route(s) after expansion`);let Se=0;d("content");let Ze=p.images.optimize&&p.images.service==="cloudflare",Nt=p.images.optimize&&!Ze?pj(e):null,co=Ze?new Map:null;if(Nt&&p.images.formats?.includes("webp"))console.warn('images.formats lists "webp", which this compiler writes losslessly: its files are several times the size of AVIF or JPEG. Keep it only for pixel-exact output; ["avif", "jpeg"] is the default.');if(Ze)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 $t=[],tr=new Map,tn=new Map,Xr=new Map,{components:Mn,errors:Ca}=await xE({formatRegistry:q,pageSources:ct.map((h)=>h.sourcePath),projectConfig:p,projectRoot:e});for(let h of Ca)i.push(h),console.error(h);if(Mn.length>0){a("Compiling components...");let h=at(m,"components");hr(h,{recursive:!0});let b=new Map(Mn.map((ie)=>[ie.path,ie.tagName])),v=new Set(b.values()),_=new Map,M=new Set,K=Po(p.url),ae=Gf(K),U=new Map,oe=async(ie,ge)=>{await zy(ie,p.images,e,Nt,co??void 0,Je);let De=ge??"",ut=U.get(De);if(ut===void 0){let Me=Vl(ie,ge===null?{}:{sourcePath:ge},e,{asInitialValues:!0,config:p,registerBundle:(Pt)=>{ne(Pt,null)},registry:xe,sections:Ye});U.set(De,Me),await Me;return}let In=await ut;if(ie.state)Object.assign(ie.state,In)};for(let{doc:ie,path:ge}of Mn){let De=df(ie,p.state);try{await oe(De,ge);let ut={formats:q,prepareDocument:async(Me,Pt)=>{await oe(Me,Pt),US(Me,K)},resolveClass:(Me,Pt,Dt)=>Fe(K,B(Me,Pt,Dt)),resolveElementPath:(Me,Pt)=>{let Dt=Pt?at(Pt,Me):at(Me),$r=b.get(Dt);return $r?`./${$r}.js`:Me.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:p.state,rewriteSrc:(Me,Pt)=>Fe(K,ne(Me,Pt)),serverBaseUrl:ae,stylesheetHref:(Me)=>v.has(Me)?Fe(K,Rf(Me)):null};if(p.$media)ut.$media=p.$media;ut.defaults=p.defaults;let In=await Gi(ge,ut);for(let Me of In.files){let Pt=Me.tagName?`${Me.tagName}.js`:tx(Me.path);if(!$t.includes(Me.tagName))on(at(h,Pt),Me.content,"utf8"),$t.push(Me.tagName),Se+=1}if(De.tagName){tn.set(De.tagName,De),Xr.set(De.tagName,ge);let Me=Rn(De,p.defaults),Pt=Nf(De.tagName,De.style,De,p.$media??{},Me);if(_.set(De.tagName,Pt),Me===null)tr.set(De.tagName,Pt),Ff(Pt,Je,jt),on(at(h,`${De.tagName}.css`),Qa(Pt,K),"utf8"),Se+=1;else M.add(De.tagName)}}catch(ut){let In=be(ut),Me=nx(e,ge).replaceAll("\\","/");i.push(`Error compiling component ${Me}: ${In}`),console.error(`Error compiling component ${Me}: ${In}`)}}for(let ie of M){let ge=h0(ie,tn,_,M);Ff(ge,Je,jt),on(at(h,`${ie}.css`),Qa(ge,K),"utf8"),Se+=1}a(` Compiled ${$t.length} component(s): ${$t.join(", ")}`)}if(tn.size>0){let h=[...tn].map(([_,M])=>({className:Ms(_),doc:M,modulePath:nx(e,at(m,"components",`${_}.js`)).split(aP).join("/"),shadow:Rn(M,p.defaults)!==null,tagName:_})),{manifest:b,warnings:v}=pu(h);for(let _ of v)console.warn(_);on(at(m,"custom-elements.json"),mu(b),"utf8"),Se+=1,a(` Wrote custom-elements.json (${h.length} element(s))`)}let dp=Cf($t,tn),xr=[];for(let[h,b]of tn)xr.push(...ql(b,Xr.get(h),e));if(p.state){let h=ql({state:p.state},qn(e),e);for(let b of h)if(Ri(b.src)===null)xr.push(b);else re(`Server function "${b.exportName}" in ${b.declaredIn} names "${b.src}", its own document's script, but project.json has no $script. Move the entry into the page, layout or component that carries the script`)}d("components");let br=p.url,nr=Po(br),bs=Boolean(br)&&p.build.sitemap!==!1,uo=[],bc=ct.filter((h)=>!h.urlPattern.includes(":")&&!h.urlPattern.includes("*")),pp=O===null?new Map:await F0(bc,q),un=bc.map((h)=>({translationKey:pp.get(h.urlPattern),urlPattern:h.urlPattern})),Xo=w0(un,O,br,g),{conflicts:$c,sets:mp}=ay(un,O);for(let h of $c){let[b,v]=h.urlPatterns,_=h.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",M=`${v} and ${b} are both the "${h.locale}" version of "${h.key}". A translation set names one URL per language, so ${v} is `+`dropped from it — it carries no alternates and no switcher. ${_}`;if(h.declared)i.push(M),console.error(M);else console.warn(M)}let fo=$0(ct,O);if(fo.length>0)console.warn(`i18n.routing is "prefix-always", but ${fo.length} route(s) sit outside the locale tree and are served as "${O?.defaultLocale}": ${fo.slice(0,10).join(", ")}${fo.length>10?`, and ${fo.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(O!==null&&O.routing==="prefix-always"&&!p.build.adapter&&!ct.some((h)=>h.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 "/${O.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Sc=new Set,wc=new Set;for(let h of ct){let b=S0(h.urlPattern,O);if(b&&!Sc.has(b.segment))Sc.add(b.segment),console.warn(`Routes under /${b.segment}/ are served as "${O?.defaultLocale}" — `+`i18n.locales declares "${b.meant}", not "${b.segment}". Rename the directory to "${b.meant.toLowerCase()}" or declare the shorter tag.`);try{a(` Compiling ${h.urlPattern} ...`);let v=await B2(h,p,e,Ye,Nt,tn,co,q,xe,ne,Je,bt,fe,{alternates:Xo.get(h.urlPattern)??[],i18n:O,translations:mp.get(h.urlPattern)??[]},T,j,B);xr.push(...v.serverEntries);for(let U of v.unregisteredRelations)if(!wc.has(U))wc.add(U),console.warn(`<link rel="${U}"> — "${U}" 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).");if($t.length>0)v.html=Y2(v.html,$t,tr,new Set($t.filter((U)=>!v.liveTags.has(U))),v.files.map((U)=>U.content).join(`
|
|
562
|
+
`),T,dp);for(let U of rP(v.html))I.add(U);Ff(v.html,Je,jt),z0(v.html,V);let _=gP(h.urlPattern,m,g);hr(gr(_),{recursive:!0});let M=!h.urlPattern.includes(":")&&!h.urlPattern.includes("*"),K=!Ll(h.urlPattern)&&!g0(v.html);if(bs&&!v.excludeFromSitemap&&K&&M){let U=Xo.get(h.urlPattern)??[];uo.push({lastmod:k(h.sourceMtime)&&h.sourceMtime!==""?h.sourceMtime:tV(q2(h.sourcePath).mtime),loc:Cs(zi(h.urlPattern,g),br),...U.length>0&&{alternates:U}})}let ae=[];for(let U of q.withCapability("serialize")){if(!U.exportTarget||Ll(h.urlPattern))continue;try{let oe=await U.call("serialize",v.doc,{buildScope:(ie)=>Do(ie,null),componentDefs:tn,evaluateTemplate:(ie,ge)=>{if(!le(ie))return;return Gt(ie,ge)??ie},mode:"export"});if(oe){let ie=_.replace(/\.html$/,U.extensions[0]);ae.push({content:oe,path:ie,type:U.mediaTypeEssence})}}catch(oe){i.push(`Error exporting ${U.name} for ${h.urlPattern}: ${be(oe)}`)}}for(let U of ae)if(U.type!==null)v.html=x0(v.html,{href:b0(m,U.path),type:U.type});on(_,ym(v.html,nr),"utf8"),Se+=1;for(let U of ae)on(U.path,U.content,"utf8"),Se+=1;for(let U of v.files){let oe=at(gr(_),U.path);hr(gr(oe),{recursive:!0}),on(oe,U.content,"utf8"),Se+=1}}catch(v){let _=`Error compiling ${h.urlPattern}: ${be(v)}`;i.push(_),console.error(_)}}if(d("routes"),Nt&&p.images.optimize){mj(e,Nt,{prune:i.length===0});let h=hj(Nt).filter((v)=>Ls(v));if(h.length>0){let v=at(m,"images/_optimized");hr(v,{recursive:!0});for(let _ of h)L2(_,at(v,tx(_)))}let b=Object.keys(Nt.entries).length;if(b>0)a(` Optimized ${b} image(s)`)}let f=[];if(!p.build.adapter&&xr.length>0){let b=`timing: "server" entries ${[...new Set(xr.map(({exportName:v,declaredIn:_})=>`${v} (${_})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${lP}`;i.push(b),console.error(b)}if(p.build.adapter){let{adapter:h}=p.build;a("Generating site-wide server worker...");let{entries:b,errors:v}=SE(xr);f=b;for(let U of v)i.push(U),console.error(U);let{mounts:_,connectors:M}=U2(We,xe,p);if(_.length>0)a(` Mounting ${_.length} extension route(s): ${_.map((U)=>U.basePath).join(", ")}`);let ae=h==="cloudflare-pages"&&f.length===0&&_.length===0?null:Ty(f,{adapter:h,base:nr,connectors:M,i18n:O,mounts:_});if(ae){let U=h==="cloudflare-pages"?"_worker.js":"worker.js";try{await Ow(ae,{adapter:h,outfile:at(m,U),plugins:[z.serverPlugin],projectRoot:e}),Se+=1,a(` Generated dist/${U} (bundled, ${f.length} server function(s))`)}catch(oe){let ie=`Error bundling dist/${U}: ${be(oe)}`;i.push(ie),console.error(ie)}if(h==="cloudflare-pages")on(at(m,"_routes.json"),`${JSON.stringify({exclude:[],include:(O&&O.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((oe)=>Fe(nr,oe)),version:1},null,2)}
|
|
563
|
+
`,"utf8"),Se+=1}}if(I.size>0){a(`Bundling ${I.size} client runtime module(s)...`);let h=await nP({...A,assetPaths:[...I]},m,void 0,x);Se+=h.written;for(let b of h.errors)i.push(b),console.error(b)}if(w.size>0){a(`Copying ${w.size} package asset(s)...`);for(let[h,b]of w){let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0}),ex(b,v),Se+=1,a(` ${b} → ${h}`)}}if(P.size>0){a(`Bundling ${P.size} client sidecar module(s)...`);for(let[h,b]of P)try{let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0});let _={entryPath:b.entryPath,outfile:v};if(b.script){let M=await z.module(b.specifier);_.entryPath=M.path,_.contents=M.contents}await Pw(_,{external:jm,minify:x,plugins:[z.clientPlugin],target:"browser"}),Se+=1,a(` ${b.specifier} → ${h}`)}catch(v){let _=`Error bundling sidecar "${b.specifier}": ${be(v)}`;i.push(_),console.error(_)}}if(X.size>0){a(`Bundling ${X.size} external class module(s)...`);let h=F2(Tr(W2(),"jx-class-entries-"));try{let b=[...X].map(([_,M])=>{let K=Tr(h,tx(_));return on(K,M,"utf8"),K}),v=await _w(b,at(m,"assets"),{external:jm,minify:x,target:"browser"});Se+=v.length;for(let _ of X.keys())a(` ${_}`)}catch(b){let v=`Error bundling external classes: ${be(b)}`;i.push(v),console.error(v)}finally{iP(h,{force:!0,recursive:!0})}}if(E.size>0){a(`Bundling ${E.size} npm element set(s)...`);for(let[h,b]of E){let v=at(m,h.replace(/^\//,""));hr(gr(v),{recursive:!0});try{await No(`${b.map((_)=>`import ${JSON.stringify(_)};`).join(`
|
|
548
564
|
`)}
|
|
549
|
-
`,{outfile:
|
|
550
|
-
Build complete: ${
|
|
551
|
-
${
|
|
565
|
+
`,{outfile:v,resolveDir:e},{minify:x,target:"browser"}),Se+=1,a(` ${b.length} element(s) → ${h}`)}catch(_){let M=`Error bundling npm $elements [${b.join(", ")}]: ${be(_)}`;i.push(M),console.error(M)}}}if(I.size>0){let h=await sP(m,void 0,x);if(h.written>0)a(`Bundling ${h.written} runtime subpath module(s)...`);Se+=h.written;for(let b of h.errors)i.push(b),console.error(b)}for(let h of xe.emitters()){let b=h.project?.key,v=b?p[b]:void 0;if(b&&(v==null||D(v)&&Object.keys(v).length===0))continue;try{let _=await h.call("emit",v??null,{projectConfig:p,root:e,routes:ct,sections:Ye});for(let M of _??[]){let K=at(m,M.path.replace(/^\//,""));if(!K.startsWith(m+aP))throw Error(`emit path escapes outDir: ${M.path}`);hr(gr(K),{recursive:!0}),on(K,M.content),Se+=1,a(` ${h.name} emitted ${M.path}`)}}catch(_){let M=`Error in ${h.name}.emit: ${be(_)}`;i.push(M),console.error(M)}}if(d("bundles"),p.redirects&&Object.keys(p.redirects).length>0){a("Generating redirects...");let h=new Set(ct.map((v)=>v.urlPattern)),b=eV(p.redirects,m,{basePath:nr,compiledUrls:h,trailingSlash:p.build.trailingSlash});Se+=b.files,i.push(...b.errors)}if(bs)a(`Generating sitemap (${uo.length} URL(s))...`),Se+=rV(uo,m);else if(!br&&p.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(jt.size>0){let{copied:h,missing:b}=aE(jt,Je,m);Se+=h,a(`Copying ${h} mounted asset(s)...`);for(let v of b)console.warn(`Referenced asset not found: ${v}`)}if(Ls(S))a("Copying public/ assets..."),ex(S,m,{recursive:!0});if(bs)Se+=sV(m,br);{let h=[Gj(p),Yj(p,new Date)];for(let _ of h){for(let M of _.errors)i.push(M),console.error(M);for(let M of _.warnings)console.warn(M)}let{skipped:b,written:v}=Zj(h.flatMap((_)=>_.files),m,Ls);Se+=v;for(let _ of b)a(` ${_} — kept the copy from public/`)}{let h=Gy(p.serviceWorker);if(h!==null){let b=h===!1?Uj():Bj(h,m,nr);for(let v of b.warnings)console.warn(v);for(let v of b.errors)i.push(v),console.error(v);if(b.path!==null)on(Tr(m,b.path),b.source,"utf8"),Se+=1,a(h===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:h,rules:b}=Z0(p.build,V);i.push(...h);let v=eE([...b,...Q0(m)],nr);if(v.length>0){a("Writing response headers..."),Se+=tE(m,v);let{adapter:_,deploy:M}=p.build;if(_==="node"||_==="bun")console.warn(`The "${_}" 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(_===void 0&&M===void 0)if(Ls(at(S,"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 a(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}Se+=nE(m)}if(p.copy){a("Copying mapped files...");for(let[h,b]of Object.entries(p.copy)){if(!k(b))throw TypeError(`project.json copy["${h}"] must be a destination path string`);let v=at(e,h),_=at(m,b);hr(gr(_),{recursive:!0}),ex(v,_)}}if(a(`
|
|
566
|
+
Build complete: ${ct.length} routes, ${Se} files`),i.length>0)a(` ${i.length} error(s)`);return d("outputs"),l.total=performance.now()-c,{errors:i,files:Se,routes:ct.length,serverEntries:f,timings:l}}async function B2(e,t,n,r,s,o,i,a,l,c,u,d,p,m,y,S,g){let x=Po(t.url),P=Ki(await hs(e.sourcePath,a),e.sourcePath,n),w=await gE(P,t,n),E=Hf(P,t,n),j=[...ql(P,e.sourcePath,n),...E.flatMap((pe)=>ql(pe.doc,pe.path,n))],A=vE(P.$head??w._pageHead??[],P.description),T=w.$head??[],I=P.title??w._pageTitle??null;delete w._pageHead,delete w._pageTitle;let V=new Set(Object.keys(w.state??{}));P0(w,t,e,n,m.i18n,m.translations);let H=Object.keys(t.state??{}).filter((pe)=>pe!=="$site"&&pe!=="$page"&&!V.has(pe)),O=v0({defaults:t.defaults,pageDir:k(P.$dir)?P.$dir:void 0,pageLang:k(P.$lang)?P.$lang:void 0,routeLocale:cr(e.urlPattern,m.i18n)}),N={...w.state};if(e.pagedState&&w.state&&e.pagedState.key in w.state)w.state[e.pagedState.key]=e.pagedState.items;await Vl(w,e,n,{config:t,registerBundle:(pe)=>{c(pe,null)},registry:l,sections:r});let G=G2(N,w.state??{},e.pagedState?.key),Q=Do(w.state??{},null,{document:w,holdMutable:!0}),re=I??t.name;if(le(re))re=Gt(re,Q)??re;let ue=rx(cP(A,Q),p),ne=rx(cP(T,Q),p);Zl(w,Q,G);let fe={counter:{n:0},media:{...t.$media,...w.$media},rules:[]},xe={n:0},X,B=()=>X??=Do(w.state??{}),q=p0(o,w);if(lx(w,o,{defaults:t.defaults,liveTags:q,slotCss:fe,slotIds:xe,slotScope:B}),w.state){let pe=new Set,ct=new Set(H);for(let[Ze,Nt]of Object.entries(w.state)){if(Ze==="$site"||Ze==="$page")continue;if(L(Nt)&&Nt.timing==="compiler")delete w.state[Ze];else if(Array.isArray(Nt))pe.add(Ze);else if(Mo(Nt))pe.add(Ze),ct.add(Ze)}for(let Ze of H)if(Ze in w.state)pe.add(Ze);let Se=!0;while(Se){Se=!1;let Ze={...w.state};delete Ze.$site,delete Ze.$page;for(let Mn of pe)delete Ze[Mn];let{$head:Nt,$paths:co,title:$t,...tr}=w,tn={...tr,state:Ze};if(i0(tn).length>0){for(let Mn of ct)if(pe.delete(Mn))Se=!0}let Xr=JSON.stringify(tn);for(let Mn of pe)if(ff(Xr,Mn))pe.delete(Mn),Se=!0}for(let Ze of pe)delete w.state[Ze]}let z=Gy(t.serviceWorker),We=z===null||z===!1?[]:[{tagName:"script",textContent:zj(z.scope??"/",x)}],qe=[...Xj(t),...We,...d,...rx(t.$head??[],p)],Ye=EE(qe,ne,ue,{title:re,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!Ll(e.urlPattern)&&{pageUrl:zi(e.urlPattern,t.build.trailingSlash)}});if(t.$media)w.$media={...t.$media,...w.$media};if(Object.values(w.$media??{}).some((pe)=>fr(String(pe))!==null))Ye.splice(2,0,{tagName:"script",textContent:Vi()});let te=t.images;await zy(w,te,n,s,i??void 0,u);let Ut={lang:O.lang,prePaintScheme:!1,projectStyle:t.style??null,resolveClass:(pe)=>Fe(x,g(pe,gr(e.sourcePath),w.imports??{})),rewriteSrc:(pe)=>Fe(x,c(pe,gr(e.sourcePath))),runtimeImports:y,serverBaseUrl:Gf(x),title:re},Je=await My(w,Ut);if(fe.rules.length>0){let pe=`<style>
|
|
567
|
+
${kf(fe.rules.join(`
|
|
552
568
|
`))}
|
|
553
569
|
</style>
|
|
554
|
-
</head
|
|
555
|
-
`):null,
|
|
556
|
-
`),u
|
|
557
|
-
${
|
|
558
|
-
</style>`,
|
|
559
|
-
`);return
|
|
560
|
-
</head>`)},
|
|
561
|
-
`),
|
|
562
|
-
`);return
|
|
563
|
-
</body>`)}function
|
|
564
|
-
</body>`)}function
|
|
565
|
-
${c.join(`
|
|
566
|
-
`)}`;let l=o[1].match(/<script[\s\S]*?<\/script>/gi);if(l)i+=`
|
|
570
|
+
</head>`;Je.html=Je.html.replace("</head>",gs(pe))}Je.html=Q2(Je.html,Ye,O);let jt=(pe)=>typeof pe==="string"&&!pe.startsWith("./")&&!pe.startsWith("../"),bt=[...new Set([...w.$elements??[],...E.flatMap((pe)=>pe.doc.$elements??[]),...P.$elements??[]].filter((pe)=>jt(pe)))];if(bt.length>0)Je.html=Z2(Je.html,S(bt));return{doc:w,excludeFromSitemap:P.$sitemap===!1,files:Je.files,html:Je.html,liveTags:q,unregisteredRelations:_E(Ye),serverEntries:j}}function U2(e,t,n){if(e.length===0)return{connectors:[],mounts:[]};let r=Po(n.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in n)s[c]=n[c]}let o=e.map((l)=>{let c=l.server,{module:u}=c;if(!k(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let d=Fe(r,c.basePath);return{basePath:d,className:l.classDef.title??l.name,module:u,options:{basePath:d,sections:s},order:c.order??100}}),i=new Set;for(let l of Object.values(s)){if(!L(l))continue;for(let c of Object.values(l)){let u=L(c)?c.provider:void 0;if(k(u))i.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!i.has(c))continue;let{module:u}=l.connector;if(!k(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:o}}async function z2(e,t,n){let r=[];for(let s of e.headProviders()){let o=s.project?.key,i=o===void 0?null:t[o];if(o!==void 0&&(i===void 0||i===null))continue;try{let a=await s.call("head",i??null,{projectConfig:t,root:n});r.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${be(a)}`)}}return r}function ax(e,t){if(Array.isArray(e))return e.map((n)=>ax(n,t));if(L(e))return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,ax(r,t)]));if(le(e))return Gt(e,t)??e;return e}function cP(e,t){return e.map((n)=>{if(!D(n))return n;let r={...n};if(r.attributes){r.attributes={...r.attributes};for(let[s,o]of Object.entries(r.attributes))if(le(o))r.attributes[s]=Gt(o,t)??o}if(le(r.textContent))r.textContent=Gt(r.textContent,t)??r.textContent;else if(D(r.textContent))r.textContent=ax(r.textContent,t);return r})}function rx(e,t){return e.map((n)=>{if(!D(n)||!n.attributes)return n;let r={...n,attributes:{...n.attributes}};for(let s of["href","src"]){let o=r.attributes[s];if(k(o)&&K2(o))r.attributes[s]=t(o)}return r})}function K2(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function dP(e){return yP(e).replaceAll("${","${")}function pP(e){return e.replaceAll("${","${")}function mP(e){return k(e)||Ie(e)||Ge(e)?String(e):null}function hP(e,t){if(!D(e))return e;let n={};for(let[r,s]of Object.entries(e))if(r==="children"&&Array.isArray(e.children))n.children=e.children.map((o)=>{if(k(o))return le(o)?mP(Yl(o,t))??o:o;return hP(o,t)});else if(r==="style"&&D(e.style)){let o={...e.style};for(let[i,a]of Object.entries(o))if(le(a))o[i]=Yl(a,t)??a;n.style=o}else if(r==="attributes"&&D(e.attributes)){let o={...e.attributes};for(let[i,a]of Object.entries(o))if(le(a)){let l=Yl(a,t);o[i]=k(l)&&l.includes("${")?pP(l):l??a}n.attributes=o}else if(r==="$props"&&D(e.$props)){let o={...e.$props};for(let[i,a]of Object.entries(o))if(le(a)){let l=Yl(a,t);o[i]=l!==null?l??null:a}n.$props=o}else if(le(s)){let o=Yl(s,t);if(r==="textContent"&&k(o)&&o.includes("${"))n.innerHTML=dP(o);else n[r]=o??s}else n[r]=s;return n}function Yl(e,t){try{let n=t.$map,r=D(n)&&"item"in n?n.item:void 0,s=D(n)&&"index"in n?n.index:void 0,o=Ji(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",o)(t,n,r,s)}catch{return null}}function Zl(e,t,n){if(!D(e))return;if(le(e.innerHTML)){let o=Gt(e.innerHTML,t);if(o!=null)e.innerHTML=String(o).replaceAll("${","${")}let r=e.textContent;if(le(r)){let o=Gt(r,t);if(k(o)&&o.includes("${"))e.innerHTML=dP(o),delete e.textContent;else e.textContent=o??r}if(D(e.style)){for(let[o,i]of Object.entries(e.style))if(le(i))e.style[o]=Gt(i,t)??i}if(D(e.attributes)){for(let[o,i]of Object.entries(e.attributes))if(le(i)){let a=Gt(i,t);e.attributes[o]=k(a)&&a.includes("${")?pP(a):a??i}}if(D(e.$props)){let o=e.$props;for(let[i,a]of Object.entries(o))if(le(a))o[i]=Gt(a,t)??a}let s=e.children;if(Le(s)){let o=uP(s,t,n);if(o){e.children=o;return}}if(le(s)){let o=Gt(s,t);if(Array.isArray(o)){let i=o;e.children=i;for(let a of i)Zl(a,t,n)}}else if(Array.isArray(e.children)){let o=0;while(o<e.children.length){let i=e.children[o];if(le(i)){let a=Gt(i,t);if(Array.isArray(a)){let c=a;e.children.splice(o,1,...c);for(let u of c)Zl(u,t,n);o+=c.length;continue}let l=mP(a);if(l!==null){e.children[o]=l,o+=1;continue}}if(Le(i)){let a=uP(i,t,n);if(a){e.children.splice(o,1,...a),o+=a.length;continue}}Zl(i,t,n),o+=1}}}function G2(e,t,n){let r=new Set(["$site","$page"]);if(n!==void 0)r.add(n);for(let[s,o]of Object.entries(e))if(Pn(o)&&(o.timing===void 0||o.timing==="compiler")&&t[s]!==o)r.add(s);return r}function X2(e,t,n){if(!me(e))return!0;let r=e.$ref;if(r.startsWith("$map/"))return!0;let[s=""]=r.slice(8).split("/"),o=s.replaceAll("~1","/").replaceAll("~0","~");return r.startsWith("#/state/")&&n.has(o)&&!Vg(t,o)}function uP(e,t,n){qo(e);let{items:r,map:s}=e;if(!s||!Hg(e,t))return null;let o=sy(e,t);if(o===null)return null;if(o.length===0&&!X2(r,t,n))return null;return o.map((i,a)=>{let l=Object.create(t);l.$map={index:a,item:i},l["$map/item"]=i,l["$map/index"]=a;let c=hP(s,l);return Zl(c,l,n),c})}function lx(e,t,n={}){let{defaults:r,liveTags:s,slotCss:o,slotIds:i,slotScope:a}=n;if(!D(e))return;if(Array.isArray(e)){for(let u of e)lx(u,t,n);return}if(Array.isArray(e.children))for(let u of e.children)lx(u,t,n);let{tagName:l}=e;if(!k(l))return;let c=t.get(l);if(c){if(e.attributes){let{lifted:I,rest:V}=ey(e.attributes);if(I)e.attributes=V,e.$props={...I,...e.$props}}let u=()=>a?.()??{},d=(I)=>{if(o&&D(I)&&!Array.isArray(I))Af(I,o.rules,o.media,"",o.counter,"jxs");return Fo(I,u(),null)},p=Rn(c,r),m=ty(c,e.attributes,{}),y=m?{...m,...e.$props}:e.$props||null,S={componentDefs:t,defaults:r,liveTags:s,path:[{key:JSON.stringify(y??{}),tag:l}],slotIds:i},g=!oy(l,c,s),{children:x}=e,P=!p&&!g&&Ns(c.children)?Zg(S):null,w=p?(Array.isArray(x)?x:[]).map((I)=>d(I)).join(`
|
|
571
|
+
`):null,E=d0(c,y,p?null:Qg(x,u(),d,P),S);if(P!==null)e.attributes={...e.attributes,[ml]:String(P)};e.innerHTML=p?`<template shadowrootmode="${p}"><link rel="stylesheet" href="${Rf(l)}">${E}</template>${w??""}`:E,delete e.children;let j=Dl(c,y),A=ry(c.style,j);if(Object.keys(A).length>0)e.style={...e.style,...A};let T=ny(c.attributes,j);if(Object.keys(T).length>0)e.attributes={...e.attributes,...T};if(!g&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,g)e.$static=!0;else e.$prerendered=!0}}function Y2(e,t,n=new Map,r=new Set,s="",o={},i=t){let a=(j)=>e.includes(`<${j}`),l=(j)=>s.includes(`<${j}`),c=t.filter((j)=>a(j)||l(j));if(c.length===0)return e;let u=c.flatMap((j)=>{let A=n.get(j);return A===void 0||A===""?[]:[A]}).join(`
|
|
572
|
+
`),d=u===""?"":`<style>
|
|
573
|
+
${kf(u)}
|
|
574
|
+
</style>`,p=(j)=>{let A=j.filter(Boolean).join(`
|
|
575
|
+
`);return A===""?e:e.replace("</head>",gs(` ${A}
|
|
576
|
+
</head>`))},m=new Set(c),y=i.filter((j)=>m.has(j)&&(l(j)||!r.has(j)));if(y.length===0)return p([d]);let S=Pl(o),x=[...Qy(o),...y.map((j)=>`/components/${j}.js`)].map((j)=>`<link rel="modulepreload" href="${j}">`).join(`
|
|
577
|
+
`),P=e.includes('<script type="importmap">'),w=p([P?"":S,x,d]),E=y.map((j)=>`<script type="module" src="/components/${j}.js"></script>`).join(`
|
|
578
|
+
`);return w.replace("</body>",gs(` ${E}
|
|
579
|
+
</body>`))}function Z2(e,t){return e.replace("</body>",gs(` <script type="module" src="${t}"></script>
|
|
580
|
+
</body>`))}function Q2(e,t,n){let r=jE(t),s=/<head>([\s\S]*?)<\/head>/i,o=e.match(s),i="";if(o){let l=o[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)i+=`
|
|
567
581
|
${l.join(`
|
|
568
|
-
`)}
|
|
582
|
+
`)}`;let c=o[1].match(/<script[\s\S]*?<\/script>/gi);if(c)i+=`
|
|
583
|
+
${c.join(`
|
|
584
|
+
`)}`}let a=e;if(s.test(a))a=a.replace(s,gs(`<head>
|
|
569
585
|
${r}${i}
|
|
570
|
-
</head>`);return a=a.replace(/<html\s[^>]*>/i,(
|
|
571
|
-
<link rel="canonical" href="${
|
|
572
|
-
<meta name="robots" content="noindex">`,
|
|
586
|
+
</head>`));return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,gs(`lang="${n.lang}"`)):l.replace("<html",`<html lang="${n.lang}"`);if(n.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${n.dir}"`):c.replace("<html",gs(`<html dir="${n.dir}"`));return c}),a}function gP(e,t,n){if(e==="/")return Tr(t,"index.html");if(Ll(e))return Tr(t,"404.html");let r=e.replace(/^\//,"");if(n==="always")return Tr(t,r,"index.html");return Tr(t,`${r}.html`)}function eV(e,t,n={}){let r=0,s=[],o=[],i=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...n.compiledUrls??[]].map((c)=>i(c))),l=n.trailingSlash??"always";for(let[c,u]of Object.entries(e)){let d=k(u)?u:u.destination,p=!k(u)&&"rewrite"in u&&u.rewrite,m=p?200:!k(u)&&("status"in u)?u.status??301:301;if(!p&&!sx.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...sx.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let y=n.basePath??"";if(o.push(`${Fe(y,c)} ${Fe(y,d)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(i(c)))console.warn(`The ${p?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(p)continue;let S=sx.get(String(m));if(!S.html)continue;let g=gP(c,t,l),x=S.canonical?`
|
|
587
|
+
<link rel="canonical" href="${ox(d)}">`:`
|
|
588
|
+
<meta name="robots" content="noindex">`,P=`<!DOCTYPE html>
|
|
573
589
|
<html>
|
|
574
590
|
<head>
|
|
575
591
|
<meta charset="utf-8">
|
|
576
|
-
<meta http-equiv="refresh" content="0;url=${
|
|
592
|
+
<meta http-equiv="refresh" content="0;url=${ox(d)}">${x}
|
|
577
593
|
<title>Redirecting...</title>
|
|
578
594
|
</head>
|
|
579
595
|
<body>
|
|
580
|
-
<p>Redirecting to <a href="${
|
|
596
|
+
<p>Redirecting to <a href="${ox(d)}">${yP(d)}</a>...</p>
|
|
581
597
|
</body>
|
|
582
|
-
</html>`;
|
|
598
|
+
</html>`;hr(gr(g),{recursive:!0}),on(g,P,"utf8"),r+=1}if(o.length>0)on(Tr(t,"_redirects"),`${o.join(`
|
|
583
599
|
`)}
|
|
584
|
-
`,"utf8"),r+=1;return{errors:s,files:r}}function
|
|
600
|
+
`,"utf8"),r+=1;return{errors:s,files:r}}function yP(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function ox(e){return String(e).replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}function ix(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function tV(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function rV(e,t){if(e.length===0)return 0;let n=e.map((o)=>{let i=(o.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${ix(a.hreflang)}" href="${ix(a.href)}"/>`).join(`
|
|
585
601
|
`);return` <url>
|
|
586
|
-
<loc>${
|
|
602
|
+
<loc>${ix(o.loc)}</loc>
|
|
587
603
|
<lastmod>${o.lastmod}</lastmod>
|
|
588
604
|
${i===""?"":`${i}
|
|
589
605
|
`} </url>`}).join(`
|
|
590
606
|
`),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
591
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${
|
|
607
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${nV}"`:""}>
|
|
592
608
|
${n}
|
|
593
609
|
</urlset>
|
|
594
|
-
`;return
|
|
610
|
+
`;return on(Tr(t,"sitemap.xml"),s,"utf8"),1}function sV(e,t){let n=Tr(e,"robots.txt"),r=Ls(n),s=r?V2(n,"utf8"):`User-agent: *
|
|
595
611
|
Allow: /
|
|
596
612
|
`;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
|
|
597
613
|
`))s+=`
|
|
598
614
|
`;return s+=`
|
|
599
|
-
Sitemap: ${
|
|
600
|
-
`,
|
|
601
|
-
`,"utf8"),
|
|
602
|
-
`,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function
|
|
603
|
-
`,"utf8"),
|
|
604
|
-
`,"utf8");let u=
|
|
605
|
-
`);return
|
|
615
|
+
Sitemap: ${Cs("/sitemap.xml",t)}
|
|
616
|
+
`,on(n,s,"utf8"),r?0:1}var lP='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',sx,nV="http://www.w3.org/1999/xhtml";var xP=J(()=>{ce();dm();Lt();An();zS();Om();bi();hy();rE();is();oE();lE();bE();qf();Ti();Sy();wE();PE();kE();uy();UE();Hl();Jy();yn();Mi();py();dy();Hj();yy();Sl();Kj();iy();Qj();ly();oP();Fy();Eo();sx=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 oV}from"node:module";import{join as iV}from"node:path";import{spawn as aV}from"node:child_process";function lV(e){try{return oV(iV(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 bP(e,t,n=aV,r=process){let o=[lV(e),"--root",e];if(t!==void 0)o.push("--port",String(t));let i=n("bun",o,{stdio:"inherit"});return i.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}`);r.exitCode=1}),r.on("SIGINT",()=>{i.kill("SIGINT")}),r.on("SIGTERM",()=>{i.kill("SIGTERM")}),i.on("exit",(a)=>{r.exitCode=a??0}),i}var $P=()=>{};import{createServer as cV}from"node:http";import{existsSync as rd,readFileSync as SP,statSync as uV}from"node:fs";import{extname as fV,join as cx,normalize as dV,resolve as wP,sep as pV}from"node:path";function hV(e,t){let n=dV(t).replaceAll("\\","/"),r=wP(e,`.${n.startsWith("/")?n:`/${n}`}`);if(r!==e&&!r.startsWith(e+pV))return null;if(rd(r)){if(uV(r).isDirectory()){let o=cx(r,"index.html");return rd(o)?o:null}return r}let s=cx(r,"index.html");return rd(s)?s:null}function vP(e,t){let n=wP(e),r=cV((s,o)=>{let i=new URL(s.url??"/","http://localhost"),a=hV(n,decodeURIComponent(i.pathname));if(a){o.writeHead(200,{"Content-Type":mV.get(fV(a).toLowerCase())??"application/octet-stream"}),o.end(SP(a));return}let l=cx(n,"404.html");if(rd(l)){o.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),o.end(SP(l));return}o.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),o.end("Not found")});return r.listen(t),r}var mV;var EP=J(()=>{bp();mV=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",...m$}))});function gV(e){let{corePath:t,fragments:n,fieldSchemaRefs:r=[]}=e;return{$comment:kP,$defs:{Fields:{$id:xl,anyOf:[{$ref:`${jP}#/$defs/JxFieldSchema`},{$ref:`${jP}#/$defs/RelationshipRef`},...r.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...n.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function ec(e,t,n,r=[]){let s=structuredClone(e),o=new Map,i=new Set;ux(s,i);let a=0,l=async(u)=>{let d=Ql(u),p=o.get(d);if(p!==void 0)return p;let m;try{m=structuredClone(await t(d))}catch(x){throw Error(`bundleSchema: cannot load $ref target "${d}": ${vV(x)}`,{cause:x})}let y=k(m.$id)&&Fs(m.$id)?m.$id:null;a+=y===null?1:0;let S=y??`urn:jx:bundled:${a}`;if(o.set(d,S),i.has(S))return S;i.add(S),m.$id=S,await c(m,wV(d),!0);let g=s.$defs??={};return g[S]=m,S},c=async(u,d,p=!1)=>{if(Array.isArray(u)){for(let g of u)await c(g,d);return}if(!L(u))return;let m=u,y=d;if(!p&&k(m.$id)&&Fs(m.$id))y=null;let S=m.$ref;if(k(S)&&y!==null&&!S.startsWith("#")&&!Fs(S)){let g=S.indexOf("#"),x=g===-1?S:S.slice(0,g),P=g===-1?"":S.slice(g);if(x){let w=await l(`${y}/${x}`);m.$ref=`${w}${P}`}}for(let g of Object.values(m))await c(g,y)};await c(s,Ql(n),!0);for(let u of r)await l(`${Ql(n)}/${u}`);return s}function $V(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*PP(e,t){for(let n of yV){let r=e[n];if(Array.isArray(r)){for(let[s,o]of r.entries())if(L(o))yield[o,`${t}/${n}/${s}`]}else if(L(r))yield[r,`${t}/${n}`]}for(let n of xV){let r=e[n];if(!L(r))continue;for(let[s,o]of Object.entries(r))if(L(o))yield[o,`${t}/${n}/${$V(s)}`]}for(let n of bV){let r=e[n];if(!Array.isArray(r))continue;for(let[s,o]of r.entries())if(L(o))yield[o,`${t}/${n}/${s}`]}}function SV(e,t){let n=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(n.startsWith("//")){let o=n.indexOf("/",2);n=o===-1?"":n.slice(o+1)}n=n.replace(/^schema\//,"");let r=n.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=r;for(let o=2;t.has(s);o+=1)s=`${r}-${o}`;return t.add(s),s}function tc(e){let t=structuredClone(e);if(L(t.$defs)){let o=new Set(Object.keys(t.$defs).filter((a)=>!Fs(a))),i={};for(let[a,l]of Object.entries(t.$defs)){let c=L(l)&&k(l.$id)?l.$id:a;i[Fs(a)?SV(c,o):a]=l}t.$defs=i}let n=new Map,r=(o,i)=>{let{$id:a}=o;if(k(a)&&Fs(a)&&!n.has(a))n.set(a,i);for(let[l,c]of PP(o,i))r(l,c)};r(t,"#");let s=(o,i)=>{let a=i,{$id:l}=o;if(k(l)&&Fs(l)){if(a=n.get(l)??i,a!=="#")delete o.$id}let c=o.$ref;if(k(c)){let u=c.indexOf("#"),d=u===-1?c:c.slice(0,u),p=u===-1?"":c.slice(u+1);if(d===""){if(p.startsWith("/"))o.$ref=`${a}${p}`}else{let m=n.get(d);if(m!==void 0)o.$ref=p?`${m}${p}`:m}}for(let[u]of PP(o,a))s(u,a)};return s(t,"#"),t}function ux(e,t){if(Array.isArray(e)){for(let r of e)ux(r,t);return}if(!L(e))return;let n=e;if(k(n.$id)&&Fs(n.$id))t.add(n.$id);for(let r of Object.values(n))ux(r,t)}function Fs(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function Ql(e){let t=e.replaceAll("\\","/"),n=t.startsWith("/"),r=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(r.length>0&&r.at(-1)!=="..")r.pop();else if(!n)r.push("..");continue}r.push(s)}return(n?"/":"")+r.join("/")}function wV(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function vV(e){return e instanceof Error?e.message:String(e)}function EV(e){let{corePath:t,pathsValueRefs:n}=e;return{$comment:kP,$defs:{PathsValue:{$id:Io,anyOf:[...bl,...n.map((r)=>({$ref:r}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function OP(e){let{baseDir:t,coreDocumentRef:n,coreProjectRef:r,extensions:s,loadJson:o}=e,i=[],a=[],l=[],c=[];for(let p of s){if(p.project)i.push(p.project);if(p.document){let m=await _P(p.document,o,t);if(a.push(...m),m.length>0)l.push(p.document)}if(p.fields)c.push(...await _P(p.fields,o,t)),i.push(p.fields)}let u=gV({corePath:r,fieldSchemaRefs:c,fragments:i}),d=EV({corePath:n,pathsValueRefs:a});return{document:tc(await ec(d,o,t,l)),project:tc(await ec(u,o,t))}}async function _P(e,t,n){let r;try{r=await t(Ql(`${Ql(n)}/${e}`))}catch{return[]}let{$id:s}=r;if(!k(s)||!r.$defs)return[];return Object.keys(r.$defs).map((o)=>`${s}#/$defs/${o}`)}var jP="https://jxsuite.com/schema/project/core/v2",kP="Generated by `jx schema` from project.json#/extensions — do not edit.",yV,xV,bV;var AP=J(()=>{$l();ce();$l();yV=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],xV=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],bV=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as NP,readFileSync as jV,statSync as CP,writeFileSync as sd}from"node:fs";import{createRequire as dx}from"node:module";import{dirname as PV,isAbsolute as _V,relative as px,resolve as Vs,sep as mx}from"node:path";async function TP(e){let{config:t}=As(e),n=await Os(e,t),r=Vs(e),{document:s,project:o}=await OP({baseDir:r,coreDocumentRef:RP(e,OV),coreProjectRef:RP(e,kV),extensions:n.extensions.map((i)=>({document:i.schemas.document&&fx(e,i,i.schemas.document),fields:i.schemas.fields&&fx(e,i,i.schemas.fields),project:i.schemas.project&&fx(e,i,i.schemas.project)})),loadJson:IP(r)});return{documentSchema:s,projectSchema:o}}async function JP(e){let{documentSchema:t,projectSchema:n}=await TP(e),r=Vs(e,"project.schema.json"),s=Vs(e,"document.schema.json");return sd(r,`${JSON.stringify(n,null,2)}
|
|
617
|
+
`,"utf8"),sd(s,`${JSON.stringify(t,null,2)}
|
|
618
|
+
`,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function MP(e,t={}){let{write:n=!0}=t,r=Vs(e),s=qn(r),o=Vs(r,"project.schema.json"),i=Vs(r,"document.schema.json"),a=(S)=>{if(!NP(S))return!0;try{return CP(s).mtimeMs>CP(S).mtimeMs}catch{return!1}},c=a(o)||a(i)?await TP(r):null;if(c&&n)sd(o,`${JSON.stringify(c.projectSchema,null,2)}
|
|
619
|
+
`,"utf8"),sd(i,`${JSON.stringify(c.documentSchema,null,2)}
|
|
620
|
+
`,"utf8");let u=IP(r),d=c?.projectSchema??nc(o),p=c?.documentSchema??nc(i),m=tc(await ec(d,u,r));return{document:tc(await ec(p,u,r)),project:m}}function nc(e){let t=JSON.parse(jV(e,"utf8"));if(!L(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function CV(e){return e.startsWith(AV)&&e.endsWith(".json")}function RV(e,t){try{return dx(import.meta.url).resolve(e)}catch(n){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:n})}}function IP(e){return async(t)=>{let n=Vs(t),r=px(e,n);if(r.startsWith("..")||_V(r))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=r.split(mx).join("/"),o="node_modules/",i=s.lastIndexOf(o),a=i===-1?null:s.slice(i+o.length);if(a!==null&&CV(a))return nc(RV(a,t));if(NP(n))return nc(n);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=im(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 nc(l)}}function RP(e,t){let n=null;try{n=dx(Vs(e,"package.json")).resolve(t)}catch{try{n=dx(import.meta.url).resolve(t)}catch{n=null}}let r=`./node_modules/${t}`;return n?DP(e,n,r):r}function fx(e,t,n){let r=px(PV(t.manifestPath),n).split(mx).join("/"),s=`./node_modules/${t.specifier}/${r}`;return DP(e,n,s)}function DP(e,t,n){let r=px(e,t).split(mx).join("/");if(r.startsWith(".."))return n;return r.startsWith("./")?r:`./${r}`}var kV="@jxsuite/schema/schemas/project.core.schema.json",OV="@jxsuite/schema/schema.json",AV="@jxsuite/schema/";var hx=J(()=>{AP();ce();is();bi();Eo()});var VP=W(function(Pne,FP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",LP=pt("fs").promises,od=pt("path");async function NV({folder:e=__dirname}={}){let t={},n=await LP.readdir(e);for(let r of n)if(r.endsWith(".json")&&r!=="package.json"){let s=await LP.readFile(od.join(e,r),"utf8");t[od.basename(r,".json")]=JSON.parse(s)}return t}FP.exports={listAll:NV}});var BP=W(function(_ne,WP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",TV=pt("fs").promises,qP=pt("path");async function HP({folder:e=__dirname}={}){let t=await TV.readFile(qP.join(e,"css.json"),"utf8");return JSON.parse(t)}async function JV({folder:e=__dirname}={}){let t=await HP(e),n={};for(let[r,s]of Object.entries(t)){n[r]={};for(let o of s){let i=o.name,a=null;if(o.for)a=s.find((l)=>l!==o&&l.name===o.name);if(a)i+=" for "+o.for[0];if(n[r][i]=o,o.descriptors){let l=o.descriptors;o.descriptors={};for(let c of l)o.descriptors[c.name]=c}}}return n}WP.exports={listAll:HP,index:JV}});var UP=W(function(id,gx){(function(e,t){typeof id=="object"&&typeof gx=="object"?gx.exports=t():typeof define=="function"&&define.amd?define([],t):typeof id=="object"?id.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,h)=>{for(var b in h)e.o(h,b)&&!e.o(f,b)&&Object.defineProperty(f,b,{enumerable:!0,get:h[b]})},o:(f,h)=>Object.prototype.hasOwnProperty.call(f,h),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function n(f,h,b,v,_,{level:M="error",autofix:K,ruleName:ae}={}){function U(Dt){return Dt>0?f.slice(h,h+Dt):f.slice(Math.max(h+Dt,0),h)}function oe(Dt,{precedes:$r}={}){let Yr=Dt.map((Na)=>Na.trivia+Na.value).join(""),Ra=f[h];return Ra.type==="eof"?Yr:$r?Yr+Ra.trivia:Yr.slice(Ra.trivia.length)}let ie=f[h].type!=="eof"?f[h].line:f.length>1?f[h-1].line:1,ge=function(Dt){let $r=Dt.split(`
|
|
621
|
+
`);return $r[$r.length-1]}(oe(U(-5),{precedes:!0})),De=U(5),ut=oe(De),In=ge+ut.split(`
|
|
606
622
|
`)[0]+`
|
|
607
|
-
`+(" ".repeat(
|
|
608
|
-
${ss}`;return{message:`${Ox} ${w}`,bareMessage:w,context:Ox,line:fe,sourceName:f.name,level:W,ruleName:Y,autofix:K,input:Pt,tokens:Je}}function r(f,h,b,w){return n(f,h,b,w,"Syntax")}function s(f,h,b,w,_={}){return _.ruleName=b,n(h.source,f.index,h,w,"Validation",_)}e.r(t),e.d(t,{WebIDLParseError:()=>dt,parse:()=>Uc,validate:()=>to,write:()=>eo});class o{constructor({source:f,tokens:h}){Object.defineProperties(this,{source:{value:f},tokens:{value:h,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},h=this;for(;h!==Object.prototype;){let b=Object.getOwnPropertyDescriptors(h);for(let[w,_]of Object.entries(b))(_.enumerable||_.get)&&(f[w]=this[w]);h=Object.getPrototypeOf(h)}return f}}function i(f,h,{useNullableInner:b}={}){if(!f.union){let w=h.unique.get(f.idlType);if(!w)return;if(w.type==="typedef"){let{typedefIncludesDictionary:_}=h.cache;if(_.has(w))return _.get(w);h.cache.typedefIncludesDictionary.set(w,void 0);let W=i(w.idlType,h);if(h.cache.typedefIncludesDictionary.set(w,W),W)return{reference:f,dictionary:W.dictionary}}if(w.type==="dictionary"&&(b||!f.nullable))return{reference:f,dictionary:w}}for(let w of f.subtype){let _=i(w,h);if(_)return w.union?_:{reference:w,dictionary:_.dictionary}}}function a(f,h){if(h.cache.dictionaryIncludesRequiredField.has(f))return h.cache.dictionaryIncludesRequiredField.get(f);h.cache.dictionaryIncludesRequiredField.set(f,void 0);let b=f.members.some((w)=>w.required);if(!b&&f.inheritance){let w=h.unique.get(f.inheritance);w?a(w,h)&&(b=!0):b=!0}return h.cache.dictionaryIncludesRequiredField.set(f,b),b}class c extends Array{constructor({source:f,tokens:h}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:h},parent:{value:null,writable:!0}})}}class l extends o{static parser(f,h){return()=>{let b=f.consumeKind(h);if(b)return new l({source:f.source,tokens:{value:b}})}}get value(){return A(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends l{static parse(f){let h=f.consumeKind("eof");if(h)return new u({source:f.source,tokens:{value:h}})}get type(){return"eof"}}function d(f,h){return N(f,{parser:l.parser(f,h),listName:h+" list"})}let p=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function x(f){for(let h of p){let b=d(f,h);if(b.length)return b}f.error("Expected identifiers, strings, decimals, or integers but none found")}class g extends o{static parse(f){let h={assign:f.consume("=")},b=ee(new g({source:f.source,tokens:h}));if(b.list=[],h.assign){if(h.asterisk=f.consume("*"),h.asterisk)return b.this;h.secondaryName=f.consumeKind(...p)}return h.open=f.consume("("),h.open?(b.list=b.rhsIsList?x(f):X(f),h.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):h.assign&&!h.secondaryName&&f.error("No right hand side to extended attribute assignment"),b.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:h}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((b)=>h==="identifier-list"?f.identifier(b,this.parent):b.write(f)),f.token(this.tokens.close)])}}class y extends o{static parse(f){let h=f.consumeKind("identifier");if(h)return new y({source:f.source,tokens:{name:h},params:g.parse(f)})}constructor({source:f,tokens:h,params:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"params",{value:b})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:h,list:b}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?b:this.params.tokens.secondaryName?A(h.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:h}=this.params;return!h||f?[]:h}*validate(f){let{name:h}=this;if(h==="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(h)){let w=`\`[${h}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(h)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",w,{level:"warning",autofix:(b=this,()=>{let{name:_}=b;b.tokens.name.value=m.get(_),_==="TreatNullAs"&&(b.params.tokens={})})})}var b;for(let w of this.arguments)yield*w.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class S extends c{static parse(f){let h={};h.open=f.consume("[");let b=new S({source:f.source,tokens:h});return h.open?(b.push(...N(f,{parser:y.parse,listName:"extended attribute"})),h.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),b.length||(f.unconsume(h.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),b):b}*validate(f){for(let h of this)yield*h.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((h)=>h.write(f)),f.token(this.tokens.close)]):""}}function E(f,h){let b=f.consume("?");b&&(h.tokens.nullable=b),f.probe("?")&&f.error("Can't nullable more than once")}function v(f,h){let b=function(w,_){let W=w.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!W)return;let K=ee(new j({source:w.source,tokens:{base:W}}));switch(K.tokens.open=w.consume("<")||w.error(`No opening bracket after ${W.value}`),W.value){case"Promise":{w.probe("[")&&w.error("Promise type cannot have extended attribute");let Y=ue(w,_)||w.error("Missing Promise subtype");K.subtype.push(Y);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let Y=re(w,_)||w.error(`Missing ${W.value} subtype`);K.subtype.push(Y);break}case"record":{w.probe("[")&&w.error("Record key cannot have extended attribute");let Y=w.consume(...et)||w.error(`Record key must be one of: ${et.join(", ")}`),V=new j({source:w.source,tokens:{base:Y}});V.tokens.separator=w.consume(",")||w.error("Missing comma after record key type"),V.type=_;let ne=re(w,_)||w.error("Error parsing generic type record");K.subtype.push(V,ne);break}}return K.idlType||w.error(`Error parsing generic type ${W.value}`),K.tokens.close=w.consume(">")||w.error(`Missing closing bracket after ${W.value}`),K.this}(f,h)||D(f);if(!b){let w=f.consumeKind("identifier")||f.consume(...et,...Te);if(!w)return;b=new j({source:f.source,tokens:{base:w}}),f.probe("<")&&f.error(`Unsupported generic type ${w.value}`)}return b.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),b.type=h||null,E(f,b),b.nullable&&b.idlType==="any"&&f.error("Type `any` cannot be made nullable"),b}class j extends o{static parse(f,h){return v(f,h)||function(b,w){let _={};if(_.open=b.consume("("),!_.open)return;let W=ee(new j({source:b.source,tokens:_}));for(W.type=w||null;;){let K=re(b,w)||b.error("No type after open parenthesis or 'or' in union type");K.idlType==="any"&&b.error("Type `any` cannot be included in a union type"),K.generic==="Promise"&&b.error("Type `Promise` cannot be included in a union type"),W.subtype.push(K);let Y=b.consume("or");if(!Y)break;K.tokens.separator=Y}return W.idlType.length<2&&b.error("At least two types are expected in a union type but found less"),_.close=b.consume(")")||b.error("Unterminated union type"),E(b,W),W.this}(f,h)}constructor({source:f,tokens:h}){super({source:f,tokens:h}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new S({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return A([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let _ of[this.extAttrs,this.parent?.extAttrs])for(let W of _){if(W.name!=="AllowShared")continue;let K="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",K,{autofix:P(this,W,_)})}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:(h=this,()=>{h.tokens.base.value="undefined"})});var h;let b=!this.union&&f.unique.get(this.idlType),w=this.union?this:b&&b.type==="typedef"?b.idlType:void 0;if(w&&this.nullable){let{reference:_}=i(w,f)||{};if(_){let W=(this.union?_:this).tokens.base;yield s(W,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let _ of this.subtype)yield*_.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((_)=>_.write(f)),f.token(this.tokens.close)]);let h=this.tokens.prefix||this.tokens.base,b=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],w=f.reference(f.ts.wrap([...b,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(h.trivia),w])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function P(f,h,b){return()=>{let w=b.indexOf(h);b.splice(w,1),!b.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class O extends o{static parse(f){let h=f.consume("=");if(!h)return null;let b=B(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),w=[b];if(b.value==="["){let _=f.consume("]")||f.error("Default sequence value must be empty");w.push(_)}else if(b.value==="{"){let _=f.consume("}")||f.error("Default dictionary value must be empty");w.push(_)}return new O({source:f.source,tokens:{assign:h},expression:w})}constructor({source:f,tokens:h,expression:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"expression",{value:b})}get type(){return M(this.expression[0]).type}get value(){return M(this.expression[0]).value}get negative(){return M(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((h)=>f.token(h))])}}class T extends o{static parse(f){let h=f.position,b={},w=ee(new T({source:f.source,tokens:b}));return w.extAttrs=S.parse(f),b.optional=f.consume("optional"),w.idlType=re(f,"argument-type"),w.idlType?(b.optional||(b.variadic=f.consume("...")),b.name=f.consumeKind("identifier")||f.consume(...te),b.name?(w.default=b.optional?O.parse(f):null,w.this):f.unconsume(h)):f.unconsume(h)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let h=i(this.idlType,f,{useNullableInner:!0});if(h){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:U(this)})}else if(this.parent&&!a(h.dictionary,f)&&function(w){let _=w.parent.arguments||w.parent.list,W=_.indexOf(w);return!_.slice(W+1).some((Y)=>!Y.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(b=this,()=>{let _=ae(b.idlType);b.tokens.optional={..._,type:"optional",value:"optional"},_.trivia=" ",U(b)()})})}var b}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function U(f){return()=>{f.default=O.parse(new de(" = {}"))}}class F extends o{static parse(f,{special:h,regular:b}={}){let w={special:h},_=ee(new F({source:f.source,tokens:w}));return h&&h.value==="stringifier"&&(w.termination=f.consume(";"),w.termination)?(_.arguments=[],_):(h||b||(w.special=f.consume("getter","setter","deleter")),_.idlType=ue(f)||f.error("Missing return type"),w.name=f.consumeKind("identifier")||f.consume("includes"),w.open=f.consume("(")||f.error("Invalid operation"),_.arguments=X(f),w.close=f.consume(")")||f.error("Unterminated operation"),w.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),_.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?A(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let h of this.arguments)yield*h.validate(f)}write(f){let{parent:h}=this,b=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((w)=>w.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:h}),...b,f.token(this.tokens.termination)]),{data:this,parent:h})}}class H extends o{static parse(f,{special:h,noInherit:b=!1,readonly:w=!1}={}){let _=f.position,W={special:h},K=ee(new H({source:f.source,tokens:W}));if(h||b||(W.special=f.consume("inherit")),K.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),W.readonly=f.consume("readonly"),w&&!W.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),W.base=f.consume("attribute"),W.base)return K.idlType=re(f,"attribute-type")||f.error("Attribute lacks a type"),W.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),W.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),K.this;f.unconsume(_)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return A(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let h=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",h)}{let{reference:h}=i(this.idlType,f)||{};if(h){let b=(this.idlType.union?h:this.idlType).tokens.base;yield s(b,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(h,b){if(h.union)return!1;if(h.extAttrs.some((_)=>_.name==="EnforceRange"))return!0;let w=b.unique.get(h.idlType);return w?.type==="typedef"&&w.idlType.extAttrs.some((_)=>_.name==="EnforceRange")}(this.idlType,f)){let h=this.idlType.tokens.base;yield s(h,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.termination)]),{data:this,parent:h})}}function A(f){return f.startsWith("_")?f.slice(1):f}function N(f,{parser:h,allowDangler:b,listName:w="list"}){let _=h(f);if(!_)return[];_.tokens.separator=f.consume(",");let W=[_];for(;_.tokens.separator;){let K=h(f);if(!K){b||f.error(`Trailing comma in ${w}`);break}if(K.tokens.separator=f.consume(","),W.push(K),!K.tokens.separator)break}return W}function B(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function M({type:f,value:h}){switch(f){case"decimal":case"integer":return{type:"number",value:h};case"string":return{type:"string",value:h.slice(1,-1)}}switch(h){case"true":case"false":return{type:"boolean",value:h==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:h.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:h}}}function D(f){let{source:h}=f,b=function(){let _=f.consume("unsigned"),W=f.consume("short","long");if(W){let K=f.consume("long");return new j({source:h,tokens:{prefix:_,base:W,postfix:K}})}_&&f.error("Failed to parse integer type")}()||function(){let _=f.consume("unrestricted"),W=f.consume("float","double");if(W)return new j({source:h,tokens:{prefix:_,base:W}});_&&f.error("Failed to parse float type")}();if(b)return b;let w=f.consume("bigint","boolean","byte","octet","undefined");return w?new j({source:h,tokens:{base:w}}):void 0}function X(f){return N(f,{parser:T.parse,listName:"arguments list"})}function re(f,h){let b=S.parse(f),w=j.parse(f,h);return w&&(ee(w).extAttrs=b),w}function ue(f,h){let b=j.parse(f,h||"return-type");if(b)return b;let w=f.consume("void");if(w){let _=new j({source:f.source,tokens:{base:w}});return _.type="return-type",_}}function xe(f){let h=f.consume("stringifier");if(!h)return;return H.parse(f,{special:h})||F.parse(f,{special:h})||f.error("Unterminated stringifier")}function z(f){let h=f.split(`
|
|
609
|
-
`);if(h.length){let b=h[h.length-1].match(/^\s+/);if(b)return b[0]}return""}function
|
|
610
|
-
${z(h)}`}}}function ae(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return ae(f.idlType);return Object.values(f.tokens).sort((h,b)=>h.index-b.index)[0]}function ee(f,h){if(h||(h=f),!f)return f;return new Proxy(f,{get(b,w){let _=b[w];return Array.isArray(_)&&w!=="source"?ee(_,b):_},set(b,w,_){if(b[w]=_,!_)return!0;if(Array.isArray(_))for(let W of _)W.parent!==void 0&&(W.parent=h);else _.parent!==void 0&&(_.parent=h);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},Te=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],et=["ByteString","DOMString","USVString"],te=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],tt=["-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(te,et,Te),Xe=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],xt=["_constructor","toString","_toString"];class de{constructor(f){this.source=function(h){let b=[],w=0,_="",W=1,K=0;for(;w<h.length;){let V=h.charAt(w),ne=-1;if(/[\t\n\r ]/.test(V)?ne=Y("whitespace",{noFlushTrivia:!0}):V==="/"&&(ne=Y("comment",{noFlushTrivia:!0})),ne!==-1){let fe=b.pop().value;W+=(fe.match(/\n/g)||[]).length,_+=fe,K-=1}else if(/[-0-9.A-Z_a-z]/.test(V)){if(ne=Y("decimal"),ne===-1&&(ne=Y("integer")),ne===-1){ne=Y("identifier");let fe=b.length-1,oe=b[fe];if(ne!==-1){if(xt.includes(oe.value)){let Je=`${A(oe.value)} is a reserved identifier and must not be used.`;throw new dt(r(b,fe,null,Je))}tt.includes(oe.value)&&(oe.type="inline")}}}else V==='"'&&(ne=Y("string"));for(let fe of Xe)if(h.startsWith(fe,w)){b.push({type:"inline",value:fe,trivia:_,line:W,index:K}),_="",w+=fe.length,ne=w;break}if(ne===-1&&(ne=Y("other")),ne===-1)throw Error("Token stream not progressing");w=ne,K+=1}return b.push({type:"eof",value:"",trivia:_,line:W,index:K}),b;function Y(V,{noFlushTrivia:ne}={}){let fe=ot[V];fe.lastIndex=w;let oe=fe.exec(h);return oe?(b.push({type:V,value:oe[0],trivia:_,line:W,index:K}),ne||(_=""),fe.lastIndex):-1}}(f),this.position=0}error(f){throw new dt(r(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let h of f){if(!this.probeKind(h))continue;let b=this.source[this.position];return this.position++,b}}consume(...f){if(!this.probeKind("inline"))return;let h=this.source[this.position];for(let b of f)if(h.value===b)return this.position++,h}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class dt extends Error{constructor({message:f,bareMessage:h,context:b,line:w,sourceName:_,input:W,tokens:K}){super(f),this.name="WebIDLParseError",this.bareMessage=h,this.context=b,this.line=w,this.sourceName=_,this.input=W,this.tokens=K}}class Be extends l{static parse(f){let h=f.consumeKind("string");if(h)return new Be({source:f.source,tokens:{value:h}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:h}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:h}),'"']),{data:this,parent:h}),f.token(this.tokens.separator)])}}class ce extends o{static parse(f){let h={};if(h.base=f.consume("enum"),!h.base)return;h.name=f.consumeKind("identifier")||f.error("No name for enum");let b=ee(new ce({source:f.source,tokens:h}));return f.current=b.this,h.open=f.consume("{")||f.error("Bodyless enum"),b.values=N(f,{parser:Be.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),h.close=f.consume("}")||f.error("Unexpected value in enum"),b.values.length||f.error("No value in enum"),h.termination=f.consume(";")||f.error("No semicolon after enum"),b.this}get type(){return"enum"}get name(){return A(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Et extends o{static parse(f){let h=f.consumeKind("identifier");if(!h)return;let b={target:h};if(b.includes=f.consume("includes"),b.includes)return b.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),b.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Et({source:f.source,tokens:b});f.unconsume(h.index)}get type(){return"includes"}get target(){return A(this.tokens.target.value)}get includes(){return A(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class Jr extends o{static parse(f){let h={},b=ee(new Jr({source:f.source,tokens:h}));if(h.base=f.consume("typedef"),h.base)return b.idlType=re(f,"typedef-type")||f.error("Typedef lacks a type"),h.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=b.this,h.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),b.this}get type(){return"typedef"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class rr extends o{static parse(f,h){let b={base:h},w=ee(new rr({source:f.source,tokens:b}));return b.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=w.this,b.assign=f.consume("=")||f.error("Callback lacks an assignment"),w.idlType=ue(f)||f.error("Callback lacks a return type"),b.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),w.arguments=X(f),b.close=f.consume(")")||f.error("Unterminated callback"),b.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),w.this}get type(){return"callback"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let h of this.arguments)if(yield*h.validate(f),h.idlType.generic==="async_sequence")yield s(h.tokens.name,h,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((h)=>h.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Ft extends o{static parse(f,h,{inheritable:b,allowedMembers:w}){let{tokens:_,type:W}=h;for(_.name=f.consumeKind("identifier")||f.error(`Missing name in ${W}`),f.current=h,h=ee(h),b&&Object.assign(_,function(K){let Y=K.consume(":");return Y?{colon:Y,inheritance:K.consumeKind("identifier")||K.error("Inheritance lacks a type")}:{}}(f)),_.open=f.consume("{")||f.error(`Bodyless ${W}`),h.members=[];;){if(_.close=f.consume("}"),_.close)return _.termination=f.consume(";")||f.error(`Missing semicolon after ${W}`),h.this;let K=S.parse(f),Y;for(let[V,...ne]of w)if(Y=ee(V(f,...ne)),Y)break;Y||f.error("Unknown member"),Y.extAttrs=K,h.members.push(Y.this)}}get partial(){return!!this.tokens.partial}get name(){return A(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?A(this.tokens.inheritance.value):null}*validate(f){for(let h of this.members)h.validate&&(yield*h.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class mn extends o{static parse(f){let h={};if(h.base=f.consume("const"),!h.base)return;let b=D(f);if(!b){let _=f.consumeKind("identifier")||f.error("Const lacks a type");b=new j({source:f.source,tokens:{base:_}})}f.probe("?")&&f.error("Unexpected nullable constant type"),b.type="const-type",h.name=f.consumeKind("identifier")||f.error("Const lacks a name"),h.assign=f.consume("=")||f.error("Const lacks value assignment"),h.value=B(f)||f.error("Const lacks a value"),h.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let w=new mn({source:f.source,tokens:h});return ee(w).idlType=b,w}get type(){return"const"}get name(){return A(this.tokens.name.value)}get value(){return M(this.tokens.value)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:h})}}class Qs extends o{static parse(f){let h=f.position,b=ee(new Qs({source:f.source,tokens:{}})),{tokens:w}=b;if(w.readonly=f.consume("readonly"),w.readonly||(w.async=f.consume("async")),w.base=w.readonly?f.consume("maplike","setlike"):w.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!w.base)return void f.unconsume(h);let{type:_}=b,W=_==="maplike",K=W||_==="iterable"||_==="async_iterable",Y=_==="async_iterable"||b.async&&_==="iterable";w.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${_} declaration`);let V=re(f)||f.error(`Missing a type argument in ${_} declaration`);return b.idlType=[V],b.arguments=[],K&&(V.tokens.separator=f.consume(","),V.tokens.separator?b.idlType.push(re(f)):W&&f.error(`Missing second type argument in ${_} declaration`)),w.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${_} declaration`),f.probe("(")&&(Y?(w.argsOpen=f.consume("("),b.arguments.push(...X(f)),w.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),w.termination=f.consume(";")||f.error(`Missing semicolon after ${_} declaration`),b.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(h=this,()=>{let w=h.tokens.async;h.tokens.base={...w,type:"async_iterable",value:"async_iterable"},delete h.tokens.async})});var h;for(let b of this.idlType)yield*b.validate(f);for(let b of this.arguments)yield*b.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((h)=>h.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class jt extends o{static parse(f){let h=f.consume("constructor");if(!h)return;let b={base:h};b.open=f.consume("(")||f.error("No argument list in constructor");let w=X(f);b.close=f.consume(")")||f.error("Unterminated constructor"),b.termination=f.consume(";")||f.error("No semicolon after constructor");let _=new jt({source:f.source,tokens:b});return ee(_).arguments=w,_}get type(){return"constructor"}*validate(f){for(let h of this.arguments)yield*h.validate(f)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:h}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((b)=>b.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:h})}}function ma(f){let h=f.consume("static");if(!h)return;return H.parse(f,{special:h})||F.parse(f,{special:h})||f.error("No body in static member")}class sr extends Ft{static parse(f,h,{extMembers:b=[],partial:w=null}={}){let _={partial:w,base:h};return Ft.parse(f,new sr({source:f.source,tokens:_}),{inheritable:!w,allowedMembers:[...b,[mn.parse],[jt.parse],[ma],[xe],[Qs.parse],[H.parse],[F.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((b)=>b.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:be(this)});let h=this.extAttrs.filter((b)=>b.name==="Constructor");for(let b of h)yield s(b.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:Ed(this,b)});if(this.extAttrs.some((b)=>b.name==="Global")){let b=this.extAttrs.filter((_)=>_.name==="LegacyFactoryFunction");for(let _ of b)yield s(_.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let w=this.members.filter((_)=>_.type==="constructor");for(let _ of w)yield s(_.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(b,w){let _=function(ne){let fe=V(ne);return{statics:new Set(fe.filter((oe)=>oe.special==="static").map((oe)=>oe.name)),nonstatics:new Set(fe.filter((oe)=>oe.special!=="static").map((oe)=>oe.name))}}(w),W=b.partials.get(w.name)||[],K=b.mixinMap.get(w.name)||[];for(let ne of[...W,...K]){let fe=V(ne),oe=fe.filter((Pt)=>Pt.special==="static"),Je=fe.filter((Pt)=>Pt.special!=="static");yield*Y(oe,_.statics,ne,w),yield*Y(Je,_.nonstatics,ne,w),oe.forEach((Pt)=>_.statics.add(Pt.name)),Je.forEach((Pt)=>_.nonstatics.add(Pt.name))}function*Y(ne,fe,oe,Je){for(let Pt of ne){let{name:ss}=Pt;if(ss&&fe.has(ss)){let Pd=`The ${Pt.special==="static"?"static ":""}operation "${ss}" has already been defined for the base interface "${Je.name}" either in itself or in a mixin`;yield s(Pt.tokens.name,oe,"no-cross-overload",Pd)}}}function V(ne){return ne.members.filter(({type:fe})=>fe==="operation")}}(f,this))}}function Ed(f,h){return f=ee(f),()=>{let b=z(f.extAttrs.tokens.open.trivia),w=f.members.length?z(ae(f.members[0]).trivia):function(fe){let oe=z(fe),Je=oe.includes("\t")?"\t":" ";return oe+Je}(b),_=jt.parse(new de(`
|
|
611
|
-
${
|
|
623
|
+
`+(" ".repeat(ge.length)+"^"),Me=_==="Syntax"?"since":"inside",Pt=`${_} error at line ${ie}${f.name?` in ${f.name}`:""}${b&&b.name?`, ${Me} \`${b.partial?"partial ":""}${function(Dt){let $r=[Dt];for(;Dt&&Dt.parent;){let{parent:Yr}=Dt;$r.unshift(Yr),Dt=Yr}return $r.map((Yr)=>function(Ra,Na){let Nb=Ra;return Na&&(Nb+=` ${Na}`),Nb}(Yr.type,Yr.name)).join(" -> ")}(b)}\``:""}:
|
|
624
|
+
${In}`;return{message:`${Pt} ${v}`,bareMessage:v,context:Pt,line:ie,sourceName:f.name,level:M,ruleName:ae,autofix:K,input:ut,tokens:De}}function r(f,h,b,v){return n(f,h,b,v,"Syntax")}function s(f,h,b,v,_={}){return _.ruleName=b,n(h.source,f.index,h,v,"Validation",_)}e.r(t),e.d(t,{WebIDLParseError:()=>pe,parse:()=>pp,validate:()=>wc,write:()=>mp});class o{constructor({source:f,tokens:h}){Object.defineProperties(this,{source:{value:f},tokens:{value:h,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},h=this;for(;h!==Object.prototype;){let b=Object.getOwnPropertyDescriptors(h);for(let[v,_]of Object.entries(b))(_.enumerable||_.get)&&(f[v]=this[v]);h=Object.getPrototypeOf(h)}return f}}function i(f,h,{useNullableInner:b}={}){if(!f.union){let v=h.unique.get(f.idlType);if(!v)return;if(v.type==="typedef"){let{typedefIncludesDictionary:_}=h.cache;if(_.has(v))return _.get(v);h.cache.typedefIncludesDictionary.set(v,void 0);let M=i(v.idlType,h);if(h.cache.typedefIncludesDictionary.set(v,M),M)return{reference:f,dictionary:M.dictionary}}if(v.type==="dictionary"&&(b||!f.nullable))return{reference:f,dictionary:v}}for(let v of f.subtype){let _=i(v,h);if(_)return v.union?_:{reference:v,dictionary:_.dictionary}}}function a(f,h){if(h.cache.dictionaryIncludesRequiredField.has(f))return h.cache.dictionaryIncludesRequiredField.get(f);h.cache.dictionaryIncludesRequiredField.set(f,void 0);let b=f.members.some((v)=>v.required);if(!b&&f.inheritance){let v=h.unique.get(f.inheritance);v?a(v,h)&&(b=!0):b=!0}return h.cache.dictionaryIncludesRequiredField.set(f,b),b}class l extends Array{constructor({source:f,tokens:h}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:h},parent:{value:null,writable:!0}})}}class c extends o{static parser(f,h){return()=>{let b=f.consumeKind(h);if(b)return new c({source:f.source,tokens:{value:b}})}}get value(){return O(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends c{static parse(f){let h=f.consumeKind("eof");if(h)return new u({source:f.source,tokens:{value:h}})}get type(){return"eof"}}function d(f,h){return N(f,{parser:c.parser(f,h),listName:h+" list"})}let p=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function y(f){for(let h of p){let b=d(f,h);if(b.length)return b}f.error("Expected identifiers, strings, decimals, or integers but none found")}class S extends o{static parse(f){let h={assign:f.consume("=")},b=z(new S({source:f.source,tokens:h}));if(b.list=[],h.assign){if(h.asterisk=f.consume("*"),h.asterisk)return b.this;h.secondaryName=f.consumeKind(...p)}return h.open=f.consume("("),h.open?(b.list=b.rhsIsList?y(f):ue(f),h.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):h.assign&&!h.secondaryName&&f.error("No right hand side to extended attribute assignment"),b.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:h}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((b)=>h==="identifier-list"?f.identifier(b,this.parent):b.write(f)),f.token(this.tokens.close)])}}class g extends o{static parse(f){let h=f.consumeKind("identifier");if(h)return new g({source:f.source,tokens:{name:h},params:S.parse(f)})}constructor({source:f,tokens:h,params:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"params",{value:b})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:h,list:b}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?b:this.params.tokens.secondaryName?O(h.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:h}=this.params;return!h||f?[]:h}*validate(f){let{name:h}=this;if(h==="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(h)){let v=`\`[${h}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(h)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",v,{level:"warning",autofix:(b=this,()=>{let{name:_}=b;b.tokens.name.value=m.get(_),_==="TreatNullAs"&&(b.params.tokens={})})})}var b;for(let v of this.arguments)yield*v.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class x extends l{static parse(f){let h={};h.open=f.consume("[");let b=new x({source:f.source,tokens:h});return h.open?(b.push(...N(f,{parser:g.parse,listName:"extended attribute"})),h.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),b.length||(f.unconsume(h.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),b):b}*validate(f){for(let h of this)yield*h.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((h)=>h.write(f)),f.token(this.tokens.close)]):""}}function P(f,h){let b=f.consume("?");b&&(h.tokens.nullable=b),f.probe("?")&&f.error("Can't nullable more than once")}function w(f,h){let b=function(v,_){let M=v.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!M)return;let K=z(new E({source:v.source,tokens:{base:M}}));switch(K.tokens.open=v.consume("<")||v.error(`No opening bracket after ${M.value}`),M.value){case"Promise":{v.probe("[")&&v.error("Promise type cannot have extended attribute");let ae=fe(v,_)||v.error("Missing Promise subtype");K.subtype.push(ae);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let ae=ne(v,_)||v.error(`Missing ${M.value} subtype`);K.subtype.push(ae);break}case"record":{v.probe("[")&&v.error("Record key cannot have extended attribute");let ae=v.consume(...Ye)||v.error(`Record key must be one of: ${Ye.join(", ")}`),U=new E({source:v.source,tokens:{base:ae}});U.tokens.separator=v.consume(",")||v.error("Missing comma after record key type"),U.type=_;let oe=ne(v,_)||v.error("Error parsing generic type record");K.subtype.push(U,oe);break}}return K.idlType||v.error(`Error parsing generic type ${M.value}`),K.tokens.close=v.consume(">")||v.error(`Missing closing bracket after ${M.value}`),K.this}(f,h)||re(f);if(!b){let v=f.consumeKind("identifier")||f.consume(...Ye,...qe);if(!v)return;b=new E({source:f.source,tokens:{base:v}}),f.probe("<")&&f.error(`Unsupported generic type ${v.value}`)}return b.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),b.type=h||null,P(f,b),b.nullable&&b.idlType==="any"&&f.error("Type `any` cannot be made nullable"),b}class E extends o{static parse(f,h){return w(f,h)||function(b,v){let _={};if(_.open=b.consume("("),!_.open)return;let M=z(new E({source:b.source,tokens:_}));for(M.type=v||null;;){let K=ne(b,v)||b.error("No type after open parenthesis or 'or' in union type");K.idlType==="any"&&b.error("Type `any` cannot be included in a union type"),K.generic==="Promise"&&b.error("Type `Promise` cannot be included in a union type"),M.subtype.push(K);let ae=b.consume("or");if(!ae)break;K.tokens.separator=ae}return M.idlType.length<2&&b.error("At least two types are expected in a union type but found less"),_.close=b.consume(")")||b.error("Unterminated union type"),P(b,M),M.this}(f,h)}constructor({source:f,tokens:h}){super({source:f,tokens:h}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new x({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return O([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let _ of[this.extAttrs,this.parent?.extAttrs])for(let M of _){if(M.name!=="AllowShared")continue;let K="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",K,{autofix:j(this,M,_)})}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:(h=this,()=>{h.tokens.base.value="undefined"})});var h;let b=!this.union&&f.unique.get(this.idlType),v=this.union?this:b&&b.type==="typedef"?b.idlType:void 0;if(v&&this.nullable){let{reference:_}=i(v,f)||{};if(_){let M=(this.union?_:this).tokens.base;yield s(M,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let _ of this.subtype)yield*_.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((_)=>_.write(f)),f.token(this.tokens.close)]);let h=this.tokens.prefix||this.tokens.base,b=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],v=f.reference(f.ts.wrap([...b,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(h.trivia),v])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function j(f,h,b){return()=>{let v=b.indexOf(h);b.splice(v,1),!b.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class A extends o{static parse(f){let h=f.consume("=");if(!h)return null;let b=G(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),v=[b];if(b.value==="["){let _=f.consume("]")||f.error("Default sequence value must be empty");v.push(_)}else if(b.value==="{"){let _=f.consume("}")||f.error("Default dictionary value must be empty");v.push(_)}return new A({source:f.source,tokens:{assign:h},expression:v})}constructor({source:f,tokens:h,expression:b}){super({source:f,tokens:h}),b.parent=this,Object.defineProperty(this,"expression",{value:b})}get type(){return Q(this.expression[0]).type}get value(){return Q(this.expression[0]).value}get negative(){return Q(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((h)=>f.token(h))])}}class T extends o{static parse(f){let h=f.position,b={},v=z(new T({source:f.source,tokens:b}));return v.extAttrs=x.parse(f),b.optional=f.consume("optional"),v.idlType=ne(f,"argument-type"),v.idlType?(b.optional||(b.variadic=f.consume("...")),b.name=f.consumeKind("identifier")||f.consume(...te),b.name?(v.default=b.optional?A.parse(f):null,v.this):f.unconsume(h)):f.unconsume(h)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return O(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let h=i(this.idlType,f,{useNullableInner:!0});if(h){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:I(this)})}else if(this.parent&&!a(h.dictionary,f)&&function(v){let _=v.parent.arguments||v.parent.list,M=_.indexOf(v);return!_.slice(M+1).some((ae)=>!ae.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(b=this,()=>{let _=q(b.idlType);b.tokens.optional={..._,type:"optional",value:"optional"},_.trivia=" ",I(b)()})})}var b}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function I(f){return()=>{f.default=A.parse(new bt(" = {}"))}}class V extends o{static parse(f,{special:h,regular:b}={}){let v={special:h},_=z(new V({source:f.source,tokens:v}));return h&&h.value==="stringifier"&&(v.termination=f.consume(";"),v.termination)?(_.arguments=[],_):(h||b||(v.special=f.consume("getter","setter","deleter")),_.idlType=fe(f)||f.error("Missing return type"),v.name=f.consumeKind("identifier")||f.consume("includes"),v.open=f.consume("(")||f.error("Invalid operation"),_.arguments=ue(f),v.close=f.consume(")")||f.error("Unterminated operation"),v.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),_.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?O(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let h of this.arguments)yield*h.validate(f)}write(f){let{parent:h}=this,b=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((v)=>v.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:h}),...b,f.token(this.tokens.termination)]),{data:this,parent:h})}}class H extends o{static parse(f,{special:h,noInherit:b=!1,readonly:v=!1}={}){let _=f.position,M={special:h},K=z(new H({source:f.source,tokens:M}));if(h||b||(M.special=f.consume("inherit")),K.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),M.readonly=f.consume("readonly"),v&&!M.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),M.base=f.consume("attribute"),M.base)return K.idlType=ne(f,"attribute-type")||f.error("Attribute lacks a type"),M.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),M.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),K.this;f.unconsume(_)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return O(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let h=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",h)}{let{reference:h}=i(this.idlType,f)||{};if(h){let b=(this.idlType.union?h:this.idlType).tokens.base;yield s(b,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(h,b){if(h.union)return!1;if(h.extAttrs.some((_)=>_.name==="EnforceRange"))return!0;let v=b.unique.get(h.idlType);return v?.type==="typedef"&&v.idlType.extAttrs.some((_)=>_.name==="EnforceRange")}(this.idlType,f)){let h=this.idlType.tokens.base;yield s(h,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.termination)]),{data:this,parent:h})}}function O(f){return f.startsWith("_")?f.slice(1):f}function N(f,{parser:h,allowDangler:b,listName:v="list"}){let _=h(f);if(!_)return[];_.tokens.separator=f.consume(",");let M=[_];for(;_.tokens.separator;){let K=h(f);if(!K){b||f.error(`Trailing comma in ${v}`);break}if(K.tokens.separator=f.consume(","),M.push(K),!K.tokens.separator)break}return M}function G(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function Q({type:f,value:h}){switch(f){case"decimal":case"integer":return{type:"number",value:h};case"string":return{type:"string",value:h.slice(1,-1)}}switch(h){case"true":case"false":return{type:"boolean",value:h==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:h.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:h}}}function re(f){let{source:h}=f,b=function(){let _=f.consume("unsigned"),M=f.consume("short","long");if(M){let K=f.consume("long");return new E({source:h,tokens:{prefix:_,base:M,postfix:K}})}_&&f.error("Failed to parse integer type")}()||function(){let _=f.consume("unrestricted"),M=f.consume("float","double");if(M)return new E({source:h,tokens:{prefix:_,base:M}});_&&f.error("Failed to parse float type")}();if(b)return b;let v=f.consume("bigint","boolean","byte","octet","undefined");return v?new E({source:h,tokens:{base:v}}):void 0}function ue(f){return N(f,{parser:T.parse,listName:"arguments list"})}function ne(f,h){let b=x.parse(f),v=E.parse(f,h);return v&&(z(v).extAttrs=b),v}function fe(f,h){let b=E.parse(f,h||"return-type");if(b)return b;let v=f.consume("void");if(v){let _=new E({source:f.source,tokens:{base:v}});return _.type="return-type",_}}function xe(f){let h=f.consume("stringifier");if(!h)return;return H.parse(f,{special:h})||V.parse(f,{special:h})||f.error("Unterminated stringifier")}function X(f){let h=f.split(`
|
|
625
|
+
`);if(h.length){let b=h[h.length-1].match(/^\s+/);if(b)return b[0]}return""}function B(f){return()=>{if(f.extAttrs.length){let h=new bt("Exposed=Window,"),b=g.parse(h);b.tokens.separator=h.consume(",");let v=f.extAttrs[0];/^\s/.test(v.tokens.name.trivia)||(v.tokens.name.trivia=` ${v.tokens.name.trivia}`),f.extAttrs.unshift(b)}else{z(f).extAttrs=x.parse(new bt("[Exposed=Window]"));let h=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=h,f.tokens.base.trivia=`
|
|
626
|
+
${X(h)}`}}}function q(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return q(f.idlType);return Object.values(f.tokens).sort((h,b)=>h.index-b.index)[0]}function z(f,h){if(h||(h=f),!f)return f;return new Proxy(f,{get(b,v){let _=b[v];return Array.isArray(_)&&v!=="source"?z(_,b):_},set(b,v,_){if(b[v]=_,!_)return!0;if(Array.isArray(_))for(let M of _)M.parent!==void 0&&(M.parent=h);else _.parent!==void 0&&(_.parent=h);return!0}})}let We={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},qe=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Ye=["ByteString","DOMString","USVString"],te=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Ut=["-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(te,Ye,qe),Je=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],jt=["_constructor","toString","_toString"];class bt{constructor(f){this.source=function(h){let b=[],v=0,_="",M=1,K=0;for(;v<h.length;){let U=h.charAt(v),oe=-1;if(/[\t\n\r ]/.test(U)?oe=ae("whitespace",{noFlushTrivia:!0}):U==="/"&&(oe=ae("comment",{noFlushTrivia:!0})),oe!==-1){let ie=b.pop().value;M+=(ie.match(/\n/g)||[]).length,_+=ie,K-=1}else if(/[-0-9.A-Z_a-z]/.test(U)){if(oe=ae("decimal"),oe===-1&&(oe=ae("integer")),oe===-1){oe=ae("identifier");let ie=b.length-1,ge=b[ie];if(oe!==-1){if(jt.includes(ge.value)){let De=`${O(ge.value)} is a reserved identifier and must not be used.`;throw new pe(r(b,ie,null,De))}Ut.includes(ge.value)&&(ge.type="inline")}}}else U==='"'&&(oe=ae("string"));for(let ie of Je)if(h.startsWith(ie,v)){b.push({type:"inline",value:ie,trivia:_,line:M,index:K}),_="",v+=ie.length,oe=v;break}if(oe===-1&&(oe=ae("other")),oe===-1)throw Error("Token stream not progressing");v=oe,K+=1}return b.push({type:"eof",value:"",trivia:_,line:M,index:K}),b;function ae(U,{noFlushTrivia:oe}={}){let ie=We[U];ie.lastIndex=v;let ge=ie.exec(h);return ge?(b.push({type:U,value:ge[0],trivia:_,line:M,index:K}),oe||(_=""),ie.lastIndex):-1}}(f),this.position=0}error(f){throw new pe(r(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let h of f){if(!this.probeKind(h))continue;let b=this.source[this.position];return this.position++,b}}consume(...f){if(!this.probeKind("inline"))return;let h=this.source[this.position];for(let b of f)if(h.value===b)return this.position++,h}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class pe extends Error{constructor({message:f,bareMessage:h,context:b,line:v,sourceName:_,input:M,tokens:K}){super(f),this.name="WebIDLParseError",this.bareMessage=h,this.context=b,this.line=v,this.sourceName=_,this.input=M,this.tokens=K}}class ct extends c{static parse(f){let h=f.consumeKind("string");if(h)return new ct({source:f.source,tokens:{value:h}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:h}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:h}),'"']),{data:this,parent:h}),f.token(this.tokens.separator)])}}class Se extends o{static parse(f){let h={};if(h.base=f.consume("enum"),!h.base)return;h.name=f.consumeKind("identifier")||f.error("No name for enum");let b=z(new Se({source:f.source,tokens:h}));return f.current=b.this,h.open=f.consume("{")||f.error("Bodyless enum"),b.values=N(f,{parser:ct.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),h.close=f.consume("}")||f.error("Unexpected value in enum"),b.values.length||f.error("No value in enum"),h.termination=f.consume(";")||f.error("No semicolon after enum"),b.this}get type(){return"enum"}get name(){return O(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Ze extends o{static parse(f){let h=f.consumeKind("identifier");if(!h)return;let b={target:h};if(b.includes=f.consume("includes"),b.includes)return b.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),b.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Ze({source:f.source,tokens:b});f.unconsume(h.index)}get type(){return"includes"}get target(){return O(this.tokens.target.value)}get includes(){return O(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class Nt extends o{static parse(f){let h={},b=z(new Nt({source:f.source,tokens:h}));if(h.base=f.consume("typedef"),h.base)return b.idlType=ne(f,"typedef-type")||f.error("Typedef lacks a type"),h.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=b.this,h.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),b.this}get type(){return"typedef"}get name(){return O(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class co extends o{static parse(f,h){let b={base:h},v=z(new co({source:f.source,tokens:b}));return b.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=v.this,b.assign=f.consume("=")||f.error("Callback lacks an assignment"),v.idlType=fe(f)||f.error("Callback lacks a return type"),b.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),v.arguments=ue(f),b.close=f.consume(")")||f.error("Unterminated callback"),b.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),v.this}get type(){return"callback"}get name(){return O(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let h of this.arguments)if(yield*h.validate(f),h.idlType.generic==="async_sequence")yield s(h.tokens.name,h,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((h)=>h.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class $t extends o{static parse(f,h,{inheritable:b,allowedMembers:v}){let{tokens:_,type:M}=h;for(_.name=f.consumeKind("identifier")||f.error(`Missing name in ${M}`),f.current=h,h=z(h),b&&Object.assign(_,function(K){let ae=K.consume(":");return ae?{colon:ae,inheritance:K.consumeKind("identifier")||K.error("Inheritance lacks a type")}:{}}(f)),_.open=f.consume("{")||f.error(`Bodyless ${M}`),h.members=[];;){if(_.close=f.consume("}"),_.close)return _.termination=f.consume(";")||f.error(`Missing semicolon after ${M}`),h.this;let K=x.parse(f),ae;for(let[U,...oe]of v)if(ae=z(U(f,...oe)),ae)break;ae||f.error("Unknown member"),ae.extAttrs=K,h.members.push(ae.this)}}get partial(){return!!this.tokens.partial}get name(){return O(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?O(this.tokens.inheritance.value):null}*validate(f){for(let h of this.members)h.validate&&(yield*h.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class tr extends o{static parse(f){let h={};if(h.base=f.consume("const"),!h.base)return;let b=re(f);if(!b){let _=f.consumeKind("identifier")||f.error("Const lacks a type");b=new E({source:f.source,tokens:{base:_}})}f.probe("?")&&f.error("Unexpected nullable constant type"),b.type="const-type",h.name=f.consumeKind("identifier")||f.error("Const lacks a name"),h.assign=f.consume("=")||f.error("Const lacks value assignment"),h.value=G(f)||f.error("Const lacks a value"),h.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let v=new tr({source:f.source,tokens:h});return z(v).idlType=b,v}get type(){return"const"}get name(){return O(this.tokens.name.value)}get value(){return Q(this.tokens.value)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:h})}}class tn extends o{static parse(f){let h=f.position,b=z(new tn({source:f.source,tokens:{}})),{tokens:v}=b;if(v.readonly=f.consume("readonly"),v.readonly||(v.async=f.consume("async")),v.base=v.readonly?f.consume("maplike","setlike"):v.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!v.base)return void f.unconsume(h);let{type:_}=b,M=_==="maplike",K=M||_==="iterable"||_==="async_iterable",ae=_==="async_iterable"||b.async&&_==="iterable";v.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${_} declaration`);let U=ne(f)||f.error(`Missing a type argument in ${_} declaration`);return b.idlType=[U],b.arguments=[],K&&(U.tokens.separator=f.consume(","),U.tokens.separator?b.idlType.push(ne(f)):M&&f.error(`Missing second type argument in ${_} declaration`)),v.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${_} declaration`),f.probe("(")&&(ae?(v.argsOpen=f.consume("("),b.arguments.push(...ue(f)),v.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),v.termination=f.consume(";")||f.error(`Missing semicolon after ${_} declaration`),b.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(h=this,()=>{let v=h.tokens.async;h.tokens.base={...v,type:"async_iterable",value:"async_iterable"},delete h.tokens.async})});var h;for(let b of this.idlType)yield*b.validate(f);for(let b of this.arguments)yield*b.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((h)=>h.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((h)=>h.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Xr extends o{static parse(f){let h=f.consume("constructor");if(!h)return;let b={base:h};b.open=f.consume("(")||f.error("No argument list in constructor");let v=ue(f);b.close=f.consume(")")||f.error("Unterminated constructor"),b.termination=f.consume(";")||f.error("No semicolon after constructor");let _=new Xr({source:f.source,tokens:b});return z(_).arguments=v,_}get type(){return"constructor"}*validate(f){for(let h of this.arguments)yield*h.validate(f)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:h}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((b)=>b.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:h})}}function Mn(f){let h=f.consume("static");if(!h)return;return H.parse(f,{special:h})||V.parse(f,{special:h})||f.error("No body in static member")}class Ca extends $t{static parse(f,h,{extMembers:b=[],partial:v=null}={}){let _={partial:v,base:h};return $t.parse(f,new Ca({source:f.source,tokens:_}),{inheritable:!v,allowedMembers:[...b,[tr.parse],[Xr.parse],[Mn],[xe],[tn.parse],[H.parse],[V.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((b)=>b.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:B(this)});let h=this.extAttrs.filter((b)=>b.name==="Constructor");for(let b of h)yield s(b.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:dp(this,b)});if(this.extAttrs.some((b)=>b.name==="Global")){let b=this.extAttrs.filter((_)=>_.name==="LegacyFactoryFunction");for(let _ of b)yield s(_.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let v=this.members.filter((_)=>_.type==="constructor");for(let _ of v)yield s(_.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(b,v){let _=function(oe){let ie=U(oe);return{statics:new Set(ie.filter((ge)=>ge.special==="static").map((ge)=>ge.name)),nonstatics:new Set(ie.filter((ge)=>ge.special!=="static").map((ge)=>ge.name))}}(v),M=b.partials.get(v.name)||[],K=b.mixinMap.get(v.name)||[];for(let oe of[...M,...K]){let ie=U(oe),ge=ie.filter((ut)=>ut.special==="static"),De=ie.filter((ut)=>ut.special!=="static");yield*ae(ge,_.statics,oe,v),yield*ae(De,_.nonstatics,oe,v),ge.forEach((ut)=>_.statics.add(ut.name)),De.forEach((ut)=>_.nonstatics.add(ut.name))}function*ae(oe,ie,ge,De){for(let ut of oe){let{name:In}=ut;if(In&&ie.has(In)){let Me=`The ${ut.special==="static"?"static ":""}operation "${In}" has already been defined for the base interface "${De.name}" either in itself or in a mixin`;yield s(ut.tokens.name,ge,"no-cross-overload",Me)}}}function U(oe){return oe.members.filter(({type:ie})=>ie==="operation")}}(f,this))}}function dp(f,h){return f=z(f),()=>{let b=X(f.extAttrs.tokens.open.trivia),v=f.members.length?X(q(f.members[0]).trivia):function(ie){let ge=X(ie),De=ge.includes("\t")?"\t":" ";return ge+De}(b),_=Xr.parse(new bt(`
|
|
627
|
+
${v}constructor();`));_.extAttrs=new x({source:f.source,tokens:{}}),z(_).arguments=h.arguments;let M=function(ie,ge){let De=ie.slice().reverse().findIndex(ge);return De===-1?De:ie.length-De-1}(f.members,(ie)=>ie.type==="constructor");f.members.splice(M+1,0,_);let{close:K}=f.tokens;K.trivia.includes(`
|
|
612
628
|
`)||(K.trivia+=`
|
|
613
|
-
${b}`);let{extAttrs:Y}=f,V=Y.indexOf(h),ne=Y.splice(V,1);Y.length?Y.length===V?Y[V-1].tokens.separator=void 0:Y[V].tokens.name.trivia.trim()||(Y[V].tokens.name.trivia=ne[0].tokens.name.trivia):Y.tokens.open=Y.tokens.close=void 0}}class or extends Ft{static parse(f,h,{extMembers:b=[],partial:w}={}){let _={partial:w,base:h};if(_.mixin=f.consume("mixin"),_.mixin)return Ft.parse(f,new or({source:f.source,tokens:_}),{allowedMembers:[...b,[mn.parse],[xe],[H.parse,{noInherit:!0}],[F.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class ir extends o{static parse(f){let h={},b=ee(new ir({source:f.source,tokens:h}));return b.extAttrs=S.parse(f),h.required=f.consume("required"),b.idlType=re(f,"dictionary-type")||f.error("Dictionary member lacks a type"),h.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),b.default=O.parse(f),h.required&&b.default&&f.error("Required member must not have a default"),h.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),b.this}get type(){return"field"}get name(){return A(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:h})}}class ns extends Ft{static parse(f,{extMembers:h=[],partial:b}={}){let w={partial:b};if(w.base=f.consume("dictionary"),w.base)return Ft.parse(f,new ns({source:f.source,tokens:w}),{inheritable:!b,allowedMembers:[...h,[ir.parse]]})}get type(){return"dictionary"}}class rs extends Ft{static parse(f,{extMembers:h=[],partial:b}={}){let w={partial:b};if(w.base=f.consume("namespace"),w.base)return Ft.parse(f,new rs({source:f.source,tokens:w}),{allowedMembers:[...h,[H.parse,{noInherit:!0,readonly:!0}],[mn.parse],[F.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((h)=>h.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:be(this)});yield*super.validate(f)}}class Lo extends Ft{static parse(f,h,{extMembers:b=[]}={}){let w={callback:h};if(w.base=f.consume("interface"),w.base)return Ft.parse(f,new Lo({source:f.source,tokens:w}),{allowedMembers:[...b,[mn.parse],[F.parse,{regular:!0}]]})}get type(){return"callback interface"}}function jd(f,h){let b=f.source;function w(V){f.error(V)}function _(...V){return f.consume(...V)}function W(V){let ne=_("interface");if(ne)return or.parse(f,ne,{...V,...h?.extensions?.mixin})||sr.parse(f,ne,{...V,...h?.extensions?.interface})||w("Interface has no proper body")}function K(){if(h.productions)for(let V of h.productions){let ne=V(f);if(ne)return ne}return function(){let V=_("callback");if(V)return f.probe("interface")?Lo.parse(f,V,{...h?.extensions?.callbackInterface}):rr.parse(f,V)}()||W()||function(){let V=_("partial");if(V)return ns.parse(f,{partial:V,...h?.extensions?.dictionary})||W({partial:V})||rs.parse(f,{partial:V,...h?.extensions?.namespace})||w("Partial doesn't apply to anything")}()||ns.parse(f,h?.extensions?.dictionary)||ce.parse(f)||Jr.parse(f)||Et.parse(f)||rs.parse(f,h?.extensions?.namespace)}let Y=function(){if(!b.length)return[];let V=[];for(;;){let fe=S.parse(f),oe=K();if(!oe){fe.length&&w("Stray extended attributes");break}ee(oe).extAttrs=fe,V.push(oe)}let ne=u.parse(f);return h.concrete&&V.push(ne),V}();return f.position<b.length&&w("Unrecognised tokens"),Y}function Uc(f,h={}){let b=new de(f);return h.sourceName!==void 0&&(b.source.name=h.sourceName),jd(b,h)}function en(f){return f}let ha={wrap:(f)=>f.join(""),trivia:en,name:en,reference:en,type:en,generic:en,nameless:en,inheritance:en,definition:en,extendedAttribute:en,extendedAttributeReference:en};class Bc{constructor(f){this.ts=Object.assign({},ha,f)}reference(f,{unescaped:h,context:b}){return h||(h=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,h,b)}token(f,h=en,...b){if(!f)return"";let w=h(f.value,...b);return this.ts.wrap([this.ts.trivia(f.trivia),w])}reference_token(f,h){return this.token(f,this.reference.bind(this),{context:h})}name_token(f,h){return this.token(f,this.ts.name,h)}identifier(f,h){return this.ts.wrap([this.reference_token(f.tokens.value,h),this.token(f.tokens.separator)])}}function eo(f,{templates:h=ha}={}){h=Object.assign({},ha,h);let b=new Bc(h);return h.wrap(f.map((w)=>w.write(b)))}function zc(f,h){let b=new Map,w=f.filter((_)=>_.type==="includes");for(let _ of w){let W=h.get(_.includes);if(!W)continue;let K=b.get(_.target);K?K.push(W):b.set(_.target,[W])}return b}function*Kc(f){let h=function(b){let w=new Map,_=new Set,W=new Map;for(let K of b)if(K.partial){let Y=W.get(K.name);Y?Y.push(K):W.set(K.name,[K])}else K.name&&(w.has(K.name)?_.add(K):w.set(K.name,K));return{all:b,unique:w,partials:W,duplicates:_,mixinMap:zc(b,w),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let b of h.all)b.validate&&(yield*b.validate(h));yield*function*({unique:b,duplicates:w}){for(let _ of w){let{name:W}=_,K=`The name "${W}" of type "${b.get(W).type}" was already seen`;yield s(_.tokens.name,_,"no-duplicate",K)}}(h)}function to(f){return[...Kc((h=f,h.flat?h.flat():[].concat(...h)))];var h}return t})())});var kj=q(function(uee,_j){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",vj=it("fs").promises,bf=it("path"),Ej=wj();class jj{constructor(e,t){this.filename=t,this.shortname=bf.basename(t,".idl"),this.path=bf.join(e,t)}async text(){return await vj.readFile(this.path,"utf8")}async parse(){let e=await this.text();return Ej.parse(e)}}async function Pj({folder:e=__dirname}={}){let t={},n=await vj.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new jj(e,r);t[s.shortname]=s}return t}async function qL(e){let t=await Pj(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}_j.exports={listAll:Pj,parseAll:qL}});function WL(){return Oj??=HL(),Oj}async function HL(){let[e,t,n]=await Promise.all([Cj.listAll(),Rj.default.listAll(),Nj.default.parseAll()]),r=new Set;for(let{elements:l}of Object.values(e))for(let u of l)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let l of t.properties)for(let u of l.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let l of Object.values(n))for(let u of l){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let d of u.members)if(d.type==="attribute"&&d.name?.startsWith("on")&&d.idlType?.idlType==="EventHandler")a.add(d.name)}let c=[...a].toSorted();return{cssProps:i,eventHandlers:c,tagExamples:s}}function UL(e){let t={};for(let n of e)t[n]={description:`Event handler for the "${n.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function BL(e){let t={...Qa.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function zL(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await WL();return{$defs:{DefsMap:Oh,TypeDefEntry:Ah,StateMap:kh,StateEntry:_h,TypedStateDef:Ym,PureTypeDef:ah,FunctionDef:Qm,ClassDef:Rh,ClassParameterDef:mu,ClassFieldDef:hu,ClassConstructorDef:gu,ClassMethodDef:yu,FormatDef:xu,ProjectBlockDef:bu,ServerBlockDef:$u,ConnectorBlockDef:Su,StudioHints:wu,ExternalClassDef:oh,ExpressionPointer:lh,ExpressionLiteral:uh,ExpressionOperand:fh,UnaryOperator:dh,BinaryOperator:ph,ConditionalOperator:mh,SwitchOperator:hh,CallOperator:gh,PureMethod:yh,AssignmentOperator:xh,NoArgMethod:bh,OneArgMethod:$h,SpliceMethod:Sh,ReduceMethod:wh,MapFilterMethod:vh,ExpressionNode:Eh,ExpressionEntry:jh,Statement:th,StatementList:nh,ElementDef:{...pu,properties:{...pu.properties,...UL(n)}},ChildrenValue:Wm,ArrayNamespace:qm,SwitchDef:Km,SwitchNode:Gm,StyleObject:{...Qa,properties:BL(t)},AttributesObject:Um,PropsObject:Bm,RefObject:Mm,AnyRef:Dm,InternalRef:Cm,StateRef:Rm,ExternalRef:Nm,ExternalComponentRef:Fm,GlobalRef:Tm,ParentRef:Jm,MapRef:Im,ElementPropertyValue:zm,StringOrRef:bm,BoolOrRef:$m,NumberOrRef:Sm,CemParameter:jm,CemEvent:Pm,TagName:{...ym,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:mm,ElementTagName:hm,JsonSchemaType:Om,HeadEntry:vm,ImageConfig:Za,PathsValue:{$id:Oo,anyOf:[...tc,Fh],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"}]},$script:{additionalProperties:!1,description:"This document's own modules, as TypeScript module text (spec.md §23.2). "+'A state entry names an export of one with `$src: "#client"` or `$src: "#server"`. `client` runs in the browser; `server` runs only on the server and is never sent to one.',properties:{client:{description:'The module the browser runs. A Function entry with `$src: "#client"` is one of its exports.',type:"string"},server:{description:'The module the server runs. A `timing: "server"` entry with `$src: "#server"` is one of its exports, called with `(args, env)`.',type:"string"}},type:"object"},$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 KL(){return{$defs:{ImageConfig:Za,StyleObject:Tj},$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:vu.properties,title:"Jx Project",type:"object"}}function GL(){return{$defs:{ImageConfig:Za,JxFieldSchema:Dh,RelationshipRef:Mh,StyleObject:Tj},$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:vu.properties,title:"Jx Project Core",type:"object"}}function XL(){return{$id:ec,$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 YL(){return{$id:Oo,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...tc,Fh],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 ZL(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...Jh}}function py(){return{$defs:{ClassConstructorDef:gu,ClassFieldDef:hu,ClassMethodDef:yu,ClassParameterDef:mu,ConnectorBlockDef:Su,FormatDef:xu,ProjectBlockDef:bu,ServerBlockDef:$u,StudioHints:wu},$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 QL(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await zL(),a=KL(),c=py(),l=GL(),u=ZL(),d=XL(),p=YL(),m=JSON.stringify(i,null,2),x=JSON.stringify(a,null,2),g=JSON.stringify(c,null,2),y=JSON.stringify(l,null,2),S=JSON.stringify(u,null,2),E=JSON.stringify(d,null,2),v=JSON.stringify(p,null,2),[j]=process.argv.slice(2);if(j)n(j,m,"utf8"),console.error(`Jx component schema written to ${j}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),x,"utf8"),n(r(o,"class-schema.json"),g,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),y,"utf8"),n(r(o,"schemas","project.fields.schema.json"),E,"utf8"),n(r(o,"schemas","document.paths.schema.json"),v,"utf8"),n(r(o,"extension-manifest.schema.json"),S,"utf8");let P=Bun.spawnSync(["bunx","oxfmt",r(o,"schemas","project.core.schema.json"),r(o,"schemas","project.fields.schema.json"),r(o,"schemas","document.paths.schema.json")],{cwd:o});if(P.exitCode!==0){let O=P.stderr.toString()||P.stdout.toString()||`exit ${P.exitCode}${P.signalCode?`, signal ${P.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${O})`)}console.error("Generated:"),console.error(" schema.json (component)"),console.error(" project-schema.json"),console.error(" class-schema.json"),console.error(" schemas/project.core.schema.json"),console.error(" schemas/project.fields.schema.json"),console.error(" schemas/document.paths.schema.json"),console.error(" extension-manifest.schema.json")}}var Cj,Rj,Nj,Oj=null,Tj,Aj,Nee;var Jj=R(()=>{gm();xm();wm();Em();_m();Am();Lm();Vm();Hm();Xm();Zm();eh();rh();ih();ch();Ph();Ch();Nh();Ih();nc();km();Th();Cj=ar(yj(),1),Rj=ar(Sj(),1),Nj=ar(kj(),1);Tj={...Qa,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,Aj]=process.argv,Nee=Aj?.endsWith("schema.ts")?QL(Aj):void 0});var Ac=q(function(Mj){Object.defineProperty(Mj,"__esModule",{value:!0});Mj.regexpCode=Mj.getEsmExportName=Mj.getProperty=Mj.safeStringify=Mj.stringify=Mj.strConcat=Mj.addCodeArg=Mj.str=Mj._=Mj.nil=Mj._Code=Mj.Name=Mj.IDENTIFIER=Mj._CodeOrName=void 0;class $f{}Mj._CodeOrName=$f;Mj.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Fi extends $f{constructor(e){super();if(!Mj.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}}}Mj.Name=Fi;class nr extends $f{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,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof Fi)t[n.str]=(t[n.str]||0)+1;return t},{})}}Mj._Code=nr;Mj.nil=new nr("");function Ij(e,...t){let n=[e[0]],r=0;while(r<t.length)hy(n,t[r]),n.push(e[++r]);return new nr(n)}Mj._=Ij;var my=new nr("+");function Dj(e,...t){let n=[Oc(e[0])],r=0;while(r<t.length)n.push(my),hy(n,t[r]),n.push(my,Oc(e[++r]));return e2(n),new nr(n)}Mj.str=Dj;function hy(e,t){if(t instanceof nr)e.push(...t._items);else if(t instanceof Fi)e.push(t);else e.push(r2(t))}Mj.addCodeArg=hy;function e2(e){let t=1;while(t<e.length-1){if(e[t]===my){let n=t2(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function t2(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Fi||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 Fi))return`"${e}${t.slice(1)}`;return}function n2(e,t){return t.emptyStr()?e:e.emptyStr()?t:Dj`${e}${t}`}Mj.strConcat=n2;function r2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Oc(Array.isArray(e)?e.join(","):e)}function s2(e){return new nr(Oc(e))}Mj.stringify=s2;function Oc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Mj.safeStringify=Oc;function o2(e){return typeof e=="string"&&Mj.IDENTIFIER.test(e)?new nr(`.${e}`):Ij`[${e}]`}Mj.getProperty=o2;function i2(e){if(typeof e=="string"&&Mj.IDENTIFIER.test(e))return new nr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Mj.getEsmExportName=i2;function a2(e){return new nr(e.toString())}Mj.regexpCode=a2});var by=q(function(qj){Object.defineProperty(qj,"__esModule",{value:!0});qj.ValueScope=qj.ValueScopeName=qj.Scope=qj.varKinds=qj.UsedValueState=void 0;var Ve=Ac();class Lj extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var wf;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(wf||(qj.UsedValueState=wf={}));qj.varKinds={const:new Ve.Name("const"),let:new Ve.Name("let"),var:new Ve.Name("var")};class yy{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ve.Name?e:this.name(e)}name(e){return new Ve.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.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}}}qj.Scope=yy;class xy extends Ve.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=Ve._`.${new Ve.Name(t)}[${n}]`}}qj.ValueScopeName=xy;var $2=Ve._`\n`;class Vj extends yy{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?$2:Ve.nil}}get(){return this._scope}name(e){return new xy(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:s}=r,o=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[s];if(i){let l=i.get(o);if(l)return l}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),c=a.length;return a[c]=t.ref,r.setValue(t,{property:s,itemIndex:c}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return Ve._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let s=Ve.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,wf.Started);let l=t(c);if(l){let u=this.opts.es5?qj.varKinds.var:qj.varKinds.const;s=Ve._`${s}${u} ${c} = ${l};${this.opts._n}`}else if(l=r===null||r===void 0?void 0:r(c))s=Ve._`${s}${l}${this.opts._n}`;else throw new Lj(c);a.set(c,wf.Completed)})}return s}}qj.ValueScope=Vj});var ye=q(function(an){Object.defineProperty(an,"__esModule",{value:!0});an.or=an.and=an.not=an.CodeGen=an.operators=an.varKinds=an.ValueScopeName=an.ValueScope=an.Scope=an.Name=an.regexpCode=an.stringify=an.getProperty=an.nil=an.strConcat=an.str=an._=void 0;var Z=Ac(),at=by(),Rs=Ac();Object.defineProperty(an,"_",{enumerable:!0,get:function(){return Rs._}});Object.defineProperty(an,"str",{enumerable:!0,get:function(){return Rs.str}});Object.defineProperty(an,"strConcat",{enumerable:!0,get:function(){return Rs.strConcat}});Object.defineProperty(an,"nil",{enumerable:!0,get:function(){return Rs.nil}});Object.defineProperty(an,"getProperty",{enumerable:!0,get:function(){return Rs.getProperty}});Object.defineProperty(an,"stringify",{enumerable:!0,get:function(){return Rs.stringify}});Object.defineProperty(an,"regexpCode",{enumerable:!0,get:function(){return Rs.regexpCode}});Object.defineProperty(an,"Name",{enumerable:!0,get:function(){return Rs.Name}});var kf=by();Object.defineProperty(an,"Scope",{enumerable:!0,get:function(){return kf.Scope}});Object.defineProperty(an,"ValueScope",{enumerable:!0,get:function(){return kf.ValueScope}});Object.defineProperty(an,"ValueScopeName",{enumerable:!0,get:function(){return kf.ValueScopeName}});Object.defineProperty(an,"varKinds",{enumerable:!0,get:function(){return kf.varKinds}});an.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 Ns{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Hj extends Ns{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?at.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Vi(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class wy extends Ns{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}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=Vi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return _f(e,this.rhs)}}class Uj extends wy{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Bj extends Ns{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class zj extends Ns{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Kj extends Ns{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Gj extends Ns{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=Vi(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class Of extends Ns{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let s=n[r];if(s.optimizeNames(e,t))continue;E2(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>To(e,t.names),{})}}class Ts extends Of{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Xj extends Of{}class Cc extends Ts{}Cc.kind="else";class es extends Ts{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 n=t.optimizeNodes();t=this.else=Array.isArray(n)?new Cc(n):n}if(t){if(e===!1)return t instanceof es?t:t.nodes;if(this.nodes.length)return this;return new es(tP(e),t instanceof es?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Vi(this.condition,e,t),this}get names(){let e=super.names;if(_f(e,this.condition),this.else)To(e,this.else.names);return e}}es.kind="if";class Li extends Ts{}Li.kind="for";class Yj extends Li{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=Vi(this.iteration,e,t),this}get names(){return To(super.names,this.iteration.names)}}class Zj extends Li{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?at.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=_f(super.names,this.from);return _f(e,this.to)}}class $y extends Li{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}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=Vi(this.iterable,e,t),this}get names(){return To(super.names,this.iterable.names)}}class vf extends Ts{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}vf.kind="func";class Ef extends Of{render(e){return"return "+super.render(e)}}Ef.kind="return";class Qj extends Ts{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 n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)To(e,this.catch.names);if(this.finally)To(e,this.finally.names);return e}}class jf extends Ts{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}jf.kind="catch";class Pf extends Ts{render(e){return"finally"+super.render(e)}}Pf.kind="finally";class eP{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
614
|
-
`:""},this._extScope=e,this._scope=new at.Scope({parent:e}),this._nodes=[new Xj]}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 n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,r){let s=this._scope.toName(t);if(n!==void 0&&r)this._constants[s.str]=n;return this._leafNode(new Hj(e,s,n)),s}const(e,t,n){return this._def(at.varKinds.const,e,t,n)}let(e,t,n){return this._def(at.varKinds.let,e,t,n)}var(e,t,n){return this._def(at.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new wy(e,t,n))}add(e,t){return this._leafNode(new Uj(e,an.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new Gj(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),Z.addCodeArg(t,r)}return t.push("}"),new Z._Code(t)}if(e,t,n){if(this._blockNode(new es(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new es(e))}else(){return this._elseNode(new Cc)}endIf(){return this._endBlockNode(es,Cc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new Yj(e),t)}forRange(e,t,n,r,s=this.opts.es5?at.varKinds.var:at.varKinds.let){let o=this._scope.toName(e);return this._for(new Zj(s,o,t,n),()=>r(o))}forOf(e,t,n,r=at.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof Z.Name?t:this.var("_arr",t);return this.forRange("_i",0,Z._`${o}.length`,(i)=>{this.var(s,Z._`${o}[${i}]`),n(s)})}return this._for(new $y("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?at.varKinds.var:at.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Z._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new $y("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(Li)}label(e){return this._leafNode(new Bj(e))}break(e){return this._leafNode(new zj(e))}return(e){let t=new Ef;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Ef)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new Qj;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new jf(s),t(s)}if(n)this._currNode=r.finally=new Pf,this.code(n);return this._endBlockNode(jf,Pf)}throw(e){return this._leafNode(new Kj(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 n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=Z.nil,n,r){if(this._blockNode(new vf(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(vf)}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 n=this._currNode;if(n instanceof e||t&&n 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 es))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}}an.CodeGen=eP;function To(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function _f(e,t){return t instanceof Z._CodeOrName?To(e,t.names):e}function Vi(e,t,n){if(e instanceof Z.Name)return r(e);if(!s(e))return e;return new Z._Code(e._items.reduce((o,i)=>{if(i instanceof Z.Name)i=r(i);if(i instanceof Z._Code)o.push(...i._items);else o.push(i);return o},[]));function r(o){let i=n[o.str];if(i===void 0||t[o.str]!==1)return o;return delete t[o.str],i}function s(o){return o instanceof Z._Code&&o._items.some((i)=>i instanceof Z.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function E2(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function tP(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${Sy(e)}`}an.not=tP;var j2=nP(an.operators.AND);function P2(...e){return e.reduce(j2)}an.and=P2;var _2=nP(an.operators.OR);function k2(...e){return e.reduce(_2)}an.or=k2;function nP(e){return(t,n)=>t===Z.nil?n:n===Z.nil?t:Z._`${Sy(t)} ${e} ${Sy(n)}`}function Sy(e){return e instanceof Z.Name?e:Z._`(${e})`}});var _e=q(function(dP){Object.defineProperty(dP,"__esModule",{value:!0});dP.checkStrictMode=dP.getErrorPath=dP.Type=dP.useFunc=dP.setEvaluated=dP.evaluatedPropsToName=dP.mergeEvaluated=dP.eachItem=dP.unescapeJsonPointer=dP.escapeJsonPointer=dP.escapeFragment=dP.unescapeFragment=dP.schemaRefOrVal=dP.schemaHasRulesButRef=dP.schemaHasRules=dP.checkUnknownRules=dP.alwaysValidSchema=dP.toHash=void 0;var ie=ye(),iP=Ac();function R2(e){let t={};for(let n of e)t[n]=!0;return t}dP.toHash=R2;function N2(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return aP(e,t),!cP(t,e.self.RULES.all)}dP.alwaysValidSchema=N2;function aP(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let s=r.RULES.keywords;for(let o in t)if(!s[o])fP(e,`unknown keyword: "${o}"`)}dP.checkUnknownRules=aP;function cP(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}dP.schemaHasRules=cP;function T2(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}dP.schemaHasRulesButRef=T2;function J2({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return ie._`${n}`}return ie._`${e}${t}${ie.getProperty(r)}`}dP.schemaRefOrVal=J2;function I2(e){return lP(decodeURIComponent(e))}dP.unescapeFragment=I2;function D2(e){return encodeURIComponent(Ey(e))}dP.escapeFragment=D2;function Ey(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}dP.escapeJsonPointer=Ey;function lP(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}dP.unescapeJsonPointer=lP;function M2(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}dP.eachItem=M2;function sP({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof ie.Name?(o instanceof ie.Name?e(s,o,i):t(s,o,i),i):o instanceof ie.Name?(t(s,i,o),o):n(o,i);return a===ie.Name&&!(c instanceof ie.Name)?r(s,c):c}}dP.mergeEvaluated={props:sP({mergeNames:(e,t,n)=>e.if(ie._`${n} !== true && ${t} !== undefined`,()=>{e.if(ie._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,ie._`${n} || {}`).code(ie._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(ie._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,ie._`${n} || {}`),jy(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:uP}),items:sP({mergeNames:(e,t,n)=>e.if(ie._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,ie._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(ie._`${n} !== true`,()=>e.assign(n,t===!0?!0:ie._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function uP(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",ie._`{}`);if(t!==void 0)jy(e,n,t);return n}dP.evaluatedPropsToName=uP;function jy(e,t,n){Object.keys(n).forEach((r)=>e.assign(ie._`${t}${ie.getProperty(r)}`,!0))}dP.setEvaluated=jy;var oP={};function F2(e,t){return e.scopeValue("func",{ref:t,code:oP[t.code]||(oP[t.code]=new iP._Code(t.code))})}dP.useFunc=F2;var vy;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(vy||(dP.Type=vy={}));function L2(e,t,n){if(e instanceof ie.Name){let r=t===vy.Num;return n?r?ie._`"[" + ${e} + "]"`:ie._`"['" + ${e} + "']"`:r?ie._`"/" + ${e}`:ie._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?ie.getProperty(e).toString():"/"+Ey(e)}dP.getErrorPath=L2;function fP(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}dP.checkStrictMode=fP});var Jn=q(function(mP){Object.defineProperty(mP,"__esModule",{value:!0});var Ne=ye(),sV={data:new Ne.Name("data"),valCxt:new Ne.Name("valCxt"),instancePath:new Ne.Name("instancePath"),parentData:new Ne.Name("parentData"),parentDataProperty:new Ne.Name("parentDataProperty"),rootData:new Ne.Name("rootData"),dynamicAnchors:new Ne.Name("dynamicAnchors"),vErrors:new Ne.Name("vErrors"),errors:new Ne.Name("errors"),this:new Ne.Name("this"),self:new Ne.Name("self"),scope:new Ne.Name("scope"),json:new Ne.Name("json"),jsonPos:new Ne.Name("jsonPos"),jsonLen:new Ne.Name("jsonLen"),jsonPart:new Ne.Name("jsonPart")};mP.default=sV});var Rc=q(function(xP){Object.defineProperty(xP,"__esModule",{value:!0});xP.extendErrors=xP.resetErrorsCount=xP.reportExtraError=xP.reportError=xP.keyword$DataError=xP.keywordError=void 0;var Q=ye(),Js=_e(),Yt=Jn();xP.keywordError={message:({keyword:e})=>Q.str`must pass "${e}" keyword validation`};xP.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Q.str`"${e}" keyword must be ${t} ($data)`:Q.str`"${e}" keyword is invalid ($data)`};function iV(e,t=xP.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,c=yP(e,t,n);if(r!==null&&r!==void 0?r:i||a)hP(o,c);else gP(s,Q._`[${c}]`)}xP.reportError=iV;function aV(e,t=xP.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=yP(e,t,n);if(hP(s,a),!(o||i))gP(r,Yt.default.vErrors)}xP.reportExtraError=aV;function cV(e,t){e.assign(Yt.default.errors,t),e.if(Q._`${Yt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Q._`${Yt.default.vErrors}.length`,t),()=>e.assign(Yt.default.vErrors,null)))}xP.resetErrorsCount=cV;function lV({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:o}){if(s===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",s,Yt.default.errors,(a)=>{if(e.const(i,Q._`${Yt.default.vErrors}[${a}]`),e.if(Q._`${i}.instancePath === undefined`,()=>e.assign(Q._`${i}.instancePath`,Q.strConcat(Yt.default.instancePath,o.errorPath))),e.assign(Q._`${i}.schemaPath`,Q.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(Q._`${i}.schema`,n),e.assign(Q._`${i}.data`,r)})}xP.extendErrors=lV;function hP(e,t){let n=e.const("err",t);e.if(Q._`${Yt.default.vErrors} === null`,()=>e.assign(Yt.default.vErrors,Q._`[${n}]`),Q._`${Yt.default.vErrors}.push(${n})`),e.code(Q._`${Yt.default.errors}++`)}function gP(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(Q._`new ${e.ValidationError}(${t})`);else n.assign(Q._`${r}.errors`,t),n.return(!1)}var Jo={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function yP(e,t,n){let{createErrors:r}=e.it;if(r===!1)return Q._`{}`;return uV(e,t,n)}function uV(e,t,n={}){let{gen:r,it:s}=e,o=[fV(s,n),dV(e,n)];return pV(e,t,o),r.object(...o)}function fV({errorPath:e},{instancePath:t}){let n=t?Q.str`${e}${Js.getErrorPath(t,Js.Type.Str)}`:e;return[Yt.default.instancePath,Q.strConcat(Yt.default.instancePath,n)]}function dV({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:Q.str`${t}/${e}`;if(n)s=Q.str`${s}${Js.getErrorPath(n,Js.Type.Str)}`;return[Jo.schemaPath,s]}function pV(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;if(r.push([Jo.keyword,s],[Jo.params,typeof t=="function"?t(e):t||Q._`{}`]),c.messages)r.push([Jo.message,typeof n=="function"?n(e):n]);if(c.verbose)r.push([Jo.schema,i],[Jo.parentSchema,Q._`${u}${d}`],[Yt.default.data,o]);if(l)r.push([Jo.propertyName,l])}});var jP=q(function(vP){Object.defineProperty(vP,"__esModule",{value:!0});vP.boolOrEmptySchema=vP.topBoolOrEmptySchema=void 0;var $P=Rc(),SP=ye(),xV=Jn(),bV={message:"boolean schema is false"};function $V(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)wP(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(xV.default.data);else t.assign(SP._`${r}.errors`,null),t.return(!0)}vP.topBoolOrEmptySchema=$V;function SV(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),wP(e);else n.var(t,!0)}vP.boolOrEmptySchema=SV;function wP(e,t){let{gen:n,data:r}=e;$P.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},bV,void 0,t)}});var _y=q(function(PP){Object.defineProperty(PP,"__esModule",{value:!0});PP.getRules=PP.isJSONType=void 0;var vV=["string","number","integer","boolean","null","object","array"],EV=new Set(vV);function jV(e){return typeof e=="string"&&EV.has(e)}PP.isJSONType=jV;function PV(){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:{}}}PP.getRules=PV});var ky=q(function(AP){Object.defineProperty(AP,"__esModule",{value:!0});AP.shouldUseRule=AP.shouldUseGroup=AP.schemaHasRulesForType=void 0;function kV({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&kP(e,r)}AP.schemaHasRulesForType=kV;function kP(e,t){return t.rules.some((n)=>OP(e,n))}AP.shouldUseGroup=kP;function OP(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}AP.shouldUseRule=OP});var Nc=q(function(DP){Object.defineProperty(DP,"__esModule",{value:!0});DP.reportTypeError=DP.checkDataTypes=DP.checkDataType=DP.coerceAndCheckDataType=DP.getJSONTypes=DP.getSchemaTypes=DP.DataType=void 0;var RP=_y(),NP=ky(),TP=Rc(),G=ye(),Cf=_e(),qi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(qi||(DP.DataType=qi={}));function CV(e){let t=JP(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}DP.getSchemaTypes=CV;function JP(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(RP.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}DP.getJSONTypes=JP;function RV(e,t){let{gen:n,data:r,opts:s}=e,o=NV(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&NP.schemaHasRulesForType(e,t[0]));if(i){let a=Ay(t,r,s.strictNumbers,qi.Wrong);n.if(a,()=>{if(o.length)TV(e,t,o);else Cy(e)})}return i}DP.coerceAndCheckDataType=RV;var IP=new Set(["string","number","integer","boolean","null"]);function NV(e,t){return t?e.filter((n)=>IP.has(n)||t==="array"&&n==="array"):[]}function TV(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",G._`typeof ${s}`),a=r.let("coerced",G._`undefined`);if(o.coerceTypes==="array")r.if(G._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,G._`${s}[0]`).assign(i,G._`typeof ${s}`).if(Ay(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(G._`${a} !== undefined`);for(let l of n)if(IP.has(l)||l==="array"&&o.coerceTypes==="array")c(l);r.else(),Cy(e),r.endIf(),r.if(G._`${a} !== undefined`,()=>{r.assign(s,a),JV(e,a)});function c(l){switch(l){case"string":r.elseIf(G._`${i} == "number" || ${i} == "boolean"`).assign(a,G._`"" + ${s}`).elseIf(G._`${s} === null`).assign(a,G._`""`);return;case"number":r.elseIf(G._`${i} == "boolean" || ${s} === null
|
|
615
|
-
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,
|
|
616
|
-
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,
|
|
617
|
-
|| ${i} === "boolean" || ${s} === null`).assign(a,G._`[${s}]`)}}}function JV({gen:e,parentData:t,parentDataProperty:n},r){e.if(G._`${t} !== undefined`,()=>e.assign(G._`${t}[${n}]`,r))}function Oy(e,t,n,r=qi.Correct){let s=r===qi.Correct?G.operators.EQ:G.operators.NEQ,o;switch(e){case"null":return G._`${t} ${s} null`;case"array":o=G._`Array.isArray(${t})`;break;case"object":o=G._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(G._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return G._`typeof ${t} ${s} ${e}`}return r===qi.Correct?o:G.not(o);function i(a=G.nil){return G.and(G._`typeof ${t} == "number"`,a,n?G._`isFinite(${t})`:G.nil)}}DP.checkDataType=Oy;function Ay(e,t,n,r){if(e.length===1)return Oy(e[0],t,n,r);let s,o=Cf.toHash(e);if(o.array&&o.object){let i=G._`typeof ${t} != "object"`;s=o.null?i:G._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=G.nil;if(o.number)delete o.integer;for(let i in o)s=G.and(s,Oy(i,t,n,r));return s}DP.checkDataTypes=Ay;var IV={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?G._`{type: ${e}}`:G._`{type: ${t}}`};function Cy(e){let t=DV(e);TP.reportError(t,IV)}DP.reportTypeError=Cy;function DV(e){let{gen:t,data:n,schema:r}=e,s=Cf.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var WP=q(function(VP){Object.defineProperty(VP,"__esModule",{value:!0});VP.assignDefaults=void 0;var In=ye(),LP=_e();function HV(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)FP(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>FP(e,o,s.default))}VP.assignDefaults=HV;function FP(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=In._`${o}${In.getProperty(t)}`;if(s){LP.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=In._`${a} === undefined`;if(i.useDefaults==="empty")c=In._`${c} || ${a} === null || ${a} === ""`;r.if(c,In._`${a} = ${In.stringify(n)}`)}});var Dn=q(function(zP){Object.defineProperty(zP,"__esModule",{value:!0});zP.validateUnion=zP.validateArray=zP.usePattern=zP.callValidateCode=zP.schemaProperties=zP.allSchemaProperties=zP.noPropertyInData=zP.propertyInData=zP.isOwnProperty=zP.hasPropFunc=zP.reportMissingProp=zP.checkMissingProp=zP.checkReportMissingProp=void 0;var pe=ye(),Wi=_e(),Is=Jn(),HP=_e();function UV(e,t){let{gen:n,data:r,it:s}=e;n.if(Ny(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:pe._`${t}`},!0),e.error()})}zP.checkReportMissingProp=UV;function BV({gen:e,data:t,it:{opts:n}},r,s){return pe.or(...r.map((o)=>pe.and(Ny(e,t,o,n.ownProperties),pe._`${s} = ${o}`)))}zP.checkMissingProp=BV;function zV(e,t){e.setParams({missingProperty:t},!0),e.error()}zP.reportMissingProp=zV;function UP(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:pe._`Object.prototype.hasOwnProperty`})}zP.hasPropFunc=UP;function Ry(e,t,n){return pe._`${UP(e)}.call(${t}, ${n})`}zP.isOwnProperty=Ry;function KV(e,t,n,r){let s=pe._`${t}${pe.getProperty(n)} !== undefined`;return r?pe._`${s} && ${Ry(e,t,n)}`:s}zP.propertyInData=KV;function Ny(e,t,n,r){let s=pe._`${t}${pe.getProperty(n)} === undefined`;return r?pe.or(s,pe.not(Ry(e,t,n))):s}zP.noPropertyInData=Ny;function BP(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}zP.allSchemaProperties=BP;function GV(e,t){return BP(t).filter((n)=>!Wi.alwaysValidSchema(e,t[n]))}zP.schemaProperties=GV;function XV({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,c,l){let u=l?pe._`${e}, ${t}, ${r}${s}`:t,d=[[Is.default.instancePath,pe.strConcat(Is.default.instancePath,o)],[Is.default.parentData,i.parentData],[Is.default.parentDataProperty,i.parentDataProperty],[Is.default.rootData,Is.default.rootData]];if(i.opts.dynamicRef)d.push([Is.default.dynamicAnchors,Is.default.dynamicAnchors]);let p=pe._`${u}, ${n.object(...d)}`;return c!==pe.nil?pe._`${a}.call(${c}, ${p})`:pe._`${a}(${p})`}zP.callValidateCode=XV;var YV=pe._`new RegExp`;function ZV({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(n,r);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:pe._`${s.code==="new RegExp"?YV:HP.useFunc(e,s)}(${n}, ${r})`})}zP.usePattern=ZV;function QV(e){let{gen:t,data:n,keyword:r,it:s}=e,o=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){let c=t.const("len",pe._`${n}.length`);t.forRange("i",0,c,(l)=>{e.subschema({keyword:r,dataProp:l,dataPropType:Wi.Type.Num},o),t.if(pe.not(o),a)})}}zP.validateArray=QV;function eq(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((c)=>Wi.alwaysValidSchema(s,c))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((c,l)=>{let u=e.subschema({keyword:r,schemaProp:l,compositeRule:!0},a);if(t.assign(i,pe._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(pe.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}zP.validateUnion=eq});var t_=q(function(QP){Object.defineProperty(QP,"__esModule",{value:!0});QP.validateKeywordUsage=QP.validSchemaType=QP.funcKeywordCode=QP.macroKeywordCode=void 0;var De=ye(),Io=Jn(),XP=Dn(),YP=Rc();function pq(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),c=ZP(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let l=n.name("valid");e.subschema({schema:a,schemaPath:De.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}QP.macroKeywordCode=pq;function mq(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=e;gq(c,t);let l=!a&&t.compile?t.compile.call(c.self,o,i,c):t.validate,u=ZP(r,s,l),d=r.let("valid");e.block$data(d,p),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function p(){if(t.errors===!1){if(g(),t.modifying)GP(e);y(()=>e.error())}else{let S=t.async?m():x();if(t.modifying)GP(e);y(()=>hq(e,S))}}function m(){let S=r.let("ruleErrs",null);return r.try(()=>g(De._`await `),(E)=>r.assign(d,!1).if(De._`${E} instanceof ${c.ValidationError}`,()=>r.assign(S,De._`${E}.errors`),()=>r.throw(E))),S}function x(){let S=De._`${u}.errors`;return r.assign(S,null),g(De.nil),S}function g(S=t.async?De._`await `:De.nil){let E=c.opts.passContext?Io.default.this:Io.default.self,v=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,De._`${S}${XP.callValidateCode(e,u,E,v)}`,t.modifying)}function y(S){var E;r.if(De.not((E=t.valid)!==null&&E!==void 0?E:d),S)}}QP.funcKeywordCode=mq;function GP(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,De._`${r.parentData}[${r.parentDataProperty}]`))}function hq(e,t){let{gen:n}=e;n.if(De._`Array.isArray(${t})`,()=>{n.assign(Io.default.vErrors,De._`${Io.default.vErrors} === null ? ${t} : ${Io.default.vErrors}.concat(${t})`).assign(Io.default.errors,De._`${Io.default.vErrors}.length`),YP.extendErrors(e)},()=>e.error())}function gq({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function ZP(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:De.stringify(n)})}function yq(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}QP.validSchemaType=yq;function xq({schema:e,opts:t,self:n,errSchemaPath:r},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw Error("ajv implementation error");let i=s.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(c);else throw Error(c)}}}QP.validateKeywordUsage=xq});var s_=q(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});n_.extendSubschemaMode=n_.extendSubschemaData=n_.getSubschema=void 0;var wt=ye(),Rf=_e();function wq(e,{keyword:t,schemaProp:n,schema:r,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:wt._`${e.schemaPath}${wt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:wt._`${e.schemaPath}${wt.getProperty(t)}${wt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${Rf.escapeFragment(n)}`}}if(r!==void 0){if(s===void 0||o===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}n_.getSubschema=wq;function vq(e,t,{dataProp:n,dataPropType:r,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,p=a.let("data",wt._`${t.data}${wt.getProperty(n)}`,!0);c(p),e.errorPath=wt.str`${l}${Rf.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=wt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let l=s instanceof wt.Name?s:a.let("data",s,!0);if(c(l),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}n_.extendSubschemaData=vq;function Eq(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:s,allErrors:o}){if(r!==void 0)e.compositeRule=r;if(s!==void 0)e.createErrors=s;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=n}n_.extendSubschemaMode=Eq});var Ty=q(function(ate,o_){o_.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var a_=q(function(cte,i_){var Ds=i_.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},s=n.post||function(){};Nf(t,r,s,e,"",e)};Ds.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ds.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ds.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ds.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 Nf(e,t,n,r,s,o,i,a,c,l){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,c,l);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in Ds.arrayKeywords)for(var p=0;p<d.length;p++)Nf(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in Ds.propsKeywords){if(d&&typeof d=="object")for(var m in d)Nf(e,t,n,d[m],s+"/"+u+"/"+_q(m),o,s,u,r,m)}else if(u in Ds.keywords||e.allKeys&&!(u in Ds.skipKeywords))Nf(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,c,l)}}function _q(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Tc=q(function(d_){Object.defineProperty(d_,"__esModule",{value:!0});d_.getSchemaRefs=d_.resolveUrl=d_.normalizeId=d_._getFullPath=d_.getFullPath=d_.inlineRef=void 0;var c_=_e(),kq=Ty(),Oq=a_(),Aq=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Cq(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Jy(e);if(!t)return!1;return l_(e)<=t}d_.inlineRef=Cq;var Rq=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Jy(e){for(let t in e){if(Rq.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(Jy))return!0;if(typeof n=="object"&&Jy(n))return!0}return!1}function l_(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,Aq.has(n))continue;if(typeof e[n]=="object")c_.eachItem(e[n],(r)=>t+=l_(r));if(t===1/0)return 1/0}return t}function u_(e,t="",n){if(n!==!1)t=Hi(t);let r=e.parse(t);return f_(e,r)}d_.getFullPath=u_;function f_(e,t){return e.serialize(t).split("#")[0]+"#"}d_._getFullPath=f_;var Nq=/#\/?$/;function Hi(e){return e?e.replace(Nq,""):""}d_.normalizeId=Hi;function Tq(e,t,n){return n=Hi(n),e.resolve(t,n)}d_.resolveUrl=Tq;var Jq=/^[a-z_][-a-z0-9._]*$/i;function Iq(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=Hi(e[n]||t),o={"":s},i=u_(r,s,!1),a={},c=new Set;return Oq(e,{allKeys:!0},(d,p,m,x)=>{if(x===void 0)return;let g=i+p,y=o[x];if(typeof d[n]=="string")y=S.call(this,d[n]);E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),o[p]=y;function S(v){let j=this.opts.uriResolver.resolve;if(v=Hi(y?j(y,v):v),c.has(v))throw u(v);c.add(v);let P=this.refs[v];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")l(d,P.schema,v);else if(v!==Hi(g))if(v[0]==="#")l(d,a[v],v),a[v]=d;else this.refs[v]=g;return v}function E(v){if(typeof v=="string"){if(!Jq.test(v))throw Error(`invalid anchor "${v}"`);S.call(this,`#${v}`)}}}),a;function l(d,p,m){if(p!==void 0&&!kq(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}d_.getSchemaRefs=Iq});var zi=q(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});k_.getData=k_.KeywordCxt=k_.validateFunctionCode=void 0;var Jf=jP(),Tf=Nc(),Bi=ky(),Ms=Nc(),y_=WP(),Sr=t_(),Ui=s_(),J=ye(),he=Jn(),x_=Tc(),Ct=_e(),$r=Rc();function qq(e){if(S_(e)){if(w_(e),$_(e)){Uq(e);return}}b_(e,()=>Jf.topBoolOrEmptySchema(e))}k_.validateFunctionCode=qq;function b_({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,J._`${he.default.data}, ${he.default.valCxt}`,r.$async,()=>{e.code(J._`"use strict"; ${m_(n,s)}`),Hq(e,s),e.code(o)});else e.func(t,J._`${he.default.data}, ${Wq(s)}`,r.$async,()=>e.code(m_(n,s)).code(o))}function Wq(e){return J._`{${he.default.instancePath}="", ${he.default.parentData}, ${he.default.parentDataProperty}, ${he.default.rootData}=${he.default.data}${e.dynamicRef?J._`, ${he.default.dynamicAnchors}={}`:J.nil}}={}`}function Hq(e,t){e.if(he.default.valCxt,()=>{if(e.var(he.default.instancePath,J._`${he.default.valCxt}.${he.default.instancePath}`),e.var(he.default.parentData,J._`${he.default.valCxt}.${he.default.parentData}`),e.var(he.default.parentDataProperty,J._`${he.default.valCxt}.${he.default.parentDataProperty}`),e.var(he.default.rootData,J._`${he.default.valCxt}.${he.default.rootData}`),t.dynamicRef)e.var(he.default.dynamicAnchors,J._`${he.default.valCxt}.${he.default.dynamicAnchors}`)},()=>{if(e.var(he.default.instancePath,J._`""`),e.var(he.default.parentData,J._`undefined`),e.var(he.default.parentDataProperty,J._`undefined`),e.var(he.default.rootData,he.default.data),t.dynamicRef)e.var(he.default.dynamicAnchors,J._`{}`)})}function Uq(e){let{schema:t,opts:n,gen:r}=e;b_(e,()=>{if(n.$comment&&t.$comment)E_(e);if(Xq(e),r.let(he.default.vErrors,null),r.let(he.default.errors,0),n.unevaluated)Bq(e);v_(e),Qq(e)});return}function Bq(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",J._`${n}.evaluated`),t.if(J._`${e.evaluated}.dynamicProps`,()=>t.assign(J._`${e.evaluated}.props`,J._`undefined`)),t.if(J._`${e.evaluated}.dynamicItems`,()=>t.assign(J._`${e.evaluated}.items`,J._`undefined`))}function m_(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?J._`/*# sourceURL=${n} */`:J.nil}function zq(e,t){if(S_(e)){if(w_(e),$_(e)){Kq(e,t);return}}Jf.boolOrEmptySchema(e,t)}function $_({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S_(e){return typeof e.schema!="boolean"}function Kq(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)E_(e);Yq(e),Zq(e);let o=r.const("_errs",he.default.errors);v_(e,o),r.var(t,J._`${o} === ${he.default.errors}`)}function w_(e){Ct.checkUnknownRules(e),Gq(e)}function v_(e,t){if(e.opts.jtd)return h_(e,[],!1,t);let n=Tf.getSchemaTypes(e.schema),r=Tf.coerceAndCheckDataType(e,n);h_(e,n,!r,t)}function Gq(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&Ct.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function Xq(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)Ct.checkStrictMode(e,"default is ignored in the schema root")}function Yq(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=x_.resolveUrl(e.opts.uriResolver,e.baseId,t)}function Zq(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function E_({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(J._`${he.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=J.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(J._`${he.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function Qq(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(J._`${he.default.errors} === 0`,()=>t.return(he.default.data),()=>t.throw(J._`new ${s}(${he.default.vErrors})`));else{if(t.assign(J._`${r}.errors`,he.default.vErrors),o.unevaluated)eW(e);t.return(J._`${he.default.errors} === 0`)}}function eW({gen:e,evaluated:t,props:n,items:r}){if(n instanceof J.Name)e.assign(J._`${t}.props`,n);if(r instanceof J.Name)e.assign(J._`${t}.items`,r)}function h_(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!Ct.schemaHasRulesButRef(o,u))){s.block(()=>P_(e,"$ref",u.all.$ref.definition));return}if(!c.jtd)tW(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!Bi.shouldUseGroup(o,p))return;if(p.type){if(s.if(Ms.checkDataType(p.type,i,c.strictNumbers)),g_(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Ms.reportTypeError(e);s.endIf()}else g_(e,p);if(!a)s.if(J._`${he.default.errors} === ${r||0}`)}}function g_(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)y_.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(Bi.shouldUseRule(r,o))P_(e,o.keyword,o.definition,t.type)})}function tW(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(nW(e,t),!e.opts.allowUnionTypes)rW(e,t);sW(e,e.dataTypes)}function nW(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!j_(e.dataTypes,n))Iy(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),iW(e,t)}function rW(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Iy(e,"use allowUnionTypes to allow union type keyword")}function sW(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&Bi.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>oW(t,i)))Iy(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function oW(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function j_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function iW(e,t){let n=[];for(let r of e.dataTypes)if(j_(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function Iy(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,Ct.checkStrictMode(e,t,e.opts.strictTypes)}class Dy{constructor(e,t,n){if(Sr.validateKeywordUsage(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Ct.schemaRefOrVal(e,this.schema,n,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",__(this.$data,e));else if(this.schemaCode=this.schemaValue,!Sr.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",he.default.errors)}result(e,t,n){this.failResult(J.not(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();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(J.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(J._`${t} !== undefined && (${J.or(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?$r.reportExtraError:$r.reportError)(this,this.def.error,t)}$dataError(){$r.reportError(this,this.def.$dataError||$r.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');$r.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,n=J.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=J.nil,t=J.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(J.or(J._`${r} === undefined`,t)),e!==J.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==J.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return J.or(o(),i());function o(){if(n.length){if(!(t instanceof J.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return J._`${Ms.checkDataTypes(a,t,s.opts.strictNumbers,Ms.DataType.Wrong)}`}return J.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return J._`!${a}(${t})`}return J.nil}}subschema(e,t){let n=Ui.getSubschema(this.it,e);Ui.extendSubschemaData(n,this.it,e),Ui.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return zq(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=Ct.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=Ct.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,J.Name)),!0}}k_.KeywordCxt=Dy;function P_(e,t,n,r){let s=new Dy(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)Sr.funcKeywordCode(s,n);else if("macro"in n)Sr.macroKeywordCode(s,n);else if(n.compile||n.validate)Sr.funcKeywordCode(s,n)}var aW=/^\/(?:[^~]|~0|~1)*$/,cW=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function __(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return he.default.rootData;if(e[0]==="/"){if(!aW.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=he.default.rootData}else{let l=cW.exec(e);if(!l)throw Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(s=l[2],s==="#"){if(u>=t)throw Error(c("property/index",u));return r[t-u]}if(u>t)throw Error(c("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let l of a)if(l)o=J._`${o}${J.getProperty(Ct.unescapeJsonPointer(l))}`,i=J._`${i} && ${o}`;return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}k_.getData=__});var Jc=q(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});class A_ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}C_.default=A_});var Gi=q(function(N_){Object.defineProperty(N_,"__esModule",{value:!0});var Ki=Tc();class R_ extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=Ki.resolveUrl(e,t,n),this.missingSchema=Ki.normalizeId(Ki.getFullPath(e,this.missingRef))}}N_.default=R_});var Dc=q(function(I_){Object.defineProperty(I_,"__esModule",{value:!0});I_.resolveSchema=I_.getCompilingSchema=I_.resolveRef=I_.compileSchema=I_.SchemaEnv=void 0;var ct=ye(),pW=Jc(),Do=Jn(),lt=Tc(),If=_e(),T_=zi();class Ic{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=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:lt.normalizeId(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}I_.SchemaEnv=Ic;function Fy(e){let t=J_.call(this,e);if(t)return t;let n=lt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new ct.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:pW.default,code:ct._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Do.default.data,parentData:Do.default.parentData,parentDataProperty:Do.default.parentDataProperty,dataNames:[Do.default.data],dataPathArr:[ct.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ct.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:ct.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ct._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),T_.validateFunctionCode(l),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(Do.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${Do.default.self}`,`${Do.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{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:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:x,items:g}=l;if(m.evaluated={props:x instanceof ct.Name?void 0:x,items:g instanceof ct.Name?void 0:g,dynamicProps:x instanceof ct.Name,dynamicItems:g instanceof ct.Name},m.source)m.source.evaluated=ct.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw d}finally{this._compilations.delete(e)}}I_.compileSchema=Fy;function mW(e,t,n){var r;n=lt.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=yW.call(this,e,n);if(o===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)o=new Ic({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=hW.call(this,o)}I_.resolveRef=mW;function hW(e){if(lt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Fy.call(this,e)}function J_(e){for(let t of this._compilations)if(gW(t,e))return t}I_.getCompilingSchema=J_;function gW(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function yW(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||Df.call(this,e,t)}function Df(e,t){let n=this.opts.uriResolver.parse(t),r=lt._getFullPath(this.opts.uriResolver,n),s=lt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return My.call(this,n,e);let o=lt.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=Df.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return My.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Fy.call(this,i);if(o===lt.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];if(l)s=lt.resolveUrl(this.opts.uriResolver,s,l);return new Ic({schema:a,schemaId:c,root:e,baseId:s})}return My.call(this,n,i)}I_.resolveSchema=Df;var xW=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function My(e,{baseId:t,schema:n,root:r}){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 n==="boolean")return;let c=n[If.unescapeFragment(a)];if(c===void 0)return;n=c;let l=typeof n==="object"&&n[this.opts.schemaId];if(!xW.has(a)&&l)t=lt.resolveUrl(this.opts.uriResolver,t,l)}let o;if(typeof n!="boolean"&&n.$ref&&!If.schemaHasRulesButRef(n,this.RULES)){let a=lt.resolveUrl(this.opts.uriResolver,t,n.$ref);o=Df.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new Ic({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var M_=q(function(mte,vW){vW.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 Uy=q(function(hte,B_){var EW=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Vy=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),jW=RegExp.prototype.test.bind(/^\d*$/u),Mo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),qy=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),L_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Wy=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),PW=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),cn=Array(256);for(let t=0;t<256;t++)cn[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Ht(e){if(e<2048)return cn[192|e>>6]+cn[128|e&63];if(e<65536)return cn[224|e>>12]+cn[128|e>>6&63]+cn[128|e&63];return cn[240|e>>18]+cn[128|e>>12&63]+cn[128|e>>6&63]+cn[128|e&63]}function _W(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var kW=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),OW=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),AW=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),CW=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function RW(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(AW(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Mo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function F_(e){let t=-1,n=0,r=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(r===-1)r=a;if(s++,s>n)n=s,t=r}else r=-1,s=0;if(n<2)return e.join(":");let o=e.slice(0,t).join(":"),i=e.slice(t+n).join(":");return o+"::"+i}function NW(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let n=t===-1?e.split(":"):e.slice(0,t).split(":"),r=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(n.length===1&&n[0]==="")n.length=0;if(r.length===1&&r[0]==="")r.length=0}let s=n.concat(r),o=0;for(let a=0;a<s.length;a++){let c=s[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&r.length===0||!Vy(c))return;o+=2;continue}if(!kW(c))return;s[a]=parseInt(c,16).toString(16),o++}if(t===-1){if(o!==8)return;return F_(s)}if(o>=8)return;let i=s.slice(0,n.length);for(let a=o;a<8;a++)i.push("0");for(let a=n.length;a<s.length;a++)i.push(s[a]);return F_(i)}function Ly(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 r=t?e.slice(1,-1):e;if(t&&OW(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(TW(r,":")<2)return{host:e,isIPV6:!1,error:t};let s="",o=r.indexOf("%");if(o!==-1){let a=r.slice(o,o+3).toLowerCase()==="%25"?3:1;if(s=r.slice(o+a),!RW(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=NW(r);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(s?"%"+s:""),escapedHost:i+(s?"%25"+s:""),isIPV6:!0}}function TW(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function V_(e){let t=e,n=[],r=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.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]==="/"){n.push("/");break}}}else if(s===3){if(t==="/.."){if(n.length!==0)n.pop();n.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),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}function JW(e){if(e===""||e[0]==="/")return V_(e);let t=e.split("/"),n=t.length-1,r=[],s=!1;for(let o=0;o<=n;o++){let i=t[o];if(i==="."||i===".."){if(i==="..")if(r.length!==0&&r[r.length-1]!=="..")r.pop();else r.push("..");s=o===n}else r.push(i)}if(s&&r[r.length-1]!=="..")r.push("");if(r.length===0||r[0]===""||r[0].includes(":"))r.unshift(".");return r.join("/")}var IW={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},DW=/[@/?#:]/g,MW=/[@/?#]/g;function q_(e,t){let n=t?MW:DW;return n.lastIndex=0,e.replace(n,(r)=>IW[r])}function W_(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&qy(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function FW(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&qy(i))t+=i;else t+="%"+o;n+=2;continue}}if(L_(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=U_(s)?r:cn[s];else if(s<55296||s>57343)t+=Ht(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Ht(65536+(s-55296<<10)+(o-56320)),n++;else t+=Ht(65533)}else t+=Ht(65533)}}return t}function LW(e,t=!1){let n="",r=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let o=e[s];if(o==="%"&&s+2<e.length){let i=e.slice(s+1,s+3);if(Mo(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(L_(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=cn[i];else if(i<55296||i>57343)n+=Ht(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=Ht(65536+(i-55296<<10)+(a-56320)),s++;else n+=Ht(65533)}else n+=Ht(65533)}}return n}function Hy(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Mo(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=cn[o];else if(o<55296||o>57343)n+=Ht(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=Ht(65536+(o-55296<<10)+(i-56320)),r++;else n+=Ht(65533)}else n+=Ht(65533)}}return n}function H_(e){return Hy(e,PW)}function VW(e){return Hy(e,Wy)}function qW(e){return Hy(e,Wy)}function U_(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 WW(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Mo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(qy(i))t+=i;else t+="%"+o;n+=2;continue}}if(Wy(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=U_(s)?r:cn[s];else if(s<55296||s>57343)t+=Ht(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Ht(65536+(s-55296<<10)+(o-56320)),n++;else t+=Ht(65533)}else t+=Ht(65533)}}return t}function HW(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(Mo(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function UW(e){let t=[];if(e.userinfo!==void 0)t.push(H_(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!Vy(n)){let r=Ly(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=W_(n,!0),r=Ly(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=q_(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!jW(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}B_.exports={nonSimpleDomain:CW,recomposeAuthority:UW,reescapeHostDelimiters:q_,normalizePercentEncoding:W_,normalizePathEncoding:FW,serializePathEncoding:LW,normalizeQueryFragmentEncoding:WW,encodeUserinfo:H_,encodeQuery:VW,encodeFragment:qW,escapePreservingEscapes:HW,removeDotSegments:V_,removeDotSegmentsRelative:JW,isIPv4:Vy,isUUID:EW,normalizeIPv6:Ly,stringArrayToHexStripped:_W}});var Y_=q(function(gte,X_){var{isUUID:BW}=Uy(),zW=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,KW=["http","https","ws","wss","urn","urn:uuid"];function GW(e){return KW.indexOf(e)!==-1}function By(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 z_(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function K_(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 XW(e){return e.secure=By(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function YW(e){if(e.port===(By(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("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function ZW(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(zW);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let s=`${r}:${t.nid||e.nid}`,o=zy(s);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function QW(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),s=`${n}:${t.nid||r}`,o=zy(s);if(o)e=o.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function eH(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!BW(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function tH(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var G_={scheme:"http",domainHost:!0,parse:z_,serialize:K_},nH={scheme:"https",domainHost:G_.domainHost,parse:z_,serialize:K_},Mf={scheme:"ws",domainHost:!0,parse:XW,serialize:YW},rH={scheme:"wss",domainHost:Mf.domainHost,parse:Mf.parse,serialize:Mf.serialize},sH={scheme:"urn",parse:ZW,serialize:QW,skipNormalize:!0},oH={scheme:"urn:uuid",parse:eH,serialize:tH,skipNormalize:!0},Ff={http:G_,https:nH,ws:Mf,wss:rH,urn:sH,"urn:uuid":oH};Object.setPrototypeOf(Ff,null);function zy(e){return e&&(Ff[e]||Ff[e.toLowerCase()])||void 0}X_.exports={wsIsSecure:By,SCHEMES:Ff,isValidSchemeName:GW,getSchemeHandler:zy}});var fk=q(function(yte,Wf){var{normalizeIPv6:nk,removeDotSegments:Fc,removeDotSegmentsRelative:rk,recomposeAuthority:iH,normalizePercentEncoding:Ky,normalizePathEncoding:aH,serializePathEncoding:Z_,normalizeQueryFragmentEncoding:Q_,encodeQuery:cH,encodeFragment:lH,reescapeHostDelimiters:uH,isIPv4:sk,nonSimpleDomain:fH}=Uy(),{SCHEMES:ok,getSchemeHandler:Gy}=Y_(),ik=/^[A-Za-z][A-Za-z0-9+.-]*$/u,dH=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function ek(e){let t=String(e);if(!ik.test(t))throw TypeError("URI scheme is malformed.");return t}function pH(e,t){if(typeof e==="string")e=wH(e,t);else if(typeof e==="object")e=Vf(Fo(e,t),t);return e}function mH(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=Lf(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:x,malformedScheme:g}=Lf(t,r);if(o||d||i||p||a||m||c||x||l||g)throw Error(s.error||u.error||"URI is malformed.");let y=ak(s,u,r,!0),S=Gy(n&&n.scheme||y.scheme),E=y.host,v=E!==void 0&&E!==""&&(sk(E)||nk(E).isIPV6);if(lk(y,n||{},S,v))throw Error("URI host is malformed.");ck(y,n||{},S,v);let j=E&&E.indexOf("%")!==-1&&!/\P{ASCII}/u.test(E);if(y.error&&!j)throw Error(y.error);return r.skipEscape=!0,Fo(y,r)}function ak(e,t,n,r){let s={};if(!r)e=Vf(Fo(e,n),n),t=Vf(Fo(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Fc(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=Fc(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=Fc(t.path);else{let o=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(o&&!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&&!o&&s.path[0]!=="/"?rk(s.path):Fc(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 hH(e,t,n){let r=tk(e,n),s=tk(t,n);return r!==void 0&&s!==void 0&&r===s}function Fo(e,t){let n={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:""},r=Object.assign({},t),s=[];if(n.scheme)n.scheme=ek(n.scheme);let o=Gy(r.scheme||n.scheme);if(o&&o.serialize)o.serialize(n,r);let i=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,a=(n.scheme===void 0||r.reference==="suffix")&&!i,c=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=Z_(n.path,c);else n.path=Ky(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=ek(n.scheme),s.push(n.scheme,":");let l=iH(n);if(l!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(l),n.path&&n.path[0]!=="/")s.push("/")}if(n.path!==void 0){let u=n.path;if(!r.absolutePath&&(!o||!o.absolutePath))u=a&&u[0]!=="/"?rk(u):Fc(u);if(a)u=Z_(u,!0);if(l===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",cH(n.query));if(n.fragment!==void 0)s.push("#",lH(n.fragment));return s.join("")}var gH=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,yH=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,xH=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function bH(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 Mc(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 qf(e){return e[0]==="["&&e[e.length-1]==="]"}function $H(e){let t=e[4];return Mc(e[3])||t!==void 0&&!qf(t)&&Mc(t)||Mc(e[6])||Mc(e[7])||Mc(e[8])}function ck(e,t,n,r){if(lk(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!qf(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&fH(e.host)){let s;try{s=new URL("http://"+e.host)}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!SH(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function lk(e,t,n,r){return Boolean(e.host&&r===!1&&!qf(e.host)&&(t.domainHost||n&&n.domainHost)&&dH.test(e.host))}function SH(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Lf(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,o=!1,i=!1,a=!1,c=!1,l=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(yH);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(xH);if(p!==null){let x=p[1],g=x.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(x.length!==g.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(gH);if(m){if(r.scheme=m[1],r.userinfo=m[3],r.host=m[4],r.port=parseInt(m[5],10),r.path=m[6]||"",r.query=m[7],r.fragment=m[8],r.scheme!==void 0)if(ik.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",l=!0;if(o=$H(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let x=bH(r,m);if(x!==void 0)r.error=r.error||x,s=!0;if(r.host)if(sk(r.host)===!1){let S=qf(r.host),E=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,v=nk(r.host);if(u=v.isIPV6||v.isIPVFuture===!0,c=E&&(!S||v.error===!0),r.host=u?v.host:v.host.toLowerCase(),c)r.error=r.error||"URI host is malformed.",s=!0}else u=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let g=Gy(n.scheme||r.scheme);if(!c)a=ck(r,n,g,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!c){let y=u?r.host:Ky(r.host,!0);if(!u)y=Ky(y.toLowerCase());r.host=u||n.scheme!=="null"?uH(y,u):y}if(!g||g&&!g.skipNormalize){if(r.path)r.path=aH(r.path);if(r.query)r.query=Q_(r.query);if(r.fragment)r.fragment=Q_(r.fragment)}if(g&&g.parse){if(g.parse(r,n),g===ok.urn&&r.nid===void 0)i=!0}}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}}function Vf(e,t){return Lf(e,t).parsed}function wH(e,t){return uk(e,t).normalized}function uk(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=Lf(e,t);return{normalized:r||s||o||i||a?e:Fo(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function tk(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Fo(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=uk(n,t);return s||o||i||a||c?void 0:r}var Xy={SCHEMES:ok,normalize:pH,resolve:mH,resolveComponent:ak,equal:hH,serialize:Fo,parse:Vf};Wf.exports=Xy;Wf.exports.default=Xy;Wf.exports.fastUri=Xy});var mk=q(function(pk){Object.defineProperty(pk,"__esModule",{value:!0});var dk=fk();dk.code='require("ajv/dist/runtime/uri").default';pk.default=dk});var Zy=q(function(ts){Object.defineProperty(ts,"__esModule",{value:!0});ts.CodeGen=ts.Name=ts.nil=ts.stringify=ts.str=ts._=ts.KeywordCxt=void 0;var EH=zi();Object.defineProperty(ts,"KeywordCxt",{enumerable:!0,get:function(){return EH.KeywordCxt}});var Yi=ye();Object.defineProperty(ts,"_",{enumerable:!0,get:function(){return Yi._}});Object.defineProperty(ts,"str",{enumerable:!0,get:function(){return Yi.str}});Object.defineProperty(ts,"stringify",{enumerable:!0,get:function(){return Yi.stringify}});Object.defineProperty(ts,"nil",{enumerable:!0,get:function(){return Yi.nil}});Object.defineProperty(ts,"Name",{enumerable:!0,get:function(){return Yi.Name}});Object.defineProperty(ts,"CodeGen",{enumerable:!0,get:function(){return Yi.CodeGen}});var jH=Jc(),bk=Gi(),$k=_y(),wr=Dc(),Sk=ye(),vr=Tc(),Fs=Nc(),Xi=_e(),hk=M_(),PH=mk(),wk=(e,t)=>new RegExp(e,t);wk.code="new RegExp";var _H=["removeAdditional","useDefaults","coerceTypes"],kH=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),OH={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."},AH={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},gk=200;function CH(e){var t,n,r,s,o,i,a,c,l,u,d,p,m,x,g,y,S,E,v,j,P,O,T,U,F;let H=e.strict,A=(t=e.code)===null||t===void 0?void 0:t.optimize,N=A===!0||A===void 0?1:A||0,B=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:wk,M=(s=e.uriResolver)!==null&&s!==void 0?s:PH.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:H)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:H)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:H)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:H)!==null&&p!==void 0?p:"log",strictRequired:(x=(m=e.strictRequired)!==null&&m!==void 0?m:H)!==null&&x!==void 0?x:!1,code:e.code?{...e.code,optimize:N,regExp:B}:{optimize:N,regExp:B},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:gk,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:gk,meta:(S=e.meta)!==null&&S!==void 0?S:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(j=e.schemaId)!==null&&j!==void 0?j:"$id",addUsedSchema:(P=e.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(O=e.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(T=e.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(U=e.unicodeRegExp)!==null&&U!==void 0?U:!0,int32range:(F=e.int32range)!==null&&F!==void 0?F:!0,uriResolver:M}}class Hf{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...CH(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new Sk.ValueScope({scope:{},prefixes:kH,es5:t,lines:n}),this.logger=DH(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=$k.getRules(),yk.call(this,OH,e,"NOT SUPPORTED"),yk.call(this,AH,e,"DEPRECATED","warn"),this._metaOpts=JH.call(this),e.formats)NH.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)TH.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);RH.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=hk;if(n==="id")r={...hk},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!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 n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(l,u){await s.call(this,l.$schema);let d=this._addSchema(l,u);return d.validate||o.call(this,d)}async function s(l){if(l&&!this.getSchema(l))await r.call(this,{$ref:l},!0)}async function o(l){try{return this._compileSchemaEnv(l)}catch(u){if(!(u instanceof bk.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,l)}}function i({missingSchema:l,missingRef:u}){if(this.refs[l])throw Error(`AnySchema ${l} is loaded but ${u} cannot be resolved`)}async function a(l){let u=await c.call(this,l);if(!this.refs[l])await s.call(this,u.$schema);if(!this.refs[l])this.addSchema(u,l,t)}async function c(l){let u=this._loading[l];if(u)return u;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,r);return this}let s;if(typeof e==="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw Error(`schema ${o} must be string`)}return t=vr.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return r}getSchema(e){let t;while(typeof(t=xk.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new wr.SchemaEnv({schema:{},schemaId:n});if(t=wr.resolveSchema.call(this,r,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=xk.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 n=e[this.opts.schemaId];if(n)n=vr.normalizeId(n),delete this.schemas[n],delete this.refs[n];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 n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(FH.call(this,n,t),!t)return Xi.eachItem(n,(s)=>Yy.call(this,s)),this;VH.call(this,t);let r={...t,type:Fs.getJSONTypes(t.type),schemaType:Fs.getJSONTypes(t.schemaType)};return Xi.eachItem(n,r.type.length===0?(s)=>Yy.call(this,s,r):(s)=>r.type.forEach((o)=>Yy.call(this,s,r,o))),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 n of t.rules){let r=n.rules.findIndex((s)=>s.keyword===e);if(r>=0)n.rules.splice(r,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:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,s)=>r+t+s)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let s=r.split("/").slice(1),o=e;for(let i of s)o=o[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:c}=a.definition,l=o[i];if(c&&l)o[i]=vk(l)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:i}=this.opts;if(typeof e=="object")o=e[i];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;n=vr.normalizeId(o||n);let c=vr.getSchemaRefs.call(this,e,n);if(a=new wr.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),s&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)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 wr.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{wr.compileSchema.call(this,e)}finally{this.opts=t}}}Hf.ValidationError=jH.default;Hf.MissingRefError=bk.default;ts.default=Hf;function yk(e,t,n,r="error"){for(let s in e){let o=s;if(o in t)this.logger[r](`${n}: option ${s}. ${e[o]}`)}}function xk(e){return e=vr.normalizeId(e),this.schemas[e]||this.refs[e]}function RH(){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 NH(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function TH(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 n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function JH(){let e={...this.opts};for(let t of _H)delete e[t];return e}var IH={log(){},warn(){},error(){}};function DH(e){if(e===!1)return IH;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 MH=/^[a-z_$][a-z0-9_$:-]*$/i;function FH(e,t){let{RULES:n}=this;if(Xi.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!MH.test(r))throw Error(`Keyword ${r} 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 Yy(e,t,n){var r;let s=t===null||t===void 0?void 0:t.post;if(n&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:c})=>c===n);if(!i)i={type:n,rules:[]},o.rules.push(i);if(o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Fs.getJSONTypes(t.type),schemaType:Fs.getJSONTypes(t.schemaType)}};if(t.before)LH.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((c)=>this.addKeyword(c))}function LH(e,t,n){let r=e.rules.findIndex((s)=>s.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function VH(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=vk(t);e.validateSchema=this.compile(t,!0)}var qH={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function vk(e){return{anyOf:[e,qH]}}});var jk=q(function(Ek){Object.defineProperty(Ek,"__esModule",{value:!0});var UH={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ek.default=UH});var Kf=q(function(_k){Object.defineProperty(_k,"__esModule",{value:!0});_k.callRef=_k.getValidate=void 0;var zH=Gi(),Bf=Dn(),qe=ye(),Zi=Jn(),zf=Dc(),Ls=_e(),KH={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=r,{root:l}=o;if((n==="#"||n==="#/")&&s===l.baseId)return d();let u=zf.resolveRef.call(c,l,s,n);if(u===void 0)throw new zH.default(r.opts.uriResolver,s,n);if(u instanceof zf.SchemaEnv)return p(u);return m(u);function d(){if(o===l)return Uf(e,i,o,o.$async);let x=t.scopeValue("root",{ref:l});return Uf(e,qe._`${x}.validate`,l,l.$async)}function p(x){let g=Pk(e,x);Uf(e,g,x,x.$async)}function m(x){let g=t.scopeValue("schema",a.code.source===!0?{ref:x,code:qe.stringify(x)}:{ref:x}),y=t.name("valid"),S=e.subschema({schema:x,dataTypes:[],schemaPath:qe.nil,topSchemaRef:g,errSchemaPath:n},y);e.mergeEvaluated(S),e.ok(y)}}};function Pk(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):qe._`${n.scopeValue("wrapper",{ref:t})}.validate`}_k.getValidate=Pk;function Uf(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:c}=o,l=c.passContext?Zi.default.this:qe.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let x=s.let("valid");s.try(()=>{if(s.code(qe._`await ${Bf.callValidateCode(e,t,l)}`),m(t),!i)s.assign(x,!0)},(g)=>{if(s.if(qe._`!(${g} instanceof ${o.ValidationError})`,()=>s.throw(g)),p(g),!i)s.assign(x,!1)}),e.ok(x)}function d(){e.result(Bf.callValidateCode(e,t,l),()=>m(t),()=>p(t))}function p(x){let g=qe._`${x}.errors`;s.assign(Zi.default.vErrors,qe._`${Zi.default.vErrors} === null ? ${g} : ${Zi.default.vErrors}.concat(${g})`),s.assign(Zi.default.errors,qe._`${Zi.default.vErrors}.length`)}function m(x){var g;if(!o.opts.unevaluated)return;let y=(g=n===null||n===void 0?void 0:n.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)o.props=Ls.mergeEvaluated.props(s,y.props,o.props)}else{let S=s.var("props",qe._`${x}.evaluated.props`);o.props=Ls.mergeEvaluated.props(s,S,o.props,qe.Name)}if(o.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)o.items=Ls.mergeEvaluated.items(s,y.items,o.items)}else{let S=s.var("items",qe._`${x}.evaluated.items`);o.items=Ls.mergeEvaluated.items(s,S,o.items,qe.Name)}}}_k.callRef=Uf;_k.default=KH});var Qy=q(function(Ok){Object.defineProperty(Ok,"__esModule",{value:!0});var YH=jk(),ZH=Kf(),QH=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",YH.default,ZH.default];Ok.default=QH});var Ck=q(function(Ak){Object.defineProperty(Ak,"__esModule",{value:!0});var qs=ye(),Vs=qs.operators,Gf={maximum:{okStr:"<=",ok:Vs.LTE,fail:Vs.GT},minimum:{okStr:">=",ok:Vs.GTE,fail:Vs.LT},exclusiveMaximum:{okStr:"<",ok:Vs.LT,fail:Vs.GTE},exclusiveMinimum:{okStr:">",ok:Vs.GT,fail:Vs.LTE}},tU={message:({keyword:e,schemaCode:t})=>qs.str`must be ${Gf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>qs._`{comparison: ${Gf[e].okStr}, limit: ${t}}`},nU={keyword:Object.keys(Gf),type:"number",schemaType:"number",$data:!0,error:tU,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(qs._`${n} ${Gf[t].fail} ${r} || isNaN(${n})`)}};Ak.default=nU});var Nk=q(function(Rk){Object.defineProperty(Rk,"__esModule",{value:!0});var Er=ye(),sU={message:({schemaCode:e})=>Er.str`must be multiple of ${e}`,params:({schemaCode:e})=>Er._`{multipleOf: ${e}}`},oU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:sU,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Er._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Er._`${i} !== parseInt(${i})`;e.fail$data(Er._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};Rk.default=oU});var Ik=q(function(Jk){Object.defineProperty(Jk,"__esModule",{value:!0});function Tk(e){let t=e.length,n=0,r=0,s;while(r<t)if(n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t){if(s=e.charCodeAt(r),(s&64512)===56320)r++}return n}Jk.default=Tk;Tk.code='require("ajv/dist/runtime/ucs2length").default'});var Fk=q(function(Mk){Object.defineProperty(Mk,"__esModule",{value:!0});var ln=ye(),Dk=_e(),cU=Ik(),lU={message({keyword:e,schemaCode:t}){return ln.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>ln._`{limit: ${e}}`},uU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:lU,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?ln.operators.GT:ln.operators.LT,i=s.opts.unicode===!1?ln._`${n}.length`:ln._`${Dk.useFunc(e.gen,cU.default)}(${n})`;e.fail$data(ln._`${i} ${o} ${r}`)}};Mk.default=uU});var Wk=q(function(qk){Object.defineProperty(qk,"__esModule",{value:!0});var Lk=Dn(),Vk=_e(),Mn=ye(),dU={message:({schemaCode:e})=>Mn.str`must match pattern "${e}"`,params:({schemaCode:e})=>Mn._`{pattern: ${e}}`},pU={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:dU,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?Mn._`new RegExp`:Vk.useFunc(t,c),u=t.let("valid");t.try(()=>t.assign(u,Mn._`${l}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(Mn._`!${u}`)}else{let c=Lk.usePattern(e,s);e.fail$data(Mn._`!${c}.test(${n})`)}}};qk.default=pU});var Uk=q(function(Hk){Object.defineProperty(Hk,"__esModule",{value:!0});var jr=ye(),hU={message({keyword:e,schemaCode:t}){return jr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>jr._`{limit: ${e}}`},gU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:hU,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?jr.operators.GT:jr.operators.LT;e.fail$data(jr._`Object.keys(${n}).length ${s} ${r}`)}};Hk.default=gU});var Kk=q(function(zk){Object.defineProperty(zk,"__esModule",{value:!0});var Pr=Dn(),_r=ye(),Bk=_e(),xU={message:({params:{missingProperty:e}})=>_r.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>_r._`{missingProperty: ${e}}`},bU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:xU,code(e){let{gen:t,schema:n,schemaCode:r,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&n.length===0)return;let c=n.length>=a.loopRequired;if(i.allErrors)l();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:x}=e.it;for(let g of n)if((m===null||m===void 0?void 0:m[g])===void 0&&!x.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,S=`required property "${g}" is not defined at "${y}" (strictRequired)`;Bk.checkStrictMode(i,S,i.opts.strictRequired)}}function l(){if(c||o)e.block$data(_r.nil,d);else for(let m of n)Pr.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(c||o){let x=t.let("valid",!0);e.block$data(x,()=>p(m,x)),e.ok(x)}else t.if(Pr.checkMissingProp(e,n,m)),Pr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Pr.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,x){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(x,Pr.propertyInData(t,s,m,a.ownProperties)),t.if(_r.not(x),()=>{e.error(),t.break()})},_r.nil)}}};zk.default=bU});var Xk=q(function(Gk){Object.defineProperty(Gk,"__esModule",{value:!0});var kr=ye(),SU={message({keyword:e,schemaCode:t}){return kr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>kr._`{limit: ${e}}`},wU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:SU,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?kr.operators.GT:kr.operators.LT;e.fail$data(kr._`${n}.length ${s} ${r}`)}};Gk.default=wU});var Xf=q(function(Zk){Object.defineProperty(Zk,"__esModule",{value:!0});var Yk=Ty();Yk.code='require("ajv/dist/runtime/equal").default';Zk.default=Yk});var tO=q(function(eO){Object.defineProperty(eO,"__esModule",{value:!0});var Qi=Nc(),Ae=ye(),Qk=_e(),jU=Xf(),PU={message:({params:{i:e,j:t}})=>Ae.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ae._`{i: ${e}, j: ${t}}`},_U={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:PU,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let c=t.let("valid"),l=o.items?Qi.getSchemaTypes(o.items):[];e.block$data(c,u,Ae._`${i} === false`),e.ok(c);function u(){let x=t.let("i",Ae._`${n}.length`),g=t.let("j");e.setParams({i:x,j:g}),t.assign(c,!0),t.if(Ae._`${x} > 1`,()=>(d()?p:m)(x,g))}function d(){return l.length>0&&!l.some((x)=>x==="object"||x==="array")}function p(x,g){let y=t.name("item"),S=Qi.checkDataTypes(l,y,a.opts.strictNumbers,Qi.DataType.Wrong),E=t.const("indices",Ae._`{}`);t.for(Ae._`;${x}--;`,()=>{if(t.let(y,Ae._`${n}[${x}]`),t.if(S,Ae._`continue`),l.length>1)t.if(Ae._`typeof ${y} == "string"`,Ae._`${y} += "_"`);t.if(Ae._`typeof ${E}[${y}] == "number"`,()=>{t.assign(g,Ae._`${E}[${y}]`),e.error(),t.assign(c,!1).break()}).code(Ae._`${E}[${y}] = ${x}`)})}function m(x,g){let y=Qk.useFunc(t,jU.default),S=t.name("outer");t.label(S).for(Ae._`;${x}--;`,()=>t.for(Ae._`${g} = ${x}; ${g}--;`,()=>t.if(Ae._`${y}(${n}[${x}], ${n}[${g}])`,()=>{e.error(),t.assign(c,!1).break(S)})))}}};eO.default=_U});var sO=q(function(rO){Object.defineProperty(rO,"__esModule",{value:!0});var ea=ye(),nO=_e(),OU=Xf(),AU={message:"must be equal to constant",params:({schemaCode:e})=>ea._`{allowedValue: ${e}}`},CU={keyword:"const",$data:!0,error:AU,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(ea._`!${nO.useFunc(t,OU.default)}(${n}, ${s})`);else e.fail(ea._`${o} !== ${n}`)}};rO.default=CU});var aO=q(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});var Or=ye(),oO=_e(),NU=Xf(),TU={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Or._`{allowedValues: ${e}}`},JU={keyword:"enum",schemaType:"array",$data:!0,error:TU,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e;if(!r&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,c,l=()=>c!==null&&c!==void 0?c:c=oO.useFunc(t,NU.default),u;if(a||r)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",o);u=Or.or(...s.map((x,g)=>p(m,g)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(Or._`${l()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,x){let g=s[x];return typeof g==="object"&&g!==null?Or._`${l()}(${n}, ${m}[${x}])`:Or._`${n} === ${g}`}}};iO.default=JU});var ex=q(function(cO){Object.defineProperty(cO,"__esModule",{value:!0});var DU=Ck(),MU=Nk(),FU=Fk(),LU=Wk(),VU=Uk(),qU=Kk(),WU=Xk(),HU=tO(),UU=sO(),BU=aO(),zU=[DU.default,MU.default,FU.default,LU.default,VU.default,qU.default,WU.default,HU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},UU.default,BU.default];cO.default=zU});var tx=q(function(uO){Object.defineProperty(uO,"__esModule",{value:!0});uO.validateAdditionalItems=void 0;var un=ye(),ta=_e(),GU={message:({params:{len:e}})=>un.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>un._`{limit: ${e}}`},XU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:GU,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){ta.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}lO(e,r)}};function lO(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",un._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(un._`${a} <= ${t.length}`);else if(typeof r=="object"&&!ta.alwaysValidSchema(i,r)){let l=n.var("valid",un._`${a} <= ${t.length}`);n.if(un.not(l),()=>c(l)),e.ok(l)}function c(l){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:ta.Type.Num},l),!i.allErrors)n.if(un.not(l),()=>n.break())})}}uO.validateAdditionalItems=lO;uO.default=XU});var nx=q(function(mO){Object.defineProperty(mO,"__esModule",{value:!0});mO.validateTuple=void 0;var Yf=ye(),Ws=_e(),dO=Dn(),ZU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return pO(e,"additionalItems",t);if(n.items=!0,Ws.alwaysValidSchema(n,t))return;e.ok(dO.validateArray(e))}};function pO(e,t,n=e.schema){let{gen:r,parentSchema:s,data:o,keyword:i,it:a}=e;if(u(s),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=Ws.mergeEvaluated.items(r,n.length,a.items);let c=r.name("valid"),l=r.const("len",Yf._`${o}.length`);n.forEach((d,p)=>{if(Ws.alwaysValidSchema(a,d))return;r.if(Yf._`${l} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c)});function u(d){let{opts:p,errSchemaPath:m}=a,x=n.length,g=x===d.minItems&&(x===d.maxItems||d[t]===!1);if(p.strictTuples&&!g){let y=`"${i}" is ${x}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Ws.checkStrictMode(a,y,p.strictTuples)}}}mO.validateTuple=pO;mO.default=ZU});var xO=q(function(yO){Object.defineProperty(yO,"__esModule",{value:!0});var gO=nx(),eB={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>gO.validateTuple(e,"items")};yO.default=eB});var vO=q(function(wO){Object.defineProperty(wO,"__esModule",{value:!0});var Zf=ye(),bO=_e(),$O=Dn(),SO=tx(),nB={message:({params:{len:e}})=>Zf.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Zf._`{limit: ${e}}`},rB={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:nB,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,bO.alwaysValidSchema(r,t))return;if(s)SO.validateAdditionalItems(e,s);else e.ok($O.validateArray(e))}};wO.default=rB});var jO=q(function(EO){Object.defineProperty(EO,"__esModule",{value:!0});var Qe=ye(),Hs=_e(),oB={message:({params:{min:e,max:t}})=>t===void 0?Qe.str`must contain at least ${e} valid item(s)`:Qe.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Qe._`{minContains: ${e}}`:Qe._`{minContains: ${e}, maxContains: ${t}}`},iB={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:oB,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:c,maxContains:l}=r;if(o.opts.next)i=c===void 0?1:c,a=l;else i=1;let u=t.const("len",Qe._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Hs.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Hs.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Hs.alwaysValidSchema(o,n)){let g=Qe._`${u} >= ${i}`;if(a!==void 0)g=Qe._`${g} && ${u} <= ${a}`;e.pass(g);return}o.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(Qe._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let g=t.name("_valid"),y=t.let("count",0);m(g,()=>t.if(g,()=>x(y)))}function m(g,y){t.forRange("i",0,u,(S)=>{e.subschema({keyword:"contains",dataProp:S,dataPropType:Hs.Type.Num,compositeRule:!0},g),y()})}function x(g){if(t.code(Qe._`${g}++`),a===void 0)t.if(Qe._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(Qe._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(Qe._`${g} >= ${i}`,()=>t.assign(d,!0))}}};EO.default=iB});var Qf=q(function(OO){Object.defineProperty(OO,"__esModule",{value:!0});OO.validateSchemaDeps=OO.validatePropertyDeps=OO.error=void 0;var na=ye(),PO=_e(),Ar=Dn();OO.error={message:({params:{property:e,depsCount:t,deps:n}})=>na.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>na._`{property: ${e},
|
|
629
|
+
${b}`);let{extAttrs:ae}=f,U=ae.indexOf(h),oe=ae.splice(U,1);ae.length?ae.length===U?ae[U-1].tokens.separator=void 0:ae[U].tokens.name.trivia.trim()||(ae[U].tokens.name.trivia=oe[0].tokens.name.trivia):ae.tokens.open=ae.tokens.close=void 0}}class xr extends $t{static parse(f,h,{extMembers:b=[],partial:v}={}){let _={partial:v,base:h};if(_.mixin=f.consume("mixin"),_.mixin)return $t.parse(f,new xr({source:f.source,tokens:_}),{allowedMembers:[...b,[tr.parse],[xe],[H.parse,{noInherit:!0}],[V.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class br extends o{static parse(f){let h={},b=z(new br({source:f.source,tokens:h}));return b.extAttrs=x.parse(f),h.required=f.consume("required"),b.idlType=ne(f,"dictionary-type")||f.error("Dictionary member lacks a type"),h.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),b.default=A.parse(f),h.required&&b.default&&f.error("Required member must not have a default"),h.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),b.this}get type(){return"field"}get name(){return O(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:h}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:h}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:h})}}class nr extends $t{static parse(f,{extMembers:h=[],partial:b}={}){let v={partial:b};if(v.base=f.consume("dictionary"),v.base)return $t.parse(f,new nr({source:f.source,tokens:v}),{inheritable:!b,allowedMembers:[...h,[br.parse]]})}get type(){return"dictionary"}}class bs extends $t{static parse(f,{extMembers:h=[],partial:b}={}){let v={partial:b};if(v.base=f.consume("namespace"),v.base)return $t.parse(f,new bs({source:f.source,tokens:v}),{allowedMembers:[...h,[H.parse,{noInherit:!0,readonly:!0}],[tr.parse],[V.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((h)=>h.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:B(this)});yield*super.validate(f)}}class uo extends $t{static parse(f,h,{extMembers:b=[]}={}){let v={callback:h};if(v.base=f.consume("interface"),v.base)return $t.parse(f,new uo({source:f.source,tokens:v}),{allowedMembers:[...b,[tr.parse],[V.parse,{regular:!0}]]})}get type(){return"callback interface"}}function bc(f,h){let b=f.source;function v(U){f.error(U)}function _(...U){return f.consume(...U)}function M(U){let oe=_("interface");if(oe)return xr.parse(f,oe,{...U,...h?.extensions?.mixin})||Ca.parse(f,oe,{...U,...h?.extensions?.interface})||v("Interface has no proper body")}function K(){if(h.productions)for(let U of h.productions){let oe=U(f);if(oe)return oe}return function(){let U=_("callback");if(U)return f.probe("interface")?uo.parse(f,U,{...h?.extensions?.callbackInterface}):co.parse(f,U)}()||M()||function(){let U=_("partial");if(U)return nr.parse(f,{partial:U,...h?.extensions?.dictionary})||M({partial:U})||bs.parse(f,{partial:U,...h?.extensions?.namespace})||v("Partial doesn't apply to anything")}()||nr.parse(f,h?.extensions?.dictionary)||Se.parse(f)||Nt.parse(f)||Ze.parse(f)||bs.parse(f,h?.extensions?.namespace)}let ae=function(){if(!b.length)return[];let U=[];for(;;){let ie=x.parse(f),ge=K();if(!ge){ie.length&&v("Stray extended attributes");break}z(ge).extAttrs=ie,U.push(ge)}let oe=u.parse(f);return h.concrete&&U.push(oe),U}();return f.position<b.length&&v("Unrecognised tokens"),ae}function pp(f,h={}){let b=new bt(f);return h.sourceName!==void 0&&(b.source.name=h.sourceName),bc(b,h)}function un(f){return f}let Xo={wrap:(f)=>f.join(""),trivia:un,name:un,reference:un,type:un,generic:un,nameless:un,inheritance:un,definition:un,extendedAttribute:un,extendedAttributeReference:un};class $c{constructor(f){this.ts=Object.assign({},Xo,f)}reference(f,{unescaped:h,context:b}){return h||(h=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,h,b)}token(f,h=un,...b){if(!f)return"";let v=h(f.value,...b);return this.ts.wrap([this.ts.trivia(f.trivia),v])}reference_token(f,h){return this.token(f,this.reference.bind(this),{context:h})}name_token(f,h){return this.token(f,this.ts.name,h)}identifier(f,h){return this.ts.wrap([this.reference_token(f.tokens.value,h),this.token(f.tokens.separator)])}}function mp(f,{templates:h=Xo}={}){h=Object.assign({},Xo,h);let b=new $c(h);return h.wrap(f.map((v)=>v.write(b)))}function fo(f,h){let b=new Map,v=f.filter((_)=>_.type==="includes");for(let _ of v){let M=h.get(_.includes);if(!M)continue;let K=b.get(_.target);K?K.push(M):b.set(_.target,[M])}return b}function*Sc(f){let h=function(b){let v=new Map,_=new Set,M=new Map;for(let K of b)if(K.partial){let ae=M.get(K.name);ae?ae.push(K):M.set(K.name,[K])}else K.name&&(v.has(K.name)?_.add(K):v.set(K.name,K));return{all:b,unique:v,partials:M,duplicates:_,mixinMap:fo(b,v),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let b of h.all)b.validate&&(yield*b.validate(h));yield*function*({unique:b,duplicates:v}){for(let _ of v){let{name:M}=_,K=`The name "${M}" of type "${b.get(M).type}" was already seen`;yield s(_.tokens.name,_,"no-duplicate",K)}}(h)}function wc(f){return[...Sc((h=f,h.flat?h.flat():[].concat(...h)))];var h}return t})())});var ZP=W(function(kne,YP){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",zP=pt("fs").promises,ad=pt("path"),KP=UP();class GP{constructor(e,t){this.filename=t,this.shortname=ad.basename(t,".idl"),this.path=ad.join(e,t)}async text(){return await zP.readFile(this.path,"utf8")}async parse(){let e=await this.text();return KP.parse(e)}}async function XP({folder:e=__dirname}={}){let t={},n=await zP.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new GP(e,r);t[s.shortname]=s}return t}async function MV(e){let t=await XP(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}YP.exports={listAll:XP,parseAll:MV}});function IV(){return QP??=DV(),QP}async function DV(){let[e,t,n]=await Promise.all([t_.listAll(),n_.default.listAll(),r_.default.parseAll()]),r=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let c of Object.values(n))for(let u of c){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let d of u.members)if(d.type==="attribute"&&d.name?.startsWith("on")&&d.idlType?.idlType==="EventHandler")a.add(d.name)}let l=[...a].toSorted();return{cssProps:i,eventHandlers:l,tagExamples:s}}function LV(e){let t={};for(let n of e)t[n]={description:`Event handler for the "${n.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function FV(e){let t={...yl.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function VV(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await IV();return{$defs:{DefsMap:Pg,TypeDefEntry:_g,StateMap:jg,StateEntry:Eg,TypedStateDef:Kh,PureTypeDef:sg,FunctionDef:Xh,ClassDef:Og,ClassParameterDef:zu,ClassFieldDef:Ku,ClassConstructorDef:Gu,ClassMethodDef:Xu,FormatDef:Yu,ProjectBlockDef:Zu,ServerBlockDef:Qu,ConnectorBlockDef:ef,StudioHints:tf,ExternalClassDef:ng,ExpressionPointer:ig,ExpressionLiteral:ag,ExpressionOperand:lg,UnaryOperator:cg,BinaryOperator:ug,ConditionalOperator:fg,SwitchOperator:dg,CallOperator:pg,PureMethod:mg,AssignmentOperator:hg,NoArgMethod:gg,OneArgMethod:yg,SpliceMethod:xg,ReduceMethod:bg,MapFilterMethod:$g,ExpressionNode:Sg,ExpressionEntry:wg,Statement:Zh,StatementList:Qh,ElementDef:{...Uu,properties:{...Uu.properties,...LV(n)}},ChildrenValue:Fh,ArrayNamespace:Lh,SwitchDef:Bh,SwitchNode:Uh,StyleObject:{...yl,properties:FV(t)},AttributesObject:qh,PropsObject:Hh,RefObject:Jh,AnyRef:Th,InternalRef:kh,StateRef:Oh,ExternalRef:Ah,ExternalComponentRef:Mh,GlobalRef:Ch,ParentRef:Rh,MapRef:Nh,ElementPropertyValue:Wh,StringOrRef:gh,BoolOrRef:yh,NumberOrRef:xh,CemParameter:wh,CemEvent:vh,TagName:{...mh,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:fh,ElementTagName:dh,JsonSchemaType:Ph,HeadEntry:$h,ImageConfig:gl,PathsValue:{$id:Io,anyOf:[...bl,Mg],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"}]},$script:{additionalProperties:!1,description:"This document's own modules, as TypeScript module text (spec.md §23.2). "+'A state entry names an export of one with `$src: "#client"` or `$src: "#server"`. `client` runs in the browser; `server` runs only on the server and is never sent to one.',properties:{client:{description:'The module the browser runs. A Function entry with `$src: "#client"` is one of its exports.',type:"string"},server:{description:'The module the server runs. A `timing: "server"` entry with `$src: "#server"` is one of its exports, called with `(args, env)`.',type:"string"}},type:"object"},$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:Io,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"},formAssociated:{description:"Makes the custom element a form-associated one (the Web Components formAssociated static): it attaches ElementInternals, a form's reset and a disabled fieldset reach its `value`, `checked` and `disabled` state, `required` with an empty value is reported as a missing value, and a label naming it reaches its control.",type:"boolean"},formValue:{description:"The value a form-associated custom element submits under its `name`, through ElementInternals.setFormValue: a `$ref`, a `${}` template or a literal. Omit it when a named native control inside the element already submits the value."},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 qV(){return{$defs:{ImageConfig:gl,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:nf.properties,title:"Jx Project",type:"object"}}function HV(){return{$defs:{ImageConfig:gl,JxFieldSchema:Tg,RelationshipRef:Jg,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:nf.properties,title:"Jx Project Core",type:"object"}}function WV(){return{$id:xl,$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 BV(){return{$id:Io,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...bl,Mg],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 UV(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...Rg}}function yx(){return{$defs:{ClassConstructorDef:Gu,ClassFieldDef:Ku,ClassMethodDef:Xu,ClassParameterDef:zu,ConnectorBlockDef:ef,FormatDef:Yu,ProjectBlockDef:Zu,ServerBlockDef:Qu,StudioHints:tf},$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 zV(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await VV(),a=qV(),l=yx(),c=HV(),u=UV(),d=WV(),p=BV(),m=JSON.stringify(i,null,2),y=JSON.stringify(a,null,2),S=JSON.stringify(l,null,2),g=JSON.stringify(c,null,2),x=JSON.stringify(u,null,2),P=JSON.stringify(d,null,2),w=JSON.stringify(p,null,2),[E]=process.argv.slice(2);if(E)n(E,m,"utf8"),console.error(`Jx component schema written to ${E}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),y,"utf8"),n(r(o,"class-schema.json"),S,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),g,"utf8"),n(r(o,"schemas","project.fields.schema.json"),P,"utf8"),n(r(o,"schemas","document.paths.schema.json"),w,"utf8"),n(r(o,"extension-manifest.schema.json"),x,"utf8");let j=Bun.spawnSync(["bunx","oxfmt",r(o,"schemas","project.core.schema.json"),r(o,"schemas","project.fields.schema.json"),r(o,"schemas","document.paths.schema.json")],{cwd:o});if(j.exitCode!==0){let A=j.stderr.toString()||j.stdout.toString()||`exit ${j.exitCode}${j.signalCode?`, signal ${j.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 t_,n_,r_,QP=null,s_,e_,Yne;var o_=J(()=>{ph();hh();bh();Sh();Eh();_h();Ih();Dh();Vh();zh();Gh();Yh();eg();rg();og();vg();kg();Ag();Ng();$l();jh();Cg();t_=Sr(VP(),1),n_=Sr(BP(),1),r_=Sr(ZP(),1);s_={...yl,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,e_]=process.argv,Yne=e_?.endsWith("schema.ts")?zV(e_):void 0});var sc=W(function(l_){Object.defineProperty(l_,"__esModule",{value:!0});l_.regexpCode=l_.getEsmExportName=l_.getProperty=l_.safeStringify=l_.stringify=l_.strConcat=l_.addCodeArg=l_.str=l_._=l_.nil=l_._Code=l_.Name=l_.IDENTIFIER=l_._CodeOrName=void 0;class ld{}l_._CodeOrName=ld;l_.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class na extends ld{constructor(e){super();if(!l_.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}}}l_.Name=na;class yr extends ld{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,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof na)t[n.str]=(t[n.str]||0)+1;return t},{})}}l_._Code=yr;l_.nil=new yr("");function i_(e,...t){let n=[e[0]],r=0;while(r<t.length)bx(n,t[r]),n.push(e[++r]);return new yr(n)}l_._=i_;var xx=new yr("+");function a_(e,...t){let n=[rc(e[0])],r=0;while(r<t.length)n.push(xx),bx(n,t[r]),n.push(xx,rc(e[++r]));return KV(n),new yr(n)}l_.str=a_;function bx(e,t){if(t instanceof yr)e.push(...t._items);else if(t instanceof na)e.push(t);else e.push(YV(t))}l_.addCodeArg=bx;function KV(e){let t=1;while(t<e.length-1){if(e[t]===xx){let n=GV(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function GV(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof na||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 na))return`"${e}${t.slice(1)}`;return}function XV(e,t){return t.emptyStr()?e:e.emptyStr()?t:a_`${e}${t}`}l_.strConcat=XV;function YV(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:rc(Array.isArray(e)?e.join(","):e)}function ZV(e){return new yr(rc(e))}l_.stringify=ZV;function rc(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}l_.safeStringify=rc;function QV(e){return typeof e=="string"&&l_.IDENTIFIER.test(e)?new yr(`.${e}`):i_`[${e}]`}l_.getProperty=QV;function eq(e){if(typeof e=="string"&&l_.IDENTIFIER.test(e))return new yr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}l_.getEsmExportName=eq;function tq(e){return new yr(e.toString())}l_.regexpCode=tq});var vx=W(function(d_){Object.defineProperty(d_,"__esModule",{value:!0});d_.ValueScope=d_.ValueScopeName=d_.Scope=d_.varKinds=d_.UsedValueState=void 0;var ze=sc();class u_ extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var ud;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ud||(d_.UsedValueState=ud={}));d_.varKinds={const:new ze.Name("const"),let:new ze.Name("let"),var:new ze.Name("var")};class Sx{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof ze.Name?e:this.name(e)}name(e){return new ze.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.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}}}d_.Scope=Sx;class wx extends ze.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=ze._`.${new ze.Name(t)}[${n}]`}}d_.ValueScopeName=wx;var mq=ze._`\n`;class f_ extends Sx{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?mq:ze.nil}}get(){return this._scope}name(e){return new wx(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:s}=r,o=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[s];if(i){let c=i.get(o);if(c)return c}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,r.setValue(t,{property:s,itemIndex:l}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return ze._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let s=ze.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((l)=>{if(a.has(l))return;a.set(l,ud.Started);let c=t(l);if(c){let u=this.opts.es5?d_.varKinds.var:d_.varKinds.const;s=ze._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=r===null||r===void 0?void 0:r(l))s=ze._`${s}${c}${this.opts._n}`;else throw new u_(l);a.set(l,ud.Completed)})}return s}}d_.ValueScope=f_});var $e=W(function(bn){Object.defineProperty(bn,"__esModule",{value:!0});bn.or=bn.and=bn.not=bn.CodeGen=bn.operators=bn.varKinds=bn.ValueScopeName=bn.ValueScope=bn.Scope=bn.Name=bn.regexpCode=bn.stringify=bn.getProperty=bn.nil=bn.strConcat=bn.str=bn._=void 0;var Z=sc(),mt=vx(),qs=sc();Object.defineProperty(bn,"_",{enumerable:!0,get:function(){return qs._}});Object.defineProperty(bn,"str",{enumerable:!0,get:function(){return qs.str}});Object.defineProperty(bn,"strConcat",{enumerable:!0,get:function(){return qs.strConcat}});Object.defineProperty(bn,"nil",{enumerable:!0,get:function(){return qs.nil}});Object.defineProperty(bn,"getProperty",{enumerable:!0,get:function(){return qs.getProperty}});Object.defineProperty(bn,"stringify",{enumerable:!0,get:function(){return qs.stringify}});Object.defineProperty(bn,"regexpCode",{enumerable:!0,get:function(){return qs.regexpCode}});Object.defineProperty(bn,"Name",{enumerable:!0,get:function(){return qs.Name}});var gd=vx();Object.defineProperty(bn,"Scope",{enumerable:!0,get:function(){return gd.Scope}});Object.defineProperty(bn,"ValueScope",{enumerable:!0,get:function(){return gd.ValueScope}});Object.defineProperty(bn,"ValueScopeName",{enumerable:!0,get:function(){return gd.ValueScopeName}});Object.defineProperty(bn,"varKinds",{enumerable:!0,get:function(){return gd.varKinds}});bn.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 Hs{optimizeNodes(){return this}optimizeNames(e,t){return this}}class m_ extends Hs{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?mt.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=sa(this.rhs,e,t);return this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}}class Px extends Hs{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}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=sa(this.rhs,e,t),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return hd(e,this.rhs)}}class h_ extends Px{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class g_ extends Hs{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class y_ extends Hs{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class x_ extends Hs{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class b_ extends Hs{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=sa(this.code,e,t),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}}class yd extends Hs{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let s=n[r];if(s.optimizeNames(e,t))continue;xq(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Wo(e,t.names),{})}}class Ws extends yd{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class $_ extends yd{}class oc extends Ws{}oc.kind="else";class ys extends Ws{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 n=t.optimizeNodes();t=this.else=Array.isArray(n)?new oc(n):n}if(t){if(e===!1)return t instanceof ys?t:t.nodes;if(this.nodes.length)return this;return new ys(j_(e),t instanceof ys?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=sa(this.condition,e,t),this}get names(){let e=super.names;if(hd(e,this.condition),this.else)Wo(e,this.else.names);return e}}ys.kind="if";class ra extends Ws{}ra.kind="for";class S_ extends ra{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=sa(this.iteration,e,t),this}get names(){return Wo(super.names,this.iteration.names)}}class w_ extends ra{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?mt.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=hd(super.names,this.from);return hd(e,this.to)}}class Ex extends ra{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}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=sa(this.iterable,e,t),this}get names(){return Wo(super.names,this.iterable.names)}}class fd extends Ws{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}fd.kind="func";class dd extends yd{render(e){return"return "+super.render(e)}}dd.kind="return";class v_ extends Ws{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 n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Wo(e,this.catch.names);if(this.finally)Wo(e,this.finally.names);return e}}class pd extends Ws{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}pd.kind="catch";class md extends Ws{render(e){return"finally"+super.render(e)}}md.kind="finally";class E_{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
630
|
+
`:""},this._extScope=e,this._scope=new mt.Scope({parent:e}),this._nodes=[new $_]}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 n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,r){let s=this._scope.toName(t);if(n!==void 0&&r)this._constants[s.str]=n;return this._leafNode(new m_(e,s,n)),s}const(e,t,n){return this._def(mt.varKinds.const,e,t,n)}let(e,t,n){return this._def(mt.varKinds.let,e,t,n)}var(e,t,n){return this._def(mt.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new Px(e,t,n))}add(e,t){return this._leafNode(new h_(e,bn.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==Z.nil)this._leafNode(new b_(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),Z.addCodeArg(t,r)}return t.push("}"),new Z._Code(t)}if(e,t,n){if(this._blockNode(new ys(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ys(e))}else(){return this._elseNode(new oc)}endIf(){return this._endBlockNode(ys,oc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new S_(e),t)}forRange(e,t,n,r,s=this.opts.es5?mt.varKinds.var:mt.varKinds.let){let o=this._scope.toName(e);return this._for(new w_(s,o,t,n),()=>r(o))}forOf(e,t,n,r=mt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof Z.Name?t:this.var("_arr",t);return this.forRange("_i",0,Z._`${o}.length`,(i)=>{this.var(s,Z._`${o}[${i}]`),n(s)})}return this._for(new Ex("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?mt.varKinds.var:mt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,Z._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new Ex("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(ra)}label(e){return this._leafNode(new g_(e))}break(e){return this._leafNode(new y_(e))}return(e){let t=new dd;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(dd)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new v_;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new pd(s),t(s)}if(n)this._currNode=r.finally=new md,this.code(n);return this._endBlockNode(pd,md)}throw(e){return this._leafNode(new x_(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 n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=Z.nil,n,r){if(this._blockNode(new fd(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(fd)}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 n=this._currNode;if(n instanceof e||t&&n 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 ys))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}}bn.CodeGen=E_;function Wo(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function hd(e,t){return t instanceof Z._CodeOrName?Wo(e,t.names):e}function sa(e,t,n){if(e instanceof Z.Name)return r(e);if(!s(e))return e;return new Z._Code(e._items.reduce((o,i)=>{if(i instanceof Z.Name)i=r(i);if(i instanceof Z._Code)o.push(...i._items);else o.push(i);return o},[]));function r(o){let i=n[o.str];if(i===void 0||t[o.str]!==1)return o;return delete t[o.str],i}function s(o){return o instanceof Z._Code&&o._items.some((i)=>i instanceof Z.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function xq(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j_(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:Z._`!${jx(e)}`}bn.not=j_;var bq=P_(bn.operators.AND);function $q(...e){return e.reduce(bq)}bn.and=$q;var Sq=P_(bn.operators.OR);function wq(...e){return e.reduce(Sq)}bn.or=wq;function P_(e){return(t,n)=>t===Z.nil?n:n===Z.nil?t:Z._`${jx(t)} ${e} ${jx(n)}`}function jx(e){return e instanceof Z.Name?e:Z._`(${e})`}});var Oe=W(function(M_){Object.defineProperty(M_,"__esModule",{value:!0});M_.checkStrictMode=M_.getErrorPath=M_.Type=M_.useFunc=M_.setEvaluated=M_.evaluatedPropsToName=M_.mergeEvaluated=M_.eachItem=M_.unescapeJsonPointer=M_.escapeJsonPointer=M_.escapeFragment=M_.unescapeFragment=M_.schemaRefOrVal=M_.schemaHasRulesButRef=M_.schemaHasRules=M_.checkUnknownRules=M_.alwaysValidSchema=M_.toHash=void 0;var de=$e(),A_=sc();function Pq(e){let t={};for(let n of e)t[n]=!0;return t}M_.toHash=Pq;function _q(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return C_(e,t),!R_(t,e.self.RULES.all)}M_.alwaysValidSchema=_q;function C_(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let s=r.RULES.keywords;for(let o in t)if(!s[o])J_(e,`unknown keyword: "${o}"`)}M_.checkUnknownRules=C_;function R_(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}M_.schemaHasRules=R_;function kq(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}M_.schemaHasRulesButRef=kq;function Oq({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return de._`${n}`}return de._`${e}${t}${de.getProperty(r)}`}M_.schemaRefOrVal=Oq;function Aq(e){return N_(decodeURIComponent(e))}M_.unescapeFragment=Aq;function Cq(e){return encodeURIComponent(kx(e))}M_.escapeFragment=Cq;function kx(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}M_.escapeJsonPointer=kx;function N_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}M_.unescapeJsonPointer=N_;function Rq(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}M_.eachItem=Rq;function k_({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let l=i===void 0?o:i instanceof de.Name?(o instanceof de.Name?e(s,o,i):t(s,o,i),i):o instanceof de.Name?(t(s,i,o),o):n(o,i);return a===de.Name&&!(l instanceof de.Name)?r(s,l):l}}M_.mergeEvaluated={props:k_({mergeNames:(e,t,n)=>e.if(de._`${n} !== true && ${t} !== undefined`,()=>{e.if(de._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,de._`${n} || {}`).code(de._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(de._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,de._`${n} || {}`),Ox(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:T_}),items:k_({mergeNames:(e,t,n)=>e.if(de._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,de._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(de._`${n} !== true`,()=>e.assign(n,t===!0?!0:de._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function T_(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",de._`{}`);if(t!==void 0)Ox(e,n,t);return n}M_.evaluatedPropsToName=T_;function Ox(e,t,n){Object.keys(n).forEach((r)=>e.assign(de._`${t}${de.getProperty(r)}`,!0))}M_.setEvaluated=Ox;var O_={};function Nq(e,t){return e.scopeValue("func",{ref:t,code:O_[t.code]||(O_[t.code]=new A_._Code(t.code))})}M_.useFunc=Nq;var _x;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(_x||(M_.Type=_x={}));function Tq(e,t,n){if(e instanceof de.Name){let r=t===_x.Num;return n?r?de._`"[" + ${e} + "]"`:de._`"['" + ${e} + "']"`:r?de._`"/" + ${e}`:de._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?de.getProperty(e).toString():"/"+kx(e)}M_.getErrorPath=Tq;function J_(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}M_.checkStrictMode=J_});var Kn=W(function(D_){Object.defineProperty(D_,"__esModule",{value:!0});var Ve=$e(),Zq={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")};D_.default=Zq});var ic=W(function(q_){Object.defineProperty(q_,"__esModule",{value:!0});q_.extendErrors=q_.resetErrorsCount=q_.reportExtraError=q_.reportError=q_.keyword$DataError=q_.keywordError=void 0;var ee=$e(),Bs=Oe(),an=Kn();q_.keywordError={message:({keyword:e})=>ee.str`must pass "${e}" keyword validation`};q_.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ee.str`"${e}" keyword must be ${t} ($data)`:ee.str`"${e}" keyword is invalid ($data)`};function eH(e,t=q_.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,l=V_(e,t,n);if(r!==null&&r!==void 0?r:i||a)L_(o,l);else F_(s,ee._`[${l}]`)}q_.reportError=eH;function tH(e,t=q_.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=V_(e,t,n);if(L_(s,a),!(o||i))F_(r,an.default.vErrors)}q_.reportExtraError=tH;function nH(e,t){e.assign(an.default.errors,t),e.if(ee._`${an.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ee._`${an.default.vErrors}.length`,t),()=>e.assign(an.default.vErrors,null)))}q_.resetErrorsCount=nH;function rH({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:o}){if(s===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",s,an.default.errors,(a)=>{if(e.const(i,ee._`${an.default.vErrors}[${a}]`),e.if(ee._`${i}.instancePath === undefined`,()=>e.assign(ee._`${i}.instancePath`,ee.strConcat(an.default.instancePath,o.errorPath))),e.assign(ee._`${i}.schemaPath`,ee.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(ee._`${i}.schema`,n),e.assign(ee._`${i}.data`,r)})}q_.extendErrors=rH;function L_(e,t){let n=e.const("err",t);e.if(ee._`${an.default.vErrors} === null`,()=>e.assign(an.default.vErrors,ee._`[${n}]`),ee._`${an.default.vErrors}.push(${n})`),e.code(ee._`${an.default.errors}++`)}function F_(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(ee._`new ${e.ValidationError}(${t})`);else n.assign(ee._`${r}.errors`,t),n.return(!1)}var Bo={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function V_(e,t,n){let{createErrors:r}=e.it;if(r===!1)return ee._`{}`;return sH(e,t,n)}function sH(e,t,n={}){let{gen:r,it:s}=e,o=[oH(s,n),iH(e,n)];return aH(e,t,o),r.object(...o)}function oH({errorPath:e},{instancePath:t}){let n=t?ee.str`${e}${Bs.getErrorPath(t,Bs.Type.Str)}`:e;return[an.default.instancePath,ee.strConcat(an.default.instancePath,n)]}function iH({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:ee.str`${t}/${e}`;if(n)s=ee.str`${s}${Bs.getErrorPath(n,Bs.Type.Str)}`;return[Bo.schemaPath,s]}function aH(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=a;if(r.push([Bo.keyword,s],[Bo.params,typeof t=="function"?t(e):t||ee._`{}`]),l.messages)r.push([Bo.message,typeof n=="function"?n(e):n]);if(l.verbose)r.push([Bo.schema,i],[Bo.parentSchema,ee._`${u}${d}`],[an.default.data,o]);if(c)r.push([Bo.propertyName,c])}});var G_=W(function(z_){Object.defineProperty(z_,"__esModule",{value:!0});z_.boolOrEmptySchema=z_.topBoolOrEmptySchema=void 0;var W_=ic(),B_=$e(),dH=Kn(),pH={message:"boolean schema is false"};function mH(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)U_(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(dH.default.data);else t.assign(B_._`${r}.errors`,null),t.return(!0)}z_.topBoolOrEmptySchema=mH;function hH(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),U_(e);else n.var(t,!0)}z_.boolOrEmptySchema=hH;function U_(e,t){let{gen:n,data:r}=e;W_.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},pH,void 0,t)}});var Cx=W(function(X_){Object.defineProperty(X_,"__esModule",{value:!0});X_.getRules=X_.isJSONType=void 0;var yH=["string","number","integer","boolean","null","object","array"],xH=new Set(yH);function bH(e){return typeof e=="string"&&xH.has(e)}X_.isJSONType=bH;function $H(){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:{}}}X_.getRules=$H});var Rx=W(function(ek){Object.defineProperty(ek,"__esModule",{value:!0});ek.shouldUseRule=ek.shouldUseGroup=ek.schemaHasRulesForType=void 0;function wH({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&Z_(e,r)}ek.schemaHasRulesForType=wH;function Z_(e,t){return t.rules.some((n)=>Q_(e,n))}ek.shouldUseGroup=Z_;function Q_(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}ek.shouldUseRule=Q_});var ac=W(function(ak){Object.defineProperty(ak,"__esModule",{value:!0});ak.reportTypeError=ak.checkDataTypes=ak.checkDataType=ak.coerceAndCheckDataType=ak.getJSONTypes=ak.getSchemaTypes=ak.DataType=void 0;var nk=Cx(),rk=Rx(),sk=ic(),Y=$e(),bd=Oe(),oa;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(oa||(ak.DataType=oa={}));function jH(e){let t=ok(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}ak.getSchemaTypes=jH;function ok(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(nk.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}ak.getJSONTypes=ok;function PH(e,t){let{gen:n,data:r,opts:s}=e,o=_H(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&rk.schemaHasRulesForType(e,t[0]));if(i){let a=Tx(t,r,s.strictNumbers,oa.Wrong);n.if(a,()=>{if(o.length)kH(e,t,o);else Jx(e)})}return i}ak.coerceAndCheckDataType=PH;var ik=new Set(["string","number","integer","boolean","null"]);function _H(e,t){return t?e.filter((n)=>ik.has(n)||t==="array"&&n==="array"):[]}function kH(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",Y._`typeof ${s}`),a=r.let("coerced",Y._`undefined`);if(o.coerceTypes==="array")r.if(Y._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,Y._`${s}[0]`).assign(i,Y._`typeof ${s}`).if(Tx(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(Y._`${a} !== undefined`);for(let c of n)if(ik.has(c)||c==="array"&&o.coerceTypes==="array")l(c);r.else(),Jx(e),r.endIf(),r.if(Y._`${a} !== undefined`,()=>{r.assign(s,a),OH(e,a)});function l(c){switch(c){case"string":r.elseIf(Y._`${i} == "number" || ${i} == "boolean"`).assign(a,Y._`"" + ${s}`).elseIf(Y._`${s} === null`).assign(a,Y._`""`);return;case"number":r.elseIf(Y._`${i} == "boolean" || ${s} === null
|
|
631
|
+
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,Y._`+${s}`);return;case"integer":r.elseIf(Y._`${i} === "boolean" || ${s} === null
|
|
632
|
+
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,Y._`+${s}`);return;case"boolean":r.elseIf(Y._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(Y._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":r.elseIf(Y._`${s} === "" || ${s} === 0 || ${s} === false`),r.assign(a,null);return;case"array":r.elseIf(Y._`${i} === "string" || ${i} === "number"
|
|
633
|
+
|| ${i} === "boolean" || ${s} === null`).assign(a,Y._`[${s}]`)}}}function OH({gen:e,parentData:t,parentDataProperty:n},r){e.if(Y._`${t} !== undefined`,()=>e.assign(Y._`${t}[${n}]`,r))}function Nx(e,t,n,r=oa.Correct){let s=r===oa.Correct?Y.operators.EQ:Y.operators.NEQ,o;switch(e){case"null":return Y._`${t} ${s} null`;case"array":o=Y._`Array.isArray(${t})`;break;case"object":o=Y._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(Y._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return Y._`typeof ${t} ${s} ${e}`}return r===oa.Correct?o:Y.not(o);function i(a=Y.nil){return Y.and(Y._`typeof ${t} == "number"`,a,n?Y._`isFinite(${t})`:Y.nil)}}ak.checkDataType=Nx;function Tx(e,t,n,r){if(e.length===1)return Nx(e[0],t,n,r);let s,o=bd.toHash(e);if(o.array&&o.object){let i=Y._`typeof ${t} != "object"`;s=o.null?i:Y._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=Y.nil;if(o.number)delete o.integer;for(let i in o)s=Y.and(s,Nx(i,t,n,r));return s}ak.checkDataTypes=Tx;var AH={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Y._`{type: ${e}}`:Y._`{type: ${t}}`};function Jx(e){let t=CH(e);sk.reportError(t,AH)}ak.reportTypeError=Jx;function CH(e){let{gen:t,data:n,schema:r}=e,s=bd.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var pk=W(function(fk){Object.defineProperty(fk,"__esModule",{value:!0});fk.assignDefaults=void 0;var Gn=$e(),uk=Oe();function DH(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)ck(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>ck(e,o,s.default))}fk.assignDefaults=DH;function ck(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=Gn._`${o}${Gn.getProperty(t)}`;if(s){uk.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=Gn._`${a} === undefined`;if(i.useDefaults==="empty")l=Gn._`${l} || ${a} === null || ${a} === ""`;r.if(l,Gn._`${a} = ${Gn.stringify(n)}`)}});var Xn=W(function(yk){Object.defineProperty(yk,"__esModule",{value:!0});yk.validateUnion=yk.validateArray=yk.usePattern=yk.callValidateCode=yk.schemaProperties=yk.allSchemaProperties=yk.noPropertyInData=yk.propertyInData=yk.isOwnProperty=yk.hasPropFunc=yk.reportMissingProp=yk.checkMissingProp=yk.checkReportMissingProp=void 0;var he=$e(),ia=Oe(),Us=Kn(),mk=Oe();function LH(e,t){let{gen:n,data:r,it:s}=e;n.if(Ix(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}yk.checkReportMissingProp=LH;function FH({gen:e,data:t,it:{opts:n}},r,s){return he.or(...r.map((o)=>he.and(Ix(e,t,o,n.ownProperties),he._`${s} = ${o}`)))}yk.checkMissingProp=FH;function VH(e,t){e.setParams({missingProperty:t},!0),e.error()}yk.reportMissingProp=VH;function hk(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}yk.hasPropFunc=hk;function Mx(e,t,n){return he._`${hk(e)}.call(${t}, ${n})`}yk.isOwnProperty=Mx;function qH(e,t,n,r){let s=he._`${t}${he.getProperty(n)} !== undefined`;return r?he._`${s} && ${Mx(e,t,n)}`:s}yk.propertyInData=qH;function Ix(e,t,n,r){let s=he._`${t}${he.getProperty(n)} === undefined`;return r?he.or(s,he.not(Mx(e,t,n))):s}yk.noPropertyInData=Ix;function gk(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}yk.allSchemaProperties=gk;function HH(e,t){return gk(t).filter((n)=>!ia.alwaysValidSchema(e,t[n]))}yk.schemaProperties=HH;function WH({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,l,c){let u=c?he._`${e}, ${t}, ${r}${s}`:t,d=[[Us.default.instancePath,he.strConcat(Us.default.instancePath,o)],[Us.default.parentData,i.parentData],[Us.default.parentDataProperty,i.parentDataProperty],[Us.default.rootData,Us.default.rootData]];if(i.opts.dynamicRef)d.push([Us.default.dynamicAnchors,Us.default.dynamicAnchors]);let p=he._`${u}, ${n.object(...d)}`;return l!==he.nil?he._`${a}.call(${l}, ${p})`:he._`${a}(${p})`}yk.callValidateCode=WH;var BH=he._`new RegExp`;function UH({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(n,r);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:he._`${s.code==="new RegExp"?BH:mk.useFunc(e,s)}(${n}, ${r})`})}yk.usePattern=UH;function zH(e){let{gen:t,data:n,keyword:r,it:s}=e,o=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){let l=t.const("len",he._`${n}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:r,dataProp:c,dataPropType:ia.Type.Num},o),t.if(he.not(o),a)})}}yk.validateArray=zH;function KH(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((l)=>ia.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((l,c)=>{let u=e.subschema({keyword:r,schemaProp:c,compositeRule:!0},a);if(t.assign(i,he._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}yk.validateUnion=KH});var jk=W(function(vk){Object.defineProperty(vk,"__esModule",{value:!0});vk.validateKeywordUsage=vk.validSchemaType=vk.funcKeywordCode=vk.macroKeywordCode=void 0;var He=$e(),Uo=Kn(),$k=Xn(),Sk=ic();function aW(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),l=wk(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=n.name("valid");e.subschema({schema:a,schemaPath:He.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}vk.macroKeywordCode=aW;function lW(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:l}=e;uW(l,t);let c=!a&&t.compile?t.compile.call(l.self,o,i,l):t.validate,u=wk(r,s,c),d=r.let("valid");e.block$data(d,p),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function p(){if(t.errors===!1){if(S(),t.modifying)bk(e);g(()=>e.error())}else{let x=t.async?m():y();if(t.modifying)bk(e);g(()=>cW(e,x))}}function m(){let x=r.let("ruleErrs",null);return r.try(()=>S(He._`await `),(P)=>r.assign(d,!1).if(He._`${P} instanceof ${l.ValidationError}`,()=>r.assign(x,He._`${P}.errors`),()=>r.throw(P))),x}function y(){let x=He._`${u}.errors`;return r.assign(x,null),S(He.nil),x}function S(x=t.async?He._`await `:He.nil){let P=l.opts.passContext?Uo.default.this:Uo.default.self,w=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,He._`${x}${$k.callValidateCode(e,u,P,w)}`,t.modifying)}function g(x){var P;r.if(He.not((P=t.valid)!==null&&P!==void 0?P:d),x)}}vk.funcKeywordCode=lW;function bk(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,He._`${r.parentData}[${r.parentDataProperty}]`))}function cW(e,t){let{gen:n}=e;n.if(He._`Array.isArray(${t})`,()=>{n.assign(Uo.default.vErrors,He._`${Uo.default.vErrors} === null ? ${t} : ${Uo.default.vErrors}.concat(${t})`).assign(Uo.default.errors,He._`${Uo.default.vErrors}.length`),Sk.extendErrors(e)},()=>e.error())}function uW({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function wk(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:He.stringify(n)})}function fW(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}vk.validSchemaType=fW;function dW({schema:e,opts:t,self:n,errSchemaPath:r},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw Error("ajv implementation error");let i=s.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[o])){let l=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(l);else throw Error(l)}}}vk.validateKeywordUsage=dW});var kk=W(function(Pk){Object.defineProperty(Pk,"__esModule",{value:!0});Pk.extendSubschemaMode=Pk.extendSubschemaData=Pk.getSubschema=void 0;var Rt=$e(),$d=Oe();function gW(e,{keyword:t,schemaProp:n,schema:r,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:Rt._`${e.schemaPath}${Rt.getProperty(t)}${Rt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${$d.escapeFragment(n)}`}}if(r!==void 0){if(s===void 0||o===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}Pk.getSubschema=gW;function yW(e,t,{dataProp:n,dataPropType:r,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=t,p=a.let("data",Rt._`${t.data}${Rt.getProperty(n)}`,!0);l(p),e.errorPath=Rt.str`${c}${$d.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=Rt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Rt.Name?s:a.let("data",s,!0);if(l(c),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;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]}}Pk.extendSubschemaData=yW;function xW(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:s,allErrors:o}){if(r!==void 0)e.compositeRule=r;if(s!==void 0)e.createErrors=s;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=n}Pk.extendSubschemaMode=xW});var Dx=W(function(jre,Ok){Ok.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var Ck=W(function(Pre,Ak){var zs=Ak.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},s=n.post||function(){};Sd(t,r,s,e,"",e)};zs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zs.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 Sd(e,t,n,r,s,o,i,a,l,c){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,l,c);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in zs.arrayKeywords)for(var p=0;p<d.length;p++)Sd(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in zs.propsKeywords){if(d&&typeof d=="object")for(var m in d)Sd(e,t,n,d[m],s+"/"+u+"/"+SW(m),o,s,u,r,m)}else if(u in zs.keywords||e.allKeys&&!(u in zs.skipKeywords))Sd(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,l,c)}}function SW(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var lc=W(function(Mk){Object.defineProperty(Mk,"__esModule",{value:!0});Mk.getSchemaRefs=Mk.resolveUrl=Mk.normalizeId=Mk._getFullPath=Mk.getFullPath=Mk.inlineRef=void 0;var Rk=Oe(),wW=Dx(),vW=Ck(),EW=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function jW(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Lx(e);if(!t)return!1;return Nk(e)<=t}Mk.inlineRef=jW;var PW=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Lx(e){for(let t in e){if(PW.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(Lx))return!0;if(typeof n=="object"&&Lx(n))return!0}return!1}function Nk(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,EW.has(n))continue;if(typeof e[n]=="object")Rk.eachItem(e[n],(r)=>t+=Nk(r));if(t===1/0)return 1/0}return t}function Tk(e,t="",n){if(n!==!1)t=aa(t);let r=e.parse(t);return Jk(e,r)}Mk.getFullPath=Tk;function Jk(e,t){return e.serialize(t).split("#")[0]+"#"}Mk._getFullPath=Jk;var _W=/#\/?$/;function aa(e){return e?e.replace(_W,""):""}Mk.normalizeId=aa;function kW(e,t,n){return n=aa(n),e.resolve(t,n)}Mk.resolveUrl=kW;var OW=/^[a-z_][-a-z0-9._]*$/i;function AW(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=aa(e[n]||t),o={"":s},i=Tk(r,s,!1),a={},l=new Set;return vW(e,{allKeys:!0},(d,p,m,y)=>{if(y===void 0)return;let S=i+p,g=o[y];if(typeof d[n]=="string")g=x.call(this,d[n]);P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),o[p]=g;function x(w){let E=this.opts.uriResolver.resolve;if(w=aa(g?E(g,w):w),l.has(w))throw u(w);l.add(w);let j=this.refs[w];if(typeof j=="string")j=this.refs[j];if(typeof j=="object")c(d,j.schema,w);else if(w!==aa(S))if(w[0]==="#")c(d,a[w],w),a[w]=d;else this.refs[w]=S;return w}function P(w){if(typeof w=="string"){if(!OW.test(w))throw Error(`invalid anchor "${w}"`);x.call(this,`#${w}`)}}}),a;function c(d,p,m){if(p!==void 0&&!wW(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}Mk.getSchemaRefs=AW});var ua=W(function(Zk){Object.defineProperty(Zk,"__esModule",{value:!0});Zk.getData=Zk.KeywordCxt=Zk.validateFunctionCode=void 0;var vd=G_(),wd=ac(),ca=Rx(),Ks=ac(),Vk=pk(),Mr=jk(),la=kk(),F=$e(),ye=Kn(),qk=lc(),It=Oe(),Jr=ic();function MW(e){if(Bk(e)){if(Uk(e),Wk(e)){LW(e);return}}Hk(e,()=>vd.topBoolOrEmptySchema(e))}Zk.validateFunctionCode=MW;function Hk({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,F._`${ye.default.data}, ${ye.default.valCxt}`,r.$async,()=>{e.code(F._`"use strict"; ${Dk(n,s)}`),DW(e,s),e.code(o)});else e.func(t,F._`${ye.default.data}, ${IW(s)}`,r.$async,()=>e.code(Dk(n,s)).code(o))}function IW(e){return F._`{${ye.default.instancePath}="", ${ye.default.parentData}, ${ye.default.parentDataProperty}, ${ye.default.rootData}=${ye.default.data}${e.dynamicRef?F._`, ${ye.default.dynamicAnchors}={}`:F.nil}}={}`}function DW(e,t){e.if(ye.default.valCxt,()=>{if(e.var(ye.default.instancePath,F._`${ye.default.valCxt}.${ye.default.instancePath}`),e.var(ye.default.parentData,F._`${ye.default.valCxt}.${ye.default.parentData}`),e.var(ye.default.parentDataProperty,F._`${ye.default.valCxt}.${ye.default.parentDataProperty}`),e.var(ye.default.rootData,F._`${ye.default.valCxt}.${ye.default.rootData}`),t.dynamicRef)e.var(ye.default.dynamicAnchors,F._`${ye.default.valCxt}.${ye.default.dynamicAnchors}`)},()=>{if(e.var(ye.default.instancePath,F._`""`),e.var(ye.default.parentData,F._`undefined`),e.var(ye.default.parentDataProperty,F._`undefined`),e.var(ye.default.rootData,ye.default.data),t.dynamicRef)e.var(ye.default.dynamicAnchors,F._`{}`)})}function LW(e){let{schema:t,opts:n,gen:r}=e;Hk(e,()=>{if(n.$comment&&t.$comment)Kk(e);if(WW(e),r.let(ye.default.vErrors,null),r.let(ye.default.errors,0),n.unevaluated)FW(e);zk(e),zW(e)});return}function FW(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",F._`${n}.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 Dk(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?F._`/*# sourceURL=${n} */`:F.nil}function VW(e,t){if(Bk(e)){if(Uk(e),Wk(e)){qW(e,t);return}}vd.boolOrEmptySchema(e,t)}function Wk({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function Bk(e){return typeof e.schema!="boolean"}function qW(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)Kk(e);BW(e),UW(e);let o=r.const("_errs",ye.default.errors);zk(e,o),r.var(t,F._`${o} === ${ye.default.errors}`)}function Uk(e){It.checkUnknownRules(e),HW(e)}function zk(e,t){if(e.opts.jtd)return Lk(e,[],!1,t);let n=wd.getSchemaTypes(e.schema),r=wd.coerceAndCheckDataType(e,n);Lk(e,n,!r,t)}function HW(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&It.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function WW(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)It.checkStrictMode(e,"default is ignored in the schema root")}function BW(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=qk.resolveUrl(e.opts.uriResolver,e.baseId,t)}function UW(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Kk({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(F._`${ye.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=F.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(F._`${ye.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function zW(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(F._`${ye.default.errors} === 0`,()=>t.return(ye.default.data),()=>t.throw(F._`new ${s}(${ye.default.vErrors})`));else{if(t.assign(F._`${r}.errors`,ye.default.vErrors),o.unevaluated)KW(e);t.return(F._`${ye.default.errors} === 0`)}}function KW({gen:e,evaluated:t,props:n,items:r}){if(n instanceof F.Name)e.assign(F._`${t}.props`,n);if(r instanceof F.Name)e.assign(F._`${t}.items`,r)}function Lk(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!It.schemaHasRulesButRef(o,u))){s.block(()=>Xk(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)GW(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!ca.shouldUseGroup(o,p))return;if(p.type){if(s.if(Ks.checkDataType(p.type,i,l.strictNumbers)),Fk(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Ks.reportTypeError(e);s.endIf()}else Fk(e,p);if(!a)s.if(F._`${ye.default.errors} === ${r||0}`)}}function Fk(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)Vk.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(ca.shouldUseRule(r,o))Xk(e,o.keyword,o.definition,t.type)})}function GW(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(XW(e,t),!e.opts.allowUnionTypes)YW(e,t);ZW(e,e.dataTypes)}function XW(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!Gk(e.dataTypes,n))Fx(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),eB(e,t)}function YW(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Fx(e,"use allowUnionTypes to allow union type keyword")}function ZW(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&ca.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>QW(t,i)))Fx(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function QW(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Gk(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function eB(e,t){let n=[];for(let r of e.dataTypes)if(Gk(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function Fx(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,It.checkStrictMode(e,t,e.opts.strictTypes)}class Vx{constructor(e,t,n){if(Mr.validateKeywordUsage(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=It.schemaRefOrVal(e,this.schema,n,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",Yk(this.$data,e));else if(this.schemaCode=this.schemaValue,!Mr.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",ye.default.errors)}result(e,t,n){this.failResult(F.not(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();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,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?Jr.reportExtraError:Jr.reportError)(this,this.def.error,t)}$dataError(){Jr.reportError(this,this.def.$dataError||Jr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Jr.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,n=F.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=F.nil,t=F.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(F.or(F._`${r} === undefined`,t)),e!==F.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==F.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return F.or(o(),i());function o(){if(n.length){if(!(t instanceof F.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return F._`${Ks.checkDataTypes(a,t,s.opts.strictNumbers,Ks.DataType.Wrong)}`}return F.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return F._`!${a}(${t})`}return F.nil}}subschema(e,t){let n=la.getSubschema(this.it,e);la.extendSubschemaData(n,this.it,e),la.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return VW(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=It.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=It.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,F.Name)),!0}}Zk.KeywordCxt=Vx;function Xk(e,t,n,r){let s=new Vx(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)Mr.funcKeywordCode(s,n);else if("macro"in n)Mr.macroKeywordCode(s,n);else if(n.compile||n.validate)Mr.funcKeywordCode(s,n)}var tB=/^\/(?:[^~]|~0|~1)*$/,nB=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yk(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return ye.default.rootData;if(e[0]==="/"){if(!tB.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=ye.default.rootData}else{let c=nB.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 r[t-u]}if(u>t)throw Error(l("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let c of a)if(c)o=F._`${o}${F.getProperty(It.unescapeJsonPointer(c))}`,i=F._`${i} && ${o}`;return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}Zk.getData=Yk});var cc=W(function(tO){Object.defineProperty(tO,"__esModule",{value:!0});class eO extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}tO.default=eO});var da=W(function(rO){Object.defineProperty(rO,"__esModule",{value:!0});var fa=lc();class nO extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=fa.resolveUrl(e,t,n),this.missingSchema=fa.normalizeId(fa.getFullPath(e,this.missingRef))}}rO.default=nO});var fc=W(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});iO.resolveSchema=iO.getCompilingSchema=iO.resolveRef=iO.compileSchema=iO.SchemaEnv=void 0;var ht=$e(),aB=cc(),zo=Kn(),gt=lc(),Ed=Oe(),sO=ua();class uc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=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(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}iO.SchemaEnv=uc;function Hx(e){let t=oO.call(this,e);if(t)return t;let n=gt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new ht.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:aB.default,code:ht._`require("ajv/dist/runtime/validation_error").default`});let l=i.scopeName("validate");e.validateName=l;let c={gen:i,allErrors:this.opts.allErrors,data:zo.default.data,parentData:zo.default.parentData,parentDataProperty:zo.default.parentDataProperty,dataNames:[zo.default.data],dataPathArr:[ht.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.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:n,baseId:e.baseId||n,schemaPath:ht.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ht._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),sO.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(zo.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${zo.default.self}`,`${zo.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:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:y,items:S}=c;if(m.evaluated={props:y instanceof ht.Name?void 0:y,items:S instanceof ht.Name?void 0:S,dynamicProps:y instanceof ht.Name,dynamicItems:S instanceof ht.Name},m.source)m.source.evaluated=ht.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw d}finally{this._compilations.delete(e)}}iO.compileSchema=Hx;function lB(e,t,n){var r;n=gt.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=fB.call(this,e,n);if(o===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)o=new uc({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=cB.call(this,o)}iO.resolveRef=lB;function cB(e){if(gt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Hx.call(this,e)}function oO(e){for(let t of this._compilations)if(uB(t,e))return t}iO.getCompilingSchema=oO;function uB(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function fB(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||jd.call(this,e,t)}function jd(e,t){let n=this.opts.uriResolver.parse(t),r=gt._getFullPath(this.opts.uriResolver,n),s=gt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return qx.call(this,n,e);let o=gt.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=jd.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return qx.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Hx.call(this,i);if(o===gt.normalizeId(t)){let{schema:a}=i,{schemaId:l}=this.opts,c=a[l];if(c)s=gt.resolveUrl(this.opts.uriResolver,s,c);return new uc({schema:a,schemaId:l,root:e,baseId:s})}return qx.call(this,n,i)}iO.resolveSchema=jd;var dB=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function qx(e,{baseId:t,schema:n,root:r}){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 n==="boolean")return;let l=n[Ed.unescapeFragment(a)];if(l===void 0)return;n=l;let c=typeof n==="object"&&n[this.opts.schemaId];if(!dB.has(a)&&c)t=gt.resolveUrl(this.opts.uriResolver,t,c)}let o;if(typeof n!="boolean"&&n.$ref&&!Ed.schemaHasRulesButRef(n,this.RULES)){let a=gt.resolveUrl(this.opts.uriResolver,t,n.$ref);o=jd.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new uc({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var lO=W(function(Rre,yB){yB.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 Gx=W(function(Nre,gO){var xB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Bx=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),bB=RegExp.prototype.test.bind(/^\d*$/u),Ko=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Ux=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),uO=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),zx=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),$B=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),$n=Array(256);for(let t=0;t<256;t++)$n[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Yt(e){if(e<2048)return $n[192|e>>6]+$n[128|e&63];if(e<65536)return $n[224|e>>12]+$n[128|e>>6&63]+$n[128|e&63];return $n[240|e>>18]+$n[128|e>>12&63]+$n[128|e>>6&63]+$n[128|e&63]}function SB(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var wB=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),vB=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),EB=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),jB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function PB(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(EB(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Ko(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function cO(e){let t=-1,n=0,r=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(r===-1)r=a;if(s++,s>n)n=s,t=r}else r=-1,s=0;if(n<2)return e.join(":");let o=e.slice(0,t).join(":"),i=e.slice(t+n).join(":");return o+"::"+i}function _B(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let n=t===-1?e.split(":"):e.slice(0,t).split(":"),r=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(n.length===1&&n[0]==="")n.length=0;if(r.length===1&&r[0]==="")r.length=0}let s=n.concat(r),o=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&&r.length===0||!Bx(l))return;o+=2;continue}if(!wB(l))return;s[a]=parseInt(l,16).toString(16),o++}if(t===-1){if(o!==8)return;return cO(s)}if(o>=8)return;let i=s.slice(0,n.length);for(let a=o;a<8;a++)i.push("0");for(let a=n.length;a<s.length;a++)i.push(s[a]);return cO(i)}function Wx(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 r=t?e.slice(1,-1):e;if(t&&vB(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(kB(r,":")<2)return{host:e,isIPV6:!1,error:t};let s="",o=r.indexOf("%");if(o!==-1){let a=r.slice(o,o+3).toLowerCase()==="%25"?3:1;if(s=r.slice(o+a),!PB(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=_B(r);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(s?"%"+s:""),escapedHost:i+(s?"%25"+s:""),isIPV6:!0}}function kB(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function fO(e){let t=e,n=[],r=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.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]==="/"){n.push("/");break}}}else if(s===3){if(t==="/.."){if(n.length!==0)n.pop();n.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),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}function OB(e){if(e===""||e[0]==="/")return fO(e);let t=e.split("/"),n=t.length-1,r=[],s=!1;for(let o=0;o<=n;o++){let i=t[o];if(i==="."||i===".."){if(i==="..")if(r.length!==0&&r[r.length-1]!=="..")r.pop();else r.push("..");s=o===n}else r.push(i)}if(s&&r[r.length-1]!=="..")r.push("");if(r.length===0||r[0]===""||r[0].includes(":"))r.unshift(".");return r.join("/")}var AB={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},CB=/[@/?#:]/g,RB=/[@/?#]/g;function dO(e,t){let n=t?RB:CB;return n.lastIndex=0,e.replace(n,(r)=>AB[r])}function pO(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&Ux(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function NB(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&Ux(i))t+=i;else t+="%"+o;n+=2;continue}}if(uO(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=hO(s)?r:$n[s];else if(s<55296||s>57343)t+=Yt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Yt(65536+(s-55296<<10)+(o-56320)),n++;else t+=Yt(65533)}else t+=Yt(65533)}}return t}function TB(e,t=!1){let n="",r=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let o=e[s];if(o==="%"&&s+2<e.length){let i=e.slice(s+1,s+3);if(Ko(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(uO(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=$n[i];else if(i<55296||i>57343)n+=Yt(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=Yt(65536+(i-55296<<10)+(a-56320)),s++;else n+=Yt(65533)}else n+=Yt(65533)}}return n}function Kx(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Ko(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=$n[o];else if(o<55296||o>57343)n+=Yt(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=Yt(65536+(o-55296<<10)+(i-56320)),r++;else n+=Yt(65533)}else n+=Yt(65533)}}return n}function mO(e){return Kx(e,$B)}function JB(e){return Kx(e,zx)}function MB(e){return Kx(e,zx)}function hO(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 IB(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Ko(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(Ux(i))t+=i;else t+="%"+o;n+=2;continue}}if(zx(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=hO(s)?r:$n[s];else if(s<55296||s>57343)t+=Yt(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=Yt(65536+(s-55296<<10)+(o-56320)),n++;else t+=Yt(65533)}else t+=Yt(65533)}}return t}function DB(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(Ko(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function LB(e){let t=[];if(e.userinfo!==void 0)t.push(mO(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!Bx(n)){let r=Wx(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=pO(n,!0),r=Wx(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=dO(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!bB(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}gO.exports={nonSimpleDomain:jB,recomposeAuthority:LB,reescapeHostDelimiters:dO,normalizePercentEncoding:pO,normalizePathEncoding:NB,serializePathEncoding:TB,normalizeQueryFragmentEncoding:IB,encodeUserinfo:mO,encodeQuery:JB,encodeFragment:MB,escapePreservingEscapes:DB,removeDotSegments:fO,removeDotSegmentsRelative:OB,isIPv4:Bx,isUUID:xB,normalizeIPv6:Wx,stringArrayToHexStripped:SB}});var SO=W(function(Tre,$O){var{isUUID:FB}=Gx(),VB=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,qB=["http","https","ws","wss","urn","urn:uuid"];function HB(e){return qB.indexOf(e)!==-1}function Xx(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 yO(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function xO(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 WB(e){return e.secure=Xx(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function BB(e){if(e.port===(Xx(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("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function UB(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(VB);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let s=`${r}:${t.nid||e.nid}`,o=Yx(s);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function zB(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),s=`${n}:${t.nid||r}`,o=Yx(s);if(o)e=o.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function KB(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!FB(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function GB(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var bO={scheme:"http",domainHost:!0,parse:yO,serialize:xO},XB={scheme:"https",domainHost:bO.domainHost,parse:yO,serialize:xO},Pd={scheme:"ws",domainHost:!0,parse:WB,serialize:BB},YB={scheme:"wss",domainHost:Pd.domainHost,parse:Pd.parse,serialize:Pd.serialize},ZB={scheme:"urn",parse:UB,serialize:zB,skipNormalize:!0},QB={scheme:"urn:uuid",parse:KB,serialize:GB,skipNormalize:!0},_d={http:bO,https:XB,ws:Pd,wss:YB,urn:ZB,"urn:uuid":QB};Object.setPrototypeOf(_d,null);function Yx(e){return e&&(_d[e]||_d[e.toLowerCase()])||void 0}$O.exports={wsIsSecure:Xx,SCHEMES:_d,isValidSchemeName:HB,getSchemeHandler:Yx}});var JO=W(function(Jre,Cd){var{normalizeIPv6:PO,removeDotSegments:pc,removeDotSegmentsRelative:_O,recomposeAuthority:eU,normalizePercentEncoding:Zx,normalizePathEncoding:tU,serializePathEncoding:wO,normalizeQueryFragmentEncoding:vO,encodeQuery:nU,encodeFragment:rU,reescapeHostDelimiters:sU,isIPv4:kO,nonSimpleDomain:oU}=Gx(),{SCHEMES:OO,getSchemeHandler:Qx}=SO(),AO=/^[A-Za-z][A-Za-z0-9+.-]*$/u,iU=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function EO(e){let t=String(e);if(!AO.test(t))throw TypeError("URI scheme is malformed.");return t}function aU(e,t){if(typeof e==="string")e=gU(e,t);else if(typeof e==="object")e=Od(Go(e,t),t);return e}function lU(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=kd(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:y,malformedScheme:S}=kd(t,r);if(o||d||i||p||a||m||l||y||c||S)throw Error(s.error||u.error||"URI is malformed.");let g=CO(s,u,r,!0),x=Qx(n&&n.scheme||g.scheme),P=g.host,w=P!==void 0&&P!==""&&(kO(P)||PO(P).isIPV6);if(NO(g,n||{},x,w))throw Error("URI host is malformed.");RO(g,n||{},x,w);let E=P&&P.indexOf("%")!==-1&&!/\P{ASCII}/u.test(P);if(g.error&&!E)throw Error(g.error);return r.skipEscape=!0,Go(g,r)}function CO(e,t,n,r){let s={};if(!r)e=Od(Go(e,n),n),t=Od(Go(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=pc(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=pc(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=pc(t.path);else{let o=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(o&&!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&&!o&&s.path[0]!=="/"?_O(s.path):pc(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 cU(e,t,n){let r=jO(e,n),s=jO(t,n);return r!==void 0&&s!==void 0&&r===s}function Go(e,t){let n={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:""},r=Object.assign({},t),s=[];if(n.scheme)n.scheme=EO(n.scheme);let o=Qx(r.scheme||n.scheme);if(o&&o.serialize)o.serialize(n,r);let i=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,a=(n.scheme===void 0||r.reference==="suffix")&&!i,l=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=wO(n.path,l);else n.path=Zx(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=EO(n.scheme),s.push(n.scheme,":");let c=eU(n);if(c!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(c),n.path&&n.path[0]!=="/")s.push("/")}if(n.path!==void 0){let u=n.path;if(!r.absolutePath&&(!o||!o.absolutePath))u=a&&u[0]!=="/"?_O(u):pc(u);if(a)u=wO(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",nU(n.query));if(n.fragment!==void 0)s.push("#",rU(n.fragment));return s.join("")}var uU=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,fU=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,dU=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function pU(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 dc(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 Ad(e){return e[0]==="["&&e[e.length-1]==="]"}function mU(e){let t=e[4];return dc(e[3])||t!==void 0&&!Ad(t)&&dc(t)||dc(e[6])||dc(e[7])||dc(e[8])}function RO(e,t,n,r){if(NO(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!Ad(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&oU(e.host)){let s;try{s=new URL("http://"+e.host)}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!hU(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function NO(e,t,n,r){return Boolean(e.host&&r===!1&&!Ad(e.host)&&(t.domainHost||n&&n.domainHost)&&iU.test(e.host))}function hU(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function kd(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,o=!1,i=!1,a=!1,l=!1,c=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(fU);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(dU);if(p!==null){let y=p[1],S=y.replace(/[\t\n\r]/g,"");if(S.length>=2){if(S.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(y.length!==S.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(uU);if(m){if(r.scheme=m[1],r.userinfo=m[3],r.host=m[4],r.port=parseInt(m[5],10),r.path=m[6]||"",r.query=m[7],r.fragment=m[8],r.scheme!==void 0)if(AO.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",c=!0;if(o=mU(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let y=pU(r,m);if(y!==void 0)r.error=r.error||y,s=!0;if(r.host)if(kO(r.host)===!1){let x=Ad(r.host),P=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,w=PO(r.host);if(u=w.isIPV6||w.isIPVFuture===!0,l=P&&(!x||w.error===!0),r.host=u?w.host:w.host.toLowerCase(),l)r.error=r.error||"URI host is malformed.",s=!0}else u=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let S=Qx(n.scheme||r.scheme);if(!l)a=RO(r,n,S,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!l){let g=u?r.host:Zx(r.host,!0);if(!u)g=Zx(g.toLowerCase());r.host=u||n.scheme!=="null"?sU(g,u):g}if(!S||S&&!S.skipNormalize){if(r.path)r.path=tU(r.path);if(r.query)r.query=vO(r.query);if(r.fragment)r.fragment=vO(r.fragment)}if(S&&S.parse){if(S.parse(r,n),S===OO.urn&&r.nid===void 0)i=!0}}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}}function Od(e,t){return kd(e,t).parsed}function gU(e,t){return TO(e,t).normalized}function TO(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=kd(e,t);return{normalized:r||s||o||i||a?e:Go(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function jO(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Go(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}=TO(n,t);return s||o||i||a||l?void 0:r}var eb={SCHEMES:OO,normalize:aU,resolve:lU,resolveComponent:CO,equal:cU,serialize:Go,parse:Od};Cd.exports=eb;Cd.exports.default=eb;Cd.exports.fastUri=eb});var DO=W(function(IO){Object.defineProperty(IO,"__esModule",{value:!0});var MO=JO();MO.code='require("ajv/dist/runtime/uri").default';IO.default=MO});var nb=W(function(xs){Object.defineProperty(xs,"__esModule",{value:!0});xs.CodeGen=xs.Name=xs.nil=xs.stringify=xs.str=xs._=xs.KeywordCxt=void 0;var xU=ua();Object.defineProperty(xs,"KeywordCxt",{enumerable:!0,get:function(){return xU.KeywordCxt}});var ma=$e();Object.defineProperty(xs,"_",{enumerable:!0,get:function(){return ma._}});Object.defineProperty(xs,"str",{enumerable:!0,get:function(){return ma.str}});Object.defineProperty(xs,"stringify",{enumerable:!0,get:function(){return ma.stringify}});Object.defineProperty(xs,"nil",{enumerable:!0,get:function(){return ma.nil}});Object.defineProperty(xs,"Name",{enumerable:!0,get:function(){return ma.Name}});Object.defineProperty(xs,"CodeGen",{enumerable:!0,get:function(){return ma.CodeGen}});var bU=cc(),HO=da(),WO=Cx(),Ir=fc(),BO=$e(),Dr=lc(),Gs=ac(),pa=Oe(),LO=lO(),$U=DO(),UO=(e,t)=>new RegExp(e,t);UO.code="new RegExp";var SU=["removeAdditional","useDefaults","coerceTypes"],wU=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),vU={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."},EU={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},FO=200;function jU(e){var t,n,r,s,o,i,a,l,c,u,d,p,m,y,S,g,x,P,w,E,j,A,T,I,V;let H=e.strict,O=(t=e.code)===null||t===void 0?void 0:t.optimize,N=O===!0||O===void 0?1:O||0,G=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:UO,Q=(s=e.uriResolver)!==null&&s!==void 0?s:$U.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:H)!==null&&i!==void 0?i:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:H)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:H)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:H)!==null&&p!==void 0?p:"log",strictRequired:(y=(m=e.strictRequired)!==null&&m!==void 0?m:H)!==null&&y!==void 0?y:!1,code:e.code?{...e.code,optimize:N,regExp:G}:{optimize:N,regExp:G},loopRequired:(S=e.loopRequired)!==null&&S!==void 0?S:FO,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:FO,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(j=e.addUsedSchema)!==null&&j!==void 0?j:!0,validateSchema:(A=e.validateSchema)!==null&&A!==void 0?A:!0,validateFormats:(T=e.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(I=e.unicodeRegExp)!==null&&I!==void 0?I:!0,int32range:(V=e.int32range)!==null&&V!==void 0?V:!0,uriResolver:Q}}class Rd{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,...jU(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new BO.ValueScope({scope:{},prefixes:wU,es5:t,lines:n}),this.logger=CU(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=WO.getRules(),VO.call(this,vU,e,"NOT SUPPORTED"),VO.call(this,EU,e,"DEPRECATED","warn"),this._metaOpts=OU.call(this),e.formats)_U.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)kU.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);PU.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=LO;if(n==="id")r={...LO},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!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 n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(c,u){await s.call(this,c.$schema);let d=this._addSchema(c,u);return d.validate||o.call(this,d)}async function s(c){if(c&&!this.getSchema(c))await r.call(this,{$ref:c},!0)}async function o(c){try{return this._compileSchemaEnv(c)}catch(u){if(!(u instanceof HO.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,c)}}function i({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]=n(c))}finally{delete this._loading[c]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,r);return this}let s;if(typeof e==="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw Error(`schema ${o} must be string`)}return t=Dr.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return r}getSchema(e){let t;while(typeof(t=qO.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new Ir.SchemaEnv({schema:{},schemaId:n});if(t=Ir.resolveSchema.call(this,r,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=qO.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 n=e[this.opts.schemaId];if(n)n=Dr.normalizeId(n),delete this.schemas[n],delete this.refs[n];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 n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(NU.call(this,n,t),!t)return pa.eachItem(n,(s)=>tb.call(this,s)),this;JU.call(this,t);let r={...t,type:Gs.getJSONTypes(t.type),schemaType:Gs.getJSONTypes(t.schemaType)};return pa.eachItem(n,r.type.length===0?(s)=>tb.call(this,s,r):(s)=>r.type.forEach((o)=>tb.call(this,s,r,o))),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 n of t.rules){let r=n.rules.findIndex((s)=>s.keyword===e);if(r>=0)n.rules.splice(r,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:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,s)=>r+t+s)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let s=r.split("/").slice(1),o=e;for(let i of s)o=o[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:l}=a.definition,c=o[i];if(l&&c)o[i]=zO(c)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:i}=this.opts;if(typeof e=="object")o=e[i];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;n=Dr.normalizeId(o||n);let l=Dr.getSchemaRefs.call(this,e,n);if(a=new Ir.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:l}),this._cache.set(a.schema,a),s&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)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 Ir.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{Ir.compileSchema.call(this,e)}finally{this.opts=t}}}Rd.ValidationError=bU.default;Rd.MissingRefError=HO.default;xs.default=Rd;function VO(e,t,n,r="error"){for(let s in e){let o=s;if(o in t)this.logger[r](`${n}: option ${s}. ${e[o]}`)}}function qO(e){return e=Dr.normalizeId(e),this.schemas[e]||this.refs[e]}function PU(){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 _U(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function kU(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 n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function OU(){let e={...this.opts};for(let t of SU)delete e[t];return e}var AU={log(){},warn(){},error(){}};function CU(e){if(e===!1)return AU;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 RU=/^[a-z_$][a-z0-9_$:-]*$/i;function NU(e,t){let{RULES:n}=this;if(pa.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!RU.test(r))throw Error(`Keyword ${r} 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 tb(e,t,n){var r;let s=t===null||t===void 0?void 0:t.post;if(n&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:l})=>l===n);if(!i)i={type:n,rules:[]},o.rules.push(i);if(o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Gs.getJSONTypes(t.type),schemaType:Gs.getJSONTypes(t.schemaType)}};if(t.before)TU.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((l)=>this.addKeyword(l))}function TU(e,t,n){let r=e.rules.findIndex((s)=>s.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function JU(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=zO(t);e.validateSchema=this.compile(t,!0)}var MU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function zO(e){return{anyOf:[e,MU]}}});var GO=W(function(KO){Object.defineProperty(KO,"__esModule",{value:!0});var LU={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};KO.default=LU});var Md=W(function(YO){Object.defineProperty(YO,"__esModule",{value:!0});YO.callRef=YO.getValidate=void 0;var VU=da(),Td=Xn(),Ke=$e(),ha=Kn(),Jd=fc(),Xs=Oe(),qU={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:l}=r,{root:c}=o;if((n==="#"||n==="#/")&&s===c.baseId)return d();let u=Jd.resolveRef.call(l,c,s,n);if(u===void 0)throw new VU.default(r.opts.uriResolver,s,n);if(u instanceof Jd.SchemaEnv)return p(u);return m(u);function d(){if(o===c)return Nd(e,i,o,o.$async);let y=t.scopeValue("root",{ref:c});return Nd(e,Ke._`${y}.validate`,c,c.$async)}function p(y){let S=XO(e,y);Nd(e,S,y,y.$async)}function m(y){let S=t.scopeValue("schema",a.code.source===!0?{ref:y,code:Ke.stringify(y)}:{ref:y}),g=t.name("valid"),x=e.subschema({schema:y,dataTypes:[],schemaPath:Ke.nil,topSchemaRef:S,errSchemaPath:n},g);e.mergeEvaluated(x),e.ok(g)}}};function XO(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):Ke._`${n.scopeValue("wrapper",{ref:t})}.validate`}YO.getValidate=XO;function Nd(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:l}=o,c=l.passContext?ha.default.this:Ke.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let y=s.let("valid");s.try(()=>{if(s.code(Ke._`await ${Td.callValidateCode(e,t,c)}`),m(t),!i)s.assign(y,!0)},(S)=>{if(s.if(Ke._`!(${S} instanceof ${o.ValidationError})`,()=>s.throw(S)),p(S),!i)s.assign(y,!1)}),e.ok(y)}function d(){e.result(Td.callValidateCode(e,t,c),()=>m(t),()=>p(t))}function p(y){let S=Ke._`${y}.errors`;s.assign(ha.default.vErrors,Ke._`${ha.default.vErrors} === null ? ${S} : ${ha.default.vErrors}.concat(${S})`),s.assign(ha.default.errors,Ke._`${ha.default.vErrors}.length`)}function m(y){var S;if(!o.opts.unevaluated)return;let g=(S=n===null||n===void 0?void 0:n.validate)===null||S===void 0?void 0:S.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps){if(g.props!==void 0)o.props=Xs.mergeEvaluated.props(s,g.props,o.props)}else{let x=s.var("props",Ke._`${y}.evaluated.props`);o.props=Xs.mergeEvaluated.props(s,x,o.props,Ke.Name)}if(o.items!==!0)if(g&&!g.dynamicItems){if(g.items!==void 0)o.items=Xs.mergeEvaluated.items(s,g.items,o.items)}else{let x=s.var("items",Ke._`${y}.evaluated.items`);o.items=Xs.mergeEvaluated.items(s,x,o.items,Ke.Name)}}}YO.callRef=Nd;YO.default=qU});var rb=W(function(QO){Object.defineProperty(QO,"__esModule",{value:!0});var BU=GO(),UU=Md(),zU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",BU.default,UU.default];QO.default=zU});var tA=W(function(eA){Object.defineProperty(eA,"__esModule",{value:!0});var Zs=$e(),Ys=Zs.operators,Id={maximum:{okStr:"<=",ok:Ys.LTE,fail:Ys.GT},minimum:{okStr:">=",ok:Ys.GTE,fail:Ys.LT},exclusiveMaximum:{okStr:"<",ok:Ys.LT,fail:Ys.GTE},exclusiveMinimum:{okStr:">",ok:Ys.GT,fail:Ys.LTE}},GU={message:({keyword:e,schemaCode:t})=>Zs.str`must be ${Id[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Zs._`{comparison: ${Id[e].okStr}, limit: ${t}}`},XU={keyword:Object.keys(Id),type:"number",schemaType:"number",$data:!0,error:GU,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(Zs._`${n} ${Id[t].fail} ${r} || isNaN(${n})`)}};eA.default=XU});var rA=W(function(nA){Object.defineProperty(nA,"__esModule",{value:!0});var Lr=$e(),ZU={message:({schemaCode:e})=>Lr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Lr._`{multipleOf: ${e}}`},QU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ZU,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Lr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Lr._`${i} !== parseInt(${i})`;e.fail$data(Lr._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};nA.default=QU});var iA=W(function(oA){Object.defineProperty(oA,"__esModule",{value:!0});function sA(e){let t=e.length,n=0,r=0,s;while(r<t)if(n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t){if(s=e.charCodeAt(r),(s&64512)===56320)r++}return n}oA.default=sA;sA.code='require("ajv/dist/runtime/ucs2length").default'});var cA=W(function(lA){Object.defineProperty(lA,"__esModule",{value:!0});var Sn=$e(),aA=Oe(),nz=iA(),rz={message({keyword:e,schemaCode:t}){return Sn.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Sn._`{limit: ${e}}`},sz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:rz,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?Sn.operators.GT:Sn.operators.LT,i=s.opts.unicode===!1?Sn._`${n}.length`:Sn._`${aA.useFunc(e.gen,nz.default)}(${n})`;e.fail$data(Sn._`${i} ${o} ${r}`)}};lA.default=sz});var pA=W(function(dA){Object.defineProperty(dA,"__esModule",{value:!0});var uA=Xn(),fA=Oe(),Yn=$e(),iz={message:({schemaCode:e})=>Yn.str`must match pattern "${e}"`,params:({schemaCode:e})=>Yn._`{pattern: ${e}}`},az={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:iz,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:l}=i.opts.code,c=l.code==="new RegExp"?Yn._`new RegExp`:fA.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,Yn._`${c}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(Yn._`!${u}`)}else{let l=uA.usePattern(e,s);e.fail$data(Yn._`!${l}.test(${n})`)}}};dA.default=az});var hA=W(function(mA){Object.defineProperty(mA,"__esModule",{value:!0});var Fr=$e(),cz={message({keyword:e,schemaCode:t}){return Fr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Fr._`{limit: ${e}}`},uz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:cz,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?Fr.operators.GT:Fr.operators.LT;e.fail$data(Fr._`Object.keys(${n}).length ${s} ${r}`)}};mA.default=uz});var xA=W(function(yA){Object.defineProperty(yA,"__esModule",{value:!0});var Vr=Xn(),qr=$e(),gA=Oe(),dz={message:({params:{missingProperty:e}})=>qr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>qr._`{missingProperty: ${e}}`},pz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:dz,code(e){let{gen:t,schema:n,schemaCode:r,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&n.length===0)return;let l=n.length>=a.loopRequired;if(i.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:y}=e.it;for(let S of n)if((m===null||m===void 0?void 0:m[S])===void 0&&!y.has(S)){let g=i.schemaEnv.baseId+i.errSchemaPath,x=`required property "${S}" is not defined at "${g}" (strictRequired)`;gA.checkStrictMode(i,x,i.opts.strictRequired)}}function c(){if(l||o)e.block$data(qr.nil,d);else for(let m of n)Vr.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||o){let y=t.let("valid",!0);e.block$data(y,()=>p(m,y)),e.ok(y)}else t.if(Vr.checkMissingProp(e,n,m)),Vr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Vr.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,y){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(y,Vr.propertyInData(t,s,m,a.ownProperties)),t.if(qr.not(y),()=>{e.error(),t.break()})},qr.nil)}}};yA.default=pz});var $A=W(function(bA){Object.defineProperty(bA,"__esModule",{value:!0});var Hr=$e(),hz={message({keyword:e,schemaCode:t}){return Hr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Hr._`{limit: ${e}}`},gz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:hz,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?Hr.operators.GT:Hr.operators.LT;e.fail$data(Hr._`${n}.length ${s} ${r}`)}};bA.default=gz});var Dd=W(function(wA){Object.defineProperty(wA,"__esModule",{value:!0});var SA=Dx();SA.code='require("ajv/dist/runtime/equal").default';wA.default=SA});var jA=W(function(EA){Object.defineProperty(EA,"__esModule",{value:!0});var ga=ac(),Te=$e(),vA=Oe(),bz=Dd(),$z={message:({params:{i:e,j:t}})=>Te.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Te._`{i: ${e}, j: ${t}}`},Sz={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$z,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let l=t.let("valid"),c=o.items?ga.getSchemaTypes(o.items):[];e.block$data(l,u,Te._`${i} === false`),e.ok(l);function u(){let y=t.let("i",Te._`${n}.length`),S=t.let("j");e.setParams({i:y,j:S}),t.assign(l,!0),t.if(Te._`${y} > 1`,()=>(d()?p:m)(y,S))}function d(){return c.length>0&&!c.some((y)=>y==="object"||y==="array")}function p(y,S){let g=t.name("item"),x=ga.checkDataTypes(c,g,a.opts.strictNumbers,ga.DataType.Wrong),P=t.const("indices",Te._`{}`);t.for(Te._`;${y}--;`,()=>{if(t.let(g,Te._`${n}[${y}]`),t.if(x,Te._`continue`),c.length>1)t.if(Te._`typeof ${g} == "string"`,Te._`${g} += "_"`);t.if(Te._`typeof ${P}[${g}] == "number"`,()=>{t.assign(S,Te._`${P}[${g}]`),e.error(),t.assign(l,!1).break()}).code(Te._`${P}[${g}] = ${y}`)})}function m(y,S){let g=vA.useFunc(t,bz.default),x=t.name("outer");t.label(x).for(Te._`;${y}--;`,()=>t.for(Te._`${S} = ${y}; ${S}--;`,()=>t.if(Te._`${g}(${n}[${y}], ${n}[${S}])`,()=>{e.error(),t.assign(l,!1).break(x)})))}}};EA.default=Sz});var kA=W(function(_A){Object.defineProperty(_A,"__esModule",{value:!0});var ya=$e(),PA=Oe(),vz=Dd(),Ez={message:"must be equal to constant",params:({schemaCode:e})=>ya._`{allowedValue: ${e}}`},jz={keyword:"const",$data:!0,error:Ez,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(ya._`!${PA.useFunc(t,vz.default)}(${n}, ${s})`);else e.fail(ya._`${o} !== ${n}`)}};_A.default=jz});var CA=W(function(AA){Object.defineProperty(AA,"__esModule",{value:!0});var Wr=$e(),OA=Oe(),_z=Dd(),kz={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Wr._`{allowedValues: ${e}}`},Oz={keyword:"enum",schemaType:"array",$data:!0,error:kz,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e;if(!r&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=OA.useFunc(t,_z.default),u;if(a||r)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",o);u=Wr.or(...s.map((y,S)=>p(m,S)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(Wr._`${c()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,y){let S=s[y];return typeof S==="object"&&S!==null?Wr._`${c()}(${n}, ${m}[${y}])`:Wr._`${n} === ${S}`}}};AA.default=Oz});var sb=W(function(RA){Object.defineProperty(RA,"__esModule",{value:!0});var Cz=tA(),Rz=rA(),Nz=cA(),Tz=pA(),Jz=hA(),Mz=xA(),Iz=$A(),Dz=jA(),Lz=kA(),Fz=CA(),Vz=[Cz.default,Rz.default,Nz.default,Tz.default,Jz.default,Mz.default,Iz.default,Dz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Lz.default,Fz.default];RA.default=Vz});var ob=W(function(TA){Object.defineProperty(TA,"__esModule",{value:!0});TA.validateAdditionalItems=void 0;var wn=$e(),xa=Oe(),Hz={message:({params:{len:e}})=>wn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>wn._`{limit: ${e}}`},Wz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Hz,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){xa.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}NA(e,r)}};function NA(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",wn._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(wn._`${a} <= ${t.length}`);else if(typeof r=="object"&&!xa.alwaysValidSchema(i,r)){let c=n.var("valid",wn._`${a} <= ${t.length}`);n.if(wn.not(c),()=>l(c)),e.ok(c)}function l(c){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:xa.Type.Num},c),!i.allErrors)n.if(wn.not(c),()=>n.break())})}}TA.validateAdditionalItems=NA;TA.default=Wz});var ib=W(function(DA){Object.defineProperty(DA,"__esModule",{value:!0});DA.validateTuple=void 0;var Ld=$e(),Qs=Oe(),MA=Xn(),Uz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return IA(e,"additionalItems",t);if(n.items=!0,Qs.alwaysValidSchema(n,t))return;e.ok(MA.validateArray(e))}};function IA(e,t,n=e.schema){let{gen:r,parentSchema:s,data:o,keyword:i,it:a}=e;if(u(s),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=Qs.mergeEvaluated.items(r,n.length,a.items);let l=r.name("valid"),c=r.const("len",Ld._`${o}.length`);n.forEach((d,p)=>{if(Qs.alwaysValidSchema(a,d))return;r.if(Ld._`${c} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},l)),e.ok(l)});function u(d){let{opts:p,errSchemaPath:m}=a,y=n.length,S=y===d.minItems&&(y===d.maxItems||d[t]===!1);if(p.strictTuples&&!S){let g=`"${i}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Qs.checkStrictMode(a,g,p.strictTuples)}}}DA.validateTuple=IA;DA.default=Uz});var qA=W(function(VA){Object.defineProperty(VA,"__esModule",{value:!0});var FA=ib(),Kz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>FA.validateTuple(e,"items")};VA.default=Kz});var zA=W(function(UA){Object.defineProperty(UA,"__esModule",{value:!0});var Fd=$e(),HA=Oe(),WA=Xn(),BA=ob(),Xz={message:({params:{len:e}})=>Fd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Fd._`{limit: ${e}}`},Yz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Xz,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,HA.alwaysValidSchema(r,t))return;if(s)BA.validateAdditionalItems(e,s);else e.ok(WA.validateArray(e))}};UA.default=Yz});var GA=W(function(KA){Object.defineProperty(KA,"__esModule",{value:!0});var lt=$e(),eo=Oe(),Qz={message:({params:{min:e,max:t}})=>t===void 0?lt.str`must contain at least ${e} valid item(s)`:lt.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?lt._`{minContains: ${e}}`:lt._`{minContains: ${e}, maxContains: ${t}}`},e8={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Qz,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:l,maxContains:c}=r;if(o.opts.next)i=l===void 0?1:l,a=c;else i=1;let u=t.const("len",lt._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){eo.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){eo.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(eo.alwaysValidSchema(o,n)){let S=lt._`${u} >= ${i}`;if(a!==void 0)S=lt._`${S} && ${u} <= ${a}`;e.pass(S);return}o.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(lt._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let S=t.name("_valid"),g=t.let("count",0);m(S,()=>t.if(S,()=>y(g)))}function m(S,g){t.forRange("i",0,u,(x)=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:eo.Type.Num,compositeRule:!0},S),g()})}function y(S){if(t.code(lt._`${S}++`),a===void 0)t.if(lt._`${S} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(lt._`${S} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(lt._`${S} >= ${i}`,()=>t.assign(d,!0))}}};KA.default=e8});var Vd=W(function(QA){Object.defineProperty(QA,"__esModule",{value:!0});QA.validateSchemaDeps=QA.validatePropertyDeps=QA.error=void 0;var ba=$e(),XA=Oe(),Br=Xn();QA.error={message:({params:{property:e,depsCount:t,deps:n}})=>ba.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>ba._`{property: ${e},
|
|
618
634
|
missingProperty: ${r},
|
|
619
635
|
depsCount: ${t},
|
|
620
|
-
deps: ${n}}`};var cB={keyword:"dependencies",type:"object",schemaType:"object",error:OO.error,code(e){let[t,n]=lB(e);_O(e,t),kO(e,n)}};function lB({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let s=Array.isArray(e[r])?t:n;s[r]=e[r]}return[t,n]}function _O(e,t=e.schema){let{gen:n,data:r,it:s}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=Ar.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(c,()=>{for(let l of a)Ar.checkReportMissingProp(e,l)});else n.if(na._`${c} && (${Ar.checkMissingProp(e,a,o)})`),Ar.reportMissingProp(e,o),n.else()}}OO.validatePropertyDeps=_O;function kO(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(PO.alwaysValidSchema(o,t[a]))continue;n.if(Ar.propertyInData(n,r,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>n.var(i,!0)),e.ok(i)}}OO.validateSchemaDeps=kO;OO.default=cB});var TO=q(function(NO){Object.defineProperty(NO,"__esModule",{value:!0});var ed=ye(),RO=_e(),dB={message:"property name must be valid",params:({params:e})=>ed._`{propertyName: ${e.propertyName}}`},pB={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dB,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(RO.alwaysValidSchema(s,n))return;let o=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if(ed.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};NO.default=pB});var rx=q(function(JO){Object.defineProperty(JO,"__esModule",{value:!0});var Us=Dn(),ut=ye(),hB=Jn(),Bs=_e(),gB={message:"must NOT have additional properties",params:({params:e})=>ut._`{additionalProperty: ${e.additionalProperty}}`},yB={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:gB,code(e){let{gen:t,schema:n,parentSchema:r,data:s,errsCount:o,it:i}=e;if(!o)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&Bs.alwaysValidSchema(i,n))return;let l=Us.allSchemaProperties(r.properties),u=Us.allSchemaProperties(r.patternProperties);d(),e.ok(ut._`${o} === ${hB.default.errors}`);function d(){t.forIn("key",s,(y)=>{if(!l.length&&!u.length)x(y);else t.if(p(y),()=>x(y))})}function p(y){let S;if(l.length>8){let E=Bs.schemaRefOrVal(i,r.properties,"properties");S=Us.isOwnProperty(t,E,y)}else if(l.length)S=ut.or(...l.map((E)=>ut._`${y} === ${E}`));else S=ut.nil;if(u.length)S=ut.or(S,...u.map((E)=>ut._`${Us.usePattern(e,E)}.test(${y})`));return ut.not(S)}function m(y){t.code(ut._`delete ${s}[${y}]`)}function x(y){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){m(y);return}if(n===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof n=="object"&&!Bs.alwaysValidSchema(i,n)){let S=t.name("valid");if(c.removeAdditional==="failing")g(y,S,!1),t.if(ut.not(S),()=>{e.reset(),m(y)});else if(g(y,S),!a)t.if(ut.not(S),()=>t.break())}}function g(y,S,E){let v={keyword:"additionalProperties",dataProp:y,dataPropType:Bs.Type.Str};if(E===!1)Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(v,S)}}};JO.default=yB});var FO=q(function(MO){Object.defineProperty(MO,"__esModule",{value:!0});var DO=zi(),td=Dn(),ra=_e(),IO=rx(),bB={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e;if(o.opts.removeAdditional==="all"&&r.additionalProperties===void 0)IO.default.code(new DO.KeywordCxt(o,IO.default,"additionalProperties"));let i=td.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=ra.mergeEvaluated.props(t,ra.toHash(i),o.props);let a=i.filter((d)=>!ra.alwaysValidSchema(o,n[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(l(d))u(d);else{if(t.if(td.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function l(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};MO.default=bB});var VO=q(function(LO){Object.defineProperty(LO,"__esModule",{value:!0});var nd=Dn(),zs=ye(),rd=_e(),sd=_e(),SB={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=nd.allSchemaProperties(n),c=a.filter((g)=>rd.alwaysValidSchema(o,n[g]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof zs.Name))o.props=sd.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let g of a){if(l)m(g);if(o.allErrors)x(g);else t.var(u,!0),x(g),t.if(u)}}function m(g){for(let y in l)if(new RegExp(g).test(y))rd.checkStrictMode(o,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function x(g){t.forIn("key",r,(y)=>{t.if(zs._`${nd.usePattern(e,g)}.test(${y})`,()=>{let S=c.includes(g);if(!S)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:sd.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(zs._`${d}[${y}]`,!0);else if(!S&&!o.allErrors)t.if(zs.not(u),()=>t.break())})})}}};LO.default=SB});var HO=q(function(WO){Object.defineProperty(WO,"__esModule",{value:!0});var qO=_e(),vB={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(qO.alwaysValidSchema(r,n)){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"}};WO.default=vB});var zO=q(function(BO){Object.defineProperty(BO,"__esModule",{value:!0});var UO=Dn(),jB={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:UO.validateUnion,error:{message:"must match a schema in anyOf"}};BO.default=jB});var XO=q(function(GO){Object.defineProperty(GO,"__esModule",{value:!0});var Ks=ye(),KO=_e(),_B={message:"must match exactly one schema in oneOf",params:({params:e})=>Ks._`{passingSchemas: ${e.passing}}`},kB={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:_B,code(e){let{gen:t,schema:n,parentSchema:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&r.discriminator)return;let o=n,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((u,d)=>{let p;if(KO.alwaysValidSchema(s,u))t.var(c,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(Ks._`${c} && ${i}`).assign(i,!1).assign(a,Ks._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,Ks.Name)})})}}};GO.default=kB});var QO=q(function(ZO){Object.defineProperty(ZO,"__esModule",{value:!0});var YO=_e(),AB={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let s=t.name("valid");n.forEach((o,i)=>{if(YO.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};ZO.default=AB});var nA=q(function(tA){Object.defineProperty(tA,"__esModule",{value:!0});var Gs=ye(),od=_e(),RB={message:({params:e})=>Gs.str`must match "${e.ifClause}" schema`,params:({params:e})=>Gs._`{failingKeyword: ${e.ifClause}}`},NB={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:RB,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)od.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=eA(r,"then"),o=eA(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else if(s)t.if(a,l("then"));else t.if(Gs.not(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,Gs._`${u}`);else e.setParams({ifClause:u})}}}};function eA(e,t){let n=e.schema[t];return n!==void 0&&!od.alwaysValidSchema(e,n)}tA.default=NB});var oA=q(function(sA){Object.defineProperty(sA,"__esModule",{value:!0});var rA=_e(),JB={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)rA.checkStrictMode(n,`"${e}" without "if" is ignored`)}};sA.default=JB});var sx=q(function(iA){Object.defineProperty(iA,"__esModule",{value:!0});var DB=tx(),MB=xO(),FB=nx(),LB=vO(),VB=jO(),qB=Qf(),WB=TO(),HB=rx(),UB=FO(),BB=VO(),zB=HO(),KB=zO(),GB=XO(),XB=QO(),YB=nA(),ZB=oA();function QB(e=!1){let t=[zB.default,KB.default,GB.default,XB.default,YB.default,ZB.default,WB.default,HB.default,qB.default,UB.default,BB.default];if(e)t.push(MB.default,LB.default);else t.push(DB.default,FB.default);return t.push(VB.default),t}iA.default=QB});var ox=q(function(lA){Object.defineProperty(lA,"__esModule",{value:!0});lA.dynamicAnchor=void 0;var sa=ye(),tz=Jn(),id=Dc(),aA=Kf(),nz={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>cA(e,e.schema)};function cA(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=sa._`${tz.default.dynamicAnchors}${sa.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:rz(e);n.if(sa._`!${s}`,()=>n.assign(s,o))}lA.dynamicAnchor=cA;function rz(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:c}=r.opts,l=new id.SchemaEnv({schema:n,schemaId:c,root:s,baseId:o,localRefs:i,meta:a});return id.compileSchema.call(r,l),aA.getValidate(e,l)}lA.default=nz});var ix=q(function(dA){Object.defineProperty(dA,"__esModule",{value:!0});dA.dynamicRef=void 0;var ad=ye(),oz=Jn(),cd=Kf(),iz={keyword:"$dynamicRef",schemaType:"string",code:(e)=>fA(e,e.schema)};function fA(e,t){let{gen:n,keyword:r,it:s}=e;if(t[0]!=="#")throw Error(`"${r}" only supports hash fragment reference`);let o=t.slice(1);if(s.allErrors)i();else{let c=n.let("valid",!1);i(c),e.ok(c)}function i(c){if(s.schemaEnv.root.dynamicAnchors[o]){let l=n.let("_v",ad._`${oz.default.dynamicAnchors}${ad.getProperty(o)}`);n.if(l,a(l,c),a(s.validateName,c))}else a(s.validateName,c)()}function a(c,l){return l?()=>n.block(()=>{cd.callRef(e,c),n.let(l,!0)}):()=>cd.callRef(e,c)}}dA.dynamicRef=fA;dA.default=iz});var yA=q(function(gA){Object.defineProperty(gA,"__esModule",{value:!0});var mA=ox(),hA=_e(),cz={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)mA.dynamicAnchor(e,"");else hA.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};gA.default=cz});var $A=q(function(bA){Object.defineProperty(bA,"__esModule",{value:!0});var xA=ix(),uz={keyword:"$recursiveRef",schemaType:"string",code:(e)=>xA.dynamicRef(e,e.schema)};bA.default=uz});var wA=q(function(SA){Object.defineProperty(SA,"__esModule",{value:!0});var dz=ox(),pz=ix(),mz=yA(),hz=$A(),gz=[dz.default,pz.default,mz.default,hz.default];SA.default=gz});var EA=q(function(vA){Object.defineProperty(vA,"__esModule",{value:!0});var ld=Qf(),xz={keyword:"dependentRequired",type:"object",schemaType:"object",error:ld.error,code:(e)=>ld.validatePropertyDeps(e)};vA.default=xz});var _A=q(function(PA){Object.defineProperty(PA,"__esModule",{value:!0});var jA=Qf(),$z={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>jA.validateSchemaDeps(e)};PA.default=$z});var AA=q(function(OA){Object.defineProperty(OA,"__esModule",{value:!0});var kA=_e(),wz={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)kA.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};OA.default=wz});var RA=q(function(CA){Object.defineProperty(CA,"__esModule",{value:!0});var Ez=EA(),jz=_A(),Pz=AA(),_z=[Ez.default,jz.default,Pz.default];CA.default=_z});var TA=q(function(NA){Object.defineProperty(NA,"__esModule",{value:!0});var Ut=ye(),ud=_e(),Oz=Jn(),Az={message:"must NOT have unevaluated properties",params:({params:e})=>Ut._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},Cz={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:Az,code(e){let{gen:t,schema:n,data:r,errsCount:s,it:o}=e;if(!s)throw Error("ajv implementation error");let{allErrors:i,props:a}=o;if(a instanceof Ut.Name)t.if(Ut._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(l(a,d),()=>c(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?c(d):t.if(u(a,d),()=>c(d)));o.props=!0,e.ok(Ut._`${s} === ${Oz.default.errors}`);function c(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!ud.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:ud.Type.Str},p),!i)t.if(Ut.not(p),()=>t.break())}}function l(d,p){return Ut._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let x in d)if(d[x]===!0)m.push(Ut._`${p} !== ${x}`);return Ut.and(...m)}}};NA.default=Cz});var IA=q(function(JA){Object.defineProperty(JA,"__esModule",{value:!0});var fn=ye(),fd=_e(),Nz={message:({params:{len:e}})=>fn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>fn._`{limit: ${e}}`},Tz={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:Nz,code(e){let{gen:t,schema:n,data:r,it:s}=e,o=s.items||0;if(o===!0)return;let i=t.const("len",fn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(fn._`${i} > ${o}`);else if(typeof n=="object"&&!fd.alwaysValidSchema(s,n)){let c=t.var("valid",fn._`${i} <= ${o}`);t.if(fn.not(c),()=>a(c,o)),e.ok(c)}s.items=!0;function a(c,l){t.forRange("i",l,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:fd.Type.Num},c),!s.allErrors)t.if(fn.not(c),()=>t.break())})}}};JA.default=Tz});var MA=q(function(DA){Object.defineProperty(DA,"__esModule",{value:!0});var Iz=TA(),Dz=IA(),Mz=[Iz.default,Dz.default];DA.default=Mz});var LA=q(function(FA){Object.defineProperty(FA,"__esModule",{value:!0});var $e=ye(),Lz={message:({schemaCode:e})=>$e.str`must match format "${e}"`,params:({schemaCode:e})=>$e._`{format: ${e}}`},Vz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Lz,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;if(s)p();else m();function p(){let x=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=n.const("fDef",$e._`${x}[${i}]`),y=n.let("fType"),S=n.let("format");n.if($e._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>n.assign(y,$e._`${g}.type || "string"`).assign(S,$e._`${g}.validate`),()=>n.assign(y,$e._`"string"`).assign(S,g)),e.fail$data($e.or(E(),v()));function E(){if(c.strictSchema===!1)return $e.nil;return $e._`${i} && !${S}`}function v(){let j=u.$async?$e._`(${g}.async ? await ${S}(${r}) : ${S}(${r}))`:$e._`${S}(${r})`,P=$e._`(typeof ${S} == "function" ? ${j} : ${S}.test(${r}))`;return $e._`${S} && ${S} !== true && ${y} === ${t} && !${P}`}}function m(){let x=d.formats[o];if(!x){E();return}if(x===!0)return;let[g,y,S]=v(x);if(g===t)e.pass(j());function E(){if(c.strictSchema===!1){d.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function v(P){let O=P instanceof RegExp?$e.regexpCode(P):c.code.formats?$e._`${c.code.formats}${$e.getProperty(o)}`:void 0,T=n.scopeValue("formats",{key:o,ref:P,code:O});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,$e._`${T}.validate`];return["string",P,T]}function j(){if(typeof x=="object"&&!(x instanceof RegExp)&&x.async){if(!u.$async)throw Error("async format in sync schema");return $e._`await ${S}(${r})`}return typeof y=="function"?$e._`${S}(${r})`:$e._`${S}.test(${r})`}}}};FA.default=Vz});var ax=q(function(VA){Object.defineProperty(VA,"__esModule",{value:!0});var Wz=LA(),Hz=[Wz.default];VA.default=Hz});var cx=q(function(qA){Object.defineProperty(qA,"__esModule",{value:!0});qA.contentVocabulary=qA.metadataVocabulary=void 0;qA.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];qA.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var UA=q(function(HA){Object.defineProperty(HA,"__esModule",{value:!0});var zz=Qy(),Kz=ex(),Gz=sx(),Xz=wA(),Yz=RA(),Zz=MA(),Qz=ax(),dd=cx(),e8=[Xz.default,zz.default,Kz.default,(0,Gz.default)(!0),Qz.default,dd.metadataVocabulary,dd.contentVocabulary,Yz.default,Zz.default];HA.default=e8});var GA=q(function(zA){Object.defineProperty(zA,"__esModule",{value:!0});zA.DiscrError=void 0;var BA;(function(e){e.Tag="tag",e.Mapping="mapping"})(BA||(zA.DiscrError=BA={}))});var lx=q(function(YA){Object.defineProperty(YA,"__esModule",{value:!0});var Fn=ye(),oa=GA(),pd=Dc(),n8=Gi(),XA=_e(),r8={message:({params:{discrError:e,tagName:t}})=>e===oa.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>Fn._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},s8={keyword:"discriminator",type:"object",schemaType:"object",error:r8,code(e){let{gen:t,data:n,schema:r,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",Fn._`${n}${Fn.getProperty(a)}`);t.if(Fn._`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:oa.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let m=p();t.if(!1);for(let x in m)t.elseIf(Fn._`${l} === ${x}`),t.assign(c,d(m[x]));t.else(),e.error(!1,{discrError:oa.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(m){let x=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},x);return e.mergeEvaluated(g,Fn.Name),x}function p(){var m;let x={},g=S(s),y=!0;for(let j=0;j<i.length;j++){let P=i[j];if((P===null||P===void 0?void 0:P.$ref)&&!XA.schemaHasRulesButRef(P,o.self.RULES)){let T=P.$ref;if(P=pd.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),P instanceof pd.SchemaEnv)P=P.schema;if(P===void 0)throw new n8.default(o.opts.uriResolver,o.baseId,T)}let O=(m=P===null||P===void 0?void 0:P.properties)===null||m===void 0?void 0:m[a];if(typeof O!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(g||S(P)),E(O,j)}if(!y)throw Error(`discriminator: "${a}" must be required`);return x;function S({required:j}){return Array.isArray(j)&&j.includes(a)}function E(j,P){if(j.const)v(j.const,P);else if(j.enum)for(let O of j.enum)v(O,P);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(j,P){if(typeof j!="string"||j in x)throw Error(`discriminator: "${a}" values must be unique strings`);x[j]=P}}}};YA.default=s8});var ZA=q(function(vne,i8){i8.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 QA=q(function(Ene,a8){a8.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 eC=q(function(jne,c8){c8.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 tC=q(function(Pne,l8){l8.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 nC=q(function(_ne,u8){u8.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 rC=q(function(kne,f8){f8.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 sC=q(function(One,d8){d8.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 oC=q(function(Ane,p8){p8.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 aC=q(function(iC){Object.defineProperty(iC,"__esModule",{value:!0});var m8=ZA(),h8=QA(),g8=eC(),y8=tC(),x8=nC(),b8=rC(),$8=sC(),S8=oC(),w8=["/properties"];function v8(e){return[m8,h8,g8,y8,x8,t(this,b8),$8,t(this,S8)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,w8):r}}iC.default=v8});var dx=q(function(dn,fx){Object.defineProperty(dn,"__esModule",{value:!0});dn.MissingRefError=dn.ValidationError=dn.CodeGen=dn.Name=dn.nil=dn.stringify=dn.str=dn._=dn.KeywordCxt=dn.Ajv2020=void 0;var j8=Zy(),P8=UA(),_8=lx(),k8=aC(),ux="https://json-schema.org/draft/2020-12/schema";class Lc extends j8.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),P8.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(_8.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;k8.default.call(this,e),this.refs["http://json-schema.org/schema"]=ux}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ux)?ux:void 0)}}dn.Ajv2020=Lc;fx.exports=dn=Lc;fx.exports.Ajv2020=Lc;Object.defineProperty(dn,"__esModule",{value:!0});dn.default=Lc;var O8=zi();Object.defineProperty(dn,"KeywordCxt",{enumerable:!0,get:function(){return O8.KeywordCxt}});var ia=ye();Object.defineProperty(dn,"_",{enumerable:!0,get:function(){return ia._}});Object.defineProperty(dn,"str",{enumerable:!0,get:function(){return ia.str}});Object.defineProperty(dn,"stringify",{enumerable:!0,get:function(){return ia.stringify}});Object.defineProperty(dn,"nil",{enumerable:!0,get:function(){return ia.nil}});Object.defineProperty(dn,"Name",{enumerable:!0,get:function(){return ia.Name}});Object.defineProperty(dn,"CodeGen",{enumerable:!0,get:function(){return ia.CodeGen}});var A8=Jc();Object.defineProperty(dn,"ValidationError",{enumerable:!0,get:function(){return A8.default}});var C8=Gi();Object.defineProperty(dn,"MissingRefError",{enumerable:!0,get:function(){return C8.default}})});import{existsSync as hd,readFileSync as uC}from"node:fs";import{createRequire as cC}from"node:module";import{basename as T8,isAbsolute as J8,relative as I8,resolve as px}from"node:path";import{fileURLToPath as lC,pathToFileURL as D8}from"node:url";function md(e){return JSON.parse(uC(e,"utf8"))}async function fC(e){let t=px(e),n=An(t),r=px(t,"project.schema.json");if(!hd(n))throw Error(`No project.jxn or project.json in ${t}`);if(!hd(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=Nl(uC(n,"utf8"),n),o=md(r);o.$id=D8(r).href;let i;try{({default:i}=await Promise.resolve().then(() => ar(dx(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let c=await new i({allErrors:!0,loadSchema:(d)=>L8(d,t),strict:!1}).compileAsync(o),l=c(s),u=c.errors??null;return{errors:u&&Wr(n)?F8(u,s):u,file:T8(n),valid:l}}function M8(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");n=Array.isArray(n)?n[Number(s)]:L(n)?n[s]:void 0}return n}function F8(e,t){return e.map((n)=>{if(!I(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!I(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!k(n.instancePath))return n;let r=M8(t,n.instancePath),s=rt(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
|
|
621
|
-
`)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function L8(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 n=lC(e),r=I8(t,n);if(r.startsWith("..")||J8(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(hd(n))return md(n);let s=r.split("\\").join("/"),o="node_modules/",i=s.lastIndexOf(o);if(i===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(i+o.length),c="@jxsuite/schema/",l;try{l=cC(px(t,"package.json")).resolve(a)}catch(u){if(!a.startsWith(c))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:u});try{l=cC(import.meta.url).resolve(a)}catch(d){let p=lC(new URL(`../${a.slice(c.length)}`,import.meta.url));if(hd(p))return md(p);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:d})}}return md(l)}var dC=R(()=>{le();El();Cl();Tl();ho()});function Rr(e){return L(e.attributes)?e.attributes:{}}function Bt(e,t){let n=Rr(e)[t];return k(n)?n:null}function yt(e){return k(e.tagName)?e.tagName.toLowerCase():""}function Qt(e,t="the popover"){let n=k(e.id)?e.id:Bt(e,"id");if(n)return`#${n}`;let r=yt(e);return r===""?t:`the <${r}>`}function W8(e){let t=Rr(e).popover;return k(t)?t:null}function mC(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&k(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if(mx(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&H8.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function mx(e){return"popover"in Rr(e)||"popover"in e}function Vc(e,t){return mx(e)||(t?.popoverTags?.has(yt(e))??!1)}function Xs(e){if(k(e.id)&&e.id!=="")return e.id;let t=Bt(e,"id");return t===""?null:t}function*Cr(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=Vc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[c,l]of o.entries())if(I(l))yield*Cr(l,[...t,"children",c],s,r)}else if(L(o)&&tn(o.map))yield*Cr(o.map,[...t,"children","map"],s,r);let i=tn(e.map)?e.map:null;if(i)yield*Cr(i,[...t,"map"],s,r);let a=L(e.cases)?e.cases:{};for(let[c,l]of Object.entries(a))if(I(l))yield*Cr(l,[...t,"cases",c],s,r)}function hx(e,t){let n=[];for(let{node:r}of Cr(e,[],null,t)){if(!Vc(r,t))continue;let s=Xs(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function gd(e){return e.startsWith("@")}function hC(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function Zt(e,t){let n=e?.[t];if(n===void 0||so(n)||Array.isArray(n))return null;return String(n)}function gC(e){for(let[t,n]of Object.entries(e??{})){if(!so(n))continue;if(hC(t)&&t.includes(":popover-open")&&Zt(n,"display")!==null)return!0;if(gd(t)&&gC(n))return!0}return!1}function yC(e){for(let[t,n]of Object.entries(e??{})){if(!so(n))continue;if(hC(t)&&t.includes(":popover-open"))return!0;if(gd(t)&&yC(n))return!0}return!1}function B8(e){return U8.some((t)=>Zt(e,t)!==null)}function z8(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(gd(n)&&so(r)&&Zt(r,"display")!==null)t.push(n);return t}function xC(e){if(!e)return[];let t=[],n=Zt(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(gd(r)&&so(s))t.push(...xC(s));return t}function K8(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 G8(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 bC(e,t){let n=[...Cr(e,[],null,t)],r=hx(e,t),s=n.some(({node:a})=>Vc(a,t)),o=new Set;for(let{node:a}of n)if(pC.has(yt(a))){let c=Bt(a,"popovertarget");if(c!==null)o.add(c)}let i=[];for(let{enclosing:a,node:c,path:l}of n)if(i.push(...X8(c,l,a,r,s,t)),mx(c))i.push(...Y8(c,l,o));return i}function X8(e,t,n,r,s,o){let i=[],a=yt(e),c=Bt(e,"popovertarget"),l=pC.has(a)||(o?.invokerTags?.has(a)??!1);if(c!==null&&!l)return i.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. ${Ge}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(c!==null){if(s&&!r.includes(c)){let u=r.length>0?`The popovers here are: ${r.map((d)=>`"${d}"`).join(", ")}. `:"";i.push({detail:`No element in this document declares \`popover\` with the id "${c}". ${u}A target that names nothing does nothing, silently. ${Ge}`,message:`popovertarget="${c}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&Xs(n)!==null&&Xs(n)!==c)i.push({detail:`This control is inside ${Qt(n)} but targets "${c}". 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. ${Ge}`,message:`A control inside ${Qt(n)} targets "${c}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&c===null){let u=Bt(e,"href")??(k(e.href)?e.href:null),d=Bt(e,"target")==="_blank",p=u!==null&&u.includes("#");if(d||p){let m=d?"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. ";i.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. ${Ge}`,message:`A link inside ${Qt(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function Y8(e,t,n){let r=[],{style:s}=e,o=Qt(e),i=W8(e);if(i!==null&&i!==""&&!q8.some((l)=>l===i))r.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". ${Ge}`,fix:"mode",message:`${o} declares popover="${i}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(bt(Rr(e).popover))r.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". ${Ge}`,fix:"mode",message:`${o} 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")r.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. ${Ge}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let l of z8(s))r.push({detail:`The same defect as a base \`display\`, arriving through \`${l}\` 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. ${Ge}`,fix:"display",message:`${o} sets display inside ${l}.`,path:t,rule:"breakpoint-display",severity:"error"});if(Zt(s,"visibility")!==null)r.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. ${Ge}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!yC(s))r.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. ${Ge}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!gC(s)&&a===null&&B8(s))r.push({detail:`${o} 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\`. ${Ge}`,fix:"open-display",message:`${o} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let l of xC(s))if(l.includes("display")&&!l.includes("overlay")){r.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. ${Ge}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(K8(s)&&!G8(s))r.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. ${Ge}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let c=Xs(e);if(c!==null&&!n.has(c))r.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. ${Ge}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var q8,pC,H8,U8,Ge="See docs/framework/concepts/overlays.";var yd=R(()=>{le();q8=["auto","manual","hint"],pC=new Set(["button","input"]);H8=["popovertarget","popovertargetaction","command","commandfor"];U8=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function ua(e,t){let n=Rr(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(Ce(r)||L(r))return{kind:"bound"};if(k(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function ca(e,t){let n=ua(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function zt(e,t){return ua(e,t).kind!=="absent"}function Ys(e){let t=ua(e,"role");if(t.kind==="bound")return la;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function xd(e){let t=ua(e,"id");if(t.kind==="bound")return la;return t.kind==="text"&&t.text!==""?t.text:null}function Ln(e,t){let n=ua(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function bd(e){let t=e.textContent;if(k(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Ln(e,"aria-label")||zt(e,"aria-labelledby"))return!0;if(yt(e)==="img"&&(Ln(e,"alt")||Ln(e,"title")))return!0;if(yt(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(k(s)){if(s.trim()!=="")return!0}else if(I(s)&&bd(s))return!0}else if(n!=null)return!0;if(L(e.map))return!0;return(L(e.cases)?Object.values(e.cases):[]).some((s)=>tn(s)&&bd(s))}function*aa(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,Ys(e)],o=[...r,yt(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,c]of i.entries())if(I(c))yield*aa(c,[...t,"children",a],s,o)}else if(L(i)&&tn(i.map))yield*aa(i.map,[...t,"children","map"],s,o);if(tn(e.map))yield*aa(e.map,[...t,"map"],s,o);if(L(e.cases)){for(let[a,c]of Object.entries(e.cases))if(I(c))yield*aa(c,[...t,"cases",a],s,o)}}function r9(e){return e.some((t)=>t.includes("-"))}function Nr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${Z8}`,message:n,path:t,rule:e,severity:o}}function $C(e,t,n){if(n.includes("label"))return!0;if(e===la||t.bound)return!0;return e!==null&&t.ids.has(e)}function s9(e,t){let{node:n,path:r,tags:s}=e,o=yt(n),i=Ys(n);if(i==="bound")return null;if(Ln(n,"aria-label")||zt(n,"aria-labelledby")||Ln(n,"title"))return null;let c=Qt(n,"the control"),l=(d)=>Nr("interactive-unnamed",r,`${c} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${d}`,"4.1.2"),u=o9(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&Q8.has(i))return bd(n)?null:l("Give it text content, or an aria-label.");if(i!==null&&e9.has(i))return l("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&zt(n,"href"))return bd(n)?null:l("Give it text content, or an aria-label.");if(u==="unnamed")return l("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return l("Give it a value, or an aria-label.");if(u==="unnamed-alt")return l("Give it an alt, or an aria-label.");return null}function o9(e,t,n,r){if(t==="area"){if(!zt(e,"href"))return"none";return Ln(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return $C(xd(e),n,r)||Ln(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(ca(e,"type")??"text").toLowerCase();if(s==="hidden"||zt(e,"type")&&ca(e,"type")===null)return"exempt";if(t9.has(s))return Ln(e,"value")?"named":"unnamed-value";if(s==="image")return Ln(e,"alt")?"named":"unnamed-alt";return $C(xd(e),n,r)||Ln(e,"placeholder")?"named":"unnamed"}function a9(e){let{node:t,path:n,tags:r}=e,s=yt(t);if(!s.includes("-")||!r.some((o)=>i9.has(o)))return null;return Nr("custom-element-in-select",n,`<${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 c9(e){let{node:t,path:n}=e;if(yt(t)!=="img")return null;let r=Ys(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(zt(t,"alt")||Ln(t,"aria-label")||zt(t,"aria-labelledby"))return null;return Nr("img-alt-missing",n,`${Qt(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 u9(e,t){let{node:n,path:r}=e,s=[];for(let o of l9){let i=ca(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Nr("aria-target-missing",r,`${Qt(n,"the element")} points ${o} 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 f9(e,t,n){for(let r of SC.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===la&&s.ids.size>0)return!0;if(e!==null&&e!==la&&s.ids.has(e))return!0}return!1}function d9(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=Ys(n);if(i===null||i==="bound"||r.length===0||r9(o))return null;if(s.includes("bound")||f9(xd(n),i,t))return null;let a=Qt(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Nr("tab-outside-tablist",r,`${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((i==="menuitem"||i==="menuitemcheckbox"||i==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Nr("menuitem-outside-menu",r,`${a} is a ${i} 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(i==="option"&&!s.includes("listbox")&&!o.includes("select")&&!o.includes("datalist"))return Nr("option-outside-listbox",r,`${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 p9(e){let t=[];for(let{node:n}of aa(e)){if(Ys(n)!=="tab")continue;let r=ua(n,"aria-selected");if(r.kind==="bound")return null;t.push(r.kind==="other"&&r.isTrue||r.kind==="text"&&r.text==="true")}return t}function m9(e){let{node:t,path:n}=e;if(Ys(t)!=="tablist")return null;let r=p9(t);if(r===null||r.length===0||r.includes(!0))return null;return Nr("tablist-none-selected",n,`${Qt(t,"the tablist")} has ${r.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 h9(e){let{node:t,path:n}=e,r=Ys(t);if(!(yt(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(Ln(t,"aria-label")||zt(t,"aria-labelledby"))return null;return Nr("dialog-unnamed",n,`${Qt(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 y9(e){let{node:t,path:n}=e;if(!zt(t,"aria-activedescendant"))return null;let r=yt(t);if(g9.has(r)||r==="a"&&zt(t,"href")||zt(t,"tabIndex")||zt(t,"tabindex")||zt(t,"contenteditable"))return null;return Nr("activedescendant-not-focusable",n,`${Qt(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 wC(e){let t=[...aa(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let c=Ys(a);if(c!==null&&n9.has(c)){let u=s.get(c)??{bound:!1,ids:new Set},d=ca(a,"aria-owns");if(d===null)u.bound||=zt(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(c,u)}let l=xd(a);if(l===la)o=!0;else if(l!==null)n.add(l);if(yt(a)==="label"){let u=ca(a,"for")??ca(a,"htmlFor");if(u===null)r.bound||=zt(a,"for")||zt(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let c=[s9(a,r),c9(a),d9(a,s),a9(a),m9(a),h9(a),y9(a)];for(let l of c)if(l)i.push(l);if(!o)i.push(...u9(a,n))}return i}var Z8="See docs/framework/concepts/accessibility.",la="bound",Q8,e9,t9,SC,n9,i9,l9,g9;var vC=R(()=>{le();yd();Q8=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),e9=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),t9=new Set(["button","reset","submit"]),SC=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),n9=new Set([...SC.values()].flat());i9=new Set(["select","jx-select"]);l9=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];g9=new Set(["button","input","select","textarea"])});function gx(e){return yt(e)==="dialog"}function EC(e){return e.startsWith("--")}function E9(e){let t=[];for(let{node:n}of Cr(e)){let r=Xs(n);if(gx(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function j9(e){let t=e.oncommand;return t!==void 0&&t!==null}function P9(e,t){for(let{node:n}of Cr(e)){if(n===e)continue;let r=yt(n);if(r==="button"){let s=Bt(n,"command"),o=Bt(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&Bt(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function PC(e,t){let n=[...Cr(e,[],null,t)],r=E9(e),s=hx(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:l}of n){let u=Xs(l);if(u!==null&&!i.has(u))i.set(u,l);if(yt(l)==="button"){let d=Bt(l,"commandfor"),p=Bt(l,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let c=[];for(let{node:l,path:u}of n)if(c.push(..._9(l,u,i,r,s,o,t)),gx(l))c.push(...k9(l,u,a));return c}function _9(e,t,n,r,s,o,i){let a=[],c=yt(e),l=i?.invokerTags?.has(c)??!1,u=Bt(e,"command"),d=Bt(e,"commandfor");if(!(u!==null||d!==null||("command"in Rr(e))||("commandfor"in Rr(e))))return a;let m=Qt(e,"the element");if(!v9.has(c)&&!l)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. ${Ge}`,fix:"invoker",message:`<${c||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!S9.has(u)&&!EC(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${jC.map((x)=>`\`${x}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${Ge}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(d!==null){let x=n.get(d),g=r.includes(d),y=s.includes(d);if(!x&&o){let S=[...r,...s].map((E)=>`"${E}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${S}. A commandfor that names nothing does nothing, silently. ${Ge}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&x){if(x9.has(u)&&!gx(x))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${y?"a popover":`a <${yt(x)||"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."} ${Ge}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(b9.has(u)&&!Vc(x,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${g?"a dialog":`a <${yt(x)||"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."} ${Ge}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(EC(u)&&!j9(x))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${d}" 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. ${Ge}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function k9(e,t,n){let r=[],s=Qt(e,"the dialog"),o=Xs(e),{style:i}=e,a=Bt(e,"closedby");if(a!==null&&!w9.has(a))r.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. ${Ge}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(Zt(i,"display")!==null)r.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. ${Ge}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let c=o===null?void 0:n.get(o),l=Bt(e,"open")!==null||Rr(e).open===!0||e.open===!0;if(o!==null&&!c?.has("show-modal")&&!l)r.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. ${Ge}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(c?.has("show-modal")&&a==="none"&&!P9(e,o))r.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"\`. ${Ge}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var jC,x9,b9,$9,S9,w9,v9;var _C=R(()=>{le();yd();jC=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],x9=new Set(["show-modal","close","request-close"]),b9=new Set(["toggle-popover","show-popover","hide-popover"]),$9=["any","closerequest","none"],S9=new Set(jC),w9=new Set($9),v9=new Set(["button"])});var DC=q(function(JC){Object.defineProperty(JC,"__esModule",{value:!0});JC.formatNames=JC.fastFormats=JC.fullFormats=void 0;function Tr(e,t){return{validate:e,compare:t}}JC.fullFormats={date:Tr(CC,$x),time:Tr(xx(!0),Sx),"date-time":Tr(kC(!0),NC),"iso-time":Tr(xx(),RC),"iso-date-time":Tr(kC(),TC),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:T9,"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:V9,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:J9,int32:{type:"number",validate:M9},int64:{type:"number",validate:F9},float:{type:"number",validate:AC},double:{type:"number",validate:AC},password:!0,binary:!0};JC.fastFormats={...JC.fullFormats,date:Tr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$x),time:Tr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Sx),"date-time":Tr(/^\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,NC),"iso-time":Tr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,RC),"iso-date-time":Tr(/^\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,TC),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};JC.formatNames=Object.keys(JC.fullFormats);function O9(e){return e%4===0&&(e%100!==0||e%400===0)}var A9=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,C9=[0,31,28,31,30,31,30,31,31,30,31,30,31];function CC(e){let t=A9.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&O9(n)?29:C9[r])}function $x(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var yx=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function xx(e){return function(n){let r=yx.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],c=r[5]==="-"?-1:1,l=+(r[6]||0),u=+(r[7]||0);if(l>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*c,p=s-l*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Sx(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function RC(e,t){if(!(e&&t))return;let n=yx.exec(e),r=yx.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var bx=/t|\s/i;function kC(e){let t=xx(e);return function(r){let s=r.split(bx);return s.length===2&&CC(s[0])&&t(s[1])}}function NC(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function TC(e,t){if(!(e&&t))return;let[n,r]=e.split(bx),[s,o]=t.split(bx),i=$x(n,s);if(i===void 0)return;return i||Sx(r,o)}var R9=/\/|:/,N9=/^(?:[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 T9(e){return R9.test(e)&&N9.test(e)}var OC=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function J9(e){return OC.lastIndex=0,OC.test(e)}var I9=-2147483648,D9=2147483647;function M9(e){return Number.isInteger(e)&&e<=D9&&e>=I9}function F9(e){return Number.isInteger(e)}function AC(){return!0}var L9=/[^\\]\\Z/;function V9(e){if(L9.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var FC=q(function(MC){Object.defineProperty(MC,"__esModule",{value:!0});var W9=Qy(),H9=ex(),U9=sx(),B9=ax(),$d=cx(),z9=[W9.default,H9.default,(0,U9.default)(),B9.default,$d.metadataVocabulary,$d.contentVocabulary];MC.default=z9});var LC=q(function(ire,G9){G9.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 qC=q(function(pn,vx){Object.defineProperty(pn,"__esModule",{value:!0});pn.MissingRefError=pn.ValidationError=pn.CodeGen=pn.Name=pn.nil=pn.stringify=pn.str=pn._=pn.KeywordCxt=pn.Ajv=void 0;var X9=Zy(),Y9=FC(),Z9=lx(),VC=LC(),Q9=["/properties"],Sd="http://json-schema.org/draft-07/schema";class qc extends X9.default{_addVocabularies(){if(super._addVocabularies(),Y9.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(Z9.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(VC,Q9):VC;this.addMetaSchema(e,Sd,!1),this.refs["http://json-schema.org/schema"]=Sd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Sd)?Sd:void 0)}}pn.Ajv=qc;vx.exports=pn=qc;vx.exports.Ajv=qc;Object.defineProperty(pn,"__esModule",{value:!0});pn.default=qc;var e4=zi();Object.defineProperty(pn,"KeywordCxt",{enumerable:!0,get:function(){return e4.KeywordCxt}});var fa=ye();Object.defineProperty(pn,"_",{enumerable:!0,get:function(){return fa._}});Object.defineProperty(pn,"str",{enumerable:!0,get:function(){return fa.str}});Object.defineProperty(pn,"stringify",{enumerable:!0,get:function(){return fa.stringify}});Object.defineProperty(pn,"nil",{enumerable:!0,get:function(){return fa.nil}});Object.defineProperty(pn,"Name",{enumerable:!0,get:function(){return fa.Name}});Object.defineProperty(pn,"CodeGen",{enumerable:!0,get:function(){return fa.CodeGen}});var t4=Jc();Object.defineProperty(pn,"ValidationError",{enumerable:!0,get:function(){return t4.default}});var n4=Gi();Object.defineProperty(pn,"MissingRefError",{enumerable:!0,get:function(){return n4.default}})});var UC=q(function(HC){Object.defineProperty(HC,"__esModule",{value:!0});HC.formatLimitDefinition=void 0;var WC=qC(),ft=ye(),Zs=ft.operators,wd={formatMaximum:{okStr:"<=",ok:Zs.LTE,fail:Zs.GT},formatMinimum:{okStr:">=",ok:Zs.GTE,fail:Zs.LT},formatExclusiveMaximum:{okStr:"<",ok:Zs.LT,fail:Zs.GTE},formatExclusiveMinimum:{okStr:">",ok:Zs.GT,fail:Zs.LTE}},o4={message:({keyword:e,schemaCode:t})=>ft.str`should be ${wd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>ft._`{comparison: ${wd[e].okStr}, limit: ${t}}`};HC.formatLimitDefinition={keyword:Object.keys(wd),type:"string",schemaType:"string",$data:!0,error:o4,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let c=new WC.KeywordCxt(o,a.RULES.all.format.definition,"format");if(c.$data)l();else u();function l(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",ft._`${p}[${c.schemaCode}]`);e.fail$data(ft.or(ft._`typeof ${m} != "object"`,ft._`${m} instanceof RegExp`,ft._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let x=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?ft._`${i.code.formats}${ft.getProperty(p)}`:void 0});e.fail$data(d(x))}function d(p){return ft._`${p}.compare(${n}, ${r}) ${wd[s].fail} 0`}},dependencies:["format"]};var i4=(e)=>(e.addKeyword(HC.formatLimitDefinition),e);HC.default=i4});var GC=q(function(Wc,KC){Object.defineProperty(Wc,"__esModule",{value:!0});var Vn=DC(),c4=UC(),da=ye(),BC=new da.Name("fullFormats"),l4=new da.Name("fastFormats"),jx=(e,t={keywords:!0})=>{if(Array.isArray(t))return zC(e,t,Vn.fullFormats,BC),e;let[n,r]=t.mode==="fast"?[Vn.fastFormats,l4]:[Vn.fullFormats,BC],s=t.formats||Vn.formatNames;if(zC(e,s,n,r),t.keywords)(0,c4.default)(e);return e};jx.get=(e,t="full")=>{let r=(t==="fast"?Vn.fastFormats:Vn.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function zC(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=da._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}KC.exports=Wc=jx;Object.defineProperty(Wc,"__esModule",{value:!0});Wc.default=jx});import{existsSync as ZC,readFileSync as _x,readdirSync as QC,statSync as eR}from"node:fs";import{createRequire as u4}from"node:module";import{join as tR,relative as pa,resolve as Px}from"node:path";async function m4(){try{let{default:e}=await Promise.resolve().then(() => ar(dx(),1)),{default:t}=await Promise.resolve().then(() => ar(GC(),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 nR(e,t={}){let n=Px(e),r=[],s=[],o=0;for(let v of["project.schema.json","document.schema.json"]){let j=Px(n,v);if(!ZC(j))continue;o+=1;let P=Hc(j),O=x4(P);if(O.length>0)r.push({errors:O.map(({reason:T,ref:U})=>({message:`$ref "${U}" ${T} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:v})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await fC(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let{addFormats:a,Ajv:c}=await m4(),{document:l}=await dj(n,{write:!1}),u=new c({allErrors:!0,ownProperties:!0,strict:!1});a(u);let d=u.compile(l),p=mC(YC(n).flatMap((v)=>{try{return[JSON.parse(_x(v,"utf8"))]}catch{return[]}}));for(let v of f4)for(let j of oR(Px(n,v))){if(j.endsWith(".class.json"))continue;o+=1;let P=h4(j,pa(n,j));if(s.push(...P.warnings),P.failure!==null){r.push(P.failure);continue}let O=P.document,T=XC(O,pa(n,j));if(s.push(...T.warnings),T.failure!==null){r.push(T.failure);continue}if(d(O))s.push(...y4(O,pa(n,j),p));else r.push({errors:d.errors??[],file:pa(n,j)})}let m=new c({allErrors:!0,ownProperties:!0,strict:!1});a(m);let x=m.compile(py());for(let v of YC(n)){o+=1;let j=Hc(v),P=XC(j,pa(n,v));if(s.push(...P.warnings),P.failure!==null)r.push(P.failure);else if(!x(j))r.push({errors:x.errors??[],file:pa(n,v)})}let{config:g}=gs(n),y=await hs(n,g),S=u4(import.meta.url);for(let v of y.extensions)for(let j of["project","document","fields"]){let P=v.schemas[j];if(!P)continue;o+=1;let O=new c({allErrors:!0,ownProperties:!0,strict:!1});a(O);for(let T of p4){let U=S.resolve(T);O.addSchema(Hc(U))}try{O.compile(Hc(P))}catch(T){r.push({errors:[{message:T instanceof Error?T.message:String(T)}],file:`${v.specifier} (${j} fragment)`})}}let E=t.strict===!0&&s.some((v)=>v.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!E}}function h4(e,t){if(!Wr(e))return{document:Hc(e),failure:null,warnings:[]};let n=_x(e,"utf8"),r=rp(n).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:g4(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:ge(s)}],file:t},warnings:r}}}function XC(e,t){let n=[];try{Va(e,t,n)}catch(s){return{failure:{errors:[{message:ge(s)}],file:t},warnings:[]}}return{failure:null,warnings:n.map(({pointer:s,problem:o})=>({detail:o.message,file:t,message:`${s} (line ${o.line}, column ${o.column}): ${o.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function g4(e){let t=mo(e);return L(t)?t:null}function Hc(e){return JSON.parse(_x(e,"utf8"))}function y4(e,t,n){let r=[];for(let s of bC(e,n))r.push({...vd(s),file:t,source:"popover"});for(let s of PC(e,n))r.push({...vd(s),file:t,source:"dialog"});for(let s of wC(e))r.push({...vd(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of cw(e))r.push({...vd({...s,severity:"info"}),file:t,source:"module"});return r}function vd(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function rR(e){return e.lint.map((t)=>{let n=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${n}]`})}function x4(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let c=a.replaceAll("~1","/").replaceAll("~0","~");if(!I(i))return!1;if(i=i[c],i===void 0)return!1}return!0},s=(o)=>{if(!L(o)||n.has(o))return;n.add(o);let i=o.$ref;if(k(i)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(i))t.push({reason:"is an absolute URI editors resolve over the network",ref:i});else if(!i.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:i});else if(i.length>1&&!i.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:i});else if(i.length>1&&!r(i.slice(1)))t.push({reason:"points at no node in this document",ref:i})}for(let[a,c]of Object.entries(o)){if(!b4.has(a))continue;if(Array.isArray(c))for(let l of c)s(l);else if(L(c)){if(s(c),sR.has(a))for(let l of Object.values(c))s(l)}}};return s(e),t}function oR(e){if(!ZC(e))return[];let t=[];for(let n of QC(e)){let r=tR(e,n);if(eR(r).isDirectory())t.push(...oR(r));else if(Hr(n))t.push(r)}return t.toSorted()}function YC(e){let t=[],n=(r)=>{for(let s of QC(r)){if(d4.has(s))continue;let o=tR(r,s);if(eR(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function iR(e){let t=[];for(let n of e.issues){t.push(`${n.file}:`);for(let r of n.errors){let s=L(r)?r:{},{instancePath:o,message:i}=s;t.push(` - ${o||"/"}: ${i??JSON.stringify(r)}`)}}return t}var f4,d4,p4,sR,b4;var aR=R(()=>{ms();Rt();tu();Jj();dC();vC();_C();bi();yd();le();Br();ii();fy();f4=["components","pages","layouts"],d4=new Set(["node_modules","dist",".git"]),p4=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];sR=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),b4=new Set([...sR,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});Rt();import{relative as kx,resolve as cR}from"node:path";async function $4(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
|
|
636
|
+
deps: ${n}}`};var n8={keyword:"dependencies",type:"object",schemaType:"object",error:QA.error,code(e){let[t,n]=r8(e);YA(e,t),ZA(e,n)}};function r8({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let s=Array.isArray(e[r])?t:n;s[r]=e[r]}return[t,n]}function YA(e,t=e.schema){let{gen:n,data:r,it:s}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let l=Br.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(l,()=>{for(let c of a)Br.checkReportMissingProp(e,c)});else n.if(ba._`${l} && (${Br.checkMissingProp(e,a,o)})`),Br.reportMissingProp(e,o),n.else()}}QA.validatePropertyDeps=YA;function ZA(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(XA.alwaysValidSchema(o,t[a]))continue;n.if(Br.propertyInData(n,r,a,o.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(l,i)},()=>n.var(i,!0)),e.ok(i)}}QA.validateSchemaDeps=ZA;QA.default=n8});var sC=W(function(rC){Object.defineProperty(rC,"__esModule",{value:!0});var qd=$e(),nC=Oe(),i8={message:"property name must be valid",params:({params:e})=>qd._`{propertyName: ${e.propertyName}}`},a8={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:i8,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(nC.alwaysValidSchema(s,n))return;let o=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if(qd.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};rC.default=a8});var ab=W(function(oC){Object.defineProperty(oC,"__esModule",{value:!0});var to=Xn(),yt=$e(),c8=Kn(),no=Oe(),u8={message:"must NOT have additional properties",params:({params:e})=>yt._`{additionalProperty: ${e.additionalProperty}}`},f8={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:u8,code(e){let{gen:t,schema:n,parentSchema:r,data:s,errsCount:o,it:i}=e;if(!o)throw Error("ajv implementation error");let{allErrors:a,opts:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&no.alwaysValidSchema(i,n))return;let c=to.allSchemaProperties(r.properties),u=to.allSchemaProperties(r.patternProperties);d(),e.ok(yt._`${o} === ${c8.default.errors}`);function d(){t.forIn("key",s,(g)=>{if(!c.length&&!u.length)y(g);else t.if(p(g),()=>y(g))})}function p(g){let x;if(c.length>8){let P=no.schemaRefOrVal(i,r.properties,"properties");x=to.isOwnProperty(t,P,g)}else if(c.length)x=yt.or(...c.map((P)=>yt._`${g} === ${P}`));else x=yt.nil;if(u.length)x=yt.or(x,...u.map((P)=>yt._`${to.usePattern(e,P)}.test(${g})`));return yt.not(x)}function m(g){t.code(yt._`delete ${s}[${g}]`)}function y(g){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){m(g);return}if(n===!1){if(e.setParams({additionalProperty:g}),e.error(),!a)t.break();return}if(typeof n=="object"&&!no.alwaysValidSchema(i,n)){let x=t.name("valid");if(l.removeAdditional==="failing")S(g,x,!1),t.if(yt.not(x),()=>{e.reset(),m(g)});else if(S(g,x),!a)t.if(yt.not(x),()=>t.break())}}function S(g,x,P){let w={keyword:"additionalProperties",dataProp:g,dataPropType:no.Type.Str};if(P===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,x)}}};oC.default=f8});var cC=W(function(lC){Object.defineProperty(lC,"__esModule",{value:!0});var aC=ua(),Hd=Xn(),$a=Oe(),iC=ab(),p8={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e;if(o.opts.removeAdditional==="all"&&r.additionalProperties===void 0)iC.default.code(new aC.KeywordCxt(o,iC.default,"additionalProperties"));let i=Hd.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=$a.mergeEvaluated.props(t,$a.toHash(i),o.props);let a=i.filter((d)=>!$a.alwaysValidSchema(o,n[d]));if(a.length===0)return;let l=t.name("valid");for(let d of a){if(c(d))u(d);else{if(t.if(Hd.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(l)}function c(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};lC.default=p8});var fC=W(function(uC){Object.defineProperty(uC,"__esModule",{value:!0});var Wd=Xn(),ro=$e(),Bd=Oe(),Ud=Oe(),h8={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=Wd.allSchemaProperties(n),l=a.filter((S)=>Bd.alwaysValidSchema(o,n[S]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof ro.Name))o.props=Ud.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let S of a){if(c)m(S);if(o.allErrors)y(S);else t.var(u,!0),y(S),t.if(u)}}function m(S){for(let g in c)if(new RegExp(S).test(g))Bd.checkStrictMode(o,`property ${g} matches pattern ${S} (use allowMatchingProperties)`)}function y(S){t.forIn("key",r,(g)=>{t.if(ro._`${Wd.usePattern(e,S)}.test(${g})`,()=>{let x=l.includes(S);if(!x)e.subschema({keyword:"patternProperties",schemaProp:S,dataProp:g,dataPropType:Ud.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(ro._`${d}[${g}]`,!0);else if(!x&&!o.allErrors)t.if(ro.not(u),()=>t.break())})})}}};uC.default=h8});var mC=W(function(pC){Object.defineProperty(pC,"__esModule",{value:!0});var dC=Oe(),y8={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(dC.alwaysValidSchema(r,n)){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"}};pC.default=y8});var yC=W(function(gC){Object.defineProperty(gC,"__esModule",{value:!0});var hC=Xn(),b8={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hC.validateUnion,error:{message:"must match a schema in anyOf"}};gC.default=b8});var $C=W(function(bC){Object.defineProperty(bC,"__esModule",{value:!0});var so=$e(),xC=Oe(),S8={message:"must match exactly one schema in oneOf",params:({params:e})=>so._`{passingSchemas: ${e.passing}}`},w8={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:S8,code(e){let{gen:t,schema:n,parentSchema:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&r.discriminator)return;let o=n,i=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){o.forEach((u,d)=>{let p;if(xC.alwaysValidSchema(s,u))t.var(l,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l);if(d>0)t.if(so._`${l} && ${i}`).assign(i,!1).assign(a,so._`[${a}, ${d}]`).else();t.if(l,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,so.Name)})})}}};bC.default=w8});var vC=W(function(wC){Object.defineProperty(wC,"__esModule",{value:!0});var SC=Oe(),E8={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let s=t.name("valid");n.forEach((o,i)=>{if(SC.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};wC.default=E8});var PC=W(function(jC){Object.defineProperty(jC,"__esModule",{value:!0});var oo=$e(),zd=Oe(),P8={message:({params:e})=>oo.str`must match "${e.ifClause}" schema`,params:({params:e})=>oo._`{failingKeyword: ${e.ifClause}}`},_8={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:P8,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)zd.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=EC(r,"then"),o=EC(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&o){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(oo.not(a),c("else"));e.pass(i,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,oo._`${u}`);else e.setParams({ifClause:u})}}}};function EC(e,t){let n=e.schema[t];return n!==void 0&&!zd.alwaysValidSchema(e,n)}jC.default=_8});var OC=W(function(kC){Object.defineProperty(kC,"__esModule",{value:!0});var _C=Oe(),O8={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)_C.checkStrictMode(n,`"${e}" without "if" is ignored`)}};kC.default=O8});var lb=W(function(AC){Object.defineProperty(AC,"__esModule",{value:!0});var C8=ob(),R8=qA(),N8=ib(),T8=zA(),J8=GA(),M8=Vd(),I8=sC(),D8=ab(),L8=cC(),F8=fC(),V8=mC(),q8=yC(),H8=$C(),W8=vC(),B8=PC(),U8=OC();function z8(e=!1){let t=[V8.default,q8.default,H8.default,W8.default,B8.default,U8.default,I8.default,D8.default,M8.default,L8.default,F8.default];if(e)t.push(R8.default,T8.default);else t.push(C8.default,N8.default);return t.push(J8.default),t}AC.default=z8});var cb=W(function(NC){Object.defineProperty(NC,"__esModule",{value:!0});NC.dynamicAnchor=void 0;var Sa=$e(),G8=Kn(),Kd=fc(),CC=Md(),X8={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>RC(e,e.schema)};function RC(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=Sa._`${G8.default.dynamicAnchors}${Sa.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:Y8(e);n.if(Sa._`!${s}`,()=>n.assign(s,o))}NC.dynamicAnchor=RC;function Y8(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:l}=r.opts,c=new Kd.SchemaEnv({schema:n,schemaId:l,root:s,baseId:o,localRefs:i,meta:a});return Kd.compileSchema.call(r,c),CC.getValidate(e,c)}NC.default=X8});var ub=W(function(MC){Object.defineProperty(MC,"__esModule",{value:!0});MC.dynamicRef=void 0;var Gd=$e(),Q8=Kn(),Xd=Md(),eK={keyword:"$dynamicRef",schemaType:"string",code:(e)=>JC(e,e.schema)};function JC(e,t){let{gen:n,keyword:r,it:s}=e;if(t[0]!=="#")throw Error(`"${r}" only supports hash fragment reference`);let o=t.slice(1);if(s.allErrors)i();else{let l=n.let("valid",!1);i(l),e.ok(l)}function i(l){if(s.schemaEnv.root.dynamicAnchors[o]){let c=n.let("_v",Gd._`${Q8.default.dynamicAnchors}${Gd.getProperty(o)}`);n.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>n.block(()=>{Xd.callRef(e,l),n.let(c,!0)}):()=>Xd.callRef(e,l)}}MC.dynamicRef=JC;MC.default=eK});var VC=W(function(FC){Object.defineProperty(FC,"__esModule",{value:!0});var DC=cb(),LC=Oe(),nK={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)DC.dynamicAnchor(e,"");else LC.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};FC.default=nK});var WC=W(function(HC){Object.defineProperty(HC,"__esModule",{value:!0});var qC=ub(),sK={keyword:"$recursiveRef",schemaType:"string",code:(e)=>qC.dynamicRef(e,e.schema)};HC.default=sK});var UC=W(function(BC){Object.defineProperty(BC,"__esModule",{value:!0});var iK=cb(),aK=ub(),lK=VC(),cK=WC(),uK=[iK.default,aK.default,lK.default,cK.default];BC.default=uK});var KC=W(function(zC){Object.defineProperty(zC,"__esModule",{value:!0});var Yd=Vd(),dK={keyword:"dependentRequired",type:"object",schemaType:"object",error:Yd.error,code:(e)=>Yd.validatePropertyDeps(e)};zC.default=dK});var YC=W(function(XC){Object.defineProperty(XC,"__esModule",{value:!0});var GC=Vd(),mK={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>GC.validateSchemaDeps(e)};XC.default=mK});var eR=W(function(QC){Object.defineProperty(QC,"__esModule",{value:!0});var ZC=Oe(),gK={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)ZC.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};QC.default=gK});var nR=W(function(tR){Object.defineProperty(tR,"__esModule",{value:!0});var xK=KC(),bK=YC(),$K=eR(),SK=[xK.default,bK.default,$K.default];tR.default=SK});var sR=W(function(rR){Object.defineProperty(rR,"__esModule",{value:!0});var Zt=$e(),Zd=Oe(),vK=Kn(),EK={message:"must NOT have unevaluated properties",params:({params:e})=>Zt._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},jK={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:EK,code(e){let{gen:t,schema:n,data:r,errsCount:s,it:o}=e;if(!s)throw Error("ajv implementation error");let{allErrors:i,props:a}=o;if(a instanceof Zt.Name)t.if(Zt._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(c(a,d),()=>l(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?l(d):t.if(u(a,d),()=>l(d)));o.props=!0,e.ok(Zt._`${s} === ${vK.default.errors}`);function l(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Zd.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Zd.Type.Str},p),!i)t.if(Zt.not(p),()=>t.break())}}function c(d,p){return Zt._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let y in d)if(d[y]===!0)m.push(Zt._`${p} !== ${y}`);return Zt.and(...m)}}};rR.default=jK});var iR=W(function(oR){Object.defineProperty(oR,"__esModule",{value:!0});var vn=$e(),Qd=Oe(),_K={message:({params:{len:e}})=>vn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>vn._`{limit: ${e}}`},kK={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:_K,code(e){let{gen:t,schema:n,data:r,it:s}=e,o=s.items||0;if(o===!0)return;let i=t.const("len",vn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(vn._`${i} > ${o}`);else if(typeof n=="object"&&!Qd.alwaysValidSchema(s,n)){let l=t.var("valid",vn._`${i} <= ${o}`);t.if(vn.not(l),()=>a(l,o)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:Qd.Type.Num},l),!s.allErrors)t.if(vn.not(l),()=>t.break())})}}};oR.default=kK});var lR=W(function(aR){Object.defineProperty(aR,"__esModule",{value:!0});var AK=sR(),CK=iR(),RK=[AK.default,CK.default];aR.default=RK});var uR=W(function(cR){Object.defineProperty(cR,"__esModule",{value:!0});var ve=$e(),TK={message:({schemaCode:e})=>ve.str`must match format "${e}"`,params:({schemaCode:e})=>ve._`{format: ${e}}`},JK={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:TK,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;if(s)p();else m();function p(){let y=n.scopeValue("formats",{ref:d.formats,code:l.code.formats}),S=n.const("fDef",ve._`${y}[${i}]`),g=n.let("fType"),x=n.let("format");n.if(ve._`typeof ${S} == "object" && !(${S} instanceof RegExp)`,()=>n.assign(g,ve._`${S}.type || "string"`).assign(x,ve._`${S}.validate`),()=>n.assign(g,ve._`"string"`).assign(x,S)),e.fail$data(ve.or(P(),w()));function P(){if(l.strictSchema===!1)return ve.nil;return ve._`${i} && !${x}`}function w(){let E=u.$async?ve._`(${S}.async ? await ${x}(${r}) : ${x}(${r}))`:ve._`${x}(${r})`,j=ve._`(typeof ${x} == "function" ? ${E} : ${x}.test(${r}))`;return ve._`${x} && ${x} !== true && ${g} === ${t} && !${j}`}}function m(){let y=d.formats[o];if(!y){P();return}if(y===!0)return;let[S,g,x]=w(y);if(S===t)e.pass(E());function P(){if(l.strictSchema===!1){d.logger.warn(j());return}throw Error(j());function j(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function w(j){let A=j instanceof RegExp?ve.regexpCode(j):l.code.formats?ve._`${l.code.formats}${ve.getProperty(o)}`:void 0,T=n.scopeValue("formats",{key:o,ref:j,code:A});if(typeof j=="object"&&!(j instanceof RegExp))return[j.type||"string",j.validate,ve._`${T}.validate`];return["string",j,T]}function E(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!u.$async)throw Error("async format in sync schema");return ve._`await ${x}(${r})`}return typeof g=="function"?ve._`${x}(${r})`:ve._`${x}.test(${r})`}}}};cR.default=JK});var fb=W(function(fR){Object.defineProperty(fR,"__esModule",{value:!0});var IK=uR(),DK=[IK.default];fR.default=DK});var db=W(function(dR){Object.defineProperty(dR,"__esModule",{value:!0});dR.contentVocabulary=dR.metadataVocabulary=void 0;dR.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];dR.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var hR=W(function(mR){Object.defineProperty(mR,"__esModule",{value:!0});var VK=rb(),qK=sb(),HK=lb(),WK=UC(),BK=nR(),UK=lR(),zK=fb(),ep=db(),KK=[WK.default,VK.default,qK.default,(0,HK.default)(!0),zK.default,ep.metadataVocabulary,ep.contentVocabulary,BK.default,UK.default];mR.default=KK});var bR=W(function(yR){Object.defineProperty(yR,"__esModule",{value:!0});yR.DiscrError=void 0;var gR;(function(e){e.Tag="tag",e.Mapping="mapping"})(gR||(yR.DiscrError=gR={}))});var pb=W(function(SR){Object.defineProperty(SR,"__esModule",{value:!0});var Zn=$e(),wa=bR(),tp=fc(),XK=da(),$R=Oe(),YK={message:({params:{discrError:e,tagName:t}})=>e===wa.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>Zn._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},ZK={keyword:"discriminator",type:"object",schemaType:"object",error:YK,code(e){let{gen:t,data:n,schema:r,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",Zn._`${n}${Zn.getProperty(a)}`);t.if(Zn._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:wa.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=p();t.if(!1);for(let y in m)t.elseIf(Zn._`${c} === ${y}`),t.assign(l,d(m[y]));t.else(),e.error(!1,{discrError:wa.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let y=t.name("valid"),S=e.subschema({keyword:"oneOf",schemaProp:m},y);return e.mergeEvaluated(S,Zn.Name),y}function p(){var m;let y={},S=x(s),g=!0;for(let E=0;E<i.length;E++){let j=i[E];if((j===null||j===void 0?void 0:j.$ref)&&!$R.schemaHasRulesButRef(j,o.self.RULES)){let T=j.$ref;if(j=tp.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),j instanceof tp.SchemaEnv)j=j.schema;if(j===void 0)throw new XK.default(o.opts.uriResolver,o.baseId,T)}let A=(m=j===null||j===void 0?void 0:j.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}"`);g=g&&(S||x(j)),P(A,E)}if(!g)throw Error(`discriminator: "${a}" must be required`);return y;function x({required:E}){return Array.isArray(E)&&E.includes(a)}function P(E,j){if(E.const)w(E.const,j);else if(E.enum)for(let A of E.enum)w(A,j);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(E,j){if(typeof E!="string"||E in y)throw Error(`discriminator: "${a}" values must be unique strings`);y[E]=j}}}};SR.default=ZK});var wR=W(function(Vse,e9){e9.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 vR=W(function(qse,t9){t9.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 ER=W(function(Hse,n9){n9.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 jR=W(function(Wse,r9){r9.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 PR=W(function(Bse,s9){s9.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 _R=W(function(Use,o9){o9.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 kR=W(function(zse,i9){i9.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 OR=W(function(Kse,a9){a9.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 CR=W(function(AR){Object.defineProperty(AR,"__esModule",{value:!0});var l9=wR(),c9=vR(),u9=ER(),f9=jR(),d9=PR(),p9=_R(),m9=kR(),h9=OR(),g9=["/properties"];function y9(e){return[l9,c9,u9,f9,d9,t(this,p9),m9,t(this,h9)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,g9):r}}AR.default=y9});var gb=W(function(En,hb){Object.defineProperty(En,"__esModule",{value:!0});En.MissingRefError=En.ValidationError=En.CodeGen=En.Name=En.nil=En.stringify=En.str=En._=En.KeywordCxt=En.Ajv2020=void 0;var b9=nb(),$9=hR(),S9=pb(),w9=CR(),mb="https://json-schema.org/draft/2020-12/schema";class mc extends b9.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),$9.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(S9.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;w9.default.call(this,e),this.refs["http://json-schema.org/schema"]=mb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(mb)?mb:void 0)}}En.Ajv2020=mc;hb.exports=En=mc;hb.exports.Ajv2020=mc;Object.defineProperty(En,"__esModule",{value:!0});En.default=mc;var v9=ua();Object.defineProperty(En,"KeywordCxt",{enumerable:!0,get:function(){return v9.KeywordCxt}});var va=$e();Object.defineProperty(En,"_",{enumerable:!0,get:function(){return va._}});Object.defineProperty(En,"str",{enumerable:!0,get:function(){return va.str}});Object.defineProperty(En,"stringify",{enumerable:!0,get:function(){return va.stringify}});Object.defineProperty(En,"nil",{enumerable:!0,get:function(){return va.nil}});Object.defineProperty(En,"Name",{enumerable:!0,get:function(){return va.Name}});Object.defineProperty(En,"CodeGen",{enumerable:!0,get:function(){return va.CodeGen}});var E9=cc();Object.defineProperty(En,"ValidationError",{enumerable:!0,get:function(){return E9.default}});var j9=da();Object.defineProperty(En,"MissingRefError",{enumerable:!0,get:function(){return j9.default}})});import{existsSync as rp,readFileSync as TR}from"node:fs";import{createRequire as RR}from"node:module";import{basename as k9,isAbsolute as O9,relative as A9,resolve as yb}from"node:path";import{fileURLToPath as NR,pathToFileURL as C9}from"node:url";function np(e){return JSON.parse(TR(e,"utf8"))}async function JR(e){let t=yb(e),n=qn(t),r=yb(t,"project.schema.json");if(!rp(n))throw Error(`No project.jxn or project.json in ${t}`);if(!rp(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=lu(TR(n,"utf8"),n),o=np(r);o.$id=C9(r).href;let i;try{({default:i}=await Promise.resolve().then(() => Sr(gb(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new i({allErrors:!0,loadSchema:(d)=>T9(d,t),strict:!1}).compileAsync(o),c=l(s),u=l.errors??null;return{errors:u&&rs(n)?N9(u,s):u,file:k9(n),valid:c}}function R9(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");n=Array.isArray(n)?n[Number(s)]:L(n)?n[s]:void 0}return n}function N9(e,t){return e.map((n)=>{if(!D(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!D(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!k(n.instancePath))return n;let r=R9(t,n.instancePath),s=ft(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
|
|
637
|
+
`)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function T9(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 n=NR(e),r=A9(t,n);if(r.startsWith("..")||O9(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(rp(n))return np(n);let s=r.split("\\").join("/"),o="node_modules/",i=s.lastIndexOf(o);if(i===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(i+o.length),l="@jxsuite/schema/",c;try{c=RR(yb(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=RR(import.meta.url).resolve(a)}catch(d){let p=NR(new URL(`../${a.slice(l.length)}`,import.meta.url));if(rp(p))return np(p);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:d})}}return np(c)}var MR=J(()=>{ce();Qc();iu();cu();Eo()});function zr(e){return L(e.attributes)?e.attributes:{}}function Qt(e,t){let n=zr(e)[t];return k(n)?n:null}function Et(e){return k(e.tagName)?e.tagName.toLowerCase():""}function cn(e,t="the popover"){let n=k(e.id)?e.id:Qt(e,"id");if(n)return`#${n}`;let r=Et(e);return r===""?t:`the <${r}>`}function I9(e){let t=zr(e).popover;return k(t)?t:null}function DR(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&k(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if(xb(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&D9.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function xb(e){return"popover"in zr(e)||"popover"in e}function hc(e,t){return xb(e)||(t?.popoverTags?.has(Et(e))??!1)}function io(e){if(k(e.id)&&e.id!=="")return e.id;let t=Qt(e,"id");return t===""?null:t}function*Ur(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=hc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[l,c]of o.entries())if(D(c))yield*Ur(c,[...t,"children",l],s,r)}else if(L(o)&&Ot(o.map))yield*Ur(o.map,[...t,"children","map"],s,r);let i=Ot(e.map)?e.map:null;if(i)yield*Ur(i,[...t,"map"],s,r);let a=L(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(D(c))yield*Ur(c,[...t,"cases",l],s,r)}function bb(e,t){let n=[];for(let{node:r}of Ur(e,[],null,t)){if(!hc(r,t))continue;let s=io(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function sp(e){return e.startsWith("@")}function LR(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function ln(e,t){let n=e?.[t];if(n===void 0||mo(n)||Array.isArray(n))return null;return String(n)}function FR(e){for(let[t,n]of Object.entries(e??{})){if(!mo(n))continue;if(LR(t)&&t.includes(":popover-open")&&ln(n,"display")!==null)return!0;if(sp(t)&&FR(n))return!0}return!1}function VR(e){for(let[t,n]of Object.entries(e??{})){if(!mo(n))continue;if(LR(t)&&t.includes(":popover-open"))return!0;if(sp(t)&&VR(n))return!0}return!1}function F9(e){return L9.some((t)=>ln(e,t)!==null)}function V9(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(sp(n)&&mo(r)&&ln(r,"display")!==null)t.push(n);return t}function qR(e){if(!e)return[];let t=[],n=ln(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(sp(r)&&mo(s))t.push(...qR(s));return t}function q9(e){if(!e)return!1;if(ln(e,"positionAnchor")!==null||ln(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(ln(e,t)??"").includes("anchor("))}function H9(e){if(!e)return!1;if(ln(e,"positionArea")!==null||ln(e,"position-area")!==null||ln(e,"positionTryFallbacks")!==null||ln(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function HR(e,t){let n=[...Ur(e,[],null,t)],r=bb(e,t),s=n.some(({node:a})=>hc(a,t)),o=new Set;for(let{node:a}of n)if(IR.has(Et(a))){let l=Qt(a,"popovertarget");if(l!==null)o.add(l)}let i=[];for(let{enclosing:a,node:l,path:c}of n)if(i.push(...W9(l,c,a,r,s,t)),xb(l))i.push(...B9(l,c,o));return i}function W9(e,t,n,r,s,o){let i=[],a=Et(e),l=Qt(e,"popovertarget"),c=IR.has(a)||(o?.invokerTags?.has(a)??!1);if(l!==null&&!c)return i.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. ${st}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(l!==null){if(s&&!r.includes(l)){let u=r.length>0?`The popovers here are: ${r.map((d)=>`"${d}"`).join(", ")}. `:"";i.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${u}A target that names nothing does nothing, silently. ${st}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&io(n)!==null&&io(n)!==l)i.push({detail:`This control is inside ${cn(n)} 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. ${st}`,message:`A control inside ${cn(n)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&l===null){let u=Qt(e,"href")??(k(e.href)?e.href:null),d=Qt(e,"target")==="_blank",p=u!==null&&u.includes("#");if(d||p){let m=d?"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. ";i.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. ${st}`,message:`A link inside ${cn(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function B9(e,t,n){let r=[],{style:s}=e,o=cn(e),i=I9(e);if(i!==null&&i!==""&&!M9.some((c)=>c===i))r.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". ${st}`,fix:"mode",message:`${o} declares popover="${i}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(Ge(zr(e).popover))r.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". ${st}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=ln(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")r.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. ${st}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of V9(s))r.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. ${st}`,fix:"display",message:`${o} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(ln(s,"visibility")!==null)r.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. ${st}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!VR(s))r.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. ${st}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!FR(s)&&a===null&&F9(s))r.push({detail:`${o} 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\`. ${st}`,fix:"open-display",message:`${o} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of qR(s))if(c.includes("display")&&!c.includes("overlay")){r.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. ${st}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(q9(s)&&!H9(s))r.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. ${st}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=io(e);if(l!==null&&!n.has(l))r.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. ${st}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var M9,IR,D9,L9,st="See docs/framework/concepts/overlays.";var op=J(()=>{ce();M9=["auto","manual","hint"],IR=new Set(["button","input"]);D9=["popovertarget","popovertargetaction","command","commandfor"];L9=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function _a(e,t){let n=zr(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(me(r)||L(r))return{kind:"bound"};if(k(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function ja(e,t){let n=_a(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function en(e,t){return _a(e,t).kind!=="absent"}function ao(e){let t=_a(e,"role");if(t.kind==="bound")return Pa;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function ip(e){let t=_a(e,"id");if(t.kind==="bound")return Pa;return t.kind==="text"&&t.text!==""?t.text:null}function Qn(e,t){let n=_a(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function ap(e){let t=e.textContent;if(k(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Qn(e,"aria-label")||en(e,"aria-labelledby"))return!0;if(Et(e)==="img"&&(Qn(e,"alt")||Qn(e,"title")))return!0;if(Et(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(k(s)){if(s.trim()!=="")return!0}else if(D(s)&&ap(s))return!0}else if(n!=null)return!0;if(L(e.map))return!0;return(L(e.cases)?Object.values(e.cases):[]).some((s)=>Ot(s)&&ap(s))}function*Ea(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,ao(e)],o=[...r,Et(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,l]of i.entries())if(D(l))yield*Ea(l,[...t,"children",a],s,o)}else if(L(i)&&Ot(i.map))yield*Ea(i.map,[...t,"children","map"],s,o);if(Ot(e.map))yield*Ea(e.map,[...t,"map"],s,o);if(L(e.cases)){for(let[a,l]of Object.entries(e.cases))if(D(l))yield*Ea(l,[...t,"cases",a],s,o)}}function Y9(e){return e.some((t)=>t.includes("-"))}function Kr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${U9}`,message:n,path:t,rule:e,severity:o}}function WR(e,t,n){if(n.includes("label"))return!0;if(e===Pa||t.bound)return!0;return e!==null&&t.ids.has(e)}function Z9(e,t){let{node:n,path:r,tags:s}=e,o=Et(n),i=ao(n);if(i==="bound")return null;if(Qn(n,"aria-label")||en(n,"aria-labelledby")||Qn(n,"title"))return null;let l=cn(n,"the control"),c=(d)=>Kr("interactive-unnamed",r,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${d}`,"4.1.2"),u=Q9(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&z9.has(i))return ap(n)?null:c("Give it text content, or an aria-label.");if(i!==null&&K9.has(i))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&en(n,"href"))return ap(n)?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 Q9(e,t,n,r){if(t==="area"){if(!en(e,"href"))return"none";return Qn(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return WR(ip(e),n,r)||Qn(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(ja(e,"type")??"text").toLowerCase();if(s==="hidden"||en(e,"type")&&ja(e,"type")===null)return"exempt";if(G9.has(s))return Qn(e,"value")?"named":"unnamed-value";if(s==="image")return Qn(e,"alt")?"named":"unnamed-alt";return WR(ip(e),n,r)||Qn(e,"placeholder")?"named":"unnamed"}function t4(e){let{node:t,path:n,tags:r}=e,s=Et(t);if(!s.includes("-")||!r.some((o)=>e4.has(o)))return null;return Kr("custom-element-in-select",n,`<${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 n4(e){let{node:t,path:n}=e;if(Et(t)!=="img")return null;let r=ao(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(en(t,"alt")||Qn(t,"aria-label")||en(t,"aria-labelledby"))return null;return Kr("img-alt-missing",n,`${cn(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 s4(e,t){let{node:n,path:r}=e,s=[];for(let o of r4){let i=ja(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Kr("aria-target-missing",r,`${cn(n,"the element")} points ${o} 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 o4(e,t,n){for(let r of BR.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===Pa&&s.ids.size>0)return!0;if(e!==null&&e!==Pa&&s.ids.has(e))return!0}return!1}function i4(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=ao(n);if(i===null||i==="bound"||r.length===0||Y9(o))return null;if(s.includes("bound")||o4(ip(n),i,t))return null;let a=cn(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Kr("tab-outside-tablist",r,`${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((i==="menuitem"||i==="menuitemcheckbox"||i==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Kr("menuitem-outside-menu",r,`${a} is a ${i} 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(i==="option"&&!s.includes("listbox")&&!o.includes("select")&&!o.includes("datalist"))return Kr("option-outside-listbox",r,`${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 a4(e){let t=[];for(let{node:n}of Ea(e)){if(ao(n)!=="tab")continue;let r=_a(n,"aria-selected");if(r.kind==="bound")return null;t.push(r.kind==="other"&&r.isTrue||r.kind==="text"&&r.text==="true")}return t}function l4(e){let{node:t,path:n}=e;if(ao(t)!=="tablist")return null;let r=a4(t);if(r===null||r.length===0||r.includes(!0))return null;return Kr("tablist-none-selected",n,`${cn(t,"the tablist")} has ${r.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 c4(e){let{node:t,path:n}=e,r=ao(t);if(!(Et(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(Qn(t,"aria-label")||en(t,"aria-labelledby"))return null;return Kr("dialog-unnamed",n,`${cn(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 f4(e){let{node:t,path:n}=e;if(!en(t,"aria-activedescendant"))return null;let r=Et(t);if(u4.has(r)||r==="a"&&en(t,"href")||en(t,"tabIndex")||en(t,"tabindex")||en(t,"contenteditable"))return null;return Kr("activedescendant-not-focusable",n,`${cn(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 UR(e){let t=[...Ea(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let l=ao(a);if(l!==null&&X9.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},d=ja(a,"aria-owns");if(d===null)u.bound||=en(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(l,u)}let c=ip(a);if(c===Pa)o=!0;else if(c!==null)n.add(c);if(Et(a)==="label"){let u=ja(a,"for")??ja(a,"htmlFor");if(u===null)r.bound||=en(a,"for")||en(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let l=[Z9(a,r),n4(a),i4(a,s),t4(a),l4(a),c4(a),f4(a)];for(let c of l)if(c)i.push(c);if(!o)i.push(...s4(a,n))}return i}var U9="See docs/framework/concepts/accessibility.",Pa="bound",z9,K9,G9,BR,X9,e4,r4,u4;var zR=J(()=>{ce();op();z9=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),K9=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),G9=new Set(["button","reset","submit"]),BR=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),X9=new Set([...BR.values()].flat());e4=new Set(["select","jx-select"]);r4=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];u4=new Set(["button","input","select","textarea"])});function $b(e){return Et(e)==="dialog"}function KR(e){return e.startsWith("--")}function x4(e){let t=[];for(let{node:n}of Ur(e)){let r=io(n);if($b(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function b4(e){let t=e.oncommand;return t!==void 0&&t!==null}function $4(e,t){for(let{node:n}of Ur(e)){if(n===e)continue;let r=Et(n);if(r==="button"){let s=Qt(n,"command"),o=Qt(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&Qt(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function XR(e,t){let n=[...Ur(e,[],null,t)],r=x4(e),s=bb(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:c}of n){let u=io(c);if(u!==null&&!i.has(u))i.set(u,c);if(Et(c)==="button"){let d=Qt(c,"commandfor"),p=Qt(c,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let l=[];for(let{node:c,path:u}of n)if(l.push(...S4(c,u,i,r,s,o,t)),$b(c))l.push(...w4(c,u,a));return l}function S4(e,t,n,r,s,o,i){let a=[],l=Et(e),c=i?.invokerTags?.has(l)??!1,u=Qt(e,"command"),d=Qt(e,"commandfor");if(!(u!==null||d!==null||("command"in zr(e))||("commandfor"in zr(e))))return a;let m=cn(e,"the element");if(!y4.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. ${st}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!h4.has(u)&&!KR(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${GR.map((y)=>`\`${y}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${st}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(d!==null){let y=n.get(d),S=r.includes(d),g=s.includes(d);if(!y&&o){let x=[...r,...s].map((P)=>`"${P}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${x}. A commandfor that names nothing does nothing, silently. ${st}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&y){if(d4.has(u)&&!$b(y))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${g?"a popover":`a <${Et(y)||"element"}>`}. The click is ignored. ${g?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${st}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(p4.has(u)&&!hc(y,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${S?"a dialog":`a <${Et(y)||"element"}>`} that declares no \`popover\`. The click is ignored. ${S?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${st}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(KR(u)&&!b4(y))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${d}" 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. ${st}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function w4(e,t,n){let r=[],s=cn(e,"the dialog"),o=io(e),{style:i}=e,a=Qt(e,"closedby");if(a!==null&&!g4.has(a))r.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. ${st}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(ln(i,"display")!==null)r.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. ${st}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=o===null?void 0:n.get(o),c=Qt(e,"open")!==null||zr(e).open===!0||e.open===!0;if(o!==null&&!l?.has("show-modal")&&!c)r.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. ${st}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!$4(e,o))r.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"\`. ${st}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var GR,d4,p4,m4,h4,g4,y4;var YR=J(()=>{ce();op();GR=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],d4=new Set(["show-modal","close","request-close"]),p4=new Set(["toggle-popover","show-popover","hide-popover"]),m4=["any","closerequest","none"],h4=new Set(GR),g4=new Set(m4),y4=new Set(["button"])});var aN=W(function(oN){Object.defineProperty(oN,"__esModule",{value:!0});oN.formatNames=oN.fastFormats=oN.fullFormats=void 0;function Gr(e,t){return{validate:e,compare:t}}oN.fullFormats={date:Gr(tN,Eb),time:Gr(wb(!0),jb),"date-time":Gr(ZR(!0),rN),"iso-time":Gr(wb(),nN),"iso-date-time":Gr(ZR(),sN),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:k4,"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:J4,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:O4,int32:{type:"number",validate:R4},int64:{type:"number",validate:N4},float:{type:"number",validate:eN},double:{type:"number",validate:eN},password:!0,binary:!0};oN.fastFormats={...oN.fullFormats,date:Gr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Eb),time:Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,jb),"date-time":Gr(/^\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,rN),"iso-time":Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,nN),"iso-date-time":Gr(/^\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,sN),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};oN.formatNames=Object.keys(oN.fullFormats);function v4(e){return e%4===0&&(e%100!==0||e%400===0)}var E4=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,j4=[0,31,28,31,30,31,30,31,31,30,31,30,31];function tN(e){let t=E4.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&v4(n)?29:j4[r])}function Eb(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Sb=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function wb(e){return function(n){let r=Sb.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],l=r[5]==="-"?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*l,p=s-c*l-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function jb(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function nN(e,t){if(!(e&&t))return;let n=Sb.exec(e),r=Sb.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var vb=/t|\s/i;function ZR(e){let t=wb(e);return function(r){let s=r.split(vb);return s.length===2&&tN(s[0])&&t(s[1])}}function rN(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function sN(e,t){if(!(e&&t))return;let[n,r]=e.split(vb),[s,o]=t.split(vb),i=Eb(n,s);if(i===void 0)return;return i||jb(r,o)}var P4=/\/|:/,_4=/^(?:[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 k4(e){return P4.test(e)&&_4.test(e)}var QR=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function O4(e){return QR.lastIndex=0,QR.test(e)}var A4=-2147483648,C4=2147483647;function R4(e){return Number.isInteger(e)&&e<=C4&&e>=A4}function N4(e){return Number.isInteger(e)}function eN(){return!0}var T4=/[^\\]\\Z/;function J4(e){if(T4.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var cN=W(function(lN){Object.defineProperty(lN,"__esModule",{value:!0});var I4=rb(),D4=sb(),L4=lb(),F4=fb(),lp=db(),V4=[I4.default,D4.default,(0,L4.default)(),F4.default,lp.metadataVocabulary,lp.contentVocabulary];lN.default=V4});var uN=W(function(Eoe,H4){H4.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 dN=W(function(jn,_b){Object.defineProperty(jn,"__esModule",{value:!0});jn.MissingRefError=jn.ValidationError=jn.CodeGen=jn.Name=jn.nil=jn.stringify=jn.str=jn._=jn.KeywordCxt=jn.Ajv=void 0;var W4=nb(),B4=cN(),U4=pb(),fN=uN(),z4=["/properties"],cp="http://json-schema.org/draft-07/schema";class gc extends W4.default{_addVocabularies(){if(super._addVocabularies(),B4.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(U4.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(fN,z4):fN;this.addMetaSchema(e,cp,!1),this.refs["http://json-schema.org/schema"]=cp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(cp)?cp:void 0)}}jn.Ajv=gc;_b.exports=jn=gc;_b.exports.Ajv=gc;Object.defineProperty(jn,"__esModule",{value:!0});jn.default=gc;var K4=ua();Object.defineProperty(jn,"KeywordCxt",{enumerable:!0,get:function(){return K4.KeywordCxt}});var ka=$e();Object.defineProperty(jn,"_",{enumerable:!0,get:function(){return ka._}});Object.defineProperty(jn,"str",{enumerable:!0,get:function(){return ka.str}});Object.defineProperty(jn,"stringify",{enumerable:!0,get:function(){return ka.stringify}});Object.defineProperty(jn,"nil",{enumerable:!0,get:function(){return ka.nil}});Object.defineProperty(jn,"Name",{enumerable:!0,get:function(){return ka.Name}});Object.defineProperty(jn,"CodeGen",{enumerable:!0,get:function(){return ka.CodeGen}});var G4=cc();Object.defineProperty(jn,"ValidationError",{enumerable:!0,get:function(){return G4.default}});var X4=da();Object.defineProperty(jn,"MissingRefError",{enumerable:!0,get:function(){return X4.default}})});var hN=W(function(mN){Object.defineProperty(mN,"__esModule",{value:!0});mN.formatLimitDefinition=void 0;var pN=dN(),xt=$e(),lo=xt.operators,up={formatMaximum:{okStr:"<=",ok:lo.LTE,fail:lo.GT},formatMinimum:{okStr:">=",ok:lo.GTE,fail:lo.LT},formatExclusiveMaximum:{okStr:"<",ok:lo.LT,fail:lo.GTE},formatExclusiveMinimum:{okStr:">",ok:lo.GT,fail:lo.LTE}},Q4={message:({keyword:e,schemaCode:t})=>xt.str`should be ${up[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>xt._`{comparison: ${up[e].okStr}, limit: ${t}}`};mN.formatLimitDefinition={keyword:Object.keys(up),type:"string",schemaType:"string",$data:!0,error:Q4,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let l=new pN.KeywordCxt(o,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",xt._`${p}[${l.schemaCode}]`);e.fail$data(xt.or(xt._`typeof ${m} != "object"`,xt._`${m} instanceof RegExp`,xt._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=l.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let y=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?xt._`${i.code.formats}${xt.getProperty(p)}`:void 0});e.fail$data(d(y))}function d(p){return xt._`${p}.compare(${n}, ${r}) ${up[s].fail} 0`}},dependencies:["format"]};var e3=(e)=>(e.addKeyword(mN.formatLimitDefinition),e);mN.default=e3});var bN=W(function(yc,xN){Object.defineProperty(yc,"__esModule",{value:!0});var er=aN(),n3=hN(),Oa=$e(),gN=new Oa.Name("fullFormats"),r3=new Oa.Name("fastFormats"),Ob=(e,t={keywords:!0})=>{if(Array.isArray(t))return yN(e,t,er.fullFormats,gN),e;let[n,r]=t.mode==="fast"?[er.fastFormats,r3]:[er.fullFormats,gN],s=t.formats||er.formatNames;if(yN(e,s,n,r),t.keywords)(0,n3.default)(e);return e};Ob.get=(e,t="full")=>{let r=(t==="fast"?er.fastFormats:er.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function yN(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=Oa._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}xN.exports=yc=Ob;Object.defineProperty(yc,"__esModule",{value:!0});yc.default=Ob});import{existsSync as wN,readFileSync as Cb,readdirSync as vN,statSync as EN}from"node:fs";import{createRequire as s3}from"node:module";import{join as jN,relative as Aa,resolve as Ab}from"node:path";async function l3(){try{let{default:e}=await Promise.resolve().then(() => Sr(gb(),1)),{default:t}=await Promise.resolve().then(() => Sr(bN(),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 PN(e,t={}){let n=Ab(e),r=[],s=[],o=0;for(let w of["project.schema.json","document.schema.json"]){let E=Ab(n,w);if(!wN(E))continue;o+=1;let j=xc(E),A=d3(j);if(A.length>0)r.push({errors:A.map(({reason:T,ref:I})=>({message:`$ref "${I}" ${T} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:w})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await JR(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let{addFormats:a,Ajv:l}=await l3(),{document:c}=await MP(n,{write:!1}),u=new l({allErrors:!0,ownProperties:!0,strict:!1});a(u);let d=u.compile(c),p=DR(SN(n).flatMap((w)=>{try{return[JSON.parse(Cb(w,"utf8"))]}catch{return[]}}));for(let w of o3)for(let E of ON(Ab(n,w))){if(E.endsWith(".class.json"))continue;o+=1;let j=c3(E,Aa(n,E));if(s.push(...j.warnings),j.failure!==null){r.push(j.failure);continue}let A=j.document,T=$N(A,Aa(n,E));if(s.push(...T.warnings),T.failure!==null){r.push(T.failure);continue}if(d(A))s.push(...f3(A,Aa(n,E),p));else r.push({errors:d.errors??[],file:Aa(n,E)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let y=m.compile(yx());for(let w of SN(n)){o+=1;let E=xc(w),j=$N(E,Aa(n,w));if(s.push(...j.warnings),j.failure!==null)r.push(j.failure);else if(!y(E))r.push({errors:y.errors??[],file:Aa(n,w)})}let{config:S}=As(n),g=await Os(n,S),x=s3(import.meta.url);for(let w of g.extensions)for(let E of["project","document","fields"]){let j=w.schemas[E];if(!j)continue;o+=1;let A=new l({allErrors:!0,ownProperties:!0,strict:!1});a(A);for(let T of a3){let I=x.resolve(T);A.addSchema(xc(I))}try{A.compile(xc(j))}catch(T){r.push({errors:[{message:T instanceof Error?T.message:String(T)}],file:`${w.specifier} (${E} fragment)`})}}let P=t.strict===!0&&s.some((w)=>w.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!P}}function c3(e,t){if(!rs(e))return{document:xc(e),failure:null,warnings:[]};let n=Cb(e,"utf8"),r=Bp(n).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:u3(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:be(s)}],file:t},warnings:r}}}function $N(e,t){let n=[];try{il(e,t,n)}catch(s){return{failure:{errors:[{message:be(s)}],file:t},warnings:[]}}return{failure:null,warnings:n.map(({pointer:s,problem:o})=>({detail:o.message,file:t,message:`${s} (line ${o.line}, column ${o.column}): ${o.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function u3(e){let t=vo(e);return L(t)?t:null}function xc(e){return JSON.parse(Cb(e,"utf8"))}function f3(e,t,n){let r=[];for(let s of HR(e,n))r.push({...fp(s),file:t,source:"popover"});for(let s of XR(e,n))r.push({...fp(s),file:t,source:"dialog"});for(let s of UR(e))r.push({...fp(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of wv(e))r.push({...fp({...s,severity:"info"}),file:t,source:"module"});return r}function fp(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function _N(e){return e.lint.map((t)=>{let n=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${n}]`})}function d3(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!D(i))return!1;if(i=i[l],i===void 0)return!1}return!0},s=(o)=>{if(!L(o)||n.has(o))return;n.add(o);let i=o.$ref;if(k(i)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(i))t.push({reason:"is an absolute URI editors resolve over the network",ref:i});else if(!i.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:i});else if(i.length>1&&!i.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:i});else if(i.length>1&&!r(i.slice(1)))t.push({reason:"points at no node in this document",ref:i})}for(let[a,l]of Object.entries(o)){if(!p3.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(L(l)){if(s(l),kN.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function ON(e){if(!wN(e))return[];let t=[];for(let n of vN(e)){let r=jN(e,n);if(EN(r).isDirectory())t.push(...ON(r));else if(Vn(n))t.push(r)}return t.toSorted()}function SN(e){let t=[],n=(r)=>{for(let s of vN(r)){if(i3.has(s))continue;let o=jN(r,s);if(EN(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function AN(e){let t=[];for(let n of e.issues){t.push(`${n.file}:`);for(let r of n.errors){let s=L(r)?r:{},{instancePath:o,message:i}=s;t.push(` - ${o||"/"}: ${i??JSON.stringify(r)}`)}}return t}var o3,i3,a3,kN,p3;var CN=J(()=>{os();Lt();Ru();o_();MR();zR();YR();Ti();op();ce();is();bi();hx();o3=["components","pages","layouts"],i3=new Set(["node_modules","dist",".git"]),a3=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];kN=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),p3=new Set([...kN,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});Lt();import{relative as Rb,resolve as RN}from"node:path";async function m3(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
|
|
622
638
|
|
|
623
639
|
Commands:
|
|
624
640
|
build [root] Build a Jx site to dist/
|
|
@@ -642,8 +658,8 @@ Options:
|
|
|
642
658
|
--strict validate: fail on an overlay or accessibility lint error, not only a schema error
|
|
643
659
|
--to <format> convert: jxn or json
|
|
644
660
|
--drop-comments convert: convert a .jxn file to .json even though it has comments
|
|
645
|
-
--check format: write nothing, and fail when a file would change`),process.exit(0);if(t==="convert"||t==="format"){try{if(t==="convert"){await Promise.resolve().then(() =>
|
|
646
|
-
Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() =>
|
|
647
|
-
Build completed with ${
|
|
648
|
-
Done: ${
|
|
649
|
-
Run "jx --help" for usage.`),process.exit(1)}var
|
|
661
|
+
--check format: write nothing, and fail when a file would change`),process.exit(0);if(t==="convert"||t==="format"){try{if(t==="convert"){await Promise.resolve().then(() => n$());t$(process.cwd(),e.slice(1))}else{await Promise.resolve().then(() => s$());r$(process.cwd(),e.slice(1))}}catch(d){console.error(be(d)),process.exit(1)}return}let n=t==="db",r=n?e[1]:null,s=e.slice(n?2:1),o=new Set,i=[],a,l;for(let d=0;d<s.length;d+=1){let p=s[d];if(p==="--connection")d+=1,a=s[d];else if(p==="--port"){d+=1;let m=Math.trunc(Number(s[d]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(p.startsWith("--"))o.add(p);else i.push(p)}let[c]=i,u=RN(c??".");if(n){if(r!=="push")console.error(`Unknown db subcommand: ${r??"(none)"}
|
|
662
|
+
Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() => MS());let m={dryRun:d};if(a!==void 0)m.connection=a;let{results:y,bindingsPatched:S,wranglerPath:g}=await JS(u,m);for(let x of y){let P=x.applied?"applied":"dry-run";console.log(`${x.connection} (${x.provider}) — ${x.tables.length} table(s), ${x.statements.length} statement(s) [${P}]`);for(let w of x.statements)console.log(` ${w}`);for(let w of x.warnings)console.warn(` warning: ${w}`)}if(S&&g)console.log(`Updated bindings in ${Rb(u,g)}`)}catch(p){console.error(`db push failed: ${be(p)}`),process.exit(1)}return}if(t==="build"){let d=o.has("--verbose"),p=!o.has("--no-clean"),m=o.has("--include-held");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => xP());await Promise.resolve().then(() => bi());let g=!o.has("--no-optimize-images")&&!RS(process.env.JX_IMAGES_OPTIMIZE),x=await fP(u,{clean:p,includeHeld:m,optimizeImages:g,verbose:d});if(x.errors.length>0){console.error(`
|
|
663
|
+
Build completed with ${x.errors.length} error(s):`);for(let P of x.errors)console.error(` - ${P}`);process.exit(1)}console.log(`
|
|
664
|
+
Done: ${x.routes} routes → ${x.files} files`)}catch(y){console.error(`Build failed: ${be(y)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => $P());bP(u,l)}catch(d){console.error(be(d)),process.exit(1)}else if(t==="preview"){let{existsSync:d}=await import("node:fs"),p=RN(u,"dist");if(!d(p))console.error(`No build output at ${p} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => EP());let y=l??4173;vP(p,y),console.log(`Previewing ${p} at http://localhost:${y}`)}else if(t==="schema")try{await Promise.resolve().then(() => hx());let{projectSchemaPath:p,documentSchemaPath:m}=await JP(u);console.log(`Wrote ${Rb(u,p)}`),console.log(`Wrote ${Rb(u,m)}`)}catch(d){console.error(`Schema generation failed: ${be(d)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => CN());let y=await PN(u,{strict:o.has("--strict")}),S=_N(y);if(y.valid){console.log(`Project is valid (${y.checked} files checked in ${u})`);for(let g of S)console.log(g)}else{console.error(`Project is INVALID (${u}):`);for(let g of[...AN(y),...S])console.error(g);process.exit(1)}}catch(d){console.error(`Validation failed: ${be(d)}`),process.exit(1)}else console.error(`Unknown command: ${t}
|
|
665
|
+
Run "jx --help" for usage.`),process.exit(1)}var Qoe=m3();export{Qoe as ready};
|