@jxsuite/compiler 9.0.1 → 9.1.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/compiler.js CHANGED
@@ -1,88 +1,93 @@
1
- import{createRequire as jc}from"node:module";var wc=Object.create;var{getPrototypeOf:Ec,defineProperty:ii,getOwnPropertyNames:Jc}=Object;var ai=Object.prototype.hasOwnProperty;function Oc(e){return this[e]}var Nc,Ac,sd=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?Nc??=new WeakMap:Ac??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?wc(Ec(e)):{};let i=t||!e||!e.__esModule||!ai.call(e,"default")?ii(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let l of Jc(e))if(!ai.call(i,l))ii(i,l,{get:Oc.bind(e,l),enumerable:!0})}if(r)s.set(e,i);return i};var od=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var N=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var ad=jc(import.meta.url);function y(e){return typeof e==="string"}function le(e){return typeof e==="number"}function Se(e){return typeof e==="boolean"}function Je(e){return typeof e==="function"}function E(e){return typeof e==="object"&&e!==null}function C(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function U(e){return C(e)&&typeof e.$ref==="string"}function oe(e){return C(e)&&e.$prototype==="Function"}function Oe(e){return C(e)&&C(e.$expression)}function Ye(e){return Oe(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function Le(e){return oe(e)&&Array.isArray(e.body)}function ct(e){return C(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function Xe(e){return C(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function ui(e){return C(e)&&!e.$prototype&&!e.$expression&&"default"in e}function ut(e){if(!C(e))return!1;for(let t of Object.keys(e))if(!fi.has(t))return!1;return!0}function se(e){return C(e)&&e.$prototype==="Array"}function ds(e){return(Array.isArray(e)?e:[e]).some((n)=>se(n))}function pi(e){return C(e)&&e.$prototype==="Class"}function yn(e){return C(e)}function V(e){return typeof e==="string"&&e.includes("${")}function di(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(wt(e))}function ms(e){return e.$prototype==="Function"||y(e.role)&&e.role!=="field"}function wt(e){if(!/[/'"`]/u.test(e))return e;let t=Qn.get(e);if(t!==void 0)return t;let n=hi(e);if(Qn.size>=mi)Qn.clear();return Qn.set(e,n),n}function gi(e){if(!e.includes("${"))return Cc;let t=er.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];hi(e.slice(r),s);let o=-1;for(let l=0;l<s.length;l+=2){let a=r+(s[l]??0),c=s[l+1]??-1;if(c===-1){o=a;break}n.push(li(e,a,r+c))}if(o===-1)break;let i=vc(e,o);if(i===-1)r=o+2;else n.push(li(e,o,i)),r=i}if(er.size>=mi)er.clear();return er.set(e,n),n}function li(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function vc(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 Rc(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function ci(e,t){let n=!1;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s===`
2
- `)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 hi(e,t){let n=e.split(""),r=(c)=>{if(n[c]!==void 0&&n[c]!==`
1
+ import{createRequire as Mu}from"node:module";var Tu=Object.create;var{getPrototypeOf:Ru,defineProperty:Ni,getOwnPropertyNames:Pu}=Object;var Ti=Object.prototype.hasOwnProperty;function ku(e){return this[e]}var _u,Du,Hg=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?_u??=new WeakMap:Du??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?Tu(Ru(e)):{};let i=t||!e||!e.__esModule||!Ti.call(e,"default")?Ni(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let l of Pu(e))if(!Ti.call(i,l))Ni(i,l,{get:ku.bind(e,l),enumerable:!0})}if(r)s.set(e,i);return i};var Bg=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var S=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var Ug=Mu(import.meta.url);function b(e){return typeof e==="string"}function ne(e){return typeof e==="number"}function be(e){return typeof e==="boolean"}function Ae(e){return typeof e==="function"}function E(e){return typeof e==="object"&&e!==null}function C(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Y(e){return C(e)&&typeof e.$ref==="string"}function ue(e){return C(e)&&e.$prototype==="Function"}function Ce(e){return C(e)&&C(e.$expression)}function et(e){return Ce(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function Be(e){return ue(e)&&Array.isArray(e.body)}function tt(e){return C(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function nt(e){return C(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function ki(e){return C(e)&&!e.$prototype&&!e.$expression&&"default"in e}function ft(e){if(!C(e))return!1;for(let t of Object.keys(e))if(!_i.has(t))return!1;return!0}function le(e){return C(e)&&e.$prototype==="Array"}function Di(e){return(Array.isArray(e)?e:[e]).some((n)=>le(n))}function Mi(e){return C(e)&&e.$prototype==="Class"}function wn(e){return C(e)}function B(e){return typeof e==="string"&&e.includes("${")}function Ii(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(jt(e))}function Ts(e){return e.$prototype==="Function"||b(e.role)&&e.role!=="field"}function jt(e){if(!/[/'"`]/u.test(e))return e;let t=lr.get(e);if(t!==void 0)return t;let n=Vi(e);if(lr.size>=Li)lr.clear();return lr.set(e,n),n}function Fi(e){if(!e.includes("${"))return Iu;let t=cr.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];Vi(e.slice(r),s);let o=-1;for(let l=0;l<s.length;l+=2){let a=r+(s[l]??0),c=s[l+1]??-1;if(c===-1){o=a;break}n.push(Ri(e,a,r+c))}if(o===-1)break;let i=Lu(e,o);if(i===-1)r=o+2;else n.push(Ri(e,o,i)),r=i}if(cr.size>=Li)cr.clear();return cr.set(e,n),n}function Ri(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function Lu(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 Vu(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function Pi(e,t){let n=!1;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s===`
2
+ `)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 Vi(e,t){let n=e.split(""),r=(c)=>{if(n[c]!==void 0&&n[c]!==`
3
3
  `)n[c]=" "},s=[],o=t!==void 0,i="",l=-1,a=0;while(a<e.length){let c=e.charAt(a);if(o)if(c==="\\")r(a),r(a+1),a+=2;else if(c==="`"&&!(t&&s.length===0))o=!1,i=c,a+=1;else if(c==="$"&&e.charAt(a+1)==="{"){if(s.length===0)t?.push(a,-1);s.push(0),o=!1,i="{",a+=2}else r(a),a+=1;else if(c==="/"&&e.charAt(a+1)==="/")while(a<e.length&&e.charAt(a)!==`
4
- `)r(a),a+=1;else if(c==="/"&&e.charAt(a+1)==="*"){let u=e.indexOf("*/",a+2),f=u===-1?e.length:u+2;for(;a<f;a+=1)r(a)}else if(c==="'"||c==='"'){a+=1;while(a<e.length&&e.charAt(a)!==c&&e.charAt(a)!==`
5
- `){if(e.charAt(a)==="\\")r(a),a+=1;r(a),a+=1}i=c,a+=1}else if(c==="`")o=!0,a+=1;else if(t&&c==="/"&&Tc.has(i)&&!Rc(e,i,l)&&ci(e,a)>0){let u=ci(e,a);for(a+=1;a<u-1;a+=1)r(a);i="/",a=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]=a+1}else s[u]=(s[u]??1)-1;if(c.trim()!=="")i=c,l=a;a+=1}}return n.join("")}function _c(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function tr(e){if(!e)return[];return e.map((t)=>y(t)?t:t.name)}function Pc(e){return typeof e==="string"}function Fe(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!C(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 C(t.cases)&&Object.values(t.cases).every((n)=>y(n))&&typeof t.default==="string";return!1}function kt(e){if(Pc(e))return[e];if(!Fe(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}var fi,Qn,mi=2048,Cc,er,Tc;var W=N(()=>{fi=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);Qn=new Map;Cc=[],er=new Map;Tc=new Set("(,=:[!&|?{;+-*%<>~^")});function kc(e,t){let n=e.slice(0,t),r=n.split(`
4
+ `)r(a),a+=1;else if(c==="/"&&e.charAt(a+1)==="*"){let u=e.indexOf("*/",a+2),p=u===-1?e.length:u+2;for(;a<p;a+=1)r(a)}else if(c==="'"||c==='"'){a+=1;while(a<e.length&&e.charAt(a)!==c&&e.charAt(a)!==`
5
+ `){if(e.charAt(a)==="\\")r(a),a+=1;r(a),a+=1}i=c,a+=1}else if(c==="`")o=!0,a+=1;else if(t&&c==="/"&&Fu.has(i)&&!Vu(e,i,l)&&Pi(e,a)>0){let u=Pi(e,a);for(a+=1;a<u-1;a+=1)r(a);i="/",a=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]=a+1}else s[u]=(s[u]??1)-1;if(c.trim()!=="")i=c,l=a;a+=1}}return n.join("")}function Wu(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function ur(e){if(!e)return[];return e.map((t)=>b(t)?t:t.name)}function Hu(e){return typeof e==="string"}function qe(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!C(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 C(t.cases)&&Object.values(t.cases).every((n)=>b(n))&&typeof t.default==="string";return!1}function En(e){if(Hu(e))return[e];if(!qe(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 Rs(e){return e.startsWith("#")}var _i,lr,Li=2048,Iu,cr,Fu;var q=S(()=>{_i=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);lr=new Map;Iu=[],cr=new Map;Fu=new Set("(,=:[!&|?{;+-*%<>~^")});function Bu(e,t){let n=e.slice(0,t),r=n.split(`
6
6
  `).length;return{column:t-n.lastIndexOf(`
7
- `),line:r}}function hs(e,t,n,r){return{...kc(e,t),kind:n,message:r,offset:t}}function Ic(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function Si(e){for(let t of[e,`return async function () {
7
+ `),line:r}}function ks(e,t,n,r){return{...Bu(e,t),kind:n,message:r,offset:t}}function qu(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function qi(e){for(let t of[e,`return async function () {
8
8
  ${e}
9
- }`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function bi(e){xs=e,nr=null}function Mc(e,t){if(!nr){if(!xs)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");nr=xs()}return nr(e,t)}function wi(e,t,n){return Mc(e,(r)=>{let s=Ic(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(hs(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 Lc(e){return wt(e).includes("<")||!Si(e)}function Fc(e){let t=gs.get(e);if(t)return t;if(!Lc(e)){let i={code:e,problems:[]};return gs.set(e,i),i}let n=[],r=wi(e,"A function body",n),s=wt(r);for(let i of s.matchAll(Dc)){let l=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(hs(e,l,"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&&Si(e)){let i=[...e].findIndex((l,a)=>l!==r[a]);n.push(hs(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 gs.set(e,o),o}function fd(e){let t=xi.get(e);if(t)return t;let n=[],s={code:wi(e,"A script",n),problems:n};return xi.set(e,s),s}function Vc(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function yi(e,t,n){if(y(e))return $i(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>y(r)))return $i(e.join(`
9
+ }`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function Ui(e){_s=e,pr=null}function zu(e,t){if(!pr){if(!_s)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");pr=_s()}return pr(e,t)}function zi(e,t,n){return zu(e,(r)=>{let s=qu(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(ks(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 Ku(e){return jt(e).includes("<")||!qi(e)}function Gu(e){let t=Ps.get(e);if(t)return t;if(!Ku(e)){let i={code:e,problems:[]};return Ps.set(e,i),i}let n=[],r=zi(e,"A function body",n),s=jt(r);for(let i of s.matchAll(Uu)){let l=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(ks(e,l,"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&&qi(e)){let i=[...e].findIndex((l,a)=>l!==r[a]);n.push(ks(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 Ps.set(e,o),o}function Yg(e){let t=Wi.get(e);if(t)return t;let n=[],s={code:zi(e,"A script",n),problems:n};return Wi.set(e,s),s}function Yu(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function Hi(e,t,n){if(b(e))return Bi(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>b(r)))return Bi(e.join(`
10
10
  `),t,n).split(`
11
- `);return e}function $i(e,t,n){let{code:r,problems:s}=Fc(e),[o,...i]=s.filter((l)=>l.kind==="unsupported");if(o)throw new Ei(t,[o,...i]);for(let l of s)n.push({...t,problem:l});return r}function ys(e,t,n){if(Array.isArray(e))return e.map((i,l)=>ys(i,{...t,pointer:`${t.pointer}/${l}`},n));if(!C(e))return e;let r=ms(e),s=[],o={set:(i,l)=>{s.push([i,l])}};for(let[i,l]of Object.entries(e)){let a={...t,pointer:`${t.pointer}/${Vc(i)}`};if(r&&i==="body")o.set(i,yi(l,a,n));else if(r&&(i==="getter"||i==="setter")&&C(l)){let c={...l};if(l.body!==void 0)c.body=yi(l.body,{...a,pointer:`${a.pointer}/body`},n);o.set(i,c)}else o.set(i,ys(l,a,n))}return Object.fromEntries(s)}function $s(e,t,n=[]){return ys(e,{path:t,pointer:""},n)}function Ji(e,t,n=[]){return $s(e,t,n)}var Dc,gs,nr=null,xs=null,xi,Ei;var Ss=N(()=>{W();Dc=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;gs=new Map;xi=new Map;Ei=class Ei 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 Wc}from"node:module";var Oi=N(()=>{Ss();Ss();bi(()=>Wc(import.meta.url)("ts-blank-space").default)});function Ai(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!Ni.has(s))Ni.add(s),console.warn(`Warning: ${s}`)}}function $n(e,t){let n=[],r=$s(e,t,n);return Ai(n),r}function ji(e,t){let n=[],r=Ji(e,t,n);return Ai(n),r}var Ni;var rr=N(()=>{Oi();Ni=new Set});function Hc(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(y(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(!C(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&U(o.target))r(o.target.$ref);for(let[i,l]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&U(l))r(l.$ref);s(l)}};s(e);for(let o of Bc)if(C(e.state)&&o in e.state)t.add(o);return t}function bs(e){return"body"in e&&"$src"in e}function Sn(e){return tr(e.parameters??e.arguments).length>0}function Ve(e){let t=["state"];for(let n of tr(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function Uc(e,t,n){if(Le(t))return"callable";if(tr(t.parameters??t.arguments).length>0)return"callable";if(y(t.body))return di(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function Et(e){let t=new Map,n=null,r=()=>n??=Hc(e);for(let[s,o]of Object.entries(e.state??{}))if(oe(o))t.set(s,Uc(s,o,r));return t}var Bc;var bn=N(()=>{W();Bc=new Set(["onMount","onUnmount","onAdopted"])});function be(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Ci(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return qc.has(n.toLowerCase())?n:e.slice(1)}return null}function wn(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Jn(e){return e.startsWith("@keyframes")}function vi(e,t){let n=[];for(let r of En(e))for(let s of En(t))n.push(zc(r,s));return n.join(", ")}function zc(e,t){let n=or(t,e);if(n!==null)return n;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function ws(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 or(e,t){return ws(e).length>0?Kc(e,t):null}function Kc(e,t){let n="",r=0;for(let s of ws(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function En(e){let t=[],n=0,r=null,s=0;for(let i=0;i<e.length;i+=1){let l=e[i];if(r){if(l==="\\")i+=1;else if(l===r)r=null;continue}if(l==='"'||l==="'")r=l;else if(l==="("||l==="[")n+=1;else if(l===")"||l==="]")n=Math.max(0,n-1);else if(l===","&&n===0)t.push(e.slice(s,i)),s=i+1}t.push(e.slice(s));let o=t.flatMap((i)=>{let l=i.trim();return l===""?[]:[l]});return o.length>0?o:[e]}function Ze(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Es(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${Pe}]))`,forced:`${e}:where([${Pe}="${t}"])`};return{auto:`:where(:root:not([${Pe}])) ${e}`,forced:`:where(:root[${Pe}="${t}"]) ${e}`}}function ft(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Js(e){return e.startsWith("--")?e:be(e)}function sr(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 Ti(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 Gc(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([l,a])=>`${l}: ${a}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function Yc(e){let t=Object.keys(e).filter((r)=>Jn(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function Xc(e){let n=ws(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function It(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(g)=>g,transposeSelector:o=(g)=>g,resolveValue:i}=t,l=[],a=(g)=>g!==null&&typeof g==="object"&&!Array.isArray(g)&&!U(g),c=(g,x)=>{if(a(x))return[x];if(!wn(g)||!Array.isArray(x)||x.length===0)return[];return x.every((w)=>a(w))?x:[]},u=(g,x,w,O)=>{if(x===void 0||x===null)return null;if(U(x))return w?i?.(g,x,O)??null:null;if(E(x))return null;let J=String(x);if(V(J))return w?i?.(g,J,O)??null:null;return s(J)},f=(g,x,w=!0,O="self")=>{let J=[];for(let[S,b]of Object.entries(g)){if(c(S,b).length>0)continue;if(x&&(S.startsWith("@")||ft(S)))continue;if(S.startsWith("$"))continue;let A=u(S,b,w,O);if(A!==null)J.push([Js(S),A])}return J},p=(g,x,w,O,J)=>{if(w.length===0)return;let S=x;if(S!==null){let j=o(S);if(j===null)return;S=j}let b=Ti(g,S,w),A={text:b,conditions:[...g],selector:S,declarations:w,target:O,key:sr(b)};if(y(J)&&J!=="")A.description=J;l.push(A)},d=(g,x,w)=>{let O=g.slice(10).trim();if(O==="")return;let J=[];for(let[b,A]of Object.entries(x)){if(!a(A))continue;let j=f(A,!0,!1,"unscoped");if(j.length>0)J.push({declarations:j,selector:b.trim()})}if(J.length===0)return;let S=Gc(w,O,J);l.push({blocks:J,conditions:[...w],declarations:[],key:sr(S),selector:null,target:"unscoped",text:S})},h=(g,x,w,O,J)=>{if(g==="@--")return;if(wn(g)){p([...O,g],null,f(x,!1,!0,"unscoped"),"unscoped",x.$description);return}if(Jn(g)){d(g,x,O);return}let S=Ci(g,r),b=S===null?g:`@media ${S}`,A=S===null?null:Ze(S);if(A!==null&&w!==null){let{auto:j,forced:re}=Es(w,A);m(x,j,[...O,b],J),m(Yc(x),re,O,J);return}m(x,w,[...O,b],J)};function m(g,x,w,O){p(w,x,f(g,!0,!0,O),O,g.$description);for(let[J,S]of Object.entries(g))for(let b of c(J,S))if(J.startsWith("@"))h(J,b,x,w,O);else if(x!==null)m(b,vi(x,J),w,Xc(J)?O:"descendant")}return m(e,n,[],"self"),l}var qc,Pe="data-color-scheme",ir="jx-color-scheme";var On=N(()=>{W();qc=new Set(["all","print","screen","speech"])});function Ed(){return`the Intl helpers ${Ns.join(", ")}`}var We="en-US",Os="UTC",Ri,Ns,_i;var Pi=N(()=>{Ri=[{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."}],Ns=Ri.map((e)=>e.path),_i=Object.fromEntries(Ri.map((e)=>[e.path,e.params.indexOf("locale")]))});function Zc(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function he(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Be(e){if(e==="")return[];return e.split("/").map((t)=>Zc(t))}function ce(e,t){let n=e;for(let r of Be(t))n=n?.[r];return n}function F(e,t){let n=e;for(let r of Be(t))n+=As.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function ki(e,t){let n=e;for(let[r,s]of Be(t).entries()){let o=r===0?"":"?.";n+=As.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function Qe(e){return As.test(e)?e:JSON.stringify(e)}function Ii(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var As;var Dt=N(()=>{As=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function js(e){let t=e.$map;return E(t)?t:void 0}function cr(e){return E(e)&&!Array.isArray(e)&&"operator"in e}function Mt(e){return E(e)&&!Array.isArray(e)&&"$ref"in e}function nu(e,t,n){let r=_i[e];if(r===void 0||r<0||t[r]!=null)return t;let s=ce(n.$page,"locale");if(!y(s)||s==="")return t;let o=[...t];return o[r]=s,o}function Bi(){return globalThis.window??globalThis}function Hi(e){return e.startsWith("window#/")&&eu.has(e.slice(8))}function He(e){return Fi.has(e)}function ar(e){if(Array.isArray(e))return e.some((t)=>ar(t));if(e===void 0||!cr(e))return!1;return He(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>ar(t))||Object.values(e.cases??{}).some((t)=>ar(t))}function Nn(e){return Ye(e)&&!ar(e.$expression)}function Cs(e,t){if(Array.isArray(e)){for(let n of e)Cs(n,t);return}if(e===void 0||!E(e))return;if(Mt(e)){if(!ru.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Be(n)[0]??"")}return}if(cr(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Cs(r,t)}}function ks(e){let t=new Set;return Cs(e.$expression,t),[...t]}function Is(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Nn(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(ks(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function X(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>su)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function G(e,t,n,r,s){if(e===null||e===void 0)return e;if(cr(e))return Ne(e,t,n,r,s);if(Mt(e)){let o=lr(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return Ui(e,t,n,r,s);return s?.report(s.path??[],e),e}function Ui(e,t,n,r,s){return e.map((o,i)=>G(o,t,n,r,X(s,i)))}function ou(e,t,n,r){let s=(o)=>{if(!e.slice(o.length).includes("/"))return t;return lr(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?lr(e.slice(0,e.lastIndexOf("/")),t,n,r):void 0;return}function lr(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?ce(o,s.slice(1).join("/")):o}if(e.startsWith("event#/")){let s=e.slice(7);return ce(n,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,l=js(t);if(o==="item")i=r?.item??l?.item??t["$map/item"];else if(o==="index")i=r?.index??l?.index??t["$map/index"];else i=l?.[o]??t[`$map/${o}`];return s.length>2?ce(i,s.slice(2).join("/")):i}if(e.startsWith("#/state/"))return ce(t,e.slice(8));if(e.startsWith("parent#/"))return ce(t,e.slice(8));if(e.startsWith("window#/"))return ce(Bi(),e.slice(8));if(e.startsWith("document#/"))return ce(globalThis.document,e.slice(10));return ce(t,e)??null}function iu(e,t,n,r){if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,l=js(t);if(o==="item")i=r?.item??l?.item??t["$map/item"];else if(o==="index")i=r?.index??l?.index??t["$map/index"];else i=l?.[o]??t[`$map/${o}`];if(s.length>2){let a=s.slice(2),c=a.pop(),u=a.length>0?ce(i,a.join("/")):i;return{key:c,obj:u}}return{key:o==="item"?"$map/item":"$map/index",obj:js(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let i=Be(s),l=i.pop(),a=t;for(let c of i)a=a[c];return{key:l,obj:a}}return{key:e,obj:t}}function Ne(e,t,n,r,s){let o=au(e,t,n,r,s);return s?.report(s.path??[],o),o}function Mi(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 au(e,t,n,r,s){let{operator:o,target:i,value:l,initial:a}=e;if(!Qc.has(o))throw Error(`$expression: unknown operator "${o}"`);if(vs.has(o)&&!("value"in e)){let c=G(i,t,n,r,X(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=Mt(i)?i.$ref:void 0;if(!y(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>Di)throw Error(`$expression: call depth exceeded (${Di})`);let f=Array.isArray(l)?l.map((d,h)=>G(d,t,n,r,X(s,["value",h]))):[];if(c.startsWith("window#/")){if(!Hi(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let d=c.slice(8),h=tu.get(d);if(h)return h(...nu(d,f,t));let m=Bi(),g=ce(m,d),x=d.lastIndexOf("/"),w=x===-1?m:ce(m,d.slice(0,x));return g.apply(w,f)}let p=lr(c,t,n,r);if(Je(p))return p.apply(ou(c,t,n,r),f);if(E(p)&&"$expression"in p){let d=p,h={};for(let[m,g]of(d.parameters??[]).entries()){let x=y(g)?g:g?.name??"";if(!x)continue;h[x]=f[m]===void 0&&E(g)&&"default"in g?g.default:f[m]}return Ne(d.$expression,t,n,{args:h,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(_s.has(o)){if(o==="?:"){let d=G(i,t,n,r,X(s,"target"));if(s){let h=G(l,t,n,r,X(s,"value")),m=G(a,t,n,r,X(s,"initial"));return d?h:m}return d?G(l,t,n,r):G(a,t,n,r)}let c=G(i,t,n,r,X(s,"target")),u=String(c),f=e.cases??{},p=Object.hasOwn(f,u);if(s){let d;for(let[m,g]of Object.entries(f)){let x=G(g,t,n,r,X(s,["cases",m]));if(m===u)d=x}let h=G(e.default,t,n,r,X(s,"default"));return p?d:h}return p?G(f[u],t,n,r):G(e.default,t,n,r)}if(Ts.has(o)){let c=G(i,t,n,r,X(s,"target")),u=G(l,t,n,r,X(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 Mi(o,c,u)}}if(Vi.has(o)){let c=G(l,t,n,r,X(s,"value")),{obj:u,key:f}=iu(i.$ref,t,n,r);u[f]=o==="="?c:Mi(o.slice(0,-1),u[f],c);return}if(Wi.has(o)){let c=G(i,t,n,r,X(s,"target"));switch(o){case"push":return c.push(G(l,t,n,r,X(s,"value")));case"unshift":return c.unshift(G(l,t,n,r,X(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=G(l,t,n,r,X(s,"value"));return c.splice(...u)}default:break}}if(Ps.has(o)){let c=G(i,t,n,r,X(s,"target")),u=l===void 0?[]:Array.isArray(l)?Ui(l,t,n,r,X(s,"value")):[G(l,t,n,r,X(s,"value"))],f=ce(c,o);if(!Je(f))return;return f.apply(c,u)}if(Rs.has(o)){let c=G(i,t,n,r,X(s,"target")),u=l;if(o==="reduce"){let f=G(a,t,n,r,X(s,"initial"));for(let[p,d]of c.entries())f=Ne(u,t,n,{acc:f,index:p,item:d},p===0?X(s,"value"):void 0);return f}if(o==="map")return c.map((f,p)=>Ne(u,t,n,{...r,index:p,item:f},p===0?X(s,"value"):void 0));if(o==="filter")return c.filter((f,p)=>Ne(u,t,n,{...r,index:p,item:f},p===0?X(s,"value"):void 0))}return}function Z(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(cr(e))return xe(e,t);if(Mt(e))return Ds(e.$ref,t);if(Array.isArray(e))return e.map((n)=>Z(n,t)).join(", ");return JSON.stringify(e)}function lu(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function Ds(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 F("_args",e.slice(6));if(e.startsWith("event#/"))return F(r,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s;if(o==="item")return s.length>2?F("_item",s.slice(2).join("/")):"_item";if(o==="index")return"_index";return`_${o}`}if(e.startsWith("#/state/"))return F(n,e.slice(8));if(e.startsWith("parent#/"))return F(n,e.slice(8));if(e.startsWith("window#/"))return F("window",e.slice(8));if(e.startsWith("document#/"))return F("document",e.slice(10));return F(n,e)}function Li(e,t){if(Mt(e))return Ds(e.$ref,t);return Z(e,t)}function cu(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(We)})`,o=JSON.stringify(Os);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 xe(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(vs.has(n)&&!("value"in e)){let i=Z(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(Mt(r)?r.$ref:void 0)??"",l=Array.isArray(s)?s.map((a)=>Z(a,t)):[];if(i.startsWith("window#/")){if(!Hi(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let a=cu(i.slice(8),l,t);if(a)return a;return`window.${i.slice(8).replaceAll("/",".")}(${l.join(", ")})`}if(i.startsWith("#/state/")){let a=i.slice(8),c=t.formulaParams?.[a];if(c){let u=c.map((f,p)=>`${JSON.stringify(f)}: ${l[p]??"undefined"}`).join(", ");return`${lu(a)}(${t.statePrefix??"state"}, { ${u} })`}}return`${Ds(i,t)}(${l.join(", ")})`}if(_s.has(n)){if(n==="?:"){let c=Z(r,t),u=Z(s,t),f=Z(o,t);return`(${c} ? ${u} : ${f})`}let i=Z(r,t),l=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${Z(u,t)} : `).join(""),a="default"in e?Z(e.default,t):"undefined";return`((_d) => ${l}${a})(String(${i}))`}if(Ts.has(n)){let i=Z(r,t),l=Z(s,t);return`(${i} ${n} ${l})`}if(Vi.has(n)){let i=Li(r,t),l=Z(s,t);return`${i} ${n} ${l}`}if(Wi.has(n)){let i=Li(r,t);switch(n){case"push":return`${i}.push(${Z(s,t)})`;case"unshift":return`${i}.unshift(${Z(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let l=Array.isArray(s)?s.map((a)=>Z(a,t)).join(", "):Z(s,t);return`${i}.splice(${l})`}default:break}}if(Ps.has(n)){let i=Z(r,t),l=s===void 0?"":Array.isArray(s)?s.map((a)=>Z(a,t)).join(", "):Z(s,t);return`(${i})?.${n}?.(${l})`}if(Rs.has(n)){let i=Z(r,t),l=xe(s,t);if(n==="reduce"){let a=Z(o,t);return`${i}.reduce((_acc, _item, _index) => ${l}, ${a})`}if(n==="map")return`${i}.map((_item, _index) => ${l})`;if(n==="filter")return`${i}.filter((_item, _index) => ${l})`}return"undefined"}function Lt(e,t,n,r){return G(e,t,n,r)}function et(e,t={}){return Z(e,t)}var Fi,vs,Ts,Vi,Wi,Rs,_s,Ps,Qc,eu,tu,ru,Di=64,su=64;var Ft=N(()=>{Pi();W();Dt();Fi=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),vs=new Set(["!","-"]),Ts=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Vi=new Set(["=","+=","-=","*=","/="]),Wi=new Set(["push","pop","shift","unshift","splice"]),Rs=new Set(["reduce","map","filter"]),_s=new Set(["?:","switch"]),Ps=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"]),Qc=new Set([...Fi,...vs,...Ts,...Rs,..._s,...Ps,"call"]),eu=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",...Ns]),tu=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??We,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??We,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??We,{timeZone:Os,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??We,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??We,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??We,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??We,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??We,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);ru=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function uu(e){return e.startsWith(qi)}function Td(e){let t=e;if(uu(t))t=t.slice(qi.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Ms}${t}.js`}function Rd(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Ms}${n}`:`${Ms}${n}.${t}`}function zi(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Ki(e){let t=zi(e);return t.startsWith("/")?t:`/${t}`}function fu(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function _d(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 fu(e,"urlPrefix")){let o=Ki(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let l=r.slice(o.length+1).split("/");if(l.some((c)=>c===""||c==="."||c===".."))return null;let{filter:a}=s;if(a&&!a(l.join("/")))return null;return`${zi(s.dir)}/${l.join("/")}`}return null}function Pd(e,t){let n=new Set;for(let r of t){let s=Ki(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${pu}]+`,"g");for(let i of e.matchAll(o)){let l=i[0].split("#")[0].split("?")[0];if(!l.endsWith("/"))n.add(l)}}return[...n].filter(Boolean)}function du(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 mu(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function kd(e){if(!y(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 Ls(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Id(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var qi="npm:",Ms="/assets/",pu;var Fs=N(()=>{W();pu=String.raw`"'\s<>()\\`});function Gi(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 gu(e){return(E(e)||Je(e))&&"then"in e&&Je(e.then)}async function Vt(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=Gi(o);switch(i.kind){case"expression":{let l=Ne(i.node,t,n,s);if(gu(l))await l;break}case"if":{let l=i.node,a=Lt(l.if,t,n,s)?l.then:l.else;if(Array.isArray(a))await Vt(a,t,n,r);break}case"switch":{let l=i.node,a=String(Lt(l.$switch,t,n,s)),c=l.cases??{},u=Object.hasOwn(c,a)?c[a]:l.default;if(Array.isArray(u))await Vt(u,t,n,r);break}case"dispatch":{let l=i.node,a=Je(r.target)?r.target():r.target,c=n?.currentTarget??a;if(!c)break;let u={};if("detail"in l)u.detail=Lt(l.detail,t,n,s);if(l.bubbles!==void 0)u.bubbles=l.bubbles;if(l.composed!==void 0)u.composed=l.composed;c.dispatchEvent(new CustomEvent(l.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function ve(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=Gi(s);switch(o.kind){case"expression":{r.push(`${n}${xe(o.node,t)};`);break}case"if":{let i=o.node,l=et(i.if,t),a={...t,indent:`${n} `};if(r.push(`${n}if (${l}) {`,ve(i.then??[],a)),i.else)r.push(`${n}} else {`,ve(i.else,a));r.push(`${n}}`);break}case"switch":{let i=o.node,l=et(i.$switch,t),a={...t,indent:`${n} `};r.push(`${n}switch (String(${l})) {`);for(let[c,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(c)}: {`,ve(u,a),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,ve(i.default,a),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,l=t.eventParam??"event",a=t.dispatchTarget??`(${l} && ${l}.currentTarget)`,c=[];if("detail"in i)c.push(`detail: ${et(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}${a}?.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(`
12
- `)}var ur=N(()=>{W();Ft()});var Vs=N(()=>{W()});function Us(e){if(e===hu)return"client";if(e===xu)return"server";return null}function yu(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function Xi(e,t){return`${Hs}${yu(e)}#${t}`}function Zi(e){return e.startsWith(Hs)}function Qi(e){if(!Zi(e))return null;let t=e.slice(Hs.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 Ws(e,t){if(Array.isArray(e)){let r=e.map((s)=>Ws(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!C(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&y(s)){let i=Us(s);o=i===null?s:Xi(t,i)}else if(r!=="$script")o=Ws(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function qs(e,t){return Ws(e,t)}function bu(e){return $u.test(e)&&!Su.test(e)}function Yi(e){return Us(e)==="client"||Qi(e)?.side==="client"}function Bs(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())Bs(s,[...t,r],n);return n}if(!C(e))return n;if(y(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")Bs(s,[...t,r],n);return n}function wu(e){let t=e.at(-1);return y(t)?`"${t}"`:"this entry"}function Hd(e){let t=Bs(e,[],[]),n=t.some((s)=>!s.lazy&&Yi(s.src)),r=[];for(let s of t){let o=wu(s.path);if(!s.lazy&&bu(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&&Yi(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 Hs="jx-script:",hu="#client",xu="#server",$u,Su;var zs=N(()=>{W();$u=/^\.{1,2}\//u,Su=/\.json$/iu});function fr(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=gi(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function ta(){return[...ea].toSorted()}function Jt(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||ea.has(n))return String(t);return t?"":null}var tt,ea,gm,Ks=32,pr,dr="jx-slot",Gs="data-jx-slots",Ys="jx.slot.group",hm;var An=N(()=>{On();Ft();Dt();W();bn();Fs();ur();Vs();zs();Vs();On();tt=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"]),ea=new Set(["contenteditable","draggable","spellcheck"]);gm=Object.freeze({emptyRow:!0}),pr=/^[\t\n\f\r ]+$/u,hm=(()=>{let e=Symbol.for(Ys),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function na(e,t,n,r,s=Ou){let o=[],i=(f,p)=>{let d={mediaQueries:t,scope:p,transposeValue:n};if(r)d.resolveValue=(h,m)=>r(h,m,p);for(let h of It(f,d))o.push(h.text)},l={},a={},c=[],u=[];for(let[f,p]of Object.entries(e)){if(E(p)&&!Array.isArray(p)){if(f.startsWith("@"))c.push([f,p]);else if(!f.startsWith("--"))u.push([f,p]);continue}if(ft(f)||f.startsWith("@"))continue;if(f.startsWith("--")||f==="colorScheme"||f==="color-scheme")l[f]=p;else a[f]=p}i(l,s.root),i(a,s.body);for(let[f,p]of u)if(f.startsWith("&"))i({[f]:p},s.root);else i(p,f);for(let[f,p]of c){if(wn(f)||Jn(f)){i({[f]:p},null);continue}let d={},h={},m=[];for(let[g,x]of Object.entries(p)){if(E(x)&&!Array.isArray(x)){if(!g.startsWith("@"))m.push([g,x]);continue}if(g.startsWith("--"))d[g]=x;else h[g]=x}i({[f]:d},s.root),i({[f]:h},s.body);for(let[g,x]of m)i({[f]:x},g)}if(Object.values(t).some((f)=>Ze(f)!==null)&&!("colorScheme"in e))o.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${Pe}="light"]) { color-scheme: light }`,`${s.root}:where([${Pe}="dark"]) { color-scheme: dark }`);return o.join(`
13
- `)}var Ou;var ra=N(()=>{On();W();Ou={body:"body",root:":root"}});function sa(e){return e===!1||e==="open"||e==="closed"}function mr(e,t){let n=e?.$shadow;if(sa(n))return n===!1?null:n;let r=t?.shadow;return sa(r)&&r!==!1?r:null}function oa(e,t){return t===null?e:":host"}function vn(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=ia(s);if(!o)continue;let i=aa(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 ia(e){return y(e)?e:e?.name??""}function aa(e){return E(e)&&"default"in e}function Nu(e,t){let n=la(e,t);return n===e?e:`${n} as ${e}`}function la(e,t){let n=t?.$export;return y(n)&&n!==""?n:e}function yr(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,l=V(i),a=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let c=[`// ${e}: auto-fetch from ${l?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(l)c.push(` const url = \`${ju(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(i)};`);let u=[];if(a!=="GET")u.push(`method: ${JSON.stringify(a)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let p=E(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${p}`)}let f=u.length>0?`, { ${u.join(", ")} }`:"";return c.push(` fetch(url${f})`," .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(`
14
- `)}function $r(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,l=JSON.stringify(`${i}/${t.$export}`),a=Object.entries(t.arguments??{}),c=a.map(([m,g])=>{if(!U(g))return`${Qe(m)}: ${JSON.stringify(g)}`;if(Au.some((x)=>g.$ref.startsWith(x)))throw Error(`Server function "${e}": argument "${m}" references "${g.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${Qe(m)}: ${et({$ref:g.$ref},{statePrefix:r})}`}),u=a.some(([,m])=>U(m)),f=`${ha}(${l}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,p=F(r,he(e)),d=`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;",` ${f}`,` .then((d) => { if (_seq === _jxSeq) ${p} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${d}; });`,o?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,f,` .then((d) => { ${p} = d; })`,` .catch((e) => { ${d}; });`]).map((m)=>`${s}${m}`).join(`
15
- `)}function ju(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function ua(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${jn}\??\.${jn}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${jn}(?:\?\.)?\[${jn}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||Cu.test(e)}function fa(e,t){let n=Is(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)=>E(c)&&!Array.isArray(c)&&y(c.$src)),l=new Set(s.filter((c)=>i||ua(o,c)));for(let c of l)for(let u of ks(n[c]))if(!(u in r))l.add(u);if(l.size===0)return e;let a=Object.fromEntries(s.filter((c)=>l.has(c)).map((c)=>[c,n[c]]));return{...e,state:{...a,...r}}}function vu(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Nn(n)));return JSON.stringify({...e,state:t})}function Sr(e){if(!E(e))return!1;if(e.state){let t;for(let[n,r]of Object.entries(e.state)){if(n==="$site"||n==="$page")continue;if(!E(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(Nn(r)){if(t??=vu(e),ua(t,n))return!0;continue}if(r.$prototype)return!0;if("default"in r)return!0;if(ut(r))continue;return!0}}if(e.$switch)return!0;if(se(e)||ds(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>Sr(t)))return!0;for(let[t,n]of Object.entries(e)){if(tt.has(t))continue;if(U(n))return!0;if(V(n))return!0}if(E(e.style)){for(let t of Object.values(e.style))if(V(t))return!0}if(E(e.attributes)){for(let t of Object.values(e.attributes))if(V(t))return!0}return!1}function pa(e){if(!E(e))return!1;if(e.$switch)return!0;if(se(e)||ds(e.children))return!0;for(let[t,n]of Object.entries(e)){if(tt.has(t))continue;if(U(n))return!0;if(V(n))return!0}if(E(e.style)){for(let t of Object.values(e.style))if(V(t))return!0}if(E(e.attributes)){for(let t of Object.values(e.attributes))if(V(t))return!0}return!1}function qt(e,t=null,n={},r={}){let s=e?.state?eo(e.state,t):t??da();return{media:r,scope:s,scopeDefs:n}}function da(e=null){return Object.create(e)}function no(e){return e[ca]}function Pm(e,t){return no(e)?.has(t)??!1}function ku(e,t,n){if(t>0&&_u.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!Pu.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function zt(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:wt(e),o="",i=0;for(let l=s.indexOf("state");l!==-1;l=s.indexOf("state",l+1))if(ku(s,l,r))o+=e.slice(i,l)+t,i=l+5;return o+e.slice(i)}function Qs(e,t){if(y(e)){if(!e.includes("state."))return;let o=wt(e);for(let i of o.matchAll(Tu))t.add(i[1]);for(let i of o.matchAll(Ru))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)Qs(o,t);return}if(!E(e))return;let n=e,{operator:r,target:s}=n;if(y(r)&&He(r)&&U(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))Qs(o,t)}function pt(e,t){if(oe(t)&&bs(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function br(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(pt(`state entry "${r}"`,s),!oe(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:la(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(Nu(r,s))}return n}function wr(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 l=`_jxLazy${s}`;s+=1,r.push(`let ${l};`,`const ${l}Load = () => (${l} ??= import('${t?t(o):o}'));`,...i.map(({binding:a,exportName:c})=>`const ${a} = (...args) => ${l}Load().then((m) => m.${c}(...args));`))}return{imports:n,loaders:r}}function eo(e={},t=null){let n=da(t),r=t?no(t):void 0,s=new Set(r);Object.defineProperty(n,ca,{configurable:!0,enumerable:!1,value:s,writable:!0});let o=new Set;for(let u of Object.values(e))if(oe(u)||Oe(u))Qs(u.body??u.$expression,o);for(let u of o)if(u in e)s.add(u);let i=Et({state:e});for(let[u,f]of Object.entries(e)){if(!E(f)||Array.isArray(f)){nt(n,u,gr(f));continue}if("default"in f){nt(n,u,gr(f.default));continue}if(Xe(f)){s.add(u);continue}if(!f.$prototype&&!("$expression"in f)&&!ut(f))nt(n,u,gr(f))}let l=[],a=[];for(let[u,f]of Object.entries(e)){if(V(f)){l.push([u,f]);continue}if(!E(f))continue;if(Oe(f)){let p=f.$expression;if(Ye(f)){let d=f.parameters;nt(n,u,(...h)=>{let m={};for(let[g,x]of d.entries()){let w=ia(x);if(!w)continue;m[w]=h[g]===void 0&&aa(x)?x.default:h[g]}return Ne(p,n,null,{args:m})})}else if(He(p.operator))nt(n,u,(d,h)=>Ne(p,d,h));else Xs(n,u,()=>Ne(p,n,null));continue}if(oe(f)){if(pt(`state entry "${u}"`,f),Le(f)){let{body:p}=f;nt(n,u,(d,h)=>{Vt(p,d??n,h??null)})}else if(y(f.body)){let{body:p}=f,d=Function(...Ve(f),p);if(i.get(u)==="computed")Xs(n,u,()=>d(n)),a.push([u,p]);else nt(n,u,d)}else nt(n,u,()=>{}),s.add(u);continue}if(ct(f)&&(f.$prototype==="LocalStorage"||f.$prototype==="SessionStorage")){nt(n,u,gr(f.default??null));continue}if(ct(f)&&f.$prototype==="Request")s.add(u)}let c=!0;while(c){c=!1;for(let[u,f]of[...a,...l])if(!s.has(u)&&ma(f,n))s.add(u),c=!0}for(let[u,f]of l)Xs(n,u,()=>ro(f,n));return n}function nt(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Xs(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function q(e,t){if(U(e))return Iu(e.$ref,t);if(V(e))return ro(e,t);return e}function we(e){return U(e)}function Iu(e,t){if(!y(e))return e;if(e.startsWith("$map/")){let n=e.split("/"),r=n[1],o=t.$map?.[r]??t[`$map/${r}`];return n.length>2?Zs(o,n.slice(2).join("/")):o}if(e.startsWith("#/state/"))return Zs(t,e.slice(8));return Zs(t,e)??null}function ma(e,t){if(!t)return!1;let n=no(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(Je(o))return!0}return!1}function Er(e){return fr(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function ro(e,t){if(ma(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page];try{let s=fr(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,s)(...r)}catch{return null}}function Zs(e,t){return ce(e,t)}function gr(e){if(!E(e))return e;return structuredClone(e)}function Du(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&V(r)).map(([n,r])=>{let s=q(r,t);return s==null?null:`${be(n)}: ${s}`}).filter(Boolean).join("; ")}function Ot(e,t,n=""){let r="",s=q(e.id,t),o=q(e.className,t),i=q(e.hidden,t),l=q(e.tabIndex,t),a=q(e.title,t),c=q(e.lang,t),u=q(e.dir,t);if(s)r+=` id="${D(String(s))}"`;if(o)r+=` class="${D(String(o))}"`;if(i)r+=" hidden";if(l!==void 0&&l!==null)r+=` tabindex="${D(String(l))}"`;if(a)r+=` title="${D(String(a))}"`;if(c)r+=` lang="${D(String(c))}"`;if(u)r+=` dir="${D(String(u))}"`;let f=[Du(e.style,t),n].filter(Boolean).join("; ");if(f)r+=` style="${D(f)}"`;if(e.attributes)for(let[p,d]of Object.entries(e.attributes)){let h=q(d,t);if(Se(h)){let m=Jt(p,h);if(m!==null)r+=m===""?` ${p}`:` ${p}="${D(m)}"`;continue}if(y(h)||le(h))r+=` ${p}="${D(String(h))}"`}if(e.$static)r+=" data-jx-static";else if(e.$prerendered)r+=" data-jx-prerendered";return r}function Tn(e,t=" "){return e?"":`
16
- ${t}`}function Jr(){let e=JSON.stringify(ir),t=JSON.stringify(Pe);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function hr(e,t,n,r){for(let s of It(t,{mediaQueries:r,resolveValue:(o,i)=>ga(o,i,n),scope:n}))e.push(s.text)}function ga(e,t,n){let r=y(t)?t:t.$ref;return Mu.push({property:e,selector:n,source:r}),null}function Or(){return`const __jxEnumAttrs = new Set(${JSON.stringify(ta())});
17
- function ${Kt}(n, v) {
11
+ `);return e}function Bi(e,t,n){let{code:r,problems:s}=Gu(e),[o,...i]=s.filter((l)=>l.kind==="unsupported");if(o)throw new Ki(t,[o,...i]);for(let l of s)n.push({...t,problem:l});return r}function Ds(e,t,n){if(Array.isArray(e))return e.map((i,l)=>Ds(i,{...t,pointer:`${t.pointer}/${l}`},n));if(!C(e))return e;let r=Ts(e),s=[],o={set:(i,l)=>{s.push([i,l])}};for(let[i,l]of Object.entries(e)){let a={...t,pointer:`${t.pointer}/${Yu(i)}`};if(r&&i==="body")o.set(i,Hi(l,a,n));else if(r&&(i==="getter"||i==="setter")&&C(l)){let c={...l};if(l.body!==void 0)c.body=Hi(l.body,{...a,pointer:`${a.pointer}/body`},n);o.set(i,c)}else o.set(i,Ds(l,a,n))}return Object.fromEntries(s)}function Ms(e,t,n=[]){return Ds(e,{path:t,pointer:""},n)}function Gi(e,t,n=[]){return Ms(e,t,n)}var Uu,Ps,pr=null,_s=null,Wi,Ki;var Is=S(()=>{q();Uu=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;Ps=new Map;Wi=new Map;Ki=class Ki 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 Xu}from"node:module";var Yi=S(()=>{Is();Is();Ui(()=>Xu(import.meta.url)("ts-blank-space").default)});function Zi(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!Xi.has(s))Xi.add(s),console.warn(`Warning: ${s}`)}}function Jn(e,t){let n=[],r=Ms(e,t,n);return Zi(n),r}function Qi(e,t){let n=[],r=Gi(e,t,n);return Zi(n),r}var Xi;var fr=S(()=>{Yi();Xi=new Set});function Qu(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(b(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(!C(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&Y(o.target))r(o.target.$ref);for(let[i,l]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&Y(l))r(l.$ref);s(l)}};s(e);for(let o of Zu)if(C(e.state)&&o in e.state)t.add(o);return t}function Ls(e){return"body"in e&&"$src"in e}function vn(e){return ur(e.parameters??e.arguments).length>0}function Ue(e){let t=["state"];for(let n of ur(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function ep(e,t,n){if(Be(t))return"callable";if(ur(t.parameters??t.arguments).length>0)return"callable";if(b(t.body))return Ii(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function At(e){let t=new Map,n=null,r=()=>n??=Qu(e);for(let[s,o]of Object.entries(e.state??{}))if(ue(o))t.set(s,ep(s,o,r));return t}var Zu;var On=S(()=>{q();Zu=new Set(["onMount","onUnmount","onAdopted"])});function Oe(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function ea(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return tp.has(n.toLowerCase())?n:e.slice(1)}return null}function jn(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Cn(e){return e.startsWith("@keyframes")}function ta(e,t){let n=[];for(let r of An(e))for(let s of An(t))n.push(np(r,s));return n.join(", ")}function np(e,t){let n=mr(t,e);if(n!==null)return n;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Fs(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 mr(e,t){return Fs(e).length>0?rp(e,t):null}function rp(e,t){let n="",r=0;for(let s of Fs(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function An(e){let t=[],n=0,r=null,s=0;for(let i=0;i<e.length;i+=1){let l=e[i];if(r){if(l==="\\")i+=1;else if(l===r)r=null;continue}if(l==='"'||l==="'")r=l;else if(l==="("||l==="[")n+=1;else if(l===")"||l==="]")n=Math.max(0,n-1);else if(l===","&&n===0)t.push(e.slice(s,i)),s=i+1}t.push(e.slice(s));let o=t.flatMap((i)=>{let l=i.trim();return l===""?[]:[l]});return o.length>0?o:[e]}function rt(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Vs(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${Ie}]))`,forced:`${e}:where([${Ie}="${t}"])`};return{auto:`:where(:root:not([${Ie}])) ${e}`,forced:`:where(:root[${Ie}="${t}"]) ${e}`}}function dt(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Ws(e){return e.startsWith("--")?e:Oe(e)}function dr(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 na(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 Nn(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
12
+ ${e.text}`}function sp(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([l,a])=>`${l}: ${a}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function op(e){let t=Object.keys(e).filter((r)=>Cn(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function ip(e){let n=Fs(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function Lt(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(g)=>g,transposeSelector:o=(g)=>g,resolveValue:i}=t,l=[],a=(g)=>g!==null&&typeof g==="object"&&!Array.isArray(g)&&!Y(g),c=(g,x)=>{if(a(x))return[x];if(!jn(g)||!Array.isArray(x)||x.length===0)return[];return x.every((w)=>a(w))?x:[]},u=(g,x,w,O)=>{if(x===void 0||x===null)return null;if(Y(x))return w?i?.(g,x,O)??null:null;if(E(x))return null;let A=String(x);if(B(A))return w?i?.(g,A,O)??null:null;return s(A)},p=(g,x,w=!0,O="self")=>{let A=[];for(let[T,_]of Object.entries(g)){if(c(T,_).length>0)continue;if(x&&(T.startsWith("@")||dt(T)))continue;if(T.startsWith("$"))continue;let G=u(T,_,w,O);if(G!==null)A.push([Ws(T),G])}return A},d=(g)=>b(g)&&g!==""?{description:g}:{},f=(g,x,w,O,A)=>{if(w.length===0)return;let T=x;if(T!==null){let N=o(T);if(N===null)return;T=N}let _=na(g,T,w),G={text:_,conditions:[...g],selector:T,declarations:w,target:O,key:dr(_)};l.push({...G,...d(A)})},y=(g,x,w)=>{let O=g.slice(10).trim();if(O==="")return;let A=[];for(let[_,G]of Object.entries(x)){if(!a(G))continue;let N=p(G,!0,!1,"unscoped");if(N.length>0)A.push({declarations:N,selector:_.trim()})}if(A.length===0)return;let T=sp(w,O,A);l.push({blocks:A,conditions:[...w],declarations:[],key:dr(T),selector:null,target:"unscoped",text:T,...d(x.$description)})},h=(g,x,w,O,A)=>{if(g==="@--")return;if(jn(g)){f([...O,g],null,p(x,!1,!0,"unscoped"),"unscoped",x.$description);return}if(Cn(g)){y(g,x,O);return}let T=ea(g,r),_=T===null?g:`@media ${T}`,G=T===null?null:rt(T);if(G!==null&&w!==null){let{auto:N,forced:H}=Vs(w,G);m(x,N,[...O,_],A),m(op(x),H,O,A);return}m(x,w,[...O,_],A)};function m(g,x,w,O){f(w,x,p(g,!0,!0,O),O,g.$description);for(let[A,T]of Object.entries(g))for(let _ of c(A,T))if(A.startsWith("@"))h(A,_,x,w,O);else if(x!==null)m(_,ta(x,A),w,ip(A)?O:"descendant")}return m(e,n,[],"self"),l}var tp,Ie="data-color-scheme",gr="jx-color-scheme";var Tn=S(()=>{q();tp=new Set(["all","print","screen","speech"])});function oa(){return`the Intl helpers ${Bs.join(", ")}`}var ze="en-US",Hs="UTC",ra,Bs,sa;var qs=S(()=>{ra=[{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."}],Bs=ra.map((e)=>e.path),sa=Object.fromEntries(ra.map((e)=>[e.path,e.params.indexOf("locale")]))});function ap(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Se(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Ke(e){if(e==="")return[];return e.split("/").map((t)=>ap(t))}function de(e,t){let n=e;for(let r of Ke(t))n=n?.[r];return n}function W(e,t){let n=e;for(let r of Ke(t))n+=Us.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function ia(e,t){let n=e;for(let[r,s]of Ke(t).entries()){let o=r===0?"":"?.";n+=Us.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function st(e){return Us.test(e)?e:JSON.stringify(e)}function aa(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Us;var Ft=S(()=>{Us=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function zs(e){let t=e.$map;return E(t)?t:void 0}function xr(e){return E(e)&&!Array.isArray(e)&&"operator"in e}function Vt(e){return E(e)&&!Array.isArray(e)&&"$ref"in e}function pp(e,t,n){let r=sa[e];if(r===void 0||r<0||t[r]!=null)return t;let s=de(n.$page,"locale");if(!b(s)||s==="")return t;let o=[...t];return o[r]=s,o}function ma(){return globalThis.window??globalThis}function ga(e){return e.startsWith("window#/")&&cp.has(e.slice(8))}function Ge(e){return pa.has(e)}function hr(e){if(Array.isArray(e))return e.some((t)=>hr(t));if(e===void 0||!xr(e))return!1;return Ge(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>hr(t))||Object.values(e.cases??{}).some((t)=>hr(t))}function Rn(e){return et(e)&&!hr(e.$expression)}function Ks(e,t){if(Array.isArray(e)){for(let n of e)Ks(n,t);return}if(e===void 0||!E(e))return;if(Vt(e)){if(!fp.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Ke(n)[0]??"")}return}if(xr(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Ks(r,t)}}function eo(e){let t=new Set;return Ks(e.$expression,t),[...t]}function to(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Rn(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(eo(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function te(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>dp)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Q(e,t,n,r,s){if(e===null||e===void 0)return e;if(xr(e))return Ne(e,t,n,r,s);if(Vt(e)){let o=yr(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return ha(e,t,n,r,s);return s?.report(s.path??[],e),e}function ha(e,t,n,r,s){return e.map((o,i)=>Q(o,t,n,r,te(s,i)))}function mp(e,t,n,r){let s=(o)=>{if(!e.slice(o.length).includes("/"))return t;return yr(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?yr(e.slice(0,e.lastIndexOf("/")),t,n,r):void 0;return}function yr(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?de(o,s.slice(1).join("/")):o}if(e.startsWith("event#/")){let s=e.slice(7);return de(n,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,l=zs(t);if(o==="item")i=r?.item??l?.item??t["$map/item"];else if(o==="index")i=r?.index??l?.index??t["$map/index"];else i=l?.[o]??t[`$map/${o}`];return s.length>2?de(i,s.slice(2).join("/")):i}if(e.startsWith("#/state/"))return de(t,e.slice(8));if(e.startsWith("parent#/"))return de(t,e.slice(8));if(e.startsWith("window#/"))return de(ma(),e.slice(8));if(e.startsWith("document#/"))return de(globalThis.document,e.slice(10));return de(t,e)??null}function gp(e,t,n,r){if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,l=zs(t);if(o==="item")i=r?.item??l?.item??t["$map/item"];else if(o==="index")i=r?.index??l?.index??t["$map/index"];else i=l?.[o]??t[`$map/${o}`];if(s.length>2){let a=s.slice(2),c=a.pop(),u=a.length>0?de(i,a.join("/")):i;return{key:c,obj:u}}return{key:o==="item"?"$map/item":"$map/index",obj:zs(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let i=Ke(s),l=i.pop(),a=t;for(let c of i)a=a[c];return{key:l,obj:a}}return{key:e,obj:t}}function Ne(e,t,n,r,s){let o=hp(e,t,n,r,s);return s?.report(s.path??[],o),o}function ca(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 hp(e,t,n,r,s){let{operator:o,target:i,value:l,initial:a}=e;if(!lp.has(o))throw Error(`$expression: unknown operator "${o}"`);if(Gs.has(o)&&!("value"in e)){let c=Q(i,t,n,r,te(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=Vt(i)?i.$ref:void 0;if(!b(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>la)throw Error(`$expression: call depth exceeded (${la})`);let p=Array.isArray(l)?l.map((f,y)=>Q(f,t,n,r,te(s,["value",y]))):[];if(c.startsWith("window#/")){if(!ga(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let f=c.slice(8),y=up.get(f);if(y)return y(...pp(f,p,t));let h=ma(),m=de(h,f),g=f.lastIndexOf("/"),x=g===-1?h:de(h,f.slice(0,g));return m.apply(x,p)}let d=yr(c,t,n,r);if(Ae(d))return d.apply(mp(c,t,n,r),p);if(E(d)&&"$expression"in d){let f=d,y={};for(let[h,m]of(f.parameters??[]).entries()){let g=b(m)?m:m?.name??"";if(!g)continue;y[g]=p[h]===void 0&&E(m)&&"default"in m?m.default:p[h]}return Ne(f.$expression,t,n,{args:y,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Zs.has(o)){if(o==="?:"){let f=Q(i,t,n,r,te(s,"target"));if(s){let y=Q(l,t,n,r,te(s,"value")),h=Q(a,t,n,r,te(s,"initial"));return f?y:h}return f?Q(l,t,n,r):Q(a,t,n,r)}let c=Q(i,t,n,r,te(s,"target")),u=String(c),p=e.cases??{},d=Object.hasOwn(p,u);if(s){let f;for(let[h,m]of Object.entries(p)){let g=Q(m,t,n,r,te(s,["cases",h]));if(h===u)f=g}let y=Q(e.default,t,n,r,te(s,"default"));return d?f:y}return d?Q(p[u],t,n,r):Q(e.default,t,n,r)}if(Ys.has(o)){let c=Q(i,t,n,r,te(s,"target")),u=Q(l,t,n,r,te(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 ca(o,c,u)}}if(fa.has(o)){let c=Q(l,t,n,r,te(s,"value")),{obj:u,key:p}=gp(i.$ref,t,n,r);u[p]=o==="="?c:ca(o.slice(0,-1),u[p],c);return}if(da.has(o)){let c=Q(i,t,n,r,te(s,"target"));switch(o){case"push":return c.push(Q(l,t,n,r,te(s,"value")));case"unshift":return c.unshift(Q(l,t,n,r,te(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=Q(l,t,n,r,te(s,"value"));return c.splice(...u)}default:break}}if(Qs.has(o)){let c=Q(i,t,n,r,te(s,"target")),u=l===void 0?[]:Array.isArray(l)?ha(l,t,n,r,te(s,"value")):[Q(l,t,n,r,te(s,"value"))],p=de(c,o);if(!Ae(p))return;return p.apply(c,u)}if(Xs.has(o)){let c=Q(i,t,n,r,te(s,"target")),u=l;if(o==="reduce"){let p=Q(a,t,n,r,te(s,"initial"));for(let[d,f]of c.entries())p=Ne(u,t,n,{acc:p,index:d,item:f},d===0?te(s,"value"):void 0);return p}if(o==="map")return c.map((p,d)=>Ne(u,t,n,{...r,index:d,item:p},d===0?te(s,"value"):void 0));if(o==="filter")return c.filter((p,d)=>Ne(u,t,n,{...r,index:d,item:p},d===0?te(s,"value"):void 0))}return}function re(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(xr(e))return Je(e,t);if(Vt(e))return no(e.$ref,t);if(Array.isArray(e))return e.map((n)=>re(n,t)).join(", ");return JSON.stringify(e)}function yp(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function no(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 W("_args",e.slice(6));if(e.startsWith("event#/"))return W(r,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s;if(o==="item")return s.length>2?W("_item",s.slice(2).join("/")):"_item";if(o==="index")return"_index";return`_${o}`}if(e.startsWith("#/state/"))return W(n,e.slice(8));if(e.startsWith("parent#/"))return W(n,e.slice(8));if(e.startsWith("window#/"))return W("window",e.slice(8));if(e.startsWith("document#/"))return W("document",e.slice(10));return W(n,e)}function ua(e,t){if(Vt(e))return no(e.$ref,t);return re(e,t)}function xp(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(ze)})`,o=JSON.stringify(Hs);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 Je(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(Gs.has(n)&&!("value"in e)){let i=re(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(Vt(r)?r.$ref:void 0)??"",l=Array.isArray(s)?s.map((a)=>re(a,t)):[];if(i.startsWith("window#/")){if(!ga(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let a=xp(i.slice(8),l,t);if(a)return a;return`window.${i.slice(8).replaceAll("/",".")}(${l.join(", ")})`}if(i.startsWith("#/state/")){let a=i.slice(8),c=t.formulaParams?.[a];if(c){let u=c.map((p,d)=>`${JSON.stringify(p)}: ${l[d]??"undefined"}`).join(", ");return`${yp(a)}(${t.statePrefix??"state"}, { ${u} })`}}return`${no(i,t)}(${l.join(", ")})`}if(Zs.has(n)){if(n==="?:"){let c=re(r,t),u=re(s,t),p=re(o,t);return`(${c} ? ${u} : ${p})`}let i=re(r,t),l=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${re(u,t)} : `).join(""),a="default"in e?re(e.default,t):"undefined";return`((_d) => ${l}${a})(String(${i}))`}if(Ys.has(n)){let i=re(r,t),l=re(s,t);return`(${i} ${n} ${l})`}if(fa.has(n)){let i=ua(r,t),l=re(s,t);return`${i} ${n} ${l}`}if(da.has(n)){let i=ua(r,t);switch(n){case"push":return`${i}.push(${re(s,t)})`;case"unshift":return`${i}.unshift(${re(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let l=Array.isArray(s)?s.map((a)=>re(a,t)).join(", "):re(s,t);return`${i}.splice(${l})`}default:break}}if(Qs.has(n)){let i=re(r,t),l=s===void 0?"":Array.isArray(s)?s.map((a)=>re(a,t)).join(", "):re(s,t);return`(${i})?.${n}?.(${l})`}if(Xs.has(n)){let i=re(r,t),l=Je(s,t);if(n==="reduce"){let a=re(o,t);return`${i}.reduce((_acc, _item, _index) => ${l}, ${a})`}if(n==="map")return`${i}.map((_item, _index) => ${l})`;if(n==="filter")return`${i}.filter((_item, _index) => ${l})`}return"undefined"}function Wt(e,t,n,r){return Q(e,t,n,r)}function ot(e,t={}){return re(e,t)}var pa,Gs,Ys,fa,da,Xs,Zs,Qs,lp,cp,up,fp,la=64,dp=64;var Ht=S(()=>{qs();q();Ft();pa=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Gs=new Set(["!","-"]),Ys=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),fa=new Set(["=","+=","-=","*=","/="]),da=new Set(["push","pop","shift","unshift","splice"]),Xs=new Set(["reduce","map","filter"]),Zs=new Set(["?:","switch"]),Qs=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"]),lp=new Set([...pa,...Gs,...Ys,...Xs,...Zs,...Qs,"call"]),cp=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",...Bs]),up=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??ze,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??ze,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??ze,{timeZone:Hs,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??ze,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??ze,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??ze,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??ze,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??ze,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);fp=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function $p(e){return e.startsWith(ya)}function gh(e){let t=e;if($p(t))t=t.slice(ya.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${ro}${t}.js`}function hh(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${ro}${n}`:`${ro}${n}.${t}`}function xa(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function $a(e){let t=xa(e);return t.startsWith("/")?t:`/${t}`}function bp(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function yh(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 bp(e,"urlPrefix")){let o=$a(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let l=r.slice(o.length+1).split("/");if(l.some((c)=>c===""||c==="."||c===".."))return null;let{filter:a}=s;if(a&&!a(l.join("/")))return null;return`${xa(s.dir)}/${l.join("/")}`}return null}function xh(e,t){let n=new Set;for(let r of t){let s=$a(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${Sp}]+`,"g");for(let i of e.matchAll(o)){let l=i[0].split("#")[0].split("?")[0];if(!l.endsWith("/"))n.add(l)}}return[...n].filter(Boolean)}function wp(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 Ep(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function $h(e){if(!b(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 so(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function bh(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var ya="npm:",ro="/assets/",Sp;var oo=S(()=>{q();Sp=String.raw`"'\s<>()\\`});function ba(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 Jp(e){return(E(e)||Ae(e))&&"then"in e&&Ae(e.then)}async function Bt(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=ba(o);switch(i.kind){case"expression":{let l=Ne(i.node,t,n,s);if(Jp(l))await l;break}case"if":{let l=i.node,a=Wt(l.if,t,n,s)?l.then:l.else;if(Array.isArray(a))await Bt(a,t,n,r);break}case"switch":{let l=i.node,a=String(Wt(l.$switch,t,n,s)),c=l.cases??{},u=Object.hasOwn(c,a)?c[a]:l.default;if(Array.isArray(u))await Bt(u,t,n,r);break}case"dispatch":{let l=i.node,a=Ae(r.target)?r.target():r.target,c=n?.currentTarget??a;if(!c)break;let u={};if("detail"in l)u.detail=Wt(l.detail,t,n,s);if(l.bubbles!==void 0)u.bubbles=l.bubbles;if(l.composed!==void 0)u.composed=l.composed;c.dispatchEvent(new CustomEvent(l.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function ke(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=ba(s);switch(o.kind){case"expression":{r.push(`${n}${Je(o.node,t)};`);break}case"if":{let i=o.node,l=ot(i.if,t),a={...t,indent:`${n} `};if(r.push(`${n}if (${l}) {`,ke(i.then??[],a)),i.else)r.push(`${n}} else {`,ke(i.else,a));r.push(`${n}}`);break}case"switch":{let i=o.node,l=ot(i.$switch,t),a={...t,indent:`${n} `};r.push(`${n}switch (String(${l})) {`);for(let[c,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(c)}: {`,ke(u,a),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,ke(i.default,a),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,l=t.eventParam??"event",a=t.dispatchTarget??`(${l} && ${l}.currentTarget)`,c=[];if("detail"in i)c.push(`detail: ${ot(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}${a}?.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(`
13
+ `)}var $r=S(()=>{q();Ht()});var io=S(()=>{q()});function uo(e){if(e===vp)return"client";if(e===Op)return"server";return null}function jp(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function wa(e,t){return`${co}${jp(e)}#${t}`}function Ea(e){return e.startsWith(co)}function Ja(e){if(!Ea(e))return null;let t=e.slice(co.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 ao(e,t){if(Array.isArray(e)){let r=e.map((s)=>ao(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!C(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&b(s)){let i=uo(s);o=i===null?s:wa(t,i)}else if(r!=="$script")o=ao(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function po(e,t){return ao(e,t)}function Np(e){return Ap.test(e)&&!Cp.test(e)}function Sa(e){return uo(e)==="client"||Ja(e)?.side==="client"}function lo(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())lo(s,[...t,r],n);return n}if(!C(e))return n;if(b(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")lo(s,[...t,r],n);return n}function Tp(e){let t=e.at(-1);return b(t)?`"${t}"`:"this entry"}function Ah(e){let t=lo(e,[],[]),n=t.some((s)=>!s.lazy&&Sa(s.src)),r=[];for(let s of t){let o=Tp(s.path);if(!s.lazy&&Np(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&&Sa(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 co="jx-script:",vp="#client",Op="#server",Ap,Cp;var fo=S(()=>{q();Ap=/^\.{1,2}\//u,Cp=/\.json$/iu});function _p(e){for(let t of Object.keys(e))if(kp.has(t))return!0;return!1}function br(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Fi(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function Oa(){return[...va].toSorted()}function gt(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||va.has(n))return String(t);return t?"":null}function ja(e,t,n,r){let s=t.replaceAll(/-([a-z])/g,(i,l)=>l.toUpperCase());if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(be(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?ne(o)?0:"":i;return}e[s]=ne(o)?Number(n):n}function mo(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(b(r)&&B(r)){t.set(n,void 0);continue}if(E(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(Dp.some((s)=>(s in r))){t.set(n,void 0);continue}if(_p(r))continue}t.set(n,r)}return t}var kp,mt,va,Zh,Dp,go=32,Sr,wr="jx-slot",ho="data-jx-slots",yo="jx.slot.group",Qh;var Pn=S(()=>{Tn();Ht();Ft();q();On();oo();$r();io();fo();io();Tn();kp=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);mt=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"]),va=new Set(["contenteditable","draggable","spellcheck"]);Zh=Object.freeze({emptyRow:!0});Dp=["$expression","$prototype","$ref","$src"],Sr=/^[\t\n\f\r ]+$/u,Qh=(()=>{let e=Symbol.for(yo),t=globalThis;return t[e]??=new WeakMap,t[e]})()});var Mp,Ip;var Aa=S(()=>{Mp={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."},Ip={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var Lp;var Ca=S(()=>{Lp={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 Fp,Vp,Wp;var Na=S(()=>{Fp={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Vp={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},Wp={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var Hp;var Ta=S(()=>{Hp={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 Bp,qp;var Ra=S(()=>{Bp={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"},qp={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 Up;var Pa=S(()=>{Up={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 zp;var ka=S(()=>{zp={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Kp,Gp,Yp,Xp,Zp,Qp,ef,tf,nf;var _a=S(()=>{Kp={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Gp={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Yp={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Xp={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Zp={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Qp={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"},ef={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},tf={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"},nf={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var rf;var Da=S(()=>{rf={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 sf,of;var Ma=S(()=>{sf={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"},of={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 af,lf,cf,uf,pf,ff;var Ia=S(()=>{af={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},lf={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"},cf={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},uf={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"},pf={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"},ff={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 df;var La=S(()=>{df={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 mf;var Fa=S(()=>{mf={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 gf,hf;var Va=S(()=>{gf={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"}]},hf={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 xo,yf;var Wa=S(()=>{xo=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],yf={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 xf;var Ha=S(()=>{xf={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 $f,bf,Sf,wf,Ef,Jf,vf,Of,jf,Af,Cf,Nf,Tf,Rf,Pf,kf,_f;var Ba=S(()=>{qs();$f={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"},bf={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."},Sf={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."},wf={enum:["!","-"]},Ef={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},Jf={const:"?:"},vf={const:"switch"},Of={const:"call"},jf={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"]},Af={enum:["=","+=","-=","*=","/="]},Cf={enum:["pop","shift"]},Nf={enum:["push","unshift"]},Tf={const:"splice"},Rf={const:"reduce"},Pf={enum:["map","filter"]},kf={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 "+`${oa()}) — 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"},_f={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 Df,Mf,If,Lf;var qa=S(()=>{Df={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"}]},Mf={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},If={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Lf={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 Ua,Ff,Vf,Wf,Hf,Bf,qf,Uf,zf,Kf,Gf;var za=S(()=>{Ua=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],Ff={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"},Vf={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"},Wf={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"},Hf={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:Ua,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"},Bf={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"},qf={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"},Uf={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"},zf={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"},Kf={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"},Gf={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"}});function qt(e){if(!b(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Jy(e){let t=qt(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&Yf.has(r)?"rtl":"ltr"}function vy(e){let t=qt(e);if(t===null)return b(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Oy(e){let t=e.i18n,n=[];if(!E(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let l of r){let a=qt(l);if(a===null){n.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(a))s.push(a)}let o=qt(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&qt(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:Xf;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function jy(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=qt(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var Yf,Er="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",Xf="prefix-except-default";var Ka=S(()=>{q();Yf=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"])});var Ga,Zf;var Ya=S(()=>{Ka();Ga=[301,302,303,307,308],Zf={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:Er,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:Er,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Er,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:[...Ga],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 Qf;var Xa=S(()=>{Qf={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 Ry="https://jxsuite.com/schema/project/fields/v2",Py="https://jxsuite.com/schema/document/paths/v2",ed,td,ky,_y;var Za=S(()=>{ed={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"},td={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"},ky=[{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"}],_y={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 Qa=S(()=>{Aa();Ca();Na();Ta();Ra();Pa();ka();_a();Da();Ma();Ia();La();Fa();Va();Wa();Ha();Ba();qa();za();Ya();Xa();Za()});function el(e,t,n){let r=e.$description;if(b(r))(Object.keys(t).length>0?t:n).$description=r}function tl(e,t,n,r,s=nd,o={}){let i=[],l=(d,f)=>{let y={mediaQueries:t,scope:f,transposeValue:n};if(r)y.resolveValue=(h,m)=>r(h,m,f);for(let h of Lt(d,y))i.push(o.comments===!0?Nn(h):h.text)},a={},c={},u=[],p=[];for(let[d,f]of Object.entries(e)){if(E(f)&&!Array.isArray(f)){if(d.startsWith("@"))u.push([d,f]);else if(!d.startsWith("--"))p.push([d,f]);continue}if(dt(d)||d.startsWith("@")||d.startsWith("$"))continue;if(d.startsWith("--")||d==="colorScheme"||d==="color-scheme")a[d]=f;else c[d]=f}el(e,a,c),l(a,s.root),l(c,s.body);for(let[d,f]of p)if(d.startsWith("&"))l({[d]:f},s.root);else l(f,d);for(let[d,f]of u){if(jn(d)||Cn(d)){l({[d]:f},null);continue}let y={},h={},m=[];for(let[g,x]of Object.entries(f)){if(E(x)&&!Array.isArray(x)){if(!g.startsWith("@"))m.push([g,x]);continue}if(g.startsWith("$"))continue;if(g.startsWith("--"))y[g]=x;else h[g]=x}el(f,y,h),l({[d]:y},s.root),l({[d]:h},s.body);for(let[g,x]of m)l({[d]:x},g)}if(Object.values(t).some((d)=>rt(d)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${Ie}="light"]) { color-scheme: light }`,`${s.root}:where([${Ie}="dark"]) { color-scheme: dark }`);return i.join(`
14
+ `)}var nd;var nl=S(()=>{Tn();q();nd={body:"body",root:":root"}});function rl(e){return e===!1||e==="open"||e==="closed"}function Jr(e,t){let n=e?.$shadow;if(rl(n))return n===!1?null:n;let r=t?.shadow;return rl(r)&&r!==!1?r:null}function sl(e,t){return t===null?e:":host"}function Mn(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=ol(s);if(!o)continue;let i=il(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 ol(e){return b(e)?e:e?.name??""}function il(e){return E(e)&&"default"in e}function rd(e,t){let n=al(e,t);return n===e?e:`${n} as ${e}`}function al(e,t){let n=t?.$export;return b(n)&&n!==""?n:e}function Ar(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,l=B(i),a=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let c=[`// ${e}: auto-fetch from ${l?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(l)c.push(` const url = \`${od(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(i)};`);let u=[];if(a!=="GET")u.push(`method: ${JSON.stringify(a)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let d=E(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${d}`)}let p=u.length>0?`, { ${u.join(", ")} }`:"";return c.push(` fetch(url${p})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${r}.${e} = d; })`,` .catch(e => { ${r}.${e} = { error: String(e) }; });`,o?"}));":"});"),c.map((d)=>`${s}${d}`).join(`
15
+ `)}function Cr(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,l=JSON.stringify(`${i}/${t.$export}`),a=Object.entries(t.arguments??{}),c=a.map(([h,m])=>{if(!Y(m))return`${st(h)}: ${JSON.stringify(m)}`;if(sd.some((g)=>m.$ref.startsWith(g)))throw Error(`Server function "${e}": argument "${h}" references "${m.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${st(h)}: ${ot({$ref:m.$ref},{statePrefix:r})}`}),u=a.some(([,h])=>Y(h)),p=`${xl}(${l}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,d=W(r,Se(e)),f=`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;",` ${p}`,` .then((d) => { if (_seq === _jxSeq) ${d} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${f}; });`,o?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,p,` .then((d) => { ${d} = d; })`,` .catch((e) => { ${f}; });`]).map((h)=>`${s}${h}`).join(`
16
+ `)}function od(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function cl(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${kn}\??\.${kn}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${kn}(?:\?\.)?\[${kn}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||id.test(e)}function ul(e,t){let n=to(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)=>E(c)&&!Array.isArray(c)&&b(c.$src)),l=new Set(s.filter((c)=>i||cl(o,c)));for(let c of l)for(let u of eo(n[c]))if(!(u in r))l.add(u);if(l.size===0)return e;let a=Object.fromEntries(s.filter((c)=>l.has(c)).map((c)=>[c,n[c]]));return{...e,state:{...a,...r}}}function ad(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Rn(n)));return JSON.stringify({...e,state:t})}function Nr(e){if(b(e))return B(e);if(!E(e))return!1;if(e.state){let t;for(let[n,r]of Object.entries(e.state)){if(n==="$site"||n==="$page")continue;if(!E(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(Rn(r)){if(t??=ad(e),cl(t,n))return!0;continue}if(r.$prototype)return!0;if("default"in r)return!0;if(ft(r))continue;return!0}}if(e.$switch)return!0;if(le(e)||Di(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>Nr(t)))return!0;for(let[t,n]of Object.entries(e)){if(mt.has(t))continue;if(Y(n))return!0;if(B(n))return!0}if(E(e.style)){for(let t of Object.values(e.style))if(B(t))return!0}if(E(e.attributes)){for(let t of Object.values(e.attributes))if(B(t))return!0}return!1}function Gt(e,t=null,n={},r={}){let s=e?.state?wo(e.state,t):t??pl();return{media:r,scope:s,scopeDefs:n}}function pl(e=null){return Object.create(e)}function Jo(e){return e[ll]}function Sx(e,t){return Jo(e)?.has(t)??!1}function fd(e,t,n){if(t>0&&ud.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!pd.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function Yt(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:jt(e),o="",i=0;for(let l=s.indexOf("state");l!==-1;l=s.indexOf("state",l+1))if(fd(s,l,r))o+=e.slice(i,l)+t,i=l+5;return o+e.slice(i)}function So(e,t){if(b(e)){if(!e.includes("state."))return;let o=jt(e);for(let i of o.matchAll(ld))t.add(i[1]);for(let i of o.matchAll(cd))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)So(o,t);return}if(!E(e))return;let n=e,{operator:r,target:s}=n;if(b(r)&&Ge(r)&&Y(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))So(o,t)}function ht(e,t){if(ue(t)&&Ls(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function Tr(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(ht(`state entry "${r}"`,s),!ue(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:al(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(rd(r,s))}return n}function Rr(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 l=`_jxLazy${s}`;s+=1,r.push(`let ${l};`,`const ${l}Load = () => (${l} ??= import('${t?t(o):o}'));`,...i.map(({binding:a,exportName:c})=>`const ${a} = (...args) => ${l}Load().then((m) => m.${c}(...args));`))}return{imports:n,loaders:r}}function wo(e={},t=null){let n=pl(t),r=t?Jo(t):void 0,s=new Set(r);Object.defineProperty(n,ll,{configurable:!0,enumerable:!1,value:s,writable:!0});let o=new Set;for(let u of Object.values(e))if(ue(u)||Ce(u))So(u.body??u.$expression,o);for(let u of o)if(u in e)s.add(u);let i=At({state:e});for(let[u,p]of Object.entries(e)){if(!E(p)||Array.isArray(p)){it(n,u,vr(p));continue}if("default"in p){it(n,u,vr(p.default));continue}if(nt(p)){s.add(u);continue}if(!p.$prototype&&!("$expression"in p)&&!ft(p))it(n,u,vr(p))}let l=[],a=[];for(let[u,p]of Object.entries(e)){if(B(p)){l.push([u,p]);continue}if(!E(p))continue;if(Ce(p)){let d=p.$expression;if(et(p)){let f=p.parameters;it(n,u,(...y)=>{let h={};for(let[m,g]of f.entries()){let x=ol(g);if(!x)continue;h[x]=y[m]===void 0&&il(g)?g.default:y[m]}return Ne(d,n,null,{args:h})})}else if(Ge(d.operator))it(n,u,(f,y)=>Ne(d,f,y));else $o(n,u,()=>Ne(d,n,null));continue}if(ue(p)){if(ht(`state entry "${u}"`,p),Be(p)){let{body:d}=p;it(n,u,(f,y)=>{Bt(d,f??n,y??null)})}else if(b(p.body)){let{body:d}=p,f=Function(...Ue(p),d);if(i.get(u)==="computed")$o(n,u,()=>f(n)),a.push([u,d]);else it(n,u,f)}else it(n,u,()=>{}),s.add(u);continue}if(tt(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){it(n,u,vr(p.default??null));continue}if(tt(p)&&p.$prototype==="Request")s.add(u);if(Zt(p))s.add(u)}let c=!0;while(c){c=!1;for(let[u,p]of[...a,...l])if(!s.has(u)&&fl(p,n))s.add(u),c=!0}for(let[u,p]of l)$o(n,u,()=>vo(p,n));return n}function it(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function $o(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function U(e,t){if(Y(e))return dd(e.$ref,t);if(B(e))return vo(e,t);return e}function me(e){return Y(e)}function dd(e,t){if(!b(e))return e;if(e.startsWith("$map/")){let n=e.split("/"),r=n[1],o=t.$map?.[r]??t[`$map/${r}`];return n.length>2?bo(o,n.slice(2).join("/")):o}if(e.startsWith("#/state/"))return bo(t,e.slice(8));return bo(t,e)??null}function fl(e,t){if(!t)return!1;let n=Jo(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(Ae(o))return!0}return!1}function Pr(e){return br(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function vo(e,t){if(fl(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page];try{let s=br(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,s)(...r)}catch{return null}}function bo(e,t){return de(e,t)}function vr(e){if(!E(e))return e;return structuredClone(e)}function md(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&B(r)).map(([n,r])=>{let s=U(r,t);return s==null?null:`${Oe(n)}: ${s}`}).filter(Boolean).join("; ")}function Ct(e,t,n=""){let r="",s=U(e.id,t),o=Fn(e),i=o?U(Vn(e),t):null,l=[b(i)||ne(i)?String(i):"",xt(e)??""].filter((y)=>y!=="").join(" "),a=U(e.hidden,t),c=U(e.tabIndex,t),u=U(e.title,t),p=U(e.lang,t),d=U(e.dir,t);if(s)r+=` id="${L(String(s))}"`;if(l)r+=` class="${L(l)}"`;if(a)r+=" hidden";if(c!==void 0&&c!==null)r+=` tabindex="${L(String(c))}"`;if(u)r+=` title="${L(String(u))}"`;if(p)r+=` lang="${L(String(p))}"`;if(d)r+=` dir="${L(String(d))}"`;let f=[md(e.style,t),n].filter(Boolean).join("; ");if(f)r+=` style="${L(f)}"`;if(e.attributes)for(let[y,h]of Object.entries(e.attributes)){if(o&&y==="class")continue;let m=U(h,t);if(be(m)){let g=gt(y,m);if(g!==null)r+=g===""?` ${y}`:` ${y}="${L(g)}"`;continue}if(b(m)||ne(m))r+=` ${y}="${L(String(m))}"`}if(e.$static)r+=" data-jx-static";else if(e.$prerendered)r+=" data-jx-prerendered";return r}function In(e,t=" "){return e?"":`
17
+ ${t}`}function kr(){let e=JSON.stringify(gr),t=JSON.stringify(Ie);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Or(e,t,n,r){for(let s of Lt(t,{mediaQueries:r,resolveValue:(o,i)=>dl(o,i,n),scope:n}))e.push(Nn(s))}function dl(e,t,n){let r=b(t)?t:t.$ref;return gd.push({property:e,selector:n,source:r}),null}function _r(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Oa())});
18
+ function ${Xt}(n, v) {
18
19
  if (typeof v !== 'boolean') return v;
19
20
  const l = n.toLowerCase();
20
21
  if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
21
22
  return v ? '' : null;
22
- }`}function Nr(){return[`async function ${ha}(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(`
23
- `)}function xa(){let e=`new RegExp(${JSON.stringify(pr.source)}, ${JSON.stringify(pr.flags)})`,t=`Symbol.for(${JSON.stringify(Ys)})`,n=JSON.stringify(Gs),r=JSON.stringify(dr);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${so}(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 ${oo}(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(`
24
- `)}function Wt(e){for(let t of io(e)){if(se(t)){if(t.map&&Wt([t.map]))return!0;continue}if(!yn(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>yn(r)&&!we(r));if(Wt(n)||Wt(t.children))return!0}return!1}function io(e){if(se(e))return[e];if(!Array.isArray(e))return[];return e}function Yt(e,t={},n=null){let r=[],s=na(E(n)?n:{},t,(i)=>i,ga);if(s!=="")r.push(s);if(Bt(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
25
- ${Lu(r.join(`
23
+ }`}function ml(){return[`function ${Oo}(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 ${jo}(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(`
24
+ `)}function gl(){return[`function ${Dr}(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(`
25
+ `)}function hl(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Ln(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>b(n)):[]}function yl(e){let t=mo(e),n=new Set(Ln(e).map((s)=>hl(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function Mr(){return[`async function ${xl}(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(`
26
+ `)}function yd(e){let t={};for(let[n,r]of Object.entries(e))if(!hd.has(n)&&r!==void 0)t[n]=r;return t}function $d(e){return tt(e)&&!xd.has(e.$prototype)}function Zt(e){return $d(e)&&e.timing==="client"}function Ir(){return[`async function ${$l}(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(`
27
+ `)}function Lr(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!Zt(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),l=r.get(i);if(l===void 0)l=`_JxClass${r.size}`,r.set(i,l);n.push({binding:l,config:yd(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function Fr(e,t){let{indent:n,instances:r,statePrefix:s}=t,o=["Promise.all(["];for(let{binding:i,config:l,key:a,name:c}of e){let u=W(s,Se(a)),p=JSON.stringify(a);o.push(`${n} ${$l}(${i}, ${JSON.stringify(c)}, ${JSON.stringify(l)}).then(([v, i]) => {`,`${n} ${u} = v;`,`${n} ${r}.set(${p}, i);`,`${n} if (typeof i.subscribe === 'function') i.subscribe((n) => { ${u} = n; });`,`${n} }).catch((e) => { console.error(${JSON.stringify(`Jx: external class "${a}" failed`)}, e); }),`)}return o.push(`${n}])`),o.join(`
28
+ `)}function bl(){let e=`new RegExp(${JSON.stringify(Sr.source)}, ${JSON.stringify(Sr.flags)})`,t=`Symbol.for(${JSON.stringify(yo)})`,n=JSON.stringify(ho),r=JSON.stringify(wr);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${Ao}(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 ${Co}(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(`
29
+ `)}function Ut(e){for(let t of No(e)){if(le(t)){if(t.map&&Ut([t.map]))return!0;continue}if(!wn(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>wn(r)&&!me(r));if(Ut(n)||Ut(t.children))return!0}return!1}function No(e){if(le(e))return[e];if(!Array.isArray(e))return[];return e}function en(e,t={},n=null){let r=[],s=tl(E(n)?n:{},t,(i)=>i,dl,void 0,{comments:!0});if(s!=="")r.push(s);if(Jl(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
30
+ ${bd(r.join(`
26
31
  `))}
27
- </style>`}function Lu(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Bt(e,t,n,r="",s,o="jx"){let i=s??{n:0};if(!E(e))return;if(e.style&&!e.id&&!e.className)e.className=`${o}-${i.n}`,i.n+=1;let l=kt(e.tagName).join(", ")||"*",a=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:l;if(e.style)hr(t,e.style,a,n);if(Array.isArray(e.children))for(let c of e.children)Bt(c,t,n,a,i,o);if(E(e.cases))for(let c of Object.values(e.cases))Bt(c,t,n,a,i,o)}function D(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Ar(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function km(e){let t=new Set;return ya(e,t),[...t]}function ya(e,t){if(!E(e))return;if(e.state){for(let n of Object.values(e.state))if(oe(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)ya(n,t)}function Im(e){let t=[];return $a(e,t),t}function $a(e,t){if(!E(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(Xe(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)$a(n,t)}function lo(e,t){if(y(e))return e;let n=kt(e);if(n.length===0)return"div";if(!Fe(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return q(s,t)?r.value:r.initial;let o=q(s,t);return r.cases[String(o)]??r.default}function Fu(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Vu(e,t,n,r=null){let s=new Map;for(let o of io(e)){let i="",l=!0,a;if(y(o)||le(o)||Se(o)){if(a=n(o),pr.test(a))continue;l=a!==""}else if(se(o))a="";else if(!yn(o))a=n(o),l=a!=="";else{let u=q(o.attributes?.slot,t),f=y(o.slot)?q(o.slot,t):null;if(y(u)&&u!=="")i=u,a=n(o);else if(y(f)&&f!==""){i=f;let{slot:p,...d}=o;a=n({...d,attributes:{...d.attributes,slot:f}})}else a=n(o)}let c=s.get(i);if(c)c.html=c.html===""?a:`${c.html}
28
- ${a}`,c.content||=l;else s.set(i,{content:l,html:a})}return{groups:s,id:r,taken:new Set}}function Sa(e,t,n){for(let r of io(e)){if(se(r)||!yn(r))continue;if(r.tagName==="slot"){let s=q(r.attributes?.name,t);n.taken.add(y(s)?s:"")}Sa(r.children,t,n)}}function Wu(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 ba(e,t){if(!t)return eo(e.state??{},null);let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=E(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return eo(n,null)}function Bu(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!V(r))return[];let s=q(r,t);return s==null?[]:[[n,s]]}))}function Cn(e,t,n,r){if(e.textContent!==void 0){let s=q(e.textContent,t);return s!=null?D(String(s)):""}if(e.innerHTML){let s=q(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>xr(s,t,n,r)).join(`
29
- `);return""}function xr(e,t,n=null,r=null){if(y(e)){if(V(e)&&t){let l=ro(e,t);return l!=null?D(String(l)):D(e)}return D(e)}if(le(e)||Se(e))return D(String(e));if(Array.isArray(e))return e.map((l)=>xr(l,t,n,r)).join(`
30
- `);if(!E(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let l=e.tagName??"div",a=Ot(e,t),c=q(e.$switch,t),u=c==null?void 0:e.cases?.[String(c)],f=u!==void 0&&!we(u)?xr(u,t,n,r):"";return`<${l}${a}>${f}</${l}>`}let s=lo(e.tagName,t);if(s==="slot"&&n){let l=q(e.attributes?.name,t),a=y(l)?l:"",c;if(!n.taken.has(a))n.taken.add(a),c=n.groups.get(a);let u=c?.html??"";if(u!==""&&n.id!==null)u=`<!--${dr} ${n.id} ${encodeURIComponent(a)}-->${u}<!--/${dr} ${n.id}-->`;if(c?.content)return Sa(e.children,t,n),u;let f=Cn(e,t,n,r);return u===""?f:f===""?u:`${u}
31
- ${f}`}let o=r?.componentDefs.get(s);if(o&&r)return Hu(e,o,t,n,r);let i=Ot(e,t);if(ao.has(s))return`<${s}${i}>`;return`<${s}${i}>${Cn(e,t,n,r)}</${s}>`}function Hu(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:l}=Wu(e.attributes),a={...i,...e.$props},c={};for(let[j,re]of Object.entries(a))c[j]=q(re,n)??re;let u=Object.keys(c).length>0,f=s.path??[],p={key:JSON.stringify(c),tag:o},d=[...f.map((j)=>j.tag),o].join(" → ");if(f.some((j)=>j.tag===p.tag&&j.key===p.key))throw Error(`Component <${o}> renders itself: ${d}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(f.length>=Ks)throw Error(`Component nesting exceeds ${Ks} levels: ${d}. A component that renders itself with changing props needs a case that stops.`);let h={...s,path:[...f,p]},{children:m}=e,g=(j)=>xr(j,n,r,s),x=mr(t,s.defaults),w=Uu(t),O=ba(t,u?c:null),J,S=null;if(x){let j=Array.isArray(m)?m.map((re)=>g(re)).join(`
32
- `):"";J=`<template shadowrootmode="${x}"><link rel="stylesheet" href="/components/${o}.css">${Cn(t,O,null,h)}</template>${j}`}else{S=!w&&Wt(t.children)?Fu(s):null;let j=Vu(m,n,g,S);J=Cn(t,O,j,h)}let b=Object.entries(Bu(t.style,O)).map(([j,re])=>`${be(j)}: ${re}`).join("; "),A={...e};if(delete A.$props,delete A.children,A.attributes=!w&&u?{...l,"data-jx-props":JSON.stringify(c)}:l,S!==null)A.attributes={...A.attributes,[Gs]:String(S)};if(w)A.$static=!0;else A.$prerendered=!0;return`<${o}${Ot(A,n,b)}>${J}</${o}>`}function Dm(e,t=null,n=null,r=null){return Cn(e,ba(e,t),n,r)}function Uu(e){return to(e)}function to(e){if(!E(e))return!0;if(Array.isArray(e))return e.every((t)=>to(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!E(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)=>to(t));if(se(e.children))return!1;return!0}function zu(e,t){return En(e).map((n)=>Ku(n,t)).join(", ")}function Ku(e,t){let n=or(e,t);if(n!==null)return n;if(e.startsWith(":host")){let r=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return r===void 0?t:`${t}${r}`}if(t===":host"&&qu.test(e))return e;return`${t}${e}`}function Mm(e,t,n=null,r={},s=null){let o=[],i=oa(e,s);if(E(t)){let l={},a=[];for(let[c,u]of Object.entries(t))if(U(u))l[c]=u;else if(E(u)&&!Array.isArray(u))a.push([c,u]);else if(!c.startsWith("@")&&!ft(c))l[c]=u;hr(o,l,i,r);for(let[c,u]of a)if(c.startsWith("@"))hr(o,{[c]:u},i,r);else if(ft(c))hr(o,u,zu(c,i),r)}if(n&&Array.isArray(n.children)){let l={n:0};for(let a of n.children)Bt(a,o,r,"",l,e)}return o.length>0?`${o.join(`
32
+ </style>`}function bd(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function xt(e){return e[Sl]}function wl(e,t,n){let r=xt(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[Sl]=s,s}function Vr(e){let{children:t}=e;if(Array.isArray(t))return t;return le(t)?[t]:[]}function _n(e,t){if(!E(e))return;if(le(e)){if(e.map)_n(e.map,t);return}t(e);for(let n of Vr(e))_n(n,t);if(E(e.cases))for(let n of Object.values(e.cases))_n(n,t)}function El(e,t,n){_n(e,(r)=>{if(r.style)wl(r,t,n)})}function Fn(e){return xt(e)!==void 0||Boolean(e.className)}function Vn(e){let{attributes:t}=e;return E(t)&&Object.hasOwn(t,"class")?t.class:e.className}function Jl(e,t,n,r="",s,o="jx"){let i=s??{n:0};_n(e,(l)=>{if(l.style)Or(t,l.style,`.${wl(l,i,o)}`,n)})}function L(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Wr(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function wx(e){let t=new Set;return vl(e,t),[...t]}function vl(e,t){if(!E(e))return;if(e.state){for(let n of Object.values(e.state))if(ue(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)vl(n,t)}function Ex(e){let t=[];return Ol(e,t),t}function Ol(e,t){if(!E(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(nt(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)Ol(n,t)}function Ro(e,t){if(b(e))return e;let n=En(e);if(n.length===0)return"div";if(!qe(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return U(s,t)?r.value:r.initial;let o=U(s,t);return r.cases[String(o)]??r.default}function Sd(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function wd(e,t,n,r=null){let s=new Map;for(let o of No(e)){let i="",l=!0,a;if(b(o)||ne(o)||be(o)){if(a=n(o),Sr.test(a))continue;l=a!==""}else if(le(o))a="";else if(!wn(o))a=n(o),l=a!=="";else{let u=U(o.attributes?.slot,t),p=b(o.slot)?U(o.slot,t):null;if(b(u)&&u!=="")i=u,a=n(o);else if(b(p)&&p!==""){i=p;let{slot:d,...f}=o;a=n({...f,attributes:{...f.attributes,slot:p}})}else a=n(o)}let c=s.get(i);if(c)c.html=c.html===""?a:`${c.html}
33
+ ${a}`,c.content||=l;else s.set(i,{content:l,html:a})}return{groups:s,id:r,taken:new Set}}function jl(e,t,n){for(let r of No(e)){if(le(r)||!wn(r))continue;if(r.tagName==="slot"){let s=U(r.attributes?.name,t);n.taken.add(b(s)?s:"")}jl(r.children,t,n)}}function Ed(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 Po(e,t){if(!t)return wo(e.state??{},null);let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=E(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return wo(n,null)}function Jd(e,t,n){let r=Ln(e).filter((l)=>Object.hasOwn(t??{},l));if(!t||r.length===0)return null;let s=mo(e),o=Po(e,null),i=null;for(let l of r){let a=U(t[l],n),c=null;if(be(a))c=gt(l,a);else if(b(a)||ne(a))c=String(a);let u=hl(l);if(c===null||s.has(u)&&s.get(u)===void 0)continue;ja(o,l,c,s),i??={},i[u]=o[u]}return i}function vd(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!B(r))return[];let s=U(r,t);return s==null?[]:[[n,s]]}))}function Dn(e,t,n,r){if(e.textContent!==void 0){let s=U(e.textContent,t);return s!=null?L(String(s)):""}if(e.innerHTML){let s=U(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>jr(s,t,n,r)).join(`
34
+ `);return""}function jr(e,t,n=null,r=null){if(b(e)){if(B(e)&&t){let l=vo(e,t);return l!=null?L(String(l)):L(e)}return L(e)}if(ne(e)||be(e))return L(String(e));if(Array.isArray(e))return e.map((l)=>jr(l,t,n,r)).join(`
35
+ `);if(!E(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let l=e.tagName??"div",a=Ct(e,t),c=U(e.$switch,t),u=c==null?void 0:e.cases?.[String(c)],p=u!==void 0&&!me(u)?jr(u,t,n,r):"";return`<${l}${a}>${p}</${l}>`}let s=Ro(e.tagName,t);if(s==="slot"&&n){let l=U(e.attributes?.name,t),a=b(l)?l:"",c;if(!n.taken.has(a))n.taken.add(a),c=n.groups.get(a);let u=c?.html??"";if(u!==""&&n.id!==null)u=`<!--${wr} ${n.id} ${encodeURIComponent(a)}-->${u}<!--/${wr} ${n.id}-->`;if(c?.content)return jl(e.children,t,n),u;let p=Dn(e,t,n,r);return u===""?p:p===""?u:`${u}
36
+ ${p}`}let o=r?.componentDefs.get(s);if(o&&r)return Od(e,o,t,n,r);let i=Ct(e,t);if(To.has(s))return`<${s}${i}>`;return`<${s}${i}>${Dn(e,t,n,r)}</${s}>`}function Od(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:l}=Ed(e.attributes),a={...i,...e.$props},c={};for(let[H,j]of Object.entries(a))c[H]=U(j,n)??j;let u=Object.keys(c).length>0,p={...Jd(t,l,n),...c},d=Object.keys(p).length>0,f=s.path??[],y={key:JSON.stringify(p),tag:o},h=[...f.map((H)=>H.tag),o].join(" → ");if(f.some((H)=>H.tag===y.tag&&H.key===y.key))throw Error(`Component <${o}> renders itself: ${h}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(f.length>=go)throw Error(`Component nesting exceeds ${go} levels: ${h}. A component that renders itself with changing props needs a case that stops.`);let m={...s,path:[...f,y]},{children:g}=e,x=(H)=>jr(H,n,r,s),w=Jr(t,s.defaults),O=jd(t),A=Po(t,d?p:null),T,_=null;if(w){let H=Array.isArray(g)?g.map((j)=>x(j)).join(`
37
+ `):"";T=`<template shadowrootmode="${w}"><link rel="stylesheet" href="/components/${o}.css">${Dn(t,A,null,m)}</template>${H}`}else{_=!O&&Ut(t.children)?Sd(s):null;let H=wd(g,n,x,_);T=Dn(t,A,H,m)}let G=Object.entries(vd(t.style,A)).map(([H,j])=>`${Oe(H)}: ${j}`).join("; "),N={...e};if(delete N.$props,delete N.children,N.attributes=!O&&u?{...l,"data-jx-props":JSON.stringify(c)}:l,_!==null)N.attributes={...N.attributes,[ho]:String(_)};if(O)N.$static=!0;else N.$prerendered=!0;return`<${o}${Ct(N,n,G)}>${T}</${o}>`}function Jx(e,t=null,n=null,r=null){return Dn(e,Po(e,t),n,r)}function jd(e){if(Ln(e).length>0)return!1;return Eo(e)}function Eo(e){if(!E(e))return!0;if(Array.isArray(e))return e.every((t)=>Eo(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!E(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)=>Eo(t));if(le(e.children))return!1;return!0}function Cd(e,t){return An(e).map((n)=>Nd(n,t)).join(", ")}function Nd(e,t){let n=mr(e,t);if(n!==null)return n;if(e.startsWith(":host")){let r=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return r===void 0?t:`${t}${r}`}if(t===":host"&&Ad.test(e))return e;return`${t}${e}`}function vx(e,t,n=null,r={},s=null){let o=[],i=sl(e,s);if(E(t)){let l={},a=[];for(let[c,u]of Object.entries(t))if(Y(u))l[c]=u;else if(E(u)&&!Array.isArray(u))a.push([c,u]);else if(!c.startsWith("@")&&!dt(c))l[c]=u;Or(o,l,i,r);for(let[c,u]of a)if(c.startsWith("@"))Or(o,{[c]:u},i,r);else if(dt(c))Or(o,u,Cd(c,i),r)}if(n){let l={n:0};for(let a of Vr(n))Jl(a,o,r,"",l,e)}return o.length>0?`${o.join(`
33
38
  `)}
34
- `:""}var Au,ca,Ht="https://esm.sh/@vue/reactivity@3.5.40",Ut="https://esm.sh/lit-html@3.3.0",jn,Cu,Tu,Ru,_u,Pu,dt,Mu,Kt="__jxAttrText",ha="__jxServerCall",so="__jxCaptureSlotted",oo="__jxDistributeSlots",Gt="<!---->",ao,qu;var Xt=N(()=>{bn();An();On();Ft();ur();ra();W();Dt();An();Ft();ur();W();Ft();Au=["$map/","event#/","$args/","$reduce/"];ca=Symbol("jx.runtimeOnlyStateKeys"),jn=String.raw`(?:\s|\\[nrt])*`,Cu=new RegExp(String.raw`(?:=|\.\.\.)${jn}state[ \t]*(?:[;,)}\]"]|\\[nr])`);Tu=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,Ru=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,_u=/[\w$.]/u,Pu=/[\w$]/u;dt=new Set(["pre","textarea","listing","plaintext","xmp"]);Mu=[];ao=new Set(["input","br","hr","img","meta","link","area","col","source"]);qu=/^(?:::slotted\(|::part\()/});class wa{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(`
39
+ `:""}var sd,ll,zt="https://esm.sh/@vue/reactivity@3.5.40",Kt="https://esm.sh/lit-html@3.3.0",kn,id,ld,cd,ud,pd,yt,gd,Xt="__jxAttrText",Oo="__jxSupplies",jo="__jxNativeSetter",Dr="__jxAbsorbAttr",xl="__jxServerCall",hd,xd,$l="__jxInstantiate",Ao="__jxCaptureSlotted",Co="__jxDistributeSlots",Qt="<!---->",Sl,To,Ad;var tn=S(()=>{On();Pn();Tn();Ht();$r();Qa();nl();q();Ft();Pn();Ht();$r();q();Ht();sd=["$map/","event#/","$args/","$reduce/"];ll=Symbol("jx.runtimeOnlyStateKeys"),kn=String.raw`(?:\s|\\[nrt])*`,id=new RegExp(String.raw`(?:=|\.\.\.)${kn}state[ \t]*(?:[;,)}\]"]|\\[nr])`);ld=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,cd=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,ud=/[\w$.]/u,pd=/[\w$]/u;yt=new Set(["pre","textarea","listing","plaintext","xmp"]);gd=[];hd=new Set(["$prototype","$src","$export","timing","default","description"]);xd=new Set(xo);Sl=Symbol("jx.styleHandle");To=new Set(["input","br","hr","img","meta","link","area","col","source"]);Ad=/^(?:::slotted\(|::part\()/});class Al{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(`
35
40
  `,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)===`
36
41
  `)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===`
37
- `||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function Zt(e){if(Gu.test(e))return"unreadable";let t=new wa(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]=Yu.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 Gu,Yu;var Rn=N(()=>{Gu=/\0/u,Yu=/^[^\s\\/(){};[\]"#=]+/u});function Ja(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():Qu(o(),r),l=()=>{s+=1;let a="";while(s<e.length){let c=e[s];if(c==="\\"){let u=e[s+1]??"";if(u==="u")a+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else a+=Xu.get(u)??u,s+=2;continue}if(c==='"')return s+=1,a;a+=c,s+=1}return a};while(s<e.length){let a=e[s];if(Ea.has(a)||a===","||a===":"){s+=1;continue}if(a==="{"||a==="["){n.push(a==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(a==="}"||a==="]"){n.pop(),r=null,s+=1;continue}if(a==='"'){let u=l(),f=n.at(-1);if(f?.kind==="object"&&Zu(e,s)===":"){if(f.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:f.path});f.keys.add(u),r=u}else r=null;continue}if(a==="-"||a>="0"&&a<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let f=e.slice(u,s);if(!ef(f))t.push({detail:f,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 Zu(e,t){let n=t;while(n<e.length&&Ea.has(e[n]))n+=1;return e[n]??""}function Qu(e,t){return e===""?t:`${e}.${t}`}function ef(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Oa(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 Ea,Xu;var Na=N(()=>{Ea=new Set([" ","\t",`
38
- `,"\r"]);Xu=new Map([["b","\b"],["f","\f"],["n",`
39
- `],["r","\r"],["t","\t"]])});function tf(e){return e instanceof Error?e.message:String(e)}function ja(e){if(y(e))return Aa.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>ja(t));if(C(e))return Qt(e);return e}function Qt(e){let t={};for(let[n,r]of Object.entries(e))t[Aa.test(n)?n.normalize("NFC"):n]=ja(r);return t}function co(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${tf(o)}`,{cause:o})}if(!C(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Ja(e);if(s.length>0){let o=s.map((i)=>Oa(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return Qt(r)}function Ca(e,t){return co(e,t,"Jx document")}function va(e,t){return co(e,t,"project config")}function Gm(e,t){return co(e,t,"class definition")}var Aa;var _n=N(()=>{W();Na();Aa=/[^\p{ASCII}]/u});function In(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 xt(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Mr(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 z(e){return!isNaN(e)&&!In(e)&&!xt(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 Ta(e){return e>=65&&e<91||e>=97&&e<123||!1}function uo(e){return e>=48&&e<64||e>=65&&e<71||e>=97&&e<103||!1}function fo(e){return uo(e)||e===95}function st(e){return e>=48&&e<58}function Ct(e){return st(e)||e===95}function po(e){return e>=48&&e<56}function Ra(e){return po(e)||e===95}function mo(e){return e===48||e===49}function _a(e){return mo(e)||e===95}function Pa(e){return e===45||e===43}var mt=1,en=2,Nt=3,jr=4,Cr=5,Pn=6,vr=7,Tr=8,kn=9,gt=10,me=11,tn=12,nn=13,Rr=14,rt=15,_r=16,Pr=17,At=18,ht=19,kr=20,Ir=21,Dr=22,rn=23,jt=24,Ue=28;function*rf(e){for(let t of(nf??=new Intl.Segmenter("en")).segment(e))yield t.segment}function sf(e){return e[Symbol.iterator]()}function ka(e,{flags:t,graphemeLocations:n=!1}){let r=n?rf(e):sf(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*Ia(e){if(M(e,65279))e.column=1,yield T(e,en);if(Mr(e.current))throw qe(e,`Invalid character \\u${e.current.toString(16)}`)}function Q(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(Mr(n))if(n>=55296&&n<=57343||n>1114111)Dn(e,`Invalid character \\u${n.toString(16)}`);else Dn(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 ke(e,t){if(t(e.current)){let n=e.current;return Q(e),n}}function M(e,t){if(e.current===t)return Q(e),t}function sn(e){if(!xt(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return Q(e),e.column=1,e.line++,!0}function go(e,t){while(e.current===t)Q(e)}function B(e,t){while(t(e.current))Q(e)}function T(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},l=e.start;e.start=i;let a=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(l.offset,i.offset),start:l,end:i,errors:a};if(n){if(!c.errors)c.errors=[];c.errors.push(new L(n,{token:c}))}return c}function qe(e,t){if(t instanceof L)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(xt(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new L(`${t}`,{start:o,end:i})}function Dn(e,t){(e.errorsInToken??=[]).push(qe(e,t))}var nf;var Da=N(()=>{vt()});function Tt(e){return(t)=>(Q(t),T(t,e))}function Mn(e){return B(e,In),T(e,At)}function Rt(e){return sn(e),T(e,ht)}function of(e){Q(e);let t=!1,n=!1;if(M(e,34)){if(!M(e,34))return T(e,kn);if(n=!0,e.current===34)throw qe(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(M(e,34)){if(M(e,34)&&M(e,34))t=!0}else M(e,92),sn(e)||Q(e)}else while(!t&&e.offset<e.length)if(M(e,34))t=!0;else M(e,92),sn(e)||Q(e);if(!t)throw qe(e,"Unexpected EOF inside string");return T(e,n?rn:kn)}function Ma(e){if(Q(e),e.current===35||e.current===34){let t=1;while(M(e,35))t++;if(!M(e,34))throw qe(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(M(e,34))if(M(e,34)){if(e.current===34)throw qe(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(M(e,35))r++;if(r===t)return T(e,gt)}while(!0){if(e.offset>=e.length)throw qe(e,"Unexpected EOF while parsing raw string");if(M(e,34)){if(n){if(!M(e,34)||!M(e,34))continue}let r=0;while(r<t&&M(e,35))r++;if(r===t)return T(e,n?jt:gt)}else sn(e)||Q(e)}}else{let t;if(e.current<255){let n=_[e.current];t=n(e)}else if(In(e.current))t=Mn(e);else if(xt(e.current))t=Rt(e);else t=xo(e);if(t.type!==me)(t.errors??=[]).push(new L("Expected a valid identifier",{token:t}));return t.type=nn,t}}function af(e){if(Q(e),ke(e,st))return B(e,z),T(e,me,"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 B(e,z),T(e,me)}function lf(e){if(Q(e),M(e,45))return T(e,Nt);else if(M(e,47)){while(e.offset<e.length&&!xt(e.current))Q(e);return T(e,Ir)}else if(M(e,42)){let t=1;while(e.offset<e.length)if(M(e,42)){if(M(e,47)){if(t--,t===0)return T(e,Dr)}}else if(M(e,47)){if(M(e,42))t++}else sn(e)||Q(e);throw qe(e,"Unexpected EOF in multiline comment")}else Fr(e)}function La(e){return Q(e),cf(e)}function cf(e){if(st(e.current))return Ie(e);else if(M(e,46)){if(ke(e,st))return B(e,z),T(e,me,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return B(e,z),T(e,me)}else return B(e,z),T(e,me)}function ho(e,t,n,r){return(s)=>{let o=Q(s);if(ke(s,n))return B(s,r),T(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(M(s,95)){if(B(s,r),!z(s.current))return T(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return B(s,z),T(s,me,`Invalid ${e} number`)}else if(M(s,95)){if(go(s,95),n(s.current)){if(B(s,r),!z(s.current))return T(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return B(s,z),T(s,me,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(st(s.current))return T(s,me,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return B(s,z),T(s,Ue)}}function Ie(e){if(M(e,48)){let t=Lr[e.current];if(t)return t(e)}if(B(e,Ct),M(e,46)){if(!ke(e,st))if(e.current===95)Dn(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else Dn(e,"Invalid decimal number, a decimal point must be followed by a digit");B(e,Ct)}if(M(e,101)||M(e,69))if(ke(e,Pa),ke(e,st)){if(B(e,Ct),z(e.current))return B(e,z),T(e,me,"Invalid number with suffix, a number with an exponent cannot have a suffix");return T(e,rt)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return B(e,Ct),T(e,rt,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return B(e,z),T(e,rt,"Invalid decimal number, missing a number after the exponent");else if(M(e,95)){if(go(e,95),st(e.current)){if(B(e,Ct),!z(e.current))return T(e,rt,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return B(e,z),T(e,me,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return B(e,z),T(e,Ue);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){Q(e);let t=null;if(ke(e,fo))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return B(e,z),T(e,Ue,t)}else if(ke(e,Ta)){let t=null;if(ke(e,Ct))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return B(e,z),T(e,Ue,t)}else if(M(e,44))return B(e,z),T(e,Ue,"Invalid number with suffix, a suffix cannot start with a comma");else if(M(e,46))return B(e,z),T(e,Ue,"Invalid number with suffix, a suffix cannot start with a dot");else if(ke(e,z))return B(e,z),T(e,Ue);else return T(e,rt);else return T(e,rt)}function uf(e){if(Q(e),e.current!=35)return B(e,z),T(e,me);let t=Ma(e);t.start.offset--,t.start.column--;let n;switch(t.type){case gt:case jt: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 L(n,{token:t})),t}function xo(e){return Q(e),B(e,z),T(e,me)}function Fr(e){throw qe(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Ln(e,t){let n=ka(e,t);yield*Ia(n);while(!n.currentIter.done){if(n.current<255){let r=_[n.current];yield r(n);continue}if(In(n.current)){yield Mn(n);continue}if(xt(n.current)){yield Rt(n);continue}yield xo(n)}yield T(n,mt)}var Lr,_;var Fa=N(()=>{vt();Da();Lr=Array(256).fill(null);Lr[98]=ho("binary",Pr,mo,_a);Lr[111]=ho("octal",_r,po,Ra);Lr[120]=ho("hexadecimal",Rr,uo,fo);_=Array(255);_.fill(xo);for(let e=0;e<32;e++)_[e]=Fr;_[9]=Mn;_[10]=Rt;_[11]=Rt;_[12]=Rt;_[13]=Rt;_[32]=Mn;_[34]=of;_[35]=Ma;_[40]=Tt(jr);_[41]=Tt(Pn);_[43]=La;_[45]=La;_[46]=af;_[47]=lf;_[48]=Ie;_[49]=Ie;_[50]=Ie;_[51]=Ie;_[52]=Ie;_[53]=Ie;_[54]=Ie;_[55]=Ie;_[56]=Ie;_[57]=Ie;_[59]=Tt(Tr);_[61]=Tt(tn);_[91]=Fr;_[92]=Tt(kr);_[93]=Fr;_[114]=uf;_[123]=Tt(Cr);_[125]=Tt(vr);_[133]=Rt;_[160]=Mn});var on=N(()=>{Fa()});var L;var vt=N(()=>{on();L=class L 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===mt)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 an(e){return Va.get(e)}function Wa(e,{start:t},{end:n}){Va.set(e,{start:t,end:n})}var Va;var yo=N(()=>{Va=new WeakMap});function Ba({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class De{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 De(this.name);return e.representation=this.representation,e}}class ze{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 ze(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class Me{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new Me(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 ze(e)}}var $o=()=>{};class Ae{static createArgument(e){return new Ae(new Me(e),null)}static createProperty(e,t){return new Ae(new Me(t),new De(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Ae(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 De(e):null}getValue(){return this.value.value}setValue(e){this.value=new Me(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var So=N(()=>{$o()});function*ln(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function bo(e){return e.children??(e.children=new yt)}class cn{static create(e){return new cn(new De(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 cn(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 ze(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=Ae.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 ln(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of ln(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=Ae.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){bo(this).appendNode(e)}insertNodeBefore(e,t){bo(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){bo(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 Ha=N(()=>{wo();So()});function*un(e){if(e instanceof yt)yield*e.nodes;else yield e}class yt{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new yt(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...un(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...un(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...un(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...un(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,...un(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,...un(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of ln(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of ln(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 wo=()=>{};var Ua=N(()=>{wo();So();Ha();$o()});function qa(e,t,n){let r;while(r=pf.exec(t)){let s=Fn(n,t,r.index);e.push(new L("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 za(e,t,n){if(!fn.test(t))return e.push(new L("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!fn.test(t[0]))return e.push(new L("Multi-line strings must start with a newline",{token:n})),t;let r=gf.exec(t)?.[1];if(r==null)return e.push(new L("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(xf,(s,o,i,l,a)=>{if(!l)return`
40
- `;if(!i.startsWith(r)){let c=Fn(n,t,a+o.length);return e.push(new L("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}})),`
42
+ `||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function nn(e){if(Td.test(e))return"unreadable";let t=new Al(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]=Rd.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 Td,Rd;var Wn=S(()=>{Td=/\0/u,Rd=/^[^\s\\/(){};[\]"#=]+/u});function Nl(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():_d(o(),r),l=()=>{s+=1;let a="";while(s<e.length){let c=e[s];if(c==="\\"){let u=e[s+1]??"";if(u==="u")a+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else a+=Pd.get(u)??u,s+=2;continue}if(c==='"')return s+=1,a;a+=c,s+=1}return a};while(s<e.length){let a=e[s];if(Cl.has(a)||a===","||a===":"){s+=1;continue}if(a==="{"||a==="["){n.push(a==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(a==="}"||a==="]"){n.pop(),r=null,s+=1;continue}if(a==='"'){let u=l(),p=n.at(-1);if(p?.kind==="object"&&kd(e,s)===":"){if(p.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:p.path});p.keys.add(u),r=u}else r=null;continue}if(a==="-"||a>="0"&&a<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let p=e.slice(u,s);if(!Dd(p))t.push({detail:p,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 kd(e,t){let n=t;while(n<e.length&&Cl.has(e[n]))n+=1;return e[n]??""}function _d(e,t){return e===""?t:`${e}.${t}`}function Dd(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Tl(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 Cl,Pd;var Rl=S(()=>{Cl=new Set([" ","\t",`
43
+ `,"\r"]);Pd=new Map([["b","\b"],["f","\f"],["n",`
44
+ `],["r","\r"],["t","\t"]])});function Md(e){return e instanceof Error?e.message:String(e)}function kl(e){if(b(e))return Pl.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>kl(t));if(C(e))return rn(e);return e}function rn(e){let t={};for(let[n,r]of Object.entries(e))t[Pl.test(n)?n.normalize("NFC"):n]=kl(r);return t}function ko(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${Md(o)}`,{cause:o})}if(!C(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Nl(e);if(s.length>0){let o=s.map((i)=>Tl(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return rn(r)}function _l(e,t){return ko(e,t,"Jx document")}function Dl(e,t){return ko(e,t,"project config")}function Dx(e,t){return ko(e,t,"class definition")}var Pl;var Hn=S(()=>{q();Rl();Pl=/[^\p{ASCII}]/u});function Un(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 wt(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Qr(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 X(e){return!isNaN(e)&&!Un(e)&&!wt(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 Ml(e){return e>=65&&e<91||e>=97&&e<123||!1}function _o(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Do(e){return _o(e)||e===95}function lt(e){return e>=48&&e<58}function Pt(e){return lt(e)||e===95}function Mo(e){return e>=48&&e<56}function Il(e){return Mo(e)||e===95}function Io(e){return e===48||e===49}function Ll(e){return Io(e)||e===95}function Fl(e){return e===45||e===43}var $t=1,sn=2,Nt=3,Hr=4,Br=5,Bn=6,qr=7,Ur=8,qn=9,bt=10,we=11,on=12,an=13,zr=14,at=15,Kr=16,Gr=17,Tt=18,St=19,Yr=20,Xr=21,Zr=22,ln=23,Rt=24,Ye=28;function*Ld(e){for(let t of(Id??=new Intl.Segmenter("en")).segment(e))yield t.segment}function Fd(e){return e[Symbol.iterator]()}function Vl(e,{flags:t,graphemeLocations:n=!1}){let r=n?Ld(e):Fd(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*Wl(e){if(F(e,65279))e.column=1,yield P(e,sn);if(Qr(e.current))throw Xe(e,`Invalid character \\u${e.current.toString(16)}`)}function oe(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(Qr(n))if(n>=55296&&n<=57343||n>1114111)zn(e,`Invalid character \\u${n.toString(16)}`);else zn(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 Le(e,t){if(t(e.current)){let n=e.current;return oe(e),n}}function F(e,t){if(e.current===t)return oe(e),t}function cn(e){if(!wt(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return oe(e),e.column=1,e.line++,!0}function Lo(e,t){while(e.current===t)oe(e)}function z(e,t){while(t(e.current))oe(e)}function P(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},l=e.start;e.start=i;let a=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(l.offset,i.offset),start:l,end:i,errors:a};if(n){if(!c.errors)c.errors=[];c.errors.push(new V(n,{token:c}))}return c}function Xe(e,t){if(t instanceof V)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(wt(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new V(`${t}`,{start:o,end:i})}function zn(e,t){(e.errorsInToken??=[]).push(Xe(e,t))}var Id;var Hl=S(()=>{kt()});function _t(e){return(t)=>(oe(t),P(t,e))}function Kn(e){return z(e,Un),P(e,Tt)}function Dt(e){return cn(e),P(e,St)}function Vd(e){oe(e);let t=!1,n=!1;if(F(e,34)){if(!F(e,34))return P(e,qn);if(n=!0,e.current===34)throw Xe(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(F(e,34)){if(F(e,34)&&F(e,34))t=!0}else F(e,92),cn(e)||oe(e)}else while(!t&&e.offset<e.length)if(F(e,34))t=!0;else F(e,92),cn(e)||oe(e);if(!t)throw Xe(e,"Unexpected EOF inside string");return P(e,n?ln:qn)}function Bl(e){if(oe(e),e.current===35||e.current===34){let t=1;while(F(e,35))t++;if(!F(e,34))throw Xe(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(F(e,34))if(F(e,34)){if(e.current===34)throw Xe(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(F(e,35))r++;if(r===t)return P(e,bt)}while(!0){if(e.offset>=e.length)throw Xe(e,"Unexpected EOF while parsing raw string");if(F(e,34)){if(n){if(!F(e,34)||!F(e,34))continue}let r=0;while(r<t&&F(e,35))r++;if(r===t)return P(e,n?Rt:bt)}else cn(e)||oe(e)}}else{let t;if(e.current<255){let n=D[e.current];t=n(e)}else if(Un(e.current))t=Kn(e);else if(wt(e.current))t=Dt(e);else t=Vo(e);if(t.type!==we)(t.errors??=[]).push(new V("Expected a valid identifier",{token:t}));return t.type=an,t}}function Wd(e){if(oe(e),Le(e,lt))return z(e,X),P(e,we,"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 z(e,X),P(e,we)}function Hd(e){if(oe(e),F(e,45))return P(e,Nt);else if(F(e,47)){while(e.offset<e.length&&!wt(e.current))oe(e);return P(e,Xr)}else if(F(e,42)){let t=1;while(e.offset<e.length)if(F(e,42)){if(F(e,47)){if(t--,t===0)return P(e,Zr)}}else if(F(e,47)){if(F(e,42))t++}else cn(e)||oe(e);throw Xe(e,"Unexpected EOF in multiline comment")}else ts(e)}function ql(e){return oe(e),Bd(e)}function Bd(e){if(lt(e.current))return Fe(e);else if(F(e,46)){if(Le(e,lt))return z(e,X),P(e,we,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return z(e,X),P(e,we)}else return z(e,X),P(e,we)}function Fo(e,t,n,r){return(s)=>{let o=oe(s);if(Le(s,n))return z(s,r),P(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(F(s,95)){if(z(s,r),!X(s.current))return P(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return z(s,X),P(s,we,`Invalid ${e} number`)}else if(F(s,95)){if(Lo(s,95),n(s.current)){if(z(s,r),!X(s.current))return P(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return z(s,X),P(s,we,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(lt(s.current))return P(s,we,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return z(s,X),P(s,Ye)}}function Fe(e){if(F(e,48)){let t=es[e.current];if(t)return t(e)}if(z(e,Pt),F(e,46)){if(!Le(e,lt))if(e.current===95)zn(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else zn(e,"Invalid decimal number, a decimal point must be followed by a digit");z(e,Pt)}if(F(e,101)||F(e,69))if(Le(e,Fl),Le(e,lt)){if(z(e,Pt),X(e.current))return z(e,X),P(e,we,"Invalid number with suffix, a number with an exponent cannot have a suffix");return P(e,at)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return z(e,Pt),P(e,at,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return z(e,X),P(e,at,"Invalid decimal number, missing a number after the exponent");else if(F(e,95)){if(Lo(e,95),lt(e.current)){if(z(e,Pt),!X(e.current))return P(e,at,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return z(e,X),P(e,we,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return z(e,X),P(e,Ye);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){oe(e);let t=null;if(Le(e,Do))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return z(e,X),P(e,Ye,t)}else if(Le(e,Ml)){let t=null;if(Le(e,Pt))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return z(e,X),P(e,Ye,t)}else if(F(e,44))return z(e,X),P(e,Ye,"Invalid number with suffix, a suffix cannot start with a comma");else if(F(e,46))return z(e,X),P(e,Ye,"Invalid number with suffix, a suffix cannot start with a dot");else if(Le(e,X))return z(e,X),P(e,Ye);else return P(e,at);else return P(e,at)}function qd(e){if(oe(e),e.current!=35)return z(e,X),P(e,we);let t=Bl(e);t.start.offset--,t.start.column--;let n;switch(t.type){case bt:case Rt: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 V(n,{token:t})),t}function Vo(e){return oe(e),z(e,X),P(e,we)}function ts(e){throw Xe(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Gn(e,t){let n=Vl(e,t);yield*Wl(n);while(!n.currentIter.done){if(n.current<255){let r=D[n.current];yield r(n);continue}if(Un(n.current)){yield Kn(n);continue}if(wt(n.current)){yield Dt(n);continue}yield Vo(n)}yield P(n,$t)}var es,D;var Ul=S(()=>{kt();Hl();es=Array(256).fill(null);es[98]=Fo("binary",Gr,Io,Ll);es[111]=Fo("octal",Kr,Mo,Il);es[120]=Fo("hexadecimal",zr,_o,Do);D=Array(255);D.fill(Vo);for(let e=0;e<32;e++)D[e]=ts;D[9]=Kn;D[10]=Dt;D[11]=Dt;D[12]=Dt;D[13]=Dt;D[32]=Kn;D[34]=Vd;D[35]=Bl;D[40]=_t(Hr);D[41]=_t(Bn);D[43]=ql;D[45]=ql;D[46]=Wd;D[47]=Hd;D[48]=Fe;D[49]=Fe;D[50]=Fe;D[51]=Fe;D[52]=Fe;D[53]=Fe;D[54]=Fe;D[55]=Fe;D[56]=Fe;D[57]=Fe;D[59]=_t(Ur);D[61]=_t(on);D[91]=ts;D[92]=_t(Yr);D[93]=ts;D[114]=qd;D[123]=_t(Br);D[125]=_t(qr);D[133]=Dt;D[160]=Kn});var un=S(()=>{Ul()});var V;var kt=S(()=>{un();V=class V 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===$t)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 pn(e){return zl.get(e)}function Kl(e,{start:t},{end:n}){zl.set(e,{start:t,end:n})}var zl;var Wo=S(()=>{zl=new WeakMap});function Gl({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class Ve{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 Ve(this.name);return e.representation=this.representation,e}}class Ze{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 Ze(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class We{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new We(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 Ze(e)}}var Ho=()=>{};class Te{static createArgument(e){return new Te(new We(e),null)}static createProperty(e,t){return new Te(new We(t),new Ve(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Te(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 Ve(e):null}getValue(){return this.value.value}setValue(e){this.value=new We(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Bo=S(()=>{Ho()});function*fn(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function qo(e){return e.children??(e.children=new Et)}class dn{static create(e){return new dn(new Ve(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 dn(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 Ze(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=Te.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 fn(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of fn(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=Te.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){qo(this).appendNode(e)}insertNodeBefore(e,t){qo(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){qo(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 Yl=S(()=>{Uo();Bo()});function*mn(e){if(e instanceof Et)yield*e.nodes;else yield e}class Et{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new Et(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...mn(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...mn(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...mn(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...mn(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,...mn(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,...mn(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of fn(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of fn(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 Uo=()=>{};var Xl=S(()=>{Uo();Bo();Yl();Ho()});function Zl(e,t,n){let r;while(r=zd.exec(t)){let s=Yn(n,t,r.index);e.push(new V("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 Ql(e,t,n){if(!gn.test(t))return e.push(new V("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!gn.test(t[0]))return e.push(new V("Multi-line strings must start with a newline",{token:n})),t;let r=Yd.exec(t)?.[1];if(r==null)return e.push(new V("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(Zd,(s,o,i,l,a)=>{if(!l)return`
45
+ `;if(!i.startsWith(r)){let c=Yn(n,t,a+o.length);return e.push(new V("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}})),`
41
46
  `}return`
42
- `+i.slice(r.length)+l}).slice(1,-1)}function Ka(e,t,n){let r;while(r=mf.exec(t)){let s=Fn(n,t,r.indices[1][0]);e.push(new L("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($f,(s,o,i,l,a)=>Ya(e,t,n,s,o,i,l,a))}function Ga(e,t,n){if(!df.test(t))return e.push(new L("Strings with three quotes must be multiline strings",{token:n})),t;if(!fn.test(t[0]))return e.push(new L("Multi-line strings must start with a newline",{token:n})),t;let r=hf.exec(t)?.[1];if(r==null){let s=yf.exec(t),o=s?Fn(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 L(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(Sf,(s,o,i,l,a,c,u)=>{if(!o)return Ya(e,t,n,s,l,a,c,u);let f=t[u+o.length+(i?i.length:0)];if(fn.test(f))return`
43
- `;if(!i.startsWith(r)){let p=Fn(n,t,u+o.length);return e.push(new L("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}})),`
47
+ `+i.slice(r.length)+l}).slice(1,-1)}function ec(e,t,n){let r;while(r=Gd.exec(t)){let s=Yn(n,t,r.indices[1][0]);e.push(new V("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(em,(s,o,i,l,a)=>nc(e,t,n,s,o,i,l,a))}function tc(e,t,n){if(!Kd.test(t))return e.push(new V("Strings with three quotes must be multiline strings",{token:n})),t;if(!gn.test(t[0]))return e.push(new V("Multi-line strings must start with a newline",{token:n})),t;let r=Xd.exec(t)?.[1];if(r==null){let s=Qd.exec(t),o=s?Yn(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 V(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(tm,(s,o,i,l,a,c,u)=>{if(!o)return nc(e,t,n,s,l,a,c,u);let p=t[u+o.length+(i?i.length:0)];if(gn.test(p))return`
48
+ `;if(!i.startsWith(r)){let d=Yn(n,t,u+o.length);return e.push(new V("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:d,end:{offset:d.offset+r.length,line:d.line,column:d.column+r.length}})),`
44
49
  `}return`
45
- `+i.slice(r.length)}).slice(1,-1)}function Ya(e,t,n,r,s,o,i,l){if(i)return"";if(o){let a=n.text.startsWith('"""'),c=t.slice(0,l).split(fn),u={offset:n.start.offset+(a?3:1)+l,line:n.start.line+(c.length-1),column:c.length===1?n.start.column+(a?3:1)+l:c.at(-1).length},f={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new L(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:f}));else e.push(new L(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:f}));return""}else if(s){let a=parseInt(s,16);if(a>=55296&&a<=57343)e.push(new L(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(a)}else{let a=ff.get(r);if(a==null)return e.push(new L(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return a}}function Fn(e,t,n){let r=1;switch(e.type){case rn:r=3;break;case gt:r=e.text.indexOf('"')+1;break;case jt:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(fn);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 Dg,ff,fn,pf,df,mf,gf,hf,xf,yf,$f,Sf;var Xa=N(()=>{vt();on();Dg=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"]]),ff=new Map([["\\n",`
46
- `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),fn=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,pf=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,df=/(?:^|[^\\\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,mf=/(?:^|[^\\\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;gf=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,hf=/(?:^|[^\\\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]*)*$/,xf=/(\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,yf=/([^\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]*$/;$f=/\\(?:$|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;Sf=/(\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 ot(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 H(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return ot(e),n}}function P(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new L(t,{token:n})}function Ee(e,t,n,r=n){if(e.storeLocations)Wa(t,n,r)}function ge(e="",t="",n=""){return e+t+n||void 0}function Br(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 ot(o),o}function Jo(e,t){if(!t&&!e.current.done&&e.current.value.type!==mt)t=P(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 L)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new L(`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 L("Encountered multiple errors",{errors:n})}function Vr(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 Za(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Oo(e){let{value:t}=e.current,n,r,s,o,i,l=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case Ue:{if(!e.flags.experimentalSuffixedNumbers)throw new L("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,f=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,f),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(f),Za(s))e.errors.push(P(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Pr:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case _r:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case rt:l=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Rr:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case nn:if(n=Vr(t.text),n===void 0)if(n=null,Vr(t.text.toLowerCase())!==void 0)e.errors.push(P(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(P(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(P(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(P(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(P(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(P(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(P(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}ot(e);let a=e.flags.experimentalSuffixedNumbers&&H(e,nn);if(a)if(l){if(o=a.text,Vr(o)!==void 0)e.errors.push(P(a,`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(P(a,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(P(a,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(P(a,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new Me(n);if(c.representation=r??t.text,Ee(e,c,t),s){let u=new ze(s);u.representation=o,u.suffix=!0,Ee(e,u,e.lastToken),c.tag=u}return c}function Vn(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case me:if(ot(e),Za(t.text))e.errors.push(P(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 kn:ot(e),n=[Ka(e.errors,t.text.slice(1,-1),t),t.text,t];break;case rn:ot(e),n=[Ga(e.errors,t.text.slice(3,-3),t),t.text,t];break;case gt:{ot(e);let r=t.text,s=r.indexOf('"');n=[qa(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case jt:{ot(e);let r=t.text,s=r.indexOf('"');n=[za(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(H(e,nn))e.errors.push(P(e.lastToken,Vr(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 No(e){let t=Vn(e);if(!t)return;let n=new De(t[0]);return n.representation=t[1],Ee(e,n,t[2],e.lastToken),n}function Wr(e){let t=Oo(e);if(t)return t;let n=Vn(e);if(!n)return;let r=new Me(n[0]);return r.representation=n[1],Ee(e,r,n[2],e.lastToken),r}function Wn(e){let t=H(e,Ir);if(!t)return;let{value:n}=e.current;return ot(e),t.text+(n?.text??"")}function Hr(e){return H(e,Dr)?.text}function Ao(e){return H(e,At)??Hr(e)}function Ur(e){let t=H(e,kr);if(!t)return;while(Ao(e));if(!Wn(e)&&!H(e,ht)&&!H(e,mt))e.errors.push(P(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 $t(e){let t=e.lastToken.end;while(H(e,ht)?.text??Wn(e)??Ao(e)??Ur(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function ne(e){let t=e.lastToken.end;while(Ao(e)??Ur(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Eo(e){let t=H(e,jr);if(!t)return;let n=ne(e),r=Vn(e);if(!r&&e.current.value){let l=e.current.value;if($t(e))e.errors.push(P(l,"This type of whitespace is not allowed inside a tag"));r=Vn(e)}if(!r){if(Oo(e))e.errors.push(P(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw P(e,"Invalid tag, did you forget to quote a string?");let s=ne(e),o=H(e,Pn);if(!o&&e.current.value){let l=e.current.value;if($t(e))e.errors.push(P(l,"This type of whitespace is not allowed inside a tag"));o=H(e,Pn)}if(!o)throw P(e,"Invalid tag, did you forget to quote a string?");let i=new ze(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,Ee(e,i,t,e.lastToken),i}function qr(e){return Wn(e)??H(e,ht)?.text??H(e,Tr)?.text??H(e,mt)?.text}function jo(e){if(!H(e,Cr))return;let t=nl(e);if(!H(e,vr))throw P(e,"Invalid node children");return t}function pn(e){let t=e.current.value;{let f=Eo(e);if(f){let p=ne(e),d=Wr(e);if(!d)throw P(e,"Invalid argument");if(d.tag)e.errors.push(P(e.lastToken,"A number suffix cannot be combined with a regular tag"));d.tag=f,d.betweenTagAndValue=p;let h=new Ae(d,null);Ee(e,d,t,e.lastToken),Ee(e,h,t,e.lastToken);let m=ne(e);if(H(e,tn))e.errors.push(P(e.lastToken,typeof d.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),m=ge(m,ne(e))||" ";return[h,m]}}{let f=Oo(e);if(f){let p=new Ae(f,null);Ee(e,p,t,e.lastToken);let d=ne(e);if(H(e,tn))e.errors.push(P(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),d=ge(d,ne(e))||" ";return[p,d]}}let n=Vn(e);if(!n)return;let r=ne(e),s=H(e,tn);if(!s){let f=new Me(n[0]);f.representation=n[1],Ee(e,f,n[2]);let p=new Ae(f,null);return Ee(e,p,t,e.lastToken),[p,r]}let o=new De(n[0]);o.representation=n[1],Ee(e,o,n[2]);let i=ne(e),l=Eo(e),a=l&&ne(e),c=Wr(e);if(!c)throw P(e,"Expected a value");if(l){if(c.tag)e.errors.push(P(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=l,c.betweenTagAndValue=a}let u=new Ae(c,o);return Ee(e,u,t,e.lastToken),u.equals=ge(r,s.text,i),[u,void 0]}function Qa(e){let t=ne(e)??"",n;while(n=_t(e)){let i=e.lastToken.end,l=pn(e);if(!l)throw P(e,"Expected a property or argument");if(!(l[1]??ne(e)))throw P(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=pn(e);if(!r)return;let s=r[1]??ne(e)??"";while(n=_t(e)){let i=e.lastToken.end,l=pn(e);if(!l)throw P(e,"Expected a property or argument");if(!(l[1]??ne(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 _t(e){let t=H(e,Nt)?.text;if(!t)return;return ge(t,$t(e))}function zr(e){let t=e.current.value,n=Eo(e),r=n&&ne(e),s=No(e);if(!s)if(n)throw P(e,"Couldn't find node name");else return;let o=ne(e),i=o!=null,l=_t(e),a=[];while(i||l){let p=e.lastToken.end,d=pn(e);if(!d)break;if(l)i=(d[1]||ne(e))!=null,o=ge(o,l,e.text.slice(p.offset,e.lastToken.end.offset)),l=_t(e);else{let h=d[0];h.leading=o,a.push(h),o=d[1]||ne(e),i=o!=null,l=_t(e)}}let c,u;while(!0){l??=_t(e);let p=e.lastToken.end,d=jo(e);if(!d){if(l)throw P(e,"Unexpected slashdash");break}if(l)o=ge(o,l,e.text.slice(p.offset,e.lastToken.end.offset)),l=void 0;else{if(c)e.errors.push(P(e,"A node can only have one children block"));c=d,u=o??"",o=void 0}o=ge(o,ne(e))}let f=new cn(s,a,c);return f.tag=n??null,f.betweenTagAndName=r,f.beforeChildren=u,f.trailing=o??"",Ee(e,f,t,e.lastToken),f}function el(e){let t=$t(e),n=zr(e);if(!n)return;let r=ge(qr(e),$t(e));return n.leading=ge(t,n.leading),n.trailing=ge(n.trailing,r),n}function tl(e){let t=H(e,en)?.text,n=nl(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=ge(t,n.nodes[0].leading);else n.trailing=ge(t,n.trailing);return n}function nl(e){let t=e.current.value,n=[],r=!0,s=$t(e);while(r){let i=e.lastToken.end,l=_t(e),a=zr(e);if(!a){if(l)throw P(e,"Unexpected slashdash");break}let c=ne(e),u=qr(e);if(l)s=ge(s,e.text.slice(i.offset,e.lastToken.end.offset),$t(e));else a.trailing=ge(a.trailing,c,u)??"",n.push(a),a.leading=s??"",s=$t(e);r=u!=null}let o=new yt(n);return Ee(e,o,t,e.lastToken),o.trailing=s??"",o}var Co=N(()=>{vt();yo();Ua();Xa();on()});function rl(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function bf(e){{let t=H(e,en);if(t)return{type:"bom",text:t.text}}{let t=H(e,ht);if(t)return{type:"newline",text:t.text}}{let t=H(e,At);if(t)return{type:"space",text:t.text}}{let t=Wn(e);if(t)return{type:"singleline",text:t}}{let t=Hr(e);if(t)return{type:"multiline",text:t}}return}function Kr(e){{let t=Ur(e);if(t)return{type:"line-escape",text:t}}{let t=H(e,At);if(t)return{type:"space",text:t.text}}{let t=Hr(e);if(t)return{type:"multiline",text:t}}return}function sl(e){let t=[];while(!0){{let n=bf(e);if(n){t.push(n);continue}}if(H(e,Nt)?.text){let r,s=rl(e,Kr)??[],o=zr(e);if(!o)throw P(e,"Invalid slashdash, expected a commented node");o.trailing=ge(o.trailing,rl(e,Kr)?.map((i)=>i.text).join(""),qr(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function wf(e){let t=H(e,Nt);if(t==null)return;let n,r=[];while(n=Kr(e))r.push(n);let s,o,i="";if(o=pn(e)){if(s=o[0],o[1])i=o[1]}else if(o=jo(e))s=o;else throw P(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function vo(e){let t=[];while(!0){let n=Kr(e);if(!n)break;let r=!0;t.push(n);while(r){let s=wf(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...vo(Br(s[1][0],Ln(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var ol=N(()=>{on();Co()});function St(e,{as:t="document",flags:n,...r}={}){let s=Ef[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=Ba(n),i=Ln(e,{...r,flags:o}),l=Br(e,i,{...r,flags:o}),a;try{a=s(l)}catch(c){Jo(l,c)}if(Jo(l),!a)throw new L(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return a}var Ef;var il=N(()=>{vt();on();Co();ol();Ef={value:Wr,identifier:No,node:el,entry:Qa,document:tl,"whitespace in document":sl,"whitespace in node":vo}});var Gr=N(()=>{vt();yo();il()});function dn(e,t){let n=e.slice(0,t),r=n.split(`
50
+ `+i.slice(r.length)}).slice(1,-1)}function nc(e,t,n,r,s,o,i,l){if(i)return"";if(o){let a=n.text.startsWith('"""'),c=t.slice(0,l).split(gn),u={offset:n.start.offset+(a?3:1)+l,line:n.start.line+(c.length-1),column:c.length===1?n.start.column+(a?3:1)+l:c.at(-1).length},p={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new V(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:p}));else e.push(new V(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:p}));return""}else if(s){let a=parseInt(s,16);if(a>=55296&&a<=57343)e.push(new V(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(a)}else{let a=Ud.get(r);if(a==null)return e.push(new V(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return a}}function Yn(e,t,n){let r=1;switch(e.type){case ln:r=3;break;case bt:r=e.text.indexOf('"')+1;break;case Rt:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(gn);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 J$,Ud,gn,zd,Kd,Gd,Yd,Xd,Zd,Qd,em,tm;var rc=S(()=>{kt();un();J$=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"]]),Ud=new Map([["\\n",`
51
+ `],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),gn=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,zd=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,Kd=/(?:^|[^\\\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,Gd=/(?:^|[^\\\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;Yd=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,Xd=/(?:^|[^\\\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]*)*$/,Zd=/(\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,Qd=/([^\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]*$/;em=/\\(?:$|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;tm=/(\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 ct(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 K(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return ct(e),n}}function M(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new V(t,{token:n})}function je(e,t,n,r=n){if(e.storeLocations)Kl(t,n,r)}function Ee(e="",t="",n=""){return e+t+n||void 0}function ss(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 ct(o),o}function Ko(e,t){if(!t&&!e.current.done&&e.current.value.type!==$t)t=M(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 V)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new V(`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 V("Encountered multiple errors",{errors:n})}function ns(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 sc(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Go(e){let{value:t}=e.current,n,r,s,o,i,l=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case Ye:{if(!e.flags.experimentalSuffixedNumbers)throw new V("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,p=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,p),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(p),sc(s))e.errors.push(M(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Gr:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Kr:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case at:l=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case zr:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case an:if(n=ns(t.text),n===void 0)if(n=null,ns(t.text.toLowerCase())!==void 0)e.errors.push(M(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(M(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(M(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}ct(e);let a=e.flags.experimentalSuffixedNumbers&&K(e,an);if(a)if(l){if(o=a.text,ns(o)!==void 0)e.errors.push(M(a,`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(M(a,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(M(a,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(M(a,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new We(n);if(c.representation=r??t.text,je(e,c,t),s){let u=new Ze(s);u.representation=o,u.suffix=!0,je(e,u,e.lastToken),c.tag=u}return c}function Xn(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case we:if(ct(e),sc(t.text))e.errors.push(M(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 qn:ct(e),n=[ec(e.errors,t.text.slice(1,-1),t),t.text,t];break;case ln:ct(e),n=[tc(e.errors,t.text.slice(3,-3),t),t.text,t];break;case bt:{ct(e);let r=t.text,s=r.indexOf('"');n=[Zl(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case Rt:{ct(e);let r=t.text,s=r.indexOf('"');n=[Ql(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(K(e,an))e.errors.push(M(e.lastToken,ns(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 Yo(e){let t=Xn(e);if(!t)return;let n=new Ve(t[0]);return n.representation=t[1],je(e,n,t[2],e.lastToken),n}function rs(e){let t=Go(e);if(t)return t;let n=Xn(e);if(!n)return;let r=new We(n[0]);return r.representation=n[1],je(e,r,n[2],e.lastToken),r}function Zn(e){let t=K(e,Xr);if(!t)return;let{value:n}=e.current;return ct(e),t.text+(n?.text??"")}function os(e){return K(e,Zr)?.text}function Xo(e){return K(e,Tt)??os(e)}function is(e){let t=K(e,Yr);if(!t)return;while(Xo(e));if(!Zn(e)&&!K(e,St)&&!K(e,$t))e.errors.push(M(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 Jt(e){let t=e.lastToken.end;while(K(e,St)?.text??Zn(e)??Xo(e)??is(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function ce(e){let t=e.lastToken.end;while(Xo(e)??is(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function zo(e){let t=K(e,Hr);if(!t)return;let n=ce(e),r=Xn(e);if(!r&&e.current.value){let l=e.current.value;if(Jt(e))e.errors.push(M(l,"This type of whitespace is not allowed inside a tag"));r=Xn(e)}if(!r){if(Go(e))e.errors.push(M(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw M(e,"Invalid tag, did you forget to quote a string?");let s=ce(e),o=K(e,Bn);if(!o&&e.current.value){let l=e.current.value;if(Jt(e))e.errors.push(M(l,"This type of whitespace is not allowed inside a tag"));o=K(e,Bn)}if(!o)throw M(e,"Invalid tag, did you forget to quote a string?");let i=new Ze(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,je(e,i,t,e.lastToken),i}function as(e){return Zn(e)??K(e,St)?.text??K(e,Ur)?.text??K(e,$t)?.text}function Zo(e){if(!K(e,Br))return;let t=lc(e);if(!K(e,qr))throw M(e,"Invalid node children");return t}function hn(e){let t=e.current.value;{let p=zo(e);if(p){let d=ce(e),f=rs(e);if(!f)throw M(e,"Invalid argument");if(f.tag)e.errors.push(M(e.lastToken,"A number suffix cannot be combined with a regular tag"));f.tag=p,f.betweenTagAndValue=d;let y=new Te(f,null);je(e,f,t,e.lastToken),je(e,y,t,e.lastToken);let h=ce(e);if(K(e,on))e.errors.push(M(e.lastToken,typeof f.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),h=Ee(h,ce(e))||" ";return[y,h]}}{let p=Go(e);if(p){let d=new Te(p,null);je(e,d,t,e.lastToken);let f=ce(e);if(K(e,on))e.errors.push(M(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),f=Ee(f,ce(e))||" ";return[d,f]}}let n=Xn(e);if(!n)return;let r=ce(e),s=K(e,on);if(!s){let p=new We(n[0]);p.representation=n[1],je(e,p,n[2]);let d=new Te(p,null);return je(e,d,t,e.lastToken),[d,r]}let o=new Ve(n[0]);o.representation=n[1],je(e,o,n[2]);let i=ce(e),l=zo(e),a=l&&ce(e),c=rs(e);if(!c)throw M(e,"Expected a value");if(l){if(c.tag)e.errors.push(M(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=l,c.betweenTagAndValue=a}let u=new Te(c,o);return je(e,u,t,e.lastToken),u.equals=Ee(r,s.text,i),[u,void 0]}function oc(e){let t=ce(e)??"",n;while(n=Mt(e)){let i=e.lastToken.end,l=hn(e);if(!l)throw M(e,"Expected a property or argument");if(!(l[1]??ce(e)))throw M(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=hn(e);if(!r)return;let s=r[1]??ce(e)??"";while(n=Mt(e)){let i=e.lastToken.end,l=hn(e);if(!l)throw M(e,"Expected a property or argument");if(!(l[1]??ce(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 Mt(e){let t=K(e,Nt)?.text;if(!t)return;return Ee(t,Jt(e))}function ls(e){let t=e.current.value,n=zo(e),r=n&&ce(e),s=Yo(e);if(!s)if(n)throw M(e,"Couldn't find node name");else return;let o=ce(e),i=o!=null,l=Mt(e),a=[];while(i||l){let d=e.lastToken.end,f=hn(e);if(!f)break;if(l)i=(f[1]||ce(e))!=null,o=Ee(o,l,e.text.slice(d.offset,e.lastToken.end.offset)),l=Mt(e);else{let y=f[0];y.leading=o,a.push(y),o=f[1]||ce(e),i=o!=null,l=Mt(e)}}let c,u;while(!0){l??=Mt(e);let d=e.lastToken.end,f=Zo(e);if(!f){if(l)throw M(e,"Unexpected slashdash");break}if(l)o=Ee(o,l,e.text.slice(d.offset,e.lastToken.end.offset)),l=void 0;else{if(c)e.errors.push(M(e,"A node can only have one children block"));c=f,u=o??"",o=void 0}o=Ee(o,ce(e))}let p=new dn(s,a,c);return p.tag=n??null,p.betweenTagAndName=r,p.beforeChildren=u,p.trailing=o??"",je(e,p,t,e.lastToken),p}function ic(e){let t=Jt(e),n=ls(e);if(!n)return;let r=Ee(as(e),Jt(e));return n.leading=Ee(t,n.leading),n.trailing=Ee(n.trailing,r),n}function ac(e){let t=K(e,sn)?.text,n=lc(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Ee(t,n.nodes[0].leading);else n.trailing=Ee(t,n.trailing);return n}function lc(e){let t=e.current.value,n=[],r=!0,s=Jt(e);while(r){let i=e.lastToken.end,l=Mt(e),a=ls(e);if(!a){if(l)throw M(e,"Unexpected slashdash");break}let c=ce(e),u=as(e);if(l)s=Ee(s,e.text.slice(i.offset,e.lastToken.end.offset),Jt(e));else a.trailing=Ee(a.trailing,c,u)??"",n.push(a),a.leading=s??"",s=Jt(e);r=u!=null}let o=new Et(n);return je(e,o,t,e.lastToken),o.trailing=s??"",o}var Qo=S(()=>{kt();Wo();Xl();rc();un()});function cc(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function nm(e){{let t=K(e,sn);if(t)return{type:"bom",text:t.text}}{let t=K(e,St);if(t)return{type:"newline",text:t.text}}{let t=K(e,Tt);if(t)return{type:"space",text:t.text}}{let t=Zn(e);if(t)return{type:"singleline",text:t}}{let t=os(e);if(t)return{type:"multiline",text:t}}return}function cs(e){{let t=is(e);if(t)return{type:"line-escape",text:t}}{let t=K(e,Tt);if(t)return{type:"space",text:t.text}}{let t=os(e);if(t)return{type:"multiline",text:t}}return}function uc(e){let t=[];while(!0){{let n=nm(e);if(n){t.push(n);continue}}if(K(e,Nt)?.text){let r,s=cc(e,cs)??[],o=ls(e);if(!o)throw M(e,"Invalid slashdash, expected a commented node");o.trailing=Ee(o.trailing,cc(e,cs)?.map((i)=>i.text).join(""),as(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function rm(e){let t=K(e,Nt);if(t==null)return;let n,r=[];while(n=cs(e))r.push(n);let s,o,i="";if(o=hn(e)){if(s=o[0],o[1])i=o[1]}else if(o=Zo(e))s=o;else throw M(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function ei(e){let t=[];while(!0){let n=cs(e);if(!n)break;let r=!0;t.push(n);while(r){let s=rm(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...ei(ss(s[1][0],Gn(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var pc=S(()=>{un();Qo()});function vt(e,{as:t="document",flags:n,...r}={}){let s=sm[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=Gl(n),i=Gn(e,{...r,flags:o}),l=ss(e,i,{...r,flags:o}),a;try{a=s(l)}catch(c){Ko(l,c)}if(Ko(l),!a)throw new V(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return a}var sm;var fc=S(()=>{kt();un();Qo();pc();sm={value:rs,identifier:Yo,node:ic,entry:oc,document:ac,"whitespace in document":uc,"whitespace in node":ei}});var us=S(()=>{kt();Wo();fc()});function yn(e,t){let n=e.slice(0,t),r=n.split(`
47
52
  `).length;return{column:t-n.lastIndexOf(`
48
- `),line:r,offset:t}}var ue;var mn=N(()=>{ue=class ue 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 ue(`${e}: ${this.reason}`,t)}}});var al;var ll=N(()=>{al=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function R(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw k(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw k(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function k(e,t,n){let r=Xr(t)?.start;return new ue(n,r===void 0?null:dn(e.text,r))}function Xr(e){let t=an(e);return t?{end:t.end.offset,start:t.start.offset}:null}function ee(e,t,n){let r=e.spans?Xr(n):null;if(r)e.spans?.set(t,r)}function cl(e,t,n){let r=e.tokens&&n?Xr(n):null;if(r)e.tokens?.names.set(t,r)}function ie(e,t,n){let r=e.tokens&&n?Xr(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 bt(e){return e.entries.filter((t)=>!t.name)}function Y(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function gn(e,t){let n=t.getTag();if(n!==null&&!pl.has(n))throw k(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw k(e,t,"(ref) annotates a value, and this is a name");return n}function it(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw k(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(le(r)){if(!Number.isFinite(r))throw k(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw k(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!y(r))throw k(e,t,"(ref) needs a string");return{$ref:r}}return r}function Re(e,t){return t.entries.filter((n)=>!n.name).map((n)=>it(e,n))}function _e(e){return e.entries.filter((t)=>t.name)}function fe(e){return e.children?.nodes??[]}function Ke(e){return e.getName()??""}function Nf(e,t,n){let r={$prototype:"Function"},s=Re(e,t),o=fe(t);for(let l of _e(t))R(r,Ke(l),it(e,l),e,l),ie(e,`${n}/${Y(Ke(l))}`,l);let i=e.tokens?bt(t):[];if(o.length>0){if(s.length>0)R(r,"parameters",s,e,t);R(r,"body",To(e,o,`${n}/body`),e,t)}else if(s.length>0){let l=s.at(-1)??null,a=s.slice(0,-1);if(a.length>0)R(r,"parameters",a,e,t);R(r,"body",l,e,t),ie(e,`${n}/body`,i.pop())}for(let[l,a]of i.entries())ie(e,`${n}/parameters/${l}`,a);return ee(e,n,t),r}function Af(e,t,n){let r={$prototype:"Function",$src:"#client"};if(Re(e,t).length>0||fe(t).length>0)throw k(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of _e(t))R(r,Ke(s),it(e,s),e,s),ie(e,`${n}/${Y(Ke(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return ee(e,n,t),r}function jf(e,t,n){if(Re(e,t).length>0||fe(t).length>0)throw k(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=_e(t);if(s.length>0){let o={};for(let i of s){let l=Ke(i);R(o,l,it(e,i),e,i),ee(e,`${n}/arguments/${Y(l)}`,i),ie(e,`${n}/arguments/${Y(l)}`,i)}r.arguments=o}return ee(e,n,t),r}function Cf(e,t,n){let r={};for(let a of _e(t)){let c=Ke(a);if(R(r,c,it(e,a),e,a),c!=="timing"||r[c]!=="server")throw k(e,a,"A script takes timing=server, and nothing else")}let s=Re(e,t),[o]=s;if(s.length!==1||!y(o)||fe(t).length>0)throw k(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",l=n.$script;if(!C(l)||!ul.has(l))l={},ul.add(l),R(n,"$script",l,e,t);R(l,i,o,e,t),ee(e,`/$script/${i}`,t),ie(e,`/$script/${i}`,bt(t)[0])}function fl(e,t,n){for(let[r,s]of(e.tokens?bt(n):[]).entries())ie(e,`${t}/${r}`,s)}function To(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw k(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return Te(e,s,`${n}/${r+o}`)})}function Te(e,t,n){let r=gn(e,t);if(ee(e,n,t),r==="fn")return Nf(e,t,n);if(r==="export")return Af(e,t,n);if(r==="server")return jf(e,t,n);let s=Re(e,t),o=_e(t),i=fe(t);if(r==="array"){if(o.length>0)throw k(e,t,"(array) holds items, and these are named");return fl(e,n,t),[...s,...To(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw k(e,t,"A list of values cannot also have names or a block");return fl(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw k(e,t,"A value cannot also have names or a block");return ie(e,n,bt(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((a)=>a.getName()==="-"))return To(e,i,n)}else if(s.length>0)throw k(e,t,"(object) holds names, and this is a value");let l={};for(let a of o){let c=Ke(a);R(l,c,it(e,a),e,a),ee(e,`${n}/${Y(c)}`,a),cl(e,`${n}/${Y(c)}`,a.name),ie(e,`${n}/${Y(c)}`,a)}for(let a of i){let c=a.getName();R(l,c,Te(e,a,`${n}/${Y(c)}`),e,a),cl(e,`${n}/${Y(c)}`,a.name)}return l}function Zr(e,t,n){let r={};if(ee(e,n,t),Re(e,t).length>0)throw k(e,t,"A style block holds declarations, and this is a value");for(let s of _e(t)){let o=Ke(s);R(r,o,it(e,s),e,s),ee(e,`${n}/${Y(o)}`,s),ie(e,`${n}/${Y(o)}`,s)}for(let s of fe(t)){let o=s.getName(),i=`${n}/${Y(o)}`,l=fe(s);if(s.getTag()==="array"||l.length>0&&l.every((c)=>c.getName()==="-")){R(r,o,Te(e,s,i),e,s);continue}let a=Re(e,s);if(a.length>1)throw k(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(a.length===1){if(_e(s).length>0||fe(s).length>0)throw k(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);R(r,o,a[0]??null,e,s),ee(e,i,s),ie(e,i,bt(s)[0])}else R(r,o,Zr(e,s,i),e,s)}return r}function Yr(e,t,n){let r=fe(t);if(r.length!==1||!r[0])throw k(e,t,`"${t.getName()}" holds one element`);return ml(e,r[0],n)}function dl(e,t,n){let r={$prototype:"Array"};if(ee(e,n,t),Re(e,t).length>0)throw k(e,t,"$array holds names and one element, and this is a value");for(let s of _e(t)){let o=Ke(s),i=o.startsWith(".")?o.slice(1):o;R(r,i,it(e,s),e,s),ie(e,`${n}/${Y(i)}`,s)}if(fe(t).length>0)R(r,"map",Yr(e,t,`${n}/map`),e,t);return r}function ml(e,t,n){let r=t.getName();if(r==="-"){let s=Re(e,t);if(s.length!==1||_e(t).length>0||fe(t).length>0)throw k(e,t,'"-" is one piece of text or one (ref)');return ee(e,n,t),ie(e,n,bt(t)[0]),s[0]??null}if(r==="$array")return dl(e,t,n);return Ro(e,t,n)}function vf(e,t,n,r){let s=gn(e,n);if(t==="map")return Yr(e,n,r);if(t==="cases"){let o={};for(let i of fe(n)){let l=i.getName();R(o,l,Yr(e,i,`${r}/${Y(l)}`),e,i)}return o}if(t==="children"&&s!=="array"&&fe(n).length>0)return Yr(e,n,r);return Te(e,n,r)}function Ro(e,t,n){let r={},s=t.getName(),o=gn(e,t);if(ee(e,n,t),o!==null)throw k(e,t,`(${o}) cannot annotate an element`);let i=Re(e,t);if(s==="$element"){let[a,c,...u]=i;if(u.length>0)throw k(e,t,"$element takes at most a tag and a text value");if(a!==void 0)R(r,"tagName",a,e,t);if(c!==void 0)R(r,"textContent",c,e,t),ie(e,`${n}/textContent`,bt(t)[1])}else{if(s.startsWith("$"))throw k(e,t,`"${s}" is not a kind of element`);if(R(r,"tagName",s,e,t),i.length>1)throw k(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)R(r,"textContent",i[0],e,t),ee(e,`${n}/textContent`,t),ie(e,`${n}/textContent`,bt(t)[0])}Tf(e,t,r,n);let l=[];for(let a of fe(t))Rf(e,a,r,l,n);if(l.length>0)R(r,"children",l,e,t);return r}function gl(e){let{attributes:t}=e;if(C(t))return t;let n={};return e.attributes=n,n}function Tf(e,t,n,r){for(let s of _e(t)){let o=Ke(s),i=s.getTag();if(i==="fn")throw k(e,s,"A function has a block form: (fn)name, on a line of its own");let l=it(e,s);if(o.startsWith(".")||o.startsWith("$")){let a=o.startsWith(".")?o.slice(1):o;R(n,a,l,e,s),ee(e,`${r}/${Y(a)}`,s),ie(e,`${r}/${Y(a)}`,s)}else if(o.startsWith("on")&&i==="ref")R(n,o,l,e,s),ee(e,`${r}/${Y(o)}`,s),ie(e,`${r}/${Y(o)}`,s);else if(o.startsWith("on")&&al.has(o))throw k(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else R(gl(n),o,l,e,s),ee(e,`${r}/attributes/${Y(o)}`,s),ie(e,`${r}/attributes/${Y(o)}`,s)}}function Rf(e,t,n,r,s){let o=t.getName(),i=gn(e,t),l=(a)=>`${s}/${Y(a)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw k(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);R(n,o,Te(e,t,l(o)),e,t)}else if(o==="script"){if(s!=="")throw k(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 k(e,t,`(${i}) cannot annotate a script`);Cf(e,t,n)}else if(o==="state")R(n,"state",Te(e,t,l("state")),e,t);else if(o==="style")R(n,"style",Zr(e,t,l("style")),e,t);else if(o==="attributes"){let a=Te(e,t,l("attributes"));if(C(a))for(let[c,u]of Object.entries(a))R(gl(n),c,u,e,t);else R(n,"attributes",a,e,t)}else if(o.startsWith(".")){let a=o.slice(1);R(n,a,vf(e,a,t,l(a)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")R(n,o,Te(e,t,l(o)),e,t);else{if(Of.has(o))throw k(e,t,`"${o}" is reserved here`);r.push(ml(e,t,`${s}/children/${r.length}`))}}function _o(e,t){return fe(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?Te(e,n,s):Ro(e,n,s)})}function Po(e){let t=Jf.exec(e);if(t)throw new ue(`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}`,dn(e,t.index));try{return St(e,{storeLocations:!0})}catch(n){let s=(n instanceof L?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new ue(o.split(`
49
- `)[0]??o,s?dn(e,s.offset):null)}}function hl(e){if(Zt(e.text)==="project")throw new ue('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=Po(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)R(r,i,_o(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")R(r,i,Te(e,o,`/${Y(i)}`),e,o),ee(e,`/${Y(i)}`,o);else if(s)throw k(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?dl(e,s,""):Ro(e,s,"");for(let[i,l]of Object.entries(o))R(r,i,l,e,s)}return Qt(r)}function Bn(e,t){try{return hl({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof ue?n.inFile(t):n}}function ko(e){let t=new Map;return{document:hl({spans:t,text:e}),spans:t}}var Jf,pl,Of,ul;var Hn=N(()=>{Gr();W();_n();Rn();mn();ll();Jf=/(?![\t\n\v\f\r])\p{Cc}/u,pl=new Set(["array","export","fn","object","on","ref","server"]),Of=new Set(["attributes","script","state","style"]);ul=new WeakSet});function Un(e){return e.toLowerCase().endsWith(".jxn")}function qn(e){return e.endsWith(".json")||Un(e)}function zn(e,t){return Un(t)?Bn(e,t):Ca(e,t)}var Io=N(()=>{_n();Hn()});function kf(e){let t={comments:0,escapes:[]},n=Pf.exec(e)?.[0].length??0;while(n<e.length)if(e.startsWith("//",n)){t.comments+=1;let r=e.indexOf(`
50
- `,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 If(e){return kf(e).escapes.flatMap((t)=>{let n=_f.get(e.charAt(t+1));return n?[{...dn(e,t),message:n}]:[]})}var _f,Pf;var xl=N(()=>{mn();_f=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.`]]),Pf=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function hn(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>hn(s,t)).join(",")}]`;if(!C(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${hn(e[s],t||s==="style")}`).join(",")}}`}function Df(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=C(n)?n[s]:void 0}return n}function Mf({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 yl(e,t){let n=Mf(e),r=new Map;for(let[s,o]of n)r.set(s,hn(Df(e.document,o)));return{meanings:r,pointers:n,text:t}}function at(e){let t=an(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function es(e,t){let{end:n,start:r}=at(e);return t.slice(r,n).trimEnd()}function Qr(e,t){let{end:n,start:r}=at(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function Fo(e){return e.children?.nodes??[]}function Do(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=Fo(e).map((o)=>Do(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function Mo(e,t,n){if(Do(t)===Do(n))return!0;let r=e.previous.meanings.get(at(t).start);return r!==void 0&&r===e.next.meanings.get(at(n).start)}function $l(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 Sl(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 f=e[c],p=t[u];o[c*s+u]=f!==void 0&&p!==void 0&&n(f,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=[],l=0,a=0;while(l<e.length&&a<t.length){let c=e[l],u=t[a];if(c!==void 0&&u!==void 0&&n(c,u))i.push([l,a]),l+=1,a+=1;else if((o[(l+1)*s+a]??0)>=(o[l*s+a+1]??0))l+=1;else a+=1}return i}function Lf(e,t,n){let r=new Map,s=new Set,o=(c,u)=>{let f=t[c];if(f)r.set(u,f),s.add(c)},i=Sl(t,n,(c,u)=>Mo(e,c,u)),l=0,a=0;for(let[c,u]of[...i,[t.length,n.length]]){let f=Sl(t.slice(l,c),n.slice(a,u),(p,d)=>$l(p)===$l(d));for(let[p,d]of f)o(l+p,a+d);if(c<t.length)o(c,u);l=c+1,a=u+1}for(let[c,u]of n.entries())if(!r.has(c)){let f=t.findIndex((p,d)=>!s.has(d)&&Mo(e,p,u));if(f!==-1)o(f,c)}return r}function Vo(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
51
- `)+1)}function Ff(e,t,n){return e.split(`
53
+ `),line:r,offset:t}}var ge;var xn=S(()=>{ge=class ge 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 ge(`${e}: ${this.reason}`,t)}}});var dc;var mc=S(()=>{dc=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 k(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw I(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw I(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function I(e,t,n){let r=fs(t)?.start;return new ge(n,r===void 0?null:yn(e.text,r))}function fs(e){let t=pn(e);return t?{end:t.end.offset,start:t.start.offset}:null}function ie(e,t,n){let r=e.spans?fs(n):null;if(r)e.spans?.set(t,r)}function gc(e,t,n){let r=e.tokens&&n?fs(n):null;if(r)e.tokens?.names.set(t,r)}function pe(e,t,n){let r=e.tokens&&n?fs(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 Ot(e){return e.entries.filter((t)=>!t.name)}function ee(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function $n(e,t){let n=t.getTag();if(n!==null&&!xc.has(n))throw I(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw I(e,t,"(ref) annotates a value, and this is a name");return n}function ut(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw I(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(ne(r)){if(!Number.isFinite(r))throw I(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw I(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!b(r))throw I(e,t,"(ref) needs a string");return{$ref:r}}return r}function De(e,t){return t.entries.filter((n)=>!n.name).map((n)=>ut(e,n))}function Me(e){return e.entries.filter((t)=>t.name)}function he(e){return e.children?.nodes??[]}function Qe(e){return e.getName()??""}function am(e,t,n){let r={$prototype:"Function"},s=De(e,t),o=he(t);for(let l of Me(t))k(r,Qe(l),ut(e,l),e,l),pe(e,`${n}/${ee(Qe(l))}`,l);let i=e.tokens?Ot(t):[];if(o.length>0){if(s.length>0)k(r,"parameters",s,e,t);k(r,"body",ti(e,o,`${n}/body`),e,t)}else if(s.length>0){let l=s.at(-1)??null,a=s.slice(0,-1);if(a.length>0)k(r,"parameters",a,e,t);k(r,"body",l,e,t),pe(e,`${n}/body`,i.pop())}for(let[l,a]of i.entries())pe(e,`${n}/parameters/${l}`,a);return ie(e,n,t),r}function lm(e,t,n){let r={$prototype:"Function",$src:"#client"};if(De(e,t).length>0||he(t).length>0)throw I(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of Me(t))k(r,Qe(s),ut(e,s),e,s),pe(e,`${n}/${ee(Qe(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return ie(e,n,t),r}function cm(e,t,n){if(De(e,t).length>0||he(t).length>0)throw I(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=Me(t);if(s.length>0){let o={};for(let i of s){let l=Qe(i);k(o,l,ut(e,i),e,i),ie(e,`${n}/arguments/${ee(l)}`,i),pe(e,`${n}/arguments/${ee(l)}`,i)}r.arguments=o}return ie(e,n,t),r}function um(e,t,n){let r={};for(let a of Me(t)){let c=Qe(a);if(k(r,c,ut(e,a),e,a),c!=="timing"||r[c]!=="server")throw I(e,a,"A script takes timing=server, and nothing else")}let s=De(e,t),[o]=s;if(s.length!==1||!b(o)||he(t).length>0)throw I(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",l=n.$script;if(!C(l)||!hc.has(l))l={},hc.add(l),k(n,"$script",l,e,t);k(l,i,o,e,t),ie(e,`/$script/${i}`,t),pe(e,`/$script/${i}`,Ot(t)[0])}function yc(e,t,n){for(let[r,s]of(e.tokens?Ot(n):[]).entries())pe(e,`${t}/${r}`,s)}function ti(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw I(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return _e(e,s,`${n}/${r+o}`)})}function _e(e,t,n){let r=$n(e,t);if(ie(e,n,t),r==="fn")return am(e,t,n);if(r==="export")return lm(e,t,n);if(r==="server")return cm(e,t,n);let s=De(e,t),o=Me(t),i=he(t);if(r==="array"){if(o.length>0)throw I(e,t,"(array) holds items, and these are named");return yc(e,n,t),[...s,...ti(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw I(e,t,"A list of values cannot also have names or a block");return yc(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw I(e,t,"A value cannot also have names or a block");return pe(e,n,Ot(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((a)=>a.getName()==="-"))return ti(e,i,n)}else if(s.length>0)throw I(e,t,"(object) holds names, and this is a value");let l={};for(let a of o){let c=Qe(a);k(l,c,ut(e,a),e,a),ie(e,`${n}/${ee(c)}`,a),gc(e,`${n}/${ee(c)}`,a.name),pe(e,`${n}/${ee(c)}`,a)}for(let a of i){let c=a.getName();k(l,c,_e(e,a,`${n}/${ee(c)}`),e,a),gc(e,`${n}/${ee(c)}`,a.name)}return l}function ds(e,t,n){let r={};if(ie(e,n,t),De(e,t).length>0)throw I(e,t,"A style block holds declarations, and this is a value");for(let s of Me(t)){let o=Qe(s);k(r,o,ut(e,s),e,s),ie(e,`${n}/${ee(o)}`,s),pe(e,`${n}/${ee(o)}`,s)}for(let s of he(t)){let o=s.getName(),i=`${n}/${ee(o)}`,l=he(s);if(s.getTag()==="array"||l.length>0&&l.every((c)=>c.getName()==="-")){k(r,o,_e(e,s,i),e,s);continue}let a=De(e,s);if(a.length>1)throw I(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(a.length===1){if(Me(s).length>0||he(s).length>0)throw I(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);k(r,o,a[0]??null,e,s),ie(e,i,s),pe(e,i,Ot(s)[0])}else k(r,o,ds(e,s,i),e,s)}return r}function ps(e,t,n){let r=he(t);if(r.length!==1||!r[0])throw I(e,t,`"${t.getName()}" holds one element`);return bc(e,r[0],n)}function $c(e,t,n){let r={$prototype:"Array"};if(ie(e,n,t),De(e,t).length>0)throw I(e,t,"$array holds names and one element, and this is a value");for(let s of Me(t)){let o=Qe(s),i=o.startsWith(".")?o.slice(1):o;k(r,i,ut(e,s),e,s),pe(e,`${n}/${ee(i)}`,s)}if(he(t).length>0)k(r,"map",ps(e,t,`${n}/map`),e,t);return r}function bc(e,t,n){let r=t.getName();if(r==="-"){let s=De(e,t);if(s.length!==1||Me(t).length>0||he(t).length>0)throw I(e,t,'"-" is one piece of text or one (ref)');return ie(e,n,t),pe(e,n,Ot(t)[0]),s[0]??null}if(r==="$array")return $c(e,t,n);return ni(e,t,n)}function pm(e,t,n,r){let s=$n(e,n);if(t==="map")return ps(e,n,r);if(t==="cases"){let o={};for(let i of he(n)){let l=i.getName();k(o,l,ps(e,i,`${r}/${ee(l)}`),e,i)}return o}if(t==="children"&&s!=="array"&&he(n).length>0)return ps(e,n,r);return _e(e,n,r)}function ni(e,t,n){let r={},s=t.getName(),o=$n(e,t);if(ie(e,n,t),o!==null)throw I(e,t,`(${o}) cannot annotate an element`);let i=De(e,t);if(s==="$element"){let[a,c,...u]=i;if(u.length>0)throw I(e,t,"$element takes at most a tag and a text value");if(a!==void 0)k(r,"tagName",a,e,t);if(c!==void 0)k(r,"textContent",c,e,t),pe(e,`${n}/textContent`,Ot(t)[1])}else{if(s.startsWith("$"))throw I(e,t,`"${s}" is not a kind of element`);if(k(r,"tagName",s,e,t),i.length>1)throw I(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)k(r,"textContent",i[0],e,t),ie(e,`${n}/textContent`,t),pe(e,`${n}/textContent`,Ot(t)[0])}fm(e,t,r,n);let l=[];for(let a of he(t))dm(e,a,r,l,n);if(l.length>0)k(r,"children",l,e,t);return r}function Sc(e){let{attributes:t}=e;if(C(t))return t;let n={};return e.attributes=n,n}function fm(e,t,n,r){for(let s of Me(t)){let o=Qe(s),i=s.getTag();if(i==="fn")throw I(e,s,"A function has a block form: (fn)name, on a line of its own");let l=ut(e,s);if(o.startsWith(".")||o.startsWith("$")){let a=o.startsWith(".")?o.slice(1):o;k(n,a,l,e,s),ie(e,`${r}/${ee(a)}`,s),pe(e,`${r}/${ee(a)}`,s)}else if(o.startsWith("on")&&i==="ref")k(n,o,l,e,s),ie(e,`${r}/${ee(o)}`,s),pe(e,`${r}/${ee(o)}`,s);else if(o.startsWith("on")&&dc.has(o))throw I(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else k(Sc(n),o,l,e,s),ie(e,`${r}/attributes/${ee(o)}`,s),pe(e,`${r}/attributes/${ee(o)}`,s)}}function dm(e,t,n,r,s){let o=t.getName(),i=$n(e,t),l=(a)=>`${s}/${ee(a)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw I(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);k(n,o,_e(e,t,l(o)),e,t)}else if(o==="script"){if(s!=="")throw I(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 I(e,t,`(${i}) cannot annotate a script`);um(e,t,n)}else if(o==="state")k(n,"state",_e(e,t,l("state")),e,t);else if(o==="style")k(n,"style",ds(e,t,l("style")),e,t);else if(o==="attributes"){let a=_e(e,t,l("attributes"));if(C(a))for(let[c,u]of Object.entries(a))k(Sc(n),c,u,e,t);else k(n,"attributes",a,e,t)}else if(o.startsWith(".")){let a=o.slice(1);k(n,a,pm(e,a,t,l(a)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")k(n,o,_e(e,t,l(o)),e,t);else{if(im.has(o))throw I(e,t,`"${o}" is reserved here`);r.push(bc(e,t,`${s}/children/${r.length}`))}}function ri(e,t){return he(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?_e(e,n,s):ni(e,n,s)})}function si(e){let t=om.exec(e);if(t)throw new ge(`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}`,yn(e,t.index));try{return vt(e,{storeLocations:!0})}catch(n){let s=(n instanceof V?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new ge(o.split(`
54
+ `)[0]??o,s?yn(e,s.offset):null)}}function wc(e){if(nn(e.text)==="project")throw new ge('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=si(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)k(r,i,ri(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")k(r,i,_e(e,o,`/${ee(i)}`),e,o),ie(e,`/${ee(i)}`,o);else if(s)throw I(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?$c(e,s,""):ni(e,s,"");for(let[i,l]of Object.entries(o))k(r,i,l,e,s)}return rn(r)}function Qn(e,t){try{return wc({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof ge?n.inFile(t):n}}function oi(e){let t=new Map;return{document:wc({spans:t,text:e}),spans:t}}var om,xc,im,hc;var er=S(()=>{us();q();Hn();Wn();xn();mc();om=/(?![\t\n\v\f\r])\p{Cc}/u,xc=new Set(["array","export","fn","object","on","ref","server"]),im=new Set(["attributes","script","state","style"]);hc=new WeakSet});function tr(e){return e.toLowerCase().endsWith(".jxn")}function nr(e){return e.endsWith(".json")||tr(e)}function rr(e,t){return tr(t)?Qn(e,t):_l(e,t)}var ii=S(()=>{Hn();er()});function hm(e){let t={comments:0,escapes:[]},n=gm.exec(e)?.[0].length??0;while(n<e.length)if(e.startsWith("//",n)){t.comments+=1;let r=e.indexOf(`
55
+ `,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 ym(e){return hm(e).escapes.flatMap((t)=>{let n=mm.get(e.charAt(t+1));return n?[{...yn(e,t),message:n}]:[]})}var mm,gm;var Ec=S(()=>{xn();mm=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.`]]),gm=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function bn(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>bn(s,t)).join(",")}]`;if(!C(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${bn(e[s],t||s==="style")}`).join(",")}}`}function xm(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=C(n)?n[s]:void 0}return n}function $m({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 Jc(e,t){let n=$m(e),r=new Map;for(let[s,o]of n)r.set(s,bn(xm(e.document,o)));return{meanings:r,pointers:n,text:t}}function pt(e){let t=pn(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function gs(e,t){let{end:n,start:r}=pt(e);return t.slice(r,n).trimEnd()}function ms(e,t){let{end:n,start:r}=pt(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function ui(e){return e.children?.nodes??[]}function ai(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=ui(e).map((o)=>ai(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function li(e,t,n){if(ai(t)===ai(n))return!0;let r=e.previous.meanings.get(pt(t).start);return r!==void 0&&r===e.next.meanings.get(pt(n).start)}function vc(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 Oc(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 p=e[c],d=t[u];o[c*s+u]=p!==void 0&&d!==void 0&&n(p,d)?(o[(c+1)*s+u+1]??0)+1:Math.max(o[(c+1)*s+u]??0,o[c*s+u+1]??0)}let i=[],l=0,a=0;while(l<e.length&&a<t.length){let c=e[l],u=t[a];if(c!==void 0&&u!==void 0&&n(c,u))i.push([l,a]),l+=1,a+=1;else if((o[(l+1)*s+a]??0)>=(o[l*s+a+1]??0))l+=1;else a+=1}return i}function bm(e,t,n){let r=new Map,s=new Set,o=(c,u)=>{let p=t[c];if(p)r.set(u,p),s.add(c)},i=Oc(t,n,(c,u)=>li(e,c,u)),l=0,a=0;for(let[c,u]of[...i,[t.length,n.length]]){let p=Oc(t.slice(l,c),n.slice(a,u),(d,f)=>vc(d)===vc(f));for(let[d,f]of p)o(l+d,a+f);if(c<t.length)o(c,u);l=c+1,a=u+1}for(let[c,u]of n.entries())if(!r.has(c)){let p=t.findIndex((d,f)=>!s.has(f)&&li(e,d,u));if(p!==-1)o(p,c)}return r}function pi(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
56
+ `)+1)}function Sm(e,t,n){return e.split(`
52
57
  `).map((r,s)=>s>0&&r.startsWith(t)?n+r.slice(t.length):r).join(`
53
- `)}function Vf(e,t,n){let r=[...n],s=(i)=>{let l=i.getName(),a=r.findIndex((c)=>c.getName()===l);return a===-1?void 0:r.splice(a,1)[0]},o="";for(let i of t.entries){let l=s(i);if(l){let a=l.getTag()===i.getTag()&&l.getValue()===i.getValue();o+=a?Qr(i,e.previous.text):`${i.leading??" "}${Qr(l,e.next.text).trimStart()}`}}for(let i of r)o+=` ${Qr(i,e.next.text).trimStart()}`;return o}function Wf(e,t,n){let r=new Map;for(let o of Fo(t)){let i=e.previous.pointers.get(at(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(at(o).start),l=i===void 0?void 0:r.get(i);if(l&&o.getName()!==null)s.set(l,o)}return s}function Bf(e,t,n){let{text:r}=e.previous,s=Qr(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 es(t,r);return`${Lo(t,r)}${o.leading??" "}${s}`}return`${Lo(t,r)} ${s}`}function Lo(e,t){let{start:n}=at(e),[r]=e.entries;if(r)return t.slice(n,at(r).start-(r.leading??"").length);let s=e.children&&an(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return es(e,t)}function Hf(e,t,n,r){let s=Wf(e,t,n),o=new Set(s.values()),i=n.entries.filter((d)=>!o.has(d)),l=`${Lo(t,e.previous.text)}${Vf(e,t,i)}`,a=Fo(n);if(a.length===0&&s.size===0)return l;let c=a[0]?Vo(a[0]):`${r} `,u=t.children,f=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&qf(u,e.previous.text,t)){let d=`${r}${Uf(u,r)}`;return`${l}${f}{${wl(e,u,a,d,c,s)}}`}let p=a.map((d)=>bl(e,d,c,`${r} `));return`${l}${f}{
54
- ${p.join("")}${r}}`}function Uf(e,t){let[n]=e.nodes,r=n?Vo(n):"";return r.startsWith(t)?r.slice(t.length):" "}function qf(e,t,n){let{end:r,start:s}=at(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
58
+ `)}function wm(e,t,n){let r=[...n],s=(i)=>{let l=i.getName(),a=r.findIndex((c)=>c.getName()===l);return a===-1?void 0:r.splice(a,1)[0]},o="";for(let i of t.entries){let l=s(i);if(l){let a=l.getTag()===i.getTag()&&l.getValue()===i.getValue();o+=a?ms(i,e.previous.text):`${i.leading??" "}${ms(l,e.next.text).trimStart()}`}}for(let i of r)o+=` ${ms(i,e.next.text).trimStart()}`;return o}function Em(e,t,n){let r=new Map;for(let o of ui(t)){let i=e.previous.pointers.get(pt(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(pt(o).start),l=i===void 0?void 0:r.get(i);if(l&&o.getName()!==null)s.set(l,o)}return s}function Jm(e,t,n){let{text:r}=e.previous,s=ms(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 gs(t,r);return`${ci(t,r)}${o.leading??" "}${s}`}return`${ci(t,r)} ${s}`}function ci(e,t){let{start:n}=pt(e),[r]=e.entries;if(r)return t.slice(n,pt(r).start-(r.leading??"").length);let s=e.children&&pn(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return gs(e,t)}function vm(e,t,n,r){let s=Em(e,t,n),o=new Set(s.values()),i=n.entries.filter((f)=>!o.has(f)),l=`${ci(t,e.previous.text)}${wm(e,t,i)}`,a=ui(n);if(a.length===0&&s.size===0)return l;let c=a[0]?pi(a[0]):`${r} `,u=t.children,p=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&jm(u,e.previous.text,t)){let f=`${r}${Om(u,r)}`;return`${l}${p}{${Ac(e,u,a,f,c,s)}}`}let d=a.map((f)=>jc(e,f,c,`${r} `));return`${l}${p}{
59
+ ${d.join("")}${r}}`}function Om(e,t){let[n]=e.nodes,r=n?pi(n):"";return r.startsWith(t)?r.slice(t.length):" "}function jm(e,t,n){let{end:r,start:s}=pt(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
55
60
  `)&&t.slice(s,r).includes(`
56
- `)}function bl(e,t,n,r){return`${r}${Ff(es(t,e.next.text),n,r)}
57
- `}function wl(e,t,n,r,s,o){let i=t.nodes.filter((g)=>!o.has(g)),l=Lf(e,i,n),a=t.nodes[0]?.leading??"",c=a.indexOf(`
58
- `),u=c===-1?"":a.slice(0,c+1),f=u,p=-1,d=()=>{if(f!==""&&!f.endsWith(`
59
- `)&&!f.endsWith(";"))f+=`
60
- `},h=(g,x)=>{let w=t.nodes.indexOf(g),O=w===p+1||w>p;p=Math.max(p,w);let J=g===t.nodes[0]?a.slice(u.length):g.leading??"";if(O&&(J.includes(`
61
- `)||f===u||f.endsWith(";"))){f+=`${J}${x}${g.trailing??""}`;return}if(!f.endsWith(`
62
- `))f+=`
63
- `;let S=(g.trailing??"").replace(/^;/u,"");f+=`${J.includes(`
64
- `)?J:r}${x}${S}`},m=(g)=>{for(let[x,w]of t.nodes.entries()){let O=o.get(w);if(O&&x<g&&x>p)d(),h(w,Bf(e,w,O))}};for(let[g,x]of n.entries()){let w=l.get(g);if(w){m(t.nodes.indexOf(w)),d();let O=Mo(e,w,x)?es(w,e.previous.text):Hf(e,w,x,Vo(w));h(w,O)}else d(),f+=bl(e,x,s,r)}return m(t.nodes.length),`${f}${t.trailing??""}`}function ts(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=hn(s.document);if(hn(r.document)===o)return e;let i={next:yl(s,t),previous:yl(r,e)},l=wl(i,St(e,{storeLocations:!0}),St(t,{storeLocations:!0}).nodes,"","",new Map);try{return hn(n(l).document)===o?l:t}catch{return t}}var ns=N(()=>{Gr();W()});function Nl(e){return!/\p{Cs}/u.test(e)}function Al(e,t){try{return St(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function ss(e){let t='"';for(let n of e)if(n==='"')t+=String.raw`\"`;else if(n==="\\")t+=String.raw`\\`;else if(n===`
65
- `)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(Ol.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function jl(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function Gf(e,t){if(zf.test(e))return null;let n=jl(e,'"""'),r=`${t}${pe}`,s=e.split(`
61
+ `)}function jc(e,t,n,r){return`${r}${Sm(gs(t,e.next.text),n,r)}
62
+ `}function Ac(e,t,n,r,s,o){let i=t.nodes.filter((m)=>!o.has(m)),l=bm(e,i,n),a=t.nodes[0]?.leading??"",c=a.indexOf(`
63
+ `),u=c===-1?"":a.slice(0,c+1),p=u,d=-1,f=()=>{if(p!==""&&!p.endsWith(`
64
+ `)&&!p.endsWith(";"))p+=`
65
+ `},y=(m,g)=>{let x=t.nodes.indexOf(m),w=x===d+1||x>d;d=Math.max(d,x);let O=m===t.nodes[0]?a.slice(u.length):m.leading??"";if(w&&(O.includes(`
66
+ `)||p===u||p.endsWith(";"))){p+=`${O}${g}${m.trailing??""}`;return}if(!p.endsWith(`
67
+ `))p+=`
68
+ `;let A=(m.trailing??"").replace(/^;/u,"");p+=`${O.includes(`
69
+ `)?O:r}${g}${A}`},h=(m)=>{for(let[g,x]of t.nodes.entries()){let w=o.get(x);if(w&&g<m&&g>d)f(),y(x,Jm(e,x,w))}};for(let[m,g]of n.entries()){let x=l.get(m);if(x){h(t.nodes.indexOf(x)),f();let w=li(e,x,g)?gs(x,e.previous.text):vm(e,x,g,pi(x));y(x,w)}else f(),p+=jc(e,g,s,r)}return h(t.nodes.length),`${p}${t.trailing??""}`}function hs(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=bn(s.document);if(bn(r.document)===o)return e;let i={next:Jc(s,t),previous:Jc(r,e)},l=Ac(i,vt(e,{storeLocations:!0}),vt(t,{storeLocations:!0}).nodes,"","",new Map);try{return bn(n(l).document)===o?l:t}catch{return t}}var ys=S(()=>{us();q()});function Rc(e){return!/\p{Cs}/u.test(e)}function Pc(e,t){try{return vt(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function $s(e){let t='"';for(let n of e)if(n==='"')t+=String.raw`\"`;else if(n==="\\")t+=String.raw`\\`;else if(n===`
70
+ `)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(Tc.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function kc(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function Nm(e,t){if(Am.test(e))return null;let n=kc(e,'"""'),r=`${t}${ye}`,s=e.split(`
66
71
  `).map((i)=>i===""?"":r+i),o=`${n}"""
67
72
  ${s.join(`
68
73
  `)}
69
- ${r}"""${n}`;return Al(o,e)?o:null}function rs(e,t,n){if(!Nl(e))throw new ue(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(Jl.test(e))return e;if(e.includes(`
70
- `)){let r=Gf(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!Ol.test(e)){let r=jl(e,'"'),s=`${r}"${e}"${r}`;if(Al(s,e))return s}return ss(e)}function ae(e,t){if(!Nl(e))throw new ue(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return Jl.test(e)?e:ss(e)}function te(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(le(e))return Object.is(e,-0)?"-0":String(e);if(y(e))return rs(e,t,n);return Gn(e)?`(ref)${ss(e.$ref)}`:null}function Cl(e){if(!de(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((c)=>te(c,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((c)=>y(c))&&n!==void 0,l=n===void 0||y(n)||Array.isArray(n),a=Array.isArray(n)&&n.length===0;return o&&i&&l&&!a}function vl(e,t,n,r){let{$prototype:s,body:o,parameters:i,...l}=t,a=[`${n}(fn)${ae(e,r)}`];for(let[c,u]of Object.entries(l))a.push(`${ae(c,r)}=${te(u,n,K(r,c))}`);if(Array.isArray(i))for(let c of i)a.push(rs(String(c),n,K(r,"parameters")));if(y(o))a.push(rs(o,n,K(r,"body")));else if(Array.isArray(o))return[`${a.join(" ")} {`,...o.flatMap((c,u)=>je("-",c,n+pe,K(K(r,"body"),u))),`${n}}`];return[a.join(" ")]}function Yf(e){if(!de(e)||e.$prototype!=="Function"||e.$src!=="#client"||!y(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>te(t,"","")!==null)}function Xf(e,t,n,r){let{$export:s,$prototype:o,$src:i,...l}=t,a=[`${n}(export)${ae(e,r)}`];if(s!==e)a.push(`$export=${te(s,n,K(r,"$export"))}`);for(let[c,u]of Object.entries(l))a.push(`${ae(c,r)}=${te(u,n,K(r,c))}`);return[a.join(" ")]}function Qf(e,t){if(!de(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>Zf.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=de(n)?Object.values(n):[];return r.length>0&&r.every((s)=>te(s,"","")!==null)}function ep(e,t,n,r){let s=[`${n}(server)${ae(e,r)}`],o=K(r,"arguments"),i=de(t.arguments)?t.arguments:{};for(let[l,a]of Object.entries(i))s.push(`${ae(l,o)}=${te(a,n,K(o,l))}`);return[s.join(" ")]}function je(e,t,n,r){let s=ae(e,r),o=n+s,i=te(t,n,r);if(i!==null)return[`${o} ${i}`];if(Yf(t))return Xf(e,t,n,r);if(Qf(e,t))return ep(e,t,n,r);if(Cl(t))return vl(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,d)=>te(p,n,K(r,d)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
71
- `))){let p=`${o} ${u.join(" ")}`;if(p.length<=Wo)return[p]}return[`${o} {`,...t.flatMap((p,d)=>je("-",p,n+pe,K(r,d))),`${n}}`]}let l=de(t)?Object.entries(t):[];if(l.length===0)return[`${o} {}`];let a=l.every(([u])=>u==="-")?`${n}(object)${s}`:o,c=l.map(([u,f])=>{let p=te(f,n,K(r,u));return p===null||p.includes(`
72
- `)?null:`${ae(u,r)}=${p}`});if(c.every((u)=>u!==null)){let u=`${a} ${c.join(" ")}`;if(u.length<=Wo)return[u]}return[`${a} {`,...l.flatMap(([u,f])=>je(u,f,n+pe,K(r,u))),`${n}}`]}function Tl(e,t,n,r){let s=Object.entries(t),o=n+ae(e,r);if(s.length===0)return[`${o} {}`];let i=[],l=0;for(let[p,d]of s){let h=te(d,n,K(r,p));if(h===null||h.includes(`
73
- `))break;i.push(`${ae(p,r)}=${h}`),l+=1}let a=`${o} ${i.join(" ")}`,c=i.length>0&&a.length<=Wo,u=c?l:0,f=s.slice(u).flatMap(([p,d])=>{if(de(d)&&!Gn(d))return Tl(p,d,n+pe,K(r,p));return je(p,d,n+pe,K(r,p))});if(c&&f.length===0)return[a];return[`${c?a:o} {`,...f,`${n}}`]}function tp(e){if(!de(e)||e.$prototype!=="Array"||!de(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=te(s,"","");return o!==null&&!o.includes(`
74
- `)})}function np(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[l,a]of Object.entries(o))i.push(`${ae(l,n)}=${te(a,t,K(n,l))}`);return[`${i.join(" ")} {`,...Kn(s??null,t+pe,K(n,"map")),`${t}}`]}function Kn(e,t,n){let r=te(e,t,n);if(r!==null)return[`${t}- ${r}`];if(tp(e))return np(e,t,n);if(de(e))return Bo(e,t,n);throw new ue(`${n} is a list inside a list of children, which has no spelling`)}function rp(e,t,n){let{tagName:r}=e;if(!y(r))return`${t}$element`;if(Kf.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${ss(r)}`;return t+ae(r,n)}function sp(e,t){return t!==null&&!t.includes(`
75
- `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function op(e,t){let n=de(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!y(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${rs(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function Bo(e,t,n,r=[]){let s=[rp(e,t,n)],o=t+pe,i=[...r],l={},a=null;for(let[c,u]of Object.entries(e)){let f=K(n,c);if(c==="tagName"&&y(u))continue;if(c==="children")continue;if(c==="textContent"){let p=te(u,t,f);if(p===null||!y(e.tagName))El(s,i,c,u,o,t,f);else a=p}else if(c==="attributes"&&de(u))for(let[p,d]of Object.entries(u)){let h=te(d,t,K(f,p));if(sp(p,h))s.push(`${ae(p,f)}=${h}`);else l[p]=d}else if(c==="state")i.push(...je("state",u,o,f));else if(c==="style"&&de(u))i.push(...Tl("style",u,o,f));else if(c.startsWith("on")&&Gn(u))s.push(`${ae(c,f)}=${te(u,t,f)}`);else if(c.startsWith("on"))i.push(...Cl(u)?vl(c,u,o,f):je(c,u,o,f).map((p,d)=>d===0?p.replace(o,`${o}(on)`):p));else if(c.startsWith("$")){let p=te(u,t,f);if(p===null||p.includes(`
76
- `))i.push(...je(c,u,o,f));else s.push(`${ae(c,f)}=${p}`)}else El(s,i,c,u,o,t,f)}if(Object.keys(l).length>0)i.push(...je("attributes",l,o,K(n,"attributes")));if(i.push(...ip(e.children,o,K(n,"children"))),a!==null)s.push(a);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function ip(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)=>Kn(s,t,K(n,o)))}let r=te(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Kn(e,t+pe,n),`${t}}`]}function El(e,t,n,r,s,o,i){let l=ae(`.${n}`,i);if(n==="map"&&de(r)){t.push(`${s}${l} {`,...Kn(r,s+pe,i),`${s}}`);return}if(n==="cases"&&de(r)){t.push(`${s}${l} {`);for(let[c,u]of Object.entries(r))t.push(`${s}${pe}${ae(c,i)} {`,...Kn(u,s+pe+pe,K(i,c)),`${s}${pe}}`);t.push(`${s}}`);return}let a=te(r,o,i);if(a===null||a.includes(`
77
- `))t.push(...je(`.${n}`,r,s,i));else e.push(`${l}=${a}`)}function Rl(e,t){return["$head {",...e.flatMap((n,r)=>de(n)&&!Gn(n)&&y(n.tagName)&&!n.$ref?Bo(n,t,`/$head/${r}`):je("-",n,t,`/$head/${r}`)),"}"]}function ap(e){let{document:t,spans:n}=ko(e);return{document:C(t)?t:null,spans:n}}function Ho(e,t){let n=lp(e);return t===void 0?n:ts(t,n,ap)}function lp(e){if(!C(e))throw new ue("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,l]of Object.entries(t)){let a=i==="$script"&&s?op(l,pe):null;if(a)o=a;else if(i==="$head"&&Array.isArray(l))n.push(...Rl(l,pe));else if(i==="$head")n.push(`(object)${je(i,l,"","/$head").join(`
78
- `)}`);else if(i.startsWith("$"))n.push(...je(i,l,"",K("",i)));else r[i]=l}if(Object.keys(r).length>0)n.push("",...Bo(r,"","",o));return`${n.join(`
74
+ ${r}"""${n}`;return Pc(o,e)?o:null}function xs(e,t,n){if(!Rc(e))throw new ge(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(Nc.test(e))return e;if(e.includes(`
75
+ `)){let r=Nm(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!Tc.test(e)){let r=kc(e,'"'),s=`${r}"${e}"${r}`;if(Pc(s,e))return s}return $s(e)}function fe(e,t){if(!Rc(e))throw new ge(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return Nc.test(e)?e:$s(e)}function ae(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(ne(e))return Object.is(e,-0)?"-0":String(e);if(b(e))return xs(e,t,n);return or(e)?`(ref)${$s(e.$ref)}`:null}function _c(e){if(!xe(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((c)=>ae(c,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((c)=>b(c))&&n!==void 0,l=n===void 0||b(n)||Array.isArray(n),a=Array.isArray(n)&&n.length===0;return o&&i&&l&&!a}function Dc(e,t,n,r){let{$prototype:s,body:o,parameters:i,...l}=t,a=[`${n}(fn)${fe(e,r)}`];for(let[c,u]of Object.entries(l))a.push(`${fe(c,r)}=${ae(u,n,Z(r,c))}`);if(Array.isArray(i))for(let c of i)a.push(xs(String(c),n,Z(r,"parameters")));if(b(o))a.push(xs(o,n,Z(r,"body")));else if(Array.isArray(o))return[`${a.join(" ")} {`,...o.flatMap((c,u)=>Re("-",c,n+ye,Z(Z(r,"body"),u))),`${n}}`];return[a.join(" ")]}function Tm(e){if(!xe(e)||e.$prototype!=="Function"||e.$src!=="#client"||!b(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>ae(t,"","")!==null)}function Rm(e,t,n,r){let{$export:s,$prototype:o,$src:i,...l}=t,a=[`${n}(export)${fe(e,r)}`];if(s!==e)a.push(`$export=${ae(s,n,Z(r,"$export"))}`);for(let[c,u]of Object.entries(l))a.push(`${fe(c,r)}=${ae(u,n,Z(r,c))}`);return[a.join(" ")]}function km(e,t){if(!xe(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>Pm.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=xe(n)?Object.values(n):[];return r.length>0&&r.every((s)=>ae(s,"","")!==null)}function _m(e,t,n,r){let s=[`${n}(server)${fe(e,r)}`],o=Z(r,"arguments"),i=xe(t.arguments)?t.arguments:{};for(let[l,a]of Object.entries(i))s.push(`${fe(l,o)}=${ae(a,n,Z(o,l))}`);return[s.join(" ")]}function Re(e,t,n,r){let s=fe(e,r),o=n+s,i=ae(t,n,r);if(i!==null)return[`${o} ${i}`];if(Tm(t))return Rm(e,t,n,r);if(km(e,t))return _m(e,t,n,r);if(_c(t))return Dc(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((d,f)=>ae(d,n,Z(r,f)));if(t.length>1&&u.every((d)=>d!==null&&!d.includes(`
76
+ `))){let d=`${o} ${u.join(" ")}`;if(d.length<=fi)return[d]}return[`${o} {`,...t.flatMap((d,f)=>Re("-",d,n+ye,Z(r,f))),`${n}}`]}let l=xe(t)?Object.entries(t):[];if(l.length===0)return[`${o} {}`];let a=l.every(([u])=>u==="-")?`${n}(object)${s}`:o,c=l.map(([u,p])=>{let d=ae(p,n,Z(r,u));return d===null||d.includes(`
77
+ `)?null:`${fe(u,r)}=${d}`});if(c.every((u)=>u!==null)){let u=`${a} ${c.join(" ")}`;if(u.length<=fi)return[u]}return[`${a} {`,...l.flatMap(([u,p])=>Re(u,p,n+ye,Z(r,u))),`${n}}`]}function Mc(e,t,n,r){let s=Object.entries(t),o=n+fe(e,r);if(s.length===0)return[`${o} {}`];let i=[],l=0;for(let[d,f]of s){let y=ae(f,n,Z(r,d));if(y===null||y.includes(`
78
+ `))break;i.push(`${fe(d,r)}=${y}`),l+=1}let a=`${o} ${i.join(" ")}`,c=i.length>0&&a.length<=fi,u=c?l:0,p=s.slice(u).flatMap(([d,f])=>{if(xe(f)&&!or(f))return Mc(d,f,n+ye,Z(r,d));return Re(d,f,n+ye,Z(r,d))});if(c&&p.length===0)return[a];return[`${c?a:o} {`,...p,`${n}}`]}function Dm(e){if(!xe(e)||e.$prototype!=="Array"||!xe(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=ae(s,"","");return o!==null&&!o.includes(`
79
+ `)})}function Mm(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[l,a]of Object.entries(o))i.push(`${fe(l,n)}=${ae(a,t,Z(n,l))}`);return[`${i.join(" ")} {`,...sr(s??null,t+ye,Z(n,"map")),`${t}}`]}function sr(e,t,n){let r=ae(e,t,n);if(r!==null)return[`${t}- ${r}`];if(Dm(e))return Mm(e,t,n);if(xe(e))return di(e,t,n);throw new ge(`${n} is a list inside a list of children, which has no spelling`)}function Im(e,t,n){let{tagName:r}=e;if(!b(r))return`${t}$element`;if(Cm.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${$s(r)}`;return t+fe(r,n)}function Lm(e,t){return t!==null&&!t.includes(`
80
+ `)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function Fm(e,t){let n=xe(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!b(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${xs(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function di(e,t,n,r=[]){let s=[Im(e,t,n)],o=t+ye,i=[...r],l={},a=null;for(let[c,u]of Object.entries(e)){let p=Z(n,c);if(c==="tagName"&&b(u))continue;if(c==="children")continue;if(c==="textContent"){let d=ae(u,t,p);if(d===null||!b(e.tagName))Cc(s,i,c,u,o,t,p);else a=d}else if(c==="attributes"&&xe(u))for(let[d,f]of Object.entries(u)){let y=ae(f,t,Z(p,d));if(Lm(d,y))s.push(`${fe(d,p)}=${y}`);else l[d]=f}else if(c==="state")i.push(...Re("state",u,o,p));else if(c==="style"&&xe(u))i.push(...Mc("style",u,o,p));else if(c.startsWith("on")&&or(u))s.push(`${fe(c,p)}=${ae(u,t,p)}`);else if(c.startsWith("on"))i.push(..._c(u)?Dc(c,u,o,p):Re(c,u,o,p).map((d,f)=>f===0?d.replace(o,`${o}(on)`):d));else if(c.startsWith("$")){let d=ae(u,t,p);if(d===null||d.includes(`
81
+ `))i.push(...Re(c,u,o,p));else s.push(`${fe(c,p)}=${d}`)}else Cc(s,i,c,u,o,t,p)}if(Object.keys(l).length>0)i.push(...Re("attributes",l,o,Z(n,"attributes")));if(i.push(...Vm(e.children,o,Z(n,"children"))),a!==null)s.push(a);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function Vm(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)=>sr(s,t,Z(n,o)))}let r=ae(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...sr(e,t+ye,n),`${t}}`]}function Cc(e,t,n,r,s,o,i){let l=fe(`.${n}`,i);if(n==="map"&&xe(r)){t.push(`${s}${l} {`,...sr(r,s+ye,i),`${s}}`);return}if(n==="cases"&&xe(r)){t.push(`${s}${l} {`);for(let[c,u]of Object.entries(r))t.push(`${s}${ye}${fe(c,i)} {`,...sr(u,s+ye+ye,Z(i,c)),`${s}${ye}}`);t.push(`${s}}`);return}let a=ae(r,o,i);if(a===null||a.includes(`
82
+ `))t.push(...Re(`.${n}`,r,s,i));else e.push(`${l}=${a}`)}function Ic(e,t){return["$head {",...e.flatMap((n,r)=>xe(n)&&!or(n)&&b(n.tagName)&&!n.$ref?di(n,t,`/$head/${r}`):Re("-",n,t,`/$head/${r}`)),"}"]}function Wm(e){let{document:t,spans:n}=oi(e);return{document:C(t)?t:null,spans:n}}function mi(e,t){let n=Hm(e);return t===void 0?n:hs(t,n,Wm)}function Hm(e){if(!C(e))throw new ge("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,l]of Object.entries(t)){let a=i==="$script"&&s?Fm(l,ye):null;if(a)o=a;else if(i==="$head"&&Array.isArray(l))n.push(...Ic(l,ye));else if(i==="$head")n.push(`(object)${Re(i,l,"","/$head").join(`
83
+ `)}`);else if(i.startsWith("$"))n.push(...Re(i,l,"",Z("",i)));else r[i]=l}if(Object.keys(r).length>0)n.push("",...di(r,"","",o));return`${n.join(`
79
84
  `)}
80
- `}var pe=" ",Wo=100,Jl,Ol,zf,Kf,de=(e)=>C(e),Gn=(e)=>de(e)&&y(e.$ref)&&Object.keys(e).length===1,K=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,Zf;var Uo=N(()=>{Gr();W();mn();Hn();ns();Jl=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,Ol=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,zf=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,Kf=new Set(["-","attributes","script","state","style"]);Zf=new Set(["$export","$src","arguments","timing"])});function fp(e,t,n){if(gn(e,t)!==null)throw k(e,t,`"project" names the file's kind, and takes no annotation`);let r=Re(e,t);if(r.length>1||_e(t).length>0||fe(t).length>0)throw k(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)R(n,"name",r[0],e,t),ee(e,"/name",t)}function pp(e,t,n){let r=t.getName(),s=`/${Y(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=_o(e,t),ee(e,s,t);else if(up.has(r)&&o)i=Zr(e,t,s);else i=Te(e,t,s);R(n,r,i,e,t)}function dp(e){if(Zt(e.text)==="document")throw new ue('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=Po(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===cp){if(r)throw k(e,s,'"project" is written twice, and a file declares one project');fp(e,s,n),r=!0}else pp(e,s,n);return Qt(n)}function qo(e,t){try{return dp({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof ue?n.inFile(t):n}}var cp="project",up;var zo=N(()=>{W();_n();Rn();mn();Hn();ns();Uo();up=new Set(["$media","style"])});var os=N(()=>{Rn();Io();mn();xl();Hn();ns();Uo();zo()});function Il(e){if(!y(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("+"),l=i===-1?null:o.slice(i+1),a=i===-1?o:o.slice(0,i);if(l==="")return null;let c=a.indexOf("."),u=c===-1?null:a.slice(0,c),f=u!==null&&gp.has(u)?u:null,p=f===null?a:a.slice(f.length+1);if(p==="")return null;let d={};for(let h of n){let m=h.indexOf("=");if(m===-1)return null;let g=h.slice(0,m).trim().toLowerCase(),x=h.slice(m+1).trim();if(g==="")return null;if(x.startsWith('"')&&x.endsWith('"')&&x.length>=2)x=x.slice(1,-1);d[g]=x}return{parameters:d,subtype:p,suffix:l,tree:f,type:s}}function Dl(e){if(!y(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(Il(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function Ml(e){let t=Il(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,gp,Pl="text/markdown; variant=GFM",kl="application/yaml",ax;var Ll=N(()=>{W();_l=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,gp=new Set(["vnd","prs","x"]);ax={".jxn":"text/plain; charset=utf-8",".markdown":`${Pl}; charset=utf-8`,".md":`${Pl}; charset=utf-8`,".yaml":`${kl}; charset=utf-8`,".yml":`${kl}; charset=utf-8`}});function Bl(e){if(e===null)throw TypeError("A class descriptor cannot be null");return C(e)?e:{}}class Yn{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=Ml(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=xp(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(!Je(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 is{#t;get#e(){return[...this.#t,bp]}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=Dl(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of Vl){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=Fl(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=Fl(e);return this.#e.some((n)=>n.extensions.includes(t))}}function xp(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!$p(o))continue;let i={identifier:s.identifier??r,timing:s.timing??hp};if(y(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function $p(e){return e!==void 0&&yp.has(e)}function Fl(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var Vl,Wl,hp,yp,Sp,bp;var Ko=N(()=>{W();Ll();Vl=["parse","serialize","rewrite","discover","load"],Wl=[...Vl,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];hp=["compiler","server"];yp=new Set(Wl);Sp={importModule:async()=>{await Promise.resolve().then(() => os());return{JxNotation:{parse:(n)=>Bn(n),serialize:(n)=>Ho(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},bp=new Yn("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},Sp)});class Hl{#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 is(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 Ul(e,t,n){let r=[];for(let s of e??[])r.push(await wp(s,t,n));return new Hl(r)}async function wp(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let a=t.resolvePath(n,e);r=t.resolvePath(`${a}/package.json`,`./${Xn}`)}else try{r=t.resolvePath(n,`${e}/${Xn}`)}catch(a){throw Error(`Extension "${e}" is not resolvable: it must export ${Xn} (is the package installed, and does its exports map include it?): ${Go(a)}`,{cause:a})}let s;try{s=await t.loadJson(r)}catch(a){throw Error(`Extension "${e}": cannot read manifest ${r}: ${Go(a)}`,{cause:a})}if(!C(s)||!y(s.name))throw Error(`Extension "${e}": ${Xn} 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[a,c]of Object.entries(o.classes??{})){let u=t.resolvePath(r,c),f;try{f=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${a}" at ${u}: ${Go(p)}`,{cause:p})}i.push(new Yn(a,u,Bl(f),t))}let l={};if(o.schemas?.project)l.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)l.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)l.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:l}}function Go(e){return e instanceof Error?e.message:String(e)}var Xn="jx-extension.json";var ql=N(()=>{Ko();W();Ko()});var zl=N(()=>{W()});function Jp(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 Gl(e){let t=Ep.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function Nx(e,t){return Un(t)?qo(e,t):va(e,t)}var Ep,Kl="project.jxn",Yo;var Yl=N(()=>{W();zl();Rn();Io();zo();_n();Ep=["project.jxn","project.json"];Yo=class Yo extends Error{constructor(e){super(Jp(e));this.name="ProjectFileConflictError"}}});import{accessSync as Tx,closeSync as Rx,constants as _x,existsSync as Op,fstatSync as Px,lstatSync as kx,openSync as Ix,readFileSync as Dx,statSync as Mx}from"node:fs";import{dirname as Fx,join as Xl}from"node:path";function Np(e){return Gl((t)=>Op(Xl(e,t)))}function Zl(e){let t=Np(e);if(t==="conflict")throw new Yo(e);return Xl(e,t??Kl)}var Ql=N(()=>{Yl()});import{readFileSync as Ap}from"node:fs";import{dirname as jp,isAbsolute as Cp,resolve as ec,sep as as}from"node:path";import{pathToFileURL as vp}from"node:url";import{createRequire as Tp}from"node:module";async function Rp(e){let t=[e],n=`${as}src${as}`,r=`${as}dist${as}`;if(e.includes(n)){let o=e.replace(n,r);if(t.push(o),o.endsWith(".ts"))t.push(`${o.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let o of t)try{return await import(vp(o).href)}catch(i){s=i}throw s instanceof Error?s:Error(String(s))}function _p(e,t){return Tp(ec(e,"package.json")).resolve(t)}function Pp(e){return{importModule:(t)=>Rp(t),loadJson:async(t)=>JSON.parse(Ap(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return ec(jp(t),n);if(Cp(n))return n;return _p(e,n)}}}async function Yx(e,t){return Ul(t?.extensions,Pp(e),Zl(e))}function ls(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 Xo=N(()=>{ql();W();Ql()});async function rc(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function l(a,c){let u,f;if(y(a)){let{readFileSync:J}=await import("node:fs"),{resolve:S}=await import("node:path");if(f=c?S(c,a):S(a),i.has(f))return;if(i.add(f),qn(f))u=zn(J(f,"utf8"),f);else{let{extname:b}=await import("node:path"),A=b(f).toLowerCase(),j=s?.byExtension(A,"parse");if(!j){await Promise.resolve().then(() => Xo());throw ls(f,A)}u=await j.parseDocument(J(f,"utf8"))}if(u=$n(u,f),t.projectRoot!==void 0){let{relative:b}=await import("node:path");u=qs(u,b(t.projectRoot,f))}}else{if(u=$n(a,a.tagName??"a component"),f=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}u=fa(u,t.projectState);let{tagName:p}=u;if(!p||!p.includes("-"))throw Error(`compileElement: tagName "${p}" must contain a hyphen`);let{dirname:d}=await import("node:path"),h=f?d(f):null,m=[];if(Array.isArray(u.$elements))for(let J of u.$elements){let S=U(J)?J.$ref:J;if(!y(S))continue;if(h)await l(S,h);let b=n?n(S,h):S.replace(/\.(?:json|jxn)$/i,".js");m.push(b)}let g=Ar(p);if(r)u.$media={...r,...u.$media};let{rewriteSrc:x}=t,w=Zn(u,g,m,x?(J)=>x(J,h):void 0,mr(u,t.defaults),t.serverBaseUrl),O=f?f.replace(/\.(?:json|jxn)$/i,".js"):`${p}.js`;o.push({content:w,path:O,tagName:p})}return await l(e,t.basePath??null),{files:o}}async function kp(e,t={}){let{title:n="Jx App",reactivitySrc:r=Ht,litHtmlSrc:s=Ut}=t,o=await rc(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:l}=await import("node:path"),a=l(i.path),c=`<!DOCTYPE html>
85
+ `}var ye=" ",fi=100,Nc,Tc,Am,Cm,xe=(e)=>C(e),or=(e)=>xe(e)&&b(e.$ref)&&Object.keys(e).length===1,Z=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,Pm;var gi=S(()=>{us();q();xn();er();ys();Nc=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,Tc=/[\p{Cc}\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,Am=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}‎‏‪-‮⁦-⁩]/u,Cm=new Set(["-","attributes","script","state","style"]);Pm=new Set(["$export","$src","arguments","timing"])});function Um(e,t,n){if($n(e,t)!==null)throw I(e,t,`"project" names the file's kind, and takes no annotation`);let r=De(e,t);if(r.length>1||Me(t).length>0||he(t).length>0)throw I(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)k(n,"name",r[0],e,t),ie(e,"/name",t)}function zm(e,t,n){let r=t.getName(),s=`/${ee(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=ri(e,t),ie(e,s,t);else if(qm.has(r)&&o)i=ds(e,t,s);else i=_e(e,t,s);k(n,r,i,e,t)}function Km(e){if(nn(e.text)==="document")throw new ge('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=si(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===Bm){if(r)throw I(e,s,'"project" is written twice, and a file declares one project');Um(e,s,n),r=!0}else zm(e,s,n);return rn(n)}function hi(e,t){try{return Km({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof ge?n.inFile(t):n}}var Bm="project",qm;var yi=S(()=>{q();Hn();Wn();xn();er();ys();gi();qm=new Set(["$media","style"])});var bs=S(()=>{Wn();ii();xn();Ec();er();ys();gi();yi()});function Wc(e){if(!b(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(!Lc.test(s)||!Lc.test(o))return null;let i=o.lastIndexOf("+"),l=i===-1?null:o.slice(i+1),a=i===-1?o:o.slice(0,i);if(l==="")return null;let c=a.indexOf("."),u=c===-1?null:a.slice(0,c),p=u!==null&&Ym.has(u)?u:null,d=p===null?a:a.slice(p.length+1);if(d==="")return null;let f={};for(let y of n){let h=y.indexOf("=");if(h===-1)return null;let m=y.slice(0,h).trim().toLowerCase(),g=y.slice(h+1).trim();if(m==="")return null;if(g.startsWith('"')&&g.endsWith('"')&&g.length>=2)g=g.slice(1,-1);f[m]=g}return{parameters:f,subtype:d,suffix:l,tree:p,type:s}}function Hc(e){if(!b(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(Wc(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function Bc(e){let t=Wc(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 Lc,Ym,Fc="text/markdown; variant=GFM",Vc="application/yaml",Kb;var qc=S(()=>{q();Lc=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Ym=new Set(["vnd","prs","x"]);Kb={".jxn":"text/plain; charset=utf-8",".markdown":`${Fc}; charset=utf-8`,".md":`${Fc}; charset=utf-8`,".yaml":`${Vc}; charset=utf-8`,".yml":`${Vc}; charset=utf-8`}});function Gc(e){if(e===null)throw TypeError("A class descriptor cannot be null");return C(e)?e:{}}class ir{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=Bc(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=Zm(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(!Ae(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 Ss{#t;get#e(){return[...this.#t,ng]}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=Hc(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of zc){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=Uc(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=Uc(e);return this.#e.some((n)=>n.extensions.includes(t))}}function Zm(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!eg(o))continue;let i={identifier:s.identifier??r,timing:s.timing??Xm};if(b(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function eg(e){return e!==void 0&&Qm.has(e)}function Uc(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var zc,Kc,Xm,Qm,tg,ng;var xi=S(()=>{q();qc();zc=["parse","serialize","rewrite","discover","load"],Kc=[...zc,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];Xm=["compiler","server"];Qm=new Set(Kc);tg={importModule:async()=>{await Promise.resolve().then(() => bs());return{JxNotation:{parse:(n)=>Qn(n),serialize:(n)=>mi(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},ng=new ir("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},tg)});class Yc{#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 Ss(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 Xc(e,t,n){let r=[];for(let s of e??[])r.push(await rg(s,t,n));return new Yc(r)}async function rg(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let a=t.resolvePath(n,e);r=t.resolvePath(`${a}/package.json`,`./${ar}`)}else try{r=t.resolvePath(n,`${e}/${ar}`)}catch(a){throw Error(`Extension "${e}" is not resolvable: it must export ${ar} (is the package installed, and does its exports map include it?): ${$i(a)}`,{cause:a})}let s;try{s=await t.loadJson(r)}catch(a){throw Error(`Extension "${e}": cannot read manifest ${r}: ${$i(a)}`,{cause:a})}if(!C(s)||!b(s.name))throw Error(`Extension "${e}": ${ar} 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[a,c]of Object.entries(o.classes??{})){let u=t.resolvePath(r,c),p;try{p=await t.loadJson(u)}catch(d){throw Error(`Extension "${e}": cannot read class "${a}" at ${u}: ${$i(d)}`,{cause:d})}i.push(new ir(a,u,Gc(p),t))}let l={};if(o.schemas?.project)l.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)l.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)l.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:l}}function $i(e){return e instanceof Error?e.message:String(e)}var ar="jx-extension.json";var Zc=S(()=>{xi();q();xi()});var Qc=S(()=>{q()});function og(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 tu(e){let t=sg.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function dS(e,t){return tr(t)?hi(e,t):Dl(e,t)}var sg,eu="project.jxn",bi;var nu=S(()=>{q();Qc();Wn();ii();yi();Hn();sg=["project.jxn","project.json"];bi=class bi extends Error{constructor(e){super(og(e));this.name="ProjectFileConflictError"}}});import{accessSync as xS,closeSync as $S,constants as bS,existsSync as ig,fstatSync as SS,lstatSync as wS,openSync as ES,readFileSync as JS,statSync as vS}from"node:fs";import{dirname as jS,join as ru}from"node:path";function ag(e){return tu((t)=>ig(ru(e,t)))}function su(e){let t=ag(e);if(t==="conflict")throw new bi(e);return ru(e,t??eu)}var ou=S(()=>{nu()});import{existsSync as lg,readFileSync as cg}from"node:fs";import{dirname as Es,isAbsolute as ug,resolve as iu,sep as ws}from"node:path";import{pathToFileURL as pg}from"node:url";import{createRequire as fg}from"node:module";function au(e){let t=[e],n=`${ws}src${ws}`,r=`${ws}dist${ws}`;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 MS(e){let t=au(e),n=Es(e),r=[...t.filter((o)=>Es(o)===n),...t.filter((o)=>Es(o)!==n)],s=r.find((o)=>lg(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function dg(e){let t=au(e),n;for(let r of t)try{return await import(pg(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function mg(e,t){return fg(iu(e,"package.json")).resolve(t)}function gg(e){return{importModule:(t)=>dg(t),loadJson:async(t)=>JSON.parse(cg(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return iu(Es(t),n);if(ug(n))return n;return mg(e,n)}}}async function IS(e,t){return Xc(t?.extensions,gg(e),su(e))}function Js(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 Si=S(()=>{Zc();q();ou()});async function uu(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function l(a,c){let u,p;if(b(a)){let{readFileSync:_}=await import("node:fs"),{resolve:G}=await import("node:path");if(p=c?G(c,a):G(a),i.has(p))return;if(i.add(p),nr(p))u=rr(_(p,"utf8"),p);else{let{extname:N}=await import("node:path"),H=N(p).toLowerCase(),j=s?.byExtension(H,"parse");if(!j){await Promise.resolve().then(() => Si());throw Js(p,H)}u=await j.parseDocument(_(p,"utf8"))}if(u=Jn(u,p),t.projectRoot!==void 0){let{relative:N}=await import("node:path");u=po(u,N(t.projectRoot,p))}}else{if(u=Jn(a,a.tagName??"a component"),p=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}await t.prepareDocument?.(u,p);let d=u.state??{};u=ul(u,t.projectState);let{tagName:f}=u;if(!f||!f.includes("-"))throw Error(`compileElement: tagName "${f}" must contain a hyphen`);let{dirname:y}=await import("node:path"),h=p?y(p):null,m=[];if(Array.isArray(u.$elements))for(let _ of u.$elements){let G=Y(_)?_.$ref:_;if(!b(G))continue;if(h)await l(G,h);let N=n?n(G,h):G.replace(/\.(?:json|jxn)$/i,".js");m.push(N)}let g=Wr(f);if(r)u.$media={...r,...u.$media};let{resolveClass:x,rewriteSrc:w}=t,O=u.imports??{},A=wi(u,g,m,w?(_)=>w(_,h):void 0,Jr(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((_)=>!(_ in d)),x?(_)=>x(_,h,O):void 0),T=p?p.replace(/\.(?:json|jxn)$/i,".js"):`${f}.js`;o.push({content:A,path:T,tagName:f})}return await l(e,t.basePath??null),{files:o}}async function yg(e,t={}){let{title:n="Jx App",reactivitySrc:r=zt,litHtmlSrc:s=Kt}=t,o=await uu(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:l}=await import("node:path"),a=l(i.path),c=`<!DOCTYPE html>
81
86
  <html lang="en">
82
87
  <head>
83
88
  <meta charset="utf-8">
84
89
  <meta name="viewport" content="width=device-width, initial-scale=1">
85
- <title>${D(n)}</title>
90
+ <title>${L(n)}</title>
86
91
  <script type="importmap">
87
92
  {
88
93
  "imports": {
@@ -96,78 +101,69 @@ ${r}"""${n}`;return Al(o,e)?o:null}function rs(e,t,n){if(!Nl(e))throw new ue(`${
96
101
  <${i.tagName}></${i.tagName}>
97
102
  <script type="module" src="./${a}"></script>
98
103
  </body>
99
- </html>`;return{files:o.files,html:c}}function Ip(e){if(!E(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(ut(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Xe(e))return"null";return JSON.stringify(e)}function Zn(e,t,n,r,s=null,o="/_jx/server"){let i=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)i.push(`// Source: ${e.$id}`);for(let S of n)i.push(`import '${S}';`);let l=e.state??{},a=Et(e),c=wr(br(l,a),r);i.push(...c.imports);let u=Object.entries(l).flatMap(([S,b])=>ct(b)&&b.$prototype==="Request"?[[S,b]]:[]),f=Object.entries(l).flatMap(([S,b])=>Xe(b)?[[S,b]]:[]);if(i.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",Or()),f.length>0)i.push(Nr());let p=s===null&&Wt(e.children);if(p)i.push(xa());i.push(...c.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let d=[],h=[],m=[],g=[],x=[];for(let[S,b]of Object.entries(l))if(Oe(b))if(Ye(b))g.push([S,b]);else if(He(b.$expression.operator))m.push([S,b]);else h.push([S,b]);else if(oe(b))(a.get(S)==="computed"?h:m).push([S,b]);else if(y(b)&&b.includes("${"))x.push([S,b]);else{let A=Ip(b);if(A!==void 0)d.push([S,A])}i.push(" this.state = reactive({");for(let[S,b]of d)i.push(` ${Qe(S)}: ${b},`);i.push(" });");for(let[S,b]of m)if(i.push(""),Oe(b)){let A=xe(b.$expression,{eventParam:"e",statePrefix:"s"});i.push(` ${F("this.state",he(S))} = (s, e) => { ${A}; };`)}else if(Le(b)){let A=ve(b.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});i.push(` ${F("this.state",he(S))} = (s, e) => {`,A," };")}else{let A=F("this.state",he(S));if(b.$src)i.push(` ${A} = ${S};`);else{let j=y(b.body)?b.body:"";i.push(` ${A} = (${Ve(b).join(", ")}) => {`,` ${j}`," };")}}for(let[S,b]of g){i.push("");let A=xe(b.$expression,{eventParam:"e",statePrefix:"this.state"});i.push(` ${F("this.state",he(S))} = ${vn(b,A)};`)}for(let[S,b]of x)i.push("",` ${F("this.state",he(S))} = computed(() => ${Er(zt(b,"this.state",{code:!1}))});`);for(let[S,b]of h)if(i.push(""),Oe(b)){let A=xe(b.$expression,{eventParam:"e",statePrefix:"this.state"});i.push(` ${F("this.state",he(S))} = computed(() => ${A});`)}else if(b.$src)i.push(` ${F("this.state",he(S))} = computed(() => ${S}(this.state));`);else{i.push(` ${F("this.state",he(S))} = computed(() => {`);let A=zt(y(b.body)?b.body:"","this.state");i.push(` ${A}`," });")}i.push(" }","");let w=[];if(Array.isArray(e.children)){let S={n:0};for(let b of e.children)Bt(b,w,e.$media??{},"",S,e.tagName)}let O=sc(),J=!Array.isArray(e.children)&&e.textContent!==void 0?` ${fs(e.textContent)}`:us(e.children,e.style," ",!1,!1,O);i.push(" template() {"," const s = this.state;",...O.decls," return html`",J," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;"," if (k in this.state) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (_k in this.state) {"," this.state[_k] = this.getAttribute(_n);"," this.removeAttribute(_n);"," }"," }"," for (const key of Object.keys(this.state)) {"," if (key.startsWith('#')) continue;"," if (this.hasOwnProperty(key) && this[key] !== undefined) {"," this.state[key] = this[key];"," }"," }");for(let[S,b]of u)i.push(yr(S,b,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[S,b]of f)i.push($r(S,b,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(E(e.style)){let S=[];for(let[b,A]of Object.entries(e.style)){if(b.startsWith(":")||b.startsWith(".")||b.startsWith("&")||b.startsWith("[")||b.startsWith("@"))continue;if(y(A)&&A.includes("${"))S.push([be(b),A])}if(S.length>0){i.push(" this.#effects.push(effect(() => {");for(let[b,A]of S){let j=A.replaceAll(/\$\{([^}]+)\}/g,(re,v)=>`\${${zt(v,"this.state")}}`);i.push(` this.style['${b}'] = \`${j}\`;`)}i.push(" }));")}}if(i.push(" const _first = !this.#rendered;"," this.#rendered = true;"),p)i.push(` const _slotted = _first ? ${so}(this) : null;`);if(i.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)i.push(" if (_first) this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else i.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)i.push(` if (_first) ${oo}(this, _slotted);`);return i.push(" if (typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount(this.state));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }","}","",`customElements.define('${e.tagName}', ${t});`,""),i.join(`
100
- `)}function sc(){return{byText:new Map,decls:[]}}function oc(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
104
+ </html>`;return{files:o.files,html:c}}function xg(e){if(!E(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(ft(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Zt(e))return"null";if(nt(e))return"null";return JSON.stringify(e)}function wi(e,t,n,r,s=null,o="/_jx/server",i=[],l){let a=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)a.push(`// Source: ${e.$id}`);for(let v of n)a.push(`import '${v}';`);let c=e.state??{},u=At(e),p=Rr(Tr(c,u),r);a.push(...p.imports);let d=Lr(c,l),f=d.entries.length>0;a.push(...d.imports);let y=Object.entries(c).flatMap(([v,J])=>tt(J)&&J.$prototype==="Request"?[[v,J]]:[]),h=Object.entries(c).flatMap(([v,J])=>nt(J)?[[v,J]]:[]);a.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",_r());let m=Object.keys(c).filter((v)=>!Rs(v)),g=m.filter((v)=>!hg.has(v)),x=g.filter((v)=>i.includes(v)),w=x.length>0;if(a.push(`const __jxProps = ${JSON.stringify(m)};`),g.length>0)a.push(`const __jxBridged = ${JSON.stringify(g)};`,ml());if(w)a.push(`const __jxInherited = new Set(${JSON.stringify(x)});`);let O=Ln(e);if(O.length>0)a.push(gl(),`const __jxObserved = ${JSON.stringify(O)};`,`const __jxObservedDefaults = () => ${yl(e)};`);if(h.length>0)a.push(Mr());if(f)a.push(Ir());let A=s===null&&Ut(e.children);if(A)a.push(bl());a.push(...p.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...s===null?[]:[" #root = null;"],...f?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...O.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[]," constructor() {"," super();");let T=[],_=[],G=[],N=[],H=[];for(let[v,J]of Object.entries(c))if(Ce(J))if(et(J))N.push([v,J]);else if(Ge(J.$expression.operator))G.push([v,J]);else _.push([v,J]);else if(ue(J))(u.get(v)==="computed"?_:G).push([v,J]);else if(b(J)&&J.includes("${"))H.push([v,J]);else{let se=xg(J);if(se!==void 0)T.push([v,se])}a.push(" this.state = reactive({");for(let[v,J]of T)a.push(` ${st(v)}: ${J},`);a.push(" });");for(let[v,J]of G)if(a.push(""),Ce(J)){let se=Je(J.$expression,{eventParam:"e",statePrefix:"s"});a.push(` ${W("this.state",Se(v))} = (s, e) => { ${se}; };`)}else if(Be(J)){let se=ke(J.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});a.push(` ${W("this.state",Se(v))} = (s, e) => {`,se," };")}else{let se=W("this.state",Se(v));if(J.$src)a.push(` ${se} = ${v};`);else{let Ns=b(J.body)?J.body:"";a.push(` ${se} = (${Ue(J).join(", ")}) => {`,` ${Ns}`," };")}}for(let[v,J]of N){a.push("");let se=Je(J.$expression,{eventParam:"e",statePrefix:"this.state"});a.push(` ${W("this.state",Se(v))} = ${Mn(J,se)};`)}for(let[v,J]of H)a.push("",` ${W("this.state",Se(v))} = computed(() => ${Pr(Yt(J,"this.state",{code:!1}))});`);for(let[v,J]of _)if(a.push(""),Ce(J)){let se=Je(J.$expression,{eventParam:"e",statePrefix:"this.state"});a.push(` ${W("this.state",Se(v))} = computed(() => ${se});`)}else if(J.$src)a.push(` ${W("this.state",Se(v))} = computed(() => ${v}(this.state));`);else{a.push(` ${W("this.state",Se(v))} = computed(() => {`);let se=Yt(b(J.body)?J.body:"","this.state");a.push(` ${se}`," });")}a.push(" }","");let j={n:0};for(let v of Vr(e))El(v,j,e.tagName??"jx");let R=pu(),$e=!Array.isArray(e.children)&&e.textContent!==void 0?` ${As(e.textContent)}`:js(e.children,e.style," ",!1,!1,R);if(a.push(" template() {"," const s = this.state;",...R.decls," return html`",$e," `;"," }","",...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;",...w?[" const _given = new Set();"]:[],...O.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${Dr}(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;",w?" 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);",...w?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),g.length>0)a.push(" if (_first) {"," for (const _k of __jxBridged) {",` if (_k in this && this[_k] !== undefined && ${Oo}(this, _k)) {`," this.state[_k] = this[_k];",...w?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...w?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],` const _set = ${jo}(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(f)a.push(` this.#jxReady ??= ${Fr(d.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[v,J]of y)a.push(Ar(v,J,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[v,J]of h)a.push(Cr(v,J,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(E(e.style)){let v=[];for(let[J,se]of Object.entries(e.style)){if(J.startsWith(":")||J.startsWith(".")||J.startsWith("&")||J.startsWith("[")||J.startsWith("@"))continue;if(b(se)&&se.includes("${"))v.push([Oe(J),se])}if(v.length>0){a.push(" this.#effects.push(effect(() => {");for(let[J,se]of v){let Ns=se.replaceAll(/\$\{([^}]+)\}/g,(Wg,Nu)=>`\${${Yt(Nu,"this.state")}}`);a.push(` this.style['${J}'] = \`${Ns}\`;`)}a.push(" }));")}}if(A)a.push(` const _slotted = _first ? ${Ao}(this) : null;`);if(a.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)a.push(" if (_first) this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else a.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(A)a.push(` if (_first) ${Co}(this, _slotted);`);if(a.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 c)a.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(O.length>0)a.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${Dr}(this.state, name, newVal, __jxObservedDefaults());`," }");return a.push("}","",`customElements.define('${e.tagName}', ${t});`,""),a.join(`
105
+ `)}function pu(){return{byText:new Map,decls:[]}}function fu(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
101
106
  ${t}
102
- \`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function us(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let l=i?Gt:"";if(se(e))return`${nc(e,n)}${l}`;if(!Array.isArray(e))return"";return e.map((a)=>{if(se(a))return`${nc(a,n)}${l}`;let c=Qo(a,r?"":n,r,s,o);return y(a)&&a.includes("${")||E(a)&&Fe(a.tagName)?`${c}${l}`:c}).join(r?"":`
103
- `)}function Qo(e,t,n=!1,r=!1,s=null,o=null){if(y(e)){if(e.includes("${"))return`${t}${fs(e)}`;return`${t}${D(e)}`}if(le(e)||Se(e))return`${t}${D(String(e))}`;if(!E(e))return"";if(Fe(e.tagName)){let m=e.tagName.$expression,g=et(m.target,{eventParam:"e",statePrefix:"s"}),x=m.operator==="?:"?[[!0,m.value],[!1,m.initial]]:[...Object.entries(m.cases),["__default__",m.default]],w=x.map(([,j])=>j),O=w.map((j)=>n||dt.has(j)),J=null;if(s&&O.every((j)=>j===O[0])){let j=tc(e,`${t} `,O[0]===!0,r,s,w.some((re)=>re.includes("-")));if(j.trim()!=="")J=oc(s,j)}let S=x.map(([j,re])=>{let v={...e,tagName:re};return[j,Qo(v,`${t} `,n,r,s,J)]});if(m.operator==="?:"){let[,j]=S[0],[,re]=S[1];return`${t}\${${g}
107
+ \`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function js(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let l=i?Qt:"";if(le(e))return`${cu(e,n)}${l}`;if(!Array.isArray(e))return"";return e.map((a)=>{if(le(a))return`${cu(a,n)}${l}`;let c=Ei(a,r?"":n,r,s,o);return b(a)&&a.includes("${")||E(a)&&qe(a.tagName)?`${c}${l}`:c}).join(r?"":`
108
+ `)}function Ei(e,t,n=!1,r=!1,s=null,o=null){if(b(e)){if(e.includes("${"))return`${t}${As(e)}`;return`${t}${L(e)}`}if(ne(e)||be(e))return`${t}${L(String(e))}`;if(!E(e))return"";if(qe(e.tagName)){let m=e.tagName.$expression,g=ot(m.target,{eventParam:"e",statePrefix:"s"}),x=m.operator==="?:"?[[!0,m.value],[!1,m.initial]]:[...Object.entries(m.cases),["__default__",m.default]],w=x.map(([,N])=>N),O=w.map((N)=>n||yt.has(N)),A=null;if(s&&O.every((N)=>N===O[0])){let N=lu(e,`${t} `,O[0]===!0,r,s,w.some((H)=>H.includes("-")));if(N.trim()!=="")A=fu(s,N)}let T=x.map(([N,H])=>{let j={...e,tagName:H};return[N,Ei(j,`${t} `,n,r,s,A)]});if(m.operator==="?:"){let[,N]=T[0],[,H]=T[1];return`${t}\${${g}
104
109
  ? html\`
105
- ${j}
110
+ ${N}
106
111
  \`
107
112
  : html\`
108
- ${re}
109
- \`}`}let b=S.flatMap(([j,re])=>j==="__default__"?[]:[` ${JSON.stringify(j)}: html\`
110
- ${re}
111
- \``]),[,A]=S.at(-1);return`${t}\${{
112
- ${b.join(`,
113
+ ${H}
114
+ \`}`}let _=T.flatMap(([N,H])=>N==="__default__"?[]:[` ${JSON.stringify(N)}: html\`
115
+ ${H}
116
+ \``]),[,G]=T.at(-1);return`${t}\${{
117
+ ${_.join(`,
113
118
  `)}
114
119
  }[String(${g})] ?? html\`
115
- ${A}
116
- \`}`}let i=e.tagName??"div",l=n||dt.has(i),a=[];if(e.attributes)for(let[m,g]of Object.entries(e.attributes))if(U(g))a.push(`${m}="\${${Kt}('${m}', ${Ge(g.$ref)}) ?? nothing}"`);else if(y(g)&&Dp(g))a.push(`${m}="\${${Kt}('${m}', ${Ce(g).slice(2,-1)}) ?? nothing}"`);else if(y(g)&&g.includes("${"))a.push(`${m}="${Ce(g)}"`);else if(Se(g)){let x=Jt(m,g);if(x!==null)a.push(x===""?m:`${m}="${x}"`)}else a.push(`${m}="${g}"`);if(e.id)a.push(`id="${Ce(String(e.id))}"`);if(e.className)a.push(`class="${Ce(String(e.className))}"`);for(let[m,g]of Object.entries(e)){if(tt.has(m)||m.startsWith("$")||m.startsWith("on")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(cs(g))a.push(`.${m}="\${${Ge(g.$ref)}}"`);else if(y(g)&&g.includes("${"))a.push(`.${m}="${Ce(g)}"`);else a.push(`.${m}="\${${JSON.stringify(g)}}"`)}if(e.$props)for(let[m,g]of Object.entries(e.$props))if(cs(g))a.push(`.${m}="\${${Ge(g.$ref)}}"`);else if(y(g)&&g.includes("${"))a.push(`.${m}="${Ce(g)}"`);else a.push(`.${m}="\${${JSON.stringify(g)}}"`);let c=r?"s.$map = $map; ":"";for(let[m,g]of Object.entries(e)){if(!m.startsWith("on")||m==="observedAttributes")continue;pt(`inline "${m}" handler`,g);let x=m.slice(2).toLowerCase();if(cs(g))a.push(c?`@${x}="\${(e) => { ${c}${Ge(g.$ref)}(s, e); }}"`:`@${x}="\${(e) => ${Ge(g.$ref)}(s, e)}"`);else if(E(g)&&"$expression"in g){let w=xe(g.$expression,{eventParam:"e",statePrefix:"s"});a.push(`@${x}="\${(e) => { ${c}${w}; }}"`)}else if(oe(g))a.push(`@${x}="\${(e) => { ${c}${ac(g)} }}"`)}let u=lc(e.style);if(u)a.push(`style="${u}"`);let f=a.length>0?`
120
+ ${G}
121
+ \`}`}let i=e.tagName??"div",l=n||yt.has(i),a=[],c=du(e,Pe,He);if(e.attributes)for(let[m,g]of Object.entries(e.attributes)){if(m==="class"&&c!==null)continue;if(Y(g))a.push(`${m}="\${${Xt}('${m}', ${He(g.$ref)}) ?? nothing}"`);else if(b(g)&&$g(g))a.push(`${m}="\${${Xt}('${m}', ${Pe(g).slice(2,-1)}) ?? nothing}"`);else if(b(g)&&g.includes("${"))a.push(`${m}="${Pe(g)}"`);else if(be(g)){let x=gt(m,g);if(x!==null)a.push(x===""?m:`${m}="${x}"`)}else a.push(`${m}="${g}"`)}if(e.id)a.push(`id="${Pe(String(e.id))}"`);if(c!==null)a.push(c);for(let[m,g]of Object.entries(e)){if(mt.has(m)||m.startsWith("$")||m.startsWith("on")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(Os(g))a.push(`.${m}="\${${He(g.$ref)}}"`);else if(b(g)&&g.includes("${"))a.push(`.${m}="${Pe(g)}"`);else a.push(`.${m}="\${${JSON.stringify(g)}}"`)}if(e.$props)for(let[m,g]of Object.entries(e.$props))if(Os(g))a.push(`.${m}="\${${He(g.$ref)}}"`);else if(b(g)&&g.includes("${"))a.push(`.${m}="${Pe(g)}"`);else a.push(`.${m}="\${${JSON.stringify(g)}}"`);let u=r?"s.$map = $map; ":"";for(let[m,g]of Object.entries(e)){if(!m.startsWith("on")||m==="observedAttributes")continue;ht(`inline "${m}" handler`,g);let x=m.slice(2).toLowerCase();if(Os(g))a.push(u?`@${x}="\${(e) => { ${u}${He(g.$ref)}(s, e); }}"`:`@${x}="\${(e) => ${He(g.$ref)}(s, e)}"`);else if(E(g)&&"$expression"in g){let w=Je(g.$expression,{eventParam:"e",statePrefix:"s"});a.push(`@${x}="\${(e) => { ${u}${w}; }}"`)}else if(ue(g))a.push(`@${x}="\${(e) => { ${u}${gu(g)} }}"`)}let p=hu(e.style);if(p)a.push(`style="${p}"`);let d=a.length>0?`
117
122
  ${t} ${a.join(`
118
- ${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${f}
119
- ${t}>`;let d=o??tc(e,t,l,r,s,i.includes("-")),h=i==="slot"?Gt:"";return l?`${h}<${i}${f}>${d}${h}</${i}>`:`${t}${h}<${i}${f}
120
- ${t}>${d}${h}</${i}>`}function tc(e,t,n,r,s,o=!1){if(e.$switch){let i=U(e.$switch)?e.$switch.$ref:e.$switch,l=Ge(i),a=[];for(let[p,d]of Object.entries(e.cases??{})){if(!d||U(d))continue;a.push([p,Qo(d,`${t} `,!1,r,s)])}let c=a.map(([,p])=>p),u=new Set(c.filter((p,d)=>c.indexOf(p)!==d&&p.trim()!==""));return`\${{
121
- ${a.map(([p,d])=>{let h=s&&u.has(d)?oc(s,d):d;return` ${JSON.stringify(p)}: html\`
122
- ${h}
123
+ ${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${d}
124
+ ${t}>`;let y=o??lu(e,t,l,r,s,i.includes("-")),h=i==="slot"?Qt:"";return l?`${h}<${i}${d}>${y}${h}</${i}>`:`${t}${h}<${i}${d}
125
+ ${t}>${y}${h}</${i}>`}function lu(e,t,n,r,s,o=!1){if(e.$switch){let i=Y(e.$switch)?e.$switch.$ref:e.$switch,l=He(i),a=[];for(let[d,f]of Object.entries(e.cases??{})){if(!f||Y(f))continue;a.push([d,Ei(f,`${t} `,!1,r,s)])}let c=a.map(([,d])=>d),u=new Set(c.filter((d,f)=>c.indexOf(d)!==f&&d.trim()!==""));return`\${{
126
+ ${a.map(([d,f])=>{let y=s&&u.has(f)?fu(s,f):f;return` ${JSON.stringify(d)}: html\`
127
+ ${y}
123
128
  \``}).join(`,
124
129
  `)}
125
- }[${l}]}`}if(e.textContent!==void 0){let i=fs(e.textContent),l=U(e.textContent)||y(e.textContent)&&e.textContent.includes("${");return o&&l?`${i}${Gt}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?us(e.children,e.style,"",!0,r,s,o):`
126
- ${us(e.children,e.style,`${t} `,!1,r,s,o)}
127
- ${t}`;return""}function nc(e,t){let n=U(e.items)?Ge(e.items.$ref):"ITEMS",r=e.map;if(!r)return"";let s=r.tagName??"div",o=[];if(r.attributes)for(let[d,h]of Object.entries(r.attributes))if(U(h))o.push(`${d}="\${${Zo(h.$ref)}}"`);else if(y(h)&&h.includes("${"))o.push(`${d}="${Ce(h)}"`);else o.push(`${d}="${h}"`);if(r.id)o.push(`id="${Ce(String(r.id))}"`);if(r.className)o.push(`class="${Ce(String(r.className))}"`);for(let[d,h]of Object.entries(r)){if(tt.has(d)||d.startsWith("$")||d.startsWith("on")||d==="tagName"||d==="id"||d==="className"||d==="style"||d==="children"||d==="textContent"||d==="innerHTML"||d==="attributes")continue;if(cs(h))o.push(`.${d}="\${${Zo(h.$ref)}}"`);else if(y(h)&&h.includes("${"))o.push(`.${d}="${Ce(h)}"`);else o.push(`.${d}="\${${JSON.stringify(h)}}"`)}if(r.$props)for(let[d,h]of Object.entries(r.$props))if(U(h))o.push(`.${d}="\${${Zo(h.$ref)}}"`);else if(y(h)&&h.includes("${"))o.push(`.${d}="${Ce(h)}"`);else o.push(`.${d}="\${${JSON.stringify(h)}}"`);let i=lc(r.style);if(i)o.push(`style="${i}"`);for(let[d,h]of Object.entries(r)){if(!d.startsWith("on"))continue;pt(`inline "${d}" handler`,h);let m=d.slice(2).toLowerCase();if(U(h))o.push(`@${m}="\${(e) => { s.$map = $map; ${Ge(h.$ref)}(s, e); }}"`);else if(Oe(h)){let g=xe(h.$expression,{eventParam:"e",statePrefix:"s"});o.push(`@${m}="\${(e) => { s.$map = $map; ${g}; }}"`)}else if(oe(h))o.push(`@${m}="\${(e) => { s.$map = $map; ${ac(h)} }}"`)}let l=o.length>0?`
130
+ }[${l}]}`}if(e.textContent!==void 0){let i=As(e.textContent),l=Y(e.textContent)||b(e.textContent)&&e.textContent.includes("${");return o&&l?`${i}${Qt}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?js(e.children,e.style,"",!0,r,s,o):`
131
+ ${js(e.children,e.style,`${t} `,!1,r,s,o)}
132
+ ${t}`;return""}function cu(e,t){let n=Y(e.items)?He(e.items.$ref):"ITEMS",r=e.map;if(!r)return"";let s=r.tagName??"div",o=[],i=du(r,Pe,vs);if(r.attributes)for(let[y,h]of Object.entries(r.attributes)){if(y==="class"&&i!==null)continue;if(Y(h))o.push(`${y}="\${${vs(h.$ref)}}"`);else if(b(h)&&h.includes("${"))o.push(`${y}="${Pe(h)}"`);else o.push(`${y}="${h}"`)}if(r.id)o.push(`id="${Pe(String(r.id))}"`);if(i!==null)o.push(i);for(let[y,h]of Object.entries(r)){if(mt.has(y)||y.startsWith("$")||y.startsWith("on")||y==="tagName"||y==="id"||y==="className"||y==="style"||y==="children"||y==="textContent"||y==="innerHTML"||y==="attributes")continue;if(Os(h))o.push(`.${y}="\${${vs(h.$ref)}}"`);else if(b(h)&&h.includes("${"))o.push(`.${y}="${Pe(h)}"`);else o.push(`.${y}="\${${JSON.stringify(h)}}"`)}if(r.$props)for(let[y,h]of Object.entries(r.$props))if(Y(h))o.push(`.${y}="\${${vs(h.$ref)}}"`);else if(b(h)&&h.includes("${"))o.push(`.${y}="${Pe(h)}"`);else o.push(`.${y}="\${${JSON.stringify(h)}}"`);let l=hu(r.style);if(l)o.push(`style="${l}"`);for(let[y,h]of Object.entries(r)){if(!y.startsWith("on"))continue;ht(`inline "${y}" handler`,h);let m=y.slice(2).toLowerCase();if(Y(h))o.push(`@${m}="\${(e) => { s.$map = $map; ${He(h.$ref)}(s, e); }}"`);else if(Ce(h)){let g=Je(h.$expression,{eventParam:"e",statePrefix:"s"});o.push(`@${m}="\${(e) => { s.$map = $map; ${g}; }}"`)}else if(ue(h))o.push(`@${m}="\${(e) => { s.$map = $map; ${gu(h)} }}"`)}let a=o.length>0?`
128
133
  ${t} ${o.join(`
129
- ${t} `)}`:"",a=sc(),c="";if(r.textContent!==void 0)c=fs(r.textContent);else if(r.children)c=`
130
- ${us(r.children,null,`${t} `,!1,!0,a)}
131
- ${t} `;let u=`html\`
132
- ${t} <${s}${l}
133
- ${t} >${c}</${s}>
134
- ${t}\``,f=(u.includes("$map")?"const $map = { item, index }; ":"")+a.decls.map((d)=>`${d.trim()} `).join(""),p=f?`(item, index) => { ${f}return ${u}; }`:`(item, index) => ${u}`;return`${t}\${${n}.map(${p})}`}function cs(e){return U(e)&&e.$ref!==""}function Ge(e){if(e.startsWith("#/state/"))return F("s",e.slice(8));if(e.startsWith("$map/"))return ic(e.slice(5));if(e.startsWith("parent#/"))return F("s",e.slice(8));if(e.startsWith("window#/"))return F("window",e.slice(8));if(e.startsWith("document#/"))return F("document",e.slice(10));return F("s",e)}function ic(e){let[t,...n]=Be(e);return F(t??"",n.map((r)=>he(r)).join("/"))}function Zo(e){if(e.startsWith("$map/"))return ic(e.slice(5));return Ge(e)}function Ce(e){return zt(e,"s",{code:!1})}function Dp(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function fs(e){if(U(e))return`\${${Ge(e.$ref)}}`;if(y(e)&&e.includes("${"))return Ce(e);return String(e)}function ac(e){if(Le(e))return ve(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=y(e.body)?e.body:"";if(Sn(e))return`((${Ve(e).join(", ")}) => { ${t}
135
- })(s, e);`;return`${zt(t,"s",{bare:!0})}
136
- `}function lc(e){if(!E(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(y(r)&&r.includes("${")){let s=be(n);t.push(`${s}: ${Ce(r)}`)}}return t.join("; ")}var ps=N(()=>{rr();zs();bn();An();Xt();W();os();Dt()});function cc(e,t){let{title:n="Jx App",reactivitySrc:r,litHtmlSrc:s}=t,o=qt(e,null,e.state??{},e.$media??{}),i=Yt(e,e.$media??{},t.projectStyle??null),l=[],a=uc(e,!1,o,l),c=[],u="",f="";if(l.length>0){for(let h of l){let m=Zn(h.def,h.className,[],t.rewriteSrc);c.push({content:m,path:`_islands/${h.tagName}.js`,tagName:h.tagName})}u=`<script type="importmap">
137
- {
138
- "imports": {
139
- "@vue/reactivity": "${r}",
140
- "lit-html": "${s}"
141
- }
142
- }
143
- </script>`,f=c.map((h)=>`<script type="module" src="./${h.path}"></script>`).join(`
144
- `)}let p=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((h)=>Ze(String(h))!==null)?`<script>${Jr()}</script>
145
- `:"",d=`<!DOCTYPE html>
134
+ ${t} `)}`:"",c=pu(),u="";if(r.textContent!==void 0)u=As(r.textContent);else if(r.children)u=`
135
+ ${js(r.children,null,`${t} `,!1,!0,c)}
136
+ ${t} `;let p=`html\`
137
+ ${t} <${s}${a}
138
+ ${t} >${u}</${s}>
139
+ ${t}\``,d=(p.includes("$map")?"const $map = { item, index }; ":"")+c.decls.map((y)=>`${y.trim()} `).join(""),f=d?`(item, index) => { ${d}return ${p}; }`:`(item, index) => ${p}`;return`${t}\${${n}.map(${f})}`}function du(e,t,n){if(!Fn(e))return null;let r=Vn(e),s="";if(Y(r))s=`\${${n(r.$ref)} ?? ""}`;else if(b(r))s=t(r);else if(ne(r))s=String(r);let o=xt(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function Os(e){return Y(e)&&e.$ref!==""}function He(e){if(e.startsWith("#/state/"))return W("s",e.slice(8));if(e.startsWith("$map/"))return mu(e.slice(5));if(e.startsWith("parent#/"))return W("s",e.slice(8));if(e.startsWith("window#/"))return W("window",e.slice(8));if(e.startsWith("document#/"))return W("document",e.slice(10));return W("s",e)}function mu(e){let[t,...n]=Ke(e);return W(t??"",n.map((r)=>Se(r)).join("/"))}function vs(e){if(e.startsWith("$map/"))return mu(e.slice(5));return He(e)}function Pe(e){return Yt(e,"s",{code:!1})}function $g(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function As(e){if(Y(e))return`\${${He(e.$ref)}}`;if(b(e)&&e.includes("${"))return Pe(e);return String(e)}function gu(e){if(Be(e))return ke(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=b(e.body)?e.body:"";if(vn(e))return`((${Ue(e).join(", ")}) => { ${t}
140
+ })(s, e);`;return`${Yt(t,"s",{bare:!0})}
141
+ `}function hu(e){if(!E(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(b(r)&&r.includes("${")){let s=Oe(n);t.push(`${s}: ${Pe(r)}`)}}return t.join("; ")}var hg;var Ji=S(()=>{fr();fo();On();Pn();tn();q();bs();Ft();hg=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])});function yu(e,t){let{title:n="Jx App"}=t,r=Gt(e,null,e.state??{},e.$media??{}),s=en(e,e.$media??{},t.projectStyle??null),o=xu(e,r),i=[],l=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((c)=>rt(String(c))!==null)?`<script>${kr()}</script>
142
+ `:"",a=`<!DOCTYPE html>
146
143
  <html lang="en">
147
144
  <head>
148
145
  <meta charset="utf-8">
149
146
  <meta name="viewport" content="width=device-width, initial-scale=1">
150
- <title>${D(n)}</title>
151
- ${p}${u}
152
- ${i}
147
+ <title>${L(n)}</title>
148
+ ${l}
149
+ ${s}
153
150
  </head>
154
151
  <body>
155
- ${a}
156
- ${f}
152
+ ${o}
157
153
  </body>
158
- </html>`;return{files:c,html:d}}function uc(e,t,n,r){if(y(e))return D(e);if(le(e)||Se(e))return D(String(e));if(!E(e))return"";let s=qt(e,n.scope,e.state??n.scopeDefs,e.$media??n.media);if(t){let c=r.length,u=`jx-island-${c}`,f=`JxIsland${c}`,p={...e,tagName:u};return r.push({className:f,def:p,tagName:u}),`<${u}></${u}>`}let o=lo(e.tagName,s.scope),i=Ot(e,s.scope);if(ao.has(o))return`<${o}${i}>`;let l=n.preformatted===!0||dt.has(o),a=Mp(e,{...s,preformatted:l},r);return`<${o}${i}>${a}</${o}>`}function Mp(e,t,n){if(e.textContent!==void 0){let r=q(e.textContent,t.scope);return r==null?"":D(String(r))}if(e.innerHTML){let r=q(e.innerHTML,t.scope);return r==null?e.innerHTML:String(r)}if(Array.isArray(e.children))return e.children.map((r)=>uc(r,pa(r),t,n)).join(Tn(t.preformatted));return""}var fc=N(()=>{Xt();ps();W()});function ri(e,t){let{title:n="Jx App",reactivitySrc:r=Ht,litHtmlSrc:s=Ut,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,l=qt(e,null,e.state??{},e.$media??{}),a=Et(e),c=Yt(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},f=new Map,p=new Map,d=[],h=[],m=[],g=[],x=[],w=[],O=e.state??{};for(let[v,I]of Object.entries(O)){if(!E(I)||Array.isArray(I)){if(V(I))h.push([v,`() => ${Er(I)}`]);else d.push([v,I]);continue}if(Oe(I)){let $e=I.$expression,lt=xe($e,{eventParam:"e",statePrefix:"state"});if(Ye(I))x.push(`state[${JSON.stringify(v)}] = ${vn(I,lt)};`);else if(He($e.operator))g.push([v,{args:["state","e"],body:lt}]);else h.push([v,`() => ${lt}`]);continue}if(oe(I)){let{body:$e}=I;if(Array.isArray($e)){let lt=ve($e,{eventParam:"e",statePrefix:"state"});if(I.parameters&&I.parameters.length>0)x.push(`state[${JSON.stringify(v)}] = ${vn(I,`(() => {
159
- ${lt}
160
- })()`)};`);else g.push([v,{args:["state","e"],body:lt}])}else if(I.$src)if(a.get(v)==="computed")h.push([v,`() => { return ${v}(state); }`]);else x.push(`state[${JSON.stringify(v)}] = ${v};`),g.push([v,{args:["state","event"],body:`return ${v}(state, event);`}]);else if(y($e)&&a.get(v)==="computed")h.push([v,`() => { ${$e} }`]);else g.push([v,{args:Ve(I),body:$e}]);continue}if(ut(I))continue;if(ui(I)){d.push([v,I.default]);continue}if(ct(I)){if(I.$prototype==="LocalStorage"||I.$prototype==="SessionStorage"){let $e=I.$prototype==="LocalStorage"?"localStorage":"sessionStorage",lt=I.key??v,bc=I.default??null;d.push([v,null]),x.push(Vp(v,$e,lt,bc));continue}if(I.$prototype==="Request"){d.push([v,null]),x.push(yr(v,I));continue}if(I.$prototype==="Cookie"){d.push([v,null]),x.push(Wp(v,I.name??v,I.default??null));continue}}if(Xe(I)){d.push([v,null]),w.push($r(v,I,{serverBaseUrl:i}));continue}d.push([v,I])}let J=pc(e,l,f,p,u);for(let[v,I]of f)if(!m.some(([$e])=>$e===v))m.push([v,I]);for(let[v,I]of p)if(!g.some(([$e])=>$e===v))g.push([v,I]);let S=br(O,a),b=Fp(d,h,m,g,x,w,S,u,r,t.rewriteSrc),A=[` "@vue/reactivity": "${r}"`,` "lit-html": "${s}"`],j=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((v)=>Ze(String(v))!==null)?`<script>${Jr()}</script>
161
- `:"",re=`<!DOCTYPE html>
154
+ </html>`;return{files:i,html:a}}function xu(e,t){if(b(e))return L(e);if(ne(e)||be(e))return L(String(e));if(!E(e))return"";let n=Gt(e,t.scope,e.state??t.scopeDefs,e.$media??t.media),r=Ro(e.tagName,n.scope),s=Ct(e,n.scope);if(To.has(r))return`<${r}${s}>`;let o=t.preformatted===!0||yt.has(r),i=bg(e,{...n,preformatted:o});return`<${r}${s}>${i}</${r}>`}function bg(e,t){if(e.textContent!==void 0){let n=U(e.textContent,t.scope);return n==null?"":L(String(n))}if(e.innerHTML){let n=U(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>xu(n,t)).join(In(t.preformatted));return""}var $u=S(()=>{tn();q()});function ji(e,t){let{title:n="Jx App",reactivitySrc:r=zt,litHtmlSrc:s=Kt,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,l=Gt(e,null,e.state??{},e.$media??{}),a=At(e),c=en(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0,textParts:!1},p=new Map,d=new Map,f=[],y=[],h=[],m=[],g=[],x=[],w=e.state??{},O=Lr(w,t.resolveClass);for(let[j,R]of Object.entries(w)){if(!E(R)||Array.isArray(R)){if(B(R))y.push([j,`() => ${Pr(R)}`]);else f.push([j,R]);continue}if(Ce(R)){let $e=R.$expression,v=Je($e,{eventParam:"e",statePrefix:"state"});if(et(R))g.push(`state[${JSON.stringify(j)}] = ${Mn(R,v)};`);else if(Ge($e.operator))m.push([j,{args:["state","e"],body:v}]);else y.push([j,`() => ${v}`]);continue}if(ue(R)){let{body:$e}=R;if(Array.isArray($e)){let v=ke($e,{eventParam:"e",statePrefix:"state"});if(R.parameters&&R.parameters.length>0)g.push(`state[${JSON.stringify(j)}] = ${Mn(R,`(() => {
155
+ ${v}
156
+ })()`)};`);else m.push([j,{args:["state","e"],body:v}])}else if(R.$src)if(a.get(j)==="computed")y.push([j,`() => { return ${j}(state); }`]);else g.push(`state[${JSON.stringify(j)}] = ${j};`),m.push([j,{args:["state","event"],body:`return ${j}(state, event);`}]);else if(b($e)&&a.get(j)==="computed")y.push([j,`() => { ${$e} }`]);else m.push([j,{args:Ue(R),body:$e}]);continue}if(ft(R))continue;if(ki(R)){f.push([j,R.default]);continue}if(tt(R)){if(R.$prototype==="LocalStorage"||R.$prototype==="SessionStorage"){let $e=R.$prototype==="LocalStorage"?"localStorage":"sessionStorage",v=R.key??j,J=R.default??null;f.push([j,null]),g.push(Jg(j,$e,v,J));continue}if(R.$prototype==="Request"){f.push([j,null]),g.push(Ar(j,R));continue}if(R.$prototype==="Cookie"){f.push([j,null]),g.push(vg(j,R.name??j,R.default??null));continue}if(Zt(R)){f.push([j,null]);continue}}if(nt(R)){f.push([j,null]),x.push(Cr(j,R,{serverBaseUrl:i}));continue}f.push([j,R])}let A=Su(e,l,p,d,u);for(let[j,R]of p)if(!h.some(([$e])=>$e===j))h.push([j,R]);for(let[j,R]of d)if(!m.some(([$e])=>$e===j))m.push([j,R]);let T=Tr(w,a),_=Eg(f,y,h,m,g,x,T,u,r,t.rewriteSrc,O),G=[` "@vue/reactivity": "${r}"`,` "lit-html": "${s}"`],N=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((j)=>rt(String(j))!==null)?`<script>${kr()}</script>
157
+ `:"",H=`<!DOCTYPE html>
162
158
  <html lang="en">
163
159
  <head>
164
160
  <meta charset="utf-8">
165
161
  <meta name="viewport" content="width=device-width, initial-scale=1">
166
- <title>${D(n)}</title>
167
- ${j}<script type="importmap">
162
+ <title>${L(n)}</title>
163
+ ${N}<script type="importmap">
168
164
  {
169
165
  "imports": {
170
- ${A.join(`,
166
+ ${G.join(`,
171
167
  `)}
172
168
  }
173
169
  }
@@ -176,22 +172,22 @@ ${A.join(`,
176
172
  <script type="module" src="./${o}"></script>
177
173
  </head>
178
174
  <body>
179
- ${J}
175
+ ${A}
180
176
  </body>
181
- </html>`;return{files:[{content:b,path:o}],html:re}}function pc(e,t,n,r,s){if(y(e))return D(e);if(le(e)||Se(e))return D(String(e));if(!E(e))return"";let o=qt(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(Fe(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${kt(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||dt.has(i);let l=[],a=!1;if(e.textContent!==void 0){let m=e.textContent;if(we(m)){let g=xn(m.$ref);l.push(`:text-content="${g}"`),ei(n,g,m.$ref),a=!0}else if(V(m)){let g=`_t${s.t}`;s.t+=1,l.push(`:text-content="${g}"`),n.set(g,`() => \`${m}\``),a=!0}}for(let[m,g]of Object.entries(e)){if(!m.startsWith("on")||m==="observedAttributes")continue;pt(`inline "${m}" handler`,g);let x=m.slice(2).toLowerCase();if(we(g)){let w=xn(g.$ref);l.push(`@${x}="${w}"`),a=!0}else if(oe(g)){let w=`_h${s.h}`;s.h+=1,l.push(`@${x}="${w}"`);let{body:O}=g;r.set(w,Array.isArray(O)?{args:["state","e"],body:ve(O,{eventParam:"e",statePrefix:"state"})}:{args:Sn(g)?Ve(g):["state","event"],body:O}),a=!0}else if(Oe(g)){let w=`_h${s.h}`;s.h+=1,l.push(`@${x}="${w}"`);let O=xe(g.$expression,{eventParam:"e",statePrefix:"state"});r.set(w,{args:["state","e"],body:O}),a=!0}}if(E(e.style))for(let[m,g]of Object.entries(e.style)){if(m.startsWith(":")||m.startsWith(".")||m.startsWith("&")||m.startsWith("[")||m.startsWith("@"))continue;if(mc(g))continue;if(V(g)){let x=`_s${s.s}`;s.s+=1,l.push(`:style.${be(m)}="${x}"`),n.set(x,`() => \`${g}\``),a=!0}}if(E(e.attributes)){for(let[m,g]of Object.entries(e.attributes))if(we(g)){let x=xn(g.$ref);l.push(`:attr.${m}="${x}"`),ei(n,x,g.$ref),a=!0}else if(V(g)){let x=`_t${s.t}`;s.t+=1,l.push(`:attr.${m}="${x}"`),n.set(x,`() => \`${g}\``),a=!0}}for(let[m,g]of Object.entries(e)){if(tt.has(m)||m.startsWith("on")||m.startsWith("$")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(we(g)){let x=xn(g.$ref);l.push(`:${be(m)}="${x}"`),ei(n,x,g.$ref),a=!0}else if(V(g)){let x=`_t${s.t}`;s.t+=1,l.push(`:${be(m)}="${x}"`),n.set(x,`() => \`${g}\``),a=!0}}let c=Ot(e,o.scope),u=a?" data-bind":"",f=l.length>0?` ${l.join(" ")}`:"",p="",d=e;if(d.$switch){s.needsLit=!0;let m=`_sw${s.sw}`;s.sw+=1;let g=we(d.$switch)?ni(d.$switch.$ref):`\`${String(d.$switch)}\``,x=d.cases??{},w=Object.entries(x).filter(([,J])=>J&&!we(J)).map(([J,S])=>`${JSON.stringify(J)}: html\`${ti(S,o.preformatted)}\``);n.set(m,`() => ({${w.join(", ")}})[String(${g})] ?? html\`\``),l.push(`:render="${m}"`);let O=` ${l.join(" ")}`;return`<${i}${c} data-bind${O}></${i}>`}if(d.textContent!==void 0&&!a){let m=q(d.textContent,o.scope);p=m==null?"":D(String(m))}else if(d.textContent!==void 0&&a){let m=q(d.textContent,o.scope);p=m==null?"":D(String(m))}else if(d.innerHTML){let m=q(d.innerHTML,o.scope);p=m==null?d.innerHTML:String(m)}else if(se(d.children)){s.needsLit=!0;let m=`_list${s.l}`;s.l+=1;let g=d.children,x=we(g.items)?ni(g.items.$ref):JSON.stringify(g.items),w=si(g.map);n.set(m,`() => (${x} ?? []).map((item, index) => html\`${w}\`)`),l.push(`:render="${m}"`),a=!0;let O=" data-bind",J=` ${l.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${O}${J}>`;return`<${i}${c}${O}${J}></${i}>`}else if(Array.isArray(d.children)&&d.children.some((m)=>se(m))){s.needsLit=!0;let m=`_children${s.l}`;s.l+=1;let g=d.children.map((w)=>ti(w,o.preformatted)).join(Tn(o.preformatted," "));n.set(m,o.preformatted?`() => html\`${g}\``:`() => html\`
182
- ${g}
183
- \``),l.push(`:render="${m}"`),a=!0;let x=` ${l.join(" ")}`;return`<${i}${c} data-bind${x}></${i}>`}else if(Array.isArray(d.children))p=d.children.map((m)=>pc(m,o,n,r,s)).join(Tn(o.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${u}${f}>`;return`<${i}${c}${u}${f}>${p}</${i}>`}function si(e,t=!1){if(!e)return"";if(Fe(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${kt(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||dt.has(n),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${Pt(e.className)}"`;if(E(e.$props))for(let[a,c]of Object.entries(e.$props))if(we(c))s+=` .${a}="\${${Bp(c.$ref)}}"`;else if(V(c))s+=` .${a}="${Pt(c)}"`;else s+=` .${a}="\${${JSON.stringify(c)}}"`;if(E(e.attributes))for(let[a,c]of Object.entries(e.attributes)){if(V(c)){s+=` ${a}="${Pt(c)}"`;continue}if(Se(c)){let u=Jt(a,c);if(u!==null)s+=u===""?` ${a}`:` ${a}="${D(u)}"`;continue}s+=` ${a}="${D(String(c))}"`}if(E(e.style)){let a=[];for(let[c,u]of Object.entries(e.style)){if(c.startsWith(":")||c.startsWith(".")||c.startsWith("&")||c.startsWith("[")||c.startsWith("@"))continue;if(mc(u))continue;let f=be(c);if(V(String(u)))a.push(`${f}: ${Pt(String(u))}`);else a.push(`${f}: ${u}`)}if(a.length>0)s+=` style="${a.join("; ")}"`}for(let[a,c]of Object.entries(e)){if(!a.startsWith("on")||a==="observedAttributes")continue;pt(`inline "${a}" handler`,c);let u=a.slice(2).toLowerCase();if(we(c)){let f=xn(c.$ref);s+=` @${u}=\${(e) => { state.$map = { item, index }; on.${f}(e); }}`}else if(Le(c)){let f=ve(c.body,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${f} }}`}else if(oe(c)){let f=Lp(c.body),p=Sn(c)?`((${Ve(c).join(", ")}) => { ${f}
184
- })(state, e);`:`${f}
185
- `;s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p}}}`}else if(E(c)&&"$expression"in c){let f=xe(c.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${f}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let o=n.includes("-")?Gt:"",i="";if(e.textContent!==void 0){let a=String(e.textContent);if(V(a))i=`${Pt(a)}${o}`;else if(we(e.textContent))i=`\${state.${xn(e.textContent.$ref)}}${o}`;else i=D(a)}else if(e.innerHTML)i=Pt(String(e.innerHTML));else if(se(e.children))i=`
186
- ${dc(e.children)}${o}
187
- `;else if(Array.isArray(e.children)){let a=e.children.map((c)=>{let u=ti(c,r);return se(c)||y(c)&&V(c)?`${u}${o}`:u});i=r?a.join(""):`
188
- ${a.join(`
177
+ </html>`;return{files:[{content:_,path:o}],html:H}}function Su(e,t,n,r,s){if(b(e)){if(!B(e))return L(e);let h=`_t${s.t}`;s.t+=1,s.textParts=!0,n.set(h,`() => \`${e}\``);let m=U(e,t.scope),g=m==null?"":L(String(m));return`<!--jx-text:${h}-->${g}<!--/jx-text-->`}if(ne(e)||be(e))return L(String(e));if(!E(e))return"";let o=Gt(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(qe(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${En(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||yt.has(i);let l=[],a=!1;if(e.textContent!==void 0){let h=e.textContent;if(me(h)){let m=Sn(h.$ref);l.push(`:text-content="${m}"`),vi(n,m,h.$ref),a=!0}else if(B(h)){let m=`_t${s.t}`;s.t+=1,l.push(`:text-content="${m}"`),n.set(m,`() => \`${h}\``),a=!0}}for(let[h,m]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;ht(`inline "${h}" handler`,m);let g=h.slice(2).toLowerCase();if(me(m)){let x=Sn(m.$ref);l.push(`@${g}="${x}"`),a=!0}else if(ue(m)){let x=`_h${s.h}`;s.h+=1,l.push(`@${g}="${x}"`);let{body:w}=m;r.set(x,Array.isArray(w)?{args:["state","e"],body:ke(w,{eventParam:"e",statePrefix:"state"})}:{args:vn(m)?Ue(m):["state","event"],body:w}),a=!0}else if(Ce(m)){let x=`_h${s.h}`;s.h+=1,l.push(`@${g}="${x}"`);let w=Je(m.$expression,{eventParam:"e",statePrefix:"state"});r.set(x,{args:["state","e"],body:w}),a=!0}}if(E(e.style))for(let[h,m]of Object.entries(e.style)){if(h.startsWith(":")||h.startsWith(".")||h.startsWith("&")||h.startsWith("[")||h.startsWith("@"))continue;if(Eu(m))continue;if(B(m)){let g=`_s${s.s}`;s.s+=1,l.push(`:style.${Oe(h)}="${g}"`),n.set(g,`() => \`${m}\``),a=!0}}if(E(e.attributes))for(let[h,m]of Object.entries(e.attributes)){let g=h==="class"?xt(e):void 0;if(g!==void 0&&(me(m)||B(m))){let x=`_t${s.t}`;s.t+=1;let w=me(m)?Cs(m.$ref):`\`${m}\``;l.push(`:attr.class="${x}"`),n.set(x,`() => [${w}, ${JSON.stringify(g)}].filter((c) => c != null && c !== "").join(" ")`),a=!0;continue}if(me(m)){let x=Sn(m.$ref);l.push(`:attr.${h}="${x}"`),vi(n,x,m.$ref),a=!0}else if(B(m)){let x=`_t${s.t}`;s.t+=1,l.push(`:attr.${h}="${x}"`),n.set(x,`() => \`${m}\``),a=!0}}for(let[h,m]of Object.entries(e)){if(mt.has(h)||h.startsWith("on")||h.startsWith("$")||h==="tagName"||h==="id"||h==="className"||h==="style"||h==="children"||h==="textContent"||h==="innerHTML"||h==="attributes")continue;if(me(m)){let g=Sn(m.$ref);l.push(`:${Oe(h)}="${g}"`),vi(n,g,m.$ref),a=!0}else if(B(m)){let g=`_t${s.t}`;s.t+=1,l.push(`:${Oe(h)}="${g}"`),n.set(g,`() => \`${m}\``),a=!0}}let c=Ct(e,o.scope),u=a?" data-bind":"",p=l.length>0?` ${l.join(" ")}`:"",d="",f=e;if(f.$switch){s.needsLit=!0;let h=`_sw${s.sw}`;s.sw+=1;let m=me(f.$switch)?Cs(f.$switch.$ref):`\`${String(f.$switch)}\``,g=f.cases??{},x=Object.entries(g).filter(([,O])=>O&&!me(O)).map(([O,A])=>`${JSON.stringify(O)}: html\`${Oi(A,o.preformatted)}\``);n.set(h,`() => ({${x.join(", ")}})[String(${m})] ?? html\`\``),l.push(`:render="${h}"`);let w=` ${l.join(" ")}`;return`<${i}${c} data-bind${w}></${i}>`}if(f.textContent!==void 0&&!a){let h=U(f.textContent,o.scope);d=h==null?"":L(String(h))}else if(f.textContent!==void 0&&a){let h=U(f.textContent,o.scope);d=h==null?"":L(String(h))}else if(f.innerHTML){let h=U(f.innerHTML,o.scope);d=h==null?f.innerHTML:String(h)}else if(le(f.children)){s.needsLit=!0;let h=`_list${s.l}`;s.l+=1;let m=f.children,g=me(m.items)?Cs(m.items.$ref):JSON.stringify(m.items),x=Ai(m.map);n.set(h,`() => (${g} ?? []).map((item, index) => html\`${x}\`)`),l.push(`:render="${h}"`),a=!0;let w=" data-bind",O=` ${l.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${w}${O}>`;return`<${i}${c}${w}${O}></${i}>`}else if(Array.isArray(f.children)&&f.children.some((h)=>le(h))){s.needsLit=!0;let h=`_children${s.l}`;s.l+=1;let m=f.children.map((x)=>Oi(x,o.preformatted)).join(In(o.preformatted," "));n.set(h,o.preformatted?`() => html\`${m}\``:`() => html\`
178
+ ${m}
179
+ \``),l.push(`:render="${h}"`),a=!0;let g=` ${l.join(" ")}`;return`<${i}${c} data-bind${g}></${i}>`}else if(Array.isArray(f.children)){if(Sg.has(i)&&f.children.some((h)=>B(h)))throw Error(`A template text child of <${i}> cannot be bound: HTML reads its content as text. Write it as the element's textContent.`);d=f.children.map((h)=>Su(h,o,n,r,s)).join(In(o.preformatted))}if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${u}${p}>`;return`<${i}${c}${u}${p}>${d}</${i}>`}function Ai(e,t=!1){if(!e)return"";if(qe(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${En(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||yt.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=Fn(e);if(o){let c=Vn(e),u="";if(me(c))u=`\${${bu(c.$ref)} ?? ""}`;else if(b(c))u=It(c);else if(ne(c))u=String(c);let p=[u,xt(e)??""].filter((d)=>d!=="").join(" ");s+=` class="${p}"`}if(E(e.$props))for(let[c,u]of Object.entries(e.$props))if(me(u))s+=` .${c}="\${${bu(u.$ref)}}"`;else if(B(u))s+=` .${c}="${It(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`;if(E(e.attributes))for(let[c,u]of Object.entries(e.attributes)){if(o&&c==="class")continue;if(B(u)){s+=` ${c}="${It(u)}"`;continue}if(be(u)){let p=gt(c,u);if(p!==null)s+=p===""?` ${c}`:` ${c}="${L(p)}"`;continue}s+=` ${c}="${L(String(u))}"`}if(E(e.style)){let c=[];for(let[u,p]of Object.entries(e.style)){if(u.startsWith(":")||u.startsWith(".")||u.startsWith("&")||u.startsWith("[")||u.startsWith("@"))continue;if(Eu(p))continue;if(B(String(p)))c.push(`${Oe(u)}: ${It(String(p))}`)}if(c.length>0)s+=` style="${c.join("; ")}"`}for(let[c,u]of Object.entries(e)){if(!c.startsWith("on")||c==="observedAttributes")continue;ht(`inline "${c}" handler`,u);let p=c.slice(2).toLowerCase();if(me(u)){let d=Sn(u.$ref);s+=` @${p}=\${(e) => { state.$map = { item, index }; on.${d}(e); }}`}else if(Be(u)){let d=ke(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${p}=\${(e) => { state.$map = { item, index }; ${d} }}`}else if(ue(u)){let d=wg(u.body),f=vn(u)?`((${Ue(u).join(", ")}) => { ${d}
180
+ })(state, e);`:`${d}
181
+ `;s+=` @${p}=\${(e) => { state.$map = { item, index }; ${f}}}`}else if(E(u)&&"$expression"in u){let d=Je(u.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${p}=\${(e) => { state.$map = { item, index }; ${d}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=n.includes("-")?Qt:"",l="";if(e.textContent!==void 0){let c=String(e.textContent);if(B(c))l=`${It(c)}${i}`;else if(me(e.textContent))l=`\${state.${Sn(e.textContent.$ref)}}${i}`;else l=L(c)}else if(e.innerHTML)l=It(String(e.innerHTML));else if(le(e.children))l=`
182
+ ${wu(e.children)}${i}
183
+ `;else if(Array.isArray(e.children)){let c=e.children.map((u)=>{let p=Oi(u,r);return le(u)||b(u)&&B(u)?`${p}${i}`:p});l=r?c.join(""):`
184
+ ${c.join(`
189
185
  `)}
190
- `}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${i}</${n}>`}function ti(e,t=!1){if(y(e))return V(e)?Pt(e):D(e);if(le(e)||Se(e))return D(String(e));if(se(e))return dc(e);return si(e,t)}function dc(e){let{items:t}=e,n=we(t)?ni(t.$ref):JSON.stringify(t??[]),r=si(e.map);return`\${(${n} ?? []).map((item, index) => html\`${r}\`)}`}function Pt(e){return e.replaceAll("$map.","")}function Lp(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function Fp(e,t,n,r,s,o,i,l,a,c){let u=[],{needsLit:f}=l,p=t.length>0;u.push("// Generated by @jxsuite/compiler — do not edit manually");let d=["reactive","effect"];if(p)d.push("computed");if(u.push(`import { ${d.join(", ")} } from '@vue/reactivity';`),f)u.push("import { html, render } from 'lit-html';");let h=wr(i,c);if(u.push(...h.imports,...h.loaders,"",Or()),o.length>0)u.push("",Nr());u.push("","const state = reactive({");for(let[m,g]of e)u.push(` ${Qe(m)}: ${JSON.stringify(g)},`);if(u.push("});",""),s.length>0){for(let m of s)u.push(m);u.push("")}if(t.length>0){for(let[m,g]of t)u.push(`${F("state",he(m))} = computed(${g});`);u.push("")}if(o.length>0){for(let m of o)u.push(m);u.push("")}if(n.length>0){u.push("const bind = {");for(let[m,g]of n)u.push(` ${Qe(m)}: ${g},`);u.push("};")}else u.push("const bind = {};");if(u.push(""),r.length>0){u.push("const on = {");for(let[m,g]of r)u.push(` ${Qe(m)}: (e) => { const fn = (${g.args.join(", ")}) => { ${g.body}
191
- }; fn(state, e); },`);u.push("};")}else u.push("const on = {};");if(u.push("","function hydrate(root) {"," root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),f)u.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else u.push(" if (parts[0] === 'style' && parts.length > 1) {");return u.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Kt}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });","}","","hydrate(document);",""),u.join(`
192
- `)}function Vp(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(`
193
- `)}function Wp(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(`
194
- `)}function mc(e){return e===null||E(e)}function Bp(e){if(e.startsWith("$map/")){let[t,...n]=Be(e.slice(5));return F(t??"",n.map((r)=>he(r)).join("/"))}if(e.startsWith("#/state/"))return F("state",e.slice(8));return F("state",e)}function ni(e){return ki("state",e.startsWith("#/state/")?e.slice(8):e)}function xn(e){return Ii(e.startsWith("#/state/")?e.slice(8):e)}function ei(e,t,n){if(e.has(t))return;e.set(t,`() => ${F("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var oi=N(()=>{bn();An();Xt();W();Dt()});function Hp(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function gc(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,Hp(s,e)])));return`
186
+ `}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${l}</${n}>`}function Oi(e,t=!1){if(b(e))return B(e)?It(e):L(e);if(ne(e)||be(e))return L(String(e));if(le(e))return wu(e);return Ai(e,t)}function wu(e){let{items:t}=e,n=me(t)?Cs(t.$ref):JSON.stringify(t??[]),r=Ai(e.map);return`\${(${n} ?? []).map((item, index) => html\`${r}\`)}`}function It(e){return e.replaceAll("$map.","")}function wg(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function Eg(e,t,n,r,s,o,i,l,a,c,u){let p=[],{needsLit:d,textParts:f}=l,y=t.length>0;p.push("// Generated by @jxsuite/compiler — do not edit manually");let h=["reactive","effect"];if(y)h.push("computed");if(p.push(`import { ${h.join(", ")} } from '@vue/reactivity';`),d)p.push("import { html, render } from 'lit-html';");let m=Rr(i,c);if(p.push(...m.imports,...u.imports,...m.loaders,"",_r()),o.length>0)p.push("",Mr());let g=u.entries.length>0;if(g)p.push("",Ir(),"const _jxInstances = new Map();");p.push("","const state = reactive({");for(let[x,w]of e)p.push(` ${st(x)}: ${JSON.stringify(w)},`);if(p.push("});",""),s.length>0){for(let x of s)p.push(x);p.push("")}if(t.length>0){for(let[x,w]of t)p.push(`${W("state",Se(x))} = computed(${w});`);p.push("")}if(o.length>0){for(let x of o)p.push(x);p.push("")}if(n.length>0){p.push("const bind = {");for(let[x,w]of n)p.push(` ${st(x)}: ${w},`);p.push("};")}else p.push("const bind = {};");if(p.push(""),r.length>0){p.push("const on = {");for(let[x,w]of r)p.push(` ${st(x)}: (e) => { const fn = (${w.args.join(", ")}) => { ${w.body}
187
+ }; fn(state, e); },`);p.push("};")}else p.push("const on = {};");if(p.push("","function hydrate(root) {"),f)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;"),d)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 = ${Xt}(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]);"," }"," });"," });"),f)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("}",""),g)p.push(`await ${Fr(u.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return p.push("hydrate(document);",""),p.join(`
188
+ `)}function Jg(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(`
189
+ `)}function vg(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(`
190
+ `)}function Eu(e){return e===null||E(e)}function bu(e){if(e.startsWith("$map/")){let[t,...n]=Ke(e.slice(5));return W(t??"",n.map((r)=>Se(r)).join("/"))}if(e.startsWith("#/state/"))return W("state",e.slice(8));return W("state",e)}function Cs(e){return ia("state",e.startsWith("#/state/")?e.slice(8):e)}function Sn(e){return aa(e.startsWith("#/state/")?e.slice(8):e)}function vi(e,t,n){if(e.has(t))return;e.set(t,`() => ${W("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var Sg;var Ci=S(()=>{On();Pn();tn();q();Ft();Sg=new Set(["script","style","textarea","title"])});function Og(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function Ju(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,Og(s,e)])));return`
195
191
  // ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
196
192
  const JX_LOCALES = ${t}
197
193
  const JX_DEFAULT_LOCALE = ${n}
@@ -260,24 +256,24 @@ app.use('/', async (c, next) => {
260
256
  res.headers.set('Content-Language', locale)
261
257
  c.res = res
262
258
  })
263
- `}function Up(e,t="/_jx/server"){return Ls(e,t)}function qp(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,l=Up(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let a=e.map(({exportName:h,src:m})=>`import { ${h} } from '${m}'`).join(`
264
- `),c=zp(r,s),u=e.map(({exportName:h})=>Yp(h,l)).join(`
265
- `),f=n==="cloudflare-workers"||n==="cloudflare-pages"?`
259
+ `}function jg(e,t="/_jx/server"){return so(e,t)}function Ag(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,l=jg(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let a=e.map(({exportName:y,src:h})=>`import { ${y} } from '${h}'`).join(`
260
+ `),c=Cg(r,s),u=e.map(({exportName:y})=>Rg(y,l)).join(`
261
+ `),p=n==="cloudflare-workers"||n==="cloudflare-pages"?`
266
262
  app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
267
263
  `:`
268
- `,p=gc(o),d=e.length===0&&r.length===0?"":Gp(i,l);return`// Generated by @jxsuite/compiler — do not edit manually
264
+ `,d=Ju(o),f=e.length===0&&r.length===0?"":Tg(i,l);return`// Generated by @jxsuite/compiler — do not edit manually
269
265
  import { Hono } from 'hono'
270
266
  ${a}${c.imports}
271
267
 
272
268
  const app = new Hono()
273
- ${p}${d}${c.routes}${u}
274
- ${f}
269
+ ${d}${f}${c.routes}${u}
270
+ ${p}
275
271
  export default app
276
- `}function zp(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 l=JSON.stringify(i.options);s.push(`const jxMount${o} = await ${i.className}.mount({ ...${l}, 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:`
272
+ `}function Cg(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 l=JSON.stringify(i.options);s.push(`const jxMount${o} = await ${i.className}.mount({ ...${l}, 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:`
277
273
  ${r.join(`
278
274
  `)}`,routes:`${s.join(`
279
275
  `)}
280
- `}}function Gp(e,t){let n=Ls(e,Kp);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
276
+ `}}function Tg(e,t){let n=so(e,Ng);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
281
277
  const jxGate = async (c, next) => {
282
278
  const site = c.req.header('sec-fetch-site')
283
279
  const foreign = site !== undefined && site !== 'same-origin' && site !== 'none'
@@ -294,7 +290,7 @@ const jxGate = async (c, next) => {
294
290
  }
295
291
  ${(t===n||t.startsWith(`${n}/`)?[n]:[n,t]).map((o)=>`app.use('${o}/*', jxGate)`).join(`
296
292
  `)}
297
- `}function Yp(e,t){return`
293
+ `}function Rg(e,t){return`
298
294
  app.post('${t}/${e}', async (c) => {
299
295
  if (!/^application\\/([\\w.-]+\\+)?json\\b/i.test(c.req.header('content-type') ?? '')) {
300
296
  return c.json({ ok: false, error: 'Expected an application/json body' }, 415)
@@ -306,14 +302,14 @@ app.post('${t}/${e}', async (c) => {
306
302
  console.error('jx: server function ${e} threw:', e)
307
303
  return c.json({ ok: false, error: 'Server error' }, 500)
308
304
  }
309
- })`}var Kp="/_jx";var hc=N(()=>{Fs()});function yc(e){let t=ji(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=Zp(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,l=Xp(i)?i:void 0,a=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=r!=="Object"?` extends ${r}`:"";c.push(`class ${n}${u} {`);for(let[f,p]of Object.entries(o)){if(p.scope!=="static")continue;let d=p.identifier??f,h=p.access==="private"?"#":"",m=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";c.push(` static ${h}${d} = ${m};`)}for(let[f,p]of Object.entries(o)){if(p.scope==="static")continue;if(p.access!=="private")continue;let d=p.identifier??f;c.push(` #${d};`)}if(Object.keys(o).length>0)c.push("");if(c.push(" constructor(config = {}) {"),l?.superCall||r!=="Object"){let f=l?.superCall?.arguments?l.superCall.arguments.join(", "):"";c.push(` super(${f});`)}for(let[f,p]of Object.entries(o)){if(p.scope==="static")continue;let d=p.identifier??f,h=p.access==="private"?"#":"",m=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";c.push(` this.${h}${d} = config.${d} !== undefined ? config.${d} : ${m};`)}if(l?.body){let f=Array.isArray(l.body)?l.body:[l.body];for(let p of f)c.push(` ${p}`)}c.push(" }");for(let[f,p]of Object.entries(a)){let d=p.identifier??f,h=p.scope==="static",g=p.access==="private"?"#":"",x=h?"static ":"",w=p.returnType?.$ref?.includes("Promise")||ed(p)?"async ":"",O=xc(p.parameters??[]),J=Qp(p.body);if(c.push(""),p.role==="accessor"){if(p.getter)c.push(` ${x}get ${g}${d}() {`,` ${p.getter.body}`," }");if(p.setter){let S=xc(p.setter.parameters??[]);c.push(` ${x}set ${g}${d}(${S}) {`,` ${p.setter.body}`," }")}}else{c.push(` ${x}${w}${g}${d}(${O}) {`);for(let S of J)c.push(` ${S}`);c.push(" }")}}return c.push("}","",`export { ${n} };`,`export default ${n};`,""),c.join(`
310
- `)}function Xp(e){return typeof e==="object"}function Zp(e){if(!e)return"Object";if(y(e))return e;if(e.$ref){let t=e.$ref.match(/([A-Za-z0-9_]+)\.class\.json/);return t?t[1]:"Object"}return"Object"}function xc(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return y(n)?n:"arg"}).join(", ")}function Qp(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function ed(e){return(Array.isArray(e.body)?e.body.join(`
311
- `):e.body??"").includes("await ")}var $c=N(()=>{rr();W()});import{readFileSync as td}from"node:fs";async function nd(e,t={}){let{title:n="Jx App",reactivitySrc:r=Ht,litHtmlSrc:s=Ut,projectStyle:o=null}=t,i;if(y(e)){let a=td(e,"utf8");if(qn(e))i=zn(a,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),f=t.formats?.byExtension(u,"parse");if(!f){await Promise.resolve().then(() => Xo());throw ls(e,u)}i=await f.parseDocument(a)}}else i=e;if(i=$n(i,y(e)?e:"the document"),pi(i)){await Promise.resolve().then(() => $c());let c=yc(i),u=y(e)?e.replace(/\.class\.json$/,".js"):`${i.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!Sr(i))return cc(i,{litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...Sc(t),title:n});if(i.tagName&&i.tagName.includes("-")){let{tagName:a}=i,c=Ar(a),f={content:Zn(i,c,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${a}.js`,tagName:a},p=Yt(i,i.$media??{},o),d=`<!DOCTYPE html>
305
+ })`}var Ng="/_jx";var vu=S(()=>{oo()});function ju(e){let t=Qi(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=kg(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,l=Pg(i)?i:void 0,a=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=_g(t.extends);if(u!==null)c.push(u,"");let p=r!=="Object"?` extends ${r}`:"";c.push(`class ${n}${p} {`);for(let[d,f]of Object.entries(o)){if(f.scope!=="static")continue;let y=f.identifier??d,h=f.access==="private"?"#":"",m=f.initializer!==void 0?JSON.stringify(f.initializer):f.default!==void 0?JSON.stringify(f.default):"null";c.push(` static ${h}${y} = ${m};`)}for(let[d,f]of Object.entries(o)){if(f.scope==="static")continue;if(f.access!=="private")continue;let y=f.identifier??d;c.push(` #${y};`)}if(Object.keys(o).length>0)c.push("");if(c.push(" constructor(config = {}) {"),l?.superCall||r!=="Object"){let d=l?.superCall?.arguments?l.superCall.arguments.join(", "):"";c.push(` super(${d});`)}for(let[d,f]of Object.entries(o)){if(f.scope==="static")continue;let y=f.identifier??d,h=f.access==="private"?"#":"",m=f.initializer!==void 0?JSON.stringify(f.initializer):f.default!==void 0?JSON.stringify(f.default):"null";c.push(` this.${h}${y} = config.${y} !== undefined ? config.${y} : ${m};`)}if(l?.body){let d=Array.isArray(l.body)?l.body:[l.body];for(let f of d)c.push(` ${f}`)}c.push(" }");for(let[d,f]of Object.entries(a)){let y=f.identifier??d,h=f.scope==="static",g=f.access==="private"?"#":"",x=h?"static ":"",w=f.returnType?.$ref?.includes("Promise")||Mg(f)?"async ":"",O=Ou(f.parameters??[]),A=Dg(f.body);if(c.push(""),f.role==="accessor"){if(f.getter)c.push(` ${x}get ${g}${y}() {`,` ${f.getter.body}`," }");if(f.setter){let T=Ou(f.setter.parameters??[])||"v";c.push(` ${x}set ${g}${y}(${T}) {`,` ${f.setter.body}`," }")}}else{c.push(` ${x}${w}${g}${y}(${O}) {`);for(let T of A)c.push(` ${T}`);c.push(" }")}}return c.push("}","",`export { ${n} };`,`export default ${n};`,""),c.join(`
306
+ `)}function Pg(e){return typeof e==="object"}function kg(e){if(!e)return"Object";if(b(e))return e;if(e.$ref){let t=e.$ref.match(Au);return t?t[1]:"Object"}return"Object"}function _g(e){if(!e||b(e)||!e.$ref)return null;let t=e.$ref.match(Au);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 Ou(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return b(n)?n:"arg"}).join(", ")}function Dg(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function Mg(e){return(Array.isArray(e.body)?e.body.join(`
307
+ `):e.body??"").includes("await ")}var Au;var Cu=S(()=>{fr();q();Au=/([A-Za-z0-9_]+)\.class\.json/});import{readFileSync as Ig}from"node:fs";async function Lg(e,t={}){let{title:n="Jx App",reactivitySrc:r=zt,litHtmlSrc:s=Kt,projectStyle:o=null}=t,i;if(b(e)){let a=Ig(e,"utf8");if(nr(e))i=rr(a,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),p=t.formats?.byExtension(u,"parse");if(!p){await Promise.resolve().then(() => Si());throw Js(e,u)}i=await p.parseDocument(a)}}else i=e;if(i=Jn(i,b(e)?e:"the document"),Mi(i)){await Promise.resolve().then(() => Cu());let c=ju(i),u=b(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!Nr(i)){let a={projectStyle:o,title:n};if(t.prePaintScheme===!1)a.prePaintScheme=!1;return yu(i,a)}if(i.tagName&&i.tagName.includes("-")){let{tagName:a}=i,c=Wr(a),p={content:wi(i,c,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass),path:`${a}.js`,tagName:a},d=en(i,i.$media??{},o),f=`<!DOCTYPE html>
312
308
  <html lang="en">
313
309
  <head>
314
310
  <meta charset="utf-8">
315
311
  <meta name="viewport" content="width=device-width, initial-scale=1">
316
- <title>${D(n)}</title>
312
+ <title>${L(n)}</title>
317
313
  <script type="importmap">
318
314
  {
319
315
  "imports": {
@@ -322,10 +318,10 @@ app.post('${t}/${e}', async (c) => {
322
318
  }
323
319
  }
324
320
  </script>
325
- ${p}
321
+ ${d}
326
322
  </head>
327
323
  <body>
328
324
  <${a}></${a}>
329
325
  <script type="module" src="./${a}.js"></script>
330
326
  </body>
331
- </html>`;return{files:[f],html:d}}let l={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...Sc(t),title:n};if(t.serverBaseUrl!==void 0)l.serverBaseUrl=t.serverBaseUrl;return ri(i,l)}function Sc(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function _y(e,t){let n=await nd(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 l=o(t);for(let a of n.files){let c=i(l,a.path);s(o(c),{recursive:!0}),r(c,a.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(n.html)}var rd=N(()=>{rr();Xt();ps();fc();oi();W();os();Xt();hc();ps();oi()});rd();export{nd as compile,ri as compileClient,rc as compileElement,kp as compileElementPage,qp as compileSiteServer,Sr as isDynamic,_y as runCli};
327
+ </html>`;return{files:[p],html:f}}let l={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...Fg(t),title:n};if(t.serverBaseUrl!==void 0)l.serverBaseUrl=t.serverBaseUrl;if(t.resolveClass!==void 0)l.resolveClass=t.resolveClass;return ji(i,l)}function Fg(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function bw(e,t){let n=await Lg(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 l=o(t);for(let a of n.files){let c=i(l,a.path);s(o(c),{recursive:!0}),r(c,a.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(n.html)}var Vg=S(()=>{fr();tn();Ji();$u();Ci();q();bs();tn();vu();Ji();Ci()});Vg();export{Lg as compile,ji as compileClient,uu as compileElement,yg as compileElementPage,Ag as compileSiteServer,Nr as isDynamic,bw as runCli};