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