@seed-ship/mcp-ui-solid 2.8.3 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,9 @@
1
- import { delegateEvents, getNextElement, template, getNextMarker, insert, createComponent, effect, setAttribute, runHydrationEvents, memo, className, setStyleProperty } from "solid-js/web";
1
+ import { delegateEvents, getNextElement, template, getNextMarker, insert, createComponent, effect, setAttribute, runHydrationEvents, memo, className, setStyleProperty, setProperty } from "solid-js/web";
2
2
  import { createSignal, createEffect, onCleanup, Show, For, Switch, Match } from "solid-js";
3
- var _tmpl$ = /* @__PURE__ */ template(`<svg fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 9l-7 7-7-7">`), _tmpl$2 = /* @__PURE__ */ template(`<button class="p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"aria-label="Close scratchpad"><svg class="w-4 h-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">`), _tmpl$3 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700 space-y-2">`), _tmpl$4 = /* @__PURE__ */ template(`<button type=button class="px-3 py-1.5 text-xs font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors">Modify filters`), _tmpl$5 = /* @__PURE__ */ template(`<div class="flex flex-col items-center gap-2 py-4 text-center"><span class=text-2xl>&#128269;</span><p class="text-sm text-gray-500 dark:text-gray-400">No results for these filters</p><!$><!/>`), _tmpl$6 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700">`), _tmpl$7 = /* @__PURE__ */ template(`<div style=overflow-y:auto><div class="divide-y divide-gray-100 dark:divide-gray-700"></div><!$><!/><!$><!/>`), _tmpl$8 = /* @__PURE__ */ template(`<div class="w-full bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-lg overflow-visible"style="animation:scratchpad-slide-down 0.2s ease-out"><div><div class="flex items-center gap-2"><span class=text-base>&#128221;</span><h3 class="text-sm font-semibold text-gray-900 dark:text-white"></h3><!$><!/></div><div class="flex items-center gap-2"><span></span><!$><!/></div></div><!$><!/><style>
4
- @keyframes scratchpad-slide-down {
5
- from { opacity: 0; transform: translateY(-8px); }
6
- to { opacity: 1; transform: translateY(0); }
7
- }
8
- `), _tmpl$9 = /* @__PURE__ */ template(`<div><span class="flex-shrink-0 mt-0.5"></span><p>`), _tmpl$0 = /* @__PURE__ */ template(`<div class="flex items-center gap-2 mb-2"><span class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide">Preview</span><span class="px-1.5 py-0.5 text-xs font-bold bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded">`), _tmpl$1 = /* @__PURE__ */ template(`<p class="text-sm text-gray-700 dark:text-gray-300">`), _tmpl$10 = /* @__PURE__ */ template(`<div class="mt-2 overflow-x-auto"><table class="min-w-full text-xs"><thead><tr></tr></thead><tbody>`), _tmpl$11 = /* @__PURE__ */ template(`<th class="px-2 py-1 text-left font-medium text-gray-500 dark:text-gray-400">`), _tmpl$12 = /* @__PURE__ */ template(`<tr class="border-t border-gray-100 dark:border-gray-700">`), _tmpl$13 = /* @__PURE__ */ template(`<td class="px-2 py-1 text-gray-700 dark:text-gray-300">`), _tmpl$14 = /* @__PURE__ */ template(`<pre class="text-xs text-gray-500 dark:text-gray-400 overflow-auto">`), _tmpl$15 = /* @__PURE__ */ template(`<div class="px-4 py-3"><h4 class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide mb-2"></h4><!$><!/>`), _tmpl$16 = /* @__PURE__ */ template(`<div class=space-y-1>`), _tmpl$17 = /* @__PURE__ */ template(`<div class="flex gap-2 text-sm"><span class="text-gray-500 dark:text-gray-400 font-mono text-xs min-w-[120px]"><!$><!/>:</span><span class="text-gray-900 dark:text-white text-xs">`), _tmpl$18 = /* @__PURE__ */ template(`<p class="text-xs text-gray-400 italic">No filters applied`), _tmpl$19 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-1.5"><!$><!/><!$><!/>`), _tmpl$20 = /* @__PURE__ */ template(`<button type=button class="ml-0.5 hover:text-blue-900 dark:hover:text-blue-100 transition-colors">&times;`), _tmpl$21 = /* @__PURE__ */ template(`<span class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-full"><span class="text-blue-500 dark:text-blue-400"><!$><!/>:</span><!$><!/><!$><!/>`), _tmpl$22 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-2">`), _tmpl$23 = /* @__PURE__ */ template(`<span class=mr-1>`), _tmpl$24 = /* @__PURE__ */ template(`<button type=button><!$><!/><!$><!/>`), _tmpl$25 = /* @__PURE__ */ template(`<div class="flex items-center gap-1">`), _tmpl$26 = /* @__PURE__ */ template(`<div>`), _tmpl$27 = /* @__PURE__ */ template(`<div><!$><!/><!$><!/>`);
3
+ import { FormFieldRenderer } from "./FormFieldRenderer.js";
4
+ var _tmpl$ = /* @__PURE__ */ template(`<svg fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 9l-7 7-7-7">`), _tmpl$2 = /* @__PURE__ */ template(`<button class="p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"aria-label=Close><svg class="w-4 h-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">`), _tmpl$3 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700 space-y-2">`), _tmpl$4 = /* @__PURE__ */ template(`<div class="flex flex-col items-center gap-2 py-4 text-center"><span class=text-2xl>&#128269;</span><p class="text-sm text-gray-500 dark:text-gray-400">No results for these filters</p><button type=button class="px-3 py-1.5 text-xs font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors">Modify filters`), _tmpl$5 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700">`), _tmpl$6 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700"><button type=button class="w-full px-4 py-2.5 text-sm font-semibold rounded-lg text-white bg-blue-600 hover:bg-blue-700 transition-colors flex items-center justify-center gap-2"><svg class="w-4 h-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>Search`), _tmpl$7 = /* @__PURE__ */ template(`<div style=overflow-y:auto><div class="divide-y divide-gray-100 dark:divide-gray-700"></div><!$><!/><!$><!/><!$><!/>`), _tmpl$8 = /* @__PURE__ */ template(`<div style="animation:scratchpad-slide-down 0.2s ease-out"><div><div class="flex items-center gap-2"><span class=text-base>&#128221;</span><h3 class="text-sm font-semibold text-gray-900 dark:text-white"></h3><!$><!/></div><div class="flex items-center gap-2"><span></span><!$><!/></div></div><!$><!/><style>
5
+ @keyframes scratchpad-slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
6
+ `), _tmpl$9 = /* @__PURE__ */ template(`<div><span class="flex-shrink-0 mt-0.5"></span><p>`), _tmpl$0 = /* @__PURE__ */ template(`<div class="flex items-center gap-2 mb-2"><span class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide">Preview</span><span class="px-1.5 py-0.5 text-xs font-bold bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded">`), _tmpl$1 = /* @__PURE__ */ template(`<p class="text-sm text-gray-700 dark:text-gray-300">`), _tmpl$10 = /* @__PURE__ */ template(`<div class="mt-2 overflow-x-auto"><table class="min-w-full text-xs"><thead><tr></tr></thead><tbody>`), _tmpl$11 = /* @__PURE__ */ template(`<th class="px-2 py-1 text-left font-medium text-gray-500 dark:text-gray-400">`), _tmpl$12 = /* @__PURE__ */ template(`<tr class="border-t border-gray-100 dark:border-gray-700">`), _tmpl$13 = /* @__PURE__ */ template(`<td class="px-2 py-1 text-gray-700 dark:text-gray-300">`), _tmpl$14 = /* @__PURE__ */ template(`<pre class="text-xs text-gray-500 overflow-auto">`), _tmpl$15 = /* @__PURE__ */ template(`<div class="px-4 py-3"><h4 class="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide mb-2"></h4><!$><!/>`), _tmpl$16 = /* @__PURE__ */ template(`<div class=space-y-1>`), _tmpl$17 = /* @__PURE__ */ template(`<div class="flex gap-2 text-xs"><span class="text-gray-500 dark:text-gray-400 font-mono min-w-[120px]"><!$><!/>:</span><span class="text-gray-900 dark:text-white">`), _tmpl$18 = /* @__PURE__ */ template(`<p class="text-xs text-gray-400 italic">No filters`), _tmpl$19 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-1.5"><!$><!/><!$><!/>`), _tmpl$20 = /* @__PURE__ */ template(`<button type=button class="ml-0.5 hover:text-blue-900 dark:hover:text-blue-100">&times;`), _tmpl$21 = /* @__PURE__ */ template(`<span class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-full"><button type=button class=hover:underline><span class="text-blue-500 dark:text-blue-400"><!$><!/>:</span> <!$><!/></button><!$><!/>`), _tmpl$22 = /* @__PURE__ */ template(`<div class="max-h-48 overflow-y-auto">`), _tmpl$23 = /* @__PURE__ */ template(`<button type=button class="mt-1 w-full px-2 py-1 text-xs text-gray-500 hover:text-gray-700 text-center">Cancel`), _tmpl$24 = /* @__PURE__ */ template(`<div class="absolute z-50 mt-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg p-2 min-w-[200px]">`), _tmpl$25 = /* @__PURE__ */ template(`<div class=relative><!$><!/><!$><!/>`), _tmpl$26 = /* @__PURE__ */ template(`<button type=button class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 rounded-full hover:border-blue-400 hover:text-blue-500 transition-colors">+ <!$><!/>`), _tmpl$27 = /* @__PURE__ */ template(`<form class="flex gap-1"><input type=text autofocus class="flex-1 px-2 py-1 text-sm border border-gray-200 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:border-blue-400 outline-none"><button type=submit class="px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700">OK</button><button type=button class="px-2 py-1 text-xs text-gray-500 hover:text-gray-700">Cancel`), _tmpl$28 = /* @__PURE__ */ template(`<span class=ml-1>✓`), _tmpl$29 = /* @__PURE__ */ template(`<button type=button><!$><!/><!$><!/>`), _tmpl$30 = /* @__PURE__ */ template(`<form class="flex flex-col gap-3"><!$><!/><div class="flex justify-end"><button type=submit class="px-4 py-2 text-sm font-medium rounded-lg text-white bg-blue-600 hover:bg-blue-700 transition-colors">`), _tmpl$31 = /* @__PURE__ */ template(`<div class="flex justify-end"><button type=button class="px-3 py-1.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors flex items-center gap-1">Next <svg class="w-3.5 h-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7">`), _tmpl$32 = /* @__PURE__ */ template(`<div class=space-y-3><!$><!/><!$><!/>`), _tmpl$33 = /* @__PURE__ */ template(`<span class="text-xs font-normal text-gray-500 dark:text-gray-400">— <!$><!/>`), _tmpl$34 = /* @__PURE__ */ template(`<div class="mt-2 ml-6">`), _tmpl$35 = /* @__PURE__ */ template(`<div><div><span></span><!$><!/><!$><!/></div><!$><!/>`), _tmpl$36 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-2">`), _tmpl$37 = /* @__PURE__ */ template(`<span class=mr-1>`);
9
7
  const STATUS_BADGES = {
10
8
  loading: {
11
9
  label: "Loading...",
@@ -30,9 +28,13 @@ const STATUS_BADGES = {
30
28
  };
31
29
  const ScratchpadPanel = (props) => {
32
30
  const [collapsed, setCollapsed] = createSignal(false);
31
+ const [localPreview, setLocalPreview] = createSignal(void 0);
32
+ let previewTimer = null;
33
33
  const badge = () => STATUS_BADGES[props.state.status] || STATUS_BADGES.loading;
34
34
  const isClosable = () => props.closable !== false;
35
35
  const isCollapsible = () => props.collapsible !== false;
36
+ const preview = () => localPreview() || props.state.preview;
37
+ const hasFilters = () => Object.keys(props.state.filters || {}).length > 0;
36
38
  createEffect(() => {
37
39
  if (props.state.status === "complete" && props.autoCloseDelay) {
38
40
  const timer = setTimeout(() => {
@@ -42,13 +44,36 @@ const ScratchpadPanel = (props) => {
42
44
  onCleanup(() => clearTimeout(timer));
43
45
  }
44
46
  });
45
- const handleHeaderClick = () => {
46
- if (isCollapsible()) setCollapsed(!collapsed());
47
- };
47
+ createEffect(() => {
48
+ const endpoint = props.state.previewEndpoint;
49
+ if (!endpoint) return;
50
+ const filters = props.state.filters;
51
+ if (!filters || Object.keys(filters).length === 0) return;
52
+ if (previewTimer) clearTimeout(previewTimer);
53
+ previewTimer = setTimeout(async () => {
54
+ try {
55
+ const res = await fetch(endpoint, {
56
+ method: "POST",
57
+ headers: {
58
+ "Content-Type": "application/json"
59
+ },
60
+ credentials: "include",
61
+ body: JSON.stringify({
62
+ filters
63
+ })
64
+ });
65
+ if (res.ok) setLocalPreview(await res.json());
66
+ } catch {
67
+ }
68
+ }, props.state.previewDebounce || 500);
69
+ });
70
+ onCleanup(() => {
71
+ if (previewTimer) clearTimeout(previewTimer);
72
+ });
48
73
  return (() => {
49
- var _el$ = getNextElement(_tmpl$8), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$7 = _el$5.nextSibling, [_el$8, _co$] = getNextMarker(_el$7.nextSibling), _el$9 = _el$3.nextSibling, _el$0 = _el$9.firstChild, _el$10 = _el$0.nextSibling, [_el$11, _co$2] = getNextMarker(_el$10.nextSibling), _el$27 = _el$2.nextSibling, [_el$28, _co$6] = getNextMarker(_el$27.nextSibling);
50
- _el$28.nextSibling;
51
- _el$2.$$click = handleHeaderClick;
74
+ var _el$ = getNextElement(_tmpl$8), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$7 = _el$5.nextSibling, [_el$8, _co$] = getNextMarker(_el$7.nextSibling), _el$9 = _el$3.nextSibling, _el$0 = _el$9.firstChild, _el$10 = _el$0.nextSibling, [_el$11, _co$2] = getNextMarker(_el$10.nextSibling), _el$29 = _el$2.nextSibling, [_el$30, _co$6] = getNextMarker(_el$29.nextSibling);
75
+ _el$30.nextSibling;
76
+ _el$2.$$click = () => isCollapsible() && setCollapsed(!collapsed());
52
77
  insert(_el$5, () => props.state.title);
53
78
  insert(_el$3, createComponent(Show, {
54
79
  get when() {
@@ -81,7 +106,7 @@ const ScratchpadPanel = (props) => {
81
106
  return !collapsed();
82
107
  },
83
108
  get children() {
84
- var _el$12 = getNextElement(_tmpl$7), _el$13 = _el$12.firstChild, _el$22 = _el$13.nextSibling, [_el$23, _co$4] = getNextMarker(_el$22.nextSibling), _el$24 = _el$23.nextSibling, [_el$25, _co$5] = getNextMarker(_el$24.nextSibling);
109
+ var _el$12 = getNextElement(_tmpl$7), _el$13 = _el$12.firstChild, _el$22 = _el$13.nextSibling, [_el$23, _co$3] = getNextMarker(_el$22.nextSibling), _el$24 = _el$23.nextSibling, [_el$25, _co$4] = getNextMarker(_el$24.nextSibling), _el$26 = _el$25.nextSibling, [_el$27, _co$5] = getNextMarker(_el$26.nextSibling);
85
110
  insert(_el$13, createComponent(For, {
86
111
  get each() {
87
112
  return props.state.sections;
@@ -113,111 +138,120 @@ const ScratchpadPanel = (props) => {
113
138
  return props.state.agentMessages;
114
139
  },
115
140
  children: (msg) => (() => {
116
- var _el$29 = getNextElement(_tmpl$9), _el$30 = _el$29.firstChild, _el$31 = _el$30.nextSibling;
117
- insert(_el$30, (() => {
141
+ var _el$31 = getNextElement(_tmpl$9), _el$32 = _el$31.firstChild, _el$33 = _el$32.nextSibling;
142
+ insert(_el$32, (() => {
118
143
  var _c$ = memo(() => msg.type === "warning");
119
144
  return () => _c$() ? "⚠️" : msg.type === "question" ? "❓" : "ℹ️";
120
145
  })());
121
- insert(_el$31, () => msg.text);
122
- effect(() => className(_el$29, `flex items-start gap-2 text-sm rounded-lg px-3 py-2 ${msg.type === "warning" ? "bg-amber-50 dark:bg-amber-900/10 text-amber-700 dark:text-amber-400" : msg.type === "question" ? "bg-blue-50 dark:bg-blue-900/10 text-blue-700 dark:text-blue-400 border border-blue-200 dark:border-blue-800" : "bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-400"}`));
123
- return _el$29;
146
+ insert(_el$33, () => msg.text);
147
+ effect(() => className(_el$31, `flex items-start gap-2 text-sm rounded-lg px-3 py-2 ${msg.type === "warning" ? "bg-amber-50 dark:bg-amber-900/10 text-amber-700 dark:text-amber-400" : msg.type === "question" ? "bg-blue-50 dark:bg-blue-900/10 text-blue-700 dark:text-blue-400 border border-blue-200 dark:border-blue-800" : "bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-400"}`));
148
+ return _el$31;
124
149
  })()
125
150
  }));
126
151
  return _el$14;
127
152
  }
128
- }), _el$23, _co$4);
153
+ }), _el$23, _co$3);
129
154
  insert(_el$12, createComponent(Show, {
130
155
  get when() {
131
- return props.state.preview;
156
+ return preview();
132
157
  },
133
158
  get children() {
134
- var _el$15 = getNextElement(_tmpl$6);
159
+ var _el$15 = getNextElement(_tmpl$5);
135
160
  insert(_el$15, createComponent(Show, {
136
161
  get when() {
137
- return props.state.preview.count === 0;
162
+ return preview().count === 0;
138
163
  },
139
164
  get fallback() {
140
165
  return [(() => {
141
- var _el$32 = getNextElement(_tmpl$0), _el$33 = _el$32.firstChild, _el$34 = _el$33.nextSibling;
142
- insert(_el$34, () => props.state.preview.count.toLocaleString());
143
- return _el$32;
166
+ var _el$34 = getNextElement(_tmpl$0), _el$35 = _el$34.firstChild, _el$36 = _el$35.nextSibling;
167
+ insert(_el$36, () => preview().count.toLocaleString());
168
+ return _el$34;
144
169
  })(), (() => {
145
- var _el$35 = getNextElement(_tmpl$1);
146
- insert(_el$35, () => props.state.preview.summary);
147
- return _el$35;
170
+ var _el$37 = getNextElement(_tmpl$1);
171
+ insert(_el$37, () => preview().summary);
172
+ return _el$37;
148
173
  })(), createComponent(Show, {
149
174
  get when() {
150
- return memo(() => !!props.state.preview.rows)() && props.state.preview.rows.length > 0;
175
+ return memo(() => !!preview().rows)() && preview().rows.length > 0;
151
176
  },
152
177
  get children() {
153
- var _el$36 = getNextElement(_tmpl$10), _el$37 = _el$36.firstChild, _el$38 = _el$37.firstChild, _el$39 = _el$38.firstChild, _el$40 = _el$38.nextSibling;
154
- insert(_el$39, createComponent(For, {
178
+ var _el$38 = getNextElement(_tmpl$10), _el$39 = _el$38.firstChild, _el$40 = _el$39.firstChild, _el$41 = _el$40.firstChild, _el$42 = _el$40.nextSibling;
179
+ insert(_el$41, createComponent(For, {
155
180
  get each() {
156
- return Object.keys(props.state.preview.rows[0]);
181
+ return Object.keys(preview().rows[0]);
157
182
  },
158
- children: (key) => (() => {
159
- var _el$41 = getNextElement(_tmpl$11);
160
- insert(_el$41, key);
161
- return _el$41;
183
+ children: (k) => (() => {
184
+ var _el$43 = getNextElement(_tmpl$11);
185
+ insert(_el$43, k);
186
+ return _el$43;
162
187
  })()
163
188
  }));
164
- insert(_el$40, createComponent(For, {
189
+ insert(_el$42, createComponent(For, {
165
190
  get each() {
166
- return props.state.preview.rows.slice(0, 5);
191
+ return preview().rows.slice(0, 5);
167
192
  },
168
193
  children: (row) => (() => {
169
- var _el$42 = getNextElement(_tmpl$12);
170
- insert(_el$42, createComponent(For, {
194
+ var _el$44 = getNextElement(_tmpl$12);
195
+ insert(_el$44, createComponent(For, {
171
196
  get each() {
172
197
  return Object.values(row);
173
198
  },
174
- children: (val) => (() => {
175
- var _el$43 = getNextElement(_tmpl$13);
176
- insert(_el$43, () => String(val));
177
- return _el$43;
199
+ children: (v) => (() => {
200
+ var _el$45 = getNextElement(_tmpl$13);
201
+ insert(_el$45, () => String(v));
202
+ return _el$45;
178
203
  })()
179
204
  }));
180
- return _el$42;
205
+ return _el$44;
181
206
  })()
182
207
  }));
183
- return _el$36;
208
+ return _el$38;
184
209
  }
185
210
  })];
186
211
  },
187
212
  get children() {
188
- var _el$16 = getNextElement(_tmpl$5), _el$17 = _el$16.firstChild, _el$18 = _el$17.nextSibling, _el$20 = _el$18.nextSibling, [_el$21, _co$3] = getNextMarker(_el$20.nextSibling);
189
- insert(_el$16, createComponent(Show, {
190
- get when() {
191
- return props.onFilterChange;
192
- },
193
- get children() {
194
- var _el$19 = getNextElement(_tmpl$4);
195
- _el$19.$$click = () => {
196
- var _a;
197
- return (_a = props.onAction) == null ? void 0 : _a.call(props, "refine_filters");
198
- };
199
- runHydrationEvents();
200
- return _el$19;
201
- }
202
- }), _el$21, _co$3);
213
+ var _el$16 = getNextElement(_tmpl$4), _el$17 = _el$16.firstChild, _el$18 = _el$17.nextSibling, _el$19 = _el$18.nextSibling;
214
+ _el$19.$$click = () => {
215
+ var _a;
216
+ return (_a = props.onAction) == null ? void 0 : _a.call(props, "refine_filters");
217
+ };
218
+ runHydrationEvents();
203
219
  return _el$16;
204
220
  }
205
221
  }));
206
222
  return _el$15;
207
223
  }
208
- }), _el$25, _co$5);
209
- effect((_$p) => setStyleProperty(_el$12, "max-height", props.maxHeight || "400px"));
224
+ }), _el$25, _co$4);
225
+ insert(_el$12, createComponent(Show, {
226
+ get when() {
227
+ return memo(() => props.state.status === "waiting_human")() && hasFilters();
228
+ },
229
+ get children() {
230
+ var _el$20 = getNextElement(_tmpl$6), _el$21 = _el$20.firstChild;
231
+ _el$21.$$click = () => {
232
+ var _a;
233
+ return (_a = props.onAction) == null ? void 0 : _a.call(props, "search", {
234
+ filters: props.state.filters
235
+ });
236
+ };
237
+ runHydrationEvents();
238
+ return _el$20;
239
+ }
240
+ }), _el$27, _co$5);
241
+ effect((_$p) => setStyleProperty(_el$12, "max-height", props.maxHeight || "500px"));
210
242
  return _el$12;
211
243
  }
212
- }), _el$28, _co$6);
244
+ }), _el$30, _co$6);
213
245
  effect((_p$) => {
214
- var _v$ = `flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700 ${isCollapsible() ? "cursor-pointer select-none hover:bg-gray-50 dark:hover:bg-gray-750" : ""}`, _v$2 = `px-2 py-0.5 text-xs font-medium rounded-full ${badge().class}`;
215
- _v$ !== _p$.e && className(_el$2, _p$.e = _v$);
216
- _v$2 !== _p$.t && className(_el$0, _p$.t = _v$2);
246
+ var _v$ = `w-full bg-white dark:bg-gray-800 rounded-xl border shadow-lg overflow-visible ${props.state.status === "waiting_human" ? "border-blue-300 dark:border-blue-600" : "border-gray-200 dark:border-gray-700"}`, _v$2 = `flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700 ${isCollapsible() ? "cursor-pointer select-none hover:bg-gray-50 dark:hover:bg-gray-750" : ""}`, _v$3 = `px-2 py-0.5 text-xs font-medium rounded-full ${badge().class}`;
247
+ _v$ !== _p$.e && className(_el$, _p$.e = _v$);
248
+ _v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
249
+ _v$3 !== _p$.a && className(_el$0, _p$.a = _v$3);
217
250
  return _p$;
218
251
  }, {
219
252
  e: void 0,
220
- t: void 0
253
+ t: void 0,
254
+ a: void 0
221
255
  });
222
256
  runHydrationEvents();
223
257
  return _el$;
@@ -225,9 +259,9 @@ const ScratchpadPanel = (props) => {
225
259
  };
226
260
  const SectionRenderer = (props) => {
227
261
  return (() => {
228
- var _el$44 = getNextElement(_tmpl$15), _el$45 = _el$44.firstChild, _el$48 = _el$45.nextSibling, [_el$49, _co$7] = getNextMarker(_el$48.nextSibling);
229
- insert(_el$45, () => props.section.title);
230
- insert(_el$44, createComponent(Switch, {
262
+ var _el$46 = getNextElement(_tmpl$15), _el$47 = _el$46.firstChild, _el$50 = _el$47.nextSibling, [_el$51, _co$7] = getNextMarker(_el$50.nextSibling);
263
+ insert(_el$47, () => props.section.title);
264
+ insert(_el$46, createComponent(Switch, {
231
265
  get children() {
232
266
  return [createComponent(Match, {
233
267
  get when() {
@@ -245,7 +279,10 @@ const SectionRenderer = (props) => {
245
279
  return props.section.type === "filter";
246
280
  },
247
281
  get children() {
248
- return createComponent(FilterSection, {
282
+ return createComponent(InteractiveFilterSection, {
283
+ get content() {
284
+ return props.section.content;
285
+ },
249
286
  get filters() {
250
287
  return props.filters;
251
288
  },
@@ -259,9 +296,9 @@ const SectionRenderer = (props) => {
259
296
  return props.section.type === "message";
260
297
  },
261
298
  get children() {
262
- var _el$46 = getNextElement(_tmpl$1);
263
- insert(_el$46, () => String(props.section.content));
264
- return _el$46;
299
+ var _el$48 = getNextElement(_tmpl$1);
300
+ insert(_el$48, () => String(props.section.content));
301
+ return _el$48;
265
302
  }
266
303
  }), createComponent(Match, {
267
304
  get when() {
@@ -282,52 +319,83 @@ const SectionRenderer = (props) => {
282
319
  return props.section.type === "steps";
283
320
  },
284
321
  get children() {
285
- return createComponent(StepsSection, {
322
+ return createComponent(EnrichedStepsSection, {
323
+ get content() {
324
+ return props.section.content;
325
+ },
326
+ get onAction() {
327
+ return props.onAction;
328
+ },
329
+ get onFilterChange() {
330
+ return props.onFilterChange;
331
+ }
332
+ });
333
+ }
334
+ }), createComponent(Match, {
335
+ get when() {
336
+ return props.section.type === "form";
337
+ },
338
+ get children() {
339
+ return createComponent(EmbeddedFormSection, {
286
340
  get content() {
287
341
  return props.section.content;
342
+ },
343
+ get sectionId() {
344
+ return props.section.id;
345
+ },
346
+ get onAction() {
347
+ return props.onAction;
288
348
  }
289
349
  });
290
350
  }
291
351
  }), createComponent(Match, {
292
352
  when: true,
293
353
  get children() {
294
- var _el$47 = getNextElement(_tmpl$14);
295
- insert(_el$47, () => JSON.stringify(props.section.content, null, 2));
296
- return _el$47;
354
+ var _el$49 = getNextElement(_tmpl$14);
355
+ insert(_el$49, () => JSON.stringify(props.section.content, null, 2));
356
+ return _el$49;
297
357
  }
298
358
  })];
299
359
  }
300
- }), _el$49, _co$7);
301
- return _el$44;
360
+ }), _el$51, _co$7);
361
+ return _el$46;
302
362
  })();
303
363
  };
304
364
  const DataSection = (props) => {
305
- const entries = () => {
306
- if (typeof props.content !== "object" || !props.content) return [];
307
- return Object.entries(props.content);
308
- };
365
+ const entries = () => typeof props.content === "object" && props.content ? Object.entries(props.content) : [];
309
366
  return (() => {
310
- var _el$50 = getNextElement(_tmpl$16);
311
- insert(_el$50, createComponent(For, {
367
+ var _el$52 = getNextElement(_tmpl$16);
368
+ insert(_el$52, createComponent(For, {
312
369
  get each() {
313
370
  return entries();
314
371
  },
315
- children: ([key, value]) => (() => {
316
- var _el$51 = getNextElement(_tmpl$17), _el$52 = _el$51.firstChild, _el$54 = _el$52.firstChild, [_el$55, _co$8] = getNextMarker(_el$54.nextSibling);
317
- _el$55.nextSibling;
318
- var _el$56 = _el$52.nextSibling;
319
- insert(_el$52, key, _el$55, _co$8);
320
- insert(_el$56, (() => {
321
- var _c$2 = memo(() => !!Array.isArray(value));
322
- return () => _c$2() ? value.join(", ") : String(value);
372
+ children: ([k, v]) => (() => {
373
+ var _el$53 = getNextElement(_tmpl$17), _el$54 = _el$53.firstChild, _el$56 = _el$54.firstChild, [_el$57, _co$8] = getNextMarker(_el$56.nextSibling);
374
+ _el$57.nextSibling;
375
+ var _el$58 = _el$54.nextSibling;
376
+ insert(_el$54, k, _el$57, _co$8);
377
+ insert(_el$58, (() => {
378
+ var _c$2 = memo(() => !!Array.isArray(v));
379
+ return () => _c$2() ? v.join(", ") : String(v);
323
380
  })());
324
- return _el$51;
381
+ return _el$53;
325
382
  })()
326
383
  }));
327
- return _el$50;
384
+ return _el$52;
328
385
  })();
329
386
  };
330
- const FilterSection = (props) => {
387
+ const InteractiveFilterSection = (props) => {
388
+ const [editingKey, setEditingKey] = createSignal(null);
389
+ const [editValue, setEditValue] = createSignal("");
390
+ const filterDefs = () => {
391
+ if (typeof props.content === "object" && props.content) return props.content;
392
+ return {};
393
+ };
394
+ const allKeys = () => {
395
+ const fromContent = Object.keys(filterDefs());
396
+ const fromFilters = Object.keys(props.filters || {});
397
+ return [.../* @__PURE__ */ new Set([...fromContent, ...fromFilters])];
398
+ };
331
399
  const removeFilter = (key) => {
332
400
  var _a;
333
401
  const next = {
@@ -336,119 +404,352 @@ const FilterSection = (props) => {
336
404
  delete next[key];
337
405
  (_a = props.onFilterChange) == null ? void 0 : _a.call(props, next);
338
406
  };
339
- const entries = () => Object.entries(props.filters);
407
+ const setFilter = (key, value) => {
408
+ var _a;
409
+ (_a = props.onFilterChange) == null ? void 0 : _a.call(props, {
410
+ ...props.filters,
411
+ [key]: value
412
+ });
413
+ setEditingKey(null);
414
+ setEditValue("");
415
+ };
416
+ const getDef = (key) => filterDefs()[key] || {};
340
417
  return (() => {
341
- var _el$57 = getNextElement(_tmpl$19), _el$59 = _el$57.firstChild, [_el$60, _co$9] = getNextMarker(_el$59.nextSibling), _el$61 = _el$60.nextSibling, [_el$62, _co$0] = getNextMarker(_el$61.nextSibling);
342
- insert(_el$57, createComponent(For, {
418
+ var _el$59 = getNextElement(_tmpl$19), _el$61 = _el$59.firstChild, [_el$62, _co$9] = getNextMarker(_el$61.nextSibling), _el$63 = _el$62.nextSibling, [_el$64, _co$0] = getNextMarker(_el$63.nextSibling);
419
+ insert(_el$59, createComponent(For, {
343
420
  get each() {
344
- return entries();
421
+ return allKeys();
422
+ },
423
+ children: (key) => {
424
+ const def = () => getDef(key);
425
+ const value = () => props.filters[key];
426
+ const hasValue = () => value() !== void 0 && value() !== "";
427
+ return (() => {
428
+ var _el$65 = getNextElement(_tmpl$25), _el$81 = _el$65.firstChild, [_el$82, _co$12] = getNextMarker(_el$81.nextSibling), _el$83 = _el$82.nextSibling, [_el$84, _co$13] = getNextMarker(_el$83.nextSibling);
429
+ insert(_el$65, createComponent(Show, {
430
+ get when() {
431
+ return hasValue();
432
+ },
433
+ get fallback() {
434
+ return (() => {
435
+ var _el$85 = getNextElement(_tmpl$26), _el$86 = _el$85.firstChild, _el$87 = _el$86.nextSibling, [_el$88, _co$14] = getNextMarker(_el$87.nextSibling);
436
+ _el$85.$$click = () => {
437
+ setEditingKey(key);
438
+ setEditValue("");
439
+ };
440
+ insert(_el$85, () => {
441
+ var _a;
442
+ return ((_a = def()) == null ? void 0 : _a.label) || key;
443
+ }, _el$88, _co$14);
444
+ runHydrationEvents();
445
+ return _el$85;
446
+ })();
447
+ },
448
+ get children() {
449
+ var _el$66 = getNextElement(_tmpl$21), _el$67 = _el$66.firstChild, _el$68 = _el$67.firstChild, _el$70 = _el$68.firstChild, [_el$71, _co$1] = getNextMarker(_el$70.nextSibling);
450
+ _el$71.nextSibling;
451
+ var _el$72 = _el$68.nextSibling, _el$73 = _el$72.nextSibling, [_el$74, _co$10] = getNextMarker(_el$73.nextSibling), _el$76 = _el$67.nextSibling, [_el$77, _co$11] = getNextMarker(_el$76.nextSibling);
452
+ _el$67.$$click = () => {
453
+ setEditingKey(key);
454
+ setEditValue(String(value() || ""));
455
+ };
456
+ insert(_el$68, () => {
457
+ var _a;
458
+ return ((_a = def()) == null ? void 0 : _a.label) || key;
459
+ }, _el$71, _co$1);
460
+ insert(_el$67, (() => {
461
+ var _c$3 = memo(() => !!Array.isArray(value()));
462
+ return () => _c$3() ? value().join(", ") : String(value());
463
+ })(), _el$74, _co$10);
464
+ insert(_el$66, createComponent(Show, {
465
+ get when() {
466
+ return props.onFilterChange;
467
+ },
468
+ get children() {
469
+ var _el$75 = getNextElement(_tmpl$20);
470
+ _el$75.$$click = () => removeFilter(key);
471
+ setAttribute(_el$75, "aria-label", `Remove ${key}`);
472
+ runHydrationEvents();
473
+ return _el$75;
474
+ }
475
+ }), _el$77, _co$11);
476
+ runHydrationEvents();
477
+ return _el$66;
478
+ }
479
+ }), _el$82, _co$12);
480
+ insert(_el$65, createComponent(Show, {
481
+ get when() {
482
+ return editingKey() === key;
483
+ },
484
+ get children() {
485
+ var _el$78 = getNextElement(_tmpl$24);
486
+ insert(_el$78, createComponent(Show, {
487
+ get when() {
488
+ var _a;
489
+ return (_a = def()) == null ? void 0 : _a.options;
490
+ },
491
+ get fallback() {
492
+ return (() => {
493
+ var _el$89 = getNextElement(_tmpl$27), _el$90 = _el$89.firstChild, _el$91 = _el$90.nextSibling, _el$92 = _el$91.nextSibling;
494
+ _el$89.addEventListener("submit", (e) => {
495
+ e.preventDefault();
496
+ setFilter(key, editValue());
497
+ });
498
+ _el$90.$$input = (e) => setEditValue(e.currentTarget.value);
499
+ _el$92.$$click = () => setEditingKey(null);
500
+ effect(() => {
501
+ var _a;
502
+ return setAttribute(_el$90, "placeholder", ((_a = def()) == null ? void 0 : _a.placeholder) || key);
503
+ });
504
+ effect(() => setProperty(_el$90, "value", editValue()));
505
+ runHydrationEvents();
506
+ return _el$89;
507
+ })();
508
+ },
509
+ get children() {
510
+ return [(() => {
511
+ var _el$79 = getNextElement(_tmpl$22);
512
+ insert(_el$79, createComponent(For, {
513
+ get each() {
514
+ return def().options;
515
+ },
516
+ children: (opt) => (() => {
517
+ var _el$93 = getNextElement(_tmpl$29), _el$95 = _el$93.firstChild, [_el$96, _co$15] = getNextMarker(_el$95.nextSibling), _el$97 = _el$96.nextSibling, [_el$98, _co$16] = getNextMarker(_el$97.nextSibling);
518
+ _el$93.$$click = () => setFilter(key, opt.value);
519
+ insert(_el$93, () => opt.label, _el$96, _co$15);
520
+ insert(_el$93, createComponent(Show, {
521
+ get when() {
522
+ return String(value()) === opt.value;
523
+ },
524
+ get children() {
525
+ return getNextElement(_tmpl$28);
526
+ }
527
+ }), _el$98, _co$16);
528
+ effect(() => className(_el$93, `w-full text-left px-2 py-1.5 text-sm rounded hover:bg-blue-50 dark:hover:bg-blue-900/20 ${String(value()) === opt.value ? "text-blue-600 dark:text-blue-400 bg-blue-50/50 dark:bg-blue-900/10" : "text-gray-900 dark:text-white"}`));
529
+ runHydrationEvents();
530
+ return _el$93;
531
+ })()
532
+ }));
533
+ return _el$79;
534
+ })(), (() => {
535
+ var _el$80 = getNextElement(_tmpl$23);
536
+ _el$80.$$click = () => setEditingKey(null);
537
+ runHydrationEvents();
538
+ return _el$80;
539
+ })()];
540
+ }
541
+ }));
542
+ return _el$78;
543
+ }
544
+ }), _el$84, _co$13);
545
+ return _el$65;
546
+ })();
547
+ }
548
+ }), _el$62, _co$9);
549
+ insert(_el$59, createComponent(Show, {
550
+ get when() {
551
+ return allKeys().length === 0;
552
+ },
553
+ get children() {
554
+ return getNextElement(_tmpl$18);
555
+ }
556
+ }), _el$64, _co$0);
557
+ return _el$59;
558
+ })();
559
+ };
560
+ const EmbeddedFormSection = (props) => {
561
+ const [formData, setFormData] = createSignal({});
562
+ const [dynamicOptions, setDynamicOptions] = createSignal({});
563
+ const config = () => {
564
+ const c = props.content;
565
+ return {
566
+ fields: (c == null ? void 0 : c.fields) || [],
567
+ submitLabel: (c == null ? void 0 : c.submitLabel) || "Submit"
568
+ };
569
+ };
570
+ const updateField = (name, value) => setFormData((prev) => ({
571
+ ...prev,
572
+ [name]: value
573
+ }));
574
+ createEffect(() => {
575
+ const data = formData();
576
+ for (const field of config().fields) {
577
+ const dep = field.depends_on || field.dependsOn;
578
+ if (!dep) continue;
579
+ const parentValue = data[dep.field];
580
+ if (!parentValue) continue;
581
+ const url = (dep.options_endpoint || dep.apiUrl || "").replace("{value}", encodeURIComponent(parentValue));
582
+ if (!url) continue;
583
+ const params = new URLSearchParams(dep.extraParams || dep.extra_params || {});
584
+ fetch(`${url}${url.includes("?") ? "&" : "?"}${params}`).then((r) => r.json()).then((items) => {
585
+ const arr = Array.isArray(items) ? items : items.results || items.features || [];
586
+ const lf = dep.label_field || dep.labelField || "label";
587
+ const vf = dep.value_field || dep.valueField || "value";
588
+ setDynamicOptions((prev) => ({
589
+ ...prev,
590
+ [field.name]: arr.map((i) => ({
591
+ label: i[lf] || String(i),
592
+ value: String(i[vf] || i[lf] || i)
593
+ }))
594
+ }));
595
+ }).catch(() => {
596
+ });
597
+ }
598
+ });
599
+ const getField = (field) => {
600
+ const dynOpts = dynamicOptions()[field.name];
601
+ return dynOpts ? {
602
+ ...field,
603
+ options: dynOpts
604
+ } : field;
605
+ };
606
+ const handleSubmit = (e) => {
607
+ var _a;
608
+ e.preventDefault();
609
+ (_a = props.onAction) == null ? void 0 : _a.call(props, "submit_form", {
610
+ sectionId: props.sectionId,
611
+ values: formData()
612
+ });
613
+ };
614
+ return (() => {
615
+ var _el$99 = getNextElement(_tmpl$30), _el$102 = _el$99.firstChild, [_el$103, _co$17] = getNextMarker(_el$102.nextSibling), _el$100 = _el$103.nextSibling, _el$101 = _el$100.firstChild;
616
+ _el$99.addEventListener("submit", handleSubmit);
617
+ insert(_el$99, createComponent(For, {
618
+ get each() {
619
+ return config().fields;
620
+ },
621
+ children: (field) => createComponent(FormFieldRenderer, {
622
+ get field() {
623
+ return getField(field);
624
+ },
625
+ get value() {
626
+ return formData()[field.name];
627
+ },
628
+ onChange: (val) => updateField(field.name, val),
629
+ formData
630
+ })
631
+ }), _el$103, _co$17);
632
+ insert(_el$101, () => config().submitLabel);
633
+ return _el$99;
634
+ })();
635
+ };
636
+ const EnrichedStepsSection = (props) => {
637
+ const stepsData = () => {
638
+ const c = props.content;
639
+ return {
640
+ steps: (c == null ? void 0 : c.steps) || [],
641
+ currentStep: (c == null ? void 0 : c.currentStep) ?? 0
642
+ };
643
+ };
644
+ return (() => {
645
+ var _el$104 = getNextElement(_tmpl$32), _el$107 = _el$104.firstChild, [_el$108, _co$18] = getNextMarker(_el$107.nextSibling), _el$109 = _el$108.nextSibling, [_el$110, _co$19] = getNextMarker(_el$109.nextSibling);
646
+ insert(_el$104, createComponent(For, {
647
+ get each() {
648
+ return stepsData().steps;
345
649
  },
346
- children: ([key, value]) => (() => {
347
- var _el$63 = getNextElement(_tmpl$21), _el$64 = _el$63.firstChild, _el$66 = _el$64.firstChild, [_el$67, _co$1] = getNextMarker(_el$66.nextSibling);
348
- _el$67.nextSibling;
349
- var _el$69 = _el$64.nextSibling, [_el$70, _co$10] = getNextMarker(_el$69.nextSibling), _el$71 = _el$70.nextSibling, [_el$72, _co$11] = getNextMarker(_el$71.nextSibling);
350
- insert(_el$64, key, _el$67, _co$1);
351
- insert(_el$63, (() => {
352
- var _c$3 = memo(() => !!Array.isArray(value));
353
- return () => _c$3() ? value.join(", ") : String(value);
354
- })(), _el$70, _co$10);
355
- insert(_el$63, createComponent(Show, {
650
+ children: (step) => (() => {
651
+ var _el$111 = getNextElement(_tmpl$35), _el$112 = _el$111.firstChild, _el$113 = _el$112.firstChild, _el$118 = _el$113.nextSibling, [_el$119, _co$21] = getNextMarker(_el$118.nextSibling), _el$120 = _el$119.nextSibling, [_el$121, _co$22] = getNextMarker(_el$120.nextSibling), _el$123 = _el$112.nextSibling, [_el$124, _co$23] = getNextMarker(_el$123.nextSibling);
652
+ insert(_el$113, (() => {
653
+ var _c$4 = memo(() => step.status === "done");
654
+ return () => _c$4() ? "✅" : step.status === "active" ? "●" : "○";
655
+ })());
656
+ insert(_el$112, () => step.label, _el$119, _co$21);
657
+ insert(_el$112, createComponent(Show, {
356
658
  get when() {
357
- return props.onFilterChange;
659
+ return memo(() => !!step.description)() && step.status === "active";
358
660
  },
359
661
  get children() {
360
- var _el$68 = getNextElement(_tmpl$20);
361
- _el$68.$$click = () => removeFilter(key);
362
- setAttribute(_el$68, "aria-label", `Remove filter ${key}`);
363
- runHydrationEvents();
364
- return _el$68;
662
+ var _el$114 = getNextElement(_tmpl$33), _el$115 = _el$114.firstChild, _el$116 = _el$115.nextSibling, [_el$117, _co$20] = getNextMarker(_el$116.nextSibling);
663
+ insert(_el$114, () => step.description, _el$117, _co$20);
664
+ return _el$114;
665
+ }
666
+ }), _el$121, _co$22);
667
+ insert(_el$111, createComponent(Show, {
668
+ get when() {
669
+ return memo(() => step.status === "active")() && step.content;
670
+ },
671
+ get children() {
672
+ var _el$122 = getNextElement(_tmpl$34);
673
+ insert(_el$122, createComponent(SectionRenderer, {
674
+ get section() {
675
+ return step.content;
676
+ },
677
+ filters: {},
678
+ get onFilterChange() {
679
+ return props.onFilterChange;
680
+ },
681
+ get onAction() {
682
+ return props.onAction;
683
+ }
684
+ }));
685
+ return _el$122;
365
686
  }
366
- }), _el$72, _co$11);
367
- return _el$63;
687
+ }), _el$124, _co$23);
688
+ effect((_p$) => {
689
+ var _v$4 = `rounded-lg ${step.status === "active" ? "bg-blue-50/50 dark:bg-blue-900/10 border border-blue-200 dark:border-blue-800 p-3" : "px-1"}`, _v$5 = `flex items-center gap-2 text-sm font-medium ${step.status === "done" ? "text-green-600 dark:text-green-400" : step.status === "active" ? "text-blue-600 dark:text-blue-400" : "text-gray-400"}`;
690
+ _v$4 !== _p$.e && className(_el$111, _p$.e = _v$4);
691
+ _v$5 !== _p$.t && className(_el$112, _p$.t = _v$5);
692
+ return _p$;
693
+ }, {
694
+ e: void 0,
695
+ t: void 0
696
+ });
697
+ return _el$111;
368
698
  })()
369
- }), _el$60, _co$9);
370
- insert(_el$57, createComponent(Show, {
699
+ }), _el$108, _co$18);
700
+ insert(_el$104, createComponent(Show, {
371
701
  get when() {
372
- return entries().length === 0;
702
+ return stepsData().steps.some((s) => s.status === "active");
373
703
  },
374
704
  get children() {
375
- return getNextElement(_tmpl$18);
705
+ var _el$105 = getNextElement(_tmpl$31), _el$106 = _el$105.firstChild;
706
+ _el$106.$$click = () => {
707
+ var _a;
708
+ return (_a = props.onAction) == null ? void 0 : _a.call(props, "next_step", {
709
+ step: stepsData().currentStep
710
+ });
711
+ };
712
+ runHydrationEvents();
713
+ return _el$105;
376
714
  }
377
- }), _el$62, _co$0);
378
- return _el$57;
715
+ }), _el$110, _co$19);
716
+ return _el$104;
379
717
  })();
380
718
  };
381
719
  const ActionSection = (props) => {
382
- const actions = () => {
383
- if (Array.isArray(props.content)) return props.content;
384
- return [];
385
- };
720
+ const actions = () => Array.isArray(props.content) ? props.content : [];
386
721
  return (() => {
387
- var _el$73 = getNextElement(_tmpl$22);
388
- insert(_el$73, createComponent(For, {
722
+ var _el$125 = getNextElement(_tmpl$36);
723
+ insert(_el$125, createComponent(For, {
389
724
  get each() {
390
725
  return actions();
391
726
  },
392
727
  children: (item) => (() => {
393
- var _el$74 = getNextElement(_tmpl$24), _el$76 = _el$74.firstChild, [_el$77, _co$12] = getNextMarker(_el$76.nextSibling), _el$78 = _el$77.nextSibling, [_el$79, _co$13] = getNextMarker(_el$78.nextSibling);
394
- _el$74.$$click = () => {
728
+ var _el$126 = getNextElement(_tmpl$29), _el$128 = _el$126.firstChild, [_el$129, _co$24] = getNextMarker(_el$128.nextSibling), _el$130 = _el$129.nextSibling, [_el$131, _co$25] = getNextMarker(_el$130.nextSibling);
729
+ _el$126.$$click = () => {
395
730
  var _a;
396
731
  return (_a = props.onAction) == null ? void 0 : _a.call(props, item.value || item.action || item.label, item);
397
732
  };
398
- insert(_el$74, createComponent(Show, {
733
+ insert(_el$126, createComponent(Show, {
399
734
  get when() {
400
735
  return item.icon;
401
736
  },
402
737
  get children() {
403
- var _el$75 = getNextElement(_tmpl$23);
404
- insert(_el$75, () => item.icon);
405
- return _el$75;
738
+ var _el$127 = getNextElement(_tmpl$37);
739
+ insert(_el$127, () => item.icon);
740
+ return _el$127;
406
741
  }
407
- }), _el$77, _co$12);
408
- insert(_el$74, () => item.label, _el$79, _co$13);
409
- effect(() => className(_el$74, `px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${item.variant === "primary" ? "bg-blue-600 text-white hover:bg-blue-700" : item.variant === "danger" ? "bg-red-600 text-white hover:bg-red-700" : "border border-gray-200 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`));
742
+ }), _el$129, _co$24);
743
+ insert(_el$126, () => item.label, _el$131, _co$25);
744
+ effect(() => className(_el$126, `px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${item.variant === "primary" ? "bg-blue-600 text-white hover:bg-blue-700" : item.variant === "danger" ? "bg-red-600 text-white hover:bg-red-700" : "border border-gray-200 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`));
410
745
  runHydrationEvents();
