@fluixi/compiler 1.0.0-alpha.70 → 1.0.0-alpha.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,33 @@
1
- "use strict";var hn=Object.create;var oe=Object.defineProperty;var xn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Sn=Object.getPrototypeOf,vn=Object.prototype.hasOwnProperty;var b=(e,t)=>()=>(e&&(t=e(e=0)),t);var at=(e,t)=>{for(var n in t)oe(e,n,{get:t[n],enumerable:!0})},lt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of En(t))!vn.call(e,o)&&o!==n&&oe(e,o,{get:()=>t[o],enumerable:!(i=xn(t,o))||i.enumerable});return e};var se=(e,t,n)=>(n=e!=null?hn(Sn(e)):{},lt(t||!e||!e.__esModule?oe(n,"default",{value:e,enumerable:!0}):n,e)),yn=e=>lt(oe({},"__esModule",{value:!0}),e);function pt(e,t){return e.replace(/\$(\d+)/g,(n,i)=>t[Number(i)]??n)}function In(e,t){return typeof t=="string"?{module:t,export:e}:t}function ut(e=[]){let t=new Map,n=[],i=[];for(let a of e){if(!wn(a)){i.push(a);continue}for(let[l,c]of Object.entries(a.components)){let p=In(l,c),f=t.get(l);if(f&&f.module!==p.module){let u=n.find(x=>x.name===l);u?u.modules.push(p.module):n.push({name:l,modules:[f.module,p.module]});continue}t.set(l,p)}}let o=new Map;return{resolve:a=>{if(o.has(a))return o.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:pt(c.module,p),export:c.export?pt(c.export,p):a};break}}return o.set(a,l),l},names:()=>[...t.keys()],conflicts:()=>n}}var wn,ft=b(()=>{"use strict";wn=e=>"components"in e});function dt(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:n="@fluixi/core",routerModule:i="@fluixi/core/router-next"}=e,o={};for(let s of G)o[s]=t;for(let s of z)o[s]=n;for(let s of B)o[s]=i;return o}var G,z,B,Ur,Re,Ce=b(()=>{"use strict";G=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],z=["Suspense","SuspenseList","Await"],B=["Router","Outlet","Redirect","Link"],Ur=[...G,...z,...B],Re=new Set([...G,...z])});function Z(e){return e.startsWith("load:")}function V(e,t){let n=e.slice(5);if(!mt.has(n))throw new $(`Unknown load strategy 'load:${n}'. Expected one of ${[...mt].join(", ")}.`);switch(n){case"eager":return X;case"idle":return{kind:"idle"};case"never":return{kind:"never"};case"visible":return t?{kind:"visible",rootMargin:t}:{kind:"visible"};case"interaction":return{kind:"interaction",events:t?kn(t):[...Nn]};case"media":if(!t)throw new $(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new $(`Unhandled load strategy '${n}'.`)}}function kn(e){let t=e.split(/[\s,]+/).map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new $("'load:interaction' was given no event names.");return t}function P(e){return e.kind!=="eager"&&e.kind!=="never"}var X,Nn,mt,$,H=b(()=>{"use strict";X={kind:"eager"},Nn=["pointerdown","focusin","keydown"],mt=new Set(["eager","idle","visible","interaction","media","never"]),$=class extends Error{}});function we(e,t={}){let{resolver:n,isBound:i,modules:o,strategyFor:s}=t,a=dt(o),l=new Map,c=new Set,p=u=>{let{name:x}=u;if(!x||x.includes(".")||i?.(x))return;let R=f(x);if(!R){c.add(x);return}let C=R.origin==="builtin"&&Re.has(x)?X:s?.(u)??X;u.source={...R,loading:C},l.set(x,u.source)},f=u=>{if(Re.has(u))return{module:a[u],export:u,origin:"builtin"};let x=n?.resolve(u);if(x)return{module:x.module,export:x.export,origin:"rule"};if(B.includes(u))return{module:a[u],export:u,origin:"builtin"}};return le(e,u=>{u.kind==="component"&&p(u)}),{resolved:l,unresolved:[...c]}}function le(e,t){let n=Array.isArray(e)?e:[e];for(let i of n){t(i);let o=i.children;o&&le(o,t)}}var Ie=b(()=>{"use strict";Ce();H()});function Ne(e){let t=[];le(e,s=>{s.kind==="component"&&s.source&&t.push(s)});let n=new Set,i=new Set;for(let s of t){let{module:a,loading:l}=s.source;l.kind==="eager"&&n.add(a),l.kind==="never"&&i.add(a)}let o=new Map;for(let s of t){let a=s.source;P(a.loading)&&n.has(a.module)&&(a.loading={kind:"eager"},o.set(a.module,(o.get(a.module)??0)+1))}return{collapsed:o,conflicted:[...i].filter(s=>n.has(s))}}var gt=b(()=>{"use strict";H();Ie()});function ke(e){return Ln.has(e)}function xt(e){return ht[e]??e}function K(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!Tn.has(e.name)}function Me(e){if(!e.static||ke(e.tag))return!1;for(let t of e.props)if(!K(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Me(t)))return!1;return!0}function Y(e){let t=e.props.map(Jn).filter(Boolean).join(""),n=`<${e.tag}${t}>`;return Mn.has(e.tag)?n:`${n}${e.children.map($n).join("")}</${e.tag}>`}function $n(e){if(e.kind==="text")return jn(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return Y(e)}function Jn(e){let t=ht[e.name]??e.name,n=e.literal;return n===!0||n===void 0?` ${t}`:n===!1||n===null?"":` ${t}="${Pn(String(n))}"`}function Pn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function jn(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Mn,ht,Tn,Ln,Te=b(()=>{"use strict";Mn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ht={className:"class",htmlFor:"for"},Tn=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),Ln=new Set(["script","style","textarea","title"])});function pe(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"}function On(e){return e.kind==="text"||e.kind==="element"&&Et(e)}function Et(e){return e.svg||ke(e.tag)||!e.props.every(t=>K(t))?!1:e.children.every(t=>On(t)||pe(t))}function ce(e){if(pe(e))return!0;let t=e.children;return t?t.some(ce):!1}function St(e){for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.kind==="text"&&(n.value===""||e.children[t+1]?.kind==="text"))return!1}return e.children.every(t=>t.kind!=="element"||St(t))}function vt(e){if(!Et(e)||!St(e)||!e.children.some(ce))return null;let t=[],n=[],i=0,o=a=>{let l=`_n$${i++}`;return t.push({ref:l,expr:a}),l};return s(e,"_el$"),{html:An(e),tag:e.tag,steps:t,holes:n};function s(a,l){let c=-1;a.children.forEach((f,u)=>{ce(f)&&(c=u)});let p=null;for(let f=0;f<=c;f++){let u=a.children[f],x=p?`${p}.nextSibling`:`${l}.firstChild`;if(pe(u)){let C=o(x),I=o(`holeEnd(${C})`);n.push({parentRef:l,startRef:C,endRef:I,node:u}),p=I;continue}let R=o(x);u.kind==="element"&&ce(u)&&s(u,R),p=R}}}function An(e){return Y(yt(e)).split(bt).join(Fn+Xn)}function yt(e){return{...e,children:e.children.map(t=>pe(t)?{kind:"text",value:bt}:t.kind==="element"?yt(t):t)}}var Fn,Xn,bt,Rt=b(()=>{"use strict";Te();Fn="<!--fx-->",Xn="<!--fx/-->";bt="\0fx-hole\0"});var Le,oi,Ct=b(()=>{"use strict";Le={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},oi={version:2,module:"@fluixi/dom",symbols:[...Le.symbols,"template","cloneTemplate","walk"]}});function _n(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function It(e){return _n(e)?e:JSON.stringify(e)}function zn(e){return e.expr!==void 0?e.reactive?`() => (${e.expr})`:`(${e.expr})`:JSON.stringify(e.literal??!0)}function Bn(e){return e.expr!==void 0?`(${e.expr})`:JSON.stringify(e.literal??!0)}function Vn(e,t,n){let i=e.filter(l=>l.kind==="spread"),s=e.filter(l=>l.kind!=="spread").map(l=>`${It(l.name)}: ${zn(l)}`);t!=null&&s.push(`children: ${t}`);let a=`{ ${s.join(", ")} }`;return i.length>0?(n.add("mergeProps"),`mergeProps(${i.map(l=>l.expr).join(", ")}, ${a})`):a}function Nt(e,t,n){return e.length===1?Q(e[0],t,n):`[${e.map(i=>Q(i,t,n)).join(", ")}]`}function wt(e,t,n,i,o){i.add("createMemo"),i.add("createComponent");let s=t.filter(p=>p.kind==="spread"),l=t.filter(p=>p.kind!=="spread").map(p=>`get ${It(p.name)}() { return ${Bn(p)}; }`);n.length>0&&l.push(`get children() { return ${Nt(n,i,o)}; }`);let c=`{ ${l.join(", ")} }`;return s.length>0&&(i.add("mergeProps"),c=`mergeProps(${s.map(p=>p.expr).join(", ")}, ${c})`),`createMemo(() => createComponent(${e}, ${c}))`}function Hn(e,t){let n=xt(t.name),i=t.literal;return i===!0||i===void 0?`${e}.setAttribute(${JSON.stringify(n)}, "");`:i===!1||i===null?"":`${e}.setAttribute(${JSON.stringify(n)}, ${JSON.stringify(String(i))});`}function Q(e,t,n){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":Nt(e.children,t,n);case"component":return wt(e.name,e.props,e.children,t,n);case"control":{let i=Dn[e.control]??e.control;return t.add(i),wt(i,e.props,e.children,t,n)}case"element":{if(n&&e.static&&!e.svg&&Me(e)){t.add("templateNode");let l=`_tmpl$${n.length}`;return n.push({id:l,html:Y(e),tag:e.tag,svg:!1}),`templateNode(${l}, ${JSON.stringify(e.tag)})`}if(n&&kt){let l=vt(e);if(l){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let c=`_tmpl$${n.length}`;n.push({id:c,html:l.html,tag:l.tag,svg:!1});let p=[`const _el$ = templateNode(${c}, ${JSON.stringify(l.tag)}, true);`];for(let f of l.steps)p.push(`const ${f.ref} = ${f.expr};`);for(let f of l.holes)p.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => (${Q(f.node,t,n)})), ${f.endRef}, holeContent(${f.startRef}, ${f.endRef}));`);return p.push("return _el$;"),`(() => { ${p.join(" ")} })()`}}t.add("createNativeElement");let i=JSON.stringify(e.tag),o="_el$",s=[],a=e.svg?`${i}, true`:i;if(s.push(`const ${o} = createNativeElement(${a});`),e.props.length>0)if(!e.svg&&e.props.every(K))for(let l of e.props)s.push(Hn(o,l));else{t.add("spread");let l=e.svg?", isSVG: true":"";s.push(`spread({ element: ${o}, props: ${Vn(e.props,null,t)}${l} });`)}for(let l of e.children){t.add("insert");let c=Q(l,t,n),p=l.kind==="expr"&&l.reactive||l.kind==="component"||l.kind==="control";s.push(p?`insert(${o}, ${c}, null);`:`insert(${o}, ${c});`)}return s.push(`return ${o};`),`(() => { ${s.join(" ")} })()`}}}function ee(e,t){if(!t||t.length===0)return e;let n=new Map(t.map(i=>[i.id,JSON.stringify(i.html)]));return e.replace(/_tmpl\$\d+/g,i=>n.get(i)??i)}var Dn,kt,j,ue=b(()=>{"use strict";Rt();Te();Ct();Dn={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};kt=!1;j={name:"imperative",contract:Le,emit(e,t){let n=new Set,i=t?.templateClone!==!1?[]:void 0;return kt=t?.partialTemplates===!0,{code:Q(e,n,i),imports:Array.from(n),templates:i}}}});function Un(e){return Wn(e,{concise:!0}).code}function qn(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Tt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $t(e,t,n={}){let i=e.quasi,o=i.expressions.map(l=>{let c=l;return{node:c,code:F(c,t),reactive:k(c)}}),s=Gn(i),{root:a}=(0,Lt.parseTemplate)(s,{svg:n.svg});return new Je(o,t).lowerRoot(a.children)}function Gn(e){let t=[];return e.quasis.forEach((n,i)=>{let o=n.value.cooked??n.value.raw;if(t.push({kind:"static",text:o,start:n.start??0}),i<e.expressions.length){let s=e.expressions[i];t.push({kind:"hole",index:i,start:s.start??0,end:s.end??0})}}),t}var te,$e,Lt,Wn,Mt,Je,Jt=b(()=>{"use strict";te=require("@babel/core"),$e=se(require("@babel/generator"),1),Lt=require("@fluixi/template-parser");H();ue();Pe();Wn=$e.default.default??$e.default;Mt=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);Je=class{constructor(t,n){this.holes=t;this.used=n}hole(t){return this.holes[t]??{node:te.types.identifier("undefined"),code:"undefined",reactive:!1}}emit(t){let{code:n,imports:i,templates:o}=j.emit(t,{});for(let s of i)this.used.add(s);return ee(n,o)}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 o=t[i];if(o.kind==="Element"||o.kind==="Component"){let a=o.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(f=>f.kind==="ElseDirective");n.push(this.lowerIf(o,a.hole,p?c:null)),p&&(i=l);continue}if(o.attributes.some(l=>l.kind==="EachDirective")){n.push(this.lowerEach(o));continue}}let s=this.lowerNode(o);s&&n.push(s)}return n}isBlankText(t){return t.kind==="Text"&&!t.raw&&fe(t.value)===""}lowerNode(t){switch(t.kind){case"Text":{if(t.raw)return{kind:"text",value:t.value};let n=fe(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(s=>s!==n),o=this.lowerComponent({...t,kind:"Component",tag:"Dynamic",tagHole:null,attributes:i});return o.props.unshift({name:"component",kind:"attr",expr:`() => (${this.hole(n.value.hole).code})`}),o}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:o,rest:s}=this.partitionSlots(t.children);for(let[c,p]of o){let f=p.length===1?p[0]:{kind:"fragment",children:p},u={name:c,kind:"attr",expr:this.emit(f),jsxElement:!0},x=i.findIndex(R=>R.name===c);x>=0?i[x]=u:i.push(u)}let a=t.attributes.find(c=>c.kind==="LoadDirective"),l=a?V(`load:${a.strategy}`,a.modifier):void 0;return{kind:"component",name:n,props:i,children:this.lowerChildren(s),...l?{load:l}:{}}}partitionSlots(t){let n=new Map,i=[];for(let o of t){if(o.kind==="Element"||o.kind==="Component"){let s=o.attributes.find(a=>a.kind==="Attribute"&&a.name==="slot");if(s&&s.value&&s.value.kind==="static"){let a={...o,attributes:o.attributes.filter(p=>p!==s)},l=a.kind==="Element"?this.lowerElement(a):this.lowerComponent(a),c=n.get(s.value.value)??[];c.push(l),n.set(s.value.value,c);continue}}i.push(o)}return{slots:n,rest:i}}lowerIf(t,n,i){let o=this.hole(n),s=[{name:"when",kind:"attr",expr:o.code,reactive:o.reactive}];if(i){let l=this.stripAndLower(i,c=>c.kind==="ElseDirective");s.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:s,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),o=[{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;o.push({name:"by",kind:"attr",expr:c})}let s=this.itemArrow(t),a;if(s){let c=s.body,p={kind:"expr",code:F(c,this.used),reactive:k(c)},f=this.rebuildWithChildren(t,[p]);a=`(${s.params.map(u=>Un(u)).join(", ")}) => (${this.emit(f)})`}else{let c=this.stripAndLower(t,p=>p.kind==="EachDirective");a=`() => (${this.emit(c)})`}return{kind:"component",name:"For",props:o,children:[{kind:"expr",code:a,reactive:!1}]}}itemArrow(t){let n=t.children.filter(o=>!this.isBlankText(o));if(n.length!==1||n[0].kind!=="Expression")return null;let i=this.hole(n[0].hole).node;return te.types.isArrowFunctionExpression(i)&&!te.types.isBlockStatement(i.body)?i:null}stripAndLower(t,n){let i={...t,attributes:t.attributes.filter(o=>!n(o))};return i.kind==="Element"?this.lowerElement(i):this.lowerComponent(i)}rebuildWithChildren(t,n){let i=this.lowerAttributes(t.attributes.filter(o=>o.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=[],o=!1,s=[],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}`),o=o||p.reactive;break}case"StyleDirective":{let p=this.hole(c.hole);s.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:o}),s.length>0&&n.push({name:"style",kind:"attr",expr:`{ ${s.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"+Tt(t.name),kind:"event",event:{name:n,delegated:Mt.has(n)},expr:i};let s=this.wrapHandler(i,t.modifiers),a=this.eventOptions(t.modifiers),l=a?`[${s}, ${a}]`:s;return{name:"on:"+n,kind:"attr",expr:l}}wrapHandler(t,n){let i=n.includes("self")?"if (e.target !== e.currentTarget) return; ":"",o=[];return n.includes("prevent")&&o.push("e.preventDefault();"),n.includes("stop")&&o.push("e.stopPropagation();"),!i&&o.length===0?t:`(e) => { ${i}${o.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",o=i?"change":"input",s=i?"checked":"value",a=`(${n})`;return[{name:t,kind:"attr",expr:`${a}[0]()`,reactive:!0},{name:"on"+Tt(o),kind:"event",event:{name:o,delegated:Mt.has(o)},expr:`(e) => ${a}[1](e.target.${s})`}]}plainAttr(t){let n=t.value,i=t.name;t.name==="class"?i=n&&n.kind==="hole"&&te.types.isObjectExpression(this.hole(n.hole).node)?"classList":"className":t.name==="html"&&(i="innerHTML");let s={name:i,kind:"attr"};if(n==null)return s.literal=!0,s;if(n.kind==="static")return s.literal=n.value,s;if(n.kind==="hole"){let c=this.hole(n.hole);return s.expr=c.code,s.reactive=c.reactive,s}let a=!1,l=n.parts.map(c=>{if("text"in c)return qn(c.text);let p=this.hole(c.hole);return a=a||p.reactive,"${"+p.code+"}"}).join("");return s.expr="`"+l+"`",s.reactive=a,s}}});function Zn(e){switch(e.kind){case"event":return"event";case"ref":return"ref";case"spread":return"spread";case"class":case"style":return"class-or-style-directive";case"attr":case"prop":return e.reactive?"reactive-prop":e.expr!==void 0?"expression-prop":void 0;default:return"expression-prop"}}function de(e){let t=[],n=new Map,i=o=>{switch(o.kind){case"text":return!0;case"expr":return!1;case"component":case"control":for(let s of o.children)i(s);return!1;case"fragment":for(let s of o.children)i(s);return!1;case"element":{let s=!0;for(let l of o.children)i(l)||(s=!1);let a;for(let l of o.props)if(a=Zn(l),a)break;return!a&&!s&&(a=Kn(o)),o.static=!a,a?n.set(o,a):t.push(o),o.static}default:return!1}};for(let o of Array.isArray(e)?e:[e])i(o);return{staticElements:t,reasons:n}}function Kn(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="control")return"control-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var je=b(()=>{"use strict"});function me(e,t=new Set,n={}){let i=$t(e,t,n);return de(i),i}var Fe=b(()=>{"use strict";Jt();je()});function Ft(e){return Yn(e,{concise:!0}).code}function Qn(e,t){let n=m.types.cloneNode(e,!0),i=m.types.file(m.types.program([m.types.expressionStatement(n)])),o=!1,s=(a,l,c)=>{for(let p of c)t.add(p);a.replaceWith(m.template.expression(l,{placeholderPattern:!1,plugins:["typescript"]})()),a.skip(),o=!0};return(0,m.traverse)(i,{"JSXElement|JSXFragment"(a){let l=a.node,{code:c,imports:p,templates:f}=j.emit(De(l,t),{});s(a,ee(c,f),p)},TaggedTemplateExpression(a){let l=a.node.tag;if(!m.types.isIdentifier(l)||l.name!=="html"&&l.name!=="svg")return;let c=me(a.node,t,{svg:l.name==="svg"}),{code:p,imports:f,templates:u}=j.emit(c,{});s(a,ee(p,u),f)}}),o?i.program.body[0].expression:e}function F(e,t){return Ft(Qn(e,t))}function rr(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:Ft(e),component:!0}:m.types.isJSXNamespacedName(e)?{tag:`${e.namespace.name}:${e.name.name}`,component:!1}:{tag:"div",component:!1}}function Ae(e){return m.types.isJSXIdentifier(e)?e.name==="class"?"className":e.name:m.types.isJSXNamespacedName(e)?`${e.namespace.name}:${e.name.name}`:"unknown"}function k(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)?k(e.test)||k(e.consequent)||k(e.alternate):m.types.isLogicalExpression(e)||m.types.isBinaryExpression(e)?k(e.left)||k(e.right):m.types.isTemplateLiteral(e)?e.expressions.some(t=>k(t)):m.types.isObjectExpression(e)?e.properties.some(t=>m.types.isObjectProperty(t)&&!t.computed&&k(t.value)):m.types.isArrayExpression(e)?e.elements.some(t=>t!=null&&!m.types.isSpreadElement(t)&&k(t)):!1}function ir(e,t){let n=Ae(e.name),i=tr.test(n),o=i||n.startsWith("on:"),a={name:n,kind:i?"event":"attr"};i&&(a.event={name:n.slice(2).toLowerCase(),delegated:nr.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=F(c,t),a.reactive=o?!1:k(c),(m.types.isJSXElement(c)||m.types.isJSXFragment(c))&&(a.jsxElement=!0),a)}return a.literal=!0,a}function Pt(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)?F(n.expression,t):null}function or(e,t){let n=[],i=[];for(let o of e){if(m.types.isJSXSpreadAttribute(o)){n.push({name:"",kind:"spread",expr:F(o.argument,t)});continue}if(!m.types.isJSXAttribute(o)||Z(Ae(o.name)))continue;let s=m.types.isJSXNamespacedName(o.name)?o.name.namespace.name:null;if(s==="use"){let a=o.name.name.name;t.add(a);let l=Pt(o,t);i.push(l!=null?`[${a}, () => (${l})]`:`[${a}]`);continue}if(s==="oncapture"){let a=o.name.name.name.toLowerCase(),l=Pt(o,t)??"undefined";n.push({name:"on:"+a,kind:"attr",expr:`[${l}, { capture: true }]`});continue}n.push(ir(o,t))}return i.length>0&&n.push({name:"use",kind:"attr",expr:`[${i.join(", ")}]`}),n}function fe(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let o=0;o<t.length;o++)/[^ \t]/.test(t[o])&&(n=o);let i="";for(let o=0;o<t.length;o++){let s=t[o].replace(/\t/g," ");o!==0&&(s=s.replace(/^ +/,"")),o!==t.length-1&&(s=s.replace(/ +$/,"")),s&&(o!==n&&(s+=" "),i+=s)}return i}function jt(e,t){let n=[];for(let i of e)if(m.types.isJSXText(i)){let o=fe(i.value);o&&n.push({kind:"text",value:o})}else if(m.types.isJSXExpressionContainer(i)){if(!m.types.isJSXEmptyExpression(i.expression)){let o=i.expression;n.push({kind:"expr",code:F(o,t),reactive:k(o)})}}else m.types.isJSXElement(i)||m.types.isJSXFragment(i)?n.push(Oe(i,t)):m.types.isJSXSpreadChild(i)&&n.push({kind:"expr",code:F(i.expression,t),reactive:!1});return n}function De(e,t=new Set){let n=Oe(e,t);return de(n),n}function Oe(e,t){if(m.types.isJSXFragment(e))return{kind:"fragment",children:jt(e.children,t)};let{tag:n,component:i}=rr(e.openingElement.name),o=or(e.openingElement.attributes,t),s=jt(e.children,t);if(i){let a=sr(e.openingElement.attributes);return{kind:"component",name:n,props:o,children:s,...a?{load:a}:{}}}return{kind:"element",tag:n,svg:er.has(n),props:o,children:s,static:!1}}function sr(e){for(let t of e){if(!m.types.isJSXAttribute(t))continue;let n=Ae(t.name);if(Z(n)){if(t.value&&!m.types.isStringLiteral(t.value))throw new $(`'${n}' needs a literal value, not an expression — the strategy is compile-time.`);return V(n,t.value?t.value.value:null)}}}var m,Xe,Yn,er,tr,nr,Pe=b(()=>{"use strict";m=require("@babel/core"),Xe=se(require("@babel/generator"),1);ue();Fe();je();H();Yn=Xe.default.default??Xe.default;er=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),tr=/^on[A-Z]/,nr=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"])});function lr(e,t,n){let{runtime:i,pragma:o,development:s,autoShow:a=!0}=n;return i==="automatic"?re(e,t,s,a):Er(e,t,o)}function Ot(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 Vt(e){return e.length===1?e[0]:r.types.arrayExpression(e)}function pr(e,t,n,i,o,s){if(!t){let u=[...n];return o.length>0&&u.push(r.types.objectMethod("get",r.types.identifier("children"),[],r.types.blockStatement([r.types.returnStatement(Vt(o))]))),Ht(e,Ot(u,i,s),s)}let a=e.value,l=cr.has(a),c=r.types.identifier("_el$"),p=[];s.needsCreateNativeElement=!0;let f=[e];if(l&&f.push(r.types.booleanLiteral(!0)),p.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(c,r.types.callExpression(r.types.identifier("createNativeElement"),f))])),n.length>0||i.length>0){s.needsSpread=!0;let u=[r.types.objectProperty(r.types.identifier("element"),c),r.types.objectProperty(r.types.identifier("props"),Ot(n,i,s))];l&&u.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(u)])))}if(o.length>0){s.needsInsert=!0;for(let u of o){let R=r.types.isArrowFunctionExpression(u)||r.types.isFunctionExpression(u)||r.types.isCallExpression(u)&&r.types.isIdentifier(u.callee)&&u.callee.name==="createMemo"?[r.types.cloneNode(c),u,r.types.nullLiteral()]:[r.types.cloneNode(c),u];p.push(r.types.expressionStatement(r.types.callExpression(r.types.identifier("insert"),R)))}}return p.push(r.types.returnStatement(c)),r.types.callExpression(r.types.arrowFunctionExpression([],r.types.blockStatement(p)),[])}function ur(e,t){let n=null;if(t.value)if(r.types.isStringLiteral(t.value))n=t.value.value;else throw new $(`'${e}' needs a literal value, not an expression — the strategy is compile-time.`);return V(e,n)}function fr(e){let t=[r.types.objectProperty(r.types.identifier("kind"),r.types.stringLiteral(e.kind))];return e.kind==="visible"&&e.rootMargin&&t.push(r.types.objectProperty(r.types.identifier("rootMargin"),r.types.stringLiteral(e.rootMargin))),e.kind==="interaction"&&t.push(r.types.objectProperty(r.types.identifier("events"),r.types.arrayExpression(e.events.map(n=>r.types.stringLiteral(n))))),e.kind==="media"&&t.push(r.types.objectProperty(r.types.identifier("query"),r.types.stringLiteral(e.query))),r.types.objectExpression(t)}function dr(e,t){return!P(e)||!P(t)?X:e}function Ht(e,t,n){r.types.isIdentifier(e)&&he.has(e.name)&&(n.controlFlowComponents.add(e.name),n.needsControlFlowImport=!0);let i=!1;if(r.types.isIdentifier(e)&&!he.has(e.name)&&n.componentResolver){let o=n.componentResolver.resolve(e.name);if(o){let s=n.pendingLoad??X,a=n.resolvedComponents.has(e.name);if(P(s)&&!a){let l=n.deferredComponents.get(e.name),c=l?dr(l.strategy,s):s;P(c)?n.deferredComponents.set(e.name,{...o,strategy:c}):(n.deferredComponents.delete(e.name),n.resolvedComponents.set(e.name,o))}else n.deferredComponents.delete(e.name),n.resolvedComponents.set(e.name,o);i=!0}}return n.pendingLoad=void 0,!i&&r.types.isIdentifier(e)&&ge.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 Wt(e,t,n){if(!t||t.length===0)return e;let i=new Map;for(let o of t){let s=`${o.svg?"svg:":""}${o.html}`,a=n.staticTemplates.get(s);a||(a=`_tmpl$${n.staticTemplates.size}`,n.staticTemplates.set(s,a)),i.set(o.id,a)}return e.replace(/_tmpl\$\d+/g,o=>i.get(o)??o)}function At(e,t){let n=new Set,i=De(e,n);we(i,{resolver:t.componentResolver,modules:{controlFlowModule:t.controlFlowModule,coreModule:t.libModule,routerModule:t.routerModule},strategyFor:c=>c.load}),Ne(i);let{code:o,imports:s,templates:a}=j.emit(i,{templateClone:t.templateClone,partialTemplates:t.partialTemplates});for(let c of s)n.add(c);for(let c of n)t.irImports.add(c);ze(i,t);let l=Wt(o,a,t);return r.template.expression(l,{placeholderPattern:!1,plugins:["typescript"]})()}function mr(e){let t=new Map,n=[];for(let i of e){let o=i.source.value;if(!i.specifiers.every(l=>r.types.isImportSpecifier(l))){n.push(i);continue}let a=t.get(o);if(!a){let l=new Set(i.specifiers.map(c=>c.local.name));t.set(o,{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 gr(e,t){let n=new Set,i=r.types.isIdentifier(e.tag)&&e.tag.name==="svg",o=me(e,n,{svg:i});we(o,{resolver:t.componentResolver,modules:{controlFlowModule:t.controlFlowModule,coreModule:t.libModule,routerModule:t.routerModule},strategyFor:p=>p.load}),Ne(o);let{code:s,imports:a,templates:l}=j.emit(o,{templateClone:t.templateClone,partialTemplates:t.partialTemplates});for(let p of a)n.add(p);for(let p of n)t.irImports.add(p);ze(o,t),t.hasLitIR=!0;let c=r.template.expression(Wt(s,l,t),{placeholderPattern:!1,plugins:["typescript"]})();return hr(c,e),c}function hr(e,t){if(!t.loc)return;let n=new Set,i=o=>{if(!n.has(o)){n.add(o),o.loc||(o.loc=t.loc,o.start=t.start,o.end=t.end);for(let s of r.types.VISITOR_KEYS[o.type]??[]){let a=o[s];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 ze(e,t){if(e.kind==="component"&&e.source&&(e.source.origin==="builtin"?(t.controlFlowComponents.add(e.name),t.needsControlFlowImport=!0):P(e.source.loading)&&!t.resolvedComponents.has(e.name)?t.deferredComponents.set(e.name,{module:e.source.module,export:e.source.export,strategy:e.source.loading}):(t.deferredComponents.delete(e.name),t.resolvedComponents.set(e.name,{module:e.source.module,export:e.source.export}))),(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)ze(n,t)}function xr(e){return e.map(t=>{if(r.types.isObjectProperty(t)){let n=t.key,i=t.computed,o=t.value;return r.types.objectMethod("get",n,[],r.types.blockStatement([r.types.returnStatement(o)]),i)}return t})}function re(e,t,n,i=!0){let o=e.openingElement,s=e.children,a=Ut(o.name),l=r.types.isJSXIdentifier(o.name)&&/^[a-z]/.test(o.name.name),c=Gt(o.attributes,t,l,r.types.isJSXIdentifier(o.name)?o.name.name:""),p=c.props,f=c.spreads;l||(p=xr(p));let u=Be(s,t,i);if(t.backend==="imperative")return pr(a,l,p,f,u,t);if(u.length>0){let I=u.length===1?u[0]:r.types.arrayExpression(u);p.push(r.types.objectProperty(r.types.identifier("children"),I))}let x;if(f.length>0){let I=p.length>0?r.types.objectExpression(p):r.types.objectExpression([]);t.needsMergeProps=!0,x=r.types.callExpression(r.types.identifier("mergeProps"),[...f,I])}else x=r.types.objectExpression(p);let R=n?"jsxDEV":u.length>1?"jsxs":"jsx",C=[a,x];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(R),C)}function Er(e,t,n){let i=e.openingElement,o=e.children,s=Ut(i.name),a=r.types.isJSXIdentifier(i.name)&&/^[a-z]/.test(i.name.name),{props:l,spreads:c}=Gt(i.attributes,t,a,r.types.isJSXIdentifier(i.name)?i.name.name:""),p=Be(o,t,t.autoShow??!0),f;if(c.length>0){let x=l.length>0?r.types.objectExpression(l):r.types.objectExpression([]);t.needsMergeProps=!0,f=r.types.callExpression(r.types.identifier("mergeProps"),[...c,x])}else f=l.length>0?r.types.objectExpression(l):r.types.nullLiteral();let u=[s,f,...p];return r.types.callExpression(r.types.identifier(n),u)}function xe(e,t,n){let{runtime:i,pragmaFrag:o,development:s}=n,a=Be(e.children,t,t.autoShow??!0);if(t.backend==="imperative")return a.length===0?r.types.nullLiteral():Vt(a);if(i==="automatic"){let l=s?"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 s&&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(o),a)}function Ut(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)?qt(e):r.types.isJSXNamespacedName(e)?r.types.stringLiteral(`${e.namespace.name}:${e.name.name}`):r.types.stringLiteral("div")}function qt(e){let t;return r.types.isJSXIdentifier(e.object)?t=r.types.identifier(e.object.name):t=qt(e.object),r.types.memberExpression(t,r.types.identifier(e.property.name))}function Sr(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}function Gt(e,t,n=!0,i=""){let o=[],s=[],a=ar[i];t.pendingLoad=void 0;for(let l of e)if(r.types.isJSXSpreadAttribute(l))s.push(l.argument);else if(r.types.isJSXAttribute(l)){let c=vr(l.name);if(Z(c)){t.pendingLoad=ur(c,l);continue}let p=yr(l.value,t,c,n);if(zt.test(c)){let D=c.slice(2).toLowerCase();Bt.includes(D)&&t.delegatedEvents.add(D)}let f=Sr(c)?r.types.identifier(c):r.types.stringLiteral(c),u=l.value,x=r.types.isJSXElement(u)||r.types.isJSXFragment(u)||r.types.isJSXExpressionContainer(u)&&(r.types.isJSXElement(u.expression)||r.types.isJSXFragment(u.expression)),R=!n&&c===a,C=r.types.isJSXExpressionContainer(u)&&!r.types.isJSXEmptyExpression(u.expression)?u.expression:null,I=!n&&!!C&&Zt(C,c);!n&&x||R||I?o.push(r.types.objectMethod("get",f,[],r.types.blockStatement([r.types.returnStatement(p)]))):o.push(r.types.objectProperty(f,p))}return{props:o,spreads:s}}function vr(e){return r.types.isJSXIdentifier(e)?e.name==="class"?"className":e.name:r.types.isJSXNamespacedName(e)?`${e.namespace.name}:${e.name.name}`:"unknown"}function yr(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 o=e.expression;return i&&Zt(o,n)?r.types.arrowFunctionExpression([],o):o}return r.types.isJSXElement(e)?re(e,t,!1,t.autoShow??!0):r.types.isJSXFragment(e)?xe(e,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1}):r.types.booleanLiteral(!0)}function Zt(e,t){return zt.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 br(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let o=0;o<t.length;o++)/[^ \t]/.test(t[o])&&(n=o);let i="";for(let o=0;o<t.length;o++){let s=t[o].replace(/\t/g," ");o!==0&&(s=s.replace(/^ +/,"")),o!==t.length-1&&(s=s.replace(/ +$/,"")),s&&(o!==n&&(s+=" "),i+=s)}return i}function Be(e,t,n=!0){let i=[];for(let o of e)if(r.types.isJSXText(o)){let s=br(o.value);s&&i.push(r.types.stringLiteral(s))}else if(r.types.isJSXExpressionContainer(o)){if(!r.types.isJSXEmptyExpression(o.expression)){let s=o.expression;if(n){let a=Rr(s,t)??Cr(s,t);if(a){i.push(a);continue}}else{let a=wr(s,t);if(a){i.push(a);continue}}Nr(s)?i.push(r.types.arrowFunctionExpression([],s)):i.push(s)}}else r.types.isJSXElement(o)?i.push(re(o,t,!1,t.autoShow??!0)):r.types.isJSXFragment(o)?i.push(xe(o,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1})):r.types.isJSXSpreadChild(o)&&i.push(o.expression);return i}function Rr(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 ne(O(n.left),i,null,t)}if(r.types.isConditionalExpression(n)){let i=J(n.consequent);if(i){let o=Ve(n.alternate,t);return ne(O(n.test),i,o,t,!0)}}return null}function Cr(e,t){if(r.types.isLogicalExpression(e)&&e.operator==="&&"){let n=J(e.right);if(n)return ne(O(e.left),n,null,t)}if(r.types.isConditionalExpression(e)){let n=J(e.consequent);if(n){let i=Ve(e.alternate,t);return ne(O(e.test),n,i,t)}}return null}function wr(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=O(n.test),s=J(n.consequent)??n.consequent,l=J(n.alternate)??n.alternate,c=r.types.conditionalExpression(i,s,l);return _e(n.consequent)||_e(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=O(n.left),s=J(n.right)??n.right,a=r.types.logicalExpression("&&",i,s);return _e(n.right)?null:(t.needsCreateMemo=!0,r.types.callExpression(r.types.identifier("createMemo"),[r.types.arrowFunctionExpression([],a)]))}return null}function Ve(e,t){if(Ir(e))return null;let n=J(e);if(n)return Kt(n,t);if(r.types.isConditionalExpression(e)){let i=e,o=J(i.consequent);if(o){let s=Ve(i.alternate,t);return ne(O(i.test),o,s,t)}}return e}function Dt(e){return r.types.isJSXElement(e)||r.types.isJSXFragment(e)}function _e(e){let t=J(e);if(!t||!r.types.isJSXElement(t))return!1;let n=t.openingElement.name;return r.types.isJSXIdentifier(n)&&he.has(n.name)}function J(e){return Dt(e)?e:r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&Dt(e.body)?e.body:null}function O(e){return r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&r.types.isExpression(e.body)?e.body:e}function Ir(e){return r.types.isNullLiteral(e)||r.types.isIdentifier(e)&&e.name==="undefined"||r.types.isBooleanLiteral(e)&&e.value===!1}function Kt(e,t){return r.types.isJSXElement(e)?re(e,t,!1,t.autoShow??!0):xe(e,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1})}function ne(e,t,n,i,o=!1){i.controlFlowComponents.add("Show"),i.needsControlFlowImport=!0;let s=Kt(t,i),a=[r.types.objectProperty(r.types.identifier("when"),r.types.arrowFunctionExpression([],e)),r.types.objectProperty(r.types.identifier("children"),s)];return n&&a.push(r.types.objectProperty(r.types.identifier("fallback"),n)),Ht(r.types.identifier("Show"),r.types.objectExpression(a),i)}function Nr(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 Yt(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 o of n.attributes){if(r.types.isJSXSpreadAttribute(o))return!1;if(r.types.isJSXAttribute(o)){let s=o.value;if(r.types.isJSXExpressionContainer(s)&&!r.types.isStringLiteral(s.expression)&&!r.types.isNumericLiteral(s.expression))return!1}}for(let o of e.children)if(r.types.isJSXElement(o)&&!Yt(o,t)||r.types.isJSXExpressionContainer(o))return!1;return!0}function kr(e,t){let n=`_$static${t.staticCounter++}`,i=re(e,t,!1);return t.staticElements.set(n,i),r.types.identifier(n)}function Mr(e,t){let n=e.openingElement.name.name;return n==="Show"?Tr(e,t):n==="For"?Lr(e,t):null}function Tr(e,t){return null}function Lr(e,t){return null}var _t,r,he,Xt,ge,ar,zt,Bt,W,cr,He=b(()=>{"use strict";_t=require("@babel/helper-plugin-utils");ft();Ie();gt();H();Ce();r=require("@babel/core");Pe();Fe();ue();he=new Set([...G,...z]),Xt=new Set(z),ge=new Set(B),ar={Show:"when",For:"each",Index:"each",Match:"when"},zt=/^on[A-Z]/,Bt=["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave"],W=(0,_t.declare)((e,t={})=>{e.assertVersion(7);let{runtime:n="automatic",importSource:i="@fluixi/jsx",pragma:o="jsx",pragmaFrag:s="Fragment",development:a=!1,detectReactivity:l=!0,useLitHTML:c=!0,hoistStatics:p=!0,delegateEvents:f=!0,delegatedEvents:u=Bt,optimizeControlFlow:x=!0,sourceMaps:R=!0,signalModule:C="@fluixi/dom",controlFlowModule:I="@fluixi/dom",routerModule:D="@fluixi/core/router-next",reactiveModule:tt="@fluixi/reactive/signal",autoShowTransform:nt=!1,backend:L="imperative",codegen:q="inline",templateClone:rt=!0,partialTemplates:it=!0,format:ot="both",litTag:fn="html",resolve:dn=[]}=t,st=ut(dn),mn=ot==="lit"||ot==="both",gn={backend:L,codegen:q,irImports:new Set,libModule:"@fluixi/core",controlFlowModule:I,routerModule:D,templateClone:rt,partialTemplates:it,hasJSX:!1,hasReactivity:!1,hasLitHTML:!1,needsSignalImport:!1,needsControlFlowImport:!1,needsCreateMemo:!1,controlFlowComponents:new Set,resolvedComponents:new Map,deferredComponents:new Map,componentResolver:st,delegatedEvents:new Set,staticElements:new Map,staticTemplates:new Map,staticCounter:0};return{name:"@fluixi/babel-plugin-jsx",manipulateOptions(g,d){d.plugins.push("jsx","typescript")},pre(g){Object.assign(g,gn)},visitor:{ImportDeclaration(g,d){g.node.source.value==="@fluixi/core/rx"&&(g.node.source=r.types.stringLiteral("@fluixi/reactive"))},Program:{enter(g,d){Object.assign(d,{hasJSX:!1,hasReactivity:!1,hasLitHTML:!1,hasLitIR:!1,needsSignalImport:!1,needsControlFlowImport:!1,needsCreateMemo:!1,controlFlowComponents:new Set,resolvedComponents:new Map,deferredComponents:new Map,componentResolver:st,delegatedEvents:new Set,staticElements:new Map,staticTemplates:new Map,autoShow:nt,staticCounter:0,libModule:"@fluixi/core",controlFlowModule:I,routerModule:D,templateClone:rt,partialTemplates:it,backend:L,codegen:q,irImports:new Set,needsCreateNativeElement:!1,needsInsert:!1,needsSpread:!1,needsCreateComponent:!1,needsMergeProps:!1})},exit(g,d){let h=[];if(d.hasJSX||d.needsSignalImport&&h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("signal"),r.types.identifier("signal"))],r.types.stringLiteral(C))),d.hasJSX||d.hasLitIR){if(d.irImports.size>0){let S=new Set(["Show","For","Index","Switch","Match","Dynamic","ErrorBoundary","Portal","Suspense"]),E=new Set(["createMemo","createEffect","createRenderEffect","createRoot","createSignal","onCleanup","batch","untrack"]),v=Array.from(d.irImports),w=y=>r.types.importSpecifier(r.types.identifier(y),r.types.identifier(y)),T=y=>!g.scope.hasBinding(y),_=v.filter(y=>E.has(y)&&T(y)),N=v.filter(y=>!S.has(y)&&!E.has(y)&&T(y)),ie=v.filter(y=>S.has(y)&&T(y));_.length>0&&h.push(r.types.importDeclaration(_.map(w),r.types.stringLiteral(tt))),N.length>0&&h.push(r.types.importDeclaration(N.map(w),r.types.stringLiteral(C))),ie.length>0&&h.push(r.types.importDeclaration(ie.map(w),r.types.stringLiteral(I)))}if(d.hasJSX&&L==="imperative"&&q!=="ir"){let E=[[!!d.needsCreateNativeElement,"createNativeElement"],[!!d.needsSpread,"spread"],[!!d.needsInsert,"insert"],[!!d.needsCreateComponent,"createComponent"],[!!d.needsMergeProps,"mergeProps"]].filter(([v,w])=>v&&!g.scope.hasBinding(w)).map(([,v])=>r.types.importSpecifier(r.types.identifier(v),r.types.identifier(v)));E.length>0&&h.push(r.types.importDeclaration(E,r.types.stringLiteral(C)))}else if(d.hasJSX&&n==="automatic"&&L!=="imperative"){let S=[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&&S.push(r.types.importSpecifier(r.types.identifier("jsxDEV"),r.types.identifier("jsxDEV"))),d.needsMergeProps&&S.push(r.types.importSpecifier(r.types.identifier("mergeProps"),r.types.identifier("mergeProps"))),h.push(r.types.importDeclaration(S,r.types.stringLiteral(i)))}if(d.needsCreateMemo&&!g.scope.hasBinding("createMemo")&&h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("createMemo"),r.types.identifier("createMemo"))],r.types.stringLiteral(L==="imperative"?tt:d.libModule??"@fluixi/core"))),d.needsControlFlowImport&&d.controlFlowComponents.size>0){let S=Array.from(d.controlFlowComponents).filter(N=>!g.scope.hasBinding(N)),E=d.libModule??"@fluixi/core",v=S.filter(N=>ge.has(N)),w=S.filter(N=>Xt.has(N)),T=S.filter(N=>!Xt.has(N)&&!ge.has(N)),_=(N,ie)=>r.types.importDeclaration(N.map(y=>r.types.importSpecifier(r.types.identifier(y),r.types.identifier(y))),r.types.stringLiteral(ie));T.length>0&&h.push(_(T,I)),w.length>0&&h.push(_(w,E)),v.length>0&&h.push(_(v,D))}let M=[];if(d.deferredComponents.size>0){for(let[S,E]of d.deferredComponents)g.scope.hasBinding(S)||M.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(r.types.identifier(S),r.types.callExpression(r.types.identifier("deferred"),[r.types.arrowFunctionExpression([],r.types.callExpression(r.types.import(),[r.types.stringLiteral(E.module)])),r.types.objectExpression([r.types.objectProperty(r.types.identifier("strategy"),fr(E.strategy)),r.types.objectProperty(r.types.identifier("export"),r.types.stringLiteral(E.export))])]))]));M.length>0&&!g.scope.hasBinding("deferred")&&h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("deferred"),r.types.identifier("deferred"))],r.types.stringLiteral(d.libModule??"@fluixi/core")))}if(d.resolvedComponents.size>0){let S=new Map;for(let[E,v]of d.resolvedComponents){if(g.scope.hasBinding(E))continue;let w=S.get(v.module)??[];w.push({local:E,exported:v.export}),S.set(v.module,w)}for(let[E,v]of S)h.push(r.types.importDeclaration(v.map(({local:w,exported:T})=>T==="default"?r.types.importDefaultSpecifier(r.types.identifier(w)):r.types.importSpecifier(r.types.identifier(w),r.types.identifier(T))),r.types.stringLiteral(E)))}if(f&&d.delegatedEvents.size>0){h.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("delegateEvents"),r.types.identifier("delegateEvents"))],r.types.stringLiteral(L==="imperative"?C:"@fluixi/jsx")));let S=r.types.arrayExpression(Array.from(d.delegatedEvents).map(v=>r.types.stringLiteral(v))),E=r.types.expressionStatement(r.types.callExpression(r.types.identifier("delegateEvents"),[S]));g.node.body.unshift(E)}if(p&&d.staticElements.size>0){let S=[];d.staticElements.forEach((E,v)=>{S.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(r.types.identifier(v),E)]))}),g.node.body.unshift(...S)}if(M.length>0&&g.node.body.unshift(...M),d.staticTemplates.size>0){let S=[];for(let[E,v]of d.staticTemplates){let T=E.startsWith("svg:")?E.slice(4):E;S.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(r.types.identifier(v),r.types.stringLiteral(T))]))}g.node.body.unshift(...S)}}h.length>0&&g.node.body.unshift(...mr(h))}},JSXElement(g,d){if(d.hasJSX=!0,L==="imperative"&&q==="ir"){g.replaceWith(At(g.node,d));return}let h=g.node,M=h.openingElement;if(r.types.isJSXIdentifier(M.name)&&ge.has(M.name.name)&&!d.componentResolver?.resolve(M.name.name)&&(d.controlFlowComponents.add(M.name.name),d.needsControlFlowImport=!0),r.types.isJSXIdentifier(M.name)&&he.has(M.name.name)&&(d.controlFlowComponents.add(M.name.name),x)){let E=Mr(h,d);if(E){g.replaceWith(E);return}}if(p&&L!=="imperative"&&Yt(h,d)){let E=kr(h,d);if(E){g.replaceWith(E);return}}let S=lr(h,d,{runtime:n,pragma:o,development:a,detectReactivity:l,useLitHTML:c,autoShow:nt});g.replaceWith(S)},JSXFragment(g,d){if(d.hasJSX=!0,L==="imperative"&&q==="ir"){g.replaceWith(At(g.node,d));return}let h=xe(g.node,d,{runtime:n,pragmaFrag:s,development:a});g.replaceWith(h)},CallExpression(g,d){if(!l)return;let h=g.node.callee;h.name,r.types.isIdentifier(h)&&(h.name==="createSignal"||h.name==="createStore"||h.name==="useContext"||h.name==="useLocation")&&(d.hasReactivity=!0)},JSXExpressionContainer(g){},TaggedTemplateExpression(g,d){if(mn&&L==="imperative"&&r.types.isIdentifier(g.node.tag)&&(g.node.tag.name===fn||g.node.tag.name==="svg")){g.replaceWith(gr(g.node,d));return}}}}});cr=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"])});var Qt=b(()=>{"use strict"});var en={};at(en,{babelPluginReactiveJSX:()=>$r,createPlugin:()=>Jr,createPreset:()=>Ee,default:()=>W,presets:()=>Pr});function Jr(e){return[W,e]}function Ee(e={}){return{plugins:[[W,{runtime:"automatic",importSource:"@fluixi/jsx",development:!1,detectReactivity:!0,useLitHTML:!0,hoistStatics:!0,delegateEvents:!0,optimizeControlFlow:!0,sourceMaps:!0,...e}]]}}var $r,Pr,tn=b(()=>{"use strict";He();Qt();He();$r=W;Pr={production:Ee({development:!1,hoistStatics:!0,delegateEvents:!0,optimizeControlFlow:!0}),development:Ee({development:!0,hoistStatics:!1,sourceMaps:!0}),minimal:Ee({detectReactivity:!1,useLitHTML:!1,hoistStatics:!1,delegateEvents:!1,optimizeControlFlow:!1})}});var Br={};at(Br,{analyzeProp:()=>Se,analyzeProps:()=>ve,createBabelPlugin:()=>U,createESBuildPlugin:()=>pn,createRollupPlugin:()=>cn,createTypeScriptTransformer:()=>sn,createVitePlugin:()=>an,createWebpackLoader:()=>ln,default:()=>zr,generateChildrenCode:()=>Ge,generateCreateElement:()=>rn,generateEventDelegation:()=>Qe,generateLitHTMLTemplate:()=>Ze,generatePropsCode:()=>qe,hoistStatic:()=>Ye,isLitTemplate:()=>nn,optimizeSpreads:()=>on,optimizeStatic:()=>Ke,serverFunctionsVitePlugin:()=>_r,shouldUseLitTemplate:()=>Ue,transform:()=>A,transformServerFunctions:()=>ae});module.exports=yn(Br);var ct=require("@babel/core"),bn="@fluixi/start/server-fn";function Rn(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)}function Cn({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||bn)))}},"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression":(t,n)=>{let i=t.node.body;if(!e.isBlockStatement(i))return;let s=(i.directives||[]).findIndex(u=>u.value.value==="use server");if(s<0)return;i.directives.splice(s,1);let a=(n.opts.filename||n.filename||"unknown").replace(n.opts.root?n.opts.root+"/":"",""),l=`${Rn(a)}:${n.fxIndex++}`,c=!!n.opts.ssr,p=c?"$$registerServerFn":"$$createServerReference";n.fxUsed=p;let f=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,f)])):t.replaceWith(f),t.skip()}}}}function ae(e,t){if(!e.includes("use server"))return null;let n=(0,ct.transformSync)(e,{filename:t.filename,configFile:!1,babelrc:!1,sourceMaps:!0,parserOpts:{plugins:["typescript","jsx"]},plugins:[[Cn,t]]});return n?.code?{code:n.code,map:n.map}:null}var be=require("node:fs"),et=require("node:path"),jr=new Set(["key","ref","children"]),Fr=[/\(\)\s*=>/,/function\s*\(\)/,/\w+\(\)/,/\w+\.\w+/,/\w+\[.+\]/,/createSignal/,/createStore/,/createMemo/,/createEffect/],Xr=/^on[A-Z]/;function Se(e,t){let n={name:e,isStatic:!0,isReactive:!1,isEvent:Xr.test(e),isRef:e==="ref",isSpread:e.startsWith("...")};if(jr.has(e))return n;if(n.isEvent||n.isRef)return n.isStatic=!1,n;if(typeof t=="string"){let i=t;for(let o of Fr)if(o.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 ve(e){let t=new Map;for(let[n,i]of Object.entries(e))t.set(n,Se(n,i));return t}function Ue(e,t,n){if(typeof e!="string")return!1;let i=ve(t);for(let o of i.values()){if(o.isSpread)return!1;o.isReactive&&o.isEvent}return!0}function nn(e){return e&&typeof e=="object"&&"_$litType$"in e}function rn(e,t,n,i={}){let o=["svg","path","circle","rect","g"].includes(e),s=qe(t,i),a=n.length>0?`, ${Ge(n)}`:"";return i.useLitHTML!==!1&&Ue(e,t,n)?Ze(e,t,n,o):`jsx('${e}', ${s}${a})`}function qe(e,t={}){if(Object.keys(e).length===0)return"{}";let n=ve(e),i=[];for(let[o,s]of Object.entries(e)){let a=n.get(o);a.isReactive&&!a.isStatic?i.push(`${o}: () => ${s}`):typeof s=="string"?i.push(`${o}: "${s}"`):typeof s=="number"||typeof s=="boolean"?i.push(`${o}: ${s}`):i.push(`${o}: ${s}`)}return`{ ${i.join(", ")} }`}function Ge(e){return e.length===0?"undefined":e.length===1?String(e[0]):`[${e.join(", ")}]`}function Ze(e,t,n,i=!1){let o=i?"svg":"html",s=`<${e}`,a=[];for(let[l,c]of Object.entries(t)){if(l==="children"||l==="key"||l==="ref")continue;let p=Se(l,c);if(p.isEvent){let f=l.slice(2).toLowerCase();s+=` @${f}=\${${a.length}}`,a.push(String(c))}else p.isReactive?(s+=` ${l}=\${${a.length}}`,a.push(`signal(() => ${c})`)):typeof c=="string"?s+=` ${l}="${c}"`:(s+=` ${l}=\${${a.length}}`,a.push(String(c)))}if(s+=">",n.length>0)for(let l of n)typeof l=="string"?s+=l:(s+=`\${${a.length}}`,a.push(String(l)));return s+=`</${e}>`,`${o}\`${s}\`${a.length>0?`, ${a.join(", ")}`:""}`}function Ke(e){return e=e.replace(/jsx\('([^']+)',\s*{},\s*"([^"]+)"\s*\)/g,(t,n,i)=>`_$staticNode('${n}', '${i}')`),e}function on(e){return e}function Ye(e){let t=[],n=0;return e=e.replace(/jsx\('([^']+)',\s*{([^}]*)},\s*([^)]*)\)/g,(i,o,s,a)=>{if(!s.includes("()")&&!s.includes("=>")){let l=`_$static${n++}`;return t.push(`const ${l} = ${i};`),l}return i}),t.length>0?t.join(`
1
+ "use strict";var Cn=Object.create;var ue=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var kn=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var I=(e,t)=>()=>(e&&(t=e(e=0)),t);var dt=(e,t)=>{for(var n in t)ue(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of In(t))!Nn.call(e,o)&&o!==n&&ue(e,o,{get:()=>t[o],enumerable:!(i=wn(t,o))||i.enumerable});return e};var de=(e,t,n)=>(n=e!=null?Cn(kn(e)):{},ft(t||!e||!e.__esModule?ue(n,"default",{value:e,enumerable:!0}):n,e)),Mn=e=>ft(ue({},"__esModule",{value:!0}),e);function gt(e,t){return e.replace(/\$(\d+)/g,(n,i)=>t[Number(i)]??n)}function jn(e,t){return typeof t=="string"?{module:t,export:e}:t}function me(e=[]){let t=new Map,n=[],i=[];for(let a of e){if(!Jn(a)){i.push(a);continue}for(let[l,c]of Object.entries(a.components)){let p=jn(l,c),d=t.get(l);if(d&&d.module!==p.module){let u=n.find(g=>g.name===l);u?u.modules.push(p.module):n.push({name:l,modules:[d.module,p.module]});continue}t.set(l,p)}}let o=new Map;return{resolve:a=>{if(o.has(a))return o.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:gt(c.module,p),export:c.export?gt(c.export,p):a};break}}return o.set(a,l),l},names:()=>[...t.keys()],conflicts:()=>n}}var Jn,Le=I(()=>{"use strict";Jn=e=>"components"in e});function ge(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:n="@fluixi/core",routerModule:i="@fluixi/core/router-next"}=e,o={};for(let s of te)o[s]=t;for(let s of q)o[s]=n;for(let s of Z)o[s]=i;return o}var te,q,Z,ai,Je,he=I(()=>{"use strict";te=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],q=["Suspense","SuspenseList","Await"],Z=["Router","Outlet","Redirect","Link"],ai=[...te,...q,...Z],Je=new Set([...te,...q])});function ne(e){return e.startsWith("load:")}function K(e,t){let n=e.slice(5);if(!yt.has(n))throw new O(`Unknown load strategy 'load:${n}'. Expected one of ${[...yt].join(", ")}.`);switch(n){case"eager":return V;case"idle":return{kind:"idle"};case"never":return{kind:"never"};case"visible":return t?{kind:"visible",rootMargin:t}:{kind:"visible"};case"interaction":return{kind:"interaction",events:t?zn(t):[...Bn]};case"media":if(!t)throw new O(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new O(`Unhandled load strategy '${n}'.`)}}function zn(e){let t=e.split(/[\s,]+/).map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new O("'load:interaction' was given no event names.");return t}function D(e){return e.kind!=="eager"&&e.kind!=="never"}var V,Bn,yt,O,Y=I(()=>{"use strict";V={kind:"eager"},Bn=["pointerdown","focusin","keydown"],yt=new Set(["eager","idle","visible","interaction","media","never"]),O=class extends Error{}});function je(e,t={}){let{resolver:n,isBound:i,modules:o,strategyFor:s}=t,a=ge(o),l=new Map,c=new Set,p=u=>{let{name:g}=u;if(!g||g.includes(".")||i?.(g))return;let C=d(g);if(!C){c.add(g);return}let b=C.origin==="builtin"&&Je.has(g)?V:s?.(u)??V;u.source={...C,loading:b},l.set(g,u.source)},d=u=>{if(Je.has(u))return{module:a[u],export:u,origin:"builtin"};let g=n?.resolve(u);if(g)return{module:g.module,export:g.export,origin:"rule"};if(Z.includes(u))return{module:a[u],export:u,origin:"builtin"}};return xe(e,u=>{u.kind==="component"&&p(u)}),{resolved:l,unresolved:[...c]}}function xe(e,t){let n=Array.isArray(e)?e:[e];for(let i of n){t(i);let o=i.children;o&&xe(o,t)}}var Pe=I(()=>{"use strict";he();Y()});function Oe(e){let t=[];xe(e,s=>{s.kind==="component"&&s.source&&t.push(s)});let n=new Set,i=new Set;for(let s of t){let{module:a,loading:l}=s.source;l.kind==="eager"&&n.add(a),l.kind==="never"&&i.add(a)}let o=new Map;for(let s of t){let a=s.source;D(a.loading)&&n.has(a.module)&&(a.loading={kind:"eager"},o.set(a.module,(o.get(a.module)??0)+1))}return{collapsed:o,conflicted:[...i].filter(s=>n.has(s))}}var bt=I(()=>{"use strict";Y();Pe()});function Ae(e){return Hn.has(e)}function Ct(e){return Rt[e]??e}function re(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!Vn.has(e.name)}function Fe(e){if(!e.static||Ae(e.tag))return!1;for(let t of e.props)if(!re(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Fe(t)))return!1;return!0}function ie(e){let t=e.props.map(Un).filter(Boolean).join(""),n=`<${e.tag}${t}>`;return Wn.has(e.tag)?n:`${n}${e.children.map(Gn).join("")}</${e.tag}>`}function Gn(e){if(e.kind==="text")return Zn(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return ie(e)}function Un(e){let t=Rt[e.name]??e.name,n=e.literal;return n===!0||n===void 0?` ${t}`:n===!1||n===null?"":` ${t}="${qn(String(n))}"`}function qn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zn(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Wn,Rt,Vn,Hn,Xe=I(()=>{"use strict";Wn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rt={className:"class",htmlFor:"for"},Vn=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),Hn=new Set(["script","style","textarea","title"])});function Se(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"}function Qn(e){return e.kind==="text"||e.kind==="element"&&wt(e)}function wt(e){return e.svg||Ae(e.tag)||!e.props.every(t=>re(t))?!1:e.children.every(t=>Qn(t)||Se(t))}function Ee(e){if(Se(e))return!0;let t=e.children;return t?t.some(Ee):!1}function It(e){for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.kind==="text"&&(n.value===""||e.children[t+1]?.kind==="text"))return!1}return e.children.every(t=>t.kind!=="element"||It(t))}function kt(e){if(!wt(e)||!It(e)||!e.children.some(Ee))return null;let t=[],n=[],i=0,o=a=>{let l=`_n$${i++}`;return t.push({ref:l,expr:a}),l};return s(e,"_el$"),{html:er(e),tag:e.tag,steps:t,holes:n};function s(a,l){let c=-1;a.children.forEach((d,u)=>{Ee(d)&&(c=u)});let p=null;for(let d=0;d<=c;d++){let u=a.children[d],g=p?`${p}.nextSibling`:`${l}.firstChild`;if(Se(u)){let b=o(g),w=o(`holeEnd(${b})`);n.push({parentRef:l,startRef:b,endRef:w,node:u}),p=w;continue}let C=o(g);u.kind==="element"&&Ee(u)&&s(u,C),p=C}}}function er(e){return ie(Nt(e)).split(Mt).join(Kn+Yn)}function Nt(e){return{...e,children:e.children.map(t=>Se(t)?{kind:"text",value:Mt}:t.kind==="element"?Nt(t):t)}}var Kn,Yn,Mt,Tt=I(()=>{"use strict";Xe();Kn="<!--fx-->",Yn="<!--fx/-->";Mt="\0fx-hole\0"});var De,Ci,$t=I(()=>{"use strict";De={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Ci={version:2,module:"@fluixi/dom",symbols:[...De.symbols,"template","cloneTemplate","walk"]}});function nr(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Jt(e){return nr(e)?e:JSON.stringify(e)}function rr(e){return e.expr!==void 0?e.reactive?`() => (${e.expr})`:`(${e.expr})`:JSON.stringify(e.literal??!0)}function ir(e){return e.expr!==void 0?`(${e.expr})`:JSON.stringify(e.literal??!0)}function or(e,t,n){let i=e.filter(l=>l.kind==="spread"),s=e.filter(l=>l.kind!=="spread").map(l=>`${Jt(l.name)}: ${rr(l)}`);t!=null&&s.push(`children: ${t}`);let a=`{ ${s.join(", ")} }`;return i.length>0?(n.add("mergeProps"),`mergeProps(${i.map(l=>l.expr).join(", ")}, ${a})`):a}function jt(e,t,n){return e.length===1?oe(e[0],t,n):`[${e.map(i=>oe(i,t,n)).join(", ")}]`}function Lt(e,t,n,i,o){i.add("createMemo"),i.add("createComponent");let s=t.filter(p=>p.kind==="spread"),l=t.filter(p=>p.kind!=="spread").map(p=>`get ${Jt(p.name)}() { return ${ir(p)}; }`);n.length>0&&l.push(`get children() { return ${jt(n,i,o)}; }`);let c=`{ ${l.join(", ")} }`;return s.length>0&&(i.add("mergeProps"),c=`mergeProps(${s.map(p=>p.expr).join(", ")}, ${c})`),`createMemo(() => createComponent(${e}, ${c}))`}function sr(e,t){let n=Ct(t.name),i=t.literal;return i===!0||i===void 0?`${e}.setAttribute(${JSON.stringify(n)}, "");`:i===!1||i===null?"":`${e}.setAttribute(${JSON.stringify(n)}, ${JSON.stringify(String(i))});`}function oe(e,t,n){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":jt(e.children,t,n);case"component":return Lt(e.name,e.props,e.children,t,n);case"control":{let i=tr[e.control]??e.control;return t.add(i),Lt(i,e.props,e.children,t,n)}case"element":{if(n&&e.static&&!e.svg&&Fe(e)){t.add("templateNode");let l=`_tmpl$${n.length}`;return n.push({id:l,html:ie(e),tag:e.tag,svg:!1}),`templateNode(${l}, ${JSON.stringify(e.tag)})`}if(n&&Pt){let l=kt(e);if(l){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let c=`_tmpl$${n.length}`;n.push({id:c,html:l.html,tag:l.tag,svg:!1});let p=[`const _el$ = templateNode(${c}, ${JSON.stringify(l.tag)}, true);`];for(let d of l.steps)p.push(`const ${d.ref} = ${d.expr};`);for(let d of l.holes)p.push(`insert(${d.parentRef}, holeScope(${d.startRef}, () => (${oe(d.node,t,n)})), ${d.endRef}, holeContent(${d.startRef}, ${d.endRef}));`);return p.push("return _el$;"),`(() => { ${p.join(" ")} })()`}}t.add("createNativeElement");let i=JSON.stringify(e.tag),o="_el$",s=[],a=e.svg?`${i}, true`:i;if(s.push(`const ${o} = createNativeElement(${a});`),e.props.length>0)if(!e.svg&&e.props.every(re))for(let l of e.props)s.push(sr(o,l));else{t.add("spread");let l=e.svg?", isSVG: true":"";s.push(`spread({ element: ${o}, props: ${or(e.props,null,t)}${l} });`)}for(let l of e.children){t.add("insert");let c=oe(l,t,n),p=l.kind==="expr"&&l.reactive||l.kind==="component"||l.kind==="control";s.push(p?`insert(${o}, ${c}, null);`:`insert(${o}, ${c});`)}return s.push(`return ${o};`),`(() => { ${s.join(" ")} })()`}}}function se(e,t){if(!t||t.length===0)return e;let n=new Map(t.map(i=>[i.id,JSON.stringify(i.html)]));return e.replace(/_tmpl\$\d+/g,i=>n.get(i)??i)}var tr,Pt,_,ve=I(()=>{"use strict";Tt();Xe();$t();tr={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};Pt=!1;_={name:"imperative",contract:De,emit(e,t){let n=new Set,i=t?.templateClone!==!1?[]:void 0;return Pt=t?.partialTemplates===!0,{code:oe(e,n,i),imports:Array.from(n),templates:i}}}});function lr(e){return ar(e,{concise:!0}).code}function cr(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function At(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xt(e,t,n={}){let i=e.quasi,o=i.expressions.map(l=>{let c=l;return{node:c,code:B(c,t),reactive:L(c)}}),s=pr(i),{root:a}=(0,Ft.parseTemplate)(s,{svg:n.svg});return new Be(o,t).lowerRoot(a.children)}function pr(e){let t=[];return e.quasis.forEach((n,i)=>{let o=n.value.cooked??n.value.raw;if(t.push({kind:"static",text:o,start:n.start??0}),i<e.expressions.length){let s=e.expressions[i];t.push({kind:"hole",index:i,start:s.start??0,end:s.end??0})}}),t}var ae,_e,Ft,ar,Ot,Be,Dt=I(()=>{"use strict";ae=require("@babel/core"),_e=de(require("@babel/generator"),1),Ft=require("@fluixi/template-parser");Y();ve();ze();ar=_e.default.default??_e.default;Ot=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);Be=class{constructor(t,n){this.holes=t;this.used=n}hole(t){return this.holes[t]??{node:ae.types.identifier("undefined"),code:"undefined",reactive:!1}}emit(t){let{code:n,imports:i,templates:o}=_.emit(t,{});for(let s of i)this.used.add(s);return se(n,o)}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 o=t[i];if(o.kind==="Element"||o.kind==="Component"){let a=o.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(d=>d.kind==="ElseDirective");n.push(this.lowerIf(o,a.hole,p?c:null)),p&&(i=l);continue}if(o.attributes.some(l=>l.kind==="EachDirective")){n.push(this.lowerEach(o));continue}}let s=this.lowerNode(o);s&&n.push(s)}return n}isBlankText(t){return t.kind==="Text"&&!t.raw&&ye(t.value)===""}lowerNode(t){switch(t.kind){case"Text":{if(t.raw)return{kind:"text",value:t.value};let n=ye(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(s=>s!==n),o=this.lowerComponent({...t,kind:"Component",tag:"Dynamic",tagHole:null,attributes:i});return o.props.unshift({name:"component",kind:"attr",expr:`() => (${this.hole(n.value.hole).code})`}),o}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:o,rest:s}=this.partitionSlots(t.children);for(let[c,p]of o){let d=p.length===1?p[0]:{kind:"fragment",children:p},u={name:c,kind:"attr",expr:this.emit(d),jsxElement:!0},g=i.findIndex(C=>C.name===c);g>=0?i[g]=u:i.push(u)}let a=t.attributes.find(c=>c.kind==="LoadDirective"),l=a?K(`load:${a.strategy}`,a.modifier):void 0;return{kind:"component",name:n,props:i,children:this.lowerChildren(s),...l?{load:l}:{}}}partitionSlots(t){let n=new Map,i=[];for(let o of t){if(o.kind==="Element"||o.kind==="Component"){let s=o.attributes.find(a=>a.kind==="Attribute"&&a.name==="slot");if(s&&s.value&&s.value.kind==="static"){let a={...o,attributes:o.attributes.filter(p=>p!==s)},l=a.kind==="Element"?this.lowerElement(a):this.lowerComponent(a),c=n.get(s.value.value)??[];c.push(l),n.set(s.value.value,c);continue}}i.push(o)}return{slots:n,rest:i}}lowerIf(t,n,i){let o=this.hole(n),s=[{name:"when",kind:"attr",expr:o.code,reactive:o.reactive}];if(i){let l=this.stripAndLower(i,c=>c.kind==="ElseDirective");s.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:s,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),o=[{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;o.push({name:"by",kind:"attr",expr:c})}let s=this.itemArrow(t),a;if(s){let c=s.body,p={kind:"expr",code:B(c,this.used),reactive:L(c)},d=this.rebuildWithChildren(t,[p]);a=`(${s.params.map(u=>lr(u)).join(", ")}) => (${this.emit(d)})`}else{let c=this.stripAndLower(t,p=>p.kind==="EachDirective");a=`() => (${this.emit(c)})`}return{kind:"component",name:"For",props:o,children:[{kind:"expr",code:a,reactive:!1}]}}itemArrow(t){let n=t.children.filter(o=>!this.isBlankText(o));if(n.length!==1||n[0].kind!=="Expression")return null;let i=this.hole(n[0].hole).node;return ae.types.isArrowFunctionExpression(i)&&!ae.types.isBlockStatement(i.body)?i:null}stripAndLower(t,n){let i={...t,attributes:t.attributes.filter(o=>!n(o))};return i.kind==="Element"?this.lowerElement(i):this.lowerComponent(i)}rebuildWithChildren(t,n){let i=this.lowerAttributes(t.attributes.filter(o=>o.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=[],o=!1,s=[],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}`),o=o||p.reactive;break}case"StyleDirective":{let p=this.hole(c.hole);s.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:o}),s.length>0&&n.push({name:"style",kind:"attr",expr:`{ ${s.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"+At(t.name),kind:"event",event:{name:n,delegated:Ot.has(n)},expr:i};let s=this.wrapHandler(i,t.modifiers),a=this.eventOptions(t.modifiers),l=a?`[${s}, ${a}]`:s;return{name:"on:"+n,kind:"attr",expr:l}}wrapHandler(t,n){let i=n.includes("self")?"if (e.target !== e.currentTarget) return; ":"",o=[];return n.includes("prevent")&&o.push("e.preventDefault();"),n.includes("stop")&&o.push("e.stopPropagation();"),!i&&o.length===0?t:`(e) => { ${i}${o.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",o=i?"change":"input",s=i?"checked":"value",a=`(${n})`;return[{name:t,kind:"attr",expr:`${a}[0]()`,reactive:!0},{name:"on"+At(o),kind:"event",event:{name:o,delegated:Ot.has(o)},expr:`(e) => ${a}[1](e.target.${s})`}]}plainAttr(t){let n=t.value,i=t.name;t.name==="class"?i=n&&n.kind==="hole"&&ae.types.isObjectExpression(this.hole(n.hole).node)?"classList":"className":t.name==="html"&&(i="innerHTML");let s={name:i,kind:"attr"};if(n==null)return s.literal=!0,s;if(n.kind==="static")return s.literal=n.value,s;if(n.kind==="hole"){let c=this.hole(n.hole);return s.expr=c.code,s.reactive=c.reactive,s}let a=!1,l=n.parts.map(c=>{if("text"in c)return cr(c.text);let p=this.hole(c.hole);return a=a||p.reactive,"${"+p.code+"}"}).join("");return s.expr="`"+l+"`",s.reactive=a,s}}});function ur(e){switch(e.kind){case"event":return"event";case"ref":return"ref";case"spread":return"spread";case"class":case"style":return"class-or-style-directive";case"attr":case"prop":return e.reactive?"reactive-prop":e.expr!==void 0?"expression-prop":void 0;default:return"expression-prop"}}function be(e){let t=[],n=new Map,i=o=>{switch(o.kind){case"text":return!0;case"expr":return!1;case"component":case"control":for(let s of o.children)i(s);return!1;case"fragment":for(let s of o.children)i(s);return!1;case"element":{let s=!0;for(let l of o.children)i(l)||(s=!1);let a;for(let l of o.props)if(a=ur(l),a)break;return!a&&!s&&(a=dr(o)),o.static=!a,a?n.set(o,a):t.push(o),o.static}default:return!1}};for(let o of Array.isArray(e)?e:[e])i(o);return{staticElements:t,reasons:n}}function dr(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="control")return"control-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var We=I(()=>{"use strict"});function Re(e,t=new Set,n={}){let i=Xt(e,t,n);return be(i),i}var Ve=I(()=>{"use strict";Dt();We()});function zt(e){return fr(e,{concise:!0}).code}function mr(e,t){let n=m.types.cloneNode(e,!0),i=m.types.file(m.types.program([m.types.expressionStatement(n)])),o=!1,s=(a,l,c)=>{for(let p of c)t.add(p);a.replaceWith(m.template.expression(l,{placeholderPattern:!1,plugins:["typescript"]})()),a.skip(),o=!0};return(0,m.traverse)(i,{"JSXElement|JSXFragment"(a){let l=a.node,{code:c,imports:p,templates:d}=_.emit(qe(l,t),{});s(a,se(c,d),p)},TaggedTemplateExpression(a){let l=a.node.tag;if(!m.types.isIdentifier(l)||l.name!=="html"&&l.name!=="svg")return;let c=Re(a.node,t,{svg:l.name==="svg"}),{code:p,imports:d,templates:u}=_.emit(c,{});s(a,se(p,u),d)}}),o?i.program.body[0].expression:e}function B(e,t){return zt(mr(e,t))}function Er(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:zt(e),component:!0}:m.types.isJSXNamespacedName(e)?{tag:`${e.namespace.name}:${e.name.name}`,component:!1}:{tag:"div",component:!1}}function Ue(e){return m.types.isJSXIdentifier(e)?e.name==="class"?"className":e.name:m.types.isJSXNamespacedName(e)?`${e.namespace.name}:${e.name.name}`:"unknown"}function L(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)?L(e.test)||L(e.consequent)||L(e.alternate):m.types.isLogicalExpression(e)||m.types.isBinaryExpression(e)?L(e.left)||L(e.right):m.types.isTemplateLiteral(e)?e.expressions.some(t=>L(t)):m.types.isObjectExpression(e)?e.properties.some(t=>m.types.isObjectProperty(t)&&!t.computed&&L(t.value)):m.types.isArrayExpression(e)?e.elements.some(t=>t!=null&&!m.types.isSpreadElement(t)&&L(t)):!1}function Sr(e,t){let n=Ue(e.name),i=hr.test(n),o=i||n.startsWith("on:"),a={name:n,kind:i?"event":"attr"};i&&(a.event={name:n.slice(2).toLowerCase(),delegated:xr.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=B(c,t),a.reactive=o?!1:L(c),(m.types.isJSXElement(c)||m.types.isJSXFragment(c))&&(a.jsxElement=!0),a)}return a.literal=!0,a}function _t(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)?B(n.expression,t):null}function vr(e,t){let n=[],i=[];for(let o of e){if(m.types.isJSXSpreadAttribute(o)){n.push({name:"",kind:"spread",expr:B(o.argument,t)});continue}if(!m.types.isJSXAttribute(o)||ne(Ue(o.name)))continue;let s=m.types.isJSXNamespacedName(o.name)?o.name.namespace.name:null;if(s==="use"){let a=o.name.name.name;t.add(a);let l=_t(o,t);i.push(l!=null?`[${a}, () => (${l})]`:`[${a}]`);continue}if(s==="oncapture"){let a=o.name.name.name.toLowerCase(),l=_t(o,t)??"undefined";n.push({name:"on:"+a,kind:"attr",expr:`[${l}, { capture: true }]`});continue}n.push(Sr(o,t))}return i.length>0&&n.push({name:"use",kind:"attr",expr:`[${i.join(", ")}]`}),n}function ye(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let o=0;o<t.length;o++)/[^ \t]/.test(t[o])&&(n=o);let i="";for(let o=0;o<t.length;o++){let s=t[o].replace(/\t/g," ");o!==0&&(s=s.replace(/^ +/,"")),o!==t.length-1&&(s=s.replace(/ +$/,"")),s&&(o!==n&&(s+=" "),i+=s)}return i}function Bt(e,t){let n=[];for(let i of e)if(m.types.isJSXText(i)){let o=ye(i.value);o&&n.push({kind:"text",value:o})}else if(m.types.isJSXExpressionContainer(i)){if(!m.types.isJSXEmptyExpression(i.expression)){let o=i.expression;n.push({kind:"expr",code:B(o,t),reactive:L(o)})}}else m.types.isJSXElement(i)||m.types.isJSXFragment(i)?n.push(Ge(i,t)):m.types.isJSXSpreadChild(i)&&n.push({kind:"expr",code:B(i.expression,t),reactive:!1});return n}function qe(e,t=new Set){let n=Ge(e,t);return be(n),n}function Ge(e,t){if(m.types.isJSXFragment(e))return{kind:"fragment",children:Bt(e.children,t)};let{tag:n,component:i}=Er(e.openingElement.name),o=vr(e.openingElement.attributes,t),s=Bt(e.children,t);if(i){let a=yr(e.openingElement.attributes);return{kind:"component",name:n,props:o,children:s,...a?{load:a}:{}}}return{kind:"element",tag:n,svg:gr.has(n),props:o,children:s,static:!1}}function yr(e){for(let t of e){if(!m.types.isJSXAttribute(t))continue;let n=Ue(t.name);if(ne(n)){if(t.value&&!m.types.isStringLiteral(t.value))throw new O(`'${n}' needs a literal value, not an expression — the strategy is compile-time.`);return K(n,t.value?t.value.value:null)}}}var m,He,fr,gr,hr,xr,ze=I(()=>{"use strict";m=require("@babel/core"),He=de(require("@babel/generator"),1);ve();Ve();We();Y();fr=He.default.default??He.default;gr=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),hr=/^on[A-Z]/,xr=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"])});function Rr(e,t,n){let{runtime:i,pragma:o,development:s,autoShow:a=!0}=n;return i==="automatic"?ce(e,t,s,a):Jr(e,t,o)}function Vt(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 Yt(e){return e.length===1?e[0]:r.types.arrayExpression(e)}function wr(e,t,n,i,o,s){if(!t){let u=[...n];return o.length>0&&u.push(r.types.objectMethod("get",r.types.identifier("children"),[],r.types.blockStatement([r.types.returnStatement(Yt(o))]))),Qt(e,Vt(u,i,s),s)}let a=e.value,l=Cr.has(a),c=r.types.identifier("_el$"),p=[];s.needsCreateNativeElement=!0;let d=[e];if(l&&d.push(r.types.booleanLiteral(!0)),p.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(c,r.types.callExpression(r.types.identifier("createNativeElement"),d))])),n.length>0||i.length>0){s.needsSpread=!0;let u=[r.types.objectProperty(r.types.identifier("element"),c),r.types.objectProperty(r.types.identifier("props"),Vt(n,i,s))];l&&u.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(u)])))}if(o.length>0){s.needsInsert=!0;for(let u of o){let C=r.types.isArrowFunctionExpression(u)||r.types.isFunctionExpression(u)||r.types.isCallExpression(u)&&r.types.isIdentifier(u.callee)&&u.callee.name==="createMemo"?[r.types.cloneNode(c),u,r.types.nullLiteral()]:[r.types.cloneNode(c),u];p.push(r.types.expressionStatement(r.types.callExpression(r.types.identifier("insert"),C)))}}return p.push(r.types.returnStatement(c)),r.types.callExpression(r.types.arrowFunctionExpression([],r.types.blockStatement(p)),[])}function Ir(e,t){let n=null;if(t.value)if(r.types.isStringLiteral(t.value))n=t.value.value;else throw new O(`'${e}' needs a literal value, not an expression — the strategy is compile-time.`);return K(e,n)}function kr(e){let t=[r.types.objectProperty(r.types.identifier("kind"),r.types.stringLiteral(e.kind))];return e.kind==="visible"&&e.rootMargin&&t.push(r.types.objectProperty(r.types.identifier("rootMargin"),r.types.stringLiteral(e.rootMargin))),e.kind==="interaction"&&t.push(r.types.objectProperty(r.types.identifier("events"),r.types.arrayExpression(e.events.map(n=>r.types.stringLiteral(n))))),e.kind==="media"&&t.push(r.types.objectProperty(r.types.identifier("query"),r.types.stringLiteral(e.query))),r.types.objectExpression(t)}function Nr(e,t){return!D(e)||!D(t)?V:e}function Qt(e,t,n){r.types.isIdentifier(e)&&we.has(e.name)&&(n.controlFlowComponents.add(e.name),n.needsControlFlowImport=!0);let i=!1;if(r.types.isIdentifier(e)&&!we.has(e.name)&&n.componentResolver){let o=n.componentResolver.resolve(e.name);if(o){let s=n.pendingLoad??V,a=n.resolvedComponents.has(e.name);if(D(s)&&!a){let l=n.deferredComponents.get(e.name),c=l?Nr(l.strategy,s):s;D(c)?n.deferredComponents.set(e.name,{...o,strategy:c}):(n.deferredComponents.delete(e.name),n.resolvedComponents.set(e.name,o))}else n.deferredComponents.delete(e.name),n.resolvedComponents.set(e.name,o);i=!0}}return n.pendingLoad=void 0,!i&&r.types.isIdentifier(e)&&Ce.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 en(e,t,n){if(!t||t.length===0)return e;let i=new Map;for(let o of t){let s=`${o.svg?"svg:":""}${o.html}`,a=n.staticTemplates.get(s);a||(a=`_tmpl$${n.staticTemplates.size}`,n.staticTemplates.set(s,a)),i.set(o.id,a)}return e.replace(/_tmpl\$\d+/g,o=>i.get(o)??o)}function Ht(e,t){let n=new Set,i=qe(e,n);je(i,{resolver:t.componentResolver,modules:{controlFlowModule:t.controlFlowModule,coreModule:t.libModule,routerModule:t.routerModule},strategyFor:c=>c.load}),Oe(i);let{code:o,imports:s,templates:a}=_.emit(i,{templateClone:t.templateClone,partialTemplates:t.partialTemplates});for(let c of s)n.add(c);for(let c of n)t.irImports.add(c);Ke(i,t);let l=en(o,a,t);return r.template.expression(l,{placeholderPattern:!1,plugins:["typescript"]})()}function Mr(e){let t=new Map,n=[];for(let i of e){let o=i.source.value;if(!i.specifiers.every(l=>r.types.isImportSpecifier(l))){n.push(i);continue}let a=t.get(o);if(!a){let l=new Set(i.specifiers.map(c=>c.local.name));t.set(o,{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 Tr(e,t){let n=new Set,i=r.types.isIdentifier(e.tag)&&e.tag.name==="svg",o=Re(e,n,{svg:i});je(o,{resolver:t.componentResolver,modules:{controlFlowModule:t.controlFlowModule,coreModule:t.libModule,routerModule:t.routerModule},strategyFor:p=>p.load}),Oe(o);let{code:s,imports:a,templates:l}=_.emit(o,{templateClone:t.templateClone,partialTemplates:t.partialTemplates});for(let p of a)n.add(p);for(let p of n)t.irImports.add(p);Ke(o,t),t.hasLitIR=!0;let c=r.template.expression(en(s,l,t),{placeholderPattern:!1,plugins:["typescript"]})();return $r(c,e),c}function $r(e,t){if(!t.loc)return;let n=new Set,i=o=>{if(!n.has(o)){n.add(o),o.loc||(o.loc=t.loc,o.start=t.start,o.end=t.end);for(let s of r.types.VISITOR_KEYS[o.type]??[]){let a=o[s];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 Ke(e,t){if(e.kind==="component"&&e.source&&(e.source.origin==="builtin"?(t.controlFlowComponents.add(e.name),t.needsControlFlowImport=!0):D(e.source.loading)&&!t.resolvedComponents.has(e.name)?t.deferredComponents.set(e.name,{module:e.source.module,export:e.source.export,strategy:e.source.loading}):(t.deferredComponents.delete(e.name),t.resolvedComponents.set(e.name,{module:e.source.module,export:e.source.export}))),(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)Ke(n,t)}function Lr(e){return e.map(t=>{if(r.types.isObjectProperty(t)){let n=t.key,i=t.computed,o=t.value;return r.types.objectMethod("get",n,[],r.types.blockStatement([r.types.returnStatement(o)]),i)}return t})}function ce(e,t,n,i=!0){let o=e.openingElement,s=e.children,a=tn(o.name),l=r.types.isJSXIdentifier(o.name)&&/^[a-z]/.test(o.name.name),c=rn(o.attributes,t,l,r.types.isJSXIdentifier(o.name)?o.name.name:""),p=c.props,d=c.spreads;l||(p=Lr(p));let u=Ye(s,t,i);if(t.backend==="imperative")return wr(a,l,p,d,u,t);if(u.length>0){let w=u.length===1?u[0]:r.types.arrayExpression(u);p.push(r.types.objectProperty(r.types.identifier("children"),w))}let g;if(d.length>0){let w=p.length>0?r.types.objectExpression(p):r.types.objectExpression([]);t.needsMergeProps=!0,g=r.types.callExpression(r.types.identifier("mergeProps"),[...d,w])}else g=r.types.objectExpression(p);let C=n?"jsxDEV":u.length>1?"jsxs":"jsx",b=[a,g];return n&&b.push(r.types.identifier("undefined"),r.types.booleanLiteral(!1),r.types.identifier("undefined"),r.types.identifier("undefined")),r.types.callExpression(r.types.identifier(C),b)}function Jr(e,t,n){let i=e.openingElement,o=e.children,s=tn(i.name),a=r.types.isJSXIdentifier(i.name)&&/^[a-z]/.test(i.name.name),{props:l,spreads:c}=rn(i.attributes,t,a,r.types.isJSXIdentifier(i.name)?i.name.name:""),p=Ye(o,t,t.autoShow??!0),d;if(c.length>0){let g=l.length>0?r.types.objectExpression(l):r.types.objectExpression([]);t.needsMergeProps=!0,d=r.types.callExpression(r.types.identifier("mergeProps"),[...c,g])}else d=l.length>0?r.types.objectExpression(l):r.types.nullLiteral();let u=[s,d,...p];return r.types.callExpression(r.types.identifier(n),u)}function Ie(e,t,n){let{runtime:i,pragmaFrag:o,development:s}=n,a=Ye(e.children,t,t.autoShow??!0);if(t.backend==="imperative")return a.length===0?r.types.nullLiteral():Yt(a);if(i==="automatic"){let l=s?"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 s&&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(o),a)}function tn(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)?nn(e):r.types.isJSXNamespacedName(e)?r.types.stringLiteral(`${e.namespace.name}:${e.name.name}`):r.types.stringLiteral("div")}function nn(e){let t;return r.types.isJSXIdentifier(e.object)?t=r.types.identifier(e.object.name):t=nn(e.object),r.types.memberExpression(t,r.types.identifier(e.property.name))}function jr(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}function rn(e,t,n=!0,i=""){let o=[],s=[],a=br[i],l=[];t.pendingLoad=void 0;for(let c of e)if(r.types.isJSXSpreadAttribute(c))s.push(c.argument);else if(r.types.isJSXAttribute(c)){let p=Pr(c.name);if(ne(p)){t.pendingLoad=Ir(p,c);continue}if(r.types.isJSXNamespacedName(c.name)&&c.name.namespace.name==="use"){let M=r.types.identifier(c.name.name.name),W=c.value===null?null:Gt(c.value,t,p,n);l.push(r.types.arrayExpression(W?[M,r.types.arrowFunctionExpression([],W)]:[M]));continue}let d=Gt(c.value,t,p,n);if(Zt.test(p)){let M=p.slice(2).toLowerCase();Kt.includes(M)&&t.delegatedEvents.add(M)}let u=jr(p)?r.types.identifier(p):r.types.stringLiteral(p),g=c.value,C=r.types.isJSXElement(g)||r.types.isJSXFragment(g)||r.types.isJSXExpressionContainer(g)&&(r.types.isJSXElement(g.expression)||r.types.isJSXFragment(g.expression)),b=!n&&p===a,w=r.types.isJSXExpressionContainer(g)&&!r.types.isJSXEmptyExpression(g.expression)?g.expression:null,z=!n&&!!w&&on(w,p);!n&&C||b||z?o.push(r.types.objectMethod("get",u,[],r.types.blockStatement([r.types.returnStatement(d)]))):o.push(r.types.objectProperty(u,d))}return l.length>0&&o.push(r.types.objectProperty(r.types.identifier("use"),r.types.arrayExpression(l))),{props:o,spreads:s}}function Pr(e){return r.types.isJSXIdentifier(e)?e.name==="class"?"className":e.name:r.types.isJSXNamespacedName(e)?`${e.namespace.name}:${e.name.name}`:"unknown"}function Gt(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 o=e.expression;return i&&on(o,n)?r.types.arrowFunctionExpression([],o):o}return r.types.isJSXElement(e)?ce(e,t,!1,t.autoShow??!0):r.types.isJSXFragment(e)?Ie(e,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1}):r.types.booleanLiteral(!0)}function on(e,t){return Zt.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 Or(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let o=0;o<t.length;o++)/[^ \t]/.test(t[o])&&(n=o);let i="";for(let o=0;o<t.length;o++){let s=t[o].replace(/\t/g," ");o!==0&&(s=s.replace(/^ +/,"")),o!==t.length-1&&(s=s.replace(/ +$/,"")),s&&(o!==n&&(s+=" "),i+=s)}return i}function Ye(e,t,n=!0){let i=[];for(let o of e)if(r.types.isJSXText(o)){let s=Or(o.value);s&&i.push(r.types.stringLiteral(s))}else if(r.types.isJSXExpressionContainer(o)){if(!r.types.isJSXEmptyExpression(o.expression)){let s=o.expression;if(n){let a=Ar(s,t)??Fr(s,t);if(a){i.push(a);continue}}else{let a=Xr(s,t);if(a){i.push(a);continue}}_r(s)?i.push(r.types.arrowFunctionExpression([],s)):i.push(s)}}else r.types.isJSXElement(o)?i.push(ce(o,t,!1,t.autoShow??!0)):r.types.isJSXFragment(o)?i.push(Ie(o,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1})):r.types.isJSXSpreadChild(o)&&i.push(o.expression);return i}function Ar(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=A(n.right);if(i)return le(H(n.left),i,null,t)}if(r.types.isConditionalExpression(n)){let i=A(n.consequent);if(i){let o=Qe(n.alternate,t);return le(H(n.test),i,o,t,!0)}}return null}function Fr(e,t){if(r.types.isLogicalExpression(e)&&e.operator==="&&"){let n=A(e.right);if(n)return le(H(e.left),n,null,t)}if(r.types.isConditionalExpression(e)){let n=A(e.consequent);if(n){let i=Qe(e.alternate,t);return le(H(e.test),n,i,t)}}return null}function Xr(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=H(n.test),s=A(n.consequent)??n.consequent,l=A(n.alternate)??n.alternate,c=r.types.conditionalExpression(i,s,l);return Ze(n.consequent)||Ze(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=H(n.left),s=A(n.right)??n.right,a=r.types.logicalExpression("&&",i,s);return Ze(n.right)?null:(t.needsCreateMemo=!0,r.types.callExpression(r.types.identifier("createMemo"),[r.types.arrowFunctionExpression([],a)]))}return null}function Qe(e,t){if(Dr(e))return null;let n=A(e);if(n)return sn(n,t);if(r.types.isConditionalExpression(e)){let i=e,o=A(i.consequent);if(o){let s=Qe(i.alternate,t);return le(H(i.test),o,s,t)}}return e}function Ut(e){return r.types.isJSXElement(e)||r.types.isJSXFragment(e)}function Ze(e){let t=A(e);if(!t||!r.types.isJSXElement(t))return!1;let n=t.openingElement.name;return r.types.isJSXIdentifier(n)&&we.has(n.name)}function A(e){return Ut(e)?e:r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&Ut(e.body)?e.body:null}function H(e){return r.types.isArrowFunctionExpression(e)&&e.params.length===0&&!e.async&&r.types.isExpression(e.body)?e.body:e}function Dr(e){return r.types.isNullLiteral(e)||r.types.isIdentifier(e)&&e.name==="undefined"||r.types.isBooleanLiteral(e)&&e.value===!1}function sn(e,t){return r.types.isJSXElement(e)?ce(e,t,!1,t.autoShow??!0):Ie(e,t,{runtime:"automatic",pragmaFrag:"Fragment",development:!1})}function le(e,t,n,i,o=!1){i.controlFlowComponents.add("Show"),i.needsControlFlowImport=!0;let s=sn(t,i),a=[r.types.objectProperty(r.types.identifier("when"),r.types.arrowFunctionExpression([],e)),r.types.objectProperty(r.types.identifier("children"),s)];return n&&a.push(r.types.objectProperty(r.types.identifier("fallback"),n)),Qt(r.types.identifier("Show"),r.types.objectExpression(a),i)}function _r(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 an(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 o of n.attributes){if(r.types.isJSXSpreadAttribute(o))return!1;if(r.types.isJSXAttribute(o)){let s=o.value;if(r.types.isJSXExpressionContainer(s)&&!r.types.isStringLiteral(s.expression)&&!r.types.isNumericLiteral(s.expression))return!1}}for(let o of e.children)if(r.types.isJSXElement(o)&&!an(o,t)||r.types.isJSXExpressionContainer(o))return!1;return!0}function Br(e,t){let n=`_$static${t.staticCounter++}`,i=ce(e,t,!1);return t.staticElements.set(n,i),r.types.identifier(n)}function zr(e,t){let n=e.openingElement.name.name;return n==="Show"?Wr(e,t):n==="For"?Vr(e,t):null}function Wr(e,t){return null}function Vr(e,t){return null}var qt,r,we,Wt,Ce,br,Zt,Kt,Q,Cr,et=I(()=>{"use strict";qt=require("@babel/helper-plugin-utils");Le();Pe();bt();Y();he();r=require("@babel/core");ze();Ve();ve();we=new Set([...te,...q]),Wt=new Set(q),Ce=new Set(Z),br={Show:"when",For:"each",Index:"each",Match:"when"},Zt=/^on[A-Z]/,Kt=["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave"],Q=(0,qt.declare)((e,t={})=>{e.assertVersion(7);let{runtime:n="automatic",importSource:i="@fluixi/jsx",pragma:o="jsx",pragmaFrag:s="Fragment",development:a=!1,detectReactivity:l=!0,useLitHTML:c=!0,hoistStatics:p=!0,delegateEvents:d=!0,delegatedEvents:u=Kt,optimizeControlFlow:g=!0,sourceMaps:C=!0,signalModule:b="@fluixi/dom",controlFlowModule:w="@fluixi/dom",routerModule:z="@fluixi/core/router-next",reactiveModule:M="@fluixi/reactive/signal",autoShowTransform:W=!1,backend:j="imperative",codegen:S="ir",templateClone:T=!0,partialTemplates:F=!0,format:pt="both",litTag:vn="html",resolve:yn=[]}=t,ut=me(yn),bn=pt==="lit"||pt==="both",Rn={backend:j,codegen:S,irImports:new Set,libModule:"@fluixi/core",controlFlowModule:w,routerModule:z,templateClone:T,partialTemplates:F,hasJSX:!1,hasReactivity:!1,hasLitHTML:!1,needsSignalImport:!1,needsControlFlowImport:!1,needsCreateMemo:!1,controlFlowComponents:new Set,resolvedComponents:new Map,deferredComponents:new Map,componentResolver:ut,delegatedEvents:new Set,staticElements:new Map,staticTemplates:new Map,staticCounter:0};return{name:"@fluixi/babel-plugin-jsx",manipulateOptions(h,f){f.plugins.push("jsx","typescript")},pre(h){Object.assign(h,Rn)},visitor:{ImportDeclaration(h,f){h.node.source.value==="@fluixi/core/rx"&&(h.node.source=r.types.stringLiteral("@fluixi/reactive"))},Program:{enter(h,f){Object.assign(f,{hasJSX:!1,hasReactivity:!1,hasLitHTML:!1,hasLitIR:!1,needsSignalImport:!1,needsControlFlowImport:!1,needsCreateMemo:!1,controlFlowComponents:new Set,resolvedComponents:new Map,deferredComponents:new Map,componentResolver:ut,delegatedEvents:new Set,staticElements:new Map,staticTemplates:new Map,autoShow:W,staticCounter:0,libModule:"@fluixi/core",controlFlowModule:w,routerModule:z,templateClone:T,partialTemplates:F,backend:j,codegen:S,irImports:new Set,needsCreateNativeElement:!1,needsInsert:!1,needsSpread:!1,needsCreateComponent:!1,needsMergeProps:!1})},exit(h,f){let x=[];if(f.hasJSX||f.needsSignalImport&&x.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("signal"),r.types.identifier("signal"))],r.types.stringLiteral(b))),f.hasJSX||f.hasLitIR){if(f.irImports.size>0){let v=new Set(["Show","For","Index","Switch","Match","Dynamic","ErrorBoundary","Portal","Suspense"]),E=new Set(["createMemo","createEffect","createRenderEffect","createRoot","createSignal","onCleanup","batch","untrack"]),y=Array.from(f.irImports),k=R=>r.types.importSpecifier(r.types.identifier(R),r.types.identifier(R)),P=R=>!h.scope.hasBinding(R),U=y.filter(R=>E.has(R)&&P(R)),$=y.filter(R=>!v.has(R)&&!E.has(R)&&P(R)),pe=y.filter(R=>v.has(R)&&P(R));U.length>0&&x.push(r.types.importDeclaration(U.map(k),r.types.stringLiteral(M))),$.length>0&&x.push(r.types.importDeclaration($.map(k),r.types.stringLiteral(b))),pe.length>0&&x.push(r.types.importDeclaration(pe.map(k),r.types.stringLiteral(w)))}if(f.hasJSX&&j==="imperative"&&S!=="ir"){let E=[[!!f.needsCreateNativeElement,"createNativeElement"],[!!f.needsSpread,"spread"],[!!f.needsInsert,"insert"],[!!f.needsCreateComponent,"createComponent"],[!!f.needsMergeProps,"mergeProps"]].filter(([y,k])=>y&&!h.scope.hasBinding(k)).map(([,y])=>r.types.importSpecifier(r.types.identifier(y),r.types.identifier(y)));E.length>0&&x.push(r.types.importDeclaration(E,r.types.stringLiteral(b)))}else if(f.hasJSX&&n==="automatic"&&j!=="imperative"){let v=[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&&v.push(r.types.importSpecifier(r.types.identifier("jsxDEV"),r.types.identifier("jsxDEV"))),f.needsMergeProps&&v.push(r.types.importSpecifier(r.types.identifier("mergeProps"),r.types.identifier("mergeProps"))),x.push(r.types.importDeclaration(v,r.types.stringLiteral(i)))}if(f.needsCreateMemo&&!h.scope.hasBinding("createMemo")&&x.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("createMemo"),r.types.identifier("createMemo"))],r.types.stringLiteral(j==="imperative"?M:f.libModule??"@fluixi/core"))),f.needsControlFlowImport&&f.controlFlowComponents.size>0){let v=Array.from(f.controlFlowComponents).filter($=>!h.scope.hasBinding($)),E=f.libModule??"@fluixi/core",y=v.filter($=>Ce.has($)),k=v.filter($=>Wt.has($)),P=v.filter($=>!Wt.has($)&&!Ce.has($)),U=($,pe)=>r.types.importDeclaration($.map(R=>r.types.importSpecifier(r.types.identifier(R),r.types.identifier(R))),r.types.stringLiteral(pe));P.length>0&&x.push(U(P,w)),k.length>0&&x.push(U(k,E)),y.length>0&&x.push(U(y,z))}let J=[];if(f.deferredComponents.size>0){for(let[v,E]of f.deferredComponents)h.scope.hasBinding(v)||J.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(r.types.identifier(v),r.types.callExpression(r.types.identifier("deferred"),[r.types.arrowFunctionExpression([],r.types.callExpression(r.types.import(),[r.types.stringLiteral(E.module)])),r.types.objectExpression([r.types.objectProperty(r.types.identifier("strategy"),kr(E.strategy)),r.types.objectProperty(r.types.identifier("export"),r.types.stringLiteral(E.export))])]))]));J.length>0&&!h.scope.hasBinding("deferred")&&x.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("deferred"),r.types.identifier("deferred"))],r.types.stringLiteral(f.libModule??"@fluixi/core")))}if(f.resolvedComponents.size>0){let v=new Map;for(let[E,y]of f.resolvedComponents){if(h.scope.hasBinding(E))continue;let k=v.get(y.module)??[];k.push({local:E,exported:y.export}),v.set(y.module,k)}for(let[E,y]of v)x.push(r.types.importDeclaration(y.map(({local:k,exported:P})=>P==="default"?r.types.importDefaultSpecifier(r.types.identifier(k)):r.types.importSpecifier(r.types.identifier(k),r.types.identifier(P))),r.types.stringLiteral(E)))}if(d&&f.delegatedEvents.size>0){x.push(r.types.importDeclaration([r.types.importSpecifier(r.types.identifier("delegateEvents"),r.types.identifier("delegateEvents"))],r.types.stringLiteral(j==="imperative"?b:"@fluixi/jsx")));let v=r.types.arrayExpression(Array.from(f.delegatedEvents).map(y=>r.types.stringLiteral(y))),E=r.types.expressionStatement(r.types.callExpression(r.types.identifier("delegateEvents"),[v]));h.node.body.unshift(E)}if(p&&f.staticElements.size>0){let v=[];f.staticElements.forEach((E,y)=>{v.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(r.types.identifier(y),E)]))}),h.node.body.unshift(...v)}if(J.length>0&&h.node.body.unshift(...J),f.staticTemplates.size>0){let v=[];for(let[E,y]of f.staticTemplates){let P=E.startsWith("svg:")?E.slice(4):E;v.push(r.types.variableDeclaration("const",[r.types.variableDeclarator(r.types.identifier(y),r.types.stringLiteral(P))]))}h.node.body.unshift(...v)}}x.length>0&&h.node.body.unshift(...Mr(x))}},JSXElement(h,f){if(f.hasJSX=!0,j==="imperative"&&S==="ir"){h.replaceWith(Ht(h.node,f));return}let x=h.node,J=x.openingElement;if(r.types.isJSXIdentifier(J.name)&&Ce.has(J.name.name)&&!f.componentResolver?.resolve(J.name.name)&&(f.controlFlowComponents.add(J.name.name),f.needsControlFlowImport=!0),r.types.isJSXIdentifier(J.name)&&we.has(J.name.name)&&(f.controlFlowComponents.add(J.name.name),g)){let E=zr(x,f);if(E){h.replaceWith(E);return}}if(p&&j!=="imperative"&&an(x,f)){let E=Br(x,f);if(E){h.replaceWith(E);return}}let v=Rr(x,f,{runtime:n,pragma:o,development:a,detectReactivity:l,useLitHTML:c,autoShow:W});h.replaceWith(v)},JSXFragment(h,f){if(f.hasJSX=!0,j==="imperative"&&S==="ir"){h.replaceWith(Ht(h.node,f));return}let x=Ie(h.node,f,{runtime:n,pragmaFrag:s,development:a});h.replaceWith(x)},CallExpression(h,f){if(!l)return;let x=h.node.callee;x.name,r.types.isIdentifier(x)&&(x.name==="createSignal"||x.name==="createStore"||x.name==="useContext"||x.name==="useLocation")&&(f.hasReactivity=!0)},JSXExpressionContainer(h){},TaggedTemplateExpression(h,f){if(bn&&j==="imperative"&&r.types.isIdentifier(h.node.tag)&&(h.node.tag.name===vn||h.node.tag.name==="svg")){h.replaceWith(Tr(h.node,f));return}}}}});Cr=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"])});var ln=I(()=>{"use strict"});var cn={};dt(cn,{babelPluginReactiveJSX:()=>Hr,createPlugin:()=>Gr,createPreset:()=>ke,default:()=>Q,presets:()=>Ur});function Gr(e){return[Q,e]}function ke(e={}){return{plugins:[[Q,{runtime:"automatic",importSource:"@fluixi/jsx",development:!1,detectReactivity:!0,useLitHTML:!0,hoistStatics:!0,delegateEvents:!0,optimizeControlFlow:!0,sourceMaps:!0,...e}]]}}var Hr,Ur,pn=I(()=>{"use strict";et();ln();et();Hr=Q;Ur={production:ke({development:!1,hoistStatics:!0,delegateEvents:!0,optimizeControlFlow:!0}),development:ke({development:!0,hoistStatics:!1,sourceMaps:!0}),minimal:ke({detectReactivity:!1,useLitHTML:!1,hoistStatics:!1,delegateEvents:!1,optimizeControlFlow:!1})}});var ri={};dt(ri,{analyzeProp:()=>Ne,analyzeProps:()=>Me,createBabelPlugin:()=>ee,createESBuildPlugin:()=>En,createRollupPlugin:()=>xn,createTypeScriptTransformer:()=>mn,createVitePlugin:()=>gn,createWebpackLoader:()=>hn,default:()=>ni,generateChildrenCode:()=>it,generateCreateElement:()=>dn,generateEventDelegation:()=>lt,generateLitHTMLTemplate:()=>ot,generatePropsCode:()=>rt,hoistStatic:()=>at,isLitTemplate:()=>un,optimizeSpreads:()=>fn,optimizeStatic:()=>st,serverFunctionsVitePlugin:()=>ti,shouldUseLitTemplate:()=>nt,transform:()=>G,transformServerFunctions:()=>fe});module.exports=Mn(ri);var mt=require("@babel/core"),Tn="@fluixi/start/server-fn";function $n(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)}function Ln({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||Tn)))}},"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression":(t,n)=>{let i=t.node.body;if(!e.isBlockStatement(i))return;let s=(i.directives||[]).findIndex(u=>u.value.value==="use server");if(s<0)return;i.directives.splice(s,1);let a=(n.opts.filename||n.filename||"unknown").replace(n.opts.root?n.opts.root+"/":"",""),l=`${$n(a)}:${n.fxIndex++}`,c=!!n.opts.ssr,p=c?"$$registerServerFn":"$$createServerReference";n.fxUsed=p;let d=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,d)])):t.replaceWith(d),t.skip()}}}}function fe(e,t){if(!e.includes("use server"))return null;let n=(0,mt.transformSync)(e,{filename:t.filename,configFile:!1,babelrc:!1,sourceMaps:!0,parserOpts:{plugins:["typescript","jsx"]},plugins:[[Ln,t]]});return n?.code?{code:n.code,map:n.map}:null}var X=require("node:fs"),N=require("node:path");Le();he();var Pn=new Set(["Text","Image","Option","Audio","Comment","Range","Selection","Notification","Event","Document","Element","Node","Screen","Window","Location","History","Storage","Response","Request","Headers"]);function On(e){if(e.startsWith(".")||e.startsWith("/")||/^[~@]\//.test(e))return;let t=e.split("/");return e.startsWith("@")?t.slice(0,2).join("/"):t[0]}function ht(e){return`_${e.replace(/[^A-Za-z0-9]/g,"_")}`}function xt(e,t={}){let{available:n,builtins:i=!0,generator:o="@fluixi/compiler",specifier:s=S=>S}=t,a=[...e];i&&a.push({components:ge()});let l=me(a),c=n?new Set(n):void 0,p=[],d=[],u=[],g=new Map;for(let S of[...l.names()].sort()){let T=l.resolve(S);if(!T)continue;let F=On(T.module);Pn.has(S)?d.push(S):c&&F&&!c.has(F)?u.push(S):(p.push(S),g.set(S,T))}let b=[...new Set(p.map(S=>g.get(S).module))].sort().map(S=>`import * as ${ht(S)} from '${s(S)}';`),w=p.map(S=>{let T=g.get(S),F=ht(T.module);return T.export==="default"?` const ${S}: typeof ${F}.default;`:` export import ${S} = ${F}.${T.export};`}),z=d.length>0?`//
3
+ // Import these explicitly — lib.dom already declares the name, so an ambient
4
+ // declaration cannot win:
5
+ `+d.map(S=>{let T=l.resolve(S)?.module;return`// import { ${S} } from '${T?s(T):""}';
6
+ `}).join(""):"",M=e.filter(S=>"match"in S).length,W=M>0?`//
7
+ // ${M} pattern rule${M===1?"":"s"} cannot be declared:
8
+ // a pattern matches unboundedly many names, so there is no list to emit. Those
9
+ // tags still resolve at build time; declare them by hand if the editor needs them.
10
+ `:"";return{source:`// GENERATED by ${o} — do not edit.
11
+ //
12
+ // The components \`resolve\` supplies without an import. This describes what the
13
+ // compiler already does; it does not enable it.
14
+ `+z+W+(b.length>0?`
15
+ ${b.join(`
16
+ `)}
17
+ `:`
3
18
  `)+`
4
- `+e:e}function Qe(e,t={}){let n=t.delegatedEvents||["click","input","change","submit"],i=e.filter(o=>n.includes(o.toLowerCase()));return i.length===0?"":`delegateEvents([${i.map(o=>`'${o}'`).join(", ")}]);`}function A(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=Ke(i),i=Ye(i)),t.delegateEvents!==!1){let o=Or(e),s=Qe(o,t);s&&(i=s+`
5
- `+i)}return i=Ar(i,n,t),{code:i,metadata:n}}function Or(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 Ar(e,t,n){let i=[],o=n.importSource||"@fluixi/jsx";return i.push(`import { jsx, jsxs, Fragment, spread } from '${o}';`),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(`
19
+ declare global {
20
+ ${w.join(`
21
+ `)}
22
+ }
23
+ `,declared:p,shadowedByDom:d,unavailable:u,patternRules:M}}var An="GENERATED by @fluixi/compiler",Fn="fluixi.d.ts";function Xn(e,t){let n;try{let o=(0,X.readFileSync)((0,N.resolve)(e,"tsconfig.json"),"utf8");n=JSON.parse(o.replace(/^\s*\/\/.*$/gm,""))}catch{return}if(n.extends!==void 0)return;if(!Array.isArray(n.include))return!0;let i=St(e,t);return n.include.some(o=>{if(typeof o!="string")return!1;let s=o.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\//g,"(?:.*/)?").replace(/\*/g,"[^/]*");return new RegExp(`^${s}(?:/.*)?$`).test(i)})}function St(e,t){return(0,N.relative)(e,t).split(N.sep).join("/")}function Dn(e,t,n){if(!e.startsWith("/"))return e;let i=(0,N.resolve)(n,e.slice(1)),o=(0,N.relative)(t,i).split(N.sep).join("/");return o.startsWith(".")||(o=`./${o}`),o.replace(/\.(tsx|ts|jsx|mts|cts)$/,".js")}function _n(e){try{let t=JSON.parse((0,X.readFileSync)((0,N.resolve)(e,"package.json"),"utf8"));return[...Object.keys(t.dependencies??{}),...Object.keys(t.devDependencies??{}),...Object.keys(t.peerDependencies??{})]}catch{return}}function vt(e,t){if(e.globals===!1)return{status:"skipped",reason:"disabled"};let n=e.resolve??[],i=(0,N.resolve)(t,e.globals??Fn),o;try{o=(0,X.readFileSync)(i,"utf8")}catch{o=void 0}if(o!==void 0&&!o.includes(An))return{status:"skipped",reason:"foreign-file",path:i};let{source:s,declared:a}=xt(n,{available:_n(t),specifier:l=>Dn(l,(0,N.dirname)(i),t)});return o===s?{status:"unchanged",path:i,declared:a.length,warning:Et(t,i)}:((0,X.mkdirSync)((0,N.dirname)(i),{recursive:!0}),(0,X.writeFileSync)(i,s),{status:"written",path:i,declared:a.length,warning:Et(t,i)})}function Et(e,t){if(Xn(e,t)!==!1)return;let n=St(e,t);return`[fluixi] ${n} is not covered by "include" in tsconfig.json, so TypeScript will ignore it and every resolved component stays "Cannot find name". Add "${n}" to "include".`}var $e=require("node:fs"),ct=require("node:path"),qr=new Set(["key","ref","children"]),Zr=[/\(\)\s*=>/,/function\s*\(\)/,/\w+\(\)/,/\w+\.\w+/,/\w+\[.+\]/,/createSignal/,/createStore/,/createMemo/,/createEffect/],Kr=/^on[A-Z]/;function Ne(e,t){let n={name:e,isStatic:!0,isReactive:!1,isEvent:Kr.test(e),isRef:e==="ref",isSpread:e.startsWith("...")};if(qr.has(e))return n;if(n.isEvent||n.isRef)return n.isStatic=!1,n;if(typeof t=="string"){let i=t;for(let o of Zr)if(o.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 Me(e){let t=new Map;for(let[n,i]of Object.entries(e))t.set(n,Ne(n,i));return t}function nt(e,t,n){if(typeof e!="string")return!1;let i=Me(t);for(let o of i.values()){if(o.isSpread)return!1;o.isReactive&&o.isEvent}return!0}function un(e){return e&&typeof e=="object"&&"_$litType$"in e}function dn(e,t,n,i={}){let o=["svg","path","circle","rect","g"].includes(e),s=rt(t,i),a=n.length>0?`, ${it(n)}`:"";return i.useLitHTML!==!1&&nt(e,t,n)?ot(e,t,n,o):`jsx('${e}', ${s}${a})`}function rt(e,t={}){if(Object.keys(e).length===0)return"{}";let n=Me(e),i=[];for(let[o,s]of Object.entries(e)){let a=n.get(o);a.isReactive&&!a.isStatic?i.push(`${o}: () => ${s}`):typeof s=="string"?i.push(`${o}: "${s}"`):typeof s=="number"||typeof s=="boolean"?i.push(`${o}: ${s}`):i.push(`${o}: ${s}`)}return`{ ${i.join(", ")} }`}function it(e){return e.length===0?"undefined":e.length===1?String(e[0]):`[${e.join(", ")}]`}function ot(e,t,n,i=!1){let o=i?"svg":"html",s=`<${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 d=l.slice(2).toLowerCase();s+=` @${d}=\${${a.length}}`,a.push(String(c))}else p.isReactive?(s+=` ${l}=\${${a.length}}`,a.push(`signal(() => ${c})`)):typeof c=="string"?s+=` ${l}="${c}"`:(s+=` ${l}=\${${a.length}}`,a.push(String(c)))}if(s+=">",n.length>0)for(let l of n)typeof l=="string"?s+=l:(s+=`\${${a.length}}`,a.push(String(l)));return s+=`</${e}>`,`${o}\`${s}\`${a.length>0?`, ${a.join(", ")}`:""}`}function st(e){return e=e.replace(/jsx\('([^']+)',\s*{},\s*"([^"]+)"\s*\)/g,(t,n,i)=>`_$staticNode('${n}', '${i}')`),e}function fn(e){return e}function at(e){let t=[],n=0;return e=e.replace(/jsx\('([^']+)',\s*{([^}]*)},\s*([^)]*)\)/g,(i,o,s,a)=>{if(!s.includes("()")&&!s.includes("=>")){let l=`_$static${n++}`;return t.push(`const ${l} = ${i};`),l}return i}),t.length>0?t.join(`
24
+ `)+`
25
+ `+e:e}function lt(e,t={}){let n=t.delegatedEvents||["click","input","change","submit"],i=e.filter(o=>n.includes(o.toLowerCase()));return i.length===0?"":`delegateEvents([${i.map(o=>`'${o}'`).join(", ")}]);`}function G(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=st(i),i=at(i)),t.delegateEvents!==!1){let o=Yr(e),s=lt(o,t);s&&(i=s+`
26
+ `+i)}return i=Qr(i,n,t),{code:i,metadata:n}}function Yr(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 Qr(e,t,n){let i=[],o=n.importSource||"@fluixi/jsx";return i.push(`import { jsx, jsxs, Fragment, spread } from '${o}';`),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
27
  `)+`
7
28
 
8
- `+e}async function U(e={}){let t=null;try{t=await Promise.resolve().then(()=>(tn(),en))}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.templateClone!==void 0?{templateClone:e.templateClone}:{},...e.partialTemplates!==void 0?{partialTemplates:e.partialTemplates}:{},...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 sn(e={}){let t=ye("typescript");return t?n=>{let i=o=>t.isJsxElement(o)||t.isJsxSelfClosingElement(o)?Dr(o,e,t):t.visitEachChild(o,i,n);return o=>t.visitNode(o,i)}:(console.warn("TypeScript not found, transformer unavailable"),n=>i=>i)}function Dr(e,t,n){return e}function ye(e){try{return require(e)}catch{return null}}function an(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 U(e);if(!/\.(jsx|tsx|ts)$/i.test(n))return null;try{let o=await import("@babel/core").catch(()=>null);if(!o)return{code:A(t,e).code,map:null};let s=/\.tsx$/.test(n),a=/\.ts$/.test(n),l=[],c=[];if(s||a){let f=await import("@babel/preset-typescript").then(u=>u.default||u).catch(()=>null);f&&l.push([f,{isTSX:s,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 o.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(o){console.error("Transform error:",o);try{return{code:A(t,e).code,map:null}}catch(s){return console.error("Fallback transform also failed:",s),null}}}}}function ln(e={}){return async function(t){let n=this.async(),i=ye("@babel/core"),o=await U(e);if(!i||!o.plugin){let s=A(t,e);n(null,s.code);return}i.transformAsync(t,{filename:this.resourcePath,plugins:[[o.plugin,o.getOptions()]],sourceMaps:e.sourceMaps!==!1}).then(s=>{n(null,s?.code,s?.map)}).catch(s=>{n(s)})}}function cn(e={}){return{name:"rollup-fluixi-jsx",async transform(t,n){let i=await U(e);if(!/\.[jt]sx$/.test(n))return null;try{let o=ye("@babel/core");if(!o||!i.plugin)return{code:A(t,e).code,map:null};let s=await o.transformAsync(t,{filename:n,plugins:[[i.plugin,i.getOptions()]],sourceMaps:e.sourceMaps!==!1});return{code:s?.code||t,map:s?.map}}catch(o){return console.error("Transform error:",o),null}}}}function pn(e={}){return{name:"esbuild-fluixi-jsx",setup(t){t.onLoad({filter:/\.[jt]sx$/},async n=>{let i=ye("@babel/core"),o=await U(e),a=require("fs").readFileSync(n.path,"utf8");try{return!i||!o.plugin?{contents:A(a,e).code,loader:"js"}:{contents:(await i.transformAsync(a,{filename:n.path,plugins:[[o.plugin,o.getOptions()]],sourceMaps:!1}))?.code||a,loader:"js"}}catch(l){return{errors:[{text:`Transform error: ${l}`}]}}})}}}var We="virtual:fluixi-server-fns";function un(e,t=[]){let n;try{n=(0,be.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 o=(0,et.join)(e,i.name);if(i.isDirectory())un(o,t);else if(/\.[jt]sx?$/.test(i.name))try{(0,be.readFileSync)(o,"utf8").includes("use server")&&t.push(o)}catch{}}return t}function _r(){let e=process.cwd();return{name:"fluixi-server-functions",enforce:"pre",configResolved(t){e=t.root||e},resolveId(t){return t===We?"\0"+We:null},load(t){if(t!=="\0"+We)return null;let n=un((0,et.join)(e,"src")),i=`import '@fluixi/start/server-fn-setup';
29
+ `+e}async function ee(e={}){let t=null;try{t=await Promise.resolve().then(()=>(pn(),cn))}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.templateClone!==void 0?{templateClone:e.templateClone}:{},...e.partialTemplates!==void 0?{partialTemplates:e.partialTemplates}:{},...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 mn(e={}){let t=Te("typescript");return t?n=>{let i=o=>t.isJsxElement(o)||t.isJsxSelfClosingElement(o)?ei(o,e,t):t.visitEachChild(o,i,n);return o=>t.visitNode(o,i)}:(console.warn("TypeScript not found, transformer unavailable"),n=>i=>i)}function ei(e,t,n){return e}function Te(e){try{return require(e)}catch{return null}}function gn(e={}){return{name:"vite-fluixi-jsx",enforce:"pre",config(){return{esbuild:{jsx:"automatic",jsxImportSource:e.importSource||"@fluixi/jsx"}}},configResolved(t){let n=vt(e,t?.root??process.cwd());n.warning&&console.warn(n.warning)},async transform(t,n){let i=await ee(e);if(!/\.(jsx|tsx|ts)$/i.test(n))return null;try{let o=await import("@babel/core").catch(()=>null);if(!o)return{code:G(t,e).code,map:null};let s=/\.tsx$/.test(n),a=/\.ts$/.test(n),l=[],c=[];if(s||a){let d=await import("@babel/preset-typescript").then(u=>u.default||u).catch(()=>null);d&&l.push([d,{isTSX:s,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 o.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(o){console.error("Transform error:",o);try{return{code:G(t,e).code,map:null}}catch(s){return console.error("Fallback transform also failed:",s),null}}}}}function hn(e={}){return async function(t){let n=this.async(),i=Te("@babel/core"),o=await ee(e);if(!i||!o.plugin){let s=G(t,e);n(null,s.code);return}i.transformAsync(t,{filename:this.resourcePath,plugins:[[o.plugin,o.getOptions()]],sourceMaps:e.sourceMaps!==!1}).then(s=>{n(null,s?.code,s?.map)}).catch(s=>{n(s)})}}function xn(e={}){return{name:"rollup-fluixi-jsx",async transform(t,n){let i=await ee(e);if(!/\.[jt]sx$/.test(n))return null;try{let o=Te("@babel/core");if(!o||!i.plugin)return{code:G(t,e).code,map:null};let s=await o.transformAsync(t,{filename:n,plugins:[[i.plugin,i.getOptions()]],sourceMaps:e.sourceMaps!==!1});return{code:s?.code||t,map:s?.map}}catch(o){return console.error("Transform error:",o),null}}}}function En(e={}){return{name:"esbuild-fluixi-jsx",setup(t){t.onLoad({filter:/\.[jt]sx$/},async n=>{let i=Te("@babel/core"),o=await ee(e),a=require("fs").readFileSync(n.path,"utf8");try{return!i||!o.plugin?{contents:G(a,e).code,loader:"js"}:{contents:(await i.transformAsync(a,{filename:n.path,plugins:[[o.plugin,o.getOptions()]],sourceMaps:!1}))?.code||a,loader:"js"}}catch(l){return{errors:[{text:`Transform error: ${l}`}]}}})}}}var tt="virtual:fluixi-server-fns";function Sn(e,t=[]){let n;try{n=(0,$e.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 o=(0,ct.join)(e,i.name);if(i.isDirectory())Sn(o,t);else if(/\.[jt]sx?$/.test(i.name))try{(0,$e.readFileSync)(o,"utf8").includes("use server")&&t.push(o)}catch{}}return t}function ti(){let e=process.cwd();return{name:"fluixi-server-functions",enforce:"pre",configResolved(t){e=t.root||e},resolveId(t){return t===tt?"\0"+tt:null},load(t){if(t!=="\0"+tt)return null;let n=Sn((0,ct.join)(e,"src")),i=`import '@fluixi/start/server-fn-setup';
9
30
  `,o=n.map(a=>`import ${JSON.stringify(a)};`).join(`
10
31
  `);return i+o+`
11
32
  export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
12
- `},transform(t,n,i){return!/\.[jt]sx?$/.test(n)||!t.includes("use server")?null:ae(t,{ssr:!!i?.ssr,filename:n,root:e})}}}var zr={analyzeProp:Se,analyzeProps:ve,shouldUseLitTemplate:Ue,isLitTemplate:nn,generateCreateElement:rn,generatePropsCode:qe,generateChildrenCode:Ge,generateLitHTMLTemplate:Ze,optimizeStatic:Ke,optimizeSpreads:on,hoistStatic:Ye,generateEventDelegation:Qe,transform:A,createBabelPlugin:U,createTypeScriptTransformer:sn,createVitePlugin:an,createWebpackLoader:ln,createRollupPlugin:cn,createESBuildPlugin:pn};
33
+ `},transform(t,n,i){return!/\.[jt]sx?$/.test(n)||!t.includes("use server")?null:fe(t,{ssr:!!i?.ssr,filename:n,root:e})}}}var ni={analyzeProp:Ne,analyzeProps:Me,shouldUseLitTemplate:nt,isLitTemplate:un,generateCreateElement:dn,generatePropsCode:rt,generateChildrenCode:it,generateLitHTMLTemplate:ot,optimizeStatic:st,optimizeSpreads:fn,hoistStatic:at,generateEventDelegation:lt,transform:G,createBabelPlugin:ee,createTypeScriptTransformer:mn,createVitePlugin:gn,createWebpackLoader:hn,createRollupPlugin:xn,createESBuildPlugin:En};
@@ -19,6 +19,22 @@ export interface CompilerOptions {
19
19
  * used in a template without an import. See `createComponentResolver`.
20
20
  */
21
21
  resolve?: readonly ComponentResolverRule[];
22
+ /**
23
+ * Where to write the ambient declarations for the components `resolve` supplies.
24
+ *
25
+ * Relative to the project root; `false` turns generation off. Without this file every
26
+ * resolved tag is a `Cannot find name` error in the editor and in `tsc`, because the
27
+ * import only exists after compilation. Committing it is intended — it is what makes a
28
+ * fresh clone type-check before anyone runs the dev server.
29
+ *
30
+ * It must be covered by `include` in tsconfig.json, which for the default means adding
31
+ * `"fluixi.d.ts"` alongside `"src"`. A file TypeScript does not read looks exactly like
32
+ * one that was never generated, so a mismatch is reported rather than left to puzzle
33
+ * over.
34
+ *
35
+ * @default 'fluixi.d.ts'
36
+ */
37
+ globals?: string | false;
22
38
  /** Clone static subtrees from a `<template>` instead of building them element by element. */
23
39
  templateClone?: boolean;
24
40
  /** Also clone subtrees whose structure is static but which contain dynamic holes. */
@@ -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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"}
@@ -491,6 +491,13 @@ export function createVitePlugin(options = {}) {
491
491
  },
492
492
  };
