solely 0.1.7 → 0.1.8
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/README.md +44 -1
- package/dist/index.js +332 -269
- package/dist/index.umd.cjs +11 -10
- package/dist/runtime/component/decorators.d.ts +6 -0
- package/dist/shared/env.d.ts +4 -0
- package/dist/shared/functions.d.ts +2 -1
- package/dist/shared/gen-function.d.ts +2 -7
- package/dist/shared/index.d.ts +1 -0
- package/dist/types/ast.d.ts +6 -0
- package/dist/types/ir.d.ts +31 -0
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
(function(p,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(p=typeof globalThis<"u"?globalThis:p||self,k(p.solely={}))})(this,function(p){"use strict";var
|
|
2
|
-
`);if(a>h.length){console.error(`[Template Error] 行号 ${a} 超出范围`);return}const u=a-1,m=Math.max(0,u-3),$=Math.min(h.length-1,u+3),f=String($+1).length,d=((
|
|
3
|
-
`):[],g=d?Math.max(...S.map(
|
|
1
|
+
(function(p,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(p=typeof globalThis<"u"?globalThis:p||self,k(p.solely={}))})(this,function(p){"use strict";var hn=Object.defineProperty;var pe=p=>{throw TypeError(p)};var fn=(p,k,I)=>k in p?hn(p,k,{enumerable:!0,configurable:!0,writable:!0,value:I}):p[k]=I;var x=(p,k,I)=>fn(p,typeof k!="symbol"?k+"":k,I),Mt=(p,k,I)=>k.has(p)||pe("Cannot "+I);var A=(p,k,I)=>(Mt(p,k,"read from private field"),I?I.call(p):k.get(p)),W=(p,k,I)=>k.has(p)?pe("Cannot add the same private member more than once"):k instanceof WeakSet?k.add(p):k.set(p,I),M=(p,k,I,yt)=>(Mt(p,k,"write to private field"),yt?yt.call(p,I):k.set(p,I),I),O=(p,k,I)=>(Mt(p,k,"access private method"),I);var F,K,Y,nt,Z,q,J,X,z,st,R,me,Pt,ge,ye,Ot,gt,be,we,_t;const _={dark:{gutter:"#858585",errorLineBg:"#3c1e1e",errorLineFg:"#f8f8f2",arrow:"#ff6b6b",badgeBg:"#ff6b6b",badgeFg:"#ffffff",exprLabel:"#a0a0a0",exprCode:"#5ddcff"}}.dark;function at(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 Nt(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 Tt(s,t="",e,n="component"){var pt;const r=(s==null?void 0:s.message)??String(s),o=`%cTemplate Error%c in <${n}> → ${r}`,i=[`color:${_.badgeFg};background:${_.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,`color:${_.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 l=e.loc;let a=l[0]||0,c=l[1]||0;a|=0,c|=0,a<1&&(a=1),c<1&&(c=1);const h=t.split(`
|
|
2
|
+
`);if(a>h.length){console.error(`[Template Error] 行号 ${a} 超出范围`);return}const u=a-1,m=Math.max(0,u-3),$=Math.min(h.length-1,u+3),f=String($+1).length,d=((pt=e.expr)==null?void 0:pt.trim())??"",S=d?d.split(`
|
|
3
|
+
`):[],g=d?Math.max(...S.map(at)):0,b=S.length>1,y=`color:${_.gutter};`,E=`color:${_.arrow};font-weight:bold;`,v=`color:${_.gutter};`,C=`color:${_.errorLineFg};background:${_.errorLineBg};padding:0 4px;`,L=`color:${_.gutter};`,P=`color:${_.arrow};font-weight:bold;padding:0 4px;`;console.groupCollapsed(`${o} %c(Line:${a}, Col:${c})`,...i,`color:${_.gutter};font-weight:normal;`);for(let Q=m;Q<=$;Q++){const At=h[Q],le=String(Q+1).padStart(f," ");if(!(Q===u)){console.log(`%c${le} │%c ${At}`,y,v);continue}const an=At.slice(0,Math.max(0,c-1)),ue=at(an),he=" ".repeat(f+3),cn=le.padEnd(f," ");if(console.log(`%c${cn} │%c ${At}`,E,C),b)for(let V=0;V<S.length;V++){const Lt=S[V],it=u+V;let It=0;if(V===0)It=ue;else if(it<h.length){const ot=h[it],mt=ot.search(/\S/),un=mt===-1?ot:ot.slice(0,mt);It=at(un)}const ln=Math.max(1,at(Lt.trim())),fe=Nt(ln,{lineIndex:V,totalLines:S.length}),de=he+" ".repeat(It);if(V===0)console.log(`%c${de}%c${fe}`,L,P);else if(it<h.length){const ot=String(it+1).padEnd(f," "),mt=h[it];console.log(`%c${ot} │%c ${mt}`,E,C),console.log(`%c${de}%c${fe}`,L,P)}}else{const V=he+" ".repeat(ue),Lt=Nt(g||1);console.log(`%c${V}%c${Lt}`,L,P)}}d&&console.log(`%cExpression:%c ${d}`,`color:${_.exprLabel};font-weight:bold;`,`color:${_.exprCode};font-family:monospace;`),console.groupEnd()}function Wt(s){if(s[s.length-1].trim()==="")throw new Error("Function body cannot be empty");return new Function(...s)}const N=(()=>{var s,t,e;return!!(typeof window<"u"&&((s=window.location)!=null&&s.search.includes("debug")||globalThis.__DEBUG__===!0||globalThis.__IS_DEV__===!0)||typeof process<"u"&&((t=process.env)==null?void 0:t.NODE_ENV)==="development"||typeof window<"u"&&["localhost","127.0.0.1","0.0.0.0"].includes(((e=window.location)==null?void 0:e.hostname)||""))})(),Ee=!N,ve=/\{\{\{\s*[\s\S]*?\s*\}\}\}/,$e=/\{\{\s*([\s\S]*?)\s*\}\}/g,Se=1e3,B=new Map;function ke(s,t){if(!(s!=null&&s.trim()))return{processed:""};if(ve.test(s))return{processed:s,error:"Illegal interpolation syntax: use {{ }} instead of {{{ }}}"};if(t==="template")try{return{processed:s.replace($e,(n,r)=>`\${${r.trim()}}`)}}catch(e){return{processed:s,error:`Template parse error: ${e instanceof Error?e.message:String(e)}`}}return{processed:s}}function Ce(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);default:return"return undefined;"}}function Re(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 xe(s){let t=0;for(let e=0;e<s.length;e++)t=(t<<5)-t+s.charCodeAt(e),t|=0;return Math.abs(t).toString(36)}function Ae(s,t,e,n,r){const o=s==="lifecycle"?["el","loops"]:s==="handler"?["event","loops"]:["loops"],i=s==="handler"?"const { value, checked } = event?.target || {};":"";let l="";if(N){const c=xe(r);l=`
|
|
4
|
+
//# sourceURL=vm:///${s}_${c}.js`}const a=`
|
|
4
5
|
const { $data } = this;
|
|
5
|
-
${
|
|
6
|
+
${i}
|
|
6
7
|
${e}
|
|
7
8
|
${n}
|
|
8
|
-
${t}
|
|
9
|
-
`.replace(/^\s+|\s+$/gm,"");return
|
|
9
|
+
${t}${l}
|
|
10
|
+
`.replace(/^\s+|\s+$/gm,"");return o.push(a),o}function Dt(s,t,e){if(!(s!=null&&s.trim()))return()=>"";const n=e.map(a=>`${a.item}:${a.index}`).join(","),r=`${t}|${s}|${n}`;if(B.has(r)){const a=B.get(r);return B.delete(r),B.set(r,a),a}const{processed:o,error:i}=ke(s,t);let l;if(i)l=function(){throw new Error(`[Compile Error] ${i} Original: ${s}`)};else try{const a=Ce(o,t),{loopValues:c,loopIndices:h}=Re(e),u=Ae(t,a,c,h,s);l=Wt(u)}catch(a){const c=a instanceof Error?a.message:String(a);l=function(){throw new Error(`[Parse Error] ${c} Original: ${s}`)}}if(B.size>=Se){const a=B.keys().next().value;a&&B.delete(a)}return B.set(r,l),l}const Ft=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"]),j=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 Le(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[l,a]=i.split("=");l&&a&&(o[decodeURIComponent(l)]=decodeURIComponent(a))}),{path:n.split("/").filter(Boolean),query:o}}var w=(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))(w||{});const Vt={onMounted:"mounted",onUpdated:"updated",onUnmounted:"unmounted"};function Bt(s){return Vt[s]??null}function jt(s){return s==="mounted"||s==="updated"||s==="unmounted"}const bt=Symbol.for("solely.irMeta"),Ie=/\{\{[\s\S]*?\}\}/;class Me{constructor(){x(this,"compilers",new Map)}get(t="anonymous"){let e=this.compilers.get(t);return e||(e=new Pe,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 Gt=new Me;class Pe{constructor(){x(this,"cache",new Map);x(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 l;try{l=Dt(r,t,n)}catch(c){N&&console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`,c),l=()=>""}const a=this.functions.push(l);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"}:jt(s)?{isDynamic:!0,type:"lifecycle"}:{isDynamic:!1,type:null}}function Oe(s){return s?Ie.test(s):!1}function wt(s,t,e){N&&(s[bt]={expr:t??"",loc:e??null})}function Ut(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 l=(a,c,h)=>{var u;(u=s.attrs)==null||u.push({key:a,value:c,role:h,loc:n})};if(r==="input"){if(i==="checkbox"){const a=s.attrs.find(m=>m.key==="value"),c=a?JSON.stringify(a.value):'"on"',h=`Array.isArray(${e}) ? ${e}.includes(${c}) : ${e}`;l(":checked",h);const u=`
|
|
10
11
|
const _v = ${c};
|
|
11
12
|
if(Array.isArray(${e})) {
|
|
12
13
|
const _i = ${e}.indexOf(_v);
|
|
@@ -18,9 +19,9 @@
|
|
|
18
19
|
const values = Array.isArray(${e}) ? ${e} : ${e} != null ? [${e}] : [];
|
|
19
20
|
for (const opt of el.options) {
|
|
20
21
|
opt.selected = values.includes(opt.value);
|
|
21
|
-
}`),l("@change",`${e} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")):(l(":value",e),l("@change",`${e} = value`,"model"));return}l(":value",e),l("@input",`${e} = $event`,"model")}function
|
|
22
|
-
`),d=t[0]+f.length-1,S=f.length>1?f[f.length-1].length+1:t[1]+m;e.push({key:a,value:l,loc:[d,S]})}return e}function
|
|
23
|
-
`&&l.push(c+1);function a(c){let h=0;for(let u=1;u<l.length&&!(l[u]>c);u++)h=u;return[h+1,c-l[h]+1]}for(;o<i;){const c=s.indexOf("<",o);if(c===-1||c>o){const y=s.substring(o,c===-1?void 0:c),E=y.trim();if(E){const v=y.indexOf(E),R=o+v,L=a(R);r().push({type:w.Text,tag:"text",content:E,loc:L,children:[]})}if(c===-1)break;o=c}const h=Ve(s,o+1);if(h===-1){const y=s.substring(o);y.trim()&&r().push({type:w.Text,tag:"text",content:y.trim(),children:[],loc:a(o)});break}const u=s.substring(o,h+1),m=r(),$=a(o);if(u.startsWith("<!--")){m.push({type:w.Comment,tag:"comment",content:u.slice(4,-3),loc:$,children:[]}),o=h+1;continue}if(u.startsWith("<![CDATA[")){m.push({type:w.Text,tag:"text",content:u.slice(9,-3),loc:$,children:[]}),o=h+1;continue}if(u.startsWith("<!")&&!u.startsWith("<!--")){m.push({type:w.Comment,tag:"comment",content:u.slice(2,-1),loc:$,children:[]}),o=h+1;continue}if(u.startsWith("<?")){m.push({type:w.Comment,tag:"comment",content:u.slice(2,-2),loc:$,children:[]}),o=h+1;continue}if(u.startsWith("</")){const y=n.pop();for(;e.length>0;){if((e[e.length-1].tag||"").toLowerCase()===(y==null?void 0:y.toLowerCase())){e.pop();break}e.pop()}o=h+1;continue}const f=De(u,$);m.push(f);const d=f.tag||"",S=d.toLowerCase().startsWith("script"),g=d.toLowerCase().startsWith("style"),b=u.endsWith("/>")||Te.has(d.toLowerCase());if((S||g)&&!b){const y=`</${d}>`,E=s.toLowerCase().indexOf(y,h+1);if(E!==-1){const v=s.substring(h+1,E);v.length&&f.children.push({type:w.Text,tag:"text",content:v,loc:a(h+1),children:[]}),o=E+y.length;continue}else{const v=s.substring(h+1);v.length&&f.children.push({type:w.Text,tag:"text",content:v,loc:a(h+1),children:[]}),o=i;continue}}!b&&f.type!==w.Text&&f.type!==w.Comment&&(e.push(f),n.push(d)),o=h+1}return t}const at=Symbol("solely.raw"),G=new WeakMap,Ht=new WeakMap,wt=new WeakMap,Yt=new WeakMap,B=new WeakMap;function Zt(s){if(s&&typeof s=="object"){const t=s[at];if(t)return t}return s}const Jt=s=>!s||typeof s!="object"?!1:s instanceof File||s instanceof Blob||s instanceof FormData||s instanceof ArrayBuffer||s instanceof Response||s instanceof Request;function Xt(s){return!!(s&&s[at])}const Et=(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))return!1;if(e.has(s))return e.get(s)===t;if(e.set(s,t),Array.isArray(s)&&Array.isArray(t)){if(s.length!==t.length)return!1;for(let r=0;r<s.length;r++)if(!Et(s[r],t[r],e))return!1;return!0}const n=Reflect.ownKeys(s);if(n.length!==Reflect.ownKeys(t).length)return!1;for(const r of n){if(!Reflect.has(t,r))return!1;const o=s[r],i=t[r];if(!Et(o,i,e))return!1}return!0},Qt=s=>{const t=[];let e=s;for(;e;){const n=wt.get(e);if(!n||n.key==null)break;t.unshift(n.key),e=n.parent}return t},Be=s=>s.map(t=>{if(t==="")return/^.*$/;const e=t.replace(/\./g,"\\.").replace(/\*\*/g,"(.+)").replace(/\*/g,"[^.]+").replace(/\[\d+\]/g,"\\[\\d+\\]");return new RegExp(`^${e}$`)}),je=(s,t)=>{if(t.length===0)return!0;const e=s.map(String).join(".");return t.some(n=>n.test(e))},W=(s,t)=>{const e=Qt(s);let n=s;for(;n;){const r=G.get(n);r&&r.forEach(i=>{var h;if(!i.active)return;const l=Qt(n),a=[...l,...e.slice(l.length)];if(!je(a,i.filterRegexes))return;const c={...t,path:a};i.throttle>0?(i.pending.push(c),i.timer||(i.timer=setTimeout(()=>{var m;if(!i.active)return;const u=[...i.pending];i.pending=[],i.timer=null,u.length>0&&((m=i.onBatch)==null||m.call(i,u),u.forEach($=>i.callback($)))},i.throttle))):((h=i.onBatch)==null||h.call(i,[c]),i.callback(c))});const o=wt.get(n);n=(o==null?void 0:o.parent)||null}};function te(s,t,e={}){const{throttle:n=0,onBatch:r,immediate:o=!1,deepCompare:i=!1}=e,l=Array.isArray(e.filter)?e.filter:e.filter?[e.filter]:[],a=Be(l),c={callback:t,onBatch:r,throttle:n,filterRegexes:a,pending:[],timer:null,active:!0},h=(f,d)=>{const S={};return["push","pop","shift","unshift","splice"].forEach(g=>{S[g]=function(...b){if(!d)return;const y=B.get(d)||0;B.set(d,y+1);const E=f[g].apply(f,b);if(B.set(d,y),g==="push")W(d,{type:"array-push",index:f.length-b.length,values:b});else if(g==="unshift")W(d,{type:"array-push",index:0,values:b});else if(g==="pop")W(d,{type:"array-splice",index:f.length,deleteCount:1,insert:[]});else if(g==="shift")W(d,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if(g==="splice"){const[v,R,...L]=b;W(d,{type:"array-splice",index:v,deleteCount:R,insert:L})}return E}}),["sort","reverse","fill","copyWithin"].forEach(g=>{S[g]=function(...b){if(!d)return;const y=B.get(d)||0;B.set(d,y+1);const E=f[g].apply(f,b);return B.set(d,y),W(d,{type:"array-reset",method:g}),E}}),["indexOf","lastIndexOf","includes"].forEach(g=>{S[g]=function(b,...y){let E=f[g].apply(f,[b,...y]);return(E===-1||E===!1)&&Xt(b)&&(E=f[g].apply(f,[Zt(b),...y])),E}}),S},u=(f,d,S)=>{if(!Object.isExtensible(f)||Jt(f)||f[at])return f;const g=Ht.get(f);if(g)return g;const b={get(E,v,R){if(v===at)return E;if(Array.isArray(E)){const P=Yt.get(y);if(P&&Object.prototype.hasOwnProperty.call(P,v))return Reflect.get(P,v,R)}const L=Reflect.get(E,v,R);return typeof v=="symbol"?L:V(L)&&!Jt(L)?u(L,y,v):L},set(E,v,R,L){const P=E[v];if(i?Et(P,R):P===R)return!0;const ft=Reflect.set(E,v,R,L);return(B.get(y)||0)===0&&(Array.isArray(P)&&Array.isArray(R)?W(y,{type:"array-replace",oldValue:P,newValue:R}):W(y,{type:"set",key:v,newValue:R,oldValue:P})),ft},deleteProperty(E,v){if(!Reflect.has(E,v))return!1;const R=E[v],L=Reflect.deleteProperty(E,v),P=B.get(y)||0;return L&&P===0&&W(y,{type:"delete",key:v,oldValue:R}),L}},y=new Proxy(f,b);return Ht.set(f,y),wt.set(y,{parent:d,key:S}),Array.isArray(f)&&Yt.set(y,h(f,y)),y},m=u(s,null,null);let $=G.get(m);if($||($=new Set,G.set(m,$)),$.add(c),o){const f=(d,S,g=new WeakSet)=>{!V(d)||g.has(d)||(g.add(d),Reflect.ownKeys(d).forEach(b=>{const y=d[b];V(y)&&g.has(y)||(W(S,{type:"set",key:b,newValue:y,oldValue:void 0}),V(y)&&f(y,u(y,S,b),g))}))};f(s,m)}return{proxy:m,unobserve:()=>{c.active=!1,c.pending=[],c.timer&&(clearTimeout(c.timer),c.timer=null);const f=G.get(m);f&&f.delete(c)},resume:()=>{if(c.active)return;c.active=!0;let f=G.get(m);f||(f=new Set,G.set(m,f)),f.has(c)||f.add(c)},dispose:()=>{c.active=!1,c.pending=[],c.timer&&(clearTimeout(c.timer),c.timer=null);const f=G.get(m);f&&f.delete(c),c.callback=()=>{},c.onBatch=void 0}}}const ct=Symbol("solely.irCtx"),lt=Symbol("solely.irEvents"),T=Symbol.for("solely.irMeta"),vt=Symbol("solely.prevClassObj"),$t=Symbol("solely.prevStyleObj"),Ge={xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},ee={readonly:"readOnly",for:"htmlFor",tabindex:"tabIndex",contenteditable:"contentEditable",maxlength:"maxLength"},qe=new Set(["data-","aria-","role","form"]),Ke=new Set(["value","selectedIndex"]);function Ue(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 ze(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?ne(n.value):{};for(const i in r){const l=r[i];i.startsWith("--")?s.style.setProperty(i,l):s.style[i]=l}}const He=(s,t)=>{const e=s,n=ne(t),r=e[$t];if(!r){for(const i in n){const l=n[i];i.startsWith("--")?s.style.setProperty(i,l):s.style[i]=l}e[$t]=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 l=n[i],a=r[i];l!==a&&(i.startsWith("--")?s.style.setProperty(i,l):s.style[i]=l,o=!0)}o&&(e[$t]=n)},Ye=(s,t)=>{const e=s,n=e[vt],r=Ze(t);if(!n){for(const i in r)s.classList.add(i);e[vt]=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[vt]=r)};function ne(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 l=i[1].trim(),a=i[2].trim();l&&a&&(t[l]=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 l=r?`${r}-${o}`:o;typeof i=="object"&&!Array.isArray(i)?e.push([i,l]):t[l]=String(i)}}}return t}function Ze(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 St(s,t,e){const n=e==null?"":String(e),r=t.indexOf(":");if(r>0){const o=t.slice(0,r),i=Ge[o];if(i){s.getAttributeNS(i,t)!==n&&s.setAttributeNS(i,t,n);return}}s.getAttribute(t)!==n&&s.setAttribute(t,n)}function se(s,t,e){const n=ee[t]||t;if(t.startsWith("data-")||t.startsWith("aria-")||qe.has(t)){St(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 l=r[n];l!==""&&l!==void 0&&(r[n]=""),s.hasAttribute(t)&&s.removeAttribute(t)}return}if(n==="src"||n==="href"){const l=String(e);if(r[n]===l||s.getAttribute(n)===l)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)&&!ee[t]?St(s,t,e):r[n]!==e&&(r[n]=e)}class re{constructor(t,e,n={}){C(this,"nodeMap",new Map);C(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 Tt(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[T]):t.txt||"";return document.createTextNode(n)}createComment(t,e){const n=t.dynamic?this.evalIR(t.fid,[e],t[T]):t.txt||"";return document.createComment(n)}applyAttrs(t,e,n,r=!1){const o=[],i=t;i[ct]||(i[ct]={loops:null}),i[ct].loops=n,i[lt]||(i[lt]=Object.create(null));let l,a=!1,c,h=!1;for(const u of e){const{key:m,fid:$,dynamic:f,value:d}=u;if(m===":class"){l=this.evalIR($,[n],u[T]),a=!0;continue}if(m===":style"){c=this.evalIR($,[n],u[T]),h=!0;continue}if(m==="class"||m==="style")continue;const S=m[0];if(S==="@"){const b=m.slice(1),y=u.role??"user";let E=i[lt][b];if(E||(E=i[lt][b]={model:[],user:[]},t.addEventListener(b,v=>{for(const R of E.model)R(v);for(const R of E.user)R(v)})),!r){const v=R=>this.evalIR($,[R,i[ct].loops],u[T]);E[y].push(v)}continue}if(m==="mounted"){r||requestAnimationFrame(()=>this.evalIR($,[t,n],u[T]));continue}if(m==="updated"){r&&requestAnimationFrame(()=>this.evalIR($,[t,n],u[T]));continue}if(m==="ref"&&d){this.scope.$refs=this.scope.$refs||{},this.scope.$refs[d]=t;continue}const g=f?this.evalIR($,[n],u[T]):d??"";if(S===":"){const b=m.slice(1);t.tagName==="SELECT"&&Ke.has(b)?o.push(()=>se(t,b,g)):se(t,b,g)}else r||St(t,m,String(g))}return a&&Ye(t,l),h&&He(t,c),o}updateNode(t,e,n){const r=e.dynamic?this.evalIR(e.fid,[n],e[T]):e.txt||"";e.dynamic&&t.textContent!==r&&(t.textContent=r)}irToNode(t,e,n,r,o){var c,h,u,m;const i=n+"-"+e,l=this.nodeMap.get(i);let a;if(l){a=l.node,l.marker=this.marker;let $=[];t.dynamic&&(t.type===w.Element?$=this.applyAttrs(a,t.attrs??[],o,!0):this.updateNode(a,t,o)),(c=t.children)==null||c.forEach((f,d)=>{this.irToNode(f,d,i,a,o)}),$.forEach(f=>f())}else switch(t.type){case w.Element:a=this.createElement(t,r),Ue(a,t),ze(a,t);const $=this.applyAttrs(a,t.attrs??[],o);r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker}),(h=t.children)==null||h.forEach((f,d)=>{this.irToNode(f,d,i,a,o)}),$.forEach(f=>f());break;case w.Text:a=this.createText(t,o),r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker});break;case w.Comment:a=this.createComment(t,o),r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker});break;case w.For:{const f=`${i}-end`;let d=(u=this.nodeMap.get(f))==null?void 0:u.node;d?this.nodeMap.get(f).marker=this.marker:(d=document.createComment(`for:${i}`),r.appendChild(d),this.nodeMap.set(f,{irNode:{type:w.Comment},node:d,loops:o,marker:this.marker}));const S=this.evalIR(t.fid,[o],t[T])||[],g=document.createDocumentFragment();S.forEach((b,y)=>{var v;const E=[...o,{itmVal:b,idxVal:y}];(v=t.children)==null||v.forEach((R,L)=>{this.irToNode(R,L,`${i}-for-${y}`,g,E)})}),d.parentNode.insertBefore(g,d);break}case w.Conditional:{const f=`${i}-end`;let d=(m=this.nodeMap.get(f))==null?void 0:m.node;d?this.nodeMap.get(f).marker=this.marker:(d=document.createComment(`if:${i}`),r.appendChild(d),this.nodeMap.set(f,{irNode:{},node:d,loops:o,marker:this.marker}));for(let S=0;S<(t.branches||[]).length;S++){const g=t.branches[S];if(g.condFid===null||this.evalIR(g.condFid,[o],g[T])){const y=document.createDocumentFragment();g.children.forEach((E,v)=>{this.irToNode(E,v,`${i}-if-${S}`,y,o)}),d.parentNode.insertBefore(y,d);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[T])});const l=n.attrs.find(a=>a.key==="ref");l&&l.value&&delete this.scope.$refs[l.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=(s,t,e={})=>{const n=new re(s,t,e);return n.mount(),{update:()=>n.update(),destroy:()=>n.destroy()}},oe=Symbol.for("solely.manifest");class tt extends HTMLElement{constructor(e={}){var o;super();_(this,x);_(this,F);_(this,j);_(this,H);_(this,et);_(this,Y);_(this,q);_(this,Z,!1);_(this,J,!1);_(this,K,!1);_(this,nt,!1);const n=this.constructor;M(this,F,n[oe]||{tagName:"base-element"});const r=A(this,F);M(this,Y,(o=r.shadowDOM)!=null&&o.use?this.attachShadow({mode:r.shadowDOM.mode||"open"}):this),O(this,x,Pt).call(this,e),O(this,x,ye).call(this,r),queueMicrotask(()=>O(this,x,Nt).call(this))}static get observedAttributes(){const e=this[oe];return e!=null&&e.propMap?Array.from(e.propMap.keys()):[]}get $data(){return A(this,et)}set $data(e){var n;V(e)||(e={}),(n=A(this,q))==null||n.call(this),O(this,x,Pt).call(this,e),O(this,x,pt).call(this)}refresh(){O(this,x,pt).call(this)}connectedCallback(){var l;const n=this.constructor.upgradeProps;let r;Array.isArray(n)?r=n.includes("$data")?n:[...n,"$data"]:r=["$data"],O(this,x,me).call(this,r),O(this,x,Nt).call(this);const o=A(this,F);if((o.className||o.tagName||"").split(" ").forEach(a=>a&&this.classList.add(a)),O(this,x,we).call(this),o.propMap&&V(this.$data))for(const[a,c]of o.propMap){const h=c.name;if(this.hasAttribute(a)){const u=this.getAttribute(a),m=O(this,x,Ot).call(this,u,c.default,c.type);this.$data[h]=m}else"default"in c&&(this.$data[h]=c.default)}A(this,H)&&M(this,j,ie(A(this,H),A(this,Y),this)),this.mounted(),(l=this.onInit)==null||l.call(this)}disconnectedCallback(){var e,n,r;this.unmounted(),(e=A(this,q))==null||e.call(this),M(this,q,void 0),(r=(n=A(this,j))==null?void 0:n.destroy)==null||r.call(n),M(this,j,null)}attributeChangedCallback(e,n,r){var h;if(n===r||!V(this.$data))return;const i=(h=A(this,F).propMap)==null?void 0:h.get(e);if(!i)return;const l=i.name,a=this.$data[l],c=O(this,x,Ot).call(this,r,i.default??a,i.type);this.$data[l]=c,M(this,K,!0),this.attributeChanged(e,a,c)}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(){}}F=new WeakMap,j=new WeakMap,H=new WeakMap,et=new WeakMap,Y=new WeakMap,q=new WeakMap,Z=new WeakMap,J=new WeakMap,K=new WeakMap,nt=new WeakMap,x=new WeakSet,me=function(e){for(const n of e)if(this.hasOwnProperty(n)){const r=this[n];delete this[n],this[n]=r}},Pt=function(e){const{proxy:n,dispose:r}=te(e,o=>{var i,l;if(o.type==="set"){const{key:a,newValue:c}=o,h=A(this,F),u=String(a),m=((i=h.propMap)==null?void 0:i.get(u.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()))||Array.from(((l=h.propMap)==null?void 0:l.values())||[]).find($=>$.name===u);m!=null&&m.reflect&&O(this,x,ge).call(this,m,c)}this.emit("change",{source:"state",...o}),O(this,x,pt).call(this)});M(this,et,n),M(this,q,r)},ge=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)}},ye=function(e){e.ir&&M(this,H,e.ir)},Ot=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}},pt=function(){A(this,J)||!A(this,j)||(M(this,J,!0),queueMicrotask(()=>{M(this,J,!1),O(this,x,be).call(this)}))},be=function(){A(this,Z)||!this.isConnected||(M(this,Z,!0),A(this,K)&&this.beforeAttributesUpdate(),this.beforeUpdate(),A(this,j).update(),this.updated(),A(this,K)&&(this.afterAttributesUpdate(),M(this,K,!1)),M(this,Z,!1))},we=function(){const e=A(this,F);if(!e.styles)return;const n=A(this,Y);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)}},Nt=function(){A(this,nt)||(M(this,nt,!0),this.created())},Ct=new WeakMap,C(tt,"upgradeProps"),_(tt,Ct,!1);const Je=Symbol.for("solely.manifest"),kt=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=zt(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 l=typeof i=="string"?{name:i}:i,a=l.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c=a.replace(/-([a-z])/g,(h,u)=>u.toUpperCase());o.set(a,{...l,name:c})}),t.propMap=o}class r extends e{}return r[Je]=t,customElements.define(n,r),r}};let z=null,ae;const Rt=new Promise(s=>{ae=s});function Xe(s){return z||(z=new ce(s),ae(z),z)}function ut(){return z}class ce{constructor(t){C(this,"routes");C(this,"base");C(this,"mode");C(this,"beforeEachGuard");C(this,"afterEachGuard");C(this,"currentRoute",null);C(this,"listeners",new Set);C(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),l=this.recursiveMatch(this.routes,o);if(l){const a=l.matched[l.matched.length-1];return a.config.redirect?this.matchRoute(a.config.redirect):{matched:l.matched,params:l.params,query:i,fullPath:e,meta:l.matched.reduce((c,h)=>({...c,...h.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 l=!0;if(o.length===0&&e.length===0)return{matched:[{config:r,params:{}}],params:{}};for(let a=0;a<o.length;a++){const c=o[a],h=e[a];if(c.startsWith(":")){if(!h){l=!1;break}i[c.slice(1)]=h}else if(c==="*"){l=!0;break}else if(c!==h){l=!1;break}}if(l){const a=o.length,c=e.slice(a),h={config:r,params:i};if(c.length>0&&r.children){const u=this.recursiveMatch(r.children,c);if(u)return{matched:[h,...u.matched],params:{...i,...u.params}}}else if(c.length===0||o.includes("*"))return{matched:[h],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 l=await this.beforeEachGuard(i,o);if(l===!1)return{success:!1,cancelled:!0};if(typeof l=="string")return this.navigate(l,e)}catch(l){return{success:!1,error:l instanceof Error?l.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 Qe=Object.getOwnPropertyDescriptor,tn=(s,t,e,n)=>{for(var r=n>1?void 0:n?Qe(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=i(r)||r);return r};let ht=class extends tt{constructor(){super(...arguments);C(this,"unsubscribe");C(this,"level",0);C(this,"currentElement",null);C(this,"currentTagName",null);C(this,"routerAttrs",new Set);C(this,"prevPropKeys",new Set);C(this,"scheduled",!1);C(this,"cache",new Map);C(this,"latestLoadId",0)}async mounted(){this.detectLevel();const t=await Rt;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 ht&&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 l=await r.component();o=typeof l=="string"?l:l.tagName}catch(l){this.renderError(`Load Error: ${l}`);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,c])=>i.set(o(a),String(c))),Object.entries(n).forEach(([a,c])=>i.set(`query-${o(a)}`,String(c))),this.routerAttrs.forEach(a=>{i.has(a)||(t.removeAttribute(a),this.routerAttrs.delete(a))}),i.forEach((a,c)=>{t.getAttribute(c)!==a&&t.setAttribute(c,a),this.routerAttrs.add(c)});const l=new Set(Object.keys(r));this.prevPropKeys.forEach(a=>{l.has(a)||(t[a]=void 0)}),Object.entries(r).forEach(([a,c])=>{t[a]!==c&&(t[a]=c)}),this.prevPropKeys=l}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()}};ht=tn([kt({tagName:"router-view"})],ht);const en=ht;var nn=Object.getOwnPropertyDescriptor,sn=(s,t,e,n)=>{for(var r=n>1?void 0:n?nn(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=i(r)||r);return r};let xt=class extends tt{constructor(){super(...arguments);C(this,"_prefetched",!1)}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){(await Rt).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=ut())==null||o.push(this.$data.to))}),this.addEventListener("mouseenter",()=>{this.prefetchRoute()},{once:!0})}updateState(){const t=ut();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=ut();t&&typeof t.prefetch=="function"&&(t.prefetch(this.$data.to),this._prefetched=!0)}};xt=sn([kt({tagName:"router-link",template:`
|
|
22
|
+
}`),l("@change",`${e} = Array.from(event.target.selectedOptions).map(o => o.value)`,"model")):(l(":value",e),l("@change",`${e} = value`,"model"));return}l(":value",e),l("@input",`${e} = $event`,"model")}function ct(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:l,role:a}=o,{isDynamic:c,type:h}=Kt(i);if(c&&h){const u=e.compile(h,l??"",t),m={key:i,fid:u,dynamic:1,role:a};wt(m,l,o.loc??s.loc),r.push(m)}else r.push({key:i,value:l,dynamic:0,role:a})}return r}function _e(s,t,e){var o,i,l,a,c,h;const n={type:s.type,dynamic:0};let r=!1;switch(s.type===w.Text?Oe(s.content)&&(r=!0):((o=s.attrs)!=null&&o.some(u=>u.key==="s-model"||Kt(u.key).isDynamic)&&(r=!0),s.type===w.For&&(r=!0)),n.dynamic=r?1:0,s.type){case w.Text:{const u=s.content??"";r?(n.fid=e.compile("template",u,t),wt(n,u,s.loc)):n.txt=u;break}case w.Element:{n.tag=s.tag,Ut(s),n.attrs=ct(s,t,e),s.children&&(n.children=tt(s.children,t,e));break}case w.For:{const u=(i=s.attrs)==null?void 0:i.find(d=>d.key==="each"),m=(u==null?void 0:u.value)??"";n.fid=e.compile("expression",m,t),n.item=((a=(l=s.attrs)==null?void 0:l.find(d=>d.key==="item"))==null?void 0:a.value)??"item",n.index=((h=(c=s.attrs)==null?void 0:c.find(d=>d.key==="index"))==null?void 0:h.value)??"index",wt(n,m,(u==null?void 0:u.loc)??s.loc);const $=new Set(["each","item","index"]);n.attrs=ct(s,t,e,$);const f=[...t,{item:n.item,index:n.index}];s.children&&(n.children=tt(s.children,f,e));break}case w.If:case w.ElseIf:case w.Else:{N&&console.warn(`[IR] Orphaned conditional node found: ${w[s.type]}`),n.attrs=ct(s,t,e),s.children&&(n.children=tt(s.children,t,e));break}case w.Comment:{n.txt=s.content??"";break}}return n}function tt(s,t,e){var o;const n=[];let r=0;for(;r<s.length;){const i=s[r];if(i.type===w.If){const l=[];let a=r;for(;a<s.length;){const c=s[a],h=c.type;if(h!==w.If&&h!==w.ElseIf&&h!==w.Else||h===w.If&&l.length>0)break;let u=null,m="",$=null;if(h!==w.Else){const g=(o=c.attrs)==null?void 0:o.find(b=>b.key==="test"||b.key==="condition");m=(g==null?void 0:g.value)??"false",u=e.compile("expression",m,t),$=(g==null?void 0:g.loc)??c.loc}const f=c.children?tt(c.children,t,e):[],S=ct(c,t,e,new Set(["test","condition"]));if(l.push({condFid:u,children:f,attrs:S.length>0?S:void 0,[bt]:N?{expr:m,loc:$}:void 0}),a++,h===w.Else)break}n.push({type:w.Conditional,dynamic:1,branches:l,...N&&{[bt]:{loc:i.loc}}}),r=a}else n.push(_e(i,t,e)),r++}return n}function qt(s,t={}){const{filename:e="anonymous",source:n}=t,r=Gt.get(e);r.clear();const o=performance.now(),i=tt(s,[],r),l=performance.now(),a=r.getStats(),c=i.filter(u=>u.dynamic===1).length,h={type:"root",version:"1.1.0",functions:r.getFunctions(),nodes:i,stats:{totalFunctions:a.total,cachedFunctions:a.cached,dynamicNodes:c,totalNodes:i.length},metadata:{compiledAt:new Date().toISOString(),astSize:s.length,filename:e,...n&&{source:n}}};return N&&console.log(`[IRBuilder] ${e} | ${(l-o).toFixed(2)}ms | Nodes: ${i.length} | Fns: ${a.total}`),h}function Ne(s){Gt.clear(s)}const Te=/<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/,We=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),De=/\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;function Fe(s,t){const e=[];let n;const r=s.replace(/^\s*[^\s"'/>]+/,""),o=s.length-r.length;for(;(n=De.exec(r))!==null;){const i=n[1];if(!i)continue;const l=n[2]??n[3]??n[4]??"";let a=i;Ft.has(i)&&(a=a.replace(/^on/,"@")),a!=="s-model"&&(a=a.replace(/^on-/,"@").replace(/^s-/,":")),a=Bt(a)||a;const c=n[0],h=c.indexOf("=");let u;if(h===-1)u=c.indexOf(i)+i.length;else{let g=h+1;for(;g<c.length&&/\s/.test(c[g]);)g++;if(c[g]==='"'||c[g]==="'"){let b=g+1;for(;b<c.length&&/\s/.test(c[b]);)b++;u=b}else{let b=g;for(;b<c.length&&/\s/.test(c[b]);)b++;u=b}}let m=n.index+u+o;const f=s.slice(0,m).split(`
|
|
23
|
+
`),d=t[0]+f.length-1,S=f.length>1?f[f.length-1].length+1:t[1]+m;e.push({key:a,value:l,loc:[d,S]})}return e}function Ve(s,t){var i;const e=((i=(s.match(Te)||[])[1])==null?void 0:i.toLowerCase())??"",n=Fe(s,t);return{type:{for:w.For,if:w.If,elseif:w.ElseIf,else:w.Else}[e]??w.Element,tag:e,loc:t,children:[],attrs:n}}function Be(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 zt(s){const t=[];if(!s)return[];const e=[],n=[],r=()=>{var c;return e.length===0?t:(c=e[e.length-1]).children||(c.children=[])};let o=0;const i=s.length,l=[0];for(let c=0;c<i;c++)s[c]===`
|
|
24
|
+
`&&l.push(c+1);function a(c){let h=0;for(let u=1;u<l.length&&!(l[u]>c);u++)h=u;return[h+1,c-l[h]+1]}for(;o<i;){const c=s.indexOf("<",o);if(c===-1||c>o){const y=s.substring(o,c===-1?void 0:c),E=y.trim();if(E){const v=y.indexOf(E),C=o+v,L=a(C);r().push({type:w.Text,tag:"text",content:E,loc:L,children:[]})}if(c===-1)break;o=c}const h=Be(s,o+1);if(h===-1){const y=s.substring(o);y.trim()&&r().push({type:w.Text,tag:"text",content:y.trim(),children:[],loc:a(o)});break}const u=s.substring(o,h+1),m=r(),$=a(o);if(u.startsWith("<!--")){m.push({type:w.Comment,tag:"comment",content:u.slice(4,-3),loc:$,children:[]}),o=h+1;continue}if(u.startsWith("<![CDATA[")){m.push({type:w.Text,tag:"text",content:u.slice(9,-3),loc:$,children:[]}),o=h+1;continue}if(u.startsWith("<!")&&!u.startsWith("<!--")){m.push({type:w.Comment,tag:"comment",content:u.slice(2,-1),loc:$,children:[]}),o=h+1;continue}if(u.startsWith("<?")){m.push({type:w.Comment,tag:"comment",content:u.slice(2,-2),loc:$,children:[]}),o=h+1;continue}if(u.startsWith("</")){const y=n.pop();for(;e.length>0;){if((e[e.length-1].tag||"").toLowerCase()===(y==null?void 0:y.toLowerCase())){e.pop();break}e.pop()}o=h+1;continue}const f=Ve(u,$);m.push(f);const d=f.tag||"",S=d.toLowerCase().startsWith("script"),g=d.toLowerCase().startsWith("style"),b=u.endsWith("/>")||We.has(d.toLowerCase());if((S||g)&&!b){const y=`</${d}>`,E=s.toLowerCase().indexOf(y,h+1);if(E!==-1){const v=s.substring(h+1,E);v.length&&f.children.push({type:w.Text,tag:"text",content:v,loc:a(h+1),children:[]}),o=E+y.length;continue}else{const v=s.substring(h+1);v.length&&f.children.push({type:w.Text,tag:"text",content:v,loc:a(h+1),children:[]}),o=i;continue}}!b&&f.type!==w.Text&&f.type!==w.Comment&&(e.push(f),n.push(d)),o=h+1}return t}const lt=Symbol("solely.raw"),U=new WeakMap,Ht=new WeakMap,Et=new WeakMap,Yt=new WeakMap,G=new WeakMap;function Zt(s){if(s&&typeof s=="object"){const t=s[lt];if(t)return t}return s}const Jt=s=>!s||typeof s!="object"?!1:s instanceof File||s instanceof Blob||s instanceof FormData||s instanceof ArrayBuffer||s instanceof Response||s instanceof Request;function Xt(s){return!!(s&&s[lt])}const vt=(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))return!1;if(e.has(s))return e.get(s)===t;if(e.set(s,t),Array.isArray(s)&&Array.isArray(t)){if(s.length!==t.length)return!1;for(let r=0;r<s.length;r++)if(!vt(s[r],t[r],e))return!1;return!0}const n=Reflect.ownKeys(s);if(n.length!==Reflect.ownKeys(t).length)return!1;for(const r of n){if(!Reflect.has(t,r))return!1;const o=s[r],i=t[r];if(!vt(o,i,e))return!1}return!0},Qt=s=>{const t=[];let e=s;for(;e;){const n=Et.get(e);if(!n||n.key==null)break;t.unshift(n.key),e=n.parent}return t},je=s=>s.map(t=>{if(t==="")return/^.*$/;const e=t.replace(/\./g,"\\.").replace(/\*\*/g,"(.+)").replace(/\*/g,"[^.]+").replace(/\[\d+\]/g,"\\[\\d+\\]");return new RegExp(`^${e}$`)}),Ge=(s,t)=>{if(t.length===0)return!0;const e=s.map(String).join(".");return t.some(n=>n.test(e))},D=(s,t)=>{const e=Qt(s);let n=s;for(;n;){const r=U.get(n);r&&r.forEach(i=>{var h;if(!i.active)return;const l=Qt(n),a=[...l,...e.slice(l.length)];if(!Ge(a,i.filterRegexes))return;const c={...t,path:a};i.throttle>0?(i.pending.push(c),i.timer||(i.timer=setTimeout(()=>{var m;if(!i.active)return;const u=[...i.pending];i.pending=[],i.timer=null,u.length>0&&((m=i.onBatch)==null||m.call(i,u),u.forEach($=>i.callback($)))},i.throttle))):((h=i.onBatch)==null||h.call(i,[c]),i.callback(c))});const o=Et.get(n);n=(o==null?void 0:o.parent)||null}};function te(s,t,e={}){const{throttle:n=0,onBatch:r,immediate:o=!1,deepCompare:i=!1}=e,l=Array.isArray(e.filter)?e.filter:e.filter?[e.filter]:[],a=je(l),c={callback:t,onBatch:r,throttle:n,filterRegexes:a,pending:[],timer:null,active:!0},h=(f,d)=>{const S={};return["push","pop","shift","unshift","splice"].forEach(g=>{S[g]=function(...b){if(!d)return;const y=G.get(d)||0;G.set(d,y+1);const E=f[g].apply(f,b);if(G.set(d,y),g==="push")D(d,{type:"array-push",index:f.length-b.length,values:b});else if(g==="unshift")D(d,{type:"array-push",index:0,values:b});else if(g==="pop")D(d,{type:"array-splice",index:f.length,deleteCount:1,insert:[]});else if(g==="shift")D(d,{type:"array-splice",index:0,deleteCount:1,insert:[]});else if(g==="splice"){const[v,C,...L]=b;D(d,{type:"array-splice",index:v,deleteCount:C,insert:L})}return E}}),["sort","reverse","fill","copyWithin"].forEach(g=>{S[g]=function(...b){if(!d)return;const y=G.get(d)||0;G.set(d,y+1);const E=f[g].apply(f,b);return G.set(d,y),D(d,{type:"array-reset",method:g}),E}}),["indexOf","lastIndexOf","includes"].forEach(g=>{S[g]=function(b,...y){let E=f[g].apply(f,[b,...y]);return(E===-1||E===!1)&&Xt(b)&&(E=f[g].apply(f,[Zt(b),...y])),E}}),S},u=(f,d,S)=>{if(!Object.isExtensible(f)||Jt(f)||f[lt])return f;const g=Ht.get(f);if(g)return g;const b={get(E,v,C){if(v===lt)return E;if(Array.isArray(E)){const P=Yt.get(y);if(P&&Object.prototype.hasOwnProperty.call(P,v))return Reflect.get(P,v,C)}const L=Reflect.get(E,v,C);return typeof v=="symbol"?L:j(L)&&!Jt(L)?u(L,y,v):L},set(E,v,C,L){const P=E[v];if(i?vt(P,C):P===C)return!0;const pt=Reflect.set(E,v,C,L);return(G.get(y)||0)===0&&(Array.isArray(P)&&Array.isArray(C)?D(y,{type:"array-replace",oldValue:P,newValue:C}):D(y,{type:"set",key:v,newValue:C,oldValue:P})),pt},deleteProperty(E,v){if(!Reflect.has(E,v))return!1;const C=E[v],L=Reflect.deleteProperty(E,v),P=G.get(y)||0;return L&&P===0&&D(y,{type:"delete",key:v,oldValue:C}),L}},y=new Proxy(f,b);return Ht.set(f,y),Et.set(y,{parent:d,key:S}),Array.isArray(f)&&Yt.set(y,h(f,y)),y},m=u(s,null,null);let $=U.get(m);if($||($=new Set,U.set(m,$)),$.add(c),o){const f=(d,S,g=new WeakSet)=>{!j(d)||g.has(d)||(g.add(d),Reflect.ownKeys(d).forEach(b=>{const y=d[b];j(y)&&g.has(y)||(D(S,{type:"set",key:b,newValue:y,oldValue:void 0}),j(y)&&f(y,u(y,S,b),g))}))};f(s,m)}return{proxy:m,unobserve:()=>{c.active=!1,c.pending=[],c.timer&&(clearTimeout(c.timer),c.timer=null);const f=U.get(m);f&&f.delete(c)},resume:()=>{if(c.active)return;c.active=!0;let f=U.get(m);f||(f=new Set,U.set(m,f)),f.has(c)||f.add(c)},dispose:()=>{c.active=!1,c.pending=[],c.timer&&(clearTimeout(c.timer),c.timer=null);const f=U.get(m);f&&f.delete(c),c.callback=()=>{},c.onBatch=void 0}}}const ut=Symbol("solely.irCtx"),ht=Symbol("solely.irEvents"),T=Symbol.for("solely.irMeta"),$t=Symbol("solely.prevClassObj"),St=Symbol("solely.prevStyleObj"),Ke={xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},ee={readonly:"readOnly",for:"htmlFor",tabindex:"tabIndex",contenteditable:"contentEditable",maxlength:"maxLength"},Ue=new Set(["data-","aria-","role","form"]),qe=new Set(["value","selectedIndex"]);function ze(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 He(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?ne(n.value):{};for(const i in r){const l=r[i];i.startsWith("--")?s.style.setProperty(i,l):s.style[i]=l}}const Ye=(s,t)=>{const e=s,n=ne(t),r=e[St];if(!r){for(const i in n){const l=n[i];i.startsWith("--")?s.style.setProperty(i,l):s.style[i]=l}e[St]=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 l=n[i],a=r[i];l!==a&&(i.startsWith("--")?s.style.setProperty(i,l):s.style[i]=l,o=!0)}o&&(e[St]=n)},Ze=(s,t)=>{const e=s,n=e[$t],r=Je(t);if(!n){for(const i in r)s.classList.add(i);e[$t]=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[$t]=r)};function ne(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 l=i[1].trim(),a=i[2].trim();l&&a&&(t[l]=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 l=r?`${r}-${o}`:o;typeof i=="object"&&!Array.isArray(i)?e.push([i,l]):t[l]=String(i)}}}return t}function Je(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 kt(s,t,e){const n=e==null?"":String(e),r=t.indexOf(":");if(r>0){const o=t.slice(0,r),i=Ke[o];if(i){s.getAttributeNS(i,t)!==n&&s.setAttributeNS(i,t,n);return}}s.getAttribute(t)!==n&&s.setAttribute(t,n)}function se(s,t,e){const n=ee[t]||t;if(t.startsWith("data-")||t.startsWith("aria-")||Ue.has(t)){kt(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 l=r[n];l!==""&&l!==void 0&&(r[n]=""),s.hasAttribute(t)&&s.removeAttribute(t)}return}if(n==="src"||n==="href"){const l=String(e);if(r[n]===l||s.getAttribute(n)===l)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)&&!ee[t]?kt(s,t,e):r[n]!==e&&(r[n]=e)}class re{constructor(t,e,n={}){x(this,"nodeMap",new Map);x(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 Tt(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[T]):t.txt||"";return document.createTextNode(n)}createComment(t,e){const n=t.dynamic?this.evalIR(t.fid,[e],t[T]):t.txt||"";return document.createComment(n)}applyAttrs(t,e,n,r=!1){const o=[],i=t;i[ut]||(i[ut]={loops:null}),i[ut].loops=n,i[ht]||(i[ht]=Object.create(null));let l,a=!1,c,h=!1;for(const u of e){const{key:m,fid:$,dynamic:f,value:d}=u;if(m===":class"){l=this.evalIR($,[n],u[T]),a=!0;continue}if(m===":style"){c=this.evalIR($,[n],u[T]),h=!0;continue}if(m==="class"||m==="style")continue;const S=m[0];if(S==="@"){const b=m.slice(1),y=u.role??"user";let E=i[ht][b];if(E||(E=i[ht][b]={model:[],user:[]},t.addEventListener(b,v=>{for(const C of E.model)C(v);for(const C of E.user)C(v)})),!r){const v=C=>this.evalIR($,[C,i[ut].loops],u[T]);E[y].push(v)}continue}if(m==="mounted"){r||requestAnimationFrame(()=>this.evalIR($,[t,n],u[T]));continue}if(m==="updated"){r&&requestAnimationFrame(()=>this.evalIR($,[t,n],u[T]));continue}if(m==="ref"&&d){this.scope.$refs=this.scope.$refs||{},this.scope.$refs[d]=t;continue}const g=f?this.evalIR($,[n],u[T]):d??"";if(S===":"){const b=m.slice(1);t.tagName==="SELECT"&&qe.has(b)?o.push(()=>se(t,b,g)):se(t,b,g)}else r||kt(t,m,String(g))}return a&&Ze(t,l),h&&Ye(t,c),o}updateNode(t,e,n){const r=e.dynamic?this.evalIR(e.fid,[n],e[T]):e.txt||"";e.dynamic&&t.textContent!==r&&(t.textContent=r)}irToNode(t,e,n,r,o){var c,h,u,m;const i=n+"-"+e,l=this.nodeMap.get(i);let a;if(l){a=l.node,l.marker=this.marker;let $=[];t.dynamic&&(t.type===w.Element?$=this.applyAttrs(a,t.attrs??[],o,!0):this.updateNode(a,t,o)),(c=t.children)==null||c.forEach((f,d)=>{this.irToNode(f,d,i,a,o)}),$.forEach(f=>f())}else switch(t.type){case w.Element:a=this.createElement(t,r),ze(a,t),He(a,t);const $=this.applyAttrs(a,t.attrs??[],o);r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker}),(h=t.children)==null||h.forEach((f,d)=>{this.irToNode(f,d,i,a,o)}),$.forEach(f=>f());break;case w.Text:a=this.createText(t,o),r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker});break;case w.Comment:a=this.createComment(t,o),r.appendChild(a),this.nodeMap.set(i,{irNode:t,node:a,loops:o,marker:this.marker});break;case w.For:{const f=`${i}-end`;let d=(u=this.nodeMap.get(f))==null?void 0:u.node;d?this.nodeMap.get(f).marker=this.marker:(d=document.createComment(`for:${i}`),r.appendChild(d),this.nodeMap.set(f,{irNode:{type:w.Comment},node:d,loops:o,marker:this.marker}));const S=this.evalIR(t.fid,[o],t[T])||[],g=document.createDocumentFragment();S.forEach((b,y)=>{var v;const E=[...o,{itmVal:b,idxVal:y}];(v=t.children)==null||v.forEach((C,L)=>{this.irToNode(C,L,`${i}-for-${y}`,g,E)})}),d.parentNode.insertBefore(g,d);break}case w.Conditional:{const f=`${i}-end`;let d=(m=this.nodeMap.get(f))==null?void 0:m.node;d?this.nodeMap.get(f).marker=this.marker:(d=document.createComment(`if:${i}`),r.appendChild(d),this.nodeMap.set(f,{irNode:{},node:d,loops:o,marker:this.marker}));for(let S=0;S<(t.branches||[]).length;S++){const g=t.branches[S];if(g.condFid===null||this.evalIR(g.condFid,[o],g[T])){const y=document.createDocumentFragment();g.children.forEach((E,v)=>{this.irToNode(E,v,`${i}-if-${S}`,y,o)}),d.parentNode.insertBefore(y,d);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[T])});const l=n.attrs.find(a=>a.key==="ref");l&&l.value&&delete this.scope.$refs[l.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=(s,t,e={})=>{const n=new re(s,t,e);return n.mount(),{update:()=>n.update(),destroy:()=>n.destroy()}},oe=Symbol.for("solely.manifest"),rt=class rt extends HTMLElement{constructor(e={}){var o;super();W(this,R);W(this,F);W(this,K);W(this,Y);W(this,nt);W(this,Z);W(this,q);W(this,J,!1);W(this,X,!1);W(this,z,!1);W(this,st,!1);const n=this.constructor;M(this,F,n[oe]||{tagName:"base-element"});const r=A(this,F);M(this,Z,(o=r.shadowDOM)!=null&&o.use?this.attachShadow({mode:r.shadowDOM.mode||"open"}):this),O(this,R,Pt).call(this,e),O(this,R,ye).call(this,r),queueMicrotask(()=>O(this,R,_t).call(this))}static get observedAttributes(){const e=this[oe];return e!=null&&e.propMap?Array.from(e.propMap.keys()):[]}get $data(){return A(this,nt)}set $data(e){var n;j(e)||(e={}),(n=A(this,q))==null||n.call(this),O(this,R,Pt).call(this,e),O(this,R,gt).call(this)}refresh(){O(this,R,gt).call(this)}connectedCallback(){var l;const n=this.constructor.upgradeProps;let r;Array.isArray(n)?r=n.includes("$data")?n:[...n,"$data"]:r=["$data"],O(this,R,me).call(this,r),O(this,R,_t).call(this);const o=A(this,F);if((o.className||o.tagName||"").split(" ").forEach(a=>a&&this.classList.add(a)),O(this,R,we).call(this),o.propMap&&j(this.$data))for(const[a,c]of o.propMap){const h=c.name;if(this.hasAttribute(a)){const u=this.getAttribute(a),m=O(this,R,Ot).call(this,u,c.default,c.type);this.$data[h]=m}else"default"in c&&(this.$data[h]=c.default)}A(this,Y)&&M(this,K,ie(A(this,Y),A(this,Z),this)),this.mounted(),(l=this.onInit)==null||l.call(this)}disconnectedCallback(){var e,n,r;this.unmounted(),(e=A(this,q))==null||e.call(this),M(this,q,void 0),(r=(n=A(this,K))==null?void 0:n.destroy)==null||r.call(n),M(this,K,null)}attributeChangedCallback(e,n,r){var h;if(n===r||!j(this.$data))return;const i=(h=A(this,F).propMap)==null?void 0:h.get(e);if(!i)return;const l=i.name,a=this.$data[l],c=O(this,R,Ot).call(this,r,i.default??a,i.type);this.$data[l]=c,M(this,z,!0),this.attributeChanged(e,a,c)}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(){}};F=new WeakMap,K=new WeakMap,Y=new WeakMap,nt=new WeakMap,Z=new WeakMap,q=new WeakMap,J=new WeakMap,X=new WeakMap,z=new WeakMap,st=new WeakMap,R=new WeakSet,me=function(e){for(const n of e)if(this.hasOwnProperty(n)){const r=this[n];delete this[n],this[n]=r}},Pt=function(e){const{proxy:n,dispose:r}=te(e,o=>{var i,l;if(o.type==="set"){const{key:a,newValue:c}=o,h=A(this,F),u=String(a),m=((i=h.propMap)==null?void 0:i.get(u.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()))||Array.from(((l=h.propMap)==null?void 0:l.values())||[]).find($=>$.name===u);m!=null&&m.reflect&&O(this,R,ge).call(this,m,c)}this.emit("change",{source:"state",...o}),O(this,R,gt).call(this)});M(this,nt,n),M(this,q,r)},ge=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)}},ye=function(e){e.ir&&M(this,Y,e.ir)},Ot=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(){A(this,X)||!A(this,K)||(M(this,X,!0),queueMicrotask(()=>{M(this,X,!1),O(this,R,be).call(this)}))},be=function(){A(this,J)||!this.isConnected||(M(this,J,!0),A(this,z)&&this.beforeAttributesUpdate(),this.beforeUpdate(),A(this,K).update(),this.updated(),A(this,z)&&(this.afterAttributesUpdate(),M(this,z,!1)),M(this,J,!1))},we=function(){const e=A(this,F);if(!e.styles)return;const n=A(this,Z);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(){A(this,st)||(M(this,st,!0),this.created())},x(rt,"upgradeProps"),(()=>{if(N){const e=customElements.define,n=new WeakSet;customElements.define=function(r,o,i){if(rt.isPrototypeOf(o)&&!n.has(o)){n.add(o);const l=o.prototype,a=["connectedCallback","disconnectedCallback","attributeChangedCallback"];for(const c of a)l[c]!==rt.prototype[c]&&console.error(`[${r}] 禁止重写 ${c}(),请使用框架钩子`)}return e.call(this,r,o,i)}}})();let et=rt;const Xe=Symbol.for("solely.manifest"),Ct=s=>{const t=s;return e=>{const{tagName:n}=t;if(customElements.get(n))return N&&console.warn(`[Solely] 标签名称 "${n}" 已经被注册,跳过重复定义。`),e;if(typeof t.template=="string"&&!t.ir)try{const o=zt(t.template);t.ir=qt(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;typeof o.replaceSync=="function"&&(o.replaceSync(t.styles),t.sheet=o)}catch{N&&console.warn(`[Style Warning] <${n}>: CSSStyleSheet 不可用,将使用 style 标签回退方案`)}if(t.props&&!t.propMap){const o=new Map;t.props.forEach(i=>{const l=typeof i=="string"?{name:i}:i,a=l.name.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c=a.replace(/-([a-z])/g,(h,u)=>u.toUpperCase());o.set(a,{...l,name:c})}),t.propMap=o}class r extends e{}return r[Xe]=t,customElements.define(n,r),r}};let H=null,ae;const Rt=new Promise(s=>{ae=s});function Qe(s){return H||(H=new ce(s),ae(H),H)}function ft(){return H}class ce{constructor(t){x(this,"routes");x(this,"base");x(this,"mode");x(this,"beforeEachGuard");x(this,"afterEachGuard");x(this,"currentRoute",null);x(this,"listeners",new Set);x(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),l=this.recursiveMatch(this.routes,o);if(l){const a=l.matched[l.matched.length-1];return a.config.redirect?this.matchRoute(a.config.redirect):{matched:l.matched,params:l.params,query:i,fullPath:e,meta:l.matched.reduce((c,h)=>({...c,...h.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 l=!0;if(o.length===0&&e.length===0)return{matched:[{config:r,params:{}}],params:{}};for(let a=0;a<o.length;a++){const c=o[a],h=e[a];if(c.startsWith(":")){if(!h){l=!1;break}i[c.slice(1)]=h}else if(c==="*"){l=!0;break}else if(c!==h){l=!1;break}}if(l){const a=o.length,c=e.slice(a),h={config:r,params:i};if(c.length>0&&r.children){const u=this.recursiveMatch(r.children,c);if(u)return{matched:[h,...u.matched],params:{...i,...u.params}}}else if(c.length===0||o.includes("*"))return{matched:[h],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 l=await this.beforeEachGuard(i,o);if(l===!1)return{success:!1,cancelled:!0};if(typeof l=="string")return this.navigate(l,e)}catch(l){return{success:!1,error:l instanceof Error?l.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 tn=Object.getOwnPropertyDescriptor,en=(s,t,e,n)=>{for(var r=n>1?void 0:n?tn(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=i(r)||r);return r};let dt=class extends et{constructor(){super(...arguments);x(this,"unsubscribe");x(this,"level",0);x(this,"currentElement",null);x(this,"currentTagName",null);x(this,"routerAttrs",new Set);x(this,"prevPropKeys",new Set);x(this,"scheduled",!1);x(this,"cache",new Map);x(this,"latestLoadId",0)}async mounted(){this.detectLevel();const t=await Rt;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 dt&&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 l=await r.component();o=typeof l=="string"?l:l.tagName}catch(l){this.renderError(`Load Error: ${l}`);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,c])=>i.set(o(a),String(c))),Object.entries(n).forEach(([a,c])=>i.set(`query-${o(a)}`,String(c))),this.routerAttrs.forEach(a=>{i.has(a)||(t.removeAttribute(a),this.routerAttrs.delete(a))}),i.forEach((a,c)=>{t.getAttribute(c)!==a&&t.setAttribute(c,a),this.routerAttrs.add(c)});const l=new Set(Object.keys(r));this.prevPropKeys.forEach(a=>{l.has(a)||(t[a]=void 0)}),Object.entries(r).forEach(([a,c])=>{t[a]!==c&&(t[a]=c)}),this.prevPropKeys=l}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()}};dt=en([Ct({tagName:"router-view"})],dt);const nn=dt;var sn=Object.getOwnPropertyDescriptor,rn=(s,t,e,n)=>{for(var r=n>1?void 0:n?sn(t,e):t,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=i(r)||r);return r};let xt=class extends et{constructor(){super(...arguments);x(this,"_prefetched",!1)}set to(t){this.$data.to=t,this.updateState()}get to(){return this.$data.to}async mounted(){(await Rt).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=ft())==null||o.push(this.$data.to))}),this.addEventListener("mouseenter",()=>{this.prefetchRoute()},{once:!0})}updateState(){const t=ft();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=ft();t&&typeof t.prefetch=="function"&&(t.prefetch(this.$data.to),this._prefetched=!0)}};xt=rn([Ct({tagName:"router-link",template:`
|
|
24
25
|
<a part="link" :href="$data.href" :class="{active: $data.isActive}">
|
|
25
26
|
<slot>{{$data.label || ''}}</slot>
|
|
26
27
|
</a>
|
|
@@ -43,4 +44,4 @@
|
|
|
43
44
|
:host([custom]) a {
|
|
44
45
|
display: contents;
|
|
45
46
|
}
|
|
46
|
-
`,shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],xt);const
|
|
47
|
+
`,shadowDOM:{use:!0,mode:"open"},props:["to","active","exact","label","custom","activeClass","prefetch"]})],xt);const on=xt;p.ASTType=w,p.BaseElement=et,p.CustomElement=Ct,p.IRRenderer=re,p.IS_DEV=N,p.IS_PROD=Ee,p.LIFECYCLE_ATTRS_MAP=Vt,p.Router=ce,p.RouterLink=on,p.RouterView=nn,p.buildIR=qt,p.clearIRCache=Ne,p.createFunction=Wt,p.createRender=ie,p.createRouter=Qe,p.genFunction=Dt,p.getRouter=ft,p.isLifecycleKind=jt,p.isObject=j,p.isProxy=Xt,p.listeners=Ft,p.mapAttrKeyToLifecycleKind=Bt,p.observe=te,p.parseHashUrl=Le,p.parseHtml=zt,p.routerReady=Rt,p.showTemplateError=Tt,p.toRaw=Zt,p.transformModel=Ut,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -18,14 +18,20 @@ export interface PropDescriptor {
|
|
|
18
18
|
* 用于描述组件模板、样式、属性监听和 Shadow DOM 行为。
|
|
19
19
|
*/
|
|
20
20
|
export interface Manifest {
|
|
21
|
+
/** HTML 模板字符串 */
|
|
21
22
|
template?: string | Function;
|
|
23
|
+
/** 组件样式(CSS 字符串) */
|
|
22
24
|
styles?: string;
|
|
25
|
+
/** 支持字符串或对象形式 */
|
|
23
26
|
props?: Array<string | PropDescriptor>;
|
|
27
|
+
/** 是否启用 Shadow DOM */
|
|
24
28
|
shadowDOM?: {
|
|
25
29
|
use: boolean;
|
|
26
30
|
mode?: "open" | "closed";
|
|
27
31
|
};
|
|
32
|
+
/** 组件根元素类名 */
|
|
28
33
|
className?: string;
|
|
34
|
+
/** 注册的自定义元素标签名 */
|
|
29
35
|
tagName: string;
|
|
30
36
|
}
|
|
31
37
|
/** 框架内部使用的运行时版本 */
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { IRLocal } from '../types';
|
|
2
|
-
/** 函数生成类型 */
|
|
3
2
|
export type GenType = "template" | "handler" | "expression" | "lifecycle";
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param code 代码字符串
|
|
7
|
-
* @param type 函数类型
|
|
8
|
-
* @param locals 局部变量列表
|
|
9
|
-
* @returns 生成的函数
|
|
4
|
+
* 主入口:生成可执行的函数(支持上层捕获异常)
|
|
10
5
|
*/
|
|
11
|
-
export declare function genFunction(code: string, type: GenType, locals: IRLocal[]):
|
|
6
|
+
export declare function genFunction(code: string, type: GenType, locals: IRLocal[]): Function;
|
package/dist/shared/index.d.ts
CHANGED
package/dist/types/ast.d.ts
CHANGED
|
@@ -33,10 +33,16 @@ export declare enum ASTType {
|
|
|
33
33
|
}
|
|
34
34
|
/** AST 节点 */
|
|
35
35
|
export interface ASTNode {
|
|
36
|
+
/** 节点类型 */
|
|
36
37
|
type: ASTType;
|
|
38
|
+
/** 标签名(只有 Element 使用) */
|
|
37
39
|
tag: string;
|
|
40
|
+
/** 源代码位置 */
|
|
38
41
|
loc: SourceLocation;
|
|
42
|
+
/** 子节点数组 */
|
|
39
43
|
children?: ASTNode[];
|
|
44
|
+
/** 属性数组 */
|
|
40
45
|
attrs?: Attribute[];
|
|
46
|
+
/** 内容(只有文本/注释使用) */
|
|
41
47
|
content?: string;
|
|
42
48
|
}
|
package/dist/types/ir.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ASTType, SourceLocation } from './ast';
|
|
2
2
|
/** IR 属性 */
|
|
3
3
|
export interface IRAttr {
|
|
4
|
+
/** 属性键名 */
|
|
4
5
|
key: string;
|
|
6
|
+
/** 属性值 */
|
|
5
7
|
value?: string;
|
|
8
|
+
/** 函数ID */
|
|
6
9
|
fid?: number;
|
|
10
|
+
/** 0=静态, 1=动态 */
|
|
7
11
|
dynamic: 0 | 1;
|
|
8
12
|
/**
|
|
9
13
|
* 执行语义角色(Execution Role)
|
|
@@ -26,38 +30,65 @@ export interface IRLocal {
|
|
|
26
30
|
}
|
|
27
31
|
/** 核心 IR 节点 */
|
|
28
32
|
export interface IRNode {
|
|
33
|
+
/** ASTType (数字枚举) */
|
|
29
34
|
type: ASTType;
|
|
35
|
+
/** dynamic flag (0=静态, 1=动态) 不包含子节点状态 */
|
|
30
36
|
dynamic: 0 | 1;
|
|
37
|
+
/** 标签名(Element 使用) */
|
|
31
38
|
tag?: string;
|
|
39
|
+
/** 属性数组(Element 使用) */
|
|
32
40
|
attrs?: IRAttr[];
|
|
41
|
+
/** 静态文本内容(Text/Comment 使用) */
|
|
33
42
|
txt?: string;
|
|
43
|
+
/** 条件/循环表达式函数ID */
|
|
34
44
|
fid?: number;
|
|
45
|
+
/** for 循环的 item 变量名 */
|
|
35
46
|
item?: string;
|
|
47
|
+
/** for 循环的 index 变量名 */
|
|
36
48
|
index?: string;
|
|
49
|
+
/** 条件分支数组 */
|
|
37
50
|
branches?: {
|
|
51
|
+
/** 条件函数ID,null 表示 else */
|
|
38
52
|
condFid: number | null;
|
|
53
|
+
/** 子节点数组 */
|
|
39
54
|
children: IRNode[];
|
|
55
|
+
/** 属性数组,支持 <if class="red" cond={...}> */
|
|
40
56
|
attrs?: IRAttr[];
|
|
41
57
|
__meta?: any;
|
|
42
58
|
}[];
|
|
59
|
+
/** 子节点数组 */
|
|
43
60
|
children?: IRNode[];
|
|
44
61
|
}
|
|
45
62
|
/** 🎯 IR 根节点 - 核心数据结构 */
|
|
46
63
|
export interface IRRoot {
|
|
64
|
+
/** 节点类型 */
|
|
47
65
|
type: 'root';
|
|
66
|
+
/** IR 版本 */
|
|
48
67
|
version: string;
|
|
68
|
+
/** 编译后的函数数组 */
|
|
49
69
|
functions: Function[];
|
|
70
|
+
/** 根节点数组 */
|
|
50
71
|
nodes: IRNode[];
|
|
72
|
+
/** 统计信息 */
|
|
51
73
|
stats: {
|
|
74
|
+
/** 总函数数 */
|
|
52
75
|
totalFunctions: number;
|
|
76
|
+
/** 缓存命中数 */
|
|
53
77
|
cachedFunctions: number;
|
|
78
|
+
/** 动态节点数 */
|
|
54
79
|
dynamicNodes: number;
|
|
80
|
+
/** 总节点数 */
|
|
55
81
|
totalNodes: number;
|
|
56
82
|
};
|
|
83
|
+
/** 元数据 */
|
|
57
84
|
metadata?: {
|
|
85
|
+
/** 编译时间 */
|
|
58
86
|
compiledAt: string;
|
|
87
|
+
/** 原始AST大小 */
|
|
59
88
|
astSize: number;
|
|
89
|
+
/** 源文件路径 */
|
|
60
90
|
source?: string;
|
|
91
|
+
/** 源文件名 */
|
|
61
92
|
filename: string;
|
|
62
93
|
};
|
|
63
94
|
}
|