@fluixi/compiler 1.0.0-alpha.68 → 1.0.0-alpha.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var v={backend:"imperative",generate:"dom",moduleName:"@fluixi/dom",delegateEvents:!0,hydratable:!1,sourceMaps:!0,dev:!1};var m={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},N={version:2,module:"@fluixi/dom",symbols:[...m.symbols,"template","cloneTemplate","walk"]};var f={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function $(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function u(e){return $(e)?e:JSON.stringify(e)}function h(e){return e.expr!==void 0?e.reactive?`() => (${e.expr})`:`(${e.expr})`:JSON.stringify(e.literal??!0)}function x(e){return e.expr!==void 0?`(${e.expr})`:JSON.stringify(e.literal??!0)}function C(e,t,r){let o=e.filter(n=>n.kind==="spread"),c=e.filter(n=>n.kind!=="spread").map(n=>`${u(n.name)}: ${h(n)}`);t!=null&&c.push(`children: ${t}`);let i=`{ ${c.join(", ")} }`;return o.length>0?(r.add("mergeProps"),`mergeProps(${o.map(n=>n.expr).join(", ")}, ${i})`):i}function g(e,t){return e.length===1?p(e[0],t):`[${e.map(r=>p(r,t)).join(", ")}]`}function d(e,t,r,o){o.add("createMemo"),o.add("createComponent");let a=t.filter(s=>s.kind==="spread"),i=t.filter(s=>s.kind!=="spread").map(s=>`get ${u(s.name)}() { return ${x(s)}; }`);r.length>0&&i.push(`get children() { return ${g(r,o)}; }`);let n=`{ ${i.join(", ")} }`;return a.length>0&&(o.add("mergeProps"),n=`mergeProps(${a.map(s=>s.expr).join(", ")}, ${n})`),`createMemo(() => createComponent(${e}, ${n}))`}function p(e,t){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":return e.reactive?`() => (${e.code})`:`(${e.code})`;case"fragment":return e.children.length===0?"null":g(e.children,t);case"component":return d(e.name,e.props,e.children,t);case"control":{let r=f[e.control]??e.control;return t.add(r),d(r,e.props,e.children,t)}case"element":{t.add("createNativeElement");let r=JSON.stringify(e.tag),o="_el$",a=[],c=e.svg?`${r}, true`:r;if(a.push(`const ${o} = createNativeElement(${c});`),e.props.length>0){t.add("spread");let i=e.svg?", isSVG: true":"";a.push(`spread({ element: ${o}, props: ${C(e.props,null,t)}${i} });`)}for(let i of e.children){t.add("insert");let n=p(i,t),s=i.kind==="expr"&&i.reactive||i.kind==="component"||i.kind==="control";a.push(s?`insert(${o}, ${n}, null);`:`insert(${o}, ${n});`)}return a.push(`return ${o};`),`(() => { ${a.join(" ")} })()`}}}var l={name:"imperative",contract:m,emit(e,t){let r=new Set;return{code:p(e,r),imports:Array.from(r)}}};var I={imperative:l};export{m as RUNTIME_CONTRACT_V1,N as RUNTIME_CONTRACT_V2,I as backends,v as defaultOptions,l as imperativeBackend};
1
+ var h=e=>"components"in e;function f(e,t){return e.replace(/\$(\d+)/g,(o,s)=>t[Number(s)]??o)}function $(e,t){return typeof t=="string"?{module:t,export:e}:t}function O(e=[]){let t=new Map,o=[],s=[];for(let r of e){if(!h(r)){s.push(r);continue}for(let[n,i]of Object.entries(r.components)){let c=$(n,i),m=t.get(n);if(m&&m.module!==c.module){let g=o.find(x=>x.name===n);g?g.modules.push(c.module):o.push({name:n,modules:[m.module,c.module]});continue}t.set(n,c)}}let a=new Map;return{resolve:r=>{if(a.has(r))return a.get(r);let n=t.get(r);if(!n)for(let i of s){let c=r.match(new RegExp(i.match.source,i.match.flags.replace("g","")));if(c){n={module:f(i.module,c),export:i.export?f(i.export,c):r};break}}return a.set(r,n),n},names:()=>[...t.keys()],conflicts:()=>o}}var S={backend:"imperative",generate:"dom",moduleName:"@fluixi/dom",delegateEvents:!0,hydratable:!1,sourceMaps:!0,dev:!1};var u={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},j={version:2,module:"@fluixi/dom",symbols:[...u.symbols,"template","cloneTemplate","walk"]};var y={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function N(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function C(e){return N(e)?e:JSON.stringify(e)}function b(e){return e.expr!==void 0?e.reactive?`() => (${e.expr})`:`(${e.expr})`:JSON.stringify(e.literal??!0)}function k(e){return e.expr!==void 0?`(${e.expr})`:JSON.stringify(e.literal??!0)}function M(e,t,o){let s=e.filter(n=>n.kind==="spread"),p=e.filter(n=>n.kind!=="spread").map(n=>`${C(n.name)}: ${b(n)}`);t!=null&&p.push(`children: ${t}`);let r=`{ ${p.join(", ")} }`;return s.length>0?(o.add("mergeProps"),`mergeProps(${s.map(n=>n.expr).join(", ")}, ${r})`):r}function v(e,t){return e.length===1?l(e[0],t):`[${e.map(o=>l(o,t)).join(", ")}]`}function R(e,t,o,s){s.add("createMemo"),s.add("createComponent");let a=t.filter(i=>i.kind==="spread"),r=t.filter(i=>i.kind!=="spread").map(i=>`get ${C(i.name)}() { return ${k(i)}; }`);o.length>0&&r.push(`get children() { return ${v(o,s)}; }`);let n=`{ ${r.join(", ")} }`;return a.length>0&&(s.add("mergeProps"),n=`mergeProps(${a.map(i=>i.expr).join(", ")}, ${n})`),`createMemo(() => createComponent(${e}, ${n}))`}function l(e,t){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":return e.reactive?`() => (${e.code})`:`(${e.code})`;case"fragment":return e.children.length===0?"null":v(e.children,t);case"component":return R(e.name,e.props,e.children,t);case"control":{let o=y[e.control]??e.control;return t.add(o),R(o,e.props,e.children,t)}case"element":{t.add("createNativeElement");let o=JSON.stringify(e.tag),s="_el$",a=[],p=e.svg?`${o}, true`:o;if(a.push(`const ${s} = createNativeElement(${p});`),e.props.length>0){t.add("spread");let r=e.svg?", isSVG: true":"";a.push(`spread({ element: ${s}, props: ${M(e.props,null,t)}${r} });`)}for(let r of e.children){t.add("insert");let n=l(r,t),i=r.kind==="expr"&&r.reactive||r.kind==="component"||r.kind==="control";a.push(i?`insert(${s}, ${n}, null);`:`insert(${s}, ${n});`)}return a.push(`return ${s};`),`(() => { ${a.join(" ")} })()`}}}var d={name:"imperative",contract:u,emit(e,t){let o=new Set;return{code:l(e,o),imports:Array.from(o)}}};var B={imperative:d};export{u as RUNTIME_CONTRACT_V1,j as RUNTIME_CONTRACT_V2,B as backends,O as createComponentResolver,S as defaultOptions,d as imperativeBackend};
@@ -1,12 +1,12 @@
1
- "use strict";var bt=Object.create;var U=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames;var Ct=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var X=(e,t)=>()=>(e&&(t=e(e=0)),t);var Xe=(e,t)=>{for(var n in t)U(e,n,{get:t[n],enumerable:!0})},je=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of wt(t))!Jt.call(e,s)&&s!==n&&U(e,s,{get:()=>t[s],enumerable:!(i=vt(t,s))||i.enumerable});return e};var q=(e,t,n)=>(n=e!=null?bt(Ct(e)):{},je(t||!e||!e.__esModule?U(n,"default",{value:e,enumerable:!0}):n,e)),kt=e=>je(U({},"__esModule",{value:!0}),e);var oe,Rn,Fe=X(()=>{"use strict";oe={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Rn={version:2,module:"@fluixi/dom",symbols:[...oe.symbols,"template","cloneTemplate","walk"]}});function Rt(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function $e(e){return Rt(e)?e:JSON.stringify(e)}function Ft(e){return e.expr!==void 0?e.reactive?`() => (${e.expr})`:`(${e.expr})`:JSON.stringify(e.literal??!0)}function Pt(e){return e.expr!==void 0?`(${e.expr})`:JSON.stringify(e.literal??!0)}function $t(e,t,n){let i=e.filter(l=>l.kind==="spread"),o=e.filter(l=>l.kind!=="spread").map(l=>`${$e(l.name)}: ${Ft(l)}`);t!=null&&o.push(`children: ${t}`);let a=`{ ${o.join(", ")} }`;return i.length>0?(n.add("mergeProps"),`mergeProps(${i.map(l=>l.expr).join(", ")}, ${a})`):a}function Me(e,t){return e.length===1?Z(e[0],t):`[${e.map(n=>Z(n,t)).join(", ")}]`}function Pe(e,t,n,i){i.add("createMemo"),i.add("createComponent");let s=t.filter(c=>c.kind==="spread"),a=t.filter(c=>c.kind!=="spread").map(c=>`get ${$e(c.name)}() { return ${Pt(c)}; }`);n.length>0&&a.push(`get children() { return ${Me(n,i)}; }`);let l=`{ ${a.join(", ")} }`;return s.length>0&&(i.add("mergeProps"),l=`mergeProps(${s.map(c=>c.expr).join(", ")}, ${l})`),`createMemo(() => createComponent(${e}, ${l}))`}function Z(e,t){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":return e.reactive?`() => (${e.code})`:`(${e.code})`;case"fragment":return e.children.length===0?"null":Me(e.children,t);case"component":return Pe(e.name,e.props,e.children,t);case"control":{let n=jt[e.control]??e.control;return t.add(n),Pe(n,e.props,e.children,t)}case"element":{t.add("createNativeElement");let n=JSON.stringify(e.tag),i="_el$",s=[],o=e.svg?`${n}, true`:n;if(s.push(`const ${i} = createNativeElement(${o});`),e.props.length>0){t.add("spread");let a=e.svg?", isSVG: true":"";s.push(`spread({ element: ${i}, props: ${$t(e.props,null,t)}${a} });`)}for(let a of e.children){t.add("insert");let l=Z(a,t),c=a.kind==="expr"&&a.reactive||a.kind==="component"||a.kind==="control";s.push(c?`insert(${i}, ${l}, null);`:`insert(${i}, ${l});`)}return s.push(`return ${i};`),`(() => { ${s.join(" ")} })()`}}}var jt,j,K=X(()=>{"use strict";Fe();jt={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};j={name:"imperative",contract:oe,emit(e,t){let n=new Set;return{code:Z(e,n),imports:Array.from(n)}}}});function Tt(e){return Mt(e,{concise:!0}).code}function Lt(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Le(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Oe(e,t,n={}){let i=e.quasi,s=i.expressions.map(l=>{let c=l;return{node:c,code:R(c,t),reactive:v(c)}}),o=At(i),{root:a}=(0,Ae.parseTemplate)(o,{svg:n.svg});return new le(s,t).lowerRoot(a.children)}function At(e){let t=[];return e.quasis.forEach((n,i)=>{let s=n.value.cooked??n.value.raw;if(t.push({kind:"static",text:s,start:n.start??0}),i<e.expressions.length){let o=e.expressions[i];t.push({kind:"hole",index:i,start:o.start??0,end:o.end??0})}}),t}var D,ae,Ae,Mt,Te,le,De=X(()=>{"use strict";D=require("@babel/core"),ae=q(require("@babel/generator"),1),Ae=require("@fluixi/template-parser");K();ce();Mt=ae.default.default??ae.default;Te=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);le=class{constructor(t,n){this.holes=t;this.used=n}hole(t){return this.holes[t]??{node:D.types.identifier("undefined"),code:"undefined",reactive:!1}}emit(t){let{code:n,imports:i}=j.emit(t,{});for(let s of i)this.used.add(s);return n}lowerRoot(t){let n=this.lowerChildren(t);return n.length===1?n[0]:{kind:"fragment",children:n}}lowerChildren(t){let n=[];for(let i=0;i<t.length;i++){let s=t[i];if(s.kind==="Element"||s.kind==="Component"){let a=s.attributes.find(l=>l.kind==="IfDirective");if(a&&a.kind==="IfDirective"){let l=i+1;l<t.length&&this.isBlankText(t[l])&&l++;let c=t[l],p=c&&(c.kind==="Element"||c.kind==="Component")&&c.attributes.some(g=>g.kind==="ElseDirective");n.push(this.lowerIf(s,a.hole,p?c:null)),p&&(i=l);continue}if(s.attributes.some(l=>l.kind==="EachDirective")){n.push(this.lowerEach(s));continue}}let o=this.lowerNode(s);o&&n.push(o)}return n}isBlankText(t){return t.kind==="Text"&&!t.raw&&Y(t.value)===""}lowerNode(t){switch(t.kind){case"Text":{if(t.raw)return{kind:"text",value:t.value};let n=Y(t.value);return n?{kind:"text",value:n}:null}case"Comment":return null;case"Expression":{let n=this.hole(t.hole);return{kind:"expr",code:n.code,reactive:n.reactive}}case"Fragment":return{kind:"fragment",children:this.lowerChildren(t.children)};case"Element":return this.lowerElement(t);case"Component":return this.lowerComponent(t);default:return null}}lowerElement(t){let n=t.attributes.find(i=>i.kind==="Attribute"&&i.name==="is");if(t.tag==="component"&&n&&n.value&&n.value.kind==="hole"){let i=t.attributes.filter(o=>o!==n),s=this.lowerComponent({...t,kind:"Component",tag:"Dynamic",tagHole:null,attributes:i});return s.props.unshift({name:"component",kind:"attr",expr:`() => (${this.hole(n.value.hole).code})`}),s}return{kind:"element",tag:t.tag,svg:t.namespace==="svg",props:this.lowerAttributes(t.attributes),children:this.lowerChildren(t.children),static:!1}}lowerComponent(t){let n=t.tagHole!=null?this.hole(t.tagHole).code:t.tag,i=this.lowerAttributes(t.attributes),{slots:s,rest:o}=this.partitionSlots(t.children);for(let[a,l]of s){let c=l.length===1?l[0]:{kind:"fragment",children:l};i.push({name:a,kind:"attr",expr:this.emit(c),jsxElement:!0})}return{kind:"component",name:n,props:i,children:this.lowerChildren(o)}}partitionSlots(t){let n=new Map,i=[];for(let s of t){if(s.kind==="Element"||s.kind==="Component"){let o=s.attributes.find(a=>a.kind==="Attribute"&&a.name==="slot");if(o&&o.value&&o.value.kind==="static"){let a={...s,attributes:s.attributes.filter(p=>p!==o)},l=a.kind==="Element"?this.lowerElement(a):this.lowerComponent(a),c=n.get(o.value.value)??[];c.push(l),n.set(o.value.value,c);continue}}i.push(s)}return{slots:n,rest:i}}lowerIf(t,n,i){let s=this.hole(n),o=[{name:"when",kind:"attr",expr:s.code,reactive:s.reactive}];if(i){let l=this.stripAndLower(i,c=>c.kind==="ElseDirective");o.push({name:"fallback",kind:"attr",expr:this.emit(l),jsxElement:!0})}let a=this.stripAndLower(t,l=>l.kind==="IfDirective");return{kind:"component",name:"Show",props:o,children:[a]}}lowerEach(t){let n=t.attributes.find(c=>c.kind==="EachDirective");if(!n||n.kind!=="EachDirective")return this.lowerNode(t);let i=this.hole(n.hole),s=[{name:"each",kind:"attr",expr:i.code,reactive:i.reactive}];if(n.key){let c="static"in n.key?`(item) => item[${JSON.stringify(n.key.static)}]`:this.hole(n.key.hole).code;s.push({name:"by",kind:"attr",expr:c})}let o=this.itemArrow(t),a;if(o){let c=o.body,p={kind:"expr",code:R(c,this.used),reactive:v(c)},g=this.rebuildWithChildren(t,[p]);a=`(${o.params.map(m=>Tt(m)).join(", ")}) => (${this.emit(g)})`}else{let c=this.stripAndLower(t,p=>p.kind==="EachDirective");a=`() => (${this.emit(c)})`}return{kind:"component",name:"For",props:s,children:[{kind:"expr",code:a,reactive:!1}]}}itemArrow(t){let n=t.children.filter(s=>!this.isBlankText(s));if(n.length!==1||n[0].kind!=="Expression")return null;let i=this.hole(n[0].hole).node;return D.types.isArrowFunctionExpression(i)&&!D.types.isBlockStatement(i.body)?i:null}stripAndLower(t,n){let i={...t,attributes:t.attributes.filter(s=>!n(s))};return i.kind==="Element"?this.lowerElement(i):this.lowerComponent(i)}rebuildWithChildren(t,n){let i=this.lowerAttributes(t.attributes.filter(s=>s.kind!=="EachDirective"));return t.kind==="Element"?{kind:"element",tag:t.tag,svg:t.namespace==="svg",props:i,children:n,static:!1}:{kind:"component",name:t.tag,props:i,children:n}}lowerAttributes(t){let n=[],i=[],s=!1,o=[],a=!1,l=[];for(let c of t)switch(c.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":n.push(this.plainAttr(c));break;case"PropertyBinding":n.push({name:c.name,kind:"prop",expr:this.hole(c.hole).code,reactive:this.hole(c.hole).reactive});break;case"EventBinding":n.push(this.eventProp(c));break;case"RefBinding":n.push({name:"ref",kind:"ref",expr:this.hole(c.hole).code,reactive:this.hole(c.hole).reactive});break;case"Spread":n.push({name:"",kind:"spread",expr:this.hole(c.hole).code});break;case"ClassDirective":{let p=this.hole(c.hole);i.push(`${JSON.stringify(c.name)}: ${p.code}`),s=s||p.reactive;break}case"StyleDirective":{let p=this.hole(c.hole);o.push(`${JSON.stringify(c.name)}: ${p.code}`),a=a||p.reactive;break}case"BindDirective":n.push(...this.bindProps(c.name,this.hole(c.hole).code));break;case"UseDirective":{let p=c.name??(c.hole!=null?this.hole(c.hole).code:null);if(!p)break;l.push(c.name!=null&&c.hole!=null?`[${p}, () => (${this.hole(c.hole).code})]`:`[${p}]`);break}}return i.length>0&&n.push({name:"classList",kind:"attr",expr:`{ ${i.join(", ")} }`,reactive:s}),o.length>0&&n.push({name:"style",kind:"attr",expr:`{ ${o.join(", ")} }`,reactive:a}),l.length>0&&n.push({name:"use",kind:"attr",expr:`[${l.join(", ")}]`}),n}eventProp(t){let n=t.name.toLowerCase(),i=this.hole(t.hole).code;if(!(t.syntax==="colon"||t.modifiers.length>0))return{name:"on"+Le(t.name),kind:"event",event:{name:n,delegated:Te.has(n)},expr:i};let o=this.wrapHandler(i,t.modifiers),a=this.eventOptions(t.modifiers),l=a?`[${o}, ${a}]`:o;return{name:"on:"+n,kind:"attr",expr:l}}wrapHandler(t,n){let i=n.includes("self")?"if (e.target !== e.currentTarget) return; ":"",s=[];return n.includes("prevent")&&s.push("e.preventDefault();"),n.includes("stop")&&s.push("e.stopPropagation();"),!i&&s.length===0?t:`(e) => { ${i}${s.join(" ")} return (${t})(e); }`}eventOptions(t){let n=[];return t.includes("capture")&&n.push("capture: true"),t.includes("once")&&n.push("once: true"),t.includes("passive")&&n.push("passive: true"),n.length?`{ ${n.join(", ")} }`:null}bindProps(t,n){let i=t==="checked",s=i?"change":"input",o=i?"checked":"value",a=`(${n})`;return[{name:t,kind:"attr",expr:`${a}[0]()`,reactive:!0},{name:"on"+Le(s),kind:"event",event:{name:s,delegated:Te.has(s)},expr:`(e) => ${a}[1](e.target.${o})`}]}plainAttr(t){let n=t.value,i=t.name;t.name==="class"?i=n&&n.kind==="hole"&&D.types.isObjectExpression(this.hole(n.hole).node)?"classList":"className":t.name==="html"&&(i="innerHTML");let o={name:i,kind:"attr"};if(n==null)return o.literal=!0,o;if(n.kind==="static")return o.literal=n.value,o;if(n.kind==="hole"){let c=this.hole(n.hole);return o.expr=c.code,o.reactive=c.reactive,o}let a=!1,l=n.parts.map(c=>{if("text"in c)return Lt(c.text);let p=this.hole(c.hole);return a=a||p.reactive,"${"+p.code+"}"}).join("");return o.expr="`"+l+"`",o.reactive=a,o}}});function Q(e,t=new Set,n={}){return Oe(e,t,n)}var pe=X(()=>{"use strict";De()});function Ve(e){return Ot(e,{concise:!0}).code}function Dt(e,t){let n=u.types.cloneNode(e,!0),i=u.types.file(u.types.program([u.types.expressionStatement(n)])),s=!1,o=(a,l,c)=>{for(let p of c)t.add(p);a.replaceWith(u.template.expression(l,{placeholderPattern:!1,plugins:["typescript"]})()),a.skip(),s=!0};return(0,u.traverse)(i,{"JSXElement|JSXFragment"(a){let l=a.node,{code:c,imports:p}=j.emit(_(l,t),{});o(a,c,p)},TaggedTemplateExpression(a){let l=a.node.tag;if(!u.types.isIdentifier(l)||l.name!=="html"&&l.name!=="svg")return;let c=Q(a.node,t,{svg:l.name==="svg"}),{code:p,imports:g}=j.emit(c,{});o(a,p,g)}}),s?i.program.body[0].expression:e}function R(e,t){return Ve(Dt(e,t))}function zt(e){if(u.types.isJSXIdentifier(e)){let t=e.name[0]!==e.name[0].toLowerCase();return{tag:e.name,component:t}}return u.types.isJSXMemberExpression(e)?{tag:Ve(e),component:!0}:u.types.isJSXNamespacedName(e)?{tag:`${e.namespace.name}:${e.name.name}`,component:!1}:{tag:"div",component:!1}}function Ht(e){return u.types.isJSXIdentifier(e)?e.name==="class"?"className":e.name:u.types.isJSXNamespacedName(e)?`${e.namespace.name}:${e.name.name}`:"unknown"}function v(e){return u.types.isCallExpression(e)||u.types.isOptionalCallExpression(e)?!0:u.types.isMemberExpression(e)||u.types.isOptionalMemberExpression(e)?!(!e.computed&&u.types.isIdentifier(e.property,{name:"children"})):u.types.isConditionalExpression(e)?v(e.test)||v(e.consequent)||v(e.alternate):u.types.isLogicalExpression(e)||u.types.isBinaryExpression(e)?v(e.left)||v(e.right):u.types.isTemplateLiteral(e)?e.expressions.some(t=>v(t)):u.types.isObjectExpression(e)?e.properties.some(t=>u.types.isObjectProperty(t)&&!t.computed&&v(t.value)):u.types.isArrayExpression(e)?e.elements.some(t=>t!=null&&!u.types.isSpreadElement(t)&&v(t)):!1}function Wt(e,t){let n=Ht(e.name),i=Bt.test(n),s=i||n.startsWith("on:"),a={name:n,kind:i?"event":"attr"};i&&(a.event={name:n.slice(2).toLowerCase(),delegated:Vt.has(n.slice(2).toLowerCase())});let l=e.value;if(l==null)return a.literal=!0,a;if(u.types.isStringLiteral(l))return a.literal=l.value,a;if(u.types.isJSXExpressionContainer(l)&&!u.types.isJSXEmptyExpression(l.expression)){let c=l.expression;return u.types.isStringLiteral(c)||u.types.isNumericLiteral(c)||u.types.isBooleanLiteral(c)?(a.literal=c.value,a):(a.expr=R(c,t),a.reactive=s?!1:v(c),(u.types.isJSXElement(c)||u.types.isJSXFragment(c))&&(a.jsxElement=!0),a)}return a.literal=!0,a}function _e(e,t){let n=e.value;return n==null?null:u.types.isStringLiteral(n)?JSON.stringify(n.value):u.types.isJSXExpressionContainer(n)&&!u.types.isJSXEmptyExpression(n.expression)?R(n.expression,t):null}function Ut(e,t){let n=[],i=[];for(let s of e){if(u.types.isJSXSpreadAttribute(s)){n.push({name:"",kind:"spread",expr:R(s.argument,t)});continue}if(!u.types.isJSXAttribute(s))continue;let o=u.types.isJSXNamespacedName(s.name)?s.name.namespace.name:null;if(o==="use"){let a=s.name.name.name;t.add(a);let l=_e(s,t);i.push(l!=null?`[${a}, () => (${l})]`:`[${a}]`);continue}if(o==="oncapture"){let a=s.name.name.name.toLowerCase(),l=_e(s,t)??"undefined";n.push({name:"on:"+a,kind:"attr",expr:`[${l}, { capture: true }]`});continue}n.push(Wt(s,t))}return i.length>0&&n.push({name:"use",kind:"attr",expr:`[${i.join(", ")}]`}),n}function Y(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let s=0;s<t.length;s++)/[^ \t]/.test(t[s])&&(n=s);let i="";for(let s=0;s<t.length;s++){let o=t[s].replace(/\t/g," ");s!==0&&(o=o.replace(/^ +/,"")),s!==t.length-1&&(o=o.replace(/ +$/,"")),o&&(s!==n&&(o+=" "),i+=o)}return i}function Be(e,t){let n=[];for(let i of e)if(u.types.isJSXText(i)){let s=Y(i.value);s&&n.push({kind:"text",value:s})}else if(u.types.isJSXExpressionContainer(i)){if(!u.types.isJSXEmptyExpression(i.expression)){let s=i.expression;n.push({kind:"expr",code:R(s,t),reactive:v(s)})}}else u.types.isJSXElement(i)||u.types.isJSXFragment(i)?n.push(_(i,t)):u.types.isJSXSpreadChild(i)&&n.push({kind:"expr",code:R(i.expression,t),reactive:!1});return n}function _(e,t=new Set){if(u.types.isJSXFragment(e))return{kind:"fragment",children:Be(e.children,t)};let{tag:n,component:i}=zt(e.openingElement.name),s=Ut(e.openingElement.attributes,t),o=Be(e.children,t);return i?{kind:"component",name:n,props:s,children:o}:{kind:"element",tag:n,svg:_t.has(n),props:s,children:o,static:!1}}var u,ue,Ot,_t,Bt,Vt,ce=X(()=>{"use strict";u=require("@babel/core"),ue=q(require("@babel/generator"),1);K();pe();Ot=ue.default.default??ue.default;_t=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),Bt=/^on[A-Z]/,Vt=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"])});function Gt(e,t,n){let{runtime:i,pragma:s,development:o,autoShow:a=!0}=n;return i==="automatic"?z(e,t,o,a):nn(e,t,s)}function He(e,t,n){return t.length>0?(n.needsMergeProps=!0,r.types.callExpression(r.types.identifier("mergeProps"),[...t,r.types.objectExpression(e)])):r.types.objectExpression(e)}function Ke(e){return e.length===1?e[0]:r.types.arrayExpression(e)}function Kt(e,t,n,i,s,o){if(!t){let m=[...n];return s.length>0&&m.push(r.types.objectMethod("get",r.types.identifier("children"),[],r.types.blockStatement([r.types.returnStatement(Ke(s))]))),Ye(e,He(m,i,o),o)}let a=e.value,l=Zt.has(a),c=r.types.identifier("_el$"),p=[];o.needsCreateNativeElement=!0;let g=[e];if(l&&g.push(r.types.booleanLiteral(!0)),p.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(c,r.types.callExpression(r.types.identifier("createNativeElement"),g))])),n.length>0||i.length>0){o.needsSpread=!0;let m=[r.types.objectProperty(r.types.identifier("element"),c),r.types.objectProperty(r.types.identifier("props"),He(n,i,o))];l&&m.push(r.types.objectProperty(r.types.identifier("isSVG"),r.types.booleanLiteral(!0))),p.push(r.types.expressionStatement(r.types.callExpression(r.types.identifier("spread"),[r.types.objectExpression(m)])))}if(s.length>0){o.needsInsert=!0;for(let m of s){let $=r.types.isArrowFunctionExpression(m)||r.types.isFunctionExpression(m)||r.types.isCallExpression(m)&&r.types.isIdentifier(m.callee)&&m.callee.name==="createMemo"?[r.types.cloneNode(c),m,r.types.nullLiteral()]:[r.types.cloneNode(c),m];p.push(r.types.expressionStatement(r.types.callExpression(r.types.identifier("insert"),$)))}}return p.push(r.types.returnStatement(c)),r.types.callExpression(r.types.arrowFunctionExpression([],r.types.blockStatement(p)),[])}function Ye(e,t,n){return r.types.isIdentifier(e)&&B.has(e.name)&&(n.controlFlowComponents.add(e.name),n.needsControlFlowImport=!0),n.backend==="imperative"?(n.needsCreateComponent=!0,n.needsCreateMemo=!0,r.types.callExpression(r.types.identifier("createMemo"),[r.types.arrowFunctionExpression([],r.types.callExpression(r.types.identifier("createComponent"),[e,t]))])):r.types.callExpression(r.types.identifier("jsx"),[e,t])}function We(e,t){let n=new Set,i=_(e,n),{code:s,imports:o}=j.emit(i,{});for(let a of o)n.add(a);for(let a of n)t.irImports.add(a);return r.template.expression(s,{placeholderPattern:!1,plugins:["typescript"]})()}function Yt(e){let t=new Map,n=[];for(let i of e){let s=i.source.value;if(!i.specifiers.every(l=>r.types.isImportSpecifier(l))){n.push(i);continue}let a=t.get(s);if(!a){let l=new Set(i.specifiers.map(c=>c.local.name));t.set(s,{decl:i,names:l}),n.push(i);continue}for(let l of i.specifiers)a.names.has(l.local.name)||(a.names.add(l.local.name),a.decl.specifiers.push(l))}return n}function Qt(e,t){let n=new Set,i=r.types.isIdentifier(e.tag)&&e.tag.name==="svg",s=Q(e,n,{svg:i}),{code:o,imports:a}=j.emit(s,{});for(let c of a)n.add(c);for(let c of n)t.irImports.add(c);Qe(s,t),t.hasLitIR=!0;let l=r.template.expression(o,{placeholderPattern:!1,plugins:["typescript"]})();return en(l,e),l}function en(e,t){if(!t.loc)return;let n=new Set,i=s=>{if(!n.has(s)){n.add(s),s.loc||(s.loc=t.loc,s.start=t.start,s.end=t.end);for(let o of r.types.VISITOR_KEYS[s.type]??[]){let a=s[o];if(Array.isArray(a))for(let l of a)l&&typeof l=="object"&&"type"in l&&i(l);else a&&typeof a=="object"&&"type"in a&&i(a)}}};i(e)}function Qe(e,t){if(e.kind==="component"&&(me.has(e.name)||B.has(e.name))&&(t.controlFlowComponents.add(e.name),t.needsControlFlowImport=!0),(e.kind==="element"||e.kind==="component"||e.kind==="control")&&"props"in e)for(let n of e.props)n.kind==="event"&&n.event?.delegated&&t.delegatedEvents.add(n.event.name);if("children"in e&&e.children)for(let n of e.children)Qe(n,t)}function tn(e){return e.map(t=>{if(r.types.isObjectProperty(t)){let n=t.key,i=t.computed,s=t.value;return r.types.objectMethod("get",n,[],r.types.blockStatement([r.types.returnStatement(s)]),i)}return t})}function z(e,t,n,i=!0){let s=e.openingElement,o=e.children,a=et(s.name),l=r.types.isJSXIdentifier(s.name)&&/^[a-z]/.test(s.name.name),c=nt(s.attributes,t,l,r.types.isJSXIdentifier(s.name)?s.name.name:""),p=c.props,g=c.spreads;l||(p=tn(p));let m=de(o,t,i);if(t.backend==="imperative")return Kt(a,l,p,g,m,t);if(m.length>0){let N=m.length===1?m[0]:r.types.arrayExpression(m);p.push(r.types.objectProperty(r.types.identifier("children"),N))}let w;if(g.length>0){let N=p.length>0?r.types.objectExpression(p):r.types.objectExpression([]);t.needsMergeProps=!0,w=r.types.callExpression(r.types.identifier("mergeProps"),[...g,N])}else w=r.types.objectExpression(p);let $=n?"jsxDEV":m.length>1?"jsxs":"jsx",C=[a,w];return n&&C.push(r.types.identifier("undefined"),r.types.booleanLiteral(!1),r.types.identifier("undefined"),r.types.identifier("undefined")),r.types.callExpression(r.types.identifier($),C)}function nn(e,t,n){let i=e.openingElement,s=e.children,o=et(i.name),a=r.types.isJSXIdentifier(i.name)&&/^[a-z]/.test(i.name.name),{props:l,spreads:c}=nt(i.attributes,t,a,r.types.isJSXIdentifier(i.name)?i.name.name:""),p=de(s,t,t.autoShow??!0),g;if(c.length>0){let w=l.length>0?r.types.objectExpression(l):r.types.objectExpression([]);t.needsMergeProps=!0,g=r.types.callExpression(r.types.identifier("mergeProps"),[...c,w])}else g=l.length>0?r.types.objectExpression(l):r.types.nullLiteral();let m=[o,g,...p];return r.types.callExpression(r.types.identifier(n),m)}function ee(e,t,n){let{runtime:i,pragmaFrag:s,development:o}=n,a=de(e.children,t,t.autoShow??!0);if(t.backend==="imperative")return a.length===0?r.types.nullLiteral():Ke(a);if(i==="automatic"){let l=o?"jsxDEV":a.length>1?"jsxs":"jsx",c=r.types.objectExpression([r.types.objectProperty(r.types.identifier("children"),a.length===1?a[0]:r.types.arrayExpression(a))]),p=[r.types.identifier("Fragment"),c];return o&&p.push(r.types.identifier("undefined"),r.types.booleanLiteral(!1),r.types.identifier("undefined"),r.types.identifier("undefined")),r.types.callExpression(r.types.identifier(l),p)}else return r.types.callExpression(r.types.identifier(s),a)}function et(e){if(r.types.isJSXIdentifier(e)){let t=e.name;return t[0]===t[0].toLowerCase()?r.types.stringLiteral(t):r.types.identifier(t)}return r.types.isJSXMemberExpression(e)?tt(e):r.types.isJSXNamespacedName(e)?r.types.stringLiteral(`${e.namespace.name}:${e.name.name}`):r.types.stringLiteral("div")}function tt(e){let t;return r.types.isJSXIdentifier(e.object)?t=r.types.identifier(e.object.name):t=tt(e.object),r.types.memberExpression(t,r.types.identifier(e.property.name))}function rn(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}function nt(e,t,n=!0,i=""){let s=[],o=[],a=qt[i];for(let l of e)if(r.types.isJSXSpreadAttribute(l))o.push(l.argument);else if(r.types.isJSXAttribute(l)){let c=sn(l.name),p=on(l.value,t,c,n);if(Ge.test(c)){let H=c.slice(2).toLowerCase();Ze.includes(H)&&t.delegatedEvents.add(H)}let g=rn(c)?r.types.identifier(c):r.types.stringLiteral(c),m=l.value,w=r.types.isJSXElement(m)||r.types.isJSXFragment(m)||r.types.isJSXExpressionContainer(m)&&(r.types.isJSXElement(m.expression)||r.types.isJSXFragment(m.expression)),$=!n&&c===a,C=r.types.isJSXExpressionContainer(m)&&!r.types.isJSXEmptyExpression(m.expression)?m.expression:null,N=!n&&!!C&&rt(C,c);!n&&w||$||N?s.push(r.types.objectMethod("get",g,[],r.types.blockStatement([r.types.returnStatement(p)]))):s.push(r.types.objectProperty(g,p))}return{props:s,spreads:o}}function sn(e){return r.types.isJSXIdentifier(e)?e.name==="class"?"className":e.name:r.types.isJSXNamespacedName(e)?`${e.namespace.name}:${e.name.name}`:"unknown"}function on(e,t,n="",i=!0){if(e===null)return r.types.booleanLiteral(!0);if(r.types.isStringLiteral(e))return e.value.includes(`
2
- `)?r.types.stringLiteral(e.value.replace(/\s+/g," ").trim()):e;if(r.types.isJSXExpressionContainer(e)){if(r.types.isJSXEmptyExpression(e.expression))return r.types.booleanLiteral(!0);let s=e.expression;return i&&rt(s,n)?r.types.arrowFunctionExpression([],s):s}return r.types.isJSXElement(e)?z(e,t,!1,t.autoShow??!0):r.types.isJSXFragment(e)?ee(e,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1}):r.types.booleanLiteral(!0)}function rt(e,t){return Ge.test(t)||t.startsWith("on:")||t==="ref"||t.startsWith("use:")||r.types.isArrowFunctionExpression(e)||r.types.isFunctionExpression(e)||r.types.isIdentifier(e)||r.types.isStringLiteral(e)||r.types.isNumericLiteral(e)||r.types.isBooleanLiteral(e)||r.types.isNullLiteral(e)?!1:!!(r.types.isCallExpression(e)||r.types.isOptionalCallExpression(e)||r.types.isMemberExpression(e)||r.types.isOptionalMemberExpression(e)||r.types.isLogicalExpression(e)||r.types.isConditionalExpression(e)||r.types.isBinaryExpression(e)||r.types.isUnaryExpression(e)||r.types.isTemplateLiteral(e)||r.types.isObjectExpression(e)||r.types.isArrayExpression(e))}function an(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let s=0;s<t.length;s++)/[^ \t]/.test(t[s])&&(n=s);let i="";for(let s=0;s<t.length;s++){let o=t[s].replace(/\t/g," ");s!==0&&(o=o.replace(/^ +/,"")),s!==t.length-1&&(o=o.replace(/ +$/,"")),o&&(s!==n&&(o+=" "),i+=o)}return i}function de(e,t,n=!0){let i=[];for(let s of e)if(r.types.isJSXText(s)){let o=an(s.value);o&&i.push(r.types.stringLiteral(o))}else if(r.types.isJSXExpressionContainer(s)){if(!r.types.isJSXEmptyExpression(s.expression)){let o=s.expression;if(n){let a=ln(o,t)??cn(o,t);if(a){i.push(a);continue}}else{let a=pn(o,t);if(a){i.push(a);continue}}fn(o)?i.push(r.types.arrowFunctionExpression([],o)):i.push(o)}}else r.types.isJSXElement(s)?i.push(z(s,t,!1,t.autoShow??!0)):r.types.isJSXFragment(s)?i.push(ee(s,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1})):r.types.isJSXSpreadChild(s)&&i.push(s.expression);return i}function ln(e,t){if(!r.types.isArrowFunctionExpression(e)||e.params.length!==0||e.async)return null;let n=e.body;if(r.types.isLogicalExpression(n)&&n.operator==="&&"){let i=J(n.right);if(i)return V(F(n.left),i,null,t)}if(r.types.isConditionalExpression(n)){let i=J(n.consequent);if(i){let s=ge(n.alternate,t);return V(F(n.test),i,s,t,!0)}}return null}function cn(e,t){if(r.types.isLogicalExpression(e)&&e.operator==="&&"){let n=J(e.right);if(n)return V(F(e.left),n,null,t)}if(r.types.isConditionalExpression(e)){let n=J(e.consequent);if(n){let i=ge(e.alternate,t);return V(F(e.test),n,i,t)}}return null}function pn(e,t){let n=r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&r.types.isExpression(e.body)?e.body:e;if(r.types.isConditionalExpression(n)){let i=F(n.test),o=J(n.consequent)??n.consequent,l=J(n.alternate)??n.alternate,c=r.types.conditionalExpression(i,o,l);return fe(n.consequent)||fe(n.alternate)?null:(t.needsCreateMemo=!0,r.types.callExpression(r.types.identifier("createMemo"),[r.types.arrowFunctionExpression([],c)]))}if(r.types.isLogicalExpression(n)&&n.operator==="&&"){let i=F(n.left),o=J(n.right)??n.right,a=r.types.logicalExpression("&&",i,o);return fe(n.right)?null:(t.needsCreateMemo=!0,r.types.callExpression(r.types.identifier("createMemo"),[r.types.arrowFunctionExpression([],a)]))}return null}function ge(e,t){if(un(e))return null;let n=J(e);if(n)return it(n,t);if(r.types.isConditionalExpression(e)){let i=e,s=J(i.consequent);if(s){let o=ge(i.alternate,t);return V(F(i.test),s,o,t)}}return e}function Ue(e){return r.types.isJSXElement(e)||r.types.isJSXFragment(e)}function fe(e){let t=J(e);if(!t||!r.types.isJSXElement(t))return!1;let n=t.openingElement.name;return r.types.isJSXIdentifier(n)&&me.has(n.name)}function J(e){return Ue(e)?e:r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&Ue(e.body)?e.body:null}function F(e){return r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&r.types.isExpression(e.body)?e.body:e}function un(e){return r.types.isNullLiteral(e)||r.types.isIdentifier(e)&&e.name==="undefined"||r.types.isBooleanLiteral(e)&&e.value===!1}function it(e,t){return r.types.isJSXElement(e)?z(e,t,!1,t.autoShow??!0):ee(e,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1})}function V(e,t,n,i,s=!1){i.controlFlowComponents.add("Show"),i.needsControlFlowImport=!0;let o=it(t,i),a=[r.types.objectProperty(r.types.identifier("when"),r.types.arrowFunctionExpression([],e)),r.types.objectProperty(r.types.identifier("children"),o)];return n&&a.push(r.types.objectProperty(r.types.identifier("fallback"),n)),Ye(r.types.identifier("Show"),r.types.objectExpression(a),i)}function fn(e){return r.types.isMemberExpression(e)||r.types.isOptionalMemberExpression(e)?!(!e.computed&&r.types.isIdentifier(e.property,{name:"children"})):r.types.isCallExpression(e)||r.types.isOptionalCallExpression(e)?!0:r.types.isIdentifier(e)?!1:!!(r.types.isLogicalExpression(e)||r.types.isConditionalExpression(e)||r.types.isBinaryExpression(e)||r.types.isUnaryExpression(e)||r.types.isTemplateLiteral(e))}function st(e,t){let n=e.openingElement;if(!r.types.isJSXIdentifier(n.name))return!1;let i=n.name.name;if(i[0]!==i[0].toLowerCase())return!1;for(let s of n.attributes){if(r.types.isJSXSpreadAttribute(s))return!1;if(r.types.isJSXAttribute(s)){let o=s.value;if(r.types.isJSXExpressionContainer(o)&&!r.types.isStringLiteral(o.expression)&&!r.types.isNumericLiteral(o.expression))return!1}}for(let s of e.children)if(r.types.isJSXElement(s)&&!st(s,t)||r.types.isJSXExpressionContainer(s))return!1;return!0}function mn(e,t){let n=`_$static${t.staticCounter++}`,i=z(e,t,!1);return t.staticElements.set(n,i),r.types.identifier(n)}function dn(e,t){let n=e.openingElement.name.name;return n==="Show"?gn(e,t):n==="For"?hn(e,t):null}function gn(e,t){return null}function hn(e,t){return null}var qe,r,me,ze,B,qt,Ge,Ze,L,Zt,he=X(()=>{"use strict";qe=require("@babel/helper-plugin-utils"),r=require("@babel/core");ce();pe();K();me=new Set(["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense","SuspenseList","Await"]),ze=new Set(["Suspense","SuspenseList","Await"]),B=new Set(["Router","Outlet","Redirect","Link"]),qt={Show:"when",For:"each",Index:"each",Match:"when"},Ge=/^on[A-Z]/,Ze=["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave"],L=(0,qe.declare)((e,t={})=>{e.assertVersion(7);let{runtime:n="automatic",importSource:i="@fluixi/jsx",pragma:s="jsx",pragmaFrag:o="Fragment",development:a=!1,detectReactivity:l=!0,useLitHTML:c=!0,hoistStatics:p=!0,delegateEvents:g=!0,delegatedEvents:m=Ze,optimizeControlFlow:w=!0,sourceMaps:$=!0,signalModule:C="@fluixi/dom",controlFlowModule:N="@fluixi/dom",routerModule:H="@fluixi/core/router-next",reactiveModule:ke="@fluixi/reactive/signal",autoShowTransform:Ne=!1,backend:k="imperative",codegen:O="inline",format:Ie="both",litTag:Et="html"}=t,St=Ie==="lit"||Ie==="both",yt={backend:k,codegen:O,irImports:new Set,libModule:"@fluixi/core",hasJSX:!1,hasReactivity:!1,hasLitHTML:!1,needsSignalImport:!1,needsControlFlowImport:!1,needsCreateMemo:!1,controlFlowComponents:new Set,delegatedEvents:new Set,staticElements:new Map,staticCounter:0};return{name:"@fluixi/babel-plugin-jsx",manipulateOptions(d,f){f.plugins.push("jsx","typescript")},pre(d){Object.assign(d,yt)},visitor:{ImportDeclaration(d,f){d.node.source.value==="@fluixi/core/rx"&&(d.node.source=r.types.stringLiteral("@fluixi/reactive"))},Program:{enter(d,f){Object.assign(f,{hasJSX:!1,hasReactivity:!1,hasLitHTML:!1,hasLitIR:!1,needsSignalImport:!1,needsControlFlowImport:!1,needsCreateMemo:!1,controlFlowComponents:new Set,delegatedEvents:new Set,staticElements:new Map,autoShow:Ne,staticCounter:0,libModule:"@fluixi/core",backend:k,codegen:O,irImports:new Set,needsCreateNativeElement:!1,needsInsert:!1,needsSpread:!1,needsCreateComponent:!1,needsMergeProps:!1})},exit(d,f){let h=[];if(f.hasJSX||f.needsSignalImport&&h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("signal"),r.types.identifier("signal"))],r.types.stringLiteral(C))),f.hasJSX||f.hasLitIR){if(f.irImports.size>0){let x=new Set(["Show","For","Index","Switch","Match","Dynamic","ErrorBoundary","Portal","Suspense"]),y=new Set(["createMemo","createEffect","createRenderEffect","createRoot","createSignal","onCleanup","batch","untrack"]),E=Array.from(f.irImports),I=S=>r.types.importSpecifier(r.types.identifier(S),r.types.identifier(S)),M=S=>!d.scope.hasBinding(S),T=E.filter(S=>y.has(S)&&M(S)),b=E.filter(S=>!x.has(S)&&!y.has(S)&&M(S)),W=E.filter(S=>x.has(S)&&M(S));T.length>0&&h.push(r.types.importDeclaration(T.map(I),r.types.stringLiteral(ke))),b.length>0&&h.push(r.types.importDeclaration(b.map(I),r.types.stringLiteral(C))),W.length>0&&h.push(r.types.importDeclaration(W.map(I),r.types.stringLiteral(N)))}if(f.hasJSX&&k==="imperative"&&O!=="ir"){let y=[[!!f.needsCreateNativeElement,"createNativeElement"],[!!f.needsSpread,"spread"],[!!f.needsInsert,"insert"],[!!f.needsCreateComponent,"createComponent"],[!!f.needsMergeProps,"mergeProps"]].filter(([E,I])=>E&&!d.scope.hasBinding(I)).map(([,E])=>r.types.importSpecifier(r.types.identifier(E),r.types.identifier(E)));y.length>0&&h.push(r.types.importDeclaration(y,r.types.stringLiteral(C)))}else if(f.hasJSX&&n==="automatic"){let x=[r.types.importSpecifier(r.types.identifier("jsx"),r.types.identifier("jsx")),r.types.importSpecifier(r.types.identifier("jsxs"),r.types.identifier("jsxs")),r.types.importSpecifier(r.types.identifier("Fragment"),r.types.identifier("Fragment"))];a&&x.push(r.types.importSpecifier(r.types.identifier("jsxDEV"),r.types.identifier("jsxDEV"))),f.needsMergeProps&&x.push(r.types.importSpecifier(r.types.identifier("mergeProps"),r.types.identifier("mergeProps"))),h.push(r.types.importDeclaration(x,r.types.stringLiteral(i)))}if(f.needsCreateMemo&&!d.scope.hasBinding("createMemo")&&h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("createMemo"),r.types.identifier("createMemo"))],r.types.stringLiteral(k==="imperative"?ke:f.libModule??"@fluixi/core"))),f.needsControlFlowImport&&f.controlFlowComponents.size>0){let x=Array.from(f.controlFlowComponents).filter(b=>!d.scope.hasBinding(b)),y=f.libModule??"@fluixi/core",E=x.filter(b=>B.has(b)),I=x.filter(b=>ze.has(b)),M=x.filter(b=>!ze.has(b)&&!B.has(b)),T=(b,W)=>r.types.importDeclaration(b.map(S=>r.types.importSpecifier(r.types.identifier(S),r.types.identifier(S))),r.types.stringLiteral(W));M.length>0&&h.push(T(M,N)),I.length>0&&h.push(T(I,y)),E.length>0&&h.push(T(E,H))}if(g&&f.delegatedEvents.size>0){h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("delegateEvents"),r.types.identifier("delegateEvents"))],r.types.stringLiteral(k==="imperative"?C:"@fluixi/jsx")));let x=r.types.arrayExpression(Array.from(f.delegatedEvents).map(E=>r.types.stringLiteral(E))),y=r.types.expressionStatement(r.types.callExpression(r.types.identifier("delegateEvents"),[x]));d.node.body.unshift(y)}if(p&&f.staticElements.size>0){let x=[];f.staticElements.forEach((y,E)=>{x.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(r.types.identifier(E),y)]))}),d.node.body.unshift(...x)}}h.length>0&&d.node.body.unshift(...Yt(h))}},JSXElement(d,f){if(f.hasJSX=!0,k==="imperative"&&O==="ir"){d.replaceWith(We(d.node,f));return}let h=d.node,x=h.openingElement;if(r.types.isJSXIdentifier(x.name)&&B.has(x.name.name)&&(f.controlFlowComponents.add(x.name.name),f.needsControlFlowImport=!0),r.types.isJSXIdentifier(x.name)&&me.has(x.name.name)&&(f.controlFlowComponents.add(x.name.name),w)){let E=dn(h,f);if(E){d.replaceWith(E);return}}if(p&&k!=="imperative"&&st(h,f)){let E=mn(h,f);if(E){d.replaceWith(E);return}}let y=Gt(h,f,{runtime:n,pragma:s,development:a,detectReactivity:l,useLitHTML:c,autoShow:Ne});d.replaceWith(y)},JSXFragment(d,f){if(f.hasJSX=!0,k==="imperative"&&O==="ir"){d.replaceWith(We(d.node,f));return}let h=ee(d.node,f,{runtime:n,pragmaFrag:o,development:a});d.replaceWith(h)},CallExpression(d,f){if(!l)return;let h=d.node.callee;h.name,r.types.isIdentifier(h)&&(h.name==="createSignal"||h.name==="createStore"||h.name==="useContext"||h.name==="useLocation")&&(f.hasReactivity=!0)},JSXExpressionContainer(d){},TaggedTemplateExpression(d,f){if(St&&k==="imperative"&&r.types.isIdentifier(d.node.tag)&&(d.node.tag.name===Et||d.node.tag.name==="svg")){d.replaceWith(Qt(d.node,f));return}}}}});Zt=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"])});var ot=X(()=>{"use strict"});var at={};Xe(at,{babelPluginReactiveJSX:()=>xn,createPlugin:()=>En,createPreset:()=>te,default:()=>L,presets:()=>Sn});function En(e){return[L,e]}function te(e={}){return{plugins:[[L,{runtime:"automatic",importSource:"@fluixi/jsx",development:!1,detectReactivity:!0,useLitHTML:!0,hoistStatics:!0,delegateEvents:!0,optimizeControlFlow:!0,sourceMaps:!0,...e}]]}}var xn,Sn,lt=X(()=>{"use strict";he();ot();he();xn=L;Sn={production:te({development:!1,hoistStatics:!0,delegateEvents:!0,optimizeControlFlow:!0}),development:te({development:!0,hoistStatics:!1,sourceMaps:!0}),minimal:te({detectReactivity:!1,useLitHTML:!1,hoistStatics:!1,delegateEvents:!1,optimizeControlFlow:!1})}});var In={};Xe(In,{analyzeProp:()=>ne,analyzeProps:()=>re,createBabelPlugin:()=>A,createESBuildPlugin:()=>ht,createRollupPlugin:()=>gt,createTypeScriptTransformer:()=>ft,createVitePlugin:()=>mt,createWebpackLoader:()=>dt,default:()=>Nn,generateChildrenCode:()=>ye,generateCreateElement:()=>pt,generateEventDelegation:()=>Ce,generateLitHTMLTemplate:()=>be,generatePropsCode:()=>Se,hoistStatic:()=>we,isLitTemplate:()=>ct,optimizeSpreads:()=>ut,optimizeStatic:()=>ve,serverFunctionsVitePlugin:()=>kn,shouldUseLitTemplate:()=>Ee,transform:()=>P,transformServerFunctions:()=>G});module.exports=kt(In);var Re=require("@babel/core"),Nt="@fluixi/start/server-fn";function It(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)}function Xt({types:e}){return{name:"fluixi-server-functions",visitor:{Program:{enter(t,n){n.fxIndex=0,n.fxUsed=null},exit(t,n){n.fxUsed&&t.unshiftContainer("body",e.importDeclaration([e.importSpecifier(e.identifier(n.fxUsed),e.identifier(n.fxUsed))],e.stringLiteral(n.opts.runtimeModule||Nt)))}},"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression":(t,n)=>{let i=t.node.body;if(!e.isBlockStatement(i))return;let o=(i.directives||[]).findIndex(m=>m.value.value==="use server");if(o<0)return;i.directives.splice(o,1);let a=(n.opts.filename||n.filename||"unknown").replace(n.opts.root?n.opts.root+"/":"",""),l=`${It(a)}:${n.fxIndex++}`,c=!!n.opts.ssr,p=c?"$$registerServerFn":"$$createServerReference";n.fxUsed=p;let g=c?e.callExpression(e.identifier(p),[e.stringLiteral(l),t.isFunctionDeclaration()?e.functionExpression(null,t.node.params,i,t.node.generator,t.node.async):t.node]):e.callExpression(e.identifier(p),[e.stringLiteral(l)]);t.isFunctionDeclaration()?t.replaceWith(e.variableDeclaration("const",[e.variableDeclarator(t.node.id,g)])):t.replaceWith(g),t.skip()}}}}function G(e,t){if(!e.includes("use server"))return null;let n=(0,Re.transformSync)(e,{filename:t.filename,configFile:!1,babelrc:!1,sourceMaps:!0,parserOpts:{plugins:["typescript","jsx"]},plugins:[[Xt,t]]});return n?.code?{code:n.code,map:n.map}:null}var se=require("node:fs"),Je=require("node:path"),yn=new Set(["key","ref","children"]),bn=[/\(\)\s*=>/,/function\s*\(\)/,/\w+\(\)/,/\w+\.\w+/,/\w+\[.+\]/,/createSignal/,/createStore/,/createMemo/,/createEffect/],vn=/^on[A-Z]/;function ne(e,t){let n={name:e,isStatic:!0,isReactive:!1,isEvent:vn.test(e),isRef:e==="ref",isSpread:e.startsWith("...")};if(yn.has(e))return n;if(n.isEvent||n.isRef)return n.isStatic=!1,n;if(typeof t=="string"){let i=t;for(let s of bn)if(s.test(i)){n.isStatic=!1,n.isReactive=!0;break}i.includes("${")&&(n.isStatic=!1,n.isReactive=!0)}else typeof t=="function"?(n.isStatic=!1,n.isReactive=!0):typeof t=="object"&&t!==null&&(n.isStatic=!1);return n}function re(e){let t=new Map;for(let[n,i]of Object.entries(e))t.set(n,ne(n,i));return t}function Ee(e,t,n){if(typeof e!="string")return!1;let i=re(t);for(let s of i.values()){if(s.isSpread)return!1;s.isReactive&&s.isEvent}return!0}function ct(e){return e&&typeof e=="object"&&"_$litType$"in e}function pt(e,t,n,i={}){let s=["svg","path","circle","rect","g"].includes(e),o=Se(t,i),a=n.length>0?`, ${ye(n)}`:"";return i.useLitHTML!==!1&&Ee(e,t,n)?be(e,t,n,s):`jsx('${e}', ${o}${a})`}function Se(e,t={}){if(Object.keys(e).length===0)return"{}";let n=re(e),i=[];for(let[s,o]of Object.entries(e)){let a=n.get(s);a.isReactive&&!a.isStatic?i.push(`${s}: () => ${o}`):typeof o=="string"?i.push(`${s}: "${o}"`):typeof o=="number"||typeof o=="boolean"?i.push(`${s}: ${o}`):i.push(`${s}: ${o}`)}return`{ ${i.join(", ")} }`}function ye(e){return e.length===0?"undefined":e.length===1?String(e[0]):`[${e.join(", ")}]`}function be(e,t,n,i=!1){let s=i?"svg":"html",o=`<${e}`,a=[];for(let[l,c]of Object.entries(t)){if(l==="children"||l==="key"||l==="ref")continue;let p=ne(l,c);if(p.isEvent){let g=l.slice(2).toLowerCase();o+=` @${g}=\${${a.length}}`,a.push(String(c))}else p.isReactive?(o+=` ${l}=\${${a.length}}`,a.push(`signal(() => ${c})`)):typeof c=="string"?o+=` ${l}="${c}"`:(o+=` ${l}=\${${a.length}}`,a.push(String(c)))}if(o+=">",n.length>0)for(let l of n)typeof l=="string"?o+=l:(o+=`\${${a.length}}`,a.push(String(l)));return o+=`</${e}>`,`${s}\`${o}\`${a.length>0?`, ${a.join(", ")}`:""}`}function ve(e){return e=e.replace(/jsx\('([^']+)',\s*{},\s*"([^"]+)"\s*\)/g,(t,n,i)=>`_$staticNode('${n}', '${i}')`),e}function ut(e){return e}function we(e){let t=[],n=0;return e=e.replace(/jsx\('([^']+)',\s*{([^}]*)},\s*([^)]*)\)/g,(i,s,o,a)=>{if(!o.includes("()")&&!o.includes("=>")){let l=`_$static${n++}`;return t.push(`const ${l} = ${i};`),l}return i}),t.length>0?t.join(`
1
+ "use strict";var kt=Object.create;var U=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty;var I=(e,t)=>()=>(e&&(t=e(e=0)),t);var Xe=(e,t)=>{for(var n in t)U(e,n,{get:t[n],enumerable:!0})},je=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Nt(t))!Xt.call(e,s)&&s!==n&&U(e,s,{get:()=>t[s],enumerable:!(i=Jt(t,s))||i.enumerable});return e};var q=(e,t,n)=>(n=e!=null?kt(It(e)):{},je(t||!e||!e.__esModule?U(n,"default",{value:e,enumerable:!0}):n,e)),jt=e=>je(U({},"__esModule",{value:!0}),e);function Pe(e,t){return e.replace(/\$(\d+)/g,(n,i)=>t[Number(i)]??n)}function Lt(e,t){return typeof t=="string"?{module:t,export:e}:t}function Fe(e=[]){let t=new Map,n=[],i=[];for(let a of e){if(!$t(a)){i.push(a);continue}for(let[l,c]of Object.entries(a.components)){let p=Lt(l,c),g=t.get(l);if(g&&g.module!==p.module){let f=n.find(w=>w.name===l);f?f.modules.push(p.module):n.push({name:l,modules:[g.module,p.module]});continue}t.set(l,p)}}let s=new Map;return{resolve:a=>{if(s.has(a))return s.get(a);let l=t.get(a);if(!l)for(let c of i){let p=a.match(new RegExp(c.match.source,c.match.flags.replace("g","")));if(p){l={module:Pe(c.module,p),export:c.export?Pe(c.export,p):a};break}}return s.set(a,l),l},names:()=>[...t.keys()],conflicts:()=>n}}var $t,$e=I(()=>{"use strict";$t=e=>"components"in e});var ae,On,Le=I(()=>{"use strict";ae={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},On={version:2,module:"@fluixi/dom",symbols:[...ae.symbols,"template","cloneTemplate","walk"]}});function At(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Ae(e){return At(e)?e:JSON.stringify(e)}function Ot(e){return e.expr!==void 0?e.reactive?`() => (${e.expr})`:`(${e.expr})`:JSON.stringify(e.literal??!0)}function Dt(e){return e.expr!==void 0?`(${e.expr})`:JSON.stringify(e.literal??!0)}function _t(e,t,n){let i=e.filter(l=>l.kind==="spread"),o=e.filter(l=>l.kind!=="spread").map(l=>`${Ae(l.name)}: ${Ot(l)}`);t!=null&&o.push(`children: ${t}`);let a=`{ ${o.join(", ")} }`;return i.length>0?(n.add("mergeProps"),`mergeProps(${i.map(l=>l.expr).join(", ")}, ${a})`):a}function Oe(e,t){return e.length===1?Z(e[0],t):`[${e.map(n=>Z(n,t)).join(", ")}]`}function Te(e,t,n,i){i.add("createMemo"),i.add("createComponent");let s=t.filter(c=>c.kind==="spread"),a=t.filter(c=>c.kind!=="spread").map(c=>`get ${Ae(c.name)}() { return ${Dt(c)}; }`);n.length>0&&a.push(`get children() { return ${Oe(n,i)}; }`);let l=`{ ${a.join(", ")} }`;return s.length>0&&(i.add("mergeProps"),l=`mergeProps(${s.map(c=>c.expr).join(", ")}, ${l})`),`createMemo(() => createComponent(${e}, ${l}))`}function Z(e,t){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":return e.reactive?`() => (${e.code})`:`(${e.code})`;case"fragment":return e.children.length===0?"null":Oe(e.children,t);case"component":return Te(e.name,e.props,e.children,t);case"control":{let n=Tt[e.control]??e.control;return t.add(n),Te(n,e.props,e.children,t)}case"element":{t.add("createNativeElement");let n=JSON.stringify(e.tag),i="_el$",s=[],o=e.svg?`${n}, true`:n;if(s.push(`const ${i} = createNativeElement(${o});`),e.props.length>0){t.add("spread");let a=e.svg?", isSVG: true":"";s.push(`spread({ element: ${i}, props: ${_t(e.props,null,t)}${a} });`)}for(let a of e.children){t.add("insert");let l=Z(a,t),c=a.kind==="expr"&&a.reactive||a.kind==="component"||a.kind==="control";s.push(c?`insert(${i}, ${l}, null);`:`insert(${i}, ${l});`)}return s.push(`return ${i};`),`(() => { ${s.join(" ")} })()`}}}var Tt,j,K=I(()=>{"use strict";Le();Tt={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};j={name:"imperative",contract:ae,emit(e,t){let n=new Set;return{code:Z(e,n),imports:Array.from(n)}}}});function zt(e){return Bt(e,{concise:!0}).code}function Vt(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function _e(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ze(e,t,n={}){let i=e.quasi,s=i.expressions.map(l=>{let c=l;return{node:c,code:M(c,t),reactive:C(c)}}),o=Ht(i),{root:a}=(0,Be.parseTemplate)(o,{svg:n.svg});return new ce(s,t).lowerRoot(a.children)}function Ht(e){let t=[];return e.quasis.forEach((n,i)=>{let s=n.value.cooked??n.value.raw;if(t.push({kind:"static",text:s,start:n.start??0}),i<e.expressions.length){let o=e.expressions[i];t.push({kind:"hole",index:i,start:o.start??0,end:o.end??0})}}),t}var _,le,Be,Bt,De,ce,Ve=I(()=>{"use strict";_=require("@babel/core"),le=q(require("@babel/generator"),1),Be=require("@fluixi/template-parser");K();pe();Bt=le.default.default??le.default;De=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);ce=class{constructor(t,n){this.holes=t;this.used=n}hole(t){return this.holes[t]??{node:_.types.identifier("undefined"),code:"undefined",reactive:!1}}emit(t){let{code:n,imports:i}=j.emit(t,{});for(let s of i)this.used.add(s);return n}lowerRoot(t){let n=this.lowerChildren(t);return n.length===1?n[0]:{kind:"fragment",children:n}}lowerChildren(t){let n=[];for(let i=0;i<t.length;i++){let s=t[i];if(s.kind==="Element"||s.kind==="Component"){let a=s.attributes.find(l=>l.kind==="IfDirective");if(a&&a.kind==="IfDirective"){let l=i+1;l<t.length&&this.isBlankText(t[l])&&l++;let c=t[l],p=c&&(c.kind==="Element"||c.kind==="Component")&&c.attributes.some(g=>g.kind==="ElseDirective");n.push(this.lowerIf(s,a.hole,p?c:null)),p&&(i=l);continue}if(s.attributes.some(l=>l.kind==="EachDirective")){n.push(this.lowerEach(s));continue}}let o=this.lowerNode(s);o&&n.push(o)}return n}isBlankText(t){return t.kind==="Text"&&!t.raw&&Y(t.value)===""}lowerNode(t){switch(t.kind){case"Text":{if(t.raw)return{kind:"text",value:t.value};let n=Y(t.value);return n?{kind:"text",value:n}:null}case"Comment":return null;case"Expression":{let n=this.hole(t.hole);return{kind:"expr",code:n.code,reactive:n.reactive}}case"Fragment":return{kind:"fragment",children:this.lowerChildren(t.children)};case"Element":return this.lowerElement(t);case"Component":return this.lowerComponent(t);default:return null}}lowerElement(t){let n=t.attributes.find(i=>i.kind==="Attribute"&&i.name==="is");if(t.tag==="component"&&n&&n.value&&n.value.kind==="hole"){let i=t.attributes.filter(o=>o!==n),s=this.lowerComponent({...t,kind:"Component",tag:"Dynamic",tagHole:null,attributes:i});return s.props.unshift({name:"component",kind:"attr",expr:`() => (${this.hole(n.value.hole).code})`}),s}return{kind:"element",tag:t.tag,svg:t.namespace==="svg",props:this.lowerAttributes(t.attributes),children:this.lowerChildren(t.children),static:!1}}lowerComponent(t){let n=t.tagHole!=null?this.hole(t.tagHole).code:t.tag,i=this.lowerAttributes(t.attributes),{slots:s,rest:o}=this.partitionSlots(t.children);for(let[a,l]of s){let c=l.length===1?l[0]:{kind:"fragment",children:l};i.push({name:a,kind:"attr",expr:this.emit(c),jsxElement:!0})}return{kind:"component",name:n,props:i,children:this.lowerChildren(o)}}partitionSlots(t){let n=new Map,i=[];for(let s of t){if(s.kind==="Element"||s.kind==="Component"){let o=s.attributes.find(a=>a.kind==="Attribute"&&a.name==="slot");if(o&&o.value&&o.value.kind==="static"){let a={...s,attributes:s.attributes.filter(p=>p!==o)},l=a.kind==="Element"?this.lowerElement(a):this.lowerComponent(a),c=n.get(o.value.value)??[];c.push(l),n.set(o.value.value,c);continue}}i.push(s)}return{slots:n,rest:i}}lowerIf(t,n,i){let s=this.hole(n),o=[{name:"when",kind:"attr",expr:s.code,reactive:s.reactive}];if(i){let l=this.stripAndLower(i,c=>c.kind==="ElseDirective");o.push({name:"fallback",kind:"attr",expr:this.emit(l),jsxElement:!0})}let a=this.stripAndLower(t,l=>l.kind==="IfDirective");return{kind:"component",name:"Show",props:o,children:[a]}}lowerEach(t){let n=t.attributes.find(c=>c.kind==="EachDirective");if(!n||n.kind!=="EachDirective")return this.lowerNode(t);let i=this.hole(n.hole),s=[{name:"each",kind:"attr",expr:i.code,reactive:i.reactive}];if(n.key){let c="static"in n.key?`(item) => item[${JSON.stringify(n.key.static)}]`:this.hole(n.key.hole).code;s.push({name:"by",kind:"attr",expr:c})}let o=this.itemArrow(t),a;if(o){let c=o.body,p={kind:"expr",code:M(c,this.used),reactive:C(c)},g=this.rebuildWithChildren(t,[p]);a=`(${o.params.map(f=>zt(f)).join(", ")}) => (${this.emit(g)})`}else{let c=this.stripAndLower(t,p=>p.kind==="EachDirective");a=`() => (${this.emit(c)})`}return{kind:"component",name:"For",props:s,children:[{kind:"expr",code:a,reactive:!1}]}}itemArrow(t){let n=t.children.filter(s=>!this.isBlankText(s));if(n.length!==1||n[0].kind!=="Expression")return null;let i=this.hole(n[0].hole).node;return _.types.isArrowFunctionExpression(i)&&!_.types.isBlockStatement(i.body)?i:null}stripAndLower(t,n){let i={...t,attributes:t.attributes.filter(s=>!n(s))};return i.kind==="Element"?this.lowerElement(i):this.lowerComponent(i)}rebuildWithChildren(t,n){let i=this.lowerAttributes(t.attributes.filter(s=>s.kind!=="EachDirective"));return t.kind==="Element"?{kind:"element",tag:t.tag,svg:t.namespace==="svg",props:i,children:n,static:!1}:{kind:"component",name:t.tag,props:i,children:n}}lowerAttributes(t){let n=[],i=[],s=!1,o=[],a=!1,l=[];for(let c of t)switch(c.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":n.push(this.plainAttr(c));break;case"PropertyBinding":n.push({name:c.name,kind:"prop",expr:this.hole(c.hole).code,reactive:this.hole(c.hole).reactive});break;case"EventBinding":n.push(this.eventProp(c));break;case"RefBinding":n.push({name:"ref",kind:"ref",expr:this.hole(c.hole).code,reactive:this.hole(c.hole).reactive});break;case"Spread":n.push({name:"",kind:"spread",expr:this.hole(c.hole).code});break;case"ClassDirective":{let p=this.hole(c.hole);i.push(`${JSON.stringify(c.name)}: ${p.code}`),s=s||p.reactive;break}case"StyleDirective":{let p=this.hole(c.hole);o.push(`${JSON.stringify(c.name)}: ${p.code}`),a=a||p.reactive;break}case"BindDirective":n.push(...this.bindProps(c.name,this.hole(c.hole).code));break;case"UseDirective":{let p=c.name??(c.hole!=null?this.hole(c.hole).code:null);if(!p)break;l.push(c.name!=null&&c.hole!=null?`[${p}, () => (${this.hole(c.hole).code})]`:`[${p}]`);break}}return i.length>0&&n.push({name:"classList",kind:"attr",expr:`{ ${i.join(", ")} }`,reactive:s}),o.length>0&&n.push({name:"style",kind:"attr",expr:`{ ${o.join(", ")} }`,reactive:a}),l.length>0&&n.push({name:"use",kind:"attr",expr:`[${l.join(", ")}]`}),n}eventProp(t){let n=t.name.toLowerCase(),i=this.hole(t.hole).code;if(!(t.syntax==="colon"||t.modifiers.length>0))return{name:"on"+_e(t.name),kind:"event",event:{name:n,delegated:De.has(n)},expr:i};let o=this.wrapHandler(i,t.modifiers),a=this.eventOptions(t.modifiers),l=a?`[${o}, ${a}]`:o;return{name:"on:"+n,kind:"attr",expr:l}}wrapHandler(t,n){let i=n.includes("self")?"if (e.target !== e.currentTarget) return; ":"",s=[];return n.includes("prevent")&&s.push("e.preventDefault();"),n.includes("stop")&&s.push("e.stopPropagation();"),!i&&s.length===0?t:`(e) => { ${i}${s.join(" ")} return (${t})(e); }`}eventOptions(t){let n=[];return t.includes("capture")&&n.push("capture: true"),t.includes("once")&&n.push("once: true"),t.includes("passive")&&n.push("passive: true"),n.length?`{ ${n.join(", ")} }`:null}bindProps(t,n){let i=t==="checked",s=i?"change":"input",o=i?"checked":"value",a=`(${n})`;return[{name:t,kind:"attr",expr:`${a}[0]()`,reactive:!0},{name:"on"+_e(s),kind:"event",event:{name:s,delegated:De.has(s)},expr:`(e) => ${a}[1](e.target.${o})`}]}plainAttr(t){let n=t.value,i=t.name;t.name==="class"?i=n&&n.kind==="hole"&&_.types.isObjectExpression(this.hole(n.hole).node)?"classList":"className":t.name==="html"&&(i="innerHTML");let o={name:i,kind:"attr"};if(n==null)return o.literal=!0,o;if(n.kind==="static")return o.literal=n.value,o;if(n.kind==="hole"){let c=this.hole(n.hole);return o.expr=c.code,o.reactive=c.reactive,o}let a=!1,l=n.parts.map(c=>{if("text"in c)return Vt(c.text);let p=this.hole(c.hole);return a=a||p.reactive,"${"+p.code+"}"}).join("");return o.expr="`"+l+"`",o.reactive=a,o}}});function Q(e,t=new Set,n={}){return ze(e,t,n)}var ue=I(()=>{"use strict";Ve()});function Ue(e){return Wt(e,{concise:!0}).code}function Ut(e,t){let n=m.types.cloneNode(e,!0),i=m.types.file(m.types.program([m.types.expressionStatement(n)])),s=!1,o=(a,l,c)=>{for(let p of c)t.add(p);a.replaceWith(m.template.expression(l,{placeholderPattern:!1,plugins:["typescript"]})()),a.skip(),s=!0};return(0,m.traverse)(i,{"JSXElement|JSXFragment"(a){let l=a.node,{code:c,imports:p}=j.emit(B(l,t),{});o(a,c,p)},TaggedTemplateExpression(a){let l=a.node.tag;if(!m.types.isIdentifier(l)||l.name!=="html"&&l.name!=="svg")return;let c=Q(a.node,t,{svg:l.name==="svg"}),{code:p,imports:g}=j.emit(c,{});o(a,p,g)}}),s?i.program.body[0].expression:e}function M(e,t){return Ue(Ut(e,t))}function Kt(e){if(m.types.isJSXIdentifier(e)){let t=e.name[0]!==e.name[0].toLowerCase();return{tag:e.name,component:t}}return m.types.isJSXMemberExpression(e)?{tag:Ue(e),component:!0}:m.types.isJSXNamespacedName(e)?{tag:`${e.namespace.name}:${e.name.name}`,component:!1}:{tag:"div",component:!1}}function Yt(e){return m.types.isJSXIdentifier(e)?e.name==="class"?"className":e.name:m.types.isJSXNamespacedName(e)?`${e.namespace.name}:${e.name.name}`:"unknown"}function C(e){return m.types.isCallExpression(e)||m.types.isOptionalCallExpression(e)?!0:m.types.isMemberExpression(e)||m.types.isOptionalMemberExpression(e)?!(!e.computed&&m.types.isIdentifier(e.property,{name:"children"})):m.types.isConditionalExpression(e)?C(e.test)||C(e.consequent)||C(e.alternate):m.types.isLogicalExpression(e)||m.types.isBinaryExpression(e)?C(e.left)||C(e.right):m.types.isTemplateLiteral(e)?e.expressions.some(t=>C(t)):m.types.isObjectExpression(e)?e.properties.some(t=>m.types.isObjectProperty(t)&&!t.computed&&C(t.value)):m.types.isArrayExpression(e)?e.elements.some(t=>t!=null&&!m.types.isSpreadElement(t)&&C(t)):!1}function Qt(e,t){let n=Yt(e.name),i=Gt.test(n),s=i||n.startsWith("on:"),a={name:n,kind:i?"event":"attr"};i&&(a.event={name:n.slice(2).toLowerCase(),delegated:Zt.has(n.slice(2).toLowerCase())});let l=e.value;if(l==null)return a.literal=!0,a;if(m.types.isStringLiteral(l))return a.literal=l.value,a;if(m.types.isJSXExpressionContainer(l)&&!m.types.isJSXEmptyExpression(l.expression)){let c=l.expression;return m.types.isStringLiteral(c)||m.types.isNumericLiteral(c)||m.types.isBooleanLiteral(c)?(a.literal=c.value,a):(a.expr=M(c,t),a.reactive=s?!1:C(c),(m.types.isJSXElement(c)||m.types.isJSXFragment(c))&&(a.jsxElement=!0),a)}return a.literal=!0,a}function He(e,t){let n=e.value;return n==null?null:m.types.isStringLiteral(n)?JSON.stringify(n.value):m.types.isJSXExpressionContainer(n)&&!m.types.isJSXEmptyExpression(n.expression)?M(n.expression,t):null}function en(e,t){let n=[],i=[];for(let s of e){if(m.types.isJSXSpreadAttribute(s)){n.push({name:"",kind:"spread",expr:M(s.argument,t)});continue}if(!m.types.isJSXAttribute(s))continue;let o=m.types.isJSXNamespacedName(s.name)?s.name.namespace.name:null;if(o==="use"){let a=s.name.name.name;t.add(a);let l=He(s,t);i.push(l!=null?`[${a}, () => (${l})]`:`[${a}]`);continue}if(o==="oncapture"){let a=s.name.name.name.toLowerCase(),l=He(s,t)??"undefined";n.push({name:"on:"+a,kind:"attr",expr:`[${l}, { capture: true }]`});continue}n.push(Qt(s,t))}return i.length>0&&n.push({name:"use",kind:"attr",expr:`[${i.join(", ")}]`}),n}function Y(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let s=0;s<t.length;s++)/[^ \t]/.test(t[s])&&(n=s);let i="";for(let s=0;s<t.length;s++){let o=t[s].replace(/\t/g," ");s!==0&&(o=o.replace(/^ +/,"")),s!==t.length-1&&(o=o.replace(/ +$/,"")),o&&(s!==n&&(o+=" "),i+=o)}return i}function We(e,t){let n=[];for(let i of e)if(m.types.isJSXText(i)){let s=Y(i.value);s&&n.push({kind:"text",value:s})}else if(m.types.isJSXExpressionContainer(i)){if(!m.types.isJSXEmptyExpression(i.expression)){let s=i.expression;n.push({kind:"expr",code:M(s,t),reactive:C(s)})}}else m.types.isJSXElement(i)||m.types.isJSXFragment(i)?n.push(B(i,t)):m.types.isJSXSpreadChild(i)&&n.push({kind:"expr",code:M(i.expression,t),reactive:!1});return n}function B(e,t=new Set){if(m.types.isJSXFragment(e))return{kind:"fragment",children:We(e.children,t)};let{tag:n,component:i}=Kt(e.openingElement.name),s=en(e.openingElement.attributes,t),o=We(e.children,t);return i?{kind:"component",name:n,props:s,children:o}:{kind:"element",tag:n,svg:qt.has(n),props:s,children:o,static:!1}}var m,me,Wt,qt,Gt,Zt,pe=I(()=>{"use strict";m=require("@babel/core"),me=q(require("@babel/generator"),1);K();ue();Wt=me.default.default??me.default;qt=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),Gt=/^on[A-Z]/,Zt=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"])});function nn(e,t,n){let{runtime:i,pragma:s,development:o,autoShow:a=!0}=n;return i==="automatic"?V(e,t,o,a):pn(e,t,s)}function Ge(e,t,n){return t.length>0?(n.needsMergeProps=!0,r.types.callExpression(r.types.identifier("mergeProps"),[...t,r.types.objectExpression(e)])):r.types.objectExpression(e)}function tt(e){return e.length===1?e[0]:r.types.arrayExpression(e)}function sn(e,t,n,i,s,o){if(!t){let f=[...n];return s.length>0&&f.push(r.types.objectMethod("get",r.types.identifier("children"),[],r.types.blockStatement([r.types.returnStatement(tt(s))]))),nt(e,Ge(f,i,o),o)}let a=e.value,l=rn.has(a),c=r.types.identifier("_el$"),p=[];o.needsCreateNativeElement=!0;let g=[e];if(l&&g.push(r.types.booleanLiteral(!0)),p.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(c,r.types.callExpression(r.types.identifier("createNativeElement"),g))])),n.length>0||i.length>0){o.needsSpread=!0;let f=[r.types.objectProperty(r.types.identifier("element"),c),r.types.objectProperty(r.types.identifier("props"),Ge(n,i,o))];l&&f.push(r.types.objectProperty(r.types.identifier("isSVG"),r.types.booleanLiteral(!0))),p.push(r.types.expressionStatement(r.types.callExpression(r.types.identifier("spread"),[r.types.objectExpression(f)])))}if(s.length>0){o.needsInsert=!0;for(let f of s){let $=r.types.isArrowFunctionExpression(f)||r.types.isFunctionExpression(f)||r.types.isCallExpression(f)&&r.types.isIdentifier(f.callee)&&f.callee.name==="createMemo"?[r.types.cloneNode(c),f,r.types.nullLiteral()]:[r.types.cloneNode(c),f];p.push(r.types.expressionStatement(r.types.callExpression(r.types.identifier("insert"),$)))}}return p.push(r.types.returnStatement(c)),r.types.callExpression(r.types.arrowFunctionExpression([],r.types.blockStatement(p)),[])}function nt(e,t,n){if(r.types.isIdentifier(e)&&T.has(e.name)&&(n.controlFlowComponents.add(e.name),n.needsControlFlowImport=!0),r.types.isIdentifier(e)&&!T.has(e.name)&&!ee.has(e.name)&&n.componentResolver){let i=n.componentResolver.resolve(e.name);i&&n.resolvedComponents.set(e.name,i)}return n.backend==="imperative"?(n.needsCreateComponent=!0,n.needsCreateMemo=!0,r.types.callExpression(r.types.identifier("createMemo"),[r.types.arrowFunctionExpression([],r.types.callExpression(r.types.identifier("createComponent"),[e,t]))])):r.types.callExpression(r.types.identifier("jsx"),[e,t])}function Ze(e,t){let n=new Set,i=B(e,n),{code:s,imports:o}=j.emit(i,{});for(let a of o)n.add(a);for(let a of n)t.irImports.add(a);return r.template.expression(s,{placeholderPattern:!1,plugins:["typescript"]})()}function on(e){let t=new Map,n=[];for(let i of e){let s=i.source.value;if(!i.specifiers.every(l=>r.types.isImportSpecifier(l))){n.push(i);continue}let a=t.get(s);if(!a){let l=new Set(i.specifiers.map(c=>c.local.name));t.set(s,{decl:i,names:l}),n.push(i);continue}for(let l of i.specifiers)a.names.has(l.local.name)||(a.names.add(l.local.name),a.decl.specifiers.push(l))}return n}function an(e,t){let n=new Set,i=r.types.isIdentifier(e.tag)&&e.tag.name==="svg",s=Q(e,n,{svg:i}),{code:o,imports:a}=j.emit(s,{});for(let c of a)n.add(c);for(let c of n)t.irImports.add(c);rt(s,t),t.hasLitIR=!0;let l=r.template.expression(o,{placeholderPattern:!1,plugins:["typescript"]})();return ln(l,e),l}function ln(e,t){if(!t.loc)return;let n=new Set,i=s=>{if(!n.has(s)){n.add(s),s.loc||(s.loc=t.loc,s.start=t.start,s.end=t.end);for(let o of r.types.VISITOR_KEYS[s.type]??[]){let a=s[o];if(Array.isArray(a))for(let l of a)l&&typeof l=="object"&&"type"in l&&i(l);else a&&typeof a=="object"&&"type"in a&&i(a)}}};i(e)}function rt(e,t){if(e.kind==="component"&&(ee.has(e.name)||T.has(e.name)))t.controlFlowComponents.add(e.name),t.needsControlFlowImport=!0;else if(e.kind==="component"&&t.componentResolver){let n=t.componentResolver.resolve(e.name);n&&t.resolvedComponents.set(e.name,n)}if((e.kind==="element"||e.kind==="component"||e.kind==="control")&&"props"in e)for(let n of e.props)n.kind==="event"&&n.event?.delegated&&t.delegatedEvents.add(n.event.name);if("children"in e&&e.children)for(let n of e.children)rt(n,t)}function cn(e){return e.map(t=>{if(r.types.isObjectProperty(t)){let n=t.key,i=t.computed,s=t.value;return r.types.objectMethod("get",n,[],r.types.blockStatement([r.types.returnStatement(s)]),i)}return t})}function V(e,t,n,i=!0){let s=e.openingElement,o=e.children,a=it(s.name),l=r.types.isJSXIdentifier(s.name)&&/^[a-z]/.test(s.name.name),c=ot(s.attributes,t,l,r.types.isJSXIdentifier(s.name)?s.name.name:""),p=c.props,g=c.spreads;l||(p=cn(p));let f=de(o,t,i);if(t.backend==="imperative")return sn(a,l,p,g,f,t);if(f.length>0){let X=f.length===1?f[0]:r.types.arrayExpression(f);p.push(r.types.objectProperty(r.types.identifier("children"),X))}let w;if(g.length>0){let X=p.length>0?r.types.objectExpression(p):r.types.objectExpression([]);t.needsMergeProps=!0,w=r.types.callExpression(r.types.identifier("mergeProps"),[...g,X])}else w=r.types.objectExpression(p);let $=n?"jsxDEV":f.length>1?"jsxs":"jsx",R=[a,w];return n&&R.push(r.types.identifier("undefined"),r.types.booleanLiteral(!1),r.types.identifier("undefined"),r.types.identifier("undefined")),r.types.callExpression(r.types.identifier($),R)}function pn(e,t,n){let i=e.openingElement,s=e.children,o=it(i.name),a=r.types.isJSXIdentifier(i.name)&&/^[a-z]/.test(i.name.name),{props:l,spreads:c}=ot(i.attributes,t,a,r.types.isJSXIdentifier(i.name)?i.name.name:""),p=de(s,t,t.autoShow??!0),g;if(c.length>0){let w=l.length>0?r.types.objectExpression(l):r.types.objectExpression([]);t.needsMergeProps=!0,g=r.types.callExpression(r.types.identifier("mergeProps"),[...c,w])}else g=l.length>0?r.types.objectExpression(l):r.types.nullLiteral();let f=[o,g,...p];return r.types.callExpression(r.types.identifier(n),f)}function te(e,t,n){let{runtime:i,pragmaFrag:s,development:o}=n,a=de(e.children,t,t.autoShow??!0);if(t.backend==="imperative")return a.length===0?r.types.nullLiteral():tt(a);if(i==="automatic"){let l=o?"jsxDEV":a.length>1?"jsxs":"jsx",c=r.types.objectExpression([r.types.objectProperty(r.types.identifier("children"),a.length===1?a[0]:r.types.arrayExpression(a))]),p=[r.types.identifier("Fragment"),c];return o&&p.push(r.types.identifier("undefined"),r.types.booleanLiteral(!1),r.types.identifier("undefined"),r.types.identifier("undefined")),r.types.callExpression(r.types.identifier(l),p)}else return r.types.callExpression(r.types.identifier(s),a)}function it(e){if(r.types.isJSXIdentifier(e)){let t=e.name;return t[0]===t[0].toLowerCase()?r.types.stringLiteral(t):r.types.identifier(t)}return r.types.isJSXMemberExpression(e)?st(e):r.types.isJSXNamespacedName(e)?r.types.stringLiteral(`${e.namespace.name}:${e.name.name}`):r.types.stringLiteral("div")}function st(e){let t;return r.types.isJSXIdentifier(e.object)?t=r.types.identifier(e.object.name):t=st(e.object),r.types.memberExpression(t,r.types.identifier(e.property.name))}function un(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}function ot(e,t,n=!0,i=""){let s=[],o=[],a=tn[i];for(let l of e)if(r.types.isJSXSpreadAttribute(l))o.push(l.argument);else if(r.types.isJSXAttribute(l)){let c=mn(l.name),p=fn(l.value,t,c,n);if(Qe.test(c)){let H=c.slice(2).toLowerCase();et.includes(H)&&t.delegatedEvents.add(H)}let g=un(c)?r.types.identifier(c):r.types.stringLiteral(c),f=l.value,w=r.types.isJSXElement(f)||r.types.isJSXFragment(f)||r.types.isJSXExpressionContainer(f)&&(r.types.isJSXElement(f.expression)||r.types.isJSXFragment(f.expression)),$=!n&&c===a,R=r.types.isJSXExpressionContainer(f)&&!r.types.isJSXEmptyExpression(f.expression)?f.expression:null,X=!n&&!!R&&at(R,c);!n&&w||$||X?s.push(r.types.objectMethod("get",g,[],r.types.blockStatement([r.types.returnStatement(p)]))):s.push(r.types.objectProperty(g,p))}return{props:s,spreads:o}}function mn(e){return r.types.isJSXIdentifier(e)?e.name==="class"?"className":e.name:r.types.isJSXNamespacedName(e)?`${e.namespace.name}:${e.name.name}`:"unknown"}function fn(e,t,n="",i=!0){if(e===null)return r.types.booleanLiteral(!0);if(r.types.isStringLiteral(e))return e.value.includes(`
2
+ `)?r.types.stringLiteral(e.value.replace(/\s+/g," ").trim()):e;if(r.types.isJSXExpressionContainer(e)){if(r.types.isJSXEmptyExpression(e.expression))return r.types.booleanLiteral(!0);let s=e.expression;return i&&at(s,n)?r.types.arrowFunctionExpression([],s):s}return r.types.isJSXElement(e)?V(e,t,!1,t.autoShow??!0):r.types.isJSXFragment(e)?te(e,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1}):r.types.booleanLiteral(!0)}function at(e,t){return Qe.test(t)||t.startsWith("on:")||t==="ref"||t.startsWith("use:")||r.types.isArrowFunctionExpression(e)||r.types.isFunctionExpression(e)||r.types.isIdentifier(e)||r.types.isStringLiteral(e)||r.types.isNumericLiteral(e)||r.types.isBooleanLiteral(e)||r.types.isNullLiteral(e)?!1:!!(r.types.isCallExpression(e)||r.types.isOptionalCallExpression(e)||r.types.isMemberExpression(e)||r.types.isOptionalMemberExpression(e)||r.types.isLogicalExpression(e)||r.types.isConditionalExpression(e)||r.types.isBinaryExpression(e)||r.types.isUnaryExpression(e)||r.types.isTemplateLiteral(e)||r.types.isObjectExpression(e)||r.types.isArrayExpression(e))}function dn(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let s=0;s<t.length;s++)/[^ \t]/.test(t[s])&&(n=s);let i="";for(let s=0;s<t.length;s++){let o=t[s].replace(/\t/g," ");s!==0&&(o=o.replace(/^ +/,"")),s!==t.length-1&&(o=o.replace(/ +$/,"")),o&&(s!==n&&(o+=" "),i+=o)}return i}function de(e,t,n=!0){let i=[];for(let s of e)if(r.types.isJSXText(s)){let o=dn(s.value);o&&i.push(r.types.stringLiteral(o))}else if(r.types.isJSXExpressionContainer(s)){if(!r.types.isJSXEmptyExpression(s.expression)){let o=s.expression;if(n){let a=gn(o,t)??hn(o,t);if(a){i.push(a);continue}}else{let a=xn(o,t);if(a){i.push(a);continue}}Sn(o)?i.push(r.types.arrowFunctionExpression([],o)):i.push(o)}}else r.types.isJSXElement(s)?i.push(V(s,t,!1,t.autoShow??!0)):r.types.isJSXFragment(s)?i.push(te(s,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1})):r.types.isJSXSpreadChild(s)&&i.push(s.expression);return i}function gn(e,t){if(!r.types.isArrowFunctionExpression(e)||e.params.length!==0||e.async)return null;let n=e.body;if(r.types.isLogicalExpression(n)&&n.operator==="&&"){let i=k(n.right);if(i)return z(P(n.left),i,null,t)}if(r.types.isConditionalExpression(n)){let i=k(n.consequent);if(i){let s=ge(n.alternate,t);return z(P(n.test),i,s,t,!0)}}return null}function hn(e,t){if(r.types.isLogicalExpression(e)&&e.operator==="&&"){let n=k(e.right);if(n)return z(P(e.left),n,null,t)}if(r.types.isConditionalExpression(e)){let n=k(e.consequent);if(n){let i=ge(e.alternate,t);return z(P(e.test),n,i,t)}}return null}function xn(e,t){let n=r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&r.types.isExpression(e.body)?e.body:e;if(r.types.isConditionalExpression(n)){let i=P(n.test),o=k(n.consequent)??n.consequent,l=k(n.alternate)??n.alternate,c=r.types.conditionalExpression(i,o,l);return fe(n.consequent)||fe(n.alternate)?null:(t.needsCreateMemo=!0,r.types.callExpression(r.types.identifier("createMemo"),[r.types.arrowFunctionExpression([],c)]))}if(r.types.isLogicalExpression(n)&&n.operator==="&&"){let i=P(n.left),o=k(n.right)??n.right,a=r.types.logicalExpression("&&",i,o);return fe(n.right)?null:(t.needsCreateMemo=!0,r.types.callExpression(r.types.identifier("createMemo"),[r.types.arrowFunctionExpression([],a)]))}return null}function ge(e,t){if(En(e))return null;let n=k(e);if(n)return lt(n,t);if(r.types.isConditionalExpression(e)){let i=e,s=k(i.consequent);if(s){let o=ge(i.alternate,t);return z(P(i.test),s,o,t)}}return e}function Ke(e){return r.types.isJSXElement(e)||r.types.isJSXFragment(e)}function fe(e){let t=k(e);if(!t||!r.types.isJSXElement(t))return!1;let n=t.openingElement.name;return r.types.isJSXIdentifier(n)&&ee.has(n.name)}function k(e){return Ke(e)?e:r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&Ke(e.body)?e.body:null}function P(e){return r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&r.types.isExpression(e.body)?e.body:e}function En(e){return r.types.isNullLiteral(e)||r.types.isIdentifier(e)&&e.name==="undefined"||r.types.isBooleanLiteral(e)&&e.value===!1}function lt(e,t){return r.types.isJSXElement(e)?V(e,t,!1,t.autoShow??!0):te(e,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1})}function z(e,t,n,i,s=!1){i.controlFlowComponents.add("Show"),i.needsControlFlowImport=!0;let o=lt(t,i),a=[r.types.objectProperty(r.types.identifier("when"),r.types.arrowFunctionExpression([],e)),r.types.objectProperty(r.types.identifier("children"),o)];return n&&a.push(r.types.objectProperty(r.types.identifier("fallback"),n)),nt(r.types.identifier("Show"),r.types.objectExpression(a),i)}function Sn(e){return r.types.isMemberExpression(e)||r.types.isOptionalMemberExpression(e)?!(!e.computed&&r.types.isIdentifier(e.property,{name:"children"})):r.types.isCallExpression(e)||r.types.isOptionalCallExpression(e)?!0:r.types.isIdentifier(e)?!1:!!(r.types.isLogicalExpression(e)||r.types.isConditionalExpression(e)||r.types.isBinaryExpression(e)||r.types.isUnaryExpression(e)||r.types.isTemplateLiteral(e))}function ct(e,t){let n=e.openingElement;if(!r.types.isJSXIdentifier(n.name))return!1;let i=n.name.name;if(i[0]!==i[0].toLowerCase())return!1;for(let s of n.attributes){if(r.types.isJSXSpreadAttribute(s))return!1;if(r.types.isJSXAttribute(s)){let o=s.value;if(r.types.isJSXExpressionContainer(o)&&!r.types.isStringLiteral(o.expression)&&!r.types.isNumericLiteral(o.expression))return!1}}for(let s of e.children)if(r.types.isJSXElement(s)&&!ct(s,t)||r.types.isJSXExpressionContainer(s))return!1;return!0}function vn(e,t){let n=`_$static${t.staticCounter++}`,i=V(e,t,!1);return t.staticElements.set(n,i),r.types.identifier(n)}function yn(e,t){let n=e.openingElement.name.name;return n==="Show"?bn(e,t):n==="For"?Cn(e,t):null}function bn(e,t){return null}function Cn(e,t){return null}var Ye,r,ee,qe,T,tn,Qe,et,A,rn,he=I(()=>{"use strict";Ye=require("@babel/helper-plugin-utils");$e();r=require("@babel/core");pe();ue();K();ee=new Set(["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense","SuspenseList","Await"]),qe=new Set(["Suspense","SuspenseList","Await"]),T=new Set(["Router","Outlet","Redirect","Link"]),tn={Show:"when",For:"each",Index:"each",Match:"when"},Qe=/^on[A-Z]/,et=["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave"],A=(0,Ye.declare)((e,t={})=>{e.assertVersion(7);let{runtime:n="automatic",importSource:i="@fluixi/jsx",pragma:s="jsx",pragmaFrag:o="Fragment",development:a=!1,detectReactivity:l=!0,useLitHTML:c=!0,hoistStatics:p=!0,delegateEvents:g=!0,delegatedEvents:f=et,optimizeControlFlow:w=!0,sourceMaps:$=!0,signalModule:R="@fluixi/dom",controlFlowModule:X="@fluixi/dom",routerModule:H="@fluixi/core/router-next",reactiveModule:ke="@fluixi/reactive/signal",autoShowTransform:Je=!1,backend:J="imperative",codegen:D="inline",format:Ne="both",litTag:bt="html",resolve:Ct=[]}=t,Ie=Fe(Ct),wt=Ne==="lit"||Ne==="both",Rt={backend:J,codegen:D,irImports:new Set,libModule:"@fluixi/core",hasJSX:!1,hasReactivity:!1,hasLitHTML:!1,needsSignalImport:!1,needsControlFlowImport:!1,needsCreateMemo:!1,controlFlowComponents:new Set,resolvedComponents:new Map,componentResolver:Ie,delegatedEvents:new Set,staticElements:new Map,staticCounter:0};return{name:"@fluixi/babel-plugin-jsx",manipulateOptions(d,u){u.plugins.push("jsx","typescript")},pre(d){Object.assign(d,Rt)},visitor:{ImportDeclaration(d,u){d.node.source.value==="@fluixi/core/rx"&&(d.node.source=r.types.stringLiteral("@fluixi/reactive"))},Program:{enter(d,u){Object.assign(u,{hasJSX:!1,hasReactivity:!1,hasLitHTML:!1,hasLitIR:!1,needsSignalImport:!1,needsControlFlowImport:!1,needsCreateMemo:!1,controlFlowComponents:new Set,resolvedComponents:new Map,componentResolver:Ie,delegatedEvents:new Set,staticElements:new Map,autoShow:Je,staticCounter:0,libModule:"@fluixi/core",backend:J,codegen:D,irImports:new Set,needsCreateNativeElement:!1,needsInsert:!1,needsSpread:!1,needsCreateComponent:!1,needsMergeProps:!1})},exit(d,u){let h=[];if(u.hasJSX||u.needsSignalImport&&h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("signal"),r.types.identifier("signal"))],r.types.stringLiteral(R))),u.hasJSX||u.hasLitIR){if(u.irImports.size>0){let x=new Set(["Show","For","Index","Switch","Match","Dynamic","ErrorBoundary","Portal","Suspense"]),S=new Set(["createMemo","createEffect","createRenderEffect","createRoot","createSignal","onCleanup","batch","untrack"]),E=Array.from(u.irImports),y=v=>r.types.importSpecifier(r.types.identifier(v),r.types.identifier(v)),N=v=>!d.scope.hasBinding(v),L=E.filter(v=>S.has(v)&&N(v)),b=E.filter(v=>!x.has(v)&&!S.has(v)&&N(v)),W=E.filter(v=>x.has(v)&&N(v));L.length>0&&h.push(r.types.importDeclaration(L.map(y),r.types.stringLiteral(ke))),b.length>0&&h.push(r.types.importDeclaration(b.map(y),r.types.stringLiteral(R))),W.length>0&&h.push(r.types.importDeclaration(W.map(y),r.types.stringLiteral(X)))}if(u.hasJSX&&J==="imperative"&&D!=="ir"){let S=[[!!u.needsCreateNativeElement,"createNativeElement"],[!!u.needsSpread,"spread"],[!!u.needsInsert,"insert"],[!!u.needsCreateComponent,"createComponent"],[!!u.needsMergeProps,"mergeProps"]].filter(([E,y])=>E&&!d.scope.hasBinding(y)).map(([,E])=>r.types.importSpecifier(r.types.identifier(E),r.types.identifier(E)));S.length>0&&h.push(r.types.importDeclaration(S,r.types.stringLiteral(R)))}else if(u.hasJSX&&n==="automatic"){let x=[r.types.importSpecifier(r.types.identifier("jsx"),r.types.identifier("jsx")),r.types.importSpecifier(r.types.identifier("jsxs"),r.types.identifier("jsxs")),r.types.importSpecifier(r.types.identifier("Fragment"),r.types.identifier("Fragment"))];a&&x.push(r.types.importSpecifier(r.types.identifier("jsxDEV"),r.types.identifier("jsxDEV"))),u.needsMergeProps&&x.push(r.types.importSpecifier(r.types.identifier("mergeProps"),r.types.identifier("mergeProps"))),h.push(r.types.importDeclaration(x,r.types.stringLiteral(i)))}if(u.needsCreateMemo&&!d.scope.hasBinding("createMemo")&&h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("createMemo"),r.types.identifier("createMemo"))],r.types.stringLiteral(J==="imperative"?ke:u.libModule??"@fluixi/core"))),u.needsControlFlowImport&&u.controlFlowComponents.size>0){let x=Array.from(u.controlFlowComponents).filter(b=>!d.scope.hasBinding(b)),S=u.libModule??"@fluixi/core",E=x.filter(b=>T.has(b)),y=x.filter(b=>qe.has(b)),N=x.filter(b=>!qe.has(b)&&!T.has(b)),L=(b,W)=>r.types.importDeclaration(b.map(v=>r.types.importSpecifier(r.types.identifier(v),r.types.identifier(v))),r.types.stringLiteral(W));N.length>0&&h.push(L(N,X)),y.length>0&&h.push(L(y,S)),E.length>0&&h.push(L(E,H))}if(u.resolvedComponents.size>0){let x=new Map;for(let[S,E]of u.resolvedComponents){if(d.scope.hasBinding(S))continue;let y=x.get(E.module)??[];y.push({local:S,exported:E.export}),x.set(E.module,y)}for(let[S,E]of x)h.push(r.types.importDeclaration(E.map(({local:y,exported:N})=>N==="default"?r.types.importDefaultSpecifier(r.types.identifier(y)):r.types.importSpecifier(r.types.identifier(y),r.types.identifier(N))),r.types.stringLiteral(S)))}if(g&&u.delegatedEvents.size>0){h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("delegateEvents"),r.types.identifier("delegateEvents"))],r.types.stringLiteral(J==="imperative"?R:"@fluixi/jsx")));let x=r.types.arrayExpression(Array.from(u.delegatedEvents).map(E=>r.types.stringLiteral(E))),S=r.types.expressionStatement(r.types.callExpression(r.types.identifier("delegateEvents"),[x]));d.node.body.unshift(S)}if(p&&u.staticElements.size>0){let x=[];u.staticElements.forEach((S,E)=>{x.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(r.types.identifier(E),S)]))}),d.node.body.unshift(...x)}}h.length>0&&d.node.body.unshift(...on(h))}},JSXElement(d,u){if(u.hasJSX=!0,J==="imperative"&&D==="ir"){d.replaceWith(Ze(d.node,u));return}let h=d.node,x=h.openingElement;if(r.types.isJSXIdentifier(x.name)&&T.has(x.name.name)&&(u.controlFlowComponents.add(x.name.name),u.needsControlFlowImport=!0),r.types.isJSXIdentifier(x.name)&&ee.has(x.name.name)&&(u.controlFlowComponents.add(x.name.name),w)){let E=yn(h,u);if(E){d.replaceWith(E);return}}if(p&&J!=="imperative"&&ct(h,u)){let E=vn(h,u);if(E){d.replaceWith(E);return}}let S=nn(h,u,{runtime:n,pragma:s,development:a,detectReactivity:l,useLitHTML:c,autoShow:Je});d.replaceWith(S)},JSXFragment(d,u){if(u.hasJSX=!0,J==="imperative"&&D==="ir"){d.replaceWith(Ze(d.node,u));return}let h=te(d.node,u,{runtime:n,pragmaFrag:o,development:a});d.replaceWith(h)},CallExpression(d,u){if(!l)return;let h=d.node.callee;h.name,r.types.isIdentifier(h)&&(h.name==="createSignal"||h.name==="createStore"||h.name==="useContext"||h.name==="useLocation")&&(u.hasReactivity=!0)},JSXExpressionContainer(d){},TaggedTemplateExpression(d,u){if(wt&&J==="imperative"&&r.types.isIdentifier(d.node.tag)&&(d.node.tag.name===bt||d.node.tag.name==="svg")){d.replaceWith(an(d.node,u));return}}}}});rn=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"])});var pt=I(()=>{"use strict"});var ut={};Xe(ut,{babelPluginReactiveJSX:()=>wn,createPlugin:()=>Rn,createPreset:()=>ne,default:()=>A,presets:()=>kn});function Rn(e){return[A,e]}function ne(e={}){return{plugins:[[A,{runtime:"automatic",importSource:"@fluixi/jsx",development:!1,detectReactivity:!0,useLitHTML:!0,hoistStatics:!0,delegateEvents:!0,optimizeControlFlow:!0,sourceMaps:!0,...e}]]}}var wn,kn,mt=I(()=>{"use strict";he();pt();he();wn=A;kn={production:ne({development:!1,hoistStatics:!0,delegateEvents:!0,optimizeControlFlow:!0}),development:ne({development:!0,hoistStatics:!1,sourceMaps:!0}),minimal:ne({detectReactivity:!1,useLitHTML:!1,hoistStatics:!1,delegateEvents:!1,optimizeControlFlow:!1})}});var $n={};Xe($n,{analyzeProp:()=>re,analyzeProps:()=>ie,createBabelPlugin:()=>O,createESBuildPlugin:()=>vt,createRollupPlugin:()=>St,createTypeScriptTransformer:()=>ht,createVitePlugin:()=>xt,createWebpackLoader:()=>Et,default:()=>Fn,generateChildrenCode:()=>ve,generateCreateElement:()=>dt,generateEventDelegation:()=>we,generateLitHTMLTemplate:()=>ye,generatePropsCode:()=>Se,hoistStatic:()=>Ce,isLitTemplate:()=>ft,optimizeSpreads:()=>gt,optimizeStatic:()=>be,serverFunctionsVitePlugin:()=>Pn,shouldUseLitTemplate:()=>Ee,transform:()=>F,transformServerFunctions:()=>G});module.exports=jt($n);var Me=require("@babel/core"),Mt="@fluixi/start/server-fn";function Pt(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)}function Ft({types:e}){return{name:"fluixi-server-functions",visitor:{Program:{enter(t,n){n.fxIndex=0,n.fxUsed=null},exit(t,n){n.fxUsed&&t.unshiftContainer("body",e.importDeclaration([e.importSpecifier(e.identifier(n.fxUsed),e.identifier(n.fxUsed))],e.stringLiteral(n.opts.runtimeModule||Mt)))}},"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression":(t,n)=>{let i=t.node.body;if(!e.isBlockStatement(i))return;let o=(i.directives||[]).findIndex(f=>f.value.value==="use server");if(o<0)return;i.directives.splice(o,1);let a=(n.opts.filename||n.filename||"unknown").replace(n.opts.root?n.opts.root+"/":"",""),l=`${Pt(a)}:${n.fxIndex++}`,c=!!n.opts.ssr,p=c?"$$registerServerFn":"$$createServerReference";n.fxUsed=p;let g=c?e.callExpression(e.identifier(p),[e.stringLiteral(l),t.isFunctionDeclaration()?e.functionExpression(null,t.node.params,i,t.node.generator,t.node.async):t.node]):e.callExpression(e.identifier(p),[e.stringLiteral(l)]);t.isFunctionDeclaration()?t.replaceWith(e.variableDeclaration("const",[e.variableDeclarator(t.node.id,g)])):t.replaceWith(g),t.skip()}}}}function G(e,t){if(!e.includes("use server"))return null;let n=(0,Me.transformSync)(e,{filename:t.filename,configFile:!1,babelrc:!1,sourceMaps:!0,parserOpts:{plugins:["typescript","jsx"]},plugins:[[Ft,t]]});return n?.code?{code:n.code,map:n.map}:null}var oe=require("node:fs"),Re=require("node:path"),Jn=new Set(["key","ref","children"]),Nn=[/\(\)\s*=>/,/function\s*\(\)/,/\w+\(\)/,/\w+\.\w+/,/\w+\[.+\]/,/createSignal/,/createStore/,/createMemo/,/createEffect/],In=/^on[A-Z]/;function re(e,t){let n={name:e,isStatic:!0,isReactive:!1,isEvent:In.test(e),isRef:e==="ref",isSpread:e.startsWith("...")};if(Jn.has(e))return n;if(n.isEvent||n.isRef)return n.isStatic=!1,n;if(typeof t=="string"){let i=t;for(let s of Nn)if(s.test(i)){n.isStatic=!1,n.isReactive=!0;break}i.includes("${")&&(n.isStatic=!1,n.isReactive=!0)}else typeof t=="function"?(n.isStatic=!1,n.isReactive=!0):typeof t=="object"&&t!==null&&(n.isStatic=!1);return n}function ie(e){let t=new Map;for(let[n,i]of Object.entries(e))t.set(n,re(n,i));return t}function Ee(e,t,n){if(typeof e!="string")return!1;let i=ie(t);for(let s of i.values()){if(s.isSpread)return!1;s.isReactive&&s.isEvent}return!0}function ft(e){return e&&typeof e=="object"&&"_$litType$"in e}function dt(e,t,n,i={}){let s=["svg","path","circle","rect","g"].includes(e),o=Se(t,i),a=n.length>0?`, ${ve(n)}`:"";return i.useLitHTML!==!1&&Ee(e,t,n)?ye(e,t,n,s):`jsx('${e}', ${o}${a})`}function Se(e,t={}){if(Object.keys(e).length===0)return"{}";let n=ie(e),i=[];for(let[s,o]of Object.entries(e)){let a=n.get(s);a.isReactive&&!a.isStatic?i.push(`${s}: () => ${o}`):typeof o=="string"?i.push(`${s}: "${o}"`):typeof o=="number"||typeof o=="boolean"?i.push(`${s}: ${o}`):i.push(`${s}: ${o}`)}return`{ ${i.join(", ")} }`}function ve(e){return e.length===0?"undefined":e.length===1?String(e[0]):`[${e.join(", ")}]`}function ye(e,t,n,i=!1){let s=i?"svg":"html",o=`<${e}`,a=[];for(let[l,c]of Object.entries(t)){if(l==="children"||l==="key"||l==="ref")continue;let p=re(l,c);if(p.isEvent){let g=l.slice(2).toLowerCase();o+=` @${g}=\${${a.length}}`,a.push(String(c))}else p.isReactive?(o+=` ${l}=\${${a.length}}`,a.push(`signal(() => ${c})`)):typeof c=="string"?o+=` ${l}="${c}"`:(o+=` ${l}=\${${a.length}}`,a.push(String(c)))}if(o+=">",n.length>0)for(let l of n)typeof l=="string"?o+=l:(o+=`\${${a.length}}`,a.push(String(l)));return o+=`</${e}>`,`${s}\`${o}\`${a.length>0?`, ${a.join(", ")}`:""}`}function be(e){return e=e.replace(/jsx\('([^']+)',\s*{},\s*"([^"]+)"\s*\)/g,(t,n,i)=>`_$staticNode('${n}', '${i}')`),e}function gt(e){return e}function Ce(e){let t=[],n=0;return e=e.replace(/jsx\('([^']+)',\s*{([^}]*)},\s*([^)]*)\)/g,(i,s,o,a)=>{if(!o.includes("()")&&!o.includes("=>")){let l=`_$static${n++}`;return t.push(`const ${l} = ${i};`),l}return i}),t.length>0?t.join(`
3
3
  `)+`
4
- `+e:e}function Ce(e,t={}){let n=t.delegatedEvents||["click","input","change","submit"],i=e.filter(s=>n.includes(s.toLowerCase()));return i.length===0?"":`delegateEvents([${i.map(s=>`'${s}'`).join(", ")}]);`}function P(e,t={}){let n={hasSignals:/createSignal|signal\(/.test(e),hasStores:/createStore|store\(/.test(e),hasLitHTML:/html`|svg`/.test(e),staticProps:new Set,dynamicProps:new Set,components:new Set},i=e;if(t.optimize!==!1&&(i=ve(i),i=we(i)),t.delegateEvents!==!1){let s=wn(e),o=Ce(s,t);o&&(i=o+`
5
- `+i)}return i=Cn(i,n,t),{code:i,metadata:n}}function wn(e){let t=new Set,n=/on([A-Z][a-z]+)/g,i;for(;(i=n.exec(e))!==null;)t.add(i[1].toLowerCase());return Array.from(t)}function Cn(e,t,n){let i=[],s=n.importSource||"@fluixi/jsx";return i.push(`import { jsx, jsxs, Fragment, spread } from '${s}';`),t.hasSignals&&i.push("import { signal } from '@fluixi/dom/reactive';"),(e.includes("<Show")||e.includes("<For")||e.includes("<Switch"))&&i.push("import { Show, For, Index, Switch, Match } from '@fluixi/dom/control-flow';"),n.delegateEvents!==!1&&i.push("import { delegateEvents } from '@fluixi/dom/runtime';"),i.join(`
4
+ `+e:e}function we(e,t={}){let n=t.delegatedEvents||["click","input","change","submit"],i=e.filter(s=>n.includes(s.toLowerCase()));return i.length===0?"":`delegateEvents([${i.map(s=>`'${s}'`).join(", ")}]);`}function F(e,t={}){let n={hasSignals:/createSignal|signal\(/.test(e),hasStores:/createStore|store\(/.test(e),hasLitHTML:/html`|svg`/.test(e),staticProps:new Set,dynamicProps:new Set,components:new Set},i=e;if(t.optimize!==!1&&(i=be(i),i=Ce(i)),t.delegateEvents!==!1){let s=Xn(e),o=we(s,t);o&&(i=o+`
5
+ `+i)}return i=jn(i,n,t),{code:i,metadata:n}}function Xn(e){let t=new Set,n=/on([A-Z][a-z]+)/g,i;for(;(i=n.exec(e))!==null;)t.add(i[1].toLowerCase());return Array.from(t)}function jn(e,t,n){let i=[],s=n.importSource||"@fluixi/jsx";return i.push(`import { jsx, jsxs, Fragment, spread } from '${s}';`),t.hasSignals&&i.push("import { signal } from '@fluixi/dom/reactive';"),(e.includes("<Show")||e.includes("<For")||e.includes("<Switch"))&&i.push("import { Show, For, Index, Switch, Match } from '@fluixi/dom/control-flow';"),n.delegateEvents!==!1&&i.push("import { delegateEvents } from '@fluixi/dom/runtime';"),i.join(`
6
6
  `)+`
7
7
 
8
- `+e}async function A(e={}){let t=null;try{t=await Promise.resolve().then(()=>(lt(),at))}catch(n){console.warn("Could not load the babel front-end:",n)}return{name:"babel-fluixi-jsx",plugin:t?t.default||t:null,getOptions(){return{runtime:"automatic",importSource:e.importSource||"@fluixi/jsx",pragma:e.pragma||"jsx",pragmaFrag:e.pragmaFrag||"Fragment",development:e.development||!1,detectReactivity:!0,useLitHTML:e.useLitHTML!==!1,hoistStatics:e.optimize!==!1,delegateEvents:e.delegateEvents!==!1,delegatedEvents:e.delegatedEvents||["click","input","change","submit"],optimizeControlFlow:e.optimize!==!1,sourceMaps:e.sourceMaps!==!1,backend:e.backend||"imperative",...e.codegen?{codegen:e.codegen}:{},...e.format?{format:e.format}:{},...e.litTag?{litTag:e.litTag}:{},...e.signalModule?{signalModule:e.signalModule}:{},...e.controlFlowModule?{controlFlowModule:e.controlFlowModule}:{},...e.routerModule?{routerModule:e.routerModule}:{},...e.reactiveModule?{reactiveModule:e.reactiveModule}:{}}}}}function ft(e={}){let t=ie("typescript");return t?n=>{let i=s=>t.isJsxElement(s)||t.isJsxSelfClosingElement(s)?Jn(s,e,t):t.visitEachChild(s,i,n);return s=>t.visitNode(s,i)}:(console.warn("TypeScript not found, transformer unavailable"),n=>i=>i)}function Jn(e,t,n){return e}function ie(e){try{return require(e)}catch{return null}}function mt(e={}){return{name:"vite-fluixi-jsx",enforce:"pre",config(){return{esbuild:{jsx:"automatic",jsxImportSource:e.importSource||"@fluixi/jsx"}}},async transform(t,n){let i=await A(e);if(!/\.(jsx|tsx|ts)$/i.test(n))return null;try{let s=await import("@babel/core").catch(()=>null);if(!s)return{code:P(t,e).code,map:null};let o=/\.tsx$/.test(n),a=/\.ts$/.test(n),l=[],c=[];if(o||a){let g=await import("@babel/preset-typescript").then(m=>m.default||m).catch(()=>null);g&&l.push([g,{isTSX:o,allExtensions:!0,jsxPragma:e.pragma||"jsx",jsxPragmaFrag:e.pragmaFrag||"Fragment",onlyRemoveTypeImports:!0}])}i&&i.plugin?c.push([i.plugin,i.getOptions()]):console.warn("[createVitePlugin] custom babel plugin not found");let p=await s.transformAsync(t,{filename:n,configFile:!1,babelrc:!1,presets:l,plugins:c,sourceMaps:e.sourceMaps!==!1});return{code:p?.code||t,map:p?.map}}catch(s){console.error("Transform error:",s);try{return{code:P(t,e).code,map:null}}catch(o){return console.error("Fallback transform also failed:",o),null}}}}}function dt(e={}){return async function(t){let n=this.async(),i=ie("@babel/core"),s=await A(e);if(!i||!s.plugin){let o=P(t,e);n(null,o.code);return}i.transformAsync(t,{filename:this.resourcePath,plugins:[[s.plugin,s.getOptions()]],sourceMaps:e.sourceMaps!==!1}).then(o=>{n(null,o?.code,o?.map)}).catch(o=>{n(o)})}}function gt(e={}){return{name:"rollup-fluixi-jsx",async transform(t,n){let i=await A(e);if(!/\.[jt]sx$/.test(n))return null;try{let s=ie("@babel/core");if(!s||!i.plugin)return{code:P(t,e).code,map:null};let o=await s.transformAsync(t,{filename:n,plugins:[[i.plugin,i.getOptions()]],sourceMaps:e.sourceMaps!==!1});return{code:o?.code||t,map:o?.map}}catch(s){return console.error("Transform error:",s),null}}}}function ht(e={}){return{name:"esbuild-fluixi-jsx",setup(t){t.onLoad({filter:/\.[jt]sx$/},async n=>{let i=ie("@babel/core"),s=await A(e),a=require("fs").readFileSync(n.path,"utf8");try{return!i||!s.plugin?{contents:P(a,e).code,loader:"js"}:{contents:(await i.transformAsync(a,{filename:n.path,plugins:[[s.plugin,s.getOptions()]],sourceMaps:!1}))?.code||a,loader:"js"}}catch(l){return{errors:[{text:`Transform error: ${l}`}]}}})}}}var xe="virtual:fluixi-server-fns";function xt(e,t=[]){let n;try{n=(0,se.readdirSync)(e,{withFileTypes:!0})}catch{return t}for(let i of n){if(i.name==="node_modules"||i.name==="dist"||i.name.startsWith("."))continue;let s=(0,Je.join)(e,i.name);if(i.isDirectory())xt(s,t);else if(/\.[jt]sx?$/.test(i.name))try{(0,se.readFileSync)(s,"utf8").includes("use server")&&t.push(s)}catch{}}return t}function kn(){let e=process.cwd();return{name:"fluixi-server-functions",enforce:"pre",configResolved(t){e=t.root||e},resolveId(t){return t===xe?"\0"+xe:null},load(t){if(t!=="\0"+xe)return null;let n=xt((0,Je.join)(e,"src")),i=`import '@fluixi/start/server-fn-setup';
8
+ `+e}async function O(e={}){let t=null;try{t=await Promise.resolve().then(()=>(mt(),ut))}catch(n){console.warn("Could not load the babel front-end:",n)}return{name:"babel-fluixi-jsx",plugin:t?t.default||t:null,getOptions(){return{runtime:"automatic",importSource:e.importSource||"@fluixi/jsx",pragma:e.pragma||"jsx",pragmaFrag:e.pragmaFrag||"Fragment",development:e.development||!1,detectReactivity:!0,useLitHTML:e.useLitHTML!==!1,hoistStatics:e.optimize!==!1,delegateEvents:e.delegateEvents!==!1,delegatedEvents:e.delegatedEvents||["click","input","change","submit"],optimizeControlFlow:e.optimize!==!1,sourceMaps:e.sourceMaps!==!1,backend:e.backend||"imperative",...e.codegen?{codegen:e.codegen}:{},...e.format?{format:e.format}:{},...e.resolve?{resolve:e.resolve}:{},...e.litTag?{litTag:e.litTag}:{},...e.signalModule?{signalModule:e.signalModule}:{},...e.controlFlowModule?{controlFlowModule:e.controlFlowModule}:{},...e.routerModule?{routerModule:e.routerModule}:{},...e.reactiveModule?{reactiveModule:e.reactiveModule}:{}}}}}function ht(e={}){let t=se("typescript");return t?n=>{let i=s=>t.isJsxElement(s)||t.isJsxSelfClosingElement(s)?Mn(s,e,t):t.visitEachChild(s,i,n);return s=>t.visitNode(s,i)}:(console.warn("TypeScript not found, transformer unavailable"),n=>i=>i)}function Mn(e,t,n){return e}function se(e){try{return require(e)}catch{return null}}function xt(e={}){return{name:"vite-fluixi-jsx",enforce:"pre",config(){return{esbuild:{jsx:"automatic",jsxImportSource:e.importSource||"@fluixi/jsx"}}},async transform(t,n){let i=await O(e);if(!/\.(jsx|tsx|ts)$/i.test(n))return null;try{let s=await import("@babel/core").catch(()=>null);if(!s)return{code:F(t,e).code,map:null};let o=/\.tsx$/.test(n),a=/\.ts$/.test(n),l=[],c=[];if(o||a){let g=await import("@babel/preset-typescript").then(f=>f.default||f).catch(()=>null);g&&l.push([g,{isTSX:o,allExtensions:!0,jsxPragma:e.pragma||"jsx",jsxPragmaFrag:e.pragmaFrag||"Fragment",onlyRemoveTypeImports:!0}])}i&&i.plugin?c.push([i.plugin,i.getOptions()]):console.warn("[createVitePlugin] custom babel plugin not found");let p=await s.transformAsync(t,{filename:n,configFile:!1,babelrc:!1,presets:l,plugins:c,sourceMaps:e.sourceMaps!==!1});return{code:p?.code||t,map:p?.map}}catch(s){console.error("Transform error:",s);try{return{code:F(t,e).code,map:null}}catch(o){return console.error("Fallback transform also failed:",o),null}}}}}function Et(e={}){return async function(t){let n=this.async(),i=se("@babel/core"),s=await O(e);if(!i||!s.plugin){let o=F(t,e);n(null,o.code);return}i.transformAsync(t,{filename:this.resourcePath,plugins:[[s.plugin,s.getOptions()]],sourceMaps:e.sourceMaps!==!1}).then(o=>{n(null,o?.code,o?.map)}).catch(o=>{n(o)})}}function St(e={}){return{name:"rollup-fluixi-jsx",async transform(t,n){let i=await O(e);if(!/\.[jt]sx$/.test(n))return null;try{let s=se("@babel/core");if(!s||!i.plugin)return{code:F(t,e).code,map:null};let o=await s.transformAsync(t,{filename:n,plugins:[[i.plugin,i.getOptions()]],sourceMaps:e.sourceMaps!==!1});return{code:o?.code||t,map:o?.map}}catch(s){return console.error("Transform error:",s),null}}}}function vt(e={}){return{name:"esbuild-fluixi-jsx",setup(t){t.onLoad({filter:/\.[jt]sx$/},async n=>{let i=se("@babel/core"),s=await O(e),a=require("fs").readFileSync(n.path,"utf8");try{return!i||!s.plugin?{contents:F(a,e).code,loader:"js"}:{contents:(await i.transformAsync(a,{filename:n.path,plugins:[[s.plugin,s.getOptions()]],sourceMaps:!1}))?.code||a,loader:"js"}}catch(l){return{errors:[{text:`Transform error: ${l}`}]}}})}}}var xe="virtual:fluixi-server-fns";function yt(e,t=[]){let n;try{n=(0,oe.readdirSync)(e,{withFileTypes:!0})}catch{return t}for(let i of n){if(i.name==="node_modules"||i.name==="dist"||i.name.startsWith("."))continue;let s=(0,Re.join)(e,i.name);if(i.isDirectory())yt(s,t);else if(/\.[jt]sx?$/.test(i.name))try{(0,oe.readFileSync)(s,"utf8").includes("use server")&&t.push(s)}catch{}}return t}function Pn(){let e=process.cwd();return{name:"fluixi-server-functions",enforce:"pre",configResolved(t){e=t.root||e},resolveId(t){return t===xe?"\0"+xe:null},load(t){if(t!=="\0"+xe)return null;let n=yt((0,Re.join)(e,"src")),i=`import '@fluixi/start/server-fn-setup';
9
9
  `,s=n.map(a=>`import ${JSON.stringify(a)};`).join(`
10
10
  `);return i+s+`
11
11
  export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
12
- `},transform(t,n,i){return!/\.[jt]sx?$/.test(n)||!t.includes("use server")?null:G(t,{ssr:!!i?.ssr,filename:n,root:e})}}}var Nn={analyzeProp:ne,analyzeProps:re,shouldUseLitTemplate:Ee,isLitTemplate:ct,generateCreateElement:pt,generatePropsCode:Se,generateChildrenCode:ye,generateLitHTMLTemplate:be,optimizeStatic:ve,optimizeSpreads:ut,hoistStatic:we,generateEventDelegation:Ce,transform:P,createBabelPlugin:A,createTypeScriptTransformer:ft,createVitePlugin:mt,createWebpackLoader:dt,createRollupPlugin:gt,createESBuildPlugin:ht};
12
+ `},transform(t,n,i){return!/\.[jt]sx?$/.test(n)||!t.includes("use server")?null:G(t,{ssr:!!i?.ssr,filename:n,root:e})}}}var Fn={analyzeProp:re,analyzeProps:ie,shouldUseLitTemplate:Ee,isLitTemplate:ft,generateCreateElement:dt,generatePropsCode:Se,generateChildrenCode:ve,generateLitHTMLTemplate:ye,optimizeStatic:be,optimizeSpreads:gt,hoistStatic:Ce,generateEventDelegation:we,transform:F,createBabelPlugin:O,createTypeScriptTransformer:ht,createVitePlugin:xt,createWebpackLoader:Et,createRollupPlugin:St,createESBuildPlugin:vt};
@@ -14,6 +14,11 @@
14
14
  * - Static vs dynamic prop detection
15
15
  */
16
16
  export interface CompilerOptions {
17
+ /**
18
+ * Rules that resolve an unbound capitalised tag to a module, so a component can be
19
+ * used in a template without an import. See `createComponentResolver`.
20
+ */
21
+ resolve?: readonly ComponentResolverRule[];
17
22
  /**
18
23
  * Whether to use lit-html templates when possible
19
24
  * @default true
@@ -189,6 +194,7 @@ export declare function createBabelPlugin(options?: CompilerOptions): Promise<{
189
194
  controlFlowModule?: string | undefined;
190
195
  signalModule?: string | undefined;
191
196
  litTag?: string | undefined;
197
+ resolve?: readonly ComponentResolverRule[] | undefined;
192
198
  format?: "both" | "jsx" | "lit" | undefined;
193
199
  codegen?: "inline" | "ir" | undefined;
194
200
  runtime: string;
@@ -236,6 +242,7 @@ export declare function createESBuildPlugin(options?: CompilerOptions): {
236
242
  setup(build: any): void;
237
243
  };
238
244
  export { transformServerFunctions } from './frontend/babel/server-functions.js';
245
+ import type { ComponentResolverRule } from './resolve/component-resolver.js';
239
246
  /**
240
247
  * Vite plugin for `"use server"`: applies the transform (client→RPC stub, server→register
241
248
  * the body), and provides `virtual:fluixi-server-fns` — side-effect imports of every
@@ -1 +1 @@
1
- {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"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"}
@@ -408,6 +408,9 @@ export async function createBabelPlugin(options = {}) {
408
408
  backend: options.backend || 'imperative',
409
409
  ...(options.codegen ? { codegen: options.codegen } : {}),
410
410
  ...(options.format ? { format: options.format } : {}),
411
+ // Forwarded explicitly: getOptions() is an allowlist, so an option missing
412
+ // here is silently dropped rather than rejected.
413
+ ...(options.resolve ? { resolve: options.resolve } : {}),
411
414
  ...(options.litTag ? { litTag: options.litTag } : {}),
412
415
  ...(options.signalModule ? { signalModule: options.signalModule } : {}),
413
416
  ...(options.controlFlowModule
@@ -1,11 +1,11 @@
1
- import{a as d}from"./chunk-3SAEGOMQ.mjs";import{transformSync as P}from"@babel/core";var R="@fluixi/start/server-fn";function C(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)}function O({types:e}){return{name:"fluixi-server-functions",visitor:{Program:{enter(t,n){n.fxIndex=0,n.fxUsed=null},exit(t,n){n.fxUsed&&t.unshiftContainer("body",e.importDeclaration([e.importSpecifier(e.identifier(n.fxUsed),e.identifier(n.fxUsed))],e.stringLiteral(n.opts.runtimeModule||R)))}},"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression":(t,n)=>{let r=t.node.body;if(!e.isBlockStatement(r))return;let i=(r.directives||[]).findIndex(g=>g.value.value==="use server");if(i<0)return;r.directives.splice(i,1);let a=(n.opts.filename||n.filename||"unknown").replace(n.opts.root?n.opts.root+"/":"",""),o=`${C(a)}:${n.fxIndex++}`,l=!!n.opts.ssr,c=l?"$$registerServerFn":"$$createServerReference";n.fxUsed=c;let u=l?e.callExpression(e.identifier(c),[e.stringLiteral(o),t.isFunctionDeclaration()?e.functionExpression(null,t.node.params,r,t.node.generator,t.node.async):t.node]):e.callExpression(e.identifier(c),[e.stringLiteral(o)]);t.isFunctionDeclaration()?t.replaceWith(e.variableDeclaration("const",[e.variableDeclarator(t.node.id,u)])):t.replaceWith(u),t.skip()}}}}function y(e,t){if(!e.includes("use server"))return null;let n=P(e,{filename:t.filename,configFile:!1,babelrc:!1,sourceMaps:!0,parserOpts:{plugins:["typescript","jsx"]},plugins:[[O,t]]});return n?.code?{code:n.code,map:n.map}:null}import{readdirSync as J,readFileSync as X}from"node:fs";import{join as E}from"node:path";var L=new Set(["key","ref","children"]),A=[/\(\)\s*=>/,/function\s*\(\)/,/\w+\(\)/,/\w+\.\w+/,/\w+\[.+\]/,/createSignal/,/createStore/,/createMemo/,/createEffect/],k=/^on[A-Z]/;function v(e,t){let n={name:e,isStatic:!0,isReactive:!1,isEvent:k.test(e),isRef:e==="ref",isSpread:e.startsWith("...")};if(L.has(e))return n;if(n.isEvent||n.isRef)return n.isStatic=!1,n;if(typeof t=="string"){let r=t;for(let s of A)if(s.test(r)){n.isStatic=!1,n.isReactive=!0;break}r.includes("${")&&(n.isStatic=!1,n.isReactive=!0)}else typeof t=="function"?(n.isStatic=!1,n.isReactive=!0):typeof t=="object"&&t!==null&&(n.isStatic=!1);return n}function h(e){let t=new Map;for(let[n,r]of Object.entries(e))t.set(n,v(n,r));return t}function S(e,t,n){if(typeof e!="string")return!1;let r=h(t);for(let s of r.values()){if(s.isSpread)return!1;s.isReactive&&s.isEvent}return!0}function _(e){return e&&typeof e=="object"&&"_$litType$"in e}function I(e,t,n,r={}){let s=["svg","path","circle","rect","g"].includes(e),i=b(t,r),a=n.length>0?`, ${$(n)}`:"";return r.useLitHTML!==!1&&S(e,t,n)?T(e,t,n,s):`jsx('${e}', ${i}${a})`}function b(e,t={}){if(Object.keys(e).length===0)return"{}";let n=h(e),r=[];for(let[s,i]of Object.entries(e)){let a=n.get(s);a.isReactive&&!a.isStatic?r.push(`${s}: () => ${i}`):typeof i=="string"?r.push(`${s}: "${i}"`):typeof i=="number"||typeof i=="boolean"?r.push(`${s}: ${i}`):r.push(`${s}: ${i}`)}return`{ ${r.join(", ")} }`}function $(e){return e.length===0?"undefined":e.length===1?String(e[0]):`[${e.join(", ")}]`}function T(e,t,n,r=!1){let s=r?"svg":"html",i=`<${e}`,a=[];for(let[o,l]of Object.entries(t)){if(o==="children"||o==="key"||o==="ref")continue;let c=v(o,l);if(c.isEvent){let u=o.slice(2).toLowerCase();i+=` @${u}=\${${a.length}}`,a.push(String(l))}else c.isReactive?(i+=` ${o}=\${${a.length}}`,a.push(`signal(() => ${l})`)):typeof l=="string"?i+=` ${o}="${l}"`:(i+=` ${o}=\${${a.length}}`,a.push(String(l)))}if(i+=">",n.length>0)for(let o of n)typeof o=="string"?i+=o:(i+=`\${${a.length}}`,a.push(String(o)));return i+=`</${e}>`,`${s}\`${i}\`${a.length>0?`, ${a.join(", ")}`:""}`}function M(e){return e=e.replace(/jsx\('([^']+)',\s*{},\s*"([^"]+)"\s*\)/g,(t,n,r)=>`_$staticNode('${n}', '${r}')`),e}function N(e){return e}function j(e){let t=[],n=0;return e=e.replace(/jsx\('([^']+)',\s*{([^}]*)},\s*([^)]*)\)/g,(r,s,i,a)=>{if(!i.includes("()")&&!i.includes("=>")){let o=`_$static${n++}`;return t.push(`const ${o} = ${r};`),o}return r}),t.length>0?t.join(`
1
+ import{a as d}from"./chunk-3SAEGOMQ.mjs";import{transformSync as R}from"@babel/core";var C="@fluixi/start/server-fn";function P(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)}function O({types:e}){return{name:"fluixi-server-functions",visitor:{Program:{enter(t,n){n.fxIndex=0,n.fxUsed=null},exit(t,n){n.fxUsed&&t.unshiftContainer("body",e.importDeclaration([e.importSpecifier(e.identifier(n.fxUsed),e.identifier(n.fxUsed))],e.stringLiteral(n.opts.runtimeModule||C)))}},"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression":(t,n)=>{let r=t.node.body;if(!e.isBlockStatement(r))return;let i=(r.directives||[]).findIndex(g=>g.value.value==="use server");if(i<0)return;r.directives.splice(i,1);let o=(n.opts.filename||n.filename||"unknown").replace(n.opts.root?n.opts.root+"/":"",""),a=`${P(o)}:${n.fxIndex++}`,l=!!n.opts.ssr,c=l?"$$registerServerFn":"$$createServerReference";n.fxUsed=c;let u=l?e.callExpression(e.identifier(c),[e.stringLiteral(a),t.isFunctionDeclaration()?e.functionExpression(null,t.node.params,r,t.node.generator,t.node.async):t.node]):e.callExpression(e.identifier(c),[e.stringLiteral(a)]);t.isFunctionDeclaration()?t.replaceWith(e.variableDeclaration("const",[e.variableDeclarator(t.node.id,u)])):t.replaceWith(u),t.skip()}}}}function y(e,t){if(!e.includes("use server"))return null;let n=R(e,{filename:t.filename,configFile:!1,babelrc:!1,sourceMaps:!0,parserOpts:{plugins:["typescript","jsx"]},plugins:[[O,t]]});return n?.code?{code:n.code,map:n.map}:null}import{readdirSync as J,readFileSync as X}from"node:fs";import{join as E}from"node:path";var L=new Set(["key","ref","children"]),A=[/\(\)\s*=>/,/function\s*\(\)/,/\w+\(\)/,/\w+\.\w+/,/\w+\[.+\]/,/createSignal/,/createStore/,/createMemo/,/createEffect/],k=/^on[A-Z]/;function v(e,t){let n={name:e,isStatic:!0,isReactive:!1,isEvent:k.test(e),isRef:e==="ref",isSpread:e.startsWith("...")};if(L.has(e))return n;if(n.isEvent||n.isRef)return n.isStatic=!1,n;if(typeof t=="string"){let r=t;for(let s of A)if(s.test(r)){n.isStatic=!1,n.isReactive=!0;break}r.includes("${")&&(n.isStatic=!1,n.isReactive=!0)}else typeof t=="function"?(n.isStatic=!1,n.isReactive=!0):typeof t=="object"&&t!==null&&(n.isStatic=!1);return n}function h(e){let t=new Map;for(let[n,r]of Object.entries(e))t.set(n,v(n,r));return t}function S(e,t,n){if(typeof e!="string")return!1;let r=h(t);for(let s of r.values()){if(s.isSpread)return!1;s.isReactive&&s.isEvent}return!0}function _(e){return e&&typeof e=="object"&&"_$litType$"in e}function I(e,t,n,r={}){let s=["svg","path","circle","rect","g"].includes(e),i=b(t,r),o=n.length>0?`, ${$(n)}`:"";return r.useLitHTML!==!1&&S(e,t,n)?T(e,t,n,s):`jsx('${e}', ${i}${o})`}function b(e,t={}){if(Object.keys(e).length===0)return"{}";let n=h(e),r=[];for(let[s,i]of Object.entries(e)){let o=n.get(s);o.isReactive&&!o.isStatic?r.push(`${s}: () => ${i}`):typeof i=="string"?r.push(`${s}: "${i}"`):typeof i=="number"||typeof i=="boolean"?r.push(`${s}: ${i}`):r.push(`${s}: ${i}`)}return`{ ${r.join(", ")} }`}function $(e){return e.length===0?"undefined":e.length===1?String(e[0]):`[${e.join(", ")}]`}function T(e,t,n,r=!1){let s=r?"svg":"html",i=`<${e}`,o=[];for(let[a,l]of Object.entries(t)){if(a==="children"||a==="key"||a==="ref")continue;let c=v(a,l);if(c.isEvent){let u=a.slice(2).toLowerCase();i+=` @${u}=\${${o.length}}`,o.push(String(l))}else c.isReactive?(i+=` ${a}=\${${o.length}}`,o.push(`signal(() => ${l})`)):typeof l=="string"?i+=` ${a}="${l}"`:(i+=` ${a}=\${${o.length}}`,o.push(String(l)))}if(i+=">",n.length>0)for(let a of n)typeof a=="string"?i+=a:(i+=`\${${o.length}}`,o.push(String(a)));return i+=`</${e}>`,`${s}\`${i}\`${o.length>0?`, ${o.join(", ")}`:""}`}function M(e){return e=e.replace(/jsx\('([^']+)',\s*{},\s*"([^"]+)"\s*\)/g,(t,n,r)=>`_$staticNode('${n}', '${r}')`),e}function N(e){return e}function j(e){let t=[],n=0;return e=e.replace(/jsx\('([^']+)',\s*{([^}]*)},\s*([^)]*)\)/g,(r,s,i,o)=>{if(!i.includes("()")&&!i.includes("=>")){let a=`_$static${n++}`;return t.push(`const ${a} = ${r};`),a}return r}),t.length>0?t.join(`
2
2
  `)+`
3
3
  `+e:e}function w(e,t={}){let n=t.delegatedEvents||["click","input","change","submit"],r=e.filter(s=>n.includes(s.toLowerCase()));return r.length===0?"":`delegateEvents([${r.map(s=>`'${s}'`).join(", ")}]);`}function f(e,t={}){let n={hasSignals:/createSignal|signal\(/.test(e),hasStores:/createStore|store\(/.test(e),hasLitHTML:/html`|svg`/.test(e),staticProps:new Set,dynamicProps:new Set,components:new Set},r=e;if(t.optimize!==!1&&(r=M(r),r=j(r)),t.delegateEvents!==!1){let s=z(e),i=w(s,t);i&&(r=i+`
4
4
  `+r)}return r=D(r,n,t),{code:r,metadata:n}}function z(e){let t=new Set,n=/on([A-Z][a-z]+)/g,r;for(;(r=n.exec(e))!==null;)t.add(r[1].toLowerCase());return Array.from(t)}function D(e,t,n){let r=[],s=n.importSource||"@fluixi/jsx";return r.push(`import { jsx, jsxs, Fragment, spread } from '${s}';`),t.hasSignals&&r.push("import { signal } from '@fluixi/dom/reactive';"),(e.includes("<Show")||e.includes("<For")||e.includes("<Switch"))&&r.push("import { Show, For, Index, Switch, Match } from '@fluixi/dom/control-flow';"),n.delegateEvents!==!1&&r.push("import { delegateEvents } from '@fluixi/dom/runtime';"),r.join(`
5
5
  `)+`
6
6
 
7
- `+e}async function p(e={}){let t=null;try{t=await import("./babel-6UTCV3CC.mjs")}catch(n){console.warn("Could not load the babel front-end:",n)}return{name:"babel-fluixi-jsx",plugin:t?t.default||t:null,getOptions(){return{runtime:"automatic",importSource:e.importSource||"@fluixi/jsx",pragma:e.pragma||"jsx",pragmaFrag:e.pragmaFrag||"Fragment",development:e.development||!1,detectReactivity:!0,useLitHTML:e.useLitHTML!==!1,hoistStatics:e.optimize!==!1,delegateEvents:e.delegateEvents!==!1,delegatedEvents:e.delegatedEvents||["click","input","change","submit"],optimizeControlFlow:e.optimize!==!1,sourceMaps:e.sourceMaps!==!1,backend:e.backend||"imperative",...e.codegen?{codegen:e.codegen}:{},...e.format?{format:e.format}:{},...e.litTag?{litTag:e.litTag}:{},...e.signalModule?{signalModule:e.signalModule}:{},...e.controlFlowModule?{controlFlowModule:e.controlFlowModule}:{},...e.routerModule?{routerModule:e.routerModule}:{},...e.reactiveModule?{reactiveModule:e.reactiveModule}:{}}}}}function V(e={}){let t=m("typescript");return t?n=>{let r=s=>t.isJsxElement(s)||t.isJsxSelfClosingElement(s)?H(s,e,t):t.visitEachChild(s,r,n);return s=>t.visitNode(s,r)}:(console.warn("TypeScript not found, transformer unavailable"),n=>r=>r)}function H(e,t,n){return e}function m(e){try{return d(e)}catch{return null}}function U(e={}){return{name:"vite-fluixi-jsx",enforce:"pre",config(){return{esbuild:{jsx:"automatic",jsxImportSource:e.importSource||"@fluixi/jsx"}}},async transform(t,n){let r=await p(e);if(!/\.(jsx|tsx|ts)$/i.test(n))return null;try{let s=await import("@babel/core").catch(()=>null);if(!s)return{code:f(t,e).code,map:null};let i=/\.tsx$/.test(n),a=/\.ts$/.test(n),o=[],l=[];if(i||a){let u=await import("@babel/preset-typescript").then(g=>g.default||g).catch(()=>null);u&&o.push([u,{isTSX:i,allExtensions:!0,jsxPragma:e.pragma||"jsx",jsxPragmaFrag:e.pragmaFrag||"Fragment",onlyRemoveTypeImports:!0}])}r&&r.plugin?l.push([r.plugin,r.getOptions()]):console.warn("[createVitePlugin] custom babel plugin not found");let c=await s.transformAsync(t,{filename:n,configFile:!1,babelrc:!1,presets:o,plugins:l,sourceMaps:e.sourceMaps!==!1});return{code:c?.code||t,map:c?.map}}catch(s){console.error("Transform error:",s);try{return{code:f(t,e).code,map:null}}catch(i){return console.error("Fallback transform also failed:",i),null}}}}}function W(e={}){return async function(t){let n=this.async(),r=m("@babel/core"),s=await p(e);if(!r||!s.plugin){let i=f(t,e);n(null,i.code);return}r.transformAsync(t,{filename:this.resourcePath,plugins:[[s.plugin,s.getOptions()]],sourceMaps:e.sourceMaps!==!1}).then(i=>{n(null,i?.code,i?.map)}).catch(i=>{n(i)})}}function q(e={}){return{name:"rollup-fluixi-jsx",async transform(t,n){let r=await p(e);if(!/\.[jt]sx$/.test(n))return null;try{let s=m("@babel/core");if(!s||!r.plugin)return{code:f(t,e).code,map:null};let i=await s.transformAsync(t,{filename:n,plugins:[[r.plugin,r.getOptions()]],sourceMaps:e.sourceMaps!==!1});return{code:i?.code||t,map:i?.map}}catch(s){return console.error("Transform error:",s),null}}}}function B(e={}){return{name:"esbuild-fluixi-jsx",setup(t){t.onLoad({filter:/\.[jt]sx$/},async n=>{let r=m("@babel/core"),s=await p(e),a=d("fs").readFileSync(n.path,"utf8");try{return!r||!s.plugin?{contents:f(a,e).code,loader:"js"}:{contents:(await r.transformAsync(a,{filename:n.path,plugins:[[s.plugin,s.getOptions()]],sourceMaps:!1}))?.code||a,loader:"js"}}catch(o){return{errors:[{text:`Transform error: ${o}`}]}}})}}}var x="virtual:fluixi-server-fns";function F(e,t=[]){let n;try{n=J(e,{withFileTypes:!0})}catch{return t}for(let r of n){if(r.name==="node_modules"||r.name==="dist"||r.name.startsWith("."))continue;let s=E(e,r.name);if(r.isDirectory())F(s,t);else if(/\.[jt]sx?$/.test(r.name))try{X(s,"utf8").includes("use server")&&t.push(s)}catch{}}return t}function ee(){let e=process.cwd();return{name:"fluixi-server-functions",enforce:"pre",configResolved(t){e=t.root||e},resolveId(t){return t===x?"\0"+x:null},load(t){if(t!=="\0"+x)return null;let n=F(E(e,"src")),r=`import '@fluixi/start/server-fn-setup';
8
- `,s=n.map(a=>`import ${JSON.stringify(a)};`).join(`
7
+ `+e}async function p(e={}){let t=null;try{t=await import("./babel-UKVEBBZL.mjs")}catch(n){console.warn("Could not load the babel front-end:",n)}return{name:"babel-fluixi-jsx",plugin:t?t.default||t:null,getOptions(){return{runtime:"automatic",importSource:e.importSource||"@fluixi/jsx",pragma:e.pragma||"jsx",pragmaFrag:e.pragmaFrag||"Fragment",development:e.development||!1,detectReactivity:!0,useLitHTML:e.useLitHTML!==!1,hoistStatics:e.optimize!==!1,delegateEvents:e.delegateEvents!==!1,delegatedEvents:e.delegatedEvents||["click","input","change","submit"],optimizeControlFlow:e.optimize!==!1,sourceMaps:e.sourceMaps!==!1,backend:e.backend||"imperative",...e.codegen?{codegen:e.codegen}:{},...e.format?{format:e.format}:{},...e.resolve?{resolve:e.resolve}:{},...e.litTag?{litTag:e.litTag}:{},...e.signalModule?{signalModule:e.signalModule}:{},...e.controlFlowModule?{controlFlowModule:e.controlFlowModule}:{},...e.routerModule?{routerModule:e.routerModule}:{},...e.reactiveModule?{reactiveModule:e.reactiveModule}:{}}}}}function V(e={}){let t=m("typescript");return t?n=>{let r=s=>t.isJsxElement(s)||t.isJsxSelfClosingElement(s)?H(s,e,t):t.visitEachChild(s,r,n);return s=>t.visitNode(s,r)}:(console.warn("TypeScript not found, transformer unavailable"),n=>r=>r)}function H(e,t,n){return e}function m(e){try{return d(e)}catch{return null}}function U(e={}){return{name:"vite-fluixi-jsx",enforce:"pre",config(){return{esbuild:{jsx:"automatic",jsxImportSource:e.importSource||"@fluixi/jsx"}}},async transform(t,n){let r=await p(e);if(!/\.(jsx|tsx|ts)$/i.test(n))return null;try{let s=await import("@babel/core").catch(()=>null);if(!s)return{code:f(t,e).code,map:null};let i=/\.tsx$/.test(n),o=/\.ts$/.test(n),a=[],l=[];if(i||o){let u=await import("@babel/preset-typescript").then(g=>g.default||g).catch(()=>null);u&&a.push([u,{isTSX:i,allExtensions:!0,jsxPragma:e.pragma||"jsx",jsxPragmaFrag:e.pragmaFrag||"Fragment",onlyRemoveTypeImports:!0}])}r&&r.plugin?l.push([r.plugin,r.getOptions()]):console.warn("[createVitePlugin] custom babel plugin not found");let c=await s.transformAsync(t,{filename:n,configFile:!1,babelrc:!1,presets:a,plugins:l,sourceMaps:e.sourceMaps!==!1});return{code:c?.code||t,map:c?.map}}catch(s){console.error("Transform error:",s);try{return{code:f(t,e).code,map:null}}catch(i){return console.error("Fallback transform also failed:",i),null}}}}}function W(e={}){return async function(t){let n=this.async(),r=m("@babel/core"),s=await p(e);if(!r||!s.plugin){let i=f(t,e);n(null,i.code);return}r.transformAsync(t,{filename:this.resourcePath,plugins:[[s.plugin,s.getOptions()]],sourceMaps:e.sourceMaps!==!1}).then(i=>{n(null,i?.code,i?.map)}).catch(i=>{n(i)})}}function q(e={}){return{name:"rollup-fluixi-jsx",async transform(t,n){let r=await p(e);if(!/\.[jt]sx$/.test(n))return null;try{let s=m("@babel/core");if(!s||!r.plugin)return{code:f(t,e).code,map:null};let i=await s.transformAsync(t,{filename:n,plugins:[[r.plugin,r.getOptions()]],sourceMaps:e.sourceMaps!==!1});return{code:i?.code||t,map:i?.map}}catch(s){return console.error("Transform error:",s),null}}}}function B(e={}){return{name:"esbuild-fluixi-jsx",setup(t){t.onLoad({filter:/\.[jt]sx$/},async n=>{let r=m("@babel/core"),s=await p(e),o=d("fs").readFileSync(n.path,"utf8");try{return!r||!s.plugin?{contents:f(o,e).code,loader:"js"}:{contents:(await r.transformAsync(o,{filename:n.path,plugins:[[s.plugin,s.getOptions()]],sourceMaps:!1}))?.code||o,loader:"js"}}catch(a){return{errors:[{text:`Transform error: ${a}`}]}}})}}}var x="virtual:fluixi-server-fns";function F(e,t=[]){let n;try{n=J(e,{withFileTypes:!0})}catch{return t}for(let r of n){if(r.name==="node_modules"||r.name==="dist"||r.name.startsWith("."))continue;let s=E(e,r.name);if(r.isDirectory())F(s,t);else if(/\.[jt]sx?$/.test(r.name))try{X(s,"utf8").includes("use server")&&t.push(s)}catch{}}return t}function ee(){let e=process.cwd();return{name:"fluixi-server-functions",enforce:"pre",configResolved(t){e=t.root||e},resolveId(t){return t===x?"\0"+x:null},load(t){if(t!=="\0"+x)return null;let n=F(E(e,"src")),r=`import '@fluixi/start/server-fn-setup';
8
+ `,s=n.map(o=>`import ${JSON.stringify(o)};`).join(`
9
9
  `);return r+s+`
10
10
  export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
11
11
  `},transform(t,n,r){return!/\.[jt]sx?$/.test(n)||!t.includes("use server")?null:y(t,{ssr:!!r?.ssr,filename:n,root:e})}}}var te={analyzeProp:v,analyzeProps:h,shouldUseLitTemplate:S,isLitTemplate:_,generateCreateElement:I,generatePropsCode:b,generateChildrenCode:$,generateLitHTMLTemplate:T,optimizeStatic:M,optimizeSpreads:N,hoistStatic:j,generateEventDelegation:w,transform:f,createBabelPlugin:p,createTypeScriptTransformer:V,createVitePlugin:U,createWebpackLoader:W,createRollupPlugin:q,createESBuildPlugin:B};export{v as analyzeProp,h as analyzeProps,p as createBabelPlugin,B as createESBuildPlugin,q as createRollupPlugin,V as createTypeScriptTransformer,U as createVitePlugin,W as createWebpackLoader,te as default,$ as generateChildrenCode,I as generateCreateElement,w as generateEventDelegation,T as generateLitHTMLTemplate,b as generatePropsCode,j as hoistStatic,_ as isLitTemplate,N as optimizeSpreads,M as optimizeStatic,ee as serverFunctionsVitePlugin,S as shouldUseLitTemplate,f as transform,y as transformServerFunctions};
package/dist/options.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var i=(a,e)=>{for(var t in e)l(a,t,{get:e[t],enumerable:!0})},m=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!s.call(a,o)&&o!==t&&l(a,o,{get:()=>e[o],enumerable:!(r=n(e,o))||r.enumerable});return a};var p=a=>m(l({},"__esModule",{value:!0}),a);var u={};i(u,{defaultOptions:()=>b});module.exports=p(u);var b={backend:"imperative",generate:"dom",moduleName:"@fluixi/dom",delegateEvents:!0,hydratable:!1,sourceMaps:!0,dev:!1};
1
+ "use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(o,e)=>{for(var a in e)r(o,a,{get:e[a],enumerable:!0})},d=(o,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!m.call(o,t)&&t!==a&&r(o,t,{get:()=>e[t],enumerable:!(l=n(e,t))||l.enumerable});return o};var i=o=>d(r({},"__esModule",{value:!0}),o);var u={};p(u,{defaultOptions:()=>v});module.exports=i(u);var v={backend:"imperative",generate:"dom",moduleName:"@fluixi/dom",delegateEvents:!0,hydratable:!1,sourceMaps:!0,dev:!1};
package/dist/options.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ComponentResolverRule } from './resolve/component-resolver.js';
1
2
  /**
2
3
  * Public compiler options. This schema is the stable public API — it stays put
3
4
  * as backends change. Switching DOM strategy is `backend`, not a rewrite.
@@ -13,6 +14,11 @@ export interface CompilerOptions {
13
14
  hydratable?: boolean;
14
15
  sourceMaps?: boolean;
15
16
  dev?: boolean;
17
+ /**
18
+ * Rules that resolve an unbound capitalised tag to a module, so a component can be
19
+ * used in a template without an import. See `createComponentResolver`.
20
+ */
21
+ resolve?: readonly ComponentResolverRule[];
16
22
  }
17
23
  export declare const defaultOptions: CompilerOptions;
18
24
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,OAAO,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAAC;IAC1C,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;IACrC,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,cAAc,EAAE,eAQ5B,CAAC"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,OAAO,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAAC;IAC1C,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;IACrC,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC5C;AAED,eAAO,MAAM,cAAc,EAAE,eAQ5B,CAAC"}
@@ -0,0 +1 @@
1
+ "use strict";var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var C=(o,e)=>{for(var n in e)u(o,n,{get:e[n],enumerable:!0})},v=(o,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of g(e))!R.call(o,t)&&t!==n&&u(o,t,{get:()=>e[t],enumerable:!(i=d(e,t))||i.enumerable});return o};var x=o=>v(u({},"__esModule",{value:!0}),o);var y={};C(y,{createComponentResolver:()=>b});module.exports=x(y);var h=o=>"components"in o;function a(o,e){return o.replace(/\$(\d+)/g,(n,i)=>e[Number(i)]??n)}function M(o,e){return typeof e=="string"?{module:e,export:o}:e}function b(o=[]){let e=new Map,n=[],i=[];for(let r of o){if(!h(r)){i.push(r);continue}for(let[s,p]of Object.entries(r.components)){let l=M(s,p),c=e.get(s);if(c&&c.module!==l.module){let m=n.find(f=>f.name===s);m?m.modules.push(l.module):n.push({name:s,modules:[c.module,l.module]});continue}e.set(s,l)}}let t=new Map;return{resolve:r=>{if(t.has(r))return t.get(r);let s=e.get(r);if(!s)for(let p of i){let l=r.match(new RegExp(p.match.source,p.match.flags.replace("g","")));if(l){s={module:a(p.module,l),export:p.export?a(p.export,l):r};break}}return t.set(r,s),s},names:()=>[...e.keys()],conflicts:()=>n}}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Compile-time component resolution.
3
+ *
4
+ * An unbound capitalised tag in a template is a name the compiler can resolve to a
5
+ * module, instead of an import the author has to write. The framework already does
6
+ * this for `Suspense`/`Portal`/`Router`, but through a hardcoded name set inside the
7
+ * Babel plugin — which cannot be extended by a UI library or an app, and cannot be
8
+ * configured per project.
9
+ *
10
+ * This is the configurable version of the same idea. It is deliberately a pure
11
+ * `name -> { module, export }` function with no filesystem access and no Babel
12
+ * dependency, because three separate consumers need exactly the same answer:
13
+ *
14
+ * - the compiler, to inject the import;
15
+ * - the TS plugin, to synthesise the import so hover/go-to-definition/rename work;
16
+ * - a codemod, to materialise imports back into source.
17
+ *
18
+ * Keeping resolution pure is what lets those three agree. Anything requiring the
19
+ * filesystem (directory conventions) belongs in a rule *builder* that produces a map,
20
+ * not in the resolver itself.
21
+ */
22
+ /** Where a resolved component comes from. */
23
+ export interface ResolvedComponent {
24
+ module: string;
25
+ /** The export name, or `default`. */
26
+ export: string;
27
+ }
28
+ /**
29
+ * An explicit name -> module map. This is what a component library ships
30
+ * (`Button -> @fluixi-ui/button`), generated from its own package list rather than
31
+ * hand-maintained.
32
+ */
33
+ export interface ComponentMapRule {
34
+ components: Record<string, string | ResolvedComponent>;
35
+ }
36
+ /**
37
+ * A pattern rule. `$1`-style references in `module`/`export` are substituted from the
38
+ * match groups, so one rule can cover a family (`Icon(.+) -> @/icons/$1`).
39
+ */
40
+ export interface ComponentPatternRule {
41
+ match: RegExp;
42
+ module: string;
43
+ /** Defaults to the tag name; use `'default'` for file-per-component layouts. */
44
+ export?: string;
45
+ }
46
+ export type ComponentResolverRule = ComponentMapRule | ComponentPatternRule;
47
+ /** Two rules claiming the same name — reported rather than silently first-wins. */
48
+ export interface ResolverConflict {
49
+ name: string;
50
+ modules: string[];
51
+ }
52
+ export interface ComponentResolver {
53
+ /** `undefined` when no rule claims the name. */
54
+ resolve: (name: string) => ResolvedComponent | undefined;
55
+ /** Every name the resolver can answer, for editor completion. */
56
+ names: () => string[];
57
+ /** Names claimed by more than one rule with different targets. */
58
+ conflicts: () => ResolverConflict[];
59
+ }
60
+ /**
61
+ * Build a resolver from rules, in order.
62
+ *
63
+ * Map rules are flattened up front so lookup is a plain object read — resolution runs
64
+ * once per component reference per compile, so it sits on the hot path of every build.
65
+ * Pattern rules are tried afterwards, in declaration order, and only when no map rule
66
+ * matched: an explicit entry should always beat a pattern.
67
+ */
68
+ export declare function createComponentResolver(rules?: readonly ComponentResolverRule[]): ComponentResolver;
69
+ //# sourceMappingURL=component-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-resolver.d.ts","sourceRoot":"","sources":["../../src/resolve/component-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC,CAAC;CACxD;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG,oBAAoB,CAAC;AAE5E,mFAAmF;AACnF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,GAAG,SAAS,CAAC;IACzD,iEAAiE;IACjE,KAAK,EAAE,MAAM,MAAM,EAAE,CAAC;IACtB,kEAAkE;IAClE,SAAS,EAAE,MAAM,gBAAgB,EAAE,CAAC;CACrC;AAiBD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,GAAE,SAAS,qBAAqB,EAAO,GAC3C,iBAAiB,CAwDnB"}