openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 8.39 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{BA as t,BD as n,J_ as r,Nv as i,dj as a,jv as o,mj as s,pj as c,q_ as l,zA as u}from"./control-ui-boot-shared-DFTSUQQ0.js";import{C as d,F as f,H as ee,O as p,U as m,d as h,f as g,g as _,gt as te,j as v,l as y,m as b,s as x,u as S,x as C}from"./solid-runtime-C416s-HC.js";import{lt as w,ut as T}from"./control-ui-boot-new-BsNYv3zK.js";import{n as E,t as D}from"./en-chat-session-optional-iBUVV79A.js";function O(e){return e.replace(/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,``)}function k(e){let t=()=>e.view.taskSuggestions??[],n=f(()=>t().some(t=>t.id===e.view.activeTaskSuggestionId)?e.view.activeTaskSuggestionId:t()[0]?.id);return v(p,{get when(){return t().length>0},get children(){var r=j();return h(r,v(d,{get each(){return t()},keyed:e=>e.id,children:(r,i)=>v(p,{keyed:!0,get when(){return`${r().id}:${r().id===n()?e.view.taskSuggestionSwapGeneration??0:`inactive`}`},children:a=>v(A,{get suggestion(){return r()},get index(){return i()},get count(){return t().length},get active(){return r().id===n()},get view(){return e.view}})})})),y(()=>t().length>1,e=>{r.classList.toggle(`task-suggestions--stack`,e)}),r}})}function A(e){let t=()=>e.view.canAcceptTaskSuggestions===!0,r=()=>e.view.taskSuggestionAcceptance?.(e.suggestion.id),i=()=>r()?.phase===`starting`,a=()=>{let e=r();return e?.phase===`failed`?e:void 0},c=()=>a()?.repository,m=()=>O(e.suggestion.title),x=()=>O(e.suggestion.cwd),S=()=>s(e.view.taskSuggestionCopiedIds?.has(e.suggestion.id)?`chat.taskSuggestions.promptCopied`:`chat.taskSuggestions.copyPrompt`),C=f(()=>c()?.cwd??``),w=f(()=>!!r()),E=l((e,t)=>e.toggleAttribute(`data-overflow-right`,!t.atEnd),{presented:()=>e.active,horizontal:!0,content:x}),D=n=>{!i()&&t()&&e.view.onAcceptTaskSuggestion?.(e.suggestion,n,void 0)};function k(){let e=ee();return v(o,{id:`task-start-${e}`,placement:`bottom-end`,get label(){return s(`chat.taskSuggestions.startOptions`)},get disabled(){return i()||!t()},triggerClass:`btn task-suggestion__start task-suggestion__start--options`,get triggerAttributes(){return{title:t()?``:s(`chat.taskSuggestions.adminRequired`)}},get trigger(){return v(u,{name:`chevronDown`})},get items(){return[{id:`local`,label:s(`chat.taskSuggestions.startSession`),disabled:i()||!t()},{id:`worktree`,label:s(`chat.taskSuggestions.startWorktree`),disabled:i()||!t()},{id:`session`,label:s(`chat.taskSuggestions.startCurrentSession`),disabled:i()||!t()}]},onSelect:e=>{(e.id===`local`||e.id===`worktree`||e.id===`session`)&&D(e.id)}})}var A=I(),j=A.firstChild,V=j.firstChild,H=V.firstChild,ne=H.nextSibling,U=V.nextSibling,W=U.firstChild,G=W.nextSibling,re=G.nextSibling,K=j.nextSibling,q=K.firstChild,J=q.nextSibling,Y=J.nextSibling,X=Y.firstChild,Z=X.firstChild,Q=Z.nextSibling,ie=Q.nextSibling,$=X.nextSibling.firstChild,ae=$.nextSibling,oe=Y.nextSibling,se=oe.nextSibling,ce=K.nextSibling;return h(V,()=>s(`chat.taskSuggestions.eyebrow`,{repo:O(n(x()))}),H),h(V,v(p,{get when(){return e.count>1},get children(){var t=M(),n=t.firstChild,r=n.nextSibling;return h(t,()=>e.index+1,n),h(t,()=>e.count,r),t}}),ne),W._$$click=()=>e.view.onCopyTaskSuggestionPrompt?.(e.suggestion),h(W,v(u,{get name(){return e.view.taskSuggestionCopiedIds?.has(e.suggestion.id)?`check`:`copy`}})),h(U,v(p,{get when(){return e.count>1},get children(){return v(d,{each:[`previous`,`next`],children:t=>{let n;te(()=>{e.active&&n&&e.view.onTaskSuggestionNavigationMount?.(e.suggestion.id,t,n)});var r=L();return r._$$click=()=>e.view.onNavigateTaskSuggestion?.(e.suggestion.id,t),_(r,`data-task-prev`,t===`previous`?``:void 0),_(r,`data-task-next`,t===`next`?``:void 0),b(()=>e=>{n=e},r),h(r,v(u,{name:t===`previous`?`chevronLeft`:`chevronRight`})),y(()=>s(t===`previous`?`chat.taskSuggestions.previous`:`chat.taskSuggestions.next`),e=>{_(r,`aria-label`,e)}),r}})}}),G),h(U,v(p,{get when(){return e.view.canDismissTaskSuggestions===!0},get children(){var t=N();return t._$$click=()=>e.view.onDismissTaskSuggestion?.(e.suggestion),h(t,v(u,{name:`x`})),y(()=>({e:i(),t:s(`chat.taskSuggestions.dismiss`,{title:m()})}),({e,t:n},r)=>{e!==r?.e&&_(t,`disabled`,e),n!==r?.t&&_(t,`aria-label`,n)}),t}}),re),h(q,m),h(J,()=>O(e.suggestion.tldr)),h(Z,v(u,{name:`chevronRight`})),h(Q,()=>s(`chat.taskSuggestions.showInstructions`)),h(ie,()=>s(`chat.taskSuggestions.hideInstructions`)),b(()=>E,$),h($,x),h(ae,()=>O(e.suggestion.prompt)),h(K,v(p,{get when(){return a()},children:e=>(()=>{var t=R(),n=t.firstChild,r=n.firstChild,i=r.nextSibling;return h(n,(()=>{var e=g(()=>!!c());return()=>e()?void 0:s(`chat.taskSuggestions.startUnconfirmed`)})(),r),h(n,()=>e().error,i),t})()}),oe),h(K,v(p,{get when(){return c()?.open},get children(){var n=P(),r=n.firstChild,i=r.nextSibling,a=i.firstChild,o=a.nextSibling,l=i.nextSibling;return h(r,()=>s(`chat.taskSuggestions.chooseRepositoryHelp`)),h(a,()=>s(`chat.taskSuggestions.repositoryFolder`)),o._$$input=t=>e.view.onChangeTaskRepository?.(e.suggestion,{cwd:t.currentTarget.value}),h(n,v(d,{get each(){return c()?.projects??[]},children:n=>(()=>{var r=z(),i=r.firstChild;return r._$$click=()=>e.view.onChangeTaskRepository?.(e.suggestion,{cwd:n.repoRoot??``}),h(r,()=>n.displayName,i),h(i,()=>n.repoRoot),y(()=>({e:!t(),t:n.repoRoot??``}),({e,t},n)=>{e!==n?.e&&_(r,`disabled`,e),t!==n?.t&&_(r,`title`,t)}),r})()}),l),l._$$click=()=>e.view.onChangeTaskRepository?.(e.suggestion,{open:!1}),h(l,()=>s(`common.cancel`)),y(()=>({e:C(),t:!t()}),({e,t},n)=>{o.value=e??``,t!==n?.t&&_(o,`disabled`,t)}),n}}),se),h(ce,v(p,{get when(){return a()},get fallback(){return[(()=>{var e=B(),n=e.firstChild,r=n.nextSibling;return e._$$click=()=>D(`local`),h(e,v(u,{name:`play`}),n),h(e,()=>s(i()?`chat.taskSuggestions.starting`:`chat.taskSuggestions.startSession`),r),y(()=>({e:i()||!t(),t:t()?``:s(`chat.taskSuggestions.adminRequired`)}),({e:t,t:n},r)=>{t!==r?.e&&_(e,`disabled`,t),n!==r?.t&&_(e,`title`,n)}),e})(),v(k,{})]},get children(){var n=F();return n._$$click=()=>{let n=c();n?n.open?t()&&T(n.cwd.trim())&&e.view.onAcceptTaskSuggestion?.(e.suggestion,`worktree`,n.cwd.trim()):e.view.onChangeTaskRepository?.(e.suggestion,{open:!0}):D(`local`)},h(n,(()=>{var e=g(()=>!!c());return()=>e()?s(c()?.open?`chat.taskSuggestions.startWorktree`:`chat.taskSuggestions.chooseRepository`):s(`common.retry`)})()),y(()=>!t()||!(!c()?.open||T(C().trim())),e=>{_(n,`disabled`,e)}),n}})),y(()=>({e:e.suggestion.id,t:e.active?e.view.taskSuggestionSwapDirection:void 0,a:!e.active,o:x(),i:S(),n:S(),s:w()}),({e,t,a:n,o:r,i,n:a,s:o},s)=>{e!==s?.e&&_(A,`data-task-id`,e),t!==s?.t&&_(A,`data-swap-direction`,t),n!==s?.a&&_(A,`hidden`,n),r!==s?.o&&_(V,`title`,r),i!==s?.i&&_(W,`aria-label`,i),a!==s?.n&&_(W,`title`,a),o!==s?.s&&_(Y,`open`,o)}),A}var j,M,N,P,F,I,L,R,z,B;function V(){return(V=e((()=>{S(),m(),t(),i(),D(),a(),r(),w(),j=C(`<div class=task-suggestions aria-live=polite>`),M=C(`<span class=task-suggestion__position> / <!>`),N=C(`<button class="task-suggestion__header-action task-suggestion__dismiss"type=button>`),P=C(`<div class=task-suggestion__repository><p></p><label><span></span><input type=text class=task-suggestion__repository-path></label><button type=button class=btn>`),F=C(`<button class="btn task-suggestion__start task-suggestion__retry"type=button>`),I=C(`<article class=task-suggestion><header class=task-suggestion__header><div class=task-suggestion__eyebrow><!><!></div><div class=task-suggestion__header-actions><button class="task-suggestion__header-action task-suggestion__copy"type=button></button><!><!></div></header><div class=task-suggestion__body><div class=task-suggestion__title></div><div class=task-suggestion__summary></div><details class=task-suggestion__instructions><summary><span class=task-suggestion__instructions-chevron aria-hidden=true></span><span class=task-suggestion__show></span><span class=task-suggestion__hide></span></summary><div class=task-suggestion__instruction-body><code></code><pre></pre></div></details><!><!></div><div class=task-suggestion__actions>`),L=C(`<button class=task-suggestion__header-action type=button>`),R=C(`<div class="callout danger"role=alert><span> <!>`),z=C(`<button type=button class="btn task-suggestion__repository-choice"><small>`),B=C(`<button class="btn task-suggestion__start task-suggestion__start--primary"type=button><!><!>`),c(E),x([`click`,`input`])})))()}V();export{k as ChatTaskSuggestionTray};