UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 17.7 kB
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{AN as n,EN as r,GN as i,IM as a,JN as o,Js as s,LM as c,MM as l,MN as u,RM as ee,Ys as d,by as f,cv as p,eP as m,fN as h,jN as g,pN as _,qN as v,sv as y,tP as b,vy as x}from"./_2_____________________________.js";import{or as te,sr as S,vi as C,yi as w}from"./deferred-ui-support-DZEPWjAk.js";import{C as T,Ct as ne,F as E,O as D,Rt as O,S as k,St as A,U as j,d as M,f as re,g as N,j as P,l as F,m as I,s as L,u as R,w as z,x as B}from"./_6____________________.js";import{f as ie,p as V}from"./_5_________________________.js";import{A as H}from"./route-controls-runtime-LXiVRSj4.js";import{n as U,t as ae}from"./markdown-runtime-CtlJb8xA.js";import{n as oe,r as se,t as ce}from"./file-preview-document-CnOpuMR8.js";var W;function G(){return(G=e((()=>{W=`openclaw-file-preview-modal{display:contents;& .modal{flex-direction:column;width:100%;height:min(780px,86vh);display:flex;overflow:hidden}& .head{border-bottom:1px solid var(--border);background:var(--bg);align-items:center;gap:12px;padding:16px 20px;display:flex}& .heading{overflow-wrap:anywhere;flex:1;min-width:0;margin:0;font-size:16px}& .close-button{width:32px;height:32px;color:var(--muted);border-radius:var(--radius-md);cursor:var(--cursor-action);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}@media (hover:hover){& .close-button:hover{color:var(--text-strong);background:var(--bg-elevated)}}& .close-button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}& .close-button svg{width:18px;height:18px}& .body.tree{grid-template-columns:minmax(180px,260px) minmax(0,1fr)}& .tree .item{grid-template-columns:16px minmax(0,1fr)}& .folder>summary{color:var(--muted);align-items:center;gap:8px;padding:9px 10px;font-size:12px;display:flex}& .folder>summary svg{width:16px;height:16px}& .folder>div{padding-left:12px}& .folder .item{gap:8px;width:100%;padding:9px 10px}& .notice{color:var(--muted);border-bottom:1px solid var(--border);margin:0;padding:12px 20px}& .markdown{overflow-wrap:anywhere;-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto;font-size:14px;line-height:1.65}& .markdown>:first-child{margin-top:0}& .markdown h1{font-size:24px}& .markdown h2{font-size:20px}& .markdown h3{font-size:16px}& .markdown pre{white-space:pre-wrap;overflow-wrap:anywhere;background:var(--bg-elevated);border-radius:var(--radius-md);padding:12px}& .markdown code{font-family:var(--mono)}& .markdown a{color:var(--accent)}& .markdown table{max-width:100%;display:block;overflow:auto}& .markdown th,& .markdown td{border:1px solid var(--border);padding:8px}& .search-icon{color:var(--muted);font-size:18px}& .search{min-width:0;color:var(--text-strong);font:inherit;background:0 0;border:none;outline:none;flex:1;padding:4px 0;font-size:18px;font-weight:400}& .search:focus,& .search:focus-visible{box-shadow:none;border:none;outline:none}& .search::placeholder{color:var(--muted)}& .state{color:var(--muted);border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg-elevated);align-items:center;gap:8px;padding:5px 10px;font-size:12px;display:inline-flex}& .body{flex:1;grid-template-columns:360px minmax(0,1fr);min-height:0;display:grid}& .list{border-right:1px solid var(--border);flex-direction:column;gap:2px;padding:14px 10px;display:flex;overflow-y:auto}& .list-section{text-transform:uppercase;letter-spacing:.08em;color:var(--muted);padding:4px 12px 8px;font-size:11px}& .item{border-radius:var(--radius-md);color:var(--text);font:inherit;text-align:left;background:0 0;border:none;outline:none;grid-template-columns:16px 1fr auto;align-items:center;gap:12px;padding:12px 14px;display:grid}& .item:focus-visible{box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent)}@media (hover:hover){& .item:hover{background:var(--bg-elevated)}}& .item.is-active{background:var(--accent-subtle)}& .item.is-active .item-name{color:var(--text-strong)}& .item-icon{width:16px;height:16px;color:var(--muted);opacity:.85;justify-content:center;align-items:center;display:inline-flex}& .item.is-active .item-icon{color:var(--accent);opacity:1}& .item-icon svg,& .chat-copy-btn svg{stroke:currentColor;fill:none;stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round;width:16px;height:16px}& .item-name{font-family:var(--mono);color:var(--text);text-overflow:ellipsis;white-space:nowrap;font-size:14px;overflow:hidden}& .item-meta{color:var(--muted);font-size:12px}& .empty-list{color:var(--muted);padding:12px;font-size:13px}& .detail{flex-direction:column;min-width:0;min-height:0;display:flex}& .detail.empty{text-align:center;justify-content:center;align-items:center;padding:24px}& .detail-head{border-bottom:1px solid var(--border);padding:20px 24px 14px}& .detail-title-row{align-items:center;gap:12px;margin-bottom:10px;display:flex}& .title{min-width:0;font-family:var(--mono);color:var(--text-strong);letter-spacing:-.01em;text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:22px;font-weight:700;overflow:hidden}& .chat-copy-btn{border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg-elevated);width:32px;height:32px;color:var(--muted);flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}@media (hover:hover){& .chat-copy-btn:not([data-copy-state]):hover{border-color:var(--border-strong);color:var(--text-strong)}}& .chat-copy-btn__icon{width:16px;height:16px}& .chat-copy-btn__icon-copy,& .chat-copy-btn__icon-check{inset:0}& .chips{flex-wrap:wrap;gap:6px;display:flex}& .chip{background:var(--bg-elevated);border:1px solid var(--border);color:var(--muted);border-radius:999px;align-items:center;padding:3px 10px;font-size:11.5px;display:inline-flex}& .chip.accent{background:var(--accent-subtle);border-color:color-mix(in srgb, var(--accent) 30%, transparent);color:var(--accent)}& .chip.ok{background:color-mix(in srgb, var(--ok) 12%, transparent);border-color:color-mix(in srgb, var(--ok) 30%, transparent);color:var(--ok)}& .detail-body{flex:1;padding:20px 24px 24px;overflow:hidden auto}& .code-content{min-width:0}& .code-chunk{min-width:0;font-family:var(--mono);color:var(--text);white-space:pre-wrap;word-break:break-word;content-visibility:auto;contain-intrinsic-block-size:auto 1414px;margin:0;font-size:13px;line-height:1.7}& .foot{border-top:1px solid var(--border);background:var(--bg);color:var(--muted);flex-wrap:wrap;flex-shrink:0;align-items:center;gap:18px;padding:12px 20px;font-size:12px;display:flex}& .foot-group{align-items:center;gap:6px;display:inline-flex}& .kbd{font-family:var(--mono);border:1px solid var(--border);background:var(--bg-elevated);color:var(--text);border-radius:4px;padding:2px 6px;font-size:10.5px}& .foot>openclaw-modal-actions{margin-inline-start:auto}& .foot .button{height:auto;min-height:36px}& .button{border-radius:var(--radius-md);border:1px solid var(--border);background:var(--bg-elevated);height:36px;color:var(--text);padding:0 14px;font-weight:600}@media (hover:hover){& .button:hover{border-color:var(--border-strong);color:var(--text-strong)}}& .empty-title{color:var(--text-strong);margin:0 0 8px;font-size:16px;font-weight:600}& .empty-subtitle{color:var(--muted);max-width:380px;margin:0;font-size:13px}@media (width<=640px){& .head{padding:12px}& .body,& .body.tree{grid-template-rows:minmax(0,min(180px,30dvh)) minmax(0,1fr);grid-template-columns:minmax(0,1fr)}& .list{border-right:0;border-bottom:1px solid var(--border);min-width:0;padding:10px 8px}& .item{min-width:0}& .foot{gap:8px;padding:10px 12px}}}`})))()}var le=t({FilePreviewModal:()=>$});function ue(e,t){let n,i=!1,a=new Map,c=e=>m(t=>(a.set(t,e),()=>a.delete(t))),u=e=>[...a].filter(([,t])=>t===e).map(([e])=>e).toSorted((e,t)=>e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),d=()=>u(`item`).find(e=>e.classList.contains(`is-active`)),f=E(()=>{let t=e.layout===`files`?e.query.trim().toLowerCase():``;return t?e.files.filter(e=>`${e.path}\n${e.contents}`.toLowerCase().includes(t)):e.files}),g=E(()=>f().find(t=>t.path===e.activePath)??f()[0]),_=E(()=>({request:e.inventoryRequest()}),{equals:(e,t)=>e.request===t.request}),v=E(()=>({request:e.fileRequest()}),{equals:(e,t)=>e.request===t.request}),y=()=>e.label||o(`filePreview.label`),b=()=>f().length===e.files.length?o(`filePreview.fileCount`,{count:String(e.files.length)}):o(`filePreview.filteredFileCount`,{count:String(f().length),total:String(e.files.length)}),S=(e,n)=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:n})),w=()=>S(`file-preview-close`),j=()=>{t.isConnected&&n?.isConnected&&i&&(u(`search`)[0]??d()??u(`button`)[0]??u(`close`)[0])?.focus({preventScroll:!0})},L=t=>{S(`file-preview-select`,t),e.layout===`files`&&j()},R=t=>{e.layout===`files`&&t.preventDefault()},B=t=>{if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),w();return}if(t.key!==`ArrowDown`&&t.key!==`ArrowUp`)return;t.preventDefault(),t.stopPropagation();let n=e.layout===`document`?u(`item`).filter(e=>!e.closest(`details:not([open])`)).flatMap(e=>f().filter(t=>t.path===e.dataset.path)):f(),r=n.findIndex(t=>t.path===e.activePath),i=n[Math.max(0,Math.min(n.length-1,Math.max(0,r)+(t.key===`ArrowDown`?1:-1)))];i&&i.path!==(n[r]??n[0])?.path&&L(i.path)},V=t=>{let n=oe(t,g()?.path??`SKILL.md`),r=e.files.find(e=>e.path===n);r&&L(r.path)};x(()=>({reset:{identity:[e.layout,e.query,g()?.path,g()?.contents,g()?.message],target:()=>u(`body`)[0]},reveal:{identity:[e.activePath,e.query,e.files,e.layout],target:d}})),ie(()=>({path:e.activePath,layout:e.layout}),{requested:(e,t)=>!t||e.layout===`document`&&e.path!==t.path,focus:j});let H=t=>(()=>{var n=K(),r=n.firstChild,i=r.nextSibling;n._$$click=()=>L(t.path),n._$$mousedown=R,n._$$pointerdown=R;var a=c(`item`);return(typeof a==`function`||Array.isArray(a))&&I(()=>a,n),M(r,P(h,{get name(){return Te[C(t.path)]}})),M(i,(()=>{var n=re(()=>e.layout===`document`);return()=>n()?t.path.split(`/`).pop():t.path})()),M(n,P(D,{get when(){return e.layout===`files`},get children(){var e=fe();return M(e,()=>t.size),e}}),null),F(()=>({e:t.path===g()?.path,t:t.path,a:t.path===g()?.path?`true`:`false`,o:e.layout===`document`&&t.path===g()?.path,i:t.path}),({e,t,a:r,o:a,i:o},s)=>{e!==s?.e&&n.classList.toggle(`is-active`,e),t!==s?.t&&N(n,`data-path`,t),r!==s?.a&&N(n,`aria-current`,r),a!==s?.o&&N(n,`autofocus`,a),o!==s?.i&&N(i,`title`,o)}),n})(),U=t=>{let n=()=>f().filter(e=>e.path.startsWith(t)),r=()=>n().filter(e=>!e.path.slice(t.length).includes(`/`)),i=()=>[...new Set([...n().map(e=>e.path),...e.directories.map(e=>`${e}/`)].filter(e=>e.startsWith(t)&&e.slice(t.length).includes(`/`)).map(e=>e.slice(t.length).split(`/`)[0]))].toSorted();return[P(T,{get each(){return r()},children:H}),P(T,{get each(){return i()},children:e=>(()=>{var n=q(),r=n.firstChild,i=r.firstChild,a=r.nextSibling;return M(r,P(h,{name:`folder`}),i),M(i,e),M(a,()=>U(`${t}${e}/`)),n})()})]};return[(()=>{var e=J();return M(e,`${W}\nopenclaw-file-preview-modal { ${p} }`),e})(),(()=>{var t=_e(),u=t.firstChild,d=u.firstChild,p=d.nextSibling,m=p.firstChild,x=m.firstChild,C=x.nextSibling,E=p.nextSibling;return t._$$keydown=B,t.addEventListener(`modal-cancel`,w),t.initialFocus=()=>[...a.keys()].filter(e=>e.isConnected&&e.autofocus).toSorted((e,t)=>e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)[0]??null,t.onOpenChange=e=>i=e,I(()=>e=>n=e,t),t._$owner=O(),M(d,P(D,{get when(){return e.layout===`document`},get fallback(){return[ve(),(()=>{var t=ye();t._$$input=e=>S(`file-preview-query-change`,e.currentTarget.value);var n=c(`search`);return(typeof n==`function`||Array.isArray(n))&&I(()=>n,t),F(()=>({e:e.searchPlaceholder||o(`filePreview.searchPlaceholder`),t:e.query}),({e,t:n},r)=>{e!==r?.e&&N(t,`placeholder`,e),t.value=n??``}),t})(),(()=>{var e=be();return M(e,b),e})()]},get children(){return[(()=>{var e=Y();return M(e,y),e})(),(()=>{var e=X();e._$$click=w;var t=c(`close`);return(typeof t==`function`||Array.isArray(t))&&I(()=>t,e),M(e,P(h,{name:`x`})),F(()=>({e:o(`common.close`),t:!g()}),({e:t,t:n},r)=>{t!==r?.e&&N(e,`aria-label`,t),n!==r?.t&&N(e,`autofocus`,n)}),e})()]}})),M(u,P(D,{get when(){return e.notice},get children(){var t=pe();return M(t,()=>e.notice),t}}),p),M(m,P(D,{get when(){return e.layout===`files`},get children(){var t=me(),n=t.firstChild,r=n.nextSibling;return M(t,()=>e.listLabel||o(`filePreview.listLabel`),n),M(t,()=>f().length,r),t}}),x),M(m,P(D,{get when(){return ne(_)},keyed:!0,children:t=>P(k,{fallback:()=>null,get children(){return P(z,{get fallback(){return P(te,{variant:`file-list`,get label(){return o(`common.loading`)},compact:!0})},get children(){return e.readInventory(),f().length===0?(()=>{var e=xe();return M(e,()=>o(`filePreview.noMatches`)),e})():e.layout===`document`?U(``):P(T,{get each(){return f()},children:H})}})}})}),C),M(p,P(D,{get when(){return ne(v)},keyed:!0,children:t=>P(k,{fallback:e=>(()=>{var t=Se(),n=t.firstChild,i=n.nextSibling;M(n,()=>r(e())),i._$$click=()=>S(`file-preview-retry`);var a=c(`button`);return(typeof a==`function`||Array.isArray(a))&&I(()=>a,i),M(i,()=>o(`common.retry`)),t})(),get children(){return P(z,{get fallback(){var e=Z(),t=e.firstChild,n=c(`body`);return(typeof n==`function`||Array.isArray(n))&&I(()=>n,t),M(t,P(te,{variant:`document`,get label(){return o(`common.loading`)},compact:!0})),e},get children(){return e.readFile(),P(D,{get when(){return g()},get fallback(){var t=Ce(),n=t.firstChild,r=n.nextSibling;return M(n,()=>e.emptyTitle||o(`filePreview.emptyTitle`)),M(r,()=>e.emptySubtitle||o(`filePreview.emptySubtitle`)),t},children:t=>(()=>{var n=Z(),r=n.firstChild;M(n,P(D,{get when(){return e.layout===`files`},get children(){var n=Q(),r=n.firstChild,i=r.firstChild,a=r.nextSibling,c=a.firstChild,l=c.nextSibling,u=l.nextSibling;return M(i,()=>t().path),M(r,P(D,{get when(){return t().contents},get children(){return P(s,{get text(){return t().contents},get idleLabel(){return e.copyLabel||o(`filePreview.copyFile`)},bare:!0})}}),null),M(c,()=>de(t().path)),M(l,()=>t().size),M(u,()=>o(`filePreview.readOnly`)),M(a,P(D,{get when(){return e.contextLabel},get children(){var t=we();return M(t,()=>e.contextLabel),t}}),null),n}}),r);var i=c(`body`);return(typeof i==`function`||Array.isArray(i))&&I(()=>i,r),M(r,P(ce,{get path(){return t().path},get content(){return t().contents},get message(){return t().message},get markdown(){return e.layout===`document`},onClick:V})),n})()})}})}})}),null),M(u,P(D,{get when(){return e.layout===`files`},get children(){var e=ge(),t=e.firstChild,n=t.firstChild,r=n.firstChild,i=r.nextSibling;M(e,P(D,{get when(){return ee()},get children(){var e=he(),t=e.firstChild,n=t.nextSibling;return M(e,P(l,{keys:[`↑`,`↓`],class:`kbd`}),t),M(e,()=>o(`filePreview.navigate`),n),e}}),t),t._$owner=O(),n._$$click=w;var a=c(`button`);return(typeof a==`function`||Array.isArray(a))&&I(()=>a,n),M(n,()=>o(`common.close`),r),M(n,P(l,{keys:`esc`,class:`kbd`}),i),e}}),E),F(()=>({e:y(),t:e.layout===`document`,a:A(()=>e.readInventory())||A(()=>e.readFile())?`true`:`false`}),({e,t:n,a:r},i)=>{e!==i?.e&&N(t,`label`,e),n!==i?.t&&p.classList.toggle(`tree`,n),r!==i?.a&&N(p,`aria-busy`,r)}),t})()]}function de(e){let t=e.split(`.`).pop()?.toLowerCase()??``,n={md:`Markdown`,txt:o(`filePreview.kind.text`),json:`JSON`,yaml:`YAML`,yml:`YAML`,ts:`TypeScript`,js:`JavaScript`,py:`Python`,sh:o(`filePreview.kind.shell`)};return Object.hasOwn(n,t)?n[t]:t?t.toUpperCase():o(`filePreview.kind.file`)}var fe,K,q,J,Y,X,pe,me,he,ge,_e,ve,ye,be,xe,Se,Z,Ce,we,Q,$,Te;function Ee(){return(Ee=e((()=>{R(),j(),ae(),n(),b(),i(),c(),V(),f(),u(),w(),se(),d(),_(),a(),S(),G(),H(),y(),fe=B(`<span class=item-meta>`),K=B(`<button class=item><span class=item-icon></span><span class=item-name>`),q=B(`<details class=folder open><summary><span></span></summary><div>`),J=B(`<style>`),Y=B(`<h1 class=heading>`),X=B(`<button class=close-button type=button>`),pe=B(`<p class=notice role=status>`),me=B(`<div class=list-section> · <!>`),he=B(`<span class=foot-group> <!>`),ge=B(`<footer class=foot><openclaw-modal-actions><button class=button> <!>`,1),_e=B(`<openclaw-modal-dialog style="--openclaw-modal-width:min(1100px, 92vw);--openclaw-modal-max-height:86vh"><div class=modal><header class=head></header><div class=body><aside class=list><!><!></aside></div><!>`,1),ve=B(`<span class=search-icon>⌕`),ye=B(`<input class=search autofocus>`),be=B(`<span class=state>`),xe=B(`<div class=empty-list>`),Se=B(`<section class="detail empty"><p role=alert></p><button class=button>`),Z=B(`<section class=detail><div class=detail-body>`),Ce=B(`<section class="detail empty"><p class=empty-title></p><p class=empty-subtitle>`),we=B(`<span class="chip ok">`),Q=B(`<div class=detail-head><div class=detail-title-row><h2 class=title></h2></div><div class=chips><span class="chip accent"></span><span class=chip></span><span class=chip>`),v(U),$=g(`openclaw-file-preview-modal`,ue,{properties:{files:{default:[],attribute:!1},activePath:{default:``},query:{default:``},label:{default:``},listLabel:{default:``},searchPlaceholder:{default:``},contextLabel:{default:``},emptyTitle:{default:``},emptySubtitle:{default:``},copyLabel:{default:``},layout:{default:`files`},directories:{default:[],attribute:!1},readInventory:{default:()=>{},attribute:!1},inventoryRequest:{default:()=>void 0,attribute:!1},readFile:{default:()=>{},attribute:!1},fileRequest:{default:()=>void 0,attribute:!1},notice:{default:``}}}),Te={code:`fileCode`,component:`layoutGrid`,data:`braces`,file:`fileText`,image:`image`,markdown:`book`,package:`box`,shell:`terminal`,skill:`pencilSparkles`},L([`pointerdown`,`mousedown`,`click`,`keydown`,`input`])})))()}export{le as n,Ee as r,$ as t};