@seed-ship/mcp-ui-solid 2.10.3 → 2.12.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,9 +1,9 @@
1
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
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-2 border-b border-gray-100 dark:border-gray-700 flex flex-wrap items-center gap-1.5">`), _tmpl$4 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700 space-y-2">`), _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><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$6 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700">`), _tmpl$7 = /* @__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$8 = /* @__PURE__ */ template(`<div style=overflow-y:auto><!$><!/><div class="divide-y divide-gray-100 dark:divide-gray-700"></div><!$><!/><!$><!/><!$><!/>`), _tmpl$9 = /* @__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>
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-2 border-b border-gray-100 dark:border-gray-700 flex flex-wrap items-center gap-1.5">`), _tmpl$4 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700 space-y-2">`), _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><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$6 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-gray-100 dark:border-gray-700">`), _tmpl$7 = /* @__PURE__ */ template(`<p class="text-xs text-red-500 dark:text-red-500 mt-0.5">Code: <!$><!/>`), _tmpl$8 = /* @__PURE__ */ template(`<button type=button class="px-3 py-1.5 text-sm font-medium rounded-lg bg-red-600 text-white hover:bg-red-700 transition-colors flex items-center gap-1">&#128260; Retry`), _tmpl$9 = /* @__PURE__ */ template(`<button type=button class="px-3 py-1.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">Close`), _tmpl$0 = /* @__PURE__ */ template(`<div class="px-4 py-3 border-t border-red-100 dark:border-red-900/30 bg-red-50 dark:bg-red-900/10"><div class="flex items-start gap-2 text-sm text-red-700 dark:text-red-400"><span class="flex-shrink-0 mt-0.5">⚠️</span><div class=flex-1><p class=font-medium></p><!$><!/></div></div><div class="flex gap-2 mt-2"><!$><!/><!$><!/>`), _tmpl$1 = /* @__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$10 = /* @__PURE__ */ template(`<div style=overflow-y:auto><!$><!/><div class="divide-y divide-gray-100 dark:divide-gray-700"></div><!$><!/><!$><!/><!$><!/><!$><!/>`), _tmpl$11 = /* @__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
5
  @keyframes scratchpad-slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
6
- `), _tmpl$0 = /* @__PURE__ */ template(`<svg class="w-3 h-3 text-gray-300 dark:text-gray-600 flex-shrink-0"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$1 = /* @__PURE__ */ template(`<span class="ml-1 font-normal opacity-75">— <!$><!/>`), _tmpl$10 = /* @__PURE__ */ template(`<span><!$><!/> <!$><!/><!$><!/>`), _tmpl$11 = /* @__PURE__ */ template(`<div><span class="flex-shrink-0 mt-0.5"></span><p>`), _tmpl$12 = /* @__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$13 = /* @__PURE__ */ template(`<p class="text-sm text-gray-700 dark:text-gray-300">`), _tmpl$14 = /* @__PURE__ */ template(`<div class="mt-2 overflow-x-auto"><table class="min-w-full text-xs"><thead><tr></tr></thead><tbody>`), _tmpl$15 = /* @__PURE__ */ template(`<th class="px-2 py-1 text-left font-medium text-gray-500 dark:text-gray-400">`), _tmpl$16 = /* @__PURE__ */ template(`<tr class="border-t border-gray-100 dark:border-gray-700">`), _tmpl$17 = /* @__PURE__ */ template(`<td class="px-2 py-1 text-gray-700 dark:text-gray-300">`), _tmpl$18 = /* @__PURE__ */ template(`<pre class="text-xs text-gray-500 overflow-auto">`), _tmpl$19 = /* @__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$20 = /* @__PURE__ */ template(`<div class=space-y-1>`), _tmpl$21 = /* @__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$22 = /* @__PURE__ */ template(`<p class="text-xs text-gray-400 italic">No filters`), _tmpl$23 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-1.5"><!$><!/><!$><!/>`), _tmpl$24 = /* @__PURE__ */ template(`<button type=button class="ml-0.5 hover:text-blue-900 dark:hover:text-blue-100">&times;`), _tmpl$25 = /* @__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$26 = /* @__PURE__ */ template(`<div class="max-h-48 overflow-y-auto">`), _tmpl$27 = /* @__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$28 = /* @__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$29 = /* @__PURE__ */ template(`<div class=relative><!$><!/><!$><!/>`), _tmpl$30 = /* @__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$31 = /* @__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$32 = /* @__PURE__ */ template(`<span class=ml-1>✓`), _tmpl$33 = /* @__PURE__ */ template(`<button type=button><!$><!/><!$><!/>`), _tmpl$34 = /* @__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$35 = /* @__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$36 = /* @__PURE__ */ template(`<div class=space-y-3><!$><!/><!$><!/>`), _tmpl$37 = /* @__PURE__ */ template(`<span class="text-xs font-normal text-gray-500 dark:text-gray-400">— <!$><!/>`), _tmpl$38 = /* @__PURE__ */ template(`<div class="mt-2 ml-6">`), _tmpl$39 = /* @__PURE__ */ template(`<div><div><span></span><!$><!/><!$><!/></div><!$><!/>`), _tmpl$40 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-2">`), _tmpl$41 = /* @__PURE__ */ template(`<span class=mr-1>`), _tmpl$42 = /* @__PURE__ */ template(`<div class=space-y-2><div class=space-y-1.5></div><!$><!/>`), _tmpl$43 = /* @__PURE__ */ template(`<div class="flex items-center gap-2 text-sm"><span></span><span class="text-gray-900 dark:text-white">`), _tmpl$44 = /* @__PURE__ */ template(`<div class="flex items-start gap-1.5 text-xs text-amber-600 dark:text-amber-400"><span class=flex-shrink-0>⚠️</span><span>`), _tmpl$45 = /* @__PURE__ */ template(`<input type=text class="w-full px-3 py-2 text-sm border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:border-blue-400 outline-none">`), _tmpl$46 = /* @__PURE__ */ template(`<div class=space-y-3><p class="text-sm text-gray-700 dark:text-gray-300"></p><div class="flex gap-2"><button type=button class="px-3 py-1.5 text-sm font-medium rounded-lg bg-green-600 text-white hover:bg-green-700 transition-colors flex items-center gap-1">&#128077; <!$><!/></button><button type=button class="px-3 py-1.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex items-center gap-1">&#128078; <!$><!/></button></div><!$><!/>`), _tmpl$47 = /* @__PURE__ */ template(`<p class="text-xs text-gray-500 dark:text-gray-400 italic">"<!$><!/>"`), _tmpl$48 = /* @__PURE__ */ template(`<div class="mt-2 px-3 py-2 bg-blue-50 dark:bg-blue-900/10 rounded-lg text-sm text-blue-700 dark:text-blue-300"><span class=font-medium>Plan:</span> <!$><!/>`), _tmpl$49 = /* @__PURE__ */ template(`<button type=button class="text-xs text-blue-600 dark:text-blue-400 hover:underline flex items-center gap-1">&#9998; Modify`), _tmpl$50 = /* @__PURE__ */ template(`<div class=space-y-2><!$><!/><div class=space-y-1></div><!$><!/><!$><!/>`), _tmpl$51 = /* @__PURE__ */ template(`<div class="flex gap-2 text-sm"><span class="text-gray-500 dark:text-gray-400 font-medium min-w-[80px]"><!$><!/>:</span><span class="text-gray-900 dark:text-white">`);
6
+ `), _tmpl$12 = /* @__PURE__ */ template(`<svg class="w-3 h-3 text-gray-300 dark:text-gray-600 flex-shrink-0"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$13 = /* @__PURE__ */ template(`<span class="ml-1 font-normal opacity-75">— <!$><!/>`), _tmpl$14 = /* @__PURE__ */ template(`<span><!$><!/> <!$><!/><!$><!/>`), _tmpl$15 = /* @__PURE__ */ template(`<div><span class="flex-shrink-0 mt-0.5"></span><p>`), _tmpl$16 = /* @__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$17 = /* @__PURE__ */ template(`<p class="text-sm text-gray-700 dark:text-gray-300">`), _tmpl$18 = /* @__PURE__ */ template(`<div class="mt-2 overflow-x-auto"><table class="min-w-full text-xs"><thead><tr></tr></thead><tbody>`), _tmpl$19 = /* @__PURE__ */ template(`<th class="px-2 py-1 text-left font-medium text-gray-500 dark:text-gray-400">`), _tmpl$20 = /* @__PURE__ */ template(`<tr class="border-t border-gray-100 dark:border-gray-700">`), _tmpl$21 = /* @__PURE__ */ template(`<td class="px-2 py-1 text-gray-700 dark:text-gray-300">`), _tmpl$22 = /* @__PURE__ */ template(`<pre class="text-xs text-gray-500 overflow-auto">`), _tmpl$23 = /* @__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$24 = /* @__PURE__ */ template(`<div class=space-y-1>`), _tmpl$25 = /* @__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$26 = /* @__PURE__ */ template(`<p class="text-xs text-gray-400 italic">No filters`), _tmpl$27 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-1.5"><!$><!/><!$><!/>`), _tmpl$28 = /* @__PURE__ */ template(`<button type=button class="ml-0.5 hover:text-blue-900 dark:hover:text-blue-100">&times;`), _tmpl$29 = /* @__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$30 = /* @__PURE__ */ template(`<div class="max-h-48 overflow-y-auto">`), _tmpl$31 = /* @__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$32 = /* @__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$33 = /* @__PURE__ */ template(`<div class=relative><!$><!/><!$><!/>`), _tmpl$34 = /* @__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$35 = /* @__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$36 = /* @__PURE__ */ template(`<span class=ml-1>✓`), _tmpl$37 = /* @__PURE__ */ template(`<button type=button><!$><!/><!$><!/>`), _tmpl$38 = /* @__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$39 = /* @__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$40 = /* @__PURE__ */ template(`<div class=space-y-3><!$><!/><!$><!/>`), _tmpl$41 = /* @__PURE__ */ template(`<span class="text-xs font-normal text-gray-500 dark:text-gray-400">— <!$><!/>`), _tmpl$42 = /* @__PURE__ */ template(`<div class="mt-2 ml-6">`), _tmpl$43 = /* @__PURE__ */ template(`<div><div><span></span><!$><!/><!$><!/></div><!$><!/>`), _tmpl$44 = /* @__PURE__ */ template(`<div class="flex flex-wrap gap-2">`), _tmpl$45 = /* @__PURE__ */ template(`<span class=mr-1>`), _tmpl$46 = /* @__PURE__ */ template(`<div class=space-y-2><div class=space-y-1.5></div><!$><!/>`), _tmpl$47 = /* @__PURE__ */ template(`<div class="flex items-center gap-2 text-sm"><span></span><span class="text-gray-900 dark:text-white">`), _tmpl$48 = /* @__PURE__ */ template(`<div class="flex items-start gap-1.5 text-xs text-amber-600 dark:text-amber-400"><span class=flex-shrink-0>⚠️</span><span>`), _tmpl$49 = /* @__PURE__ */ template(`<div class="flex gap-1"><input type=text class="flex-1 px-3 py-2 text-sm border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:border-blue-400 outline-none"><button type=button class="px-3 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700">Send`), _tmpl$50 = /* @__PURE__ */ template(`<div class=space-y-3><p class="text-sm text-gray-700 dark:text-gray-300"></p><div class="flex flex-wrap gap-2"></div><!$><!/>`), _tmpl$51 = /* @__PURE__ */ template(`<span>`), _tmpl$52 = /* @__PURE__ */ template(`<p class="text-xs text-gray-500 dark:text-gray-400 italic">"<!$><!/>"`), _tmpl$53 = /* @__PURE__ */ template(`<div class="mt-2 px-3 py-2 bg-blue-50 dark:bg-blue-900/10 rounded-lg text-sm text-blue-700 dark:text-blue-300"><span class=font-medium>Plan:</span> <!$><!/>`), _tmpl$54 = /* @__PURE__ */ template(`<button type=button class="text-xs text-blue-600 dark:text-blue-400 hover:underline flex items-center gap-1">&#9998; Modify`), _tmpl$55 = /* @__PURE__ */ template(`<div class=space-y-2><!$><!/><div class=space-y-1></div><!$><!/><!$><!/>`), _tmpl$56 = /* @__PURE__ */ template(`<div class="flex gap-2 text-sm"><span class="text-gray-500 dark:text-gray-400 font-medium min-w-[80px]"><!$><!/>:</span><span class="text-gray-900 dark:text-white">`);
7
7
  const STATUS_BADGES = {
8
8
  loading: {
9
9
  label: "Loading...",
@@ -24,6 +24,10 @@ const STATUS_BADGES = {
24
24
  complete: {
25
25
  label: "Complete",
26
26
  class: "bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400"
27
+ },
28
+ error: {
29
+ label: "Error",
30
+ class: "bg-red-100 text-red-600 dark:bg-red-900/30 dark:text-red-400"
27
31
  }
28
32
  };
29
33
  const ScratchpadPanel = (props) => {
@@ -53,9 +57,10 @@ const ScratchpadPanel = (props) => {
53
57
  previewTimer = setTimeout(async () => {
54
58
  try {
55
59
  const res = await fetch(endpoint, {
56
- method: "POST",
60
+ method: props.state.previewMethod || "POST",
57
61
  headers: {
58
- "Content-Type": "application/json"
62
+ "Content-Type": "application/json",
63
+ ...props.state.previewHeaders
59
64
  },
60
65
  credentials: "include",
61
66
  body: JSON.stringify({
@@ -71,8 +76,8 @@ const ScratchpadPanel = (props) => {
71
76
  if (previewTimer) clearTimeout(previewTimer);
72
77
  });
73
78
  return (() => {
74
- var _el$ = getNextElement(_tmpl$9), _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$32 = _el$2.nextSibling, [_el$33, _co$7] = getNextMarker(_el$32.nextSibling);
75
- _el$33.nextSibling;
79
+ var _el$ = getNextElement(_tmpl$11), _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$52 = _el$2.nextSibling, [_el$53, _co$10] = getNextMarker(_el$52.nextSibling);
80
+ _el$53.nextSibling;
76
81
  _el$2.$$click = () => isCollapsible() && setCollapsed(!collapsed());
77
82
  insert(_el$5, () => props.state.title);
78
83
  insert(_el$3, createComponent(Show, {
@@ -106,7 +111,7 @@ const ScratchpadPanel = (props) => {
106
111
  return !collapsed();
107
112
  },
108
113
  get children() {
109
- var _el$12 = getNextElement(_tmpl$8), _el$23 = _el$12.firstChild, [_el$24, _co$3] = getNextMarker(_el$23.nextSibling), _el$14 = _el$24.nextSibling, _el$25 = _el$14.nextSibling, [_el$26, _co$4] = getNextMarker(_el$25.nextSibling), _el$27 = _el$26.nextSibling, [_el$28, _co$5] = getNextMarker(_el$27.nextSibling), _el$29 = _el$28.nextSibling, [_el$30, _co$6] = getNextMarker(_el$29.nextSibling);
114
+ var _el$12 = getNextElement(_tmpl$10), _el$41 = _el$12.firstChild, [_el$42, _co$7] = getNextMarker(_el$41.nextSibling), _el$14 = _el$42.nextSibling, _el$43 = _el$14.nextSibling, [_el$44, _co$8] = getNextMarker(_el$43.nextSibling), _el$45 = _el$44.nextSibling, [_el$46, _co$9] = getNextMarker(_el$45.nextSibling), _el$47 = _el$46.nextSibling, [_el$48, _co$0] = getNextMarker(_el$47.nextSibling), _el$49 = _el$48.nextSibling, [_el$50, _co$1] = getNextMarker(_el$49.nextSibling);
110
115
  insert(_el$12, createComponent(Show, {
111
116
  get when() {
112
117
  return memo(() => !!props.state.turnHistory)() && props.state.turnHistory.length > 0;
@@ -122,32 +127,32 @@ const ScratchpadPanel = (props) => {
122
127
  return i() > 0;
123
128
  },
124
129
  get children() {
125
- return getNextElement(_tmpl$0);
130
+ return getNextElement(_tmpl$12);
126
131
  }
127
132
  }), (() => {
128
- var _el$35 = getNextElement(_tmpl$10), _el$41 = _el$35.firstChild, [_el$42, _co$9] = getNextMarker(_el$41.nextSibling), _el$36 = _el$42.nextSibling, _el$43 = _el$36.nextSibling, [_el$44, _co$0] = getNextMarker(_el$43.nextSibling), _el$45 = _el$44.nextSibling, [_el$46, _co$1] = getNextMarker(_el$45.nextSibling);
129
- insert(_el$35, (() => {
133
+ var _el$55 = getNextElement(_tmpl$14), _el$61 = _el$55.firstChild, [_el$62, _co$12] = getNextMarker(_el$61.nextSibling), _el$56 = _el$62.nextSibling, _el$63 = _el$56.nextSibling, [_el$64, _co$13] = getNextMarker(_el$63.nextSibling), _el$65 = _el$64.nextSibling, [_el$66, _co$14] = getNextMarker(_el$65.nextSibling);
134
+ insert(_el$55, (() => {
130
135
  var _c$ = memo(() => turn.status === "done");
131
136
  return () => _c$() ? "✅" : turn.status === "active" ? "●" : "○";
132
- })(), _el$42, _co$9);
133
- insert(_el$35, () => turn.label, _el$44, _co$0);
134
- insert(_el$35, createComponent(Show, {
137
+ })(), _el$62, _co$12);
138
+ insert(_el$55, () => turn.label, _el$64, _co$13);
139
+ insert(_el$55, createComponent(Show, {
135
140
  get when() {
136
141
  return turn.summary;
137
142
  },
138
143
  get children() {
139
- var _el$37 = getNextElement(_tmpl$1), _el$38 = _el$37.firstChild, _el$39 = _el$38.nextSibling, [_el$40, _co$8] = getNextMarker(_el$39.nextSibling);
140
- insert(_el$37, () => turn.summary, _el$40, _co$8);
141
- return _el$37;
144
+ var _el$57 = getNextElement(_tmpl$13), _el$58 = _el$57.firstChild, _el$59 = _el$58.nextSibling, [_el$60, _co$11] = getNextMarker(_el$59.nextSibling);
145
+ insert(_el$57, () => turn.summary, _el$60, _co$11);
146
+ return _el$57;
142
147
  }
143
- }), _el$46, _co$1);
144
- effect(() => className(_el$35, `text-xs font-medium px-2 py-0.5 rounded-full ${turn.status === "done" ? "bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400" : turn.status === "active" ? "bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400" : turn.status === "skipped" ? "bg-gray-100 dark:bg-gray-700 text-gray-400 line-through" : "bg-gray-100 dark:bg-gray-700 text-gray-400"}`));
145
- return _el$35;
148
+ }), _el$66, _co$14);
149
+ effect(() => className(_el$55, `text-xs font-medium px-2 py-0.5 rounded-full ${turn.status === "done" ? "bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400" : turn.status === "active" ? "bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400" : turn.status === "skipped" ? "bg-gray-100 dark:bg-gray-700 text-gray-400 line-through" : "bg-gray-100 dark:bg-gray-700 text-gray-400"}`));
150
+ return _el$55;
146
151
  })()]
147
152
  }));
148
153
  return _el$13;
149
154
  }
150
- }), _el$24, _co$3);
155
+ }), _el$42, _co$7);
151
156
  insert(_el$14, createComponent(For, {
152
157
  get each() {
153
158
  return props.state.sections;
@@ -165,6 +170,9 @@ const ScratchpadPanel = (props) => {
165
170
  },
166
171
  get onSectionEdit() {
167
172
  return props.onSectionEdit;
173
+ },
174
+ get onSubmit() {
175
+ return props.onSubmit;
168
176
  }
169
177
  })
170
178
  }));
@@ -179,19 +187,19 @@ const ScratchpadPanel = (props) => {
179
187
  return props.state.agentMessages;
180
188
  },
181
189
  children: (msg) => (() => {
182
- var _el$47 = getNextElement(_tmpl$11), _el$48 = _el$47.firstChild, _el$49 = _el$48.nextSibling;
183
- insert(_el$48, (() => {
190
+ var _el$67 = getNextElement(_tmpl$15), _el$68 = _el$67.firstChild, _el$69 = _el$68.nextSibling;
191
+ insert(_el$68, (() => {
184
192
  var _c$2 = memo(() => msg.type === "warning");
185
193
  return () => _c$2() ? "⚠️" : msg.type === "question" ? "❓" : "ℹ️";
186
194
  })());
187
- insert(_el$49, () => msg.text);
188
- effect(() => className(_el$47, `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"}`));
189
- return _el$47;
195
+ insert(_el$69, () => msg.text);
196
+ effect(() => className(_el$67, `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"}`));
197
+ return _el$67;
190
198
  })()
191
199
  }));
192
200
  return _el$15;
193
201
  }
194
- }), _el$26, _co$4);
202
+ }), _el$44, _co$8);
195
203
  insert(_el$12, createComponent(Show, {
196
204
  get when() {
197
205
  return preview();
@@ -204,49 +212,49 @@ const ScratchpadPanel = (props) => {
204
212
  },
205
213
  get fallback() {
206
214
  return [(() => {
207
- var _el$50 = getNextElement(_tmpl$12), _el$51 = _el$50.firstChild, _el$52 = _el$51.nextSibling;
208
- insert(_el$52, () => preview().count.toLocaleString());
209
- return _el$50;
215
+ var _el$70 = getNextElement(_tmpl$16), _el$71 = _el$70.firstChild, _el$72 = _el$71.nextSibling;
216
+ insert(_el$72, () => preview().count.toLocaleString());
217
+ return _el$70;
210
218
  })(), (() => {
211
- var _el$53 = getNextElement(_tmpl$13);
212
- insert(_el$53, () => preview().summary);
213
- return _el$53;
219
+ var _el$73 = getNextElement(_tmpl$17);
220
+ insert(_el$73, () => preview().summary);
221
+ return _el$73;
214
222
  })(), createComponent(Show, {
215
223
  get when() {
216
224
  return memo(() => !!preview().rows)() && preview().rows.length > 0;
217
225
  },
218
226
  get children() {
219
- var _el$54 = getNextElement(_tmpl$14), _el$55 = _el$54.firstChild, _el$56 = _el$55.firstChild, _el$57 = _el$56.firstChild, _el$58 = _el$56.nextSibling;
220
- insert(_el$57, createComponent(For, {
227
+ var _el$74 = getNextElement(_tmpl$18), _el$75 = _el$74.firstChild, _el$76 = _el$75.firstChild, _el$77 = _el$76.firstChild, _el$78 = _el$76.nextSibling;
228
+ insert(_el$77, createComponent(For, {
221
229
  get each() {
222
230
  return Object.keys(preview().rows[0]);
223
231
  },
224
232
  children: (k) => (() => {
225
- var _el$59 = getNextElement(_tmpl$15);
226
- insert(_el$59, k);
227
- return _el$59;
233
+ var _el$79 = getNextElement(_tmpl$19);
234
+ insert(_el$79, k);
235
+ return _el$79;
228
236
  })()
229
237
  }));
230
- insert(_el$58, createComponent(For, {
238
+ insert(_el$78, createComponent(For, {
231
239
  get each() {
232
240
  return preview().rows.slice(0, 5);
233
241
  },
234
242
  children: (row) => (() => {
235
- var _el$60 = getNextElement(_tmpl$16);
236
- insert(_el$60, createComponent(For, {
243
+ var _el$80 = getNextElement(_tmpl$20);
244
+ insert(_el$80, createComponent(For, {
237
245
  get each() {
238
246
  return Object.values(row);
239
247
  },
240
248
  children: (v) => (() => {
241
- var _el$61 = getNextElement(_tmpl$17);
242
- insert(_el$61, () => String(v));
243
- return _el$61;
249
+ var _el$81 = getNextElement(_tmpl$21);
250
+ insert(_el$81, () => String(v));
251
+ return _el$81;
244
252
  })()
245
253
  }));
246
- return _el$60;
254
+ return _el$80;
247
255
  })()
248
256
  }));
249
- return _el$54;
257
+ return _el$74;
250
258
  }
251
259
  })];
252
260
  },
@@ -262,27 +270,75 @@ const ScratchpadPanel = (props) => {
262
270
  }));
263
271
  return _el$16;
264
272
  }
265
- }), _el$28, _co$5);
273
+ }), _el$46, _co$9);
274
+ insert(_el$12, createComponent(Show, {
275
+ get when() {
276
+ return memo(() => props.state.status === "error")() && props.state.error;
277
+ },
278
+ get children() {
279
+ var _el$21 = getNextElement(_tmpl$0), _el$22 = _el$21.firstChild, _el$23 = _el$22.firstChild, _el$24 = _el$23.nextSibling, _el$25 = _el$24.firstChild, _el$30 = _el$25.nextSibling, [_el$31, _co$4] = getNextMarker(_el$30.nextSibling), _el$32 = _el$22.nextSibling, _el$35 = _el$32.firstChild, [_el$36, _co$5] = getNextMarker(_el$35.nextSibling), _el$37 = _el$36.nextSibling, [_el$38, _co$6] = getNextMarker(_el$37.nextSibling);
280
+ insert(_el$25, () => props.state.error.message);
281
+ insert(_el$24, createComponent(Show, {
282
+ get when() {
283
+ return props.state.error.code;
284
+ },
285
+ get children() {
286
+ var _el$26 = getNextElement(_tmpl$7), _el$27 = _el$26.firstChild, _el$28 = _el$27.nextSibling, [_el$29, _co$3] = getNextMarker(_el$28.nextSibling);
287
+ insert(_el$26, () => props.state.error.code, _el$29, _co$3);
288
+ return _el$26;
289
+ }
290
+ }), _el$31, _co$4);
291
+ insert(_el$32, createComponent(Show, {
292
+ get when() {
293
+ return props.state.error.retryable !== false;
294
+ },
295
+ get children() {
296
+ var _el$33 = getNextElement(_tmpl$8);
297
+ _el$33.$$click = () => {
298
+ var _a;
299
+ return (_a = props.onRetry) == null ? void 0 : _a.call(props);
300
+ };
301
+ runHydrationEvents();
302
+ return _el$33;
303
+ }
304
+ }), _el$36, _co$5);
305
+ insert(_el$32, createComponent(Show, {
306
+ get when() {
307
+ return props.onClose;
308
+ },
309
+ get children() {
310
+ var _el$34 = getNextElement(_tmpl$9);
311
+ _el$34.$$click = () => {
312
+ var _a;
313
+ return (_a = props.onClose) == null ? void 0 : _a.call(props);
314
+ };
315
+ runHydrationEvents();
316
+ return _el$34;
317
+ }
318
+ }), _el$38, _co$6);
319
+ return _el$21;
320
+ }
321
+ }), _el$48, _co$0);
266
322
  insert(_el$12, createComponent(Show, {
267
323
  get when() {
268
324
  return memo(() => props.state.status === "waiting_human")() && hasFilters();
269
325
  },
270
326
  get children() {
271
- var _el$21 = getNextElement(_tmpl$7), _el$22 = _el$21.firstChild;
272
- _el$22.$$click = () => {
327
+ var _el$39 = getNextElement(_tmpl$1), _el$40 = _el$39.firstChild;
328
+ _el$40.$$click = () => {
273
329
  var _a;
274
330
  return (_a = props.onAction) == null ? void 0 : _a.call(props, "search", {
275
331
  filters: props.state.filters
276
332
  });
277
333
  };
278
334
  runHydrationEvents();
279
- return _el$21;
335
+ return _el$39;
280
336
  }
281
- }), _el$30, _co$6);
337
+ }), _el$50, _co$1);
282
338
  effect((_$p) => setStyleProperty(_el$12, "max-height", props.maxHeight || "500px"));
283
339
  return _el$12;
284
340
  }
285
- }), _el$33, _co$7);
341
+ }), _el$53, _co$10);
286
342
  effect((_p$) => {
287
343
  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}`;
288
344
  _v$ !== _p$.e && className(_el$, _p$.e = _v$);
@@ -300,9 +356,9 @@ const ScratchpadPanel = (props) => {
300
356
  };
301
357
  const SectionRenderer = (props) => {
302
358
  return (() => {
303
- var _el$62 = getNextElement(_tmpl$19), _el$63 = _el$62.firstChild, _el$66 = _el$63.nextSibling, [_el$67, _co$10] = getNextMarker(_el$66.nextSibling);
304
- insert(_el$63, () => props.section.title);
305
- insert(_el$62, createComponent(Switch, {
359
+ var _el$82 = getNextElement(_tmpl$23), _el$83 = _el$82.firstChild, _el$86 = _el$83.nextSibling, [_el$87, _co$15] = getNextMarker(_el$86.nextSibling);
360
+ insert(_el$83, () => props.section.title);
361
+ insert(_el$82, createComponent(Switch, {
306
362
  get children() {
307
363
  return [createComponent(Match, {
308
364
  get when() {
@@ -337,9 +393,9 @@ const SectionRenderer = (props) => {
337
393
  return props.section.type === "message";
338
394
  },
339
395
  get children() {
340
- var _el$64 = getNextElement(_tmpl$13);
341
- insert(_el$64, () => String(props.section.content));
342
- return _el$64;
396
+ var _el$84 = getNextElement(_tmpl$17);
397
+ insert(_el$84, () => String(props.section.content));
398
+ return _el$84;
343
399
  }
344
400
  }), createComponent(Match, {
345
401
  get when() {
@@ -386,6 +442,9 @@ const SectionRenderer = (props) => {
386
442
  },
387
443
  get onAction() {
388
444
  return props.onAction;
445
+ },
446
+ get onSubmit() {
447
+ return props.onSubmit;
389
448
  }
390
449
  });
391
450
  }
@@ -431,37 +490,37 @@ const SectionRenderer = (props) => {
431
490
  }), createComponent(Match, {
432
491
  when: true,
433
492
  get children() {
434
- var _el$65 = getNextElement(_tmpl$18);
435
- insert(_el$65, () => JSON.stringify(props.section.content, null, 2));
436
- return _el$65;
493
+ var _el$85 = getNextElement(_tmpl$22);
494
+ insert(_el$85, () => JSON.stringify(props.section.content, null, 2));
495
+ return _el$85;
437
496
  }
438
497
  })];
439
498
  }
440
- }), _el$67, _co$10);
441
- return _el$62;
499
+ }), _el$87, _co$15);
500
+ return _el$82;
442
501
  })();
443
502
  };
444
503
  const DataSection = (props) => {
445
504
  const entries = () => typeof props.content === "object" && props.content ? Object.entries(props.content) : [];
446
505
  return (() => {
447
- var _el$68 = getNextElement(_tmpl$20);
448
- insert(_el$68, createComponent(For, {
506
+ var _el$88 = getNextElement(_tmpl$24);
507
+ insert(_el$88, createComponent(For, {
449
508
  get each() {
450
509
  return entries();
451
510
  },
452
511
  children: ([k, v]) => (() => {
453
- var _el$69 = getNextElement(_tmpl$21), _el$70 = _el$69.firstChild, _el$72 = _el$70.firstChild, [_el$73, _co$11] = getNextMarker(_el$72.nextSibling);
454
- _el$73.nextSibling;
455
- var _el$74 = _el$70.nextSibling;
456
- insert(_el$70, k, _el$73, _co$11);
457
- insert(_el$74, (() => {
512
+ var _el$89 = getNextElement(_tmpl$25), _el$90 = _el$89.firstChild, _el$92 = _el$90.firstChild, [_el$93, _co$16] = getNextMarker(_el$92.nextSibling);
513
+ _el$93.nextSibling;
514
+ var _el$94 = _el$90.nextSibling;
515
+ insert(_el$90, k, _el$93, _co$16);
516
+ insert(_el$94, (() => {
458
517
  var _c$3 = memo(() => !!Array.isArray(v));
459
518
  return () => _c$3() ? v.join(", ") : String(v);
460
519
  })());
461
- return _el$69;
520
+ return _el$89;
462
521
  })()
463
522
  }));
464
- return _el$68;
523
+ return _el$88;
465
524
  })();
466
525
  };
467
526
  const InteractiveFilterSection = (props) => {
@@ -495,8 +554,8 @@ const InteractiveFilterSection = (props) => {
495
554
  };
496
555
  const getDef = (key) => filterDefs()[key] || {};
497
556
  return (() => {
498
- var _el$75 = getNextElement(_tmpl$23), _el$77 = _el$75.firstChild, [_el$78, _co$12] = getNextMarker(_el$77.nextSibling), _el$79 = _el$78.nextSibling, [_el$80, _co$13] = getNextMarker(_el$79.nextSibling);
499
- insert(_el$75, createComponent(For, {
557
+ var _el$95 = getNextElement(_tmpl$27), _el$97 = _el$95.firstChild, [_el$98, _co$17] = getNextMarker(_el$97.nextSibling), _el$99 = _el$98.nextSibling, [_el$100, _co$18] = getNextMarker(_el$99.nextSibling);
558
+ insert(_el$95, createComponent(For, {
500
559
  get each() {
501
560
  return allKeys();
502
561
  },
@@ -505,136 +564,136 @@ const InteractiveFilterSection = (props) => {
505
564
  const value = () => props.filters[key];
506
565
  const hasValue = () => value() !== void 0 && value() !== "";
507
566
  return (() => {
508
- var _el$81 = getNextElement(_tmpl$29), _el$97 = _el$81.firstChild, [_el$98, _co$17] = getNextMarker(_el$97.nextSibling), _el$99 = _el$98.nextSibling, [_el$100, _co$18] = getNextMarker(_el$99.nextSibling);
509
- insert(_el$81, createComponent(Show, {
567
+ var _el$101 = getNextElement(_tmpl$33), _el$117 = _el$101.firstChild, [_el$118, _co$22] = getNextMarker(_el$117.nextSibling), _el$119 = _el$118.nextSibling, [_el$120, _co$23] = getNextMarker(_el$119.nextSibling);
568
+ insert(_el$101, createComponent(Show, {
510
569
  get when() {
511
570
  return hasValue();
512
571
  },
513
572
  get fallback() {
514
573
  return (() => {
515
- var _el$101 = getNextElement(_tmpl$30), _el$102 = _el$101.firstChild, _el$103 = _el$102.nextSibling, [_el$104, _co$19] = getNextMarker(_el$103.nextSibling);
516
- _el$101.$$click = () => {
574
+ var _el$121 = getNextElement(_tmpl$34), _el$122 = _el$121.firstChild, _el$123 = _el$122.nextSibling, [_el$124, _co$24] = getNextMarker(_el$123.nextSibling);
575
+ _el$121.$$click = () => {
517
576
  setEditingKey(key);
518
577
  setEditValue("");
519
578
  };
520
- insert(_el$101, () => {
579
+ insert(_el$121, () => {
521
580
  var _a;
522
581
  return ((_a = def()) == null ? void 0 : _a.label) || key;
523
- }, _el$104, _co$19);
582
+ }, _el$124, _co$24);
524
583
  runHydrationEvents();
525
- return _el$101;
584
+ return _el$121;
526
585
  })();
527
586
  },
528
587
  get children() {
529
- var _el$82 = getNextElement(_tmpl$25), _el$83 = _el$82.firstChild, _el$84 = _el$83.firstChild, _el$86 = _el$84.firstChild, [_el$87, _co$14] = getNextMarker(_el$86.nextSibling);
530
- _el$87.nextSibling;
531
- var _el$88 = _el$84.nextSibling, _el$89 = _el$88.nextSibling, [_el$90, _co$15] = getNextMarker(_el$89.nextSibling), _el$92 = _el$83.nextSibling, [_el$93, _co$16] = getNextMarker(_el$92.nextSibling);
532
- _el$83.$$click = () => {
588
+ var _el$102 = getNextElement(_tmpl$29), _el$103 = _el$102.firstChild, _el$104 = _el$103.firstChild, _el$106 = _el$104.firstChild, [_el$107, _co$19] = getNextMarker(_el$106.nextSibling);
589
+ _el$107.nextSibling;
590
+ var _el$108 = _el$104.nextSibling, _el$109 = _el$108.nextSibling, [_el$110, _co$20] = getNextMarker(_el$109.nextSibling), _el$112 = _el$103.nextSibling, [_el$113, _co$21] = getNextMarker(_el$112.nextSibling);
591
+ _el$103.$$click = () => {
533
592
  setEditingKey(key);
534
593
  setEditValue(String(value() || ""));
535
594
  };
536
- insert(_el$84, () => {
595
+ insert(_el$104, () => {
537
596
  var _a;
538
597
  return ((_a = def()) == null ? void 0 : _a.label) || key;
539
- }, _el$87, _co$14);
540
- insert(_el$83, (() => {
598
+ }, _el$107, _co$19);
599
+ insert(_el$103, (() => {
541
600
  var _c$4 = memo(() => !!Array.isArray(value()));
542
601
  return () => _c$4() ? value().join(", ") : String(value());
543
- })(), _el$90, _co$15);
544
- insert(_el$82, createComponent(Show, {
602
+ })(), _el$110, _co$20);
603
+ insert(_el$102, createComponent(Show, {
545
604
  get when() {
546
605
  return props.onFilterChange;
547
606
  },
548
607
  get children() {
549
- var _el$91 = getNextElement(_tmpl$24);
550
- _el$91.$$click = () => removeFilter(key);
551
- setAttribute(_el$91, "aria-label", `Remove ${key}`);
608
+ var _el$111 = getNextElement(_tmpl$28);
609
+ _el$111.$$click = () => removeFilter(key);
610
+ setAttribute(_el$111, "aria-label", `Remove ${key}`);
552
611
  runHydrationEvents();
553
- return _el$91;
612
+ return _el$111;
554
613
  }
555
- }), _el$93, _co$16);
614
+ }), _el$113, _co$21);
556
615
  runHydrationEvents();
557
- return _el$82;
616
+ return _el$102;
558
617
  }
559
- }), _el$98, _co$17);
560
- insert(_el$81, createComponent(Show, {
618
+ }), _el$118, _co$22);
619
+ insert(_el$101, createComponent(Show, {
561
620
  get when() {
562
621
  return editingKey() === key;
563
622
  },
564
623
  get children() {
565
- var _el$94 = getNextElement(_tmpl$28);
566
- insert(_el$94, createComponent(Show, {
624
+ var _el$114 = getNextElement(_tmpl$32);
625
+ insert(_el$114, createComponent(Show, {
567
626
  get when() {
568
627
  var _a;
569
628
  return (_a = def()) == null ? void 0 : _a.options;
570
629
  },
571
630
  get fallback() {
572
631
  return (() => {
573
- var _el$105 = getNextElement(_tmpl$31), _el$106 = _el$105.firstChild, _el$107 = _el$106.nextSibling, _el$108 = _el$107.nextSibling;
574
- _el$105.addEventListener("submit", (e) => {
632
+ var _el$125 = getNextElement(_tmpl$35), _el$126 = _el$125.firstChild, _el$127 = _el$126.nextSibling, _el$128 = _el$127.nextSibling;
633
+ _el$125.addEventListener("submit", (e) => {
575
634
  e.preventDefault();
576
635
  setFilter(key, editValue());
577
636
  });
578
- _el$106.$$input = (e) => setEditValue(e.currentTarget.value);
579
- _el$108.$$click = () => setEditingKey(null);
637
+ _el$126.$$input = (e) => setEditValue(e.currentTarget.value);
638
+ _el$128.$$click = () => setEditingKey(null);
580
639
  effect(() => {
581
640
  var _a;
582
- return setAttribute(_el$106, "placeholder", ((_a = def()) == null ? void 0 : _a.placeholder) || key);
641
+ return setAttribute(_el$126, "placeholder", ((_a = def()) == null ? void 0 : _a.placeholder) || key);
583
642
  });
584
- effect(() => setProperty(_el$106, "value", editValue()));
643
+ effect(() => setProperty(_el$126, "value", editValue()));
585
644
  runHydrationEvents();
586
- return _el$105;
645
+ return _el$125;
587
646
  })();
588
647
  },
589
648
  get children() {
590
649
  return [(() => {
591
- var _el$95 = getNextElement(_tmpl$26);
592
- insert(_el$95, createComponent(For, {
650
+ var _el$115 = getNextElement(_tmpl$30);
651
+ insert(_el$115, createComponent(For, {
593
652
  get each() {
594
653
  return def().options;
595
654
  },
596
655
  children: (opt) => (() => {
597
- var _el$109 = getNextElement(_tmpl$33), _el$111 = _el$109.firstChild, [_el$112, _co$20] = getNextMarker(_el$111.nextSibling), _el$113 = _el$112.nextSibling, [_el$114, _co$21] = getNextMarker(_el$113.nextSibling);
598
- _el$109.$$click = () => setFilter(key, opt.value);
599
- insert(_el$109, () => opt.label, _el$112, _co$20);
600
- insert(_el$109, createComponent(Show, {
656
+ var _el$129 = getNextElement(_tmpl$37), _el$131 = _el$129.firstChild, [_el$132, _co$25] = getNextMarker(_el$131.nextSibling), _el$133 = _el$132.nextSibling, [_el$134, _co$26] = getNextMarker(_el$133.nextSibling);
657
+ _el$129.$$click = () => setFilter(key, opt.value);
658
+ insert(_el$129, () => opt.label, _el$132, _co$25);
659
+ insert(_el$129, createComponent(Show, {
601
660
  get when() {
602
661
  return String(value()) === opt.value;
603
662
  },
604
663
  get children() {
605
- return getNextElement(_tmpl$32);
664
+ return getNextElement(_tmpl$36);
606
665
  }
607
- }), _el$114, _co$21);
608
- effect(() => className(_el$109, `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"}`));
666
+ }), _el$134, _co$26);
667
+ effect(() => className(_el$129, `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"}`));
609
668
  runHydrationEvents();
