@fluixi/dom 1.0.0-alpha.65 → 1.0.0-alpha.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function tr(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function nr(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function rr(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function or(e,t){let n=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),r={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return n.has(t)||r[e]&&r[e].has(t)}var ir=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),sr=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),O="http://www.w3.org/2000/svg";function kt(e){return e.localName.includes("-")}function de(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(kt(e)){e[t]=n;return}m(e,t,n,r)}var pe=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function Fe(e,t=document){return t.querySelector(e)}function ar(e,t=document){return Array.from(t.querySelectorAll(e))}function lr(e,t){return e.closest(t)}function He(e,...t){e.classList.add(...t)}function Ve(e,...t){e.classList.remove(...t)}function Ue(e,...t){t.forEach(n=>e.classList.toggle(n))}function cr(e,t){return e.classList.contains(t)}function m(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function We(e,t){return e.getAttribute(t)}function Ke(e,t){e.removeAttribute(t)}function ye(e,t){Object.assign(e.style,t)}function ur(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function ze(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([o,i])=>{if(o==="class"||o==="className")r.className=i;else if(o==="style"&&typeof i=="object")ye(r,i);else if(o.startsWith("on")&&typeof i=="function"){let s=o.slice(2).toLowerCase();r.addEventListener(s,i)}else m(r,o,i)}),n.forEach(o=>{typeof o=="string"?r.appendChild(document.createTextNode(o)):r.appendChild(o)}),r}function Be(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Ge(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function fr(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function dr(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function pr(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function yr(e,t,n,r){let o=i=>{let s=i.target.closest(n);s&&e.contains(s)&&r(i,s)};return e.addEventListener(t,o),()=>{e.removeEventListener(t,o)}}function mr(e,t=5e3){return new Promise((n,r)=>{let o=Fe(e);if(o){n(o);return}let i=new MutationObserver(()=>{let a=Fe(e);a&&(i.disconnect(),clearTimeout(s),n(a))});i.observe(document.body,{childList:!0,subtree:!0});let s=setTimeout(()=>{i.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function gr(e,t,n={}){let r=new IntersectionObserver(o=>{o.forEach(i=>{t(i.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function hr(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var _t=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function xr(e){return typeof e=="object"&&e!==null&&e.$$typeof===_t}function Ot(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function br(e){if(typeof e!="function")return!1;try{let t=e();return Ot(t)}catch{return!1}}function Tr(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function Er(e){return e instanceof Node}function Nr(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function vr(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}import{isSignal as x}from"@fluixi/reactive/signal";function wr(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Ar(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Cr(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Rr(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Mr(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Pr(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function Lr(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Dr(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function $t(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function It(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function qt(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function jt(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Ft(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Ht(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function T(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Vt(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function kr(e){return $t(e)?{type:"router",value:e}:qt(e)?{type:"route",value:e}:It(e)?{type:"routes",value:e}:jt(e)?{type:"outlet",value:e}:T(e)?{type:"component",value:e}:Vt(e)?{type:"suspense",value:e}:Ft(e)?{type:"provider",value:e}:Ht(e)?{type:"context",value:e}:{type:"none",value:e}}import{batch as Qe,createEffect as j,createRenderEffect as p,createRoot as zt,onCleanup as R,readChildren as Bt}from"@fluixi/reactive/signal";var g=typeof document>"u";function P(e){g=e}var $=Symbol.for("fluixi.server-node"),me=null;function Xe(e){me=e}function I(){if(!me)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return me}function L(e){return e!=null&&e[$]===!0?!0:typeof Node<"u"&&e instanceof Node}function ge(e){return e!=null&&e[$]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function he(e){return e!=null&&e[$]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},Je=null;function Ye(e){Je=e}function xe(){return Je}function be(e,t){return u.active&&t.parentNode===e}function Te(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function Ut(){return u.active?u.cursor:null}function Wt(e,t){if(!e||e.parentNode==null)return t();let n=u.active,r=u.cursor,o=u.parents;u.active=!0,u.cursor=e,u.parents=[];try{return t()}finally{u.active=n,u.cursor=r,u.parents=o}}function Kt(e){if(!u.active)return e();let t=u.cursor,n=u.parents;u.active=!1,u.parents=[];try{return e()}finally{u.active=!0,u.cursor=t,u.parents=n}}function q(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Te(t)}function Gt(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let r=0,o=e;for(;o=o.previousElementSibling;)o.tagName===e.tagName&&r++;n+=`:nth-of-type(${r+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function Xt(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function Wr(e){return Xt(Gt(e))}var Kr=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Jt={};var Ze=new Map,X=new Set,ee=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function te(e){if(!g)for(let t of e)X.has(t)||ee.has(t)||(X.add(t),document.addEventListener(t,Yt))}function Yt(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function Ee(e,t,n){if(e[`$$${t}`]=n,ee.has(t)){let r=`__fx_${t}`;if(!e[r]){let o=i=>{e[`$$${t}`]?.(i)};e.addEventListener(t,o),e[r]=o}return}X.has(t)||te([t])}function J(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function zr(e){return!ee.has(e)}function Br(e){return typeof e=="function"}function w(e,t=!1){if(g)return I().createText(e);if(u.active&&!t){let n=xe()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function ne(e,t=!1){if(g)return I().createElement(e,t);if(u.active){let n=xe()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(O,e):document.createElement(e)}function et(e,t=!1){let n=Ze.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,Ze.set(e,r),r}function tt(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Zt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Zt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Gr(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Xr(e){if(x(e)||T(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!x(t)&&!T(t);)t=t();return t}var v=0,Qt=200;function en(e,t,n,r,o){let i=r,s=new Map;return p(()=>{let a;if(T(e)&&!x(e)){if(!s.has(e)){v++;try{let l=e();s.set(e,l)}finally{v--}}for(a=s.get(e);typeof a=="function"&&x(a);)a=a()}else for(a=e();typeof a=="function"&&x(a);)a=a();{let l=0;for(;typeof a=="function"&&l++<50;)if(T(a)){if(!s.has(a)){let c=a;v++;try{let f=c();s.set(c,f)}finally{v--}}a=s.get(a)}else if(x(a))a=a();else if(a=a(),typeof a!="function"||!x(a)&&!T(a))break}v++;try{i=Y(t,a,n,i,s),o(i)}finally{v--}})}function b(e,t,n,r){if(v>Qt)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=w("",!0),e.appendChild(n));let o=r??null,i=l=>Array.isArray(l)&&l.some(c=>typeof c=="function"),s=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!i(t)){v++;try{o=Y(e,t,n,null)}finally{v--}return()=>o}let a=en(s(t),e,n,o,l=>{o=l});return()=>(a?.(),o)}function Y(e,t,n,r,o){if(t==null||typeof t=="boolean")return C(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return C(e,r,n);if(G(t)){let s=w("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(s,r[0]),C(e,r.slice(1),n)):h(e,s,n):r?e.replaceChild(s,r):h(e,s,n),t.then(a=>{s.parentNode===e&&Y(e,a,s.nextSibling,s)}).catch(a=>{console.error("Error resolving promise in insertExpression:",a)}),s}let i=typeof t;if(i==="string"||i==="number"){if(i==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let a=w(t);return h(e,a,n),a}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=C(e,r,n)}if(r&&he(r))return r.data=t,r;let s=w(t);return r&&r.parentNode===e?e.replaceChild(s,r):be(e,s)||h(e,s,n),s}if(L(t))return be(e,t)?(Te(t),t):Array.isArray(r)?(r.length===0?h(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),C(e,r.slice(1),n)):h(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):h(e,t,n)):h(e,t,n),t);if(Array.isArray(t)){let s=[],a=Array.isArray(r)?r:r?[r]:[],l=[];N(t,s,e,n,!0,o,l);let c=tn(e,a,s,n);for(let f of l){let d=b(e,f.sig,f.marker);R(()=>{C(e,d()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return c}if(i==="object"&&t!==null&&typeof t=="object"){let s=t;if("type"in s&&"props"in s){let a=s;if(typeof a.type=="function"){let l=a.type(a.props||{});return Y(e,l,n,r)}}}return C(e,r,n)}function N(e,t,n,r,o=!0,i,s){for(let a=0;a<e.length;a++){let l=e[a];if(!(l==null||typeof l=="boolean")){for(;typeof l=="function"&&!G(l)&&!x(l)&&!T(l)&&(l=l(),!(l==null||typeof l=="boolean")););if(!(l==null||typeof l=="boolean")){if(typeof l=="function"){let c;for(T(l)&&!x(l)?(i||(i=new Map),i.has(l)||i.set(l,l()),c=i.get(l)):c=l();typeof c=="function"&&!G(c)&&!x(c)&&!T(c);)i||(i=new Map),i.has(c)||i.set(c,c()),c=i.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if(x(c)){if(s){let d=w("",!0);t.push(d),s.push({marker:d,sig:c});continue}let f=c();for(;typeof f=="function"&&x(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?N(f,t,n,r,o,i):N([f],t,n,r,o,i);continue}continue}Array.isArray(c)?N(c,t,n,r,o,i,s):N([c],t,n,r,o,i,s);continue}if(G(l)){let c=w("",!0);t.push(c),l.then(f=>{if(c.parentNode){let d=[];if(N([f],d,c.parentNode,void 0,!1,i),d.length>0){c.parentNode.replaceChild(d[0],c);for(let y=1;y<d.length;y++)c.parentNode?.insertBefore(d[y],d[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(l)){N(l,t,n,r,o,i,s);continue}if(L(l)){t.push(l);continue}if(typeof l=="object"&&l!==null&&"type"in l&&"props"in l){let c=l;if(typeof c.type=="function"){let f=c.type(c.props||{});Array.isArray(f)?N(f,t,n,r,!1,i):N([f],t,n,r,!1,i);continue}}if(typeof l=="string"||typeof l=="number"){let c=String(l);if(c.trim()===""&&c!==" ")continue;t.push(w(c));continue}t.push(w(String(l)))}}}}function tn(e,t,n,r){for(let d=0;d<n.length;d++)n[d].parentNode!==null&&n[d].parentNode!==e&&(n=n.slice(),n[d]=n[d].cloneNode(!0));let o=n.length,i=t.length,s=o,a=0,l=0,c=i>0?t[i-1].nextSibling??void 0:r,f=null;for(;a<i||l<s;){if(t[a]===n[l]){a++,l++;continue}for(;i>a&&s>l&&t[i-1]===n[s-1];)i--,s--;if(i===a){let d=s<o?l?n[l-1].nextSibling??void 0:n[s-l]:c;for(;l<s;)h(e,n[l++],d)}else if(s===l)for(;a<i;)(!f||!f.has(t[a]))&&t[a].parentNode===e&&e.removeChild(t[a]),a++;else if(t[a]===n[s-1]&&n[l]===t[i-1]){let d=t[--i].nextSibling;h(e,n[l++],t[a++].nextSibling),h(e,n[--s],d),t[i]=t[a-1]}else{if(!f){f=new Map;let y=l;for(;y<s;)f.set(n[y],y++)}let d=f.get(t[a]);if(d!=null)if(l<d&&d<s){let y=a,fe=1;for(;++y<i&&y<s&&!(!f.has(t[y])||f.get(t[y])!==d+fe);)fe++;if(fe>d-l){let Dt=t[a];for(;l<d;)h(e,n[l++],Dt)}else t[a].parentNode===e?e.replaceChild(n[l++],t[a++]):(h(e,n[l++],c),a++)}else a++;else t[a].parentNode===e&&e.removeChild(t[a]),a++}}return n}function C(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function h(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function D(e,t,n){n==null?delete e[t]:e[t]=n}function nt(e,t,n){let r=n,o;return Array.isArray(n)&&(r=n[0],o=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,o),()=>e.removeEventListener(t,r,o))}function rt(e,t){let n=(r,o)=>{typeof r=="function"&&r(e,o??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function F(e,t,n,r=!1){return typeof n!="function"?(m(e,t,n,r),()=>{}):p(()=>{let o=typeof n=="function"?n():n;m(e,t,o,r)})}function H(e,t,n){return typeof n!="function"?(D(e,t,n),()=>{}):p(()=>{let r=typeof n=="function"?n():n;D(e,t,r)})}function ot(e,t,n){return typeof n!="function"?(m(e,t,!!n),()=>{}):p(()=>{let r=n();m(e,t,!!r)})}function k(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){p(()=>k(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let o=t[r];return typeof o=="function"?o():!!o}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function Z(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let o=t[r],i=r.split(/\s+/).filter(Boolean);if(typeof o=="function"&&n)n.push(p(()=>{let s=!!o();for(let a of i)e.classList.toggle(a,s)}));else{let s=!!(typeof o=="function"?o():o);for(let a of i)e.classList.toggle(a,s)}}}function Q(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let o=n[r];o==null?e.style[r]="":e.style[r]=o}}function it(e){let{element:t,props:n,prevProps:r=Jt,isSVG:o=!1,skipChildren:i=!1}=e;if(!t||!ge(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let s=o||t.namespaceURI===O,a=[];for(let l in n){if(i&&l==="children")continue;let c=n[l],f=r[l];if(c===f)continue;if(l==="ref"){_(c,t);continue}if(l==="use"){rt(t,c);continue}if(l.startsWith("on:")){a.push(nt(t,l.slice(3),c));continue}if(l.startsWith("prop:")){a.push(H(t,l.slice(5),c));continue}if(l.startsWith("attr:")){a.push(F(t,l.slice(5),c,s));continue}if(l.startsWith("bool:")){a.push(ot(t,l.slice(5),c));continue}if(l==="class"||l==="className"){typeof c=="function"?a.push(p(()=>k(t,c()))):k(t,c);continue}if(l==="classList"){typeof c=="function"?a.push(p(()=>Z(t,c()))):Z(t,c,a);continue}if(l==="style"){typeof c=="function"?a.push(p(()=>Q(t,c()))):Q(t,c);continue}if(l.startsWith("on")){let y=l.slice(2).toLowerCase();f&&J(t,y),c&&Ee(t,y,c);continue}let d=pe.has(l)||!s&&l in t;typeof c=="function"?a.push(d?H(t,l,c):F(t,l,c,s)):a.push(p(()=>d?D(t,l,n[l]):m(t,l,n[l],s)))}for(let l in r)if(!(l in n))if(l.startsWith("on")){let c=l.slice(2).toLowerCase();J(t,c)}else pe.has(l)?D(t,l,null):t.removeAttribute(l);return()=>{a.forEach(l=>l())}}function re(e,t,n=!1){for(let r in t){let o=t[r];if(r==="ref"){_(o,e);continue}if(r!=="children"){if(r==="use"){rt(e,o);continue}if(r.startsWith("on:")){nt(e,r.slice(3),o);continue}if(r.startsWith("prop:")){H(e,r.slice(5),o);continue}if(r.startsWith("attr:")){F(e,r.slice(5),o,n);continue}if(r.startsWith("bool:")){ot(e,r.slice(5),o);continue}if(r.startsWith("on")&&r.length>2){let i=r.slice(2).toLowerCase();if(typeof o=="function")if(ee.has(i)){e[`$$${i}`]=o;let s=`__fx_${i}`;if(!e[s]){let a=l=>{e[`$$${i}`]?.(l)};e.addEventListener(i,a),e[s]=a}}else e[`$$${i}`]=o,X.has(i)||te([i]);continue}if(r==="class"||r==="className"){k(e,o);continue}if(r==="classList"){typeof o=="function"?p(()=>Z(e,o())):Z(e,o);continue}if(r==="style"){typeof o=="function"?p(()=>Q(e,o())):Q(e,o);continue}if(r==="innerHTML"){if(typeof o=="function"){let i=j(()=>{let s=o();for(;typeof s=="function";)s=s();e.innerHTML=s});R(()=>i())}else e.innerHTML=o;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof o=="function"){let i=j(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.value=s??"")});R(()=>{i()})}else p(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof o=="function"){let i=j(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.checked=s??"")});R(()=>{i()})}else p(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof o=="function"){let i=!0,s=j(()=>{let a=o();for(;typeof a=="function"&&a.length===0;)a=a();i?(i=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""});R(()=>{s()})}else{let i=!0;p(()=>{let s=t[r];i?(i=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""})}continue}if(typeof o=="function"){let i=j(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();de(e,r,s,n)});R(()=>{i()})}else p(()=>de(e,r,t[r],n))}}}function st(...e){let t=r=>{for(let o=e.length-1;o>=0;o--){let i=e[o];if(i&&r in i&&i[r]!==void 0)return i[r]}},n=r=>{for(let o of e)if(o&&r in o)return!0;return!1};return new Proxy({},{get:(r,o)=>t(o),has:(r,o)=>n(o),ownKeys:()=>{let r=new Set;for(let o of e)if(o)for(let i of Reflect.ownKeys(o))r.add(i);return[...r]},getOwnPropertyDescriptor:(r,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>t(o)}:void 0})}function Jr(e,...t){let n=new Set;for(let s of t)for(let a of s)n.add(a);let r=s=>({enumerable:!0,configurable:!0,get:()=>e[s]}),o=t.map(s=>{let a=new Set(s);return new Proxy({},{get:(l,c)=>a.has(c)?e[c]:void 0,has:(l,c)=>a.has(c)&&c in e,ownKeys:()=>Array.from(a).filter(l=>l in e),getOwnPropertyDescriptor:(l,c)=>a.has(c)&&c in e?r(c):void 0})}),i=new Proxy({},{get:(s,a)=>n.has(a)?void 0:e[a],has:(s,a)=>!n.has(a)&&a in e,ownKeys:()=>Reflect.ownKeys(e).filter(s=>!n.has(s)),getOwnPropertyDescriptor:(s,a)=>!n.has(a)&&a in e?r(a):void 0});return[...o,i]}function _(e,t){if(e){if(L(e)){let n=t,r=e;if(!n)return;typeof n=="function"?n(r):typeof n=="object"&&"current"in n&&(n.current=r);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function at(e,t,n){let r=t||document.body,o=Bt(()=>e),i=[];return Qe(()=>{let s=p(()=>{let a=o();Array.isArray(a)?(a.forEach(l=>r.appendChild(l)),i.push(()=>{a.forEach(l=>{l.parentNode===r&&r.removeChild(l)})})):L(a)&&(r.appendChild(a),i.push(()=>{a.parentNode===r&&r.removeChild(a)}))});i.push(s),R(()=>{i.forEach(a=>a())})}),null}function Yr(e){return typeof e=="string"&&e.toLowerCase()===e}function lt(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function Zr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function G(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Qr(e){return typeof e=="function"&&e.length===0&&x(e)}function oe(e,t,n){if(!t)throw new Error("Container element is required");let r,o,i=[];return zt(s=>{Qe(()=>{u.active||(t.textContent=""),b(t,e)}),o=s}),()=>{o?.(),r?.(),i.forEach(s=>s()),t.textContent=""}}var nn="__fx_dom_create_component__",M=globalThis[nn]??={fn:null};function to(e){M.fn=e}function no(e={}){let t=e.signalSystem?.createComponent;t&&(M.fn=t)}function ie(e,t){return M.fn?M.fn(e,t):(()=>e(t))}var ro=()=>M.fn!==null,ct=()=>M.fn!==null;function ut(){M.fn=null}var se,dt={getStore:()=>se,run(e,t){let n=se;se=e;try{return t()}finally{se=n}}},Ne=dt;function pt(e){Ne=e??dt}function V(e={}){e.locals||(e.locals=e.request?Se(e.request):{});let t=0,n=0,r=null,o=new Map,i=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let s=o.get(r)??0;return o.set(r,s+1),`${r}:r${s}`},nextIslandNamespace:s=>{let a=i.get(s)??0;return i.set(s,a+1),`${s}#${a}`},withResourceScope(s,a){let l=r;r=s;try{return a()}finally{r=l}},pending:new Set,data:new Map}}function U(e,t){return Ne.run(e,t)}function S(){return Ne.getStore()}function ve(){return S()?.event}function yt(){let e=ve();return e?(e.locals||(e.locals={}),e.locals):{}}var ft=new WeakMap;function Se(e){let t=ft.get(e);return t||(t={},ft.set(e,t)),t}import{setResourceIdSource as rn,setServerDataGetter as on}from"@fluixi/reactive/signal";var W="__FX_DATA__";function ae(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var we;function le(){let e=globalThis.__FX_DATA__;if(e)return e;if(we!==void 0)return we;let t=null;if(typeof document<"u"){let n=document.getElementById(W)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return we=t}function Ae(){for(;;){for(;u.cursor&&u.cursor.nodeType===3&&u.cursor.data==="";)u.cursor=u.cursor.nextSibling;if(u.cursor!=null||!u.parents.length)return;u.cursor=u.parents.pop().nextSibling}}var sn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ce=typeof process<"u"&&process.env&&!1;function Re(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function an(e){Ae();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(sn.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(Ce&&t&&Re(`<${e}>`,t),null)}function ln(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}Ae();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(Ce&&t&&Re(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function cn(e){Ae();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(Ce&&t&&Re(`marker <!--${e.slice(0,24)}-->`,t),null)}var mt=!1;function un(){mt||(mt=!0,Ye({hydrateElement:an,hydrateText:ln,hydrateMarker:cn}))}function K(e,t,n){un(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=le(),o=n?.resourceNamespace,i=0;rn(()=>o?`${o}:r${i++}`:`r${i++}`),on(r?s=>s in r?{value:r[s]}:void 0:null);try{return oe(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var Me="fluixi-island";function fn(e){let{component:t,props:n={},name:r}=e,o=ne(Me),i=r??t.name??"Island";m(o,"name",i),m(o,"props",JSON.stringify(n??{}));let s=g?S():void 0;if(s){let a=s.nextIslandNamespace(i);b(o,()=>s.withResourceScope(a,()=>t(n)))}else b(o,()=>t(n));return o}var gt=!1;function dn(){if(gt||typeof document>"u")return;gt=!0;let e=document.createElement("style");e.textContent=`${Me}{display:contents}`,document.head.appendChild(e)}function pn(e){if(typeof document>"u")return;dn();let t=document.querySelectorAll(Me),n=new Map;t.forEach(r=>{let o=r.getAttribute("name")??"",i=n.get(o)??0;n.set(o,i+1);let s=e[o];if(!s){typeof process>"u"&&console.warn(`[fluixi] island "${o}" has no component in the registry — left static.`);return}let a={};try{a=JSON.parse(r.getAttribute("props")||"{}")}catch{}K(()=>s(a),r,{resourceNamespace:`${o}#${i}`})})}function yn(e,...t){throw new Error("html`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function mn(e,...t){throw new Error("svg`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}import{readChildren as gn}from"@fluixi/reactive/signal";function ko(e,t={}){if(typeof e=="function")return ie(e,t);if(typeof e!="string"||e.length===0)return null;let n=lt(e);if(g)return I().createElement(e,n);let r=n?document.createElementNS(O,e):document.createElement(e);return re(r,t,n),hn(r,t),r}function hn(e,t){if(!t||t.children===void 0)return;let n=gn(()=>t.children),r=o=>{b(e,o,typeof o=="function"?null:void 0)};Array.isArray(n)?n.forEach(r):r(n)}import{createMemo as Pe,untrack as Tt}from"@fluixi/reactive/signal";function ht(e){return typeof e=="function"?e:(()=>e)}function A(e){return()=>{let t=e();return typeof t=="function"?t():t}}function xt(e){return e!=null&&e!==!1}function bt(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function xn(e){let t=A(()=>e.when),n=Pe(t,void 0),r=Pe(n,void 0);return Pe(()=>{if(r()){let i=e.children;return typeof i=="function"&&!bt(i)?typeof n=="function"?Tt(()=>Tt(n)?i(n()):e.fallback):i(n):i}return e.fallback},void 0,{name:"show"})}import{mapArray as bn,keyArray as Tn}from"@fluixi/reactive/signal";function En(e){let t=A(()=>e.each),n=()=>e.fallback??null,r=(o,i)=>{let s=e.children,a=Array.isArray(s)?s.map(l=>typeof l=="function"?l(o,i):l):typeof s=="function"?s(o,i):s;return q(a),a};return e.by?Tn(t,e.by,(o,i)=>r(o,i),{fallback:n}):bn(t,(o,i)=>r(o,i),{fallback:n})}import{indexArray as Nn}from"@fluixi/reactive/signal";function vn(e){let t=A(()=>e.each);return Nn(t,(n,r)=>{let o=e.children(n,r);return q(o),o},{fallback:()=>e.fallback??null})}import{mapArray as wi,keyArray as Ai,indexArray as Ci}from"@fluixi/reactive/signal";import{createMemo as Sn}from"@fluixi/reactive/signal";var Le=Symbol("match");function wn(e){return{[Le]:!0,when:A(()=>e.when),children:e.children}}function An(e){let t=Array.isArray(e.children)?e.children:[e.children];return Sn(()=>{for(let n of t){let r=n,o=0;for(;typeof r=="function"&&!r[Le]&&o++<10;)r=r();if(!r||typeof r!="object"||r[Le]!==!0)continue;let i=r.when();if(xt(i))return typeof r.children=="function"?r.children(i):r.children}return e.fallback??null})}import{createMemo as Cn}from"@fluixi/reactive/signal";function Rn(e){let t=ht(e.component),{component:n,...r}=e;return Cn(()=>{let o=t();return o==null?null:typeof o=="string"?{tag:o,props:r}:o(r)})}import{createRoot as Mn,onCleanup as Pn}from"@fluixi/reactive/signal";function Ln(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return Mn(o=>{n=o,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),b(r,e.children)&&_(e.ref,r)}),Pn(()=>{n(),r.remove()}),null}import{createMemo as Dn,createSignal as kn}from"@fluixi/reactive/signal";function _n(e){let[t,n]=kn(null),r=()=>n(null);return Dn(()=>{let o=t();if(o!==null)return typeof e.fallback=="function"?e.fallback(o,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(i){return n(i),typeof e.fallback=="function"?e.fallback(i,r):e.fallback}})}import{createMemo as On}from"@fluixi/reactive/signal";function $n(e){return On(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;(typeof o=="function"?o():o)&&n.push(r)}return n.join(" ")})}import{createMemo as In}from"@fluixi/reactive/signal";function qn(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function jn(e){return In(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;let i=typeof o=="function"?o():o;i!=null&&n.push(`${qn(r)}: ${i}`)}return n.join("; ")})}var _e=1,Oe=3,$e=8,Et;Et=$;var z=class{constructor(){this[Et]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let n=t.childNodes.indexOf(this);return n>=0?t.childNodes[n+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let n=t.childNodes.indexOf(this);return n>0?t.childNodes[n-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,n){if(n==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(n);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let n=this.childNodes.indexOf(t);return n>=0&&this.childNodes.splice(n,1),t.parentNode=null,t}replaceChild(t,n){let r=this.childNodes.indexOf(n);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,n.parentNode=null),n}addEventListener(){}removeEventListener(){}},B=class e extends z{constructor(n){super();this.nodeType=Oe;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}get textContent(){return this.data}set textContent(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},ce=class e extends z{constructor(n){super();this.nodeType=$e;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},De=class{constructor(){this.cssText=""}setProperty(t,n){this[t]=n}removeProperty(t){delete this[t]}},ke=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let n=this.list();for(let r of t)n.includes(r)||n.push(r);this.write(n)}remove(...t){this.write(this.list().filter(n=>!t.includes(n)))}contains(t){return this.list().includes(t)}toggle(t,n){let r=this.contains(t),o=n===void 0?!r:n;return o?this.add(t):this.remove(t),o}},ue=class e extends z{constructor(n,r=!1){super();this.nodeType=_e;this.attributes=new Map;this.style=new De;this.classList=new ke(this);this.rawHTML=null;this.localName=n.toLowerCase(),this.tagName=r?n:n.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(n,r){this.attributes.set(n,String(r))}removeAttribute(n){this.attributes.delete(n)}getAttribute(n){return this.attributes.has(n)?this.attributes.get(n):null}hasAttribute(n){return this.attributes.has(n)}get id(){return this.getAttribute("id")??""}set id(n){n==null?this.removeAttribute("id"):this.setAttribute("id",n)}get className(){return this.getAttribute("class")??""}set className(n){n==null?this.removeAttribute("class"):this.setAttribute("class",n)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(n){n==null?this.removeAttribute("for"):this.setAttribute("for",n)}set value(n){n==null?this.removeAttribute("value"):this.setAttribute("value",String(n))}set checked(n){n?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(n){n?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(n){}get textContent(){return this.childNodes.map(n=>n.textContent??"").join("")}set textContent(n){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,n!=null&&n!==""&&this.appendChild(new B(String(n)))}set innerText(n){this.textContent=n}set innerHTML(n){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=n==null?"":String(n)}cloneNode(n=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,n)for(let o of this.childNodes)r.appendChild(o.cloneNode(!0));return r}};var Fn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vt=/&/g,Hn=/</g,Vn=/>/g,Un=/"/g;function Ie(e){return e.replace(vt,"&amp;").replace(Hn,"&lt;").replace(Vn,"&gt;")}function Nt(e){return e.replace(vt,"&amp;").replace(Un,"&quot;")}function Wn(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Kn(e){if(!e)return"";let t=[];e.cssText&&t.push(e.cssText.trim().replace(/;\s*$/,""));for(let n of Object.keys(e)){if(n==="cssText")continue;let r=e[n];r==null||r===""||t.push(`${Wn(n)}: ${r}`)}return t.join("; ")}function zn(e){let t="",n=Kn(e.style);for(let[r,o]of e.attributes)r==="style"&&n||(t+=` ${r}="${Nt(o)}"`);if(n){let r=e.attributes.get("style"),o=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${Nt(o)}"`}return t}function E(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Ie(e);if(typeof e=="number")return Ie(String(e));if(typeof e=="function")return E(e());if(Array.isArray(e))return e.map(E).join("");switch(e.nodeType){case Oe:return Ie(e.data??"");case $e:return`<!--${e.data??""}-->`;case _e:{let t=e.localName,n=`<${t}${zn(e)}>`;if(Fn.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(E).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(E).join(""):""}import{createRoot as Ct}from"@fluixi/reactive/signal";import{setResourceTracker as Bn,setResourceIdSource as Gn,setResourceDataSink as Xn,getOwner as Jn,runWithOwner as St,flush as Yn}from"@fluixi/reactive/signal";var wt=!1;function Rt(){wt||(wt=!0,Xe({createElement:(e,t)=>new ue(e,t),createText:e=>new B(e),createComment:e=>new ce(e)}))}function Mt(e,t={}){let n=g;Rt(),P(!0);let r=V(t.event);try{return U(r,()=>Ct(o=>{try{let i=typeof e=="function"?e():e;return E(i)}finally{o()}}))}finally{P(n)}}var At=!1;function Zn(){At||(At=!0,Bn(e=>{S()?.pending.add(e)}),Gn(()=>S()?.nextResourceId()??""),Xn((e,t)=>{e&&S()?.data.set(e,t)}))}var qe=null;function Pt(e){qe=e}function je(e){if(e.data.size===0)return"";let t={};for(let[r,o]of e.data){let i=o;if(qe)try{i=qe(o,r)}catch{continue}i!==void 0&&(t[r]=i)}if(Object.keys(t).length===0)return"";let n=ae(JSON.stringify(t));return`<script type="application/json" id="${W}">${n}<\/script>`}var Qn=50;async function Lt(e,t={}){let n=g;Rt(),P(!0),Zn();let r=V(t.event);try{return await U(r,async()=>{t.preload&&await t.preload(t.event);let o,i=null,s=()=>{};Ct(f=>{s=f,i=Jn(),o=typeof e=="function"?e():e});let a=()=>{try{St(i,()=>E(o))}catch{}};a();let l=0;for(;r.pending.size>0&&l++<Qn;){let f=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(f),await Yn(),a()}let c=St(i,()=>E(o))+je(r);return s(),c})}finally{P(n)}}var er={createComponent:ie,createElement:ze,createNativeElement:ne,createTemplate:et,cloneTemplate:tt,createPortal:at,render:oe,hydrate:K,insert:b,appendChildren:Ge,removeChildren:Be,spread:it,applyProps:re,mergeProps:st,setProperty:D,setDynamicProperty:H,setAttribute:m,setDynamicAttribute:F,removeAttribute:Ke,getAttribute:We,setClassName:k,addClass:He,removeClass:Ve,toggleClass:Ue,setStyles:ye,delegateEvents:te,addDelegatedEventListener:Ee,removeDelegatedEventListener:J,handleRef:_,resetIntegration:ut,isIntegrationInitialized:ct},ls=er;export{Rn as Dynamic,_n as ErrorBoundary,W as FX_DATA_ID,En as For,vn as Index,fn as Island,pe as JSX_PROPERTIES,wn as Match,Ln as Portal,sr as SVG_ELEMENTS,O as SVG_NAMESPACE,xn as Show,An as Switch,ir as VOID_ELEMENTS,He as addClass,Ee as addDelegatedEventListener,nt as addNativeEventListener,Ge as appendChildren,de as applyElementProp,re as applyProps,rt as applyUse,Lr as asComponent,Pr as asContext,Rr as asOutlet,Mr as asProvider,Cr as asRoute,wr as asRouter,Ar as asRoutes,Dr as asSuspense,Ut as captureHydrationCursor,kr as checkRenderType,$n as classMap,C as cleanChildren,tt as cloneTemplate,lr as closest,ie as createComponent,ko as createDynamicElement,ze as createElement,ne as createNativeElement,at as createPortal,V as createRequestContext,et as createTemplate,ls as default,yr as delegate,te as delegateEvents,ae as escapeFxJson,Zr as escapeHTML,Gr as fnName,Kr as generateID,We as getAttribute,vr as getGlobal,rr as getLitEventName,yt as getLocals,pr as getOffset,S as getRequestContext,ve as getRequestEvent,Se as getRequestLocals,le as getServerData,Wr as getStableElementId,ur as getStyle,_ as handleRef,cr as hasClass,yn as html,K as hydrate,q as hydrateAdvancePast,pn as hydrateIslands,Ci as indexArray,no as initializeIntegration,b as insert,Y as insertExpression,ro as intergartionInitialized,Qr as isAccessor,T as isComponent,Ht as isContext,kt as isCustomElement,Er as isDOMNode,zr as isDelegatedEvent,ge as isDomElement,L as isDomNode,he as isDomText,nr as isEventHandler,Br as isFunction,ct as isIntegrationInitialized,Tr as isJSXTemplate,Ot as isLitTemplateResult,Yr as isNativeElement,jt as isOutlet,G as isPromise,Ft as isProvider,xr as isReactElement,qt as isRoute,$t as isRouter,It as isRoutes,lt as isSVGElement,g as isServer,Vt as isSuspense,br as isTemplateFactory,fr as isVisible,Xr as iterateFn,Ai as keyArray,Zt as makeArrayFlat,wi as mapArray,st as mergeProps,gr as observeIntersection,hr as observeResize,Fe as query,ar as queryAll,to as registerCreateComponent,Nr as registerGlobal,Ke as removeAttribute,Be as removeChildren,Ve as removeClass,J as removeDelegatedEventListener,oe as render,Mt as renderToString,Lt as renderToStringAsync,ut as resetIntegration,Wt as runHydrationAt,U as runWithRequestContext,Kt as runWithoutHydration,dr as scrollIntoView,E as serializeNode,je as serializeResourceData,m as setAttribute,Z as setClassList,k as setClassName,Pt as setDataRedactor,F as setDynamicAttribute,ot as setDynamicBoolAttribute,H as setDynamicProperty,D as setProperty,pt as setRequestStore,P as setServerMode,Q as setStyle,ye as setStyles,or as shouldSetAsProperty,Jr as splitProps,it as spread,jn as styleMap,mn as svg,tr as toAttributeName,Ue as toggleClass,mr as waitForElement};
1
+ function tr(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function nr(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function rr(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function or(e,t){let n=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),r={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return n.has(t)||r[e]&&r[e].has(t)}var ir=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),sr=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),O="http://www.w3.org/2000/svg";function kt(e){return e.localName.includes("-")}function de(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(kt(e)){e[t]=n;return}m(e,t,n,r)}var pe=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function Fe(e,t=document){return t.querySelector(e)}function ar(e,t=document){return Array.from(t.querySelectorAll(e))}function lr(e,t){return e.closest(t)}function He(e,...t){e.classList.add(...t)}function Ve(e,...t){e.classList.remove(...t)}function Ue(e,...t){t.forEach(n=>e.classList.toggle(n))}function cr(e,t){return e.classList.contains(t)}function m(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function We(e,t){return e.getAttribute(t)}function Ke(e,t){e.removeAttribute(t)}function ye(e,t){Object.assign(e.style,t)}function ur(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Be(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([o,i])=>{if(o==="class"||o==="className")r.className=i;else if(o==="style"&&typeof i=="object")ye(r,i);else if(o.startsWith("on")&&typeof i=="function"){let s=o.slice(2).toLowerCase();r.addEventListener(s,i)}else m(r,o,i)}),n.forEach(o=>{typeof o=="string"?r.appendChild(document.createTextNode(o)):r.appendChild(o)}),r}function ze(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Ge(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function fr(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function dr(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function pr(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function yr(e,t,n,r){let o=i=>{let s=i.target.closest(n);s&&e.contains(s)&&r(i,s)};return e.addEventListener(t,o),()=>{e.removeEventListener(t,o)}}function mr(e,t=5e3){return new Promise((n,r)=>{let o=Fe(e);if(o){n(o);return}let i=new MutationObserver(()=>{let a=Fe(e);a&&(i.disconnect(),clearTimeout(s),n(a))});i.observe(document.body,{childList:!0,subtree:!0});let s=setTimeout(()=>{i.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function gr(e,t,n={}){let r=new IntersectionObserver(o=>{o.forEach(i=>{t(i.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function hr(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var _t=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function xr(e){return typeof e=="object"&&e!==null&&e.$$typeof===_t}function Ot(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function Tr(e){if(typeof e!="function")return!1;try{let t=e();return Ot(t)}catch{return!1}}function br(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function Er(e){return e instanceof Node}function Nr(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function vr(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}import{isSignal as x}from"@fluixi/reactive/signal";function Ar(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function wr(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Rr(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Cr(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Mr(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Pr(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function Lr(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Dr(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function It(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function $t(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function qt(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function jt(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Ft(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Ht(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function b(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Vt(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function kr(e){return It(e)?{type:"router",value:e}:qt(e)?{type:"route",value:e}:$t(e)?{type:"routes",value:e}:jt(e)?{type:"outlet",value:e}:b(e)?{type:"component",value:e}:Vt(e)?{type:"suspense",value:e}:Ft(e)?{type:"provider",value:e}:Ht(e)?{type:"context",value:e}:{type:"none",value:e}}import{batch as Qe,createEffect as j,createRenderEffect as p,createRoot as Bt,onCleanup as C,readChildren as zt}from"@fluixi/reactive/signal";var g=typeof document>"u";function P(e){g=e}var I=Symbol.for("fluixi.server-node"),me=null;function Xe(e){me=e}function $(){if(!me)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return me}function L(e){return e!=null&&e[I]===!0?!0:typeof Node<"u"&&e instanceof Node}function ge(e){return e!=null&&e[I]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function he(e){return e!=null&&e[I]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},Je=null;function Ye(e){Je=e}function xe(){return Je}function Te(e,t){return u.active&&t.parentNode===e}function be(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function Ut(){return u.active?u.cursor:null}function Wt(e,t){if(!e||e.parentNode==null)return t();let n=u.active,r=u.cursor,o=u.parents;u.active=!0,u.cursor=e,u.parents=[];try{return t()}finally{u.active=n,u.cursor=r,u.parents=o}}function Kt(e){if(!u.active)return e();let t=u.cursor,n=u.parents;u.active=!1,u.parents=[];try{return e()}finally{u.active=!0,u.cursor=t,u.parents=n}}function q(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&be(t)}function Gt(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let r=0,o=e;for(;o=o.previousElementSibling;)o.tagName===e.tagName&&r++;n+=`:nth-of-type(${r+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function Xt(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function Wr(e){return Xt(Gt(e))}var Kr=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Jt={};var Ze=new Map,X=new Set,ee=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function te(e){if(!g)for(let t of e)X.has(t)||ee.has(t)||(X.add(t),document.addEventListener(t,Yt))}function Yt(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function Ee(e,t,n){if(e[`$$${t}`]=n,ee.has(t)){let r=`__fx_${t}`;if(!e[r]){let o=i=>{e[`$$${t}`]?.(i)};e.addEventListener(t,o),e[r]=o}return}X.has(t)||te([t])}function J(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function Br(e){return!ee.has(e)}function zr(e){return typeof e=="function"}function A(e,t=!1){if(g)return $().createText(e);if(u.active&&!t){let n=xe()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function ne(e,t=!1){if(g)return $().createElement(e,t);if(u.active){let n=xe()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(O,e):document.createElement(e)}function et(e,t=!1){let n=Ze.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,Ze.set(e,r),r}function tt(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Zt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Zt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Gr(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Xr(e){if(x(e)||b(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!x(t)&&!b(t);)t=t();return t}var v=0,Qt=200;function en(e,t,n,r,o){let i=r,s=new Map;return p(()=>{let a;if(b(e)&&!x(e)){if(!s.has(e)){v++;try{let l=e();s.set(e,l)}finally{v--}}for(a=s.get(e);typeof a=="function"&&x(a);)a=a()}else for(a=e();typeof a=="function"&&x(a);)a=a();{let l=0;for(;typeof a=="function"&&l++<50;)if(b(a)){if(!s.has(a)){let c=a;v++;try{let f=c();s.set(c,f)}finally{v--}}a=s.get(a)}else if(x(a))a=a();else if(a=a(),typeof a!="function"||!x(a)&&!b(a))break}v++;try{i=Y(t,a,n,i,s),o(i)}finally{v--}})}function T(e,t,n,r){if(v>Qt)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=A("",!0),e.appendChild(n));let o=r??null,i=l=>Array.isArray(l)&&l.some(c=>typeof c=="function"),s=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!i(t)){v++;try{o=Y(e,t,n,null)}finally{v--}return()=>o}let a=en(s(t),e,n,o,l=>{o=l});return()=>(a?.(),o)}function Y(e,t,n,r,o){if(t==null||typeof t=="boolean")return R(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return R(e,r,n);if(G(t)){let s=A("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(s,r[0]),R(e,r.slice(1),n)):h(e,s,n):r?e.replaceChild(s,r):h(e,s,n),t.then(a=>{s.parentNode===e&&Y(e,a,s.nextSibling,s)}).catch(a=>{console.error("Error resolving promise in insertExpression:",a)}),s}let i=typeof t;if(i==="string"||i==="number"){if(i==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let a=A(t);return h(e,a,n),a}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=R(e,r,n)}if(r&&he(r))return r.data=t,r;let s=A(t);return r&&r.parentNode===e?e.replaceChild(s,r):Te(e,s)||h(e,s,n),s}if(L(t))return Te(e,t)?(be(t),t):Array.isArray(r)?(r.length===0?h(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),R(e,r.slice(1),n)):h(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):h(e,t,n)):h(e,t,n),t);if(Array.isArray(t)){let s=[],a=Array.isArray(r)?r:r?[r]:[],l=[];N(t,s,e,n,!0,o,l);let c=tn(e,a,s,n);for(let f of l){let d=T(e,f.sig,f.marker);C(()=>{R(e,d()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return c}if(i==="object"&&t!==null&&typeof t=="object"){let s=t;if("type"in s&&"props"in s){let a=s;if(typeof a.type=="function"){let l=a.type(a.props||{});return Y(e,l,n,r)}}}return R(e,r,n)}function N(e,t,n,r,o=!0,i,s){for(let a=0;a<e.length;a++){let l=e[a];if(!(l==null||typeof l=="boolean")){for(;typeof l=="function"&&!G(l)&&!x(l)&&!b(l)&&(l=l(),!(l==null||typeof l=="boolean")););if(!(l==null||typeof l=="boolean")){if(typeof l=="function"){let c;for(b(l)&&!x(l)?(i||(i=new Map),i.has(l)||i.set(l,l()),c=i.get(l)):c=l();typeof c=="function"&&!G(c)&&!x(c)&&!b(c);)i||(i=new Map),i.has(c)||i.set(c,c()),c=i.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if(x(c)){if(s){let d=A("",!0);t.push(d),s.push({marker:d,sig:c});continue}let f=c();for(;typeof f=="function"&&x(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?N(f,t,n,r,o,i):N([f],t,n,r,o,i);continue}continue}Array.isArray(c)?N(c,t,n,r,o,i,s):N([c],t,n,r,o,i,s);continue}if(G(l)){let c=A("",!0);t.push(c),l.then(f=>{if(c.parentNode){let d=[];if(N([f],d,c.parentNode,void 0,!1,i),d.length>0){c.parentNode.replaceChild(d[0],c);for(let y=1;y<d.length;y++)c.parentNode?.insertBefore(d[y],d[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(l)){N(l,t,n,r,o,i,s);continue}if(L(l)){t.push(l);continue}if(typeof l=="object"&&l!==null&&"type"in l&&"props"in l){let c=l;if(typeof c.type=="function"){let f=c.type(c.props||{});Array.isArray(f)?N(f,t,n,r,!1,i):N([f],t,n,r,!1,i);continue}}if(typeof l=="string"||typeof l=="number"){let c=String(l);if(c.trim()===""&&c!==" ")continue;t.push(A(c));continue}t.push(A(String(l)))}}}}function tn(e,t,n,r){for(let d=0;d<n.length;d++)n[d].parentNode!==null&&n[d].parentNode!==e&&(n=n.slice(),n[d]=n[d].cloneNode(!0));let o=n.length,i=t.length,s=o,a=0,l=0,c=i>0?t[i-1].nextSibling??void 0:r,f=null;for(;a<i||l<s;){if(t[a]===n[l]){a++,l++;continue}for(;i>a&&s>l&&t[i-1]===n[s-1];)i--,s--;if(i===a){let d=s<o?l?n[l-1].nextSibling??void 0:n[s-l]:c;for(;l<s;)h(e,n[l++],d)}else if(s===l)for(;a<i;)(!f||!f.has(t[a]))&&t[a].parentNode===e&&e.removeChild(t[a]),a++;else if(t[a]===n[s-1]&&n[l]===t[i-1]){let d=t[--i].nextSibling;h(e,n[l++],t[a++].nextSibling),h(e,n[--s],d),t[i]=t[a-1]}else{if(!f){f=new Map;let y=l;for(;y<s;)f.set(n[y],y++)}let d=f.get(t[a]);if(d!=null)if(l<d&&d<s){let y=a,fe=1;for(;++y<i&&y<s&&!(!f.has(t[y])||f.get(t[y])!==d+fe);)fe++;if(fe>d-l){let Dt=t[a];for(;l<d;)h(e,n[l++],Dt)}else t[a].parentNode===e?e.replaceChild(n[l++],t[a++]):(h(e,n[l++],c),a++)}else a++;else t[a].parentNode===e&&e.removeChild(t[a]),a++}}return n}function R(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function h(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function D(e,t,n){n==null?delete e[t]:e[t]=n}function nt(e,t,n){let r=n,o;return Array.isArray(n)&&(r=n[0],o=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,o),()=>e.removeEventListener(t,r,o))}function rt(e,t){let n=(r,o)=>{typeof r=="function"&&r(e,o??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function F(e,t,n,r=!1){return typeof n!="function"?(m(e,t,n,r),()=>{}):p(()=>{let o=typeof n=="function"?n():n;m(e,t,o,r)})}function H(e,t,n){return typeof n!="function"?(D(e,t,n),()=>{}):p(()=>{let r=typeof n=="function"?n():n;D(e,t,r)})}function ot(e,t,n){return typeof n!="function"?(m(e,t,!!n),()=>{}):p(()=>{let r=n();m(e,t,!!r)})}function k(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){p(()=>k(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let o=t[r];return typeof o=="function"?o():!!o}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function Z(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let o=t[r],i=r.split(/\s+/).filter(Boolean);if(typeof o=="function"&&n)n.push(p(()=>{let s=!!o();for(let a of i)e.classList.toggle(a,s)}));else{let s=!!(typeof o=="function"?o():o);for(let a of i)e.classList.toggle(a,s)}}}function Q(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let o=n[r];o==null?e.style[r]="":e.style[r]=o}}function it(e){let{element:t,props:n,prevProps:r=Jt,isSVG:o=!1,skipChildren:i=!1}=e;if(!t||!ge(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let s=o||t.namespaceURI===O,a=[];for(let l in n){if(i&&l==="children")continue;let c=n[l],f=r[l];if(c===f)continue;if(l==="ref"){_(c,t);continue}if(l==="use"){rt(t,c);continue}if(l.startsWith("on:")){a.push(nt(t,l.slice(3),c));continue}if(l.startsWith("prop:")){a.push(H(t,l.slice(5),c));continue}if(l.startsWith("attr:")){a.push(F(t,l.slice(5),c,s));continue}if(l.startsWith("bool:")){a.push(ot(t,l.slice(5),c));continue}if(l==="class"||l==="className"){typeof c=="function"?a.push(p(()=>k(t,c()))):k(t,c);continue}if(l==="classList"){typeof c=="function"?a.push(p(()=>Z(t,c()))):Z(t,c,a);continue}if(l==="style"){typeof c=="function"?a.push(p(()=>Q(t,c()))):Q(t,c);continue}if(l.startsWith("on")){let y=l.slice(2).toLowerCase();f&&J(t,y),c&&Ee(t,y,c);continue}let d=pe.has(l)||!s&&l in t;typeof c=="function"?a.push(d?H(t,l,c):F(t,l,c,s)):a.push(p(()=>d?D(t,l,n[l]):m(t,l,n[l],s)))}for(let l in r)if(!(l in n))if(l.startsWith("on")){let c=l.slice(2).toLowerCase();J(t,c)}else pe.has(l)?D(t,l,null):t.removeAttribute(l);return()=>{a.forEach(l=>l())}}function re(e,t,n=!1){for(let r in t){let o=t[r];if(r==="ref"){_(o,e);continue}if(r!=="children"){if(r==="use"){rt(e,o);continue}if(r.startsWith("on:")){nt(e,r.slice(3),o);continue}if(r.startsWith("prop:")){H(e,r.slice(5),o);continue}if(r.startsWith("attr:")){F(e,r.slice(5),o,n);continue}if(r.startsWith("bool:")){ot(e,r.slice(5),o);continue}if(r.startsWith("on")&&r.length>2){let i=r.slice(2).toLowerCase();if(typeof o=="function")if(ee.has(i)){e[`$$${i}`]=o;let s=`__fx_${i}`;if(!e[s]){let a=l=>{e[`$$${i}`]?.(l)};e.addEventListener(i,a),e[s]=a}}else e[`$$${i}`]=o,X.has(i)||te([i]);continue}if(r==="class"||r==="className"){k(e,o);continue}if(r==="classList"){typeof o=="function"?p(()=>Z(e,o())):Z(e,o);continue}if(r==="style"){typeof o=="function"?p(()=>Q(e,o())):Q(e,o);continue}if(r==="innerHTML"){if(typeof o=="function"){let i=j(()=>{let s=o();for(;typeof s=="function";)s=s();e.innerHTML=s});C(()=>i())}else e.innerHTML=o;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof o=="function"){let i=j(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.value=s??"")});C(()=>{i()})}else p(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof o=="function"){let i=j(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.checked=s??"")});C(()=>{i()})}else p(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof o=="function"){let i=!0,s=j(()=>{let a=o();for(;typeof a=="function"&&a.length===0;)a=a();i?(i=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""});C(()=>{s()})}else{let i=!0;p(()=>{let s=t[r];i?(i=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""})}continue}if(typeof o=="function"){let i=j(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();de(e,r,s,n)});C(()=>{i()})}else p(()=>de(e,r,t[r],n))}}}function st(...e){let t=r=>{for(let o=e.length-1;o>=0;o--){let i=e[o];if(i&&r in i&&i[r]!==void 0)return i[r]}},n=r=>{for(let o of e)if(o&&r in o)return!0;return!1};return new Proxy({},{get:(r,o)=>t(o),has:(r,o)=>n(o),ownKeys:()=>{let r=new Set;for(let o of e)if(o)for(let i of Reflect.ownKeys(o))r.add(i);return[...r]},getOwnPropertyDescriptor:(r,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>t(o)}:void 0})}function Jr(e,...t){let n=new Set;for(let s of t)for(let a of s)n.add(a);let r=s=>({enumerable:!0,configurable:!0,get:()=>e[s]}),o=t.map(s=>{let a=new Set(s);return new Proxy({},{get:(l,c)=>a.has(c)?e[c]:void 0,has:(l,c)=>a.has(c)&&c in e,ownKeys:()=>Array.from(a).filter(l=>l in e),getOwnPropertyDescriptor:(l,c)=>a.has(c)&&c in e?r(c):void 0})}),i=new Proxy({},{get:(s,a)=>n.has(a)?void 0:e[a],has:(s,a)=>!n.has(a)&&a in e,ownKeys:()=>Reflect.ownKeys(e).filter(s=>!n.has(s)),getOwnPropertyDescriptor:(s,a)=>!n.has(a)&&a in e?r(a):void 0});return[...o,i]}function _(e,t){if(e){if(L(e)){let n=t,r=e;if(!n)return;typeof n=="function"?n(r):typeof n=="object"&&"current"in n&&(n.current=r);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function at(e,t,n){let r=t||document.body,o=zt(()=>e),i=[];return Qe(()=>{let s=p(()=>{let a=o();Array.isArray(a)?(a.forEach(l=>r.appendChild(l)),i.push(()=>{a.forEach(l=>{l.parentNode===r&&r.removeChild(l)})})):L(a)&&(r.appendChild(a),i.push(()=>{a.parentNode===r&&r.removeChild(a)}))});i.push(s),C(()=>{i.forEach(a=>a())})}),null}function Yr(e){return typeof e=="string"&&e.toLowerCase()===e}function lt(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function Zr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function G(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Qr(e){return typeof e=="function"&&e.length===0&&x(e)}function oe(e,t,n){if(!t)throw new Error("Container element is required");let r,o,i=[];return Bt(s=>{Qe(()=>{u.active||(t.textContent=""),T(t,e)}),o=s}),()=>{o?.(),r?.(),i.forEach(s=>s()),t.textContent=""}}var nn="__fx_dom_create_component__",M=globalThis[nn]??={fn:null};function to(e){M.fn=e}function no(e={}){let t=e.signalSystem?.createComponent;t&&(M.fn=t)}function ie(e,t){return M.fn?M.fn(e,t):(()=>e(t))}var ro=()=>M.fn!==null,ct=()=>M.fn!==null;function ut(){M.fn=null}var se,dt={getStore:()=>se,run(e,t){let n=se;se=e;try{return t()}finally{se=n}}},Ne=dt;function pt(e){Ne=e??dt}function V(e={}){e.locals||(e.locals=e.request?Se(e.request):{});let t=0,n=0,r=null,o=new Map,i=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let s=o.get(r)??0;return o.set(r,s+1),`${r}:r${s}`},nextIslandNamespace:s=>{let a=i.get(s)??0;return i.set(s,a+1),`${s}#${a}`},withResourceScope(s,a){let l=r;r=s;try{return a()}finally{r=l}},pending:new Set,data:new Map}}function U(e,t){return Ne.run(e,t)}function S(){return Ne.getStore()}function ve(){return S()?.event}function yt(){let e=ve();return e?(e.locals||(e.locals={}),e.locals):{}}var ft=new WeakMap;function Se(e){let t=ft.get(e);return t||(t={},ft.set(e,t)),t}import{setResourceIdSource as rn,setServerDataGetter as on}from"@fluixi/reactive/signal";var W="__FX_DATA__";function ae(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Ae;function le(){let e=globalThis.__FX_DATA__;if(e)return e;if(Ae!==void 0)return Ae;let t=null;if(typeof document<"u"){let n=document.getElementById(W)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Ae=t}function we(){for(;;){for(;u.cursor&&u.cursor.nodeType===3&&u.cursor.data==="";)u.cursor=u.cursor.nextSibling;if(u.cursor!=null||!u.parents.length)return;u.cursor=u.parents.pop().nextSibling}}var sn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Re=typeof process<"u"&&process.env&&!1;function Ce(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function an(e){we();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(sn.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(Re&&t&&Ce(`<${e}>`,t),null)}function ln(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}we();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(Re&&t&&Ce(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function cn(e){we();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(Re&&t&&Ce(`marker <!--${e.slice(0,24)}-->`,t),null)}var mt=!1;function un(){mt||(mt=!0,Ye({hydrateElement:an,hydrateText:ln,hydrateMarker:cn}))}function K(e,t,n){un(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=le(),o=n?.resourceNamespace,i=0;rn(()=>o?`${o}:r${i++}`:`r${i++}`),on(r?s=>s in r?{value:r[s]}:void 0:null);try{return oe(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var Me="fluixi-island";function fn(e){let{component:t,props:n={},name:r}=e,o=ne(Me),i=r??t.name??"Island";m(o,"name",i),m(o,"props",JSON.stringify(n??{}));let s=g?S():void 0;if(s){let a=s.nextIslandNamespace(i);T(o,()=>s.withResourceScope(a,()=>t(n)))}else T(o,()=>t(n));return o}var gt=!1;function dn(){if(gt||typeof document>"u")return;gt=!0;let e=document.createElement("style");e.textContent=`${Me}{display:contents}`,document.head.appendChild(e)}function pn(e){if(typeof document>"u")return;dn();let t=document.querySelectorAll(Me),n=new Map;t.forEach(r=>{let o=r.getAttribute("name")??"",i=n.get(o)??0;n.set(o,i+1);let s=e[o];if(!s){typeof process>"u"&&console.warn(`[fluixi] island "${o}" has no component in the registry — left static.`);return}let a={};try{a=JSON.parse(r.getAttribute("props")||"{}")}catch{}K(()=>s(a),r,{resourceNamespace:`${o}#${i}`})})}function yn(e,...t){throw new Error("html`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function mn(e,...t){throw new Error("svg`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}import{readChildren as gn}from"@fluixi/reactive/signal";function ko(e,t={}){if(typeof e=="function")return ie(e,t);if(typeof e!="string"||e.length===0)return null;let n=lt(e);if(g)return $().createElement(e,n);let r=n?document.createElementNS(O,e):document.createElement(e);return re(r,t,n),hn(r,t),r}function hn(e,t){if(!t||t.children===void 0)return;let n=gn(()=>t.children),r=o=>{T(e,o,typeof o=="function"?null:void 0)};Array.isArray(n)?n.forEach(r):r(n)}import{createMemo as Pe,untrack as bt}from"@fluixi/reactive/signal";function ht(e){return typeof e=="function"?e:(()=>e)}function w(e){return()=>{let t=e();return typeof t=="function"?t():t}}function xt(e){return e!=null&&e!==!1}function Tt(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function xn(e){let t=w(()=>e.when),n=Pe(t,void 0),r=Pe(n,void 0);return Pe(()=>{if(r()){let i=e.children;return typeof i=="function"&&!Tt(i)?typeof n=="function"?bt(()=>bt(n)?i(n()):e.fallback):i(n):i}return e.fallback},void 0,{name:"show"})}import{mapArray as Tn,keyArray as bn}from"@fluixi/reactive/signal";function En(e){let t=w(()=>e.each),n=()=>e.fallback??null,r=(o,i)=>{let s=e.children,a=Array.isArray(s)?s.map(l=>typeof l=="function"?l(o,i):l):typeof s=="function"?s(o,i):s;return q(a),a};return e.by?bn(t,e.by,(o,i)=>r(o,i),{fallback:n}):Tn(t,(o,i)=>r(o,i),{fallback:n})}import{indexArray as Nn}from"@fluixi/reactive/signal";function vn(e){let t=w(()=>e.each);return Nn(t,(n,r)=>{let o=e.children(n,r);return q(o),o},{fallback:()=>e.fallback??null})}import{mapArray as Ai,keyArray as wi,indexArray as Ri}from"@fluixi/reactive/signal";import{createMemo as Sn}from"@fluixi/reactive/signal";var Le=Symbol("match");function An(e){return{[Le]:!0,when:w(()=>e.when),children:e.children}}function wn(e){let t=Array.isArray(e.children)?e.children:[e.children];return Sn(()=>{for(let n of t){let r=n,o=0;for(;typeof r=="function"&&!r[Le]&&o++<10;)r=r();if(!r||typeof r!="object"||r[Le]!==!0)continue;let i=r.when();if(xt(i))return typeof r.children=="function"?r.children(i):r.children}return e.fallback??null})}import{createMemo as Rn}from"@fluixi/reactive/signal";function Cn(e){let t=ht(e.component),{component:n,...r}=e;return Rn(()=>{let o=t();return o==null?null:typeof o=="string"?{tag:o,props:r}:o(r)})}import{createRoot as Mn,onCleanup as Pn}from"@fluixi/reactive/signal";function Ln(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return Mn(o=>{n=o,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),T(r,e.children)&&_(e.ref,r)}),Pn(()=>{n(),r.remove()}),null}import{createMemo as Dn,createSignal as kn}from"@fluixi/reactive/signal";function _n(e){let[t,n]=kn(null),r=()=>n(null);return Dn(()=>{let o=t();if(o!==null)return typeof e.fallback=="function"?e.fallback(o,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(i){return n(i),typeof e.fallback=="function"?e.fallback(i,r):e.fallback}})}import{createMemo as On}from"@fluixi/reactive/signal";function In(e){return On(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;(typeof o=="function"?o():o)&&n.push(r)}return n.join(" ")})}import{createMemo as $n}from"@fluixi/reactive/signal";function qn(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function jn(e){return $n(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;let i=typeof o=="function"?o():o;i!=null&&n.push(`${qn(r)}: ${i}`)}return n.join("; ")})}var _e=1,Oe=3,Ie=8,Et;Et=I;var B=class{constructor(){this[Et]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let n=t.childNodes.indexOf(this);return n>=0?t.childNodes[n+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let n=t.childNodes.indexOf(this);return n>0?t.childNodes[n-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,n){if(n==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(n);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let n=this.childNodes.indexOf(t);return n>=0&&this.childNodes.splice(n,1),t.parentNode=null,t}replaceChild(t,n){let r=this.childNodes.indexOf(n);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,n.parentNode=null),n}addEventListener(){}removeEventListener(){}},z=class e extends B{constructor(n){super();this.nodeType=Oe;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}get textContent(){return this.data}set textContent(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},ce=class e extends B{constructor(n){super();this.nodeType=Ie;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},De=class{constructor(){this.cssText=""}setProperty(t,n){this[t]=n}removeProperty(t){delete this[t]}},ke=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let n=this.list();for(let r of t)n.includes(r)||n.push(r);this.write(n)}remove(...t){this.write(this.list().filter(n=>!t.includes(n)))}contains(t){return this.list().includes(t)}toggle(t,n){let r=this.contains(t),o=n===void 0?!r:n;return o?this.add(t):this.remove(t),o}},ue=class e extends B{constructor(n,r=!1){super();this.nodeType=_e;this.attributes=new Map;this.style=new De;this.classList=new ke(this);this.rawHTML=null;this.localName=n.toLowerCase(),this.tagName=r?n:n.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(n,r){this.attributes.set(n,String(r))}removeAttribute(n){this.attributes.delete(n)}getAttribute(n){return this.attributes.has(n)?this.attributes.get(n):null}hasAttribute(n){return this.attributes.has(n)}get id(){return this.getAttribute("id")??""}set id(n){n==null?this.removeAttribute("id"):this.setAttribute("id",n)}get className(){return this.getAttribute("class")??""}set className(n){n==null?this.removeAttribute("class"):this.setAttribute("class",n)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(n){n==null?this.removeAttribute("for"):this.setAttribute("for",n)}set value(n){n==null?this.removeAttribute("value"):this.setAttribute("value",String(n))}set checked(n){n?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(n){n?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(n){}get textContent(){return this.childNodes.map(n=>n.textContent??"").join("")}set textContent(n){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,n!=null&&n!==""&&this.appendChild(new z(String(n)))}set innerText(n){this.textContent=n}set innerHTML(n){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=n==null?"":String(n)}cloneNode(n=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,n)for(let o of this.childNodes)r.appendChild(o.cloneNode(!0));return r}};var Fn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vt=/&/g,Hn=/</g,Vn=/>/g,Un=/"/g;function $e(e){return e.replace(vt,"&amp;").replace(Hn,"&lt;").replace(Vn,"&gt;")}function Nt(e){return e.replace(vt,"&amp;").replace(Un,"&quot;")}function Wn(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Kn(e){if(!e)return"";let t=[];e.cssText&&t.push(e.cssText.trim().replace(/;\s*$/,""));for(let n of Object.keys(e)){if(n==="cssText")continue;let r=e[n];r==null||r===""||t.push(`${Wn(n)}: ${r}`)}return t.join("; ")}function Bn(e){let t="",n=Kn(e.style);for(let[r,o]of e.attributes)r==="style"&&n||(t+=` ${r}="${Nt(o)}"`);if(n){let r=e.attributes.get("style"),o=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${Nt(o)}"`}return t}function E(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return $e(e);if(typeof e=="number")return $e(String(e));if(typeof e=="function")return E(e());if(Array.isArray(e))return e.map(E).join("");switch(e.nodeType){case Oe:return $e(e.data??"");case Ie:return`<!--${e.data??""}-->`;case _e:{let t=e.localName,n=`<${t}${Bn(e)}>`;if(Fn.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(E).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(E).join(""):""}import{createRoot as Rt}from"@fluixi/reactive/signal";import{setResourceTracker as zn,setResourceIdSource as Gn,setResourceDataSink as Xn,getOwner as Jn,runWithOwner as St,flush as Yn}from"@fluixi/reactive/signal";var At=!1;function Ct(){At||(At=!0,Xe({createElement:(e,t)=>new ue(e,t),createText:e=>new z(e),createComment:e=>new ce(e)}))}function Mt(e,t={}){let n=g;Ct(),P(!0);let r=V(t.event);try{return U(r,()=>Rt(o=>{try{let i=typeof e=="function"?e():e;return E(i)}finally{o()}}))}finally{P(n)}}var wt=!1;function Zn(){wt||(wt=!0,zn(e=>{S()?.pending.add(e)}),Gn(()=>S()?.nextResourceId()??""),Xn((e,t)=>{e&&S()?.data.set(e,t)}))}var qe=null;function Pt(e){qe=e}function je(e){if(e.data.size===0)return"";let t={};for(let[r,o]of e.data){let i=o;if(qe)try{i=qe(o,r)}catch{continue}i!==void 0&&(t[r]=i)}if(Object.keys(t).length===0)return"";let n=ae(JSON.stringify(t));return`<script type="application/json" id="${W}">${n}<\/script>`}var Qn=50;async function Lt(e,t={}){let n=g;Ct(),P(!0),Zn();let r=V(t.event);try{return await U(r,async()=>{t.preload&&await t.preload(t.event);let o,i=null,s=()=>{};Rt(f=>{s=f,i=Jn(),o=typeof e=="function"?e():e});let a=()=>{try{St(i,()=>E(o))}catch{}};a();let l=0;for(;r.pending.size>0&&l++<Qn;){let f=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(f),await Yn(),a()}let c=St(i,()=>E(o))+je(r);return s(),c})}finally{P(n)}}var er={createComponent:ie,createElement:Be,createNativeElement:ne,createTemplate:et,cloneTemplate:tt,createPortal:at,render:oe,hydrate:K,insert:T,appendChildren:Ge,removeChildren:ze,spread:it,applyProps:re,mergeProps:st,setProperty:D,setDynamicProperty:H,setAttribute:m,setDynamicAttribute:F,removeAttribute:Ke,getAttribute:We,setClassName:k,addClass:He,removeClass:Ve,toggleClass:Ue,setStyles:ye,delegateEvents:te,addDelegatedEventListener:Ee,removeDelegatedEventListener:J,handleRef:_,resetIntegration:ut,isIntegrationInitialized:ct},ls=er;export{Cn as Dynamic,_n as ErrorBoundary,W as FX_DATA_ID,En as For,vn as Index,fn as Island,pe as JSX_PROPERTIES,An as Match,Ln as Portal,sr as SVG_ELEMENTS,O as SVG_NAMESPACE,xn as Show,wn as Switch,ir as VOID_ELEMENTS,He as addClass,Ee as addDelegatedEventListener,nt as addNativeEventListener,Ge as appendChildren,de as applyElementProp,re as applyProps,rt as applyUse,Lr as asComponent,Pr as asContext,Cr as asOutlet,Mr as asProvider,Rr as asRoute,Ar as asRouter,wr as asRoutes,Dr as asSuspense,Ut as captureHydrationCursor,kr as checkRenderType,In as classMap,R as cleanChildren,tt as cloneTemplate,lr as closest,ie as createComponent,ko as createDynamicElement,Be as createElement,ne as createNativeElement,at as createPortal,V as createRequestContext,et as createTemplate,ls as default,yr as delegate,te as delegateEvents,ae as escapeFxJson,Zr as escapeHTML,Gr as fnName,Kr as generateID,We as getAttribute,vr as getGlobal,rr as getLitEventName,yt as getLocals,pr as getOffset,S as getRequestContext,ve as getRequestEvent,Se as getRequestLocals,le as getServerData,Wr as getStableElementId,ur as getStyle,_ as handleRef,cr as hasClass,yn as html,K as hydrate,q as hydrateAdvancePast,pn as hydrateIslands,Ri as indexArray,no as initializeIntegration,T as insert,Y as insertExpression,ro as intergartionInitialized,Qr as isAccessor,b as isComponent,Ht as isContext,kt as isCustomElement,Er as isDOMNode,Br as isDelegatedEvent,ge as isDomElement,L as isDomNode,he as isDomText,nr as isEventHandler,zr as isFunction,ct as isIntegrationInitialized,br as isJSXTemplate,Ot as isLitTemplateResult,Yr as isNativeElement,jt as isOutlet,G as isPromise,Ft as isProvider,xr as isReactElement,qt as isRoute,It as isRouter,$t as isRoutes,lt as isSVGElement,g as isServer,Vt as isSuspense,Tr as isTemplateFactory,fr as isVisible,Xr as iterateFn,wi as keyArray,Zt as makeArrayFlat,Ai as mapArray,st as mergeProps,gr as observeIntersection,hr as observeResize,Fe as query,ar as queryAll,to as registerCreateComponent,Nr as registerGlobal,Ke as removeAttribute,ze as removeChildren,Ve as removeClass,J as removeDelegatedEventListener,oe as render,Mt as renderToString,Lt as renderToStringAsync,ut as resetIntegration,Wt as runHydrationAt,U as runWithRequestContext,Kt as runWithoutHydration,dr as scrollIntoView,E as serializeNode,je as serializeResourceData,m as setAttribute,Z as setClassList,k as setClassName,Pt as setDataRedactor,F as setDynamicAttribute,ot as setDynamicBoolAttribute,H as setDynamicProperty,D as setProperty,pt as setRequestStore,P as setServerMode,Q as setStyle,ye as setStyles,or as shouldSetAsProperty,Jr as splitProps,it as spread,jn as styleMap,mn as svg,tr as toAttributeName,Ue as toggleClass,mr as waitForElement};
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},te=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Z(t))!Q.call(e,s)&&s!==n&&P(e,s,{get:()=>t[s],enumerable:!(o=Y(t,s))||o.enumerable});return e};var ne=e=>te(P({},"__esModule",{value:!0}),e);var Ee={};ee(Ee,{createDynamicElement:()=>he});module.exports=ne(Ee);var g=require("@fluixi/reactive/signal");var M="http://www.w3.org/2000/svg";function oe(e){return e.localName.includes("-")}function R(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(oe(e)){e[t]=n;return}T(e,t,n,o)}function T(e,t,n,o=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}var Ne=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function E(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var d=require("@fluixi/reactive/signal");var S=typeof document>"u";var $=Symbol.for("fluixi.server-node"),j=null;function w(){if(!j)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return j}function v(e){return e!=null&&e[$]===!0?!0:typeof Node<"u"&&e instanceof Node}function D(e){return e!=null&&e[$]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var b={active:!1,cursor:null,parents:[]},ie=null;function F(){return ie}function O(e,t){return b.active&&t.parentNode===e}function I(e){let t=b.parents.lastIndexOf(e);t!==-1&&(b.parents.length=t),b.cursor=e.nextSibling}var _=new Set,K=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function re(e){if(!S)for(let t of e)_.has(t)||K.has(t)||(_.add(t),document.addEventListener(t,se))}function se(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function x(e,t=!1){if(S)return w().createText(e);if(b.active&&!t){let n=F()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var h=0,fe=200;function ae(e,t,n,o,s){let a=o,i=new Map;return(0,d.createRenderEffect)(()=>{let r;if(E(e)&&!(0,g.isSignal)(e)){if(!i.has(e)){h++;try{let f=e();i.set(e,f)}finally{h--}}for(r=i.get(e);typeof r=="function"&&(0,g.isSignal)(r);)r=r()}else for(r=e();typeof r=="function"&&(0,g.isSignal)(r);)r=r();{let f=0;for(;typeof r=="function"&&f++<50;)if(E(r)){if(!i.has(r)){let l=r;h++;try{let u=l();i.set(l,u)}finally{h--}}r=i.get(r)}else if((0,g.isSignal)(r))r=r();else if(r=r(),typeof r!="function"||!(0,g.isSignal)(r)&&!E(r))break}h++;try{a=C(t,r,n,a,i),s(a)}finally{h--}})}function H(e,t,n,o){if(h>fe)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=x("",!0),e.appendChild(n));let s=o??null,a=f=>Array.isArray(f)&&f.some(l=>typeof l=="function"),i=f=>typeof f=="function"?f:()=>f;if(typeof t!="function"&&!a(t)){h++;try{s=C(e,t,n,null)}finally{h--}return()=>s}let r=ae(i(t),e,n,s,f=>{s=f});return()=>(r?.(),s)}function C(e,t,n,o,s){if(t==null||typeof t=="boolean")return N(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return N(e,o,n);if(A(t)){let i=x("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(i,o[0]),N(e,o.slice(1),n)):p(e,i,n):o?e.replaceChild(i,o):p(e,i,n),t.then(r=>{i.parentNode===e&&C(e,r,i.nextSibling,i)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),i}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let r=x(t);return p(e,r,n),r}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=N(e,o,n)}if(o&&D(o))return o.data=t,o;let i=x(t);return o&&o.parentNode===e?e.replaceChild(i,o):O(e,i)||p(e,i,n),i}if(v(t))return O(e,t)?(I(t),t):Array.isArray(o)?(o.length===0?p(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),N(e,o.slice(1),n)):p(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):p(e,t,n)):p(e,t,n),t);if(Array.isArray(t)){let i=[],r=Array.isArray(o)?o:o?[o]:[],f=[];m(t,i,e,n,!0,s,f);let l=le(e,r,i,n);for(let u of f){let c=H(e,u.sig,u.marker);(0,d.onCleanup)(()=>{N(e,c()),u.marker.parentNode===e&&e.removeChild(u.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let i=t;if("type"in i&&"props"in i){let r=i;if(typeof r.type=="function"){let f=r.type(r.props||{});return C(e,f,n,o)}}}return N(e,o,n)}function m(e,t,n,o,s=!0,a,i){for(let r=0;r<e.length;r++){let f=e[r];if(!(f==null||typeof f=="boolean")){for(;typeof f=="function"&&!A(f)&&!(0,g.isSignal)(f)&&!E(f)&&(f=f(),!(f==null||typeof f=="boolean")););if(!(f==null||typeof f=="boolean")){if(typeof f=="function"){let l;for(E(f)&&!(0,g.isSignal)(f)?(a||(a=new Map),a.has(f)||a.set(f,f()),l=a.get(f)):l=f();typeof l=="function"&&!A(l)&&!(0,g.isSignal)(l)&&!E(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if((0,g.isSignal)(l)){if(i){let c=x("",!0);t.push(c),i.push({marker:c,sig:l});continue}let u=l();for(;typeof u=="function"&&(0,g.isSignal)(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?m(u,t,n,o,s,a):m([u],t,n,o,s,a);continue}continue}Array.isArray(l)?m(l,t,n,o,s,a,i):m([l],t,n,o,s,a,i);continue}if(A(f)){let l=x("",!0);t.push(l),f.then(u=>{if(l.parentNode){let c=[];if(m([u],c,l.parentNode,void 0,!1,a),c.length>0){l.parentNode.replaceChild(c[0],l);for(let y=1;y<c.length;y++)l.parentNode?.insertBefore(c[y],c[y-1].nextSibling)}}}).catch(u=>console.error("Error resolving promise in array:",u));continue}if(Array.isArray(f)){m(f,t,n,o,s,a,i);continue}if(v(f)){t.push(f);continue}if(typeof f=="object"&&f!==null&&"type"in f&&"props"in f){let l=f;if(typeof l.type=="function"){let u=l.type(l.props||{});Array.isArray(u)?m(u,t,n,o,!1,a):m([u],t,n,o,!1,a);continue}}if(typeof f=="string"||typeof f=="number"){let l=String(f);if(l.trim()===""&&l!==" ")continue;t.push(x(l));continue}t.push(x(String(f)))}}}}function le(e,t,n,o){for(let c=0;c<n.length;c++)n[c].parentNode!==null&&n[c].parentNode!==e&&(n=n.slice(),n[c]=n[c].cloneNode(!0));let s=n.length,a=t.length,i=s,r=0,f=0,l=a>0?t[a-1].nextSibling??void 0:o,u=null;for(;r<a||f<i;){if(t[r]===n[f]){r++,f++;continue}for(;a>r&&i>f&&t[a-1]===n[i-1];)a--,i--;if(a===r){let c=i<s?f?n[f-1].nextSibling??void 0:n[i-f]:l;for(;f<i;)p(e,n[f++],c)}else if(i===f)for(;r<a;)(!u||!u.has(t[r]))&&t[r].parentNode===e&&e.removeChild(t[r]),r++;else if(t[r]===n[i-1]&&n[f]===t[a-1]){let c=t[--a].nextSibling;p(e,n[f++],t[r++].nextSibling),p(e,n[--i],c),t[a]=t[r-1]}else{if(!u){u=new Map;let y=f;for(;y<i;)u.set(n[y],y++)}let c=u.get(t[r]);if(c!=null)if(f<c&&c<i){let y=r,L=1;for(;++y<a&&y<i&&!(!u.has(t[y])||u.get(t[y])!==c+L);)L++;if(L>c-f){let J=t[r];for(;f<c;)p(e,n[f++],J)}else t[r].parentNode===e?e.replaceChild(n[f++],t[r++]):(p(e,n[f++],l),r++)}else r++;else t[r].parentNode===e&&e.removeChild(t[r]),r++}}return n}function N(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function p(e,t,n){b.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function W(e,t,n){n==null?delete e[t]:e[t]=n}function ue(e,t,n){let o=n,s;return Array.isArray(n)&&(o=n[0],s=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s))}function ce(e,t){let n=(o,s)=>{typeof o=="function"&&o(e,s??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function de(e,t,n,o=!1){return typeof n!="function"?(T(e,t,n,o),()=>{}):(0,d.createRenderEffect)(()=>{let s=typeof n=="function"?n():n;T(e,t,s,o)})}function ye(e,t,n){return typeof n!="function"?(W(e,t,n),()=>{}):(0,d.createRenderEffect)(()=>{let o=typeof n=="function"?n():n;W(e,t,o)})}function pe(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):(0,d.createRenderEffect)(()=>{let o=n();T(e,t,!!o)})}function G(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,d.createRenderEffect)(()=>G(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(o=>{let s=t[o];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function k(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let s=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push((0,d.createRenderEffect)(()=>{let i=!!s();for(let r of a)e.classList.toggle(r,i)}));else{let i=!!(typeof s=="function"?s():s);for(let r of a)e.classList.toggle(r,i)}}}function V(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let o in n){let s=n[o];s==null?e.style[o]="":e.style[o]=s}}function B(e,t,n=!1){for(let o in t){let s=t[o];if(o==="ref"){ge(s,e);continue}if(o!=="children"){if(o==="use"){ce(e,s);continue}if(o.startsWith("on:")){ue(e,o.slice(3),s);continue}if(o.startsWith("prop:")){ye(e,o.slice(5),s);continue}if(o.startsWith("attr:")){de(e,o.slice(5),s,n);continue}if(o.startsWith("bool:")){pe(e,o.slice(5),s);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof s=="function")if(K.has(a)){e[`$$${a}`]=s;let i=`__fx_${a}`;if(!e[i]){let r=f=>{e[`$$${a}`]?.(f)};e.addEventListener(a,r),e[i]=r}}else e[`$$${a}`]=s,_.has(a)||re([a]);continue}if(o==="class"||o==="className"){G(e,s);continue}if(o==="classList"){typeof s=="function"?(0,d.createRenderEffect)(()=>k(e,s())):k(e,s);continue}if(o==="style"){typeof s=="function"?(0,d.createRenderEffect)(()=>V(e,s())):V(e,s);continue}if(o==="innerHTML"){if(typeof s=="function"){let a=(0,d.createEffect)(()=>{let i=s();for(;typeof i=="function";)i=i();e.innerHTML=i});(0,d.onCleanup)(()=>a())}else e.innerHTML=s;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof s=="function"){let a=(0,d.createEffect)(()=>{let i=s();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.value=i??"")});(0,d.onCleanup)(()=>{a()})}else(0,d.createRenderEffect)(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof s=="function"){let a=(0,d.createEffect)(()=>{let i=s();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.checked=i??"")});(0,d.onCleanup)(()=>{a()})}else(0,d.createRenderEffect)(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof s=="function"){let a=!0,i=(0,d.createEffect)(()=>{let r=s();for(;typeof r=="function"&&r.length===0;)r=r();a?(a=!1,queueMicrotask(()=>{e.value=r??""})):e.value=r??""});(0,d.onCleanup)(()=>{i()})}else{let a=!0;(0,d.createRenderEffect)(()=>{let i=t[o];a?(a=!1,queueMicrotask(()=>{e.value=i??""})):e.value=i??""})}continue}if(typeof s=="function"){let a=(0,d.createEffect)(()=>{let i=s();for(;typeof i=="function"&&i.length===0;)i=i();R(e,o,i,n)});(0,d.onCleanup)(()=>{a()})}else(0,d.createRenderEffect)(()=>R(e,o,t[o],n))}}}function ge(e,t){if(e){if(v(e)){let n=t,o=e;if(!n)return;typeof n=="function"?n(o):typeof n=="object"&&"current"in n&&(n.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function q(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function A(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}var me="__fx_dom_create_component__",z=globalThis[me]??={fn:null};function U(e,t){return z.fn?z.fn(e,t):(()=>e(t))}var X=require("@fluixi/reactive/signal");function he(e,t={}){if(typeof e=="function")return U(e,t);if(typeof e!="string"||e.length===0)return null;let n=q(e);if(S)return w().createElement(e,n);let o=n?document.createElementNS(M,e):document.createElement(e);return B(o,t,n),xe(o,t),o}function xe(e,t){if(!t||t.children===void 0)return;let n=(0,X.readChildren)(()=>t.children),o=s=>{H(e,s,typeof s=="function"?null:void 0)};Array.isArray(n)?n.forEach(o):o(n)}
1
+ "use strict";var M=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},te=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Z(t))!Q.call(e,s)&&s!==n&&M(e,s,{get:()=>t[s],enumerable:!(o=Y(t,s))||o.enumerable});return e};var ne=e=>te(M({},"__esModule",{value:!0}),e);var Ee={};ee(Ee,{createDynamicElement:()=>xe});module.exports=ne(Ee);var m=require("@fluixi/reactive/signal");var R="http://www.w3.org/2000/svg";function oe(e){return e.localName.includes("-")}function P(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(oe(e)){e[t]=n;return}N(e,t,n,o)}function N(e,t,n,o=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}var Te=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function E(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var d=require("@fluixi/reactive/signal");var S=typeof document>"u";var j=Symbol.for("fluixi.server-node"),_=null;function w(){if(!_)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return _}function A(e){return e!=null&&e[j]===!0?!0:typeof Node<"u"&&e instanceof Node}function F(e){return e!=null&&e[j]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var b={active:!1,cursor:null,parents:[]},re=null;function $(){return re}function O(e,t){return b.active&&t.parentNode===e}function I(e){let t=b.parents.lastIndexOf(e);t!==-1&&(b.parents.length=t),b.cursor=e.nextSibling}var H=new Set,q=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ie(e){if(!S)for(let t of e)H.has(t)||q.has(t)||(H.add(t),document.addEventListener(t,se))}function se(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function h(e,t=!1){if(S)return w().createText(e);if(b.active&&!t){let n=$()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var x=0,fe=200;function ae(e,t,n,o,s){let a=o,r=new Map;return(0,d.createRenderEffect)(()=>{let i;if(E(e)&&!(0,m.isSignal)(e)){if(!r.has(e)){x++;try{let f=e();r.set(e,f)}finally{x--}}for(i=r.get(e);typeof i=="function"&&(0,m.isSignal)(i);)i=i()}else for(i=e();typeof i=="function"&&(0,m.isSignal)(i);)i=i();{let f=0;for(;typeof i=="function"&&f++<50;)if(E(i)){if(!r.has(i)){let l=i;x++;try{let u=l();r.set(l,u)}finally{x--}}i=r.get(i)}else if((0,m.isSignal)(i))i=i();else if(i=i(),typeof i!="function"||!(0,m.isSignal)(i)&&!E(i))break}x++;try{a=C(t,i,n,a,r),s(a)}finally{x--}})}function D(e,t,n,o){if(x>fe)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=h("",!0),e.appendChild(n));let s=o??null,a=f=>Array.isArray(f)&&f.some(l=>typeof l=="function"),r=f=>typeof f=="function"?f:()=>f;if(typeof t!="function"&&!a(t)){x++;try{s=C(e,t,n,null)}finally{x--}return()=>s}let i=ae(r(t),e,n,s,f=>{s=f});return()=>(i?.(),s)}function C(e,t,n,o,s){if(t==null||typeof t=="boolean")return T(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return T(e,o,n);if(v(t)){let r=h("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(r,o[0]),T(e,o.slice(1),n)):p(e,r,n):o?e.replaceChild(r,o):p(e,r,n),t.then(i=>{r.parentNode===e&&C(e,i,r.nextSibling,r)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),r}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let i=h(t);return p(e,i,n),i}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=T(e,o,n)}if(o&&F(o))return o.data=t,o;let r=h(t);return o&&o.parentNode===e?e.replaceChild(r,o):O(e,r)||p(e,r,n),r}if(A(t))return O(e,t)?(I(t),t):Array.isArray(o)?(o.length===0?p(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),T(e,o.slice(1),n)):p(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):p(e,t,n)):p(e,t,n),t);if(Array.isArray(t)){let r=[],i=Array.isArray(o)?o:o?[o]:[],f=[];g(t,r,e,n,!0,s,f);let l=le(e,i,r,n);for(let u of f){let c=D(e,u.sig,u.marker);(0,d.onCleanup)(()=>{T(e,c()),u.marker.parentNode===e&&e.removeChild(u.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let r=t;if("type"in r&&"props"in r){let i=r;if(typeof i.type=="function"){let f=i.type(i.props||{});return C(e,f,n,o)}}}return T(e,o,n)}function g(e,t,n,o,s=!0,a,r){for(let i=0;i<e.length;i++){let f=e[i];if(!(f==null||typeof f=="boolean")){for(;typeof f=="function"&&!v(f)&&!(0,m.isSignal)(f)&&!E(f)&&(f=f(),!(f==null||typeof f=="boolean")););if(!(f==null||typeof f=="boolean")){if(typeof f=="function"){let l;for(E(f)&&!(0,m.isSignal)(f)?(a||(a=new Map),a.has(f)||a.set(f,f()),l=a.get(f)):l=f();typeof l=="function"&&!v(l)&&!(0,m.isSignal)(l)&&!E(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if((0,m.isSignal)(l)){if(r){let c=h("",!0);t.push(c),r.push({marker:c,sig:l});continue}let u=l();for(;typeof u=="function"&&(0,m.isSignal)(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?g(u,t,n,o,s,a):g([u],t,n,o,s,a);continue}continue}Array.isArray(l)?g(l,t,n,o,s,a,r):g([l],t,n,o,s,a,r);continue}if(v(f)){let l=h("",!0);t.push(l),f.then(u=>{if(l.parentNode){let c=[];if(g([u],c,l.parentNode,void 0,!1,a),c.length>0){l.parentNode.replaceChild(c[0],l);for(let y=1;y<c.length;y++)l.parentNode?.insertBefore(c[y],c[y-1].nextSibling)}}}).catch(u=>console.error("Error resolving promise in array:",u));continue}if(Array.isArray(f)){g(f,t,n,o,s,a,r);continue}if(A(f)){t.push(f);continue}if(typeof f=="object"&&f!==null&&"type"in f&&"props"in f){let l=f;if(typeof l.type=="function"){let u=l.type(l.props||{});Array.isArray(u)?g(u,t,n,o,!1,a):g([u],t,n,o,!1,a);continue}}if(typeof f=="string"||typeof f=="number"){let l=String(f);if(l.trim()===""&&l!==" ")continue;t.push(h(l));continue}t.push(h(String(f)))}}}}function le(e,t,n,o){for(let c=0;c<n.length;c++)n[c].parentNode!==null&&n[c].parentNode!==e&&(n=n.slice(),n[c]=n[c].cloneNode(!0));let s=n.length,a=t.length,r=s,i=0,f=0,l=a>0?t[a-1].nextSibling??void 0:o,u=null;for(;i<a||f<r;){if(t[i]===n[f]){i++,f++;continue}for(;a>i&&r>f&&t[a-1]===n[r-1];)a--,r--;if(a===i){let c=r<s?f?n[f-1].nextSibling??void 0:n[r-f]:l;for(;f<r;)p(e,n[f++],c)}else if(r===f)for(;i<a;)(!u||!u.has(t[i]))&&t[i].parentNode===e&&e.removeChild(t[i]),i++;else if(t[i]===n[r-1]&&n[f]===t[a-1]){let c=t[--a].nextSibling;p(e,n[f++],t[i++].nextSibling),p(e,n[--r],c),t[a]=t[i-1]}else{if(!u){u=new Map;let y=f;for(;y<r;)u.set(n[y],y++)}let c=u.get(t[i]);if(c!=null)if(f<c&&c<r){let y=i,L=1;for(;++y<a&&y<r&&!(!u.has(t[y])||u.get(t[y])!==c+L);)L++;if(L>c-f){let J=t[i];for(;f<c;)p(e,n[f++],J)}else t[i].parentNode===e?e.replaceChild(n[f++],t[i++]):(p(e,n[f++],l),i++)}else i++;else t[i].parentNode===e&&e.removeChild(t[i]),i++}}return n}function T(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function p(e,t,n){b.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function W(e,t,n){n==null?delete e[t]:e[t]=n}function ue(e,t,n){let o=n,s;return Array.isArray(n)&&(o=n[0],s=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s))}function ce(e,t){let n=(o,s)=>{typeof o=="function"&&o(e,s??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function de(e,t,n,o=!1){return typeof n!="function"?(N(e,t,n,o),()=>{}):(0,d.createRenderEffect)(()=>{let s=typeof n=="function"?n():n;N(e,t,s,o)})}function ye(e,t,n){return typeof n!="function"?(W(e,t,n),()=>{}):(0,d.createRenderEffect)(()=>{let o=typeof n=="function"?n():n;W(e,t,o)})}function pe(e,t,n){return typeof n!="function"?(N(e,t,!!n),()=>{}):(0,d.createRenderEffect)(()=>{let o=n();N(e,t,!!o)})}function K(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,d.createRenderEffect)(()=>K(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(o=>{let s=t[o];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function V(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let s=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push((0,d.createRenderEffect)(()=>{let r=!!s();for(let i of a)e.classList.toggle(i,r)}));else{let r=!!(typeof s=="function"?s():s);for(let i of a)e.classList.toggle(i,r)}}}function k(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let o in n){let s=n[o];s==null?e.style[o]="":e.style[o]=s}}function B(e,t,n=!1){for(let o in t){let s=t[o];if(o==="ref"){me(s,e);continue}if(o!=="children"){if(o==="use"){ce(e,s);continue}if(o.startsWith("on:")){ue(e,o.slice(3),s);continue}if(o.startsWith("prop:")){ye(e,o.slice(5),s);continue}if(o.startsWith("attr:")){de(e,o.slice(5),s,n);continue}if(o.startsWith("bool:")){pe(e,o.slice(5),s);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof s=="function")if(q.has(a)){e[`$$${a}`]=s;let r=`__fx_${a}`;if(!e[r]){let i=f=>{e[`$$${a}`]?.(f)};e.addEventListener(a,i),e[r]=i}}else e[`$$${a}`]=s,H.has(a)||ie([a]);continue}if(o==="class"||o==="className"){K(e,s);continue}if(o==="classList"){typeof s=="function"?(0,d.createRenderEffect)(()=>V(e,s())):V(e,s);continue}if(o==="style"){typeof s=="function"?(0,d.createRenderEffect)(()=>k(e,s())):k(e,s);continue}if(o==="innerHTML"){if(typeof s=="function"){let a=(0,d.createEffect)(()=>{let r=s();for(;typeof r=="function";)r=r();e.innerHTML=r});(0,d.onCleanup)(()=>a())}else e.innerHTML=s;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof s=="function"){let a=(0,d.createEffect)(()=>{let r=s();for(;typeof r=="function"&&r.length===0;)r=r();document.activeElement!==e&&(e.value=r??"")});(0,d.onCleanup)(()=>{a()})}else(0,d.createRenderEffect)(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof s=="function"){let a=(0,d.createEffect)(()=>{let r=s();for(;typeof r=="function"&&r.length===0;)r=r();document.activeElement!==e&&(e.checked=r??"")});(0,d.onCleanup)(()=>{a()})}else(0,d.createRenderEffect)(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof s=="function"){let a=!0,r=(0,d.createEffect)(()=>{let i=s();for(;typeof i=="function"&&i.length===0;)i=i();a?(a=!1,queueMicrotask(()=>{e.value=i??""})):e.value=i??""});(0,d.onCleanup)(()=>{r()})}else{let a=!0;(0,d.createRenderEffect)(()=>{let r=t[o];a?(a=!1,queueMicrotask(()=>{e.value=r??""})):e.value=r??""})}continue}if(typeof s=="function"){let a=(0,d.createEffect)(()=>{let r=s();for(;typeof r=="function"&&r.length===0;)r=r();P(e,o,r,n)});(0,d.onCleanup)(()=>{a()})}else(0,d.createRenderEffect)(()=>P(e,o,t[o],n))}}}function me(e,t){if(e){if(A(e)){let n=t,o=e;if(!n)return;typeof n=="function"?n(o):typeof n=="object"&&"current"in n&&(n.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function G(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function v(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}var ge="__fx_dom_create_component__",z=globalThis[ge]??={fn:null};function U(e,t){return z.fn?z.fn(e,t):(()=>e(t))}var X=require("@fluixi/reactive/signal");function xe(e,t={}){if(typeof e=="function")return U(e,t);if(typeof e!="string"||e.length===0)return null;let n=G(e);if(S)return w().createElement(e,n);let o=n?document.createElementNS(R,e):document.createElement(e);return B(o,t,n),he(o,t),o}function he(e,t){if(!t||t.children===void 0)return;let n=(0,X.readChildren)(()=>t.children),o=s=>{D(e,s,typeof s=="function"?null:void 0)};Array.isArray(n)?n.forEach(o):o(n)}
@@ -1,10 +1,45 @@
1
1
  /** A tag name, or a component function. */
2
2
  export type DynamicType = string | ((props: any) => any);
3
+ /**
4
+ * The element a tag name builds: the exact interface for a known HTML or SVG tag,
5
+ * and `Element` for a custom-element name we can't know statically.
6
+ *
7
+ * HTML is checked first because a few names (`a`, `script`, `style`, `title`) are
8
+ * in both maps, and the HTML one is what an unqualified tag means.
9
+ */
10
+ type ElementFor<T extends string> = T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : T extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[T] : Element;
11
+ /**
12
+ * What `createDynamicElement` returns for a given type: a component's own return
13
+ * type, or the element its tag name builds.
14
+ *
15
+ * Distributes over a union, so a polymorphic `as?: string | Component` yields the
16
+ * union of both rather than collapsing — which is what keeps `as` from being a
17
+ * hole in the type system.
18
+ */
19
+ export type DynamicResult<T extends DynamicType> = T extends (props: any) => infer R ? R : T extends string ? ElementFor<T> : never;
20
+ /**
21
+ * Build-time guards. `as` is the one place a component library hands the type
22
+ * system a runtime value, so if inference regresses to `any` here it takes every
23
+ * polymorphic component's props with it — silently.
24
+ */
25
+ type Assert<T extends true> = T;
26
+ type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
27
+ /** What an actual call returns — asserting the alias alone would miss a signature
28
+ * regressed back to `any`, which is the regression that matters. */
29
+ type Returns<T extends DynamicType> = ReturnType<typeof createDynamicElement<T>>;
30
+ export type DynamicResultIsInferred = [
31
+ Assert<Equals<Returns<'div'>, HTMLDivElement>>,
32
+ Assert<Equals<Returns<'a'>, HTMLAnchorElement>>,
33
+ Assert<Equals<Returns<'circle'>, SVGCircleElement>>,
34
+ Assert<Equals<Returns<'my-widget'>, Element>>,
35
+ Assert<Equals<Returns<() => HTMLButtonElement>, HTMLButtonElement>>
36
+ ];
3
37
  /**
4
38
  * Create a node for `type` with `props`.
5
39
  *
6
40
  * A string builds a native element (SVG-aware) and inserts its children; a
7
41
  * function is instantiated as a component.
8
42
  */
9
- export declare function createDynamicElement(type: DynamicType, props?: Record<string, any>): any;
43
+ export declare function createDynamicElement<T extends DynamicType>(type: T, props?: Record<string, any>): DynamicResult<T>;
44
+ export {};
10
45
  //# sourceMappingURL=dynamic-element.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-element.d.ts","sourceRoot":"","sources":["../../../src/lib/dom/dynamic-element.ts"],"names":[],"mappings":"AAsBA,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,GAAG,CAc5F"}
1
+ {"version":3,"file":"dynamic-element.d.ts","sourceRoot":"","sources":["../../../src/lib/dom/dynamic-element.ts"],"names":[],"mappings":"AAsBA,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,qBAAqB,GACrE,qBAAqB,CAAC,CAAC,CAAC,GACxB,CAAC,SAAS,MAAM,oBAAoB,GAClC,oBAAoB,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC;AAEd;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC,GAChF,CAAC,GACD,CAAC,SAAS,MAAM,GACd,UAAU,CAAC,CAAC,CAAC,GACb,KAAK,CAAC;AAEZ;;;;GAIG;AACH,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAChC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GACnF,IAAI,GACJ,KAAK,CAAC;AACV;qEACqE;AACrE,KAAK,OAAO,CAAC,CAAC,SAAS,WAAW,IAAI,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,iBAAiB,CAAC,CAAC;IAC/C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACnD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,WAAW,EACxD,IAAI,EAAE,CAAC,EACP,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC9B,aAAa,CAAC,CAAC,CAAC,CAkBlB"}
@@ -1 +1 @@
1
- import{isSignal as g}from"@fluixi/reactive/signal";var R="http://www.w3.org/2000/svg";function Y(e){return e.localName.includes("-")}function O(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(Y(e)){e[t]=n;return}T(e,t,n,o)}function T(e,t,n,o=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}var ye=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function E(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as we,createEffect as v,createRenderEffect as p,createRoot as ve,onCleanup as S,readChildren as Ae}from"@fluixi/reactive/signal";var w=typeof document>"u";var D=Symbol.for("fluixi.server-node"),$=null;function A(){if(!$)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return $}function C(e){return e!=null&&e[D]===!0?!0:typeof Node<"u"&&e instanceof Node}function F(e){return e!=null&&e[D]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var b={active:!1,cursor:null,parents:[]},Z=null;function I(){return Z}function _(e,t){return b.active&&t.parentNode===e}function W(e){let t=b.parents.lastIndexOf(e);t!==-1&&(b.parents.length=t),b.cursor=e.nextSibling}var H=new Set,G=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function Q(e){if(!w)for(let t of e)H.has(t)||G.has(t)||(H.add(t),document.addEventListener(t,ee))}function ee(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function x(e,t=!1){if(w)return A().createText(e);if(b.active&&!t){let n=I()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var h=0,te=200;function ne(e,t,n,o,f){let a=o,i=new Map;return p(()=>{let r;if(E(e)&&!g(e)){if(!i.has(e)){h++;try{let s=e();i.set(e,s)}finally{h--}}for(r=i.get(e);typeof r=="function"&&g(r);)r=r()}else for(r=e();typeof r=="function"&&g(r);)r=r();{let s=0;for(;typeof r=="function"&&s++<50;)if(E(r)){if(!i.has(r)){let l=r;h++;try{let u=l();i.set(l,u)}finally{h--}}r=i.get(r)}else if(g(r))r=r();else if(r=r(),typeof r!="function"||!g(r)&&!E(r))break}h++;try{a=P(t,r,n,a,i),f(a)}finally{h--}})}function j(e,t,n,o){if(h>te)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=x("",!0),e.appendChild(n));let f=o??null,a=s=>Array.isArray(s)&&s.some(l=>typeof l=="function"),i=s=>typeof s=="function"?s:()=>s;if(typeof t!="function"&&!a(t)){h++;try{f=P(e,t,n,null)}finally{h--}return()=>f}let r=ne(i(t),e,n,f,s=>{f=s});return()=>(r?.(),f)}function P(e,t,n,o,f){if(t==null||typeof t=="boolean")return N(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return N(e,o,n);if(L(t)){let i=x("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(i,o[0]),N(e,o.slice(1),n)):y(e,i,n):o?e.replaceChild(i,o):y(e,i,n),t.then(r=>{i.parentNode===e&&P(e,r,i.nextSibling,i)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),i}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let r=x(t);return y(e,r,n),r}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=N(e,o,n)}if(o&&F(o))return o.data=t,o;let i=x(t);return o&&o.parentNode===e?e.replaceChild(i,o):_(e,i)||y(e,i,n),i}if(C(t))return _(e,t)?(W(t),t):Array.isArray(o)?(o.length===0?y(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),N(e,o.slice(1),n)):y(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):y(e,t,n)):y(e,t,n),t);if(Array.isArray(t)){let i=[],r=Array.isArray(o)?o:o?[o]:[],s=[];m(t,i,e,n,!0,f,s);let l=oe(e,r,i,n);for(let u of s){let c=j(e,u.sig,u.marker);S(()=>{N(e,c()),u.marker.parentNode===e&&e.removeChild(u.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let i=t;if("type"in i&&"props"in i){let r=i;if(typeof r.type=="function"){let s=r.type(r.props||{});return P(e,s,n,o)}}}return N(e,o,n)}function m(e,t,n,o,f=!0,a,i){for(let r=0;r<e.length;r++){let s=e[r];if(!(s==null||typeof s=="boolean")){for(;typeof s=="function"&&!L(s)&&!g(s)&&!E(s)&&(s=s(),!(s==null||typeof s=="boolean")););if(!(s==null||typeof s=="boolean")){if(typeof s=="function"){let l;for(E(s)&&!g(s)?(a||(a=new Map),a.has(s)||a.set(s,s()),l=a.get(s)):l=s();typeof l=="function"&&!L(l)&&!g(l)&&!E(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(g(l)){if(i){let c=x("",!0);t.push(c),i.push({marker:c,sig:l});continue}let u=l();for(;typeof u=="function"&&g(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?m(u,t,n,o,f,a):m([u],t,n,o,f,a);continue}continue}Array.isArray(l)?m(l,t,n,o,f,a,i):m([l],t,n,o,f,a,i);continue}if(L(s)){let l=x("",!0);t.push(l),s.then(u=>{if(l.parentNode){let c=[];if(m([u],c,l.parentNode,void 0,!1,a),c.length>0){l.parentNode.replaceChild(c[0],l);for(let d=1;d<c.length;d++)l.parentNode?.insertBefore(c[d],c[d-1].nextSibling)}}}).catch(u=>console.error("Error resolving promise in array:",u));continue}if(Array.isArray(s)){m(s,t,n,o,f,a,i);continue}if(C(s)){t.push(s);continue}if(typeof s=="object"&&s!==null&&"type"in s&&"props"in s){let l=s;if(typeof l.type=="function"){let u=l.type(l.props||{});Array.isArray(u)?m(u,t,n,o,!1,a):m([u],t,n,o,!1,a);continue}}if(typeof s=="string"||typeof s=="number"){let l=String(s);if(l.trim()===""&&l!==" ")continue;t.push(x(l));continue}t.push(x(String(s)))}}}}function oe(e,t,n,o){for(let c=0;c<n.length;c++)n[c].parentNode!==null&&n[c].parentNode!==e&&(n=n.slice(),n[c]=n[c].cloneNode(!0));let f=n.length,a=t.length,i=f,r=0,s=0,l=a>0?t[a-1].nextSibling??void 0:o,u=null;for(;r<a||s<i;){if(t[r]===n[s]){r++,s++;continue}for(;a>r&&i>s&&t[a-1]===n[i-1];)a--,i--;if(a===r){let c=i<f?s?n[s-1].nextSibling??void 0:n[i-s]:l;for(;s<i;)y(e,n[s++],c)}else if(i===s)for(;r<a;)(!u||!u.has(t[r]))&&t[r].parentNode===e&&e.removeChild(t[r]),r++;else if(t[r]===n[i-1]&&n[s]===t[a-1]){let c=t[--a].nextSibling;y(e,n[s++],t[r++].nextSibling),y(e,n[--i],c),t[a]=t[r-1]}else{if(!u){u=new Map;let d=s;for(;d<i;)u.set(n[d],d++)}let c=u.get(t[r]);if(c!=null)if(s<c&&c<i){let d=r,M=1;for(;++d<a&&d<i&&!(!u.has(t[d])||u.get(t[d])!==c+M);)M++;if(M>c-s){let J=t[r];for(;s<c;)y(e,n[s++],J)}else t[r].parentNode===e?e.replaceChild(n[s++],t[r++]):(y(e,n[s++],l),r++)}else r++;else t[r].parentNode===e&&e.removeChild(t[r]),r++}}return n}function N(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function y(e,t,n){b.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function k(e,t,n){n==null?delete e[t]:e[t]=n}function ie(e,t,n){let o=n,f;return Array.isArray(n)&&(o=n[0],f=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,f),()=>e.removeEventListener(t,o,f))}function re(e,t){let n=(o,f)=>{typeof o=="function"&&o(e,f??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function se(e,t,n,o=!1){return typeof n!="function"?(T(e,t,n,o),()=>{}):p(()=>{let f=typeof n=="function"?n():n;T(e,t,f,o)})}function fe(e,t,n){return typeof n!="function"?(k(e,t,n),()=>{}):p(()=>{let o=typeof n=="function"?n():n;k(e,t,o)})}function ae(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):p(()=>{let o=n();T(e,t,!!o)})}function B(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){p(()=>B(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(o=>{let f=t[o];return typeof f=="function"?f():!!f}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function V(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let f=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof f=="function"&&n)n.push(p(()=>{let i=!!f();for(let r of a)e.classList.toggle(r,i)}));else{let i=!!(typeof f=="function"?f():f);for(let r of a)e.classList.toggle(r,i)}}}function K(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let o in n){let f=n[o];f==null?e.style[o]="":e.style[o]=f}}function q(e,t,n=!1){for(let o in t){let f=t[o];if(o==="ref"){le(f,e);continue}if(o!=="children"){if(o==="use"){re(e,f);continue}if(o.startsWith("on:")){ie(e,o.slice(3),f);continue}if(o.startsWith("prop:")){fe(e,o.slice(5),f);continue}if(o.startsWith("attr:")){se(e,o.slice(5),f,n);continue}if(o.startsWith("bool:")){ae(e,o.slice(5),f);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof f=="function")if(G.has(a)){e[`$$${a}`]=f;let i=`__fx_${a}`;if(!e[i]){let r=s=>{e[`$$${a}`]?.(s)};e.addEventListener(a,r),e[i]=r}}else e[`$$${a}`]=f,H.has(a)||Q([a]);continue}if(o==="class"||o==="className"){B(e,f);continue}if(o==="classList"){typeof f=="function"?p(()=>V(e,f())):V(e,f);continue}if(o==="style"){typeof f=="function"?p(()=>K(e,f())):K(e,f);continue}if(o==="innerHTML"){if(typeof f=="function"){let a=v(()=>{let i=f();for(;typeof i=="function";)i=i();e.innerHTML=i});S(()=>a())}else e.innerHTML=f;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof f=="function"){let a=v(()=>{let i=f();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.value=i??"")});S(()=>{a()})}else p(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof f=="function"){let a=v(()=>{let i=f();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.checked=i??"")});S(()=>{a()})}else p(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof f=="function"){let a=!0,i=v(()=>{let r=f();for(;typeof r=="function"&&r.length===0;)r=r();a?(a=!1,queueMicrotask(()=>{e.value=r??""})):e.value=r??""});S(()=>{i()})}else{let a=!0;p(()=>{let i=t[o];a?(a=!1,queueMicrotask(()=>{e.value=i??""})):e.value=i??""})}continue}if(typeof f=="function"){let a=v(()=>{let i=f();for(;typeof i=="function"&&i.length===0;)i=i();O(e,o,i,n)});S(()=>{a()})}else p(()=>O(e,o,t[o],n))}}}function le(e,t){if(e){if(C(e)){let n=t,o=e;if(!n)return;typeof n=="function"?n(o):typeof n=="object"&&"current"in n&&(n.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function z(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function L(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}var ue="__fx_dom_create_component__",U=globalThis[ue]??={fn:null};function X(e,t){return U.fn?U.fn(e,t):(()=>e(t))}import{readChildren as ce}from"@fluixi/reactive/signal";function De(e,t={}){if(typeof e=="function")return X(e,t);if(typeof e!="string"||e.length===0)return null;let n=z(e);if(w)return A().createElement(e,n);let o=n?document.createElementNS(R,e):document.createElement(e);return q(o,t,n),de(o,t),o}function de(e,t){if(!t||t.children===void 0)return;let n=ce(()=>t.children),o=f=>{j(e,f,typeof f=="function"?null:void 0)};Array.isArray(n)?n.forEach(o):o(n)}export{De as createDynamicElement};
1
+ import{isSignal as m}from"@fluixi/reactive/signal";var P="http://www.w3.org/2000/svg";function Y(e){return e.localName.includes("-")}function O(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(Y(e)){e[t]=n;return}N(e,t,n,o)}function N(e,t,n,o=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}var ye=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function E(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as we,createEffect as A,createRenderEffect as p,createRoot as Ae,onCleanup as S,readChildren as ve}from"@fluixi/reactive/signal";var w=typeof document>"u";var F=Symbol.for("fluixi.server-node"),j=null;function v(){if(!j)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return j}function C(e){return e!=null&&e[F]===!0?!0:typeof Node<"u"&&e instanceof Node}function $(e){return e!=null&&e[F]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var b={active:!1,cursor:null,parents:[]},Z=null;function I(){return Z}function H(e,t){return b.active&&t.parentNode===e}function W(e){let t=b.parents.lastIndexOf(e);t!==-1&&(b.parents.length=t),b.cursor=e.nextSibling}var D=new Set,K=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function Q(e){if(!w)for(let t of e)D.has(t)||K.has(t)||(D.add(t),document.addEventListener(t,ee))}function ee(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function h(e,t=!1){if(w)return v().createText(e);if(b.active&&!t){let n=I()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var x=0,te=200;function ne(e,t,n,o,f){let a=o,r=new Map;return p(()=>{let i;if(E(e)&&!m(e)){if(!r.has(e)){x++;try{let s=e();r.set(e,s)}finally{x--}}for(i=r.get(e);typeof i=="function"&&m(i);)i=i()}else for(i=e();typeof i=="function"&&m(i);)i=i();{let s=0;for(;typeof i=="function"&&s++<50;)if(E(i)){if(!r.has(i)){let l=i;x++;try{let u=l();r.set(l,u)}finally{x--}}i=r.get(i)}else if(m(i))i=i();else if(i=i(),typeof i!="function"||!m(i)&&!E(i))break}x++;try{a=M(t,i,n,a,r),f(a)}finally{x--}})}function _(e,t,n,o){if(x>te)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=h("",!0),e.appendChild(n));let f=o??null,a=s=>Array.isArray(s)&&s.some(l=>typeof l=="function"),r=s=>typeof s=="function"?s:()=>s;if(typeof t!="function"&&!a(t)){x++;try{f=M(e,t,n,null)}finally{x--}return()=>f}let i=ne(r(t),e,n,f,s=>{f=s});return()=>(i?.(),f)}function M(e,t,n,o,f){if(t==null||typeof t=="boolean")return T(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return T(e,o,n);if(L(t)){let r=h("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(r,o[0]),T(e,o.slice(1),n)):y(e,r,n):o?e.replaceChild(r,o):y(e,r,n),t.then(i=>{r.parentNode===e&&M(e,i,r.nextSibling,r)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),r}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let i=h(t);return y(e,i,n),i}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=T(e,o,n)}if(o&&$(o))return o.data=t,o;let r=h(t);return o&&o.parentNode===e?e.replaceChild(r,o):H(e,r)||y(e,r,n),r}if(C(t))return H(e,t)?(W(t),t):Array.isArray(o)?(o.length===0?y(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),T(e,o.slice(1),n)):y(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):y(e,t,n)):y(e,t,n),t);if(Array.isArray(t)){let r=[],i=Array.isArray(o)?o:o?[o]:[],s=[];g(t,r,e,n,!0,f,s);let l=oe(e,i,r,n);for(let u of s){let c=_(e,u.sig,u.marker);S(()=>{T(e,c()),u.marker.parentNode===e&&e.removeChild(u.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let r=t;if("type"in r&&"props"in r){let i=r;if(typeof i.type=="function"){let s=i.type(i.props||{});return M(e,s,n,o)}}}return T(e,o,n)}function g(e,t,n,o,f=!0,a,r){for(let i=0;i<e.length;i++){let s=e[i];if(!(s==null||typeof s=="boolean")){for(;typeof s=="function"&&!L(s)&&!m(s)&&!E(s)&&(s=s(),!(s==null||typeof s=="boolean")););if(!(s==null||typeof s=="boolean")){if(typeof s=="function"){let l;for(E(s)&&!m(s)?(a||(a=new Map),a.has(s)||a.set(s,s()),l=a.get(s)):l=s();typeof l=="function"&&!L(l)&&!m(l)&&!E(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(m(l)){if(r){let c=h("",!0);t.push(c),r.push({marker:c,sig:l});continue}let u=l();for(;typeof u=="function"&&m(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?g(u,t,n,o,f,a):g([u],t,n,o,f,a);continue}continue}Array.isArray(l)?g(l,t,n,o,f,a,r):g([l],t,n,o,f,a,r);continue}if(L(s)){let l=h("",!0);t.push(l),s.then(u=>{if(l.parentNode){let c=[];if(g([u],c,l.parentNode,void 0,!1,a),c.length>0){l.parentNode.replaceChild(c[0],l);for(let d=1;d<c.length;d++)l.parentNode?.insertBefore(c[d],c[d-1].nextSibling)}}}).catch(u=>console.error("Error resolving promise in array:",u));continue}if(Array.isArray(s)){g(s,t,n,o,f,a,r);continue}if(C(s)){t.push(s);continue}if(typeof s=="object"&&s!==null&&"type"in s&&"props"in s){let l=s;if(typeof l.type=="function"){let u=l.type(l.props||{});Array.isArray(u)?g(u,t,n,o,!1,a):g([u],t,n,o,!1,a);continue}}if(typeof s=="string"||typeof s=="number"){let l=String(s);if(l.trim()===""&&l!==" ")continue;t.push(h(l));continue}t.push(h(String(s)))}}}}function oe(e,t,n,o){for(let c=0;c<n.length;c++)n[c].parentNode!==null&&n[c].parentNode!==e&&(n=n.slice(),n[c]=n[c].cloneNode(!0));let f=n.length,a=t.length,r=f,i=0,s=0,l=a>0?t[a-1].nextSibling??void 0:o,u=null;for(;i<a||s<r;){if(t[i]===n[s]){i++,s++;continue}for(;a>i&&r>s&&t[a-1]===n[r-1];)a--,r--;if(a===i){let c=r<f?s?n[s-1].nextSibling??void 0:n[r-s]:l;for(;s<r;)y(e,n[s++],c)}else if(r===s)for(;i<a;)(!u||!u.has(t[i]))&&t[i].parentNode===e&&e.removeChild(t[i]),i++;else if(t[i]===n[r-1]&&n[s]===t[a-1]){let c=t[--a].nextSibling;y(e,n[s++],t[i++].nextSibling),y(e,n[--r],c),t[a]=t[i-1]}else{if(!u){u=new Map;let d=s;for(;d<r;)u.set(n[d],d++)}let c=u.get(t[i]);if(c!=null)if(s<c&&c<r){let d=i,R=1;for(;++d<a&&d<r&&!(!u.has(t[d])||u.get(t[d])!==c+R);)R++;if(R>c-s){let J=t[i];for(;s<c;)y(e,n[s++],J)}else t[i].parentNode===e?e.replaceChild(n[s++],t[i++]):(y(e,n[s++],l),i++)}else i++;else t[i].parentNode===e&&e.removeChild(t[i]),i++}}return n}function T(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function y(e,t,n){b.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function V(e,t,n){n==null?delete e[t]:e[t]=n}function re(e,t,n){let o=n,f;return Array.isArray(n)&&(o=n[0],f=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,f),()=>e.removeEventListener(t,o,f))}function ie(e,t){let n=(o,f)=>{typeof o=="function"&&o(e,f??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function se(e,t,n,o=!1){return typeof n!="function"?(N(e,t,n,o),()=>{}):p(()=>{let f=typeof n=="function"?n():n;N(e,t,f,o)})}function fe(e,t,n){return typeof n!="function"?(V(e,t,n),()=>{}):p(()=>{let o=typeof n=="function"?n():n;V(e,t,o)})}function ae(e,t,n){return typeof n!="function"?(N(e,t,!!n),()=>{}):p(()=>{let o=n();N(e,t,!!o)})}function B(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){p(()=>B(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(o=>{let f=t[o];return typeof f=="function"?f():!!f}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function k(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let f=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof f=="function"&&n)n.push(p(()=>{let r=!!f();for(let i of a)e.classList.toggle(i,r)}));else{let r=!!(typeof f=="function"?f():f);for(let i of a)e.classList.toggle(i,r)}}}function q(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let o in n){let f=n[o];f==null?e.style[o]="":e.style[o]=f}}function G(e,t,n=!1){for(let o in t){let f=t[o];if(o==="ref"){le(f,e);continue}if(o!=="children"){if(o==="use"){ie(e,f);continue}if(o.startsWith("on:")){re(e,o.slice(3),f);continue}if(o.startsWith("prop:")){fe(e,o.slice(5),f);continue}if(o.startsWith("attr:")){se(e,o.slice(5),f,n);continue}if(o.startsWith("bool:")){ae(e,o.slice(5),f);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof f=="function")if(K.has(a)){e[`$$${a}`]=f;let r=`__fx_${a}`;if(!e[r]){let i=s=>{e[`$$${a}`]?.(s)};e.addEventListener(a,i),e[r]=i}}else e[`$$${a}`]=f,D.has(a)||Q([a]);continue}if(o==="class"||o==="className"){B(e,f);continue}if(o==="classList"){typeof f=="function"?p(()=>k(e,f())):k(e,f);continue}if(o==="style"){typeof f=="function"?p(()=>q(e,f())):q(e,f);continue}if(o==="innerHTML"){if(typeof f=="function"){let a=A(()=>{let r=f();for(;typeof r=="function";)r=r();e.innerHTML=r});S(()=>a())}else e.innerHTML=f;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof f=="function"){let a=A(()=>{let r=f();for(;typeof r=="function"&&r.length===0;)r=r();document.activeElement!==e&&(e.value=r??"")});S(()=>{a()})}else p(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof f=="function"){let a=A(()=>{let r=f();for(;typeof r=="function"&&r.length===0;)r=r();document.activeElement!==e&&(e.checked=r??"")});S(()=>{a()})}else p(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof f=="function"){let a=!0,r=A(()=>{let i=f();for(;typeof i=="function"&&i.length===0;)i=i();a?(a=!1,queueMicrotask(()=>{e.value=i??""})):e.value=i??""});S(()=>{r()})}else{let a=!0;p(()=>{let r=t[o];a?(a=!1,queueMicrotask(()=>{e.value=r??""})):e.value=r??""})}continue}if(typeof f=="function"){let a=A(()=>{let r=f();for(;typeof r=="function"&&r.length===0;)r=r();O(e,o,r,n)});S(()=>{a()})}else p(()=>O(e,o,t[o],n))}}}function le(e,t){if(e){if(C(e)){let n=t,o=e;if(!n)return;typeof n=="function"?n(o):typeof n=="object"&&"current"in n&&(n.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function z(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function L(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}var ue="__fx_dom_create_component__",U=globalThis[ue]??={fn:null};function X(e,t){return U.fn?U.fn(e,t):(()=>e(t))}import{readChildren as ce}from"@fluixi/reactive/signal";function Fe(e,t={}){if(typeof e=="function")return X(e,t);if(typeof e!="string"||e.length===0)return null;let n=z(e);if(w)return v().createElement(e,n);let o=n?document.createElementNS(P,e):document.createElement(e);return G(o,t,n),de(o,t),o}function de(e,t){if(!t||t.children===void 0)return;let n=ce(()=>t.children),o=f=>{_(e,f,typeof f=="function"?null:void 0)};Array.isArray(n)?n.forEach(o):o(n)}export{Fe as createDynamicElement};
@@ -1 +1 @@
1
- "use strict";var r=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(t,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of o(e))!u.call(t,n)&&n!==a&&r(t,n,{get:()=>e[n],enumerable:!(i=s(e,n))||i.enumerable});return t};var l=t=>c(r({},"__esModule",{value:!0}),t);var g={};module.exports=l(g);
1
+ "use strict";var r=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(t,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of o(e))!u.call(t,i)&&i!==a&&r(t,i,{get:()=>e[i],enumerable:!(n=s(e,i))||n.enumerable});return t};var l=t=>c(r({},"__esModule",{value:!0}),t);var g={};module.exports=l(g);
@@ -1045,8 +1045,14 @@ export interface SVGAttributes<T = SVGElement> extends DOMAttributes<T> {
1045
1045
  /**
1046
1046
  * Anything the renderer accepts as output. `JSX.Element` aliases this; html``
1047
1047
  * templates produce the same values, so the type is shared rather than duplicated.
1048
+ *
1049
+ * It is now literally the same type, not a parallel copy. The two had drifted —
1050
+ * this one lacked `ComponentChild`'s recursive array and lazy child — so a
1051
+ * component annotated with the shared `ComponentChild` was rejected as a JSX
1052
+ * component. Both authoring modes compile to the same runtime calls, so
1053
+ * "renderable" has to mean one thing.
1048
1054
  */
1049
- export type FxElement = Node | string | number | boolean | null | undefined | Element[] | HTMLElement | Accessor<any> | globalThis.Element;
1055
+ export type FxElement = ComponentChild;
1050
1056
  /**
1051
1057
  * Every intrinsic tag mapped to the attributes it accepts. `JSX.IntrinsicElements`
1052
1058
  * aliases this. It lives here because html`` tooling needs the same map to type