solely 0.1.2 → 0.1.4

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.
@@ -1,12 +1,12 @@
1
- (function(f,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(f=typeof globalThis<"u"?globalThis:f||self,S(f.solely={}))})(this,function(f){"use strict";var nn=Object.defineProperty;var ue=f=>{throw TypeError(f)};var sn=(f,S,_)=>S in f?nn(f,S,{enumerable:!0,configurable:!0,writable:!0,value:_}):f[S]=_;var L=(f,S,_)=>sn(f,typeof S!="symbol"?S+"":S,_),Ot=(f,S,_)=>S.has(f)||ue("Cannot "+_);var A=(f,S,_)=>(Ot(f,S,"read from private field"),_?_.call(f):S.get(f)),W=(f,S,_)=>S.has(f)?ue("Cannot add the same private member more than once"):S instanceof WeakSet?S.add(f):S.set(f,_),D=(f,S,_,$t)=>(Ot(f,S,"write to private field"),$t?$t.call(f,_):S.set(f,_),_),T=(f,S,_)=>(Ot(f,S,"access private method"),_);var G,X,tt,ot,et,Y,nt,st,H,at,ct,Z,C,he,Nt,fe,_t,Tt,Et,de,pe,Wt,It;const j={dark:{gutter:"#858585",errorLineBg:"#3c1e1e",errorLineFg:"#f8f8f2",arrow:"#ff6b6b",badgeBg:"#ff6b6b",badgeFg:"#ffffff",exprLabel:"#a0a0a0",exprCode:"#5ddcff"}}.dark;function ht(n){let t=0;for(let e=0;e<n.length;){const s=n.codePointAt(e);if(n[e]===" "){t+=4,e++;continue}s>=9472&&s<=9599||s>255?t+=2:t+=1,e+=s>65535?2:1}return t}function Dt(n,t){return(t?"~":"^").repeat(Math.max(1,n))}function Ft(n,t="",e,s="component"){var P;const r=(n==null?void 0:n.message)??String(n),i=`%cTemplate Error%c in <${s}> → ${r}`,o=[`color:${j.badgeFg};background:${j.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,`color:${j.arrow};font-weight:bold;`];if(!t||!(e!=null&&e.loc)||e.loc.length<2){console.error(i,...o),e!=null&&e.expr&&console.log(`Expression: ${e.expr.trim()}`);return}const c=e.loc;let a=c[0]||0,l=c[1]||0;a|=0,l|=0,a<1&&(a=1),l<1&&(l=1);const u=t.split(`
2
- `);if(a>u.length){console.error(`[Template Error] 行号 ${a} 超出范围`);return}const h=a-1,y=Math.max(0,h-3),E=Math.min(u.length-1,h+3),g=String(E+1).length,p=((P=e.expr)==null?void 0:P.trim())??"",I=p?p.split(`
3
- `):[],w=p?Math.max(...I.map(ht)):0,k=I.length>1,R=`color:${j.gutter};`,M=`color:${j.arrow};font-weight:bold;`,d=`color:${j.gutter};`,v=`color:${j.errorLineFg};background:${j.errorLineBg};padding:0 4px;`,$=`color:${j.gutter};`,b=`color:${j.arrow};font-weight:bold;padding:0 4px;`;console.groupCollapsed(`${i} %c(Line:${a}, Col:${l})`,...o,`color:${j.gutter};font-weight:normal;`);for(let x=y;x<=E;x++){const O=u[x],N=String(x+1).padStart(g," ");if(!(x===h)){console.log(`%c${N} │%c ${O}`,R,d);continue}const K=O.slice(0,Math.max(0,l-1)),B=ht(K),wt=" ".repeat(g+3),Xe=N.padEnd(g," ");if(console.log(`%c${Xe} │%c ${O}`,M,v),k)for(let z=0;z<I.length;z++){const Mt=I[z],lt=h+z;let Pt=0;if(z===0)Pt=B;else if(lt<u.length){const ut=u[lt],vt=ut.search(/\S/),en=vt===-1?ut:ut.slice(0,vt);Pt=ht(en)}const tn=Math.max(1,ht(Mt)),ce=Dt(tn,!0),le=wt+" ".repeat(Pt);if(z===0)console.log(`%c${le}%c${ce}`,$,b);else if(lt<u.length){const ut=String(lt+1).padEnd(g," "),vt=u[lt];console.log(`%c${ut} │%c ${vt}`,M,v),console.log(`%c${le}%c${ce}`,$,b)}}else{const z=wt+" ".repeat(B),Mt=Dt(w||1,!1);console.log(`%c${z}%c${Mt}`,$,b)}}p&&console.log(`%cExpression:%c ${p}`,`color:${j.exprLabel};font-weight:bold;`,`color:${j.exprCode};font-family:monospace;`),console.groupEnd()}const xt={};function jt(n){const t=n.map(e=>e.replace(/[',"]/g,"")).join(",");if(!xt[t]){const e=n[n.length-1];if(e.trim()==="")throw new Error("Function body cannot be empty");if(ye(e))throw new Error("Input contains potentially dangerous code: "+e);xt[t]=new Function(...n)}return xt[t]}const me=["eval","Function","process","require"];function ye(n){return me.some(t=>new RegExp(`\\b${t}\\b`,"g").test(n))}function ge(n,t){if(!(n!=null&&n.trim()))return"";if(/\{\{\{\s*.*?\s*\}\}\}/.test(n))throw new Error("Illegal interpolation syntax: use {{ }} instead of {{{ }}}");return t==="template"?n.replace(/\{\{\s*(.*?)\s*\}\}/g,(e,s)=>`\${${s.trim()}}`):n}function be(n,t){const e=s=>s.endsWith(";")?s:s+";";switch(t){case"template":return`return \`${n}\`;`;case"expression":return`return (${n});`;case"handler":case"lifecycle":return e(n)}}function we(n){if(!n.length)return{loopValues:"",loopIndices:""};const t=n.map(s=>s.item).join(", "),e=n.map(s=>s.index).join(", ");return{loopValues:`var [${t}] = loops.map(l => l.itmVal);`,loopIndices:`var [${e}] = loops.map(l => l.idxVal);`}}function ve(n,t,e,s){const r=n==="lifecycle"?["el","loops"]:n==="handler"?["event","loops"]:["loops"],o=`
1
+ (function(f,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(f=typeof globalThis<"u"?globalThis:f||self,k(f.solely={}))})(this,function(f){"use strict";var tn=Object.defineProperty;var ae=f=>{throw TypeError(f)};var en=(f,k,_)=>k in f?tn(f,k,{enumerable:!0,configurable:!0,writable:!0,value:_}):f[k]=_;var A=(f,k,_)=>en(f,typeof k!="symbol"?k+"":k,_),Pt=(f,k,_)=>k.has(f)||ae("Cannot "+_);var N=(f,k,_)=>(Pt(f,k,"read from private field"),_?_.call(f):k.get(f)),j=(f,k,_)=>k.has(f)?ae("Cannot add the same private member more than once"):k instanceof WeakSet?k.add(f):k.set(f,_),T=(f,k,_,bt)=>(Pt(f,k,"write to private field"),bt?bt.call(f,_):k.set(f,_),_),W=(f,k,_)=>(Pt(f,k,"access private method"),_);var q,J,X,rt,Q,U,tt,et,H,it,C,ce,Ot,le,ue,Nt,gt,he,fe,_t,Lt;const V={dark:{gutter:"#858585",errorLineBg:"#3c1e1e",errorLineFg:"#f8f8f2",arrow:"#ff6b6b",badgeBg:"#ff6b6b",badgeFg:"#ffffff",exprLabel:"#a0a0a0",exprCode:"#5ddcff"}}.dark;function ct(s){let t=0;for(let e=0;e<s.length;){const n=s.codePointAt(e);if(s[e]===" "){t+=4,e++;continue}n>=9472&&n<=9599||n>255?t+=2:t+=1,e+=n>65535?2:1}return t}function Tt(s,t={}){const{lineIndex:e=0,totalLines:n=1}=t,r=Math.max(1,Math.floor(s));return(n<=1||e===0?"^":"~").repeat(r)}function Wt(s,t="",e,n="component"){var M;const r=(s==null?void 0:s.message)??String(s),o=`%cTemplate Error%c in <${n}> → ${r}`,i=[`color:${V.badgeFg};background:${V.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,`color:${V.arrow};font-weight:bold;`];if(!t||!(e!=null&&e.loc)||e.loc.length<2){console.error(o,...i),e!=null&&e.expr&&console.log(`Expression: ${e.expr.trim()}`);return}const c=e.loc;let a=c[0]||0,l=c[1]||0;a|=0,l|=0,a<1&&(a=1),l<1&&(l=1);const u=t.split(`
2
+ `);if(a>u.length){console.error(`[Template Error] 行号 ${a} 超出范围`);return}const h=a-1,p=Math.max(0,h-3),v=Math.min(u.length-1,h+3),g=String(v+1).length,m=((M=e.expr)==null?void 0:M.trim())??"",L=m?m.split(`
3
+ `):[],b=m?Math.max(...L.map(ct)):0,$=L.length>1,R=`color:${V.gutter};`,I=`color:${V.arrow};font-weight:bold;`,d=`color:${V.gutter};`,E=`color:${V.errorLineFg};background:${V.errorLineBg};padding:0 4px;`,S=`color:${V.gutter};`,w=`color:${V.arrow};font-weight:bold;padding:0 4px;`;console.groupCollapsed(`${o} %c(Line:${a}, Col:${l})`,...i,`color:${V.gutter};font-weight:normal;`);for(let x=p;x<=v;x++){const P=u[x],O=String(x+1).padStart(g," ");if(!(x===h)){console.log(`%c${O} │%c ${P}`,R,d);continue}const G=P.slice(0,Math.max(0,l-1)),B=ct(G),mt=" ".repeat(g+3),Je=O.padEnd(g," ");if(console.log(`%c${Je} │%c ${P}`,I,E),$)for(let K=0;K<L.length;K++){const It=L[K],ot=h+K;let Mt=0;if(K===0)Mt=B;else if(ot<u.length){const at=u[ot],yt=at.search(/\S/),Qe=yt===-1?at:at.slice(0,yt);Mt=ct(Qe)}const Xe=Math.max(1,ct(It.trim())),ie=Tt(Xe,{lineIndex:K,totalLines:L.length}),oe=mt+" ".repeat(Mt);if(K===0)console.log(`%c${oe}%c${ie}`,S,w);else if(ot<u.length){const at=String(ot+1).padEnd(g," "),yt=u[ot];console.log(`%c${at} │%c ${yt}`,I,E),console.log(`%c${oe}%c${ie}`,S,w)}}else{const K=mt+" ".repeat(B),It=Tt(b||1);console.log(`%c${K}%c${It}`,S,w)}}m&&console.log(`%cExpression:%c ${m}`,`color:${V.exprLabel};font-weight:bold;`,`color:${V.exprCode};font-family:monospace;`),console.groupEnd()}const wt={};function Ft(s){const t=s.map(e=>e.replace(/[',"]/g,"")).join(",");if(!wt[t]){const e=s[s.length-1];if(e.trim()==="")throw new Error("Function body cannot be empty");if(pe(e))throw new Error("Input contains potentially dangerous code: "+e);wt[t]=new Function(...s)}return wt[t]}const de=["eval","Function","process","require"];function pe(s){return de.some(t=>new RegExp(`\\b${t}\\b`,"g").test(s))}const me=/\{\{\{\s*[\s\S]*?\s*\}\}\}/,ye=/\{\{\s*([\s\S]*?)\s*\}\}/g;function ge(s,t){if(!(s!=null&&s.trim()))return"";if(me.test(s))throw new Error("Illegal interpolation syntax: use {{ }} instead of {{{ }}}");return t==="template"?s.replace(ye,(e,n)=>`\${${n.trim()}}`):s}function be(s,t){const e=n=>n.endsWith(";")?n:n+";";switch(t){case"template":return`return \`${s}\`;`;case"expression":return`return (${s});`;case"handler":case"lifecycle":return e(s)}}function we(s){if(!s.length)return{loopValues:"",loopIndices:""};const t=s.map(n=>n.item).join(", "),e=s.map(n=>n.index).join(", ");return{loopValues:`var [${t}] = loops.map(l => l.itmVal);`,loopIndices:`var [${e}] = loops.map(l => l.idxVal);`}}function Ee(s,t,e,n){const r=s==="lifecycle"?["el","loops"]:s==="handler"?["event","loops"]:["loops"],i=`
4
4
  const { $data } = this;
5
- ${n==="handler"?"const { value, checked } = event?.target || {};":""}
5
+ ${s==="handler"?"const { value, checked } = event?.target || {};":""}
6
6
  ${e}
7
- ${s}
7
+ ${n}
8
8
  ${t}
9
- `.replace(/^\s+|\s+$/gm,"");return r.push(o),r}function Vt(n,t,e){if(!(n!=null&&n.trim()))return()=>"";const s=ge(n,t),r=be(s,t),{loopValues:i,loopIndices:o}=we(e),c=ve(t,r,i,o);return jt(c)}const Bt=new Set(["onabort","onautocomplete","onautocompleteerror","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragexit","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onwheel","onpause","onplay","onplaying","onprogress","onratechange","onreset","onresize","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onvolumechange","onwaiting"]),U=n=>{if(n===null||typeof n!="object")return!1;const t=Object.prototype.toString.call(n);return!["[object Function]","[object Date]","[object RegExp]","[object Map]","[object Set]","[object WeakMap]","[object WeakSet]"].includes(t)};function Ee(n=window.location){let t;typeof n=="string"?t=new URL(n).hash:t=n.hash;const e=t.split("?");let s=e[0];const r=e[1],i={};return s=s.replace(/^#\/?/,""),r&&r.split("&").forEach(o=>{const[c,a]=o.split("=");c&&a&&(i[decodeURIComponent(c)]=decodeURIComponent(a))}),{path:s.split("/").filter(Boolean),query:i}}var m=(n=>(n[n.Element=0]="Element",n[n.Text=1]="Text",n[n.Comment=2]="Comment",n[n.If=3]="If",n[n.ElseIf=4]="ElseIf",n[n.Else=5]="Else",n[n.For=6]="For",n[n.Conditional=7]="Conditional",n[n.Other=99]="Other",n))(m||{});const Kt={onMounted:"mounted",onUpdated:"updated",onUnmounted:"unmounted"};function qt(n){return Kt[n]??null}function Gt(n){return n==="mounted"||n==="updated"||n==="unmounted"}const St=Symbol.for("solely.irMeta"),J=process.env.NODE_ENV!=="production",$e=/\{\{.*?\}\}/;class xe{constructor(){L(this,"compilers",new Map)}get(t="anonymous"){let e=this.compilers.get(t);return e||(e=new Se,this.compilers.set(t,e)),e}clear(t){var e;if(t)(e=this.compilers.get(t))==null||e.clear(),this.compilers.delete(t);else{for(const s of this.compilers.values())s.clear();this.compilers.clear()}}}const zt=new xe;class Se{constructor(){L(this,"cache",new Map);L(this,"functions",[])}makeCacheKey(t,e,s){if(s.length===0)return`${t}:${e}`;const r=s.map(i=>Object.keys(i).sort().join(",")).join(";");return`${t}:${e}:${r}`}compile(t,e,s){const r=e==null?void 0:e.trim();if(!r)return 0;const i=this.makeCacheKey(t,r,s),o=this.cache.get(i);if(o!==void 0)return o;let c;try{c=Vt(r,t,s)}catch(l){J&&console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`,l),c=()=>""}const a=this.functions.push(c);return this.cache.set(i,a),a}getFunctions(){return this.functions}getStats(){return{total:this.functions.length,cached:this.cache.size}}clear(){this.cache.clear(),this.functions=[]}}function Ut(n){const t=n[0];return t===":"?{isDynamic:!0,type:"expression"}:t==="@"?{isDynamic:!0,type:"handler"}:Gt(n)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function ke(n){return n?$e.test(n):!1}function kt(n,t,e){J&&(n[St]={expr:t??"",loc:e??null})}function Yt(n){if(!n.attrs)return;const t=n.attrs.find(a=>a.key==="s-model");if(!t)return;const e="$data."+t.value.replace("this.","").replace("$data.",""),s=t.loc,r=(n.tag||"").toLowerCase(),i=n.attrs.find(a=>a.key==="type"),o=(i==null?void 0:i.value)??"text";n.attrs=n.attrs.filter(a=>a!==t);const c=(a,l,u)=>{var h;(h=n.attrs)==null||h.push({key:a,value:l,role:u,loc:s})};if(r==="input"){if(o==="checkbox"){const a=n.attrs.find(y=>y.key==="value"),l=a?JSON.stringify(a.value):'"on"',u=`Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;c(":checked",u);const h=`
9
+ `.replace(/^\s+|\s+$/gm,"");return r.push(i),r}function Vt(s,t,e){if(!(s!=null&&s.trim()))return()=>"";const n=ge(s,t),r=be(n,t),{loopValues:o,loopIndices:i}=we(e),c=Ee(t,r,o,i);return Ft(c)}const jt=new Set(["onabort","onautocomplete","onautocompleteerror","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragexit","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onwheel","onpause","onplay","onplaying","onprogress","onratechange","onreset","onresize","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onvolumechange","onwaiting"]),z=s=>{if(s===null||typeof s!="object")return!1;const t=Object.prototype.toString.call(s);return!["[object Function]","[object Date]","[object RegExp]","[object Map]","[object Set]","[object WeakMap]","[object WeakSet]"].includes(t)};function ve(s=window.location){let t;typeof s=="string"?t=new URL(s).hash:t=s.hash;const e=t.split("?");let n=e[0];const r=e[1],o={};return n=n.replace(/^#\/?/,""),r&&r.split("&").forEach(i=>{const[c,a]=i.split("=");c&&a&&(o[decodeURIComponent(c)]=decodeURIComponent(a))}),{path:n.split("/").filter(Boolean),query:o}}var y=(s=>(s[s.Element=0]="Element",s[s.Text=1]="Text",s[s.Comment=2]="Comment",s[s.If=3]="If",s[s.ElseIf=4]="ElseIf",s[s.Else=5]="Else",s[s.For=6]="For",s[s.Conditional=7]="Conditional",s[s.Other=99]="Other",s))(y||{});const Dt={onMounted:"mounted",onUpdated:"updated",onUnmounted:"unmounted"};function Bt(s){return Dt[s]??null}function Gt(s){return s==="mounted"||s==="updated"||s==="unmounted"}const Et=Symbol.for("solely.irMeta"),Y=process.env.NODE_ENV!=="production",$e=/\{\{[\s\S]*?\}\}/;class Se{constructor(){A(this,"compilers",new Map)}get(t="anonymous"){let e=this.compilers.get(t);return e||(e=new xe,this.compilers.set(t,e)),e}clear(t){var e;if(t)(e=this.compilers.get(t))==null||e.clear(),this.compilers.delete(t);else{for(const n of this.compilers.values())n.clear();this.compilers.clear()}}}const qt=new Se;class xe{constructor(){A(this,"cache",new Map);A(this,"functions",[])}makeCacheKey(t,e,n){if(n.length===0)return`${t}:${e}`;const r=n.map(o=>Object.keys(o).sort().join(",")).join(";");return`${t}:${e}:${r}`}compile(t,e,n){const r=e==null?void 0:e.trim();if(!r)return 0;const o=this.makeCacheKey(t,r,n),i=this.cache.get(o);if(i!==void 0)return i;let c;try{c=Vt(r,t,n)}catch(l){Y&&console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`,l),c=()=>""}const a=this.functions.push(c);return this.cache.set(o,a),a}getFunctions(){return this.functions}getStats(){return{total:this.functions.length,cached:this.cache.size}}clear(){this.cache.clear(),this.functions=[]}}function Kt(s){const t=s[0];return t===":"?{isDynamic:!0,type:"expression"}:t==="@"?{isDynamic:!0,type:"handler"}:Gt(s)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function ke(s){return s?$e.test(s):!1}function vt(s,t,e){Y&&(s[Et]={expr:t??"",loc:e??null})}function zt(s){if(!s.attrs)return;const t=s.attrs.find(a=>a.key==="s-model");if(!t)return;const e="$data."+t.value.replace("this.","").replace("$data.",""),n=t.loc,r=(s.tag||"").toLowerCase(),o=s.attrs.find(a=>a.key==="type"),i=(o==null?void 0:o.value)??"text";s.attrs=s.attrs.filter(a=>a!==t);const c=(a,l,u)=>{var h;(h=s.attrs)==null||h.push({key:a,value:l,role:u,loc:n})};if(r==="input"){if(i==="checkbox"){const a=s.attrs.find(p=>p.key==="value"),l=a?JSON.stringify(a.value):'"on"',u=`Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;c(":checked",u);const h=`
10
10
  const _v = ${l};
11
11
  if(Array.isArray(${e})) {
12
12
  const _i = ${e}.indexOf(_v);
@@ -14,13 +14,13 @@
14
14
  else if(!checked && _i > -1) ${e}.splice(_i,1);
15
15
  } else {
16
16
  ${e} = checked;
17
- }`;c("@change",h,"model");return}if(o==="radio"){const a=n.attrs.find(u=>u.key==="value"),l=(a==null?void 0:a.value)??"null";c(":checked",`${e} == ${JSON.stringify(l)}`),c("@change",`if (checked) ${e} = ${JSON.stringify(l)}`,"model");return}c(":value",e),c("@input",`${e} = value`,"model");return}if(r==="textarea"){c(":value",e),c("@input",`${e} = value`,"model");return}if(r==="select"){n.attrs.some(l=>l.key==="multiple")?(c("updated",`
17
+ }`;c("@change",h,"model");return}if(i==="radio"){const a=s.attrs.find(u=>u.key==="value"),l=(a==null?void 0:a.value)??"null";c(":checked",`${e} == ${JSON.stringify(l)}`),c("@change",`if (checked) ${e} = ${JSON.stringify(l)}`,"model");return}c(":value",e),c("@input",`${e} = value`,"model");return}if(r==="textarea"){c(":value",e),c("@input",`${e} = value`,"model");return}if(r==="select"){s.attrs.some(l=>l.key==="multiple")?(c("updated",`
18
18
  const values = Array.isArray(${e}) ? ${e} : ${e} != null ? [${e}] : [];
19
19
  for (const opt of el.options) {
20
20
  opt.selected = values.includes(opt.value);
21
- }`),c("@change",`${e} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")):(c(":value",e),c("@change",`${e} = value`,"model"));return}c(":value",e),c("@input",`${e} = $event`,"model")}function ft(n,t,e,s=null){if(!n.attrs||n.attrs.length===0)return[];const r=[];for(const i of n.attrs){if(s&&s.has(i.key))continue;const{key:o,value:c,role:a}=i,{isDynamic:l,type:u}=Ut(o);if(l&&u){const h=e.compile(u,c??"",t),y={key:o,fid:h,dynamic:1,role:a};kt(y,c,i.loc??n.loc),r.push(y)}else r.push({key:o,value:c,dynamic:0,role:a})}return r}function Ce(n,t,e){var i,o,c,a,l,u;const s={type:n.type,dynamic:0};let r=!1;switch(n.type===m.Text?ke(n.content)&&(r=!0):((i=n.attrs)!=null&&i.some(h=>h.key==="s-model"||Ut(h.key).isDynamic)&&(r=!0),n.type===m.For&&(r=!0)),s.dynamic=r?1:0,n.type){case m.Text:{const h=n.content??"";r?(s.fid=e.compile("template",h,t),kt(s,h,n.loc)):s.txt=h;break}case m.Element:{s.tag=n.tag,Yt(n),s.attrs=ft(n,t,e),n.children&&(s.children=rt(n.children,t,e));break}case m.For:{const h=(o=n.attrs)==null?void 0:o.find(p=>p.key==="each"),y=(h==null?void 0:h.value)??"";s.fid=e.compile("expression",y,t),s.item=((a=(c=n.attrs)==null?void 0:c.find(p=>p.key==="item"))==null?void 0:a.value)??"item",s.index=((u=(l=n.attrs)==null?void 0:l.find(p=>p.key==="index"))==null?void 0:u.value)??"index",kt(s,y,(h==null?void 0:h.loc)??n.loc);const E=new Set(["each","item","index"]);s.attrs=ft(n,t,e,E);const g=[...t,{item:s.item,index:s.index}];n.children&&(s.children=rt(n.children,g,e));break}case m.If:case m.ElseIf:case m.Else:{J&&console.warn(`[IR] Orphaned conditional node found: ${m[n.type]}`),s.attrs=ft(n,t,e),n.children&&(s.children=rt(n.children,t,e));break}case m.Comment:{s.txt=n.content??"";break}}return s}function rt(n,t,e){var i;const s=[];let r=0;for(;r<n.length;){const o=n[r];if(o.type===m.If){const c=[];let a=r;for(;a<n.length;){const l=n[a],u=l.type;if(u!==m.If&&u!==m.ElseIf&&u!==m.Else)break;let h=null,y="";if(u!==m.Else){const I=(i=l.attrs)==null?void 0:i.find(w=>w.key==="test"||w.key==="condition");y=(I==null?void 0:I.value)??"false",h=e.compile("expression",y,t)}const E=l.children?rt(l.children,t,e):[],p=ft(l,t,e,new Set(["test","condition"]));if(c.push({condFid:h,children:E,attrs:p.length>0?p:void 0,[St]:J?{expr:y,loc:l.loc}:void 0}),a++,u===m.Else)break}s.push({type:m.Conditional,dynamic:1,branches:c,...J&&{[St]:{loc:o.loc}}}),r=a}else s.push(Ce(o,t,e)),r++}return s}function Ht(n,t={}){const{filename:e="anonymous",source:s}=t,r=zt.get(e);r.clear();const i=performance.now(),o=rt(n,[],r),c=performance.now(),a=r.getStats(),l=o.filter(h=>h.dynamic===1).length,u={type:"root",version:"1.1.0",functions:r.getFunctions(),nodes:o,stats:{totalFunctions:a.total,cachedFunctions:a.cached,dynamicNodes:l,totalNodes:o.length},metadata:{compiledAt:new Date().toISOString(),astSize:n.length,filename:e,...s&&{source:s}}};return J&&console.log(`[IRBuilder] ${e} | ${(c-i).toFixed(2)}ms | Nodes: ${o.length} | Fns: ${a.total}`),u}function Re(n){zt.clear(n)}const Le=/<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/,Ae=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ie=/\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;function Me(n,t){const e=[];let s;const r=n.replace(/^\s*[^\s"'/>]+/,""),i=n.length-r.length;for(;(s=Ie.exec(r))!==null;){const o=s[1];if(!o)continue;const c=s[2]??s[3]??s[4]??"";let a=o;Bt.has(o)&&(a=a.replace(/^on/,"@")),a!=="s-model"&&(a=a.replace(/^on-/,"@").replace(/^s-/,":")),a=qt(a)||a;const l=s[0],u=l.indexOf("=");let h;if(u===-1)h=l.indexOf(o)+o.length;else{let w=u+1;for(;w<l.length&&/\s/.test(l[w]);)w++;if(l[w]==='"'||l[w]==="'"){let k=w+1;for(;k<l.length&&/\s/.test(l[k]);)k++;h=k}else{let k=w;for(;k<l.length&&/\s/.test(l[k]);)k++;h=k}}let y=s.index+h+i;const g=n.slice(0,y).split(`
22
- `),p=t[0]+g.length-1,I=g.length>1?g[g.length-1].length+1:t[1]+y;e.push({key:a,value:c,loc:[p,I]})}return e}function Pe(n,t){var o;const e=((o=(n.match(Le)||[])[1])==null?void 0:o.toLowerCase())??"",s=Me(n,t);return{type:{for:m.For,if:m.If,elseif:m.ElseIf,else:m.Else}[e]??m.Element,tag:e,loc:t,children:[],attrs:s}}function Oe(n,t){const e=n.length;if(n.startsWith("!--",t)){const o=n.indexOf("-->",t+3);return o===-1?-1:o+2}if(n.startsWith("![CDATA[",t)){const o=n.indexOf("]]>",t+8);return o===-1?-1:o+2}if(n[t]==="!")return n.indexOf(">",t+1);if(n[t]==="?"){const o=n.indexOf("?>",t+1);return o===-1?-1:o+1}let s=!1,r=!1,i=t;for(;i<e;){const o=n[i];if(o==="'"&&!r)s=!s;else if(o==='"'&&!s)r=!r;else if(o===">"&&!s&&!r)return i;i++}return-1}function Zt(n){const t=[];if(!n)return[];const e=[],s=[],r=()=>{var l;return e.length===0?t:(l=e[e.length-1]).children||(l.children=[])};let i=0;const o=n.length,c=[0];for(let l=0;l<o;l++)n[l]===`
23
- `&&c.push(l+1);function a(l){let u=0;for(let h=1;h<c.length&&!(c[h]>l);h++)u=h;return[u+1,l-c[u]+1]}for(;i<o;){const l=n.indexOf("<",i);if(l===-1||l>i){const R=n.substring(i,l===-1?void 0:l),M=R.trim();if(M){const d=R.indexOf(M),v=i+d,$=a(v);r().push({type:m.Text,tag:"text",content:M,loc:$,children:[]})}if(l===-1)break;i=l}const u=Oe(n,i+1);if(u===-1){const R=n.substring(i);R.trim()&&r().push({type:m.Text,tag:"text",content:R.trim(),children:[],loc:a(i)});break}const h=n.substring(i,u+1),y=r(),E=a(i);if(h.startsWith("<!--")){y.push({type:m.Comment,tag:"comment",content:h.slice(4,-3),loc:E,children:[]}),i=u+1;continue}if(h.startsWith("<![CDATA[")){y.push({type:m.Text,tag:"text",content:h.slice(9,-3),loc:E,children:[]}),i=u+1;continue}if(h.startsWith("<!")&&!h.startsWith("<!--")){y.push({type:m.Comment,tag:"comment",content:h.slice(2,-1),loc:E,children:[]}),i=u+1;continue}if(h.startsWith("<?")){y.push({type:m.Comment,tag:"comment",content:h.slice(2,-2),loc:E,children:[]}),i=u+1;continue}if(h.startsWith("</")){const R=s.pop();for(;e.length>0;){if((e[e.length-1].tag||"").toLowerCase()===(R==null?void 0:R.toLowerCase())){e.pop();break}e.pop()}i=u+1;continue}const g=Pe(h,E);y.push(g);const p=g.tag||"",I=p.toLowerCase().startsWith("script"),w=p.toLowerCase().startsWith("style"),k=h.endsWith("/>")||Ae.has(p.toLowerCase());if((I||w)&&!k){const R=`</${p}>`,M=n.toLowerCase().indexOf(R,u+1);if(M!==-1){const d=n.substring(u+1,M);d.length&&g.children.push({type:m.Text,tag:"text",content:d,loc:a(u+1),children:[]}),i=M+R.length;continue}else{const d=n.substring(u+1);d.length&&g.children.push({type:m.Text,tag:"text",content:d,loc:a(u+1),children:[]}),i=o;continue}}!k&&g.type!==m.Text&&g.type!==m.Comment&&(e.push(g),s.push(p)),i=u+1}return t}const dt=Symbol("solely.raw");function Jt(n){const t=n&&n[dt];return t?Jt(t):n}function Ne(n){return!!(n&&n[dt])}const Ct=(n,t,e=new WeakMap)=>{if(n===t)return!0;if(n==null||t==null||typeof n!="object"||typeof t!="object")return n===t;if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;if(e.has(n))return e.get(n)===t;e.set(n,t);for(let r=0;r<n.length;r++)if(!Ct(n[r],t[r],e))return!1;return!0}if(Array.isArray(n)!==Array.isArray(t))return!1;if(e.has(n))return e.get(n)===t;e.set(n,t);const s=Reflect.ownKeys(n);if(s.length!==Reflect.ownKeys(t).length)return!1;for(const r of s)if(!Reflect.has(t,r)||!Ct(n[r],t[r],e))return!1;return!0};function Qt(n,t,e={}){const{throttle:s=0,onBatch:r,immediate:i=!1,deepCompare:o=!1}=e;let c=!0,a=null,l=[],u=0;const h=new WeakMap,y=new WeakMap,E=new WeakMap,g=Array.isArray(e.filter)?e.filter:e.filter?[e.filter]:[],p=d=>{if(g.length===0)return!0;const v=d.map(String).join(".");return g.some($=>{if($==="")return!0;const b=$.replace(/\./g,"\\.").replace(/\*\*/g,"(.+)").replace(/\*/g,"[^.]+").replace(/\[\d+\]/g,"\\[\\d+\\]");return new RegExp(`^${b}$`).test(v)})},I=d=>{const v=[];let $=d;for(;$;){const b=y.get($);if(!b||b.key==null)break;v.unshift(b.key),$=b.parent}return v},w=(d,v)=>{if(!c)return;const $=I(d);if(!p($))return;const b={...v,path:$};s>0?(l.push(b),a||(a=setTimeout(()=>{const P=[...l];l=[],a=null,c&&(r==null||r(P),P.forEach(t))},s))):(r==null||r([b]),t(b))},k=(d,v)=>{const $={};return["push","pop","shift","unshift","splice"].forEach(b=>{$[b]=function(...P){u++;const x=d[b].apply(d,P);if(u--,b==="push")w(v,{type:"array-push",index:d.length-P.length,values:P});else if(b==="unshift")w(v,{type:"array-push",index:0,values:P});else if(b==="pop")w(v,{type:"array-splice",index:d.length,deleteCount:1,insert:[]});else if(b==="shift")w(v,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if(b==="splice"){const[O,N,...F]=P;w(v,{type:"array-splice",index:O,deleteCount:N,insert:F})}return x}}),["sort","reverse","fill","copyWithin"].forEach(b=>{$[b]=function(...P){u++;const x=d[b].apply(d,P);return u--,w(v,{type:"array-reset",method:b}),x}}),["indexOf","lastIndexOf","includes"].forEach(b=>{$[b]=function(P,...x){let O=d[b].apply(d,[P,...x]);return(O===-1||O===!1)&&Ne(P)&&(O=d[b].apply(d,[Jt(P),...x])),O}}),$},R=(d,v,$)=>{if(!Object.isExtensible(d)||d[dt])return d;const b=h.get(d);if(b)return y.set(b,{parent:v,key:$}),b;const P={get(O,N,F){if(N===dt)return O;if(Array.isArray(O)){const B=E.get(x);if(B&&Object.prototype.hasOwnProperty.call(B,N))return Reflect.get(B,N,F)}const K=Reflect.get(O,N,F);return typeof N=="symbol"?K:U(K)?R(K,x,N):K},set(O,N,F,K){const B=O[N];if(o?Ct(B,F):B===F)return!0;const wt=Reflect.set(O,N,F,K);return u===0&&(Array.isArray(B)&&Array.isArray(F)?w(x,{type:"array-replace",oldValue:B,newValue:F}):w(x,{type:"set",key:N,newValue:F,oldValue:B})),wt},deleteProperty(O,N){if(!Reflect.has(O,N))return!1;const F=O[N],K=Reflect.deleteProperty(O,N);return K&&u===0&&w(x,{type:"delete",key:N,oldValue:F}),K}},x=new Proxy(d,P);return h.set(d,x),y.set(x,{parent:v,key:$}),Array.isArray(d)&&E.set(x,k(d,x)),x},M=R(n,null,null);if(i){const d=(v,$,b=new WeakSet)=>{!U(v)||b.has(v)||(b.add(v),Reflect.ownKeys(v).forEach(P=>{const x=v[P];w($,{type:"set",key:P,newValue:x,oldValue:void 0}),U(x)&&d(x,R(x,$,P),b)}))};d(n,M)}return{proxy:M,unobserve:()=>{c=!1,l=[],a&&clearTimeout(a)},resume:()=>{c=!0}}}const Xt=Symbol.for("solely.manifest"),V=class V extends HTMLElement{constructor(e={}){var i;super();W(this,C);W(this,G);W(this,X);W(this,tt);W(this,ot);W(this,et);W(this,Y);W(this,nt,!1);W(this,st,!1);W(this,H,!1);W(this,at,!1);const s=this.constructor;D(this,G,s[Xt]||{tagName:"base-element"});const r=A(this,G);D(this,et,(i=r.shadowDOM)!=null&&i.use?this.attachShadow({mode:r.shadowDOM.mode||"open"}):this),T(this,C,Nt).call(this,e),T(this,C,fe).call(this,r),queueMicrotask(()=>T(this,C,Wt).call(this))}static get observedAttributes(){if(A(V,Z).has(this))return A(V,Z).get(this);const e=this[Xt];if(!(e!=null&&e.props))return A(V,Z).set(this,[]),[];const s=e.props.map(r=>(typeof r=="string"?r:r.name).replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase());return A(V,Z).set(this,s),s}get $data(){return A(this,ot)}set $data(e){var s;U(e)||(e={}),(s=A(this,Y))==null||s.call(this),T(this,C,Nt).call(this,e),T(this,C,Et).call(this)}refresh(){T(this,C,Et).call(this)}connectedCallback(){var i;const e=this.constructor;Array.isArray(e.upgradeProps)&&T(this,C,he).call(this,e.upgradeProps),T(this,C,Wt).call(this);const s=A(this,G);if((s.className||s.tagName||"").split(" ").forEach(o=>o&&this.classList.add(o)),T(this,C,pe).call(this),s.props&&U(this.$data))for(const o of s.props){const c=typeof o=="string"?o:o.name,a=T(this,C,_t).call(this,c),l=c.replace(/-([a-z])/g,(u,h)=>h.toUpperCase());if(this.hasAttribute(c)){const u=this.getAttribute(c),h=T(this,C,Tt).call(this,u,a==null?void 0:a.default,a==null?void 0:a.type);this.$data[l]=h}else a&&"default"in a&&(this.$data[l]=a.default)}A(this,tt)&&D(this,X,ie(A(this,tt),A(this,et),this)),this.mounted(),(i=this.onInit)==null||i.call(this)}disconnectedCallback(){var e;this.unmounted(),(e=A(this,Y))==null||e.call(this),D(this,Y,void 0)}attributeChangedCallback(e,s,r){if(s===r||!U(this.$data))return;const i=T(this,C,_t).call(this,e),o=e.replace(/-([a-z])/g,(l,u)=>u.toUpperCase()),c=this.$data[o],a=T(this,C,Tt).call(this,r,(i==null?void 0:i.default)??c,i==null?void 0:i.type);this.$data[o]=a,D(this,H,!0),this.attributeChanged(e,c,a),this.emit("change",{source:"attribute",name:e,oldValue:c,newValue:a})}emit(e,s,r){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:s,...r}))}onInit(){}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(e,s,r){}beforeAttributesUpdate(){}afterAttributesUpdate(){}};G=new WeakMap,X=new WeakMap,tt=new WeakMap,ot=new WeakMap,et=new WeakMap,Y=new WeakMap,nt=new WeakMap,st=new WeakMap,H=new WeakMap,at=new WeakMap,ct=new WeakMap,Z=new WeakMap,C=new WeakSet,he=function(e){for(const s of e)if(this.hasOwnProperty(s)){const r=this[s];delete this[s],this[s]=r}},Nt=function(e){const{proxy:s,unobserve:r}=Qt(e,i=>{this.emit("change",{source:"state",...i}),T(this,C,Et).call(this)});D(this,ot,s),D(this,Y,r)},fe=function(e){const s=e.template;if(typeof s=="string"){const r=Zt(s);D(this,tt,Ht(r,{source:s,filename:e.tagName}))}},_t=function(e){const s=A(this,G).props;if(!s)return;const r=e.replace(/-([a-z])/g,(o,c)=>c.toUpperCase()),i=s.find(o=>typeof o=="string"?o===r:o.name===r);if(i)return typeof i=="string"?{name:i}:i},Tt=function(e,s,r){if(e===null)return s;switch(r){case"number":{const i=Number(e);return isNaN(i)?s:i}case"boolean":return e!==null&&e!=="false";case"object":try{return JSON.parse(e)}catch{return s}default:return e}},Et=function(){A(this,st)||!A(this,X)||(D(this,st,!0),queueMicrotask(()=>{D(this,st,!1),T(this,C,de).call(this)}))},de=function(){A(this,nt)||!this.isConnected||(D(this,nt,!0),A(this,H)&&this.beforeAttributesUpdate(),this.beforeUpdate(),A(this,X).update(),this.updated(),A(this,H)&&(this.afterAttributesUpdate(),D(this,H,!1)),D(this,nt,!1))},pe=function(){const s=A(this,G).styles;if(!s)return;const r=A(this,et);if("adoptedStyleSheets"in r){if(r._styleInjected)return;let o=A(V,ct).get(s);o||(o=new CSSStyleSheet,o.replaceSync(s),A(V,ct).set(s,o)),r.adoptedStyleSheets=[...r.adoptedStyleSheets,o],r._styleInjected=!0;return}if(r.querySelector("style[data-manifest-style]"))return;const i=document.createElement("style");i.dataset.manifestStyle="true",i.textContent=s,r.appendChild(i)},Wt=function(){A(this,at)||(D(this,at,!0),this.created())},It=new WeakMap,L(V,"upgradeProps"),W(V,ct,new Map),W(V,Z,new WeakMap),W(V,It,!1);let it=V;const _e=Symbol.for("solely.manifest"),Rt=n=>t=>{if(customElements.get(n.tagName))return console.warn(`标签名称 "${n.tagName}" 已经被注册`),t;class e extends t{}return e[_e]=n,customElements.define(n.tagName,e),e},pt=Symbol("solely.isSVG"),mt=Symbol("solely.irCtx"),yt=Symbol("solely.irEvents"),q=Symbol.for("solely.irMeta"),te=Symbol("solely.lastDynamicClass"),ee=Symbol("solely.dynamicStyleLast"),Te={xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},We={readonly:"readOnly",for:"htmlFor",tabindex:"tabIndex",contenteditable:"contentEditable",maxlength:"maxLength"},De=new Set(["data-","aria-","role","form"]),Fe=new Set(["value","selectedIndex"]);function je(n,t){var i;const e=n,s=(i=t.attrs)==null?void 0:i.find(o=>o.key==="class"&&!o.dynamic),r=s?s.value:"";r&&(e[pt]?e.className.baseVal=r:e.className=r)}function Ve(n,t){var r;const e=(r=t.attrs)==null?void 0:r.find(i=>i.key==="style"&&!i.dynamic),s=e?ne(e.value):{};for(const i in s){const o=s[i];i.startsWith("--")?n.style.setProperty(i,o):n.style[i]=o}}const Be=(n,t)=>{const e=n,s=ne(t),r=e[ee]||{};for(const i in r)i in s||(i.startsWith("--")?n.style.removeProperty(i):n.style[i]="");for(const i in s){const o=s[i];i.startsWith("--")?n.style.setProperty(i,o):n.style[i]=o}e[ee]=s},Ke=(n,t)=>{const e=n,s=e[te]||{},r=qe(t);for(const i in s)s[i]&&!r[i]&&(e[pt]?e.className.baseVal=e.className.baseVal.replace(new RegExp(`\\b${i}\\b`,"g"),"").trim():e.classList.remove(i));for(const i in r)if(r[i])if(e[pt]){const o=e.className.baseVal.split(/\s+/);o.includes(i)||(o.push(i),e.className.baseVal=o.join(" "))}else e.classList.add(i);e[te]=r};function ne(n){const t={},e=[[n]];for(;e.length;){const[s,r]=e.pop();if(typeof s=="string"){s.split(";").forEach(i=>{const[o,c]=i.split(":").map(a=>a.trim());o&&c&&(t[o]=c)});continue}if(Array.isArray(s)){s.forEach(i=>e.push([i]));continue}if(s&&typeof s=="object")for(const[i,o]of Object.entries(s)){const c=r?`${r}-${i}`:i;o&&typeof o=="object"&&!Array.isArray(o)?e.push([o,c]):t[c]=String(o??"")}}return t}function qe(n){const t={},e=[n];for(;e.length;){const s=e.pop();if(s){if(typeof s=="string")s.split(/\s+/).forEach(r=>r&&(t[r]=!0));else if(Array.isArray(s))e.push(...s);else if(typeof s=="object")for(const[r,i]of Object.entries(s))t[r]=!!i}}return t}function Ge(n,t,e){const s=t.indexOf(":");if(s>0){const r=t.slice(0,s),i=Te[r];if(i)return n.setAttributeNS(i,t,e)}n.setAttribute(t,e)}function se(n,t,e){if(t.startsWith("data-")||t.startsWith("aria-")||De.has(t)){n.setAttribute(t,e);return}const s=We[t]||t;n[s]=e}class re{constructor(t,e,s={}){L(this,"nodeMap",new Map);L(this,"marker",!1);this.ir=t,this.container=e,this.scope=s}evalIR(t,e,s){var i;const r=this.ir.functions[t-1];try{return r?r.apply(this.scope,e):""}catch(o){return Ft(o.message||o.toString(),((i=this.ir.metadata)==null?void 0:i.source)||"",s,this.scope.tagName),""}}createElement(t,e){const s=t.tag,r=e instanceof SVGElement||s==="svg",i=r?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s);return i[pt]=r,i}createText(t,e){const s=t.dynamic?this.evalIR(t.fid,[e],t[q]):t.txt||"";return document.createTextNode(s)}createComment(t,e){const s=t.dynamic?this.evalIR(t.fid,[e],t[q]):t.txt||"";return document.createComment(s)}applyAttrs(t,e,s,r=!1){const i=[],o=t;o[mt]||(o[mt]={loops:null}),o[mt].loops=s,o[yt]||(o[yt]=Object.create(null));let c,a=!1,l,u=!1;for(const h of e){const{key:y,fid:E,dynamic:g,value:p}=h;if(y===":class"){c=this.evalIR(E,[s]),a=!0;continue}if(y===":style"){l=this.evalIR(E,[s]),u=!0;continue}if(y==="class"||y==="style")continue;const I=y[0];if(I==="@"){const k=y.slice(1),R=h.role??"user";let M=o[yt][k];if(M||(M=o[yt][k]={model:[],user:[]},t.addEventListener(k,d=>{for(const v of M.model)v(d);for(const v of M.user)v(d)})),!r){const d=v=>this.evalIR(E,[v,o[mt].loops],h[q]);M[R].push(d)}continue}if(y==="mounted"){r||requestAnimationFrame(()=>this.evalIR(E,[t,s],h[q]));continue}if(y==="updated"){r&&requestAnimationFrame(()=>this.evalIR(E,[t,s],h[q]));continue}if(y==="ref"&&p){this.scope.$refs=this.scope.$refs||{},this.scope.$refs[p]=t;continue}const w=g?this.evalIR(E,[s],h[q]):p??"";if(I===":"){const k=y.slice(1);t.tagName==="SELECT"&&Fe.has(k)?i.push(()=>se(t,k,w)):se(t,k,w)}else Ge(t,y,String(w))}return(a||!r)&&Ke(t,c),(u||!r)&&Be(t,l),i}updateNode(t,e,s){const r=e.dynamic?this.evalIR(e.fid,[s],e[q]):e.txt||"";e.dynamic&&t.textContent!==r&&(t.textContent=r)}irToNode(t,e,s,r,i){var l,u,h,y;const o=s+"-"+e,c=this.nodeMap.get(o);let a;if(c){a=c.node,c.marker=this.marker;let E=[];t.dynamic&&(t.type===m.Element?E=this.applyAttrs(a,t.attrs??[],i,!0):this.updateNode(a,t,i)),(l=t.children)==null||l.forEach((g,p)=>{this.irToNode(g,p,o,a,i)}),E.forEach(g=>g())}else switch(t.type){case m.Element:a=this.createElement(t,r),je(a,t),Ve(a,t);const E=this.applyAttrs(a,t.attrs??[],i);r.appendChild(a),this.nodeMap.set(o,{irNode:t,node:a,loops:i,marker:this.marker}),(u=t.children)==null||u.forEach((g,p)=>{this.irToNode(g,p,o,a,i)}),E.forEach(g=>g());break;case m.Text:a=this.createText(t,i),r.appendChild(a),this.nodeMap.set(o,{irNode:t,node:a,loops:i,marker:this.marker});break;case m.Comment:a=this.createComment(t,i),r.appendChild(a),this.nodeMap.set(o,{irNode:t,node:a,loops:i,marker:this.marker});break;case m.For:{const g=`${o}-end`;let p=(h=this.nodeMap.get(g))==null?void 0:h.node;p?this.nodeMap.get(g).marker=this.marker:(p=document.createComment(`for:${o}`),r.appendChild(p),this.nodeMap.set(g,{irNode:{type:m.Comment},node:p,loops:i,marker:this.marker}));const I=this.evalIR(t.fid,[i],t[q])||[],w=document.createDocumentFragment();I.forEach((k,R)=>{var d;const M=[...i,{itmVal:k,idxVal:R}];(d=t.children)==null||d.forEach((v,$)=>{this.irToNode(v,$,`${o}-for-${R}`,w,M)})}),p.parentNode.insertBefore(w,p);break}case m.Conditional:{const g=`${o}-end`;let p=(y=this.nodeMap.get(g))==null?void 0:y.node;p?this.nodeMap.get(g).marker=this.marker:(p=document.createComment(`if:${o}`),r.appendChild(p),this.nodeMap.set(g,{irNode:{},node:p,loops:i,marker:this.marker}));for(let I=0;I<(t.branches||[]).length;I++){const w=t.branches[I];if(w.condFid===null||this.evalIR(w.condFid,[i],w[q])){const R=document.createDocumentFragment();w.children.forEach((M,d)=>{this.irToNode(M,d,`${o}-if-${I}`,R,i)}),p.parentNode.insertBefore(R,p);break}}break}}}cleanupOldNodes(){for(const[t,e]of this.nodeMap.entries())if(e.marker!==this.marker){const{irNode:s,node:r,loops:i}=e;if(s.attrs){const o=s.attrs.find(a=>a.key==="unmounted");o&&requestAnimationFrame(()=>{this.evalIR(o.fid,[r,i],o[q])});const c=s.attrs.find(a=>a.key==="ref");c&&c.value&&delete this.scope.$refs[c.value]}r==null||r.remove(),this.nodeMap.delete(t)}}mount(){this.marker=!this.marker,this.ir.nodes.forEach((t,e)=>{this.irToNode(t,e,"root",this.container,[])}),this.cleanupOldNodes()}update(){this.marker=!this.marker,this.ir.nodes.forEach((t,e)=>{this.irToNode(t,e,"root",this.container,[])}),this.cleanupOldNodes()}destroy(){this.container.innerHTML="",this.nodeMap.clear()}}const ie=(n,t,e={})=>{const s=new re(n,t,e);return s.mount(),{update:()=>s.update(),destroy:()=>s.destroy()}};let Q=null,oe;const Lt=new Promise(n=>{oe=n});function ze(n){return Q||(Q=new ae(n),oe(Q),Q)}function gt(){return Q}class ae{constructor(t){L(this,"routes");L(this,"base");L(this,"mode");L(this,"beforeEachGuard");L(this,"afterEachGuard");L(this,"currentRoute",null);L(this,"listeners",new Set);L(this,"isStarted",!1);this.routes=t.routes,this.base=t.base??"/",this.mode=t.mode||"history",this.beforeEachGuard=t.beforeEach,this.afterEachGuard=t.afterEach}matchRoute(t="/"){const e=t.startsWith("/")?t:"/"+t,[s,r]=e.split("?"),i=s.split("/").filter(Boolean),o=this.parseQuery(r),c=this.recursiveMatch(this.routes,i);if(c){const a=c.matched[c.matched.length-1];return a.config.redirect?this.matchRoute(a.config.redirect):{matched:c.matched,params:c.params,query:o,fullPath:e,meta:c.matched.reduce((l,u)=>({...l,...u.config.meta||{}}),{})}}return null}recursiveMatch(t,e){const s=[...t].sort((r,i)=>this.calculateScore(i.path)-this.calculateScore(r.path));for(const r of s){const i=r.path.split("/").filter(Boolean),o={};let c=!0;if(i.length===0&&e.length===0)return{matched:[{config:r,params:{}}],params:{}};for(let a=0;a<i.length;a++){const l=i[a],u=e[a];if(l.startsWith(":")){if(!u){c=!1;break}o[l.slice(1)]=u}else if(l==="*"){c=!0;break}else if(l!==u){c=!1;break}}if(c){const a=i.length,l=e.slice(a),u={config:r,params:o};if(l.length>0&&r.children){const h=this.recursiveMatch(r.children,l);if(h)return{matched:[u,...h.matched],params:{...o,...h.params}}}else if(l.length===0||i.includes("*"))return{matched:[u],params:o}}}return null}calculateScore(t="/"){const e=t.split("/").filter(Boolean);return e.length===0?1:e.reduce((s,r)=>r.startsWith(":")?s+5:r==="*"?s+0:s+10,0)}parseQuery(t){const e={};return t&&new URLSearchParams(t).forEach((r,i)=>{e[i]=r}),e}normalizePath(t="/"){let e=t&&typeof t=="string"?t:"/";return e.startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e}getPath(){let t;try{t=this.mode==="hash"?window.location.hash.slice(1)||"/":window.location.pathname||"/"}catch{t="/"}const e=this.base||"/";return e!=="/"&&t.startsWith(e)&&(t=t.slice(e.length)||"/"),this.normalizePath(t)}updateBrowserHistory(t="/",e){const s=this.normalizePath(t),r=this.base||"/";if(this.mode==="hash")e?window.location.replace(`#${s}`):window.location.hash=s;else{const i=r.endsWith("/")?r.slice(0,-1):r,o=i==="/"?s:i+s;e?window.history.replaceState({path:o},"",o):window.history.pushState({path:o},"",o)}}async navigate(t="/",e=!1,s=!1){const r=this.normalizePath(t),i=this.currentRoute,o=this.matchRoute(r);if(!o)return{success:!1,error:`No route matched: ${r}`};if(i&&i.fullPath===o.fullPath)return{success:!0};if(this.beforeEachGuard)try{const c=await this.beforeEachGuard(o,i);if(c===!1)return{success:!1,cancelled:!0};if(typeof c=="string")return this.navigate(c,e)}catch(c){return{success:!1,error:c instanceof Error?c.message:"Guard Error"}}return this.currentRoute=o,s||this.updateBrowserHistory(r,e),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(o,i),{success:!0}}resolve(t="/"){const e=this.normalizePath(t);if(this.mode==="hash")return`#${e}`;const s=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return s==="/"?e:s+e}get modeType(){return this.mode}pushWithQuery(t="/",e){const s=new URLSearchParams(e).toString(),r=t.includes("?")?"&":"?";return this.push(t+(s?r+s:""))}push(t="/"){return this.navigate(t,!1)}replace(t="/"){return this.navigate(t,!0)}back(){window.history.back()}listen(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notifyListeners(){this.listeners.forEach(t=>t())}setupListeners(){if(this.isStarted)return;const t=()=>{this.navigate(this.getPath(),!0,!0)};window.addEventListener("popstate",t),this.mode==="hash"&&!window.location.hash&&(window.location.hash="/"),this.navigate(this.getPath(),!0)}getCurrentRoute(){return this.currentRoute}}var Ue=Object.getOwnPropertyDescriptor,Ye=(n,t,e,s)=>{for(var r=s>1?void 0:s?Ue(t,e):t,i=n.length-1,o;i>=0;i--)(o=n[i])&&(r=o(r)||r);return r};let bt=class extends it{constructor(){super(...arguments);L(this,"unsubscribe");L(this,"level",0);L(this,"currentElement",null);L(this,"currentTagName",null);L(this,"routerAttrs",new Set);L(this,"prevPropKeys",new Set);L(this,"scheduled",!1);L(this,"cache",new Map);L(this,"latestLoadId",0)}async mounted(){this.detectLevel();const t=await Lt;this.unsubscribe=t.listen(()=>{this.scheduleLoad(t.getCurrentRoute())}),this.loadRoute(t.getCurrentRoute())}unmounted(){var t;(t=this.unsubscribe)==null||t.call(this),this.cache.forEach(e=>e.remove()),this.cache.clear()}scheduleLoad(t){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.loadRoute(t)}))}detectLevel(){let t=0,e=this.parentElement;for(;e;)e instanceof bt&&t++,e=e.parentElement;this.level=t}async loadRoute(t){const e=++this.latestLoadId,s=t==null?void 0:t.matched[this.level];if(!s){this.handleEmptyRoute();return}const{config:r}=s;let i=r.tagName;if(!i&&typeof r.component=="function"){this.renderLoading();try{const c=await r.component();i=typeof c=="string"?c:c.tagName}catch(c){this.renderError(`Load Error: ${c}`);return}}if(e!==this.latestLoadId)return;if(!i){this.clear();return}if(!r.forceReload&&this.currentElement&&this.currentTagName===i.toLowerCase()){this.syncState(this.currentElement,t==null?void 0:t.params,(t==null?void 0:t.query)||{},r.props);return}this.clear(r.keepAlive);const o=this.getOrCreateComponent(i,r);this.syncState(o,t==null?void 0:t.params,(t==null?void 0:t.query)||{},r.props),this.appendChild(o),this.currentElement=o,this.currentTagName=i.toLowerCase()}getOrCreateComponent(t,e){const s=t.toLowerCase();if(e.keepAlive&&this.cache.has(s))return this.cache.get(s);const r=document.createElement(t);return e.keepAlive&&this.cache.set(s,r),r}syncState(t,e,s,r={}){const i=a=>a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=new Map;Object.entries(e).forEach(([a,l])=>o.set(i(a),String(l))),Object.entries(s).forEach(([a,l])=>o.set(`query-${i(a)}`,String(l))),this.routerAttrs.forEach(a=>{o.has(a)||(t.removeAttribute(a),this.routerAttrs.delete(a))}),o.forEach((a,l)=>{t.getAttribute(l)!==a&&t.setAttribute(l,a),this.routerAttrs.add(l)});const c=new Set(Object.keys(r));this.prevPropKeys.forEach(a=>{c.has(a)||(t[a]=void 0)}),Object.entries(r).forEach(([a,l])=>{t[a]!==l&&(t[a]=l)}),this.prevPropKeys=c}handleEmptyRoute(){this.clear(),this.level===0&&this.renderError("404 Not Found")}renderLoading(){this.innerHTML='<div style="padding:20px; color:#999;">Loading...</div>'}renderError(t){this.innerHTML=`<div style="padding:20px; color:#ff4d4f;">${t}</div>`}clear(t=!1){this.currentElement?this.contains(this.currentElement)&&this.removeChild(this.currentElement):t||(this.innerHTML=""),this.currentElement=null,this.currentTagName=null,this.routerAttrs.clear(),this.prevPropKeys.clear()}};bt=Ye([Rt({tagName:"router-view"})],bt);const He=bt;var Ze=Object.getOwnPropertyDescriptor,Je=(n,t,e,s)=>{for(var r=s>1?void 0:s?Ze(t,e):t,i=n.length-1,o;i>=0;i--)(o=n[i])&&(r=o(r)||r);return r};let At=class extends it{constructor(){super(...arguments);L(this,"_prefetched",!1)}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){(await Lt).listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",e=>{var r,i;e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||e.button!==0||(r=e.target.closest("a"))!=null&&r.getAttribute("target")||(e.preventDefault(),(i=gt())==null||i.push(this.$data.to))}),this.addEventListener("mouseenter",()=>{this.prefetchRoute()},{once:!0})}updateState(){const t=gt();if(!t)return;this.$data.href=t.resolve(this.$data.to);let e=!1;if(this.$data.active)e=!0;else{const r=t.getCurrentRoute();if(r){const i=r.fullPath;this.hasAttribute("exact")?e=i===this.$data.to:e=i===this.$data.to||i.startsWith(this.$data.to+"/")}}this.$data.isActive=e;const s=this.$data.activeClass||"active";this.classList.toggle(s,e)}prefetchRoute(){if(this._prefetched||!this.hasAttribute("prefetch"))return;const t=gt();t&&typeof t.prefetch=="function"&&(t.prefetch(this.$data.to),this._prefetched=!0)}};At=Je([Rt({tagName:"router-link",template:`
21
+ }`),c("@change",`${e} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")):(c(":value",e),c("@change",`${e} = value`,"model"));return}c(":value",e),c("@input",`${e} = $event`,"model")}function lt(s,t,e,n=null){if(!s.attrs||s.attrs.length===0)return[];const r=[];for(const o of s.attrs){if(n&&n.has(o.key))continue;const{key:i,value:c,role:a}=o,{isDynamic:l,type:u}=Kt(i);if(l&&u){const h=e.compile(u,c??"",t),p={key:i,fid:h,dynamic:1,role:a};vt(p,c,o.loc??s.loc),r.push(p)}else r.push({key:i,value:c,dynamic:0,role:a})}return r}function Re(s,t,e){var o,i,c,a,l,u;const n={type:s.type,dynamic:0};let r=!1;switch(s.type===y.Text?ke(s.content)&&(r=!0):((o=s.attrs)!=null&&o.some(h=>h.key==="s-model"||Kt(h.key).isDynamic)&&(r=!0),s.type===y.For&&(r=!0)),n.dynamic=r?1:0,s.type){case y.Text:{const h=s.content??"";r?(n.fid=e.compile("template",h,t),vt(n,h,s.loc)):n.txt=h;break}case y.Element:{n.tag=s.tag,zt(s),n.attrs=lt(s,t,e),s.children&&(n.children=nt(s.children,t,e));break}case y.For:{const h=(i=s.attrs)==null?void 0:i.find(m=>m.key==="each"),p=(h==null?void 0:h.value)??"";n.fid=e.compile("expression",p,t),n.item=((a=(c=s.attrs)==null?void 0:c.find(m=>m.key==="item"))==null?void 0:a.value)??"item",n.index=((u=(l=s.attrs)==null?void 0:l.find(m=>m.key==="index"))==null?void 0:u.value)??"index",vt(n,p,(h==null?void 0:h.loc)??s.loc);const v=new Set(["each","item","index"]);n.attrs=lt(s,t,e,v);const g=[...t,{item:n.item,index:n.index}];s.children&&(n.children=nt(s.children,g,e));break}case y.If:case y.ElseIf:case y.Else:{Y&&console.warn(`[IR] Orphaned conditional node found: ${y[s.type]}`),n.attrs=lt(s,t,e),s.children&&(n.children=nt(s.children,t,e));break}case y.Comment:{n.txt=s.content??"";break}}return n}function nt(s,t,e){var o;const n=[];let r=0;for(;r<s.length;){const i=s[r];if(i.type===y.If){const c=[];let a=r;for(;a<s.length;){const l=s[a],u=l.type;if(u!==y.If&&u!==y.ElseIf&&u!==y.Else||u===y.If&&c.length>0)break;let h=null,p="",v=null;if(u!==y.Else){const b=(o=l.attrs)==null?void 0:o.find($=>$.key==="test"||$.key==="condition");p=(b==null?void 0:b.value)??"false",h=e.compile("expression",p,t),v=(b==null?void 0:b.loc)??l.loc}const g=l.children?nt(l.children,t,e):[],L=lt(l,t,e,new Set(["test","condition"]));if(c.push({condFid:h,children:g,attrs:L.length>0?L:void 0,[Et]:Y?{expr:p,loc:v}:void 0}),a++,u===y.Else)break}n.push({type:y.Conditional,dynamic:1,branches:c,...Y&&{[Et]:{loc:i.loc}}}),r=a}else n.push(Re(i,t,e)),r++}return n}function Ut(s,t={}){const{filename:e="anonymous",source:n}=t,r=qt.get(e);r.clear();const o=performance.now(),i=nt(s,[],r),c=performance.now(),a=r.getStats(),l=i.filter(h=>h.dynamic===1).length,u={type:"root",version:"1.1.0",functions:r.getFunctions(),nodes:i,stats:{totalFunctions:a.total,cachedFunctions:a.cached,dynamicNodes:l,totalNodes:i.length},metadata:{compiledAt:new Date().toISOString(),astSize:s.length,filename:e,...n&&{source:n}}};return Y&&console.log(`[IRBuilder] ${e} | ${(c-o).toFixed(2)}ms | Nodes: ${i.length} | Fns: ${a.total}`),u}function Ce(s){qt.clear(s)}const Ae=/<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/,Le=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ie=/\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;function Me(s,t){const e=[];let n;const r=s.replace(/^\s*[^\s"'/>]+/,""),o=s.length-r.length;for(;(n=Ie.exec(r))!==null;){const i=n[1];if(!i)continue;const c=n[2]??n[3]??n[4]??"";let a=i;jt.has(i)&&(a=a.replace(/^on/,"@")),a!=="s-model"&&(a=a.replace(/^on-/,"@").replace(/^s-/,":")),a=Bt(a)||a;const l=n[0],u=l.indexOf("=");let h;if(u===-1)h=l.indexOf(i)+i.length;else{let b=u+1;for(;b<l.length&&/\s/.test(l[b]);)b++;if(l[b]==='"'||l[b]==="'"){let $=b+1;for(;$<l.length&&/\s/.test(l[$]);)$++;h=$}else{let $=b;for(;$<l.length&&/\s/.test(l[$]);)$++;h=$}}let p=n.index+h+o;const g=s.slice(0,p).split(`
22
+ `),m=t[0]+g.length-1,L=g.length>1?g[g.length-1].length+1:t[1]+p;e.push({key:a,value:c,loc:[m,L]})}return e}function Pe(s,t){var i;const e=((i=(s.match(Ae)||[])[1])==null?void 0:i.toLowerCase())??"",n=Me(s,t);return{type:{for:y.For,if:y.If,elseif:y.ElseIf,else:y.Else}[e]??y.Element,tag:e,loc:t,children:[],attrs:n}}function Oe(s,t){const e=s.length;if(s.startsWith("!--",t)){const i=s.indexOf("-->",t+3);return i===-1?-1:i+2}if(s.startsWith("![CDATA[",t)){const i=s.indexOf("]]>",t+8);return i===-1?-1:i+2}if(s[t]==="!")return s.indexOf(">",t+1);if(s[t]==="?"){const i=s.indexOf("?>",t+1);return i===-1?-1:i+1}let n=!1,r=!1,o=t;for(;o<e;){const i=s[o];if(i==="'"&&!r)n=!n;else if(i==='"'&&!n)r=!r;else if(i===">"&&!n&&!r)return o;o++}return-1}function Ht(s){const t=[];if(!s)return[];const e=[],n=[],r=()=>{var l;return e.length===0?t:(l=e[e.length-1]).children||(l.children=[])};let o=0;const i=s.length,c=[0];for(let l=0;l<i;l++)s[l]===`
23
+ `&&c.push(l+1);function a(l){let u=0;for(let h=1;h<c.length&&!(c[h]>l);h++)u=h;return[u+1,l-c[u]+1]}for(;o<i;){const l=s.indexOf("<",o);if(l===-1||l>o){const R=s.substring(o,l===-1?void 0:l),I=R.trim();if(I){const d=R.indexOf(I),E=o+d,S=a(E);r().push({type:y.Text,tag:"text",content:I,loc:S,children:[]})}if(l===-1)break;o=l}const u=Oe(s,o+1);if(u===-1){const R=s.substring(o);R.trim()&&r().push({type:y.Text,tag:"text",content:R.trim(),children:[],loc:a(o)});break}const h=s.substring(o,u+1),p=r(),v=a(o);if(h.startsWith("<!--")){p.push({type:y.Comment,tag:"comment",content:h.slice(4,-3),loc:v,children:[]}),o=u+1;continue}if(h.startsWith("<![CDATA[")){p.push({type:y.Text,tag:"text",content:h.slice(9,-3),loc:v,children:[]}),o=u+1;continue}if(h.startsWith("<!")&&!h.startsWith("<!--")){p.push({type:y.Comment,tag:"comment",content:h.slice(2,-1),loc:v,children:[]}),o=u+1;continue}if(h.startsWith("<?")){p.push({type:y.Comment,tag:"comment",content:h.slice(2,-2),loc:v,children:[]}),o=u+1;continue}if(h.startsWith("</")){const R=n.pop();for(;e.length>0;){if((e[e.length-1].tag||"").toLowerCase()===(R==null?void 0:R.toLowerCase())){e.pop();break}e.pop()}o=u+1;continue}const g=Pe(h,v);p.push(g);const m=g.tag||"",L=m.toLowerCase().startsWith("script"),b=m.toLowerCase().startsWith("style"),$=h.endsWith("/>")||Le.has(m.toLowerCase());if((L||b)&&!$){const R=`</${m}>`,I=s.toLowerCase().indexOf(R,u+1);if(I!==-1){const d=s.substring(u+1,I);d.length&&g.children.push({type:y.Text,tag:"text",content:d,loc:a(u+1),children:[]}),o=I+R.length;continue}else{const d=s.substring(u+1);d.length&&g.children.push({type:y.Text,tag:"text",content:d,loc:a(u+1),children:[]}),o=i;continue}}!$&&g.type!==y.Text&&g.type!==y.Comment&&(e.push(g),n.push(m)),o=u+1}return t}const ut=Symbol("solely.raw");function Yt(s){const t=s&&s[ut];return t?Yt(t):s}function Ne(s){return!!(s&&s[ut])}const $t=(s,t,e=new WeakMap)=>{if(s===t)return!0;if(s==null||t==null||typeof s!="object"||typeof t!="object")return s===t;if(Array.isArray(s)&&Array.isArray(t)){if(s.length!==t.length)return!1;if(e.has(s))return e.get(s)===t;e.set(s,t);for(let r=0;r<s.length;r++)if(!$t(s[r],t[r],e))return!1;return!0}if(Array.isArray(s)!==Array.isArray(t))return!1;if(e.has(s))return e.get(s)===t;e.set(s,t);const n=Reflect.ownKeys(s);if(n.length!==Reflect.ownKeys(t).length)return!1;for(const r of n)if(!Reflect.has(t,r)||!$t(s[r],t[r],e))return!1;return!0};function Zt(s,t,e={}){const{throttle:n=0,onBatch:r,immediate:o=!1,deepCompare:i=!1}=e;let c=!0,a=null,l=[],u=0;const h=new WeakMap,p=new WeakMap,v=new WeakMap,g=Array.isArray(e.filter)?e.filter:e.filter?[e.filter]:[],m=d=>{if(g.length===0)return!0;const E=d.map(String).join(".");return g.some(S=>{if(S==="")return!0;const w=S.replace(/\./g,"\\.").replace(/\*\*/g,"(.+)").replace(/\*/g,"[^.]+").replace(/\[\d+\]/g,"\\[\\d+\\]");return new RegExp(`^${w}$`).test(E)})},L=d=>{const E=[];let S=d;for(;S;){const w=p.get(S);if(!w||w.key==null)break;E.unshift(w.key),S=w.parent}return E},b=(d,E)=>{if(!c)return;const S=L(d);if(!m(S))return;const w={...E,path:S};n>0?(l.push(w),a||(a=setTimeout(()=>{const M=[...l];l=[],a=null,c&&(r==null||r(M),M.forEach(t))},n))):(r==null||r([w]),t(w))},$=(d,E)=>{const S={};return["push","pop","shift","unshift","splice"].forEach(w=>{S[w]=function(...M){u++;const x=d[w].apply(d,M);if(u--,w==="push")b(E,{type:"array-push",index:d.length-M.length,values:M});else if(w==="unshift")b(E,{type:"array-push",index:0,values:M});else if(w==="pop")b(E,{type:"array-splice",index:d.length,deleteCount:1,insert:[]});else if(w==="shift")b(E,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if(w==="splice"){const[P,O,...F]=M;b(E,{type:"array-splice",index:P,deleteCount:O,insert:F})}return x}}),["sort","reverse","fill","copyWithin"].forEach(w=>{S[w]=function(...M){u++;const x=d[w].apply(d,M);return u--,b(E,{type:"array-reset",method:w}),x}}),["indexOf","lastIndexOf","includes"].forEach(w=>{S[w]=function(M,...x){let P=d[w].apply(d,[M,...x]);return(P===-1||P===!1)&&Ne(M)&&(P=d[w].apply(d,[Yt(M),...x])),P}}),S},R=(d,E,S)=>{if(!Object.isExtensible(d)||d[ut])return d;const w=h.get(d);if(w)return p.set(w,{parent:E,key:S}),w;const M={get(P,O,F){if(O===ut)return P;if(Array.isArray(P)){const B=v.get(x);if(B&&Object.prototype.hasOwnProperty.call(B,O))return Reflect.get(B,O,F)}const G=Reflect.get(P,O,F);return typeof O=="symbol"?G:z(G)?R(G,x,O):G},set(P,O,F,G){const B=P[O];if(i?$t(B,F):B===F)return!0;const mt=Reflect.set(P,O,F,G);return u===0&&(Array.isArray(B)&&Array.isArray(F)?b(x,{type:"array-replace",oldValue:B,newValue:F}):b(x,{type:"set",key:O,newValue:F,oldValue:B})),mt},deleteProperty(P,O){if(!Reflect.has(P,O))return!1;const F=P[O],G=Reflect.deleteProperty(P,O);return G&&u===0&&b(x,{type:"delete",key:O,oldValue:F}),G}},x=new Proxy(d,M);return h.set(d,x),p.set(x,{parent:E,key:S}),Array.isArray(d)&&v.set(x,$(d,x)),x},I=R(s,null,null);if(o){const d=(E,S,w=new WeakSet)=>{!z(E)||w.has(E)||(w.add(E),Reflect.ownKeys(E).forEach(M=>{const x=E[M];b(S,{type:"set",key:M,newValue:x,oldValue:void 0}),z(x)&&d(x,R(x,S,M),w)}))};d(s,I)}return{proxy:I,unobserve:()=>{c=!1,l=[],a&&clearTimeout(a)},resume:()=>{c=!0}}}const Jt=Symbol.for("solely.manifest");class st extends HTMLElement{constructor(e={}){var o;super();j(this,C);j(this,q);j(this,J);j(this,X);j(this,rt);j(this,Q);j(this,U);j(this,tt,!1);j(this,et,!1);j(this,H,!1);j(this,it,!1);const n=this.constructor;T(this,q,n[Jt]||{tagName:"base-element"});const r=N(this,q);T(this,Q,(o=r.shadowDOM)!=null&&o.use?this.attachShadow({mode:r.shadowDOM.mode||"open"}):this),W(this,C,Ot).call(this,e),W(this,C,ue).call(this,r),queueMicrotask(()=>W(this,C,_t).call(this))}static get observedAttributes(){const e=this[Jt];return e!=null&&e.propMap?Array.from(e.propMap.keys()):[]}get $data(){return N(this,rt)}set $data(e){var n;z(e)||(e={}),(n=N(this,U))==null||n.call(this),W(this,C,Ot).call(this,e),W(this,C,gt).call(this)}refresh(){W(this,C,gt).call(this)}connectedCallback(){var o;const e=this.constructor;Array.isArray(e.upgradeProps)&&W(this,C,ce).call(this,e.upgradeProps),W(this,C,_t).call(this);const n=N(this,q);if((n.className||n.tagName||"").split(" ").forEach(i=>i&&this.classList.add(i)),W(this,C,fe).call(this),n.propMap&&z(this.$data))for(const[i,c]of n.propMap){const a=c.name;if(this.hasAttribute(i)){const l=this.getAttribute(i),u=W(this,C,Nt).call(this,l,c.default,c.type);this.$data[a]=u}else"default"in c&&(this.$data[a]=c.default)}N(this,X)&&T(this,J,ne(N(this,X),N(this,Q),this)),this.mounted(),(o=this.onInit)==null||o.call(this)}disconnectedCallback(){var e;this.unmounted(),(e=N(this,U))==null||e.call(this),T(this,U,void 0)}attributeChangedCallback(e,n,r){var u;if(n===r||!z(this.$data))return;const i=(u=N(this,q).propMap)==null?void 0:u.get(e);if(!i)return;const c=i.name,a=this.$data[c],l=W(this,C,Nt).call(this,r,i.default??a,i.type);this.$data[c]=l,T(this,H,!0),this.attributeChanged(e,a,l)}emit(e,n,r){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:n,...r}))}onInit(){}created(){}mounted(){}beforeUpdate(){}updated(){}unmounted(){}attributeChanged(e,n,r){}beforeAttributesUpdate(){}afterAttributesUpdate(){}}q=new WeakMap,J=new WeakMap,X=new WeakMap,rt=new WeakMap,Q=new WeakMap,U=new WeakMap,tt=new WeakMap,et=new WeakMap,H=new WeakMap,it=new WeakMap,C=new WeakSet,ce=function(e){for(const n of e)if(this.hasOwnProperty(n)){const r=this[n];delete this[n],this[n]=r}},Ot=function(e){const{proxy:n,unobserve:r}=Zt(e,o=>{var i,c;if(o.type==="set"){const{key:a,newValue:l}=o,u=N(this,q),h=String(a),p=((i=u.propMap)==null?void 0:i.get(h.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()))||Array.from(((c=u.propMap)==null?void 0:c.values())||[]).find(v=>v.name===h);p!=null&&p.reflect&&W(this,C,le).call(this,p,l)}this.emit("change",{source:"state",...o}),W(this,C,gt).call(this)});T(this,rt,n),T(this,U,r)},le=function(e,n){const r=e.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();if(e.type==="boolean")n?this.setAttribute(r,""):this.removeAttribute(r);else{const o=typeof n=="object"?JSON.stringify(n):String(n);this.setAttribute(r,o)}},ue=function(e){e.ir&&T(this,X,e.ir)},Nt=function(e,n,r){if(e===null)return r==="boolean"?n??!1:n;switch(r){case"boolean":return!0;case"number":{const o=Number(e);return isNaN(o)?n:o}case"object":try{return JSON.parse(e)}catch{return n}default:return e}},gt=function(){N(this,et)||!N(this,J)||(T(this,et,!0),queueMicrotask(()=>{T(this,et,!1),W(this,C,he).call(this)}))},he=function(){N(this,tt)||!this.isConnected||(T(this,tt,!0),N(this,H)&&this.beforeAttributesUpdate(),this.beforeUpdate(),N(this,J).update(),this.updated(),N(this,H)&&(this.afterAttributesUpdate(),T(this,H,!1)),T(this,tt,!1))},fe=function(){const e=N(this,q);if(!e.styles)return;const n=N(this,Q);if(e.sheet&&n instanceof ShadowRoot&&"adoptedStyleSheets"in n){n.adoptedStyleSheets.includes(e.sheet)||(n.adoptedStyleSheets=[...n.adoptedStyleSheets,e.sheet]);return}const r=n instanceof ShadowRoot?n:document.head,o=`solely-style-${e.tagName}`;if(!r.querySelector(`#${o}`)){const i=document.createElement("style");i.id=o,i.textContent=e.styles,r.appendChild(i)}},_t=function(){N(this,it)||(T(this,it,!0),this.created())},Lt=new WeakMap,A(st,"upgradeProps"),j(st,Lt,!1);const _e=Symbol.for("solely.manifest"),St=s=>{const t=s;return e=>{const{tagName:n}=t;if(customElements.get(n))return e;if(typeof t.template=="string"&&!t.ir)try{const o=Ht(t.template);t.ir=Ut(o,{source:t.template,filename:n})}catch(o){console.error(`[Compiler Error] <${n}>:`,o)}if(t.styles&&!t.sheet&&"CSSStyleSheet"in window)try{const o=new CSSStyleSheet;o.replaceSync(t.styles),t.sheet=o}catch(o){console.error(`[Style Error] <${n}>:`,o)}if(t.props&&!t.propMap){const o=new Map;t.props.forEach(i=>{const c=typeof i=="string"?{name:i}:i,a=c.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();o.set(a,c)}),t.propMap=o}class r extends e{}return r[_e]=t,customElements.define(n,r),r}},ht=Symbol("solely.irCtx"),ft=Symbol("solely.irEvents"),D=Symbol.for("solely.irMeta"),xt=Symbol("solely.prevClassObj"),kt=Symbol("solely.prevStyleObj"),Te={xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},Xt={readonly:"readOnly",for:"htmlFor",tabindex:"tabIndex",contenteditable:"contentEditable",maxlength:"maxLength"},We=new Set(["data-","aria-","role","form"]),Fe=new Set(["value","selectedIndex"]);function Ve(s,t){var n;const e=(n=t.attrs)==null?void 0:n.find(r=>r.key==="class"&&!r.dynamic);e!=null&&e.value&&s.setAttribute("class",e.value)}function je(s,t){var o;if(!s.style)return;const n=(o=t.attrs)==null?void 0:o.find(i=>i.key==="style"&&!i.dynamic),r=n?Qt(n.value):{};for(const i in r){const c=r[i];i.startsWith("--")?s.style.setProperty(i,c):s.style[i]=c}}const De=(s,t)=>{const e=s,n=Qt(t),r=e[kt];if(!r){for(const i in n){const c=n[i];i.startsWith("--")?s.style.setProperty(i,c):s.style[i]=c}e[kt]=n;return}let o=!1;for(const i in r)i in n||(i.startsWith("--")?s.style.removeProperty(i):s.style[i]="",o=!0);for(const i in n){const c=n[i],a=r[i];c!==a&&(i.startsWith("--")?s.style.setProperty(i,c):s.style[i]=c,o=!0)}o&&(e[kt]=n)},Be=(s,t)=>{const e=s,n=e[xt],r=Ge(t);if(!n){for(const i in r)s.classList.add(i);e[xt]=r;return}let o=!1;for(const i in n)r[i]||(s.classList.remove(i),o=!0);for(const i in r)n[i]||(s.classList.add(i),o=!0);o&&(e[xt]=r)};function Qt(s){const t={},e=[[s]];for(;e.length;){const[n,r]=e.pop();if(n){if(typeof n=="string"){const o=/([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g;let i;for(;(i=o.exec(n))!==null;){const c=i[1].trim(),a=i[2].trim();c&&a&&(t[c]=a)}continue}if(Array.isArray(n)){for(let o=n.length-1;o>=0;o--)e.push([n[o]]);continue}if(typeof n=="object")for(const o in n){const i=n[o];if(i==null)continue;const c=r?`${r}-${o}`:o;typeof i=="object"&&!Array.isArray(i)?e.push([i,c]):t[c]=String(i)}}}return t}function Ge(s){const t={},e=[s];for(;e.length;){const n=e.pop();if(n){if(typeof n=="string"){const r=n.split(" ");for(let o=0;o<r.length;o++){const i=r[o].trim();i&&(t[i]=!0)}}else if(Array.isArray(n))for(let r=n.length-1;r>=0;r--)e.push(n[r]);else if(typeof n=="object")for(const r in n)n[r]&&(t[r]=!0)}}return t}function Rt(s,t,e){const n=e==null?"":String(e),r=t.indexOf(":");if(r>0){const o=t.slice(0,r),i=Te[o];if(i){s.getAttributeNS(i,t)!==n&&s.setAttributeNS(i,t,n);return}}s.getAttribute(t)!==n&&s.setAttribute(t,n)}function te(s,t,e){const n=Xt[t]||t;if(t.startsWith("data-")||t.startsWith("aria-")||We.has(t)){Rt(s,t,e);return}const r=s,o=r.tagName;if(e==null){if(typeof r[n]=="boolean")r[n]!==!1&&(r[n]=!1);else{const c=r[n];c!==""&&c!==void 0&&(r[n]=""),s.hasAttribute(t)&&s.removeAttribute(t)}return}if(n==="src"||n==="href"){const c=String(e);if(r[n]===c||s.getAttribute(n)===c)return}if(n==="value"&&(o==="INPUT"||o==="TEXTAREA")&&r.value===e)return;if(typeof e=="boolean"){if(r[n]===e)return;r[n]=e;return}(s instanceof SVGElement||r.ownerSVGElement!==void 0)&&!Xt[t]?Rt(s,t,e):r[n]!==e&&(r[n]=e)}class ee{constructor(t,e,n={}){A(this,"nodeMap",new Map);A(this,"marker",!1);this.ir=t,this.container=e,this.scope=n}evalIR(t,e,n){var o;const r=this.ir.functions[t-1];try{return r?r.apply(this.scope,e):""}catch(i){return Wt(i.message||i.toString(),((o=this.ir.metadata)==null?void 0:o.source)||"",n,this.scope.tagName),""}}createElement(t,e){const n=t.tag;return e instanceof SVGElement||n==="svg"?document.createElementNS("http://www.w3.org/2000/svg",n):document.createElement(n)}createText(t,e){const n=t.dynamic?this.evalIR(t.fid,[e],t[D]):t.txt||"";return document.createTextNode(n)}createComment(t,e){const n=t.dynamic?this.evalIR(t.fid,[e],t[D]):t.txt||"";return document.createComment(n)}applyAttrs(t,e,n,r=!1){const o=[],i=t;i[ht]||(i[ht]={loops:null}),i[ht].loops=n,i[ft]||(i[ft]=Object.create(null));let c,a=!1,l,u=!1;for(const h of e){const{key:p,fid:v,dynamic:g,value:m}=h;if(p===":class"){c=this.evalIR(v,[n],h[D]),a=!0;continue}if(p===":style"){l=this.evalIR(v,[n],h[D]),u=!0;continue}if(p==="class"||p==="style")continue;const L=p[0];if(L==="@"){const $=p.slice(1),R=h.role??"user";let I=i[ft][$];if(I||(I=i[ft][$]={model:[],user:[]},t.addEventListener($,d=>{for(const E of I.model)E(d);for(const E of I.user)E(d)})),!r){const d=E=>this.evalIR(v,[E,i[ht].loops],h[D]);I[R].push(d)}continue}if(p==="mounted"){r||requestAnimationFrame(()=>this.evalIR(v,[t,n],h[D]));continue}if(p==="updated"){r&&requestAnimationFrame(()=>this.evalIR(v,[t,n],h[D]));continue}if(p==="ref"&&m){this.scope.$refs=this.scope.$refs||{},this.scope.$refs[m]=t;continue}const b=g?this.evalIR(v,[n],h[D]):m??"";if(L===":"){const $=p.slice(1);t.tagName==="SELECT"&&Fe.has($)?o.push(()=>te(t,$,b)):te(t,$,b)}else r||Rt(t,p,String(b))}return a&&Be(t,c),u&&De(t,l),o}updateNode(t,e,n){const r=e.dynamic?this.evalIR(e.fid,[n],e[D]):e.txt||"";e.dynamic&&t.textContent!==r&&(t.textContent=r)}irToNode(t,e,n,r,o){var l,u,h,p;const i=n+"-"+e,c=this.nodeMap.get(i);let a;if(c){a=c.node,c.marker=this.marker;let v=[];t.dynamic&&(t.type===y.Element?v=this.applyAttrs(a,t.attrs??[],o,!0):this.updateNode(a,t,o)),(l=t.children)==null||l.forEach((g,m)=>{this.irToNode(g,m,i,a,o)}),v.forEach(g=>g())}else switch(t.type){case y.Element:a=this.createElement(t,r),Ve(a,t),je(a,t);const v=this.applyAttrs(a,t.attrs??[],o);r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker}),(u=t.children)==null||u.forEach((g,m)=>{this.irToNode(g,m,i,a,o)}),v.forEach(g=>g());break;case y.Text:a=this.createText(t,o),r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker});break;case y.Comment:a=this.createComment(t,o),r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker});break;case y.For:{const g=`${i}-end`;let m=(h=this.nodeMap.get(g))==null?void 0:h.node;m?this.nodeMap.get(g).marker=this.marker:(m=document.createComment(`for:${i}`),r.appendChild(m),this.nodeMap.set(g,{irNode:{type:y.Comment},node:m,loops:o,marker:this.marker}));const L=this.evalIR(t.fid,[o],t[D])||[],b=document.createDocumentFragment();L.forEach(($,R)=>{var d;const I=[...o,{itmVal:$,idxVal:R}];(d=t.children)==null||d.forEach((E,S)=>{this.irToNode(E,S,`${i}-for-${R}`,b,I)})}),m.parentNode.insertBefore(b,m);break}case y.Conditional:{const g=`${i}-end`;let m=(p=this.nodeMap.get(g))==null?void 0:p.node;m?this.nodeMap.get(g).marker=this.marker:(m=document.createComment(`if:${i}`),r.appendChild(m),this.nodeMap.set(g,{irNode:{},node:m,loops:o,marker:this.marker}));for(let L=0;L<(t.branches||[]).length;L++){const b=t.branches[L];if(b.condFid===null||this.evalIR(b.condFid,[o],b[D])){const R=document.createDocumentFragment();b.children.forEach((I,d)=>{this.irToNode(I,d,`${i}-if-${L}`,R,o)}),m.parentNode.insertBefore(R,m);break}}break}}}cleanupOldNodes(){for(const[t,e]of this.nodeMap.entries())if(e.marker!==this.marker){const{irNode:n,node:r,loops:o}=e;if(n.attrs){const i=n.attrs.find(a=>a.key==="unmounted");i&&requestAnimationFrame(()=>{this.evalIR(i.fid,[r,o],i[D])});const c=n.attrs.find(a=>a.key==="ref");c&&c.value&&delete this.scope.$refs[c.value]}r==null||r.remove(),this.nodeMap.delete(t)}}mount(){this.marker=!this.marker,this.ir.nodes.forEach((t,e)=>{this.irToNode(t,e,"root",this.container,[])}),this.cleanupOldNodes()}update(){this.marker=!this.marker,this.ir.nodes.forEach((t,e)=>{this.irToNode(t,e,"root",this.container,[])}),this.cleanupOldNodes()}destroy(){this.container.innerHTML="",this.nodeMap.clear()}}const ne=(s,t,e={})=>{const n=new ee(s,t,e);return n.mount(),{update:()=>n.update(),destroy:()=>n.destroy()}};let Z=null,se;const Ct=new Promise(s=>{se=s});function qe(s){return Z||(Z=new re(s),se(Z),Z)}function dt(){return Z}class re{constructor(t){A(this,"routes");A(this,"base");A(this,"mode");A(this,"beforeEachGuard");A(this,"afterEachGuard");A(this,"currentRoute",null);A(this,"listeners",new Set);A(this,"isStarted",!1);this.routes=t.routes,this.base=t.base??"/",this.mode=t.mode||"history",this.beforeEachGuard=t.beforeEach,this.afterEachGuard=t.afterEach}matchRoute(t="/"){const e=t.startsWith("/")?t:"/"+t,[n,r]=e.split("?"),o=n.split("/").filter(Boolean),i=this.parseQuery(r),c=this.recursiveMatch(this.routes,o);if(c){const a=c.matched[c.matched.length-1];return a.config.redirect?this.matchRoute(a.config.redirect):{matched:c.matched,params:c.params,query:i,fullPath:e,meta:c.matched.reduce((l,u)=>({...l,...u.config.meta||{}}),{})}}return null}recursiveMatch(t,e){const n=[...t].sort((r,o)=>this.calculateScore(o.path)-this.calculateScore(r.path));for(const r of n){const o=r.path.split("/").filter(Boolean),i={};let c=!0;if(o.length===0&&e.length===0)return{matched:[{config:r,params:{}}],params:{}};for(let a=0;a<o.length;a++){const l=o[a],u=e[a];if(l.startsWith(":")){if(!u){c=!1;break}i[l.slice(1)]=u}else if(l==="*"){c=!0;break}else if(l!==u){c=!1;break}}if(c){const a=o.length,l=e.slice(a),u={config:r,params:i};if(l.length>0&&r.children){const h=this.recursiveMatch(r.children,l);if(h)return{matched:[u,...h.matched],params:{...i,...h.params}}}else if(l.length===0||o.includes("*"))return{matched:[u],params:i}}}return null}calculateScore(t="/"){const e=t.split("/").filter(Boolean);return e.length===0?1:e.reduce((n,r)=>r.startsWith(":")?n+5:r==="*"?n+0:n+10,0)}parseQuery(t){const e={};return t&&new URLSearchParams(t).forEach((r,o)=>{e[o]=r}),e}normalizePath(t="/"){let e=t&&typeof t=="string"?t:"/";return e.startsWith("/")||(e="/"+e),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e}getPath(){let t;try{t=this.mode==="hash"?window.location.hash.slice(1)||"/":window.location.pathname||"/"}catch{t="/"}const e=this.base||"/";return e!=="/"&&t.startsWith(e)&&(t=t.slice(e.length)||"/"),this.normalizePath(t)}updateBrowserHistory(t="/",e){const n=this.normalizePath(t),r=this.base||"/";if(this.mode==="hash")e?window.location.replace(`#${n}`):window.location.hash=n;else{const o=r.endsWith("/")?r.slice(0,-1):r,i=o==="/"?n:o+n;e?window.history.replaceState({path:i},"",i):window.history.pushState({path:i},"",i)}}async navigate(t="/",e=!1,n=!1){const r=this.normalizePath(t),o=this.currentRoute,i=this.matchRoute(r);if(!i)return{success:!1,error:`No route matched: ${r}`};if(o&&o.fullPath===i.fullPath)return{success:!0};if(this.beforeEachGuard)try{const c=await this.beforeEachGuard(i,o);if(c===!1)return{success:!1,cancelled:!0};if(typeof c=="string")return this.navigate(c,e)}catch(c){return{success:!1,error:c instanceof Error?c.message:"Guard Error"}}return this.currentRoute=i,n||this.updateBrowserHistory(r,e),this.notifyListeners(),this.afterEachGuard&&this.afterEachGuard(i,o),{success:!0}}resolve(t="/"){const e=this.normalizePath(t);if(this.mode==="hash")return`#${e}`;const n=this.base.endsWith("/")?this.base.slice(0,-1):this.base;return n==="/"?e:n+e}get modeType(){return this.mode}pushWithQuery(t="/",e){const n=new URLSearchParams(e).toString(),r=t.includes("?")?"&":"?";return this.push(t+(n?r+n:""))}push(t="/"){return this.navigate(t,!1)}replace(t="/"){return this.navigate(t,!0)}back(){window.history.back()}listen(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notifyListeners(){this.listeners.forEach(t=>t())}setupListeners(){if(this.isStarted)return;const t=()=>{this.navigate(this.getPath(),!0,!0)};window.addEventListener("popstate",t),this.mode==="hash"&&!window.location.hash&&(window.location.hash="/"),this.navigate(this.getPath(),!0)}getCurrentRoute(){return this.currentRoute}}var Ke=Object.getOwnPropertyDescriptor,ze=(s,t,e,n)=>{for(var r=n>1?void 0:n?Ke(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=i(r)||r);return r};let pt=class extends st{constructor(){super(...arguments);A(this,"unsubscribe");A(this,"level",0);A(this,"currentElement",null);A(this,"currentTagName",null);A(this,"routerAttrs",new Set);A(this,"prevPropKeys",new Set);A(this,"scheduled",!1);A(this,"cache",new Map);A(this,"latestLoadId",0)}async mounted(){this.detectLevel();const t=await Ct;this.unsubscribe=t.listen(()=>{this.scheduleLoad(t.getCurrentRoute())}),this.loadRoute(t.getCurrentRoute())}unmounted(){var t;(t=this.unsubscribe)==null||t.call(this),this.cache.forEach(e=>e.remove()),this.cache.clear()}scheduleLoad(t){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.loadRoute(t)}))}detectLevel(){let t=0,e=this.parentElement;for(;e;)e instanceof pt&&t++,e=e.parentElement;this.level=t}async loadRoute(t){const e=++this.latestLoadId,n=t==null?void 0:t.matched[this.level];if(!n){this.handleEmptyRoute();return}const{config:r}=n;let o=r.tagName;if(!o&&typeof r.component=="function"){this.renderLoading();try{const c=await r.component();o=typeof c=="string"?c:c.tagName}catch(c){this.renderError(`Load Error: ${c}`);return}}if(e!==this.latestLoadId)return;if(!o){this.clear();return}if(!r.forceReload&&this.currentElement&&this.currentTagName===o.toLowerCase()){this.syncState(this.currentElement,t==null?void 0:t.params,(t==null?void 0:t.query)||{},r.props);return}this.clear(r.keepAlive);const i=this.getOrCreateComponent(o,r);this.syncState(i,t==null?void 0:t.params,(t==null?void 0:t.query)||{},r.props),this.appendChild(i),this.currentElement=i,this.currentTagName=o.toLowerCase()}getOrCreateComponent(t,e){const n=t.toLowerCase();if(e.keepAlive&&this.cache.has(n))return this.cache.get(n);const r=document.createElement(t);return e.keepAlive&&this.cache.set(n,r),r}syncState(t,e,n,r={}){const o=a=>a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=new Map;Object.entries(e).forEach(([a,l])=>i.set(o(a),String(l))),Object.entries(n).forEach(([a,l])=>i.set(`query-${o(a)}`,String(l))),this.routerAttrs.forEach(a=>{i.has(a)||(t.removeAttribute(a),this.routerAttrs.delete(a))}),i.forEach((a,l)=>{t.getAttribute(l)!==a&&t.setAttribute(l,a),this.routerAttrs.add(l)});const c=new Set(Object.keys(r));this.prevPropKeys.forEach(a=>{c.has(a)||(t[a]=void 0)}),Object.entries(r).forEach(([a,l])=>{t[a]!==l&&(t[a]=l)}),this.prevPropKeys=c}handleEmptyRoute(){this.clear(),this.level===0&&this.renderError("404 Not Found")}renderLoading(){this.innerHTML='<div style="padding:20px; color:#999;">Loading...</div>'}renderError(t){this.innerHTML=`<div style="padding:20px; color:#ff4d4f;">${t}</div>`}clear(t=!1){this.currentElement?this.contains(this.currentElement)&&this.removeChild(this.currentElement):t||(this.innerHTML=""),this.currentElement=null,this.currentTagName=null,this.routerAttrs.clear(),this.prevPropKeys.clear()}};pt=ze([St({tagName:"router-view"})],pt);const Ue=pt;var He=Object.getOwnPropertyDescriptor,Ye=(s,t,e,n)=>{for(var r=n>1?void 0:n?He(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=i(r)||r);return r};let At=class extends st{constructor(){super(...arguments);A(this,"_prefetched",!1)}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){(await Ct).listen(()=>this.updateState()),this.updateState(),this.addEventListener("click",e=>{var r,o;e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||e.button!==0||(r=e.target.closest("a"))!=null&&r.getAttribute("target")||(e.preventDefault(),(o=dt())==null||o.push(this.$data.to))}),this.addEventListener("mouseenter",()=>{this.prefetchRoute()},{once:!0})}updateState(){const t=dt();if(!t)return;this.$data.href=t.resolve(this.$data.to);let e=!1;if(this.$data.active)e=!0;else{const r=t.getCurrentRoute();if(r){const o=r.fullPath;this.hasAttribute("exact")?e=o===this.$data.to:e=o===this.$data.to||o.startsWith(this.$data.to+"/")}}this.$data.isActive=e;const n=this.$data.activeClass||"active";this.classList.toggle(n,e)}prefetchRoute(){if(this._prefetched||!this.hasAttribute("prefetch"))return;const t=dt();t&&typeof t.prefetch=="function"&&(t.prefetch(this.$data.to),this._prefetched=!0)}};At=Ye([St({tagName:"router-link",template:`
24
24
  <a part="link" :href="$data.href" :class="{active: $data.isActive}">
25
25
  <slot>{{$data.label || ''}}</slot>
26
26
  </a>
@@ -43,4 +43,4 @@
43
43
  :host([custom]) a {
44
44
  display: contents;
45
45
  }
46
- `,shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],At);const Qe=At;f.ASTType=m,f.BaseElement=it,f.CustomElement=Rt,f.IRRenderer=re,f.LIFECYCLE_ATTRS_MAP=Kt,f.Router=ae,f.RouterLink=Qe,f.RouterView=He,f.buildIR=Ht,f.clearIRCache=Re,f.createFunction=jt,f.createRender=ie,f.createRouter=ze,f.genFunction=Vt,f.getRouter=gt,f.isLifecycleKind=Gt,f.isObject=U,f.listeners=Bt,f.mapAttrKeyToLifecycleKind=qt,f.observe=Qt,f.parseHashUrl=Ee,f.parseHtml=Zt,f.routerReady=Lt,f.showTemplateError=Ft,f.transformModel=Yt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
46
+ `,shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],At);const Ze=At;f.ASTType=y,f.BaseElement=st,f.CustomElement=St,f.IRRenderer=ee,f.LIFECYCLE_ATTRS_MAP=Dt,f.Router=re,f.RouterLink=Ze,f.RouterView=Ue,f.buildIR=Ut,f.clearIRCache=Ce,f.createFunction=Ft,f.createRender=ne,f.createRouter=qe,f.genFunction=Vt,f.getRouter=dt,f.isLifecycleKind=Gt,f.isObject=z,f.listeners=jt,f.mapAttrKeyToLifecycleKind=Bt,f.observe=Zt,f.parseHashUrl=ve,f.parseHtml=Ht,f.routerReady=Ct,f.showTemplateError=Wt,f.transformModel=zt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
@@ -1,9 +1,11 @@
1
+ import { IRRoot } from '../../types';
1
2
  /** Prop 配置,支持类型声明 */
2
3
  export type PropType = "string" | "number" | "boolean" | "object";
3
4
  export interface PropDescriptor {
4
5
  name: string;
5
6
  type?: PropType;
6
7
  default?: any;
8
+ reflect?: boolean;
7
9
  }
8
10
  /**
9
11
  * Manifest:组件声明配置
@@ -21,4 +23,10 @@ export interface Manifest {
21
23
  className?: string;
22
24
  tagName: string;
23
25
  }
24
- export declare const CustomElement: (manifest: Manifest) => ClassDecorator;
26
+ /** 框架内部使用的运行时版本 */
27
+ export interface InternalManifest extends Manifest {
28
+ ir?: IRRoot;
29
+ sheet?: CSSStyleSheet;
30
+ propMap?: Map<string, PropDescriptor>;
31
+ }
32
+ export declare const CustomElement: (config: Manifest) => ClassDecorator;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solely",
3
3
  "private": false,
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",