import{Signal as n,signal as t,computed as r,effect as e}from"@preact/signals-core";import{version as i,useRef as u,useMemo as o,useEffect as f,useState as c,useLayoutEffect as a}from"react";import{useSyncExternalStore as s}from"use-sync-external-store/shim/index.js";var l=i.split(".").map(Number)[0],v=[],d=Symbol.for(l>=19?"react.transitional.element":"react.element"),m="undefined"!=typeof window&&!!window.__PREACT_SIGNALS_DEVTOOLS__;function p(t){if("function"!=typeof t)return t;else return function(r,e){if("string"==typeof r&&e)for(var i in e){var u=e[i];if("children"!==i&&u instanceof n)e[i]=u.value}return t.call.apply(t,[t,r,e].concat([].slice.call(arguments,2)))}}var b,y=Symbol.dispose||Symbol.for("Symbol.dispose");function g(n,t){var r=t.effect.S();b=t;return h.bind(t,n,r)}function h(n,t){t();b=n}var w,_,S=function(){},x=((w={u:0,effect:{s:void 0,c:function(){},S:function(){return S},d:function(){}},subscribe:function(){return S},getSnapshot:function(){return 0},S:function(){},f:function(){}})[y]=function(){},w),j=Promise.prototype.then.bind(Promise.resolve());function P(){if(!_)_=j($)}function $(){var n;_=void 0;null==(n=b)||n.f()}var k="undefined"!=typeof window?a:f;function C(n,t){if(void 0===n)n=0;P();var r=u();if(null==r.current)if("undefined"==typeof window)r.current=x;else r.current=function(n,t){var r,i,u,o,f=0,c=e(function(){i=this},{name:t||"Component"});i.c=function(){f=f+1|0;if(m){var n;null==(n=i.y)||n.call(i)}if(o)o()};return(r={u:n,effect:i,subscribe:function(n){o=n;return function(){f=f+1|0;o=void 0;c()}},getSnapshot:function(){return f},S:function(){if(null!=b){var n=b.u,t=this.u;if(0==n&&0==t||0==n&&1==t){b.f();u=g(void 0,this)}else if(1==n&&0==t||2==n&&0==t);else u=g(b,this)}else u=g(void 0,this)},f:function(){var n=u;u=void 0;null==n||n()}})[y]=function(){this.f()},r}(n,t);var i=r.current;s(i.subscribe,i.getSnapshot,i.getSnapshot);i.S();if(0===n)k($);return i}Object.defineProperties(n.prototype,{$$typeof:{configurable:!0,value:d},type:{configurable:!0,value:function(n){var t=n.data,r=C(1);try{return t.value}finally{r.f()}}},props:{configurable:!0,get:function(){var n=this;return{data:{get value(){return n.value}}}}},ref:{configurable:!0,value:null}});function N(n,t){return C(n,t)}function useSignal(n,r){return o(function(){return t(n,r)},v)}function useComputed(n,t){var e=u(n);e.current=n;return o(function(){return r(function(){return e.current()},t)},v)}function useSignalEffect(n,t){var r=u(n);r.current=n;f(function(){return e(function(){return r.current()},t)},v)}function O(n){var t=c(function(){return n()})[0];f(function(){return t[Symbol.dispose]},[t]);return t}export{C as _useSignalsImplementation,P as ensureFinalCleanup,useComputed,O as useModel,useSignal,useSignalEffect,N as useSignals,p as wrapJsx};//# sourceMappingURL=runtime.module.js.map
