@rubytech/taskmaster 1.7.2 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-info.json +3 -3
- package/dist/control-ui/assets/{index-BFPQ4MXV.js → index-D3tbqnfY.js} +622 -507
- package/dist/control-ui/assets/index-D3tbqnfY.js.map +1 -0
- package/dist/control-ui/index.html +1 -1
- package/dist/gateway/server-methods/network.js +165 -0
- package/dist/gateway/server-methods-list.js +2 -0
- package/dist/gateway/server-methods.js +2 -0
- package/package.json +1 -1
- package/skills/taskmaster/SKILL.md +34 -0
- package/skills/taskmaster/references/docs-guide.md +74 -0
- package/taskmaster-docs/USER-GUIDE.md +29 -111
- package/templates/taskmaster/skills/taskmaster/SKILL.md +29 -47
- package/dist/control-ui/assets/index-BFPQ4MXV.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var zu=Object.defineProperty;var qu=(e,t,n)=>t in e?zu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var K=(e,t,n)=>qu(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const Hu="modulepreload",ju=function(e,t){return new URL(e,t).href},qa={},ae=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let c=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const a=document.getElementsByTagName("link"),r=document.querySelector("meta[property=csp-nonce]"),d=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));s=c(n.map(l=>{if(l=ju(l,i),l in qa)return;qa[l]=!0;const p=l.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(i)for(let S=a.length-1;S>=0;S--){const f=a[S];if(f.href===l&&(!p||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${h}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":Hu,p||(v.as="script"),v.crossOrigin="",v.href=l,d&&v.setAttribute("nonce",d),document.head.appendChild(v),p)return new Promise((S,f)=>{v.addEventListener("load",S),v.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(a){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=a,window.dispatchEvent(r),!r.defaultPrevented)throw a}return s.then(a=>{for(const r of a||[])r.status==="rejected"&&o(r.reason);return t().catch(o)})};const gi=globalThis,Po=gi.ShadowRoot&&(gi.ShadyCSS===void 0||gi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lo=Symbol(),Ha=new WeakMap;let Ul=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==Lo)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(Po&&t===void 0){const i=n!==void 0&&n.length===1;i&&(t=Ha.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ha.set(n,t))}return t}toString(){return this.cssText}};const Vu=e=>new Ul(typeof e=="string"?e:e+"",void 0,Lo),Gu=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((i,s,o)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[o+1],e[0]);return new Ul(n,e,Lo)},Qu=(e,t)=>{if(Po)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const i=document.createElement("style"),s=gi.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,e.appendChild(i)}},ja=Po?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const i of t.cssRules)n+=i.cssText;return Vu(n)})(e):e;const{is:Yu,defineProperty:Ju,getOwnPropertyDescriptor:Xu,getOwnPropertyNames:Zu,getOwnPropertySymbols:ep,getPrototypeOf:tp}=Object,tt=globalThis,Va=tt.trustedTypes,np=Va?Va.emptyScript:"",ms=tt.reactiveElementPolyfillSupport,bn=(e,t)=>e,ki={toAttribute(e,t){switch(t){case Boolean:e=e?np: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}},Io=(e,t)=>!Yu(e,t),Ga={attribute:!0,type:String,converter:ki,reflect:!1,useDefault:!1,hasChanged:Io};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),tt.litPropertyMetadata??(tt.litPropertyMetadata=new WeakMap);let Ut=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=Ga){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,n);s!==void 0&&Ju(this.prototype,t,s)}}static getPropertyDescriptor(t,n,i){const{get:s,set:o}=Xu(this.prototype,t)??{get(){return this[n]},set(a){this[n]=a}};return{get:s,set(a){const r=s==null?void 0:s.call(this);o==null||o.call(this,a),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ga}static _$Ei(){if(this.hasOwnProperty(bn("elementProperties")))return;const t=tp(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(bn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(bn("properties"))){const n=this.properties,i=[...Zu(n),...ep(n)];for(const s of i)this.createProperty(s,n[s])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[i,s]of n)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[n,i]of this.elementProperties){const s=this._$Eu(n,i);s!==void 0&&this._$Eh.set(s,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)n.unshift(ja(s))}else t!==void 0&&n.push(ja(t));return n}static _$Eu(t,n){const i=n.attribute;return i===!1?void 0:typeof i=="string"?i: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(){var t;this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(n=>n(this))}addController(t){var n;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)==null||n.call(t))}removeController(t){var n;(n=this._$EO)==null||n.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const i of n.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Qu(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostConnected)==null?void 0:i.call(n)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostDisconnected)==null?void 0:i.call(n)})}attributeChangedCallback(t,n,i){this._$AK(t,i)}_$ET(t,n){var o;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const a=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:ki).toAttribute(n,i.type);this._$Em=t,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(t,n){var o,a;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const r=i.getPropertyOptions(s),d=typeof r.converter=="function"?{fromAttribute:r.converter}:((o=r.converter)==null?void 0:o.fromAttribute)!==void 0?r.converter:ki;this._$Em=s;const c=d.fromAttribute(n,r.type);this[s]=c??((a=this._$Ej)==null?void 0:a.get(s))??c,this._$Em=null}}requestUpdate(t,n,i,s=!1,o){var a;if(t!==void 0){const r=this.constructor;if(s===!1&&(o=this[t]),i??(i=r.getPropertyOptions(t)),!((i.hasChanged??Io)(o,n)||i.useDefault&&i.reflect&&o===((a=this._$Ej)==null?void 0:a.get(t))&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:i,reflect:s,wrapped:o},a){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,a??n??this[t]),o!==!0||a!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(n=void 0),this._$AL.set(t,n)),s===!0&&this._$Em!==t&&(this._$Eq??(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(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,a]of s){const{wrapped:r}=a,d=this[o];r!==!0||this._$AL.has(o)||d===void 0||this.C(o,void 0,a,d)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(s=>{var o;return(o=s.hostUpdate)==null?void 0:o.call(s)}),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){var n;(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),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=this._$Eq.forEach(n=>this._$ET(n,this[n]))),this._$EM()}updated(t){}firstUpdated(t){}};Ut.elementStyles=[],Ut.shadowRootOptions={mode:"open"},Ut[bn("elementProperties")]=new Map,Ut[bn("finalized")]=new Map,ms==null||ms({ReactiveElement:Ut}),(tt.reactiveElementVersions??(tt.reactiveElementVersions=[])).push("2.1.2");const wn=globalThis,Qa=e=>e,$i=wn.trustedTypes,Ya=$i?$i.createPolicy("lit-html",{createHTML:e=>e}):void 0,Kl="$lit$",et=`lit$${Math.random().toFixed(9).slice(2)}$`,Wl="?"+et,ip=`<${Wl}>`,$t=document,Pn=()=>$t.createComment(""),Ln=e=>e===null||typeof e!="object"&&typeof e!="function",Ro=Array.isArray,sp=e=>Ro(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",ys=`[
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Za=/'/g,er=/"/g,zl=/^(?:script|style|textarea|title)$/i,op=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),u=op(1),it=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),tr=new WeakMap,mt=$t.createTreeWalker($t,129);function ql(e,t){if(!Ro(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ya!==void 0?Ya.createHTML(t):t}const ap=(e,t)=>{const n=e.length-1,i=[];let s,o=t===2?"<svg>":t===3?"<math>":"",a=an;for(let r=0;r<n;r++){const d=e[r];let c,l,p=-1,h=0;for(;h<d.length&&(a.lastIndex=h,l=a.exec(d),l!==null);)h=a.lastIndex,a===an?l[1]==="!--"?a=Ja:l[1]!==void 0?a=Xa:l[2]!==void 0?(zl.test(l[2])&&(s=RegExp("</"+l[2],"g")),a=ut):l[3]!==void 0&&(a=ut):a===ut?l[0]===">"?(a=s??an,p=-1):l[1]===void 0?p=-2:(p=a.lastIndex-l[2].length,c=l[1],a=l[3]===void 0?ut:l[3]==='"'?er:Za):a===er||a===Za?a=ut:a===Ja||a===Xa?a=an:(a=ut,s=void 0);const v=a===ut&&e[r+1].startsWith("/>")?" ":"";o+=a===an?d+ip:p>=0?(i.push(c),d.slice(0,p)+Kl+d.slice(p)+et+v):d+et+(p===-2?r:v)}return[ql(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let no=class Hl{constructor({strings:t,_$litType$:n},i){let s;this.parts=[];let o=0,a=0;const r=t.length-1,d=this.parts,[c,l]=ap(t,n);if(this.el=Hl.createElement(c,i),mt.currentNode=this.el.content,n===2||n===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=mt.nextNode())!==null&&d.length<r;){if(s.nodeType===1){if(s.hasAttributes())for(const p of s.getAttributeNames())if(p.endsWith(Kl)){const h=l[a++],v=s.getAttribute(p).split(et),S=/([.?@])?(.*)/.exec(h);d.push({type:1,index:o,name:S[2],strings:v,ctor:S[1]==="."?lp:S[1]==="?"?cp:S[1]==="@"?dp:ji}),s.removeAttribute(p)}else p.startsWith(et)&&(d.push({type:6,index:o}),s.removeAttribute(p));if(zl.test(s.tagName)){const p=s.textContent.split(et),h=p.length-1;if(h>0){s.textContent=$i?$i.emptyScript:"";for(let v=0;v<h;v++)s.append(p[v],Pn()),mt.nextNode(),d.push({type:2,index:++o});s.append(p[h],Pn())}}}else if(s.nodeType===8)if(s.data===Wl)d.push({type:2,index:o});else{let p=-1;for(;(p=s.data.indexOf(et,p+1))!==-1;)d.push({type:7,index:o}),p+=et.length-1}o++}}static createElement(t,n){const i=$t.createElement("template");return i.innerHTML=t,i}};function jt(e,t,n=e,i){var a,r;if(t===it)return t;let s=i!==void 0?(a=n._$Co)==null?void 0:a[i]:n._$Cl;const o=Ln(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==o&&((r=s==null?void 0:s._$AO)==null||r.call(s,!1),o===void 0?s=void 0:(s=new o(e),s._$AT(e,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=s:n._$Cl=s),s!==void 0&&(t=jt(e,s._$AS(e,t.values),s,i)),t}class rp{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:i}=this._$AD,s=((t==null?void 0:t.creationScope)??$t).importNode(n,!0);mt.currentNode=s;let o=mt.nextNode(),a=0,r=0,d=i[0];for(;d!==void 0;){if(a===d.index){let c;d.type===2?c=new Hi(o,o.nextSibling,this,t):d.type===1?c=new d.ctor(o,d.name,d.strings,this,t):d.type===6&&(c=new up(o,this,t)),this._$AV.push(c),d=i[++r]}a!==(d==null?void 0:d.index)&&(o=mt.nextNode(),a++)}return mt.currentNode=$t,s}p(t){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}let Hi=class jl{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,n,i,s){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=jt(this,t,n),Ln(t)?t===k||t==null||t===""?(this._$AH!==k&&this._$AR(),this._$AH=k):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):sp(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!==k&&Ln(this._$AH)?this._$AA.nextSibling.data=t:this.T($t.createTextNode(t)),this._$AH=t}$(t){var o;const{values:n,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=no.createElement(ql(i.h,i.h[0]),this.options)),i);if(((o=this._$AH)==null?void 0:o._$AD)===s)this._$AH.p(n);else{const a=new rp(s,this),r=a.u(this.options);a.p(n),this.T(r),this._$AH=a}}_$AC(t){let n=tr.get(t.strings);return n===void 0&&tr.set(t.strings,n=new no(t)),n}k(t){Ro(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,s=0;for(const o of t)s===n.length?n.push(i=new jl(this.O(Pn()),this.O(Pn()),this,this.options)):i=n[s],i._$AI(o),s++;s<n.length&&(this._$AR(i&&i._$AB.nextSibling,s),n.length=s)}_$AR(t=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);t!==this._$AB;){const s=Qa(t).nextSibling;Qa(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}};class ji{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,s,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=k}_$AI(t,n=this,i,s){const o=this.strings;let a=!1;if(o===void 0)t=jt(this,t,n,0),a=!Ln(t)||t!==this._$AH&&t!==it,a&&(this._$AH=t);else{const r=t;let d,c;for(t=o[0],d=0;d<o.length-1;d++)c=jt(this,r[i+d],n,d),c===it&&(c=this._$AH[d]),a||(a=!Ln(c)||c!==this._$AH[d]),c===k?t=k:t!==k&&(t+=(c??"")+o[d+1]),this._$AH[d]=c}a&&!s&&this.j(t)}j(t){t===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let lp=class extends ji{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===k?void 0:t}},cp=class extends ji{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==k)}},dp=class extends ji{constructor(t,n,i,s,o){super(t,n,i,s,o),this.type=5}_$AI(t,n=this){if((t=jt(this,t,n,0)??k)===it)return;const i=this._$AH,s=t===k&&i!==k||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==k&&(i===k||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,t):this._$AH.handleEvent(t)}},up=class{constructor(t,n,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){jt(this,t)}};const pp={I:Hi},vs=wn.litHtmlPolyfillSupport;vs==null||vs(no,Hi),(wn.litHtmlVersions??(wn.litHtmlVersions=[])).push("3.3.2");const hp=(e,t,n)=>{const i=(n==null?void 0:n.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const o=(n==null?void 0:n.renderBefore)??null;i._$litPart$=s=new Hi(t.insertBefore(Pn(),o),o,void 0,n??{})}return s._$AI(e),s};const bt=globalThis;let zt=class extends Ut{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const t=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=t.firstChild),t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=hp(n,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return it}};var Ol;zt._$litElement$=!0,zt.finalized=!0,(Ol=bt.litElementHydrateSupport)==null||Ol.call(bt,{LitElement:zt});const bs=bt.litElementPolyfillSupport;bs==null||bs({LitElement:zt});(bt.litElementVersions??(bt.litElementVersions=[])).push("4.2.2");const Vl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const fp={attribute:!0,type:String,converter:ki,reflect:!1,hasChanged:Io},gp=(e=fp,t,n)=>{const{kind:i,metadata:s}=n;let o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(n.name,e),i==="accessor"){const{name:a}=n;return{set(r){const d=t.get.call(this);t.set.call(this,r),this.requestUpdate(a,d,e,!0,r)},init(r){return r!==void 0&&this.C(a,void 0,e,r),r}}}if(i==="setter"){const{name:a}=n;return function(r){const d=this[a];t.call(this,r),this.requestUpdate(a,d,e,!0,r)}}throw Error("Unsupported decorator location: "+i)};function Vi(e){return(t,n)=>typeof n=="object"?gp(e,t,n):((i,s,o)=>{const a=s.hasOwnProperty(o);return s.constructor.createProperty(o,i),a?Object.getOwnPropertyDescriptor(s,o):void 0})(e,t,n)}function y(e){return Vi({...e,state:!0,attribute:!1})}const mp=50,yp=200,vp="Assistant";function nr(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function io(e){const t=nr(e==null?void 0:e.name,mp)??vp,n=nr((e==null?void 0:e.avatar)??void 0,yp)??null;return{agentId:typeof(e==null?void 0:e.agentId)=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function bp(){return io(typeof window>"u"?{}:{name:window.__TASKMASTER_ASSISTANT_NAME__,avatar:window.__TASKMASTER_ASSISTANT_AVATAR__})}const wp="Taskmaster",kp="/taskmaster-icon.png",$p="#00d4ff",Sp="";let Xn=null;function Ve(){return Xn||(Xn={name:window.__TASKMASTER_BRAND_NAME__||wp,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||kp,accentColor:window.__TASKMASTER_ACCENT_COLOR__||$p,backgroundColor:window.__TASKMASTER_BACKGROUND_COLOR__||Sp},Xn)}function Re(){return window.__TASKMASTER_WORKSPACE_BRANDS__??{}}function Gl(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);return t?`${parseInt(t[1],16)}, ${parseInt(t[2],16)}, ${parseInt(t[3],16)}`:null}function xp(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!t)return 0;const[n,i,s]=[t[1],t[2],t[3]].map(o=>{const a=parseInt(o,16)/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*n+.7152*i+.0722*s}function Ql(e){const t=Gl(e);if(!t)return;const n=document.documentElement;n.style.setProperty("--accent",e),n.style.setProperty("--accent-hover",e),n.style.setProperty("--accent-muted",e),n.style.setProperty("--primary",e),n.style.setProperty("--ring",e),n.style.setProperty("--accent-subtle",`rgba(${t}, 0.15)`),n.style.setProperty("--accent-glow",`rgba(${t}, 0.25)`),n.style.setProperty("--tasker-orange",e),n.style.setProperty("--tasker-orange-hover",e),n.style.setProperty("--tasker-orange-glow",`rgba(${t}, 0.25)`);const i=xp(e)>.4?"#111111":"#ffffff";n.style.setProperty("--accent-foreground",i),n.style.setProperty("--primary-foreground",i)}function Zn(e,t,n){const i=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e),s=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!i||!s)return e;const o=(c,l)=>Math.round(parseInt(i[c],16)*(1-n)+parseInt(s[l],16)*n),a=o(1,1),r=o(2,2),d=o(3,3);return`#${a.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${d.toString(16).padStart(2,"0")}`}const rn={"--bg":"#12141a","--bg-muted":"#262a35","--card":"#181b22","--secondary":"#1e2028"};function Yl(e){const t=document.documentElement;if(!e){for(const[i,s]of Object.entries(rn))t.style.setProperty(i,s);t.style.removeProperty("--brand-bg"),t.style.removeProperty("--brand-bg-subtle"),t.style.removeProperty("--brand-bg-card");return}const n=Gl(e);n&&(t.style.setProperty("--bg",Zn(rn["--bg"],e,.08)),t.style.setProperty("--bg-muted",Zn(rn["--bg-muted"],e,.1)),t.style.setProperty("--card",Zn(rn["--card"],e,.12)),t.style.setProperty("--secondary",Zn(rn["--secondary"],e,.1)),t.style.setProperty("--brand-bg",e),t.style.setProperty("--brand-bg-subtle",`rgba(${n}, 0.08)`),t.style.setProperty("--brand-bg-card",`rgba(${n}, 0.12)`))}function kn(e){const t=Ve(),n=Re(),i=e?n[e]:void 0,s=(i==null?void 0:i.accentColor)??t.accentColor;Ql(s);const o=(i==null?void 0:i.backgroundColor)??t.backgroundColor;Yl(o)}const Si="taskmaster.control.settings.v1",Jl="taskmaster.account.settings.";function $n(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}`}const Ot={gatewayUrl:$n(),token:"",theme:"system",navCollapsed:!1,navGroupsCollapsed:{}},Ze={sessionKey:"main",lastActiveSessionKey:"main",chatFocusMode:!1,chatShowThinking:!1,splitRatio:.6};function Ap(){try{const e=localStorage.getItem(Si);if(!e)return{...Ot,gatewayUrl:$n()};const t=JSON.parse(e);return{gatewayUrl:typeof t.gatewayUrl=="string"&&t.gatewayUrl.trim()?t.gatewayUrl.trim():$n(),token:typeof t.token=="string"?t.token:Ot.token,theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:Ot.theme,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:Ot.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:Ot.navGroupsCollapsed}}catch{return{...Ot,gatewayUrl:$n()}}}function Cp(e){if(!e)return{...Ze};try{const t=localStorage.getItem(Jl+e);if(!t)return{...Ze};const n=JSON.parse(t);return{sessionKey:typeof n.sessionKey=="string"&&n.sessionKey.trim()?n.sessionKey.trim():Ze.sessionKey,lastActiveSessionKey:typeof n.lastActiveSessionKey=="string"&&n.lastActiveSessionKey.trim()?n.lastActiveSessionKey.trim():typeof n.sessionKey=="string"&&n.sessionKey.trim()||Ze.lastActiveSessionKey,chatFocusMode:typeof n.chatFocusMode=="boolean"?n.chatFocusMode:Ze.chatFocusMode,chatShowThinking:typeof n.chatShowThinking=="boolean"?n.chatShowThinking:Ze.chatShowThinking,splitRatio:typeof n.splitRatio=="number"&&n.splitRatio>=.4&&n.splitRatio<=.7?n.splitRatio:Ze.splitRatio}}catch{return{...Ze}}}let xi=null;function ir(e){xi=e}function ws(){return{...Ap(),...Cp(xi)}}function Ep(e){const t={gatewayUrl:e.gatewayUrl,token:e.token,theme:e.theme,navCollapsed:e.navCollapsed,navGroupsCollapsed:e.navGroupsCollapsed};if(localStorage.setItem(Si,JSON.stringify(t)),xi){const n={sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,chatFocusMode:e.chatFocusMode,chatShowThinking:e.chatShowThinking,splitRatio:e.splitRatio};localStorage.setItem(Jl+xi,JSON.stringify(n))}}const Tp="taskmaster.draft.";function Do(e,t){return Tp+e+"."+t}function In(e,t,n){try{const i=Do(e,t);n?localStorage.setItem(i,n):localStorage.removeItem(i)}catch{}}function Rn(e,t){try{return localStorage.getItem(Do(e,t))??""}catch{return""}}function _p(e,t){try{localStorage.removeItem(Do(e,t))}catch{}}let yt=null,$e=null;function sr(e,t,n){$e={workspace:e,sessionKey:t,text:n},yt!=null&&clearTimeout(yt),yt=setTimeout(()=>{$e&&In($e.workspace,$e.sessionKey,$e.text),$e=null,yt=null},300)}function so(){yt!=null&&clearTimeout(yt),yt=null,$e&&(In($e.workspace,$e.sessionKey,$e.text),$e=null)}(function(){try{const t=localStorage.getItem(Si);if(!t)return;const n=JSON.parse(t);if(!("sessionKey"in n))return;const i={gatewayUrl:typeof n.gatewayUrl=="string"?n.gatewayUrl:$n(),token:typeof n.token=="string"?n.token:"",theme:n.theme==="light"||n.theme==="dark"||n.theme==="system"?n.theme:"system",navCollapsed:typeof n.navCollapsed=="boolean"?n.navCollapsed:!1,navGroupsCollapsed:typeof n.navGroupsCollapsed=="object"&&n.navGroupsCollapsed!==null?n.navGroupsCollapsed:{}};localStorage.setItem(Si,JSON.stringify(i))}catch{}})();function Xl(e){var o;const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const i=(o=n[1])==null?void 0:o.trim(),s=n.slice(2).join(":");return!i||!s?null:{agentId:i,rest:s}}const Mp=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,ei=/<\s*\/?\s*final\b[^>]*>/gi,or=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function Pp(e,t){return e.trimStart()}function Lp(e,t){if(!e||!Mp.test(e))return e;let n=e;ei.test(n)?(ei.lastIndex=0,n=n.replace(ei,"")):ei.lastIndex=0,or.lastIndex=0;let i="",s=0,o=!1;for(const a of n.matchAll(or)){const r=a.index??0,d=a[1]==="/";o?d&&(o=!1):(i+=n.slice(s,r),d||(o=!0)),s=r+a[0].length}return i+=n.slice(s),Pp(i)}function Zl(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function Gi(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0){const a=-t,r=Math.round(a/1e3);if(r<60)return`in ${r}s`;const d=Math.round(r/60);if(d<60)return`in ${d}m`;const c=Math.round(d/60);return c<48?`in ${c}h`:`in ${Math.round(c/24)}d`}const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const i=Math.round(n/60);if(i<60)return`${i}m ago`;const s=Math.round(i/60);return s<48?`${s}h ago`:`${Math.round(s/24)}d ago`}function Bo(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 i=Math.round(n/60);return i<48?`${i}h`:`${Math.round(i/24)}d`}function Ip(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function ec(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 Ai(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ks(e){return Lp(e)}const Rp=/^\[([^\]]+)\]\s*/,Dp=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],$s=new WeakMap,Ss=new WeakMap;function Bp(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:Dp.some(t=>e.startsWith(`${t} `))}function xs(e){const t=e.match(Rp);if(!t)return e;const n=t[1]??"";return Bp(n)?e.slice(t[0].length):e}function Sn(e){const t=e,n=typeof t.role=="string"?t.role:"",i=t.content;if(typeof i=="string")return n==="assistant"?ks(i):xs(i);if(Array.isArray(i)){const s=i.map(o=>{const a=o;return a.type==="text"&&typeof a.text=="string"?a.text:null}).filter(o=>typeof o=="string");if(s.length>0){const o=s.join(`
|
|
4
|
-
`);return n==="assistant"?ks(o):xs(o)}}return typeof t.text=="string"?n==="assistant"?ks(t.text):xs(t.text):null}function tc(e){if(!e||typeof e!="object")return Sn(e);const t=e;if($s.has(t))return $s.get(t)??null;const n=Sn(e);return $s.set(t,n),n}function
|
|
5
|
-
`);const s=
|
|
6
|
-
`):null}function
|
|
7
|
-
`)}return typeof t.text=="string"?t.text:null}function
|
|
8
|
-
`):""}const
|
|
1
|
+
var Hu=Object.defineProperty;var qu=(e,t,n)=>t in e?Hu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var W=(e,t,n)=>qu(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const ju="modulepreload",Vu=function(e,t){return new URL(e,t).href},Hr={},re=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let c=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const r=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),d=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=c(n.map(l=>{if(l=Vu(l,i),l in Hr)return;Hr[l]=!0;const p=l.endsWith(".css"),f=p?'[rel="stylesheet"]':"";if(i)for(let S=r.length-1;S>=0;S--){const h=r[S];if(h.href===l&&(!p||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${f}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":ju,p||(v.as="script"),v.crossOrigin="",v.href=l,d&&v.setAttribute("nonce",d),document.head.appendChild(v),p)return new Promise((S,h)=>{v.addEventListener("load",S),v.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(r){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r}return s.then(r=>{for(const a of r||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};const gi=globalThis,Po=gi.ShadowRoot&&(gi.ShadyCSS===void 0||gi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lo=Symbol(),qr=new WeakMap;let Ul=class{constructor(t,n,i){if(this._$cssResult$=!0,i!==Lo)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(Po&&t===void 0){const i=n!==void 0&&n.length===1;i&&(t=qr.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&qr.set(n,t))}return t}toString(){return this.cssText}};const Gu=e=>new Ul(typeof e=="string"?e:e+"",void 0,Lo),Qu=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((i,s,o)=>i+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[o+1],e[0]);return new Ul(n,e,Lo)},Ju=(e,t)=>{if(Po)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const i=document.createElement("style"),s=gi.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,e.appendChild(i)}},jr=Po?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const i of t.cssRules)n+=i.cssText;return Gu(n)})(e):e;const{is:Yu,defineProperty:Xu,getOwnPropertyDescriptor:Zu,getOwnPropertyNames:ep,getOwnPropertySymbols:tp,getPrototypeOf:np}=Object,tt=globalThis,Vr=tt.trustedTypes,ip=Vr?Vr.emptyScript:"",ms=tt.reactiveElementPolyfillSupport,bn=(e,t)=>e,ki={toAttribute(e,t){switch(t){case Boolean:e=e?ip: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}},Io=(e,t)=>!Yu(e,t),Gr={attribute:!0,type:String,converter:ki,reflect:!1,useDefault:!1,hasChanged:Io};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),tt.litPropertyMetadata??(tt.litPropertyMetadata=new WeakMap);let Ut=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=Gr){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 i=Symbol(),s=this.getPropertyDescriptor(t,i,n);s!==void 0&&Xu(this.prototype,t,s)}}static getPropertyDescriptor(t,n,i){const{get:s,set:o}=Zu(this.prototype,t)??{get(){return this[n]},set(r){this[n]=r}};return{get:s,set(r){const a=s==null?void 0:s.call(this);o==null||o.call(this,r),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Gr}static _$Ei(){if(this.hasOwnProperty(bn("elementProperties")))return;const t=np(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(bn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(bn("properties"))){const n=this.properties,i=[...ep(n),...tp(n)];for(const s of i)this.createProperty(s,n[s])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[i,s]of n)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[n,i]of this.elementProperties){const s=this._$Eu(n,i);s!==void 0&&this._$Eh.set(s,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)n.unshift(jr(s))}else t!==void 0&&n.push(jr(t));return n}static _$Eu(t,n){const i=n.attribute;return i===!1?void 0:typeof i=="string"?i: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(){var t;this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(n=>n(this))}addController(t){var n;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)==null||n.call(t))}removeController(t){var n;(n=this._$EO)==null||n.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const i of n.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ju(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostConnected)==null?void 0:i.call(n)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostDisconnected)==null?void 0:i.call(n)})}attributeChangedCallback(t,n,i){this._$AK(t,i)}_$ET(t,n){var o;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const r=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:ki).toAttribute(n,i.type);this._$Em=t,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,n){var o,r;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=i.getPropertyOptions(s),d=typeof a.converter=="function"?{fromAttribute:a.converter}:((o=a.converter)==null?void 0:o.fromAttribute)!==void 0?a.converter:ki;this._$Em=s;const c=d.fromAttribute(n,a.type);this[s]=c??((r=this._$Ej)==null?void 0:r.get(s))??c,this._$Em=null}}requestUpdate(t,n,i,s=!1,o){var r;if(t!==void 0){const a=this.constructor;if(s===!1&&(o=this[t]),i??(i=a.getPropertyOptions(t)),!((i.hasChanged??Io)(o,n)||i.useDefault&&i.reflect&&o===((r=this._$Ej)==null?void 0:r.get(t))&&!this.hasAttribute(a._$Eu(t,i))))return;this.C(t,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:i,reflect:s,wrapped:o},r){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,r??n??this[t]),o!==!0||r!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(n=void 0),this._$AL.set(t,n)),s===!0&&this._$Em!==t&&(this._$Eq??(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(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,r]of this._$Ep)this[o]=r;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,r]of s){const{wrapped:a}=r,d=this[o];a!==!0||this._$AL.has(o)||d===void 0||this.C(o,void 0,r,d)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(s=>{var o;return(o=s.hostUpdate)==null?void 0:o.call(s)}),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){var n;(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),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=this._$Eq.forEach(n=>this._$ET(n,this[n]))),this._$EM()}updated(t){}firstUpdated(t){}};Ut.elementStyles=[],Ut.shadowRootOptions={mode:"open"},Ut[bn("elementProperties")]=new Map,Ut[bn("finalized")]=new Map,ms==null||ms({ReactiveElement:Ut}),(tt.reactiveElementVersions??(tt.reactiveElementVersions=[])).push("2.1.2");const wn=globalThis,Qr=e=>e,$i=wn.trustedTypes,Jr=$i?$i.createPolicy("lit-html",{createHTML:e=>e}):void 0,Wl="$lit$",et=`lit$${Math.random().toFixed(9).slice(2)}$`,Kl="?"+et,sp=`<${Kl}>`,$t=document,Pn=()=>$t.createComment(""),Ln=e=>e===null||typeof e!="object"&&typeof e!="function",Ro=Array.isArray,op=e=>Ro(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",ys=`[
|
|
2
|
+
\f\r]`,rn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Yr=/-->/g,Xr=/>/g,ut=RegExp(`>|${ys}(?:([^\\s"'>=/]+)(${ys}*=${ys}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zr=/'/g,ea=/"/g,zl=/^(?:script|style|textarea|title)$/i,rp=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),u=rp(1),it=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),ta=new WeakMap,mt=$t.createTreeWalker($t,129);function Hl(e,t){if(!Ro(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jr!==void 0?Jr.createHTML(t):t}const ap=(e,t)=>{const n=e.length-1,i=[];let s,o=t===2?"<svg>":t===3?"<math>":"",r=rn;for(let a=0;a<n;a++){const d=e[a];let c,l,p=-1,f=0;for(;f<d.length&&(r.lastIndex=f,l=r.exec(d),l!==null);)f=r.lastIndex,r===rn?l[1]==="!--"?r=Yr:l[1]!==void 0?r=Xr:l[2]!==void 0?(zl.test(l[2])&&(s=RegExp("</"+l[2],"g")),r=ut):l[3]!==void 0&&(r=ut):r===ut?l[0]===">"?(r=s??rn,p=-1):l[1]===void 0?p=-2:(p=r.lastIndex-l[2].length,c=l[1],r=l[3]===void 0?ut:l[3]==='"'?ea:Zr):r===ea||r===Zr?r=ut:r===Yr||r===Xr?r=rn:(r=ut,s=void 0);const v=r===ut&&e[a+1].startsWith("/>")?" ":"";o+=r===rn?d+sp:p>=0?(i.push(c),d.slice(0,p)+Wl+d.slice(p)+et+v):d+et+(p===-2?a:v)}return[Hl(e,o+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};let no=class ql{constructor({strings:t,_$litType$:n},i){let s;this.parts=[];let o=0,r=0;const a=t.length-1,d=this.parts,[c,l]=ap(t,n);if(this.el=ql.createElement(c,i),mt.currentNode=this.el.content,n===2||n===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=mt.nextNode())!==null&&d.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const p of s.getAttributeNames())if(p.endsWith(Wl)){const f=l[r++],v=s.getAttribute(p).split(et),S=/([.?@])?(.*)/.exec(f);d.push({type:1,index:o,name:S[2],strings:v,ctor:S[1]==="."?cp:S[1]==="?"?dp:S[1]==="@"?up:ji}),s.removeAttribute(p)}else p.startsWith(et)&&(d.push({type:6,index:o}),s.removeAttribute(p));if(zl.test(s.tagName)){const p=s.textContent.split(et),f=p.length-1;if(f>0){s.textContent=$i?$i.emptyScript:"";for(let v=0;v<f;v++)s.append(p[v],Pn()),mt.nextNode(),d.push({type:2,index:++o});s.append(p[f],Pn())}}}else if(s.nodeType===8)if(s.data===Kl)d.push({type:2,index:o});else{let p=-1;for(;(p=s.data.indexOf(et,p+1))!==-1;)d.push({type:7,index:o}),p+=et.length-1}o++}}static createElement(t,n){const i=$t.createElement("template");return i.innerHTML=t,i}};function jt(e,t,n=e,i){var r,a;if(t===it)return t;let s=i!==void 0?(r=n._$Co)==null?void 0:r[i]:n._$Cl;const o=Ln(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==o&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),o===void 0?s=void 0:(s=new o(e),s._$AT(e,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=s:n._$Cl=s),s!==void 0&&(t=jt(e,s._$AS(e,t.values),s,i)),t}class lp{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:i}=this._$AD,s=((t==null?void 0:t.creationScope)??$t).importNode(n,!0);mt.currentNode=s;let o=mt.nextNode(),r=0,a=0,d=i[0];for(;d!==void 0;){if(r===d.index){let c;d.type===2?c=new qi(o,o.nextSibling,this,t):d.type===1?c=new d.ctor(o,d.name,d.strings,this,t):d.type===6&&(c=new pp(o,this,t)),this._$AV.push(c),d=i[++a]}r!==(d==null?void 0:d.index)&&(o=mt.nextNode(),r++)}return mt.currentNode=$t,s}p(t){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}let qi=class jl{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,n,i,s){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=jt(this,t,n),Ln(t)?t===k||t==null||t===""?(this._$AH!==k&&this._$AR(),this._$AH=k):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):op(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!==k&&Ln(this._$AH)?this._$AA.nextSibling.data=t:this.T($t.createTextNode(t)),this._$AH=t}$(t){var o;const{values:n,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=no.createElement(Hl(i.h,i.h[0]),this.options)),i);if(((o=this._$AH)==null?void 0:o._$AD)===s)this._$AH.p(n);else{const r=new lp(s,this),a=r.u(this.options);r.p(n),this.T(a),this._$AH=r}}_$AC(t){let n=ta.get(t.strings);return n===void 0&&ta.set(t.strings,n=new no(t)),n}k(t){Ro(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,s=0;for(const o of t)s===n.length?n.push(i=new jl(this.O(Pn()),this.O(Pn()),this,this.options)):i=n[s],i._$AI(o),s++;s<n.length&&(this._$AR(i&&i._$AB.nextSibling,s),n.length=s)}_$AR(t=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);t!==this._$AB;){const s=Qr(t).nextSibling;Qr(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}};class ji{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,i,s,o){this.type=1,this._$AH=k,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=k}_$AI(t,n=this,i,s){const o=this.strings;let r=!1;if(o===void 0)t=jt(this,t,n,0),r=!Ln(t)||t!==this._$AH&&t!==it,r&&(this._$AH=t);else{const a=t;let d,c;for(t=o[0],d=0;d<o.length-1;d++)c=jt(this,a[i+d],n,d),c===it&&(c=this._$AH[d]),r||(r=!Ln(c)||c!==this._$AH[d]),c===k?t=k:t!==k&&(t+=(c??"")+o[d+1]),this._$AH[d]=c}r&&!s&&this.j(t)}j(t){t===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let cp=class extends ji{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===k?void 0:t}},dp=class extends ji{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==k)}},up=class extends ji{constructor(t,n,i,s,o){super(t,n,i,s,o),this.type=5}_$AI(t,n=this){if((t=jt(this,t,n,0)??k)===it)return;const i=this._$AH,s=t===k&&i!==k||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==k&&(i===k||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,t):this._$AH.handleEvent(t)}},pp=class{constructor(t,n,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){jt(this,t)}};const hp={I:qi},vs=wn.litHtmlPolyfillSupport;vs==null||vs(no,qi),(wn.litHtmlVersions??(wn.litHtmlVersions=[])).push("3.3.2");const fp=(e,t,n)=>{const i=(n==null?void 0:n.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const o=(n==null?void 0:n.renderBefore)??null;i._$litPart$=s=new qi(t.insertBefore(Pn(),o),o,void 0,n??{})}return s._$AI(e),s};const bt=globalThis;let zt=class extends Ut{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const t=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=t.firstChild),t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=fp(n,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return it}};var Ol;zt._$litElement$=!0,zt.finalized=!0,(Ol=bt.litElementHydrateSupport)==null||Ol.call(bt,{LitElement:zt});const bs=bt.litElementPolyfillSupport;bs==null||bs({LitElement:zt});(bt.litElementVersions??(bt.litElementVersions=[])).push("4.2.2");const Vl=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};const gp={attribute:!0,type:String,converter:ki,reflect:!1,hasChanged:Io},mp=(e=gp,t,n)=>{const{kind:i,metadata:s}=n;let o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(n.name,e),i==="accessor"){const{name:r}=n;return{set(a){const d=t.get.call(this);t.set.call(this,a),this.requestUpdate(r,d,e,!0,a)},init(a){return a!==void 0&&this.C(r,void 0,e,a),a}}}if(i==="setter"){const{name:r}=n;return function(a){const d=this[r];t.call(this,a),this.requestUpdate(r,d,e,!0,a)}}throw Error("Unsupported decorator location: "+i)};function Vi(e){return(t,n)=>typeof n=="object"?mp(e,t,n):((i,s,o)=>{const r=s.hasOwnProperty(o);return s.constructor.createProperty(o,i),r?Object.getOwnPropertyDescriptor(s,o):void 0})(e,t,n)}function y(e){return Vi({...e,state:!0,attribute:!1})}const yp=50,vp=200,bp="Assistant";function na(e,t){if(typeof e!="string")return;const n=e.trim();if(n)return n.length<=t?n:n.slice(0,t)}function io(e){const t=na(e==null?void 0:e.name,yp)??bp,n=na((e==null?void 0:e.avatar)??void 0,vp)??null;return{agentId:typeof(e==null?void 0:e.agentId)=="string"&&e.agentId.trim()?e.agentId.trim():null,name:t,avatar:n}}function wp(){return io(typeof window>"u"?{}:{name:window.__TASKMASTER_ASSISTANT_NAME__,avatar:window.__TASKMASTER_ASSISTANT_AVATAR__})}const kp="Taskmaster",$p="/taskmaster-icon.png",Sp="#00d4ff",xp="";let Xn=null;function Ve(){return Xn||(Xn={name:window.__TASKMASTER_BRAND_NAME__||kp,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||$p,accentColor:window.__TASKMASTER_ACCENT_COLOR__||Sp,backgroundColor:window.__TASKMASTER_BACKGROUND_COLOR__||xp},Xn)}function Re(){return window.__TASKMASTER_WORKSPACE_BRANDS__??{}}function Gl(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);return t?`${parseInt(t[1],16)}, ${parseInt(t[2],16)}, ${parseInt(t[3],16)}`:null}function Ap(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!t)return 0;const[n,i,s]=[t[1],t[2],t[3]].map(o=>{const r=parseInt(o,16)/255;return r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)});return .2126*n+.7152*i+.0722*s}function Ql(e){const t=Gl(e);if(!t)return;const n=document.documentElement;n.style.setProperty("--accent",e),n.style.setProperty("--accent-hover",e),n.style.setProperty("--accent-muted",e),n.style.setProperty("--primary",e),n.style.setProperty("--ring",e),n.style.setProperty("--accent-subtle",`rgba(${t}, 0.15)`),n.style.setProperty("--accent-glow",`rgba(${t}, 0.25)`),n.style.setProperty("--tasker-orange",e),n.style.setProperty("--tasker-orange-hover",e),n.style.setProperty("--tasker-orange-glow",`rgba(${t}, 0.25)`);const i=Ap(e)>.4?"#111111":"#ffffff";n.style.setProperty("--accent-foreground",i),n.style.setProperty("--primary-foreground",i)}function Zn(e,t,n){const i=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e),s=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t);if(!i||!s)return e;const o=(c,l)=>Math.round(parseInt(i[c],16)*(1-n)+parseInt(s[l],16)*n),r=o(1,1),a=o(2,2),d=o(3,3);return`#${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${d.toString(16).padStart(2,"0")}`}const an={"--bg":"#12141a","--bg-muted":"#262a35","--card":"#181b22","--secondary":"#1e2028"};function Jl(e){const t=document.documentElement;if(!e){for(const[i,s]of Object.entries(an))t.style.setProperty(i,s);t.style.removeProperty("--brand-bg"),t.style.removeProperty("--brand-bg-subtle"),t.style.removeProperty("--brand-bg-card");return}const n=Gl(e);n&&(t.style.setProperty("--bg",Zn(an["--bg"],e,.08)),t.style.setProperty("--bg-muted",Zn(an["--bg-muted"],e,.1)),t.style.setProperty("--card",Zn(an["--card"],e,.12)),t.style.setProperty("--secondary",Zn(an["--secondary"],e,.1)),t.style.setProperty("--brand-bg",e),t.style.setProperty("--brand-bg-subtle",`rgba(${n}, 0.08)`),t.style.setProperty("--brand-bg-card",`rgba(${n}, 0.12)`))}function kn(e){const t=Ve(),n=Re(),i=e?n[e]:void 0,s=(i==null?void 0:i.accentColor)??t.accentColor;Ql(s);const o=(i==null?void 0:i.backgroundColor)??t.backgroundColor;Jl(o)}const Si="taskmaster.control.settings.v1",Yl="taskmaster.account.settings.";function $n(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}`}const Ot={gatewayUrl:$n(),token:"",theme:"system",navCollapsed:!1,navGroupsCollapsed:{}},Ze={sessionKey:"main",lastActiveSessionKey:"main",chatFocusMode:!1,chatShowThinking:!1,splitRatio:.6};function Ep(){try{const e=localStorage.getItem(Si);if(!e)return{...Ot,gatewayUrl:$n()};const t=JSON.parse(e);return{gatewayUrl:typeof t.gatewayUrl=="string"&&t.gatewayUrl.trim()?t.gatewayUrl.trim():$n(),token:typeof t.token=="string"?t.token:Ot.token,theme:t.theme==="light"||t.theme==="dark"||t.theme==="system"?t.theme:Ot.theme,navCollapsed:typeof t.navCollapsed=="boolean"?t.navCollapsed:Ot.navCollapsed,navGroupsCollapsed:typeof t.navGroupsCollapsed=="object"&&t.navGroupsCollapsed!==null?t.navGroupsCollapsed:Ot.navGroupsCollapsed}}catch{return{...Ot,gatewayUrl:$n()}}}function Cp(e){if(!e)return{...Ze};try{const t=localStorage.getItem(Yl+e);if(!t)return{...Ze};const n=JSON.parse(t);return{sessionKey:typeof n.sessionKey=="string"&&n.sessionKey.trim()?n.sessionKey.trim():Ze.sessionKey,lastActiveSessionKey:typeof n.lastActiveSessionKey=="string"&&n.lastActiveSessionKey.trim()?n.lastActiveSessionKey.trim():typeof n.sessionKey=="string"&&n.sessionKey.trim()||Ze.lastActiveSessionKey,chatFocusMode:typeof n.chatFocusMode=="boolean"?n.chatFocusMode:Ze.chatFocusMode,chatShowThinking:typeof n.chatShowThinking=="boolean"?n.chatShowThinking:Ze.chatShowThinking,splitRatio:typeof n.splitRatio=="number"&&n.splitRatio>=.4&&n.splitRatio<=.7?n.splitRatio:Ze.splitRatio}}catch{return{...Ze}}}let xi=null;function ia(e){xi=e}function ws(){return{...Ep(),...Cp(xi)}}function Tp(e){const t={gatewayUrl:e.gatewayUrl,token:e.token,theme:e.theme,navCollapsed:e.navCollapsed,navGroupsCollapsed:e.navGroupsCollapsed};if(localStorage.setItem(Si,JSON.stringify(t)),xi){const n={sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,chatFocusMode:e.chatFocusMode,chatShowThinking:e.chatShowThinking,splitRatio:e.splitRatio};localStorage.setItem(Yl+xi,JSON.stringify(n))}}const _p="taskmaster.draft.";function Do(e,t){return _p+e+"."+t}function In(e,t,n){try{const i=Do(e,t);n?localStorage.setItem(i,n):localStorage.removeItem(i)}catch{}}function Rn(e,t){try{return localStorage.getItem(Do(e,t))??""}catch{return""}}function Mp(e,t){try{localStorage.removeItem(Do(e,t))}catch{}}let yt=null,$e=null;function sa(e,t,n){$e={workspace:e,sessionKey:t,text:n},yt!=null&&clearTimeout(yt),yt=setTimeout(()=>{$e&&In($e.workspace,$e.sessionKey,$e.text),$e=null,yt=null},300)}function so(){yt!=null&&clearTimeout(yt),yt=null,$e&&(In($e.workspace,$e.sessionKey,$e.text),$e=null)}(function(){try{const t=localStorage.getItem(Si);if(!t)return;const n=JSON.parse(t);if(!("sessionKey"in n))return;const i={gatewayUrl:typeof n.gatewayUrl=="string"?n.gatewayUrl:$n(),token:typeof n.token=="string"?n.token:"",theme:n.theme==="light"||n.theme==="dark"||n.theme==="system"?n.theme:"system",navCollapsed:typeof n.navCollapsed=="boolean"?n.navCollapsed:!1,navGroupsCollapsed:typeof n.navGroupsCollapsed=="object"&&n.navGroupsCollapsed!==null?n.navGroupsCollapsed:{}};localStorage.setItem(Si,JSON.stringify(i))}catch{}})();function Xl(e){var o;const t=(e??"").trim();if(!t)return null;const n=t.split(":").filter(Boolean);if(n.length<3||n[0]!=="agent")return null;const i=(o=n[1])==null?void 0:o.trim(),s=n.slice(2).join(":");return!i||!s?null:{agentId:i,rest:s}}const Pp=/<\s*\/?\s*(?:think(?:ing)?|thought|antthinking|final)\b/i,ei=/<\s*\/?\s*final\b[^>]*>/gi,oa=/<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^>]*>/gi;function Lp(e,t){return e.trimStart()}function Ip(e,t){if(!e||!Pp.test(e))return e;let n=e;ei.test(n)?(ei.lastIndex=0,n=n.replace(ei,"")):ei.lastIndex=0,oa.lastIndex=0;let i="",s=0,o=!1;for(const r of n.matchAll(oa)){const a=r.index??0,d=r[1]==="/";o?d&&(o=!1):(i+=n.slice(s,a),d||(o=!0)),s=a+r[0].length}return i+=n.slice(s),Lp(i)}function Zl(e){return!e&&e!==0?"n/a":new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"})}function Gi(e){if(!e&&e!==0)return"n/a";const t=Date.now()-e;if(t<0){const r=-t,a=Math.round(r/1e3);if(a<60)return`in ${a}s`;const d=Math.round(a/60);if(d<60)return`in ${d}m`;const c=Math.round(d/60);return c<48?`in ${c}h`:`in ${Math.round(c/24)}d`}const n=Math.round(t/1e3);if(n<60)return`${n}s ago`;const i=Math.round(n/60);if(i<60)return`${i}m ago`;const s=Math.round(i/60);return s<48?`${s}h ago`:`${Math.round(s/24)}d ago`}function No(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 i=Math.round(n/60);return i<48?`${i}h`:`${Math.round(i/24)}d`}function Rp(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function ec(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 Ai(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function ks(e){return Ip(e)}const Dp=/^\[([^\]]+)\]\s*/,Np=["WebChat","WhatsApp","Telegram","Signal","Slack","Discord","iMessage","Teams","Matrix","Zalo","Zalo Personal","BlueBubbles"],$s=new WeakMap,Ss=new WeakMap;function Bp(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:Np.some(t=>e.startsWith(`${t} `))}function xs(e){const t=e.match(Dp);if(!t)return e;const n=t[1]??"";return Bp(n)?e.slice(t[0].length):e}function Sn(e){const t=e,n=typeof t.role=="string"?t.role:"",i=t.content;if(typeof i=="string")return n==="assistant"?ks(i):xs(i);if(Array.isArray(i)){const s=i.map(o=>{const r=o;return r.type==="text"&&typeof r.text=="string"?r.text:null}).filter(o=>typeof o=="string");if(s.length>0){const o=s.join(`
|
|
4
|
+
`);return n==="assistant"?ks(o):xs(o)}}return typeof t.text=="string"?n==="assistant"?ks(t.text):xs(t.text):null}function tc(e){if(!e||typeof e!="object")return Sn(e);const t=e;if($s.has(t))return $s.get(t)??null;const n=Sn(e);return $s.set(t,n),n}function ra(e){const n=e.content,i=[];if(Array.isArray(n))for(const a of n){const d=a;if(d.type==="thinking"&&typeof d.thinking=="string"){const c=d.thinking.trim();c&&i.push(c)}}if(i.length>0)return i.join(`
|
|
5
|
+
`);const s=Op(e);if(!s)return null;const r=[...s.matchAll(/<\s*think(?:ing)?\s*>([\s\S]*?)<\s*\/\s*think(?:ing)?\s*>/gi)].map(a=>(a[1]??"").trim()).filter(Boolean);return r.length>0?r.join(`
|
|
6
|
+
`):null}function Fp(e){if(!e||typeof e!="object")return ra(e);const t=e;if(Ss.has(t))return Ss.get(t)??null;const n=ra(e);return Ss.set(t,n),n}function Op(e){const t=e,n=t.content;if(typeof n=="string")return n;if(Array.isArray(n)){const i=n.map(s=>{const o=s;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(s=>typeof s=="string");if(i.length>0)return i.join(`
|
|
7
|
+
`)}return typeof t.text=="string"?t.text:null}function Up(e){const t=e.trim();if(!t)return"";const n=t.split(/\r?\n/).map(i=>i.trim()).filter(Boolean).map(i=>`_${i}_`);return n.length?["_Reasoning:_",...n].join(`
|
|
8
|
+
`):""}const Wp=/Read HEARTBEAT\.md if it exists|reply HEARTBEAT_OK/i,Kp=/^[\s*`_]*HEARTBEAT_OK[\s*`_]*$/i,zp=/^[\s*`_]*NO_REPLY[\s*`_]*$/i,Hp=/^A new session was started via \/new or \/reset\./;function qp(e){const t=e,n=typeof t.role=="string"?t.role:"";let i="";typeof t.content=="string"?i=t.content:Array.isArray(t.content)?i=t.content.filter(o=>typeof o=="object"&&o!==null).map(o=>o.text??"").join(" "):typeof t.text=="string"&&(i=t.text);const s=i.trim();return s?!!(n==="user"&&Wp.test(s)||n==="assistant"&&Kp.test(s)||n==="user"&&Hp.test(s)||n==="assistant"&&zp.test(s)):!1}function nc(e){return e.filter(t=>!qp(t))}function ic(e){const t=e;let n=typeof t.role=="string"?t.role:"unknown";const i=typeof t.toolCallId=="string"||typeof t.tool_call_id=="string",s=t.content,o=Array.isArray(s)?s:null,r=Array.isArray(o)&&o.some(p=>{const v=String(p.type??"").toLowerCase();return v==="toolresult"||v==="tool_result"}),a=typeof t.toolName=="string"||typeof t.tool_name=="string";(i||r||a)&&(n="toolResult");let d=[];typeof t.content=="string"?d=[{type:"text",text:t.content}]:Array.isArray(t.content)?d=t.content.map(p=>({type:p.type||"text",text:p.text,name:p.name,args:p.args||p.arguments})):typeof t.text=="string"&&(d=[{type:"text",text:t.text}]);const c=typeof t.timestamp=="number"?t.timestamp:Date.now(),l=typeof t.id=="string"?t.id:void 0;return{role:n,content:d,timestamp:c,id:l}}function sc(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 oc(e){const t=e,n=typeof t.role=="string"?t.role.toLowerCase():"";return n==="toolresult"||n==="tool_result"}function aa(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 jp(){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 Qi(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),aa(t)}return aa(jp())}const Be=50;async function Ne(e,t){if(!e.client||!e.connected)return;e.chatLoading=!0,e.lastError=null;const n=(t==null?void 0:t.limit)??Be;try{const i=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:n}),s=Array.isArray(i.messages)?i.messages:[],o=typeof i.totalMessages=="number"?i.totalMessages:s.length,r=nc(s);e.chatMessages=r,e.chatHistoryTotal=o,e.chatHistoryHasMore=o>s.length,e.chatThinkingLevel=i.thinkingLevel??null,e.chatModelProvider=typeof i.modelProvider=="string"?i.modelProvider:null,e.chatModel=typeof i.model=="string"?i.model:null,e.chatVerboseLevel=typeof i.verboseLevel=="string"?i.verboseLevel:null,e.chatFillerEnabled=typeof i.fillerEnabled=="boolean"?i.fillerEnabled:null}catch(i){e.lastError=String(i)}finally{e.chatLoading=!1}}async function Vp(e){if(!e.client||!e.connected||e.chatLoadingOlder||!e.chatHistoryHasMore)return!1;e.chatLoadingOlder=!0;try{const t=e.chatMessages.length,n=await e.client.request("chat.history",{sessionKey:e.sessionKey,limit:Be,offset:t}),i=Array.isArray(n.messages)?n.messages:[],s=typeof n.totalMessages=="number"?n.totalMessages:0;if(i.length===0)return e.chatHistoryHasMore=!1,!1;const o=nc(i);return e.chatMessages=[...o,...e.chatMessages],e.chatHistoryTotal=s,e.chatHistoryHasMore=s>t+i.length,!0}catch(t){return e.lastError=String(t),!1}finally{e.chatLoadingOlder=!1}}function Gp(e){const t=/^data:(.+?);base64,(.+)$/.exec(e);return t?{mimeType:t[1],content:t[2]}:null}async function rc(e,t,n){if(e.chatSuggestion=null,!e.client||!e.connected)return!1;const i=t.trim(),s=n&&n.length>0;if(!i&&!s)return!1;const o=Date.now(),r=(n??[]).filter(v=>!v.fileName),a=(n??[]).filter(v=>v.fileName),d=[],c=a.map(v=>v.fileName).filter(Boolean);if(c.length>0){const v=i?`${c.join(", ")}
|
|
9
9
|
|
|
10
|
-
${i}`:c.join(", ");d.push({type:"text",text:v})}else i&&d.push({type:"text",text:i});for(const v of
|
|
10
|
+
${i}`:c.join(", ");d.push({type:"text",text:v})}else i&&d.push({type:"text",text:i});for(const v of r)d.push({type:"image",source:{type:"base64",media_type:v.mimeType,data:v.dataUrl}});e.chatMessages=[...e.chatMessages,{role:"user",content:d,timestamp:o}],e.chatSending=!0,e.lastError=null;const l=Qi();e.chatRunId=l,e.chatStream="",e.chatStreamStartedAt=o;const p=[...r,...a],f=p.length>0?p.map(v=>{if(v.textContent)return{type:"document",mimeType:v.mimeType||"text/plain",fileName:v.fileName,content:btoa(unescape(encodeURIComponent(v.textContent)))};const S=Gp(v.dataUrl);return S?{type:v.fileName?"document":"image",mimeType:S.mimeType,fileName:v.fileName,content:S.content}:null}).filter(v=>v!==null):void 0;try{return await e.client.request("chat.send",{sessionKey:e.sessionKey,message:i,deliver:!1,idempotencyKey:l,attachments:f}),!0}catch(v){const S=String(v);return e.chatRunId=null,e.chatStream=null,e.chatStreamStartedAt=null,e.lastError=S,e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:"Error: "+S}],timestamp:Date.now()}],!1}finally{e.chatSending=!1}}async function ac(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 lc(e,t){var n,i;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==="working"){const o=(t.message?(n=Sn(t.message))==null?void 0:n.trim():void 0)||((i=e.chatStream)==null?void 0:i.trim());if(o)if(!e.chatInterimText)e.chatInterimText=o;else{const r=o.trim(),a=e.chatInterimText.trim();r===a||a.endsWith(r)||(r.startsWith(a)?e.chatInterimText=o:e.chatInterimText=`${e.chatInterimText}
|
|
11
11
|
|
|
12
|
-
${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.message);return typeof s=="string"&&s.trim()&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:s.trim()}],timestamp:Date.now(),filler:!0}]),"block"}else if(t.state==="delta"){e.chatSuggestion=null;const s=Sn(t.message);if(typeof s=="string"){if(s.trim()==="NO_REPLY")return null;const o=e.chatStream??"";(!o||s.length>=o.length)&&(e.chatStream=s)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatInterimText=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatInterimText=null,e.lastError=t.errorMessage??"chat error");return t.state}const
|
|
13
|
-
`)}function
|
|
12
|
+
${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.message);return typeof s=="string"&&s.trim()&&(e.chatMessages=[...e.chatMessages,{role:"assistant",content:[{type:"text",text:s.trim()}],timestamp:Date.now(),filler:!0}]),"block"}else if(t.state==="delta"){e.chatSuggestion=null;const s=Sn(t.message);if(typeof s=="string"){if(s.trim()==="NO_REPLY")return null;const o=e.chatStream??"";(!o||s.length>=o.length)&&(e.chatStream=s)}}else t.state==="final"||t.state==="aborted"?(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatInterimText=null):t.state==="error"&&(e.chatStream=null,e.chatRunId=null,e.chatStreamStartedAt=null,e.chatInterimText=null,e.lastError=t.errorMessage??"chat error");return t.state}const Ei=Object.freeze(Object.defineProperty({__proto__:null,CHAT_PAGE_SIZE:Be,abortChatRun:ac,handleChatEvent:lc,loadChatHistory:Ne,loadOlderChatHistory:Vp,sendChatMessage:rc},Symbol.toStringTag,{value:"Module"}));async function Bo(e){if(!(!e.client||!e.connected)&&!e.sessionsLoading){e.sessionsLoading=!0,e.sessionsError=null;try{const t={includeGlobal:e.sessionsIncludeGlobal??!0,includeUnknown:e.sessionsIncludeUnknown??!1},n=Ai(e.sessionsFilterActive??"",0),i=Ai(e.sessionsFilterLimit??"",0);n>0&&(t.activeMinutes=n),i>0&&(t.limit=i);const s=await e.client.request("sessions.list",t);s&&(e.sessionsResult=s)}catch(t){e.sessionsError=String(t)}finally{e.sessionsLoading=!1}}}async function ti(e,t,n){if(!e.client||!e.connected)return;const i={key:t};"label"in n&&(i.label=n.label),"thinkingLevel"in n&&(i.thinkingLevel=n.thinkingLevel),"verboseLevel"in n&&(i.verboseLevel=n.verboseLevel),"reasoningLevel"in n&&(i.reasoningLevel=n.reasoningLevel),"model"in n&&(i.model=n.model),"fillerEnabled"in n&&(i.fillerEnabled=n.fillerEnabled);try{await e.client.request("sessions.patch",i),await Bo(e)}catch(s){e.sessionsError=String(s)}}const la=50,Qp=80,Jp=12e4;function Yp(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 i=n.map(s=>{if(!s||typeof s!="object")return null;const o=s;return o.type==="text"&&typeof o.text=="string"?o.text:null}).filter(s=>!!s);return i.length===0?null:i.join(`
|
|
13
|
+
`)}function ca(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean")return String(e);const t=Yp(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 i=ec(n,Jp);return i.truncated?`${i.text}
|
|
14
14
|
|
|
15
|
-
… truncated (${i.total} chars, showing first ${i.text.length}).`:i.text}function
|
|
15
|
+
… truncated (${i.total} chars, showing first ${i.text.length}).`:i.text}function Xp(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 Zp(e){if(e.toolStreamOrder.length<=la)return;const t=e.toolStreamOrder.length-la,n=e.toolStreamOrder.splice(0,t);for(const i of n)e.toolStreamById.delete(i)}function eh(e){e.chatToolMessages=e.toolStreamOrder.map(t=>{var n;return(n=e.toolStreamById.get(t))==null?void 0:n.message}).filter(t=>!!t)}function oo(e){e.toolStreamSyncTimer!=null&&(clearTimeout(e.toolStreamSyncTimer),e.toolStreamSyncTimer=null),eh(e)}function th(e,t=!1){if(t){oo(e);return}e.toolStreamSyncTimer==null&&(e.toolStreamSyncTimer=window.setTimeout(()=>oo(e),Qp))}function Fo(e){e.toolStreamById.clear(),e.toolStreamOrder=[],e.chatToolMessages=[],oo(e)}const nh=5e3;function ih(e,t){var s;const n=t.data??{},i=typeof n.phase=="string"?n.phase:"";e.compactionClearTimer!=null&&(window.clearTimeout(e.compactionClearTimer),e.compactionClearTimer=null),i==="start"?e.compactionStatus={active:!0,startedAt:Date.now(),completedAt:null}:i==="end"&&(e.compactionStatus={active:!1,startedAt:((s=e.compactionStatus)==null?void 0:s.startedAt)??null,completedAt:Date.now()},e.compactionClearTimer=window.setTimeout(()=>{e.compactionStatus=null,e.compactionClearTimer=null},nh))}function sh(e,t){if(!t)return;if(t.stream==="compaction"){ih(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 i=t.data??{},s=typeof i.toolCallId=="string"?i.toolCallId:"";if(!s)return;const o=typeof i.name=="string"?i.name:"tool",r=typeof i.phase=="string"?i.phase:"",a=r==="start"?i.args:void 0,d=r==="update"?ca(i.partialResult):r==="result"?ca(i.result):void 0,c=Date.now();let l=e.toolStreamById.get(s);l?(l.name=o,a!==void 0&&(l.args=a),d!==void 0&&(l.output=d),l.updatedAt=c):(l={toolCallId:s,runId:t.runId,sessionKey:n,name:o,args:a,output:d,startedAt:typeof t.ts=="number"?t.ts:c,updatedAt:c,message:{}},e.toolStreamById.set(s,l),e.toolStreamOrder.push(s)),l.message=Xp(l),Zp(e),th(e,r==="result")}let ni=0;function Jt(e,t=!1){e.chatScrollFrame&&cancelAnimationFrame(e.chatScrollFrame),e.chatScrollTimeout!=null&&(clearTimeout(e.chatScrollTimeout),e.chatScrollTimeout=null);const n=++ni,i=()=>{const s=e.querySelector(".chat-thread");if(s){const o=getComputedStyle(s).overflowY;if(o==="auto"||o==="scroll"||s.scrollHeight-s.clientHeight>1)return s}return document.scrollingElement??document.documentElement};e.updateComplete.then(()=>{n===ni&&(e.chatScrollFrame=requestAnimationFrame(()=>{if(e.chatScrollFrame=null,n!==ni)return;const s=i();if(!s)return;const o=s.scrollHeight-s.scrollTop-s.clientHeight;if(!(t||e.chatUserNearBottom||o<200))return;t&&(e.chatHasAutoScrolled=!0),s.scrollTop=s.scrollHeight,e.chatUserNearBottom=!0;const a=t?150:120;e.chatScrollTimeout=window.setTimeout(()=>{if(e.chatScrollTimeout=null,n!==ni)return;const d=i();if(!d)return;const c=d.scrollHeight-d.scrollTop-d.clientHeight;(t||e.chatUserNearBottom||c<200)&&(d.scrollTop=d.scrollHeight,e.chatUserNearBottom=!0)},a)}))})}function cc(e,t=!1){e.logsScrollFrame&&cancelAnimationFrame(e.logsScrollFrame),e.updateComplete.then(()=>{e.logsScrollFrame=requestAnimationFrame(()=>{e.logsScrollFrame=null;const n=e.querySelector(".log-stream");!n||!(t||n.scrollTop<80)||(n.scrollTop=0)})})}function oh(e,t){const n=t.currentTarget;if(!n)return;const i=n.scrollHeight-n.scrollTop-n.clientHeight;e.chatUserNearBottom=i<200,n.scrollTop<100&&e.onLoadOlder&&e.onLoadOlder()}function rh(e){const t=e.querySelector(".chat-thread");if(!t)return null;const n=t.scrollHeight,i=t.scrollTop;return()=>{const s=t.scrollHeight-n;t.scrollTop=i+s}}function ah(e,t){const n=t.currentTarget;n&&(e.logsAtBottom=n.scrollTop<80)}function lh(e,t){const n=t.currentTarget;n&&(e.logsAtBottom=n.scrollTop<80)}function ch(e){e.chatHasAutoScrolled=!1,e.chatUserNearBottom=!0}function dh(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
16
16
|
`)}
|
|
17
|
-
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function
|
|
17
|
+
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function uh(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
|
|
18
18
|
`)}
|
|
19
|
-
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-session-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function
|
|
20
|
-
`}function dc(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const a=t[o],r=t[o+1];if(typeof a=="number"){if(!Array.isArray(i))return;i[a]==null&&(i[a]=typeof r=="number"?[]:{}),i=i[a]}else{if(typeof i!="object"||i==null)return;const d=i;d[a]==null&&(d[a]=typeof r=="number"?[]:{}),i=d[a]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function Fe(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});hh(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function uc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});ph(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function ph(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function hh(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?St(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=St(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=st(t.config??{}),e.configFormOriginal=st(t.config??{}),e.configRawOriginal=n)}async function fh(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?St(e.configForm):e.configRaw,i=(t=e.configSnapshot)==null?void 0:t.hash;if(!i){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:n,baseHash:i}),e.configFormDirty=!1,await Fe(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function Jt(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 Fn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t={includeDisabled:!0};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(t.agentIds=e.workspaceAgentIds);const n=await e.client.request("cron.list",t);e.cronJobs=Array.isArray(n.jobs)?n.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function pc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=Ai(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const i=e.everyUnit;return{kind:"every",everyMs:n*(i==="minutes"?6e4:i==="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 hc(e){if(e.payloadKind==="systemEvent"){const o=e.payloadText.trim();if(!o)throw new Error("System event text required.");return{kind:"systemEvent",text:o}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel);const i=[];e.toAdmins&&i.push("admins");for(const o of e.recipients){const a=o.trim();a&&i.push(a)}i.length>0&&(n.to=i.join(","));const s=Ai(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function gh(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=pc(e.cronForm),i=hc(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),a={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:o||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!a.name)throw new Error("Name required.");await e.client.request("cron.add",a),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Fn(e),await Jt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function mh(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 Fn(e),await Jt(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function yh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null,e.cronRunModalJobId=t.id,e.cronRunModalJobName=t.name||"Untitled",e.cronRunResult=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await ao(e,t.id)}catch(n){e.cronError=String(n),e.cronRunResult={status:"error",error:String(n)}}finally{e.cronBusy=!1}}}function vh(e,t){e.cronRunModalJobId&&t.jobId===e.cronRunModalJobId&&t.action==="finished"&&(e.cronRunResult={status:t.status??"unknown",durationMs:t.durationMs,summary:t.summary,error:t.error})}async function bh(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 Fn(e),await Jt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}function wh(e){var n;const t={name:e.name||"",description:e.description||"",agentId:e.agentId||"",enabled:e.enabled,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"",cronTz:"",sessionTarget:e.sessionTarget||"main",wakeMode:e.wakeMode||"next-heartbeat",payloadKind:e.payload.kind,payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};if(e.schedule.kind==="at"){const i=new Date(e.schedule.atMs),s=o=>String(o).padStart(2,"0");t.scheduleAt=`${i.getFullYear()}-${s(i.getMonth()+1)}-${s(i.getDate())}T${s(i.getHours())}:${s(i.getMinutes())}`}else if(e.schedule.kind==="every"){const i=e.schedule.everyMs;i%864e5===0?(t.everyAmount=String(i/864e5),t.everyUnit="days"):i%36e5===0?(t.everyAmount=String(i/36e5),t.everyUnit="hours"):(t.everyAmount=String(i/6e4),t.everyUnit="minutes")}else e.schedule.kind==="cron"&&(t.cronExpr=e.schedule.expr,t.cronTz=e.schedule.tz||"");if(e.payload.kind==="systemEvent")t.payloadText=e.payload.text;else if(e.payload.kind==="agentTurn"){t.payloadText=e.payload.message,t.deliver=e.payload.deliver??!1,t.timeoutSeconds=e.payload.timeoutSeconds?String(e.payload.timeoutSeconds):"";const i=e.payload.channel??e.payload.provider;t.channel=i||"last";const s=e.payload.to||"";if(s){const o=s.split(",").map(a=>a.trim()).filter(Boolean);t.toAdmins=o.some(a=>a.toLowerCase()==="admins"),t.recipients=o.filter(a=>a.toLowerCase()!=="admins")}}return(n=e.isolation)!=null&&n.postToMainPrefix&&(t.postToMainPrefix=e.isolation.postToMainPrefix),t}async function kh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=pc(e.cronForm),i=hc(e.cronForm),s={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:e.cronForm.agentId.trim()||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i};if(e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?s.isolation={postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:s.isolation=void 0,!s.name)throw new Error("Name required.");await e.client.request("cron.update",{id:t,patch:s}),await Fn(e),await Jt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ao(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function J(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 Oo(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const i=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=i.message??null,e.whatsappLoginQrDataUrl=i.qrDataUrl??null,e.whatsappLoginConnected=null}catch(i){e.whatsappLoginMessage=String(i),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function fc(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.wait",{timeoutMs:12e4,accountId:t});e.whatsappLoginMessage=n.message??null,e.whatsappLoginConnected=n.connected??null,n.connected&&(e.whatsappLoginQrDataUrl=null,e.whatsappActiveQrAccountId=null,e.whatsappPairedPhone=n.selfPhone??null)}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function gc(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null}catch(n){e.whatsappLoginMessage=String(n)}finally{e.whatsappBusy=!1}}}async function mc(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const i=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!i){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const o=st(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const a=o.channels;(!a.whatsapp||typeof a.whatsapp!="object")&&(a.whatsapp={});const r=a.whatsapp;(!r.accounts||typeof r.accounts!="object")&&(r.accounts={});const d=r.accounts;if(d[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}d[i]={name:n,provider:"baileys"};const c=s.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const l=St(o);await e.client.request("config.set",{raw:l,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await J(e,!0),await Oo(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function yc(e,t){if(!(!e.client||!e.connected)&&!e.whatsappAccountSaving){e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=st(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,a=o==null?void 0:o.accounts;if(!a){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(a).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!a[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete a[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(l=>{const p=l.match;return!p||p.channel!=="whatsapp"?!0:p.accountId!==t}));const d=n.hash;if(!d){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=St(i);await e.client.request("config.set",{raw:c,baseHash:d}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await J(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const $h=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:mc,loadChannels:J,logoutWhatsApp:gc,removeWhatsAppAccount:yc,startWhatsAppLogin:Oo,waitWhatsAppLogin:fc},Symbol.toStringTag,{value:"Module"}));async function Uo(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,i,s]=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 o=i;e.debugModels=Array.isArray(o==null?void 0:o.models)?o==null?void 0:o.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const Sh=2e3,xh=new Set(["trace","debug","info","warn","error","fatal"]);function Ah(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 Ch(e){if(typeof e!="string")return null;const t=e.toLowerCase();return xh.has(t)?t:null}function vc(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,i=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,s=Ch((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),o=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,a=Ah(o);let r=null;a&&(typeof a.subsystem=="string"?r=a.subsystem:typeof a.module=="string"&&(r=a.module)),!r&&o&&o.length<120&&(r=o);let d=null;return typeof t[1]=="string"?d=t[1]:!a&&typeof t[0]=="string"?d=t[0]:typeof t.message=="string"&&(d=t.message),{raw:e,time:i,level:s,subsystem:r,message:d??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function qt(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.logsLoading=!0),e.logsError=null;try{const i=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),o=(Array.isArray(i.lines)?i.lines.filter(r=>typeof r=="string"):[]).map(vc),a=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=a?o:[...e.logsEntries,...o].slice(-Sh),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const Eh=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:qt,parseLogLine:vc},Symbol.toStringTag,{value:"Module"}));const bc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ce,n:mi,Gx:dr,Gy:ur,a:As,d:Cs,h:Th}=bc,xt=32,Ko=64,_h=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},se=(e="")=>{const t=new Error(e);throw _h(t,se),t},Mh=e=>typeof e=="bigint",Ph=e=>typeof e=="string",Lh=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",at=(e,t,n="")=>{const i=Lh(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const a=n&&`"${n}" `,r=o?` of length ${t}`:"",d=i?`length=${s}`:`type=${typeof e}`;se(a+"expected Uint8Array"+r+", got "+d)}return e},Yi=e=>new Uint8Array(e),wc=e=>Uint8Array.from(e),kc=(e,t)=>e.toString(16).padStart(t,"0"),$c=e=>Array.from(at(e)).map(t=>kc(t,2)).join(""),ze={_0:48,_9:57,A:65,F:70,a:97,f:102},pr=e=>{if(e>=ze._0&&e<=ze._9)return e-ze._0;if(e>=ze.A&&e<=ze.F)return e-(ze.A-10);if(e>=ze.a&&e<=ze.f)return e-(ze.a-10)},Sc=e=>{const t="hex invalid";if(!Ph(e))return se(t);const n=e.length,i=n/2;if(n%2)return se(t);const s=Yi(i);for(let o=0,a=0;o<i;o++,a+=2){const r=pr(e.charCodeAt(a)),d=pr(e.charCodeAt(a+1));if(r===void 0||d===void 0)return se(t);s[o]=r*16+d}return s},xc=()=>globalThis==null?void 0:globalThis.crypto,Ih=()=>{var e;return((e=xc())==null?void 0:e.subtle)??se("crypto.subtle must be defined, consider polyfill")},Dn=(...e)=>{const t=Yi(e.reduce((i,s)=>i+at(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},Rh=(e=xt)=>xc().getRandomValues(Yi(e)),Ei=BigInt,ft=(e,t,n,i="bad number: out of range")=>Mh(e)&&t<=e&&e<n?e:se(i),I=(e,t=ce)=>{const n=e%t;return n>=0n?n:t+n},Ac=e=>I(e,mi),Dh=(e,t)=>{(e===0n||t<=0n)&&se("no inverse n="+e+" mod="+t);let n=I(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const a=i/n,r=i%n,d=s-o*a;i=n,n=r,s=o,o=d}return i===1n?I(s,t):se("no inverse")},Bh=e=>{const t=_c[e];return typeof t!="function"&&se("hashes."+e+" not set"),t},Es=e=>e instanceof At?e:se("Point expected"),ro=2n**256n,De=class De{constructor(t,n,i,s){K(this,"X");K(this,"Y");K(this,"Z");K(this,"T");const o=ro;this.X=ft(t,0n,o),this.Y=ft(n,0n,o),this.Z=ft(i,1n,o),this.T=ft(s,0n,o),Object.freeze(this)}static CURVE(){return bc}static fromAffine(t){return new De(t.x,t.y,1n,I(t.x*t.y))}static fromBytes(t,n=!1){const i=Cs,s=wc(at(t,xt)),o=t[31];s[31]=o&-129;const a=Ec(s);ft(a,0n,n?ro:ce);const d=I(a*a),c=I(d-1n),l=I(i*d+1n);let{isValid:p,value:h}=Fh(c,l);p||se("bad point: y not sqrt");const v=(h&1n)===1n,S=(o&128)!==0;return!n&&h===0n&&S&&se("bad point: x==0, isLastByteOdd"),S!==v&&(h=I(-h)),new De(h,a,1n,I(h*a))}static fromHex(t,n){return De.fromBytes(Sc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=As,n=Cs,i=this;if(i.is0())return se("bad point: ZERO");const{X:s,Y:o,Z:a,T:r}=i,d=I(s*s),c=I(o*o),l=I(a*a),p=I(l*l),h=I(d*t),v=I(l*I(h+c)),S=I(p+I(n*I(d*c)));if(v!==S)return se("bad point: equation left != right (1)");const f=I(s*o),w=I(a*r);return f!==w?se("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:a,Z:r}=Es(t),d=I(n*r),c=I(o*s),l=I(i*r),p=I(a*s);return d===c&&l===p}is0(){return this.equals(Wt)}negate(){return new De(I(-this.X),this.Y,this.Z,I(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=As,o=I(t*t),a=I(n*n),r=I(2n*I(i*i)),d=I(s*o),c=t+n,l=I(I(c*c)-o-a),p=d+a,h=p-r,v=d-a,S=I(l*h),f=I(p*v),w=I(l*v),b=I(h*p);return new De(S,f,b,w)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:r,Z:d,T:c}=Es(t),l=As,p=Cs,h=I(n*a),v=I(i*r),S=I(o*p*c),f=I(s*d),w=I((n+i)*(a+r)-h-v),b=I(f-S),x=I(f+S),C=I(v-l*h),T=I(w*b),P=I(x*C),_=I(w*C),N=I(b*x);return new De(T,P,N,_)}subtract(t){return this.add(Es(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Wt;if(ft(t,1n,mi),t===1n)return this;if(this.equals(Ct))return Qh(t).p;let i=Wt,s=Ct;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?i=i.add(o):n&&(s=s.add(o));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals(Wt))return{x:0n,y:1n};const s=Dh(i,ce);I(i*s)!==1n&&se("invalid inverse");const o=I(t*s),a=I(n*s);return{x:o,y:a}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Cc(n);return i[31]|=t&1n?128:0,i}toHex(){return $c(this.toBytes())}clearCofactor(){return this.multiply(Ei(Th),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(mi/2n,!1).double();return mi%2n&&(t=t.add(this)),t.is0()}};K(De,"BASE"),K(De,"ZERO");let At=De;const Ct=new At(dr,ur,1n,I(dr*ur)),Wt=new At(0n,1n,1n,0n);At.BASE=Ct;At.ZERO=Wt;const Cc=e=>Sc(kc(ft(e,0n,ro),Ko)).reverse(),Ec=e=>Ei("0x"+$c(wc(at(e)).reverse())),Me=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ce;return n},Nh=e=>{const n=e*e%ce*e%ce,i=Me(n,2n)*n%ce,s=Me(i,1n)*e%ce,o=Me(s,5n)*s%ce,a=Me(o,10n)*o%ce,r=Me(a,20n)*a%ce,d=Me(r,40n)*r%ce,c=Me(d,80n)*d%ce,l=Me(c,80n)*d%ce,p=Me(l,10n)*o%ce;return{pow_p_5_8:Me(p,2n)*e%ce,b2:n}},hr=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Fh=(e,t)=>{const n=I(t*t*t),i=I(n*n*t),s=Nh(e*i).pow_p_5_8;let o=I(e*n*s);const a=I(t*o*o),r=o,d=I(o*hr),c=a===e,l=a===I(-e),p=a===I(-e*hr);return c&&(o=r),(l||p)&&(o=d),(I(o)&1n)===1n&&(o=I(-o)),{isValid:c||l,value:o}},lo=e=>Ac(Ec(e)),Wo=(...e)=>_c.sha512Async(Dn(...e)),Oh=(...e)=>Bh("sha512")(Dn(...e)),Tc=e=>{const t=e.slice(0,xt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(xt,Ko),i=lo(t),s=Ct.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},zo=e=>Wo(at(e,xt)).then(Tc),Uh=e=>Tc(Oh(at(e,xt))),Kh=e=>zo(e).then(t=>t.pointBytes),Wh=e=>Wo(e.hashable).then(e.finish),zh=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=lo(t),a=Ct.multiply(o).toBytes();return{hashable:Dn(a,i,n),finish:c=>{const l=Ac(o+lo(c)*s);return at(Dn(a,Cc(l)),Ko)}}},qh=async(e,t)=>{const n=at(e),i=await zo(t),s=await Wo(i.prefix,n);return Wh(zh(i,s,n))},_c={sha512Async:async e=>{const t=Ih(),n=Dn(e);return Yi(await t.digest("SHA-512",n.buffer))},sha512:void 0},Hh=(e=Rh(xt))=>e,jh={getExtendedPublicKeyAsync:zo,getExtendedPublicKey:Uh,randomSecretKey:Hh},Ti=8,Vh=256,Mc=Math.ceil(Vh/Ti)+1,co=2**(Ti-1),Gh=()=>{const e=[];let t=Ct,n=t;for(let i=0;i<Mc;i++){n=t,e.push(n);for(let s=1;s<co;s++)n=n.add(t),e.push(n);t=n.double()}return e};let fr;const gr=(e,t)=>{const n=t.negate();return e?n:t},Qh=e=>{const t=fr||(fr=Gh());let n=Wt,i=Ct;const s=2**Ti,o=s,a=Ei(s-1),r=Ei(Ti);for(let d=0;d<Mc;d++){let c=Number(e&a);e>>=r,c>co&&(c-=o,e+=1n);const l=d*co,p=l,h=l+Math.abs(c)-1,v=d%2!==0,S=c<0;c===0?i=i.add(gr(v,t[p])):n=n.add(gr(S,t[h]))}return e!==0n&&se("invalid wnaf"),{p:n,f:i}},Ts="taskmaster-device-identity-v1";function uo(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Pc(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),i=atob(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o+=1)s[o]=i.charCodeAt(o);return s}function Yh(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Lc(e){const t=await crypto.subtle.digest("SHA-256",e);return Yh(new Uint8Array(t))}async function Jh(){const e=jh.randomSecretKey(),t=await Kh(e);return{deviceId:await Lc(t),publicKey:uo(t),privateKey:uo(e)}}async function Xh(){try{const n=localStorage.getItem(Ts);if(n){const i=JSON.parse(n);if((i==null?void 0:i.version)===1&&typeof i.deviceId=="string"&&typeof i.publicKey=="string"&&typeof i.privateKey=="string"){const s=await Lc(Pc(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(Ts,JSON.stringify(o)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await Jh(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Ts,JSON.stringify(t)),e}async function Zh(e,t){const n=Pc(e),i=new TextEncoder().encode(t),s=await qh(i,n);return uo(s)}const Ic="taskmaster.device.auth.v1";function qo(e){return e.trim()}function ef(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const i=n.trim();i&&t.add(i)}return[...t].sort()}function Ho(){try{const e=window.localStorage.getItem(Ic);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 Rc(e){try{window.localStorage.setItem(Ic,JSON.stringify(e))}catch{}}function tf(e){const t=Ho();if(!t||t.deviceId!==e.deviceId)return null;const n=qo(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function nf(e){const t=qo(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=Ho();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:ef(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Rc(n),s}function sf(e){const t=Ho();if(!t||t.deviceId!==e.deviceId)return;const n=qo(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Rc(i)}async function jo(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t!=null&&t.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n==null?void 0:n.pending)?n.pending:[],paired:Array.isArray(n==null?void 0:n.paired)?n.paired:[]}}catch(n){t!=null&&t.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Vo(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t!=null&&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!=null&&t.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function of(e){return{method:"exec.approvals.get",params:{}}}async function af(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=of(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);rf(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function rf(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=st(t.file??{}))}async function Dc(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function ot(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Qe(e){return e instanceof Error?e.message:String(e)}function Bn(){return{name:"",skillContent:"",references:[]}}async function Ge(e,t){if(t!=null&&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=Qe(n)}finally{e.skillsLoading=!1}}}function Bc(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Nc(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 Ge(e),ot(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Qe(i);e.skillsError=s,ot(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Fc(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 Ge(e),ot(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Qe(n);e.skillsError=i,ot(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Oc(e,t,n,i){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const s=await e.client.request("skills.install",{name:n,installId:i,timeoutMs:12e4});await Ge(e),ot(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=Qe(s);e.skillsError=o,ot(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}async function Uc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});n&&(e.skillDetail=n,e.skillDetailTab="SKILL.md")}catch(n){e.skillsError=Qe(n)}}function Kc(e){e.skillDetail=null,e.skillDetailTab=""}function Wc(e,t){e.skillDetailTab=t}async function zc(e){if(e.skillAddModal=!0,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[],!(!e.client||!e.connected))try{const t=await e.client.request("skills.drafts",{});t&&(e.skillDrafts=t.drafts)}catch{}}function qc(e){e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[]}function Hc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n}))},e.skillAddFormSource="draft"}async function jc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n}))},e.skillAddFormSource="installed",await Go(e)}async function Go(e){if(!e.client||!e.connected)return;const t=e.skillAddForm;if(!(!t.name.trim()||!t.skillContent.trim())){e.skillsBusyKey="__add__",e.skillsError=null;try{const n=t.references.filter(s=>s.name.trim()&&s.content.trim()).map(s=>({name:s.name.trim(),content:s.content})),i=t.name.trim();e.skillAddFormSource==="installed"?(await e.client.request("skills.create",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillDrafts=[],await Ge(e),ot(e,i,{kind:"success",message:"Skill saved — active on next message"})):(await e.client.request("skills.saveDraft",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Bn(),e.skillAddFormSource="draft",e.skillDrafts=[],ot(e,i,{kind:"success",message:"Draft saved"}))}catch(n){e.skillsError=Qe(n)}finally{e.skillsBusyKey=null}}}async function Vc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("skills.deleteDraft",{name:t}),e.skillDrafts=e.skillDrafts.filter(n=>n.name!==t)}catch(n){e.skillsError=Qe(n)}}async function Gc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});if(!n)return;e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i}))},e.skillAddFormSource="installed",e.skillAddModal=!0,e.skillDrafts=[]}catch(n){e.skillsError=Qe(n)}}function Qc(e,t){const n=e.skillDetail;n&&(e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i}))},e.skillAddFormSource="installed",e.skillEditTab=t&&t!=="SKILL.md"?t:"SKILL.md",e.skillDetail=null,e.skillDetailTab="",e.skillAddModal=!0,e.skillDrafts=[])}function Yc(e,t,n){e.skillAddForm={...e.skillAddForm,references:e.skillAddForm.references.map(i=>i.name===t?{...i,content:n}:i)}}function Jc(e,t){e.skillEditTab=t}async function Xc(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.delete",{name:t}),await Ge(e)}catch(n){e.skillsError=Qe(n)}finally{e.skillsBusyKey=null}}}const lf=Object.freeze(Object.defineProperty({__proto__:null,closeAddSkillModal:qc,closeSkillDetail:Kc,deleteDraft:Vc,deleteSkill:Xc,editDetailSkill:Qc,editSkill:Gc,emptyAddForm:Bn,importDraft:Hc,installDraft:jc,installSkill:Oc,loadSkills:Ge,openAddSkillModal:zc,saveNewSkill:Go,saveSkillApiKey:Fc,setEditTab:Jc,setSkillDetailTab:Wc,updateFormReference:Yc,updateSkillEdit:Bc,updateSkillEnabled:Nc,viewSkillDetail:Uc},Symbol.toStringTag,{value:"Module"})),Zc={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},ed=new Map(Object.entries(Zc).map(([e,t])=>[t,e]));function Ji(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Nn(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 cf(e,t=""){const n=Ji(t),i=Zc[e];return n?`${n}${i}`:i}function td(e,t=""){const n=Ji(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=Nn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":ed.get(s)??null}function df(e){let t=Nn(e);if(t.endsWith("/index.html")&&(t=Nn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let i=0;i<n.length;i++){const s=`/${n.slice(i).join("/")}`.toLowerCase();if(ed.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function uf(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Qo(e){return e==="system"?uf():e}const ii=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,pf=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,si=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},hf=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var c;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,a=s,r=pf();if(!!a.startViewTransition&&!r){let l=.5,p=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")l=ii(n.pointerClientX/window.innerWidth),p=ii(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const h=n.element.getBoundingClientRect();h.width>0&&h.height>0&&typeof window<"u"&&(l=ii((h.left+h.width/2)/window.innerWidth),p=ii((h.top+h.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${l*100}%`),o.style.setProperty("--theme-switch-y",`${p*100}%`),o.classList.add("theme-transition");try{const h=(c=a.startViewTransition)==null?void 0:c.call(a,()=>{t()});h!=null&&h.finished?h.finished.finally(()=>si(o)):si(o)}catch{si(o),t()}return}t(),si(o)},ff=2e3;async function xn(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),o=Array.isArray(s.entries)?s.entries:[],a=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=a?o:[...e.sessionLogsEntries,...o].slice(-ff),s.cursors&&(e.sessionLogsCursors=s.cursors),Array.isArray(s.agents)&&(e.sessionLogsAgents=s.agents),e.sessionLogsLastFetchAt=Date.now()}catch(n){e.sessionLogsError=String(n)}finally{t!=null&&t.quiet||(e.sessionLogsLoading=!1)}}}const nd=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:xn},Symbol.toStringTag,{value:"Module"}));async function id(e,t){if(!(!e.client||!e.connected))try{const n={},i=await e.client.request("memory.audit",n);i!=null&&i.ok&&(e.auditEntries=i.entries??[])}catch{}}async function gf(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Oe(e){return e instanceof Error?e.message:String(e)}let oi=null;function Xt(e,t){oi&&clearTimeout(oi),e.filesMessage={kind:"success",text:t},oi=setTimeout(()=>{e.filesMessage=null,oi=null},3e3)}async function Zt(e,t){if(!(!e.client||!e.connected)){if(!t){e.filesTree=[],e.filesRoot="";return}if(!e.filesLoading){e.filesLoading=!0,e.filesError=null;try{const n={};t&&(n.agentId=t);const i=await e.client.request("files.tree",n);i!=null&&i.tree&&(e.filesTree=i.tree,e.filesRoot=i.root??"")}catch(n){e.filesError=Oe(n)}finally{e.filesLoading=!1}}}}async function mf(e,t,n){e.filesSelectedPaths=new Set([t]),await sd(e,t,n)}async function yf(e,t,n){const i=new Set(e.filesSelectedPaths);if(i.has(t)?i.delete(t):i.add(t),e.filesSelectedPaths=i,i.size===1){const s=[...i][0];await sd(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function vf(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const o of n)try{await od(e,o,t),i++}catch(a){s=Oe(a)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:Xt(e,`${i} file${i!==1?"s":""} downloaded`)}async function bf(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await Sf(e,t,o,i)}async function sd(e,t,n){if(!(!e.client||!e.connected)){e.filesSelectedPath=t,e.filesPreviewLoading=!0,e.filesPreviewContent=null,e.filesPreviewBinary=!1,e.filesPreviewSize=null;try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.read",i);e.filesPreviewContent=(s==null?void 0:s.content)??null,e.filesPreviewBinary=(s==null?void 0:s.binary)??!1,e.filesPreviewSize=(s==null?void 0:s.size)??null}catch(i){e.filesError=Oe(i)}finally{e.filesPreviewLoading=!1}}}async function od(e,t,n){if(!(!e.client||!e.connected))try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.download",i);if(!(s!=null&&s.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const o=Uint8Array.from(atob(s.base64),c=>c.charCodeAt(0)),a=new Blob([o]),r=URL.createObjectURL(a),d=document.createElement("a");d.href=r,d.download=s.name??t.split("/").pop()??"download",document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(r)}catch(i){e.filesMessage={kind:"error",text:Oe(i)}}}async function wf(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const a of n)try{const r=await a.arrayBuffer(),d=btoa(new Uint8Array(r).reduce((l,p)=>l+String.fromCharCode(p),"")),c={path:t,name:a.name,data:d};i&&(c.agentId=i),await e.client.request("files.upload",c),s++}catch(r){o=Oe(r)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:Xt(e,`${s} file${s!==1?"s":""} uploaded`),await Zt(e,i)}async function kf(e,t,n,i){if(!e.client||!e.connected)return;e.filesMessage=null;const s=t==="."?n:`${t}/${n}`;try{const o={path:s};i&&(o.agentId=i),await e.client.request("files.mkdir",o),Xt(e,`Created ${s}`),await Zt(e,i),e.filesExpandedDirs=new Set([...e.filesExpandedDirs,s]),e.filesCurrentDir=s}catch(o){e.filesMessage={kind:"error",text:Oe(o)}}}async function $f(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={path:t};n&&(i.agentId=n),await e.client.request("files.delete",i),Xt(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await Zt(e,n)}catch(i){e.filesMessage={kind:"error",text:Oe(i)}}}}async function Sf(e,t,n,i){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={from:t,to:n};i&&(s.agentId=i),await e.client.request("files.move",s),Xt(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await Zt(e,i)}catch(s){e.filesMessage={kind:"error",text:Oe(s)}}}}async function Yo(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const i=await e.client.request("memory.status",n);i!=null&&i.ok&&(e.filesMemoryStatus={dirty:i.dirty??!1,syncing:i.syncing,syncProgress:i.syncProgress,files:i.files??0,chunks:i.chunks??0,model:i.model,embeddingState:i.embeddingState})}catch{}}async function xf(e,t){if(!(!e.client||!e.connected)&&!e.filesReindexBusy){e.filesReindexBusy=!0,e.filesMessage=null;try{const n={force:!0};t&&(n.agentId=t);const i=await e.client.request("memory.reindex",n),s=(i==null?void 0:i.files)??0,o=(i==null?void 0:i.chunks)??0;Xt(e,`Re-indexed: ${s} files, ${o} chunks`),await Yo(e,t)}catch(n){e.filesMessage={kind:"error",text:Oe(n)}}finally{e.filesReindexBusy=!1}}}function Af(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n,e.filesCurrentDir=t}async function Cf(e,t,n){if(!(!e.client||!e.connected)){if(!t.trim()){e.filesSearchResults=null;return}e.filesSearchLoading=!0,e.filesSearchResults=null;try{const i={query:t.trim(),maxResults:20};n&&(i.agentId=n);const s=await e.client.request("memory.search",i);e.filesSearchResults=(s==null?void 0:s.results)??[]}catch(i){e.filesMessage={kind:"error",text:Oe(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function Ef(e){e.filesSearchQuery="",e.filesSearchResults=null}function Tf(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Vo(e,{quiet:!0})},5e3))}function _f(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Jo(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&qt(e,{quiet:!0})},2e3))}function Xo(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Zo(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||xn(e,{quiet:!0})},2e3))}function ea(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function ta(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Uo(e)},3e3))}function na(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Mf(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{id(e)},3e4))}function Pf(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function Lf(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{if(e.tab!=="files")return;const t=e;Yo(t,t.filesResolvedAgentId)},3e3))}function If(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function nt(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,Ep(n),t.theme!==e.theme&&(e.theme=t.theme,Xi(e,Qo(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function ad(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&nt(e,{...e.settings,lastActiveSessionKey:n})}function Rf(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),o=t.get("gatewayUrl");let a=!1;if(n!=null){const d=n.trim();d&&d!==e.settings.token&&nt(e,{...e.settings,token:d}),t.delete("token"),a=!0}if(i!=null){const d=i.trim();d&&(e.password=d),t.delete("password"),a=!0}if(s!=null){const d=s.trim();d&&(e.sessionKey=d,nt(e,{...e.settings,sessionKey:d,lastActiveSessionKey:d}))}if(o!=null){const d=o.trim();d&&d!==e.settings.gatewayUrl&&nt(e,{...e.settings,gatewayUrl:d}),t.delete("gatewayUrl"),a=!0}if(!a)return;const r=new URL(window.location.href);r.search=t.toString(),window.history.replaceState({},"",r.toString())}function Df(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Zo(e):Jo(e):(Xo(e),ea(e)),t==="debug"?ta(e):na(e),_i(e),ld(e,t,!1)}function Bf(e,t,n){hf({nextTheme:t,applyTheme:()=>{e.theme=t,nt(e,{...e.settings,theme:t}),Xi(e,Qo(t))},context:n,currentTheme:e.theme})}async function _i(e){if(e.tab==="overview"&&await cd(e),e.tab==="channels"&&await zf(e),e.tab==="instances"&&await Dc(e),e.tab==="cron"&&await ia(e),e.tab==="skills"&&await Ge(e),e.tab==="nodes"&&(await Vo(e),await jo(e),await Fe(e),await af(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await Gf(e),Yt(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await uc(e),await Fe(e)),e.tab==="debug"&&(await Uo(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await ae(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>nd);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await qt(e,{reset:!0});cc(e,!0)}}function Nf(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Ji(e):df(window.location.pathname)}function Ff(e){e.theme=e.settings.theme??"system",Xi(e,Qo(e.theme))}function Xi(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Of(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"&&Xi(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Uf(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 Kf(e,t){if(typeof window>"u")return;const n=td(window.location.pathname,e.basePath)??"chat";rd(e,n),ld(e,n,t)}function Wf(e){var s;if(typeof window>"u")return;const t=td(window.location.pathname,e.basePath);if(!t)return;const i=(s=new URL(window.location.href).searchParams.get("session"))==null?void 0:s.trim();i&&(e.sessionKey=i,nt(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),rd(e,t)}function rd(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Zo(e):Jo(e):(Xo(e),ea(e)),t==="debug"?ta(e):na(e),e.connected&&_i(e)}function ld(e,t,n){if(typeof window>"u")return;const i=Nn(cf(t,e.basePath)),s=Nn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),s!==i&&(o.pathname=i),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}async function cd(e){await Promise.all([J(e,!1),Dc(e),No(e),Jt(e),Uo(e)])}async function zf(e){await Promise.all([J(e,!0),uc(e),Fe(e)])}async function ia(e){await Promise.all([J(e,!1),Jt(e),Fn(e)])}function dd(e){return e.chatSending||!!e.chatRunId}function qf(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"}async function ud(e){e.connected&&(e.chatMessage="",await rc(e))}function Hf(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:Qi(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],Yt(e))}async function pd(e,t,n){var s,o;Fo(e);const i=await ac(e,t,n==null?void 0:n.attachments);return!i&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!i&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),i&&ad(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((o=n.previousAttachments)!=null&&o.length)&&(e.chatAttachments=n.previousAttachments),Yt(e),i&&!e.chatRunId&&hd(e),i}async function hd(e){if(!e.connected||dd(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await pd(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function jf(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Vf(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],a=t==null?o:[],r=a.length>0;if(!(!s&&!r)){if(qf(s)){await ud(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[],_p(e.selectedWorkspace??"",e.sessionKey)),dd(e)){Hf(e,s,a);return}await pd(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:r?a:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function Gf(e){var i;const t=e,n=Math.max((((i=t.chatMessages)==null?void 0:i.length)??0)+10,Ne);await Promise.all([Be(t,{limit:n}),No(t),po(e)]),Yt(e,!0)}const Qf=hd;function Yf(e){var s,o,a;const t=Xl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((a=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:a.trim())||"main"}function Jf(e,t){const n=Ji(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function po(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Yf(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Jf(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),o=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const L={messageSquare:u`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:u`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:u`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,unlink:u`<svg viewBox="0 0 24 24"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"/><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"/><line x1="8" x2="8" y1="2" y2="5"/><line x1="2" x2="5" y1="8" y2="8"/><line x1="16" x2="16" y1="19" y2="22"/><line x1="19" x2="22" y1="16" y2="16"/></svg>`,radio:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:u`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:u`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:u`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:u`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:u`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:u`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:u`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,users:u`<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>`,menu:u`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:u`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:u`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:u`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:u`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:u`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:u`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:u`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,rotateCw:u`<svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,download:u`<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,wrench:u`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:u`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:u`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:u`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:u`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,globeOff:u`<svg viewBox="0 0 24 24"><path d="M21.54 15H17"/><path d="M7 3.34V5a3 3 0 0 0 3 3 2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:u`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:u`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,plug:u`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`,puzzle:u`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`,info:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>`,send:u`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>`,slidersHorizontal:u`<svg viewBox="0 0 24 24"><line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/></svg>`,square:u`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:u`<svg viewBox="0 0 24 24"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`,eyeOff:u`<svg viewBox="0 0 24 24"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,trash:u`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,mic:u`<svg viewBox="0 0 24 24"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,chevronDown:u`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:u`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`,wifi:u`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.859a10 10 0 0 1 14 0"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/></svg>`,wifiOff:u`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/><path d="M5 12.859a10 10 0 0 1 5.17-2.69"/><path d="M13.41 10.28a10 10 0 0 1 5.59 2.58"/><path d="M2 8.82a15 15 0 0 1 4.17-2.65"/><path d="M10.66 5c4.01-.36 8.14.9 11.34 3.76"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,power:u`<svg viewBox="0 0 24 24"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"/><line x1="12" x2="12" y1="2" y2="12"/></svg>`,powerOff:u`<svg viewBox="0 0 24 24"><path d="M18.36 6.64A9 9 0 0 1 20.77 15"/><path d="M6.16 6.16a9 9 0 1 0 12.68 12.68"/><path d="M12 2v4"/><path d="m2 2 20 20"/></svg>`},Xf=u`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,Zf=u`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>`;let mr=!1;function eg(){mr||(mr=!0,document.addEventListener("click",e=>{const t=document.getElementById("nav-burger-toggle");if(!(t!=null&&t.checked))return;const n=t.closest(".setup-header");n!=null&&n.contains(e.target)||(t.checked=!1)}))}function Mt(e,t){var l;const n=(p,h)=>p===e?u`<span class="sp-page-nav-current">${p}</span>`:u`<a href=${h}>${p}</a>`,i=u`
|
|
19
|
+
`],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-session-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function ph(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:i}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${i}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}function st(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function St(e){return`${JSON.stringify(e,null,2).trimEnd()}
|
|
20
|
+
`}function dc(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const r=t[o],a=t[o+1];if(typeof r=="number"){if(!Array.isArray(i))return;i[r]==null&&(i[r]=typeof a=="number"?[]:{}),i=i[r]}else{if(typeof i!="object"||i==null)return;const d=i;d[r]==null&&(d[r]=typeof a=="number"?[]:{}),i=d[r]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function Fe(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});fh(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function uc(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});hh(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function hh(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function fh(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?St(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=St(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=st(t.config??{}),e.configFormOriginal=st(t.config??{}),e.configRawOriginal=n)}async function gh(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?St(e.configForm):e.configRaw,i=(t=e.configSnapshot)==null?void 0:t.hash;if(!i){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:n,baseHash:i}),e.configFormDirty=!1,await Fe(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function Yt(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 Fn(e){if(!(!e.client||!e.connected)&&!e.cronLoading){e.cronLoading=!0,e.cronError=null;try{const t={includeDisabled:!0};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(t.agentIds=e.workspaceAgentIds);const n=await e.client.request("cron.list",t);e.cronJobs=Array.isArray(n.jobs)?n.jobs:[]}catch(t){e.cronError=String(t)}finally{e.cronLoading=!1}}}function pc(e){if(e.scheduleKind==="at"){const n=Date.parse(e.scheduleAt);if(!Number.isFinite(n))throw new Error("Invalid run time.");return{kind:"at",atMs:n}}if(e.scheduleKind==="every"){const n=Ai(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const i=e.everyUnit;return{kind:"every",everyMs:n*(i==="minutes"?6e4:i==="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 hc(e){if(e.payloadKind==="systemEvent"){const o=e.payloadText.trim();if(!o)throw new Error("System event text required.");return{kind:"systemEvent",text:o}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel);const i=[];e.toAdmins&&i.push("admins");for(const o of e.recipients){const r=o.trim();r&&i.push(r)}i.length>0&&(n.to=i.join(","));const s=Ai(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function mh(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=pc(e.cronForm),i=hc(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),r={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:o||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!r.name)throw new Error("Name required.");await e.client.request("cron.add",r),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Fn(e),await Yt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function yh(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 Fn(e),await Yt(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function vh(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null,e.cronRunModalJobId=t.id,e.cronRunModalJobName=t.name||"Untitled",e.cronRunResult=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await ro(e,t.id)}catch(n){e.cronError=String(n),e.cronRunResult={status:"error",error:String(n)}}finally{e.cronBusy=!1}}}function bh(e,t){e.cronRunModalJobId&&t.jobId===e.cronRunModalJobId&&t.action==="finished"&&(e.cronRunResult={status:t.status??"unknown",durationMs:t.durationMs,summary:t.summary,error:t.error})}async function wh(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 Fn(e),await Yt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}function kh(e){var n;const t={name:e.name||"",description:e.description||"",agentId:e.agentId||"",enabled:e.enabled,scheduleKind:e.schedule.kind,scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"",cronTz:"",sessionTarget:e.sessionTarget||"main",wakeMode:e.wakeMode||"next-heartbeat",payloadKind:e.payload.kind,payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};if(e.schedule.kind==="at"){const i=new Date(e.schedule.atMs),s=o=>String(o).padStart(2,"0");t.scheduleAt=`${i.getFullYear()}-${s(i.getMonth()+1)}-${s(i.getDate())}T${s(i.getHours())}:${s(i.getMinutes())}`}else if(e.schedule.kind==="every"){const i=e.schedule.everyMs;i%864e5===0?(t.everyAmount=String(i/864e5),t.everyUnit="days"):i%36e5===0?(t.everyAmount=String(i/36e5),t.everyUnit="hours"):(t.everyAmount=String(i/6e4),t.everyUnit="minutes")}else e.schedule.kind==="cron"&&(t.cronExpr=e.schedule.expr,t.cronTz=e.schedule.tz||"");if(e.payload.kind==="systemEvent")t.payloadText=e.payload.text;else if(e.payload.kind==="agentTurn"){t.payloadText=e.payload.message,t.deliver=e.payload.deliver??!1,t.timeoutSeconds=e.payload.timeoutSeconds?String(e.payload.timeoutSeconds):"";const i=e.payload.channel??e.payload.provider;t.channel=i||"last";const s=e.payload.to||"";if(s){const o=s.split(",").map(r=>r.trim()).filter(Boolean);t.toAdmins=o.some(r=>r.toLowerCase()==="admins"),t.recipients=o.filter(r=>r.toLowerCase()!=="admins")}}return(n=e.isolation)!=null&&n.postToMainPrefix&&(t.postToMainPrefix=e.isolation.postToMainPrefix),t}async function $h(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=pc(e.cronForm),i=hc(e.cronForm),s={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:e.cronForm.agentId.trim()||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i};if(e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?s.isolation={postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:s.isolation=void 0,!s.name)throw new Error("Name required.");await e.client.request("cron.update",{id:t,patch:s}),await Fn(e),await Yt(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ro(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("cron.runs",{id:t,limit:50});e.cronRunsJobId=t,e.cronRuns=Array.isArray(n.entries)?n.entries:[]}catch(n){e.cronError=String(n)}}async function Y(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 Oo(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const i=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=i.message??null,e.whatsappLoginQrDataUrl=i.qrDataUrl??null,e.whatsappLoginConnected=null}catch(i){e.whatsappLoginMessage=String(i),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function fc(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{const n=await e.client.request("web.login.wait",{timeoutMs:12e4,accountId:t});e.whatsappLoginMessage=n.message??null,e.whatsappLoginConnected=n.connected??null,n.connected&&(e.whatsappLoginQrDataUrl=null,e.whatsappActiveQrAccountId=null,e.whatsappPairedPhone=n.selfPhone??null)}catch(n){e.whatsappLoginMessage=String(n),e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function gc(e,t){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0;try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t}),e.whatsappLoginMessage="Logged out.",e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null}catch(n){e.whatsappLoginMessage=String(n)}finally{e.whatsappBusy=!1}}}async function mc(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const i=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!i){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const o=st(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const r=o.channels;(!r.whatsapp||typeof r.whatsapp!="object")&&(r.whatsapp={});const a=r.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const d=a.accounts;if(d[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}d[i]={name:n,provider:"baileys"};const c=s.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const l=St(o);await e.client.request("config.set",{raw:l,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await Y(e,!0),await Oo(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function yc(e,t){if(!(!e.client||!e.connected)&&!e.whatsappAccountSaving){e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=st(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,r=o==null?void 0:o.accounts;if(!r){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(r).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!r[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete r[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(l=>{const p=l.match;return!p||p.channel!=="whatsapp"?!0:p.accountId!==t}));const d=n.hash;if(!d){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=St(i);await e.client.request("config.set",{raw:c,baseHash:d}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await Y(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const Sh=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:mc,loadChannels:Y,logoutWhatsApp:gc,removeWhatsAppAccount:yc,startWhatsAppLogin:Oo,waitWhatsAppLogin:fc},Symbol.toStringTag,{value:"Module"}));async function Uo(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,i,s]=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 o=i;e.debugModels=Array.isArray(o==null?void 0:o.models)?o==null?void 0:o.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const xh=2e3,Ah=new Set(["trace","debug","info","warn","error","fatal"]);function Eh(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 Ch(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Ah.has(t)?t:null}function vc(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,i=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,s=Ch((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),o=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,r=Eh(o);let a=null;r&&(typeof r.subsystem=="string"?a=r.subsystem:typeof r.module=="string"&&(a=r.module)),!a&&o&&o.length<120&&(a=o);let d=null;return typeof t[1]=="string"?d=t[1]:!r&&typeof t[0]=="string"?d=t[0]:typeof t.message=="string"&&(d=t.message),{raw:e,time:i,level:s,subsystem:a,message:d??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Ht(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.logsLoading=!0),e.logsError=null;try{const i=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),o=(Array.isArray(i.lines)?i.lines.filter(a=>typeof a=="string"):[]).map(vc),r=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-xh),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const Th=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:Ht,parseLogLine:vc},Symbol.toStringTag,{value:"Module"}));const bc={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:ce,n:mi,Gx:da,Gy:ua,a:As,d:Es,h:_h}=bc,xt=32,Wo=64,Mh=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},se=(e="")=>{const t=new Error(e);throw Mh(t,se),t},Ph=e=>typeof e=="bigint",Lh=e=>typeof e=="string",Ih=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",rt=(e,t,n="")=>{const i=Ih(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const r=n&&`"${n}" `,a=o?` of length ${t}`:"",d=i?`length=${s}`:`type=${typeof e}`;se(r+"expected Uint8Array"+a+", got "+d)}return e},Ji=e=>new Uint8Array(e),wc=e=>Uint8Array.from(e),kc=(e,t)=>e.toString(16).padStart(t,"0"),$c=e=>Array.from(rt(e)).map(t=>kc(t,2)).join(""),ze={_0:48,_9:57,A:65,F:70,a:97,f:102},pa=e=>{if(e>=ze._0&&e<=ze._9)return e-ze._0;if(e>=ze.A&&e<=ze.F)return e-(ze.A-10);if(e>=ze.a&&e<=ze.f)return e-(ze.a-10)},Sc=e=>{const t="hex invalid";if(!Lh(e))return se(t);const n=e.length,i=n/2;if(n%2)return se(t);const s=Ji(i);for(let o=0,r=0;o<i;o++,r+=2){const a=pa(e.charCodeAt(r)),d=pa(e.charCodeAt(r+1));if(a===void 0||d===void 0)return se(t);s[o]=a*16+d}return s},xc=()=>globalThis==null?void 0:globalThis.crypto,Rh=()=>{var e;return((e=xc())==null?void 0:e.subtle)??se("crypto.subtle must be defined, consider polyfill")},Dn=(...e)=>{const t=Ji(e.reduce((i,s)=>i+rt(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},Dh=(e=xt)=>xc().getRandomValues(Ji(e)),Ci=BigInt,ft=(e,t,n,i="bad number: out of range")=>Ph(e)&&t<=e&&e<n?e:se(i),I=(e,t=ce)=>{const n=e%t;return n>=0n?n:t+n},Ac=e=>I(e,mi),Nh=(e,t)=>{(e===0n||t<=0n)&&se("no inverse n="+e+" mod="+t);let n=I(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const r=i/n,a=i%n,d=s-o*r;i=n,n=a,s=o,o=d}return i===1n?I(s,t):se("no inverse")},Bh=e=>{const t=_c[e];return typeof t!="function"&&se("hashes."+e+" not set"),t},Cs=e=>e instanceof At?e:se("Point expected"),ao=2n**256n,De=class De{constructor(t,n,i,s){W(this,"X");W(this,"Y");W(this,"Z");W(this,"T");const o=ao;this.X=ft(t,0n,o),this.Y=ft(n,0n,o),this.Z=ft(i,1n,o),this.T=ft(s,0n,o),Object.freeze(this)}static CURVE(){return bc}static fromAffine(t){return new De(t.x,t.y,1n,I(t.x*t.y))}static fromBytes(t,n=!1){const i=Es,s=wc(rt(t,xt)),o=t[31];s[31]=o&-129;const r=Cc(s);ft(r,0n,n?ao:ce);const d=I(r*r),c=I(d-1n),l=I(i*d+1n);let{isValid:p,value:f}=Oh(c,l);p||se("bad point: y not sqrt");const v=(f&1n)===1n,S=(o&128)!==0;return!n&&f===0n&&S&&se("bad point: x==0, isLastByteOdd"),S!==v&&(f=I(-f)),new De(f,r,1n,I(f*r))}static fromHex(t,n){return De.fromBytes(Sc(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=As,n=Es,i=this;if(i.is0())return se("bad point: ZERO");const{X:s,Y:o,Z:r,T:a}=i,d=I(s*s),c=I(o*o),l=I(r*r),p=I(l*l),f=I(d*t),v=I(l*I(f+c)),S=I(p+I(n*I(d*c)));if(v!==S)return se("bad point: equation left != right (1)");const h=I(s*o),b=I(r*a);return h!==b?se("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:r,Z:a}=Cs(t),d=I(n*a),c=I(o*s),l=I(i*a),p=I(r*s);return d===c&&l===p}is0(){return this.equals(Kt)}negate(){return new De(I(-this.X),this.Y,this.Z,I(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=As,o=I(t*t),r=I(n*n),a=I(2n*I(i*i)),d=I(s*o),c=t+n,l=I(I(c*c)-o-r),p=d+r,f=p-a,v=d-r,S=I(l*f),h=I(p*v),b=I(l*v),w=I(f*p);return new De(S,h,w,b)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:r,Y:a,Z:d,T:c}=Cs(t),l=As,p=Es,f=I(n*r),v=I(i*a),S=I(o*p*c),h=I(s*d),b=I((n+i)*(r+a)-f-v),w=I(h-S),x=I(h+S),A=I(v-l*f),C=I(b*w),P=I(x*A),_=I(b*A),B=I(w*x);return new De(C,P,B,_)}subtract(t){return this.add(Cs(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return Kt;if(ft(t,1n,mi),t===1n)return this;if(this.equals(Et))return Jh(t).p;let i=Kt,s=Et;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?i=i.add(o):n&&(s=s.add(o));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals(Kt))return{x:0n,y:1n};const s=Nh(i,ce);I(i*s)!==1n&&se("invalid inverse");const o=I(t*s),r=I(n*s);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Ec(n);return i[31]|=t&1n?128:0,i}toHex(){return $c(this.toBytes())}clearCofactor(){return this.multiply(Ci(_h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(mi/2n,!1).double();return mi%2n&&(t=t.add(this)),t.is0()}};W(De,"BASE"),W(De,"ZERO");let At=De;const Et=new At(da,ua,1n,I(da*ua)),Kt=new At(0n,1n,1n,0n);At.BASE=Et;At.ZERO=Kt;const Ec=e=>Sc(kc(ft(e,0n,ao),Wo)).reverse(),Cc=e=>Ci("0x"+$c(wc(rt(e)).reverse())),Me=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=ce;return n},Fh=e=>{const n=e*e%ce*e%ce,i=Me(n,2n)*n%ce,s=Me(i,1n)*e%ce,o=Me(s,5n)*s%ce,r=Me(o,10n)*o%ce,a=Me(r,20n)*r%ce,d=Me(a,40n)*a%ce,c=Me(d,80n)*d%ce,l=Me(c,80n)*d%ce,p=Me(l,10n)*o%ce;return{pow_p_5_8:Me(p,2n)*e%ce,b2:n}},ha=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Oh=(e,t)=>{const n=I(t*t*t),i=I(n*n*t),s=Fh(e*i).pow_p_5_8;let o=I(e*n*s);const r=I(t*o*o),a=o,d=I(o*ha),c=r===e,l=r===I(-e),p=r===I(-e*ha);return c&&(o=a),(l||p)&&(o=d),(I(o)&1n)===1n&&(o=I(-o)),{isValid:c||l,value:o}},lo=e=>Ac(Cc(e)),Ko=(...e)=>_c.sha512Async(Dn(...e)),Uh=(...e)=>Bh("sha512")(Dn(...e)),Tc=e=>{const t=e.slice(0,xt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(xt,Wo),i=lo(t),s=Et.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},zo=e=>Ko(rt(e,xt)).then(Tc),Wh=e=>Tc(Uh(rt(e,xt))),Kh=e=>zo(e).then(t=>t.pointBytes),zh=e=>Ko(e.hashable).then(e.finish),Hh=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=lo(t),r=Et.multiply(o).toBytes();return{hashable:Dn(r,i,n),finish:c=>{const l=Ac(o+lo(c)*s);return rt(Dn(r,Ec(l)),Wo)}}},qh=async(e,t)=>{const n=rt(e),i=await zo(t),s=await Ko(i.prefix,n);return zh(Hh(i,s,n))},_c={sha512Async:async e=>{const t=Rh(),n=Dn(e);return Ji(await t.digest("SHA-512",n.buffer))},sha512:void 0},jh=(e=Dh(xt))=>e,Vh={getExtendedPublicKeyAsync:zo,getExtendedPublicKey:Wh,randomSecretKey:jh},Ti=8,Gh=256,Mc=Math.ceil(Gh/Ti)+1,co=2**(Ti-1),Qh=()=>{const e=[];let t=Et,n=t;for(let i=0;i<Mc;i++){n=t,e.push(n);for(let s=1;s<co;s++)n=n.add(t),e.push(n);t=n.double()}return e};let fa;const ga=(e,t)=>{const n=t.negate();return e?n:t},Jh=e=>{const t=fa||(fa=Qh());let n=Kt,i=Et;const s=2**Ti,o=s,r=Ci(s-1),a=Ci(Ti);for(let d=0;d<Mc;d++){let c=Number(e&r);e>>=a,c>co&&(c-=o,e+=1n);const l=d*co,p=l,f=l+Math.abs(c)-1,v=d%2!==0,S=c<0;c===0?i=i.add(ga(v,t[p])):n=n.add(ga(S,t[f]))}return e!==0n&&se("invalid wnaf"),{p:n,f:i}},Ts="taskmaster-device-identity-v1";function uo(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Pc(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),i=atob(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o+=1)s[o]=i.charCodeAt(o);return s}function Yh(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Lc(e){const t=await crypto.subtle.digest("SHA-256",e);return Yh(new Uint8Array(t))}async function Xh(){const e=Vh.randomSecretKey(),t=await Kh(e);return{deviceId:await Lc(t),publicKey:uo(t),privateKey:uo(e)}}async function Zh(){try{const n=localStorage.getItem(Ts);if(n){const i=JSON.parse(n);if((i==null?void 0:i.version)===1&&typeof i.deviceId=="string"&&typeof i.publicKey=="string"&&typeof i.privateKey=="string"){const s=await Lc(Pc(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(Ts,JSON.stringify(o)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await Xh(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Ts,JSON.stringify(t)),e}async function ef(e,t){const n=Pc(e),i=new TextEncoder().encode(t),s=await qh(i,n);return uo(s)}const Ic="taskmaster.device.auth.v1";function Ho(e){return e.trim()}function tf(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const i=n.trim();i&&t.add(i)}return[...t].sort()}function qo(){try{const e=window.localStorage.getItem(Ic);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 Rc(e){try{window.localStorage.setItem(Ic,JSON.stringify(e))}catch{}}function nf(e){const t=qo();if(!t||t.deviceId!==e.deviceId)return null;const n=Ho(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function sf(e){const t=Ho(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=qo();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:tf(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Rc(n),s}function of(e){const t=qo();if(!t||t.deviceId!==e.deviceId)return;const n=Ho(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Rc(i)}async function jo(e,t){if(!(!e.client||!e.connected)&&!e.devicesLoading){e.devicesLoading=!0,t!=null&&t.quiet||(e.devicesError=null);try{const n=await e.client.request("device.pair.list",{});e.devicesList={pending:Array.isArray(n==null?void 0:n.pending)?n.pending:[],paired:Array.isArray(n==null?void 0:n.paired)?n.paired:[]}}catch(n){t!=null&&t.quiet||(e.devicesError=String(n))}finally{e.devicesLoading=!1}}}async function Vo(e,t){if(!(!e.client||!e.connected)&&!e.nodesLoading){e.nodesLoading=!0,t!=null&&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!=null&&t.quiet||(e.lastError=String(n))}finally{e.nodesLoading=!1}}}function rf(e){return{method:"exec.approvals.get",params:{}}}async function af(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=rf(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);lf(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function lf(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=st(t.file??{}))}async function Dc(e){if(!(!e.client||!e.connected)&&!e.presenceLoading){e.presenceLoading=!0,e.presenceError=null,e.presenceStatus=null;try{const t=await e.client.request("system-presence",{});Array.isArray(t)?(e.presenceEntries=t,e.presenceStatus=t.length===0?"No instances yet.":null):(e.presenceEntries=[],e.presenceStatus="No presence payload.")}catch(t){e.presenceError=String(t)}finally{e.presenceLoading=!1}}}function ot(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Qe(e){return e instanceof Error?e.message:String(e)}function Nn(){return{name:"",skillContent:"",references:[]}}async function Ge(e,t){if(t!=null&&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=Qe(n)}finally{e.skillsLoading=!1}}}function Nc(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Bc(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 Ge(e),ot(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Qe(i);e.skillsError=s,ot(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Fc(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 Ge(e),ot(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Qe(n);e.skillsError=i,ot(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Oc(e,t,n,i){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const s=await e.client.request("skills.install",{name:n,installId:i,timeoutMs:12e4});await Ge(e),ot(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=Qe(s);e.skillsError=o,ot(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}async function Uc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});n&&(e.skillDetail=n,e.skillDetailTab="SKILL.md")}catch(n){e.skillsError=Qe(n)}}function Wc(e){e.skillDetail=null,e.skillDetailTab=""}function Kc(e,t){e.skillDetailTab=t}async function zc(e){if(e.skillAddModal=!0,e.skillAddForm=Nn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[],!(!e.client||!e.connected))try{const t=await e.client.request("skills.drafts",{});t&&(e.skillDrafts=t.drafts)}catch{}}function Hc(e){e.skillAddModal=!1,e.skillAddForm=Nn(),e.skillAddFormSource="draft",e.skillEditTab="SKILL.md",e.skillDrafts=[]}function qc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n}))},e.skillAddFormSource="draft"}async function jc(e,t){e.skillAddForm={name:t.name,skillContent:t.skillContent,references:t.references.map(n=>({...n}))},e.skillAddFormSource="installed",await Go(e)}async function Go(e){if(!e.client||!e.connected)return;const t=e.skillAddForm;if(!(!t.name.trim()||!t.skillContent.trim())){e.skillsBusyKey="__add__",e.skillsError=null;try{const n=t.references.filter(s=>s.name.trim()&&s.content.trim()).map(s=>({name:s.name.trim(),content:s.content})),i=t.name.trim();e.skillAddFormSource==="installed"?(await e.client.request("skills.create",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Nn(),e.skillAddFormSource="draft",e.skillDrafts=[],await Ge(e),ot(e,i,{kind:"success",message:"Skill saved — active on next message"})):(await e.client.request("skills.saveDraft",{name:i,skillContent:t.skillContent,references:n.length>0?n:void 0}),e.skillAddModal=!1,e.skillAddForm=Nn(),e.skillAddFormSource="draft",e.skillDrafts=[],ot(e,i,{kind:"success",message:"Draft saved"}))}catch(n){e.skillsError=Qe(n)}finally{e.skillsBusyKey=null}}}async function Vc(e,t){if(!(!e.client||!e.connected))try{await e.client.request("skills.deleteDraft",{name:t}),e.skillDrafts=e.skillDrafts.filter(n=>n.name!==t)}catch(n){e.skillsError=Qe(n)}}async function Gc(e,t){if(!(!e.client||!e.connected))try{const n=await e.client.request("skills.read",{name:t});if(!n)return;e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i}))},e.skillAddFormSource="installed",e.skillAddModal=!0,e.skillDrafts=[]}catch(n){e.skillsError=Qe(n)}}function Qc(e,t){const n=e.skillDetail;n&&(e.skillAddForm={name:n.name,skillContent:n.content,references:n.references.map(i=>({...i}))},e.skillAddFormSource="installed",e.skillEditTab=t&&t!=="SKILL.md"?t:"SKILL.md",e.skillDetail=null,e.skillDetailTab="",e.skillAddModal=!0,e.skillDrafts=[])}function Jc(e,t,n){e.skillAddForm={...e.skillAddForm,references:e.skillAddForm.references.map(i=>i.name===t?{...i,content:n}:i)}}function Yc(e,t){e.skillEditTab=t}async function Xc(e,t){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{await e.client.request("skills.delete",{name:t}),await Ge(e)}catch(n){e.skillsError=Qe(n)}finally{e.skillsBusyKey=null}}}const cf=Object.freeze(Object.defineProperty({__proto__:null,closeAddSkillModal:Hc,closeSkillDetail:Wc,deleteDraft:Vc,deleteSkill:Xc,editDetailSkill:Qc,editSkill:Gc,emptyAddForm:Nn,importDraft:qc,installDraft:jc,installSkill:Oc,loadSkills:Ge,openAddSkillModal:zc,saveNewSkill:Go,saveSkillApiKey:Fc,setEditTab:Yc,setSkillDetailTab:Kc,updateFormReference:Jc,updateSkillEdit:Nc,updateSkillEnabled:Bc,viewSkillDetail:Uc},Symbol.toStringTag,{value:"Module"})),Zc={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},ed=new Map(Object.entries(Zc).map(([e,t])=>[t,e]));function Yi(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function Bn(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 df(e,t=""){const n=Yi(t),i=Zc[e];return n?`${n}${i}`:i}function td(e,t=""){const n=Yi(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=Bn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":ed.get(s)??null}function uf(e){let t=Bn(e);if(t.endsWith("/index.html")&&(t=Bn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let i=0;i<n.length;i++){const s=`/${n.slice(i).join("/")}`.toLowerCase();if(ed.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function pf(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Qo(e){return e==="system"?pf():e}const ii=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,hf=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,si=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},ff=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var c;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,r=s,a=hf();if(!!r.startViewTransition&&!a){let l=.5,p=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")l=ii(n.pointerClientX/window.innerWidth),p=ii(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const f=n.element.getBoundingClientRect();f.width>0&&f.height>0&&typeof window<"u"&&(l=ii((f.left+f.width/2)/window.innerWidth),p=ii((f.top+f.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${l*100}%`),o.style.setProperty("--theme-switch-y",`${p*100}%`),o.classList.add("theme-transition");try{const f=(c=r.startViewTransition)==null?void 0:c.call(r,()=>{t()});f!=null&&f.finished?f.finished.finally(()=>si(o)):si(o)}catch{si(o),t()}return}t(),si(o)},gf=2e3;async function xn(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),o=Array.isArray(s.entries)?s.entries:[],r=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=r?o:[...e.sessionLogsEntries,...o].slice(-gf),s.cursors&&(e.sessionLogsCursors=s.cursors),Array.isArray(s.agents)&&(e.sessionLogsAgents=s.agents),e.sessionLogsLastFetchAt=Date.now()}catch(n){e.sessionLogsError=String(n)}finally{t!=null&&t.quiet||(e.sessionLogsLoading=!1)}}}const nd=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:xn},Symbol.toStringTag,{value:"Module"}));async function id(e,t){if(!(!e.client||!e.connected))try{const n={},i=await e.client.request("memory.audit",n);i!=null&&i.ok&&(e.auditEntries=i.entries??[])}catch{}}async function mf(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Oe(e){return e instanceof Error?e.message:String(e)}let oi=null;function Xt(e,t){oi&&clearTimeout(oi),e.filesMessage={kind:"success",text:t},oi=setTimeout(()=>{e.filesMessage=null,oi=null},3e3)}async function Zt(e,t){if(!(!e.client||!e.connected)){if(!t){e.filesTree=[],e.filesRoot="";return}if(!e.filesLoading){e.filesLoading=!0,e.filesError=null;try{const n={};t&&(n.agentId=t);const i=await e.client.request("files.tree",n);i!=null&&i.tree&&(e.filesTree=i.tree,e.filesRoot=i.root??"")}catch(n){e.filesError=Oe(n)}finally{e.filesLoading=!1}}}}async function yf(e,t,n){e.filesSelectedPaths=new Set([t]),await sd(e,t,n)}async function vf(e,t,n){const i=new Set(e.filesSelectedPaths);if(i.has(t)?i.delete(t):i.add(t),e.filesSelectedPaths=i,i.size===1){const s=[...i][0];await sd(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function bf(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const o of n)try{await od(e,o,t),i++}catch(r){s=Oe(r)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:Xt(e,`${i} file${i!==1?"s":""} downloaded`)}async function wf(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await xf(e,t,o,i)}async function sd(e,t,n){if(!(!e.client||!e.connected)){e.filesSelectedPath=t,e.filesPreviewLoading=!0,e.filesPreviewContent=null,e.filesPreviewBinary=!1,e.filesPreviewSize=null;try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.read",i);e.filesPreviewContent=(s==null?void 0:s.content)??null,e.filesPreviewBinary=(s==null?void 0:s.binary)??!1,e.filesPreviewSize=(s==null?void 0:s.size)??null}catch(i){e.filesError=Oe(i)}finally{e.filesPreviewLoading=!1}}}async function od(e,t,n){if(!(!e.client||!e.connected))try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.download",i);if(!(s!=null&&s.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const o=Uint8Array.from(atob(s.base64),c=>c.charCodeAt(0)),r=new Blob([o]),a=URL.createObjectURL(r),d=document.createElement("a");d.href=a,d.download=s.name??t.split("/").pop()??"download",document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(a)}catch(i){e.filesMessage={kind:"error",text:Oe(i)}}}async function kf(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const r of n)try{const a=await r.arrayBuffer(),d=btoa(new Uint8Array(a).reduce((l,p)=>l+String.fromCharCode(p),"")),c={path:t,name:r.name,data:d};i&&(c.agentId=i),await e.client.request("files.upload",c),s++}catch(a){o=Oe(a)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:Xt(e,`${s} file${s!==1?"s":""} uploaded`),await Zt(e,i)}async function $f(e,t,n,i){if(!e.client||!e.connected)return;e.filesMessage=null;const s=t==="."?n:`${t}/${n}`;try{const o={path:s};i&&(o.agentId=i),await e.client.request("files.mkdir",o),Xt(e,`Created ${s}`),await Zt(e,i),e.filesExpandedDirs=new Set([...e.filesExpandedDirs,s]),e.filesCurrentDir=s}catch(o){e.filesMessage={kind:"error",text:Oe(o)}}}async function Sf(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={path:t};n&&(i.agentId=n),await e.client.request("files.delete",i),Xt(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await Zt(e,n)}catch(i){e.filesMessage={kind:"error",text:Oe(i)}}}}async function xf(e,t,n,i){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={from:t,to:n};i&&(s.agentId=i),await e.client.request("files.move",s),Xt(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await Zt(e,i)}catch(s){e.filesMessage={kind:"error",text:Oe(s)}}}}async function Jo(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const i=await e.client.request("memory.status",n);i!=null&&i.ok&&(e.filesMemoryStatus={dirty:i.dirty??!1,syncing:i.syncing,syncProgress:i.syncProgress,files:i.files??0,chunks:i.chunks??0,model:i.model,embeddingState:i.embeddingState})}catch{}}async function Af(e,t){if(!(!e.client||!e.connected)&&!e.filesReindexBusy){e.filesReindexBusy=!0,e.filesMessage=null;try{const n={force:!0};t&&(n.agentId=t);const i=await e.client.request("memory.reindex",n),s=(i==null?void 0:i.files)??0,o=(i==null?void 0:i.chunks)??0;Xt(e,`Re-indexed: ${s} files, ${o} chunks`),await Jo(e,t)}catch(n){e.filesMessage={kind:"error",text:Oe(n)}}finally{e.filesReindexBusy=!1}}}function Ef(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n,e.filesCurrentDir=t}async function Cf(e,t,n){if(!(!e.client||!e.connected)){if(!t.trim()){e.filesSearchResults=null;return}e.filesSearchLoading=!0,e.filesSearchResults=null;try{const i={query:t.trim(),maxResults:20};n&&(i.agentId=n);const s=await e.client.request("memory.search",i);e.filesSearchResults=(s==null?void 0:s.results)??[]}catch(i){e.filesMessage={kind:"error",text:Oe(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function Tf(e){e.filesSearchQuery="",e.filesSearchResults=null}function _f(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{Vo(e,{quiet:!0})},5e3))}function Mf(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function Yo(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Ht(e,{quiet:!0})},2e3))}function Xo(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function Zo(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||xn(e,{quiet:!0})},2e3))}function er(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function tr(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Uo(e)},3e3))}function nr(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Pf(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{id(e)},3e4))}function Lf(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function If(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{if(e.tab!=="files")return;const t=e;Jo(t,t.filesResolvedAgentId)},3e3))}function Rf(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function nt(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,Tp(n),t.theme!==e.theme&&(e.theme=t.theme,Xi(e,Qo(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function rd(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&nt(e,{...e.settings,lastActiveSessionKey:n})}function Df(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),o=t.get("gatewayUrl");let r=!1;if(n!=null){const d=n.trim();d&&d!==e.settings.token&&nt(e,{...e.settings,token:d}),t.delete("token"),r=!0}if(i!=null){const d=i.trim();d&&(e.password=d),t.delete("password"),r=!0}if(s!=null){const d=s.trim();d&&(e.sessionKey=d,nt(e,{...e.settings,sessionKey:d,lastActiveSessionKey:d}))}if(o!=null){const d=o.trim();d&&d!==e.settings.gatewayUrl&&nt(e,{...e.settings,gatewayUrl:d}),t.delete("gatewayUrl"),r=!0}if(!r)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function Nf(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Zo(e):Yo(e):(Xo(e),er(e)),t==="debug"?tr(e):nr(e),_i(e),ld(e,t,!1)}function Bf(e,t,n){ff({nextTheme:t,applyTheme:()=>{e.theme=t,nt(e,{...e.settings,theme:t}),Xi(e,Qo(t))},context:n,currentTheme:e.theme})}async function _i(e){if(e.tab==="overview"&&await cd(e),e.tab==="channels"&&await Hf(e),e.tab==="instances"&&await Dc(e),e.tab==="cron"&&await ir(e),e.tab==="skills"&&await Ge(e),e.tab==="nodes"&&(await Vo(e),await jo(e),await Fe(e),await af(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await Qf(e),Jt(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await uc(e),await Fe(e)),e.tab==="debug"&&(await Uo(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await re(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>nd);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await Ht(e,{reset:!0});cc(e,!0)}}function Ff(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Yi(e):uf(window.location.pathname)}function Of(e){e.theme=e.settings.theme??"system",Xi(e,Qo(e.theme))}function Xi(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Uf(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"&&Xi(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Wf(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 Kf(e,t){if(typeof window>"u")return;const n=td(window.location.pathname,e.basePath)??"chat";ad(e,n),ld(e,n,t)}function zf(e){var s;if(typeof window>"u")return;const t=td(window.location.pathname,e.basePath);if(!t)return;const i=(s=new URL(window.location.href).searchParams.get("session"))==null?void 0:s.trim();i&&(e.sessionKey=i,nt(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),ad(e,t)}function ad(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?Zo(e):Yo(e):(Xo(e),er(e)),t==="debug"?tr(e):nr(e),e.connected&&_i(e)}function ld(e,t,n){if(typeof window>"u")return;const i=Bn(df(t,e.basePath)),s=Bn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),s!==i&&(o.pathname=i),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}async function cd(e){await Promise.all([Y(e,!1),Dc(e),Bo(e),Yt(e),Uo(e)])}async function Hf(e){await Promise.all([Y(e,!0),uc(e),Fe(e)])}async function ir(e){await Promise.all([Y(e,!1),Yt(e),Fn(e)])}function dd(e){return e.chatSending||!!e.chatRunId}function qf(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"}async function ud(e){e.connected&&(e.chatMessage="",await ac(e))}function jf(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:Qi(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],Jt(e))}async function pd(e,t,n){var s,o;Fo(e);const i=await rc(e,t,n==null?void 0:n.attachments);return!i&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!i&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),i&&rd(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((o=n.previousAttachments)!=null&&o.length)&&(e.chatAttachments=n.previousAttachments),Jt(e),i&&!e.chatRunId&&hd(e),i}async function hd(e){if(!e.connected||dd(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await pd(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Vf(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Gf(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],a=r.length>0;if(!(!s&&!a)){if(qf(s)){await ud(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[],Mp(e.selectedWorkspace??"",e.sessionKey)),dd(e)){jf(e,s,r);return}await pd(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function Qf(e){var i;const t=e,n=Math.max((((i=t.chatMessages)==null?void 0:i.length)??0)+10,Be);await Promise.all([Ne(t,{limit:n}),Bo(t),po(e)]),Jt(e,!0)}const Jf=hd;function Yf(e){var s,o,r;const t=Xl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((r=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:r.trim())||"main"}function Xf(e,t){const n=Yi(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function po(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Yf(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Xf(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),o=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const L={messageSquare:u`<svg viewBox="0 0 24 24"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>`,barChart:u`<svg viewBox="0 0 24 24"><line x1="12" x2="12" y1="20" y2="10"/><line x1="18" x2="18" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="16"/></svg>`,link:u`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,unlink:u`<svg viewBox="0 0 24 24"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"/><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"/><line x1="8" x2="8" y1="2" y2="5"/><line x1="2" x2="5" y1="8" y2="8"/><line x1="16" x2="16" y1="19" y2="22"/><line x1="19" x2="22" y1="16" y2="16"/></svg>`,radio:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="2"/><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"/></svg>`,fileText:u`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>`,zap:u`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:u`<svg viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>`,settings:u`<svg viewBox="0 0 24 24"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,bug:u`<svg viewBox="0 0 24 24"><path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/></svg>`,scrollText:u`<svg viewBox="0 0 24 24"><path d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"/><path d="M19 17V5a2 2 0 0 0-2-2H4"/><path d="M15 8h-5"/><path d="M15 12h-5"/></svg>`,folder:u`<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,users:u`<svg viewBox="0 0 24 24"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>`,menu:u`<svg viewBox="0 0 24 24"><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/></svg>`,x:u`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:u`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:u`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,search:u`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:u`<svg viewBox="0 0 24 24"><path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/><path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/><path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/><path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/><path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/><path d="M3.477 10.896a4 4 0 0 1 .585-.396"/><path d="M19.938 10.5a4 4 0 0 1 .585.396"/><path d="M6 18a4 4 0 0 1-1.967-.516"/><path d="M19.967 17.484A4 4 0 0 1 18 18"/></svg>`,book:u`<svg viewBox="0 0 24 24"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/></svg>`,loader:u`<svg viewBox="0 0 24 24"><path d="M12 2v4"/><path d="m16.2 7.8 2.9-2.9"/><path d="M18 12h4"/><path d="m16.2 16.2 2.9 2.9"/><path d="M12 18v4"/><path d="m4.9 19.1 2.9-2.9"/><path d="M2 12h4"/><path d="m4.9 4.9 2.9 2.9"/></svg>`,rotateCw:u`<svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,download:u`<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>`,wrench:u`<svg viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,fileCode:u`<svg viewBox="0 0 24 24"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/></svg>`,edit:u`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,penLine:u`<svg viewBox="0 0 24 24"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>`,paperclip:u`<svg viewBox="0 0 24 24"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`,globe:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,globeOff:u`<svg viewBox="0 0 24 24"><path d="M21.54 15H17"/><path d="M7 3.34V5a3 3 0 0 0 3 3 2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,image:u`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,smartphone:u`<svg viewBox="0 0 24 24"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>`,plug:u`<svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M9 8V2"/><path d="M15 8V2"/><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z"/></svg>`,circle:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`,puzzle:u`<svg viewBox="0 0 24 24"><path d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"/></svg>`,info:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>`,send:u`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:u`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" y1="9" x2="9.01" y2="9"/><line x1="15" y1="9" x2="15.01" y2="9"/></svg>`,slidersHorizontal:u`<svg viewBox="0 0 24 24"><line x1="21" x2="14" y1="4" y2="4"/><line x1="10" x2="3" y1="4" y2="4"/><line x1="21" x2="12" y1="12" y2="12"/><line x1="8" x2="3" y1="12" y2="12"/><line x1="21" x2="16" y1="20" y2="20"/><line x1="12" x2="3" y1="20" y2="20"/><line x1="14" x2="14" y1="2" y2="6"/><line x1="8" x2="8" y1="10" y2="14"/><line x1="16" x2="16" y1="18" y2="22"/></svg>`,square:u`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:u`<svg viewBox="0 0 24 24"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`,eyeOff:u`<svg viewBox="0 0 24 24"><path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,trash:u`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,mic:u`<svg viewBox="0 0 24 24"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,chevronDown:u`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:u`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`,wifi:u`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.859a10 10 0 0 1 14 0"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/></svg>`,wifiOff:u`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/><path d="M5 12.859a10 10 0 0 1 5.17-2.69"/><path d="M13.41 10.28a10 10 0 0 1 5.59 2.58"/><path d="M2 8.82a15 15 0 0 1 4.17-2.65"/><path d="M10.66 5c4.01-.36 8.14.9 11.34 3.76"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`,power:u`<svg viewBox="0 0 24 24"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"/><line x1="12" x2="12" y1="2" y2="12"/></svg>`,powerOff:u`<svg viewBox="0 0 24 24"><path d="M18.36 6.64A9 9 0 0 1 20.77 15"/><path d="M6.16 6.16a9 9 0 1 0 12.68 12.68"/><path d="M12 2v4"/><path d="m2 2 20 20"/></svg>`},Zf=u`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`,eg=u`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>`;let ma=!1;function tg(){ma||(ma=!0,document.addEventListener("click",e=>{const t=document.getElementById("nav-burger-toggle");if(!(t!=null&&t.checked))return;const n=t.closest(".setup-header");n!=null&&n.contains(e.target)||(t.checked=!1)}))}function Mt(e,t){var l;const n=(p,f)=>p===e?u`<span class="sp-page-nav-current">${p}</span>`:u`<a href=${f}>${p}</a>`,i=u`
|
|
21
21
|
${n("Setup","/setup")}
|
|
22
22
|
${n("Chat","/chat")}
|
|
23
23
|
${n("Admins","/admins")}
|
|
@@ -25,10 +25,10 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
25
25
|
${n("Files","/files")}
|
|
26
26
|
${n("Browser","/browser")}
|
|
27
27
|
${n("Advanced","/advanced")}
|
|
28
|
-
`,o=t&&(t.isMaster!==!1||!t.hasPins)?
|
|
29
|
-
${
|
|
30
|
-
<span class="nav-audit-badge">${
|
|
31
|
-
</button>`:k,c=()=>{const p=document.getElementById("nav-burger-toggle");p&&(p.checked=!1)};return
|
|
28
|
+
`,o=t&&(t.isMaster!==!1||!t.hasPins)?ng(t):k,r=t!=null&&t.hasPins&&t.onLogout?u`<button class="nav-logout-btn" @click=${t.onLogout} title="Lock">${Zf}</button>`:k,a=(t==null?void 0:t.auditCount)??0,d=a>0&&(t!=null&&t.onAuditClick)?u`<button class="nav-audit-btn" @click=${t.onAuditClick} title="Memory writes to review">
|
|
29
|
+
${eg}
|
|
30
|
+
<span class="nav-audit-badge">${a>99?"99+":a}</span>
|
|
31
|
+
</button>`:k,c=()=>{const p=document.getElementById("nav-burger-toggle");p&&(p.checked=!1)};return tg(),u`
|
|
32
32
|
<div class="setup-header">
|
|
33
33
|
<input type="checkbox" id="nav-burger-toggle" class="nav-burger-checkbox" />
|
|
34
34
|
<div class="setup-header-inner">
|
|
@@ -39,7 +39,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
39
39
|
<div class="setup-header-right">
|
|
40
40
|
${o!==k?u`<span class="nav-selector-inline">${o}</span>`:k}
|
|
41
41
|
${d}
|
|
42
|
-
${
|
|
42
|
+
${r}
|
|
43
43
|
<label for="nav-burger-toggle" class="nav-burger-button" aria-label="Toggle menu">
|
|
44
44
|
<span class="nav-burger-icon"></span>
|
|
45
45
|
</label>
|
|
@@ -50,11 +50,11 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
50
50
|
${i}
|
|
51
51
|
</nav>
|
|
52
52
|
</div>
|
|
53
|
-
`}function
|
|
53
|
+
`}function ng(e){const{workspaces:t,selectedWorkspace:n,onWorkspaceSelect:i}=e;return u`
|
|
54
54
|
<select
|
|
55
55
|
class="sp-workspace-selector"
|
|
56
56
|
.value=${n??""}
|
|
57
|
-
@change=${o=>{const
|
|
57
|
+
@change=${o=>{const r=o.target,a=r.value;if(a==="__add__"){r.value=n??"",e.onAddAccount?e.onAddAccount():window.location.href="/setup";return}i(a)}}
|
|
58
58
|
>
|
|
59
59
|
${t.map(o=>u`
|
|
60
60
|
<option value=${o.name} ?selected=${o.name===n}>
|
|
@@ -64,7 +64,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
64
64
|
<option disabled>───</option>
|
|
65
65
|
<option value="__add__">+ Add Account</option>
|
|
66
66
|
</select>
|
|
67
|
-
`}function
|
|
67
|
+
`}function ig(e){return e.connected?e.fullscreen&&e.active?u`
|
|
68
68
|
<div class="sp-fullscreen-overlay">
|
|
69
69
|
<div class="sp-fullscreen-toolbar">
|
|
70
70
|
<button
|
|
@@ -196,14 +196,14 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
196
196
|
<p>Connecting to gateway...</p>
|
|
197
197
|
</div>
|
|
198
198
|
</div>
|
|
199
|
-
`}const Mi="application/x-taskmaster-file-path";let pt=null;function fd(e){return e==null?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function gd(e){const t=e.split("/");return t.length>1?t.slice(0,-1).join("/"):"."}function
|
|
199
|
+
`}const Mi="application/x-taskmaster-file-path";let pt=null;function fd(e){return e==null?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function gd(e){const t=e.split("/");return t.length>1?t.slice(0,-1).join("/"):"."}function sg(e,t,n){var o,r;e.preventDefault(),e.stopPropagation(),e.currentTarget.classList.remove("sp-drop-target");const i=(o=e.dataTransfer)==null?void 0:o.getData(Mi);if(i){gd(i)!==t&&n.onMoveToDir(i,t);return}const s=(r=e.dataTransfer)==null?void 0:r.files;if(s&&s.length>0){const a=Array.from(s).filter(d=>d.name.toLowerCase().endsWith(".md"));a.length>0&&n.onUpload(t,a)}}function md(e,t,n){var d;const i=e.type==="directory"||e.type==="symlink"&&e.children!=null,s=t.expandedDirs.has(e.path),o=t.selectedPaths.has(e.path),r=t.currentDir===e.path,a=n*20+12;return i?u`
|
|
200
200
|
<div
|
|
201
|
-
class="sp-tree-item sp-tree-dir ${s?"expanded":""} ${
|
|
202
|
-
style="padding-left: ${
|
|
201
|
+
class="sp-tree-item sp-tree-dir ${s?"expanded":""} ${r?"current":""}"
|
|
202
|
+
style="padding-left: ${a}px;"
|
|
203
203
|
@click=${()=>t.onToggleDir(e.path)}
|
|
204
204
|
@dragover=${c=>{c.preventDefault(),c.stopPropagation(),c.dataTransfer&&(c.dataTransfer.dropEffect="move"),c.currentTarget.classList.add("sp-drop-target")}}
|
|
205
205
|
@dragleave=${c=>{c.currentTarget.classList.remove("sp-drop-target")}}
|
|
206
|
-
@drop=${c=>
|
|
206
|
+
@drop=${c=>sg(c,e.path,t)}
|
|
207
207
|
>
|
|
208
208
|
<span class="sp-tree-chevron">${s?"−":"+"}</span>
|
|
209
209
|
<span class="sp-tree-icon">${L.folder}</span>
|
|
@@ -218,7 +218,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
218
218
|
`:u`
|
|
219
219
|
<div
|
|
220
220
|
class="sp-tree-item sp-tree-file ${o?"selected":""}"
|
|
221
|
-
style="padding-left: ${
|
|
221
|
+
style="padding-left: ${a}px;"
|
|
222
222
|
draggable="true"
|
|
223
223
|
@click=${c=>{c.metaKey||c.ctrlKey?t.onToggleSelectFile(e.path):t.onSelectFile(e.path)}}
|
|
224
224
|
@dragstart=${c=>{c.dataTransfer&&(c.dataTransfer.effectAllowed="move",c.dataTransfer.setData(Mi,e.path),c.dataTransfer.setData("text/plain",e.name))}}
|
|
@@ -227,7 +227,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
227
227
|
<span class="sp-tree-name">${e.name}</span>
|
|
228
228
|
<span class="sp-tree-size">${fd(e.size)}</span>
|
|
229
229
|
</div>
|
|
230
|
-
`}function
|
|
230
|
+
`}function og(e){const t=e.selectedPaths.size;return t<2?k:u`
|
|
231
231
|
<div class="sp-bulk-actions">
|
|
232
232
|
<span style="color: var(--tasker-muted-grey); font-size: 13px;">${t} files selected</span>
|
|
233
233
|
<button
|
|
@@ -238,7 +238,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
238
238
|
Download ${t} files
|
|
239
239
|
</button>
|
|
240
240
|
</div>
|
|
241
|
-
`}function
|
|
241
|
+
`}function rg(e){if(e.selectedPaths.size!==1||!e.selectedPath)return k;if(e.previewLoading)return u`
|
|
242
242
|
<div class="sp-file-preview">
|
|
243
243
|
<div class="setup-spinner" style="width: 32px; height: 32px; margin: 24px auto;"></div>
|
|
244
244
|
</div>
|
|
@@ -294,7 +294,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
294
294
|
Clear
|
|
295
295
|
</button>`:k}
|
|
296
296
|
</div>
|
|
297
|
-
`}function
|
|
297
|
+
`}function lg(e){return e.searchResults?e.searchResults.length===0?u`<div class="sp-search-results">
|
|
298
298
|
<div style="padding: 24px; color: var(--tasker-muted-grey); text-align: center;">No results found.</div>
|
|
299
299
|
</div>`:u`
|
|
300
300
|
<div class="sp-search-results">
|
|
@@ -314,7 +314,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
314
314
|
</div>
|
|
315
315
|
`)}
|
|
316
316
|
</div>
|
|
317
|
-
`:k}function
|
|
317
|
+
`:k}function cg(e){const t=e.currentDir;return e.connected?u`
|
|
318
318
|
<div class="setup-container">
|
|
319
319
|
${Mt("Files",e.wsProps)}
|
|
320
320
|
<div class="setup-card sp-card-wide">
|
|
@@ -366,7 +366,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
366
366
|
class="setup-status-light"
|
|
367
367
|
style="width: 10px; height: 10px; background: ${e.memoryStatus.syncing?"#f59e0b":e.memoryStatus.dirty?"#ef4444":"#22c55e"}"
|
|
368
368
|
></span>
|
|
369
|
-
${(()=>{var d;if(e.memoryStatus.syncing&&e.memoryStatus.syncProgress){const{completed:c,total:l,label:p}=e.memoryStatus.syncProgress;return p||(l>0?`Indexing ${c}/${l} files…`:"Indexing…")}const n=e.memoryStatus.files,i=e.memoryStatus.chunks,s=`${n} file${n!==1?"s":""}, ${i} chunks`,o=(d=e.memoryStatus)==null?void 0:d.model;if(!o)return s;const
|
|
369
|
+
${(()=>{var d;if(e.memoryStatus.syncing&&e.memoryStatus.syncProgress){const{completed:c,total:l,label:p}=e.memoryStatus.syncProgress;return p||(l>0?`Indexing ${c}/${l} files…`:"Indexing…")}const n=e.memoryStatus.files,i=e.memoryStatus.chunks,s=`${n} file${n!==1?"s":""}, ${i} chunks`,o=(d=e.memoryStatus)==null?void 0:d.model;if(!o)return s;const a=(o.includes("/")?o.split("/").pop():o).replace(/[-_]Q\d.*$/i,"").replace(/\.gguf$/i,"");return`${s} · ${a}`})()}
|
|
370
370
|
</span>`:k}
|
|
371
371
|
</div>
|
|
372
372
|
|
|
@@ -380,16 +380,16 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
380
380
|
|
|
381
381
|
${ag(e)}
|
|
382
382
|
|
|
383
|
-
${e.searchResults!==null?
|
|
383
|
+
${e.searchResults!==null?lg(e):u`<div
|
|
384
384
|
class="sp-file-tree"
|
|
385
385
|
@dragover=${n=>{n.preventDefault(),n.dataTransfer&&(n.dataTransfer.dropEffect=n.dataTransfer.types.includes(Mi)?"move":"copy")}}
|
|
386
|
-
@drop=${n=>{var o,
|
|
386
|
+
@drop=${n=>{var o,r;n.preventDefault();const i=(o=n.dataTransfer)==null?void 0:o.getData(Mi);if(i){gd(i)!=="."&&e.onMoveToDir(i,".");return}const s=(r=n.dataTransfer)==null?void 0:r.files;if(s&&s.length>0){const a=Array.from(s).filter(d=>d.name.toLowerCase().endsWith(".md"));a.length>0&&e.onUpload(t,a)}}}
|
|
387
387
|
>
|
|
388
388
|
${e.tree.length===0&&!e.loading?u`<div style="padding: 24px; color: var(--tasker-muted-grey); text-align: center;">No files found. Drop .md files here to upload.</div>`:e.tree.map(n=>md(n,e,0))}
|
|
389
389
|
</div>`}
|
|
390
390
|
|
|
391
|
-
${sg(e)}
|
|
392
391
|
${og(e)}
|
|
392
|
+
${rg(e)}
|
|
393
393
|
</div>
|
|
394
394
|
</div>
|
|
395
395
|
`:u`
|
|
@@ -399,12 +399,12 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
399
399
|
<p>Connecting to gateway...</p>
|
|
400
400
|
</div>
|
|
401
401
|
</div>
|
|
402
|
-
`}const
|
|
402
|
+
`}const sr="taskmaster_uninstall_done";async function dg(e){var t,n;if(!(!e.client||!e.connected)&&!e.uninstallBusy){e.uninstallBusy=!0,e.uninstallError=null,(t=e.requestUpdate)==null||t.call(e),ug();try{await e.client.request("system.uninstall",{scopes:["service","state","workspace"],purge:!0})}catch{}e.uninstallBusy=!1,e.uninstallDone=!0,(n=e.requestUpdate)==null||n.call(e)}}function Pi(){try{return localStorage.getItem(sr)==="1"}catch{return!1}}function or(){try{localStorage.removeItem(sr)}catch{}}function ug(){try{localStorage.setItem(sr,"1")}catch{}}const ya=Object.freeze(Object.defineProperty({__proto__:null,checkUninstallDone:Pi,clearUninstallDone:or,runUninstall:dg},Symbol.toStringTag,{value:"Module"}));function j(e){return u`
|
|
403
403
|
<span
|
|
404
404
|
class="setup-status-light"
|
|
405
405
|
style="background: ${{good:"#22c55e",bad:"#ef4444",partial:"#eab308",unknown:"#6b7280"}[e]}"
|
|
406
406
|
></span>
|
|
407
|
-
`}function
|
|
407
|
+
`}function de(e,t){return u`
|
|
408
408
|
<button
|
|
409
409
|
class="setup-info-btn"
|
|
410
410
|
@click=${()=>t.onInfoModalOpen(e)}
|
|
@@ -412,7 +412,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
412
412
|
>
|
|
413
413
|
${L.info}
|
|
414
414
|
</button>
|
|
415
|
-
`}function
|
|
415
|
+
`}function pg(e){var i;if(!e.infoModalOpen)return k;let t="",n=[];switch(e.infoModalOpen){case"gateway":{const s=typeof window<"u"?window.location.host:"unknown";t="Gateway",n=[{label:"Status",value:e.gatewayHealthy===!1?"Stopped":"Running"},{label:"Address",value:s},{label:"Health",value:e.gatewayHealthMessage||"OK"}];break}case"claude":{const s=e.authExpiresIn;let o="N/A";if(s!=null&&s>0)if(s>60){const r=Math.floor(s/60),a=s%60;o=a>0?`${r}h ${a}m`:`${r}h`}else o=`${s}m`;t="Claude",n=[{label:"Connected",value:e.authConnected?"Yes":"No"},{label:"Token Expiry",value:o},{label:"Renewal",value:"Automatic (tokens refresh on expiry)"},...e.authMessage?[{label:"Message",value:e.authMessage}]:[]];break}case"license":{const s=e.licenseStoredKey?`…${e.licenseStoredKey.slice(-12)}`:"N/A";t="License",n=[{label:"Status",value:e.licenseValid?"Active":"Inactive"},{label:"Key",value:s},{label:"Tier",value:e.licenseTier||"Standard"},{label:"Device ID",value:e.licenseDeviceId||"N/A"}];break}case"whatsapp":{const s=en(e),o=s?rr(s,e):null;t="WhatsApp",n=[{label:"Account",value:(o==null?void 0:o.name)||(o==null?void 0:o.accountId)||"Default"},{label:"Phone",value:((i=o==null?void 0:o.self)==null?void 0:i.e164)||"Not paired"},{label:"Connected",value:o!=null&&o.connected?"Yes":"No"},{label:"Linked",value:o!=null&&o.linked?"Yes":"No"},...o!=null&&o.lastError?[{label:"Last Error",value:ar(o.lastError)}]:[]];break}case"imessage":{const{thisWsOwns:s}=lr(e);t="iMessage",n=[{label:"Connected",value:s&&e.imessageConnected?"Yes":"No"},{label:"Assigned To",value:e.imessageOwnerWorkspace??"Not assigned"},{label:"Mode",value:"Self-chat only"},...e.imessageLastError?[{label:"Last Error",value:e.imessageLastError}]:[]];break}case"update":{t="Software Update",n=[{label:"Current",value:e.currentVersion?`v${e.currentVersion}`:"Unknown"},{label:"Latest",value:e.latestVersion?`v${e.latestVersion}`:"Unknown"},{label:"Status",value:e.updateAvailable===null?"Not checked":e.updateAvailable?"Update available":"Up to date"},...e.updateMessage?[{label:"Message",value:e.updateMessage}]:[]];break}case"remote-access":{const s=e.tailscaleStatus,o=s?s.installed?s.loggedIn?s.serveEnabled&&s.serveActive?"Active":s.serveEnabled&&!s.serveActive?"Enabled but not active":"Off":"Not connected":"Not installed":"Checking...";t="Remote Access",n=[{label:"Status",value:o},{label:"What",value:"Access this control panel from anywhere — your phone, another computer, or while away from home"},{label:"How",value:"Uses Tailscale to create a private, encrypted connection with a trusted HTTPS certificate (no browser warnings)"},{label:"Requires",value:"Tailscale installed on this device and on any device you want to access the control panel from, all logged into the same Tailscale account"},{label:"Internet Access",value:"Enable internet access (globe icon) to make Public Chat reachable from the web"},{label:"Cost",value:"Tailscale is free for personal use (up to 100 devices)"},...s!=null&&s.tailnetUrl?[{label:"URL",value:`${s.tailnetUrl} — bookmark this on your other devices`}]:[]];break}case"public-chat":{t="Public Chat",n=[{label:"Status",value:e.publicChatEnabled?"Enabled":"Disabled"},{label:"What",value:"A chat widget anyone can use to message your business from a web browser"},{label:"Requires",value:"Remote Access with internet access enabled — this gives your device a public URL that visitors can reach"},{label:"Access mode",value:wg[e.publicChatAuthMode]??"Open access"},{label:"Open access",value:"Anyone can chat without identifying themselves"},{label:"WhatsApp OTP",value:"Visitors verify their phone number before chatting"},{label:"Visitor chooses",value:"Visitors can chat anonymously or verify via WhatsApp"}];break}case"account-pin":{t="Account PIN",n=[{label:"Status",value:e.accountHasPin?"Set":"Not set"},{label:"What",value:"A numeric PIN that protects this account on the control panel"},{label:"When needed",value:"Required when switching to this account or after the session expires"},{label:"Format",value:"4 to 6 digits"}];break}case"branding":{const s=!!(e.brandAccentColor||e.brandBackgroundColor||e.brandHasLogo);t="Branding",n=[{label:"Status",value:s?"Customised":"Default"},{label:"What",value:"Your business logo and colour scheme, displayed on the control panel and public chat pages"},{label:"Logo",value:"Shown on public chat pages alongside your business name"},{label:"Accent colour",value:"Used for buttons, links, and interactive elements"},{label:"Background tint",value:"A subtle colour wash applied to page and card backgrounds"},{label:"Scope",value:"Each account has its own branding — switch accounts to customise each one separately"}];break}case"network":{t="Network",n=[{label:"Address",value:e.networkHostname?`${e.networkHostname}.local:${e.networkPort}`:`Port ${e.networkPort}`},{label:"What",value:"The hostname and port this device uses on your local network"},{label:"When to change",value:"If you have multiple devices on the same network, give each a unique hostname and port so they don't conflict"},{label:"After saving",value:"The gateway restarts and your browser redirects to the new address"}];break}default:return k}return u`
|
|
416
416
|
<div class="setup-info-overlay" @click=${s=>{s.target.classList.contains("setup-info-overlay")&&e.onInfoModalClose()}}>
|
|
417
417
|
<div class="setup-info-card">
|
|
418
418
|
<h3>${t}</h3>
|
|
@@ -433,21 +433,21 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
433
433
|
</div>
|
|
434
434
|
`}function Ae(e){const t=[{id:"license",label:"1. Activate License"},{id:"auth",label:"2. Connect Claude"},{id:"whatsapp",label:"3. Link WhatsApp"}],n=["license","auth","whatsapp","complete"],i=n.indexOf(e);return u`
|
|
435
435
|
<div class="setup-steps">
|
|
436
|
-
${t.map(s=>{const o=n.indexOf(s.id),
|
|
436
|
+
${t.map(s=>{const o=n.indexOf(s.id),r=e===s.id,a=i>o;return u`
|
|
437
437
|
<div
|
|
438
|
-
class="setup-step ${
|
|
438
|
+
class="setup-step ${r?"active":""} ${a?"completed":""}"
|
|
439
439
|
>
|
|
440
440
|
<span class="setup-step-dot"></span>
|
|
441
441
|
<span class="setup-step-label">${s.label}</span>
|
|
442
442
|
</div>
|
|
443
443
|
`})}
|
|
444
444
|
</div>
|
|
445
|
-
`}function
|
|
445
|
+
`}function va(e){const{licenseKey:t,licenseBusy:n,licenseValid:i,licenseMessage:s,licenseDeviceId:o,onLicenseKeyChange:r,onLicenseActivate:a}=e;return i===!0?u`
|
|
446
446
|
<div class="setup-container">
|
|
447
447
|
<div class="setup-card setup-success">
|
|
448
448
|
${Ae("license")}
|
|
449
449
|
<div class="setup-status-row">
|
|
450
|
-
${
|
|
450
|
+
${j("good")}
|
|
451
451
|
<span>License Activated</span>
|
|
452
452
|
</div>
|
|
453
453
|
<p>${s??"Your license is active."}</p>
|
|
@@ -486,20 +486,20 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
486
486
|
type="text"
|
|
487
487
|
placeholder="Paste your license key here"
|
|
488
488
|
.value=${t}
|
|
489
|
-
@input=${d=>
|
|
490
|
-
@keydown=${d=>{d.key==="Enter"&&t.trim()&&
|
|
489
|
+
@input=${d=>r(d.target.value)}
|
|
490
|
+
@keydown=${d=>{d.key==="Enter"&&t.trim()&&a()}}
|
|
491
491
|
/>
|
|
492
492
|
<button
|
|
493
493
|
class="setup-button"
|
|
494
494
|
?disabled=${!t.trim()||n}
|
|
495
|
-
@click=${
|
|
495
|
+
@click=${a}
|
|
496
496
|
>
|
|
497
497
|
${n?"Activating...":"Activate"}
|
|
498
498
|
</button>
|
|
499
499
|
</div>
|
|
500
500
|
${i===!1&&s?u`
|
|
501
501
|
<div class="setup-status-row" style="margin-top: 12px;">
|
|
502
|
-
${
|
|
502
|
+
${j("bad")}
|
|
503
503
|
<span class="setup-error">${s}</span>
|
|
504
504
|
</div>
|
|
505
505
|
`:k}
|
|
@@ -511,18 +511,18 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
511
511
|
</p>
|
|
512
512
|
</div>
|
|
513
513
|
</div>
|
|
514
|
-
`}function
|
|
514
|
+
`}function hg(e){const{authConnected:t,authBusy:n,authMessage:i,authUrl:s,authCodeInput:o,authExpiresIn:r,onStartAuth:a,onSubmitAuthCode:d,onAuthCodeChange:c,onSkipToWhatsApp:l}=e;return t===!0?u`
|
|
515
515
|
<div class="setup-container">
|
|
516
516
|
<div class="setup-card setup-success">
|
|
517
517
|
${Ae("auth")}
|
|
518
518
|
<div class="setup-status-row">
|
|
519
|
-
${
|
|
519
|
+
${j("good")}
|
|
520
520
|
<span>Claude Connected</span>
|
|
521
521
|
</div>
|
|
522
522
|
<p>
|
|
523
523
|
Your Claude Pro subscription is linked.
|
|
524
|
-
${
|
|
525
|
-
>Expires in ${
|
|
524
|
+
${r?u`<br /><span class="setup-hint"
|
|
525
|
+
>Expires in ${r} minutes</span
|
|
526
526
|
>`:k}
|
|
527
527
|
</p>
|
|
528
528
|
<p style="color: var(--tasker-text-grey); font-size: 14px;">
|
|
@@ -627,7 +627,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
627
627
|
First, let's connect your Claude Pro subscription.<br />
|
|
628
628
|
This powers your AI assistant.
|
|
629
629
|
</p>`}
|
|
630
|
-
<button class="setup-button primary" @click=${
|
|
630
|
+
<button class="setup-button primary" @click=${a}>
|
|
631
631
|
Connect to Claude →
|
|
632
632
|
</button>
|
|
633
633
|
<p class="setup-hint" style="margin-top: 8px;">
|
|
@@ -643,7 +643,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
643
643
|
</p>
|
|
644
644
|
</div>
|
|
645
645
|
</div>
|
|
646
|
-
`}function
|
|
646
|
+
`}function rr(e,t){const n=new Map(t.whatsappAccounts.map(i=>[i.accountId,i]));return e.whatsappAccountId?n.get(e.whatsappAccountId)??null:e.isDefault&&t.whatsappAccounts.length===1?t.whatsappAccounts[0]??null:null}function en(e){var n;const t=(n=e.wsProps)==null?void 0:n.selectedWorkspace;return t?e.workspaces.find(i=>i.name===t)??null:e.workspaces[0]??null}function ba(e){const t=en(e),n=(t==null?void 0:t.displayName)??(t==null?void 0:t.name)??Ve().name,i=e.whatsappBusy||e.gatewayHealthLoading;if(e.renamingWorkspace&&t){const s=()=>{const o=e.renameWorkspaceName.trim();o&&e.onWorkspaceRename(t.name,o)};return u`
|
|
647
647
|
<div style="display: flex; align-items: center; gap: 6px; margin-bottom: 4px;">
|
|
648
648
|
<input
|
|
649
649
|
type="text"
|
|
@@ -685,14 +685,14 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
685
685
|
${L.rotateCw}
|
|
686
686
|
</button>
|
|
687
687
|
</div>
|
|
688
|
-
`}function
|
|
688
|
+
`}function wa(e){return u`
|
|
689
689
|
<div class="setup-status-item">
|
|
690
|
-
${
|
|
690
|
+
${j(e.gatewayHealthy===!1?"bad":"good")}
|
|
691
691
|
<div class="setup-status-info">
|
|
692
692
|
<strong>Gateway</strong>
|
|
693
693
|
<span>${e.gatewayHealthMessage||"Running"}</span>
|
|
694
694
|
</div>
|
|
695
|
-
${
|
|
695
|
+
${de("gateway",e)}
|
|
696
696
|
<button
|
|
697
697
|
class="setup-status-action ${e.gatewayRestartBusy?"spinning":""}"
|
|
698
698
|
?disabled=${e.gatewayRestartBusy}
|
|
@@ -702,16 +702,16 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
702
702
|
${L.rotateCw}
|
|
703
703
|
</button>
|
|
704
704
|
</div>
|
|
705
|
-
`}function
|
|
705
|
+
`}function ka(e){const t=e.authConnected===!0;return u`
|
|
706
706
|
<div class="setup-status-item">
|
|
707
|
-
${
|
|
707
|
+
${j(t?"good":"bad")}
|
|
708
708
|
<div class="setup-status-info">
|
|
709
709
|
<strong>Claude</strong>
|
|
710
710
|
<span>
|
|
711
711
|
${t?"Connected":"Not connected"}${t&&e.authExpiresIn?u` <span style="color: var(--tasker-text-grey); font-size: 12px;">(${e.authExpiresIn>60?`${Math.floor(e.authExpiresIn/60)}h ${e.authExpiresIn%60}m`:`${e.authExpiresIn}m`})</span>`:k}
|
|
712
712
|
</span>
|
|
713
713
|
</div>
|
|
714
|
-
${
|
|
714
|
+
${de("claude",e)}
|
|
715
715
|
${t?u`
|
|
716
716
|
<button
|
|
717
717
|
class="setup-status-action ${e.authBusy?"spinning":""}"
|
|
@@ -731,14 +731,14 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
731
731
|
</button>
|
|
732
732
|
`}
|
|
733
733
|
</div>
|
|
734
|
-
`}function $
|
|
734
|
+
`}function $a(e){return u`
|
|
735
735
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
736
|
-
${
|
|
736
|
+
${j("good")}
|
|
737
737
|
<div class="setup-status-info">
|
|
738
738
|
<strong>License</strong>
|
|
739
739
|
<span>Active</span>
|
|
740
740
|
</div>
|
|
741
|
-
${
|
|
741
|
+
${de("license",e)}
|
|
742
742
|
<button
|
|
743
743
|
class="setup-status-action"
|
|
744
744
|
@click=${()=>{e.licenseRemoveConfirm?e.onLicenseRemoveCancel():e.onLicenseRemoveConfirm()}}
|
|
@@ -771,12 +771,12 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
771
771
|
</div>
|
|
772
772
|
`:k}
|
|
773
773
|
</div>
|
|
774
|
-
`}function
|
|
774
|
+
`}function ar(e){var t,n;try{const i=JSON.parse(e),s=(i==null?void 0:i.error)??i,o=((n=(t=s==null?void 0:s.output)==null?void 0:t.payload)==null?void 0:n.message)??(s==null?void 0:s.message)??(i==null?void 0:i.message);if(o&&typeof o=="string")return o}catch{}return e.length>80?e.slice(0,77)+"…":e}function Sa(e){var p;const t=en(e);if(!t)return k;const n=rr(t,e),i=(n==null?void 0:n.running)&&(n==null?void 0:n.connected),s=(n==null?void 0:n.linked)&&!i,o=!!n,r=i?"good":s?"partial":o?"bad":"unknown",a=i?"Connected":s?"Linked, not connected":o?n!=null&&n.lastError?ar(n.lastError):"Not connected":"Not paired",d=!(n!=null&&n.provider)||(n==null?void 0:n.provider)==="baileys",c=t.whatsappAccountId??(t.isDefault&&e.whatsappAccounts.length===1?(p=e.whatsappAccounts[0])==null?void 0:p.accountId:void 0),l=c!=null&&e.whatsappActiveQrAccountId===c;return u`
|
|
775
775
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
776
|
-
${
|
|
776
|
+
${j(r)}
|
|
777
777
|
<div class="setup-status-info">
|
|
778
778
|
<strong>WhatsApp</strong>
|
|
779
|
-
<span>${
|
|
779
|
+
<span>${a}</span>
|
|
780
780
|
</div>
|
|
781
781
|
${o?u`<button
|
|
782
782
|
class="setup-info-btn"
|
|
@@ -801,16 +801,16 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
801
801
|
</div>
|
|
802
802
|
`:k}
|
|
803
803
|
</div>
|
|
804
|
-
`}const
|
|
805
|
-
<div class="setup-info-overlay" @click=${
|
|
804
|
+
`}const fg=[{id:"claude-opus-4-6",shortName:"Opus"},{id:"claude-sonnet-4-5-20250929",shortName:"Sonnet"},{id:"claude-haiku-4-5-20251001",shortName:"Haiku"}],gg="anthropic/claude-sonnet-4-5-20250929",mg=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function yg(e){var h,b;if(!e.whatsappSettingsOpen)return k;const t=en(e);if(!t)return k;const n=rr(t,e);if(!n)return k;const i=n.running&&n.connected,s=!n.provider||n.provider==="baileys",o=t.whatsappAccountId??(t.isDefault&&e.whatsappAccounts.length===1?(h=e.whatsappAccounts[0])==null?void 0:h.accountId:void 0),r=()=>e.onWhatsAppSettingsClose(),a=e.whatsappModelCatalog??[],d=new Set(a.filter(w=>w.provider==="anthropic").map(w=>w.id)),c=fg.filter(w=>d.has(w.id)),l=e.whatsappModel??gg,p=e.whatsappThinkingLevel??"off",f="display: flex; justify-content: space-between; font-size: 13px;",v="color: var(--tasker-text-grey);",S="color: var(--tasker-white); text-align: right;";return u`
|
|
805
|
+
<div class="setup-info-overlay" @click=${w=>{w.target.classList.contains("setup-info-overlay")&&r()}}>
|
|
806
806
|
<div class="setup-info-card" style="max-width: 360px;">
|
|
807
807
|
<h3>WhatsApp</h3>
|
|
808
808
|
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 12px;">
|
|
809
|
-
<div style="${
|
|
810
|
-
<div style="${
|
|
811
|
-
<div style="${
|
|
812
|
-
<div style="${
|
|
813
|
-
${n.lastError?u`<div style="${
|
|
809
|
+
<div style="${f}"><span style="${v}">Account</span><span style="${S}">${n.name||n.accountId||"Default"}</span></div>
|
|
810
|
+
<div style="${f}"><span style="${v}">Phone</span><span style="${S}">${((b=n.self)==null?void 0:b.e164)||"Not paired"}</span></div>
|
|
811
|
+
<div style="${f}"><span style="${v}">Connected</span><span style="${S}">${i?"Yes":"No"}</span></div>
|
|
812
|
+
<div style="${f}"><span style="${v}">Linked</span><span style="${S}">${n.linked?"Yes":"No"}</span></div>
|
|
813
|
+
${n.lastError?u`<div style="${f}"><span style="${v}">Error</span><span style="${S}; color: #ef4444;">${ar(n.lastError)}</span></div>`:k}
|
|
814
814
|
</div>
|
|
815
815
|
${s&&o?u`
|
|
816
816
|
<div style="border-top: 1px solid rgba(255,255,255,0.08); margin: 16px 0 12px;"></div>
|
|
@@ -818,12 +818,12 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
818
818
|
class="setup-button secondary"
|
|
819
819
|
style="width: 100%; padding: 10px;"
|
|
820
820
|
?disabled=${e.whatsappBusy}
|
|
821
|
-
@click=${()=>{e.onWhatsAppUnlink(o),
|
|
821
|
+
@click=${()=>{e.onWhatsAppUnlink(o),r()}}
|
|
822
822
|
>Unlink WhatsApp</button>`:u`<button
|
|
823
823
|
class="setup-button secondary"
|
|
824
824
|
style="width: 100%; padding: 10px;"
|
|
825
825
|
?disabled=${e.whatsappBusy}
|
|
826
|
-
@click=${()=>{e.onWhatsAppRelink(o),
|
|
826
|
+
@click=${()=>{e.onWhatsAppRelink(o),r()}}
|
|
827
827
|
>Link WhatsApp</button>`}
|
|
828
828
|
`:k}
|
|
829
829
|
${i?u`
|
|
@@ -892,11 +892,11 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
892
892
|
class="setup-model-select"
|
|
893
893
|
style="flex: 1;"
|
|
894
894
|
.value=${l}
|
|
895
|
-
@change=${
|
|
895
|
+
@change=${w=>{e.onWhatsAppModelChange(w.target.value)}}
|
|
896
896
|
>
|
|
897
|
-
${c.map(
|
|
898
|
-
<option value=${"anthropic/"+
|
|
899
|
-
${
|
|
897
|
+
${c.map(w=>u`
|
|
898
|
+
<option value=${"anthropic/"+w.id} ?selected=${l==="anthropic/"+w.id}>
|
|
899
|
+
${w.shortName}
|
|
900
900
|
</option>
|
|
901
901
|
`)}
|
|
902
902
|
</select>
|
|
@@ -908,11 +908,11 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
908
908
|
class="setup-model-select"
|
|
909
909
|
style="flex: 1;"
|
|
910
910
|
.value=${p}
|
|
911
|
-
@change=${
|
|
911
|
+
@change=${w=>{e.onWhatsAppThinkingChange(w.target.value)}}
|
|
912
912
|
>
|
|
913
|
-
${
|
|
914
|
-
<option value=${
|
|
915
|
-
${
|
|
913
|
+
${mg.map(w=>u`
|
|
914
|
+
<option value=${w.value} ?selected=${p===w.value}>
|
|
915
|
+
${w.label}
|
|
916
916
|
</option>
|
|
917
917
|
`)}
|
|
918
918
|
</select>
|
|
@@ -922,20 +922,20 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
922
922
|
<button
|
|
923
923
|
class="setup-button secondary"
|
|
924
924
|
style="margin-top: 20px; width: 100%; padding: 10px;"
|
|
925
|
-
@click=${
|
|
925
|
+
@click=${r}
|
|
926
926
|
>
|
|
927
927
|
Close
|
|
928
928
|
</button>
|
|
929
929
|
</div>
|
|
930
930
|
</div>
|
|
931
|
-
`}function
|
|
931
|
+
`}function lr(e){const t=en(e),n=e.imessageOwnerWorkspace,i=!!(t&&n===t.name),s=!!(n&&t&&n!==t.name);return{selectedWs:t,ownerWs:n,thisWsOwns:i,anotherWsOwns:s}}function xa(e){const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=lr(e);let s,o;return i?(s="partial",o=`Connected to ${t}`):n&&e.imessageConnected?(s="good",o="Connected"):n&&e.imessageRunning?(s="partial",o="Running, not connected"):n?(s="bad",o="Not running"):e.imessageConfigured?(s="unknown",o="Not connected"):(s="bad",o="Not configured"),u`
|
|
932
932
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
933
|
-
${
|
|
933
|
+
${j(s)}
|
|
934
934
|
<div class="setup-status-info">
|
|
935
935
|
<strong>iMessage</strong>
|
|
936
936
|
<span>${o}</span>
|
|
937
937
|
</div>
|
|
938
|
-
${
|
|
938
|
+
${de("imessage",e)}
|
|
939
939
|
<button
|
|
940
940
|
class="setup-status-action ${e.imessageEnabling?"spinning":""}"
|
|
941
941
|
?disabled=${e.imessageEnabling}
|
|
@@ -946,7 +946,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
946
946
|
</button>
|
|
947
947
|
${k}
|
|
948
948
|
</div>
|
|
949
|
-
`}function
|
|
949
|
+
`}function vg(e){if(!e.imessageEnableConfirm)return k;const{ownerWs:t,thisWsOwns:n,anotherWsOwns:i}=lr(e),s=()=>{e.onIMessageEnableCancel()};return n?u`
|
|
950
950
|
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&s()}}>
|
|
951
951
|
<div class="setup-info-card" style="text-align: center;">
|
|
952
952
|
<h3>iMessage</h3>
|
|
@@ -1022,10 +1022,10 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1022
1022
|
</button>
|
|
1023
1023
|
</div>
|
|
1024
1024
|
</div>
|
|
1025
|
-
`}function
|
|
1025
|
+
`}function Aa(e){if(!e.isMaster)return k;const n=e.apiKeyProviders.filter(i=>i.hasKey).length;return u`
|
|
1026
1026
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1027
1027
|
<div class="setup-status-item">
|
|
1028
|
-
${
|
|
1028
|
+
${j(n>0?"good":"bad")}
|
|
1029
1029
|
<div class="setup-status-info">
|
|
1030
1030
|
<strong>API Keys</strong>
|
|
1031
1031
|
<span>${n} configured</span>
|
|
@@ -1036,14 +1036,14 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1036
1036
|
>Manage</button>
|
|
1037
1037
|
</div>
|
|
1038
1038
|
</div>
|
|
1039
|
-
${
|
|
1040
|
-
`}function
|
|
1039
|
+
${bg(e)}
|
|
1040
|
+
`}function bg(e){if(!e.apiKeyModalOpen)return k;const t=e.apiKeyProviders,n={};for(const c of t)c.key&&(n[c.id]=c.key);const i=(c,l)=>{const p=l==null?void 0:l.closest(".setup-apikey-input"),f=p==null?void 0:p.querySelector("input"),v=f==null?void 0:f.value.trim();!v||v===n[c]||e.onApiKeySave(c,v)},s=c=>{const l=c.currentTarget,p=l.closest(".setup-apikey-input"),f=p==null?void 0:p.querySelector("input");if(!f)return;const v=f.type==="text";f.type=v?"password":"text",l.classList.toggle("active",!v)},o=(c,l)=>{const p=l.target,f=p.closest(".setup-apikey-input"),v=p.value.trim(),S=v.length>0&&v!==n[c],h=f==null?void 0:f.querySelector(".setup-apikey-save");h&&(h.style.display=S?"":"none");const b=f==null?void 0:f.querySelector(".setup-apikey-eye");b&&(b.style.display=v.length>0?"":"none")},r=t.filter(c=>c.primary),a=t.filter(c=>!c.primary),d=c=>{const l=e.apiKeySavingProvider===c.id&&e.apiKeyBusy,p=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} key saved`,f=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} key removed`,v=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} disabled`,S=!e.apiKeyBusy&&e.apiKeySuccess===`${c.id} enabled`;return u`
|
|
1041
1041
|
<div class="setup-apikey-row ${c.disabled?"disabled":""}">
|
|
1042
1042
|
<div class="setup-apikey-info">
|
|
1043
1043
|
<strong>${c.name}</strong>
|
|
1044
1044
|
<span class="setup-apikey-category">${c.category}</span>
|
|
1045
1045
|
${p?u`<span class="setup-apikey-badge saved">Saved</span>`:k}
|
|
1046
|
-
${
|
|
1046
|
+
${f?u`<span class="setup-apikey-badge removed">Removed</span>`:k}
|
|
1047
1047
|
${v?u`<span class="setup-apikey-badge removed">Disabled</span>`:k}
|
|
1048
1048
|
${S?u`<span class="setup-apikey-badge saved">Enabled</span>`:k}
|
|
1049
1049
|
${c.disabled&&!S?u`<span class="setup-apikey-badge apikey-disabled">Off</span>`:k}
|
|
@@ -1054,8 +1054,8 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1054
1054
|
.value=${c.key??""}
|
|
1055
1055
|
placeholder="Enter key"
|
|
1056
1056
|
?disabled=${e.apiKeyBusy||c.disabled}
|
|
1057
|
-
@input=${
|
|
1058
|
-
@keydown=${
|
|
1057
|
+
@input=${h=>o(c.id,h)}
|
|
1058
|
+
@keydown=${h=>{h.key==="Enter"&&i(c.id,h.target)}}
|
|
1059
1059
|
/>
|
|
1060
1060
|
<button
|
|
1061
1061
|
class="setup-apikey-icon-btn setup-apikey-eye"
|
|
@@ -1067,7 +1067,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1067
1067
|
class="setup-apikey-save setup-button"
|
|
1068
1068
|
style="display: none;"
|
|
1069
1069
|
?disabled=${e.apiKeyBusy}
|
|
1070
|
-
@click=${
|
|
1070
|
+
@click=${h=>i(c.id,h.currentTarget)}
|
|
1071
1071
|
>Save</button>`}
|
|
1072
1072
|
${c.hasKey&&!l?u`
|
|
1073
1073
|
<button
|
|
@@ -1091,24 +1091,24 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1091
1091
|
<h3 style="margin: 0 0 4px; text-align: center;">API Keys</h3>
|
|
1092
1092
|
<div class="setup-apikey-list">
|
|
1093
1093
|
${e.apiKeyError?u`<p class="setup-error" style="margin: 0;">${e.apiKeyError}</p>`:k}
|
|
1094
|
-
${
|
|
1095
|
-
${
|
|
1094
|
+
${r.map(d)}
|
|
1095
|
+
${a.length>0?u`
|
|
1096
1096
|
<details class="setup-apikey-advanced">
|
|
1097
1097
|
<summary>Additional keys</summary>
|
|
1098
|
-
${
|
|
1098
|
+
${a.map(d)}
|
|
1099
1099
|
</details>
|
|
1100
1100
|
`:k}
|
|
1101
1101
|
</div>
|
|
1102
1102
|
</div>
|
|
1103
1103
|
</div>
|
|
1104
|
-
`}function
|
|
1104
|
+
`}function Ea(e){const t=e.updateAvailable===null?"unknown":e.updateAvailable?"partial":"good",n=e.updateAvailable&&e.latestVersion?`v${e.currentVersion} → v${e.latestVersion}`:e.currentVersion?`v${e.currentVersion}`:"Unknown",i=e.updateChecking||e.updateRunning;return u`
|
|
1105
1105
|
<div class="setup-status-item">
|
|
1106
|
-
${
|
|
1106
|
+
${j(t)}
|
|
1107
1107
|
<div class="setup-status-info">
|
|
1108
1108
|
<strong>Software</strong>
|
|
1109
1109
|
<span>${n}</span>
|
|
1110
1110
|
</div>
|
|
1111
|
-
${
|
|
1111
|
+
${de("update",e)}
|
|
1112
1112
|
${e.updateAvailable?u`
|
|
1113
1113
|
<button
|
|
1114
1114
|
class="setup-status-action ${i?"spinning":""}"
|
|
@@ -1129,9 +1129,9 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1129
1129
|
</button>
|
|
1130
1130
|
`}
|
|
1131
1131
|
</div>
|
|
1132
|
-
`}const
|
|
1132
|
+
`}const wg={anonymous:"Open access",verified:"WhatsApp OTP",choice:"Visitor chooses"};function Ca(e){const t=e.publicChatEnabled;return u`
|
|
1133
1133
|
<div class="setup-status-item">
|
|
1134
|
-
${
|
|
1134
|
+
${j(t?"good":"unknown")}
|
|
1135
1135
|
<div class="setup-status-info">
|
|
1136
1136
|
<strong>Public Chat</strong>
|
|
1137
1137
|
${t?u`
|
|
@@ -1146,7 +1146,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1146
1146
|
</select>
|
|
1147
1147
|
`:u`<span>Disabled</span>`}
|
|
1148
1148
|
</div>
|
|
1149
|
-
${
|
|
1149
|
+
${de("public-chat",e)}
|
|
1150
1150
|
<button
|
|
1151
1151
|
class="setup-info-btn"
|
|
1152
1152
|
title="${t?"Disable public chat":"Enable public chat"}"
|
|
@@ -1154,21 +1154,21 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1154
1154
|
@click=${e.onPublicChatToggle}
|
|
1155
1155
|
>${t?L.powerOff:L.power}</button>
|
|
1156
1156
|
</div>
|
|
1157
|
-
`}function
|
|
1157
|
+
`}function Ta(e){const t=!!(e.brandAccentColor||e.brandBackgroundColor||e.brandHasLogo),n=t?"good":"unknown",i=e.brandingBusy;return u`
|
|
1158
1158
|
<div class="setup-status-item">
|
|
1159
|
-
${
|
|
1159
|
+
${j(n)}
|
|
1160
1160
|
<div class="setup-status-info">
|
|
1161
1161
|
<strong>Branding</strong>
|
|
1162
1162
|
<span>${t?"Customised":"Default"}</span>
|
|
1163
1163
|
</div>
|
|
1164
|
-
${
|
|
1164
|
+
${de("branding",e)}
|
|
1165
1165
|
<button
|
|
1166
1166
|
class="setup-link-btn"
|
|
1167
1167
|
?disabled=${i}
|
|
1168
1168
|
@click=${e.onBrandingToggle}
|
|
1169
1169
|
>${i?"...":"Edit"}</button>
|
|
1170
1170
|
</div>
|
|
1171
|
-
`}function
|
|
1171
|
+
`}function _a(e){var s;if(!e.brandingExpanded)return k;const t=e.brandingBusy,n=(s=e.wsProps)==null?void 0:s.selectedWorkspace,i=e.brandHasLogo&&n?`/brand-logo/${encodeURIComponent(n)}`:"";return u`
|
|
1172
1172
|
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&e.onBrandingToggle()}}>
|
|
1173
1173
|
<div class="setup-info-card" style="max-width: 400px; position: relative;">
|
|
1174
1174
|
<h3 style="margin-right: 24px;">Branding</h3>
|
|
@@ -1189,7 +1189,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1189
1189
|
accept="image/png,image/jpeg,image/svg+xml,image/webp"
|
|
1190
1190
|
style="display: none;"
|
|
1191
1191
|
?disabled=${t}
|
|
1192
|
-
@change=${o=>{var d;const
|
|
1192
|
+
@change=${o=>{var d;const r=o.target,a=(d=r.files)==null?void 0:d[0];a&&e.onBrandLogoUpload(a),r.value=""}}
|
|
1193
1193
|
/>
|
|
1194
1194
|
</label>
|
|
1195
1195
|
</div>
|
|
@@ -1211,8 +1211,8 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1211
1211
|
.value=${e.brandAccentColor||"#00d4ff"}
|
|
1212
1212
|
?disabled=${t}
|
|
1213
1213
|
placeholder="#00d4ff"
|
|
1214
|
-
@keydown=${o=>{if(o.key==="Enter"){const
|
|
1215
|
-
@blur=${o=>{const
|
|
1214
|
+
@keydown=${o=>{if(o.key==="Enter"){const r=o.target.value.trim();/^#[0-9a-fA-F]{6}$/.test(r)&&e.onBrandAccentColorChange(r)}}}
|
|
1215
|
+
@blur=${o=>{const r=o.target.value.trim();/^#[0-9a-fA-F]{6}$/.test(r)&&r!==(e.brandAccentColor||"#00d4ff")&&e.onBrandAccentColorChange(r)}}
|
|
1216
1216
|
/>
|
|
1217
1217
|
${e.brandAccentColor?u`<button class="branding-clear-btn" ?disabled=${t} @click=${()=>e.onBrandAccentColorChange("")}>Clear</button>`:k}
|
|
1218
1218
|
</div>
|
|
@@ -1234,8 +1234,8 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1234
1234
|
.value=${e.brandBackgroundColor||"#12141a"}
|
|
1235
1235
|
?disabled=${t}
|
|
1236
1236
|
placeholder="#12141a"
|
|
1237
|
-
@keydown=${o=>{if(o.key==="Enter"){const
|
|
1238
|
-
@blur=${o=>{const
|
|
1237
|
+
@keydown=${o=>{if(o.key==="Enter"){const r=o.target.value.trim();/^#[0-9a-fA-F]{6}$/.test(r)&&e.onBrandBackgroundColorChange(r)}}}
|
|
1238
|
+
@blur=${o=>{const r=o.target.value.trim();/^#[0-9a-fA-F]{6}$/.test(r)&&r!==(e.brandBackgroundColor||"#12141a")&&e.onBrandBackgroundColorChange(r)}}
|
|
1239
1239
|
/>
|
|
1240
1240
|
${e.brandBackgroundColor?u`<button class="branding-clear-btn" ?disabled=${t} @click=${()=>e.onBrandBackgroundColorChange("")}>Clear</button>`:k}
|
|
1241
1241
|
</div>
|
|
@@ -1249,32 +1249,32 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1249
1249
|
|
|
1250
1250
|
</div>
|
|
1251
1251
|
</div>
|
|
1252
|
-
`}function
|
|
1252
|
+
`}function kg(e){if(!e.isMaster)return k;const t=e.tailscaleStatus,n=e.tailscaleBusy,i=e.tailscaleAuthUrl;if(!t)return u`
|
|
1253
1253
|
<div class="setup-status-item">
|
|
1254
|
-
${
|
|
1254
|
+
${j("unknown")}
|
|
1255
1255
|
<div class="setup-status-info">
|
|
1256
1256
|
<strong>Remote Access</strong>
|
|
1257
1257
|
<span>Checking...</span>
|
|
1258
1258
|
</div>
|
|
1259
|
-
${
|
|
1259
|
+
${de("remote-access",e)}
|
|
1260
1260
|
</div>
|
|
1261
1261
|
`;if(!t.installed)return u`
|
|
1262
1262
|
<div class="setup-status-item">
|
|
1263
|
-
${
|
|
1263
|
+
${j("unknown")}
|
|
1264
1264
|
<div class="setup-status-info">
|
|
1265
1265
|
<strong>Remote Access</strong>
|
|
1266
1266
|
<span>Tailscale not installed</span>
|
|
1267
1267
|
</div>
|
|
1268
|
-
${
|
|
1268
|
+
${de("remote-access",e)}
|
|
1269
1269
|
</div>
|
|
1270
1270
|
`;if(i)return u`
|
|
1271
1271
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
1272
|
-
${
|
|
1272
|
+
${j("partial")}
|
|
1273
1273
|
<div class="setup-status-info">
|
|
1274
1274
|
<strong>Remote Access</strong>
|
|
1275
1275
|
<span>Waiting for authentication...</span>
|
|
1276
1276
|
</div>
|
|
1277
|
-
${
|
|
1277
|
+
${de("remote-access",e)}
|
|
1278
1278
|
<div style="flex-basis: 100%; padding-top: 8px;">
|
|
1279
1279
|
<p style="margin: 0 0 8px; font-size: 13px; opacity: 0.8;">
|
|
1280
1280
|
Scan the QR code or open the link to log in with your Google or Microsoft account:
|
|
@@ -1298,12 +1298,12 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1298
1298
|
</div>
|
|
1299
1299
|
`;if(!t.loggedIn)return u`
|
|
1300
1300
|
<div class="setup-status-item">
|
|
1301
|
-
${
|
|
1301
|
+
${j("partial")}
|
|
1302
1302
|
<div class="setup-status-info">
|
|
1303
1303
|
<strong>Remote Access</strong>
|
|
1304
1304
|
<span>Not connected</span>
|
|
1305
1305
|
</div>
|
|
1306
|
-
${
|
|
1306
|
+
${de("remote-access",e)}
|
|
1307
1307
|
<button
|
|
1308
1308
|
class="setup-link-btn"
|
|
1309
1309
|
?disabled=${n}
|
|
@@ -1312,12 +1312,12 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1312
1312
|
</div>
|
|
1313
1313
|
`;if(!t.serveEnabled)return u`
|
|
1314
1314
|
<div class="setup-status-item">
|
|
1315
|
-
${
|
|
1315
|
+
${j("partial")}
|
|
1316
1316
|
<div class="setup-status-info">
|
|
1317
1317
|
<strong>Remote Access</strong>
|
|
1318
1318
|
<span>Connected (not enabled)</span>
|
|
1319
1319
|
</div>
|
|
1320
|
-
${
|
|
1320
|
+
${de("remote-access",e)}
|
|
1321
1321
|
<button
|
|
1322
1322
|
class="setup-info-btn"
|
|
1323
1323
|
title="Enable remote access"
|
|
@@ -1327,19 +1327,19 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1327
1327
|
</div>
|
|
1328
1328
|
`;if(!t.serveActive)return u`
|
|
1329
1329
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
1330
|
-
${
|
|
1330
|
+
${j("bad")}
|
|
1331
1331
|
<div class="setup-status-info">
|
|
1332
1332
|
<strong>Remote Access</strong>
|
|
1333
1333
|
<span>Enabled but not active</span>
|
|
1334
1334
|
</div>
|
|
1335
|
-
${
|
|
1335
|
+
${de("remote-access",e)}
|
|
1336
1336
|
<div style="flex-basis: 100%; padding-top: 4px;">
|
|
1337
1337
|
<p style="margin: 0; font-size: 13px; color: #f59e0b;">
|
|
1338
1338
|
Remote access is configured but not running. Try disabling and re-enabling, or check that Tailscale is connected.
|
|
1339
1339
|
</p>
|
|
1340
1340
|
</div>
|
|
1341
1341
|
</div>
|
|
1342
|
-
`;const s=t.tailnetUrl??`https://${t.hostname}`,o=e.tailscaleFunnelEnableUrl,
|
|
1342
|
+
`;const s=t.tailnetUrl??`https://${t.hostname}`,o=e.tailscaleFunnelEnableUrl,r=e.tailscaleDisableConfirm?u`<div style="flex-basis: 100%; padding-top: 6px; display: flex; gap: 8px; align-items: center;">
|
|
1343
1343
|
<span style="font-size: 12px; opacity: 0.8;">Disable remote access?</span>
|
|
1344
1344
|
<button
|
|
1345
1345
|
class="setup-link-btn"
|
|
@@ -1364,7 +1364,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1364
1364
|
>Open Tailscale admin to enable Funnel →</a>
|
|
1365
1365
|
</div>`:e.tailscaleError?u`<p style="flex-basis: 100%; margin: 6px 0 0; font-size: 13px; color: #ef4444;">${e.tailscaleError}</p>`:k;return u`
|
|
1366
1366
|
<div class="setup-status-item" style="flex-wrap: wrap;">
|
|
1367
|
-
${
|
|
1367
|
+
${j("good")}
|
|
1368
1368
|
<div class="setup-status-info">
|
|
1369
1369
|
<strong>Remote Access</strong>
|
|
1370
1370
|
<span style="display: inline-flex; align-items: center; gap: 4px;">
|
|
@@ -1377,11 +1377,11 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1377
1377
|
<button
|
|
1378
1378
|
class="setup-info-btn"
|
|
1379
1379
|
title="Copy URL"
|
|
1380
|
-
@click=${async
|
|
1380
|
+
@click=${async a=>{const d=a.currentTarget;try{await navigator.clipboard.writeText(s)}catch{const c=document.createElement("textarea");c.value=s,c.style.position="fixed",c.style.opacity="0",document.body.appendChild(c),c.select(),document.execCommand("copy"),document.body.removeChild(c)}d.classList.add("copied"),setTimeout(()=>d.classList.remove("copied"),1500)}}
|
|
1381
1381
|
>${L.copy}</button>
|
|
1382
1382
|
</span>
|
|
1383
1383
|
</div>
|
|
1384
|
-
${
|
|
1384
|
+
${de("remote-access",e)}
|
|
1385
1385
|
${t.funnelEnabled?u`<button
|
|
1386
1386
|
class="setup-info-btn"
|
|
1387
1387
|
title="Disable internet access"
|
|
@@ -1399,9 +1399,9 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1399
1399
|
?disabled=${n}
|
|
1400
1400
|
@click=${e.onTailscaleDisableConfirmToggle}
|
|
1401
1401
|
>${L.powerOff}</button>
|
|
1402
|
-
${
|
|
1402
|
+
${r}
|
|
1403
1403
|
</div>
|
|
1404
|
-
`}function
|
|
1404
|
+
`}function yd(e){const t=e>=70?4:e>=50?3:e>=30?2:1;return u`
|
|
1405
1405
|
<span style="display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; vertical-align: middle;">
|
|
1406
1406
|
${[4,7,10,14].map((i,s)=>u`<span style="
|
|
1407
1407
|
width: 3px;
|
|
@@ -1410,9 +1410,9 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1410
1410
|
background: ${s<t?"var(--tasker-accent, #00e5ff)":"rgba(255,255,255,0.15)"};
|
|
1411
1411
|
"></span>`)}
|
|
1412
1412
|
</span>
|
|
1413
|
-
`}function
|
|
1413
|
+
`}function Ma(e){if(e.serverPlatform!=="linux")return k;const t=e.wifiStatus,n=e.wifiBusy;if(!t)return u`
|
|
1414
1414
|
<div class="setup-status-item">
|
|
1415
|
-
${
|
|
1415
|
+
${j("unknown")}
|
|
1416
1416
|
<div class="setup-status-info">
|
|
1417
1417
|
<strong>WiFi</strong>
|
|
1418
1418
|
<span>Checking...</span>
|
|
@@ -1420,87 +1420,109 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1420
1420
|
</div>
|
|
1421
1421
|
`;if(!t.available)return u`
|
|
1422
1422
|
<div class="setup-status-item">
|
|
1423
|
-
${
|
|
1423
|
+
${j("unknown")}
|
|
1424
1424
|
<div class="setup-status-info">
|
|
1425
1425
|
<strong>WiFi</strong>
|
|
1426
1426
|
<span>NetworkManager not available</span>
|
|
1427
1427
|
</div>
|
|
1428
1428
|
</div>
|
|
1429
|
-
`;const i
|
|
1430
|
-
<div>
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
<
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1429
|
+
`;const i=!!t.savedSsid&&!t.connected,s=t.connected?"good":"partial",o=t.connected?u`${t.ssid} ${t.signal!=null?u`<span style="margin-left: 4px;">${yd(t.signal)}</span>`:k}`:i?u`${t.savedSsid} <span style="opacity: 0.4;">\u2014 reconnecting\u2026</span>`:"Not connected";return u`
|
|
1430
|
+
<div class="setup-status-item">
|
|
1431
|
+
${j(s)}
|
|
1432
|
+
<div class="setup-status-info">
|
|
1433
|
+
<strong>WiFi</strong>
|
|
1434
|
+
<span>${o}</span>
|
|
1435
|
+
${t.connected&&t.ip?u`<span style="font-size: 11px; opacity: 0.5;">${t.ip}</span>`:k}
|
|
1436
|
+
</div>
|
|
1437
|
+
<button
|
|
1438
|
+
class="setup-link-btn"
|
|
1439
|
+
?disabled=${n}
|
|
1440
|
+
@click=${e.onWifiModalToggle}
|
|
1441
|
+
>${n?"...":"Edit"}</button>
|
|
1442
|
+
</div>
|
|
1443
|
+
`}function $g(e){if(!e.wifiModalOpen)return k;const t=e.wifiStatus,n=e.wifiBusy,i=e.wifiNetworks,s=e.wifiSelectedSsid;return u`
|
|
1444
|
+
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&e.onWifiModalToggle()}}>
|
|
1445
|
+
<div class="setup-info-card" style="max-width: 420px; position: relative;">
|
|
1446
|
+
<h3 style="margin-right: 24px;">WiFi</h3>
|
|
1447
|
+
<button class="branding-modal-close" @click=${e.onWifiModalToggle}>×</button>
|
|
1448
|
+
|
|
1449
|
+
<!-- Current status -->
|
|
1450
|
+
${t!=null&&t.connected?u`
|
|
1451
|
+
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px;">
|
|
1452
|
+
<span style="color: #22c55e;">${L.wifi}</span>
|
|
1453
|
+
<span style="font-size: 13px;">${t.ssid}${t.ip?u` <span style="opacity: 0.5;">(${t.ip})</span>`:k}</span>
|
|
1454
|
+
<button
|
|
1455
|
+
class="setup-link-btn"
|
|
1456
|
+
style="margin-left: auto; font-size: 12px;"
|
|
1457
|
+
?disabled=${n}
|
|
1458
|
+
@click=${e.onWifiDisconnect}
|
|
1459
|
+
>Disconnect</button>
|
|
1460
|
+
</div>
|
|
1461
|
+
`:t!=null&&t.savedSsid?u`
|
|
1462
|
+
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 12px;">
|
|
1463
|
+
<span style="color: #eab308; opacity: 0.6;">${L.wifi}</span>
|
|
1464
|
+
<span style="font-size: 13px; opacity: 0.6;">${t.savedSsid} \u2014 reconnecting\u2026</span>
|
|
1465
|
+
</div>
|
|
1466
|
+
`:k}
|
|
1467
|
+
|
|
1468
|
+
<!-- Scan button -->
|
|
1444
1469
|
<button
|
|
1445
|
-
class="setup-
|
|
1470
|
+
class="setup-button primary"
|
|
1471
|
+
style="padding: 6px 16px; font-size: 13px; margin-bottom: 12px; width: 100%;"
|
|
1446
1472
|
?disabled=${n}
|
|
1447
|
-
@click=${
|
|
1448
|
-
|
|
1449
|
-
>${o?L.x:n?L.loader:L.rotateCw}</button>
|
|
1450
|
-
</div>
|
|
1473
|
+
@click=${e.onWifiScan}
|
|
1474
|
+
>${n&&i.length===0?"Scanning...":"Scan for networks"}</button>
|
|
1451
1475
|
|
|
1452
|
-
|
|
1453
|
-
<p style="margin: 0; font-size: 13px; color: #ef4444;">${e.wifiError}</p>
|
|
1454
|
-
</div>`:k}
|
|
1476
|
+
${e.wifiError?u`<p style="margin: 0 0 8px; font-size: 13px; color: #ef4444;">${e.wifiError}</p>`:k}
|
|
1455
1477
|
|
|
1456
|
-
|
|
1457
|
-
|
|
1478
|
+
<!-- Network list -->
|
|
1479
|
+
${i.length>0?u`
|
|
1458
1480
|
<div style="
|
|
1459
|
-
max-height:
|
|
1481
|
+
max-height: 240px;
|
|
1460
1482
|
overflow-y: auto;
|
|
1461
1483
|
border: 1px solid rgba(255,255,255,0.1);
|
|
1462
1484
|
border-radius: 6px;
|
|
1463
|
-
margin-bottom:
|
|
1485
|
+
margin-bottom: 12px;
|
|
1464
1486
|
">
|
|
1465
|
-
${i.map(
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1487
|
+
${i.map(o=>{const r=(t==null?void 0:t.savedSsid)===o.ssid;return u`
|
|
1488
|
+
<button
|
|
1489
|
+
style="
|
|
1490
|
+
display: flex;
|
|
1491
|
+
align-items: center;
|
|
1492
|
+
justify-content: space-between;
|
|
1493
|
+
width: 100%;
|
|
1494
|
+
padding: 8px 12px;
|
|
1495
|
+
background: ${s===o.ssid?"rgba(255,255,255,0.1)":"transparent"};
|
|
1496
|
+
border: none;
|
|
1497
|
+
border-bottom: 1px solid rgba(255,255,255,0.06);
|
|
1498
|
+
color: inherit;
|
|
1499
|
+
font-size: 13px;
|
|
1500
|
+
cursor: pointer;
|
|
1501
|
+
text-align: left;
|
|
1502
|
+
"
|
|
1503
|
+
@click=${()=>{o.active||e.onWifiSelectSsid(s===o.ssid?null:o.ssid)}}
|
|
1504
|
+
>
|
|
1505
|
+
<span style="display: flex; align-items: center; gap: 8px;">
|
|
1506
|
+
${o.active?u`<span style="color: #22c55e;" title="Connected">\u2713</span>`:r?u`<span style="opacity: 0.4; font-size: 11px;" title="Saved">\u2605</span>`:k}
|
|
1507
|
+
<span>${o.ssid}</span>
|
|
1508
|
+
</span>
|
|
1509
|
+
<span style="display: flex; align-items: center; gap: 8px;">
|
|
1510
|
+
${o.security!=="Open"?u`<span style="opacity: 0.4; font-size: 11px;" title="${o.security}">\uD83D\uDD12</span>`:k}
|
|
1511
|
+
<span title="Signal: ${o.signal}%">${yd(o.signal)}</span>
|
|
1512
|
+
</span>
|
|
1513
|
+
</button>
|
|
1514
|
+
`})}
|
|
1493
1515
|
</div>
|
|
1494
1516
|
|
|
1495
|
-
${s&&!i.find(
|
|
1517
|
+
${s&&!i.find(o=>o.ssid===s&&o.active)?u`
|
|
1496
1518
|
<div style="display: flex; gap: 8px; align-items: center;">
|
|
1497
|
-
${(()=>{const
|
|
1519
|
+
${(()=>{const o=i.find(d=>d.ssid===s),r=(o==null?void 0:o.security)!=="Open",a=(t==null?void 0:t.savedSsid)===s;return r&&!a?u`
|
|
1498
1520
|
<input
|
|
1499
1521
|
type="password"
|
|
1500
1522
|
placeholder="Password"
|
|
1501
1523
|
.value=${e.wifiPassword}
|
|
1502
|
-
@input=${
|
|
1503
|
-
@keydown=${
|
|
1524
|
+
@input=${d=>e.onWifiPasswordChange(d.target.value)}
|
|
1525
|
+
@keydown=${d=>{d.key==="Enter"&&e.onWifiConnect()}}
|
|
1504
1526
|
?disabled=${n}
|
|
1505
1527
|
style="
|
|
1506
1528
|
flex: 1;
|
|
@@ -1519,7 +1541,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1519
1541
|
?disabled=${n}
|
|
1520
1542
|
@click=${e.onWifiConnect}
|
|
1521
1543
|
>${n?"Connecting...":"Connect"}</button>
|
|
1522
|
-
${t.savedSsid===s?u`<button
|
|
1544
|
+
${(t==null?void 0:t.savedSsid)===s?u`<button
|
|
1523
1545
|
class="setup-link-btn"
|
|
1524
1546
|
?disabled=${n}
|
|
1525
1547
|
@click=${e.onWifiForget}
|
|
@@ -1527,22 +1549,111 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1527
1549
|
>Forget</button>`:k}
|
|
1528
1550
|
</div>
|
|
1529
1551
|
`:k}
|
|
1552
|
+
`:k}
|
|
1553
|
+
</div>
|
|
1554
|
+
</div>
|
|
1555
|
+
`}function Pa(e){return e.isMaster?e.networkPort==null?u`
|
|
1556
|
+
<div class="setup-status-item">
|
|
1557
|
+
${j("unknown")}
|
|
1558
|
+
<div class="setup-status-info">
|
|
1559
|
+
<strong>Network</strong>
|
|
1560
|
+
<span>Loading...</span>
|
|
1561
|
+
</div>
|
|
1562
|
+
</div>
|
|
1563
|
+
`:u`
|
|
1564
|
+
<div class="setup-status-item">
|
|
1565
|
+
${j("good")}
|
|
1566
|
+
<div class="setup-status-info">
|
|
1567
|
+
<strong>Network</strong>
|
|
1568
|
+
<span>${e.networkHostname}.local:${e.networkPort}</span>
|
|
1569
|
+
</div>
|
|
1570
|
+
${de("network",e)}
|
|
1571
|
+
<button
|
|
1572
|
+
class="setup-link-btn"
|
|
1573
|
+
@click=${e.onNetworkModalToggle}
|
|
1574
|
+
>Edit</button>
|
|
1575
|
+
</div>
|
|
1576
|
+
`:k}function Sg(e){if(!e.networkModalOpen)return k;const t=e.networkBusy,n=e.networkPortInput!==String(e.networkPort),i=e.networkHostnameInput!==e.networkHostname,s=n||i;return u`
|
|
1577
|
+
<div class="setup-info-overlay" @click=${o=>{o.target.classList.contains("setup-info-overlay")&&e.onNetworkModalToggle()}}>
|
|
1578
|
+
<div class="setup-info-card" style="max-width: 400px; position: relative;">
|
|
1579
|
+
<h3 style="margin-right: 24px;">Network</h3>
|
|
1580
|
+
<button class="branding-modal-close" @click=${e.onNetworkModalToggle}>×</button>
|
|
1581
|
+
|
|
1582
|
+
<!-- Hostname -->
|
|
1583
|
+
<div class="branding-row">
|
|
1584
|
+
<label class="branding-label">Hostname</label>
|
|
1585
|
+
<div style="display: flex; align-items: center; gap: 8px; flex: 1;">
|
|
1586
|
+
<input
|
|
1587
|
+
type="text"
|
|
1588
|
+
.value=${e.networkHostnameInput}
|
|
1589
|
+
?disabled=${t}
|
|
1590
|
+
@input=${o=>e.onNetworkHostnameChange(o.target.value)}
|
|
1591
|
+
style="
|
|
1592
|
+
flex: 1;
|
|
1593
|
+
padding: 6px 10px;
|
|
1594
|
+
background: rgba(255,255,255,0.06);
|
|
1595
|
+
border: 1px solid rgba(255,255,255,0.15);
|
|
1596
|
+
border-radius: 4px;
|
|
1597
|
+
color: inherit;
|
|
1598
|
+
font-size: 13px;
|
|
1599
|
+
outline: none;
|
|
1600
|
+
"
|
|
1601
|
+
/>
|
|
1602
|
+
<span style="font-size: 13px; opacity: 0.5;">.local</span>
|
|
1530
1603
|
</div>
|
|
1531
|
-
|
|
1604
|
+
</div>
|
|
1605
|
+
|
|
1606
|
+
<!-- Port -->
|
|
1607
|
+
<div class="branding-row">
|
|
1608
|
+
<label class="branding-label">Port</label>
|
|
1609
|
+
<input
|
|
1610
|
+
type="number"
|
|
1611
|
+
min="1024"
|
|
1612
|
+
max="65535"
|
|
1613
|
+
.value=${e.networkPortInput}
|
|
1614
|
+
?disabled=${t}
|
|
1615
|
+
@input=${o=>e.onNetworkPortChange(o.target.value)}
|
|
1616
|
+
style="
|
|
1617
|
+
width: 100px;
|
|
1618
|
+
padding: 6px 10px;
|
|
1619
|
+
background: rgba(255,255,255,0.06);
|
|
1620
|
+
border: 1px solid rgba(255,255,255,0.15);
|
|
1621
|
+
border-radius: 4px;
|
|
1622
|
+
color: inherit;
|
|
1623
|
+
font-size: 13px;
|
|
1624
|
+
outline: none;
|
|
1625
|
+
-moz-appearance: textfield;
|
|
1626
|
+
"
|
|
1627
|
+
/>
|
|
1628
|
+
</div>
|
|
1629
|
+
|
|
1630
|
+
${e.networkError?u`<p style="margin: 8px 0 0; font-size: 13px; color: #ef4444;">${e.networkError}</p>`:k}
|
|
1631
|
+
${e.networkSuccess?u`<p style="margin: 8px 0 0; font-size: 13px; color: #22c55e;">${e.networkSuccess}</p>`:k}
|
|
1632
|
+
|
|
1633
|
+
<div style="margin-top: 16px; display: flex; gap: 8px; align-items: center;">
|
|
1634
|
+
<button
|
|
1635
|
+
class="setup-button primary"
|
|
1636
|
+
style="padding: 8px 20px; font-size: 13px;"
|
|
1637
|
+
?disabled=${t||!s}
|
|
1638
|
+
@click=${e.onNetworkSave}
|
|
1639
|
+
>${t?"Saving...":"Save"}</button>
|
|
1640
|
+
${s?u`<span style="font-size: 12px; opacity: 0.5;">Gateway will restart</span>`:k}
|
|
1641
|
+
</div>
|
|
1642
|
+
</div>
|
|
1532
1643
|
</div>
|
|
1533
|
-
`}function
|
|
1644
|
+
`}function xg(e){var i,s,o;const t=e.updateRunning,n=e.updateLastResult;if(!t&&!n)return k;if(t)return u`
|
|
1534
1645
|
<div class="setup-info-overlay">
|
|
1535
1646
|
<div class="setup-info-card" style="max-width: 400px;">
|
|
1536
1647
|
<h3>Software Update</h3>
|
|
1537
1648
|
${e.updateProgressSteps.length>0?u`
|
|
1538
1649
|
<div class="setup-update-progress">
|
|
1539
|
-
${e.updateProgressSteps.map(
|
|
1540
|
-
<div class="setup-update-step ${
|
|
1650
|
+
${e.updateProgressSteps.map(r=>u`
|
|
1651
|
+
<div class="setup-update-step ${r.status}">
|
|
1541
1652
|
<span class="setup-update-step-icon">
|
|
1542
|
-
${
|
|
1653
|
+
${r.status==="running"?u`<span class="setup-update-spinner"></span>`:r.status==="done"?u`<span class="setup-update-icon-ok">${L.check}</span>`:u`<span class="setup-update-icon-fail">${L.x}</span>`}
|
|
1543
1654
|
</span>
|
|
1544
|
-
<span class="setup-update-step-name">${
|
|
1545
|
-
${
|
|
1655
|
+
<span class="setup-update-step-name">${r.name}</span>
|
|
1656
|
+
${r.durationMs!=null?u`<span class="setup-update-step-time">${La(r.durationMs)}</span>`:k}
|
|
1546
1657
|
</div>
|
|
1547
1658
|
`)}
|
|
1548
1659
|
</div>
|
|
@@ -1550,15 +1661,15 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1550
1661
|
${e.updateMessage?u`<p style="text-align: center; color: var(--tasker-text-grey); font-size: 13px; margin: 12px 0 0;">${e.updateMessage}</p>`:k}
|
|
1551
1662
|
</div>
|
|
1552
1663
|
</div>
|
|
1553
|
-
`;if(n){const
|
|
1664
|
+
`;if(n){const r=n.status==="ok";let a;if(r){const c=(i=n.before)==null?void 0:i.version,l=((s=n.after)==null?void 0:s.version)??n.currentVersion;a=c?`v${c} → v${l}`:`Updated to v${l}`}else a=n.reason??((o=n.failedStep)==null?void 0:o.name)??"unknown error";const d=n.durationMs!=null?La(n.durationMs):null;return u`
|
|
1554
1665
|
<div class="setup-info-overlay" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onUpdateDismissResult()}}>
|
|
1555
1666
|
<div class="setup-info-card" style="max-width: 360px; text-align: center;">
|
|
1556
|
-
<div class="setup-update-result-icon ${
|
|
1557
|
-
<h3 style="color: ${
|
|
1558
|
-
${
|
|
1667
|
+
<div class="setup-update-result-icon ${r?"ok":"fail"}">${r?L.circleCheck:L.circleX}</div>
|
|
1668
|
+
<h3 style="color: ${r?"#22c55e":"#ef4444"};">
|
|
1669
|
+
${r?"Update Complete":"Update Failed"}
|
|
1559
1670
|
</h3>
|
|
1560
1671
|
<p style="color: var(--tasker-text-grey); font-size: 14px; margin: 8px 0;">
|
|
1561
|
-
${
|
|
1672
|
+
${a}
|
|
1562
1673
|
</p>
|
|
1563
1674
|
${d?u`<p style="color: rgba(255,255,255,0.3); font-size: 12px; margin: 4px 0 0;">${d}</p>`:k}
|
|
1564
1675
|
<button
|
|
@@ -1570,20 +1681,20 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1570
1681
|
</button>
|
|
1571
1682
|
</div>
|
|
1572
1683
|
</div>
|
|
1573
|
-
`}return k}function
|
|
1684
|
+
`}return k}function La(e){if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),i=t%60;return i>0?`${n}m ${i}s`:`${n}m`}function Ia(e){const t=e.accountHasPin;return u`
|
|
1574
1685
|
<div class="setup-status-item">
|
|
1575
|
-
${
|
|
1686
|
+
${j(t?"good":"bad")}
|
|
1576
1687
|
<div class="setup-status-info">
|
|
1577
1688
|
<strong>Account PIN</strong>
|
|
1578
1689
|
<span>${t?"Set":"Not set"}</span>
|
|
1579
1690
|
</div>
|
|
1580
|
-
${
|
|
1691
|
+
${de("account-pin",e)}
|
|
1581
1692
|
<button
|
|
1582
1693
|
class="setup-link-btn"
|
|
1583
1694
|
@click=${()=>e.onAccountPinModalOpen()}
|
|
1584
1695
|
>${t?"Change":"Set PIN"}</button>
|
|
1585
1696
|
</div>
|
|
1586
|
-
`}function
|
|
1697
|
+
`}function Ra(e){if(!e.accountPinModalOpen)return k;const t=e.accountHasPin,n=e.accountPinBusy;let i="",s="",o="";const r=c=>l=>{const p=l.target;p.value=p.value.replace(/\D/g,"").slice(0,6),c(p.value)},a=(c,l)=>{var f;let p=c.querySelector(".pin-modal-validation");p||(p=document.createElement("p"),p.className="login-error pin-modal-validation",(f=c.querySelector("button[type=submit]"))==null||f.before(p)),p.textContent=l},d=c=>{c.preventDefault();const l=c.target;if(!n){if(t&&!i){a(l,"Enter your current PIN");return}if(!s){a(l,"Enter a new PIN");return}if(!o){a(l,"Confirm your new PIN");return}if(s!==o){a(l,"PINs do not match");return}if(s.length<4){a(l,"PIN must be 4–6 digits");return}e.onAccountPinSave(t?i:null,s)}};return u`
|
|
1587
1698
|
<div class="setup-info-overlay" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onAccountPinModalClose()}}>
|
|
1588
1699
|
<div class="setup-info-card" style="max-width: 340px;">
|
|
1589
1700
|
<div class="setup-info-header">
|
|
@@ -1603,7 +1714,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1603
1714
|
maxlength="6"
|
|
1604
1715
|
placeholder="Current PIN"
|
|
1605
1716
|
?disabled=${n}
|
|
1606
|
-
@input=${
|
|
1717
|
+
@input=${r(c=>{i=c})}
|
|
1607
1718
|
autofocus
|
|
1608
1719
|
/>
|
|
1609
1720
|
`:k}
|
|
@@ -1616,7 +1727,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1616
1727
|
maxlength="6"
|
|
1617
1728
|
placeholder="New PIN (4–6 digits)"
|
|
1618
1729
|
?disabled=${n}
|
|
1619
|
-
@input=${
|
|
1730
|
+
@input=${r(c=>{s=c})}
|
|
1620
1731
|
${t?k:u`autofocus`}
|
|
1621
1732
|
/>
|
|
1622
1733
|
<input
|
|
@@ -1628,7 +1739,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1628
1739
|
maxlength="6"
|
|
1629
1740
|
placeholder="Confirm PIN"
|
|
1630
1741
|
?disabled=${n}
|
|
1631
|
-
@input=${
|
|
1742
|
+
@input=${r(c=>{o=c})}
|
|
1632
1743
|
/>
|
|
1633
1744
|
${e.accountPinError?u`<p class="login-error">${e.accountPinError}</p>`:k}
|
|
1634
1745
|
${e.accountPinSuccess?u`<p class="login-success">${e.accountPinSuccess}</p>`:k}
|
|
@@ -1640,7 +1751,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1640
1751
|
</form>
|
|
1641
1752
|
</div>
|
|
1642
1753
|
</div>
|
|
1643
|
-
`}function
|
|
1754
|
+
`}function Da(e){if(!e.addingWorkspace)return k;const{workspaceSaving:t}=e;return u`
|
|
1644
1755
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1645
1756
|
<div class="setup-add-account">
|
|
1646
1757
|
<strong>New Account</strong>
|
|
@@ -1693,7 +1804,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1693
1804
|
</div>
|
|
1694
1805
|
</div>
|
|
1695
1806
|
</div>
|
|
1696
|
-
`}function
|
|
1807
|
+
`}function Na(e){const t=en(e);return!t||t.isDefault?k:e.workspaceRemoveConfirm===t.name?u`
|
|
1697
1808
|
<div style="margin-top: 16px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 12px;">
|
|
1698
1809
|
<div style="font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
|
1699
1810
|
<span style="color: var(--tasker-danger, #ef4444);">Remove "${t.displayName??t.name}" and its WhatsApp account?</span>
|
|
@@ -1722,7 +1833,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1722
1833
|
@click=${i=>{i.preventDefault(),e.onSetWorkspaceRemoveConfirm(t.name)}}
|
|
1723
1834
|
>Remove Account</a>
|
|
1724
1835
|
</p>
|
|
1725
|
-
`}function
|
|
1836
|
+
`}function Ba(e){if(e.uninstallDone)return u`
|
|
1726
1837
|
<div style="margin-top: 24px; border-top: 1px solid var(--tasker-border, rgba(255,255,255,0.1)); padding-top: 16px;">
|
|
1727
1838
|
<p style="color: var(--tasker-danger, #ef4444); font-size: 13px; font-weight: 600; margin: 0 0 8px 0;">
|
|
1728
1839
|
Taskmaster has been uninstalled.
|
|
@@ -1777,11 +1888,11 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1777
1888
|
@click=${t=>{t.preventDefault(),e.onUninstallConfirm()}}
|
|
1778
1889
|
>Uninstall Taskmaster</a>
|
|
1779
1890
|
</p>
|
|
1780
|
-
`}function
|
|
1891
|
+
`}function Fa(){return u`
|
|
1781
1892
|
<p class="setup-hint" style="margin-top: 4px; font-size: 12px; opacity: 0.6;">
|
|
1782
1893
|
Need help? <a href="https://wa.me/447591215452" target="_blank" rel="noopener" style="color: var(--tasker-orange);">Message Tuesday on WhatsApp</a>
|
|
1783
1894
|
</p>
|
|
1784
|
-
`}function
|
|
1895
|
+
`}function Ag(e){const{whatsappBusy:t,whatsappLoginMessage:n,whatsappLoginQrDataUrl:i,whatsappLoginConnected:s,whatsappChannelStatus:o}=e;if(i)return u`
|
|
1785
1896
|
<div class="setup-container">
|
|
1786
1897
|
<div class="setup-card">
|
|
1787
1898
|
<h1>Scan with WhatsApp</h1>
|
|
@@ -1815,58 +1926,62 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1815
1926
|
<p>${n||"Connecting to WhatsApp..."}</p>
|
|
1816
1927
|
</div>
|
|
1817
1928
|
</div>
|
|
1818
|
-
`;const
|
|
1929
|
+
`;const r=(o==null?void 0:o.running)&&(o==null?void 0:o.connected);return o?(e.whatsappAccounts.length>1?e.whatsappAccounts.every(l=>l.running&&l.connected):r)&&e.authConnected?u`
|
|
1819
1930
|
<div class="setup-container">
|
|
1820
1931
|
<div class="setup-card setup-success setup-dashboard-wide">
|
|
1821
|
-
${
|
|
1932
|
+
${ba(e)}
|
|
1822
1933
|
<div class="setup-status-dashboard">
|
|
1823
|
-
${
|
|
1824
|
-
${
|
|
1825
|
-
${$
|
|
1826
|
-
${
|
|
1827
|
-
${e.serverPlatform==="darwin"?
|
|
1828
|
-
${
|
|
1829
|
-
${
|
|
1830
|
-
${
|
|
1831
|
-
${
|
|
1832
|
-
${
|
|
1833
|
-
${
|
|
1934
|
+
${wa(e)}
|
|
1935
|
+
${ka(e)}
|
|
1936
|
+
${$a(e)}
|
|
1937
|
+
${Sa(e)}
|
|
1938
|
+
${e.serverPlatform==="darwin"?xa(e):k}
|
|
1939
|
+
${Ia(e)}
|
|
1940
|
+
${Ea(e)}
|
|
1941
|
+
${Ca(e)}
|
|
1942
|
+
${Ta(e)}
|
|
1943
|
+
${kg(e)}
|
|
1944
|
+
${Pa(e)}
|
|
1945
|
+
${Ma(e)}
|
|
1834
1946
|
</div>
|
|
1835
1947
|
|
|
1836
|
-
${
|
|
1837
|
-
${
|
|
1838
|
-
${
|
|
1839
|
-
${
|
|
1840
|
-
${
|
|
1841
|
-
${
|
|
1842
|
-
${
|
|
1948
|
+
${Ra(e)}
|
|
1949
|
+
${_a(e)}
|
|
1950
|
+
${Sg(e)}
|
|
1951
|
+
${$g(e)}
|
|
1952
|
+
${Aa(e)}
|
|
1953
|
+
${Da(e)}
|
|
1954
|
+
${Na(e)}
|
|
1955
|
+
${Ba(e)}
|
|
1956
|
+
${Fa()}
|
|
1843
1957
|
${e.workspacesError?u`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:k}
|
|
1844
1958
|
</div>
|
|
1845
1959
|
</div>
|
|
1846
1960
|
`:u`
|
|
1847
1961
|
<div class="setup-container">
|
|
1848
1962
|
<div class="setup-card setup-dashboard-wide">
|
|
1849
|
-
${
|
|
1963
|
+
${ba(e)}
|
|
1850
1964
|
<div class="setup-status-dashboard">
|
|
1851
|
-
${
|
|
1852
|
-
${
|
|
1853
|
-
${$
|
|
1854
|
-
${
|
|
1855
|
-
${e.serverPlatform==="darwin"?
|
|
1856
|
-
${
|
|
1857
|
-
${
|
|
1858
|
-
${
|
|
1859
|
-
${
|
|
1860
|
-
${
|
|
1965
|
+
${wa(e)}
|
|
1966
|
+
${ka(e)}
|
|
1967
|
+
${$a(e)}
|
|
1968
|
+
${Sa(e)}
|
|
1969
|
+
${e.serverPlatform==="darwin"?xa(e):k}
|
|
1970
|
+
${Ia(e)}
|
|
1971
|
+
${Ea(e)}
|
|
1972
|
+
${Ca(e)}
|
|
1973
|
+
${Ta(e)}
|
|
1974
|
+
${Pa(e)}
|
|
1975
|
+
${Ma(e)}
|
|
1861
1976
|
</div>
|
|
1862
1977
|
|
|
1863
|
-
${
|
|
1864
|
-
${
|
|
1865
|
-
${
|
|
1866
|
-
${
|
|
1867
|
-
${
|
|
1868
|
-
${
|
|
1869
|
-
${
|
|
1978
|
+
${Ra(e)}
|
|
1979
|
+
${_a(e)}
|
|
1980
|
+
${Aa(e)}
|
|
1981
|
+
${Da(e)}
|
|
1982
|
+
${Na(e)}
|
|
1983
|
+
${Ba(e)}
|
|
1984
|
+
${Fa()}
|
|
1870
1985
|
${e.workspacesError?u`<p class="setup-error" style="margin-top: 8px;">${e.workspacesError}</p>`:k}
|
|
1871
1986
|
</div>
|
|
1872
1987
|
</div>
|
|
@@ -1875,7 +1990,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1875
1990
|
<div class="setup-card">
|
|
1876
1991
|
${Ae("whatsapp")}
|
|
1877
1992
|
<div class="setup-status-row">
|
|
1878
|
-
${
|
|
1993
|
+
${j("bad")}
|
|
1879
1994
|
<span>Connection Failed</span>
|
|
1880
1995
|
</div>
|
|
1881
1996
|
<p class="setup-error">${n}</p>
|
|
@@ -1911,7 +2026,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1911
2026
|
</button>
|
|
1912
2027
|
</div>
|
|
1913
2028
|
</div>
|
|
1914
|
-
`}function
|
|
2029
|
+
`}function Eg(e){const{connected:t,currentStep:n}=e;if(t&&Pi()&&or(),e.uninstallDone||!t&&Pi())return u`
|
|
1915
2030
|
<div class="setup-container">
|
|
1916
2031
|
<div class="setup-card">
|
|
1917
2032
|
<p style="color: var(--tasker-danger, #ef4444); font-size: 16px; font-weight: 600; margin: 0 0 12px 0;">
|
|
@@ -1934,7 +2049,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1934
2049
|
<p>${o?"Restarting gateway after update…":"Connecting to gateway..."}</p>
|
|
1935
2050
|
</div>
|
|
1936
2051
|
</div>
|
|
1937
|
-
`}let i;switch(n){case"license":i=
|
|
2052
|
+
`}let i;switch(n){case"license":i=va(e);break;case"auth":i=hg(e);break;case"whatsapp":case"complete":i=Ag(e);break;default:i=va(e)}const s=Mt("Setup",e.wsProps);return u`${i}${pg(e)}${vg(e)}${yg(e)}${xg(e)}${s}`}function Cg(e,t){const n=e.paired?"Paired phone (used to link WhatsApp)":"Admin access via WhatsApp DM";return u`
|
|
1938
2053
|
<div class="sp-list-item">
|
|
1939
2054
|
<div class="sp-list-item-main">
|
|
1940
2055
|
<div class="sp-list-item-title">${e.phone}</div>
|
|
@@ -1949,7 +2064,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1949
2064
|
Remove
|
|
1950
2065
|
</button>`}
|
|
1951
2066
|
</div>
|
|
1952
|
-
`}function
|
|
2067
|
+
`}function Tg(e){if(!e.connected)return u`
|
|
1953
2068
|
<div class="setup-container">
|
|
1954
2069
|
<div class="setup-card">
|
|
1955
2070
|
<div class="setup-spinner"></div>
|
|
@@ -1998,7 +2113,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
1998
2113
|
</form>
|
|
1999
2114
|
|
|
2000
2115
|
<div class="sp-list" style="margin-top: 20px;">
|
|
2001
|
-
${e.phones.length===0?u`<div class="sp-list-empty">No admin phones configured yet.</div>`:e.phones.map(n=>
|
|
2116
|
+
${e.phones.length===0?u`<div class="sp-list-empty">No admin phones configured yet.</div>`:e.phones.map(n=>Cg(n,e))}
|
|
2002
2117
|
</div>
|
|
2003
2118
|
|
|
2004
2119
|
<div class="setup-hint" style="margin-top: 20px; padding: 14px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; text-align: left;">
|
|
@@ -2009,13 +2124,13 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2009
2124
|
|
|
2010
2125
|
</div>
|
|
2011
2126
|
</div>
|
|
2012
|
-
`}const
|
|
2127
|
+
`}const vd=u`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`;function _g(e){return Object.keys(e.fields).length}function Mg(e,t){return u`
|
|
2013
2128
|
<div class="event-modal-overlay" @click=${t.onDeleteConfirmClose}>
|
|
2014
2129
|
<div class="event-modal" style="width: min(400px, 100%);" @click=${n=>n.stopPropagation()}>
|
|
2015
2130
|
<div class="event-modal__header">
|
|
2016
2131
|
<div class="event-modal__title">Delete Contact</div>
|
|
2017
2132
|
<button class="event-modal__close" @click=${t.onDeleteConfirmClose}>
|
|
2018
|
-
${
|
|
2133
|
+
${vd}
|
|
2019
2134
|
</button>
|
|
2020
2135
|
</div>
|
|
2021
2136
|
<p style="margin: 0 0 8px; color: rgba(255,255,255,0.7); font-size: 14px; line-height: 1.5;">
|
|
@@ -2041,13 +2156,13 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2041
2156
|
</div>
|
|
2042
2157
|
</div>
|
|
2043
2158
|
</div>
|
|
2044
|
-
`}function
|
|
2159
|
+
`}function Pg(e,t){const n=t.addFieldKey.trim().length>0,i=s=>{s.preventDefault(),n&&t.onAddFieldSubmit()};return u`
|
|
2045
2160
|
<div class="event-modal-overlay" @click=${t.onAddFieldClose}>
|
|
2046
2161
|
<div class="event-modal" style="width: min(400px, 100%);" @click=${s=>s.stopPropagation()}>
|
|
2047
2162
|
<div class="event-modal__header">
|
|
2048
2163
|
<div class="event-modal__title">Add Field</div>
|
|
2049
2164
|
<button class="event-modal__close" @click=${t.onAddFieldClose}>
|
|
2050
|
-
${
|
|
2165
|
+
${vd}
|
|
2051
2166
|
</button>
|
|
2052
2167
|
</div>
|
|
2053
2168
|
<p style="margin: 0 0 16px; color: rgba(255,255,255,0.5); font-size: 13px;">
|
|
@@ -2092,7 +2207,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2092
2207
|
</form>
|
|
2093
2208
|
</div>
|
|
2094
2209
|
</div>
|
|
2095
|
-
`}function
|
|
2210
|
+
`}function Lg(e,t){const n=Object.entries(e.fields);return u`
|
|
2096
2211
|
<div class="contacts-record-fields">
|
|
2097
2212
|
${n.length===0?u`<div style="color: rgba(255,255,255,0.4); font-size: 13px; margin-top: 12px;">No fields yet. Add one below.</div>`:n.map(([i,s])=>u`
|
|
2098
2213
|
<div class="contacts-field-row">
|
|
@@ -2139,7 +2254,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2139
2254
|
</button>
|
|
2140
2255
|
</div>
|
|
2141
2256
|
</div>
|
|
2142
|
-
`}function
|
|
2257
|
+
`}function Ig(e,t){const n=t.editingId===e.id,i=_g(e),s=i===0?"No fields":`${i} field${i>1?"s":""}`;return u`
|
|
2143
2258
|
<div class="contacts-record">
|
|
2144
2259
|
<div
|
|
2145
2260
|
class="contacts-record-header"
|
|
@@ -2151,9 +2266,9 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2151
2266
|
</div>
|
|
2152
2267
|
<span class="contacts-record-meta">${s}</span>
|
|
2153
2268
|
</div>
|
|
2154
|
-
${n?
|
|
2269
|
+
${n?Lg(e,t):k}
|
|
2155
2270
|
</div>
|
|
2156
|
-
`}function
|
|
2271
|
+
`}function Rg(e){if(!e.connected)return u`
|
|
2157
2272
|
<div class="setup-container">
|
|
2158
2273
|
<div class="setup-card">
|
|
2159
2274
|
<div class="setup-spinner"></div>
|
|
@@ -2249,7 +2364,7 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2249
2364
|
<div style="margin-top: 16px;">
|
|
2250
2365
|
${e.records.length===0?u`<div class="contacts-empty">
|
|
2251
2366
|
${e.searchQuery.trim()?`No records matching "${e.searchQuery}".`:"No contact records yet. Add one to get started."}
|
|
2252
|
-
</div>`:e.records.map(o=>
|
|
2367
|
+
</div>`:e.records.map(o=>Ig(o,e))}
|
|
2253
2368
|
</div>
|
|
2254
2369
|
|
|
2255
2370
|
<div class="setup-hint" style="margin-top: 20px; padding: 14px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; text-align: left;">
|
|
@@ -2261,99 +2376,99 @@ ${o}`)}return e.chatStream="","working"}else if(t.state==="block"){const s=Sn(t.
|
|
|
2261
2376
|
</div>
|
|
2262
2377
|
</div>
|
|
2263
2378
|
|
|
2264
|
-
${i?
|
|
2265
|
-
${s?
|
|
2266
|
-
`}const vd={CHILD:2},bd=e=>(...t)=>({_$litDirective$:e,values:t});let wd=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,i){this._$Ct=t,this._$AM=n,this._$Ci=i}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:Lg}=pp,Or=e=>e,Ur=()=>document.createComment(""),ln=(e,t,n)=>{var o;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const a=i.insertBefore(Ur(),s),r=i.insertBefore(Ur(),s);n=new Lg(a,r,e,e.options)}else{const a=n._$AB.nextSibling,r=n._$AM,d=r!==e;if(d){let c;(o=n._$AQ)==null||o.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==r._$AU&&n._$AP(c)}if(a!==s||d){let c=n._$AA;for(;c!==a;){const l=Or(c).nextSibling;Or(i).insertBefore(c,s),c=l}}}return n},ht=(e,t,n=e)=>(e._$AI(t,n),e),Ig={},Rg=(e,t=Ig)=>e._$AH=t,Dg=e=>e._$AH,_s=e=>{e._$AR(),e._$AA.remove()};const Kr=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},Bg=bd(class extends wd{constructor(e){if(super(e),e.type!==vd.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;n===void 0?n=t:t!==void 0&&(i=t);const s=[],o=[];let a=0;for(const r of e)s[a]=i?i(r,a):a,o[a]=n(r,a),a++;return{values:o,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=Dg(e),{values:o,keys:a}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=a,o;const r=this.ut??(this.ut=[]),d=[];let c,l,p=0,h=s.length-1,v=0,S=o.length-1;for(;p<=h&&v<=S;)if(s[p]===null)p++;else if(s[h]===null)h--;else if(r[p]===a[v])d[v]=ht(s[p],o[v]),p++,v++;else if(r[h]===a[S])d[S]=ht(s[h],o[S]),h--,S--;else if(r[p]===a[S])d[S]=ht(s[p],o[S]),ln(e,d[S+1],s[p]),p++,S--;else if(r[h]===a[v])d[v]=ht(s[h],o[v]),ln(e,s[p],s[h]),h--,v++;else if(c===void 0&&(c=Kr(a,v,S),l=Kr(r,p,h)),c.has(r[p]))if(c.has(r[h])){const f=l.get(a[v]),w=f!==void 0?s[f]:null;if(w===null){const b=ln(e,s[p]);ht(b,o[v]),d[v]=b}else d[v]=ht(w,o[v]),ln(e,s[p],w),s[f]=null;v++}else _s(s[h]),h--;else _s(s[p]),p++;for(;v<=S;){const f=ln(e,d[S+1]);ht(f,o[v]),d[v++]=f}for(;p<=h;){const f=s[p++];f!==null&&_s(f)}return this.ut=a,Rg(e,d),it}});class ho extends wd{constructor(t){if(super(t),this.it=k,t.type!==vd.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===k||t==null)return this._t=void 0,this.it=t;if(t===it)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:[]}}}ho.directiveName="unsafeHTML",ho.resultType=1;const Li=bd(ho);const{entries:kd,setPrototypeOf:Wr,isFrozen:Ng,getPrototypeOf:Fg,getOwnPropertyDescriptor:Og}=Object;let{freeze:ge,seal:we,create:fo}=Object,{apply:go,construct:mo}=typeof Reflect<"u"&&Reflect;ge||(ge=function(t){return t});we||(we=function(t){return t});go||(go=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(n,s)});mo||(mo=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const ai=me(Array.prototype.forEach),Ug=me(Array.prototype.lastIndexOf),zr=me(Array.prototype.pop),cn=me(Array.prototype.push),Kg=me(Array.prototype.splice),yi=me(String.prototype.toLowerCase),Ms=me(String.prototype.toString),Ps=me(String.prototype.match),dn=me(String.prototype.replace),Wg=me(String.prototype.indexOf),zg=me(String.prototype.trim),ke=me(Object.prototype.hasOwnProperty),ue=me(RegExp.prototype.test),un=qg(TypeError);function me(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return go(e,t,i)}}function qg(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return mo(e,n)}}function U(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yi;Wr&&Wr(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(Ng(t)||(t[i]=o),s=o)}e[s]=!0}return e}function Hg(e){for(let t=0;t<e.length;t++)ke(e,t)||(e[t]=null);return e}function Le(e){const t=fo(null);for(const[n,i]of kd(e))ke(e,n)&&(Array.isArray(i)?t[n]=Hg(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Le(i):t[n]=i);return t}function pn(e,t){for(;e!==null;){const i=Og(e,t);if(i){if(i.get)return me(i.get);if(typeof i.value=="function")return me(i.value)}e=Fg(e)}function n(){return null}return n}const qr=ge(["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"]),Ls=ge(["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"]),Is=ge(["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"]),jg=ge(["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"]),Rs=ge(["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"]),Vg=ge(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Hr=ge(["#text"]),jr=ge(["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"]),Ds=ge(["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"]),Vr=ge(["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"]),ri=ge(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Gg=we(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qg=we(/<%[\w\W]*|[\w\W]*%>/gm),Yg=we(/\$\{[\w\W]*/gm),Jg=we(/^data-[\-\w.\u00B7-\uFFFF]+$/),Xg=we(/^aria-[\-\w]+$/),$d=we(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zg=we(/^(?:\w+script|data):/i),em=we(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sd=we(/^html$/i),tm=we(/^[a-z][.\w]*(-[.\w]+)+$/i);var Gr=Object.freeze({__proto__:null,ARIA_ATTR:Xg,ATTR_WHITESPACE:em,CUSTOM_ELEMENT:tm,DATA_ATTR:Jg,DOCTYPE_NAME:Sd,ERB_EXPR:Qg,IS_ALLOWED_URI:$d,IS_SCRIPT_OR_DATA:Zg,MUSTACHE_EXPR:Gg,TMPLIT_EXPR:Yg});const hn={element:1,text:3,progressingInstruction:7,comment:8,document:9},nm=function(){return typeof window>"u"?null:window},im=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Qr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nm();const t=D=>xd(D);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==hn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:r,Element:d,NodeFilter:c,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:v}=e,S=d.prototype,f=pn(S,"cloneNode"),w=pn(S,"remove"),b=pn(S,"nextSibling"),x=pn(S,"childNodes"),C=pn(S,"parentNode");if(typeof a=="function"){const D=n.createElement("template");D.content&&D.content.ownerDocument&&(n=D.content.ownerDocument)}let T,P="";const{implementation:_,createNodeIterator:N,createDocumentFragment:H,getElementsByTagName:ie}=n,{importNode:be}=i;let X=Qr();t.isSupported=typeof kd=="function"&&typeof C=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:rt,ERB_EXPR:It,TMPLIT_EXPR:lt,DATA_ATTR:ss,ARIA_ATTR:os,IS_SCRIPT_OR_DATA:as,ATTR_WHITESPACE:Kn,CUSTOM_ELEMENT:rs}=Gr;let{IS_ALLOWED_URI:Wn}=Gr,Z=null;const zn=U({},[...qr,...Ls,...Is,...Rs,...Hr]);let ee=null;const qn=U({},[...jr,...Ds,...Vr,...ri]);let Q=Object.seal(fo(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}})),ct=null,nn=null;const Je=Object.seal(fo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Hn=!0,A=!0,M=!1,F=!0,O=!1,Y=!0,j=!1,de=!1,Xe=!1,Rt=!1,jn=!1,Vn=!1,Ea=!0,Ta=!1;const Du="user-content-";let ls=!0,sn=!1,Dt={},Te=null;const cs=U({},["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 _a=null;const Ma=U({},["audio","video","img","source","image","track"]);let ds=null;const Pa=U({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gn="http://www.w3.org/1998/Math/MathML",Qn="http://www.w3.org/2000/svg",Ue="http://www.w3.org/1999/xhtml";let Bt=Ue,us=!1,ps=null;const Bu=U({},[Gn,Qn,Ue],Ms);let Yn=U({},["mi","mo","mn","ms","mtext"]),Jn=U({},["annotation-xml"]);const Nu=U({},["title","style","font","a","script"]);let on=null;const Fu=["application/xhtml+xml","text/html"],Ou="text/html";let ne=null,Nt=null;const Uu=n.createElement("form"),La=function($){return $ instanceof RegExp||$ instanceof Function},hs=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Nt&&Nt===$)){if((!$||typeof $!="object")&&($={}),$=Le($),on=Fu.indexOf($.PARSER_MEDIA_TYPE)===-1?Ou:$.PARSER_MEDIA_TYPE,ne=on==="application/xhtml+xml"?Ms:yi,Z=ke($,"ALLOWED_TAGS")?U({},$.ALLOWED_TAGS,ne):zn,ee=ke($,"ALLOWED_ATTR")?U({},$.ALLOWED_ATTR,ne):qn,ps=ke($,"ALLOWED_NAMESPACES")?U({},$.ALLOWED_NAMESPACES,Ms):Bu,ds=ke($,"ADD_URI_SAFE_ATTR")?U(Le(Pa),$.ADD_URI_SAFE_ATTR,ne):Pa,_a=ke($,"ADD_DATA_URI_TAGS")?U(Le(Ma),$.ADD_DATA_URI_TAGS,ne):Ma,Te=ke($,"FORBID_CONTENTS")?U({},$.FORBID_CONTENTS,ne):cs,ct=ke($,"FORBID_TAGS")?U({},$.FORBID_TAGS,ne):Le({}),nn=ke($,"FORBID_ATTR")?U({},$.FORBID_ATTR,ne):Le({}),Dt=ke($,"USE_PROFILES")?$.USE_PROFILES:!1,Hn=$.ALLOW_ARIA_ATTR!==!1,A=$.ALLOW_DATA_ATTR!==!1,M=$.ALLOW_UNKNOWN_PROTOCOLS||!1,F=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=$.SAFE_FOR_TEMPLATES||!1,Y=$.SAFE_FOR_XML!==!1,j=$.WHOLE_DOCUMENT||!1,Rt=$.RETURN_DOM||!1,jn=$.RETURN_DOM_FRAGMENT||!1,Vn=$.RETURN_TRUSTED_TYPE||!1,Xe=$.FORCE_BODY||!1,Ea=$.SANITIZE_DOM!==!1,Ta=$.SANITIZE_NAMED_PROPS||!1,ls=$.KEEP_CONTENT!==!1,sn=$.IN_PLACE||!1,Wn=$.ALLOWED_URI_REGEXP||$d,Bt=$.NAMESPACE||Ue,Yn=$.MATHML_TEXT_INTEGRATION_POINTS||Yn,Jn=$.HTML_INTEGRATION_POINTS||Jn,Q=$.CUSTOM_ELEMENT_HANDLING||{},$.CUSTOM_ELEMENT_HANDLING&&La($.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=$.CUSTOM_ELEMENT_HANDLING.tagNameCheck),$.CUSTOM_ELEMENT_HANDLING&&La($.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=$.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=$.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),O&&(A=!1),jn&&(Rt=!0),Dt&&(Z=U({},Hr),ee=[],Dt.html===!0&&(U(Z,qr),U(ee,jr)),Dt.svg===!0&&(U(Z,Ls),U(ee,Ds),U(ee,ri)),Dt.svgFilters===!0&&(U(Z,Is),U(ee,Ds),U(ee,ri)),Dt.mathMl===!0&&(U(Z,Rs),U(ee,Vr),U(ee,ri))),$.ADD_TAGS&&(typeof $.ADD_TAGS=="function"?Je.tagCheck=$.ADD_TAGS:(Z===zn&&(Z=Le(Z)),U(Z,$.ADD_TAGS,ne))),$.ADD_ATTR&&(typeof $.ADD_ATTR=="function"?Je.attributeCheck=$.ADD_ATTR:(ee===qn&&(ee=Le(ee)),U(ee,$.ADD_ATTR,ne))),$.ADD_URI_SAFE_ATTR&&U(ds,$.ADD_URI_SAFE_ATTR,ne),$.FORBID_CONTENTS&&(Te===cs&&(Te=Le(Te)),U(Te,$.FORBID_CONTENTS,ne)),$.ADD_FORBID_CONTENTS&&(Te===cs&&(Te=Le(Te)),U(Te,$.ADD_FORBID_CONTENTS,ne)),ls&&(Z["#text"]=!0),j&&U(Z,["html","head","body"]),Z.table&&(U(Z,["tbody"]),delete ct.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=$.TRUSTED_TYPES_POLICY,P=T.createHTML("")}else T===void 0&&(T=im(v,s)),T!==null&&typeof P=="string"&&(P=T.createHTML(""));ge&&ge($),Nt=$}},Ia=U({},[...Ls,...Is,...jg]),Ra=U({},[...Rs,...Vg]),Ku=function($){let E=C($);(!E||!E.tagName)&&(E={namespaceURI:Bt,tagName:"template"});const R=yi($.tagName),V=yi(E.tagName);return ps[$.namespaceURI]?$.namespaceURI===Qn?E.namespaceURI===Ue?R==="svg":E.namespaceURI===Gn?R==="svg"&&(V==="annotation-xml"||Yn[V]):!!Ia[R]:$.namespaceURI===Gn?E.namespaceURI===Ue?R==="math":E.namespaceURI===Qn?R==="math"&&Jn[V]:!!Ra[R]:$.namespaceURI===Ue?E.namespaceURI===Qn&&!Jn[V]||E.namespaceURI===Gn&&!Yn[V]?!1:!Ra[R]&&(Nu[R]||!Ia[R]):!!(on==="application/xhtml+xml"&&ps[$.namespaceURI]):!1},_e=function($){cn(t.removed,{element:$});try{C($).removeChild($)}catch{w($)}},dt=function($,E){try{cn(t.removed,{attribute:E.getAttributeNode($),from:E})}catch{cn(t.removed,{attribute:null,from:E})}if(E.removeAttribute($),$==="is")if(Rt||jn)try{_e(E)}catch{}else try{E.setAttribute($,"")}catch{}},Da=function($){let E=null,R=null;if(Xe)$="<remove></remove>"+$;else{const te=Ps($,/^[\r\n\t ]+/);R=te&&te[0]}on==="application/xhtml+xml"&&Bt===Ue&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const V=T?T.createHTML($):$;if(Bt===Ue)try{E=new h().parseFromString(V,on)}catch{}if(!E||!E.documentElement){E=_.createDocument(Bt,"template",null);try{E.documentElement.innerHTML=us?P:V}catch{}}const re=E.body||E.documentElement;return $&&R&&re.insertBefore(n.createTextNode(R),re.childNodes[0]||null),Bt===Ue?ie.call(E,j?"html":"body")[0]:j?E.documentElement:re},Ba=function($){return N.call($.ownerDocument||$,$,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},fs=function($){return $ instanceof p&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof l)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},Na=function($){return typeof r=="function"&&$ instanceof r};function Ke(D,$,E){ai(D,R=>{R.call(t,$,E,Nt)})}const Fa=function($){let E=null;if(Ke(X.beforeSanitizeElements,$,null),fs($))return _e($),!0;const R=ne($.nodeName);if(Ke(X.uponSanitizeElement,$,{tagName:R,allowedTags:Z}),Y&&$.hasChildNodes()&&!Na($.firstElementChild)&&ue(/<[/\w!]/g,$.innerHTML)&&ue(/<[/\w!]/g,$.textContent)||$.nodeType===hn.progressingInstruction||Y&&$.nodeType===hn.comment&&ue(/<[/\w]/g,$.data))return _e($),!0;if(!(Je.tagCheck instanceof Function&&Je.tagCheck(R))&&(!Z[R]||ct[R])){if(!ct[R]&&Ua(R)&&(Q.tagNameCheck instanceof RegExp&&ue(Q.tagNameCheck,R)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(R)))return!1;if(ls&&!Te[R]){const V=C($)||$.parentNode,re=x($)||$.childNodes;if(re&&V){const te=re.length;for(let ye=te-1;ye>=0;--ye){const We=f(re[ye],!0);We.__removalCount=($.__removalCount||0)+1,V.insertBefore(We,b($))}}}return _e($),!0}return $ instanceof d&&!Ku($)||(R==="noscript"||R==="noembed"||R==="noframes")&&ue(/<\/no(script|embed|frames)/i,$.innerHTML)?(_e($),!0):(O&&$.nodeType===hn.text&&(E=$.textContent,ai([rt,It,lt],V=>{E=dn(E,V," ")}),$.textContent!==E&&(cn(t.removed,{element:$.cloneNode()}),$.textContent=E)),Ke(X.afterSanitizeElements,$,null),!1)},Oa=function($,E,R){if(Ea&&(E==="id"||E==="name")&&(R in n||R in Uu))return!1;if(!(A&&!nn[E]&&ue(ss,E))){if(!(Hn&&ue(os,E))){if(!(Je.attributeCheck instanceof Function&&Je.attributeCheck(E,$))){if(!ee[E]||nn[E]){if(!(Ua($)&&(Q.tagNameCheck instanceof RegExp&&ue(Q.tagNameCheck,$)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck($))&&(Q.attributeNameCheck instanceof RegExp&&ue(Q.attributeNameCheck,E)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(E,$))||E==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&ue(Q.tagNameCheck,R)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(R))))return!1}else if(!ds[E]){if(!ue(Wn,dn(R,Kn,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&$!=="script"&&Wg(R,"data:")===0&&_a[$])){if(!(M&&!ue(as,dn(R,Kn,"")))){if(R)return!1}}}}}}}return!0},Ua=function($){return $!=="annotation-xml"&&Ps($,rs)},Ka=function($){Ke(X.beforeSanitizeAttributes,$,null);const{attributes:E}=$;if(!E||fs($))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ee,forceKeepAttr:void 0};let V=E.length;for(;V--;){const re=E[V],{name:te,namespaceURI:ye,value:We}=re,Ft=ne(te),gs=We;let oe=te==="value"?gs:zg(gs);if(R.attrName=Ft,R.attrValue=oe,R.keepAttr=!0,R.forceKeepAttr=void 0,Ke(X.uponSanitizeAttribute,$,R),oe=R.attrValue,Ta&&(Ft==="id"||Ft==="name")&&(dt(te,$),oe=Du+oe),Y&&ue(/((--!?|])>)|<\/(style|title|textarea)/i,oe)){dt(te,$);continue}if(Ft==="attributename"&&Ps(oe,"href")){dt(te,$);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){dt(te,$);continue}if(!F&&ue(/\/>/i,oe)){dt(te,$);continue}O&&ai([rt,It,lt],za=>{oe=dn(oe,za," ")});const Wa=ne($.nodeName);if(!Oa(Wa,Ft,oe)){dt(te,$);continue}if(T&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!ye)switch(v.getAttributeType(Wa,Ft)){case"TrustedHTML":{oe=T.createHTML(oe);break}case"TrustedScriptURL":{oe=T.createScriptURL(oe);break}}if(oe!==gs)try{ye?$.setAttributeNS(ye,te,oe):$.setAttribute(te,oe),fs($)?_e($):zr(t.removed)}catch{dt(te,$)}}Ke(X.afterSanitizeAttributes,$,null)},Wu=function D($){let E=null;const R=Ba($);for(Ke(X.beforeSanitizeShadowDOM,$,null);E=R.nextNode();)Ke(X.uponSanitizeShadowNode,E,null),Fa(E),Ka(E),E.content instanceof o&&D(E.content);Ke(X.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(D){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,R=null,V=null,re=null;if(us=!D,us&&(D="<!-->"),typeof D!="string"&&!Na(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw un("dirty is not a string, aborting")}else throw un("toString is not a function");if(!t.isSupported)return D;if(de||hs($),t.removed=[],typeof D=="string"&&(sn=!1),sn){if(D.nodeName){const We=ne(D.nodeName);if(!Z[We]||ct[We])throw un("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof r)E=Da("<!---->"),R=E.ownerDocument.importNode(D,!0),R.nodeType===hn.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?E=R:E.appendChild(R);else{if(!Rt&&!O&&!j&&D.indexOf("<")===-1)return T&&Vn?T.createHTML(D):D;if(E=Da(D),!E)return Rt?null:Vn?P:""}E&&Xe&&_e(E.firstChild);const te=Ba(sn?D:E);for(;V=te.nextNode();)Fa(V),Ka(V),V.content instanceof o&&Wu(V.content);if(sn)return D;if(Rt){if(jn)for(re=H.call(E.ownerDocument);E.firstChild;)re.appendChild(E.firstChild);else re=E;return(ee.shadowroot||ee.shadowrootmode)&&(re=be.call(i,re,!0)),re}let ye=j?E.outerHTML:E.innerHTML;return j&&Z["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&ue(Sd,E.ownerDocument.doctype.name)&&(ye="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
|
|
2267
|
-
`+ye),O&&
|
|
2268
|
-
]`).replace("lheading",
|
|
2269
|
-
`).map(o=>{let
|
|
2270
|
-
`)}var Ri=class{constructor(e){
|
|
2271
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=
|
|
2379
|
+
${i?Mg(i,e):k}
|
|
2380
|
+
${s?Pg(s,e):k}
|
|
2381
|
+
`}const bd={CHILD:2},wd=e=>(...t)=>({_$litDirective$:e,values:t});let kd=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,i){this._$Ct=t,this._$AM=n,this._$Ci=i}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:Dg}=hp,Oa=e=>e,Ua=()=>document.createComment(""),ln=(e,t,n)=>{var o;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const r=i.insertBefore(Ua(),s),a=i.insertBefore(Ua(),s);n=new Dg(r,a,e,e.options)}else{const r=n._$AB.nextSibling,a=n._$AM,d=a!==e;if(d){let c;(o=n._$AQ)==null||o.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==a._$AU&&n._$AP(c)}if(r!==s||d){let c=n._$AA;for(;c!==r;){const l=Oa(c).nextSibling;Oa(i).insertBefore(c,s),c=l}}}return n},ht=(e,t,n=e)=>(e._$AI(t,n),e),Ng={},Bg=(e,t=Ng)=>e._$AH=t,Fg=e=>e._$AH,_s=e=>{e._$AR(),e._$AA.remove()};const Wa=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},Og=wd(class extends kd{constructor(e){if(super(e),e.type!==bd.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;n===void 0?n=t:t!==void 0&&(i=t);const s=[],o=[];let r=0;for(const a of e)s[r]=i?i(a,r):r,o[r]=n(a,r),r++;return{values:o,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=Fg(e),{values:o,keys:r}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=r,o;const a=this.ut??(this.ut=[]),d=[];let c,l,p=0,f=s.length-1,v=0,S=o.length-1;for(;p<=f&&v<=S;)if(s[p]===null)p++;else if(s[f]===null)f--;else if(a[p]===r[v])d[v]=ht(s[p],o[v]),p++,v++;else if(a[f]===r[S])d[S]=ht(s[f],o[S]),f--,S--;else if(a[p]===r[S])d[S]=ht(s[p],o[S]),ln(e,d[S+1],s[p]),p++,S--;else if(a[f]===r[v])d[v]=ht(s[f],o[v]),ln(e,s[p],s[f]),f--,v++;else if(c===void 0&&(c=Wa(r,v,S),l=Wa(a,p,f)),c.has(a[p]))if(c.has(a[f])){const h=l.get(r[v]),b=h!==void 0?s[h]:null;if(b===null){const w=ln(e,s[p]);ht(w,o[v]),d[v]=w}else d[v]=ht(b,o[v]),ln(e,s[p],b),s[h]=null;v++}else _s(s[f]),f--;else _s(s[p]),p++;for(;v<=S;){const h=ln(e,d[S+1]);ht(h,o[v]),d[v++]=h}for(;p<=f;){const h=s[p++];h!==null&&_s(h)}return this.ut=r,Bg(e,d),it}});class ho extends kd{constructor(t){if(super(t),this.it=k,t.type!==bd.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===k||t==null)return this._t=void 0,this.it=t;if(t===it)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:[]}}}ho.directiveName="unsafeHTML",ho.resultType=1;const Li=wd(ho);const{entries:$d,setPrototypeOf:Ka,isFrozen:Ug,getPrototypeOf:Wg,getOwnPropertyDescriptor:Kg}=Object;let{freeze:ge,seal:we,create:fo}=Object,{apply:go,construct:mo}=typeof Reflect<"u"&&Reflect;ge||(ge=function(t){return t});we||(we=function(t){return t});go||(go=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(n,s)});mo||(mo=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const ri=me(Array.prototype.forEach),zg=me(Array.prototype.lastIndexOf),za=me(Array.prototype.pop),cn=me(Array.prototype.push),Hg=me(Array.prototype.splice),yi=me(String.prototype.toLowerCase),Ms=me(String.prototype.toString),Ps=me(String.prototype.match),dn=me(String.prototype.replace),qg=me(String.prototype.indexOf),jg=me(String.prototype.trim),ke=me(Object.prototype.hasOwnProperty),pe=me(RegExp.prototype.test),un=Vg(TypeError);function me(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return go(e,t,i)}}function Vg(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return mo(e,n)}}function U(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yi;Ka&&Ka(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(Ug(t)||(t[i]=o),s=o)}e[s]=!0}return e}function Gg(e){for(let t=0;t<e.length;t++)ke(e,t)||(e[t]=null);return e}function Le(e){const t=fo(null);for(const[n,i]of $d(e))ke(e,n)&&(Array.isArray(i)?t[n]=Gg(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Le(i):t[n]=i);return t}function pn(e,t){for(;e!==null;){const i=Kg(e,t);if(i){if(i.get)return me(i.get);if(typeof i.value=="function")return me(i.value)}e=Wg(e)}function n(){return null}return n}const Ha=ge(["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"]),Ls=ge(["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"]),Is=ge(["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"]),Qg=ge(["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"]),Rs=ge(["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"]),Jg=ge(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qa=ge(["#text"]),ja=ge(["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"]),Ds=ge(["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"]),Va=ge(["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"]),ai=ge(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yg=we(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xg=we(/<%[\w\W]*|[\w\W]*%>/gm),Zg=we(/\$\{[\w\W]*/gm),em=we(/^data-[\-\w.\u00B7-\uFFFF]+$/),tm=we(/^aria-[\-\w]+$/),Sd=we(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),nm=we(/^(?:\w+script|data):/i),im=we(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xd=we(/^html$/i),sm=we(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ga=Object.freeze({__proto__:null,ARIA_ATTR:tm,ATTR_WHITESPACE:im,CUSTOM_ELEMENT:sm,DATA_ATTR:em,DOCTYPE_NAME:xd,ERB_EXPR:Xg,IS_ALLOWED_URI:Sd,IS_SCRIPT_OR_DATA:nm,MUSTACHE_EXPR:Yg,TMPLIT_EXPR:Zg});const hn={element:1,text:3,progressingInstruction:7,comment:8,document:9},om=function(){return typeof window>"u"?null:window},rm=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Qa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ad(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:om();const t=D=>Ad(D);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==hn.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:a,Element:d,NodeFilter:c,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:f,trustedTypes:v}=e,S=d.prototype,h=pn(S,"cloneNode"),b=pn(S,"remove"),w=pn(S,"nextSibling"),x=pn(S,"childNodes"),A=pn(S,"parentNode");if(typeof r=="function"){const D=n.createElement("template");D.content&&D.content.ownerDocument&&(n=D.content.ownerDocument)}let C,P="";const{implementation:_,createNodeIterator:B,createDocumentFragment:z,getElementsByTagName:te}=n,{importNode:be}=i;let X=Qa();t.isSupported=typeof $d=="function"&&typeof A=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:at,ERB_EXPR:It,TMPLIT_EXPR:lt,DATA_ATTR:ss,ARIA_ATTR:os,IS_SCRIPT_OR_DATA:rs,ATTR_WHITESPACE:Wn,CUSTOM_ELEMENT:as}=Ga;let{IS_ALLOWED_URI:Kn}=Ga,Z=null;const zn=U({},[...Ha,...Ls,...Is,...Rs,...qa]);let ee=null;const Hn=U({},[...ja,...Ds,...Va,...ai]);let Q=Object.seal(fo(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}})),ct=null,nn=null;const Ye=Object.seal(fo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let qn=!0,E=!0,M=!1,F=!0,O=!1,J=!0,V=!1,ue=!1,Xe=!1,Rt=!1,jn=!1,Vn=!1,Cr=!0,Tr=!1;const Nu="user-content-";let ls=!0,sn=!1,Dt={},Te=null;const cs=U({},["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 _r=null;const Mr=U({},["audio","video","img","source","image","track"]);let ds=null;const Pr=U({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gn="http://www.w3.org/1998/Math/MathML",Qn="http://www.w3.org/2000/svg",Ue="http://www.w3.org/1999/xhtml";let Nt=Ue,us=!1,ps=null;const Bu=U({},[Gn,Qn,Ue],Ms);let Jn=U({},["mi","mo","mn","ms","mtext"]),Yn=U({},["annotation-xml"]);const Fu=U({},["title","style","font","a","script"]);let on=null;const Ou=["application/xhtml+xml","text/html"],Uu="text/html";let ie=null,Bt=null;const Wu=n.createElement("form"),Lr=function($){return $ instanceof RegExp||$ instanceof Function},hs=function(){let $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Bt&&Bt===$)){if((!$||typeof $!="object")&&($={}),$=Le($),on=Ou.indexOf($.PARSER_MEDIA_TYPE)===-1?Uu:$.PARSER_MEDIA_TYPE,ie=on==="application/xhtml+xml"?Ms:yi,Z=ke($,"ALLOWED_TAGS")?U({},$.ALLOWED_TAGS,ie):zn,ee=ke($,"ALLOWED_ATTR")?U({},$.ALLOWED_ATTR,ie):Hn,ps=ke($,"ALLOWED_NAMESPACES")?U({},$.ALLOWED_NAMESPACES,Ms):Bu,ds=ke($,"ADD_URI_SAFE_ATTR")?U(Le(Pr),$.ADD_URI_SAFE_ATTR,ie):Pr,_r=ke($,"ADD_DATA_URI_TAGS")?U(Le(Mr),$.ADD_DATA_URI_TAGS,ie):Mr,Te=ke($,"FORBID_CONTENTS")?U({},$.FORBID_CONTENTS,ie):cs,ct=ke($,"FORBID_TAGS")?U({},$.FORBID_TAGS,ie):Le({}),nn=ke($,"FORBID_ATTR")?U({},$.FORBID_ATTR,ie):Le({}),Dt=ke($,"USE_PROFILES")?$.USE_PROFILES:!1,qn=$.ALLOW_ARIA_ATTR!==!1,E=$.ALLOW_DATA_ATTR!==!1,M=$.ALLOW_UNKNOWN_PROTOCOLS||!1,F=$.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=$.SAFE_FOR_TEMPLATES||!1,J=$.SAFE_FOR_XML!==!1,V=$.WHOLE_DOCUMENT||!1,Rt=$.RETURN_DOM||!1,jn=$.RETURN_DOM_FRAGMENT||!1,Vn=$.RETURN_TRUSTED_TYPE||!1,Xe=$.FORCE_BODY||!1,Cr=$.SANITIZE_DOM!==!1,Tr=$.SANITIZE_NAMED_PROPS||!1,ls=$.KEEP_CONTENT!==!1,sn=$.IN_PLACE||!1,Kn=$.ALLOWED_URI_REGEXP||Sd,Nt=$.NAMESPACE||Ue,Jn=$.MATHML_TEXT_INTEGRATION_POINTS||Jn,Yn=$.HTML_INTEGRATION_POINTS||Yn,Q=$.CUSTOM_ELEMENT_HANDLING||{},$.CUSTOM_ELEMENT_HANDLING&&Lr($.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=$.CUSTOM_ELEMENT_HANDLING.tagNameCheck),$.CUSTOM_ELEMENT_HANDLING&&Lr($.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=$.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),$.CUSTOM_ELEMENT_HANDLING&&typeof $.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=$.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),O&&(E=!1),jn&&(Rt=!0),Dt&&(Z=U({},qa),ee=[],Dt.html===!0&&(U(Z,Ha),U(ee,ja)),Dt.svg===!0&&(U(Z,Ls),U(ee,Ds),U(ee,ai)),Dt.svgFilters===!0&&(U(Z,Is),U(ee,Ds),U(ee,ai)),Dt.mathMl===!0&&(U(Z,Rs),U(ee,Va),U(ee,ai))),$.ADD_TAGS&&(typeof $.ADD_TAGS=="function"?Ye.tagCheck=$.ADD_TAGS:(Z===zn&&(Z=Le(Z)),U(Z,$.ADD_TAGS,ie))),$.ADD_ATTR&&(typeof $.ADD_ATTR=="function"?Ye.attributeCheck=$.ADD_ATTR:(ee===Hn&&(ee=Le(ee)),U(ee,$.ADD_ATTR,ie))),$.ADD_URI_SAFE_ATTR&&U(ds,$.ADD_URI_SAFE_ATTR,ie),$.FORBID_CONTENTS&&(Te===cs&&(Te=Le(Te)),U(Te,$.FORBID_CONTENTS,ie)),$.ADD_FORBID_CONTENTS&&(Te===cs&&(Te=Le(Te)),U(Te,$.ADD_FORBID_CONTENTS,ie)),ls&&(Z["#text"]=!0),V&&U(Z,["html","head","body"]),Z.table&&(U(Z,["tbody"]),delete ct.tbody),$.TRUSTED_TYPES_POLICY){if(typeof $.TRUSTED_TYPES_POLICY.createHTML!="function")throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof $.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw un('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=$.TRUSTED_TYPES_POLICY,P=C.createHTML("")}else C===void 0&&(C=rm(v,s)),C!==null&&typeof P=="string"&&(P=C.createHTML(""));ge&&ge($),Bt=$}},Ir=U({},[...Ls,...Is,...Qg]),Rr=U({},[...Rs,...Jg]),Ku=function($){let T=A($);(!T||!T.tagName)&&(T={namespaceURI:Nt,tagName:"template"});const R=yi($.tagName),G=yi(T.tagName);return ps[$.namespaceURI]?$.namespaceURI===Qn?T.namespaceURI===Ue?R==="svg":T.namespaceURI===Gn?R==="svg"&&(G==="annotation-xml"||Jn[G]):!!Ir[R]:$.namespaceURI===Gn?T.namespaceURI===Ue?R==="math":T.namespaceURI===Qn?R==="math"&&Yn[G]:!!Rr[R]:$.namespaceURI===Ue?T.namespaceURI===Qn&&!Yn[G]||T.namespaceURI===Gn&&!Jn[G]?!1:!Rr[R]&&(Fu[R]||!Ir[R]):!!(on==="application/xhtml+xml"&&ps[$.namespaceURI]):!1},_e=function($){cn(t.removed,{element:$});try{A($).removeChild($)}catch{b($)}},dt=function($,T){try{cn(t.removed,{attribute:T.getAttributeNode($),from:T})}catch{cn(t.removed,{attribute:null,from:T})}if(T.removeAttribute($),$==="is")if(Rt||jn)try{_e(T)}catch{}else try{T.setAttribute($,"")}catch{}},Dr=function($){let T=null,R=null;if(Xe)$="<remove></remove>"+$;else{const ne=Ps($,/^[\r\n\t ]+/);R=ne&&ne[0]}on==="application/xhtml+xml"&&Nt===Ue&&($='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+$+"</body></html>");const G=C?C.createHTML($):$;if(Nt===Ue)try{T=new f().parseFromString(G,on)}catch{}if(!T||!T.documentElement){T=_.createDocument(Nt,"template",null);try{T.documentElement.innerHTML=us?P:G}catch{}}const ae=T.body||T.documentElement;return $&&R&&ae.insertBefore(n.createTextNode(R),ae.childNodes[0]||null),Nt===Ue?te.call(T,V?"html":"body")[0]:V?T.documentElement:ae},Nr=function($){return B.call($.ownerDocument||$,$,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},fs=function($){return $ instanceof p&&(typeof $.nodeName!="string"||typeof $.textContent!="string"||typeof $.removeChild!="function"||!($.attributes instanceof l)||typeof $.removeAttribute!="function"||typeof $.setAttribute!="function"||typeof $.namespaceURI!="string"||typeof $.insertBefore!="function"||typeof $.hasChildNodes!="function")},Br=function($){return typeof a=="function"&&$ instanceof a};function We(D,$,T){ri(D,R=>{R.call(t,$,T,Bt)})}const Fr=function($){let T=null;if(We(X.beforeSanitizeElements,$,null),fs($))return _e($),!0;const R=ie($.nodeName);if(We(X.uponSanitizeElement,$,{tagName:R,allowedTags:Z}),J&&$.hasChildNodes()&&!Br($.firstElementChild)&&pe(/<[/\w!]/g,$.innerHTML)&&pe(/<[/\w!]/g,$.textContent)||$.nodeType===hn.progressingInstruction||J&&$.nodeType===hn.comment&&pe(/<[/\w]/g,$.data))return _e($),!0;if(!(Ye.tagCheck instanceof Function&&Ye.tagCheck(R))&&(!Z[R]||ct[R])){if(!ct[R]&&Ur(R)&&(Q.tagNameCheck instanceof RegExp&&pe(Q.tagNameCheck,R)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(R)))return!1;if(ls&&!Te[R]){const G=A($)||$.parentNode,ae=x($)||$.childNodes;if(ae&&G){const ne=ae.length;for(let ye=ne-1;ye>=0;--ye){const Ke=h(ae[ye],!0);Ke.__removalCount=($.__removalCount||0)+1,G.insertBefore(Ke,w($))}}}return _e($),!0}return $ instanceof d&&!Ku($)||(R==="noscript"||R==="noembed"||R==="noframes")&&pe(/<\/no(script|embed|frames)/i,$.innerHTML)?(_e($),!0):(O&&$.nodeType===hn.text&&(T=$.textContent,ri([at,It,lt],G=>{T=dn(T,G," ")}),$.textContent!==T&&(cn(t.removed,{element:$.cloneNode()}),$.textContent=T)),We(X.afterSanitizeElements,$,null),!1)},Or=function($,T,R){if(Cr&&(T==="id"||T==="name")&&(R in n||R in Wu))return!1;if(!(E&&!nn[T]&&pe(ss,T))){if(!(qn&&pe(os,T))){if(!(Ye.attributeCheck instanceof Function&&Ye.attributeCheck(T,$))){if(!ee[T]||nn[T]){if(!(Ur($)&&(Q.tagNameCheck instanceof RegExp&&pe(Q.tagNameCheck,$)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck($))&&(Q.attributeNameCheck instanceof RegExp&&pe(Q.attributeNameCheck,T)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(T,$))||T==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&pe(Q.tagNameCheck,R)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(R))))return!1}else if(!ds[T]){if(!pe(Kn,dn(R,Wn,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&$!=="script"&&qg(R,"data:")===0&&_r[$])){if(!(M&&!pe(rs,dn(R,Wn,"")))){if(R)return!1}}}}}}}return!0},Ur=function($){return $!=="annotation-xml"&&Ps($,as)},Wr=function($){We(X.beforeSanitizeAttributes,$,null);const{attributes:T}=$;if(!T||fs($))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ee,forceKeepAttr:void 0};let G=T.length;for(;G--;){const ae=T[G],{name:ne,namespaceURI:ye,value:Ke}=ae,Ft=ie(ne),gs=Ke;let oe=ne==="value"?gs:jg(gs);if(R.attrName=Ft,R.attrValue=oe,R.keepAttr=!0,R.forceKeepAttr=void 0,We(X.uponSanitizeAttribute,$,R),oe=R.attrValue,Tr&&(Ft==="id"||Ft==="name")&&(dt(ne,$),oe=Nu+oe),J&&pe(/((--!?|])>)|<\/(style|title|textarea)/i,oe)){dt(ne,$);continue}if(Ft==="attributename"&&Ps(oe,"href")){dt(ne,$);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){dt(ne,$);continue}if(!F&&pe(/\/>/i,oe)){dt(ne,$);continue}O&&ri([at,It,lt],zr=>{oe=dn(oe,zr," ")});const Kr=ie($.nodeName);if(!Or(Kr,Ft,oe)){dt(ne,$);continue}if(C&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!ye)switch(v.getAttributeType(Kr,Ft)){case"TrustedHTML":{oe=C.createHTML(oe);break}case"TrustedScriptURL":{oe=C.createScriptURL(oe);break}}if(oe!==gs)try{ye?$.setAttributeNS(ye,ne,oe):$.setAttribute(ne,oe),fs($)?_e($):za(t.removed)}catch{dt(ne,$)}}We(X.afterSanitizeAttributes,$,null)},zu=function D($){let T=null;const R=Nr($);for(We(X.beforeSanitizeShadowDOM,$,null);T=R.nextNode();)We(X.uponSanitizeShadowNode,T,null),Fr(T),Wr(T),T.content instanceof o&&D(T.content);We(X.afterSanitizeShadowDOM,$,null)};return t.sanitize=function(D){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,R=null,G=null,ae=null;if(us=!D,us&&(D="<!-->"),typeof D!="string"&&!Br(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw un("dirty is not a string, aborting")}else throw un("toString is not a function");if(!t.isSupported)return D;if(ue||hs($),t.removed=[],typeof D=="string"&&(sn=!1),sn){if(D.nodeName){const Ke=ie(D.nodeName);if(!Z[Ke]||ct[Ke])throw un("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof a)T=Dr("<!---->"),R=T.ownerDocument.importNode(D,!0),R.nodeType===hn.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?T=R:T.appendChild(R);else{if(!Rt&&!O&&!V&&D.indexOf("<")===-1)return C&&Vn?C.createHTML(D):D;if(T=Dr(D),!T)return Rt?null:Vn?P:""}T&&Xe&&_e(T.firstChild);const ne=Nr(sn?D:T);for(;G=ne.nextNode();)Fr(G),Wr(G),G.content instanceof o&&zu(G.content);if(sn)return D;if(Rt){if(jn)for(ae=z.call(T.ownerDocument);T.firstChild;)ae.appendChild(T.firstChild);else ae=T;return(ee.shadowroot||ee.shadowrootmode)&&(ae=be.call(i,ae,!0)),ae}let ye=V?T.outerHTML:T.innerHTML;return V&&Z["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&pe(xd,T.ownerDocument.doctype.name)&&(ye="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
|
|
2382
|
+
`+ye),O&&ri([at,It,lt],Ke=>{ye=dn(ye,Ke," ")}),C&&Vn?C.createHTML(ye):ye},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hs(D),ue=!0},t.clearConfig=function(){Bt=null,ue=!1},t.isValidAttribute=function(D,$,T){Bt||hs({});const R=ie(D),G=ie($);return Or(R,G,T)},t.addHook=function(D,$){typeof $=="function"&&cn(X[D],$)},t.removeHook=function(D,$){if($!==void 0){const T=zg(X[D],$);return T===-1?void 0:Hg(X[D],T,1)[0]}return za(X[D])},t.removeHooks=function(D){X[D]=[]},t.removeAllHooks=function(){X=Qa()},t}var yo=Ad();function cr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Pt=cr();function Ed(e){Pt=e}var An={exec:()=>null};function K(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(s,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(he.caret,"$1"),n=n.replace(s,r),i},getRegex:()=>new RegExp(n,t)};return i}var am=(()=>{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")},lm=/^(?:[ \t]*(?:\n|$))+/,cm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,dm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,On=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,um=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,dr=/(?:[*+-]|\d{1,9}[.)])/,Cd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Td=K(Cd).replace(/bull/g,dr).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(),pm=K(Cd).replace(/bull/g,dr).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(),ur=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,hm=/^[^\n]+/,pr=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,fm=K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gm=K(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,dr).getRegex(),Zi="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",hr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,mm=K("^ {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",hr).replace("tag",Zi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_d=K(ur).replace("hr",On).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",Zi).getRegex(),ym=K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_d).getRegex(),fr={blockquote:ym,code:cm,def:fm,fences:dm,heading:um,hr:On,html:mm,lheading:Td,list:gm,newline:lm,paragraph:_d,table:An,text:hm},Ja=K("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",On).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",Zi).getRegex(),vm={...fr,lheading:pm,table:Ja,paragraph:K(ur).replace("hr",On).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ja).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",Zi).getRegex()},bm={...fr,html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",hr).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:An,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(ur).replace("hr",On).replace("heading",` *#{1,6} *[^
|
|
2383
|
+
]`).replace("lheading",Td).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},wm=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,km=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Md=/^( {2,}|\\)\n(?!\s*$)/,$m=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,es=/[\p{P}\p{S}]/u,gr=/[\s\p{P}\p{S}]/u,Pd=/[^\s\p{P}\p{S}]/u,Sm=K(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,gr).getRegex(),Ld=/(?!~)[\p{P}\p{S}]/u,xm=/(?!~)[\s\p{P}\p{S}]/u,Am=/(?:[^\s\p{P}\p{S}]|~)/u,Em=K(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",am?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Id=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Cm=K(Id,"u").replace(/punct/g,es).getRegex(),Tm=K(Id,"u").replace(/punct/g,Ld).getRegex(),Rd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_m=K(Rd,"gu").replace(/notPunctSpace/g,Pd).replace(/punctSpace/g,gr).replace(/punct/g,es).getRegex(),Mm=K(Rd,"gu").replace(/notPunctSpace/g,Am).replace(/punctSpace/g,xm).replace(/punct/g,Ld).getRegex(),Pm=K("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Pd).replace(/punctSpace/g,gr).replace(/punct/g,es).getRegex(),Lm=K(/\\(punct)/,"gu").replace(/punct/g,es).getRegex(),Im=K(/^<(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(),Rm=K(hr).replace("(?:-->|$)","-->").getRegex(),Dm=K("^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",Rm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ii=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Nm=K(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ii).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Dd=K(/^!?\[(label)\]\[(ref)\]/).replace("label",Ii).replace("ref",pr).getRegex(),Nd=K(/^!?\[(ref)\](?:\[\])?/).replace("ref",pr).getRegex(),Bm=K("reflink|nolink(?!\\()","g").replace("reflink",Dd).replace("nolink",Nd).getRegex(),Ya=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,mr={_backpedal:An,anyPunctuation:Lm,autolink:Im,blockSkip:Em,br:Md,code:km,del:An,emStrongLDelim:Cm,emStrongRDelimAst:_m,emStrongRDelimUnd:Pm,escape:wm,link:Nm,nolink:Nd,punctuation:Sm,reflink:Dd,reflinkSearch:Bm,tag:Dm,text:$m,url:An},Fm={...mr,link:K(/^!?\[(label)\]\((.*?)\)/).replace("label",Ii).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ii).getRegex()},vo={...mr,emStrongRDelimAst:Mm,emStrongLDelim:Tm,url:K(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ya).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:K(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ya).getRegex()},Om={...vo,br:K(Md).replace("{2,}","*").getRegex(),text:K(vo.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},li={normal:fr,gfm:vm,pedantic:bm},fn={normal:mr,gfm:vo,breaks:Om,pedantic:Fm},Um={"&":"&","<":"<",">":">",'"':""","'":"'"},Xa=e=>Um[e];function He(e,t){if(t){if(he.escapeTest.test(e))return e.replace(he.escapeReplace,Xa)}else if(he.escapeTestNoEncode.test(e))return e.replace(he.escapeReplaceNoEncode,Xa);return e}function Za(e){try{e=encodeURI(e).replace(he.percentDecode,"%")}catch{return null}return e}function el(e,t){var o;let n=e.replace(he.findPipe,(r,a,d)=>{let c=!1,l=a;for(;--l>=0&&d[l]==="\\";)c=!c;return c?"|":" |"}),i=n.split(he.splitPipe),s=0;if(i[0].trim()||i.shift(),i.length>0&&!((o=i.at(-1))!=null&&o.trim())&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(he.slashPipe,"|");return i}function gn(e,t,n){let i=e.length;if(i===0)return"";let s=0;for(;s<i&&e.charAt(i-s-1)===t;)s++;return e.slice(0,i-s)}function Wm(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}function tl(e,t,n,i,s){let o=t.href,r=t.title||null,a=e[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,d}function Km(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let s=i[1];return t.split(`
|
|
2384
|
+
`).map(o=>{let r=o.match(n.other.beginningSpace);if(r===null)return o;let[a]=r;return a.length>=s.length?o.slice(s.length):o}).join(`
|
|
2385
|
+
`)}var Ri=class{constructor(e){W(this,"options");W(this,"rules");W(this,"lexer");this.options=e||Pt}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:gn(n,`
|
|
2386
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=Km(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:i}}}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 i=gn(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.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:gn(t[0],`
|
|
2272
2387
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=gn(t[0],`
|
|
2273
2388
|
`).split(`
|
|
2274
|
-
`),i="",s="",o=[];for(;n.length>0;){let
|
|
2389
|
+
`),i="",s="",o=[];for(;n.length>0;){let r=!1,a=[],d;for(d=0;d<n.length;d++)if(this.rules.other.blockquoteStart.test(n[d]))a.push(n[d]),r=!0;else if(!r)a.push(n[d]);else break;n=n.slice(d);let c=a.join(`
|
|
2275
2390
|
`),l=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
2276
2391
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
2277
2392
|
${c}`:c,s=s?`${s}
|
|
2278
|
-
${l}`:l;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,o,!0),this.lexer.state.top=p,n.length===0)break;let
|
|
2393
|
+
${l}`:l;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,o,!0),this.lexer.state.top=p,n.length===0)break;let f=o.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let v=f,S=v.raw+`
|
|
2279
2394
|
`+n.join(`
|
|
2280
|
-
`),
|
|
2395
|
+
`),h=this.blockquote(S);o[o.length-1]=h,i=i.substring(0,i.length-v.raw.length)+h.raw,s=s.substring(0,s.length-v.text.length)+h.text;break}else if((f==null?void 0:f.type)==="list"){let v=f,S=v.raw+`
|
|
2281
2396
|
`+n.join(`
|
|
2282
|
-
`),
|
|
2283
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){var n,i;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),o=s.length>1,
|
|
2284
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,
|
|
2285
|
-
`,1)[0],
|
|
2286
|
-
`,e=e.substring(S.length+1),l=!0),!l){let
|
|
2287
|
-
`,1)[0],
|
|
2288
|
-
`+
|
|
2289
|
-
`+S}!
|
|
2290
|
-
`,e=e.substring(_.length+1),v=
|
|
2291
|
-
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let
|
|
2292
|
-
`?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 o=gn(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=
|
|
2293
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){var s,o,
|
|
2294
|
-
`:n.push(
|
|
2397
|
+
`),h=this.list(S);o[o.length-1]=h,i=i.substring(0,i.length-f.raw.length)+h.raw,s=s.substring(0,s.length-v.raw.length)+h.raw,n=S.substring(o.at(-1).raw.length).split(`
|
|
2398
|
+
`);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){var n,i;let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),o=s.length>1,r={type:"list",raw:"",ordered:o,start:o?+s.slice(0,-1):"",loose:!1,items:[]};s=o?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=o?s:"[*+-]");let a=this.rules.other.listItemRegex(s),d=!1;for(;e;){let l=!1,p="",f="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let v=t[2].split(`
|
|
2399
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,w=>" ".repeat(3*w.length)),S=e.split(`
|
|
2400
|
+
`,1)[0],h=!v.trim(),b=0;if(this.options.pedantic?(b=2,f=v.trimStart()):h?b=t[1].length+1:(b=t[2].search(this.rules.other.nonSpaceChar),b=b>4?1:b,f=v.slice(b),b+=t[1].length),h&&this.rules.other.blankLine.test(S)&&(p+=S+`
|
|
2401
|
+
`,e=e.substring(S.length+1),l=!0),!l){let w=this.rules.other.nextBulletRegex(b),x=this.rules.other.hrRegex(b),A=this.rules.other.fencesBeginRegex(b),C=this.rules.other.headingBeginRegex(b),P=this.rules.other.htmlBeginRegex(b);for(;e;){let _=e.split(`
|
|
2402
|
+
`,1)[0],B;if(S=_,this.options.pedantic?(S=S.replace(this.rules.other.listReplaceNesting," "),B=S):B=S.replace(this.rules.other.tabCharGlobal," "),A.test(S)||C.test(S)||P.test(S)||w.test(S)||x.test(S))break;if(B.search(this.rules.other.nonSpaceChar)>=b||!S.trim())f+=`
|
|
2403
|
+
`+B.slice(b);else{if(h||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||A.test(v)||C.test(v)||x.test(v))break;f+=`
|
|
2404
|
+
`+S}!h&&!S.trim()&&(h=!0),p+=_+`
|
|
2405
|
+
`,e=e.substring(_.length+1),v=B.slice(b)}}r.loose||(d?r.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(d=!0)),r.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),r.raw+=p}let c=r.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),((n=l.tokens[0])==null?void 0:n.type)==="text"||((i=l.tokens[0])==null?void 0:i.type)==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let f={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=f.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=f.raw+l.tokens[0].raw,l.tokens[0].text=f.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(f)):l.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):l.tokens.unshift(f)}}if(!r.loose){let p=l.tokens.filter(v=>v.type==="space"),f=p.length>0&&p.some(v=>this.rules.other.anyLine.test(v.raw));r.loose=f}}if(r.loose)for(let l of r.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return r}}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," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=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:i,title:s}}}table(e){var r;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=el(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(r=t[3])!=null&&r.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
2406
|
+
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<n.length;a++)o.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:o.align[a]});for(let a of s)o.rows.push(el(a,o.header.length).map((d,c)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:o.align[c]})));return o}}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)===`
|
|
2407
|
+
`?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 o=gn(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=Wm(t[2],"()");if(o===-2)return;if(o>-1){let r=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[3])}else s=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),tl(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.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 i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[i.toLowerCase()];if(!s){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return tl(n,s,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...i[0]].length-1,o,r,a=s,d=0,c=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);(i=c.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(r=[...o].length,i[3]||i[4]){a+=r;continue}else if((i[5]||i[6])&&s%3&&!((s+r)%3)){d+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+d);let l=[...i[0]][0].length,p=e.slice(0,s+i.index+l+r);if(Math.min(s,r)%2){let v=p.slice(1,-1);return{type:"em",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}let f=p.slice(2,-2);return{type:"strong",raw:p,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&s&&(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,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let i,s;if(t[2]==="@")i=t[0],s="mailto:"+i;else{let o;do o=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(o!==t[0]);i=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}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}}}},Se=class bo{constructor(t){W(this,"tokens");W(this,"options");W(this,"state");W(this,"inlineQueue");W(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Pt,this.options.tokenizer=this.options.tokenizer||new Ri,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:li.normal,inline:fn.normal};this.options.pedantic?(n.block=li.pedantic,n.inline=fn.pedantic):this.options.gfm&&(n.block=li.gfm,this.options.breaks?n.inline=fn.breaks:n.inline=fn.gfm),this.tokenizer.rules=n}static get rules(){return{block:li,inline:fn}}static lex(t,n){return new bo(n).lex(t)}static lexInline(t,n){return new bo(n).inlineTokens(t)}lex(t){t=t.replace(he.carriageReturn,`
|
|
2408
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){var s,o,r;for(this.options.pedantic&&(t=t.replace(he.tabCharGlobal," ").replace(he.spaceLine,""));t;){let a;if((o=(s=this.options.extensions)==null?void 0:s.block)!=null&&o.some(c=>(a=c.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let c=n.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
|
2409
|
+
`:n.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
2295
2410
|
`)?"":`
|
|
2296
|
-
`)+
|
|
2297
|
-
`+
|
|
2411
|
+
`)+a.raw,c.text+=`
|
|
2412
|
+
`+a.text,this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
2298
2413
|
`)?"":`
|
|
2299
|
-
`)+
|
|
2300
|
-
`+
|
|
2414
|
+
`)+a.raw,c.text+=`
|
|
2415
|
+
`+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},n.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),n.push(a);continue}let d=t;if((r=this.options.extensions)!=null&&r.startBlock){let c=1/0,l=t.slice(1),p;this.options.extensions.startBlock.forEach(f=>{p=f.call({lexer:this},l),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(d=t.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(d))){let c=n.at(-1);i&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
2301
2416
|
`)?"":`
|
|
2302
|
-
`)+
|
|
2303
|
-
`+
|
|
2417
|
+
`)+a.raw,c.text+=`
|
|
2418
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a),i=d.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
2304
2419
|
`)?"":`
|
|
2305
|
-
`)+
|
|
2306
|
-
`+
|
|
2307
|
-
`;return i?'<pre><code class="language-'+
|
|
2308
|
-
`:"<pre><code>"+(n?s:
|
|
2420
|
+
`)+a.raw,c.text+=`
|
|
2421
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(t){let c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,c,l,p,f;let i=t,s=null;if(this.tokens.links){let v=Object.keys(this.tokens.links);if(v.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)v.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,s.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=s[2]?s[2].length:0,i=i.slice(0,s.index+o)+"["+"a".repeat(s[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((c=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:c.call({lexer:this},i))??i;let r=!1,a="";for(;t;){r||(a=""),r=!1;let v;if((p=(l=this.options.extensions)==null?void 0:l.inline)!=null&&p.some(h=>(v=h.call({lexer:this},t,n))?(t=t.substring(v.raw.length),n.push(v),!0):!1))continue;if(v=this.tokenizer.escape(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.tag(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.link(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(v.raw.length);let h=n.at(-1);v.type==="text"&&(h==null?void 0:h.type)==="text"?(h.raw+=v.raw,h.text+=v.text):n.push(v);continue}if(v=this.tokenizer.emStrong(t,i,a)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.codespan(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.br(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.del(t)){t=t.substring(v.raw.length),n.push(v);continue}if(v=this.tokenizer.autolink(t)){t=t.substring(v.raw.length),n.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(t))){t=t.substring(v.raw.length),n.push(v);continue}let S=t;if((f=this.options.extensions)!=null&&f.startInline){let h=1/0,b=t.slice(1),w;this.options.extensions.startInline.forEach(x=>{w=x.call({lexer:this},b),typeof w=="number"&&w>=0&&(h=Math.min(h,w))}),h<1/0&&h>=0&&(S=t.substring(0,h+1))}if(v=this.tokenizer.inlineText(S)){t=t.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(a=v.raw.slice(-1)),r=!0;let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=v.raw,h.text+=v.text):n.push(v);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},Di=class{constructor(e){W(this,"options");W(this,"parser");this.options=e||Pt}space(e){return""}code({text:e,lang:t,escaped:n}){var o;let i=(o=(t||"").match(he.notSpaceStart))==null?void 0:o[0],s=e.replace(he.endingNewline,"")+`
|
|
2422
|
+
`;return i?'<pre><code class="language-'+He(i)+'">'+(n?s:He(s,!0))+`</code></pre>
|
|
2423
|
+
`:"<pre><code>"+(n?s:He(s,!0))+`</code></pre>
|
|
2309
2424
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
2310
2425
|
${this.parser.parse(e)}</blockquote>
|
|
2311
2426
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
2312
2427
|
`}hr(e){return`<hr>
|
|
2313
|
-
`}list(e){let t=e.ordered,n=e.start,i="";for(let
|
|
2428
|
+
`}list(e){let t=e.ordered,n=e.start,i="";for(let r=0;r<e.items.length;r++){let a=e.items[r];i+=this.listitem(a)}let s=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
|
|
2314
2429
|
`+i+"</"+s+`>
|
|
2315
2430
|
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
2316
2431
|
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
2317
|
-
`}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let
|
|
2432
|
+
`}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let r=0;r<o.length;r++)n+=this.tablecell(o[r]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
2318
2433
|
<thead>
|
|
2319
2434
|
`+t+`</thead>
|
|
2320
2435
|
`+i+`</table>
|
|
2321
2436
|
`}tablerow({text:e}){return`<tr>
|
|
2322
2437
|
${e}</tr>
|
|
2323
2438
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
2324
|
-
`}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>${
|
|
2325
|
-
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+
|
|
2439
|
+
`}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>${He(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 i=this.parser.parseInline(n),s=Za(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+He(t)+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let s=Za(e);if(s===null)return He(n);e=s;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${He(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:He(e.text)}},yr=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}},xe=class wo{constructor(t){W(this,"options");W(this,"renderer");W(this,"textRenderer");this.options=t||Pt,this.options.renderer=this.options.renderer||new Di,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new yr}static parse(t,n){return new wo(n).parse(t)}static parseInline(t,n){return new wo(n).parseInline(t)}parse(t){var i,s;let n="";for(let o=0;o<t.length;o++){let r=t[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[r.type]){let d=r,c=this.options.extensions.renderers[d.type].call({parser:this},d);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){n+=c||"";continue}}let a=r;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 d='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var s,o;let i="";for(let r=0;r<t.length;r++){let a=t[r];if((o=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&o[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=c||"";continue}}let d=a;switch(d.type){case"escape":{i+=n.text(d);break}case"html":{i+=n.html(d);break}case"link":{i+=n.link(d);break}case"image":{i+=n.image(d);break}case"checkbox":{i+=n.checkbox(d);break}case"strong":{i+=n.strong(d);break}case"em":{i+=n.em(d);break}case"codespan":{i+=n.codespan(d);break}case"br":{i+=n.br(d);break}case"del":{i+=n.del(d);break}case"text":{i+=n.text(d);break}default:{let c='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return i}},fi,vn=(fi=class{constructor(e){W(this,"options");W(this,"block");this.options=e||Pt}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Se.lex:Se.lexInline}provideParser(){return this.block?xe.parse:xe.parseInline}},W(fi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),W(fi,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),fi),zm=class{constructor(...e){W(this,"defaults",cr());W(this,"options",this.setOptions);W(this,"parse",this.parseMarkdown(!0));W(this,"parseInline",this.parseMarkdown(!1));W(this,"Parser",xe);W(this,"Renderer",Di);W(this,"TextRenderer",yr);W(this,"Lexer",Se);W(this,"Tokenizer",Ri);W(this,"Hooks",vn);this.use(...e)}walkTokens(e,t){var i,s;let n=[];for(let o of e)switch(n=n.concat(t.call(this,o)),o.type){case"table":{let r=o;for(let a of r.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of r.rows)for(let d of a)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{let r=o;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=o;(s=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&s[r.type]?this.defaults.extensions.childTokens[r.type].forEach(a=>{let d=r[a].flat(1/0);n=n.concat(this.walkTokens(d,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=t.renderers[s.name];o?t.renderers[s.name]=function(...r){let a=s.renderer.apply(this,r);return a===!1&&(a=o.apply(this,r)),a}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),i.extensions=t),n.renderer){let s=this.defaults.renderer||new Di(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let r=o,a=n.renderer[r],d=s[r];s[r]=(...c)=>{let l=a.apply(s,c);return l===!1&&(l=d.apply(s,c)),l||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Ri(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let r=o,a=n.tokenizer[r],d=s[r];s[r]=(...c)=>{let l=a.apply(s,c);return l===!1&&(l=d.apply(s,c)),l}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new vn;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let r=o,a=n.hooks[r],d=s[r];vn.passThroughHooks.has(o)?s[r]=c=>{if(this.defaults.async&&vn.passThroughHooksRespectAsync.has(o))return(async()=>{let p=await a.call(s,c);return d.call(s,p)})();let l=a.call(s,c);return d.call(s,l)}:s[r]=(...c)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(s,c);return p===!1&&(p=await d.apply(s,c)),p})();let l=a.apply(s,c);return l===!1&&(l=d.apply(s,c)),l}}i.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(r){let a=[];return a.push(o.call(this,r)),s&&(a=a.concat(s.call(this,r))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Se.lex(e,t??this.defaults)}parser(e,t){return xe.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(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 o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let r=s.hooks?await s.hooks.preprocess(t):t,a=await(s.hooks?await s.hooks.provideLexer():e?Se.lex:Se.lexInline)(r,s),d=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(d,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():e?xe.parse:xe.parseInline)(d,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(o);try{s.hooks&&(t=s.hooks.preprocess(t));let r=(s.hooks?s.hooks.provideLexer():e?Se.lex:Se.lexInline)(t,s);s.hooks&&(r=s.hooks.processAllTokens(r)),s.walkTokens&&this.walkTokens(r,s.walkTokens);let a=(s.hooks?s.hooks.provideParser():e?xe.parse:xe.parseInline)(r,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(r){return o(r)}}}onError(e,t){return n=>{if(n.message+=`
|
|
2440
|
+
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+He(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Ct=new zm;function q(e,t){return Ct.parse(e,t)}q.options=q.setOptions=function(e){return Ct.setOptions(e),q.defaults=Ct.defaults,Ed(q.defaults),q};q.getDefaults=cr;q.defaults=Pt;q.use=function(...e){return Ct.use(...e),q.defaults=Ct.defaults,Ed(q.defaults),q};q.walkTokens=function(e,t){return Ct.walkTokens(e,t)};q.parseInline=Ct.parseInline;q.Parser=xe;q.parser=xe.parse;q.Renderer=Di;q.TextRenderer=yr;q.Lexer=Se;q.lexer=Se.lex;q.Tokenizer=Ri;q.Hooks=vn;q.parse=q;q.options;q.setOptions;q.use;q.walkTokens;q.parseInline;xe.parse;Se.lex;q.setOptions({gfm:!0,breaks:!0,mangle:!1});const nl=["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"],il=["class","href","rel","target","title","start"];let sl=!1;const Hm=14e4,qm=4e4,jm=200,Ns=5e4,vt=new Map;function Vm(e){const t=vt.get(e);return t===void 0?null:(vt.delete(e),vt.set(e,t),t)}function ol(e,t){if(vt.set(e,t),vt.size<=jm)return;const n=vt.keys().next().value;n&&vt.delete(n)}function Gm(){sl||(sl=!0,yo.addHook("afterSanitizeAttributes",e=>{!(e instanceof HTMLAnchorElement)||!e.getAttribute("href")||(e.setAttribute("rel","noreferrer noopener"),e.setAttribute("target","_blank"))}))}function Ni(e){const t=e.trim();if(!t)return"";if(Gm(),t.length<=Ns){const r=Vm(t);if(r!==null)return r}const n=ec(t,Hm),i=n.truncated?`
|
|
2326
2441
|
|
|
2327
|
-
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>
|
|
2442
|
+
… truncated (${n.total} chars, showing first ${n.text.length}).`:"";if(n.text.length>qm){const a=`<pre class="code-block">${Qm(`${n.text}${i}`)}</pre>`,d=yo.sanitize(a,{ALLOWED_TAGS:nl,ALLOWED_ATTR:il});return t.length<=Ns&&ol(t,d),d}const s=q.parse(`${n.text}${i}`),o=yo.sanitize(s,{ALLOWED_TAGS:nl,ALLOWED_ATTR:il});return t.length<=Ns&&ol(t,o),o}function Qm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const Jm=1500,Ym=2e3,Bd="Copy as markdown",Xm="Copied",Zm="Copy failed";async function ey(e){if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}}function ci(e,t){e.title=t,e.setAttribute("aria-label",t)}function ty(e){const t=e.label??Bd;return u`
|
|
2328
2443
|
<button
|
|
2329
2444
|
class="chat-copy-btn"
|
|
2330
2445
|
type="button"
|
|
2331
2446
|
title=${t}
|
|
2332
2447
|
aria-label=${t}
|
|
2333
|
-
@click=${async n=>{const i=n.currentTarget;if(i==null||i.querySelector(".chat-copy-btn__icon"),!i||i.dataset.copying==="1")return;i.dataset.copying="1",i.setAttribute("aria-busy","true"),i.disabled=!0;const s=await
|
|
2448
|
+
@click=${async n=>{const i=n.currentTarget;if(i==null||i.querySelector(".chat-copy-btn__icon"),!i||i.dataset.copying==="1")return;i.dataset.copying="1",i.setAttribute("aria-busy","true"),i.disabled=!0;const s=await ey(e.text());if(i.isConnected){if(delete i.dataset.copying,i.removeAttribute("aria-busy"),i.disabled=!1,!s){i.dataset.error="1",ci(i,Zm),window.setTimeout(()=>{i.isConnected&&(delete i.dataset.error,ci(i,t))},Ym);return}i.dataset.copied="1",ci(i,Xm),window.setTimeout(()=>{i.isConnected&&(delete i.dataset.copied,ci(i,t))},Jm)}}}
|
|
2334
2449
|
>
|
|
2335
2450
|
<span class="chat-copy-btn__icon" aria-hidden="true">
|
|
2336
2451
|
<span class="chat-copy-btn__icon-copy">${L.copy}</span>
|
|
2337
2452
|
<span class="chat-copy-btn__icon-check">${L.check}</span>
|
|
2338
2453
|
</span>
|
|
2339
2454
|
</button>
|
|
2340
|
-
`}function
|
|
2341
|
-
<div class="vnp" data-url=${e} @click=${
|
|
2455
|
+
`}function ny(e){return ty({text:()=>e,label:Bd})}function iy(e){const t=e,n=sy(t.content),i=[];for(const s of n){const o=String(s.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(o)||typeof s.name=="string"&&s.arguments!=null)&&i.push({kind:"call",name:s.name??"tool",args:oy(s.arguments??s.args)})}for(const s of n){const o=String(s.type??"").toLowerCase();if(o!=="toolresult"&&o!=="tool_result")continue;const r=ry(s),a=typeof s.name=="string"?s.name:"tool";i.push({kind:"result",name:a,text:r})}if(oc(e)&&!i.some(s=>s.kind==="result")){const s=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",o=tc(e)??void 0;i.push({kind:"result",name:s,text:o})}return i}function sy(e){return Array.isArray(e)?e.filter(Boolean):[]}function oy(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 ry(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}const Bs=40,Fs=new Map;async function ay(e){const t=Fs.get(e);if(t)return t;try{const n=new(window.AudioContext||window.webkitAudioContext),s=await(await fetch(e)).arrayBuffer(),r=(await n.decodeAudioData(s)).getChannelData(0),a=Math.floor(r.length/Bs),d=[];for(let p=0;p<Bs;p++){let f=0;const v=p*a,S=Math.min(v+a,r.length);for(let h=v;h<S;h++){const b=Math.abs(r[h]);b>f&&(f=b)}d.push(f)}const c=Math.max(...d,.01),l=d.map(p=>Math.max(p/c,.08));return Fs.set(e,l),n.close(),l}catch{const n=Array.from(e).reduce((s,o)=>(s<<5)-s+o.charCodeAt(0)|0,0),i=[];for(let s=0;s<Bs;s++){const o=Math.abs((n*(s+1)*9301+49297)%233280/233280);i.push(.15+o*.85)}return Fs.set(e,i),i}}const Os=[1,1.5,2],Bi=new Map;function ly(e){let t=Bi.get(e);if(t)return t;const n=new Audio;return n.preload="metadata",n.src=e,t={audio:n,playing:!1,currentTime:0,duration:0,speed:1,waveform:[]},Bi.set(e,t),ay(e).then(i=>{t.waveform=i,Fd(e)}),t}const En="http://www.w3.org/2000/svg";function cy(){const e=document.createElementNS(En,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","currentColor");const t=document.createElementNS(En,"polygon");return t.setAttribute("points","6,3 20,12 6,21"),e.appendChild(t),e}function dy(){const e=document.createElementNS(En,"svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","currentColor");const t=document.createElementNS(En,"rect");t.setAttribute("x","5"),t.setAttribute("y","3"),t.setAttribute("width","4"),t.setAttribute("height","18"),t.setAttribute("rx","1");const n=document.createElementNS(En,"rect");return n.setAttribute("x","15"),n.setAttribute("y","3"),n.setAttribute("width","4"),n.setAttribute("height","18"),n.setAttribute("rx","1"),e.append(t,n),e}function Wt(e){return document.querySelector(`.vnp[data-url="${CSS.escape(e)}"]`)}function Fd(e){const t=Wt(e);if(!t)return;const n=Bi.get(e);if(!n||n.waveform.length===0)return;const i=t.querySelector(".vnp__waveform");if(i){if(i.children.length===0){const s=document.createDocumentFragment();for(const o of n.waveform){const r=document.createElement("span");r.className="vnp__bar",r.style.height=`${Math.round(o*100)}%`,s.appendChild(r)}i.appendChild(s)}Cn(t,n)}}function Cn(e,t){const n=t.duration>0?t.currentTime/t.duration:0,i=e.querySelectorAll(".vnp__bar"),s=i.length;i.forEach((r,a)=>{r.classList.toggle("vnp__bar--active",a/s<n)});const o=e.querySelector(".vnp__time");o&&(o.textContent=t.playing||t.currentTime>0?Fi(t.currentTime):Fi(t.duration))}function Us(e,t){const n=e.querySelector(".vnp__play");if(!n)return;const i=n.querySelector("svg"),s=t?dy():cy();i?n.replaceChild(s,i):n.appendChild(s)}function Fi(e){if(!isFinite(e)||e<0)return"0:00";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}const rl=new Set;function uy(e){if(rl.has(e))return;rl.add(e);const t=Bi.get(e);if(!t)return;const{audio:n}=t;n.addEventListener("loadedmetadata",()=>{t.duration=n.duration;const i=Wt(e);i&&Cn(i,t)}),n.addEventListener("timeupdate",()=>{t.currentTime=n.currentTime;const i=Wt(e);i&&Cn(i,t)}),n.addEventListener("ended",()=>{t.playing=!1,n.currentTime=0,t.currentTime=0;const i=Wt(e);i&&(Cn(i,t),Us(i,!1))}),n.addEventListener("pause",()=>{t.playing=!1;const i=Wt(e);i&&Us(i,!1)}),n.addEventListener("play",()=>{t.playing=!0;const i=Wt(e);i&&Us(i,!0)})}function py(e,t){const n=ly(e);uy(e);const i=a=>{a.stopPropagation(),n.playing?n.audio.pause():n.audio.play()},s=a=>{a.stopPropagation();const d=Os.indexOf(n.speed),c=Os[(d+1)%Os.length];n.speed=c,n.audio.playbackRate=c;const l=a.target.closest(".vnp__speed");l&&(l.textContent=`${c}×`)},o=a=>{a.stopPropagation();const d=a.target.closest(".vnp__waveform");if(!d)return;const c=d.getBoundingClientRect(),l=Math.max(0,Math.min(1,(a.clientX-c.left)/c.width));if(n.duration>0){n.audio.currentTime=l*n.duration,n.currentTime=n.audio.currentTime;const p=d.closest(".vnp");p&&Cn(p,n)}},r=n.playing||n.currentTime>0?Fi(n.currentTime):Fi(n.duration);return queueMicrotask(()=>Fd(e)),u`
|
|
2456
|
+
<div class="vnp" data-url=${e} @click=${a=>a.stopPropagation()}>
|
|
2342
2457
|
<button class="vnp__play" @click=${i} aria-label=${n.playing?"Pause":"Play"}>
|
|
2343
|
-
${n.playing?
|
|
2458
|
+
${n.playing?fy():hy()}
|
|
2344
2459
|
</button>
|
|
2345
2460
|
|
|
2346
2461
|
<div class="vnp__body">
|
|
2347
2462
|
<div class="vnp__waveform" @click=${o}></div>
|
|
2348
2463
|
|
|
2349
2464
|
<div class="vnp__meta">
|
|
2350
|
-
<span class="vnp__time">${
|
|
2465
|
+
<span class="vnp__time">${r}</span>
|
|
2351
2466
|
<button class="vnp__speed" @click=${s}>${n.speed}×</button>
|
|
2352
2467
|
${t?u`<a class="vnp__name" href=${e} target="_blank" rel="noreferrer noopener">${t}</a>`:k}
|
|
2353
2468
|
</div>
|
|
2354
2469
|
</div>
|
|
2355
2470
|
</div>
|
|
2356
|
-
`}function
|
|
2471
|
+
`}function hy(){return u`<svg viewBox="0 0 24 24" fill="currentColor"><polygon points="6,3 20,12 6,21" /></svg>`}function fy(){return u`<svg viewBox="0 0 24 24" fill="currentColor"><rect x="5" y="3" width="4" height="18" rx="1"/><rect x="15" y="3" width="4" height="18" rx="1"/></svg>`}function gy(e){var s;const n=e.content,i=[];if(Array.isArray(n))for(const o of n){if(typeof o!="object"||o===null)continue;const r=o;if(r.type==="image")if(((s=r.source)==null?void 0:s.type)==="base64"){const a=r.source,d=a.data,c=a.media_type||"image/png",l=d.startsWith("data:")?d:`data:${c};base64,${d}`;i.push({url:l})}else if(typeof r.data=="string"&&r.data){const a=r.data,d=r.mimeType||r.media_type||"image/png",c=a.startsWith("data:")?a:`data:${d};base64,${a}`;i.push({url:c})}else typeof r.url=="string"&&i.push({url:r.url});else if(r.type==="image_url"){const a=r.image_url;typeof(a==null?void 0:a.url)=="string"&&i.push({url:a.url})}}return i}function my(e){const n=e.content,i=[];if(Array.isArray(n))for(const s of n){if(typeof s!="object"||s===null)continue;const o=s;o.type==="file"&&typeof o.url=="string"&&typeof o.name=="string"&&i.push({url:o.url,name:o.name,mimeType:o.mimeType??"application/octet-stream"})}return i}function yy(e){return e==="application/pdf"?"📄":e.startsWith("audio/")?"🎵":"📎"}function vy(e){return u`
|
|
2357
2472
|
<div class="chat-group assistant">
|
|
2358
2473
|
<div class="chat-group-messages">
|
|
2359
2474
|
<div class="chat-bubble chat-reading-indicator" aria-hidden="true">
|
|
@@ -2363,30 +2478,30 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2363
2478
|
</div>
|
|
2364
2479
|
</div>
|
|
2365
2480
|
</div>
|
|
2366
|
-
`}function
|
|
2481
|
+
`}function by(e){return u`
|
|
2367
2482
|
<div class="chat-group assistant">
|
|
2368
2483
|
<div class="chat-group-messages">
|
|
2369
2484
|
<div class="chat-interim fade-in">
|
|
2370
|
-
${Li(
|
|
2485
|
+
${Li(Ni(e))}
|
|
2371
2486
|
</div>
|
|
2372
2487
|
</div>
|
|
2373
2488
|
</div>
|
|
2374
|
-
`}function
|
|
2489
|
+
`}function wy(e,t,n,i){return u`
|
|
2375
2490
|
<div class="chat-group assistant">
|
|
2376
2491
|
<div class="chat-group-messages">
|
|
2377
|
-
${
|
|
2492
|
+
${Od({role:"assistant",content:[{type:"text",text:e}],timestamp:t},{isStreaming:!1,showReasoning:!1})}
|
|
2378
2493
|
</div>
|
|
2379
2494
|
</div>
|
|
2380
|
-
`}function
|
|
2495
|
+
`}function ky(e,t){const n=sc(e.role),i=n==="user"?"user":n==="assistant"?"assistant":"other",s=new Date(e.timestamp).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"});return u`
|
|
2381
2496
|
<div class="chat-group ${i}">
|
|
2382
2497
|
<div class="chat-group-messages">
|
|
2383
|
-
${e.messages.map((o,
|
|
2498
|
+
${e.messages.map((o,r)=>Od(o.message,{isStreaming:e.isStreaming&&r===e.messages.length-1,showReasoning:t.showReasoning}))}
|
|
2384
2499
|
<div class="chat-group-footer">
|
|
2385
2500
|
<span class="chat-group-timestamp">${s}</span>
|
|
2386
2501
|
</div>
|
|
2387
2502
|
</div>
|
|
2388
2503
|
</div>
|
|
2389
|
-
`}function
|
|
2504
|
+
`}function $y(e){return e.length===0?k:u`
|
|
2390
2505
|
<div class="chat-message-images">
|
|
2391
2506
|
${e.map(t=>u`
|
|
2392
2507
|
<img
|
|
@@ -2397,12 +2512,12 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2397
2512
|
/>
|
|
2398
2513
|
`)}
|
|
2399
2514
|
</div>
|
|
2400
|
-
`}function
|
|
2515
|
+
`}function Sy(e){return e.length===0?k:u`
|
|
2401
2516
|
<div class="chat-message-files">
|
|
2402
|
-
${e.map(t=>t.mimeType==="application/pdf"
|
|
2517
|
+
${e.map(t=>t.mimeType==="application/pdf"?Ay(t):t.mimeType.startsWith("audio/")?py(t.url,t.name):Ey(t))}
|
|
2403
2518
|
</div>
|
|
2404
|
-
`}function
|
|
2405
|
-
<div class="chat-pdf-preview" @click=${()=>
|
|
2519
|
+
`}function xy(e,t){const n=document.createElement("div");n.className="chat-pdf-modal-overlay";const i=document.createElement("div");i.className="chat-pdf-modal";const s=document.createElement("div");s.className="chat-pdf-modal__header";const o=document.createElement("span");o.className="chat-pdf-modal__title",o.textContent=t;const r=document.createElement("a");r.className="chat-pdf-modal__open",r.href=e,r.target="_blank",r.rel="noreferrer noopener",r.textContent="Open in new tab";const a=document.createElement("button");a.className="chat-pdf-modal__close",a.setAttribute("aria-label","Close");const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox","0 0 24 24");const c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1","18"),c.setAttribute("y1","6"),c.setAttribute("x2","6"),c.setAttribute("y2","18");const l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1","6"),l.setAttribute("y1","6"),l.setAttribute("x2","18"),l.setAttribute("y2","18"),d.append(c,l),a.appendChild(d),s.append(o,r,a);const p=document.createElement("iframe");p.className="chat-pdf-modal__frame",p.src=e,p.title=t,i.append(s,p),n.appendChild(i),n.addEventListener("click",f=>{f.target===n&&n.remove()}),a.addEventListener("click",()=>n.remove()),document.body.appendChild(n)}function Ay(e){return u`
|
|
2520
|
+
<div class="chat-pdf-preview" @click=${()=>xy(e.url,e.name)}>
|
|
2406
2521
|
<iframe
|
|
2407
2522
|
src=${e.url}
|
|
2408
2523
|
class="chat-pdf-preview__frame"
|
|
@@ -2416,35 +2531,35 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2416
2531
|
@click=${t=>t.stopPropagation()}
|
|
2417
2532
|
>${e.name}</a>
|
|
2418
2533
|
</div>
|
|
2419
|
-
`}function
|
|
2534
|
+
`}function Ey(e){return u`
|
|
2420
2535
|
<a
|
|
2421
2536
|
class="chat-file-card"
|
|
2422
2537
|
href=${e.url}
|
|
2423
2538
|
target="_blank"
|
|
2424
2539
|
rel="noreferrer noopener"
|
|
2425
2540
|
>
|
|
2426
|
-
<span class="chat-file-card__icon">${
|
|
2541
|
+
<span class="chat-file-card__icon">${yy(e.mimeType)}</span>
|
|
2427
2542
|
<span class="chat-file-card__name">${e.name}</span>
|
|
2428
2543
|
</a>
|
|
2429
|
-
`}function
|
|
2544
|
+
`}function Od(e,t,n){const i=e,s=typeof i.role=="string"?i.role:"unknown",o=oc(e)||s.toLowerCase()==="toolresult"||s.toLowerCase()==="tool_result"||typeof i.toolCallId=="string"||typeof i.tool_call_id=="string",a=iy(e).length>0,d=gy(e),c=d.length>0,l=my(e),p=l.length>0,f=tc(e),v=t.showReasoning&&s==="assistant"?Fp(e):null,S=f!=null&&f.trim()?f:null,h=v?Up(v):null,b=S,w=(s==="assistant"||s==="user")&&!!(b!=null&&b.trim()),x=["chat-bubble",w?"has-copy":"",t.isStreaming?"streaming":"","fade-in"].filter(Boolean).join(" ");return!b&&(a||o)||!b&&!c&&!p?k:u`
|
|
2430
2545
|
<div class="${x}">
|
|
2431
|
-
${
|
|
2432
|
-
${
|
|
2433
|
-
${
|
|
2434
|
-
${
|
|
2435
|
-
${
|
|
2546
|
+
${w?ny(b):k}
|
|
2547
|
+
${$y(d)}
|
|
2548
|
+
${Sy(l)}
|
|
2549
|
+
${h?u`<div class="chat-thinking">${Li(Ni(h))}</div>`:k}
|
|
2550
|
+
${b?u`<div class="chat-text">${Li(Ni(b))}</div>`:k}
|
|
2436
2551
|
</div>
|
|
2437
|
-
`}const
|
|
2552
|
+
`}const N={active:!1,mode:"tap",startTime:0,elapsed:0,mediaRecorder:null,audioChunks:[],stream:null,timerId:null,startX:0,cancelled:!1};let H=null,wt=null,kt=!1;function al(e){const t=Math.floor(e/60),n=e%60;return`${t}:${n.toString().padStart(2,"0")}`}function gt(){if(N.timerId&&(clearInterval(N.timerId),N.timerId=null),N.stream){for(const e of N.stream.getTracks())e.stop();N.stream=null}wt&&(clearTimeout(wt),wt=null),Oi(),N.mediaRecorder=null,N.audioChunks=[],N.active=!1,N.cancelled=!1,kt=!1}async function Ud(e){var t;try{if(!((t=navigator.mediaDevices)!=null&&t.getUserMedia))return console.warn("[voice] getUserMedia unavailable (requires secure context)"),gt(),!1;const n=await navigator.mediaDevices.getUserMedia({audio:!0});N.stream=n;const i=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":"",s=i?new MediaRecorder(n,{mimeType:i}):new MediaRecorder(n);return N.mediaRecorder=s,N.audioChunks=[],N.mode=e,N.startTime=Date.now(),N.elapsed=0,N.active=!0,N.cancelled=!1,s.ondataavailable=o=>{o.data.size>0&&N.audioChunks.push(o.data)},s.onstop=()=>{if(N.cancelled){gt(),H==null||H.onRequestRender();return}const o=new Blob(N.audioChunks,{type:s.mimeType});if(o.size===0){gt(),H==null||H.onRequestRender();return}const r=new FileReader;r.onload=()=>{const a=r.result,d=s.mimeType.includes("mp4")?"m4a":"webm",c={id:Qi(),dataUrl:a,mimeType:s.mimeType||"audio/webm",fileName:`voice-note-${Date.now()}.${d}`};gt(),H==null||H.onSend(c),H==null||H.onRequestRender()},r.onerror=()=>{gt(),H==null||H.onRequestRender()},r.readAsDataURL(o)},s.start(250),N.timerId=setInterval(()=>{N.elapsed=Math.floor((Date.now()-N.startTime)/1e3),H==null||H.onRequestRender()},1e3),H==null||H.onRequestRender(),!0}catch(n){return console.warn("[voice] startRecording failed:",n),gt(),!1}}function Wd(){!N.active||!N.mediaRecorder||(N.cancelled=!1,N.mediaRecorder.state==="recording"&&N.mediaRecorder.stop())}function Kd(){!N.active||!N.mediaRecorder||(N.cancelled=!0,N.mediaRecorder.state==="recording"?N.mediaRecorder.stop():(gt(),H==null||H.onRequestRender()))}function Cy(){document.addEventListener("pointerup",zd)}function Oi(){document.removeEventListener("pointerup",zd)}function zd(e){if(!kt&&!N.active){Oi();return}if(kt=!1,Oi(),wt&&(clearTimeout(wt),wt=null,!N.active)){Ud("tap");return}N.active&&N.mode==="hold"&&(N.cancelled?Kd():Wd()),e.preventDefault()}function Ty(e){N.active||(kt=!0,N.startX=e.clientX,Cy(),wt=setTimeout(async()=>{if(!kt)return;await Ud("hold")||(kt=!1,Oi())},300))}function ll(e){if(!N.active||N.mode!=="hold"||!kt)return;const t=N.startX-e.clientX;t>80?(N.cancelled=!0,H==null||H.onRequestRender()):N.cancelled&&t<=60&&(N.cancelled=!1,H==null||H.onRequestRender())}function _y(){return N.active}function My(e){H=e}function Py(e){return u`
|
|
2438
2553
|
<button
|
|
2439
2554
|
class="btn btn--icon chat-compose__mic"
|
|
2440
2555
|
?disabled=${!e}
|
|
2441
|
-
@pointerdown=${
|
|
2556
|
+
@pointerdown=${Ty}
|
|
2442
2557
|
aria-label="Record voice note"
|
|
2443
2558
|
title="Tap to record, hold to send on release"
|
|
2444
2559
|
>
|
|
2445
2560
|
${L.mic}
|
|
2446
2561
|
</button>
|
|
2447
|
-
`}function
|
|
2562
|
+
`}function Ly(){return N.active?N.mode==="tap"?u`
|
|
2448
2563
|
<div class="chat-voice-recording" @pointermove=${ll}>
|
|
2449
2564
|
<button
|
|
2450
2565
|
class="btn btn--icon chat-voice-recording__trash"
|
|
@@ -2456,11 +2571,11 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2456
2571
|
</button>
|
|
2457
2572
|
<div class="chat-voice-recording__indicator">
|
|
2458
2573
|
<span class="chat-voice-recording__dot"></span>
|
|
2459
|
-
<span class="chat-voice-recording__timer">${
|
|
2574
|
+
<span class="chat-voice-recording__timer">${al(N.elapsed)}</span>
|
|
2460
2575
|
</div>
|
|
2461
2576
|
<button
|
|
2462
2577
|
class="btn btn--icon chat-voice-recording__send primary"
|
|
2463
|
-
@click=${
|
|
2578
|
+
@click=${Wd}
|
|
2464
2579
|
aria-label="Send voice note"
|
|
2465
2580
|
title="Send"
|
|
2466
2581
|
>
|
|
@@ -2471,13 +2586,13 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2471
2586
|
<div class="chat-voice-recording hold" @pointermove=${ll}>
|
|
2472
2587
|
<div class="chat-voice-recording__indicator">
|
|
2473
2588
|
<span class="chat-voice-recording__dot"></span>
|
|
2474
|
-
<span class="chat-voice-recording__timer">${
|
|
2475
|
-
<span class="chat-voice-recording__slide ${
|
|
2476
|
-
${
|
|
2589
|
+
<span class="chat-voice-recording__timer">${al(N.elapsed)}</span>
|
|
2590
|
+
<span class="chat-voice-recording__slide ${N.cancelled?"cancelled":""}">
|
|
2591
|
+
${N.cancelled?"Release to cancel":"← Slide to cancel"}
|
|
2477
2592
|
</span>
|
|
2478
2593
|
</div>
|
|
2479
2594
|
</div>
|
|
2480
|
-
`:k}function
|
|
2595
|
+
`:k}function Iy(e){return u`
|
|
2481
2596
|
<div class="sidebar-panel">
|
|
2482
2597
|
<div class="sidebar-header">
|
|
2483
2598
|
<div class="sidebar-title">Tool Output</div>
|
|
@@ -2491,10 +2606,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2491
2606
|
<button @click=${e.onViewRawText} class="btn" style="margin-top: 12px;">
|
|
2492
2607
|
View Raw Text
|
|
2493
2608
|
</button>
|
|
2494
|
-
`:e.content?u`<div class="sidebar-markdown">${Li(
|
|
2609
|
+
`:e.content?u`<div class="sidebar-markdown">${Li(Ni(e.content))}</div>`:u`<div class="muted">No content available</div>`}
|
|
2495
2610
|
</div>
|
|
2496
2611
|
</div>
|
|
2497
|
-
`}var
|
|
2612
|
+
`}var Ry=Object.defineProperty,Dy=Object.getOwnPropertyDescriptor,ts=(e,t,n,i)=>{for(var s=i>1?void 0:i?Dy(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(s=(i?r(t,n,s):r(s))||s);return i&&s&&Ry(t,n,s),s};let Vt=class extends zt{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,s=(e.clientX-this.startX)/n;let o=this.startRatio+s;o=Math.max(this.minRatio,Math.min(this.maxRatio,o)),this.dispatchEvent(new CustomEvent("resize",{detail:{splitRatio:o},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 u``}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)}};Vt.styles=Qu`
|
|
2498
2613
|
:host {
|
|
2499
2614
|
width: 4px;
|
|
2500
2615
|
cursor: col-resize;
|
|
@@ -2520,21 +2635,21 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
|
|
|
2520
2635
|
:host(.dragging) {
|
|
2521
2636
|
background: var(--accent, #007bff);
|
|
2522
2637
|
}
|
|
2523
|
-
`;ts([Vi({type:Number})],Vt.prototype,"splitRatio",2);ts([Vi({type:Number})],Vt.prototype,"minRatio",2);ts([Vi({type:Number})],Vt.prototype,"maxRatio",2);Vt=ts([Vl("resizable-divider")],Vt);function di(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function Ks(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const Iy=1,Ry=1,Lt="emoji",Gt="keyvalue",va="favorites",Dy="tokens",zd="tokens",By="unicode",qd="count",Ny="group",Fy="order",Hd="group-order",ko="eTag",Ui="url",cl="skinTone",tn="readonly",ba="readwrite",jd="skinUnicodes",Oy="skinUnicodes",Uy="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Ky="en";function Wy(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function dl(e){return Wy(e,t=>t.unicode)}function zy(e){function t(n,i,s){const o=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[a,[r,d]]of Object.entries(s))o.createIndex(a,r,{multiEntry:d});return o}t(Gt),t(Lt,By,{[zd]:[Dy,!0],[Hd]:[[Ny,Fy]],[jd]:[Oy,!0]}),t(va,void 0,{[qd]:[""]})}const $o={},vi={},Ki={};function Vd(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function qy(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,Iy);$o[e]=s,s.onupgradeneeded=o=>{o.oldVersion<Ry&&zy(s.result)},Vd(n,i,s)});return t.onclose=()=>wa(e),t}function Hy(e){return vi[e]||(vi[e]=qy(e)),vi[e]}function Ye(e,t,n,i){return new Promise((s,o)=>{const a=e.transaction(t,n,{durability:"relaxed"}),r=typeof t=="string"?a.objectStore(t):t.map(c=>a.objectStore(c));let d;i(r,a,c=>{d=c}),a.oncomplete=()=>s(d),a.onerror=()=>o(a.error)})}function wa(e){const t=$o[e],n=t&&t.result;if(n){n.close();const i=Ki[e];if(i)for(const s of i)s()}delete $o[e],delete vi[e],delete Ki[e]}function jy(e){return new Promise((t,n)=>{wa(e);const i=indexedDB.deleteDatabase(e);Vd(t,n,i)})}function Vy(e,t){let n=Ki[e];n||(n=Ki[e]=[]),n.push(t)}const Gy=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function Ht(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||Gy.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const Qy=2;function Gd(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=Qy)}function Yy(e){return e.map(({annotation:n,emoticon:i,group:s,order:o,shortcodes:a,skins:r,tags:d,emoji:c,version:l})=>{const p=[...new Set(Gd([...(a||[]).map(Ht).flat(),...(d||[]).map(Ht).flat(),...Ht(n),i]))].sort(),h={annotation:n,group:s,order:o,tags:d,tokens:p,unicode:c,version:l};if(i&&(h.emoticon=i),a&&(h.shortcodes=a),r){h.skinTones=[],h.skinUnicodes=[],h.skinVersions=[];for(const{tone:v,emoji:S,version:f}of r)h.skinTones.push(v),h.skinUnicodes.push(S),h.skinVersions.push(f)}return h})}function Qd(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function Tt(e,t,n){Qd(e,"get",t,n)}function Yd(e,t,n){Qd(e,"getAll",t,n)}function ka(e){e.commit&&e.commit()}function Jy(e,t){let n=e[0];for(let i=1;i<e.length;i++){const s=e[i];t(n)>t(s)&&(n=s)}return n}function Jd(e,t){const n=Jy(e,s=>s.length),i=[];for(const s of n)e.some(o=>o.findIndex(a=>t(a)===t(s))===-1)||i.push(s);return i}async function Xy(e){return!await $a(e,Gt,Ui)}async function Zy(e,t,n){const[i,s]=await Promise.all([ko,Ui].map(o=>$a(e,Gt,o)));return i===n&&s===t}async function ev(e,t){return Ye(e,Lt,tn,(i,s,o)=>{let a;const r=()=>{i.getAll(a&&IDBKeyRange.lowerBound(a,!0),50).onsuccess=d=>{const c=d.target.result;for(const l of c)if(a=l.unicode,t(l))return o(l);if(c.length<50)return o();r()}};r()})}async function Xd(e,t,n,i){{const s=Yy(t);await Ye(e,[Lt,Gt],ba,([o,a],r)=>{let d,c,l=0;function p(){++l===2&&h()}function h(){if(!(d===i&&c===n)){o.clear();for(const v of s)o.put(v);a.put(i,ko),a.put(n,Ui),ka(r)}}Tt(a,ko,v=>{d=v,p()}),Tt(a,Ui,v=>{c=v,p()})})}}async function tv(e,t){return Ye(e,Lt,tn,(n,i,s)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Yd(n.index(Hd),o,s)})}async function Zd(e,t){const n=Gd(Ht(t));return n.length?Ye(e,Lt,tn,(i,s,o)=>{const a=[],r=()=>{a.length===n.length&&d()},d=()=>{const c=Jd(a,l=>l.unicode);o(c.sort((l,p)=>l.order<p.order?-1:1))};for(let c=0;c<n.length;c++){const l=n[c],p=c===n.length-1?IDBKeyRange.bound(l,l+"",!1,!0):IDBKeyRange.only(l);Yd(i.index(zd),p,h=>{a.push(h),r()})}}):[]}async function nv(e,t){const n=await Zd(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(o=>o.toLowerCase()).includes(t.toLowerCase()))[0]||null:await ev(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function iv(e,t){return Ye(e,Lt,tn,(n,i,s)=>Tt(n,t,o=>{if(o)return s(o);Tt(n.index(jd),t,a=>s(a||null))}))}function $a(e,t,n){return Ye(e,t,tn,(i,s,o)=>Tt(i,n,o))}function sv(e,t,n,i){return Ye(e,t,ba,(s,o)=>{s.put(i,n),ka(o)})}function ov(e,t){return Ye(e,va,ba,(n,i)=>Tt(n,t,s=>{n.put((s||0)+1,t),ka(i)}))}function av(e,t,n){return n===0?[]:Ye(e,[va,Lt],tn,([i,s],o,a)=>{const r=[];i.index(qd).openCursor(void 0,"prev").onsuccess=d=>{const c=d.target.result;if(!c)return a(r);function l(v){if(r.push(v),r.length===n)return a(r);c.continue()}const p=c.primaryKey,h=t.byName(p);if(h)return l(h);Tt(s,p,v=>{if(v)return l(v);c.continue()})}})}const ui="";function rv(e,t){const n=new Map;for(const s of e){const o=t(s);for(const a of o){let r=n;for(let c=0;c<a.length;c++){const l=a.charAt(c);let p=r.get(l);p||(p=new Map,r.set(l,p)),r=p}let d=r.get(ui);d||(d=[],r.set(ui,d)),d.push(s)}}return(s,o)=>{let a=n;for(let c=0;c<s.length;c++){const l=s.charAt(c),p=a.get(l);if(p)a=p;else return[]}if(o)return a.get(ui)||[];const r=[],d=[a];for(;d.length;){const l=[...d.shift().entries()].sort((p,h)=>p[0]<h[0]?-1:1);for(const[p,h]of l)p===ui?r.push(...h):d.push(h)}return r}}const lv=["name","url"];function cv(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||lv.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function ul(e){cv(e);const t=(h,v)=>h.name.toLowerCase()<v.name.toLowerCase()?-1:1,n=e.sort(t),s=rv(e,h=>{const v=new Set;if(h.shortcodes)for(const S of h.shortcodes)for(const f of Ht(S))v.add(f);return v}),o=h=>s(h,!0),a=h=>s(h,!1),r=h=>{const v=Ht(h),S=v.map((f,w)=>(w<v.length-1?o:a)(f));return Jd(S,f=>f.name).sort(t)},d=new Map,c=new Map;for(const h of e){c.set(h.name.toLowerCase(),h);for(const v of h.shortcodes||[])d.set(v.toLowerCase(),h)}return{all:n,search:r,byShortcode:h=>d.get(h.toLowerCase()),byName:h=>c.get(h.toLowerCase())}}const dv=typeof wrappedJSObject<"u";function mn(e){if(!e)return e;if(dv&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function eu(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const uv=["annotation","emoji","group","order","version"];function pv(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||uv.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function tu(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function hv(e){const t=await fetch(e,{method:"HEAD"});tu(t,e);const n=t.headers.get("etag");return eu(n),n}async function So(e){const t=await fetch(e);tu(t,e);const n=t.headers.get("etag");eu(n);const i=await t.json();return pv(i),[n,i]}function fv(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function gv(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=-1;++s<t;)i[s]=e.charCodeAt(s);return n}async function nu(e){const t=JSON.stringify(e);let n=gv(t);const i=await crypto.subtle.digest("SHA-1",n),s=fv(i);return btoa(s)}async function mv(e,t){let n,i=await hv(t);if(!i){const s=await So(t);i=s[0],n=s[1],i||(i=await nu(n))}await Zy(e,t,i)||(n||(n=(await So(t))[1]),await Xd(e,n,t,i))}async function yv(e,t){let[n,i]=await So(t);n||(n=await nu(i)),await Xd(e,i,t,n)}async function vv(e,t){try{await mv(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class bv{constructor({dataSource:t=Uy,locale:n=Ky,customEmoji:i=[]}={}){this.dataSource=t,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=ul(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await Hy(this._dbName);Vy(this._dbName,this._clear);const n=this.dataSource;await Xy(t)?await yv(t,n):this._lazyUpdate=vv(t,n)}async ready(){const t=async()=>(this._ready||(this._ready=this._init()),this._ready);await t(),this._db||await t()}async getEmojiByGroup(t){return Ks(t),await this.ready(),dl(await tv(this._db,t)).map(mn)}async getEmojiBySearchQuery(t){di(t),await this.ready();const n=this._custom.search(t),i=dl(await Zd(this._db,t)).map(mn);return[...n,...i]}async getEmojiByShortcode(t){di(t),await this.ready();const n=this._custom.byShortcode(t);return n||mn(await nv(this._db,t))}async getEmojiByUnicodeOrName(t){di(t),await this.ready();const n=this._custom.byName(t);return n||mn(await iv(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await $a(this._db,Gt,cl)||0}async setPreferredSkinTone(t){return Ks(t),await this.ready(),sv(this._db,Gt,cl,t)}async incrementFavoriteEmojiCount(t){return di(t),await this.ready(),ov(this._db,t)}async getTopFavoriteEmoji(t){return Ks(t),await this.ready(),(await av(this._db,this._custom,t)).map(mn)}set customEmoji(t){this._custom=ul(t)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await wa(this._dbName)}async delete(){await this._shutdown(),await jy(this._dbName)}}const xo=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([e,t,n])=>({id:e,emoji:t,name:n})),Ws=xo.slice(1),wv=2,pl=6,iu=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function hl(e){return e.unicode.includes("")}const kv={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},$v=1e3,Sv="🖐️",xv=8,Av=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],su='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Cv=(e,t)=>e<t?-1:e>t?1:0,fl=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const i=n.getContext("2d",{willReadFrequently:!0});return i.textBaseline="top",i.font=`100px ${su}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Ev=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Tv(e){const t=fl(e,"#000"),n=fl(e,"#fff");return t&&n&&Ev(t,n)}function _v(){const e=Object.entries(kv);try{for(const[t,n]of e)if(Tv(t))return n}catch{}return e[0][1]}let zs;const qs=()=>(zs||(zs=new Promise(e=>iu(()=>e(_v())))),zs),Ao=new Map,Mv="️",Pv="\uD83C",Lv="",Iv=127995,Rv=57339;function Dv(e,t){if(t===0)return e;const n=e.indexOf(Lv);return n!==-1?e.substring(0,n)+String.fromCodePoint(Iv+t-1)+e.substring(n):(e.endsWith(Mv)&&(e=e.substring(0,e.length-1)),e+Pv+String.fromCodePoint(Rv+t-1))}function Pe(e){e.preventDefault(),e.stopPropagation()}function Hs(e,t,n){return t+=e?-1:1,t<0?t=n.length-1:t>=n.length&&(t=0),t}function ou(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function Bv(e,t){const n=i=>{const s={};for(const o of i)typeof o.tone=="number"&&o.version<=t&&(s[o.tone]=o.unicode);return s};return e.map(({unicode:i,skins:s,shortcodes:o,url:a,name:r,category:d,annotation:c})=>({unicode:i,name:r,shortcodes:o,url:a,category:d,annotation:c,id:i||r,skins:s&&n(s)}))}const bi=requestAnimationFrame;let Nv=typeof ResizeObserver=="function";function Fv(e,t,n){let i;Nv?(i=new ResizeObserver(n),i.observe(e)):bi(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function gl(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let js;function Ov(e,t,n){let i=!0,s=!1;for(const o of e){const a=n(o);if(!a)continue;const r=gl(a);r===0&&(s=!0),typeof js>"u"&&(js=gl(t));const d=r/1.8<js;Ao.set(o.unicode,d),d||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
2638
|
+
`;ts([Vi({type:Number})],Vt.prototype,"splitRatio",2);ts([Vi({type:Number})],Vt.prototype,"minRatio",2);ts([Vi({type:Number})],Vt.prototype,"maxRatio",2);Vt=ts([Vl("resizable-divider")],Vt);function di(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function Ws(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const Ny=1,By=1,Lt="emoji",Gt="keyvalue",vr="favorites",Fy="tokens",Hd="tokens",Oy="unicode",qd="count",Uy="group",Wy="order",jd="group-order",ko="eTag",Ui="url",cl="skinTone",tn="readonly",br="readwrite",Vd="skinUnicodes",Ky="skinUnicodes",zy="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Hy="en";function qy(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function dl(e){return qy(e,t=>t.unicode)}function jy(e){function t(n,i,s){const o=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[r,[a,d]]of Object.entries(s))o.createIndex(r,a,{multiEntry:d});return o}t(Gt),t(Lt,Oy,{[Hd]:[Fy,!0],[jd]:[[Uy,Wy]],[Vd]:[Ky,!0]}),t(vr,void 0,{[qd]:[""]})}const $o={},vi={},Wi={};function Gd(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function Vy(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,Ny);$o[e]=s,s.onupgradeneeded=o=>{o.oldVersion<By&&jy(s.result)},Gd(n,i,s)});return t.onclose=()=>wr(e),t}function Gy(e){return vi[e]||(vi[e]=Vy(e)),vi[e]}function Je(e,t,n,i){return new Promise((s,o)=>{const r=e.transaction(t,n,{durability:"relaxed"}),a=typeof t=="string"?r.objectStore(t):t.map(c=>r.objectStore(c));let d;i(a,r,c=>{d=c}),r.oncomplete=()=>s(d),r.onerror=()=>o(r.error)})}function wr(e){const t=$o[e],n=t&&t.result;if(n){n.close();const i=Wi[e];if(i)for(const s of i)s()}delete $o[e],delete vi[e],delete Wi[e]}function Qy(e){return new Promise((t,n)=>{wr(e);const i=indexedDB.deleteDatabase(e);Gd(t,n,i)})}function Jy(e,t){let n=Wi[e];n||(n=Wi[e]=[]),n.push(t)}const Yy=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function qt(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||Yy.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const Xy=2;function Qd(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=Xy)}function Zy(e){return e.map(({annotation:n,emoticon:i,group:s,order:o,shortcodes:r,skins:a,tags:d,emoji:c,version:l})=>{const p=[...new Set(Qd([...(r||[]).map(qt).flat(),...(d||[]).map(qt).flat(),...qt(n),i]))].sort(),f={annotation:n,group:s,order:o,tags:d,tokens:p,unicode:c,version:l};if(i&&(f.emoticon=i),r&&(f.shortcodes=r),a){f.skinTones=[],f.skinUnicodes=[],f.skinVersions=[];for(const{tone:v,emoji:S,version:h}of a)f.skinTones.push(v),f.skinUnicodes.push(S),f.skinVersions.push(h)}return f})}function Jd(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function Tt(e,t,n){Jd(e,"get",t,n)}function Yd(e,t,n){Jd(e,"getAll",t,n)}function kr(e){e.commit&&e.commit()}function ev(e,t){let n=e[0];for(let i=1;i<e.length;i++){const s=e[i];t(n)>t(s)&&(n=s)}return n}function Xd(e,t){const n=ev(e,s=>s.length),i=[];for(const s of n)e.some(o=>o.findIndex(r=>t(r)===t(s))===-1)||i.push(s);return i}async function tv(e){return!await $r(e,Gt,Ui)}async function nv(e,t,n){const[i,s]=await Promise.all([ko,Ui].map(o=>$r(e,Gt,o)));return i===n&&s===t}async function iv(e,t){return Je(e,Lt,tn,(i,s,o)=>{let r;const a=()=>{i.getAll(r&&IDBKeyRange.lowerBound(r,!0),50).onsuccess=d=>{const c=d.target.result;for(const l of c)if(r=l.unicode,t(l))return o(l);if(c.length<50)return o();a()}};a()})}async function Zd(e,t,n,i){{const s=Zy(t);await Je(e,[Lt,Gt],br,([o,r],a)=>{let d,c,l=0;function p(){++l===2&&f()}function f(){if(!(d===i&&c===n)){o.clear();for(const v of s)o.put(v);r.put(i,ko),r.put(n,Ui),kr(a)}}Tt(r,ko,v=>{d=v,p()}),Tt(r,Ui,v=>{c=v,p()})})}}async function sv(e,t){return Je(e,Lt,tn,(n,i,s)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);Yd(n.index(jd),o,s)})}async function eu(e,t){const n=Qd(qt(t));return n.length?Je(e,Lt,tn,(i,s,o)=>{const r=[],a=()=>{r.length===n.length&&d()},d=()=>{const c=Xd(r,l=>l.unicode);o(c.sort((l,p)=>l.order<p.order?-1:1))};for(let c=0;c<n.length;c++){const l=n[c],p=c===n.length-1?IDBKeyRange.bound(l,l+"",!1,!0):IDBKeyRange.only(l);Yd(i.index(Hd),p,f=>{r.push(f),a()})}}):[]}async function ov(e,t){const n=await eu(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(o=>o.toLowerCase()).includes(t.toLowerCase()))[0]||null:await iv(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function rv(e,t){return Je(e,Lt,tn,(n,i,s)=>Tt(n,t,o=>{if(o)return s(o);Tt(n.index(Vd),t,r=>s(r||null))}))}function $r(e,t,n){return Je(e,t,tn,(i,s,o)=>Tt(i,n,o))}function av(e,t,n,i){return Je(e,t,br,(s,o)=>{s.put(i,n),kr(o)})}function lv(e,t){return Je(e,vr,br,(n,i)=>Tt(n,t,s=>{n.put((s||0)+1,t),kr(i)}))}function cv(e,t,n){return n===0?[]:Je(e,[vr,Lt],tn,([i,s],o,r)=>{const a=[];i.index(qd).openCursor(void 0,"prev").onsuccess=d=>{const c=d.target.result;if(!c)return r(a);function l(v){if(a.push(v),a.length===n)return r(a);c.continue()}const p=c.primaryKey,f=t.byName(p);if(f)return l(f);Tt(s,p,v=>{if(v)return l(v);c.continue()})}})}const ui="";function dv(e,t){const n=new Map;for(const s of e){const o=t(s);for(const r of o){let a=n;for(let c=0;c<r.length;c++){const l=r.charAt(c);let p=a.get(l);p||(p=new Map,a.set(l,p)),a=p}let d=a.get(ui);d||(d=[],a.set(ui,d)),d.push(s)}}return(s,o)=>{let r=n;for(let c=0;c<s.length;c++){const l=s.charAt(c),p=r.get(l);if(p)r=p;else return[]}if(o)return r.get(ui)||[];const a=[],d=[r];for(;d.length;){const l=[...d.shift().entries()].sort((p,f)=>p[0]<f[0]?-1:1);for(const[p,f]of l)p===ui?a.push(...f):d.push(f)}return a}}const uv=["name","url"];function pv(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||uv.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function ul(e){pv(e);const t=(f,v)=>f.name.toLowerCase()<v.name.toLowerCase()?-1:1,n=e.sort(t),s=dv(e,f=>{const v=new Set;if(f.shortcodes)for(const S of f.shortcodes)for(const h of qt(S))v.add(h);return v}),o=f=>s(f,!0),r=f=>s(f,!1),a=f=>{const v=qt(f),S=v.map((h,b)=>(b<v.length-1?o:r)(h));return Xd(S,h=>h.name).sort(t)},d=new Map,c=new Map;for(const f of e){c.set(f.name.toLowerCase(),f);for(const v of f.shortcodes||[])d.set(v.toLowerCase(),f)}return{all:n,search:a,byShortcode:f=>d.get(f.toLowerCase()),byName:f=>c.get(f.toLowerCase())}}const hv=typeof wrappedJSObject<"u";function mn(e){if(!e)return e;if(hv&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function tu(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const fv=["annotation","emoji","group","order","version"];function gv(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||fv.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function nu(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function mv(e){const t=await fetch(e,{method:"HEAD"});nu(t,e);const n=t.headers.get("etag");return tu(n),n}async function So(e){const t=await fetch(e);nu(t,e);const n=t.headers.get("etag");tu(n);const i=await t.json();return gv(i),[n,i]}function yv(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function vv(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=-1;++s<t;)i[s]=e.charCodeAt(s);return n}async function iu(e){const t=JSON.stringify(e);let n=vv(t);const i=await crypto.subtle.digest("SHA-1",n),s=yv(i);return btoa(s)}async function bv(e,t){let n,i=await mv(t);if(!i){const s=await So(t);i=s[0],n=s[1],i||(i=await iu(n))}await nv(e,t,i)||(n||(n=(await So(t))[1]),await Zd(e,n,t,i))}async function wv(e,t){let[n,i]=await So(t);n||(n=await iu(i)),await Zd(e,i,t,n)}async function kv(e,t){try{await bv(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class $v{constructor({dataSource:t=zy,locale:n=Hy,customEmoji:i=[]}={}){this.dataSource=t,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=ul(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await Gy(this._dbName);Jy(this._dbName,this._clear);const n=this.dataSource;await tv(t)?await wv(t,n):this._lazyUpdate=kv(t,n)}async ready(){const t=async()=>(this._ready||(this._ready=this._init()),this._ready);await t(),this._db||await t()}async getEmojiByGroup(t){return Ws(t),await this.ready(),dl(await sv(this._db,t)).map(mn)}async getEmojiBySearchQuery(t){di(t),await this.ready();const n=this._custom.search(t),i=dl(await eu(this._db,t)).map(mn);return[...n,...i]}async getEmojiByShortcode(t){di(t),await this.ready();const n=this._custom.byShortcode(t);return n||mn(await ov(this._db,t))}async getEmojiByUnicodeOrName(t){di(t),await this.ready();const n=this._custom.byName(t);return n||mn(await rv(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await $r(this._db,Gt,cl)||0}async setPreferredSkinTone(t){return Ws(t),await this.ready(),av(this._db,Gt,cl,t)}async incrementFavoriteEmojiCount(t){return di(t),await this.ready(),lv(this._db,t)}async getTopFavoriteEmoji(t){return Ws(t),await this.ready(),(await cv(this._db,this._custom,t)).map(mn)}set customEmoji(t){this._custom=ul(t)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await wr(this._dbName)}async delete(){await this._shutdown(),await Qy(this._dbName)}}const xo=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([e,t,n])=>({id:e,emoji:t,name:n})),Ks=xo.slice(1),Sv=2,pl=6,su=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function hl(e){return e.unicode.includes("")}const xv={"":17,"":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱♀️":4,"🤣":3,"👁️🗨️":2,"😀":1,"😐️":.7,"😃":.6},Av=1e3,Ev="🖐️",Cv=8,Tv=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],ou='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',_v=(e,t)=>e<t?-1:e>t?1:0,fl=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const i=n.getContext("2d",{willReadFrequently:!0});return i.textBaseline="top",i.font=`100px ${ou}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Mv=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Pv(e){const t=fl(e,"#000"),n=fl(e,"#fff");return t&&n&&Mv(t,n)}function Lv(){const e=Object.entries(xv);try{for(const[t,n]of e)if(Pv(t))return n}catch{}return e[0][1]}let zs;const Hs=()=>(zs||(zs=new Promise(e=>su(()=>e(Lv())))),zs),Ao=new Map,Iv="️",Rv="\uD83C",Dv="",Nv=127995,Bv=57339;function Fv(e,t){if(t===0)return e;const n=e.indexOf(Dv);return n!==-1?e.substring(0,n)+String.fromCodePoint(Nv+t-1)+e.substring(n):(e.endsWith(Iv)&&(e=e.substring(0,e.length-1)),e+Rv+String.fromCodePoint(Bv+t-1))}function Pe(e){e.preventDefault(),e.stopPropagation()}function qs(e,t,n){return t+=e?-1:1,t<0?t=n.length-1:t>=n.length&&(t=0),t}function ru(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function Ov(e,t){const n=i=>{const s={};for(const o of i)typeof o.tone=="number"&&o.version<=t&&(s[o.tone]=o.unicode);return s};return e.map(({unicode:i,skins:s,shortcodes:o,url:r,name:a,category:d,annotation:c})=>({unicode:i,name:a,shortcodes:o,url:r,category:d,annotation:c,id:i||a,skins:s&&n(s)}))}const bi=requestAnimationFrame;let Uv=typeof ResizeObserver=="function";function Wv(e,t,n){let i;Uv?(i=new ResizeObserver(n),i.observe(e)):bi(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function gl(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let js;function Kv(e,t,n){let i=!0,s=!1;for(const o of e){const r=n(o);if(!r)continue;const a=gl(r);a===0&&(s=!0),typeof js>"u"&&(js=gl(t));const d=a/1.8<js;Ao.set(o.unicode,d),d||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
|
|
2524
2639
|
This is likely due to using \`display:none\` which is unsupported.
|
|
2525
2640
|
If this is a Jest/Vitest environment, you can ignore this warning.
|
|
2526
|
-
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function Uv(e){return ou(e,t=>t)}function Kv(e){e&&(e.scrollTop=0)}function Tn(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function ml(e){return""+e}function Wv(e){const t=document.createElement("template");return t.innerHTML=e,t}const zv=new WeakMap,qv=new WeakMap,Hv=Symbol("un-keyed"),jv="replaceChildren"in Element.prototype;function Vv(e,t){jv?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function Gv(e,t){let n=e.firstChild,i=0;for(;n;){if(t[i]!==n)return!0;n=n.nextSibling,i++}return i!==t.length}function Qv(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=Gv(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&Vv(i,e)}function Yv(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:o,attributeName:a,attributeValuePre:r,attributeValuePost:d}}=n,c=e[o];if(s!==c)if(n.currentExpression=c,a)if(c===null)i.removeAttribute(a);else{const l=r+ml(c)+d;i.setAttribute(a,l)}else{let l;Array.isArray(c)?Qv(c,n):c instanceof Element?(l=c,i.replaceWith(l)):i.nodeValue=ml(c),l&&(n.targetNode=l)}}}function Jv(e){let t="",n=!1,i=!1,s=-1;const o=new Map,a=[];let r=0;for(let c=0,l=e.length;c<l;c++){const p=e[c];if(t+=p.slice(r),c===l-1)break;for(let x=0;x<p.length;x++)switch(p.charAt(x)){case"<":{p.charAt(x+1)==="/"?a.pop():(n=!0,a.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const h=a[a.length-1],v=Tn(o,h,()=>[]);let S,f,w;if(i){const x=/(\S+)="?([^"=]*)$/.exec(p);S=x[1],f=x[2];const C=/^([^">]*)("?)/.exec(e[c+1]);w=C[1],t=t.slice(0,-1*x[0].length),r=C[0].length}else r=0;const b={attributeName:S,attributeValuePre:f,attributeValuePost:w,expressionIndex:c};v.push(b),!n&&!i&&(t+=" ")}return{template:Wv(t),elementsToBindings:o}}function yl(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],o=s.attributeName?t:t.firstChild,a={binding:s,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(a)}}function Xv(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))yl(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,a=-1;do{const r=t.get(++a);r&&yl(r,o,n)}while(o=s.nextNode())}return n}function Zv(e){const{template:t,elementsToBindings:n}=Tn(zv,e,()=>Jv(e)),i=t.cloneNode(!0).content.firstElementChild,s=Xv(i,n);return function(a){return Yv(a,s),i}}function eb(e){const t=Tn(qv,e,()=>new Map);let n=Hv;function i(o,...a){const r=Tn(t,o,()=>new Map);return Tn(r,n,()=>Zv(o))(a)}function s(o,a,r){return o.map((d,c)=>{const l=n;n=r(d);try{return a(d,c)}finally{n=l}})}return{map:s,html:i}}function tb(e,t,n,i,s,o,a,r,d){const{labelWithSkin:c,titleForEmoji:l,unicodeWithSkin:p}=n,{html:h,map:v}=eb(t);function S(x,C,T){return v(x,(P,_)=>h`<button role="${C?"option":"menuitem"}" aria-selected="${C?_===t.activeSearchItem:null}" aria-label="${c(P,t.currentSkinTone)}" title="${l(P)}" class="${"emoji"+(C&&_===t.activeSearchItem?" active":"")+(P.unicode?"":" custom-emoji")}" id="${`${T}-${P.id}`}" style="${P.unicode?null:`--custom-emoji-background: url(${JSON.stringify(P.url)})`}">${P.unicode?p(P,t.currentSkinTone):""}</button>`,P=>`${T}-${P.id}`)}const w=h`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(t.searchMode&&t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?`emo-${t.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${v(t.skinTones,(x,C)=>h`<div id="skintone-${C}" class="emoji ${C===t.activeSkinTone?"active":""}" aria-selected="${C===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[C]}" aria-label="${t.i18n.skinTones[C]}">${x}</div>`,x=>x)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${v(t.groups,x=>h`<button role="tab" class="nav-button" aria-controls="tab-${x.id}" aria-label="${t.i18n.categories[x.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===x.id}" title="${t.i18n.categories[x.name]}" data-group-id="${x.id}"><div class="nav-emoji emoji">${x.emoji}</div></button>`,x=>x.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${v(t.currentEmojisWithCategories,(x,C)=>h`<div><div id="menu-label-${C}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:x.category?x.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${C!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(x.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${C}" id="${t.searchMode?"search-results":null}">${S(x.emojis,t.searchMode,"emo")}</div></div>`,x=>x.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${S(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,b=(x,C)=>{for(const T of e.querySelectorAll(`[${x}]`))C(T,T.getAttribute(x))};if(d){e.appendChild(w);for(const x of["click","focusout","input","keydown","keyup"])b(`data-on-${x}`,(C,T)=>{C.addEventListener(x,i[T])});b("data-ref",(x,C)=>{o[C]=x}),a.addEventListener("abort",()=>{e.removeChild(w)})}b("data-action",(x,C)=>{let T=r.get(C);T||r.set(C,T=new WeakSet),T.has(x)||(T.add(x),s[C](x))})}const Wi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function nb(e){let t=!1,n;const i=new Map,s=new Set;let o;const a=()=>{if(t)return;const c=[...s];s.clear();try{for(const l of c)l()}finally{o=!1,s.size&&(o=!0,Wi(a))}},r=new Proxy({},{get(c,l){if(n){let p=i.get(l);p||(p=new Set,i.set(l,p)),p.add(n)}return c[l]},set(c,l,p){if(c[l]!==p){c[l]=p;const h=i.get(l);if(h){for(const v of h)s.add(v);o||(o=!0,Wi(a))}}return!0}}),d=c=>{const l=()=>{const p=n;n=l;try{return c()}finally{n=p}};return l()};return e.addEventListener("abort",()=>{t=!0}),{state:r,createEffect:d}}function Vs(e,t,n){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}const vl=new WeakMap;function ib(e,t,n){{const i=e.closest(".tabpanel");let s=vl.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),vl.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const Gs=[],{assign:pi}=Object;function sb(e,t){const n={},i=new AbortController,s=i.signal,{state:o,createEffect:a}=nb(s),r=new Map;pi(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),pi(o,t),pi(o,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:xv,isRtl:!1,currentGroupIndex:0,groups:Ws,databaseLoaded:!1,activeSearchItemId:void 0}),a(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const d=A=>{e.getElementById(A).focus()},c=A=>e.getElementById(`emo-${A.id}`),l=(A,M)=>{n.rootElement.dispatchEvent(new CustomEvent(A,{detail:M,bubbles:!0,composed:!0}))},p=(A,M)=>A.id===M.id,h=(A,M)=>{const{category:F,emojis:O}=A,{category:Y,emojis:j}=M;return F!==Y?!1:Vs(O,j,p)},v=A=>{Vs(o.currentEmojis,A,p)||(o.currentEmojis=A)},S=A=>{o.searchMode!==A&&(o.searchMode=A)},f=A=>{Vs(o.currentEmojisWithCategories,A,h)||(o.currentEmojisWithCategories=A)},w=(A,M)=>M&&A.skins&&A.skins[M]||A.unicode,C={labelWithSkin:(A,M)=>Uv([A.name||w(A,M),A.annotation,...A.shortcodes||Gs].filter(Boolean)).join(", "),titleForEmoji:A=>A.annotation||(A.shortcodes||Gs).join(", "),unicodeWithSkin:w},T={onClickSkinToneButton:Q,onEmojiClick:zn,onNavClick:Kn,onNavKeydown:rs,onSearchKeydown:as,onSkinToneOptionsClick:qn,onSkinToneOptionsFocusOut:Je,onSkinToneOptionsKeydown:ct,onSkinToneOptionsKeyup:nn,onSearchInput:Hn},P={calculateEmojiGridStyle:H,updateOnIntersection:ie};let _=!0;a(()=>{tb(e,o,C,T,P,n,s,r,_),_=!1}),o.emojiVersion||qs().then(A=>{A||(o.message=o.i18n.emojiUnsupportedMessage)}),a(()=>{async function A(){let M=!1;const F=setTimeout(()=>{M=!0,o.message=o.i18n.loadingMessage},$v);try{await o.database.ready(),o.databaseLoaded=!0}catch(O){console.error(O),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(F),M&&(M=!1,o.message="")}}o.database&&A()}),a(()=>{o.pickerStyle=`
|
|
2641
|
+
For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function zv(e){return ru(e,t=>t)}function Hv(e){e&&(e.scrollTop=0)}function Tn(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function ml(e){return""+e}function qv(e){const t=document.createElement("template");return t.innerHTML=e,t}const jv=new WeakMap,Vv=new WeakMap,Gv=Symbol("un-keyed"),Qv="replaceChildren"in Element.prototype;function Jv(e,t){Qv?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function Yv(e,t){let n=e.firstChild,i=0;for(;n;){if(t[i]!==n)return!0;n=n.nextSibling,i++}return i!==t.length}function Xv(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=Yv(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&Jv(i,e)}function Zv(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:o,attributeName:r,attributeValuePre:a,attributeValuePost:d}}=n,c=e[o];if(s!==c)if(n.currentExpression=c,r)if(c===null)i.removeAttribute(r);else{const l=a+ml(c)+d;i.setAttribute(r,l)}else{let l;Array.isArray(c)?Xv(c,n):c instanceof Element?(l=c,i.replaceWith(l)):i.nodeValue=ml(c),l&&(n.targetNode=l)}}}function eb(e){let t="",n=!1,i=!1,s=-1;const o=new Map,r=[];let a=0;for(let c=0,l=e.length;c<l;c++){const p=e[c];if(t+=p.slice(a),c===l-1)break;for(let x=0;x<p.length;x++)switch(p.charAt(x)){case"<":{p.charAt(x+1)==="/"?r.pop():(n=!0,r.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const f=r[r.length-1],v=Tn(o,f,()=>[]);let S,h,b;if(i){const x=/(\S+)="?([^"=]*)$/.exec(p);S=x[1],h=x[2];const A=/^([^">]*)("?)/.exec(e[c+1]);b=A[1],t=t.slice(0,-1*x[0].length),a=A[0].length}else a=0;const w={attributeName:S,attributeValuePre:h,attributeValuePost:b,expressionIndex:c};v.push(w),!n&&!i&&(t+=" ")}return{template:qv(t),elementsToBindings:o}}function yl(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],o=s.attributeName?t:t.firstChild,r={binding:s,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(r)}}function tb(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))yl(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,r=-1;do{const a=t.get(++r);a&&yl(a,o,n)}while(o=s.nextNode())}return n}function nb(e){const{template:t,elementsToBindings:n}=Tn(jv,e,()=>eb(e)),i=t.cloneNode(!0).content.firstElementChild,s=tb(i,n);return function(r){return Zv(r,s),i}}function ib(e){const t=Tn(Vv,e,()=>new Map);let n=Gv;function i(o,...r){const a=Tn(t,o,()=>new Map);return Tn(a,n,()=>nb(o))(r)}function s(o,r,a){return o.map((d,c)=>{const l=n;n=a(d);try{return r(d,c)}finally{n=l}})}return{map:s,html:i}}function sb(e,t,n,i,s,o,r,a,d){const{labelWithSkin:c,titleForEmoji:l,unicodeWithSkin:p}=n,{html:f,map:v}=ib(t);function S(x,A,C){return v(x,(P,_)=>f`<button role="${A?"option":"menuitem"}" aria-selected="${A?_===t.activeSearchItem:null}" aria-label="${c(P,t.currentSkinTone)}" title="${l(P)}" class="${"emoji"+(A&&_===t.activeSearchItem?" active":"")+(P.unicode?"":" custom-emoji")}" id="${`${C}-${P.id}`}" style="${P.unicode?null:`--custom-emoji-background: url(${JSON.stringify(P.url)})`}">${P.unicode?p(P,t.currentSkinTone):""}</button>`,P=>`${C}-${P.id}`)}const b=f`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(t.searchMode&&t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?`emo-${t.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${v(t.skinTones,(x,A)=>f`<div id="skintone-${A}" class="emoji ${A===t.activeSkinTone?"active":""}" aria-selected="${A===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[A]}" aria-label="${t.i18n.skinTones[A]}">${x}</div>`,x=>x)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${v(t.groups,x=>f`<button role="tab" class="nav-button" aria-controls="tab-${x.id}" aria-label="${t.i18n.categories[x.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===x.id}" title="${t.i18n.categories[x.name]}" data-group-id="${x.id}"><div class="nav-emoji emoji">${x.emoji}</div></button>`,x=>x.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${v(t.currentEmojisWithCategories,(x,A)=>f`<div><div id="menu-label-${A}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:x.category?x.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${A!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(x.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${A}" id="${t.searchMode?"search-results":null}">${S(x.emojis,t.searchMode,"emo")}</div></div>`,x=>x.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${S(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,w=(x,A)=>{for(const C of e.querySelectorAll(`[${x}]`))A(C,C.getAttribute(x))};if(d){e.appendChild(b);for(const x of["click","focusout","input","keydown","keyup"])w(`data-on-${x}`,(A,C)=>{A.addEventListener(x,i[C])});w("data-ref",(x,A)=>{o[A]=x}),r.addEventListener("abort",()=>{e.removeChild(b)})}w("data-action",(x,A)=>{let C=a.get(A);C||a.set(A,C=new WeakSet),C.has(x)||(C.add(x),s[A](x))})}const Ki=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function ob(e){let t=!1,n;const i=new Map,s=new Set;let o;const r=()=>{if(t)return;const c=[...s];s.clear();try{for(const l of c)l()}finally{o=!1,s.size&&(o=!0,Ki(r))}},a=new Proxy({},{get(c,l){if(n){let p=i.get(l);p||(p=new Set,i.set(l,p)),p.add(n)}return c[l]},set(c,l,p){if(c[l]!==p){c[l]=p;const f=i.get(l);if(f){for(const v of f)s.add(v);o||(o=!0,Ki(r))}}return!0}}),d=c=>{const l=()=>{const p=n;n=l;try{return c()}finally{n=p}};return l()};return e.addEventListener("abort",()=>{t=!0}),{state:a,createEffect:d}}function Vs(e,t,n){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}const vl=new WeakMap;function rb(e,t,n){{const i=e.closest(".tabpanel");let s=vl.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),vl.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const Gs=[],{assign:pi}=Object;function ab(e,t){const n={},i=new AbortController,s=i.signal,{state:o,createEffect:r}=ob(s),a=new Map;pi(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),pi(o,t),pi(o,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Cv,isRtl:!1,currentGroupIndex:0,groups:Ks,databaseLoaded:!1,activeSearchItemId:void 0}),r(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const d=E=>{e.getElementById(E).focus()},c=E=>e.getElementById(`emo-${E.id}`),l=(E,M)=>{n.rootElement.dispatchEvent(new CustomEvent(E,{detail:M,bubbles:!0,composed:!0}))},p=(E,M)=>E.id===M.id,f=(E,M)=>{const{category:F,emojis:O}=E,{category:J,emojis:V}=M;return F!==J?!1:Vs(O,V,p)},v=E=>{Vs(o.currentEmojis,E,p)||(o.currentEmojis=E)},S=E=>{o.searchMode!==E&&(o.searchMode=E)},h=E=>{Vs(o.currentEmojisWithCategories,E,f)||(o.currentEmojisWithCategories=E)},b=(E,M)=>M&&E.skins&&E.skins[M]||E.unicode,A={labelWithSkin:(E,M)=>zv([E.name||b(E,M),E.annotation,...E.shortcodes||Gs].filter(Boolean)).join(", "),titleForEmoji:E=>E.annotation||(E.shortcodes||Gs).join(", "),unicodeWithSkin:b},C={onClickSkinToneButton:Q,onEmojiClick:zn,onNavClick:Wn,onNavKeydown:as,onSearchKeydown:rs,onSkinToneOptionsClick:Hn,onSkinToneOptionsFocusOut:Ye,onSkinToneOptionsKeydown:ct,onSkinToneOptionsKeyup:nn,onSearchInput:qn},P={calculateEmojiGridStyle:z,updateOnIntersection:te};let _=!0;r(()=>{sb(e,o,A,C,P,n,s,a,_),_=!1}),o.emojiVersion||Hs().then(E=>{E||(o.message=o.i18n.emojiUnsupportedMessage)}),r(()=>{async function E(){let M=!1;const F=setTimeout(()=>{M=!0,o.message=o.i18n.loadingMessage},Av);try{await o.database.ready(),o.databaseLoaded=!0}catch(O){console.error(O),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(F),M&&(M=!1,o.message="")}}o.database&&E()}),r(()=>{o.pickerStyle=`
|
|
2527
2642
|
--num-groups: ${o.groups.length};
|
|
2528
2643
|
--indicator-opacity: ${o.searchMode?0:1};
|
|
2529
|
-
--num-skintones: ${pl};`}),a(()=>{o.customEmoji&&o.database&&N()}),a(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==xo&&(o.groups=xo):o.groups!==Ws&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=Ws)}),a(()=>{async function A(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}A()}),a(()=>{o.skinTones=Array(pl).fill().map((A,M)=>Dv(o.skinToneEmoji,M))}),a(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),a(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),a(()=>{async function A(){const{database:M}=o,F=(await Promise.all(Av.map(O=>M.getEmojiByUnicodeOrName(O)))).filter(Boolean);o.defaultFavoriteEmojis=F}o.databaseLoaded&&A()});function N(){const{customEmoji:A,database:M}=o,F=A||Gs;M.customEmoji!==F&&(M.customEmoji=F)}a(()=>{async function A(){N();const{database:M,defaultFavoriteEmojis:F,numColumns:O}=o,Y=await M.getTopFavoriteEmoji(O),j=await lt(ou([...Y,...F],de=>de.unicode||de.name).slice(0,O));o.currentFavorites=j}o.databaseLoaded&&o.defaultFavoriteEmojis&&A()});function H(A){Fv(A,s,()=>{{const M=getComputedStyle(n.rootElement),F=parseInt(M.getPropertyValue("--num-columns"),10),O=M.getPropertyValue("direction")==="rtl";o.numColumns=F,o.isRtl=O}})}function ie(A){ib(A,s,M=>{for(const{target:F,isIntersecting:O}of M)F.classList.toggle("onscreen",O)})}a(()=>{async function A(){const{searchText:M,currentGroup:F,databaseLoaded:O,customEmoji:Y}=o;if(!O)o.currentEmojis=[],o.searchMode=!1;else if(M.length>=wv){const j=await os(M);o.searchText===M&&(v(j),S(!0))}else{const{id:j}=F;if(j!==-1||Y&&Y.length){const de=await ss(j);o.currentGroup.id===j&&(v(de),S(!1))}}}A()});const be=()=>{bi(()=>Kv(n.tabpanelElement))};a(()=>{const{currentEmojis:A,emojiVersion:M}=o,F=A.filter(O=>O.unicode).filter(O=>hl(O)&&!Ao.has(O.unicode));if(!M&&F.length)v(A),bi(()=>X(F));else{const O=M?A:A.filter(rt);v(O),be()}});function X(A){Ov(A,n.baselineEmoji,c)?be():o.currentEmojis=[...o.currentEmojis]}function rt(A){return!A.unicode||!hl(A)||Ao.get(A.unicode)}async function It(A){const M=o.emojiVersion||await qs();return A.filter(({version:F})=>!F||F<=M)}async function lt(A){return Bv(A,o.emojiVersion||await qs())}async function ss(A){const M=A===-1?o.customEmoji:await o.database.getEmojiByGroup(A);return lt(await It(M))}async function os(A){return lt(await It(await o.database.getEmojiBySearchQuery(A)))}a(()=>{}),a(()=>{function A(){const{searchMode:F,currentEmojis:O}=o;if(F)return[{category:"",emojis:O}];const Y=new Map;for(const j of O){const de=j.category||"";let Xe=Y.get(de);Xe||(Xe=[],Y.set(de,Xe)),Xe.push(j)}return[...Y.entries()].map(([j,de])=>({category:j,emojis:de})).sort((j,de)=>o.customCategorySorting(j.category,de.category))}const M=A();f(M)}),a(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),a(()=>{const{rawSearchText:A}=o;iu(()=>{o.searchText=(A||"").trim(),o.activeSearchItem=-1})});function as(A){if(!o.searchMode||!o.currentEmojis.length)return;const M=F=>{Pe(A),o.activeSearchItem=Hs(F,o.activeSearchItem,o.currentEmojis)};switch(A.key){case"ArrowDown":return M(!1);case"ArrowUp":return M(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return Pe(A),Z(o.currentEmojis[o.activeSearchItem].id)}}function Kn(A){const{target:M}=A,F=M.closest(".nav-button");if(!F)return;const O=parseInt(F.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(Y=>Y.id===O)}function rs(A){const{target:M,key:F}=A,O=Y=>{Y&&(Pe(A),Y.focus())};switch(F){case"ArrowLeft":return O(M.previousElementSibling);case"ArrowRight":return O(M.nextElementSibling);case"Home":return O(M.parentElement.firstElementChild);case"End":return O(M.parentElement.lastElementChild)}}async function Wn(A){const M=await o.database.getEmojiByUnicodeOrName(A),F=[...o.currentEmojis,...o.currentFavorites].find(Y=>Y.id===A),O=F.unicode&&w(F,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(A),{emoji:M,skinTone:o.currentSkinTone,...O&&{unicode:O},...F.name&&{name:F.name}}}async function Z(A){const M=Wn(A);l("emoji-click-sync",M),l("emoji-click",await M)}function zn(A){const{target:M}=A;if(!M.classList.contains("emoji"))return;Pe(A);const F=M.id.substring(4);Z(F)}function ee(A){o.currentSkinTone=A,o.skinTonePickerExpanded=!1,d("skintone-button"),l("skin-tone-change",{skinTone:A}),o.database.setPreferredSkinTone(A)}function qn(A){const{target:{id:M}}=A,F=M&&M.match(/^skintone-(\d)/);if(!F)return;Pe(A);const O=parseInt(F[1],10);ee(O)}function Q(A){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&(Pe(A),bi(()=>d("skintone-list")))}a(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function ct(A){if(!o.skinTonePickerExpanded)return;const M=async F=>{Pe(A),o.activeSkinTone=F};switch(A.key){case"ArrowUp":return M(Hs(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return M(Hs(!1,o.activeSkinTone,o.skinTones));case"Home":return M(0);case"End":return M(o.skinTones.length-1);case"Enter":return Pe(A),ee(o.activeSkinTone);case"Escape":return Pe(A),o.skinTonePickerExpanded=!1,d("skintone-button")}}function nn(A){if(o.skinTonePickerExpanded&&A.key===" ")return Pe(A),ee(o.activeSkinTone)}async function Je(A){const{relatedTarget:M}=A;(!M||M.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function Hn(A){o.rawSearchText=A.target.value}return{$set(A){pi(o,A)},$destroy(){i.abort()}}}const ob="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",ab="en";var rb={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading…",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}},lb=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const au=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],cb=`:host{--emoji-font-family:${su}}`;class Sa extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=lb+cb,this.shadowRoot.appendChild(n),this._ctx={locale:ab,dataSource:ob,skinToneEmoji:Sv,customCategorySorting:Cv,customEmoji:null,i18n:rb,emojiVersion:null,...t};for(const i of au)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){bl(this),this._cmp||(this._cmp=sb(this.shadowRoot,this._ctx))}disconnectedCallback(){bl(this),Wi(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,i){this._set(t.replace(/-([a-z])/g,(s,o)=>o.toUpperCase()),t==="emoji-version"?parseFloat(i):i)}_set(t,n){this._ctx[t]=n,this._cmp&&this._cmp.$set({[t]:n}),["locale","dataSource"].includes(t)&&this._dbFlush()}_dbCreate(){const{locale:t,dataSource:n,database:i}=this._ctx;(!i||i.locale!==t||i.dataSource!==n)&&this._set("database",new bv({locale:t,dataSource:n}))}_dbFlush(){Wi(()=>this._dbCreate())}}const ru={};for(const e of au)ru[e]={get(){return e==="database"&&this._dbCreate(),this._ctx[e]},set(t){if(e==="database")throw new Error("database is read-only");this._set(e,t)}};Object.defineProperties(Sa.prototype,ru);function bl(e){e instanceof Sa||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Sa);function db(e){e.style.height="0";const t=Math.max(e.scrollHeight,44);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>e.offsetHeight?"auto":"hidden"}function wl(e){e.style.height="44px",e.style.overflowY="hidden"}const ub=5e3;function pb(e){return e?e.active?u`
|
|
2644
|
+
--num-skintones: ${pl};`}),r(()=>{o.customEmoji&&o.database&&B()}),r(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==xo&&(o.groups=xo):o.groups!==Ks&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=Ks)}),r(()=>{async function E(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}E()}),r(()=>{o.skinTones=Array(pl).fill().map((E,M)=>Fv(o.skinToneEmoji,M))}),r(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),r(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),r(()=>{async function E(){const{database:M}=o,F=(await Promise.all(Tv.map(O=>M.getEmojiByUnicodeOrName(O)))).filter(Boolean);o.defaultFavoriteEmojis=F}o.databaseLoaded&&E()});function B(){const{customEmoji:E,database:M}=o,F=E||Gs;M.customEmoji!==F&&(M.customEmoji=F)}r(()=>{async function E(){B();const{database:M,defaultFavoriteEmojis:F,numColumns:O}=o,J=await M.getTopFavoriteEmoji(O),V=await lt(ru([...J,...F],ue=>ue.unicode||ue.name).slice(0,O));o.currentFavorites=V}o.databaseLoaded&&o.defaultFavoriteEmojis&&E()});function z(E){Wv(E,s,()=>{{const M=getComputedStyle(n.rootElement),F=parseInt(M.getPropertyValue("--num-columns"),10),O=M.getPropertyValue("direction")==="rtl";o.numColumns=F,o.isRtl=O}})}function te(E){rb(E,s,M=>{for(const{target:F,isIntersecting:O}of M)F.classList.toggle("onscreen",O)})}r(()=>{async function E(){const{searchText:M,currentGroup:F,databaseLoaded:O,customEmoji:J}=o;if(!O)o.currentEmojis=[],o.searchMode=!1;else if(M.length>=Sv){const V=await os(M);o.searchText===M&&(v(V),S(!0))}else{const{id:V}=F;if(V!==-1||J&&J.length){const ue=await ss(V);o.currentGroup.id===V&&(v(ue),S(!1))}}}E()});const be=()=>{bi(()=>Hv(n.tabpanelElement))};r(()=>{const{currentEmojis:E,emojiVersion:M}=o,F=E.filter(O=>O.unicode).filter(O=>hl(O)&&!Ao.has(O.unicode));if(!M&&F.length)v(E),bi(()=>X(F));else{const O=M?E:E.filter(at);v(O),be()}});function X(E){Kv(E,n.baselineEmoji,c)?be():o.currentEmojis=[...o.currentEmojis]}function at(E){return!E.unicode||!hl(E)||Ao.get(E.unicode)}async function It(E){const M=o.emojiVersion||await Hs();return E.filter(({version:F})=>!F||F<=M)}async function lt(E){return Ov(E,o.emojiVersion||await Hs())}async function ss(E){const M=E===-1?o.customEmoji:await o.database.getEmojiByGroup(E);return lt(await It(M))}async function os(E){return lt(await It(await o.database.getEmojiBySearchQuery(E)))}r(()=>{}),r(()=>{function E(){const{searchMode:F,currentEmojis:O}=o;if(F)return[{category:"",emojis:O}];const J=new Map;for(const V of O){const ue=V.category||"";let Xe=J.get(ue);Xe||(Xe=[],J.set(ue,Xe)),Xe.push(V)}return[...J.entries()].map(([V,ue])=>({category:V,emojis:ue})).sort((V,ue)=>o.customCategorySorting(V.category,ue.category))}const M=E();h(M)}),r(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),r(()=>{const{rawSearchText:E}=o;su(()=>{o.searchText=(E||"").trim(),o.activeSearchItem=-1})});function rs(E){if(!o.searchMode||!o.currentEmojis.length)return;const M=F=>{Pe(E),o.activeSearchItem=qs(F,o.activeSearchItem,o.currentEmojis)};switch(E.key){case"ArrowDown":return M(!1);case"ArrowUp":return M(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return Pe(E),Z(o.currentEmojis[o.activeSearchItem].id)}}function Wn(E){const{target:M}=E,F=M.closest(".nav-button");if(!F)return;const O=parseInt(F.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(J=>J.id===O)}function as(E){const{target:M,key:F}=E,O=J=>{J&&(Pe(E),J.focus())};switch(F){case"ArrowLeft":return O(M.previousElementSibling);case"ArrowRight":return O(M.nextElementSibling);case"Home":return O(M.parentElement.firstElementChild);case"End":return O(M.parentElement.lastElementChild)}}async function Kn(E){const M=await o.database.getEmojiByUnicodeOrName(E),F=[...o.currentEmojis,...o.currentFavorites].find(J=>J.id===E),O=F.unicode&&b(F,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(E),{emoji:M,skinTone:o.currentSkinTone,...O&&{unicode:O},...F.name&&{name:F.name}}}async function Z(E){const M=Kn(E);l("emoji-click-sync",M),l("emoji-click",await M)}function zn(E){const{target:M}=E;if(!M.classList.contains("emoji"))return;Pe(E);const F=M.id.substring(4);Z(F)}function ee(E){o.currentSkinTone=E,o.skinTonePickerExpanded=!1,d("skintone-button"),l("skin-tone-change",{skinTone:E}),o.database.setPreferredSkinTone(E)}function Hn(E){const{target:{id:M}}=E,F=M&&M.match(/^skintone-(\d)/);if(!F)return;Pe(E);const O=parseInt(F[1],10);ee(O)}function Q(E){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&(Pe(E),bi(()=>d("skintone-list")))}r(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function ct(E){if(!o.skinTonePickerExpanded)return;const M=async F=>{Pe(E),o.activeSkinTone=F};switch(E.key){case"ArrowUp":return M(qs(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return M(qs(!1,o.activeSkinTone,o.skinTones));case"Home":return M(0);case"End":return M(o.skinTones.length-1);case"Enter":return Pe(E),ee(o.activeSkinTone);case"Escape":return Pe(E),o.skinTonePickerExpanded=!1,d("skintone-button")}}function nn(E){if(o.skinTonePickerExpanded&&E.key===" ")return Pe(E),ee(o.activeSkinTone)}async function Ye(E){const{relatedTarget:M}=E;(!M||M.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function qn(E){o.rawSearchText=E.target.value}return{$set(E){pi(o,E)},$destroy(){i.abort()}}}const lb="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",cb="en";var db={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading…",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}},ub=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const au=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],pb=`:host{--emoji-font-family:${ou}}`;class Sr extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=ub+pb,this.shadowRoot.appendChild(n),this._ctx={locale:cb,dataSource:lb,skinToneEmoji:Ev,customCategorySorting:_v,customEmoji:null,i18n:db,emojiVersion:null,...t};for(const i of au)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){bl(this),this._cmp||(this._cmp=ab(this.shadowRoot,this._ctx))}disconnectedCallback(){bl(this),Ki(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,i){this._set(t.replace(/-([a-z])/g,(s,o)=>o.toUpperCase()),t==="emoji-version"?parseFloat(i):i)}_set(t,n){this._ctx[t]=n,this._cmp&&this._cmp.$set({[t]:n}),["locale","dataSource"].includes(t)&&this._dbFlush()}_dbCreate(){const{locale:t,dataSource:n,database:i}=this._ctx;(!i||i.locale!==t||i.dataSource!==n)&&this._set("database",new $v({locale:t,dataSource:n}))}_dbFlush(){Ki(()=>this._dbCreate())}}const lu={};for(const e of au)lu[e]={get(){return e==="database"&&this._dbCreate(),this._ctx[e]},set(t){if(e==="database")throw new Error("database is read-only");this._set(e,t)}};Object.defineProperties(Sr.prototype,lu);function bl(e){e instanceof Sr||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Sr);function hb(e){e.style.height="0";const t=Math.max(e.scrollHeight,44);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>e.offsetHeight?"auto":"hidden"}function wl(e){e.style.height="44px",e.style.overflowY="hidden"}const fb=5e3;function gb(e){return e?e.active?u`
|
|
2530
2645
|
<div class="callout info compaction-indicator compaction-indicator--active">
|
|
2531
2646
|
${L.loader} Compacting context...
|
|
2532
2647
|
</div>
|
|
2533
|
-
`:e.completedAt&&Date.now()-e.completedAt<
|
|
2648
|
+
`:e.completedAt&&Date.now()-e.completedAt<fb?u`
|
|
2534
2649
|
<div class="callout success compaction-indicator compaction-indicator--complete">
|
|
2535
2650
|
${L.check} Context compacted
|
|
2536
2651
|
</div>
|
|
2537
|
-
`:k:k}const
|
|
2652
|
+
`:k:k}const qe=5*1024*1024;function je(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Ee(e,t){var i,s,o;let n=(i=e.closest(".chat"))==null?void 0:i.querySelector(".chat-attachment-error");if(!n){n=document.createElement("div"),n.className="callout danger chat-attachment-error",n.style.cssText="margin: 8px 4px; animation: fade-in 200ms ease-out;";const r=(s=e.closest(".chat"))==null?void 0:s.querySelector(".chat-compose");(o=r==null?void 0:r.parentElement)==null||o.insertBefore(n,r)}n.textContent=t,setTimeout(()=>n==null?void 0:n.remove(),4e3)}const mb=/\.(md|txt|csv|json|xml|html|css|js|ts|py|sh|yaml|yml|toml|ini|cfg|log|sql)$/i;function cu(e){return e.type.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name)}function du(e){return e.type.startsWith("text/")||e.type==="application/json"||e.type==="application/xml"||mb.test(e.name)}function uu(e){return e.type==="application/pdf"||/\.pdf$/i.test(e.name)}function pu(e){return e.type.startsWith("video/")||/\.(mp4|webm|mov|avi|mkv|m4v)$/i.test(e.name)}function yb(e,t){if(!t.onAttachmentsChange)return;const n=document.querySelector(".chat");if(cu(e)){if(e.size>qe){n&&Ee(n,`Image too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:je(),dataUrl:i.result,mimeType:e.type};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else if(du(e)){if(e.size>qe){n&&Ee(n,`File too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:je(),dataUrl:"",mimeType:e.type||"text/plain",fileName:e.name,textContent:i.result};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsText(e)}else if(uu(e)){if(e.size>qe){n&&Ee(n,`PDF too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:je(),dataUrl:i.result,mimeType:"application/pdf",fileName:e.name};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else if(pu(e)){if(e.size>qe){n&&Ee(n,`Video too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:je(),dataUrl:i.result,mimeType:e.type||"video/mp4",fileName:e.name};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else n&&Ee(n,`Unsupported file type: ${e.name}. Use the Files page to upload to workspace.`)}function vb(e,t){var s;e.preventDefault(),e.stopPropagation();const n=e.currentTarget;n.classList.remove("chat--dragover");const i=(s=e.dataTransfer)==null?void 0:s.files;if(!(!i||i.length===0))for(let o=0;o<i.length;o++){const r=i[o];if(cu(r)){if(!t.onAttachmentsChange)continue;if(r.size>qe){Ee(n,`Image too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var p;const d=a.result,c={id:je(),dataUrl:d,mimeType:r.type},l=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...l,c])},a.readAsDataURL(r)}else if(du(r)){if(!t.onAttachmentsChange)continue;if(r.size>qe){Ee(n,`File too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var p;const d=a.result,c={id:je(),dataUrl:"",mimeType:r.type||"text/plain",fileName:r.name,textContent:d},l=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...l,c])},a.readAsText(r)}else if(uu(r)){if(!t.onAttachmentsChange)continue;if(r.size>qe){Ee(n,`PDF too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var p;const d=a.result,c={id:je(),dataUrl:d,mimeType:"application/pdf",fileName:r.name},l=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...l,c])},a.readAsDataURL(r)}else if(pu(r)){if(!t.onAttachmentsChange)continue;if(r.size>qe){Ee(n,`Video too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var p;const d=a.result,c={id:je(),dataUrl:d,mimeType:r.type||"video/mp4",fileName:r.name},l=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...l,c])},a.readAsDataURL(r)}else Ee(n,`Unsupported file type: ${r.name}. Use the Files page to upload to workspace.`)}}function bb(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),e.currentTarget.classList.add("chat--dragover")}function wb(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&t.classList.remove("chat--dragover")}function kb(e,t){var s,o,r;const n=(s=e.clipboardData)==null?void 0:s.items;if(!n||!t.onAttachmentsChange)return;const i=[];for(let a=0;a<n.length;a++){const d=n[a];(d.type.startsWith("image/")||d.type.startsWith("video/"))&&i.push(d)}if(i.length!==0){e.preventDefault();for(const a of i){const d=a.getAsFile();if(!d)continue;const c=d.type.startsWith("video/")?"Video":"Image";if(d.size>qe){const p=((r=(o=e.target)==null?void 0:o.closest)==null?void 0:r.call(o,".chat"))??document.querySelector(".chat");p&&Ee(p,`${c} too large (${(d.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const l=new FileReader;l.onload=()=>{var h;const p=l.result,f=d.type.startsWith("video/"),v={id:je(),dataUrl:p,mimeType:d.type,fileName:f?d.name||"video.mp4":void 0},S=t.attachments??[];(h=t.onAttachmentsChange)==null||h.call(t,[...S,v])},l.readAsDataURL(d)}}}function $b(e){const t=e.currentTarget,n=t.closest(".chat-compose"),i=n==null?void 0:n.querySelector(".emoji-picker-popup");if(!i)return;const s=i.classList.toggle("active");if(t.classList.toggle("active",s),s){const o=r=>{i.contains(r.target)||t.contains(r.target)||(i.classList.remove("active"),t.classList.remove("active"),document.removeEventListener("click",o,!0))};requestAnimationFrame(()=>document.addEventListener("click",o,!0))}}function Sb(e,t){const n=e.detail,i=n==null?void 0:n.unicode;if(!i)return;const s=e.currentTarget.closest(".chat-compose"),o=s==null?void 0:s.querySelector("textarea");if(!o)return;const r=o.selectionStart??t.draft.length,a=o.selectionEnd??r,d=t.draft.slice(0,r),c=t.draft.slice(a);t.onDraftChange(d+i+c);const l=s==null?void 0:s.querySelector(".emoji-picker-popup"),p=s==null?void 0:s.querySelector(".chat-compose__emoji");l==null||l.classList.remove("active"),p==null||p.classList.remove("active"),requestAnimationFrame(()=>{o.focus();const f=r+i.length;o.setSelectionRange(f,f)})}function xb(e){const t=e.attachments??[];return t.length===0?k:u`
|
|
2538
2653
|
<div class="chat-attachments">
|
|
2539
2654
|
${t.map(n=>{var i;return n.fileName?u`
|
|
2540
2655
|
<div class="chat-attachment chat-attachment--file">
|
|
@@ -2544,7 +2659,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2544
2659
|
class="chat-attachment__remove chat-attachment__remove--file"
|
|
2545
2660
|
type="button"
|
|
2546
2661
|
aria-label="Remove attachment"
|
|
2547
|
-
@click=${()=>{var o;const s=(e.attachments??[]).filter(
|
|
2662
|
+
@click=${()=>{var o;const s=(e.attachments??[]).filter(r=>r.id!==n.id);(o=e.onAttachmentsChange)==null||o.call(e,s)}}
|
|
2548
2663
|
>
|
|
2549
2664
|
${L.x}
|
|
2550
2665
|
</button>
|
|
@@ -2560,14 +2675,14 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2560
2675
|
class="chat-attachment__remove"
|
|
2561
2676
|
type="button"
|
|
2562
2677
|
aria-label="Remove attachment"
|
|
2563
|
-
@click=${()=>{var o;const s=(e.attachments??[]).filter(
|
|
2678
|
+
@click=${()=>{var o;const s=(e.attachments??[]).filter(r=>r.id!==n.id);(o=e.onAttachmentsChange)==null||o.call(e,s)}}
|
|
2564
2679
|
>
|
|
2565
2680
|
${L.x}
|
|
2566
2681
|
</button>
|
|
2567
2682
|
</div>
|
|
2568
2683
|
`})}
|
|
2569
2684
|
</div>
|
|
2570
|
-
`}function
|
|
2685
|
+
`}function hu(e){var S,h,b;const t=e.connected,n=e.sending||e.stream!==null,i=!!(e.canAbort&&e.onAbort),s=(h=(S=e.sessions)==null?void 0:S.sessions)==null?void 0:h.find(w=>w.key===e.sessionKey),o=(s==null?void 0:s.reasoningLevel)??"off",r=e.showThinking&&o!=="off";e.assistantName,e.assistantAvatar??e.assistantAvatarUrl;const a=(((b=e.attachments)==null?void 0:b.length)??0)>0,d=e.connected?a?"Add a message...":"Message...":"Connecting…";My({onSend:w=>{e.onAttachmentsChange&&e.onAttachmentsChange([...e.attachments??[],w]),requestAnimationFrame(()=>e.onSend())},onRequestRender:()=>{var w;(w=e.requestUpdate)==null||w.call(e)}});const c=_y(),l=!c&&!e.draft.trim()&&!a&&!n,p=e.splitRatio??.6,f=!!(e.sidebarOpen&&e.onCloseSidebar),v=u`
|
|
2571
2686
|
<div
|
|
2572
2687
|
class="chat-thread"
|
|
2573
2688
|
role="log"
|
|
@@ -2578,20 +2693,20 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2578
2693
|
${e.loadingOlder?u`<span class="chat-load-more__spinner">${L.loader}</span> Loading older messages…`:u`<button class="chat-load-more__btn" type="button" @click=${e.onLoadOlder}>Load older messages</button>`}
|
|
2579
2694
|
</div>`:k}
|
|
2580
2695
|
${e.loading?u`<div class="muted">Loading chat…</div>`:k}
|
|
2581
|
-
${
|
|
2696
|
+
${Og(Pb(e),w=>w.key,w=>w.kind==="interim"?by(w.text):w.kind==="reading-indicator"?vy():w.kind==="stream"?wy(w.text,w.startedAt,e.onOpenSidebar):w.kind==="group"?ky(w,{onOpenSidebar:e.onOpenSidebar,showReasoning:r,assistantName:e.assistantName}):k)}
|
|
2582
2697
|
</div>
|
|
2583
2698
|
`;return u`
|
|
2584
2699
|
<section
|
|
2585
2700
|
class="card chat"
|
|
2586
|
-
@drop=${
|
|
2587
|
-
@dragover=${
|
|
2588
|
-
@dragleave=${
|
|
2701
|
+
@drop=${w=>vb(w,e)}
|
|
2702
|
+
@dragover=${bb}
|
|
2703
|
+
@dragleave=${wb}
|
|
2589
2704
|
>
|
|
2590
2705
|
${e.disabledReason?u`<div class="callout">${e.disabledReason}</div>`:k}
|
|
2591
2706
|
|
|
2592
2707
|
${e.error?u`<div class="callout danger">${e.error}</div>`:k}
|
|
2593
2708
|
|
|
2594
|
-
${
|
|
2709
|
+
${gb(e.compactionStatus)}
|
|
2595
2710
|
|
|
2596
2711
|
${e.focusMode?u`
|
|
2597
2712
|
<button
|
|
@@ -2606,18 +2721,18 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2606
2721
|
`:k}
|
|
2607
2722
|
|
|
2608
2723
|
<div
|
|
2609
|
-
class="chat-split-container ${
|
|
2724
|
+
class="chat-split-container ${f?"chat-split-container--open":""}"
|
|
2610
2725
|
>
|
|
2611
2726
|
<div
|
|
2612
2727
|
class="chat-main"
|
|
2613
|
-
style="flex: ${
|
|
2728
|
+
style="flex: ${f?`0 0 ${p*100}%`:"1 1 100%"}"
|
|
2614
2729
|
>
|
|
2615
2730
|
${v}
|
|
2616
2731
|
${e.nearBottom===!1?u`
|
|
2617
2732
|
<button
|
|
2618
2733
|
class="chat-scroll-bottom"
|
|
2619
2734
|
type="button"
|
|
2620
|
-
@click=${
|
|
2735
|
+
@click=${w=>{const x=w.currentTarget.closest(".chat-main"),A=x==null?void 0:x.querySelector(".chat-thread");A&&A.scrollTo({top:A.scrollHeight,behavior:"smooth"})}}
|
|
2621
2736
|
aria-label="Scroll to bottom"
|
|
2622
2737
|
title="Scroll to bottom"
|
|
2623
2738
|
>
|
|
@@ -2626,13 +2741,13 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
|
|
|
2626
2741
|
`:k}
|
|
2627
2742
|
</div>
|
|
2628
2743
|
|
|
2629
|
-
${
|
|
2744
|
+
${f?u`
|
|
2630
2745
|
<resizable-divider
|
|
2631
2746
|
.splitRatio=${p}
|
|
2632
|
-
@resize=${
|
|
2747
|
+
@resize=${w=>{var x;return(x=e.onSplitRatioChange)==null?void 0:x.call(e,w.detail.splitRatio)}}
|
|
2633
2748
|
></resizable-divider>
|
|
2634
2749
|
<div class="chat-sidebar">
|
|
2635
|
-
${
|
|
2750
|
+
${Iy({content:e.sidebarContent??null,error:e.sidebarError??null,onClose:e.onCloseSidebar,onViewRawText:()=>{!e.sidebarContent||!e.onOpenSidebar||e.onOpenSidebar(`\`\`\`
|
|
2636
2751
|
${e.sidebarContent}
|
|
2637
2752
|
\`\`\``)}})}
|
|
2638
2753
|
</div>
|
|
@@ -2644,7 +2759,7 @@ ${e.sidebarContent}
|
|
|
2644
2759
|
<button
|
|
2645
2760
|
class="chat-suggestion-chip"
|
|
2646
2761
|
type="button"
|
|
2647
|
-
@click=${()=>{var
|
|
2762
|
+
@click=${()=>{var w;return(w=e.onSuggestionClick)==null?void 0:w.call(e,e.suggestion)}}
|
|
2648
2763
|
>
|
|
2649
2764
|
${e.suggestion}
|
|
2650
2765
|
</button>
|
|
@@ -2652,13 +2767,13 @@ ${e.sidebarContent}
|
|
|
2652
2767
|
`:k}
|
|
2653
2768
|
|
|
2654
2769
|
<div class="chat-compose">
|
|
2655
|
-
${
|
|
2656
|
-
${c?
|
|
2770
|
+
${xb(e)}
|
|
2771
|
+
${c?Ly():u`
|
|
2657
2772
|
<div class="chat-compose__row">
|
|
2658
2773
|
<button
|
|
2659
2774
|
class="chat-compose__emoji"
|
|
2660
2775
|
type="button"
|
|
2661
|
-
@click=${
|
|
2776
|
+
@click=${$b}
|
|
2662
2777
|
aria-label="Emoji"
|
|
2663
2778
|
title="Emoji"
|
|
2664
2779
|
>
|
|
@@ -2667,7 +2782,7 @@ ${e.sidebarContent}
|
|
|
2667
2782
|
<button
|
|
2668
2783
|
class="chat-compose__attach"
|
|
2669
2784
|
type="button"
|
|
2670
|
-
@click=${
|
|
2785
|
+
@click=${w=>{var A;const x=(A=w.currentTarget.closest(".chat-compose__row"))==null?void 0:A.querySelector(".chat-compose__file-input");x==null||x.click()}}
|
|
2671
2786
|
aria-label="Attach file"
|
|
2672
2787
|
title="Attach file"
|
|
2673
2788
|
>
|
|
@@ -2679,16 +2794,16 @@ ${e.sidebarContent}
|
|
|
2679
2794
|
multiple
|
|
2680
2795
|
accept="image/*,video/*,.pdf,.md,.txt,.csv,.json,.xml,.html,.css,.js,.ts,.py,.sh,.yaml,.yml,.toml,.ini,.cfg,.log,.sql"
|
|
2681
2796
|
style="display:none"
|
|
2682
|
-
@change=${
|
|
2797
|
+
@change=${w=>{const x=w.target,A=x.files;if(!(!A||A.length===0||!e.onAttachmentsChange)){for(let C=0;C<A.length;C++)yb(A[C],e);x.value=""}}}
|
|
2683
2798
|
/>
|
|
2684
2799
|
<label class="field chat-compose__field">
|
|
2685
2800
|
<span>Message</span>
|
|
2686
2801
|
<textarea
|
|
2687
2802
|
.value=${e.draft}
|
|
2688
2803
|
?disabled=${!e.connected}
|
|
2689
|
-
@keydown=${
|
|
2690
|
-
@input=${
|
|
2691
|
-
@paste=${
|
|
2804
|
+
@keydown=${w=>{w.key==="Enter"&&(w.isComposing||w.keyCode===229||w.shiftKey||e.connected&&(w.preventDefault(),t&&(e.onSend(),wl(w.target))))}}
|
|
2805
|
+
@input=${w=>{const x=w.target;e.onDraftChange(x.value),hb(x)}}
|
|
2806
|
+
@paste=${w=>kb(w,e)}
|
|
2692
2807
|
placeholder=${d}
|
|
2693
2808
|
></textarea>
|
|
2694
2809
|
</label>
|
|
@@ -2702,11 +2817,11 @@ ${e.sidebarContent}
|
|
|
2702
2817
|
${L.square}
|
|
2703
2818
|
</button>
|
|
2704
2819
|
`:k}
|
|
2705
|
-
${l?
|
|
2820
|
+
${l?Py(e.connected):u`
|
|
2706
2821
|
<button
|
|
2707
2822
|
class="btn btn--icon chat-compose__send primary"
|
|
2708
2823
|
?disabled=${!e.connected}
|
|
2709
|
-
@click=${
|
|
2824
|
+
@click=${w=>{var A;e.onSend();const x=(A=w.target.closest(".chat-compose"))==null?void 0:A.querySelector("textarea");x&&wl(x)}}
|
|
2710
2825
|
aria-label="${n?"Queue":"Send"}"
|
|
2711
2826
|
title="${n?"Queue message":"Send (Enter)"}"
|
|
2712
2827
|
>
|
|
@@ -2715,23 +2830,23 @@ ${e.sidebarContent}
|
|
|
2715
2830
|
</div>`}
|
|
2716
2831
|
<div class="emoji-picker-popup">
|
|
2717
2832
|
<emoji-picker
|
|
2718
|
-
@emoji-click=${
|
|
2833
|
+
@emoji-click=${w=>Sb(w,e)}
|
|
2719
2834
|
></emoji-picker>
|
|
2720
2835
|
</div>
|
|
2721
|
-
${e.publicMode?k:
|
|
2836
|
+
${e.publicMode?k:_b(e)}
|
|
2722
2837
|
</div>
|
|
2723
2838
|
</section>
|
|
2724
|
-
`}const
|
|
2839
|
+
`}const Ab=[{id:"claude-opus-4-6",shortName:"Opus",description:"Most capable"},{id:"claude-sonnet-4-5-20250929",shortName:"Sonnet",description:"Fast & capable"},{id:"claude-haiku-4-5-20251001",shortName:"Haiku",description:"Fastest"}];function Eb(e){const t=new Set(e.filter(n=>n.provider==="anthropic").map(n=>n.id));return Ab.filter(n=>t.has(n.id)).map(n=>({key:`anthropic/${n.id}`,...n}))}const Cb=[{value:"off",label:"Off"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Tb(e){var s;const t=e.currentTarget,n=(s=t.closest(".chat-model-bar"))==null?void 0:s.querySelector(".chat-settings-menu");if(!n)return;const i=n.classList.contains("active");if(document.querySelectorAll(".chat-settings-menu.active").forEach(o=>o.classList.remove("active")),!i){n.classList.add("active");const o=r=>{!n.contains(r.target)&&r.target!==t&&!t.contains(r.target)&&(n.classList.remove("active"),document.removeEventListener("click",o))};requestAnimationFrame(()=>document.addEventListener("click",o))}}function _b(e){if(!e.connected)return k;const t=e.modelCatalog??[],n=Eb(t);if(n.length===0)return k;const i=e.modelProvider&&e.model?`${e.modelProvider}/${e.model}`:null,s=e.thinkingLevel??"off",o=e.verboseLevel==="on"||e.verboseLevel==="full",r=e.fillerEnabled===!0;return u`
|
|
2725
2840
|
<div class="chat-model-bar">
|
|
2726
2841
|
<div class="chat-model-bar__select">
|
|
2727
2842
|
<select
|
|
2728
2843
|
class="chat-model-bar__dropdown"
|
|
2729
2844
|
.value=${i??""}
|
|
2730
|
-
@change=${
|
|
2845
|
+
@change=${a=>{const d=a.target.value;d&&e.onModelChange&&e.onModelChange(d)}}
|
|
2731
2846
|
>
|
|
2732
|
-
${n.map(
|
|
2733
|
-
<option value=${
|
|
2734
|
-
${
|
|
2847
|
+
${n.map(a=>u`
|
|
2848
|
+
<option value=${a.key} ?selected=${a.key===i}>
|
|
2849
|
+
${a.shortName} — ${a.description}
|
|
2735
2850
|
</option>
|
|
2736
2851
|
`)}
|
|
2737
2852
|
</select>
|
|
@@ -2740,11 +2855,11 @@ ${e.sidebarContent}
|
|
|
2740
2855
|
<select
|
|
2741
2856
|
class="chat-model-bar__dropdown"
|
|
2742
2857
|
.value=${s}
|
|
2743
|
-
@change=${
|
|
2858
|
+
@change=${a=>{const d=a.target.value;e.onThinkingLevelChange&&e.onThinkingLevelChange(d)}}
|
|
2744
2859
|
>
|
|
2745
|
-
${
|
|
2746
|
-
<option value=${
|
|
2747
|
-
Thinking: ${
|
|
2860
|
+
${Cb.map(a=>u`
|
|
2861
|
+
<option value=${a.value} ?selected=${a.value===s}>
|
|
2862
|
+
Thinking: ${a.label}
|
|
2748
2863
|
</option>
|
|
2749
2864
|
`)}
|
|
2750
2865
|
</select>
|
|
@@ -2752,7 +2867,7 @@ ${e.sidebarContent}
|
|
|
2752
2867
|
<button
|
|
2753
2868
|
class="chat-model-bar__settings-btn"
|
|
2754
2869
|
type="button"
|
|
2755
|
-
@click=${
|
|
2870
|
+
@click=${Tb}
|
|
2756
2871
|
aria-label="Message settings"
|
|
2757
2872
|
title="Message settings"
|
|
2758
2873
|
>
|
|
@@ -2763,7 +2878,7 @@ ${e.sidebarContent}
|
|
|
2763
2878
|
<input
|
|
2764
2879
|
type="checkbox"
|
|
2765
2880
|
.checked=${o}
|
|
2766
|
-
@change=${
|
|
2881
|
+
@change=${a=>{const d=a.target.checked;e.onVerboseChange&&e.onVerboseChange(d?"on":"off")}}
|
|
2767
2882
|
/>
|
|
2768
2883
|
<span>Verbose</span>
|
|
2769
2884
|
<span class="chat-settings-menu__hint">Detailed responses</span>
|
|
@@ -2771,17 +2886,17 @@ ${e.sidebarContent}
|
|
|
2771
2886
|
<label class="chat-settings-menu__item">
|
|
2772
2887
|
<input
|
|
2773
2888
|
type="checkbox"
|
|
2774
|
-
.checked=${
|
|
2775
|
-
@change=${
|
|
2889
|
+
.checked=${r}
|
|
2890
|
+
@change=${a=>{const d=a.target.checked;e.onFillerChange&&e.onFillerChange(d)}}
|
|
2776
2891
|
/>
|
|
2777
2892
|
<span>Filler</span>
|
|
2778
2893
|
<span class="chat-settings-menu__hint">Quick acks while thinking</span>
|
|
2779
2894
|
</label>
|
|
2780
2895
|
</div>
|
|
2781
2896
|
</div>
|
|
2782
|
-
`}function
|
|
2897
|
+
`}function Mb(e){const t=[];let n=null;for(const i of e){if(i.kind!=="message"){n&&(t.push(n),n=null),t.push(i);continue}const s=ic(i.message),o=sc(s.role),r=s.timestamp||Date.now();!n||n.role!==o?(n&&t.push(n),n={kind:"group",key:`group:${o}:${i.key}`,role:o,messages:[{message:i.message,key:i.key}],timestamp:r,isStreaming:!1}):n.messages.push({message:i.message,key:i.key})}return n&&t.push(n),t}function Pb(e){var o;const t=[],n=Array.isArray(e.messages)?e.messages:[],i=Array.isArray(e.toolMessages)?e.toolMessages:[],s=e.showThinking||e.verboseLevel==="on"||e.verboseLevel==="full";for(let r=0;r<n.length;r++){const a=n[r],d=ic(a);if(!s&&d.role.toLowerCase()==="toolresult"){const c=a,p=(Array.isArray(c.content)?c.content:[]).filter(f=>{const v=f.type;return v==="image"||v==="file"});p.length>0&&t.push({kind:"message",key:Qs(a,r),message:{role:"assistant",content:p,timestamp:d.timestamp}});continue}t.push({kind:"message",key:Qs(a,r),message:a})}if(s)for(let r=0;r<i.length;r++)t.push({kind:"message",key:Qs(i[r],r+n.length),message:i[r]});if(e.interimText&&t.push({kind:"interim",key:"interim:thinking",text:e.interimText}),e.stream!==null){const r=`stream:${e.sessionKey}:${e.streamStartedAt??"live"}`;e.stream.trim().length>0?t.push({kind:"stream",key:r,text:e.stream,startedAt:e.streamStartedAt??Date.now()}):t.push({kind:"reading-indicator",key:r})}for(const r of e.queue){const a=((o=r.attachments)==null?void 0:o.filter(c=>c.fileName).map(c=>c.fileName))??[],d=a.length>0?r.text?`${a.join(", ")}
|
|
2783
2898
|
|
|
2784
|
-
${
|
|
2899
|
+
${r.text}`:a.join(", "):r.text;t.push({kind:"message",key:`queue:${r.id}`,message:{role:"user",content:[{type:"text",text:d}],timestamp:r.createdAt}})}return Mb(t)}function Qs(e,t){const n=e,i=typeof n.toolCallId=="string"?n.toolCallId:"";if(i)return`tool:${i}`;const s=typeof n.id=="string"?n.id:"";if(s)return`msg:${s}`;const o=typeof n.messageId=="string"?n.messageId:"";if(o)return`msg:${o}`;const r=typeof n.timestamp=="number"?n.timestamp:null,a=typeof n.role=="string"?n.role:"unknown";return r!=null?`msg:${a}:${r}:${t}`:`msg:${a}:${t}`}const Lb=u`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>`;function Ib(e){if(!e.connected)return u`
|
|
2785
2900
|
<div class="setup-container">
|
|
2786
2901
|
<div class="setup-card">
|
|
2787
2902
|
<div class="setup-spinner"></div>
|
|
@@ -2794,21 +2909,21 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2794
2909
|
target="_blank"
|
|
2795
2910
|
rel="noopener"
|
|
2796
2911
|
title="Open public chat in new tab"
|
|
2797
|
-
>Public ${
|
|
2912
|
+
>Public ${Lb}</a>`:k;return u`
|
|
2798
2913
|
<div class="setup-container setup-container--full chat-page">
|
|
2799
2914
|
${Mt("Chat",e.wsProps)}
|
|
2800
2915
|
${t}
|
|
2801
2916
|
<div class="chat-viewport">
|
|
2802
|
-
${
|
|
2917
|
+
${hu(e)}
|
|
2803
2918
|
</div>
|
|
2804
2919
|
</div>
|
|
2805
|
-
`}function
|
|
2806
|
-
${
|
|
2807
|
-
${
|
|
2808
|
-
${n?
|
|
2809
|
-
${t?
|
|
2810
|
-
${e.runModalJobId?
|
|
2811
|
-
`}function
|
|
2920
|
+
`}function Rb(e){return e?`${Zl(e)} (${Gi(e)})`:"n/a"}function fu(e){const t=e.state??{},n=t.lastStatus??"n/a",i=t.lastRunAtMs?Gi(t.lastRunAtMs):"never";return`${n} · last ${i}`}function gu(e){const t=e.schedule;return t.kind==="at"?`One-time: ${Zl(t.atMs)}`:t.kind==="every"?`Every ${No(t.everyMs)}`:Db(t.expr,t.tz)}function Db(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[i,s,o,r,a]=n,d=t?` (${t.replace(/^.*\//,"").replace(/_/g," ")})`:"",c=(h,b)=>new Date(2e3,0,1,h,b).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),l=/^\d{1,2}$/.test(i)?parseInt(i,10):null,p=kl(s);if(l===null||!p)return`${e}${t?` (${t})`:""}`;const f=p.map(h=>c(h,l)),v=f.length<=3?f.join(" & "):`${f.slice(0,-1).join(", ")} & ${f[f.length-1]}`,S=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(o==="*"&&r==="*"){if(a==="*")return`Daily at ${v}${d}`;if(a==="1-5")return`Weekdays at ${v}${d}`;if(a==="0,6"||a==="6,0")return`Weekends at ${v}${d}`;const h=kl(a);if(h)return`${h.map(w=>S[w%7]??String(w)).join(", ")} at ${v}${d}`}return`${e}${t?` (${t})`:""}`}function kl(e){if(e==="*")return null;if(/^\d+(,\d+)*$/.test(e))return e.split(",").map(Number);if(/^\d+-\d+$/.test(e)){const[t,n]=e.split("-").map(Number);if(t>n)return null;const i=[];for(let s=t;s<=n;s++)i.push(s);return i}return null}function Nb(e,t=!0){const n=e.payload;return n.kind==="systemEvent"?`Task: ${t&&n.text.length>60?`${n.text.slice(0,57)}…`:n.text}`:`Message: ${t&&n.message.length>60?`${n.message.slice(0,57)}…`:n.message}`}function $l(e){const t=e.payload;if(t.kind!=="agentTurn")return null;const n=t.channel??t.provider,i=t.to;if(!i&&!n)return null;const s=[];if(i){const r=i.split(",").map(a=>a.trim()).filter(Boolean).map(a=>a.toLowerCase()==="admins"?"All admins":a);s.push(r.join(", "))}return n&&n!=="last"&&s.push(`via ${n}`),s.join(" ")||null}let ve=null;function Bb(e){var s;const t=["last",...e.channels.filter(Boolean)],n=(s=e.form.channel)==null?void 0:s.trim();n&&!t.includes(n)&&t.push(n);const i=new Set;return t.filter(o=>i.has(o)?!1:(i.add(o),!0))}function Fb(e,t){var i,s;if(t==="last")return"last";const n=(i=e.channelMeta)==null?void 0:i.find(o=>o.id===t);return n!=null&&n.label?n.label:((s=e.channelLabels)==null?void 0:s[t])??t}function Ob(e){return e.split(",").map(n=>n.trim()).filter(Boolean).map(n=>n.toLowerCase()==="admins"?"All admins":n).join(", ")}function Ub(e){return e||"Default"}const Wb=u`<svg viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg>`,Kb=u`<svg viewBox="0 0 24 24"><rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/></svg>`,zb=u`<svg viewBox="0 0 24 24"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>`,ns=u`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,Hb=u`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,mu=u`<svg viewBox="0 0 24 24"><path d="M12 5v14"/><path d="M5 12h14"/></svg>`,qb=u`<svg viewBox="0 0 24 24"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`;function Sl(e){const t=e.detailJobId?e.jobs.find(i=>i.id===e.detailJobId)??null:null,n=e.newEventModalOpen||!!e.editJobId;return u`
|
|
2921
|
+
${jb(e)}
|
|
2922
|
+
${Vb(e)}
|
|
2923
|
+
${n?Qb(e):k}
|
|
2924
|
+
${t?Xb(t,e):k}
|
|
2925
|
+
${e.runModalJobId?Zb(e):k}
|
|
2926
|
+
`}function jb(e){const t=e.status,n=(t==null?void 0:t.enabled)??!1,i=(t==null?void 0:t.jobs)??0,s=t==null?void 0:t.nextWakeAtMs;return u`
|
|
2812
2927
|
<div class="event-status-bar">
|
|
2813
2928
|
<div class="event-status-bar__info">
|
|
2814
2929
|
<span class="statusDot ${n?"ok":""}"></span>
|
|
@@ -2830,14 +2945,14 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2830
2945
|
${e.error?u`<span class="muted">${e.error}</span>`:k}
|
|
2831
2946
|
</div>
|
|
2832
2947
|
<button class="btn primary btn--sm" @click=${e.onNewEventModalOpen}>
|
|
2833
|
-
${
|
|
2948
|
+
${mu} New Event
|
|
2834
2949
|
</button>
|
|
2835
2950
|
</div>
|
|
2836
|
-
`}function
|
|
2951
|
+
`}function Vb(e){return e.jobs.length===0?u`<div class="muted" style="padding: 20px 0;">No events yet. Create one to get started.</div>`:u`
|
|
2837
2952
|
<div class="event-grid">
|
|
2838
|
-
${e.jobs.map(t=>
|
|
2953
|
+
${e.jobs.map(t=>Gb(t,e))}
|
|
2839
2954
|
</div>
|
|
2840
|
-
`}function
|
|
2955
|
+
`}function Gb(e,t){return u`
|
|
2841
2956
|
<div
|
|
2842
2957
|
class="event-card ${e.enabled?"":"disabled"}"
|
|
2843
2958
|
@click=${()=>t.onDetailOpen(e)}
|
|
@@ -2848,12 +2963,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2848
2963
|
${e.enabled?"On":"Off"}
|
|
2849
2964
|
</span>
|
|
2850
2965
|
</div>
|
|
2851
|
-
<div class="event-card__schedule">${
|
|
2852
|
-
${e.agentId?u`<div class="event-card__agent">${
|
|
2966
|
+
<div class="event-card__schedule">${gu(e)}</div>
|
|
2967
|
+
${e.agentId?u`<div class="event-card__agent">${Ub(e.agentId)}</div>`:k}
|
|
2853
2968
|
${$l(e)?u`<div class="event-card__agent muted" style="font-size: 11px;">\u2192 ${$l(e)}</div>`:k}
|
|
2854
2969
|
<div class="event-card__footer">
|
|
2855
2970
|
<div class="event-card__status">
|
|
2856
|
-
<span class="muted" style="font-size: 11px;">${
|
|
2971
|
+
<span class="muted" style="font-size: 11px;">${fu(e)}</span>
|
|
2857
2972
|
</div>
|
|
2858
2973
|
<div class="event-card__actions" @click=${n=>n.stopPropagation()}>
|
|
2859
2974
|
<button
|
|
@@ -2862,7 +2977,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2862
2977
|
?disabled=${t.busy}
|
|
2863
2978
|
@click=${()=>t.onToggle(e,!e.enabled)}
|
|
2864
2979
|
>
|
|
2865
|
-
${e.enabled?
|
|
2980
|
+
${e.enabled?Kb:Wb}
|
|
2866
2981
|
</button>
|
|
2867
2982
|
<button
|
|
2868
2983
|
class="btn-icon"
|
|
@@ -2870,7 +2985,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2870
2985
|
?disabled=${t.busy}
|
|
2871
2986
|
@click=${()=>t.onRun(e)}
|
|
2872
2987
|
>
|
|
2873
|
-
${
|
|
2988
|
+
${Hb}
|
|
2874
2989
|
</button>
|
|
2875
2990
|
${t.pendingDeleteId===e.id?u`<button
|
|
2876
2991
|
class="btn danger btn--sm"
|
|
@@ -2881,11 +2996,11 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2881
2996
|
title="Delete"
|
|
2882
2997
|
?disabled=${t.busy}
|
|
2883
2998
|
@click=${()=>{t.onArmDelete(e.id),ve&&clearTimeout(ve),ve=setTimeout(()=>{t.onArmDelete(""),ve=null},3e3)}}
|
|
2884
|
-
>${
|
|
2999
|
+
>${zb}</button>`}
|
|
2885
3000
|
</div>
|
|
2886
3001
|
</div>
|
|
2887
3002
|
</div>
|
|
2888
|
-
`}function
|
|
3003
|
+
`}function Qb(e){const t=!!e.editJobId,n=Bb(e),i=()=>{e.onNewEventModalClose()};return u`
|
|
2889
3004
|
<div class="event-modal-overlay" @click=${i}>
|
|
2890
3005
|
<div class="event-modal" @click=${s=>s.stopPropagation()}>
|
|
2891
3006
|
<div class="event-modal__header">
|
|
@@ -2943,7 +3058,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
2943
3058
|
</label>
|
|
2944
3059
|
</div>
|
|
2945
3060
|
|
|
2946
|
-
${
|
|
3061
|
+
${Yb(e)}
|
|
2947
3062
|
|
|
2948
3063
|
<div class="form-grid" style="margin-top: 12px;">
|
|
2949
3064
|
<label class="field">
|
|
@@ -3005,7 +3120,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3005
3120
|
@change=${s=>e.onFormChange({channel:s.target.value})}
|
|
3006
3121
|
>
|
|
3007
3122
|
${n.map(s=>u`<option value=${s}>
|
|
3008
|
-
${
|
|
3123
|
+
${Fb(e,s)}
|
|
3009
3124
|
</option>`)}
|
|
3010
3125
|
</select>
|
|
3011
3126
|
</label>
|
|
@@ -3018,7 +3133,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3018
3133
|
/>
|
|
3019
3134
|
</label>
|
|
3020
3135
|
</div>
|
|
3021
|
-
${
|
|
3136
|
+
${Jb(e)}
|
|
3022
3137
|
<div class="form-grid" style="margin-top: 12px;">
|
|
3023
3138
|
<label class="field">
|
|
3024
3139
|
<span>Timeout (seconds)</span>
|
|
@@ -3049,7 +3164,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3049
3164
|
</div>
|
|
3050
3165
|
</div>
|
|
3051
3166
|
</div>
|
|
3052
|
-
`}function
|
|
3167
|
+
`}function Jb(e){const t=e.form.recipients;return u`
|
|
3053
3168
|
<div style="margin-top: 8px;">
|
|
3054
3169
|
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
|
|
3055
3170
|
<span style="font-size: 13px; color: var(--muted);">Recipients</span>
|
|
@@ -3057,7 +3172,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3057
3172
|
class="btn btn--sm"
|
|
3058
3173
|
@click=${()=>{e.onFormChange({recipients:[...t,""]})}}
|
|
3059
3174
|
>
|
|
3060
|
-
${
|
|
3175
|
+
${mu} Add
|
|
3061
3176
|
</button>
|
|
3062
3177
|
</div>
|
|
3063
3178
|
${t.length===0&&!e.form.toAdmins?u`<div class="muted" style="font-size: 12px; padding: 4px 0;">No recipients. Add a phone number or enable "All admins".</div>`:k}
|
|
@@ -3072,14 +3187,14 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3072
3187
|
<button
|
|
3073
3188
|
class="btn-icon danger"
|
|
3074
3189
|
title="Remove"
|
|
3075
|
-
@click=${()=>{const s=t.filter((o,
|
|
3190
|
+
@click=${()=>{const s=t.filter((o,r)=>r!==i);e.onFormChange({recipients:s})}}
|
|
3076
3191
|
>
|
|
3077
3192
|
${ns}
|
|
3078
3193
|
</button>
|
|
3079
3194
|
</div>
|
|
3080
3195
|
`)}
|
|
3081
3196
|
</div>
|
|
3082
|
-
`}function
|
|
3197
|
+
`}function Yb(e){const t=e.form;return t.scheduleKind==="at"?u`
|
|
3083
3198
|
<label class="field" style="margin-top: 12px;">
|
|
3084
3199
|
<span>Run at</span>
|
|
3085
3200
|
<input
|
|
@@ -3128,7 +3243,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3128
3243
|
/>
|
|
3129
3244
|
</label>
|
|
3130
3245
|
</div>
|
|
3131
|
-
`}function
|
|
3246
|
+
`}function Xb(e,t){var n;return u`
|
|
3132
3247
|
<div class="event-modal-overlay" @click=${t.onDetailClose}>
|
|
3133
3248
|
<div class="event-modal" @click=${i=>i.stopPropagation()}>
|
|
3134
3249
|
<div class="event-modal__header">
|
|
@@ -3146,7 +3261,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3146
3261
|
?disabled=${t.busy}
|
|
3147
3262
|
@click=${()=>t.onEdit(e)}
|
|
3148
3263
|
>
|
|
3149
|
-
${
|
|
3264
|
+
${qb} Edit
|
|
3150
3265
|
</button>
|
|
3151
3266
|
<button
|
|
3152
3267
|
class="btn"
|
|
@@ -3182,7 +3297,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3182
3297
|
</div>
|
|
3183
3298
|
<div class="event-detail-row">
|
|
3184
3299
|
<span class="event-detail-label">Schedule</span>
|
|
3185
|
-
<span class="event-detail-value">${
|
|
3300
|
+
<span class="event-detail-value">${gu(e)}</span>
|
|
3186
3301
|
</div>
|
|
3187
3302
|
${e.agentId?u`
|
|
3188
3303
|
<div class="event-detail-row">
|
|
@@ -3204,12 +3319,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3204
3319
|
</div>
|
|
3205
3320
|
<div class="event-detail-row" style="flex-direction: column; align-items: stretch; gap: 4px;">
|
|
3206
3321
|
<span class="event-detail-label">Action</span>
|
|
3207
|
-
<span class="event-detail-value" style="text-align: left; white-space: pre-wrap; font-size: 12px; color: var(--muted); line-height: 1.5;">${
|
|
3322
|
+
<span class="event-detail-value" style="text-align: left; white-space: pre-wrap; font-size: 12px; color: var(--muted); line-height: 1.5;">${Nb(e,!1)}</span>
|
|
3208
3323
|
</div>
|
|
3209
3324
|
${e.payload.kind==="agentTurn"&&e.payload.to?u`
|
|
3210
3325
|
<div class="event-detail-row">
|
|
3211
3326
|
<span class="event-detail-label">Send to</span>
|
|
3212
|
-
<span class="event-detail-value mono">${
|
|
3327
|
+
<span class="event-detail-value mono">${Ob(e.payload.to)}</span>
|
|
3213
3328
|
</div>
|
|
3214
3329
|
`:k}
|
|
3215
3330
|
${e.payload.kind==="agentTurn"&&(e.payload.channel??e.payload.provider)?u`
|
|
@@ -3229,12 +3344,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3229
3344
|
<div class="event-detail-section">
|
|
3230
3345
|
<div class="event-detail-row">
|
|
3231
3346
|
<span class="event-detail-label">Last run</span>
|
|
3232
|
-
<span class="event-detail-value">${
|
|
3347
|
+
<span class="event-detail-value">${fu(e)}</span>
|
|
3233
3348
|
</div>
|
|
3234
3349
|
${(n=e.state)!=null&&n.nextRunAtMs?u`
|
|
3235
3350
|
<div class="event-detail-row">
|
|
3236
3351
|
<span class="event-detail-label">Next run</span>
|
|
3237
|
-
<span class="event-detail-value">${
|
|
3352
|
+
<span class="event-detail-value">${Rb(e.state.nextRunAtMs)}</span>
|
|
3238
3353
|
</div>
|
|
3239
3354
|
`:k}
|
|
3240
3355
|
</div>
|
|
@@ -3245,14 +3360,14 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3245
3360
|
</div>
|
|
3246
3361
|
${t.runs.length===0?u`<div class="muted" style="font-size: 13px;">No runs recorded yet.</div>`:u`
|
|
3247
3362
|
<div class="list">
|
|
3248
|
-
${[...t.runs].sort((i,s)=>s.ts-i.ts).map(i=>
|
|
3363
|
+
${[...t.runs].sort((i,s)=>s.ts-i.ts).map(i=>tw(i))}
|
|
3249
3364
|
</div>
|
|
3250
3365
|
`}
|
|
3251
3366
|
</div>
|
|
3252
3367
|
|
|
3253
3368
|
</div>
|
|
3254
3369
|
</div>
|
|
3255
|
-
`}function
|
|
3370
|
+
`}function Zb(e){const t=e.runResult,n=!t,i=(t==null?void 0:t.status)==="ok"?"Completed":(t==null?void 0:t.status)==="error"?"Error":(t==null?void 0:t.status)??"";return u`
|
|
3256
3371
|
<div class="event-modal-overlay" @click=${e.onRunModalClose}>
|
|
3257
3372
|
<div class="event-modal" style="max-width: 480px;" @click=${s=>s.stopPropagation()}>
|
|
3258
3373
|
<div class="event-modal__header">
|
|
@@ -3278,7 +3393,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3278
3393
|
>
|
|
3279
3394
|
${i}
|
|
3280
3395
|
</span>
|
|
3281
|
-
${t.durationMs!=null?u`<span class="muted" style="font-size: 13px;">${
|
|
3396
|
+
${t.durationMs!=null?u`<span class="muted" style="font-size: 13px;">${No(t.durationMs)}</span>`:k}
|
|
3282
3397
|
</div>
|
|
3283
3398
|
${t.summary?u`
|
|
3284
3399
|
<div style="white-space: pre-wrap; font-size: 13px; line-height: 1.6; max-height: 400px; overflow-y: auto; color: var(--fg);">
|
|
@@ -3299,14 +3414,14 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3299
3414
|
`}
|
|
3300
3415
|
</div>
|
|
3301
3416
|
</div>
|
|
3302
|
-
`}function
|
|
3417
|
+
`}function ew(e){const t=e.toLowerCase();return t==="ok"||t==="success"?"chip chip-ok":t==="error"||t==="fail"||t==="failed"?"chip chip-warn":"chip"}function tw(e){return u`
|
|
3303
3418
|
<div class="list-item" style="grid-template-columns: 1fr; gap: 6px;">
|
|
3304
3419
|
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
|
3305
|
-
<span class=${
|
|
3420
|
+
<span class=${ew(e.status)} style="font-size: 11px; padding: 2px 8px;">
|
|
3306
3421
|
${e.status}
|
|
3307
3422
|
</span>
|
|
3308
3423
|
<span class="muted" style="font-size: 12px;">${Gi(e.ts)}</span>
|
|
3309
|
-
<span class="muted" style="font-size: 12px;">${
|
|
3424
|
+
<span class="muted" style="font-size: 12px;">${No(e.durationMs)}</span>
|
|
3310
3425
|
</div>
|
|
3311
3426
|
${e.summary?u`<div class="muted" style="font-size: 12px;">${e.summary}</div>`:k}
|
|
3312
3427
|
${e.error?u`
|
|
@@ -3316,12 +3431,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3316
3431
|
</details>
|
|
3317
3432
|
`:k}
|
|
3318
3433
|
</div>
|
|
3319
|
-
`}function
|
|
3434
|
+
`}function nw(e){var r;const t=((r=e.report)==null?void 0:r.skills)??[],n=e.filter.trim().toLowerCase(),i=e.typeFilter,s=t.filter(a=>i==="preloaded"&&!a.preloaded||i==="user"&&a.preloaded?!1:n?[a.name,a.description].join(" ").toLowerCase().includes(n):!0),o=(a,d)=>u`
|
|
3320
3435
|
<button
|
|
3321
3436
|
class="chip ${i===d?"chip-ok":""}"
|
|
3322
3437
|
style="cursor: pointer; border: none; background: ${i===d?"var(--accent, #3b82f6)":"var(--bg-hover, rgba(255,255,255,0.06))"}; color: ${i===d?"#fff":"var(--text)"}; padding: 4px 10px; border-radius: 4px; font-size: 12px;"
|
|
3323
3438
|
@click=${()=>e.onTypeFilterChange(d)}
|
|
3324
|
-
>${
|
|
3439
|
+
>${a}</button>
|
|
3325
3440
|
`;return u`
|
|
3326
3441
|
<section class="card">
|
|
3327
3442
|
<div class="row" style="justify-content: space-between;">
|
|
@@ -3342,7 +3457,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3342
3457
|
<span>Filter</span>
|
|
3343
3458
|
<input
|
|
3344
3459
|
.value=${e.filter}
|
|
3345
|
-
@input=${
|
|
3460
|
+
@input=${a=>e.onFilterChange(a.target.value)}
|
|
3346
3461
|
placeholder="Search skills"
|
|
3347
3462
|
/>
|
|
3348
3463
|
</label>
|
|
@@ -3358,34 +3473,34 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3358
3473
|
|
|
3359
3474
|
${s.length===0?u`<div class="muted" style="margin-top: 16px;">No skills found.</div>`:u`
|
|
3360
3475
|
<div class="list" style="margin-top: 16px;">
|
|
3361
|
-
${s.map(
|
|
3476
|
+
${s.map(a=>iw(a,e))}
|
|
3362
3477
|
</div>
|
|
3363
3478
|
`}
|
|
3364
3479
|
</section>
|
|
3365
3480
|
|
|
3366
|
-
${e.detail?
|
|
3367
|
-
${e.addModal?
|
|
3368
|
-
`}function
|
|
3481
|
+
${e.detail?sw(e):k}
|
|
3482
|
+
${e.addModal?ow(e):k}
|
|
3483
|
+
`}function iw(e,t){const n=t.busyKey===e.skillKey,i=t.edits[e.skillKey]??"",s=t.messages[e.skillKey]??null,o=e.install.length>0&&e.missing.bins.length>0,r=[...e.missing.bins.map(d=>`bin:${d}`),...e.missing.env.map(d=>`env:${d}`),...e.missing.config.map(d=>`config:${d}`),...e.missing.os.map(d=>`os:${d}`)],a=[];return e.disabled&&a.push("disabled"),e.blockedByAllowlist&&a.push("blocked by allowlist"),u`
|
|
3369
3484
|
<div class="list-item" style="cursor: pointer;" @click=${()=>t.onViewDetail(e.name)}>
|
|
3370
3485
|
<div class="list-main">
|
|
3371
3486
|
<div class="list-title">
|
|
3372
3487
|
${e.emoji?`${e.emoji} `:""}${e.name}
|
|
3373
3488
|
</div>
|
|
3374
|
-
<div class="list-sub">${
|
|
3489
|
+
<div class="list-sub">${Rp(e.description,140)}</div>
|
|
3375
3490
|
<div class="chip-row" style="margin-top: 6px;">
|
|
3376
3491
|
<span class="chip ${e.preloaded?"chip-ok":""}">
|
|
3377
3492
|
${e.preloaded?"Preloaded":"User"}
|
|
3378
3493
|
</span>
|
|
3379
3494
|
${e.disabled?u`<span class="chip chip-warn">Disabled</span>`:k}
|
|
3380
3495
|
</div>
|
|
3381
|
-
${
|
|
3496
|
+
${r.length>0?u`
|
|
3382
3497
|
<div class="muted" style="margin-top: 6px;">
|
|
3383
|
-
Missing: ${
|
|
3498
|
+
Missing: ${r.join(", ")}
|
|
3384
3499
|
</div>
|
|
3385
3500
|
`:k}
|
|
3386
|
-
${
|
|
3501
|
+
${a.length>0?u`
|
|
3387
3502
|
<div class="muted" style="margin-top: 6px;">
|
|
3388
|
-
Reason: ${
|
|
3503
|
+
Reason: ${a.join(", ")}
|
|
3389
3504
|
</div>
|
|
3390
3505
|
`:k}
|
|
3391
3506
|
</div>
|
|
@@ -3446,13 +3561,13 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3446
3561
|
`:k}
|
|
3447
3562
|
</div>
|
|
3448
3563
|
</div>
|
|
3449
|
-
`}function
|
|
3564
|
+
`}function sw(e){var d,c,l;const t=e.detail,n=["SKILL.md",...t.references.map(p=>p.name)],i=e.detailTab||"SKILL.md",s=i==="SKILL.md"?t.content:((d=t.references.find(p=>p.name===i))==null?void 0:d.content)??"",o=p=>{p.target.classList.contains("event-modal-overlay")&&e.onDetailClose()},r=(l=(c=e.report)==null?void 0:c.skills)==null?void 0:l.find(p=>p.name===t.name),a=r?!r.preloaded:!1;return u`
|
|
3450
3565
|
<div class="event-modal-overlay" @click=${o}>
|
|
3451
3566
|
<div class="event-modal" style="width: min(720px, 100%);" @click=${p=>p.stopPropagation()}>
|
|
3452
3567
|
<div class="event-modal__header">
|
|
3453
3568
|
<div class="event-modal__title">${t.name}</div>
|
|
3454
3569
|
<div class="row" style="gap: 8px;">
|
|
3455
|
-
${
|
|
3570
|
+
${a?u`<button class="btn" @click=${()=>e.onEditDetail(i)}>Edit</button>`:k}
|
|
3456
3571
|
<button class="event-modal__close" @click=${e.onDetailClose}>×</button>
|
|
3457
3572
|
</div>
|
|
3458
3573
|
</div>
|
|
@@ -3472,25 +3587,25 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3472
3587
|
<pre style="white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.5; max-height: 60vh; overflow-y: auto; background: var(--bg, #111); padding: 16px; border-radius: 8px; border: 1px solid var(--border);">${s}</pre>
|
|
3473
3588
|
</div>
|
|
3474
3589
|
</div>
|
|
3475
|
-
`}function
|
|
3590
|
+
`}function ow(e){const t=e.drafts.length>0,n=e.busyKey==="__add__",i=e.addForm.name.trim()!=="",s=e.formSource==="installed",o=a=>{a.target.classList.contains("event-modal-overlay")&&e.onAddClose()},r=i?s?`Edit Skill: ${e.addForm.name}`:`Edit Draft: ${e.addForm.name}`:"Skill Drafts";return u`
|
|
3476
3591
|
<div class="event-modal-overlay" @click=${o}>
|
|
3477
|
-
<div class="event-modal" style="width: min(620px, 100%);" @click=${
|
|
3592
|
+
<div class="event-modal" style="width: min(620px, 100%);" @click=${a=>a.stopPropagation()}>
|
|
3478
3593
|
<div class="event-modal__header">
|
|
3479
|
-
<div class="event-modal__title">${
|
|
3594
|
+
<div class="event-modal__title">${r}</div>
|
|
3480
3595
|
<button class="event-modal__close" @click=${e.onAddClose}>×</button>
|
|
3481
3596
|
</div>
|
|
3482
3597
|
|
|
3483
|
-
${i?
|
|
3598
|
+
${i?rw(e,n):t?aw(e,n):u`
|
|
3484
3599
|
<div class="muted" style="text-align: center; padding: 32px 16px;">
|
|
3485
3600
|
No drafts available. Ask your assistant to create a skill and it will appear here.
|
|
3486
3601
|
</div>
|
|
3487
3602
|
`}
|
|
3488
3603
|
</div>
|
|
3489
3604
|
</div>
|
|
3490
|
-
`}function
|
|
3605
|
+
`}function rw(e,t){const n=e.addForm,s=e.formSource==="installed"?"Save Skill":"Save Draft",o=n.references.length>0,r=e.editTab||"SKILL.md",a=n.references.find(c=>c.name===r),d=c=>u`
|
|
3491
3606
|
<button
|
|
3492
|
-
class="chip ${c===
|
|
3493
|
-
style="cursor: pointer; border: none; background: ${c===
|
|
3607
|
+
class="chip ${c===r?"chip-ok":""}"
|
|
3608
|
+
style="cursor: pointer; border: none; background: ${c===r?"var(--accent, #3b82f6)":"var(--bg-hover, rgba(255,255,255,0.06))"}; color: ${c===r?"#fff":"var(--text)"}; padding: 4px 10px; border-radius: 4px; font-size: 12px;"
|
|
3494
3609
|
@click=${()=>e.onEditTab(c)}
|
|
3495
3610
|
>${c}</button>
|
|
3496
3611
|
`;return u`
|
|
@@ -3508,12 +3623,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3508
3623
|
${n.references.map(c=>d(c.name))}
|
|
3509
3624
|
</div>
|
|
3510
3625
|
`:k}
|
|
3511
|
-
${
|
|
3626
|
+
${a?u`
|
|
3512
3627
|
<label class="field" style="margin-bottom: 12px;">
|
|
3513
|
-
<span>${
|
|
3628
|
+
<span>${a.name}</span>
|
|
3514
3629
|
<textarea
|
|
3515
|
-
.value=${
|
|
3516
|
-
@input=${c=>e.onRefUpdate(
|
|
3630
|
+
.value=${a.content}
|
|
3631
|
+
@input=${c=>e.onRefUpdate(a.name,c.target.value)}
|
|
3517
3632
|
style="min-height: 260px; font-family: monospace; font-size: 12px; line-height: 1.5; resize: vertical; overflow-wrap: break-word; white-space: pre-wrap;"
|
|
3518
3633
|
></textarea>
|
|
3519
3634
|
</label>
|
|
@@ -3538,7 +3653,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3538
3653
|
${t?"Saving…":s}
|
|
3539
3654
|
</button>
|
|
3540
3655
|
</div>
|
|
3541
|
-
`}function
|
|
3656
|
+
`}function aw(e,t){return u`
|
|
3542
3657
|
<div class="card-sub" style="margin-bottom: 16px;">
|
|
3543
3658
|
Skills prepared by your assistant. Review, install, or delete.
|
|
3544
3659
|
</div>
|
|
@@ -3579,7 +3694,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3579
3694
|
</div>
|
|
3580
3695
|
`)}
|
|
3581
3696
|
</div>
|
|
3582
|
-
`}const
|
|
3697
|
+
`}const lw=["user","assistant","tool_call","tool_result","thinking","error"],xl={user:"User",assistant:"Assistant",tool:"Tool",tool_call:"Call",tool_result:"Result",thinking:"Thinking",error:"Error",system:"System"};function yu(e){return e==="tool"?"tool_call":e}function cw(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function dw(e){return e.split(":").slice(2).join(":")||e}function uw(e,t){return t?[e.content,e.agentId,e.sessionKey,e.sessionId,e.toolName,e.toolCallId].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function pw(e,t){return`${e.sessionId}:${e.timestamp}:${t}`}const Al=300;function hw(e,t){const n=yu(e);return t[n]??!0}function fw(e){const t=e.filterText.trim().toLowerCase(),n=e.entries.filter(i=>!hw(i.type,e.typeFilters)||e.agents.length>0&&!(e.agentFilters[i.agentId]??!0)?!1:uw(i,t));return u`
|
|
3583
3698
|
<div>
|
|
3584
3699
|
<button class="chips-toggle" style="margin-top: 10px;" @click=${e.onToggleChips}>
|
|
3585
3700
|
<span class="chips-toggle-icon ${e.chipsExpanded?"expanded":""}">${L.chevronDown}</span>
|
|
@@ -3587,7 +3702,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3587
3702
|
</button>
|
|
3588
3703
|
${e.chipsExpanded?u`
|
|
3589
3704
|
<div class="chip-row" style="margin-top: 6px;">
|
|
3590
|
-
${
|
|
3705
|
+
${lw.map(i=>u`
|
|
3591
3706
|
<label class="chip session-log-chip ${i}">
|
|
3592
3707
|
<input
|
|
3593
3708
|
type="checkbox"
|
|
@@ -3621,13 +3736,13 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3621
3736
|
${e.error?u`<div class="callout danger" style="margin-top: 10px;">${e.error}</div>`:k}
|
|
3622
3737
|
|
|
3623
3738
|
<div class="log-stream" style="margin-top: 10px;" @scroll=${e.onScroll}>
|
|
3624
|
-
${n.length===0?u`<div class="muted" style="padding: 12px;">No session log entries.</div>`:n.map((i,s)=>{const o=
|
|
3739
|
+
${n.length===0?u`<div class="muted" style="padding: 12px;">No session log entries.</div>`:n.map((i,s)=>{const o=yu(i.type),r=pw(i,s),a=e.expandedIds.has(r),d=i.content.length>Al,c=a||!d?i.content:i.content.slice(0,Al)+"…";return u`
|
|
3625
3740
|
<div class="log-row session-entry ${o}">
|
|
3626
3741
|
<div class="log-row-header">
|
|
3627
|
-
<span class="log-time mono">${
|
|
3742
|
+
<span class="log-time mono">${cw(i.timestamp)}</span>
|
|
3628
3743
|
<span class="session-log-type ${o}">${xl[o]}</span>
|
|
3629
3744
|
<span class="log-subsystem mono">${i.agentId}</span>
|
|
3630
|
-
<span class="session-label mono">${
|
|
3745
|
+
<span class="session-label mono">${dw(i.sessionKey)}</span>
|
|
3631
3746
|
${i.toolName?u`<span class="session-tool mono">${i.toolName}</span>`:k}
|
|
3632
3747
|
${i.toolCallId?u`<span class="session-call-id mono">${i.toolCallId.slice(0,12)}</span>`:k}
|
|
3633
3748
|
${i.model?u`<span class="session-model mono">${i.model}</span>`:k}
|
|
@@ -3635,13 +3750,13 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3635
3750
|
<div class="log-message mono">${c}</div>
|
|
3636
3751
|
${d?u`<button
|
|
3637
3752
|
class="log-expand-btn"
|
|
3638
|
-
@click=${()=>e.onToggleExpand(
|
|
3639
|
-
>${
|
|
3753
|
+
@click=${()=>e.onToggleExpand(r)}
|
|
3754
|
+
>${a?"Collapse":"Expand"}</button>`:k}
|
|
3640
3755
|
</div>
|
|
3641
3756
|
`})}
|
|
3642
3757
|
</div>
|
|
3643
3758
|
</div>
|
|
3644
|
-
`}const
|
|
3759
|
+
`}const Eo=["trace","debug","info","warn","error","fatal"];function gw(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString()}function vu(e,t){return t?[e.message,e.subsystem,e.raw].filter(Boolean).join(" ").toLowerCase().includes(t):!0}function mw(e){const t=e.logsSubTab==="session";return u`
|
|
3645
3760
|
<section class="card">
|
|
3646
3761
|
<div class="logs-toolbar">
|
|
3647
3762
|
<div class="sp-tabs" style="margin: 0;">
|
|
@@ -3679,7 +3794,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3679
3794
|
<button
|
|
3680
3795
|
class="btn btn-sm"
|
|
3681
3796
|
?disabled=${e.sessionLogsProps.entries.length===0}
|
|
3682
|
-
@click=${()=>{const n=e.sessionLogsProps,i=n.filterText.trim().toLowerCase(),o=n.entries.filter(
|
|
3797
|
+
@click=${()=>{const n=e.sessionLogsProps,i=n.filterText.trim().toLowerCase(),o=n.entries.filter(r=>{const a=r.type==="tool"?"tool_call":r.type;return!n.typeFilters[a]||n.agents.length>0&&!(n.agentFilters[r.agentId]??!0)?!1:i?[r.content,r.agentId,r.sessionKey,r.sessionId,r.toolName,r.toolCallId].filter(Boolean).join(" ").toLowerCase().includes(i):!0}).map(r=>`${r.timestamp} [${r.type}] ${r.agentId} ${r.sessionKey} ${r.toolName??""} ${r.content}`);n.onExport(o,i?"filtered":"visible")}}
|
|
3683
3798
|
>
|
|
3684
3799
|
Export
|
|
3685
3800
|
</button>
|
|
@@ -3690,7 +3805,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3690
3805
|
<button
|
|
3691
3806
|
class="btn btn-sm"
|
|
3692
3807
|
?disabled=${e.entries.length===0}
|
|
3693
|
-
@click=${()=>{const n=e.filterText.trim().toLowerCase(),i=
|
|
3808
|
+
@click=${()=>{const n=e.filterText.trim().toLowerCase(),i=Eo.some(r=>!e.levelFilters[r]),s=e.entries.filter(r=>r.level&&!e.levelFilters[r.level]?!1:vu(r,n)),o=n||i?"filtered":"visible";e.onExport(s.map(r=>r.raw),o)}}
|
|
3694
3809
|
>
|
|
3695
3810
|
Export
|
|
3696
3811
|
</button>
|
|
@@ -3698,16 +3813,16 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3698
3813
|
</div>
|
|
3699
3814
|
</div>
|
|
3700
3815
|
|
|
3701
|
-
${t?
|
|
3816
|
+
${t?fw(e.sessionLogsProps):yw(e)}
|
|
3702
3817
|
</section>
|
|
3703
|
-
`}function
|
|
3818
|
+
`}function yw(e){const t=e.filterText.trim().toLowerCase();Eo.some(i=>!e.levelFilters[i]);const n=e.entries.filter(i=>i.level&&!e.levelFilters[i.level]?!1:vu(i,t));return u`
|
|
3704
3819
|
<button class="chips-toggle" @click=${e.onToggleChips}>
|
|
3705
3820
|
<span class="chips-toggle-icon ${e.chipsExpanded?"expanded":""}">${L.chevronDown}</span>
|
|
3706
3821
|
Filters
|
|
3707
3822
|
</button>
|
|
3708
3823
|
${e.chipsExpanded?u`
|
|
3709
3824
|
<div class="chip-row" style="margin-top: 6px; align-items: center;">
|
|
3710
|
-
${
|
|
3825
|
+
${Eo.map(i=>u`
|
|
3711
3826
|
<label class="chip log-chip ${i}">
|
|
3712
3827
|
<input
|
|
3713
3828
|
type="checkbox"
|
|
@@ -3738,7 +3853,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3738
3853
|
${n.length===0?u`<div class="muted" style="padding: 12px;">No log entries.</div>`:[...n].reverse().map(i=>u`
|
|
3739
3854
|
<div class="log-row">
|
|
3740
3855
|
<div class="log-row-header">
|
|
3741
|
-
<span class="log-time mono">${
|
|
3856
|
+
<span class="log-time mono">${gw(i.time)}</span>
|
|
3742
3857
|
<span class="log-level ${i.level??""}">${i.level??""}</span>
|
|
3743
3858
|
<span class="log-subsystem mono">${i.subsystem??""}</span>
|
|
3744
3859
|
</div>
|
|
@@ -3746,12 +3861,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3746
3861
|
</div>
|
|
3747
3862
|
`)}
|
|
3748
3863
|
</div>
|
|
3749
|
-
`}const
|
|
3864
|
+
`}const vw=[{id:"cron",label:"Events"},{id:"skills",label:"Skills"},{id:"logs",label:"Logs"}];function bw(e){switch(e.activeTab){case"cron":return Sl(e.cronProps);case"skills":return nw(e.skillsProps);case"logs":return mw(e.logsProps);default:return Sl(e.cronProps)}}function ww(e){return e.connected?u`
|
|
3750
3865
|
<div class="setup-container">
|
|
3751
3866
|
${Mt("Advanced",e.wsProps)}
|
|
3752
3867
|
<div class="setup-card sp-card-advanced" style="text-align: left;">
|
|
3753
3868
|
<div class="sp-tabs">
|
|
3754
|
-
${
|
|
3869
|
+
${vw.map(t=>u`
|
|
3755
3870
|
<button
|
|
3756
3871
|
class="sp-tab ${e.activeTab===t.id?"active":""}"
|
|
3757
3872
|
@click=${()=>e.onTabChange(t.id)}
|
|
@@ -3760,7 +3875,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3760
3875
|
</button>
|
|
3761
3876
|
`)}
|
|
3762
3877
|
</div>
|
|
3763
|
-
${
|
|
3878
|
+
${bw(e)}
|
|
3764
3879
|
</div>
|
|
3765
3880
|
</div>
|
|
3766
3881
|
`:u`
|
|
@@ -3770,10 +3885,10 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3770
3885
|
<p>Connecting to gateway...</p>
|
|
3771
3886
|
</div>
|
|
3772
3887
|
</div>
|
|
3773
|
-
`}function
|
|
3888
|
+
`}function El(e){if(!e.show)return k;const t=Ve(),n=e.isFirstTime,i=e.changePinMode===!0&&!n,s=e.changePinBusy===!0;let o=e.accounts.length>0?e.accounts[0].id:"";const r=v=>{var h;o=v.target.value;const S=(h=v.target.closest(".login-card"))==null?void 0:h.querySelector(".login-change-pin");S&&(S.style.display=o==="__master__"?"":"none")},a=v=>S=>{const h=S.target;h.value=h.value.replace(/\D/g,"").slice(0,6),v(h.value)},d=v=>{const S=v.currentTarget,h=S.closest(".login-pin-wrapper"),b=h==null?void 0:h.querySelector("input");if(!b)return;const w=b.type==="text";b.type=w?"password":"text",S.classList.toggle("active",!w)},c=!n&&e.accounts.length>1?u`
|
|
3774
3889
|
<select
|
|
3775
3890
|
class="login-account-select"
|
|
3776
|
-
@change=${
|
|
3891
|
+
@change=${r}
|
|
3777
3892
|
?disabled=${e.busy||s}
|
|
3778
3893
|
>
|
|
3779
3894
|
${e.accounts.map((v,S)=>u`
|
|
@@ -3782,13 +3897,13 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3782
3897
|
</option>
|
|
3783
3898
|
`)}
|
|
3784
3899
|
</select>
|
|
3785
|
-
`:k;if(i){let v="",S="",
|
|
3900
|
+
`:k;if(i){let v="",S="",h="";const b=w=>{var x;w.preventDefault(),!s&&(!v||!S||!h||S===h&&o&&((x=e.onChangePin)==null||x.call(e,o,v,S)))};return u`
|
|
3786
3901
|
<div class="login-overlay">
|
|
3787
3902
|
<div class="login-card">
|
|
3788
3903
|
<img class="login-logo" src="${t.iconUrl}" alt="${t.name}" />
|
|
3789
3904
|
<h2 class="login-title">Change PIN</h2>
|
|
3790
3905
|
<p class="login-subtitle">Enter your current PIN, then choose a new one</p>
|
|
3791
|
-
<form class="login-form" @submit=${
|
|
3906
|
+
<form class="login-form" @submit=${b}>
|
|
3792
3907
|
${c}
|
|
3793
3908
|
<div class="login-pin-wrapper">
|
|
3794
3909
|
<input
|
|
@@ -3800,7 +3915,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3800
3915
|
maxlength="6"
|
|
3801
3916
|
placeholder="Current PIN"
|
|
3802
3917
|
?disabled=${s}
|
|
3803
|
-
@input=${
|
|
3918
|
+
@input=${a(w=>{v=w})}
|
|
3804
3919
|
autofocus
|
|
3805
3920
|
/>
|
|
3806
3921
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
@@ -3818,7 +3933,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3818
3933
|
maxlength="6"
|
|
3819
3934
|
placeholder="New PIN (4-6 digits)"
|
|
3820
3935
|
?disabled=${s}
|
|
3821
|
-
@input=${
|
|
3936
|
+
@input=${a(w=>{S=w})}
|
|
3822
3937
|
/>
|
|
3823
3938
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
3824
3939
|
<span class="pin-eye-show">${L.eye}</span>
|
|
@@ -3835,7 +3950,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3835
3950
|
maxlength="6"
|
|
3836
3951
|
placeholder="Confirm new PIN"
|
|
3837
3952
|
?disabled=${s}
|
|
3838
|
-
@input=${
|
|
3953
|
+
@input=${a(w=>{h=w})}
|
|
3839
3954
|
/>
|
|
3840
3955
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
3841
3956
|
<span class="pin-eye-show">${L.eye}</span>
|
|
@@ -3854,12 +3969,12 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3854
3969
|
<a
|
|
3855
3970
|
class="login-link"
|
|
3856
3971
|
href="#"
|
|
3857
|
-
@click=${
|
|
3972
|
+
@click=${w=>{var x;w.preventDefault(),(x=e.onToggleChangePinMode)==null||x.call(e)}}
|
|
3858
3973
|
>Back to login</a>
|
|
3859
3974
|
</p>
|
|
3860
3975
|
</div>
|
|
3861
3976
|
</div>
|
|
3862
|
-
`}let l="",p="";const
|
|
3977
|
+
`}let l="",p="";const f=v=>{if(v.preventDefault(),!e.busy)if(n){if(!l||!p||l!==p)return;e.onSubmit(l)}else{if(!l||!o)return;e.onSubmit(o,l)}};return u`
|
|
3863
3978
|
<div class="login-overlay">
|
|
3864
3979
|
<div class="login-card">
|
|
3865
3980
|
<img class="login-logo" src="${t.iconUrl}" alt="${t.name}" />
|
|
@@ -3867,7 +3982,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3867
3982
|
<p class="login-subtitle">
|
|
3868
3983
|
${n?"Set a PIN to protect this device":"Enter your PIN to continue"}
|
|
3869
3984
|
</p>
|
|
3870
|
-
<form class="login-form" @submit=${
|
|
3985
|
+
<form class="login-form" @submit=${f}>
|
|
3871
3986
|
${c}
|
|
3872
3987
|
<div class="login-pin-wrapper">
|
|
3873
3988
|
<input
|
|
@@ -3879,7 +3994,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3879
3994
|
maxlength="6"
|
|
3880
3995
|
placeholder="${n?"Choose a 4-6 digit PIN":"PIN"}"
|
|
3881
3996
|
?disabled=${e.busy}
|
|
3882
|
-
@input=${
|
|
3997
|
+
@input=${a(v=>{l=v})}
|
|
3883
3998
|
autofocus
|
|
3884
3999
|
/>
|
|
3885
4000
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
@@ -3898,7 +4013,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3898
4013
|
maxlength="6"
|
|
3899
4014
|
placeholder="Confirm PIN"
|
|
3900
4015
|
?disabled=${e.busy}
|
|
3901
|
-
@input=${
|
|
4016
|
+
@input=${a(v=>{p=v})}
|
|
3902
4017
|
/>
|
|
3903
4018
|
<button class="login-pin-toggle" type="button" @click=${d}>
|
|
3904
4019
|
<span class="pin-eye-show">${L.eye}</span>
|
|
@@ -3924,7 +4039,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3924
4039
|
</p>`:k}
|
|
3925
4040
|
</div>
|
|
3926
4041
|
</div>
|
|
3927
|
-
`}function
|
|
4042
|
+
`}function kw(e){if(!e.connected)return u`
|
|
3928
4043
|
<div class="setup-container">
|
|
3929
4044
|
<div class="setup-card">
|
|
3930
4045
|
<div class="setup-spinner"></div>
|
|
@@ -3937,17 +4052,17 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3937
4052
|
<span class="public-chat-header__name">${n}</span>
|
|
3938
4053
|
</div>
|
|
3939
4054
|
<div class="chat-viewport">
|
|
3940
|
-
${
|
|
4055
|
+
${hu(t)}
|
|
3941
4056
|
</div>
|
|
3942
4057
|
</div>
|
|
3943
|
-
`}async function bw(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}async function Un(e){if(!(!e.client||!e.connected)&&!e.workspacesLoading){e.workspacesLoading=!0,e.workspacesError=null;try{const t=await e.client.request("workspaces.list",{});e.workspaces=t.workspaces}catch(t){e.workspacesError=String(t)}finally{e.workspacesLoading=!1}}}async function ww(e,t){var i,s;if(!e.client||!e.connected||e.workspaceSaving)return;const n=t.name.trim();if(!n){e.workspacesError="Account name is required.";return}e.workspaceSaving=!0,e.workspacesError=null;try{const o=await e.client.request("config.get",{});e.configSnapshot=o;const a=o.hash;if(!a){e.workspacesError="Config hash missing; reload and retry.";return}const r={name:n,baseHash:a,whatsappAccountName:n};(i=t.workspacePath)!=null&&i.trim()&&(r.workspaceDir=t.workspacePath.trim());const d=await e.client.request("workspaces.create",r);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await Un(e),(s=t.onCreated)==null||s.call(t,d)}catch(o){e.workspacesError=String(o)}finally{e.workspaceSaving=!1}}async function kw(e,t){if(!(!e.client||!e.connected)&&!e.workspaceSaving){e.workspaceSaving=!0,e.workspacesError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=n.hash;if(!i){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.remove",{name:t,baseHash:i}),e.workspaceRemoveConfirm=null,await Un(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function $w(e,t,n){if(!(!e.client||!e.connected)){e.workspacesError=null;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.hash;if(!s){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.rename",{name:t,displayName:n,baseHash:s}),await Un(e)}catch(i){e.workspacesError=String(i)}}}const hi=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:ww,loadWorkspaces:Un,removeWorkspace:kw,renameWorkspace:$w},Symbol.toStringTag,{value:"Module"})),vu={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"taskmaster-control-ui",SETUP_UI:"setup-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"taskmaster-macos",IOS_APP:"taskmaster-ios",ANDROID_APP:"taskmaster-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"taskmaster-probe",PUBLIC_CHAT:"public-chat"},El=vu,Eo={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(vu));new Set(Object.values(Eo));function Sw(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),i=e.token??"",s=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),i];return t==="v2"&&s.push(e.nonce??""),s.join("|")}const xw=4008;class Aw{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(){var t;this.closed=!0,(t=this.ws)==null||t.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){var t;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{var i,s;const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),(s=(i=this.opts).onClose)==null||s.call(i,{code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){var p;if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=this.opts.role??"operator",n=this.opts.scopes??["operator.admin","operator.approvals","operator.pairing"],s=!(t!=="operator")&&typeof crypto<"u"&&!!crypto.subtle;let o=null,a=!1,r=this.opts.token;if(s){o=await Xh();const h=(p=tf({deviceId:o.deviceId,role:t}))==null?void 0:p.token;r=h??this.opts.token,a=!!(h&&this.opts.token)}const d=r||this.opts.password?{token:r,password:this.opts.password}:void 0;let c;if(s&&o){const h=Date.now(),v=this.connectNonce??void 0,S=Sw({deviceId:o.deviceId,clientId:this.opts.clientName??El.CONTROL_UI,clientMode:this.opts.mode??Eo.WEBCHAT,role:t,scopes:n,signedAtMs:h,token:r??null,nonce:v}),f=await Zh(o.privateKey,S);c={id:o.deviceId,publicKey:o.publicKey,signature:f,signedAt:h,nonce:v}}const l={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??El.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Eo.WEBCHAT,instanceId:this.opts.instanceId},role:t,scopes:n,device:c,caps:[],auth:d,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",l).then(h=>{var v,S,f;(v=h==null?void 0:h.auth)!=null&&v.deviceToken&&o&&nf({deviceId:o.deviceId,role:h.auth.role??t,token:h.auth.deviceToken,scopes:h.auth.scopes??[]}),this.backoffMs=800,(f=(S=this.opts).onHello)==null||f.call(S,h)}).catch(()=>{var h;a&&o&&sf({deviceId:o.deviceId,role:t}),(h=this.ws)==null||h.close(xw,"connect failed")})}handleMessage(t){var s,o,a,r,d,c;let n;try{n=JSON.parse(t)}catch{return}const i=n;if(i.type==="event"){const l=n;if(l.event==="connect.challenge"){const h=l.payload,v=h&&typeof h.nonce=="string"?h.nonce:null;v&&(this.connectNonce=v,this.sendConnect());return}const p=typeof l.seq=="number"?l.seq:null;p!==null&&(this.lastSeq!==null&&p>this.lastSeq+1&&((o=(s=this.opts).onGap)==null||o.call(s,{expected:this.lastSeq+1,received:p})),this.lastSeq=p);try{(r=(a=this.opts).onEvent)==null||r.call(a,l)}catch(h){console.error("[gateway] event handler error:",h)}return}if(i.type==="res"){const l=n,p=this.pending.get(l.id);if(!p)return;if(this.pending.delete(l.id),l.ok)p.resolve(l.payload);else{const h=new Error(((d=l.error)==null?void 0:d.message)??"request failed");h.payload=l.payload,h.details=(c=l.error)==null?void 0:c.details,p.reject(h)}return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const i=Qi(),s={type:"req",id:i,method:t,params:n},o=new Promise((a,r)=>{this.pending.set(i,{resolve:d=>a(d),reject:r})});return this.ws.send(JSON.stringify(s)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function To(e){return typeof e=="object"&&e!==null}function Cw(e){if(!To(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!To(n))return null;const i=typeof n.command=="string"?n.command.trim():"";if(!i)return null;const s=typeof e.createdAtMs=="number"?e.createdAtMs:0,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!s||!o?null:{id:t,request:{command:i,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:s,expiresAtMs:o}}function Ew(e){if(!To(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 bu(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Tw(e,t){const n=bu(e).filter(i=>i.id!==t.id);return n.push(t),n}function Tl(e,t){return bu(e).filter(n=>n.id!==t)}class _w{constructor(){this.canvas=null,this.ctx=null,this.img=new Image,this.pendingFrame=null,this.rafId=null,this.deviceWidth=1280,this.deviceHeight=720,this.lastMouseMoveAt=0,this.MOUSE_THROTTLE_MS=30}attach(t){this.canvas=t,this.ctx=t.getContext("2d")}detach(){this.rafId!=null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas=null,this.ctx=null,this.pendingFrame=null}updateFrame(t,n){if(n!=null&&n.deviceWidth&&(this.deviceWidth=n.deviceWidth),n!=null&&n.deviceHeight&&(this.deviceHeight=n.deviceHeight),this.pendingFrame=t,!this.canvas){const i=document.getElementById("browser-screencast-canvas");i&&this.attach(i)}this.rafId==null&&(this.rafId=requestAnimationFrame(()=>this.renderFrame()))}renderFrame(){this.rafId=null;const t=this.pendingFrame;!t||!this.canvas||!this.ctx||(this.pendingFrame=null,this.img.onload=()=>{!this.canvas||!this.ctx||((this.canvas.width!==this.img.width||this.canvas.height!==this.img.height)&&(this.canvas.width=this.img.width,this.canvas.height=this.img.height),this.ctx.drawImage(this.img,0,0))},this.img.src=`data:image/jpeg;base64,${t}`)}translateCoordinates(t,n){if(!this.canvas)return{x:t,y:n};const i=this.canvas.getBoundingClientRect(),s=this.canvas.width/i.width,o=this.canvas.height/i.height,a=this.deviceWidth/this.canvas.width,r=this.deviceHeight/this.canvas.height;return{x:Math.round(t*s*a),y:Math.round(n*o*r)}}shouldThrottleMouseMove(){const t=performance.now();return t-this.lastMouseMoveAt<this.MOUSE_THROTTLE_MS?!0:(this.lastMouseMoveAt=t,!1)}getDeviceDimensions(){return{width:this.deviceWidth,height:this.deviceHeight}}}let Ys=null;function _n(){return Ys||(Ys=new _w),Ys}function xa(e){return e instanceof Error?e.message:String(e)}async function Mw(e){if(!e.client){console.error("[browser] startScreencast: no client"),e.browserError="Not connected to gateway";return}if(!e.connected){console.error("[browser] startScreencast: client exists but not connected"),e.browserError="Not connected to gateway";return}console.log("[browser] startScreencast: sending request"),e.browserLoading=!0,e.browserError=null;try{const t=await e.client.request("browser.screencast.start",{quality:60,maxWidth:1280,maxHeight:720});console.log("[browser] startScreencast response:",t),t!=null&&t.ok?e.browserScreencastActive=!0:(console.warn("[browser] startScreencast: response did not have ok=true",t),e.browserError="Screencast start failed (no ok in response)")}catch(t){console.error("[browser] startScreencast error:",t),e.browserError=xa(t)}finally{e.browserLoading=!1}}async function Pw(e){if(!(!e.client||!e.connected)){e.browserLoading=!0,e.browserFullscreen=!1;try{await e.client.request("browser.screencast.stop",{}),e.browserScreencastActive=!1,e.browserScreencastFrame=null,e.browserScreencastMetadata=null}catch(t){e.browserError=xa(t)}finally{e.browserLoading=!1}}}async function Js(e,t,n,i,s){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"mouse",action:t,x:n,y:i,button:s??"left",clickCount:t==="mousePressed"?1:0})}catch{}}async function Xs(e,t,n,i){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"key",action:t,key:n,...i!=null&&i.text?{text:i.text}:{},...i!=null&&i.code?{code:i.code}:{},...i!=null&&i.modifiers?{modifiers:i.modifiers}:{}})}catch{}}async function Lw(e){if(!(!e.client||!e.connected))try{await e.client.request("browser.handoff.complete",{}),e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}catch(t){e.browserError=xa(t)}}function Iw(e){e.browserInputMode=!e.browserInputMode}function Rw(e){e.browserFullscreen=!e.browserFullscreen,_n().detach()}function Dw(e,t){if(!(t!=null&&t.data))return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,_n().updateFrame(t.data,t.metadata)}function Bw(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function Nw(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}async function _o(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),i=n?{sessionKey:n}:{};try{const s=await e.client.request("agent.identity.get",i);if(!s)return;const o=io(s);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}async function wi(e){return(await e.request("apikeys.list")).providers??[]}async function _l(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function Fw(e,t){await e.request("apikeys.remove",{provider:t})}async function Ow(e,t,n){await e.request("apikeys.disable",{provider:t,disabled:n})}const zi="taskmaster_update_pending";async function wu(e){var t,n;if(!(!e.client||!e.connected)&&!e.updateChecking){e.updateChecking=!0,e.updateMessage=null,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("update.status",{});e.currentVersion=i.current,e.latestVersion=i.latest,e.updateAvailable=i.updateAvailable,e.updateMessage=i.updateAvailable?`v${i.latest} available`:"Up to date"}catch(i){e.updateMessage=`Check failed: ${String(i)}`,e.updateAvailable=null}finally{e.updateChecking=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function Uw(e){var t,n,i,s;if(!(!e.client||e.updateRunning)){e.updateRunning=!0,e.updateMessage="Starting update...",e.updateProgressSteps=[],e.updateLastResult=null,(t=e.requestUpdate)==null||t.call(e);try{localStorage.setItem(zi,String(Date.now())),localStorage.removeItem(Aa)}catch{}try{const o=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(o.ok&&o.result.status==="ok")e.updateMessage="Updated — restarting gateway...",(n=e.requestUpdate)==null||n.call(e);else if(o.ok&&o.result.status==="skipped")Mn(),e.updateMessage=o.result.reason||"Update skipped",e.updateRunning=!1,(i=e.requestUpdate)==null||i.call(e);else throw Mn(),new Error(o.result.reason||"Update failed")}catch(o){Mn(),e.updateMessage=`Update failed: ${String(o)}`,e.updateRunning=!1,e.updateProgressSteps=[],(s=e.requestUpdate)==null||s.call(e)}}}function Kw(e,t){var i,s,o;const n=t.phase;if(n==="step-start"){const a=t.name,r=t.index,d=t.total;e.updateMessage=`Updating: ${a} (${r+1}/${d})`;const c=e.updateProgressSteps.find(l=>l.index===r);c?(c.status="running",c.name=a):e.updateProgressSteps=[...e.updateProgressSteps,{name:a,index:r,total:d,status:"running"}],(i=e.requestUpdate)==null||i.call(e)}else if(n==="step-done"){const a=t.name,r=t.index,d=t.total,c=t.ok,l=t.durationMs,p=e.updateProgressSteps.find(v=>v.index===r);p?(p.status=c?"done":"failed",p.durationMs=l):e.updateProgressSteps=[...e.updateProgressSteps,{name:a,index:r,total:d,status:c?"done":"failed",durationMs:l}];const h=!c&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=c?`Updating: ${a} done (${r+1}/${d})`:`Update step failed: ${a}${h}`,(s=e.requestUpdate)==null||s.call(e)}else if(n==="complete"){if(t.status==="ok")e.updateMessage="Update complete — restarting gateway...";else{const r=t.reason;e.updateMessage=r?`Update failed: ${r}`:"Update failed",e.updateRunning=!1,Mn()}(o=e.requestUpdate)==null||o.call(e)}}async function Ww(e){var n,i,s,o;if(!e.client||!e.connected)return;const t=qw();Mn();try{const a=await e.client.request("update.lastResult",{});if(!a.ok||!a.result)return;const r=5*6e4,d=Date.now()-a.result.ts<r;if(!t&&!d||Hw(a.result.ts))return;e.updateLastResult=a.result;const c=(n=a.result.after)==null?void 0:n.version;if(a.result.status==="ok"&&c&&(e.currentVersion=c),e.updateAvailable=!1,a.result.status==="ok"){const l=(i=a.result.before)==null?void 0:i.version,p=c??a.result.currentVersion;e.updateMessage=l?`Updated: v${l} → v${p}`:`Updated to v${p}`}else{const l=a.result.reason??((s=a.result.failedStep)==null?void 0:s.name)??"unknown error";e.updateMessage=`Update failed: ${l}`}}catch{}finally{e.updateRunning=!1,e.updateProgressSteps=[],(o=e.requestUpdate)==null||o.call(e)}}const Aa="taskmaster_update_dismissed";function zw(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(Aa,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function qw(){try{const e=localStorage.getItem(zi);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(zi),!1):!0:!1}catch{return!1}}function Mn(){try{localStorage.removeItem(zi)}catch{}}function Hw(e){try{const t=localStorage.getItem(Aa);return t?Number(t)>=e:!1}catch{return!1}}function Zs(e,t){var r,d,c;const n=(e??"").trim(),i=(r=t.mainSessionKey)==null?void 0:r.trim();if(!i)return n;if(!n)return i;const s=((d=t.mainKey)==null?void 0:d.trim())||"main",o=(c=t.defaultAgentId)==null?void 0:c.trim();return n==="main"||n===s||o&&(n===`agent:${o}:main`||n===`agent:${o}:${s}`)?i:n}function jw(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=Zs(e.sessionKey,t),i=Zs(e.settings.sessionKey,t),s=Zs(e.settings.lastActiveSessionKey,t),o=n||i||e.sessionKey,a={...e.settings,sessionKey:i||o,lastActiveSessionKey:s||o},r=a.sessionKey!==e.settings.sessionKey||a.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),r&&nt(e,a)}function Ie(e){var s;e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=!!e.publicChat,n=e.setup||e.filesPage||e.browserPage||e.chatPage||e.adminsPage||e.contactsPage||e.advancedPage,i=t?"public-chat":n?"setup-ui":"taskmaster-control-ui";(s=e.client)==null||s.stop(),e.client=new Aw({url:e.settings.gatewayUrl,token:t?void 0:e.settings.token.trim()?e.settings.token:void 0,password:t?void 0:e.password.trim()?e.password:void 0,clientName:i,mode:"webchat",role:t?"public":void 0,scopes:t?[]:void 0,onHello:o=>{var a;if(e.connected=!0,e.lastError=null,e.hello=o,t){Ml(e,o),_o(e),(((a=e.publicChatConfig)==null?void 0:a.auth)??"anonymous")==="anonymous"&&Zw(e);return}Pi()&&(oa(),e.uninstallDone=!1),Ml(e,o),e.handleAccessCheck(),Ww(e).then(()=>{wu(e)}),_o(e),bw(e),(e.chatPage||e.setup)&&Qw(e),Vo(e,{quiet:!0}),jo(e,{quiet:!0}),Un(e).then(()=>{e.initWorkspaceSelection()}),e.startEmbeddingPoll(),(e.setup||e.chatPage)&&Fe(e),e.setup&&(Yw(e),Jw(e),Xw(e)),_i(e)},onClose:({code:o,reason:a})=>{e.connected=!1,o!==1012&&(e.lastError=`disconnected (${o}): ${a||"no reason"}`)},onEvent:o=>Vw(e,o),onGap:({expected:o,received:a})=>{console.warn(`[gateway] event gap: expected seq ${o}, got ${a}`),_i(e)}}),e.client.start()}function Vw(e,t){try{Gw(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Gw(e,t){var n;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;ih(e,t.payload);return}if(t.event==="chat"){const i=t.payload;i!=null&&i.sessionKey&&ad(e,i.sessionKey);const s=lc(e,i);if((s==="final"||s==="error"||s==="aborted")&&(Fo(e),Qf(e)),s==="final"){const o=e,a=Math.max((((n=o.chatMessages)==null?void 0:n.length)??0)+10,Ne);Be(o,{limit:a})}return}if(t.event==="suggestions"){const i=t.payload;(i==null?void 0:i.sessionKey)===e.sessionKey&&Array.isArray(i.suggestions)&&i.suggestions.length>0&&(e.chatSuggestion=i.suggestions[0]);return}if(t.event==="presence"){const i=t.payload;i!=null&&i.presence&&Array.isArray(i.presence)&&(e.presenceEntries=i.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"){const i=t.payload;i&&vh(e,i),e.tab==="cron"&&ia(e)}if((t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&jo(e,{quiet:!0}),t.event==="exec.approval.requested"){const i=Cw(t.payload);if(i){e.execApprovalQueue=Tw(e.execApprovalQueue,i),e.execApprovalError=null;const s=Math.max(0,i.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Tl(e.execApprovalQueue,i.id)},s)}return}if(t.event==="browser.screencast.frame"){Dw(e,t.payload);return}if(t.event==="browser.handoff"){Bw(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){Nw(e);return}if(t.event==="exec.approval.resolved"){const i=Ew(t.payload);i&&(e.execApprovalQueue=Tl(e.execApprovalQueue,i.id));return}if(t.event==="update.progress"){Kw(e,t.payload);return}}function Ml(e,t){const n=t.snapshot;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n!=null&&n.health&&(e.debugHealth=n.health),n!=null&&n.sessionDefaults&&jw(e,n.sessionDefaults)}async function Qw(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("models.list",{});Array.isArray(t==null?void 0:t.models)&&(e.chatModelCatalog=t.models)}catch{}}async function Yw(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await wi(e.client)}catch{}}async function Jw(e){if(!(!e.client||!e.connected))try{e.tailscaleStatus=await e.client.request("tailscale.status")}catch{}}async function Xw(e){if(!(!e.client||!e.connected))try{e.wifiStatus=await e.client.request("wifi.status")}catch{}}const Pl="taskmaster_public_id";function ku(e=30){var s;const t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${Pl}=`));if(t)return t.split("=")[1];const n=`anon-${((s=crypto.randomUUID)==null?void 0:s.call(crypto))??Math.random().toString(36).slice(2)}`,i=new Date(Date.now()+e*864e5).toUTCString();return document.cookie=`${Pl}=${n}; path=/; expires=${i}; SameSite=Lax`,n}async function Zw(e){var n,i,s;if(!e.client||!e.connected)return;const t=ku((n=e.publicChatConfig)==null?void 0:n.cookieTtlDays);try{const o=(i=e.publicChatConfig)==null?void 0:i.accountId,a=await e.client.request("public.session",{cookieId:t,accountId:o});if(a!=null&&a.sessionKey){e.publicChatSessionKey=a.sessionKey,e.sessionKey=a.sessionKey,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready";const r=((s=e.publicChatConfig)==null?void 0:s.accountId)??"";e.chatMessage=Rn(r,a.sessionKey),Be(e)}}catch(o){console.error("[public-chat] failed to resolve anonymous session:",o),e.lastError="Failed to start chat session"}}let Ee=!1,fe=null,Qt="",qi="";function $u(e){return e.replace(/[\s\-()]/g,"")}function Su(){Ee=!1,fe=null,Qt="",qi=""}async function ek(e){if(!e.client||!e.connected)return;const t=ku(e.cookieTtlDays);try{const n=await e.client.request("public.session",{cookieId:t,accountId:e.accountId});n!=null&&n.sessionKey&&e.onAuthenticated(n.sessionKey)}catch(n){fe=n instanceof Error?n.message:"Failed to start session",e.requestUpdate()}}async function Ll(e){if(!e.client||Ee)return;const t=$u(Qt);if(!t){fe="Please enter your phone number",e.requestUpdate();return}Ee=!0,fe=null,e.requestUpdate();try{const n=await e.client.request("public.otp.request",{phone:t,name:qi.trim()||void 0,accountId:e.accountId});n!=null&&n.ok?e.onAuthStepChange("otp"):fe=(n==null?void 0:n.error)??"Failed to send verification code"}catch(n){fe=n instanceof Error?n.message:"Failed to send verification code"}finally{Ee=!1,e.requestUpdate()}}async function Il(e,t){if(!(!e.client||Ee)){if(!t.trim()){fe="Please enter the verification code",e.requestUpdate();return}Ee=!0,fe=null,e.requestUpdate();try{const n=await e.client.request("public.otp.verify",{phone:$u(Qt),code:t.trim(),accountId:e.accountId});n!=null&&n.ok&&n.sessionKey?(Su(),e.onAuthenticated(n.sessionKey)):fe=(n==null?void 0:n.error)??"Invalid verification code"}catch(n){fe=n instanceof Error?n.message:"Verification failed"}finally{Ee=!1,e.requestUpdate()}}}function eo(e){return k}function Rl(e){return u`
|
|
4058
|
+
`}async function $w(e){if(!(!e.client||!e.connected)&&!e.agentsLoading){e.agentsLoading=!0,e.agentsError=null;try{const t=await e.client.request("agents.list",{});t&&(e.agentsList=t)}catch(t){e.agentsError=String(t)}finally{e.agentsLoading=!1}}}async function Un(e){if(!(!e.client||!e.connected)&&!e.workspacesLoading){e.workspacesLoading=!0,e.workspacesError=null;try{const t=await e.client.request("workspaces.list",{});e.workspaces=t.workspaces}catch(t){e.workspacesError=String(t)}finally{e.workspacesLoading=!1}}}async function Sw(e,t){var i,s;if(!e.client||!e.connected||e.workspaceSaving)return;const n=t.name.trim();if(!n){e.workspacesError="Account name is required.";return}e.workspaceSaving=!0,e.workspacesError=null;try{const o=await e.client.request("config.get",{});e.configSnapshot=o;const r=o.hash;if(!r){e.workspacesError="Config hash missing; reload and retry.";return}const a={name:n,baseHash:r,whatsappAccountName:n};(i=t.workspacePath)!=null&&i.trim()&&(a.workspaceDir=t.workspacePath.trim());const d=await e.client.request("workspaces.create",a);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await Un(e),(s=t.onCreated)==null||s.call(t,d)}catch(o){e.workspacesError=String(o)}finally{e.workspaceSaving=!1}}async function xw(e,t){if(!(!e.client||!e.connected)&&!e.workspaceSaving){e.workspaceSaving=!0,e.workspacesError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=n.hash;if(!i){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.remove",{name:t,baseHash:i}),e.workspaceRemoveConfirm=null,await Un(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function Aw(e,t,n){if(!(!e.client||!e.connected)){e.workspacesError=null;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.hash;if(!s){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.rename",{name:t,displayName:n,baseHash:s}),await Un(e)}catch(i){e.workspacesError=String(i)}}}const hi=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:Sw,loadWorkspaces:Un,removeWorkspace:xw,renameWorkspace:Aw},Symbol.toStringTag,{value:"Module"})),bu={WEBCHAT_UI:"webchat-ui",CONTROL_UI:"taskmaster-control-ui",SETUP_UI:"setup-ui",WEBCHAT:"webchat",CLI:"cli",GATEWAY_CLIENT:"gateway-client",MACOS_APP:"taskmaster-macos",IOS_APP:"taskmaster-ios",ANDROID_APP:"taskmaster-android",NODE_HOST:"node-host",TEST:"test",FINGERPRINT:"fingerprint",PROBE:"taskmaster-probe",PUBLIC_CHAT:"public-chat"},Cl=bu,Co={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(bu));new Set(Object.values(Co));function Ew(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),i=e.token??"",s=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),i];return t==="v2"&&s.push(e.nonce??""),s.join("|")}const Cw=4008;class Tw{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(){var t;this.closed=!0,(t=this.ws)==null||t.close(),this.ws=null,this.flushPending(new Error("gateway client stopped"))}get connected(){var t;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN}connect(){this.closed||(this.ws=new WebSocket(this.opts.url),this.ws.onopen=()=>this.queueConnect(),this.ws.onmessage=t=>this.handleMessage(String(t.data??"")),this.ws.onclose=t=>{var i,s;const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),(s=(i=this.opts).onClose)==null||s.call(i,{code:t.code,reason:n}),this.scheduleReconnect()},this.ws.onerror=()=>{})}scheduleReconnect(){if(this.closed)return;const t=this.backoffMs;this.backoffMs=Math.min(this.backoffMs*1.7,15e3),window.setTimeout(()=>this.connect(),t)}flushPending(t){for(const[,n]of this.pending)n.reject(t);this.pending.clear()}async sendConnect(){var p;if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=this.opts.role??"operator",n=this.opts.scopes??["operator.admin","operator.approvals","operator.pairing"],s=!(t!=="operator")&&typeof crypto<"u"&&!!crypto.subtle;let o=null,r=!1,a=this.opts.token;if(s){o=await Zh();const f=(p=nf({deviceId:o.deviceId,role:t}))==null?void 0:p.token;a=f??this.opts.token,r=!!(f&&this.opts.token)}const d=a||this.opts.password?{token:a,password:this.opts.password}:void 0;let c;if(s&&o){const f=Date.now(),v=this.connectNonce??void 0,S=Ew({deviceId:o.deviceId,clientId:this.opts.clientName??Cl.CONTROL_UI,clientMode:this.opts.mode??Co.WEBCHAT,role:t,scopes:n,signedAtMs:f,token:a??null,nonce:v}),h=await ef(o.privateKey,S);c={id:o.deviceId,publicKey:o.publicKey,signature:h,signedAt:f,nonce:v}}const l={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Cl.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Co.WEBCHAT,instanceId:this.opts.instanceId},role:t,scopes:n,device:c,caps:[],auth:d,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",l).then(f=>{var v,S,h;(v=f==null?void 0:f.auth)!=null&&v.deviceToken&&o&&sf({deviceId:o.deviceId,role:f.auth.role??t,token:f.auth.deviceToken,scopes:f.auth.scopes??[]}),this.backoffMs=800,(h=(S=this.opts).onHello)==null||h.call(S,f)}).catch(()=>{var f;r&&o&&of({deviceId:o.deviceId,role:t}),(f=this.ws)==null||f.close(Cw,"connect failed")})}handleMessage(t){var s,o,r,a,d,c;let n;try{n=JSON.parse(t)}catch{return}const i=n;if(i.type==="event"){const l=n;if(l.event==="connect.challenge"){const f=l.payload,v=f&&typeof f.nonce=="string"?f.nonce:null;v&&(this.connectNonce=v,this.sendConnect());return}const p=typeof l.seq=="number"?l.seq:null;p!==null&&(this.lastSeq!==null&&p>this.lastSeq+1&&((o=(s=this.opts).onGap)==null||o.call(s,{expected:this.lastSeq+1,received:p})),this.lastSeq=p);try{(a=(r=this.opts).onEvent)==null||a.call(r,l)}catch(f){console.error("[gateway] event handler error:",f)}return}if(i.type==="res"){const l=n,p=this.pending.get(l.id);if(!p)return;if(this.pending.delete(l.id),l.ok)p.resolve(l.payload);else{const f=new Error(((d=l.error)==null?void 0:d.message)??"request failed");f.payload=l.payload,f.details=(c=l.error)==null?void 0:c.details,p.reject(f)}return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const i=Qi(),s={type:"req",id:i,method:t,params:n},o=new Promise((r,a)=>{this.pending.set(i,{resolve:d=>r(d),reject:a})});return this.ws.send(JSON.stringify(s)),o}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function To(e){return typeof e=="object"&&e!==null}function _w(e){if(!To(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!To(n))return null;const i=typeof n.command=="string"?n.command.trim():"";if(!i)return null;const s=typeof e.createdAtMs=="number"?e.createdAtMs:0,o=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!s||!o?null:{id:t,request:{command:i,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:s,expiresAtMs:o}}function Mw(e){if(!To(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 wu(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Pw(e,t){const n=wu(e).filter(i=>i.id!==t.id);return n.push(t),n}function Tl(e,t){return wu(e).filter(n=>n.id!==t)}class Lw{constructor(){this.canvas=null,this.ctx=null,this.img=new Image,this.pendingFrame=null,this.rafId=null,this.deviceWidth=1280,this.deviceHeight=720,this.lastMouseMoveAt=0,this.MOUSE_THROTTLE_MS=30}attach(t){this.canvas=t,this.ctx=t.getContext("2d")}detach(){this.rafId!=null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.canvas=null,this.ctx=null,this.pendingFrame=null}updateFrame(t,n){if(n!=null&&n.deviceWidth&&(this.deviceWidth=n.deviceWidth),n!=null&&n.deviceHeight&&(this.deviceHeight=n.deviceHeight),this.pendingFrame=t,!this.canvas){const i=document.getElementById("browser-screencast-canvas");i&&this.attach(i)}this.rafId==null&&(this.rafId=requestAnimationFrame(()=>this.renderFrame()))}renderFrame(){this.rafId=null;const t=this.pendingFrame;!t||!this.canvas||!this.ctx||(this.pendingFrame=null,this.img.onload=()=>{!this.canvas||!this.ctx||((this.canvas.width!==this.img.width||this.canvas.height!==this.img.height)&&(this.canvas.width=this.img.width,this.canvas.height=this.img.height),this.ctx.drawImage(this.img,0,0))},this.img.src=`data:image/jpeg;base64,${t}`)}translateCoordinates(t,n){if(!this.canvas)return{x:t,y:n};const i=this.canvas.getBoundingClientRect(),s=this.canvas.width/i.width,o=this.canvas.height/i.height,r=this.deviceWidth/this.canvas.width,a=this.deviceHeight/this.canvas.height;return{x:Math.round(t*s*r),y:Math.round(n*o*a)}}shouldThrottleMouseMove(){const t=performance.now();return t-this.lastMouseMoveAt<this.MOUSE_THROTTLE_MS?!0:(this.lastMouseMoveAt=t,!1)}getDeviceDimensions(){return{width:this.deviceWidth,height:this.deviceHeight}}}let Js=null;function _n(){return Js||(Js=new Lw),Js}function xr(e){return e instanceof Error?e.message:String(e)}async function Iw(e){if(!e.client){console.error("[browser] startScreencast: no client"),e.browserError="Not connected to gateway";return}if(!e.connected){console.error("[browser] startScreencast: client exists but not connected"),e.browserError="Not connected to gateway";return}console.log("[browser] startScreencast: sending request"),e.browserLoading=!0,e.browserError=null;try{const t=await e.client.request("browser.screencast.start",{quality:60,maxWidth:1280,maxHeight:720});console.log("[browser] startScreencast response:",t),t!=null&&t.ok?e.browserScreencastActive=!0:(console.warn("[browser] startScreencast: response did not have ok=true",t),e.browserError="Screencast start failed (no ok in response)")}catch(t){console.error("[browser] startScreencast error:",t),e.browserError=xr(t)}finally{e.browserLoading=!1}}async function Rw(e){if(!(!e.client||!e.connected)){e.browserLoading=!0,e.browserFullscreen=!1;try{await e.client.request("browser.screencast.stop",{}),e.browserScreencastActive=!1,e.browserScreencastFrame=null,e.browserScreencastMetadata=null}catch(t){e.browserError=xr(t)}finally{e.browserLoading=!1}}}async function Ys(e,t,n,i,s){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"mouse",action:t,x:n,y:i,button:s??"left",clickCount:t==="mousePressed"?1:0})}catch{}}async function Xs(e,t,n,i){if(!(!e.client||!e.connected||!e.browserInputMode))try{await e.client.request("browser.screencast.input",{type:"key",action:t,key:n,...i!=null&&i.text?{text:i.text}:{},...i!=null&&i.code?{code:i.code}:{},...i!=null&&i.modifiers?{modifiers:i.modifiers}:{}})}catch{}}async function Dw(e){if(!(!e.client||!e.connected))try{await e.client.request("browser.handoff.complete",{}),e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}catch(t){e.browserError=xr(t)}}function Nw(e){e.browserInputMode=!e.browserInputMode}function Bw(e){e.browserFullscreen=!e.browserFullscreen,_n().detach()}function Fw(e,t){if(!(t!=null&&t.data))return;e.browserScreencastFrame=t.data,e.browserScreencastMetadata=t.metadata??null,_n().updateFrame(t.data,t.metadata)}function Ow(e,t){t&&(e.browserHandoffPending=!0,e.browserHandoffReason=t.reason??"Action required",e.browserHandoffId=t.id??null)}function Uw(e){e.browserHandoffPending=!1,e.browserHandoffReason=null,e.browserHandoffId=null}async function _o(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),i=n?{sessionKey:n}:{};try{const s=await e.client.request("agent.identity.get",i);if(!s)return;const o=io(s);e.assistantName=o.name,e.assistantAvatar=o.avatar,e.assistantAgentId=o.agentId??null}catch{}}async function wi(e){return(await e.request("apikeys.list")).providers??[]}async function _l(e,t,n){await e.request("apikeys.set",{provider:t,apiKey:n})}async function Ww(e,t){await e.request("apikeys.remove",{provider:t})}async function Kw(e,t,n){await e.request("apikeys.disable",{provider:t,disabled:n})}const zi="taskmaster_update_pending";async function ku(e){var t,n;if(!(!e.client||!e.connected)&&!e.updateChecking){e.updateChecking=!0,e.updateMessage=null,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("update.status",{});e.currentVersion=i.current,e.latestVersion=i.latest,e.updateAvailable=i.updateAvailable,e.updateMessage=i.updateAvailable?`v${i.latest} available`:"Up to date"}catch(i){e.updateMessage=`Check failed: ${String(i)}`,e.updateAvailable=null}finally{e.updateChecking=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function zw(e){var t,n,i,s;if(!(!e.client||e.updateRunning)){e.updateRunning=!0,e.updateMessage="Starting update...",e.updateProgressSteps=[],e.updateLastResult=null,(t=e.requestUpdate)==null||t.call(e);try{localStorage.setItem(zi,String(Date.now())),localStorage.removeItem(Ar)}catch{}try{const o=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(o.ok&&o.result.status==="ok")e.updateMessage="Updated — restarting gateway...",(n=e.requestUpdate)==null||n.call(e);else if(o.ok&&o.result.status==="skipped")Mn(),e.updateMessage=o.result.reason||"Update skipped",e.updateRunning=!1,(i=e.requestUpdate)==null||i.call(e);else throw Mn(),new Error(o.result.reason||"Update failed")}catch(o){Mn(),e.updateMessage=`Update failed: ${String(o)}`,e.updateRunning=!1,e.updateProgressSteps=[],(s=e.requestUpdate)==null||s.call(e)}}}function Hw(e,t){var i,s,o;const n=t.phase;if(n==="step-start"){const r=t.name,a=t.index,d=t.total;e.updateMessage=`Updating: ${r} (${a+1}/${d})`;const c=e.updateProgressSteps.find(l=>l.index===a);c?(c.status="running",c.name=r):e.updateProgressSteps=[...e.updateProgressSteps,{name:r,index:a,total:d,status:"running"}],(i=e.requestUpdate)==null||i.call(e)}else if(n==="step-done"){const r=t.name,a=t.index,d=t.total,c=t.ok,l=t.durationMs,p=e.updateProgressSteps.find(v=>v.index===a);p?(p.status=c?"done":"failed",p.durationMs=l):e.updateProgressSteps=[...e.updateProgressSteps,{name:r,index:a,total:d,status:c?"done":"failed",durationMs:l}];const f=!c&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=c?`Updating: ${r} done (${a+1}/${d})`:`Update step failed: ${r}${f}`,(s=e.requestUpdate)==null||s.call(e)}else if(n==="complete"){if(t.status==="ok")e.updateMessage="Update complete — restarting gateway...";else{const a=t.reason;e.updateMessage=a?`Update failed: ${a}`:"Update failed",e.updateRunning=!1,Mn()}(o=e.requestUpdate)==null||o.call(e)}}async function qw(e){var n,i,s,o;if(!e.client||!e.connected)return;const t=Vw();Mn();try{const r=await e.client.request("update.lastResult",{});if(!r.ok||!r.result)return;const a=5*6e4,d=Date.now()-r.result.ts<a;if(!t&&!d||Gw(r.result.ts))return;e.updateLastResult=r.result;const c=(n=r.result.after)==null?void 0:n.version;if(r.result.status==="ok"&&c&&(e.currentVersion=c),e.updateAvailable=!1,r.result.status==="ok"){const l=(i=r.result.before)==null?void 0:i.version,p=c??r.result.currentVersion;e.updateMessage=l?`Updated: v${l} → v${p}`:`Updated to v${p}`}else{const l=r.result.reason??((s=r.result.failedStep)==null?void 0:s.name)??"unknown error";e.updateMessage=`Update failed: ${l}`}}catch{}finally{e.updateRunning=!1,e.updateProgressSteps=[],(o=e.requestUpdate)==null||o.call(e)}}const Ar="taskmaster_update_dismissed";function jw(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(Ar,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function Vw(){try{const e=localStorage.getItem(zi);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(zi),!1):!0:!1}catch{return!1}}function Mn(){try{localStorage.removeItem(zi)}catch{}}function Gw(e){try{const t=localStorage.getItem(Ar);return t?Number(t)>=e:!1}catch{return!1}}function Zs(e,t){var a,d,c;const n=(e??"").trim(),i=(a=t.mainSessionKey)==null?void 0:a.trim();if(!i)return n;if(!n)return i;const s=((d=t.mainKey)==null?void 0:d.trim())||"main",o=(c=t.defaultAgentId)==null?void 0:c.trim();return n==="main"||n===s||o&&(n===`agent:${o}:main`||n===`agent:${o}:${s}`)?i:n}function Qw(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=Zs(e.sessionKey,t),i=Zs(e.settings.sessionKey,t),s=Zs(e.settings.lastActiveSessionKey,t),o=n||i||e.sessionKey,r={...e.settings,sessionKey:i||o,lastActiveSessionKey:s||o},a=r.sessionKey!==e.settings.sessionKey||r.lastActiveSessionKey!==e.settings.lastActiveSessionKey;o!==e.sessionKey&&(e.sessionKey=o),a&&nt(e,r)}function Ie(e){var s;e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const t=!!e.publicChat,n=e.setup||e.filesPage||e.browserPage||e.chatPage||e.adminsPage||e.contactsPage||e.advancedPage,i=t?"public-chat":n?"setup-ui":"taskmaster-control-ui";(s=e.client)==null||s.stop(),e.client=new Tw({url:e.settings.gatewayUrl,token:t?void 0:e.settings.token.trim()?e.settings.token:void 0,password:t?void 0:e.password.trim()?e.password:void 0,clientName:i,mode:"webchat",role:t?"public":void 0,scopes:t?[]:void 0,onHello:o=>{var r;if(e.connected=!0,e.lastError=null,e.hello=o,t){Ml(e,o),_o(e),(((r=e.publicChatConfig)==null?void 0:r.auth)??"anonymous")==="anonymous"&&ik(e);return}Pi()&&(or(),e.uninstallDone=!1),Ml(e,o),e.handleAccessCheck(),qw(e).then(()=>{ku(e)}),_o(e),$w(e),(e.chatPage||e.setup)&&Xw(e),Vo(e,{quiet:!0}),jo(e,{quiet:!0}),Un(e).then(()=>{e.initWorkspaceSelection()}),e.startEmbeddingPoll(),(e.setup||e.chatPage)&&Fe(e),e.setup&&(Zw(e),ek(e),tk(e),nk(e)),_i(e)},onClose:({code:o,reason:r})=>{e.connected=!1,o!==1012&&(e.lastError=`disconnected (${o}): ${r||"no reason"}`)},onEvent:o=>Jw(e,o),onGap:({expected:o,received:r})=>{console.warn(`[gateway] event gap: expected seq ${o}, got ${r}`),_i(e)}}),e.client.start()}function Jw(e,t){try{Yw(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function Yw(e,t){var n;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;sh(e,t.payload);return}if(t.event==="chat"){const i=t.payload;i!=null&&i.sessionKey&&rd(e,i.sessionKey);const s=lc(e,i);if((s==="final"||s==="error"||s==="aborted")&&(Fo(e),Jf(e)),s==="final"){const o=e,r=Math.max((((n=o.chatMessages)==null?void 0:n.length)??0)+10,Be);Ne(o,{limit:r})}return}if(t.event==="suggestions"){const i=t.payload;(i==null?void 0:i.sessionKey)===e.sessionKey&&Array.isArray(i.suggestions)&&i.suggestions.length>0&&(e.chatSuggestion=i.suggestions[0]);return}if(t.event==="presence"){const i=t.payload;i!=null&&i.presence&&Array.isArray(i.presence)&&(e.presenceEntries=i.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"){const i=t.payload;i&&bh(e,i),e.tab==="cron"&&ir(e)}if((t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&jo(e,{quiet:!0}),t.event==="exec.approval.requested"){const i=_w(t.payload);if(i){e.execApprovalQueue=Pw(e.execApprovalQueue,i),e.execApprovalError=null;const s=Math.max(0,i.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Tl(e.execApprovalQueue,i.id)},s)}return}if(t.event==="browser.screencast.frame"){Fw(e,t.payload);return}if(t.event==="browser.handoff"){Ow(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){Uw(e);return}if(t.event==="exec.approval.resolved"){const i=Mw(t.payload);i&&(e.execApprovalQueue=Tl(e.execApprovalQueue,i.id));return}if(t.event==="update.progress"){Hw(e,t.payload);return}}function Ml(e,t){const n=t.snapshot;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence),n!=null&&n.health&&(e.debugHealth=n.health),n!=null&&n.sessionDefaults&&Qw(e,n.sessionDefaults)}async function Xw(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("models.list",{});Array.isArray(t==null?void 0:t.models)&&(e.chatModelCatalog=t.models)}catch{}}async function Zw(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await wi(e.client)}catch{}}async function ek(e){if(!(!e.client||!e.connected))try{e.tailscaleStatus=await e.client.request("tailscale.status")}catch{}}async function tk(e){if(!(!e.client||!e.connected))try{e.wifiStatus=await e.client.request("wifi.status")}catch{}}async function nk(e){if(!(!e.client||!e.connected))try{const t=await e.client.request("network.status");e.networkPort=t.port,e.networkHostname=t.hostname,e.networkPortInput=String(t.port),e.networkHostnameInput=t.hostname}catch{}}const Pl="taskmaster_public_id";function $u(e=30){var s;const t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${Pl}=`));if(t)return t.split("=")[1];const n=`anon-${((s=crypto.randomUUID)==null?void 0:s.call(crypto))??Math.random().toString(36).slice(2)}`,i=new Date(Date.now()+e*864e5).toUTCString();return document.cookie=`${Pl}=${n}; path=/; expires=${i}; SameSite=Lax`,n}async function ik(e){var n,i,s;if(!e.client||!e.connected)return;const t=$u((n=e.publicChatConfig)==null?void 0:n.cookieTtlDays);try{const o=(i=e.publicChatConfig)==null?void 0:i.accountId,r=await e.client.request("public.session",{cookieId:t,accountId:o});if(r!=null&&r.sessionKey){e.publicChatSessionKey=r.sessionKey,e.sessionKey=r.sessionKey,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready";const a=((s=e.publicChatConfig)==null?void 0:s.accountId)??"";e.chatMessage=Rn(a,r.sessionKey),Ne(e)}}catch(o){console.error("[public-chat] failed to resolve anonymous session:",o),e.lastError="Failed to start chat session"}}let Ce=!1,fe=null,Qt="",Hi="";function Su(e){return e.replace(/[\s\-()]/g,"")}function xu(){Ce=!1,fe=null,Qt="",Hi=""}async function sk(e){if(!e.client||!e.connected)return;const t=$u(e.cookieTtlDays);try{const n=await e.client.request("public.session",{cookieId:t,accountId:e.accountId});n!=null&&n.sessionKey&&e.onAuthenticated(n.sessionKey)}catch(n){fe=n instanceof Error?n.message:"Failed to start session",e.requestUpdate()}}async function Ll(e){if(!e.client||Ce)return;const t=Su(Qt);if(!t){fe="Please enter your phone number",e.requestUpdate();return}Ce=!0,fe=null,e.requestUpdate();try{const n=await e.client.request("public.otp.request",{phone:t,name:Hi.trim()||void 0,accountId:e.accountId});n!=null&&n.ok?e.onAuthStepChange("otp"):fe=(n==null?void 0:n.error)??"Failed to send verification code"}catch(n){fe=n instanceof Error?n.message:"Failed to send verification code"}finally{Ce=!1,e.requestUpdate()}}async function Il(e,t){if(!(!e.client||Ce)){if(!t.trim()){fe="Please enter the verification code",e.requestUpdate();return}Ce=!0,fe=null,e.requestUpdate();try{const n=await e.client.request("public.otp.verify",{phone:Su(Qt),code:t.trim(),accountId:e.accountId});n!=null&&n.ok&&n.sessionKey?(xu(),e.onAuthenticated(n.sessionKey)):fe=(n==null?void 0:n.error)??"Invalid verification code"}catch(n){fe=n instanceof Error?n.message:"Verification failed"}finally{Ce=!1,e.requestUpdate()}}}function eo(e){return k}function Rl(e){return u`
|
|
3944
4059
|
<div class="public-auth__form">
|
|
3945
4060
|
<label class="field public-auth__field">
|
|
3946
4061
|
<span>Your name (optional)</span>
|
|
3947
4062
|
<input
|
|
3948
4063
|
type="text"
|
|
3949
|
-
.value=${
|
|
3950
|
-
@input=${t=>{
|
|
4064
|
+
.value=${Hi}
|
|
4065
|
+
@input=${t=>{Hi=t.target.value}}
|
|
3951
4066
|
placeholder="Name"
|
|
3952
4067
|
/>
|
|
3953
4068
|
</label>
|
|
@@ -3965,10 +4080,10 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3965
4080
|
${fe?u`<div class="public-auth__error">${fe}</div>`:k}
|
|
3966
4081
|
<button
|
|
3967
4082
|
class="btn primary public-auth__btn"
|
|
3968
|
-
?disabled=${
|
|
4083
|
+
?disabled=${Ce}
|
|
3969
4084
|
@click=${()=>{Ll(e)}}
|
|
3970
4085
|
>
|
|
3971
|
-
${
|
|
4086
|
+
${Ce?"Sending...":"Send verification code"}
|
|
3972
4087
|
</button>
|
|
3973
4088
|
</div>
|
|
3974
4089
|
`}function Dl(e){let t="";return u`
|
|
@@ -3991,10 +4106,10 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
3991
4106
|
${fe?u`<div class="public-auth__error">${fe}</div>`:k}
|
|
3992
4107
|
<button
|
|
3993
4108
|
class="btn primary public-auth__btn"
|
|
3994
|
-
?disabled=${
|
|
4109
|
+
?disabled=${Ce}
|
|
3995
4110
|
@click=${()=>{Il(e,t)}}
|
|
3996
4111
|
>
|
|
3997
|
-
${
|
|
4112
|
+
${Ce?"Verifying...":"Verify"}
|
|
3998
4113
|
</button>
|
|
3999
4114
|
<button
|
|
4000
4115
|
class="btn public-auth__btn public-auth__btn--link"
|
|
@@ -4003,7 +4118,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4003
4118
|
Use a different number
|
|
4004
4119
|
</button>
|
|
4005
4120
|
</div>
|
|
4006
|
-
`}function
|
|
4121
|
+
`}function ok(e){const{authMode:t,authStep:n}=e;return t==="anonymous"?u`
|
|
4007
4122
|
<div class="setup-container">
|
|
4008
4123
|
<div class="setup-card">
|
|
4009
4124
|
<div class="setup-spinner"></div>
|
|
@@ -4037,13 +4152,13 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4037
4152
|
<div class="public-auth__choices">
|
|
4038
4153
|
<button
|
|
4039
4154
|
class="btn primary public-auth__btn"
|
|
4040
|
-
@click=${()=>{
|
|
4155
|
+
@click=${()=>{sk(e)}}
|
|
4041
4156
|
>
|
|
4042
4157
|
Chat now
|
|
4043
4158
|
</button>
|
|
4044
4159
|
<button
|
|
4045
4160
|
class="btn public-auth__btn"
|
|
4046
|
-
@click=${()=>{
|
|
4161
|
+
@click=${()=>{xu(),e.onAuthStepChange("phone")}}
|
|
4047
4162
|
>
|
|
4048
4163
|
Verify with WhatsApp
|
|
4049
4164
|
</button>
|
|
@@ -4053,7 +4168,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4053
4168
|
</p>
|
|
4054
4169
|
</div>
|
|
4055
4170
|
</div>
|
|
4056
|
-
`}const Ca="taskmaster-access-session",xu={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function Au(){try{return localStorage.getItem(Ca)}catch{return null}}function Cu(e){try{localStorage.setItem(Ca,e)}catch{}}function nk(){try{localStorage.removeItem(Ca)}catch{}}async function Bl(e){if(e.client)try{const t=Au(),n=await e.client.request("access.status",{token:t});e.accessState={...e.accessState,checked:!0,hasPins:n.hasPins,hasMasterPin:n.hasMasterPin,accounts:n.accounts??[],authenticated:n.authenticated,workspace:n.workspace,master:n.master,error:null}}catch{e.accessState={...e.accessState,checked:!0,hasPins:!1,hasMasterPin:!1,accounts:[],authenticated:!0,error:null}}}async function ik(e,t,n){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const i=await e.client.request("access.verify",{account:t,pin:n});i.ok&&i.token?(Cu(i.token),e.accessState={...e.accessState,authenticated:!0,workspace:i.workspace??null,master:i.master??!1,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:i.message??"Incorrect PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to verify PIN"}}}}async function sk(e,t){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const n=await e.client.request("access.setMasterPin",{pin:t});n.ok&&n.token?(Cu(n.token),e.accessState={...e.accessState,checked:!0,hasPins:!0,hasMasterPin:!0,authenticated:!0,workspace:null,master:!0,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:"Failed to set PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to set PIN"}}}}async function ok(e,t,n){if(!e.client)return!1;try{return(await e.client.request("access.setAccountPin",{workspace:t,pin:n})).ok}catch{return!1}}async function ak(e){const t=Au();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}nk(),e.accessState={...xu,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}function rk(e,t="admin"){var s;if(!e)return[];const n=e.bindings;if(!Array.isArray(n))return[];const i=[];for(const o of n){if(!o||typeof o!="object"||o.agentId!==t&&o.agentId!=="management")continue;const a=o.match;if(!a||typeof a!="object"||(a.channel??"").toLowerCase()!=="whatsapp")continue;const d=a.peer;if(!d||typeof d!="object"||d.kind!=="dm")continue;const c=d.id??"";c&&i.push({phone:c,paired:((s=o.meta)==null?void 0:s.paired)===!0})}return i.sort((o,a)=>o.paired&&!a.paired?-1:!o.paired&&a.paired?1:0),i}function Eu(e,t,n="admin",i){const s=c=>c===n||c==="management",o=new Map,a=new Map;for(const c of e){if(!c||typeof c!="object"||!s(c.agentId))continue;const l=c.match;if(!l||typeof l!="object"||(l.channel??"").toLowerCase()!=="whatsapp")continue;const h=l.peer;if(!h||typeof h!="object"||h.kind!=="dm")continue;const v=h.id??"";v&&(c.meta&&o.set(v,c.meta),l.accountId&&a.set(v,l.accountId))}const r=e.filter(c=>{if(!c||typeof c!="object"||!s(c.agentId))return!0;const l=c.match;if(!l||typeof l!="object"||(l.channel??"").toLowerCase()!=="whatsapp")return!0;const h=l.peer;return!h||typeof h!="object"?!0:h.kind!=="dm"}),d=t.map(c=>{const l=i??a.get(c.phone),p={channel:"whatsapp",peer:{kind:"dm",id:c.phone}};l&&(p.accountId=l);const h={agentId:n,match:p},v=o.get(c.phone);return v?h.meta=v:c.paired&&(h.meta={paired:!0}),h});return[...r,...d]}async function is(e,t){if(!e.client||!e.connected)return;if(!t){e.adminPhones=[];return}if(e.adminsLoading)return;e.adminsLoading=!0,e.adminsError=null;const n=t;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.config;e.configForm=st(s??{}),e.adminPhones=rk(s,n),e.configFormDirty=!1}catch(i){e.adminsError=String(i)}finally{e.adminsLoading=!1}}async function Tu(e,t,n,i){var a,r;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n;let o=t.replace(/[\s\-\(\)]/g,"");if(!o){e.adminsError="Phone number is required";return}if(o.startsWith("+")||(o="+"+o),!/^\+[1-9]\d{6,14}$/.test(o)){e.adminsError="Invalid phone number. Use international format (e.g., +44 7504 472444)";return}if(e.adminPhones.some(d=>d.phone===o)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const d=st(e.configForm??((a=e.configSnapshot)==null?void 0:a.config)??{}),c=d.bindings??[],l=[...e.adminPhones,{phone:o}],p=Eu(c,l,s,i);dc(d,["bindings"],p);const h=(r=e.configSnapshot)==null?void 0:r.hash;if(!h){e.adminsError="Config hash missing; reload and retry.";return}const v=St(d);await e.client.request("config.set",{raw:v,baseHash:h}),await is(e,n)}catch(d){e.adminsError=String(d)}finally{e.adminsSaving=!1}}async function _u(e,t,n,i){var a,r;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n,o=e.adminPhones.find(d=>d.phone===t);if(o!=null&&o.paired){e.adminsError="Cannot remove the paired phone. Unlink WhatsApp first.";return}e.adminsSaving=!0,e.adminsError=null;try{const d=st(e.configForm??((a=e.configSnapshot)==null?void 0:a.config)??{}),c=d.bindings??[],l=e.adminPhones.filter(S=>S.phone!==t),p=Eu(c,l,s,i);dc(d,["bindings"],p);const h=(r=e.configSnapshot)==null?void 0:r.hash;if(!h){e.adminsError="Config hash missing; reload and retry.";return}const v=St(d);await e.client.request("config.set",{raw:v,baseHash:h}),await is(e,n)}catch(d){e.adminsError=String(d)}finally{e.adminsSaving=!1}}const lk=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:Tu,loadAdmins:is,removeAdmin:_u},Symbol.toStringTag,{value:"Module"}));async function _t(e,t){if(!(!e.client||!e.connected)){if(!t){e.contactsRecords=[];return}if(!e.contactsLoading){e.contactsLoading=!0,e.contactsError=null;try{const n=e.contactsSearchQuery.trim(),i=n?await e.client.request("records.search",{query:n,workspace:t}):await e.client.request("records.list",{workspace:t});e.contactsRecords=i.records??[]}catch(n){e.contactsError=String(n)}finally{e.contactsLoading=!1}}}}async function Mu(e,t,n,i){if(!e.client||!e.connected||e.contactsSaving)return;let s=t.replace(/[\s\-\(\)]/g,"");const o=n.trim();if(!s){e.contactsError="Phone number is required";return}if(!o){e.contactsError="Name is required";return}if(s.startsWith("+")||(s="+"+s),!/^\+[1-9]\d{6,14}$/.test(s)){e.contactsError="Invalid phone number. Use international format (e.g., +44 7490 553305)";return}e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.set",{id:s,name:o,fields:{},workspace:i}),e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName="",await _t(e,i)}catch(a){e.contactsError=String(a)}finally{e.contactsSaving=!1}}async function Pu(e,t,n){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.delete",{id:t}),e.contactsEditingId===t&&(e.contactsEditingId=null),await _t(e,n)}catch(i){e.contactsError=String(i)}finally{e.contactsSaving=!1}}}async function Mo(e,t,n,i,s){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.setField",{id:t,key:n,value:i}),await _t(e,s)}catch(o){e.contactsError=String(o)}finally{e.contactsSaving=!1}}}async function Lu(e,t,n,i){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.deleteField",{id:t,key:n}),await _t(e,i)}catch(s){e.contactsError=String(s)}finally{e.contactsSaving=!1}}}const ck=Object.freeze(Object.defineProperty({__proto__:null,addContact:Mu,deleteContact:Pu,deleteContactField:Lu,loadContacts:_t,setContactField:Mo},Symbol.toStringTag,{value:"Module"}));function yn(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout(),auditCount:e.auditEntries.length,onAuditClick:()=>{e.auditModalOpen=!0}}}function dk(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),onAddAccount:()=>{e.addingWorkspace=!0},hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout(),auditCount:e.auditEntries.length,onAuditClick:()=>{e.auditModalOpen=!0}}}function uk(e){const t=le(e);if(!t)return;const n=t.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return n==null?void 0:n.id}function pk(e){const t=le(e);return(t==null?void 0:t.whatsappAccountId)??void 0}function hk(e){var i;const t=le(e);if(!t)return;const n=t.agents.find(s=>s.id.endsWith("-admin")||s.id==="admin");return(n==null?void 0:n.id)??((i=t.agents[0])==null?void 0:i.id)}function fk(e){return e.selectedWorkspace??void 0}function le(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const gk=/^data:/i,mk=/^https?:\/\//i;function Nl(e){var r,d;const t=((r=e.agentsList)==null?void 0:r.agents)??[],n=Xl(e.sessionKey),i=(n==null?void 0:n.agentId)??((d=e.agentsList)==null?void 0:d.defaultId)??"main",s=t.find(c=>c.id===i),o=s==null?void 0:s.identity,a=(o==null?void 0:o.avatarUrl)??(o==null?void 0:o.avatar);if(a)return gk.test(a)||mk.test(a)?a:o==null?void 0:o.avatarUrl}function yk(e){var i;if(!e)return null;const t=(i=e.channelAccounts)==null?void 0:i.whatsapp;if(!t||t.length===0)return null;const n=t[0];return{running:n.running??!1,connected:n.connected??!1,linked:n.linked??!1,lastError:n.lastError}}function vk(e){var a;if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=(a=e.channelAccounts)==null?void 0:a.imessage;if(!t||t.length===0)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const n=t[0],i=n.running??!1,s=n.probe,o=s!=null?s.ok===!0:i;return{configured:n.configured??!1,running:i,connected:o,lastError:n.lastError??null,selfChatMode:n.mode==="self-chat"||!!n.selfChatMode,dmPolicy:n.dmPolicy??null,cliPath:n.cliPath??null}}function bk(e){var a;const t=(a=e.configSnapshot)==null?void 0:a.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const i=n.find(r=>{var d,c;return((d=r.match)==null?void 0:d.channel)==="imessage"&&((c=r.meta)==null?void 0:c.imessageOwner)});if(!i)return null;const s=i.agentId;for(const r of e.workspaces)if(r.agents.some(d=>d.id===s))return r.name;if(s==="admin"||s==="public"){const r=e.workspaces.find(d=>d.isDefault);return(r==null?void 0:r.name)??null}const o=s.replace(/-(admin|public)$/,"");if(o!==s){const r=e.workspaces.find(d=>d.name===o);return(r==null?void 0:r.name)??null}return null}function wk(e){var t,n,i,s,o,a,r,d,c;if(e.embeddingDownloading&&!e.publicChat)return u`
|
|
4171
|
+
`}const Er="taskmaster-access-session",Au={checked:!1,hasPins:!1,hasMasterPin:!1,authenticated:!1,workspace:null,master:!1,accounts:[],error:null,busy:!1};function Eu(){try{return localStorage.getItem(Er)}catch{return null}}function Cu(e){try{localStorage.setItem(Er,e)}catch{}}function rk(){try{localStorage.removeItem(Er)}catch{}}async function Nl(e){if(e.client)try{const t=Eu(),n=await e.client.request("access.status",{token:t});e.accessState={...e.accessState,checked:!0,hasPins:n.hasPins,hasMasterPin:n.hasMasterPin,accounts:n.accounts??[],authenticated:n.authenticated,workspace:n.workspace,master:n.master,error:null}}catch{e.accessState={...e.accessState,checked:!0,hasPins:!1,hasMasterPin:!1,accounts:[],authenticated:!0,error:null}}}async function ak(e,t,n){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const i=await e.client.request("access.verify",{account:t,pin:n});i.ok&&i.token?(Cu(i.token),e.accessState={...e.accessState,authenticated:!0,workspace:i.workspace??null,master:i.master??!1,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:i.message??"Incorrect PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to verify PIN"}}}}async function lk(e,t){if(e.client){e.accessState={...e.accessState,busy:!0,error:null};try{const n=await e.client.request("access.setMasterPin",{pin:t});n.ok&&n.token?(Cu(n.token),e.accessState={...e.accessState,checked:!0,hasPins:!0,hasMasterPin:!0,authenticated:!0,workspace:null,master:!0,busy:!1,error:null}):e.accessState={...e.accessState,busy:!1,error:"Failed to set PIN"}}catch{e.accessState={...e.accessState,busy:!1,error:"Failed to set PIN"}}}}async function ck(e,t,n){if(!e.client)return!1;try{return(await e.client.request("access.setAccountPin",{workspace:t,pin:n})).ok}catch{return!1}}async function dk(e){const t=Eu();if(e.client&&t)try{await e.client.request("access.logout",{token:t})}catch{}rk(),e.accessState={...Au,checked:!0,hasPins:!0,hasMasterPin:e.accessState.hasMasterPin,accounts:e.accessState.accounts}}function uk(e,t="admin"){var s;if(!e)return[];const n=e.bindings;if(!Array.isArray(n))return[];const i=[];for(const o of n){if(!o||typeof o!="object"||o.agentId!==t&&o.agentId!=="management")continue;const r=o.match;if(!r||typeof r!="object"||(r.channel??"").toLowerCase()!=="whatsapp")continue;const d=r.peer;if(!d||typeof d!="object"||d.kind!=="dm")continue;const c=d.id??"";c&&i.push({phone:c,paired:((s=o.meta)==null?void 0:s.paired)===!0})}return i.sort((o,r)=>o.paired&&!r.paired?-1:!o.paired&&r.paired?1:0),i}function Tu(e,t,n="admin",i){const s=c=>c===n||c==="management",o=new Map,r=new Map;for(const c of e){if(!c||typeof c!="object"||!s(c.agentId))continue;const l=c.match;if(!l||typeof l!="object"||(l.channel??"").toLowerCase()!=="whatsapp")continue;const f=l.peer;if(!f||typeof f!="object"||f.kind!=="dm")continue;const v=f.id??"";v&&(c.meta&&o.set(v,c.meta),l.accountId&&r.set(v,l.accountId))}const a=e.filter(c=>{if(!c||typeof c!="object"||!s(c.agentId))return!0;const l=c.match;if(!l||typeof l!="object"||(l.channel??"").toLowerCase()!=="whatsapp")return!0;const f=l.peer;return!f||typeof f!="object"?!0:f.kind!=="dm"}),d=t.map(c=>{const l=i??r.get(c.phone),p={channel:"whatsapp",peer:{kind:"dm",id:c.phone}};l&&(p.accountId=l);const f={agentId:n,match:p},v=o.get(c.phone);return v?f.meta=v:c.paired&&(f.meta={paired:!0}),f});return[...a,...d]}async function is(e,t){if(!e.client||!e.connected)return;if(!t){e.adminPhones=[];return}if(e.adminsLoading)return;e.adminsLoading=!0,e.adminsError=null;const n=t;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const s=i.config;e.configForm=st(s??{}),e.adminPhones=uk(s,n),e.configFormDirty=!1}catch(i){e.adminsError=String(i)}finally{e.adminsLoading=!1}}async function _u(e,t,n,i){var r,a;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n;let o=t.replace(/[\s\-\(\)]/g,"");if(!o){e.adminsError="Phone number is required";return}if(o.startsWith("+")||(o="+"+o),!/^\+[1-9]\d{6,14}$/.test(o)){e.adminsError="Invalid phone number. Use international format (e.g., +44 7504 472444)";return}if(e.adminPhones.some(d=>d.phone===o)){e.adminsError="Phone number already exists";return}e.adminsSaving=!0,e.adminsError=null;try{const d=st(e.configForm??((r=e.configSnapshot)==null?void 0:r.config)??{}),c=d.bindings??[],l=[...e.adminPhones,{phone:o}],p=Tu(c,l,s,i);dc(d,["bindings"],p);const f=(a=e.configSnapshot)==null?void 0:a.hash;if(!f){e.adminsError="Config hash missing; reload and retry.";return}const v=St(d);await e.client.request("config.set",{raw:v,baseHash:f}),await is(e,n)}catch(d){e.adminsError=String(d)}finally{e.adminsSaving=!1}}async function Mu(e,t,n,i){var r,a;if(!e.client||!e.connected)return;if(!n){e.adminsError="No business selected.";return}if(e.adminsSaving)return;const s=n,o=e.adminPhones.find(d=>d.phone===t);if(o!=null&&o.paired){e.adminsError="Cannot remove the paired phone. Unlink WhatsApp first.";return}e.adminsSaving=!0,e.adminsError=null;try{const d=st(e.configForm??((r=e.configSnapshot)==null?void 0:r.config)??{}),c=d.bindings??[],l=e.adminPhones.filter(S=>S.phone!==t),p=Tu(c,l,s,i);dc(d,["bindings"],p);const f=(a=e.configSnapshot)==null?void 0:a.hash;if(!f){e.adminsError="Config hash missing; reload and retry.";return}const v=St(d);await e.client.request("config.set",{raw:v,baseHash:f}),await is(e,n)}catch(d){e.adminsError=String(d)}finally{e.adminsSaving=!1}}const pk=Object.freeze(Object.defineProperty({__proto__:null,addAdmin:_u,loadAdmins:is,removeAdmin:Mu},Symbol.toStringTag,{value:"Module"}));async function _t(e,t){if(!(!e.client||!e.connected)){if(!t){e.contactsRecords=[];return}if(!e.contactsLoading){e.contactsLoading=!0,e.contactsError=null;try{const n=e.contactsSearchQuery.trim(),i=n?await e.client.request("records.search",{query:n,workspace:t}):await e.client.request("records.list",{workspace:t});e.contactsRecords=i.records??[]}catch(n){e.contactsError=String(n)}finally{e.contactsLoading=!1}}}}async function Pu(e,t,n,i){if(!e.client||!e.connected||e.contactsSaving)return;let s=t.replace(/[\s\-\(\)]/g,"");const o=n.trim();if(!s){e.contactsError="Phone number is required";return}if(!o){e.contactsError="Name is required";return}if(s.startsWith("+")||(s="+"+s),!/^\+[1-9]\d{6,14}$/.test(s)){e.contactsError="Invalid phone number. Use international format (e.g., +44 7490 553305)";return}e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.set",{id:s,name:o,fields:{},workspace:i}),e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName="",await _t(e,i)}catch(r){e.contactsError=String(r)}finally{e.contactsSaving=!1}}async function Lu(e,t,n){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.delete",{id:t}),e.contactsEditingId===t&&(e.contactsEditingId=null),await _t(e,n)}catch(i){e.contactsError=String(i)}finally{e.contactsSaving=!1}}}async function Mo(e,t,n,i,s){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.setField",{id:t,key:n,value:i}),await _t(e,s)}catch(o){e.contactsError=String(o)}finally{e.contactsSaving=!1}}}async function Iu(e,t,n,i){if(!(!e.client||!e.connected)&&!e.contactsSaving){e.contactsSaving=!0,e.contactsError=null;try{await e.client.request("records.deleteField",{id:t,key:n}),await _t(e,i)}catch(s){e.contactsError=String(s)}finally{e.contactsSaving=!1}}}const hk=Object.freeze(Object.defineProperty({__proto__:null,addContact:Pu,deleteContact:Lu,deleteContactField:Iu,loadContacts:_t,setContactField:Mo},Symbol.toStringTag,{value:"Module"}));function yn(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout(),auditCount:e.auditEntries.length,onAuditClick:()=>{e.auditModalOpen=!0}}}function fk(e){if(e.workspaces.length!==0)return{workspaces:e.workspaces,selectedWorkspace:e.selectedWorkspace,onWorkspaceSelect:t=>e.handleWorkspaceSelect(t),onAddAccount:()=>{e.addingWorkspace=!0},hasPins:e.accessState.hasPins,isMaster:e.accessState.master,onLogout:()=>e.handleLogout(),auditCount:e.auditEntries.length,onAuditClick:()=>{e.auditModalOpen=!0}}}function gk(e){const t=le(e);if(!t)return;const n=t.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return n==null?void 0:n.id}function mk(e){const t=le(e);return(t==null?void 0:t.whatsappAccountId)??void 0}function yk(e){var i;const t=le(e);if(!t)return;const n=t.agents.find(s=>s.id.endsWith("-admin")||s.id==="admin");return(n==null?void 0:n.id)??((i=t.agents[0])==null?void 0:i.id)}function vk(e){return e.selectedWorkspace??void 0}function le(e){return e.selectedWorkspace?e.workspaces.find(t=>t.name===e.selectedWorkspace)??null:null}const bk=/^data:/i,wk=/^https?:\/\//i;function Bl(e){var a,d;const t=((a=e.agentsList)==null?void 0:a.agents)??[],n=Xl(e.sessionKey),i=(n==null?void 0:n.agentId)??((d=e.agentsList)==null?void 0:d.defaultId)??"main",s=t.find(c=>c.id===i),o=s==null?void 0:s.identity,r=(o==null?void 0:o.avatarUrl)??(o==null?void 0:o.avatar);if(r)return bk.test(r)||wk.test(r)?r:o==null?void 0:o.avatarUrl}function kk(e){var i;if(!e)return null;const t=(i=e.channelAccounts)==null?void 0:i.whatsapp;if(!t||t.length===0)return null;const n=t[0];return{running:n.running??!1,connected:n.connected??!1,linked:n.linked??!1,lastError:n.lastError}}function $k(e){var r;if(!e)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const t=(r=e.channelAccounts)==null?void 0:r.imessage;if(!t||t.length===0)return{configured:!1,running:!1,connected:!1,lastError:null,selfChatMode:!1,dmPolicy:null,cliPath:null};const n=t[0],i=n.running??!1,s=n.probe,o=s!=null?s.ok===!0:i;return{configured:n.configured??!1,running:i,connected:o,lastError:n.lastError??null,selfChatMode:n.mode==="self-chat"||!!n.selfChatMode,dmPolicy:n.dmPolicy??null,cliPath:n.cliPath??null}}function Sk(e){var r;const t=(r=e.configSnapshot)==null?void 0:r.config;if(!t)return null;const n=t.bindings;if(!Array.isArray(n))return null;const i=n.find(a=>{var d,c;return((d=a.match)==null?void 0:d.channel)==="imessage"&&((c=a.meta)==null?void 0:c.imessageOwner)});if(!i)return null;const s=i.agentId;for(const a of e.workspaces)if(a.agents.some(d=>d.id===s))return a.name;if(s==="admin"||s==="public"){const a=e.workspaces.find(d=>d.isDefault);return(a==null?void 0:a.name)??null}const o=s.replace(/-(admin|public)$/,"");if(o!==s){const a=e.workspaces.find(d=>d.name===o);return(a==null?void 0:a.name)??null}return null}function xk(e){var t,n,i,s,o,r,a,d,c;if(e.embeddingDownloading&&!e.publicChat)return u`
|
|
4057
4172
|
<div class="setup-container">
|
|
4058
4173
|
<div class="setup-card" style="text-align:center; max-width:420px;">
|
|
4059
4174
|
<div class="setup-spinner"></div>
|
|
@@ -4067,14 +4182,14 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4067
4182
|
</p>
|
|
4068
4183
|
</div>
|
|
4069
4184
|
</div>
|
|
4070
|
-
`;if(e.publicChat)return e.connected?e.publicChatAuthenticated?
|
|
4185
|
+
`;if(e.publicChat)return e.connected?e.publicChatAuthenticated?kw({connected:e.connected,sessionKey:e.sessionKey,loading:e.chatLoading,sending:e.chatSending,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,assistantAvatarUrl:e.chatAvatarUrl??Bl(e)??null,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,canAbort:!!e.chatRunId,disabledReason:e.connected?null:"Disconnected.",error:e.lastError,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,suggestion:e.chatSuggestion,onSuggestionClick:l=>{e.chatMessage=l,e.chatSuggestion=null,e.handleSendChat()},onRefresh:()=>(e.resetToolStream(),re(async()=>{const{loadChatHistory:l}=await Promise.resolve().then(()=>Ei);return{loadChatHistory:l}},void 0,import.meta.url).then(({loadChatHistory:l})=>{l(e)})),onDraftChange:l=>{var f;e.chatMessage=l;const p=((f=e.publicChatConfig)==null?void 0:f.accountId)??"";sa(p,e.sessionKey,l)},requestUpdate:()=>e.requestUpdate(),attachments:e.chatAttachments,onAttachmentsChange:l=>e.chatAttachments=l,onSend:()=>e.handleSendChat(),onAbort:()=>{e.handleAbortChat()},onQueueRemove:l=>e.removeQueuedMessage(l),onChatScroll:l=>e.handleChatScroll(l),nearBottom:e.chatUserNearBottom,hasMore:e.chatHistoryHasMore,loadingOlder:e.chatLoadingOlder,onLoadOlder:()=>{e.handleLoadOlderChat()}}):ok({authMode:e.publicChatConfig.auth??"anonymous",authStep:e.publicChatAuthStep,connected:e.connected,client:e.client,assistantName:e.assistantName,assistantAvatar:e.assistantAvatar,accountId:e.publicChatConfig.accountId,cookieTtlDays:e.publicChatConfig.cookieTtlDays,onAuthenticated:l=>{var f;e.publicChatSessionKey=l,e.sessionKey=l,e.publicChatAuthenticated=!0,e.publicChatAuthStep="ready";const p=((f=e.publicChatConfig)==null?void 0:f.accountId)??"";e.chatMessage=Rn(p,l),re(async()=>{const{loadChatHistory:v}=await Promise.resolve().then(()=>Ei);return{loadChatHistory:v}},void 0,import.meta.url).then(({loadChatHistory:v})=>{v(e)})},onAuthStepChange:l=>{e.publicChatAuthStep=l},requestUpdate:()=>{e.requestUpdate()}}):u`
|
|
4071
4186
|
<div class="setup-container">
|
|
4072
4187
|
<div class="setup-card">
|
|
4073
4188
|
<div class="setup-spinner"></div>
|
|
4074
4189
|
<p>Connecting...</p>
|
|
4075
4190
|
</div>
|
|
4076
4191
|
</div>
|
|
4077
|
-
`;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return Cl({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(p,h)=>{h!=null&&e.handlePinSubmit(p,h)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(p,h,v)=>e.handleChangePin(p,h,v)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return Cl({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:p=>e.handleSetMasterPin(p)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",k}if(e.setup){const l=yk(e.channelsSnapshot),p=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],h=vk(e.channelsSnapshot),v=bk(e),S=async()=>{e.tailscaleStatus=await e.client.request("tailscale.status")};return Sg({connected:e.connected,serverPlatform:((s=(i=e.hello)==null?void 0:i.server)==null?void 0:s.platform)??null,assistantName:e.assistantName,currentStep:e.setupStep,licenseKey:e.licenseKey,licenseBusy:e.licenseBusy,licenseValid:e.licenseValid,licenseMessage:e.licenseMessage,licenseTier:e.licenseTier,licenseDeviceId:e.licenseDeviceId,licenseStoredKey:e.licenseStoredKey,onLicenseKeyChange:f=>e.handleLicenseKeyChange(f),onLicenseActivate:()=>e.handleLicenseActivate(),onLicenseRemove:async()=>{await e.handleLicenseRemove(),e.licenseRemoveConfirm=!1},licenseRemoveConfirm:e.licenseRemoveConfirm,onLicenseRemoveConfirm:()=>{e.licenseRemoveConfirm=!0},onLicenseRemoveCancel:()=>{e.licenseRemoveConfirm=!1},authConnected:e.authConnected,authBusy:e.authBusy,authMessage:e.authMessage,authUrl:e.authUrl,authCodeInput:e.authCodeInput,authExpiresIn:e.authExpiresIn,whatsappBusy:e.whatsappBusy,whatsappLoginMessage:e.whatsappLoginMessage,whatsappLoginQrDataUrl:e.whatsappLoginQrDataUrl,whatsappLoginConnected:e.whatsappLoginConnected,whatsappChannelStatus:l,whatsappAccounts:p,whatsappActiveQrAccountId:e.whatsappActiveQrAccountId,whatsappAccountSaving:e.whatsappAccountSaving,gatewayHealthy:e.gatewayHealthy,gatewayHealthLoading:e.gatewayHealthLoading,gatewayHealthMessage:e.gatewayHealthMessage,gatewayRestartBusy:e.gatewayRestartBusy,updateAvailable:e.updateAvailable,currentVersion:e.currentVersion,latestVersion:e.latestVersion,updateChecking:e.updateChecking,updateRunning:e.updateRunning,updateMessage:e.updateMessage,updateProgressSteps:e.updateProgressSteps,updateLastResult:e.updateLastResult,onUpdateCheck:()=>e.handleUpdateCheck(),onUpdateRun:()=>e.handleUpdateRun(),onUpdateDismissResult:()=>e.handleUpdateDismissResult(),uninstallConfirm:e.uninstallConfirm,uninstallBusy:e.uninstallBusy,uninstallDone:e.uninstallDone,uninstallError:e.uninstallError,uninstallConfirmText:e.uninstallConfirmText,onUninstallConfirm:()=>e.handleUninstallConfirm(),onUninstallCancel:()=>e.handleUninstallCancel(),onUninstallConfirmTextChange:f=>e.handleUninstallConfirmTextChange(f),onUninstallRun:()=>e.handleUninstallRun(),onUninstallDismiss:()=>e.handleUninstallDismiss(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:f=>e.handleAuthSubmitCode(f),onAuthCodeChange:f=>e.handleAuthCodeChange(f),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async f=>{await e.handleWhatsAppStart(!0,f),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(f),await J(e,!0),e.requestUpdate())},onWhatsAppUnlink:async f=>{await e.handleWhatsAppLogout(f)},onWhatsAppReset:async f=>{await e.handleWhatsAppLogout(f),await e.handleWhatsAppStart(!0,f),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(f),await J(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await J(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),J(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:f=>e.handleRemoveWhatsAppAccount(f),workspaces:e.workspaces,workspacesLoading:e.workspacesLoading,workspacesError:e.workspacesError,addingWorkspace:e.addingWorkspace,newWorkspaceName:e.newWorkspaceName,newWorkspacePath:e.newWorkspacePath,workspaceSaving:e.workspaceSaving,workspaceRemoveConfirm:e.workspaceRemoveConfirm,newWorkspacePin:e.newWorkspacePin,onSetNewWorkspacePin:f=>{e.newWorkspacePin=f},onWorkspaceCreate:async(f,w)=>{const b=e.newWorkspacePin;await e.handleWorkspaceCreate(f,w),b.match(/^\d{4,6}$/)&&(await ok(e,f,b),e.newWorkspacePin="")},onWorkspaceRemove:f=>e.handleWorkspaceRemove(f),onSetAddingWorkspace:f=>{e.addingWorkspace=f},onSetNewWorkspaceName:f=>{e.newWorkspaceName=f},onSetNewWorkspacePath:f=>{e.newWorkspacePath=f},onSetWorkspaceRemoveConfirm:f=>{e.workspaceRemoveConfirm=f},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(f,w)=>e.handleWorkspaceRename(f,w),whatsappDmPolicy:(()=>{const f=le(e),w=f==null?void 0:f.whatsappAccountId,b=w?p.find(x=>x.accountId===w):p[0];return(b==null?void 0:b.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var P;const f=le(e),w=f==null?void 0:f.whatsappAccountId,b=w?p.find(_=>_.accountId===w):p[0];if(!b)return;const C=b.dmPolicy!=null&&b.dmPolicy!=="disabled"?"disabled":"open",T=C==="open"?{dmPolicy:C,allowFrom:["*"]}:{dmPolicy:C};try{const _=await e.client.request("config.get"),N=_.config,H=(P=N==null?void 0:N.channels)==null?void 0:P.whatsapp,be=((H==null?void 0:H.accounts)??{})[b.accountId]?{channels:{whatsapp:{accounts:{[b.accountId]:T}}}}:{channels:{whatsapp:T}};await e.client.request("config.patch",{raw:JSON.stringify(be),baseHash:_.hash,note:`WhatsApp DM policy → ${C}`,skipRestart:!0}),await J(e,!1)}catch(_){console.error("DM toggle failed:",_)}},whatsappModel:(()=>{var P,_;const f=le(e);if(!f)return null;const w=f.agents.find(N=>N.id.endsWith("-public")||N.id==="public");if(!w)return null;const b=(P=e.configSnapshot)==null?void 0:P.config,x=(_=b==null?void 0:b.agents)==null?void 0:_.list;if(!Array.isArray(x))return null;const C=x.find(N=>N.id===w.id);if(!(C!=null&&C.model))return null;const T=typeof C.model=="string"?C.model:C.model.primary;return(T==null?void 0:T.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async f=>{const w=le(e);if(!w)return;const b=w.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(b)try{const x=await e.client.request("config.get"),C=x.config,T=(C==null?void 0:C.agents)??{},P=Array.isArray(T.list)?[...T.list]:[],_=P.findIndex(H=>H.id===b.id);if(f)_>=0?P[_]={...P[_],model:f}:P.push({id:b.id,model:f});else if(_>=0){const{model:H,...ie}=P[_];Object.keys(ie).length<=1?P.splice(_,1):P[_]=ie}const N=P.length>0?{agents:{list:P}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(N),baseHash:x.hash,note:`Public agent model → ${f||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Model change failed:",x)}},whatsappThinkingLevel:(()=>{var T,P,_;const f=le(e);if(!f)return null;const w=f.agents.find(N=>N.id.endsWith("-public")||N.id==="public");if(!w)return null;const b=(T=e.configSnapshot)==null?void 0:T.config,x=(P=b==null?void 0:b.agents)==null?void 0:P.list;if(!Array.isArray(x))return null;const C=x.find(N=>N.id===w.id);return((_=C==null?void 0:C.thinkingLevel)==null?void 0:_.trim())||null})(),onWhatsAppThinkingChange:async f=>{const w=le(e);if(!w)return;const b=w.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(b)try{const x=await e.client.request("config.get"),C=x.config,T=(C==null?void 0:C.agents)??{},P=Array.isArray(T.list)?[...T.list]:[],_=P.findIndex(ie=>ie.id===b.id),N=f==="off"?void 0:f;if(N)_>=0?P[_]={...P[_],thinkingLevel:N}:P.push({id:b.id,thinkingLevel:N});else if(_>=0){const{thinkingLevel:ie,...be}=P[_];Object.keys(be).length<=1?P.splice(_,1):P[_]=be}const H=P.length>0?{agents:{list:P}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(H),baseHash:x.hash,note:`Public agent thinking → ${N||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Thinking change failed:",x)}},whatsappGroupPolicy:(()=>{var _,N;const f=(_=e.configSnapshot)==null?void 0:_.config,w=(N=f==null?void 0:f.channels)==null?void 0:N.whatsapp,b=le(e),x=b==null?void 0:b.whatsappAccountId,C=(w==null?void 0:w.accounts)??{},T=x?C[x]:void 0;return(T==null?void 0:T.groupPolicy)??(w==null?void 0:w.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var N,H;const f=(N=e.configSnapshot)==null?void 0:N.config,w=(H=f==null?void 0:f.channels)==null?void 0:H.whatsapp,b=le(e),x=b==null?void 0:b.whatsappAccountId,C=(w==null?void 0:w.accounts)??{},T=x?C[x]:void 0,_=((T==null?void 0:T.groups)??(w==null?void 0:w.groups)??{})["*"];return(_==null?void 0:_.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var b;const f=le(e),w=f==null?void 0:f.whatsappAccountId;try{const x=await e.client.request("config.get"),C=x.config,T=((b=C==null?void 0:C.channels)==null?void 0:b.whatsapp)??{},P=T.accounts??{},_=w?P[w]:void 0,N=(_==null?void 0:_.groupPolicy)??T.groupPolicy??"allowlist",H=N==="disabled"||N==="allowlist",ie=H?"open":"disabled",be=H?{"*":{}}:void 0,X={groupPolicy:ie};be&&(X.groups=be);const rt=_?{channels:{whatsapp:{accounts:{[w]:X}}}}:{channels:{whatsapp:X}};await e.client.request("config.patch",{raw:JSON.stringify(rt),baseHash:x.hash,note:`WhatsApp groups → ${ie}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Group toggle failed:",x)}},onWhatsAppGroupMentionChange:async f=>{var x;const w=le(e),b=w==null?void 0:w.whatsappAccountId;try{const C=await e.client.request("config.get"),T=C.config,_=(((x=T==null?void 0:T.channels)==null?void 0:x.whatsapp)??{}).accounts??{},N=b?_[b]:void 0,H={"*":{requireMention:f}},ie=N?{channels:{whatsapp:{accounts:{[b]:{groups:H}}}}}:{channels:{whatsapp:{groups:H}}};await e.client.request("config.patch",{raw:JSON.stringify(ie),baseHash:C.hash,note:`WhatsApp group mention → ${f?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(C){console.error("Group mention change failed:",C)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:h.configured,imessageRunning:h.running,imessageConnected:h.connected,imessageLastError:h.lastError,imessageSelfChatMode:h.selfChatMode,imessageCliPath:h.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:v,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),w=f.config,b=(w==null?void 0:w.bindings)??[],x=le(e),C=x==null?void 0:x.agents.find(H=>H.id.endsWith("-admin")||H.id==="admin"),T=(C==null?void 0:C.id)??"admin",P=b.filter(H=>{var ie;return((ie=H.match)==null?void 0:ie.channel)!=="imessage"}),_=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],N=[...P,..._];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:N}),baseHash:f.hash,note:"Enable iMessage (self-chat) for "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([J(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await J(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),w=f.config,x=((w==null?void 0:w.bindings)??[]).filter(C=>{var T;return((T=C.match)==null?void 0:T.channel)!=="imessage"});await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:x}),baseHash:f.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([J(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),w=f.config,b=(w==null?void 0:w.bindings)??[],x=le(e),C=x==null?void 0:x.agents.find(N=>N.id.endsWith("-admin")||N.id==="admin"),T=(C==null?void 0:C.id)??"admin",P=b.filter(N=>{var H;return((H=N.match)==null?void 0:H.channel)!=="imessage"}),_=[{agentId:T,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:[...P,..._]}),baseHash:f.hash,note:"Reassign iMessage to "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([J(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:f=>{e.infoModalOpen=f},onInfoModalClose:()=>{e.infoModalOpen=null},isMaster:e.accessState.master,apiKeyProviders:e.apiKeyProviders,apiKeyModalOpen:e.apiKeyModalOpen,apiKeyBusy:e.apiKeyBusy,apiKeyError:e.apiKeyError,apiKeySuccess:e.apiKeySuccess,apiKeySavingProvider:e.apiKeySavingProvider,onApiKeyModalOpen:()=>{e.apiKeyModalOpen=!0,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeyModalClose:()=>{e.apiKeyModalOpen=!1,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeySave:async(f,w)=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await _l(e.client,f,w);const b=`${f} key saved`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}f==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===b&&(e.apiKeySuccess=null)},2500)}catch(b){e.apiKeyError=b instanceof Error?b.message:"Failed to save key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async f=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Fw(e.client,f);const w=`${f} key removed`;e.apiKeySuccess=w,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===w&&(e.apiKeySuccess=null)},2500)}catch(w){e.apiKeyError=w instanceof Error?w.message:"Failed to remove key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyDisable:async(f,w)=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Ow(e.client,f,w);const b=`${f} ${w?"disabled":"enabled"}`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===b&&(e.apiKeySuccess=null)},2500)}catch(b){e.apiKeyError=b instanceof Error?b.message:`Failed to ${w?"disable":"enable"} key`,e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},authApiKeyMode:e.authApiKeyMode,authApiKeyInput:e.authApiKeyInput,authApiKeyBusy:e.authApiKeyBusy,authApiKeyError:e.authApiKeyError,onAuthApiKeyToggle:()=>{e.authApiKeyMode=!e.authApiKeyMode,e.authApiKeyError=null},onAuthApiKeyChange:f=>{e.authApiKeyInput=f},onAuthApiKeySubmit:async()=>{const f=e.authApiKeyInput.trim();if(f){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await _l(e.client,"anthropic",f),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(w){e.authApiKeyError=w instanceof Error?w.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{var w;const f=e.selectedWorkspace??((w=e.workspaces[0])==null?void 0:w.name);return f?e.accessState.accounts.some(b=>b.id===f):!1})(),accountPinModalOpen:e.accountPinModalOpen,accountPinBusy:e.accountPinBusy,accountPinError:e.accountPinError,accountPinSuccess:e.accountPinSuccess,onAccountPinModalOpen:()=>{e.accountPinModalOpen=!0,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinModalClose:()=>{e.accountPinModalOpen=!1,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinSave:(f,w)=>{var x;const b=e.selectedWorkspace??((x=e.workspaces[0])==null?void 0:x.name);b&&e.handleAccountPinSave(b,f,w)},publicChatEnabled:(()=>{var b;const f=(b=e.configSnapshot)==null?void 0:b.config,w=f==null?void 0:f.publicChat;return(w==null?void 0:w.enabled)===!0})(),publicChatAuthMode:(()=>{var x;const f=(x=e.configSnapshot)==null?void 0:x.config,w=f==null?void 0:f.publicChat,b=w==null?void 0:w.auth;return b==="verified"||b==="choice"?b:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var f;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const w=await e.client.request("config.get"),b=w.config,x=((f=b==null?void 0:b.publicChat)==null?void 0:f.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!x}}),baseHash:w.hash,note:`Public chat → ${x?"disabled":"enabled"}`}),e.configSnapshot=await e.client.request("config.get")}catch(w){console.error("Public chat toggle failed:",w)}finally{e.publicChatToggleBusy=!1}}},onPublicChatAuthModeChange:async f=>{if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const w=await e.client.request("config.get");await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{auth:f}}),baseHash:w.hash,note:`Public chat auth → ${f}`}),e.configSnapshot=await e.client.request("config.get")}catch(w){console.error("Public chat auth mode change failed:",w)}finally{e.publicChatToggleBusy=!1}}},brandAccentColor:(()=>{var b;const f=e.selectedWorkspace;return f?((b=Re()[f])==null?void 0:b.accentColor)??"":""})(),brandBackgroundColor:(()=>{var b;const f=e.selectedWorkspace;return f?((b=Re()[f])==null?void 0:b.backgroundColor)??"":""})(),brandHasLogo:(()=>{var b;const f=e.selectedWorkspace;return f?!!((b=Re()[f])!=null&&b.logoUrl):!1})(),brandingBusy:e.brandingBusy,brandingExpanded:e.brandingExpanded,onBrandingToggle:()=>{e.brandingExpanded=!e.brandingExpanded},onBrandAccentColorChange:async f=>{var b;const w=e.selectedWorkspace;if(!(!w||e.brandingBusy)){e.brandingBusy=!0;try{const x=await e.client.request("config.get"),C=x.config,T=((b=C==null?void 0:C.workspaces)==null?void 0:b[w])??{},P=T.brand??{};await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[w]:{...T,brand:{...P,accentColor:f}}}}),baseHash:x.hash,note:`Brand accent → ${f}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");const _=Re();_[w]||(_[w]={}),_[w].accentColor=f,kn(w)}catch(x){console.error("Brand accent change failed:",x)}finally{e.brandingBusy=!1}}},onBrandBackgroundColorChange:async f=>{var b;const w=e.selectedWorkspace;if(!(!w||e.brandingBusy)){e.brandingBusy=!0;try{const x=await e.client.request("config.get"),C=x.config,T=((b=C==null?void 0:C.workspaces)==null?void 0:b[w])??{},P=T.brand??{};await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[w]:{...T,brand:{...P,backgroundColor:f}}}}),baseHash:x.hash,note:`Brand background → ${f}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");const _=Re();_[w]||(_[w]={}),_[w].backgroundColor=f,kn(w)}catch(x){console.error("Brand background change failed:",x)}finally{e.brandingBusy=!1}}},onBrandLogoUpload:async f=>{const w=e.selectedWorkspace;if(!(!w||e.brandingBusy)){e.brandingBusy=!0;try{const b=await f.arrayBuffer(),x=new Uint8Array(b);let C="";for(let _=0;_<x.length;_++)C+=String.fromCharCode(x[_]);const T=btoa(C);await e.client.request("brand.uploadLogo",{workspace:w,data:T,mimeType:f.type});const P=Re();P[w]||(P[w]={}),P[w].logoUrl=`/brand-logo/${encodeURIComponent(w)}`}catch(b){console.error("Brand logo upload failed:",b)}finally{e.brandingBusy=!1}}},onBrandLogoRemove:async()=>{const f=e.selectedWorkspace;if(!(!f||e.brandingBusy)){e.brandingBusy=!0;try{await e.client.request("brand.removeLogo",{workspace:f});const w=Re();w[f]&&delete w[f].logoUrl}catch(w){console.error("Brand logo remove failed:",w)}finally{e.brandingBusy=!1}}},onBrandReset:async()=>{var w;const f=e.selectedWorkspace;if(!(!f||e.brandingBusy)){e.brandingBusy=!0;try{const b=await e.client.request("config.get"),x=b.config,C=((w=x==null?void 0:x.workspaces)==null?void 0:w[f])??{},{brand:T,...P}=C;await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[f]:{...P,brand:null}}}),baseHash:b.hash,note:"Brand reset to defaults",skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");try{await e.client.request("brand.removeLogo",{workspace:f})}catch{}const _=Re();delete _[f],kn(f)}catch(b){console.error("Brand reset failed:",b)}finally{e.brandingBusy=!1}}},tailscaleStatus:e.tailscaleStatus,tailscaleBusy:e.tailscaleBusy,tailscaleAuthUrl:e.tailscaleAuthUrl,tailscaleError:e.tailscaleError,tailscaleFunnelEnableUrl:e.tailscaleFunnelEnableUrl,tailscaleDisableConfirm:e.tailscaleDisableConfirm,onTailscaleEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleAuthUrl=null;try{const f=await e.client.request("tailscale.enable");if(f.authUrl){e.tailscaleAuthUrl=f.authUrl;const w=setInterval(async()=>{try{const b=await e.client.request("tailscale.status");e.tailscaleStatus=b,b.loggedIn&&(clearInterval(w),e.tailscaleAuthUrl=null,e.tailscaleBusy=!1)}catch{}},3e3);setTimeout(()=>{clearInterval(w),e.tailscaleBusy&&(e.tailscaleBusy=!1)},3e5)}else f.alreadyLoggedIn&&(e.tailscaleStatus=await e.client.request("tailscale.status")),e.tailscaleBusy=!1}catch(f){console.error("Tailscale enable failed:",f),e.tailscaleBusy=!1}}},onTailscaleServeEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null;try{await e.client.request("tailscale.serve.enable"),await S()}catch(f){console.error("Tailscale serve enable failed:",f),e.tailscaleError=f.message||"Failed to enable Remote Access"}finally{e.tailscaleBusy=!1}}},onTailscaleServeDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.serve.disable"),await S()}catch(f){console.error("Tailscale serve disable failed:",f)}finally{e.tailscaleBusy=!1}}},onTailscaleFunnelEnable:async()=>{var f;if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null,e.tailscaleFunnelEnableUrl=null;try{await e.client.request("tailscale.funnel.enable"),await S()}catch(w){console.error("Tailscale funnel enable failed:",w);const b=w;(f=b.payload)!=null&&f.enableUrl&&(e.tailscaleFunnelEnableUrl=b.payload.enableUrl),e.tailscaleError=b.message||"Failed to enable Funnel"}finally{e.tailscaleBusy=!1}}},onTailscaleFunnelDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.funnel.disable"),await S()}catch(f){console.error("Tailscale funnel disable failed:",f)}finally{e.tailscaleBusy=!1}}},onTailscaleDisableConfirmToggle:()=>{e.tailscaleDisableConfirm=!e.tailscaleDisableConfirm},wifiStatus:e.wifiStatus,wifiNetworks:e.wifiNetworks,wifiBusy:e.wifiBusy,wifiError:e.wifiError,wifiPassword:e.wifiPassword,wifiSelectedSsid:e.wifiSelectedSsid,onWifiScan:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{const[f,w]=await Promise.all([e.client.request("wifi.scan"),e.client.request("wifi.status")]);e.wifiNetworks=f.networks,e.wifiStatus=w}catch(f){console.error("WiFi scan failed:",f),e.wifiError=f.message||"Failed to scan networks"}finally{e.wifiBusy=!1}}},onWifiConnect:async()=>{if(e.wifiBusy||!e.wifiSelectedSsid)return;const f=e.wifiSelectedSsid;e.wifiBusy=!0,e.wifiError=null;try{const w=await e.client.request("wifi.connect",{ssid:f,password:e.wifiPassword});e.wifiPassword="",e.wifiSelectedSsid=null,e.wifiNetworks=[],e.wifiStatus={available:!0,connected:w.connected,ssid:w.ssid,signal:null,ip:w.ip,savedSsid:w.ssid,autoconnect:!0},e.wifiBusy=!1;try{const b=await e.client.request("wifi.status");e.wifiStatus=b}catch{}}catch(w){console.error("WiFi connect failed:",w),e.wifiError=w.message||"Failed to connect",e.wifiBusy=!1}},onWifiDisconnect:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.disconnect"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi disconnect failed:",f),e.wifiError=f.message||"Failed to disconnect"}finally{e.wifiBusy=!1}}},onWifiForget:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.forget"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi forget failed:",f),e.wifiError=f.message||"Failed to forget network"}finally{e.wifiBusy=!1}}},onWifiDismiss:()=>{e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="",e.wifiError=null},onWifiSelectSsid:f=>{e.wifiSelectedSsid=f,e.wifiPassword="",e.wifiError=null},onWifiPasswordChange:f=>{e.wifiPassword=f},wsProps:dk(e)})}if(e.filesPage){const l=hk(e);return lg({connected:e.connected,wsProps:yn(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,currentDir:e.filesCurrentDir,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>Zt(e,l),onReindex:()=>xf(e,l),onSelectFile:p=>{e.filesPendingDeletePath=null,mf(e,p,l)},onToggleSelectFile:p=>yf(e,p,l),onToggleDir:p=>Af(e,p),onUpload:(p,h)=>wf(e,p,h,l),onNewFolder:(p,h)=>kf(e,p,h,l),onDownload:p=>od(e,p,l),onBulkDownload:()=>vf(e,l),onDelete:p=>{e.filesPendingDeletePath=null,$f(e,p,l)},pendingDeletePath:e.filesPendingDeletePath,onArmDelete:p=>{e.filesPendingDeletePath=p||null},onMoveToDir:(p,h)=>bf(e,p,h,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:p=>{const h=e.filesSearchAgentId??l;Cf(e,p,h)},onSearchAgentChange:p=>{e.filesSearchAgentId=p},onSearchClear:()=>{Ef(e)},onSearchQueryChange:p=>{e.filesSearchQuery=p}})}if(e.browserPage)return ng({connected:e.connected,active:e.browserScreencastActive,loading:e.browserLoading,error:e.browserError,inputMode:e.browserInputMode,fullscreen:e.browserFullscreen,handoffPending:e.browserHandoffPending,handoffReason:e.browserHandoffReason,onStart:()=>Mw(e),onStop:()=>Pw(e),onToggleInput:()=>Iw(e),onToggleFullscreen:()=>Rw(e),onCompleteHandoff:()=>Lw(e),onCanvasMouseDown:l=>{const h=l.target.getBoundingClientRect(),S=_n().translateCoordinates(l.clientX-h.left,l.clientY-h.top);Js(e,"mousePressed",S.x,S.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const h=l.target.getBoundingClientRect(),S=_n().translateCoordinates(l.clientX-h.left,l.clientY-h.top);Js(e,"mouseReleased",S.x,S.y)},onCanvasMouseMove:l=>{const p=_n();if(p.shouldThrottleMouseMove())return;const v=l.target.getBoundingClientRect(),S=p.translateCoordinates(l.clientX-v.left,l.clientY-v.top);Js(e,"mouseMoved",S.x,S.y)},onCanvasKeyDown:l=>{let p=0;l.altKey&&(p|=1),l.ctrlKey&&(p|=2),l.metaKey&&(p|=4),l.shiftKey&&(p|=8),Xs(e,"keyDown",l.key,{code:l.code,modifiers:p||void 0}),l.key.length===1&&Xs(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{Xs(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=uk(e),p=pk(e);return Ag({connected:e.connected,wsProps:yn(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>is(e,l),onAdd:h=>{Tu(e,h,l,p).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:h=>_u(e,h,l,p),onNewPhoneChange:h=>e.handleAdminsNewPhoneChange(h)})}if(e.contactsPage){const l=fk(e);return Pg({connected:e.connected,wsProps:yn(e),loading:e.contactsLoading,saving:e.contactsSaving,records:e.contactsRecords,error:e.contactsError,searchQuery:e.contactsSearchQuery,editingId:e.contactsEditingId,showAddForm:e.contactsShowAddForm,newRecordPhone:e.contactsNewPhone,newRecordName:e.contactsNewName,deleteConfirmId:e.contactsDeleteConfirmId,addFieldForId:e.contactsAddFieldForId,addFieldKey:e.contactsAddFieldKey,addFieldValue:e.contactsAddFieldValue,onSearch:p=>e.contactsSearchQuery=p,onSearchSubmit:()=>_t(e,l),onAdd:(p,h)=>Mu(e,p,h,l),onDelete:p=>Pu(e,p,l),onSetField:(p,h,v)=>Mo(e,p,h,v,l),onDeleteField:(p,h)=>Lu(e,p,h,l),onToggleExpand:p=>{e.contactsEditingId=e.contactsEditingId===p?null:p},onShowAddForm:()=>e.contactsShowAddForm=!0,onCancelAddForm:()=>{e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName=""},onNewRecordPhoneChange:p=>e.handleContactsNewPhoneChange(p),onNewRecordNameChange:p=>e.handleContactsNewNameChange(p),onRefresh:()=>_t(e,l),onDeleteConfirmOpen:p=>e.contactsDeleteConfirmId=p,onDeleteConfirmClose:()=>e.contactsDeleteConfirmId=null,onAddFieldOpen:p=>{e.contactsAddFieldForId=p,e.contactsAddFieldKey="",e.contactsAddFieldValue=""},onAddFieldClose:()=>{e.contactsAddFieldForId=null,e.contactsAddFieldKey="",e.contactsAddFieldValue=""},onAddFieldKeyChange:p=>e.contactsAddFieldKey=p,onAddFieldValueChange:p=>e.contactsAddFieldValue=p,onAddFieldSubmit:()=>{const p=e.contactsAddFieldForId,h=e.contactsAddFieldKey.trim();!p||!h||(Mo(e,p,h,e.contactsAddFieldValue,l),e.contactsAddFieldForId=null,e.contactsAddFieldKey="",e.contactsAddFieldValue="")}})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",p=Nl(e),h=e.chatAvatarUrl??p??null,v=(()=>{var w;const S=(w=e.configSnapshot)==null?void 0:w.config,f=S==null?void 0:S.publicChat;return(f==null?void 0:f.enabled)===!0})();return Mb({connected:e.connected,wsProps:yn(e),publicChatEnabled:v,publicChatAccountId:e.selectedWorkspace??void 0,sessionKey:e.sessionKey,onSessionKeyChange:S=>{const f=e.selectedWorkspace??"";so(),In(f,e.sessionKey,e.chatMessage),e.sessionKey=S,e.chatMessage=Rn(f,S),e.chatAttachments=[],e.chatStream=null,e.chatInterimText=null,e.chatSuggestion=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:S,lastActiveSessionKey:S}),e.loadAssistantIdentity(),Be(e),po(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:S=>{const f=Math.max(e.chatMessages.length+10,Ne);ti(e,e.sessionKey,{model:S}).then(()=>{Be(e,{limit:f})})},onThinkingLevelChange:S=>{const f=Math.max(e.chatMessages.length+10,Ne);ti(e,e.sessionKey,{thinkingLevel:S==="off"?null:S}).then(()=>{Be(e,{limit:f})})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:S=>{e.chatMessage=S,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:S=>{const f=Math.max(e.chatMessages.length+10,Ne);ti(e,e.sessionKey,{verboseLevel:S==="off"?null:S}).then(()=>{Be(e,{limit:f})})},onFillerChange:S=>{const f=Math.max(e.chatMessages.length+10,Ne);ti(e,e.sessionKey,{fillerEnabled:S}).then(()=>{Be(e,{limit:f})})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:h,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:!1,onRefresh:()=>{e.resetToolStream();const S=Math.max(e.chatMessages.length+10,Ne);return Promise.all([Be(e,{limit:S}),po(e)])},onToggleFocusMode:()=>{},onChatScroll:S=>e.handleChatScroll(S),nearBottom:e.chatUserNearBottom,hasMore:e.chatHistoryHasMore,loadingOlder:e.chatLoadingOlder,onLoadOlder:()=>{e.handleLoadOlderChat()},onDraftChange:S=>{e.chatMessage=S,sr(e.selectedWorkspace??"",e.sessionKey,S)},requestUpdate:()=>e.requestUpdate(),attachments:e.chatAttachments,onAttachmentsChange:S=>e.chatAttachments=S,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:S=>e.removeQueuedMessage(S),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:S=>e.handleOpenSidebar(S),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:S=>e.handleSplitRatioChange(S),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?yw({connected:e.connected,wsProps:yn(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&Ge(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?xn(e,{reset:!0}):qt(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(a=(o=e.channelsSnapshot)==null?void 0:o.channelMeta)!=null&&a.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((r=e.channelsSnapshot)==null?void 0:r.channelOrder)??[],channelLabels:((d=e.channelsSnapshot)==null?void 0:d.channelLabels)??{},channelMeta:((c=e.channelsSnapshot)==null?void 0:c.channelMeta)??[],agentIds:(()=>{var p;const l=le(e);return((p=l==null?void 0:l.agents)==null?void 0:p.map(h=>h.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1,e.cronEditJobId=null},detailJobId:e.cronDetailJobId,editJobId:e.cronEditJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,ao(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onEdit:l=>{e.cronForm=wh(l),e.cronEditJobId=l.id,e.cronDetailJobId=null},onEditSave:()=>{const l=e.cronEditJobId;l&&kh(e,l).then(()=>{e.cronEditJobId=null})},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{gh(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,p)=>mh(e,l,p),onRun:l=>yh(e,l),onRemove:l=>{e.cronPendingDeleteId=null,bh(e,l)},pendingDeleteId:e.cronPendingDeleteId,onArmDelete:l=>{e.cronPendingDeleteId=l||null},onLoadRuns:l=>ao(e,l),runModalJobId:e.cronRunModalJobId,runModalJobName:e.cronRunModalJobName,runResult:e.cronRunResult,onRunModalClose:()=>{e.cronRunModalJobId=null,e.cronRunModalJobName="",e.cronRunResult=null}},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,typeFilter:e.skillsTypeFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,detail:e.skillDetail,detailTab:e.skillDetailTab,addModal:e.skillAddModal,addForm:e.skillAddForm,formSource:e.skillAddFormSource,editTab:e.skillEditTab,drafts:e.skillDrafts,onFilterChange:l=>e.skillsFilter=l,onTypeFilterChange:l=>e.skillsTypeFilter=l,onRefresh:()=>Ge(e,{clearMessages:!0}),onToggle:(l,p)=>Nc(e,l,p),onEdit:(l,p)=>Bc(e,l,p),onSaveKey:l=>Fc(e,l),onInstall:(l,p,h)=>Oc(e,l,p,h),onViewDetail:l=>Uc(e,l),onDetailClose:()=>Kc(e),onDetailTab:l=>Wc(e,l),onAddOpen:()=>zc(e),onAddClose:()=>qc(e),onImportDraft:l=>Hc(e,l),onInstallDraft:l=>jc(e,l),onDeleteDraft:l=>Vc(e,l),onAddSave:()=>Go(e),onAddFormUpdate:(l,p)=>{e.skillAddForm={...e.skillAddForm,[l]:p}},onDelete:l=>Xc(e,l),onEditSkill:l=>Gc(e,l),onEditDetail:l=>Qc(e,l),onRefUpdate:(l,p)=>Yc(e,l,p),onEditTab:l=>Jc(e,l)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?xn(e,{reset:!0}):qt(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,chipsExpanded:e.sessionLogsChipsExpanded,expandedIds:e.sessionLogsExpandedIds,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,p)=>{const h=e;h.sessionLogsTypeFilters={...h.sessionLogsTypeFilters,[l]:p}},onAgentToggle:(l,p)=>{const h=e;h.sessionLogsAgentFilters={...h.sessionLogsAgentFilters,[l]:p}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onToggleChips:()=>{const l=e;l.sessionLogsChipsExpanded=!l.sessionLogsChipsExpanded},onToggleExpand:l=>{const p=e,h=new Set(p.sessionLogsExpandedIds);h.has(l)?h.delete(l):h.add(l),p.sessionLogsExpandedIds=h,p.requestUpdate()},onRefresh:()=>{xn(e,{reset:!0})},onExport:(l,p)=>e.exportSessionLogs(l,p),onScroll:l=>e.handleSessionLogsScroll(l)},loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,chipsExpanded:e.logsChipsExpanded,truncated:e.logsTruncated,onFilterTextChange:l=>e.logsFilterText=l,onLevelToggle:(l,p)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:p}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onToggleChips:()=>{const l=e;l.logsChipsExpanded=!l.logsChipsExpanded},onRefresh:()=>qt(e,{reset:!0}),onExport:(l,p)=>e.exportSessionLogs(l,p),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),u``)}function kk(e){const t=new Date(e),n=t.toLocaleDateString("en-GB",{day:"2-digit",month:"short"}),i=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return`${n} ${i}`}function Fl(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function $k(e,t,n){return u`
|
|
4192
|
+
`;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return El({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(p,f)=>{f!=null&&e.handlePinSubmit(p,f)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(p,f,v)=>e.handleChangePin(p,f,v)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return El({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:p=>e.handleSetMasterPin(p)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",k}if(e.setup){const l=kk(e.channelsSnapshot),p=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],f=$k(e.channelsSnapshot),v=Sk(e),S=async()=>{e.tailscaleStatus=await e.client.request("tailscale.status")};return Eg({connected:e.connected,serverPlatform:((s=(i=e.hello)==null?void 0:i.server)==null?void 0:s.platform)??null,assistantName:e.assistantName,currentStep:e.setupStep,licenseKey:e.licenseKey,licenseBusy:e.licenseBusy,licenseValid:e.licenseValid,licenseMessage:e.licenseMessage,licenseTier:e.licenseTier,licenseDeviceId:e.licenseDeviceId,licenseStoredKey:e.licenseStoredKey,onLicenseKeyChange:h=>e.handleLicenseKeyChange(h),onLicenseActivate:()=>e.handleLicenseActivate(),onLicenseRemove:async()=>{await e.handleLicenseRemove(),e.licenseRemoveConfirm=!1},licenseRemoveConfirm:e.licenseRemoveConfirm,onLicenseRemoveConfirm:()=>{e.licenseRemoveConfirm=!0},onLicenseRemoveCancel:()=>{e.licenseRemoveConfirm=!1},authConnected:e.authConnected,authBusy:e.authBusy,authMessage:e.authMessage,authUrl:e.authUrl,authCodeInput:e.authCodeInput,authExpiresIn:e.authExpiresIn,whatsappBusy:e.whatsappBusy,whatsappLoginMessage:e.whatsappLoginMessage,whatsappLoginQrDataUrl:e.whatsappLoginQrDataUrl,whatsappLoginConnected:e.whatsappLoginConnected,whatsappChannelStatus:l,whatsappAccounts:p,whatsappActiveQrAccountId:e.whatsappActiveQrAccountId,whatsappAccountSaving:e.whatsappAccountSaving,gatewayHealthy:e.gatewayHealthy,gatewayHealthLoading:e.gatewayHealthLoading,gatewayHealthMessage:e.gatewayHealthMessage,gatewayRestartBusy:e.gatewayRestartBusy,updateAvailable:e.updateAvailable,currentVersion:e.currentVersion,latestVersion:e.latestVersion,updateChecking:e.updateChecking,updateRunning:e.updateRunning,updateMessage:e.updateMessage,updateProgressSteps:e.updateProgressSteps,updateLastResult:e.updateLastResult,onUpdateCheck:()=>e.handleUpdateCheck(),onUpdateRun:()=>e.handleUpdateRun(),onUpdateDismissResult:()=>e.handleUpdateDismissResult(),uninstallConfirm:e.uninstallConfirm,uninstallBusy:e.uninstallBusy,uninstallDone:e.uninstallDone,uninstallError:e.uninstallError,uninstallConfirmText:e.uninstallConfirmText,onUninstallConfirm:()=>e.handleUninstallConfirm(),onUninstallCancel:()=>e.handleUninstallCancel(),onUninstallConfirmTextChange:h=>e.handleUninstallConfirmTextChange(h),onUninstallRun:()=>e.handleUninstallRun(),onUninstallDismiss:()=>e.handleUninstallDismiss(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:h=>e.handleAuthSubmitCode(h),onAuthCodeChange:h=>e.handleAuthCodeChange(h),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async h=>{await e.handleWhatsAppStart(!0,h),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(h),await Y(e,!0),e.requestUpdate())},onWhatsAppUnlink:async h=>{await e.handleWhatsAppLogout(h)},onWhatsAppReset:async h=>{await e.handleWhatsAppLogout(h),await e.handleWhatsAppStart(!0,h),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(h),await Y(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await Y(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),Y(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:h=>e.handleRemoveWhatsAppAccount(h),workspaces:e.workspaces,workspacesLoading:e.workspacesLoading,workspacesError:e.workspacesError,addingWorkspace:e.addingWorkspace,newWorkspaceName:e.newWorkspaceName,newWorkspacePath:e.newWorkspacePath,workspaceSaving:e.workspaceSaving,workspaceRemoveConfirm:e.workspaceRemoveConfirm,newWorkspacePin:e.newWorkspacePin,onSetNewWorkspacePin:h=>{e.newWorkspacePin=h},onWorkspaceCreate:async(h,b)=>{const w=e.newWorkspacePin;await e.handleWorkspaceCreate(h,b),w.match(/^\d{4,6}$/)&&(await ck(e,h,w),e.newWorkspacePin="")},onWorkspaceRemove:h=>e.handleWorkspaceRemove(h),onSetAddingWorkspace:h=>{e.addingWorkspace=h},onSetNewWorkspaceName:h=>{e.newWorkspaceName=h},onSetNewWorkspacePath:h=>{e.newWorkspacePath=h},onSetWorkspaceRemoveConfirm:h=>{e.workspaceRemoveConfirm=h},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(h,b)=>e.handleWorkspaceRename(h,b),whatsappDmPolicy:(()=>{const h=le(e),b=h==null?void 0:h.whatsappAccountId,w=b?p.find(x=>x.accountId===b):p[0];return(w==null?void 0:w.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var P;const h=le(e),b=h==null?void 0:h.whatsappAccountId,w=b?p.find(_=>_.accountId===b):p[0];if(!w)return;const A=w.dmPolicy!=null&&w.dmPolicy!=="disabled"?"disabled":"open",C=A==="open"?{dmPolicy:A,allowFrom:["*"]}:{dmPolicy:A};try{const _=await e.client.request("config.get"),B=_.config,z=(P=B==null?void 0:B.channels)==null?void 0:P.whatsapp,be=((z==null?void 0:z.accounts)??{})[w.accountId]?{channels:{whatsapp:{accounts:{[w.accountId]:C}}}}:{channels:{whatsapp:C}};await e.client.request("config.patch",{raw:JSON.stringify(be),baseHash:_.hash,note:`WhatsApp DM policy → ${A}`,skipRestart:!0}),await Y(e,!1)}catch(_){console.error("DM toggle failed:",_)}},whatsappModel:(()=>{var P,_;const h=le(e);if(!h)return null;const b=h.agents.find(B=>B.id.endsWith("-public")||B.id==="public");if(!b)return null;const w=(P=e.configSnapshot)==null?void 0:P.config,x=(_=w==null?void 0:w.agents)==null?void 0:_.list;if(!Array.isArray(x))return null;const A=x.find(B=>B.id===b.id);if(!(A!=null&&A.model))return null;const C=typeof A.model=="string"?A.model:A.model.primary;return(C==null?void 0:C.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async h=>{const b=le(e);if(!b)return;const w=b.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(w)try{const x=await e.client.request("config.get"),A=x.config,C=(A==null?void 0:A.agents)??{},P=Array.isArray(C.list)?[...C.list]:[],_=P.findIndex(z=>z.id===w.id);if(h)_>=0?P[_]={...P[_],model:h}:P.push({id:w.id,model:h});else if(_>=0){const{model:z,...te}=P[_];Object.keys(te).length<=1?P.splice(_,1):P[_]=te}const B=P.length>0?{agents:{list:P}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(B),baseHash:x.hash,note:`Public agent model → ${h||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Model change failed:",x)}},whatsappThinkingLevel:(()=>{var C,P,_;const h=le(e);if(!h)return null;const b=h.agents.find(B=>B.id.endsWith("-public")||B.id==="public");if(!b)return null;const w=(C=e.configSnapshot)==null?void 0:C.config,x=(P=w==null?void 0:w.agents)==null?void 0:P.list;if(!Array.isArray(x))return null;const A=x.find(B=>B.id===b.id);return((_=A==null?void 0:A.thinkingLevel)==null?void 0:_.trim())||null})(),onWhatsAppThinkingChange:async h=>{const b=le(e);if(!b)return;const w=b.agents.find(x=>x.id.endsWith("-public")||x.id==="public");if(w)try{const x=await e.client.request("config.get"),A=x.config,C=(A==null?void 0:A.agents)??{},P=Array.isArray(C.list)?[...C.list]:[],_=P.findIndex(te=>te.id===w.id),B=h==="off"?void 0:h;if(B)_>=0?P[_]={...P[_],thinkingLevel:B}:P.push({id:w.id,thinkingLevel:B});else if(_>=0){const{thinkingLevel:te,...be}=P[_];Object.keys(be).length<=1?P.splice(_,1):P[_]=be}const z=P.length>0?{agents:{list:P}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(z),baseHash:x.hash,note:`Public agent thinking → ${B||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Thinking change failed:",x)}},whatsappGroupPolicy:(()=>{var _,B;const h=(_=e.configSnapshot)==null?void 0:_.config,b=(B=h==null?void 0:h.channels)==null?void 0:B.whatsapp,w=le(e),x=w==null?void 0:w.whatsappAccountId,A=(b==null?void 0:b.accounts)??{},C=x?A[x]:void 0;return(C==null?void 0:C.groupPolicy)??(b==null?void 0:b.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var B,z;const h=(B=e.configSnapshot)==null?void 0:B.config,b=(z=h==null?void 0:h.channels)==null?void 0:z.whatsapp,w=le(e),x=w==null?void 0:w.whatsappAccountId,A=(b==null?void 0:b.accounts)??{},C=x?A[x]:void 0,_=((C==null?void 0:C.groups)??(b==null?void 0:b.groups)??{})["*"];return(_==null?void 0:_.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var w;const h=le(e),b=h==null?void 0:h.whatsappAccountId;try{const x=await e.client.request("config.get"),A=x.config,C=((w=A==null?void 0:A.channels)==null?void 0:w.whatsapp)??{},P=C.accounts??{},_=b?P[b]:void 0,B=(_==null?void 0:_.groupPolicy)??C.groupPolicy??"allowlist",z=B==="disabled"||B==="allowlist",te=z?"open":"disabled",be=z?{"*":{}}:void 0,X={groupPolicy:te};be&&(X.groups=be);const at=_?{channels:{whatsapp:{accounts:{[b]:X}}}}:{channels:{whatsapp:X}};await e.client.request("config.patch",{raw:JSON.stringify(at),baseHash:x.hash,note:`WhatsApp groups → ${te}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(x){console.error("Group toggle failed:",x)}},onWhatsAppGroupMentionChange:async h=>{var x;const b=le(e),w=b==null?void 0:b.whatsappAccountId;try{const A=await e.client.request("config.get"),C=A.config,_=(((x=C==null?void 0:C.channels)==null?void 0:x.whatsapp)??{}).accounts??{},B=w?_[w]:void 0,z={"*":{requireMention:h}},te=B?{channels:{whatsapp:{accounts:{[w]:{groups:z}}}}}:{channels:{whatsapp:{groups:z}}};await e.client.request("config.patch",{raw:JSON.stringify(te),baseHash:A.hash,note:`WhatsApp group mention → ${h?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(A){console.error("Group mention change failed:",A)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:f.configured,imessageRunning:f.running,imessageConnected:f.connected,imessageLastError:f.lastError,imessageSelfChatMode:f.selfChatMode,imessageCliPath:f.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:v,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const h=await e.client.request("config.get"),b=h.config,w=(b==null?void 0:b.bindings)??[],x=le(e),A=x==null?void 0:x.agents.find(z=>z.id.endsWith("-admin")||z.id==="admin"),C=(A==null?void 0:A.id)??"admin",P=w.filter(z=>{var te;return((te=z.match)==null?void 0:te.channel)!=="imessage"}),_=[{agentId:C,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],B=[...P,..._];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:B}),baseHash:h.hash,note:"Enable iMessage (self-chat) for "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([Y(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await Y(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const h=await e.client.request("config.get"),b=h.config,x=((b==null?void 0:b.bindings)??[]).filter(A=>{var C;return((C=A.match)==null?void 0:C.channel)!=="imessage"});await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:x}),baseHash:h.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([Y(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const h=await e.client.request("config.get"),b=h.config,w=(b==null?void 0:b.bindings)??[],x=le(e),A=x==null?void 0:x.agents.find(B=>B.id.endsWith("-admin")||B.id==="admin"),C=(A==null?void 0:A.id)??"admin",P=w.filter(B=>{var z;return((z=B.match)==null?void 0:z.channel)!=="imessage"}),_=[{agentId:C,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:[...P,..._]}),baseHash:h.hash,note:"Reassign iMessage to "+((x==null?void 0:x.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([Y(e,!0),Fe(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:h=>{e.infoModalOpen=h},onInfoModalClose:()=>{e.infoModalOpen=null},isMaster:e.accessState.master,apiKeyProviders:e.apiKeyProviders,apiKeyModalOpen:e.apiKeyModalOpen,apiKeyBusy:e.apiKeyBusy,apiKeyError:e.apiKeyError,apiKeySuccess:e.apiKeySuccess,apiKeySavingProvider:e.apiKeySavingProvider,onApiKeyModalOpen:()=>{e.apiKeyModalOpen=!0,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeyModalClose:()=>{e.apiKeyModalOpen=!1,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeySave:async(h,b)=>{e.apiKeySavingProvider=h,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await _l(e.client,h,b);const w=`${h} key saved`;e.apiKeySuccess=w,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}h==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===w&&(e.apiKeySuccess=null)},2500)}catch(w){e.apiKeyError=w instanceof Error?w.message:"Failed to save key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async h=>{e.apiKeySavingProvider=h,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Ww(e.client,h);const b=`${h} key removed`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===b&&(e.apiKeySuccess=null)},2500)}catch(b){e.apiKeyError=b instanceof Error?b.message:"Failed to remove key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyDisable:async(h,b)=>{e.apiKeySavingProvider=h,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Kw(e.client,h,b);const w=`${h} ${b?"disabled":"enabled"}`;e.apiKeySuccess=w,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await wi(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===w&&(e.apiKeySuccess=null)},2500)}catch(w){e.apiKeyError=w instanceof Error?w.message:`Failed to ${b?"disable":"enable"} key`,e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},authApiKeyMode:e.authApiKeyMode,authApiKeyInput:e.authApiKeyInput,authApiKeyBusy:e.authApiKeyBusy,authApiKeyError:e.authApiKeyError,onAuthApiKeyToggle:()=>{e.authApiKeyMode=!e.authApiKeyMode,e.authApiKeyError=null},onAuthApiKeyChange:h=>{e.authApiKeyInput=h},onAuthApiKeySubmit:async()=>{const h=e.authApiKeyInput.trim();if(h){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await _l(e.client,"anthropic",h),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(b){e.authApiKeyError=b instanceof Error?b.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{var b;const h=e.selectedWorkspace??((b=e.workspaces[0])==null?void 0:b.name);return h?e.accessState.accounts.some(w=>w.id===h):!1})(),accountPinModalOpen:e.accountPinModalOpen,accountPinBusy:e.accountPinBusy,accountPinError:e.accountPinError,accountPinSuccess:e.accountPinSuccess,onAccountPinModalOpen:()=>{e.accountPinModalOpen=!0,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinModalClose:()=>{e.accountPinModalOpen=!1,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinSave:(h,b)=>{var x;const w=e.selectedWorkspace??((x=e.workspaces[0])==null?void 0:x.name);w&&e.handleAccountPinSave(w,h,b)},publicChatEnabled:(()=>{var w;const h=(w=e.configSnapshot)==null?void 0:w.config,b=h==null?void 0:h.publicChat;return(b==null?void 0:b.enabled)===!0})(),publicChatAuthMode:(()=>{var x;const h=(x=e.configSnapshot)==null?void 0:x.config,b=h==null?void 0:h.publicChat,w=b==null?void 0:b.auth;return w==="verified"||w==="choice"?w:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var h;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get"),w=b.config,x=((h=w==null?void 0:w.publicChat)==null?void 0:h.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!x}}),baseHash:b.hash,note:`Public chat → ${x?"disabled":"enabled"}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat toggle failed:",b)}finally{e.publicChatToggleBusy=!1}}},onPublicChatAuthModeChange:async h=>{if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get");await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{auth:h}}),baseHash:b.hash,note:`Public chat auth → ${h}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat auth mode change failed:",b)}finally{e.publicChatToggleBusy=!1}}},brandAccentColor:(()=>{var w;const h=e.selectedWorkspace;return h?((w=Re()[h])==null?void 0:w.accentColor)??"":""})(),brandBackgroundColor:(()=>{var w;const h=e.selectedWorkspace;return h?((w=Re()[h])==null?void 0:w.backgroundColor)??"":""})(),brandHasLogo:(()=>{var w;const h=e.selectedWorkspace;return h?!!((w=Re()[h])!=null&&w.logoUrl):!1})(),brandingBusy:e.brandingBusy,brandingExpanded:e.brandingExpanded,onBrandingToggle:()=>{e.brandingExpanded=!e.brandingExpanded},onBrandAccentColorChange:async h=>{var w;const b=e.selectedWorkspace;if(!(!b||e.brandingBusy)){e.brandingBusy=!0;try{const x=await e.client.request("config.get"),A=x.config,C=((w=A==null?void 0:A.workspaces)==null?void 0:w[b])??{},P=C.brand??{};await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[b]:{...C,brand:{...P,accentColor:h}}}}),baseHash:x.hash,note:`Brand accent → ${h}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");const _=Re();_[b]||(_[b]={}),_[b].accentColor=h,kn(b)}catch(x){console.error("Brand accent change failed:",x)}finally{e.brandingBusy=!1}}},onBrandBackgroundColorChange:async h=>{var w;const b=e.selectedWorkspace;if(!(!b||e.brandingBusy)){e.brandingBusy=!0;try{const x=await e.client.request("config.get"),A=x.config,C=((w=A==null?void 0:A.workspaces)==null?void 0:w[b])??{},P=C.brand??{};await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[b]:{...C,brand:{...P,backgroundColor:h}}}}),baseHash:x.hash,note:`Brand background → ${h}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");const _=Re();_[b]||(_[b]={}),_[b].backgroundColor=h,kn(b)}catch(x){console.error("Brand background change failed:",x)}finally{e.brandingBusy=!1}}},onBrandLogoUpload:async h=>{const b=e.selectedWorkspace;if(!(!b||e.brandingBusy)){e.brandingBusy=!0;try{const w=await h.arrayBuffer(),x=new Uint8Array(w);let A="";for(let _=0;_<x.length;_++)A+=String.fromCharCode(x[_]);const C=btoa(A);await e.client.request("brand.uploadLogo",{workspace:b,data:C,mimeType:h.type});const P=Re();P[b]||(P[b]={}),P[b].logoUrl=`/brand-logo/${encodeURIComponent(b)}`}catch(w){console.error("Brand logo upload failed:",w)}finally{e.brandingBusy=!1}}},onBrandLogoRemove:async()=>{const h=e.selectedWorkspace;if(!(!h||e.brandingBusy)){e.brandingBusy=!0;try{await e.client.request("brand.removeLogo",{workspace:h});const b=Re();b[h]&&delete b[h].logoUrl}catch(b){console.error("Brand logo remove failed:",b)}finally{e.brandingBusy=!1}}},onBrandReset:async()=>{var b;const h=e.selectedWorkspace;if(!(!h||e.brandingBusy)){e.brandingBusy=!0;try{const w=await e.client.request("config.get"),x=w.config,A=((b=x==null?void 0:x.workspaces)==null?void 0:b[h])??{},{brand:C,...P}=A;await e.client.request("config.patch",{raw:JSON.stringify({workspaces:{[h]:{...P,brand:null}}}),baseHash:w.hash,note:"Brand reset to defaults",skipRestart:!0}),e.configSnapshot=await e.client.request("config.get");try{await e.client.request("brand.removeLogo",{workspace:h})}catch{}const _=Re();delete _[h],kn(h)}catch(w){console.error("Brand reset failed:",w)}finally{e.brandingBusy=!1}}},tailscaleStatus:e.tailscaleStatus,tailscaleBusy:e.tailscaleBusy,tailscaleAuthUrl:e.tailscaleAuthUrl,tailscaleError:e.tailscaleError,tailscaleFunnelEnableUrl:e.tailscaleFunnelEnableUrl,tailscaleDisableConfirm:e.tailscaleDisableConfirm,onTailscaleEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleAuthUrl=null;try{const h=await e.client.request("tailscale.enable");if(h.authUrl){e.tailscaleAuthUrl=h.authUrl;const b=setInterval(async()=>{try{const w=await e.client.request("tailscale.status");e.tailscaleStatus=w,w.loggedIn&&(clearInterval(b),e.tailscaleAuthUrl=null,e.tailscaleBusy=!1)}catch{}},3e3);setTimeout(()=>{clearInterval(b),e.tailscaleBusy&&(e.tailscaleBusy=!1)},3e5)}else h.alreadyLoggedIn&&(e.tailscaleStatus=await e.client.request("tailscale.status")),e.tailscaleBusy=!1}catch(h){console.error("Tailscale enable failed:",h),e.tailscaleBusy=!1}}},onTailscaleServeEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null;try{await e.client.request("tailscale.serve.enable"),await S()}catch(h){console.error("Tailscale serve enable failed:",h),e.tailscaleError=h.message||"Failed to enable Remote Access"}finally{e.tailscaleBusy=!1}}},onTailscaleServeDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.serve.disable"),await S()}catch(h){console.error("Tailscale serve disable failed:",h)}finally{e.tailscaleBusy=!1}}},onTailscaleFunnelEnable:async()=>{var h;if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null,e.tailscaleFunnelEnableUrl=null;try{await e.client.request("tailscale.funnel.enable"),await S()}catch(b){console.error("Tailscale funnel enable failed:",b);const w=b;(h=w.payload)!=null&&h.enableUrl&&(e.tailscaleFunnelEnableUrl=w.payload.enableUrl),e.tailscaleError=w.message||"Failed to enable Funnel"}finally{e.tailscaleBusy=!1}}},onTailscaleFunnelDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.funnel.disable"),await S()}catch(h){console.error("Tailscale funnel disable failed:",h)}finally{e.tailscaleBusy=!1}}},onTailscaleDisableConfirmToggle:()=>{e.tailscaleDisableConfirm=!e.tailscaleDisableConfirm},wifiModalOpen:e.wifiModalOpen,onWifiModalToggle:()=>{e.wifiModalOpen=!e.wifiModalOpen,e.wifiModalOpen||(e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="",e.wifiError=null)},wifiStatus:e.wifiStatus,wifiNetworks:e.wifiNetworks,wifiBusy:e.wifiBusy,wifiError:e.wifiError,wifiPassword:e.wifiPassword,wifiSelectedSsid:e.wifiSelectedSsid,onWifiScan:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{const[h,b]=await Promise.all([e.client.request("wifi.scan"),e.client.request("wifi.status")]);e.wifiNetworks=h.networks,e.wifiStatus=b}catch(h){console.error("WiFi scan failed:",h),e.wifiError=h.message||"Failed to scan networks"}finally{e.wifiBusy=!1}}},onWifiConnect:async()=>{if(e.wifiBusy||!e.wifiSelectedSsid)return;const h=e.wifiSelectedSsid;e.wifiBusy=!0,e.wifiError=null;try{const b=await e.client.request("wifi.connect",{ssid:h,password:e.wifiPassword});e.wifiPassword="",e.wifiSelectedSsid=null,e.wifiNetworks=[],e.wifiStatus={available:!0,connected:b.connected,ssid:b.ssid,signal:null,ip:b.ip,savedSsid:b.ssid,autoconnect:!0},e.wifiBusy=!1;try{const w=await e.client.request("wifi.status");e.wifiStatus=w}catch{}}catch(b){console.error("WiFi connect failed:",b),e.wifiError=b.message||"Failed to connect",e.wifiBusy=!1}},onWifiDisconnect:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.disconnect"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const h=await e.client.request("wifi.status");e.wifiStatus=h}catch(h){console.error("WiFi disconnect failed:",h),e.wifiError=h.message||"Failed to disconnect"}finally{e.wifiBusy=!1}}},onWifiForget:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.forget"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const h=await e.client.request("wifi.status");e.wifiStatus=h}catch(h){console.error("WiFi forget failed:",h),e.wifiError=h.message||"Failed to forget network"}finally{e.wifiBusy=!1}}},onWifiDismiss:()=>{e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="",e.wifiError=null},onWifiSelectSsid:h=>{e.wifiSelectedSsid=h,e.wifiPassword="",e.wifiError=null},onWifiPasswordChange:h=>{e.wifiPassword=h},networkPort:e.networkPort,networkHostname:e.networkHostname,networkPortInput:e.networkPortInput,networkHostnameInput:e.networkHostnameInput,networkModalOpen:e.networkModalOpen,networkBusy:e.networkBusy,networkError:e.networkError,networkSuccess:e.networkSuccess,onNetworkModalToggle:()=>{e.networkModalOpen=!e.networkModalOpen,e.networkModalOpen&&(e.networkPortInput=String(e.networkPort??""),e.networkHostnameInput=e.networkHostname,e.networkError=null,e.networkSuccess=null)},onNetworkPortChange:h=>{e.networkPortInput=h,e.networkError=null,e.networkSuccess=null},onNetworkHostnameChange:h=>{e.networkHostnameInput=h,e.networkError=null,e.networkSuccess=null},onNetworkSave:async()=>{if(e.networkBusy)return;e.networkBusy=!0,e.networkError=null,e.networkSuccess=null;const h=e.networkPortInput.trim(),b=Number.parseInt(h,10),w=e.networkHostnameInput.trim();if(!h||!Number.isFinite(b)||b<1024||b>65535){e.networkError="Port must be a number between 1024 and 65535",e.networkBusy=!1;return}const x=b!==e.networkPort,A=w!==e.networkHostname;if(!x&&!A){e.networkBusy=!1;return}try{A&&await e.client.request("network.setHostname",{hostname:w});const C={};x&&(C.gateway={port:b}),A&&(C.discovery={bonjourHostname:w});const P=await e.client.request("config.get");await e.client.request("config.patch",{raw:JSON.stringify(C),baseHash:P.hash,note:[x?`Port → ${b}`:null,A?`Hostname → ${w}`:null].filter(Boolean).join(", "),restartDelayMs:2e3}),e.networkSuccess="Saved — redirecting...";const _=window.location.protocol,B=A?`${w}.local`:window.location.hostname,z=x?b:e.networkPort,te=`${_}//${B}:${z}/setup`;setTimeout(()=>{window.location.href=te},1500)}catch(C){console.error("Network save failed:",C),e.networkError=C.message||"Failed to save network settings",e.networkBusy=!1}},wsProps:fk(e)})}if(e.filesPage){const l=yk(e);return cg({connected:e.connected,wsProps:yn(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,currentDir:e.filesCurrentDir,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>Zt(e,l),onReindex:()=>Af(e,l),onSelectFile:p=>{e.filesPendingDeletePath=null,yf(e,p,l)},onToggleSelectFile:p=>vf(e,p,l),onToggleDir:p=>Ef(e,p),onUpload:(p,f)=>kf(e,p,f,l),onNewFolder:(p,f)=>$f(e,p,f,l),onDownload:p=>od(e,p,l),onBulkDownload:()=>bf(e,l),onDelete:p=>{e.filesPendingDeletePath=null,Sf(e,p,l)},pendingDeletePath:e.filesPendingDeletePath,onArmDelete:p=>{e.filesPendingDeletePath=p||null},onMoveToDir:(p,f)=>wf(e,p,f,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:p=>{const f=e.filesSearchAgentId??l;Cf(e,p,f)},onSearchAgentChange:p=>{e.filesSearchAgentId=p},onSearchClear:()=>{Tf(e)},onSearchQueryChange:p=>{e.filesSearchQuery=p}})}if(e.browserPage)return ig({connected:e.connected,active:e.browserScreencastActive,loading:e.browserLoading,error:e.browserError,inputMode:e.browserInputMode,fullscreen:e.browserFullscreen,handoffPending:e.browserHandoffPending,handoffReason:e.browserHandoffReason,onStart:()=>Iw(e),onStop:()=>Rw(e),onToggleInput:()=>Nw(e),onToggleFullscreen:()=>Bw(e),onCompleteHandoff:()=>Dw(e),onCanvasMouseDown:l=>{const f=l.target.getBoundingClientRect(),S=_n().translateCoordinates(l.clientX-f.left,l.clientY-f.top);Ys(e,"mousePressed",S.x,S.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const f=l.target.getBoundingClientRect(),S=_n().translateCoordinates(l.clientX-f.left,l.clientY-f.top);Ys(e,"mouseReleased",S.x,S.y)},onCanvasMouseMove:l=>{const p=_n();if(p.shouldThrottleMouseMove())return;const v=l.target.getBoundingClientRect(),S=p.translateCoordinates(l.clientX-v.left,l.clientY-v.top);Ys(e,"mouseMoved",S.x,S.y)},onCanvasKeyDown:l=>{let p=0;l.altKey&&(p|=1),l.ctrlKey&&(p|=2),l.metaKey&&(p|=4),l.shiftKey&&(p|=8),Xs(e,"keyDown",l.key,{code:l.code,modifiers:p||void 0}),l.key.length===1&&Xs(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{Xs(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=gk(e),p=mk(e);return Tg({connected:e.connected,wsProps:yn(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>is(e,l),onAdd:f=>{_u(e,f,l,p).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:f=>Mu(e,f,l,p),onNewPhoneChange:f=>e.handleAdminsNewPhoneChange(f)})}if(e.contactsPage){const l=vk(e);return Rg({connected:e.connected,wsProps:yn(e),loading:e.contactsLoading,saving:e.contactsSaving,records:e.contactsRecords,error:e.contactsError,searchQuery:e.contactsSearchQuery,editingId:e.contactsEditingId,showAddForm:e.contactsShowAddForm,newRecordPhone:e.contactsNewPhone,newRecordName:e.contactsNewName,deleteConfirmId:e.contactsDeleteConfirmId,addFieldForId:e.contactsAddFieldForId,addFieldKey:e.contactsAddFieldKey,addFieldValue:e.contactsAddFieldValue,onSearch:p=>e.contactsSearchQuery=p,onSearchSubmit:()=>_t(e,l),onAdd:(p,f)=>Pu(e,p,f,l),onDelete:p=>Lu(e,p,l),onSetField:(p,f,v)=>Mo(e,p,f,v,l),onDeleteField:(p,f)=>Iu(e,p,f,l),onToggleExpand:p=>{e.contactsEditingId=e.contactsEditingId===p?null:p},onShowAddForm:()=>e.contactsShowAddForm=!0,onCancelAddForm:()=>{e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName=""},onNewRecordPhoneChange:p=>e.handleContactsNewPhoneChange(p),onNewRecordNameChange:p=>e.handleContactsNewNameChange(p),onRefresh:()=>_t(e,l),onDeleteConfirmOpen:p=>e.contactsDeleteConfirmId=p,onDeleteConfirmClose:()=>e.contactsDeleteConfirmId=null,onAddFieldOpen:p=>{e.contactsAddFieldForId=p,e.contactsAddFieldKey="",e.contactsAddFieldValue=""},onAddFieldClose:()=>{e.contactsAddFieldForId=null,e.contactsAddFieldKey="",e.contactsAddFieldValue=""},onAddFieldKeyChange:p=>e.contactsAddFieldKey=p,onAddFieldValueChange:p=>e.contactsAddFieldValue=p,onAddFieldSubmit:()=>{const p=e.contactsAddFieldForId,f=e.contactsAddFieldKey.trim();!p||!f||(Mo(e,p,f,e.contactsAddFieldValue,l),e.contactsAddFieldForId=null,e.contactsAddFieldKey="",e.contactsAddFieldValue="")}})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",p=Bl(e),f=e.chatAvatarUrl??p??null,v=(()=>{var b;const S=(b=e.configSnapshot)==null?void 0:b.config,h=S==null?void 0:S.publicChat;return(h==null?void 0:h.enabled)===!0})();return Ib({connected:e.connected,wsProps:yn(e),publicChatEnabled:v,publicChatAccountId:e.selectedWorkspace??void 0,sessionKey:e.sessionKey,onSessionKeyChange:S=>{const h=e.selectedWorkspace??"";so(),In(h,e.sessionKey,e.chatMessage),e.sessionKey=S,e.chatMessage=Rn(h,S),e.chatAttachments=[],e.chatStream=null,e.chatInterimText=null,e.chatSuggestion=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:S,lastActiveSessionKey:S}),e.loadAssistantIdentity(),Ne(e),po(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:S=>{const h=Math.max(e.chatMessages.length+10,Be);ti(e,e.sessionKey,{model:S}).then(()=>{Ne(e,{limit:h})})},onThinkingLevelChange:S=>{const h=Math.max(e.chatMessages.length+10,Be);ti(e,e.sessionKey,{thinkingLevel:S==="off"?null:S}).then(()=>{Ne(e,{limit:h})})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:S=>{e.chatMessage=S,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:S=>{const h=Math.max(e.chatMessages.length+10,Be);ti(e,e.sessionKey,{verboseLevel:S==="off"?null:S}).then(()=>{Ne(e,{limit:h})})},onFillerChange:S=>{const h=Math.max(e.chatMessages.length+10,Be);ti(e,e.sessionKey,{fillerEnabled:S}).then(()=>{Ne(e,{limit:h})})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:f,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:!1,onRefresh:()=>{e.resetToolStream();const S=Math.max(e.chatMessages.length+10,Be);return Promise.all([Ne(e,{limit:S}),po(e)])},onToggleFocusMode:()=>{},onChatScroll:S=>e.handleChatScroll(S),nearBottom:e.chatUserNearBottom,hasMore:e.chatHistoryHasMore,loadingOlder:e.chatLoadingOlder,onLoadOlder:()=>{e.handleLoadOlderChat()},onDraftChange:S=>{e.chatMessage=S,sa(e.selectedWorkspace??"",e.sessionKey,S)},requestUpdate:()=>e.requestUpdate(),attachments:e.chatAttachments,onAttachmentsChange:S=>e.chatAttachments=S,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:S=>e.removeQueuedMessage(S),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:S=>e.handleOpenSidebar(S),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:S=>e.handleSplitRatioChange(S),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?ww({connected:e.connected,wsProps:yn(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&Ge(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?xn(e,{reset:!0}):Ht(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(r=(o=e.channelsSnapshot)==null?void 0:o.channelMeta)!=null&&r.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((a=e.channelsSnapshot)==null?void 0:a.channelOrder)??[],channelLabels:((d=e.channelsSnapshot)==null?void 0:d.channelLabels)??{},channelMeta:((c=e.channelsSnapshot)==null?void 0:c.channelMeta)??[],agentIds:(()=>{var p;const l=le(e);return((p=l==null?void 0:l.agents)==null?void 0:p.map(f=>f.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1,e.cronEditJobId=null},detailJobId:e.cronDetailJobId,editJobId:e.cronEditJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,ro(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onEdit:l=>{e.cronForm=kh(l),e.cronEditJobId=l.id,e.cronDetailJobId=null},onEditSave:()=>{const l=e.cronEditJobId;l&&$h(e,l).then(()=>{e.cronEditJobId=null})},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{mh(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,p)=>yh(e,l,p),onRun:l=>vh(e,l),onRemove:l=>{e.cronPendingDeleteId=null,wh(e,l)},pendingDeleteId:e.cronPendingDeleteId,onArmDelete:l=>{e.cronPendingDeleteId=l||null},onLoadRuns:l=>ro(e,l),runModalJobId:e.cronRunModalJobId,runModalJobName:e.cronRunModalJobName,runResult:e.cronRunResult,onRunModalClose:()=>{e.cronRunModalJobId=null,e.cronRunModalJobName="",e.cronRunResult=null}},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,typeFilter:e.skillsTypeFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,detail:e.skillDetail,detailTab:e.skillDetailTab,addModal:e.skillAddModal,addForm:e.skillAddForm,formSource:e.skillAddFormSource,editTab:e.skillEditTab,drafts:e.skillDrafts,onFilterChange:l=>e.skillsFilter=l,onTypeFilterChange:l=>e.skillsTypeFilter=l,onRefresh:()=>Ge(e,{clearMessages:!0}),onToggle:(l,p)=>Bc(e,l,p),onEdit:(l,p)=>Nc(e,l,p),onSaveKey:l=>Fc(e,l),onInstall:(l,p,f)=>Oc(e,l,p,f),onViewDetail:l=>Uc(e,l),onDetailClose:()=>Wc(e),onDetailTab:l=>Kc(e,l),onAddOpen:()=>zc(e),onAddClose:()=>Hc(e),onImportDraft:l=>qc(e,l),onInstallDraft:l=>jc(e,l),onDeleteDraft:l=>Vc(e,l),onAddSave:()=>Go(e),onAddFormUpdate:(l,p)=>{e.skillAddForm={...e.skillAddForm,[l]:p}},onDelete:l=>Xc(e,l),onEditSkill:l=>Gc(e,l),onEditDetail:l=>Qc(e,l),onRefUpdate:(l,p)=>Jc(e,l,p),onEditTab:l=>Yc(e,l)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?xn(e,{reset:!0}):Ht(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,chipsExpanded:e.sessionLogsChipsExpanded,expandedIds:e.sessionLogsExpandedIds,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,p)=>{const f=e;f.sessionLogsTypeFilters={...f.sessionLogsTypeFilters,[l]:p}},onAgentToggle:(l,p)=>{const f=e;f.sessionLogsAgentFilters={...f.sessionLogsAgentFilters,[l]:p}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onToggleChips:()=>{const l=e;l.sessionLogsChipsExpanded=!l.sessionLogsChipsExpanded},onToggleExpand:l=>{const p=e,f=new Set(p.sessionLogsExpandedIds);f.has(l)?f.delete(l):f.add(l),p.sessionLogsExpandedIds=f,p.requestUpdate()},onRefresh:()=>{xn(e,{reset:!0})},onExport:(l,p)=>e.exportSessionLogs(l,p),onScroll:l=>e.handleSessionLogsScroll(l)},loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,chipsExpanded:e.logsChipsExpanded,truncated:e.logsTruncated,onFilterTextChange:l=>e.logsFilterText=l,onLevelToggle:(l,p)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:p}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onToggleChips:()=>{const l=e;l.logsChipsExpanded=!l.logsChipsExpanded},onRefresh:()=>Ht(e,{reset:!0}),onExport:(l,p)=>e.exportSessionLogs(l,p),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),u``)}function Ak(e){const t=new Date(e),n=t.toLocaleDateString("en-GB",{day:"2-digit",month:"short"}),i=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return`${n} ${i}`}function Fl(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function Ek(e,t,n){return u`
|
|
4078
4193
|
<div class="audit-modal-overlay" @click=${s=>{s.target.classList.contains("audit-modal-overlay")&&n()}}>
|
|
4079
4194
|
<div class="audit-modal-card">
|
|
4080
4195
|
<div class="audit-modal-header">
|
|
@@ -4094,7 +4209,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4094
4209
|
<a href="/files" class="audit-modal-path-link">${s.path}</a>
|
|
4095
4210
|
</div>
|
|
4096
4211
|
<div class="audit-modal-entry-meta">
|
|
4097
|
-
${
|
|
4212
|
+
${Ak(s.timestamp)}
|
|
4098
4213
|
<span class="audit-modal-agent">${s.agentId}</span>
|
|
4099
4214
|
</div>
|
|
4100
4215
|
</div>
|
|
@@ -4106,7 +4221,7 @@ ${a.text}`:r.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
|
|
|
4106
4221
|
`}
|
|
4107
4222
|
</div>
|
|
4108
4223
|
</div>
|
|
4109
|
-
`}const Sk={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},xk={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};function Ak(e){e.basePath=Nf();const t=Ve();if(Ql(t.accentColor),Yl(t.backgroundColor),window.scrollTo(0,0),Mf(e),e.publicChat){const n=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__,i=(n==null?void 0:n.accountId)??"",s=i?i.charAt(0).toUpperCase()+i.slice(1):"Assistant";document.title=`Chat with ${s}`,Ie(e);return}if(e.setup){document.title=`${t.name} Setup`,Ie(e);return}if(e.filesPage){document.title=`${t.name} Files`,Lf(e),Ie(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Ie(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Ie(e);return}if(e.contactsPage){document.title=`${t.name} Contacts`,Ie(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Ie(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Ie(e);return}Kf(e,!0),Ff(e),Of(e),window.addEventListener("popstate",e.popStateHandler),Rf(e),Ie(e),Tf(e),e.tab==="logs"&&(e.logsSubTab==="session"?Zo(e):Jo(e)),e.tab==="debug"&&ta(e)}function Ck(e){uh(e)}function Ek(e){var t;window.removeEventListener("popstate",e.popStateHandler),_f(e),Xo(e),ea(e),na(e),Pf(e),If(e),Uf(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Tk(e,t){if(!e.publicChat){if(e.filesPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleFilesLoad&&e.handleFilesLoad(),e.adminsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdminsLoad&&e.handleAdminsLoad(),e.contactsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleContactsLoad&&e.handleContactsLoad(),e.chatPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleChatLoad&&e.handleChatLoad(),e.advancedPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdvancedLoad&&e.handleAdvancedLoad(),e.setup&&e.connected){const n=t.has("connected")&&t.get("connected")===!1;n&&e.handleLicenseStatusCheck&&e.licenseValid===null&&!e.licenseBusy&&e.handleLicenseStatusCheck(),n&&e.handleUpdateCheck&&e.handleUpdateCheck();const i=t.has("setupStep")&&e.setupStep==="auth";(n||i)&&e.setupStep==="auth"&&e.handleAuthStatusCheck&&e.authConnected===null&&!e.authBusy&&e.handleAuthStatusCheck(),e.setupStep==="whatsapp"&&t.has("setupStep")&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(o=>{e.channelsSnapshot=o,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1})),t.has("whatsappLoginConnected")&&e.whatsappLoginConnected===!0&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(s=>{e.channelsSnapshot=s,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1}))}if(e.tab==="chat"&&!e.advancedPage&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),i=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;Yt(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&cc(e,t.has("tab")||t.has("logsAutoFollow"))}}function _k(e){const t={name:(e==null?void 0:e.name)??"",displayName:(e==null?void 0:e.displayName)??"",about:(e==null?void 0:e.about)??"",picture:(e==null?void 0:e.picture)??"",banner:(e==null?void 0:e.banner)??"",website:(e==null?void 0:e.website)??"",nip05:(e==null?void 0:e.nip05)??"",lud16:(e==null?void 0:e.lud16)??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e!=null&&e.banner||e!=null&&e.website||e!=null&&e.nip05||e!=null&&e.lud16)}}async function Mk(e,t,n){await Oo(e,t,n),await J(e,!0)}async function Pk(e,t){await fc(e,t),await J(e,!0)}async function Lk(e,t){await gc(e,t),await J(e,!0)}async function Ik(e,t){await mc(e,t)}async function Rk(e,t){await yc(e,t)}async function Dk(e){await fh(e),await Fe(e),await J(e,!0)}async function Bk(e){await Fe(e),await J(e,!0)}function Nk(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[i,...s]=n.split(":");if(!i||s.length===0)continue;const o=i.trim(),a=s.join(":").trim();o&&a&&(t[o]=a)}return t}function Iu(e){var n,i,s;return((s=(((i=(n=e.channelsSnapshot)==null?void 0:n.channelAccounts)==null?void 0:i.nostr)??[])[0])==null?void 0:s.accountId)??e.nostrProfileAccountId??"default"}function Ru(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Fk(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=_k(n??void 0)}function Ok(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Uk(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function Kk(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function Wk(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Iu(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(Ru(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const o=(s==null?void 0:s.error)??`Profile update failed (${i.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Nk(s==null?void 0:s.details)};return}if(!s.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 J(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function zk(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Iu(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(Ru(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const d=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:d,success:null};return}const o=s.merged??s.imported??null,a=o?{...t.values,...o}:t.values,r=!!(a.banner||a.website||a.nip05||a.lud16);e.nostrProfileFormState={...t,importing:!1,values:a,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:r},s.saved&&await J(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function qk(e){if(e.client){e.authBusy=!0,e.authMessage=null;try{const t=await e.client.request("auth.status",{});e.authConnected=t.connected,e.authExpiresIn=t.expiresIn??null,e.authMessage=t.message??null,t.connected&&(e.setupStep="whatsapp")}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to check auth status"}finally{e.authBusy=!1}}}async function Hk(e){if(e.client){e.authBusy=!0,e.authMessage=null,e.authUrl=null,e.authConnected=null;try{const t=await e.client.request("auth.oauth.start",{provider:"anthropic"});e.authUrl=t.authUrl,e.authMessage=t.message??"Sign in with your Claude Pro account"}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to start auth flow"}finally{e.authBusy=!1}}}async function jk(e,t){if(e.client){e.authBusy=!0,e.authMessage="Verifying code...";try{await e.client.request("auth.oauth.code",{code:t});const n=await e.client.request("auth.oauth.wait",{timeoutMs:3e4});n.connected?(e.authConnected=!0,e.authMessage=n.message??"Connected to Claude!",e.authUrl=null,e.authCodeInput=""):e.authMessage=n.message??"Still waiting for authorization..."}catch(n){e.authConnected=!1,e.authMessage=n instanceof Error?n.message:"Verification failed"}finally{e.authBusy=!1}}}function Vk(e,t){e.authCodeInput=t}function Gk(e){e.setupStep="whatsapp"}async function Qk(e){if(e.client){e.licenseBusy=!0,e.licenseMessage=null;try{const t=await e.client.request("license.status",{});e.licenseDeviceId=t.deviceId??null,e.licenseStoredKey=t.key??null,t.licensed?(e.licenseValid=!0,e.licenseTier=t.tier??null,e.setupStep="auth"):(e.licenseValid=null,e.setupStep="license")}catch(t){const n=t instanceof Error?t.message:String(t);n.includes("unknown method")?(e.licenseValid=!0,e.setupStep="auth"):(e.licenseValid=null,e.licenseMessage=n,e.setupStep="license")}finally{e.licenseBusy=!1}}}async function Yk(e){if(e.client&&e.licenseKey.trim()){e.licenseBusy=!0,e.licenseMessage=null,e.licenseValid=null;try{const t=await e.client.request("license.activate",{key:e.licenseKey.trim()});t.valid?(e.licenseValid=!0,e.licenseMessage=t.message??"License activated",e.licenseTier=t.tier??null,setTimeout(()=>{e.setupStep="auth"},1500)):(e.licenseValid=!1,e.licenseMessage=t.message??"Invalid license key")}catch(t){e.licenseValid=!1,e.licenseMessage=t instanceof Error?t.message:"Activation failed"}finally{e.licenseBusy=!1}}}async function Jk(e){if(e.client){e.licenseBusy=!0;try{await e.client.request("license.remove",{}),e.licenseValid=null,e.licenseKey="",e.licenseTier=null,e.licenseMessage=null,e.setupStep="license"}catch(t){e.licenseMessage=t instanceof Error?t.message:"Failed to remove license"}finally{e.licenseBusy=!1}}}function Xk(e,t){e.licenseKey=t}async function Zk(e){var t,n;if(!(!e.client||!e.connected)&&!e.gatewayHealthLoading){e.gatewayHealthLoading=!0,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("health",{probe:!0});e.gatewayHealthy=i.ok===!0,e.gatewayHealthMessage=i.ok?`Healthy${i.durationMs?` (${i.durationMs}ms)`:""}`:"Unhealthy"}catch(i){e.gatewayHealthy=!1,e.gatewayHealthMessage=`Error: ${String(i)}`}finally{e.gatewayHealthLoading=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function e0(e){var t,n,i;if(!(!e.client||e.gatewayRestartBusy)){e.gatewayRestartBusy=!0,e.gatewayHealthMessage="Restarting...",(t=e.requestUpdate)==null||t.call(e);try{const s=await e.client.request("gateway.restart",{reason:"Manual restart from setup page",delayMs:1e3});if(s.ok&&((n=s.restart)!=null&&n.ok))e.gatewayHealthMessage="Restarting...",setTimeout(()=>{window.location.reload()},3e3);else throw new Error("Restart not scheduled")}catch(s){e.gatewayHealthMessage=`Restart failed: ${String(s)}`,e.gatewayRestartBusy=!1,(i=e.requestUpdate)==null||i.call(e)}}}var t0=Object.defineProperty,n0=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?n0(t,n):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(s=(i?a(t,n,s):a(s))||s);return i&&s&&t0(t,n,s),s};const to=bp();function i0(){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"}function s0(){const e=window.location.pathname;if(e==="/setup"||e.endsWith("/setup"))return!0;if(!window.location.search)return!1;const n=new URLSearchParams(window.location.search).get("setup");if(!n)return!1;const i=n.trim().toLowerCase();return i==="1"||i==="true"||i==="yes"||i==="on"}function o0(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function a0(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function r0(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function l0(){const e=window.location.pathname;return e==="/contacts"||e.endsWith("/contacts")}function c0(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function d0(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends zt{constructor(){super(...arguments),this.settings=ws(),this.password="",this.tab="chat",this.onboarding=i0(),this.setup=s0(),this.filesPage=o0(),this.browserPage=a0(),this.adminsPage=r0(),this.contactsPage=l0(),this.chatPage=c0(),this.advancedPage=d0(),this.advancedTab="cron",this.publicChat=!!window.__TASKMASTER_PUBLIC_CHAT__,this.publicChatConfig=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__??{},this.publicChatSessionKey=null,this.publicChatAuthenticated=!1,this.publicChatAuthStep="idle",this.connected=!1,this.accessState=xu,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=to.name,this.assistantAvatar=to.avatar,this.assistantAgentId=to.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatHistoryTotal=0,this.chatHistoryHasMore=!1,this.chatLoadingOlder=!1,this.chatToolMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatModelProvider=null,this.chatModel=null,this.chatModelCatalog=[],this.chatVerboseLevel=null,this.chatFillerEnabled=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.configLoading=!1,this.configRaw=`{
|
|
4224
|
+
`}const Ck={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Tk={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",recipients:[],toAdmins:!1,timeoutSeconds:"",postToMainPrefix:""};function _k(e){e.basePath=Ff();const t=Ve();if(Ql(t.accentColor),Jl(t.backgroundColor),window.scrollTo(0,0),Pf(e),e.publicChat){const n=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__,i=(n==null?void 0:n.accountId)??"",s=i?i.charAt(0).toUpperCase()+i.slice(1):"Assistant";document.title=`Chat with ${s}`,Ie(e);return}if(e.setup){document.title=`${t.name} Setup`,Ie(e);return}if(e.filesPage){document.title=`${t.name} Files`,If(e),Ie(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Ie(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Ie(e);return}if(e.contactsPage){document.title=`${t.name} Contacts`,Ie(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Ie(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Ie(e);return}Kf(e,!0),Of(e),Uf(e),window.addEventListener("popstate",e.popStateHandler),Df(e),Ie(e),_f(e),e.tab==="logs"&&(e.logsSubTab==="session"?Zo(e):Yo(e)),e.tab==="debug"&&tr(e)}function Mk(e){ph(e)}function Pk(e){var t;window.removeEventListener("popstate",e.popStateHandler),Mf(e),Xo(e),er(e),nr(e),Lf(e),Rf(e),Wf(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Lk(e,t){if(!e.publicChat){if(e.filesPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleFilesLoad&&e.handleFilesLoad(),e.adminsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdminsLoad&&e.handleAdminsLoad(),e.contactsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleContactsLoad&&e.handleContactsLoad(),e.chatPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleChatLoad&&e.handleChatLoad(),e.advancedPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdvancedLoad&&e.handleAdvancedLoad(),e.setup&&e.connected){const n=t.has("connected")&&t.get("connected")===!1;n&&e.handleLicenseStatusCheck&&e.licenseValid===null&&!e.licenseBusy&&e.handleLicenseStatusCheck(),n&&e.handleUpdateCheck&&e.handleUpdateCheck();const i=t.has("setupStep")&&e.setupStep==="auth";(n||i)&&e.setupStep==="auth"&&e.handleAuthStatusCheck&&e.authConnected===null&&!e.authBusy&&e.handleAuthStatusCheck(),e.setupStep==="whatsapp"&&t.has("setupStep")&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(o=>{e.channelsSnapshot=o,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1})),t.has("whatsappLoginConnected")&&e.whatsappLoginConnected===!0&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(s=>{e.channelsSnapshot=s,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1}))}if(e.tab==="chat"&&!e.advancedPage&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),i=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;Jt(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&cc(e,t.has("tab")||t.has("logsAutoFollow"))}}function Ik(e){const t={name:(e==null?void 0:e.name)??"",displayName:(e==null?void 0:e.displayName)??"",about:(e==null?void 0:e.about)??"",picture:(e==null?void 0:e.picture)??"",banner:(e==null?void 0:e.banner)??"",website:(e==null?void 0:e.website)??"",nip05:(e==null?void 0:e.nip05)??"",lud16:(e==null?void 0:e.lud16)??""};return{values:t,original:{...t},saving:!1,importing:!1,error:null,success:null,fieldErrors:{},showAdvanced:!!(e!=null&&e.banner||e!=null&&e.website||e!=null&&e.nip05||e!=null&&e.lud16)}}async function Rk(e,t,n){await Oo(e,t,n),await Y(e,!0)}async function Dk(e,t){await fc(e,t),await Y(e,!0)}async function Nk(e,t){await gc(e,t),await Y(e,!0)}async function Bk(e,t){await mc(e,t)}async function Fk(e,t){await yc(e,t)}async function Ok(e){await gh(e),await Fe(e),await Y(e,!0)}async function Uk(e){await Fe(e),await Y(e,!0)}function Wk(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[i,...s]=n.split(":");if(!i||s.length===0)continue;const o=i.trim(),r=s.join(":").trim();o&&r&&(t[o]=r)}return t}function Ru(e){var n,i,s;return((s=(((i=(n=e.channelsSnapshot)==null?void 0:n.channelAccounts)==null?void 0:i.nostr)??[])[0])==null?void 0:s.accountId)??e.nostrProfileAccountId??"default"}function Du(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Kk(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Ik(n??void 0)}function zk(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Hk(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function qk(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function jk(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Ru(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(Du(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const o=(s==null?void 0:s.error)??`Profile update failed (${i.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Wk(s==null?void 0:s.details)};return}if(!s.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 Y(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function Vk(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Ru(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(Du(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const d=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:d,success:null};return}const o=s.merged??s.imported??null,r=o?{...t.values,...o}:t.values,a=!!(r.banner||r.website||r.nip05||r.lud16);e.nostrProfileFormState={...t,importing:!1,values:r,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:a},s.saved&&await Y(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function Gk(e){if(e.client){e.authBusy=!0,e.authMessage=null;try{const t=await e.client.request("auth.status",{});e.authConnected=t.connected,e.authExpiresIn=t.expiresIn??null,e.authMessage=t.message??null,t.connected&&(e.setupStep="whatsapp")}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to check auth status"}finally{e.authBusy=!1}}}async function Qk(e){if(e.client){e.authBusy=!0,e.authMessage=null,e.authUrl=null,e.authConnected=null;try{const t=await e.client.request("auth.oauth.start",{provider:"anthropic"});e.authUrl=t.authUrl,e.authMessage=t.message??"Sign in with your Claude Pro account"}catch(t){e.authConnected=!1,e.authMessage=t instanceof Error?t.message:"Failed to start auth flow"}finally{e.authBusy=!1}}}async function Jk(e,t){if(e.client){e.authBusy=!0,e.authMessage="Verifying code...";try{await e.client.request("auth.oauth.code",{code:t});const n=await e.client.request("auth.oauth.wait",{timeoutMs:3e4});n.connected?(e.authConnected=!0,e.authMessage=n.message??"Connected to Claude!",e.authUrl=null,e.authCodeInput=""):e.authMessage=n.message??"Still waiting for authorization..."}catch(n){e.authConnected=!1,e.authMessage=n instanceof Error?n.message:"Verification failed"}finally{e.authBusy=!1}}}function Yk(e,t){e.authCodeInput=t}function Xk(e){e.setupStep="whatsapp"}async function Zk(e){if(e.client){e.licenseBusy=!0,e.licenseMessage=null;try{const t=await e.client.request("license.status",{});e.licenseDeviceId=t.deviceId??null,e.licenseStoredKey=t.key??null,t.licensed?(e.licenseValid=!0,e.licenseTier=t.tier??null,e.setupStep="auth"):(e.licenseValid=null,e.setupStep="license")}catch(t){const n=t instanceof Error?t.message:String(t);n.includes("unknown method")?(e.licenseValid=!0,e.setupStep="auth"):(e.licenseValid=null,e.licenseMessage=n,e.setupStep="license")}finally{e.licenseBusy=!1}}}async function e0(e){if(e.client&&e.licenseKey.trim()){e.licenseBusy=!0,e.licenseMessage=null,e.licenseValid=null;try{const t=await e.client.request("license.activate",{key:e.licenseKey.trim()});t.valid?(e.licenseValid=!0,e.licenseMessage=t.message??"License activated",e.licenseTier=t.tier??null,setTimeout(()=>{e.setupStep="auth"},1500)):(e.licenseValid=!1,e.licenseMessage=t.message??"Invalid license key")}catch(t){e.licenseValid=!1,e.licenseMessage=t instanceof Error?t.message:"Activation failed"}finally{e.licenseBusy=!1}}}async function t0(e){if(e.client){e.licenseBusy=!0;try{await e.client.request("license.remove",{}),e.licenseValid=null,e.licenseKey="",e.licenseTier=null,e.licenseMessage=null,e.setupStep="license"}catch(t){e.licenseMessage=t instanceof Error?t.message:"Failed to remove license"}finally{e.licenseBusy=!1}}}function n0(e,t){e.licenseKey=t}async function i0(e){var t,n;if(!(!e.client||!e.connected)&&!e.gatewayHealthLoading){e.gatewayHealthLoading=!0,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("health",{probe:!0});e.gatewayHealthy=i.ok===!0,e.gatewayHealthMessage=i.ok?`Healthy${i.durationMs?` (${i.durationMs}ms)`:""}`:"Unhealthy"}catch(i){e.gatewayHealthy=!1,e.gatewayHealthMessage=`Error: ${String(i)}`}finally{e.gatewayHealthLoading=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function s0(e){var t,n,i;if(!(!e.client||e.gatewayRestartBusy)){e.gatewayRestartBusy=!0,e.gatewayHealthMessage="Restarting...",(t=e.requestUpdate)==null||t.call(e);try{const s=await e.client.request("gateway.restart",{reason:"Manual restart from setup page",delayMs:1e3});if(s.ok&&((n=s.restart)!=null&&n.ok))e.gatewayHealthMessage="Restarting...",setTimeout(()=>{window.location.reload()},3e3);else throw new Error("Restart not scheduled")}catch(s){e.gatewayHealthMessage=`Restart failed: ${String(s)}`,e.gatewayRestartBusy=!1,(i=e.requestUpdate)==null||i.call(e)}}}var o0=Object.defineProperty,r0=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?r0(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(s=(i?r(t,n,s):r(s))||s);return i&&s&&o0(t,n,s),s};const to=wp();function a0(){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"}function l0(){const e=window.location.pathname;if(e==="/setup"||e.endsWith("/setup"))return!0;if(!window.location.search)return!1;const n=new URLSearchParams(window.location.search).get("setup");if(!n)return!1;const i=n.trim().toLowerCase();return i==="1"||i==="true"||i==="yes"||i==="on"}function c0(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function d0(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function u0(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function p0(){const e=window.location.pathname;return e==="/contacts"||e.endsWith("/contacts")}function h0(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function f0(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends zt{constructor(){super(...arguments),this.settings=ws(),this.password="",this.tab="chat",this.onboarding=a0(),this.setup=l0(),this.filesPage=c0(),this.browserPage=d0(),this.adminsPage=u0(),this.contactsPage=p0(),this.chatPage=h0(),this.advancedPage=f0(),this.advancedTab="cron",this.publicChat=!!window.__TASKMASTER_PUBLIC_CHAT__,this.publicChatConfig=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__??{},this.publicChatSessionKey=null,this.publicChatAuthenticated=!1,this.publicChatAuthStep="idle",this.connected=!1,this.accessState=Au,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=to.name,this.assistantAvatar=to.avatar,this.assistantAgentId=to.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatHistoryTotal=0,this.chatHistoryHasMore=!1,this.chatLoadingOlder=!1,this.chatToolMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatModelProvider=null,this.chatModel=null,this.chatModelCatalog=[],this.chatVerboseLevel=null,this.chatFillerEnabled=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.configLoading=!1,this.configRaw=`{
|
|
4110
4225
|
}
|
|
4111
|
-
`,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.whatsappActiveQrAccountId=null,this.whatsappPairedPhone=null,this.addingWhatsAppAccount=!1,this.newWhatsAppAccountName="",this.whatsappAccountError=null,this.whatsappAccountSaving=!1,this.whatsappSettingsOpen=!1,this.publicChatToggleBusy=!1,this.brandingBusy=!1,this.brandingExpanded=!1,this.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleFunnelEnableUrl=null,this.tailscaleDisableConfirm=!1,this.wifiStatus=null,this.wifiNetworks=[],this.wifiBusy=!1,this.wifiError=null,this.wifiPassword="",this.wifiSelectedSsid=null,this.licenseKey="",this.licenseBusy=!1,this.licenseValid=null,this.licenseMessage=null,this.licenseTier=null,this.licenseDeviceId=null,this.licenseStoredKey=null,this.licenseRemoveConfirm=!1,this.authConnected=null,this.authBusy=!1,this.authMessage=null,this.authUrl=null,this.authCodeInput="",this.authExpiresIn=null,this.setupStep="license",this.gatewayHealthy=null,this.gatewayHealthLoading=!1,this.gatewayHealthMessage=null,this.gatewayRestartBusy=!1,this.updateAvailable=null,this.currentVersion=null,this.latestVersion=null,this.updateChecking=!1,this.updateMessage=null,this.updateProgressSteps=[],this.updateLastResult=null,this.uninstallConfirm=!1,this.uninstallBusy=!1,this.uninstallDone=!1,this.uninstallError=null,this.uninstallConfirmText="",this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...xk},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.cronEditJobId=null,this.cronPendingDeleteId=null,this.cronRunModalJobId=null,this.cronRunModalJobName="",this.cronRunResult=null,this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserFullscreen=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesCurrentDir=".",this.filesPendingDeletePath=null,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.embeddingDownloading=!1,this.embeddingPollTimer=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.filesResolvedAgentId=void 0,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillsTypeFilter="all",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillDetail=null,this.skillDetailTab="",this.skillAddModal=!1,this.skillAddForm={name:"",skillContent:"",references:[]},this.skillAddFormSource="draft",this.skillEditTab="SKILL.md",this.skillDrafts=[],this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.contactsLoading=!1,this.contactsSaving=!1,this.contactsRecords=[],this.contactsError=null,this.contactsSearchQuery="",this.contactsEditingId=null,this.contactsShowAddForm=!1,this.contactsNewPhone="",this.contactsNewName="",this.contactsDeleteConfirmId=null,this.contactsAddFieldForId=null,this.contactsAddFieldKey="",this.contactsAddFieldValue="",this.imessageEnableConfirm=!1,this.imessageEnabling=!1,this.infoModalOpen=null,this.workspaces=[],this.workspacesLoading=!1,this.workspacesError=null,this.selectedWorkspace=null,this.addingWorkspace=!1,this.newWorkspaceName="",this.newWorkspacePath="",this.newWorkspacePin="",this.accountPinModalOpen=!1,this.accountPinBusy=!1,this.accountPinError=null,this.accountPinSuccess=null,this.apiKeyProviders=[],this.apiKeyModalOpen=!1,this.apiKeyBusy=!1,this.apiKeyError=null,this.apiKeySuccess=null,this.apiKeySavingProvider=null,this.authApiKeyMode=!1,this.authApiKeyInput="",this.authApiKeyBusy=!1,this.authApiKeyError=null,this.pinChanging=null,this.pinChangeBusy=!1,this.pinChangeError=null,this.loginChangePinMode=!1,this.changePinBusy=!1,this.changePinError=null,this.changePinSuccess=null,this.workspaceSaving=!1,this.workspaceRemoveConfirm=null,this.renamingWorkspace=!1,this.renameWorkspaceName="",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={...Sk},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.logsSubTab="session",this.logsChipsExpanded=!1,this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,tool_call:!0,tool_result:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsChipsExpanded=!1,this.sessionLogsExpandedIds=new Set,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.onLoadOlder=()=>this.handleLoadOlderChat(),this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>Wf(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,this._beforeUnloadHandler=()=>{var t;so();const e=this.selectedWorkspace??((t=this.publicChatConfig)==null?void 0:t.accountId)??"";e&&In(e,this.sessionKey,this.chatMessage)}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ak(this),window.addEventListener("beforeunload",this._beforeUnloadHandler)}firstUpdated(){Ck(this)}disconnectedCallback(){window.removeEventListener("beforeunload",this._beforeUnloadHandler),this.stopEmbeddingPoll(),Ek(this),super.disconnectedCallback()}startEmbeddingPoll(){if(this.embeddingPollTimer!=null)return;const e=async()=>{if(!(!this.client||!this.connected)){try{const t=await this.client.request("memory.status",{});if((t==null?void 0:t.embeddingState)==="downloading")this.embeddingDownloading=!0;else{this.embeddingDownloading&&(this.embeddingDownloading=!1),this.stopEmbeddingPoll();return}}catch{this.embeddingDownloading=!1,this.stopEmbeddingPoll();return}this.embeddingPollTimer=window.setTimeout(e,3e3)}};e()}stopEmbeddingPoll(){this.embeddingPollTimer!=null&&(window.clearTimeout(this.embeddingPollTimer),this.embeddingPollTimer=null)}updated(e){Tk(this,e)}connect(){Ie(this)}handleChatScroll(e){sh(this,e)}handleLogsScroll(e){ah(this,e)}handleSessionLogsScroll(e){rh(this,e)}exportLogs(e,t){ch(e,t)}exportSessionLogs(e,t){dh(e,t)}resetToolStream(){Fo(this)}resetChatScroll(){lh(this)}async loadAssistantIdentity(){await _o(this)}applySettings(e){nt(this,e)}setTab(e){Df(this,e)}setTheme(e,t){Bf(this,e,t)}async loadOverview(){await cd(this)}async loadCron(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.cronForm={...this.cronForm,accountId:(e==null?void 0:e.whatsappAccountId)??void 0},await ia(this)}async handleAbortChat(){await ud(this)}removeQueuedMessage(e){jf(this,e)}async handleSendChat(e,t){await Vf(this,e,t)}async handleWhatsAppStart(e,t){await Mk(this,e,t)}async handleWhatsAppWait(e){await Pk(this,e)}async handleWhatsAppLogout(e){await Lk(this,e)}async handleAddWhatsAppAccount(e){await Ik(this,e)}async handleRemoveWhatsAppAccount(e){await Rk(this,e)}async handleAccessCheck(){await Bl(this)}async handlePinSubmit(e,t){await ik(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await sk(this,e)}async handleLogout(){await ak(this)}toggleChangePinMode(){this.loginChangePinMode=!this.loginChangePinMode,this.changePinError=null,this.changePinSuccess=null}async handleChangePin(e,t,n){if(this.client){this.changePinBusy=!0,this.changePinError=null,this.changePinSuccess=null;try{const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.changePinError=i.message??"Incorrect current PIN",this.changePinBusy=!1;return}e==="__master__"?await this.client.request("access.setMasterPin",{pin:n}):await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.changePinSuccess="PIN changed successfully",this.changePinBusy=!1,setTimeout(()=>{this.loginChangePinMode=!1,this.changePinSuccess=null},2e3)}catch{this.changePinError="Failed to change PIN",this.changePinBusy=!1}}}async handleAccountPinSave(e,t,n){if(this.client){this.accountPinBusy=!0,this.accountPinError=null,this.accountPinSuccess=null;try{if(t!==null){const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.accountPinError=i.message??"Incorrect current PIN",this.accountPinBusy=!1;return}}await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.accountPinSuccess="PIN saved",this.accountPinBusy=!1,await Bl(this),setTimeout(()=>{this.accountPinModalOpen=!1,this.accountPinSuccess=null,this.accountPinError=null},1500)}catch{this.accountPinError="Failed to save PIN",this.accountPinBusy=!1}}}async handleLicenseStatusCheck(){await Qk(this)}async handleLicenseActivate(){await Yk(this)}async handleLicenseRemove(){await Jk(this)}handleLicenseKeyChange(e){Xk(this,e)}async handleAuthStatusCheck(){await qk(this)}async handleAuthStart(){await Hk(this)}async handleAuthSubmitCode(e){await jk(this,e)}handleAuthCodeChange(e){Vk(this,e)}handleSkipToWhatsApp(){Gk(this)}async handleGatewayHealthCheck(){await Zk(this)}async handleGatewayRestart(){await e0(this)}async handleUpdateCheck(){await wu(this)}async handleUpdateRun(){await Uw(this)}handleUpdateDismissResult(){zw(this)}handleUninstallConfirm(){this.uninstallConfirm=!0,this.uninstallConfirmText=""}handleUninstallCancel(){this.uninstallConfirm=!1,this.uninstallConfirmText="",this.uninstallError=null}handleUninstallConfirmTextChange(e){this.uninstallConfirmText=e}async handleUninstallRun(){const{runUninstall:e}=await ae(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>yr);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){ae(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>yr);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await id(this)}async clearAudit(){await gf(this),this.auditModalOpen=!1}handleFilesLoad(){var n;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((n=e==null?void 0:e.agents)==null?void 0:n.map(i=>i.id))??void 0;const t=this.resolveFilesAgentId();this.filesResolvedAgentId=t,Zt(this,t),Yo(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();ae(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>lk);return{loadAdmins:t}},void 0,import.meta.url).then(({loadAdmins:t})=>{t(this,e)})}resolveAdminAgentId(){const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(n=>n.id.endsWith("-admin")||n.id==="admin");return t==null?void 0:t.id}resolveFilesAgentId(){var n;const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return(t==null?void 0:t.id)??((n=e.agents[0])==null?void 0:n.id)}handleChatLoad(){const e=this.resolveAdminAgentId();if(e){const t=`agent:${e}:main`;t!==this.sessionKey&&(this.sessionKey=t,this.chatMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatRunId=null,this.chatSuggestion=null,this.resetChatScroll(),this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}ae(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>Ci);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this).then(()=>{Yt(this,!0)})})}async handleLoadOlderChat(){if(this.chatLoadingOlder||!this.chatHistoryHasMore)return;const e=oh(this),{loadOlderChatHistory:t}=await ae(async()=>{const{loadOlderChatHistory:i}=await Promise.resolve().then(()=>Ci);return{loadOlderChatHistory:i}},void 0,import.meta.url);await t(this)&&e&&(await this.updateComplete,e())}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.loadCron(),this.advancedTab==="logs"&&(this.logsSubTab==="session"?ae(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>nd);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):ae(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>Eh);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&ae(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>lf);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Dk(this)}async handleChannelConfigReload(){await Bk(this)}handleNostrProfileEdit(e,t){Fk(this,e,t)}handleNostrProfileCancel(){Ok(this)}handleNostrProfileFieldChange(e,t){Uk(this,e,t)}async handleNostrProfileSave(){await Wk(this)}async handleNostrProfileImport(){await zk(this)}handleNostrProfileToggleAdvanced(){Kk(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}}}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})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleContactsLoad(){const e=this.selectedWorkspace??void 0;ae(async()=>{const{loadContacts:t}=await Promise.resolve().then(()=>ck);return{loadContacts:t}},void 0,import.meta.url).then(({loadContacts:t})=>{t(this,e)})}handleContactsNewPhoneChange(e){this.contactsNewPhone=e,this.contactsError&&(this.contactsError=null)}handleContactsNewNameChange(e){this.contactsNewName=e,this.contactsError&&(this.contactsError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await ae(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>hi);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await ae(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>hi);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await ae(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>$h);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const o=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,o),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(o),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await ae(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>hi);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=(e==null?void 0:e.displayName)??(e==null?void 0:e.name)??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await ae(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>hi);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){so(),this.selectedWorkspace&&In(this.selectedWorkspace,this.sessionKey,this.chatMessage),this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),kn(e),ir(e),this.settings=ws(),this.chatMessage=Rn(e,this.settings.sessionKey),this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.reloadCurrentPageData()}getSelectedWorkspaceInfo(){return this.selectedWorkspace?this.workspaces.find(e=>e.name===this.selectedWorkspace)??null:null}reloadCurrentPageData(){this.loadAuditEntries(),this.adminsPage?this.handleAdminsLoad():this.contactsPage?this.handleContactsLoad():this.filesPage?this.handleFilesLoad():this.chatPage?this.handleChatLoad():this.advancedPage&&this.handleAdvancedLoad()}initWorkspaceSelection(){if(this.workspaces.length===0){this.reloadCurrentPageData();return}const e=localStorage.getItem("taskmaster-selected-workspace"),t=e?this.workspaces.find(n=>n.name===e):null;if(t)this.selectedWorkspace=t.name;else{const n=this.workspaces.find(i=>i.isDefault)??this.workspaces[0];this.selectedWorkspace=n.name,localStorage.setItem("taskmaster-selected-workspace",n.name)}kn(this.selectedWorkspace),ir(this.selectedWorkspace),this.settings=ws(),this.chatMessage=Rn(this.selectedWorkspace,this.settings.sessionKey),this.reloadCurrentPageData()}render(){return u`${wk(this)}${this.auditModalOpen?$k(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):k}`}};m([y()],g.prototype,"settings",2);m([y()],g.prototype,"password",2);m([y()],g.prototype,"tab",2);m([y()],g.prototype,"onboarding",2);m([y()],g.prototype,"setup",2);m([y()],g.prototype,"filesPage",2);m([y()],g.prototype,"browserPage",2);m([y()],g.prototype,"adminsPage",2);m([y()],g.prototype,"contactsPage",2);m([y()],g.prototype,"chatPage",2);m([y()],g.prototype,"advancedPage",2);m([y()],g.prototype,"advancedTab",2);m([y()],g.prototype,"publicChat",2);m([y()],g.prototype,"publicChatConfig",2);m([y()],g.prototype,"publicChatSessionKey",2);m([y()],g.prototype,"publicChatAuthenticated",2);m([y()],g.prototype,"publicChatAuthStep",2);m([y()],g.prototype,"connected",2);m([y()],g.prototype,"accessState",2);m([y()],g.prototype,"theme",2);m([y()],g.prototype,"themeResolved",2);m([y()],g.prototype,"hello",2);m([y()],g.prototype,"lastError",2);m([y()],g.prototype,"eventLog",2);m([y()],g.prototype,"assistantName",2);m([y()],g.prototype,"assistantAvatar",2);m([y()],g.prototype,"assistantAgentId",2);m([y()],g.prototype,"sessionKey",2);m([y()],g.prototype,"chatLoading",2);m([y()],g.prototype,"chatSending",2);m([y()],g.prototype,"chatMessage",2);m([y()],g.prototype,"chatMessages",2);m([y()],g.prototype,"chatHistoryTotal",2);m([y()],g.prototype,"chatHistoryHasMore",2);m([y()],g.prototype,"chatLoadingOlder",2);m([y()],g.prototype,"chatToolMessages",2);m([y()],g.prototype,"chatStream",2);m([y()],g.prototype,"chatInterimText",2);m([y()],g.prototype,"chatSuggestion",2);m([y()],g.prototype,"chatStreamStartedAt",2);m([y()],g.prototype,"chatRunId",2);m([y()],g.prototype,"compactionStatus",2);m([y()],g.prototype,"chatAvatarUrl",2);m([y()],g.prototype,"chatThinkingLevel",2);m([y()],g.prototype,"chatModelProvider",2);m([y()],g.prototype,"chatModel",2);m([y()],g.prototype,"chatModelCatalog",2);m([y()],g.prototype,"chatVerboseLevel",2);m([y()],g.prototype,"chatFillerEnabled",2);m([y()],g.prototype,"chatQueue",2);m([y()],g.prototype,"chatAttachments",2);m([y()],g.prototype,"sidebarOpen",2);m([y()],g.prototype,"sidebarContent",2);m([y()],g.prototype,"sidebarError",2);m([y()],g.prototype,"splitRatio",2);m([y()],g.prototype,"nodesLoading",2);m([y()],g.prototype,"nodes",2);m([y()],g.prototype,"devicesLoading",2);m([y()],g.prototype,"devicesError",2);m([y()],g.prototype,"devicesList",2);m([y()],g.prototype,"execApprovalsLoading",2);m([y()],g.prototype,"execApprovalsSaving",2);m([y()],g.prototype,"execApprovalsDirty",2);m([y()],g.prototype,"execApprovalsSnapshot",2);m([y()],g.prototype,"execApprovalsForm",2);m([y()],g.prototype,"execApprovalsSelectedAgent",2);m([y()],g.prototype,"execApprovalsTarget",2);m([y()],g.prototype,"execApprovalsTargetNodeId",2);m([y()],g.prototype,"execApprovalQueue",2);m([y()],g.prototype,"execApprovalBusy",2);m([y()],g.prototype,"execApprovalError",2);m([y()],g.prototype,"configLoading",2);m([y()],g.prototype,"configRaw",2);m([y()],g.prototype,"configRawOriginal",2);m([y()],g.prototype,"configValid",2);m([y()],g.prototype,"configIssues",2);m([y()],g.prototype,"configSaving",2);m([y()],g.prototype,"configApplying",2);m([y()],g.prototype,"updateRunning",2);m([y()],g.prototype,"applySessionKey",2);m([y()],g.prototype,"configSnapshot",2);m([y()],g.prototype,"configSchema",2);m([y()],g.prototype,"configSchemaVersion",2);m([y()],g.prototype,"configSchemaLoading",2);m([y()],g.prototype,"configUiHints",2);m([y()],g.prototype,"configForm",2);m([y()],g.prototype,"configFormOriginal",2);m([y()],g.prototype,"configFormDirty",2);m([y()],g.prototype,"configFormMode",2);m([y()],g.prototype,"configSearchQuery",2);m([y()],g.prototype,"configActiveSection",2);m([y()],g.prototype,"configActiveSubsection",2);m([y()],g.prototype,"channelsLoading",2);m([y()],g.prototype,"channelsSnapshot",2);m([y()],g.prototype,"channelsError",2);m([y()],g.prototype,"channelsLastSuccess",2);m([y()],g.prototype,"whatsappLoginMessage",2);m([y()],g.prototype,"whatsappLoginQrDataUrl",2);m([y()],g.prototype,"whatsappLoginConnected",2);m([y()],g.prototype,"whatsappBusy",2);m([y()],g.prototype,"whatsappActiveQrAccountId",2);m([y()],g.prototype,"whatsappPairedPhone",2);m([y()],g.prototype,"addingWhatsAppAccount",2);m([y()],g.prototype,"newWhatsAppAccountName",2);m([y()],g.prototype,"whatsappAccountError",2);m([y()],g.prototype,"whatsappAccountSaving",2);m([y()],g.prototype,"whatsappSettingsOpen",2);m([y()],g.prototype,"publicChatToggleBusy",2);m([y()],g.prototype,"brandingBusy",2);m([y()],g.prototype,"brandingExpanded",2);m([y()],g.prototype,"tailscaleStatus",2);m([y()],g.prototype,"tailscaleBusy",2);m([y()],g.prototype,"tailscaleAuthUrl",2);m([y()],g.prototype,"tailscaleError",2);m([y()],g.prototype,"tailscaleFunnelEnableUrl",2);m([y()],g.prototype,"tailscaleDisableConfirm",2);m([y()],g.prototype,"wifiStatus",2);m([y()],g.prototype,"wifiNetworks",2);m([y()],g.prototype,"wifiBusy",2);m([y()],g.prototype,"wifiError",2);m([y()],g.prototype,"wifiPassword",2);m([y()],g.prototype,"wifiSelectedSsid",2);m([y()],g.prototype,"licenseKey",2);m([y()],g.prototype,"licenseBusy",2);m([y()],g.prototype,"licenseValid",2);m([y()],g.prototype,"licenseMessage",2);m([y()],g.prototype,"licenseTier",2);m([y()],g.prototype,"licenseDeviceId",2);m([y()],g.prototype,"licenseStoredKey",2);m([y()],g.prototype,"licenseRemoveConfirm",2);m([y()],g.prototype,"authConnected",2);m([y()],g.prototype,"authBusy",2);m([y()],g.prototype,"authMessage",2);m([y()],g.prototype,"authUrl",2);m([y()],g.prototype,"authCodeInput",2);m([y()],g.prototype,"authExpiresIn",2);m([y()],g.prototype,"setupStep",2);m([y()],g.prototype,"gatewayHealthy",2);m([y()],g.prototype,"gatewayHealthLoading",2);m([y()],g.prototype,"gatewayHealthMessage",2);m([y()],g.prototype,"gatewayRestartBusy",2);m([y()],g.prototype,"updateAvailable",2);m([y()],g.prototype,"currentVersion",2);m([y()],g.prototype,"latestVersion",2);m([y()],g.prototype,"updateChecking",2);m([y()],g.prototype,"updateMessage",2);m([y()],g.prototype,"updateProgressSteps",2);m([y()],g.prototype,"updateLastResult",2);m([y()],g.prototype,"uninstallConfirm",2);m([y()],g.prototype,"uninstallBusy",2);m([y()],g.prototype,"uninstallDone",2);m([y()],g.prototype,"uninstallError",2);m([y()],g.prototype,"uninstallConfirmText",2);m([y()],g.prototype,"nostrProfileFormState",2);m([y()],g.prototype,"nostrProfileAccountId",2);m([y()],g.prototype,"presenceLoading",2);m([y()],g.prototype,"presenceEntries",2);m([y()],g.prototype,"presenceError",2);m([y()],g.prototype,"presenceStatus",2);m([y()],g.prototype,"agentsLoading",2);m([y()],g.prototype,"agentsList",2);m([y()],g.prototype,"agentsError",2);m([y()],g.prototype,"sessionsLoading",2);m([y()],g.prototype,"sessionsResult",2);m([y()],g.prototype,"sessionsError",2);m([y()],g.prototype,"cronLoading",2);m([y()],g.prototype,"cronJobs",2);m([y()],g.prototype,"cronStatus",2);m([y()],g.prototype,"cronError",2);m([y()],g.prototype,"cronForm",2);m([y()],g.prototype,"cronRunsJobId",2);m([y()],g.prototype,"cronRuns",2);m([y()],g.prototype,"cronBusy",2);m([y()],g.prototype,"cronNewEventModal",2);m([y()],g.prototype,"cronDetailJobId",2);m([y()],g.prototype,"cronEditJobId",2);m([y()],g.prototype,"cronPendingDeleteId",2);m([y()],g.prototype,"cronRunModalJobId",2);m([y()],g.prototype,"cronRunModalJobName",2);m([y()],g.prototype,"cronRunResult",2);m([y()],g.prototype,"browserScreencastActive",2);m([y()],g.prototype,"browserScreencastFrame",2);m([y()],g.prototype,"browserScreencastMetadata",2);m([y()],g.prototype,"browserHandoffPending",2);m([y()],g.prototype,"browserHandoffReason",2);m([y()],g.prototype,"browserHandoffId",2);m([y()],g.prototype,"browserInputMode",2);m([y()],g.prototype,"browserFullscreen",2);m([y()],g.prototype,"browserLoading",2);m([y()],g.prototype,"browserError",2);m([y()],g.prototype,"filesLoading",2);m([y()],g.prototype,"filesTree",2);m([y()],g.prototype,"filesRoot",2);m([y()],g.prototype,"filesError",2);m([y()],g.prototype,"filesSelectedPath",2);m([y()],g.prototype,"filesSelectedPaths",2);m([y()],g.prototype,"filesPreviewContent",2);m([y()],g.prototype,"filesPreviewLoading",2);m([y()],g.prototype,"filesPreviewBinary",2);m([y()],g.prototype,"filesPreviewSize",2);m([y()],g.prototype,"filesExpandedDirs",2);m([y()],g.prototype,"filesCurrentDir",2);m([y()],g.prototype,"filesPendingDeletePath",2);m([y()],g.prototype,"filesMessage",2);m([y()],g.prototype,"filesUploadBusy",2);m([y()],g.prototype,"filesReindexBusy",2);m([y()],g.prototype,"filesMemoryStatus",2);m([y()],g.prototype,"embeddingDownloading",2);m([y()],g.prototype,"filesSearchQuery",2);m([y()],g.prototype,"filesSearchResults",2);m([y()],g.prototype,"filesSearchLoading",2);m([y()],g.prototype,"filesSearchAgentId",2);m([y()],g.prototype,"auditEntries",2);m([y()],g.prototype,"auditLoading",2);m([y()],g.prototype,"auditModalOpen",2);m([y()],g.prototype,"skillsLoading",2);m([y()],g.prototype,"skillsReport",2);m([y()],g.prototype,"skillsError",2);m([y()],g.prototype,"skillsFilter",2);m([y()],g.prototype,"skillsTypeFilter",2);m([y()],g.prototype,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",2);m([y()],g.prototype,"skillDetail",2);m([y()],g.prototype,"skillDetailTab",2);m([y()],g.prototype,"skillAddModal",2);m([y()],g.prototype,"skillAddForm",2);m([y()],g.prototype,"skillAddFormSource",2);m([y()],g.prototype,"skillEditTab",2);m([y()],g.prototype,"skillDrafts",2);m([y()],g.prototype,"adminsLoading",2);m([y()],g.prototype,"adminPhones",2);m([y()],g.prototype,"adminsError",2);m([y()],g.prototype,"adminsSaving",2);m([y()],g.prototype,"adminsNewPhone",2);m([y()],g.prototype,"contactsLoading",2);m([y()],g.prototype,"contactsSaving",2);m([y()],g.prototype,"contactsRecords",2);m([y()],g.prototype,"contactsError",2);m([y()],g.prototype,"contactsSearchQuery",2);m([y()],g.prototype,"contactsEditingId",2);m([y()],g.prototype,"contactsShowAddForm",2);m([y()],g.prototype,"contactsNewPhone",2);m([y()],g.prototype,"contactsNewName",2);m([y()],g.prototype,"contactsDeleteConfirmId",2);m([y()],g.prototype,"contactsAddFieldForId",2);m([y()],g.prototype,"contactsAddFieldKey",2);m([y()],g.prototype,"contactsAddFieldValue",2);m([y()],g.prototype,"imessageEnableConfirm",2);m([y()],g.prototype,"imessageEnabling",2);m([y()],g.prototype,"infoModalOpen",2);m([y()],g.prototype,"workspaces",2);m([y()],g.prototype,"workspacesLoading",2);m([y()],g.prototype,"workspacesError",2);m([y()],g.prototype,"selectedWorkspace",2);m([y()],g.prototype,"addingWorkspace",2);m([y()],g.prototype,"newWorkspaceName",2);m([y()],g.prototype,"newWorkspacePath",2);m([y()],g.prototype,"newWorkspacePin",2);m([y()],g.prototype,"accountPinModalOpen",2);m([y()],g.prototype,"accountPinBusy",2);m([y()],g.prototype,"accountPinError",2);m([y()],g.prototype,"accountPinSuccess",2);m([y()],g.prototype,"apiKeyProviders",2);m([y()],g.prototype,"apiKeyModalOpen",2);m([y()],g.prototype,"apiKeyBusy",2);m([y()],g.prototype,"apiKeyError",2);m([y()],g.prototype,"apiKeySuccess",2);m([y()],g.prototype,"apiKeySavingProvider",2);m([y()],g.prototype,"authApiKeyMode",2);m([y()],g.prototype,"authApiKeyInput",2);m([y()],g.prototype,"authApiKeyBusy",2);m([y()],g.prototype,"authApiKeyError",2);m([y()],g.prototype,"pinChanging",2);m([y()],g.prototype,"pinChangeBusy",2);m([y()],g.prototype,"pinChangeError",2);m([y()],g.prototype,"loginChangePinMode",2);m([y()],g.prototype,"changePinBusy",2);m([y()],g.prototype,"changePinError",2);m([y()],g.prototype,"changePinSuccess",2);m([y()],g.prototype,"workspaceSaving",2);m([y()],g.prototype,"workspaceRemoveConfirm",2);m([y()],g.prototype,"renamingWorkspace",2);m([y()],g.prototype,"renameWorkspaceName",2);m([y()],g.prototype,"debugLoading",2);m([y()],g.prototype,"debugStatus",2);m([y()],g.prototype,"debugHealth",2);m([y()],g.prototype,"debugModels",2);m([y()],g.prototype,"debugHeartbeat",2);m([y()],g.prototype,"debugCallMethod",2);m([y()],g.prototype,"debugCallParams",2);m([y()],g.prototype,"debugCallResult",2);m([y()],g.prototype,"debugCallError",2);m([y()],g.prototype,"logsLoading",2);m([y()],g.prototype,"logsError",2);m([y()],g.prototype,"logsFile",2);m([y()],g.prototype,"logsEntries",2);m([y()],g.prototype,"logsFilterText",2);m([y()],g.prototype,"logsLevelFilters",2);m([y()],g.prototype,"logsAutoFollow",2);m([y()],g.prototype,"logsTruncated",2);m([y()],g.prototype,"logsCursor",2);m([y()],g.prototype,"logsLastFetchAt",2);m([y()],g.prototype,"logsLimit",2);m([y()],g.prototype,"logsMaxBytes",2);m([y()],g.prototype,"logsAtBottom",2);m([y()],g.prototype,"logsSubTab",2);m([y()],g.prototype,"logsChipsExpanded",2);m([y()],g.prototype,"sessionLogsLoading",2);m([y()],g.prototype,"sessionLogsError",2);m([y()],g.prototype,"sessionLogsEntries",2);m([y()],g.prototype,"sessionLogsFilterText",2);m([y()],g.prototype,"sessionLogsTypeFilters",2);m([y()],g.prototype,"sessionLogsAgentFilters",2);m([y()],g.prototype,"sessionLogsAgents",2);m([y()],g.prototype,"sessionLogsAutoFollow",2);m([y()],g.prototype,"sessionLogsChipsExpanded",2);m([y()],g.prototype,"sessionLogsCursors",2);m([y()],g.prototype,"sessionLogsLastFetchAt",2);m([y()],g.prototype,"sessionLogsAtBottom",2);m([y()],g.prototype,"chatUserNearBottom",2);g=m([Vl("taskmaster-app")],g);
|
|
4112
|
-
//# sourceMappingURL=index-
|
|
4226
|
+
`,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.whatsappActiveQrAccountId=null,this.whatsappPairedPhone=null,this.addingWhatsAppAccount=!1,this.newWhatsAppAccountName="",this.whatsappAccountError=null,this.whatsappAccountSaving=!1,this.whatsappSettingsOpen=!1,this.publicChatToggleBusy=!1,this.brandingBusy=!1,this.brandingExpanded=!1,this.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleFunnelEnableUrl=null,this.tailscaleDisableConfirm=!1,this.wifiStatus=null,this.wifiNetworks=[],this.wifiBusy=!1,this.wifiError=null,this.wifiPassword="",this.wifiSelectedSsid=null,this.networkPort=null,this.networkHostname="",this.networkPortInput="",this.networkHostnameInput="",this.networkModalOpen=!1,this.networkBusy=!1,this.networkError=null,this.networkSuccess=null,this.wifiModalOpen=!1,this.licenseKey="",this.licenseBusy=!1,this.licenseValid=null,this.licenseMessage=null,this.licenseTier=null,this.licenseDeviceId=null,this.licenseStoredKey=null,this.licenseRemoveConfirm=!1,this.authConnected=null,this.authBusy=!1,this.authMessage=null,this.authUrl=null,this.authCodeInput="",this.authExpiresIn=null,this.setupStep="license",this.gatewayHealthy=null,this.gatewayHealthLoading=!1,this.gatewayHealthMessage=null,this.gatewayRestartBusy=!1,this.updateAvailable=null,this.currentVersion=null,this.latestVersion=null,this.updateChecking=!1,this.updateMessage=null,this.updateProgressSteps=[],this.updateLastResult=null,this.uninstallConfirm=!1,this.uninstallBusy=!1,this.uninstallDone=!1,this.uninstallError=null,this.uninstallConfirmText="",this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Tk},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=null,this.cronEditJobId=null,this.cronPendingDeleteId=null,this.cronRunModalJobId=null,this.cronRunModalJobName="",this.cronRunResult=null,this.browserScreencastActive=!1,this.browserScreencastFrame=null,this.browserScreencastMetadata=null,this.browserHandoffPending=!1,this.browserHandoffReason=null,this.browserHandoffId=null,this.browserInputMode=!1,this.browserFullscreen=!1,this.browserLoading=!1,this.browserError=null,this.filesLoading=!1,this.filesTree=[],this.filesRoot="",this.filesError=null,this.filesSelectedPath=null,this.filesSelectedPaths=new Set,this.filesPreviewContent=null,this.filesPreviewLoading=!1,this.filesPreviewBinary=!1,this.filesPreviewSize=null,this.filesExpandedDirs=new Set,this.filesCurrentDir=".",this.filesPendingDeletePath=null,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.embeddingDownloading=!1,this.embeddingPollTimer=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.filesResolvedAgentId=void 0,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillsTypeFilter="all",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.skillDetail=null,this.skillDetailTab="",this.skillAddModal=!1,this.skillAddForm={name:"",skillContent:"",references:[]},this.skillAddFormSource="draft",this.skillEditTab="SKILL.md",this.skillDrafts=[],this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.contactsLoading=!1,this.contactsSaving=!1,this.contactsRecords=[],this.contactsError=null,this.contactsSearchQuery="",this.contactsEditingId=null,this.contactsShowAddForm=!1,this.contactsNewPhone="",this.contactsNewName="",this.contactsDeleteConfirmId=null,this.contactsAddFieldForId=null,this.contactsAddFieldKey="",this.contactsAddFieldValue="",this.imessageEnableConfirm=!1,this.imessageEnabling=!1,this.infoModalOpen=null,this.workspaces=[],this.workspacesLoading=!1,this.workspacesError=null,this.selectedWorkspace=null,this.addingWorkspace=!1,this.newWorkspaceName="",this.newWorkspacePath="",this.newWorkspacePin="",this.accountPinModalOpen=!1,this.accountPinBusy=!1,this.accountPinError=null,this.accountPinSuccess=null,this.apiKeyProviders=[],this.apiKeyModalOpen=!1,this.apiKeyBusy=!1,this.apiKeyError=null,this.apiKeySuccess=null,this.apiKeySavingProvider=null,this.authApiKeyMode=!1,this.authApiKeyInput="",this.authApiKeyBusy=!1,this.authApiKeyError=null,this.pinChanging=null,this.pinChangeBusy=!1,this.pinChangeError=null,this.loginChangePinMode=!1,this.changePinBusy=!1,this.changePinError=null,this.changePinSuccess=null,this.workspaceSaving=!1,this.workspaceRemoveConfirm=null,this.renamingWorkspace=!1,this.renameWorkspaceName="",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={...Ck},this.logsAutoFollow=!0,this.logsTruncated=!1,this.logsCursor=null,this.logsLastFetchAt=null,this.logsLimit=500,this.logsMaxBytes=25e4,this.logsAtBottom=!0,this.logsSubTab="session",this.logsChipsExpanded=!1,this.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,tool_call:!0,tool_result:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsChipsExpanded=!1,this.sessionLogsExpandedIds=new Set,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.onLoadOlder=()=>this.handleLoadOlderChat(),this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>zf(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null,this._beforeUnloadHandler=()=>{var t;so();const e=this.selectedWorkspace??((t=this.publicChatConfig)==null?void 0:t.accountId)??"";e&&In(e,this.sessionKey,this.chatMessage)}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),_k(this),window.addEventListener("beforeunload",this._beforeUnloadHandler)}firstUpdated(){Mk(this)}disconnectedCallback(){window.removeEventListener("beforeunload",this._beforeUnloadHandler),this.stopEmbeddingPoll(),Pk(this),super.disconnectedCallback()}startEmbeddingPoll(){if(this.embeddingPollTimer!=null)return;const e=async()=>{if(!(!this.client||!this.connected)){try{const t=await this.client.request("memory.status",{});if((t==null?void 0:t.embeddingState)==="downloading")this.embeddingDownloading=!0;else{this.embeddingDownloading&&(this.embeddingDownloading=!1),this.stopEmbeddingPoll();return}}catch{this.embeddingDownloading=!1,this.stopEmbeddingPoll();return}this.embeddingPollTimer=window.setTimeout(e,3e3)}};e()}stopEmbeddingPoll(){this.embeddingPollTimer!=null&&(window.clearTimeout(this.embeddingPollTimer),this.embeddingPollTimer=null)}updated(e){Lk(this,e)}connect(){Ie(this)}handleChatScroll(e){oh(this,e)}handleLogsScroll(e){ah(this,e)}handleSessionLogsScroll(e){lh(this,e)}exportLogs(e,t){dh(e,t)}exportSessionLogs(e,t){uh(e,t)}resetToolStream(){Fo(this)}resetChatScroll(){ch(this)}async loadAssistantIdentity(){await _o(this)}applySettings(e){nt(this,e)}setTab(e){Nf(this,e)}setTheme(e,t){Bf(this,e,t)}async loadOverview(){await cd(this)}async loadCron(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.cronForm={...this.cronForm,accountId:(e==null?void 0:e.whatsappAccountId)??void 0},await ir(this)}async handleAbortChat(){await ud(this)}removeQueuedMessage(e){Vf(this,e)}async handleSendChat(e,t){await Gf(this,e,t)}async handleWhatsAppStart(e,t){await Rk(this,e,t)}async handleWhatsAppWait(e){await Dk(this,e)}async handleWhatsAppLogout(e){await Nk(this,e)}async handleAddWhatsAppAccount(e){await Bk(this,e)}async handleRemoveWhatsAppAccount(e){await Fk(this,e)}async handleAccessCheck(){await Nl(this)}async handlePinSubmit(e,t){await ak(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await lk(this,e)}async handleLogout(){await dk(this)}toggleChangePinMode(){this.loginChangePinMode=!this.loginChangePinMode,this.changePinError=null,this.changePinSuccess=null}async handleChangePin(e,t,n){if(this.client){this.changePinBusy=!0,this.changePinError=null,this.changePinSuccess=null;try{const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.changePinError=i.message??"Incorrect current PIN",this.changePinBusy=!1;return}e==="__master__"?await this.client.request("access.setMasterPin",{pin:n}):await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.changePinSuccess="PIN changed successfully",this.changePinBusy=!1,setTimeout(()=>{this.loginChangePinMode=!1,this.changePinSuccess=null},2e3)}catch{this.changePinError="Failed to change PIN",this.changePinBusy=!1}}}async handleAccountPinSave(e,t,n){if(this.client){this.accountPinBusy=!0,this.accountPinError=null,this.accountPinSuccess=null;try{if(t!==null){const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.accountPinError=i.message??"Incorrect current PIN",this.accountPinBusy=!1;return}}await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.accountPinSuccess="PIN saved",this.accountPinBusy=!1,await Nl(this),setTimeout(()=>{this.accountPinModalOpen=!1,this.accountPinSuccess=null,this.accountPinError=null},1500)}catch{this.accountPinError="Failed to save PIN",this.accountPinBusy=!1}}}async handleLicenseStatusCheck(){await Zk(this)}async handleLicenseActivate(){await e0(this)}async handleLicenseRemove(){await t0(this)}handleLicenseKeyChange(e){n0(this,e)}async handleAuthStatusCheck(){await Gk(this)}async handleAuthStart(){await Qk(this)}async handleAuthSubmitCode(e){await Jk(this,e)}handleAuthCodeChange(e){Yk(this,e)}handleSkipToWhatsApp(){Xk(this)}async handleGatewayHealthCheck(){await i0(this)}async handleGatewayRestart(){await s0(this)}async handleUpdateCheck(){await ku(this)}async handleUpdateRun(){await zw(this)}handleUpdateDismissResult(){jw(this)}handleUninstallConfirm(){this.uninstallConfirm=!0,this.uninstallConfirmText=""}handleUninstallCancel(){this.uninstallConfirm=!1,this.uninstallConfirmText="",this.uninstallError=null}handleUninstallConfirmTextChange(e){this.uninstallConfirmText=e}async handleUninstallRun(){const{runUninstall:e}=await re(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>ya);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){re(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>ya);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await id(this)}async clearAudit(){await mf(this),this.auditModalOpen=!1}handleFilesLoad(){var n;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((n=e==null?void 0:e.agents)==null?void 0:n.map(i=>i.id))??void 0;const t=this.resolveFilesAgentId();this.filesResolvedAgentId=t,Zt(this,t),Jo(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();re(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>pk);return{loadAdmins:t}},void 0,import.meta.url).then(({loadAdmins:t})=>{t(this,e)})}resolveAdminAgentId(){const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(n=>n.id.endsWith("-admin")||n.id==="admin");return t==null?void 0:t.id}resolveFilesAgentId(){var n;const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return(t==null?void 0:t.id)??((n=e.agents[0])==null?void 0:n.id)}handleChatLoad(){const e=this.resolveAdminAgentId();if(e){const t=`agent:${e}:main`;t!==this.sessionKey&&(this.sessionKey=t,this.chatMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatRunId=null,this.chatSuggestion=null,this.resetChatScroll(),this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}re(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>Ei);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this).then(()=>{Jt(this,!0)})})}async handleLoadOlderChat(){if(this.chatLoadingOlder||!this.chatHistoryHasMore)return;const e=rh(this),{loadOlderChatHistory:t}=await re(async()=>{const{loadOlderChatHistory:i}=await Promise.resolve().then(()=>Ei);return{loadOlderChatHistory:i}},void 0,import.meta.url);await t(this)&&e&&(await this.updateComplete,e())}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.loadCron(),this.advancedTab==="logs"&&(this.logsSubTab==="session"?re(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>nd);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):re(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>Th);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&re(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>cf);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Ok(this)}async handleChannelConfigReload(){await Uk(this)}handleNostrProfileEdit(e,t){Kk(this,e,t)}handleNostrProfileCancel(){zk(this)}handleNostrProfileFieldChange(e,t){Hk(this,e,t)}async handleNostrProfileSave(){await jk(this)}async handleNostrProfileImport(){await Vk(this)}handleNostrProfileToggleAdvanced(){qk(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}}}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})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleContactsLoad(){const e=this.selectedWorkspace??void 0;re(async()=>{const{loadContacts:t}=await Promise.resolve().then(()=>hk);return{loadContacts:t}},void 0,import.meta.url).then(({loadContacts:t})=>{t(this,e)})}handleContactsNewPhoneChange(e){this.contactsNewPhone=e,this.contactsError&&(this.contactsError=null)}handleContactsNewNameChange(e){this.contactsNewName=e,this.contactsError&&(this.contactsError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await re(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>hi);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await re(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>hi);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await re(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>Sh);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const o=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,o),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(o),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await re(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>hi);return{removeWorkspace:n}},void 0,import.meta.url);await t(this,e)}handleWorkspaceRenameStart(){const e=this.getSelectedWorkspaceInfo();this.renameWorkspaceName=(e==null?void 0:e.displayName)??(e==null?void 0:e.name)??"",this.renamingWorkspace=!0}handleWorkspaceRenameCancel(){this.renamingWorkspace=!1,this.renameWorkspaceName=""}async handleWorkspaceRename(e,t){const{renameWorkspace:n}=await re(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>hi);return{renameWorkspace:i}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){so(),this.selectedWorkspace&&In(this.selectedWorkspace,this.sessionKey,this.chatMessage),this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),kn(e),ia(e),this.settings=ws(),this.chatMessage=Rn(e,this.settings.sessionKey),this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.reloadCurrentPageData()}getSelectedWorkspaceInfo(){return this.selectedWorkspace?this.workspaces.find(e=>e.name===this.selectedWorkspace)??null:null}reloadCurrentPageData(){this.loadAuditEntries(),this.adminsPage?this.handleAdminsLoad():this.contactsPage?this.handleContactsLoad():this.filesPage?this.handleFilesLoad():this.chatPage?this.handleChatLoad():this.advancedPage&&this.handleAdvancedLoad()}initWorkspaceSelection(){if(this.workspaces.length===0){this.reloadCurrentPageData();return}const e=localStorage.getItem("taskmaster-selected-workspace"),t=e?this.workspaces.find(n=>n.name===e):null;if(t)this.selectedWorkspace=t.name;else{const n=this.workspaces.find(i=>i.isDefault)??this.workspaces[0];this.selectedWorkspace=n.name,localStorage.setItem("taskmaster-selected-workspace",n.name)}kn(this.selectedWorkspace),ia(this.selectedWorkspace),this.settings=ws(),this.chatMessage=Rn(this.selectedWorkspace,this.settings.sessionKey),this.reloadCurrentPageData()}render(){return u`${xk(this)}${this.auditModalOpen?Ek(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):k}`}};m([y()],g.prototype,"settings",2);m([y()],g.prototype,"password",2);m([y()],g.prototype,"tab",2);m([y()],g.prototype,"onboarding",2);m([y()],g.prototype,"setup",2);m([y()],g.prototype,"filesPage",2);m([y()],g.prototype,"browserPage",2);m([y()],g.prototype,"adminsPage",2);m([y()],g.prototype,"contactsPage",2);m([y()],g.prototype,"chatPage",2);m([y()],g.prototype,"advancedPage",2);m([y()],g.prototype,"advancedTab",2);m([y()],g.prototype,"publicChat",2);m([y()],g.prototype,"publicChatConfig",2);m([y()],g.prototype,"publicChatSessionKey",2);m([y()],g.prototype,"publicChatAuthenticated",2);m([y()],g.prototype,"publicChatAuthStep",2);m([y()],g.prototype,"connected",2);m([y()],g.prototype,"accessState",2);m([y()],g.prototype,"theme",2);m([y()],g.prototype,"themeResolved",2);m([y()],g.prototype,"hello",2);m([y()],g.prototype,"lastError",2);m([y()],g.prototype,"eventLog",2);m([y()],g.prototype,"assistantName",2);m([y()],g.prototype,"assistantAvatar",2);m([y()],g.prototype,"assistantAgentId",2);m([y()],g.prototype,"sessionKey",2);m([y()],g.prototype,"chatLoading",2);m([y()],g.prototype,"chatSending",2);m([y()],g.prototype,"chatMessage",2);m([y()],g.prototype,"chatMessages",2);m([y()],g.prototype,"chatHistoryTotal",2);m([y()],g.prototype,"chatHistoryHasMore",2);m([y()],g.prototype,"chatLoadingOlder",2);m([y()],g.prototype,"chatToolMessages",2);m([y()],g.prototype,"chatStream",2);m([y()],g.prototype,"chatInterimText",2);m([y()],g.prototype,"chatSuggestion",2);m([y()],g.prototype,"chatStreamStartedAt",2);m([y()],g.prototype,"chatRunId",2);m([y()],g.prototype,"compactionStatus",2);m([y()],g.prototype,"chatAvatarUrl",2);m([y()],g.prototype,"chatThinkingLevel",2);m([y()],g.prototype,"chatModelProvider",2);m([y()],g.prototype,"chatModel",2);m([y()],g.prototype,"chatModelCatalog",2);m([y()],g.prototype,"chatVerboseLevel",2);m([y()],g.prototype,"chatFillerEnabled",2);m([y()],g.prototype,"chatQueue",2);m([y()],g.prototype,"chatAttachments",2);m([y()],g.prototype,"sidebarOpen",2);m([y()],g.prototype,"sidebarContent",2);m([y()],g.prototype,"sidebarError",2);m([y()],g.prototype,"splitRatio",2);m([y()],g.prototype,"nodesLoading",2);m([y()],g.prototype,"nodes",2);m([y()],g.prototype,"devicesLoading",2);m([y()],g.prototype,"devicesError",2);m([y()],g.prototype,"devicesList",2);m([y()],g.prototype,"execApprovalsLoading",2);m([y()],g.prototype,"execApprovalsSaving",2);m([y()],g.prototype,"execApprovalsDirty",2);m([y()],g.prototype,"execApprovalsSnapshot",2);m([y()],g.prototype,"execApprovalsForm",2);m([y()],g.prototype,"execApprovalsSelectedAgent",2);m([y()],g.prototype,"execApprovalsTarget",2);m([y()],g.prototype,"execApprovalsTargetNodeId",2);m([y()],g.prototype,"execApprovalQueue",2);m([y()],g.prototype,"execApprovalBusy",2);m([y()],g.prototype,"execApprovalError",2);m([y()],g.prototype,"configLoading",2);m([y()],g.prototype,"configRaw",2);m([y()],g.prototype,"configRawOriginal",2);m([y()],g.prototype,"configValid",2);m([y()],g.prototype,"configIssues",2);m([y()],g.prototype,"configSaving",2);m([y()],g.prototype,"configApplying",2);m([y()],g.prototype,"updateRunning",2);m([y()],g.prototype,"applySessionKey",2);m([y()],g.prototype,"configSnapshot",2);m([y()],g.prototype,"configSchema",2);m([y()],g.prototype,"configSchemaVersion",2);m([y()],g.prototype,"configSchemaLoading",2);m([y()],g.prototype,"configUiHints",2);m([y()],g.prototype,"configForm",2);m([y()],g.prototype,"configFormOriginal",2);m([y()],g.prototype,"configFormDirty",2);m([y()],g.prototype,"configFormMode",2);m([y()],g.prototype,"configSearchQuery",2);m([y()],g.prototype,"configActiveSection",2);m([y()],g.prototype,"configActiveSubsection",2);m([y()],g.prototype,"channelsLoading",2);m([y()],g.prototype,"channelsSnapshot",2);m([y()],g.prototype,"channelsError",2);m([y()],g.prototype,"channelsLastSuccess",2);m([y()],g.prototype,"whatsappLoginMessage",2);m([y()],g.prototype,"whatsappLoginQrDataUrl",2);m([y()],g.prototype,"whatsappLoginConnected",2);m([y()],g.prototype,"whatsappBusy",2);m([y()],g.prototype,"whatsappActiveQrAccountId",2);m([y()],g.prototype,"whatsappPairedPhone",2);m([y()],g.prototype,"addingWhatsAppAccount",2);m([y()],g.prototype,"newWhatsAppAccountName",2);m([y()],g.prototype,"whatsappAccountError",2);m([y()],g.prototype,"whatsappAccountSaving",2);m([y()],g.prototype,"whatsappSettingsOpen",2);m([y()],g.prototype,"publicChatToggleBusy",2);m([y()],g.prototype,"brandingBusy",2);m([y()],g.prototype,"brandingExpanded",2);m([y()],g.prototype,"tailscaleStatus",2);m([y()],g.prototype,"tailscaleBusy",2);m([y()],g.prototype,"tailscaleAuthUrl",2);m([y()],g.prototype,"tailscaleError",2);m([y()],g.prototype,"tailscaleFunnelEnableUrl",2);m([y()],g.prototype,"tailscaleDisableConfirm",2);m([y()],g.prototype,"wifiStatus",2);m([y()],g.prototype,"wifiNetworks",2);m([y()],g.prototype,"wifiBusy",2);m([y()],g.prototype,"wifiError",2);m([y()],g.prototype,"wifiPassword",2);m([y()],g.prototype,"wifiSelectedSsid",2);m([y()],g.prototype,"networkPort",2);m([y()],g.prototype,"networkHostname",2);m([y()],g.prototype,"networkPortInput",2);m([y()],g.prototype,"networkHostnameInput",2);m([y()],g.prototype,"networkModalOpen",2);m([y()],g.prototype,"networkBusy",2);m([y()],g.prototype,"networkError",2);m([y()],g.prototype,"networkSuccess",2);m([y()],g.prototype,"wifiModalOpen",2);m([y()],g.prototype,"licenseKey",2);m([y()],g.prototype,"licenseBusy",2);m([y()],g.prototype,"licenseValid",2);m([y()],g.prototype,"licenseMessage",2);m([y()],g.prototype,"licenseTier",2);m([y()],g.prototype,"licenseDeviceId",2);m([y()],g.prototype,"licenseStoredKey",2);m([y()],g.prototype,"licenseRemoveConfirm",2);m([y()],g.prototype,"authConnected",2);m([y()],g.prototype,"authBusy",2);m([y()],g.prototype,"authMessage",2);m([y()],g.prototype,"authUrl",2);m([y()],g.prototype,"authCodeInput",2);m([y()],g.prototype,"authExpiresIn",2);m([y()],g.prototype,"setupStep",2);m([y()],g.prototype,"gatewayHealthy",2);m([y()],g.prototype,"gatewayHealthLoading",2);m([y()],g.prototype,"gatewayHealthMessage",2);m([y()],g.prototype,"gatewayRestartBusy",2);m([y()],g.prototype,"updateAvailable",2);m([y()],g.prototype,"currentVersion",2);m([y()],g.prototype,"latestVersion",2);m([y()],g.prototype,"updateChecking",2);m([y()],g.prototype,"updateMessage",2);m([y()],g.prototype,"updateProgressSteps",2);m([y()],g.prototype,"updateLastResult",2);m([y()],g.prototype,"uninstallConfirm",2);m([y()],g.prototype,"uninstallBusy",2);m([y()],g.prototype,"uninstallDone",2);m([y()],g.prototype,"uninstallError",2);m([y()],g.prototype,"uninstallConfirmText",2);m([y()],g.prototype,"nostrProfileFormState",2);m([y()],g.prototype,"nostrProfileAccountId",2);m([y()],g.prototype,"presenceLoading",2);m([y()],g.prototype,"presenceEntries",2);m([y()],g.prototype,"presenceError",2);m([y()],g.prototype,"presenceStatus",2);m([y()],g.prototype,"agentsLoading",2);m([y()],g.prototype,"agentsList",2);m([y()],g.prototype,"agentsError",2);m([y()],g.prototype,"sessionsLoading",2);m([y()],g.prototype,"sessionsResult",2);m([y()],g.prototype,"sessionsError",2);m([y()],g.prototype,"cronLoading",2);m([y()],g.prototype,"cronJobs",2);m([y()],g.prototype,"cronStatus",2);m([y()],g.prototype,"cronError",2);m([y()],g.prototype,"cronForm",2);m([y()],g.prototype,"cronRunsJobId",2);m([y()],g.prototype,"cronRuns",2);m([y()],g.prototype,"cronBusy",2);m([y()],g.prototype,"cronNewEventModal",2);m([y()],g.prototype,"cronDetailJobId",2);m([y()],g.prototype,"cronEditJobId",2);m([y()],g.prototype,"cronPendingDeleteId",2);m([y()],g.prototype,"cronRunModalJobId",2);m([y()],g.prototype,"cronRunModalJobName",2);m([y()],g.prototype,"cronRunResult",2);m([y()],g.prototype,"browserScreencastActive",2);m([y()],g.prototype,"browserScreencastFrame",2);m([y()],g.prototype,"browserScreencastMetadata",2);m([y()],g.prototype,"browserHandoffPending",2);m([y()],g.prototype,"browserHandoffReason",2);m([y()],g.prototype,"browserHandoffId",2);m([y()],g.prototype,"browserInputMode",2);m([y()],g.prototype,"browserFullscreen",2);m([y()],g.prototype,"browserLoading",2);m([y()],g.prototype,"browserError",2);m([y()],g.prototype,"filesLoading",2);m([y()],g.prototype,"filesTree",2);m([y()],g.prototype,"filesRoot",2);m([y()],g.prototype,"filesError",2);m([y()],g.prototype,"filesSelectedPath",2);m([y()],g.prototype,"filesSelectedPaths",2);m([y()],g.prototype,"filesPreviewContent",2);m([y()],g.prototype,"filesPreviewLoading",2);m([y()],g.prototype,"filesPreviewBinary",2);m([y()],g.prototype,"filesPreviewSize",2);m([y()],g.prototype,"filesExpandedDirs",2);m([y()],g.prototype,"filesCurrentDir",2);m([y()],g.prototype,"filesPendingDeletePath",2);m([y()],g.prototype,"filesMessage",2);m([y()],g.prototype,"filesUploadBusy",2);m([y()],g.prototype,"filesReindexBusy",2);m([y()],g.prototype,"filesMemoryStatus",2);m([y()],g.prototype,"embeddingDownloading",2);m([y()],g.prototype,"filesSearchQuery",2);m([y()],g.prototype,"filesSearchResults",2);m([y()],g.prototype,"filesSearchLoading",2);m([y()],g.prototype,"filesSearchAgentId",2);m([y()],g.prototype,"auditEntries",2);m([y()],g.prototype,"auditLoading",2);m([y()],g.prototype,"auditModalOpen",2);m([y()],g.prototype,"skillsLoading",2);m([y()],g.prototype,"skillsReport",2);m([y()],g.prototype,"skillsError",2);m([y()],g.prototype,"skillsFilter",2);m([y()],g.prototype,"skillsTypeFilter",2);m([y()],g.prototype,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",2);m([y()],g.prototype,"skillDetail",2);m([y()],g.prototype,"skillDetailTab",2);m([y()],g.prototype,"skillAddModal",2);m([y()],g.prototype,"skillAddForm",2);m([y()],g.prototype,"skillAddFormSource",2);m([y()],g.prototype,"skillEditTab",2);m([y()],g.prototype,"skillDrafts",2);m([y()],g.prototype,"adminsLoading",2);m([y()],g.prototype,"adminPhones",2);m([y()],g.prototype,"adminsError",2);m([y()],g.prototype,"adminsSaving",2);m([y()],g.prototype,"adminsNewPhone",2);m([y()],g.prototype,"contactsLoading",2);m([y()],g.prototype,"contactsSaving",2);m([y()],g.prototype,"contactsRecords",2);m([y()],g.prototype,"contactsError",2);m([y()],g.prototype,"contactsSearchQuery",2);m([y()],g.prototype,"contactsEditingId",2);m([y()],g.prototype,"contactsShowAddForm",2);m([y()],g.prototype,"contactsNewPhone",2);m([y()],g.prototype,"contactsNewName",2);m([y()],g.prototype,"contactsDeleteConfirmId",2);m([y()],g.prototype,"contactsAddFieldForId",2);m([y()],g.prototype,"contactsAddFieldKey",2);m([y()],g.prototype,"contactsAddFieldValue",2);m([y()],g.prototype,"imessageEnableConfirm",2);m([y()],g.prototype,"imessageEnabling",2);m([y()],g.prototype,"infoModalOpen",2);m([y()],g.prototype,"workspaces",2);m([y()],g.prototype,"workspacesLoading",2);m([y()],g.prototype,"workspacesError",2);m([y()],g.prototype,"selectedWorkspace",2);m([y()],g.prototype,"addingWorkspace",2);m([y()],g.prototype,"newWorkspaceName",2);m([y()],g.prototype,"newWorkspacePath",2);m([y()],g.prototype,"newWorkspacePin",2);m([y()],g.prototype,"accountPinModalOpen",2);m([y()],g.prototype,"accountPinBusy",2);m([y()],g.prototype,"accountPinError",2);m([y()],g.prototype,"accountPinSuccess",2);m([y()],g.prototype,"apiKeyProviders",2);m([y()],g.prototype,"apiKeyModalOpen",2);m([y()],g.prototype,"apiKeyBusy",2);m([y()],g.prototype,"apiKeyError",2);m([y()],g.prototype,"apiKeySuccess",2);m([y()],g.prototype,"apiKeySavingProvider",2);m([y()],g.prototype,"authApiKeyMode",2);m([y()],g.prototype,"authApiKeyInput",2);m([y()],g.prototype,"authApiKeyBusy",2);m([y()],g.prototype,"authApiKeyError",2);m([y()],g.prototype,"pinChanging",2);m([y()],g.prototype,"pinChangeBusy",2);m([y()],g.prototype,"pinChangeError",2);m([y()],g.prototype,"loginChangePinMode",2);m([y()],g.prototype,"changePinBusy",2);m([y()],g.prototype,"changePinError",2);m([y()],g.prototype,"changePinSuccess",2);m([y()],g.prototype,"workspaceSaving",2);m([y()],g.prototype,"workspaceRemoveConfirm",2);m([y()],g.prototype,"renamingWorkspace",2);m([y()],g.prototype,"renameWorkspaceName",2);m([y()],g.prototype,"debugLoading",2);m([y()],g.prototype,"debugStatus",2);m([y()],g.prototype,"debugHealth",2);m([y()],g.prototype,"debugModels",2);m([y()],g.prototype,"debugHeartbeat",2);m([y()],g.prototype,"debugCallMethod",2);m([y()],g.prototype,"debugCallParams",2);m([y()],g.prototype,"debugCallResult",2);m([y()],g.prototype,"debugCallError",2);m([y()],g.prototype,"logsLoading",2);m([y()],g.prototype,"logsError",2);m([y()],g.prototype,"logsFile",2);m([y()],g.prototype,"logsEntries",2);m([y()],g.prototype,"logsFilterText",2);m([y()],g.prototype,"logsLevelFilters",2);m([y()],g.prototype,"logsAutoFollow",2);m([y()],g.prototype,"logsTruncated",2);m([y()],g.prototype,"logsCursor",2);m([y()],g.prototype,"logsLastFetchAt",2);m([y()],g.prototype,"logsLimit",2);m([y()],g.prototype,"logsMaxBytes",2);m([y()],g.prototype,"logsAtBottom",2);m([y()],g.prototype,"logsSubTab",2);m([y()],g.prototype,"logsChipsExpanded",2);m([y()],g.prototype,"sessionLogsLoading",2);m([y()],g.prototype,"sessionLogsError",2);m([y()],g.prototype,"sessionLogsEntries",2);m([y()],g.prototype,"sessionLogsFilterText",2);m([y()],g.prototype,"sessionLogsTypeFilters",2);m([y()],g.prototype,"sessionLogsAgentFilters",2);m([y()],g.prototype,"sessionLogsAgents",2);m([y()],g.prototype,"sessionLogsAutoFollow",2);m([y()],g.prototype,"sessionLogsChipsExpanded",2);m([y()],g.prototype,"sessionLogsCursors",2);m([y()],g.prototype,"sessionLogsLastFetchAt",2);m([y()],g.prototype,"sessionLogsAtBottom",2);m([y()],g.prototype,"chatUserNearBottom",2);g=m([Vl("taskmaster-app")],g);
|
|
4227
|
+
//# sourceMappingURL=index-D3tbqnfY.js.map
|