@preact/signals-devtools-ui 0.1.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 ADDED
@@ -0,0 +1,12 @@
1
+ # @preact/signals-devtools-ui
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#815](https://github.com/preactjs/signals/pull/815) [`53e802a`](https://github.com/preactjs/signals/commit/53e802ad8d9d70b6e4635729892307ea15cbd32f) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Initial release
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`53e802a`](https://github.com/preactjs/signals/commit/53e802ad8d9d70b6e4635729892307ea15cbd32f)]:
12
+ - @preact/signals-devtools-adapter@0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022-present Preact Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # @preact/signals-devtools-ui
2
+
3
+ DevTools UI components for Preact Signals. This package provides a reusable UI that can be embedded in various contexts - browser extensions, iframes, overlays, blog posts, etc.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @preact/signals-devtools-ui @preact/signals-devtools-adapter
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Embedded in a page (for demos, blog posts, etc.)
14
+
15
+ ```tsx
16
+ import { mount } from "@preact/signals-devtools-ui";
17
+ import { createDirectAdapter } from "@preact/signals-devtools-adapter";
18
+ import "@preact/signals-devtools-ui/styles";
19
+
20
+ // Create a direct adapter (connects directly to signals on the page)
21
+ const adapter = createDirectAdapter();
22
+
23
+ // Mount the DevTools UI
24
+ const unmount = await mount({
25
+ adapter,
26
+ container: document.getElementById("devtools-container")!,
27
+ });
28
+
29
+ // Later, to cleanup:
30
+ unmount();
31
+ ```
32
+
33
+ ### In a browser extension
34
+
35
+ ```tsx
36
+ import { mount } from "@preact/signals-devtools-ui";
37
+ import { createBrowserExtensionAdapter } from "@preact/signals-devtools-adapter";
38
+ import "@preact/signals-devtools-ui/styles";
39
+
40
+ const adapter = createBrowserExtensionAdapter();
41
+
42
+ await mount({
43
+ adapter,
44
+ container: document.getElementById("app")!,
45
+ });
46
+ ```
47
+
48
+ ### In an iframe
49
+
50
+ ```tsx
51
+ import { mount } from "@preact/signals-devtools-ui";
52
+ import { createPostMessageAdapter } from "@preact/signals-devtools-adapter";
53
+ import "@preact/signals-devtools-ui/styles";
54
+
55
+ const adapter = createPostMessageAdapter({
56
+ sourceWindow: window,
57
+ sourceOrigin: "https://your-app.com",
58
+ targetWindow: window.parent,
59
+ targetOrigin: "https://your-app.com",
60
+ });
61
+
62
+ await mount({
63
+ adapter,
64
+ container: document.getElementById("devtools")!,
65
+ });
66
+ ```
67
+
68
+ ## Using Individual Components
69
+
70
+ You can also use individual components for custom layouts:
71
+
72
+ ```tsx
73
+ import {
74
+ initDevTools,
75
+ Header,
76
+ UpdatesContainer,
77
+ GraphVisualization,
78
+ } from "@preact/signals-devtools-ui";
79
+ import { createDirectAdapter } from "@preact/signals-devtools-adapter";
80
+
81
+ const adapter = createDirectAdapter();
82
+ await adapter.connect();
83
+ initDevTools(adapter);
84
+
85
+ function MyCustomDevTools() {
86
+ return (
87
+ <div>
88
+ <Header />
89
+ <div className="my-layout">
90
+ <UpdatesContainer />
91
+ <GraphVisualization />
92
+ </div>
93
+ </div>
94
+ );
95
+ }
96
+ ```
97
+
98
+ ## Props
99
+
100
+ ### `mount(options)`
101
+
102
+ | Option | Type | Required | Description |
103
+ | ------------ | ---------------------- | -------- | -------------------------------- |
104
+ | `adapter` | `DevToolsAdapter` | Yes | The communication adapter to use |
105
+ | `container` | `HTMLElement` | Yes | The DOM element to render into |
106
+ | `hideHeader` | `boolean` | No | Hide the header bar |
107
+ | `initialTab` | `"updates" \| "graph"` | No | Which tab to show initially |
108
+
109
+ ### `DevToolsPanel`
110
+
111
+ | Prop | Type | Default | Description |
112
+ | ------------ | ---------------------- | ----------- | ---------------------- |
113
+ | `hideHeader` | `boolean` | `false` | Hide the header bar |
114
+ | `initialTab` | `"updates" \| "graph"` | `"updates"` | Initial tab to display |
115
+
116
+ ## Styling
117
+
118
+ The package includes CSS styles. Import them in your app:
119
+
120
+ ```ts
121
+ import "@preact/signals-devtools-ui/styles";
122
+ ```
123
+
124
+ Or include the CSS file from the dist folder manually.
125
+
126
+ ## Available Components
127
+
128
+ - `DevToolsPanel` - Main panel component
129
+ - `Header` - Header with status and controls
130
+ - `SettingsPanel` - Debug settings configuration
131
+ - `UpdatesContainer` - Signal updates list
132
+ - `GraphVisualization` - Dependency graph
133
+ - `EmptyState` - Empty state placeholder
134
+ - `StatusIndicator` - Connection status indicator
135
+ - `Button` - Styled button component
136
+
137
+ ## License
138
+
139
+ MIT
@@ -0,0 +1,5 @@
1
+ export { DevToolsPanel, mount, type MountOptions, type DevToolsPanelProps, } from "./DevToolsPanel";
2
+ export { initDevTools, destroyDevTools, getContext, createConnectionStore, createUpdatesStore, createSettingsStore, type DevToolsContext, type SignalUpdate, type UpdateTreeNode, type UpdateTreeNodeSingle, type UpdateTreeNodeGroup, type Divider, } from "./context";
3
+ export type { GraphNode, GraphLink, GraphData } from "./types";
4
+ export { Button, EmptyState, GraphVisualization, Header, SettingsPanel, StatusIndicator, UpdateItem, UpdateTreeNodeComponent, UpdatesContainer, } from "./components";
5
+ export type { DevToolsAdapter, Settings, ConnectionStatus, ConnectionStatusType, } from "@preact/signals-devtools-adapter";
@@ -0,0 +1 @@
1
+ function n(n,t){(null==t||t>n.length)&&(t=n.length);for(var i=0,e=Array(t);i<t;i++)e[i]=n[i];return e}function t(t,i){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,i){if(t){if("string"==typeof t)return n(t,i);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){e&&(t=e);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[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 i(){return i=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var e in i)({}).hasOwnProperty.call(i,e)&&(n[e]=i[e])}return n},i.apply(null,arguments)}var e,r,o,u,a,l,c,s,f,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,t){for(var i in t)n[i]=t[i];return n}function w(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function N(n,t,i,e,u){var a={type:n,props:t,key:i,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 x(n){return n.children}function k(n,t){this.props=n,this.context=t}function _(n,t){if(null==t)return n.__?_(n.__,n.__i+1):null;for(var i;t<n.__k.length;t++)if(null!=(i=n.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof n.type?_(n):null}function C(n){var t,i;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,t=0;t<n.__k.length;t++)if(null!=(i=n.__k[t])&&null!=i.__e){n.__e=n.__c.base=i.__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,t,i,e,o,u,l,c=1;a.length;)a.length>c&&a.sort(s),n=a.shift(),c=a.length,n.__d&&(i=void 0,e=void 0,o=(e=(t=n).__v).__e,u=[],l=[],t.__P&&((i=b({},e)).__v=e.__v+1,r.vnode&&r.vnode(i),O(t.__P,i,e,t.__n,t.__P.namespaceURI,32&e.__u?[o]:null,u,null==o?_(e):o,!!(32&e.__u),l),i.__v=e.__v,i.__.__k[i.__i]=i,j(u,i,l),e.__e=e.__=null,i.__e!=o&&C(i)));M.__r=0}function A(n,t,i,e,r,o,u,a,l,c,s){var f,d,h,v,g,b,w,k=e&&e.__k||m,C=t.length;for(l=function(n,t,i,e,r){var o,u,a,l,c,s=i.length,f=s,d=0;for(n.__k=new Array(r),o=0;o<r;o++)null!=(u=t[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(x,{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,i,l,f))&&(f--,(a=i[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=i[o])&&0==(2&a.__u)&&(a.__e==e&&(e=_(a)),q(a,a));return e}(i,t,k,l,C),f=0;f<C;f++)null!=(h=i.__k[f])&&(d=-1==h.__i?p:k[h.__i]||p,h.__i=f,b=O(n,h,d,r,o,u,a,l,c,s),v=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&$(d.ref,null,h),s.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 i.__e=g,l}function P(n,t,i,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,t=P(r[o],t,i,e));return t}n.__e!=t&&(e&&(t&&n.type&&!t.parentNode&&(t=_(n)),i.insertBefore(n.__e,t||null)),t=n.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function U(n,t,i,e){var r,o,u,a=n.key,l=n.type,c=t[i],s=null!=c&&0==(2&c.__u);if(null===c&&null==n.key||s&&a==c.key&&l==c.type)return i;if(e>(s?1:0))for(r=i-1,o=i+1;r>=0||o<t.length;)if(null!=(c=t[u=r>=0?r--:o++])&&0==(2&c.__u)&&a==c.key&&l==c.type)return u;return-1}function T(n,t,i){"-"==t[0]?n.setProperty(t,null==i?"":i):n[t]=null==i?"":"number"!=typeof i||g.test(t)?i:i+"px"}function D(n,t,i,e,r){var o,u;n:if("style"==t)if("string"==typeof i)n.style.cssText=i;else{if("string"==typeof e&&(n.style.cssText=e=""),e)for(t in e)i&&t in i||T(n.style,t,"");if(i)for(t in i)e&&i[t]==e[t]||T(n.style,t,i[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(f,"$1")),u=t.toLowerCase(),t=u in n||"onFocusOut"==t||"onFocusIn"==t?u.slice(2):t.slice(2),n.l||(n.l={}),n.l[t+o]=i,i?e?i.u=e.u:(i.u=d,n.addEventListener(t,o?v:h,o)):n.removeEventListener(t,o?v:h,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==i?"":i;break n}catch(n){}"function"==typeof i||(null==i||!1===i&&"-"!=t[4]?n.removeAttribute(t):n.setAttribute(t,"popover"==t&&1==i?"":i))}}function I(n){return function(t){if(this.l){var i=this.l[t.type+n];if(null==t.t)t.t=d++;else if(t.t<i.u)return;return i(r.event?r.event(t):t)}}}function O(n,t,i,e,o,u,a,l,c,s){var f,d,h,v,p,m,g,N,_,C,S,M,P,U,T,D,I,O=t.type;if(null!=t.constructor)return null;128&i.__u&&(c=!!(32&i.__u),u=[l=t.__e=i.__e]),(f=r.__b)&&f(t);n:if("function"==typeof O)try{if(N=t.props,_="prototype"in O&&O.prototype.render,C=(f=O.contextType)&&e[f.__c],S=f?C?C.props.value:f.__:e,i.__c?g=(d=t.__c=i.__c).__=d.__E:(_?t.__c=d=new O(N,S):(t.__c=d=new k(N,S),d.constructor=O,d.render=L),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=[]),_&&null==d.__s&&(d.__s=d.state),_&&null!=O.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=b({},d.__s)),b(d.__s,O.getDerivedStateFromProps(N,d.__s))),v=d.props,p=d.state,d.__v=t,h)_&&null==O.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),_&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(_&&null==O.getDerivedStateFromProps&&N!==v&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(N,S),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(N,d.__s,S)||t.__v==i.__v){for(t.__v!=i.__v&&(d.props=N,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(N,d.__s,S),_&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(v,p,m)})}if(d.context=S,d.props=N,d.__P=n,d.__e=!1,P=r.__r,U=0,_){for(d.state=d.__s,d.__d=!1,P&&P(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,P&&P(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&&(e=b(b({},e),d.getChildContext())),_&&!h&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(v,p)),D=f,null!=f&&f.type===x&&null==f.key&&(D=F(f.props.children)),l=A(n,y(D)?D:[D],t,i,e,o,u,a,l,c,s),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),g&&(d.__E=d.__=null)}catch(n){if(t.__v=null,c||null!=u)if(n.then){for(t.__u|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;u[u.indexOf(l)]=null,t.__e=l}else{for(I=u.length;I--;)w(u[I]);E(t)}else t.__e=i.__e,t.__k=i.__k,n.then||E(t);r.__e(n,t,i)}else null==u&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):l=t.__e=R(i.__e,t,i,e,o,u,a,c,s);return(f=r.diffed)&&f(t),128&t.__u?void 0:l}function E(n){n&&n.__c&&(n.__c.__e=!0),n&&n.__k&&n.__k.forEach(E)}function j(n,t,i){for(var e=0;e<i.length;e++)$(i[e],i[++e],i[++e]);r.__c&&r.__c(t,n),n.some(function(t){try{n=t.__h,t.__h=[],n.some(function(n){n.call(t)})}catch(n){r.__e(n,t.__v)}})}function F(n){return"object"!=typeof n||null==n||n.__b&&n.__b>0?n:y(n)?n.map(F):b({},n)}function R(n,t,i,o,u,a,l,c,s){var f,d,h,v,m,g,b,N=i.props,x=t.props,k=t.type;if("svg"==k?u="http://www.w3.org/2000/svg":"math"==k?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((m=a[f])&&"setAttribute"in m==!!k&&(k?m.localName==k:3==m.nodeType)){n=m,a[f]=null;break}if(null==n){if(null==k)return document.createTextNode(x);n=document.createElementNS(u,k,x.is&&x),c&&(r.__m&&r.__m(t,a),c=!1),a=null}if(null==k)N===x||c&&n.data==x||(n.data=x);else{if(a=a&&e.call(n.childNodes),N=i.props||p,!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)h=m;else if(!(f in x)){if("value"==f&&"defaultValue"in x||"checked"==f&&"defaultChecked"in x)continue;D(n,f,null,m,u)}for(f in x)m=x[f],"children"==f?v=m:"dangerouslySetInnerHTML"==f?d=m:"value"==f?g=m:"checked"==f?b=m:c&&"function"!=typeof m||N[f]===m||D(n,f,m,N[f],u);if(d)c||h&&(d.__html==h.__html||d.__html==n.innerHTML)||(n.innerHTML=d.__html),t.__k=[];else if(h&&(n.innerHTML=""),A("template"==t.type?n.content:n,y(v)?v:[v],t,i,o,"foreignObject"==k?"http://www.w3.org/1999/xhtml":u,a,l,a?a[0]:i.__k&&_(i,0),c,s),null!=a)for(f=a.length;f--;)w(a[f]);c||(f="value","progress"==k&&null==g?n.removeAttribute("value"):null!=g&&(g!==n[f]||"progress"==k&&!g||"option"==k&&g!=N[f])&&D(n,f,g,N[f],u),f="checked",null!=b&&b!=n[f]&&D(n,f,b,N[f],u))}return n}function $(n,t,i){try{if("function"==typeof n){var e="function"==typeof n.__u;e&&n.__u(),e&&null==t||(n.__u=n(t))}else n.current=t}catch(n){r.__e(n,i)}}function q(n,t,i){var e,o;if(r.unmount&&r.unmount(n),(e=n.ref)&&(e.current&&e.current!=n.__e||$(e,null,t)),null!=(e=n.__c)){if(e.componentWillUnmount)try{e.componentWillUnmount()}catch(n){r.__e(n,t)}e.base=e.__P=null}if(e=n.__k)for(o=0;o<e.length;o++)e[o]&&q(e[o],t,i||"function"!=typeof n.type);i||w(n.__e),n.__c=n.__=n.__e=void 0}function L(n,t,i){return this.constructor(n,i)}function z(n,t,i){var o,u,a,l;t==document&&(t=document.documentElement),r.__&&r.__(n,t),u=(o="function"==typeof i)?null:i&&i.__k||t.__k,a=[],l=[],O(t,n=(!o&&i||t).__k=function(n,t,i){var r,o,u,a={};for(u in t)"key"==u?r=t[u]:"ref"==u?o=t[u]:a[u]=t[u];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):i),"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)}(x,null,[n]),u||p,p,t.namespaceURI,!o&&i?[i]:u?null:t.firstChild?e.call(t.childNodes):null,a,!o&&i?i:u?u.__e:t.firstChild,o,l),j(a,n,l)}e=m.slice,r={__e:function(n,t,i,e){for(var r,o,u;t=t.__;)if((r=t.__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(t){n=t}throw n}},o=0,u=function(n){return null!=n&&null==n.constructor},k.prototype.setState=function(n,t){var i;i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=b({},this.state),"function"==typeof n&&(n=n(b({},i),this.props)),n&&b(i,n),null!=n&&this.__v&&(t&&this.m.push(t),S(this))},k.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),S(this))},k.prototype.render=x,a=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,s=function(n,t){return n.__v.__b-t.__v.__b},M.__r=0,f=/(PointerCapture)$|Capture$/i,d=0,h=I(!1),v=I(!0);var H=0;function G(n,t,i,e,o,u){t||(t={});var a,l,c=t;if("ref"in c)for(l in c={},t)"ref"==l?a=t[l]:c[l]=t[l];var s={type:n,props:c,key:i,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 J,W,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,t){Y.__h&&Y.__h(W,n,Z||t),Z=0;var i=W.__H||(W.__H={__:[],__h:[]});return n>=i.__.length&&i.__.push({}),i.__[n]}function un(n,t){var i=on(J++,3);!Y.__s&&vn(i.__H,t)&&(i.__=n,i.u=t,W.__H.__h.push(i))}function an(n){return Z=5,ln(function(){return{current:n}},[])}function ln(n,t){var i=on(J++,7);return vn(i.__H,t)&&(i.__=n(),i.__H=t,i.__h=n),i.__}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(t){n.__H.__h=[],Y.__e(t,n.__v)}}Y.__b=function(n){W=null,K&&K(n)},Y.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),rn&&rn(n,t)},Y.__r=function(n){Q&&Q(n),J=0;var t=(W=n.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(dn),t.__h.forEach(hn),t.__h=[],J=0)),B=W},Y.diffed=function(n){nn&&nn(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==X.push(t)&&V===Y.requestAnimationFrame||((V=Y.requestAnimationFrame)||fn)(cn)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),B=W=null},Y.__c=function(n,t){t.some(function(n){try{n.__h.forEach(dn),n.__h=n.__h.filter(function(n){return!n.__||hn(n)})}catch(i){t.some(function(n){n.__h&&(n.__h=[])}),t=[],Y.__e(i,n.__v)}}),tn&&tn(n,t)},Y.unmount=function(n){en&&en(n);var t,i=n.__c;i&&i.__H&&(i.__H.__.forEach(function(n){try{dn(n)}catch(n){t=n}}),i.__H=void 0,t&&Y.__e(t,i.__v))};var sn="function"==typeof requestAnimationFrame;function fn(n){var t,i=function(){clearTimeout(e),sn&&cancelAnimationFrame(t),setTimeout(n)},e=setTimeout(i,35);sn&&(t=requestAnimationFrame(i))}function dn(n){var t=W,i=n.__c;"function"==typeof i&&(n.__c=void 0,i()),W=t}function hn(n){var t=W;n.__c=n.__(),W=t}function vn(n,t){return!n||n.length!==t.length||t.some(function(t,i){return t!==n[i]})}function pn(n,t){return"function"==typeof t?t(n):t}var mn=Symbol.for("preact-signals");function gn(){if(!(xn>1)){var n,t=!1;while(void 0!==Nn){var i=Nn;Nn=void 0;kn++;while(void 0!==i){var e=i.o;i.o=void 0;i.f&=-3;if(!(8&i.f)&&An(i))try{i.c()}catch(i){if(!t){n=i;t=!0}}i=e}}kn=0;xn--;if(t)throw n}else xn--}function yn(n){if(xn>0)return n();xn++;try{return n()}finally{gn()}}var bn=void 0;function wn(n){var t=bn;bn=void 0;try{return n()}finally{bn=t}}var Nn=void 0,xn=0,kn=0,_n=0;function Cn(n){if(void 0!==bn){var t=n.n;if(void 0===t||t.t!==bn){t={i:0,S:n,p:bn.s,n:void 0,t:bn,e:void 0,x:void 0,r:t};if(void 0!==bn.s)bn.s.n=t;bn.s=t;n.n=t;if(32&bn.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=bn.s;t.n=void 0;bn.s.n=t;bn.s=t}return t}}}function Sn(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}Sn.prototype.brand=mn;Sn.prototype.h=function(){return!0};Sn.prototype.S=function(n){var t=this,i=this.t;if(i!==n&&void 0===n.e){n.x=i;this.t=n;if(void 0!==i)i.e=n;else wn(function(){var n;null==(n=t.W)||n.call(t)})}};Sn.prototype.U=function(n){var t=this;if(void 0!==this.t){var i=n.e,e=n.x;if(void 0!==i){i.x=e;n.e=void 0}if(void 0!==e){e.e=i;n.x=void 0}if(n===this.t){this.t=e;if(void 0===e)wn(function(){var n;null==(n=t.Z)||n.call(t)})}}};Sn.prototype.subscribe=function(n){var t=this;return Fn(function(){var i=t.value,e=bn;bn=void 0;try{n(i)}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(kn>100)throw new Error("Cycle detected");this.v=n;this.i++;_n++;xn++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{gn()}}}});function Mn(n,t){return new Sn(n,t)}function An(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 Pn(n){for(var t=n.s;void 0!==t;t=t.n){var i=t.S.n;if(void 0!==i)t.r=i;t.S.n=t;t.i=-1;if(void 0===t.n){n.s=t;break}}}function Un(n){var t=n.s,i=void 0;while(void 0!==t){var e=t.p;if(-1===t.i){t.S.U(t);if(void 0!==e)e.n=t.n;if(void 0!==t.n)t.n.p=e}else i=t;t.S.n=t.r;if(void 0!==t.r)t.r=void 0;t=e}n.s=i}function Tn(n,t){Sn.call(this,void 0);this.x=n;this.s=void 0;this.g=_n-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}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===_n)return!0;this.g=_n;this.f|=1;if(this.i>0&&!An(this)){this.f&=-2;return!0}var n=bn;try{Pn(this);bn=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++}bn=n;Un(this);this.f&=-2;return!0};Tn.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)}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 t=this.s;void 0!==t;t=t.n)t.S.U(t)}}};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,t){return new Tn(n,t)}function In(n){var t=n.u;n.u=void 0;if("function"==typeof t){xn++;var i=bn;bn=void 0;try{t()}catch(t){n.f&=-2;n.f|=8;On(n);throw t}finally{bn=i;gn()}}}function On(n){for(var t=n.s;void 0!==t;t=t.n)t.S.U(t);n.x=void 0;n.s=void 0;In(n)}function En(n){if(bn!==this)throw new Error("Out-of-order effect");Un(this);bn=n;this.f&=-2;if(8&this.f)On(this);gn()}function jn(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}jn.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()}};jn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1;this.f&=-9;In(this);Pn(this);xn++;var n=bn;bn=this;return En.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))On(this)};jn.prototype.dispose=function(){this.d()};function Fn(n,t){var i=new jn(n,t);try{i.c()}catch(n){i.d();throw n}var e=i.d.bind(i);e[Symbol.dispose]=e;return e}var Rn,$n,qn,Ln="undefined"!=typeof window&&!!window.__PREACT_SIGNALS_DEVTOOLS__,zn=[],Hn=[];Fn(function(){Rn=this.N})();function Gn(n,t){r[n]=t.bind(null,r[n]||function(){})}function Jn(n){if(qn)qn();qn=n&&n.S()}function Wn(n){var t=this,i=n.data,e=useSignal(i);e.value=i;var r=ln(function(){var n=t,i=t.__v;while(i=i.__)if(i.__c){i.__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 t=r.value;if(n.__v&&n.__v.__e&&3===n.__v.__e.nodeType)n.__v.__e.data=t}}),l=t.__$u.d;t.__$u.d=function(){a();l.call(this)};return[o,r]},[]),o=r[0],a=r[1];return o.value?a.peek():a.value}Wn.displayName="ReactiveTextNode";Object.defineProperties(Sn.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}});Gn("__b",function(n,t){if("string"==typeof t.type){var i,e=t.props;for(var r in e)if("children"!==r){var o=e[r];if(o instanceof Sn){if(!i)t.__np=i={};i[r]=o;e[r]=o.peek()}}}n(t)});Gn("__r",function(n,t){if(t.type!==x){Jn();var i,e=t.__c;if(e){e.__$f&=-2;if(void 0===(i=e.__$u))e.__$u=i=function(n,t){var i;Fn(function(){i=this},{name:t});i.c=n;return i}(function(){var n;if(Ln)null==(n=i.y)||n.call(i);e.__$f|=1;e.setState({})},"function"==typeof t.type?t.type.displayName||t.type.name:"")}$n=e;Jn(i)}n(t)});Gn("__e",function(n,t,i,e){Jn();$n=void 0;n(t,i,e)});Gn("diffed",function(n,t){Jn();$n=void 0;var i;if("string"==typeof t.type&&(i=t.__e)){var e=t.__np,r=t.props;if(e){var o=i.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={};i.U=o}for(var l in e){var c=o[l],s=e[l];if(void 0===c){c=Bn(i,l,s,r);o[l]=c}else c.o(s,r)}}}n(t)});function Bn(n,t,i,e){var r=t in n&&void 0===n.ownerSVGElement,o=Mn(i);return{o:function(n,t){o.value=n;e=t},d:Fn(function(){this.N=Qn;var i=o.value.value;if(e[t]!==i){e[t]=i;if(r)n[t]=i;else if(null!=i&&(!1!==i||"-"===t[4]))n.setAttribute(t,i);else n.removeAttribute(t)}})}}Gn("unmount",function(n,t){if("string"==typeof t.type){var i=t.__e;if(i){var e=i.U;if(e){i.U=void 0;for(var r in e){var o=e[r];if(o)o.d()}}}}else{var u=t.__c;if(u){var a=u.__$u;if(a){u.__$u=void 0;a.d()}}}n(t)});Gn("__h",function(n,t,i,e){if(e<3||9===e)t.__$f|=2;n(t,i,e)});k.prototype.shouldComponentUpdate=function(n,t){var i=this.__$u,e=i&&void 0!==i.s;for(var r in t)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,t){return function(n){return Z=1,function(n,t,i){var e=on(J++,2);if(e.t=n,!e.__c&&(e.__=[i?i(t):pn(void 0,t),function(n){var t=e.__N?e.__N[0]:e.__[0],i=e.t(t,n);t!==i&&(e.__N=[i,e.__[1]],e.__c.setState({}))}],e.__c=W,!W.__f)){var r=function(n,t,i){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,t,i);var u=e.__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]&&(u=!0)}}),o&&o.call(this,n,t,i)||u};W.__f=!0;var o=W.shouldComponentUpdate,u=W.componentWillUpdate;W.componentWillUpdate=function(n,t,i){if(this.__e){var e=o;o=void 0,r(n,t,i),o=e}u&&u.call(this,n,t,i)},W.shouldComponentUpdate=r}return e.__N||e.__}(pn,n)}(function(){return Mn(n,t)})[0]}var Vn="undefined"==typeof requestAnimationFrame?setTimeout:function(n){var t=function(){clearTimeout(i);cancelAnimationFrame(e);n()},i=setTimeout(t,35),e=requestAnimationFrame(t)},Zn=function(n){queueMicrotask(function(){queueMicrotask(n)})};function Xn(){yn(function(){var n;while(n=zn.shift())Rn.call(n)})}function Yn(){if(1===zn.push(this))(r.requestAnimationFrame||Vn)(Xn)}function Kn(){yn(function(){var n;while(n=Hn.shift())Rn.call(n)})}function Qn(){if(1===Hn.push(this))(r.requestAnimationFrame||Zn)(Kn)}function useSignalEffect(n,t){var i=an(n);i.current=n;un(function(){return Fn(function(){this.N=Yn;return i.current()},t)},[])}function nt(n){var t=n.onClick,i=n.className,e=void 0===i?"":i,r=n.disabled,o=void 0===r?!1:r,u=n.children,a=n.variant,l=void 0===a?"secondary":a,c=n.active;return G("button",{onClick:t,className:("btn "+("primary"===l?"btn-primary":"btn-secondary")+" "+((void 0===c?0:c)?"active":"")+" "+e).trim(),disabled:o,children:u})}function tt(n){var t=n.onRefresh,i=n.title,e=void 0===i?"No Signals Detected":i,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 G("div",{className:"empty-state",children:G("div",{className:"empty-state-content",children:[G("h2",{children:e}),G("p",{children:o}),G("div",{className:"empty-state-actions",children:G(nt,{onClick:t,variant:"primary",children:a})})]})})}function it(n){var t=n.status,i=n.message,e=n.showIndicator,r=void 0===e?!0:e,o=n.className;return G("div",{className:"connection-status "+t+" "+(void 0===o?"":o),children:[r&&G("span",{className:"status-indicator "+t}),G("span",{className:"status-text",children:i})]})}var et=null;function rt(){if(!et)throw new Error("DevTools context not initialized. Call initDevTools() first.");return et}function ot(n){var t=Mn("connecting"),i=Mn("Connecting..."),e=Mn(!1);n.on("connectionStatusChanged",function(n){t.value=n.status;i.value=n.message});n.on("signalsAvailable",function(n){e.value=n});return{get status(){return t.value},get message(){return i.value},get isConnected(){return e.value},refreshConnection:function(){t.value="connecting";i.value="Connecting...";n.requestState()}}}var ut=function(n,t){return n.update.signalId===t.update.signalId&&n.children.length===t.children.length&&n.children.every(function(n,i){return ut(n,t.children[i])})};function at(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(t){if("divider"!==t.type){var i=t.signalName||"Unknown";n.set(i,(n.get(i)||0)+1)}});return n}),s=Dn(function(){return function(n){for(var t=[],i=[],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(i.length>0&&i[i.length-1].depth>=a)i.pop();if(0===i.length)t.push(l);else{var c=i[i.length-1];c.children.push(l);c.hasChildren=!0}i.push(l)}}return t}(r.value)});n.on("signalUpdate",function(n){if(!o.value){var t=[].concat(n).reverse();t.push({type:"divider"});a(t)}});n.on("signalDisposed",function(n){if(!o.value)!function(n){for(var i,e=Array.isArray(n)?n:[n],r=new Set(u.value),o=t(e);!(i=o()).done;){var a=i.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=t(n);!(r=u()).done;){var a=r.value;if(!e||!ut(e,a)){o.push(a);e=a}else if("group"!==e.type){o.pop();e=i({},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 lt(n){var t=Mn({enabled:!0,grouped:!0,maxUpdatesPerSecond:60,filterPatterns:[]}),i=Mn(!1),e=Mn(!1);n.on("configReceived",function(n){if(n.settings)t.value=n.settings});return{get settings(){return t.value},get showSettings(){return i.value},get showDisposedSignals(){return e.value},set settings(n){t.value=n},applySettings:function(e){t.value=e;n.sendConfig(e);i.value=!1},toggleSettings:function(){i.value=!i.value},hideSettings:function(){i.value=!1},toggleShowDisposedSignals:function(){e.value=!e.value}}}function ct(n){var t=lt(n),i=at(n,t),e=ot(n);return et={adapter:n,connectionStore:e,updatesStore:i,settingsStore:t}}function st(){if(et){et.adapter.disconnect();et=null}}function ft(){var n=rt(),t=n.connectionStore,i=n.updatesStore,e=n.settingsStore.toggleSettings,r=function(){i.isPaused.value=!i.isPaused.value},o=function(){i.clearUpdates()};return G("header",{className:"header",children:[G("div",{className:"header-title",children:[G("h1",{children:"Signals"}),G(it,{status:t.status,message:t.message})]}),G("div",{className:"header-controls",children:[o&&G(nt,{onClick:o,children:"Clear"}),r&&G(nt,{onClick:r,active:i.isPaused.value,children:i.isPaused.value?"Resume":"Pause"}),e&&G(nt,{onClick:e,children:"Settings"})]})]})}function dt(){var n=rt().settingsStore,t=n.hideSettings,e=n.applySettings,r=n.settings,o=n.showSettings,u=useSignal(r);useSignalEffect(function(){u.value=n.settings});if(!o)return null;else return G("div",{className:"settings-panel",children:G("div",{className:"settings-content",children:[G("h3",{children:"Debug Configuration"}),G("div",{className:"setting-group",children:G("label",{children:[G("input",{type:"checkbox",checked:u.value.enabled,onChange:function(n){return u.value=i({},u.value,{enabled:n.target.checked})}}),"Enable debug updates"]})}),G("div",{className:"setting-group",children:G("label",{children:[G("input",{type:"checkbox",checked:u.value.grouped,onChange:function(n){return u.value=i({},u.value,{grouped:n.target.checked})}}),"Group related updates"]})}),G("div",{className:"setting-group",children:[G("label",{htmlFor:"maxUpdatesInput",children:"Max updates per second:"}),G("input",{type:"number",id:"maxUpdatesInput",value:u.value.maxUpdatesPerSecond,min:"1",max:"1000",onChange:function(n){return u.value=i({},u.value,{maxUpdatesPerSecond:parseInt(n.target.value)||60})}})]}),G("div",{className:"setting-group",children:[G("label",{htmlFor:"filterPatternsInput",children:"Filter patterns (one per line):"}),G("textarea",{id:"filterPatternsInput",placeholder:"user.*\n.*State$\nglobal",value:u.value.filterPatterns.join("\n"),onChange:function(n){return u.value=i({},u.value,{filterPatterns:n.target.value.split("\n").map(function(n){return n.trim()}).filter(function(n){return n.length>0})})}})]}),G("h3",{children:"Graph Settings"}),G("div",{className:"setting-group",children:[G("label",{children:[G("input",{type:"checkbox",checked:n.showDisposedSignals,onChange:function(){return n.toggleShowDisposedSignals()}}),"Show disposed signals in graph"]}),G("p",{className:"setting-description",children:"When enabled, signals and effects that have been disposed will still be shown in the graph view."})]}),G("div",{className:"settings-actions",children:[G(nt,{onClick:function(){e(u.value)},variant:"primary",children:"Apply"}),G(nt,{onClick:t,children:"Cancel"})]})]})})}var ht=function(n){var t=document.createElement("textarea");try{t.value=n;document.body.append(t);t.select();document.execCommand("copy")}finally{t.remove()}};function vt(){var n=rt(),i=n.updatesStore,e=n.settingsStore,r=i.updates,o=i.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),m=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 g=function(n,t){var i=an(n);i.current=n;$n.__$f|=4;return ln(function(){return Dn(function(){return i.current()},void 0)},[])}(function(){var n=r.value,i=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=t(s);!(a=f()).done;){var d=a.value;if(d.signalId)if(u||!i.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&&i.has(d.subscribedTo))continue;var p=d.subscribedTo+"->"+d.signalId;if(!c.has(p))c.set(p,{source:d.subscribedTo,target:d.signalId})}}}var m=Array.from(l.values()),g=new Map;m.forEach(function(n){if(!g.has(n.depth))g.set(n.depth,[]);g.get(n.depth).push(n)});var y=Math.max.apply(Math,m.map(function(n){return n.depth}));g.forEach(function(n,t){var i=120*(n.length-1),e=80+100*y-i/2;n.forEach(function(n,i){n.x=100+250*t;n.y=e+120*i})});return{nodes:m,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 t=6.5*n.name.length+16;return Math.max(30,Math.min(t/2,70))},x=function(n){var t=a.current;if(t&&p.value){var i=t.getBoundingClientRect();m.value={x:n.clientX-i.left,y:n.clientY-i.top}}},k=function(){p.value=null},_=function(n){v.value=n;setTimeout(function(){v.value=void 0},2e3)};if(0===g.value.nodes.length)return G("div",{className:"graph-empty",children:G("div",{children:[G("h3",{children:"No Signal Dependencies"}),G("p",{children:"Create some signals with dependencies to see the graph visualization."})]})});var C=Math.max.apply(Math,[800].concat(g.value.nodes.map(function(n){return n.x+100}))),S=Math.max.apply(Math,[600].concat(g.value.nodes.map(function(n){return n.y+100})));return G("div",{className:"graph-container",children:G("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 t=a.current;if(t){var i=t.getBoundingClientRect(),e=n.clientX-i.left,r=n.clientY-i.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:[G("svg",{ref:u,className:"graph-svg",width:C,height:S,viewBox:"0 0 "+C+" "+S,children:[G("defs",{children:G("marker",{id:"arrowhead",markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto",children:G("polygon",{points:"0 0, 8 3, 0 6",fill:"#94a3b8"})})}),G("g",{transform:"translate("+c.value.x+", "+c.value.y+") scale("+s.value+")",children:[G("g",{className:"links",children:g.value.links.map(function(n,t){var i=g.value.nodes.find(function(t){return t.id===n.source}),e=g.value.nodes.find(function(t){return t.id===n.target});if(!i||!e)return null;var r=N(i),o=N(e),u=i.x+r,a=i.y,l=e.x-o-8,c=e.y,s=u+.5*(l-u);return G("path",{className:"graph-link",d:"M "+u+" "+a+" C "+s+" "+a+", "+s+" "+c+", "+l+" "+c,fill:"none",markerEnd:"url(#arrowhead)"},"link-"+t)})}),G("g",{className:"nodes",children:g.value.nodes.map(function(n){var t,i=N(n),e=Math.floor((2*i-16)/6.5),r=n.name.length>e?n.name.slice(0,e-1)+"…":n.name;return G("g",{className:"graph-node-group "+((null==(t=p.value)?void 0:t.id)===n.id?"hovered":""),onMouseEnter:function(t){return function(n,t){p.value=n;var i=a.current;if(i){var e=i.getBoundingClientRect();m.value={x:t.clientX-e.left,y:t.clientY-e.top}}}(n,t)},onMouseMove:x,onMouseLeave:k,children:[G("circle",{className:"graph-node "+n.type,cx:n.x,cy:n.y,r:i}),G("text",{className:"graph-text",x:n.x,y:n.y,textAnchor:"middle",dominantBaseline:"central",children:r})]},n.id)})})]})]}),G("div",{className:"graph-controls",children:[G("button",{className:"graph-reset-button",onClick:function(){c.value={x:0,y:0};s.value=1},title:"Reset view",children:"⟲ Reset View"}),G("div",{ref:l,className:"graph-export-container",children:[G("button",{className:"graph-export-button",onClick:function(){h.value=!h.value},title:"Export graph",children:"↓ Export"}),h.value&&G("div",{className:"graph-export-menu",children:[G("button",{className:"graph-export-menu-item",onClick:function(){try{h.value=!1;var n=["graph LR"];g.value.nodes.forEach(function(t){var i=w(t.id),e=t.name;switch(t.type){case"signal":n.push(" "+i+"(("+e+"))");break;case"computed":n.push(" "+i+"("+e+")");break;case"effect":n.push(" "+i+"(["+e+"])")}});for(var i,e=t(g.value.links);!(i=e()).done;){var r=i.value,o=w(r.source),u=w(r.target);n.push(" "+o+" --\x3e "+u)}ht(n.join("\n"));_("Copied to clipboard!");return Promise.resolve()}catch(n){return Promise.reject(n)}},children:"Mermaid"}),G("button",{className:"graph-export-menu-item",onClick:function(){try{h.value=!1;var n=JSON.stringify(g.value,null,2);ht(n);_("Copied to clipboard!");return Promise.resolve()}catch(n){return Promise.reject(n)}},children:"JSON"})]})]}),G("div",{className:"graph-zoom-indicator",title:"Zoom level",children:[Math.round(100*s.value),"%"]})]}),v.value&&G("div",{className:"graph-toast",children:v.value}),p.value&&G("div",{className:"graph-tooltip",style:{left:m.value.x+12,top:m.value.y-8},children:[G("div",{className:"tooltip-header",children:G("span",{className:"tooltip-type "+p.value.type,children:p.value.type})}),G("div",{className:"tooltip-name",children:p.value.name}),G("div",{className:"tooltip-id",children:["ID: ",p.value.id]})]}),G("div",{className:"graph-legend",children:[G("div",{className:"legend-item",children:[G("div",{className:"legend-color",style:{backgroundColor:"#2196f3"}}),G("span",{children:"Signal"})]}),G("div",{className:"legend-item",children:[G("div",{className:"legend-color",style:{backgroundColor:"#ff9800"}}),G("span",{children:"Computed"})]}),G("div",{className:"legend-item",children:[G("div",{className:"legend-color",style:{backgroundColor:"#4caf50"}}),G("span",{children:"Effect"})]})]})]})})}function pt(n){var t=n.update,i=n.count,e=n.firstUpdate,r=new Date(t.timestamp||t.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=i&&G("span",{class:"update-count",title:"Number of grouped identical updates",children:["x",i]});if("effect"===t.type)return G("div",{className:"update-item "+t.type,children:G("div",{className:"update-header",children:[G("span",{className:"signal-name",children:["↪️ ",t.signalName,u]}),G("span",{className:"update-time",children:r})]})});var a=o(t.prevValue),l=o(t.newValue),c=void 0!==e?o(e.prevValue):void 0;return G("div",{class:"update-item "+t.type,children:[G("div",{class:"update-header",children:[G("span",{class:"signal-name",children:[0===t.depth?"🎯":"↪️"," ",t.signalName,u]}),G("span",{class:"update-time",children:r})]}),G("div",{class:"value-change",children:[c&&c!==a&&G(x,{children:[G("span",{class:"value-prev",children:c}),G("span",{class:"value-arrow",children:"..."})]}),G("span",{class:"value-prev",children:a}),G("span",{class:"value-arrow",children:"→"}),G("span",{class:"value-new",children:l})]})]})}function mt(n){var t,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)t=e.children.map(function(n,t){var r=e.firstChildren[t];return i({},n,{type:"group",firstUpdate:r.update,firstChildren:r.children,count:e.count})});else t=e.children;return G("div",{className:"tree-node",children:[G("div",{className:"tree-node-content",children:[o&&G("button",{className:"collapse-button",onClick:function(){r.value=!r.value},"aria-label":r.value?"Expand":"Collapse",children:r.value?"▶":"▼"}),!o&&G("div",{className:"collapse-spacer"}),G("div",{className:"update-content",children:G(pt,{update:e.update,count:u,firstUpdate:a})})]}),o&&!r.value&&G("div",{className:"tree-children",children:t.map(function(n){return G(mt,{node:n},n.id)})})]})}function gt(){var n=rt().updatesStore,t=an(null),i=n.collapsedUpdateTree.value;useSignalEffect(function(){if(t.current)t.current.scrollTop=0});return G("div",{className:"updates-container",children:[G("div",{className:"updates-header",children:G("div",{className:"updates-stats",children:[G("span",{children:["Updates: ",G("strong",{children:n.totalUpdates.value})]}),G("span",{children:["Signals: ",G("strong",{children:n.signalCounts.value.size})]})]})}),G("div",{className:"updates-list",ref:t,children:i.map(function(n){return G(mt,{node:n},n.id)})})]})}var yt=["adapter","container"];function bt(n){var t=void 0===n?{}:n,i=t.hideHeader,e=void 0===i?!1:i,r=t.initialTab,o=void 0===r?"updates":r,u=rt().connectionStore,a=useSignal(o);return G("div",{id:"app",className:"signals-devtools",children:[!e&&G(ft,{}),G(dt,{}),G("main",{className:"main-content",children:[G("div",{className:"tabs",children:[G("button",{className:"tab "+("updates"===a.value?"active":""),onClick:function(){return a.value="updates"},children:"Updates"}),G("button",{className:"tab "+("graph"===a.value?"active":""),onClick:function(){return a.value="graph"},children:"Dependency Graph"})]}),G("div",{className:"tab-content",children:!u.isConnected?G(tt,{onRefresh:u.refreshConnection}):G(x,{children:["updates"===a.value&&G(gt,{}),"graph"===a.value&&G(vt,{})]})})]})]})}exports.Button=nt;exports.DevToolsPanel=bt;exports.EmptyState=tt;exports.GraphVisualization=vt;exports.Header=ft;exports.SettingsPanel=dt;exports.StatusIndicator=it;exports.UpdateItem=pt;exports.UpdateTreeNodeComponent=mt;exports.UpdatesContainer=gt;exports.createConnectionStore=ot;exports.createSettingsStore=lt;exports.createUpdatesStore=at;exports.destroyDevTools=st;exports.getContext=rt;exports.initDevTools=ct;exports.mount=function(n){try{var t=n.adapter,e=n.container,r=function(n,t){if(null==n)return{};var i={};for(var e in n)if({}.hasOwnProperty.call(n,e)){if(-1!==t.indexOf(e))continue;i[e]=n[e]}return i}(n,yt);ct(t);return Promise.resolve(t.connect()).then(function(){e.innerHTML="";z(G(bt,i({},r)),e);return function(){z(null,e);st()}})}catch(n){return Promise.reject(n)}};//# sourceMappingURL=devtools-ui.js.map