@fluixi/dom 1.0.0-alpha.80 → 1.0.0-alpha.82
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-client.cjs +1 -1
- package/dist/cdn/dom-client.global.js +1 -1
- package/dist/cdn/dom-client.mjs +1 -1
- 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.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.mjs +1 -1
- package/dist/lib/dom/versions.cjs +1 -1
- package/dist/lib/dom/versions.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/cdn/dom-client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var G=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Xe=Object.prototype.hasOwnProperty;var Je=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},Ye=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ge(t))!Xe.call(e,i)&&i!==n&&G(e,i,{get:()=>t[i],enumerable:!(r=qe(t,i))||r.enumerable});return e};var Ze=e=>Ye(G({},"__esModule",{value:!0}),e);var xt={};Je(xt,{Dynamic:()=>ue,ErrorBoundary:()=>pe,For:()=>se,Index:()=>ae,Match:()=>le,Portal:()=>de,Show:()=>ie,Switch:()=>fe,batch:()=>d.batch,classMap:()=>ye,createComponent:()=>$e,createComputed:()=>d.createComputed,createContext:()=>d.createContext,createEffect:()=>d.createEffect,createElement:()=>ge,createMemo:()=>d.createMemo,createRenderEffect:()=>d.createRenderEffect,createResource:()=>d.createResource,createRoot:()=>d.createRoot,createSignal:()=>d.createSignal,delegateEvents:()=>te,effect:()=>d.effect,hydrate:()=>oe,indexArray:()=>S.indexArray,insert:()=>k,keyArray:()=>S.keyArray,mapArray:()=>S.mapArray,memo:()=>d.memo,onCleanup:()=>d.onCleanup,render:()=>I,setAttribute:()=>w,setClassName:()=>L,setProperty:()=>R,setStyle:()=>$,signal:()=>d.signal,spread:()=>Fe,store:()=>d.store,styleMap:()=>me,untrack:()=>d.untrack,useContext:()=>d.useContext});module.exports=Ze(xt);var he="http://www.w3.org/2000/svg";var X=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function w(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 Qe(e,t){Object.assign(e.style,t)}function ge(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,a])=>{if(i==="class"||i==="className")r.className=a;else if(i==="style"&&typeof a=="object")Qe(r,a);else if(i.startsWith("on")&&typeof a=="function"){let c=i.slice(2).toLowerCase();r.addEventListener(c,a)}else w(r,i,a)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}var Tt=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var b=require("@fluixi/reactive/signal");var xe="1.0.0-alpha.80";var be=require("@fluixi/reactive/version"),x={dom:xe,reactive:be.VERSION};function Te(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 Ee(){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 we(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function P(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var m=require("@fluixi/reactive/signal");var J=typeof document>"u";var Y=Symbol.for("fluixi.server-node"),Ne=null;function Ae(){if(!Ne)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Ne}function O(e){return e!=null&&e[Y]===!0?!0:typeof Node<"u"&&e instanceof Node}function Se(e){return e!=null&&e[Y]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function ve(e){return e!=null&&e[Y]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},Ce=null;function Pe(e){Ce=e}function Me(){return Ce}function Z(e,t){return u.active&&t.parentNode===e}function Q(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function _(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Q(t)}var et={};var ee=new Set,_e=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function te(e){if(!J)for(let t of e)ee.has(t)||_e.has(t)||(ee.add(t),document.addEventListener(t,tt))}function tt(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 nt(e,t,n){if(e[`$$${t}`]=n,_e.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,i),e[r]=i}return}ee.has(t)||te([t])}function Re(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function v(e,t=!1){if(J)return Ae().createText(e);if(u.active&&!t){let n=Me()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var A=0,rt=200;function ot(e,t,n,r,i){let a=r,c=new Map;return(0,m.createRenderEffect)(()=>{let s;if(P(e)&&!(0,b.isSignal)(e)){if(!c.has(e)){A++;try{let o=e();c.set(e,o)}finally{A--}}for(s=c.get(e);typeof s=="function"&&(0,b.isSignal)(s);)s=s()}else for(s=e();typeof s=="function"&&(0,b.isSignal)(s);)s=s();{let o=0;for(;typeof s=="function"&&o++<50;)if(P(s)){if(!c.has(s)){let l=s;A++;try{let f=l();c.set(l,f)}finally{A--}}s=c.get(s)}else if((0,b.isSignal)(s))s=s();else if(s=s(),typeof s!="function"||!(0,b.isSignal)(s)&&!P(s))break}A++;try{a=D(t,s,n,a,c),i(a)}finally{A--}})}function k(e,t,n,r){if(A>rt)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=v("",!0),e.appendChild(n));let i=r??null,a=o=>Array.isArray(o)&&o.some(l=>typeof l=="function"),c=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!a(t)){A++;try{i=D(e,t,n,i)}finally{A--}return()=>i}let s=ot(c(t),e,n,i,o=>{i=o});return()=>(s?.(),i)}function D(e,t,n,r,i){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(F(t)){let c=v("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(c,r[0]),M(e,r.slice(1),n)):g(e,c,n):r?e.replaceChild(c,r):g(e,c,n),t.then(s=>{c.parentNode===e&&D(e,s,c.nextSibling,c)}).catch(s=>{console.error("Error resolving promise in insertExpression:",s)}),c}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let s=v(t);return g(e,s,n),s}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=M(e,r,n)}if(r&&ve(r))return r.data=t,r;let c=v(t);return r&&r.parentNode===e?e.replaceChild(c,r):Z(e,c)||g(e,c,n),c}if(O(t))return Z(e,t)?(Q(t),t):Array.isArray(r)?(r.length===0?g(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),M(e,r.slice(1),n)):g(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):g(e,t,n)):g(e,t,n),t);if(Array.isArray(t)){let c=[],s=Array.isArray(r)?r:r?[r]:[],o=[];N(t,c,e,n,!0,i,o);let l=it(e,s,c,n);for(let f of o){let p=k(e,f.sig,f.marker);(0,m.onCleanup)(()=>{M(e,p()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let c=t;if("type"in c&&"props"in c){let s=c;if(typeof s.type=="function"){let o=s.type(s.props||{});return D(e,o,n,r)}}}return M(e,r,n)}function N(e,t,n,r,i=!0,a,c){for(let s=0;s<e.length;s++){let o=e[s];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!F(o)&&!(0,b.isSignal)(o)&&!P(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let l;for(P(o)&&!(0,b.isSignal)(o)?(a||(a=new Map),a.has(o)||a.set(o,o()),l=a.get(o)):l=o();typeof l=="function"&&!F(l)&&!(0,b.isSignal)(l)&&!P(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,b.isSignal)(l)){if(c){let p=v("",!0);t.push(p),c.push({marker:p,sig:l});continue}let f=l();for(;typeof f=="function"&&(0,b.isSignal)(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?N(f,t,n,r,i,a):N([f],t,n,r,i,a);continue}continue}Array.isArray(l)?N(l,t,n,r,i,a,c):N([l],t,n,r,i,a,c);continue}if(F(o)){let l=v("",!0);t.push(l),o.then(f=>{if(l.parentNode){let p=[];if(N([f],p,l.parentNode,void 0,!1,a),p.length>0){l.parentNode.replaceChild(p[0],l);for(let y=1;y<p.length;y++)l.parentNode?.insertBefore(p[y],p[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(o)){N(o,t,n,r,i,a,c);continue}if(O(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let l=o;if(typeof l.type=="function"){let f=l.type(l.props||{});Array.isArray(f)?N(f,t,n,r,!1,a):N([f],t,n,r,!1,a);continue}}if(typeof o=="string"||typeof o=="number"){let l=String(o);if(l.trim()===""&&l!==" ")continue;t.push(v(l));continue}t.push(v(String(o)))}}}}function it(e,t,n,r){for(let p=0;p<n.length;p++){let y=n[p].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(n=n.slice(),n[p]=n[p].cloneNode(!0))}let i=n.length,a=t.length,c=i,s=0,o=0,l=a>0?t[a-1].nextSibling??void 0:r,f=null;for(;s<a||o<c;){if(t[s]===n[o]){s++,o++;continue}for(;a>s&&c>o&&t[a-1]===n[c-1];)a--,c--;if(a===s){let p=c<i?o?n[o-1].nextSibling??void 0:n[c-o]:l;for(;o<c;)g(e,n[o++],p)}else if(c===o)for(;s<a;)(!f||!f.has(t[s]))&&t[s].parentNode===e&&e.removeChild(t[s]),s++;else if(t[s]===n[c-1]&&n[o]===t[a-1]){let p=t[--a].nextSibling;g(e,n[o++],t[s++].nextSibling),g(e,n[--c],p),t[a]=t[s-1]}else{if(!f){f=new Map;let y=o;for(;y<c;)f.set(n[y],y++)}let p=f.get(t[s]);if(p!=null)if(o<p&&p<c){let y=s,q=1;for(;++y<a&&y<c&&!(!f.has(t[y])||f.get(t[y])!==p+q);)q++;if(q>p-o){let ze=t[s];for(;o<p;)g(e,n[o++],ze)}else t[s].parentNode===e?e.replaceChild(n[o++],t[s++]):(g(e,n[o++],l),s++)}else s++;else t[s].parentNode===e&&e.removeChild(t[s]),s++}}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 g(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function R(e,t,n){n==null?delete e[t]:e[t]=n}function st(e,t,n){let r=n,i;return Array.isArray(n)&&(r=n[0],i=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i))}function at(e,t){let n=(r,i)=>{typeof r=="function"&&r(e,i??(()=>{}))};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 ke(e,t,n,r=!1){return typeof n!="function"?(w(e,t,n,r),()=>{}):(0,m.createRenderEffect)(()=>{let i=typeof n=="function"?n():n;w(e,t,i,r)})}function Le(e,t,n){return typeof n!="function"?(R(e,t,n),()=>{}):(0,m.createRenderEffect)(()=>{let r=typeof n=="function"?n():n;R(e,t,r)})}function ct(e,t,n){return typeof n!="function"?(w(e,t,!!n),()=>{}):(0,m.createRenderEffect)(()=>{let r=n();w(e,t,!!r)})}function L(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,m.createRenderEffect)(()=>L(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 i=t[r];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function Oe(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],a=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push((0,m.createRenderEffect)(()=>{let c=!!i();for(let s of a)e.classList.toggle(s,c)}));else{let c=!!(typeof i=="function"?i():i);for(let s of a)e.classList.toggle(s,c)}}}function $(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 i=n[r];i==null?e.style[r]="":e.style[r]=i}}function Fe(e){let{element:t,props:n,prevProps:r=et,isSVG:i=!1,skipChildren:a=!1}=e;if(!t||!Se(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=i||t.namespaceURI===he,s=[];for(let o in n){if(a&&o==="children")continue;let l=n[o],f=r[o];if(l===f)continue;if(o==="ref"){ne(l,t);continue}if(o==="use"){at(t,l);continue}if(o.startsWith("on:")){s.push(st(t,o.slice(3),l));continue}if(o.startsWith("prop:")){s.push(Le(t,o.slice(5),l));continue}if(o.startsWith("attr:")){s.push(ke(t,o.slice(5),l,c));continue}if(o.startsWith("bool:")){s.push(ct(t,o.slice(5),l));continue}if(o==="class"||o==="className"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>L(t,l()))):L(t,l);continue}if(o==="classList"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>Oe(t,l()))):Oe(t,l,s);continue}if(o==="style"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>$(t,l()))):$(t,l);continue}if(o.startsWith("on")){let y=o.slice(2).toLowerCase();f&&Re(t,y),l&&nt(t,y,l);continue}let p=X.has(o)||!c&&o in t;typeof l=="function"?s.push(p?Le(t,o,l):ke(t,o,l,c)):s.push((0,m.createRenderEffect)(()=>p?R(t,o,n[o]):w(t,o,n[o],c)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let l=o.slice(2).toLowerCase();Re(t,l)}else X.has(o)?R(t,o,null):t.removeAttribute(o);return()=>{s.forEach(o=>o())}}function ne(e,t){if(e){if(O(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 F(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function I(e,t,n){if(!t)throw new Error("Container element is required");let r,i,a=[];return(0,m.createRoot)(c=>{(0,m.batch)(()=>{u.active||(t.textContent=""),Te(t),Ee(),k(t,e)}),i=c}),()=>{i?.(),r?.(),a.forEach(c=>c()),t.textContent=""}}var j=require("@fluixi/reactive");var lt="__fx_dom_create_component__",De=globalThis[lt]??={fn:null};function $e(e,t){if(De.fn)return De.fn(e,t);let n=typeof e=="function"?(0,j.untrack)(()=>e(t)):e;if(n!=null&&(typeof n=="function"||typeof n=="object")&&!(0,j.isSignal)(n)){try{n.$name=e?.name}catch{}return we(n)}return n}var H=require("@fluixi/reactive/signal");var ft="__FX_DATA__";var re;function Ie(){let e=globalThis.__FX_DATA__;if(e)return e;if(re!==void 0)return re;let t=null;if(typeof document<"u"){let n=document.getElementById(ft)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return re=t}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 ut=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),U=typeof process<"u"&&process.env&&!1;function W(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 dt(e){V();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(ut.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(U&&t&&W(`<${e}>`,t),null)}function pt(e){V();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(u.cursor=t.nextSibling,t):(U&&t&&W(`<${e}> (static)`,t),null)}function yt(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}V();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(U&&t&&W(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function mt(e){V();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(U&&t&&W(`marker <!--${e.slice(0,24)}-->`,t),null)}var je=!1;function ht(){je||(je=!0,Pe({hydrateElement:dt,hydrateText:yt,hydrateMarker:mt,hydrateStatic:pt}))}function oe(e,t,n){ht(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=Ie(),i=n?.resourceNamespace,a=0;(0,H.setResourceIdSource)(()=>i?`${i}:r${a++}`:`r${a++}`),(0,H.setServerDataGetter)(r?c=>c in r?{value:r[c]}:void 0:null);try{return I(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var h=require("@fluixi/reactive/signal");function He(e){return typeof e=="function"?e:(()=>e)}function C(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Ve(e){return e!=null&&e!==!1}function Ue(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function ie(e){let t=C(()=>e.when),n=(0,h.createMemo)(t,void 0),r=(0,h.createMemo)(n,void 0),i=(0,h.getOwner)(),a=null,c=null,s=o=>{o!==c&&(a&&(0,h.disposeScope)(a),a=(0,h.createChildOwner)(i),c=o)};return(0,h.createMemo)(()=>{let o=r();return s(o?"when":"fallback"),(0,h.runWithOwner)(a,()=>{if(o){let l=e.children;return typeof l=="function"&&!Ue(l)?typeof n=="function"?(0,h.untrack)(()=>(0,h.untrack)(n)?l(n()):e.fallback):l(n):l}return e.fallback});return e.fallback??null},void 0,{name:"show"})}var K=require("@fluixi/reactive/signal");function se(e){let t=C(()=>e.each),n=()=>e.fallback??null,r=(i,a)=>{let c=e.children,s=Array.isArray(c)?c.map(o=>typeof o=="function"?o(i,a):o):typeof c=="function"?c(i,a):c;return _(s),s};return e.by?(0,K.keyArray)(t,e.by,(i,a)=>r(i,a),{fallback:n}):(0,K.mapArray)(t,(i,a)=>r(i,a),{fallback:n})}var We=require("@fluixi/reactive/signal");function ae(e){let t=C(()=>e.each);return(0,We.indexArray)(t,(n,r)=>{let i=e.children(n,r);return _(i),i},{fallback:()=>e.fallback??null})}var S=require("@fluixi/reactive/signal");var T=require("@fluixi/reactive/signal");var ce=Symbol("match");function le(e){return{[ce]:!0,when:C(()=>e.when),get children(){return e.children}}}function fe(e){let t=Array.isArray(e.children)?e.children:[e.children],n=(0,T.getOwner)(),r=null,i=-1,a=c=>{c!==i&&(r&&(0,T.disposeScope)(r),r=(0,T.createChildOwner)(n),i=c)};return(0,T.createMemo)(()=>{for(let c=0;c<t.length;c+=1){let o=t[c],l=0;for(;typeof o=="function"&&!o[ce]&&l++<10;)o=o();if(!o||typeof o!="object"||o[ce]!==!0)continue;let f=o.when();if(Ve(f))return a(c),(0,T.runWithOwner)(r,()=>typeof o.children=="function"?o.children(f):o.children)}return a(-2),(0,T.runWithOwner)(r,()=>e.fallback??null)})}var E=require("@fluixi/reactive/signal");function ue(e){let t=He(e.component),{component:n,...r}=e,i=(0,E.getOwner)(),a=null,c;return(0,E.createMemo)(()=>{let s=t();return s!==c&&(a&&(0,E.disposeScope)(a),a=(0,E.createChildOwner)(i),c=s),s==null?null:typeof s=="string"?{tag:s,props:r}:(0,E.runWithOwner)(a,()=>s(r))})}var B=require("@fluixi/reactive/signal");function de(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return(0,B.createRoot)(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),k(r,e.children)&&ne(e.ref,r)}),(0,B.onCleanup)(()=>{n(),r.remove()}),null}var z=require("@fluixi/reactive/signal");function pe(e){let[t,n]=(0,z.createSignal)(null),r=()=>n(null);return(0,z.createMemo)(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(a){return n(a),typeof e.fallback=="function"?e.fallback(a,r):e.fallback}})}var Ke=require("@fluixi/reactive/signal");function ye(e){return(0,Ke.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;(typeof i=="function"?i():i)&&n.push(r)}return n.join(" ")})}var Be=require("@fluixi/reactive/signal");function gt(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function me(e){return(0,Be.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let a=typeof i=="function"?i():i;a!=null&&n.push(`${gt(r)}: ${a}`)}return n.join("; ")})}var d=require("@fluixi/reactive");
|
|
1
|
+
"use strict";var G=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Xe=Object.prototype.hasOwnProperty;var Je=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},Ye=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ge(t))!Xe.call(e,i)&&i!==n&&G(e,i,{get:()=>t[i],enumerable:!(r=qe(t,i))||r.enumerable});return e};var Ze=e=>Ye(G({},"__esModule",{value:!0}),e);var xt={};Je(xt,{Dynamic:()=>ue,ErrorBoundary:()=>pe,For:()=>se,Index:()=>ae,Match:()=>le,Portal:()=>de,Show:()=>ie,Switch:()=>fe,batch:()=>d.batch,classMap:()=>ye,createComponent:()=>$e,createComputed:()=>d.createComputed,createContext:()=>d.createContext,createEffect:()=>d.createEffect,createElement:()=>ge,createMemo:()=>d.createMemo,createRenderEffect:()=>d.createRenderEffect,createResource:()=>d.createResource,createRoot:()=>d.createRoot,createSignal:()=>d.createSignal,delegateEvents:()=>te,effect:()=>d.effect,hydrate:()=>oe,indexArray:()=>S.indexArray,insert:()=>k,keyArray:()=>S.keyArray,mapArray:()=>S.mapArray,memo:()=>d.memo,onCleanup:()=>d.onCleanup,render:()=>I,setAttribute:()=>w,setClassName:()=>L,setProperty:()=>R,setStyle:()=>$,signal:()=>d.signal,spread:()=>Fe,store:()=>d.store,styleMap:()=>me,untrack:()=>d.untrack,useContext:()=>d.useContext});module.exports=Ze(xt);var he="http://www.w3.org/2000/svg";var X=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function w(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 Qe(e,t){Object.assign(e.style,t)}function ge(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,a])=>{if(i==="class"||i==="className")r.className=a;else if(i==="style"&&typeof a=="object")Qe(r,a);else if(i.startsWith("on")&&typeof a=="function"){let c=i.slice(2).toLowerCase();r.addEventListener(c,a)}else w(r,i,a)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}var Tt=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var b=require("@fluixi/reactive/signal");var xe="1.0.0-alpha.82";var be=require("@fluixi/reactive/version"),x={dom:xe,reactive:be.VERSION};function Te(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 Ee(){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 we(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function P(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var m=require("@fluixi/reactive/signal");var J=typeof document>"u";var Y=Symbol.for("fluixi.server-node"),Ne=null;function Ae(){if(!Ne)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Ne}function O(e){return e!=null&&e[Y]===!0?!0:typeof Node<"u"&&e instanceof Node}function Se(e){return e!=null&&e[Y]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function ve(e){return e!=null&&e[Y]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},Ce=null;function Pe(e){Ce=e}function Me(){return Ce}function Z(e,t){return u.active&&t.parentNode===e}function Q(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function _(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Q(t)}var et={};var ee=new Set,_e=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function te(e){if(!J)for(let t of e)ee.has(t)||_e.has(t)||(ee.add(t),document.addEventListener(t,tt))}function tt(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 nt(e,t,n){if(e[`$$${t}`]=n,_e.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,i),e[r]=i}return}ee.has(t)||te([t])}function Re(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function v(e,t=!1){if(J)return Ae().createText(e);if(u.active&&!t){let n=Me()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var A=0,rt=200;function ot(e,t,n,r,i){let a=r,c=new Map;return(0,m.createRenderEffect)(()=>{let s;if(P(e)&&!(0,b.isSignal)(e)){if(!c.has(e)){A++;try{let o=e();c.set(e,o)}finally{A--}}for(s=c.get(e);typeof s=="function"&&(0,b.isSignal)(s);)s=s()}else for(s=e();typeof s=="function"&&(0,b.isSignal)(s);)s=s();{let o=0;for(;typeof s=="function"&&o++<50;)if(P(s)){if(!c.has(s)){let l=s;A++;try{let f=l();c.set(l,f)}finally{A--}}s=c.get(s)}else if((0,b.isSignal)(s))s=s();else if(s=s(),typeof s!="function"||!(0,b.isSignal)(s)&&!P(s))break}A++;try{a=D(t,s,n,a,c),i(a)}finally{A--}})}function k(e,t,n,r){if(A>rt)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=v("",!0),e.appendChild(n));let i=r??null,a=o=>Array.isArray(o)&&o.some(l=>typeof l=="function"),c=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!a(t)){A++;try{i=D(e,t,n,i)}finally{A--}return()=>i}let s=ot(c(t),e,n,i,o=>{i=o});return()=>(s?.(),i)}function D(e,t,n,r,i){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(F(t)){let c=v("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(c,r[0]),M(e,r.slice(1),n)):g(e,c,n):r?e.replaceChild(c,r):g(e,c,n),t.then(s=>{c.parentNode===e&&D(e,s,c.nextSibling,c)}).catch(s=>{console.error("Error resolving promise in insertExpression:",s)}),c}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let s=v(t);return g(e,s,n),s}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=M(e,r,n)}if(r&&ve(r))return r.data=t,r;let c=v(t);return r&&r.parentNode===e?e.replaceChild(c,r):Z(e,c)||g(e,c,n),c}if(O(t))return Z(e,t)?(Q(t),t):Array.isArray(r)?(r.length===0?g(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),M(e,r.slice(1),n)):g(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):g(e,t,n)):g(e,t,n),t);if(Array.isArray(t)){let c=[],s=Array.isArray(r)?r:r?[r]:[],o=[];N(t,c,e,n,!0,i,o);let l=it(e,s,c,n);for(let f of o){let p=k(e,f.sig,f.marker);(0,m.onCleanup)(()=>{M(e,p()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let c=t;if("type"in c&&"props"in c){let s=c;if(typeof s.type=="function"){let o=s.type(s.props||{});return D(e,o,n,r)}}}return M(e,r,n)}function N(e,t,n,r,i=!0,a,c){for(let s=0;s<e.length;s++){let o=e[s];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!F(o)&&!(0,b.isSignal)(o)&&!P(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let l;for(P(o)&&!(0,b.isSignal)(o)?(a||(a=new Map),a.has(o)||a.set(o,o()),l=a.get(o)):l=o();typeof l=="function"&&!F(l)&&!(0,b.isSignal)(l)&&!P(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,b.isSignal)(l)){if(c){let p=v("",!0);t.push(p),c.push({marker:p,sig:l});continue}let f=l();for(;typeof f=="function"&&(0,b.isSignal)(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?N(f,t,n,r,i,a):N([f],t,n,r,i,a);continue}continue}Array.isArray(l)?N(l,t,n,r,i,a,c):N([l],t,n,r,i,a,c);continue}if(F(o)){let l=v("",!0);t.push(l),o.then(f=>{if(l.parentNode){let p=[];if(N([f],p,l.parentNode,void 0,!1,a),p.length>0){l.parentNode.replaceChild(p[0],l);for(let y=1;y<p.length;y++)l.parentNode?.insertBefore(p[y],p[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(o)){N(o,t,n,r,i,a,c);continue}if(O(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let l=o;if(typeof l.type=="function"){let f=l.type(l.props||{});Array.isArray(f)?N(f,t,n,r,!1,a):N([f],t,n,r,!1,a);continue}}if(typeof o=="string"||typeof o=="number"){let l=String(o);if(l.trim()===""&&l!==" ")continue;t.push(v(l));continue}t.push(v(String(o)))}}}}function it(e,t,n,r){for(let p=0;p<n.length;p++){let y=n[p].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(n=n.slice(),n[p]=n[p].cloneNode(!0))}let i=n.length,a=t.length,c=i,s=0,o=0,l=a>0?t[a-1].nextSibling??void 0:r,f=null;for(;s<a||o<c;){if(t[s]===n[o]){s++,o++;continue}for(;a>s&&c>o&&t[a-1]===n[c-1];)a--,c--;if(a===s){let p=c<i?o?n[o-1].nextSibling??void 0:n[c-o]:l;for(;o<c;)g(e,n[o++],p)}else if(c===o)for(;s<a;)(!f||!f.has(t[s]))&&t[s].parentNode===e&&e.removeChild(t[s]),s++;else if(t[s]===n[c-1]&&n[o]===t[a-1]){let p=t[--a].nextSibling;g(e,n[o++],t[s++].nextSibling),g(e,n[--c],p),t[a]=t[s-1]}else{if(!f){f=new Map;let y=o;for(;y<c;)f.set(n[y],y++)}let p=f.get(t[s]);if(p!=null)if(o<p&&p<c){let y=s,q=1;for(;++y<a&&y<c&&!(!f.has(t[y])||f.get(t[y])!==p+q);)q++;if(q>p-o){let ze=t[s];for(;o<p;)g(e,n[o++],ze)}else t[s].parentNode===e?e.replaceChild(n[o++],t[s++]):(g(e,n[o++],l),s++)}else s++;else t[s].parentNode===e&&e.removeChild(t[s]),s++}}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 g(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function R(e,t,n){n==null?delete e[t]:e[t]=n}function st(e,t,n){let r=n,i;return Array.isArray(n)&&(r=n[0],i=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i))}function at(e,t){let n=(r,i)=>{typeof r=="function"&&r(e,i??(()=>{}))};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 ke(e,t,n,r=!1){return typeof n!="function"?(w(e,t,n,r),()=>{}):(0,m.createRenderEffect)(()=>{let i=typeof n=="function"?n():n;w(e,t,i,r)})}function Le(e,t,n){return typeof n!="function"?(R(e,t,n),()=>{}):(0,m.createRenderEffect)(()=>{let r=typeof n=="function"?n():n;R(e,t,r)})}function ct(e,t,n){return typeof n!="function"?(w(e,t,!!n),()=>{}):(0,m.createRenderEffect)(()=>{let r=n();w(e,t,!!r)})}function L(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,m.createRenderEffect)(()=>L(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 i=t[r];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function Oe(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],a=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push((0,m.createRenderEffect)(()=>{let c=!!i();for(let s of a)e.classList.toggle(s,c)}));else{let c=!!(typeof i=="function"?i():i);for(let s of a)e.classList.toggle(s,c)}}}function $(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 i=n[r];i==null?e.style[r]="":e.style[r]=i}}function Fe(e){let{element:t,props:n,prevProps:r=et,isSVG:i=!1,skipChildren:a=!1}=e;if(!t||!Se(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=i||t.namespaceURI===he,s=[];for(let o in n){if(a&&o==="children")continue;let l=n[o],f=r[o];if(l===f)continue;if(o==="ref"){ne(l,t);continue}if(o==="use"){at(t,l);continue}if(o.startsWith("on:")){s.push(st(t,o.slice(3),l));continue}if(o.startsWith("prop:")){s.push(Le(t,o.slice(5),l));continue}if(o.startsWith("attr:")){s.push(ke(t,o.slice(5),l,c));continue}if(o.startsWith("bool:")){s.push(ct(t,o.slice(5),l));continue}if(o==="class"||o==="className"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>L(t,l()))):L(t,l);continue}if(o==="classList"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>Oe(t,l()))):Oe(t,l,s);continue}if(o==="style"){typeof l=="function"?s.push((0,m.createRenderEffect)(()=>$(t,l()))):$(t,l);continue}if(o.startsWith("on")){let y=o.slice(2).toLowerCase();f&&Re(t,y),l&&nt(t,y,l);continue}let p=X.has(o)||!c&&o in t;typeof l=="function"?s.push(p?Le(t,o,l):ke(t,o,l,c)):s.push((0,m.createRenderEffect)(()=>p?R(t,o,n[o]):w(t,o,n[o],c)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let l=o.slice(2).toLowerCase();Re(t,l)}else X.has(o)?R(t,o,null):t.removeAttribute(o);return()=>{s.forEach(o=>o())}}function ne(e,t){if(e){if(O(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 F(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function I(e,t,n){if(!t)throw new Error("Container element is required");let r,i,a=[];return(0,m.createRoot)(c=>{(0,m.batch)(()=>{u.active||(t.textContent=""),Te(t),Ee(),k(t,e)}),i=c}),()=>{i?.(),r?.(),a.forEach(c=>c()),t.textContent=""}}var j=require("@fluixi/reactive");var lt="__fx_dom_create_component__",De=globalThis[lt]??={fn:null};function $e(e,t){if(De.fn)return De.fn(e,t);let n=typeof e=="function"?(0,j.untrack)(()=>e(t)):e;if(n!=null&&(typeof n=="function"||typeof n=="object")&&!(0,j.isSignal)(n)){try{n.$name=e?.name}catch{}return we(n)}return n}var H=require("@fluixi/reactive/signal");var ft="__FX_DATA__";var re;function Ie(){let e=globalThis.__FX_DATA__;if(e)return e;if(re!==void 0)return re;let t=null;if(typeof document<"u"){let n=document.getElementById(ft)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return re=t}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 ut=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),U=typeof process<"u"&&process.env&&!1;function W(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 dt(e){V();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(ut.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(U&&t&&W(`<${e}>`,t),null)}function pt(e){V();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(u.cursor=t.nextSibling,t):(U&&t&&W(`<${e}> (static)`,t),null)}function yt(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}V();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(U&&t&&W(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function mt(e){V();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(U&&t&&W(`marker <!--${e.slice(0,24)}-->`,t),null)}var je=!1;function ht(){je||(je=!0,Pe({hydrateElement:dt,hydrateText:yt,hydrateMarker:mt,hydrateStatic:pt}))}function oe(e,t,n){ht(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=Ie(),i=n?.resourceNamespace,a=0;(0,H.setResourceIdSource)(()=>i?`${i}:r${a++}`:`r${a++}`),(0,H.setServerDataGetter)(r?c=>c in r?{value:r[c]}:void 0:null);try{return I(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var h=require("@fluixi/reactive/signal");function He(e){return typeof e=="function"?e:(()=>e)}function C(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Ve(e){return e!=null&&e!==!1}function Ue(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function ie(e){let t=C(()=>e.when),n=(0,h.createMemo)(t,void 0),r=(0,h.createMemo)(n,void 0),i=(0,h.getOwner)(),a=null,c=null,s=o=>{o!==c&&(a&&(0,h.disposeScope)(a),a=(0,h.createChildOwner)(i),c=o)};return(0,h.createMemo)(()=>{let o=r();return s(o?"when":"fallback"),(0,h.runWithOwner)(a,()=>{if(o){let l=e.children;return typeof l=="function"&&!Ue(l)?typeof n=="function"?(0,h.untrack)(()=>(0,h.untrack)(n)?l(n()):e.fallback):l(n):l}return e.fallback});return e.fallback??null},void 0,{name:"show"})}var K=require("@fluixi/reactive/signal");function se(e){let t=C(()=>e.each),n=()=>e.fallback??null,r=(i,a)=>{let c=e.children,s=Array.isArray(c)?c.map(o=>typeof o=="function"?o(i,a):o):typeof c=="function"?c(i,a):c;return _(s),s};return e.by?(0,K.keyArray)(t,e.by,(i,a)=>r(i,a),{fallback:n}):(0,K.mapArray)(t,(i,a)=>r(i,a),{fallback:n})}var We=require("@fluixi/reactive/signal");function ae(e){let t=C(()=>e.each);return(0,We.indexArray)(t,(n,r)=>{let i=e.children(n,r);return _(i),i},{fallback:()=>e.fallback??null})}var S=require("@fluixi/reactive/signal");var T=require("@fluixi/reactive/signal");var ce=Symbol("match");function le(e){return{[ce]:!0,when:C(()=>e.when),get children(){return e.children}}}function fe(e){let t=Array.isArray(e.children)?e.children:[e.children],n=(0,T.getOwner)(),r=null,i=-1,a=c=>{c!==i&&(r&&(0,T.disposeScope)(r),r=(0,T.createChildOwner)(n),i=c)};return(0,T.createMemo)(()=>{for(let c=0;c<t.length;c+=1){let o=t[c],l=0;for(;typeof o=="function"&&!o[ce]&&l++<10;)o=o();if(!o||typeof o!="object"||o[ce]!==!0)continue;let f=o.when();if(Ve(f))return a(c),(0,T.runWithOwner)(r,()=>typeof o.children=="function"?o.children(f):o.children)}return a(-2),(0,T.runWithOwner)(r,()=>e.fallback??null)})}var E=require("@fluixi/reactive/signal");function ue(e){let t=He(e.component),{component:n,...r}=e,i=(0,E.getOwner)(),a=null,c;return(0,E.createMemo)(()=>{let s=t();return s!==c&&(a&&(0,E.disposeScope)(a),a=(0,E.createChildOwner)(i),c=s),s==null?null:typeof s=="string"?{tag:s,props:r}:(0,E.runWithOwner)(a,()=>s(r))})}var B=require("@fluixi/reactive/signal");function de(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return(0,B.createRoot)(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),k(r,e.children)&&ne(e.ref,r)}),(0,B.onCleanup)(()=>{n(),r.remove()}),null}var z=require("@fluixi/reactive/signal");function pe(e){let[t,n]=(0,z.createSignal)(null),r=()=>n(null);return(0,z.createMemo)(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(a){return n(a),typeof e.fallback=="function"?e.fallback(a,r):e.fallback}})}var Ke=require("@fluixi/reactive/signal");function ye(e){return(0,Ke.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;(typeof i=="function"?i():i)&&n.push(r)}return n.join(" ")})}var Be=require("@fluixi/reactive/signal");function gt(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function me(e){return(0,Be.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let a=typeof i=="function"?i():i;a!=null&&n.push(`${gt(r)}: ${a}`)}return n.join("; ")})}var d=require("@fluixi/reactive");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var FluixiDOM=(()=>{var Pe=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames;var In=Object.prototype.hasOwnProperty;var qn=(e,t)=>{for(var n in t)Pe(e,n,{get:t[n],enumerable:!0})},Ln=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jn(t))!In.call(e,i)&&i!==n&&Pe(e,i,{get:()=>t[i],enumerable:!(r=Dn(t,i))||r.enumerable});return e};var $n=e=>Ln(Pe({},"__esModule",{value:!0}),e);var ro={};qn(ro,{Dynamic:()=>st,ErrorBoundary:()=>lt,For:()=>tt,Index:()=>nt,Match:()=>ot,Portal:()=>ut,Show:()=>et,Switch:()=>it,batch:()=>R,classMap:()=>at,createComponent:()=>Nn,createComputed:()=>pn,createContext:()=>Ee,createEffect:()=>Te,createElement:()=>ht,createMemo:()=>Je,createRenderEffect:()=>hn,createResource:()=>mn,createRoot:()=>fn,createSignal:()=>M,delegateEvents:()=>Le,effect:()=>wn,hydrate:()=>Qe,indexArray:()=>re,insert:()=>K,keyArray:()=>ne,mapArray:()=>te,memo:()=>bn,onCleanup:()=>Ke,render:()=>be,setAttribute:()=>A,setClassName:()=>oe,setProperty:()=>B,setStyle:()=>ge,signal:()=>gn,spread:()=>Ut,store:()=>An,styleMap:()=>ct,untrack:()=>X,useContext:()=>ln});var pt="http://www.w3.org/2000/svg";var Ce=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function A(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 Fn(e,t){Object.assign(e.style,t)}function ht(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,s])=>{if(i==="class"||i==="className")r.className=s;else if(i==="style"&&typeof s=="object")Fn(r,s);else if(i.startsWith("on")&&typeof s=="function"){let u=i.slice(2).toLowerCase();r.addEventListener(u,s)}else A(r,i,s)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}var io=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var Vn="__fluixi_signal_next_state__",Un=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},d=globalThis[Vn]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Un,onSuspend:null,onError:null},yt=0,mt=1,Z=2,gt=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(d.untracked)return;let e=d.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Hn=class extends gt{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(Z);ke(this)}}peek(){return this._value}},bt=class extends gt{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=Z,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(d.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===mt&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Z)break}(this.state===Z||!this._initialized)&&this.recompute(),this.state=yt}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let e=d.consumer,t=d.untracked;d.consumer=this,d.untracked=!1;let n,r=!1,i;try{n=this._fn()}catch(u){r=!0,i=u,n=this._value}finally{d.consumer=e,d.untracked=t}let s=!this._initialized||this._threw!==r||(r?i!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=r,this._error=i,this._value=n,s){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(Z);ke(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===yt;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(mt);ke(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function ke(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Wn=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function zn(e){if(d.untracked)return e();d.untracked=!0;try{return e()}finally{d.untracked=!1}}function W(e){let t=fe(e);return e&&(e.owned??=[]).push(t),t}function z(e,t=!0){Q(e,t)}function fe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function wt(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:n=>{let r=d.owner,i=fe(r);(i.contexts=new Map).set(t,n.value),r&&(r.owned??=[]).push(i),d.owner=i;try{return n.children}finally{d.owner=r}}}}function xt(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Bn(e){d.onSuspend=e}function Kn(e){return d.onSuspend?(d.onSuspend(e,d.owner),!0):!1}function Gn(e){d.onError=e}function q(){return d.owner}function _(e,t){let n=d.owner;d.owner=e;try{return t()}finally{d.owner=n}}function L(e){if(d.owner){if(d.owner.disposed){e();return}(d.owner.cleanups??=[]).push(e)}}function Q(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Q(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function $(e){let t=fe(d.owner);d.owner&&(d.owner.owned??=[]).push(t);let n=d.owner;d.owner=t;try{return e(()=>Q(t))}finally{d.owner=n}}function Xn(e){d.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Jn(e){e.queued||(e.queued=!0,d.queue.push(e),!d.scheduled&&d.batchDepth===0&&(d.scheduled=!0,d.hostSchedule(Oe)))}function Oe(){if(d.scheduled=!1,d.flushing)return;d.flushing=!0;let e=0;try{for(;d.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=d.queue;d.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{d.flushing=!1}}function Yn(){d.batchDepth===0&&Oe()}function Zn(e){d.batchDepth++;try{return e()}finally{--d.batchDepth===0&&Oe()}}var Qn=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=fe(d.owner),d.owner&&(d.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new bt(()=>{Q(this.owner,!1),_(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new Wn(()=>Jn(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&d.onSuspend){d.onSuspend(e,this.owner);return}if(d.onError&&d.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),Q(this.owner))}};function vt(e){let t=new Qn(e);return()=>t.dispose()}function er(e){return!!e&&typeof e.then=="function"}Xn(()=>{});var St=Symbol.for("signal"),tr=Symbol.for("memo"),nr=Symbol.for("signal-node");function C(e,t){let n=new Hn(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let u=typeof s=="function"?s(n.peek()):s;return n.set(u),Yn(),u});return Object.defineProperty(r,St,{value:!0,enumerable:!0}),Object.defineProperty(r,nr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,i]}function m(e,t,n){let r=t,i=q(),s=new bt(()=>_(i,()=>{try{return r=e(r)}catch(l){if(er(l))return Kn(l),r;throw l}}),{equals:n?.equals}),u=(()=>s.get());return Object.defineProperty(u,St,{value:!0,enumerable:!0}),Object.defineProperty(u,tr,{value:!0,enumerable:!0}),u}function de(e,t){let n=t;return vt(()=>{n=e(n)})}function S(e,t){let n=t;return vt(()=>{n=e(n)})}function ee(e){return Zn(e)}function k(e){return zn(e)}function te(e,t,n){let r=[];return L(()=>{for(let i of r)i.dispose();r=[]}),m(()=>{let i=e()||[];return k(()=>{if(i.length===0){for(let o of r)o.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let o of r)s.has(o.item)||s.set(o.item,o);let u=[],l=new Set;for(let o=0;o<i.length;o++){let a=i[o],p=s.get(a);if(p&&!l.has(p))p.setIndex(o),u.push(p),l.add(p);else{let c,y,g;$(b=>{g=b;let[U,J]=C(o);y=J,c=t(a,U)});let v={item:a,rendered:c,dispose:g,setIndex:y};u.push(v),l.add(v)}}for(let o of r)l.has(o)||o.dispose();return r=u,u.map(o=>o.rendered)})})}function ne(e,t,n,r){let i=[],s=[];return L(()=>{for(let u of s)u.dispose();i=[],s=[]}),m(()=>{let u=e()||[];return k(()=>{if(u.length===0){for(let c of s)c.dispose();return i=[],s=[],r?.fallback?r.fallback():[]}let l=new Map;for(let c=0;c<i.length;c++)l.set(i[c],s[c]);let o=[],a=[],p=new Set;for(let c=0;c<u.length;c++){let y=t(u[c]),g=l.get(y);if(g&&!p.has(y))g.setIndex(c),o.push(g);else{let v,b,U;$(J=>{U=J;let[j,Y]=C(c);b=Y;let ue=m(H=>(e()||[])[j()]??H,u[c]);v=n(ue,j)}),o.push({rendered:v,dispose:U,setIndex:b})}a.push(y),p.add(y)}for(let[c,y]of l)p.has(c)||y.dispose();return i=a,s=o,o.map(c=>c.rendered)})})}function re(e,t,n){let r=[];return L(()=>{for(let i of r)i.dispose();r=[]}),m(()=>{let i=e()||[];return k(()=>{if(i.length===0){for(let o of r)o.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,u=i.length;for(let o=s;o<u;o++){let a,p,c,y=i[o];$(g=>{c=g;let[v,b]=C(y);p=b,a=t(v,o)}),r.push({rendered:a,setItem:p,dispose:c})}for(let o=u;o<s;o++)r[o].dispose();u<s&&(r=r.slice(0,u));let l=Math.min(s,u);for(let o=0;o<l;o++)r[o].setItem(i[o]);return r.map(o=>o.rendered)})})}var uo=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var rr=Symbol.for("signal");function E(e){return typeof e=="function"&&e[rr]===!0}var or=null;function Et(e){or=e}var ir=null;function Tt(e){ir=e}var sr=wt();Bn((e,t)=>{let n=xt(t,sr);n&&(n.increment(),e.finally(()=>n.decrement()))});var ur=wt();Gn((e,t)=>{let n=xt(t,ur);return n?(n.setError(e),!0):!1});var Re=Symbol.for("fluixi-proxy");var At="1.0.0-alpha.80";var _t="1.0.0-alpha.80";var T={dom:At,reactive:_t};function Nt(e){T.core&&e.setAttribute("fluixi",T.core),e.setAttribute("fx-dom",T.dom),e.setAttribute("fx-reactive",T.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=T)}function Pt(){let e=[T.core,T.dom,T.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${T.core??"(absent)"}, dom ${T.dom}, reactive ${T.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 Ct(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function F(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var Me=typeof document>"u";var De=Symbol.for("fluixi.server-node"),kt=null;function Ot(){if(!kt)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return kt}function pe(e){return e!=null&&e[De]===!0?!0:typeof Node<"u"&&e instanceof Node}function Rt(e){return e!=null&&e[De]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Mt(e){return e!=null&&e[De]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var h={active:!1,cursor:null,parents:[]},Dt=null;function jt(e){Dt=e}function It(){return Dt}function je(e,t){return h.active&&t.parentNode===e}function Ie(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function he(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Ie(t)}var lr={};var qe=new Set,Vt=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function Le(e){if(!Me)for(let t of e)qe.has(t)||Vt.has(t)||(qe.add(t),document.addEventListener(t,ar))}function ar(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 cr(e,t,n){if(e[`$$${t}`]=n,Vt.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,i),e[r]=i}return}qe.has(t)||Le([t])}function qt(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function O(e,t=!1){if(Me)return Ot().createText(e);if(h.active&&!t){let n=It()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var P=0,fr=200;function dr(e,t,n,r,i){let s=r,u=new Map;return S(()=>{let l;if(F(e)&&!E(e)){if(!u.has(e)){P++;try{let o=e();u.set(e,o)}finally{P--}}for(l=u.get(e);typeof l=="function"&&E(l);)l=l()}else for(l=e();typeof l=="function"&&E(l);)l=l();{let o=0;for(;typeof l=="function"&&o++<50;)if(F(l)){if(!u.has(l)){let a=l;P++;try{let p=a();u.set(a,p)}finally{P--}}l=u.get(l)}else if(E(l))l=l();else if(l=l(),typeof l!="function"||!E(l)&&!F(l))break}P++;try{s=me(t,l,n,s,u),i(s)}finally{P--}})}function K(e,t,n,r){if(P>fr)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=O("",!0),e.appendChild(n));let i=r??null,s=o=>Array.isArray(o)&&o.some(a=>typeof a=="function"),u=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!s(t)){P++;try{i=me(e,t,n,i)}finally{P--}return()=>i}let l=dr(u(t),e,n,i,o=>{i=o});return()=>(l?.(),i)}function me(e,t,n,r,i){if(t==null||typeof t=="boolean")return V(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return V(e,r,n);if(ye(t)){let u=O("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(u,r[0]),V(e,r.slice(1),n)):x(e,u,n):r?e.replaceChild(u,r):x(e,u,n),t.then(l=>{u.parentNode===e&&me(e,l,u.nextSibling,u)}).catch(l=>{console.error("Error resolving promise in insertExpression:",l)}),u}let s=typeof t;if(s==="string"||s==="number"){if(s==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let l=O(t);return x(e,l,n),l}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=V(e,r,n)}if(r&&Mt(r))return r.data=t,r;let u=O(t);return r&&r.parentNode===e?e.replaceChild(u,r):je(e,u)||x(e,u,n),u}if(pe(t))return je(e,t)?(Ie(t),t):Array.isArray(r)?(r.length===0?x(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),V(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 u=[],l=Array.isArray(r)?r:r?[r]:[],o=[];N(t,u,e,n,!0,i,o);let a=pr(e,l,u,n);for(let p of o){let c=K(e,p.sig,p.marker);L(()=>{V(e,c()),p.marker.parentNode===e&&e.removeChild(p.marker)})}return a}if(s==="object"&&t!==null&&typeof t=="object"){let u=t;if("type"in u&&"props"in u){let l=u;if(typeof l.type=="function"){let o=l.type(l.props||{});return me(e,o,n,r)}}}return V(e,r,n)}function N(e,t,n,r,i=!0,s,u){for(let l=0;l<e.length;l++){let o=e[l];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!ye(o)&&!E(o)&&!F(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let a;for(F(o)&&!E(o)?(s||(s=new Map),s.has(o)||s.set(o,o()),a=s.get(o)):a=o();typeof a=="function"&&!ye(a)&&!E(a)&&!F(a);)s||(s=new Map),s.has(a)||s.set(a,a()),a=s.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(E(a)){if(u){let c=O("",!0);t.push(c),u.push({marker:c,sig:a});continue}let p=a();for(;typeof p=="function"&&E(p);)p=p();if(p==null||typeof p=="boolean")continue;Array.isArray(p)?N(p,t,n,r,i,s):N([p],t,n,r,i,s);continue}continue}Array.isArray(a)?N(a,t,n,r,i,s,u):N([a],t,n,r,i,s,u);continue}if(ye(o)){let a=O("",!0);t.push(a),o.then(p=>{if(a.parentNode){let c=[];if(N([p],c,a.parentNode,void 0,!1,s),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(p=>console.error("Error resolving promise in array:",p));continue}if(Array.isArray(o)){N(o,t,n,r,i,s,u);continue}if(pe(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let a=o;if(typeof a.type=="function"){let p=a.type(a.props||{});Array.isArray(p)?N(p,t,n,r,!1,s):N([p],t,n,r,!1,s);continue}}if(typeof o=="string"||typeof o=="number"){let a=String(o);if(a.trim()===""&&a!==" ")continue;t.push(O(a));continue}t.push(O(String(o)))}}}}function pr(e,t,n,r){for(let c=0;c<n.length;c++){let y=n[c].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(n=n.slice(),n[c]=n[c].cloneNode(!0))}let i=n.length,s=t.length,u=i,l=0,o=0,a=s>0?t[s-1].nextSibling??void 0:r,p=null;for(;l<s||o<u;){if(t[l]===n[o]){l++,o++;continue}for(;s>l&&u>o&&t[s-1]===n[u-1];)s--,u--;if(s===l){let c=u<i?o?n[o-1].nextSibling??void 0:n[u-o]:a;for(;o<u;)x(e,n[o++],c)}else if(u===o)for(;l<s;)(!p||!p.has(t[l]))&&t[l].parentNode===e&&e.removeChild(t[l]),l++;else if(t[l]===n[u-1]&&n[o]===t[s-1]){let c=t[--s].nextSibling;x(e,n[o++],t[l++].nextSibling),x(e,n[--u],c),t[s]=t[l-1]}else{if(!p){p=new Map;let y=o;for(;y<u;)p.set(n[y],y++)}let c=p.get(t[l]);if(c!=null)if(o<c&&c<u){let y=l,g=1;for(;++y<s&&y<u&&!(!p.has(t[y])||p.get(t[y])!==c+g);)g++;if(g>c-o){let v=t[l];for(;o<c;)x(e,n[o++],v)}else t[l].parentNode===e?e.replaceChild(n[o++],t[l++]):(x(e,n[o++],a),l++)}else l++;else t[l].parentNode===e&&e.removeChild(t[l]),l++}}return n}function V(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){h.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function B(e,t,n){n==null?delete e[t]:e[t]=n}function hr(e,t,n){let r=n,i;return Array.isArray(n)&&(r=n[0],i=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i))}function yr(e,t){let n=(r,i)=>{typeof r=="function"&&r(e,i??(()=>{}))};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 Lt(e,t,n,r=!1){return typeof n!="function"?(A(e,t,n,r),()=>{}):S(()=>{let i=typeof n=="function"?n():n;A(e,t,i,r)})}function $t(e,t,n){return typeof n!="function"?(B(e,t,n),()=>{}):S(()=>{let r=typeof n=="function"?n():n;B(e,t,r)})}function mr(e,t,n){return typeof n!="function"?(A(e,t,!!n),()=>{}):S(()=>{let r=n();A(e,t,!!r)})}function oe(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){S(()=>oe(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 i=t[r];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function Ft(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],s=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push(S(()=>{let u=!!i();for(let l of s)e.classList.toggle(l,u)}));else{let u=!!(typeof i=="function"?i():i);for(let l of s)e.classList.toggle(l,u)}}}function ge(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 i=n[r];i==null?e.style[r]="":e.style[r]=i}}function Ut(e){let{element:t,props:n,prevProps:r=lr,isSVG:i=!1,skipChildren:s=!1}=e;if(!t||!Rt(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let u=i||t.namespaceURI===pt,l=[];for(let o in n){if(s&&o==="children")continue;let a=n[o],p=r[o];if(a===p)continue;if(o==="ref"){$e(a,t);continue}if(o==="use"){yr(t,a);continue}if(o.startsWith("on:")){l.push(hr(t,o.slice(3),a));continue}if(o.startsWith("prop:")){l.push($t(t,o.slice(5),a));continue}if(o.startsWith("attr:")){l.push(Lt(t,o.slice(5),a,u));continue}if(o.startsWith("bool:")){l.push(mr(t,o.slice(5),a));continue}if(o==="class"||o==="className"){typeof a=="function"?l.push(S(()=>oe(t,a()))):oe(t,a);continue}if(o==="classList"){typeof a=="function"?l.push(S(()=>Ft(t,a()))):Ft(t,a,l);continue}if(o==="style"){typeof a=="function"?l.push(S(()=>ge(t,a()))):ge(t,a);continue}if(o.startsWith("on")){let y=o.slice(2).toLowerCase();p&&qt(t,y),a&&cr(t,y,a);continue}let c=Ce.has(o)||!u&&o in t;typeof a=="function"?l.push(c?$t(t,o,a):Lt(t,o,a,u)):l.push(S(()=>c?B(t,o,n[o]):A(t,o,n[o],u)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let a=o.slice(2).toLowerCase();qt(t,a)}else Ce.has(o)?B(t,o,null):t.removeAttribute(o);return()=>{l.forEach(o=>o())}}function $e(e,t){if(e){if(pe(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 ye(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function be(e,t,n){if(!t)throw new Error("Container element is required");let r,i,s=[];return $(u=>{ee(()=>{h.active||(t.textContent=""),Nt(t),Pt(),K(t,e)}),i=u}),()=>{i?.(),r?.(),s.forEach(u=>u()),t.textContent=""}}var gr="__fluixi_signal_next_state__",br=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},f=globalThis[gr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:br,onSuspend:null,onError:null},Ht=0,Wt=1,ie=2,sn=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(f.untracked)return;let e=f.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},wr=class extends sn{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(ie);Ue(this)}}peek(){return this._value}},un=class extends sn{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=ie,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(f.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Wt&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===ie)break}(this.state===ie||!this._initialized)&&this.recompute(),this.state=Ht}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let e=f.consumer,t=f.untracked;f.consumer=this,f.untracked=!1;let n,r=!1,i;try{n=this._fn()}catch(u){r=!0,i=u,n=this._value}finally{f.consumer=e,f.untracked=t}let s=!this._initialized||this._threw!==r||(r?i!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=r,this._error=i,this._value=n,s){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(ie);Ue(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Ht;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(Wt);Ue(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Ue(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var xr=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function vr(e){if(f.untracked)return e();f.untracked=!0;try{return e()}finally{f.untracked=!1}}function Be(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ee(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:n=>{let r=f.owner,i=Be(r);(i.contexts=new Map).set(t,n.value),r&&(r.owned??=[]).push(i),f.owner=i;try{return n.children}finally{f.owner=r}}}}function ln(e){let t=f.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function an(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Sr(e){f.onSuspend=e}function Er(e){return f.onSuspend?(f.onSuspend(e,f.owner),!0):!1}function Tr(e){f.onError=e}function Ar(){return f.owner}function cn(e,t){let n=f.owner;f.owner=e;try{return t()}finally{f.owner=n}}function Ke(e){if(f.owner){if(f.owner.disposed){e();return}(f.owner.cleanups??=[]).push(e)}}function xe(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)xe(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function fn(e){let t=Be(f.owner);f.owner&&(f.owner.owned??=[]).push(t);let n=f.owner;f.owner=t;try{return e(()=>xe(t))}finally{f.owner=n}}function _r(e){f.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Nr(e){e.queued||(e.queued=!0,f.queue.push(e),!f.scheduled&&f.batchDepth===0&&(f.scheduled=!0,f.hostSchedule(Ge)))}function Ge(){if(f.scheduled=!1,f.flushing)return;f.flushing=!0;let e=0;try{for(;f.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=f.queue;f.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{f.flushing=!1}}function Pr(){f.batchDepth===0&&Ge()}function Cr(e){f.batchDepth++;try{return e()}finally{--f.batchDepth===0&&Ge()}}var kr=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=Be(f.owner),f.owner&&(f.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new un(()=>{xe(this.owner,!1),cn(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new xr(()=>Nr(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&f.onSuspend){f.onSuspend(e,this.owner);return}if(f.onError&&f.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),xe(this.owner))}};function Xe(e){let t=new kr(e);return()=>t.dispose()}function Or(e){return!!e&&typeof e.then=="function"}_r(()=>{});var dn=Symbol.for("signal"),Rr=Symbol.for("memo"),Mr=Symbol.for("signal-node");function M(e,t){let n=new wr(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let u=typeof s=="function"?s(n.peek()):s;return n.set(u),Pr(),u});return Object.defineProperty(r,dn,{value:!0,enumerable:!0}),Object.defineProperty(r,Mr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,i]}function Je(e,t,n){let r=t,i=Ar(),s=new un(()=>cn(i,()=>{try{return r=e(r)}catch(l){if(Or(l))return Er(l),r;throw l}}),{equals:n?.equals}),u=(()=>s.get());return Object.defineProperty(u,dn,{value:!0,enumerable:!0}),Object.defineProperty(u,Rr,{value:!0,enumerable:!0}),u}function Te(e,t){let n=t;return Xe(()=>{n=e(n)})}function pn(e,t){let n=t;Xe(()=>{n=e(n)})}function hn(e,t){let n=t;return Xe(()=>{n=e(n)})}function R(e){return Cr(e)}function X(e){return vr(e)}var jo=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var Dr=Symbol.for("signal");function yn(e){return typeof e=="function"&&e[Dr]===!0}var zt=null;function jr(e){zt&&zt(e)}var Bt=null;function Ir(e){return Bt?Bt(e):void 0}var Kt=null;function qr(){return Kt?Kt():void 0}var Gt=null;function Lr(e,t){Gt&&Gt(e,t)}function $r(e){return!!e&&typeof e.then=="function"}var Fe=Symbol();function mn(e,t,n={}){let r,i;typeof t=="function"?(r=typeof e=="function"?e:()=>e,i=t):(r=()=>!0,i=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:qr(),u=s!==void 0?Ir(s):void 0,l=u!==void 0,[o,a]=M(u!==void 0?u.value:n.initialValue,{equals:!1}),[p,c]=M(void 0,{equals:!1}),[y,g]=M(u!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[v,b]=M(void 0,{equals:!1}),[U,J]=M(void 0,{equals:!1}),j=Fe,Y=!1;Te(()=>{let w=r();if(U(),w===!1||w===null||w===void 0){j=Fe,R(()=>{g("unresolved"),b(void 0),c(void 0)});return}let le=Y;if(Y=!1,j!==Fe&&w===j&&!le)return;if(j=w,l){l=!1;return}let ae=!1;Ke(()=>ae=!0);let ft=X(y),Mn=X(o),dt=ft==="ready"||ft==="refreshing";R(()=>{g(dt?"refreshing":"pending"),c(void 0)});try{let I=i(w,{value:Mn,refetching:dt});$r(I)?(b(I),jr(I),I.then(ce=>{ae||(s!==void 0&&Lr(s,ce),R(()=>{a(()=>ce),g("ready"),b(void 0)}))},ce=>{ae||R(()=>{c(ce),g("errored"),b(void 0)})})):R(()=>{a(()=>I),g("ready"),b(void 0)})}catch(I){if(ae)return;R(()=>{c(I),g("errored"),b(void 0)})}});let ue=()=>{let w=y();return w==="pending"||w==="refreshing"},H=(()=>{let w=p();if(w)throw w;if(ue()){let le=v();if(le)throw le}return o()});return Object.defineProperties(H,{state:{get:y},loading:{get:ue},error:{get:p},latest:{get:o}}),Object.defineProperty(H,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(H,Symbol.for("signal"),{value:!0,enumerable:!0}),[H,{mutate:a,refetch:()=>{Y=!0,J(void 0)}}]}var Fr=Ee();Sr((e,t)=>{let n=an(t,Fr);n&&(n.increment(),e.finally(()=>n.decrement()))});var Vr=Ee();Tr((e,t)=>{let n=an(t,Vr);return n?(n.setError(e),!0):!1});function gn(e,t){let[n,r]=M(e,t);return Object.assign(n,{set:r})}function bn(e,t,n){return Je(e,t,n)}function wn(e,t){return Te(e,t)}var He=Symbol("store-raw"),Xt=Symbol("store-node"),Jt=Symbol("store-has"),Yt=Symbol("store-self"),Zt=Symbol("store-track");var Qt=new WeakMap,en=new WeakMap;function xn(e){let[t,n]=C(e),r=t;return r.$=n,r}function ve(e){let t=Qt.get(e);return t||Qt.set(e,t={keys:new Map}),t}function tn(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=xn(n)),r}function nn(e){let t=ve(e);(t.all||(t.all=xn()))()}function rn(e,t){e.$(typeof t=="function"?()=>t:t)}function vn(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function we(e){if(!vn(e))return e;let t=en.get(e);if(t)return t;let n=new Proxy(e,Ur);return en.set(e,n),n}var Ur={get(e,t,n){if(t===He||t===Xt)return e;if(t===Re)return n;if(t===Jt)return u=>u in e;if(t==="__proxy")return!0;if(t===Zt||t===Yt)return nn(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let i=Object.getOwnPropertyDescriptor(e,t);if(i&&i.get)return i.get.call(n);let s=tn(ve(e),t,r)();return vn(s)?we(s):s},set(){return!0},deleteProperty(e,t){return t in e&&se(e,t,void 0),!0},has(e,t){return t===He||t===Re||t===Xt||t===Jt||t===Yt||t===Zt?!0:(tn(ve(e),t,e[t])(),t in e)},ownKeys(e){return nn(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function se(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let r=Array.isArray(e),i=r?e.length:0;n===void 0?delete e[t]:e[t]=n;let s=ve(e),u=s.keys.get(t);if(u&&rn(u,n),r&&e.length!==i){let l=s.keys.get("length");l&&rn(l,e.length)}s.all&&s.all.$(void 0)}function on(e,t){return typeof e=="function"?e(t):e}function We(e,t){for(let n of Object.keys(t)){let r=t[n],i=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&i&&typeof i=="object"&&!Array.isArray(i)?We(i,r):se(e,n,r)}}function Ye(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function Sn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let u=t[s];if(u==="*"){let o=t.slice(s+1);if(Array.isArray(e))for(let a=0;a<e.length;a++)Sn(e[a],o,n);return}let l=e[u];(l==null||typeof l!="object")&&(l=/^\d+$/.test(t[s+1])?[]:{},se(e,u,l)),e=l}let i=t[r];if(i==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)se(e,s,on(n,e[s]));return}se(e,i,on(n,e[i]))}function Ve(e,t,n){Sn(e,Ye(t),n)}function Hr(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&We(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&Ve(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){We(e,n);return}if(Array.isArray(t[1])&&t.length>=3){Ve(e,`${n}.${t[1].join(".")}`,t[2]);return}Ve(e,String(n),t[1])}function ze(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ze);let t={};for(let n of Object.keys(e))t[n]=ze(e[n]);return t}function G(e,t){let n=e;for(let r of Ye(t)){if(n==null)return;n=n[r]}return n}var En=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...n)=>ee(()=>Hr(this.root,n)))}get state(){return we(this.root)}get proxy(){return we(this.root)}get accessor(){return(()=>we(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return Se(this.state);let t=this.state;for(let n of Ye(e)){if(t==null)return;t=t[n]}return Se(t)}select(e){return m(()=>e(this.state))}subscribe(e){return de(()=>e(this.state))}watch(e,t){let n;return de(()=>{let r=e(this.state);Object.is(r,n)||(t(r,n),n=r)})}reactive(e){return m(()=>this.state[e])}produce(e){this.set((t=>{let n=ze(t);return e(n),n}))}reconcile(e,t={}){this.set(e)}push(e,...t){let n=G(this.root,e);this.set(e,n.concat(t))}pop(e){let t=G(this.root,e).slice(),n=t.pop();return this.set(e,t),n}shift(e){let t=G(this.root,e).slice(),n=t.shift();return this.set(e,t),n}splice(e,t,n,...r){let i=G(this.root,e).slice(),s=i.splice(t,n,...r);return this.set(e,i),s}insert(e,t,n){let r=G(this.root,e).slice();r.splice(t,0,n),this.set(e,r)}removeAt(e,t){let n=G(this.root,e).slice(),r=n.splice(t,1);return this.set(e,n),r}toObservable(){let[e]=C(this.state);return e.toObservable()}dispose(){}},Wr=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function zr(e,t){for(let n of Wr)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function Tn(e,t={immutable:!0}){let n=new En(e,t);return zr(n.set,n),[n.proxy,n.set]}function Br(e,t={}){return new En(e,{...t,immutable:!1})}function Se(e){if(e==null||typeof e!="object")return e;let t=e[He];return t!==void 0?t:e}function Kr(e){return k(()=>Se(e))}var qo=Object.freeze({createStore:Tn,createMutableStore:Br,batch:ee,unwrap:Se,untrackStore:Kr});function An(e,t){let[n,r]=Tn(e,t);return new Proxy(n,{get:(i,s)=>s==="set"?r:i[s],has:(i,s)=>s==="set"||Reflect.has(i,s)})}var Gr="__fx_dom_create_component__",_n=globalThis[Gr]??={fn:null};function Nn(e,t){if(_n.fn)return _n.fn(e,t);let n=typeof e=="function"?X(()=>e(t)):e;if(n!=null&&(typeof n=="function"||typeof n=="object")&&!yn(n)){try{n.$name=e?.name}catch{}return Ct(n)}return n}var Xr="__FX_DATA__";var Ze;function Pn(){let e=globalThis.__FX_DATA__;if(e)return e;if(Ze!==void 0)return Ze;let t=null;if(typeof document<"u"){let n=document.getElementById(Xr)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Ze=t}function Ae(){for(;;){for(;h.cursor&&h.cursor.nodeType===3&&h.cursor.data==="";)h.cursor=h.cursor.nextSibling;if(h.cursor!=null||!h.parents.length)return;h.cursor=h.parents.pop().nextSibling}}var Jr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_e=typeof process<"u"&&process.env&&!1;function Ne(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 Yr(e){Ae();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Jr.has(e.toLowerCase())?h.cursor=t.nextSibling:(h.parents.push(t),h.cursor=t.firstChild),t):(_e&&t&&Ne(`<${e}>`,t),null)}function Zr(e){Ae();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(h.cursor=t.nextSibling,t):(_e&&t&&Ne(`<${e}> (static)`,t),null)}function Qr(e){if(e===""){let n=h.cursor;return n&&n.nodeType===3&&n.data!==""?(h.cursor=n.nextSibling,n.data="",n):null}Ae();let t=h.cursor;return t&&t.nodeType===3?(h.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(_e&&t&&Ne(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function eo(e){Ae();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(_e&&t&&Ne(`marker <!--${e.slice(0,24)}-->`,t),null)}var Cn=!1;function to(){Cn||(Cn=!0,jt({hydrateElement:Yr,hydrateText:Qr,hydrateMarker:eo,hydrateStatic:Zr}))}function Qe(e,t,n){to(),h.active=!0,h.cursor=t.firstChild,h.parents=[];let r=Pn(),i=n?.resourceNamespace,s=0;Tt(()=>i?`${i}:r${s++}`:`r${s++}`),Et(r?u=>u in r?{value:r[u]}:void 0:null);try{return be(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[]}}function kn(e){return typeof e=="function"?e:(()=>e)}function D(e){return()=>{let t=e();return typeof t=="function"?t():t}}function On(e){return e!=null&&e!==!1}function Rn(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function et(e){let t=D(()=>e.when),n=m(t,void 0),r=m(n,void 0),i=q(),s=null,u=null,l=o=>{o!==u&&(s&&z(s),s=W(i),u=o)};return m(()=>{let o=r();return l(o?"when":"fallback"),_(s,()=>{if(o){let a=e.children;return typeof a=="function"&&!Rn(a)?typeof n=="function"?k(()=>k(n)?a(n()):e.fallback):a(n):a}return e.fallback});return e.fallback??null},void 0,{name:"show"})}function tt(e){let t=D(()=>e.each),n=()=>e.fallback??null,r=(i,s)=>{let u=e.children,l=Array.isArray(u)?u.map(o=>typeof o=="function"?o(i,s):o):typeof u=="function"?u(i,s):u;return he(l),l};return e.by?ne(t,e.by,(i,s)=>r(i,s),{fallback:n}):te(t,(i,s)=>r(i,s),{fallback:n})}function nt(e){let t=D(()=>e.each);return re(t,(n,r)=>{let i=e.children(n,r);return he(i),i},{fallback:()=>e.fallback??null})}var rt=Symbol("match");function ot(e){return{[rt]:!0,when:D(()=>e.when),get children(){return e.children}}}function it(e){let t=Array.isArray(e.children)?e.children:[e.children],n=q(),r=null,i=-1,s=u=>{u!==i&&(r&&z(r),r=W(n),i=u)};return m(()=>{for(let u=0;u<t.length;u+=1){let o=t[u],a=0;for(;typeof o=="function"&&!o[rt]&&a++<10;)o=o();if(!o||typeof o!="object"||o[rt]!==!0)continue;let p=o.when();if(On(p))return s(u),_(r,()=>typeof o.children=="function"?o.children(p):o.children)}return s(-2),_(r,()=>e.fallback??null)})}function st(e){let t=kn(e.component),{component:n,...r}=e,i=q(),s=null,u;return m(()=>{let l=t();return l!==u&&(s&&z(s),s=W(i),u=l),l==null?null:typeof l=="string"?{tag:l,props:r}:_(s,()=>l(r))})}function ut(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return $(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),K(r,e.children)&&$e(e.ref,r)}),L(()=>{n(),r.remove()}),null}function lt(e){let[t,n]=C(null),r=()=>n(null);return m(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,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}})}function at(e){return m(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;(typeof i=="function"?i():i)&&n.push(r)}return n.join(" ")})}function no(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ct(e){return m(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let s=typeof i=="function"?i():i;s!=null&&n.push(`${no(r)}: ${s}`)}return n.join("; ")})}return $n(ro);})();
|
|
1
|
+
"use strict";var FluixiDOM=(()=>{var Pe=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames;var In=Object.prototype.hasOwnProperty;var qn=(e,t)=>{for(var n in t)Pe(e,n,{get:t[n],enumerable:!0})},Ln=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jn(t))!In.call(e,i)&&i!==n&&Pe(e,i,{get:()=>t[i],enumerable:!(r=Dn(t,i))||r.enumerable});return e};var $n=e=>Ln(Pe({},"__esModule",{value:!0}),e);var ro={};qn(ro,{Dynamic:()=>st,ErrorBoundary:()=>lt,For:()=>tt,Index:()=>nt,Match:()=>ot,Portal:()=>ut,Show:()=>et,Switch:()=>it,batch:()=>R,classMap:()=>at,createComponent:()=>Nn,createComputed:()=>pn,createContext:()=>Ee,createEffect:()=>Te,createElement:()=>ht,createMemo:()=>Je,createRenderEffect:()=>hn,createResource:()=>mn,createRoot:()=>fn,createSignal:()=>M,delegateEvents:()=>Le,effect:()=>wn,hydrate:()=>Qe,indexArray:()=>re,insert:()=>K,keyArray:()=>ne,mapArray:()=>te,memo:()=>bn,onCleanup:()=>Ke,render:()=>be,setAttribute:()=>A,setClassName:()=>oe,setProperty:()=>B,setStyle:()=>ge,signal:()=>gn,spread:()=>Ut,store:()=>An,styleMap:()=>ct,untrack:()=>X,useContext:()=>ln});var pt="http://www.w3.org/2000/svg";var Ce=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function A(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 Fn(e,t){Object.assign(e.style,t)}function ht(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,s])=>{if(i==="class"||i==="className")r.className=s;else if(i==="style"&&typeof s=="object")Fn(r,s);else if(i.startsWith("on")&&typeof s=="function"){let u=i.slice(2).toLowerCase();r.addEventListener(u,s)}else A(r,i,s)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}var io=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var Vn="__fluixi_signal_next_state__",Un=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},d=globalThis[Vn]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Un,onSuspend:null,onError:null},yt=0,mt=1,Z=2,gt=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(d.untracked)return;let e=d.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Hn=class extends gt{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(Z);ke(this)}}peek(){return this._value}},bt=class extends gt{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=Z,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(d.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===mt&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Z)break}(this.state===Z||!this._initialized)&&this.recompute(),this.state=yt}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let e=d.consumer,t=d.untracked;d.consumer=this,d.untracked=!1;let n,r=!1,i;try{n=this._fn()}catch(u){r=!0,i=u,n=this._value}finally{d.consumer=e,d.untracked=t}let s=!this._initialized||this._threw!==r||(r?i!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=r,this._error=i,this._value=n,s){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(Z);ke(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===yt;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(mt);ke(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function ke(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Wn=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function zn(e){if(d.untracked)return e();d.untracked=!0;try{return e()}finally{d.untracked=!1}}function W(e){let t=fe(e);return e&&(e.owned??=[]).push(t),t}function z(e,t=!0){Q(e,t)}function fe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function wt(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:n=>{let r=d.owner,i=fe(r);(i.contexts=new Map).set(t,n.value),r&&(r.owned??=[]).push(i),d.owner=i;try{return n.children}finally{d.owner=r}}}}function xt(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Bn(e){d.onSuspend=e}function Kn(e){return d.onSuspend?(d.onSuspend(e,d.owner),!0):!1}function Gn(e){d.onError=e}function q(){return d.owner}function _(e,t){let n=d.owner;d.owner=e;try{return t()}finally{d.owner=n}}function L(e){if(d.owner){if(d.owner.disposed){e();return}(d.owner.cleanups??=[]).push(e)}}function Q(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Q(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function $(e){let t=fe(d.owner);d.owner&&(d.owner.owned??=[]).push(t);let n=d.owner;d.owner=t;try{return e(()=>Q(t))}finally{d.owner=n}}function Xn(e){d.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Jn(e){e.queued||(e.queued=!0,d.queue.push(e),!d.scheduled&&d.batchDepth===0&&(d.scheduled=!0,d.hostSchedule(Oe)))}function Oe(){if(d.scheduled=!1,d.flushing)return;d.flushing=!0;let e=0;try{for(;d.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=d.queue;d.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{d.flushing=!1}}function Yn(){d.batchDepth===0&&Oe()}function Zn(e){d.batchDepth++;try{return e()}finally{--d.batchDepth===0&&Oe()}}var Qn=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=fe(d.owner),d.owner&&(d.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new bt(()=>{Q(this.owner,!1),_(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new Wn(()=>Jn(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&d.onSuspend){d.onSuspend(e,this.owner);return}if(d.onError&&d.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),Q(this.owner))}};function vt(e){let t=new Qn(e);return()=>t.dispose()}function er(e){return!!e&&typeof e.then=="function"}Xn(()=>{});var St=Symbol.for("signal"),tr=Symbol.for("memo"),nr=Symbol.for("signal-node");function C(e,t){let n=new Hn(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let u=typeof s=="function"?s(n.peek()):s;return n.set(u),Yn(),u});return Object.defineProperty(r,St,{value:!0,enumerable:!0}),Object.defineProperty(r,nr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,i]}function m(e,t,n){let r=t,i=q(),s=new bt(()=>_(i,()=>{try{return r=e(r)}catch(l){if(er(l))return Kn(l),r;throw l}}),{equals:n?.equals}),u=(()=>s.get());return Object.defineProperty(u,St,{value:!0,enumerable:!0}),Object.defineProperty(u,tr,{value:!0,enumerable:!0}),u}function de(e,t){let n=t;return vt(()=>{n=e(n)})}function S(e,t){let n=t;return vt(()=>{n=e(n)})}function ee(e){return Zn(e)}function k(e){return zn(e)}function te(e,t,n){let r=[];return L(()=>{for(let i of r)i.dispose();r=[]}),m(()=>{let i=e()||[];return k(()=>{if(i.length===0){for(let o of r)o.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let o of r)s.has(o.item)||s.set(o.item,o);let u=[],l=new Set;for(let o=0;o<i.length;o++){let a=i[o],p=s.get(a);if(p&&!l.has(p))p.setIndex(o),u.push(p),l.add(p);else{let c,y,g;$(b=>{g=b;let[U,J]=C(o);y=J,c=t(a,U)});let v={item:a,rendered:c,dispose:g,setIndex:y};u.push(v),l.add(v)}}for(let o of r)l.has(o)||o.dispose();return r=u,u.map(o=>o.rendered)})})}function ne(e,t,n,r){let i=[],s=[];return L(()=>{for(let u of s)u.dispose();i=[],s=[]}),m(()=>{let u=e()||[];return k(()=>{if(u.length===0){for(let c of s)c.dispose();return i=[],s=[],r?.fallback?r.fallback():[]}let l=new Map;for(let c=0;c<i.length;c++)l.set(i[c],s[c]);let o=[],a=[],p=new Set;for(let c=0;c<u.length;c++){let y=t(u[c]),g=l.get(y);if(g&&!p.has(y))g.setIndex(c),o.push(g);else{let v,b,U;$(J=>{U=J;let[j,Y]=C(c);b=Y;let ue=m(H=>(e()||[])[j()]??H,u[c]);v=n(ue,j)}),o.push({rendered:v,dispose:U,setIndex:b})}a.push(y),p.add(y)}for(let[c,y]of l)p.has(c)||y.dispose();return i=a,s=o,o.map(c=>c.rendered)})})}function re(e,t,n){let r=[];return L(()=>{for(let i of r)i.dispose();r=[]}),m(()=>{let i=e()||[];return k(()=>{if(i.length===0){for(let o of r)o.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,u=i.length;for(let o=s;o<u;o++){let a,p,c,y=i[o];$(g=>{c=g;let[v,b]=C(y);p=b,a=t(v,o)}),r.push({rendered:a,setItem:p,dispose:c})}for(let o=u;o<s;o++)r[o].dispose();u<s&&(r=r.slice(0,u));let l=Math.min(s,u);for(let o=0;o<l;o++)r[o].setItem(i[o]);return r.map(o=>o.rendered)})})}var uo=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var rr=Symbol.for("signal");function E(e){return typeof e=="function"&&e[rr]===!0}var or=null;function Et(e){or=e}var ir=null;function Tt(e){ir=e}var sr=wt();Bn((e,t)=>{let n=xt(t,sr);n&&(n.increment(),e.finally(()=>n.decrement()))});var ur=wt();Gn((e,t)=>{let n=xt(t,ur);return n?(n.setError(e),!0):!1});var Re=Symbol.for("fluixi-proxy");var At="1.0.0-alpha.82";var _t="1.0.0-alpha.82";var T={dom:At,reactive:_t};function Nt(e){T.core&&e.setAttribute("fluixi",T.core),e.setAttribute("fx-dom",T.dom),e.setAttribute("fx-reactive",T.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=T)}function Pt(){let e=[T.core,T.dom,T.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${T.core??"(absent)"}, dom ${T.dom}, reactive ${T.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 Ct(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function F(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var Me=typeof document>"u";var De=Symbol.for("fluixi.server-node"),kt=null;function Ot(){if(!kt)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return kt}function pe(e){return e!=null&&e[De]===!0?!0:typeof Node<"u"&&e instanceof Node}function Rt(e){return e!=null&&e[De]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Mt(e){return e!=null&&e[De]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var h={active:!1,cursor:null,parents:[]},Dt=null;function jt(e){Dt=e}function It(){return Dt}function je(e,t){return h.active&&t.parentNode===e}function Ie(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function he(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Ie(t)}var lr={};var qe=new Set,Vt=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function Le(e){if(!Me)for(let t of e)qe.has(t)||Vt.has(t)||(qe.add(t),document.addEventListener(t,ar))}function ar(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 cr(e,t,n){if(e[`$$${t}`]=n,Vt.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,i),e[r]=i}return}qe.has(t)||Le([t])}function qt(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function O(e,t=!1){if(Me)return Ot().createText(e);if(h.active&&!t){let n=It()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var P=0,fr=200;function dr(e,t,n,r,i){let s=r,u=new Map;return S(()=>{let l;if(F(e)&&!E(e)){if(!u.has(e)){P++;try{let o=e();u.set(e,o)}finally{P--}}for(l=u.get(e);typeof l=="function"&&E(l);)l=l()}else for(l=e();typeof l=="function"&&E(l);)l=l();{let o=0;for(;typeof l=="function"&&o++<50;)if(F(l)){if(!u.has(l)){let a=l;P++;try{let p=a();u.set(a,p)}finally{P--}}l=u.get(l)}else if(E(l))l=l();else if(l=l(),typeof l!="function"||!E(l)&&!F(l))break}P++;try{s=me(t,l,n,s,u),i(s)}finally{P--}})}function K(e,t,n,r){if(P>fr)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=O("",!0),e.appendChild(n));let i=r??null,s=o=>Array.isArray(o)&&o.some(a=>typeof a=="function"),u=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!s(t)){P++;try{i=me(e,t,n,i)}finally{P--}return()=>i}let l=dr(u(t),e,n,i,o=>{i=o});return()=>(l?.(),i)}function me(e,t,n,r,i){if(t==null||typeof t=="boolean")return V(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return V(e,r,n);if(ye(t)){let u=O("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(u,r[0]),V(e,r.slice(1),n)):x(e,u,n):r?e.replaceChild(u,r):x(e,u,n),t.then(l=>{u.parentNode===e&&me(e,l,u.nextSibling,u)}).catch(l=>{console.error("Error resolving promise in insertExpression:",l)}),u}let s=typeof t;if(s==="string"||s==="number"){if(s==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let l=O(t);return x(e,l,n),l}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=V(e,r,n)}if(r&&Mt(r))return r.data=t,r;let u=O(t);return r&&r.parentNode===e?e.replaceChild(u,r):je(e,u)||x(e,u,n),u}if(pe(t))return je(e,t)?(Ie(t),t):Array.isArray(r)?(r.length===0?x(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),V(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 u=[],l=Array.isArray(r)?r:r?[r]:[],o=[];N(t,u,e,n,!0,i,o);let a=pr(e,l,u,n);for(let p of o){let c=K(e,p.sig,p.marker);L(()=>{V(e,c()),p.marker.parentNode===e&&e.removeChild(p.marker)})}return a}if(s==="object"&&t!==null&&typeof t=="object"){let u=t;if("type"in u&&"props"in u){let l=u;if(typeof l.type=="function"){let o=l.type(l.props||{});return me(e,o,n,r)}}}return V(e,r,n)}function N(e,t,n,r,i=!0,s,u){for(let l=0;l<e.length;l++){let o=e[l];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!ye(o)&&!E(o)&&!F(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let a;for(F(o)&&!E(o)?(s||(s=new Map),s.has(o)||s.set(o,o()),a=s.get(o)):a=o();typeof a=="function"&&!ye(a)&&!E(a)&&!F(a);)s||(s=new Map),s.has(a)||s.set(a,a()),a=s.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(E(a)){if(u){let c=O("",!0);t.push(c),u.push({marker:c,sig:a});continue}let p=a();for(;typeof p=="function"&&E(p);)p=p();if(p==null||typeof p=="boolean")continue;Array.isArray(p)?N(p,t,n,r,i,s):N([p],t,n,r,i,s);continue}continue}Array.isArray(a)?N(a,t,n,r,i,s,u):N([a],t,n,r,i,s,u);continue}if(ye(o)){let a=O("",!0);t.push(a),o.then(p=>{if(a.parentNode){let c=[];if(N([p],c,a.parentNode,void 0,!1,s),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(p=>console.error("Error resolving promise in array:",p));continue}if(Array.isArray(o)){N(o,t,n,r,i,s,u);continue}if(pe(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let a=o;if(typeof a.type=="function"){let p=a.type(a.props||{});Array.isArray(p)?N(p,t,n,r,!1,s):N([p],t,n,r,!1,s);continue}}if(typeof o=="string"||typeof o=="number"){let a=String(o);if(a.trim()===""&&a!==" ")continue;t.push(O(a));continue}t.push(O(String(o)))}}}}function pr(e,t,n,r){for(let c=0;c<n.length;c++){let y=n[c].parentNode;y!==null&&y!==e&&y.nodeType!==11&&(n=n.slice(),n[c]=n[c].cloneNode(!0))}let i=n.length,s=t.length,u=i,l=0,o=0,a=s>0?t[s-1].nextSibling??void 0:r,p=null;for(;l<s||o<u;){if(t[l]===n[o]){l++,o++;continue}for(;s>l&&u>o&&t[s-1]===n[u-1];)s--,u--;if(s===l){let c=u<i?o?n[o-1].nextSibling??void 0:n[u-o]:a;for(;o<u;)x(e,n[o++],c)}else if(u===o)for(;l<s;)(!p||!p.has(t[l]))&&t[l].parentNode===e&&e.removeChild(t[l]),l++;else if(t[l]===n[u-1]&&n[o]===t[s-1]){let c=t[--s].nextSibling;x(e,n[o++],t[l++].nextSibling),x(e,n[--u],c),t[s]=t[l-1]}else{if(!p){p=new Map;let y=o;for(;y<u;)p.set(n[y],y++)}let c=p.get(t[l]);if(c!=null)if(o<c&&c<u){let y=l,g=1;for(;++y<s&&y<u&&!(!p.has(t[y])||p.get(t[y])!==c+g);)g++;if(g>c-o){let v=t[l];for(;o<c;)x(e,n[o++],v)}else t[l].parentNode===e?e.replaceChild(n[o++],t[l++]):(x(e,n[o++],a),l++)}else l++;else t[l].parentNode===e&&e.removeChild(t[l]),l++}}return n}function V(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){h.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function B(e,t,n){n==null?delete e[t]:e[t]=n}function hr(e,t,n){let r=n,i;return Array.isArray(n)&&(r=n[0],i=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i))}function yr(e,t){let n=(r,i)=>{typeof r=="function"&&r(e,i??(()=>{}))};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 Lt(e,t,n,r=!1){return typeof n!="function"?(A(e,t,n,r),()=>{}):S(()=>{let i=typeof n=="function"?n():n;A(e,t,i,r)})}function $t(e,t,n){return typeof n!="function"?(B(e,t,n),()=>{}):S(()=>{let r=typeof n=="function"?n():n;B(e,t,r)})}function mr(e,t,n){return typeof n!="function"?(A(e,t,!!n),()=>{}):S(()=>{let r=n();A(e,t,!!r)})}function oe(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){S(()=>oe(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 i=t[r];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function Ft(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],s=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push(S(()=>{let u=!!i();for(let l of s)e.classList.toggle(l,u)}));else{let u=!!(typeof i=="function"?i():i);for(let l of s)e.classList.toggle(l,u)}}}function ge(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 i=n[r];i==null?e.style[r]="":e.style[r]=i}}function Ut(e){let{element:t,props:n,prevProps:r=lr,isSVG:i=!1,skipChildren:s=!1}=e;if(!t||!Rt(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let u=i||t.namespaceURI===pt,l=[];for(let o in n){if(s&&o==="children")continue;let a=n[o],p=r[o];if(a===p)continue;if(o==="ref"){$e(a,t);continue}if(o==="use"){yr(t,a);continue}if(o.startsWith("on:")){l.push(hr(t,o.slice(3),a));continue}if(o.startsWith("prop:")){l.push($t(t,o.slice(5),a));continue}if(o.startsWith("attr:")){l.push(Lt(t,o.slice(5),a,u));continue}if(o.startsWith("bool:")){l.push(mr(t,o.slice(5),a));continue}if(o==="class"||o==="className"){typeof a=="function"?l.push(S(()=>oe(t,a()))):oe(t,a);continue}if(o==="classList"){typeof a=="function"?l.push(S(()=>Ft(t,a()))):Ft(t,a,l);continue}if(o==="style"){typeof a=="function"?l.push(S(()=>ge(t,a()))):ge(t,a);continue}if(o.startsWith("on")){let y=o.slice(2).toLowerCase();p&&qt(t,y),a&&cr(t,y,a);continue}let c=Ce.has(o)||!u&&o in t;typeof a=="function"?l.push(c?$t(t,o,a):Lt(t,o,a,u)):l.push(S(()=>c?B(t,o,n[o]):A(t,o,n[o],u)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let a=o.slice(2).toLowerCase();qt(t,a)}else Ce.has(o)?B(t,o,null):t.removeAttribute(o);return()=>{l.forEach(o=>o())}}function $e(e,t){if(e){if(pe(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 ye(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function be(e,t,n){if(!t)throw new Error("Container element is required");let r,i,s=[];return $(u=>{ee(()=>{h.active||(t.textContent=""),Nt(t),Pt(),K(t,e)}),i=u}),()=>{i?.(),r?.(),s.forEach(u=>u()),t.textContent=""}}var gr="__fluixi_signal_next_state__",br=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},f=globalThis[gr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:br,onSuspend:null,onError:null},Ht=0,Wt=1,ie=2,sn=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(f.untracked)return;let e=f.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},wr=class extends sn{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(ie);Ue(this)}}peek(){return this._value}},un=class extends sn{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=ie,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(f.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Wt&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===ie)break}(this.state===ie||!this._initialized)&&this.recompute(),this.state=Ht}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let e=f.consumer,t=f.untracked;f.consumer=this,f.untracked=!1;let n,r=!1,i;try{n=this._fn()}catch(u){r=!0,i=u,n=this._value}finally{f.consumer=e,f.untracked=t}let s=!this._initialized||this._threw!==r||(r?i!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=r,this._error=i,this._value=n,s){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(ie);Ue(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Ht;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(Wt);Ue(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Ue(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var xr=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function vr(e){if(f.untracked)return e();f.untracked=!0;try{return e()}finally{f.untracked=!1}}function Be(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ee(e){let t=Symbol("context");return{id:t,defaultValue:e,Provider:n=>{let r=f.owner,i=Be(r);(i.contexts=new Map).set(t,n.value),r&&(r.owned??=[]).push(i),f.owner=i;try{return n.children}finally{f.owner=r}}}}function ln(e){let t=f.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return e.defaultValue}function an(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Sr(e){f.onSuspend=e}function Er(e){return f.onSuspend?(f.onSuspend(e,f.owner),!0):!1}function Tr(e){f.onError=e}function Ar(){return f.owner}function cn(e,t){let n=f.owner;f.owner=e;try{return t()}finally{f.owner=n}}function Ke(e){if(f.owner){if(f.owner.disposed){e();return}(f.owner.cleanups??=[]).push(e)}}function xe(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)xe(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function fn(e){let t=Be(f.owner);f.owner&&(f.owner.owned??=[]).push(t);let n=f.owner;f.owner=t;try{return e(()=>xe(t))}finally{f.owner=n}}function _r(e){f.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Nr(e){e.queued||(e.queued=!0,f.queue.push(e),!f.scheduled&&f.batchDepth===0&&(f.scheduled=!0,f.hostSchedule(Ge)))}function Ge(){if(f.scheduled=!1,f.flushing)return;f.flushing=!0;let e=0;try{for(;f.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=f.queue;f.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{f.flushing=!1}}function Pr(){f.batchDepth===0&&Ge()}function Cr(e){f.batchDepth++;try{return e()}finally{--f.batchDepth===0&&Ge()}}var kr=class{constructor(e){this.queued=!1,this.disposed=!1,this.owner=Be(f.owner),f.owner&&(f.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new un(()=>{xe(this.owner,!1),cn(this.owner,()=>{let t=e();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new xr(()=>Nr(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&f.onSuspend){f.onSuspend(e,this.owner);return}if(f.onError&&f.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),xe(this.owner))}};function Xe(e){let t=new kr(e);return()=>t.dispose()}function Or(e){return!!e&&typeof e.then=="function"}_r(()=>{});var dn=Symbol.for("signal"),Rr=Symbol.for("memo"),Mr=Symbol.for("signal-node");function M(e,t){let n=new wr(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let u=typeof s=="function"?s(n.peek()):s;return n.set(u),Pr(),u});return Object.defineProperty(r,dn,{value:!0,enumerable:!0}),Object.defineProperty(r,Mr,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[r,i]}function Je(e,t,n){let r=t,i=Ar(),s=new un(()=>cn(i,()=>{try{return r=e(r)}catch(l){if(Or(l))return Er(l),r;throw l}}),{equals:n?.equals}),u=(()=>s.get());return Object.defineProperty(u,dn,{value:!0,enumerable:!0}),Object.defineProperty(u,Rr,{value:!0,enumerable:!0}),u}function Te(e,t){let n=t;return Xe(()=>{n=e(n)})}function pn(e,t){let n=t;Xe(()=>{n=e(n)})}function hn(e,t){let n=t;return Xe(()=>{n=e(n)})}function R(e){return Cr(e)}function X(e){return vr(e)}var jo=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var Dr=Symbol.for("signal");function yn(e){return typeof e=="function"&&e[Dr]===!0}var zt=null;function jr(e){zt&&zt(e)}var Bt=null;function Ir(e){return Bt?Bt(e):void 0}var Kt=null;function qr(){return Kt?Kt():void 0}var Gt=null;function Lr(e,t){Gt&&Gt(e,t)}function $r(e){return!!e&&typeof e.then=="function"}var Fe=Symbol();function mn(e,t,n={}){let r,i;typeof t=="function"?(r=typeof e=="function"?e:()=>e,i=t):(r=()=>!0,i=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:qr(),u=s!==void 0?Ir(s):void 0,l=u!==void 0,[o,a]=M(u!==void 0?u.value:n.initialValue,{equals:!1}),[p,c]=M(void 0,{equals:!1}),[y,g]=M(u!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[v,b]=M(void 0,{equals:!1}),[U,J]=M(void 0,{equals:!1}),j=Fe,Y=!1;Te(()=>{let w=r();if(U(),w===!1||w===null||w===void 0){j=Fe,R(()=>{g("unresolved"),b(void 0),c(void 0)});return}let le=Y;if(Y=!1,j!==Fe&&w===j&&!le)return;if(j=w,l){l=!1;return}let ae=!1;Ke(()=>ae=!0);let ft=X(y),Mn=X(o),dt=ft==="ready"||ft==="refreshing";R(()=>{g(dt?"refreshing":"pending"),c(void 0)});try{let I=i(w,{value:Mn,refetching:dt});$r(I)?(b(I),jr(I),I.then(ce=>{ae||(s!==void 0&&Lr(s,ce),R(()=>{a(()=>ce),g("ready"),b(void 0)}))},ce=>{ae||R(()=>{c(ce),g("errored"),b(void 0)})})):R(()=>{a(()=>I),g("ready"),b(void 0)})}catch(I){if(ae)return;R(()=>{c(I),g("errored"),b(void 0)})}});let ue=()=>{let w=y();return w==="pending"||w==="refreshing"},H=(()=>{let w=p();if(w)throw w;if(ue()){let le=v();if(le)throw le}return o()});return Object.defineProperties(H,{state:{get:y},loading:{get:ue},error:{get:p},latest:{get:o}}),Object.defineProperty(H,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(H,Symbol.for("signal"),{value:!0,enumerable:!0}),[H,{mutate:a,refetch:()=>{Y=!0,J(void 0)}}]}var Fr=Ee();Sr((e,t)=>{let n=an(t,Fr);n&&(n.increment(),e.finally(()=>n.decrement()))});var Vr=Ee();Tr((e,t)=>{let n=an(t,Vr);return n?(n.setError(e),!0):!1});function gn(e,t){let[n,r]=M(e,t);return Object.assign(n,{set:r})}function bn(e,t,n){return Je(e,t,n)}function wn(e,t){return Te(e,t)}var He=Symbol("store-raw"),Xt=Symbol("store-node"),Jt=Symbol("store-has"),Yt=Symbol("store-self"),Zt=Symbol("store-track");var Qt=new WeakMap,en=new WeakMap;function xn(e){let[t,n]=C(e),r=t;return r.$=n,r}function ve(e){let t=Qt.get(e);return t||Qt.set(e,t={keys:new Map}),t}function tn(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=xn(n)),r}function nn(e){let t=ve(e);(t.all||(t.all=xn()))()}function rn(e,t){e.$(typeof t=="function"?()=>t:t)}function vn(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function we(e){if(!vn(e))return e;let t=en.get(e);if(t)return t;let n=new Proxy(e,Ur);return en.set(e,n),n}var Ur={get(e,t,n){if(t===He||t===Xt)return e;if(t===Re)return n;if(t===Jt)return u=>u in e;if(t==="__proxy")return!0;if(t===Zt||t===Yt)return nn(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let i=Object.getOwnPropertyDescriptor(e,t);if(i&&i.get)return i.get.call(n);let s=tn(ve(e),t,r)();return vn(s)?we(s):s},set(){return!0},deleteProperty(e,t){return t in e&&se(e,t,void 0),!0},has(e,t){return t===He||t===Re||t===Xt||t===Jt||t===Yt||t===Zt?!0:(tn(ve(e),t,e[t])(),t in e)},ownKeys(e){return nn(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function se(e,t,n){if(e[t]===n&&(n!==void 0||t in e))return;let r=Array.isArray(e),i=r?e.length:0;n===void 0?delete e[t]:e[t]=n;let s=ve(e),u=s.keys.get(t);if(u&&rn(u,n),r&&e.length!==i){let l=s.keys.get("length");l&&rn(l,e.length)}s.all&&s.all.$(void 0)}function on(e,t){return typeof e=="function"?e(t):e}function We(e,t){for(let n of Object.keys(t)){let r=t[n],i=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&i&&typeof i=="object"&&!Array.isArray(i)?We(i,r):se(e,n,r)}}function Ye(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function Sn(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let u=t[s];if(u==="*"){let o=t.slice(s+1);if(Array.isArray(e))for(let a=0;a<e.length;a++)Sn(e[a],o,n);return}let l=e[u];(l==null||typeof l!="object")&&(l=/^\d+$/.test(t[s+1])?[]:{},se(e,u,l)),e=l}let i=t[r];if(i==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)se(e,s,on(n,e[s]));return}se(e,i,on(n,e[i]))}function Ve(e,t,n){Sn(e,Ye(t),n)}function Hr(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&We(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&Ve(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){We(e,n);return}if(Array.isArray(t[1])&&t.length>=3){Ve(e,`${n}.${t[1].join(".")}`,t[2]);return}Ve(e,String(n),t[1])}function ze(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ze);let t={};for(let n of Object.keys(e))t[n]=ze(e[n]);return t}function G(e,t){let n=e;for(let r of Ye(t)){if(n==null)return;n=n[r]}return n}var En=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...n)=>ee(()=>Hr(this.root,n)))}get state(){return we(this.root)}get proxy(){return we(this.root)}get accessor(){return(()=>we(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return Se(this.state);let t=this.state;for(let n of Ye(e)){if(t==null)return;t=t[n]}return Se(t)}select(e){return m(()=>e(this.state))}subscribe(e){return de(()=>e(this.state))}watch(e,t){let n;return de(()=>{let r=e(this.state);Object.is(r,n)||(t(r,n),n=r)})}reactive(e){return m(()=>this.state[e])}produce(e){this.set((t=>{let n=ze(t);return e(n),n}))}reconcile(e,t={}){this.set(e)}push(e,...t){let n=G(this.root,e);this.set(e,n.concat(t))}pop(e){let t=G(this.root,e).slice(),n=t.pop();return this.set(e,t),n}shift(e){let t=G(this.root,e).slice(),n=t.shift();return this.set(e,t),n}splice(e,t,n,...r){let i=G(this.root,e).slice(),s=i.splice(t,n,...r);return this.set(e,i),s}insert(e,t,n){let r=G(this.root,e).slice();r.splice(t,0,n),this.set(e,r)}removeAt(e,t){let n=G(this.root,e).slice(),r=n.splice(t,1);return this.set(e,n),r}toObservable(){let[e]=C(this.state);return e.toObservable()}dispose(){}},Wr=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function zr(e,t){for(let n of Wr)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function Tn(e,t={immutable:!0}){let n=new En(e,t);return zr(n.set,n),[n.proxy,n.set]}function Br(e,t={}){return new En(e,{...t,immutable:!1})}function Se(e){if(e==null||typeof e!="object")return e;let t=e[He];return t!==void 0?t:e}function Kr(e){return k(()=>Se(e))}var qo=Object.freeze({createStore:Tn,createMutableStore:Br,batch:ee,unwrap:Se,untrackStore:Kr});function An(e,t){let[n,r]=Tn(e,t);return new Proxy(n,{get:(i,s)=>s==="set"?r:i[s],has:(i,s)=>s==="set"||Reflect.has(i,s)})}var Gr="__fx_dom_create_component__",_n=globalThis[Gr]??={fn:null};function Nn(e,t){if(_n.fn)return _n.fn(e,t);let n=typeof e=="function"?X(()=>e(t)):e;if(n!=null&&(typeof n=="function"||typeof n=="object")&&!yn(n)){try{n.$name=e?.name}catch{}return Ct(n)}return n}var Xr="__FX_DATA__";var Ze;function Pn(){let e=globalThis.__FX_DATA__;if(e)return e;if(Ze!==void 0)return Ze;let t=null;if(typeof document<"u"){let n=document.getElementById(Xr)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Ze=t}function Ae(){for(;;){for(;h.cursor&&h.cursor.nodeType===3&&h.cursor.data==="";)h.cursor=h.cursor.nextSibling;if(h.cursor!=null||!h.parents.length)return;h.cursor=h.parents.pop().nextSibling}}var Jr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_e=typeof process<"u"&&process.env&&!1;function Ne(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 Yr(e){Ae();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Jr.has(e.toLowerCase())?h.cursor=t.nextSibling:(h.parents.push(t),h.cursor=t.firstChild),t):(_e&&t&&Ne(`<${e}>`,t),null)}function Zr(e){Ae();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(h.cursor=t.nextSibling,t):(_e&&t&&Ne(`<${e}> (static)`,t),null)}function Qr(e){if(e===""){let n=h.cursor;return n&&n.nodeType===3&&n.data!==""?(h.cursor=n.nextSibling,n.data="",n):null}Ae();let t=h.cursor;return t&&t.nodeType===3?(h.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(_e&&t&&Ne(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function eo(e){Ae();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(_e&&t&&Ne(`marker <!--${e.slice(0,24)}-->`,t),null)}var Cn=!1;function to(){Cn||(Cn=!0,jt({hydrateElement:Yr,hydrateText:Qr,hydrateMarker:eo,hydrateStatic:Zr}))}function Qe(e,t,n){to(),h.active=!0,h.cursor=t.firstChild,h.parents=[];let r=Pn(),i=n?.resourceNamespace,s=0;Tt(()=>i?`${i}:r${s++}`:`r${s++}`),Et(r?u=>u in r?{value:r[u]}:void 0:null);try{return be(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[]}}function kn(e){return typeof e=="function"?e:(()=>e)}function D(e){return()=>{let t=e();return typeof t=="function"?t():t}}function On(e){return e!=null&&e!==!1}function Rn(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function et(e){let t=D(()=>e.when),n=m(t,void 0),r=m(n,void 0),i=q(),s=null,u=null,l=o=>{o!==u&&(s&&z(s),s=W(i),u=o)};return m(()=>{let o=r();return l(o?"when":"fallback"),_(s,()=>{if(o){let a=e.children;return typeof a=="function"&&!Rn(a)?typeof n=="function"?k(()=>k(n)?a(n()):e.fallback):a(n):a}return e.fallback});return e.fallback??null},void 0,{name:"show"})}function tt(e){let t=D(()=>e.each),n=()=>e.fallback??null,r=(i,s)=>{let u=e.children,l=Array.isArray(u)?u.map(o=>typeof o=="function"?o(i,s):o):typeof u=="function"?u(i,s):u;return he(l),l};return e.by?ne(t,e.by,(i,s)=>r(i,s),{fallback:n}):te(t,(i,s)=>r(i,s),{fallback:n})}function nt(e){let t=D(()=>e.each);return re(t,(n,r)=>{let i=e.children(n,r);return he(i),i},{fallback:()=>e.fallback??null})}var rt=Symbol("match");function ot(e){return{[rt]:!0,when:D(()=>e.when),get children(){return e.children}}}function it(e){let t=Array.isArray(e.children)?e.children:[e.children],n=q(),r=null,i=-1,s=u=>{u!==i&&(r&&z(r),r=W(n),i=u)};return m(()=>{for(let u=0;u<t.length;u+=1){let o=t[u],a=0;for(;typeof o=="function"&&!o[rt]&&a++<10;)o=o();if(!o||typeof o!="object"||o[rt]!==!0)continue;let p=o.when();if(On(p))return s(u),_(r,()=>typeof o.children=="function"?o.children(p):o.children)}return s(-2),_(r,()=>e.fallback??null)})}function st(e){let t=kn(e.component),{component:n,...r}=e,i=q(),s=null,u;return m(()=>{let l=t();return l!==u&&(s&&z(s),s=W(i),u=l),l==null?null:typeof l=="string"?{tag:l,props:r}:_(s,()=>l(r))})}function ut(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return $(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),K(r,e.children)&&$e(e.ref,r)}),L(()=>{n(),r.remove()}),null}function lt(e){let[t,n]=C(null),r=()=>n(null);return m(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,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}})}function at(e){return m(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;(typeof i=="function"?i():i)&&n.push(r)}return n.join(" ")})}function no(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ct(e){return m(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let s=typeof i=="function"?i():i;s!=null&&n.push(`${no(r)}: ${s}`)}return n.join("; ")})}return $n(ro);})();
|
package/dist/cdn/dom-client.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var G="http://www.w3.org/2000/svg";var D=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function T(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 Le(e,t){Object.assign(e.style,t)}function Oe(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([s,a])=>{if(s==="class"||s==="className")r.className=a;else if(s==="style"&&typeof a=="object")Le(r,a);else if(s.startsWith("on")&&typeof a=="function"){let c=s.slice(2).toLowerCase();r.addEventListener(c,a)}else T(r,s,a)}),n.forEach(s=>{typeof s=="string"?r.appendChild(document.createTextNode(s)):r.appendChild(s)}),r}var Ot=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;import{isSignal as h}from"@fluixi/reactive/signal";var X="1.0.0-alpha.80";import{VERSION as _e}from"@fluixi/reactive/version";var m={dom:X,reactive:_e};function J(e){m.core&&e.setAttribute("fluixi",m.core),e.setAttribute("fx-dom",m.dom),e.setAttribute("fx-reactive",m.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=m)}function Y(){let e=[m.core,m.dom,m.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${m.core??"(absent)"}, dom ${m.dom}, reactive ${m.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 Z(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function N(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as Fe,createEffect as Xt,createRenderEffect as g,createRoot as De,onCleanup as $e,readChildren as Jt}from"@fluixi/reactive/signal";var $=typeof document>"u";var I=Symbol.for("fluixi.server-node"),Q=null;function ee(){if(!Q)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Q}function C(e){return e!=null&&e[I]===!0?!0:typeof Node<"u"&&e instanceof Node}function te(e){return e!=null&&e[I]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function ne(e){return e!=null&&e[I]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},re=null;function oe(e){re=e}function ie(){return re}function j(e,t){return u.active&&t.parentNode===e}function H(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function P(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&H(t)}var Ie={};var V=new Set,fe=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ue(e){if(!$)for(let t of e)V.has(t)||fe.has(t)||(V.add(t),document.addEventListener(t,je))}function je(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 He(e,t,n){if(e[`$$${t}`]=n,fe.has(t)){let r=`__fx_${t}`;if(!e[r]){let s=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,s),e[r]=s}return}V.has(t)||ue([t])}function se(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function E(e,t=!1){if($)return ee().createText(e);if(u.active&&!t){let n=ie()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var b=0,Ve=200;function Ue(e,t,n,r,s){let a=r,c=new Map;return g(()=>{let i;if(N(e)&&!h(e)){if(!c.has(e)){b++;try{let o=e();c.set(e,o)}finally{b--}}for(i=c.get(e);typeof i=="function"&&h(i);)i=i()}else for(i=e();typeof i=="function"&&h(i);)i=i();{let o=0;for(;typeof i=="function"&&o++<50;)if(N(i)){if(!c.has(i)){let l=i;b++;try{let f=l();c.set(l,f)}finally{b--}}i=c.get(i)}else if(h(i))i=i();else if(i=i(),typeof i!="function"||!h(i)&&!N(i))break}b++;try{a=R(t,i,n,a,c),s(a)}finally{b--}})}function v(e,t,n,r){if(b>Ve)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=E("",!0),e.appendChild(n));let s=r??null,a=o=>Array.isArray(o)&&o.some(l=>typeof l=="function"),c=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!a(t)){b++;try{s=R(e,t,n,s)}finally{b--}return()=>s}let i=Ue(c(t),e,n,s,o=>{s=o});return()=>(i?.(),s)}function R(e,t,n,r,s){if(t==null||typeof t=="boolean")return A(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return A(e,r,n);if(M(t)){let c=E("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(c,r[0]),A(e,r.slice(1),n)):y(e,c,n):r?e.replaceChild(c,r):y(e,c,n),t.then(i=>{c.parentNode===e&&R(e,i,c.nextSibling,c)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),c}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let i=E(t);return y(e,i,n),i}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=A(e,r,n)}if(r&&ne(r))return r.data=t,r;let c=E(t);return r&&r.parentNode===e?e.replaceChild(c,r):j(e,c)||y(e,c,n),c}if(C(t))return j(e,t)?(H(t),t):Array.isArray(r)?(r.length===0?y(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),A(e,r.slice(1),n)):y(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):y(e,t,n)):y(e,t,n),t);if(Array.isArray(t)){let c=[],i=Array.isArray(r)?r:r?[r]:[],o=[];x(t,c,e,n,!0,s,o);let l=We(e,i,c,n);for(let f of o){let d=v(e,f.sig,f.marker);$e(()=>{A(e,d()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let c=t;if("type"in c&&"props"in c){let i=c;if(typeof i.type=="function"){let o=i.type(i.props||{});return R(e,o,n,r)}}}return A(e,r,n)}function x(e,t,n,r,s=!0,a,c){for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!M(o)&&!h(o)&&!N(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let l;for(N(o)&&!h(o)?(a||(a=new Map),a.has(o)||a.set(o,o()),l=a.get(o)):l=o();typeof l=="function"&&!M(l)&&!h(l)&&!N(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(h(l)){if(c){let d=E("",!0);t.push(d),c.push({marker:d,sig:l});continue}let f=l();for(;typeof f=="function"&&h(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?x(f,t,n,r,s,a):x([f],t,n,r,s,a);continue}continue}Array.isArray(l)?x(l,t,n,r,s,a,c):x([l],t,n,r,s,a,c);continue}if(M(o)){let l=E("",!0);t.push(l),o.then(f=>{if(l.parentNode){let d=[];if(x([f],d,l.parentNode,void 0,!1,a),d.length>0){l.parentNode.replaceChild(d[0],l);for(let p=1;p<d.length;p++)l.parentNode?.insertBefore(d[p],d[p-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(o)){x(o,t,n,r,s,a,c);continue}if(C(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let l=o;if(typeof l.type=="function"){let f=l.type(l.props||{});Array.isArray(f)?x(f,t,n,r,!1,a):x([f],t,n,r,!1,a);continue}}if(typeof o=="string"||typeof o=="number"){let l=String(o);if(l.trim()===""&&l!==" ")continue;t.push(E(l));continue}t.push(E(String(o)))}}}}function We(e,t,n,r){for(let d=0;d<n.length;d++){let p=n[d].parentNode;p!==null&&p!==e&&p.nodeType!==11&&(n=n.slice(),n[d]=n[d].cloneNode(!0))}let s=n.length,a=t.length,c=s,i=0,o=0,l=a>0?t[a-1].nextSibling??void 0:r,f=null;for(;i<a||o<c;){if(t[i]===n[o]){i++,o++;continue}for(;a>i&&c>o&&t[a-1]===n[c-1];)a--,c--;if(a===i){let d=c<s?o?n[o-1].nextSibling??void 0:n[c-o]:l;for(;o<c;)y(e,n[o++],d)}else if(c===o)for(;i<a;)(!f||!f.has(t[i]))&&t[i].parentNode===e&&e.removeChild(t[i]),i++;else if(t[i]===n[c-1]&&n[o]===t[a-1]){let d=t[--a].nextSibling;y(e,n[o++],t[i++].nextSibling),y(e,n[--c],d),t[a]=t[i-1]}else{if(!f){f=new Map;let p=o;for(;p<c;)f.set(n[p],p++)}let d=f.get(t[i]);if(d!=null)if(o<d&&d<c){let p=i,F=1;for(;++p<a&&p<c&&!(!f.has(t[p])||f.get(t[p])!==d+F);)F++;if(F>d-o){let ke=t[i];for(;o<d;)y(e,n[o++],ke)}else t[i].parentNode===e?e.replaceChild(n[o++],t[i++]):(y(e,n[o++],l),i++)}else i++;else t[i].parentNode===e&&e.removeChild(t[i]),i++}}return n}function A(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 y(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function S(e,t,n){n==null?delete e[t]:e[t]=n}function Ke(e,t,n){let r=n,s;return Array.isArray(n)&&(r=n[0],s=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,s),()=>e.removeEventListener(t,r,s))}function Be(e,t){let n=(r,s)=>{typeof r=="function"&&r(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 r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function ae(e,t,n,r=!1){return typeof n!="function"?(T(e,t,n,r),()=>{}):g(()=>{let s=typeof n=="function"?n():n;T(e,t,s,r)})}function ce(e,t,n){return typeof n!="function"?(S(e,t,n),()=>{}):g(()=>{let r=typeof n=="function"?n():n;S(e,t,r)})}function ze(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):g(()=>{let r=n();T(e,t,!!r)})}function k(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){g(()=>k(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let s=t[r];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function le(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let s=t[r],a=r.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push(g(()=>{let c=!!s();for(let i of a)e.classList.toggle(i,c)}));else{let c=!!(typeof s=="function"?s():s);for(let i of a)e.classList.toggle(i,c)}}}function U(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 s=n[r];s==null?e.style[r]="":e.style[r]=s}}function qe(e){let{element:t,props:n,prevProps:r=Ie,isSVG:s=!1,skipChildren:a=!1}=e;if(!t||!te(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=s||t.namespaceURI===G,i=[];for(let o in n){if(a&&o==="children")continue;let l=n[o],f=r[o];if(l===f)continue;if(o==="ref"){W(l,t);continue}if(o==="use"){Be(t,l);continue}if(o.startsWith("on:")){i.push(Ke(t,o.slice(3),l));continue}if(o.startsWith("prop:")){i.push(ce(t,o.slice(5),l));continue}if(o.startsWith("attr:")){i.push(ae(t,o.slice(5),l,c));continue}if(o.startsWith("bool:")){i.push(ze(t,o.slice(5),l));continue}if(o==="class"||o==="className"){typeof l=="function"?i.push(g(()=>k(t,l()))):k(t,l);continue}if(o==="classList"){typeof l=="function"?i.push(g(()=>le(t,l()))):le(t,l,i);continue}if(o==="style"){typeof l=="function"?i.push(g(()=>U(t,l()))):U(t,l);continue}if(o.startsWith("on")){let p=o.slice(2).toLowerCase();f&&se(t,p),l&&He(t,p,l);continue}let d=D.has(o)||!c&&o in t;typeof l=="function"?i.push(d?ce(t,o,l):ae(t,o,l,c)):i.push(g(()=>d?S(t,o,n[o]):T(t,o,n[o],c)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let l=o.slice(2).toLowerCase();se(t,l)}else D.has(o)?S(t,o,null):t.removeAttribute(o);return()=>{i.forEach(o=>o())}}function W(e,t){if(e){if(C(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 M(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function K(e,t,n){if(!t)throw new Error("Container element is required");let r,s,a=[];return De(c=>{Fe(()=>{u.active||(t.textContent=""),J(t),Y(),v(t,e)}),s=c}),()=>{s?.(),r?.(),a.forEach(c=>c()),t.textContent=""}}import{untrack as Ge,isSignal as Xe}from"@fluixi/reactive";var Je="__fx_dom_create_component__",de=globalThis[Je]??={fn:null};function Ye(e,t){if(de.fn)return de.fn(e,t);let n=typeof e=="function"?Ge(()=>e(t)):e;if(n!=null&&(typeof n=="function"||typeof n=="object")&&!Xe(n)){try{n.$name=e?.name}catch{}return Z(n)}return n}import{setResourceIdSource as Qe,setServerDataGetter as et}from"@fluixi/reactive/signal";var Ze="__FX_DATA__";var B;function pe(){let e=globalThis.__FX_DATA__;if(e)return e;if(B!==void 0)return B;let t=null;if(typeof document<"u"){let n=document.getElementById(Ze)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return B=t}function L(){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 tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),O=typeof process<"u"&&process.env&&!1;function _(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 nt(e){L();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(tt.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(O&&t&&_(`<${e}>`,t),null)}function rt(e){L();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(u.cursor=t.nextSibling,t):(O&&t&&_(`<${e}> (static)`,t),null)}function ot(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}L();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(O&&t&&_(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function it(e){L();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(O&&t&&_(`marker <!--${e.slice(0,24)}-->`,t),null)}var ye=!1;function st(){ye||(ye=!0,oe({hydrateElement:nt,hydrateText:ot,hydrateMarker:it,hydrateStatic:rt}))}function me(e,t,n){st(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=pe(),s=n?.resourceNamespace,a=0;Qe(()=>s?`${s}:r${a++}`:`r${a++}`),et(r?c=>c in r?{value:r[c]}:void 0:null);try{return K(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}import{createChildOwner as at,createMemo as z,disposeScope as ct,getOwner as lt,runWithOwner as ft,untrack as be}from"@fluixi/reactive/signal";function he(e){return typeof e=="function"?e:(()=>e)}function w(e){return()=>{let t=e();return typeof t=="function"?t():t}}function ge(e){return e!=null&&e!==!1}function xe(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function Te(e){let t=w(()=>e.when),n=z(t,void 0),r=z(n,void 0),s=lt(),a=null,c=null,i=o=>{o!==c&&(a&&ct(a),a=at(s),c=o)};return z(()=>{let o=r();return i(o?"when":"fallback"),ft(a,()=>{if(o){let l=e.children;return typeof l=="function"&&!xe(l)?typeof n=="function"?be(()=>be(n)?l(n()):e.fallback):l(n):l}return e.fallback});return e.fallback??null},void 0,{name:"show"})}import{mapArray as ut,keyArray as dt}from"@fluixi/reactive/signal";function Ee(e){let t=w(()=>e.each),n=()=>e.fallback??null,r=(s,a)=>{let c=e.children,i=Array.isArray(c)?c.map(o=>typeof o=="function"?o(s,a):o):typeof c=="function"?c(s,a):c;return P(i),i};return e.by?dt(t,e.by,(s,a)=>r(s,a),{fallback:n}):ut(t,(s,a)=>r(s,a),{fallback:n})}import{indexArray as pt}from"@fluixi/reactive/signal";function we(e){let t=w(()=>e.each);return pt(t,(n,r)=>{let s=e.children(n,r);return P(s),s},{fallback:()=>e.fallback??null})}import{mapArray as Rt,keyArray as kt,indexArray as Lt}from"@fluixi/reactive/signal";import{createMemo as yt,createChildOwner as mt,disposeScope as ht,getOwner as gt,runWithOwner as Ne}from"@fluixi/reactive/signal";var q=Symbol("match");function Ae(e){return{[q]:!0,when:w(()=>e.when),get children(){return e.children}}}function Se(e){let t=Array.isArray(e.children)?e.children:[e.children],n=gt(),r=null,s=-1,a=c=>{c!==s&&(r&&ht(r),r=mt(n),s=c)};return yt(()=>{for(let c=0;c<t.length;c+=1){let o=t[c],l=0;for(;typeof o=="function"&&!o[q]&&l++<10;)o=o();if(!o||typeof o!="object"||o[q]!==!0)continue;let f=o.when();if(ge(f))return a(c),Ne(r,()=>typeof o.children=="function"?o.children(f):o.children)}return a(-2),Ne(r,()=>e.fallback??null)})}import{createMemo as xt,createChildOwner as bt,disposeScope as Tt,getOwner as Et,runWithOwner as wt}from"@fluixi/reactive/signal";function ve(e){let t=he(e.component),{component:n,...r}=e,s=Et(),a=null,c;return xt(()=>{let i=t();return i!==c&&(a&&Tt(a),a=bt(s),c=i),i==null?null:typeof i=="string"?{tag:i,props:r}:wt(a,()=>i(r))})}import{createRoot as Nt,onCleanup as At}from"@fluixi/reactive/signal";function Ce(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return Nt(s=>{n=s,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),v(r,e.children)&&W(e.ref,r)}),At(()=>{n(),r.remove()}),null}import{createMemo as St,createSignal as vt}from"@fluixi/reactive/signal";function Pe(e){let[t,n]=vt(null),r=()=>n(null);return St(()=>{let s=t();if(s!==null)return typeof e.fallback=="function"?e.fallback(s,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(a){return n(a),typeof e.fallback=="function"?e.fallback(a,r):e.fallback}})}import{createMemo as Ct}from"@fluixi/reactive/signal";function Me(e){return Ct(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,s]of Object.entries(t)){if(!r)continue;(typeof s=="function"?s():s)&&n.push(r)}return n.join(" ")})}import{createMemo as Pt}from"@fluixi/reactive/signal";function Mt(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Re(e){return Pt(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,s]of Object.entries(t)){if(!r)continue;let a=typeof s=="function"?s():s;a!=null&&n.push(`${Mt(r)}: ${a}`)}return n.join("; ")})}import{signal as mr,memo as hr,effect as gr,store as xr,createSignal as br,createMemo as Tr,createEffect as Er,createComputed as wr,createRenderEffect as Nr,createRoot as Ar,createResource as Sr,createContext as vr,useContext as Cr,onCleanup as Pr,batch as Mr,untrack as Rr}from"@fluixi/reactive";export{ve as Dynamic,Pe as ErrorBoundary,Ee as For,we as Index,Ae as Match,Ce as Portal,Te as Show,Se as Switch,Mr as batch,Me as classMap,Ye as createComponent,wr as createComputed,vr as createContext,Er as createEffect,Oe as createElement,Tr as createMemo,Nr as createRenderEffect,Sr as createResource,Ar as createRoot,br as createSignal,ue as delegateEvents,gr as effect,me as hydrate,Lt as indexArray,v as insert,kt as keyArray,Rt as mapArray,hr as memo,Pr as onCleanup,K as render,T as setAttribute,k as setClassName,S as setProperty,U as setStyle,mr as signal,qe as spread,xr as store,Re as styleMap,Rr as untrack,Cr as useContext};
|
|
1
|
+
var G="http://www.w3.org/2000/svg";var D=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function T(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 Le(e,t){Object.assign(e.style,t)}function Oe(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([s,a])=>{if(s==="class"||s==="className")r.className=a;else if(s==="style"&&typeof a=="object")Le(r,a);else if(s.startsWith("on")&&typeof a=="function"){let c=s.slice(2).toLowerCase();r.addEventListener(c,a)}else T(r,s,a)}),n.forEach(s=>{typeof s=="string"?r.appendChild(document.createTextNode(s)):r.appendChild(s)}),r}var Ot=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;import{isSignal as h}from"@fluixi/reactive/signal";var X="1.0.0-alpha.82";import{VERSION as _e}from"@fluixi/reactive/version";var m={dom:X,reactive:_e};function J(e){m.core&&e.setAttribute("fluixi",m.core),e.setAttribute("fx-dom",m.dom),e.setAttribute("fx-reactive",m.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=m)}function Y(){let e=[m.core,m.dom,m.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${m.core??"(absent)"}, dom ${m.dom}, reactive ${m.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 Z(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function N(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as Fe,createEffect as Xt,createRenderEffect as g,createRoot as De,onCleanup as $e,readChildren as Jt}from"@fluixi/reactive/signal";var $=typeof document>"u";var I=Symbol.for("fluixi.server-node"),Q=null;function ee(){if(!Q)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Q}function C(e){return e!=null&&e[I]===!0?!0:typeof Node<"u"&&e instanceof Node}function te(e){return e!=null&&e[I]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function ne(e){return e!=null&&e[I]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},re=null;function oe(e){re=e}function ie(){return re}function j(e,t){return u.active&&t.parentNode===e}function H(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function P(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&H(t)}var Ie={};var V=new Set,fe=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ue(e){if(!$)for(let t of e)V.has(t)||fe.has(t)||(V.add(t),document.addEventListener(t,je))}function je(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 He(e,t,n){if(e[`$$${t}`]=n,fe.has(t)){let r=`__fx_${t}`;if(!e[r]){let s=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,s),e[r]=s}return}V.has(t)||ue([t])}function se(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function E(e,t=!1){if($)return ee().createText(e);if(u.active&&!t){let n=ie()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}var b=0,Ve=200;function Ue(e,t,n,r,s){let a=r,c=new Map;return g(()=>{let i;if(N(e)&&!h(e)){if(!c.has(e)){b++;try{let o=e();c.set(e,o)}finally{b--}}for(i=c.get(e);typeof i=="function"&&h(i);)i=i()}else for(i=e();typeof i=="function"&&h(i);)i=i();{let o=0;for(;typeof i=="function"&&o++<50;)if(N(i)){if(!c.has(i)){let l=i;b++;try{let f=l();c.set(l,f)}finally{b--}}i=c.get(i)}else if(h(i))i=i();else if(i=i(),typeof i!="function"||!h(i)&&!N(i))break}b++;try{a=R(t,i,n,a,c),s(a)}finally{b--}})}function v(e,t,n,r){if(b>Ve)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=E("",!0),e.appendChild(n));let s=r??null,a=o=>Array.isArray(o)&&o.some(l=>typeof l=="function"),c=o=>typeof o=="function"?o:()=>o;if(typeof t!="function"&&!a(t)){b++;try{s=R(e,t,n,s)}finally{b--}return()=>s}let i=Ue(c(t),e,n,s,o=>{s=o});return()=>(i?.(),s)}function R(e,t,n,r,s){if(t==null||typeof t=="boolean")return A(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return A(e,r,n);if(M(t)){let c=E("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(c,r[0]),A(e,r.slice(1),n)):y(e,c,n):r?e.replaceChild(c,r):y(e,c,n),t.then(i=>{c.parentNode===e&&R(e,i,c.nextSibling,c)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),c}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let i=E(t);return y(e,i,n),i}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=A(e,r,n)}if(r&&ne(r))return r.data=t,r;let c=E(t);return r&&r.parentNode===e?e.replaceChild(c,r):j(e,c)||y(e,c,n),c}if(C(t))return j(e,t)?(H(t),t):Array.isArray(r)?(r.length===0?y(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),A(e,r.slice(1),n)):y(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):y(e,t,n)):y(e,t,n),t);if(Array.isArray(t)){let c=[],i=Array.isArray(r)?r:r?[r]:[],o=[];x(t,c,e,n,!0,s,o);let l=We(e,i,c,n);for(let f of o){let d=v(e,f.sig,f.marker);$e(()=>{A(e,d()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let c=t;if("type"in c&&"props"in c){let i=c;if(typeof i.type=="function"){let o=i.type(i.props||{});return R(e,o,n,r)}}}return A(e,r,n)}function x(e,t,n,r,s=!0,a,c){for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!M(o)&&!h(o)&&!N(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let l;for(N(o)&&!h(o)?(a||(a=new Map),a.has(o)||a.set(o,o()),l=a.get(o)):l=o();typeof l=="function"&&!M(l)&&!h(l)&&!N(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(h(l)){if(c){let d=E("",!0);t.push(d),c.push({marker:d,sig:l});continue}let f=l();for(;typeof f=="function"&&h(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?x(f,t,n,r,s,a):x([f],t,n,r,s,a);continue}continue}Array.isArray(l)?x(l,t,n,r,s,a,c):x([l],t,n,r,s,a,c);continue}if(M(o)){let l=E("",!0);t.push(l),o.then(f=>{if(l.parentNode){let d=[];if(x([f],d,l.parentNode,void 0,!1,a),d.length>0){l.parentNode.replaceChild(d[0],l);for(let p=1;p<d.length;p++)l.parentNode?.insertBefore(d[p],d[p-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(o)){x(o,t,n,r,s,a,c);continue}if(C(o)){t.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let l=o;if(typeof l.type=="function"){let f=l.type(l.props||{});Array.isArray(f)?x(f,t,n,r,!1,a):x([f],t,n,r,!1,a);continue}}if(typeof o=="string"||typeof o=="number"){let l=String(o);if(l.trim()===""&&l!==" ")continue;t.push(E(l));continue}t.push(E(String(o)))}}}}function We(e,t,n,r){for(let d=0;d<n.length;d++){let p=n[d].parentNode;p!==null&&p!==e&&p.nodeType!==11&&(n=n.slice(),n[d]=n[d].cloneNode(!0))}let s=n.length,a=t.length,c=s,i=0,o=0,l=a>0?t[a-1].nextSibling??void 0:r,f=null;for(;i<a||o<c;){if(t[i]===n[o]){i++,o++;continue}for(;a>i&&c>o&&t[a-1]===n[c-1];)a--,c--;if(a===i){let d=c<s?o?n[o-1].nextSibling??void 0:n[c-o]:l;for(;o<c;)y(e,n[o++],d)}else if(c===o)for(;i<a;)(!f||!f.has(t[i]))&&t[i].parentNode===e&&e.removeChild(t[i]),i++;else if(t[i]===n[c-1]&&n[o]===t[a-1]){let d=t[--a].nextSibling;y(e,n[o++],t[i++].nextSibling),y(e,n[--c],d),t[a]=t[i-1]}else{if(!f){f=new Map;let p=o;for(;p<c;)f.set(n[p],p++)}let d=f.get(t[i]);if(d!=null)if(o<d&&d<c){let p=i,F=1;for(;++p<a&&p<c&&!(!f.has(t[p])||f.get(t[p])!==d+F);)F++;if(F>d-o){let ke=t[i];for(;o<d;)y(e,n[o++],ke)}else t[i].parentNode===e?e.replaceChild(n[o++],t[i++]):(y(e,n[o++],l),i++)}else i++;else t[i].parentNode===e&&e.removeChild(t[i]),i++}}return n}function A(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 y(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function S(e,t,n){n==null?delete e[t]:e[t]=n}function Ke(e,t,n){let r=n,s;return Array.isArray(n)&&(r=n[0],s=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,s),()=>e.removeEventListener(t,r,s))}function Be(e,t){let n=(r,s)=>{typeof r=="function"&&r(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 r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function ae(e,t,n,r=!1){return typeof n!="function"?(T(e,t,n,r),()=>{}):g(()=>{let s=typeof n=="function"?n():n;T(e,t,s,r)})}function ce(e,t,n){return typeof n!="function"?(S(e,t,n),()=>{}):g(()=>{let r=typeof n=="function"?n():n;S(e,t,r)})}function ze(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):g(()=>{let r=n();T(e,t,!!r)})}function k(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){g(()=>k(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let s=t[r];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function le(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let s=t[r],a=r.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push(g(()=>{let c=!!s();for(let i of a)e.classList.toggle(i,c)}));else{let c=!!(typeof s=="function"?s():s);for(let i of a)e.classList.toggle(i,c)}}}function U(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 s=n[r];s==null?e.style[r]="":e.style[r]=s}}function qe(e){let{element:t,props:n,prevProps:r=Ie,isSVG:s=!1,skipChildren:a=!1}=e;if(!t||!te(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=s||t.namespaceURI===G,i=[];for(let o in n){if(a&&o==="children")continue;let l=n[o],f=r[o];if(l===f)continue;if(o==="ref"){W(l,t);continue}if(o==="use"){Be(t,l);continue}if(o.startsWith("on:")){i.push(Ke(t,o.slice(3),l));continue}if(o.startsWith("prop:")){i.push(ce(t,o.slice(5),l));continue}if(o.startsWith("attr:")){i.push(ae(t,o.slice(5),l,c));continue}if(o.startsWith("bool:")){i.push(ze(t,o.slice(5),l));continue}if(o==="class"||o==="className"){typeof l=="function"?i.push(g(()=>k(t,l()))):k(t,l);continue}if(o==="classList"){typeof l=="function"?i.push(g(()=>le(t,l()))):le(t,l,i);continue}if(o==="style"){typeof l=="function"?i.push(g(()=>U(t,l()))):U(t,l);continue}if(o.startsWith("on")){let p=o.slice(2).toLowerCase();f&&se(t,p),l&&He(t,p,l);continue}let d=D.has(o)||!c&&o in t;typeof l=="function"?i.push(d?ce(t,o,l):ae(t,o,l,c)):i.push(g(()=>d?S(t,o,n[o]):T(t,o,n[o],c)))}for(let o in r)if(!(o in n))if(o.startsWith("on")){let l=o.slice(2).toLowerCase();se(t,l)}else D.has(o)?S(t,o,null):t.removeAttribute(o);return()=>{i.forEach(o=>o())}}function W(e,t){if(e){if(C(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 M(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function K(e,t,n){if(!t)throw new Error("Container element is required");let r,s,a=[];return De(c=>{Fe(()=>{u.active||(t.textContent=""),J(t),Y(),v(t,e)}),s=c}),()=>{s?.(),r?.(),a.forEach(c=>c()),t.textContent=""}}import{untrack as Ge,isSignal as Xe}from"@fluixi/reactive";var Je="__fx_dom_create_component__",de=globalThis[Je]??={fn:null};function Ye(e,t){if(de.fn)return de.fn(e,t);let n=typeof e=="function"?Ge(()=>e(t)):e;if(n!=null&&(typeof n=="function"||typeof n=="object")&&!Xe(n)){try{n.$name=e?.name}catch{}return Z(n)}return n}import{setResourceIdSource as Qe,setServerDataGetter as et}from"@fluixi/reactive/signal";var Ze="__FX_DATA__";var B;function pe(){let e=globalThis.__FX_DATA__;if(e)return e;if(B!==void 0)return B;let t=null;if(typeof document<"u"){let n=document.getElementById(Ze)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return B=t}function L(){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 tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),O=typeof process<"u"&&process.env&&!1;function _(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 nt(e){L();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(tt.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(O&&t&&_(`<${e}>`,t),null)}function rt(e){L();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(u.cursor=t.nextSibling,t):(O&&t&&_(`<${e}> (static)`,t),null)}function ot(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}L();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(O&&t&&_(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function it(e){L();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(O&&t&&_(`marker <!--${e.slice(0,24)}-->`,t),null)}var ye=!1;function st(){ye||(ye=!0,oe({hydrateElement:nt,hydrateText:ot,hydrateMarker:it,hydrateStatic:rt}))}function me(e,t,n){st(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=pe(),s=n?.resourceNamespace,a=0;Qe(()=>s?`${s}:r${a++}`:`r${a++}`),et(r?c=>c in r?{value:r[c]}:void 0:null);try{return K(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}import{createChildOwner as at,createMemo as z,disposeScope as ct,getOwner as lt,runWithOwner as ft,untrack as be}from"@fluixi/reactive/signal";function he(e){return typeof e=="function"?e:(()=>e)}function w(e){return()=>{let t=e();return typeof t=="function"?t():t}}function ge(e){return e!=null&&e!==!1}function xe(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function Te(e){let t=w(()=>e.when),n=z(t,void 0),r=z(n,void 0),s=lt(),a=null,c=null,i=o=>{o!==c&&(a&&ct(a),a=at(s),c=o)};return z(()=>{let o=r();return i(o?"when":"fallback"),ft(a,()=>{if(o){let l=e.children;return typeof l=="function"&&!xe(l)?typeof n=="function"?be(()=>be(n)?l(n()):e.fallback):l(n):l}return e.fallback});return e.fallback??null},void 0,{name:"show"})}import{mapArray as ut,keyArray as dt}from"@fluixi/reactive/signal";function Ee(e){let t=w(()=>e.each),n=()=>e.fallback??null,r=(s,a)=>{let c=e.children,i=Array.isArray(c)?c.map(o=>typeof o=="function"?o(s,a):o):typeof c=="function"?c(s,a):c;return P(i),i};return e.by?dt(t,e.by,(s,a)=>r(s,a),{fallback:n}):ut(t,(s,a)=>r(s,a),{fallback:n})}import{indexArray as pt}from"@fluixi/reactive/signal";function we(e){let t=w(()=>e.each);return pt(t,(n,r)=>{let s=e.children(n,r);return P(s),s},{fallback:()=>e.fallback??null})}import{mapArray as Rt,keyArray as kt,indexArray as Lt}from"@fluixi/reactive/signal";import{createMemo as yt,createChildOwner as mt,disposeScope as ht,getOwner as gt,runWithOwner as Ne}from"@fluixi/reactive/signal";var q=Symbol("match");function Ae(e){return{[q]:!0,when:w(()=>e.when),get children(){return e.children}}}function Se(e){let t=Array.isArray(e.children)?e.children:[e.children],n=gt(),r=null,s=-1,a=c=>{c!==s&&(r&&ht(r),r=mt(n),s=c)};return yt(()=>{for(let c=0;c<t.length;c+=1){let o=t[c],l=0;for(;typeof o=="function"&&!o[q]&&l++<10;)o=o();if(!o||typeof o!="object"||o[q]!==!0)continue;let f=o.when();if(ge(f))return a(c),Ne(r,()=>typeof o.children=="function"?o.children(f):o.children)}return a(-2),Ne(r,()=>e.fallback??null)})}import{createMemo as xt,createChildOwner as bt,disposeScope as Tt,getOwner as Et,runWithOwner as wt}from"@fluixi/reactive/signal";function ve(e){let t=he(e.component),{component:n,...r}=e,s=Et(),a=null,c;return xt(()=>{let i=t();return i!==c&&(a&&Tt(a),a=bt(s),c=i),i==null?null:typeof i=="string"?{tag:i,props:r}:wt(a,()=>i(r))})}import{createRoot as Nt,onCleanup as At}from"@fluixi/reactive/signal";function Ce(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return Nt(s=>{n=s,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),v(r,e.children)&&W(e.ref,r)}),At(()=>{n(),r.remove()}),null}import{createMemo as St,createSignal as vt}from"@fluixi/reactive/signal";function Pe(e){let[t,n]=vt(null),r=()=>n(null);return St(()=>{let s=t();if(s!==null)return typeof e.fallback=="function"?e.fallback(s,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(a){return n(a),typeof e.fallback=="function"?e.fallback(a,r):e.fallback}})}import{createMemo as Ct}from"@fluixi/reactive/signal";function Me(e){return Ct(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,s]of Object.entries(t)){if(!r)continue;(typeof s=="function"?s():s)&&n.push(r)}return n.join(" ")})}import{createMemo as Pt}from"@fluixi/reactive/signal";function Mt(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Re(e){return Pt(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,s]of Object.entries(t)){if(!r)continue;let a=typeof s=="function"?s():s;a!=null&&n.push(`${Mt(r)}: ${a}`)}return n.join("; ")})}import{signal as mr,memo as hr,effect as gr,store as xr,createSignal as br,createMemo as Tr,createEffect as Er,createComputed as wr,createRenderEffect as Nr,createRoot as Ar,createResource as Sr,createContext as vr,useContext as Cr,onCleanup as Pr,batch as Mr,untrack as Rr}from"@fluixi/reactive";export{ve as Dynamic,Pe as ErrorBoundary,Ee as For,we as Index,Ae as Match,Ce as Portal,Te as Show,Se as Switch,Mr as batch,Me as classMap,Ye as createComponent,wr as createComputed,vr as createContext,Er as createEffect,Oe as createElement,Tr as createMemo,Nr as createRenderEffect,Sr as createResource,Ar as createRoot,br as createSignal,ue as delegateEvents,gr as effect,me as hydrate,Lt as indexArray,v as insert,kt as keyArray,Rt as mapArray,hr as memo,Pr as onCleanup,K as render,T as setAttribute,k as setClassName,S as setProperty,U as setStyle,mr as signal,qe as spread,xr as store,Re as styleMap,Rr as untrack,Cr as useContext};
|