@qingchencloud/openclaw-zh 2026.1.29-zh.202601301427 → 2026.1.30-zh.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +353 -16
- package/dist/agents/auth-health.js +5 -1
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/cli/program/help.js +1 -1
- package/dist/cli/skills-cli.js +5 -5
- package/dist/cli/update-cli.js +13 -13
- package/dist/commands/channels/list.js +2 -2
- package/dist/commands/status.command.js +10 -10
- package/dist/commands/uninstall.js +6 -6
- package/dist/config/schema.js +379 -379
- package/dist/control-ui/assets/{index-DFDgq9AK.js → index-CNKLKKXX.js} +582 -561
- package/dist/control-ui/assets/index-CNKLKKXX.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/tui/commands.js +22 -22
- package/dist/tui/tui-waiting.js +10 -10
- package/dist/wizard/onboarding.finalize.js +5 -5
- package/dist/wizard/onboarding.js +3 -3
- package/extensions/line/src/channel.ts +21 -13
- package/package.json +2 -2
- package/dist/control-ui/assets/index-DFDgq9AK.js.map +0 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const
|
|
2
|
-
\f\r]`,ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Vi=/'/g,Yi=/"/g,io=/^(?:script|style|textarea|title)$/i,il=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),c=il(1),ke=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Qi=new WeakMap,Pe=Oe.createTreeWalker(Oe,129);function ao(e,t){if(!Ns(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return qi!==void 0?qi.createHTML(t):t}const al=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=ot;for(let r=0;r<n;r++){const l=e[r];let p,d,u=-1,g=0;for(;g<l.length&&(o.lastIndex=g,d=o.exec(l),d!==null);)g=o.lastIndex,o===ot?d[1]==="!--"?o=Gi:d[1]!==void 0?o=Wi:d[2]!==void 0?(io.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=Me):d[3]!==void 0&&(o=Me):o===Me?d[0]===">"?(o=i??ot,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,p=d[1],o=d[3]===void 0?Me:d[3]==='"'?Yi:Vi):o===Yi||o===Vi?o=Me:o===Gi||o===Wi?o=ot:(o=Me,i=void 0);const v=o===Me&&e[r+1].startsWith("/>")?" ":"";a+=o===ot?l+nl:u>=0?(s.push(p),l.slice(0,u)+no+l.slice(u)+xe+v):l+xe+(u===-2?r:v)}return[ao(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let as=class oo{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const r=t.length-1,l=this.parts,[p,d]=al(t,n);if(this.el=oo.createElement(p,s),Pe.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Pe.nextNode())!==null&&l.length<r;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(no)){const g=d[o++],v=i.getAttribute(u).split(xe),y=/([.?@])?(.*)/.exec(g);l.push({type:1,index:a,name:y[2],strings:v,ctor:y[1]==="."?rl:y[1]==="?"?ll:y[1]==="@"?cl:rn}),i.removeAttribute(u)}else u.startsWith(xe)&&(l.push({type:6,index:a}),i.removeAttribute(u));if(io.test(i.tagName)){const u=i.textContent.split(xe),g=u.length-1;if(g>0){i.textContent=Qt?Qt.emptyScript:"";for(let v=0;v<g;v++)i.append(u[v],$t()),Pe.nextNode(),l.push({type:2,index:++a});i.append(u[g],$t())}}}else if(i.nodeType===8)if(i.data===so)l.push({type:2,index:a});else{let u=-1;for(;(u=i.data.indexOf(xe,u+1))!==-1;)l.push({type:7,index:a}),u+=xe.length-1}a++}}static createElement(t,n){const s=Oe.createElement("template");return s.innerHTML=t,s}};function Xe(e,t,n=e,s){if(t===ke)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=xt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=Xe(e,i._$AS(e,t.values),i,s)),t}class ol{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??Oe).importNode(n,!0);Pe.currentNode=i;let a=Pe.nextNode(),o=0,r=0,l=s[0];for(;l!==void 0;){if(o===l.index){let p;l.type===2?p=new on(a,a.nextSibling,this,t):l.type===1?p=new l.ctor(a,l.name,l.strings,this,t):l.type===6&&(p=new dl(a,this,t)),this._$AV.push(p),l=s[++r]}o!==l?.index&&(a=Pe.nextNode(),o++)}return Pe.currentNode=Oe,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let on=class ro{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Xe(this,t,n),xt(t)?t===f||t==null||t===""?(this._$AH!==f&&this._$AR(),this._$AH=f):t!==this._$AH&&t!==ke&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):sl(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==f&&xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Oe.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=as.createElement(ao(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new ol(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Qi.get(t.strings);return n===void 0&&Qi.set(t.strings,n=new as(t)),n}k(t){Ns(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new ro(this.O($t()),this.O($t()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=ji(t).nextSibling;ji(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class rn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=f,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=f}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=Xe(this,t,n,0),o=!xt(t)||t!==this._$AH&&t!==ke,o&&(this._$AH=t);else{const r=t;let l,p;for(t=a[0],l=0;l<a.length-1;l++)p=Xe(this,r[s+l],n,l),p===ke&&(p=this._$AH[l]),o||=!xt(p)||p!==this._$AH[l],p===f?t=f:t!==f&&(t+=(p??"")+a[l+1]),this._$AH[l]=p}o&&!i&&this.j(t)}j(t){t===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let rl=class extends rn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===f?void 0:t}},ll=class extends rn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==f)}},cl=class extends rn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=Xe(this,t,n,0)??f)===ke)return;const s=this._$AH,i=t===f&&s!==f||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==f&&(s===f||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},dl=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Xe(this,t)}};const ul={I:on},pl=Ps.litHtmlPolyfillSupport;pl?.(as,on),(Ps.litHtmlVersions??=[]).push("3.3.2");const hl=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new on(t.insertBefore($t(),a),a,void 0,n??{})}return i._$AI(e),i};const Os=globalThis;let Je=class extends Qe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=hl(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ke}};Je._$litElement$=!0,Je.finalized=!0,Os.litElementHydrateSupport?.({LitElement:Je});const fl=Os.litElementPolyfillSupport;fl?.({LitElement:Je});(Os.litElementVersions??=[]).push("4.2.2");const lo=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const gl={attribute:!0,type:String,converter:Yt,reflect:!1,hasChanged:Rs},vl=(e=gl,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(r){const l=t.get.call(this);t.set.call(this,r),this.requestUpdate(o,l,e,!0,r)},init(r){return r!==void 0&&this.C(o,void 0,e,r),r}}}if(s==="setter"){const{name:o}=n;return function(r){const l=this[o];t.call(this,r),this.requestUpdate(o,l,e,!0,r)}}throw Error("Unsupported decorator location: "+s)};function ln(e){return(t,n)=>typeof n=="object"?vl(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function w(e){return ln({...e,state:!0,attribute:!1})}const ml=50,yl=200,bl="Assistant";function Zi(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function os(e){const t=Zi(e?.name,ml)??bl,n=Zi(e?.avatar??void 0,yl)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function wl(){return os(typeof window>"u"?{}:{name:window.__OPENCLAW_ASSISTANT_NAME__,avatar:window.__OPENCLAW_ASSISTANT_AVATAR__})}const co="openclaw.control.settings.v1";function $l(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(co);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function xl(e){localStorage.setItem(co,JSON.stringify(e))}function uo(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const Al=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","cron"]},{label:"Agent",tabs:["skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],po={overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},ho=new Map(Object.entries(po).map(([e,t])=>[t,e]));function cn(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function At(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function Ds(e,t=""){const n=cn(t),s=po[e];return n?`${n}${s}`:s}function fo(e,t=""){const n=cn(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=At(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":ho.get(i)??null}function kl(e){let t=At(e);if(t.endsWith("/index.html")&&(t=At(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(ho.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function Sl(e){switch(e){case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function rs(e){switch(e){case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"cron":return"Cron Jobs";case"skills":return"Skills";case"nodes":return"Nodes";case"chat":return"Chat";case"config":return"Config";case"debug":return"Debug";case"logs":return"Logs";default:return"Control"}}function _l(e){switch(e){case"overview":return"Gateway status, entry points, and a fast health read.";case"channels":return"Manage channels and settings.";case"instances":return"Presence beacons from connected clients and nodes.";case"sessions":return"Inspect active sessions and adjust per-session defaults.";case"cron":return"Schedule wakeups and recurring agent runs.";case"skills":return"Manage skill availability and API key injection.";case"nodes":return"Paired devices, capabilities, and command exposure.";case"chat":return"Direct gateway chat session for quick interventions.";case"config":return"Edit ~/.openclaw/openclaw.json safely.";case"debug":return"Gateway snapshots, events, and manual RPC calls.";case"logs":return"Live tail of the gateway file logs.";default:return""}}const W={messageSquare:c`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:c`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:c`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:c`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:c`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:c`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:c`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:c`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:c`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:c`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,menu:c`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:c`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:c`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:c`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:c`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:c`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:c`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:c`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,wrench:c`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:c`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:c`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:c`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:c`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,image:c`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:c`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,plug:c`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:c`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`},Cl=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Bt=/<\s*\/?\s*final\b[^<>]*>/gi,Ji=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Xi(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(l=>a>=l.start&&o<=l.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function ea(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Tl(e,t){return e.trimStart()}function El(e,t){if(!e||!Cl.test(e))return e;let n=e;if(Bt.test(n)){Bt.lastIndex=0;const r=[],l=Xi(n);for(const p of n.matchAll(Bt)){const d=p.index??0;r.push({start:d,length:p[0].length,inCode:ea(d,l)})}for(let p=r.length-1;p>=0;p--){const d=r[p];d.inCode||(n=n.slice(0,d.start)+n.slice(d.start+d.length))}}else Bt.lastIndex=0;const s=Xi(n);Ji.lastIndex=0;let i="",a=0,o=!1;for(const r of n.matchAll(Ji)){const l=r.index??0,p=r[1]==="/";ea(l,s)||(o?p&&(o=!1):(i+=n.slice(a,l),p||(o=!0)),a=l+r[0].length)}return i+=n.slice(a),Tl(i)}function kt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function O(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0)return"just now";const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const s=Math.round(n/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);return i<48?`${i}h ago`:`${Math.round(i/24)}d ago`}function go(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const s=Math.round(n/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function ls(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function cs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function vo(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Zt(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Un(e){return El(e)}const Ml=/^\[([^\]]+)\]\s*/,Ll=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Kn=new WeakMap,Hn=new WeakMap;function Il(e){return/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}Z\b/.test(e)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}\b/.test(e)?!0:Ll.some(t=>e.startsWith(`${t} `))}function zn(e){const t=e.match(Ml);if(!t)return e;const n=t[1]??"";return Il(n)?e.slice(t[0].length):e}function ds(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?Un(s):zn(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const Vt=globalThis,Is=Vt.ShadowRoot&&(Vt.ShadyCSS===void 0||Vt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ls=Symbol(),Ui=new WeakMap;let to=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==Ls)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(Is&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Ui.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Ui.set(n,t))}return t}toString(){return this.cssText}};const Wr=e=>new to(typeof e=="string"?e:e+"",void 0,Ls),Vr=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((s,i,a)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[a+1],e[0]);return new to(n,e,Ls)},qr=(e,t)=>{if(Is)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=Vt.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},Ki=Is?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Wr(n)})(e):e;const{is:Gr,defineProperty:Yr,getOwnPropertyDescriptor:Qr,getOwnPropertyNames:Zr,getOwnPropertySymbols:Xr,getPrototypeOf:Jr}=Object,an=globalThis,Hi=an.trustedTypes,el=Hi?Hi.emptyScript:"",tl=an.reactiveElementPolyfillSupport,mt=(e,t)=>e,Yt={toAttribute(e,t){switch(t){case Boolean:e=e?el:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Rs=(e,t)=>!Gr(e,t),zi={attribute:!0,type:String,converter:Yt,reflect:!1,useDefault:!1,hasChanged:Rs};Symbol.metadata??=Symbol("metadata"),an.litPropertyMetadata??=new WeakMap;let Qe=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=zi){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,n);i!==void 0&&Yr(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=Qr(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const r=i?.call(this);a?.call(this,o),this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??zi}static _$Ei(){if(this.hasOwnProperty(mt("elementProperties")))return;const t=Jr(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(mt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(mt("properties"))){const n=this.properties,s=[...Zr(n),...Xr(n)];for(const i of s)this.createProperty(i,n[i])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[s,i]of n)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[n,s]of this.elementProperties){const i=this._$Eu(n,s);i!==void 0&&this._$Eh.set(i,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)n.unshift(Ki(i))}else t!==void 0&&n.push(Ki(t));return n}static _$Eu(t,n){const s=n.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const s of n.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return qr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,s){this._$AK(t,s)}_$ET(t,n){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const a=(s.converter?.toAttribute!==void 0?s.converter:Yt).toAttribute(n,s.type);this._$Em=t,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(t,n){const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const a=s.getPropertyOptions(i),o=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Yt;this._$Em=i;const r=o.fromAttribute(n,a.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(t,n,s,i=!1,a){if(t!==void 0){const o=this.constructor;if(i===!1&&(a=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??Rs)(a,n)||s.useDefault&&s.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:s,reflect:i,wrapped:a},o){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??n??this[t]),a!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(n=void 0),this._$AL.set(t,n)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,a]of s){const{wrapped:o}=a,r=this[i];o!==!0||this._$AL.has(i)||r===void 0||this.C(i,void 0,a,r)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(t){}firstUpdated(t){}};Qe.elementStyles=[],Qe.shadowRootOptions={mode:"open"},Qe[mt("elementProperties")]=new Map,Qe[mt("finalized")]=new Map,tl?.({ReactiveElement:Qe}),(an.reactiveElementVersions??=[]).push("2.1.2");const Ps=globalThis,ji=e=>e,Qt=Ps.trustedTypes,Wi=Qt?Qt.createPolicy("lit-html",{createHTML:e=>e}):void 0,no="$lit$",xe=`lit$${Math.random().toFixed(9).slice(2)}$`,so="?"+xe,nl=`<${so}>`,Oe=document,$t=()=>Oe.createComment(""),xt=e=>e===null||typeof e!="object"&&typeof e!="function",Ns=Array.isArray,sl=e=>Ns(e)||typeof e?.[Symbol.iterator]=="function",Fn=`[
|
|
2
|
+
\f\r]`,ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Vi=/-->/g,qi=/>/g,Me=RegExp(`>|${Fn}(?:([^\\s"'>=/]+)(${Fn}*=${Fn}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Gi=/'/g,Yi=/"/g,io=/^(?:script|style|textarea|title)$/i,il=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),c=il(1),ke=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Qi=new WeakMap,Pe=Oe.createTreeWalker(Oe,129);function ao(e,t){if(!Ns(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wi!==void 0?Wi.createHTML(t):t}const al=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=ot;for(let r=0;r<n;r++){const l=e[r];let p,d,u=-1,g=0;for(;g<l.length&&(o.lastIndex=g,d=o.exec(l),d!==null);)g=o.lastIndex,o===ot?d[1]==="!--"?o=Vi:d[1]!==void 0?o=qi:d[2]!==void 0?(io.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=Me):d[3]!==void 0&&(o=Me):o===Me?d[0]===">"?(o=i??ot,u=-1):d[1]===void 0?u=-2:(u=o.lastIndex-d[2].length,p=d[1],o=d[3]===void 0?Me:d[3]==='"'?Yi:Gi):o===Yi||o===Gi?o=Me:o===Vi||o===qi?o=ot:(o=Me,i=void 0);const v=o===Me&&e[r+1].startsWith("/>")?" ":"";a+=o===ot?l+nl:u>=0?(s.push(p),l.slice(0,u)+no+l.slice(u)+xe+v):l+xe+(u===-2?r:v)}return[ao(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let as=class oo{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const r=t.length-1,l=this.parts,[p,d]=al(t,n);if(this.el=oo.createElement(p,s),Pe.currentNode=this.el.content,n===2||n===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Pe.nextNode())!==null&&l.length<r;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(no)){const g=d[o++],v=i.getAttribute(u).split(xe),y=/([.?@])?(.*)/.exec(g);l.push({type:1,index:a,name:y[2],strings:v,ctor:y[1]==="."?rl:y[1]==="?"?ll:y[1]==="@"?cl:rn}),i.removeAttribute(u)}else u.startsWith(xe)&&(l.push({type:6,index:a}),i.removeAttribute(u));if(io.test(i.tagName)){const u=i.textContent.split(xe),g=u.length-1;if(g>0){i.textContent=Qt?Qt.emptyScript:"";for(let v=0;v<g;v++)i.append(u[v],$t()),Pe.nextNode(),l.push({type:2,index:++a});i.append(u[g],$t())}}}else if(i.nodeType===8)if(i.data===so)l.push({type:2,index:a});else{let u=-1;for(;(u=i.data.indexOf(xe,u+1))!==-1;)l.push({type:7,index:a}),u+=xe.length-1}a++}}static createElement(t,n){const s=Oe.createElement("template");return s.innerHTML=t,s}};function Je(e,t,n=e,s){if(t===ke)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=xt(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,s)),s!==void 0?(n._$Co??=[])[s]=i:n._$Cl=i),i!==void 0&&(t=Je(e,i._$AS(e,t.values),i,s)),t}class ol{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:s}=this._$AD,i=(t?.creationScope??Oe).importNode(n,!0);Pe.currentNode=i;let a=Pe.nextNode(),o=0,r=0,l=s[0];for(;l!==void 0;){if(o===l.index){let p;l.type===2?p=new on(a,a.nextSibling,this,t):l.type===1?p=new l.ctor(a,l.name,l.strings,this,t):l.type===6&&(p=new dl(a,this,t)),this._$AV.push(p),l=s[++r]}o!==l?.index&&(a=Pe.nextNode(),o++)}return Pe.currentNode=Oe,i}p(t){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,n),n+=s.strings.length-2):s._$AI(t[n])),n++}}let on=class ro{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=Je(this,t,n),xt(t)?t===f||t==null||t===""?(this._$AH!==f&&this._$AR(),this._$AH=f):t!==this._$AH&&t!==ke&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):sl(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==f&&xt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Oe.createTextNode(t)),this._$AH=t}$(t){const{values:n,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=as.createElement(ao(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new ol(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Qi.get(t.strings);return n===void 0&&Qi.set(t.strings,n=new as(t)),n}k(t){Ns(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const a of t)i===n.length?n.push(s=new ro(this.O($t()),this.O($t()),this,this.options)):s=n[i],s._$AI(a),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){const s=ji(t).nextSibling;ji(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class rn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=f,this._$AN=void 0,this.element=t,this.name=n,this._$AM=i,this.options=a,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=f}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=Je(this,t,n,0),o=!xt(t)||t!==this._$AH&&t!==ke,o&&(this._$AH=t);else{const r=t;let l,p;for(t=a[0],l=0;l<a.length-1;l++)p=Je(this,r[s+l],n,l),p===ke&&(p=this._$AH[l]),o||=!xt(p)||p!==this._$AH[l],p===f?t=f:t!==f&&(t+=(p??"")+a[l+1]),this._$AH[l]=p}o&&!i&&this.j(t)}j(t){t===f?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let rl=class extends rn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===f?void 0:t}},ll=class extends rn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==f)}},cl=class extends rn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=Je(this,t,n,0)??f)===ke)return;const s=this._$AH,i=t===f&&s!==f||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==f&&(s===f||i);i&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},dl=class{constructor(t,n,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Je(this,t)}};const ul={I:on},pl=Ps.litHtmlPolyfillSupport;pl?.(as,on),(Ps.litHtmlVersions??=[]).push("3.3.2");const hl=(e,t,n)=>{const s=n?.renderBefore??t;let i=s._$litPart$;if(i===void 0){const a=n?.renderBefore??null;s._$litPart$=i=new on(t.insertBefore($t(),a),a,void 0,n??{})}return i._$AI(e),i};const Os=globalThis;let Xe=class extends Qe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=hl(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ke}};Xe._$litElement$=!0,Xe.finalized=!0,Os.litElementHydrateSupport?.({LitElement:Xe});const fl=Os.litElementPolyfillSupport;fl?.({LitElement:Xe});(Os.litElementVersions??=[]).push("4.2.2");const lo=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const gl={attribute:!0,type:String,converter:Yt,reflect:!1,hasChanged:Rs},vl=(e=gl,t,n)=>{const{kind:s,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),s==="setter"&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),s==="accessor"){const{name:o}=n;return{set(r){const l=t.get.call(this);t.set.call(this,r),this.requestUpdate(o,l,e,!0,r)},init(r){return r!==void 0&&this.C(o,void 0,e,r),r}}}if(s==="setter"){const{name:o}=n;return function(r){const l=this[o];t.call(this,r),this.requestUpdate(o,l,e,!0,r)}}throw Error("Unsupported decorator location: "+s)};function ln(e){return(t,n)=>typeof n=="object"?vl(e,t,n):((s,i,a)=>{const o=i.hasOwnProperty(a);return i.constructor.createProperty(a,s),o?Object.getOwnPropertyDescriptor(i,a):void 0})(e,t,n)}function w(e){return ln({...e,state:!0,attribute:!1})}const ml=50,yl=200,bl="Assistant";function Zi(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function os(e){const t=Zi(e?.name,ml)??bl,n=Zi(e?.avatar??void 0,yl)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function wl(){return os(typeof window>"u"?{}:{name:window.__OPENCLAW_ASSISTANT_NAME__,avatar:window.__OPENCLAW_ASSISTANT_AVATAR__})}const co="openclaw.control.settings.v1";function $l(){const t={gatewayUrl:`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,token:"",sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const n=localStorage.getItem(co);if(!n)return t;const s=JSON.parse(n);return{gatewayUrl:typeof s.gatewayUrl=="string"&&s.gatewayUrl.trim()?s.gatewayUrl.trim():t.gatewayUrl,token:typeof s.token=="string"?s.token:t.token,sessionKey:typeof s.sessionKey=="string"&&s.sessionKey.trim()?s.sessionKey.trim():t.sessionKey,lastActiveSessionKey:typeof s.lastActiveSessionKey=="string"&&s.lastActiveSessionKey.trim()?s.lastActiveSessionKey.trim():typeof s.sessionKey=="string"&&s.sessionKey.trim()||t.lastActiveSessionKey,theme:s.theme==="light"||s.theme==="dark"||s.theme==="system"?s.theme:t.theme,chatFocusMode:typeof s.chatFocusMode=="boolean"?s.chatFocusMode:t.chatFocusMode,chatShowThinking:typeof s.chatShowThinking=="boolean"?s.chatShowThinking:t.chatShowThinking,splitRatio:typeof s.splitRatio=="number"&&s.splitRatio>=.4&&s.splitRatio<=.7?s.splitRatio:t.splitRatio,navCollapsed:typeof s.navCollapsed=="boolean"?s.navCollapsed:t.navCollapsed,navGroupsCollapsed:typeof s.navGroupsCollapsed=="object"&&s.navGroupsCollapsed!==null?s.navGroupsCollapsed:t.navGroupsCollapsed}}catch{return t}}function xl(e){localStorage.setItem(co,JSON.stringify(e))}function uo(e){const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const s=n[1]?.trim(),i=n.slice(2).join(":");return!s||!i?null:{agentId:s,rest:i}}const Al=[{label:"对话",tabs:["chat"]},{label:"控制台",tabs:["overview","channels","instances","sessions","cron"]},{label:"代理",tabs:["skills","nodes"]},{label:"设置",tabs:["config","debug","logs"]}],po={overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},ho=new Map(Object.entries(po).map(([e,t])=>[t,e]));function cn(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function At(e){if(!e)return"/";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function Ds(e,t=""){const n=cn(t),s=po[e];return n?`${n}${s}`:s}function fo(e,t=""){const n=cn(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=At(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":ho.get(i)??null}function kl(e){let t=At(e);if(t.endsWith("/index.html")&&(t=At(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(ho.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function Sl(e){switch(e){case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"cron":return"loader";case"skills":return"zap";case"nodes":return"monitor";case"config":return"settings";case"debug":return"bug";case"logs":return"scrollText";default:return"folder"}}function rs(e){switch(e){case"overview":return"概览";case"channels":return"渠道";case"instances":return"实例";case"sessions":return"会话";case"cron":return"定时任务";case"skills":return"技能";case"nodes":return"节点";case"chat":return"对话";case"config":return"配置";case"debug":return"调试";case"logs":return"日志";default:return"控制"}}function _l(e){switch(e){case"overview":return"网关状态、入口点和快速健康检查。";case"channels":return"管理渠道和设置。";case"instances":return"来自已连接客户端和节点的存在信标。";case"sessions":return"检查活动会话并调整会话默认值。";case"cron":return"安排唤醒和定期代理运行。";case"skills":return"管理技能可用性和 API 密钥注入。";case"nodes":return"配对设备、功能和命令暴露。";case"chat":return"直接网关对话会话,用于快速干预。";case"config":return"安全编辑 ~/.openclaw/openclaw.json。";case"debug":return"网关快照、事件和手动 RPC 调用。";case"logs":return"网关文件日志的实时输出。";default:return""}}const z={messageSquare:c`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:c`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:c`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:c`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:c`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:c`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:c`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:c`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:c`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:c`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,menu:c`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:c`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:c`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:c`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:c`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:c`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:c`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:c`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,wrench:c`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:c`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:c`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:c`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:c`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,image:c`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:c`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,plug:c`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:c`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:c`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`},Tl=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,Bt=/<\s*\/?\s*final\b[^<>]*>/gi,Xi=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Ji(e){const t=[],n=/(^|\n)(```|~~~)[^\n]*\n[\s\S]*?(?:\n\2(?:\n|$)|$)/g;for(const i of e.matchAll(n)){const a=(i.index??0)+i[1].length;t.push({start:a,end:a+i[0].length-i[1].length})}const s=/`+[^`]+`+/g;for(const i of e.matchAll(s)){const a=i.index??0,o=a+i[0].length;t.some(l=>a>=l.start&&o<=l.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function ea(e,t){return t.some(n=>e>=n.start&&e<n.end)}function Cl(e,t){return e.trimStart()}function El(e,t){if(!e||!Tl.test(e))return e;let n=e;if(Bt.test(n)){Bt.lastIndex=0;const r=[],l=Ji(n);for(const p of n.matchAll(Bt)){const d=p.index??0;r.push({start:d,length:p[0].length,inCode:ea(d,l)})}for(let p=r.length-1;p>=0;p--){const d=r[p];d.inCode||(n=n.slice(0,d.start)+n.slice(d.start+d.length))}}else Bt.lastIndex=0;const s=Ji(n);Xi.lastIndex=0;let i="",a=0,o=!1;for(const r of n.matchAll(Xi)){const l=r.index??0,p=r[1]==="/";ea(l,s)||(o?p&&(o=!1):(i+=n.slice(a,l),p||(o=!0)),a=l+r[0].length)}return i+=n.slice(a),Cl(i)}function kt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function O(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0)return"just now";const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const s=Math.round(n/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);return i<48?`${i}h ago`:`${Math.round(i/24)}d ago`}function go(e){if(!e&&e!==0)return"n/a";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const s=Math.round(n/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function ls(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function cs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function vo(e,t){return e.length<=t?{text:e,truncated:!1,total:e.length}:{text:e.slice(0,Math.max(0,t)),truncated:!0,total:e.length}}function Zt(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function Un(e){return El(e)}const Ml=/^\[([^\]]+)\]\s*/,Il=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],Kn=new WeakMap,Hn=new WeakMap;function Ll(e){return/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}Z\b/.test(e)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}\b/.test(e)?!0:Il.some(t=>e.startsWith(`${t} `))}function zn(e){const t=e.match(Ml);if(!t)return e;const n=t[1]??"";return Ll(n)?e.slice(t[0].length):e}function ds(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?Un(s):zn(s);if(Array.isArray(s)){const i=s.map(a=>{const o=a;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(a=>typeof a=="string");if(i.length>0){const a=i.join(`
|
|
4
4
|
`);return n==="assistant"?Un(a):zn(a)}}return typeof t.text=="string"?n==="assistant"?Un(t.text):zn(t.text):null}function mo(e){if(!e||typeof e!="object")return ds(e);const t=e;if(Kn.has(t))return Kn.get(t)??null;const n=ds(e);return Kn.set(t,n),n}function ta(e){const n=e.content,s=[];if(Array.isArray(n))for(const r of n){const l=r;if(l.type==="thinking"&&typeof l.thinking=="string"){const p=l.thinking.trim();p&&s.push(p)}}if(s.length>0)return s.join(`
|
|
5
5
|
`);const i=Pl(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(r=>(r[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
|
|
6
6
|
`):null}function Rl(e){if(!e||typeof e!="object")return ta(e);const t=e;if(Hn.has(t))return Hn.get(t)??null;const n=ta(e);return Hn.set(t,n),n}function Pl(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const s=n.map(i=>{const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>typeof i=="string");if(s.length>0)return s.join(`
|
|
7
7
|
`)}return typeof t.text=="string"?t.text:null}function Nl(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(s=>s.trim()).filter(Boolean).map(s=>`_${s}_`);return n.length?["_Reasoning:_",...n].join(`
|
|
8
8
|
`):""}let na=!1;function sa(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)t+=e[n].toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Ol(){const e=new Uint8Array(16),t=Date.now();for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return e[0]^=t&255,e[1]^=t>>>8&255,e[2]^=t>>>16&255,e[3]^=t>>>24&255,e}function Dl(){na||(na=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Bs(e=globalThis.crypto){if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),sa(t)}return Dl(),sa(Ol())}async function St(e){if(!(!e.client||!e.connected)){e.chatLoading=!0,e.lastError=null;try{const t=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:200});e.chatMessages=Array.isArray(t.messages)?t.messages:[],e.chatThinkingLevel=t.thinkingLevel??null}catch(t){e.lastError=String(t)}finally{e.chatLoading=!1}}}function Bl(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Fl(e,t,n){if(!e.client||!e.connected)return!1;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return!1;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const p of n)o.push({type:"image",source:{type:"base64",media_type:p.mimeType,data:p.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const r=Bs();e.chatRunId=r,e.chatStream="",e.chatStreamStartedAt=a;const l=i?n.map(p=>{const d=Bl(p.dataUrl);return d?{type:"image",mimeType:d.mimeType,content:d.content}:null}).filter(p=>p!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:r,attachments:l}),!0}catch(p){const d=String(p);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=d,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+d}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function Ul(e){if(!e.client||!e.connected)return!1;const t=e.chatRunId;try{return await e.client.request("chat.abort",t?{sessionKey:e.sessionKey,runId:t}:{sessionKey:e.sessionKey}),!0}catch(n){return e.lastError=String(n),!1}}function Kl(e,t){if(!t||t.sessionKey!==e.sessionKey)return null;if(t.runId&&e.chatRunId&&t.runId!==e.chatRunId)return t.state==="final"?"final":null;if(t.state==="delta"){const n=ds(t.message);if(typeof n=="string"){const s=e.chatStream??"";(!s||n.length>=s.length)&&(e.chatStream=n)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.lastError=t.errorMessage??"chat error");return t.state}async function Ke(e,t){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const n=t?.includeGlobal??e.sessionsIncludeGlobal,s=t?.includeUnknown??e.sessionsIncludeUnknown,i=t?.activeMinutes??Zt(e.sessionsFilterActive,0),a=t?.limit??Zt(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const r=await e.client.request("sessions.list",o);r&&(e.sessionsResult=r)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Hl(e,t,n){if(!e.client||!e.connected)return;const s={key:t};"label"in n&&(s.label=n.label),"thinkingLevel"in n&&(s.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(s.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(s.reasoningLevel=n.reasoningLevel);try{await e.client.request("sessions.patch",s),await Ke(e)}catch(i){e.sessionsError=String(i)}}async function zl(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
9
9
|
|
|
10
|
-
Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await Ke(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}const ia=50,jl=80,
|
|
11
|
-
`)}function aa(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=
|
|
10
|
+
Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,e.sessionsError=null;try{await e.client.request("sessions.delete",{key:t,deleteTranscript:!0}),await Ke(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}const ia=50,jl=80,Wl=12e4;function Vl(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.text=="string")return t.text;const n=t.content;if(!Array.isArray(n))return null;const s=n.map(i=>{if(!i||typeof i!="object")return null;const a=i;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(i=>!!i);return s.length===0?null:s.join(`
|
|
11
|
+
`)}function aa(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Vl(e);let n;if(typeof e=="string")n=e;else if(t)n=t;else try{n=JSON.stringify(e,null,2)}catch{n=String(e)}const s=vo(n,Wl);return s.truncated?`${s.text}
|
|
12
12
|
|
|
13
|
-
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function
|
|
13
|
+
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function ql(e){const t=[];return t.push({type:"toolcall",name:e.name,arguments:e.args??{}}),e.output&&t.push({type:"toolresult",name:e.name,text:e.output}),{role:"assistant",toolCallId:e.toolCallId,runId:e.runId,content:t,timestamp:e.startedAt}}function Gl(e){if(e.toolStreamOrder.length<=ia)return;const t=e.toolStreamOrder.length-ia,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function Yl(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function us(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),Yl(e)}function Ql(e,t=!1){if(t){us(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>us(e),jl))}function dn(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],us(e)}const Zl=5e3;function Xl(e,t){const n=t.data??{},s=typeof n.phase=="string"?n.phase:"";e.compactionClearTimer!=null&&(window.clearTimeout(e.compactionClearTimer),e.compactionClearTimer=null),s==="start"?e.compactionStatus={active:!0,startedAt:Date.now(),completedAt:null}:s==="end"&&(e.compactionStatus={active:!1,startedAt:e.compactionStatus?.startedAt??null,completedAt:Date.now()},e.compactionClearTimer=window.setTimeout(()=>{e.compactionStatus=null,e.compactionClearTimer=null},Zl))}function Jl(e,t){if(!t)return;if(t.stream==="compaction"){Xl(e,t);return}if(t.stream!=="tool")return;const n=typeof t.sessionKey=="string"?t.sessionKey:void 0;if(n&&n!==e.sessionKey||!n&&e.chatRunId&&t.runId!==e.chatRunId||e.chatRunId&&t.runId!==e.chatRunId||!e.chatRunId)return;const s=t.data??{},i=typeof s.toolCallId=="string"?s.toolCallId:"";if(!i)return;const a=typeof s.name=="string"?s.name:"tool",o=typeof s.phase=="string"?s.phase:"",r=o==="start"?s.args:void 0,l=o==="update"?aa(s.partialResult):o==="result"?aa(s.result):void 0,p=Date.now();let d=e.toolStreamById.get(i);d?(d.name=a,r!==void 0&&(d.args=r),l!==void 0&&(d.output=l),d.updatedAt=p):(d={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:r,output:l,startedAt:typeof t.ts=="number"?t.ts:p,updatedAt:p,message:{}},e.toolStreamById.set(i,d),e.toolStreamOrder.push(i)),d.message=ql(d),Gl(e),Ql(e,o==="result")}function un(e,t=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const n=()=>{const s=e.querySelector(".chat-thread");if(s){const i=getComputedStyle(s).overflowY;if(i==="auto"||i==="scroll"||s.scrollHeight-s.clientHeight>1)return s}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{e.chatScrollFrame=requestAnimationFrame(()=>{e.chatScrollFrame=null;const s=n();if(!s)return;const i=s.scrollHeight-s.scrollTop-s.clientHeight;if(!(t||e.chatUserNearBottom||i<200))return;t&&(e.chatHasAutoScrolled=!0),s.scrollTop=s.scrollHeight,e.chatUserNearBottom=!0;const o=t?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const r=n();if(!r)return;const l=r.scrollHeight-r.scrollTop-r.clientHeight;(t||e.chatUserNearBottom||l<200)&&(r.scrollTop=r.scrollHeight,e.chatUserNearBottom=!0)},o)})})}function yo(e,t=!1){e.logsScrollFrame&&cancelAnimationFrame(e.logsScrollFrame),e.updateComplete.then(()=>{e.logsScrollFrame=requestAnimationFrame(()=>{e.logsScrollFrame=null;const n=e.querySelector(".log-stream");if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;(t||s<80)&&(n.scrollTop=n.scrollHeight)})})}function ec(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<200}function tc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function nc(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0}function sc(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
14
14
|
`)}
|
|
15
15
|
`],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),a=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`openclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function ic(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}function De(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function et(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
16
|
-
`}function bo(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],r=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof r=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const l=s;l[o]==null&&(l[o]=typeof r=="number"?[]:{}),s=l[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function wo(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function ye(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});oc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function $o(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});ac(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function ac(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function oc(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?et(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=et(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=De(t.config??{}),e.configFormOriginal=De(t.config??{}),e.configRawOriginal=n)}async function ps(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?et(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await ye(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function rc(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?et(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.apply",{raw:t,baseHash:n,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await ye(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function lc(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function Ft(e,t,n){const s=De(e.configForm??e.configSnapshot?.config??{});bo(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=et(s))}function oa(e,t){const n=De(e.configForm??e.configSnapshot?.config??{});wo(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=et(n))}async function Tt(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function pn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function cc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=Zt(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function dc(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=Zt(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function uc(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=cc(e.cronForm),n=dc(e.cronForm),s=e.cronForm.agentId.trim(),i={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!i.name)throw new Error("Name required.");await e.client.request("cron.add",i),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await pn(e),await Tt(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function pc(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await pn(e),await Tt(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function hc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await xo(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function fc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await pn(e),await Tt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function xo(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function oe(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function gc(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function vc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function mc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}async function hn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function yc(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const bc=2e3,wc=new Set(["trace","debug","info","warn","error","fatal"]);function $c(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function xc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return wc.has(t)?t:null}function Ac(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=xc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=$c(a);let r=null;o&&(typeof o.subsystem=="string"?r=o.subsystem:typeof o.module=="string"&&(r=o.module)),!r&&a&&a.length<120&&(r=a);let l=null;return typeof t[1]=="string"?l=t[1]:!o&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:s,level:i,subsystem:r,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Fs(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(r=>typeof r=="string"):[]).map(Ac),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-bc),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}const Ao={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:G,n:Wt,Gx:ra,Gy:la,a:jn,d:qn,h:kc}=Ao,Be=32,Us=64,Sc=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},H=(e="")=>{const t=new Error(e);throw Sc(t,H),t},_c=e=>typeof e=="bigint",Cc=e=>typeof e=="string",Tc=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",_e=(e,t,n="")=>{const s=Tc(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,r=a?` of length ${t}`:"",l=s?`length=${i}`:`type=${typeof e}`;H(o+"expected Uint8Array"+r+", got "+l)}return e},fn=e=>new Uint8Array(e),ko=e=>Uint8Array.from(e),So=(e,t)=>e.toString(16).padStart(t,"0"),_o=e=>Array.from(_e(e)).map(t=>So(t,2)).join(""),ve={_0:48,_9:57,A:65,F:70,a:97,f:102},ca=e=>{if(e>=ve._0&&e<=ve._9)return e-ve._0;if(e>=ve.A&&e<=ve.F)return e-(ve.A-10);if(e>=ve.a&&e<=ve.f)return e-(ve.a-10)},Co=e=>{const t="hex invalid";if(!Cc(e))return H(t);const n=e.length,s=n/2;if(n%2)return H(t);const i=fn(s);for(let a=0,o=0;a<s;a++,o+=2){const r=ca(e.charCodeAt(o)),l=ca(e.charCodeAt(o+1));if(r===void 0||l===void 0)return H(t);i[a]=r*16+l}return i},To=()=>globalThis?.crypto,Ec=()=>To()?.subtle??H("crypto.subtle must be defined, consider polyfill"),_t=(...e)=>{const t=fn(e.reduce((s,i)=>s+_e(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},Mc=(e=Be)=>To().getRandomValues(fn(e)),Jt=BigInt,Re=(e,t,n,s="bad number: out of range")=>_c(e)&&t<=e&&e<n?e:H(s),k=(e,t=G)=>{const n=e%t;return n>=0n?n:t+n},Eo=e=>k(e,Wt),Lc=(e,t)=>{(e===0n||t<=0n)&&H("no inverse n="+e+" mod="+t);let n=k(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,r=s%n,l=i-a*o;s=n,n=r,i=a,a=l}return s===1n?k(i,t):H("no inverse")},Ic=e=>{const t=Ro[e];return typeof t!="function"&&H("hashes."+e+" not set"),t},Gn=e=>e instanceof ee?e:H("Point expected"),hs=2n**256n;class ee{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=hs;this.X=Re(t,0n,a),this.Y=Re(n,0n,a),this.Z=Re(s,1n,a),this.T=Re(i,0n,a),Object.freeze(this)}static CURVE(){return Ao}static fromAffine(t){return new ee(t.x,t.y,1n,k(t.x*t.y))}static fromBytes(t,n=!1){const s=qn,i=ko(_e(t,Be)),a=t[31];i[31]=a&-129;const o=Lo(i);Re(o,0n,n?hs:G);const l=k(o*o),p=k(l-1n),d=k(s*l+1n);let{isValid:u,value:g}=Pc(p,d);u||H("bad point: y not sqrt");const v=(g&1n)===1n,y=(a&128)!==0;return!n&&g===0n&&y&&H("bad point: x==0, isLastByteOdd"),y!==v&&(g=k(-g)),new ee(g,o,1n,k(g*o))}static fromHex(t,n){return ee.fromBytes(Co(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=jn,n=qn,s=this;if(s.is0())return H("bad point: ZERO");const{X:i,Y:a,Z:o,T:r}=s,l=k(i*i),p=k(a*a),d=k(o*o),u=k(d*d),g=k(l*t),v=k(d*k(g+p)),y=k(u+k(n*k(l*p)));if(v!==y)return H("bad point: equation left != right (1)");const $=k(i*a),A=k(o*r);return $!==A?H("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:r}=Gn(t),l=k(n*r),p=k(a*i),d=k(s*r),u=k(o*i);return l===p&&d===u}is0(){return this.equals(Ze)}negate(){return new ee(k(-this.X),this.Y,this.Z,k(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=jn,a=k(t*t),o=k(n*n),r=k(2n*k(s*s)),l=k(i*a),p=t+n,d=k(k(p*p)-a-o),u=l+o,g=u-r,v=l-o,y=k(d*g),$=k(u*v),A=k(d*v),_=k(g*u);return new ee(y,$,_,A)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:r,Z:l,T:p}=Gn(t),d=jn,u=qn,g=k(n*o),v=k(s*r),y=k(a*u*p),$=k(i*l),A=k((n+s)*(o+r)-g-v),_=k($-y),L=k($+y),P=k(v-d*g),M=k(A*_),T=k(L*P),E=k(A*P),pe=k(_*L);return new ee(M,T,pe,E)}subtract(t){return this.add(Gn(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Ze;if(Re(t,1n,Wt),t===1n)return this;if(this.equals(Fe))return qc(t).p;let s=Ze,i=Fe;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(Ze))return{x:0n,y:1n};const i=Lc(s,G);k(s*i)!==1n&&H("invalid inverse");const a=k(t*i),o=k(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Mo(n);return s[31]|=t&1n?128:0,s}toHex(){return _o(this.toBytes())}clearCofactor(){return this.multiply(Jt(kc),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Wt/2n,!1).double();return Wt%2n&&(t=t.add(this)),t.is0()}}const Fe=new ee(ra,la,1n,k(ra*la)),Ze=new ee(0n,1n,1n,0n);ee.BASE=Fe;ee.ZERO=Ze;const Mo=e=>Co(So(Re(e,0n,hs),Us)).reverse(),Lo=e=>Jt("0x"+_o(ko(_e(e)).reverse())),ce=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=G;return n},Rc=e=>{const n=e*e%G*e%G,s=ce(n,2n)*n%G,i=ce(s,1n)*e%G,a=ce(i,5n)*i%G,o=ce(a,10n)*a%G,r=ce(o,20n)*o%G,l=ce(r,40n)*r%G,p=ce(l,80n)*l%G,d=ce(p,80n)*l%G,u=ce(d,10n)*a%G;return{pow_p_5_8:ce(u,2n)*e%G,b2:n}},da=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Pc=(e,t)=>{const n=k(t*t*t),s=k(n*n*t),i=Rc(e*s).pow_p_5_8;let a=k(e*n*i);const o=k(t*a*a),r=a,l=k(a*da),p=o===e,d=o===k(-e),u=o===k(-e*da);return p&&(a=r),(d||u)&&(a=l),(k(a)&1n)===1n&&(a=k(-a)),{isValid:p||d,value:a}},fs=e=>Eo(Lo(e)),Ks=(...e)=>Ro.sha512Async(_t(...e)),Nc=(...e)=>Ic("sha512")(_t(...e)),Io=e=>{const t=e.slice(0,Be);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Be,Us),s=fs(t),i=Fe.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Hs=e=>Ks(_e(e,Be)).then(Io),Oc=e=>Io(Nc(_e(e,Be))),Dc=e=>Hs(e).then(t=>t.pointBytes),Bc=e=>Ks(e.hashable).then(e.finish),Fc=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=fs(t),o=Fe.multiply(a).toBytes();return{hashable:_t(o,s,n),finish:p=>{const d=Eo(a+fs(p)*i);return _e(_t(o,Mo(d)),Us)}}},Uc=async(e,t)=>{const n=_e(e),s=await Hs(t),i=await Ks(s.prefix,n);return Bc(Fc(s,i,n))},Ro={sha512Async:async e=>{const t=Ec(),n=_t(e);return fn(await t.digest("SHA-512",n.buffer))},sha512:void 0},Kc=(e=Mc(Be))=>e,Hc={getExtendedPublicKeyAsync:Hs,getExtendedPublicKey:Oc,randomSecretKey:Kc},Xt=8,zc=256,Po=Math.ceil(zc/Xt)+1,gs=2**(Xt-1),jc=()=>{const e=[];let t=Fe,n=t;for(let s=0;s<Po;s++){n=t,e.push(n);for(let i=1;i<gs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let ua;const pa=(e,t)=>{const n=t.negate();return e?n:t},qc=e=>{const t=ua||(ua=jc());let n=Ze,s=Fe;const i=2**Xt,a=i,o=Jt(i-1),r=Jt(Xt);for(let l=0;l<Po;l++){let p=Number(e&o);e>>=r,p>gs&&(p-=a,e+=1n);const d=l*gs,u=d,g=d+Math.abs(p)-1,v=l%2!==0,y=p<0;p===0?s=s.add(pa(v,t[u])):n=n.add(pa(y,t[g]))}return e!==0n&&H("invalid wnaf"),{p:n,f:s}},Wn="openclaw-device-identity-v1";function vs(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function No(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Gc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Oo(e){const t=await crypto.subtle.digest("SHA-256",e);return Gc(new Uint8Array(t))}async function Wc(){const e=Hc.randomSecretKey(),t=await Dc(e);return{deviceId:await Oo(t),publicKey:vs(t),privateKey:vs(e)}}async function zs(){try{const n=localStorage.getItem(Wn);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await Oo(No(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Wn,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await Wc(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Wn,JSON.stringify(t)),e}async function Vc(e,t){const n=No(e),s=new TextEncoder().encode(t),i=await Uc(s,n);return vs(i)}const Do="openclaw.device.auth.v1";function js(e){return e.trim()}function Yc(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].sort()}function qs(){try{const e=window.localStorage.getItem(Do);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function Bo(e){try{window.localStorage.setItem(Do,JSON.stringify(e))}catch{}}function Qc(e){const t=qs();if(!t||t.deviceId!==e.deviceId)return null;const n=js(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Fo(e){const t=js(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=qs();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:Yc(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,Bo(n),i}function Uo(e){const t=qs();if(!t||t.deviceId!==e.deviceId)return;const n=js(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],Bo(s)}async function Ce(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Zc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Ce(e)}catch(n){e.devicesError=String(n)}}async function Jc(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Ce(e)}catch(s){e.devicesError=String(s)}}async function Xc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await zs(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Fo({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Ce(e)}catch(n){e.devicesError=String(n)}}async function ed(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await zs();t.deviceId===s.deviceId&&Uo({deviceId:s.deviceId,role:t.role}),await Ce(e)}catch(s){e.devicesError=String(s)}}async function gn(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function td(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function nd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Gs(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=td(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);sd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function sd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=De(t.file??{}))}async function id(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=nd(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await Gs(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function ad(e,t,n){const s=De(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});bo(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function od(e,t){const n=De(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});wo(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Ws(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function tt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function vn(e){return e instanceof Error?e.message:String(e)}async function Et(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=vn(n)}finally{e.skillsLoading=!1}}}function rd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function ld(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await Et(e),tt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=vn(s);e.skillsError=i,tt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function cd(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await Et(e),tt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=vn(n);e.skillsError=s,tt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function dd(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await Et(e),tt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=vn(i);e.skillsError=a,tt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}function ud(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Vs(e){return e==="system"?ud():e}const Ut=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,pd=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Kt=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},hd=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,r=pd();if(!!o.startViewTransition&&!r){let p=.5,d=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")p=Ut(n.pointerClientX/window.innerWidth),d=Ut(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(p=Ut((u.left+u.width/2)/window.innerWidth),d=Ut((u.top+u.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${p*100}%`),a.style.setProperty("--theme-switch-y",`${d*100}%`),a.classList.add("theme-transition");try{const u=o.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>Kt(a)):Kt(a)}catch{Kt(a),t()}return}t(),Kt(a)};function fd(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{gn(e,{quiet:!0})},5e3))}function gd(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Ys(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Fs(e,{quiet:!0})},2e3))}function Qs(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Zs(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&hn(e)},3e3))}function Js(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Se(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,xl(n),t.theme!==e.theme&&(e.theme=t.theme,mn(e,Vs(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Ko(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Se(e,{...e.settings,lastActiveSessionKey:n})}function vd(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),a=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&Se(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(s!=null){const l=s.trim();l&&(e.password=l),t.delete("password"),o=!0}if(i!=null){const l=i.trim();l&&(e.sessionKey=l,Se(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(a!=null){const l=a.trim();l&&l!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=l),t.delete("gatewayUrl"),o=!0}if(!o)return;const r=new URL(window.location.href);r.search=t.toString(),window.history.replaceState({},"",r.toString())}function md(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ys(e):Qs(e),t==="debug"?Zs(e):Js(e),Xs(e),zo(e,t,!1)}function yd(e,t,n){hd({nextTheme:t,applyTheme:()=>{e.theme=t,Se(e,{...e.settings,theme:t}),mn(e,Vs(t))},context:n,currentTheme:e.theme})}async function Xs(e){e.tab==="overview"&&await jo(e),e.tab==="channels"&&await _d(e),e.tab==="instances"&&await Ws(e),e.tab==="sessions"&&await Ke(e),e.tab==="cron"&&await ei(e),e.tab==="skills"&&await Et(e),e.tab==="nodes"&&(await gn(e),await Ce(e),await ye(e),await Gs(e)),e.tab==="chat"&&(await Yo(e),un(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await $o(e),await ye(e)),e.tab==="debug"&&(await hn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Fs(e,{reset:!0}),yo(e,!0))}function bd(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?cn(e):kl(window.location.pathname)}function wd(e){e.theme=e.settings.theme??"system",mn(e,Vs(e.theme))}function mn(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function $d(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&mn(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function xd(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function Ad(e,t){if(typeof window>"u")return;const n=fo(window.location.pathname,e.basePath)??"chat";Ho(e,n),zo(e,n,t)}function kd(e){if(typeof window>"u")return;const t=fo(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Se(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Ho(e,t)}function Ho(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ys(e):Qs(e),t==="debug"?Zs(e):Js(e),e.connected&&Xs(e)}function zo(e,t,n){if(typeof window>"u")return;const s=At(Ds(t,e.basePath)),i=At(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function Sd(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function jo(e){await Promise.all([oe(e,!1),Ws(e),Ke(e),Tt(e),hn(e)])}async function _d(e){await Promise.all([oe(e,!0),$o(e),ye(e)])}async function ei(e){await Promise.all([oe(e,!1),Tt(e),pn(e)])}function qo(e){return e.chatSending||!!e.chatRunId}function Cd(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function Td(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function Go(e){e.connected&&(e.chatMessage="",await Ul(e))}function Ed(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Bs(),text:s,createdAt:Date.now(),attachments:i?n?.map(a=>({...a})):void 0}])}async function Wo(e,t,n){dn(e);const s=await Fl(e,t,n?.attachments);return!s&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!s&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),s&&Ko(e,e.sessionKey),s&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),s&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),un(e),s&&!e.chatRunId&&Vo(e),s&&n?.refreshSessions&&(e.refreshSessionsAfterChat=!0),s}async function Vo(e){if(!e.connected||qo(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Wo(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Md(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Ld(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],r=o.length>0;if(!i&&!r)return;if(Cd(i)){await Go(e);return}const l=Td(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),qo(e)){Ed(e,i,o);return}await Wo(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:r?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:l})}async function Yo(e){await Promise.all([St(e),Ke(e,{activeMinutes:0}),ms(e)]),un(e,!0)}const Id=Vo;function Rd(e){const t=uo(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Pd(e,t){const n=cn(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function ms(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Rd(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Pd(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const{I:Nd}=ul,ha=e=>e,Od=e=>e.strings===void 0,fa=()=>document.createComment(""),rt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(fa(),i),o=s.insertBefore(fa(),i);n=new Nd(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,r=o!==e;if(r){let l;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(l=e._$AU)!==o._$AU&&n._$AP(l)}if(a!==i||r){let l=n._$AA;for(;l!==a;){const p=ha(l).nextSibling;ha(s).insertBefore(l,i),l=p}}}return n},Le=(e,t,n=e)=>(e._$AI(t,n),e),Dd={},Bd=(e,t=Dd)=>e._$AH=t,Fd=e=>e._$AH,Vn=e=>{e._$AR(),e._$AA.remove()};const ti={CHILD:2},ni=e=>(...t)=>({_$litDirective$:e,values:t});class si{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}}const yt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),yt(s,t);return!0},en=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},Qo=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Hd(t)}};function Ud(e){this._$AN!==void 0?(en(this),this._$AM=e,Qo(this)):this._$AM=e}function Kd(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let a=n;a<s.length;a++)yt(s[a],!1),en(s[a]);else s!=null&&(yt(s,!1),en(s));else yt(this,e)}const Hd=e=>{e.type==ti.CHILD&&(e._$AP??=Kd,e._$AQ??=Ud)};class zd extends si{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),Qo(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(yt(this,t),en(this))}setValue(t){if(Od(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Yn=new WeakMap,jd=ni(class extends zd{render(e){return f}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),f}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Yn.get(t);n===void 0&&(n=new WeakMap,Yn.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Yn.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});const ga=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Zo=ni(class extends si{constructor(e){if(super(e),e.type!==ti.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const r of e)i[o]=s?s(r,o):o,a[o]=n(r,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Fd(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const r=this.ut??=[],l=[];let p,d,u=0,g=i.length-1,v=0,y=a.length-1;for(;u<=g&&v<=y;)if(i[u]===null)u++;else if(i[g]===null)g--;else if(r[u]===o[v])l[v]=Le(i[u],a[v]),u++,v++;else if(r[g]===o[y])l[y]=Le(i[g],a[y]),g--,y--;else if(r[u]===o[y])l[y]=Le(i[u],a[y]),rt(e,l[y+1],i[u]),u++,y--;else if(r[g]===o[v])l[v]=Le(i[g],a[v]),rt(e,i[u],i[g]),g--,v++;else if(p===void 0&&(p=ga(o,v,y),d=ga(r,u,g)),p.has(r[u]))if(p.has(r[g])){const $=d.get(o[v]),A=$!==void 0?i[$]:null;if(A===null){const _=rt(e,i[u]);Le(_,a[v]),l[v]=_}else l[v]=Le(A,a[v]),rt(e,i[u],A),i[$]=null;v++}else Vn(i[g]),g--;else Vn(i[u]),u++;for(;v<=y;){const $=rt(e,l[y+1]);Le($,a[v]),l[v++]=$}for(;u<=g;){const $=i[u++];$!==null&&Vn($)}return this.ut=o,Bd(e,l),ke}});function Jo(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(u=>{const v=String(u.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),r=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||r)&&(n="toolResult");let l=[];typeof t.content=="string"?l=[{type:"text",text:t.content}]:Array.isArray(t.content)?l=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(l=[{type:"text",text:t.text}]);const p=typeof t.timestamp=="number"?t.timestamp:Date.now(),d=typeof t.id=="string"?t.id:void 0;return{role:n,content:l,timestamp:p,id:d}}function ii(e){const t=e.toLowerCase();return e==="user"||e==="User"?e:e==="assistant"?"assistant":e==="system"?"system":t==="toolresult"||t==="tool_result"||t==="tool"||t==="function"?"tool":e}function Xo(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}class ys extends si{constructor(t){if(super(t),this.it=f,t.type!==ti.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===f||t==null)return this._t=void 0,this.it=t;if(t===ke)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}ys.directiveName="unsafeHTML",ys.resultType=1;const bs=ni(ys);const{entries:er,setPrototypeOf:va,isFrozen:qd,getPrototypeOf:Gd,getOwnPropertyDescriptor:Wd}=Object;let{freeze:Z,seal:ne,create:ws}=Object,{apply:$s,construct:xs}=typeof Reflect<"u"&&Reflect;Z||(Z=function(t){return t});ne||(ne=function(t){return t});$s||($s=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});xs||(xs=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Ht=J(Array.prototype.forEach),Vd=J(Array.prototype.lastIndexOf),ma=J(Array.prototype.pop),lt=J(Array.prototype.push),Yd=J(Array.prototype.splice),Vt=J(String.prototype.toLowerCase),Qn=J(String.prototype.toString),Zn=J(String.prototype.match),ct=J(String.prototype.replace),Qd=J(String.prototype.indexOf),Zd=J(String.prototype.trim),se=J(Object.prototype.hasOwnProperty),Y=J(RegExp.prototype.test),dt=Jd(TypeError);function J(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return $s(e,t,s)}}function Jd(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return xs(e,n)}}function I(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Vt;va&&va(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(qd(t)||(t[s]=a),i=a)}e[i]=!0}return e}function Xd(e){for(let t=0;t<e.length;t++)se(e,t)||(e[t]=null);return e}function de(e){const t=ws(null);for(const[n,s]of er(e))se(e,n)&&(Array.isArray(s)?t[n]=Xd(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=de(s):t[n]=s);return t}function ut(e,t){for(;e!==null;){const s=Wd(e,t);if(s){if(s.get)return J(s.get);if(typeof s.value=="function")return J(s.value)}e=Gd(e)}function n(){return null}return n}const ya=Z(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Jn=Z(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Xn=Z(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),eu=Z(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),es=Z(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),tu=Z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ba=Z(["#text"]),wa=Z(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ts=Z(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$a=Z(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),zt=Z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),nu=ne(/\{\{[\w\W]*|[\w\W]*\}\}/gm),su=ne(/<%[\w\W]*|[\w\W]*%>/gm),iu=ne(/\$\{[\w\W]*/gm),au=ne(/^data-[\-\w.\u00B7-\uFFFF]+$/),ou=ne(/^aria-[\-\w]+$/),tr=ne(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ru=ne(/^(?:\w+script|data):/i),lu=ne(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nr=ne(/^html$/i),cu=ne(/^[a-z][.\w]*(-[.\w]+)+$/i);var xa=Object.freeze({__proto__:null,ARIA_ATTR:ou,ATTR_WHITESPACE:lu,CUSTOM_ELEMENT:cu,DATA_ATTR:au,DOCTYPE_NAME:nr,ERB_EXPR:su,IS_ALLOWED_URI:tr,IS_SCRIPT_OR_DATA:ru,MUSTACHE_EXPR:nu,TMPLIT_EXPR:iu});const pt={element:1,text:3,progressingInstruction:7,comment:8,document:9},du=function(){return typeof window>"u"?null:window},uu=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Aa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function sr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:du();const t=C=>sr(C);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==pt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:r,Element:l,NodeFilter:p,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:v}=e,y=l.prototype,$=ut(y,"cloneNode"),A=ut(y,"remove"),_=ut(y,"nextSibling"),L=ut(y,"childNodes"),P=ut(y,"parentNode");if(typeof o=="function"){const C=n.createElement("template");C.content&&C.content.ownerDocument&&(n=C.content.ownerDocument)}let M,T="";const{implementation:E,createNodeIterator:pe,createDocumentFragment:xn,getElementsByTagName:An}=n,{importNode:Ir}=s;let V=Aa();t.isSupported=typeof er=="function"&&typeof P=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:kn,ERB_EXPR:Sn,TMPLIT_EXPR:_n,DATA_ATTR:Rr,ARIA_ATTR:Pr,IS_SCRIPT_OR_DATA:Nr,ATTR_WHITESPACE:vi,CUSTOM_ELEMENT:Or}=xa;let{IS_ALLOWED_URI:mi}=xa,K=null;const yi=I({},[...ya,...Jn,...Xn,...es,...ba]);let z=null;const bi=I({},[...wa,...ts,...$a,...zt]);let B=Object.seal(ws(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),st=null,Cn=null;const ze=Object.seal(ws(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let wi=!0,Tn=!0,$i=!1,xi=!0,je=!1,Lt=!0,Te=!1,En=!1,Mn=!1,qe=!1,It=!1,Rt=!1,Ai=!0,ki=!1;const Dr="user-content-";let Ln=!0,it=!1,Ge={},re=null;const In=I({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Si=null;const _i=I({},["audio","video","img","source","image","track"]);let Rn=null;const Ci=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pt="http://www.w3.org/1998/Math/MathML",Nt="http://www.w3.org/2000/svg",he="http://www.w3.org/1999/xhtml";let We=he,Pn=!1,Nn=null;const Br=I({},[Pt,Nt,he],Qn);let Ot=I({},["mi","mo","mn","ms","mtext"]),Dt=I({},["annotation-xml"]);const Fr=I({},["title","style","font","a","script"]);let at=null;const Ur=["application/xhtml+xml","text/html"],Kr="text/html";let U=null,Ve=null;const Hr=n.createElement("form"),Ti=function(h){return h instanceof RegExp||h instanceof Function},On=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ve&&Ve===h)){if((!h||typeof h!="object")&&(h={}),h=de(h),at=Ur.indexOf(h.PARSER_MEDIA_TYPE)===-1?Kr:h.PARSER_MEDIA_TYPE,U=at==="application/xhtml+xml"?Qn:Vt,K=se(h,"ALLOWED_TAGS")?I({},h.ALLOWED_TAGS,U):yi,z=se(h,"ALLOWED_ATTR")?I({},h.ALLOWED_ATTR,U):bi,Nn=se(h,"ALLOWED_NAMESPACES")?I({},h.ALLOWED_NAMESPACES,Qn):Br,Rn=se(h,"ADD_URI_SAFE_ATTR")?I(de(Ci),h.ADD_URI_SAFE_ATTR,U):Ci,Si=se(h,"ADD_DATA_URI_TAGS")?I(de(_i),h.ADD_DATA_URI_TAGS,U):_i,re=se(h,"FORBID_CONTENTS")?I({},h.FORBID_CONTENTS,U):In,st=se(h,"FORBID_TAGS")?I({},h.FORBID_TAGS,U):de({}),Cn=se(h,"FORBID_ATTR")?I({},h.FORBID_ATTR,U):de({}),Ge=se(h,"USE_PROFILES")?h.USE_PROFILES:!1,wi=h.ALLOW_ARIA_ATTR!==!1,Tn=h.ALLOW_DATA_ATTR!==!1,$i=h.ALLOW_UNKNOWN_PROTOCOLS||!1,xi=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=h.SAFE_FOR_TEMPLATES||!1,Lt=h.SAFE_FOR_XML!==!1,Te=h.WHOLE_DOCUMENT||!1,qe=h.RETURN_DOM||!1,It=h.RETURN_DOM_FRAGMENT||!1,Rt=h.RETURN_TRUSTED_TYPE||!1,Mn=h.FORCE_BODY||!1,Ai=h.SANITIZE_DOM!==!1,ki=h.SANITIZE_NAMED_PROPS||!1,Ln=h.KEEP_CONTENT!==!1,it=h.IN_PLACE||!1,mi=h.ALLOWED_URI_REGEXP||tr,We=h.NAMESPACE||he,Ot=h.MATHML_TEXT_INTEGRATION_POINTS||Ot,Dt=h.HTML_INTEGRATION_POINTS||Dt,B=h.CUSTOM_ELEMENT_HANDLING||{},h.CUSTOM_ELEMENT_HANDLING&&Ti(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&Ti(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(B.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),je&&(Tn=!1),It&&(qe=!0),Ge&&(K=I({},ba),z=[],Ge.html===!0&&(I(K,ya),I(z,wa)),Ge.svg===!0&&(I(K,Jn),I(z,ts),I(z,zt)),Ge.svgFilters===!0&&(I(K,Xn),I(z,ts),I(z,zt)),Ge.mathMl===!0&&(I(K,es),I(z,$a),I(z,zt))),h.ADD_TAGS&&(typeof h.ADD_TAGS=="function"?ze.tagCheck=h.ADD_TAGS:(K===yi&&(K=de(K)),I(K,h.ADD_TAGS,U))),h.ADD_ATTR&&(typeof h.ADD_ATTR=="function"?ze.attributeCheck=h.ADD_ATTR:(z===bi&&(z=de(z)),I(z,h.ADD_ATTR,U))),h.ADD_URI_SAFE_ATTR&&I(Rn,h.ADD_URI_SAFE_ATTR,U),h.FORBID_CONTENTS&&(re===In&&(re=de(re)),I(re,h.FORBID_CONTENTS,U)),h.ADD_FORBID_CONTENTS&&(re===In&&(re=de(re)),I(re,h.ADD_FORBID_CONTENTS,U)),Ln&&(K["#text"]=!0),Te&&I(K,["html","head","body"]),K.table&&(I(K,["tbody"]),delete st.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=h.TRUSTED_TYPES_POLICY,T=M.createHTML("")}else M===void 0&&(M=uu(v,i)),M!==null&&typeof T=="string"&&(T=M.createHTML(""));Z&&Z(h),Ve=h}},Ei=I({},[...Jn,...Xn,...eu]),Mi=I({},[...es,...tu]),zr=function(h){let x=P(h);(!x||!x.tagName)&&(x={namespaceURI:We,tagName:"template"});const S=Vt(h.tagName),D=Vt(x.tagName);return Nn[h.namespaceURI]?h.namespaceURI===Nt?x.namespaceURI===he?S==="svg":x.namespaceURI===Pt?S==="svg"&&(D==="annotation-xml"||Ot[D]):!!Ei[S]:h.namespaceURI===Pt?x.namespaceURI===he?S==="math":x.namespaceURI===Nt?S==="math"&&Dt[D]:!!Mi[S]:h.namespaceURI===he?x.namespaceURI===Nt&&!Dt[D]||x.namespaceURI===Pt&&!Ot[D]?!1:!Mi[S]&&(Fr[S]||!Ei[S]):!!(at==="application/xhtml+xml"&&Nn[h.namespaceURI]):!1},le=function(h){lt(t.removed,{element:h});try{P(h).removeChild(h)}catch{A(h)}},Ee=function(h,x){try{lt(t.removed,{attribute:x.getAttributeNode(h),from:x})}catch{lt(t.removed,{attribute:null,from:x})}if(x.removeAttribute(h),h==="is")if(qe||It)try{le(x)}catch{}else try{x.setAttribute(h,"")}catch{}},Li=function(h){let x=null,S=null;if(Mn)h="<remove></remove>"+h;else{const F=Zn(h,/^[\r\n\t ]+/);S=F&&F[0]}at==="application/xhtml+xml"&&We===he&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const D=M?M.createHTML(h):h;if(We===he)try{x=new g().parseFromString(D,at)}catch{}if(!x||!x.documentElement){x=E.createDocument(We,"template",null);try{x.documentElement.innerHTML=Pn?T:D}catch{}}const q=x.body||x.documentElement;return h&&S&&q.insertBefore(n.createTextNode(S),q.childNodes[0]||null),We===he?An.call(x,Te?"html":"body")[0]:Te?x.documentElement:q},Ii=function(h){return pe.call(h.ownerDocument||h,h,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Dn=function(h){return h instanceof u&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof d)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},Ri=function(h){return typeof r=="function"&&h instanceof r};function fe(C,h,x){Ht(C,S=>{S.call(t,h,x,Ve)})}const Pi=function(h){let x=null;if(fe(V.beforeSanitizeElements,h,null),Dn(h))return le(h),!0;const S=U(h.nodeName);if(fe(V.uponSanitizeElement,h,{tagName:S,allowedTags:K}),Lt&&h.hasChildNodes()&&!Ri(h.firstElementChild)&&Y(/<[/\w!]/g,h.innerHTML)&&Y(/<[/\w!]/g,h.textContent)||h.nodeType===pt.progressingInstruction||Lt&&h.nodeType===pt.comment&&Y(/<[/\w]/g,h.data))return le(h),!0;if(!(ze.tagCheck instanceof Function&&ze.tagCheck(S))&&(!K[S]||st[S])){if(!st[S]&&Oi(S)&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,S)||B.tagNameCheck instanceof Function&&B.tagNameCheck(S)))return!1;if(Ln&&!re[S]){const D=P(h)||h.parentNode,q=L(h)||h.childNodes;if(q&&D){const F=q.length;for(let X=F-1;X>=0;--X){const ge=$(q[X],!0);ge.__removalCount=(h.__removalCount||0)+1,D.insertBefore(ge,_(h))}}}return le(h),!0}return h instanceof l&&!zr(h)||(S==="noscript"||S==="noembed"||S==="noframes")&&Y(/<\/no(script|embed|frames)/i,h.innerHTML)?(le(h),!0):(je&&h.nodeType===pt.text&&(x=h.textContent,Ht([kn,Sn,_n],D=>{x=ct(x,D," ")}),h.textContent!==x&&(lt(t.removed,{element:h.cloneNode()}),h.textContent=x)),fe(V.afterSanitizeElements,h,null),!1)},Ni=function(h,x,S){if(Ai&&(x==="id"||x==="name")&&(S in n||S in Hr))return!1;if(!(Tn&&!Cn[x]&&Y(Rr,x))){if(!(wi&&Y(Pr,x))){if(!(ze.attributeCheck instanceof Function&&ze.attributeCheck(x,h))){if(!z[x]||Cn[x]){if(!(Oi(h)&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,h)||B.tagNameCheck instanceof Function&&B.tagNameCheck(h))&&(B.attributeNameCheck instanceof RegExp&&Y(B.attributeNameCheck,x)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(x,h))||x==="is"&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,S)||B.tagNameCheck instanceof Function&&B.tagNameCheck(S))))return!1}else if(!Rn[x]){if(!Y(mi,ct(S,vi,""))){if(!((x==="src"||x==="xlink:href"||x==="href")&&h!=="script"&&Qd(S,"data:")===0&&Si[h])){if(!($i&&!Y(Nr,ct(S,vi,"")))){if(S)return!1}}}}}}}return!0},Oi=function(h){return h!=="annotation-xml"&&Zn(h,Or)},Di=function(h){fe(V.beforeSanitizeAttributes,h,null);const{attributes:x}=h;if(!x||Dn(h))return;const S={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let D=x.length;for(;D--;){const q=x[D],{name:F,namespaceURI:X,value:ge}=q,Ye=U(F),Bn=ge;let j=F==="value"?Bn:Zd(Bn);if(S.attrName=Ye,S.attrValue=j,S.keepAttr=!0,S.forceKeepAttr=void 0,fe(V.uponSanitizeAttribute,h,S),j=S.attrValue,ki&&(Ye==="id"||Ye==="name")&&(Ee(F,h),j=Dr+j),Lt&&Y(/((--!?|])>)|<\/(style|title|textarea)/i,j)){Ee(F,h);continue}if(Ye==="attributename"&&Zn(j,"href")){Ee(F,h);continue}if(S.forceKeepAttr)continue;if(!S.keepAttr){Ee(F,h);continue}if(!xi&&Y(/\/>/i,j)){Ee(F,h);continue}je&&Ht([kn,Sn,_n],Fi=>{j=ct(j,Fi," ")});const Bi=U(h.nodeName);if(!Ni(Bi,Ye,j)){Ee(F,h);continue}if(M&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!X)switch(v.getAttributeType(Bi,Ye)){case"TrustedHTML":{j=M.createHTML(j);break}case"TrustedScriptURL":{j=M.createScriptURL(j);break}}if(j!==Bn)try{X?h.setAttributeNS(X,F,j):h.setAttribute(F,j),Dn(h)?le(h):ma(t.removed)}catch{Ee(F,h)}}fe(V.afterSanitizeAttributes,h,null)},jr=function C(h){let x=null;const S=Ii(h);for(fe(V.beforeSanitizeShadowDOM,h,null);x=S.nextNode();)fe(V.uponSanitizeShadowNode,x,null),Pi(x),Di(x),x.content instanceof a&&C(x.content);fe(V.afterSanitizeShadowDOM,h,null)};return t.sanitize=function(C){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,S=null,D=null,q=null;if(Pn=!C,Pn&&(C="<!-->"),typeof C!="string"&&!Ri(C))if(typeof C.toString=="function"){if(C=C.toString(),typeof C!="string")throw dt("dirty is not a string, aborting")}else throw dt("toString is not a function");if(!t.isSupported)return C;if(En||On(h),t.removed=[],typeof C=="string"&&(it=!1),it){if(C.nodeName){const ge=U(C.nodeName);if(!K[ge]||st[ge])throw dt("root node is forbidden and cannot be sanitized in-place")}}else if(C instanceof r)x=Li("<!---->"),S=x.ownerDocument.importNode(C,!0),S.nodeType===pt.element&&S.nodeName==="BODY"||S.nodeName==="HTML"?x=S:x.appendChild(S);else{if(!qe&&!je&&!Te&&C.indexOf("<")===-1)return M&&Rt?M.createHTML(C):C;if(x=Li(C),!x)return qe?null:Rt?T:""}x&&Mn&&le(x.firstChild);const F=Ii(it?C:x);for(;D=F.nextNode();)Pi(D),Di(D),D.content instanceof a&&jr(D.content);if(it)return C;if(qe){if(It)for(q=xn.call(x.ownerDocument);x.firstChild;)q.appendChild(x.firstChild);else q=x;return(z.shadowroot||z.shadowrootmode)&&(q=Ir.call(s,q,!0)),q}let X=Te?x.outerHTML:x.innerHTML;return Te&&K["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&Y(nr,x.ownerDocument.doctype.name)&&(X="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
17
|
-
`+
|
|
18
|
-
]`).replace("lheading",or).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Su=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_u=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,lr=/^( {2,}|\\)\n(?!\s*$)/,
|
|
16
|
+
`}function bo(e,t,n){if(t.length===0)return;let s=e;for(let a=0;a<t.length-1;a+=1){const o=t[a],r=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof r=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const l=s;l[o]==null&&(l[o]=typeof r=="number"?[]:{}),s=l[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}function wo(e,t){if(t.length===0)return;let n=e;for(let i=0;i<t.length-1;i+=1){const a=t[i];if(typeof a=="number"){if(!Array.isArray(n))return;n=n[a]}else{if(typeof n!="object"||n==null)return;n=n[a]}if(n==null)return}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(n)&&n.splice(s,1);return}typeof n=="object"&&n!=null&&delete n[s]}async function be(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});oc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function $o(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});ac(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function ac(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function oc(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?et(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=et(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=De(t.config??{}),e.configFormOriginal=De(t.config??{}),e.configRawOriginal=n)}async function ps(e){if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?et(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:t,baseHash:n}),e.configFormDirty=!1,await be(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function rc(e){if(!(!e.client||!e.connected)){e.configApplying=!0,e.lastError=null;try{const t=e.configFormMode==="form"&&e.configForm?et(e.configForm):e.configRaw,n=e.configSnapshot?.hash;if(!n){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.apply",{raw:t,baseHash:n,sessionKey:e.applySessionKey}),e.configFormDirty=!1,await be(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function lc(e){if(!(!e.client||!e.connected)){e.updateRunning=!0,e.lastError=null;try{await e.client.request("update.run",{sessionKey:e.applySessionKey})}catch(t){e.lastError=String(t)}finally{e.updateRunning=!1}}}function Ft(e,t,n){const s=De(e.configForm??e.configSnapshot?.config??{});bo(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=et(s))}function oa(e,t){const n=De(e.configForm??e.configSnapshot?.config??{});wo(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=et(n))}async function Ct(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("cron.status",{});e.cronStatus=t}catch(t){e.cronError=String(t)}}async function pn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t=await e.client.request("cron.list",{includeDisabled:!0});e.cronJobs=Array.isArray(t.jobs)?t.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function cc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=Zt(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function dc(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=Zt(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function uc(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=cc(e.cronForm),n=dc(e.cronForm),s=e.cronForm.agentId.trim(),i={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!i.name)throw new Error("Name required.");await e.client.request("cron.add",i),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await pn(e),await Ct(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function pc(e,t,n){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.update",{id:t.id,patch:{enabled:n}}),await pn(e),await Ct(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function hc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await xo(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function fc(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await pn(e),await Ct(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function xo(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function oe(e,t){if(!(!e.client||!e.connected)&&!e.channelsLoading){e.channelsLoading=!0,e.channelsError=null;try{const n=await e.client.request("channels.status",{probe:t,timeoutMs:8e3});e.channelsSnapshot=n,e.channelsLastSuccess=Date.now()}catch(n){e.channelsError=String(n)}finally{e.channelsLoading=!1}}}async function gc(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.start",{force:t,timeoutMs:3e4});e.whatsappLoginMessage=n.message??null,e.whatsappLoginQrDataUrl=n.qrDataUrl??null,e.whatsappLoginConnected=null}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function vc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const t=await e.client.request("web.login.wait",{timeoutMs:12e4});e.whatsappLoginMessage=t.message??null,e.whatsappLoginConnected=t.connected??null,t.connected&&(e.whatsappLoginQrDataUrl=null)}catch(t){e.whatsappLoginMessage=String(t),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function mc(e){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp"}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}catch(t){e.whatsappLoginMessage=String(t)}finally{e.whatsappBusy=!1}}}async function hn(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const a=s;e.debugModels=Array.isArray(a?.models)?a?.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}async function yc(e){if(!(!e.client||!e.connected)){e.debugCallError=null,e.debugCallResult=null;try{const t=e.debugCallParams.trim()?JSON.parse(e.debugCallParams):{},n=await e.client.request(e.debugCallMethod.trim(),t);e.debugCallResult=JSON.stringify(n,null,2)}catch(t){e.debugCallError=String(t)}}}const bc=2e3,wc=new Set(["trace","debug","info","warn","error","fatal"]);function $c(e){if(typeof e!="string")return null;const t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;try{const n=JSON.parse(t);return!n||typeof n!="object"?null:n}catch{return null}}function xc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return wc.has(t)?t:null}function Ac(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof n?.date=="string"?n?.date:null,i=xc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=$c(a);let r=null;o&&(typeof o.subsystem=="string"?r=o.subsystem:typeof o.module=="string"&&(r=o.module)),!r&&a&&a.length<120&&(r=a);let l=null;return typeof t[1]=="string"?l=t[1]:!o&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:s,level:i,subsystem:r,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Fs(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!t?.quiet)){t?.quiet||(e.logsLoading=!0),e.logsError=null;try{const s=await e.client.request("logs.tail",{cursor:t?.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),a=(Array.isArray(s.lines)?s.lines.filter(r=>typeof r=="string"):[]).map(Ac),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-bc),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t?.quiet||(e.logsLoading=!1)}}}const Ao={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:q,n:qt,Gx:ra,Gy:la,a:jn,d:Wn,h:kc}=Ao,Be=32,Us=64,Sc=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},H=(e="")=>{const t=new Error(e);throw Sc(t,H),t},_c=e=>typeof e=="bigint",Tc=e=>typeof e=="string",Cc=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",_e=(e,t,n="")=>{const s=Cc(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,r=a?` of length ${t}`:"",l=s?`length=${i}`:`type=${typeof e}`;H(o+"expected Uint8Array"+r+", got "+l)}return e},fn=e=>new Uint8Array(e),ko=e=>Uint8Array.from(e),So=(e,t)=>e.toString(16).padStart(t,"0"),_o=e=>Array.from(_e(e)).map(t=>So(t,2)).join(""),me={_0:48,_9:57,A:65,F:70,a:97,f:102},ca=e=>{if(e>=me._0&&e<=me._9)return e-me._0;if(e>=me.A&&e<=me.F)return e-(me.A-10);if(e>=me.a&&e<=me.f)return e-(me.a-10)},To=e=>{const t="hex invalid";if(!Tc(e))return H(t);const n=e.length,s=n/2;if(n%2)return H(t);const i=fn(s);for(let a=0,o=0;a<s;a++,o+=2){const r=ca(e.charCodeAt(o)),l=ca(e.charCodeAt(o+1));if(r===void 0||l===void 0)return H(t);i[a]=r*16+l}return i},Co=()=>globalThis?.crypto,Ec=()=>Co()?.subtle??H("crypto.subtle must be defined, consider polyfill"),_t=(...e)=>{const t=fn(e.reduce((s,i)=>s+_e(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},Mc=(e=Be)=>Co().getRandomValues(fn(e)),Xt=BigInt,Re=(e,t,n,s="bad number: out of range")=>_c(e)&&t<=e&&e<n?e:H(s),k=(e,t=q)=>{const n=e%t;return n>=0n?n:t+n},Eo=e=>k(e,qt),Ic=(e,t)=>{(e===0n||t<=0n)&&H("no inverse n="+e+" mod="+t);let n=k(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,r=s%n,l=i-a*o;s=n,n=r,i=a,a=l}return s===1n?k(i,t):H("no inverse")},Lc=e=>{const t=Ro[e];return typeof t!="function"&&H("hashes."+e+" not set"),t},Vn=e=>e instanceof ee?e:H("Point expected"),hs=2n**256n;class ee{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=hs;this.X=Re(t,0n,a),this.Y=Re(n,0n,a),this.Z=Re(s,1n,a),this.T=Re(i,0n,a),Object.freeze(this)}static CURVE(){return Ao}static fromAffine(t){return new ee(t.x,t.y,1n,k(t.x*t.y))}static fromBytes(t,n=!1){const s=Wn,i=ko(_e(t,Be)),a=t[31];i[31]=a&-129;const o=Io(i);Re(o,0n,n?hs:q);const l=k(o*o),p=k(l-1n),d=k(s*l+1n);let{isValid:u,value:g}=Pc(p,d);u||H("bad point: y not sqrt");const v=(g&1n)===1n,y=(a&128)!==0;return!n&&g===0n&&y&&H("bad point: x==0, isLastByteOdd"),y!==v&&(g=k(-g)),new ee(g,o,1n,k(g*o))}static fromHex(t,n){return ee.fromBytes(To(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=jn,n=Wn,s=this;if(s.is0())return H("bad point: ZERO");const{X:i,Y:a,Z:o,T:r}=s,l=k(i*i),p=k(a*a),d=k(o*o),u=k(d*d),g=k(l*t),v=k(d*k(g+p)),y=k(u+k(n*k(l*p)));if(v!==y)return H("bad point: equation left != right (1)");const $=k(i*a),A=k(o*r);return $!==A?H("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:r}=Vn(t),l=k(n*r),p=k(a*i),d=k(s*r),u=k(o*i);return l===p&&d===u}is0(){return this.equals(Ze)}negate(){return new ee(k(-this.X),this.Y,this.Z,k(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=jn,a=k(t*t),o=k(n*n),r=k(2n*k(s*s)),l=k(i*a),p=t+n,d=k(k(p*p)-a-o),u=l+o,g=u-r,v=l-o,y=k(d*g),$=k(u*v),A=k(d*v),_=k(g*u);return new ee(y,$,_,A)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:r,Z:l,T:p}=Vn(t),d=jn,u=Wn,g=k(n*o),v=k(s*r),y=k(a*u*p),$=k(i*l),A=k((n+s)*(o+r)-g-v),_=k($-y),I=k($+y),P=k(v-d*g),M=k(A*_),C=k(I*P),E=k(A*P),he=k(_*I);return new ee(M,C,he,E)}subtract(t){return this.add(Vn(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Ze;if(Re(t,1n,qt),t===1n)return this;if(this.equals(Fe))return Wc(t).p;let s=Ze,i=Fe;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?s=s.add(a):n&&(i=i.add(a));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(Ze))return{x:0n,y:1n};const i=Ic(s,q);k(s*i)!==1n&&H("invalid inverse");const a=k(t*i),o=k(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Mo(n);return s[31]|=t&1n?128:0,s}toHex(){return _o(this.toBytes())}clearCofactor(){return this.multiply(Xt(kc),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(qt/2n,!1).double();return qt%2n&&(t=t.add(this)),t.is0()}}const Fe=new ee(ra,la,1n,k(ra*la)),Ze=new ee(0n,1n,1n,0n);ee.BASE=Fe;ee.ZERO=Ze;const Mo=e=>To(So(Re(e,0n,hs),Us)).reverse(),Io=e=>Xt("0x"+_o(ko(_e(e)).reverse())),ce=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=q;return n},Rc=e=>{const n=e*e%q*e%q,s=ce(n,2n)*n%q,i=ce(s,1n)*e%q,a=ce(i,5n)*i%q,o=ce(a,10n)*a%q,r=ce(o,20n)*o%q,l=ce(r,40n)*r%q,p=ce(l,80n)*l%q,d=ce(p,80n)*l%q,u=ce(d,10n)*a%q;return{pow_p_5_8:ce(u,2n)*e%q,b2:n}},da=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Pc=(e,t)=>{const n=k(t*t*t),s=k(n*n*t),i=Rc(e*s).pow_p_5_8;let a=k(e*n*i);const o=k(t*a*a),r=a,l=k(a*da),p=o===e,d=o===k(-e),u=o===k(-e*da);return p&&(a=r),(d||u)&&(a=l),(k(a)&1n)===1n&&(a=k(-a)),{isValid:p||d,value:a}},fs=e=>Eo(Io(e)),Ks=(...e)=>Ro.sha512Async(_t(...e)),Nc=(...e)=>Lc("sha512")(_t(...e)),Lo=e=>{const t=e.slice(0,Be);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(Be,Us),s=fs(t),i=Fe.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Hs=e=>Ks(_e(e,Be)).then(Lo),Oc=e=>Lo(Nc(_e(e,Be))),Dc=e=>Hs(e).then(t=>t.pointBytes),Bc=e=>Ks(e.hashable).then(e.finish),Fc=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=fs(t),o=Fe.multiply(a).toBytes();return{hashable:_t(o,s,n),finish:p=>{const d=Eo(a+fs(p)*i);return _e(_t(o,Mo(d)),Us)}}},Uc=async(e,t)=>{const n=_e(e),s=await Hs(t),i=await Ks(s.prefix,n);return Bc(Fc(s,i,n))},Ro={sha512Async:async e=>{const t=Ec(),n=_t(e);return fn(await t.digest("SHA-512",n.buffer))},sha512:void 0},Kc=(e=Mc(Be))=>e,Hc={getExtendedPublicKeyAsync:Hs,getExtendedPublicKey:Oc,randomSecretKey:Kc},Jt=8,zc=256,Po=Math.ceil(zc/Jt)+1,gs=2**(Jt-1),jc=()=>{const e=[];let t=Fe,n=t;for(let s=0;s<Po;s++){n=t,e.push(n);for(let i=1;i<gs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let ua;const pa=(e,t)=>{const n=t.negate();return e?n:t},Wc=e=>{const t=ua||(ua=jc());let n=Ze,s=Fe;const i=2**Jt,a=i,o=Xt(i-1),r=Xt(Jt);for(let l=0;l<Po;l++){let p=Number(e&o);e>>=r,p>gs&&(p-=a,e+=1n);const d=l*gs,u=d,g=d+Math.abs(p)-1,v=l%2!==0,y=p<0;p===0?s=s.add(pa(v,t[u])):n=n.add(pa(y,t[g]))}return e!==0n&&H("invalid wnaf"),{p:n,f:s}},qn="openclaw-device-identity-v1";function vs(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function No(e){const t=e.replaceAll("-","+").replaceAll("_","/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)i[a]=s.charCodeAt(a);return i}function Vc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Oo(e){const t=await crypto.subtle.digest("SHA-256",e);return Vc(new Uint8Array(t))}async function qc(){const e=Hc.randomSecretKey(),t=await Dc(e);return{deviceId:await Oo(t),publicKey:vs(t),privateKey:vs(e)}}async function zs(){try{const n=localStorage.getItem(qn);if(n){const s=JSON.parse(n);if(s?.version===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await Oo(No(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(qn,JSON.stringify(a)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await qc(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(qn,JSON.stringify(t)),e}async function Gc(e,t){const n=No(e),s=new TextEncoder().encode(t),i=await Uc(s,n);return vs(i)}const Do="openclaw.device.auth.v1";function js(e){return e.trim()}function Yc(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].sort()}function Ws(){try{const e=window.localStorage.getItem(Do);if(!e)return null;const t=JSON.parse(e);return!t||t.version!==1||!t.deviceId||typeof t.deviceId!="string"||!t.tokens||typeof t.tokens!="object"?null:t}catch{return null}}function Bo(e){try{window.localStorage.setItem(Do,JSON.stringify(e))}catch{}}function Qc(e){const t=Ws();if(!t||t.deviceId!==e.deviceId)return null;const n=js(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function Fo(e){const t=js(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Ws();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:Yc(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,Bo(n),i}function Uo(e){const t=Ws();if(!t||t.deviceId!==e.deviceId)return;const n=js(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],Bo(s)}async function Te(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t?.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n?.pending)?n.pending:[],paired:Array.isArray(n?.paired)?n.paired:[]}}catch(n){t?.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Zc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Te(e)}catch(n){e.devicesError=String(n)}}async function Xc(e,t){if(!(!e.client||!e.connected||!window.confirm("Reject this device pairing request?")))try{await e.client.request("device.pair.reject",{requestId:t}),await Te(e)}catch(s){e.devicesError=String(s)}}async function Jc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await zs(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&Fo({deviceId:s.deviceId,role:i,token:n.token,scopes:n.scopes??t.scopes??[]}),window.prompt("New device token (copy and store securely):",n.token)}await Te(e)}catch(n){e.devicesError=String(n)}}async function ed(e,t){if(!(!e.client||!e.connected||!window.confirm(`Revoke token for ${t.deviceId} (${t.role})?`)))try{await e.client.request("device.token.revoke",t);const s=await zs();t.deviceId===s.deviceId&&Uo({deviceId:s.deviceId,role:t.role}),await Te(e)}catch(s){e.devicesError=String(s)}}async function gn(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t?.quiet||(e.lastError=null);try{const n=await e.client.request("node.list",{});e.nodes=Array.isArray(n.nodes)?n.nodes:[]}catch(n){t?.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function td(e){if(!e||e.kind==="gateway")return{method:"exec.approvals.get",params:{}};const t=e.nodeId.trim();return t?{method:"exec.approvals.node.get",params:{nodeId:t}}:null}function nd(e,t){if(!e||e.kind==="gateway")return{method:"exec.approvals.set",params:t};const n=e.nodeId.trim();return n?{method:"exec.approvals.node.set",params:{...t,nodeId:n}}:null}async function Vs(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=td(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);sd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function sd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=De(t.file??{}))}async function id(e,t){if(!(!e.client||!e.connected)){e.execApprovalsSaving=!0,e.lastError=null;try{const n=e.execApprovalsSnapshot?.hash;if(!n){e.lastError="Exec approvals hash missing; reload and retry.";return}const s=e.execApprovalsForm??e.execApprovalsSnapshot?.file??{},i=nd(t,{file:s,baseHash:n});if(!i){e.lastError="Select a node before saving exec approvals.";return}await e.client.request(i.method,i.params),e.execApprovalsDirty=!1,await Vs(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function ad(e,t,n){const s=De(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});bo(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function od(e,t){const n=De(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});wo(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function qs(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function tt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function vn(e){return e instanceof Error?e.message:String(e)}async function Et(e,t){if(t?.clearMessages&&Object.keys(e.skillMessages).length>0&&(e.skillMessages={}),!(!e.client||!e.connected)&&!e.skillsLoading){e.skillsLoading=!0,e.skillsError=null;try{const n=await e.client.request("skills.status",{});n&&(e.skillsReport=n)}catch(n){e.skillsError=vn(n)}finally{e.skillsLoading=!1}}}function rd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function ld(e,t,n){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.update",{skillKey:t,enabled:n}),await Et(e),tt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=vn(s);e.skillsError=i,tt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function cd(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const n=e.skillEdits[t]??"";await e.client.request("skills.update",{skillKey:t,apiKey:n}),await Et(e),tt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=vn(n);e.skillsError=s,tt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function dd(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await Et(e),tt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=vn(i);e.skillsError=a,tt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}function ud(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Gs(e){return e==="system"?ud():e}const Ut=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,pd=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Kt=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},hd=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const a=i.documentElement,o=i,r=pd();if(!!o.startViewTransition&&!r){let p=.5,d=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")p=Ut(n.pointerClientX/window.innerWidth),d=Ut(n.pointerClientY/window.innerHeight);else if(n?.element){const u=n.element.getBoundingClientRect();u.width>0&&u.height>0&&typeof window<"u"&&(p=Ut((u.left+u.width/2)/window.innerWidth),d=Ut((u.top+u.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${p*100}%`),a.style.setProperty("--theme-switch-y",`${d*100}%`),a.classList.add("theme-transition");try{const u=o.startViewTransition?.(()=>{t()});u?.finished?u.finished.finally(()=>Kt(a)):Kt(a)}catch{Kt(a),t()}return}t(),Kt(a)};function fd(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{gn(e,{quiet:!0})},5e3))}function gd(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Ys(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Fs(e,{quiet:!0})},2e3))}function Qs(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Zs(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&hn(e)},3e3))}function Xs(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Se(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,xl(n),t.theme!==e.theme&&(e.theme=t.theme,mn(e,Gs(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Ko(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Se(e,{...e.settings,lastActiveSessionKey:n})}function vd(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),a=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&Se(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(s!=null){const l=s.trim();l&&(e.password=l),t.delete("password"),o=!0}if(i!=null){const l=i.trim();l&&(e.sessionKey=l,Se(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(a!=null){const l=a.trim();l&&l!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=l),t.delete("gatewayUrl"),o=!0}if(!o)return;const r=new URL(window.location.href);r.search=t.toString(),window.history.replaceState({},"",r.toString())}function md(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ys(e):Qs(e),t==="debug"?Zs(e):Xs(e),Js(e),zo(e,t,!1)}function yd(e,t,n){hd({nextTheme:t,applyTheme:()=>{e.theme=t,Se(e,{...e.settings,theme:t}),mn(e,Gs(t))},context:n,currentTheme:e.theme})}async function Js(e){e.tab==="overview"&&await jo(e),e.tab==="channels"&&await _d(e),e.tab==="instances"&&await qs(e),e.tab==="sessions"&&await Ke(e),e.tab==="cron"&&await ei(e),e.tab==="skills"&&await Et(e),e.tab==="nodes"&&(await gn(e),await Te(e),await be(e),await Vs(e)),e.tab==="chat"&&(await Yo(e),un(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await $o(e),await be(e)),e.tab==="debug"&&(await hn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Fs(e,{reset:!0}),yo(e,!0))}function bd(){if(typeof window>"u")return"";const e=window.__OPENCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?cn(e):kl(window.location.pathname)}function wd(e){e.theme=e.settings.theme??"system",mn(e,Gs(e.theme))}function mn(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function $d(e){if(typeof window>"u"||typeof window.matchMedia!="function")return;if(e.themeMedia=window.matchMedia("(prefers-color-scheme: dark)"),e.themeMediaHandler=n=>{e.theme==="system"&&mn(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function xd(e){if(!e.themeMedia||!e.themeMediaHandler)return;if(typeof e.themeMedia.removeEventListener=="function"){e.themeMedia.removeEventListener("change",e.themeMediaHandler);return}e.themeMedia.removeListener(e.themeMediaHandler),e.themeMedia=null,e.themeMediaHandler=null}function Ad(e,t){if(typeof window>"u")return;const n=fo(window.location.pathname,e.basePath)??"chat";Ho(e,n),zo(e,n,t)}function kd(e){if(typeof window>"u")return;const t=fo(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,Se(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Ho(e,t)}function Ho(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ys(e):Qs(e),t==="debug"?Zs(e):Xs(e),e.connected&&Js(e)}function zo(e,t,n){if(typeof window>"u")return;const s=At(Ds(t,e.basePath)),i=At(window.location.pathname),a=new URL(window.location.href);t==="chat"&&e.sessionKey?a.searchParams.set("session",e.sessionKey):a.searchParams.delete("session"),i!==s&&(a.pathname=s),n?window.history.replaceState({},"",a.toString()):window.history.pushState({},"",a.toString())}function Sd(e,t,n){if(typeof window>"u")return;const s=new URL(window.location.href);s.searchParams.set("session",t),window.history.replaceState({},"",s.toString())}async function jo(e){await Promise.all([oe(e,!1),qs(e),Ke(e),Ct(e),hn(e)])}async function _d(e){await Promise.all([oe(e,!0),$o(e),be(e)])}async function ei(e){await Promise.all([oe(e,!1),Ct(e),pn(e)])}function Wo(e){return e.chatSending||!!e.chatRunId}function Td(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/stop"?!0:n==="stop"||n==="esc"||n==="abort"||n==="wait"||n==="exit"}function Cd(e){const t=e.trim();if(!t)return!1;const n=t.toLowerCase();return n==="/new"||n==="/reset"?!0:n.startsWith("/new ")||n.startsWith("/reset ")}async function Vo(e){e.connected&&(e.chatMessage="",await Ul(e))}function Ed(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Bs(),text:s,createdAt:Date.now(),attachments:i?n?.map(a=>({...a})):void 0}])}async function qo(e,t,n){dn(e);const s=await Fl(e,t,n?.attachments);return!s&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!s&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),s&&Ko(e,e.sessionKey),s&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),s&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),un(e),s&&!e.chatRunId&&Go(e),s&&n?.refreshSessions&&(e.refreshSessionsAfterChat=!0),s}async function Go(e){if(!e.connected||Wo(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await qo(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Md(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Id(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],r=o.length>0;if(!i&&!r)return;if(Td(i)){await Vo(e);return}const l=Cd(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Wo(e)){Ed(e,i,o);return}await qo(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:r?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:l})}async function Yo(e){await Promise.all([St(e),Ke(e,{activeMinutes:0}),ms(e)]),un(e,!0)}const Ld=Go;function Rd(e){const t=uo(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Pd(e,t){const n=cn(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function ms(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Rd(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Pd(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),a=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=a||null}catch{e.chatAvatarUrl=null}}const{I:Nd}=ul,ha=e=>e,Od=e=>e.strings===void 0,fa=()=>document.createComment(""),rt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(fa(),i),o=s.insertBefore(fa(),i);n=new Nd(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,r=o!==e;if(r){let l;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(l=e._$AU)!==o._$AU&&n._$AP(l)}if(a!==i||r){let l=n._$AA;for(;l!==a;){const p=ha(l).nextSibling;ha(s).insertBefore(l,i),l=p}}}return n},Ie=(e,t,n=e)=>(e._$AI(t,n),e),Dd={},Bd=(e,t=Dd)=>e._$AH=t,Fd=e=>e._$AH,Gn=e=>{e._$AR(),e._$AA.remove()};const ti={CHILD:2},ni=e=>(...t)=>({_$litDirective$:e,values:t});class si{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}}const yt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),yt(s,t);return!0},en=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},Qo=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Hd(t)}};function Ud(e){this._$AN!==void 0?(en(this),this._$AM=e,Qo(this)):this._$AM=e}function Kd(e,t=!1,n=0){const s=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(s))for(let a=n;a<s.length;a++)yt(s[a],!1),en(s[a]);else s!=null&&(yt(s,!1),en(s));else yt(this,e)}const Hd=e=>{e.type==ti.CHILD&&(e._$AP??=Kd,e._$AQ??=Ud)};class zd extends si{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),Qo(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(yt(this,t),en(this))}setValue(t){if(Od(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const Yn=new WeakMap,jd=ni(class extends zd{render(e){return f}update(e,[t]){const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),f}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Yn.get(t);n===void 0&&(n=new WeakMap,Yn.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return typeof this.G=="function"?Yn.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});const ga=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Zo=ni(class extends si{constructor(e){if(super(e),e.type!==ti.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],a=[];let o=0;for(const r of e)i[o]=s?s(r,o):o,a[o]=n(r,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Fd(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const r=this.ut??=[],l=[];let p,d,u=0,g=i.length-1,v=0,y=a.length-1;for(;u<=g&&v<=y;)if(i[u]===null)u++;else if(i[g]===null)g--;else if(r[u]===o[v])l[v]=Ie(i[u],a[v]),u++,v++;else if(r[g]===o[y])l[y]=Ie(i[g],a[y]),g--,y--;else if(r[u]===o[y])l[y]=Ie(i[u],a[y]),rt(e,l[y+1],i[u]),u++,y--;else if(r[g]===o[v])l[v]=Ie(i[g],a[v]),rt(e,i[u],i[g]),g--,v++;else if(p===void 0&&(p=ga(o,v,y),d=ga(r,u,g)),p.has(r[u]))if(p.has(r[g])){const $=d.get(o[v]),A=$!==void 0?i[$]:null;if(A===null){const _=rt(e,i[u]);Ie(_,a[v]),l[v]=_}else l[v]=Ie(A,a[v]),rt(e,i[u],A),i[$]=null;v++}else Gn(i[g]),g--;else Gn(i[u]),u++;for(;v<=y;){const $=rt(e,l[y+1]);Ie($,a[v]),l[v++]=$}for(;u<=g;){const $=i[u++];$!==null&&Gn($)}return this.ut=o,Bd(e,l),ke}});function Xo(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const s=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",i=t.content,a=Array.isArray(i)?i:null,o=Array.isArray(a)&&a.some(u=>{const v=String(u.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),r=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||r)&&(n="toolResult");let l=[];typeof t.content=="string"?l=[{type:"text",text:t.content}]:Array.isArray(t.content)?l=t.content.map(u=>({type:u.type||"text",text:u.text,name:u.name,args:u.args||u.arguments})):typeof t.text=="string"&&(l=[{type:"text",text:t.text}]);const p=typeof t.timestamp=="number"?t.timestamp:Date.now(),d=typeof t.id=="string"?t.id:void 0;return{role:n,content:l,timestamp:p,id:d}}function ii(e){const t=e.toLowerCase();return e==="user"||e==="User"?e:e==="assistant"?"assistant":e==="system"?"system":t==="toolresult"||t==="tool_result"||t==="tool"||t==="function"?"tool":e}function Jo(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}class ys extends si{constructor(t){if(super(t),this.it=f,t.type!==ti.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===f||t==null)return this._t=void 0,this.it=t;if(t===ke)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}ys.directiveName="unsafeHTML",ys.resultType=1;const bs=ni(ys);const{entries:er,setPrototypeOf:va,isFrozen:Wd,getPrototypeOf:Vd,getOwnPropertyDescriptor:qd}=Object;let{freeze:Z,seal:ne,create:ws}=Object,{apply:$s,construct:xs}=typeof Reflect<"u"&&Reflect;Z||(Z=function(t){return t});ne||(ne=function(t){return t});$s||($s=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];return t.apply(n,i)});xs||(xs=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Ht=X(Array.prototype.forEach),Gd=X(Array.prototype.lastIndexOf),ma=X(Array.prototype.pop),lt=X(Array.prototype.push),Yd=X(Array.prototype.splice),Gt=X(String.prototype.toLowerCase),Qn=X(String.prototype.toString),Zn=X(String.prototype.match),ct=X(String.prototype.replace),Qd=X(String.prototype.indexOf),Zd=X(String.prototype.trim),se=X(Object.prototype.hasOwnProperty),Y=X(RegExp.prototype.test),dt=Xd(TypeError);function X(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return $s(e,t,s)}}function Xd(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return xs(e,n)}}function L(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Gt;va&&va(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(Wd(t)||(t[s]=a),i=a)}e[i]=!0}return e}function Jd(e){for(let t=0;t<e.length;t++)se(e,t)||(e[t]=null);return e}function de(e){const t=ws(null);for(const[n,s]of er(e))se(e,n)&&(Array.isArray(s)?t[n]=Jd(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=de(s):t[n]=s);return t}function ut(e,t){for(;e!==null;){const s=qd(e,t);if(s){if(s.get)return X(s.get);if(typeof s.value=="function")return X(s.value)}e=Vd(e)}function n(){return null}return n}const ya=Z(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Xn=Z(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Jn=Z(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),eu=Z(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),es=Z(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),tu=Z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ba=Z(["#text"]),wa=Z(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ts=Z(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$a=Z(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),zt=Z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),nu=ne(/\{\{[\w\W]*|[\w\W]*\}\}/gm),su=ne(/<%[\w\W]*|[\w\W]*%>/gm),iu=ne(/\$\{[\w\W]*/gm),au=ne(/^data-[\-\w.\u00B7-\uFFFF]+$/),ou=ne(/^aria-[\-\w]+$/),tr=ne(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ru=ne(/^(?:\w+script|data):/i),lu=ne(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nr=ne(/^html$/i),cu=ne(/^[a-z][.\w]*(-[.\w]+)+$/i);var xa=Object.freeze({__proto__:null,ARIA_ATTR:ou,ATTR_WHITESPACE:lu,CUSTOM_ELEMENT:cu,DATA_ATTR:au,DOCTYPE_NAME:nr,ERB_EXPR:su,IS_ALLOWED_URI:tr,IS_SCRIPT_OR_DATA:ru,MUSTACHE_EXPR:nu,TMPLIT_EXPR:iu});const pt={element:1,text:3,progressingInstruction:7,comment:8,document:9},du=function(){return typeof window>"u"?null:window},uu=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const a="dompurify"+(s?"#"+s:"");try{return t.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},Aa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function sr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:du();const t=T=>sr(T);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==pt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:r,Element:l,NodeFilter:p,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:g,trustedTypes:v}=e,y=l.prototype,$=ut(y,"cloneNode"),A=ut(y,"remove"),_=ut(y,"nextSibling"),I=ut(y,"childNodes"),P=ut(y,"parentNode");if(typeof o=="function"){const T=n.createElement("template");T.content&&T.content.ownerDocument&&(n=T.content.ownerDocument)}let M,C="";const{implementation:E,createNodeIterator:he,createDocumentFragment:xn,getElementsByTagName:An}=n,{importNode:Lr}=s;let G=Aa();t.isSupported=typeof er=="function"&&typeof P=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:kn,ERB_EXPR:Sn,TMPLIT_EXPR:_n,DATA_ATTR:Rr,ARIA_ATTR:Pr,IS_SCRIPT_OR_DATA:Nr,ATTR_WHITESPACE:vi,CUSTOM_ELEMENT:Or}=xa;let{IS_ALLOWED_URI:mi}=xa,K=null;const yi=L({},[...ya,...Xn,...Jn,...es,...ba]);let j=null;const bi=L({},[...wa,...ts,...$a,...zt]);let B=Object.seal(ws(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),st=null,Tn=null;const ze=Object.seal(ws(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let wi=!0,Cn=!0,$i=!1,xi=!0,je=!1,It=!0,Ce=!1,En=!1,Mn=!1,We=!1,Lt=!1,Rt=!1,Ai=!0,ki=!1;const Dr="user-content-";let In=!0,it=!1,Ve={},re=null;const Ln=L({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Si=null;const _i=L({},["audio","video","img","source","image","track"]);let Rn=null;const Ti=L({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pt="http://www.w3.org/1998/Math/MathML",Nt="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let qe=fe,Pn=!1,Nn=null;const Br=L({},[Pt,Nt,fe],Qn);let Ot=L({},["mi","mo","mn","ms","mtext"]),Dt=L({},["annotation-xml"]);const Fr=L({},["title","style","font","a","script"]);let at=null;const Ur=["application/xhtml+xml","text/html"],Kr="text/html";let U=null,Ge=null;const Hr=n.createElement("form"),Ci=function(h){return h instanceof RegExp||h instanceof Function},On=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ge&&Ge===h)){if((!h||typeof h!="object")&&(h={}),h=de(h),at=Ur.indexOf(h.PARSER_MEDIA_TYPE)===-1?Kr:h.PARSER_MEDIA_TYPE,U=at==="application/xhtml+xml"?Qn:Gt,K=se(h,"ALLOWED_TAGS")?L({},h.ALLOWED_TAGS,U):yi,j=se(h,"ALLOWED_ATTR")?L({},h.ALLOWED_ATTR,U):bi,Nn=se(h,"ALLOWED_NAMESPACES")?L({},h.ALLOWED_NAMESPACES,Qn):Br,Rn=se(h,"ADD_URI_SAFE_ATTR")?L(de(Ti),h.ADD_URI_SAFE_ATTR,U):Ti,Si=se(h,"ADD_DATA_URI_TAGS")?L(de(_i),h.ADD_DATA_URI_TAGS,U):_i,re=se(h,"FORBID_CONTENTS")?L({},h.FORBID_CONTENTS,U):Ln,st=se(h,"FORBID_TAGS")?L({},h.FORBID_TAGS,U):de({}),Tn=se(h,"FORBID_ATTR")?L({},h.FORBID_ATTR,U):de({}),Ve=se(h,"USE_PROFILES")?h.USE_PROFILES:!1,wi=h.ALLOW_ARIA_ATTR!==!1,Cn=h.ALLOW_DATA_ATTR!==!1,$i=h.ALLOW_UNKNOWN_PROTOCOLS||!1,xi=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=h.SAFE_FOR_TEMPLATES||!1,It=h.SAFE_FOR_XML!==!1,Ce=h.WHOLE_DOCUMENT||!1,We=h.RETURN_DOM||!1,Lt=h.RETURN_DOM_FRAGMENT||!1,Rt=h.RETURN_TRUSTED_TYPE||!1,Mn=h.FORCE_BODY||!1,Ai=h.SANITIZE_DOM!==!1,ki=h.SANITIZE_NAMED_PROPS||!1,In=h.KEEP_CONTENT!==!1,it=h.IN_PLACE||!1,mi=h.ALLOWED_URI_REGEXP||tr,qe=h.NAMESPACE||fe,Ot=h.MATHML_TEXT_INTEGRATION_POINTS||Ot,Dt=h.HTML_INTEGRATION_POINTS||Dt,B=h.CUSTOM_ELEMENT_HANDLING||{},h.CUSTOM_ELEMENT_HANDLING&&Ci(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&Ci(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(B.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),je&&(Cn=!1),Lt&&(We=!0),Ve&&(K=L({},ba),j=[],Ve.html===!0&&(L(K,ya),L(j,wa)),Ve.svg===!0&&(L(K,Xn),L(j,ts),L(j,zt)),Ve.svgFilters===!0&&(L(K,Jn),L(j,ts),L(j,zt)),Ve.mathMl===!0&&(L(K,es),L(j,$a),L(j,zt))),h.ADD_TAGS&&(typeof h.ADD_TAGS=="function"?ze.tagCheck=h.ADD_TAGS:(K===yi&&(K=de(K)),L(K,h.ADD_TAGS,U))),h.ADD_ATTR&&(typeof h.ADD_ATTR=="function"?ze.attributeCheck=h.ADD_ATTR:(j===bi&&(j=de(j)),L(j,h.ADD_ATTR,U))),h.ADD_URI_SAFE_ATTR&&L(Rn,h.ADD_URI_SAFE_ATTR,U),h.FORBID_CONTENTS&&(re===Ln&&(re=de(re)),L(re,h.FORBID_CONTENTS,U)),h.ADD_FORBID_CONTENTS&&(re===Ln&&(re=de(re)),L(re,h.ADD_FORBID_CONTENTS,U)),In&&(K["#text"]=!0),Ce&&L(K,["html","head","body"]),K.table&&(L(K,["tbody"]),delete st.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw dt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=h.TRUSTED_TYPES_POLICY,C=M.createHTML("")}else M===void 0&&(M=uu(v,i)),M!==null&&typeof C=="string"&&(C=M.createHTML(""));Z&&Z(h),Ge=h}},Ei=L({},[...Xn,...Jn,...eu]),Mi=L({},[...es,...tu]),zr=function(h){let x=P(h);(!x||!x.tagName)&&(x={namespaceURI:qe,tagName:"template"});const S=Gt(h.tagName),D=Gt(x.tagName);return Nn[h.namespaceURI]?h.namespaceURI===Nt?x.namespaceURI===fe?S==="svg":x.namespaceURI===Pt?S==="svg"&&(D==="annotation-xml"||Ot[D]):!!Ei[S]:h.namespaceURI===Pt?x.namespaceURI===fe?S==="math":x.namespaceURI===Nt?S==="math"&&Dt[D]:!!Mi[S]:h.namespaceURI===fe?x.namespaceURI===Nt&&!Dt[D]||x.namespaceURI===Pt&&!Ot[D]?!1:!Mi[S]&&(Fr[S]||!Ei[S]):!!(at==="application/xhtml+xml"&&Nn[h.namespaceURI]):!1},le=function(h){lt(t.removed,{element:h});try{P(h).removeChild(h)}catch{A(h)}},Ee=function(h,x){try{lt(t.removed,{attribute:x.getAttributeNode(h),from:x})}catch{lt(t.removed,{attribute:null,from:x})}if(x.removeAttribute(h),h==="is")if(We||Lt)try{le(x)}catch{}else try{x.setAttribute(h,"")}catch{}},Ii=function(h){let x=null,S=null;if(Mn)h="<remove></remove>"+h;else{const F=Zn(h,/^[\r\n\t ]+/);S=F&&F[0]}at==="application/xhtml+xml"&&qe===fe&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const D=M?M.createHTML(h):h;if(qe===fe)try{x=new g().parseFromString(D,at)}catch{}if(!x||!x.documentElement){x=E.createDocument(qe,"template",null);try{x.documentElement.innerHTML=Pn?C:D}catch{}}const V=x.body||x.documentElement;return h&&S&&V.insertBefore(n.createTextNode(S),V.childNodes[0]||null),qe===fe?An.call(x,Ce?"html":"body")[0]:Ce?x.documentElement:V},Li=function(h){return he.call(h.ownerDocument||h,h,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Dn=function(h){return h instanceof u&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof d)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},Ri=function(h){return typeof r=="function"&&h instanceof r};function ge(T,h,x){Ht(T,S=>{S.call(t,h,x,Ge)})}const Pi=function(h){let x=null;if(ge(G.beforeSanitizeElements,h,null),Dn(h))return le(h),!0;const S=U(h.nodeName);if(ge(G.uponSanitizeElement,h,{tagName:S,allowedTags:K}),It&&h.hasChildNodes()&&!Ri(h.firstElementChild)&&Y(/<[/\w!]/g,h.innerHTML)&&Y(/<[/\w!]/g,h.textContent)||h.nodeType===pt.progressingInstruction||It&&h.nodeType===pt.comment&&Y(/<[/\w]/g,h.data))return le(h),!0;if(!(ze.tagCheck instanceof Function&&ze.tagCheck(S))&&(!K[S]||st[S])){if(!st[S]&&Oi(S)&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,S)||B.tagNameCheck instanceof Function&&B.tagNameCheck(S)))return!1;if(In&&!re[S]){const D=P(h)||h.parentNode,V=I(h)||h.childNodes;if(V&&D){const F=V.length;for(let J=F-1;J>=0;--J){const ve=$(V[J],!0);ve.__removalCount=(h.__removalCount||0)+1,D.insertBefore(ve,_(h))}}}return le(h),!0}return h instanceof l&&!zr(h)||(S==="noscript"||S==="noembed"||S==="noframes")&&Y(/<\/no(script|embed|frames)/i,h.innerHTML)?(le(h),!0):(je&&h.nodeType===pt.text&&(x=h.textContent,Ht([kn,Sn,_n],D=>{x=ct(x,D," ")}),h.textContent!==x&&(lt(t.removed,{element:h.cloneNode()}),h.textContent=x)),ge(G.afterSanitizeElements,h,null),!1)},Ni=function(h,x,S){if(Ai&&(x==="id"||x==="name")&&(S in n||S in Hr))return!1;if(!(Cn&&!Tn[x]&&Y(Rr,x))){if(!(wi&&Y(Pr,x))){if(!(ze.attributeCheck instanceof Function&&ze.attributeCheck(x,h))){if(!j[x]||Tn[x]){if(!(Oi(h)&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,h)||B.tagNameCheck instanceof Function&&B.tagNameCheck(h))&&(B.attributeNameCheck instanceof RegExp&&Y(B.attributeNameCheck,x)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(x,h))||x==="is"&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&Y(B.tagNameCheck,S)||B.tagNameCheck instanceof Function&&B.tagNameCheck(S))))return!1}else if(!Rn[x]){if(!Y(mi,ct(S,vi,""))){if(!((x==="src"||x==="xlink:href"||x==="href")&&h!=="script"&&Qd(S,"data:")===0&&Si[h])){if(!($i&&!Y(Nr,ct(S,vi,"")))){if(S)return!1}}}}}}}return!0},Oi=function(h){return h!=="annotation-xml"&&Zn(h,Or)},Di=function(h){ge(G.beforeSanitizeAttributes,h,null);const{attributes:x}=h;if(!x||Dn(h))return;const S={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let D=x.length;for(;D--;){const V=x[D],{name:F,namespaceURI:J,value:ve}=V,Ye=U(F),Bn=ve;let W=F==="value"?Bn:Zd(Bn);if(S.attrName=Ye,S.attrValue=W,S.keepAttr=!0,S.forceKeepAttr=void 0,ge(G.uponSanitizeAttribute,h,S),W=S.attrValue,ki&&(Ye==="id"||Ye==="name")&&(Ee(F,h),W=Dr+W),It&&Y(/((--!?|])>)|<\/(style|title|textarea)/i,W)){Ee(F,h);continue}if(Ye==="attributename"&&Zn(W,"href")){Ee(F,h);continue}if(S.forceKeepAttr)continue;if(!S.keepAttr){Ee(F,h);continue}if(!xi&&Y(/\/>/i,W)){Ee(F,h);continue}je&&Ht([kn,Sn,_n],Fi=>{W=ct(W,Fi," ")});const Bi=U(h.nodeName);if(!Ni(Bi,Ye,W)){Ee(F,h);continue}if(M&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!J)switch(v.getAttributeType(Bi,Ye)){case"TrustedHTML":{W=M.createHTML(W);break}case"TrustedScriptURL":{W=M.createScriptURL(W);break}}if(W!==Bn)try{J?h.setAttributeNS(J,F,W):h.setAttribute(F,W),Dn(h)?le(h):ma(t.removed)}catch{Ee(F,h)}}ge(G.afterSanitizeAttributes,h,null)},jr=function T(h){let x=null;const S=Li(h);for(ge(G.beforeSanitizeShadowDOM,h,null);x=S.nextNode();)ge(G.uponSanitizeShadowNode,x,null),Pi(x),Di(x),x.content instanceof a&&T(x.content);ge(G.afterSanitizeShadowDOM,h,null)};return t.sanitize=function(T){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,S=null,D=null,V=null;if(Pn=!T,Pn&&(T="<!-->"),typeof T!="string"&&!Ri(T))if(typeof T.toString=="function"){if(T=T.toString(),typeof T!="string")throw dt("dirty is not a string, aborting")}else throw dt("toString is not a function");if(!t.isSupported)return T;if(En||On(h),t.removed=[],typeof T=="string"&&(it=!1),it){if(T.nodeName){const ve=U(T.nodeName);if(!K[ve]||st[ve])throw dt("root node is forbidden and cannot be sanitized in-place")}}else if(T instanceof r)x=Ii("<!---->"),S=x.ownerDocument.importNode(T,!0),S.nodeType===pt.element&&S.nodeName==="BODY"||S.nodeName==="HTML"?x=S:x.appendChild(S);else{if(!We&&!je&&!Ce&&T.indexOf("<")===-1)return M&&Rt?M.createHTML(T):T;if(x=Ii(T),!x)return We?null:Rt?C:""}x&&Mn&&le(x.firstChild);const F=Li(it?T:x);for(;D=F.nextNode();)Pi(D),Di(D),D.content instanceof a&&jr(D.content);if(it)return T;if(We){if(Lt)for(V=xn.call(x.ownerDocument);x.firstChild;)V.appendChild(x.firstChild);else V=x;return(j.shadowroot||j.shadowrootmode)&&(V=Lr.call(s,V,!0)),V}let J=Ce?x.outerHTML:x.innerHTML;return Ce&&K["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&Y(nr,x.ownerDocument.doctype.name)&&(J="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
17
|
+
`+J),je&&Ht([kn,Sn,_n],ve=>{J=ct(J,ve," ")}),M&&Rt?M.createHTML(J):J},t.setConfig=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};On(T),En=!0},t.clearConfig=function(){Ge=null,En=!1},t.isValidAttribute=function(T,h,x){Ge||On({});const S=U(T),D=U(h);return Ni(S,D,x)},t.addHook=function(T,h){typeof h=="function"&<(G[T],h)},t.removeHook=function(T,h){if(h!==void 0){const x=Gd(G[T],h);return x===-1?void 0:Yd(G[T],x,1)[0]}return ma(G[T])},t.removeHooks=function(T){G[T]=[]},t.removeAllHooks=function(){G=Aa()},t}var As=sr();function ai(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var He=ai();function ir(e){He=e}var bt={exec:()=>null};function R(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(Q.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var pu=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Q={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},hu=/^(?:[ \t]*(?:\n|$))+/,fu=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Mt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,vu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,oi=/(?:[*+-]|\d{1,9}[.)])/,ar=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,or=R(ar).replace(/bull/g,oi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),mu=R(ar).replace(/bull/g,oi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ri=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,yu=/^[^\n]+/,li=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,bu=R(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",li).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),wu=R(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,oi).getRegex(),yn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ci=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$u=R("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ci).replace("tag",yn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rr=R(ri).replace("hr",Mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",yn).getRegex(),xu=R(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",rr).getRegex(),di={blockquote:xu,code:fu,def:bu,fences:gu,heading:vu,hr:Mt,html:$u,lheading:or,list:wu,newline:hu,paragraph:rr,table:bt,text:yu},ka=R("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",yn).getRegex(),Au={...di,lheading:mu,table:ka,paragraph:R(ri).replace("hr",Mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ka).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",yn).getRegex()},ku={...di,html:R(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ci).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:bt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:R(ri).replace("hr",Mt).replace("heading",` *#{1,6} *[^
|
|
18
|
+
]`).replace("lheading",or).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Su=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_u=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,lr=/^( {2,}|\\)\n(?!\s*$)/,Tu=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bn=/[\p{P}\p{S}]/u,ui=/[\s\p{P}\p{S}]/u,cr=/[^\s\p{P}\p{S}]/u,Cu=R(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ui).getRegex(),dr=/(?!~)[\p{P}\p{S}]/u,Eu=/(?!~)[\s\p{P}\p{S}]/u,Mu=/(?:[^\s\p{P}\p{S}]|~)/u,Iu=R(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",pu?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ur=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Lu=R(ur,"u").replace(/punct/g,bn).getRegex(),Ru=R(ur,"u").replace(/punct/g,dr).getRegex(),pr="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Pu=R(pr,"gu").replace(/notPunctSpace/g,cr).replace(/punctSpace/g,ui).replace(/punct/g,bn).getRegex(),Nu=R(pr,"gu").replace(/notPunctSpace/g,Mu).replace(/punctSpace/g,Eu).replace(/punct/g,dr).getRegex(),Ou=R("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,cr).replace(/punctSpace/g,ui).replace(/punct/g,bn).getRegex(),Du=R(/\\(punct)/,"gu").replace(/punct/g,bn).getRegex(),Bu=R(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Fu=R(ci).replace("(?:-->|$)","-->").getRegex(),Uu=R("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Fu).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Ku=R(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",tn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),hr=R(/^!?\[(label)\]\[(ref)\]/).replace("label",tn).replace("ref",li).getRegex(),fr=R(/^!?\[(ref)\](?:\[\])?/).replace("ref",li).getRegex(),Hu=R("reflink|nolink(?!\\()","g").replace("reflink",hr).replace("nolink",fr).getRegex(),Sa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,pi={_backpedal:bt,anyPunctuation:Du,autolink:Bu,blockSkip:Iu,br:lr,code:_u,del:bt,emStrongLDelim:Lu,emStrongRDelimAst:Pu,emStrongRDelimUnd:Ou,escape:Su,link:Ku,nolink:fr,punctuation:Cu,reflink:hr,reflinkSearch:Hu,tag:Uu,text:Tu,url:bt},zu={...pi,link:R(/^!?\[(label)\]\((.*?)\)/).replace("label",tn).getRegex(),reflink:R(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",tn).getRegex()},ks={...pi,emStrongRDelimAst:Nu,emStrongLDelim:Ru,url:R(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Sa).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:R(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Sa).getRegex()},ju={...ks,br:R(lr).replace("{2,}","*").getRegex(),text:R(ks.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},jt={normal:di,gfm:Au,pedantic:ku},ht={normal:pi,gfm:ks,breaks:ju,pedantic:zu},Wu={"&":"&","<":"<",">":">",'"':""","'":"'"},_a=e=>Wu[e];function ye(e,t){if(t){if(Q.escapeTest.test(e))return e.replace(Q.escapeReplace,_a)}else if(Q.escapeTestNoEncode.test(e))return e.replace(Q.escapeReplaceNoEncode,_a);return e}function Ta(e){try{e=encodeURI(e).replace(Q.percentDecode,"%")}catch{return null}return e}function Ca(e,t){let n=e.replace(Q.findPipe,(a,o,r)=>{let l=!1,p=o;for(;--p>=0&&r[p]==="\\";)l=!l;return l?"|":" |"}),s=n.split(Q.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(Q.slashPipe,"|");return s}function ft(e,t,n){let s=e.length;if(s===0)return"";let i=0;for(;i<s&&e.charAt(s-i-1)===t;)i++;return e.slice(0,s-i)}function Vu(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function Ea(e,t,n,s,i){let a=t.href,o=t.title||null,r=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:r,tokens:s.inlineTokens(r)};return s.state.inLink=!1,l}function qu(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
|
|
19
19
|
`).map(a=>{let o=a.match(n.other.beginningSpace);if(o===null)return a;let[r]=o;return r.length>=i.length?a.slice(i.length):a}).join(`
|
|
20
20
|
`)}var nn=class{options;rules;lexer;constructor(e){this.options=e||He}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:ft(n,`
|
|
21
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=
|
|
21
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=qu(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=ft(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ft(t[0],`
|
|
22
22
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=ft(t[0],`
|
|
23
23
|
`).split(`
|
|
24
24
|
`),s="",i="",a=[];for(;n.length>0;){let o=!1,r=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))r.push(n[l]),o=!0;else if(!o)r.push(n[l]);else break;n=n.slice(l);let p=r.join(`
|
|
@@ -33,13 +33,13 @@ ${d}`:d;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
33
33
|
`);continue}}return{type:"blockquote",raw:s,tokens:a,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let l=!1,p="",d="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let u=t[2].split(`
|
|
34
34
|
`,1)[0].replace(this.rules.other.listReplaceTabs,$=>" ".repeat(3*$.length)),g=e.split(`
|
|
35
35
|
`,1)[0],v=!u.trim(),y=0;if(this.options.pedantic?(y=2,d=u.trimStart()):v?y=t[1].length+1:(y=t[2].search(this.rules.other.nonSpaceChar),y=y>4?1:y,d=u.slice(y),y+=t[1].length),v&&this.rules.other.blankLine.test(g)&&(p+=g+`
|
|
36
|
-
`,e=e.substring(g.length+1),l=!0),!l){let $=this.rules.other.nextBulletRegex(y),A=this.rules.other.hrRegex(y),_=this.rules.other.fencesBeginRegex(y),
|
|
37
|
-
`,1)[0],
|
|
38
|
-
`+
|
|
36
|
+
`,e=e.substring(g.length+1),l=!0),!l){let $=this.rules.other.nextBulletRegex(y),A=this.rules.other.hrRegex(y),_=this.rules.other.fencesBeginRegex(y),I=this.rules.other.headingBeginRegex(y),P=this.rules.other.htmlBeginRegex(y);for(;e;){let M=e.split(`
|
|
37
|
+
`,1)[0],C;if(g=M,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),C=g):C=g.replace(this.rules.other.tabCharGlobal," "),_.test(g)||I.test(g)||P.test(g)||$.test(g)||A.test(g))break;if(C.search(this.rules.other.nonSpaceChar)>=y||!g.trim())d+=`
|
|
38
|
+
`+C.slice(y);else{if(v||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(u)||I.test(u)||A.test(u))break;d+=`
|
|
39
39
|
`+g}!v&&!g.trim()&&(v=!0),p+=M+`
|
|
40
|
-
`,e=e.substring(M.length+1),u=
|
|
41
|
-
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(
|
|
42
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=ft(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=
|
|
40
|
+
`,e=e.substring(M.length+1),u=C.slice(y)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(o=!0)),i.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),i.raw+=p}let r=i.items.at(-1);if(r)r.raw=r.raw.trimEnd(),r.text=r.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l of i.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=d.checked,i.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=d.raw+l.tokens[0].raw,l.tokens[0].text=d.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(d)):l.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):l.tokens.unshift(d)}}if(!i.loose){let p=l.tokens.filter(u=>u.type==="space"),d=p.length>0&&p.some(u=>this.rules.other.anyLine.test(u.raw));i.loose=d}}if(i.loose)for(let l of i.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ca(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
41
|
+
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let o of s)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<n.length;o++)a.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(Ca(o,a.header.length).map((r,l)=>({text:r,tokens:this.lexer.inline(r),header:!1,align:a.align[l]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
42
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=ft(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=Vu(t[2],"()");if(a===-2)return;if(a>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],i=a[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Ea(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[s.toLowerCase()];if(!i){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Ea(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let i=[...s[0]].length-1,a,o,r=i,l=0,p=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+i);(s=p.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){r+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(r-=o,r>0)continue;o=Math.min(o,o+r+l);let d=[...s[0]][0].length,u=e.slice(0,i+s.index+d+o);if(Math.min(i,o)%2){let v=u.slice(1,-1);return{type:"em",raw:u,text:v,tokens:this.lexer.inlineTokens(v)}}let g=u.slice(2,-2);return{type:"strong",raw:u,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},ie=class Ss{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||He,this.options.tokenizer=this.options.tokenizer||new nn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Q,block:jt.normal,inline:ht.normal};this.options.pedantic?(n.block=jt.pedantic,n.inline=ht.pedantic):this.options.gfm&&(n.block=jt.gfm,this.options.breaks?n.inline=ht.breaks:n.inline=ht.gfm),this.tokenizer.rules=n}static get rules(){return{block:jt,inline:ht}}static lex(t,n){return new Ss(n).lex(t)}static lexInline(t,n){return new Ss(n).inlineTokens(t)}lex(t){t=t.replace(Q.carriageReturn,`
|
|
43
43
|
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace(Q.tabCharGlobal," ").replace(Q.spaceLine,""));t;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
44
44
|
`:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
45
45
|
`)?"":`
|
|
@@ -54,8 +54,8 @@ ${d}`:d;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
54
54
|
`)?"":`
|
|
55
55
|
`)+i.raw,o.text+=`
|
|
56
56
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(t){let o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let s=t,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)a=i[2]?i[2].length:0,s=s.slice(0,i.index+a)+"["+"a".repeat(i[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let o=!1,r="";for(;t;){o||(r=""),o=!1;let l;if(this.options.extensions?.inline?.some(d=>(l=d.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let d=n.at(-1);l.type==="text"&&d?.type==="text"?(d.raw+=l.raw,d.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(t,s,r)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),n.push(l);continue}let p=t;if(this.options.extensions?.startInline){let d=1/0,u=t.slice(1),g;this.options.extensions.startInline.forEach(v=>{g=v.call({lexer:this},u),typeof g=="number"&&g>=0&&(d=Math.min(d,g))}),d<1/0&&d>=0&&(p=t.substring(0,d+1))}if(l=this.tokenizer.inlineText(p)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(r=l.raw.slice(-1)),o=!0;let d=n.at(-1);d?.type==="text"?(d.raw+=l.raw,d.text+=l.text):n.push(l);continue}if(t){let d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}},sn=class{options;parser;constructor(e){this.options=e||He}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(Q.notSpaceStart)?.[0],i=e.replace(Q.endingNewline,"")+`
|
|
57
|
-
`;return s?'<pre><code class="language-'+
|
|
58
|
-
`:"<pre><code>"+(n?i:
|
|
57
|
+
`;return s?'<pre><code class="language-'+ye(s)+'">'+(n?i:ye(i,!0))+`</code></pre>
|
|
58
|
+
`:"<pre><code>"+(n?i:ye(i,!0))+`</code></pre>
|
|
59
59
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
60
60
|
${this.parser.parse(e)}</blockquote>
|
|
61
61
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
@@ -71,25 +71,25 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
71
71
|
`}tablerow({text:e}){return`<tr>
|
|
72
72
|
${e}</tr>
|
|
73
73
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
74
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${
|
|
75
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+
|
|
74
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ye(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),i=Ta(e);if(i===null)return s;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+ye(t)+'"'),a+=">"+s+"</a>",a}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let i=Ta(e);if(i===null)return ye(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${ye(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ye(e.text)}},hi=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},ae=class _s{options;renderer;textRenderer;constructor(t){this.options=t||He,this.options.renderer=this.options.renderer||new sn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new hi}static parse(t,n){return new _s(n).parse(t)}static parseInline(t,n){return new _s(n).parseInline(t)}parse(t){let n="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let o=i,r=this.options.extensions.renderers[o.type].call({parser:this},o);if(r!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=r||"";continue}}let a=i;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,n=this.renderer){let s="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let r=this.options.extensions.renderers[a.type].call({parser:this},a);if(r!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=r||"";continue}}let o=a;switch(o.type){case"escape":{s+=n.text(o);break}case"html":{s+=n.html(o);break}case"link":{s+=n.link(o);break}case"image":{s+=n.image(o);break}case"checkbox":{s+=n.checkbox(o);break}case"strong":{s+=n.strong(o);break}case"em":{s+=n.em(o);break}case"codespan":{s+=n.codespan(o);break}case"br":{s+=n.br(o);break}case"del":{s+=n.del(o);break}case"text":{s+=n.text(o);break}default:{let r='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return s}},gt=class{options;block;constructor(e){this.options=e||He}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?ie.lex:ie.lexInline}provideParser(){return this.block?ae.parse:ae.parseInline}},Gu=class{defaults=ai();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ae;Renderer=sn;TextRenderer=hi;Lexer=ie;Tokenizer=nn;Hooks=gt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let i=s;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let o of a)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{let i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let o=i[a].flat(1/0);n=n.concat(this.walkTokens(o,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...o){let r=i.renderer.apply(this,o);return r===!1&&(r=a.apply(this,o)),r}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){let i=this.defaults.renderer||new sn(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let o=a,r=n.renderer[o],l=i[o];i[o]=(...p)=>{let d=r.apply(i,p);return d===!1&&(d=l.apply(i,p)),d||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new nn(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let o=a,r=n.tokenizer[o],l=i[o];i[o]=(...p)=>{let d=r.apply(i,p);return d===!1&&(d=l.apply(i,p)),d}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new gt;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let o=a,r=n.hooks[o],l=i[o];gt.passThroughHooks.has(a)?i[o]=p=>{if(this.defaults.async&>.passThroughHooksRespectAsync.has(a))return(async()=>{let u=await r.call(i,p);return l.call(i,u)})();let d=r.call(i,p);return l.call(i,d)}:i[o]=(...p)=>{if(this.defaults.async)return(async()=>{let u=await r.apply(i,p);return u===!1&&(u=await l.apply(i,p)),u})();let d=r.apply(i,p);return d===!1&&(d=l.apply(i,p)),d}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let r=[];return r.push(a.call(this,o)),i&&(r=r.concat(i.call(this,o))),r}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ie.lex(e,t??this.defaults)}parser(e,t){return ae.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},i={...this.defaults,...s},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?ie.lex:ie.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let p=await(i.hooks?await i.hooks.provideParser():e?ae.parse:ae.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(p):p})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?ie.lex:ie.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?ae.parse:ae.parseInline)(o,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
75
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+ye(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},Ue=new Gu;function N(e,t){return Ue.parse(e,t)}N.options=N.setOptions=function(e){return Ue.setOptions(e),N.defaults=Ue.defaults,ir(N.defaults),N};N.getDefaults=ai;N.defaults=He;N.use=function(...e){return Ue.use(...e),N.defaults=Ue.defaults,ir(N.defaults),N};N.walkTokens=function(e,t){return Ue.walkTokens(e,t)};N.parseInline=Ue.parseInline;N.Parser=ae;N.parser=ae.parse;N.Renderer=sn;N.TextRenderer=hi;N.Lexer=ie;N.lexer=ie.lex;N.Tokenizer=nn;N.Hooks=gt;N.parse=N;N.options;N.setOptions;N.use;N.walkTokens;N.parseInline;ae.parse;ie.lex;N.setOptions({gfm:!0,breaks:!0,mangle:!1});const Ma=["a","b","blockquote","br","code","del","em","h1","h2","h3","h4","hr","i","li","ol","p","pre","strong","table","tbody","td","th","thead","tr","ul"],Ia=["class","href","rel","target","title","start"];let La=!1;const Yu=14e4,Qu=4e4,Zu=200,ns=5e4,Ne=new Map;function Xu(e){const t=Ne.get(e);return t===void 0?null:(Ne.delete(e),Ne.set(e,t),t)}function Ra(e,t){if(Ne.set(e,t),Ne.size<=Zu)return;const n=Ne.keys().next().value;n&&Ne.delete(n)}function Ju(){La||(La=!0,As.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function Ts(e){const t=e.trim();if(!t)return"";if(Ju(),t.length<=ns){const o=Xu(t);if(o!==null)return o}const n=vo(t,Yu),s=n.truncated?`
|
|
76
76
|
|
|
77
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>Qu){const r=`<pre class="code-block">${ep(`${n.text}${s}`)}</pre>`,l=As.sanitize(r,{ALLOWED_TAGS:Ma,ALLOWED_ATTR:
|
|
77
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>Qu){const r=`<pre class="code-block">${ep(`${n.text}${s}`)}</pre>`,l=As.sanitize(r,{ALLOWED_TAGS:Ma,ALLOWED_ATTR:Ia});return t.length<=ns&&Ra(t,l),l}const i=N.parse(`${n.text}${s}`),a=As.sanitize(i,{ALLOWED_TAGS:Ma,ALLOWED_ATTR:Ia});return t.length<=ns&&Ra(t,a),a}function ep(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const tp=1500,np=2e3,gr="Copy as markdown",sp="Copied",ip="Copy failed";async function ap(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function Wt(e,t){e.title=t,e.setAttribute("aria-label",t)}function op(e){const t=e.label??gr;return c`
|
|
78
78
|
<button
|
|
79
79
|
class="chat-copy-btn"
|
|
80
80
|
type="button"
|
|
81
81
|
title=${t}
|
|
82
82
|
aria-label=${t}
|
|
83
|
-
@click=${async n=>{const s=n.currentTarget;if(s?.querySelector(".chat-copy-btn__icon"),!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await ap(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",
|
|
83
|
+
@click=${async n=>{const s=n.currentTarget;if(s?.querySelector(".chat-copy-btn__icon"),!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await ap(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",Wt(s,ip),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,Wt(s,t))},np);return}s.dataset.copied="1",Wt(s,sp),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,Wt(s,t))},tp)}}}
|
|
84
84
|
>
|
|
85
85
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
86
|
-
<span class="chat-copy-btn__icon-copy">${
|
|
87
|
-
<span class="chat-copy-btn__icon-check">${
|
|
86
|
+
<span class="chat-copy-btn__icon-copy">${z.copy}</span>
|
|
87
|
+
<span class="chat-copy-btn__icon-check">${z.check}</span>
|
|
88
88
|
</span>
|
|
89
89
|
</button>
|
|
90
90
|
`}function rp(e){return op({text:()=>e,label:gr})}const lp={icon:"puzzle",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},cp={bash:{icon:"wrench",title:"Bash",detailKeys:["command"]},process:{icon:"wrench",title:"Process",detailKeys:["sessionId"]},read:{icon:"fileText",title:"Read",detailKeys:["path"]},write:{icon:"edit",title:"Write",detailKeys:["path"]},edit:{icon:"penLine",title:"Edit",detailKeys:["path"]},attach:{icon:"paperclip",title:"Attach",detailKeys:["path","url","fileName"]},browser:{icon:"globe",title:"Browser",actions:{status:{label:"status"},start:{label:"start"},stop:{label:"stop"},tabs:{label:"tabs"},open:{label:"open",detailKeys:["targetUrl"]},focus:{label:"focus",detailKeys:["targetId"]},close:{label:"close",detailKeys:["targetId"]},snapshot:{label:"snapshot",detailKeys:["targetUrl","targetId","ref","element","format"]},screenshot:{label:"screenshot",detailKeys:["targetUrl","targetId","ref","element"]},navigate:{label:"navigate",detailKeys:["targetUrl","targetId"]},console:{label:"console",detailKeys:["level","targetId"]},pdf:{label:"pdf",detailKeys:["targetId"]},upload:{label:"upload",detailKeys:["paths","ref","inputRef","element","targetId"]},dialog:{label:"dialog",detailKeys:["accept","promptText","targetId"]},act:{label:"act",detailKeys:["request.kind","request.ref","request.selector","request.text","request.value"]}}},canvas:{icon:"image",title:"Canvas",actions:{present:{label:"present",detailKeys:["target","node","nodeId"]},hide:{label:"hide",detailKeys:["node","nodeId"]},navigate:{label:"navigate",detailKeys:["url","node","nodeId"]},eval:{label:"eval",detailKeys:["javaScript","node","nodeId"]},snapshot:{label:"snapshot",detailKeys:["format","node","nodeId"]},a2ui_push:{label:"A2UI push",detailKeys:["jsonlPath","node","nodeId"]},a2ui_reset:{label:"A2UI reset",detailKeys:["node","nodeId"]}}},nodes:{icon:"smartphone",title:"Nodes",actions:{status:{label:"status"},describe:{label:"describe",detailKeys:["node","nodeId"]},pending:{label:"pending"},approve:{label:"approve",detailKeys:["requestId"]},reject:{label:"reject",detailKeys:["requestId"]},notify:{label:"notify",detailKeys:["node","nodeId","title","body"]},camera_snap:{label:"camera snap",detailKeys:["node","nodeId","facing","deviceId"]},camera_list:{label:"camera list",detailKeys:["node","nodeId"]},camera_clip:{label:"camera clip",detailKeys:["node","nodeId","facing","duration","durationMs"]},screen_record:{label:"screen record",detailKeys:["node","nodeId","duration","durationMs","fps","screenIndex"]}}},cron:{icon:"loader",title:"Cron",actions:{status:{label:"status"},list:{label:"list"},add:{label:"add",detailKeys:["job.name","job.id","job.schedule","job.cron"]},update:{label:"update",detailKeys:["id"]},remove:{label:"remove",detailKeys:["id"]},run:{label:"run",detailKeys:["id"]},runs:{label:"runs",detailKeys:["id"]},wake:{label:"wake",detailKeys:["text","mode"]}}},gateway:{icon:"plug",title:"Gateway",actions:{restart:{label:"restart",detailKeys:["reason","delayMs"]},"config.get":{label:"config get"},"config.schema":{label:"config schema"},"config.apply":{label:"config apply",detailKeys:["restartDelayMs"]},"update.run":{label:"update run",detailKeys:["restartDelayMs"]}}},whatsapp_login:{icon:"circle",title:"WhatsApp Login",actions:{start:{label:"start"},wait:{label:"wait"}}},discord:{icon:"messageSquare",title:"Discord",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sticker:{label:"sticker",detailKeys:["to","stickerIds"]},poll:{label:"poll",detailKeys:["question","to"]},permissions:{label:"permissions",detailKeys:["channelId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},threadCreate:{label:"thread create",detailKeys:["channelId","name"]},threadList:{label:"thread list",detailKeys:["guildId","channelId"]},threadReply:{label:"thread reply",detailKeys:["channelId","content"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},searchMessages:{label:"search",detailKeys:["guildId","content"]},memberInfo:{label:"member",detailKeys:["guildId","userId"]},roleInfo:{label:"roles",detailKeys:["guildId"]},emojiList:{label:"emoji list",detailKeys:["guildId"]},roleAdd:{label:"role add",detailKeys:["guildId","userId","roleId"]},roleRemove:{label:"role remove",detailKeys:["guildId","userId","roleId"]},channelInfo:{label:"channel",detailKeys:["channelId"]},channelList:{label:"channels",detailKeys:["guildId"]},voiceStatus:{label:"voice",detailKeys:["guildId","userId"]},eventList:{label:"events",detailKeys:["guildId"]},eventCreate:{label:"event create",detailKeys:["guildId","name"]},timeout:{label:"timeout",detailKeys:["guildId","userId"]},kick:{label:"kick",detailKeys:["guildId","userId"]},ban:{label:"ban",detailKeys:["guildId","userId"]}}},slack:{icon:"messageSquare",title:"Slack",actions:{react:{label:"react",detailKeys:["channelId","messageId","emoji"]},reactions:{label:"reactions",detailKeys:["channelId","messageId"]},sendMessage:{label:"send",detailKeys:["to","content"]},editMessage:{label:"edit",detailKeys:["channelId","messageId"]},deleteMessage:{label:"delete",detailKeys:["channelId","messageId"]},readMessages:{label:"read messages",detailKeys:["channelId","limit"]},pinMessage:{label:"pin",detailKeys:["channelId","messageId"]},unpinMessage:{label:"unpin",detailKeys:["channelId","messageId"]},listPins:{label:"list pins",detailKeys:["channelId"]},memberInfo:{label:"member",detailKeys:["userId"]},emojiList:{label:"emoji list"}}}},dp={fallback:lp,tools:cp},vr=dp,Pa=vr.fallback??{icon:"puzzle"},up=vr.tools??{};function pp(e){return(e??"tool").trim()}function hp(e){const t=e.replace(/_/g," ").trim();return t?t.split(/\s+/).map(n=>n.length<=2&&n.toUpperCase()===n?n:`${n.at(0)?.toUpperCase()??""}${n.slice(1)}`).join(" "):"Tool"}function fp(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function mr(e){if(e!=null){if(typeof e=="string"){const t=e.trim();if(!t)return;const n=t.split(/\r?\n/)[0]?.trim()??"";return n?n.length>160?`${n.slice(0,157)}…`:n:void 0}if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const t=e.map(s=>mr(s)).filter(s=>!!s);if(t.length===0)return;const n=t.slice(0,3).join(", ");return t.length>3?`${n}…`:n}}}function gp(e,t){if(!e||typeof e!="object")return;let n=e;for(const s of t.split(".")){if(!s||!n||typeof n!="object")return;n=n[s]}return n}function vp(e,t){for(const n of t){const s=gp(e,n),i=mr(s);if(i)return i}}function mp(e){if(!e||typeof e!="object")return;const t=e,n=typeof t.path=="string"?t.path:void 0;if(!n)return;const s=typeof t.offset=="number"?t.offset:void 0,i=typeof t.limit=="number"?t.limit:void 0;return s!==void 0&&i!==void 0?`${n}:${s}-${s+i}`:n}function yp(e){if(!e||typeof e!="object")return;const t=e;return typeof t.path=="string"?t.path:void 0}function bp(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function wp(e){const t=pp(e.name),n=t.toLowerCase(),s=up[n],i=s?.icon??Pa.icon??"puzzle",a=s?.title??hp(t),o=s?.label??t,r=e.args&&typeof e.args=="object"?e.args.action:void 0,l=typeof r=="string"?r.trim():void 0,p=bp(s,l),d=fp(p?.label??l);let u;n==="read"&&(u=mp(e.args)),!u&&(n==="write"||n==="edit"||n==="attach")&&(u=yp(e.args));const g=p?.detailKeys??s?.detailKeys??Pa.detailKeys??[];return!u&&g.length>0&&(u=vp(e.args,g)),!u&&e.meta&&(u=e.meta),u&&(u=xp(u)),{name:t,icon:i,title:a,label:o,verb:d,detail:u}}function $p(e){const t=[];if(e.verb&&t.push(e.verb),e.detail&&t.push(e.detail),t.length!==0)return t.join(" · ")}function xp(e){return e&&e.replace(/\/Users\/[^/]+/g,"~").replace(/\/home\/[^/]+/g,"~")}const Ap=80,kp=2,Na=100;function Sp(e){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{const n=JSON.parse(t);return"```json\n"+JSON.stringify(n,null,2)+"\n```"}catch{}return e}function _p(e){const t=e.split(`
|
|
91
91
|
`),n=t.slice(0,kp),s=n.join(`
|
|
92
|
-
`);return s.length>Na?s.slice(0,Na)+"…":n.length<t.length?s+"…":s}function
|
|
92
|
+
`);return s.length>Na?s.slice(0,Na)+"…":n.length<t.length?s+"…":s}function Tp(e){const t=e,n=Cp(t.content),s=[];for(const i of n){const a=String(i.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(a)||typeof i.name=="string"&&i.arguments!=null)&&s.push({kind:"call",name:i.name??"tool",args:Ep(i.arguments??i.args)})}for(const i of n){const a=String(i.type??"").toLowerCase();if(a!=="toolresult"&&a!=="tool_result")continue;const o=Mp(i),r=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:r,text:o})}if(Jo(e)&&!s.some(i=>i.kind==="result")){const i=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",a=mo(e)??void 0;s.push({kind:"result",name:i,text:a})}return s}function Oa(e,t){const n=wp({name:e.name,args:e.args}),s=$p(n),i=!!e.text?.trim(),a=!!t,o=a?()=>{if(i){t(Sp(e.text));return}const u=`## ${n.label}
|
|
93
93
|
|
|
94
94
|
${s?`**Command:** \`${s}\`
|
|
95
95
|
|
|
@@ -103,18 +103,18 @@ ${s?`**Command:** \`${s}\`
|
|
|
103
103
|
>
|
|
104
104
|
<div class="chat-tool-card__header">
|
|
105
105
|
<div class="chat-tool-card__title">
|
|
106
|
-
<span class="chat-tool-card__icon">${
|
|
106
|
+
<span class="chat-tool-card__icon">${z[n.icon]}</span>
|
|
107
107
|
<span>${n.label}</span>
|
|
108
108
|
</div>
|
|
109
|
-
${a?c`<span class="chat-tool-card__action">${i?"View":""} ${
|
|
110
|
-
${d&&!a?c`<span class="chat-tool-card__status">${
|
|
109
|
+
${a?c`<span class="chat-tool-card__action">${i?"View":""} ${z.check}</span>`:f}
|
|
110
|
+
${d&&!a?c`<span class="chat-tool-card__status">${z.check}</span>`:f}
|
|
111
111
|
</div>
|
|
112
112
|
${s?c`<div class="chat-tool-card__detail">${s}</div>`:f}
|
|
113
113
|
${d?c`<div class="chat-tool-card__status-text muted">Completed</div>`:f}
|
|
114
114
|
${l?c`<div class="chat-tool-card__preview mono">${_p(e.text)}</div>`:f}
|
|
115
115
|
${p?c`<div class="chat-tool-card__inline mono">${e.text}</div>`:f}
|
|
116
116
|
</div>
|
|
117
|
-
`}function
|
|
117
|
+
`}function Cp(e){return Array.isArray(e)?e.filter(Boolean):[]}function Ep(e){if(typeof e!="string")return e;const t=e.trim();if(!t||!t.startsWith("{")&&!t.startsWith("["))return e;try{return JSON.parse(t)}catch{return e}}function Mp(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function Ip(e){const n=e.content,s=[];if(Array.isArray(n))for(const i of n){if(typeof i!="object"||i===null)continue;const a=i;if(a.type==="image"){const o=a.source;if(o?.type==="base64"&&typeof o.data=="string"){const r=o.data,l=o.media_type||"image/png",p=r.startsWith("data:")?r:`data:${l};base64,${r}`;s.push({url:p})}else typeof a.url=="string"&&s.push({url:a.url})}else if(a.type==="image_url"){const o=a.image_url;typeof o?.url=="string"&&s.push({url:o.url})}}return s}function Lp(e){return c`
|
|
118
118
|
<div class="chat-group assistant">
|
|
119
119
|
${fi("assistant",e)}
|
|
120
120
|
<div class="chat-group-messages">
|
|
@@ -162,12 +162,12 @@ ${s?`**Command:** \`${s}\`
|
|
|
162
162
|
/>
|
|
163
163
|
`)}
|
|
164
164
|
</div>
|
|
165
|
-
`}function yr(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",a=
|
|
165
|
+
`}function yr(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",a=Jo(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",o=Tp(e),r=o.length>0,l=Ip(e),p=l.length>0,d=mo(e),u=t.showReasoning&&i==="assistant"?Rl(e):null,g=d?.trim()?d:null,v=u?Nl(u):null,y=g,$=i==="assistant"&&!!y?.trim(),A=["chat-bubble",$?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!y&&r&&a?c`${o.map(_=>Oa(_,n))}`:!y&&!r&&!p?f:c`
|
|
166
166
|
<div class="${A}">
|
|
167
167
|
${$?rp(y):f}
|
|
168
168
|
${Op(l)}
|
|
169
|
-
${v?c`<div class="chat-thinking">${bs(
|
|
170
|
-
${y?c`<div class="chat-text">${bs(
|
|
169
|
+
${v?c`<div class="chat-thinking">${bs(Ts(v))}</div>`:f}
|
|
170
|
+
${y?c`<div class="chat-text">${bs(Ts(y))}</div>`:f}
|
|
171
171
|
${o.map(_=>Oa(_,n))}
|
|
172
172
|
</div>
|
|
173
173
|
`}function Dp(e){return c`
|
|
@@ -175,7 +175,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
175
175
|
<div class="sidebar-header">
|
|
176
176
|
<div class="sidebar-title">Tool Output</div>
|
|
177
177
|
<button @click=${e.onClose} class="btn" title="Close sidebar">
|
|
178
|
-
${
|
|
178
|
+
${z.x}
|
|
179
179
|
</button>
|
|
180
180
|
</div>
|
|
181
181
|
<div class="sidebar-content">
|
|
@@ -184,10 +184,10 @@ ${s?`**Command:** \`${s}\`
|
|
|
184
184
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
185
185
|
View Raw Text
|
|
186
186
|
</button>
|
|
187
|
-
`:e.content?c`<div class="sidebar-markdown">${bs(
|
|
187
|
+
`:e.content?c`<div class="sidebar-markdown">${bs(Ts(e.content))}</div>`:c`<div class="muted">No content available</div>`}
|
|
188
188
|
</div>
|
|
189
189
|
</div>
|
|
190
|
-
`}var Bp=Object.defineProperty,Fp=Object.getOwnPropertyDescriptor,wn=(e,t,n,s)=>{for(var i=s>1?void 0:s?Fp(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&Bp(t,n,i),i};let nt=class extends
|
|
190
|
+
`}var Bp=Object.defineProperty,Fp=Object.getOwnPropertyDescriptor,wn=(e,t,n,s)=>{for(var i=s>1?void 0:s?Fp(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&Bp(t,n,i),i};let nt=class extends Xe{constructor(){super(...arguments),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.isDragging=!1,this.startX=0,this.startRatio=0,this.handleMouseDown=e=>{this.isDragging=!0,this.startX=e.clientX,this.startRatio=this.splitRatio,this.classList.add("dragging"),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),e.preventDefault()},this.handleMouseMove=e=>{if(!this.isDragging)return;const t=this.parentElement;if(!t)return;const n=t.getBoundingClientRect().width,i=(e.clientX-this.startX)/n;let a=this.startRatio+i;a=Math.max(this.minRatio,Math.min(this.maxRatio,a)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:a},bubbles:!0,composed:!0}))},this.handleMouseUp=()=>{this.isDragging=!1,this.classList.remove("dragging"),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}render(){return c``}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this.handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}};nt.styles=Vr`
|
|
191
191
|
:host {
|
|
192
192
|
width: 4px;
|
|
193
193
|
cursor: col-resize;
|
|
@@ -215,11 +215,11 @@ ${s?`**Command:** \`${s}\`
|
|
|
215
215
|
}
|
|
216
216
|
`;wn([ln({type:Number})],nt.prototype,"splitRatio",2);wn([ln({type:Number})],nt.prototype,"minRatio",2);wn([ln({type:Number})],nt.prototype,"maxRatio",2);nt=wn([lo("resizable-divider")],nt);const Up=5e3;function Da(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function Kp(e){return e?e.active?c`
|
|
217
217
|
<div class="callout info compaction-indicator compaction-indicator--active">
|
|
218
|
-
${
|
|
218
|
+
${z.loader} 正在压缩上下文...
|
|
219
219
|
</div>
|
|
220
220
|
`:e.completedAt&&Date.now()-e.completedAt<Up?c`
|
|
221
221
|
<div class="callout success compaction-indicator compaction-indicator--complete">
|
|
222
|
-
${
|
|
222
|
+
${z.check} 上下文已压缩
|
|
223
223
|
</div>
|
|
224
224
|
`:f:f}function Hp(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function zp(e,t){const n=e.clipboardData?.items;if(!n||!t.onAttachmentsChange)return;const s=[];for(let i=0;i<n.length;i++){const a=n[i];a.type.startsWith("image/")&&s.push(a)}if(s.length!==0){e.preventDefault();for(const i of s){const a=i.getAsFile();if(!a)continue;const o=new FileReader;o.onload=()=>{const r=o.result,l={id:Hp(),dataUrl:r,mimeType:a.type},p=t.attachments??[];t.onAttachmentsChange?.([...p,l])},o.readAsDataURL(a)}}}function jp(e){const t=e.attachments??[];return t.length===0?f:c`
|
|
225
225
|
<div class="chat-attachments">
|
|
@@ -227,29 +227,29 @@ ${s?`**Command:** \`${s}\`
|
|
|
227
227
|
<div class="chat-attachment">
|
|
228
228
|
<img
|
|
229
229
|
src=${n.dataUrl}
|
|
230
|
-
alt="
|
|
230
|
+
alt="附件预览"
|
|
231
231
|
class="chat-attachment__img"
|
|
232
232
|
/>
|
|
233
233
|
<button
|
|
234
234
|
class="chat-attachment__remove"
|
|
235
235
|
type="button"
|
|
236
|
-
aria-label="
|
|
236
|
+
aria-label="移除附件"
|
|
237
237
|
@click=${()=>{const s=(e.attachments??[]).filter(i=>i.id!==n.id);e.onAttachmentsChange?.(s)}}
|
|
238
238
|
>
|
|
239
|
-
${
|
|
239
|
+
${z.x}
|
|
240
240
|
</button>
|
|
241
241
|
</div>
|
|
242
242
|
`)}
|
|
243
243
|
</div>
|
|
244
|
-
`}function
|
|
244
|
+
`}function Wp(e){const t=e.connected,n=e.sending||e.stream!==null,s=!!(e.canAbort&&e.onAbort),a=e.sessions?.sessions?.find(v=>v.key===e.sessionKey)?.reasoningLevel??"off",o=e.showThinking&&a!=="off",r={name:e.assistantName,avatar:e.assistantAvatar??e.assistantAvatarUrl??null},l=(e.attachments?.length??0)>0,p=e.connected?l?"添加消息或粘贴更多图片...":"消息 (↩ 发送, Shift+↩ 换行, 可粘贴图片)":"连接网关开始对话…",d=e.splitRatio??.6,u=!!(e.sidebarOpen&&e.onCloseSidebar),g=c`
|
|
245
245
|
<div
|
|
246
246
|
class="chat-thread"
|
|
247
247
|
role="log"
|
|
248
248
|
aria-live="polite"
|
|
249
249
|
@scroll=${e.onChatScroll}
|
|
250
250
|
>
|
|
251
|
-
${e.loading?c`<div class="muted"
|
|
252
|
-
${Zo(
|
|
251
|
+
${e.loading?c`<div class="muted">正在加载对话…</div>`:f}
|
|
252
|
+
${Zo(qp(e),v=>v.key,v=>v.kind==="reading-indicator"?Lp(r):v.kind==="stream"?Rp(v.text,v.startedAt,e.onOpenSidebar,r):v.kind==="group"?Pp(v,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName,assistantAvatar:r.avatar}):f)}
|
|
253
253
|
</div>
|
|
254
254
|
`;return c`
|
|
255
255
|
<section class="card chat">
|
|
@@ -267,7 +267,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
267
267
|
aria-label="Exit focus mode"
|
|
268
268
|
title="Exit focus mode"
|
|
269
269
|
>
|
|
270
|
-
${
|
|
270
|
+
${z.x}
|
|
271
271
|
</button>
|
|
272
272
|
`:f}
|
|
273
273
|
|
|
@@ -296,20 +296,20 @@ ${e.sidebarContent}
|
|
|
296
296
|
|
|
297
297
|
${e.queue.length?c`
|
|
298
298
|
<div class="chat-queue" role="status" aria-live="polite">
|
|
299
|
-
<div class="chat-queue__title"
|
|
299
|
+
<div class="chat-queue__title">队列中 (${e.queue.length})</div>
|
|
300
300
|
<div class="chat-queue__list">
|
|
301
301
|
${e.queue.map(v=>c`
|
|
302
302
|
<div class="chat-queue__item">
|
|
303
303
|
<div class="chat-queue__text">
|
|
304
|
-
${v.text||(v.attachments?.length
|
|
304
|
+
${v.text||(v.attachments?.length?`图片 (${v.attachments.length})`:"")}
|
|
305
305
|
</div>
|
|
306
306
|
<button
|
|
307
307
|
class="btn chat-queue__remove"
|
|
308
308
|
type="button"
|
|
309
|
-
aria-label="
|
|
309
|
+
aria-label="移除队列消息"
|
|
310
310
|
@click=${()=>e.onQueueRemove(v.id)}
|
|
311
311
|
>
|
|
312
|
-
${
|
|
312
|
+
${z.x}
|
|
313
313
|
</button>
|
|
314
314
|
</div>
|
|
315
315
|
`)}
|
|
@@ -321,7 +321,7 @@ ${e.sidebarContent}
|
|
|
321
321
|
${jp(e)}
|
|
322
322
|
<div class="chat-compose__row">
|
|
323
323
|
<label class="field chat-compose__field">
|
|
324
|
-
<span
|
|
324
|
+
<span>消息</span>
|
|
325
325
|
<textarea
|
|
326
326
|
${jd(v=>v&&Da(v))}
|
|
327
327
|
.value=${e.draft}
|
|
@@ -338,31 +338,31 @@ ${e.sidebarContent}
|
|
|
338
338
|
?disabled=${!e.connected||!s&&e.sending}
|
|
339
339
|
@click=${s?e.onAbort:e.onNewSession}
|
|
340
340
|
>
|
|
341
|
-
${s?"
|
|
341
|
+
${s?"停止":"新会话"}
|
|
342
342
|
</button>
|
|
343
343
|
<button
|
|
344
344
|
class="btn primary"
|
|
345
345
|
?disabled=${!e.connected}
|
|
346
346
|
@click=${e.onSend}
|
|
347
347
|
>
|
|
348
|
-
${n?"
|
|
348
|
+
${n?"排队":"发送"}<kbd class="btn-kbd">↵</kbd>
|
|
349
349
|
</button>
|
|
350
350
|
</div>
|
|
351
351
|
</div>
|
|
352
352
|
</div>
|
|
353
353
|
</section>
|
|
354
|
-
`}const Ba=200;function Gp(e){const t=[];let n=null;for(const s of e){if(s.kind!=="message"){n&&(t.push(n),n=null),t.push(s);continue}const i=Jo(s.message),a=ii(i.role),o=i.timestamp||Date.now();!n||n.role!==a?(n&&t.push(n),n={kind:"group",key:`group:${a}:${s.key}`,role:a,messages:[{message:s.message,key:s.key}],timestamp:o,isStreaming:!1}):n.messages.push({message:s.message,key:s.key})}return n&&t.push(n),t}function Wp(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Ba);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Ba} messages (${i} hidden).`,timestamp:Date.now()}});for(let a=i;a<n.length;a++){const o=n[a],r=Jo(o);!e.showThinking&&r.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:Fa(o,a),message:o})}if(e.showThinking)for(let a=0;a<s.length;a++)t.push({kind:"message",key:Fa(s[a],a+n.length),message:s[a]});if(e.stream!==null){const a=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:a,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:a})}return Gp(t)}function Fa(e,t){const n=e,s=typeof n.toolCallId=="string"?n.toolCallId:"";if(s)return`tool:${s}`;const i=typeof n.id=="string"?n.id:"";if(i)return`msg:${i}`;const a=typeof n.messageId=="string"?n.messageId:"";if(a)return`msg:${a}`;const o=typeof n.timestamp=="number"?n.timestamp:null,r=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${r}:${o}:${t}`:`msg:${r}:${t}`}function ue(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function br(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(ue(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function $n(e){return e.filter(t=>typeof t=="string").join(".")}function te(e,t){const n=$n(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const r=a.split(".");if(r.length!==i.length)continue;let l=!0;for(let p=0;p<i.length;p+=1)if(r[p]!=="*"&&r[p]!==i[p]){l=!1;break}if(l)return o}}function we(e){return e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}function Vp(e){const t=$n(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}const Yp=new Set(["title","description","default","nullable"]);function Qp(e){return Object.keys(e??{}).filter(n=>!Yp.has(n)).length===0}function Zp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const Ct={chevronDown:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>`,plus:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>`,minus:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>`,trash:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>`,edit:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>`};function be(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:r}=e,l=e.showLabel??!0,p=ue(t),d=te(s,i),u=d?.label??t.title??we(String(s.at(-1))),g=d?.help??t.description,v=$n(s);if(a.has(v))return c`<div class="cfg-field cfg-field--error">
|
|
354
|
+
`}const Ba=200;function Vp(e){const t=[];let n=null;for(const s of e){if(s.kind!=="message"){n&&(t.push(n),n=null),t.push(s);continue}const i=Xo(s.message),a=ii(i.role),o=i.timestamp||Date.now();!n||n.role!==a?(n&&t.push(n),n={kind:"group",key:`group:${a}:${s.key}`,role:a,messages:[{message:s.message,key:s.key}],timestamp:o,isStreaming:!1}):n.messages.push({message:s.message,key:s.key})}return n&&t.push(n),t}function qp(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Ba);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`显示最近 ${Ba} 条消息(已隐藏 ${i} 条)。`,timestamp:Date.now()}});for(let a=i;a<n.length;a++){const o=n[a],r=Xo(o);!e.showThinking&&r.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:Fa(o,a),message:o})}if(e.showThinking)for(let a=0;a<s.length;a++)t.push({kind:"message",key:Fa(s[a],a+n.length),message:s[a]});if(e.stream!==null){const a=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:a,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:a})}return Vp(t)}function Fa(e,t){const n=e,s=typeof n.toolCallId=="string"?n.toolCallId:"";if(s)return`tool:${s}`;const i=typeof n.id=="string"?n.id:"";if(i)return`msg:${i}`;const a=typeof n.messageId=="string"?n.messageId:"";if(a)return`msg:${a}`;const o=typeof n.timestamp=="number"?n.timestamp:null,r=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${r}:${o}:${t}`:`msg:${r}:${t}`}function ue(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function br(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(ue(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function $n(e){return e.filter(t=>typeof t=="string").join(".")}function te(e,t){const n=$n(e),s=t[n];if(s)return s;const i=n.split(".");for(const[a,o]of Object.entries(t)){if(!a.includes("*"))continue;const r=a.split(".");if(r.length!==i.length)continue;let l=!0;for(let p=0;p<i.length;p+=1)if(r[p]!=="*"&&r[p]!==i[p]){l=!1;break}if(l)return o}}const Gp={Enabled:"已启用",Mode:"模式",Path:"路径",Port:"端口","Timeout Ms":"超时 (毫秒)","Timeout Seconds":"超时 (秒)","Max Bytes":"最大字节数","Max Chars":"最大字符数","Max Redirects":"最大重定向次数","Max Pages":"最大页数","Max Pixels":"最大像素","Max Tokens":"最大令牌数","Max Concurrent":"最大并发数","Max Attempts":"最大尝试次数","Max Body Bytes":"最大请求体字节数","Max Text Length":"最大文本长度","Max Attachments":"最大附件数","Min Chars":"最小字符数","Min Text Chars":"最小文本字符数","Debounce Ms":"防抖 (毫秒)","Base Url":"基础 URL","Api Key":"API 密钥",Token:"令牌",Model:"模型","Model Id":"模型 ID",Provider:"提供商",Language:"语言","Language Code":"语言代码",Lang:"语言",Bind:"绑定",Default:"默认值",Level:"级别",Label:"标签",Strategy:"策略",Scope:"范围",Store:"存储",Seed:"种子",Prompt:"提示词",Color:"颜色",Rate:"速率",Speed:"速度",Pitch:"音调",Volume:"音量",Voice:"语音","Voice Id":"语音 ID",Region:"区域",Domain:"域名",User:"用户",Proxy:"代理",Root:"根目录",File:"文件",Factor:"因子",Start:"开始",End:"结束",Cap:"上限",Ttl:"存活时间",Jitter:"抖动",Image:"图像",Topic:"主题",Target:"目标",Account:"账户",Transport:"传输",Driver:"驱动",Network:"网络",Memory:"内存","Memory Swap":"内存交换",Workdir:"工作目录",Cpus:"CPU 数量",Placeholder:"占位符",Subscription:"订阅",To:"目标",Every:"间隔",Thinking:"思考","Thinking Default":"默认思考",Style:"样式",Prefer:"偏好",Drop:"丢弃",Auto:"自动",Wait:"等待",Session:"会话",Diagnostics:"诊断",Approvals:"审批",Media:"媒体",NodeHost:"节点主机","Node Host":"节点主机",Browser:"浏览器",Tools:"工具",Web:"网页",Auth:"认证",Http:"HTTP",HTTP:"HTTP",Endpoints:"端点",Responses:"响应",Files:"文件",Images:"图像",Pdf:"PDF",PDF:"PDF","Chat Completions":"聊天补全","Control Ui":"控制台 UI",Reload:"重载",Nodes:"节点","Browser Proxy":"浏览器代理","Cache Trace":"缓存追踪",Otel:"OpenTelemetry",OpenTelemetry:"OpenTelemetry",Headers:"请求头",Remote:"远程",Defaults:"默认配置",Exec:"执行","Apply Patch":"应用补丁",Docker:"Docker",Sandbox:"沙箱",Elevated:"提权",Message:"消息","Cross Context":"跨上下文",Marker:"标记",Broadcast:"广播",Links:"链接",Audio:"音频",Video:"视频",Search:"搜索",Perplexity:"Perplexity",Fetch:"获取",Cooldowns:"冷却时间",Profiles:"配置","Model Overrides":"模型覆盖","Human Delay":"人性化延迟","Image Model":"图像模型","Memory Search":"记忆搜索",Local:"本地",Batch:"批处理",Query:"查询",Hybrid:"混合",Cache:"缓存",Chunking:"分块",Sync:"同步",Sessions:"会话",Vector:"向量",Compaction:"压缩","Hard Clear":"硬清除","Soft Trim":"软裁剪","Context Pruning":"上下文修剪",Prune:"修剪",Subagents:"子代理",Inbound:"入站",Outbound:"出站",Tts:"语音合成",TTS:"语音合成",Edge:"Edge",Openai:"OpenAI",OpenAI:"OpenAI",Elevenlabs:"ElevenLabs",ElevenLabs:"ElevenLabs",Deepgram:"Deepgram","Voice Settings":"语音设置","Voice Aliases":"语音别名","Provider Options":"提供商选项",Streaming:"流式传输","Block Streaming Chunk":"块流分块","Block Streaming Coalesce":"块流合并",Stt:"语音转文本",STT:"语音转文本",Transcription:"转录",Dm:"私信",DM:"私信",Reconnect:"重连",Thread:"线程","Group Chat":"群聊",Group:"群组",Tls:"TLS",TLS:"TLS",Tailscale:"Tailscale",Serve:"服务",Tunnel:"隧道",Twilio:"Twilio",Telnyx:"Telnyx",Plivo:"Plivo","Identity Links":"身份链接","Agent To Agent":"代理间",Reset:"重置","Reset By Channel":"按渠道重置","Reset By Type":"按类型重置",Queue:"队列","Shell Env":"Shell 环境",Env:"环境变量",Vars:"变量",Heartbeat:"心跳",Mdns:"mDNS",mDNS:"mDNS","Wide Area":"广域",Load:"加载",Entries:"条目",Installs:"安装",Install:"安装","Active Hours":"活跃时段","Allow From":"允许来源","Send Policy":"发送策略","By Channel":"按渠道","Debounce Ms By Channel":"按渠道防抖",Assistant:"助手","Memory Flush":"内存刷新",Embedding:"嵌入",Experimental:"实验性",Internal:"内部","LLM Task":"LLM 任务","LLM Task Config":"LLM 任务配置",Lobster:"Lobster","Lobster Config":"Lobster 配置",OpenProse:"OpenProse","OpenProse Config":"OpenProse 配置","Memory (Core)":"记忆 (核心)","Memory (Core) Config":"记忆 (核心) 配置","Bedrock Discovery":"Bedrock 发现",Providers:"提供商",Gmail:"Gmail",Webchat:"网页聊天","Allow Tailscale":"允许 Tailscale","Allow Host Control":"允许主机控制","Allow Model Id":"允许模型 ID","Allow Normalization":"允许规范化","Allow Provider":"允许提供商","Allow Seed":"允许种子","Allow Text":"允许文本","Allow Unsafe External Content":"允许不安全的外部内容","Allow Url":"允许 URL","Allow Voice":"允许语音","Allow Voice Settings":"允许语音设置","Attach Only":"仅附加","Auto Generate":"自动生成","Auto Start":"自动启动","Auto-Capture":"自动捕获","Auto-Recall":"自动回忆","Detect Language":"检测语言","Enable Streaming":"启用流式传输","Enable LLM Task":"启用 LLM 任务","Enable Lobster":"启用 Lobster","Enable Memory (Core)":"启用记忆 (核心)","Enable No Vnc":"启用 NoVNC","Enable OpenProse":"启用 OpenProse","Enable qwen-portal-auth":"启用 qwen-portal-auth","Skip Signature Verification":"跳过签名验证",Headless:"无头模式","Include Body":"包含请求体","Include Reasoning":"包含推理","Interrupt On Speech":"语音中断","Live Reload":"实时重载","No Sandbox":"无沙箱","Per Session":"每会话","Prefer Brew":"优先 Brew","Preserve Filenames":"保留文件名",Punctuate:"标点","Read Only Root":"只读根目录","Remove Ack After Reply":"回复后移除确认","Reset On Exit":"退出时重置","Save Subtitles":"保存字幕","Skip Bootstrap":"跳过引导","Smart Format":"智能格式","Use Speaker Boost":"使用扬声器增强","Agent Filter":"代理过滤器",Allow:"允许列表","Allow Bundled":"允许捆绑","Allowed Mimes":"允许的 MIME 类型","Allowed Models":"允许的模型","Also Allow":"同时允许",Binds:"绑定","Cap Drop":"丢弃权限",Command:"命令",Deny:"拒绝列表",Dns:"DNS",DNS:"DNS","Extra Dirs":"额外目录","Extra Hosts":"额外主机",Handlers:"处理器","Inbound Allowlist":"入站白名单",Mappings:"映射","Mention Patterns":"提及模式",Presets:"预设","Provider Filter":"提供商过滤器","Redact Patterns":"脱敏模式","Reset Triggers":"重置触发器",Rules:"规则","Session Filter":"会话过滤器",Targets:"目标",Tmpfs:"临时文件系统","Trusted Proxies":"可信代理","Last Run At":"上次运行时间","Last Run Command":"上次运行命令","Last Run Commit":"上次运行提交","Last Run Mode":"上次运行模式","Last Run Version":"上次运行版本","Console Level":"控制台级别","Console Style":"控制台样式","Database Path":"数据库路径","Context Tokens":"上下文令牌数","Default Auth Profile Id":"默认认证配置 ID","Default Call Mode":"默认呼叫模式","Default Context Window":"默认上下文窗口","Default Max Tokens":"默认最大令牌数","Default Model":"默认模型","Default Profile":"默认配置","Default Provider":"默认提供商","Default To Number":"默认目标号码","Embedding Model":"嵌入模型","Executable Path":"可执行路径","From Number":"来源号码","Head Chars":"头部字符数","Heartbeat Seconds":"心跳间隔 (秒)","History Limit":"历史限制","Hook Url":"钩子 URL","Idle Hours":"空闲小时数","Idle Minutes":"空闲分钟数","Idle Ms":"空闲 (毫秒)","Initial Ms":"初始 (毫秒)","Interval Minutes":"间隔分钟数","Keep Last Assistants":"保留最后助手数","Key Path":"密钥路径","Main Key":"主密钥","Max Age Days":"最大天数","Max Concurrent Calls":"最大并发呼叫数","Max Concurrent Runs":"最大并发运行数","Max Duration Seconds":"最大持续时间 (秒)","Max History Share":"最大历史共享","Max Ms":"最大 (毫秒)","Message Prefix":"消息前缀","Min Prunable Tool Chars":"最小可修剪工具字符数","Notify Hangup Delay (sec)":"挂断通知延迟 (秒)","Output Format":"输出格式","Pids Limit":"进程数限制","Poll Interval Ms":"轮询间隔 (毫秒)","Prefs Path":"偏好路径","Redact Sensitive":"脱敏敏感信息","Refresh Interval":"刷新间隔","Renew Every Minutes":"续订间隔 (分钟)","Reserve Tokens Floor":"保留令牌下限","Response Model":"响应模型","Response Prefix":"响应前缀","Response System Prompt":"响应系统提示词","Response Timeout (ms)":"响应超时 (毫秒)","Ring Timeout Ms":"响铃超时 (毫秒)","Session Tools Visibility":"会话工具可见性","Setup Command":"设置命令","Silence Duration Ms":"静音持续 (毫秒)","Silence Timeout Ms":"静音超时 (毫秒)","Similarity Boost":"相似度增强","Soft Threshold Tokens":"软阈值令牌数","Soft Trim Ratio":"软裁剪比例",Stability:"稳定性","Summary Model":"摘要模型","System Prompt":"系统提示词","Tail Chars":"尾部字符数","Time Format":"时间格式","Timeout Minutes":"超时 (分钟)","Timeout Sec":"超时 (秒)",Timezone:"时区","Transcript Timeout Ms":"转录超时 (毫秒)","Transforms Dir":"转换目录","Typing Interval Seconds":"输入间隔 (秒)","Typing Mode":"输入模式","User Timezone":"用户时区","Vad Threshold":"语音活动检测阈值","Verbose Default":"默认详细模式","Workspace Access":"工作空间访问","Workspace Root":"工作空间根目录","Ack Max Chars":"确认最大字符数","Apply Text Normalization":"应用文本规范化","Archive After Minutes":"归档间隔 (分钟)","At Hour":"在小时","Auth Id":"认证 ID","Auth Token":"认证令牌","Auto Start Timeout Ms":"自动启动超时 (毫秒)","Background Ms":"后台 (毫秒)","Block Streaming Break":"块流中断","Block Streaming Default":"块流默认","Break Preference":"断行偏好","Ca Path":"CA 路径","Call Log Store Path":"呼叫日志存储路径","Cdp Port":"CDP 端口","Cdp Url":"CDP URL","CDP URL":"CDP URL","Cert Path":"证书路径","Cleanup Ms":"清理 (毫秒)","Container Prefix":"容器前缀",Discord:"Discord","Elevated Default":"提权默认值","Hard Clear Ratio":"硬清除比例",Imessage:"iMessage",iMessage:"iMessage","Inbound Greeting":"入站问候语","Inbound Policy":"入站策略",Mattermost:"Mattermost","Media Max Mb":"媒体最大 MB","Media Stream Path":"媒体流路径","Model Cache Dir":"模型缓存目录",Msteams:"MS Teams","MS Teams":"MS Teams","Node Manager":"节点管理器","No Vnc Port":"NoVNC 端口","Public Webhook URL":"公共 Webhook URL","Push Token":"推送令牌","Realtime STT Model":"实时语音转文本模型","Seccomp Profile":"Seccomp 配置","Apparmor Profile":"AppArmor 配置",Signal:"Signal",Slack:"Slack","Stt Provider":"语音转文本提供商","Tailscale Mode":"Tailscale 模式","Tailscale Path":"Tailscale 路径",Telegram:"Telegram","TTS Provider Override":"语音合成提供商覆盖","Tunnel Provider":"隧道提供商","Vnc Port":"VNC 端口","Webhook Bind":"Webhook 绑定","Webhook Path":"Webhook 路径","Webhook Port":"Webhook 端口",Whatsapp:"WhatsApp",WhatsApp:"WhatsApp","ElevenLabs API Key":"ElevenLabs API 密钥","ElevenLabs Base URL":"ElevenLabs 基础 URL","ElevenLabs Model ID":"ElevenLabs 模型 ID","ElevenLabs Voice ID":"ElevenLabs 语音 ID","OpenAI API Key":"OpenAI API 密钥","OpenAI Realtime API Key":"OpenAI 实时 API 密钥","OpenAI TTS Model":"OpenAI 语音合成模型","OpenAI TTS Voice":"OpenAI 语音合成声音","Telnyx API Key":"Telnyx API 密钥","Telnyx Connection ID":"Telnyx 连接 ID","Telnyx Public Key":"Telnyx 公钥","Twilio Account SID":"Twilio 账户 SID","Twilio Auth Token":"Twilio 认证令牌","ngrok Auth Token":"ngrok 认证令牌","ngrok Domain":"ngrok 域名","Allow ngrok Free Tier (Loopback Bypass)":"允许 ngrok 免费版 (回环绕过)","@openclaw/bluebubbles":"@openclaw/bluebubbles","@openclaw/bluebubbles Config":"@openclaw/bluebubbles 配置","@openclaw/copilot-proxy":"@openclaw/copilot-proxy","@openclaw/copilot-proxy Config":"@openclaw/copilot-proxy 配置","@openclaw/diagnostics-otel":"@openclaw/diagnostics-otel","@openclaw/diagnostics-otel Config":"@openclaw/diagnostics-otel 配置","@openclaw/discord":"@openclaw/discord","@openclaw/discord Config":"@openclaw/discord 配置","@openclaw/google-antigravity-auth":"@openclaw/google-antigravity-auth","@openclaw/google-antigravity-auth Config":"@openclaw/google-antigravity-auth 配置","@openclaw/google-gemini-cli-auth":"@openclaw/google-gemini-cli-auth","@openclaw/google-gemini-cli-auth Config":"@openclaw/google-gemini-cli-auth 配置","@openclaw/googlechat":"@openclaw/googlechat","@openclaw/googlechat Config":"@openclaw/googlechat 配置","@openclaw/imessage":"@openclaw/imessage","@openclaw/imessage Config":"@openclaw/imessage 配置","@openclaw/line":"@openclaw/line","@openclaw/line Config":"@openclaw/line 配置","@openclaw/matrix":"@openclaw/matrix","@openclaw/matrix Config":"@openclaw/matrix 配置","@openclaw/mattermost":"@openclaw/mattermost","@openclaw/mattermost Config":"@openclaw/mattermost 配置","@openclaw/memory-lancedb":"@openclaw/memory-lancedb","@openclaw/memory-lancedb Config":"@openclaw/memory-lancedb 配置","@openclaw/msteams":"@openclaw/msteams","@openclaw/msteams Config":"@openclaw/msteams 配置","@openclaw/nextcloud-talk":"@openclaw/nextcloud-talk","@openclaw/nextcloud-talk Config":"@openclaw/nextcloud-talk 配置","@openclaw/nostr":"@openclaw/nostr","@openclaw/nostr Config":"@openclaw/nostr 配置","@openclaw/signal":"@openclaw/signal","@openclaw/signal Config":"@openclaw/signal 配置","@openclaw/slack":"@openclaw/slack","@openclaw/slack Config":"@openclaw/slack 配置","@openclaw/telegram":"@openclaw/telegram","@openclaw/telegram Config":"@openclaw/telegram 配置","@openclaw/tlon":"@openclaw/tlon","@openclaw/tlon Config":"@openclaw/tlon 配置","@openclaw/twitch":"@openclaw/twitch","@openclaw/twitch Config":"@openclaw/twitch 配置","@openclaw/voice-call":"@openclaw/voice-call","@openclaw/voice-call Config":"@openclaw/voice-call 配置","@openclaw/whatsapp":"@openclaw/whatsapp","@openclaw/whatsapp Config":"@openclaw/whatsapp 配置","@openclaw/zalo":"@openclaw/zalo","@openclaw/zalo Config":"@openclaw/zalo 配置","@openclaw/zalouser":"@openclaw/zalouser","@openclaw/zalouser Config":"@openclaw/zalouser 配置","qwen-portal-auth Config":"qwen-portal-auth 配置","Enable @openclaw/bluebubbles":"启用 @openclaw/bluebubbles","Enable @openclaw/copilot-proxy":"启用 @openclaw/copilot-proxy","Enable @openclaw/diagnostics-otel":"启用 @openclaw/diagnostics-otel","Enable @openclaw/discord":"启用 @openclaw/discord","Enable @openclaw/google-antigravity-auth":"启用 @openclaw/google-antigravity-auth","Enable @openclaw/google-gemini-cli-auth":"启用 @openclaw/google-gemini-cli-auth","Enable @openclaw/googlechat":"启用 @openclaw/googlechat","Enable @openclaw/imessage":"启用 @openclaw/imessage","Enable @openclaw/line":"启用 @openclaw/line","Enable @openclaw/matrix":"启用 @openclaw/matrix","Enable @openclaw/mattermost":"启用 @openclaw/mattermost","Enable @openclaw/memory-lancedb":"启用 @openclaw/memory-lancedb","Enable @openclaw/msteams":"启用 @openclaw/msteams","Enable @openclaw/nextcloud-talk":"启用 @openclaw/nextcloud-talk","Enable @openclaw/nostr":"启用 @openclaw/nostr","Enable @openclaw/signal":"启用 @openclaw/signal","Enable @openclaw/slack":"启用 @openclaw/slack","Enable @openclaw/telegram":"启用 @openclaw/telegram","Enable @openclaw/tlon":"启用 @openclaw/tlon","Enable @openclaw/twitch":"启用 @openclaw/twitch","Enable @openclaw/voice-call":"启用 @openclaw/voice-call","Enable @openclaw/whatsapp":"启用 @openclaw/whatsapp","Enable @openclaw/zalo":"启用 @openclaw/zalo","Enable @openclaw/zalouser":"启用 @openclaw/zalouser"};function pe(e){const t=e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").replace(/^./,n=>n.toUpperCase());return Gp[t]||t}function Yp(e){const t=$n(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}const Qp=new Set(["title","description","default","nullable"]);function Zp(e){return Object.keys(e??{}).filter(n=>!Qp.has(n)).length===0}function Xp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const Tt={chevronDown:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>`,plus:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>`,minus:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg>`,trash:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>`,edit:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>`};function we(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:r}=e,l=e.showLabel??!0,p=ue(t),d=te(s,i),u=d?.label??t.title??pe(String(s.at(-1))),g=d?.help??t.description,v=$n(s);if(a.has(v))return c`<div class="cfg-field cfg-field--error">
|
|
355
355
|
<div class="cfg-field__label">${u}</div>
|
|
356
356
|
<div class="cfg-field__error">Unsupported schema node. Use Raw mode.</div>
|
|
357
|
-
</div>`;if(t.anyOf||t.oneOf){const $=(t.anyOf??t.oneOf??[]).filter(
|
|
357
|
+
</div>`;if(t.anyOf||t.oneOf){const $=(t.anyOf??t.oneOf??[]).filter(C=>!(C.type==="null"||Array.isArray(C.type)&&C.type.includes("null")));if($.length===1)return we({...e,schema:$[0]});const A=C=>{if(C.const!==void 0)return C.const;if(C.enum&&C.enum.length===1)return C.enum[0]},_=$.map(A),I=_.every(C=>C!==void 0);if(I&&_.length>0&&_.length<=5){const C=n??t.default;return c`
|
|
358
358
|
<div class="cfg-field">
|
|
359
359
|
${l?c`<label class="cfg-field__label">${u}</label>`:f}
|
|
360
360
|
${g?c`<div class="cfg-field__help">${g}</div>`:f}
|
|
361
361
|
<div class="cfg-segmented">
|
|
362
|
-
${_.map((E,
|
|
362
|
+
${_.map((E,he)=>c`
|
|
363
363
|
<button
|
|
364
364
|
type="button"
|
|
365
|
-
class="cfg-segmented__btn ${E===
|
|
365
|
+
class="cfg-segmented__btn ${E===C||String(E)===String(C)?"active":""}"
|
|
366
366
|
?disabled=${o}
|
|
367
367
|
@click=${()=>r(s,E)}
|
|
368
368
|
>
|
|
@@ -371,7 +371,7 @@ ${e.sidebarContent}
|
|
|
371
371
|
`)}
|
|
372
372
|
</div>
|
|
373
373
|
</div>
|
|
374
|
-
`}if(
|
|
374
|
+
`}if(I&&_.length>5)return Ka({...e,options:_,value:n??t.default});const P=new Set($.map(C=>ue(C)).filter(Boolean)),M=new Set([...P].map(C=>C==="integer"?"number":C));if([...M].every(C=>["string","number","boolean"].includes(C))){const C=M.has("string"),E=M.has("number");if(M.has("boolean")&&M.size===1)return we({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(C||E)return Ua({...e,inputType:E&&!C?"number":"text"})}}if(t.enum){const y=t.enum;if(y.length<=5){const $=n??t.default;return c`
|
|
375
375
|
<div class="cfg-field">
|
|
376
376
|
${l?c`<label class="cfg-field__label">${u}</label>`:f}
|
|
377
377
|
${g?c`<div class="cfg-field__help">${g}</div>`:f}
|
|
@@ -388,7 +388,7 @@ ${e.sidebarContent}
|
|
|
388
388
|
`)}
|
|
389
389
|
</div>
|
|
390
390
|
</div>
|
|
391
|
-
`}return Ka({...e,options:y,value:n??t.default})}if(p==="object")return
|
|
391
|
+
`}return Ka({...e,options:y,value:n??t.default})}if(p==="object")return eh(e);if(p==="array")return th(e);if(p==="boolean"){const y=typeof n=="boolean"?n:typeof t.default=="boolean"?t.default:!1;return c`
|
|
392
392
|
<label class="cfg-toggle-row ${o?"disabled":""}">
|
|
393
393
|
<div class="cfg-toggle-row__content">
|
|
394
394
|
<span class="cfg-toggle-row__label">${u}</span>
|
|
@@ -409,7 +409,7 @@ ${e.sidebarContent}
|
|
|
409
409
|
<div class="cfg-field__label">${u}</div>
|
|
410
410
|
<div class="cfg-field__error">Unsupported type: ${p}. Use Raw mode.</div>
|
|
411
411
|
</div>
|
|
412
|
-
`}function Ua(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:r}=e,l=e.showLabel??!0,p=te(s,i),d=p?.label??t.title??
|
|
412
|
+
`}function Ua(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:r}=e,l=e.showLabel??!0,p=te(s,i),d=p?.label??t.title??pe(String(s.at(-1))),u=p?.help??t.description,g=p?.sensitive??Yp(s),v=p?.placeholder??(g?"••••":t.default!==void 0?`Default: ${t.default}`:""),y=n??"";return c`
|
|
413
413
|
<div class="cfg-field">
|
|
414
414
|
${l?c`<label class="cfg-field__label">${d}</label>`:f}
|
|
415
415
|
${u?c`<div class="cfg-field__help">${u}</div>`:f}
|
|
@@ -434,7 +434,7 @@ ${e.sidebarContent}
|
|
|
434
434
|
`:f}
|
|
435
435
|
</div>
|
|
436
436
|
</div>
|
|
437
|
-
`}function Jp(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,r=e.showLabel??!0,l=te(s,i),p=l?.label??t.title??
|
|
437
|
+
`}function Jp(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,r=e.showLabel??!0,l=te(s,i),p=l?.label??t.title??pe(String(s.at(-1))),d=l?.help??t.description,u=n??t.default??"",g=typeof u=="number"?u:0;return c`
|
|
438
438
|
<div class="cfg-field">
|
|
439
439
|
${r?c`<label class="cfg-field__label">${p}</label>`:f}
|
|
440
440
|
${d?c`<div class="cfg-field__help">${d}</div>`:f}
|
|
@@ -460,7 +460,7 @@ ${e.sidebarContent}
|
|
|
460
460
|
>+</button>
|
|
461
461
|
</div>
|
|
462
462
|
</div>
|
|
463
|
-
`}function Ka(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:r}=e,l=e.showLabel??!0,p=te(s,i),d=p?.label??t.title??
|
|
463
|
+
`}function Ka(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:r}=e,l=e.showLabel??!0,p=te(s,i),d=p?.label??t.title??pe(String(s.at(-1))),u=p?.help??t.description,g=n??t.default,v=o.findIndex($=>$===g||String($)===String(g)),y="__unset__";return c`
|
|
464
464
|
<div class="cfg-field">
|
|
465
465
|
${l?c`<label class="cfg-field__label">${d}</label>`:f}
|
|
466
466
|
${u?c`<div class="cfg-field__help">${u}</div>`:f}
|
|
@@ -476,24 +476,24 @@ ${e.sidebarContent}
|
|
|
476
476
|
`)}
|
|
477
477
|
</select>
|
|
478
478
|
</div>
|
|
479
|
-
`}function
|
|
479
|
+
`}function eh(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:r}=e;e.showLabel;const l=te(s,i),p=l?.label??t.title??pe(String(s.at(-1))),d=l?.help??t.description,u=n??t.default,g=u&&typeof u=="object"&&!Array.isArray(u)?u:{},v=t.properties??{},$=Object.entries(v).sort((P,M)=>{const C=te([...s,P[0]],i)?.order??0,E=te([...s,M[0]],i)?.order??0;return C!==E?C-E:P[0].localeCompare(M[0])}),A=new Set(Object.keys(v)),_=t.additionalProperties,I=!!_&&typeof _=="object";return s.length===1?c`
|
|
480
480
|
<div class="cfg-fields">
|
|
481
|
-
${$.map(([P,M])=>
|
|
482
|
-
${
|
|
481
|
+
${$.map(([P,M])=>we({schema:M,value:g[P],path:[...s,P],hints:i,unsupported:a,disabled:o,onPatch:r}))}
|
|
482
|
+
${I?Ha({schema:_,value:g,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:A,onPatch:r}):f}
|
|
483
483
|
</div>
|
|
484
484
|
`:c`
|
|
485
485
|
<details class="cfg-object" open>
|
|
486
486
|
<summary class="cfg-object__header">
|
|
487
487
|
<span class="cfg-object__title">${p}</span>
|
|
488
|
-
<span class="cfg-object__chevron">${
|
|
488
|
+
<span class="cfg-object__chevron">${Tt.chevronDown}</span>
|
|
489
489
|
</summary>
|
|
490
490
|
${d?c`<div class="cfg-object__help">${d}</div>`:f}
|
|
491
491
|
<div class="cfg-object__content">
|
|
492
|
-
${$.map(([P,M])=>
|
|
493
|
-
${
|
|
492
|
+
${$.map(([P,M])=>we({schema:M,value:g[P],path:[...s,P],hints:i,unsupported:a,disabled:o,onPatch:r}))}
|
|
493
|
+
${I?Ha({schema:_,value:g,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:A,onPatch:r}):f}
|
|
494
494
|
</div>
|
|
495
495
|
</details>
|
|
496
|
-
`}function
|
|
496
|
+
`}function th(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:r}=e,l=e.showLabel??!0,p=te(s,i),d=p?.label??t.title??pe(String(s.at(-1))),u=p?.help??t.description,g=Array.isArray(t.items)?t.items[0]:t.items;if(!g)return c`
|
|
497
497
|
<div class="cfg-field cfg-field--error">
|
|
498
498
|
<div class="cfg-field__label">${d}</div>
|
|
499
499
|
<div class="cfg-field__error">Unsupported array schema. Use Raw mode.</div>
|
|
@@ -509,7 +509,7 @@ ${e.sidebarContent}
|
|
|
509
509
|
?disabled=${o}
|
|
510
510
|
@click=${()=>{const y=[...v,br(g)];r(s,y)}}
|
|
511
511
|
>
|
|
512
|
-
<span class="cfg-array__add-icon">${
|
|
512
|
+
<span class="cfg-array__add-icon">${Tt.plus}</span>
|
|
513
513
|
Add
|
|
514
514
|
</button>
|
|
515
515
|
</div>
|
|
@@ -517,7 +517,7 @@ ${e.sidebarContent}
|
|
|
517
517
|
|
|
518
518
|
${v.length===0?c`
|
|
519
519
|
<div class="cfg-array__empty">
|
|
520
|
-
|
|
520
|
+
暂无项目。点击"添加"创建一个。
|
|
521
521
|
</div>
|
|
522
522
|
`:c`
|
|
523
523
|
<div class="cfg-array__items">
|
|
@@ -532,37 +532,37 @@ ${e.sidebarContent}
|
|
|
532
532
|
?disabled=${o}
|
|
533
533
|
@click=${()=>{const A=[...v];A.splice($,1),r(s,A)}}
|
|
534
534
|
>
|
|
535
|
-
${
|
|
535
|
+
${Tt.trash}
|
|
536
536
|
</button>
|
|
537
537
|
</div>
|
|
538
538
|
<div class="cfg-array__item-content">
|
|
539
|
-
${
|
|
539
|
+
${we({schema:g,value:y,path:[...s,$],hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:r})}
|
|
540
540
|
</div>
|
|
541
541
|
</div>
|
|
542
542
|
`)}
|
|
543
543
|
</div>
|
|
544
544
|
`}
|
|
545
545
|
</div>
|
|
546
|
-
`}function Ha(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:r,onPatch:l}=e,p=
|
|
546
|
+
`}function Ha(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:r,onPatch:l}=e,p=Zp(t),d=Object.entries(n??{}).filter(([u])=>!r.has(u));return c`
|
|
547
547
|
<div class="cfg-map">
|
|
548
548
|
<div class="cfg-map__header">
|
|
549
|
-
<span class="cfg-map__label"
|
|
549
|
+
<span class="cfg-map__label">自定义条目</span>
|
|
550
550
|
<button
|
|
551
551
|
type="button"
|
|
552
552
|
class="cfg-map__add"
|
|
553
553
|
?disabled=${o}
|
|
554
554
|
@click=${()=>{const u={...n??{}};let g=1,v=`custom-${g}`;for(;v in u;)g+=1,v=`custom-${g}`;u[v]=p?{}:br(t),l(s,u)}}
|
|
555
555
|
>
|
|
556
|
-
<span class="cfg-map__add-icon">${
|
|
556
|
+
<span class="cfg-map__add-icon">${Tt.plus}</span>
|
|
557
557
|
Add Entry
|
|
558
558
|
</button>
|
|
559
559
|
</div>
|
|
560
560
|
|
|
561
561
|
${d.length===0?c`
|
|
562
|
-
<div class="cfg-map__empty"
|
|
562
|
+
<div class="cfg-map__empty">暂无自定义条目。</div>
|
|
563
563
|
`:c`
|
|
564
564
|
<div class="cfg-map__items">
|
|
565
|
-
${d.map(([u,g])=>{const v=[...s,u],y=
|
|
565
|
+
${d.map(([u,g])=>{const v=[...s,u],y=Xp(g);return c`
|
|
566
566
|
<div class="cfg-map__item">
|
|
567
567
|
<div class="cfg-map__item-key">
|
|
568
568
|
<input
|
|
@@ -584,7 +584,7 @@ ${e.sidebarContent}
|
|
|
584
584
|
?disabled=${o}
|
|
585
585
|
@change=${$=>{const A=$.target,_=A.value.trim();if(!_){l(v,void 0);return}try{l(v,JSON.parse(_))}catch{A.value=y}}}
|
|
586
586
|
></textarea>
|
|
587
|
-
`:
|
|
587
|
+
`:we({schema:t,value:g,path:v,hints:i,unsupported:a,disabled:o,showLabel:!1,onPatch:l})}
|
|
588
588
|
</div>
|
|
589
589
|
<button
|
|
590
590
|
type="button"
|
|
@@ -593,23 +593,23 @@ ${e.sidebarContent}
|
|
|
593
593
|
?disabled=${o}
|
|
594
594
|
@click=${()=>{const $={...n??{}};delete $[u],l(s,$)}}
|
|
595
595
|
>
|
|
596
|
-
${
|
|
596
|
+
${Tt.trash}
|
|
597
597
|
</button>
|
|
598
598
|
</div>
|
|
599
599
|
`})}
|
|
600
600
|
</div>
|
|
601
601
|
`}
|
|
602
602
|
</div>
|
|
603
|
-
`}const za={env:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},gi={env:{label:"Environment Variables",description:"Environment variables passed to the gateway process"},update:{label:"Updates",description:"Auto-update settings and release channel"},agents:{label:"Agents",description:"Agent configurations, models, and identities"},auth:{label:"Authentication",description:"API keys and authentication profiles"},channels:{label:"Channels",description:"Messaging channels (Telegram, Discord, Slack, etc.)"},messages:{label:"Messages",description:"Message handling and routing settings"},commands:{label:"Commands",description:"Custom slash commands"},hooks:{label:"Hooks",description:"Webhooks and event hooks"},skills:{label:"Skills",description:"Skill packs and capabilities"},tools:{label:"Tools",description:"Tool configurations (browser, search, etc.)"},gateway:{label:"Gateway",description:"Gateway server settings (port, auth, binding)"},wizard:{label:"Setup Wizard",description:"Setup wizard state and history"},meta:{label:"Metadata",description:"Gateway metadata and version information"},logging:{label:"Logging",description:"Log levels and output configuration"},browser:{label:"Browser",description:"Browser automation settings"},ui:{label:"UI",description:"User interface preferences"},models:{label:"Models",description:"AI model configurations and providers"},bindings:{label:"Bindings",description:"Key bindings and shortcuts"},broadcast:{label:"Broadcast",description:"Broadcast and notification settings"},audio:{label:"Audio",description:"Audio input/output settings"},session:{label:"Session",description:"Session management and persistence"},cron:{label:"Cron",description:"Scheduled tasks and automation"},web:{label:"Web",description:"Web server and API settings"},discovery:{label:"Discovery",description:"Service discovery and networking"},canvasHost:{label:"Canvas Host",description:"Canvas rendering and display"},talk:{label:"Talk",description:"Voice and speech settings"},plugins:{label:"Plugins",description:"Plugin management and extensions"}};function ja(e){return za[e]??za.default}function th(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=gi[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:vt(t,s)}function vt(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||vt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&vt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&vt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&vt(s,t))return!0}return!1}function nh(e){if(!e.schema)return c`<div class="muted">Schema unavailable.</div>`;const t=e.schema,n=e.value??{};if(ue(t)!=="object"||!t.properties)return c`<div class="callout danger">Unsupported schema. Use Raw.</div>`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,r=e.activeSubsection??null,p=Object.entries(i).sort((u,g)=>{const v=te([u[0]],e.uiHints)?.order??50,y=te([g[0]],e.uiHints)?.order??50;return v!==y?v-y:u[0].localeCompare(g[0])}).filter(([u,g])=>!(o&&u!==o||a&&!th(u,g,a)));let d=null;if(o&&r&&p.length===1){const u=p[0]?.[1];u&&ue(u)==="object"&&u.properties&&u.properties[r]&&(d={sectionKey:o,subsectionKey:r,schema:u.properties[r]})}return p.length===0?c`
|
|
603
|
+
`}const za={env:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},gi={env:{label:"环境变量",description:"传递给网关进程的环境变量"},update:{label:"更新",description:"自动更新设置和发布渠道"},agents:{label:"代理",description:"代理配置、模型和身份"},auth:{label:"身份验证",description:"API 密钥和认证配置"},channels:{label:"渠道",description:"消息渠道 (Telegram、Discord、Slack 等)"},messages:{label:"消息",description:"消息处理和路由设置"},commands:{label:"命令",description:"自定义斜杠命令"},hooks:{label:"钩子",description:"Webhooks 和事件钩子"},skills:{label:"技能",description:"技能包和功能"},tools:{label:"工具",description:"工具配置 (浏览器、搜索等)"},gateway:{label:"网关",description:"网关服务器设置 (端口、认证、绑定)"},wizard:{label:"设置向导",description:"设置向导状态和历史"},meta:{label:"元数据",description:"网关元数据和版本信息"},logging:{label:"日志",description:"日志级别和输出配置"},browser:{label:"浏览器",description:"浏览器自动化设置"},ui:{label:"界面",description:"用户界面偏好"},models:{label:"模型",description:"AI 模型配置和提供商"},bindings:{label:"绑定",description:"按键绑定和快捷键"},broadcast:{label:"广播",description:"广播和通知设置"},audio:{label:"音频",description:"音频输入/输出设置"},session:{label:"会话",description:"会话管理和持久化"},cron:{label:"定时任务",description:"计划任务和自动化"},web:{label:"网页",description:"网页服务器和 API 设置"},discovery:{label:"发现",description:"服务发现和网络"},canvasHost:{label:"画布主机",description:"画布渲染和显示"},talk:{label:"语音",description:"语音和语音设置"},plugins:{label:"插件",description:"插件管理和扩展"}};function ja(e){return za[e]??za.default}function nh(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=gi[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:vt(t,s)}function vt(e,t){if(e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)||e.enum?.some(s=>String(s).toLowerCase().includes(t)))return!0;if(e.properties){for(const[s,i]of Object.entries(e.properties))if(s.toLowerCase().includes(t)||vt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&vt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&vt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&vt(s,t))return!0}return!1}function sh(e){if(!e.schema)return c`<div class="muted">Schema unavailable.</div>`;const t=e.schema,n=e.value??{};if(ue(t)!=="object"||!t.properties)return c`<div class="callout danger">Unsupported schema. Use Raw.</div>`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,r=e.activeSubsection??null,p=Object.entries(i).sort((u,g)=>{const v=te([u[0]],e.uiHints)?.order??50,y=te([g[0]],e.uiHints)?.order??50;return v!==y?v-y:u[0].localeCompare(g[0])}).filter(([u,g])=>!(o&&u!==o||a&&!nh(u,g,a)));let d=null;if(o&&r&&p.length===1){const u=p[0]?.[1];u&&ue(u)==="object"&&u.properties&&u.properties[r]&&(d={sectionKey:o,subsectionKey:r,schema:u.properties[r]})}return p.length===0?c`
|
|
604
604
|
<div class="config-empty">
|
|
605
|
-
<div class="config-empty__icon">${
|
|
605
|
+
<div class="config-empty__icon">${z.search}</div>
|
|
606
606
|
<div class="config-empty__text">
|
|
607
607
|
${a?`No settings match "${a}"`:"No settings in this section"}
|
|
608
608
|
</div>
|
|
609
609
|
</div>
|
|
610
610
|
`:c`
|
|
611
611
|
<div class="config-form config-form--modern">
|
|
612
|
-
${d?(()=>{const{sectionKey:u,subsectionKey:g,schema:v}=d,y=te([u,g],e.uiHints),$=y?.label??v.title??
|
|
612
|
+
${d?(()=>{const{sectionKey:u,subsectionKey:g,schema:v}=d,y=te([u,g],e.uiHints),$=y?.label??v.title??pe(g),A=y?.help??v.description??"",_=n[u],I=_&&typeof _=="object"?_[g]:void 0,P=`config-section-${u}-${g}`;return c`
|
|
613
613
|
<section class="config-section-card" id=${P}>
|
|
614
614
|
<div class="config-section-card__header">
|
|
615
615
|
<span class="config-section-card__icon">${ja(u)}</span>
|
|
@@ -619,7 +619,7 @@ ${e.sidebarContent}
|
|
|
619
619
|
</div>
|
|
620
620
|
</div>
|
|
621
621
|
<div class="config-section-card__content">
|
|
622
|
-
${
|
|
622
|
+
${we({schema:v,value:I,path:[u,g],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
|
|
623
623
|
</div>
|
|
624
624
|
</section>
|
|
625
625
|
`})():p.map(([u,g])=>{const v=gi[u]??{label:u.charAt(0).toUpperCase()+u.slice(1),description:g.description??""};return c`
|
|
@@ -632,17 +632,17 @@ ${e.sidebarContent}
|
|
|
632
632
|
</div>
|
|
633
633
|
</div>
|
|
634
634
|
<div class="config-section-card__content">
|
|
635
|
-
${
|
|
635
|
+
${we({schema:g,value:n[u],path:[u],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
|
|
636
636
|
</div>
|
|
637
637
|
</section>
|
|
638
638
|
`})}
|
|
639
639
|
</div>
|
|
640
|
-
`}const sh=new Set(["title","description","default","nullable"]);function ih(e){return Object.keys(e??{}).filter(n=>!sh.has(n)).length===0}function wr(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function $r(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:wt(e,[])}function wt(e,t){const n=new Set,s={...e},i=$n(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const r=ah(e,t);return r||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=ue(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:r,nullable:l}=wr(s.enum);s.enum=r,l&&(s.nullable=!0),r.length===0&&n.add(i)}if(o==="object"){const r=e.properties??{},l={};for(const[p,d]of Object.entries(r)){const u=wt(d,[...t,p]);u.schema&&(l[p]=u.schema);for(const g of u.unsupportedPaths)n.add(g)}if(s.properties=l,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!ih(e.additionalProperties)){const p=wt(e.additionalProperties,[...t,"*"]);s.additionalProperties=p.schema??e.additionalProperties,p.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const r=Array.isArray(e.items)?e.items[0]:e.items;if(!r)n.add(i);else{const l=wt(r,[...t,"*"]);s.items=l.schema??r,l.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function ah(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const r of n){if(!r||typeof r!="object")return null;if(Array.isArray(r.enum)){const{enumValues:l,nullable:p}=wr(r.enum);s.push(...l),p&&(a=!0);continue}if("const"in r){if(r.const==null){a=!0;continue}s.push(r.const);continue}if(ue(r)==="null"){a=!0;continue}i.push(r)}if(s.length>0&&i.length===0){const r=[];for(const l of s)r.some(p=>Object.is(p,l))||r.push(l);return{schema:{...e,enum:r,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const r=wt(i[0],t);return r.schema&&(r.schema.nullable=a||r.schema.nullable),r}const o=["string","number","integer","boolean"];return i.length>0&&s.length===0&&i.every(r=>r.type&&o.includes(String(r.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}const Ts={all:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>`,env:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},qa=[{key:"env",label:"Environment"},{key:"update",label:"Updates"},{key:"agents",label:"Agents"},{key:"auth",label:"Authentication"},{key:"channels",label:"Channels"},{key:"messages",label:"Messages"},{key:"commands",label:"Commands"},{key:"hooks",label:"Hooks"},{key:"skills",label:"Skills"},{key:"tools",label:"Tools"},{key:"gateway",label:"Gateway"},{key:"wizard",label:"Setup Wizard"}],Ga="__all__";function Wa(e){return Ts[e]??Ts.default}function oh(e,t){const n=gi[e];return n||{label:t?.title??we(e),description:t?.description??""}}function rh(e){const{key:t,schema:n,uiHints:s}=e;if(!n||ue(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const r=te([t,a],s),l=r?.label??o.title??we(a),p=r?.help??o.description??"",d=r?.order??50;return{key:a,label:l,description:p,order:d}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function lh(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const r=i,l=a,p=new Set([...Object.keys(r),...Object.keys(l)]);for(const d of p)s(r[d],l[d],o?`${o}.${d}`:d)}return s(e,t,""),n}function Va(e,t=40){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length<=t?n:n.slice(0,t-3)+"..."}function ch(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=$r(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=qa.filter(E=>E.key in i),o=new Set(qa.map(E=>E.key)),r=Object.keys(i).filter(E=>!o.has(E)).map(E=>({key:E,label:E.charAt(0).toUpperCase()+E.slice(1)})),l=[...a,...r],p=e.activeSection&&n.schema&&ue(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,d=e.activeSection?oh(e.activeSection,p):null,u=e.activeSection?rh({key:e.activeSection,schema:p,uiHints:e.uiHints}):[],g=e.formMode==="form"&&!!e.activeSection&&u.length>0,v=e.activeSubsection===Ga,y=e.searchQuery||v?null:e.activeSubsection??u[0]?.key??null,$=e.formMode==="form"?lh(e.originalValue,e.formValue):[],A=e.formMode==="raw"&&e.raw!==e.originalRaw,_=e.formMode==="form"?$.length>0:A,L=!!e.formValue&&!e.loading&&!!n.schema,P=e.connected&&!e.saving&&_&&(e.formMode==="raw"?!0:L),M=e.connected&&!e.applying&&!e.updating&&_&&(e.formMode==="raw"?!0:L),T=e.connected&&!e.applying&&!e.updating;return c`
|
|
640
|
+
`}const ih=new Set(["title","description","default","nullable"]);function ah(e){return Object.keys(e??{}).filter(n=>!ih.has(n)).length===0}function wr(e){const t=e.filter(i=>i!=null),n=t.length!==e.length,s=[];for(const i of t)s.some(a=>Object.is(a,i))||s.push(i);return{enumValues:s,nullable:n}}function $r(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:wt(e,[])}function wt(e,t){const n=new Set,s={...e},i=$n(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const r=oh(e,t);return r||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=ue(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:r,nullable:l}=wr(s.enum);s.enum=r,l&&(s.nullable=!0),r.length===0&&n.add(i)}if(o==="object"){const r=e.properties??{},l={};for(const[p,d]of Object.entries(r)){const u=wt(d,[...t,p]);u.schema&&(l[p]=u.schema);for(const g of u.unsupportedPaths)n.add(g)}if(s.properties=l,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!ah(e.additionalProperties)){const p=wt(e.additionalProperties,[...t,"*"]);s.additionalProperties=p.schema??e.additionalProperties,p.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const r=Array.isArray(e.items)?e.items[0]:e.items;if(!r)n.add(i);else{const l=wt(r,[...t,"*"]);s.items=l.schema??r,l.unsupportedPaths.length>0&&n.add(i)}}else o!=="string"&&o!=="number"&&o!=="integer"&&o!=="boolean"&&!s.enum&&n.add(i);return{schema:s,unsupportedPaths:Array.from(n)}}function oh(e,t){if(e.allOf)return null;const n=e.anyOf??e.oneOf;if(!n)return null;const s=[],i=[];let a=!1;for(const r of n){if(!r||typeof r!="object")return null;if(Array.isArray(r.enum)){const{enumValues:l,nullable:p}=wr(r.enum);s.push(...l),p&&(a=!0);continue}if("const"in r){if(r.const==null){a=!0;continue}s.push(r.const);continue}if(ue(r)==="null"){a=!0;continue}i.push(r)}if(s.length>0&&i.length===0){const r=[];for(const l of s)r.some(p=>Object.is(p,l))||r.push(l);return{schema:{...e,enum:r,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const r=wt(i[0],t);return r.schema&&(r.schema.nullable=a||r.schema.nullable),r}const o=["string","number","integer","boolean"];return i.length>0&&s.length===0&&i.every(r=>r.type&&o.includes(String(r.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}const Cs={all:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>`,env:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>`,update:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,agents:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"></path><circle cx="8" cy="14" r="1"></circle><circle cx="16" cy="14" r="1"></circle></svg>`,auth:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,channels:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`,messages:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>`,commands:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`,hooks:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>`,skills:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>`,tools:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path></svg>`,gateway:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,wizard:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 4V2"></path><path d="M15 16v-2"></path><path d="M8 9h2"></path><path d="M20 9h2"></path><path d="M17.8 11.8 19 13"></path><path d="M15 9h0"></path><path d="M17.8 6.2 19 5"></path><path d="m3 21 9-9"></path><path d="M12.2 6.2 11 5"></path></svg>`,meta:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>`,logging:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>`,browser:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4"></circle><line x1="21.17" y1="8" x2="12" y2="8"></line><line x1="3.95" y1="6.06" x2="8.54" y2="14"></line><line x1="10.88" y1="21.94" x2="15.46" y2="14"></line></svg>`,ui:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>`,models:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>`,bindings:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>`,broadcast:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path><circle cx="12" cy="12" r="2"></circle><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path></svg>`,audio:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>`,session:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M23 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>`,cron:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`,web:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>`,discovery:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>`,canvasHost:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>`,talk:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>`,plugins:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v6"></path><path d="m4.93 10.93 4.24 4.24"></path><path d="M2 12h6"></path><path d="m4.93 13.07 4.24-4.24"></path><path d="M12 22v-6"></path><path d="m19.07 13.07-4.24-4.24"></path><path d="M22 12h-6"></path><path d="m19.07 10.93-4.24 4.24"></path></svg>`,default:c`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>`},Wa=[{key:"env",label:"环境"},{key:"update",label:"更新"},{key:"agents",label:"代理"},{key:"auth",label:"身份验证"},{key:"channels",label:"渠道"},{key:"messages",label:"消息"},{key:"commands",label:"命令"},{key:"hooks",label:"钩子"},{key:"skills",label:"技能"},{key:"tools",label:"工具"},{key:"gateway",label:"网关"},{key:"wizard",label:"设置向导"},{key:"meta",label:"元数据"},{key:"diagnostics",label:"诊断"},{key:"logging",label:"日志"},{key:"browser",label:"浏览器"},{key:"ui",label:"界面"},{key:"models",label:"模型"},{key:"nodeHost",label:"节点主机"},{key:"bindings",label:"绑定"},{key:"broadcast",label:"广播"},{key:"audio",label:"音频"},{key:"media",label:"媒体"},{key:"approvals",label:"审批"},{key:"session",label:"会话"},{key:"cron",label:"定时任务"},{key:"web",label:"网页"},{key:"discovery",label:"发现"},{key:"canvasHost",label:"画布主机"},{key:"talk",label:"语音"},{key:"plugins",label:"插件"}],Va="__all__";function qa(e){return Cs[e]??Cs.default}function rh(e,t){const n=gi[e];return n||{label:t?.title??pe(e),description:t?.description??""}}function lh(e){const{key:t,schema:n,uiHints:s}=e;if(!n||ue(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const r=te([t,a],s),l=r?.label??o.title??pe(a),p=r?.help??o.description??"",d=r?.order??50;return{key:a,label:l,description:p,order:d}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function ch(e,t){if(!e||!t)return[];const n=[];function s(i,a,o){if(i===a)return;if(typeof i!=typeof a){n.push({path:o,from:i,to:a});return}if(typeof i!="object"||i===null||a===null){i!==a&&n.push({path:o,from:i,to:a});return}if(Array.isArray(i)&&Array.isArray(a)){JSON.stringify(i)!==JSON.stringify(a)&&n.push({path:o,from:i,to:a});return}const r=i,l=a,p=new Set([...Object.keys(r),...Object.keys(l)]);for(const d of p)s(r[d],l[d],o?`${o}.${d}`:d)}return s(e,t,""),n}function Ga(e,t=40){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return n.length<=t?n:n.slice(0,t-3)+"..."}function dh(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=$r(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=Wa.filter(E=>E.key in i),o=new Set(Wa.map(E=>E.key)),r=Object.keys(i).filter(E=>!o.has(E)).map(E=>({key:E,label:pe(E)})),l=[...a,...r],p=e.activeSection&&n.schema&&ue(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,d=e.activeSection?rh(e.activeSection,p):null,u=e.activeSection?lh({key:e.activeSection,schema:p,uiHints:e.uiHints}):[],g=e.formMode==="form"&&!!e.activeSection&&u.length>0,v=e.activeSubsection===Va,y=e.searchQuery||v?null:e.activeSubsection??u[0]?.key??null,$=e.formMode==="form"?ch(e.originalValue,e.formValue):[],A=e.formMode==="raw"&&e.raw!==e.originalRaw,_=e.formMode==="form"?$.length>0:A,I=!!e.formValue&&!e.loading&&!!n.schema,P=e.connected&&!e.saving&&_&&(e.formMode==="raw"?!0:I),M=e.connected&&!e.applying&&!e.updating&&_&&(e.formMode==="raw"?!0:I),C=e.connected&&!e.applying&&!e.updating;return c`
|
|
641
641
|
<div class="config-layout">
|
|
642
642
|
<!-- Sidebar -->
|
|
643
643
|
<aside class="config-sidebar">
|
|
644
644
|
<div class="config-sidebar__header">
|
|
645
|
-
<div class="config-sidebar__title"
|
|
645
|
+
<div class="config-sidebar__title">设置</div>
|
|
646
646
|
<span class="pill pill--sm ${t==="valid"?"pill--ok":t==="invalid"?"pill--danger":""}">${t}</span>
|
|
647
647
|
</div>
|
|
648
648
|
|
|
@@ -655,7 +655,7 @@ ${e.sidebarContent}
|
|
|
655
655
|
<input
|
|
656
656
|
type="text"
|
|
657
657
|
class="config-search__input"
|
|
658
|
-
placeholder="
|
|
658
|
+
placeholder="搜索设置..."
|
|
659
659
|
.value=${e.searchQuery}
|
|
660
660
|
@input=${E=>e.onSearchChange(E.target.value)}
|
|
661
661
|
/>
|
|
@@ -673,15 +673,15 @@ ${e.sidebarContent}
|
|
|
673
673
|
class="config-nav__item ${e.activeSection===null?"active":""}"
|
|
674
674
|
@click=${()=>e.onSectionChange(null)}
|
|
675
675
|
>
|
|
676
|
-
<span class="config-nav__icon">${
|
|
677
|
-
<span class="config-nav__label"
|
|
676
|
+
<span class="config-nav__icon">${Cs.all}</span>
|
|
677
|
+
<span class="config-nav__label">所有设置</span>
|
|
678
678
|
</button>
|
|
679
679
|
${l.map(E=>c`
|
|
680
680
|
<button
|
|
681
681
|
class="config-nav__item ${e.activeSection===E.key?"active":""}"
|
|
682
682
|
@click=${()=>e.onSectionChange(E.key)}
|
|
683
683
|
>
|
|
684
|
-
<span class="config-nav__icon">${
|
|
684
|
+
<span class="config-nav__icon">${qa(E.key)}</span>
|
|
685
685
|
<span class="config-nav__label">${E.label}</span>
|
|
686
686
|
</button>
|
|
687
687
|
`)}
|
|
@@ -695,13 +695,13 @@ ${e.sidebarContent}
|
|
|
695
695
|
?disabled=${e.schemaLoading||!e.schema}
|
|
696
696
|
@click=${()=>e.onFormModeChange("form")}
|
|
697
697
|
>
|
|
698
|
-
|
|
698
|
+
表单
|
|
699
699
|
</button>
|
|
700
700
|
<button
|
|
701
701
|
class="config-mode-toggle__btn ${e.formMode==="raw"?"active":""}"
|
|
702
702
|
@click=${()=>e.onFormModeChange("raw")}
|
|
703
703
|
>
|
|
704
|
-
|
|
704
|
+
原始
|
|
705
705
|
</button>
|
|
706
706
|
</div>
|
|
707
707
|
</div>
|
|
@@ -713,35 +713,35 @@ ${e.sidebarContent}
|
|
|
713
713
|
<div class="config-actions">
|
|
714
714
|
<div class="config-actions__left">
|
|
715
715
|
${_?c`
|
|
716
|
-
<span class="config-changes-badge">${e.formMode==="raw"?"
|
|
716
|
+
<span class="config-changes-badge">${e.formMode==="raw"?"未保存的更改":`${$.length} 项未保存更改`}</span>
|
|
717
717
|
`:c`
|
|
718
|
-
<span class="config-status muted"
|
|
718
|
+
<span class="config-status muted">无更改</span>
|
|
719
719
|
`}
|
|
720
720
|
</div>
|
|
721
721
|
<div class="config-actions__right">
|
|
722
722
|
<button class="btn btn--sm" ?disabled=${e.loading} @click=${e.onReload}>
|
|
723
|
-
${e.loading?"
|
|
723
|
+
${e.loading?"加载中…":"重新加载"}
|
|
724
724
|
</button>
|
|
725
725
|
<button
|
|
726
726
|
class="btn btn--sm primary"
|
|
727
727
|
?disabled=${!P}
|
|
728
728
|
@click=${e.onSave}
|
|
729
729
|
>
|
|
730
|
-
${e.saving?"
|
|
730
|
+
${e.saving?"保存中…":"保存"}
|
|
731
731
|
</button>
|
|
732
732
|
<button
|
|
733
733
|
class="btn btn--sm"
|
|
734
734
|
?disabled=${!M}
|
|
735
735
|
@click=${e.onApply}
|
|
736
736
|
>
|
|
737
|
-
${e.applying?"
|
|
737
|
+
${e.applying?"应用中…":"应用"}
|
|
738
738
|
</button>
|
|
739
739
|
<button
|
|
740
740
|
class="btn btn--sm"
|
|
741
|
-
?disabled=${!
|
|
741
|
+
?disabled=${!C}
|
|
742
742
|
@click=${e.onUpdate}
|
|
743
743
|
>
|
|
744
|
-
${e.updating?"
|
|
744
|
+
${e.updating?"更新中…":"更新"}
|
|
745
745
|
</button>
|
|
746
746
|
</div>
|
|
747
747
|
</div>
|
|
@@ -750,7 +750,7 @@ ${e.sidebarContent}
|
|
|
750
750
|
${_&&e.formMode==="form"?c`
|
|
751
751
|
<details class="config-diff">
|
|
752
752
|
<summary class="config-diff__summary">
|
|
753
|
-
<span
|
|
753
|
+
<span>查看 ${$.length} 项待处理更改</span>
|
|
754
754
|
<svg class="config-diff__chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
755
755
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
756
756
|
</svg>
|
|
@@ -760,9 +760,9 @@ ${e.sidebarContent}
|
|
|
760
760
|
<div class="config-diff__item">
|
|
761
761
|
<div class="config-diff__path">${E.path}</div>
|
|
762
762
|
<div class="config-diff__values">
|
|
763
|
-
<span class="config-diff__from">${
|
|
763
|
+
<span class="config-diff__from">${Ga(E.from)}</span>
|
|
764
764
|
<span class="config-diff__arrow">→</span>
|
|
765
|
-
<span class="config-diff__to">${
|
|
765
|
+
<span class="config-diff__to">${Ga(E.to)}</span>
|
|
766
766
|
</div>
|
|
767
767
|
</div>
|
|
768
768
|
`)}
|
|
@@ -772,7 +772,7 @@ ${e.sidebarContent}
|
|
|
772
772
|
|
|
773
773
|
${d&&e.formMode==="form"?c`
|
|
774
774
|
<div class="config-section-hero">
|
|
775
|
-
<div class="config-section-hero__icon">${
|
|
775
|
+
<div class="config-section-hero__icon">${qa(e.activeSection??"")}</div>
|
|
776
776
|
<div class="config-section-hero__text">
|
|
777
777
|
<div class="config-section-hero__title">${d.label}</div>
|
|
778
778
|
${d.description?c`<div class="config-section-hero__desc">${d.description}</div>`:f}
|
|
@@ -784,9 +784,9 @@ ${e.sidebarContent}
|
|
|
784
784
|
<div class="config-subnav">
|
|
785
785
|
<button
|
|
786
786
|
class="config-subnav__item ${y===null?"active":""}"
|
|
787
|
-
@click=${()=>e.onSubsectionChange(
|
|
787
|
+
@click=${()=>e.onSubsectionChange(Va)}
|
|
788
788
|
>
|
|
789
|
-
|
|
789
|
+
全部
|
|
790
790
|
</button>
|
|
791
791
|
${u.map(E=>c`
|
|
792
792
|
<button
|
|
@@ -805,15 +805,15 @@ ${e.sidebarContent}
|
|
|
805
805
|
${e.formMode==="form"?c`
|
|
806
806
|
${e.schemaLoading?c`<div class="config-loading">
|
|
807
807
|
<div class="config-loading__spinner"></div>
|
|
808
|
-
<span
|
|
809
|
-
</div>`:
|
|
808
|
+
<span>加载架构中…</span>
|
|
809
|
+
</div>`:sh({schema:n.schema,uiHints:e.uiHints,value:e.formValue,disabled:e.loading||!e.formValue,unsupportedPaths:n.unsupportedPaths,onPatch:e.onFormPatch,searchQuery:e.searchQuery,activeSection:e.activeSection,activeSubsection:y})}
|
|
810
810
|
${s?c`<div class="callout danger" style="margin-top: 12px;">
|
|
811
|
-
|
|
812
|
-
|
|
811
|
+
表单视图无法安全编辑某些字段。
|
|
812
|
+
使用原始模式以避免丢失配置条目。
|
|
813
813
|
</div>`:f}
|
|
814
814
|
`:c`
|
|
815
815
|
<label class="field config-raw-field">
|
|
816
|
-
<span
|
|
816
|
+
<span>原始 JSON5</span>
|
|
817
817
|
<textarea
|
|
818
818
|
.value=${e.raw}
|
|
819
819
|
@input=${E=>e.onRawChange(E.target.value)}
|
|
@@ -827,51 +827,51 @@ ${e.sidebarContent}
|
|
|
827
827
|
</div>`:f}
|
|
828
828
|
</main>
|
|
829
829
|
</div>
|
|
830
|
-
`}function
|
|
830
|
+
`}function uh(e){if(!e&&e!==0)return"n/a";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function ph(e,t){const n=t.snapshot,s=n?.channels;if(!n||!s)return!1;const i=s[e],a=typeof i?.configured=="boolean"&&i.configured,o=typeof i?.running=="boolean"&&i.running,r=typeof i?.connected=="boolean"&&i.connected,p=(n.channelAccounts?.[e]??[]).some(d=>d.configured||d.running||d.connected);return a||o||r||p}function hh(e,t){return t?.[e]?.length??0}function xr(e,t){const n=hh(e,t);return n<2?f:c`<div class="account-count">Accounts (${n})</div>`}function fh(e,t){let n=e;for(const s of t){if(!n)return null;const i=ue(n);if(i==="object"){const a=n.properties??{};if(typeof s=="string"&&a[s]){n=a[s];continue}const o=n.additionalProperties;if(typeof s=="string"&&o&&typeof o=="object"){n=o;continue}return null}if(i==="array"){if(typeof s!="number")return null;n=(Array.isArray(n.items)?n.items[0]:n.items)??null;continue}return null}return n}function gh(e,t){const s=(e.channels??{})[t],i=e[t];return(s&&typeof s=="object"?s:null)??(i&&typeof i=="object"?i:null)??{}}function vh(e){const t=$r(e.schema),n=t.schema;if(!n)return c`<div class="callout danger">架构不可用。请使用原始模式。</div>`;const s=fh(n,["channels",e.channelId]);if(!s)return c`<div class="callout danger">渠道配置架构不可用。</div>`;const i=e.configValue??{},a=gh(i,e.channelId);return c`
|
|
831
831
|
<div class="config-form">
|
|
832
|
-
${
|
|
832
|
+
${we({schema:s,value:a,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
|
|
833
833
|
</div>
|
|
834
834
|
`}function $e(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return c`
|
|
835
835
|
<div style="margin-top: 16px;">
|
|
836
|
-
${n.configSchemaLoading?c`<div class="muted"
|
|
836
|
+
${n.configSchemaLoading?c`<div class="muted">加载配置架构中…</div>`:vh({channelId:t,configValue:n.configForm,schema:n.configSchema,uiHints:n.configUiHints,disabled:s,onPatch:n.onConfigPatch})}
|
|
837
837
|
<div class="row" style="margin-top: 12px;">
|
|
838
838
|
<button
|
|
839
839
|
class="btn primary"
|
|
840
840
|
?disabled=${s||!n.configFormDirty}
|
|
841
841
|
@click=${()=>n.onConfigSave()}
|
|
842
842
|
>
|
|
843
|
-
${n.configSaving?"
|
|
843
|
+
${n.configSaving?"保存中…":"保存"}
|
|
844
844
|
</button>
|
|
845
845
|
<button
|
|
846
846
|
class="btn"
|
|
847
847
|
?disabled=${s}
|
|
848
848
|
@click=${()=>n.onConfigReload()}
|
|
849
849
|
>
|
|
850
|
-
|
|
850
|
+
重新加载
|
|
851
851
|
</button>
|
|
852
852
|
</div>
|
|
853
853
|
</div>
|
|
854
|
-
`}function
|
|
854
|
+
`}function mh(e){const{props:t,discord:n,accountCountLabel:s}=e;return c`
|
|
855
855
|
<div class="card">
|
|
856
856
|
<div class="card-title">Discord</div>
|
|
857
|
-
<div class="card-sub"
|
|
857
|
+
<div class="card-sub">机器人状态和渠道配置。</div>
|
|
858
858
|
${s}
|
|
859
859
|
|
|
860
860
|
<div class="status-list" style="margin-top: 16px;">
|
|
861
861
|
<div>
|
|
862
|
-
<span class="label"
|
|
862
|
+
<span class="label">已配置</span>
|
|
863
863
|
<span>${n?.configured?"Yes":"No"}</span>
|
|
864
864
|
</div>
|
|
865
865
|
<div>
|
|
866
|
-
<span class="label"
|
|
866
|
+
<span class="label">运行中</span>
|
|
867
867
|
<span>${n?.running?"Yes":"No"}</span>
|
|
868
868
|
</div>
|
|
869
869
|
<div>
|
|
870
|
-
<span class="label"
|
|
870
|
+
<span class="label">上次启动</span>
|
|
871
871
|
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
872
872
|
</div>
|
|
873
873
|
<div>
|
|
874
|
-
<span class="label"
|
|
874
|
+
<span class="label">上次探测</span>
|
|
875
875
|
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
876
876
|
</div>
|
|
877
877
|
</div>
|
|
@@ -881,7 +881,7 @@ ${e.sidebarContent}
|
|
|
881
881
|
</div>`:f}
|
|
882
882
|
|
|
883
883
|
${n?.probe?c`<div class="callout" style="margin-top: 12px;">
|
|
884
|
-
|
|
884
|
+
探测 ${n.probe.ok?"成功":"失败"} ·
|
|
885
885
|
${n.probe.status??""} ${n.probe.error??""}
|
|
886
886
|
</div>`:f}
|
|
887
887
|
|
|
@@ -889,41 +889,41 @@ ${e.sidebarContent}
|
|
|
889
889
|
|
|
890
890
|
<div class="row" style="margin-top: 12px;">
|
|
891
891
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
892
|
-
|
|
892
|
+
探测
|
|
893
893
|
</button>
|
|
894
894
|
</div>
|
|
895
895
|
</div>
|
|
896
|
-
`}function
|
|
896
|
+
`}function yh(e){const{props:t,googleChat:n,accountCountLabel:s}=e;return c`
|
|
897
897
|
<div class="card">
|
|
898
898
|
<div class="card-title">Google Chat</div>
|
|
899
|
-
<div class="card-sub">Chat API
|
|
899
|
+
<div class="card-sub">Chat API Webhook 状态和渠道配置。</div>
|
|
900
900
|
${s}
|
|
901
901
|
|
|
902
902
|
<div class="status-list" style="margin-top: 16px;">
|
|
903
903
|
<div>
|
|
904
|
-
<span class="label"
|
|
904
|
+
<span class="label">已配置</span>
|
|
905
905
|
<span>${n?n.configured?"Yes":"No":"n/a"}</span>
|
|
906
906
|
</div>
|
|
907
907
|
<div>
|
|
908
|
-
<span class="label"
|
|
908
|
+
<span class="label">运行中</span>
|
|
909
909
|
<span>${n?n.running?"Yes":"No":"n/a"}</span>
|
|
910
910
|
</div>
|
|
911
911
|
<div>
|
|
912
|
-
<span class="label"
|
|
912
|
+
<span class="label">凭证</span>
|
|
913
913
|
<span>${n?.credentialSource??"n/a"}</span>
|
|
914
914
|
</div>
|
|
915
915
|
<div>
|
|
916
|
-
<span class="label"
|
|
916
|
+
<span class="label">受众</span>
|
|
917
917
|
<span>
|
|
918
918
|
${n?.audienceType?`${n.audienceType}${n.audience?` · ${n.audience}`:""}`:"n/a"}
|
|
919
919
|
</span>
|
|
920
920
|
</div>
|
|
921
921
|
<div>
|
|
922
|
-
<span class="label"
|
|
922
|
+
<span class="label">上次启动</span>
|
|
923
923
|
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
924
924
|
</div>
|
|
925
925
|
<div>
|
|
926
|
-
<span class="label"
|
|
926
|
+
<span class="label">上次探测</span>
|
|
927
927
|
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
928
928
|
</div>
|
|
929
929
|
</div>
|
|
@@ -933,7 +933,7 @@ ${e.sidebarContent}
|
|
|
933
933
|
</div>`:f}
|
|
934
934
|
|
|
935
935
|
${n?.probe?c`<div class="callout" style="margin-top: 12px;">
|
|
936
|
-
|
|
936
|
+
探测 ${n.probe.ok?"成功":"失败"} ·
|
|
937
937
|
${n.probe.status??""} ${n.probe.error??""}
|
|
938
938
|
</div>`:f}
|
|
939
939
|
|
|
@@ -941,31 +941,31 @@ ${e.sidebarContent}
|
|
|
941
941
|
|
|
942
942
|
<div class="row" style="margin-top: 12px;">
|
|
943
943
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
944
|
-
|
|
944
|
+
探测
|
|
945
945
|
</button>
|
|
946
946
|
</div>
|
|
947
947
|
</div>
|
|
948
|
-
`}function
|
|
948
|
+
`}function bh(e){const{props:t,imessage:n,accountCountLabel:s}=e;return c`
|
|
949
949
|
<div class="card">
|
|
950
950
|
<div class="card-title">iMessage</div>
|
|
951
|
-
<div class="card-sub">macOS
|
|
951
|
+
<div class="card-sub">macOS 桥接状态和渠道配置。</div>
|
|
952
952
|
${s}
|
|
953
953
|
|
|
954
954
|
<div class="status-list" style="margin-top: 16px;">
|
|
955
955
|
<div>
|
|
956
|
-
<span class="label"
|
|
956
|
+
<span class="label">已配置</span>
|
|
957
957
|
<span>${n?.configured?"Yes":"No"}</span>
|
|
958
958
|
</div>
|
|
959
959
|
<div>
|
|
960
|
-
<span class="label"
|
|
960
|
+
<span class="label">运行中</span>
|
|
961
961
|
<span>${n?.running?"Yes":"No"}</span>
|
|
962
962
|
</div>
|
|
963
963
|
<div>
|
|
964
|
-
<span class="label"
|
|
964
|
+
<span class="label">上次启动</span>
|
|
965
965
|
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
966
966
|
</div>
|
|
967
967
|
<div>
|
|
968
|
-
<span class="label"
|
|
968
|
+
<span class="label">上次探测</span>
|
|
969
969
|
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
970
970
|
</div>
|
|
971
971
|
</div>
|
|
@@ -975,7 +975,7 @@ ${e.sidebarContent}
|
|
|
975
975
|
</div>`:f}
|
|
976
976
|
|
|
977
977
|
${n?.probe?c`<div class="callout" style="margin-top: 12px;">
|
|
978
|
-
|
|
978
|
+
探测 ${n.probe.ok?"成功":"失败"} ·
|
|
979
979
|
${n.probe.error??""}
|
|
980
980
|
</div>`:f}
|
|
981
981
|
|
|
@@ -983,11 +983,11 @@ ${e.sidebarContent}
|
|
|
983
983
|
|
|
984
984
|
<div class="row" style="margin-top: 12px;">
|
|
985
985
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
986
|
-
|
|
986
|
+
探测
|
|
987
987
|
</button>
|
|
988
988
|
</div>
|
|
989
989
|
</div>
|
|
990
|
-
`}function
|
|
990
|
+
`}function wh(e){const{values:t,original:n}=e;return t.name!==n.name||t.displayName!==n.displayName||t.about!==n.about||t.picture!==n.picture||t.banner!==n.banner||t.website!==n.website||t.nip05!==n.nip05||t.lud16!==n.lud16}function $h(e){const{state:t,callbacks:n,accountId:s}=e,i=wh(t),a=(r,l,p={})=>{const{type:d="text",placeholder:u,maxLength:g,help:v}=p,y=t.values[r]??"",$=t.fieldErrors[r],A=`nostr-profile-${r}`;return d==="textarea"?c`
|
|
991
991
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
992
992
|
<label for="${A}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
993
993
|
${l}
|
|
@@ -999,7 +999,7 @@ ${e.sidebarContent}
|
|
|
999
999
|
maxlength=${g??2e3}
|
|
1000
1000
|
rows="3"
|
|
1001
1001
|
style="width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 4px; resize: vertical; font-family: inherit;"
|
|
1002
|
-
@input=${_=>{const
|
|
1002
|
+
@input=${_=>{const I=_.target;n.onFieldChange(r,I.value)}}
|
|
1003
1003
|
?disabled=${t.saving}
|
|
1004
1004
|
></textarea>
|
|
1005
1005
|
${v?c`<div style="font-size: 12px; color: var(--text-muted); margin-top: 2px;">${v}</div>`:f}
|
|
@@ -1017,7 +1017,7 @@ ${e.sidebarContent}
|
|
|
1017
1017
|
placeholder=${u??""}
|
|
1018
1018
|
maxlength=${g??256}
|
|
1019
1019
|
style="width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 4px;"
|
|
1020
|
-
@input=${_=>{const
|
|
1020
|
+
@input=${_=>{const I=_.target;n.onFieldChange(r,I.value)}}
|
|
1021
1021
|
?disabled=${t.saving}
|
|
1022
1022
|
/>
|
|
1023
1023
|
${v?c`<div style="font-size: 12px; color: var(--text-muted); margin-top: 2px;">${v}</div>`:f}
|
|
@@ -1105,45 +1105,45 @@ ${e.sidebarContent}
|
|
|
1105
1105
|
You have unsaved changes
|
|
1106
1106
|
</div>`:f}
|
|
1107
1107
|
</div>
|
|
1108
|
-
`}function
|
|
1108
|
+
`}function xh(e){const t={name:e?.name??"",displayName:e?.displayName??"",about:e?.about??"",picture:e?.picture??"",banner:e?.banner??"",website:e?.website??"",nip05:e?.nip05??"",lud16:e?.lud16??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e?.banner||e?.website||e?.nip05||e?.lud16)}}function Ya(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:"n/a"}function Ah(e){const{props:t,nostr:n,nostrAccounts:s,accountCountLabel:i,profileFormState:a,profileFormCallbacks:o,onEditProfile:r}=e,l=s[0],p=n?.configured??l?.configured??!1,d=n?.running??l?.running??!1,u=n?.publicKey??l?.publicKey,g=n?.lastStartAt??l?.lastStartAt??null,v=n?.lastError??l?.lastError??null,y=s.length>1,$=a!=null,A=I=>{const P=I.publicKey,M=I.profile,C=M?.displayName??M?.name??I.name??I.accountId;return c`
|
|
1109
1109
|
<div class="account-card">
|
|
1110
1110
|
<div class="account-card-header">
|
|
1111
|
-
<div class="account-card-title">${
|
|
1112
|
-
<div class="account-card-id">${
|
|
1111
|
+
<div class="account-card-title">${C}</div>
|
|
1112
|
+
<div class="account-card-id">${I.accountId}</div>
|
|
1113
1113
|
</div>
|
|
1114
1114
|
<div class="status-list account-card-status">
|
|
1115
1115
|
<div>
|
|
1116
|
-
<span class="label"
|
|
1117
|
-
<span>${
|
|
1116
|
+
<span class="label">运行中</span>
|
|
1117
|
+
<span>${I.running?"Yes":"No"}</span>
|
|
1118
1118
|
</div>
|
|
1119
1119
|
<div>
|
|
1120
|
-
<span class="label"
|
|
1121
|
-
<span>${
|
|
1120
|
+
<span class="label">已配置</span>
|
|
1121
|
+
<span>${I.configured?"Yes":"No"}</span>
|
|
1122
1122
|
</div>
|
|
1123
1123
|
<div>
|
|
1124
|
-
<span class="label"
|
|
1124
|
+
<span class="label">公钥</span>
|
|
1125
1125
|
<span class="monospace" title="${P??""}">${Ya(P)}</span>
|
|
1126
1126
|
</div>
|
|
1127
1127
|
<div>
|
|
1128
|
-
<span class="label"
|
|
1129
|
-
<span>${
|
|
1128
|
+
<span class="label">最后入站</span>
|
|
1129
|
+
<span>${I.lastInboundAt?O(I.lastInboundAt):"n/a"}</span>
|
|
1130
1130
|
</div>
|
|
1131
|
-
${
|
|
1132
|
-
<div class="account-card-error">${
|
|
1131
|
+
${I.lastError?c`
|
|
1132
|
+
<div class="account-card-error">${I.lastError}</div>
|
|
1133
1133
|
`:f}
|
|
1134
1134
|
</div>
|
|
1135
1135
|
</div>
|
|
1136
|
-
`},_=()=>{if($&&o)return
|
|
1136
|
+
`},_=()=>{if($&&o)return $h({state:a,callbacks:o,accountId:s[0]?.accountId??"default"});const I=l?.profile??n?.profile,{name:P,displayName:M,about:C,picture:E,nip05:he}=I??{},xn=P||M||C||E||he;return c`
|
|
1137
1137
|
<div style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
|
|
1138
1138
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
|
1139
|
-
<div style="font-weight: 500;"
|
|
1139
|
+
<div style="font-weight: 500;">个人资料</div>
|
|
1140
1140
|
${p?c`
|
|
1141
1141
|
<button
|
|
1142
1142
|
class="btn btn-sm"
|
|
1143
1143
|
@click=${r}
|
|
1144
1144
|
style="font-size: 12px; padding: 4px 8px;"
|
|
1145
1145
|
>
|
|
1146
|
-
|
|
1146
|
+
编辑资料
|
|
1147
1147
|
</button>
|
|
1148
1148
|
`:f}
|
|
1149
1149
|
</div>
|
|
@@ -1159,45 +1159,45 @@ ${e.sidebarContent}
|
|
|
1159
1159
|
/>
|
|
1160
1160
|
</div>
|
|
1161
1161
|
`:f}
|
|
1162
|
-
${P?c`<div><span class="label"
|
|
1163
|
-
${M?c`<div><span class="label"
|
|
1164
|
-
${
|
|
1165
|
-
${
|
|
1162
|
+
${P?c`<div><span class="label">名称</span><span>${P}</span></div>`:f}
|
|
1163
|
+
${M?c`<div><span class="label">显示名称</span><span>${M}</span></div>`:f}
|
|
1164
|
+
${C?c`<div><span class="label">简介</span><span style="max-width: 300px; overflow: hidden; text-overflow: ellipsis;">${C}</span></div>`:f}
|
|
1165
|
+
${he?c`<div><span class="label">NIP-05</span><span>${he}</span></div>`:f}
|
|
1166
1166
|
</div>
|
|
1167
1167
|
`:c`
|
|
1168
1168
|
<div style="color: var(--text-muted); font-size: 13px;">
|
|
1169
|
-
|
|
1169
|
+
暂无个人资料。点击"编辑资料"添加您的名称、简介和头像。
|
|
1170
1170
|
</div>
|
|
1171
1171
|
`}
|
|
1172
1172
|
</div>
|
|
1173
1173
|
`};return c`
|
|
1174
1174
|
<div class="card">
|
|
1175
1175
|
<div class="card-title">Nostr</div>
|
|
1176
|
-
<div class="card-sub"
|
|
1176
|
+
<div class="card-sub">通过 Nostr 中继进行去中心化私信 (NIP-04)。</div>
|
|
1177
1177
|
${i}
|
|
1178
1178
|
|
|
1179
1179
|
${y?c`
|
|
1180
1180
|
<div class="account-card-list">
|
|
1181
|
-
${s.map(
|
|
1181
|
+
${s.map(I=>A(I))}
|
|
1182
1182
|
</div>
|
|
1183
1183
|
`:c`
|
|
1184
1184
|
<div class="status-list" style="margin-top: 16px;">
|
|
1185
1185
|
<div>
|
|
1186
|
-
<span class="label"
|
|
1186
|
+
<span class="label">已配置</span>
|
|
1187
1187
|
<span>${p?"Yes":"No"}</span>
|
|
1188
1188
|
</div>
|
|
1189
1189
|
<div>
|
|
1190
|
-
<span class="label"
|
|
1190
|
+
<span class="label">运行中</span>
|
|
1191
1191
|
<span>${d?"Yes":"No"}</span>
|
|
1192
1192
|
</div>
|
|
1193
1193
|
<div>
|
|
1194
|
-
<span class="label"
|
|
1194
|
+
<span class="label">公钥</span>
|
|
1195
1195
|
<span class="monospace" title="${u??""}"
|
|
1196
1196
|
>${Ya(u)}</span
|
|
1197
1197
|
>
|
|
1198
1198
|
</div>
|
|
1199
1199
|
<div>
|
|
1200
|
-
<span class="label"
|
|
1200
|
+
<span class="label">上次启动</span>
|
|
1201
1201
|
<span>${g?O(g):"n/a"}</span>
|
|
1202
1202
|
</div>
|
|
1203
1203
|
</div>
|
|
@@ -1210,34 +1210,34 @@ ${e.sidebarContent}
|
|
|
1210
1210
|
${$e({channelId:"nostr",props:t})}
|
|
1211
1211
|
|
|
1212
1212
|
<div class="row" style="margin-top: 12px;">
|
|
1213
|
-
<button class="btn" @click=${()=>t.onRefresh(!1)}
|
|
1213
|
+
<button class="btn" @click=${()=>t.onRefresh(!1)}>刷新</button>
|
|
1214
1214
|
</div>
|
|
1215
1215
|
</div>
|
|
1216
|
-
`}function
|
|
1216
|
+
`}function kh(e){const{props:t,signal:n,accountCountLabel:s}=e;return c`
|
|
1217
1217
|
<div class="card">
|
|
1218
1218
|
<div class="card-title">Signal</div>
|
|
1219
|
-
<div class="card-sub">signal-cli
|
|
1219
|
+
<div class="card-sub">signal-cli 状态和渠道配置。</div>
|
|
1220
1220
|
${s}
|
|
1221
1221
|
|
|
1222
1222
|
<div class="status-list" style="margin-top: 16px;">
|
|
1223
1223
|
<div>
|
|
1224
|
-
<span class="label"
|
|
1224
|
+
<span class="label">已配置</span>
|
|
1225
1225
|
<span>${n?.configured?"Yes":"No"}</span>
|
|
1226
1226
|
</div>
|
|
1227
1227
|
<div>
|
|
1228
|
-
<span class="label"
|
|
1228
|
+
<span class="label">运行中</span>
|
|
1229
1229
|
<span>${n?.running?"Yes":"No"}</span>
|
|
1230
1230
|
</div>
|
|
1231
1231
|
<div>
|
|
1232
|
-
<span class="label"
|
|
1232
|
+
<span class="label">基础 URL</span>
|
|
1233
1233
|
<span>${n?.baseUrl??"n/a"}</span>
|
|
1234
1234
|
</div>
|
|
1235
1235
|
<div>
|
|
1236
|
-
<span class="label"
|
|
1236
|
+
<span class="label">上次启动</span>
|
|
1237
1237
|
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
1238
1238
|
</div>
|
|
1239
1239
|
<div>
|
|
1240
|
-
<span class="label"
|
|
1240
|
+
<span class="label">上次探测</span>
|
|
1241
1241
|
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
1242
1242
|
</div>
|
|
1243
1243
|
</div>
|
|
@@ -1247,7 +1247,7 @@ ${e.sidebarContent}
|
|
|
1247
1247
|
</div>`:f}
|
|
1248
1248
|
|
|
1249
1249
|
${n?.probe?c`<div class="callout" style="margin-top: 12px;">
|
|
1250
|
-
|
|
1250
|
+
探测 ${n.probe.ok?"成功":"失败"} ·
|
|
1251
1251
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1252
1252
|
</div>`:f}
|
|
1253
1253
|
|
|
@@ -1255,31 +1255,31 @@ ${e.sidebarContent}
|
|
|
1255
1255
|
|
|
1256
1256
|
<div class="row" style="margin-top: 12px;">
|
|
1257
1257
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
1258
|
-
|
|
1258
|
+
探测
|
|
1259
1259
|
</button>
|
|
1260
1260
|
</div>
|
|
1261
1261
|
</div>
|
|
1262
|
-
`}function
|
|
1262
|
+
`}function Sh(e){const{props:t,slack:n,accountCountLabel:s}=e;return c`
|
|
1263
1263
|
<div class="card">
|
|
1264
1264
|
<div class="card-title">Slack</div>
|
|
1265
|
-
<div class="card-sub">Socket
|
|
1265
|
+
<div class="card-sub">Socket 模式状态和渠道配置。</div>
|
|
1266
1266
|
${s}
|
|
1267
1267
|
|
|
1268
1268
|
<div class="status-list" style="margin-top: 16px;">
|
|
1269
1269
|
<div>
|
|
1270
|
-
<span class="label"
|
|
1270
|
+
<span class="label">已配置</span>
|
|
1271
1271
|
<span>${n?.configured?"Yes":"No"}</span>
|
|
1272
1272
|
</div>
|
|
1273
1273
|
<div>
|
|
1274
|
-
<span class="label"
|
|
1274
|
+
<span class="label">运行中</span>
|
|
1275
1275
|
<span>${n?.running?"Yes":"No"}</span>
|
|
1276
1276
|
</div>
|
|
1277
1277
|
<div>
|
|
1278
|
-
<span class="label"
|
|
1278
|
+
<span class="label">上次启动</span>
|
|
1279
1279
|
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
1280
1280
|
</div>
|
|
1281
1281
|
<div>
|
|
1282
|
-
<span class="label"
|
|
1282
|
+
<span class="label">上次探测</span>
|
|
1283
1283
|
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
1284
1284
|
</div>
|
|
1285
1285
|
</div>
|
|
@@ -1289,7 +1289,7 @@ ${e.sidebarContent}
|
|
|
1289
1289
|
</div>`:f}
|
|
1290
1290
|
|
|
1291
1291
|
${n?.probe?c`<div class="callout" style="margin-top: 12px;">
|
|
1292
|
-
|
|
1292
|
+
探测 ${n.probe.ok?"成功":"失败"} ·
|
|
1293
1293
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1294
1294
|
</div>`:f}
|
|
1295
1295
|
|
|
@@ -1297,11 +1297,11 @@ ${e.sidebarContent}
|
|
|
1297
1297
|
|
|
1298
1298
|
<div class="row" style="margin-top: 12px;">
|
|
1299
1299
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
1300
|
-
|
|
1300
|
+
探测
|
|
1301
1301
|
</button>
|
|
1302
1302
|
</div>
|
|
1303
1303
|
</div>
|
|
1304
|
-
`}function
|
|
1304
|
+
`}function _h(e){const{props:t,telegram:n,telegramAccounts:s,accountCountLabel:i}=e,a=s.length>1,o=r=>{const p=r.probe?.bot?.username,d=r.name||r.accountId;return c`
|
|
1305
1305
|
<div class="account-card">
|
|
1306
1306
|
<div class="account-card-header">
|
|
1307
1307
|
<div class="account-card-title">
|
|
@@ -1311,15 +1311,15 @@ ${e.sidebarContent}
|
|
|
1311
1311
|
</div>
|
|
1312
1312
|
<div class="status-list account-card-status">
|
|
1313
1313
|
<div>
|
|
1314
|
-
<span class="label"
|
|
1314
|
+
<span class="label">运行中</span>
|
|
1315
1315
|
<span>${r.running?"Yes":"No"}</span>
|
|
1316
1316
|
</div>
|
|
1317
1317
|
<div>
|
|
1318
|
-
<span class="label"
|
|
1318
|
+
<span class="label">已配置</span>
|
|
1319
1319
|
<span>${r.configured?"Yes":"No"}</span>
|
|
1320
1320
|
</div>
|
|
1321
1321
|
<div>
|
|
1322
|
-
<span class="label"
|
|
1322
|
+
<span class="label">最后入站</span>
|
|
1323
1323
|
<span>${r.lastInboundAt?O(r.lastInboundAt):"n/a"}</span>
|
|
1324
1324
|
</div>
|
|
1325
1325
|
${r.lastError?c`
|
|
@@ -1332,7 +1332,7 @@ ${e.sidebarContent}
|
|
|
1332
1332
|
`};return c`
|
|
1333
1333
|
<div class="card">
|
|
1334
1334
|
<div class="card-title">Telegram</div>
|
|
1335
|
-
<div class="card-sub"
|
|
1335
|
+
<div class="card-sub">机器人状态和渠道配置。</div>
|
|
1336
1336
|
${i}
|
|
1337
1337
|
|
|
1338
1338
|
${a?c`
|
|
@@ -1342,23 +1342,23 @@ ${e.sidebarContent}
|
|
|
1342
1342
|
`:c`
|
|
1343
1343
|
<div class="status-list" style="margin-top: 16px;">
|
|
1344
1344
|
<div>
|
|
1345
|
-
<span class="label"
|
|
1345
|
+
<span class="label">已配置</span>
|
|
1346
1346
|
<span>${n?.configured?"Yes":"No"}</span>
|
|
1347
1347
|
</div>
|
|
1348
1348
|
<div>
|
|
1349
|
-
<span class="label"
|
|
1349
|
+
<span class="label">运行中</span>
|
|
1350
1350
|
<span>${n?.running?"Yes":"No"}</span>
|
|
1351
1351
|
</div>
|
|
1352
1352
|
<div>
|
|
1353
|
-
<span class="label"
|
|
1353
|
+
<span class="label">模式</span>
|
|
1354
1354
|
<span>${n?.mode??"n/a"}</span>
|
|
1355
1355
|
</div>
|
|
1356
1356
|
<div>
|
|
1357
|
-
<span class="label"
|
|
1357
|
+
<span class="label">上次启动</span>
|
|
1358
1358
|
<span>${n?.lastStartAt?O(n.lastStartAt):"n/a"}</span>
|
|
1359
1359
|
</div>
|
|
1360
1360
|
<div>
|
|
1361
|
-
<span class="label"
|
|
1361
|
+
<span class="label">上次探测</span>
|
|
1362
1362
|
<span>${n?.lastProbeAt?O(n.lastProbeAt):"n/a"}</span>
|
|
1363
1363
|
</div>
|
|
1364
1364
|
</div>
|
|
@@ -1369,7 +1369,7 @@ ${e.sidebarContent}
|
|
|
1369
1369
|
</div>`:f}
|
|
1370
1370
|
|
|
1371
1371
|
${n?.probe?c`<div class="callout" style="margin-top: 12px;">
|
|
1372
|
-
|
|
1372
|
+
探测 ${n.probe.ok?"成功":"失败"} ·
|
|
1373
1373
|
${n.probe.status??""} ${n.probe.error??""}
|
|
1374
1374
|
</div>`:f}
|
|
1375
1375
|
|
|
@@ -1377,49 +1377,49 @@ ${e.sidebarContent}
|
|
|
1377
1377
|
|
|
1378
1378
|
<div class="row" style="margin-top: 12px;">
|
|
1379
1379
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
1380
|
-
|
|
1380
|
+
探测
|
|
1381
1381
|
</button>
|
|
1382
1382
|
</div>
|
|
1383
1383
|
</div>
|
|
1384
|
-
`}function
|
|
1384
|
+
`}function Th(e){const{props:t,whatsapp:n,accountCountLabel:s}=e;return c`
|
|
1385
1385
|
<div class="card">
|
|
1386
1386
|
<div class="card-title">WhatsApp</div>
|
|
1387
|
-
<div class="card-sub"
|
|
1387
|
+
<div class="card-sub">连接 WhatsApp Web 并监控连接健康状态。</div>
|
|
1388
1388
|
${s}
|
|
1389
1389
|
|
|
1390
1390
|
<div class="status-list" style="margin-top: 16px;">
|
|
1391
1391
|
<div>
|
|
1392
|
-
<span class="label"
|
|
1392
|
+
<span class="label">已配置</span>
|
|
1393
1393
|
<span>${n?.configured?"Yes":"No"}</span>
|
|
1394
1394
|
</div>
|
|
1395
1395
|
<div>
|
|
1396
|
-
<span class="label"
|
|
1396
|
+
<span class="label">已链接</span>
|
|
1397
1397
|
<span>${n?.linked?"Yes":"No"}</span>
|
|
1398
1398
|
</div>
|
|
1399
1399
|
<div>
|
|
1400
|
-
<span class="label"
|
|
1400
|
+
<span class="label">运行中</span>
|
|
1401
1401
|
<span>${n?.running?"Yes":"No"}</span>
|
|
1402
1402
|
</div>
|
|
1403
1403
|
<div>
|
|
1404
|
-
<span class="label"
|
|
1404
|
+
<span class="label">已连接</span>
|
|
1405
1405
|
<span>${n?.connected?"Yes":"No"}</span>
|
|
1406
1406
|
</div>
|
|
1407
1407
|
<div>
|
|
1408
|
-
<span class="label"
|
|
1408
|
+
<span class="label">最后连接</span>
|
|
1409
1409
|
<span>
|
|
1410
1410
|
${n?.lastConnectedAt?O(n.lastConnectedAt):"n/a"}
|
|
1411
1411
|
</span>
|
|
1412
1412
|
</div>
|
|
1413
1413
|
<div>
|
|
1414
|
-
<span class="label"
|
|
1414
|
+
<span class="label">最后消息</span>
|
|
1415
1415
|
<span>
|
|
1416
1416
|
${n?.lastMessageAt?O(n.lastMessageAt):"n/a"}
|
|
1417
1417
|
</span>
|
|
1418
1418
|
</div>
|
|
1419
1419
|
<div>
|
|
1420
|
-
<span class="label"
|
|
1420
|
+
<span class="label">认证时长</span>
|
|
1421
1421
|
<span>
|
|
1422
|
-
${n?.authAgeMs!=null?
|
|
1422
|
+
${n?.authAgeMs!=null?uh(n.authAgeMs):"n/a"}
|
|
1423
1423
|
</span>
|
|
1424
1424
|
</div>
|
|
1425
1425
|
</div>
|
|
@@ -1442,46 +1442,46 @@ ${e.sidebarContent}
|
|
|
1442
1442
|
?disabled=${t.whatsappBusy}
|
|
1443
1443
|
@click=${()=>t.onWhatsAppStart(!1)}
|
|
1444
1444
|
>
|
|
1445
|
-
${t.whatsappBusy?"
|
|
1445
|
+
${t.whatsappBusy?"处理中…":"显示二维码"}
|
|
1446
1446
|
</button>
|
|
1447
1447
|
<button
|
|
1448
1448
|
class="btn"
|
|
1449
1449
|
?disabled=${t.whatsappBusy}
|
|
1450
1450
|
@click=${()=>t.onWhatsAppStart(!0)}
|
|
1451
1451
|
>
|
|
1452
|
-
|
|
1452
|
+
重新链接
|
|
1453
1453
|
</button>
|
|
1454
1454
|
<button
|
|
1455
1455
|
class="btn"
|
|
1456
1456
|
?disabled=${t.whatsappBusy}
|
|
1457
1457
|
@click=${()=>t.onWhatsAppWait()}
|
|
1458
1458
|
>
|
|
1459
|
-
|
|
1459
|
+
等待扫描
|
|
1460
1460
|
</button>
|
|
1461
1461
|
<button
|
|
1462
1462
|
class="btn danger"
|
|
1463
1463
|
?disabled=${t.whatsappBusy}
|
|
1464
1464
|
@click=${()=>t.onWhatsAppLogout()}
|
|
1465
1465
|
>
|
|
1466
|
-
|
|
1466
|
+
退出登录
|
|
1467
1467
|
</button>
|
|
1468
1468
|
<button class="btn" @click=${()=>t.onRefresh(!0)}>
|
|
1469
|
-
|
|
1469
|
+
刷新
|
|
1470
1470
|
</button>
|
|
1471
1471
|
</div>
|
|
1472
1472
|
|
|
1473
1473
|
${$e({channelId:"whatsapp",props:t})}
|
|
1474
1474
|
</div>
|
|
1475
|
-
`}function Ch(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null;t?.googlechat;const a=t?.slack??null,o=t?.signal??null,r=t?.imessage??null,l=t?.nostr??null,d=
|
|
1475
|
+
`}function Ch(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null;t?.googlechat;const a=t?.slack??null,o=t?.signal??null,r=t?.imessage??null,l=t?.nostr??null,d=Eh(e.snapshot).map((u,g)=>({key:u,enabled:ph(u,e),order:g})).sort((u,g)=>u.enabled!==g.enabled?u.enabled?-1:1:u.order-g.order);return c`
|
|
1476
1476
|
<section class="grid grid-cols-2">
|
|
1477
|
-
${d.map(u=>
|
|
1477
|
+
${d.map(u=>Mh(u.key,e,{whatsapp:n,telegram:s,discord:i,slack:a,signal:o,imessage:r,nostr:l,channelAccounts:e.snapshot?.channelAccounts??null}))}
|
|
1478
1478
|
</section>
|
|
1479
1479
|
|
|
1480
1480
|
<section class="card" style="margin-top: 18px;">
|
|
1481
1481
|
<div class="row" style="justify-content: space-between;">
|
|
1482
1482
|
<div>
|
|
1483
|
-
<div class="card-title"
|
|
1484
|
-
<div class="card-sub"
|
|
1483
|
+
<div class="card-title">渠道健康</div>
|
|
1484
|
+
<div class="card-sub">来自网关的渠道状态快照。</div>
|
|
1485
1485
|
</div>
|
|
1486
1486
|
<div class="muted">${e.lastSuccessAt?O(e.lastSuccessAt):"n/a"}</div>
|
|
1487
1487
|
</div>
|
|
@@ -1489,31 +1489,31 @@ ${e.sidebarContent}
|
|
|
1489
1489
|
${e.lastError}
|
|
1490
1490
|
</div>`:f}
|
|
1491
1491
|
<pre class="code-block" style="margin-top: 12px;">
|
|
1492
|
-
${e.snapshot?JSON.stringify(e.snapshot,null,2):"
|
|
1492
|
+
${e.snapshot?JSON.stringify(e.snapshot,null,2):"暂无快照。"}
|
|
1493
1493
|
</pre>
|
|
1494
1494
|
</section>
|
|
1495
|
-
`}function
|
|
1495
|
+
`}function Eh(e){return e?.channelMeta?.length?e.channelMeta.map(t=>t.id):e?.channelOrder?.length?e.channelOrder:["whatsapp","telegram","discord","googlechat","slack","signal","imessage","nostr"]}function Mh(e,t,n){const s=xr(e,n.channelAccounts);switch(e){case"whatsapp":return Th({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return _h({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return mh({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return yh({props:t,accountCountLabel:s});case"slack":return Sh({props:t,slack:n.slack,accountCountLabel:s});case"signal":return kh({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return bh({props:t,imessage:n.imessage,accountCountLabel:s});case"nostr":{const i=n.channelAccounts?.nostr??[],a=i[0],o=a?.accountId??"default",r=a?.profile??null,l=t.nostrProfileAccountId===o?t.nostrProfileFormState:null,p=l?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return Ah({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:l,profileFormCallbacks:p,onEditProfile:()=>t.onNostrProfileEdit(o,r)})}default:return Ih(e,t,n.channelAccounts??{})}}function Ih(e,t,n){const s=Rh(t.snapshot,e),i=t.snapshot?.channels?.[e],a=typeof i?.configured=="boolean"?i.configured:void 0,o=typeof i?.running=="boolean"?i.running:void 0,r=typeof i?.connected=="boolean"?i.connected:void 0,l=typeof i?.lastError=="string"?i.lastError:void 0,p=n[e]??[],d=xr(e,n);return c`
|
|
1496
1496
|
<div class="card">
|
|
1497
1497
|
<div class="card-title">${s}</div>
|
|
1498
|
-
<div class="card-sub"
|
|
1498
|
+
<div class="card-sub">渠道状态和配置。</div>
|
|
1499
1499
|
${d}
|
|
1500
1500
|
|
|
1501
1501
|
${p.length>0?c`
|
|
1502
1502
|
<div class="account-card-list">
|
|
1503
|
-
${p.map(u=>
|
|
1503
|
+
${p.map(u=>Dh(u))}
|
|
1504
1504
|
</div>
|
|
1505
1505
|
`:c`
|
|
1506
1506
|
<div class="status-list" style="margin-top: 16px;">
|
|
1507
1507
|
<div>
|
|
1508
|
-
<span class="label"
|
|
1508
|
+
<span class="label">已配置</span>
|
|
1509
1509
|
<span>${a==null?"n/a":a?"Yes":"No"}</span>
|
|
1510
1510
|
</div>
|
|
1511
1511
|
<div>
|
|
1512
|
-
<span class="label"
|
|
1512
|
+
<span class="label">运行中</span>
|
|
1513
1513
|
<span>${o==null?"n/a":o?"Yes":"No"}</span>
|
|
1514
1514
|
</div>
|
|
1515
1515
|
<div>
|
|
1516
|
-
<span class="label"
|
|
1516
|
+
<span class="label">已连接</span>
|
|
1517
1517
|
<span>${r==null?"n/a":r?"Yes":"No"}</span>
|
|
1518
1518
|
</div>
|
|
1519
1519
|
</div>
|
|
@@ -1525,7 +1525,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1525
1525
|
|
|
1526
1526
|
${$e({channelId:e,props:t})}
|
|
1527
1527
|
</div>
|
|
1528
|
-
`}function Lh(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function
|
|
1528
|
+
`}function Lh(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Rh(e,t){return Lh(e)[t]?.label??e?.channelLabels?.[t]??t}const Ph=600*1e3;function Ar(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<Ph:!1}function Nh(e){return e.running?"Yes":Ar(e)?"Active":"No"}function Oh(e){return e.connected===!0?"Yes":e.connected===!1?"No":Ar(e)?"Active":"n/a"}function Dh(e){const t=Nh(e),n=Oh(e);return c`
|
|
1529
1529
|
<div class="account-card">
|
|
1530
1530
|
<div class="account-card-header">
|
|
1531
1531
|
<div class="account-card-title">${e.name||e.accountId}</div>
|
|
@@ -1533,19 +1533,19 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1533
1533
|
</div>
|
|
1534
1534
|
<div class="status-list account-card-status">
|
|
1535
1535
|
<div>
|
|
1536
|
-
<span class="label"
|
|
1536
|
+
<span class="label">运行中</span>
|
|
1537
1537
|
<span>${t}</span>
|
|
1538
1538
|
</div>
|
|
1539
1539
|
<div>
|
|
1540
|
-
<span class="label"
|
|
1540
|
+
<span class="label">已配置</span>
|
|
1541
1541
|
<span>${e.configured?"Yes":"No"}</span>
|
|
1542
1542
|
</div>
|
|
1543
1543
|
<div>
|
|
1544
|
-
<span class="label"
|
|
1544
|
+
<span class="label">已连接</span>
|
|
1545
1545
|
<span>${n}</span>
|
|
1546
1546
|
</div>
|
|
1547
1547
|
<div>
|
|
1548
|
-
<span class="label"
|
|
1548
|
+
<span class="label">最后入站</span>
|
|
1549
1549
|
<span>${e.lastInboundAt?O(e.lastInboundAt):"n/a"}</span>
|
|
1550
1550
|
</div>
|
|
1551
1551
|
${e.lastError?c`
|
|
@@ -1555,55 +1555,55 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1555
1555
|
`:f}
|
|
1556
1556
|
</div>
|
|
1557
1557
|
</div>
|
|
1558
|
-
`}function
|
|
1558
|
+
`}function Bh(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function Fh(e){const t=e.ts??null;return t?O(t):"n/a"}function kr(e){return e?`${kt(e)} (${O(e)})`:"n/a"}function Uh(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function Kh(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Hh(e){const t=e.state??{},n=t.nextRunAtMs?kt(t.nextRunAtMs):"n/a",s=t.lastRunAtMs?kt(t.lastRunAtMs):"n/a";return`${t.lastStatus??"n/a"} · next ${n} · last ${s}`}function zh(e){const t=e.schedule;return t.kind==="at"?`At ${kt(t.atMs)}`:t.kind==="every"?`Every ${go(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function jh(e){const t=e.payload;return t.kind==="systemEvent"?`System: ${t.text}`:`Agent: ${t.message}`}function Wh(e){const t=["last",...e.channels.filter(Boolean)],n=e.form.channel?.trim();n&&!t.includes(n)&&t.push(n);const s=new Set;return t.filter(i=>s.has(i)?!1:(s.add(i),!0))}function Vh(e,t){if(t==="last")return"last";const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function qh(e){const t=Wh(e);return c`
|
|
1559
1559
|
<section class="grid grid-cols-2">
|
|
1560
1560
|
<div class="card">
|
|
1561
|
-
<div class="card-title"
|
|
1562
|
-
<div class="card-sub"
|
|
1561
|
+
<div class="card-title">调度器</div>
|
|
1562
|
+
<div class="card-sub">网关定时任务调度器状态。</div>
|
|
1563
1563
|
<div class="stat-grid" style="margin-top: 16px;">
|
|
1564
1564
|
<div class="stat">
|
|
1565
|
-
<div class="stat-label"
|
|
1565
|
+
<div class="stat-label">已启用</div>
|
|
1566
1566
|
<div class="stat-value">
|
|
1567
1567
|
${e.status?e.status.enabled?"Yes":"No":"n/a"}
|
|
1568
1568
|
</div>
|
|
1569
1569
|
</div>
|
|
1570
1570
|
<div class="stat">
|
|
1571
|
-
<div class="stat-label"
|
|
1571
|
+
<div class="stat-label">任务数</div>
|
|
1572
1572
|
<div class="stat-value">${e.status?.jobs??"n/a"}</div>
|
|
1573
1573
|
</div>
|
|
1574
1574
|
<div class="stat">
|
|
1575
|
-
<div class="stat-label"
|
|
1575
|
+
<div class="stat-label">下次唤醒</div>
|
|
1576
1576
|
<div class="stat-value">${kr(e.status?.nextWakeAtMs??null)}</div>
|
|
1577
1577
|
</div>
|
|
1578
1578
|
</div>
|
|
1579
1579
|
<div class="row" style="margin-top: 12px;">
|
|
1580
1580
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
1581
|
-
${e.loading?"
|
|
1581
|
+
${e.loading?"刷新中…":"刷新"}
|
|
1582
1582
|
</button>
|
|
1583
1583
|
${e.error?c`<span class="muted">${e.error}</span>`:f}
|
|
1584
1584
|
</div>
|
|
1585
1585
|
</div>
|
|
1586
1586
|
|
|
1587
1587
|
<div class="card">
|
|
1588
|
-
<div class="card-title"
|
|
1589
|
-
<div class="card-sub"
|
|
1588
|
+
<div class="card-title">新建任务</div>
|
|
1589
|
+
<div class="card-sub">创建计划唤醒或代理运行。</div>
|
|
1590
1590
|
<div class="form-grid" style="margin-top: 16px;">
|
|
1591
1591
|
<label class="field">
|
|
1592
|
-
<span
|
|
1592
|
+
<span>名称</span>
|
|
1593
1593
|
<input
|
|
1594
1594
|
.value=${e.form.name}
|
|
1595
1595
|
@input=${n=>e.onFormChange({name:n.target.value})}
|
|
1596
1596
|
/>
|
|
1597
1597
|
</label>
|
|
1598
1598
|
<label class="field">
|
|
1599
|
-
<span
|
|
1599
|
+
<span>描述</span>
|
|
1600
1600
|
<input
|
|
1601
1601
|
.value=${e.form.description}
|
|
1602
1602
|
@input=${n=>e.onFormChange({description:n.target.value})}
|
|
1603
1603
|
/>
|
|
1604
1604
|
</label>
|
|
1605
1605
|
<label class="field">
|
|
1606
|
-
<span
|
|
1606
|
+
<span>代理 ID</span>
|
|
1607
1607
|
<input
|
|
1608
1608
|
.value=${e.form.agentId}
|
|
1609
1609
|
@input=${n=>e.onFormChange({agentId:n.target.value})}
|
|
@@ -1611,7 +1611,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1611
1611
|
/>
|
|
1612
1612
|
</label>
|
|
1613
1613
|
<label class="field checkbox">
|
|
1614
|
-
<span
|
|
1614
|
+
<span>已启用</span>
|
|
1615
1615
|
<input
|
|
1616
1616
|
type="checkbox"
|
|
1617
1617
|
.checked=${e.form.enabled}
|
|
@@ -1619,52 +1619,52 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1619
1619
|
/>
|
|
1620
1620
|
</label>
|
|
1621
1621
|
<label class="field">
|
|
1622
|
-
<span
|
|
1622
|
+
<span>计划</span>
|
|
1623
1623
|
<select
|
|
1624
1624
|
.value=${e.form.scheduleKind}
|
|
1625
1625
|
@change=${n=>e.onFormChange({scheduleKind:n.target.value})}
|
|
1626
1626
|
>
|
|
1627
|
-
<option value="every"
|
|
1628
|
-
<option value="at"
|
|
1629
|
-
<option value="cron">Cron
|
|
1627
|
+
<option value="every">每隔</option>
|
|
1628
|
+
<option value="at">定时</option>
|
|
1629
|
+
<option value="cron">Cron 表达式</option>
|
|
1630
1630
|
</select>
|
|
1631
1631
|
</label>
|
|
1632
1632
|
</div>
|
|
1633
|
-
${
|
|
1633
|
+
${Gh(e)}
|
|
1634
1634
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1635
1635
|
<label class="field">
|
|
1636
|
-
<span
|
|
1636
|
+
<span>会话</span>
|
|
1637
1637
|
<select
|
|
1638
1638
|
.value=${e.form.sessionTarget}
|
|
1639
1639
|
@change=${n=>e.onFormChange({sessionTarget:n.target.value})}
|
|
1640
1640
|
>
|
|
1641
|
-
<option value="main"
|
|
1642
|
-
<option value="isolated"
|
|
1641
|
+
<option value="main">主会话</option>
|
|
1642
|
+
<option value="isolated">隔离会话</option>
|
|
1643
1643
|
</select>
|
|
1644
1644
|
</label>
|
|
1645
1645
|
<label class="field">
|
|
1646
|
-
<span
|
|
1646
|
+
<span>唤醒模式</span>
|
|
1647
1647
|
<select
|
|
1648
1648
|
.value=${e.form.wakeMode}
|
|
1649
1649
|
@change=${n=>e.onFormChange({wakeMode:n.target.value})}
|
|
1650
1650
|
>
|
|
1651
|
-
<option value="next-heartbeat"
|
|
1652
|
-
<option value="now"
|
|
1651
|
+
<option value="next-heartbeat">下次心跳</option>
|
|
1652
|
+
<option value="now">立即</option>
|
|
1653
1653
|
</select>
|
|
1654
1654
|
</label>
|
|
1655
1655
|
<label class="field">
|
|
1656
|
-
<span
|
|
1656
|
+
<span>负载</span>
|
|
1657
1657
|
<select
|
|
1658
1658
|
.value=${e.form.payloadKind}
|
|
1659
1659
|
@change=${n=>e.onFormChange({payloadKind:n.target.value})}
|
|
1660
1660
|
>
|
|
1661
|
-
<option value="systemEvent"
|
|
1662
|
-
<option value="agentTurn"
|
|
1661
|
+
<option value="systemEvent">系统事件</option>
|
|
1662
|
+
<option value="agentTurn">代理轮次</option>
|
|
1663
1663
|
</select>
|
|
1664
1664
|
</label>
|
|
1665
1665
|
</div>
|
|
1666
1666
|
<label class="field" style="margin-top: 12px;">
|
|
1667
|
-
<span>${e.form.payloadKind==="systemEvent"?"
|
|
1667
|
+
<span>${e.form.payloadKind==="systemEvent"?"系统文本":"代理消息"}</span>
|
|
1668
1668
|
<textarea
|
|
1669
1669
|
.value=${e.form.payloadText}
|
|
1670
1670
|
@input=${n=>e.onFormChange({payloadText:n.target.value})}
|
|
@@ -1674,7 +1674,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1674
1674
|
${e.form.payloadKind==="agentTurn"?c`
|
|
1675
1675
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1676
1676
|
<label class="field checkbox">
|
|
1677
|
-
<span
|
|
1677
|
+
<span>投递</span>
|
|
1678
1678
|
<input
|
|
1679
1679
|
type="checkbox"
|
|
1680
1680
|
.checked=${e.form.deliver}
|
|
@@ -1682,18 +1682,18 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1682
1682
|
/>
|
|
1683
1683
|
</label>
|
|
1684
1684
|
<label class="field">
|
|
1685
|
-
<span
|
|
1685
|
+
<span>渠道</span>
|
|
1686
1686
|
<select
|
|
1687
1687
|
.value=${e.form.channel||"last"}
|
|
1688
1688
|
@change=${n=>e.onFormChange({channel:n.target.value})}
|
|
1689
1689
|
>
|
|
1690
1690
|
${t.map(n=>c`<option value=${n}>
|
|
1691
|
-
${
|
|
1691
|
+
${Vh(e,n)}
|
|
1692
1692
|
</option>`)}
|
|
1693
1693
|
</select>
|
|
1694
1694
|
</label>
|
|
1695
1695
|
<label class="field">
|
|
1696
|
-
<span
|
|
1696
|
+
<span>发送至</span>
|
|
1697
1697
|
<input
|
|
1698
1698
|
.value=${e.form.to}
|
|
1699
1699
|
@input=${n=>e.onFormChange({to:n.target.value})}
|
|
@@ -1701,7 +1701,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1701
1701
|
/>
|
|
1702
1702
|
</label>
|
|
1703
1703
|
<label class="field">
|
|
1704
|
-
<span
|
|
1704
|
+
<span>超时(秒)</span>
|
|
1705
1705
|
<input
|
|
1706
1706
|
.value=${e.form.timeoutSeconds}
|
|
1707
1707
|
@input=${n=>e.onFormChange({timeoutSeconds:n.target.value})}
|
|
@@ -1709,7 +1709,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1709
1709
|
</label>
|
|
1710
1710
|
${e.form.sessionTarget==="isolated"?c`
|
|
1711
1711
|
<label class="field">
|
|
1712
|
-
<span
|
|
1712
|
+
<span>发布到主会话前缀</span>
|
|
1713
1713
|
<input
|
|
1714
1714
|
.value=${e.form.postToMainPrefix}
|
|
1715
1715
|
@input=${n=>e.onFormChange({postToMainPrefix:n.target.value})}
|
|
@@ -1720,38 +1720,38 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1720
1720
|
`:f}
|
|
1721
1721
|
<div class="row" style="margin-top: 14px;">
|
|
1722
1722
|
<button class="btn primary" ?disabled=${e.busy} @click=${e.onAdd}>
|
|
1723
|
-
${e.busy?"
|
|
1723
|
+
${e.busy?"保存中…":"添加任务"}
|
|
1724
1724
|
</button>
|
|
1725
1725
|
</div>
|
|
1726
1726
|
</div>
|
|
1727
1727
|
</section>
|
|
1728
1728
|
|
|
1729
1729
|
<section class="card" style="margin-top: 18px;">
|
|
1730
|
-
<div class="card-title"
|
|
1731
|
-
<div class="card-sub"
|
|
1732
|
-
${e.jobs.length===0?c`<div class="muted" style="margin-top: 12px;"
|
|
1730
|
+
<div class="card-title">任务列表</div>
|
|
1731
|
+
<div class="card-sub">网关中存储的所有计划任务。</div>
|
|
1732
|
+
${e.jobs.length===0?c`<div class="muted" style="margin-top: 12px;">暂无任务。</div>`:c`
|
|
1733
1733
|
<div class="list" style="margin-top: 12px;">
|
|
1734
|
-
${e.jobs.map(n=>
|
|
1734
|
+
${e.jobs.map(n=>Yh(n,e))}
|
|
1735
1735
|
</div>
|
|
1736
1736
|
`}
|
|
1737
1737
|
</section>
|
|
1738
1738
|
|
|
1739
1739
|
<section class="card" style="margin-top: 18px;">
|
|
1740
|
-
<div class="card-title"
|
|
1740
|
+
<div class="card-title">运行历史</div>
|
|
1741
1741
|
<div class="card-sub">Latest runs for ${e.runsJobId??"(select a job)"}.</div>
|
|
1742
1742
|
${e.runsJobId==null?c`
|
|
1743
1743
|
<div class="muted" style="margin-top: 12px;">
|
|
1744
|
-
|
|
1744
|
+
选择一个任务查看运行历史。
|
|
1745
1745
|
</div>
|
|
1746
|
-
`:e.runs.length===0?c`<div class="muted" style="margin-top: 12px;"
|
|
1746
|
+
`:e.runs.length===0?c`<div class="muted" style="margin-top: 12px;">暂无运行记录。</div>`:c`
|
|
1747
1747
|
<div class="list" style="margin-top: 12px;">
|
|
1748
|
-
${e.runs.map(n=>
|
|
1748
|
+
${e.runs.map(n=>Qh(n))}
|
|
1749
1749
|
</div>
|
|
1750
1750
|
`}
|
|
1751
1751
|
</section>
|
|
1752
|
-
`}function
|
|
1752
|
+
`}function Gh(e){const t=e.form;return t.scheduleKind==="at"?c`
|
|
1753
1753
|
<label class="field" style="margin-top: 12px;">
|
|
1754
|
-
<span
|
|
1754
|
+
<span>运行时间</span>
|
|
1755
1755
|
<input
|
|
1756
1756
|
type="datetime-local"
|
|
1757
1757
|
.value=${t.scheduleAt}
|
|
@@ -1761,47 +1761,47 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1761
1761
|
`:t.scheduleKind==="every"?c`
|
|
1762
1762
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1763
1763
|
<label class="field">
|
|
1764
|
-
<span
|
|
1764
|
+
<span>每隔</span>
|
|
1765
1765
|
<input
|
|
1766
1766
|
.value=${t.everyAmount}
|
|
1767
1767
|
@input=${n=>e.onFormChange({everyAmount:n.target.value})}
|
|
1768
1768
|
/>
|
|
1769
1769
|
</label>
|
|
1770
1770
|
<label class="field">
|
|
1771
|
-
<span
|
|
1771
|
+
<span>单位</span>
|
|
1772
1772
|
<select
|
|
1773
1773
|
.value=${t.everyUnit}
|
|
1774
1774
|
@change=${n=>e.onFormChange({everyUnit:n.target.value})}
|
|
1775
1775
|
>
|
|
1776
|
-
<option value="minutes"
|
|
1777
|
-
<option value="hours"
|
|
1778
|
-
<option value="days"
|
|
1776
|
+
<option value="minutes">分钟</option>
|
|
1777
|
+
<option value="hours">小时</option>
|
|
1778
|
+
<option value="days">天</option>
|
|
1779
1779
|
</select>
|
|
1780
1780
|
</label>
|
|
1781
1781
|
</div>
|
|
1782
1782
|
`:c`
|
|
1783
1783
|
<div class="form-grid" style="margin-top: 12px;">
|
|
1784
1784
|
<label class="field">
|
|
1785
|
-
<span
|
|
1785
|
+
<span>表达式</span>
|
|
1786
1786
|
<input
|
|
1787
1787
|
.value=${t.cronExpr}
|
|
1788
1788
|
@input=${n=>e.onFormChange({cronExpr:n.target.value})}
|
|
1789
1789
|
/>
|
|
1790
1790
|
</label>
|
|
1791
1791
|
<label class="field">
|
|
1792
|
-
<span
|
|
1792
|
+
<span>时区(可选)</span>
|
|
1793
1793
|
<input
|
|
1794
1794
|
.value=${t.cronTz}
|
|
1795
1795
|
@input=${n=>e.onFormChange({cronTz:n.target.value})}
|
|
1796
1796
|
/>
|
|
1797
1797
|
</label>
|
|
1798
1798
|
</div>
|
|
1799
|
-
`}function
|
|
1799
|
+
`}function Yh(e,t){const s=`list-item list-item-clickable${t.runsJobId===e.id?" list-item-selected":""}`;return c`
|
|
1800
1800
|
<div class=${s} @click=${()=>t.onLoadRuns(e.id)}>
|
|
1801
1801
|
<div class="list-main">
|
|
1802
1802
|
<div class="list-title">${e.name}</div>
|
|
1803
|
-
<div class="list-sub">${
|
|
1804
|
-
<div class="muted">${
|
|
1803
|
+
<div class="list-sub">${zh(e)}</div>
|
|
1804
|
+
<div class="muted">${jh(e)}</div>
|
|
1805
1805
|
${e.agentId?c`<div class="muted">Agent: ${e.agentId}</div>`:f}
|
|
1806
1806
|
<div class="chip-row" style="margin-top: 6px;">
|
|
1807
1807
|
<span class="chip">${e.enabled?"enabled":"disabled"}</span>
|
|
@@ -1810,40 +1810,40 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1810
1810
|
</div>
|
|
1811
1811
|
</div>
|
|
1812
1812
|
<div class="list-meta">
|
|
1813
|
-
<div>${
|
|
1813
|
+
<div>${Hh(e)}</div>
|
|
1814
1814
|
<div class="row" style="justify-content: flex-end; margin-top: 8px;">
|
|
1815
1815
|
<button
|
|
1816
1816
|
class="btn"
|
|
1817
1817
|
?disabled=${t.busy}
|
|
1818
1818
|
@click=${i=>{i.stopPropagation(),t.onToggle(e,!e.enabled)}}
|
|
1819
1819
|
>
|
|
1820
|
-
${e.enabled?"
|
|
1820
|
+
${e.enabled?"禁用":"启用"}
|
|
1821
1821
|
</button>
|
|
1822
1822
|
<button
|
|
1823
1823
|
class="btn"
|
|
1824
1824
|
?disabled=${t.busy}
|
|
1825
1825
|
@click=${i=>{i.stopPropagation(),t.onRun(e)}}
|
|
1826
1826
|
>
|
|
1827
|
-
|
|
1827
|
+
运行
|
|
1828
1828
|
</button>
|
|
1829
1829
|
<button
|
|
1830
1830
|
class="btn"
|
|
1831
1831
|
?disabled=${t.busy}
|
|
1832
1832
|
@click=${i=>{i.stopPropagation(),t.onLoadRuns(e.id)}}
|
|
1833
1833
|
>
|
|
1834
|
-
|
|
1834
|
+
历史
|
|
1835
1835
|
</button>
|
|
1836
1836
|
<button
|
|
1837
1837
|
class="btn danger"
|
|
1838
1838
|
?disabled=${t.busy}
|
|
1839
1839
|
@click=${i=>{i.stopPropagation(),t.onRemove(e)}}
|
|
1840
1840
|
>
|
|
1841
|
-
|
|
1841
|
+
删除
|
|
1842
1842
|
</button>
|
|
1843
1843
|
</div>
|
|
1844
1844
|
</div>
|
|
1845
1845
|
</div>
|
|
1846
|
-
`}function
|
|
1846
|
+
`}function Qh(e){return c`
|
|
1847
1847
|
<div class="list-item">
|
|
1848
1848
|
<div class="list-main">
|
|
1849
1849
|
<div class="list-title">${e.status}</div>
|
|
@@ -1855,21 +1855,21 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1855
1855
|
${e.error?c`<div class="muted">${e.error}</div>`:f}
|
|
1856
1856
|
</div>
|
|
1857
1857
|
</div>
|
|
1858
|
-
`}function
|
|
1858
|
+
`}function Zh(e){const n=(e.status&&typeof e.status=="object"?e.status.securityAudit:null)?.summary??null,s=n?.critical??0,i=n?.warn??0,a=n?.info??0,o=s>0?"danger":i>0?"warn":"success",r=s>0?`${s} critical`:i>0?`${i} warnings`:"No critical issues";return c`
|
|
1859
1859
|
<section class="grid grid-cols-2">
|
|
1860
1860
|
<div class="card">
|
|
1861
1861
|
<div class="row" style="justify-content: space-between;">
|
|
1862
1862
|
<div>
|
|
1863
|
-
<div class="card-title"
|
|
1864
|
-
<div class="card-sub"
|
|
1863
|
+
<div class="card-title">快照</div>
|
|
1864
|
+
<div class="card-sub">状态、健康和心跳数据。</div>
|
|
1865
1865
|
</div>
|
|
1866
1866
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
1867
|
-
${e.loading?"
|
|
1867
|
+
${e.loading?"刷新中…":"刷新"}
|
|
1868
1868
|
</button>
|
|
1869
1869
|
</div>
|
|
1870
1870
|
<div class="stack" style="margin-top: 12px;">
|
|
1871
1871
|
<div>
|
|
1872
|
-
<div class="muted"
|
|
1872
|
+
<div class="muted">状态</div>
|
|
1873
1873
|
${n?c`<div class="callout ${o}" style="margin-top: 8px;">
|
|
1874
1874
|
Security audit: ${r}${a>0?` · ${a} info`:""}. Run
|
|
1875
1875
|
<span class="mono">openclaw security audit --deep</span> for details.
|
|
@@ -1877,22 +1877,22 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1877
1877
|
<pre class="code-block">${JSON.stringify(e.status??{},null,2)}</pre>
|
|
1878
1878
|
</div>
|
|
1879
1879
|
<div>
|
|
1880
|
-
<div class="muted"
|
|
1880
|
+
<div class="muted">健康</div>
|
|
1881
1881
|
<pre class="code-block">${JSON.stringify(e.health??{},null,2)}</pre>
|
|
1882
1882
|
</div>
|
|
1883
1883
|
<div>
|
|
1884
|
-
<div class="muted"
|
|
1884
|
+
<div class="muted">最后心跳</div>
|
|
1885
1885
|
<pre class="code-block">${JSON.stringify(e.heartbeat??{},null,2)}</pre>
|
|
1886
1886
|
</div>
|
|
1887
1887
|
</div>
|
|
1888
1888
|
</div>
|
|
1889
1889
|
|
|
1890
1890
|
<div class="card">
|
|
1891
|
-
<div class="card-title"
|
|
1892
|
-
<div class="card-sub"
|
|
1891
|
+
<div class="card-title">手动 RPC</div>
|
|
1892
|
+
<div class="card-sub">使用 JSON 参数发送原始网关方法。</div>
|
|
1893
1893
|
<div class="form-grid" style="margin-top: 16px;">
|
|
1894
1894
|
<label class="field">
|
|
1895
|
-
<span
|
|
1895
|
+
<span>方法</span>
|
|
1896
1896
|
<input
|
|
1897
1897
|
.value=${e.callMethod}
|
|
1898
1898
|
@input=${l=>e.onCallMethodChange(l.target.value)}
|
|
@@ -1900,7 +1900,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1900
1900
|
/>
|
|
1901
1901
|
</label>
|
|
1902
1902
|
<label class="field">
|
|
1903
|
-
<span
|
|
1903
|
+
<span>参数 (JSON)</span>
|
|
1904
1904
|
<textarea
|
|
1905
1905
|
.value=${e.callParams}
|
|
1906
1906
|
@input=${l=>e.onCallParamsChange(l.target.value)}
|
|
@@ -1909,7 +1909,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1909
1909
|
</label>
|
|
1910
1910
|
</div>
|
|
1911
1911
|
<div class="row" style="margin-top: 12px;">
|
|
1912
|
-
<button class="btn primary" @click=${e.onCall}
|
|
1912
|
+
<button class="btn primary" @click=${e.onCall}>调用</button>
|
|
1913
1913
|
</div>
|
|
1914
1914
|
${e.callError?c`<div class="callout danger" style="margin-top: 12px;">
|
|
1915
1915
|
${e.callError}
|
|
@@ -1919,15 +1919,15 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1919
1919
|
</section>
|
|
1920
1920
|
|
|
1921
1921
|
<section class="card" style="margin-top: 18px;">
|
|
1922
|
-
<div class="card-title"
|
|
1923
|
-
<div class="card-sub"
|
|
1922
|
+
<div class="card-title">模型</div>
|
|
1923
|
+
<div class="card-sub">来自 models.list 的模型目录。</div>
|
|
1924
1924
|
<pre class="code-block" style="margin-top: 12px;">${JSON.stringify(e.models??[],null,2)}</pre>
|
|
1925
1925
|
</section>
|
|
1926
1926
|
|
|
1927
1927
|
<section class="card" style="margin-top: 18px;">
|
|
1928
|
-
<div class="card-title"
|
|
1929
|
-
<div class="card-sub"
|
|
1930
|
-
${e.eventLog.length===0?c`<div class="muted" style="margin-top: 12px;"
|
|
1928
|
+
<div class="card-title">事件日志</div>
|
|
1929
|
+
<div class="card-sub">最新网关事件。</div>
|
|
1930
|
+
${e.eventLog.length===0?c`<div class="muted" style="margin-top: 12px;">暂无事件。</div>`:c`
|
|
1931
1931
|
<div class="list" style="margin-top: 12px;">
|
|
1932
1932
|
${e.eventLog.map(l=>c`
|
|
1933
1933
|
<div class="list-item">
|
|
@@ -1936,22 +1936,22 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1936
1936
|
<div class="list-sub">${new Date(l.ts).toLocaleTimeString()}</div>
|
|
1937
1937
|
</div>
|
|
1938
1938
|
<div class="list-meta">
|
|
1939
|
-
<pre class="code-block">${
|
|
1939
|
+
<pre class="code-block">${Kh(l.payload)}</pre>
|
|
1940
1940
|
</div>
|
|
1941
1941
|
</div>
|
|
1942
1942
|
`)}
|
|
1943
1943
|
</div>
|
|
1944
1944
|
`}
|
|
1945
1945
|
</section>
|
|
1946
|
-
`}function
|
|
1946
|
+
`}function Xh(e){return c`
|
|
1947
1947
|
<section class="card">
|
|
1948
1948
|
<div class="row" style="justify-content: space-between;">
|
|
1949
1949
|
<div>
|
|
1950
|
-
<div class="card-title"
|
|
1951
|
-
<div class="card-sub"
|
|
1950
|
+
<div class="card-title">已连接实例</div>
|
|
1951
|
+
<div class="card-sub">来自网关和客户端的存在信标。</div>
|
|
1952
1952
|
</div>
|
|
1953
1953
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
1954
|
-
${e.loading?"
|
|
1954
|
+
${e.loading?"加载中…":"刷新"}
|
|
1955
1955
|
</button>
|
|
1956
1956
|
</div>
|
|
1957
1957
|
${e.lastError?c`<div class="callout danger" style="margin-top: 12px;">
|
|
@@ -1961,14 +1961,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1961
1961
|
${e.statusMessage}
|
|
1962
1962
|
</div>`:f}
|
|
1963
1963
|
<div class="list" style="margin-top: 16px;">
|
|
1964
|
-
${e.entries.length===0?c`<div class="muted"
|
|
1964
|
+
${e.entries.length===0?c`<div class="muted">暂无实例报告。</div>`:e.entries.map(t=>Jh(t))}
|
|
1965
1965
|
</div>
|
|
1966
1966
|
</section>
|
|
1967
1967
|
`}function Jh(e){const t=e.lastInputSeconds!=null?`${e.lastInputSeconds}s ago`:"n/a",n=e.mode??"unknown",s=Array.isArray(e.roles)?e.roles.filter(Boolean):[],i=Array.isArray(e.scopes)?e.scopes.filter(Boolean):[],a=i.length>0?i.length>3?`${i.length} scopes`:`scopes: ${i.join(", ")}`:null;return c`
|
|
1968
1968
|
<div class="list-item">
|
|
1969
1969
|
<div class="list-main">
|
|
1970
1970
|
<div class="list-title">${e.host??"unknown host"}</div>
|
|
1971
|
-
<div class="list-sub">${
|
|
1971
|
+
<div class="list-sub">${Bh(e)}</div>
|
|
1972
1972
|
<div class="chip-row">
|
|
1973
1973
|
<span class="chip">${n}</span>
|
|
1974
1974
|
${s.map(o=>c`<span class="chip">${o}</span>`)}
|
|
@@ -1980,43 +1980,43 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
1980
1980
|
</div>
|
|
1981
1981
|
</div>
|
|
1982
1982
|
<div class="list-meta">
|
|
1983
|
-
<div>${
|
|
1984
|
-
<div class="muted"
|
|
1985
|
-
<div class="muted"
|
|
1983
|
+
<div>${Fh(e)}</div>
|
|
1984
|
+
<div class="muted">最后输入 ${t}</div>
|
|
1985
|
+
<div class="muted">原因 ${e.reason??""}</div>
|
|
1986
1986
|
</div>
|
|
1987
1987
|
</div>
|
|
1988
|
-
`}const Qa=["trace","debug","info","warn","error","fatal"];function
|
|
1988
|
+
`}const Qa=["trace","debug","info","warn","error","fatal"];function ef(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function tf(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function nf(e){const t=e.filterText.trim().toLowerCase(),n=Qa.some(a=>!e.levelFilters[a]),s=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:tf(a,t)),i=t||n?"filtered":"visible";return c`
|
|
1989
1989
|
<section class="card">
|
|
1990
1990
|
<div class="row" style="justify-content: space-between;">
|
|
1991
1991
|
<div>
|
|
1992
|
-
<div class="card-title"
|
|
1993
|
-
<div class="card-sub"
|
|
1992
|
+
<div class="card-title">日志</div>
|
|
1993
|
+
<div class="card-sub">网关文件日志 (JSONL)。</div>
|
|
1994
1994
|
</div>
|
|
1995
1995
|
<div class="row" style="gap: 8px;">
|
|
1996
1996
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
1997
|
-
${e.loading?"
|
|
1997
|
+
${e.loading?"加载中…":"刷新"}
|
|
1998
1998
|
</button>
|
|
1999
1999
|
<button
|
|
2000
2000
|
class="btn"
|
|
2001
2001
|
?disabled=${s.length===0}
|
|
2002
2002
|
@click=${()=>e.onExport(s.map(a=>a.raw),i)}
|
|
2003
2003
|
>
|
|
2004
|
-
|
|
2004
|
+
导出 ${i}
|
|
2005
2005
|
</button>
|
|
2006
2006
|
</div>
|
|
2007
2007
|
</div>
|
|
2008
2008
|
|
|
2009
2009
|
<div class="filters" style="margin-top: 14px;">
|
|
2010
2010
|
<label class="field" style="min-width: 220px;">
|
|
2011
|
-
<span
|
|
2011
|
+
<span>筛选</span>
|
|
2012
2012
|
<input
|
|
2013
2013
|
.value=${e.filterText}
|
|
2014
2014
|
@input=${a=>e.onFilterTextChange(a.target.value)}
|
|
2015
|
-
placeholder="
|
|
2015
|
+
placeholder="搜索日志"
|
|
2016
2016
|
/>
|
|
2017
2017
|
</label>
|
|
2018
2018
|
<label class="field checkbox">
|
|
2019
|
-
<span
|
|
2019
|
+
<span>自动跟踪</span>
|
|
2020
2020
|
<input
|
|
2021
2021
|
type="checkbox"
|
|
2022
2022
|
.checked=${e.autoFollow}
|
|
@@ -2040,14 +2040,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2040
2040
|
|
|
2041
2041
|
${e.file?c`<div class="muted" style="margin-top: 10px;">File: ${e.file}</div>`:f}
|
|
2042
2042
|
${e.truncated?c`<div class="callout" style="margin-top: 10px;">
|
|
2043
|
-
|
|
2043
|
+
日志输出已截断;显示最新部分。
|
|
2044
2044
|
</div>`:f}
|
|
2045
2045
|
${e.error?c`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:f}
|
|
2046
2046
|
|
|
2047
2047
|
<div class="log-stream" style="margin-top: 12px;" @scroll=${e.onScroll}>
|
|
2048
|
-
${s.length===0?c`<div class="muted" style="padding: 12px;"
|
|
2048
|
+
${s.length===0?c`<div class="muted" style="padding: 12px;">暂无日志条目。</div>`:s.map(a=>c`
|
|
2049
2049
|
<div class="log-row">
|
|
2050
|
-
<div class="log-time mono">${
|
|
2050
|
+
<div class="log-time mono">${ef(a.time)}</div>
|
|
2051
2051
|
<div class="log-level ${a.level??""}">${a.level??""}</div>
|
|
2052
2052
|
<div class="log-subsystem mono">${a.subsystem??""}</div>
|
|
2053
2053
|
<div class="log-message mono">${a.message??a.raw}</div>
|
|
@@ -2055,49 +2055,49 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2055
2055
|
`)}
|
|
2056
2056
|
</div>
|
|
2057
2057
|
</section>
|
|
2058
|
-
`}function
|
|
2059
|
-
${
|
|
2060
|
-
${
|
|
2061
|
-
${
|
|
2058
|
+
`}function sf(e){const t=df(e),n=vf(e);return c`
|
|
2059
|
+
${yf(n)}
|
|
2060
|
+
${mf(t)}
|
|
2061
|
+
${af(e)}
|
|
2062
2062
|
<section class="card">
|
|
2063
2063
|
<div class="row" style="justify-content: space-between;">
|
|
2064
2064
|
<div>
|
|
2065
|
-
<div class="card-title"
|
|
2066
|
-
<div class="card-sub"
|
|
2065
|
+
<div class="card-title">节点</div>
|
|
2066
|
+
<div class="card-sub">配对设备和实时链接。</div>
|
|
2067
2067
|
</div>
|
|
2068
2068
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
2069
|
-
${e.loading?"
|
|
2069
|
+
${e.loading?"加载中…":"刷新"}
|
|
2070
2070
|
</button>
|
|
2071
2071
|
</div>
|
|
2072
2072
|
<div class="list" style="margin-top: 16px;">
|
|
2073
|
-
${e.nodes.length===0?c`<div class="muted"
|
|
2073
|
+
${e.nodes.length===0?c`<div class="muted">未找到节点。</div>`:e.nodes.map(s=>Cf(s))}
|
|
2074
2074
|
</div>
|
|
2075
2075
|
</section>
|
|
2076
|
-
`}function
|
|
2076
|
+
`}function af(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],s=Array.isArray(t.paired)?t.paired:[];return c`
|
|
2077
2077
|
<section class="card">
|
|
2078
2078
|
<div class="row" style="justify-content: space-between;">
|
|
2079
2079
|
<div>
|
|
2080
|
-
<div class="card-title"
|
|
2081
|
-
<div class="card-sub"
|
|
2080
|
+
<div class="card-title">设备</div>
|
|
2081
|
+
<div class="card-sub">配对请求 + 角色令牌。</div>
|
|
2082
2082
|
</div>
|
|
2083
2083
|
<button class="btn" ?disabled=${e.devicesLoading} @click=${e.onDevicesRefresh}>
|
|
2084
|
-
${e.devicesLoading?"
|
|
2084
|
+
${e.devicesLoading?"加载中…":"刷新"}
|
|
2085
2085
|
</button>
|
|
2086
2086
|
</div>
|
|
2087
2087
|
${e.devicesError?c`<div class="callout danger" style="margin-top: 12px;">${e.devicesError}</div>`:f}
|
|
2088
2088
|
<div class="list" style="margin-top: 16px;">
|
|
2089
2089
|
${n.length>0?c`
|
|
2090
|
-
<div class="muted" style="margin-bottom: 8px;"
|
|
2091
|
-
${n.map(i=>
|
|
2090
|
+
<div class="muted" style="margin-bottom: 8px;">待处理</div>
|
|
2091
|
+
${n.map(i=>of(i,e))}
|
|
2092
2092
|
`:f}
|
|
2093
2093
|
${s.length>0?c`
|
|
2094
|
-
<div class="muted" style="margin-top: 12px; margin-bottom: 8px;"
|
|
2095
|
-
${s.map(i=>
|
|
2094
|
+
<div class="muted" style="margin-top: 12px; margin-bottom: 8px;">已配对</div>
|
|
2095
|
+
${s.map(i=>rf(i,e))}
|
|
2096
2096
|
`:f}
|
|
2097
|
-
${n.length===0&&s.length===0?c`<div class="muted"
|
|
2097
|
+
${n.length===0&&s.length===0?c`<div class="muted">没有配对设备。</div>`:f}
|
|
2098
2098
|
</div>
|
|
2099
2099
|
</section>
|
|
2100
|
-
`}function
|
|
2100
|
+
`}function of(e,t){const n=e.displayName?.trim()||e.deviceId,s=typeof e.ts=="number"?O(e.ts):"n/a",i=e.role?.trim()?`role: ${e.role}`:"role: -",a=e.isRepair?" · repair":"",o=e.remoteIp?` · ${e.remoteIp}`:"";return c`
|
|
2101
2101
|
<div class="list-item">
|
|
2102
2102
|
<div class="list-main">
|
|
2103
2103
|
<div class="list-title">${n}</div>
|
|
@@ -2108,54 +2108,54 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2108
2108
|
</div>
|
|
2109
2109
|
<div class="list-meta">
|
|
2110
2110
|
<div class="row" style="justify-content: flex-end; gap: 8px; flex-wrap: wrap;">
|
|
2111
|
-
<button class="btn btn--sm primary" @click=${()=>t.
|
|
2112
|
-
|
|
2111
|
+
<button class="btn btn--sm primary" @click=${()=>t.onDevice批准(e.requestId)}>
|
|
2112
|
+
批准
|
|
2113
2113
|
</button>
|
|
2114
|
-
<button class="btn btn--sm" @click=${()=>t.
|
|
2115
|
-
|
|
2114
|
+
<button class="btn btn--sm" @click=${()=>t.onDevice拒绝(e.requestId)}>
|
|
2115
|
+
拒绝
|
|
2116
2116
|
</button>
|
|
2117
2117
|
</div>
|
|
2118
2118
|
</div>
|
|
2119
2119
|
</div>
|
|
2120
|
-
`}function
|
|
2120
|
+
`}function rf(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${ls(e.roles)}`,a=`scopes: ${ls(e.scopes)}`,o=Array.isArray(e.tokens)?e.tokens:[];return c`
|
|
2121
2121
|
<div class="list-item">
|
|
2122
2122
|
<div class="list-main">
|
|
2123
2123
|
<div class="list-title">${n}</div>
|
|
2124
2124
|
<div class="list-sub">${e.deviceId}${s}</div>
|
|
2125
2125
|
<div class="muted" style="margin-top: 6px;">${i} · ${a}</div>
|
|
2126
|
-
${o.length===0?c`<div class="muted" style="margin-top: 6px;"
|
|
2127
|
-
<div class="muted" style="margin-top: 10px;"
|
|
2126
|
+
${o.length===0?c`<div class="muted" style="margin-top: 6px;">令牌:无</div>`:c`
|
|
2127
|
+
<div class="muted" style="margin-top: 10px;">令牌</div>
|
|
2128
2128
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 6px;">
|
|
2129
|
-
${o.map(r=>
|
|
2129
|
+
${o.map(r=>lf(e.deviceId,r,t))}
|
|
2130
2130
|
</div>
|
|
2131
2131
|
`}
|
|
2132
2132
|
</div>
|
|
2133
2133
|
</div>
|
|
2134
|
-
`}function
|
|
2134
|
+
`}function lf(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${ls(t.scopes)}`,a=O(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return c`
|
|
2135
2135
|
<div class="row" style="justify-content: space-between; gap: 8px;">
|
|
2136
2136
|
<div class="list-sub">${t.role} · ${s} · ${i} · ${a}</div>
|
|
2137
2137
|
<div class="row" style="justify-content: flex-end; gap: 6px; flex-wrap: wrap;">
|
|
2138
2138
|
<button
|
|
2139
2139
|
class="btn btn--sm"
|
|
2140
|
-
@click=${()=>n.
|
|
2140
|
+
@click=${()=>n.onDevice轮换(e,t.role,t.scopes)}
|
|
2141
2141
|
>
|
|
2142
|
-
|
|
2142
|
+
轮换
|
|
2143
2143
|
</button>
|
|
2144
2144
|
${t.revokedAtMs?f:c`
|
|
2145
2145
|
<button
|
|
2146
2146
|
class="btn btn--sm danger"
|
|
2147
|
-
@click=${()=>n.
|
|
2147
|
+
@click=${()=>n.onDevice撤销(e,t.role)}
|
|
2148
2148
|
>
|
|
2149
|
-
|
|
2149
|
+
撤销
|
|
2150
2150
|
</button>
|
|
2151
2151
|
`}
|
|
2152
2152
|
</div>
|
|
2153
2153
|
</div>
|
|
2154
|
-
`}const Ae="__defaults__",Za=[{value:"deny",label:"
|
|
2154
|
+
`}const Ae="__defaults__",Za=[{value:"deny",label:"拒绝"},{value:"allowlist",label:"白名单"},{value:"full",label:"完全"}],cf=[{value:"off",label:"关闭"},{value:"on-miss",label:"未命中时"},{value:"always",label:"始终"}];function df(e){const t=e.configForm,n=Sf(e.nodes),{defaultBinding:s,agents:i}=Tf(t),a=!!t,o=e.configSaving||e.configFormMode==="raw";return{ready:a,disabled:o,configDirty:e.configDirty,configLoading:e.configLoading,configSaving:e.configSaving,defaultBinding:s,agents:i,nodes:n,onBindDefault:e.onBindDefault,onBindAgent:e.onBindAgent,onSave:e.onSaveBindings,onLoadConfig:e.onLoadConfig,formMode:e.configFormMode}}function Xa(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function uf(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function pf(e){const t=e?.defaults??{};return{security:Xa(t.security),ask:uf(t.ask),askFallback:Xa(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function hf(e){const t=e?.agents??{},n=Array.isArray(t.list)?t.list:[],s=[];return n.forEach(i=>{if(!i||typeof i!="object")return;const a=i,o=typeof a.id=="string"?a.id.trim():"";if(!o)return;const r=typeof a.name=="string"?a.name.trim():void 0,l=a.default===!0;s.push({id:o,name:r||void 0,isDefault:l})}),s}function ff(e,t){const n=hf(e),s=Object.keys(t?.agents??{}),i=new Map;n.forEach(o=>i.set(o.id,o)),s.forEach(o=>{i.has(o)||i.set(o,{id:o})});const a=Array.from(i.values());return a.length===0&&a.push({id:"main",isDefault:!0}),a.sort((o,r)=>{if(o.isDefault&&!r.isDefault)return-1;if(!o.isDefault&&r.isDefault)return 1;const l=o.name?.trim()?o.name:o.id,p=r.name?.trim()?r.name:r.id;return l.localeCompare(p)}),a}function gf(e,t){return e===Ae?Ae:e&&t.some(n=>n.id===e)?e:Ae}function vf(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=pf(t),i=ff(e.configForm,t),a=_f(e.nodes),o=e.execApprovalsTarget;let r=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&r&&!a.some(u=>u.id===r)&&(r=null);const l=gf(e.execApprovalsSelectedAgent,i),p=l!==Ae?(t?.agents??{})[l]??null:null,d=Array.isArray(p?.allowlist)?p.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:l,selectedAgent:p,agents:i,allowlist:d,target:o,targetNodeId:r,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,on移除:e.onExecApprovals移除,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function mf(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return c`
|
|
2155
2155
|
<section class="card">
|
|
2156
2156
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
2157
2157
|
<div>
|
|
2158
|
-
<div class="card-title"
|
|
2158
|
+
<div class="card-title">执行节点绑定</div>
|
|
2159
2159
|
<div class="card-sub">
|
|
2160
2160
|
Pin agents to a specific node when using <span class="mono">exec host=node</span>.
|
|
2161
2161
|
</div>
|
|
@@ -2165,7 +2165,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2165
2165
|
?disabled=${e.disabled||!e.configDirty}
|
|
2166
2166
|
@click=${e.onSave}
|
|
2167
2167
|
>
|
|
2168
|
-
${e.configSaving?"
|
|
2168
|
+
${e.configSaving?"保存中…":"保存"}
|
|
2169
2169
|
</button>
|
|
2170
2170
|
</div>
|
|
2171
2171
|
|
|
@@ -2177,17 +2177,17 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2177
2177
|
<div class="list" style="margin-top: 16px;">
|
|
2178
2178
|
<div class="list-item">
|
|
2179
2179
|
<div class="list-main">
|
|
2180
|
-
<div class="list-title"
|
|
2181
|
-
<div class="list-sub"
|
|
2180
|
+
<div class="list-title">默认绑定</div>
|
|
2181
|
+
<div class="list-sub">当代理未覆盖节点绑定时使用。</div>
|
|
2182
2182
|
</div>
|
|
2183
2183
|
<div class="list-meta">
|
|
2184
2184
|
<label class="field">
|
|
2185
|
-
<span
|
|
2185
|
+
<span>节点</span>
|
|
2186
2186
|
<select
|
|
2187
2187
|
?disabled=${e.disabled||!t}
|
|
2188
2188
|
@change=${s=>{const a=s.target.value.trim();e.onBindDefault(a||null)}}
|
|
2189
2189
|
>
|
|
2190
|
-
<option value="" ?selected=${n===""}
|
|
2190
|
+
<option value="" ?selected=${n===""}>任意节点</option>
|
|
2191
2191
|
${e.nodes.map(s=>c`<option
|
|
2192
2192
|
value=${s.id}
|
|
2193
2193
|
?selected=${n===s.id}
|
|
@@ -2196,24 +2196,24 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2196
2196
|
</option>`)}
|
|
2197
2197
|
</select>
|
|
2198
2198
|
</label>
|
|
2199
|
-
${t?f:c`<div class="muted"
|
|
2199
|
+
${t?f:c`<div class="muted">没有可用的 system.run 节点。</div>`}
|
|
2200
2200
|
</div>
|
|
2201
2201
|
</div>
|
|
2202
2202
|
|
|
2203
|
-
${e.agents.length===0?c`<div class="muted"
|
|
2203
|
+
${e.agents.length===0?c`<div class="muted">未找到代理。</div>`:e.agents.map(s=>kf(s,e))}
|
|
2204
2204
|
</div>
|
|
2205
2205
|
`:c`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
2206
|
-
<div class="muted"
|
|
2206
|
+
<div class="muted">加载配置以编辑绑定。</div>
|
|
2207
2207
|
<button class="btn" ?disabled=${e.configLoading} @click=${e.onLoadConfig}>
|
|
2208
|
-
${e.configLoading?"
|
|
2208
|
+
${e.configLoading?"加载中…":"加载配置"}
|
|
2209
2209
|
</button>
|
|
2210
2210
|
</div>`}
|
|
2211
2211
|
</section>
|
|
2212
|
-
`}function
|
|
2212
|
+
`}function yf(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return c`
|
|
2213
2213
|
<section class="card">
|
|
2214
2214
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
2215
2215
|
<div>
|
|
2216
|
-
<div class="card-title"
|
|
2216
|
+
<div class="card-title">执行审批</div>
|
|
2217
2217
|
<div class="card-sub">
|
|
2218
2218
|
Allowlist and approval policy for <span class="mono">exec host=gateway/node</span>.
|
|
2219
2219
|
</div>
|
|
@@ -2223,51 +2223,51 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2223
2223
|
?disabled=${e.disabled||!e.dirty||!n}
|
|
2224
2224
|
@click=${e.onSave}
|
|
2225
2225
|
>
|
|
2226
|
-
${e.saving?"
|
|
2226
|
+
${e.saving?"保存中…":"保存"}
|
|
2227
2227
|
</button>
|
|
2228
2228
|
</div>
|
|
2229
2229
|
|
|
2230
|
-
${
|
|
2230
|
+
${bf(e)}
|
|
2231
2231
|
|
|
2232
2232
|
${t?c`
|
|
2233
|
-
${bf(e)}
|
|
2234
2233
|
${wf(e)}
|
|
2235
|
-
${
|
|
2234
|
+
${$f(e)}
|
|
2235
|
+
${e.selectedScope===Ae?f:xf(e)}
|
|
2236
2236
|
`:c`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
2237
|
-
<div class="muted"
|
|
2237
|
+
<div class="muted">加载执行审批以编辑白名单。</div>
|
|
2238
2238
|
<button class="btn" ?disabled=${e.loading||!n} @click=${e.onLoad}>
|
|
2239
|
-
${e.loading?"
|
|
2239
|
+
${e.loading?"加载中…":"加载审批"}
|
|
2240
2240
|
</button>
|
|
2241
2241
|
</div>`}
|
|
2242
2242
|
</section>
|
|
2243
|
-
`}function
|
|
2243
|
+
`}function bf(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return c`
|
|
2244
2244
|
<div class="list" style="margin-top: 12px;">
|
|
2245
2245
|
<div class="list-item">
|
|
2246
2246
|
<div class="list-main">
|
|
2247
|
-
<div class="list-title"
|
|
2247
|
+
<div class="list-title">目标</div>
|
|
2248
2248
|
<div class="list-sub">
|
|
2249
|
-
|
|
2249
|
+
网关编辑本地审批;节点编辑所选节点。
|
|
2250
2250
|
</div>
|
|
2251
2251
|
</div>
|
|
2252
2252
|
<div class="list-meta">
|
|
2253
2253
|
<label class="field">
|
|
2254
|
-
<span
|
|
2254
|
+
<span>主机</span>
|
|
2255
2255
|
<select
|
|
2256
2256
|
?disabled=${e.disabled}
|
|
2257
2257
|
@change=${s=>{if(s.target.value==="node"){const o=e.targetNodes[0]?.id??null;e.onSelectTarget("node",n||o)}else e.onSelectTarget("gateway",null)}}
|
|
2258
2258
|
>
|
|
2259
|
-
<option value="gateway" ?selected=${e.target==="gateway"}
|
|
2260
|
-
<option value="node" ?selected=${e.target==="node"}
|
|
2259
|
+
<option value="gateway" ?selected=${e.target==="gateway"}>网关</option>
|
|
2260
|
+
<option value="node" ?selected=${e.target==="node"}>节点</option>
|
|
2261
2261
|
</select>
|
|
2262
2262
|
</label>
|
|
2263
2263
|
${e.target==="node"?c`
|
|
2264
2264
|
<label class="field">
|
|
2265
|
-
<span
|
|
2265
|
+
<span>节点</span>
|
|
2266
2266
|
<select
|
|
2267
2267
|
?disabled=${e.disabled||!t}
|
|
2268
2268
|
@change=${s=>{const a=s.target.value.trim();e.onSelectTarget("node",a||null)}}
|
|
2269
2269
|
>
|
|
2270
|
-
<option value="" ?selected=${n===""}
|
|
2270
|
+
<option value="" ?selected=${n===""}>选择节点</option>
|
|
2271
2271
|
${e.targetNodes.map(s=>c`<option
|
|
2272
2272
|
value=${s.id}
|
|
2273
2273
|
?selected=${n===s.id}
|
|
@@ -2279,17 +2279,17 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2279
2279
|
`:f}
|
|
2280
2280
|
</div>
|
|
2281
2281
|
</div>
|
|
2282
|
-
${e.target==="node"&&!t?c`<div class="muted"
|
|
2282
|
+
${e.target==="node"&&!t?c`<div class="muted">尚无节点提供执行审批功能。</div>`:f}
|
|
2283
2283
|
</div>
|
|
2284
|
-
`}function
|
|
2284
|
+
`}function wf(e){return c`
|
|
2285
2285
|
<div class="row" style="margin-top: 12px; gap: 8px; flex-wrap: wrap;">
|
|
2286
|
-
<span class="label"
|
|
2286
|
+
<span class="label">范围</span>
|
|
2287
2287
|
<div class="row" style="gap: 8px; flex-wrap: wrap;">
|
|
2288
2288
|
<button
|
|
2289
2289
|
class="btn btn--sm ${e.selectedScope===Ae?"active":""}"
|
|
2290
2290
|
@click=${()=>e.onSelectScope(Ae)}
|
|
2291
2291
|
>
|
|
2292
|
-
|
|
2292
|
+
默认值
|
|
2293
2293
|
</button>
|
|
2294
2294
|
${e.agents.map(t=>{const n=t.name?.trim()?`${t.name} (${t.id})`:t.id;return c`
|
|
2295
2295
|
<button
|
|
@@ -2301,24 +2301,24 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2301
2301
|
`})}
|
|
2302
2302
|
</div>
|
|
2303
2303
|
</div>
|
|
2304
|
-
`}function
|
|
2304
|
+
`}function $f(e){const t=e.selectedScope===Ae,n=e.defaults,s=e.selectedAgent??{},i=t?["defaults"]:["agents",e.selectedScope],a=typeof s.security=="string"?s.security:void 0,o=typeof s.ask=="string"?s.ask:void 0,r=typeof s.askFallback=="string"?s.askFallback:void 0,l=t?n.security:a??"__default__",p=t?n.ask:o??"__default__",d=t?n.askFallback:r??"__default__",u=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,g=u??n.autoAllowSkills,v=u==null;return c`
|
|
2305
2305
|
<div class="list" style="margin-top: 16px;">
|
|
2306
2306
|
<div class="list-item">
|
|
2307
2307
|
<div class="list-main">
|
|
2308
|
-
<div class="list-title"
|
|
2308
|
+
<div class="list-title">安全</div>
|
|
2309
2309
|
<div class="list-sub">
|
|
2310
2310
|
${t?"Default security mode.":`Default: ${n.security}.`}
|
|
2311
2311
|
</div>
|
|
2312
2312
|
</div>
|
|
2313
2313
|
<div class="list-meta">
|
|
2314
2314
|
<label class="field">
|
|
2315
|
-
<span
|
|
2315
|
+
<span>模式</span>
|
|
2316
2316
|
<select
|
|
2317
2317
|
?disabled=${e.disabled}
|
|
2318
|
-
@change=${y=>{const A=y.target.value;!t&&A==="__default__"?e.
|
|
2318
|
+
@change=${y=>{const A=y.target.value;!t&&A==="__default__"?e.on移除([...i,"security"]):e.onPatch([...i,"security"],A)}}
|
|
2319
2319
|
>
|
|
2320
2320
|
${t?f:c`<option value="__default__" ?selected=${l==="__default__"}>
|
|
2321
|
-
|
|
2321
|
+
使用默认 (${n.security})
|
|
2322
2322
|
</option>`}
|
|
2323
2323
|
${Za.map(y=>c`<option
|
|
2324
2324
|
value=${y.value}
|
|
@@ -2333,22 +2333,22 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2333
2333
|
|
|
2334
2334
|
<div class="list-item">
|
|
2335
2335
|
<div class="list-main">
|
|
2336
|
-
<div class="list-title"
|
|
2336
|
+
<div class="list-title">询问</div>
|
|
2337
2337
|
<div class="list-sub">
|
|
2338
2338
|
${t?"Default prompt policy.":`Default: ${n.ask}.`}
|
|
2339
2339
|
</div>
|
|
2340
2340
|
</div>
|
|
2341
2341
|
<div class="list-meta">
|
|
2342
2342
|
<label class="field">
|
|
2343
|
-
<span
|
|
2343
|
+
<span>模式</span>
|
|
2344
2344
|
<select
|
|
2345
2345
|
?disabled=${e.disabled}
|
|
2346
|
-
@change=${y=>{const A=y.target.value;!t&&A==="__default__"?e.
|
|
2346
|
+
@change=${y=>{const A=y.target.value;!t&&A==="__default__"?e.on移除([...i,"ask"]):e.onPatch([...i,"ask"],A)}}
|
|
2347
2347
|
>
|
|
2348
2348
|
${t?f:c`<option value="__default__" ?selected=${p==="__default__"}>
|
|
2349
|
-
|
|
2349
|
+
使用默认 (${n.ask})
|
|
2350
2350
|
</option>`}
|
|
2351
|
-
${
|
|
2351
|
+
${cf.map(y=>c`<option
|
|
2352
2352
|
value=${y.value}
|
|
2353
2353
|
?selected=${p===y.value}
|
|
2354
2354
|
>
|
|
@@ -2361,20 +2361,20 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2361
2361
|
|
|
2362
2362
|
<div class="list-item">
|
|
2363
2363
|
<div class="list-main">
|
|
2364
|
-
<div class="list-title"
|
|
2364
|
+
<div class="list-title">询问回退</div>
|
|
2365
2365
|
<div class="list-sub">
|
|
2366
2366
|
${t?"Applied when the UI prompt is unavailable.":`Default: ${n.askFallback}.`}
|
|
2367
2367
|
</div>
|
|
2368
2368
|
</div>
|
|
2369
2369
|
<div class="list-meta">
|
|
2370
2370
|
<label class="field">
|
|
2371
|
-
<span
|
|
2371
|
+
<span>回退</span>
|
|
2372
2372
|
<select
|
|
2373
2373
|
?disabled=${e.disabled}
|
|
2374
|
-
@change=${y=>{const A=y.target.value;!t&&A==="__default__"?e.
|
|
2374
|
+
@change=${y=>{const A=y.target.value;!t&&A==="__default__"?e.on移除([...i,"askFallback"]):e.onPatch([...i,"askFallback"],A)}}
|
|
2375
2375
|
>
|
|
2376
2376
|
${t?f:c`<option value="__default__" ?selected=${d==="__default__"}>
|
|
2377
|
-
|
|
2377
|
+
使用默认 (${n.askFallback})
|
|
2378
2378
|
</option>`}
|
|
2379
2379
|
${Za.map(y=>c`<option
|
|
2380
2380
|
value=${y.value}
|
|
@@ -2389,14 +2389,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2389
2389
|
|
|
2390
2390
|
<div class="list-item">
|
|
2391
2391
|
<div class="list-main">
|
|
2392
|
-
<div class="list-title"
|
|
2392
|
+
<div class="list-title">自动允许技能 CLI</div>
|
|
2393
2393
|
<div class="list-sub">
|
|
2394
2394
|
${t?"Allow skill executables listed by the Gateway.":v?`Using default (${n.autoAllowSkills?"on":"off"}).`:`Override (${g?"on":"off"}).`}
|
|
2395
2395
|
</div>
|
|
2396
2396
|
</div>
|
|
2397
2397
|
<div class="list-meta">
|
|
2398
2398
|
<label class="field">
|
|
2399
|
-
<span
|
|
2399
|
+
<span>启用</span>
|
|
2400
2400
|
<input
|
|
2401
2401
|
type="checkbox"
|
|
2402
2402
|
?disabled=${e.disabled}
|
|
@@ -2407,35 +2407,35 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2407
2407
|
${!t&&!v?c`<button
|
|
2408
2408
|
class="btn btn--sm"
|
|
2409
2409
|
?disabled=${e.disabled}
|
|
2410
|
-
@click=${()=>e.
|
|
2410
|
+
@click=${()=>e.on移除([...i,"autoAllowSkills"])}
|
|
2411
2411
|
>
|
|
2412
|
-
|
|
2412
|
+
使用默认
|
|
2413
2413
|
</button>`:f}
|
|
2414
2414
|
</div>
|
|
2415
2415
|
</div>
|
|
2416
2416
|
</div>
|
|
2417
|
-
`}function
|
|
2417
|
+
`}function xf(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return c`
|
|
2418
2418
|
<div class="row" style="margin-top: 18px; justify-content: space-between;">
|
|
2419
2419
|
<div>
|
|
2420
|
-
<div class="card-title"
|
|
2421
|
-
<div class="card-sub"
|
|
2420
|
+
<div class="card-title">白名单</div>
|
|
2421
|
+
<div class="card-sub">不区分大小写的通配符模式。</div>
|
|
2422
2422
|
</div>
|
|
2423
2423
|
<button
|
|
2424
2424
|
class="btn btn--sm"
|
|
2425
2425
|
?disabled=${e.disabled}
|
|
2426
2426
|
@click=${()=>{const s=[...n,{pattern:""}];e.onPatch(t,s)}}
|
|
2427
2427
|
>
|
|
2428
|
-
|
|
2428
|
+
添加模式
|
|
2429
2429
|
</button>
|
|
2430
2430
|
</div>
|
|
2431
2431
|
<div class="list" style="margin-top: 12px;">
|
|
2432
|
-
${n.length===0?c`<div class="muted"
|
|
2432
|
+
${n.length===0?c`<div class="muted">尚无白名单条目。</div>`:n.map((s,i)=>Af(e,s,i))}
|
|
2433
2433
|
</div>
|
|
2434
|
-
`}function
|
|
2434
|
+
`}function Af(e,t,n){const s=t.lastUsedAt?O(t.lastUsedAt):"never",i=t.lastUsedCommand?cs(t.lastUsedCommand,120):null,a=t.lastResolvedPath?cs(t.lastResolvedPath,120):null;return c`
|
|
2435
2435
|
<div class="list-item">
|
|
2436
2436
|
<div class="list-main">
|
|
2437
2437
|
<div class="list-title">${t.pattern?.trim()?t.pattern:"New pattern"}</div>
|
|
2438
|
-
<div class="list-sub"
|
|
2438
|
+
<div class="list-sub">最后使用:${s}</div>
|
|
2439
2439
|
${i?c`<div class="list-sub mono">${i}</div>`:f}
|
|
2440
2440
|
${a?c`<div class="list-sub mono">${a}</div>`:f}
|
|
2441
2441
|
</div>
|
|
@@ -2452,13 +2452,13 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2452
2452
|
<button
|
|
2453
2453
|
class="btn btn--sm danger"
|
|
2454
2454
|
?disabled=${e.disabled}
|
|
2455
|
-
@click=${()=>{if(e.allowlist.length<=1){e.
|
|
2455
|
+
@click=${()=>{if(e.allowlist.length<=1){e.on移除(["agents",e.selectedScope,"allowlist"]);return}e.on移除(["agents",e.selectedScope,"allowlist",n])}}
|
|
2456
2456
|
>
|
|
2457
|
-
|
|
2457
|
+
移除
|
|
2458
2458
|
</button>
|
|
2459
2459
|
</div>
|
|
2460
2460
|
</div>
|
|
2461
|
-
`}function
|
|
2461
|
+
`}function kf(e,t){const n=e.binding??"__default__",s=e.name?.trim()?`${e.name} (${e.id})`:e.id,i=t.nodes.length>0;return c`
|
|
2462
2462
|
<div class="list-item">
|
|
2463
2463
|
<div class="list-main">
|
|
2464
2464
|
<div class="list-title">${s}</div>
|
|
@@ -2469,13 +2469,13 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2469
2469
|
</div>
|
|
2470
2470
|
<div class="list-meta">
|
|
2471
2471
|
<label class="field">
|
|
2472
|
-
<span
|
|
2472
|
+
<span>绑定</span>
|
|
2473
2473
|
<select
|
|
2474
2474
|
?disabled=${t.disabled||!i}
|
|
2475
2475
|
@change=${a=>{const r=a.target.value.trim();t.onBindAgent(e.index,r==="__default__"?null:r)}}
|
|
2476
2476
|
>
|
|
2477
2477
|
<option value="__default__" ?selected=${n==="__default__"}>
|
|
2478
|
-
|
|
2478
|
+
使用默认
|
|
2479
2479
|
</option>
|
|
2480
2480
|
${t.nodes.map(a=>c`<option
|
|
2481
2481
|
value=${a.id}
|
|
@@ -2487,7 +2487,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2487
2487
|
</label>
|
|
2488
2488
|
</div>
|
|
2489
2489
|
</div>
|
|
2490
|
-
`}function
|
|
2490
|
+
`}function Sf(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(r=>String(r)==="system.run"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,s)=>n.label.localeCompare(s.label)),t}function _f(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(r=>String(r)==="system.execApprovals.get"||String(r)==="system.execApprovals.set"))continue;const a=typeof n.nodeId=="string"?n.nodeId.trim():"";if(!a)continue;const o=typeof n.displayName=="string"&&n.displayName.trim()?n.displayName.trim():a;t.push({id:a,label:o===a?a:`${o} · ${a}`})}return t.sort((n,s)=>n.label.localeCompare(s.label)),t}function Tf(e){const t={id:"main",name:void 0,index:0,isDefault:!0,binding:null};if(!e||typeof e!="object")return{defaultBinding:null,agents:[t]};const s=(e.tools??{}).exec??{},i=typeof s.node=="string"&&s.node.trim()?s.node.trim():null,a=e.agents??{},o=Array.isArray(a.list)?a.list:[];if(o.length===0)return{defaultBinding:i,agents:[t]};const r=[];return o.forEach((l,p)=>{if(!l||typeof l!="object")return;const d=l,u=typeof d.id=="string"?d.id.trim():"";if(!u)return;const g=typeof d.name=="string"?d.name.trim():void 0,v=d.default===!0,$=(d.tools??{}).exec??{},A=typeof $.node=="string"&&$.node.trim()?$.node.trim():null;r.push({id:u,name:g||void 0,index:p,isDefault:v,binding:A})}),r.length===0&&r.push(t),{defaultBinding:i,agents:r}}function Cf(e){const t=!!e.connected,n=!!e.paired,s=typeof e.displayName=="string"&&e.displayName.trim()||(typeof e.nodeId=="string"?e.nodeId:"unknown"),i=Array.isArray(e.caps)?e.caps:[],a=Array.isArray(e.commands)?e.commands:[];return c`
|
|
2491
2491
|
<div class="list-item">
|
|
2492
2492
|
<div class="list-main">
|
|
2493
2493
|
<div class="list-title">${s}</div>
|
|
@@ -2506,9 +2506,9 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2506
2506
|
</div>
|
|
2507
2507
|
</div>
|
|
2508
2508
|
</div>
|
|
2509
|
-
`}function
|
|
2509
|
+
`}function Ef(e){const t=e.hello?.snapshot,n=t?.uptimeMs?go(t.uptimeMs):"n/a",s=t?.policy?.tickIntervalMs?`${t.policy.tickIntervalMs}ms`:"n/a",i=(()=>{if(e.connected||!e.lastError)return null;const o=e.lastError.toLowerCase();if(!(o.includes("unauthorized")||o.includes("connect failed")))return null;const l=!!e.settings.token.trim(),p=!!e.password.trim();return!l&&!p?c`
|
|
2510
2510
|
<div class="muted" style="margin-top: 8px;">
|
|
2511
|
-
|
|
2511
|
+
此网关需要身份验证。添加令牌或密码,然后点击连接。
|
|
2512
2512
|
<div style="margin-top: 6px;">
|
|
2513
2513
|
<span class="mono">openclaw dashboard --no-open</span> → tokenized URL<br />
|
|
2514
2514
|
<span class="mono">openclaw doctor --generate-gateway-token</span> → set token
|
|
@@ -2571,11 +2571,11 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2571
2571
|
`})();return c`
|
|
2572
2572
|
<section class="grid grid-cols-2">
|
|
2573
2573
|
<div class="card">
|
|
2574
|
-
<div class="card-title"
|
|
2575
|
-
<div class="card-sub"
|
|
2574
|
+
<div class="card-title">网关访问</div>
|
|
2575
|
+
<div class="card-sub">控制台连接地址和身份验证方式。</div>
|
|
2576
2576
|
<div class="form-grid" style="margin-top: 16px;">
|
|
2577
2577
|
<label class="field">
|
|
2578
|
-
<span>WebSocket
|
|
2578
|
+
<span>WebSocket 地址</span>
|
|
2579
2579
|
<input
|
|
2580
2580
|
.value=${e.settings.gatewayUrl}
|
|
2581
2581
|
@input=${o=>{const r=o.target.value;e.onSettingsChange({...e.settings,gatewayUrl:r})}}
|
|
@@ -2583,7 +2583,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2583
2583
|
/>
|
|
2584
2584
|
</label>
|
|
2585
2585
|
<label class="field">
|
|
2586
|
-
<span
|
|
2586
|
+
<span>网关令牌</span>
|
|
2587
2587
|
<input
|
|
2588
2588
|
.value=${e.settings.token}
|
|
2589
2589
|
@input=${o=>{const r=o.target.value;e.onSettingsChange({...e.settings,token:r})}}
|
|
@@ -2591,16 +2591,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2591
2591
|
/>
|
|
2592
2592
|
</label>
|
|
2593
2593
|
<label class="field">
|
|
2594
|
-
<span
|
|
2594
|
+
<span>密码(不保存)</span>
|
|
2595
2595
|
<input
|
|
2596
2596
|
type="password"
|
|
2597
2597
|
.value=${e.password}
|
|
2598
2598
|
@input=${o=>{const r=o.target.value;e.onPasswordChange(r)}}
|
|
2599
|
-
placeholder="
|
|
2599
|
+
placeholder="系统或共享密码"
|
|
2600
2600
|
/>
|
|
2601
2601
|
</label>
|
|
2602
2602
|
<label class="field">
|
|
2603
|
-
<span
|
|
2603
|
+
<span>默认会话密钥</span>
|
|
2604
2604
|
<input
|
|
2605
2605
|
.value=${e.settings.sessionKey}
|
|
2606
2606
|
@input=${o=>{const r=o.target.value;e.onSessionKeyChange(r)}}
|
|
@@ -2608,32 +2608,32 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2608
2608
|
</label>
|
|
2609
2609
|
</div>
|
|
2610
2610
|
<div class="row" style="margin-top: 14px;">
|
|
2611
|
-
<button class="btn" @click=${()=>e.onConnect()}
|
|
2612
|
-
<button class="btn" @click=${()=>e.onRefresh()}
|
|
2613
|
-
<span class="muted"
|
|
2611
|
+
<button class="btn" @click=${()=>e.onConnect()}>连接</button>
|
|
2612
|
+
<button class="btn" @click=${()=>e.onRefresh()}>刷新</button>
|
|
2613
|
+
<span class="muted">点击连接按钮以应用连接更改。</span>
|
|
2614
2614
|
</div>
|
|
2615
2615
|
</div>
|
|
2616
2616
|
|
|
2617
2617
|
<div class="card">
|
|
2618
|
-
<div class="card-title"
|
|
2619
|
-
<div class="card-sub"
|
|
2618
|
+
<div class="card-title">快照</div>
|
|
2619
|
+
<div class="card-sub">最新的网关握手信息。</div>
|
|
2620
2620
|
<div class="stat-grid" style="margin-top: 16px;">
|
|
2621
2621
|
<div class="stat">
|
|
2622
|
-
<div class="stat-label"
|
|
2622
|
+
<div class="stat-label">状态</div>
|
|
2623
2623
|
<div class="stat-value ${e.connected?"ok":"warn"}">
|
|
2624
|
-
${e.connected?"
|
|
2624
|
+
${e.connected?"已连接":"未连接"}
|
|
2625
2625
|
</div>
|
|
2626
2626
|
</div>
|
|
2627
2627
|
<div class="stat">
|
|
2628
|
-
<div class="stat-label"
|
|
2628
|
+
<div class="stat-label">运行时间</div>
|
|
2629
2629
|
<div class="stat-value">${n}</div>
|
|
2630
2630
|
</div>
|
|
2631
2631
|
<div class="stat">
|
|
2632
|
-
<div class="stat-label"
|
|
2632
|
+
<div class="stat-label">刷新间隔</div>
|
|
2633
2633
|
<div class="stat-value">${s}</div>
|
|
2634
2634
|
</div>
|
|
2635
2635
|
<div class="stat">
|
|
2636
|
-
<div class="stat-label"
|
|
2636
|
+
<div class="stat-label">最后渠道刷新</div>
|
|
2637
2637
|
<div class="stat-value">
|
|
2638
2638
|
${e.lastChannelsRefresh?O(e.lastChannelsRefresh):"n/a"}
|
|
2639
2639
|
</div>
|
|
@@ -2644,80 +2644,80 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2644
2644
|
${i??""}
|
|
2645
2645
|
${a??""}
|
|
2646
2646
|
</div>`:c`<div class="callout" style="margin-top: 14px;">
|
|
2647
|
-
|
|
2647
|
+
使用渠道功能连接 WhatsApp、Telegram、Discord、Signal 或 iMessage。
|
|
2648
2648
|
</div>`}
|
|
2649
2649
|
</div>
|
|
2650
2650
|
</section>
|
|
2651
2651
|
|
|
2652
2652
|
<section class="grid grid-cols-3" style="margin-top: 18px;">
|
|
2653
2653
|
<div class="card stat-card">
|
|
2654
|
-
<div class="stat-label"
|
|
2654
|
+
<div class="stat-label">实例</div>
|
|
2655
2655
|
<div class="stat-value">${e.presenceCount}</div>
|
|
2656
|
-
<div class="muted"
|
|
2656
|
+
<div class="muted">最近 5 分钟内的存在信标。</div>
|
|
2657
2657
|
</div>
|
|
2658
2658
|
<div class="card stat-card">
|
|
2659
|
-
<div class="stat-label"
|
|
2659
|
+
<div class="stat-label">会话</div>
|
|
2660
2660
|
<div class="stat-value">${e.sessionsCount??"n/a"}</div>
|
|
2661
|
-
<div class="muted"
|
|
2661
|
+
<div class="muted">网关跟踪的最近会话密钥。</div>
|
|
2662
2662
|
</div>
|
|
2663
2663
|
<div class="card stat-card">
|
|
2664
|
-
<div class="stat-label"
|
|
2664
|
+
<div class="stat-label">定时任务</div>
|
|
2665
2665
|
<div class="stat-value">
|
|
2666
|
-
${e.cronEnabled==null?"n/a":e.cronEnabled?"
|
|
2666
|
+
${e.cronEnabled==null?"n/a":e.cronEnabled?"已启用":"已禁用"}
|
|
2667
2667
|
</div>
|
|
2668
|
-
<div class="muted"
|
|
2668
|
+
<div class="muted">下次唤醒 ${kr(e.cronNext)}</div>
|
|
2669
2669
|
</div>
|
|
2670
2670
|
</section>
|
|
2671
2671
|
|
|
2672
2672
|
<section class="card" style="margin-top: 18px;">
|
|
2673
|
-
<div class="card-title"
|
|
2674
|
-
<div class="card-sub"
|
|
2673
|
+
<div class="card-title">备注</div>
|
|
2674
|
+
<div class="card-sub">远程控制设置的快速提醒。</div>
|
|
2675
2675
|
<div class="note-grid" style="margin-top: 14px;">
|
|
2676
2676
|
<div>
|
|
2677
|
-
<div class="note-title">Tailscale
|
|
2677
|
+
<div class="note-title">Tailscale 服务</div>
|
|
2678
2678
|
<div class="muted">
|
|
2679
|
-
|
|
2679
|
+
建议使用服务模式,通过 tailnet 身份验证将网关保持在本地回环。
|
|
2680
2680
|
</div>
|
|
2681
2681
|
</div>
|
|
2682
2682
|
<div>
|
|
2683
|
-
<div class="note-title"
|
|
2684
|
-
<div class="muted"
|
|
2683
|
+
<div class="note-title">会话管理</div>
|
|
2684
|
+
<div class="muted">使用 /new 或 sessions.patch 重置上下文。</div>
|
|
2685
2685
|
</div>
|
|
2686
2686
|
<div>
|
|
2687
|
-
<div class="note-title"
|
|
2688
|
-
<div class="muted"
|
|
2687
|
+
<div class="note-title">定时任务提醒</div>
|
|
2688
|
+
<div class="muted">为定期运行使用隔离会话。</div>
|
|
2689
2689
|
</div>
|
|
2690
2690
|
</div>
|
|
2691
2691
|
</section>
|
|
2692
|
-
`}const
|
|
2692
|
+
`}const Mf=["","off","minimal","low","medium","high"],If=["","off","on"],Lf=[{value:"",label:"继承"},{value:"off",label:"关闭(显式)"},{value:"on",label:"开启"}],Rf=["","off","on","stream"];function Pf(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function Sr(e){return Pf(e)==="zai"}function Nf(e){return Sr(e)?If:Mf}function Of(e,t){return!t||!e||e==="off"?e:"on"}function Df(e,t){return e?t&&e==="on"?"low":e:null}function Bf(e){const t=e.result?.sessions??[];return c`
|
|
2693
2693
|
<section class="card">
|
|
2694
2694
|
<div class="row" style="justify-content: space-between;">
|
|
2695
2695
|
<div>
|
|
2696
|
-
<div class="card-title"
|
|
2697
|
-
<div class="card-sub"
|
|
2696
|
+
<div class="card-title">会话</div>
|
|
2697
|
+
<div class="card-sub">活动会话密钥和单会话设置覆盖。</div>
|
|
2698
2698
|
</div>
|
|
2699
2699
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
2700
|
-
${e.loading?"
|
|
2700
|
+
${e.loading?"加载中…":"刷新"}
|
|
2701
2701
|
</button>
|
|
2702
2702
|
</div>
|
|
2703
2703
|
|
|
2704
2704
|
<div class="filters" style="margin-top: 14px;">
|
|
2705
2705
|
<label class="field">
|
|
2706
|
-
<span
|
|
2706
|
+
<span>活动时间(分钟)</span>
|
|
2707
2707
|
<input
|
|
2708
2708
|
.value=${e.activeMinutes}
|
|
2709
2709
|
@input=${n=>e.onFiltersChange({activeMinutes:n.target.value,limit:e.limit,includeGlobal:e.includeGlobal,includeUnknown:e.includeUnknown})}
|
|
2710
2710
|
/>
|
|
2711
2711
|
</label>
|
|
2712
2712
|
<label class="field">
|
|
2713
|
-
<span
|
|
2713
|
+
<span>限制</span>
|
|
2714
2714
|
<input
|
|
2715
2715
|
.value=${e.limit}
|
|
2716
2716
|
@input=${n=>e.onFiltersChange({activeMinutes:e.activeMinutes,limit:n.target.value,includeGlobal:e.includeGlobal,includeUnknown:e.includeUnknown})}
|
|
2717
2717
|
/>
|
|
2718
2718
|
</label>
|
|
2719
2719
|
<label class="field checkbox">
|
|
2720
|
-
<span
|
|
2720
|
+
<span>包含全局</span>
|
|
2721
2721
|
<input
|
|
2722
2722
|
type="checkbox"
|
|
2723
2723
|
.checked=${e.includeGlobal}
|
|
@@ -2725,7 +2725,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2725
2725
|
/>
|
|
2726
2726
|
</label>
|
|
2727
2727
|
<label class="field checkbox">
|
|
2728
|
-
<span
|
|
2728
|
+
<span>包含未知</span>
|
|
2729
2729
|
<input
|
|
2730
2730
|
type="checkbox"
|
|
2731
2731
|
.checked=${e.includeUnknown}
|
|
@@ -2737,45 +2737,45 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2737
2737
|
${e.error?c`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:f}
|
|
2738
2738
|
|
|
2739
2739
|
<div class="muted" style="margin-top: 12px;">
|
|
2740
|
-
${e.result
|
|
2740
|
+
${e.result?`存储路径:${e.result.path}`:""}
|
|
2741
2741
|
</div>
|
|
2742
2742
|
|
|
2743
2743
|
<div class="table" style="margin-top: 16px;">
|
|
2744
2744
|
<div class="table-head">
|
|
2745
|
-
<div
|
|
2746
|
-
<div
|
|
2747
|
-
<div
|
|
2748
|
-
<div
|
|
2749
|
-
<div
|
|
2750
|
-
<div
|
|
2751
|
-
<div
|
|
2752
|
-
<div
|
|
2753
|
-
<div
|
|
2754
|
-
</div>
|
|
2755
|
-
${t.length===0?c`<div class="muted"
|
|
2745
|
+
<div>密钥</div>
|
|
2746
|
+
<div>标签</div>
|
|
2747
|
+
<div>类型</div>
|
|
2748
|
+
<div>更新时间</div>
|
|
2749
|
+
<div>令牌数</div>
|
|
2750
|
+
<div>思考</div>
|
|
2751
|
+
<div>详细</div>
|
|
2752
|
+
<div>推理</div>
|
|
2753
|
+
<div>操作</div>
|
|
2754
|
+
</div>
|
|
2755
|
+
${t.length===0?c`<div class="muted">未找到会话。</div>`:t.map(n=>Ff(n,e.basePath,e.onPatch,e.on删除,e.loading))}
|
|
2756
2756
|
</div>
|
|
2757
2757
|
</section>
|
|
2758
|
-
`}function
|
|
2758
|
+
`}function Ff(e,t,n,s,i){const a=e.updatedAt?O(e.updatedAt):"n/a",o=e.thinkingLevel??"",r=Sr(e.modelProvider),l=Of(o,r),p=Nf(e.modelProvider),d=e.verboseLevel??"",u=e.reasoningLevel??"",g=e.displayName??e.key,v=e.kind!=="global",y=v?`${Ds("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return c`
|
|
2759
2759
|
<div class="table-row">
|
|
2760
2760
|
<div class="mono">${v?c`<a href=${y} class="session-link">${g}</a>`:g}</div>
|
|
2761
2761
|
<div>
|
|
2762
2762
|
<input
|
|
2763
2763
|
.value=${e.label??""}
|
|
2764
2764
|
?disabled=${i}
|
|
2765
|
-
placeholder="
|
|
2765
|
+
placeholder="(可选)"
|
|
2766
2766
|
@change=${$=>{const A=$.target.value.trim();n(e.key,{label:A||null})}}
|
|
2767
2767
|
/>
|
|
2768
2768
|
</div>
|
|
2769
2769
|
<div>${e.kind}</div>
|
|
2770
2770
|
<div>${a}</div>
|
|
2771
|
-
<div>${
|
|
2771
|
+
<div>${Uh(e)}</div>
|
|
2772
2772
|
<div>
|
|
2773
2773
|
<select
|
|
2774
2774
|
.value=${l}
|
|
2775
2775
|
?disabled=${i}
|
|
2776
|
-
@change=${$=>{const A=$.target.value;n(e.key,{thinkingLevel:
|
|
2776
|
+
@change=${$=>{const A=$.target.value;n(e.key,{thinkingLevel:Df(A,r)})}}
|
|
2777
2777
|
>
|
|
2778
|
-
${p.map($=>c`<option value=${$}>${$||"
|
|
2778
|
+
${p.map($=>c`<option value=${$}>${$||"继承"}</option>`)}
|
|
2779
2779
|
</select>
|
|
2780
2780
|
</div>
|
|
2781
2781
|
<div>
|
|
@@ -2793,16 +2793,16 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2793
2793
|
?disabled=${i}
|
|
2794
2794
|
@change=${$=>{const A=$.target.value;n(e.key,{reasoningLevel:A||null})}}
|
|
2795
2795
|
>
|
|
2796
|
-
${
|
|
2796
|
+
${Rf.map($=>c`<option value=${$}>${$||"继承"}</option>`)}
|
|
2797
2797
|
</select>
|
|
2798
2798
|
</div>
|
|
2799
2799
|
<div>
|
|
2800
2800
|
<button class="btn danger" ?disabled=${i} @click=${()=>s(e.key)}>
|
|
2801
|
-
|
|
2801
|
+
删除
|
|
2802
2802
|
</button>
|
|
2803
2803
|
</div>
|
|
2804
2804
|
</div>
|
|
2805
|
-
`}function
|
|
2805
|
+
`}function Uf(e){const t=Math.max(0,e),n=Math.floor(t/1e3);if(n<60)return`${n}s`;const s=Math.floor(n/60);return s<60?`${s}m`:`${Math.floor(s/60)}h`}function Le(e,t){return t?c`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:f}function Kf(e){const t=e.execApprovalQueue[0];if(!t)return f;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${Uf(s)}`:"expired",a=e.execApprovalQueue.length;return c`
|
|
2806
2806
|
<div class="exec-approval-overlay" role="dialog" aria-live="polite">
|
|
2807
2807
|
<div class="exec-approval-card">
|
|
2808
2808
|
<div class="exec-approval-header">
|
|
@@ -2814,13 +2814,13 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2814
2814
|
</div>
|
|
2815
2815
|
<div class="exec-approval-command mono">${n.command}</div>
|
|
2816
2816
|
<div class="exec-approval-meta">
|
|
2817
|
-
${
|
|
2818
|
-
${
|
|
2819
|
-
${
|
|
2820
|
-
${
|
|
2821
|
-
${
|
|
2822
|
-
${
|
|
2823
|
-
${
|
|
2817
|
+
${Le("Host",n.host)}
|
|
2818
|
+
${Le("Agent",n.agentId)}
|
|
2819
|
+
${Le("Session",n.sessionKey)}
|
|
2820
|
+
${Le("CWD",n.cwd)}
|
|
2821
|
+
${Le("Resolved",n.resolvedPath)}
|
|
2822
|
+
${Le("Security",n.security)}
|
|
2823
|
+
${Le("Ask",n.ask)}
|
|
2824
2824
|
</div>
|
|
2825
2825
|
${e.execApprovalError?c`<div class="exec-approval-error">${e.execApprovalError}</div>`:f}
|
|
2826
2826
|
<div class="exec-approval-actions">
|
|
@@ -2848,7 +2848,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2848
2848
|
</div>
|
|
2849
2849
|
</div>
|
|
2850
2850
|
</div>
|
|
2851
|
-
`}function
|
|
2851
|
+
`}function Hf(e){const{pendingGatewayUrl:t}=e;return t?c`
|
|
2852
2852
|
<div class="exec-approval-overlay" role="dialog" aria-modal="true" aria-live="polite">
|
|
2853
2853
|
<div class="exec-approval-card">
|
|
2854
2854
|
<div class="exec-approval-header">
|
|
@@ -2877,39 +2877,39 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2877
2877
|
</div>
|
|
2878
2878
|
</div>
|
|
2879
2879
|
</div>
|
|
2880
|
-
`:f}function
|
|
2880
|
+
`:f}function zf(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(i=>[i.name,i.description,i.source].join(" ").toLowerCase().includes(n)):t;return c`
|
|
2881
2881
|
<section class="card">
|
|
2882
2882
|
<div class="row" style="justify-content: space-between;">
|
|
2883
2883
|
<div>
|
|
2884
|
-
<div class="card-title"
|
|
2885
|
-
<div class="card-sub"
|
|
2884
|
+
<div class="card-title">技能</div>
|
|
2885
|
+
<div class="card-sub">内置、托管和工作区技能。</div>
|
|
2886
2886
|
</div>
|
|
2887
2887
|
<button class="btn" ?disabled=${e.loading} @click=${e.onRefresh}>
|
|
2888
|
-
${e.loading?"
|
|
2888
|
+
${e.loading?"加载中…":"刷新"}
|
|
2889
2889
|
</button>
|
|
2890
2890
|
</div>
|
|
2891
2891
|
|
|
2892
2892
|
<div class="filters" style="margin-top: 14px;">
|
|
2893
2893
|
<label class="field" style="flex: 1;">
|
|
2894
|
-
<span
|
|
2894
|
+
<span>筛选</span>
|
|
2895
2895
|
<input
|
|
2896
2896
|
.value=${e.filter}
|
|
2897
2897
|
@input=${i=>e.onFilterChange(i.target.value)}
|
|
2898
|
-
placeholder="
|
|
2898
|
+
placeholder="搜索技能"
|
|
2899
2899
|
/>
|
|
2900
2900
|
</label>
|
|
2901
|
-
<div class="muted"
|
|
2901
|
+
<div class="muted">显示 ${s.length} 项</div>
|
|
2902
2902
|
</div>
|
|
2903
2903
|
|
|
2904
2904
|
${e.error?c`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:f}
|
|
2905
2905
|
|
|
2906
|
-
${s.length===0?c`<div class="muted" style="margin-top: 16px;"
|
|
2906
|
+
${s.length===0?c`<div class="muted" style="margin-top: 16px;">未找到技能。</div>`:c`
|
|
2907
2907
|
<div class="list" style="margin-top: 16px;">
|
|
2908
|
-
${s.map(i=>
|
|
2908
|
+
${s.map(i=>jf(i,e))}
|
|
2909
2909
|
</div>
|
|
2910
2910
|
`}
|
|
2911
2911
|
</section>
|
|
2912
|
-
`}function
|
|
2912
|
+
`}function jf(e,t){const n=t.busyKey===e.skillKey,s=t.edits[e.skillKey]??"",i=t.messages[e.skillKey]??null,a=e.install.length>0&&e.missing.bins.length>0,o=[...e.missing.bins.map(l=>`bin:${l}`),...e.missing.env.map(l=>`env:${l}`),...e.missing.config.map(l=>`config:${l}`),...e.missing.os.map(l=>`os:${l}`)],r=[];return e.disabled&&r.push("已禁用"),e.blockedByAllowlist&&r.push("被白名单阻止"),c`
|
|
2913
2913
|
<div class="list-item">
|
|
2914
2914
|
<div class="list-main">
|
|
2915
2915
|
<div class="list-title">
|
|
@@ -2919,18 +2919,18 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2919
2919
|
<div class="chip-row" style="margin-top: 6px;">
|
|
2920
2920
|
<span class="chip">${e.source}</span>
|
|
2921
2921
|
<span class="chip ${e.eligible?"chip-ok":"chip-warn"}">
|
|
2922
|
-
${e.eligible?"
|
|
2922
|
+
${e.eligible?"可用":"已阻止"}
|
|
2923
2923
|
</span>
|
|
2924
|
-
${e.disabled?c`<span class="chip chip-warn"
|
|
2924
|
+
${e.disabled?c`<span class="chip chip-warn">已禁用</span>`:f}
|
|
2925
2925
|
</div>
|
|
2926
2926
|
${o.length>0?c`
|
|
2927
2927
|
<div class="muted" style="margin-top: 6px;">
|
|
2928
|
-
|
|
2928
|
+
缺少:${o.join(", ")}
|
|
2929
2929
|
</div>
|
|
2930
2930
|
`:f}
|
|
2931
2931
|
${r.length>0?c`
|
|
2932
2932
|
<div class="muted" style="margin-top: 6px;">
|
|
2933
|
-
|
|
2933
|
+
原因:${r.join(", ")}
|
|
2934
2934
|
</div>
|
|
2935
2935
|
`:f}
|
|
2936
2936
|
</div>
|
|
@@ -2941,14 +2941,14 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2941
2941
|
?disabled=${n}
|
|
2942
2942
|
@click=${()=>t.onToggle(e.skillKey,e.disabled)}
|
|
2943
2943
|
>
|
|
2944
|
-
${e.disabled?"
|
|
2944
|
+
${e.disabled?"启用":"禁用"}
|
|
2945
2945
|
</button>
|
|
2946
2946
|
${a?c`<button
|
|
2947
2947
|
class="btn"
|
|
2948
2948
|
?disabled=${n}
|
|
2949
2949
|
@click=${()=>t.onInstall(e.skillKey,e.name,e.install[0].id)}
|
|
2950
2950
|
>
|
|
2951
|
-
${n?"
|
|
2951
|
+
${n?"安装中…":e.install[0].label}
|
|
2952
2952
|
</button>`:f}
|
|
2953
2953
|
</div>
|
|
2954
2954
|
${i?c`<div
|
|
@@ -2959,7 +2959,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2959
2959
|
</div>`:f}
|
|
2960
2960
|
${e.primaryEnv?c`
|
|
2961
2961
|
<div class="field" style="margin-top: 10px;">
|
|
2962
|
-
<span>API
|
|
2962
|
+
<span>API 密钥</span>
|
|
2963
2963
|
<input
|
|
2964
2964
|
type="password"
|
|
2965
2965
|
.value=${s}
|
|
@@ -2972,22 +2972,22 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2972
2972
|
?disabled=${n}
|
|
2973
2973
|
@click=${()=>t.onSaveKey(e.skillKey)}
|
|
2974
2974
|
>
|
|
2975
|
-
|
|
2975
|
+
保存密钥
|
|
2976
2976
|
</button>
|
|
2977
2977
|
`:f}
|
|
2978
2978
|
</div>
|
|
2979
2979
|
</div>
|
|
2980
|
-
`}function
|
|
2980
|
+
`}function Wf(e,t){const n=Ds(t,e.basePath);return c`
|
|
2981
2981
|
<a
|
|
2982
2982
|
href=${n}
|
|
2983
2983
|
class="nav-item ${e.tab===t?"active":""}"
|
|
2984
2984
|
@click=${s=>{s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||(s.preventDefault(),e.setTab(t))}}
|
|
2985
2985
|
title=${rs(t)}
|
|
2986
2986
|
>
|
|
2987
|
-
<span class="nav-item__icon" aria-hidden="true">${
|
|
2987
|
+
<span class="nav-item__icon" aria-hidden="true">${z[Sl(t)]}</span>
|
|
2988
2988
|
<span class="nav-item__text">${rs(t)}</span>
|
|
2989
2989
|
</a>
|
|
2990
|
-
`}function
|
|
2990
|
+
`}function Vf(e){const t=qf(e.hello,e.sessionsResult),n=Gf(e.sessionKey,e.sessionsResult,t),s=e.onboarding,i=e.onboarding,a=e.onboarding?!1:e.settings.chatShowThinking,o=e.onboarding?!0:e.settings.chatFocusMode,r=c`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path></svg>`,l=c`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7V4h3"></path><path d="M20 7V4h-3"></path><path d="M4 17v3h3"></path><path d="M20 17v3h-3"></path><circle cx="12" cy="12" r="3"></circle></svg>`;return c`
|
|
2991
2991
|
<div class="chat-controls">
|
|
2992
2992
|
<label class="field chat-controls__session">
|
|
2993
2993
|
<select
|
|
@@ -3004,7 +3004,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3004
3004
|
class="btn btn--sm btn--icon"
|
|
3005
3005
|
?disabled=${e.chatLoading||!e.connected}
|
|
3006
3006
|
@click=${()=>{e.resetToolStream(),Yo(e)}}
|
|
3007
|
-
title="
|
|
3007
|
+
title="刷新对话数据"
|
|
3008
3008
|
>
|
|
3009
3009
|
${r}
|
|
3010
3010
|
</button>
|
|
@@ -3014,30 +3014,30 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3014
3014
|
?disabled=${s}
|
|
3015
3015
|
@click=${()=>{s||e.applySettings({...e.settings,chatShowThinking:!e.settings.chatShowThinking})}}
|
|
3016
3016
|
aria-pressed=${a}
|
|
3017
|
-
title=${s?"
|
|
3017
|
+
title=${s?"初始化期间禁用":"切换助手思考/工作输出"}
|
|
3018
3018
|
>
|
|
3019
|
-
${
|
|
3019
|
+
${z.brain}
|
|
3020
3020
|
</button>
|
|
3021
3021
|
<button
|
|
3022
3022
|
class="btn btn--sm btn--icon ${o?"active":""}"
|
|
3023
3023
|
?disabled=${i}
|
|
3024
3024
|
@click=${()=>{i||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})}}
|
|
3025
3025
|
aria-pressed=${o}
|
|
3026
|
-
title=${i?"
|
|
3026
|
+
title=${i?"初始化期间禁用":"切换专注模式(隐藏侧栏和页头)"}
|
|
3027
3027
|
>
|
|
3028
3028
|
${l}
|
|
3029
3029
|
</button>
|
|
3030
3030
|
</div>
|
|
3031
|
-
`}function
|
|
3031
|
+
`}function qf(e,t){const n=e?.snapshot,s=n?.sessionDefaults?.mainSessionKey?.trim();if(s)return s;const i=n?.sessionDefaults?.mainKey?.trim();return i||(t?.sessions?.some(a=>a.key==="main")?"main":null)}function Gf(e,t,n){const s=new Set,i=[],a=n&&t?.sessions?.find(r=>r.key===n),o=t?.sessions?.find(r=>r.key===e);if(n&&(s.add(n),i.push({key:n,displayName:a?.displayName})),s.has(e)||(s.add(e),i.push({key:e,displayName:o?.displayName})),t?.sessions)for(const r of t.sessions)s.has(r.key)||(s.add(r.key),i.push({key:r.key,displayName:r.displayName}));return i}const Yf=["system","light","dark"];function Qf(e){const t=Math.max(0,Yf.indexOf(e.theme)),n=s=>i=>{const o={element:i.currentTarget};(i.clientX||i.clientY)&&(o.pointerClientX=i.clientX,o.pointerClientY=i.clientY),e.setTheme(s,o)};return c`
|
|
3032
3032
|
<div class="theme-toggle" style="--theme-index: ${t};">
|
|
3033
|
-
<div class="theme-toggle__track" role="group" aria-label="
|
|
3033
|
+
<div class="theme-toggle__track" role="group" aria-label="主题">
|
|
3034
3034
|
<span class="theme-toggle__indicator"></span>
|
|
3035
3035
|
<button
|
|
3036
3036
|
class="theme-toggle__button ${e.theme==="system"?"active":""}"
|
|
3037
3037
|
@click=${n("system")}
|
|
3038
3038
|
aria-pressed=${e.theme==="system"}
|
|
3039
|
-
aria-label="
|
|
3040
|
-
title="
|
|
3039
|
+
aria-label="系统主题"
|
|
3040
|
+
title="系统"
|
|
3041
3041
|
>
|
|
3042
3042
|
${Jf()}
|
|
3043
3043
|
</button>
|
|
@@ -3045,23 +3045,23 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3045
3045
|
class="theme-toggle__button ${e.theme==="light"?"active":""}"
|
|
3046
3046
|
@click=${n("light")}
|
|
3047
3047
|
aria-pressed=${e.theme==="light"}
|
|
3048
|
-
aria-label="
|
|
3049
|
-
title="
|
|
3048
|
+
aria-label="浅色主题"
|
|
3049
|
+
title="浅色"
|
|
3050
3050
|
>
|
|
3051
|
-
${
|
|
3051
|
+
${Zf()}
|
|
3052
3052
|
</button>
|
|
3053
3053
|
<button
|
|
3054
3054
|
class="theme-toggle__button ${e.theme==="dark"?"active":""}"
|
|
3055
3055
|
@click=${n("dark")}
|
|
3056
3056
|
aria-pressed=${e.theme==="dark"}
|
|
3057
|
-
aria-label="
|
|
3058
|
-
title="
|
|
3057
|
+
aria-label="深色主题"
|
|
3058
|
+
title="深色"
|
|
3059
3059
|
>
|
|
3060
|
-
${
|
|
3060
|
+
${Xf()}
|
|
3061
3061
|
</button>
|
|
3062
3062
|
</div>
|
|
3063
3063
|
</div>
|
|
3064
|
-
`}function
|
|
3064
|
+
`}function Zf(){return c`
|
|
3065
3065
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3066
3066
|
<circle cx="12" cy="12" r="4"></circle>
|
|
3067
3067
|
<path d="M12 2v2"></path>
|
|
@@ -3073,7 +3073,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3073
3073
|
<path d="m6.34 17.66-1.41 1.41"></path>
|
|
3074
3074
|
<path d="m19.07 4.93-1.41 1.41"></path>
|
|
3075
3075
|
</svg>
|
|
3076
|
-
`}function
|
|
3076
|
+
`}function Xf(){return c`
|
|
3077
3077
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
3078
3078
|
<path
|
|
3079
3079
|
d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"
|
|
@@ -3085,35 +3085,35 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3085
3085
|
<line x1="8" x2="16" y1="21" y2="21"></line>
|
|
3086
3086
|
<line x1="12" x2="12" y1="17" y2="21"></line>
|
|
3087
3087
|
</svg>
|
|
3088
|
-
`}const
|
|
3088
|
+
`}const eg=/^data:/i,tg=/^https?:\/\//i;function ng(e){const t=e.agentsList?.agents??[],s=uo(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",a=t.find(r=>r.id===s)?.identity,o=a?.avatarUrl??a?.avatar;if(o)return eg.test(o)||tg.test(o)?o:a?.avatarUrl}function sg(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,s=e.cronStatus?.nextWakeAtMs??null,i=e.connected?null:"已断开网关连接。",a=e.tab==="chat",o=a&&(e.settings.chatFocusMode||e.onboarding),r=e.onboarding?!1:e.settings.chatShowThinking,l=ng(e),p=e.chatAvatarUrl??l??null;return c`
|
|
3089
3089
|
<div class="shell ${a?"shell--chat":""} ${o?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
|
|
3090
3090
|
<header class="topbar">
|
|
3091
3091
|
<div class="topbar-left">
|
|
3092
3092
|
<button
|
|
3093
3093
|
class="nav-collapse-toggle"
|
|
3094
3094
|
@click=${()=>e.applySettings({...e.settings,navCollapsed:!e.settings.navCollapsed})}
|
|
3095
|
-
title="${e.settings.navCollapsed?"
|
|
3096
|
-
aria-label="${e.settings.navCollapsed?"
|
|
3095
|
+
title="${e.settings.navCollapsed?"展开侧栏":"收起侧栏"}"
|
|
3096
|
+
aria-label="${e.settings.navCollapsed?"展开侧栏":"收起侧栏"}"
|
|
3097
3097
|
>
|
|
3098
|
-
<span class="nav-collapse-toggle__icon">${
|
|
3098
|
+
<span class="nav-collapse-toggle__icon">${z.menu}</span>
|
|
3099
3099
|
</button>
|
|
3100
|
-
<
|
|
3100
|
+
<a class="brand" href="https://openclaw.qt.cool" target="_blank" rel="noreferrer" title="访问 OpenClaw 汉化官网" style="text-decoration: none; color: inherit;">
|
|
3101
3101
|
<div class="brand-logo">
|
|
3102
3102
|
<img src="https://mintcdn.com/clawdhub/4rYvG-uuZrMK_URE/assets/pixel-lobster.svg?fit=max&auto=format&n=4rYvG-uuZrMK_URE&q=85&s=da2032e9eac3b5d9bfe7eb96ca6a8a26" alt="OpenClaw" />
|
|
3103
3103
|
</div>
|
|
3104
3104
|
<div class="brand-text">
|
|
3105
|
-
<div class="brand-title">OPENCLAW
|
|
3106
|
-
<div class="brand-sub"
|
|
3105
|
+
<div class="brand-title">OPENCLAW 中文版</div>
|
|
3106
|
+
<div class="brand-sub">网关控制台 · 点击访问官网</div>
|
|
3107
3107
|
</div>
|
|
3108
|
-
</
|
|
3108
|
+
</a>
|
|
3109
3109
|
</div>
|
|
3110
3110
|
<div class="topbar-status">
|
|
3111
3111
|
<div class="pill">
|
|
3112
3112
|
<span class="statusDot ${e.connected?"ok":""}"></span>
|
|
3113
|
-
<span
|
|
3114
|
-
<span class="mono">${e.connected?"
|
|
3113
|
+
<span>健康状态</span>
|
|
3114
|
+
<span class="mono">${e.connected?"正常":"离线"}</span>
|
|
3115
3115
|
</div>
|
|
3116
|
-
${
|
|
3116
|
+
${Qf(e)}
|
|
3117
3117
|
</div>
|
|
3118
3118
|
</header>
|
|
3119
3119
|
<aside class="nav ${e.settings.navCollapsed?"nav--collapsed":""}">
|
|
@@ -3128,13 +3128,13 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3128
3128
|
<span class="nav-label__chevron">${u?"+":"−"}</span>
|
|
3129
3129
|
</button>
|
|
3130
3130
|
<div class="nav-group__items">
|
|
3131
|
-
${d.tabs.map(v=>
|
|
3131
|
+
${d.tabs.map(v=>Wf(e,v))}
|
|
3132
3132
|
</div>
|
|
3133
3133
|
</div>
|
|
3134
3134
|
`})}
|
|
3135
3135
|
<div class="nav-group nav-group--links">
|
|
3136
3136
|
<div class="nav-label nav-label--static">
|
|
3137
|
-
<span class="nav-label__text"
|
|
3137
|
+
<span class="nav-label__text">资源</span>
|
|
3138
3138
|
</div>
|
|
3139
3139
|
<div class="nav-group__items">
|
|
3140
3140
|
<a
|
|
@@ -3142,12 +3142,33 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3142
3142
|
href="https://docs.openclaw.ai"
|
|
3143
3143
|
target="_blank"
|
|
3144
3144
|
rel="noreferrer"
|
|
3145
|
-
title="
|
|
3145
|
+
title="文档(新标签页打开)"
|
|
3146
3146
|
>
|
|
3147
|
-
<span class="nav-item__icon" aria-hidden="true">${
|
|
3148
|
-
<span class="nav-item__text"
|
|
3147
|
+
<span class="nav-item__icon" aria-hidden="true">${z.book}</span>
|
|
3148
|
+
<span class="nav-item__text">文档</span>
|
|
3149
3149
|
</a>
|
|
3150
3150
|
</div>
|
|
3151
|
+
<a
|
|
3152
|
+
class="nav-item nav-item--external"
|
|
3153
|
+
href="https://openclaw.qt.cool"
|
|
3154
|
+
target="_blank"
|
|
3155
|
+
rel="noreferrer"
|
|
3156
|
+
title="汉化官网(新标签页打开)"
|
|
3157
|
+
style="color: #ef4444;"
|
|
3158
|
+
>
|
|
3159
|
+
<span class="nav-item__icon" aria-hidden="true">${z.globe}</span>
|
|
3160
|
+
<span class="nav-item__text">🇨🇳 汉化官网</span>
|
|
3161
|
+
</a>
|
|
3162
|
+
<a
|
|
3163
|
+
class="nav-item nav-item--external"
|
|
3164
|
+
href="https://github.com/1186258278/OpenClawChineseTranslation"
|
|
3165
|
+
target="_blank"
|
|
3166
|
+
rel="noreferrer"
|
|
3167
|
+
title="GitHub 仓库(新标签页打开)"
|
|
3168
|
+
>
|
|
3169
|
+
<span class="nav-item__icon" aria-hidden="true">${z.link}</span>
|
|
3170
|
+
<span class="nav-item__text">GitHub</span>
|
|
3171
|
+
</a>
|
|
3151
3172
|
</div>
|
|
3152
3173
|
</aside>
|
|
3153
3174
|
<main class="content ${a?"content--chat":""}">
|
|
@@ -3158,36 +3179,36 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
3158
3179
|
</div>
|
|
3159
3180
|
<div class="page-meta">
|
|
3160
3181
|
${e.lastError?c`<div class="pill danger">${e.lastError}</div>`:f}
|
|
3161
|
-
${a?
|
|
3182
|
+
${a?Vf(e):f}
|
|
3162
3183
|
</div>
|
|
3163
3184
|
</section>
|
|
3164
3185
|
|
|
3165
|
-
${e.tab==="overview"?
|
|
3186
|
+
${e.tab==="overview"?Ef({connected:e.connected,hello:e.hello,settings:e.settings,password:e.password,lastError:e.lastError,presenceCount:t,sessionsCount:n,cronEnabled:e.cronStatus?.enabled??null,cronNext:s,lastChannelsRefresh:e.channelsLastSuccess,onSettingsChange:d=>e.applySettings(d),onPasswordChange:d=>e.password=d,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.resetToolStream(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity()},onConnect:()=>e.connect(),onRefresh:()=>e.loadOverview()}):f}
|
|
3166
3187
|
|
|
3167
3188
|
${e.tab==="channels"?Ch({connected:e.connected,loading:e.channelsLoading,snapshot:e.channelsSnapshot,lastError:e.channelsError,lastSuccessAt:e.channelsLastSuccess,whatsappMessage:e.whatsappLoginMessage,whatsappQrDataUrl:e.whatsappLoginQrDataUrl,whatsappConnected:e.whatsappLoginConnected,whatsappBusy:e.whatsappBusy,configSchema:e.configSchema,configSchemaLoading:e.configSchemaLoading,configForm:e.configForm,configUiHints:e.configUiHints,configSaving:e.configSaving,configFormDirty:e.configFormDirty,nostrProfileFormState:e.nostrProfileFormState,nostrProfileAccountId:e.nostrProfileAccountId,onRefresh:d=>oe(e,d),onWhatsAppStart:d=>e.handleWhatsAppStart(d),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(d,u)=>Ft(e,d,u),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(d,u)=>e.handleNostrProfileEdit(d,u),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(d,u)=>e.handleNostrProfileFieldChange(d,u),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):f}
|
|
3168
3189
|
|
|
3169
|
-
${e.tab==="instances"?
|
|
3190
|
+
${e.tab==="instances"?Xh({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>qs(e)}):f}
|
|
3170
3191
|
|
|
3171
|
-
${e.tab==="sessions"?
|
|
3192
|
+
${e.tab==="sessions"?Bf({loading:e.sessionsLoading,result:e.sessionsResult,error:e.sessionsError,activeMinutes:e.sessionsFilterActive,limit:e.sessionsFilterLimit,includeGlobal:e.sessionsIncludeGlobal,includeUnknown:e.sessionsIncludeUnknown,basePath:e.basePath,onFiltersChange:d=>{e.sessionsFilterActive=d.activeMinutes,e.sessionsFilterLimit=d.limit,e.sessionsIncludeGlobal=d.includeGlobal,e.sessionsIncludeUnknown=d.includeUnknown},onRefresh:()=>Ke(e),onPatch:(d,u)=>Hl(e,d,u),onDelete:d=>zl(e,d)}):f}
|
|
3172
3193
|
|
|
3173
|
-
${e.tab==="cron"?
|
|
3194
|
+
${e.tab==="cron"?qh({loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:e.channelsSnapshot?.channelMeta?.length?e.channelsSnapshot.channelMeta.map(d=>d.id):e.channelsSnapshot?.channelOrder??[],channelLabels:e.channelsSnapshot?.channelLabels??{},channelMeta:e.channelsSnapshot?.channelMeta??[],runsJobId:e.cronRunsJobId,runs:e.cronRuns,onFormChange:d=>e.cronForm={...e.cronForm,...d},onRefresh:()=>e.loadCron(),onAdd:()=>uc(e),onToggle:(d,u)=>pc(e,d,u),onRun:d=>hc(e,d),onRemove:d=>fc(e,d),onLoadRuns:d=>xo(e,d)}):f}
|
|
3174
3195
|
|
|
3175
|
-
${e.tab==="skills"?
|
|
3196
|
+
${e.tab==="skills"?zf({loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:d=>e.skillsFilter=d,onRefresh:()=>Et(e,{clearMessages:!0}),onToggle:(d,u)=>ld(e,d,u),onEdit:(d,u)=>rd(e,d,u),onSaveKey:d=>cd(e,d),onInstall:(d,u,g)=>dd(e,d,u,g)}):f}
|
|
3176
3197
|
|
|
3177
|
-
${e.tab==="nodes"?
|
|
3198
|
+
${e.tab==="nodes"?sf({loading:e.nodesLoading,nodes:e.nodes,devicesLoading:e.devicesLoading,devicesError:e.devicesError,devicesList:e.devicesList,configForm:e.configForm??e.configSnapshot?.config,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,configFormMode:e.configFormMode,execApprovalsLoading:e.execApprovalsLoading,execApprovalsSaving:e.execApprovalsSaving,execApprovalsDirty:e.execApprovalsDirty,execApprovalsSnapshot:e.execApprovalsSnapshot,execApprovalsForm:e.execApprovalsForm,execApprovalsSelectedAgent:e.execApprovalsSelectedAgent,execApprovalsTarget:e.execApprovalsTarget,execApprovalsTargetNodeId:e.execApprovalsTargetNodeId,onRefresh:()=>gn(e),onDevicesRefresh:()=>Te(e),onDeviceApprove:d=>Zc(e,d),onDeviceReject:d=>Xc(e,d),onDeviceRotate:(d,u,g)=>Jc(e,{deviceId:d,role:u,scopes:g}),onDeviceRevoke:(d,u)=>ed(e,{deviceId:d,role:u}),onLoadConfig:()=>be(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Vs(e,d)},onBindDefault:d=>{d?Ft(e,["tools","exec","node"],d):oa(e,["tools","exec","node"])},onBindAgent:(d,u)=>{const g=["agents","list",d,"tools","exec","node"];u?Ft(e,g,u):oa(e,g)},onSaveBindings:()=>ps(e),onExecApprovalsTargetChange:(d,u)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=u,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,u)=>ad(e,d,u),onExecApprovalsRemove:d=>od(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return id(e,d)}}):f}
|
|
3178
3199
|
|
|
3179
|
-
${e.tab==="chat"?
|
|
3200
|
+
${e.tab==="chat"?Wp({sessionKey:e.sessionKey,onSessionKeyChange:d=>{e.sessionKey=d,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:d,lastActiveSessionKey:d}),e.loadAssistantIdentity(),St(e),ms(e)},thinkingLevel:e.chatThinkingLevel,showThinking:r,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:p,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,draft:e.chatMessage,queue:e.chatQueue,connected:e.connected,canSend:e.connected,disabledReason:i,error:e.lastError,sessions:e.sessionsResult,focusMode:o,onRefresh:()=>(e.resetToolStream(),Promise.all([St(e),ms(e)])),onToggleFocusMode:()=>{e.onboarding||e.applySettings({...e.settings,chatFocusMode:!e.settings.chatFocusMode})},onChatScroll:d=>e.handleChatScroll(d),onDraftChange:d=>e.chatMessage=d,attachments:e.chatAttachments,onAttachmentsChange:d=>e.chatAttachments=d,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:d=>e.removeQueuedMessage(d),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:d=>e.handleOpenSidebar(d),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:d=>e.handleSplitRatioChange(d),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar}):f}
|
|
3180
3201
|
|
|
3181
|
-
${e.tab==="config"?
|
|
3202
|
+
${e.tab==="config"?dh({raw:e.configRaw,originalRaw:e.configRawOriginal,valid:e.configValid,issues:e.configIssues,loading:e.configLoading,saving:e.configSaving,applying:e.configApplying,updating:e.updateRunning,connected:e.connected,schema:e.configSchema,schemaLoading:e.configSchemaLoading,uiHints:e.configUiHints,formMode:e.configFormMode,formValue:e.configForm,originalValue:e.configFormOriginal,searchQuery:e.configSearchQuery,activeSection:e.configActiveSection,activeSubsection:e.configActiveSubsection,onRawChange:d=>{e.configRaw=d},onFormModeChange:d=>e.configFormMode=d,onFormPatch:(d,u)=>Ft(e,d,u),onSearchChange:d=>e.configSearchQuery=d,onSectionChange:d=>{e.configActiveSection=d,e.configActiveSubsection=null},onSubsectionChange:d=>e.configActiveSubsection=d,onReload:()=>be(e),onSave:()=>ps(e),onApply:()=>rc(e),onUpdate:()=>lc(e)}):f}
|
|
3182
3203
|
|
|
3183
|
-
${e.tab==="debug"?
|
|
3204
|
+
${e.tab==="debug"?Zh({loading:e.debugLoading,status:e.debugStatus,health:e.debugHealth,models:e.debugModels,heartbeat:e.debugHeartbeat,eventLog:e.eventLog,callMethod:e.debugCallMethod,callParams:e.debugCallParams,callResult:e.debugCallResult,callError:e.debugCallError,onCallMethodChange:d=>e.debugCallMethod=d,onCallParamsChange:d=>e.debugCallParams=d,onRefresh:()=>hn(e),onCall:()=>yc(e)}):f}
|
|
3184
3205
|
|
|
3185
|
-
${e.tab==="logs"?
|
|
3206
|
+
${e.tab==="logs"?nf({loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:d=>e.logsFilterText=d,onLevelToggle:(d,u)=>{e.logsLevelFilters={...e.logsLevelFilters,[d]:u}},onToggleAutoFollow:d=>e.logsAutoFollow=d,onRefresh:()=>Fs(e,{reset:!0}),onExport:(d,u)=>e.exportLogs(d,u),onScroll:d=>e.handleLogsScroll(d)}):f}
|
|
3186
3207
|
</main>
|
|
3187
|
-
${Uf(e)}
|
|
3188
3208
|
${Kf(e)}
|
|
3209
|
+
${Hf(e)}
|
|
3189
3210
|
</div>
|
|
3190
|
-
`}const sg={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},ig={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};async function ag(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const _r={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},Xa=_r,Es={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(_r));new Set(Object.values(Es));function og(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const rg=4008;class lg{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await zs();const d=Qc({deviceId:i.deviceId,role:s})?.token;o=d??this.opts.token,a=!!(d&&this.opts.token)}const r=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let l;if(t&&i){const d=Date.now(),u=this.connectNonce??void 0,g=og({deviceId:i.deviceId,clientId:this.opts.clientName??Xa.CONTROL_UI,clientMode:this.opts.mode??Es.WEBCHAT,role:s,scopes:n,signedAtMs:d,token:o??null,nonce:u}),v=await Vc(i.privateKey,g);l={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:d,nonce:u}}const p={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Xa.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Es.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:l,caps:[],auth:r,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",p).then(d=>{d?.auth?.deviceToken&&i&&Fo({deviceId:i.deviceId,role:d.auth.role??s,token:d.auth.deviceToken,scopes:d.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(d)}).catch(()=>{a&&i&&Uo({deviceId:i.deviceId,role:s}),this.ws?.close(rg,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,r=o&&typeof o.nonce=="string"?o.nonce:null;r&&(this.connectNonce=r,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Bs(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,r)=>{this.pending.set(s,{resolve:l=>o(l),reject:r})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ms(e){return typeof e=="object"&&e!==null}function cg(e){if(!Ms(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Ms(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function dg(e){if(!Ms(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function Cr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function ug(e,t){const n=Cr(e).filter(s=>s.id!==t.id);return n.push(t),n}function eo(e,t){return Cr(e).filter(n=>n.id!==t)}async function Tr(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=os(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ss(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function pg(e,t){if(!t?.mainSessionKey)return;const n=ss(e.sessionKey,t),s=ss(e.settings.sessionKey,t),i=ss(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},r=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),r&&Se(e,o)}function Er(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new lg({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,gg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,dn(e),Tr(e),ag(e),gn(e,{quiet:!0}),Ce(e,{quiet:!0}),Xs(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>hg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function hg(e,t){try{fg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function fg(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;Xl(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Ko(e,n.sessionKey);const s=Kl(e,n);(s==="final"||s==="error"||s==="aborted")&&(dn(e),Id(e),e.refreshSessionsAfterChat&&(e.refreshSessionsAfterChat=!1,s==="final"&&Ke(e,{activeMinutes:0}))),s==="final"&&St(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&ei(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Ce(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=cg(t.payload);if(n){e.execApprovalQueue=ug(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=eo(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=dg(t.payload);n&&(e.execApprovalQueue=eo(e.execApprovalQueue,n.id))}}function gg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&pg(e,n.sessionDefaults)}function vg(e){e.basePath=bd(),vd(e),Ad(e,!0),wd(e),$d(e),window.addEventListener("popstate",e.popStateHandler),Er(e),fd(e),e.tab==="logs"&&Ys(e),e.tab==="debug"&&Zs(e)}function mg(e){ic(e)}function yg(e){window.removeEventListener("popstate",e.popStateHandler),gd(e),Qs(e),Js(e),xd(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function bg(e,t){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;un(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&yo(e,t.has("tab")||t.has("logsAutoFollow"))}async function wg(e,t){await gc(e,t),await oe(e,!0)}async function $g(e){await vc(e),await oe(e,!0)}async function xg(e){await mc(e),await oe(e,!0)}async function Ag(e){await ps(e),await ye(e),await oe(e,!0)}async function kg(e){await ye(e),await oe(e,!0)}function Sg(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function Mr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function Lr(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function _g(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=$h(n??void 0)}function Cg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Tg(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Eg(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Mg(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Mr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(Lr(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:Sg(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await oe(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Lg(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Mr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(Lr(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const l=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,r=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:r},i.saved&&await oe(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}var Ig=Object.defineProperty,Rg=Object.getOwnPropertyDescriptor,b=(e,t,n,s)=>{for(var i=s>1?void 0:s?Rg(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&Ig(t,n,i),i};const is=wl();function Pg(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let m=class extends Je{constructor(){super(...arguments),this.settings=$l(),this.password="",this.tab="chat",this.onboarding=Pg(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=is.name,this.assistantAvatar=is.avatar,this.assistantAgentId=is.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
|
|
3211
|
+
`}const ig={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},ag={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};async function og(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const _r={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"openclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"openclaw-macos",IOS_APP:"openclaw-ios",ANDROID_APP:"openclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"openclaw-probe"},Ja=_r,Es={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(_r));new Set(Object.values(Es));function rg(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const lg=4008;class cg{constructor(t){this.opts=t,this.ws=null,this.pending=new Map,this.closed=!1,this.lastSeq=null,this.connectNonce=null,this.connectSent=!1,this.connectTimer=null,this.backoffMs=800}start(){this.closed=!1,this.connect()}stop(){this.closed=!0,this.ws?.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),this.opts.onClose?.({code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,a=!1,o=this.opts.token;if(t){i=await zs();const d=Qc({deviceId:i.deviceId,role:s})?.token;o=d??this.opts.token,a=!!(d&&this.opts.token)}const r=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let l;if(t&&i){const d=Date.now(),u=this.connectNonce??void 0,g=rg({deviceId:i.deviceId,clientId:this.opts.clientName??Ja.CONTROL_UI,clientMode:this.opts.mode??Es.WEBCHAT,role:s,scopes:n,signedAtMs:d,token:o??null,nonce:u}),v=await Gc(i.privateKey,g);l={id:i.deviceId,publicKey:i.publicKey,signature:v,signedAt:d,nonce:u}}const p={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Ja.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Es.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:l,caps:[],auth:r,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",p).then(d=>{d?.auth?.deviceToken&&i&&Fo({deviceId:i.deviceId,role:d.auth.role??s,token:d.auth.deviceToken,scopes:d.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(d)}).catch(()=>{a&&i&&Uo({deviceId:i.deviceId,role:s}),this.ws?.close(lg,"connect failed")})}handleMessage(t){let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const i=n;if(i.event==="connect.challenge"){const o=i.payload,r=o&&typeof o.nonce=="string"?o.nonce:null;r&&(this.connectNonce=r,this.sendConnect());return}const a=typeof i.seq=="number"?i.seq:null;a!==null&&(this.lastSeq!==null&&a>this.lastSeq+1&&this.opts.onGap?.({expected:this.lastSeq+1,received:a}),this.lastSeq=a);try{this.opts.onEvent?.(i)}catch(o){console.error("[gateway] event handler error:",o)}return}if(s.type==="res"){const i=n,a=this.pending.get(i.id);if(!a)return;this.pending.delete(i.id),i.ok?a.resolve(i.payload):a.reject(new Error(i.error?.message??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Bs(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,r)=>{this.pending.set(s,{resolve:l=>o(l),reject:r})});return this.ws.send(JSON.stringify(i)),a}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function Ms(e){return typeof e=="object"&&e!==null}function dg(e){if(!Ms(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!Ms(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,a=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!a?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:a}}function ug(e){if(!Ms(e))return null;const t=typeof e.id=="string"?e.id.trim():"";return t?{id:t,decision:typeof e.decision=="string"?e.decision:null,resolvedBy:typeof e.resolvedBy=="string"?e.resolvedBy:null,ts:typeof e.ts=="number"?e.ts:null}:null}function Tr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function pg(e,t){const n=Tr(e).filter(s=>s.id!==t.id);return n.push(t),n}function eo(e,t){return Tr(e).filter(n=>n.id!==t)}async function Cr(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const a=os(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ss(e,t){const n=(e??"").trim(),s=t.mainSessionKey?.trim();if(!s)return n;if(!n)return s;const i=t.mainKey?.trim()||"main",a=t.defaultAgentId?.trim();return n==="main"||n===i||a&&(n===`agent:${a}:main`||n===`agent:${a}:${i}`)?s:n}function hg(e,t){if(!t?.mainSessionKey)return;const n=ss(e.sessionKey,t),s=ss(e.settings.sessionKey,t),i=ss(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},r=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),r&&Se(e,o)}function Er(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new cg({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"openclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,vg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,dn(e),Cr(e),og(e),gn(e,{quiet:!0}),Te(e,{quiet:!0}),Js(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>fg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function fg(e,t){try{gg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function gg(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;Jl(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Ko(e,n.sessionKey);const s=Kl(e,n);(s==="final"||s==="error"||s==="aborted")&&(dn(e),Ld(e),e.refreshSessionsAfterChat&&(e.refreshSessionsAfterChat=!1,s==="final"&&Ke(e,{activeMinutes:0}))),s==="final"&&St(e);return}if(t.event==="presence"){const n=t.payload;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&ei(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Te(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=dg(t.payload);if(n){e.execApprovalQueue=pg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=eo(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=ug(t.payload);n&&(e.execApprovalQueue=eo(e.execApprovalQueue,n.id))}}function vg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&hg(e,n.sessionDefaults)}function mg(e){e.basePath=bd(),vd(e),Ad(e,!0),wd(e),$d(e),window.addEventListener("popstate",e.popStateHandler),Er(e),fd(e),e.tab==="logs"&&Ys(e),e.tab==="debug"&&Zs(e)}function yg(e){ic(e)}function bg(e){window.removeEventListener("popstate",e.popStateHandler),gd(e),Qs(e),Xs(e),xd(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function wg(e,t){if(e.tab==="chat"&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;un(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&yo(e,t.has("tab")||t.has("logsAutoFollow"))}async function $g(e,t){await gc(e,t),await oe(e,!0)}async function xg(e){await vc(e),await oe(e,!0)}async function Ag(e){await mc(e),await oe(e,!0)}async function kg(e){await ps(e),await be(e),await oe(e,!0)}async function Sg(e){await be(e),await oe(e,!0)}function _g(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const a=s.trim(),o=i.join(":").trim();a&&o&&(t[a]=o)}return t}function Mr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function Ir(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Tg(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=xh(n??void 0)}function Cg(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Eg(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Mg(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Ig(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Mr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(Ir(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const a=i?.error??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:a,success:null,fieldErrors:_g(i?.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await oe(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Lg(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Mr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(Ir(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||i?.ok===!1||!i){const l=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,r=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:r},i.saved&&await oe(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}var Rg=Object.defineProperty,Pg=Object.getOwnPropertyDescriptor,b=(e,t,n,s)=>{for(var i=s>1?void 0:s?Pg(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&Rg(t,n,i),i};const is=wl();function Ng(){if(!window.location.search)return!1;const t=new URLSearchParams(window.location.search).get("onboarding");if(!t)return!1;const n=t.trim().toLowerCase();return n==="1"||n==="true"||n==="yes"||n==="on"}let m=class extends Xe{constructor(){super(...arguments),this.settings=$l(),this.password="",this.tab="chat",this.onboarding=Ng(),this.connected=!1,this.theme=this.settings.theme??"system",this.themeResolved="dark",this.hello=null,this.lastError=null,this.eventLog=[],this.eventLogBuffer=[],this.toolStreamSyncTimer=null,this.sidebarCloseTimer=null,this.assistantName=is.name,this.assistantAvatar=is.avatar,this.assistantAgentId=is.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.pendingGatewayUrl=null,this.configLoading=!1,this.configRaw=`{
|
|
3191
3212
|
}
|
|
3192
|
-
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...
|
|
3193
|
-
//# sourceMappingURL=index-
|
|
3213
|
+
`,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...ag},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.debugLoading=!1,this.debugStatus=null,this.debugHealth=null,this.debugModels=[],this.debugHeartbeat=null,this.debugCallMethod="",this.debugCallParams="{}",this.debugCallResult=null,this.debugCallError=null,this.logsLoading=!1,this.logsError=null,this.logsFile=null,this.logsEntries=[],this.logsFilterText="",this.logsLevelFilters={...ig},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=!1,this.basePath="",this.popStateHandler=()=>kd(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),mg(this)}firstUpdated(){yg(this)}disconnectedCallback(){bg(this),super.disconnectedCallback()}updated(e){wg(this,e)}connect(){Er(this)}handleChatScroll(e){ec(this,e)}handleLogsScroll(e){tc(this,e)}exportLogs(e,t){sc(e,t)}resetToolStream(){dn(this)}resetChatScroll(){nc(this)}async loadAssistantIdentity(){await Cr(this)}applySettings(e){Se(this,e)}setTab(e){md(this,e)}setTheme(e,t){yd(this,e,t)}async loadOverview(){await jo(this)}async loadCron(){await ei(this)}async handleAbortChat(){await Vo(this)}removeQueuedMessage(e){Md(this,e)}async handleSendChat(e,t){await Id(this,e,t)}async handleWhatsAppStart(e){await $g(this,e)}async handleWhatsAppWait(){await xg(this)}async handleWhatsAppLogout(){await Ag(this)}async handleChannelConfigSave(){await kg(this)}async handleChannelConfigReload(){await Sg(this)}handleNostrProfileEdit(e,t){Tg(this,e,t)}handleNostrProfileCancel(){Cg(this)}handleNostrProfileFieldChange(e,t){Eg(this,e,t)}async handleNostrProfileSave(){await Ig(this)}async handleNostrProfileImport(){await Lg(this)}handleNostrProfileToggleAdvanced(){Mg(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleGatewayUrlConfirm(){const e=this.pendingGatewayUrl;e&&(this.pendingGatewayUrl=null,Se(this,{...this.settings,gatewayUrl:e}),this.connect())}handleGatewayUrlCancel(){this.pendingGatewayUrl=null}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}render(){return sg(this)}};b([w()],m.prototype,"settings",2);b([w()],m.prototype,"password",2);b([w()],m.prototype,"tab",2);b([w()],m.prototype,"onboarding",2);b([w()],m.prototype,"connected",2);b([w()],m.prototype,"theme",2);b([w()],m.prototype,"themeResolved",2);b([w()],m.prototype,"hello",2);b([w()],m.prototype,"lastError",2);b([w()],m.prototype,"eventLog",2);b([w()],m.prototype,"assistantName",2);b([w()],m.prototype,"assistantAvatar",2);b([w()],m.prototype,"assistantAgentId",2);b([w()],m.prototype,"sessionKey",2);b([w()],m.prototype,"chatLoading",2);b([w()],m.prototype,"chatSending",2);b([w()],m.prototype,"chatMessage",2);b([w()],m.prototype,"chatMessages",2);b([w()],m.prototype,"chatToolMessages",2);b([w()],m.prototype,"chatStream",2);b([w()],m.prototype,"chatStreamStartedAt",2);b([w()],m.prototype,"chatRunId",2);b([w()],m.prototype,"compactionStatus",2);b([w()],m.prototype,"chatAvatarUrl",2);b([w()],m.prototype,"chatThinkingLevel",2);b([w()],m.prototype,"chatQueue",2);b([w()],m.prototype,"chatAttachments",2);b([w()],m.prototype,"sidebarOpen",2);b([w()],m.prototype,"sidebarContent",2);b([w()],m.prototype,"sidebarError",2);b([w()],m.prototype,"splitRatio",2);b([w()],m.prototype,"nodesLoading",2);b([w()],m.prototype,"nodes",2);b([w()],m.prototype,"devicesLoading",2);b([w()],m.prototype,"devicesError",2);b([w()],m.prototype,"devicesList",2);b([w()],m.prototype,"execApprovalsLoading",2);b([w()],m.prototype,"execApprovalsSaving",2);b([w()],m.prototype,"execApprovalsDirty",2);b([w()],m.prototype,"execApprovalsSnapshot",2);b([w()],m.prototype,"execApprovalsForm",2);b([w()],m.prototype,"execApprovalsSelectedAgent",2);b([w()],m.prototype,"execApprovalsTarget",2);b([w()],m.prototype,"execApprovalsTargetNodeId",2);b([w()],m.prototype,"execApprovalQueue",2);b([w()],m.prototype,"execApprovalBusy",2);b([w()],m.prototype,"execApprovalError",2);b([w()],m.prototype,"pendingGatewayUrl",2);b([w()],m.prototype,"configLoading",2);b([w()],m.prototype,"configRaw",2);b([w()],m.prototype,"configRawOriginal",2);b([w()],m.prototype,"configValid",2);b([w()],m.prototype,"configIssues",2);b([w()],m.prototype,"configSaving",2);b([w()],m.prototype,"configApplying",2);b([w()],m.prototype,"updateRunning",2);b([w()],m.prototype,"applySessionKey",2);b([w()],m.prototype,"configSnapshot",2);b([w()],m.prototype,"configSchema",2);b([w()],m.prototype,"configSchemaVersion",2);b([w()],m.prototype,"configSchemaLoading",2);b([w()],m.prototype,"configUiHints",2);b([w()],m.prototype,"configForm",2);b([w()],m.prototype,"configFormOriginal",2);b([w()],m.prototype,"configFormDirty",2);b([w()],m.prototype,"configFormMode",2);b([w()],m.prototype,"configSearchQuery",2);b([w()],m.prototype,"configActiveSection",2);b([w()],m.prototype,"configActiveSubsection",2);b([w()],m.prototype,"channelsLoading",2);b([w()],m.prototype,"channelsSnapshot",2);b([w()],m.prototype,"channelsError",2);b([w()],m.prototype,"channelsLastSuccess",2);b([w()],m.prototype,"whatsappLoginMessage",2);b([w()],m.prototype,"whatsappLoginQrDataUrl",2);b([w()],m.prototype,"whatsappLoginConnected",2);b([w()],m.prototype,"whatsappBusy",2);b([w()],m.prototype,"nostrProfileFormState",2);b([w()],m.prototype,"nostrProfileAccountId",2);b([w()],m.prototype,"presenceLoading",2);b([w()],m.prototype,"presenceEntries",2);b([w()],m.prototype,"presenceError",2);b([w()],m.prototype,"presenceStatus",2);b([w()],m.prototype,"agentsLoading",2);b([w()],m.prototype,"agentsList",2);b([w()],m.prototype,"agentsError",2);b([w()],m.prototype,"sessionsLoading",2);b([w()],m.prototype,"sessionsResult",2);b([w()],m.prototype,"sessionsError",2);b([w()],m.prototype,"sessionsFilterActive",2);b([w()],m.prototype,"sessionsFilterLimit",2);b([w()],m.prototype,"sessionsIncludeGlobal",2);b([w()],m.prototype,"sessionsIncludeUnknown",2);b([w()],m.prototype,"cronLoading",2);b([w()],m.prototype,"cronJobs",2);b([w()],m.prototype,"cronStatus",2);b([w()],m.prototype,"cronError",2);b([w()],m.prototype,"cronForm",2);b([w()],m.prototype,"cronRunsJobId",2);b([w()],m.prototype,"cronRuns",2);b([w()],m.prototype,"cronBusy",2);b([w()],m.prototype,"skillsLoading",2);b([w()],m.prototype,"skillsReport",2);b([w()],m.prototype,"skillsError",2);b([w()],m.prototype,"skillsFilter",2);b([w()],m.prototype,"skillEdits",2);b([w()],m.prototype,"skillsBusyKey",2);b([w()],m.prototype,"skillMessages",2);b([w()],m.prototype,"debugLoading",2);b([w()],m.prototype,"debugStatus",2);b([w()],m.prototype,"debugHealth",2);b([w()],m.prototype,"debugModels",2);b([w()],m.prototype,"debugHeartbeat",2);b([w()],m.prototype,"debugCallMethod",2);b([w()],m.prototype,"debugCallParams",2);b([w()],m.prototype,"debugCallResult",2);b([w()],m.prototype,"debugCallError",2);b([w()],m.prototype,"logsLoading",2);b([w()],m.prototype,"logsError",2);b([w()],m.prototype,"logsFile",2);b([w()],m.prototype,"logsEntries",2);b([w()],m.prototype,"logsFilterText",2);b([w()],m.prototype,"logsLevelFilters",2);b([w()],m.prototype,"logsAutoFollow",2);b([w()],m.prototype,"logsTruncated",2);b([w()],m.prototype,"logsCursor",2);b([w()],m.prototype,"logsLastFetchAt",2);b([w()],m.prototype,"logsLimit",2);b([w()],m.prototype,"logsMaxBytes",2);b([w()],m.prototype,"logsAtBottom",2);m=b([lo("openclaw-app")],m);
|
|
3214
|
+
//# sourceMappingURL=index-CNKLKKXX.js.map
|