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