610
- return _el$109;
669
+ return _el$129;
611
670
  })()
612
671
  }));
613
- return _el$95;
672
+ return _el$115;
614
673
  })(), (() => {
615
- var _el$96 = getNextElement(_tmpl$27);
616
- _el$96.$$click = () => setEditingKey(null);
674
+ var _el$116 = getNextElement(_tmpl$31);
675
+ _el$116.$$click = () => setEditingKey(null);
617
676
  runHydrationEvents();
618
- return _el$96;
677
+ return _el$116;
619
678
  })()];
620
679
  }
621
680
  }));
622
- return _el$94;
681
+ return _el$114;
623
682
  }
624
- }), _el$100, _co$18);
625
- return _el$81;
683
+ }), _el$120, _co$23);
684
+ return _el$101;
626
685
  })();
627
686
  }
628
- }), _el$78, _co$12);
629
- insert(_el$75, createComponent(Show, {
687
+ }), _el$98, _co$17);
688
+ insert(_el$95, createComponent(Show, {
630
689
  get when() {
631
690
  return allKeys().length === 0;
632
691
  },
633
692
  get children() {
634
- return getNextElement(_tmpl$22);
693
+ return getNextElement(_tmpl$26);
635
694
  }
636
- }), _el$80, _co$13);
637
- return _el$75;
695
+ }), _el$100, _co$18);
696
+ return _el$95;
638
697
  })();
