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