@fluixi/dom 1.0.0-alpha.70 → 1.0.0-alpha.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/dom.cjs +1 -1
- package/dist/cdn/dom.global.js +1 -1
- package/dist/cdn/dom.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.mjs +1 -1
- package/dist/lib/dom/dynamic-element.cjs +1 -1
- package/dist/lib/dom/dynamic-element.mjs +1 -1
- package/dist/lib/dom/hydration.cjs +1 -1
- package/dist/lib/dom/hydration.mjs +1 -1
- package/dist/lib/dom/index.cjs +1 -1
- package/dist/lib/dom/index.mjs +1 -1
- package/dist/lib/dom/island.cjs +1 -1
- package/dist/lib/dom/island.mjs +1 -1
- package/dist/lib/dom/runtime.cjs +1 -1
- package/dist/lib/dom/runtime.d.ts.map +1 -1
- package/dist/lib/dom/runtime.js +5 -0
- package/dist/lib/dom/runtime.mjs +1 -1
- package/dist/lib/dom/versions.cjs +1 -0
- package/dist/lib/dom/versions.d.ts +33 -0
- package/dist/lib/dom/versions.d.ts.map +1 -0
- package/dist/lib/dom/versions.js +57 -0
- package/dist/lib/dom/versions.mjs +1 -0
- package/dist/lib/flow/portal.cjs +1 -1
- package/dist/lib/flow/portal.mjs +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/version.generated.mjs +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function Lr(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function Or(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function kr(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function Dr(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 _r=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$r=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"]),W="http://www.w3.org/2000/svg";function Gt(e){return e.localName.includes("-")}function we(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(Gt(e)){e[t]=n;return}h(e,t,n,r)}var Se=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function Ge(e,t=document){return t.querySelector(e)}function Ir(e,t=document){return Array.from(t.querySelectorAll(e))}function qr(e,t){return e.closest(t)}function Xe(e,...t){e.classList.add(...t)}function Je(e,...t){e.classList.remove(...t)}function Ye(e,...t){t.forEach(n=>e.classList.toggle(n))}function jr(e,t){return e.classList.contains(t)}function h(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 Ze(e,t){return e.getAttribute(t)}function Qe(e,t){e.removeAttribute(t)}function ve(e,t){Object.assign(e.style,t)}function Hr(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function et(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([o,s])=>{if(o==="class"||o==="className")r.className=s;else if(o==="style"&&typeof s=="object")ve(r,s);else if(o.startsWith("on")&&typeof s=="function"){let i=o.slice(2).toLowerCase();r.addEventListener(i,s)}else h(r,o,s)}),n.forEach(o=>{typeof o=="string"?r.appendChild(document.createTextNode(o)):r.appendChild(o)}),r}function tt(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function nt(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 Vr(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function Wr(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function Ur(e,t,n,r){let o=s=>{let i=s.target.closest(n);i&&e.contains(i)&&r(s,i)};return e.addEventListener(t,o),()=>{e.removeEventListener(t,o)}}function Br(e,t=5e3){return new Promise((n,r)=>{let o=Ge(e);if(o){n(o);return}let s=new MutationObserver(()=>{let a=Ge(e);a&&(s.disconnect(),clearTimeout(i),n(a))});s.observe(document.body,{childList:!0,subtree:!0});let i=setTimeout(()=>{s.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function Kr(e,t,n={}){let r=new IntersectionObserver(o=>{o.forEach(s=>{t(s.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function zr(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var Xt=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function Gr(e){return typeof e=="object"&&e!==null&&e.$$typeof===Xt}function Jt(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function Xr(e){if(typeof e!="function")return!1;try{let t=e();return Jt(t)}catch{return!1}}function Jr(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function Yr(e){return e instanceof Node}function Zr(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function Qr(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}import{isSignal as T}from"@fluixi/reactive/signal";function to(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function no(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function ro(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function oo(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function io(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function so(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function ao(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function lo(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function Yt(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function Zt(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 en(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function tn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function nn(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function N(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function rn(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function co(e){return Yt(e)?{type:"router",value:e}:Qt(e)?{type:"route",value:e}:Zt(e)?{type:"routes",value:e}:en(e)?{type:"outlet",value:e}:N(e)?{type:"component",value:e}:rn(e)?{type:"suspense",value:e}:tn(e)?{type:"provider",value:e}:nn(e)?{type:"context",value:e}:{type:"none",value:e}}import{batch as at,createEffect as K,createRenderEffect as m,createRoot as an,onCleanup as P,readChildren as ln}from"@fluixi/reactive/signal";var g=typeof document>"u";function D(e){g=e}var U=Symbol.for("fluixi.server-node"),Ae=null;function rt(e){Ae=e}function _(){if(!Ae)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Ae}function $(e){return e!=null&&e[U]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ce(e){return e!=null&&e[U]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Re(e){return e!=null&&e[U]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},ot=null;function it(e){ot=e}function Q(){return ot}function Me(e,t){return u.active&&t.parentNode===e}function Pe(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function on(){return u.active?u.cursor:null}function ee(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 sn(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 B(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Pe(t)}function cn(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 un(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 Eo(e){return un(cn(e))}var No=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),fn={};var st=new Map,ne=new Set,ae=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function le(e){if(!g)for(let t of e)ne.has(t)||ae.has(t)||(ne.add(t),document.addEventListener(t,dn))}function dn(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 Le(e,t,n){if(e[`$$${t}`]=n,ae.has(t)){let r=`__fx_${t}`;if(!e[r]){let o=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,o),e[r]=o}return}ne.has(t)||le([t])}function re(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function wo(e){return!ae.has(e)}function So(e){return typeof e=="function"}function C(e,t=!1){if(g)return _().createText(e);if(u.active&&!t){let n=Q()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function ce(e,t=!1){if(g)return _().createElement(e,t);if(u.active){let n=Q()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(W,e):document.createElement(e)}function Oe(e,t=!1){let n=st.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,st.set(e,r),r}function lt(e,t,n=!1,r=!1){if(g){let o=_();return n?o.parseTemplate(e,r):o.createRaw(e)}if(u.active){let o=Q()?.hydrateStatic(t);if(o)return o}return ke(Oe(e,r),r).firstChild}function ct(e,t){if(!u.active)return t();let n=ee(e.nextSibling,t);if(typeof n=="function"){let r=n;return((...o)=>u.active?ee(e.nextSibling,()=>r(...o)):r(...o))}return n}function ut(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function ft(e,t){let n=[];for(let r=e.nextSibling;r&&r!==t;r=r.nextSibling)n.push(r);return n}function ke(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function pn(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?pn(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function vo(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Ao(e){if(T(e)||N(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!T(t)&&!N(t);)t=t();return t}var v=0,yn=200;function mn(e,t,n,r,o){let s=r,i=new Map;return m(()=>{let a;if(N(e)&&!T(e)){if(!i.has(e)){v++;try{let l=e();i.set(e,l)}finally{v--}}for(a=i.get(e);typeof a=="function"&&T(a);)a=a()}else for(a=e();typeof a=="function"&&T(a);)a=a();{let l=0;for(;typeof a=="function"&&l++<50;)if(N(a)){if(!i.has(a)){let c=a;v++;try{let f=c();i.set(c,f)}finally{v--}}a=i.get(a)}else if(T(a))a=a();else if(a=a(),typeof a!="function"||!T(a)&&!N(a))break}v++;try{s=oe(t,a,n,s,i),o(s)}finally{v--}})}function b(e,t,n,r){if(v>yn)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=C("",!0),e.appendChild(n));let o=r??null,s=l=>Array.isArray(l)&&l.some(c=>typeof c=="function"),i=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!s(t)){v++;try{o=oe(e,t,n,null)}finally{v--}return()=>o}let a=mn(i(t),e,n,o,l=>{o=l});return()=>(a?.(),o)}function oe(e,t,n,r,o){if(t==null||typeof t=="boolean")return M(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return M(e,r,n);if(te(t)){let i=C("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(i,r[0]),M(e,r.slice(1),n)):x(e,i,n):r?e.replaceChild(i,r):x(e,i,n),t.then(a=>{i.parentNode===e&&oe(e,a,i.nextSibling,i)}).catch(a=>{console.error("Error resolving promise in insertExpression:",a)}),i}let s=typeof t;if(s==="string"||s==="number"){if(s==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let a=C(t);return x(e,a,n),a}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=M(e,r,n)}if(r&&Re(r))return r.data=t,r;let i=C(t);return r&&r.parentNode===e?e.replaceChild(i,r):Me(e,i)||x(e,i,n),i}if($(t))return Me(e,t)?(Pe(t),t):Array.isArray(r)?(r.length===0?x(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),M(e,r.slice(1),n)):x(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):x(e,t,n)):x(e,t,n),t);if(Array.isArray(t)){let i=[],a=Array.isArray(r)?r:r?[r]:[],l=[];S(t,i,e,n,!0,o,l);let c=gn(e,a,i,n);for(let f of l){let d=b(e,f.sig,f.marker);P(()=>{M(e,d()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return c}if(s==="object"&&t!==null&&typeof t=="object"){let i=t;if("type"in i&&"props"in i){let a=i;if(typeof a.type=="function"){let l=a.type(a.props||{});return oe(e,l,n,r)}}}return M(e,r,n)}function S(e,t,n,r,o=!0,s,i){for(let a=0;a<e.length;a++){let l=e[a];if(!(l==null||typeof l=="boolean")){for(;typeof l=="function"&&!te(l)&&!T(l)&&!N(l)&&(l=l(),!(l==null||typeof l=="boolean")););if(!(l==null||typeof l=="boolean")){if(typeof l=="function"){let c;for(N(l)&&!T(l)?(s||(s=new Map),s.has(l)||s.set(l,l()),c=s.get(l)):c=l();typeof c=="function"&&!te(c)&&!T(c)&&!N(c);)s||(s=new Map),s.has(c)||s.set(c,c()),c=s.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if(T(c)){if(i){let d=C("",!0);t.push(d),i.push({marker:d,sig:c});continue}let f=c();for(;typeof f=="function"&&T(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?S(f,t,n,r,o,s):S([f],t,n,r,o,s);continue}continue}Array.isArray(c)?S(c,t,n,r,o,s,i):S([c],t,n,r,o,s,i);continue}if(te(l)){let c=C("",!0);t.push(c),l.then(f=>{if(c.parentNode){let d=[];if(S([f],d,c.parentNode,void 0,!1,s),d.length>0){c.parentNode.replaceChild(d[0],c);for(let p=1;p<d.length;p++)c.parentNode?.insertBefore(d[p],d[p-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(l)){S(l,t,n,r,o,s,i);continue}if($(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)?S(f,t,n,r,!1,s):S([f],t,n,r,!1,s);continue}}if(typeof l=="string"||typeof l=="number"){let c=String(l);if(c.trim()===""&&c!==" ")continue;t.push(C(c));continue}t.push(C(String(l)))}}}}function gn(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,s=t.length,i=o,a=0,l=0,c=s>0?t[s-1].nextSibling??void 0:r,f=null;for(;a<s||l<i;){if(t[a]===n[l]){a++,l++;continue}for(;s>a&&i>l&&t[s-1]===n[i-1];)s--,i--;if(s===a){let d=i<o?l?n[l-1].nextSibling??void 0:n[i-l]:c;for(;l<i;)x(e,n[l++],d)}else if(i===l)for(;a<s;)(!f||!f.has(t[a]))&&t[a].parentNode===e&&e.removeChild(t[a]),a++;else if(t[a]===n[i-1]&&n[l]===t[s-1]){let d=t[--s].nextSibling;x(e,n[l++],t[a++].nextSibling),x(e,n[--i],d),t[s]=t[a-1]}else{if(!f){f=new Map;let p=l;for(;p<i;)f.set(n[p],p++)}let d=f.get(t[a]);if(d!=null)if(l<d&&d<i){let p=a,y=1;for(;++p<s&&p<i&&!(!f.has(t[p])||f.get(t[p])!==d+y);)y++;if(y>d-l){let Ee=t[a];for(;l<d;)x(e,n[l++],Ee)}else t[a].parentNode===e?e.replaceChild(n[l++],t[a++]):(x(e,n[l++],c),a++)}else a++;else t[a].parentNode===e&&e.removeChild(t[a]),a++}}return n}function M(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 x(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function I(e,t,n){n==null?delete e[t]:e[t]=n}function dt(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 pt(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 z(e,t,n,r=!1){return typeof n!="function"?(h(e,t,n,r),()=>{}):m(()=>{let o=typeof n=="function"?n():n;h(e,t,o,r)})}function G(e,t,n){return typeof n!="function"?(I(e,t,n),()=>{}):m(()=>{let r=typeof n=="function"?n():n;I(e,t,r)})}function yt(e,t,n){return typeof n!="function"?(h(e,t,!!n),()=>{}):m(()=>{let r=n();h(e,t,!!r)})}function q(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){m(()=>q(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 ie(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let o=t[r],s=r.split(/\s+/).filter(Boolean);if(typeof o=="function"&&n)n.push(m(()=>{let i=!!o();for(let a of s)e.classList.toggle(a,i)}));else{let i=!!(typeof o=="function"?o():o);for(let a of s)e.classList.toggle(a,i)}}}function se(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 mt(e){let{element:t,props:n,prevProps:r=fn,isSVG:o=!1,skipChildren:s=!1}=e;if(!t||!Ce(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let i=o||t.namespaceURI===W,a=[];for(let l in n){if(s&&l==="children")continue;let c=n[l],f=r[l];if(c===f)continue;if(l==="ref"){j(c,t);continue}if(l==="use"){pt(t,c);continue}if(l.startsWith("on:")){a.push(dt(t,l.slice(3),c));continue}if(l.startsWith("prop:")){a.push(G(t,l.slice(5),c));continue}if(l.startsWith("attr:")){a.push(z(t,l.slice(5),c,i));continue}if(l.startsWith("bool:")){a.push(yt(t,l.slice(5),c));continue}if(l==="class"||l==="className"){typeof c=="function"?a.push(m(()=>q(t,c()))):q(t,c);continue}if(l==="classList"){typeof c=="function"?a.push(m(()=>ie(t,c()))):ie(t,c,a);continue}if(l==="style"){typeof c=="function"?a.push(m(()=>se(t,c()))):se(t,c);continue}if(l.startsWith("on")){let p=l.slice(2).toLowerCase();f&&re(t,p),c&&Le(t,p,c);continue}let d=Se.has(l)||!i&&l in t;typeof c=="function"?a.push(d?G(t,l,c):z(t,l,c,i)):a.push(m(()=>d?I(t,l,n[l]):h(t,l,n[l],i)))}for(let l in r)if(!(l in n))if(l.startsWith("on")){let c=l.slice(2).toLowerCase();re(t,c)}else Se.has(l)?I(t,l,null):t.removeAttribute(l);return()=>{a.forEach(l=>l())}}function ue(e,t,n=!1){for(let r in t){let o=t[r];if(r==="ref"){j(o,e);continue}if(r!=="children"){if(r==="use"){pt(e,o);continue}if(r.startsWith("on:")){dt(e,r.slice(3),o);continue}if(r.startsWith("prop:")){G(e,r.slice(5),o);continue}if(r.startsWith("attr:")){z(e,r.slice(5),o,n);continue}if(r.startsWith("bool:")){yt(e,r.slice(5),o);continue}if(r.startsWith("on")&&r.length>2){let s=r.slice(2).toLowerCase();if(typeof o=="function")if(ae.has(s)){e[`$$${s}`]=o;let i=`__fx_${s}`;if(!e[i]){let a=l=>{e[`$$${s}`]?.(l)};e.addEventListener(s,a),e[i]=a}}else e[`$$${s}`]=o,ne.has(s)||le([s]);continue}if(r==="class"||r==="className"){q(e,o);continue}if(r==="classList"){typeof o=="function"?m(()=>ie(e,o())):ie(e,o);continue}if(r==="style"){typeof o=="function"?m(()=>se(e,o())):se(e,o);continue}if(r==="innerHTML"){if(typeof o=="function"){let s=K(()=>{let i=o();for(;typeof i=="function";)i=i();e.innerHTML=i});P(()=>s())}else e.innerHTML=o;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof o=="function"){let s=K(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.value=i??"")});P(()=>{s()})}else m(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof o=="function"){let s=K(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.checked=i??"")});P(()=>{s()})}else m(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof o=="function"){let s=!0,i=K(()=>{let a=o();for(;typeof a=="function"&&a.length===0;)a=a();s?(s=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""});P(()=>{i()})}else{let s=!0;m(()=>{let i=t[r];s?(s=!1,queueMicrotask(()=>{e.value=i??""})):e.value=i??""})}continue}if(typeof o=="function"){let s=K(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();we(e,r,i,n)});P(()=>{s()})}else m(()=>we(e,r,t[r],n))}}}function gt(...e){let t=r=>{for(let o=e.length-1;o>=0;o--){let s=e[o];if(s&&r in s&&s[r]!==void 0)return s[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 s of Reflect.ownKeys(o))r.add(s);return[...r]},getOwnPropertyDescriptor:(r,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>t(o)}:void 0})}function Co(e,...t){let n=new Set;for(let i of t)for(let a of i)n.add(a);let r=i=>({enumerable:!0,configurable:!0,get:()=>e[i]}),o=t.map(i=>{let a=new Set(i);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})}),s=new Proxy({},{get:(i,a)=>n.has(a)?void 0:e[a],has:(i,a)=>!n.has(a)&&a in e,ownKeys:()=>Reflect.ownKeys(e).filter(i=>!n.has(i)),getOwnPropertyDescriptor:(i,a)=>!n.has(a)&&a in e?r(a):void 0});return[...o,s]}function j(e,t){if(e){if($(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 ht(e,t,n){let r=t||document.body,o=ln(()=>e),s=[];return at(()=>{let i=m(()=>{let a=o();Array.isArray(a)?(a.forEach(l=>r.appendChild(l)),s.push(()=>{a.forEach(l=>{l.parentNode===r&&r.removeChild(l)})})):$(a)&&(r.appendChild(a),s.push(()=>{a.parentNode===r&&r.removeChild(a)}))});s.push(i),P(()=>{s.forEach(a=>a())})}),null}function Ro(e){return typeof e=="string"&&e.toLowerCase()===e}function xt(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 Mo(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function te(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Po(e){return typeof e=="function"&&e.length===0&&T(e)}function fe(e,t,n){if(!t)throw new Error("Container element is required");let r,o,s=[];return an(i=>{at(()=>{u.active||(t.textContent=""),b(t,e)}),o=i}),()=>{o?.(),r?.(),s.forEach(i=>i()),t.textContent=""}}var hn="__fx_dom_create_component__",L=globalThis[hn]??={fn:null};function Oo(e){L.fn=e}function ko(e={}){let t=e.signalSystem?.createComponent;t&&(L.fn=t)}function de(e,t){return L.fn?L.fn(e,t):(()=>e(t))}var Do=()=>L.fn!==null,Tt=()=>L.fn!==null;function bt(){L.fn=null}var pe,Nt={getStore:()=>pe,run(e,t){let n=pe;pe=e;try{return t()}finally{pe=n}}},De=Nt;function wt(e){De=e??Nt}function X(e={}){e.locals||(e.locals=e.request?$e(e.request):{});let t=0,n=0,r=null,o=new Map,s=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let i=o.get(r)??0;return o.set(r,i+1),`${r}:r${i}`},nextIslandNamespace:i=>{let a=s.get(i)??0;return s.set(i,a+1),`${i}#${a}`},withResourceScope(i,a){let l=r;r=i;try{return a()}finally{r=l}},pending:new Set,data:new Map}}function J(e,t){return De.run(e,t)}function A(){return De.getStore()}function _e(){return A()?.event}function St(){let e=_e();return e?(e.locals||(e.locals={}),e.locals):{}}var Et=new WeakMap;function $e(e){let t=Et.get(e);return t||(t={},Et.set(e,t)),t}import{setResourceIdSource as xn,setServerDataGetter as Tn}from"@fluixi/reactive/signal";var Y="__FX_DATA__";function ye(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Ie;function me(){let e=globalThis.__FX_DATA__;if(e)return e;if(Ie!==void 0)return Ie;let t=null;if(typeof document<"u"){let n=document.getElementById(Y)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Ie=t}function ge(){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 bn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),he=typeof process<"u"&&process.env&&!1;function xe(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 En(e){ge();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(bn.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(he&&t&&xe(`<${e}>`,t),null)}function Nn(e){ge();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(u.cursor=t.nextSibling,t):(he&&t&&xe(`<${e}> (static)`,t),null)}function wn(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}ge();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(he&&t&&xe(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function Sn(e){ge();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(he&&t&&xe(`marker <!--${e.slice(0,24)}-->`,t),null)}var vt=!1;function vn(){vt||(vt=!0,it({hydrateElement:En,hydrateText:wn,hydrateMarker:Sn,hydrateStatic:Nn}))}function Z(e,t,n){vn(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=me(),o=n?.resourceNamespace,s=0;xn(()=>o?`${o}:r${s++}`:`r${s++}`),Tn(r?i=>i in r?{value:r[i]}:void 0:null);try{return fe(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var qe="fluixi-island";function An(e){let{component:t,props:n={},name:r}=e,o=ce(qe),s=r??t.name??"Island";h(o,"name",s),h(o,"props",JSON.stringify(n??{}));let i=g?A():void 0;if(i){let a=i.nextIslandNamespace(s);b(o,()=>i.withResourceScope(a,()=>t(n)))}else b(o,()=>t(n));return o}var At=!1;function Cn(){if(At||typeof document>"u")return;At=!0;let e=document.createElement("style");e.textContent=`${qe}{display:contents}`,document.head.appendChild(e)}function Rn(e){if(typeof document>"u")return;Cn();let t=document.querySelectorAll(qe),n=new Map;t.forEach(r=>{let o=r.getAttribute("name")??"",s=n.get(o)??0;n.set(o,s+1);let i=e[o];if(!i){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{}Z(()=>i(a),r,{resourceNamespace:`${o}#${s}`})})}function Mn(e,...t){throw new Error("html`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function Pn(e,...t){throw new Error("svg`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}import{readChildren as Ln}from"@fluixi/reactive/signal";function ci(e,t={}){if(typeof e=="function")return de(e,t);if(typeof e!="string"||e.length===0)return null;let n=xt(e);if(g)return _().createElement(e,n);let r=n?document.createElementNS(W,e):document.createElement(e);return ue(r,t,n),On(r,t),r}function On(e,t){if(!t||t.children===void 0)return;let n=Ln(()=>t.children),r=o=>{b(e,o,typeof o=="function"?null:void 0)};Array.isArray(n)?n.forEach(r):r(n)}import{createChildOwner as kn,createMemo as je,disposeScope as Dn,getOwner as _n,runWithOwner as $n,untrack as Pt}from"@fluixi/reactive/signal";function Ct(e){return typeof e=="function"?e:(()=>e)}function R(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Rt(e){return e!=null&&e!==!1}function Mt(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function In(e){let t=R(()=>e.when),n=je(t,void 0),r=je(n,void 0),o=_n(),s=null,i=null,a=l=>{l!==i&&(s&&Dn(s),s=kn(o),i=l)};return je(()=>{let l=r();return a(l?"when":"fallback"),$n(s,()=>{if(l){let c=e.children;return typeof c=="function"&&!Mt(c)?typeof n=="function"?Pt(()=>Pt(n)?c(n()):e.fallback):c(n):c}return e.fallback});return e.fallback??null},void 0,{name:"show"})}import{mapArray as qn,keyArray as jn}from"@fluixi/reactive/signal";function Hn(e){let t=R(()=>e.each),n=()=>e.fallback??null,r=(o,s)=>{let i=e.children,a=Array.isArray(i)?i.map(l=>typeof l=="function"?l(o,s):l):typeof i=="function"?i(o,s):i;return B(a),a};return e.by?jn(t,e.by,(o,s)=>r(o,s),{fallback:n}):qn(t,(o,s)=>r(o,s),{fallback:n})}import{indexArray as Fn}from"@fluixi/reactive/signal";function Vn(e){let t=R(()=>e.each);return Fn(t,(n,r)=>{let o=e.children(n,r);return B(o),o},{fallback:()=>e.fallback??null})}import{mapArray as is,keyArray as ss,indexArray as as}from"@fluixi/reactive/signal";import{createMemo as Wn,createChildOwner as Un,disposeScope as Bn,getOwner as Kn,runWithOwner as Lt}from"@fluixi/reactive/signal";var He=Symbol("match");function zn(e){return{[He]:!0,when:R(()=>e.when),get children(){return e.children}}}function Gn(e){let t=Array.isArray(e.children)?e.children:[e.children],n=Kn(),r=null,o=-1,s=i=>{i!==o&&(r&&Bn(r),r=Un(n),o=i)};return Wn(()=>{for(let i=0;i<t.length;i+=1){let l=t[i],c=0;for(;typeof l=="function"&&!l[He]&&c++<10;)l=l();if(!l||typeof l!="object"||l[He]!==!0)continue;let f=l.when();if(Rt(f))return s(i),Lt(r,()=>typeof l.children=="function"?l.children(f):l.children)}return s(-2),Lt(r,()=>e.fallback??null)})}import{createMemo as Xn,createChildOwner as Jn,disposeScope as Yn,getOwner as Zn,runWithOwner as Qn}from"@fluixi/reactive/signal";function er(e){let t=Ct(e.component),{component:n,...r}=e,o=Zn(),s=null,i;return Xn(()=>{let a=t();return a!==i&&(s&&Yn(s),s=Jn(o),i=a),a==null?null:typeof a=="string"?{tag:a,props:r}:Qn(s,()=>a(r))})}import{createRoot as tr,onCleanup as nr}from"@fluixi/reactive/signal";function rr(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return tr(o=>{n=o,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),b(r,e.children)&&j(e.ref,r)}),nr(()=>{n(),r.remove()}),null}import{createMemo as or,createSignal as ir}from"@fluixi/reactive/signal";function Ot(e){if(g)return e.fallback??null;let t=u.active,[n,r]=ir(!t);return t&&queueMicrotask(()=>r(!0)),or(()=>n()?e.children:e.fallback??null,void 0,{name:"client-only"})}var sr=Ot;import{createMemo as ar,createSignal as lr}from"@fluixi/reactive/signal";function cr(e){let[t,n]=lr(null),r=()=>n(null);return ar(()=>{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(s){return n(s),typeof e.fallback=="function"?e.fallback(s,r):e.fallback}})}import{createMemo as ur}from"@fluixi/reactive/signal";function fr(e){return ur(()=>{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 dr}from"@fluixi/reactive/signal";function pr(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function yr(e){return dr(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;let s=typeof o=="function"?o():o;s!=null&&n.push(`${pr(r)}: ${s}`)}return n.join("; ")})}var be=1,We=3,Ue=8,kt;kt=U;var H=class{constructor(){this[kt]=!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(){}},O=class e extends H{constructor(n){super();this.nodeType=We;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)}},Te=class e extends H{constructor(n){super();this.nodeType=be;this.rawOuterHTML=n}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},F=class e extends H{constructor(n){super();this.nodeType=Ue;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},Fe=class{constructor(){this.cssText=""}setProperty(t,n){this[t]=n}removeProperty(t){delete this[t]}},Ve=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}},k=class e extends H{constructor(n,r=!1){super();this.nodeType=be;this.attributes=new Map;this.style=new Fe;this.classList=new Ve(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 O(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 mr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_t=/&/g,$t=/</g,It=/>/g,gr=/"/g;function Be(e){return e.replace(_t,"&").replace($t,"<").replace(It,">")}function Dt(e){return e.replace(_t,"&").replace(gr,""").replace($t,"<").replace(It,">")}function hr(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function xr(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(`${hr(n)}: ${r}`)}return t.join("; ")}function Tr(e){let t="",n=xr(e.style);for(let[r,o]of e.attributes)r==="style"&&n||(t+=` ${r}="${Dt(o)}"`);if(n){let r=e.attributes.get("style"),o=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${Dt(o)}"`}return t}function w(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Be(e);if(typeof e=="number")return Be(String(e));if(typeof e=="function")return w(e());if(Array.isArray(e))return e.map(w).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case We:return Be(e.data??"");case Ue:return`<!--${e.data??""}-->`;case be:{let t=e.localName,n=`<${t}${Tr(e)}>`;if(mr.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(w).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(w).join(""):""}import{createRoot as Wt}from"@fluixi/reactive/signal";import{setResourceTracker as Nr,setResourceIdSource as wr,setResourceDataSink as Sr,getOwner as vr,runWithOwner as Ht,flush as Ar}from"@fluixi/reactive/signal";var br=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Er={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function qt(e){return e.replace(/&(#?\w+);/g,(t,n)=>Er[n]??t)}var E=class extends Error{};function jt(e,t=!1){let n=0,r=[],o=[],s=c=>{let f=o[o.length-1];f?f.appendChild(c):r.push(c)};for(;n<e.length;){let c=e.indexOf("<",n);if(c===-1){a(e.slice(n));break}if(c>n&&a(e.slice(n,c)),e.startsWith("<!--",c)){let f=e.indexOf("-->",c);if(f===-1)throw new E(`unterminated comment at ${c}`);s(new F(e.slice(c+4,f))),n=f+3;continue}if(e[c+1]==="/"){let f=e.indexOf(">",c);if(f===-1)throw new E(`unterminated closing tag at ${c}`);let d=e.slice(c+2,f).trim().toLowerCase(),p=o.pop();if(!p||p.localName!==d)throw new E(`</${d}> does not close <${p?.localName??"nothing"}>`);n=f+1;continue}n=l(c)}if(o.length>0)throw new E(`unclosed <${o[o.length-1].localName}>`);let i=r[0];if(r.length!==1||!(i instanceof k))throw new E(`expected exactly one root element, got ${r.length}`);return i;function a(c){c!==""&&s(new O(qt(c)))}function l(c){let f=/[\s/>]/.exec(e.slice(c+1));if(!f)throw new E(`unterminated tag at ${c}`);let d=e.slice(c+1,c+1+f.index).toLowerCase(),p=new k(d,t),y=c+1+f.index;for(;y<e.length;){for(;y<e.length&&/\s/.test(e[y]);)y++;if(e[y]===">"){y++;break}if(e[y]==="/"&&e[y+1]===">"){y+=2;break}let Ee=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let V=e.slice(Ee,y);if(V==="")throw new E(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new E(`attribute ${V} must have a double-quoted value`);let Ne=e.indexOf('"',y+2);if(Ne===-1)throw new E(`unterminated value for ${V}`);p.setAttribute(V,qt(e.slice(y+2,Ne))),y=Ne+1}else p.setAttribute(V,"")}return s(p),br.has(d)||o.push(p),y}}var Ft=!1;function Ut(){Ft||(Ft=!0,rt({createElement:(e,t)=>new k(e,t),createText:e=>new O(e),createRaw:e=>new Te(e),parseTemplate:(e,t)=>jt(e,t),createComment:e=>new F(e)}))}function Bt(e,t={}){let n=g;Ut(),D(!0);let r=X(t.event);try{return J(r,()=>Wt(o=>{try{let s=typeof e=="function"?e():e;return w(s)}finally{o()}}))}finally{D(n)}}var Vt=!1;function Cr(){Vt||(Vt=!0,Nr(e=>{A()?.pending.add(e)}),wr(()=>A()?.nextResourceId()??""),Sr((e,t)=>{e&&A()?.data.set(e,t)}))}var Ke=null;function Kt(e){Ke=e}function ze(e){if(e.data.size===0)return"";let t={};for(let[r,o]of e.data){let s=o;if(Ke)try{s=Ke(o,r)}catch{continue}s!==void 0&&(t[r]=s)}if(Object.keys(t).length===0)return"";let n=ye(JSON.stringify(t));return`<script type="application/json" id="${Y}">${n}<\/script>`}var Rr=50;async function zt(e,t={}){let n=g;Ut(),D(!0),Cr();let r=X(t.event);try{return await J(r,async()=>{t.preload&&await t.preload(t.event);let o,s=null,i=()=>{};Wt(f=>{i=f,s=vr(),o=typeof e=="function"?e():e});let a=()=>{try{Ht(s,()=>w(o))}catch{}};a();let l=0;for(;r.pending.size>0&&l++<Rr;){let f=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(f),await Ar(),a()}let c=Ht(s,()=>w(o))+ze(r);return i(),c})}finally{D(n)}}var Mr="1.0.0-alpha.70";var Pr={createComponent:de,createElement:et,createNativeElement:ce,createTemplate:Oe,cloneTemplate:ke,templateNode:lt,holeContent:ft,holeEnd:ut,holeScope:ct,createPortal:ht,render:fe,hydrate:Z,insert:b,appendChildren:nt,removeChildren:tt,spread:mt,applyProps:ue,mergeProps:gt,setProperty:I,setDynamicProperty:G,setAttribute:h,setDynamicAttribute:z,removeAttribute:Qe,getAttribute:Ze,setClassName:q,addClass:Xe,removeClass:Je,toggleClass:Ye,setStyles:ve,delegateEvents:le,addDelegatedEventListener:Le,removeDelegatedEventListener:re,handleRef:j,resetIntegration:bt,isIntegrationInitialized:Tt},zs=Pr;export{Ot as ClientOnly,er as Dynamic,cr as ErrorBoundary,Y as FX_DATA_ID,Hn as For,Vn as Index,An as Island,Se as JSX_PROPERTIES,zn as Match,sr as NoSsr,rr as Portal,$r as SVG_ELEMENTS,W as SVG_NAMESPACE,In as Show,Gn as Switch,Mr as VERSION,_r as VOID_ELEMENTS,Xe as addClass,Le as addDelegatedEventListener,dt as addNativeEventListener,nt as appendChildren,we as applyElementProp,ue as applyProps,pt as applyUse,ao as asComponent,so as asContext,oo as asOutlet,io as asProvider,ro as asRoute,to as asRouter,no as asRoutes,lo as asSuspense,on as captureHydrationCursor,co as checkRenderType,fr as classMap,M as cleanChildren,ke as cloneTemplate,qr as closest,de as createComponent,ci as createDynamicElement,et as createElement,ce as createNativeElement,ht as createPortal,X as createRequestContext,Oe as createTemplate,zs as default,Ur as delegate,le as delegateEvents,ye as escapeFxJson,Mo as escapeHTML,vo as fnName,No as generateID,Ze as getAttribute,Qr as getGlobal,kr as getLitEventName,St as getLocals,Wr as getOffset,A as getRequestContext,_e as getRequestEvent,$e as getRequestLocals,me as getServerData,Eo as getStableElementId,Hr as getStyle,j as handleRef,jr as hasClass,ft as holeContent,ut as holeEnd,ct as holeScope,Mn as html,Z as hydrate,B as hydrateAdvancePast,Rn as hydrateIslands,as as indexArray,ko as initializeIntegration,b as insert,oe as insertExpression,Do as intergartionInitialized,Po as isAccessor,N as isComponent,nn as isContext,Gt as isCustomElement,Yr as isDOMNode,wo as isDelegatedEvent,Ce as isDomElement,$ as isDomNode,Re as isDomText,Or as isEventHandler,So as isFunction,Tt as isIntegrationInitialized,Jr as isJSXTemplate,Jt as isLitTemplateResult,Ro as isNativeElement,en as isOutlet,te as isPromise,tn as isProvider,Gr as isReactElement,Qt as isRoute,Yt as isRouter,Zt as isRoutes,xt as isSVGElement,g as isServer,rn as isSuspense,Xr as isTemplateFactory,Fr as isVisible,Ao as iterateFn,ss as keyArray,pn as makeArrayFlat,is as mapArray,gt as mergeProps,Kr as observeIntersection,zr as observeResize,Ge as query,Ir as queryAll,Oo as registerCreateComponent,Zr as registerGlobal,Qe as removeAttribute,tt as removeChildren,Je as removeClass,re as removeDelegatedEventListener,fe as render,Bt as renderToString,zt as renderToStringAsync,bt as resetIntegration,ee as runHydrationAt,J as runWithRequestContext,sn as runWithoutHydration,Vr as scrollIntoView,w as serializeNode,ze as serializeResourceData,h as setAttribute,ie as setClassList,q as setClassName,Kt as setDataRedactor,z as setDynamicAttribute,yt as setDynamicBoolAttribute,G as setDynamicProperty,I as setProperty,wt as setRequestStore,D as setServerMode,se as setStyle,ve as setStyles,Dr as shouldSetAsProperty,Co as splitProps,mt as spread,yr as styleMap,Pn as svg,lt as templateNode,Lr as toAttributeName,Ye as toggleClass,Br as waitForElement};
|
|
1
|
+
function $r(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function Ir(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function qr(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function jr(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 Fr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Hr=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"]),U="http://www.w3.org/2000/svg";function Zt(e){return e.localName.includes("-")}function Se(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(Zt(e)){e[t]=n;return}h(e,t,n,r)}var ve=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function Ze(e,t=document){return t.querySelector(e)}function Vr(e,t=document){return Array.from(t.querySelectorAll(e))}function Wr(e,t){return e.closest(t)}function Qe(e,...t){e.classList.add(...t)}function et(e,...t){e.classList.remove(...t)}function tt(e,...t){t.forEach(n=>e.classList.toggle(n))}function Ur(e,t){return e.classList.contains(t)}function h(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 nt(e,t){return e.getAttribute(t)}function rt(e,t){e.removeAttribute(t)}function Ae(e,t){Object.assign(e.style,t)}function Br(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function ot(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([o,s])=>{if(o==="class"||o==="className")r.className=s;else if(o==="style"&&typeof s=="object")Ae(r,s);else if(o.startsWith("on")&&typeof s=="function"){let i=o.slice(2).toLowerCase();r.addEventListener(i,s)}else h(r,o,s)}),n.forEach(o=>{typeof o=="string"?r.appendChild(document.createTextNode(o)):r.appendChild(o)}),r}function it(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function st(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function Kr(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function zr(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function Gr(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function Xr(e,t,n,r){let o=s=>{let i=s.target.closest(n);i&&e.contains(i)&&r(s,i)};return e.addEventListener(t,o),()=>{e.removeEventListener(t,o)}}function Jr(e,t=5e3){return new Promise((n,r)=>{let o=Ze(e);if(o){n(o);return}let s=new MutationObserver(()=>{let a=Ze(e);a&&(s.disconnect(),clearTimeout(i),n(a))});s.observe(document.body,{childList:!0,subtree:!0});let i=setTimeout(()=>{s.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function Yr(e,t,n={}){let r=new IntersectionObserver(o=>{o.forEach(s=>{t(s.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function Zr(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var Qt=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function Qr(e){return typeof e=="object"&&e!==null&&e.$$typeof===Qt}function en(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function eo(e){if(typeof e!="function")return!1;try{let t=e();return en(t)}catch{return!1}}function to(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function no(e){return e instanceof Node}function ro(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function oo(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}import{isSignal as b}from"@fluixi/reactive/signal";var Ce="1.0.0-alpha.71";import{VERSION as tn}from"@fluixi/reactive";var x={dom:Ce,reactive:tn};function nn(e){x.core=e}function Re(e){x.core&&e.setAttribute("fluixi",x.core),e.setAttribute("fx-dom",x.dom),e.setAttribute("fx-reactive",x.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=x)}function Me(){let e=[x.core,x.dom,x.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${x.core??"(absent)"}, dom ${x.dom}, reactive ${x.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function uo(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function fo(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function po(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function yo(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function mo(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function go(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function ho(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function xo(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function rn(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function on(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function sn(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function an(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function ln(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function cn(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function w(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function un(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function To(e){return rn(e)?{type:"router",value:e}:sn(e)?{type:"route",value:e}:on(e)?{type:"routes",value:e}:an(e)?{type:"outlet",value:e}:w(e)?{type:"component",value:e}:un(e)?{type:"suspense",value:e}:ln(e)?{type:"provider",value:e}:cn(e)?{type:"context",value:e}:{type:"none",value:e}}import{batch as ft,createEffect as z,createRenderEffect as m,createRoot as pn,onCleanup as O,readChildren as yn}from"@fluixi/reactive/signal";var g=typeof document>"u";function _(e){g=e}var B=Symbol.for("fluixi.server-node"),Pe=null;function at(e){Pe=e}function $(){if(!Pe)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Pe}function I(e){return e!=null&&e[B]===!0?!0:typeof Node<"u"&&e instanceof Node}function Oe(e){return e!=null&&e[B]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Le(e){return e!=null&&e[B]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},lt=null;function ct(e){lt=e}function ee(){return lt}function ke(e,t){return u.active&&t.parentNode===e}function De(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function fn(){return u.active?u.cursor:null}function te(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 dn(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 K(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&De(t)}function mn(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 gn(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 Oo(e){return gn(mn(e))}var Lo=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),hn={};var ut=new Map,re=new Set,le=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ce(e){if(!g)for(let t of e)re.has(t)||le.has(t)||(re.add(t),document.addEventListener(t,xn))}function xn(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 _e(e,t,n){if(e[`$$${t}`]=n,le.has(t)){let r=`__fx_${t}`;if(!e[r]){let o=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,o),e[r]=o}return}re.has(t)||ce([t])}function oe(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function ko(e){return!le.has(e)}function Do(e){return typeof e=="function"}function R(e,t=!1){if(g)return $().createText(e);if(u.active&&!t){let n=ee()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function ue(e,t=!1){if(g)return $().createElement(e,t);if(u.active){let n=ee()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(U,e):document.createElement(e)}function $e(e,t=!1){let n=ut.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,ut.set(e,r),r}function dt(e,t,n=!1,r=!1){if(g){let o=$();return n?o.parseTemplate(e,r):o.createRaw(e)}if(u.active){let o=ee()?.hydrateStatic(t);if(o)return o}return Ie($e(e,r),r).firstChild}function pt(e,t){if(!u.active)return t();let n=te(e.nextSibling,t);if(typeof n=="function"){let r=n;return((...o)=>u.active?te(e.nextSibling,()=>r(...o)):r(...o))}return n}function yt(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function mt(e,t){let n=[];for(let r=e.nextSibling;r&&r!==t;r=r.nextSibling)n.push(r);return n}function Ie(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Tn(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Tn(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function _o(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function $o(e){if(b(e)||w(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!b(t)&&!w(t);)t=t();return t}var A=0,bn=200;function En(e,t,n,r,o){let s=r,i=new Map;return m(()=>{let a;if(w(e)&&!b(e)){if(!i.has(e)){A++;try{let l=e();i.set(e,l)}finally{A--}}for(a=i.get(e);typeof a=="function"&&b(a);)a=a()}else for(a=e();typeof a=="function"&&b(a);)a=a();{let l=0;for(;typeof a=="function"&&l++<50;)if(w(a)){if(!i.has(a)){let c=a;A++;try{let f=c();i.set(c,f)}finally{A--}}a=i.get(a)}else if(b(a))a=a();else if(a=a(),typeof a!="function"||!b(a)&&!w(a))break}A++;try{s=ie(t,a,n,s,i),o(s)}finally{A--}})}function E(e,t,n,r){if(A>bn)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=R("",!0),e.appendChild(n));let o=r??null,s=l=>Array.isArray(l)&&l.some(c=>typeof c=="function"),i=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!s(t)){A++;try{o=ie(e,t,n,null)}finally{A--}return()=>o}let a=En(i(t),e,n,o,l=>{o=l});return()=>(a?.(),o)}function ie(e,t,n,r,o){if(t==null||typeof t=="boolean")return P(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return P(e,r,n);if(ne(t)){let i=R("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(i,r[0]),P(e,r.slice(1),n)):T(e,i,n):r?e.replaceChild(i,r):T(e,i,n),t.then(a=>{i.parentNode===e&&ie(e,a,i.nextSibling,i)}).catch(a=>{console.error("Error resolving promise in insertExpression:",a)}),i}let s=typeof t;if(s==="string"||s==="number"){if(s==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let a=R(t);return T(e,a,n),a}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=P(e,r,n)}if(r&&Le(r))return r.data=t,r;let i=R(t);return r&&r.parentNode===e?e.replaceChild(i,r):ke(e,i)||T(e,i,n),i}if(I(t))return ke(e,t)?(De(t),t):Array.isArray(r)?(r.length===0?T(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),P(e,r.slice(1),n)):T(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):T(e,t,n)):T(e,t,n),t);if(Array.isArray(t)){let i=[],a=Array.isArray(r)?r:r?[r]:[],l=[];v(t,i,e,n,!0,o,l);let c=Nn(e,a,i,n);for(let f of l){let d=E(e,f.sig,f.marker);O(()=>{P(e,d()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return c}if(s==="object"&&t!==null&&typeof t=="object"){let i=t;if("type"in i&&"props"in i){let a=i;if(typeof a.type=="function"){let l=a.type(a.props||{});return ie(e,l,n,r)}}}return P(e,r,n)}function v(e,t,n,r,o=!0,s,i){for(let a=0;a<e.length;a++){let l=e[a];if(!(l==null||typeof l=="boolean")){for(;typeof l=="function"&&!ne(l)&&!b(l)&&!w(l)&&(l=l(),!(l==null||typeof l=="boolean")););if(!(l==null||typeof l=="boolean")){if(typeof l=="function"){let c;for(w(l)&&!b(l)?(s||(s=new Map),s.has(l)||s.set(l,l()),c=s.get(l)):c=l();typeof c=="function"&&!ne(c)&&!b(c)&&!w(c);)s||(s=new Map),s.has(c)||s.set(c,c()),c=s.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if(b(c)){if(i){let d=R("",!0);t.push(d),i.push({marker:d,sig:c});continue}let f=c();for(;typeof f=="function"&&b(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?v(f,t,n,r,o,s):v([f],t,n,r,o,s);continue}continue}Array.isArray(c)?v(c,t,n,r,o,s,i):v([c],t,n,r,o,s,i);continue}if(ne(l)){let c=R("",!0);t.push(c),l.then(f=>{if(c.parentNode){let d=[];if(v([f],d,c.parentNode,void 0,!1,s),d.length>0){c.parentNode.replaceChild(d[0],c);for(let p=1;p<d.length;p++)c.parentNode?.insertBefore(d[p],d[p-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(l)){v(l,t,n,r,o,s,i);continue}if(I(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)?v(f,t,n,r,!1,s):v([f],t,n,r,!1,s);continue}}if(typeof l=="string"||typeof l=="number"){let c=String(l);if(c.trim()===""&&c!==" ")continue;t.push(R(c));continue}t.push(R(String(l)))}}}}function Nn(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,s=t.length,i=o,a=0,l=0,c=s>0?t[s-1].nextSibling??void 0:r,f=null;for(;a<s||l<i;){if(t[a]===n[l]){a++,l++;continue}for(;s>a&&i>l&&t[s-1]===n[i-1];)s--,i--;if(s===a){let d=i<o?l?n[l-1].nextSibling??void 0:n[i-l]:c;for(;l<i;)T(e,n[l++],d)}else if(i===l)for(;a<s;)(!f||!f.has(t[a]))&&t[a].parentNode===e&&e.removeChild(t[a]),a++;else if(t[a]===n[i-1]&&n[l]===t[s-1]){let d=t[--s].nextSibling;T(e,n[l++],t[a++].nextSibling),T(e,n[--i],d),t[s]=t[a-1]}else{if(!f){f=new Map;let p=l;for(;p<i;)f.set(n[p],p++)}let d=f.get(t[a]);if(d!=null)if(l<d&&d<i){let p=a,y=1;for(;++p<s&&p<i&&!(!f.has(t[p])||f.get(t[p])!==d+y);)y++;if(y>d-l){let Ne=t[a];for(;l<d;)T(e,n[l++],Ne)}else t[a].parentNode===e?e.replaceChild(n[l++],t[a++]):(T(e,n[l++],c),a++)}else a++;else t[a].parentNode===e&&e.removeChild(t[a]),a++}}return n}function P(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 T(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function q(e,t,n){n==null?delete e[t]:e[t]=n}function gt(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 ht(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 G(e,t,n,r=!1){return typeof n!="function"?(h(e,t,n,r),()=>{}):m(()=>{let o=typeof n=="function"?n():n;h(e,t,o,r)})}function X(e,t,n){return typeof n!="function"?(q(e,t,n),()=>{}):m(()=>{let r=typeof n=="function"?n():n;q(e,t,r)})}function xt(e,t,n){return typeof n!="function"?(h(e,t,!!n),()=>{}):m(()=>{let r=n();h(e,t,!!r)})}function j(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){m(()=>j(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 se(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let o=t[r],s=r.split(/\s+/).filter(Boolean);if(typeof o=="function"&&n)n.push(m(()=>{let i=!!o();for(let a of s)e.classList.toggle(a,i)}));else{let i=!!(typeof o=="function"?o():o);for(let a of s)e.classList.toggle(a,i)}}}function ae(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 Tt(e){let{element:t,props:n,prevProps:r=hn,isSVG:o=!1,skipChildren:s=!1}=e;if(!t||!Oe(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let i=o||t.namespaceURI===U,a=[];for(let l in n){if(s&&l==="children")continue;let c=n[l],f=r[l];if(c===f)continue;if(l==="ref"){F(c,t);continue}if(l==="use"){ht(t,c);continue}if(l.startsWith("on:")){a.push(gt(t,l.slice(3),c));continue}if(l.startsWith("prop:")){a.push(X(t,l.slice(5),c));continue}if(l.startsWith("attr:")){a.push(G(t,l.slice(5),c,i));continue}if(l.startsWith("bool:")){a.push(xt(t,l.slice(5),c));continue}if(l==="class"||l==="className"){typeof c=="function"?a.push(m(()=>j(t,c()))):j(t,c);continue}if(l==="classList"){typeof c=="function"?a.push(m(()=>se(t,c()))):se(t,c,a);continue}if(l==="style"){typeof c=="function"?a.push(m(()=>ae(t,c()))):ae(t,c);continue}if(l.startsWith("on")){let p=l.slice(2).toLowerCase();f&&oe(t,p),c&&_e(t,p,c);continue}let d=ve.has(l)||!i&&l in t;typeof c=="function"?a.push(d?X(t,l,c):G(t,l,c,i)):a.push(m(()=>d?q(t,l,n[l]):h(t,l,n[l],i)))}for(let l in r)if(!(l in n))if(l.startsWith("on")){let c=l.slice(2).toLowerCase();oe(t,c)}else ve.has(l)?q(t,l,null):t.removeAttribute(l);return()=>{a.forEach(l=>l())}}function fe(e,t,n=!1){for(let r in t){let o=t[r];if(r==="ref"){F(o,e);continue}if(r!=="children"){if(r==="use"){ht(e,o);continue}if(r.startsWith("on:")){gt(e,r.slice(3),o);continue}if(r.startsWith("prop:")){X(e,r.slice(5),o);continue}if(r.startsWith("attr:")){G(e,r.slice(5),o,n);continue}if(r.startsWith("bool:")){xt(e,r.slice(5),o);continue}if(r.startsWith("on")&&r.length>2){let s=r.slice(2).toLowerCase();if(typeof o=="function")if(le.has(s)){e[`$$${s}`]=o;let i=`__fx_${s}`;if(!e[i]){let a=l=>{e[`$$${s}`]?.(l)};e.addEventListener(s,a),e[i]=a}}else e[`$$${s}`]=o,re.has(s)||ce([s]);continue}if(r==="class"||r==="className"){j(e,o);continue}if(r==="classList"){typeof o=="function"?m(()=>se(e,o())):se(e,o);continue}if(r==="style"){typeof o=="function"?m(()=>ae(e,o())):ae(e,o);continue}if(r==="innerHTML"){if(typeof o=="function"){let s=z(()=>{let i=o();for(;typeof i=="function";)i=i();e.innerHTML=i});O(()=>s())}else e.innerHTML=o;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof o=="function"){let s=z(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.value=i??"")});O(()=>{s()})}else m(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof o=="function"){let s=z(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.checked=i??"")});O(()=>{s()})}else m(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof o=="function"){let s=!0,i=z(()=>{let a=o();for(;typeof a=="function"&&a.length===0;)a=a();s?(s=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""});O(()=>{i()})}else{let s=!0;m(()=>{let i=t[r];s?(s=!1,queueMicrotask(()=>{e.value=i??""})):e.value=i??""})}continue}if(typeof o=="function"){let s=z(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();Se(e,r,i,n)});O(()=>{s()})}else m(()=>Se(e,r,t[r],n))}}}function bt(...e){let t=r=>{for(let o=e.length-1;o>=0;o--){let s=e[o];if(s&&r in s&&s[r]!==void 0)return s[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 s of Reflect.ownKeys(o))r.add(s);return[...r]},getOwnPropertyDescriptor:(r,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>t(o)}:void 0})}function Io(e,...t){let n=new Set;for(let i of t)for(let a of i)n.add(a);let r=i=>({enumerable:!0,configurable:!0,get:()=>e[i]}),o=t.map(i=>{let a=new Set(i);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})}),s=new Proxy({},{get:(i,a)=>n.has(a)?void 0:e[a],has:(i,a)=>!n.has(a)&&a in e,ownKeys:()=>Reflect.ownKeys(e).filter(i=>!n.has(i)),getOwnPropertyDescriptor:(i,a)=>!n.has(a)&&a in e?r(a):void 0});return[...o,s]}function F(e,t){if(e){if(I(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 Et(e,t,n){let r=t||document.body,o=yn(()=>e),s=[];return ft(()=>{let i=m(()=>{let a=o();Array.isArray(a)?(a.forEach(l=>r.appendChild(l)),s.push(()=>{a.forEach(l=>{l.parentNode===r&&r.removeChild(l)})})):I(a)&&(r.appendChild(a),s.push(()=>{a.parentNode===r&&r.removeChild(a)}))});s.push(i),O(()=>{s.forEach(a=>a())})}),null}function qo(e){return typeof e=="string"&&e.toLowerCase()===e}function Nt(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 jo(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ne(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Fo(e){return typeof e=="function"&&e.length===0&&b(e)}function de(e,t,n){if(!t)throw new Error("Container element is required");let r,o,s=[];return pn(i=>{ft(()=>{u.active||(t.textContent=""),Re(t),Me(),E(t,e)}),o=i}),()=>{o?.(),r?.(),s.forEach(i=>i()),t.textContent=""}}var wn="__fx_dom_create_component__",L=globalThis[wn]??={fn:null};function Vo(e){L.fn=e}function Wo(e={}){let t=e.signalSystem?.createComponent;t&&(L.fn=t)}function pe(e,t){return L.fn?L.fn(e,t):(()=>e(t))}var Uo=()=>L.fn!==null,wt=()=>L.fn!==null;function St(){L.fn=null}var ye,At={getStore:()=>ye,run(e,t){let n=ye;ye=e;try{return t()}finally{ye=n}}},qe=At;function Ct(e){qe=e??At}function J(e={}){e.locals||(e.locals=e.request?Fe(e.request):{});let t=0,n=0,r=null,o=new Map,s=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let i=o.get(r)??0;return o.set(r,i+1),`${r}:r${i}`},nextIslandNamespace:i=>{let a=s.get(i)??0;return s.set(i,a+1),`${i}#${a}`},withResourceScope(i,a){let l=r;r=i;try{return a()}finally{r=l}},pending:new Set,data:new Map}}function Y(e,t){return qe.run(e,t)}function C(){return qe.getStore()}function je(){return C()?.event}function Rt(){let e=je();return e?(e.locals||(e.locals={}),e.locals):{}}var vt=new WeakMap;function Fe(e){let t=vt.get(e);return t||(t={},vt.set(e,t)),t}import{setResourceIdSource as Sn,setServerDataGetter as vn}from"@fluixi/reactive/signal";var Z="__FX_DATA__";function me(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var He;function ge(){let e=globalThis.__FX_DATA__;if(e)return e;if(He!==void 0)return He;let t=null;if(typeof document<"u"){let n=document.getElementById(Z)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return He=t}function he(){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 An=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),xe=typeof process<"u"&&process.env&&!1;function Te(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 Cn(e){he();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(An.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(xe&&t&&Te(`<${e}>`,t),null)}function Rn(e){he();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(u.cursor=t.nextSibling,t):(xe&&t&&Te(`<${e}> (static)`,t),null)}function Mn(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}he();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(xe&&t&&Te(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function Pn(e){he();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(xe&&t&&Te(`marker <!--${e.slice(0,24)}-->`,t),null)}var Mt=!1;function On(){Mt||(Mt=!0,ct({hydrateElement:Cn,hydrateText:Mn,hydrateMarker:Pn,hydrateStatic:Rn}))}function Q(e,t,n){On(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=ge(),o=n?.resourceNamespace,s=0;Sn(()=>o?`${o}:r${s++}`:`r${s++}`),vn(r?i=>i in r?{value:r[i]}:void 0:null);try{return de(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var Ve="fluixi-island";function Ln(e){let{component:t,props:n={},name:r}=e,o=ue(Ve),s=r??t.name??"Island";h(o,"name",s),h(o,"props",JSON.stringify(n??{}));let i=g?C():void 0;if(i){let a=i.nextIslandNamespace(s);E(o,()=>i.withResourceScope(a,()=>t(n)))}else E(o,()=>t(n));return o}var Pt=!1;function kn(){if(Pt||typeof document>"u")return;Pt=!0;let e=document.createElement("style");e.textContent=`${Ve}{display:contents}`,document.head.appendChild(e)}function Dn(e){if(typeof document>"u")return;kn();let t=document.querySelectorAll(Ve),n=new Map;t.forEach(r=>{let o=r.getAttribute("name")??"",s=n.get(o)??0;n.set(o,s+1);let i=e[o];if(!i){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{}Q(()=>i(a),r,{resourceNamespace:`${o}#${s}`})})}function _n(e,...t){throw new Error("html`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function $n(e,...t){throw new Error("svg`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}import{readChildren as In}from"@fluixi/reactive/signal";function Ti(e,t={}){if(typeof e=="function")return pe(e,t);if(typeof e!="string"||e.length===0)return null;let n=Nt(e);if(g)return $().createElement(e,n);let r=n?document.createElementNS(U,e):document.createElement(e);return fe(r,t,n),qn(r,t),r}function qn(e,t){if(!t||t.children===void 0)return;let n=In(()=>t.children),r=o=>{E(e,o,typeof o=="function"?null:void 0)};Array.isArray(n)?n.forEach(r):r(n)}import{createChildOwner as jn,createMemo as We,disposeScope as Fn,getOwner as Hn,runWithOwner as Vn,untrack as Dt}from"@fluixi/reactive/signal";function Ot(e){return typeof e=="function"?e:(()=>e)}function M(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Lt(e){return e!=null&&e!==!1}function kt(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function Wn(e){let t=M(()=>e.when),n=We(t,void 0),r=We(n,void 0),o=Hn(),s=null,i=null,a=l=>{l!==i&&(s&&Fn(s),s=jn(o),i=l)};return We(()=>{let l=r();return a(l?"when":"fallback"),Vn(s,()=>{if(l){let c=e.children;return typeof c=="function"&&!kt(c)?typeof n=="function"?Dt(()=>Dt(n)?c(n()):e.fallback):c(n):c}return e.fallback});return e.fallback??null},void 0,{name:"show"})}import{mapArray as Un,keyArray as Bn}from"@fluixi/reactive/signal";function Kn(e){let t=M(()=>e.each),n=()=>e.fallback??null,r=(o,s)=>{let i=e.children,a=Array.isArray(i)?i.map(l=>typeof l=="function"?l(o,s):l):typeof i=="function"?i(o,s):i;return K(a),a};return e.by?Bn(t,e.by,(o,s)=>r(o,s),{fallback:n}):Un(t,(o,s)=>r(o,s),{fallback:n})}import{indexArray as zn}from"@fluixi/reactive/signal";function Gn(e){let t=M(()=>e.each);return zn(t,(n,r)=>{let o=e.children(n,r);return K(o),o},{fallback:()=>e.fallback??null})}import{mapArray as ms,keyArray as gs,indexArray as hs}from"@fluixi/reactive/signal";import{createMemo as Xn,createChildOwner as Jn,disposeScope as Yn,getOwner as Zn,runWithOwner as _t}from"@fluixi/reactive/signal";var Ue=Symbol("match");function Qn(e){return{[Ue]:!0,when:M(()=>e.when),get children(){return e.children}}}function er(e){let t=Array.isArray(e.children)?e.children:[e.children],n=Zn(),r=null,o=-1,s=i=>{i!==o&&(r&&Yn(r),r=Jn(n),o=i)};return Xn(()=>{for(let i=0;i<t.length;i+=1){let l=t[i],c=0;for(;typeof l=="function"&&!l[Ue]&&c++<10;)l=l();if(!l||typeof l!="object"||l[Ue]!==!0)continue;let f=l.when();if(Lt(f))return s(i),_t(r,()=>typeof l.children=="function"?l.children(f):l.children)}return s(-2),_t(r,()=>e.fallback??null)})}import{createMemo as tr,createChildOwner as nr,disposeScope as rr,getOwner as or,runWithOwner as ir}from"@fluixi/reactive/signal";function sr(e){let t=Ot(e.component),{component:n,...r}=e,o=or(),s=null,i;return tr(()=>{let a=t();return a!==i&&(s&&rr(s),s=nr(o),i=a),a==null?null:typeof a=="string"?{tag:a,props:r}:ir(s,()=>a(r))})}import{createRoot as ar,onCleanup as lr}from"@fluixi/reactive/signal";function cr(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return ar(o=>{n=o,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),E(r,e.children)&&F(e.ref,r)}),lr(()=>{n(),r.remove()}),null}import{createMemo as ur,createSignal as fr}from"@fluixi/reactive/signal";function $t(e){if(g)return e.fallback??null;let t=u.active,[n,r]=fr(!t);return t&&queueMicrotask(()=>r(!0)),ur(()=>n()?e.children:e.fallback??null,void 0,{name:"client-only"})}var dr=$t;import{createMemo as pr,createSignal as yr}from"@fluixi/reactive/signal";function mr(e){let[t,n]=yr(null),r=()=>n(null);return pr(()=>{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(s){return n(s),typeof e.fallback=="function"?e.fallback(s,r):e.fallback}})}import{createMemo as gr}from"@fluixi/reactive/signal";function hr(e){return gr(()=>{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 xr}from"@fluixi/reactive/signal";function Tr(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function br(e){return xr(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;let s=typeof o=="function"?o():o;s!=null&&n.push(`${Tr(r)}: ${s}`)}return n.join("; ")})}var Ee=1,ze=3,Ge=8,It;It=B;var H=class{constructor(){this[It]=!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(){}},k=class e extends H{constructor(n){super();this.nodeType=ze;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)}},be=class e extends H{constructor(n){super();this.nodeType=Ee;this.rawOuterHTML=n}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},V=class e extends H{constructor(n){super();this.nodeType=Ge;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},Be=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}},D=class e extends H{constructor(n,r=!1){super();this.nodeType=Ee;this.attributes=new Map;this.style=new Be;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 k(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 Er=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jt=/&/g,Ft=/</g,Ht=/>/g,Nr=/"/g;function Xe(e){return e.replace(jt,"&").replace(Ft,"<").replace(Ht,">")}function qt(e){return e.replace(jt,"&").replace(Nr,""").replace(Ft,"<").replace(Ht,">")}function wr(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Sr(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(`${wr(n)}: ${r}`)}return t.join("; ")}function vr(e){let t="",n=Sr(e.style);for(let[r,o]of e.attributes)r==="style"&&n||(t+=` ${r}="${qt(o)}"`);if(n){let r=e.attributes.get("style"),o=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${qt(o)}"`}return t}function S(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Xe(e);if(typeof e=="number")return Xe(String(e));if(typeof e=="function")return S(e());if(Array.isArray(e))return e.map(S).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case ze:return Xe(e.data??"");case Ge:return`<!--${e.data??""}-->`;case Ee:{let t=e.localName,n=`<${t}${vr(e)}>`;if(Er.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(S).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(S).join(""):""}import{createRoot as zt}from"@fluixi/reactive/signal";import{setResourceTracker as Rr,setResourceIdSource as Mr,setResourceDataSink as Pr,getOwner as Or,runWithOwner as Ut,flush as Lr}from"@fluixi/reactive/signal";var Ar=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Cr={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Vt(e){return e.replace(/&(#?\w+);/g,(t,n)=>Cr[n]??t)}var N=class extends Error{};function Wt(e,t=!1){let n=0,r=[],o=[],s=c=>{let f=o[o.length-1];f?f.appendChild(c):r.push(c)};for(;n<e.length;){let c=e.indexOf("<",n);if(c===-1){a(e.slice(n));break}if(c>n&&a(e.slice(n,c)),e.startsWith("<!--",c)){let f=e.indexOf("-->",c);if(f===-1)throw new N(`unterminated comment at ${c}`);s(new V(e.slice(c+4,f))),n=f+3;continue}if(e[c+1]==="/"){let f=e.indexOf(">",c);if(f===-1)throw new N(`unterminated closing tag at ${c}`);let d=e.slice(c+2,f).trim().toLowerCase(),p=o.pop();if(!p||p.localName!==d)throw new N(`</${d}> does not close <${p?.localName??"nothing"}>`);n=f+1;continue}n=l(c)}if(o.length>0)throw new N(`unclosed <${o[o.length-1].localName}>`);let i=r[0];if(r.length!==1||!(i instanceof D))throw new N(`expected exactly one root element, got ${r.length}`);return i;function a(c){c!==""&&s(new k(Vt(c)))}function l(c){let f=/[\s/>]/.exec(e.slice(c+1));if(!f)throw new N(`unterminated tag at ${c}`);let d=e.slice(c+1,c+1+f.index).toLowerCase(),p=new D(d,t),y=c+1+f.index;for(;y<e.length;){for(;y<e.length&&/\s/.test(e[y]);)y++;if(e[y]===">"){y++;break}if(e[y]==="/"&&e[y+1]===">"){y+=2;break}let Ne=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let W=e.slice(Ne,y);if(W==="")throw new N(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new N(`attribute ${W} must have a double-quoted value`);let we=e.indexOf('"',y+2);if(we===-1)throw new N(`unterminated value for ${W}`);p.setAttribute(W,Vt(e.slice(y+2,we))),y=we+1}else p.setAttribute(W,"")}return s(p),Ar.has(d)||o.push(p),y}}var Bt=!1;function Gt(){Bt||(Bt=!0,at({createElement:(e,t)=>new D(e,t),createText:e=>new k(e),createRaw:e=>new be(e),parseTemplate:(e,t)=>Wt(e,t),createComment:e=>new V(e)}))}function Xt(e,t={}){let n=g;Gt(),_(!0);let r=J(t.event);try{return Y(r,()=>zt(o=>{try{let s=typeof e=="function"?e():e;return S(s)}finally{o()}}))}finally{_(n)}}var Kt=!1;function kr(){Kt||(Kt=!0,Rr(e=>{C()?.pending.add(e)}),Mr(()=>C()?.nextResourceId()??""),Pr((e,t)=>{e&&C()?.data.set(e,t)}))}var Je=null;function Jt(e){Je=e}function Ye(e){if(e.data.size===0)return"";let t={};for(let[r,o]of e.data){let s=o;if(Je)try{s=Je(o,r)}catch{continue}s!==void 0&&(t[r]=s)}if(Object.keys(t).length===0)return"";let n=me(JSON.stringify(t));return`<script type="application/json" id="${Z}">${n}<\/script>`}var Dr=50;async function Yt(e,t={}){let n=g;Gt(),_(!0),kr();let r=J(t.event);try{return await Y(r,async()=>{t.preload&&await t.preload(t.event);let o,s=null,i=()=>{};zt(f=>{i=f,s=Or(),o=typeof e=="function"?e():e});let a=()=>{try{Ut(s,()=>S(o))}catch{}};a();let l=0;for(;r.pending.size>0&&l++<Dr;){let f=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(f),await Lr(),a()}let c=Ut(s,()=>S(o))+Ye(r);return i(),c})}finally{_(n)}}var _r={createComponent:pe,createElement:ot,createNativeElement:ue,createTemplate:$e,cloneTemplate:Ie,templateNode:dt,holeContent:mt,holeEnd:yt,holeScope:pt,createPortal:Et,render:de,hydrate:Q,insert:E,appendChildren:st,removeChildren:it,spread:Tt,applyProps:fe,mergeProps:bt,setProperty:q,setDynamicProperty:X,setAttribute:h,setDynamicAttribute:G,removeAttribute:rt,getAttribute:nt,setClassName:j,addClass:Qe,removeClass:et,toggleClass:tt,setStyles:Ae,delegateEvents:ce,addDelegatedEventListener:_e,removeDelegatedEventListener:oe,handleRef:F,resetIntegration:St,isIntegrationInitialized:wt},na=_r;export{$t as ClientOnly,sr as Dynamic,mr as ErrorBoundary,Z as FX_DATA_ID,Kn as For,Gn as Index,Ln as Island,ve as JSX_PROPERTIES,Qn as Match,dr as NoSsr,cr as Portal,Hr as SVG_ELEMENTS,U as SVG_NAMESPACE,Wn as Show,er as Switch,Ce as VERSION,Fr as VOID_ELEMENTS,Qe as addClass,_e as addDelegatedEventListener,gt as addNativeEventListener,st as appendChildren,Se as applyElementProp,fe as applyProps,ht as applyUse,ho as asComponent,go as asContext,yo as asOutlet,mo as asProvider,po as asRoute,uo as asRouter,fo as asRoutes,xo as asSuspense,fn as captureHydrationCursor,To as checkRenderType,hr as classMap,P as cleanChildren,Ie as cloneTemplate,Wr as closest,pe as createComponent,Ti as createDynamicElement,ot as createElement,ue as createNativeElement,Et as createPortal,J as createRequestContext,$e as createTemplate,na as default,Xr as delegate,ce as delegateEvents,me as escapeFxJson,jo as escapeHTML,_o as fnName,Lo as generateID,nt as getAttribute,oo as getGlobal,qr as getLitEventName,Rt as getLocals,Gr as getOffset,C as getRequestContext,je as getRequestEvent,Fe as getRequestLocals,ge as getServerData,Oo as getStableElementId,Br as getStyle,F as handleRef,Ur as hasClass,mt as holeContent,yt as holeEnd,pt as holeScope,_n as html,Q as hydrate,K as hydrateAdvancePast,Dn as hydrateIslands,hs as indexArray,Wo as initializeIntegration,E as insert,ie as insertExpression,Uo as intergartionInitialized,Fo as isAccessor,w as isComponent,cn as isContext,Zt as isCustomElement,no as isDOMNode,ko as isDelegatedEvent,Oe as isDomElement,I as isDomNode,Le as isDomText,Ir as isEventHandler,Do as isFunction,wt as isIntegrationInitialized,to as isJSXTemplate,en as isLitTemplateResult,qo as isNativeElement,an as isOutlet,ne as isPromise,ln as isProvider,Qr as isReactElement,sn as isRoute,rn as isRouter,on as isRoutes,Nt as isSVGElement,g as isServer,un as isSuspense,eo as isTemplateFactory,Kr as isVisible,$o as iterateFn,gs as keyArray,Tn as makeArrayFlat,ms as mapArray,bt as mergeProps,Yr as observeIntersection,Zr as observeResize,Ze as query,Vr as queryAll,nn as registerCoreVersion,Vo as registerCreateComponent,ro as registerGlobal,rt as removeAttribute,it as removeChildren,et as removeClass,oe as removeDelegatedEventListener,de as render,Xt as renderToString,Yt as renderToStringAsync,St as resetIntegration,te as runHydrationAt,Y as runWithRequestContext,dn as runWithoutHydration,zr as scrollIntoView,S as serializeNode,Ye as serializeResourceData,h as setAttribute,se as setClassList,j as setClassName,Jt as setDataRedactor,G as setDynamicAttribute,xt as setDynamicBoolAttribute,X as setDynamicProperty,q as setProperty,Ct as setRequestStore,_ as setServerMode,ae as setStyle,Ae as setStyles,jr as shouldSetAsProperty,Io as splitProps,Tt as spread,Re as stampVersions,br as styleMap,$n as svg,dt as templateNode,$r as toAttributeName,tt as toggleClass,x as versions,Jr as waitForElement,Me as warnOnVersionSkew};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var R=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var n in t)R(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&&R(e,s,{get:()=>t[s],enumerable:!(o=Y(t,s))||o.enumerable});return e};var ne=e=>te(R({},"__esModule",{value:!0}),e);var Ee={};ee(Ee,{createDynamicElement:()=>xe});module.exports=ne(Ee);var m=require("@fluixi/reactive/signal");var M="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}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 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 H(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 O=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)O.has(t)||q.has(t)||(O.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 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(v(t)){let r=h("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(r,o[0]),N(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=N(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):H(e,r)||p(e,r,n),r}if(A(t))return H(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 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)(()=>{N(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 N(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 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 k(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"?(k(e,t,n),()=>{}):(0,d.createRenderEffect)(()=>{let o=typeof n=="function"?n():n;k(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 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 W(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 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"){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,O.has(a)||ie([a]);continue}if(o==="class"||o==="className"){K(e,s);continue}if(o==="classList"){typeof s=="function"?(0,d.createRenderEffect)(()=>W(e,s())):W(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 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(M,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
|
+
"use strict";var R=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var n in t)R(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&&R(e,s,{get:()=>t[s],enumerable:!(o=Y(t,s))||o.enumerable});return e};var ne=e=>te(R({},"__esModule",{value:!0}),e);var Ee={};ee(Ee,{createDynamicElement:()=>xe});module.exports=ne(Ee);var m=require("@fluixi/reactive/signal");var M="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}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 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 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(v(t)){let r=h("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(r,o[0]),N(e,o.slice(1),n)):y(e,r,n):o?e.replaceChild(r,o):y(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 y(e,i,n),i}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 r=h(t);return o&&o.parentNode===e?e.replaceChild(r,o):O(e,r)||y(e,r,n),r}if(A(t))return O(e,t)?(I(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 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)(()=>{N(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 N(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 p=1;p<c.length;p++)l.parentNode?.insertBefore(c[p],c[p-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;)y(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;y(e,n[f++],t[i++].nextSibling),y(e,n[--r],c),t[a]=t[i-1]}else{if(!u){u=new Map;let p=f;for(;p<r;)u.set(n[p],p++)}let c=u.get(t[i]);if(c!=null)if(f<c&&c<r){let p=i,L=1;for(;++p<a&&p<r&&!(!u.has(t[p])||u.get(t[p])!==c+L);)L++;if(L>c-f){let J=t[i];for(;f<c;)y(e,n[f++],J)}else t[i].parentNode===e?e.replaceChild(n[f++],t[i++]):(y(e,n[f++],l),i++)}else i++;else t[i].parentNode===e&&e.removeChild(t[i]),i++}}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 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 pe(e,t,n){return typeof n!="function"?(k(e,t,n),()=>{}):(0,d.createRenderEffect)(()=>{let o=typeof n=="function"?n():n;k(e,t,o)})}function ye(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):(0,d.createRenderEffect)(()=>{let o=n();T(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 W(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 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"){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:")){pe(e,o.slice(5),s);continue}if(o.startsWith("attr:")){de(e,o.slice(5),s,n);continue}if(o.startsWith("bool:")){ye(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)(()=>W(e,s())):W(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 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(M,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 +1 @@
|
|
|
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 H(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 Ae,createEffect as A,createRenderEffect as p,createRoot as ve,onCleanup as S,readChildren as Ce}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 O(e,t){return b.active&&t.parentNode===e}function k(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=R(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=R(e,t,n,null)}finally{x--}return()=>f}let i=ne(r(t),e,n,f,s=>{f=s});return()=>(i?.(),f)}function R(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 r=h("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(r,o[0]),N(e,o.slice(1),n)):y(e,r,n):o?e.replaceChild(r,o):y(e,r,n),t.then(i=>{r.parentNode===e&&R(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=N(e,o,n)}if(o&&$(o))return o.data=t,o;let r=h(t);return o&&o.parentNode===e?e.replaceChild(r,o):O(e,r)||y(e,r,n),r}if(C(t))return O(e,t)?(k(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 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(()=>{N(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 R(e,s,n,o)}}}return N(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,M=1;for(;++d<a&&d<r&&!(!u.has(t[d])||u.get(t[d])!==c+M);)M++;if(M>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 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 W(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"?(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"?(W(e,t,n),()=>{}):p(()=>{let o=typeof n=="function"?n():n;W(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 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(()=>V(e,f())):V(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();H(e,o,r,n)});S(()=>{a()})}else p(()=>H(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 $e(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{$e 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}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 pe=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 Ae,createEffect as A,createRenderEffect as y,createRoot as ve,onCleanup as S,readChildren as Ce}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 k(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 y(()=>{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=R(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=R(e,t,n,null)}finally{x--}return()=>f}let i=ne(r(t),e,n,f,s=>{f=s});return()=>(i?.(),f)}function R(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 r=h("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(r,o[0]),N(e,o.slice(1),n)):p(e,r,n):o?e.replaceChild(r,o):p(e,r,n),t.then(i=>{r.parentNode===e&&R(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=N(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)||p(e,r,n),r}if(C(t))return H(e,t)?(k(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 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(()=>{N(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 R(e,s,n,o)}}}return N(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;)p(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;p(e,n[s++],t[i++].nextSibling),p(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,M=1;for(;++d<a&&d<r&&!(!u.has(t[d])||u.get(t[d])!==c+M);)M++;if(M>c-s){let J=t[i];for(;s<c;)p(e,n[s++],J)}else t[i].parentNode===e?e.replaceChild(n[s++],t[i++]):(p(e,n[s++],l),i++)}else i++;else t[i].parentNode===e&&e.removeChild(t[i]),i++}}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 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"?(T(e,t,n,o),()=>{}):y(()=>{let f=typeof n=="function"?n():n;T(e,t,f,o)})}function fe(e,t,n){return typeof n!="function"?(W(e,t,n),()=>{}):y(()=>{let o=typeof n=="function"?n():n;W(e,t,o)})}function ae(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):y(()=>{let o=n();T(e,t,!!o)})}function B(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){y(()=>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(y(()=>{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"?y(()=>V(e,f())):V(e,f);continue}if(o==="style"){typeof f=="function"?y(()=>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 y(()=>{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 y(()=>{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;y(()=>{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 y(()=>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 $e(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{$e as createDynamicElement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _=Object.defineProperty;var
|
|
1
|
+
"use strict";var _=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.prototype.hasOwnProperty;var ne=(n,e)=>{for(var t in e)_(n,t,{get:e[t],enumerable:!0})},te=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of Z(e))!ee.call(n,c)&&c!==t&&_(n,c,{get:()=>e[c],enumerable:!(i=Q(e,c))||i.enumerable});return n};var oe=n=>te(_({},"__esModule",{value:!0}),n);var he={};ne(he,{hydrate:()=>pe});module.exports=oe(he);var x=require("@fluixi/reactive/signal");var $="1.0.0-alpha.71";var D=require("@fluixi/reactive"),h={dom:$,reactive:D.VERSION};function O(n){h.core&&n.setAttribute("fluixi",h.core),n.setAttribute("fx-dom",h.dom),n.setAttribute("fx-reactive",h.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=h)}function F(){let n=[h.core,h.dom,h.reactive].filter(e=>e!==void 0);new Set(n).size<=1||console.warn(`[fluixi] package versions disagree — core ${h.core??"(absent)"}, dom ${h.dom}, reactive ${h.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function E(n){return typeof n=="function"&&n[Symbol.for("fluixi-component")]===!0}var g=require("@fluixi/reactive/signal");var j=typeof document>"u";var V=Symbol.for("fluixi.server-node"),H=null;function I(){if(!H)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return H}function L(n){return n!=null&&n[V]===!0?!0:typeof Node<"u"&&n instanceof Node}function W(n){return n!=null&&n[V]===!0?n.nodeType===3:typeof Text<"u"&&n instanceof Text}var u={active:!1,cursor:null,parents:[]},K=null;function B(n){K=n}function X(){return K}function R(n,e){return u.active&&e.parentNode===n}function q(n){let e=u.parents.lastIndexOf(n);e!==-1&&(u.parents.length=e),u.cursor=n.nextSibling}function b(n,e=!1){if(j)return I().createText(n);if(u.active&&!e){let t=X()?.hydrateText(n);if(t)return t}return document.createTextNode(n)}var N=0,re=200;function ie(n,e,t,i,c){let f=i,s=new Map;return(0,g.createRenderEffect)(()=>{let r;if(E(n)&&!(0,x.isSignal)(n)){if(!s.has(n)){N++;try{let o=n();s.set(n,o)}finally{N--}}for(r=s.get(n);typeof r=="function"&&(0,x.isSignal)(r);)r=r()}else for(r=n();typeof r=="function"&&(0,x.isSignal)(r);)r=r();{let o=0;for(;typeof r=="function"&&o++<50;)if(E(r)){if(!s.has(r)){let a=r;N++;try{let l=a();s.set(a,l)}finally{N--}}r=s.get(r)}else if((0,x.isSignal)(r))r=r();else if(r=r(),typeof r!="function"||!(0,x.isSignal)(r)&&!E(r))break}N++;try{f=S(e,r,t,f,s),c(f)}finally{N--}})}function J(n,e,t,i){if(N>re)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=b("",!0),n.appendChild(t));let c=i??null,f=o=>Array.isArray(o)&&o.some(a=>typeof a=="function"),s=o=>typeof o=="function"?o:()=>o;if(typeof e!="function"&&!f(e)){N++;try{c=S(n,e,t,null)}finally{N--}return()=>c}let r=ie(s(e),n,t,c,o=>{c=o});return()=>(r?.(),c)}function S(n,e,t,i,c){if(e==null||typeof e=="boolean")return T(n,i,t);if(typeof e=="function")for(;typeof e=="function";)e=e();if(e==null||typeof e=="boolean")return T(n,i,t);if(w(e)){let s=b("",!0);return Array.isArray(i)?i.length>0?(n.replaceChild(s,i[0]),T(n,i.slice(1),t)):p(n,s,t):i?n.replaceChild(s,i):p(n,s,t),e.then(r=>{s.parentNode===n&&S(n,r,s.nextSibling,s)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),s}let f=typeof e;if(f==="string"||f==="number"){if(f==="number"&&(e=String(e)),Array.isArray(i)){if(i.length===0){let r=b(e);return p(n,r,t),r}if(i.length===1&&i[0].nodeType===3)return i[0].data=e,i;i=T(n,i,t)}if(i&&W(i))return i.data=e,i;let s=b(e);return i&&i.parentNode===n?n.replaceChild(s,i):R(n,s)||p(n,s,t),s}if(L(e))return R(n,e)?(q(e),e):Array.isArray(i)?(i.length===0?p(n,e,t):i[0].parentNode===n?(n.replaceChild(e,i[0]),T(n,i.slice(1),t)):p(n,e,t),e):(i?i!==e&&(i.parentNode===n?n.replaceChild(e,i):p(n,e,t)):p(n,e,t),e);if(Array.isArray(e)){let s=[],r=Array.isArray(i)?i:i?[i]:[],o=[];m(e,s,n,t,!0,c,o);let a=se(n,r,s,t);for(let l of o){let d=J(n,l.sig,l.marker);(0,g.onCleanup)(()=>{T(n,d()),l.marker.parentNode===n&&n.removeChild(l.marker)})}return a}if(f==="object"&&e!==null&&typeof e=="object"){let s=e;if("type"in s&&"props"in s){let r=s;if(typeof r.type=="function"){let o=r.type(r.props||{});return S(n,o,t,i)}}}return T(n,i,t)}function m(n,e,t,i,c=!0,f,s){for(let r=0;r<n.length;r++){let o=n[r];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!w(o)&&!(0,x.isSignal)(o)&&!E(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let a;for(E(o)&&!(0,x.isSignal)(o)?(f||(f=new Map),f.has(o)||f.set(o,o()),a=f.get(o)):a=o();typeof a=="function"&&!w(a)&&!(0,x.isSignal)(a)&&!E(a);)f||(f=new Map),f.has(a)||f.set(a,a()),a=f.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if((0,x.isSignal)(a)){if(s){let d=b("",!0);e.push(d),s.push({marker:d,sig:a});continue}let l=a();for(;typeof l=="function"&&(0,x.isSignal)(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?m(l,e,t,i,c,f):m([l],e,t,i,c,f);continue}continue}Array.isArray(a)?m(a,e,t,i,c,f,s):m([a],e,t,i,c,f,s);continue}if(w(o)){let a=b("",!0);e.push(a),o.then(l=>{if(a.parentNode){let d=[];if(m([l],d,a.parentNode,void 0,!1,f),d.length>0){a.parentNode.replaceChild(d[0],a);for(let y=1;y<d.length;y++)a.parentNode?.insertBefore(d[y],d[y-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(o)){m(o,e,t,i,c,f,s);continue}if(L(o)){e.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let a=o;if(typeof a.type=="function"){let l=a.type(a.props||{});Array.isArray(l)?m(l,e,t,i,!1,f):m([l],e,t,i,!1,f);continue}}if(typeof o=="string"||typeof o=="number"){let a=String(o);if(a.trim()===""&&a!==" ")continue;e.push(b(a));continue}e.push(b(String(o)))}}}}function se(n,e,t,i){for(let d=0;d<t.length;d++)t[d].parentNode!==null&&t[d].parentNode!==n&&(t=t.slice(),t[d]=t[d].cloneNode(!0));let c=t.length,f=e.length,s=c,r=0,o=0,a=f>0?e[f-1].nextSibling??void 0:i,l=null;for(;r<f||o<s;){if(e[r]===t[o]){r++,o++;continue}for(;f>r&&s>o&&e[f-1]===t[s-1];)f--,s--;if(f===r){let d=s<c?o?t[o-1].nextSibling??void 0:t[s-o]:a;for(;o<s;)p(n,t[o++],d)}else if(s===o)for(;r<f;)(!l||!l.has(e[r]))&&e[r].parentNode===n&&n.removeChild(e[r]),r++;else if(e[r]===t[s-1]&&t[o]===e[f-1]){let d=e[--f].nextSibling;p(n,t[o++],e[r++].nextSibling),p(n,t[--s],d),e[f]=e[r-1]}else{if(!l){l=new Map;let y=o;for(;y<s;)l.set(t[y],y++)}let d=l.get(e[r]);if(d!=null)if(o<d&&d<s){let y=r,P=1;for(;++y<f&&y<s&&!(!l.has(e[y])||l.get(e[y])!==d+P);)P++;if(P>d-o){let Y=e[r];for(;o<d;)p(n,t[o++],Y)}else e[r].parentNode===n?n.replaceChild(t[o++],e[r++]):(p(n,t[o++],a),r++)}else r++;else e[r].parentNode===n&&n.removeChild(e[r]),r++}}return t}function T(n,e,t){if(e)if(Array.isArray(e))for(let i=0;i<e.length;i++)e[i].parentNode===n&&n.removeChild(e[i]);else e.parentNode===n&&n.removeChild(e);return null}function p(n,e,t){u.active&&e.parentNode===n||(t&&t.parentNode===n?n.insertBefore(e,t):n.appendChild(e))}function w(n){return n!=null&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"||n instanceof Promise}function U(n,e,t){if(!e)throw new Error("Container element is required");let i,c,f=[];return(0,g.createRoot)(s=>{(0,g.batch)(()=>{u.active||(e.textContent=""),O(e),F(),J(e,n)}),c=s}),()=>{c?.(),i?.(),f.forEach(s=>s()),e.textContent=""}}var A=require("@fluixi/reactive/signal");var fe="__FX_DATA__";var M;function z(){let n=globalThis.__FX_DATA__;if(n)return n;if(M!==void 0)return M;let e=null;if(typeof document<"u"){let t=document.getElementById(fe)?.textContent;if(t)try{e=JSON.parse(t)}catch{e=null}}return M=e}function v(){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 ae=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),C=typeof process<"u"&&process.env&&!1;function k(n,e){let t=e.nodeType===1?`<${e.tagName.toLowerCase()}>`:e.nodeType===3?`text ${JSON.stringify((e.nodeValue??"").slice(0,24))}`:e.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${n} but the server DOM has ${t}. 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 ue(n){v();let e=u.cursor;return e&&e.nodeType===1&&e.tagName.toLowerCase()===n.toLowerCase()?(ae.has(n.toLowerCase())?u.cursor=e.nextSibling:(u.parents.push(e),u.cursor=e.firstChild),e):(C&&e&&k(`<${n}>`,e),null)}function le(n){v();let e=u.cursor;return e&&e.nodeType===1&&e.tagName.toLowerCase()===n.toLowerCase()?(u.cursor=e.nextSibling,e):(C&&e&&k(`<${n}> (static)`,e),null)}function ce(n){if(n===""){let t=u.cursor;return t&&t.nodeType===3&&t.data!==""?(u.cursor=t.nextSibling,t.data="",t):null}v();let e=u.cursor;return e&&e.nodeType===3?(u.cursor=e.nextSibling,e.nodeValue!==n&&(e.nodeValue=n),e):(C&&e&&k(`text ${JSON.stringify(n.slice(0,24))}`,e),null)}function de(n){v();let e=u.cursor;return e&&e.nodeType===8&&e.data===n?(u.cursor=e.nextSibling,e):(C&&e&&k(`marker <!--${n.slice(0,24)}-->`,e),null)}var G=!1;function ye(){G||(G=!0,B({hydrateElement:ue,hydrateText:ce,hydrateMarker:de,hydrateStatic:le}))}function pe(n,e,t){ye(),u.active=!0,u.cursor=e.firstChild,u.parents=[];let i=z(),c=t?.resourceNamespace,f=0;(0,A.setResourceIdSource)(()=>c?`${c}:r${f++}`:`r${f++}`),(0,A.setServerDataGetter)(i?s=>s in i?{value:i[s]}:void 0:null);try{return U(n,e)}finally{u.active=!1,u.cursor=null,u.parents=[]}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isSignal as
|
|
1
|
+
import{isSignal as x}from"@fluixi/reactive/signal";var L="1.0.0-alpha.71";import{VERSION as U}from"@fluixi/reactive";var h={dom:L,reactive:U};function R(n){h.core&&n.setAttribute("fluixi",h.core),n.setAttribute("fx-dom",h.dom),n.setAttribute("fx-reactive",h.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=h)}function M(){let n=[h.core,h.dom,h.reactive].filter(e=>e!==void 0);new Set(n).size<=1||console.warn(`[fluixi] package versions disagree — core ${h.core??"(absent)"}, dom ${h.dom}, reactive ${h.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function b(n){return typeof n=="function"&&n[Symbol.for("fluixi-component")]===!0}import{batch as z,createEffect as Se,createRenderEffect as G,createRoot as Y,onCleanup as Q,readChildren as Ae}from"@fluixi/reactive/signal";var D=typeof document>"u";var O=Symbol.for("fluixi.server-node"),$=null;function F(){if(!$)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return $}function k(n){return n!=null&&n[O]===!0?!0:typeof Node<"u"&&n instanceof Node}function H(n){return n!=null&&n[O]===!0?n.nodeType===3:typeof Text<"u"&&n instanceof Text}var u={active:!1,cursor:null,parents:[]},j=null;function V(n){j=n}function I(){return j}function P(n,e){return u.active&&e.parentNode===n}function W(n){let e=u.parents.lastIndexOf(n);e!==-1&&(u.parents.length=e),u.cursor=n.nextSibling}function N(n,e=!1){if(D)return F().createText(n);if(u.active&&!e){let t=I()?.hydrateText(n);if(t)return t}return document.createTextNode(n)}var m=0,Z=200;function ee(n,e,t,i,d){let f=i,s=new Map;return G(()=>{let r;if(b(n)&&!x(n)){if(!s.has(n)){m++;try{let o=n();s.set(n,o)}finally{m--}}for(r=s.get(n);typeof r=="function"&&x(r);)r=r()}else for(r=n();typeof r=="function"&&x(r);)r=r();{let o=0;for(;typeof r=="function"&&o++<50;)if(b(r)){if(!s.has(r)){let a=r;m++;try{let l=a();s.set(a,l)}finally{m--}}r=s.get(r)}else if(x(r))r=r();else if(r=r(),typeof r!="function"||!x(r)&&!b(r))break}m++;try{f=w(e,r,t,f,s),d(f)}finally{m--}})}function K(n,e,t,i){if(m>Z)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=N("",!0),n.appendChild(t));let d=i??null,f=o=>Array.isArray(o)&&o.some(a=>typeof a=="function"),s=o=>typeof o=="function"?o:()=>o;if(typeof e!="function"&&!f(e)){m++;try{d=w(n,e,t,null)}finally{m--}return()=>d}let r=ee(s(e),n,t,d,o=>{d=o});return()=>(r?.(),d)}function w(n,e,t,i,d){if(e==null||typeof e=="boolean")return E(n,i,t);if(typeof e=="function")for(;typeof e=="function";)e=e();if(e==null||typeof e=="boolean")return E(n,i,t);if(T(e)){let s=N("",!0);return Array.isArray(i)?i.length>0?(n.replaceChild(s,i[0]),E(n,i.slice(1),t)):p(n,s,t):i?n.replaceChild(s,i):p(n,s,t),e.then(r=>{s.parentNode===n&&w(n,r,s.nextSibling,s)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),s}let f=typeof e;if(f==="string"||f==="number"){if(f==="number"&&(e=String(e)),Array.isArray(i)){if(i.length===0){let r=N(e);return p(n,r,t),r}if(i.length===1&&i[0].nodeType===3)return i[0].data=e,i;i=E(n,i,t)}if(i&&H(i))return i.data=e,i;let s=N(e);return i&&i.parentNode===n?n.replaceChild(s,i):P(n,s)||p(n,s,t),s}if(k(e))return P(n,e)?(W(e),e):Array.isArray(i)?(i.length===0?p(n,e,t):i[0].parentNode===n?(n.replaceChild(e,i[0]),E(n,i.slice(1),t)):p(n,e,t),e):(i?i!==e&&(i.parentNode===n?n.replaceChild(e,i):p(n,e,t)):p(n,e,t),e);if(Array.isArray(e)){let s=[],r=Array.isArray(i)?i:i?[i]:[],o=[];g(e,s,n,t,!0,d,o);let a=ne(n,r,s,t);for(let l of o){let c=K(n,l.sig,l.marker);Q(()=>{E(n,c()),l.marker.parentNode===n&&n.removeChild(l.marker)})}return a}if(f==="object"&&e!==null&&typeof e=="object"){let s=e;if("type"in s&&"props"in s){let r=s;if(typeof r.type=="function"){let o=r.type(r.props||{});return w(n,o,t,i)}}}return E(n,i,t)}function g(n,e,t,i,d=!0,f,s){for(let r=0;r<n.length;r++){let o=n[r];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!T(o)&&!x(o)&&!b(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let a;for(b(o)&&!x(o)?(f||(f=new Map),f.has(o)||f.set(o,o()),a=f.get(o)):a=o();typeof a=="function"&&!T(a)&&!x(a)&&!b(a);)f||(f=new Map),f.has(a)||f.set(a,a()),a=f.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(x(a)){if(s){let c=N("",!0);e.push(c),s.push({marker:c,sig:a});continue}let l=a();for(;typeof l=="function"&&x(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?g(l,e,t,i,d,f):g([l],e,t,i,d,f);continue}continue}Array.isArray(a)?g(a,e,t,i,d,f,s):g([a],e,t,i,d,f,s);continue}if(T(o)){let a=N("",!0);e.push(a),o.then(l=>{if(a.parentNode){let c=[];if(g([l],c,a.parentNode,void 0,!1,f),c.length>0){a.parentNode.replaceChild(c[0],a);for(let y=1;y<c.length;y++)a.parentNode?.insertBefore(c[y],c[y-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(o)){g(o,e,t,i,d,f,s);continue}if(k(o)){e.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let a=o;if(typeof a.type=="function"){let l=a.type(a.props||{});Array.isArray(l)?g(l,e,t,i,!1,f):g([l],e,t,i,!1,f);continue}}if(typeof o=="string"||typeof o=="number"){let a=String(o);if(a.trim()===""&&a!==" ")continue;e.push(N(a));continue}e.push(N(String(o)))}}}}function ne(n,e,t,i){for(let c=0;c<t.length;c++)t[c].parentNode!==null&&t[c].parentNode!==n&&(t=t.slice(),t[c]=t[c].cloneNode(!0));let d=t.length,f=e.length,s=d,r=0,o=0,a=f>0?e[f-1].nextSibling??void 0:i,l=null;for(;r<f||o<s;){if(e[r]===t[o]){r++,o++;continue}for(;f>r&&s>o&&e[f-1]===t[s-1];)f--,s--;if(f===r){let c=s<d?o?t[o-1].nextSibling??void 0:t[s-o]:a;for(;o<s;)p(n,t[o++],c)}else if(s===o)for(;r<f;)(!l||!l.has(e[r]))&&e[r].parentNode===n&&n.removeChild(e[r]),r++;else if(e[r]===t[s-1]&&t[o]===e[f-1]){let c=e[--f].nextSibling;p(n,t[o++],e[r++].nextSibling),p(n,t[--s],c),e[f]=e[r-1]}else{if(!l){l=new Map;let y=o;for(;y<s;)l.set(t[y],y++)}let c=l.get(e[r]);if(c!=null)if(o<c&&c<s){let y=r,C=1;for(;++y<f&&y<s&&!(!l.has(e[y])||l.get(e[y])!==c+C);)C++;if(C>c-o){let J=e[r];for(;o<c;)p(n,t[o++],J)}else e[r].parentNode===n?n.replaceChild(t[o++],e[r++]):(p(n,t[o++],a),r++)}else r++;else e[r].parentNode===n&&n.removeChild(e[r]),r++}}return t}function E(n,e,t){if(e)if(Array.isArray(e))for(let i=0;i<e.length;i++)e[i].parentNode===n&&n.removeChild(e[i]);else e.parentNode===n&&n.removeChild(e);return null}function p(n,e,t){u.active&&e.parentNode===n||(t&&t.parentNode===n?n.insertBefore(e,t):n.appendChild(e))}function T(n){return n!=null&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"||n instanceof Promise}function B(n,e,t){if(!e)throw new Error("Container element is required");let i,d,f=[];return Y(s=>{z(()=>{u.active||(e.textContent=""),R(e),M(),K(e,n)}),d=s}),()=>{d?.(),i?.(),f.forEach(s=>s()),e.textContent=""}}import{setResourceIdSource as oe,setServerDataGetter as re}from"@fluixi/reactive/signal";var te="__FX_DATA__";var _;function X(){let n=globalThis.__FX_DATA__;if(n)return n;if(_!==void 0)return _;let e=null;if(typeof document<"u"){let t=document.getElementById(te)?.textContent;if(t)try{e=JSON.parse(t)}catch{e=null}}return _=e}function S(){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 ie=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),A=typeof process<"u"&&process.env&&!1;function v(n,e){let t=e.nodeType===1?`<${e.tagName.toLowerCase()}>`:e.nodeType===3?`text ${JSON.stringify((e.nodeValue??"").slice(0,24))}`:e.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${n} but the server DOM has ${t}. 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 se(n){S();let e=u.cursor;return e&&e.nodeType===1&&e.tagName.toLowerCase()===n.toLowerCase()?(ie.has(n.toLowerCase())?u.cursor=e.nextSibling:(u.parents.push(e),u.cursor=e.firstChild),e):(A&&e&&v(`<${n}>`,e),null)}function fe(n){S();let e=u.cursor;return e&&e.nodeType===1&&e.tagName.toLowerCase()===n.toLowerCase()?(u.cursor=e.nextSibling,e):(A&&e&&v(`<${n}> (static)`,e),null)}function ae(n){if(n===""){let t=u.cursor;return t&&t.nodeType===3&&t.data!==""?(u.cursor=t.nextSibling,t.data="",t):null}S();let e=u.cursor;return e&&e.nodeType===3?(u.cursor=e.nextSibling,e.nodeValue!==n&&(e.nodeValue=n),e):(A&&e&&v(`text ${JSON.stringify(n.slice(0,24))}`,e),null)}function ue(n){S();let e=u.cursor;return e&&e.nodeType===8&&e.data===n?(u.cursor=e.nextSibling,e):(A&&e&&v(`marker <!--${n.slice(0,24)}-->`,e),null)}var q=!1;function le(){q||(q=!0,V({hydrateElement:se,hydrateText:ae,hydrateMarker:ue,hydrateStatic:fe}))}function De(n,e,t){le(),u.active=!0,u.cursor=e.firstChild,u.parents=[];let i=X(),d=t?.resourceNamespace,f=0;oe(()=>d?`${d}:r${f++}`:`r${f++}`),re(i?s=>s in i?{value:i[s]}:void 0:null);try{return B(n,e)}finally{u.active=!1,u.cursor=null,u.parents=[]}}export{De as hydrate};
|