411
- return _el$74;
746
+ return _el$126;
412
747
  })()
413
748
  }));
414
- return _el$73;
415
- })();
416
- };
417
- const StepsSection = (props) => {
418
- const steps = () => {
419
- if (Array.isArray(props.content)) return props.content;
420
- return [];
421
- };
422
- return (() => {
423
- var _el$80 = getNextElement(_tmpl$25);
424
- insert(_el$80, createComponent(For, {
425
- get each() {
426
- return steps();
427
- },
428
- children: (step, i) => [createComponent(Show, {
429
- get when() {
430
- return i() > 0;
431
- },
432
- get children() {
433
- var _el$81 = getNextElement(_tmpl$26);
434
- effect(() => className(_el$81, `w-6 h-px ${step.status === "pending" ? "bg-gray-300 dark:bg-gray-600" : "bg-blue-400"}`));
435
- return _el$81;
436
- }
437
- }), (() => {
438
- var _el$82 = getNextElement(_tmpl$27), _el$83 = _el$82.firstChild, [_el$84, _co$14] = getNextMarker(_el$83.nextSibling), _el$85 = _el$84.nextSibling, [_el$86, _co$15] = getNextMarker(_el$85.nextSibling);
439
- insert(_el$82, (() => {
440
- var _c$4 = memo(() => step.status === "done");
441
- return () => _c$4() ? "✓" : step.status === "active" ? "●" : "○";
442
- })(), _el$84, _co$14);
443
- insert(_el$82, () => step.label, _el$86, _co$15);
444
- effect(() => className(_el$82, `flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium ${step.status === "done" ? "text-green-600 dark:text-green-400" : step.status === "active" ? "text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20" : "text-gray-400"}`));
445
- return _el$82;
446
- })()]
447
- }));
448
- return _el$80;
749
+ return _el$125;
449
750
  })();
450
751
  };
451
- delegateEvents(["click"]);
752
+ delegateEvents(["click", "input"]);
452
753
  export {
453
754
  ScratchpadPanel
454
755
  };