@preact/signals-devtools-ui 0.2.0 → 0.4.0

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.
@@ -1 +1 @@
1
- function n(n,i){(null==i||i>n.length)&&(i=n.length);for(var t=0,e=Array(i);t<i;t++)e[t]=n[t];return e}function i(i,t){var e="undefined"!=typeof Symbol&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=function(i,t){if(i){if("string"==typeof i)return n(i,t);var e={}.toString.call(i).slice(8,-1);return"Object"===e&&i.constructor&&(e=i.constructor.name),"Map"===e||"Set"===e?Array.from(i):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(i,t):void 0}}(i))||t&&i&&"number"==typeof i.length){e&&(i=e);var r=0;return function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(){return t=Object.assign?Object.assign.bind():function(n){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var e in t)({}).hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n},t.apply(null,arguments)}var e,r,o,u,a,l,c,s,f,d,h,v,p={},g=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function b(n,i){for(var t in i)n[t]=i[t];return n}function w(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function N(n,i,t,e,u){var a={type:n,props:i,key:t,ref:e,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==u?++o:u,__i:-1,__u:0};return null==u&&null!=r.vnode&&r.vnode(a),a}function k(n){return n.children}function _(n,i){this.props=n,this.context=i}function x(n,i){if(null==i)return n.__?x(n.__,n.__i+1):null;for(var t;i<n.__k.length;i++)if(null!=(t=n.__k[i])&&null!=t.__e)return t.__e;return"function"==typeof n.type?x(n):null}function C(n){var i,t;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,i=0;i<n.__k.length;i++)if(null!=(t=n.__k[i])&&null!=t.__e){n.__e=n.__c.base=t.__e;break}return C(n)}}function S(n){(!n.__d&&(n.__d=!0)&&a.push(n)&&!M.__r++||l!=r.debounceRendering)&&((l=r.debounceRendering)||c)(M)}function M(){for(var n,i,t,e,o,u,l,c=1;a.length;)a.length>c&&a.sort(s),n=a.shift(),c=a.length,n.__d&&(t=void 0,e=void 0,o=(e=(i=n).__v).__e,u=[],l=[],i.__P&&((t=b({},e)).__v=e.__v+1,r.vnode&&r.vnode(t),I(i.__P,t,e,i.__n,i.__P.namespaceURI,32&e.__u?[o]:null,u,null==o?x(e):o,!!(32&e.__u),l),t.__v=e.__v,t.__.__k[t.__i]=t,j(u,t,l),e.__e=e.__=null,t.__e!=o&&C(t)));M.__r=0}function A(n,i,t,e,r,o,u,a,l,c,s){var f,d,h,v,m,b,w,_=e&&e.__k||g,C=i.length;for(l=function(n,i,t,e,r){var o,u,a,l,c,s=t.length,f=s,d=0;for(n.__k=new Array(r),o=0;o<r;o++)null!=(u=i[o])&&"boolean"!=typeof u&&"function"!=typeof u?(l=o+d,(u=n.__k[o]="string"==typeof u||"number"==typeof u||"bigint"==typeof u||u.constructor==String?N(null,u,null,null,null):y(u)?N(k,{children:u},null,null,null):null==u.constructor&&u.__b>0?N(u.type,u.props,u.key,u.ref?u.ref:null,u.__v):u).__=n,u.__b=n.__b+1,a=null,-1!=(c=u.__i=U(u,t,l,f))&&(f--,(a=t[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(r>s?d--:r<s&&d++),"function"!=typeof u.type&&(u.__u|=4)):c!=l&&(c==l-1?d--:c==l+1?d++:(c>l?d--:d++,u.__u|=4))):n.__k[o]=null;if(f)for(o=0;o<s;o++)null!=(a=t[o])&&0==(2&a.__u)&&(a.__e==e&&(e=x(a)),$(a,a));return e}(t,i,_,l,C),f=0;f<C;f++)null!=(h=t.__k[f])&&(d=-1==h.__i?p:_[h.__i]||p,h.__i=f,b=I(n,h,d,r,o,u,a,l,c,s),v=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&R(d.ref,null,h),s.push(h.ref,h.__c||v,h)),null==m&&null!=v&&(m=v),(w=!!(4&h.__u))||d.__k===h.__k?l=P(h,l,n,w):"function"==typeof h.type&&void 0!==b?l=b:v&&(l=v.nextSibling),h.__u&=-7);return t.__e=m,l}function P(n,i,t,e){var r,o;if("function"==typeof n.type){for(r=n.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=n,i=P(r[o],i,t,e));return i}n.__e!=i&&(e&&(i&&n.type&&!i.parentNode&&(i=x(n)),t.insertBefore(n.__e,i||null)),i=n.__e);do{i=i&&i.nextSibling}while(null!=i&&8==i.nodeType);return i}function U(n,i,t,e){var r,o,u,a=n.key,l=n.type,c=i[t],s=null!=c&&0==(2&c.__u);if(null===c&&null==n.key||s&&a==c.key&&l==c.type)return t;if(e>(s?1:0))for(r=t-1,o=t+1;r>=0||o<i.length;)if(null!=(c=i[u=r>=0?r--:o++])&&0==(2&c.__u)&&a==c.key&&l==c.type)return u;return-1}function T(n,i,t){"-"==i[0]?n.setProperty(i,null==t?"":t):n[i]=null==t?"":"number"!=typeof t||m.test(i)?t:t+"px"}function D(n,i,t,e,r){var o,u;n:if("style"==i)if("string"==typeof t)n.style.cssText=t;else{if("string"==typeof e&&(n.style.cssText=e=""),e)for(i in e)t&&i in t||T(n.style,i,"");if(t)for(i in t)e&&t[i]==e[i]||T(n.style,i,t[i])}else if("o"==i[0]&&"n"==i[1])o=i!=(i=i.replace(f,"$1")),u=i.toLowerCase(),i=u in n||"onFocusOut"==i||"onFocusIn"==i?u.slice(2):i.slice(2),n.l||(n.l={}),n.l[i+o]=t,t?e?t.u=e.u:(t.u=d,n.addEventListener(i,o?v:h,o)):n.removeEventListener(i,o?v:h,o);else{if("http://www.w3.org/2000/svg"==r)i=i.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=i&&"height"!=i&&"href"!=i&&"list"!=i&&"form"!=i&&"tabIndex"!=i&&"download"!=i&&"rowSpan"!=i&&"colSpan"!=i&&"role"!=i&&"popover"!=i&&i in n)try{n[i]=null==t?"":t;break n}catch(n){}"function"==typeof t||(null==t||!1===t&&"-"!=i[4]?n.removeAttribute(i):n.setAttribute(i,"popover"==i&&1==t?"":t))}}function E(n){return function(i){if(this.l){var t=this.l[i.type+n];if(null==i.t)i.t=d++;else if(i.t<t.u)return;return t(r.event?r.event(i):i)}}}function I(n,i,t,e,o,u,a,l,c,s){var f,d,h,v,p,g,m,N,x,C,S,M,P,U,T,D,E,I=i.type;if(null!=i.constructor)return null;128&t.__u&&(c=!!(32&t.__u),u=[l=i.__e=t.__e]),(f=r.__b)&&f(i);n:if("function"==typeof I)try{if(N=i.props,x="prototype"in I&&I.prototype.render,C=(f=I.contextType)&&e[f.__c],S=f?C?C.props.value:f.__:e,t.__c?m=(d=i.__c=t.__c).__=d.__E:(x?i.__c=d=new I(N,S):(i.__c=d=new _(N,S),d.constructor=I,d.render=q),C&&C.sub(d),d.props=N,d.state||(d.state={}),d.context=S,d.__n=e,h=d.__d=!0,d.__h=[],d.m=[]),x&&null==d.__s&&(d.__s=d.state),x&&null!=I.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=b({},d.__s)),b(d.__s,I.getDerivedStateFromProps(N,d.__s))),v=d.props,p=d.state,d.__v=i,h)x&&null==I.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),x&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(x&&null==I.getDerivedStateFromProps&&N!==v&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(N,S),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(N,d.__s,S)||i.__v==t.__v){for(i.__v!=t.__v&&(d.props=N,d.state=d.__s,d.__d=!1),i.__e=t.__e,i.__k=t.__k,i.__k.some(function(n){n&&(n.__=i)}),M=0;M<d.m.length;M++)d.__h.push(d.m[M]);d.m=[],d.__h.length&&a.push(d);break n}null!=d.componentWillUpdate&&d.componentWillUpdate(N,d.__s,S),x&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(v,p,g)})}if(d.context=S,d.props=N,d.__P=n,d.__e=!1,P=r.__r,U=0,x){for(d.state=d.__s,d.__d=!1,P&&P(i),f=d.render(d.props,d.state,d.context),T=0;T<d.m.length;T++)d.__h.push(d.m[T]);d.m=[]}else do{d.__d=!1,P&&P(i),f=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++U<25);d.state=d.__s,null!=d.getChildContext&&(e=b(b({},e),d.getChildContext())),x&&!h&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(v,p)),D=f,null!=f&&f.type===k&&null==f.key&&(D=F(f.props.children)),l=A(n,y(D)?D:[D],i,t,e,o,u,a,l,c,s),d.base=i.__e,i.__u&=-161,d.__h.length&&a.push(d),m&&(d.__E=d.__=null)}catch(n){if(i.__v=null,c||null!=u)if(n.then){for(i.__u|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;u[u.indexOf(l)]=null,i.__e=l}else{for(E=u.length;E--;)w(u[E]);O(i)}else i.__e=t.__e,i.__k=t.__k,n.then||O(i);r.__e(n,i,t)}else null==u&&i.__v==t.__v?(i.__k=t.__k,i.__e=t.__e):l=i.__e=L(t.__e,i,t,e,o,u,a,c,s);return(f=r.diffed)&&f(i),128&i.__u?void 0:l}function O(n){n&&n.__c&&(n.__c.__e=!0),n&&n.__k&&n.__k.forEach(O)}function j(n,i,t){for(var e=0;e<t.length;e++)R(t[e],t[++e],t[++e]);r.__c&&r.__c(i,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(n){n.call(i)})}catch(n){r.__e(n,i.__v)}})}function F(n){return"object"!=typeof n||null==n||n.__b&&n.__b>0?n:y(n)?n.map(F):b({},n)}function L(n,i,t,o,u,a,l,c,s){var f,d,h,v,g,m,b,N=t.props,k=i.props,_=i.type;if("svg"==_?u="http://www.w3.org/2000/svg":"math"==_?u="http://www.w3.org/1998/Math/MathML":u||(u="http://www.w3.org/1999/xhtml"),null!=a)for(f=0;f<a.length;f++)if((g=a[f])&&"setAttribute"in g==!!_&&(_?g.localName==_:3==g.nodeType)){n=g,a[f]=null;break}if(null==n){if(null==_)return document.createTextNode(k);n=document.createElementNS(u,_,k.is&&k),c&&(r.__m&&r.__m(i,a),c=!1),a=null}if(null==_)N===k||c&&n.data==k||(n.data=k);else{if(a=a&&e.call(n.childNodes),N=t.props||p,!c&&null!=a)for(N={},f=0;f<n.attributes.length;f++)N[(g=n.attributes[f]).name]=g.value;for(f in N)if(g=N[f],"children"==f);else if("dangerouslySetInnerHTML"==f)h=g;else if(!(f in k)){if("value"==f&&"defaultValue"in k||"checked"==f&&"defaultChecked"in k)continue;D(n,f,null,g,u)}for(f in k)g=k[f],"children"==f?v=g:"dangerouslySetInnerHTML"==f?d=g:"value"==f?m=g:"checked"==f?b=g:c&&"function"!=typeof g||N[f]===g||D(n,f,g,N[f],u);if(d)c||h&&(d.__html==h.__html||d.__html==n.innerHTML)||(n.innerHTML=d.__html),i.__k=[];else if(h&&(n.innerHTML=""),A("template"==i.type?n.content:n,y(v)?v:[v],i,t,o,"foreignObject"==_?"http://www.w3.org/1999/xhtml":u,a,l,a?a[0]:t.__k&&x(t,0),c,s),null!=a)for(f=a.length;f--;)w(a[f]);c||(f="value","progress"==_&&null==m?n.removeAttribute("value"):null!=m&&(m!==n[f]||"progress"==_&&!m||"option"==_&&m!=N[f])&&D(n,f,m,N[f],u),f="checked",null!=b&&b!=n[f]&&D(n,f,b,N[f],u))}return n}function R(n,i,t){try{if("function"==typeof n){var e="function"==typeof n.__u;e&&n.__u(),e&&null==i||(n.__u=n(i))}else n.current=i}catch(n){r.__e(n,t)}}function $(n,i,t){var e,o;if(r.unmount&&r.unmount(n),(e=n.ref)&&(e.current&&e.current!=n.__e||R(e,null,i)),null!=(e=n.__c)){if(e.componentWillUnmount)try{e.componentWillUnmount()}catch(n){r.__e(n,i)}e.base=e.__P=null}if(e=n.__k)for(o=0;o<e.length;o++)e[o]&&$(e[o],i,t||"function"!=typeof n.type);t||w(n.__e),n.__c=n.__=n.__e=void 0}function q(n,i,t){return this.constructor(n,t)}function z(n,i,t){var o,u,a,l;i==document&&(i=document.documentElement),r.__&&r.__(n,i),u=(o="function"==typeof t)?null:t&&t.__k||i.__k,a=[],l=[],I(i,n=(!o&&t||i).__k=function(n,i,t){var r,o,u,a={};for(u in i)"key"==u?r=i[u]:"ref"==u?o=i[u]:a[u]=i[u];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):t),"function"==typeof n&&null!=n.defaultProps)for(u in n.defaultProps)void 0===a[u]&&(a[u]=n.defaultProps[u]);return N(n,a,r,o,null)}(k,null,[n]),u||p,p,i.namespaceURI,!o&&t?[t]:u?null:i.firstChild?e.call(i.childNodes):null,a,!o&&t?t:u?u.__e:i.firstChild,o,l),j(a,n,l)}e=g.slice,r={__e:function(n,i,t,e){for(var r,o,u;i=i.__;)if((r=i.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(n)),u=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(n,e||{}),u=r.__d),u)return r.__E=r}catch(i){n=i}throw n}},o=0,u=function(n){return null!=n&&null==n.constructor},_.prototype.setState=function(n,i){var t;t=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=b({},this.state),"function"==typeof n&&(n=n(b({},t),this.props)),n&&b(t,n),null!=n&&this.__v&&(i&&this.m.push(i),S(this))},_.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),S(this))},_.prototype.render=k,a=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,s=function(n,i){return n.__v.__b-i.__v.__b},M.__r=0,f=/(PointerCapture)$|Capture$/i,d=0,h=E(!1),v=E(!0);var H=0;function W(n,i,t,e,o,u){i||(i={});var a,l,c=i;if("ref"in c)for(l in c={},i)"ref"==l?a=i[l]:c[l]=i[l];var s={type:n,props:c,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--H,__i:-1,__u:0,__source:o,__self:u};if("function"==typeof n&&(a=n.defaultProps))for(l in a)void 0===c[l]&&(c[l]=a[l]);return r.vnode&&r.vnode(s),s}var G,J,B,V,Z=0,X=[],Y=r,K=Y.__b,Q=Y.__r,nn=Y.diffed,tn=Y.__c,en=Y.unmount,rn=Y.__;function on(n,i){Y.__h&&Y.__h(J,n,Z||i),Z=0;var t=J.__H||(J.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function un(n,i){var t=on(G++,3);!Y.__s&&vn(t.__H,i)&&(t.__=n,t.u=i,J.__H.__h.push(t))}function an(n){return Z=5,ln(function(){return{current:n}},[])}function ln(n,i){var t=on(G++,7);return vn(t.__H,i)&&(t.__=n(),t.__H=i,t.__h=n),t.__}function cn(){for(var n;n=X.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(dn),n.__H.__h.forEach(hn),n.__H.__h=[]}catch(i){n.__H.__h=[],Y.__e(i,n.__v)}}Y.__b=function(n){J=null,K&&K(n)},Y.__=function(n,i){n&&i.__k&&i.__k.__m&&(n.__m=i.__k.__m),rn&&rn(n,i)},Y.__r=function(n){Q&&Q(n),G=0;var i=(J=n.__c).__H;i&&(B===J?(i.__h=[],J.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(i.__h.forEach(dn),i.__h.forEach(hn),i.__h=[],G=0)),B=J},Y.diffed=function(n){nn&&nn(n);var i=n.__c;i&&i.__H&&(i.__H.__h.length&&(1!==X.push(i)&&V===Y.requestAnimationFrame||((V=Y.requestAnimationFrame)||fn)(cn)),i.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),B=J=null},Y.__c=function(n,i){i.some(function(n){try{n.__h.forEach(dn),n.__h=n.__h.filter(function(n){return!n.__||hn(n)})}catch(t){i.some(function(n){n.__h&&(n.__h=[])}),i=[],Y.__e(t,n.__v)}}),tn&&tn(n,i)},Y.unmount=function(n){en&&en(n);var i,t=n.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{dn(n)}catch(n){i=n}}),t.__H=void 0,i&&Y.__e(i,t.__v))};var sn="function"==typeof requestAnimationFrame;function fn(n){var i,t=function(){clearTimeout(e),sn&&cancelAnimationFrame(i),setTimeout(n)},e=setTimeout(t,35);sn&&(i=requestAnimationFrame(t))}function dn(n){var i=J,t=n.__c;"function"==typeof t&&(n.__c=void 0,t()),J=i}function hn(n){var i=J;n.__c=n.__(),J=i}function vn(n,i){return!n||n.length!==i.length||i.some(function(i,t){return i!==n[t]})}function pn(n,i){return"function"==typeof i?i(n):i}var gn=Symbol.for("preact-signals");function mn(){if(!(kn>1)){var n,i=!1;while(void 0!==Nn){var t=Nn;Nn=void 0;_n++;while(void 0!==t){var e=t.o;t.o=void 0;t.f&=-3;if(!(8&t.f)&&An(t))try{t.c()}catch(t){if(!i){n=t;i=!0}}t=e}}_n=0;kn--;if(i)throw n}else kn--}function yn(n){if(kn>0)return n();kn++;try{return n()}finally{mn()}}var bn=void 0;function wn(n){var i=bn;bn=void 0;try{return n()}finally{bn=i}}var Nn=void 0,kn=0,_n=0,xn=0;function Cn(n){if(void 0!==bn){var i=n.n;if(void 0===i||i.t!==bn){i={i:0,S:n,p:bn.s,n:void 0,t:bn,e:void 0,x:void 0,r:i};if(void 0!==bn.s)bn.s.n=i;bn.s=i;n.n=i;if(32&bn.f)n.S(i);return i}else if(-1===i.i){i.i=0;if(void 0!==i.n){i.n.p=i.p;if(void 0!==i.p)i.p.n=i.n;i.p=bn.s;i.n=void 0;bn.s.n=i;bn.s=i}return i}}}function Sn(n,i){this.v=n;this.i=0;this.n=void 0;this.t=void 0;this.W=null==i?void 0:i.watched;this.Z=null==i?void 0:i.unwatched;this.name=null==i?void 0:i.name}Sn.prototype.brand=gn;Sn.prototype.h=function(){return!0};Sn.prototype.S=function(n){var i=this,t=this.t;if(t!==n&&void 0===n.e){n.x=t;this.t=n;if(void 0!==t)t.e=n;else wn(function(){var n;null==(n=i.W)||n.call(i)})}};Sn.prototype.U=function(n){var i=this;if(void 0!==this.t){var t=n.e,e=n.x;if(void 0!==t){t.x=e;n.e=void 0}if(void 0!==e){e.e=t;n.x=void 0}if(n===this.t){this.t=e;if(void 0===e)wn(function(){var n;null==(n=i.Z)||n.call(i)})}}};Sn.prototype.subscribe=function(n){var i=this;return Fn(function(){var t=i.value,e=bn;bn=void 0;try{n(t)}finally{bn=e}},{name:"sub"})};Sn.prototype.valueOf=function(){return this.value};Sn.prototype.toString=function(){return this.value+""};Sn.prototype.toJSON=function(){return this.value};Sn.prototype.peek=function(){var n=bn;bn=void 0;try{return this.value}finally{bn=n}};Object.defineProperty(Sn.prototype,"value",{get:function(){var n=Cn(this);if(void 0!==n)n.i=this.i;return this.v},set:function(n){if(n!==this.v){if(_n>100)throw new Error("Cycle detected");this.v=n;this.i++;xn++;kn++;try{for(var i=this.t;void 0!==i;i=i.x)i.t.N()}finally{mn()}}}});function Mn(n,i){return new Sn(n,i)}function An(n){for(var i=n.s;void 0!==i;i=i.n)if(i.S.i!==i.i||!i.S.h()||i.S.i!==i.i)return!0;return!1}function Pn(n){for(var i=n.s;void 0!==i;i=i.n){var t=i.S.n;if(void 0!==t)i.r=t;i.S.n=i;i.i=-1;if(void 0===i.n){n.s=i;break}}}function Un(n){var i=n.s,t=void 0;while(void 0!==i){var e=i.p;if(-1===i.i){i.S.U(i);if(void 0!==e)e.n=i.n;if(void 0!==i.n)i.n.p=e}else t=i;i.S.n=i.r;if(void 0!==i.r)i.r=void 0;i=e}n.s=t}function Tn(n,i){Sn.call(this,void 0);this.x=n;this.s=void 0;this.g=xn-1;this.f=4;this.W=null==i?void 0:i.watched;this.Z=null==i?void 0:i.unwatched;this.name=null==i?void 0:i.name}Tn.prototype=new Sn;Tn.prototype.h=function(){this.f&=-3;if(1&this.f)return!1;if(32==(36&this.f))return!0;this.f&=-5;if(this.g===xn)return!0;this.g=xn;this.f|=1;if(this.i>0&&!An(this)){this.f&=-2;return!0}var n=bn;try{Pn(this);bn=this;var i=this.x();if(16&this.f||this.v!==i||0===this.i){this.v=i;this.f&=-17;this.i++}}catch(n){this.v=n;this.f|=16;this.i++}bn=n;Un(this);this.f&=-2;return!0};Tn.prototype.S=function(n){if(void 0===this.t){this.f|=36;for(var i=this.s;void 0!==i;i=i.n)i.S.S(i)}Sn.prototype.S.call(this,n)};Tn.prototype.U=function(n){if(void 0!==this.t){Sn.prototype.U.call(this,n);if(void 0===this.t){this.f&=-33;for(var i=this.s;void 0!==i;i=i.n)i.S.U(i)}}};Tn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var n=this.t;void 0!==n;n=n.x)n.t.N()}};Object.defineProperty(Tn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var n=Cn(this);this.h();if(void 0!==n)n.i=this.i;if(16&this.f)throw this.v;return this.v}});function Dn(n,i){return new Tn(n,i)}function En(n){var i=n.u;n.u=void 0;if("function"==typeof i){kn++;var t=bn;bn=void 0;try{i()}catch(i){n.f&=-2;n.f|=8;In(n);throw i}finally{bn=t;mn()}}}function In(n){for(var i=n.s;void 0!==i;i=i.n)i.S.U(i);n.x=void 0;n.s=void 0;En(n)}function On(n){if(bn!==this)throw new Error("Out-of-order effect");Un(this);bn=n;this.f&=-2;if(8&this.f)In(this);mn()}function jn(n,i){this.x=n;this.u=void 0;this.s=void 0;this.o=void 0;this.f=32;this.name=null==i?void 0:i.name}jn.prototype.c=function(){var n=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var i=this.x();if("function"==typeof i)this.u=i}finally{n()}};jn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1;this.f&=-9;En(this);Pn(this);kn++;var n=bn;bn=this;return On.bind(this,n)};jn.prototype.N=function(){if(!(2&this.f)){this.f|=2;this.o=Nn;Nn=this}};jn.prototype.d=function(){this.f|=8;if(!(1&this.f))In(this)};jn.prototype.dispose=function(){this.d()};function Fn(n,i){var t=new jn(n,i);try{t.c()}catch(n){t.d();throw n}var e=t.d.bind(t);e[Symbol.dispose]=e;return e}var Ln,Rn,$n,qn="undefined"!=typeof window&&!!window.__PREACT_SIGNALS_DEVTOOLS__,zn=[],Hn=[];Fn(function(){Ln=this.N})();function Wn(n,i){r[n]=i.bind(null,r[n]||function(){})}function Gn(n){if($n)$n();$n=n&&n.S()}function Jn(n){var i=this,t=n.data,e=useSignal(t);e.value=t;var r=ln(function(){var n=i,t=i.__v;while(t=t.__)if(t.__c){t.__c.__$f|=4;break}var r=Dn(function(){var n=e.value.value;return 0===n?0:!0===n?"":n||""}),o=Dn(function(){return!Array.isArray(r.value)&&!u(r.value)}),a=Fn(function(){this.N=Qn;if(o.value){var i=r.value;if(n.__v&&n.__v.__e&&3===n.__v.__e.nodeType)n.__v.__e.data=i}}),l=i.__$u.d;i.__$u.d=function(){a();l.call(this)};return[o,r]},[]),o=r[0],a=r[1];return o.value?a.peek():a.value}Jn.displayName="ReactiveTextNode";Object.defineProperties(Sn.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Jn},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Wn("__b",function(n,i){if("string"==typeof i.type){var t,e=i.props;for(var r in e)if("children"!==r){var o=e[r];if(o instanceof Sn){if(!t)i.__np=t={};t[r]=o;e[r]=o.peek()}}}n(i)});Wn("__r",function(n,i){if(i.type!==k){Gn();var t,e=i.__c;if(e){e.__$f&=-2;if(void 0===(t=e.__$u))e.__$u=t=function(n,i){var t;Fn(function(){t=this},{name:i});t.c=n;return t}(function(){var n;if(qn)null==(n=t.y)||n.call(t);e.__$f|=1;e.setState({})},"function"==typeof i.type?i.type.displayName||i.type.name:"")}Rn=e;Gn(t)}n(i)});Wn("__e",function(n,i,t,e){Gn();Rn=void 0;n(i,t,e)});Wn("diffed",function(n,i){Gn();Rn=void 0;var t;if("string"==typeof i.type&&(t=i.__e)){var e=i.__np,r=i.props;if(e){var o=t.U;if(o)for(var u in o){var a=o[u];if(void 0!==a&&!(u in e)){a.d();o[u]=void 0}}else{o={};t.U=o}for(var l in e){var c=o[l],s=e[l];if(void 0===c){c=Bn(t,l,s,r);o[l]=c}else c.o(s,r)}}}n(i)});function Bn(n,i,t,e){var r=i in n&&void 0===n.ownerSVGElement,o=Mn(t);return{o:function(n,i){o.value=n;e=i},d:Fn(function(){this.N=Qn;var t=o.value.value;if(e[i]!==t){e[i]=t;if(r)n[i]=t;else if(null!=t&&(!1!==t||"-"===i[4]))n.setAttribute(i,t);else n.removeAttribute(i)}})}}Wn("unmount",function(n,i){if("string"==typeof i.type){var t=i.__e;if(t){var e=t.U;if(e){t.U=void 0;for(var r in e){var o=e[r];if(o)o.d()}}}}else{var u=i.__c;if(u){var a=u.__$u;if(a){u.__$u=void 0;a.d()}}}n(i)});Wn("__h",function(n,i,t,e){if(e<3||9===e)i.__$f|=2;n(i,t,e)});_.prototype.shouldComponentUpdate=function(n,i){var t=this.__$u,e=t&&void 0!==t.s;for(var r in i)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){var o=2&this.__$f;if(!(e||o||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(e||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var u in n)if("__source"!==u&&n[u]!==this.props[u])return!0;for(var a in this.props)if(!(a in n))return!0;return!1};function useSignal(n,i){return function(n){return Z=1,function(n,i,t){var e=on(G++,2);if(e.t=n,!e.__c&&(e.__=[t?t(i):pn(void 0,i),function(n){var i=e.__N?e.__N[0]:e.__[0],t=e.t(i,n);i!==t&&(e.__N=[t,e.__[1]],e.__c.setState({}))}],e.__c=J,!J.__f)){var r=function(n,i,t){if(!e.__c.__H)return!0;var r=e.__c.__H.__.filter(function(n){return!!n.__c});if(r.every(function(n){return!n.__N}))return!o||o.call(this,n,i,t);var u=e.__c.props!==n;return r.forEach(function(n){if(n.__N){var i=n.__[0];n.__=n.__N,n.__N=void 0,i!==n.__[0]&&(u=!0)}}),o&&o.call(this,n,i,t)||u};J.__f=!0;var o=J.shouldComponentUpdate,u=J.componentWillUpdate;J.componentWillUpdate=function(n,i,t){if(this.__e){var e=o;o=void 0,r(n,i,t),o=e}u&&u.call(this,n,i,t)},J.shouldComponentUpdate=r}return e.__N||e.__}(pn,n)}(function(){return Mn(n,i)})[0]}var Vn="undefined"==typeof requestAnimationFrame?setTimeout:function(n){var i=function(){clearTimeout(t);cancelAnimationFrame(e);n()},t=setTimeout(i,35),e=requestAnimationFrame(i)},Zn=function(n){queueMicrotask(function(){queueMicrotask(n)})};function Xn(){yn(function(){var n;while(n=zn.shift())Ln.call(n)})}function Yn(){if(1===zn.push(this))(r.requestAnimationFrame||Vn)(Xn)}function Kn(){yn(function(){var n;while(n=Hn.shift())Ln.call(n)})}function Qn(){if(1===Hn.push(this))(r.requestAnimationFrame||Zn)(Kn)}function useSignalEffect(n,i){var t=an(n);t.current=n;un(function(){return Fn(function(){this.N=Yn;return t.current()},i)},[])}function ni(n){var i=n.onClick,t=n.className,e=void 0===t?"":t,r=n.disabled,o=void 0===r?!1:r,u=n.children,a=n.variant,l=void 0===a?"secondary":a,c=n.popovertarget,s=n.active;return W("button",{popovertarget:c,onClick:i,className:("btn "+("primary"===l?"btn-primary":"btn-secondary")+" "+((void 0===s?0:s)?"active":"")+" "+e).trim(),disabled:o,children:u})}function ii(n){var i=n.onRefresh,t=n.title,e=void 0===t?"No Signals Detected":t,r=n.description,o=void 0===r?"Make sure your application is using @preact/signals-debug package.":r,u=n.buttonText,a=void 0===u?"Refresh Detection":u;return W("div",{className:"empty-state",children:W("div",{className:"empty-state-content",children:[W("h2",{children:e}),W("p",{children:o}),W("div",{className:"empty-state-actions",children:W(ni,{onClick:i,variant:"primary",children:a})})]})})}function ti(n){var i=n.status,t=n.message,e=n.showIndicator,r=void 0===e?!0:e,o=n.className;return W("div",{className:"connection-status "+i+" "+(void 0===o?"":o),children:[r&&W("span",{className:"status-indicator "+i}),W("span",{className:"status-text",children:t})]})}var ei=null;function ri(){if(!ei)throw new Error("DevTools context not initialized. Call initDevTools() first.");return ei}function oi(n){var i=Mn("connecting"),t=Mn("Connecting..."),e=Mn(!1);n.on("connectionStatusChanged",function(n){i.value=n.status;t.value=n.message});n.on("signalsAvailable",function(n){e.value=n});return{get status(){return i.value},get message(){return t.value},get isConnected(){return e.value},refreshConnection:function(){i.value="connecting";t.value="Connecting...";n.requestState()}}}var ui=function(n,i){return n.update.signalId===i.update.signalId&&n.children.length===i.children.length&&n.children.every(function(n,t){return ui(n,i.children[t])})};function ai(n,e){var r=Mn([]),o=Mn(!1),u=Mn(new Set),a=function(n){if(Array.isArray(n))n.forEach(function(n){if("divider"!==n.type)n.receivedAt=Date.now()});else if("update"===n.type)n.receivedAt=Date.now();r.value=[].concat(r.value,Array.isArray(n)?n:[n])},l=Dn(function(){return r.value.length>0}),c=Dn(function(){var n=new Map;r.value.forEach(function(i){if("divider"!==i.type){var t=i.signalName||"Unknown";n.set(t,(n.get(t)||0)+1)}});return n}),s=Dn(function(){return function(n){for(var i=[],t=[],e=n.slice(-100).reverse(),r=0;r<e.length;r++){var o=e[r];if("divider"!==o.type){var u=o,a=u.depth||0,l={type:"single",id:u.signalName+"-"+u.receivedAt+"-"+r,update:u,children:[],depth:a,hasChildren:!1};while(t.length>0&&t[t.length-1].depth>=a)t.pop();if(0===t.length)i.push(l);else{var c=t[t.length-1];c.children.push(l);c.hasChildren=!0}t.push(l)}}return i}(r.value)});n.on("signalUpdate",function(n){if(!o.value){var i=[].concat(n).reverse();i.push({type:"divider"});a(i)}});n.on("signalDisposed",function(n){if(!o.value)!function(n){for(var t,e=Array.isArray(n)?n:[n],r=new Set(u.value),o=i(e);!(t=o()).done;){var a=t.value;if(a.signalId)r.add(a.signalId)}u.value=r}(n)});var f=Dn(function(){var n=s.value;if(e.settings.grouped)return function(n){for(var e,r,o=[],u=i(n);!(r=u()).done;){var a=r.value;if(!e||!ui(e,a)){o.push(a);e=a}else if("group"!==e.type){o.pop();e=t({},e,{type:"group",count:2,firstUpdate:a.update,firstChildren:a.children});o.push(e)}else{e.count++;e.firstUpdate=a.update;e.firstChildren=a.children}}return o}(n);else return n});return{updates:r,updateTree:s,collapsedUpdateTree:f,totalUpdates:Dn(function(){return Object.keys(s.value).length}),signalCounts:c,disposedSignalIds:u,addUpdate:a,clearUpdates:function(){r.value=[];u.value=new Set},hasUpdates:l,isPaused:o}}function li(n){var i=Mn({enabled:!0,grouped:!0,consoleLogging:!0,maxUpdatesPerSecond:60,filterPatterns:[]}),t=Mn(!1);n.on("configReceived",function(n){if(n.settings)i.value=n.settings});return{get settings(){return i.value},get showDisposedSignals(){return t.value},set settings(n){i.value=n},applySettings:function(t){i.value=t;n.sendConfig(t)},toggleShowDisposedSignals:function(){t.value=!t.value}}}function ci(n){var i=li(n),t=ai(n,i),e=oi(n);return ei={adapter:n,connectionStore:e,updatesStore:t,settingsStore:i}}function si(){if(ei){ei.adapter.disconnect();ei=null}}function fi(){var n=ri(),i=n.connectionStore,t=n.updatesStore,e=function(){t.isPaused.value=!t.isPaused.value},r=function(){t.clearUpdates()};return W("header",{className:"header",children:[W("div",{className:"header-title",children:[W("h1",{children:"Signals"}),W(ti,{status:i.status,message:i.message})]}),W("div",{className:"header-controls",children:[r&&W(ni,{onClick:r,children:"Clear"}),e&&W(ni,{onClick:e,active:t.isPaused.value,children:t.isPaused.value?"Resume":"Pause"}),W(ni,{popovertarget:"settings-panel-popover",children:"Settings"})]})]})}function di(){var n=ri().settingsStore,i=an(null),e=n.applySettings,r=useSignal(n.settings);useSignalEffect(function(){r.value=n.settings});return W("div",{ref:i,popover:"auto",id:"settings-panel-popover",className:"settings-panel",children:W("div",{className:"settings-content",children:[W("h3",{children:"Debug Configuration"}),W("div",{className:"setting-group",children:W("label",{children:[W("input",{type:"checkbox",checked:r.value.enabled,onChange:function(n){return r.value=t({},r.value,{enabled:n.target.checked})}}),"Enable debug updates"]})}),W("div",{className:"setting-group",children:W("label",{children:[W("input",{type:"checkbox",checked:r.value.grouped,onChange:function(n){return r.value=t({},r.value,{grouped:n.target.checked})}}),"Group related updates"]})}),W("div",{className:"setting-group",children:[W("label",{children:[W("input",{type:"checkbox",checked:r.value.consoleLogging,onChange:function(n){return r.value=t({},r.value,{consoleLogging:n.target.checked})}}),"Enable console logging"]}),W("p",{className:"setting-description",children:"When disabled, signal updates will not be logged to the browser console."})]}),W("div",{className:"setting-group",children:[W("label",{htmlFor:"maxUpdatesInput",children:"Max updates per second:"}),W("input",{type:"number",id:"maxUpdatesInput",value:r.value.maxUpdatesPerSecond,min:"1",max:"1000",onChange:function(n){return r.value=t({},r.value,{maxUpdatesPerSecond:parseInt(n.target.value)||60})}})]}),W("div",{className:"setting-group",children:[W("label",{htmlFor:"filterPatternsInput",children:"Filter patterns (one per line):"}),W("textarea",{id:"filterPatternsInput",placeholder:"user.*\n.*State$\nglobal",value:r.value.filterPatterns.join("\n"),onChange:function(n){return r.value=t({},r.value,{filterPatterns:n.target.value.split("\n").map(function(n){return n.trim()}).filter(function(n){return n.length>0})})}})]}),W("h3",{children:"Graph Settings"}),W("div",{className:"setting-group",children:[W("label",{children:[W("input",{type:"checkbox",checked:n.showDisposedSignals,onChange:function(){return n.toggleShowDisposedSignals()}}),"Show disposed signals in graph"]}),W("p",{className:"setting-description",children:"When enabled, signals and effects that have been disposed will still be shown in the graph view."})]}),W("div",{className:"settings-actions",children:[W(ni,{onClick:function(){e(r.value)},variant:"primary",children:"Apply"}),W(ni,{onClick:function(){var n;null==(n=i.current)||n.hide()},children:"Cancel"})]})]})})}var hi=function(n){var i=document.createElement("textarea");try{i.value=n;document.body.append(i);i.select();document.execCommand("copy")}finally{i.remove()}};function vi(){var n=ri(),t=n.updatesStore,e=n.settingsStore,r=t.updates,o=t.disposedSignalIds,u=an(null),a=an(null),l=an(null),c=useSignal({x:0,y:0}),s=useSignal(1),f=useSignal(!1),d=useSignal({x:0,y:0}),h=useSignal(!1),v=useSignal(),p=useSignal(null),g=useSignal({x:0,y:0});un(function(){var n=function(n){if(h.value&&l.current&&!l.current.contains(n.target))h.value=!1};document.addEventListener("mousedown",n);return function(){document.removeEventListener("mousedown",n)}},[]);var m=function(n,i){var t=an(n);t.current=n;Rn.__$f|=4;return ln(function(){return Dn(function(){return t.current()},void 0)},[])}(function(){var n=r.value,t=o.value,u=e.showDisposedSignals;if(!n||0===n.length)return{nodes:[],links:[]};for(var a,l=new Map,c=new Map,s=n.filter(function(n){return"divider"!==n.type}),f=i(s);!(a=f()).done;){var d=a.value;if(d.signalId)if(u||!t.has(d.signalId)){var h=d.signalType,v=d.depth||0;if(!l.has(d.signalId))l.set(d.signalId,{id:d.signalId,name:d.signalName,type:h,x:0,y:0,depth:v});if(d.subscribedTo){if(!u&&t.has(d.subscribedTo))continue;var p=d.subscribedTo+"->"+d.signalId;if(!c.has(p))c.set(p,{source:d.subscribedTo,target:d.signalId})}}}var g=Array.from(l.values()),m=new Map;g.forEach(function(n){if(!m.has(n.depth))m.set(n.depth,[]);m.get(n.depth).push(n)});var y=Math.max.apply(Math,g.map(function(n){return n.depth}));m.forEach(function(n,i){var t=120*(n.length-1),e=80+100*y-t/2;n.forEach(function(n,t){n.x=100+250*i;n.y=e+120*t})});return{nodes:g,links:Array.from(c.values())}}),y=function(){f.value=!1},b=/[^a-zA-Z0-9]/g,w=function(n){return n.replace(b,"_")},N=function(n){var i=6.5*n.name.length+16;return Math.max(30,Math.min(i/2,70))},k=function(n){var i=a.current;if(i&&p.value){var t=i.getBoundingClientRect();g.value={x:n.clientX-t.left,y:n.clientY-t.top}}},_=function(){p.value=null},x=function(n){v.value=n;setTimeout(function(){v.value=void 0},2e3)};if(0===m.value.nodes.length)return W("div",{className:"graph-empty",children:W("div",{children:[W("h3",{children:"No Signal Dependencies"}),W("p",{children:"Create some signals with dependencies to see the graph visualization."})]})});var C=Math.max.apply(Math,[800].concat(m.value.nodes.map(function(n){return n.x+100}))),S=Math.max.apply(Math,[600].concat(m.value.nodes.map(function(n){return n.y+100})));return W("div",{className:"graph-container",children:W("div",{ref:a,className:"graph-content",onMouseDown:function(n){if(0===n.button){f.value=!0;d.value={x:n.clientX-c.value.x,y:n.clientY-c.value.y}}},onMouseMove:function(n){if(f.value)c.value={x:n.clientX-d.value.x,y:n.clientY-d.value.y}},onMouseUp:y,onMouseLeave:y,onWheel:function(n){n.preventDefault();var i=a.current;if(i){var t=i.getBoundingClientRect(),e=n.clientX-t.left,r=n.clientY-t.top,o=n.deltaY>0?.96:1.04,u=Math.min(Math.max(.1,s.value*o),5),l=u/s.value;c.value={x:e-(e-c.value.x)*l,y:r-(r-c.value.y)*l};s.value=u}},style:{cursor:f.value?"grabbing":"grab"},children:[W("svg",{ref:u,className:"graph-svg",width:C,height:S,viewBox:"0 0 "+C+" "+S,children:[W("defs",{children:W("marker",{id:"arrowhead",markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto",children:W("polygon",{points:"0 0, 8 3, 0 6",fill:"#94a3b8"})})}),W("g",{transform:"translate("+c.value.x+", "+c.value.y+") scale("+s.value+")",children:[W("g",{className:"links",children:m.value.links.map(function(n,i){var t=m.value.nodes.find(function(i){return i.id===n.source}),e=m.value.nodes.find(function(i){return i.id===n.target});if(!t||!e)return null;var r=N(t),o=N(e),u=t.x+r,a=t.y,l=e.x-o-8,c=e.y,s=u+.5*(l-u);return W("path",{className:"graph-link",d:"M "+u+" "+a+" C "+s+" "+a+", "+s+" "+c+", "+l+" "+c,fill:"none",markerEnd:"url(#arrowhead)"},"link-"+i)})}),W("g",{className:"nodes",children:m.value.nodes.map(function(n){var i,t=N(n),e=Math.floor((2*t-16)/6.5),r=n.name.length>e?n.name.slice(0,e-1)+"…":n.name;return W("g",{className:"graph-node-group "+((null==(i=p.value)?void 0:i.id)===n.id?"hovered":""),onMouseEnter:function(i){return function(n,i){p.value=n;var t=a.current;if(t){var e=t.getBoundingClientRect();g.value={x:i.clientX-e.left,y:i.clientY-e.top}}}(n,i)},onMouseMove:k,onMouseLeave:_,children:[W("circle",{className:"graph-node "+n.type,cx:n.x,cy:n.y,r:t}),W("text",{className:"graph-text",x:n.x,y:n.y,textAnchor:"middle",dominantBaseline:"central",children:r})]},n.id)})})]})]}),W("div",{className:"graph-controls",children:[W("button",{className:"graph-reset-button",onClick:function(){c.value={x:0,y:0};s.value=1},title:"Reset view",children:"⟲ Reset View"}),W("div",{ref:l,className:"graph-export-container",children:[W("button",{className:"graph-export-button",onClick:function(){h.value=!h.value},title:"Export graph",children:"↓ Export"}),h.value&&W("div",{className:"graph-export-menu",children:[W("button",{className:"graph-export-menu-item",onClick:function(){try{h.value=!1;var n=["graph LR"];m.value.nodes.forEach(function(i){var t=w(i.id),e=i.name;switch(i.type){case"signal":n.push(" "+t+"(("+e+"))");break;case"computed":n.push(" "+t+"("+e+")");break;case"effect":n.push(" "+t+"(["+e+"])")}});for(var t,e=i(m.value.links);!(t=e()).done;){var r=t.value,o=w(r.source),u=w(r.target);n.push(" "+o+" --\x3e "+u)}hi(n.join("\n"));x("Copied to clipboard!");return Promise.resolve()}catch(n){return Promise.reject(n)}},children:"Mermaid"}),W("button",{className:"graph-export-menu-item",onClick:function(){try{h.value=!1;var n=JSON.stringify(m.value,null,2);hi(n);x("Copied to clipboard!");return Promise.resolve()}catch(n){return Promise.reject(n)}},children:"JSON"})]})]}),W("div",{className:"graph-zoom-indicator",title:"Zoom level",children:[Math.round(100*s.value),"%"]})]}),v.value&&W("div",{className:"graph-toast",children:v.value}),p.value&&W("div",{className:"graph-tooltip",style:{left:g.value.x+12,top:g.value.y-8},children:[W("div",{className:"tooltip-header",children:W("span",{className:"tooltip-type "+p.value.type,children:p.value.type})}),W("div",{className:"tooltip-name",children:p.value.name}),W("div",{className:"tooltip-id",children:["ID: ",p.value.id]})]}),W("div",{className:"graph-legend",children:[W("div",{className:"legend-item",children:[W("div",{className:"legend-color",style:{backgroundColor:"#2196f3"}}),W("span",{children:"Signal"})]}),W("div",{className:"legend-item",children:[W("div",{className:"legend-color",style:{backgroundColor:"#ff9800"}}),W("span",{children:"Computed"})]}),W("div",{className:"legend-item",children:[W("div",{className:"legend-color",style:{backgroundColor:"#4caf50"}}),W("span",{children:"Effect"})]})]})]})})}function pi(n){var i=n.update,t=n.count,e=n.firstUpdate,r=new Date(i.timestamp||i.receivedAt).toLocaleTimeString(),o=function(n){if(null===n)return"null";if(void 0===n)return"undefined";if("string"==typeof n)return'"'+n+'"';if("function"==typeof n)return"function()";if("object"==typeof n)try{return JSON.stringify(n,null,0)}catch(n){return"[Object]"}return String(n)},u=t&&W("span",{class:"update-count",title:"Number of grouped identical updates",children:["x",t]});if("effect"===i.type)return W("div",{className:"update-item "+i.type,children:W("div",{className:"update-header",children:[W("span",{className:"signal-name",children:["↪️ ",i.signalName,u]}),W("span",{className:"update-time",children:r})]})});var a=o(i.prevValue),l=o(i.newValue),c=void 0!==e?o(e.prevValue):void 0;return W("div",{class:"update-item "+i.type,children:[W("div",{class:"update-header",children:[W("span",{class:"signal-name",children:[0===i.depth?"🎯":"↪️"," ",i.signalName,u]}),W("span",{class:"update-time",children:r})]}),W("div",{class:"value-change",children:[c&&c!==a&&W(k,{children:[W("span",{class:"value-prev",children:c}),W("span",{class:"value-arrow",children:"..."})]}),W("span",{class:"value-prev",children:a}),W("span",{class:"value-arrow",children:"→"}),W("span",{class:"value-new",children:l})]})]})}function gi(n){var i,e=n.node,r=useSignal(!1),o=e.children.length>0,u="group"===e.type?e.count:void 0,a="group"===e.type?e.firstUpdate:void 0;if("group"===e.type&&e.firstChildren)i=e.children.map(function(n,i){var r=e.firstChildren[i];return t({},n,{type:"group",firstUpdate:r.update,firstChildren:r.children,count:e.count})});else i=e.children;return W("div",{className:"tree-node",children:[W("div",{className:"tree-node-content",children:[o&&W("button",{className:"collapse-button",onClick:function(){r.value=!r.value},"aria-label":r.value?"Expand":"Collapse",children:r.value?"▶":"▼"}),!o&&W("div",{className:"collapse-spacer"}),W("div",{className:"update-content",children:W(pi,{update:e.update,count:u,firstUpdate:a})})]}),o&&!r.value&&W("div",{className:"tree-children",children:i.map(function(n){return W(gi,{node:n},n.id)})})]})}function mi(){var n=ri().updatesStore,i=an(null),t=n.collapsedUpdateTree.value;useSignalEffect(function(){if(i.current)i.current.scrollTop=0});return W("div",{className:"updates-container",children:[W("div",{className:"updates-header",children:W("div",{className:"updates-stats",children:[W("span",{children:["Updates: ",W("strong",{children:n.totalUpdates.value})]}),W("span",{children:["Signals: ",W("strong",{children:n.signalCounts.value.size})]})]})}),W("div",{className:"updates-list",ref:i,children:t.map(function(n){return W(gi,{node:n},n.id)})})]})}var yi=["adapter","container"],bi=function(n){try{var i=n.adapter,e=n.container,r=function(n,i){if(null==n)return{};var t={};for(var e in n)if({}.hasOwnProperty.call(n,e)){if(-1!==i.indexOf(e))continue;t[e]=n[e]}return t}(n,yi);ci(i);return Promise.resolve(i.connect()).then(function(){e.innerHTML="";z(W(wi,t({},r)),e);return function(){z(null,e);si()}})}catch(n){return Promise.reject(n)}};function wi(n){var i=void 0===n?{}:n,t=i.hideHeader,e=void 0===t?!1:t,r=i.initialTab,o=void 0===r?"updates":r,u=ri().connectionStore,a=useSignal(o);return W("div",{id:"app",className:"signals-devtools",children:[!e&&W(fi,{}),W(di,{}),W("main",{className:"main-content",children:[W("div",{className:"tabs",children:[W("button",{className:"tab "+("updates"===a.value?"active":""),onClick:function(){return a.value="updates"},children:"Updates"}),W("button",{className:"tab "+("graph"===a.value?"active":""),onClick:function(){return a.value="graph"},children:"Dependency Graph"})]}),W("div",{className:"tab-content",children:!u.isConnected?W(ii,{onRefresh:u.refreshConnection}):W(k,{children:["updates"===a.value&&W(mi,{}),"graph"===a.value&&W(vi,{})]})})]})]})}export{ni as Button,wi as DevToolsPanel,ii as EmptyState,vi as GraphVisualization,fi as Header,di as SettingsPanel,ti as StatusIndicator,pi as UpdateItem,gi as UpdateTreeNodeComponent,mi as UpdatesContainer,oi as createConnectionStore,li as createSettingsStore,ai as createUpdatesStore,si as destroyDevTools,ri as getContext,ci as initDevTools,bi as mount};//# sourceMappingURL=devtools-ui.module.js.map
1
+ function n(n,i){(null==i||i>n.length)&&(i=n.length);for(var t=0,e=Array(i);t<i;t++)e[t]=n[t];return e}function i(i,t){var e="undefined"!=typeof Symbol&&i[Symbol.iterator]||i["@@iterator"];if(e)return(e=e.call(i)).next.bind(e);if(Array.isArray(i)||(e=function(i,t){if(i){if("string"==typeof i)return n(i,t);var e={}.toString.call(i).slice(8,-1);return"Object"===e&&i.constructor&&(e=i.constructor.name),"Map"===e||"Set"===e?Array.from(i):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(i,t):void 0}}(i))||t&&i&&"number"==typeof i.length){e&&(i=e);var r=0;return function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(){return t=Object.assign?Object.assign.bind():function(n){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var e in t)({}).hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n},t.apply(null,arguments)}var e,r,o,a,u,l,c,f,s,d,h,v,p={},m=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function b(n,i){for(var t in i)n[t]=i[t];return n}function w(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function N(n,i,t,e,a){var u={type:n,props:i,key:t,ref:e,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==a?++o:a,__i:-1,__u:0};return null==a&&null!=r.vnode&&r.vnode(u),u}function k(n){return n.children}function _(n,i){this.props=n,this.context=i}function C(n,i){if(null==i)return n.__?C(n.__,n.__i+1):null;for(var t;i<n.__k.length;i++)if(null!=(t=n.__k[i])&&null!=t.__e)return t.__e;return"function"==typeof n.type?C(n):null}function x(n){var i,t;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,i=0;i<n.__k.length;i++)if(null!=(t=n.__k[i])&&null!=t.__e){n.__e=n.__c.base=t.__e;break}return x(n)}}function M(n){(!n.__d&&(n.__d=!0)&&u.push(n)&&!S.__r++||l!=r.debounceRendering)&&((l=r.debounceRendering)||c)(S)}function S(){for(var n,i,t,e,o,a,l,c=1;u.length;)u.length>c&&u.sort(f),n=u.shift(),c=u.length,n.__d&&(t=void 0,e=void 0,o=(e=(i=n).__v).__e,a=[],l=[],i.__P&&((t=b({},e)).__v=e.__v+1,r.vnode&&r.vnode(t),I(i.__P,t,e,i.__n,i.__P.namespaceURI,32&e.__u?[o]:null,a,null==o?C(e):o,!!(32&e.__u),l),t.__v=e.__v,t.__.__k[t.__i]=t,j(a,t,l),e.__e=e.__=null,t.__e!=o&&x(t)));S.__r=0}function A(n,i,t,e,r,o,a,u,l,c,f){var s,d,h,v,g,b,w,_=e&&e.__k||m,x=i.length;for(l=function(n,i,t,e,r){var o,a,u,l,c,f=t.length,s=f,d=0;for(n.__k=new Array(r),o=0;o<r;o++)null!=(a=i[o])&&"boolean"!=typeof a&&"function"!=typeof a?(l=o+d,(a=n.__k[o]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?N(null,a,null,null,null):y(a)?N(k,{children:a},null,null,null):null==a.constructor&&a.__b>0?N(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=n,a.__b=n.__b+1,u=null,-1!=(c=a.__i=U(a,t,l,s))&&(s--,(u=t[c])&&(u.__u|=2)),null==u||null==u.__v?(-1==c&&(r>f?d--:r<f&&d++),"function"!=typeof a.type&&(a.__u|=4)):c!=l&&(c==l-1?d--:c==l+1?d++:(c>l?d--:d++,a.__u|=4))):n.__k[o]=null;if(s)for(o=0;o<f;o++)null!=(u=t[o])&&0==(2&u.__u)&&(u.__e==e&&(e=C(u)),R(u,u));return e}(t,i,_,l,x),s=0;s<x;s++)null!=(h=t.__k[s])&&(d=-1==h.__i?p:_[h.__i]||p,h.__i=s,b=I(n,h,d,r,o,a,u,l,c,f),v=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&L(d.ref,null,h),f.push(h.ref,h.__c||v,h)),null==g&&null!=v&&(g=v),(w=!!(4&h.__u))||d.__k===h.__k?l=P(h,l,n,w):"function"==typeof h.type&&void 0!==b?l=b:v&&(l=v.nextSibling),h.__u&=-7);return t.__e=g,l}function P(n,i,t,e){var r,o;if("function"==typeof n.type){for(r=n.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=n,i=P(r[o],i,t,e));return i}n.__e!=i&&(e&&(i&&n.type&&!i.parentNode&&(i=C(n)),t.insertBefore(n.__e,i||null)),i=n.__e);do{i=i&&i.nextSibling}while(null!=i&&8==i.nodeType);return i}function U(n,i,t,e){var r,o,a,u=n.key,l=n.type,c=i[t],f=null!=c&&0==(2&c.__u);if(null===c&&null==n.key||f&&u==c.key&&l==c.type)return t;if(e>(f?1:0))for(r=t-1,o=t+1;r>=0||o<i.length;)if(null!=(c=i[a=r>=0?r--:o++])&&0==(2&c.__u)&&u==c.key&&l==c.type)return a;return-1}function T(n,i,t){"-"==i[0]?n.setProperty(i,null==t?"":t):n[i]=null==t?"":"number"!=typeof t||g.test(i)?t:t+"px"}function D(n,i,t,e,r){var o,a;n:if("style"==i)if("string"==typeof t)n.style.cssText=t;else{if("string"==typeof e&&(n.style.cssText=e=""),e)for(i in e)t&&i in t||T(n.style,i,"");if(t)for(i in t)e&&t[i]==e[i]||T(n.style,i,t[i])}else if("o"==i[0]&&"n"==i[1])o=i!=(i=i.replace(s,"$1")),a=i.toLowerCase(),i=a in n||"onFocusOut"==i||"onFocusIn"==i?a.slice(2):i.slice(2),n.l||(n.l={}),n.l[i+o]=t,t?e?t.u=e.u:(t.u=d,n.addEventListener(i,o?v:h,o)):n.removeEventListener(i,o?v:h,o);else{if("http://www.w3.org/2000/svg"==r)i=i.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=i&&"height"!=i&&"href"!=i&&"list"!=i&&"form"!=i&&"tabIndex"!=i&&"download"!=i&&"rowSpan"!=i&&"colSpan"!=i&&"role"!=i&&"popover"!=i&&i in n)try{n[i]=null==t?"":t;break n}catch(n){}"function"==typeof t||(null==t||!1===t&&"-"!=i[4]?n.removeAttribute(i):n.setAttribute(i,"popover"==i&&1==t?"":t))}}function E(n){return function(i){if(this.l){var t=this.l[i.type+n];if(null==i.t)i.t=d++;else if(i.t<t.u)return;return t(r.event?r.event(i):i)}}}function I(n,i,t,o,a,u,l,c,f,s){var d,h,v,m,g,N,x,M,S,P,U,T,E,I,j,L,R,q=i.type;if(null!=i.constructor)return null;128&t.__u&&(f=!!(32&t.__u),u=[c=i.__e=t.__e]),(d=r.__b)&&d(i);n:if("function"==typeof q)try{if(M=i.props,S="prototype"in q&&q.prototype.render,P=(d=q.contextType)&&o[d.__c],U=d?P?P.props.value:d.__:o,t.__c?x=(h=i.__c=t.__c).__=h.__E:(S?i.__c=h=new q(M,U):(i.__c=h=new _(M,U),h.constructor=q,h.render=$),P&&P.sub(h),h.props=M,h.state||(h.state={}),h.context=U,h.__n=o,v=h.__d=!0,h.__h=[],h.m=[]),S&&null==h.__s&&(h.__s=h.state),S&&null!=q.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=b({},h.__s)),b(h.__s,q.getDerivedStateFromProps(M,h.__s))),m=h.props,g=h.state,h.__v=i,v)S&&null==q.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),S&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(S&&null==q.getDerivedStateFromProps&&M!==m&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(M,U),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(M,h.__s,U)||i.__v==t.__v){for(i.__v!=t.__v&&(h.props=M,h.state=h.__s,h.__d=!1),i.__e=t.__e,i.__k=t.__k,i.__k.some(function(n){n&&(n.__=i)}),T=0;T<h.m.length;T++)h.__h.push(h.m[T]);h.m=[],h.__h.length&&l.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(M,h.__s,U),S&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(m,g,N)})}if(h.context=U,h.props=M,h.__P=n,h.__e=!1,E=r.__r,I=0,S){for(h.state=h.__s,h.__d=!1,E&&E(i),d=h.render(h.props,h.state,h.context),j=0;j<h.m.length;j++)h.__h.push(h.m[j]);h.m=[]}else do{h.__d=!1,E&&E(i),d=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++I<25);h.state=h.__s,null!=h.getChildContext&&(o=b(b({},o),h.getChildContext())),S&&!v&&null!=h.getSnapshotBeforeUpdate&&(N=h.getSnapshotBeforeUpdate(m,g)),L=d,null!=d&&d.type===k&&null==d.key&&(L=F(d.props.children)),c=A(n,y(L)?L:[L],i,t,o,a,u,l,c,f,s),h.base=i.__e,i.__u&=-161,h.__h.length&&l.push(h),x&&(h.__E=h.__=null)}catch(n){if(i.__v=null,f||null!=u)if(n.then){for(i.__u|=f?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;u[u.indexOf(c)]=null,i.__e=c}else{for(R=u.length;R--;)w(u[R]);O(i)}else i.__e=t.__e,i.__k=t.__k,n.then||O(i);r.__e(n,i,t)}else null==u&&i.__v==t.__v?(i.__k=t.__k,i.__e=t.__e):c=i.__e=function(n,i,t,o,a,u,l,c,f){var s,d,h,v,m,g,b,N=t.props,k=i.props,_=i.type;if("svg"==_?a="http://www.w3.org/2000/svg":"math"==_?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),null!=u)for(s=0;s<u.length;s++)if((m=u[s])&&"setAttribute"in m==!!_&&(_?m.localName==_:3==m.nodeType)){n=m,u[s]=null;break}if(null==n){if(null==_)return document.createTextNode(k);n=document.createElementNS(a,_,k.is&&k),c&&(r.__m&&r.__m(i,u),c=!1),u=null}if(null==_)N===k||c&&n.data==k||(n.data=k);else{if(u=u&&e.call(n.childNodes),N=t.props||p,!c&&null!=u)for(N={},s=0;s<n.attributes.length;s++)N[(m=n.attributes[s]).name]=m.value;for(s in N)if(m=N[s],"children"==s);else if("dangerouslySetInnerHTML"==s)h=m;else if(!(s in k)){if("value"==s&&"defaultValue"in k||"checked"==s&&"defaultChecked"in k)continue;D(n,s,null,m,a)}for(s in k)m=k[s],"children"==s?v=m:"dangerouslySetInnerHTML"==s?d=m:"value"==s?g=m:"checked"==s?b=m:c&&"function"!=typeof m||N[s]===m||D(n,s,m,N[s],a);if(d)c||h&&(d.__html==h.__html||d.__html==n.innerHTML)||(n.innerHTML=d.__html),i.__k=[];else if(h&&(n.innerHTML=""),A("template"==i.type?n.content:n,y(v)?v:[v],i,t,o,"foreignObject"==_?"http://www.w3.org/1999/xhtml":a,u,l,u?u[0]:t.__k&&C(t,0),c,f),null!=u)for(s=u.length;s--;)w(u[s]);c||(s="value","progress"==_&&null==g?n.removeAttribute("value"):null!=g&&(g!==n[s]||"progress"==_&&!g||"option"==_&&g!=N[s])&&D(n,s,g,N[s],a),s="checked",null!=b&&b!=n[s]&&D(n,s,b,N[s],a))}return n}(t.__e,i,t,o,a,u,l,f,s);return(d=r.diffed)&&d(i),128&i.__u?void 0:c}function O(n){n&&n.__c&&(n.__c.__e=!0),n&&n.__k&&n.__k.forEach(O)}function j(n,i,t){for(var e=0;e<t.length;e++)L(t[e],t[++e],t[++e]);r.__c&&r.__c(i,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(n){n.call(i)})}catch(n){r.__e(n,i.__v)}})}function F(n){return"object"!=typeof n||null==n||n.__b&&n.__b>0?n:y(n)?n.map(F):b({},n)}function L(n,i,t){try{if("function"==typeof n){var e="function"==typeof n.__u;e&&n.__u(),e&&null==i||(n.__u=n(i))}else n.current=i}catch(n){r.__e(n,t)}}function R(n,i,t){var e,o;if(r.unmount&&r.unmount(n),(e=n.ref)&&(e.current&&e.current!=n.__e||L(e,null,i)),null!=(e=n.__c)){if(e.componentWillUnmount)try{e.componentWillUnmount()}catch(n){r.__e(n,i)}e.base=e.__P=null}if(e=n.__k)for(o=0;o<e.length;o++)e[o]&&R(e[o],i,t||"function"!=typeof n.type);t||w(n.__e),n.__c=n.__=n.__e=void 0}function $(n,i,t){return this.constructor(n,t)}function q(n,i,t){var o,a,u,l;i==document&&(i=document.documentElement),r.__&&r.__(n,i),a=(o="function"==typeof t)?null:t&&t.__k||i.__k,u=[],l=[],I(i,n=(!o&&t||i).__k=function(n,i,t){var r,o,a,u={};for(a in i)"key"==a?r=i[a]:"ref"==a?o=i[a]:u[a]=i[a];if(arguments.length>2&&(u.children=arguments.length>3?e.call(arguments,2):t),"function"==typeof n&&null!=n.defaultProps)for(a in n.defaultProps)void 0===u[a]&&(u[a]=n.defaultProps[a]);return N(n,u,r,o,null)}(k,null,[n]),a||p,p,i.namespaceURI,!o&&t?[t]:a?null:i.firstChild?e.call(i.childNodes):null,u,!o&&t?t:a?a.__e:i.firstChild,o,l),j(u,n,l)}e=m.slice,r={__e:function(n,i,t,e){for(var r,o,a;i=i.__;)if((r=i.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(n)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(n,e||{}),a=r.__d),a)return r.__E=r}catch(i){n=i}throw n}},o=0,a=function(n){return null!=n&&null==n.constructor},_.prototype.setState=function(n,i){var t;t=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=b({},this.state),"function"==typeof n&&(n=n(b({},t),this.props)),n&&b(t,n),null!=n&&this.__v&&(i&&this.m.push(i),M(this))},_.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),M(this))},_.prototype.render=k,u=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,i){return n.__v.__b-i.__v.__b},S.__r=0,s=/(PointerCapture)$|Capture$/i,d=0,h=E(!1),v=E(!0);var z=0;function H(n,i,t,e,o,a){i||(i={});var u,l,c=i;if("ref"in c)for(l in c={},i)"ref"==l?u=i[l]:c[l]=i[l];var f={type:n,props:c,key:t,ref:u,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--z,__i:-1,__u:0,__source:o,__self:a};if("function"==typeof n&&(u=n.defaultProps))for(l in u)void 0===c[l]&&(c[l]=u[l]);return r.vnode&&r.vnode(f),f}var W,G,J,B,V=0,Z=[],X=r,Y=X.__b,K=X.__r,Q=X.diffed,nn=X.__c,tn=X.unmount,en=X.__;function rn(n,i){X.__h&&X.__h(G,n,V||i),V=0;var t=G.__H||(G.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function on(n,i){var t=rn(W++,3);!X.__s&&hn(t.__H,i)&&(t.__=n,t.u=i,G.__H.__h.push(t))}function an(n){return V=5,un(function(){return{current:n}},[])}function un(n,i){var t=rn(W++,7);return hn(t.__H,i)&&(t.__=n(),t.__H=i,t.__h=n),t.__}function ln(){for(var n;n=Z.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(sn),n.__H.__h.forEach(dn),n.__H.__h=[]}catch(i){n.__H.__h=[],X.__e(i,n.__v)}}X.__b=function(n){G=null,Y&&Y(n)},X.__=function(n,i){n&&i.__k&&i.__k.__m&&(n.__m=i.__k.__m),en&&en(n,i)},X.__r=function(n){K&&K(n),W=0;var i=(G=n.__c).__H;i&&(J===G?(i.__h=[],G.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(i.__h.forEach(sn),i.__h.forEach(dn),i.__h=[],W=0)),J=G},X.diffed=function(n){Q&&Q(n);var i=n.__c;i&&i.__H&&(i.__H.__h.length&&(1!==Z.push(i)&&B===X.requestAnimationFrame||((B=X.requestAnimationFrame)||fn)(ln)),i.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),J=G=null},X.__c=function(n,i){i.some(function(n){try{n.__h.forEach(sn),n.__h=n.__h.filter(function(n){return!n.__||dn(n)})}catch(t){i.some(function(n){n.__h&&(n.__h=[])}),i=[],X.__e(t,n.__v)}}),nn&&nn(n,i)},X.unmount=function(n){tn&&tn(n);var i,t=n.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{sn(n)}catch(n){i=n}}),t.__H=void 0,i&&X.__e(i,t.__v))};var cn="function"==typeof requestAnimationFrame;function fn(n){var i,t=function(){clearTimeout(e),cn&&cancelAnimationFrame(i),setTimeout(n)},e=setTimeout(t,35);cn&&(i=requestAnimationFrame(t))}function sn(n){var i=G,t=n.__c;"function"==typeof t&&(n.__c=void 0,t()),G=i}function dn(n){var i=G;n.__c=n.__(),G=i}function hn(n,i){return!n||n.length!==i.length||i.some(function(i,t){return i!==n[t]})}var vn=Symbol.for("preact-signals");function pn(){if(!(Nn>1)){var n,i=!1;while(void 0!==wn){var t=wn;wn=void 0;kn++;while(void 0!==t){var e=t.o;t.o=void 0;t.f&=-3;if(!(8&t.f)&&Sn(t))try{t.c()}catch(t){if(!i){n=t;i=!0}}t=e}}kn=0;Nn--;if(i)throw n}else Nn--}function mn(n){if(Nn>0)return n();Nn++;try{return n()}finally{pn()}}var gn=void 0;function yn(n){var i=gn;gn=void 0;try{return n()}finally{gn=i}}var bn,wn=void 0,Nn=0,kn=0,_n=0;function Cn(n){if(void 0!==gn){var i=n.n;if(void 0===i||i.t!==gn){i={i:0,S:n,p:gn.s,n:void 0,t:gn,e:void 0,x:void 0,r:i};if(void 0!==gn.s)gn.s.n=i;gn.s=i;n.n=i;if(32&gn.f)n.S(i);return i}else if(-1===i.i){i.i=0;if(void 0!==i.n){i.n.p=i.p;if(void 0!==i.p)i.p.n=i.n;i.p=gn.s;i.n=void 0;gn.s.n=i;gn.s=i}return i}}}function xn(n,i){this.v=n;this.i=0;this.n=void 0;this.t=void 0;this.W=null==i?void 0:i.watched;this.Z=null==i?void 0:i.unwatched;this.name=null==i?void 0:i.name}xn.prototype.brand=vn;xn.prototype.h=function(){return!0};xn.prototype.S=function(n){var i=this,t=this.t;if(t!==n&&void 0===n.e){n.x=t;this.t=n;if(void 0!==t)t.e=n;else yn(function(){var n;null==(n=i.W)||n.call(i)})}};xn.prototype.U=function(n){var i=this;if(void 0!==this.t){var t=n.e,e=n.x;if(void 0!==t){t.x=e;n.e=void 0}if(void 0!==e){e.e=t;n.x=void 0}if(n===this.t){this.t=e;if(void 0===e)yn(function(){var n;null==(n=i.Z)||n.call(i)})}}};xn.prototype.subscribe=function(n){var i=this;return jn(function(){var t=i.value,e=gn;gn=void 0;try{n(t)}finally{gn=e}},{name:"sub"})};xn.prototype.valueOf=function(){return this.value};xn.prototype.toString=function(){return this.value+""};xn.prototype.toJSON=function(){return this.value};xn.prototype.peek=function(){var n=gn;gn=void 0;try{return this.value}finally{gn=n}};Object.defineProperty(xn.prototype,"value",{get:function(){var n=Cn(this);if(void 0!==n)n.i=this.i;return this.v},set:function(n){if(n!==this.v){if(kn>100)throw new Error("Cycle detected");this.v=n;this.i++;_n++;Nn++;try{for(var i=this.t;void 0!==i;i=i.x)i.t.N()}finally{pn()}}}});function Mn(n,i){return new xn(n,i)}function Sn(n){for(var i=n.s;void 0!==i;i=i.n)if(i.S.i!==i.i||!i.S.h()||i.S.i!==i.i)return!0;return!1}function An(n){for(var i=n.s;void 0!==i;i=i.n){var t=i.S.n;if(void 0!==t)i.r=t;i.S.n=i;i.i=-1;if(void 0===i.n){n.s=i;break}}}function Pn(n){var i=n.s,t=void 0;while(void 0!==i){var e=i.p;if(-1===i.i){i.S.U(i);if(void 0!==e)e.n=i.n;if(void 0!==i.n)i.n.p=e}else t=i;i.S.n=i.r;if(void 0!==i.r)i.r=void 0;i=e}n.s=t}function Un(n,i){xn.call(this,void 0);this.x=n;this.s=void 0;this.g=_n-1;this.f=4;this.W=null==i?void 0:i.watched;this.Z=null==i?void 0:i.unwatched;this.name=null==i?void 0:i.name}Un.prototype=new xn;Un.prototype.h=function(){this.f&=-3;if(1&this.f)return!1;if(32==(36&this.f))return!0;this.f&=-5;if(this.g===_n)return!0;this.g=_n;this.f|=1;if(this.i>0&&!Sn(this)){this.f&=-2;return!0}var n=gn;try{An(this);gn=this;var i=this.x();if(16&this.f||this.v!==i||0===this.i){this.v=i;this.f&=-17;this.i++}}catch(n){this.v=n;this.f|=16;this.i++}gn=n;Pn(this);this.f&=-2;return!0};Un.prototype.S=function(n){if(void 0===this.t){this.f|=36;for(var i=this.s;void 0!==i;i=i.n)i.S.S(i)}xn.prototype.S.call(this,n)};Un.prototype.U=function(n){if(void 0!==this.t){xn.prototype.U.call(this,n);if(void 0===this.t){this.f&=-33;for(var i=this.s;void 0!==i;i=i.n)i.S.U(i)}}};Un.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var n=this.t;void 0!==n;n=n.x)n.t.N()}};Object.defineProperty(Un.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var n=Cn(this);this.h();if(void 0!==n)n.i=this.i;if(16&this.f)throw this.v;return this.v}});function Tn(n,i){return new Un(n,i)}function Dn(n){var i=n.u;n.u=void 0;if("function"==typeof i){Nn++;var t=gn;gn=void 0;try{i()}catch(i){n.f&=-2;n.f|=8;En(n);throw i}finally{gn=t;pn()}}}function En(n){for(var i=n.s;void 0!==i;i=i.n)i.S.U(i);n.x=void 0;n.s=void 0;Dn(n)}function In(n){if(gn!==this)throw new Error("Out-of-order effect");Pn(this);gn=n;this.f&=-2;if(8&this.f)En(this);pn()}function On(n,i){this.x=n;this.u=void 0;this.s=void 0;this.o=void 0;this.f=32;this.name=null==i?void 0:i.name;if(bn)bn.push(this)}On.prototype.c=function(){var n=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var i=this.x();if("function"==typeof i)this.u=i}finally{n()}};On.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1;this.f&=-9;Dn(this);An(this);Nn++;var n=gn;gn=this;return In.bind(this,n)};On.prototype.N=function(){if(!(2&this.f)){this.f|=2;this.o=wn;wn=this}};On.prototype.d=function(){this.f|=8;if(!(1&this.f))En(this)};On.prototype.dispose=function(){this.d()};function jn(n,i){var t=new On(n,i);try{t.c()}catch(n){t.d();throw n}var e=t.d.bind(t);e[Symbol.dispose]=e;return e}var Fn,Ln,Rn,$n="undefined"!=typeof window&&!!window.__PREACT_SIGNALS_DEVTOOLS__,qn=[],zn=[];jn(function(){Fn=this.N})();function Hn(n,i){r[n]=i.bind(null,r[n]||function(){})}function Wn(n){if(Rn)Rn();Rn=n&&n.S()}function Gn(n){var i=this,t=n.data,e=useSignal(t);e.value=t;var r=un(function(){var n=i,t=i.__v;while(t=t.__)if(t.__c){t.__c.__$f|=4;break}var r=Tn(function(){var n=e.value.value;return 0===n?0:!0===n?"":n||""}),o=Tn(function(){return!Array.isArray(r.value)&&!a(r.value)}),u=jn(function(){this.N=Kn;if(o.value){var i=r.value;if(n.__v&&n.__v.__e&&3===n.__v.__e.nodeType)n.__v.__e.data=i}}),l=i.__$u.d;i.__$u.d=function(){u();l.call(this)};return[o,r]},[]),o=r[0],u=r[1];return o.value?u.peek():u.value}Gn.displayName="ReactiveTextNode";Object.defineProperties(xn.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Gn},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Hn("__b",function(n,i){if("string"==typeof i.type){var t,e=i.props;for(var r in e)if("children"!==r){var o=e[r];if(o instanceof xn){if(!t)i.__np=t={};t[r]=o;e[r]=o.peek()}}}n(i)});Hn("__r",function(n,i){if(i.type!==k){Wn();var t,e=i.__c;if(e){e.__$f&=-2;if(void 0===(t=e.__$u))e.__$u=t=function(n,i){var t;jn(function(){t=this},{name:i});t.c=n;return t}(function(){var n;if($n)null==(n=t.y)||n.call(t);e.__$f|=1;e.setState({})},"function"==typeof i.type?i.type.displayName||i.type.name:"")}Ln=e;Wn(t)}n(i)});Hn("__e",function(n,i,t,e){Wn();Ln=void 0;n(i,t,e)});Hn("diffed",function(n,i){Wn();Ln=void 0;var t;if("string"==typeof i.type&&(t=i.__e)){var e=i.__np,r=i.props;if(e){var o=t.U;if(o)for(var a in o){var u=o[a];if(void 0!==u&&!(a in e)){u.d();o[a]=void 0}}else{o={};t.U=o}for(var l in e){var c=o[l],f=e[l];if(void 0===c){c=Jn(t,l,f,r);o[l]=c}else c.o(f,r)}}}n(i)});function Jn(n,i,t,e){var r=i in n&&void 0===n.ownerSVGElement,o=Mn(t);return{o:function(n,i){o.value=n;e=i},d:jn(function(){this.N=Kn;var t=o.value.value;if(e[i]!==t){e[i]=t;if(r)n[i]=t;else if(null!=t&&(!1!==t||"-"===i[4]))n.setAttribute(i,t);else n.removeAttribute(i)}})}}Hn("unmount",function(n,i){if("string"==typeof i.type){var t=i.__e;if(t){var e=t.U;if(e){t.U=void 0;for(var r in e){var o=e[r];if(o)o.d()}}}}else{var a=i.__c;if(a){var u=a.__$u;if(u){a.__$u=void 0;u.d()}}}n(i)});Hn("__h",function(n,i,t,e){if(e<3||9===e)i.__$f|=2;n(i,t,e)});_.prototype.shouldComponentUpdate=function(n,i){if(this.__R)return!0;var t=this.__$u,e=t&&void 0!==t.s;for(var r in i)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){var o=2&this.__$f;if(!(e||o||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(e||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var a in n)if("__source"!==a&&n[a]!==this.props[a])return!0;for(var u in this.props)if(!(u in n))return!0;return!1};function useSignal(n,i){return un(function(){return Mn(n,i)},[])}var Bn="undefined"==typeof requestAnimationFrame?setTimeout:function(n){var i=function(){clearTimeout(t);cancelAnimationFrame(e);n()},t=setTimeout(i,35),e=requestAnimationFrame(i)},Vn=function(n){queueMicrotask(function(){queueMicrotask(n)})};function Zn(){mn(function(){var n;while(n=qn.shift())Fn.call(n)})}function Xn(){if(1===qn.push(this))(r.requestAnimationFrame||Bn)(Zn)}function Yn(){mn(function(){var n;while(n=zn.shift())Fn.call(n)})}function Kn(){if(1===zn.push(this))(r.requestAnimationFrame||Vn)(Yn)}function useSignalEffect(n,i){var t=an(n);t.current=n;on(function(){return jn(function(){this.N=Xn;return t.current()},i)},[])}function Qn(n){var i=n.onClick,t=n.className,e=void 0===t?"":t,r=n.disabled,o=void 0===r?!1:r,a=n.children,u=n.variant,l=void 0===u?"secondary":u,c=n.popovertarget,f=n.active;return H("button",{popovertarget:c,onClick:i,className:("btn "+("primary"===l?"btn-primary":"btn-secondary")+" "+((void 0===f?0:f)?"active":"")+" "+e).trim(),disabled:o,children:a})}function ni(n){var i=n.onRefresh,t=n.title,e=void 0===t?"No Signals Detected":t,r=n.description,o=void 0===r?"Make sure your application is using @preact/signals-debug package.":r,a=n.buttonText,u=void 0===a?"Refresh Detection":a;return H("div",{className:"empty-state",children:H("div",{className:"empty-state-content",children:[H("h2",{children:e}),H("p",{children:o}),H("div",{className:"empty-state-actions",children:H(Qn,{onClick:i,variant:"primary",children:u})})]})})}function ii(n){var i=n.status,t=n.message,e=n.showIndicator,r=void 0===e?!0:e,o=n.className;return H("div",{className:"connection-status "+i+" "+(void 0===o?"":o),children:[r&&H("span",{className:"status-indicator "+i}),H("span",{className:"status-text",children:t})]})}var ti=null;function ei(){if(!ti)throw new Error("DevTools context not initialized. Call initDevTools() first.");return ti}function ri(n){var i=Mn("connecting"),t=Mn("Connecting..."),e=Mn(!1);n.on("connectionStatusChanged",function(n){i.value=n.status;t.value=n.message});n.on("signalsAvailable",function(n){e.value=n});return{get status(){return i.value},get message(){return t.value},get isConnected(){return e.value},refreshConnection:function(){i.value="connecting";t.value="Connecting...";n.requestState()}}}var oi=function(n,i){return n.update.signalId===i.update.signalId&&n.children.length===i.children.length&&n.children.every(function(n,t){return oi(n,i.children[t])})};function ai(n,e){var r=Mn([]),o=Mn(!1),a=Mn(new Set),u=function(n){if(Array.isArray(n))n.forEach(function(n){if("divider"!==n.type)n.receivedAt=Date.now()});else if("update"===n.type)n.receivedAt=Date.now();r.value=[].concat(r.value,Array.isArray(n)?n:[n])},l=Tn(function(){return r.value.length>0}),c=Tn(function(){var n=new Map;r.value.forEach(function(i){if("divider"!==i.type){var t=i.signalName||"Unknown";n.set(t,(n.get(t)||0)+1)}});return n}),f=Tn(function(){return function(n){for(var i=[],t=[],e=n.slice(-100).reverse(),r=0;r<e.length;r++){var o=e[r];if("divider"!==o.type){var a=o,u=a.depth||0,l={type:"single",id:a.signalName+"-"+a.receivedAt+"-"+r,update:a,children:[],depth:u,hasChildren:!1};while(t.length>0&&t[t.length-1].depth>=u)t.pop();if(0===t.length)i.push(l);else{var c=t[t.length-1];c.children.push(l);c.hasChildren=!0}t.push(l)}}return i}(r.value)});n.on("signalUpdate",function(n){if(!o.value){var i=[].concat(n).reverse();i.push({type:"divider"});u(i)}});n.on("signalDisposed",function(n){if(!o.value)!function(n){for(var t,e=Array.isArray(n)?n:[n],r=new Set(a.value),o=i(e);!(t=o()).done;){var u=t.value;if(u.signalId)r.add(u.signalId)}a.value=r}(n)});var s=Tn(function(){var n=f.value;if(e.settings.grouped)return function(n){for(var e,r,o=[],a=i(n);!(r=a()).done;){var u=r.value;if(!e||!oi(e,u)){o.push(u);e=u}else if("group"!==e.type){o.pop();e=t({},e,{type:"group",count:2,firstUpdate:u.update,firstChildren:u.children});o.push(e)}else{e.count++;e.firstUpdate=u.update;e.firstChildren=u.children}}return o}(n);else return n});return{updates:r,updateTree:f,collapsedUpdateTree:s,totalUpdates:Tn(function(){return Object.keys(f.value).length}),signalCounts:c,disposedSignalIds:a,addUpdate:u,clearUpdates:function(){r.value=[];a.value=new Set},hasUpdates:l,isPaused:o}}function ui(n){var i=Mn({enabled:!0,grouped:!0,consoleLogging:!0,maxUpdatesPerSecond:60,filterPatterns:[]}),t=Mn(!1);n.on("configReceived",function(n){if(n.settings)i.value=n.settings});return{get settings(){return i.value},get showDisposedSignals(){return t.value},set settings(n){i.value=n},applySettings:function(t){i.value=t;n.sendConfig(t)},toggleShowDisposedSignals:function(){t.value=!t.value}}}function li(n){var i=ui(n),t=ai(n,i),e=ri(n);return ti={adapter:n,connectionStore:e,updatesStore:t,settingsStore:i}}function ci(){if(ti){ti.adapter.disconnect();ti=null}}function fi(){var n=ei(),i=n.connectionStore,t=n.updatesStore,e=function(){t.isPaused.value=!t.isPaused.value},r=function(){t.clearUpdates()};return H("header",{className:"header",children:[H("div",{className:"header-title",children:[H("h1",{children:"Signals"}),H(ii,{status:i.status,message:i.message})]}),H("div",{className:"header-controls",children:[r&&H(Qn,{onClick:r,children:"Clear"}),e&&H(Qn,{onClick:e,active:t.isPaused.value,children:t.isPaused.value?"Resume":"Pause"}),H(Qn,{popovertarget:"settings-panel-popover",children:"Settings"})]})]})}function si(){var n=ei().settingsStore,i=an(null),e=n.applySettings,r=useSignal(n.settings);useSignalEffect(function(){r.value=n.settings});return H("div",{ref:i,popover:"auto",id:"settings-panel-popover",className:"settings-panel",children:H("div",{className:"settings-content",children:[H("h3",{children:"Debug Configuration"}),H("div",{className:"setting-group",children:H("label",{children:[H("input",{type:"checkbox",checked:r.value.enabled,onChange:function(n){return r.value=t({},r.value,{enabled:n.target.checked})}}),"Enable debug updates"]})}),H("div",{className:"setting-group",children:H("label",{children:[H("input",{type:"checkbox",checked:r.value.grouped,onChange:function(n){return r.value=t({},r.value,{grouped:n.target.checked})}}),"Group related updates"]})}),H("div",{className:"setting-group",children:[H("label",{children:[H("input",{type:"checkbox",checked:r.value.consoleLogging,onChange:function(n){return r.value=t({},r.value,{consoleLogging:n.target.checked})}}),"Enable console logging"]}),H("p",{className:"setting-description",children:"When disabled, signal updates will not be logged to the browser console."})]}),H("div",{className:"setting-group",children:[H("label",{htmlFor:"maxUpdatesInput",children:"Max updates per second:"}),H("input",{type:"number",id:"maxUpdatesInput",value:r.value.maxUpdatesPerSecond,min:"1",max:"1000",onChange:function(n){return r.value=t({},r.value,{maxUpdatesPerSecond:parseInt(n.target.value)||60})}})]}),H("div",{className:"setting-group",children:[H("label",{htmlFor:"filterPatternsInput",children:"Filter patterns (one per line):"}),H("textarea",{id:"filterPatternsInput",placeholder:"user.*\n.*State$\nglobal",value:r.value.filterPatterns.join("\n"),onChange:function(n){return r.value=t({},r.value,{filterPatterns:n.target.value.split("\n").map(function(n){return n.trim()}).filter(function(n){return n.length>0})})}})]}),H("h3",{children:"Graph Settings"}),H("div",{className:"setting-group",children:[H("label",{children:[H("input",{type:"checkbox",checked:n.showDisposedSignals,onChange:function(){return n.toggleShowDisposedSignals()}}),"Show disposed signals in graph"]}),H("p",{className:"setting-description",children:"When enabled, signals and effects that have been disposed will still be shown in the graph view."})]}),H("div",{className:"settings-actions",children:[H(Qn,{onClick:function(){e(r.value)},variant:"primary",children:"Apply"}),H(Qn,{onClick:function(){var n;null==(n=i.current)||n.hide()},children:"Cancel"})]})]})})}var di=function(n){var i=document.createElement("textarea");try{i.value=n;document.body.append(i);i.select();document.execCommand("copy")}finally{i.remove()}};function hi(){var n=ei(),t=n.updatesStore,e=n.settingsStore,r=t.updates,o=t.disposedSignalIds,a=an(null),u=an(null),l=an(null),c=useSignal({x:0,y:0}),f=useSignal(1),s=useSignal(!1),d=useSignal({x:0,y:0}),h=useSignal(!1),v=useSignal(),p=useSignal(null),m=useSignal({x:0,y:0});on(function(){var n=function(n){if(h.value&&l.current&&!l.current.contains(n.target))h.value=!1};document.addEventListener("mousedown",n);return function(){document.removeEventListener("mousedown",n)}},[]);var g=function(n,i){var t=an(n);t.current=n;Ln.__$f|=4;return un(function(){return Tn(function(){return t.current()},void 0)},[])}(function(){var n=r.value,t=o.value,a=e.showDisposedSignals;if(!n||0===n.length)return{nodes:[],links:[]};for(var u,l=new Map,c=new Map,f=n.filter(function(n){return"divider"!==n.type}),s=i(f);!(u=s()).done;){var d=u.value;if(d.signalId)if(a||!t.has(d.signalId)){var h=d.signalType;if(!l.has(d.signalId))l.set(d.signalId,{id:d.signalId,name:d.signalName,type:h,x:0,y:0,depth:0});if(d.allDependencies&&d.allDependencies.length>0)for(var v,p=i(d.allDependencies);!(v=p()).done;){var m=v.value;if(a||!t.has(m.id)){if(!l.has(m.id))l.set(m.id,{id:m.id,name:m.name,type:m.type,x:0,y:0,depth:0});var g=m.id+"->"+d.signalId;if(!c.has(g))c.set(g,{source:m.id,target:d.signalId})}}else if(d.subscribedTo){if(!a&&t.has(d.subscribedTo))continue;var y=d.subscribedTo+"->"+d.signalId;if(!c.has(y))c.set(y,{source:d.subscribedTo,target:d.signalId})}}}var b=Array.from(c.values()),w=function(n,i){var t=new Map,e=new Map,r=new Map;n.forEach(function(n,i){e.set(i,new Set);r.set(i,0)});i.forEach(function(n){var i;null==(i=e.get(n.source))||i.add(n.target);r.set(n.target,(r.get(n.target)||0)+1)});var o=[];n.forEach(function(n,i){if(0===r.get(i)){o.push(i);t.set(i,0)}});var a=function(){var n,i=o.shift(),a=t.get(i);null==(n=e.get(i))||n.forEach(function(n){var i,e=null!=(i=t.get(n))?i:0;t.set(n,Math.max(e,a+1));var u=(r.get(n)||0)-1;r.set(n,u);if(0===u)o.push(n)})};while(o.length>0)a();return t}(l,b);l.forEach(function(n,i){var t;n.depth=null!=(t=w.get(i))?t:0});var N=new Map;l.forEach(function(n){if(!N.has(n.depth))N.set(n.depth,[]);N.get(n.depth).push(n)});!function(n,i){var t=Array.from(n.keys()).sort(function(n,i){return n-i}),e=new Map,r=new Map;i.forEach(function(n){if(!e.has(n.source))e.set(n.source,[]);if(!r.has(n.target))r.set(n.target,[]);e.get(n.source).push(n.target);r.get(n.target).push(n.source)});for(var o=new Map,a=0;a<4;a++){for(var u=function(){var i=t[l],e=n.get(i);e.forEach(function(n,i){o.set(n.id,i)});if(0===l)return 1;var a=e.map(function(n){var i=r.get(n.id)||[];if(0===i.length)return 0;else return i.reduce(function(n,i){var t;return n+(null!=(t=o.get(i))?t:0)},0)/i.length}),u=e.map(function(n,i){return{node:n,barycenter:a[i]}}).sort(function(n,i){return n.barycenter-i.barycenter}).map(function(n){return n.node});n.set(i,u)},l=0;l<t.length;l++)if(!u());for(var c=function(){var i=t[f],r=n.get(i);r.forEach(function(n,i){o.set(n.id,i)});if(f===t.length-1)return 1;var a=r.map(function(n){var i=e.get(n.id)||[];if(0===i.length)return 0;else return i.reduce(function(n,i){var t;return n+(null!=(t=o.get(i))?t:0)},0)/i.length}),u=r.map(function(n,i){return{node:n,barycenter:a[i]}}).sort(function(n,i){return n.barycenter-i.barycenter}).map(function(n){return n.node});n.set(i,u)},f=t.length-1;f>=0;f--)if(!c());}}(N,b);N.forEach(function(n,i){var t=80-120*(n.length-1)/2;n.forEach(function(n,e){n.x=100+250*i;n.y=t+120*e+50*N.size})});return{nodes:Array.from(l.values()),links:b}}),y=function(){s.value=!1},b=/[^a-zA-Z0-9]/g,w=function(n){return n.replace(b,"_")},N=function(n){var i=6.5*n.name.length+16;return Math.max(30,Math.min(i/2,70))},k=function(n){var i=u.current;if(i&&p.value){var t=i.getBoundingClientRect();m.value={x:n.clientX-t.left,y:n.clientY-t.top}}},_=function(){p.value=null},C=function(n){v.value=n;setTimeout(function(){v.value=void 0},2e3)};if(0===g.value.nodes.length)return H("div",{className:"graph-empty",children:H("div",{children:[H("h3",{children:"No Signal Dependencies"}),H("p",{children:"Create some signals with dependencies to see the graph visualization."})]})});var x=Math.max.apply(Math,[800].concat(g.value.nodes.map(function(n){return n.x+100}))),M=Math.max.apply(Math,[600].concat(g.value.nodes.map(function(n){return n.y+100})));return H("div",{className:"graph-container",children:H("div",{ref:u,className:"graph-content",onMouseDown:function(n){if(0===n.button){s.value=!0;d.value={x:n.clientX-c.value.x,y:n.clientY-c.value.y}}},onMouseMove:function(n){if(s.value)c.value={x:n.clientX-d.value.x,y:n.clientY-d.value.y}},onMouseUp:y,onMouseLeave:y,onWheel:function(n){n.preventDefault();var i=u.current;if(i){var t=i.getBoundingClientRect(),e=n.clientX-t.left,r=n.clientY-t.top,o=n.deltaY>0?.96:1.04,a=Math.min(Math.max(.1,f.value*o),5),l=a/f.value;c.value={x:e-(e-c.value.x)*l,y:r-(r-c.value.y)*l};f.value=a}},style:{cursor:s.value?"grabbing":"grab"},children:[H("svg",{ref:a,className:"graph-svg",width:x,height:M,viewBox:"0 0 "+x+" "+M,children:[H("defs",{children:H("marker",{id:"arrowhead",markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto",children:H("polygon",{points:"0 0, 8 3, 0 6",fill:"#94a3b8"})})}),H("g",{transform:"translate("+c.value.x+", "+c.value.y+") scale("+f.value+")",children:[H("g",{className:"links",children:g.value.links.map(function(n,i){var t=g.value.nodes.find(function(i){return i.id===n.source}),e=g.value.nodes.find(function(i){return i.id===n.target});if(!t||!e)return null;var r=N(t),o=N(e),a=t.x+r,u=t.y,l=e.x-o-8,c=e.y,f=a+.5*(l-a);return H("path",{className:"graph-link",d:"M "+a+" "+u+" C "+f+" "+u+", "+f+" "+c+", "+l+" "+c,fill:"none",markerEnd:"url(#arrowhead)"},"link-"+i)})}),H("g",{className:"nodes",children:g.value.nodes.map(function(n){var i,t=N(n),e=Math.floor((2*t-16)/6.5),r=n.name.length>e?n.name.slice(0,e-1)+"…":n.name;return H("g",{className:"graph-node-group "+((null==(i=p.value)?void 0:i.id)===n.id?"hovered":""),onMouseEnter:function(i){return function(n,i){p.value=n;var t=u.current;if(t){var e=t.getBoundingClientRect();m.value={x:i.clientX-e.left,y:i.clientY-e.top}}}(n,i)},onMouseMove:k,onMouseLeave:_,children:[H("circle",{className:"graph-node "+n.type,cx:n.x,cy:n.y,r:t}),H("text",{className:"graph-text",x:n.x,y:n.y,textAnchor:"middle",dominantBaseline:"central",children:r})]},n.id)})})]})]}),H("div",{className:"graph-controls",children:[H("button",{className:"graph-reset-button",onClick:function(){c.value={x:0,y:0};f.value=1},title:"Reset view",children:"⟲ Reset View"}),H("div",{ref:l,className:"graph-export-container",children:[H("button",{className:"graph-export-button",onClick:function(){h.value=!h.value},title:"Export graph",children:"↓ Export"}),h.value&&H("div",{className:"graph-export-menu",children:[H("button",{className:"graph-export-menu-item",onClick:function(){try{h.value=!1;var n=["graph LR"];g.value.nodes.forEach(function(i){var t=w(i.id),e=i.name;switch(i.type){case"signal":n.push(" "+t+"(("+e+"))");break;case"computed":n.push(" "+t+"("+e+")");break;case"effect":n.push(" "+t+"(["+e+"])");break;case"component":n.push(" "+t+"{{"+e+"}}")}});for(var t,e=i(g.value.links);!(t=e()).done;){var r=t.value,o=w(r.source),a=w(r.target);n.push(" "+o+" --\x3e "+a)}di(n.join("\n"));C("Copied to clipboard!");return Promise.resolve()}catch(n){return Promise.reject(n)}},children:"Mermaid"}),H("button",{className:"graph-export-menu-item",onClick:function(){try{h.value=!1;var n=JSON.stringify(g.value,null,2);di(n);C("Copied to clipboard!");return Promise.resolve()}catch(n){return Promise.reject(n)}},children:"JSON"})]})]}),H("div",{className:"graph-zoom-indicator",title:"Zoom level",children:[Math.round(100*f.value),"%"]})]}),v.value&&H("div",{className:"graph-toast",children:v.value}),p.value&&H("div",{className:"graph-tooltip",style:{left:m.value.x+12,top:m.value.y-8},children:[H("div",{className:"tooltip-header",children:H("span",{className:"tooltip-type "+p.value.type,children:p.value.type})}),H("div",{className:"tooltip-name",children:p.value.name}),H("div",{className:"tooltip-id",children:["ID: ",p.value.id]})]}),H("div",{className:"graph-legend",children:[H("div",{className:"legend-item",children:[H("div",{className:"legend-color",style:{backgroundColor:"#2196f3"}}),H("span",{children:"Signal"})]}),H("div",{className:"legend-item",children:[H("div",{className:"legend-color",style:{backgroundColor:"#ff9800"}}),H("span",{children:"Computed"})]}),H("div",{className:"legend-item",children:[H("div",{className:"legend-color",style:{backgroundColor:"#4caf50"}}),H("span",{children:"Effect"})]}),H("div",{className:"legend-item",children:[H("div",{className:"legend-color",style:{backgroundColor:"#9c27b0"}}),H("span",{children:"Component"})]})]})]})})}function vi(n){var i=n.update,t=n.count,e=n.firstUpdate,r=new Date(i.timestamp||i.receivedAt).toLocaleTimeString(),o=function(n){if(null===n)return"null";if(void 0===n)return"undefined";if("string"==typeof n)return'"'+n+'"';if("function"==typeof n)return"function()";if("object"==typeof n)try{return JSON.stringify(n,null,0)}catch(n){return"[Object]"}return String(n)},a=t&&H("span",{class:"update-count",title:"Number of grouped identical updates",children:["x",t]});if("effect"===i.type||"component"===i.type){var u="component"===i.type?"🔄":"↪️",l="component"===i.type?"Component render":"Effect";return H("div",{className:"update-item "+i.type,children:H("div",{className:"update-header",children:[H("span",{className:"signal-name",children:[u," ",i.signalName,a]}),H("span",{className:"update-type-badge",children:l}),H("span",{className:"update-time",children:r})]})})}var c=o(i.prevValue),f=o(i.newValue),s=void 0!==e?o(e.prevValue):void 0;return H("div",{class:"update-item "+i.type,children:[H("div",{class:"update-header",children:[H("span",{class:"signal-name",children:[0===i.depth?"🎯":"↪️"," ",i.signalName,a]}),H("span",{class:"update-time",children:r})]}),H("div",{class:"value-change",children:[s&&s!==c&&H(k,{children:[H("span",{class:"value-prev",children:s}),H("span",{class:"value-arrow",children:"..."})]}),H("span",{class:"value-prev",children:c}),H("span",{class:"value-arrow",children:"→"}),H("span",{class:"value-new",children:f})]})]})}function pi(n){var i,e=n.node,r=useSignal(!1),o=e.children.length>0,a="group"===e.type?e.count:void 0,u="group"===e.type?e.firstUpdate:void 0;if("group"===e.type&&e.firstChildren)i=e.children.map(function(n,i){var r=e.firstChildren[i];return t({},n,{type:"group",firstUpdate:r.update,firstChildren:r.children,count:e.count})});else i=e.children;return H("div",{className:"tree-node",children:[H("div",{className:"tree-node-content",children:[o&&H("button",{className:"collapse-button",onClick:function(){r.value=!r.value},"aria-label":r.value?"Expand":"Collapse",children:r.value?"▶":"▼"}),!o&&H("div",{className:"collapse-spacer"}),H("div",{className:"update-content",children:H(vi,{update:e.update,count:a,firstUpdate:u})})]}),o&&!r.value&&H("div",{className:"tree-children",children:i.map(function(n){return H(pi,{node:n},n.id)})})]})}function mi(){var n=ei().updatesStore,i=an(null),t=n.collapsedUpdateTree.value;useSignalEffect(function(){if(i.current)i.current.scrollTop=0});return H("div",{className:"updates-container",children:[H("div",{className:"updates-header",children:H("div",{className:"updates-stats",children:[H("span",{children:["Updates: ",H("strong",{children:n.totalUpdates.value})]}),H("span",{children:["Signals: ",H("strong",{children:n.signalCounts.value.size})]})]})}),H("div",{className:"updates-list",ref:i,children:t.map(function(n){return H(pi,{node:n},n.id)})})]})}var gi=["adapter","container"],yi=function(n){try{var i=n.adapter,e=n.container,r=function(n,i){if(null==n)return{};var t={};for(var e in n)if({}.hasOwnProperty.call(n,e)){if(-1!==i.indexOf(e))continue;t[e]=n[e]}return t}(n,gi);li(i);return Promise.resolve(i.connect()).then(function(){e.innerHTML="";q(H(bi,t({},r)),e);return function(){q(null,e);ci()}})}catch(n){return Promise.reject(n)}};function bi(n){var i=void 0===n?{}:n,t=i.hideHeader,e=void 0===t?!1:t,r=i.initialTab,o=void 0===r?"updates":r,a=ei().connectionStore,u=useSignal(o);return H("div",{className:"signals-devtools",children:[!e&&H(fi,{}),H(si,{}),H("main",{className:"main-content",children:[H("div",{className:"tabs",children:[H("button",{className:"tab "+("updates"===u.value?"active":""),onClick:function(){return u.value="updates"},children:"Updates"}),H("button",{className:"tab "+("graph"===u.value?"active":""),onClick:function(){return u.value="graph"},children:"Dependency Graph"})]}),H("div",{className:"tab-content",children:!a.isConnected?H(ni,{onRefresh:a.refreshConnection}):H(k,{children:["updates"===u.value&&H(mi,{}),"graph"===u.value&&H(hi,{})]})})]})]})}export{Qn as Button,bi as DevToolsPanel,ni as EmptyState,hi as GraphVisualization,fi as Header,si as SettingsPanel,ii as StatusIndicator,vi as UpdateItem,pi as UpdateTreeNodeComponent,mi as UpdatesContainer,ri as createConnectionStore,ui as createSettingsStore,ai as createUpdatesStore,ci as destroyDevTools,ei as getContext,li as initDevTools,yi as mount};//# sourceMappingURL=devtools-ui.module.js.map