493
493
  },
494
+ // Written once per build, and on dev-server start, rather than per transform: the
495
+ // set of resolvable names comes from config, so nothing a file does can change it.
496
+ configResolved(config) {
497
+ const outcome = writeComponentGlobals(options, config?.root ?? process.cwd());
498
+ if (outcome.warning)
499
+ console.warn(outcome.warning);
500
+ },
494
501
  async transform(code, id) {
495
502
  // Load babel plugin dynamically on first transform
496
503
  const babelPlugin = await createBabelPlugin(options);
@@ -703,6 +710,7 @@ export function createESBuildPlugin(options = {}) {
703
710
  // ============================================================================
704
711
  export { transformServerFunctions } from './frontend/babel/server-functions.js';
705
712
  import { transformServerFunctions as _txServerFns } from './frontend/babel/server-functions.js';
713
+ import { writeComponentGlobals } from './resolve/write-globals.js';
706
714
  import { readdirSync, readFileSync } from 'node:fs';
707
715
  import { join as _join } from 'node:path';
708
716
  const SERVER_FNS_VMOD = 'virtual:fluixi-server-fns';
@@ -1,11 +1,32 @@
1
- import{a as d}from"./chunk-3SAEGOMQ.mjs";import{transformSync as C}from"@babel/core";var R="@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||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=`${P(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=C(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 b(e){let t=new Map;for(let[n,r]of Object.entries(e))t.set(n,v(n,r));return t}function h(e,t,n){if(typeof e!="string")return!1;let r=b(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=S(t,r),a=n.length>0?`, ${$(n)}`:"";return r.useLitHTML!==!1&&h(e,t,n)?T(e,t,n,s):`jsx('${e}', ${i}${a})`}function S(e,t={}){if(Object.keys(e).length===0)return"{}";let n=b(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 S,b as C,g as M}from"./chunk-EF6V4GTD.mjs";import{transformSync as Z}from"@babel/core";var K="@fluixi/start/server-fn";function Q(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(16)}function Y({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||K)))}},"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=`${Q(o)}:${n.fxIndex++}`,c=!!n.opts.ssr,u=c?"$$registerServerFn":"$$createServerReference";n.fxUsed=u;let f=c?e.callExpression(e.identifier(u),[e.stringLiteral(a),t.isFunctionDeclaration()?e.functionExpression(null,t.node.params,r,t.node.generator,t.node.async):t.node]):e.callExpression(e.identifier(u),[e.stringLiteral(a)]);t.isFunctionDeclaration()?t.replaceWith(e.variableDeclaration("const",[e.variableDeclarator(t.node.id,f)])):t.replaceWith(f),t.skip()}}}}function $(e,t){if(!e.includes("use server"))return null;let n=Z(e,{filename:t.filename,configFile:!1,babelrc:!1,sourceMaps:!0,parserOpts:{plugins:["typescript","jsx"]},plugins:[[Y,t]]});return n?.code?{code:n.code,map:n.map}:null}import{mkdirSync as ne,readFileSync as w,writeFileSync as re}from"node:fs";import{dirname as P,relative as L,sep as k,resolve as v}from"node:path";var ee=new Set(["Text","Image","Option","Audio","Comment","Range","Selection","Notification","Event","Document","Element","Node","Screen","Window","Location","History","Storage","Response","Request","Headers"]);function te(e){if(e.startsWith(".")||e.startsWith("/")||/^[~@]\//.test(e))return;let t=e.split("/");return e.startsWith("@")?t.slice(0,2).join("/"):t[0]}function O(e){return`_${e.replace(/[^A-Za-z0-9]/g,"_")}`}function F(e,t={}){let{available:n,builtins:r=!0,generator:s="@fluixi/compiler",specifier:i=l=>l}=t,o=[...e];r&&o.push({components:M()});let a=C(o),c=n?new Set(n):void 0,u=[],f=[],g=[],x=new Map;for(let l of[...a.names()].sort()){let p=a.resolve(l);if(!p)continue;let m=te(p.module);ee.has(l)?f.push(l):c&&m&&!c.has(m)?g.push(l):(u.push(l),x.set(l,p))}let E=[...new Set(u.map(l=>x.get(l).module))].sort().map(l=>`import * as ${O(l)} from '${i(l)}';`),J=u.map(l=>{let p=x.get(l),m=O(p.module);return p.export==="default"?` const ${l}: typeof ${m}.default;`:` export import ${l} = ${m}.${p.export};`}),q=f.length>0?`//
2
+ // Import these explicitly — lib.dom already declares the name, so an ambient
3
+ // declaration cannot win:
4
+ `+f.map(l=>{let p=a.resolve(l)?.module;return`// import { ${l} } from '${p?i(p):""}';
5
+ `}).join(""):"",b=e.filter(l=>"match"in l).length,X=b>0?`//
6
+ // ${b} pattern rule${b===1?"":"s"} cannot be declared:
7
+ // a pattern matches unboundedly many names, so there is no list to emit. Those
8
+ // tags still resolve at build time; declare them by hand if the editor needs them.
9
+ `:"";return{source:`// GENERATED by ${s} — do not edit.
10
+ //
11
+ // The components \`resolve\` supplies without an import. This describes what the
12
+ // compiler already does; it does not enable it.
13
+ `+q+X+(E.length>0?`
14
+ ${E.join(`
15
+ `)}
16
+ `:`
2
17
  `)+`
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
- `+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(`
18
+ declare global {
19
+ ${J.join(`
20
+ `)}
21
+ }
22
+ `,declared:u,shadowedByDom:f,unavailable:g,patternRules:b}}var se="GENERATED by @fluixi/compiler",ie="fluixi.d.ts";function oe(e,t){let n;try{let s=w(v(e,"tsconfig.json"),"utf8");n=JSON.parse(s.replace(/^\s*\/\/.*$/gm,""))}catch{return}if(n.extends!==void 0)return;if(!Array.isArray(n.include))return!0;let r=D(e,t);return n.include.some(s=>{if(typeof s!="string")return!1;let i=s.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\//g,"(?:.*/)?").replace(/\*/g,"[^/]*");return new RegExp(`^${i}(?:/.*)?$`).test(r)})}function D(e,t){return L(e,t).split(k).join("/")}function ae(e,t,n){if(!e.startsWith("/"))return e;let r=v(n,e.slice(1)),s=L(t,r).split(k).join("/");return s.startsWith(".")||(s=`./${s}`),s.replace(/\.(tsx|ts|jsx|mts|cts)$/,".js")}function le(e){try{let t=JSON.parse(w(v(e,"package.json"),"utf8"));return[...Object.keys(t.dependencies??{}),...Object.keys(t.devDependencies??{}),...Object.keys(t.peerDependencies??{})]}catch{return}}function N(e,t){if(e.globals===!1)return{status:"skipped",reason:"disabled"};let n=e.resolve??[],r=v(t,e.globals??ie),s;try{s=w(r,"utf8")}catch{s=void 0}if(s!==void 0&&!s.includes(se))return{status:"skipped",reason:"foreign-file",path:r};let{source:i,declared:o}=F(n,{available:le(t),specifier:a=>ae(a,P(r),t)});return s===i?{status:"unchanged",path:r,declared:o.length,warning:A(t,r)}:(ne(P(r),{recursive:!0}),re(r,i),{status:"written",path:r,declared:o.length,warning:A(t,r)})}function A(e,t){if(oe(e,t)!==!1)return;let n=D(e,t);return`[fluixi] ${n} is not covered by "include" in tsconfig.json, so TypeScript will ignore it and every resolved component stays "Cannot find name". Add "${n}" to "include".`}import{readdirSync as we,readFileSync as Re}from"node:fs";import{join as U}from"node:path";var ce=new Set(["key","ref","children"]),ue=[/\(\)\s*=>/,/function\s*\(\)/,/\w+\(\)/,/\w+\.\w+/,/\w+\[.+\]/,/createSignal/,/createStore/,/createMemo/,/createEffect/],fe=/^on[A-Z]/;function T(e,t){let n={name:e,isStatic:!0,isReactive:!1,isEvent:fe.test(e),isRef:e==="ref",isSpread:e.startsWith("...")};if(ce.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 ue)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 j(e){let t=new Map;for(let[n,r]of Object.entries(e))t.set(n,T(n,r));return t}function _(e,t,n){if(typeof e!="string")return!1;let r=j(t);for(let s of r.values()){if(s.isSpread)return!1;s.isReactive&&s.isEvent}return!0}function pe(e){return e&&typeof e=="object"&&"_$litType$"in e}function ge(e,t,n,r={}){let s=["svg","path","circle","rect","g"].includes(e),i=G(t,r),o=n.length>0?`, ${I(n)}`:"";return r.useLitHTML!==!1&&_(e,t,n)?W(e,t,n,s):`jsx('${e}', ${i}${o})`}function G(e,t={}){if(Object.keys(e).length===0)return"{}";let n=j(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 I(e){return e.length===0?"undefined":e.length===1?String(e[0]):`[${e.join(", ")}]`}function W(e,t,n,r=!1){let s=r?"svg":"html",i=`<${e}`,o=[];for(let[a,c]of Object.entries(t)){if(a==="children"||a==="key"||a==="ref")continue;let u=T(a,c);if(u.isEvent){let f=a.slice(2).toLowerCase();i+=` @${f}=\${${o.length}}`,o.push(String(c))}else u.isReactive?(i+=` ${a}=\${${o.length}}`,o.push(`signal(() => ${c})`)):typeof c=="string"?i+=` ${a}="${c}"`:(i+=` ${a}=\${${o.length}}`,o.push(String(c)))}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 z(e){return e=e.replace(/jsx\('([^']+)',\s*{},\s*"([^"]+)"\s*\)/g,(t,n,r)=>`_$staticNode('${n}', '${r}')`),e}function de(e){return e}function H(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(`
23
+ `)+`
24
+ `+e:e}function B(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 d(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=z(r),r=H(r)),t.delegateEvents!==!1){let s=me(e),i=B(s,t);i&&(r=i+`
25
+ `+r)}return r=ye(r,n,t),{code:r,metadata:n}}function me(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 ye(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
26
  `)+`
6
27
 
7
- `+e}async function p(e={}){let t=null;try{t=await import("./babel-NY6FXXLW.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.templateClone!==void 0?{templateClone:e.templateClone}:{},...e.partialTemplates!==void 0?{partialTemplates:e.partialTemplates}:{},...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(`
28
+ `+e}async function y(e={}){let t=null;try{t=await import("./babel-DFIRSRWC.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.templateClone!==void 0?{templateClone:e.templateClone}:{},...e.partialTemplates!==void 0?{partialTemplates:e.partialTemplates}:{},...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 be(e={}){let t=h("typescript");return t?n=>{let r=s=>t.isJsxElement(s)||t.isJsxSelfClosingElement(s)?ve(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 ve(e,t,n){return e}function h(e){try{return S(e)}catch{return null}}function he(e={}){return{name:"vite-fluixi-jsx",enforce:"pre",config(){return{esbuild:{jsx:"automatic",jsxImportSource:e.importSource||"@fluixi/jsx"}}},configResolved(t){let n=N(e,t?.root??process.cwd());n.warning&&console.warn(n.warning)},async transform(t,n){let r=await y(e);if(!/\.(jsx|tsx|ts)$/i.test(n))return null;try{let s=await import("@babel/core").catch(()=>null);if(!s)return{code:d(t,e).code,map:null};let i=/\.tsx$/.test(n),o=/\.ts$/.test(n),a=[],c=[];if(i||o){let f=await import("@babel/preset-typescript").then(g=>g.default||g).catch(()=>null);f&&a.push([f,{isTSX:i,allExtensions:!0,jsxPragma:e.pragma||"jsx",jsxPragmaFrag:e.pragmaFrag||"Fragment",onlyRemoveTypeImports:!0}])}r&&r.plugin?c.push([r.plugin,r.getOptions()]):console.warn("[createVitePlugin] custom babel plugin not found");let u=await s.transformAsync(t,{filename:n,configFile:!1,babelrc:!1,presets:a,plugins:c,sourceMaps:e.sourceMaps!==!1});return{code:u?.code||t,map:u?.map}}catch(s){console.error("Transform error:",s);try{return{code:d(t,e).code,map:null}}catch(i){return console.error("Fallback transform also failed:",i),null}}}}}function xe(e={}){return async function(t){let n=this.async(),r=h("@babel/core"),s=await y(e);if(!r||!s.plugin){let i=d(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 Se(e={}){return{name:"rollup-fluixi-jsx",async transform(t,n){let r=await y(e);if(!/\.[jt]sx$/.test(n))return null;try{let s=h("@babel/core");if(!s||!r.plugin)return{code:d(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 $e(e={}){return{name:"esbuild-fluixi-jsx",setup(t){t.onLoad({filter:/\.[jt]sx$/},async n=>{let r=h("@babel/core"),s=await y(e),o=S("fs").readFileSync(n.path,"utf8");try{return!r||!s.plugin?{contents:d(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 R="virtual:fluixi-server-fns";function V(e,t=[]){let n;try{n=we(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=U(e,r.name);if(r.isDirectory())V(s,t);else if(/\.[jt]sx?$/.test(r.name))try{Re(s,"utf8").includes("use server")&&t.push(s)}catch{}}return t}function Ie(){let e=process.cwd();return{name:"fluixi-server-functions",enforce:"pre",configResolved(t){e=t.root||e},resolveId(t){return t===R?"\0"+R:null},load(t){if(t!=="\0"+R)return null;let n=V(U(e,"src")),r=`import '@fluixi/start/server-fn-setup';
29
+ `,s=n.map(o=>`import ${JSON.stringify(o)};`).join(`
9
30
  `);return r+s+`
10
31
  export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
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:b,shouldUseLitTemplate:h,isLitTemplate:_,generateCreateElement:I,generatePropsCode:S,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,b 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,S as generatePropsCode,j as hoistStatic,_ as isLitTemplate,N as optimizeSpreads,M as optimizeStatic,ee as serverFunctionsVitePlugin,h as shouldUseLitTemplate,f as transform,y as transformServerFunctions};
32
+ `},transform(t,n,r){return!/\.[jt]sx?$/.test(n)||!t.includes("use server")?null:$(t,{ssr:!!r?.ssr,filename:n,root:e})}}}var We={analyzeProp:T,analyzeProps:j,shouldUseLitTemplate:_,isLitTemplate:pe,generateCreateElement:ge,generatePropsCode:G,generateChildrenCode:I,generateLitHTMLTemplate:W,optimizeStatic:z,optimizeSpreads:de,hoistStatic:H,generateEventDelegation:B,transform:d,createBabelPlugin:y,createTypeScriptTransformer:be,createVitePlugin:he,createWebpackLoader:xe,createRollupPlugin:Se,createESBuildPlugin:$e};export{T as analyzeProp,j as analyzeProps,y as createBabelPlugin,$e as createESBuildPlugin,Se as createRollupPlugin,be as createTypeScriptTransformer,he as createVitePlugin,xe as createWebpackLoader,We as default,I as generateChildrenCode,ge as generateCreateElement,B as generateEventDelegation,W as generateLitHTMLTemplate,G as generatePropsCode,H as hoistStatic,pe as isLitTemplate,de as optimizeSpreads,z as optimizeStatic,Ie as serverFunctionsVitePlugin,_ as shouldUseLitTemplate,d as transform,$ as transformServerFunctions};
@@ -0,0 +1,22 @@
1
+ "use strict";var C=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var _=(e,t)=>{for(var r in t)C(e,r,{get:t[r],enumerable:!0})},B=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!L.call(e,n)&&n!==r&&C(e,n,{get:()=>t[n],enumerable:!(a=N(t,n))||a.enumerable});return e};var D=e=>B(C({},"__esModule",{value:!0}),e);var W={};_(W,{componentGlobals:()=>I});module.exports=D(W);var j=e=>"components"in e;function b(e,t){return e.replace(/\$(\d+)/g,(r,a)=>t[Number(a)]??r)}function A(e,t){return typeof t=="string"?{module:t,export:e}:t}function M(e=[]){let t=new Map,r=[],a=[];for(let i of e){if(!j(i)){a.push(i);continue}for(let[s,c]of Object.entries(i.components)){let l=A(s,c),m=t.get(s);if(m&&m.module!==l.module){let d=r.find(f=>f.name===s);d?d.modules.push(l.module):r.push({name:s,modules:[m.module,l.module]});continue}t.set(s,l)}}let n=new Map;return{resolve:i=>{if(n.has(i))return n.get(i);let s=t.get(i);if(!s)for(let c of a){let l=i.match(new RegExp(c.match.source,c.match.flags.replace("g","")));if(l){s={module:b(c.module,l),export:c.export?b(c.export,l):i};break}}return n.set(i,s),s},names:()=>[...t.keys()],conflicts:()=>r}}var h=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],x=["Suspense","SuspenseList","Await"],O=["Router","Outlet","Redirect","Link"],q=[...h,...x,...O],z=new Set([...h,...x]);function y(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:a="@fluixi/core/router-next"}=e,n={};for(let p of h)n[p]=t;for(let p of x)n[p]=r;for(let p of O)n[p]=a;return n}var G=new Set(["Text","Image","Option","Audio","Comment","Range","Selection","Notification","Event","Document","Element","Node","Screen","Window","Location","History","Storage","Response","Request","Headers"]);function P(e){if(e.startsWith(".")||e.startsWith("/")||/^[~@]\//.test(e))return;let t=e.split("/");return e.startsWith("@")?t.slice(0,2).join("/"):t[0]}function w(e){return`_${e.replace(/[^A-Za-z0-9]/g,"_")}`}function I(e,t={}){let{available:r,builtins:a=!0,generator:n="@fluixi/compiler",specifier:p=o=>o}=t,i=[...e];a&&i.push({components:y()});let s=M(i),c=r?new Set(r):void 0,l=[],m=[],d=[],f=new Map;for(let o of[...s.names()].sort()){let u=s.resolve(o);if(!u)continue;let g=P(u.module);G.has(o)?m.push(o):c&&g&&!c.has(g)?d.push(o):(l.push(o),f.set(o,u))}let v=[...new Set(l.map(o=>f.get(o).module))].sort().map(o=>`import * as ${w(o)} from '${p(o)}';`),E=l.map(o=>{let u=f.get(o),g=w(u.module);return u.export==="default"?` const ${o}: typeof ${g}.default;`:` export import ${o} = ${g}.${u.export};`}),S=m.length>0?`//
2
+ // Import these explicitly — lib.dom already declares the name, so an ambient
3
+ // declaration cannot win:
4
+ `+m.map(o=>{let u=s.resolve(o)?.module;return`// import { ${o} } from '${u?p(u):""}';
5
+ `}).join(""):"",R=e.filter(o=>"match"in o).length,$=R>0?`//
6
+ // ${R} pattern rule${R===1?"":"s"} cannot be declared:
7
+ // a pattern matches unboundedly many names, so there is no list to emit. Those
8
+ // tags still resolve at build time; declare them by hand if the editor needs them.
9
+ `:"";return{source:`// GENERATED by ${n} — do not edit.
10
+ //
11
+ // The components \`resolve\` supplies without an import. This describes what the
12
+ // compiler already does; it does not enable it.
13
+ `+S+$+(v.length>0?`
14
+ ${v.join(`
15
+ `)}
16
+ `:`
17
+ `)+`
18
+ declare global {
19
+ ${E.join(`
20
+ `)}
21
+ }
22
+ `,declared:l,shadowedByDom:m,unavailable:d,patternRules:R}}