639
698
  };
640
699
  const EmbeddedFormSection = (props) => {
@@ -686,15 +745,23 @@ const EmbeddedFormSection = (props) => {
686
745
  const handleSubmit = (e) => {
687
746
  var _a;
688
747
  e.preventDefault();
689
- (_a = props.onAction) == null ? void 0 : _a.call(props, "submit_form", {
690
- sectionId: props.sectionId,
691
- values: formData()
692
- });
748
+ const values = Object.fromEntries(Object.entries(formData()).filter(([key]) => {
749
+ const field = config().fields.find((f) => f.name === key);
750
+ return (field == null ? void 0 : field.fieldStatus) !== "unsupported";
751
+ }).filter(([, v]) => v !== void 0 && v !== "" && !(Array.isArray(v) && v.length === 0)));
752
+ if (props.onSubmit) {
753
+ props.onSubmit(props.sectionId, values);
754
+ } else {
755
+ (_a = props.onAction) == null ? void 0 : _a.call(props, "submit_form", {
756
+ sectionId: props.sectionId,
757
+ values
758
+ });
759
+ }
693
760
  };
694
761
  return (() => {
695
- var _el$115 = getNextElement(_tmpl$34), _el$118 = _el$115.firstChild, [_el$119, _co$22] = getNextMarker(_el$118.nextSibling), _el$116 = _el$119.nextSibling, _el$117 = _el$116.firstChild;
696
- _el$115.addEventListener("submit", handleSubmit);
697
- insert(_el$115, createComponent(For, {
762
+ var _el$135 = getNextElement(_tmpl$38), _el$138 = _el$135.firstChild, [_el$139, _co$27] = getNextMarker(_el$138.nextSibling), _el$136 = _el$139.nextSibling, _el$137 = _el$136.firstChild;
763
+ _el$135.addEventListener("submit", handleSubmit);
764
+ insert(_el$135, createComponent(For, {
698
765
  get each() {
699
766
  return config().fields;
700
767
  },
@@ -708,9 +775,9 @@ const EmbeddedFormSection = (props) => {
708
775
  onChange: (val) => updateField(field.name, val),
709
776
  formData
710
777
  })
711
- }), _el$119, _co$22);
712
- insert(_el$117, () => config().submitLabel);
713
- return _el$115;
778
+ }), _el$139, _co$27);
779
+ insert(_el$137, () => config().submitLabel);
780
+ return _el$135;
714
781
  })();
715
782
  };
