@termix-it/cryptoclaw 1.0.1 → 1.0.2
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/CHANGELOG.md +93 -93
- package/assets/favicon.svg +22 -0
- package/dist/{acp-cli-Bsrf851G.js → acp-cli-CBFKSvET.js} +2 -2
- package/dist/{acp-cli-C9D24JzU.js → acp-cli-CEPAR8vh.js} +2 -2
- package/dist/{agent-BH-rLX4t.js → agent-8dTCwA-D.js} +2 -2
- package/dist/{agent-mns7e_gL.js → agent-sjalTGVA.js} +2 -2
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-options-CUOi5M0r.js → channel-options-B951pKy8.js} +1 -1
- package/dist/{channel-options-B3XNSAJG.js → channel-options-DJsSCLD8.js} +1 -1
- package/dist/{channels-cli-BRxxmnVq.js → channels-cli-Fv9FTQXn.js} +6 -6
- package/dist/{channels-cli-xTlvzb2Z.js → channels-cli-Lq6EWRJ9.js} +5 -5
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/{cli-B7NiNFc2.js → cli-Bzyu6rQE.js} +2 -2
- package/dist/{cli-6yV4qEGI.js → cli-DJnpasWd.js} +2 -2
- package/dist/{command-options-DeWanQ_1.js → command-options-DBpEhnW5.js} +1 -1
- package/dist/{completion-cli-DyiCPCwN.js → completion-cli-Bd5FrGHg.js} +25 -25
- package/dist/{completion-cli-BIA4Amxj.js → completion-cli-Cs-B1hk7.js} +1 -1
- package/dist/{config-guard-C4vrsjgm.js → config-guard-Csl9Ubn5.js} +36 -36
- package/dist/{configure-BupCndyG.js → configure-CeTzu0Ed.js} +14 -14
- package/dist/{configure-B28_m98z.js → configure-CxPJaP8X.js} +14 -14
- package/dist/control-ui/apple-touch-icon.png +0 -0
- package/dist/control-ui/assets/{index-DQ-7PWhX.js → index-BdjmXlOn.js} +372 -363
- package/dist/control-ui/assets/index-BdjmXlOn.js.map +1 -0
- package/dist/control-ui/assets/{index-nlpH70Eh.css → index-BxkHytum.css} +1 -1
- package/dist/control-ui/favicon-32.png +0 -0
- package/dist/control-ui/favicon.ico +0 -0
- package/dist/control-ui/favicon.svg +4 -4
- package/dist/control-ui/index.html +2 -2
- package/dist/{cron-cli-CaCwFGvb.js → cron-cli-D8gKivN0.js} +2 -2
- package/dist/{cron-cli-v8FMB7_N.js → cron-cli-yC5Cy77c.js} +2 -2
- package/dist/{daemon-cli-JZ9ONoBh.js → daemon-cli-BM8zb09s.js} +5 -5
- package/dist/{daemon-cli-D24Obngu.js → daemon-cli-D8AC0Q_A.js} +5 -5
- package/dist/{deps-DY5l__pK.js → deps-BhcPiVuz.js} +1 -1
- package/dist/{deps-BDQ4UyT5.js → deps-ZGqhOjkR.js} +1 -1
- package/dist/{directory-cli-B8IA2RSF.js → directory-cli--IOOMz66.js} +2 -2
- package/dist/{directory-cli-C9y2B84i.js → directory-cli-DGFlpQ4T.js} +2 -2
- package/dist/{dns-cli-DoO4a6op.js → dns-cli-DkhYuREi.js} +2 -2
- package/dist/{dns-cli-DJUkN_WU.js → dns-cli-fQ4wu1HJ.js} +2 -2
- package/dist/{docs-cli-CcQ9shjL.js → docs-cli-BgnDzmFT.js} +5 -5
- package/dist/{docs-cli-CPus_TqL.js → docs-cli-CPaJzUSD.js} +5 -5
- package/dist/{doctor-D3VWObNR.js → doctor-D6M3Hc0a.js} +3 -3
- package/dist/{doctor-ClJURW58.js → doctor-DRRL31R4.js} +3 -3
- package/dist/entry.js +1 -1
- package/dist/{exec-approvals-cli-DC9v48w9.js → exec-approvals-cli-BhEdzGao.js} +3 -3
- package/dist/{exec-approvals-cli-Djev4HNk.js → exec-approvals-cli-DHMroOAh.js} +3 -3
- package/dist/extensionAPI.js +8 -8
- package/dist/{gateway-cli-CHZrqsVp.js → gateway-cli-CbQ4xoXp.js} +14 -14
- package/dist/{gateway-cli--xOlaN5f.js → gateway-cli-DO7lIBZ5.js} +15 -15
- package/dist/{github-copilot-auth-CLh6feLw.js → github-copilot-auth-D6I2MUxi.js} +1 -1
- package/dist/{github-copilot-auth-CeBZ5KDq.js → github-copilot-auth-DvShXmvU.js} +1 -1
- package/dist/{health-format-QWTDdHdV.js → health-format-DlvTEKqI.js} +1 -1
- package/dist/{health-format-D0ylScGO.js → health-format-SZpheYuf.js} +1 -1
- package/dist/hooks/bundled/boot-md/HOOK.md +1 -1
- package/dist/hooks/bundled/command-logger/HOOK.md +1 -1
- package/dist/hooks/bundled/session-memory/HOOK.md +1 -1
- package/dist/hooks/bundled/soul-evil/HOOK.md +1 -1
- package/dist/{hooks-cli-IS7KFMZy.js → hooks-cli-CedlcxxR.js} +4 -4
- package/dist/{hooks-cli-C9066q7q.js → hooks-cli-DRarvOK2.js} +4 -4
- package/dist/index.js +38 -38
- package/dist/{links-DXtV_A64.js → links-Dv1EDiwa.js} +1 -1
- package/dist/{links-KcaRpMJg.js → links-kbubTyay.js} +1 -1
- package/dist/{loader-BNqYr2Am.js → loader-DE_vKAH5.js} +10 -10
- package/dist/{logs-cli-BRQOdLoD.js → logs-cli-_DHuOrR4.js} +2 -2
- package/dist/{logs-cli-D08L6RIX.js → logs-cli-emy-Mg4S.js} +2 -2
- package/dist/{models-cli-CovM2RsI.js → models-cli-CdrDfutq.js} +4 -4
- package/dist/{models-cli-D0bxf-ID.js → models-cli-CgIqfTHx.js} +4 -4
- package/dist/{node-cli-whSrpDNN.js → node-cli-Bsn9lQ6O.js} +2 -2
- package/dist/{node-cli-DoMmvbg-.js → node-cli-Ckvs6bcI.js} +2 -2
- package/dist/{nodes-cli-CeMIAaHZ.js → nodes-cli-BELOAYB6.js} +2 -2
- package/dist/{nodes-cli-DRmkJeRw.js → nodes-cli-CTQPoAcf.js} +2 -2
- package/dist/{onboard-channels-uZ5vLniX.js → onboard-channels-B5qHfMk8.js} +2 -2
- package/dist/{onboard-channels-xteKATz4.js → onboard-channels-BgchLTab.js} +2 -2
- package/dist/{onboard-skills-tUnJDYV8.js → onboard-skills-CyG0xbsu.js} +7 -7
- package/dist/{onboard-skills-CKpZ4Xwu.js → onboard-skills-DEnuz7z3.js} +7 -7
- package/dist/{onboarding-DX15S5UW.js → onboarding-B6aTF0nd.js} +18 -18
- package/dist/{pairing-cli-Oq8UZJRJ.js → pairing-cli-C_PnyRzK.js} +2 -2
- package/dist/{pairing-cli-B7Bji_j_.js → pairing-cli-CocCRLzF.js} +2 -2
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/{plugins-cli-BVoSu7m7.js → plugins-cli-DB1NYN9W.js} +5 -5
- package/dist/{plugins-cli-ChkSbzKF.js → plugins-cli-Dn9I2nvT.js} +5 -5
- package/dist/{program-DpxSYPmu.js → program-CL1V1uQh.js} +18 -18
- package/dist/{register.subclis-DG215F73.js → register.subclis-Bf9yES9h.js} +26 -26
- package/dist/{reply-3TWXjNUA.js → reply-qWVVjmhR.js} +10 -10
- package/dist/{run-main-D43qwCZX.js → run-main-C12Z921D.js} +19 -19
- package/dist/{sandbox-cli-BPdnq1hk.js → sandbox-cli-DVfJ38Q2.js} +4 -4
- package/dist/{sandbox-cli-a3oEVi7W.js → sandbox-cli-DqrtTHAP.js} +4 -4
- package/dist/{security-cli-Devsjfv_.js → security-cli-2AAajc4y.js} +2 -2
- package/dist/{security-cli-C1XbzHNF.js → security-cli-YL2ZTkkR.js} +2 -2
- package/dist/{server-node-events-BVLdeCJU.js → server-node-events-uUSBf7hZ.js} +4 -4
- package/dist/{server-node-events-DLZj55Ir.js → server-node-events-x6ZMjAs1.js} +4 -4
- package/dist/{skills-cli-DnSEVLxn.js → skills-cli-CYZbvr7O.js} +2 -2
- package/dist/{skills-cli-g1nC-Yz9.js → skills-cli-eDUNGpwb.js} +2 -2
- package/dist/{status-D09U-Iku.js → status-BnbwLzB2.js} +1 -1
- package/dist/{status-1TQxVU1M.js → status-CN2V3fan.js} +18 -18
- package/dist/{status-CbMg399g.js → status-DCrBN9vJ.js} +1 -1
- package/dist/{system-cli-D3UizeGy.js → system-cli-BEmIixtY.js} +2 -2
- package/dist/{system-cli-DJ_e6msK.js → system-cli-ZxnlO0-v.js} +2 -2
- package/dist/{tui-cli-PKJ39Zsl.js → tui-cli-B9iCyCn2.js} +2 -2
- package/dist/{tui-cli-DPhl5a66.js → tui-cli-iakTIAvk.js} +2 -2
- package/dist/{update-cli-C5x50A17.js → update-cli-DUO4CVNB.js} +12 -12
- package/dist/{update-cli-DKLyK_Tu.js → update-cli-DlXzjuIc.js} +11 -11
- package/dist/{update-runner-DotP-T6Y.js → update-runner-L1EJYQRF.js} +2 -2
- package/dist/{update-runner-vOge0-Wj.js → update-runner-eJ773fp-.js} +2 -2
- package/dist/{webhooks-cli-DEqtDAwW.js → webhooks-cli-BLHZn_at.js} +2 -2
- package/dist/{webhooks-cli-ORjumqe4.js → webhooks-cli-UhujyhVU.js} +2 -2
- package/docs/assets/pixel-lobster.svg +3 -3
- package/docs/blockchain/aave.md +72 -0
- package/docs/blockchain/agent-identity.md +73 -0
- package/docs/blockchain/contracts.md +96 -0
- package/docs/blockchain/defi.md +61 -0
- package/docs/blockchain/index.md +92 -0
- package/docs/blockchain/market-data.md +98 -0
- package/docs/blockchain/nft.md +44 -0
- package/docs/blockchain/portfolio.md +57 -0
- package/docs/blockchain/security.md +83 -0
- package/docs/blockchain/swap.md +89 -0
- package/docs/blockchain/wallet.md +77 -0
- package/docs/concepts/features.md +29 -10
- package/docs/docs.json +76 -6
- package/docs/index.md +44 -44
- package/docs/start/getting-started.md +10 -9
- package/docs/zh-CN/blockchain/aave.md +63 -0
- package/docs/zh-CN/blockchain/agent-identity.md +62 -0
- package/docs/zh-CN/blockchain/contracts.md +64 -0
- package/docs/zh-CN/blockchain/defi.md +49 -0
- package/docs/zh-CN/blockchain/index.md +92 -0
- package/docs/zh-CN/blockchain/market-data.md +68 -0
- package/docs/zh-CN/blockchain/nft.md +43 -0
- package/docs/zh-CN/blockchain/portfolio.md +49 -0
- package/docs/zh-CN/blockchain/security.md +75 -0
- package/docs/zh-CN/blockchain/swap.md +68 -0
- package/docs/zh-CN/blockchain/wallet.md +71 -0
- package/extensions/voice-call/README.md +2 -2
- package/extensions/voice-call/src/cli.ts +1 -1
- package/package.json +1 -1
- package/dist/control-ui/assets/index-DQ-7PWhX.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
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]`,Pt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Pa=/'/g,Da=/"/g,tr=/^(?:script|style|textarea|title)$/i,nr=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=nr(1),mn=nr(2),Qe=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Fa=new WeakMap,ct=ut.createTreeWalker(ut,129);function sr(e,t){if(!ki(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ma!==void 0?Ma.createHTML(t):t}const cc=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=Pt;for(let l=0;l<n;l++){const c=e[l];let u,p,g=-1,h=0;for(;h<c.length&&(o.lastIndex=h,p=o.exec(c),p!==null);)h=o.lastIndex,o===Pt?p[1]==="!--"?o=Ia:p[1]!==void 0?o=Ra:p[2]!==void 0?(tr.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=tt):p[3]!==void 0&&(o=tt):o===tt?p[0]===">"?(o=i??Pt,g=-1):p[1]===void 0?g=-2:(g=o.lastIndex-p[2].length,u=p[1],o=p[3]===void 0?tt:p[3]==='"'?Da:Pa):o===Da||o===Pa?o=tt:o===Ia||o===Ra?o=Pt:(o=tt,i=void 0);const d=o===tt&&e[l+1].startsWith("/>")?" ":"";a+=o===Pt?c+rc:g>=0?(s.push(u),c.slice(0,g)+Xo+c.slice(g)+Ge+d):c+Ge+(g===-2?l:d)}return[sr(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let Ws=class ir{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,c=this.parts,[u,p]=cc(t,n);if(this.el=ir.createElement(u,s),ct.currentNode=this.el.content,n===2||n===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=ct.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const g of i.getAttributeNames())if(g.endsWith(Xo)){const h=p[o++],d=i.getAttribute(g).split(Ge),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:a,name:f[2],strings:d,ctor:f[1]==="."?uc:f[1]==="?"?gc:f[1]==="@"?pc:Qn}),i.removeAttribute(g)}else g.startsWith(Ge)&&(c.push({type:6,index:a}),i.removeAttribute(g));if(tr.test(i.tagName)){const g=i.textContent.split(Ge),h=g.length-1;if(h>0){i.textContent=Fn?Fn.emptyScript:"";for(let d=0;d<h;d++)i.append(g[d],Zt()),ct.nextNode(),c.push({type:2,index:++a});i.append(g[h],Zt())}}}else if(i.nodeType===8)if(i.data===er)c.push({type:2,index:a});else{let g=-1;for(;(g=i.data.indexOf(Ge,g+1))!==-1;)c.push({type:7,index:a}),g+=Ge.length-1}a++}}static createElement(t,n){const s=ut.createElement("template");return s.innerHTML=t,s}};function _t(e,t,n=e,s){if(t===Qe)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Jt(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=_t(e,i._$AS(e,t.values),i,s)),t}class dc{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??ut).importNode(n,!0);ct.currentNode=i;let a=ct.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Vn(a,a.nextSibling,this,t):c.type===1?u=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(u=new fc(a,this,t)),this._$AV.push(u),c=s[++l]}o!==c?.index&&(a=ct.nextNode(),o++)}return ct.currentNode=ut,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 Vn=class ar{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=v,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=_t(this,t,n),Jt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==Qe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):lc(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!==v&&Jt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ut.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=Ws.createElement(sr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new dc(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Fa.get(t.strings);return n===void 0&&Fa.set(t.strings,n=new Ws(t)),n}k(t){ki(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 ar(this.O(Zt()),this.O(Zt()),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=La(t).nextSibling;La(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class Qn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=v,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=v}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=_t(this,t,n,0),o=!Jt(t)||t!==this._$AH&&t!==Qe,o&&(this._$AH=t);else{const l=t;let c,u;for(t=a[0],c=0;c<a.length-1;c++)u=_t(this,l[s+c],n,c),u===Qe&&(u=this._$AH[c]),o||=!Jt(u)||u!==this._$AH[c],u===v?t=v:t!==v&&(t+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let uc=class extends Qn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},gc=class extends Qn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},pc=class extends Qn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=_t(this,t,n,0)??v)===Qe)return;const s=this._$AH,i=t===v&&s!==v||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==v&&(s===v||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)}},fc=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){_t(this,t)}};const hc={I:Vn},vc=wi.litHtmlPolyfillSupport;vc?.(Ws,Vn),(wi.litHtmlVersions??=[]).push("3.3.2");const mc=(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 Vn(t.insertBefore(Zt(),a),a,void 0,n??{})}return i._$AI(e),i};const Si=globalThis;let Tt=class extends At{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=mc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Qe}};Tt._$litElement$=!0,Tt.finalized=!0,Si.litElementHydrateSupport?.({LitElement:Tt});const bc=Si.litElementPolyfillSupport;bc?.({LitElement:Tt});(Si.litElementVersions??=[]).push("4.2.2");const or=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const yc={attribute:!0,type:String,converter:Dn,reflect:!1,hasChanged:$i},xc=(e=yc,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(l){const c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const c=this[o];t.call(this,l),this.requestUpdate(o,c,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Yn(e){return(t,n)=>typeof n=="object"?xc(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 $(e){return Yn({...e,state:!0,attribute:!1})}async function ye(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 $c(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 wc(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 kc(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}}}function gt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Et(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
4
|
-
`}function
|
|
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 En=globalThis,mi=En.ShadowRoot&&(En.ShadyCSS===void 0||En.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,bi=Symbol(),Sa=new WeakMap;let Yo=class{constructor(t,n,s){if(this._$cssResult$=!0,s!==bi)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(mi&&t===void 0){const s=n!==void 0&&n.length===1;s&&(t=Sa.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&Sa.set(n,t))}return t}toString(){return this.cssText}};const Ql=e=>new Yo(typeof e=="string"?e:e+"",void 0,bi),Yl=(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 Yo(n,e,bi)},Zl=(e,t)=>{if(mi)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const s=document.createElement("style"),i=En.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=n.cssText,e.appendChild(s)}},Aa=mi?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const s of t.cssRules)n+=s.cssText;return Ql(n)})(e):e;const{is:Jl,defineProperty:Xl,getOwnPropertyDescriptor:ec,getOwnPropertyNames:tc,getOwnPropertySymbols:nc,getPrototypeOf:sc}=Object,qn=globalThis,Ca=qn.trustedTypes,ic=Ca?Ca.emptyScript:"",ac=qn.reactiveElementPolyfillSupport,Wt=(e,t)=>e,Pn={toAttribute(e,t){switch(t){case Boolean:e=e?ic: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}},yi=(e,t)=>!Jl(e,t),Ta={attribute:!0,type:String,converter:Pn,reflect:!1,useDefault:!1,hasChanged:yi};Symbol.metadata??=Symbol("metadata"),qn.litPropertyMetadata??=new WeakMap;let At=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=Ta){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&&Xl(this.prototype,t,i)}}static getPropertyDescriptor(t,n,s){const{get:i,set:a}=ec(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:i,set(o){const l=i?.call(this);a?.call(this,o),this.requestUpdate(t,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ta}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;const t=sc(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Wt("properties"))){const n=this.properties,s=[...tc(n),...nc(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(Aa(i))}else t!==void 0&&n.push(Aa(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 Zl(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:Pn).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:Pn;this._$Em=i;const l=o.fromAttribute(n,a.type);this[i]=l??this._$Ej?.get(i)??l,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??yi)(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,l=this[i];o!==!0||this._$AL.has(i)||l===void 0||this.C(i,void 0,a,l)}}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){}};At.elementStyles=[],At.shadowRootOptions={mode:"open"},At[Wt("elementProperties")]=new Map,At[Wt("finalized")]=new Map,ac?.({ReactiveElement:At}),(qn.reactiveElementVersions??=[]).push("2.1.2");const xi=globalThis,_a=e=>e,Dn=xi.trustedTypes,Ea=Dn?Dn.createPolicy("lit-html",{createHTML:e=>e}):void 0,Zo="$lit$",Ge=`lit$${Math.random().toFixed(9).slice(2)}$`,Jo="?"+Ge,oc=`<${Jo}>`,ut=document,Zt=()=>ut.createComment(""),Jt=e=>e===null||typeof e!="object"&&typeof e!="function",$i=Array.isArray,rc=e=>$i(e)||typeof e?.[Symbol.iterator]=="function",ys=`[
|
|
2
|
+
\f\r]`,Pt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,La=/-->/g,Ma=/>/g,tt=RegExp(`>|${ys}(?:([^\\s"'>=/]+)(${ys}*=${ys}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ia=/'/g,Ra=/"/g,Xo=/^(?:script|style|textarea|title)$/i,er=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),r=er(1),mn=er(2),Qe=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Pa=new WeakMap,ct=ut.createTreeWalker(ut,129);function tr(e,t){if(!$i(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ea!==void 0?Ea.createHTML(t):t}const lc=(e,t)=>{const n=e.length-1,s=[];let i,a=t===2?"<svg>":t===3?"<math>":"",o=Pt;for(let l=0;l<n;l++){const c=e[l];let u,p,g=-1,h=0;for(;h<c.length&&(o.lastIndex=h,p=o.exec(c),p!==null);)h=o.lastIndex,o===Pt?p[1]==="!--"?o=La:p[1]!==void 0?o=Ma:p[2]!==void 0?(Xo.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=tt):p[3]!==void 0&&(o=tt):o===tt?p[0]===">"?(o=i??Pt,g=-1):p[1]===void 0?g=-2:(g=o.lastIndex-p[2].length,u=p[1],o=p[3]===void 0?tt:p[3]==='"'?Ra:Ia):o===Ra||o===Ia?o=tt:o===La||o===Ma?o=Pt:(o=tt,i=void 0);const d=o===tt&&e[l+1].startsWith("/>")?" ":"";a+=o===Pt?c+oc:g>=0?(s.push(u),c.slice(0,g)+Zo+c.slice(g)+Ge+d):c+Ge+(g===-2?l:d)}return[tr(e,a+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};let js=class nr{constructor({strings:t,_$litType$:n},s){let i;this.parts=[];let a=0,o=0;const l=t.length-1,c=this.parts,[u,p]=lc(t,n);if(this.el=nr.createElement(u,s),ct.currentNode=this.el.content,n===2||n===3){const g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=ct.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const g of i.getAttributeNames())if(g.endsWith(Zo)){const h=p[o++],d=i.getAttribute(g).split(Ge),f=/([.?@])?(.*)/.exec(h);c.push({type:1,index:a,name:f[2],strings:d,ctor:f[1]==="."?dc:f[1]==="?"?uc:f[1]==="@"?gc:Vn}),i.removeAttribute(g)}else g.startsWith(Ge)&&(c.push({type:6,index:a}),i.removeAttribute(g));if(Xo.test(i.tagName)){const g=i.textContent.split(Ge),h=g.length-1;if(h>0){i.textContent=Dn?Dn.emptyScript:"";for(let d=0;d<h;d++)i.append(g[d],Zt()),ct.nextNode(),c.push({type:2,index:++a});i.append(g[h],Zt())}}}else if(i.nodeType===8)if(i.data===Jo)c.push({type:2,index:a});else{let g=-1;for(;(g=i.data.indexOf(Ge,g+1))!==-1;)c.push({type:7,index:a}),g+=Ge.length-1}a++}}static createElement(t,n){const s=ut.createElement("template");return s.innerHTML=t,s}};function _t(e,t,n=e,s){if(t===Qe)return t;let i=s!==void 0?n._$Co?.[s]:n._$Cl;const a=Jt(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=_t(e,i._$AS(e,t.values),i,s)),t}class cc{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??ut).importNode(n,!0);ct.currentNode=i;let a=ct.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Gn(a,a.nextSibling,this,t):c.type===1?u=new c.ctor(a,c.name,c.strings,this,t):c.type===6&&(u=new pc(a,this,t)),this._$AV.push(u),c=s[++l]}o!==c?.index&&(a=ct.nextNode(),o++)}return ct.currentNode=ut,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 Gn=class sr{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,s,i){this.type=2,this._$AH=v,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=_t(this,t,n),Jt(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==Qe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):rc(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!==v&&Jt(this._$AH)?this._$AA.nextSibling.data=t:this.T(ut.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=js.createElement(tr(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(n);else{const a=new cc(i,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(t){let n=Pa.get(t.strings);return n===void 0&&Pa.set(t.strings,n=new js(t)),n}k(t){$i(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 sr(this.O(Zt()),this.O(Zt()),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=_a(t).nextSibling;_a(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}};class Vn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,s,i,a){this.type=1,this._$AH=v,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=v}_$AI(t,n=this,s,i){const a=this.strings;let o=!1;if(a===void 0)t=_t(this,t,n,0),o=!Jt(t)||t!==this._$AH&&t!==Qe,o&&(this._$AH=t);else{const l=t;let c,u;for(t=a[0],c=0;c<a.length-1;c++)u=_t(this,l[s+c],n,c),u===Qe&&(u=this._$AH[c]),o||=!Jt(u)||u!==this._$AH[c],u===v?t=v:t!==v&&(t+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(t)}j(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let dc=class extends Vn{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===v?void 0:t}},uc=class extends Vn{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},gc=class extends Vn{constructor(t,n,s,i,a){super(t,n,s,i,a),this.type=5}_$AI(t,n=this){if((t=_t(this,t,n,0)??v)===Qe)return;const s=this._$AH,i=t===v&&s!==v||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,a=t!==v&&(s===v||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)}},pc=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){_t(this,t)}};const fc={I:Gn},hc=xi.litHtmlPolyfillSupport;hc?.(js,Gn),(xi.litHtmlVersions??=[]).push("3.3.2");const vc=(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 Gn(t.insertBefore(Zt(),a),a,void 0,n??{})}return i._$AI(e),i};const wi=globalThis;let Tt=class extends At{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=vc(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Qe}};Tt._$litElement$=!0,Tt.finalized=!0,wi.litElementHydrateSupport?.({LitElement:Tt});const mc=wi.litElementPolyfillSupport;mc?.({LitElement:Tt});(wi.litElementVersions??=[]).push("4.2.2");const ir=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const bc={attribute:!0,type:String,converter:Pn,reflect:!1,hasChanged:yi},yc=(e=bc,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(l){const c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,e,!0,l)},init(l){return l!==void 0&&this.C(o,void 0,e,l),l}}}if(s==="setter"){const{name:o}=n;return function(l){const c=this[o];t.call(this,l),this.requestUpdate(o,c,e,!0,l)}}throw Error("Unsupported decorator location: "+s)};function Qn(e){return(t,n)=>typeof n=="object"?yc(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 $(e){return Qn({...e,state:!0,attribute:!1})}async function ye(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 xc(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 $c(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 wc(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}}}function gt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Et(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
4
|
+
`}function ar(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],l=t[a+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof l=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const c=s;c[o]==null&&(c[o]=typeof l=="number"?[]:{}),s=c[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 or(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 Ee(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Sc(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function rr(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});kc(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function kc(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Sc(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=gt(t.config??{}),e.configFormOriginal=gt(t.config??{}),e.configRawOriginal=n)}async function Ln(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 Ee(e)}catch(t){e.lastError=String(t)}finally{e.configSaving=!1}}}async function Ac(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 Ee(e)}catch(t){e.lastError=String(t)}finally{e.configApplying=!1}}}async function Cc(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 $e(e,t,n){const s=gt(e.configForm??e.configSnapshot?.config??{});ar(s,t,n),e.configForm=s,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=Et(s))}function ze(e,t){const n=gt(e.configForm??e.configSnapshot?.config??{});or(n,t),e.configForm=n,e.configFormDirty=!0,e.configFormMode==="form"&&(e.configRaw=Et(n))}function Tc(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 _c(e){const{state:t,callbacks:n,accountId:s}=e,i=Tc(t),a=(l,c,u={})=>{const{type:p="text",placeholder:g,maxLength:h,help:d}=u,f=t.values[l]??"",m=t.fieldErrors[l],k=`nostr-profile-${l}`;return p==="textarea"?r`
|
|
5
5
|
<div class="form-field" style="margin-bottom: 12px;">
|
|
6
6
|
<label for="${k}" style="display: block; margin-bottom: 4px; font-weight: 500;">
|
|
7
7
|
${c}
|
|
@@ -121,19 +121,19 @@
|
|
|
121
121
|
</div>
|
|
122
122
|
`:v}
|
|
123
123
|
</div>
|
|
124
|
-
`}function
|
|
124
|
+
`}function Ec(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)}}async function Lc(e,t){await xc(e,t),await ye(e,!0)}async function Mc(e){await $c(e),await ye(e,!0)}async function Ic(e){await wc(e),await ye(e,!0)}async function Rc(e){await Ln(e),await Ee(e),await ye(e,!0)}async function Pc(e){await Ee(e),await ye(e,!0)}function Dc(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 lr(e){return(e.channelsSnapshot?.channelAccounts?.nostr??[])[0]?.accountId??e.nostrProfileAccountId??"default"}function cr(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Fc(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Ec(n??void 0)}function Nc(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Oc(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function Bc(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Uc(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=lr(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(cr(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:Dc(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 ye(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function zc(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=lr(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(cr(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 c=i?.error??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:c,success:null};return}const a=i.merged??i.imported??null,o=a?{...t.values,...a}:t.values,l=!!(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:l},i.saved&&await ye(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}function dr(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 Ws=450;function an(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,a=t&&!e.chatHasAutoScrolled;if(!(a||e.chatUserNearBottom||i<Ws)){e.chatNewMessagesBelow=!0;return}a&&(e.chatHasAutoScrolled=!0),s.scrollTop=s.scrollHeight,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1;const l=a?150:120;e.chatScrollTimeout=window.setTimeout(()=>{e.chatScrollTimeout=null;const c=n();if(!c)return;const u=c.scrollHeight-c.scrollTop-c.clientHeight;(a||e.chatUserNearBottom||u<Ws)&&(c.scrollTop=c.scrollHeight,e.chatUserNearBottom=!0)},l)})})}function ur(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 Hc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=s<Ws,e.chatUserNearBottom&&(e.chatNewMessagesBelow=!1)}function Kc(e,t){const n=t.currentTarget;if(!n)return;const s=n.scrollHeight-n.scrollTop-n.clientHeight;e.logsAtBottom=s<80}function Da(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0,e.chatNewMessagesBelow=!1}function jc(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
125
125
|
`)}
|
|
126
|
-
`],{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=`cryptoclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function qc(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)}async function Zn(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 Gc(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 Vc=2e3,Qc=new Set(["trace","debug","info","warn","error","fatal"]);function Yc(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 Zc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Qc.has(t)?t:null}function Jc(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=Zc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=Yc(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:s,level:i,subsystem:l,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ai(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(l=>typeof l=="string"):[]).map(Jc),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-Vc),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)}}}async function Jn(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 Xc(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Jn(e,{quiet:!0})},5e3))}function ed(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Ci(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ai(e,{quiet:!0})},2e3))}function Ti(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function _i(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Zn(e)},3e3))}function Ei(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function fr(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function hr(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function In(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function Li(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const td=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,bn=/<\s*\/?\s*final\b[^<>]*>/gi,Oa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Ba(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(c=>a>=c.start&&o<=c.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Ua(e,t){return t.some(n=>e>=n.start&&e<n.end)}function nd(e,t){return e.trimStart()}function sd(e,t){if(!e||!td.test(e))return e;let n=e;if(bn.test(n)){bn.lastIndex=0;const l=[],c=Ba(n);for(const u of n.matchAll(bn)){const p=u.index??0;l.push({start:p,length:u[0].length,inCode:Ua(p,c)})}for(let u=l.length-1;u>=0;u--){const p=l[u];p.inCode||(n=n.slice(0,p.start)+n.slice(p.start+p.length))}}else bn.lastIndex=0;const s=Ba(n);Oa.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(Oa)){const c=l.index??0,u=l[1]==="/";Ua(c,s)||(o?u&&(o=!1):(i+=n.slice(a,c),u||(o=!0)),a=c+l[0].length)}return i+=n.slice(a),nd(i)}function Xt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function V(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e,n=Math.abs(t),s=t<0?"from now":"ago",i=Math.round(n/1e3);if(i<60)return t<0?"just now":`${i}s ago`;const a=Math.round(i/60);if(a<60)return`${a}m ${s}`;const o=Math.round(a/60);return o<48?`${o}h ${s}`:`${Math.round(o/24)}d ${s}`}function vr(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 Gs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Vs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function mr(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 Nn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function $s(e){return sd(e)}async function on(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 Xn(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 id(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",at:new Date(n).toISOString()}}if(e.scheduleKind==="every"){const n=Nn(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 ad(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},s=Nn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function od(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=id(e.cronForm),n=ad(e.cronForm),s=e.cronForm.sessionTarget==="isolated"&&e.cronForm.payloadKind==="agentTurn"&&e.cronForm.deliveryMode?{mode:e.cronForm.deliveryMode==="announce"?"announce":"none",channel:e.cronForm.deliveryChannel.trim()||"last",to:e.cronForm.deliveryTo.trim()||void 0}:void 0,i=e.cronForm.agentId.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,delivery:s};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Xn(e),await on(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function rd(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 Xn(e),await on(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function ld(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 br(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function cd(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 Xn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function br(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)}}const yr="cryptoclaw.device.auth.v1";function Mi(e){return e.trim()}function dd(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].toSorted()}function Ii(){try{const e=window.localStorage.getItem(yr);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 xr(e){try{window.localStorage.setItem(yr,JSON.stringify(e))}catch{}}function ud(e){const t=Ii();if(!t||t.deviceId!==e.deviceId)return null;const n=Mi(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function $r(e){const t=Mi(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Ii();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:dd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,xr(n),i}function wr(e){const t=Ii();if(!t||t.deviceId!==e.deviceId)return;const n=Mi(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],xr(s)}const kr={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:Rn,Gx:za,Gy:Ha,a:ws,d:ks,h:gd}=kr,pt=32,Ri=64,pd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},oe=(e="")=>{const t=new Error(e);throw pd(t,oe),t},fd=e=>typeof e=="bigint",hd=e=>typeof e=="string",vd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ye=(e,t,n="")=>{const s=vd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",c=s?`length=${i}`:`type=${typeof e}`;oe(o+"expected Uint8Array"+l+", got "+c)}return e},es=e=>new Uint8Array(e),Sr=e=>Uint8Array.from(e),Ar=(e,t)=>e.toString(16).padStart(t,"0"),Cr=e=>Array.from(Ye(e)).map(t=>Ar(t,2)).join(""),He={_0:48,_9:57,A:65,F:70,a:97,f:102},Ka=e=>{if(e>=He._0&&e<=He._9)return e-He._0;if(e>=He.A&&e<=He.F)return e-(He.A-10);if(e>=He.a&&e<=He.f)return e-(He.a-10)},Tr=e=>{const t="hex invalid";if(!hd(e))return oe(t);const n=e.length,s=n/2;if(n%2)return oe(t);const i=es(s);for(let a=0,o=0;a<s;a++,o+=2){const l=Ka(e.charCodeAt(o)),c=Ka(e.charCodeAt(o+1));if(l===void 0||c===void 0)return oe(t);i[a]=l*16+c}return i},_r=()=>globalThis?.crypto,md=()=>_r()?.subtle??oe("crypto.subtle must be defined, consider polyfill"),en=(...e)=>{const t=es(e.reduce((s,i)=>s+Ye(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},bd=(e=pt)=>_r().getRandomValues(es(e)),On=BigInt,at=(e,t,n,s="bad number: out of range")=>fd(e)&&t<=e&&e<n?e:oe(s),D=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Er=e=>D(e,Rn),yd=(e,t)=>{(e===0n||t<=0n)&&oe("no inverse n="+e+" mod="+t);let n=D(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,c=i-a*o;s=n,n=l,i=a,a=c}return s===1n?D(i,t):oe("no inverse")},xd=e=>{const t=Rr[e];return typeof t!="function"&&oe("hashes."+e+" not set"),t},Ss=e=>e instanceof ke?e:oe("Point expected"),Qs=2n**256n;class ke{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Qs;this.X=at(t,0n,a),this.Y=at(n,0n,a),this.Z=at(s,1n,a),this.T=at(i,0n,a),Object.freeze(this)}static CURVE(){return kr}static fromAffine(t){return new ke(t.x,t.y,1n,D(t.x*t.y))}static fromBytes(t,n=!1){const s=ks,i=Sr(Ye(t,pt)),a=t[31];i[31]=a&-129;const o=Mr(i);at(o,0n,n?Qs:ue);const c=D(o*o),u=D(c-1n),p=D(s*c+1n);let{isValid:g,value:h}=wd(u,p);g||oe("bad point: y not sqrt");const d=(h&1n)===1n,f=(a&128)!==0;return!n&&h===0n&&f&&oe("bad point: x==0, isLastByteOdd"),f!==d&&(h=D(-h)),new ke(h,o,1n,D(h*o))}static fromHex(t,n){return ke.fromBytes(Tr(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=ws,n=ks,s=this;if(s.is0())return oe("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,c=D(i*i),u=D(a*a),p=D(o*o),g=D(p*p),h=D(c*t),d=D(p*D(h+u)),f=D(g+D(n*D(c*u)));if(d!==f)return oe("bad point: equation left != right (1)");const m=D(i*a),k=D(o*l);return m!==k?oe("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=Ss(t),c=D(n*l),u=D(a*i),p=D(s*l),g=D(o*i);return c===u&&p===g}is0(){return this.equals(Ct)}negate(){return new ke(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=ws,a=D(t*t),o=D(n*n),l=D(2n*D(s*s)),c=D(i*a),u=t+n,p=D(D(u*u)-a-o),g=c+o,h=g-l,d=c-o,f=D(p*h),m=D(g*d),k=D(p*d),S=D(h*g);return new ke(f,m,S,k)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:c,T:u}=Ss(t),p=ws,g=ks,h=D(n*o),d=D(s*l),f=D(a*g*u),m=D(i*c),k=D((n+s)*(o+l)-h-d),S=D(m-f),w=D(m+f),C=D(d-p*h),A=D(k*S),_=D(w*C),T=D(k*C),I=D(S*w);return new ke(A,_,I,T)}subtract(t){return this.add(Ss(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Ct;if(at(t,1n,Rn),t===1n)return this;if(this.equals(ft))return Rd(t).p;let s=Ct,i=ft;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(Ct))return{x:0n,y:1n};const i=yd(s,ue);D(s*i)!==1n&&oe("invalid inverse");const a=D(t*i),o=D(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=Lr(n);return s[31]|=t&1n?128:0,s}toHex(){return Cr(this.toBytes())}clearCofactor(){return this.multiply(On(gd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Rn/2n,!1).double();return Rn%2n&&(t=t.add(this)),t.is0()}}const ft=new ke(za,Ha,1n,D(za*Ha)),Ct=new ke(0n,1n,1n,0n);ke.BASE=ft;ke.ZERO=Ct;const Lr=e=>Tr(Ar(at(e,0n,Qs),Ri)).reverse(),Mr=e=>On("0x"+Cr(Sr(Ye(e)).reverse())),Ie=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},$d=e=>{const n=e*e%ue*e%ue,s=Ie(n,2n)*n%ue,i=Ie(s,1n)*e%ue,a=Ie(i,5n)*i%ue,o=Ie(a,10n)*a%ue,l=Ie(o,20n)*o%ue,c=Ie(l,40n)*l%ue,u=Ie(c,80n)*c%ue,p=Ie(u,80n)*c%ue,g=Ie(p,10n)*a%ue;return{pow_p_5_8:Ie(g,2n)*e%ue,b2:n}},ja=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,wd=(e,t)=>{const n=D(t*t*t),s=D(n*n*t),i=$d(e*s).pow_p_5_8;let a=D(e*n*i);const o=D(t*a*a),l=a,c=D(a*ja),u=o===e,p=o===D(-e),g=o===D(-e*ja);return u&&(a=l),(p||g)&&(a=c),(D(a)&1n)===1n&&(a=D(-a)),{isValid:u||p,value:a}},Ys=e=>Er(Mr(e)),Pi=(...e)=>Rr.sha512Async(en(...e)),kd=(...e)=>xd("sha512")(en(...e)),Ir=e=>{const t=e.slice(0,pt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(pt,Ri),s=Ys(t),i=ft.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Di=e=>Pi(Ye(e,pt)).then(Ir),Sd=e=>Ir(kd(Ye(e,pt))),Ad=e=>Di(e).then(t=>t.pointBytes),Cd=e=>Pi(e.hashable).then(e.finish),Td=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Ys(t),o=ft.multiply(a).toBytes();return{hashable:en(o,s,n),finish:u=>{const p=Er(a+Ys(u)*i);return Ye(en(o,Lr(p)),Ri)}}},_d=async(e,t)=>{const n=Ye(e),s=await Di(t),i=await Pi(s.prefix,n);return Cd(Td(s,i,n))},Rr={sha512Async:async e=>{const t=md(),n=en(e);return es(await t.digest("SHA-512",n.buffer))},sha512:void 0},Ed=(e=bd(pt))=>e,Ld={getExtendedPublicKeyAsync:Di,getExtendedPublicKey:Sd,randomSecretKey:Ed},Bn=8,Md=256,Pr=Math.ceil(Md/Bn)+1,Zs=2**(Bn-1),Id=()=>{const e=[];let t=ft,n=t;for(let s=0;s<Pr;s++){n=t,e.push(n);for(let i=1;i<Zs;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Wa;const qa=(e,t)=>{const n=t.negate();return e?n:t},Rd=e=>{const t=Wa||(Wa=Id());let n=Ct,s=ft;const i=2**Bn,a=i,o=On(i-1),l=On(Bn);for(let c=0;c<Pr;c++){let u=Number(e&o);e>>=l,u>Zs&&(u-=a,e+=1n);const p=c*Zs,g=p,h=p+Math.abs(u)-1,d=c%2!==0,f=u<0;u===0?s=s.add(qa(d,t[g])):n=n.add(qa(f,t[h]))}return e!==0n&&oe("invalid wnaf"),{p:n,f:s}},As="cryptoclaw-device-identity-v1";function Js(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Dr(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 Pd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Fr(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Pd(new Uint8Array(t))}async function Dd(){const e=Ld.randomSecretKey(),t=await Ad(e);return{deviceId:await Fr(t),publicKey:Js(t),privateKey:Js(e)}}async function Fi(){try{const n=localStorage.getItem(As);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 Fr(Dr(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(As,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 Dd(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(As,JSON.stringify(t)),e}async function Fd(e,t){const n=Dr(e),s=new TextEncoder().encode(t),i=await _d(s,n);return Js(i)}async function Ze(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 Nd(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Ze(e)}catch(n){e.devicesError=String(n)}}async function Od(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 Ze(e)}catch(s){e.devicesError=String(s)}}async function Bd(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Fi(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&$r({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 Ze(e)}catch(n){e.devicesError=String(n)}}async function Ud(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 Fi();t.deviceId===s.deviceId&&wr({deviceId:s.deviceId,role:t.role}),await Ze(e)}catch(s){e.devicesError=String(s)}}function zd(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 Hd(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 Ni(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=zd(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);Kd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Kd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=gt(t.file??{}))}async function jd(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=Hd(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 Ni(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function Wd(e,t,n){const s=gt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});rr(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function qd(e,t){const n=gt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});lr(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Oi(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}}}async function mt(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??Nn(e.sessionsFilterActive,0),a=t?.limit??Nn(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const l=await e.client.request("sessions.list",o);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function Gd(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 mt(e)}catch(i){e.sessionsError=String(i)}}async function Vd(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
126
|
+
`],{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=`cryptoclaw-logs-${t}-${a}.log`,i.click(),URL.revokeObjectURL(s)}function Wc(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)}async function Yn(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 qc(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 Gc=2e3,Vc=new Set(["trace","debug","info","warn","error","fatal"]);function Qc(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 Yc(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Vc.has(t)?t:null}function Zc(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=Yc(n?.logLevelName??n?.level),a=typeof t[0]=="string"?t[0]:typeof n?.name=="string"?n?.name:null,o=Qc(a);let l=null;o&&(typeof o.subsystem=="string"?l=o.subsystem:typeof o.module=="string"&&(l=o.module)),!l&&a&&a.length<120&&(l=a);let c=null;return typeof t[1]=="string"?c=t[1]:!o&&typeof t[0]=="string"?c=t[0]:typeof t.message=="string"&&(c=t.message),{raw:e,time:s,level:i,subsystem:l,message:c??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function ki(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(l=>typeof l=="string"):[]).map(Zc),o=!!(t?.reset||s.reset||e.logsCursor==null);e.logsEntries=o?a:[...e.logsEntries,...a].slice(-Gc),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)}}}async function Zn(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 Jc(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Zn(e,{quiet:!0})},5e3))}function Xc(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Si(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&ki(e,{quiet:!0})},2e3))}function Ai(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Ci(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Yn(e)},3e3))}function Ti(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}async function gr(e,t){if(!(!e.client||!e.connected||e.agentIdentityLoading)&&!e.agentIdentityById[t]){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{const n=await e.client.request("agent.identity.get",{agentId:t});n&&(e.agentIdentityById={...e.agentIdentityById,[t]:n})}catch(n){e.agentIdentityError=String(n)}finally{e.agentIdentityLoading=!1}}}async function pr(e,t){if(!e.client||!e.connected||e.agentIdentityLoading)return;const n=t.filter(s=>!e.agentIdentityById[s]);if(n.length!==0){e.agentIdentityLoading=!0,e.agentIdentityError=null;try{for(const s of n){const i=await e.client.request("agent.identity.get",{agentId:s});i&&(e.agentIdentityById={...e.agentIdentityById,[s]:i})}}catch(s){e.agentIdentityError=String(s)}finally{e.agentIdentityLoading=!1}}}async function Mn(e,t){if(!(!e.client||!e.connected)&&!e.agentSkillsLoading){e.agentSkillsLoading=!0,e.agentSkillsError=null;try{const n=await e.client.request("skills.status",{agentId:t});n&&(e.agentSkillsReport=n,e.agentSkillsAgentId=t)}catch(n){e.agentSkillsError=String(n)}finally{e.agentSkillsLoading=!1}}}async function _i(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});if(t){e.agentsList=t;const n=e.agentsSelectedId,s=t.agents.some(i=>i.id===n);(!n||!s)&&(e.agentsSelectedId=t.defaultId??t.agents[0]?.id??null)}}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}const ed=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,bn=/<\s*\/?\s*final\b[^<>]*>/gi,Fa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;function Na(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(c=>a>=c.start&&o<=c.end)||t.push({start:a,end:o})}return t.sort((i,a)=>i.start-a.start),t}function Oa(e,t){return t.some(n=>e>=n.start&&e<n.end)}function td(e,t){return e.trimStart()}function nd(e,t){if(!e||!ed.test(e))return e;let n=e;if(bn.test(n)){bn.lastIndex=0;const l=[],c=Na(n);for(const u of n.matchAll(bn)){const p=u.index??0;l.push({start:p,length:u[0].length,inCode:Oa(p,c)})}for(let u=l.length-1;u>=0;u--){const p=l[u];p.inCode||(n=n.slice(0,p.start)+n.slice(p.start+p.length))}}else bn.lastIndex=0;const s=Na(n);Fa.lastIndex=0;let i="",a=0,o=!1;for(const l of n.matchAll(Fa)){const c=l.index??0,u=l[1]==="/";Oa(c,s)||(o?u&&(o=!1):(i+=n.slice(a,c),u||(o=!0)),a=c+l[0].length)}return i+=n.slice(a),td(i)}function Xt(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString()}function V(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e,n=Math.abs(t),s=t<0?"from now":"ago",i=Math.round(n/1e3);if(i<60)return t<0?"just now":`${i}s ago`;const a=Math.round(i/60);if(a<60)return`${a}m ${s}`;const o=Math.round(a/60);return o<48?`${o}h ${s}`:`${Math.round(o/24)}d ${s}`}function fr(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 qs(e){return!e||e.length===0?"none":e.filter(t=>!!(t&&t.trim())).join(", ")}function Gs(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function hr(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 Fn(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function xs(e){return nd(e)}async function on(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 Jn(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 sd(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",at:new Date(n).toISOString()}}if(e.scheduleKind==="every"){const n=Fn(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 id(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},s=Fn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function ad(e){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const t=sd(e.cronForm),n=id(e.cronForm),s=e.cronForm.sessionTarget==="isolated"&&e.cronForm.payloadKind==="agentTurn"&&e.cronForm.deliveryMode?{mode:e.cronForm.deliveryMode==="announce"?"announce":"none",channel:e.cronForm.deliveryChannel.trim()||"last",to:e.cronForm.deliveryTo.trim()||void 0}:void 0,i=e.cronForm.agentId.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,enabled:e.cronForm.enabled,schedule:t,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:n,delivery:s};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Jn(e),await on(e)}catch(t){e.cronError=String(t)}finally{e.cronBusy=!1}}}async function od(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 Jn(e),await on(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function rd(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 vr(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ld(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 Jn(e),await on(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function vr(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)}}const mr="cryptoclaw.device.auth.v1";function Ei(e){return e.trim()}function cd(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].toSorted()}function Li(){try{const e=window.localStorage.getItem(mr);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 br(e){try{window.localStorage.setItem(mr,JSON.stringify(e))}catch{}}function dd(e){const t=Li();if(!t||t.deviceId!==e.deviceId)return null;const n=Ei(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function yr(e){const t=Ei(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=Li();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:cd(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,br(n),i}function xr(e){const t=Li();if(!t||t.deviceId!==e.deviceId)return;const n=Ei(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],br(s)}const $r={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ue,n:In,Gx:Ba,Gy:Ua,a:$s,d:ws,h:ud}=$r,pt=32,Mi=64,gd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},oe=(e="")=>{const t=new Error(e);throw gd(t,oe),t},pd=e=>typeof e=="bigint",fd=e=>typeof e=="string",hd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ye=(e,t,n="")=>{const s=hd(e),i=e?.length,a=t!==void 0;if(!s||a&&i!==t){const o=n&&`"${n}" `,l=a?` of length ${t}`:"",c=s?`length=${i}`:`type=${typeof e}`;oe(o+"expected Uint8Array"+l+", got "+c)}return e},Xn=e=>new Uint8Array(e),wr=e=>Uint8Array.from(e),kr=(e,t)=>e.toString(16).padStart(t,"0"),Sr=e=>Array.from(Ye(e)).map(t=>kr(t,2)).join(""),He={_0:48,_9:57,A:65,F:70,a:97,f:102},za=e=>{if(e>=He._0&&e<=He._9)return e-He._0;if(e>=He.A&&e<=He.F)return e-(He.A-10);if(e>=He.a&&e<=He.f)return e-(He.a-10)},Ar=e=>{const t="hex invalid";if(!fd(e))return oe(t);const n=e.length,s=n/2;if(n%2)return oe(t);const i=Xn(s);for(let a=0,o=0;a<s;a++,o+=2){const l=za(e.charCodeAt(o)),c=za(e.charCodeAt(o+1));if(l===void 0||c===void 0)return oe(t);i[a]=l*16+c}return i},Cr=()=>globalThis?.crypto,vd=()=>Cr()?.subtle??oe("crypto.subtle must be defined, consider polyfill"),en=(...e)=>{const t=Xn(e.reduce((s,i)=>s+Ye(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},md=(e=pt)=>Cr().getRandomValues(Xn(e)),Nn=BigInt,at=(e,t,n,s="bad number: out of range")=>pd(e)&&t<=e&&e<n?e:oe(s),D=(e,t=ue)=>{const n=e%t;return n>=0n?n:t+n},Tr=e=>D(e,In),bd=(e,t)=>{(e===0n||t<=0n)&&oe("no inverse n="+e+" mod="+t);let n=D(e,t),s=t,i=0n,a=1n;for(;n!==0n;){const o=s/n,l=s%n,c=i-a*o;s=n,n=l,i=a,a=c}return s===1n?D(i,t):oe("no inverse")},yd=e=>{const t=Mr[e];return typeof t!="function"&&oe("hashes."+e+" not set"),t},ks=e=>e instanceof ke?e:oe("Point expected"),Vs=2n**256n;class ke{static BASE;static ZERO;X;Y;Z;T;constructor(t,n,s,i){const a=Vs;this.X=at(t,0n,a),this.Y=at(n,0n,a),this.Z=at(s,1n,a),this.T=at(i,0n,a),Object.freeze(this)}static CURVE(){return $r}static fromAffine(t){return new ke(t.x,t.y,1n,D(t.x*t.y))}static fromBytes(t,n=!1){const s=ws,i=wr(Ye(t,pt)),a=t[31];i[31]=a&-129;const o=Er(i);at(o,0n,n?Vs:ue);const c=D(o*o),u=D(c-1n),p=D(s*c+1n);let{isValid:g,value:h}=$d(u,p);g||oe("bad point: y not sqrt");const d=(h&1n)===1n,f=(a&128)!==0;return!n&&h===0n&&f&&oe("bad point: x==0, isLastByteOdd"),f!==d&&(h=D(-h)),new ke(h,o,1n,D(h*o))}static fromHex(t,n){return ke.fromBytes(Ar(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=$s,n=ws,s=this;if(s.is0())return oe("bad point: ZERO");const{X:i,Y:a,Z:o,T:l}=s,c=D(i*i),u=D(a*a),p=D(o*o),g=D(p*p),h=D(c*t),d=D(p*D(h+u)),f=D(g+D(n*D(c*u)));if(d!==f)return oe("bad point: equation left != right (1)");const m=D(i*a),k=D(o*l);return m!==k?oe("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:a,Y:o,Z:l}=ks(t),c=D(n*l),u=D(a*i),p=D(s*l),g=D(o*i);return c===u&&p===g}is0(){return this.equals(Ct)}negate(){return new ke(D(-this.X),this.Y,this.Z,D(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=$s,a=D(t*t),o=D(n*n),l=D(2n*D(s*s)),c=D(i*a),u=t+n,p=D(D(u*u)-a-o),g=c+o,h=g-l,d=c-o,f=D(p*h),m=D(g*d),k=D(p*d),S=D(h*g);return new ke(f,m,S,k)}add(t){const{X:n,Y:s,Z:i,T:a}=this,{X:o,Y:l,Z:c,T:u}=ks(t),p=$s,g=ws,h=D(n*o),d=D(s*l),f=D(a*g*u),m=D(i*c),k=D((n+s)*(o+l)-h-d),S=D(m-f),w=D(m+f),C=D(d-p*h),A=D(k*S),_=D(w*C),T=D(k*C),I=D(S*w);return new ke(A,_,I,T)}subtract(t){return this.add(ks(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Ct;if(at(t,1n,In),t===1n)return this;if(this.equals(ft))return Id(t).p;let s=Ct,i=ft;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(Ct))return{x:0n,y:1n};const i=bd(s,ue);D(s*i)!==1n&&oe("invalid inverse");const a=D(t*i),o=D(n*i);return{x:a,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=_r(n);return s[31]|=t&1n?128:0,s}toHex(){return Sr(this.toBytes())}clearCofactor(){return this.multiply(Nn(ud),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(In/2n,!1).double();return In%2n&&(t=t.add(this)),t.is0()}}const ft=new ke(Ba,Ua,1n,D(Ba*Ua)),Ct=new ke(0n,1n,1n,0n);ke.BASE=ft;ke.ZERO=Ct;const _r=e=>Ar(kr(at(e,0n,Vs),Mi)).reverse(),Er=e=>Nn("0x"+Sr(wr(Ye(e)).reverse())),Ie=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ue;return n},xd=e=>{const n=e*e%ue*e%ue,s=Ie(n,2n)*n%ue,i=Ie(s,1n)*e%ue,a=Ie(i,5n)*i%ue,o=Ie(a,10n)*a%ue,l=Ie(o,20n)*o%ue,c=Ie(l,40n)*l%ue,u=Ie(c,80n)*c%ue,p=Ie(u,80n)*c%ue,g=Ie(p,10n)*a%ue;return{pow_p_5_8:Ie(g,2n)*e%ue,b2:n}},Ha=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,$d=(e,t)=>{const n=D(t*t*t),s=D(n*n*t),i=xd(e*s).pow_p_5_8;let a=D(e*n*i);const o=D(t*a*a),l=a,c=D(a*Ha),u=o===e,p=o===D(-e),g=o===D(-e*Ha);return u&&(a=l),(p||g)&&(a=c),(D(a)&1n)===1n&&(a=D(-a)),{isValid:u||p,value:a}},Qs=e=>Tr(Er(e)),Ii=(...e)=>Mr.sha512Async(en(...e)),wd=(...e)=>yd("sha512")(en(...e)),Lr=e=>{const t=e.slice(0,pt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(pt,Mi),s=Qs(t),i=ft.multiply(s),a=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:a}},Ri=e=>Ii(Ye(e,pt)).then(Lr),kd=e=>Lr(wd(Ye(e,pt))),Sd=e=>Ri(e).then(t=>t.pointBytes),Ad=e=>Ii(e.hashable).then(e.finish),Cd=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,a=Qs(t),o=ft.multiply(a).toBytes();return{hashable:en(o,s,n),finish:u=>{const p=Tr(a+Qs(u)*i);return Ye(en(o,_r(p)),Mi)}}},Td=async(e,t)=>{const n=Ye(e),s=await Ri(t),i=await Ii(s.prefix,n);return Ad(Cd(s,i,n))},Mr={sha512Async:async e=>{const t=vd(),n=en(e);return Xn(await t.digest("SHA-512",n.buffer))},sha512:void 0},_d=(e=md(pt))=>e,Ed={getExtendedPublicKeyAsync:Ri,getExtendedPublicKey:kd,randomSecretKey:_d},On=8,Ld=256,Ir=Math.ceil(Ld/On)+1,Ys=2**(On-1),Md=()=>{const e=[];let t=ft,n=t;for(let s=0;s<Ir;s++){n=t,e.push(n);for(let i=1;i<Ys;i++)n=n.add(t),e.push(n);t=n.double()}return e};let Ka;const ja=(e,t)=>{const n=t.negate();return e?n:t},Id=e=>{const t=Ka||(Ka=Md());let n=Ct,s=ft;const i=2**On,a=i,o=Nn(i-1),l=Nn(On);for(let c=0;c<Ir;c++){let u=Number(e&o);e>>=l,u>Ys&&(u-=a,e+=1n);const p=c*Ys,g=p,h=p+Math.abs(u)-1,d=c%2!==0,f=u<0;u===0?s=s.add(ja(d,t[g])):n=n.add(ja(f,t[h]))}return e!==0n&&oe("invalid wnaf"),{p:n,f:s}},Ss="cryptoclaw-device-identity-v1";function Zs(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}function Rr(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 Rd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Pr(e){const t=await crypto.subtle.digest("SHA-256",e.slice().buffer);return Rd(new Uint8Array(t))}async function Pd(){const e=Ed.randomSecretKey(),t=await Sd(e);return{deviceId:await Pr(t),publicKey:Zs(t),privateKey:Zs(e)}}async function Pi(){try{const n=localStorage.getItem(Ss);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 Pr(Rr(s.publicKey));if(i!==s.deviceId){const a={...s,deviceId:i};return localStorage.setItem(Ss,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 Pd(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Ss,JSON.stringify(t)),e}async function Dd(e,t){const n=Rr(e),s=new TextEncoder().encode(t),i=await Td(s,n);return Zs(i)}async function Ze(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 Fd(e,t){if(!(!e.client||!e.connected))try{await e.client.request("device.pair.approve",{requestId:t}),await Ze(e)}catch(n){e.devicesError=String(n)}}async function Nd(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 Ze(e)}catch(s){e.devicesError=String(s)}}async function Od(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("device.token.rotate",t);if(n?.token){const s=await Pi(),i=n.role??t.role;(n.deviceId===s.deviceId||t.deviceId===s.deviceId)&&yr({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 Ze(e)}catch(n){e.devicesError=String(n)}}async function Bd(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 Pi();t.deviceId===s.deviceId&&xr({deviceId:s.deviceId,role:t.role}),await Ze(e)}catch(s){e.devicesError=String(s)}}function Ud(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 zd(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 Di(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=Ud(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);Hd(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Hd(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=gt(t.file??{}))}async function Kd(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=zd(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 Di(e,t)}catch(n){e.lastError=String(n)}finally{e.execApprovalsSaving=!1}}}function jd(e,t,n){const s=gt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});ar(s,t,n),e.execApprovalsForm=s,e.execApprovalsDirty=!0}function Wd(e,t){const n=gt(e.execApprovalsForm??e.execApprovalsSnapshot?.file??{});or(n,t),e.execApprovalsForm=n,e.execApprovalsDirty=!0}async function Fi(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}}}async function mt(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??Fn(e.sessionsFilterActive,0),a=t?.limit??Fn(e.sessionsFilterLimit,0),o={includeGlobal:n,includeUnknown:s};i>0&&(o.activeMinutes=i),a>0&&(o.limit=a);const l=await e.client.request("sessions.list",o);l&&(e.sessionsResult=l)}catch(n){e.sessionsError=String(n)}finally{e.sessionsLoading=!1}}}async function qd(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 mt(e)}catch(i){e.sessionsError=String(i)}}async function Gd(e,t){if(!(!e.client||!e.connected||e.sessionsLoading||!window.confirm(`Delete session "${t}"?
|
|
127
127
|
|
|
128
|
-
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 mt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}function Lt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ts(e){return e instanceof Error?e.message:String(e)}async function rn(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=ts(n)}finally{e.skillsLoading=!1}}}function Qd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Yd(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 rn(e),Lt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ts(s);e.skillsError=i,Lt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Zd(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 rn(e),Lt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ts(n);e.skillsError=s,Lt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Jd(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 rn(e),Lt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=ts(i);e.skillsError=a,Lt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}const Xd=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"Agent",tabs:["agents","skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],Nr={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},Or=new Map(Object.entries(Nr).map(([e,t])=>[t,e]));function ln(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function tn(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 Bi(e,t=""){const n=ln(t),s=Nr[e];return n?`${n}${s}`:s}function Br(e,t=""){const n=ln(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=tn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Or.get(i)??null}function eu(e){let t=tn(e);if(t.endsWith("/index.html")&&(t=tn(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(Or.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function tu(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";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 Xs(e){switch(e){case"agents":return"Agents";case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"usage":return"Usage";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 nu(e){switch(e){case"agents":return"Manage agent workspaces, tools, and identities.";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"usage":return"";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 ~/.cryptoclaw/cryptoclaw.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 Ur="cryptoclaw.control.settings.v1";function su(){const e=`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,t=window.__CRYPTOCLAW_GATEWAY_TOKEN__??"",n={gatewayUrl:e,token:t,sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const s=localStorage.getItem(Ur);if(!s)return n;const i=JSON.parse(s);return{gatewayUrl:typeof i.gatewayUrl=="string"&&i.gatewayUrl.trim()?i.gatewayUrl.trim():n.gatewayUrl,token:typeof i.token=="string"&&i.token?i.token:n.token,sessionKey:typeof i.sessionKey=="string"&&i.sessionKey.trim()?i.sessionKey.trim():n.sessionKey,lastActiveSessionKey:typeof i.lastActiveSessionKey=="string"&&i.lastActiveSessionKey.trim()?i.lastActiveSessionKey.trim():typeof i.sessionKey=="string"&&i.sessionKey.trim()||n.lastActiveSessionKey,theme:i.theme==="light"||i.theme==="dark"||i.theme==="system"?i.theme:n.theme,chatFocusMode:typeof i.chatFocusMode=="boolean"?i.chatFocusMode:n.chatFocusMode,chatShowThinking:typeof i.chatShowThinking=="boolean"?i.chatShowThinking:n.chatShowThinking,splitRatio:typeof i.splitRatio=="number"&&i.splitRatio>=.4&&i.splitRatio<=.7?i.splitRatio:n.splitRatio,navCollapsed:typeof i.navCollapsed=="boolean"?i.navCollapsed:n.navCollapsed,navGroupsCollapsed:typeof i.navGroupsCollapsed=="object"&&i.navGroupsCollapsed!==null?i.navGroupsCollapsed:n.navGroupsCollapsed}}catch{return n}}function iu(e){localStorage.setItem(Ur,JSON.stringify(e))}const yn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,au=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,xn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ou=({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,l=au();if(!!o.startViewTransition&&!l){let u=.5,p=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=yn(n.pointerClientX/window.innerWidth),p=yn(n.pointerClientY/window.innerHeight);else if(n?.element){const g=n.element.getBoundingClientRect();g.width>0&&g.height>0&&typeof window<"u"&&(u=yn((g.left+g.width/2)/window.innerWidth),p=yn((g.top+g.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${p*100}%`),a.classList.add("theme-transition");try{const g=o.startViewTransition?.(()=>{t()});g?.finished?g.finished.finally(()=>xn(a)):xn(a)}catch{xn(a),t()}return}t(),xn(a)};function ru(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ui(e){return e==="system"?ru():e}function ht(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,iu(n),t.theme!==e.theme&&(e.theme=t.theme,ns(e,Ui(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function zr(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&ht(e,{...e.settings,lastActiveSessionKey:n})}function lu(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&&(t.delete("token"),o=!0),s!=null){const c=s.trim();c&&(e.password=c),t.delete("password"),o=!0}if(i!=null){const c=i.trim();c&&(e.sessionKey=c,ht(e,{...e.settings,sessionKey:c,lastActiveSessionKey:c}))}if(a!=null){const c=a.trim();c&&c!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=c),t.delete("gatewayUrl"),o=!0}if(!o)return;const l=new URL(window.location.href);l.search=t.toString(),window.history.replaceState({},"",l.toString())}function cu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ci(e):Ti(e),t==="debug"?_i(e):Ei(e),zi(e),Kr(e,t,!1)}function du(e,t,n){ou({nextTheme:t,applyTheme:()=>{e.theme=t,ht(e,{...e.settings,theme:t}),ns(e,Ui(t))},context:n,currentTheme:e.theme})}async function zi(e){if(e.tab==="overview"&&await jr(e),e.tab==="channels"&&await bu(e),e.tab==="instances"&&await Oi(e),e.tab==="sessions"&&await mt(e),e.tab==="cron"&&await Un(e),e.tab==="skills"&&await rn(e),e.tab==="agents"){await Li(e),await Ee(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&hr(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(fr(e,n),e.agentsPanel==="skills"&&In(e,n),e.agentsPanel==="channels"&&ye(e,!1),e.agentsPanel==="cron"&&Un(e))}e.tab==="nodes"&&(await Jn(e),await Ze(e),await Ee(e),await Ni(e)),e.tab==="chat"&&(await Zr(e),an(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await cr(e),await Ee(e)),e.tab==="debug"&&(await Zn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await Ai(e,{reset:!0}),pr(e,!0))}function uu(){if(typeof window>"u")return"";const e=window.__CRYPTOCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ln(e):eu(window.location.pathname)}function gu(e){e.theme=e.settings.theme??"system",ns(e,Ui(e.theme))}function ns(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function pu(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"&&ns(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function fu(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 hu(e,t){if(typeof window>"u")return;const n=Br(window.location.pathname,e.basePath)??"chat";Hr(e,n),Kr(e,n,t)}function vu(e){if(typeof window>"u")return;const t=Br(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,ht(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Hr(e,t)}function Hr(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Ci(e):Ti(e),t==="debug"?_i(e):Ei(e),e.connected&&zi(e)}function Kr(e,t,n){if(typeof window>"u")return;const s=tn(Bi(t,e.basePath)),i=tn(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 mu(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 jr(e){await Promise.all([ye(e,!1),Oi(e),mt(e),on(e),Zn(e)])}async function bu(e){await Promise.all([ye(e,!0),cr(e),Ee(e)])}async function Un(e){await Promise.all([ye(e,!1),on(e),Xn(e)])}const Ga=50,yu=80,xu=12e4;function $u(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(`
|
|
129
|
-
`)}function
|
|
128
|
+
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 mt(e)}catch(s){e.sessionsError=String(s)}finally{e.sessionsLoading=!1}}}function Lt(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function es(e){return e instanceof Error?e.message:String(e)}async function rn(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=es(n)}finally{e.skillsLoading=!1}}}function Vd(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Qd(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 rn(e),Lt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=es(s);e.skillsError=i,Lt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Yd(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 rn(e),Lt(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=es(n);e.skillsError=s,Lt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Zd(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 rn(e),Lt(e,t,{kind:"success",message:i?.message??"Installed"})}catch(i){const a=es(i);e.skillsError=a,Lt(e,t,{kind:"error",message:a})}finally{e.skillsBusyKey=null}}}const Jd=[{label:"Chat",tabs:["chat"]},{label:"Control",tabs:["overview","channels","instances","sessions","usage","cron"]},{label:"Agent",tabs:["agents","skills","nodes"]},{label:"Settings",tabs:["config","debug","logs"]}],Dr={agents:"/agents",overview:"/overview",channels:"/channels",instances:"/instances",sessions:"/sessions",usage:"/usage",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",config:"/config",debug:"/debug",logs:"/logs"},Fr=new Map(Object.entries(Dr).map(([e,t])=>[t,e]));function ln(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function tn(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 Ni(e,t=""){const n=ln(t),s=Dr[e];return n?`${n}${s}`:s}function Nr(e,t=""){const n=ln(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=tn(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Fr.get(i)??null}function Xd(e){let t=tn(e);if(t.endsWith("/index.html")&&(t=tn(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(Fr.has(i)){const a=n.slice(0,s);return a.length?`/${a.join("/")}`:""}}return`/${n.join("/")}`}function eu(e){switch(e){case"agents":return"folder";case"chat":return"messageSquare";case"overview":return"barChart";case"channels":return"link";case"instances":return"radio";case"sessions":return"fileText";case"usage":return"barChart";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 Js(e){switch(e){case"agents":return"Agents";case"overview":return"Overview";case"channels":return"Channels";case"instances":return"Instances";case"sessions":return"Sessions";case"usage":return"Usage";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 tu(e){switch(e){case"agents":return"Manage agent workspaces, tools, and identities.";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"usage":return"";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 ~/.cryptoclaw/cryptoclaw.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 Or="cryptoclaw.control.settings.v1";function nu(){const e=`${location.protocol==="https:"?"wss":"ws"}://${location.host}`,t=window.__CRYPTOCLAW_GATEWAY_TOKEN__??"",n={gatewayUrl:e,token:t,sessionKey:"main",lastActiveSessionKey:"main",theme:"system",chatFocusMode:!1,chatShowThinking:!0,splitRatio:.6,navCollapsed:!1,navGroupsCollapsed:{}};try{const s=localStorage.getItem(Or);if(!s)return n;const i=JSON.parse(s);return{gatewayUrl:typeof i.gatewayUrl=="string"&&i.gatewayUrl.trim()?i.gatewayUrl.trim():n.gatewayUrl,token:typeof i.token=="string"&&i.token?i.token:n.token,sessionKey:typeof i.sessionKey=="string"&&i.sessionKey.trim()?i.sessionKey.trim():n.sessionKey,lastActiveSessionKey:typeof i.lastActiveSessionKey=="string"&&i.lastActiveSessionKey.trim()?i.lastActiveSessionKey.trim():typeof i.sessionKey=="string"&&i.sessionKey.trim()||n.lastActiveSessionKey,theme:i.theme==="light"||i.theme==="dark"||i.theme==="system"?i.theme:n.theme,chatFocusMode:typeof i.chatFocusMode=="boolean"?i.chatFocusMode:n.chatFocusMode,chatShowThinking:typeof i.chatShowThinking=="boolean"?i.chatShowThinking:n.chatShowThinking,splitRatio:typeof i.splitRatio=="number"&&i.splitRatio>=.4&&i.splitRatio<=.7?i.splitRatio:n.splitRatio,navCollapsed:typeof i.navCollapsed=="boolean"?i.navCollapsed:n.navCollapsed,navGroupsCollapsed:typeof i.navGroupsCollapsed=="object"&&i.navGroupsCollapsed!==null?i.navGroupsCollapsed:n.navGroupsCollapsed}}catch{return n}}function su(e){localStorage.setItem(Or,JSON.stringify(e))}const yn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,iu=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,xn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},au=({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,l=iu();if(!!o.startViewTransition&&!l){let u=.5,p=.5;if(n?.pointerClientX!==void 0&&n?.pointerClientY!==void 0&&typeof window<"u")u=yn(n.pointerClientX/window.innerWidth),p=yn(n.pointerClientY/window.innerHeight);else if(n?.element){const g=n.element.getBoundingClientRect();g.width>0&&g.height>0&&typeof window<"u"&&(u=yn((g.left+g.width/2)/window.innerWidth),p=yn((g.top+g.height/2)/window.innerHeight))}a.style.setProperty("--theme-switch-x",`${u*100}%`),a.style.setProperty("--theme-switch-y",`${p*100}%`),a.classList.add("theme-transition");try{const g=o.startViewTransition?.(()=>{t()});g?.finished?g.finished.finally(()=>xn(a)):xn(a)}catch{xn(a),t()}return}t(),xn(a)};function ou(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Oi(e){return e==="system"?ou():e}function ht(e,t){const n={...t,lastActiveSessionKey:t.lastActiveSessionKey?.trim()||t.sessionKey.trim()||"main"};e.settings=n,su(n),t.theme!==e.theme&&(e.theme=t.theme,ts(e,Oi(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Br(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&ht(e,{...e.settings,lastActiveSessionKey:n})}function ru(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&&(t.delete("token"),o=!0),s!=null){const c=s.trim();c&&(e.password=c),t.delete("password"),o=!0}if(i!=null){const c=i.trim();c&&(e.sessionKey=c,ht(e,{...e.settings,sessionKey:c,lastActiveSessionKey:c}))}if(a!=null){const c=a.trim();c&&c!==e.settings.gatewayUrl&&(e.pendingGatewayUrl=c),t.delete("gatewayUrl"),o=!0}if(!o)return;const l=new URL(window.location.href);l.search=t.toString(),window.history.replaceState({},"",l.toString())}function lu(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Si(e):Ai(e),t==="debug"?Ci(e):Ti(e),Bi(e),zr(e,t,!1)}function cu(e,t,n){au({nextTheme:t,applyTheme:()=>{e.theme=t,ht(e,{...e.settings,theme:t}),ts(e,Oi(t))},context:n,currentTheme:e.theme})}async function Bi(e){if(e.tab==="overview"&&await Hr(e),e.tab==="channels"&&await mu(e),e.tab==="instances"&&await Fi(e),e.tab==="sessions"&&await mt(e),e.tab==="cron"&&await Bn(e),e.tab==="skills"&&await rn(e),e.tab==="agents"){await _i(e),await Ee(e);const t=e.agentsList?.agents?.map(s=>s.id)??[];t.length>0&&pr(e,t);const n=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id;n&&(gr(e,n),e.agentsPanel==="skills"&&Mn(e,n),e.agentsPanel==="channels"&&ye(e,!1),e.agentsPanel==="cron"&&Bn(e))}e.tab==="nodes"&&(await Zn(e),await Ze(e),await Ee(e),await Di(e)),e.tab==="chat"&&(await Qr(e),an(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await rr(e),await Ee(e)),e.tab==="debug"&&(await Yn(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"&&(e.logsAtBottom=!0,await ki(e,{reset:!0}),ur(e,!0))}function du(){if(typeof window>"u")return"";const e=window.__CRYPTOCLAW_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?ln(e):Xd(window.location.pathname)}function uu(e){e.theme=e.settings.theme??"system",ts(e,Oi(e.theme))}function ts(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function gu(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"&&ts(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function pu(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 fu(e,t){if(typeof window>"u")return;const n=Nr(window.location.pathname,e.basePath)??"chat";Ur(e,n),zr(e,n,t)}function hu(e){if(typeof window>"u")return;const t=Nr(window.location.pathname,e.basePath);if(!t)return;const s=new URL(window.location.href).searchParams.get("session")?.trim();s&&(e.sessionKey=s,ht(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Ur(e,t)}function Ur(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?Si(e):Ai(e),t==="debug"?Ci(e):Ti(e),e.connected&&Bi(e)}function zr(e,t,n){if(typeof window>"u")return;const s=tn(Ni(t,e.basePath)),i=tn(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 vu(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 Hr(e){await Promise.all([ye(e,!1),Fi(e),mt(e),on(e),Yn(e)])}async function mu(e){await Promise.all([ye(e,!0),rr(e),Ee(e)])}async function Bn(e){await Promise.all([ye(e,!1),on(e),Jn(e)])}const Wa=50,bu=80,yu=12e4;function xu(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(`
|
|
129
|
+
`)}function qa(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=xu(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=hr(n,yu);return s.truncated?`${s.text}
|
|
130
130
|
|
|
131
|
-
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function
|
|
132
|
-
`);return n==="assistant"
|
|
133
|
-
`);const i=
|
|
134
|
-
`):null}function
|
|
135
|
-
`)}return typeof t.text=="string"?t.text:null}function
|
|
136
|
-
`):""}let Ya=!1;function Za(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 Du(){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 Fu(){Ya||(Ya=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Hi(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),Za(t)}return Fu(),Za(Du())}async function nn(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 Nu(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Ou(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const l=Hi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=a;const c=i?n.map(u=>{const p=Nu(u.dataUrl);return p?{type:"image",mimeType:p.mimeType,content:p.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:c}),l}catch(u){const p=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=p,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+p}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Bu(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 Uu(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=ti(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}const qr=120;function Gr(e){return e.chatSending||!!e.chatRunId}function zu(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 Hu(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 Vr(e){e.connected&&(e.chatMessage="",await Bu(e))}function Ku(e,t,n,s){const i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Hi(),text:i,createdAt:Date.now(),attachments:a?n?.map(o=>({...o})):void 0,refreshSessions:s}])}async function Qr(e,t,n){ss(e);const s=await Ou(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&zr(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),an(e),i&&!e.chatRunId&&Yr(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function Yr(e){if(!e.connected||Gr(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Qr(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function ju(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Wu(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!i&&!l)return;if(zu(i)){await Vr(e);return}const c=Hu(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Gr(e)){Ku(e,i,o,c);return}await Qr(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})}async function Zr(e){await Promise.all([nn(e),mt(e,{activeMinutes:qr}),ni(e)]),an(e)}const qu=Yr;function Gu(e){const t=gr(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Vu(e,t){const n=ln(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function ni(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Gu(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Vu(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 Qu={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Yu={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"isolated",wakeMode:"next-heartbeat",payloadKind:"agentTurn",payloadText:"",deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",timeoutSeconds:""},Zu=50,Ju=200,Xu="Assistant";function Ja(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function si(e){const t=Ja(e?.name,Zu)??Xu,n=Ja(e?.avatar??void 0,Ju)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function eg(){return si(typeof window>"u"?{}:{name:window.__CRYPTOCLAW_ASSISTANT_NAME__,avatar:window.__CRYPTOCLAW_ASSISTANT_AVATAR__})}async function Jr(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=si(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function ii(e){return typeof e=="object"&&e!==null}function tg(e){if(!ii(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!ii(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 ng(e){if(!ii(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 Xr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function sg(e,t){const n=Xr(e).filter(s=>s.id!==t.id);return n.push(t),n}function Xa(e,t){return Xr(e).filter(n=>n.id!==t)}function ig(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 el={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"cryptoclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"cryptoclaw-macos",IOS_APP:"cryptoclaw-ios",ANDROID_APP:"cryptoclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"cryptoclaw-probe"},eo=el,ai={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(el));new Set(Object.values(ai));const ag=4008;class og{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.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",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.addEventListener("error",()=>{}))}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 Fi();const p=ud({deviceId:i.deviceId,role:s})?.token;o=p??this.opts.token,a=!!(p&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let c;if(t&&i){const p=Date.now(),g=this.connectNonce??void 0,h=ig({deviceId:i.deviceId,clientId:this.opts.clientName??eo.CONTROL_UI,clientMode:this.opts.mode??ai.WEBCHAT,role:s,scopes:n,signedAtMs:p,token:o??null,nonce:g}),d=await Fd(i.privateKey,h);c={id:i.deviceId,publicKey:i.publicKey,signature:d,signedAt:p,nonce:g}}const u={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??eo.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??ai.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(p=>{p?.auth?.deviceToken&&i&&$r({deviceId:i.deviceId,role:p.auth.role??s,token:p.auth.deviceToken,scopes:p.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(p)}).catch(()=>{a&&i&&wr({deviceId:i.deviceId,role:s}),this.ws?.close(ag,"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,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,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=Hi(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:c=>o(c),reject:l})});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 Es(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 rg(e,t){if(!t?.mainSessionKey)return;const n=Es(e.sessionKey,t),s=Es(e.settings.sessionKey,t),i=Es(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},l=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),l&&ht(e,o)}function tl(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new og({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"cryptoclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,dg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,ss(e),Jr(e),Li(e),Jn(e,{quiet:!0}),Ze(e,{quiet:!0}),zi(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>lg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function lg(e,t){try{cg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function cg(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;_u(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&zr(e,n.sessionKey);const s=Uu(e,n);if(s==="final"||s==="error"||s==="aborted"){ss(e),qu(e);const i=n?.runId;i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),s==="final"&&mt(e,{activeMinutes:qr}))}s==="final"&&nn(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"&&Un(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Ze(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=tg(t.payload);if(n){e.execApprovalQueue=sg(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Xa(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=ng(t.payload);n&&(e.execApprovalQueue=Xa(e.execApprovalQueue,n.id))}}function dg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&rg(e,n.sessionDefaults)}function ug(e){e.basePath=uu(),lu(e),hu(e,!0),gu(e),pu(e),window.addEventListener("popstate",e.popStateHandler),tl(e),Xc(e),e.tab==="logs"&&Ci(e),e.tab==="debug"&&_i(e)}function gg(e){qc(e)}function pg(e){window.removeEventListener("popstate",e.popStateHandler),ed(e),Ti(e),Ei(e),fu(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function fg(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;an(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&pr(e,t.has("tab")||t.has("logsAutoFollow"))}const Ki={CHILD:2},ji=e=>(...t)=>({_$litDirective$:e,values:t});let Wi=class{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{I:hg}=hc,to=e=>e,vg=e=>e.strings===void 0,no=()=>document.createComment(""),Dt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(no(),i),o=s.insertBefore(no(),i);n=new hg(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let c;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==o._$AU&&n._$AP(c)}if(a!==i||l){let c=n._$AA;for(;c!==a;){const u=to(c).nextSibling;to(s).insertBefore(c,i),c=u}}}return n},nt=(e,t,n=e)=>(e._$AI(t,n),e),mg={},bg=(e,t=mg)=>e._$AH=t,yg=e=>e._$AH,Ls=e=>{e._$AR(),e._$AA.remove()};const so=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},nl=ji(class extends Wi{constructor(e){if(super(e),e.type!==Ki.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 l of e)i[o]=s?s(l,o):o,a[o]=n(l,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=yg(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],c=[];let u,p,g=0,h=i.length-1,d=0,f=a.length-1;for(;g<=h&&d<=f;)if(i[g]===null)g++;else if(i[h]===null)h--;else if(l[g]===o[d])c[d]=nt(i[g],a[d]),g++,d++;else if(l[h]===o[f])c[f]=nt(i[h],a[f]),h--,f--;else if(l[g]===o[f])c[f]=nt(i[g],a[f]),Dt(e,c[f+1],i[g]),g++,f--;else if(l[h]===o[d])c[d]=nt(i[h],a[d]),Dt(e,i[g],i[h]),h--,d++;else if(u===void 0&&(u=so(o,d,f),p=so(l,g,h)),u.has(l[g]))if(u.has(l[h])){const m=p.get(o[d]),k=m!==void 0?i[m]:null;if(k===null){const S=Dt(e,i[g]);nt(S,a[d]),c[d]=S}else c[d]=nt(k,a[d]),Dt(e,i[g],k),i[m]=null;d++}else Ls(i[h]),h--;else Ls(i[g]),g++;for(;d<=f;){const m=Dt(e,c[f+1]);nt(m,a[d]),c[d++]=m}for(;g<=h;){const m=i[g++];m!==null&&Ls(m)}return this.ut=o,bg(e,c),Qe}}),le={messageSquare:r`
|
|
131
|
+
… truncated (${s.total} chars, showing first ${s.text.length}).`:s.text}function $u(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 wu(e){if(e.toolStreamOrder.length<=Wa)return;const t=e.toolStreamOrder.length-Wa,n=e.toolStreamOrder.splice(0,t);for(const s of n)e.toolStreamById.delete(s)}function ku(e){e.chatToolMessages=e.toolStreamOrder.map(t=>e.toolStreamById.get(t)?.message).filter(t=>!!t)}function Xs(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),ku(e)}function Su(e,t=!1){if(t){Xs(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>Xs(e),bu))}function ns(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],Xs(e)}const Au=5e3;function Cu(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},Au))}function Tu(e,t){if(!t)return;if(t.stream==="compaction"){Cu(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:"",l=o==="start"?s.args:void 0,c=o==="update"?qa(s.partialResult):o==="result"?qa(s.result):void 0,u=Date.now();let p=e.toolStreamById.get(i);p?(p.name=a,l!==void 0&&(p.args=l),c!==void 0&&(p.output=c||void 0),p.updatedAt=u):(p={toolCallId:i,runId:t.runId,sessionKey:n,name:a,args:l,output:c||void 0,startedAt:typeof t.ts=="number"?t.ts:u,updatedAt:u,message:{}},e.toolStreamById.set(i,p),e.toolStreamOrder.push(i)),p.message=$u(p),wu(e),Su(e,o==="result")}const _u=/^\[([^\]]+)\]\s*/,Eu=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Nostr","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],As=new WeakMap,Cs=new WeakMap;function Lu(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:Eu.some(t=>e.startsWith(`${t} `))}function Ts(e){const t=e.match(_u);if(!t)return e;const n=t[1]??"";return Lu(n)?e.slice(t[0].length):e}function ei(e){const t=e,n=typeof t.role=="string"?t.role:"",s=t.content;if(typeof s=="string")return n==="assistant"?xs(s):Ts(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(`
|
|
132
|
+
`);return n==="assistant"?xs(a):Ts(a)}}return typeof t.text=="string"?n==="assistant"?xs(t.text):Ts(t.text):null}function Kr(e){if(!e||typeof e!="object")return ei(e);const t=e;if(As.has(t))return As.get(t)??null;const n=ei(e);return As.set(t,n),n}function Ga(e){const n=e.content,s=[];if(Array.isArray(n))for(const l of n){const c=l;if(c.type==="thinking"&&typeof c.thinking=="string"){const u=c.thinking.trim();u&&s.push(u)}}if(s.length>0)return s.join(`
|
|
133
|
+
`);const i=Iu(e);if(!i)return null;const o=[...i.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(l=>(l[1]??"").trim()).filter(Boolean);return o.length>0?o.join(`
|
|
134
|
+
`):null}function Mu(e){if(!e||typeof e!="object")return Ga(e);const t=e;if(Cs.has(t))return Cs.get(t)??null;const n=Ga(e);return Cs.set(t,n),n}function Iu(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(`
|
|
135
|
+
`)}return typeof t.text=="string"?t.text:null}function Ru(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(`
|
|
136
|
+
`):""}let Va=!1;function Qa(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 Pu(){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 Du(){Va||(Va=!0,console.warn("[uuid] crypto API missing; falling back to weak randomness"))}function Ui(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),Qa(t)}return Du(),Qa(Pu())}async function nn(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 Fu(e){const t=/^data:([^;]+);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function Nu(e,t,n){if(!e.client||!e.connected)return null;const s=t.trim(),i=n&&n.length>0;if(!s&&!i)return null;const a=Date.now(),o=[];if(s&&o.push({type:"text",text:s}),i)for(const u of n)o.push({type:"image",source:{type:"base64",media_type:u.mimeType,data:u.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:o,timestamp:a}],e.chatSending=!0,e.lastError=null;const l=Ui();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=a;const c=i?n.map(u=>{const p=Fu(u.dataUrl);return p?{type:"image",mimeType:p.mimeType,content:p.content}:null}).filter(u=>u!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:s,deliver:!1,idempotencyKey:l,attachments:c}),l}catch(u){const p=String(u);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=p,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+p}],timestamp:Date.now()}],null}finally{e.chatSending=!1}}async function Ou(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 Bu(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=ei(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}const jr=120;function Wr(e){return e.chatSending||!!e.chatRunId}function Uu(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 zu(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 qr(e){e.connected&&(e.chatMessage="",await Ou(e))}function Hu(e,t,n,s){const i=t.trim(),a=!!(n&&n.length>0);!i&&!a||(e.chatQueue=[...e.chatQueue,{id:Ui(),text:i,createdAt:Date.now(),attachments:a?n?.map(o=>({...o})):void 0,refreshSessions:s}])}async function Gr(e,t,n){ns(e);const s=await Nu(e,t,n?.attachments),i=!!s;return!i&&n?.previousDraft!=null&&(e.chatMessage=n.previousDraft),!i&&n?.previousAttachments&&(e.chatAttachments=n.previousAttachments),i&&Br(e,e.sessionKey),i&&n?.restoreDraft&&n.previousDraft?.trim()&&(e.chatMessage=n.previousDraft),i&&n?.restoreAttachments&&n.previousAttachments?.length&&(e.chatAttachments=n.previousAttachments),an(e),i&&!e.chatRunId&&Vr(e),i&&n?.refreshSessions&&s&&e.refreshSessionsAfterChat.add(s),i}async function Vr(e){if(!e.connected||Wr(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Gr(e,t.text,{attachments:t.attachments,refreshSessions:t.refreshSessions})||(e.chatQueue=[t,...e.chatQueue])}function Ku(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function ju(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),a=e.chatAttachments??[],o=t==null?a:[],l=o.length>0;if(!i&&!l)return;if(Uu(i)){await qr(e);return}const c=zu(i);if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Wr(e)){Hu(e,i,o,c);return}await Gr(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&n?.restoreDraft),attachments:l?o:void 0,previousAttachments:t==null?a:void 0,restoreAttachments:!!(t&&n?.restoreDraft),refreshSessions:c})}async function Qr(e){await Promise.all([nn(e),mt(e,{activeMinutes:jr}),ti(e)]),an(e)}const Wu=Vr;function qu(e){const t=dr(e.sessionKey);return t?.agentId?t.agentId:e.hello?.snapshot?.sessionDefaults?.defaultAgentId?.trim()||"main"}function Gu(e,t){const n=ln(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function ti(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=qu(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Gu(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 Vu={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Qu={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"isolated",wakeMode:"next-heartbeat",payloadKind:"agentTurn",payloadText:"",deliveryMode:"announce",deliveryChannel:"last",deliveryTo:"",timeoutSeconds:""},Yu=50,Zu=200,Ju="Assistant";function Ya(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function ni(e){const t=Ya(e?.name,Yu)??Ju,n=Ya(e?.avatar??void 0,Zu)??null;return{agentId:typeof e?.agentId=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function Xu(){return ni(typeof window>"u"?{}:{name:window.__CRYPTOCLAW_ASSISTANT_NAME__,avatar:window.__CRYPTOCLAW_ASSISTANT_AVATAR__})}async function Yr(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=ni(i);e.assistantName=a.name,e.assistantAvatar=a.avatar,e.assistantAgentId=a.agentId??null}catch{}}function si(e){return typeof e=="object"&&e!==null}function eg(e){if(!si(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!si(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 tg(e){if(!si(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 Zr(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function ng(e,t){const n=Zr(e).filter(s=>s.id!==t.id);return n.push(t),n}function Za(e,t){return Zr(e).filter(n=>n.id!==t)}function sg(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 Jr={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"cryptoclaw-control-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"cryptoclaw-macos",IOS_APP:"cryptoclaw-ios",ANDROID_APP:"cryptoclaw-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"cryptoclaw-probe"},Ja=Jr,ii={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(Jr));new Set(Object.values(ii));const ig=4008;class ag{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.addEventListener("open",()=>this.queueConnect()),this.ws.addEventListener("message",t=>this.handleMessage(String(t.data??""))),this.ws.addEventListener("close",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.addEventListener("error",()=>{}))}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 Pi();const p=dd({deviceId:i.deviceId,role:s})?.token;o=p??this.opts.token,a=!!(p&&this.opts.token)}const l=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let c;if(t&&i){const p=Date.now(),g=this.connectNonce??void 0,h=sg({deviceId:i.deviceId,clientId:this.opts.clientName??Ja.CONTROL_UI,clientMode:this.opts.mode??ii.WEBCHAT,role:s,scopes:n,signedAtMs:p,token:o??null,nonce:g}),d=await Dd(i.privateKey,h);c={id:i.deviceId,publicKey:i.publicKey,signature:d,signedAt:p,nonce:g}}const u={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??ii.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:c,caps:[],auth:l,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",u).then(p=>{p?.auth?.deviceToken&&i&&yr({deviceId:i.deviceId,role:p.auth.role??s,token:p.auth.deviceToken,scopes:p.auth.scopes??[]}),this.backoffMs=800,this.opts.onHello?.(p)}).catch(()=>{a&&i&&xr({deviceId:i.deviceId,role:s}),this.ws?.close(ig,"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,l=o&&typeof o.nonce=="string"?o.nonce:null;l&&(this.connectNonce=l,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=Ui(),i={type:"req",id:s,method:t,params:n},a=new Promise((o,l)=>{this.pending.set(s,{resolve:c=>o(c),reject:l})});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 _s(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 og(e,t){if(!t?.mainSessionKey)return;const n=_s(e.sessionKey,t),s=_s(e.settings.sessionKey,t),i=_s(e.settings.lastActiveSessionKey,t),a=n||s||e.sessionKey,o={...e.settings,sessionKey:s||a,lastActiveSessionKey:i||a},l=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;a!==e.sessionKey&&(e.sessionKey=a),l&&ht(e,o)}function Xr(e){e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null,e.client?.stop(),e.client=new ag({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:"cryptoclaw-control-ui",mode:"webchat",onHello:t=>{e.connected=!0,e.lastError=null,e.hello=t,cg(e,t),e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,ns(e),Yr(e),_i(e),Zn(e,{quiet:!0}),Ze(e,{quiet:!0}),Bi(e)},onClose:({code:t,reason:n})=>{e.connected=!1,t!==1012&&(e.lastError=`disconnected (${t}): ${n||"no reason"}`)},onEvent:t=>rg(e,t),onGap:({expected:t,received:n})=>{e.lastError=`event gap detected (expected seq ${t}, got ${n}); refresh recommended`}}),e.client.start()}function rg(e,t){try{lg(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function lg(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;Tu(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n?.sessionKey&&Br(e,n.sessionKey);const s=Bu(e,n);if(s==="final"||s==="error"||s==="aborted"){ns(e),Wu(e);const i=n?.runId;i&&e.refreshSessionsAfterChat.has(i)&&(e.refreshSessionsAfterChat.delete(i),s==="final"&&mt(e,{activeMinutes:jr}))}s==="final"&&nn(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"&&Bn(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&Ze(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=eg(t.payload);if(n){e.execApprovalQueue=ng(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Za(e.execApprovalQueue,n.id)},s)}return}if(t.event==="exec.approval.resolved"){const n=tg(t.payload);n&&(e.execApprovalQueue=Za(e.execApprovalQueue,n.id))}}function cg(e,t){const n=t.snapshot;n?.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n?.health&&(e.debugHealth=n.health),n?.sessionDefaults&&og(e,n.sessionDefaults)}function dg(e){e.basePath=du(),ru(e),fu(e,!0),uu(e),gu(e),window.addEventListener("popstate",e.popStateHandler),Xr(e),Jc(e),e.tab==="logs"&&Si(e),e.tab==="debug"&&Ci(e)}function ug(e){Wc(e)}function gg(e){window.removeEventListener("popstate",e.popStateHandler),Xc(e),Ai(e),Ti(e),pu(e),e.topbarObserver?.disconnect(),e.topbarObserver=null}function pg(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;an(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&ur(e,t.has("tab")||t.has("logsAutoFollow"))}const zi={CHILD:2},Hi=e=>(...t)=>({_$litDirective$:e,values:t});let Ki=class{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{I:fg}=fc,Xa=e=>e,hg=e=>e.strings===void 0,eo=()=>document.createComment(""),Dt=(e,t,n)=>{const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=s.insertBefore(eo(),i),o=s.insertBefore(eo(),i);n=new fg(a,o,e,e.options)}else{const a=n._$AB.nextSibling,o=n._$AM,l=o!==e;if(l){let c;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==o._$AU&&n._$AP(c)}if(a!==i||l){let c=n._$AA;for(;c!==a;){const u=Xa(c).nextSibling;Xa(s).insertBefore(c,i),c=u}}}return n},nt=(e,t,n=e)=>(e._$AI(t,n),e),vg={},mg=(e,t=vg)=>e._$AH=t,bg=e=>e._$AH,Es=e=>{e._$AR(),e._$AA.remove()};const to=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},el=Hi(class extends Ki{constructor(e){if(super(e),e.type!==zi.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 l of e)i[o]=s?s(l,o):o,a[o]=n(l,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=bg(e),{values:a,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,a;const l=this.ut??=[],c=[];let u,p,g=0,h=i.length-1,d=0,f=a.length-1;for(;g<=h&&d<=f;)if(i[g]===null)g++;else if(i[h]===null)h--;else if(l[g]===o[d])c[d]=nt(i[g],a[d]),g++,d++;else if(l[h]===o[f])c[f]=nt(i[h],a[f]),h--,f--;else if(l[g]===o[f])c[f]=nt(i[g],a[f]),Dt(e,c[f+1],i[g]),g++,f--;else if(l[h]===o[d])c[d]=nt(i[h],a[d]),Dt(e,i[g],i[h]),h--,d++;else if(u===void 0&&(u=to(o,d,f),p=to(l,g,h)),u.has(l[g]))if(u.has(l[h])){const m=p.get(o[d]),k=m!==void 0?i[m]:null;if(k===null){const S=Dt(e,i[g]);nt(S,a[d]),c[d]=S}else c[d]=nt(k,a[d]),Dt(e,i[g],k),i[m]=null;d++}else Es(i[h]),h--;else Es(i[g]),g++;for(;d<=f;){const m=Dt(e,c[f+1]);nt(m,a[d]),c[d++]=m}for(;g<=h;){const m=i[g++];m!==null&&Es(m)}return this.ut=o,mg(e,c),Qe}}),le={messageSquare:r`
|
|
137
137
|
<svg viewBox="0 0 24 24">
|
|
138
138
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
139
139
|
</svg>
|
|
@@ -321,17 +321,17 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
321
321
|
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"
|
|
322
322
|
/>
|
|
323
323
|
</svg>
|
|
324
|
-
`};function
|
|
324
|
+
`};function yg(e,t){const n=Ni(t,e.basePath);return r`
|
|
325
325
|
<a
|
|
326
326
|
href=${n}
|
|
327
327
|
class="nav-item ${e.tab===t?"active":""}"
|
|
328
328
|
@click=${s=>{s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||(s.preventDefault(),e.setTab(t))}}
|
|
329
|
-
title=${
|
|
329
|
+
title=${Js(t)}
|
|
330
330
|
>
|
|
331
|
-
<span class="nav-item__icon" aria-hidden="true">${le[
|
|
332
|
-
<span class="nav-item__text">${
|
|
331
|
+
<span class="nav-item__icon" aria-hidden="true">${le[eu(t)]}</span>
|
|
332
|
+
<span class="nav-item__text">${Js(t)}</span>
|
|
333
333
|
</a>
|
|
334
|
-
`}function
|
|
334
|
+
`}function xg(e){const t=$g(e.hello,e.sessionsResult),n=wg(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,l=r`
|
|
335
335
|
<svg
|
|
336
336
|
width="18"
|
|
337
337
|
height="18"
|
|
@@ -368,9 +368,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
368
368
|
<select
|
|
369
369
|
.value=${e.sessionKey}
|
|
370
370
|
?disabled=${!e.connected}
|
|
371
|
-
@change=${u=>{const p=u.target.value;e.sessionKey=p,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:p,lastActiveSessionKey:p}),e.loadAssistantIdentity(),
|
|
371
|
+
@change=${u=>{const p=u.target.value;e.sessionKey=p,e.chatMessage="",e.chatStream=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:p,lastActiveSessionKey:p}),e.loadAssistantIdentity(),vu(e,p),nn(e)}}
|
|
372
372
|
>
|
|
373
|
-
${
|
|
373
|
+
${el(n,u=>u.key,u=>r`<option value=${u.key}>
|
|
374
374
|
${u.displayName??u.key}
|
|
375
375
|
</option>`)}
|
|
376
376
|
</select>
|
|
@@ -378,7 +378,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
378
378
|
<button
|
|
379
379
|
class="btn btn--sm btn--icon"
|
|
380
380
|
?disabled=${e.chatLoading||!e.connected}
|
|
381
|
-
@click=${()=>{e.resetToolStream(),
|
|
381
|
+
@click=${()=>{e.resetToolStream(),Qr(e)}}
|
|
382
382
|
title="Refresh chat data"
|
|
383
383
|
>
|
|
384
384
|
${l}
|
|
@@ -403,7 +403,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
403
403
|
${c}
|
|
404
404
|
</button>
|
|
405
405
|
</div>
|
|
406
|
-
`}function
|
|
406
|
+
`}function $g(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 Ls(e,t){const n=t?.label?.trim();if(n)return`${n} (${e})`;const s=t?.displayName?.trim();return s||e}function wg(e,t,n){const s=new Set,i=[],a=n&&t?.sessions?.find(l=>l.key===n),o=t?.sessions?.find(l=>l.key===e);if(n&&(s.add(n),i.push({key:n,displayName:Ls(n,a||void 0)})),s.has(e)||(s.add(e),i.push({key:e,displayName:Ls(e,o)})),t?.sessions)for(const l of t.sessions)s.has(l.key)||(s.add(l.key),i.push({key:l.key,displayName:Ls(l.key,l)}));return i}const kg=["system","light","dark"];function Sg(e){const t=Math.max(0,kg.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 r`
|
|
407
407
|
<div class="theme-toggle" style="--theme-index: ${t};">
|
|
408
408
|
<div class="theme-toggle__track" role="group" aria-label="Theme">
|
|
409
409
|
<span class="theme-toggle__indicator"></span>
|
|
@@ -414,7 +414,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
414
414
|
aria-label="System theme"
|
|
415
415
|
title="System"
|
|
416
416
|
>
|
|
417
|
-
${
|
|
417
|
+
${Tg()}
|
|
418
418
|
</button>
|
|
419
419
|
<button
|
|
420
420
|
class="theme-toggle__button ${e.theme==="light"?"active":""}"
|
|
@@ -423,7 +423,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
423
423
|
aria-label="Light theme"
|
|
424
424
|
title="Light"
|
|
425
425
|
>
|
|
426
|
-
${
|
|
426
|
+
${Ag()}
|
|
427
427
|
</button>
|
|
428
428
|
<button
|
|
429
429
|
class="theme-toggle__button ${e.theme==="dark"?"active":""}"
|
|
@@ -432,11 +432,11 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
432
432
|
aria-label="Dark theme"
|
|
433
433
|
title="Dark"
|
|
434
434
|
>
|
|
435
|
-
${
|
|
435
|
+
${Cg()}
|
|
436
436
|
</button>
|
|
437
437
|
</div>
|
|
438
438
|
</div>
|
|
439
|
-
`}function
|
|
439
|
+
`}function Ag(){return r`
|
|
440
440
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
441
441
|
<circle cx="12" cy="12" r="4"></circle>
|
|
442
442
|
<path d="M12 2v2"></path>
|
|
@@ -448,21 +448,21 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
448
448
|
<path d="m6.34 17.66-1.41 1.41"></path>
|
|
449
449
|
<path d="m19.07 4.93-1.41 1.41"></path>
|
|
450
450
|
</svg>
|
|
451
|
-
`}function
|
|
451
|
+
`}function Cg(){return r`
|
|
452
452
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
453
453
|
<path
|
|
454
454
|
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"
|
|
455
455
|
></path>
|
|
456
456
|
</svg>
|
|
457
|
-
`}function
|
|
457
|
+
`}function Tg(){return r`
|
|
458
458
|
<svg class="theme-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
459
459
|
<rect width="20" height="14" x="2" y="3" rx="2"></rect>
|
|
460
460
|
<line x1="8" x2="16" y1="21" y2="21"></line>
|
|
461
461
|
<line x1="12" x2="12" y1="17" y2="21"></line>
|
|
462
462
|
</svg>
|
|
463
|
-
`}function
|
|
463
|
+
`}function tl(e,t){if(!e)return e;const s=e.files.some(i=>i.name===t.name)?e.files.map(i=>i.name===t.name?t:i):[...e.files,t];return{...e,files:s}}async function Ms(e,t){if(!(!e.client||!e.connected||e.agentFilesLoading)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const n=await e.client.request("agents.files.list",{agentId:t});n&&(e.agentFilesList=n,e.agentFileActive&&!n.files.some(s=>s.name===e.agentFileActive)&&(e.agentFileActive=null))}catch(n){e.agentFilesError=String(n)}finally{e.agentFilesLoading=!1}}}async function _g(e,t,n,s){if(!(!e.client||!e.connected||e.agentFilesLoading)&&!Object.hasOwn(e.agentFileContents,n)){e.agentFilesLoading=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.get",{agentId:t,name:n});if(i?.file){const a=i.file.content??"",o=e.agentFileContents[n]??"",l=e.agentFileDrafts[n],c=s?.preserveDraft??!0;e.agentFilesList=tl(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:a},(!c||!Object.hasOwn(e.agentFileDrafts,n)||l===o)&&(e.agentFileDrafts={...e.agentFileDrafts,[n]:a})}}catch(i){e.agentFilesError=String(i)}finally{e.agentFilesLoading=!1}}}async function Eg(e,t,n,s){if(!(!e.client||!e.connected||e.agentFileSaving)){e.agentFileSaving=!0,e.agentFilesError=null;try{const i=await e.client.request("agents.files.set",{agentId:t,name:n,content:s});i?.file&&(e.agentFilesList=tl(e.agentFilesList,i.file),e.agentFileContents={...e.agentFileContents,[n]:s},e.agentFileDrafts={...e.agentFileDrafts,[n]:s})}catch(i){e.agentFilesError=String(i)}finally{e.agentFileSaving=!1}}}async function nl(e,t){if(!(!e.client||!e.connected)&&!e.usageLoading){e.usageLoading=!0,e.usageError=null;try{const n=t?.startDate??e.usageStartDate,s=t?.endDate??e.usageEndDate,[i,a]=await Promise.all([e.client.request("sessions.usage",{startDate:n,endDate:s,limit:1e3,includeContextWeight:!0}),e.client.request("usage.cost",{startDate:n,endDate:s})]);i&&(e.usageResult=i),a&&(e.usageCostSummary=a)}catch(n){e.usageError=String(n)}finally{e.usageLoading=!1}}}async function Lg(e,t){if(!(!e.client||!e.connected)&&!e.usageTimeSeriesLoading){e.usageTimeSeriesLoading=!0,e.usageTimeSeries=null;try{const n=await e.client.request("sessions.usage.timeseries",{key:t});n&&(e.usageTimeSeries=n)}catch{e.usageTimeSeries=null}finally{e.usageTimeSeriesLoading=!1}}}async function Mg(e,t){if(!(!e.client||!e.connected)&&!e.usageSessionLogsLoading){e.usageSessionLogsLoading=!0,e.usageSessionLogs=null;try{const n=await e.client.request("sessions.usage.logs",{key:t,limit:500});n&&Array.isArray(n.logs)&&(e.usageSessionLogs=n.logs)}catch{e.usageSessionLogs=null}finally{e.usageSessionLogsLoading=!1}}}const Ig={bash:"exec","apply-patch":"apply_patch"},Rg={"group:memory":["memory_search","memory_get"],"group:web":["web_search","web_fetch"],"group:fs":["read","write","edit","apply_patch"],"group:runtime":["exec","process"],"group:sessions":["sessions_list","sessions_history","sessions_send","sessions_spawn","session_status"],"group:ui":["browser","canvas"],"group:automation":["cron","gateway"],"group:messaging":["message"],"group:nodes":["nodes"],"group:openclaw":["browser","canvas","nodes","cron","message","gateway","agents_list","sessions_list","sessions_history","sessions_send","sessions_spawn","session_status","memory_search","memory_get","web_search","web_fetch","image"]},Pg={minimal:{allow:["session_status"]},coding:{allow:["group:fs","group:runtime","group:sessions","group:memory","image"]},messaging:{allow:["group:messaging","sessions_list","sessions_history","sessions_send","session_status"]},full:{}};function Pe(e){const t=e.trim().toLowerCase();return Ig[t]??t}function Dg(e){return e?e.map(Pe).filter(Boolean):[]}function Fg(e){const t=Dg(e),n=[];for(const s of t){const i=Rg[s];if(i){n.push(...i);continue}n.push(s)}return Array.from(new Set(n))}function Ng(e){if(!e)return;const t=Pg[e];if(t&&!(!t.allow&&!t.deny))return{allow:t.allow?[...t.allow]:void 0,deny:t.deny?[...t.deny]:void 0}}function Og(e){const t=e.host??"unknown",n=e.ip?`(${e.ip})`:"",s=e.mode??"",i=e.version??"";return`${t} ${n} ${s} ${i}`.trim()}function Bg(e){const t=e.ts??null;return t?V(t):"n/a"}function ji(e){return e?`${Xt(e)} (${V(e)})`:"n/a"}function Ug(e){if(e.totalTokens==null)return"n/a";const t=e.totalTokens??0,n=e.contextTokens??0;return n?`${t} / ${n}`:String(t)}function zg(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}function sl(e){const t=e.state??{},n=t.nextRunAtMs?Xt(t.nextRunAtMs):"n/a",s=t.lastRunAtMs?Xt(t.lastRunAtMs):"n/a";return`${t.lastStatus??"n/a"} · next ${n} · last ${s}`}function il(e){const t=e.schedule;if(t.kind==="at"){const n=Date.parse(t.at);return Number.isFinite(n)?`At ${Xt(n)}`:`At ${t.at}`}return t.kind==="every"?`Every ${fr(t.everyMs)}`:`Cron ${t.expr}${t.tz?` (${t.tz})`:""}`}function al(e){const t=e.payload;if(t.kind==="systemEvent")return`System: ${t.text}`;const n=`Agent: ${t.message}`,s=e.delivery;if(s&&s.mode!=="none"){const i=s.channel||s.to?` (${s.channel??"last"}${s.to?` -> ${s.to}`:""})`:"";return`${n} · ${s.mode}${i}`}return n}const no=[{id:"fs",label:"Files",tools:[{id:"read",label:"read",description:"Read file contents"},{id:"write",label:"write",description:"Create or overwrite files"},{id:"edit",label:"edit",description:"Make precise edits"},{id:"apply_patch",label:"apply_patch",description:"Patch files (OpenAI)"}]},{id:"runtime",label:"Runtime",tools:[{id:"exec",label:"exec",description:"Run shell commands"},{id:"process",label:"process",description:"Manage background processes"}]},{id:"web",label:"Web",tools:[{id:"web_search",label:"web_search",description:"Search the web"},{id:"web_fetch",label:"web_fetch",description:"Fetch web content"}]},{id:"memory",label:"Memory",tools:[{id:"memory_search",label:"memory_search",description:"Semantic search"},{id:"memory_get",label:"memory_get",description:"Read memory files"}]},{id:"sessions",label:"Sessions",tools:[{id:"sessions_list",label:"sessions_list",description:"List sessions"},{id:"sessions_history",label:"sessions_history",description:"Session history"},{id:"sessions_send",label:"sessions_send",description:"Send to session"},{id:"sessions_spawn",label:"sessions_spawn",description:"Spawn sub-agent"},{id:"session_status",label:"session_status",description:"Session status"}]},{id:"ui",label:"UI",tools:[{id:"browser",label:"browser",description:"Control web browser"},{id:"canvas",label:"canvas",description:"Control canvases"}]},{id:"messaging",label:"Messaging",tools:[{id:"message",label:"message",description:"Send messages"}]},{id:"automation",label:"Automation",tools:[{id:"cron",label:"cron",description:"Schedule tasks"},{id:"gateway",label:"gateway",description:"Gateway control"}]},{id:"nodes",label:"Nodes",tools:[{id:"nodes",label:"nodes",description:"Nodes + devices"}]},{id:"agents",label:"Agents",tools:[{id:"agents_list",label:"agents_list",description:"List agents"}]},{id:"media",label:"Media",tools:[{id:"image",label:"image",description:"Image understanding"}]}],Hg=[{id:"minimal",label:"Minimal"},{id:"coding",label:"Coding"},{id:"messaging",label:"Messaging"},{id:"full",label:"Full"}];function ol(e){return e.name?.trim()||e.identity?.name?.trim()||e.id}const Kg=new RegExp("\\p{Emoji_Presentation}(\\u200d\\p{Emoji_Presentation}|\\ufe0f)*","u");function jg(e){const t=e.trim();if(!t||t.length>16)return!1;let n=!1;for(let s=0;s<t.length;s+=1)if(t.charCodeAt(s)>127){n=!0;break}return!(!n||t.includes("://")||t.includes("/")||t.includes("."))}function Wg(e){const t=Kg.exec(e.trim());return t?t[0]:""}function ss(e,t){for(const n of[t?.emoji,e.identity?.emoji,t?.avatar,e.identity?.avatar]){const s=n?.trim();if(!s)continue;if(jg(s))return s;const i=Wg(s);if(i)return i}return""}function rl(e,t){return t&&e===t?"default":null}function qg(e){if(e==null||!Number.isFinite(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let n=e/1024,s=0;for(;n>=1024&&s<t.length-1;)n/=1024,s+=1;return`${n.toFixed(n<10?1:0)} ${t[s]}`}function is(e,t){const n=e;return{entry:(n?.agents?.list??[]).find(a=>a?.id===t),defaults:n?.agents?.defaults,globalTools:n?.tools}}function ll(e,t,n,s,i){const a=is(t,e.id),l=(n&&n.agentId===e.id?n.workspace:null)||a.entry?.workspace||a.defaults?.workspace||"default",c=a.entry?.model?qt(a.entry?.model):qt(a.defaults?.model),u=i?.name?.trim()||e.identity?.name?.trim()||e.name?.trim()||a.entry?.name||e.id,p=ss(e,i)||"-",g=Array.isArray(a.entry?.skills)?a.entry?.skills:null,h=g?.length??null;return{workspace:l,model:c,identityName:u,identityEmoji:p,skillsLabel:g?`${h} selected`:"all skills",isDefault:!!(s&&e.id===s)}}function qt(e){if(!e)return"-";if(typeof e=="string")return e.trim()||"-";if(typeof e=="object"&&e){const t=e,n=t.primary?.trim();if(n){const s=Array.isArray(t.fallbacks)?t.fallbacks.length:0;return s>0?`${n} (+${s} fallback)`:n}}return"-"}function so(e){const t=e.match(/^(.+) \(\+\d+ fallback\)$/);return t?t[1]:e}function io(e){if(!e)return null;if(typeof e=="string")return e.trim()||null;if(typeof e=="object"&&e){const t=e;return(typeof t.primary=="string"?t.primary:typeof t.model=="string"?t.model:typeof t.id=="string"?t.id:typeof t.value=="string"?t.value:null)?.trim()||null}return null}function Gg(e){if(!e||typeof e=="string")return null;if(typeof e=="object"&&e){const t=e,n=Array.isArray(t.fallbacks)?t.fallbacks:Array.isArray(t.fallback)?t.fallback:null;return n?n.filter(s=>typeof s=="string"):null}return null}function Vg(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Qg(e){const n=e?.agents?.defaults?.models;if(!n||typeof n!="object")return[];const s=[];for(const[i,a]of Object.entries(n)){const o=i.trim();if(!o)continue;const l=a&&typeof a=="object"&&"alias"in a&&typeof a.alias=="string"?a.alias?.trim():void 0,c=l&&l!==o?`${l} (${o})`:o;s.push({value:o,label:c})}return s}function Yg(e,t){const n=Qg(e),s=t?n.some(i=>i.value===t):!1;return t&&!s&&n.unshift({value:t,label:`Current (${t})`}),n.length===0?r`
|
|
464
464
|
<option value="" disabled>No configured models</option>
|
|
465
|
-
`:n.map(i=>r`<option value=${i.value}>${i.label}</option>`)}function
|
|
465
|
+
`:n.map(i=>r`<option value=${i.value}>${i.label}</option>`)}function Zg(e){const t=Pe(e);if(!t)return{kind:"exact",value:""};if(t==="*")return{kind:"all"};if(!t.includes("*"))return{kind:"exact",value:t};const n=t.replace(/[.*+?^${}()|[\\]\\]/g,"\\$&");return{kind:"regex",value:new RegExp(`^${n.replaceAll("\\*",".*")}$`)}}function ai(e){return Array.isArray(e)?Fg(e).map(Zg).filter(t=>t.kind!=="exact"||t.value.length>0):[]}function Gt(e,t){for(const n of t)if(n.kind==="all"||n.kind==="exact"&&e===n.value||n.kind==="regex"&&n.value.test(e))return!0;return!1}function Jg(e,t){if(!t)return!0;const n=Pe(e),s=ai(t.deny);if(Gt(n,s))return!1;const i=ai(t.allow);return!!(i.length===0||Gt(n,i)||n==="apply_patch"&&Gt("exec",i))}function ao(e,t){if(!Array.isArray(t)||t.length===0)return!1;const n=Pe(e),s=ai(t);return!!(Gt(n,s)||n==="apply_patch"&&Gt("exec",s))}function Xg(e){const t=e.agentsList?.agents??[],n=e.agentsList?.defaultId??null,s=e.selectedAgentId??n??t[0]?.id??null,i=s?t.find(a=>a.id===s)??null:null;return r`
|
|
466
466
|
<div class="agents-layout">
|
|
467
467
|
<section class="card agents-sidebar">
|
|
468
468
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -478,17 +478,19 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
478
478
|
<div class="agent-list" style="margin-top: 12px;">
|
|
479
479
|
${t.length===0?r`
|
|
480
480
|
<div class="muted">No agents found.</div>
|
|
481
|
-
`:t.map(a=>{const o=
|
|
481
|
+
`:t.map(a=>{const o=rl(a.id,n),l=ss(a,e.agentIdentityById[a.id]??null);return r`
|
|
482
482
|
<button
|
|
483
483
|
type="button"
|
|
484
484
|
class="agent-row ${s===a.id?"active":""}"
|
|
485
485
|
@click=${()=>e.onSelectAgent(a.id)}
|
|
486
486
|
>
|
|
487
487
|
<div class="agent-avatar">
|
|
488
|
-
${l||
|
|
488
|
+
${l||r`
|
|
489
|
+
<img src="/favicon.svg" alt="" style="width: 100%; height: 100%; object-fit: contain" />
|
|
490
|
+
`}
|
|
489
491
|
</div>
|
|
490
492
|
<div class="agent-info">
|
|
491
|
-
<div class="agent-title">${
|
|
493
|
+
<div class="agent-title">${ol(a)}</div>
|
|
492
494
|
<div class="agent-sub mono">${a.id}</div>
|
|
493
495
|
</div>
|
|
494
496
|
${o?r`<span class="agent-pill">${o}</span>`:v}
|
|
@@ -498,14 +500,14 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
498
500
|
</section>
|
|
499
501
|
<section class="agents-main">
|
|
500
502
|
${i?r`
|
|
501
|
-
${
|
|
502
|
-
${
|
|
503
|
-
${e.activePanel==="overview"?
|
|
504
|
-
${e.activePanel==="files"?
|
|
505
|
-
${e.activePanel==="tools"?
|
|
506
|
-
${e.activePanel==="skills"?
|
|
507
|
-
${e.activePanel==="channels"?
|
|
508
|
-
${e.activePanel==="cron"?
|
|
503
|
+
${ep(i,n,e.agentIdentityById[i.id]??null)}
|
|
504
|
+
${tp(e.activePanel,a=>e.onSelectPanel(a))}
|
|
505
|
+
${e.activePanel==="overview"?np({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,agentIdentityError:e.agentIdentityError,agentIdentityLoading:e.agentIdentityLoading,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave,onModelChange:e.onModelChange,onModelFallbacksChange:e.onModelFallbacksChange}):v}
|
|
506
|
+
${e.activePanel==="files"?gp({agentId:i.id,agentFilesList:e.agentFilesList,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,onLoadFiles:e.onLoadFiles,onSelectFile:e.onSelectFile,onFileDraftChange:e.onFileDraftChange,onFileReset:e.onFileReset,onFileSave:e.onFileSave}):v}
|
|
507
|
+
${e.activePanel==="tools"?fp({agentId:i.id,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,onProfileChange:e.onToolsProfileChange,onOverridesChange:e.onToolsOverridesChange,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):v}
|
|
508
|
+
${e.activePanel==="skills"?vp({agentId:i.id,report:e.agentSkillsReport,loading:e.agentSkillsLoading,error:e.agentSkillsError,activeAgentId:e.agentSkillsAgentId,configForm:e.configForm,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configDirty,filter:e.skillsFilter,onFilterChange:e.onSkillsFilterChange,onRefresh:e.onSkillsRefresh,onToggle:e.onAgentSkillToggle,onClear:e.onAgentSkillsClear,onDisableAll:e.onAgentSkillsDisableAll,onConfigReload:e.onConfigReload,onConfigSave:e.onConfigSave}):v}
|
|
509
|
+
${e.activePanel==="channels"?dp({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,snapshot:e.channelsSnapshot,loading:e.channelsLoading,error:e.channelsError,lastSuccess:e.channelsLastSuccess,onRefresh:e.onChannelsRefresh}):v}
|
|
510
|
+
${e.activePanel==="cron"?up({agent:i,defaultId:n,configForm:e.configForm,agentFilesList:e.agentFilesList,agentIdentity:e.agentIdentityById[i.id]??null,jobs:e.cronJobs,status:e.cronStatus,loading:e.cronLoading,error:e.cronError,onRefresh:e.onCronRefresh}):v}
|
|
509
511
|
`:r`
|
|
510
512
|
<div class="card">
|
|
511
513
|
<div class="card-title">Select an agent</div>
|
|
@@ -514,11 +516,13 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
514
516
|
`}
|
|
515
517
|
</section>
|
|
516
518
|
</div>
|
|
517
|
-
`}function
|
|
519
|
+
`}function ep(e,t,n){const s=rl(e.id,t),i=ol(e),a=e.identity?.theme?.trim()||"Agent workspace and routing.",o=ss(e,n);return r`
|
|
518
520
|
<section class="card agent-header">
|
|
519
521
|
<div class="agent-header-main">
|
|
520
522
|
<div class="agent-avatar agent-avatar--lg">
|
|
521
|
-
${o||
|
|
523
|
+
${o||r`
|
|
524
|
+
<img src="/favicon.svg" alt="" style="width: 100%; height: 100%; object-fit: contain" />
|
|
525
|
+
`}
|
|
522
526
|
</div>
|
|
523
527
|
<div>
|
|
524
528
|
<div class="card-title">${i}</div>
|
|
@@ -530,7 +534,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
530
534
|
${s?r`<span class="agent-pill">${s}</span>`:v}
|
|
531
535
|
</div>
|
|
532
536
|
</section>
|
|
533
|
-
`}function
|
|
537
|
+
`}function tp(e,t){return r`
|
|
534
538
|
<div class="agent-tabs">
|
|
535
539
|
${[{id:"overview",label:"Overview"},{id:"files",label:"Files"},{id:"tools",label:"Tools"},{id:"skills",label:"Skills"},{id:"channels",label:"Channels"},{id:"cron",label:"Cron Jobs"}].map(s=>r`
|
|
536
540
|
<button
|
|
@@ -542,7 +546,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
542
546
|
</button>
|
|
543
547
|
`)}
|
|
544
548
|
</div>
|
|
545
|
-
`}function
|
|
549
|
+
`}function np(e){const{agent:t,configForm:n,agentFilesList:s,agentIdentity:i,agentIdentityLoading:a,agentIdentityError:o,configLoading:l,configSaving:c,configDirty:u,onConfigReload:p,onConfigSave:g,onModelChange:h,onModelFallbacksChange:d}=e,f=is(n,t.id),k=(s&&s.agentId===t.id?s.workspace:null)||f.entry?.workspace||f.defaults?.workspace||"default",S=f.entry?.model?qt(f.entry?.model):qt(f.defaults?.model),w=qt(f.defaults?.model),C=io(f.entry?.model)||(S!=="-"?so(S):null),A=io(f.defaults?.model)||(w!=="-"?so(w):null),_=C??A??null,T=Gg(f.entry?.model),I=T?T.join(", "):"",z=i?.name?.trim()||t.identity?.name?.trim()||t.name?.trim()||f.entry?.name||"-",se=ss(t,i)||"-",F=Array.isArray(f.entry?.skills)?f.entry?.skills:null,H=F?.length??null,ce=a?"Loading…":o?"Unavailable":"",E=!!(e.defaultId&&t.id===e.defaultId);return r`
|
|
546
550
|
<section class="card">
|
|
547
551
|
<div class="card-title">Overview</div>
|
|
548
552
|
<div class="card-sub">Workspace paths and identity metadata.</div>
|
|
@@ -589,7 +593,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
589
593
|
${A?`Inherit default (${A})`:"Inherit default"}
|
|
590
594
|
</option>
|
|
591
595
|
`}
|
|
592
|
-
${
|
|
596
|
+
${Yg(n,_??void 0)}
|
|
593
597
|
</select>
|
|
594
598
|
</label>
|
|
595
599
|
<label class="field" style="min-width: 260px; flex: 1;">
|
|
@@ -598,7 +602,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
598
602
|
.value=${I}
|
|
599
603
|
?disabled=${!n||l||c}
|
|
600
604
|
placeholder="provider/model, provider/model"
|
|
601
|
-
@input=${B=>d(t.id,
|
|
605
|
+
@input=${B=>d(t.id,Vg(B.target.value))}
|
|
602
606
|
/>
|
|
603
607
|
</label>
|
|
604
608
|
</div>
|
|
@@ -620,7 +624,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
620
624
|
</div>
|
|
621
625
|
</div>
|
|
622
626
|
</section>
|
|
623
|
-
`}function
|
|
627
|
+
`}function cl(e,t){return r`
|
|
624
628
|
<section class="card">
|
|
625
629
|
<div class="card-title">Agent Context</div>
|
|
626
630
|
<div class="card-sub">${t}</div>
|
|
@@ -651,9 +655,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
651
655
|
</div>
|
|
652
656
|
</div>
|
|
653
657
|
</section>
|
|
654
|
-
`}function
|
|
658
|
+
`}function sp(e,t){const n=e.channelMeta?.find(s=>s.id===t);return n?.label?n.label:e.channelLabels?.[t]??t}function ip(e){if(!e)return[];const t=new Set;for(const i of e.channelOrder??[])t.add(i);for(const i of e.channelMeta??[])t.add(i.id);for(const i of Object.keys(e.channelAccounts??{}))t.add(i);const n=[],s=e.channelOrder?.length?e.channelOrder:Array.from(t);for(const i of s)t.has(i)&&(n.push(i),t.delete(i));for(const i of t)n.push(i);return n.map(i=>({id:i,label:sp(e,i),accounts:e.channelAccounts?.[i]??[]}))}const ap=["groupPolicy","streamMode","dmPolicy"];function op(e,t){if(!e)return null;const s=(e.channels??{})[t];if(s&&typeof s=="object")return s;const i=e[t];return i&&typeof i=="object"?i:null}function rp(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function lp(e,t){const n=op(e,t);return n?ap.flatMap(s=>s in n?[{label:s,value:rp(n[s])}]:[]):[]}function cp(e){let t=0,n=0,s=0;for(const i of e){const a=i.probe&&typeof i.probe=="object"&&"ok"in i.probe?!!i.probe.ok:!1;(i.connected===!0||i.running===!0||a)&&(t+=1),i.configured&&(n+=1),i.enabled&&(s+=1)}return{total:e.length,connected:t,configured:n,enabled:s}}function dp(e){const t=ll(e.agent,e.configForm,e.agentFilesList,e.defaultId,e.agentIdentity),n=ip(e.snapshot),s=e.lastSuccess?V(e.lastSuccess):"never";return r`
|
|
655
659
|
<section class="grid grid-cols-2">
|
|
656
|
-
${
|
|
660
|
+
${cl(t,"Workspace, identity, and model configuration.")}
|
|
657
661
|
<section class="card">
|
|
658
662
|
<div class="row" style="justify-content: space-between;">
|
|
659
663
|
<div>
|
|
@@ -675,7 +679,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
675
679
|
<div class="muted" style="margin-top: 16px">No channels found.</div>
|
|
676
680
|
`:r`
|
|
677
681
|
<div class="list" style="margin-top: 16px;">
|
|
678
|
-
${n.map(i=>{const a=
|
|
682
|
+
${n.map(i=>{const a=cp(i.accounts),o=a.total?`${a.connected}/${a.total} connected`:"no accounts",l=a.configured?`${a.configured} configured`:"not configured",c=a.total?`${a.enabled} enabled`:"disabled",u=lp(e.configForm,i.id);return r`
|
|
679
683
|
<div class="list-item">
|
|
680
684
|
<div class="list-main">
|
|
681
685
|
<div class="list-title">${i.label}</div>
|
|
@@ -693,9 +697,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
693
697
|
`}
|
|
694
698
|
</section>
|
|
695
699
|
</section>
|
|
696
|
-
`}function
|
|
700
|
+
`}function up(e){const t=ll(e.agent,e.configForm,e.agentFilesList,e.defaultId,e.agentIdentity),n=e.jobs.filter(s=>s.agentId===e.agent.id);return r`
|
|
697
701
|
<section class="grid grid-cols-2">
|
|
698
|
-
${
|
|
702
|
+
${cl(t,"Workspace and scheduling targets.")}
|
|
699
703
|
<section class="card">
|
|
700
704
|
<div class="row" style="justify-content: space-between;">
|
|
701
705
|
<div>
|
|
@@ -719,7 +723,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
719
723
|
</div>
|
|
720
724
|
<div class="stat">
|
|
721
725
|
<div class="stat-label">Next wake</div>
|
|
722
|
-
<div class="stat-value">${
|
|
726
|
+
<div class="stat-value">${ji(e.status?.nextWakeAtMs??null)}</div>
|
|
723
727
|
</div>
|
|
724
728
|
</div>
|
|
725
729
|
${e.error?r`<div class="callout danger" style="margin-top: 12px;">${e.error}</div>`:v}
|
|
@@ -738,7 +742,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
738
742
|
<div class="list-title">${s.name}</div>
|
|
739
743
|
${s.description?r`<div class="list-sub">${s.description}</div>`:v}
|
|
740
744
|
<div class="chip-row" style="margin-top: 6px;">
|
|
741
|
-
<span class="chip">${
|
|
745
|
+
<span class="chip">${il(s)}</span>
|
|
742
746
|
<span class="chip ${s.enabled?"chip-ok":"chip-warn"}">
|
|
743
747
|
${s.enabled?"enabled":"disabled"}
|
|
744
748
|
</span>
|
|
@@ -746,15 +750,15 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
746
750
|
</div>
|
|
747
751
|
</div>
|
|
748
752
|
<div class="list-meta">
|
|
749
|
-
<div class="mono">${
|
|
750
|
-
<div class="muted">${
|
|
753
|
+
<div class="mono">${sl(s)}</div>
|
|
754
|
+
<div class="muted">${al(s)}</div>
|
|
751
755
|
</div>
|
|
752
756
|
</div>
|
|
753
757
|
`)}
|
|
754
758
|
</div>
|
|
755
759
|
`}
|
|
756
760
|
</section>
|
|
757
|
-
`}function
|
|
761
|
+
`}function gp(e){const t=e.agentFilesList?.agentId===e.agentId?e.agentFilesList:null,n=t?.files??[],s=e.agentFileActive??null,i=s?n.find(c=>c.name===s)??null:null,a=s?e.agentFileContents[s]??"":"",o=s?e.agentFileDrafts[s]??a:"",l=s?o!==a:!1;return r`
|
|
758
762
|
<section class="card">
|
|
759
763
|
<div class="row" style="justify-content: space-between;">
|
|
760
764
|
<div>
|
|
@@ -776,7 +780,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
776
780
|
<div class="agent-files-list">
|
|
777
781
|
${n.length===0?r`
|
|
778
782
|
<div class="muted">No files found.</div>
|
|
779
|
-
`:n.map(c=>
|
|
783
|
+
`:n.map(c=>pp(c,s,()=>e.onSelectFile(c.name)))}
|
|
780
784
|
</div>
|
|
781
785
|
<div class="agent-files-editor">
|
|
782
786
|
${i?r`
|
|
@@ -825,7 +829,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
825
829
|
</div>
|
|
826
830
|
`}
|
|
827
831
|
</section>
|
|
828
|
-
`}function
|
|
832
|
+
`}function pp(e,t,n){const s=e.missing?"Missing":`${qg(e.size)} · ${V(e.updatedAtMs??null)}`;return r`
|
|
829
833
|
<button
|
|
830
834
|
type="button"
|
|
831
835
|
class="agent-file-row ${t===e.name?"active":""}"
|
|
@@ -839,7 +843,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
839
843
|
<span class="agent-pill warn">missing</span>
|
|
840
844
|
`:v}
|
|
841
845
|
</button>
|
|
842
|
-
`}function
|
|
846
|
+
`}function fp(e){const t=is(e.configForm,e.agentId),n=t.entry?.tools??{},s=t.globalTools??{},i=n.profile??s.profile??"full",a=n.profile?"agent override":s.profile?"global default":"default",o=Array.isArray(n.allow)&&n.allow.length>0,l=Array.isArray(s.allow)&&s.allow.length>0,c=!!e.configForm&&!e.configLoading&&!e.configSaving&&!o,u=o?[]:Array.isArray(n.alsoAllow)?n.alsoAllow:[],p=o?[]:Array.isArray(n.deny)?n.deny:[],g=o?{allow:n.allow??[],deny:n.deny??[]}:Ng(i)??void 0,h=no.flatMap(S=>S.tools.map(w=>w.id)),d=S=>{const w=Jg(S,g),C=ao(S,u),A=ao(S,p);return{allowed:(w||C)&&!A,baseAllowed:w,denied:A}},f=h.filter(S=>d(S).allowed).length,m=(S,w)=>{const C=new Set(u.map(I=>Pe(I)).filter(I=>I.length>0)),A=new Set(p.map(I=>Pe(I)).filter(I=>I.length>0)),_=d(S).baseAllowed,T=Pe(S);w?(A.delete(T),_||C.add(T)):(C.delete(T),A.add(T)),e.onOverridesChange(e.agentId,[...C],[...A])},k=S=>{const w=new Set(u.map(A=>Pe(A)).filter(A=>A.length>0)),C=new Set(p.map(A=>Pe(A)).filter(A=>A.length>0));for(const A of h){const _=d(A).baseAllowed,T=Pe(A);S?(C.delete(T),_||w.add(T)):(w.delete(T),C.add(T))}e.onOverridesChange(e.agentId,[...w],[...C])};return r`
|
|
843
847
|
<section class="card">
|
|
844
848
|
<div class="row" style="justify-content: space-between;">
|
|
845
849
|
<div>
|
|
@@ -917,7 +921,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
917
921
|
<div class="agent-tools-presets" style="margin-top: 16px;">
|
|
918
922
|
<div class="label">Quick Presets</div>
|
|
919
923
|
<div class="agent-tools-buttons">
|
|
920
|
-
${
|
|
924
|
+
${Hg.map(S=>r`
|
|
921
925
|
<button
|
|
922
926
|
class="btn btn--sm ${i===S.id?"active":""}"
|
|
923
927
|
?disabled=${!c}
|
|
@@ -937,7 +941,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
937
941
|
</div>
|
|
938
942
|
|
|
939
943
|
<div class="agent-tools-grid" style="margin-top: 20px;">
|
|
940
|
-
${
|
|
944
|
+
${no.map(S=>r`
|
|
941
945
|
<div class="agent-tools-section">
|
|
942
946
|
<div class="agent-tools-header">${S.label}</div>
|
|
943
947
|
<div class="agent-tools-list">
|
|
@@ -963,7 +967,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
963
967
|
`)}
|
|
964
968
|
</div>
|
|
965
969
|
</section>
|
|
966
|
-
`}const
|
|
970
|
+
`}const $n=[{id:"workspace",label:"Workspace Skills",sources:["cryptoclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["cryptoclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["cryptoclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["cryptoclaw-extra"]}];function hp(e){const t=new Map;for(const a of $n)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=$n.find(a=>a.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:$n.find(l=>l.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):s.skills.push(a)}const i=$n.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return s.skills.length>0&&i.push(s),i}function vp(e){const t=!!e.configForm&&!e.configLoading&&!e.configSaving,n=is(e.configForm,e.agentId),s=Array.isArray(n.entry?.skills)?n.entry?.skills:void 0,i=new Set((s??[]).map(d=>d.trim()).filter(Boolean)),a=s!==void 0,o=!!(e.report&&e.activeAgentId===e.agentId),l=o?e.report?.skills??[]:[],c=e.filter.trim().toLowerCase(),u=c?l.filter(d=>[d.name,d.description,d.source].join(" ").toLowerCase().includes(c)):l,p=hp(u),g=a?l.filter(d=>i.has(d.name)).length:l.length,h=l.length;return r`
|
|
967
971
|
<section class="card">
|
|
968
972
|
<div class="row" style="justify-content: space-between;">
|
|
969
973
|
<div>
|
|
@@ -1035,21 +1039,21 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1035
1039
|
<div class="muted" style="margin-top: 16px">No skills found.</div>
|
|
1036
1040
|
`:r`
|
|
1037
1041
|
<div class="agent-skills-groups" style="margin-top: 16px;">
|
|
1038
|
-
${p.map(d=>
|
|
1042
|
+
${p.map(d=>mp(d,{agentId:e.agentId,allowSet:i,usingAllowlist:a,editable:t,onToggle:e.onToggle}))}
|
|
1039
1043
|
</div>
|
|
1040
1044
|
`}
|
|
1041
1045
|
</section>
|
|
1042
|
-
`}function
|
|
1046
|
+
`}function mp(e,t){const n=e.id==="workspace"||e.id==="built-in";return r`
|
|
1043
1047
|
<details class="agent-skills-group" ?open=${!n}>
|
|
1044
1048
|
<summary class="agent-skills-header">
|
|
1045
1049
|
<span>${e.label}</span>
|
|
1046
1050
|
<span class="muted">${e.skills.length}</span>
|
|
1047
1051
|
</summary>
|
|
1048
1052
|
<div class="list skills-grid">
|
|
1049
|
-
${e.skills.map(s=>
|
|
1053
|
+
${e.skills.map(s=>bp(s,{agentId:t.agentId,allowSet:t.allowSet,usingAllowlist:t.usingAllowlist,editable:t.editable,onToggle:t.onToggle}))}
|
|
1050
1054
|
</div>
|
|
1051
1055
|
</details>
|
|
1052
|
-
`}function
|
|
1056
|
+
`}function bp(e,t){const n=t.usingAllowlist?t.allowSet.has(e.name):!0,s=[...e.missing.bins.map(a=>`bin:${a}`),...e.missing.env.map(a=>`env:${a}`),...e.missing.config.map(a=>`config:${a}`),...e.missing.os.map(a=>`os:${a}`)],i=[];return e.disabled&&i.push("disabled"),e.blockedByAllowlist&&i.push("blocked by allowlist"),r`
|
|
1053
1057
|
<div class="list-item agent-skill-row">
|
|
1054
1058
|
<div class="list-main">
|
|
1055
1059
|
<div class="list-title">
|
|
@@ -1080,7 +1084,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1080
1084
|
</label>
|
|
1081
1085
|
</div>
|
|
1082
1086
|
</div>
|
|
1083
|
-
`}function De(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function
|
|
1087
|
+
`}function De(e){if(e)return Array.isArray(e.type)?e.type.filter(n=>n!=="null")[0]??e.type[0]:e.type}function dl(e){if(!e)return"";if(e.default!==void 0)return e.default;switch(De(e)){case"object":return{};case"array":return[];case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";default:return""}}function as(e){return e.filter(t=>typeof t=="string").join(".")}function Se(e,t){const n=as(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 l=a.split(".");if(l.length!==i.length)continue;let c=!0;for(let u=0;u<i.length;u+=1)if(l[u]!=="*"&&l[u]!==i[u]){c=!1;break}if(c)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 yp(e){const t=as(e).toLowerCase();return t.includes("token")||t.includes("password")||t.includes("secret")||t.includes("apikey")||t.endsWith("key")}const xp=new Set(["title","description","default","nullable"]);function $p(e){return Object.keys(e??{}).filter(n=>!xp.has(n)).length===0}function wp(e){if(e===void 0)return"";try{return JSON.stringify(e,null,2)??""}catch{return""}}const sn={chevronDown:r`
|
|
1084
1088
|
<svg
|
|
1085
1089
|
viewBox="0 0 24 24"
|
|
1086
1090
|
fill="none"
|
|
@@ -1138,7 +1142,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1138
1142
|
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
|
|
1139
1143
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
|
|
1140
1144
|
</svg>
|
|
1141
|
-
`};function je(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=De(t),p=Se(s,i),g=p?.label??t.title??We(String(s.at(-1))),h=p?.help??t.description,d=
|
|
1145
|
+
`};function je(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=De(t),p=Se(s,i),g=p?.label??t.title??We(String(s.at(-1))),h=p?.help??t.description,d=as(s);if(a.has(d))return r`<div class="cfg-field cfg-field--error">
|
|
1142
1146
|
<div class="cfg-field__label">${g}</div>
|
|
1143
1147
|
<div class="cfg-field__error">Unsupported schema node. Use Raw mode.</div>
|
|
1144
1148
|
</div>`;if(t.anyOf||t.oneOf){const m=(t.anyOf??t.oneOf??[]).filter(_=>!(_.type==="null"||Array.isArray(_.type)&&_.type.includes("null")));if(m.length===1)return je({...e,schema:m[0]});const k=_=>{if(_.const!==void 0)return _.const;if(_.enum&&_.enum.length===1)return _.enum[0]},S=m.map(k),w=S.every(_=>_!==void 0);if(w&&S.length>0&&S.length<=5){const _=n??t.default;return r`
|
|
@@ -1158,7 +1162,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1158
1162
|
`)}
|
|
1159
1163
|
</div>
|
|
1160
1164
|
</div>
|
|
1161
|
-
`}if(w&&S.length>5)return
|
|
1165
|
+
`}if(w&&S.length>5)return ro({...e,options:S,value:n??t.default});const C=new Set(m.map(_=>De(_)).filter(Boolean)),A=new Set([...C].map(_=>_==="integer"?"number":_));if([...A].every(_=>["string","number","boolean"].includes(_))){const _=A.has("string"),T=A.has("number");if(A.has("boolean")&&A.size===1)return je({...e,schema:{...t,type:"boolean",anyOf:void 0,oneOf:void 0}});if(_||T)return oo({...e,inputType:T&&!_?"number":"text"})}}if(t.enum){const f=t.enum;if(f.length<=5){const m=n??t.default;return r`
|
|
1162
1166
|
<div class="cfg-field">
|
|
1163
1167
|
${c?r`<label class="cfg-field__label">${g}</label>`:v}
|
|
1164
1168
|
${h?r`<div class="cfg-field__help">${h}</div>`:v}
|
|
@@ -1175,7 +1179,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1175
1179
|
`)}
|
|
1176
1180
|
</div>
|
|
1177
1181
|
</div>
|
|
1178
|
-
`}return
|
|
1182
|
+
`}return ro({...e,options:f,value:n??t.default})}if(u==="object")return Sp(e);if(u==="array")return Ap(e);if(u==="boolean"){const f=typeof n=="boolean"?n:typeof t.default=="boolean"?t.default:!1;return r`
|
|
1179
1183
|
<label class="cfg-toggle-row ${o?"disabled":""}">
|
|
1180
1184
|
<div class="cfg-toggle-row__content">
|
|
1181
1185
|
<span class="cfg-toggle-row__label">${g}</span>
|
|
@@ -1191,12 +1195,12 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1191
1195
|
<span class="cfg-toggle__track"></span>
|
|
1192
1196
|
</div>
|
|
1193
1197
|
</label>
|
|
1194
|
-
`}return u==="number"||u==="integer"
|
|
1198
|
+
`}return u==="number"||u==="integer"?kp(e):u==="string"?oo({...e,inputType:"text"}):r`
|
|
1195
1199
|
<div class="cfg-field cfg-field--error">
|
|
1196
1200
|
<div class="cfg-field__label">${g}</div>
|
|
1197
1201
|
<div class="cfg-field__error">Unsupported type: ${u}. Use Raw mode.</div>
|
|
1198
1202
|
</div>
|
|
1199
|
-
`}function
|
|
1203
|
+
`}function oo(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o,inputType:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??We(String(s.at(-1))),g=u?.help??t.description,h=u?.sensitive??yp(s),d=u?.placeholder??(h?"••••":t.default!==void 0?`Default: ${String(t.default)}`:""),f=n??"";return r`
|
|
1200
1204
|
<div class="cfg-field">
|
|
1201
1205
|
${c?r`<label class="cfg-field__label">${p}</label>`:v}
|
|
1202
1206
|
${g?r`<div class="cfg-field__help">${g}</div>`:v}
|
|
@@ -1221,7 +1225,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1221
1225
|
`:v}
|
|
1222
1226
|
</div>
|
|
1223
1227
|
</div>
|
|
1224
|
-
`}function
|
|
1228
|
+
`}function kp(e){const{schema:t,value:n,path:s,hints:i,disabled:a,onPatch:o}=e,l=e.showLabel??!0,c=Se(s,i),u=c?.label??t.title??We(String(s.at(-1))),p=c?.help??t.description,g=n??t.default??"",h=typeof g=="number"?g:0;return r`
|
|
1225
1229
|
<div class="cfg-field">
|
|
1226
1230
|
${l?r`<label class="cfg-field__label">${u}</label>`:v}
|
|
1227
1231
|
${p?r`<div class="cfg-field__help">${p}</div>`:v}
|
|
@@ -1247,7 +1251,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1247
1251
|
>+</button>
|
|
1248
1252
|
</div>
|
|
1249
1253
|
</div>
|
|
1250
|
-
`}function
|
|
1254
|
+
`}function ro(e){const{schema:t,value:n,path:s,hints:i,disabled:a,options:o,onPatch:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??We(String(s.at(-1))),g=u?.help??t.description,h=n??t.default,d=o.findIndex(m=>m===h||String(m)===String(h)),f="__unset__";return r`
|
|
1251
1255
|
<div class="cfg-field">
|
|
1252
1256
|
${c?r`<label class="cfg-field__label">${p}</label>`:v}
|
|
1253
1257
|
${g?r`<div class="cfg-field__help">${g}</div>`:v}
|
|
@@ -1263,10 +1267,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1263
1267
|
`)}
|
|
1264
1268
|
</select>
|
|
1265
1269
|
</div>
|
|
1266
|
-
`}function
|
|
1270
|
+
`}function Sp(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=Se(s,i),u=c?.label??t.title??We(String(s.at(-1))),p=c?.help??t.description,g=n??t.default,h=g&&typeof g=="object"&&!Array.isArray(g)?g:{},d=t.properties??{},m=Object.entries(d).toSorted((C,A)=>{const _=Se([...s,C[0]],i)?.order??0,T=Se([...s,A[0]],i)?.order??0;return _!==T?_-T:C[0].localeCompare(A[0])}),k=new Set(Object.keys(d)),S=t.additionalProperties,w=!!S&&typeof S=="object";return s.length===1?r`
|
|
1267
1271
|
<div class="cfg-fields">
|
|
1268
1272
|
${m.map(([C,A])=>je({schema:A,value:h[C],path:[...s,C],hints:i,unsupported:a,disabled:o,onPatch:l}))}
|
|
1269
|
-
${w?
|
|
1273
|
+
${w?lo({schema:S,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:k,onPatch:l}):v}
|
|
1270
1274
|
</div>
|
|
1271
1275
|
`:r`
|
|
1272
1276
|
<details class="cfg-object" open>
|
|
@@ -1277,10 +1281,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1277
1281
|
${p?r`<div class="cfg-object__help">${p}</div>`:v}
|
|
1278
1282
|
<div class="cfg-object__content">
|
|
1279
1283
|
${m.map(([C,A])=>je({schema:A,value:h[C],path:[...s,C],hints:i,unsupported:a,disabled:o,onPatch:l}))}
|
|
1280
|
-
${w?
|
|
1284
|
+
${w?lo({schema:S,value:h,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:k,onPatch:l}):v}
|
|
1281
1285
|
</div>
|
|
1282
1286
|
</details>
|
|
1283
|
-
`}function
|
|
1287
|
+
`}function Ap(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,onPatch:l}=e,c=e.showLabel??!0,u=Se(s,i),p=u?.label??t.title??We(String(s.at(-1))),g=u?.help??t.description,h=Array.isArray(t.items)?t.items[0]:t.items;if(!h)return r`
|
|
1284
1288
|
<div class="cfg-field cfg-field--error">
|
|
1285
1289
|
<div class="cfg-field__label">${p}</div>
|
|
1286
1290
|
<div class="cfg-field__error">Unsupported array schema. Use Raw mode.</div>
|
|
@@ -1294,7 +1298,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1294
1298
|
type="button"
|
|
1295
1299
|
class="cfg-array__add"
|
|
1296
1300
|
?disabled=${o}
|
|
1297
|
-
@click=${()=>{const f=[...d,
|
|
1301
|
+
@click=${()=>{const f=[...d,dl(h)];l(s,f)}}
|
|
1298
1302
|
>
|
|
1299
1303
|
<span class="cfg-array__add-icon">${sn.plus}</span>
|
|
1300
1304
|
Add
|
|
@@ -1328,7 +1332,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1328
1332
|
</div>
|
|
1329
1333
|
`}
|
|
1330
1334
|
</div>
|
|
1331
|
-
`}function
|
|
1335
|
+
`}function lo(e){const{schema:t,value:n,path:s,hints:i,unsupported:a,disabled:o,reservedKeys:l,onPatch:c}=e,u=$p(t),p=Object.entries(n??{}).filter(([g])=>!l.has(g));return r`
|
|
1332
1336
|
<div class="cfg-map">
|
|
1333
1337
|
<div class="cfg-map__header">
|
|
1334
1338
|
<span class="cfg-map__label">Custom entries</span>
|
|
@@ -1336,7 +1340,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1336
1340
|
type="button"
|
|
1337
1341
|
class="cfg-map__add"
|
|
1338
1342
|
?disabled=${o}
|
|
1339
|
-
@click=${()=>{const g={...n};let h=1,d=`custom-${h}`;for(;d in g;)h+=1,d=`custom-${h}`;g[d]=u?{}:
|
|
1343
|
+
@click=${()=>{const g={...n};let h=1,d=`custom-${h}`;for(;d in g;)h+=1,d=`custom-${h}`;g[d]=u?{}:dl(t),c(s,g)}}
|
|
1340
1344
|
>
|
|
1341
1345
|
<span class="cfg-map__add-icon">${sn.plus}</span>
|
|
1342
1346
|
Add Entry
|
|
@@ -1347,7 +1351,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1347
1351
|
<div class="cfg-map__empty">No custom entries.</div>
|
|
1348
1352
|
`:r`
|
|
1349
1353
|
<div class="cfg-map__items">
|
|
1350
|
-
${p.map(([g,h])=>{const d=[...s,g],f=
|
|
1354
|
+
${p.map(([g,h])=>{const d=[...s,g],f=wp(h);return r`
|
|
1351
1355
|
<div class="cfg-map__item">
|
|
1352
1356
|
<div class="cfg-map__item-key">
|
|
1353
1357
|
<input
|
|
@@ -1385,7 +1389,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1385
1389
|
</div>
|
|
1386
1390
|
`}
|
|
1387
1391
|
</div>
|
|
1388
|
-
`}const
|
|
1392
|
+
`}const co={env:r`
|
|
1389
1393
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
1390
1394
|
<circle cx="12" cy="12" r="3"></circle>
|
|
1391
1395
|
<path
|
|
@@ -1572,11 +1576,11 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1572
1576
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
1573
1577
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
1574
1578
|
</svg>
|
|
1575
|
-
`},
|
|
1579
|
+
`},Wi={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 uo(e){return co[e]??co.default}function Cp(e,t,n){if(!n)return!0;const s=n.toLowerCase(),i=Wi[e];return e.toLowerCase().includes(s)||i&&(i.label.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))?!0:Kt(t,s)}function Kt(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)||Kt(i,t))return!0}if(e.items){const s=Array.isArray(e.items)?e.items:[e.items];for(const i of s)if(i&&Kt(i,t))return!0}if(e.additionalProperties&&typeof e.additionalProperties=="object"&&Kt(e.additionalProperties,t))return!0;const n=e.anyOf??e.oneOf??e.allOf;if(n){for(const s of n)if(s&&Kt(s,t))return!0}return!1}function Tp(e){if(!e.schema)return r`
|
|
1576
1580
|
<div class="muted">Schema unavailable.</div>
|
|
1577
1581
|
`;const t=e.schema,n=e.value??{};if(De(t)!=="object"||!t.properties)return r`
|
|
1578
1582
|
<div class="callout danger">Unsupported schema. Use Raw.</div>
|
|
1579
|
-
`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,l=e.activeSubsection??null,u=Object.entries(i).toSorted((g,h)=>{const d=Se([g[0]],e.uiHints)?.order??50,f=Se([h[0]],e.uiHints)?.order??50;return d!==f?d-f:g[0].localeCompare(h[0])}).filter(([g,h])=>!(o&&g!==o||a&&!
|
|
1583
|
+
`;const s=new Set(e.unsupportedPaths??[]),i=t.properties,a=e.searchQuery??"",o=e.activeSection,l=e.activeSubsection??null,u=Object.entries(i).toSorted((g,h)=>{const d=Se([g[0]],e.uiHints)?.order??50,f=Se([h[0]],e.uiHints)?.order??50;return d!==f?d-f:g[0].localeCompare(h[0])}).filter(([g,h])=>!(o&&g!==o||a&&!Cp(g,h,a)));let p=null;if(o&&l&&u.length===1){const g=u[0]?.[1];g&&De(g)==="object"&&g.properties&&g.properties[l]&&(p={sectionKey:o,subsectionKey:l,schema:g.properties[l]})}return u.length===0?r`
|
|
1580
1584
|
<div class="config-empty">
|
|
1581
1585
|
<div class="config-empty__icon">${le.search}</div>
|
|
1582
1586
|
<div class="config-empty__text">
|
|
@@ -1588,7 +1592,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1588
1592
|
${p?(()=>{const{sectionKey:g,subsectionKey:h,schema:d}=p,f=Se([g,h],e.uiHints),m=f?.label??d.title??We(h),k=f?.help??d.description??"",S=n[g],w=S&&typeof S=="object"?S[h]:void 0,C=`config-section-${g}-${h}`;return r`
|
|
1589
1593
|
<section class="config-section-card" id=${C}>
|
|
1590
1594
|
<div class="config-section-card__header">
|
|
1591
|
-
<span class="config-section-card__icon">${
|
|
1595
|
+
<span class="config-section-card__icon">${uo(g)}</span>
|
|
1592
1596
|
<div class="config-section-card__titles">
|
|
1593
1597
|
<h3 class="config-section-card__title">${m}</h3>
|
|
1594
1598
|
${k?r`<p class="config-section-card__desc">${k}</p>`:v}
|
|
@@ -1598,10 +1602,10 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1598
1602
|
${je({schema:d,value:w,path:[g,h],hints:e.uiHints,unsupported:s,disabled:e.disabled??!1,showLabel:!1,onPatch:e.onPatch})}
|
|
1599
1603
|
</div>
|
|
1600
1604
|
</section>
|
|
1601
|
-
`})():u.map(([g,h])=>{const d=
|
|
1605
|
+
`})():u.map(([g,h])=>{const d=Wi[g]??{label:g.charAt(0).toUpperCase()+g.slice(1),description:h.description??""};return r`
|
|
1602
1606
|
<section class="config-section-card" id="config-section-${g}">
|
|
1603
1607
|
<div class="config-section-card__header">
|
|
1604
|
-
<span class="config-section-card__icon">${
|
|
1608
|
+
<span class="config-section-card__icon">${uo(g)}</span>
|
|
1605
1609
|
<div class="config-section-card__titles">
|
|
1606
1610
|
<h3 class="config-section-card__title">${d.label}</h3>
|
|
1607
1611
|
${d.description?r`<p class="config-section-card__desc">${d.description}</p>`:v}
|
|
@@ -1613,29 +1617,29 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1613
1617
|
</section>
|
|
1614
1618
|
`})}
|
|
1615
1619
|
</div>
|
|
1616
|
-
`}const
|
|
1620
|
+
`}const _p=new Set(["title","description","default","nullable"]);function Ep(e){return Object.keys(e??{}).filter(n=>!_p.has(n)).length===0}function ul(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 gl(e){return!e||typeof e!="object"?{schema:null,unsupportedPaths:["<root>"]}:Vt(e,[])}function Vt(e,t){const n=new Set,s={...e},i=as(t)||"<root>";if(e.anyOf||e.oneOf||e.allOf){const l=Lp(e,t);return l||{schema:e,unsupportedPaths:[i]}}const a=Array.isArray(e.type)&&e.type.includes("null"),o=De(e)??(e.properties||e.additionalProperties?"object":void 0);if(s.type=o??e.type,s.nullable=a||e.nullable,s.enum){const{enumValues:l,nullable:c}=ul(s.enum);s.enum=l,c&&(s.nullable=!0),l.length===0&&n.add(i)}if(o==="object"){const l=e.properties??{},c={};for(const[u,p]of Object.entries(l)){const g=Vt(p,[...t,u]);g.schema&&(c[u]=g.schema);for(const h of g.unsupportedPaths)n.add(h)}if(s.properties=c,e.additionalProperties===!0)n.add(i);else if(e.additionalProperties===!1)s.additionalProperties=!1;else if(e.additionalProperties&&typeof e.additionalProperties=="object"&&!Ep(e.additionalProperties)){const u=Vt(e.additionalProperties,[...t,"*"]);s.additionalProperties=u.schema??e.additionalProperties,u.unsupportedPaths.length>0&&n.add(i)}}else if(o==="array"){const l=Array.isArray(e.items)?e.items[0]:e.items;if(!l)n.add(i);else{const c=Vt(l,[...t,"*"]);s.items=c.schema??l,c.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 Lp(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 l of n){if(!l||typeof l!="object")return null;if(Array.isArray(l.enum)){const{enumValues:c,nullable:u}=ul(l.enum);s.push(...c),u&&(a=!0);continue}if("const"in l){if(l.const==null){a=!0;continue}s.push(l.const);continue}if(De(l)==="null"){a=!0;continue}i.push(l)}if(s.length>0&&i.length===0){const l=[];for(const c of s)l.some(u=>Object.is(u,c))||l.push(c);return{schema:{...e,enum:l,nullable:a,anyOf:void 0,oneOf:void 0,allOf:void 0},unsupportedPaths:[]}}if(i.length===1){const l=Vt(i[0],t);return l.schema&&(l.schema.nullable=a||l.schema.nullable),l}const o=new Set(["string","number","integer","boolean"]);return i.length>0&&s.length===0&&i.every(l=>l.type&&o.has(String(l.type)))?{schema:{...e,nullable:a},unsupportedPaths:[]}:null}function Mp(e,t){let n=e;for(const s of t){if(!n)return null;const i=De(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 Ip(e,t){const s=(e.channels??{})[t],i=e[t];return(s&&typeof s=="object"?s:null)??(i&&typeof i=="object"?i:null)??{}}const Rp=["groupPolicy","streamMode","dmPolicy"];function Pp(e){if(e==null)return"n/a";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return"n/a"}}function Dp(e){const t=Rp.flatMap(n=>n in e?[[n,e[n]]]:[]);return t.length===0?null:r`
|
|
1617
1621
|
<div class="status-list" style="margin-top: 12px;">
|
|
1618
1622
|
${t.map(([n,s])=>r`
|
|
1619
1623
|
<div>
|
|
1620
1624
|
<span class="label">${n}</span>
|
|
1621
|
-
<span>${
|
|
1625
|
+
<span>${Pp(s)}</span>
|
|
1622
1626
|
</div>
|
|
1623
1627
|
`)}
|
|
1624
1628
|
</div>
|
|
1625
|
-
`}function
|
|
1629
|
+
`}function Fp(e){const t=gl(e.schema),n=t.schema;if(!n)return r`
|
|
1626
1630
|
<div class="callout danger">Schema unavailable. Use Raw.</div>
|
|
1627
|
-
`;const s=
|
|
1631
|
+
`;const s=Mp(n,["channels",e.channelId]);if(!s)return r`
|
|
1628
1632
|
<div class="callout danger">Channel config schema unavailable.</div>
|
|
1629
|
-
`;const i=e.configValue??{},a=
|
|
1633
|
+
`;const i=e.configValue??{},a=Ip(i,e.channelId);return r`
|
|
1630
1634
|
<div class="config-form">
|
|
1631
1635
|
${je({schema:s,value:a,path:["channels",e.channelId],hints:e.uiHints,unsupported:new Set(t.unsupportedPaths),disabled:e.disabled,showLabel:!1,onPatch:e.onPatch})}
|
|
1632
1636
|
</div>
|
|
1633
|
-
${
|
|
1637
|
+
${Dp(a)}
|
|
1634
1638
|
`}function qe(e){const{channelId:t,props:n}=e,s=n.configSaving||n.configSchemaLoading;return r`
|
|
1635
1639
|
<div style="margin-top: 16px;">
|
|
1636
1640
|
${n.configSchemaLoading?r`
|
|
1637
1641
|
<div class="muted">Loading config schema…</div>
|
|
1638
|
-
`:
|
|
1642
|
+
`:Fp({channelId:t,configValue:n.configForm,schema:n.configSchema,uiHints:n.configUiHints,disabled:s,onPatch:n.onConfigPatch})}
|
|
1639
1643
|
<div class="row" style="margin-top: 12px;">
|
|
1640
1644
|
<button
|
|
1641
1645
|
class="btn primary"
|
|
@@ -1653,7 +1657,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1653
1657
|
</button>
|
|
1654
1658
|
</div>
|
|
1655
1659
|
</div>
|
|
1656
|
-
`}function
|
|
1660
|
+
`}function Np(e){const{props:t,discord:n,accountCountLabel:s}=e;return r`
|
|
1657
1661
|
<div class="card">
|
|
1658
1662
|
<div class="card-title">Discord</div>
|
|
1659
1663
|
<div class="card-sub">Bot status and channel configuration.</div>
|
|
@@ -1695,7 +1699,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1695
1699
|
</button>
|
|
1696
1700
|
</div>
|
|
1697
1701
|
</div>
|
|
1698
|
-
`}function
|
|
1702
|
+
`}function Op(e){const{props:t,googleChat:n,accountCountLabel:s}=e;return r`
|
|
1699
1703
|
<div class="card">
|
|
1700
1704
|
<div class="card-title">Google Chat</div>
|
|
1701
1705
|
<div class="card-sub">Chat API webhook status and channel configuration.</div>
|
|
@@ -1747,7 +1751,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1747
1751
|
</button>
|
|
1748
1752
|
</div>
|
|
1749
1753
|
</div>
|
|
1750
|
-
`}function
|
|
1754
|
+
`}function Bp(e){const{props:t,imessage:n,accountCountLabel:s}=e;return r`
|
|
1751
1755
|
<div class="card">
|
|
1752
1756
|
<div class="card-title">iMessage</div>
|
|
1753
1757
|
<div class="card-sub">macOS bridge status and channel configuration.</div>
|
|
@@ -1789,7 +1793,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1789
1793
|
</button>
|
|
1790
1794
|
</div>
|
|
1791
1795
|
</div>
|
|
1792
|
-
`}function
|
|
1796
|
+
`}function go(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:"n/a"}function Up(e){const{props:t,nostr:n,nostrAccounts:s,accountCountLabel:i,profileFormState:a,profileFormCallbacks:o,onEditProfile:l}=e,c=s[0],u=n?.configured??c?.configured??!1,p=n?.running??c?.running??!1,g=n?.publicKey??c?.publicKey,h=n?.lastStartAt??c?.lastStartAt??null,d=n?.lastError??c?.lastError??null,f=s.length>1,m=a!=null,k=w=>{const C=w.publicKey,A=w.profile,_=A?.displayName??A?.name??w.name??w.accountId;return r`
|
|
1793
1797
|
<div class="account-card">
|
|
1794
1798
|
<div class="account-card-header">
|
|
1795
1799
|
<div class="account-card-title">${_}</div>
|
|
@@ -1806,7 +1810,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1806
1810
|
</div>
|
|
1807
1811
|
<div>
|
|
1808
1812
|
<span class="label">Public Key</span>
|
|
1809
|
-
<span class="monospace" title="${C??""}">${
|
|
1813
|
+
<span class="monospace" title="${C??""}">${go(C)}</span>
|
|
1810
1814
|
</div>
|
|
1811
1815
|
<div>
|
|
1812
1816
|
<span class="label">Last inbound</span>
|
|
@@ -1817,7 +1821,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1817
1821
|
`:v}
|
|
1818
1822
|
</div>
|
|
1819
1823
|
</div>
|
|
1820
|
-
`},S=()=>{if(m&&o)return
|
|
1824
|
+
`},S=()=>{if(m&&o)return _c({state:a,callbacks:o,accountId:s[0]?.accountId??"default"});const w=c?.profile??n?.profile,{name:C,displayName:A,about:_,picture:T,nip05:I}=w??{},z=C||A||_||T||I;return r`
|
|
1821
1825
|
<div style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
|
|
1822
1826
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;">
|
|
1823
1827
|
<div style="font-weight: 500;">Profile</div>
|
|
@@ -1877,7 +1881,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1877
1881
|
<div>
|
|
1878
1882
|
<span class="label">Public Key</span>
|
|
1879
1883
|
<span class="monospace" title="${g??""}"
|
|
1880
|
-
>${
|
|
1884
|
+
>${go(g)}</span
|
|
1881
1885
|
>
|
|
1882
1886
|
</div>
|
|
1883
1887
|
<div>
|
|
@@ -1897,7 +1901,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1897
1901
|
<button class="btn" @click=${()=>t.onRefresh(!1)}>Refresh</button>
|
|
1898
1902
|
</div>
|
|
1899
1903
|
</div>
|
|
1900
|
-
`}function
|
|
1904
|
+
`}function zp(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 Hp(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,l=typeof i?.connected=="boolean"&&i.connected,u=(n.channelAccounts?.[e]??[]).some(p=>p.configured||p.running||p.connected);return a||o||l||u}function Kp(e,t){return t?.[e]?.length??0}function pl(e,t){const n=Kp(e,t);return n<2?v:r`<div class="account-count">Accounts (${n})</div>`}function jp(e){const{props:t,signal:n,accountCountLabel:s}=e;return r`
|
|
1901
1905
|
<div class="card">
|
|
1902
1906
|
<div class="card-title">Signal</div>
|
|
1903
1907
|
<div class="card-sub">signal-cli status and channel configuration.</div>
|
|
@@ -1943,7 +1947,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1943
1947
|
</button>
|
|
1944
1948
|
</div>
|
|
1945
1949
|
</div>
|
|
1946
|
-
`}function
|
|
1950
|
+
`}function Wp(e){const{props:t,slack:n,accountCountLabel:s}=e;return r`
|
|
1947
1951
|
<div class="card">
|
|
1948
1952
|
<div class="card-title">Slack</div>
|
|
1949
1953
|
<div class="card-sub">Socket mode status and channel configuration.</div>
|
|
@@ -1985,7 +1989,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
1985
1989
|
</button>
|
|
1986
1990
|
</div>
|
|
1987
1991
|
</div>
|
|
1988
|
-
`}function
|
|
1992
|
+
`}function qp(e){const{props:t,telegram:n,telegramAccounts:s,accountCountLabel:i}=e,a=s.length>1,o=l=>{const u=l.probe?.bot?.username,p=l.name||l.accountId;return r`
|
|
1989
1993
|
<div class="account-card">
|
|
1990
1994
|
<div class="account-card-header">
|
|
1991
1995
|
<div class="account-card-title">
|
|
@@ -2065,7 +2069,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
2065
2069
|
</button>
|
|
2066
2070
|
</div>
|
|
2067
2071
|
</div>
|
|
2068
|
-
`}function
|
|
2072
|
+
`}function Gp(e){const{props:t,whatsapp:n,accountCountLabel:s}=e;return r`
|
|
2069
2073
|
<div class="card">
|
|
2070
2074
|
<div class="card-title">WhatsApp</div>
|
|
2071
2075
|
<div class="card-sub">Link WhatsApp Web and monitor connection health.</div>
|
|
@@ -2103,7 +2107,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
2103
2107
|
<div>
|
|
2104
2108
|
<span class="label">Auth age</span>
|
|
2105
2109
|
<span>
|
|
2106
|
-
${n?.authAgeMs!=null?
|
|
2110
|
+
${n?.authAgeMs!=null?zp(n.authAgeMs):"n/a"}
|
|
2107
2111
|
</span>
|
|
2108
2112
|
</div>
|
|
2109
2113
|
</div>
|
|
@@ -2156,9 +2160,9 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
2156
2160
|
|
|
2157
2161
|
${qe({channelId:"whatsapp",props:t})}
|
|
2158
2162
|
</div>
|
|
2159
|
-
`}function
|
|
2163
|
+
`}function Vp(e){const t=e.snapshot?.channels,n=t?.whatsapp??void 0,s=t?.telegram??void 0,i=t?.discord??null,a=t?.googlechat??null,o=t?.slack??null,l=t?.signal??null,c=t?.imessage??null,u=t?.nostr??null,g=Qp(e.snapshot).map((h,d)=>({key:h,enabled:Hp(h,e),order:d})).toSorted((h,d)=>h.enabled!==d.enabled?h.enabled?-1:1:h.order-d.order);return r`
|
|
2160
2164
|
<section class="grid grid-cols-2">
|
|
2161
|
-
${g.map(h=>
|
|
2165
|
+
${g.map(h=>Yp(h.key,e,{whatsapp:n,telegram:s,discord:i,googlechat:a,slack:o,signal:l,imessage:c,nostr:u,channelAccounts:e.snapshot?.channelAccounts??null}))}
|
|
2162
2166
|
</section>
|
|
2163
2167
|
|
|
2164
2168
|
<section class="card" style="margin-top: 18px;">
|
|
@@ -2176,7 +2180,7 @@ Deletes the session entry and archives its transcript.`))){e.sessionsLoading=!0,
|
|
|
2176
2180
|
${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
2177
2181
|
</pre>
|
|
2178
2182
|
</section>
|
|
2179
|
-
`}function
|
|
2183
|
+
`}function Qp(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 Yp(e,t,n){const s=pl(e,n.channelAccounts);switch(e){case"whatsapp":return Gp({props:t,whatsapp:n.whatsapp,accountCountLabel:s});case"telegram":return qp({props:t,telegram:n.telegram,telegramAccounts:n.channelAccounts?.telegram??[],accountCountLabel:s});case"discord":return Np({props:t,discord:n.discord,accountCountLabel:s});case"googlechat":return Op({props:t,googleChat:n.googlechat,accountCountLabel:s});case"slack":return Wp({props:t,slack:n.slack,accountCountLabel:s});case"signal":return jp({props:t,signal:n.signal,accountCountLabel:s});case"imessage":return Bp({props:t,imessage:n.imessage,accountCountLabel:s});case"nostr":{const i=n.channelAccounts?.nostr??[],a=i[0],o=a?.accountId??"default",l=a?.profile??null,c=t.nostrProfileAccountId===o?t.nostrProfileFormState:null,u=c?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return Up({props:t,nostr:n.nostr,nostrAccounts:i,accountCountLabel:s,profileFormState:c,profileFormCallbacks:u,onEditProfile:()=>t.onNostrProfileEdit(o,l)})}default:return Zp(e,t,n.channelAccounts??{})}}function Zp(e,t,n){const s=Xp(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,l=typeof i?.connected=="boolean"?i.connected:void 0,c=typeof i?.lastError=="string"?i.lastError:void 0,u=n[e]??[],p=pl(e,n);return r`
|
|
2180
2184
|
<div class="card">
|
|
2181
2185
|
<div class="card-title">${s}</div>
|
|
2182
2186
|
<div class="card-sub">Channel status and configuration.</div>
|
|
@@ -2184,7 +2188,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2184
2188
|
|
|
2185
2189
|
${u.length>0?r`
|
|
2186
2190
|
<div class="account-card-list">
|
|
2187
|
-
${u.map(g=>
|
|
2191
|
+
${u.map(g=>sf(g))}
|
|
2188
2192
|
</div>
|
|
2189
2193
|
`:r`
|
|
2190
2194
|
<div class="status-list" style="margin-top: 16px;">
|
|
@@ -2209,7 +2213,7 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2209
2213
|
|
|
2210
2214
|
${qe({channelId:e,props:t})}
|
|
2211
2215
|
</div>
|
|
2212
|
-
`}function
|
|
2216
|
+
`}function Jp(e){return e?.channelMeta?.length?Object.fromEntries(e.channelMeta.map(t=>[t.id,t])):{}}function Xp(e,t){return Jp(e)[t]?.label??e?.channelLabels?.[t]??t}const ef=600*1e3;function fl(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<ef:!1}function tf(e){return e.running?"Yes":fl(e)?"Active":"No"}function nf(e){return e.connected===!0?"Yes":e.connected===!1?"No":fl(e)?"Active":"n/a"}function sf(e){const t=tf(e),n=nf(e);return r`
|
|
2213
2217
|
<div class="account-card">
|
|
2214
2218
|
<div class="account-card-header">
|
|
2215
2219
|
<div class="account-card-title">${e.name||e.accountId}</div>
|
|
@@ -2239,12 +2243,12 @@ ${e.snapshot?JSON.stringify(e.snapshot,null,2):"No snapshot yet."}
|
|
|
2239
2243
|
`:v}
|
|
2240
2244
|
</div>
|
|
2241
2245
|
</div>
|
|
2242
|
-
`}const Qt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Qt(s,t);return!0},zn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},vl=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),af(t)}};function nf(e){this._$AN!==void 0?(zn(this),this._$AM=e,vl(this)):this._$AM=e}function sf(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++)Qt(s[a],!1),zn(s[a]);else s!=null&&(Qt(s,!1),zn(s));else Qt(this,e)}const af=e=>{e.type==Ki.CHILD&&(e._$AP??=sf,e._$AQ??=nf)};class of extends Wi{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),vl(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Qt(this,t),zn(this))}setValue(t){if(vg(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 Rs=new WeakMap,rf=ji(class extends of{render(e){return v}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)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Rs.get(t);n===void 0&&(n=new WeakMap,Rs.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"?Rs.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class li extends Wi{constructor(t){if(super(t),this.it=v,t.type!==Ki.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this._t=void 0,this.it=t;if(t===Qe)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:[]}}}li.directiveName="unsafeHTML",li.resultType=1;const ci=ji(li);const{entries:ml,setPrototypeOf:ho,isFrozen:lf,getPrototypeOf:cf,getOwnPropertyDescriptor:df}=Object;let{freeze:ve,seal:Ae,create:di}=Object,{apply:ui,construct:gi}=typeof Reflect<"u"&&Reflect;ve||(ve=function(t){return t});Ae||(Ae=function(t){return t});ui||(ui=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)});gi||(gi=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 kn=me(Array.prototype.forEach),uf=me(Array.prototype.lastIndexOf),vo=me(Array.prototype.pop),Ft=me(Array.prototype.push),gf=me(Array.prototype.splice),Pn=me(String.prototype.toLowerCase),Ps=me(String.prototype.toString),Ds=me(String.prototype.match),Nt=me(String.prototype.replace),pf=me(String.prototype.indexOf),ff=me(String.prototype.trim),Ce=me(Object.prototype.hasOwnProperty),fe=me(RegExp.prototype.test),Ot=hf(TypeError);function me(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 ui(e,t,s)}}function hf(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return gi(e,n)}}function j(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pn;ho&&ho(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(lf(t)||(t[s]=a),i=a)}e[i]=!0}return e}function vf(e){for(let t=0;t<e.length;t++)Ce(e,t)||(e[t]=null);return e}function Re(e){const t=di(null);for(const[n,s]of ml(e))Ce(e,n)&&(Array.isArray(s)?t[n]=vf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Re(s):t[n]=s);return t}function Bt(e,t){for(;e!==null;){const s=df(e,t);if(s){if(s.get)return me(s.get);if(typeof s.value=="function")return me(s.value)}e=cf(e)}function n(){return null}return n}const mo=ve(["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"]),Fs=ve(["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"]),Ns=ve(["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"]),mf=ve(["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"]),Os=ve(["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"]),bf=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bo=ve(["#text"]),yo=ve(["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"]),Bs=ve(["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"]),xo=ve(["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"]),Sn=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yf=Ae(/\{\{[\w\W]*|[\w\W]*\}\}/gm),xf=Ae(/<%[\w\W]*|[\w\W]*%>/gm),$f=Ae(/\$\{[\w\W]*/gm),wf=Ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),kf=Ae(/^aria-[\-\w]+$/),bl=Ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sf=Ae(/^(?:\w+script|data):/i),Af=Ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yl=Ae(/^html$/i),Cf=Ae(/^[a-z][.\w]*(-[.\w]+)+$/i);var $o=Object.freeze({__proto__:null,ARIA_ATTR:kf,ATTR_WHITESPACE:Af,CUSTOM_ELEMENT:Cf,DATA_ATTR:wf,DOCTYPE_NAME:yl,ERB_EXPR:xf,IS_ALLOWED_URI:bl,IS_SCRIPT_OR_DATA:Sf,MUSTACHE_EXPR:yf,TMPLIT_EXPR:$f});const Ut={element:1,text:3,progressingInstruction:7,comment:8,document:9},Tf=function(){return typeof window>"u"?null:window},_f=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}},wo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tf();const t=U=>xl(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ut.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:h,trustedTypes:d}=e,f=c.prototype,m=Bt(f,"cloneNode"),k=Bt(f,"remove"),S=Bt(f,"nextSibling"),w=Bt(f,"childNodes"),C=Bt(f,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let A,_="";const{implementation:T,createNodeIterator:I,createDocumentFragment:z,getElementsByTagName:Y}=n,{importNode:se}=s;let F=wo();t.isSupported=typeof ml=="function"&&typeof C=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:ce,TMPLIT_EXPR:E,DATA_ATTR:B,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:J,CUSTOM_ELEMENT:te}=$o;let{IS_ALLOWED_URI:M}=$o,R=null;const P=j({},[...mo,...Fs,...Ns,...Os,...bo]);let K=null;const xe=j({},[...yo,...Bs,...xo,...Sn]);let Q=Object.seal(di(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}})),we=null,X=null;const pe=Object.seal(di(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ne=!0,Je=!1,la=!0,yt=!1,dn=!0,Xe=!1,ds=!1,us=!1,xt=!1,un=!1,gn=!1,ca=!0,da=!1;const Hl="user-content-";let gs=!0,It=!1,$t={},Le=null;const ps=j({},["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 ua=null;const ga=j({},["audio","video","img","source","image","track"]);let fs=null;const pa=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let wt=Oe,hs=!1,vs=null;const Kl=j({},[pn,fn,Oe],Ps);let hn=j({},["mi","mo","mn","ms","mtext"]),vn=j({},["annotation-xml"]);const jl=j({},["title","style","font","a","script"]);let Rt=null;const Wl=["application/xhtml+xml","text/html"],ql="text/html";let ne=null,kt=null;const Gl=n.createElement("form"),fa=function(b){return b instanceof RegExp||b instanceof Function},ms=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(kt&&kt===b)){if((!b||typeof b!="object")&&(b={}),b=Re(b),Rt=Wl.indexOf(b.PARSER_MEDIA_TYPE)===-1?ql:b.PARSER_MEDIA_TYPE,ne=Rt==="application/xhtml+xml"?Ps:Pn,R=Ce(b,"ALLOWED_TAGS")?j({},b.ALLOWED_TAGS,ne):P,K=Ce(b,"ALLOWED_ATTR")?j({},b.ALLOWED_ATTR,ne):xe,vs=Ce(b,"ALLOWED_NAMESPACES")?j({},b.ALLOWED_NAMESPACES,Ps):Kl,fs=Ce(b,"ADD_URI_SAFE_ATTR")?j(Re(pa),b.ADD_URI_SAFE_ATTR,ne):pa,ua=Ce(b,"ADD_DATA_URI_TAGS")?j(Re(ga),b.ADD_DATA_URI_TAGS,ne):ga,Le=Ce(b,"FORBID_CONTENTS")?j({},b.FORBID_CONTENTS,ne):ps,we=Ce(b,"FORBID_TAGS")?j({},b.FORBID_TAGS,ne):Re({}),X=Ce(b,"FORBID_ATTR")?j({},b.FORBID_ATTR,ne):Re({}),$t=Ce(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fe=b.ALLOW_ARIA_ATTR!==!1,Ne=b.ALLOW_DATA_ATTR!==!1,Je=b.ALLOW_UNKNOWN_PROTOCOLS||!1,la=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,yt=b.SAFE_FOR_TEMPLATES||!1,dn=b.SAFE_FOR_XML!==!1,Xe=b.WHOLE_DOCUMENT||!1,xt=b.RETURN_DOM||!1,un=b.RETURN_DOM_FRAGMENT||!1,gn=b.RETURN_TRUSTED_TYPE||!1,us=b.FORCE_BODY||!1,ca=b.SANITIZE_DOM!==!1,da=b.SANITIZE_NAMED_PROPS||!1,gs=b.KEEP_CONTENT!==!1,It=b.IN_PLACE||!1,M=b.ALLOWED_URI_REGEXP||bl,wt=b.NAMESPACE||Oe,hn=b.MATHML_TEXT_INTEGRATION_POINTS||hn,vn=b.HTML_INTEGRATION_POINTS||vn,Q=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&fa(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&fa(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),yt&&(Ne=!1),un&&(xt=!0),$t&&(R=j({},bo),K=[],$t.html===!0&&(j(R,mo),j(K,yo)),$t.svg===!0&&(j(R,Fs),j(K,Bs),j(K,Sn)),$t.svgFilters===!0&&(j(R,Ns),j(K,Bs),j(K,Sn)),$t.mathMl===!0&&(j(R,Os),j(K,xo),j(K,Sn))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?pe.tagCheck=b.ADD_TAGS:(R===P&&(R=Re(R)),j(R,b.ADD_TAGS,ne))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?pe.attributeCheck=b.ADD_ATTR:(K===xe&&(K=Re(K)),j(K,b.ADD_ATTR,ne))),b.ADD_URI_SAFE_ATTR&&j(fs,b.ADD_URI_SAFE_ATTR,ne),b.FORBID_CONTENTS&&(Le===ps&&(Le=Re(Le)),j(Le,b.FORBID_CONTENTS,ne)),b.ADD_FORBID_CONTENTS&&(Le===ps&&(Le=Re(Le)),j(Le,b.ADD_FORBID_CONTENTS,ne)),gs&&(R["#text"]=!0),Xe&&j(R,["html","head","body"]),R.table&&(j(R,["tbody"]),delete we.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ot('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ot('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=b.TRUSTED_TYPES_POLICY,_=A.createHTML("")}else A===void 0&&(A=_f(d,i)),A!==null&&typeof _=="string"&&(_=A.createHTML(""));ve&&ve(b),kt=b}},ha=j({},[...Fs,...Ns,...mf]),va=j({},[...Os,...bf]),Vl=function(b){let L=C(b);(!L||!L.tagName)&&(L={namespaceURI:wt,tagName:"template"});const N=Pn(b.tagName),Z=Pn(L.tagName);return vs[b.namespaceURI]?b.namespaceURI===fn?L.namespaceURI===Oe?N==="svg":L.namespaceURI===pn?N==="svg"&&(Z==="annotation-xml"||hn[Z]):!!ha[N]:b.namespaceURI===pn?L.namespaceURI===Oe?N==="math":L.namespaceURI===fn?N==="math"&&vn[Z]:!!va[N]:b.namespaceURI===Oe?L.namespaceURI===fn&&!vn[Z]||L.namespaceURI===pn&&!hn[Z]?!1:!va[N]&&(jl[N]||!ha[N]):!!(Rt==="application/xhtml+xml"&&vs[b.namespaceURI]):!1},Me=function(b){Ft(t.removed,{element:b});try{C(b).removeChild(b)}catch{k(b)}},et=function(b,L){try{Ft(t.removed,{attribute:L.getAttributeNode(b),from:L})}catch{Ft(t.removed,{attribute:null,from:L})}if(L.removeAttribute(b),b==="is")if(xt||un)try{Me(L)}catch{}else try{L.setAttribute(b,"")}catch{}},ma=function(b){let L=null,N=null;if(us)b="<remove></remove>"+b;else{const ee=Ds(b,/^[\r\n\t ]+/);N=ee&&ee[0]}Rt==="application/xhtml+xml"&&wt===Oe&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const Z=A?A.createHTML(b):b;if(wt===Oe)try{L=new h().parseFromString(Z,Rt)}catch{}if(!L||!L.documentElement){L=T.createDocument(wt,"template",null);try{L.documentElement.innerHTML=hs?_:Z}catch{}}const de=L.body||L.documentElement;return b&&N&&de.insertBefore(n.createTextNode(N),de.childNodes[0]||null),wt===Oe?Y.call(L,Xe?"html":"body")[0]:Xe?L.documentElement:de},ba=function(b){return I.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},bs=function(b){return b instanceof g&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof p)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},ya=function(b){return typeof l=="function"&&b instanceof l};function Be(U,b,L){kn(U,N=>{N.call(t,b,L,kt)})}const xa=function(b){let L=null;if(Be(F.beforeSanitizeElements,b,null),bs(b))return Me(b),!0;const N=ne(b.nodeName);if(Be(F.uponSanitizeElement,b,{tagName:N,allowedTags:R}),dn&&b.hasChildNodes()&&!ya(b.firstElementChild)&&fe(/<[/\w!]/g,b.innerHTML)&&fe(/<[/\w!]/g,b.textContent)||b.nodeType===Ut.progressingInstruction||dn&&b.nodeType===Ut.comment&&fe(/<[/\w]/g,b.data))return Me(b),!0;if(!(pe.tagCheck instanceof Function&&pe.tagCheck(N))&&(!R[N]||we[N])){if(!we[N]&&wa(N)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N)))return!1;if(gs&&!Le[N]){const Z=C(b)||b.parentNode,de=w(b)||b.childNodes;if(de&&Z){const ee=de.length;for(let be=ee-1;be>=0;--be){const Ue=m(de[be],!0);Ue.__removalCount=(b.__removalCount||0)+1,Z.insertBefore(Ue,S(b))}}}return Me(b),!0}return b instanceof c&&!Vl(b)||(N==="noscript"||N==="noembed"||N==="noframes")&&fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Me(b),!0):(yt&&b.nodeType===Ut.text&&(L=b.textContent,kn([H,ce,E],Z=>{L=Nt(L,Z," ")}),b.textContent!==L&&(Ft(t.removed,{element:b.cloneNode()}),b.textContent=L)),Be(F.afterSanitizeElements,b,null),!1)},$a=function(b,L,N){if(ca&&(L==="id"||L==="name")&&(N in n||N in Gl))return!1;if(!(Ne&&!X[L]&&fe(B,L))){if(!(Fe&&fe(ie,L))){if(!(pe.attributeCheck instanceof Function&&pe.attributeCheck(L,b))){if(!K[L]||X[L]){if(!(wa(b)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))&&(Q.attributeNameCheck instanceof RegExp&&fe(Q.attributeNameCheck,L)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(L,b))||L==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N))))return!1}else if(!fs[L]){if(!fe(M,Nt(N,J,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&b!=="script"&&pf(N,"data:")===0&&ua[b])){if(!(Je&&!fe(ae,Nt(N,J,"")))){if(N)return!1}}}}}}}return!0},wa=function(b){return b!=="annotation-xml"&&Ds(b,te)},ka=function(b){Be(F.beforeSanitizeAttributes,b,null);const{attributes:L}=b;if(!L||bs(b))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let Z=L.length;for(;Z--;){const de=L[Z],{name:ee,namespaceURI:be,value:Ue}=de,St=ne(ee),ys=Ue;let re=ee==="value"?ys:ff(ys);if(N.attrName=St,N.attrValue=re,N.keepAttr=!0,N.forceKeepAttr=void 0,Be(F.uponSanitizeAttribute,b,N),re=N.attrValue,da&&(St==="id"||St==="name")&&(et(ee,b),re=Hl+re),dn&&fe(/((--!?|])>)|<\/(style|title|textarea)/i,re)){et(ee,b);continue}if(St==="attributename"&&Ds(re,"href")){et(ee,b);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){et(ee,b);continue}if(!la&&fe(/\/>/i,re)){et(ee,b);continue}yt&&kn([H,ce,E],Aa=>{re=Nt(re,Aa," ")});const Sa=ne(b.nodeName);if(!$a(Sa,St,re)){et(ee,b);continue}if(A&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(Sa,St)){case"TrustedHTML":{re=A.createHTML(re);break}case"TrustedScriptURL":{re=A.createScriptURL(re);break}}if(re!==ys)try{be?b.setAttributeNS(be,ee,re):b.setAttribute(ee,re),bs(b)?Me(b):vo(t.removed)}catch{et(ee,b)}}Be(F.afterSanitizeAttributes,b,null)},Ql=function U(b){let L=null;const N=ba(b);for(Be(F.beforeSanitizeShadowDOM,b,null);L=N.nextNode();)Be(F.uponSanitizeShadowNode,L,null),xa(L),ka(L),L.content instanceof a&&U(L.content);Be(F.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,N=null,Z=null,de=null;if(hs=!U,hs&&(U="<!-->"),typeof U!="string"&&!ya(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Ot("dirty is not a string, aborting")}else throw Ot("toString is not a function");if(!t.isSupported)return U;if(ds||ms(b),t.removed=[],typeof U=="string"&&(It=!1),It){if(U.nodeName){const Ue=ne(U.nodeName);if(!R[Ue]||we[Ue])throw Ot("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)L=ma("<!---->"),N=L.ownerDocument.importNode(U,!0),N.nodeType===Ut.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?L=N:L.appendChild(N);else{if(!xt&&!yt&&!Xe&&U.indexOf("<")===-1)return A&&gn?A.createHTML(U):U;if(L=ma(U),!L)return xt?null:gn?_:""}L&&us&&Me(L.firstChild);const ee=ba(It?U:L);for(;Z=ee.nextNode();)xa(Z),ka(Z),Z.content instanceof a&&Ql(Z.content);if(It)return U;if(xt){if(un)for(de=z.call(L.ownerDocument);L.firstChild;)de.appendChild(L.firstChild);else de=L;return(K.shadowroot||K.shadowrootmode)&&(de=se.call(s,de,!0)),de}let be=Xe?L.outerHTML:L.innerHTML;return Xe&&R["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&fe(yl,L.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
|
|
2243
|
-
`+be),yt&&
|
|
2244
|
-
]`).replace("lheading",
|
|
2246
|
+
`}const Qt=(e,t)=>{const n=e._$AN;if(n===void 0)return!1;for(const s of n)s._$AO?.(t,!1),Qt(s,t);return!0},Un=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},hl=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),rf(t)}};function af(e){this._$AN!==void 0?(Un(this),this._$AM=e,hl(this)):this._$AM=e}function of(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++)Qt(s[a],!1),Un(s[a]);else s!=null&&(Qt(s,!1),Un(s));else Qt(this,e)}const rf=e=>{e.type==zi.CHILD&&(e._$AP??=of,e._$AQ??=af)};class lf extends Ki{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,s){super._$AT(t,n,s),hl(this),this.isConnected=t._$AU}_$AO(t,n=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),n&&(Qt(this,t),Un(this))}setValue(t){if(hg(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 Is=new WeakMap,cf=Hi(class extends lf{render(e){return v}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)),v}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=Is.get(t);n===void 0&&(n=new WeakMap,Is.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"?Is.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class oi extends Ki{constructor(t){if(super(t),this.it=v,t.type!==zi.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this._t=void 0,this.it=t;if(t===Qe)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:[]}}}oi.directiveName="unsafeHTML",oi.resultType=1;const ri=Hi(oi);const{entries:vl,setPrototypeOf:po,isFrozen:df,getPrototypeOf:uf,getOwnPropertyDescriptor:gf}=Object;let{freeze:ve,seal:Ae,create:li}=Object,{apply:ci,construct:di}=typeof Reflect<"u"&&Reflect;ve||(ve=function(t){return t});Ae||(Ae=function(t){return t});ci||(ci=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)});di||(di=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 wn=me(Array.prototype.forEach),pf=me(Array.prototype.lastIndexOf),fo=me(Array.prototype.pop),Ft=me(Array.prototype.push),ff=me(Array.prototype.splice),Rn=me(String.prototype.toLowerCase),Rs=me(String.prototype.toString),Ps=me(String.prototype.match),Nt=me(String.prototype.replace),hf=me(String.prototype.indexOf),vf=me(String.prototype.trim),Ce=me(Object.prototype.hasOwnProperty),fe=me(RegExp.prototype.test),Ot=mf(TypeError);function me(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 ci(e,t,s)}}function mf(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return di(e,n)}}function j(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rn;po&&po(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const a=n(i);a!==i&&(df(t)||(t[s]=a),i=a)}e[i]=!0}return e}function bf(e){for(let t=0;t<e.length;t++)Ce(e,t)||(e[t]=null);return e}function Re(e){const t=li(null);for(const[n,s]of vl(e))Ce(e,n)&&(Array.isArray(s)?t[n]=bf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Re(s):t[n]=s);return t}function Bt(e,t){for(;e!==null;){const s=gf(e,t);if(s){if(s.get)return me(s.get);if(typeof s.value=="function")return me(s.value)}e=uf(e)}function n(){return null}return n}const ho=ve(["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"]),Ds=ve(["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"]),Fs=ve(["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"]),yf=ve(["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"]),Ns=ve(["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"]),xf=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vo=ve(["#text"]),mo=ve(["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"]),Os=ve(["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"]),bo=ve(["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"]),kn=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$f=Ae(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wf=Ae(/<%[\w\W]*|[\w\W]*%>/gm),kf=Ae(/\$\{[\w\W]*/gm),Sf=Ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),Af=Ae(/^aria-[\-\w]+$/),ml=Ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Cf=Ae(/^(?:\w+script|data):/i),Tf=Ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bl=Ae(/^html$/i),_f=Ae(/^[a-z][.\w]*(-[.\w]+)+$/i);var yo=Object.freeze({__proto__:null,ARIA_ATTR:Af,ATTR_WHITESPACE:Tf,CUSTOM_ELEMENT:_f,DATA_ATTR:Sf,DOCTYPE_NAME:bl,ERB_EXPR:wf,IS_ALLOWED_URI:ml,IS_SCRIPT_OR_DATA:Cf,MUSTACHE_EXPR:$f,TMPLIT_EXPR:kf});const Ut={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ef=function(){return typeof window>"u"?null:window},Lf=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}},xo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function yl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ef();const t=U=>yl(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ut.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:u,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:h,trustedTypes:d}=e,f=c.prototype,m=Bt(f,"cloneNode"),k=Bt(f,"remove"),S=Bt(f,"nextSibling"),w=Bt(f,"childNodes"),C=Bt(f,"parentNode");if(typeof o=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let A,_="";const{implementation:T,createNodeIterator:I,createDocumentFragment:z,getElementsByTagName:Y}=n,{importNode:se}=s;let F=xo();t.isSupported=typeof vl=="function"&&typeof C=="function"&&T&&T.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:H,ERB_EXPR:ce,TMPLIT_EXPR:E,DATA_ATTR:B,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:J,CUSTOM_ELEMENT:te}=yo;let{IS_ALLOWED_URI:M}=yo,R=null;const P=j({},[...ho,...Ds,...Fs,...Ns,...vo]);let K=null;const xe=j({},[...mo,...Os,...bo,...kn]);let Q=Object.seal(li(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}})),we=null,X=null;const pe=Object.seal(li(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Ne=!0,Je=!1,oa=!0,yt=!1,dn=!0,Xe=!1,cs=!1,ds=!1,xt=!1,un=!1,gn=!1,ra=!0,la=!1;const zl="user-content-";let us=!0,It=!1,$t={},Le=null;const gs=j({},["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 ca=null;const da=j({},["audio","video","img","source","image","track"]);let ps=null;const ua=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pn="http://www.w3.org/1998/Math/MathML",fn="http://www.w3.org/2000/svg",Oe="http://www.w3.org/1999/xhtml";let wt=Oe,fs=!1,hs=null;const Hl=j({},[pn,fn,Oe],Rs);let hn=j({},["mi","mo","mn","ms","mtext"]),vn=j({},["annotation-xml"]);const Kl=j({},["title","style","font","a","script"]);let Rt=null;const jl=["application/xhtml+xml","text/html"],Wl="text/html";let ne=null,kt=null;const ql=n.createElement("form"),ga=function(b){return b instanceof RegExp||b instanceof Function},vs=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(kt&&kt===b)){if((!b||typeof b!="object")&&(b={}),b=Re(b),Rt=jl.indexOf(b.PARSER_MEDIA_TYPE)===-1?Wl:b.PARSER_MEDIA_TYPE,ne=Rt==="application/xhtml+xml"?Rs:Rn,R=Ce(b,"ALLOWED_TAGS")?j({},b.ALLOWED_TAGS,ne):P,K=Ce(b,"ALLOWED_ATTR")?j({},b.ALLOWED_ATTR,ne):xe,hs=Ce(b,"ALLOWED_NAMESPACES")?j({},b.ALLOWED_NAMESPACES,Rs):Hl,ps=Ce(b,"ADD_URI_SAFE_ATTR")?j(Re(ua),b.ADD_URI_SAFE_ATTR,ne):ua,ca=Ce(b,"ADD_DATA_URI_TAGS")?j(Re(da),b.ADD_DATA_URI_TAGS,ne):da,Le=Ce(b,"FORBID_CONTENTS")?j({},b.FORBID_CONTENTS,ne):gs,we=Ce(b,"FORBID_TAGS")?j({},b.FORBID_TAGS,ne):Re({}),X=Ce(b,"FORBID_ATTR")?j({},b.FORBID_ATTR,ne):Re({}),$t=Ce(b,"USE_PROFILES")?b.USE_PROFILES:!1,Fe=b.ALLOW_ARIA_ATTR!==!1,Ne=b.ALLOW_DATA_ATTR!==!1,Je=b.ALLOW_UNKNOWN_PROTOCOLS||!1,oa=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,yt=b.SAFE_FOR_TEMPLATES||!1,dn=b.SAFE_FOR_XML!==!1,Xe=b.WHOLE_DOCUMENT||!1,xt=b.RETURN_DOM||!1,un=b.RETURN_DOM_FRAGMENT||!1,gn=b.RETURN_TRUSTED_TYPE||!1,ds=b.FORCE_BODY||!1,ra=b.SANITIZE_DOM!==!1,la=b.SANITIZE_NAMED_PROPS||!1,us=b.KEEP_CONTENT!==!1,It=b.IN_PLACE||!1,M=b.ALLOWED_URI_REGEXP||ml,wt=b.NAMESPACE||Oe,hn=b.MATHML_TEXT_INTEGRATION_POINTS||hn,vn=b.HTML_INTEGRATION_POINTS||vn,Q=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&ga(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&ga(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),yt&&(Ne=!1),un&&(xt=!0),$t&&(R=j({},vo),K=[],$t.html===!0&&(j(R,ho),j(K,mo)),$t.svg===!0&&(j(R,Ds),j(K,Os),j(K,kn)),$t.svgFilters===!0&&(j(R,Fs),j(K,Os),j(K,kn)),$t.mathMl===!0&&(j(R,Ns),j(K,bo),j(K,kn))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?pe.tagCheck=b.ADD_TAGS:(R===P&&(R=Re(R)),j(R,b.ADD_TAGS,ne))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?pe.attributeCheck=b.ADD_ATTR:(K===xe&&(K=Re(K)),j(K,b.ADD_ATTR,ne))),b.ADD_URI_SAFE_ATTR&&j(ps,b.ADD_URI_SAFE_ATTR,ne),b.FORBID_CONTENTS&&(Le===gs&&(Le=Re(Le)),j(Le,b.FORBID_CONTENTS,ne)),b.ADD_FORBID_CONTENTS&&(Le===gs&&(Le=Re(Le)),j(Le,b.ADD_FORBID_CONTENTS,ne)),us&&(R["#text"]=!0),Xe&&j(R,["html","head","body"]),R.table&&(j(R,["tbody"]),delete we.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ot('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ot('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=b.TRUSTED_TYPES_POLICY,_=A.createHTML("")}else A===void 0&&(A=Lf(d,i)),A!==null&&typeof _=="string"&&(_=A.createHTML(""));ve&&ve(b),kt=b}},pa=j({},[...Ds,...Fs,...yf]),fa=j({},[...Ns,...xf]),Gl=function(b){let L=C(b);(!L||!L.tagName)&&(L={namespaceURI:wt,tagName:"template"});const N=Rn(b.tagName),Z=Rn(L.tagName);return hs[b.namespaceURI]?b.namespaceURI===fn?L.namespaceURI===Oe?N==="svg":L.namespaceURI===pn?N==="svg"&&(Z==="annotation-xml"||hn[Z]):!!pa[N]:b.namespaceURI===pn?L.namespaceURI===Oe?N==="math":L.namespaceURI===fn?N==="math"&&vn[Z]:!!fa[N]:b.namespaceURI===Oe?L.namespaceURI===fn&&!vn[Z]||L.namespaceURI===pn&&!hn[Z]?!1:!fa[N]&&(Kl[N]||!pa[N]):!!(Rt==="application/xhtml+xml"&&hs[b.namespaceURI]):!1},Me=function(b){Ft(t.removed,{element:b});try{C(b).removeChild(b)}catch{k(b)}},et=function(b,L){try{Ft(t.removed,{attribute:L.getAttributeNode(b),from:L})}catch{Ft(t.removed,{attribute:null,from:L})}if(L.removeAttribute(b),b==="is")if(xt||un)try{Me(L)}catch{}else try{L.setAttribute(b,"")}catch{}},ha=function(b){let L=null,N=null;if(ds)b="<remove></remove>"+b;else{const ee=Ps(b,/^[\r\n\t ]+/);N=ee&&ee[0]}Rt==="application/xhtml+xml"&&wt===Oe&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const Z=A?A.createHTML(b):b;if(wt===Oe)try{L=new h().parseFromString(Z,Rt)}catch{}if(!L||!L.documentElement){L=T.createDocument(wt,"template",null);try{L.documentElement.innerHTML=fs?_:Z}catch{}}const de=L.body||L.documentElement;return b&&N&&de.insertBefore(n.createTextNode(N),de.childNodes[0]||null),wt===Oe?Y.call(L,Xe?"html":"body")[0]:Xe?L.documentElement:de},va=function(b){return I.call(b.ownerDocument||b,b,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},ms=function(b){return b instanceof g&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof p)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},ma=function(b){return typeof l=="function"&&b instanceof l};function Be(U,b,L){wn(U,N=>{N.call(t,b,L,kt)})}const ba=function(b){let L=null;if(Be(F.beforeSanitizeElements,b,null),ms(b))return Me(b),!0;const N=ne(b.nodeName);if(Be(F.uponSanitizeElement,b,{tagName:N,allowedTags:R}),dn&&b.hasChildNodes()&&!ma(b.firstElementChild)&&fe(/<[/\w!]/g,b.innerHTML)&&fe(/<[/\w!]/g,b.textContent)||b.nodeType===Ut.progressingInstruction||dn&&b.nodeType===Ut.comment&&fe(/<[/\w]/g,b.data))return Me(b),!0;if(!(pe.tagCheck instanceof Function&&pe.tagCheck(N))&&(!R[N]||we[N])){if(!we[N]&&xa(N)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N)))return!1;if(us&&!Le[N]){const Z=C(b)||b.parentNode,de=w(b)||b.childNodes;if(de&&Z){const ee=de.length;for(let be=ee-1;be>=0;--be){const Ue=m(de[be],!0);Ue.__removalCount=(b.__removalCount||0)+1,Z.insertBefore(Ue,S(b))}}}return Me(b),!0}return b instanceof c&&!Gl(b)||(N==="noscript"||N==="noembed"||N==="noframes")&&fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Me(b),!0):(yt&&b.nodeType===Ut.text&&(L=b.textContent,wn([H,ce,E],Z=>{L=Nt(L,Z," ")}),b.textContent!==L&&(Ft(t.removed,{element:b.cloneNode()}),b.textContent=L)),Be(F.afterSanitizeElements,b,null),!1)},ya=function(b,L,N){if(ra&&(L==="id"||L==="name")&&(N in n||N in ql))return!1;if(!(Ne&&!X[L]&&fe(B,L))){if(!(Fe&&fe(ie,L))){if(!(pe.attributeCheck instanceof Function&&pe.attributeCheck(L,b))){if(!K[L]||X[L]){if(!(xa(b)&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,b)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(b))&&(Q.attributeNameCheck instanceof RegExp&&fe(Q.attributeNameCheck,L)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(L,b))||L==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&fe(Q.tagNameCheck,N)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(N))))return!1}else if(!ps[L]){if(!fe(M,Nt(N,J,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&b!=="script"&&hf(N,"data:")===0&&ca[b])){if(!(Je&&!fe(ae,Nt(N,J,"")))){if(N)return!1}}}}}}}return!0},xa=function(b){return b!=="annotation-xml"&&Ps(b,te)},$a=function(b){Be(F.beforeSanitizeAttributes,b,null);const{attributes:L}=b;if(!L||ms(b))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let Z=L.length;for(;Z--;){const de=L[Z],{name:ee,namespaceURI:be,value:Ue}=de,St=ne(ee),bs=Ue;let re=ee==="value"?bs:vf(bs);if(N.attrName=St,N.attrValue=re,N.keepAttr=!0,N.forceKeepAttr=void 0,Be(F.uponSanitizeAttribute,b,N),re=N.attrValue,la&&(St==="id"||St==="name")&&(et(ee,b),re=zl+re),dn&&fe(/((--!?|])>)|<\/(style|title|textarea)/i,re)){et(ee,b);continue}if(St==="attributename"&&Ps(re,"href")){et(ee,b);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){et(ee,b);continue}if(!oa&&fe(/\/>/i,re)){et(ee,b);continue}yt&&wn([H,ce,E],ka=>{re=Nt(re,ka," ")});const wa=ne(b.nodeName);if(!ya(wa,St,re)){et(ee,b);continue}if(A&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(wa,St)){case"TrustedHTML":{re=A.createHTML(re);break}case"TrustedScriptURL":{re=A.createScriptURL(re);break}}if(re!==bs)try{be?b.setAttributeNS(be,ee,re):b.setAttribute(ee,re),ms(b)?Me(b):fo(t.removed)}catch{et(ee,b)}}Be(F.afterSanitizeAttributes,b,null)},Vl=function U(b){let L=null;const N=va(b);for(Be(F.beforeSanitizeShadowDOM,b,null);L=N.nextNode();)Be(F.uponSanitizeShadowNode,L,null),ba(L),$a(L),L.content instanceof a&&U(L.content);Be(F.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(U){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,N=null,Z=null,de=null;if(fs=!U,fs&&(U="<!-->"),typeof U!="string"&&!ma(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Ot("dirty is not a string, aborting")}else throw Ot("toString is not a function");if(!t.isSupported)return U;if(cs||vs(b),t.removed=[],typeof U=="string"&&(It=!1),It){if(U.nodeName){const Ue=ne(U.nodeName);if(!R[Ue]||we[Ue])throw Ot("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof l)L=ha("<!---->"),N=L.ownerDocument.importNode(U,!0),N.nodeType===Ut.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?L=N:L.appendChild(N);else{if(!xt&&!yt&&!Xe&&U.indexOf("<")===-1)return A&&gn?A.createHTML(U):U;if(L=ha(U),!L)return xt?null:gn?_:""}L&&ds&&Me(L.firstChild);const ee=va(It?U:L);for(;Z=ee.nextNode();)ba(Z),$a(Z),Z.content instanceof a&&Vl(Z.content);if(It)return U;if(xt){if(un)for(de=z.call(L.ownerDocument);L.firstChild;)de.appendChild(L.firstChild);else de=L;return(K.shadowroot||K.shadowrootmode)&&(de=se.call(s,de,!0)),de}let be=Xe?L.outerHTML:L.innerHTML;return Xe&&R["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&fe(bl,L.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
|
|
2247
|
+
`+be),yt&&wn([H,ce,E],Ue=>{be=Nt(be,Ue," ")}),A&&gn?A.createHTML(be):be},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vs(U),cs=!0},t.clearConfig=function(){kt=null,cs=!1},t.isValidAttribute=function(U,b,L){kt||vs({});const N=ne(U),Z=ne(b);return ya(N,Z,L)},t.addHook=function(U,b){typeof b=="function"&&Ft(F[U],b)},t.removeHook=function(U,b){if(b!==void 0){const L=pf(F[U],b);return L===-1?void 0:ff(F[U],L,1)[0]}return fo(F[U])},t.removeHooks=function(U){F[U]=[]},t.removeAllHooks=function(){F=xo()},t}var ui=yl();function qi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bt=qi();function xl(e){bt=e}var Yt={exec:()=>null};function W(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(he.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var Mf=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),he={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")},If=/^(?:[ \t]*(?:\n|$))+/,Rf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Pf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Df=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Gi=/(?:[*+-]|\d{1,9}[.)])/,$l=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,wl=W($l).replace(/bull/g,Gi).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(),Ff=W($l).replace(/bull/g,Gi).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(),Vi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Nf=/^[^\n]+/,Qi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Of=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Qi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Bf=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Gi).getRegex(),os="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",Yi=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Uf=W("^ {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",Yi).replace("tag",os).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),kl=W(Vi).replace("hr",cn).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",os).getRegex(),zf=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",kl).getRegex(),Zi={blockquote:zf,code:Rf,def:Of,fences:Pf,heading:Df,hr:cn,html:Uf,lheading:wl,list:Bf,newline:If,paragraph:kl,table:Yt,text:Nf},$o=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cn).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",os).getRegex(),Hf={...Zi,lheading:Ff,table:$o,paragraph:W(Vi).replace("hr",cn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$o).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",os).getRegex()},Kf={...Zi,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Yi).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:Yt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Vi).replace("hr",cn).replace("heading",` *#{1,6} *[^
|
|
2248
|
+
]`).replace("lheading",wl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},jf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Wf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Sl=/^( {2,}|\\)\n(?!\s*$)/,qf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,rs=/[\p{P}\p{S}]/u,Ji=/[\s\p{P}\p{S}]/u,Al=/[^\s\p{P}\p{S}]/u,Gf=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ji).getRegex(),Cl=/(?!~)[\p{P}\p{S}]/u,Vf=/(?!~)[\s\p{P}\p{S}]/u,Qf=/(?:[^\s\p{P}\p{S}]|~)/u,Yf=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Mf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Tl=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Zf=W(Tl,"u").replace(/punct/g,rs).getRegex(),Jf=W(Tl,"u").replace(/punct/g,Cl).getRegex(),_l="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Xf=W(_l,"gu").replace(/notPunctSpace/g,Al).replace(/punctSpace/g,Ji).replace(/punct/g,rs).getRegex(),eh=W(_l,"gu").replace(/notPunctSpace/g,Qf).replace(/punctSpace/g,Vf).replace(/punct/g,Cl).getRegex(),th=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Al).replace(/punctSpace/g,Ji).replace(/punct/g,rs).getRegex(),nh=W(/\\(punct)/,"gu").replace(/punct/g,rs).getRegex(),sh=W(/^<(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(),ih=W(Yi).replace("(?:-->|$)","-->").getRegex(),ah=W("^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",ih).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),zn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,oh=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",zn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),El=W(/^!?\[(label)\]\[(ref)\]/).replace("label",zn).replace("ref",Qi).getRegex(),Ll=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",Qi).getRegex(),rh=W("reflink|nolink(?!\\()","g").replace("reflink",El).replace("nolink",Ll).getRegex(),wo=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Xi={_backpedal:Yt,anyPunctuation:nh,autolink:sh,blockSkip:Yf,br:Sl,code:Wf,del:Yt,emStrongLDelim:Zf,emStrongRDelimAst:Xf,emStrongRDelimUnd:th,escape:jf,link:oh,nolink:Ll,punctuation:Gf,reflink:El,reflinkSearch:rh,tag:ah,text:qf,url:Yt},lh={...Xi,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",zn).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zn).getRegex()},gi={...Xi,emStrongRDelimAst:eh,emStrongLDelim:Jf,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",wo).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:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",wo).getRegex()},ch={...gi,br:W(Sl).replace("{2,}","*").getRegex(),text:W(gi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Sn={normal:Zi,gfm:Hf,pedantic:Kf},zt={normal:Xi,gfm:gi,breaks:ch,pedantic:lh},dh={"&":"&","<":"<",">":">",'"':""","'":"'"},ko=e=>dh[e];function Ke(e,t){if(t){if(he.escapeTest.test(e))return e.replace(he.escapeReplace,ko)}else if(he.escapeTestNoEncode.test(e))return e.replace(he.escapeReplaceNoEncode,ko);return e}function So(e){try{e=encodeURI(e).replace(he.percentDecode,"%")}catch{return null}return e}function Ao(e,t){let n=e.replace(he.findPipe,(a,o,l)=>{let c=!1,u=o;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(he.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(he.slashPipe,"|");return s}function Ht(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 uh(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 Co(e,t,n,s,i){let a=t.href,o=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,c}function gh(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
|
|
2245
2249
|
`).map(a=>{let o=a.match(n.other.beginningSpace);if(o===null)return a;let[l]=o;return l.length>=i.length?a.slice(i.length):a}).join(`
|
|
2246
|
-
`)}var
|
|
2247
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=
|
|
2250
|
+
`)}var Hn=class{options;rules;lexer;constructor(e){this.options=e||bt}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:Ht(n,`
|
|
2251
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=gh(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=Ht(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:Ht(t[0],`
|
|
2248
2252
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Ht(t[0],`
|
|
2249
2253
|
`).split(`
|
|
2250
2254
|
`),s="",i="",a=[];for(;n.length>0;){let o=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),o=!0;else if(!o)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
|
|
@@ -2263,9 +2267,9 @@ ${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
2263
2267
|
`,1)[0],_;if(h=A,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),_=h):_=h.replace(this.rules.other.tabCharGlobal," "),S.test(h)||w.test(h)||C.test(h)||m.test(h)||k.test(h))break;if(_.search(this.rules.other.nonSpaceChar)>=f||!h.trim())p+=`
|
|
2264
2268
|
`+_.slice(f);else{if(d||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||S.test(g)||w.test(g)||k.test(g))break;p+=`
|
|
2265
2269
|
`+h}!d&&!h.trim()&&(d=!0),u+=A+`
|
|
2266
|
-
`,e=e.substring(A.length+1),g=_.slice(f)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),c.tokens[0]?.type==="text"||c.tokens[0]?.type==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let p={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=p.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=p.raw+c.tokens[0].raw,c.tokens[0].text=p.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(p)):c.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):c.tokens.unshift(p)}}if(!i.loose){let u=c.tokens.filter(g=>g.type==="space"),p=u.length>0&&u.some(g=>this.rules.other.anyLine.test(g.raw));i.loose=p}}if(i.loose)for(let c of i.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.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=
|
|
2267
|
-
`):[],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(
|
|
2268
|
-
`?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=Ht(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=
|
|
2270
|
+
`,e=e.substring(A.length+1),g=_.slice(f)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),c.tokens[0]?.type==="text"||c.tokens[0]?.type==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let p={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=p.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=p.raw+c.tokens[0].raw,c.tokens[0].text=p.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(p)):c.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):c.tokens.unshift(p)}}if(!i.loose){let u=c.tokens.filter(g=>g.type==="space"),p=u.length>0&&u.some(g=>this.rules.other.anyLine.test(g.raw));i.loose=p}}if(i.loose)for(let c of i.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.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=Ao(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
2271
|
+
`):[],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(Ao(o,a.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[c]})));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)===`
|
|
2272
|
+
`?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=Ht(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=uh(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)),Co(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 Co(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,l=i,c=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(s=u.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]){l+=o;continue}else if((s[5]||s[6])&&i%3&&!((i+o)%3)){c+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+c);let p=[...s[0]][0].length,g=e.slice(0,i+s.index+p+o);if(Math.min(i,o)%2){let d=g.slice(1,-1);return{type:"em",raw:g,text:d,tokens:this.lexer.inlineTokens(d)}}let h=g.slice(2,-2);return{type:"strong",raw:g,text:h,tokens:this.lexer.inlineTokens(h)}}}}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}}}},Te=class pi{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||bt,this.options.tokenizer=this.options.tokenizer||new Hn,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:he,block:Sn.normal,inline:zt.normal};this.options.pedantic?(n.block=Sn.pedantic,n.inline=zt.pedantic):this.options.gfm&&(n.block=Sn.gfm,this.options.breaks?n.inline=zt.breaks:n.inline=zt.gfm),this.tokenizer.rules=n}static get rules(){return{block:Sn,inline:zt}}static lex(t,n){return new pi(n).lex(t)}static lexInline(t,n){return new pi(n).inlineTokens(t)}lex(t){t=t.replace(he.carriageReturn,`
|
|
2269
2273
|
`),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(he.tabCharGlobal," ").replace(he.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+=`
|
|
2270
2274
|
`: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(`
|
|
2271
2275
|
`)?"":`
|
|
@@ -2279,7 +2283,7 @@ ${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
2279
2283
|
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),s=a.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
2280
2284
|
`)?"":`
|
|
2281
2285
|
`)+i.raw,o.text+=`
|
|
2282
|
-
`+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 c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.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,l="";for(;t;){o||(l=""),o=!1;let c;if(this.options.extensions?.inline?.some(p=>(c=p.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(c.raw.length);let p=n.at(-1);c.type==="text"&&p?.type==="text"?(p.raw+=c.raw,p.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(t,s,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(t)){t=t.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(t))){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if(this.options.extensions?.startInline){let p=1/0,g=t.slice(1),h;this.options.extensions.startInline.forEach(d=>{h=d.call({lexer:this},g),typeof h=="number"&&h>=0&&(p=Math.min(p,h))}),p<1/0&&p>=0&&(u=t.substring(0,p+1))}if(c=this.tokenizer.inlineText(u)){t=t.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),o=!0;let p=n.at(-1);p?.type==="text"?(p.raw+=c.raw,p.text+=c.text):n.push(c);continue}if(t){let p="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return n}},
|
|
2286
|
+
`+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 c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.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,l="";for(;t;){o||(l=""),o=!1;let c;if(this.options.extensions?.inline?.some(p=>(c=p.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(c.raw.length);let p=n.at(-1);c.type==="text"&&p?.type==="text"?(p.raw+=c.raw,p.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(t,s,l)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(t)){t=t.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(t))){t=t.substring(c.raw.length),n.push(c);continue}let u=t;if(this.options.extensions?.startInline){let p=1/0,g=t.slice(1),h;this.options.extensions.startInline.forEach(d=>{h=d.call({lexer:this},g),typeof h=="number"&&h>=0&&(p=Math.min(p,h))}),p<1/0&&p>=0&&(u=t.substring(0,p+1))}if(c=this.tokenizer.inlineText(u)){t=t.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),o=!0;let p=n.at(-1);p?.type==="text"?(p.raw+=c.raw,p.text+=c.text):n.push(c);continue}if(t){let p="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return n}},Kn=class{options;parser;constructor(e){this.options=e||bt}space(e){return""}code({text:e,lang:t,escaped:n}){let s=(t||"").match(he.notSpaceStart)?.[0],i=e.replace(he.endingNewline,"")+`
|
|
2283
2287
|
`;return s?'<pre><code class="language-'+Ke(s)+'">'+(n?i:Ke(i,!0))+`</code></pre>
|
|
2284
2288
|
`:"<pre><code>"+(n?i:Ke(i,!0))+`</code></pre>
|
|
2285
2289
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
@@ -2297,29 +2301,29 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
2297
2301
|
`}tablerow({text:e}){return`<tr>
|
|
2298
2302
|
${e}</tr>
|
|
2299
2303
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
2300
|
-
`}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>${Ke(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=
|
|
2301
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Ke(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},vt=new
|
|
2304
|
+
`}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>${Ke(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=So(e);if(i===null)return s;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+Ke(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=So(e);if(i===null)return Ke(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Ke(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ke(e.text)}},ea=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}},_e=class fi{options;renderer;textRenderer;constructor(t){this.options=t||bt,this.options.renderer=this.options.renderer||new Kn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ea}static parse(t,n){return new fi(n).parse(t)}static parseInline(t,n){return new fi(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,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";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 l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";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 l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},jt=class{options;block;constructor(e){this.options=e||bt}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?Te.lex:Te.lexInline}provideParser(){return this.block?_e.parse:_e.parseInline}},ph=class{defaults=qi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_e;Renderer=Kn;TextRenderer=ea;Lexer=Te;Tokenizer=Hn;Hooks=jt;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 l=i.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}: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 Kn(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,l=n.renderer[o],c=i[o];i[o]=(...u)=>{let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p||""}}s.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Hn(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,l=n.tokenizer[o],c=i[o];i[o]=(...u)=>{let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p}}s.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new jt;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,l=n.hooks[o],c=i[o];jt.passThroughHooks.has(a)?i[o]=u=>{if(this.defaults.async&&jt.passThroughHooksRespectAsync.has(a))return(async()=>{let g=await l.call(i,u);return c.call(i,g)})();let p=l.call(i,u);return c.call(i,p)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(i,u);return g===!1&&(g=await c.apply(i,u)),g})();let p=l.apply(i,u);return p===!1&&(p=c.apply(i,u)),p}}s.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Te.lex(e,t??this.defaults)}parser(e,t){return _e.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,l=await(i.hooks?await i.hooks.provideLexer():e?Te.lex:Te.lexInline)(o,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?_e.parse:_e.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let o=(i.hooks?i.hooks.provideLexer():e?Te.lex:Te.lexInline)(t,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?_e.parse:_e.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
2305
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Ke(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},vt=new ph;function G(e,t){return vt.parse(e,t)}G.options=G.setOptions=function(e){return vt.setOptions(e),G.defaults=vt.defaults,xl(G.defaults),G};G.getDefaults=qi;G.defaults=bt;G.use=function(...e){return vt.use(...e),G.defaults=vt.defaults,xl(G.defaults),G};G.walkTokens=function(e,t){return vt.walkTokens(e,t)};G.parseInline=vt.parseInline;G.Parser=_e;G.parser=_e.parse;G.Renderer=Kn;G.TextRenderer=ea;G.Lexer=Te;G.lexer=Te.lex;G.Tokenizer=Hn;G.Hooks=jt;G.parse=G;G.options;G.setOptions;G.use;G.walkTokens;G.parseInline;_e.parse;Te.lex;G.setOptions({gfm:!0,breaks:!0});const To=["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"],_o=["class","href","rel","target","title","start"];let Eo=!1;const fh=14e4,hh=4e4,vh=200,Bs=5e4,dt=new Map;function mh(e){const t=dt.get(e);return t===void 0?null:(dt.delete(e),dt.set(e,t),t)}function Lo(e,t){if(dt.set(e,t),dt.size<=vh)return;const n=dt.keys().next().value;n&&dt.delete(n)}function bh(){Eo||(Eo=!0,ui.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function hi(e){const t=e.trim();if(!t)return"";if(bh(),t.length<=Bs){const o=mh(t);if(o!==null)return o}const n=hr(t,fh),s=n.truncated?`
|
|
2302
2306
|
|
|
2303
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>
|
|
2307
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>hh){const l=`<pre class="code-block">${yh(`${n.text}${s}`)}</pre>`,c=ui.sanitize(l,{ALLOWED_TAGS:To,ALLOWED_ATTR:_o});return t.length<=Bs&&Lo(t,c),c}const i=G.parse(`${n.text}${s}`),a=ui.sanitize(i,{ALLOWED_TAGS:To,ALLOWED_ATTR:_o});return t.length<=Bs&&Lo(t,a),a}function yh(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const xh=1500,$h=2e3,Ml="Copy as markdown",wh="Copied",kh="Copy failed";async function Sh(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function An(e,t){e.title=t,e.setAttribute("aria-label",t)}function Ah(e){const t=e.label??Ml;return r`
|
|
2304
2308
|
<button
|
|
2305
2309
|
class="chat-copy-btn"
|
|
2306
2310
|
type="button"
|
|
2307
2311
|
title=${t}
|
|
2308
2312
|
aria-label=${t}
|
|
2309
|
-
@click=${async n=>{const s=n.currentTarget;if(!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await
|
|
2313
|
+
@click=${async n=>{const s=n.currentTarget;if(!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await Sh(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",An(s,kh),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,An(s,t))},$h);return}s.dataset.copied="1",An(s,wh),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,An(s,t))},xh)}}}
|
|
2310
2314
|
>
|
|
2311
2315
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
2312
2316
|
<span class="chat-copy-btn__icon-copy">${le.copy}</span>
|
|
2313
2317
|
<span class="chat-copy-btn__icon-check">${le.check}</span>
|
|
2314
2318
|
</span>
|
|
2315
2319
|
</button>
|
|
2316
|
-
`}function
|
|
2317
|
-
`),n=t.slice(0,
|
|
2318
|
-
`);return s.length>
|
|
2320
|
+
`}function Ch(e){return Ah({text:()=>e,label:Ml})}function Il(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(g=>{const h=g,d=(typeof h.type=="string"?h.type:"").toLowerCase();return d==="toolresult"||d==="tool_result"}),l=typeof t.toolName=="string"||typeof t.tool_name=="string";(s||o||l)&&(n="toolResult");let c=[];typeof t.content=="string"?c=[{type:"text",text:t.content}]:Array.isArray(t.content)?c=t.content.map(g=>({type:g.type||"text",text:g.text,name:g.name,args:g.args||g.arguments})):typeof t.text=="string"&&(c=[{type:"text",text:t.text}]);const u=typeof t.timestamp=="number"?t.timestamp:Date.now(),p=typeof t.id=="string"?t.id:void 0;return{role:n,content:c,timestamp:u,id:p}}function ta(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 Rl(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}const Th={icon:"puzzle",detailKeys:["command","path","url","targetUrl","targetId","ref","element","node","nodeId","id","requestId","to","channelId","guildId","userId","name","query","pattern","messageId"]},_h={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"}}}},Eh={fallback:Th,tools:_h},Pl=Eh,Mo=Pl.fallback??{icon:"puzzle"},Lh=Pl.tools??{};function Mh(e){return(e??"tool").trim()}function Ih(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 Rh(e){const t=e?.trim();if(t)return t.replace(/_/g," ")}function Dl(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=>Dl(s)).filter(s=>!!s);if(t.length===0)return;const n=t.slice(0,3).join(", ");return t.length>3?`${n}…`:n}}}function Ph(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 Dh(e,t){for(const n of t){const s=Ph(e,n),i=Dl(s);if(i)return i}}function Fh(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 Nh(e){if(!e||typeof e!="object")return;const t=e;return typeof t.path=="string"?t.path:void 0}function Oh(e,t){if(!(!e||!t))return e.actions?.[t]??void 0}function Bh(e){const t=Mh(e.name),n=t.toLowerCase(),s=Lh[n],i=s?.icon??Mo.icon??"puzzle",a=s?.title??Ih(t),o=s?.label??t,l=e.args&&typeof e.args=="object"?e.args.action:void 0,c=typeof l=="string"?l.trim():void 0,u=Oh(s,c),p=Rh(u?.label??c);let g;n==="read"&&(g=Fh(e.args)),!g&&(n==="write"||n==="edit"||n==="attach")&&(g=Nh(e.args));const h=u?.detailKeys??s?.detailKeys??Mo.detailKeys??[];return!g&&h.length>0&&(g=Dh(e.args,h)),!g&&e.meta&&(g=e.meta),g&&(g=zh(g)),{name:t,icon:i,title:a,label:o,verb:p,detail:g}}function Uh(e){const t=[];if(e.verb&&t.push(e.verb),e.detail&&t.push(e.detail),t.length!==0)return t.join(" · ")}function zh(e){return e&&e.replace(/\/Users\/[^/]+/g,"~").replace(/\/home\/[^/]+/g,"~")}const Hh=80,Kh=2,Io=100;function jh(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 Wh(e){const t=e.split(`
|
|
2321
|
+
`),n=t.slice(0,Kh),s=n.join(`
|
|
2322
|
+
`);return s.length>Io?s.slice(0,Io)+"…":n.length<t.length?s+"…":s}function qh(e){const t=e,n=Gh(t.content),s=[];for(const i of n){const a=(typeof i.type=="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:Vh(i.arguments??i.args)})}for(const i of n){const a=(typeof i.type=="string"?i.type:"").toLowerCase();if(a!=="toolresult"&&a!=="tool_result")continue;const o=Qh(i),l=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:l,text:o})}if(Rl(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=Kr(e)??void 0;s.push({kind:"result",name:i,text:a})}return s}function Ro(e,t){const n=Bh({name:e.name,args:e.args}),s=Uh(n),i=!!e.text?.trim(),a=!!t,o=a?()=>{if(i){t(jh(e.text));return}const g=`## ${n.label}
|
|
2319
2323
|
|
|
2320
2324
|
${s?`**Command:** \`${s}\`
|
|
2321
2325
|
|
|
2322
|
-
`:""}*No output — tool completed successfully.*`;t(g)}:void 0,l=i&&(e.text?.length??0)<=
|
|
2326
|
+
`:""}*No output — tool completed successfully.*`;t(g)}:void 0,l=i&&(e.text?.length??0)<=Hh,c=i&&!l,u=i&&l,p=!i;return r`
|
|
2323
2327
|
<div
|
|
2324
2328
|
class="chat-tool-card ${a?"chat-tool-card--clickable":""}"
|
|
2325
2329
|
@click=${o}
|
|
@@ -2339,12 +2343,12 @@ ${s?`**Command:** \`${s}\`
|
|
|
2339
2343
|
${p?r`
|
|
2340
2344
|
<div class="chat-tool-card__status-text muted">Completed</div>
|
|
2341
2345
|
`:v}
|
|
2342
|
-
${c?r`<div class="chat-tool-card__preview mono">${
|
|
2346
|
+
${c?r`<div class="chat-tool-card__preview mono">${Wh(e.text)}</div>`:v}
|
|
2343
2347
|
${u?r`<div class="chat-tool-card__inline mono">${e.text}</div>`:v}
|
|
2344
2348
|
</div>
|
|
2345
|
-
`}function
|
|
2349
|
+
`}function Gh(e){return Array.isArray(e)?e.filter(Boolean):[]}function Vh(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 Qh(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function Yh(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 l=o.data,c=o.media_type||"image/png",u=l.startsWith("data:")?l:`data:${c};base64,${l}`;s.push({url:u})}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 Zh(e){return r`
|
|
2346
2350
|
<div class="chat-group assistant">
|
|
2347
|
-
${
|
|
2351
|
+
${na("assistant",e)}
|
|
2348
2352
|
<div class="chat-group-messages">
|
|
2349
2353
|
<div class="chat-bubble chat-reading-indicator" aria-hidden="true">
|
|
2350
2354
|
<span class="chat-reading-indicator__dots">
|
|
@@ -2353,33 +2357,38 @@ ${s?`**Command:** \`${s}\`
|
|
|
2353
2357
|
</div>
|
|
2354
2358
|
</div>
|
|
2355
2359
|
</div>
|
|
2356
|
-
`}function
|
|
2360
|
+
`}function Jh(e,t,n,s){const i=new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),a=s?.name??"Assistant";return r`
|
|
2357
2361
|
<div class="chat-group assistant">
|
|
2358
|
-
${
|
|
2362
|
+
${na("assistant",s)}
|
|
2359
2363
|
<div class="chat-group-messages">
|
|
2360
|
-
${
|
|
2364
|
+
${Fl({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!0,showReasoning:!1},n)}
|
|
2361
2365
|
<div class="chat-group-footer">
|
|
2362
2366
|
<span class="chat-sender-name">${a}</span>
|
|
2363
2367
|
<span class="chat-group-timestamp">${i}</span>
|
|
2364
2368
|
</div>
|
|
2365
2369
|
</div>
|
|
2366
2370
|
</div>
|
|
2367
|
-
`}function
|
|
2371
|
+
`}function Xh(e,t){const n=ta(e.role),s=t.assistantName??"Assistant",i=n==="user"?"You":n==="assistant"?s:n,a=n==="user"?"user":n==="assistant"?"assistant":"other",o=new Date(e.timestamp).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return r`
|
|
2368
2372
|
<div class="chat-group ${a}">
|
|
2369
|
-
${
|
|
2373
|
+
${na(e.role,{name:s,avatar:t.assistantAvatar??null})}
|
|
2370
2374
|
<div class="chat-group-messages">
|
|
2371
|
-
${e.messages.map((l,c)=>
|
|
2375
|
+
${e.messages.map((l,c)=>Fl(l.message,{isStreaming:e.isStreaming&&c===e.messages.length-1,showReasoning:t.showReasoning},t.onOpenSidebar))}
|
|
2372
2376
|
<div class="chat-group-footer">
|
|
2373
2377
|
<span class="chat-sender-name">${i}</span>
|
|
2374
2378
|
<span class="chat-group-timestamp">${o}</span>
|
|
2375
2379
|
</div>
|
|
2376
2380
|
</div>
|
|
2377
2381
|
</div>
|
|
2378
|
-
`}function
|
|
2382
|
+
`}function na(e,t){const n=ta(e),s=t?.name?.trim()||"Assistant",i=t?.avatar?.trim()||"",a=n==="user"?"U":n==="assistant"?s.charAt(0).toUpperCase()||"A":n==="tool"?"⚙":"?",o=n==="user"?"user":n==="assistant"?"assistant":n==="tool"?"tool":"other";return i&&n==="assistant"?ev(i)?r`<img
|
|
2379
2383
|
class="chat-avatar ${o}"
|
|
2380
2384
|
src="${i}"
|
|
2381
2385
|
alt="${s}"
|
|
2382
|
-
|
|
2386
|
+
@error=${l=>{const c=l.target;c.onerror=null,c.src="/favicon.svg"}}
|
|
2387
|
+
/>`:r`<div class="chat-avatar ${o}">${i}</div>`:n==="assistant"?r`<img
|
|
2388
|
+
class="chat-avatar ${o}"
|
|
2389
|
+
src="/favicon.svg"
|
|
2390
|
+
alt="${s}"
|
|
2391
|
+
/>`:r`<div class="chat-avatar ${o}">${a}</div>`}function ev(e){return/^https?:\/\//i.test(e)||/^data:image\//i.test(e)||e.startsWith("/")}function tv(e){return e.length===0?v:r`
|
|
2383
2392
|
<div class="chat-message-images">
|
|
2384
2393
|
${e.map(t=>r`
|
|
2385
2394
|
<img
|
|
@@ -2390,15 +2399,15 @@ ${s?`**Command:** \`${s}\`
|
|
|
2390
2399
|
/>
|
|
2391
2400
|
`)}
|
|
2392
2401
|
</div>
|
|
2393
|
-
`}function
|
|
2402
|
+
`}function Fl(e,t,n){const s=e,i=typeof s.role=="string"?s.role:"unknown",a=Rl(e)||i.toLowerCase()==="toolresult"||i.toLowerCase()==="tool_result"||typeof s.toolCallId=="string"||typeof s.tool_call_id=="string",o=qh(e),l=o.length>0,c=Yh(e),u=c.length>0,p=Kr(e),g=t.showReasoning&&i==="assistant"?Mu(e):null,h=p?.trim()?p:null,d=g?Ru(g):null,f=h,m=i==="assistant"&&!!f?.trim(),k=["chat-bubble",m?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!f&&l&&a?r`${o.map(S=>Ro(S,n))}`:!f&&!l&&!u?v:r`
|
|
2394
2403
|
<div class="${k}">
|
|
2395
|
-
${m?
|
|
2396
|
-
${
|
|
2397
|
-
${d?r`<div class="chat-thinking">${
|
|
2398
|
-
${f?r`<div class="chat-text">${
|
|
2399
|
-
${o.map(S=>
|
|
2404
|
+
${m?Ch(f):v}
|
|
2405
|
+
${tv(c)}
|
|
2406
|
+
${d?r`<div class="chat-thinking">${ri(hi(d))}</div>`:v}
|
|
2407
|
+
${f?r`<div class="chat-text">${ri(hi(f))}</div>`:v}
|
|
2408
|
+
${o.map(S=>Ro(S,n))}
|
|
2400
2409
|
</div>
|
|
2401
|
-
`}function
|
|
2410
|
+
`}function nv(e){return r`
|
|
2402
2411
|
<div class="sidebar-panel">
|
|
2403
2412
|
<div class="sidebar-header">
|
|
2404
2413
|
<div class="sidebar-title">Tool Output</div>
|
|
@@ -2412,12 +2421,12 @@ ${s?`**Command:** \`${s}\`
|
|
|
2412
2421
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
2413
2422
|
View Raw Text
|
|
2414
2423
|
</button>
|
|
2415
|
-
`:e.content?r`<div class="sidebar-markdown">${
|
|
2424
|
+
`:e.content?r`<div class="sidebar-markdown">${ri(hi(e.content))}</div>`:r`
|
|
2416
2425
|
<div class="muted">No content available</div>
|
|
2417
2426
|
`}
|
|
2418
2427
|
</div>
|
|
2419
2428
|
</div>
|
|
2420
|
-
`}var
|
|
2429
|
+
`}var sv=Object.defineProperty,iv=Object.getOwnPropertyDescriptor,ls=(e,t,n,s)=>{for(var i=s>1?void 0:s?iv(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&&sv(t,n,i),i};let Mt=class extends Tt{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 v}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)}};Mt.styles=Yl`
|
|
2421
2430
|
:host {
|
|
2422
2431
|
width: 4px;
|
|
2423
2432
|
cursor: col-resize;
|
|
@@ -2440,15 +2449,15 @@ ${s?`**Command:** \`${s}\`
|
|
|
2440
2449
|
:host(.dragging) {
|
|
2441
2450
|
background: var(--accent, #007bff);
|
|
2442
2451
|
}
|
|
2443
|
-
`;
|
|
2452
|
+
`;ls([Qn({type:Number})],Mt.prototype,"splitRatio",2);ls([Qn({type:Number})],Mt.prototype,"minRatio",2);ls([Qn({type:Number})],Mt.prototype,"maxRatio",2);Mt=ls([ir("resizable-divider")],Mt);const av=5e3;function Po(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function ov(e){return e?e.active?r`
|
|
2444
2453
|
<div class="callout info compaction-indicator compaction-indicator--active">
|
|
2445
2454
|
${le.loader} Compacting context...
|
|
2446
2455
|
</div>
|
|
2447
|
-
`:e.completedAt&&Date.now()-e.completedAt<
|
|
2456
|
+
`:e.completedAt&&Date.now()-e.completedAt<av?r`
|
|
2448
2457
|
<div class="callout success compaction-indicator compaction-indicator--complete">
|
|
2449
2458
|
${le.check} Context compacted
|
|
2450
2459
|
</div>
|
|
2451
|
-
`:v:v}function
|
|
2460
|
+
`:v:v}function rv(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function lv(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.addEventListener("load",()=>{const l=o.result,c={id:rv(),dataUrl:l,mimeType:a.type},u=t.attachments??[];t.onAttachmentsChange?.([...u,c])}),o.readAsDataURL(a)}}}function cv(e){const t=e.attachments??[];return t.length===0?v:r`
|
|
2452
2461
|
<div class="chat-attachments">
|
|
2453
2462
|
${t.map(n=>r`
|
|
2454
2463
|
<div class="chat-attachment">
|
|
@@ -2468,7 +2477,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
2468
2477
|
</div>
|
|
2469
2478
|
`)}
|
|
2470
2479
|
</div>
|
|
2471
|
-
`}function
|
|
2480
|
+
`}function dv(e){const t=e.connected,n=e.sending||e.stream!==null,s=!!(e.canAbort&&e.onAbort),a=e.sessions?.sessions?.find(d=>d.key===e.sessionKey)?.reasoningLevel??"off",o=e.showThinking&&a!=="off",l={name:e.assistantName,avatar:e.assistantAvatar??e.assistantAvatarUrl??null},c=(e.attachments?.length??0)>0,u=e.connected?c?"Add a message or paste more images...":"Message (↩ to send, Shift+↩ for line breaks, paste images)":"Connect to the gateway to start chatting…",p=e.splitRatio??.6,g=!!(e.sidebarOpen&&e.onCloseSidebar),h=r`
|
|
2472
2481
|
<div
|
|
2473
2482
|
class="chat-thread"
|
|
2474
2483
|
role="log"
|
|
@@ -2478,7 +2487,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
2478
2487
|
${e.loading?r`
|
|
2479
2488
|
<div class="muted">Loading chat…</div>
|
|
2480
2489
|
`:v}
|
|
2481
|
-
${
|
|
2490
|
+
${el(gv(e),d=>d.key,d=>d.kind==="reading-indicator"?Zh(l):d.kind==="stream"?Jh(d.text,d.startedAt,e.onOpenSidebar,l):d.kind==="group"?Xh(d,{onOpenSidebar:e.onOpenSidebar,showReasoning:o,assistantName:e.assistantName,assistantAvatar:l.avatar}):v)}
|
|
2482
2491
|
</div>
|
|
2483
2492
|
`;return r`
|
|
2484
2493
|
<section class="card chat">
|
|
@@ -2486,7 +2495,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
2486
2495
|
|
|
2487
2496
|
${e.error?r`<div class="callout danger">${e.error}</div>`:v}
|
|
2488
2497
|
|
|
2489
|
-
${
|
|
2498
|
+
${ov(e.compactionStatus)}
|
|
2490
2499
|
|
|
2491
2500
|
${e.focusMode?r`
|
|
2492
2501
|
<button
|
|
@@ -2516,7 +2525,7 @@ ${s?`**Command:** \`${s}\`
|
|
|
2516
2525
|
@resize=${d=>e.onSplitRatioChange?.(d.detail.splitRatio)}
|
|
2517
2526
|
></resizable-divider>
|
|
2518
2527
|
<div class="chat-sidebar">
|
|
2519
|
-
${
|
|
2528
|
+
${nv({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
|
|
2520
2529
|
${e.sidebarContent}
|
|
2521
2530
|
\`\`\``)}})}
|
|
2522
2531
|
</div>
|
|
@@ -2557,17 +2566,17 @@ ${e.sidebarContent}
|
|
|
2557
2566
|
`:v}
|
|
2558
2567
|
|
|
2559
2568
|
<div class="chat-compose">
|
|
2560
|
-
${
|
|
2569
|
+
${cv(e)}
|
|
2561
2570
|
<div class="chat-compose__row">
|
|
2562
2571
|
<label class="field chat-compose__field">
|
|
2563
2572
|
<span>Message</span>
|
|
2564
2573
|
<textarea
|
|
2565
|
-
${
|
|
2574
|
+
${cf(d=>d&&Po(d))}
|
|
2566
2575
|
.value=${e.draft}
|
|
2567
2576
|
?disabled=${!e.connected}
|
|
2568
2577
|
@keydown=${d=>{d.key==="Enter"&&(d.isComposing||d.keyCode===229||d.shiftKey||e.connected&&(d.preventDefault(),t&&e.onSend()))}}
|
|
2569
|
-
@input=${d=>{const f=d.target;
|
|
2570
|
-
@paste=${d=>
|
|
2578
|
+
@input=${d=>{const f=d.target;Po(f),e.onDraftChange(f.value)}}
|
|
2579
|
+
@paste=${d=>lv(d,e)}
|
|
2571
2580
|
placeholder=${u}
|
|
2572
2581
|
></textarea>
|
|
2573
2582
|
</label>
|
|
@@ -2590,7 +2599,7 @@ ${e.sidebarContent}
|
|
|
2590
2599
|
</div>
|
|
2591
2600
|
</div>
|
|
2592
2601
|
</section>
|
|
2593
|
-
`}const
|
|
2602
|
+
`}const Do=200;function uv(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=Il(s.message),a=ta(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 gv(e){const t=[],n=Array.isArray(e.messages)?e.messages:[],s=Array.isArray(e.toolMessages)?e.toolMessages:[],i=Math.max(0,n.length-Do);i>0&&t.push({kind:"message",key:"chat:history:notice",message:{role:"system",content:`Showing last ${Do} messages (${i} hidden).`,timestamp:Date.now()}});for(let a=i;a<n.length;a++){const o=n[a],l=Il(o);!e.showThinking&&l.role.toLowerCase()==="toolresult"||t.push({kind:"message",key:Fo(o,a),message:o})}if(e.showThinking)for(let a=0;a<s.length;a++)t.push({kind:"message",key:Fo(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 uv(t)}function Fo(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,l=typeof n.role=="string"?n.role:"unknown";return o!=null?`msg:${l}:${o}:${t}`:`msg:${l}:${t}`}const vi={all:r`
|
|
2594
2603
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2595
2604
|
<rect x="3" y="3" width="7" height="7"></rect>
|
|
2596
2605
|
<rect x="14" y="3" width="7" height="7"></rect>
|
|
@@ -2784,7 +2793,7 @@ ${e.sidebarContent}
|
|
|
2784
2793
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
2785
2794
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
2786
2795
|
</svg>
|
|
2787
|
-
`},
|
|
2796
|
+
`},No=[{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"}],Oo="__all__";function Bo(e){return vi[e]??vi.default}function pv(e,t){const n=Wi[e];return n||{label:t?.title??We(e),description:t?.description??""}}function fv(e){const{key:t,schema:n,uiHints:s}=e;if(!n||De(n)!=="object"||!n.properties)return[];const i=Object.entries(n.properties).map(([a,o])=>{const l=Se([t,a],s),c=l?.label??o.title??We(a),u=l?.help??o.description??"",p=l?.order??50;return{key:a,label:c,description:u,order:p}});return i.sort((a,o)=>a.order!==o.order?a.order-o.order:a.key.localeCompare(o.key)),i}function hv(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 l=i,c=a,u=new Set([...Object.keys(l),...Object.keys(c)]);for(const p of u)s(l[p],c[p],o?`${o}.${p}`:p)}return s(e,t,""),n}function Uo(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 vv(e){const t=e.valid==null?"unknown":e.valid?"valid":"invalid",n=gl(e.schema),s=n.schema?n.unsupportedPaths.length>0:!1,i=n.schema?.properties??{},a=No.filter(T=>T.key in i),o=new Set(No.map(T=>T.key)),l=Object.keys(i).filter(T=>!o.has(T)).map(T=>({key:T,label:T.charAt(0).toUpperCase()+T.slice(1)})),c=[...a,...l],u=e.activeSection&&n.schema&&De(n.schema)==="object"?n.schema.properties?.[e.activeSection]:void 0,p=e.activeSection?pv(e.activeSection,u):null,g=e.activeSection?fv({key:e.activeSection,schema:u,uiHints:e.uiHints}):[],h=e.formMode==="form"&&!!e.activeSection&&g.length>0,d=e.activeSubsection===Oo,f=e.searchQuery||d?null:e.activeSubsection??g[0]?.key??null,m=e.formMode==="form"?hv(e.originalValue,e.formValue):[],k=e.formMode==="raw"&&e.raw!==e.originalRaw,S=e.formMode==="form"?m.length>0:k,w=!!e.formValue&&!e.loading&&!!n.schema,C=e.connected&&!e.saving&&S&&(e.formMode==="raw"?!0:w),A=e.connected&&!e.applying&&!e.updating&&S&&(e.formMode==="raw"?!0:w),_=e.connected&&!e.applying&&!e.updating;return r`
|
|
2788
2797
|
<div class="config-layout">
|
|
2789
2798
|
<!-- Sidebar -->
|
|
2790
2799
|
<aside class="config-sidebar">
|
|
@@ -2831,7 +2840,7 @@ ${e.sidebarContent}
|
|
|
2831
2840
|
class="config-nav__item ${e.activeSection===null?"active":""}"
|
|
2832
2841
|
@click=${()=>e.onSectionChange(null)}
|
|
2833
2842
|
>
|
|
2834
|
-
<span class="config-nav__icon">${
|
|
2843
|
+
<span class="config-nav__icon">${vi.all}</span>
|
|
2835
2844
|
<span class="config-nav__label">All Settings</span>
|
|
2836
2845
|
</button>
|
|
2837
2846
|
${c.map(T=>r`
|
|
@@ -2840,7 +2849,7 @@ ${e.sidebarContent}
|
|
|
2840
2849
|
@click=${()=>e.onSectionChange(T.key)}
|
|
2841
2850
|
>
|
|
2842
2851
|
<span class="config-nav__icon"
|
|
2843
|
-
>${
|
|
2852
|
+
>${Bo(T.key)}</span
|
|
2844
2853
|
>
|
|
2845
2854
|
<span class="config-nav__label">${T.label}</span>
|
|
2846
2855
|
</button>
|
|
@@ -2936,11 +2945,11 @@ ${e.sidebarContent}
|
|
|
2936
2945
|
<div class="config-diff__path">${T.path}</div>
|
|
2937
2946
|
<div class="config-diff__values">
|
|
2938
2947
|
<span class="config-diff__from"
|
|
2939
|
-
>${
|
|
2948
|
+
>${Uo(T.from)}</span
|
|
2940
2949
|
>
|
|
2941
2950
|
<span class="config-diff__arrow">→</span>
|
|
2942
2951
|
<span class="config-diff__to"
|
|
2943
|
-
>${
|
|
2952
|
+
>${Uo(T.to)}</span
|
|
2944
2953
|
>
|
|
2945
2954
|
</div>
|
|
2946
2955
|
</div>
|
|
@@ -2951,7 +2960,7 @@ ${e.sidebarContent}
|
|
|
2951
2960
|
${p&&e.formMode==="form"?r`
|
|
2952
2961
|
<div class="config-section-hero">
|
|
2953
2962
|
<div class="config-section-hero__icon">
|
|
2954
|
-
${
|
|
2963
|
+
${Bo(e.activeSection??"")}
|
|
2955
2964
|
</div>
|
|
2956
2965
|
<div class="config-section-hero__text">
|
|
2957
2966
|
<div class="config-section-hero__title">
|
|
@@ -2967,7 +2976,7 @@ ${e.sidebarContent}
|
|
|
2967
2976
|
<div class="config-subnav">
|
|
2968
2977
|
<button
|
|
2969
2978
|
class="config-subnav__item ${f===null?"active":""}"
|
|
2970
|
-
@click=${()=>e.onSubsectionChange(
|
|
2979
|
+
@click=${()=>e.onSubsectionChange(Oo)}
|
|
2971
2980
|
>
|
|
2972
2981
|
All
|
|
2973
2982
|
</button>
|
|
@@ -2991,7 +3000,7 @@ ${e.sidebarContent}
|
|
|
2991
3000
|
<div class="config-loading__spinner"></div>
|
|
2992
3001
|
<span>Loading schema…</span>
|
|
2993
3002
|
</div>
|
|
2994
|
-
`:
|
|
3003
|
+
`:Tp({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:f})}
|
|
2995
3004
|
${s?r`
|
|
2996
3005
|
<div class="callout danger" style="margin-top: 12px">
|
|
2997
3006
|
Form view can't safely edit some fields. Use Raw to avoid losing config entries.
|
|
@@ -3015,7 +3024,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3015
3024
|
</div>`:v}
|
|
3016
3025
|
</main>
|
|
3017
3026
|
</div>
|
|
3018
|
-
`}function
|
|
3027
|
+
`}function mv(e){const t=["last",...e.channels.filter(Boolean)],n=e.form.deliveryChannel?.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 bv(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 yv(e){const t=mv(e);return r`
|
|
3019
3028
|
<section class="grid grid-cols-2">
|
|
3020
3029
|
<div class="card">
|
|
3021
3030
|
<div class="card-title">Scheduler</div>
|
|
@@ -3033,7 +3042,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3033
3042
|
</div>
|
|
3034
3043
|
<div class="stat">
|
|
3035
3044
|
<div class="stat-label">Next wake</div>
|
|
3036
|
-
<div class="stat-value">${
|
|
3045
|
+
<div class="stat-value">${ji(e.status?.nextWakeAtMs??null)}</div>
|
|
3037
3046
|
</div>
|
|
3038
3047
|
</div>
|
|
3039
3048
|
<div class="row" style="margin-top: 12px;">
|
|
@@ -3090,7 +3099,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3090
3099
|
</select>
|
|
3091
3100
|
</label>
|
|
3092
3101
|
</div>
|
|
3093
|
-
${
|
|
3102
|
+
${xv(e)}
|
|
3094
3103
|
<div class="form-grid" style="margin-top: 12px;">
|
|
3095
3104
|
<label class="field">
|
|
3096
3105
|
<span>Session</span>
|
|
@@ -3158,7 +3167,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3158
3167
|
@change=${n=>e.onFormChange({deliveryChannel:n.target.value})}
|
|
3159
3168
|
>
|
|
3160
3169
|
${t.map(n=>r`<option value=${n}>
|
|
3161
|
-
${
|
|
3170
|
+
${bv(e,n)}
|
|
3162
3171
|
</option>`)}
|
|
3163
3172
|
</select>
|
|
3164
3173
|
</label>
|
|
@@ -3188,7 +3197,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3188
3197
|
<div class="muted" style="margin-top: 12px">No jobs yet.</div>
|
|
3189
3198
|
`:r`
|
|
3190
3199
|
<div class="list" style="margin-top: 12px;">
|
|
3191
|
-
${e.jobs.map(n
|
|
3200
|
+
${e.jobs.map(n=>$v(n,e))}
|
|
3192
3201
|
</div>
|
|
3193
3202
|
`}
|
|
3194
3203
|
</section>
|
|
@@ -3202,11 +3211,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3202
3211
|
<div class="muted" style="margin-top: 12px">No runs yet.</div>
|
|
3203
3212
|
`:r`
|
|
3204
3213
|
<div class="list" style="margin-top: 12px;">
|
|
3205
|
-
${e.runs.map(n=>
|
|
3214
|
+
${e.runs.map(n=>wv(n))}
|
|
3206
3215
|
</div>
|
|
3207
3216
|
`}
|
|
3208
3217
|
</section>
|
|
3209
|
-
`}function
|
|
3218
|
+
`}function xv(e){const t=e.form;return t.scheduleKind==="at"?r`
|
|
3210
3219
|
<label class="field" style="margin-top: 12px;">
|
|
3211
3220
|
<span>Run at</span>
|
|
3212
3221
|
<input
|
|
@@ -3253,12 +3262,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3253
3262
|
/>
|
|
3254
3263
|
</label>
|
|
3255
3264
|
</div>
|
|
3256
|
-
`}function
|
|
3265
|
+
`}function $v(e,t){const s=`list-item list-item-clickable${t.runsJobId===e.id?" list-item-selected":""}`;return r`
|
|
3257
3266
|
<div class=${s} @click=${()=>t.onLoadRuns(e.id)}>
|
|
3258
3267
|
<div class="list-main">
|
|
3259
3268
|
<div class="list-title">${e.name}</div>
|
|
3260
|
-
<div class="list-sub">${
|
|
3261
|
-
<div class="muted">${
|
|
3269
|
+
<div class="list-sub">${il(e)}</div>
|
|
3270
|
+
<div class="muted">${al(e)}</div>
|
|
3262
3271
|
${e.agentId?r`<div class="muted">Agent: ${e.agentId}</div>`:v}
|
|
3263
3272
|
<div class="chip-row" style="margin-top: 6px;">
|
|
3264
3273
|
<span class="chip">${e.enabled?"enabled":"disabled"}</span>
|
|
@@ -3267,7 +3276,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3267
3276
|
</div>
|
|
3268
3277
|
</div>
|
|
3269
3278
|
<div class="list-meta">
|
|
3270
|
-
<div>${
|
|
3279
|
+
<div>${sl(e)}</div>
|
|
3271
3280
|
<div class="row" style="justify-content: flex-end; margin-top: 8px;">
|
|
3272
3281
|
<button
|
|
3273
3282
|
class="btn"
|
|
@@ -3300,7 +3309,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3300
3309
|
</div>
|
|
3301
3310
|
</div>
|
|
3302
3311
|
</div>
|
|
3303
|
-
`}function
|
|
3312
|
+
`}function wv(e){return r`
|
|
3304
3313
|
<div class="list-item">
|
|
3305
3314
|
<div class="list-main">
|
|
3306
3315
|
<div class="list-title">${e.status}</div>
|
|
@@ -3312,7 +3321,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3312
3321
|
${e.error?r`<div class="muted">${e.error}</div>`:v}
|
|
3313
3322
|
</div>
|
|
3314
3323
|
</div>
|
|
3315
|
-
`}function
|
|
3324
|
+
`}function kv(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",l=s>0?`${s} critical`:i>0?`${i} warnings`:"No critical issues";return r`
|
|
3316
3325
|
<section class="grid grid-cols-2">
|
|
3317
3326
|
<div class="card">
|
|
3318
3327
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -3395,14 +3404,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3395
3404
|
<div class="list-sub">${new Date(c.ts).toLocaleTimeString()}</div>
|
|
3396
3405
|
</div>
|
|
3397
3406
|
<div class="list-meta">
|
|
3398
|
-
<pre class="code-block">${
|
|
3407
|
+
<pre class="code-block">${zg(c.payload)}</pre>
|
|
3399
3408
|
</div>
|
|
3400
3409
|
</div>
|
|
3401
3410
|
`)}
|
|
3402
3411
|
</div>
|
|
3403
3412
|
`}
|
|
3404
3413
|
</section>
|
|
3405
|
-
`}function
|
|
3414
|
+
`}function Sv(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 st(e,t){return t?r`<div class="exec-approval-meta-row"><span>${e}</span><span>${t}</span></div>`:v}function Av(e){const t=e.execApprovalQueue[0];if(!t)return v;const n=t.request,s=t.expiresAtMs-Date.now(),i=s>0?`expires in ${Sv(s)}`:"expired",a=e.execApprovalQueue.length;return r`
|
|
3406
3415
|
<div class="exec-approval-overlay" role="dialog" aria-live="polite">
|
|
3407
3416
|
<div class="exec-approval-card">
|
|
3408
3417
|
<div class="exec-approval-header">
|
|
@@ -3448,7 +3457,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3448
3457
|
</div>
|
|
3449
3458
|
</div>
|
|
3450
3459
|
</div>
|
|
3451
|
-
`}function
|
|
3460
|
+
`}function Cv(e){const{pendingGatewayUrl:t}=e;return t?r`
|
|
3452
3461
|
<div class="exec-approval-overlay" role="dialog" aria-modal="true" aria-live="polite">
|
|
3453
3462
|
<div class="exec-approval-card">
|
|
3454
3463
|
<div class="exec-approval-header">
|
|
@@ -3477,7 +3486,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3477
3486
|
</div>
|
|
3478
3487
|
</div>
|
|
3479
3488
|
</div>
|
|
3480
|
-
`:v}function
|
|
3489
|
+
`:v}function Tv(e){return r`
|
|
3481
3490
|
<section class="card">
|
|
3482
3491
|
<div class="row" style="justify-content: space-between;">
|
|
3483
3492
|
<div>
|
|
@@ -3497,14 +3506,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3497
3506
|
<div class="list" style="margin-top: 16px;">
|
|
3498
3507
|
${e.entries.length===0?r`
|
|
3499
3508
|
<div class="muted">No instances reported yet.</div>
|
|
3500
|
-
`:e.entries.map(t=>
|
|
3509
|
+
`:e.entries.map(t=>_v(t))}
|
|
3501
3510
|
</div>
|
|
3502
3511
|
</section>
|
|
3503
|
-
`}function
|
|
3512
|
+
`}function _v(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 r`
|
|
3504
3513
|
<div class="list-item">
|
|
3505
3514
|
<div class="list-main">
|
|
3506
3515
|
<div class="list-title">${e.host??"unknown host"}</div>
|
|
3507
|
-
<div class="list-sub">${
|
|
3516
|
+
<div class="list-sub">${Og(e)}</div>
|
|
3508
3517
|
<div class="chip-row">
|
|
3509
3518
|
<span class="chip">${n}</span>
|
|
3510
3519
|
${s.map(o=>r`<span class="chip">${o}</span>`)}
|
|
@@ -3516,12 +3525,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3516
3525
|
</div>
|
|
3517
3526
|
</div>
|
|
3518
3527
|
<div class="list-meta">
|
|
3519
|
-
<div>${
|
|
3528
|
+
<div>${Bg(e)}</div>
|
|
3520
3529
|
<div class="muted">Last input ${t}</div>
|
|
3521
3530
|
<div class="muted">Reason ${e.reason??""}</div>
|
|
3522
3531
|
</div>
|
|
3523
3532
|
</div>
|
|
3524
|
-
`}const
|
|
3533
|
+
`}const zo=["trace","debug","info","warn","error","fatal"];function Ev(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function Lv(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function Mv(e){const t=e.filterText.trim().toLowerCase(),n=zo.some(a=>!e.levelFilters[a]),s=e.entries.filter(a=>a.level&&!e.levelFilters[a.level]?!1:Lv(a,t)),i=t||n?"filtered":"visible";return r`
|
|
3525
3534
|
<section class="card">
|
|
3526
3535
|
<div class="row" style="justify-content: space-between;">
|
|
3527
3536
|
<div>
|
|
@@ -3562,7 +3571,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3562
3571
|
</div>
|
|
3563
3572
|
|
|
3564
3573
|
<div class="chip-row" style="margin-top: 12px;">
|
|
3565
|
-
${
|
|
3574
|
+
${zo.map(a=>r`
|
|
3566
3575
|
<label class="chip log-chip ${a}">
|
|
3567
3576
|
<input
|
|
3568
3577
|
type="checkbox"
|
|
@@ -3585,7 +3594,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3585
3594
|
<div class="muted" style="padding: 12px">No log entries.</div>
|
|
3586
3595
|
`:s.map(a=>r`
|
|
3587
3596
|
<div class="log-row">
|
|
3588
|
-
<div class="log-time mono">${
|
|
3597
|
+
<div class="log-time mono">${Ev(a.time)}</div>
|
|
3589
3598
|
<div class="log-level ${a.level??""}">${a.level??""}</div>
|
|
3590
3599
|
<div class="log-subsystem mono">${a.subsystem??""}</div>
|
|
3591
3600
|
<div class="log-message mono">${a.message??a.raw}</div>
|
|
@@ -3593,10 +3602,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3593
3602
|
`)}
|
|
3594
3603
|
</div>
|
|
3595
3604
|
</section>
|
|
3596
|
-
`}function
|
|
3597
|
-
${
|
|
3598
|
-
${
|
|
3599
|
-
${
|
|
3605
|
+
`}function Iv(e){const t=Ov(e),n=jv(e);return r`
|
|
3606
|
+
${qv(n)}
|
|
3607
|
+
${Wv(t)}
|
|
3608
|
+
${Rv(e)}
|
|
3600
3609
|
<section class="card">
|
|
3601
3610
|
<div class="row" style="justify-content: space-between;">
|
|
3602
3611
|
<div>
|
|
@@ -3610,10 +3619,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3610
3619
|
<div class="list" style="margin-top: 16px;">
|
|
3611
3620
|
${e.nodes.length===0?r`
|
|
3612
3621
|
<div class="muted">No nodes found.</div>
|
|
3613
|
-
`:e.nodes.map(s=>
|
|
3622
|
+
`:e.nodes.map(s=>nm(s))}
|
|
3614
3623
|
</div>
|
|
3615
3624
|
</section>
|
|
3616
|
-
`}function
|
|
3625
|
+
`}function Rv(e){const t=e.devicesList??{pending:[],paired:[]},n=Array.isArray(t.pending)?t.pending:[],s=Array.isArray(t.paired)?t.paired:[];return r`
|
|
3617
3626
|
<section class="card">
|
|
3618
3627
|
<div class="row" style="justify-content: space-between;">
|
|
3619
3628
|
<div>
|
|
@@ -3628,18 +3637,18 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3628
3637
|
<div class="list" style="margin-top: 16px;">
|
|
3629
3638
|
${n.length>0?r`
|
|
3630
3639
|
<div class="muted" style="margin-bottom: 8px;">Pending</div>
|
|
3631
|
-
${n.map(i=>
|
|
3640
|
+
${n.map(i=>Pv(i,e))}
|
|
3632
3641
|
`:v}
|
|
3633
3642
|
${s.length>0?r`
|
|
3634
3643
|
<div class="muted" style="margin-top: 12px; margin-bottom: 8px;">Paired</div>
|
|
3635
|
-
${s.map(i=>
|
|
3644
|
+
${s.map(i=>Dv(i,e))}
|
|
3636
3645
|
`:v}
|
|
3637
3646
|
${n.length===0&&s.length===0?r`
|
|
3638
3647
|
<div class="muted">No paired devices.</div>
|
|
3639
3648
|
`:v}
|
|
3640
3649
|
</div>
|
|
3641
3650
|
</section>
|
|
3642
|
-
`}function
|
|
3651
|
+
`}function Pv(e,t){const n=e.displayName?.trim()||e.deviceId,s=typeof e.ts=="number"?V(e.ts):"n/a",i=e.role?.trim()?`role: ${e.role}`:"role: -",a=e.isRepair?" · repair":"",o=e.remoteIp?` · ${e.remoteIp}`:"";return r`
|
|
3643
3652
|
<div class="list-item">
|
|
3644
3653
|
<div class="list-main">
|
|
3645
3654
|
<div class="list-title">${n}</div>
|
|
@@ -3659,7 +3668,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3659
3668
|
</div>
|
|
3660
3669
|
</div>
|
|
3661
3670
|
</div>
|
|
3662
|
-
`}function
|
|
3671
|
+
`}function Dv(e,t){const n=e.displayName?.trim()||e.deviceId,s=e.remoteIp?` · ${e.remoteIp}`:"",i=`roles: ${qs(e.roles)}`,a=`scopes: ${qs(e.scopes)}`,o=Array.isArray(e.tokens)?e.tokens:[];return r`
|
|
3663
3672
|
<div class="list-item">
|
|
3664
3673
|
<div class="list-main">
|
|
3665
3674
|
<div class="list-title">${n}</div>
|
|
@@ -3670,12 +3679,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3670
3679
|
`:r`
|
|
3671
3680
|
<div class="muted" style="margin-top: 10px;">Tokens</div>
|
|
3672
3681
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 6px;">
|
|
3673
|
-
${o.map(l=>
|
|
3682
|
+
${o.map(l=>Fv(e.deviceId,l,t))}
|
|
3674
3683
|
</div>
|
|
3675
3684
|
`}
|
|
3676
3685
|
</div>
|
|
3677
3686
|
</div>
|
|
3678
|
-
`}function
|
|
3687
|
+
`}function Fv(e,t,n){const s=t.revokedAtMs?"revoked":"active",i=`scopes: ${qs(t.scopes)}`,a=V(t.rotatedAtMs??t.createdAtMs??t.lastUsedAtMs??null);return r`
|
|
3679
3688
|
<div class="row" style="justify-content: space-between; gap: 8px;">
|
|
3680
3689
|
<div class="list-sub">${t.role} · ${s} · ${i} · ${a}</div>
|
|
3681
3690
|
<div class="row" style="justify-content: flex-end; gap: 6px; flex-wrap: wrap;">
|
|
@@ -3695,7 +3704,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3695
3704
|
`}
|
|
3696
3705
|
</div>
|
|
3697
3706
|
</div>
|
|
3698
|
-
`}const Ve="__defaults__",
|
|
3707
|
+
`}const Ve="__defaults__",Ho=[{value:"deny",label:"Deny"},{value:"allowlist",label:"Allowlist"},{value:"full",label:"Full"}],Nv=[{value:"off",label:"Off"},{value:"on-miss",label:"On miss"},{value:"always",label:"Always"}];function Ov(e){const t=e.configForm,n=Xv(e.nodes),{defaultBinding:s,agents:i}=tm(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 Ko(e){return e==="allowlist"||e==="full"||e==="deny"?e:"deny"}function Bv(e){return e==="always"||e==="off"||e==="on-miss"?e:"on-miss"}function Uv(e){const t=e?.defaults??{};return{security:Ko(t.security),ask:Bv(t.ask),askFallback:Ko(t.askFallback??"deny"),autoAllowSkills:!!(t.autoAllowSkills??!1)}}function zv(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 l=typeof a.name=="string"?a.name.trim():void 0,c=a.default===!0;s.push({id:o,name:l||void 0,isDefault:c})}),s}function Hv(e,t){const n=zv(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,l)=>{if(o.isDefault&&!l.isDefault)return-1;if(!o.isDefault&&l.isDefault)return 1;const c=o.name?.trim()?o.name:o.id,u=l.name?.trim()?l.name:l.id;return c.localeCompare(u)}),a}function Kv(e,t){return e===Ve?Ve:e&&t.some(n=>n.id===e)?e:Ve}function jv(e){const t=e.execApprovalsForm??e.execApprovalsSnapshot?.file??null,n=!!t,s=Uv(t),i=Hv(e.configForm,t),a=em(e.nodes),o=e.execApprovalsTarget;let l=o==="node"&&e.execApprovalsTargetNodeId?e.execApprovalsTargetNodeId:null;o==="node"&&l&&!a.some(g=>g.id===l)&&(l=null);const c=Kv(e.execApprovalsSelectedAgent,i),u=c!==Ve?(t?.agents??{})[c]??null:null,p=Array.isArray(u?.allowlist)?u.allowlist??[]:[];return{ready:n,disabled:e.execApprovalsSaving||e.execApprovalsLoading,dirty:e.execApprovalsDirty,loading:e.execApprovalsLoading,saving:e.execApprovalsSaving,form:t,defaults:s,selectedScope:c,selectedAgent:u,agents:i,allowlist:p,target:o,targetNodeId:l,targetNodes:a,onSelectScope:e.onExecApprovalsSelectAgent,onSelectTarget:e.onExecApprovalsTargetChange,onPatch:e.onExecApprovalsPatch,onRemove:e.onExecApprovalsRemove,onLoad:e.onLoadExecApprovals,onSave:e.onSaveExecApprovals}}function Wv(e){const t=e.nodes.length>0,n=e.defaultBinding??"";return r`
|
|
3699
3708
|
<section class="card">
|
|
3700
3709
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
3701
3710
|
<div>
|
|
@@ -3750,7 +3759,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3750
3759
|
|
|
3751
3760
|
${e.agents.length===0?r`
|
|
3752
3761
|
<div class="muted">No agents found.</div>
|
|
3753
|
-
`:e.agents.map(s=>
|
|
3762
|
+
`:e.agents.map(s=>Jv(s,e))}
|
|
3754
3763
|
</div>
|
|
3755
3764
|
`:r`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
3756
3765
|
<div class="muted">Load config to edit bindings.</div>
|
|
@@ -3759,7 +3768,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3759
3768
|
</button>
|
|
3760
3769
|
</div>`}
|
|
3761
3770
|
</section>
|
|
3762
|
-
`}function
|
|
3771
|
+
`}function qv(e){const t=e.ready,n=e.target!=="node"||!!e.targetNodeId;return r`
|
|
3763
3772
|
<section class="card">
|
|
3764
3773
|
<div class="row" style="justify-content: space-between; align-items: center;">
|
|
3765
3774
|
<div>
|
|
@@ -3777,12 +3786,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3777
3786
|
</button>
|
|
3778
3787
|
</div>
|
|
3779
3788
|
|
|
3780
|
-
${
|
|
3789
|
+
${Gv(e)}
|
|
3781
3790
|
|
|
3782
3791
|
${t?r`
|
|
3783
|
-
${
|
|
3784
|
-
${
|
|
3785
|
-
${e.selectedScope===Ve?v:
|
|
3792
|
+
${Vv(e)}
|
|
3793
|
+
${Qv(e)}
|
|
3794
|
+
${e.selectedScope===Ve?v:Yv(e)}
|
|
3786
3795
|
`:r`<div class="row" style="margin-top: 12px; gap: 12px;">
|
|
3787
3796
|
<div class="muted">Load exec approvals to edit allowlists.</div>
|
|
3788
3797
|
<button class="btn" ?disabled=${e.loading||!n} @click=${e.onLoad}>
|
|
@@ -3790,7 +3799,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3790
3799
|
</button>
|
|
3791
3800
|
</div>`}
|
|
3792
3801
|
</section>
|
|
3793
|
-
`}function
|
|
3802
|
+
`}function Gv(e){const t=e.targetNodes.length>0,n=e.targetNodeId??"";return r`
|
|
3794
3803
|
<div class="list" style="margin-top: 12px;">
|
|
3795
3804
|
<div class="list-item">
|
|
3796
3805
|
<div class="list-main">
|
|
@@ -3833,7 +3842,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3833
3842
|
<div class="muted">No nodes advertise exec approvals yet.</div>
|
|
3834
3843
|
`:v}
|
|
3835
3844
|
</div>
|
|
3836
|
-
`}function
|
|
3845
|
+
`}function Vv(e){return r`
|
|
3837
3846
|
<div class="row" style="margin-top: 12px; gap: 8px; flex-wrap: wrap;">
|
|
3838
3847
|
<span class="label">Scope</span>
|
|
3839
3848
|
<div class="row" style="gap: 8px; flex-wrap: wrap;">
|
|
@@ -3853,7 +3862,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3853
3862
|
`})}
|
|
3854
3863
|
</div>
|
|
3855
3864
|
</div>
|
|
3856
|
-
`}function
|
|
3865
|
+
`}function Qv(e){const t=e.selectedScope===Ve,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,l=typeof s.askFallback=="string"?s.askFallback:void 0,c=t?n.security:a??"__default__",u=t?n.ask:o??"__default__",p=t?n.askFallback:l??"__default__",g=typeof s.autoAllowSkills=="boolean"?s.autoAllowSkills:void 0,h=g??n.autoAllowSkills,d=g==null;return r`
|
|
3857
3866
|
<div class="list" style="margin-top: 16px;">
|
|
3858
3867
|
<div class="list-item">
|
|
3859
3868
|
<div class="list-main">
|
|
@@ -3872,7 +3881,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3872
3881
|
${t?v:r`<option value="__default__" ?selected=${c==="__default__"}>
|
|
3873
3882
|
Use default (${n.security})
|
|
3874
3883
|
</option>`}
|
|
3875
|
-
${
|
|
3884
|
+
${Ho.map(f=>r`<option
|
|
3876
3885
|
value=${f.value}
|
|
3877
3886
|
?selected=${c===f.value}
|
|
3878
3887
|
>
|
|
@@ -3900,7 +3909,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3900
3909
|
${t?v:r`<option value="__default__" ?selected=${u==="__default__"}>
|
|
3901
3910
|
Use default (${n.ask})
|
|
3902
3911
|
</option>`}
|
|
3903
|
-
${
|
|
3912
|
+
${Nv.map(f=>r`<option
|
|
3904
3913
|
value=${f.value}
|
|
3905
3914
|
?selected=${u===f.value}
|
|
3906
3915
|
>
|
|
@@ -3928,7 +3937,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3928
3937
|
${t?v:r`<option value="__default__" ?selected=${p==="__default__"}>
|
|
3929
3938
|
Use default (${n.askFallback})
|
|
3930
3939
|
</option>`}
|
|
3931
|
-
${
|
|
3940
|
+
${Ho.map(f=>r`<option
|
|
3932
3941
|
value=${f.value}
|
|
3933
3942
|
?selected=${p===f.value}
|
|
3934
3943
|
>
|
|
@@ -3966,7 +3975,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3966
3975
|
</div>
|
|
3967
3976
|
</div>
|
|
3968
3977
|
</div>
|
|
3969
|
-
`}function
|
|
3978
|
+
`}function Yv(e){const t=["agents",e.selectedScope,"allowlist"],n=e.allowlist;return r`
|
|
3970
3979
|
<div class="row" style="margin-top: 18px; justify-content: space-between;">
|
|
3971
3980
|
<div>
|
|
3972
3981
|
<div class="card-title">Allowlist</div>
|
|
@@ -3983,9 +3992,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
3983
3992
|
<div class="list" style="margin-top: 12px;">
|
|
3984
3993
|
${n.length===0?r`
|
|
3985
3994
|
<div class="muted">No allowlist entries yet.</div>
|
|
3986
|
-
`:n.map((s,i)=>
|
|
3995
|
+
`:n.map((s,i)=>Zv(e,s,i))}
|
|
3987
3996
|
</div>
|
|
3988
|
-
`}function
|
|
3997
|
+
`}function Zv(e,t,n){const s=t.lastUsedAt?V(t.lastUsedAt):"never",i=t.lastUsedCommand?Gs(t.lastUsedCommand,120):null,a=t.lastResolvedPath?Gs(t.lastResolvedPath,120):null;return r`
|
|
3989
3998
|
<div class="list-item">
|
|
3990
3999
|
<div class="list-main">
|
|
3991
4000
|
<div class="list-title">${t.pattern?.trim()?t.pattern:"New pattern"}</div>
|
|
@@ -4012,7 +4021,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4012
4021
|
</button>
|
|
4013
4022
|
</div>
|
|
4014
4023
|
</div>
|
|
4015
|
-
`}function
|
|
4024
|
+
`}function Jv(e,t){const n=e.binding??"__default__",s=e.name?.trim()?`${e.name} (${e.id})`:e.id,i=t.nodes.length>0;return r`
|
|
4016
4025
|
<div class="list-item">
|
|
4017
4026
|
<div class="list-main">
|
|
4018
4027
|
<div class="list-title">${s}</div>
|
|
@@ -4041,7 +4050,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4041
4050
|
</label>
|
|
4042
4051
|
</div>
|
|
4043
4052
|
</div>
|
|
4044
|
-
`}function
|
|
4053
|
+
`}function Xv(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(l=>String(l)==="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 em(e){const t=[];for(const n of e){if(!(Array.isArray(n.commands)?n.commands:[]).some(l=>String(l)==="system.execApprovals.get"||String(l)==="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 tm(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 l=[];return o.forEach((c,u)=>{if(!c||typeof c!="object")return;const p=c,g=typeof p.id=="string"?p.id.trim():"";if(!g)return;const h=typeof p.name=="string"?p.name.trim():void 0,d=p.default===!0,m=(p.tools??{}).exec??{},k=typeof m.node=="string"&&m.node.trim()?m.node.trim():null;l.push({id:g,name:h||void 0,index:u,isDefault:d,binding:k})}),l.length===0&&l.push(t),{defaultBinding:i,agents:l}}function nm(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 r`
|
|
4045
4054
|
<div class="list-item">
|
|
4046
4055
|
<div class="list-main">
|
|
4047
4056
|
<div class="list-title">${s}</div>
|
|
@@ -4060,7 +4069,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4060
4069
|
</div>
|
|
4061
4070
|
</div>
|
|
4062
4071
|
</div>
|
|
4063
|
-
`}function
|
|
4072
|
+
`}function sm(e){const t=e.hello?.snapshot,n=t?.uptimeMs?fr(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 c=!!e.settings.token.trim(),u=!!e.password.trim();return!c&&!u?r`
|
|
4064
4073
|
<div class="muted" style="margin-top: 8px">
|
|
4065
4074
|
This gateway requires auth. Add a token or password, then click Connect.
|
|
4066
4075
|
<div style="margin-top: 6px">
|
|
@@ -4070,7 +4079,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4070
4079
|
<div style="margin-top: 6px">
|
|
4071
4080
|
<a
|
|
4072
4081
|
class="session-link"
|
|
4073
|
-
href="https://docs.
|
|
4082
|
+
href="https://docs.openclaw.ai/web/dashboard"
|
|
4074
4083
|
target="_blank"
|
|
4075
4084
|
rel="noreferrer"
|
|
4076
4085
|
title="Control UI auth docs (opens in new tab)"
|
|
@@ -4084,7 +4093,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4084
4093
|
<div style="margin-top: 6px">
|
|
4085
4094
|
<a
|
|
4086
4095
|
class="session-link"
|
|
4087
|
-
href="https://docs.
|
|
4096
|
+
href="https://docs.openclaw.ai/web/dashboard"
|
|
4088
4097
|
target="_blank"
|
|
4089
4098
|
rel="noreferrer"
|
|
4090
4099
|
title="Control UI auth docs (opens in new tab)"
|
|
@@ -4103,7 +4112,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4103
4112
|
<div style="margin-top: 6px">
|
|
4104
4113
|
<a
|
|
4105
4114
|
class="session-link"
|
|
4106
|
-
href="https://docs.
|
|
4115
|
+
href="https://docs.openclaw.ai/gateway/tailscale"
|
|
4107
4116
|
target="_blank"
|
|
4108
4117
|
rel="noreferrer"
|
|
4109
4118
|
title="Tailscale Serve docs (opens in new tab)"
|
|
@@ -4112,7 +4121,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4112
4121
|
<span class="muted"> · </span>
|
|
4113
4122
|
<a
|
|
4114
4123
|
class="session-link"
|
|
4115
|
-
href="https://docs.
|
|
4124
|
+
href="https://docs.openclaw.ai/web/control-ui#insecure-http"
|
|
4116
4125
|
target="_blank"
|
|
4117
4126
|
rel="noreferrer"
|
|
4118
4127
|
title="Insecure HTTP docs (opens in new tab)"
|
|
@@ -4219,7 +4228,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4219
4228
|
<div class="stat-value">
|
|
4220
4229
|
${e.cronEnabled==null?"n/a":e.cronEnabled?"Enabled":"Disabled"}
|
|
4221
4230
|
</div>
|
|
4222
|
-
<div class="muted">Next wake ${
|
|
4231
|
+
<div class="muted">Next wake ${ji(e.cronNext)}</div>
|
|
4223
4232
|
</div>
|
|
4224
4233
|
</section>
|
|
4225
4234
|
|
|
@@ -4243,7 +4252,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4243
4252
|
</div>
|
|
4244
4253
|
</div>
|
|
4245
4254
|
</section>
|
|
4246
|
-
`}const
|
|
4255
|
+
`}const im=["","off","minimal","low","medium","high"],am=["","off","on"],om=[{value:"",label:"inherit"},{value:"off",label:"off (explicit)"},{value:"on",label:"on"}],rm=["","off","on","stream"];function lm(e){if(!e)return"";const t=e.trim().toLowerCase();return t==="z.ai"||t==="z-ai"?"zai":t}function Nl(e){return lm(e)==="zai"}function cm(e){return Nl(e)?am:im}function dm(e,t){return!t||!e||e==="off"?e:"on"}function um(e,t){return e?t&&e==="on"?"low":e:null}function gm(e){const t=e.result?.sessions??[];return r`
|
|
4247
4256
|
<section class="card">
|
|
4248
4257
|
<div class="row" style="justify-content: space-between;">
|
|
4249
4258
|
<div>
|
|
@@ -4308,10 +4317,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4308
4317
|
</div>
|
|
4309
4318
|
${t.length===0?r`
|
|
4310
4319
|
<div class="muted">No sessions found.</div>
|
|
4311
|
-
`:t.map(n=>
|
|
4320
|
+
`:t.map(n=>pm(n,e.basePath,e.onPatch,e.onDelete,e.loading))}
|
|
4312
4321
|
</div>
|
|
4313
4322
|
</section>
|
|
4314
|
-
`}function
|
|
4323
|
+
`}function pm(e,t,n,s,i){const a=e.updatedAt?V(e.updatedAt):"n/a",o=e.thinkingLevel??"",l=Nl(e.modelProvider),c=dm(o,l),u=cm(e.modelProvider),p=e.verboseLevel??"",g=e.reasoningLevel??"",h=e.displayName??e.key,d=e.kind!=="global",f=d?`${Ni("chat",t)}?session=${encodeURIComponent(e.key)}`:null;return r`
|
|
4315
4324
|
<div class="table-row">
|
|
4316
4325
|
<div class="mono">${d?r`<a href=${f} class="session-link">${h}</a>`:h}</div>
|
|
4317
4326
|
<div>
|
|
@@ -4324,12 +4333,12 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4324
4333
|
</div>
|
|
4325
4334
|
<div>${e.kind}</div>
|
|
4326
4335
|
<div>${a}</div>
|
|
4327
|
-
<div>${
|
|
4336
|
+
<div>${Ug(e)}</div>
|
|
4328
4337
|
<div>
|
|
4329
4338
|
<select
|
|
4330
4339
|
.value=${c}
|
|
4331
4340
|
?disabled=${i}
|
|
4332
|
-
@change=${m=>{const k=m.target.value;n(e.key,{thinkingLevel:
|
|
4341
|
+
@change=${m=>{const k=m.target.value;n(e.key,{thinkingLevel:um(k,l)})}}
|
|
4333
4342
|
>
|
|
4334
4343
|
${u.map(m=>r`<option value=${m}>${m||"inherit"}</option>`)}
|
|
4335
4344
|
</select>
|
|
@@ -4340,7 +4349,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4340
4349
|
?disabled=${i}
|
|
4341
4350
|
@change=${m=>{const k=m.target.value;n(e.key,{verboseLevel:k||null})}}
|
|
4342
4351
|
>
|
|
4343
|
-
${
|
|
4352
|
+
${om.map(m=>r`<option value=${m.value}>${m.label}</option>`)}
|
|
4344
4353
|
</select>
|
|
4345
4354
|
</div>
|
|
4346
4355
|
<div>
|
|
@@ -4349,7 +4358,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4349
4358
|
?disabled=${i}
|
|
4350
4359
|
@change=${m=>{const k=m.target.value;n(e.key,{reasoningLevel:k||null})}}
|
|
4351
4360
|
>
|
|
4352
|
-
${
|
|
4361
|
+
${rm.map(m=>r`<option value=${m}>${m||"inherit"}</option>`)}
|
|
4353
4362
|
</select>
|
|
4354
4363
|
</div>
|
|
4355
4364
|
<div>
|
|
@@ -4358,7 +4367,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4358
4367
|
</button>
|
|
4359
4368
|
</div>
|
|
4360
4369
|
</div>
|
|
4361
|
-
`}const
|
|
4370
|
+
`}const Cn=[{id:"workspace",label:"Workspace Skills",sources:["cryptoclaw-workspace"]},{id:"built-in",label:"Built-in Skills",sources:["cryptoclaw-bundled"]},{id:"installed",label:"Installed Skills",sources:["cryptoclaw-managed"]},{id:"extra",label:"Extra Skills",sources:["cryptoclaw-extra"]}];function fm(e){const t=new Map;for(const a of Cn)t.set(a.id,{id:a.id,label:a.label,skills:[]});const n=Cn.find(a=>a.id==="built-in"),s={id:"other",label:"Other Skills",skills:[]};for(const a of e){const o=a.bundled?n:Cn.find(l=>l.sources.includes(a.source));o?t.get(o.id)?.skills.push(a):s.skills.push(a)}const i=Cn.map(a=>t.get(a.id)).filter(a=>!!(a&&a.skills.length>0));return s.skills.length>0&&i.push(s),i}function hm(e){const t=e.report?.skills??[],n=e.filter.trim().toLowerCase(),s=n?t.filter(a=>[a.name,a.description,a.source].join(" ").toLowerCase().includes(n)):t,i=fm(s);return r`
|
|
4362
4371
|
<section class="card">
|
|
4363
4372
|
<div class="row" style="justify-content: space-between;">
|
|
4364
4373
|
<div>
|
|
@@ -4395,20 +4404,20 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4395
4404
|
<span class="muted">${a.skills.length}</span>
|
|
4396
4405
|
</summary>
|
|
4397
4406
|
<div class="list skills-grid">
|
|
4398
|
-
${a.skills.map(l=>
|
|
4407
|
+
${a.skills.map(l=>vm(l,e))}
|
|
4399
4408
|
</div>
|
|
4400
4409
|
</details>
|
|
4401
4410
|
`})}
|
|
4402
4411
|
</div>
|
|
4403
4412
|
`}
|
|
4404
4413
|
</section>
|
|
4405
|
-
`}function
|
|
4414
|
+
`}function vm(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.bundled&&e.source!=="cryptoclaw-bundled"),l=[...e.missing.bins.map(u=>`bin:${u}`),...e.missing.env.map(u=>`env:${u}`),...e.missing.config.map(u=>`config:${u}`),...e.missing.os.map(u=>`os:${u}`)],c=[];return e.disabled&&c.push("disabled"),e.blockedByAllowlist&&c.push("blocked by allowlist"),r`
|
|
4406
4415
|
<div class="list-item">
|
|
4407
4416
|
<div class="list-main">
|
|
4408
4417
|
<div class="list-title">
|
|
4409
4418
|
${e.emoji?`${e.emoji} `:""}${e.name}
|
|
4410
4419
|
</div>
|
|
4411
|
-
<div class="list-sub">${
|
|
4420
|
+
<div class="list-sub">${Gs(e.description,140)}</div>
|
|
4412
4421
|
<div class="chip-row" style="margin-top: 6px;">
|
|
4413
4422
|
<span class="chip">${e.source}</span>
|
|
4414
4423
|
${o?r`
|
|
@@ -4475,9 +4484,9 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4475
4484
|
`:v}
|
|
4476
4485
|
</div>
|
|
4477
4486
|
</div>
|
|
4478
|
-
`}const
|
|
4487
|
+
`}const mm=new Set(["agent","channel","chat","provider","model","tool","label","key","session","id","has","mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"]),jn=e=>e.trim().toLowerCase(),bm=e=>{const t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(`^${t}$`,"i")},ot=e=>{let t=e.trim().toLowerCase();if(!t)return null;t.startsWith("$")&&(t=t.slice(1));let n=1;t.endsWith("k")?(n=1e3,t=t.slice(0,-1)):t.endsWith("m")&&(n=1e6,t=t.slice(0,-1));const s=Number(t);return Number.isFinite(s)?s*n:null},sa=e=>(e.match(/"[^"]+"|\S+/g)??[]).map(n=>{const s=n.replace(/^"|"$/g,""),i=s.indexOf(":");if(i>0){const a=s.slice(0,i),o=s.slice(i+1);return{key:a,value:o,raw:s}}return{value:s,raw:s}}),ym=e=>[e.label,e.key,e.sessionId].filter(n=>!!n).map(n=>n.toLowerCase()),jo=e=>{const t=new Set;e.modelProvider&&t.add(e.modelProvider.toLowerCase()),e.providerOverride&&t.add(e.providerOverride.toLowerCase()),e.origin?.provider&&t.add(e.origin.provider.toLowerCase());for(const n of e.usage?.modelUsage??[])n.provider&&t.add(n.provider.toLowerCase());return Array.from(t)},Wo=e=>{const t=new Set;e.model&&t.add(e.model.toLowerCase());for(const n of e.usage?.modelUsage??[])n.model&&t.add(n.model.toLowerCase());return Array.from(t)},xm=e=>(e.usage?.toolUsage?.tools??[]).map(t=>t.name.toLowerCase()),$m=(e,t)=>{const n=jn(t.value??"");if(!n)return!0;if(!t.key)return ym(e).some(i=>i.includes(n));switch(jn(t.key)){case"agent":return e.agentId?.toLowerCase().includes(n)??!1;case"channel":return e.channel?.toLowerCase().includes(n)??!1;case"chat":return e.chatType?.toLowerCase().includes(n)??!1;case"provider":return jo(e).some(i=>i.includes(n));case"model":return Wo(e).some(i=>i.includes(n));case"tool":return xm(e).some(i=>i.includes(n));case"label":return e.label?.toLowerCase().includes(n)??!1;case"key":case"session":case"id":if(n.includes("*")||n.includes("?")){const i=bm(n);return i.test(e.key)||(e.sessionId?i.test(e.sessionId):!1)}return e.key.toLowerCase().includes(n)||(e.sessionId?.toLowerCase().includes(n)??!1);case"has":switch(n){case"tools":return(e.usage?.toolUsage?.totalCalls??0)>0;case"errors":return(e.usage?.messageCounts?.errors??0)>0;case"context":return!!e.contextWeight;case"usage":return!!e.usage;case"model":return Wo(e).length>0;case"provider":return jo(e).length>0;default:return!0}case"mintokens":{const i=ot(n);return i===null?!0:(e.usage?.totalTokens??0)>=i}case"maxtokens":{const i=ot(n);return i===null?!0:(e.usage?.totalTokens??0)<=i}case"mincost":{const i=ot(n);return i===null?!0:(e.usage?.totalCost??0)>=i}case"maxcost":{const i=ot(n);return i===null?!0:(e.usage?.totalCost??0)<=i}case"minmessages":{const i=ot(n);return i===null?!0:(e.usage?.messageCounts?.total??0)>=i}case"maxmessages":{const i=ot(n);return i===null?!0:(e.usage?.messageCounts?.total??0)<=i}default:return!0}},wm=(e,t)=>{const n=sa(t);if(n.length===0)return{sessions:e,warnings:[]};const s=[];for(const a of n){if(!a.key)continue;const o=jn(a.key);if(!mm.has(o)){s.push(`Unknown filter: ${a.key}`);continue}if(a.value===""&&s.push(`Missing value for ${a.key}`),o==="has"){const l=new Set(["tools","errors","context","usage","model","provider"]);a.value&&!l.has(jn(a.value))&&s.push(`Unknown has:${a.value}`)}["mintokens","maxtokens","mincost","maxcost","minmessages","maxmessages"].includes(o)&&a.value&&ot(a.value)===null&&s.push(`Invalid number for ${a.key}`)}return{sessions:e.filter(a=>n.every(o=>$m(a,o))),warnings:s}};function km(e){const t=e.split(`
|
|
4479
4488
|
`),n=new Map,s=[];for(const l of t){const c=/^\[Tool:\s*([^\]]+)\]/.exec(l.trim());if(c){const u=c[1];n.set(u,(n.get(u)??0)+1);continue}l.trim().startsWith("[Tool Result]")||s.push(l)}const i=Array.from(n.entries()).toSorted((l,c)=>c[1]-l[1]),a=i.reduce((l,[,c])=>l+c,0),o=i.length>0?`Tools: ${i.map(([l,c])=>`${l}×${c}`).join(", ")} (${a} calls)`:"";return{tools:i,summary:o,cleanContent:s.join(`
|
|
4480
|
-
`).trim()}}const
|
|
4489
|
+
`).trim()}}const Sm=`
|
|
4481
4490
|
.usage-page-header {
|
|
4482
4491
|
margin: 4px 0 12px;
|
|
4483
4492
|
}
|
|
@@ -4533,16 +4542,16 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4533
4542
|
align-items: center;
|
|
4534
4543
|
gap: 6px;
|
|
4535
4544
|
padding: 4px 10px;
|
|
4536
|
-
background: rgba(
|
|
4545
|
+
background: rgba(0, 230, 118, 0.1);
|
|
4537
4546
|
border-radius: 4px;
|
|
4538
4547
|
font-size: 12px;
|
|
4539
|
-
color: #
|
|
4548
|
+
color: #00e676;
|
|
4540
4549
|
}
|
|
4541
4550
|
.usage-refresh-indicator::before {
|
|
4542
4551
|
content: "";
|
|
4543
4552
|
width: 10px;
|
|
4544
4553
|
height: 10px;
|
|
4545
|
-
border: 2px solid #
|
|
4554
|
+
border: 2px solid #00e676;
|
|
4546
4555
|
border-top-color: transparent;
|
|
4547
4556
|
border-radius: 50%;
|
|
4548
4557
|
animation: usage-spin 0.6s linear infinite;
|
|
@@ -4640,36 +4649,36 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
4640
4649
|
border-color: var(--border-strong);
|
|
4641
4650
|
}
|
|
4642
4651
|
.usage-primary-btn {
|
|
4643
|
-
background: #
|
|
4644
|
-
color: #
|
|
4645
|
-
border-color: #
|
|
4652
|
+
background: #00e676;
|
|
4653
|
+
color: #050810;
|
|
4654
|
+
border-color: #00e676;
|
|
4646
4655
|
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
|
|
4647
4656
|
}
|
|
4648
4657
|
.btn.usage-primary-btn {
|
|
4649
|
-
background: #
|
|
4650
|
-
border-color: #
|
|
4651
|
-
color: #
|
|
4658
|
+
background: #00e676 !important;
|
|
4659
|
+
border-color: #00e676 !important;
|
|
4660
|
+
color: #050810 !important;
|
|
4652
4661
|
}
|
|
4653
4662
|
.usage-primary-btn:hover {
|
|
4654
|
-
background: #
|
|
4655
|
-
border-color: #
|
|
4663
|
+
background: #00c853;
|
|
4664
|
+
border-color: #00c853;
|
|
4656
4665
|
}
|
|
4657
4666
|
.btn.usage-primary-btn:hover {
|
|
4658
|
-
background: #
|
|
4659
|
-
border-color: #
|
|
4667
|
+
background: #00c853 !important;
|
|
4668
|
+
border-color: #00c853 !important;
|
|
4660
4669
|
}
|
|
4661
4670
|
.usage-primary-btn:disabled {
|
|
4662
|
-
background: rgba(
|
|
4663
|
-
border-color: rgba(
|
|
4664
|
-
color: #
|
|
4671
|
+
background: rgba(0, 230, 118, 0.18);
|
|
4672
|
+
border-color: rgba(0, 230, 118, 0.3);
|
|
4673
|
+
color: #00e676;
|
|
4665
4674
|
box-shadow: none;
|
|
4666
4675
|
cursor: default;
|
|
4667
4676
|
opacity: 1;
|
|
4668
4677
|
}
|
|
4669
4678
|
.usage-primary-btn[disabled] {
|
|
4670
|
-
background: rgba(
|
|
4671
|
-
border-color: rgba(
|
|
4672
|
-
color: #
|
|
4679
|
+
background: rgba(0, 230, 118, 0.18) !important;
|
|
4680
|
+
border-color: rgba(0, 230, 118, 0.3) !important;
|
|
4681
|
+
color: #00e676 !important;
|
|
4673
4682
|
opacity: 1 !important;
|
|
4674
4683
|
}
|
|
4675
4684
|
.usage-secondary-btn {
|
|
@@ -5012,8 +5021,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5012
5021
|
border-radius: 8px;
|
|
5013
5022
|
padding: 10px;
|
|
5014
5023
|
color: var(--text);
|
|
5015
|
-
background: rgba(
|
|
5016
|
-
border: 1px solid rgba(
|
|
5024
|
+
background: rgba(0, 230, 118, 0.08);
|
|
5025
|
+
border: 1px solid rgba(0, 230, 118, 0.2);
|
|
5017
5026
|
display: flex;
|
|
5018
5027
|
flex-direction: column;
|
|
5019
5028
|
gap: 4px;
|
|
@@ -5033,14 +5042,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5033
5042
|
.usage-hour-cell {
|
|
5034
5043
|
height: 28px;
|
|
5035
5044
|
border-radius: 6px;
|
|
5036
|
-
background: rgba(
|
|
5037
|
-
border: 1px solid rgba(
|
|
5045
|
+
background: rgba(0, 230, 118, 0.1);
|
|
5046
|
+
border: 1px solid rgba(0, 230, 118, 0.2);
|
|
5038
5047
|
cursor: pointer;
|
|
5039
5048
|
transition: border-color 0.15s, box-shadow 0.15s;
|
|
5040
5049
|
}
|
|
5041
5050
|
.usage-hour-cell.selected {
|
|
5042
|
-
border-color: rgba(
|
|
5043
|
-
box-shadow: 0 0 0 2px rgba(
|
|
5051
|
+
border-color: rgba(0, 230, 118, 0.8);
|
|
5052
|
+
box-shadow: 0 0 0 2px rgba(0, 230, 118, 0.2);
|
|
5044
5053
|
}
|
|
5045
5054
|
.usage-hour-labels {
|
|
5046
5055
|
display: grid;
|
|
@@ -5063,8 +5072,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5063
5072
|
width: 14px;
|
|
5064
5073
|
height: 10px;
|
|
5065
5074
|
border-radius: 4px;
|
|
5066
|
-
background: rgba(
|
|
5067
|
-
border: 1px solid rgba(
|
|
5075
|
+
background: rgba(0, 230, 118, 0.15);
|
|
5076
|
+
border: 1px solid rgba(0, 230, 118, 0.2);
|
|
5068
5077
|
}
|
|
5069
5078
|
.usage-calendar-labels {
|
|
5070
5079
|
display: grid;
|
|
@@ -5082,8 +5091,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5082
5091
|
.usage-calendar-cell {
|
|
5083
5092
|
height: 18px;
|
|
5084
5093
|
border-radius: 4px;
|
|
5085
|
-
border: 1px solid rgba(
|
|
5086
|
-
background: rgba(
|
|
5094
|
+
border: 1px solid rgba(0, 230, 118, 0.2);
|
|
5095
|
+
background: rgba(0, 230, 118, 0.08);
|
|
5087
5096
|
}
|
|
5088
5097
|
.usage-calendar-cell.empty {
|
|
5089
5098
|
background: transparent;
|
|
@@ -5278,8 +5287,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5278
5287
|
color: var(--text);
|
|
5279
5288
|
}
|
|
5280
5289
|
.chart-toggle .toggle-btn.active {
|
|
5281
|
-
background: #
|
|
5282
|
-
color:
|
|
5290
|
+
background: #00e676;
|
|
5291
|
+
color: #050810;
|
|
5283
5292
|
}
|
|
5284
5293
|
.chart-toggle.small .toggle-btn {
|
|
5285
5294
|
padding: 4px 8px;
|
|
@@ -5335,14 +5344,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5335
5344
|
.daily-bar {
|
|
5336
5345
|
width: 100%;
|
|
5337
5346
|
max-width: var(--bar-max-width, 32px);
|
|
5338
|
-
background: #
|
|
5347
|
+
background: #00e676;
|
|
5339
5348
|
border-radius: 3px 3px 0 0;
|
|
5340
5349
|
min-height: 2px;
|
|
5341
5350
|
transition: all 0.15s;
|
|
5342
5351
|
overflow: hidden;
|
|
5343
5352
|
}
|
|
5344
5353
|
.daily-bar-wrapper:hover .daily-bar {
|
|
5345
|
-
background: #
|
|
5354
|
+
background: #00c853;
|
|
5346
5355
|
}
|
|
5347
5356
|
.daily-bar-label {
|
|
5348
5357
|
position: absolute;
|
|
@@ -5460,7 +5469,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5460
5469
|
background: #06b6d4;
|
|
5461
5470
|
}
|
|
5462
5471
|
.legend-dot.system {
|
|
5463
|
-
background: #
|
|
5472
|
+
background: #00e676;
|
|
5464
5473
|
}
|
|
5465
5474
|
.legend-dot.skills {
|
|
5466
5475
|
background: #8b5cf6;
|
|
@@ -5538,7 +5547,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5538
5547
|
}
|
|
5539
5548
|
.session-bar-fill {
|
|
5540
5549
|
height: 100%;
|
|
5541
|
-
background: rgba(
|
|
5550
|
+
background: rgba(0, 230, 118, 0.7);
|
|
5542
5551
|
border-radius: 4px;
|
|
5543
5552
|
transition: width 0.3s ease;
|
|
5544
5553
|
}
|
|
@@ -5609,27 +5618,27 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5609
5618
|
fill: var(--text-muted);
|
|
5610
5619
|
}
|
|
5611
5620
|
.timeseries-svg .ts-area {
|
|
5612
|
-
fill: #
|
|
5621
|
+
fill: #00e676;
|
|
5613
5622
|
fill-opacity: 0.1;
|
|
5614
5623
|
}
|
|
5615
5624
|
.timeseries-svg .ts-line {
|
|
5616
5625
|
fill: none;
|
|
5617
|
-
stroke: #
|
|
5626
|
+
stroke: #00e676;
|
|
5618
5627
|
stroke-width: 2;
|
|
5619
5628
|
}
|
|
5620
5629
|
.timeseries-svg .ts-dot {
|
|
5621
|
-
fill: #
|
|
5630
|
+
fill: #00e676;
|
|
5622
5631
|
transition: r 0.15s, fill 0.15s;
|
|
5623
5632
|
}
|
|
5624
5633
|
.timeseries-svg .ts-dot:hover {
|
|
5625
5634
|
r: 5;
|
|
5626
5635
|
}
|
|
5627
5636
|
.timeseries-svg .ts-bar {
|
|
5628
|
-
fill: #
|
|
5637
|
+
fill: #00e676;
|
|
5629
5638
|
transition: fill 0.15s;
|
|
5630
5639
|
}
|
|
5631
5640
|
.timeseries-svg .ts-bar:hover {
|
|
5632
|
-
fill: #
|
|
5641
|
+
fill: #00c853;
|
|
5633
5642
|
}
|
|
5634
5643
|
.timeseries-svg .ts-bar.output { fill: #ef4444; }
|
|
5635
5644
|
.timeseries-svg .ts-bar.input { fill: #f59e0b; }
|
|
@@ -5760,7 +5769,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5760
5769
|
transition: width 0.3s ease;
|
|
5761
5770
|
}
|
|
5762
5771
|
.context-segment.system {
|
|
5763
|
-
background: #
|
|
5772
|
+
background: #00e676;
|
|
5764
5773
|
}
|
|
5765
5774
|
.context-segment.skills {
|
|
5766
5775
|
background: #8b5cf6;
|
|
@@ -5999,7 +6008,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
5999
6008
|
.sessions-card .session-bar-row.selected {
|
|
6000
6009
|
border-color: var(--accent);
|
|
6001
6010
|
background: var(--accent-subtle);
|
|
6002
|
-
box-shadow: inset 0 0 0 1px rgba(
|
|
6011
|
+
box-shadow: inset 0 0 0 1px rgba(0, 230, 118, 0.15);
|
|
6003
6012
|
}
|
|
6004
6013
|
.sessions-card .session-bar-label {
|
|
6005
6014
|
flex: 1 1 auto;
|
|
@@ -6017,7 +6026,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6017
6026
|
opacity: 0.5;
|
|
6018
6027
|
}
|
|
6019
6028
|
.sessions-card .session-bar-fill {
|
|
6020
|
-
background: rgba(
|
|
6029
|
+
background: rgba(0, 230, 118, 0.55);
|
|
6021
6030
|
}
|
|
6022
6031
|
.sessions-clear-btn {
|
|
6023
6032
|
margin-left: auto;
|
|
@@ -6387,7 +6396,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6387
6396
|
height: 22px;
|
|
6388
6397
|
}
|
|
6389
6398
|
}
|
|
6390
|
-
`,
|
|
6399
|
+
`,Am=4;function it(e){return Math.round(e/Am)}function O(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Cm(e){const t=new Date;return t.setHours(e,0,0,0),t.toLocaleTimeString(void 0,{hour:"numeric"})}function Tm(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:24},()=>0);for(const i of e){const a=i.usage;if(!a?.messageCounts||a.messageCounts.total===0)continue;const o=a.firstActivity??i.updatedAt,l=a.lastActivity??i.updatedAt;if(!o||!l)continue;const c=Math.min(o,l),u=Math.max(o,l),g=Math.max(u-c,1)/6e4;let h=c;for(;h<u;){const d=new Date(h),f=ia(d,t),m=aa(d,t),k=Math.min(m.getTime(),u),w=Math.max((k-h)/6e4,0)/g;n[f]+=a.messageCounts.errors*w,s[f]+=a.messageCounts.total*w,h=k+1}}return s.map((i,a)=>{const o=n[a],l=i>0?o/i:0;return{hour:a,rate:l,errors:o,msgs:i}}).filter(i=>i.msgs>0&&i.errors>0).toSorted((i,a)=>a.rate-i.rate).slice(0,5).map(i=>({label:Cm(i.hour),value:`${(i.rate*100).toFixed(2)}%`,sub:`${Math.round(i.errors)} errors · ${Math.round(i.msgs)} msgs`}))}const _m=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function ia(e,t){return t==="utc"?e.getUTCHours():e.getHours()}function Em(e,t){return t==="utc"?e.getUTCDay():e.getDay()}function aa(e,t){const n=new Date(e);return t==="utc"?n.setUTCMinutes(59,59,999):n.setMinutes(59,59,999),n}function Lm(e,t){const n=Array.from({length:24},()=>0),s=Array.from({length:7},()=>0);let i=0,a=!1;for(const l of e){const c=l.usage;if(!c||!c.totalTokens||c.totalTokens<=0)continue;i+=c.totalTokens;const u=c.firstActivity??l.updatedAt,p=c.lastActivity??l.updatedAt;if(!u||!p)continue;a=!0;const g=Math.min(u,p),h=Math.max(u,p),f=Math.max(h-g,1)/6e4;let m=g;for(;m<h;){const k=new Date(m),S=ia(k,t),w=Em(k,t),C=aa(k,t),A=Math.min(C.getTime(),h),T=Math.max((A-m)/6e4,0)/f;n[S]+=c.totalTokens*T,s[w]+=c.totalTokens*T,m=A+1}}const o=_m.map((l,c)=>({label:l,tokens:s[c]}));return{hasData:a,totalTokens:i,hourTotals:n,weekdayTotals:o}}function Mm(e,t,n,s){const i=Lm(e,t);if(!i.hasData)return r`
|
|
6391
6400
|
<div class="card usage-mosaic">
|
|
6392
6401
|
<div class="usage-mosaic-header">
|
|
6393
6402
|
<div>
|
|
@@ -6413,7 +6422,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6413
6422
|
<div class="usage-mosaic-section">
|
|
6414
6423
|
<div class="usage-mosaic-section-title">Day of Week</div>
|
|
6415
6424
|
<div class="usage-daypart-grid">
|
|
6416
|
-
${i.weekdayTotals.map(l=>{const c=Math.min(l.tokens/o,1),u=l.tokens>0?`rgba(
|
|
6425
|
+
${i.weekdayTotals.map(l=>{const c=Math.min(l.tokens/o,1),u=l.tokens>0?`rgba(0, 230, 118, ${.12+c*.6})`:"transparent";return r`
|
|
6417
6426
|
<div class="usage-daypart-cell" style="background: ${u};">
|
|
6418
6427
|
<div class="usage-daypart-label">${l.label}</div>
|
|
6419
6428
|
<div class="usage-daypart-value">${O(l.tokens)}</div>
|
|
@@ -6427,7 +6436,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6427
6436
|
<span class="usage-mosaic-sub">0 → 23</span>
|
|
6428
6437
|
</div>
|
|
6429
6438
|
<div class="usage-hour-grid">
|
|
6430
|
-
${i.hourTotals.map((l,c)=>{const u=Math.min(l/a,1),p=l>0?`rgba(
|
|
6439
|
+
${i.hourTotals.map((l,c)=>{const u=Math.min(l/a,1),p=l>0?`rgba(0, 230, 118, ${.08+u*.7})`:"transparent",g=`${c}:00 · ${O(l)} tokens`,h=u>.7?"rgba(0, 230, 118, 0.6)":"rgba(0, 230, 118, 0.2)",d=n.includes(c);return r`
|
|
6431
6440
|
<div
|
|
6432
6441
|
class="usage-hour-cell ${d?"selected":""}"
|
|
6433
6442
|
style="background: ${p}; border-color: ${h};"
|
|
@@ -6451,10 +6460,10 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6451
6460
|
</div>
|
|
6452
6461
|
</div>
|
|
6453
6462
|
</div>
|
|
6454
|
-
`}function q(e,t=2){return`$${e.toFixed(t)}`}function
|
|
6455
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}function
|
|
6456
|
-
`)},
|
|
6457
|
-
`)},
|
|
6463
|
+
`}function q(e,t=2){return`$${e.toFixed(t)}`}function Us(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Im(e){return!e||e<=0?"0s":e>=6e4?`${Math.round(e/6e4)}m`:e>=1e3?`${Math.round(e/1e3)}s`:`${Math.round(e)}ms`}function Ol(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const[,n,s,i]=t,a=new Date(Date.UTC(Number(n),Number(s)-1,Number(i)));return Number.isNaN(a.valueOf())?null:a}function Bl(e){const t=Ol(e);return t?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):e}function Rm(e){const t=Ol(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"}):e}function Ul(e){if(!e||e<=0)return"—";const t=Math.round(e/1e3),n=t%60,s=Math.floor(t/60)%60,i=Math.floor(t/3600);return i>0?`${i}h ${s}m`:s>0?`${s}m ${n}s`:`${n}s`}function zs(e,t,n="text/plain"){const s=new Blob([t],{type:n}),i=URL.createObjectURL(s),a=document.createElement("a");a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function Pm(e){return e.includes('"')||e.includes(",")||e.includes(`
|
|
6464
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function Wn(e){return e.map(t=>t==null?"":Pm(String(t))).join(",")}const Tn=()=>({input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),_n=(e,t)=>{e.input+=t.input??0,e.output+=t.output??0,e.cacheRead+=t.cacheRead??0,e.cacheWrite+=t.cacheWrite??0,e.totalTokens+=t.totalTokens??0,e.totalCost+=t.totalCost??0,e.inputCost+=t.inputCost??0,e.outputCost+=t.outputCost??0,e.cacheReadCost+=t.cacheReadCost??0,e.cacheWriteCost+=t.cacheWriteCost??0,e.missingCostEntries+=t.missingCostEntries??0},Dm=(e,t)=>{if(e.length===0)return t??{messages:{total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},tools:{totalCalls:0,uniqueTools:0,tools:[]},byModel:[],byProvider:[],byAgent:[],byChannel:[],daily:[]};const n={total:0,user:0,assistant:0,toolCalls:0,toolResults:0,errors:0},s=new Map,i=new Map,a=new Map,o=new Map,l=new Map,c=new Map,u=new Map,p=new Map,g={count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};for(const h of e){const d=h.usage;if(d){if(d.messageCounts&&(n.total+=d.messageCounts.total,n.user+=d.messageCounts.user,n.assistant+=d.messageCounts.assistant,n.toolCalls+=d.messageCounts.toolCalls,n.toolResults+=d.messageCounts.toolResults,n.errors+=d.messageCounts.errors),d.toolUsage)for(const f of d.toolUsage.tools)s.set(f.name,(s.get(f.name)??0)+f.count);if(d.modelUsage)for(const f of d.modelUsage){const m=`${f.provider??"unknown"}::${f.model??"unknown"}`,k=i.get(m)??{provider:f.provider,model:f.model,count:0,totals:Tn()};k.count+=f.count,_n(k.totals,f.totals),i.set(m,k);const S=f.provider??"unknown",w=a.get(S)??{provider:f.provider,model:void 0,count:0,totals:Tn()};w.count+=f.count,_n(w.totals,f.totals),a.set(S,w)}if(d.latency){const{count:f,avgMs:m,minMs:k,maxMs:S,p95Ms:w}=d.latency;f>0&&(g.count+=f,g.sum+=m*f,g.min=Math.min(g.min,k),g.max=Math.max(g.max,S),g.p95Max=Math.max(g.p95Max,w))}if(h.agentId){const f=o.get(h.agentId)??Tn();_n(f,d),o.set(h.agentId,f)}if(h.channel){const f=l.get(h.channel)??Tn();_n(f,d),l.set(h.channel,f)}for(const f of d.dailyBreakdown??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.tokens+=f.tokens,m.cost+=f.cost,c.set(f.date,m)}for(const f of d.dailyMessageCounts??[]){const m=c.get(f.date)??{date:f.date,tokens:0,cost:0,messages:0,toolCalls:0,errors:0};m.messages+=f.total,m.toolCalls+=f.toolCalls,m.errors+=f.errors,c.set(f.date,m)}for(const f of d.dailyLatency??[]){const m=u.get(f.date)??{date:f.date,count:0,sum:0,min:Number.POSITIVE_INFINITY,max:0,p95Max:0};m.count+=f.count,m.sum+=f.avgMs*f.count,m.min=Math.min(m.min,f.minMs),m.max=Math.max(m.max,f.maxMs),m.p95Max=Math.max(m.p95Max,f.p95Ms),u.set(f.date,m)}for(const f of d.dailyModelUsage??[]){const m=`${f.date}::${f.provider??"unknown"}::${f.model??"unknown"}`,k=p.get(m)??{date:f.date,provider:f.provider,model:f.model,tokens:0,cost:0,count:0};k.tokens+=f.tokens,k.cost+=f.cost,k.count+=f.count,p.set(m,k)}}}return{messages:n,tools:{totalCalls:Array.from(s.values()).reduce((h,d)=>h+d,0),uniqueTools:s.size,tools:Array.from(s.entries()).map(([h,d])=>({name:h,count:d})).toSorted((h,d)=>d.count-h.count)},byModel:Array.from(i.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byProvider:Array.from(a.values()).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byAgent:Array.from(o.entries()).map(([h,d])=>({agentId:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),byChannel:Array.from(l.entries()).map(([h,d])=>({channel:h,totals:d})).toSorted((h,d)=>d.totals.totalCost-h.totals.totalCost),latency:g.count>0?{count:g.count,avgMs:g.sum/g.count,minMs:g.min===Number.POSITIVE_INFINITY?0:g.min,maxMs:g.max,p95Ms:g.p95Max}:void 0,dailyLatency:Array.from(u.values()).map(h=>({date:h.date,count:h.count,avgMs:h.count?h.sum/h.count:0,minMs:h.min===Number.POSITIVE_INFINITY?0:h.min,maxMs:h.max,p95Ms:h.p95Max})).toSorted((h,d)=>h.date.localeCompare(d.date)),modelDaily:Array.from(p.values()).toSorted((h,d)=>h.date.localeCompare(d.date)||d.cost-h.cost),daily:Array.from(c.values()).toSorted((h,d)=>h.date.localeCompare(d.date))}},Fm=(e,t,n)=>{let s=0,i=0;for(const p of e){const g=p.usage?.durationMs??0;g>0&&(s+=g,i+=1)}const a=i?s/i:0,o=t&&s>0?t.totalTokens/(s/6e4):void 0,l=t&&s>0?t.totalCost/(s/6e4):void 0,c=n.messages.total?n.messages.errors/n.messages.total:0,u=n.daily.filter(p=>p.messages>0&&p.errors>0).map(p=>({date:p.date,errors:p.errors,messages:p.messages,rate:p.errors/p.messages})).toSorted((p,g)=>g.rate-p.rate||g.errors-p.errors)[0];return{durationSumMs:s,durationCount:i,avgDurationMs:a,throughputTokensPerMin:o,throughputCostPerMin:l,errorRate:c,peakErrorDay:u}},Nm=e=>{const t=[Wn(["key","label","agentId","channel","provider","model","updatedAt","durationMs","messages","errors","toolCalls","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","totalCost"])];for(const n of e){const s=n.usage;t.push(Wn([n.key,n.label??"",n.agentId??"",n.channel??"",n.modelProvider??n.providerOverride??"",n.model??n.modelOverride??"",n.updatedAt?new Date(n.updatedAt).toISOString():"",s?.durationMs??"",s?.messageCounts?.total??"",s?.messageCounts?.errors??"",s?.messageCounts?.toolCalls??"",s?.input??"",s?.output??"",s?.cacheRead??"",s?.cacheWrite??"",s?.totalTokens??"",s?.totalCost??""]))}return t.join(`
|
|
6465
|
+
`)},Om=e=>{const t=[Wn(["date","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","totalTokens","inputCost","outputCost","cacheReadCost","cacheWriteCost","totalCost"])];for(const n of e)t.push(Wn([n.date,n.input,n.output,n.cacheRead,n.cacheWrite,n.totalTokens,n.inputCost??"",n.outputCost??"",n.cacheReadCost??"",n.cacheWriteCost??"",n.totalCost]));return t.join(`
|
|
6466
|
+
`)},Bm=(e,t,n)=>{const s=e.trim();if(!s)return[];const i=s.length?s.split(/\s+/):[],a=i.length?i[i.length-1]:"",[o,l]=a.includes(":")?[a.slice(0,a.indexOf(":")),a.slice(a.indexOf(":")+1)]:["",""],c=o.toLowerCase(),u=l.toLowerCase(),p=w=>{const C=new Set;for(const A of w)A&&C.add(A);return Array.from(C)},g=p(t.map(w=>w.agentId)).slice(0,6),h=p(t.map(w=>w.channel)).slice(0,6),d=p([...t.map(w=>w.modelProvider),...t.map(w=>w.providerOverride),...n?.byProvider.map(w=>w.provider)??[]]).slice(0,6),f=p([...t.map(w=>w.model),...n?.byModel.map(w=>w.model)??[]]).slice(0,6),m=p(n?.tools.tools.map(w=>w.name)??[]).slice(0,6);if(!c)return[{label:"agent:",value:"agent:"},{label:"channel:",value:"channel:"},{label:"provider:",value:"provider:"},{label:"model:",value:"model:"},{label:"tool:",value:"tool:"},{label:"has:errors",value:"has:errors"},{label:"has:tools",value:"has:tools"},{label:"minTokens:",value:"minTokens:"},{label:"maxCost:",value:"maxCost:"}];const k=[],S=(w,C)=>{for(const A of C)(!u||A.toLowerCase().includes(u))&&k.push({label:`${w}:${A}`,value:`${w}:${A}`})};switch(c){case"agent":S("agent",g);break;case"channel":S("channel",h);break;case"provider":S("provider",d);break;case"model":S("model",f);break;case"tool":S("tool",m);break;case"has":["errors","tools","context","usage","model","provider"].forEach(w=>{(!u||w.includes(u))&&k.push({label:`has:${w}`,value:`has:${w}`})});break}return k},Um=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/);return s[s.length-1]=t,`${s.join(" ")} `},rt=e=>e.trim().toLowerCase(),zm=(e,t)=>{const n=e.trim();if(!n)return`${t} `;const s=n.split(/\s+/),i=s[s.length-1]??"",a=t.includes(":")?t.split(":")[0]:null,o=i.includes(":")?i.split(":")[0]:null;return i.endsWith(":")&&a&&o===a?(s[s.length-1]=t,`${s.join(" ")} `):s.includes(t)?`${s.join(" ")} `:`${s.join(" ")} ${t} `},qo=(e,t)=>{const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>i!==t);return s.length?`${s.join(" ")} `:""},Go=(e,t,n)=>{const s=rt(t),a=[...sa(e).filter(o=>rt(o.key??"")!==s).map(o=>o.raw),...n.map(o=>`${t}:${o}`)];return a.length?`${a.join(" ")} `:""};function ge(e,t){return t===0?0:e/t*100}function Hm(e){const t=e.totalCost||0;return{input:{tokens:e.input,cost:e.inputCost||0,pct:ge(e.inputCost||0,t)},output:{tokens:e.output,cost:e.outputCost||0,pct:ge(e.outputCost||0,t)},cacheRead:{tokens:e.cacheRead,cost:e.cacheReadCost||0,pct:ge(e.cacheReadCost||0,t)},cacheWrite:{tokens:e.cacheWrite,cost:e.cacheWriteCost||0,pct:ge(e.cacheWriteCost||0,t)},totalCost:t}}function Km(e,t,n,s,i,a,o,l){if(!(e.length>0||t.length>0||n.length>0))return v;const u=n.length===1?s.find(f=>f.key===n[0]):null,p=u?(u.label||u.key).slice(0,20)+((u.label||u.key).length>20?"…":""):n.length===1?n[0].slice(0,8)+"…":`${n.length} sessions`,g=u?u.label||u.key:n.length===1?n[0]:n.join(", "),h=e.length===1?e[0]:`${e.length} days`,d=t.length===1?`${t[0]}:00`:`${t.length} hours`;return r`
|
|
6458
6467
|
<div class="active-filters">
|
|
6459
6468
|
${e.length>0?r`
|
|
6460
6469
|
<div class="filter-chip">
|
|
@@ -6480,7 +6489,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6480
6489
|
</button>
|
|
6481
6490
|
`:v}
|
|
6482
6491
|
</div>
|
|
6483
|
-
`}function
|
|
6492
|
+
`}function jm(e,t,n,s,i,a){if(!e.length)return r`
|
|
6484
6493
|
<div class="daily-chart-compact">
|
|
6485
6494
|
<div class="sessions-panel-title">Daily Usage</div>
|
|
6486
6495
|
<div class="muted" style="padding: 20px; text-align: center">No data</div>
|
|
@@ -6506,7 +6515,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6506
6515
|
</div>
|
|
6507
6516
|
<div class="daily-chart">
|
|
6508
6517
|
<div class="daily-chart-bars" style="--bar-max-width: ${u}px">
|
|
6509
|
-
${e.map((g,h)=>{const f=l[h]/c*100,m=t.includes(g.date),k=
|
|
6518
|
+
${e.map((g,h)=>{const f=l[h]/c*100,m=t.includes(g.date),k=Bl(g.date),S=e.length>20?String(parseInt(g.date.slice(8),10)):k,w=e.length>20?"font-size: 8px":"",C=s==="by-type"?o?[{value:g.output,class:"output"},{value:g.input,class:"input"},{value:g.cacheWrite,class:"cache-write"},{value:g.cacheRead,class:"cache-read"}]:[{value:g.outputCost??0,class:"output"},{value:g.inputCost??0,class:"input"},{value:g.cacheWriteCost??0,class:"cache-write"},{value:g.cacheReadCost??0,class:"cache-read"}]:[],A=s==="by-type"?o?[`Output ${O(g.output)}`,`Input ${O(g.input)}`,`Cache write ${O(g.cacheWrite)}`,`Cache read ${O(g.cacheRead)}`]:[`Output ${q(g.outputCost??0)}`,`Input ${q(g.inputCost??0)}`,`Cache write ${q(g.cacheWriteCost??0)}`,`Cache read ${q(g.cacheReadCost??0)}`]:[],_=o?O(g.totalTokens):q(g.totalCost);return r`
|
|
6510
6519
|
<div
|
|
6511
6520
|
class="daily-bar-wrapper ${m?"selected":""}"
|
|
6512
6521
|
@click=${T=>a(g.date,T.shiftKey)}
|
|
@@ -6529,7 +6538,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6529
6538
|
${p?r`<div class="daily-bar-total">${_}</div>`:v}
|
|
6530
6539
|
<div class="daily-bar-label" style="${w}">${S}</div>
|
|
6531
6540
|
<div class="daily-bar-tooltip">
|
|
6532
|
-
<strong>${
|
|
6541
|
+
<strong>${Rm(g.date)}</strong><br />
|
|
6533
6542
|
${O(g.totalTokens)} tokens<br />
|
|
6534
6543
|
${q(g.totalCost)}
|
|
6535
6544
|
${A.length?r`${A.map(T=>r`<div>${T}</div>`)}`:v}
|
|
@@ -6539,7 +6548,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6539
6548
|
</div>
|
|
6540
6549
|
</div>
|
|
6541
6550
|
</div>
|
|
6542
|
-
`}function
|
|
6551
|
+
`}function Wm(e,t){const n=Hm(e),s=t==="tokens",i=e.totalTokens||1,a={output:ge(e.output,i),input:ge(e.input,i),cacheWrite:ge(e.cacheWrite,i),cacheRead:ge(e.cacheRead,i)};return r`
|
|
6543
6552
|
<div class="cost-breakdown cost-breakdown-compact">
|
|
6544
6553
|
<div class="cost-breakdown-header">${s?"Tokens":"Cost"} by Type</div>
|
|
6545
6554
|
<div class="cost-breakdown-bar">
|
|
@@ -6579,7 +6588,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6579
6588
|
</div>
|
|
6580
6589
|
`}
|
|
6581
6590
|
</div>
|
|
6582
|
-
`}function
|
|
6591
|
+
`}function Vo(e,t,n){return r`
|
|
6583
6592
|
<div class="usage-insight-card">
|
|
6584
6593
|
<div class="usage-insight-title">${e}</div>
|
|
6585
6594
|
${t.length===0?r`<div class="muted">${n}</div>`:r`
|
|
@@ -6594,7 +6603,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6594
6603
|
</div>
|
|
6595
6604
|
`}
|
|
6596
6605
|
</div>
|
|
6597
|
-
`}function
|
|
6606
|
+
`}function qm(e,t,n,s,i,a,o){if(!e)return v;const l=t.messages.total?Math.round(e.totalTokens/t.messages.total):0,c=t.messages.total?e.totalCost/t.messages.total:0,u=e.input+e.cacheRead,p=u>0?e.cacheRead/u:0,g=u>0?`${(p*100).toFixed(1)}%`:"—",h=n.errorRate*100,d=n.throughputTokensPerMin!==void 0?`${O(Math.round(n.throughputTokensPerMin))} tok/min`:"—",f=n.throughputCostPerMin!==void 0?`${q(n.throughputCostPerMin,4)} / min`:"—",m=n.durationCount>0?Im(n.avgDurationMs):"—",k="Cache hit rate = cache read / (input + cache read). Higher is better.",S="Error rate = errors / total messages. Lower is better.",w="Throughput shows tokens per minute over active time. Higher is better.",C="Average tokens per message in this range.",A=s?"Average cost per message when providers report costs. Cost data is missing for some or all sessions in this range.":"Average cost per message when providers report costs.",_=t.daily.filter(F=>F.messages>0&&F.errors>0).map(F=>{const H=F.errors/F.messages;return{label:Bl(F.date),value:`${(H*100).toFixed(2)}%`,sub:`${F.errors} errors · ${F.messages} msgs · ${O(F.tokens)}`,rate:H}}).toSorted((F,H)=>H.rate-F.rate).slice(0,5).map(({rate:F,...H})=>H),T=t.byModel.slice(0,5).map(F=>({label:F.model??"unknown",value:q(F.totals.totalCost),sub:`${O(F.totals.totalTokens)} · ${F.count} msgs`})),I=t.byProvider.slice(0,5).map(F=>({label:F.provider??"unknown",value:q(F.totals.totalCost),sub:`${O(F.totals.totalTokens)} · ${F.count} msgs`})),z=t.tools.tools.slice(0,6).map(F=>({label:F.name,value:`${F.count}`,sub:"calls"})),Y=t.byAgent.slice(0,5).map(F=>({label:F.agentId,value:q(F.totals.totalCost),sub:O(F.totals.totalTokens)})),se=t.byChannel.slice(0,5).map(F=>({label:F.channel,value:q(F.totals.totalCost),sub:O(F.totals.totalTokens)}));return r`
|
|
6598
6607
|
<section class="card" style="margin-top: 16px;">
|
|
6599
6608
|
<div class="card-title">Usage Overview</div>
|
|
6600
6609
|
<div class="usage-summary-grid">
|
|
@@ -6683,11 +6692,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6683
6692
|
${lt("Top Tools",z,"No tool calls")}
|
|
6684
6693
|
${lt("Top Agents",Y,"No agent data")}
|
|
6685
6694
|
${lt("Top Channels",se,"No channel data")}
|
|
6686
|
-
${
|
|
6687
|
-
${
|
|
6695
|
+
${Vo("Peak Error Days",_,"No error data")}
|
|
6696
|
+
${Vo("Peak Error Hours",i,"No error data")}
|
|
6688
6697
|
</div>
|
|
6689
6698
|
</section>
|
|
6690
|
-
`}function
|
|
6699
|
+
`}function Gm(e,t,n,s,i,a,o,l,c,u,p,g,h,d,f){const m=E=>h.includes(E),k=E=>{const B=E.label||E.key;return B.startsWith("agent:")&&B.includes("?token=")?B.slice(0,B.indexOf("?token=")):B},S=async E=>{const B=k(E);try{await navigator.clipboard.writeText(B)}catch{}},w=E=>{const B=[];return m("channel")&&E.channel&&B.push(`channel:${E.channel}`),m("agent")&&E.agentId&&B.push(`agent:${E.agentId}`),m("provider")&&(E.modelProvider||E.providerOverride)&&B.push(`provider:${E.modelProvider??E.providerOverride}`),m("model")&&E.model&&B.push(`model:${E.model}`),m("messages")&&E.usage?.messageCounts&&B.push(`msgs:${E.usage.messageCounts.total}`),m("tools")&&E.usage?.toolUsage&&B.push(`tools:${E.usage.toolUsage.totalCalls}`),m("errors")&&E.usage?.messageCounts&&B.push(`errors:${E.usage.messageCounts.errors}`),m("duration")&&E.usage?.durationMs&&B.push(`dur:${Ul(E.usage.durationMs)}`),B},C=E=>{const B=E.usage;if(!B)return 0;if(n.length>0&&B.dailyBreakdown&&B.dailyBreakdown.length>0){const ie=B.dailyBreakdown.filter(ae=>n.includes(ae.date));return s?ie.reduce((ae,J)=>ae+J.tokens,0):ie.reduce((ae,J)=>ae+J.cost,0)}return s?B.totalTokens??0:B.totalCost??0},A=[...e].toSorted((E,B)=>{switch(i){case"recent":return(B.updatedAt??0)-(E.updatedAt??0);case"messages":return(B.usage?.messageCounts?.total??0)-(E.usage?.messageCounts?.total??0);case"errors":return(B.usage?.messageCounts?.errors??0)-(E.usage?.messageCounts?.errors??0);case"cost":return C(B)-C(E);default:return C(B)-C(E)}}),_=a==="asc"?A.toReversed():A,T=_.reduce((E,B)=>E+C(B),0),I=_.length?T/_.length:0,z=_.reduce((E,B)=>E+(B.usage?.messageCounts?.errors??0),0),Y=new Set(t),se=_.filter(E=>Y.has(E.key)),F=se.length,H=new Map(_.map(E=>[E.key,E])),ce=o.map(E=>H.get(E)).filter(E=>!!E);return r`
|
|
6691
6700
|
<div class="card sessions-card">
|
|
6692
6701
|
<div class="sessions-card-header">
|
|
6693
6702
|
<div class="card-title">Sessions</div>
|
|
@@ -6828,7 +6837,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6828
6837
|
</div>
|
|
6829
6838
|
`:v}
|
|
6830
6839
|
</div>
|
|
6831
|
-
`}function
|
|
6840
|
+
`}function Vm(){return v}function Qm(e){const t=e.usage;if(!t)return r`
|
|
6832
6841
|
<div class="muted">No usage data for this session.</div>
|
|
6833
6842
|
`;const n=o=>o?new Date(o).toLocaleString():"—",s=[];e.channel&&s.push(`channel:${e.channel}`),e.agentId&&s.push(`agent:${e.agentId}`),(e.modelProvider||e.providerOverride)&&s.push(`provider:${e.modelProvider??e.providerOverride}`),e.model&&s.push(`model:${e.model}`);const i=t.toolUsage?.tools.slice(0,6).map(o=>({label:o.name,value:`${o.count}`,sub:"calls"}))??[],a=t.modelUsage?.slice(0,6).map(o=>({label:o.model??"unknown",value:q(o.totals.totalCost),sub:O(o.totals.totalTokens)}))??[];return r`
|
|
6834
6843
|
${s.length>0?r`<div class="usage-badges">${s.map(o=>r`<span class="usage-badge">${o}</span>`)}</div>`:v}
|
|
@@ -6850,7 +6859,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6850
6859
|
</div>
|
|
6851
6860
|
<div class="session-summary-card">
|
|
6852
6861
|
<div class="session-summary-title">Duration</div>
|
|
6853
|
-
<div class="session-summary-value">${
|
|
6862
|
+
<div class="session-summary-value">${Ul(t.durationMs)}</div>
|
|
6854
6863
|
<div class="session-summary-meta">${n(t.firstActivity)} → ${n(t.lastActivity)}</div>
|
|
6855
6864
|
</div>
|
|
6856
6865
|
</div>
|
|
@@ -6858,7 +6867,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6858
6867
|
${lt("Top Tools",i,"No tool calls")}
|
|
6859
6868
|
${lt("Model Mix",a,"No model data")}
|
|
6860
6869
|
</div>
|
|
6861
|
-
`}function
|
|
6870
|
+
`}function Ym(e,t,n,s,i,a,o,l,c,u,p,g,h,d,f,m,k,S,w,C,A,_,T){const I=e.label||e.key,z=I.length>50?I.slice(0,50)+"…":I,Y=e.usage;return r`
|
|
6862
6871
|
<div class="card session-detail-panel">
|
|
6863
6872
|
<div class="session-detail-header">
|
|
6864
6873
|
<div class="session-detail-header-left">
|
|
@@ -6873,17 +6882,17 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6873
6882
|
<button class="session-close-btn" @click=${T} title="Close session details">×</button>
|
|
6874
6883
|
</div>
|
|
6875
6884
|
<div class="session-detail-content">
|
|
6876
|
-
${
|
|
6885
|
+
${Qm(e)}
|
|
6877
6886
|
<div class="session-detail-row">
|
|
6878
|
-
${
|
|
6887
|
+
${Zm(t,n,s,i,a,o,l,c,u)}
|
|
6879
6888
|
</div>
|
|
6880
6889
|
<div class="session-detail-bottom">
|
|
6881
|
-
${
|
|
6882
|
-
${
|
|
6890
|
+
${Xm(p,g,h,d,f,m,k,S,w,C)}
|
|
6891
|
+
${Jm(e.contextWeight,Y,A,_)}
|
|
6883
6892
|
</div>
|
|
6884
6893
|
</div>
|
|
6885
6894
|
</div>
|
|
6886
|
-
`}function
|
|
6895
|
+
`}function Zm(e,t,n,s,i,a,o,l,c){if(t)return r`
|
|
6887
6896
|
<div class="session-timeseries-compact">
|
|
6888
6897
|
<div class="muted" style="padding: 20px; text-align: center">Loading...</div>
|
|
6889
6898
|
</div>
|
|
@@ -6978,7 +6987,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
6978
6987
|
</div>
|
|
6979
6988
|
`:v}
|
|
6980
6989
|
</div>
|
|
6981
|
-
`}function
|
|
6990
|
+
`}function Jm(e,t,n,s){if(!e)return r`
|
|
6982
6991
|
<div class="context-details-panel">
|
|
6983
6992
|
<div class="muted" style="padding: 20px; text-align: center">No context data</div>
|
|
6984
6993
|
</div>
|
|
@@ -7049,7 +7058,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7049
7058
|
`})():v}
|
|
7050
7059
|
</div>
|
|
7051
7060
|
</div>
|
|
7052
|
-
`}function
|
|
7061
|
+
`}function Xm(e,t,n,s,i,a,o,l,c,u){if(t)return r`
|
|
7053
7062
|
<div class="session-logs-compact">
|
|
7054
7063
|
<div class="session-logs-header">Conversation</div>
|
|
7055
7064
|
<div class="muted" style="padding: 20px; text-align: center">Loading...</div>
|
|
@@ -7059,7 +7068,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7059
7068
|
<div class="session-logs-header">Conversation</div>
|
|
7060
7069
|
<div class="muted" style="padding: 20px; text-align: center">No messages</div>
|
|
7061
7070
|
</div>
|
|
7062
|
-
`;const p=i.query.trim().toLowerCase(),g=e.map(S=>{const w
|
|
7071
|
+
`;const p=i.query.trim().toLowerCase(),g=e.map(S=>{const w=km(S.content),C=w.cleanContent||S.content;return{log:S,toolInfo:w,cleanContent:C}}),h=Array.from(new Set(g.flatMap(S=>S.toolInfo.tools.map(([w])=>w)))).toSorted((S,w)=>S.localeCompare(w)),d=g.filter(S=>!(i.roles.length>0&&!i.roles.includes(S.log.role)||i.hasTools&&S.toolInfo.tools.length===0||i.tools.length>0&&!S.toolInfo.tools.some(([C])=>i.tools.includes(C))||p&&!S.cleanContent.toLowerCase().includes(p))),f=i.roles.length>0||i.tools.length>0||i.hasTools||p?`${d.length} of ${e.length}`:`${e.length}`,m=new Set(i.roles),k=new Set(i.tools);return r`
|
|
7063
7072
|
<div class="session-logs-compact">
|
|
7064
7073
|
<div class="session-logs-header">
|
|
7065
7074
|
<span>Conversation <span style="font-weight: normal; color: var(--text-muted);">(${f} messages)</span></span>
|
|
@@ -7129,7 +7138,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7129
7138
|
`:v}
|
|
7130
7139
|
</div>
|
|
7131
7140
|
</div>
|
|
7132
|
-
`}function
|
|
7141
|
+
`}function eb(e){if(e.loading&&!e.totals)return r`
|
|
7133
7142
|
<style>
|
|
7134
7143
|
@keyframes initial-spin {
|
|
7135
7144
|
to { transform: rotate(360deg); }
|
|
@@ -7149,15 +7158,15 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7149
7158
|
align-items: center;
|
|
7150
7159
|
gap: 6px;
|
|
7151
7160
|
padding: 4px 10px;
|
|
7152
|
-
background: rgba(
|
|
7161
|
+
background: rgba(0, 230, 118, 0.1);
|
|
7153
7162
|
border-radius: 4px;
|
|
7154
7163
|
font-size: 12px;
|
|
7155
|
-
color: #
|
|
7164
|
+
color: #00e676;
|
|
7156
7165
|
">
|
|
7157
7166
|
<span style="
|
|
7158
7167
|
width: 10px;
|
|
7159
7168
|
height: 10px;
|
|
7160
|
-
border: 2px solid #
|
|
7169
|
+
border: 2px solid #00e676;
|
|
7161
7170
|
border-top-color: transparent;
|
|
7162
7171
|
border-radius: 50%;
|
|
7163
7172
|
animation: initial-spin 0.6s linear infinite;
|
|
@@ -7175,7 +7184,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7175
7184
|
</div>
|
|
7176
7185
|
</div>
|
|
7177
7186
|
</section>
|
|
7178
|
-
`;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((M,R)=>{const P=t?M.usage?.totalTokens??0:M.usage?.totalCost??0;return(t?R.usage?.totalTokens??0:R.usage?.totalCost??0)-P}),a=e.selectedDays.length>0?i.filter(M=>{if(M.usage?.activityDates?.length)return M.usage.activityDates.some(K=>e.selectedDays.includes(K));if(!M.updatedAt)return!1;const R=new Date(M.updatedAt),P=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(P)}):i,o=(M,R)=>{if(R.length===0)return!0;const P=M.usage,K=P?.firstActivity??M.updatedAt,xe=P?.lastActivity??M.updatedAt;if(!K||!xe)return!1;const Q=Math.min(K,xe),we=Math.max(K,xe);let X=Q;for(;X<=we;){const pe=new Date(X),Fe=
|
|
7187
|
+
`;const t=e.chartMode==="tokens",n=e.query.trim().length>0,s=e.queryDraft.trim().length>0,i=[...e.sessions].toSorted((M,R)=>{const P=t?M.usage?.totalTokens??0:M.usage?.totalCost??0;return(t?R.usage?.totalTokens??0:R.usage?.totalCost??0)-P}),a=e.selectedDays.length>0?i.filter(M=>{if(M.usage?.activityDates?.length)return M.usage.activityDates.some(K=>e.selectedDays.includes(K));if(!M.updatedAt)return!1;const R=new Date(M.updatedAt),P=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return e.selectedDays.includes(P)}):i,o=(M,R)=>{if(R.length===0)return!0;const P=M.usage,K=P?.firstActivity??M.updatedAt,xe=P?.lastActivity??M.updatedAt;if(!K||!xe)return!1;const Q=Math.min(K,xe),we=Math.max(K,xe);let X=Q;for(;X<=we;){const pe=new Date(X),Fe=ia(pe,e.timeZone);if(R.includes(Fe))return!0;const Ne=aa(pe,e.timeZone);X=Math.min(Ne.getTime(),we)+1}return!1},l=e.selectedHours.length>0?a.filter(M=>o(M,e.selectedHours)):a,c=wm(l,e.query),u=c.sessions,p=c.warnings,g=Bm(e.queryDraft,i,e.aggregates),h=sa(e.query),d=M=>{const R=rt(M);return h.filter(P=>rt(P.key??"")===R).map(P=>P.value).filter(Boolean)},f=M=>{const R=new Set;for(const P of M)P&&R.add(P);return Array.from(R)},m=f(i.map(M=>M.agentId)).slice(0,12),k=f(i.map(M=>M.channel)).slice(0,12),S=f([...i.map(M=>M.modelProvider),...i.map(M=>M.providerOverride),...e.aggregates?.byProvider.map(M=>M.provider)??[]]).slice(0,12),w=f([...i.map(M=>M.model),...e.aggregates?.byModel.map(M=>M.model)??[]]).slice(0,12),C=f(e.aggregates?.tools.tools.map(M=>M.name)??[]).slice(0,12),A=e.selectedSessions.length===1?e.sessions.find(M=>M.key===e.selectedSessions[0])??u.find(M=>M.key===e.selectedSessions[0]):null,_=M=>M.reduce((R,P)=>(P.usage&&(R.input+=P.usage.input,R.output+=P.usage.output,R.cacheRead+=P.usage.cacheRead,R.cacheWrite+=P.usage.cacheWrite,R.totalTokens+=P.usage.totalTokens,R.totalCost+=P.usage.totalCost,R.inputCost+=P.usage.inputCost??0,R.outputCost+=P.usage.outputCost??0,R.cacheReadCost+=P.usage.cacheReadCost??0,R.cacheWriteCost+=P.usage.cacheWriteCost??0,R.missingCostEntries+=P.usage.missingCostEntries??0),R),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0}),T=M=>e.costDaily.filter(P=>M.includes(P.date)).reduce((P,K)=>(P.input+=K.input,P.output+=K.output,P.cacheRead+=K.cacheRead,P.cacheWrite+=K.cacheWrite,P.totalTokens+=K.totalTokens,P.totalCost+=K.totalCost,P.inputCost+=K.inputCost??0,P.outputCost+=K.outputCost??0,P.cacheReadCost+=K.cacheReadCost??0,P.cacheWriteCost+=K.cacheWriteCost??0,P),{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,totalCost:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0,missingCostEntries:0});let I,z;const Y=i.length;if(e.selectedSessions.length>0){const M=u.filter(R=>e.selectedSessions.includes(R.key));I=_(M),z=M.length}else e.selectedDays.length>0&&e.selectedHours.length===0?(I=T(e.selectedDays),z=u.length):e.selectedHours.length>0||n?(I=_(u),z=u.length):(I=e.totals,z=Y);const se=e.selectedSessions.length>0?u.filter(M=>e.selectedSessions.includes(M.key)):n||e.selectedHours.length>0?u:e.selectedDays.length>0?a:i,F=Dm(se,e.aggregates),H=e.selectedSessions.length>0?(()=>{const M=u.filter(P=>e.selectedSessions.includes(P.key)),R=new Set;for(const P of M)for(const K of P.usage?.activityDates??[])R.add(K);return R.size>0?e.costDaily.filter(P=>R.has(P.date)):e.costDaily})():e.costDaily,ce=Fm(se,I,F),E=!e.loading&&!e.totals&&e.sessions.length===0,B=(I?.missingCostEntries??0)>0||(I?I.totalTokens>0&&I.totalCost===0&&I.input+I.output+I.cacheRead+I.cacheWrite>0:!1),ie=[{label:"Today",days:1},{label:"7d",days:7},{label:"30d",days:30}],ae=M=>{const R=new Date,P=new Date;P.setDate(P.getDate()-(M-1)),e.onStartDateChange(Us(P)),e.onEndDateChange(Us(R))},J=(M,R,P)=>{if(P.length===0)return v;const K=d(M),xe=new Set(K.map(X=>rt(X))),Q=P.length>0&&P.every(X=>xe.has(rt(X))),we=K.length;return r`
|
|
7179
7188
|
<details
|
|
7180
7189
|
class="usage-filter-select"
|
|
7181
7190
|
@toggle=${X=>{const pe=X.currentTarget;if(!pe.open)return;const Fe=Ne=>{Ne.composedPath().includes(pe)||(pe.open=!1,window.removeEventListener("click",Fe,!0))};window.addEventListener("click",Fe,!0)}}
|
|
@@ -7190,14 +7199,14 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7190
7199
|
<div class="usage-filter-actions">
|
|
7191
7200
|
<button
|
|
7192
7201
|
class="btn btn-sm"
|
|
7193
|
-
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(
|
|
7202
|
+
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(Go(e.queryDraft,M,P))}}
|
|
7194
7203
|
?disabled=${Q}
|
|
7195
7204
|
>
|
|
7196
7205
|
Select All
|
|
7197
7206
|
</button>
|
|
7198
7207
|
<button
|
|
7199
7208
|
class="btn btn-sm"
|
|
7200
|
-
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(
|
|
7209
|
+
@click=${X=>{X.preventDefault(),X.stopPropagation(),e.onQueryDraftChange(Go(e.queryDraft,M,[]))}}
|
|
7201
7210
|
?disabled=${we===0}
|
|
7202
7211
|
>
|
|
7203
7212
|
Clear
|
|
@@ -7209,7 +7218,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7209
7218
|
<input
|
|
7210
7219
|
type="checkbox"
|
|
7211
7220
|
.checked=${pe}
|
|
7212
|
-
@change=${Fe=>{const Ne=Fe.target,Je=`${M}:${X}`;e.onQueryDraftChange(Ne.checked?
|
|
7221
|
+
@change=${Fe=>{const Ne=Fe.target,Je=`${M}:${X}`;e.onQueryDraftChange(Ne.checked?zm(e.queryDraft,Je):qo(e.queryDraft,Je))}}
|
|
7213
7222
|
/>
|
|
7214
7223
|
<span>${X}</span>
|
|
7215
7224
|
</label>
|
|
@@ -7217,8 +7226,8 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7217
7226
|
</div>
|
|
7218
7227
|
</div>
|
|
7219
7228
|
</details>
|
|
7220
|
-
`},te=
|
|
7221
|
-
<style>${
|
|
7229
|
+
`},te=Us(new Date);return r`
|
|
7230
|
+
<style>${Sm}</style>
|
|
7222
7231
|
|
|
7223
7232
|
<section class="usage-page-header">
|
|
7224
7233
|
<div class="usage-page-title">Usage</div>
|
|
@@ -7265,21 +7274,21 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7265
7274
|
<div class="usage-export-list">
|
|
7266
7275
|
<button
|
|
7267
7276
|
class="usage-export-item"
|
|
7268
|
-
@click=${()=>
|
|
7277
|
+
@click=${()=>zs(`cryptoclaw-usage-sessions-${te}.csv`,Nm(u),"text/csv")}
|
|
7269
7278
|
?disabled=${u.length===0}
|
|
7270
7279
|
>
|
|
7271
7280
|
Sessions CSV
|
|
7272
7281
|
</button>
|
|
7273
7282
|
<button
|
|
7274
7283
|
class="usage-export-item"
|
|
7275
|
-
@click=${()=>
|
|
7284
|
+
@click=${()=>zs(`cryptoclaw-usage-daily-${te}.csv`,Om(H),"text/csv")}
|
|
7276
7285
|
?disabled=${H.length===0}
|
|
7277
7286
|
>
|
|
7278
7287
|
Daily CSV
|
|
7279
7288
|
</button>
|
|
7280
7289
|
<button
|
|
7281
7290
|
class="usage-export-item"
|
|
7282
|
-
@click=${()=>
|
|
7291
|
+
@click=${()=>zs(`cryptoclaw-usage-${te}.json`,JSON.stringify({totals:I,sessions:u,daily:H,aggregates:F},null,2),"application/json")}
|
|
7283
7292
|
?disabled=${u.length===0&&H.length===0}
|
|
7284
7293
|
>
|
|
7285
7294
|
JSON
|
|
@@ -7291,7 +7300,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7291
7300
|
</div>
|
|
7292
7301
|
<div class="usage-header-row">
|
|
7293
7302
|
<div class="usage-controls">
|
|
7294
|
-
${
|
|
7303
|
+
${Km(e.selectedDays,e.selectedHours,e.selectedSessions,e.sessions,e.onClearDays,e.onClearHours,e.onClearSessions,e.onClearFilters)}
|
|
7295
7304
|
<div class="usage-presets">
|
|
7296
7305
|
${ie.map(M=>r`
|
|
7297
7306
|
<button class="btn btn-sm" @click=${()=>ae(M.days)}>
|
|
@@ -7386,7 +7395,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7386
7395
|
${R}
|
|
7387
7396
|
<button
|
|
7388
7397
|
title="Remove filter"
|
|
7389
|
-
@click=${()=>e.onQueryDraftChange(
|
|
7398
|
+
@click=${()=>e.onQueryDraftChange(qo(e.queryDraft,R))}
|
|
7390
7399
|
>
|
|
7391
7400
|
×
|
|
7392
7401
|
</button>
|
|
@@ -7399,7 +7408,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7399
7408
|
${g.map(M=>r`
|
|
7400
7409
|
<button
|
|
7401
7410
|
class="usage-query-suggestion"
|
|
7402
|
-
@click=${()=>e.onQueryDraftChange(
|
|
7411
|
+
@click=${()=>e.onQueryDraftChange(Um(e.queryDraft,M.value))}
|
|
7403
7412
|
>
|
|
7404
7413
|
${M.label}
|
|
7405
7414
|
</button>
|
|
@@ -7422,26 +7431,26 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7422
7431
|
`:v}
|
|
7423
7432
|
</section>
|
|
7424
7433
|
|
|
7425
|
-
${
|
|
7434
|
+
${qm(I,F,ce,B,Tm(se,e.timeZone),z,Y)}
|
|
7426
7435
|
|
|
7427
|
-
${
|
|
7436
|
+
${Mm(se,e.timeZone,e.selectedHours,e.onSelectHour)}
|
|
7428
7437
|
|
|
7429
7438
|
<!-- Two-column layout: Daily+Breakdown on left, Sessions on right -->
|
|
7430
7439
|
<div class="usage-grid">
|
|
7431
7440
|
<div class="usage-grid-left">
|
|
7432
7441
|
<div class="card usage-left-card">
|
|
7433
|
-
${
|
|
7434
|
-
${I?
|
|
7442
|
+
${jm(H,e.selectedDays,e.chartMode,e.dailyChartMode,e.onDailyChartModeChange,e.onSelectDay)}
|
|
7443
|
+
${I?Wm(I,e.chartMode):v}
|
|
7435
7444
|
</div>
|
|
7436
7445
|
</div>
|
|
7437
7446
|
<div class="usage-grid-right">
|
|
7438
|
-
${
|
|
7447
|
+
${Gm(u,e.selectedSessions,e.selectedDays,t,e.sessionSort,e.sessionSortDir,e.recentSessions,e.sessionsTab,e.onSelectSession,e.onSessionSortChange,e.onSessionSortDirChange,e.onSessionsTabChange,e.visibleColumns,Y,e.onClearSessions)}
|
|
7439
7448
|
</div>
|
|
7440
7449
|
</div>
|
|
7441
7450
|
|
|
7442
7451
|
<!-- Session Detail Panel (when selected) or Empty State -->
|
|
7443
|
-
${A?
|
|
7444
|
-
`}let
|
|
7452
|
+
${A?Ym(A,e.timeSeries,e.timeSeriesLoading,e.timeSeriesMode,e.onTimeSeriesModeChange,e.timeSeriesBreakdownMode,e.onTimeSeriesBreakdownChange,e.startDate,e.endDate,e.selectedDays,e.sessionLogs,e.sessionLogsLoading,e.sessionLogsExpanded,e.onToggleSessionLogsExpanded,{roles:e.logFilterRoles,tools:e.logFilterTools,hasTools:e.logFilterHasTools,query:e.logFilterQuery},e.onLogFilterRolesChange,e.onLogFilterToolsChange,e.onLogFilterHasToolsChange,e.onLogFilterQueryChange,e.onLogFilterClear,e.contextExpanded,e.onToggleContextExpanded,e.onClearSessions):Vm()}
|
|
7453
|
+
`}let Hs=null;const Qo=e=>{Hs&&clearTimeout(Hs),Hs=window.setTimeout(()=>{nl(e)},400)},tb=/^data:/i,nb=/^https?:\/\//i;function sb(e){const t=e.agentsList?.agents??[],s=dr(e.sessionKey)?.agentId??e.agentsList?.defaultId??"main",a=t.find(l=>l.id===s)?.identity,o=a?.avatarUrl??a?.avatar;if(o)return tb.test(o)||nb.test(o)?o:a?.avatarUrl}function ib(e){const t=e.presenceEntries.length,n=e.sessionsResult?.count??null,s=e.cronStatus?.nextWakeAtMs??null,i=e.connected?null:"Disconnected from gateway.",a=e.tab==="chat",o=a&&(e.settings.chatFocusMode||e.onboarding),l=e.onboarding?!1:e.settings.chatShowThinking,c=sb(e),u=e.chatAvatarUrl??c??null,p=e.configForm??e.configSnapshot?.config,g=ln(e.basePath??""),h=e.agentsSelectedId??e.agentsList?.defaultId??e.agentsList?.agents?.[0]?.id??null;return r`
|
|
7445
7454
|
<div class="shell ${a?"shell--chat":""} ${o?"shell--chat-focus":""} ${e.settings.navCollapsed?"shell--nav-collapsed":""} ${e.onboarding?"shell--onboarding":""}">
|
|
7446
7455
|
<header class="topbar">
|
|
7447
7456
|
<div class="topbar-left">
|
|
@@ -7469,11 +7478,11 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7469
7478
|
<span>Health</span>
|
|
7470
7479
|
<span class="mono">${e.connected?"OK":"Offline"}</span>
|
|
7471
7480
|
</div>
|
|
7472
|
-
${
|
|
7481
|
+
${Sg(e)}
|
|
7473
7482
|
</div>
|
|
7474
7483
|
</header>
|
|
7475
7484
|
<aside class="nav ${e.settings.navCollapsed?"nav--collapsed":""}">
|
|
7476
|
-
${
|
|
7485
|
+
${Jd.map(d=>{const f=e.settings.navGroupsCollapsed[d.label]??!1,m=d.tabs.some(k=>k===e.tab);return r`
|
|
7477
7486
|
<div class="nav-group ${f&&!m?"nav-group--collapsed":""}">
|
|
7478
7487
|
<button
|
|
7479
7488
|
class="nav-label"
|
|
@@ -7484,7 +7493,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7484
7493
|
<span class="nav-label__chevron">${f?"+":"−"}</span>
|
|
7485
7494
|
</button>
|
|
7486
7495
|
<div class="nav-group__items">
|
|
7487
|
-
${d.tabs.map(k=>
|
|
7496
|
+
${d.tabs.map(k=>yg(e,k))}
|
|
7488
7497
|
</div>
|
|
7489
7498
|
</div>
|
|
7490
7499
|
`})}
|
|
@@ -7495,7 +7504,7 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7495
7504
|
<div class="nav-group__items">
|
|
7496
7505
|
<a
|
|
7497
7506
|
class="nav-item nav-item--external"
|
|
7498
|
-
href="https://docs.
|
|
7507
|
+
href="https://docs.openclaw.ai"
|
|
7499
7508
|
target="_blank"
|
|
7500
7509
|
rel="noreferrer"
|
|
7501
7510
|
title="Docs (opens in new tab)"
|
|
@@ -7509,45 +7518,45 @@ ${JSON.stringify(e.issues,null,2)}</pre
|
|
|
7509
7518
|
<main class="content ${a?"content--chat":""}">
|
|
7510
7519
|
<section class="content-header">
|
|
7511
7520
|
<div>
|
|
7512
|
-
${e.tab==="usage"?v:r`<div class="page-title">${
|
|
7513
|
-
${e.tab==="usage"?v:r`<div class="page-sub">${
|
|
7521
|
+
${e.tab==="usage"?v:r`<div class="page-title">${Js(e.tab)}</div>`}
|
|
7522
|
+
${e.tab==="usage"?v:r`<div class="page-sub">${tu(e.tab)}</div>`}
|
|
7514
7523
|
</div>
|
|
7515
7524
|
<div class="page-meta">
|
|
7516
7525
|
${e.lastError?r`<div class="pill danger">${e.lastError}</div>`:v}
|
|
7517
|
-
${a
|
|
7526
|
+
${a?xg(e):v}
|
|
7518
7527
|
</div>
|
|
7519
7528
|
</section>
|
|
7520
7529
|
|
|
7521
|
-
${e.tab==="overview"?
|
|
7530
|
+
${e.tab==="overview"?sm({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()}):v}
|
|
7522
7531
|
|
|
7523
|
-
${e.tab==="channels"?
|
|
7532
|
+
${e.tab==="channels"?Vp({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=>ye(e,d),onWhatsAppStart:d=>e.handleWhatsAppStart(d),onWhatsAppWait:()=>e.handleWhatsAppWait(),onWhatsAppLogout:()=>e.handleWhatsAppLogout(),onConfigPatch:(d,f)=>$e(e,d,f),onConfigSave:()=>e.handleChannelConfigSave(),onConfigReload:()=>e.handleChannelConfigReload(),onNostrProfileEdit:(d,f)=>e.handleNostrProfileEdit(d,f),onNostrProfileCancel:()=>e.handleNostrProfileCancel(),onNostrProfileFieldChange:(d,f)=>e.handleNostrProfileFieldChange(d,f),onNostrProfileSave:()=>e.handleNostrProfileSave(),onNostrProfileImport:()=>e.handleNostrProfileImport(),onNostrProfileToggleAdvanced:()=>e.handleNostrProfileToggleAdvanced()}):v}
|
|
7524
7533
|
|
|
7525
|
-
${e.tab==="instances"?
|
|
7534
|
+
${e.tab==="instances"?Tv({loading:e.presenceLoading,entries:e.presenceEntries,lastError:e.presenceError,statusMessage:e.presenceStatus,onRefresh:()=>Fi(e)}):v}
|
|
7526
7535
|
|
|
7527
|
-
${e.tab==="sessions"?
|
|
7536
|
+
${e.tab==="sessions"?gm({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:()=>mt(e),onPatch:(d,f)=>qd(e,d,f),onDelete:d=>Gd(e,d)}):v}
|
|
7528
7537
|
|
|
7529
|
-
${e.tab==="usage"?
|
|
7538
|
+
${e.tab==="usage"?eb({loading:e.usageLoading,error:e.usageError,startDate:e.usageStartDate,endDate:e.usageEndDate,sessions:e.usageResult?.sessions??[],sessionsLimitReached:(e.usageResult?.sessions?.length??0)>=1e3,totals:e.usageResult?.totals??null,aggregates:e.usageResult?.aggregates??null,costDaily:e.usageCostSummary?.daily??[],selectedSessions:e.usageSelectedSessions,selectedDays:e.usageSelectedDays,selectedHours:e.usageSelectedHours,chartMode:e.usageChartMode,dailyChartMode:e.usageDailyChartMode,timeSeriesMode:e.usageTimeSeriesMode,timeSeriesBreakdownMode:e.usageTimeSeriesBreakdownMode,timeSeries:e.usageTimeSeries,timeSeriesLoading:e.usageTimeSeriesLoading,sessionLogs:e.usageSessionLogs,sessionLogsLoading:e.usageSessionLogsLoading,sessionLogsExpanded:e.usageSessionLogsExpanded,logFilterRoles:e.usageLogFilterRoles,logFilterTools:e.usageLogFilterTools,logFilterHasTools:e.usageLogFilterHasTools,logFilterQuery:e.usageLogFilterQuery,query:e.usageQuery,queryDraft:e.usageQueryDraft,sessionSort:e.usageSessionSort,sessionSortDir:e.usageSessionSortDir,recentSessions:e.usageRecentSessions,sessionsTab:e.usageSessionsTab,visibleColumns:e.usageVisibleColumns,timeZone:e.usageTimeZone,contextExpanded:e.usageContextExpanded,headerPinned:e.usageHeaderPinned,onStartDateChange:d=>{e.usageStartDate=d,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],Qo(e)},onEndDateChange:d=>{e.usageEndDate=d,e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],Qo(e)},onRefresh:()=>nl(e),onTimeZoneChange:d=>{e.usageTimeZone=d},onToggleContextExpanded:()=>{e.usageContextExpanded=!e.usageContextExpanded},onToggleSessionLogsExpanded:()=>{e.usageSessionLogsExpanded=!e.usageSessionLogsExpanded},onLogFilterRolesChange:d=>{e.usageLogFilterRoles=d},onLogFilterToolsChange:d=>{e.usageLogFilterTools=d},onLogFilterHasToolsChange:d=>{e.usageLogFilterHasTools=d},onLogFilterQueryChange:d=>{e.usageLogFilterQuery=d},onLogFilterClear:()=>{e.usageLogFilterRoles=[],e.usageLogFilterTools=[],e.usageLogFilterHasTools=!1,e.usageLogFilterQuery=""},onToggleHeaderPinned:()=>{e.usageHeaderPinned=!e.usageHeaderPinned},onSelectHour:(d,f)=>{if(f&&e.usageSelectedHours.length>0){const m=Array.from({length:24},(C,A)=>A),k=e.usageSelectedHours[e.usageSelectedHours.length-1],S=m.indexOf(k),w=m.indexOf(d);if(S!==-1&&w!==-1){const[C,A]=S<w?[S,w]:[w,S],_=m.slice(C,A+1);e.usageSelectedHours=[...new Set([...e.usageSelectedHours,..._])]}}else e.usageSelectedHours.includes(d)?e.usageSelectedHours=e.usageSelectedHours.filter(m=>m!==d):e.usageSelectedHours=[...e.usageSelectedHours,d]},onQueryDraftChange:d=>{e.usageQueryDraft=d,e.usageQueryDebounceTimer&&window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=window.setTimeout(()=>{e.usageQuery=e.usageQueryDraft,e.usageQueryDebounceTimer=null},250)},onApplyQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQuery=e.usageQueryDraft},onClearQuery:()=>{e.usageQueryDebounceTimer&&(window.clearTimeout(e.usageQueryDebounceTimer),e.usageQueryDebounceTimer=null),e.usageQueryDraft="",e.usageQuery=""},onSessionSortChange:d=>{e.usageSessionSort=d},onSessionSortDirChange:d=>{e.usageSessionSortDir=d},onSessionsTabChange:d=>{e.usageSessionsTab=d},onToggleColumn:d=>{e.usageVisibleColumns.includes(d)?e.usageVisibleColumns=e.usageVisibleColumns.filter(f=>f!==d):e.usageVisibleColumns=[...e.usageVisibleColumns,d]},onSelectSession:(d,f)=>{if(e.usageTimeSeries=null,e.usageSessionLogs=null,e.usageRecentSessions=[d,...e.usageRecentSessions.filter(m=>m!==d)].slice(0,8),f&&e.usageSelectedSessions.length>0){const m=e.usageChartMode==="tokens",S=[...e.usageResult?.sessions??[]].toSorted((_,T)=>{const I=m?_.usage?.totalTokens??0:_.usage?.totalCost??0;return(m?T.usage?.totalTokens??0:T.usage?.totalCost??0)-I}).map(_=>_.key),w=e.usageSelectedSessions[e.usageSelectedSessions.length-1],C=S.indexOf(w),A=S.indexOf(d);if(C!==-1&&A!==-1){const[_,T]=C<A?[C,A]:[A,C],I=S.slice(_,T+1),z=[...new Set([...e.usageSelectedSessions,...I])];e.usageSelectedSessions=z}}else e.usageSelectedSessions.length===1&&e.usageSelectedSessions[0]===d?e.usageSelectedSessions=[]:e.usageSelectedSessions=[d];e.usageSelectedSessions.length===1&&(Lg(e,e.usageSelectedSessions[0]),Mg(e,e.usageSelectedSessions[0]))},onSelectDay:(d,f)=>{if(f&&e.usageSelectedDays.length>0){const m=(e.usageCostSummary?.daily??[]).map(C=>C.date),k=e.usageSelectedDays[e.usageSelectedDays.length-1],S=m.indexOf(k),w=m.indexOf(d);if(S!==-1&&w!==-1){const[C,A]=S<w?[S,w]:[w,S],_=m.slice(C,A+1),T=[...new Set([...e.usageSelectedDays,..._])];e.usageSelectedDays=T}}else e.usageSelectedDays.includes(d)?e.usageSelectedDays=e.usageSelectedDays.filter(m=>m!==d):e.usageSelectedDays=[d]},onChartModeChange:d=>{e.usageChartMode=d},onDailyChartModeChange:d=>{e.usageDailyChartMode=d},onTimeSeriesModeChange:d=>{e.usageTimeSeriesMode=d},onTimeSeriesBreakdownChange:d=>{e.usageTimeSeriesBreakdownMode=d},onClearDays:()=>{e.usageSelectedDays=[]},onClearHours:()=>{e.usageSelectedHours=[]},onClearSessions:()=>{e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null},onClearFilters:()=>{e.usageSelectedDays=[],e.usageSelectedHours=[],e.usageSelectedSessions=[],e.usageTimeSeries=null,e.usageSessionLogs=null}}):v}
|
|
7530
7539
|
|
|
7531
|
-
${e.tab==="cron"?
|
|
7540
|
+
${e.tab==="cron"?yv({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:()=>ad(e),onToggle:(d,f)=>od(e,d,f),onRun:d=>rd(e,d),onRemove:d=>ld(e,d),onLoadRuns:d=>vr(e,d)}):v}
|
|
7532
7541
|
|
|
7533
|
-
${e.tab==="agents"?
|
|
7542
|
+
${e.tab==="agents"?Xg({loading:e.agentsLoading,error:e.agentsError,agentsList:e.agentsList,selectedAgentId:h,activePanel:e.agentsPanel,configForm:p,configLoading:e.configLoading,configSaving:e.configSaving,configDirty:e.configFormDirty,channelsLoading:e.channelsLoading,channelsError:e.channelsError,channelsSnapshot:e.channelsSnapshot,channelsLastSuccess:e.channelsLastSuccess,cronLoading:e.cronLoading,cronStatus:e.cronStatus,cronJobs:e.cronJobs,cronError:e.cronError,agentFilesLoading:e.agentFilesLoading,agentFilesError:e.agentFilesError,agentFilesList:e.agentFilesList,agentFileActive:e.agentFileActive,agentFileContents:e.agentFileContents,agentFileDrafts:e.agentFileDrafts,agentFileSaving:e.agentFileSaving,agentIdentityLoading:e.agentIdentityLoading,agentIdentityError:e.agentIdentityError,agentIdentityById:e.agentIdentityById,agentSkillsLoading:e.agentSkillsLoading,agentSkillsReport:e.agentSkillsReport,agentSkillsError:e.agentSkillsError,agentSkillsAgentId:e.agentSkillsAgentId,skillsFilter:e.skillsFilter,onRefresh:async()=>{await _i(e);const d=e.agentsList?.agents?.map(f=>f.id)??[];d.length>0&&pr(e,d)},onSelectAgent:d=>{e.agentsSelectedId!==d&&(e.agentsSelectedId=d,e.agentFilesList=null,e.agentFilesError=null,e.agentFilesLoading=!1,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},e.agentSkillsReport=null,e.agentSkillsError=null,e.agentSkillsAgentId=null,gr(e,d),e.agentsPanel==="files"&&Ms(e,d),e.agentsPanel==="skills"&&Mn(e,d))},onSelectPanel:d=>{e.agentsPanel=d,d==="files"&&h&&e.agentFilesList?.agentId!==h&&(e.agentFilesList=null,e.agentFilesError=null,e.agentFileActive=null,e.agentFileContents={},e.agentFileDrafts={},Ms(e,h)),d==="skills"&&h&&Mn(e,h),d==="channels"&&ye(e,!1),d==="cron"&&e.loadCron()},onLoadFiles:d=>Ms(e,d),onSelectFile:d=>{e.agentFileActive=d,h&&_g(e,h,d)},onFileDraftChange:(d,f)=>{e.agentFileDrafts={...e.agentFileDrafts,[d]:f}},onFileReset:d=>{const f=e.agentFileContents[d]??"";e.agentFileDrafts={...e.agentFileDrafts,[d]:f}},onFileSave:d=>{if(!h)return;const f=e.agentFileDrafts[d]??e.agentFileContents[d]??"";Eg(e,h,d,f)},onToolsProfileChange:(d,f,m)=>{if(!p)return;const k=p.agents?.list;if(!Array.isArray(k))return;const S=k.findIndex(C=>C&&typeof C=="object"&&"id"in C&&C.id===d);if(S<0)return;const w=["agents","list",S,"tools"];f?$e(e,[...w,"profile"],f):ze(e,[...w,"profile"]),m&&ze(e,[...w,"allow"])},onToolsOverridesChange:(d,f,m)=>{if(!p)return;const k=p.agents?.list;if(!Array.isArray(k))return;const S=k.findIndex(C=>C&&typeof C=="object"&&"id"in C&&C.id===d);if(S<0)return;const w=["agents","list",S,"tools"];f.length>0?$e(e,[...w,"alsoAllow"],f):ze(e,[...w,"alsoAllow"]),m.length>0?$e(e,[...w,"deny"],m):ze(e,[...w,"deny"])},onConfigReload:()=>Ee(e),onConfigSave:()=>Ln(e),onChannelsRefresh:()=>ye(e,!1),onCronRefresh:()=>e.loadCron(),onSkillsFilterChange:d=>e.skillsFilter=d,onSkillsRefresh:()=>{h&&Mn(e,h)},onAgentSkillToggle:(d,f,m)=>{if(!p)return;const k=p.agents?.list;if(!Array.isArray(k))return;const S=k.findIndex(z=>z&&typeof z=="object"&&"id"in z&&z.id===d);if(S<0)return;const w=k[S],C=f.trim();if(!C)return;const A=e.agentSkillsReport?.skills?.map(z=>z.name).filter(Boolean)??[],T=(Array.isArray(w.skills)?w.skills.map(z=>String(z).trim()).filter(Boolean):void 0)??A,I=new Set(T);m?I.add(C):I.delete(C),$e(e,["agents","list",S,"skills"],[...I])},onAgentSkillsClear:d=>{if(!p)return;const f=p.agents?.list;if(!Array.isArray(f))return;const m=f.findIndex(k=>k&&typeof k=="object"&&"id"in k&&k.id===d);m<0||ze(e,["agents","list",m,"skills"])},onAgentSkillsDisableAll:d=>{if(!p)return;const f=p.agents?.list;if(!Array.isArray(f))return;const m=f.findIndex(k=>k&&typeof k=="object"&&"id"in k&&k.id===d);m<0||$e(e,["agents","list",m,"skills"],[])},onModelChange:(d,f)=>{if(!p)return;const m=p.agents?.list;if(!Array.isArray(m))return;const k=m.findIndex(A=>A&&typeof A=="object"&&"id"in A&&A.id===d);if(k<0)return;const S=["agents","list",k,"model"];if(!f){ze(e,S);return}const C=m[k]?.model;if(C&&typeof C=="object"&&!Array.isArray(C)){const A=C.fallbacks,_={primary:f,...Array.isArray(A)?{fallbacks:A}:{}};$e(e,S,_)}else $e(e,S,f)},onModelFallbacksChange:(d,f)=>{if(!p)return;const m=p.agents?.list;if(!Array.isArray(m))return;const k=m.findIndex(z=>z&&typeof z=="object"&&"id"in z&&z.id===d);if(k<0)return;const S=["agents","list",k,"model"],w=m[k],C=f.map(z=>z.trim()).filter(Boolean),A=w.model,T=(()=>{if(typeof A=="string")return A.trim()||null;if(A&&typeof A=="object"&&!Array.isArray(A)){const z=A.primary;if(typeof z=="string")return z.trim()||null}return null})();if(C.length===0){T?$e(e,S,T):ze(e,S);return}$e(e,S,T?{primary:T,fallbacks:C}:{fallbacks:C})}}):v}
|
|
7534
7543
|
|
|
7535
|
-
${e.tab==="skills"?
|
|
7544
|
+
${e.tab==="skills"?hm({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:()=>rn(e,{clearMessages:!0}),onToggle:(d,f)=>Qd(e,d,f),onEdit:(d,f)=>Vd(e,d,f),onSaveKey:d=>Yd(e,d),onInstall:(d,f,m)=>Zd(e,d,f,m)}):v}
|
|
7536
7545
|
|
|
7537
|
-
${e.tab==="nodes"?
|
|
7546
|
+
${e.tab==="nodes"?Iv({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:()=>Zn(e),onDevicesRefresh:()=>Ze(e),onDeviceApprove:d=>Fd(e,d),onDeviceReject:d=>Nd(e,d),onDeviceRotate:(d,f,m)=>Od(e,{deviceId:d,role:f,scopes:m}),onDeviceRevoke:(d,f)=>Bd(e,{deviceId:d,role:f}),onLoadConfig:()=>Ee(e),onLoadExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Di(e,d)},onBindDefault:d=>{d?$e(e,["tools","exec","node"],d):ze(e,["tools","exec","node"])},onBindAgent:(d,f)=>{const m=["agents","list",d,"tools","exec","node"];f?$e(e,m,f):ze(e,m)},onSaveBindings:()=>Ln(e),onExecApprovalsTargetChange:(d,f)=>{e.execApprovalsTarget=d,e.execApprovalsTargetNodeId=f,e.execApprovalsSnapshot=null,e.execApprovalsForm=null,e.execApprovalsDirty=!1,e.execApprovalsSelectedAgent=null},onExecApprovalsSelectAgent:d=>{e.execApprovalsSelectedAgent=d},onExecApprovalsPatch:(d,f)=>jd(e,d,f),onExecApprovalsRemove:d=>Wd(e,d),onSaveExecApprovals:()=>{const d=e.execApprovalsTarget==="node"&&e.execApprovalsTargetNodeId?{kind:"node",nodeId:e.execApprovalsTargetNodeId}:{kind:"gateway"};return Kd(e,d)}}):v}
|
|
7538
7547
|
|
|
7539
|
-
${e.tab==="chat"?
|
|
7548
|
+
${e.tab==="chat"?dv({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(),nn(e),ti(e)},thinkingLevel:e.chatThinkingLevel,showThinking:l,loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:u,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([nn(e),ti(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}),showNewMessages:e.chatNewMessagesBelow,onScrollToBottom:()=>e.scrollToBottom(),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}):v}
|
|
7540
7549
|
|
|
7541
|
-
${e.tab==="config"?
|
|
7550
|
+
${e.tab==="config"?vv({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,f)=>$e(e,d,f),onSearchChange:d=>e.configSearchQuery=d,onSectionChange:d=>{e.configActiveSection=d,e.configActiveSubsection=null},onSubsectionChange:d=>e.configActiveSubsection=d,onReload:()=>Ee(e),onSave:()=>Ln(e),onApply:()=>Ac(e),onUpdate:()=>Cc(e)}):v}
|
|
7542
7551
|
|
|
7543
|
-
${e.tab==="debug"
|
|
7552
|
+
${e.tab==="debug"?kv({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:()=>Yn(e),onCall:()=>qc(e)}):v}
|
|
7544
7553
|
|
|
7545
|
-
${e.tab==="logs"?
|
|
7554
|
+
${e.tab==="logs"?Mv({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,f)=>{e.logsLevelFilters={...e.logsLevelFilters,[d]:f}},onToggleAutoFollow:d=>e.logsAutoFollow=d,onRefresh:()=>ki(e,{reset:!0}),onExport:(d,f)=>e.exportLogs(d,f),onScroll:d=>e.handleLogsScroll(d)}):v}
|
|
7546
7555
|
</main>
|
|
7547
|
-
${
|
|
7548
|
-
${
|
|
7556
|
+
${Av(e)}
|
|
7557
|
+
${Cv(e)}
|
|
7549
7558
|
</div>
|
|
7550
|
-
`}var
|
|
7559
|
+
`}var ab=Object.defineProperty,ob=Object.getOwnPropertyDescriptor,x=(e,t,n,s)=>{for(var i=s>1?void 0:s?ob(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&&ab(t,n,i),i};const Ks=Xu();function rb(){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 y=class extends Tt{constructor(){super(...arguments),this.settings=nu(),this.password="",this.tab="chat",this.onboarding=rb(),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=Ks.name,this.assistantAvatar=Ks.avatar,this.assistantAgentId=Ks.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=`{
|
|
7551
7560
|
}
|
|
7552
|
-
`,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.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Yu},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={...Qu},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.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>vu(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ug(this)}firstUpdated(){gg(this)}disconnectedCallback(){pg(this),super.disconnectedCallback()}updated(e){fg(this,e)}connect(){tl(this)}handleChatScroll(e){Kc(this,e)}handleLogsScroll(e){jc(this,e)}exportLogs(e,t){Wc(e,t)}resetToolStream(){ss(this)}resetChatScroll(){Na(this)}scrollToBottom(){Na(this),an(this,!0)}async loadAssistantIdentity(){await Jr(this)}applySettings(e){ht(this,e)}setTab(e){cu(this,e)}setTheme(e,t){du(this,e,t)}async loadOverview(){await jr(this)}async loadCron(){await Un(this)}async handleAbortChat(){await Vr(this)}removeQueuedMessage(e){ju(this,e)}async handleSendChat(e,t){await Wu(this,e,t)}async handleWhatsAppStart(e){await Mc(this,e)}async handleWhatsAppWait(){await Ic(this)}async handleWhatsAppLogout(){await Rc(this)}async handleChannelConfigSave(){await Pc(this)}async handleChannelConfigReload(){await Dc(this)}handleNostrProfileEdit(e,t){Nc(this,e,t)}handleNostrProfileCancel(){Oc(this)}handleNostrProfileFieldChange(e,t){Bc(this,e,t)}async handleNostrProfileSave(){await zc(this)}async handleNostrProfileImport(){await Hc(this)}handleNostrProfileToggleAdvanced(){Uc(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,ht(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 nb(this)}};x([$()],y.prototype,"settings",2);x([$()],y.prototype,"password",2);x([$()],y.prototype,"tab",2);x([$()],y.prototype,"onboarding",2);x([$()],y.prototype,"connected",2);x([$()],y.prototype,"theme",2);x([$()],y.prototype,"themeResolved",2);x([$()],y.prototype,"hello",2);x([$()],y.prototype,"lastError",2);x([$()],y.prototype,"eventLog",2);x([$()],y.prototype,"assistantName",2);x([$()],y.prototype,"assistantAvatar",2);x([$()],y.prototype,"assistantAgentId",2);x([$()],y.prototype,"sessionKey",2);x([$()],y.prototype,"chatLoading",2);x([$()],y.prototype,"chatSending",2);x([$()],y.prototype,"chatMessage",2);x([$()],y.prototype,"chatMessages",2);x([$()],y.prototype,"chatToolMessages",2);x([$()],y.prototype,"chatStream",2);x([$()],y.prototype,"chatStreamStartedAt",2);x([$()],y.prototype,"chatRunId",2);x([$()],y.prototype,"compactionStatus",2);x([$()],y.prototype,"chatAvatarUrl",2);x([$()],y.prototype,"chatThinkingLevel",2);x([$()],y.prototype,"chatQueue",2);x([$()],y.prototype,"chatAttachments",2);x([$()],y.prototype,"sidebarOpen",2);x([$()],y.prototype,"sidebarContent",2);x([$()],y.prototype,"sidebarError",2);x([$()],y.prototype,"splitRatio",2);x([$()],y.prototype,"nodesLoading",2);x([$()],y.prototype,"nodes",2);x([$()],y.prototype,"devicesLoading",2);x([$()],y.prototype,"devicesError",2);x([$()],y.prototype,"devicesList",2);x([$()],y.prototype,"execApprovalsLoading",2);x([$()],y.prototype,"execApprovalsSaving",2);x([$()],y.prototype,"execApprovalsDirty",2);x([$()],y.prototype,"execApprovalsSnapshot",2);x([$()],y.prototype,"execApprovalsForm",2);x([$()],y.prototype,"execApprovalsSelectedAgent",2);x([$()],y.prototype,"execApprovalsTarget",2);x([$()],y.prototype,"execApprovalsTargetNodeId",2);x([$()],y.prototype,"execApprovalQueue",2);x([$()],y.prototype,"execApprovalBusy",2);x([$()],y.prototype,"execApprovalError",2);x([$()],y.prototype,"pendingGatewayUrl",2);x([$()],y.prototype,"configLoading",2);x([$()],y.prototype,"configRaw",2);x([$()],y.prototype,"configRawOriginal",2);x([$()],y.prototype,"configValid",2);x([$()],y.prototype,"configIssues",2);x([$()],y.prototype,"configSaving",2);x([$()],y.prototype,"configApplying",2);x([$()],y.prototype,"updateRunning",2);x([$()],y.prototype,"applySessionKey",2);x([$()],y.prototype,"configSnapshot",2);x([$()],y.prototype,"configSchema",2);x([$()],y.prototype,"configSchemaVersion",2);x([$()],y.prototype,"configSchemaLoading",2);x([$()],y.prototype,"configUiHints",2);x([$()],y.prototype,"configForm",2);x([$()],y.prototype,"configFormOriginal",2);x([$()],y.prototype,"configFormDirty",2);x([$()],y.prototype,"configFormMode",2);x([$()],y.prototype,"configSearchQuery",2);x([$()],y.prototype,"configActiveSection",2);x([$()],y.prototype,"configActiveSubsection",2);x([$()],y.prototype,"channelsLoading",2);x([$()],y.prototype,"channelsSnapshot",2);x([$()],y.prototype,"channelsError",2);x([$()],y.prototype,"channelsLastSuccess",2);x([$()],y.prototype,"whatsappLoginMessage",2);x([$()],y.prototype,"whatsappLoginQrDataUrl",2);x([$()],y.prototype,"whatsappLoginConnected",2);x([$()],y.prototype,"whatsappBusy",2);x([$()],y.prototype,"nostrProfileFormState",2);x([$()],y.prototype,"nostrProfileAccountId",2);x([$()],y.prototype,"presenceLoading",2);x([$()],y.prototype,"presenceEntries",2);x([$()],y.prototype,"presenceError",2);x([$()],y.prototype,"presenceStatus",2);x([$()],y.prototype,"agentsLoading",2);x([$()],y.prototype,"agentsList",2);x([$()],y.prototype,"agentsError",2);x([$()],y.prototype,"agentsSelectedId",2);x([$()],y.prototype,"agentsPanel",2);x([$()],y.prototype,"agentFilesLoading",2);x([$()],y.prototype,"agentFilesError",2);x([$()],y.prototype,"agentFilesList",2);x([$()],y.prototype,"agentFileContents",2);x([$()],y.prototype,"agentFileDrafts",2);x([$()],y.prototype,"agentFileActive",2);x([$()],y.prototype,"agentFileSaving",2);x([$()],y.prototype,"agentIdentityLoading",2);x([$()],y.prototype,"agentIdentityError",2);x([$()],y.prototype,"agentIdentityById",2);x([$()],y.prototype,"agentSkillsLoading",2);x([$()],y.prototype,"agentSkillsError",2);x([$()],y.prototype,"agentSkillsReport",2);x([$()],y.prototype,"agentSkillsAgentId",2);x([$()],y.prototype,"sessionsLoading",2);x([$()],y.prototype,"sessionsResult",2);x([$()],y.prototype,"sessionsError",2);x([$()],y.prototype,"sessionsFilterActive",2);x([$()],y.prototype,"sessionsFilterLimit",2);x([$()],y.prototype,"sessionsIncludeGlobal",2);x([$()],y.prototype,"sessionsIncludeUnknown",2);x([$()],y.prototype,"usageLoading",2);x([$()],y.prototype,"usageResult",2);x([$()],y.prototype,"usageCostSummary",2);x([$()],y.prototype,"usageError",2);x([$()],y.prototype,"usageStartDate",2);x([$()],y.prototype,"usageEndDate",2);x([$()],y.prototype,"usageSelectedSessions",2);x([$()],y.prototype,"usageSelectedDays",2);x([$()],y.prototype,"usageSelectedHours",2);x([$()],y.prototype,"usageChartMode",2);x([$()],y.prototype,"usageDailyChartMode",2);x([$()],y.prototype,"usageTimeSeriesMode",2);x([$()],y.prototype,"usageTimeSeriesBreakdownMode",2);x([$()],y.prototype,"usageTimeSeries",2);x([$()],y.prototype,"usageTimeSeriesLoading",2);x([$()],y.prototype,"usageSessionLogs",2);x([$()],y.prototype,"usageSessionLogsLoading",2);x([$()],y.prototype,"usageSessionLogsExpanded",2);x([$()],y.prototype,"usageQuery",2);x([$()],y.prototype,"usageQueryDraft",2);x([$()],y.prototype,"usageSessionSort",2);x([$()],y.prototype,"usageSessionSortDir",2);x([$()],y.prototype,"usageRecentSessions",2);x([$()],y.prototype,"usageTimeZone",2);x([$()],y.prototype,"usageContextExpanded",2);x([$()],y.prototype,"usageHeaderPinned",2);x([$()],y.prototype,"usageSessionsTab",2);x([$()],y.prototype,"usageVisibleColumns",2);x([$()],y.prototype,"usageLogFilterRoles",2);x([$()],y.prototype,"usageLogFilterTools",2);x([$()],y.prototype,"usageLogFilterHasTools",2);x([$()],y.prototype,"usageLogFilterQuery",2);x([$()],y.prototype,"cronLoading",2);x([$()],y.prototype,"cronJobs",2);x([$()],y.prototype,"cronStatus",2);x([$()],y.prototype,"cronError",2);x([$()],y.prototype,"cronForm",2);x([$()],y.prototype,"cronRunsJobId",2);x([$()],y.prototype,"cronRuns",2);x([$()],y.prototype,"cronBusy",2);x([$()],y.prototype,"skillsLoading",2);x([$()],y.prototype,"skillsReport",2);x([$()],y.prototype,"skillsError",2);x([$()],y.prototype,"skillsFilter",2);x([$()],y.prototype,"skillEdits",2);x([$()],y.prototype,"skillsBusyKey",2);x([$()],y.prototype,"skillMessages",2);x([$()],y.prototype,"debugLoading",2);x([$()],y.prototype,"debugStatus",2);x([$()],y.prototype,"debugHealth",2);x([$()],y.prototype,"debugModels",2);x([$()],y.prototype,"debugHeartbeat",2);x([$()],y.prototype,"debugCallMethod",2);x([$()],y.prototype,"debugCallParams",2);x([$()],y.prototype,"debugCallResult",2);x([$()],y.prototype,"debugCallError",2);x([$()],y.prototype,"logsLoading",2);x([$()],y.prototype,"logsError",2);x([$()],y.prototype,"logsFile",2);x([$()],y.prototype,"logsEntries",2);x([$()],y.prototype,"logsFilterText",2);x([$()],y.prototype,"logsLevelFilters",2);x([$()],y.prototype,"logsAutoFollow",2);x([$()],y.prototype,"logsTruncated",2);x([$()],y.prototype,"logsCursor",2);x([$()],y.prototype,"logsLastFetchAt",2);x([$()],y.prototype,"logsLimit",2);x([$()],y.prototype,"logsMaxBytes",2);x([$()],y.prototype,"logsAtBottom",2);x([$()],y.prototype,"chatNewMessagesBelow",2);y=x([or("cryptoclaw-app")],y);
|
|
7553
|
-
//# sourceMappingURL=index-
|
|
7561
|
+
`,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.agentsSelectedId=null,this.agentsPanel="overview",this.agentFilesLoading=!1,this.agentFilesError=null,this.agentFilesList=null,this.agentFileContents={},this.agentFileDrafts={},this.agentFileActive=null,this.agentFileSaving=!1,this.agentIdentityLoading=!1,this.agentIdentityError=null,this.agentIdentityById={},this.agentSkillsLoading=!1,this.agentSkillsError=null,this.agentSkillsReport=null,this.agentSkillsAgentId=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.sessionsFilterActive="",this.sessionsFilterLimit="120",this.sessionsIncludeGlobal=!0,this.sessionsIncludeUnknown=!1,this.usageLoading=!1,this.usageResult=null,this.usageCostSummary=null,this.usageError=null,this.usageStartDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageEndDate=(()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`})(),this.usageSelectedSessions=[],this.usageSelectedDays=[],this.usageSelectedHours=[],this.usageChartMode="tokens",this.usageDailyChartMode="by-type",this.usageTimeSeriesMode="per-turn",this.usageTimeSeriesBreakdownMode="by-type",this.usageTimeSeries=null,this.usageTimeSeriesLoading=!1,this.usageSessionLogs=null,this.usageSessionLogsLoading=!1,this.usageSessionLogsExpanded=!1,this.usageQuery="",this.usageQueryDraft="",this.usageSessionSort="recent",this.usageSessionSortDir="desc",this.usageRecentSessions=[],this.usageTimeZone="local",this.usageContextExpanded=!1,this.usageHeaderPinned=!1,this.usageSessionsTab="all",this.usageVisibleColumns=["channel","agent","provider","model","messages","tools","errors","duration"],this.usageLogFilterRoles=[],this.usageLogFilterTools=[],this.usageLogFilterHasTools=!1,this.usageLogFilterQuery="",this.usageQueryDebounceTimer=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Qu},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={...Vu},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.chatNewMessagesBelow=!1,this.nodesPollInterval=null,this.logsPollInterval=null,this.debugPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.refreshSessionsAfterChat=new Set,this.basePath="",this.popStateHandler=()=>hu(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),dg(this)}firstUpdated(){ug(this)}disconnectedCallback(){gg(this),super.disconnectedCallback()}updated(e){pg(this,e)}connect(){Xr(this)}handleChatScroll(e){Hc(this,e)}handleLogsScroll(e){Kc(this,e)}exportLogs(e,t){jc(e,t)}resetToolStream(){ns(this)}resetChatScroll(){Da(this)}scrollToBottom(){Da(this),an(this,!0)}async loadAssistantIdentity(){await Yr(this)}applySettings(e){ht(this,e)}setTab(e){lu(this,e)}setTheme(e,t){cu(this,e,t)}async loadOverview(){await Hr(this)}async loadCron(){await Bn(this)}async handleAbortChat(){await qr(this)}removeQueuedMessage(e){Ku(this,e)}async handleSendChat(e,t){await ju(this,e,t)}async handleWhatsAppStart(e){await Lc(this,e)}async handleWhatsAppWait(){await Mc(this)}async handleWhatsAppLogout(){await Ic(this)}async handleChannelConfigSave(){await Rc(this)}async handleChannelConfigReload(){await Pc(this)}handleNostrProfileEdit(e,t){Fc(this,e,t)}handleNostrProfileCancel(){Nc(this)}handleNostrProfileFieldChange(e,t){Oc(this,e,t)}async handleNostrProfileSave(){await Uc(this)}async handleNostrProfileImport(){await zc(this)}handleNostrProfileToggleAdvanced(){Bc(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,ht(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 ib(this)}};x([$()],y.prototype,"settings",2);x([$()],y.prototype,"password",2);x([$()],y.prototype,"tab",2);x([$()],y.prototype,"onboarding",2);x([$()],y.prototype,"connected",2);x([$()],y.prototype,"theme",2);x([$()],y.prototype,"themeResolved",2);x([$()],y.prototype,"hello",2);x([$()],y.prototype,"lastError",2);x([$()],y.prototype,"eventLog",2);x([$()],y.prototype,"assistantName",2);x([$()],y.prototype,"assistantAvatar",2);x([$()],y.prototype,"assistantAgentId",2);x([$()],y.prototype,"sessionKey",2);x([$()],y.prototype,"chatLoading",2);x([$()],y.prototype,"chatSending",2);x([$()],y.prototype,"chatMessage",2);x([$()],y.prototype,"chatMessages",2);x([$()],y.prototype,"chatToolMessages",2);x([$()],y.prototype,"chatStream",2);x([$()],y.prototype,"chatStreamStartedAt",2);x([$()],y.prototype,"chatRunId",2);x([$()],y.prototype,"compactionStatus",2);x([$()],y.prototype,"chatAvatarUrl",2);x([$()],y.prototype,"chatThinkingLevel",2);x([$()],y.prototype,"chatQueue",2);x([$()],y.prototype,"chatAttachments",2);x([$()],y.prototype,"sidebarOpen",2);x([$()],y.prototype,"sidebarContent",2);x([$()],y.prototype,"sidebarError",2);x([$()],y.prototype,"splitRatio",2);x([$()],y.prototype,"nodesLoading",2);x([$()],y.prototype,"nodes",2);x([$()],y.prototype,"devicesLoading",2);x([$()],y.prototype,"devicesError",2);x([$()],y.prototype,"devicesList",2);x([$()],y.prototype,"execApprovalsLoading",2);x([$()],y.prototype,"execApprovalsSaving",2);x([$()],y.prototype,"execApprovalsDirty",2);x([$()],y.prototype,"execApprovalsSnapshot",2);x([$()],y.prototype,"execApprovalsForm",2);x([$()],y.prototype,"execApprovalsSelectedAgent",2);x([$()],y.prototype,"execApprovalsTarget",2);x([$()],y.prototype,"execApprovalsTargetNodeId",2);x([$()],y.prototype,"execApprovalQueue",2);x([$()],y.prototype,"execApprovalBusy",2);x([$()],y.prototype,"execApprovalError",2);x([$()],y.prototype,"pendingGatewayUrl",2);x([$()],y.prototype,"configLoading",2);x([$()],y.prototype,"configRaw",2);x([$()],y.prototype,"configRawOriginal",2);x([$()],y.prototype,"configValid",2);x([$()],y.prototype,"configIssues",2);x([$()],y.prototype,"configSaving",2);x([$()],y.prototype,"configApplying",2);x([$()],y.prototype,"updateRunning",2);x([$()],y.prototype,"applySessionKey",2);x([$()],y.prototype,"configSnapshot",2);x([$()],y.prototype,"configSchema",2);x([$()],y.prototype,"configSchemaVersion",2);x([$()],y.prototype,"configSchemaLoading",2);x([$()],y.prototype,"configUiHints",2);x([$()],y.prototype,"configForm",2);x([$()],y.prototype,"configFormOriginal",2);x([$()],y.prototype,"configFormDirty",2);x([$()],y.prototype,"configFormMode",2);x([$()],y.prototype,"configSearchQuery",2);x([$()],y.prototype,"configActiveSection",2);x([$()],y.prototype,"configActiveSubsection",2);x([$()],y.prototype,"channelsLoading",2);x([$()],y.prototype,"channelsSnapshot",2);x([$()],y.prototype,"channelsError",2);x([$()],y.prototype,"channelsLastSuccess",2);x([$()],y.prototype,"whatsappLoginMessage",2);x([$()],y.prototype,"whatsappLoginQrDataUrl",2);x([$()],y.prototype,"whatsappLoginConnected",2);x([$()],y.prototype,"whatsappBusy",2);x([$()],y.prototype,"nostrProfileFormState",2);x([$()],y.prototype,"nostrProfileAccountId",2);x([$()],y.prototype,"presenceLoading",2);x([$()],y.prototype,"presenceEntries",2);x([$()],y.prototype,"presenceError",2);x([$()],y.prototype,"presenceStatus",2);x([$()],y.prototype,"agentsLoading",2);x([$()],y.prototype,"agentsList",2);x([$()],y.prototype,"agentsError",2);x([$()],y.prototype,"agentsSelectedId",2);x([$()],y.prototype,"agentsPanel",2);x([$()],y.prototype,"agentFilesLoading",2);x([$()],y.prototype,"agentFilesError",2);x([$()],y.prototype,"agentFilesList",2);x([$()],y.prototype,"agentFileContents",2);x([$()],y.prototype,"agentFileDrafts",2);x([$()],y.prototype,"agentFileActive",2);x([$()],y.prototype,"agentFileSaving",2);x([$()],y.prototype,"agentIdentityLoading",2);x([$()],y.prototype,"agentIdentityError",2);x([$()],y.prototype,"agentIdentityById",2);x([$()],y.prototype,"agentSkillsLoading",2);x([$()],y.prototype,"agentSkillsError",2);x([$()],y.prototype,"agentSkillsReport",2);x([$()],y.prototype,"agentSkillsAgentId",2);x([$()],y.prototype,"sessionsLoading",2);x([$()],y.prototype,"sessionsResult",2);x([$()],y.prototype,"sessionsError",2);x([$()],y.prototype,"sessionsFilterActive",2);x([$()],y.prototype,"sessionsFilterLimit",2);x([$()],y.prototype,"sessionsIncludeGlobal",2);x([$()],y.prototype,"sessionsIncludeUnknown",2);x([$()],y.prototype,"usageLoading",2);x([$()],y.prototype,"usageResult",2);x([$()],y.prototype,"usageCostSummary",2);x([$()],y.prototype,"usageError",2);x([$()],y.prototype,"usageStartDate",2);x([$()],y.prototype,"usageEndDate",2);x([$()],y.prototype,"usageSelectedSessions",2);x([$()],y.prototype,"usageSelectedDays",2);x([$()],y.prototype,"usageSelectedHours",2);x([$()],y.prototype,"usageChartMode",2);x([$()],y.prototype,"usageDailyChartMode",2);x([$()],y.prototype,"usageTimeSeriesMode",2);x([$()],y.prototype,"usageTimeSeriesBreakdownMode",2);x([$()],y.prototype,"usageTimeSeries",2);x([$()],y.prototype,"usageTimeSeriesLoading",2);x([$()],y.prototype,"usageSessionLogs",2);x([$()],y.prototype,"usageSessionLogsLoading",2);x([$()],y.prototype,"usageSessionLogsExpanded",2);x([$()],y.prototype,"usageQuery",2);x([$()],y.prototype,"usageQueryDraft",2);x([$()],y.prototype,"usageSessionSort",2);x([$()],y.prototype,"usageSessionSortDir",2);x([$()],y.prototype,"usageRecentSessions",2);x([$()],y.prototype,"usageTimeZone",2);x([$()],y.prototype,"usageContextExpanded",2);x([$()],y.prototype,"usageHeaderPinned",2);x([$()],y.prototype,"usageSessionsTab",2);x([$()],y.prototype,"usageVisibleColumns",2);x([$()],y.prototype,"usageLogFilterRoles",2);x([$()],y.prototype,"usageLogFilterTools",2);x([$()],y.prototype,"usageLogFilterHasTools",2);x([$()],y.prototype,"usageLogFilterQuery",2);x([$()],y.prototype,"cronLoading",2);x([$()],y.prototype,"cronJobs",2);x([$()],y.prototype,"cronStatus",2);x([$()],y.prototype,"cronError",2);x([$()],y.prototype,"cronForm",2);x([$()],y.prototype,"cronRunsJobId",2);x([$()],y.prototype,"cronRuns",2);x([$()],y.prototype,"cronBusy",2);x([$()],y.prototype,"skillsLoading",2);x([$()],y.prototype,"skillsReport",2);x([$()],y.prototype,"skillsError",2);x([$()],y.prototype,"skillsFilter",2);x([$()],y.prototype,"skillEdits",2);x([$()],y.prototype,"skillsBusyKey",2);x([$()],y.prototype,"skillMessages",2);x([$()],y.prototype,"debugLoading",2);x([$()],y.prototype,"debugStatus",2);x([$()],y.prototype,"debugHealth",2);x([$()],y.prototype,"debugModels",2);x([$()],y.prototype,"debugHeartbeat",2);x([$()],y.prototype,"debugCallMethod",2);x([$()],y.prototype,"debugCallParams",2);x([$()],y.prototype,"debugCallResult",2);x([$()],y.prototype,"debugCallError",2);x([$()],y.prototype,"logsLoading",2);x([$()],y.prototype,"logsError",2);x([$()],y.prototype,"logsFile",2);x([$()],y.prototype,"logsEntries",2);x([$()],y.prototype,"logsFilterText",2);x([$()],y.prototype,"logsLevelFilters",2);x([$()],y.prototype,"logsAutoFollow",2);x([$()],y.prototype,"logsTruncated",2);x([$()],y.prototype,"logsCursor",2);x([$()],y.prototype,"logsLastFetchAt",2);x([$()],y.prototype,"logsLimit",2);x([$()],y.prototype,"logsMaxBytes",2);x([$()],y.prototype,"logsAtBottom",2);x([$()],y.prototype,"chatNewMessagesBelow",2);y=x([ir("cryptoclaw-app")],y);
|
|
7562
|
+
//# sourceMappingURL=index-BdjmXlOn.js.map
|