import{Signal as t}from"@preact/signals-core";import{useSignal}from"@preact/signals-react";import{useSignals as n}from"@preact/signals-react/runtime";import{createElement as r,useMemo as e,Fragment as o}from"react";const c=t=>{n();return"function"==typeof t.children?t.children(t.v,t.i):t.children};c.displayName="Item";function i(t){n();const e="function"==typeof t.when?t.when():t.when.value;if(!e)return t.fallback||null;else return r(c,{v:e,children:t.children})}i.displayName="Show";function u(i){n();const u=e(()=>new Map,[]),f="function"==typeof i.each?i.each():i.each,s=f instanceof t?f.value:f;if(!s.length)return i.fallback||null;const a=new Set(u.keys()),l=s.map((t,n)=>{a.delete(t);if(!u.has(t)){const e=i.getKey?i.getKey(t,n):n,o=r(c,{v:t,key:e,i:n,children:i.children});u.set(t,o);return o}return u.get(t)});a.forEach(t=>{u.delete(t)});return r(o,{children:l})}u.displayName="For";function f(t){const n=useSignal(t);if(n.peek()!==t)n.value=t;return n}function s(t){const n=useSignal(t);if(!("current"in n))Object.defineProperty(n,"current",a);return n}const a={configurable:!0,get(){return this.value},set(t){this.value=t}};export{u as For,i as Show,f as useLiveSignal,s as useSignalRef};//# sourceMappingURL=utils.mjs.map