716
783
  const EnrichedStepsSection = (props) => {
@@ -722,35 +789,35 @@ const EnrichedStepsSection = (props) => {
722
789
  };
723
790
  };
724
791
  return (() => {
725
- var _el$120 = getNextElement(_tmpl$36), _el$123 = _el$120.firstChild, [_el$124, _co$23] = getNextMarker(_el$123.nextSibling), _el$125 = _el$124.nextSibling, [_el$126, _co$24] = getNextMarker(_el$125.nextSibling);
726
- insert(_el$120, createComponent(For, {
792
+ var _el$140 = getNextElement(_tmpl$40), _el$143 = _el$140.firstChild, [_el$144, _co$28] = getNextMarker(_el$143.nextSibling), _el$145 = _el$144.nextSibling, [_el$146, _co$29] = getNextMarker(_el$145.nextSibling);
793
+ insert(_el$140, createComponent(For, {
727
794
  get each() {
728
795
  return stepsData().steps;
729
796
  },
730
797
  children: (step) => (() => {
731
- var _el$127 = getNextElement(_tmpl$39), _el$128 = _el$127.firstChild, _el$129 = _el$128.firstChild, _el$134 = _el$129.nextSibling, [_el$135, _co$26] = getNextMarker(_el$134.nextSibling), _el$136 = _el$135.nextSibling, [_el$137, _co$27] = getNextMarker(_el$136.nextSibling), _el$139 = _el$128.nextSibling, [_el$140, _co$28] = getNextMarker(_el$139.nextSibling);
732
- insert(_el$129, (() => {
798
+ var _el$147 = getNextElement(_tmpl$43), _el$148 = _el$147.firstChild, _el$149 = _el$148.firstChild, _el$154 = _el$149.nextSibling, [_el$155, _co$31] = getNextMarker(_el$154.nextSibling), _el$156 = _el$155.nextSibling, [_el$157, _co$32] = getNextMarker(_el$156.nextSibling), _el$159 = _el$148.nextSibling, [_el$160, _co$33] = getNextMarker(_el$159.nextSibling);
799
+ insert(_el$149, (() => {
733
800
  var _c$5 = memo(() => step.status === "done");
734
801
  return () => _c$5() ? "✅" : step.status === "active" ? "●" : "○";
735
802
  })());
736
- insert(_el$128, () => step.label, _el$135, _co$26);
737
- insert(_el$128, createComponent(Show, {
803
+ insert(_el$148, () => step.label, _el$155, _co$31);
804
+ insert(_el$148, createComponent(Show, {
738
805
  get when() {
739
806
  return memo(() => !!step.description)() && step.status === "active";
740
807
  },
741
808
  get children() {
742
- var _el$130 = getNextElement(_tmpl$37), _el$131 = _el$130.firstChild, _el$132 = _el$131.nextSibling, [_el$133, _co$25] = getNextMarker(_el$132.nextSibling);
743
- insert(_el$130, () => step.description, _el$133, _co$25);
744
- return _el$130;
809
+ var _el$150 = getNextElement(_tmpl$41), _el$151 = _el$150.firstChild, _el$152 = _el$151.nextSibling, [_el$153, _co$30] = getNextMarker(_el$152.nextSibling);
810
+ insert(_el$150, () => step.description, _el$153, _co$30);
811
+ return _el$150;
745
812
  }
746
- }), _el$137, _co$27);
747
- insert(_el$127, createComponent(Show, {
813
+ }), _el$157, _co$32);
814
+ insert(_el$147, createComponent(Show, {
748
815
  get when() {
749
816
  return memo(() => step.status === "active")() && step.content;
750
817
  },
751
818
  get children() {
752
- var _el$138 = getNextElement(_tmpl$38);
753
- insert(_el$138, createComponent(SectionRenderer, {
819
+ var _el$158 = getNextElement(_tmpl$42);
820
+ insert(_el$158, createComponent(SectionRenderer, {
754
821
  get section() {
755
822
  return step.content;
756
823
  },
@@ -762,71 +829,71 @@ const EnrichedStepsSection = (props) => {
762
829
  return props.onAction;
763
830
  }
764
831
  }));
765
- return _el$138;
832
+ return _el$158;
766
833
  }
767
- }), _el$140, _co$28);
834
+ }), _el$160, _co$33);
768
835
  effect((_p$) => {
769
836
  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"}`;
770
- _v$4 !== _p$.e && className(_el$127, _p$.e = _v$4);
771
- _v$5 !== _p$.t && className(_el$128, _p$.t = _v$5);
837
+ _v$4 !== _p$.e && className(_el$147, _p$.e = _v$4);
838
+ _v$5 !== _p$.t && className(_el$148, _p$.t = _v$5);
772
839
  return _p$;
773
840
  }, {
774
841
  e: void 0,
775
842
  t: void 0
776
843
  });
777
- return _el$127;
844
+ return _el$147;
778
845
  })()
779
- }), _el$124, _co$23);
780
- insert(_el$120, createComponent(Show, {
846
+ }), _el$144, _co$28);
847
+ insert(_el$140, createComponent(Show, {
781
848
  get when() {
782
849
  return stepsData().steps.some((s) => s.status === "active");
783
850
  },
784
851
  get children() {
785
- var _el$121 = getNextElement(_tmpl$35), _el$122 = _el$121.firstChild;
786
- _el$122.$$click = () => {
852
+ var _el$141 = getNextElement(_tmpl$39), _el$142 = _el$141.firstChild;
853
+ _el$142.$$click = () => {
787
854
  var _a;
788
855
  return (_a = props.onAction) == null ? void 0 : _a.call(props, "next_step", {
789
856
  step: stepsData().currentStep
790
857
  });
791
858
  };
792
859
  runHydrationEvents();
793
- return _el$121;
860
+ return _el$141;
794
861
  }
795
- }), _el$126, _co$24);
796
- return _el$120;
862
+ }), _el$146, _co$29);
863
+ return _el$140;
797
864
  })();
798
865
  };
799
866
  const ActionSection = (props) => {
800
867
  const actions = () => Array.isArray(props.content) ? props.content : [];
801
868
  return (() => {
802
- var _el$141 = getNextElement(_tmpl$40);
803
- insert(_el$141, createComponent(For, {
869
+ var _el$161 = getNextElement(_tmpl$44);
870
+ insert(_el$161, createComponent(For, {
804
871
  get each() {
805
872
  return actions();
806
873
  },
807
874
  children: (item) => (() => {
808
- var _el$142 = getNextElement(_tmpl$33), _el$144 = _el$142.firstChild, [_el$145, _co$29] = getNextMarker(_el$144.nextSibling), _el$146 = _el$145.nextSibling, [_el$147, _co$30] = getNextMarker(_el$146.nextSibling);
809
- _el$142.$$click = () => {
875
+ var _el$162 = getNextElement(_tmpl$37), _el$164 = _el$162.firstChild, [_el$165, _co$34] = getNextMarker(_el$164.nextSibling), _el$166 = _el$165.nextSibling, [_el$167, _co$35] = getNextMarker(_el$166.nextSibling);
876
+ _el$162.$$click = () => {
810
877
  var _a;
811
878
  return (_a = props.onAction) == null ? void 0 : _a.call(props, item.value || item.action || item.label, item);
812
879
  };
813
- insert(_el$142, createComponent(Show, {
880
+ insert(_el$162, createComponent(Show, {
814
881
  get when() {
815
882
  return item.icon;
816
883
  },
817
884
  get children() {
818
- var _el$143 = getNextElement(_tmpl$41);
819
- insert(_el$143, () => item.icon);
820
- return _el$143;
885
+ var _el$163 = getNextElement(_tmpl$45);
886
+ insert(_el$163, () => item.icon);
887
+ return _el$163;
821
888
  }
822
- }), _el$145, _co$29);
823
- insert(_el$142, () => item.label, _el$147, _co$30);
824
- effect(() => className(_el$142, `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"}`));
889
+ }), _el$165, _co$34);
890
+ insert(_el$162, () => item.label, _el$167, _co$35);
891
+ effect(() => className(_el$162, `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"}`));
825
892
  runHydrationEvents();
826
- return _el$142;
893
+ return _el$162;
827
894
  })()
828
895
  }));
829
- return _el$141;
896
+ return _el$161;
830
897
  })();
831
898
  };
832
899
  const UnderstandingSection = (props) => {
@@ -850,90 +917,130 @@ const UnderstandingSection = (props) => {
850
917
  }
851
918
  };
852
919
  return (() => {
853
- var _el$148 = getNextElement(_tmpl$42), _el$149 = _el$148.firstChild, _el$151 = _el$149.nextSibling, [_el$152, _co$31] = getNextMarker(_el$151.nextSibling);
854
- insert(_el$149, createComponent(For, {
920
+ var _el$168 = getNextElement(_tmpl$46), _el$169 = _el$168.firstChild, _el$171 = _el$169.nextSibling, [_el$172, _co$36] = getNextMarker(_el$171.nextSibling);
921
+ insert(_el$169, createComponent(For, {
855
922
  get each() {
856
923
  return data().detections;
857
924
  },
858
925
  children: (det) => (() => {
859
- var _el$153 = getNextElement(_tmpl$43), _el$154 = _el$153.firstChild, _el$155 = _el$154.nextSibling;
860
- insert(_el$154, () => det.label);
861
- insert(_el$155, () => det.value);
862
- effect(() => className(_el$154, `px-1.5 py-0.5 text-xs font-medium rounded ${confidenceClass(det.confidence)}`));
863
- return _el$153;
926
+ var _el$173 = getNextElement(_tmpl$47), _el$174 = _el$173.firstChild, _el$175 = _el$174.nextSibling;
927
+ insert(_el$174, () => det.label);
928
+ insert(_el$175, () => det.value);
929
+ effect(() => className(_el$174, `px-1.5 py-0.5 text-xs font-medium rounded ${confidenceClass(det.confidence)}`));
930
+ return _el$173;
864
931
  })()
865
932
  }));
866
- insert(_el$148, createComponent(Show, {
933
+ insert(_el$168, createComponent(Show, {
867
934
  get when() {
868
935
  return data().warnings.length > 0;
869
936
  },
870
937
  get children() {
871
- var _el$150 = getNextElement(_tmpl$20);
872
- insert(_el$150, createComponent(For, {
938
+ var _el$170 = getNextElement(_tmpl$24);
939
+ insert(_el$170, createComponent(For, {
873
940
  get each() {
874
941
  return data().warnings;
875
942
  },
876
943
  children: (w) => (() => {
877
- var _el$156 = getNextElement(_tmpl$44), _el$157 = _el$156.firstChild, _el$158 = _el$157.nextSibling;
878
- insert(_el$158, w);
879
- return _el$156;
944
+ var _el$176 = getNextElement(_tmpl$48), _el$177 = _el$176.firstChild, _el$178 = _el$177.nextSibling;
945
+ insert(_el$178, w);
946
+ return _el$176;
880
947
  })()
881
948
  }));
882
- return _el$150;
949
+ return _el$170;
883
950
  }
884
- }), _el$152, _co$31);
885
- return _el$148;
951
+ }), _el$172, _co$36);
952
+ return _el$168;
886
953
  })();
887
954
  };
888
955
  const FeedbackSection = (props) => {
889
956
  const [comment, setComment] = createSignal("");
957
+ const [showComment, setShowComment] = createSignal(false);
890
958
  const data = () => {
959
+ var _a, _b, _c, _d;
891
960
  const c = props.content;
961
+ const options = (c == null ? void 0 : c.options) || [{
962
+ value: ((_a = c == null ? void 0 : c.approve) == null ? void 0 : _a.value) || "approve",
963
+ label: ((_b = c == null ? void 0 : c.approve) == null ? void 0 : _b.label) || "Yes",
964
+ icon: "👍",
965
+ variant: "primary"
966
+ }, {
967
+ value: ((_c = c == null ? void 0 : c.reject) == null ? void 0 : _c.value) || "reject",
968
+ label: ((_d = c == null ? void 0 : c.reject) == null ? void 0 : _d.label) || "No",
969
+ icon: "👎"
970
+ }];
892
971
  return {
893
972
  question: (c == null ? void 0 : c.question) || "",
894
- approve: (c == null ? void 0 : c.approve) || {
895
- label: "Yes",
896
- value: "approve"
897
- },
898
- reject: (c == null ? void 0 : c.reject) || {
899
- label: "No",
900
- value: "reject"
901
- },
902
- allowComment: (c == null ? void 0 : c.allowComment) ?? false,
903
- commentPlaceholder: (c == null ? void 0 : c.commentPlaceholder) || "Add a comment..."
973
+ options,
974
+ allowFreeText: (c == null ? void 0 : c.allowFreeText) ?? (c == null ? void 0 : c.allowComment) ?? false,
975
+ placeholder: (c == null ? void 0 : c.placeholder) || (c == null ? void 0 : c.commentPlaceholder) || "Add a comment..."
904
976
  };
905
977
  };
906
- const handleFeedback = (approved) => {
978
+ const handleOption = (option) => {
907
979
  var _a;
908
- const d = data();
980
+ if (option.needsComment) {
981
+ setShowComment(true);
982
+ return;
983
+ }
909
984
  (_a = props.onAction) == null ? void 0 : _a.call(props, "feedback", {
910
- approved,
911
- value: approved ? d.approve.value : d.reject.value,
985
+ option: option.value,
912
986
  comment: comment()
913
987
  });
914
988
  };
915
989
  return (() => {
916
- var _el$159 = getNextElement(_tmpl$46), _el$160 = _el$159.firstChild, _el$161 = _el$160.nextSibling, _el$162 = _el$161.firstChild, _el$163 = _el$162.firstChild, _el$164 = _el$163.nextSibling, [_el$165, _co$32] = getNextMarker(_el$164.nextSibling), _el$166 = _el$162.nextSibling, _el$167 = _el$166.firstChild, _el$168 = _el$167.nextSibling, [_el$169, _co$33] = getNextMarker(_el$168.nextSibling), _el$171 = _el$161.nextSibling, [_el$172, _co$34] = getNextMarker(_el$171.nextSibling);
917
- insert(_el$160, () => data().question);
918
- _el$162.$$click = () => handleFeedback(true);
919
- insert(_el$162, () => data().approve.label, _el$165, _co$32);
920
- _el$166.$$click = () => handleFeedback(false);
921
- insert(_el$166, () => data().reject.label, _el$169, _co$33);
922
- insert(_el$159, createComponent(Show, {
990
+ var _el$179 = getNextElement(_tmpl$50), _el$180 = _el$179.firstChild, _el$181 = _el$180.nextSibling, _el$185 = _el$181.nextSibling, [_el$186, _co$37] = getNextMarker(_el$185.nextSibling);
991
+ insert(_el$180, () => data().question);
992
+ insert(_el$181, createComponent(For, {
993
+ get each() {
994
+ return data().options;
995
+ },
996
+ children: (option) => (() => {
997
+ var _el$187 = getNextElement(_tmpl$37), _el$189 = _el$187.firstChild, [_el$190, _co$38] = getNextMarker(_el$189.nextSibling), _el$191 = _el$190.nextSibling, [_el$192, _co$39] = getNextMarker(_el$191.nextSibling);
998
+ _el$187.$$click = () => handleOption(option);
999
+ insert(_el$187, createComponent(Show, {
1000
+ get when() {
1001
+ return option.icon;
1002
+ },
1003
+ get children() {
1004
+ var _el$188 = getNextElement(_tmpl$51);
1005
+ insert(_el$188, () => option.icon);
1006
+ return _el$188;
1007
+ }
1008
+ }), _el$190, _co$38);
1009
+ insert(_el$187, () => option.label, _el$192, _co$39);
1010
+ effect(() => className(_el$187, `px-3 py-1.5 text-sm font-medium rounded-lg transition-colors flex items-center gap-1 ${option.variant === "primary" ? "bg-blue-600 text-white hover:bg-blue-700" : option.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"}`));
1011
+ runHydrationEvents();
1012
+ return _el$187;
1013
+ })()
1014
+ }));
1015
+ insert(_el$179, createComponent(Show, {
923
1016
  get when() {
924
- return data().allowComment;
1017
+ return data().allowFreeText || showComment();
925
1018
  },
926
1019
  get children() {
927
- var _el$170 = getNextElement(_tmpl$45);
928
- _el$170.$$input = (e) => setComment(e.currentTarget.value);
929
- effect(() => setAttribute(_el$170, "placeholder", data().commentPlaceholder));
930
- effect(() => setProperty(_el$170, "value", comment()));
1020
+ var _el$182 = getNextElement(_tmpl$49), _el$183 = _el$182.firstChild, _el$184 = _el$183.nextSibling;
1021
+ _el$183.$$input = (e) => setComment(e.currentTarget.value);
1022
+ _el$184.$$click = () => {
1023
+ var _a;
1024
+ return (_a = props.onAction) == null ? void 0 : _a.call(props, "feedback", {
1025
+ option: "comment",
1026
+ comment: comment()
1027
+ });
1028
+ };
1029
+ effect((_p$) => {
1030
+ var _v$6 = data().placeholder, _v$7 = showComment();
1031
+ _v$6 !== _p$.e && setAttribute(_el$183, "placeholder", _p$.e = _v$6);
1032
+ _v$7 !== _p$.t && setProperty(_el$183, "autofocus", _p$.t = _v$7);
1033
+ return _p$;
1034
+ }, {
1035
+ e: void 0,
1036
+ t: void 0
1037
+ });
1038
+ effect(() => setProperty(_el$183, "value", comment()));
931
1039
  runHydrationEvents();
932
- return _el$170;
1040
+ return _el$182;
933
1041
  }
934
- }), _el$172, _co$34);
935
- runHydrationEvents();
936
- return _el$159;
1042
+ }), _el$186, _co$37);
1043
+ return _el$179;
937
1044
  })();
938
1045
  };
939
1046
  const PromptSection = (props) => {
@@ -948,56 +1055,56 @@ const PromptSection = (props) => {
948
1055
  };
949
1056
  };
950
1057
  return (() => {
951
- var _el$173 = getNextElement(_tmpl$50), _el$186 = _el$173.firstChild, [_el$187, _co$37] = getNextMarker(_el$186.nextSibling), _el$179 = _el$187.nextSibling, _el$188 = _el$179.nextSibling, [_el$189, _co$38] = getNextMarker(_el$188.nextSibling), _el$190 = _el$189.nextSibling, [_el$191, _co$39] = getNextMarker(_el$190.nextSibling);
952
- insert(_el$173, createComponent(Show, {
1058
+ var _el$193 = getNextElement(_tmpl$55), _el$206 = _el$193.firstChild, [_el$207, _co$42] = getNextMarker(_el$206.nextSibling), _el$199 = _el$207.nextSibling, _el$208 = _el$199.nextSibling, [_el$209, _co$43] = getNextMarker(_el$208.nextSibling), _el$210 = _el$209.nextSibling, [_el$211, _co$44] = getNextMarker(_el$210.nextSibling);
1059
+ insert(_el$193, createComponent(Show, {
953
1060
  get when() {
954
1061
  return data().originalQuery;
955
1062
  },
956
1063
  get children() {
957
- var _el$174 = getNextElement(_tmpl$47), _el$175 = _el$174.firstChild, _el$177 = _el$175.nextSibling, [_el$178, _co$35] = getNextMarker(_el$177.nextSibling);
958
- _el$178.nextSibling;
959
- insert(_el$174, () => data().originalQuery, _el$178, _co$35);
960
- return _el$174;
1064
+ var _el$194 = getNextElement(_tmpl$52), _el$195 = _el$194.firstChild, _el$197 = _el$195.nextSibling, [_el$198, _co$40] = getNextMarker(_el$197.nextSibling);
1065
+ _el$198.nextSibling;
1066
+ insert(_el$194, () => data().originalQuery, _el$198, _co$40);
1067
+ return _el$194;
961
1068
  }
962
- }), _el$187, _co$37);
963
- insert(_el$179, createComponent(For, {
1069
+ }), _el$207, _co$42);
1070
+ insert(_el$199, createComponent(For, {
964
1071
  get each() {
965
1072
  return Object.entries(data().extracted);
966
1073
  },
967
1074
  children: ([key, value]) => (() => {
968
- var _el$192 = getNextElement(_tmpl$51), _el$193 = _el$192.firstChild, _el$195 = _el$193.firstChild, [_el$196, _co$40] = getNextMarker(_el$195.nextSibling);
969
- _el$196.nextSibling;
970
- var _el$197 = _el$193.nextSibling;
971
- insert(_el$193, key, _el$196, _co$40);
972
- insert(_el$197, () => String(value));
973
- return _el$192;
1075
+ var _el$212 = getNextElement(_tmpl$56), _el$213 = _el$212.firstChild, _el$215 = _el$213.firstChild, [_el$216, _co$45] = getNextMarker(_el$215.nextSibling);
1076
+ _el$216.nextSibling;
1077
+ var _el$217 = _el$213.nextSibling;
1078
+ insert(_el$213, key, _el$216, _co$45);
1079
+ insert(_el$217, () => String(value));
1080
+ return _el$212;
974
1081
  })()
975
1082
  }));
976
- insert(_el$173, createComponent(Show, {
1083
+ insert(_el$193, createComponent(Show, {
977
1084
  get when() {
978
1085
  return data().plan;
979
1086
  },
980
1087
  get children() {
981
- var _el$180 = getNextElement(_tmpl$48), _el$181 = _el$180.firstChild, _el$182 = _el$181.nextSibling, _el$183 = _el$182.nextSibling, [_el$184, _co$36] = getNextMarker(_el$183.nextSibling);
982
- insert(_el$180, () => data().plan, _el$184, _co$36);
983
- return _el$180;
1088
+ var _el$200 = getNextElement(_tmpl$53), _el$201 = _el$200.firstChild, _el$202 = _el$201.nextSibling, _el$203 = _el$202.nextSibling, [_el$204, _co$41] = getNextMarker(_el$203.nextSibling);
1089
+ insert(_el$200, () => data().plan, _el$204, _co$41);
1090
+ return _el$200;
984
1091
  }
985
- }), _el$189, _co$38);
986
- insert(_el$173, createComponent(Show, {
1092
+ }), _el$209, _co$43);
1093
+ insert(_el$193, createComponent(Show, {
987
1094
  get when() {
988
1095
  return data().editable;
989
1096
  },
990
1097
  get children() {
991
- var _el$185 = getNextElement(_tmpl$49);
992
- _el$185.$$click = () => {
1098
+ var _el$205 = getNextElement(_tmpl$54);
1099
+ _el$205.$$click = () => {
993
1100
  var _a;
994
1101
  return (_a = props.onAction) == null ? void 0 : _a.call(props, "edit_prompt", data());
995
1102
  };
996
1103
  runHydrationEvents();
997
- return _el$185;
1104
+ return _el$205;
998
1105
  }
999
- }), _el$191, _co$39);
1000
- return _el$173;
1106
+ }), _el$211, _co$44);
1107
+ return _el$193;
1001
1108
  })();
1002
1109
  };
1003
1110
  delegateEvents(["click", "input"]);