@rubytech/taskmaster 1.0.57 → 1.0.58

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.
@@ -15,7 +15,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
15
15
  `],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),r=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`taskmaster-logs-${t}-${r}.log`,i.click(),URL.revokeObjectURL(s)}function kd(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
16
16
  `)}
17
17
  `],{type:"text/plain"}),s=URL.createObjectURL(n),i=document.createElement("a"),r=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");i.href=s,i.download=`taskmaster-session-logs-${t}-${r}.log`,i.click(),URL.revokeObjectURL(s)}function Sd(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:s}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${s}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}function Ue(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function et(e){return`${JSON.stringify(e,null,2).trimEnd()}
18
- `}function ol(e,t,n){if(t.length===0)return;let s=e;for(let r=0;r<t.length-1;r+=1){const o=t[r],a=t[r+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof a=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const l=s;l[o]==null&&(l[o]=typeof a=="number"?[]:{}),s=l[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}async function xe(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Ad(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function al(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});xd(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function xd(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Ad(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?et(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=et(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=Ue(t.config??{}),e.configFormOriginal=Ue(t.config??{}),e.configRawOriginal=n)}async function $d(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?et(e.configForm):e.configRaw,s=(t=e.configSnapshot)==null?void 0:t.hash;if(!s){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:n,baseHash:s}),e.configFormDirty=!1,await xe(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function un(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 gs(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 Ed(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=Xn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function Td(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=Xn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function Cd(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=Ed(e.cronForm),s=Td(e.cronForm),i=e.cronForm.agentId.trim(),r=(t=e.cronForm.accountId)==null?void 0:t.trim(),o={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,accountId:r||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:s,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!o.name)throw new Error("Name required.");await e.client.request("cron.add",o),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await gs(e),await un(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function _d(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 gs(e),await un(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function Md(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await bi(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ld(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await gs(e),await un(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function bi(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 q(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 Xi(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const s=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=s.message??null,e.whatsappLoginQrDataUrl=s.qrDataUrl??null,e.whatsappLoginConnected=null}catch(s){e.whatsappLoginMessage=String(s),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function ll(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 cl(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 ul(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!s){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const r=Ue(i.config??{});(!r.channels||typeof r.channels!="object")&&(r.channels={});const o=r.channels;(!o.whatsapp||typeof o.whatsapp!="object")&&(o.whatsapp={});const a=o.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const l=a.accounts;if(l[s]){e.whatsappAccountError=`Account "${s}" already exists.`;return}l[s]={name:n,provider:"baileys"};const c=i.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const u=et(r);await e.client.request("config.set",{raw:u,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await q(e,!0),await Xi(e,!0,s)}catch(i){e.whatsappAccountError=String(i)}finally{e.whatsappAccountSaving=!1}}async function dl(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 s=Ue(n.config??{}),i=s.channels,r=i==null?void 0:i.whatsapp,o=r==null?void 0:r.accounts;if(!o){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(o).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!o[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete o[t],Array.isArray(s.bindings)&&(s.bindings=s.bindings.filter(u=>{const p=u.match;return!p||p.channel!=="whatsapp"?!0:p.accountId!==t}));const l=n.hash;if(!l){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=et(s);await e.client.request("config.set",{raw:c,baseHash:l}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await q(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const Pd=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:ul,loadChannels:q,logoutWhatsApp:cl,removeWhatsAppAccount:dl,startWhatsAppLogin:Xi,waitWhatsAppLogin:ll},Symbol.toStringTag,{value:"Module"}));async function Zi(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const r=s;e.debugModels=Array.isArray(r==null?void 0:r.models)?r==null?void 0:r.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const Rd=2e3,Id=new Set(["trace","debug","info","warn","error","fatal"]);function Nd(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 Dd(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Id.has(t)?t:null}function Od(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,i=Dd((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),r=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,o=Nd(r);let a=null;o&&(typeof o.subsystem=="string"?a=o.subsystem:typeof o.module=="string"&&(a=o.module)),!a&&r&&r.length<120&&(a=r);let l=null;return typeof t[1]=="string"?l=t[1]:!o&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:s,level:i,subsystem:a,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Jt(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 s=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),r=(Array.isArray(s.lines)?s.lines.filter(a=>typeof a=="string"):[]).map(Od),o=!!(t!=null&&t.reset||s.reset||e.logsCursor==null);e.logsEntries=o?r:[...e.logsEntries,...r].slice(-Rd),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const pl={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:se,n:zn,Gx:ko,Gy:So,a:Hs,d:qs,h:Bd}=pl,tt=32,Ji=64,Fd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},Z=(e="")=>{const t=new Error(e);throw Fd(t,Z),t},Ud=e=>typeof e=="bigint",Wd=e=>typeof e=="string",Kd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ke=(e,t,n="")=>{const s=Kd(e),i=e==null?void 0:e.length,r=t!==void 0;if(!s||r&&i!==t){const o=n&&`"${n}" `,a=r?` of length ${t}`:"",l=s?`length=${i}`:`type=${typeof e}`;Z(o+"expected Uint8Array"+a+", got "+l)}return e},ms=e=>new Uint8Array(e),hl=e=>Uint8Array.from(e),fl=(e,t)=>e.toString(16).padStart(t,"0"),gl=e=>Array.from(Ke(e)).map(t=>fl(t,2)).join(""),Te={_0:48,_9:57,A:65,F:70,a:97,f:102},xo=e=>{if(e>=Te._0&&e<=Te._9)return e-Te._0;if(e>=Te.A&&e<=Te.F)return e-(Te.A-10);if(e>=Te.a&&e<=Te.f)return e-(Te.a-10)},ml=e=>{const t="hex invalid";if(!Wd(e))return Z(t);const n=e.length,s=n/2;if(n%2)return Z(t);const i=ms(s);for(let r=0,o=0;r<s;r++,o+=2){const a=xo(e.charCodeAt(o)),l=xo(e.charCodeAt(o+1));if(a===void 0||l===void 0)return Z(t);i[r]=a*16+l}return i},yl=()=>globalThis==null?void 0:globalThis.crypto,zd=()=>{var e;return((e=yl())==null?void 0:e.subtle)??Z("crypto.subtle must be defined, consider polyfill")},an=(...e)=>{const t=ms(e.reduce((s,i)=>s+Ke(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},jd=(e=tt)=>yl().getRandomValues(ms(e)),Jn=BigInt,Qe=(e,t,n,s="bad number: out of range")=>Ud(e)&&t<=e&&e<n?e:Z(s),M=(e,t=se)=>{const n=e%t;return n>=0n?n:t+n},vl=e=>M(e,zn),Hd=(e,t)=>{(e===0n||t<=0n)&&Z("no inverse n="+e+" mod="+t);let n=M(e,t),s=t,i=0n,r=1n;for(;n!==0n;){const o=s/n,a=s%n,l=i-r*o;s=n,n=a,i=r,r=l}return s===1n?M(i,t):Z("no inverse")},qd=e=>{const t=Sl[e];return typeof t!="function"&&Z("hashes."+e+" not set"),t},Gs=e=>e instanceof nt?e:Z("Point expected"),wi=2n**256n,Se=class Se{constructor(t,n,s,i){B(this,"X");B(this,"Y");B(this,"Z");B(this,"T");const r=wi;this.X=Qe(t,0n,r),this.Y=Qe(n,0n,r),this.Z=Qe(s,1n,r),this.T=Qe(i,0n,r),Object.freeze(this)}static CURVE(){return pl}static fromAffine(t){return new Se(t.x,t.y,1n,M(t.x*t.y))}static fromBytes(t,n=!1){const s=qs,i=hl(Ke(t,tt)),r=t[31];i[31]=r&-129;const o=wl(i);Qe(o,0n,n?wi:se);const l=M(o*o),c=M(l-1n),u=M(s*l+1n);let{isValid:p,value:d}=Vd(c,u);p||Z("bad point: y not sqrt");const h=(d&1n)===1n,b=(r&128)!==0;return!n&&d===0n&&b&&Z("bad point: x==0, isLastByteOdd"),b!==h&&(d=M(-d)),new Se(d,o,1n,M(d*o))}static fromHex(t,n){return Se.fromBytes(ml(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Hs,n=qs,s=this;if(s.is0())return Z("bad point: ZERO");const{X:i,Y:r,Z:o,T:a}=s,l=M(i*i),c=M(r*r),u=M(o*o),p=M(u*u),d=M(l*t),h=M(u*M(d+c)),b=M(p+M(n*M(l*c)));if(h!==b)return Z("bad point: equation left != right (1)");const w=M(i*r),S=M(o*a);return w!==S?Z("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:r,Y:o,Z:a}=Gs(t),l=M(n*a),c=M(r*i),u=M(s*a),p=M(o*i);return l===c&&u===p}is0(){return this.equals(bt)}negate(){return new Se(M(-this.X),this.Y,this.Z,M(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Hs,r=M(t*t),o=M(n*n),a=M(2n*M(s*s)),l=M(i*r),c=t+n,u=M(M(c*c)-r-o),p=l+o,d=p-a,h=l-o,b=M(u*d),w=M(p*h),S=M(u*h),T=M(d*p);return new Se(b,w,T,S)}add(t){const{X:n,Y:s,Z:i,T:r}=this,{X:o,Y:a,Z:l,T:c}=Gs(t),u=Hs,p=qs,d=M(n*o),h=M(s*a),b=M(r*p*c),w=M(i*l),S=M((n+s)*(o+a)-d-h),T=M(w-b),A=M(w+b),E=M(h-u*d),C=M(S*T),R=M(A*E),U=M(S*E),Q=M(T*A);return new Se(C,R,Q,U)}subtract(t){return this.add(Gs(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return bt;if(Qe(t,1n,zn),t===1n)return this;if(this.equals(st))return rp(t).p;let s=bt,i=st;for(let r=this;t>0n;r=r.double(),t>>=1n)t&1n?s=s.add(r):n&&(i=i.add(r));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(bt))return{x:0n,y:1n};const i=Hd(s,se);M(s*i)!==1n&&Z("invalid inverse");const r=M(t*i),o=M(n*i);return{x:r,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=bl(n);return s[31]|=t&1n?128:0,s}toHex(){return gl(this.toBytes())}clearCofactor(){return this.multiply(Jn(Bd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(zn/2n,!1).double();return zn%2n&&(t=t.add(this)),t.is0()}};B(Se,"BASE"),B(Se,"ZERO");let nt=Se;const st=new nt(ko,So,1n,M(ko*So)),bt=new nt(0n,1n,1n,0n);nt.BASE=st;nt.ZERO=bt;const bl=e=>ml(fl(Qe(e,0n,wi),Ji)).reverse(),wl=e=>Jn("0x"+gl(hl(Ke(e)).reverse())),be=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=se;return n},Gd=e=>{const n=e*e%se*e%se,s=be(n,2n)*n%se,i=be(s,1n)*e%se,r=be(i,5n)*i%se,o=be(r,10n)*r%se,a=be(o,20n)*o%se,l=be(a,40n)*a%se,c=be(l,80n)*l%se,u=be(c,80n)*l%se,p=be(u,10n)*r%se;return{pow_p_5_8:be(p,2n)*e%se,b2:n}},Ao=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Vd=(e,t)=>{const n=M(t*t*t),s=M(n*n*t),i=Gd(e*s).pow_p_5_8;let r=M(e*n*i);const o=M(t*r*r),a=r,l=M(r*Ao),c=o===e,u=o===M(-e),p=o===M(-e*Ao);return c&&(r=a),(u||p)&&(r=l),(M(r)&1n)===1n&&(r=M(-r)),{isValid:c||u,value:r}},ki=e=>vl(wl(e)),er=(...e)=>Sl.sha512Async(an(...e)),Qd=(...e)=>qd("sha512")(an(...e)),kl=e=>{const t=e.slice(0,tt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(tt,Ji),s=ki(t),i=st.multiply(s),r=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:r}},tr=e=>er(Ke(e,tt)).then(kl),Yd=e=>kl(Qd(Ke(e,tt))),Xd=e=>tr(e).then(t=>t.pointBytes),Zd=e=>er(e.hashable).then(e.finish),Jd=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,r=ki(t),o=st.multiply(r).toBytes();return{hashable:an(o,s,n),finish:c=>{const u=vl(r+ki(c)*i);return Ke(an(o,bl(u)),Ji)}}},ep=async(e,t)=>{const n=Ke(e),s=await tr(t),i=await er(s.prefix,n);return Zd(Jd(s,i,n))},Sl={sha512Async:async e=>{const t=zd(),n=an(e);return ms(await t.digest("SHA-512",n.buffer))},sha512:void 0},tp=(e=jd(tt))=>e,np={getExtendedPublicKeyAsync:tr,getExtendedPublicKey:Yd,randomSecretKey:tp},es=8,sp=256,xl=Math.ceil(sp/es)+1,Si=2**(es-1),ip=()=>{const e=[];let t=st,n=t;for(let s=0;s<xl;s++){n=t,e.push(n);for(let i=1;i<Si;i++)n=n.add(t),e.push(n);t=n.double()}return e};let $o;const Eo=(e,t)=>{const n=t.negate();return e?n:t},rp=e=>{const t=$o||($o=ip());let n=bt,s=st;const i=2**es,r=i,o=Jn(i-1),a=Jn(es);for(let l=0;l<xl;l++){let c=Number(e&o);e>>=a,c>Si&&(c-=r,e+=1n);const u=l*Si,p=u,d=u+Math.abs(c)-1,h=l%2!==0,b=c<0;c===0?s=s.add(Eo(h,t[p])):n=n.add(Eo(b,t[d]))}return e!==0n&&Z("invalid wnaf"),{p:n,f:s}},Vs="taskmaster-device-identity-v1";function xi(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Al(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let r=0;r<s.length;r+=1)i[r]=s.charCodeAt(r);return i}function op(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function $l(e){const t=await crypto.subtle.digest("SHA-256",e);return op(new Uint8Array(t))}async function ap(){const e=np.randomSecretKey(),t=await Xd(e);return{deviceId:await $l(t),publicKey:xi(t),privateKey:xi(e)}}async function lp(){try{const n=localStorage.getItem(Vs);if(n){const s=JSON.parse(n);if((s==null?void 0:s.version)===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await $l(Al(s.publicKey));if(i!==s.deviceId){const r={...s,deviceId:i};return localStorage.setItem(Vs,JSON.stringify(r)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await ap(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Vs,JSON.stringify(t)),e}async function cp(e,t){const n=Al(e),s=new TextEncoder().encode(t),i=await ep(s,n);return xi(i)}const El="taskmaster.device.auth.v1";function nr(e){return e.trim()}function up(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].sort()}function sr(){try{const e=window.localStorage.getItem(El);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 Tl(e){try{window.localStorage.setItem(El,JSON.stringify(e))}catch{}}function dp(e){const t=sr();if(!t||t.deviceId!==e.deviceId)return null;const n=nr(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function pp(e){const t=nr(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=sr();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:up(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,Tl(n),i}function hp(e){const t=sr();if(!t||t.deviceId!==e.deviceId)return;const n=nr(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],Tl(s)}async function ir(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 rr(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 fp(e){return{method:"exec.approvals.get",params:{}}}async function gp(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=fp(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);mp(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function mp(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=Ue(t.file??{}))}async function Cl(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 At(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ys(e){return e instanceof Error?e.message:String(e)}async function $t(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=ys(n)}finally{e.skillsLoading=!1}}}function yp(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function vp(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 $t(e),At(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ys(s);e.skillsError=i,At(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function bp(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 $t(e),At(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ys(n);e.skillsError=s,At(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function wp(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await $t(e),At(e,t,{kind:"success",message:(i==null?void 0:i.message)??"Installed"})}catch(i){const r=ys(i);e.skillsError=r,At(e,t,{kind:"error",message:r})}finally{e.skillsBusyKey=null}}}const _l={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},Ml=new Map(Object.entries(_l).map(([e,t])=>[t,e]));function vs(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function ln(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 kp(e,t=""){const n=vs(t),s=_l[e];return n?`${n}${s}`:s}function Ll(e,t=""){const n=vs(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=ln(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Ml.get(i)??null}function Sp(e){let t=ln(e);if(t.endsWith("/index.html")&&(t=ln(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(Ml.has(i)){const r=n.slice(0,s);return r.length?`/${r.join("/")}`:""}}return`/${n.join("/")}`}function xp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function or(e){return e==="system"?xp():e}const _n=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Ap=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Mn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},$p=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{var c;if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const r=i.documentElement,o=i,a=Ap();if(!!o.startViewTransition&&!a){let u=.5,p=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")u=_n(n.pointerClientX/window.innerWidth),p=_n(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const d=n.element.getBoundingClientRect();d.width>0&&d.height>0&&typeof window<"u"&&(u=_n((d.left+d.width/2)/window.innerWidth),p=_n((d.top+d.height/2)/window.innerHeight))}r.style.setProperty("--theme-switch-x",`${u*100}%`),r.style.setProperty("--theme-switch-y",`${p*100}%`),r.classList.add("theme-transition");try{const d=(c=o.startViewTransition)==null?void 0:c.call(o,()=>{t()});d!=null&&d.finished?d.finished.finally(()=>Mn(r)):Mn(r)}catch{Mn(r),t()}return}t(),Mn(r)},Ep=2e3;async function wt(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 s=await e.client.request("sessions.transcript",{cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:200,maxBytesPerFile:e.sessionLogsFull?25e4:5e4,...e.sessionLogsFull?{full:!0}:{}}),i=Array.isArray(s.entries)?s.entries:[],r=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=r?i:[...e.sessionLogsEntries,...i].slice(-Ep),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 Tp=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:wt},Symbol.toStringTag,{value:"Module"}));async function Pl(e,t){if(!(!e.client||!e.connected))try{const n={},s=await e.client.request("memory.audit",n);s!=null&&s.ok&&(e.auditEntries=s.entries??[])}catch{}}async function Cp(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Le(e){return e instanceof Error?e.message:String(e)}let Ln=null;function dn(e,t){Ln&&clearTimeout(Ln),e.filesMessage={kind:"success",text:t},Ln=setTimeout(()=>{e.filesMessage=null,Ln=null},3e3)}async function pn(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 s=await e.client.request("files.tree",n);s!=null&&s.tree&&(e.filesTree=s.tree,e.filesRoot=s.root??"")}catch(n){e.filesError=Le(n)}finally{e.filesLoading=!1}}}}async function _p(e,t,n){e.filesSelectedPaths=new Set([t]),await Rl(e,t,n)}async function Mp(e,t,n){const s=new Set(e.filesSelectedPaths);if(s.has(t)?s.delete(t):s.add(t),e.filesSelectedPaths=s,s.size===1){const i=[...s][0];await Rl(e,i,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Lp(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let s=0,i="";for(const r of n)try{await Il(e,r,t),s++}catch(o){i=Le(o)}i?e.filesMessage={kind:"error",text:`${s} downloaded, error: ${i}`}:dn(e,`${s} file${s!==1?"s":""} downloaded`)}async function Pp(e,t,n,s){const i=t.split("/").pop()??t,r=n==="."?i:`${n}/${i}`;r!==t&&await Nl(e,t,r,s)}async function Rl(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 s={path:t};n&&(s.agentId=n);const i=await e.client.request("files.read",s);e.filesPreviewContent=(i==null?void 0:i.content)??null,e.filesPreviewBinary=(i==null?void 0:i.binary)??!1,e.filesPreviewSize=(i==null?void 0:i.size)??null}catch(s){e.filesError=Le(s)}finally{e.filesPreviewLoading=!1}}}async function Il(e,t,n){if(!(!e.client||!e.connected))try{const s={path:t};n&&(s.agentId=n);const i=await e.client.request("files.download",s);if(!(i!=null&&i.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const r=Uint8Array.from(atob(i.base64),c=>c.charCodeAt(0)),o=new Blob([r]),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.download=i.name??t.split("/").pop()??"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}catch(s){e.filesMessage={kind:"error",text:Le(s)}}}async function Rp(e,t,n,s){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let i=0,r="";for(const o of n)try{const a=await o.arrayBuffer(),l=btoa(new Uint8Array(a).reduce((u,p)=>u+String.fromCharCode(p),"")),c={path:t,name:o.name,data:l};s&&(c.agentId=s),await e.client.request("files.upload",c),i++}catch(a){r=Le(a)}e.filesUploadBusy=!1,r?e.filesMessage={kind:"error",text:i>0?`${i} uploaded, error: ${r}`:r}:dn(e,`${i} file${i!==1?"s":""} uploaded`),await pn(e,s)}async function Ip(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={path:t};n&&(s.agentId=n),await e.client.request("files.delete",s),dn(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await pn(e,n)}catch(s){e.filesMessage={kind:"error",text:Le(s)}}}}async function Nl(e,t,n,s){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={from:t,to:n};s&&(i.agentId=s),await e.client.request("files.move",i),dn(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await pn(e,s)}catch(i){e.filesMessage={kind:"error",text:Le(i)}}}}async function ar(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const s=await e.client.request("memory.status",n);s!=null&&s.ok&&(e.filesMemoryStatus={dirty:s.dirty??!1,files:s.files??0,chunks:s.chunks??0})}catch{}}async function Np(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 s=await e.client.request("memory.reindex",n),i=(s==null?void 0:s.files)??0,r=(s==null?void 0:s.chunks)??0;dn(e,`Re-indexed: ${i} files, ${r} chunks`),await ar(e,t)}catch(n){e.filesMessage={kind:"error",text:Le(n)}}finally{e.filesReindexBusy=!1}}}function Dp(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n}async function Op(e,t,n){if(!(!e.client||!e.connected)){if(!t.trim()){e.filesSearchResults=null;return}e.filesSearchLoading=!0,e.filesSearchResults=null;try{const s={query:t.trim(),maxResults:20};n&&(s.agentId=n);const i=await e.client.request("memory.search",s);e.filesSearchResults=(i==null?void 0:i.results)??[]}catch(s){e.filesMessage={kind:"error",text:Le(s)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function Bp(e){e.filesSearchQuery="",e.filesSearchResults=null}function Fp(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{rr(e,{quiet:!0})},5e3))}function Up(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function lr(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Jt(e,{quiet:!0})},2e3))}function cr(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function ur(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{e.tab!=="logs"||e.logsSubTab!=="session"||wt(e,{quiet:!0})},2e3))}function dr(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function pr(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Zi(e)},3e3))}function hr(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Wp(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{Pl(e)},3e4))}function Kp(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function zp(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{e.tab==="files"&&ar(e)},1e4))}function jp(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function Be(e,t){var s;const n={...t,lastActiveSessionKey:((s=t.lastActiveSessionKey)==null?void 0:s.trim())||t.sessionKey.trim()||"main"};e.settings=n,Uu(n),t.theme!==e.theme&&(e.theme=t.theme,bs(e,or(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Dl(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Be(e,{...e.settings,lastActiveSessionKey:n})}function Hp(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),r=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&Be(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(s!=null){const l=s.trim();l&&(e.password=l),t.delete("password"),o=!0}if(i!=null){const l=i.trim();l&&(e.sessionKey=l,Be(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(r!=null){const l=r.trim();l&&l!==e.settings.gatewayUrl&&Be(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),o=!0}if(!o)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function qp(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?ur(e):lr(e):(cr(e),dr(e)),t==="debug"?pr(e):hr(e),ts(e),Bl(e,t,!1)}function Gp(e,t,n){$p({nextTheme:t,applyTheme:()=>{e.theme=t,Be(e,{...e.settings,theme:t}),bs(e,or(t))},context:n,currentTheme:e.theme})}async function ts(e){if(e.tab==="overview"&&await Fl(e),e.tab==="channels"&&await eh(e),e.tab==="instances"&&await Cl(e),e.tab==="cron"&&await fr(e),e.tab==="skills"&&await $t(e),e.tab==="nodes"&&(await rr(e),await ir(e),await xe(e),await gp(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await rh(e),cn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await al(e),await xe(e)),e.tab==="debug"&&(await Zi(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await pe(async()=>{const{loadSessionLogs:s}=await Promise.resolve().then(()=>Tp);return{loadSessionLogs:s}},void 0,import.meta.url);await n(e,{reset:!0})}else await Jt(e,{reset:!0});rl(e,!0)}}function Vp(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?vs(e):Sp(window.location.pathname)}function Qp(e){e.theme=e.settings.theme??"system",bs(e,or(e.theme))}function bs(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Yp(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"&&bs(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Xp(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 Zp(e,t){if(typeof window>"u")return;const n=Ll(window.location.pathname,e.basePath)??"chat";Ol(e,n),Bl(e,n,t)}function Jp(e){var i;if(typeof window>"u")return;const t=Ll(window.location.pathname,e.basePath);if(!t)return;const s=(i=new URL(window.location.href).searchParams.get("session"))==null?void 0:i.trim();s&&(e.sessionKey=s,Be(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Ol(e,t)}function Ol(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?ur(e):lr(e):(cr(e),dr(e)),t==="debug"?pr(e):hr(e),e.connected&&ts(e)}function Bl(e,t,n){if(typeof window>"u")return;const s=ln(kp(t,e.basePath)),i=ln(window.location.pathname),r=new URL(window.location.href);t==="chat"&&e.sessionKey?r.searchParams.set("session",e.sessionKey):r.searchParams.delete("session"),i!==s&&(r.pathname=s),n?window.history.replaceState({},"",r.toString()):window.history.pushState({},"",r.toString())}async function Fl(e){await Promise.all([q(e,!1),Cl(e),Qi(e),un(e),Zi(e)])}async function eh(e){await Promise.all([q(e,!0),al(e),xe(e)])}async function fr(e){await Promise.all([q(e,!1),un(e),gs(e)])}function Ul(e){return e.chatSending||!!e.chatRunId}function th(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 Wl(e){e.connected&&(e.chatMessage="",await sl(e))}function nh(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Vi(),text:s,createdAt:Date.now(),attachments:i?n==null?void 0:n.map(r=>({...r})):void 0}],cn(e))}async function Kl(e,t,n){var i,r;Yi(e);const s=await nl(e,t,n==null?void 0:n.attachments);return!s&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!s&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),s&&Dl(e,e.sessionKey),s&&(n!=null&&n.restoreDraft)&&((i=n.previousDraft)!=null&&i.trim())&&(e.chatMessage=n.previousDraft),s&&(n!=null&&n.restoreAttachments)&&((r=n.previousAttachments)!=null&&r.length)&&(e.chatAttachments=n.previousAttachments),cn(e),s&&!e.chatRunId&&zl(e),s}async function zl(e){if(!e.connected||Ul(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Kl(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function sh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function ih(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),r=e.chatAttachments??[],o=t==null?r:[],a=o.length>0;if(!(!i&&!a)){if(th(i)){await Wl(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Ul(e)){nh(e,i,o);return}await Kl(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?o:void 0,previousAttachments:t==null?r:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function rh(e){await Promise.all([Me(e),Qi(e),Ai(e)]),cn(e,!0)}const oh=zl;function ah(e){var i,r,o;const t=Va(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(i=e.hello)==null?void 0:i.snapshot;return((o=(r=n==null?void 0:n.sessionDefaults)==null?void 0:r.defaultAgentId)==null?void 0:o.trim())||"main"}function lh(e,t){const n=vs(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function Ai(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=ah(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=lh(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),r=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=r||null}catch{e.chatAvatarUrl=null}}const O={messageSquare:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:f`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:f`<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:f`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,image:f`<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:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,puzzle:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:f`<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:f`<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:f`<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>`,chevronDown:f`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:f`<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>`},ch="Taskmaster",uh="/taskmaster-icon.png",jl="#00d4ff";let Pn=null;function We(){return Pn||(Pn={name:window.__TASKMASTER_BRAND_NAME__||ch,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||uh,accentColor:window.__TASKMASTER_ACCENT_COLOR__||jl},Pn)}function dh(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 ph(e){if(e===jl)return;const t=dh(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 hh=f`<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>`,fh=f`<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 To=!1;function gh(){To||(To=!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 at(e,t){const n=(u,p)=>u===e?f`<span class="sp-page-nav-current">${u}</span>`:f`<a href=${p}>${u}</a>`,s=f`
18
+ `}function ol(e,t,n){if(t.length===0)return;let s=e;for(let r=0;r<t.length-1;r+=1){const o=t[r],a=t[r+1];if(typeof o=="number"){if(!Array.isArray(s))return;s[o]==null&&(s[o]=typeof a=="number"?[]:{}),s=s[o]}else{if(typeof s!="object"||s==null)return;const l=s;l[o]==null&&(l[o]=typeof a=="number"?[]:{}),s=l[o]}}const i=t[t.length-1];if(typeof i=="number"){Array.isArray(s)&&(s[i]=n);return}typeof s=="object"&&s!=null&&(s[i]=n)}async function xe(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});Ad(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function al(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});xd(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function xd(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function Ad(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?et(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=et(e.configForm):e.configRaw=n,e.configValid=typeof t.valid=="boolean"?t.valid:null,e.configIssues=Array.isArray(t.issues)?t.issues:[],e.configFormDirty||(e.configForm=Ue(t.config??{}),e.configFormOriginal=Ue(t.config??{}),e.configRawOriginal=n)}async function $d(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?et(e.configForm):e.configRaw,s=(t=e.configSnapshot)==null?void 0:t.hash;if(!s){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:n,baseHash:s}),e.configFormDirty=!1,await xe(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function un(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 gs(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 Ed(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=Xn(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const s=e.everyUnit;return{kind:"every",everyMs:n*(s==="minutes"?6e4:s==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function Td(e){if(e.payloadKind==="systemEvent"){const i=e.payloadText.trim();if(!i)throw new Error("System event text required.");return{kind:"systemEvent",text:i}}const t=e.payloadText.trim();if(!t)throw new Error("Agent message required.");const n={kind:"agentTurn",message:t};e.deliver&&(n.deliver=!0),e.channel&&(n.channel=e.channel),e.to.trim()&&(n.to=e.to.trim());const s=Xn(e.timeoutSeconds,0);return s>0&&(n.timeoutSeconds=s),n}async function Cd(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=Ed(e.cronForm),s=Td(e.cronForm),i=e.cronForm.agentId.trim(),r=(t=e.cronForm.accountId)==null?void 0:t.trim(),o={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:i||void 0,accountId:r||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:s,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!o.name)throw new Error("Name required.");await e.client.request("cron.add",o),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await gs(e),await un(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function _d(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 gs(e),await un(e)}catch(s){e.cronError=String(s)}finally{e.cronBusy=!1}}}async function Md(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.run",{id:t.id,mode:"force"}),await bi(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ld(e,t){if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await e.client.request("cron.remove",{id:t.id}),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,e.cronRuns=[]),await gs(e),await un(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function bi(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 q(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 Xi(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const s=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=s.message??null,e.whatsappLoginQrDataUrl=s.qrDataUrl??null,e.whatsappLoginConnected=null}catch(s){e.whatsappLoginMessage=String(s),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function ll(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 cl(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 ul(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!s){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const i=await e.client.request("config.get",{});e.configSnapshot=i;const r=Ue(i.config??{});(!r.channels||typeof r.channels!="object")&&(r.channels={});const o=r.channels;(!o.whatsapp||typeof o.whatsapp!="object")&&(o.whatsapp={});const a=o.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const l=a.accounts;if(l[s]){e.whatsappAccountError=`Account "${s}" already exists.`;return}l[s]={name:n,provider:"baileys"};const c=i.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const u=et(r);await e.client.request("config.set",{raw:u,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await q(e,!0),await Xi(e,!0,s)}catch(i){e.whatsappAccountError=String(i)}finally{e.whatsappAccountSaving=!1}}async function dl(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 s=Ue(n.config??{}),i=s.channels,r=i==null?void 0:i.whatsapp,o=r==null?void 0:r.accounts;if(!o){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(o).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!o[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete o[t],Array.isArray(s.bindings)&&(s.bindings=s.bindings.filter(u=>{const p=u.match;return!p||p.channel!=="whatsapp"?!0:p.accountId!==t}));const l=n.hash;if(!l){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=et(s);await e.client.request("config.set",{raw:c,baseHash:l}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await q(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const Pd=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:ul,loadChannels:q,logoutWhatsApp:cl,removeWhatsAppAccount:dl,startWhatsAppLogin:Xi,waitWhatsAppLogin:ll},Symbol.toStringTag,{value:"Module"}));async function Zi(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,s,i]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const r=s;e.debugModels=Array.isArray(r==null?void 0:r.models)?r==null?void 0:r.models:[],e.debugHeartbeat=i}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const Rd=2e3,Id=new Set(["trace","debug","info","warn","error","fatal"]);function Nd(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 Dd(e){if(typeof e!="string")return null;const t=e.toLowerCase();return Id.has(t)?t:null}function Od(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,s=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,i=Dd((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),r=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,o=Nd(r);let a=null;o&&(typeof o.subsystem=="string"?a=o.subsystem:typeof o.module=="string"&&(a=o.module)),!a&&r&&r.length<120&&(a=r);let l=null;return typeof t[1]=="string"?l=t[1]:!o&&typeof t[0]=="string"?l=t[0]:typeof t.message=="string"&&(l=t.message),{raw:e,time:s,level:i,subsystem:a,message:l??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Jt(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 s=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),r=(Array.isArray(s.lines)?s.lines.filter(a=>typeof a=="string"):[]).map(Od),o=!!(t!=null&&t.reset||s.reset||e.logsCursor==null);e.logsEntries=o?r:[...e.logsEntries,...r].slice(-Rd),typeof s.cursor=="number"&&(e.logsCursor=s.cursor),typeof s.file=="string"&&(e.logsFile=s.file),e.logsTruncated=!!s.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const pl={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:se,n:zn,Gx:ko,Gy:So,a:Hs,d:qs,h:Bd}=pl,tt=32,Ji=64,Fd=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},Z=(e="")=>{const t=new Error(e);throw Fd(t,Z),t},Ud=e=>typeof e=="bigint",Wd=e=>typeof e=="string",Kd=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ke=(e,t,n="")=>{const s=Kd(e),i=e==null?void 0:e.length,r=t!==void 0;if(!s||r&&i!==t){const o=n&&`"${n}" `,a=r?` of length ${t}`:"",l=s?`length=${i}`:`type=${typeof e}`;Z(o+"expected Uint8Array"+a+", got "+l)}return e},ms=e=>new Uint8Array(e),hl=e=>Uint8Array.from(e),fl=(e,t)=>e.toString(16).padStart(t,"0"),gl=e=>Array.from(Ke(e)).map(t=>fl(t,2)).join(""),Te={_0:48,_9:57,A:65,F:70,a:97,f:102},xo=e=>{if(e>=Te._0&&e<=Te._9)return e-Te._0;if(e>=Te.A&&e<=Te.F)return e-(Te.A-10);if(e>=Te.a&&e<=Te.f)return e-(Te.a-10)},ml=e=>{const t="hex invalid";if(!Wd(e))return Z(t);const n=e.length,s=n/2;if(n%2)return Z(t);const i=ms(s);for(let r=0,o=0;r<s;r++,o+=2){const a=xo(e.charCodeAt(o)),l=xo(e.charCodeAt(o+1));if(a===void 0||l===void 0)return Z(t);i[r]=a*16+l}return i},yl=()=>globalThis==null?void 0:globalThis.crypto,zd=()=>{var e;return((e=yl())==null?void 0:e.subtle)??Z("crypto.subtle must be defined, consider polyfill")},an=(...e)=>{const t=ms(e.reduce((s,i)=>s+Ke(i).length,0));let n=0;return e.forEach(s=>{t.set(s,n),n+=s.length}),t},jd=(e=tt)=>yl().getRandomValues(ms(e)),Jn=BigInt,Qe=(e,t,n,s="bad number: out of range")=>Ud(e)&&t<=e&&e<n?e:Z(s),M=(e,t=se)=>{const n=e%t;return n>=0n?n:t+n},vl=e=>M(e,zn),Hd=(e,t)=>{(e===0n||t<=0n)&&Z("no inverse n="+e+" mod="+t);let n=M(e,t),s=t,i=0n,r=1n;for(;n!==0n;){const o=s/n,a=s%n,l=i-r*o;s=n,n=a,i=r,r=l}return s===1n?M(i,t):Z("no inverse")},qd=e=>{const t=Sl[e];return typeof t!="function"&&Z("hashes."+e+" not set"),t},Gs=e=>e instanceof nt?e:Z("Point expected"),wi=2n**256n,Se=class Se{constructor(t,n,s,i){B(this,"X");B(this,"Y");B(this,"Z");B(this,"T");const r=wi;this.X=Qe(t,0n,r),this.Y=Qe(n,0n,r),this.Z=Qe(s,1n,r),this.T=Qe(i,0n,r),Object.freeze(this)}static CURVE(){return pl}static fromAffine(t){return new Se(t.x,t.y,1n,M(t.x*t.y))}static fromBytes(t,n=!1){const s=qs,i=hl(Ke(t,tt)),r=t[31];i[31]=r&-129;const o=wl(i);Qe(o,0n,n?wi:se);const l=M(o*o),c=M(l-1n),u=M(s*l+1n);let{isValid:p,value:d}=Vd(c,u);p||Z("bad point: y not sqrt");const h=(d&1n)===1n,b=(r&128)!==0;return!n&&d===0n&&b&&Z("bad point: x==0, isLastByteOdd"),b!==h&&(d=M(-d)),new Se(d,o,1n,M(d*o))}static fromHex(t,n){return Se.fromBytes(ml(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=Hs,n=qs,s=this;if(s.is0())return Z("bad point: ZERO");const{X:i,Y:r,Z:o,T:a}=s,l=M(i*i),c=M(r*r),u=M(o*o),p=M(u*u),d=M(l*t),h=M(u*M(d+c)),b=M(p+M(n*M(l*c)));if(h!==b)return Z("bad point: equation left != right (1)");const w=M(i*r),S=M(o*a);return w!==S?Z("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:s,Z:i}=this,{X:r,Y:o,Z:a}=Gs(t),l=M(n*a),c=M(r*i),u=M(s*a),p=M(o*i);return l===c&&u===p}is0(){return this.equals(bt)}negate(){return new Se(M(-this.X),this.Y,this.Z,M(-this.T))}double(){const{X:t,Y:n,Z:s}=this,i=Hs,r=M(t*t),o=M(n*n),a=M(2n*M(s*s)),l=M(i*r),c=t+n,u=M(M(c*c)-r-o),p=l+o,d=p-a,h=l-o,b=M(u*d),w=M(p*h),S=M(u*h),T=M(d*p);return new Se(b,w,T,S)}add(t){const{X:n,Y:s,Z:i,T:r}=this,{X:o,Y:a,Z:l,T:c}=Gs(t),u=Hs,p=qs,d=M(n*o),h=M(s*a),b=M(r*p*c),w=M(i*l),S=M((n+s)*(o+a)-d-h),T=M(w-b),A=M(w+b),E=M(h-u*d),C=M(S*T),R=M(A*E),U=M(S*E),Q=M(T*A);return new Se(C,R,Q,U)}subtract(t){return this.add(Gs(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return bt;if(Qe(t,1n,zn),t===1n)return this;if(this.equals(st))return rp(t).p;let s=bt,i=st;for(let r=this;t>0n;r=r.double(),t>>=1n)t&1n?s=s.add(r):n&&(i=i.add(r));return s}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:s}=this;if(this.equals(bt))return{x:0n,y:1n};const i=Hd(s,se);M(s*i)!==1n&&Z("invalid inverse");const r=M(t*i),o=M(n*i);return{x:r,y:o}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),s=bl(n);return s[31]|=t&1n?128:0,s}toHex(){return gl(this.toBytes())}clearCofactor(){return this.multiply(Jn(Bd),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(zn/2n,!1).double();return zn%2n&&(t=t.add(this)),t.is0()}};B(Se,"BASE"),B(Se,"ZERO");let nt=Se;const st=new nt(ko,So,1n,M(ko*So)),bt=new nt(0n,1n,1n,0n);nt.BASE=st;nt.ZERO=bt;const bl=e=>ml(fl(Qe(e,0n,wi),Ji)).reverse(),wl=e=>Jn("0x"+gl(hl(Ke(e)).reverse())),be=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=se;return n},Gd=e=>{const n=e*e%se*e%se,s=be(n,2n)*n%se,i=be(s,1n)*e%se,r=be(i,5n)*i%se,o=be(r,10n)*r%se,a=be(o,20n)*o%se,l=be(a,40n)*a%se,c=be(l,80n)*l%se,u=be(c,80n)*l%se,p=be(u,10n)*r%se;return{pow_p_5_8:be(p,2n)*e%se,b2:n}},Ao=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Vd=(e,t)=>{const n=M(t*t*t),s=M(n*n*t),i=Gd(e*s).pow_p_5_8;let r=M(e*n*i);const o=M(t*r*r),a=r,l=M(r*Ao),c=o===e,u=o===M(-e),p=o===M(-e*Ao);return c&&(r=a),(u||p)&&(r=l),(M(r)&1n)===1n&&(r=M(-r)),{isValid:c||u,value:r}},ki=e=>vl(wl(e)),er=(...e)=>Sl.sha512Async(an(...e)),Qd=(...e)=>qd("sha512")(an(...e)),kl=e=>{const t=e.slice(0,tt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(tt,Ji),s=ki(t),i=st.multiply(s),r=i.toBytes();return{head:t,prefix:n,scalar:s,point:i,pointBytes:r}},tr=e=>er(Ke(e,tt)).then(kl),Yd=e=>kl(Qd(Ke(e,tt))),Xd=e=>tr(e).then(t=>t.pointBytes),Zd=e=>er(e.hashable).then(e.finish),Jd=(e,t,n)=>{const{pointBytes:s,scalar:i}=e,r=ki(t),o=st.multiply(r).toBytes();return{hashable:an(o,s,n),finish:c=>{const u=vl(r+ki(c)*i);return Ke(an(o,bl(u)),Ji)}}},ep=async(e,t)=>{const n=Ke(e),s=await tr(t),i=await er(s.prefix,n);return Zd(Jd(s,i,n))},Sl={sha512Async:async e=>{const t=zd(),n=an(e);return ms(await t.digest("SHA-512",n.buffer))},sha512:void 0},tp=(e=jd(tt))=>e,np={getExtendedPublicKeyAsync:tr,getExtendedPublicKey:Yd,randomSecretKey:tp},es=8,sp=256,xl=Math.ceil(sp/es)+1,Si=2**(es-1),ip=()=>{const e=[];let t=st,n=t;for(let s=0;s<xl;s++){n=t,e.push(n);for(let i=1;i<Si;i++)n=n.add(t),e.push(n);t=n.double()}return e};let $o;const Eo=(e,t)=>{const n=t.negate();return e?n:t},rp=e=>{const t=$o||($o=ip());let n=bt,s=st;const i=2**es,r=i,o=Jn(i-1),a=Jn(es);for(let l=0;l<xl;l++){let c=Number(e&o);e>>=a,c>Si&&(c-=r,e+=1n);const u=l*Si,p=u,d=u+Math.abs(c)-1,h=l%2!==0,b=c<0;c===0?s=s.add(Eo(h,t[p])):n=n.add(Eo(b,t[d]))}return e!==0n&&Z("invalid wnaf"),{p:n,f:s}},Vs="taskmaster-device-identity-v1";function xi(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Al(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),s=atob(n),i=new Uint8Array(s.length);for(let r=0;r<s.length;r+=1)i[r]=s.charCodeAt(r);return i}function op(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function $l(e){const t=await crypto.subtle.digest("SHA-256",e);return op(new Uint8Array(t))}async function ap(){const e=np.randomSecretKey(),t=await Xd(e);return{deviceId:await $l(t),publicKey:xi(t),privateKey:xi(e)}}async function lp(){try{const n=localStorage.getItem(Vs);if(n){const s=JSON.parse(n);if((s==null?void 0:s.version)===1&&typeof s.deviceId=="string"&&typeof s.publicKey=="string"&&typeof s.privateKey=="string"){const i=await $l(Al(s.publicKey));if(i!==s.deviceId){const r={...s,deviceId:i};return localStorage.setItem(Vs,JSON.stringify(r)),{deviceId:i,publicKey:s.publicKey,privateKey:s.privateKey}}return{deviceId:s.deviceId,publicKey:s.publicKey,privateKey:s.privateKey}}}}catch{}const e=await ap(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(Vs,JSON.stringify(t)),e}async function cp(e,t){const n=Al(e),s=new TextEncoder().encode(t),i=await ep(s,n);return xi(i)}const El="taskmaster.device.auth.v1";function nr(e){return e.trim()}function up(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const s=n.trim();s&&t.add(s)}return[...t].sort()}function sr(){try{const e=window.localStorage.getItem(El);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 Tl(e){try{window.localStorage.setItem(El,JSON.stringify(e))}catch{}}function dp(e){const t=sr();if(!t||t.deviceId!==e.deviceId)return null;const n=nr(e.role),s=t.tokens[n];return!s||typeof s.token!="string"?null:s}function pp(e){const t=nr(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},s=sr();s&&s.deviceId===e.deviceId&&(n.tokens={...s.tokens});const i={token:e.token,role:t,scopes:up(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=i,Tl(n),i}function hp(e){const t=sr();if(!t||t.deviceId!==e.deviceId)return;const n=nr(e.role);if(!t.tokens[n])return;const s={...t,tokens:{...t.tokens}};delete s.tokens[n],Tl(s)}async function ir(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 rr(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 fp(e){return{method:"exec.approvals.get",params:{}}}async function gp(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=fp(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const s=await e.client.request(n.method,n.params);mp(e,s)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function mp(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=Ue(t.file??{}))}async function Cl(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 At(e,t,n){if(!t.trim())return;const s={...e.skillMessages};n?s[t]=n:delete s[t],e.skillMessages=s}function ys(e){return e instanceof Error?e.message:String(e)}async function $t(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=ys(n)}finally{e.skillsLoading=!1}}}function yp(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function vp(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 $t(e),At(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(s){const i=ys(s);e.skillsError=i,At(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function bp(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 $t(e),At(e,t,{kind:"success",message:"API key saved"})}catch(n){const s=ys(n);e.skillsError=s,At(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function wp(e,t,n,s){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const i=await e.client.request("skills.install",{name:n,installId:s,timeoutMs:12e4});await $t(e),At(e,t,{kind:"success",message:(i==null?void 0:i.message)??"Installed"})}catch(i){const r=ys(i);e.skillsError=r,At(e,t,{kind:"error",message:r})}finally{e.skillsBusyKey=null}}}const _l={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},Ml=new Map(Object.entries(_l).map(([e,t])=>[t,e]));function vs(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function ln(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 kp(e,t=""){const n=vs(t),s=_l[e];return n?`${n}${s}`:s}function Ll(e,t=""){const n=vs(t);let s=e||"/";n&&(s===n?s="/":s.startsWith(`${n}/`)&&(s=s.slice(n.length)));let i=ln(s).toLowerCase();return i.endsWith("/index.html")&&(i="/"),i==="/"?"chat":Ml.get(i)??null}function Sp(e){let t=ln(e);if(t.endsWith("/index.html")&&(t=ln(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let s=0;s<n.length;s++){const i=`/${n.slice(s).join("/")}`.toLowerCase();if(Ml.has(i)){const r=n.slice(0,s);return r.length?`/${r.join("/")}`:""}}return`/${n.join("/")}`}function xp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function or(e){return e==="system"?xp():e}const _n=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Ap=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,Mn=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},$p=({nextTheme:e,applyTheme:t,context:n,currentTheme:s})=>{var c;if(s===e)return;const i=globalThis.document??null;if(!i){t();return}const r=i.documentElement,o=i,a=Ap();if(!!o.startViewTransition&&!a){let u=.5,p=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")u=_n(n.pointerClientX/window.innerWidth),p=_n(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const d=n.element.getBoundingClientRect();d.width>0&&d.height>0&&typeof window<"u"&&(u=_n((d.left+d.width/2)/window.innerWidth),p=_n((d.top+d.height/2)/window.innerHeight))}r.style.setProperty("--theme-switch-x",`${u*100}%`),r.style.setProperty("--theme-switch-y",`${p*100}%`),r.classList.add("theme-transition");try{const d=(c=o.startViewTransition)==null?void 0:c.call(o,()=>{t()});d!=null&&d.finished?d.finished.finally(()=>Mn(r)):Mn(r)}catch{Mn(r),t()}return}t(),Mn(r)},Ep=2e3;async function wt(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 s=await e.client.request("sessions.transcript",{cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:200,maxBytesPerFile:e.sessionLogsFull?25e4:5e4,...e.sessionLogsFull?{full:!0}:{}}),i=Array.isArray(s.entries)?s.entries:[],r=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=r?i:[...e.sessionLogsEntries,...i].slice(-Ep),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 Tp=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:wt},Symbol.toStringTag,{value:"Module"}));async function Pl(e,t){if(!(!e.client||!e.connected))try{const n={},s=await e.client.request("memory.audit",n);s!=null&&s.ok&&(e.auditEntries=s.entries??[])}catch{}}async function Cp(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Le(e){return e instanceof Error?e.message:String(e)}let Ln=null;function dn(e,t){Ln&&clearTimeout(Ln),e.filesMessage={kind:"success",text:t},Ln=setTimeout(()=>{e.filesMessage=null,Ln=null},3e3)}async function pn(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 s=await e.client.request("files.tree",n);s!=null&&s.tree&&(e.filesTree=s.tree,e.filesRoot=s.root??"")}catch(n){e.filesError=Le(n)}finally{e.filesLoading=!1}}}}async function _p(e,t,n){e.filesSelectedPaths=new Set([t]),await Rl(e,t,n)}async function Mp(e,t,n){const s=new Set(e.filesSelectedPaths);if(s.has(t)?s.delete(t):s.add(t),e.filesSelectedPaths=s,s.size===1){const i=[...s][0];await Rl(e,i,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function Lp(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let s=0,i="";for(const r of n)try{await Il(e,r,t),s++}catch(o){i=Le(o)}i?e.filesMessage={kind:"error",text:`${s} downloaded, error: ${i}`}:dn(e,`${s} file${s!==1?"s":""} downloaded`)}async function Pp(e,t,n,s){const i=t.split("/").pop()??t,r=n==="."?i:`${n}/${i}`;r!==t&&await Nl(e,t,r,s)}async function Rl(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 s={path:t};n&&(s.agentId=n);const i=await e.client.request("files.read",s);e.filesPreviewContent=(i==null?void 0:i.content)??null,e.filesPreviewBinary=(i==null?void 0:i.binary)??!1,e.filesPreviewSize=(i==null?void 0:i.size)??null}catch(s){e.filesError=Le(s)}finally{e.filesPreviewLoading=!1}}}async function Il(e,t,n){if(!(!e.client||!e.connected))try{const s={path:t};n&&(s.agentId=n);const i=await e.client.request("files.download",s);if(!(i!=null&&i.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const r=Uint8Array.from(atob(i.base64),c=>c.charCodeAt(0)),o=new Blob([r]),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.download=i.name??t.split("/").pop()??"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}catch(s){e.filesMessage={kind:"error",text:Le(s)}}}async function Rp(e,t,n,s){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let i=0,r="";for(const o of n)try{const a=await o.arrayBuffer(),l=btoa(new Uint8Array(a).reduce((u,p)=>u+String.fromCharCode(p),"")),c={path:t,name:o.name,data:l};s&&(c.agentId=s),await e.client.request("files.upload",c),i++}catch(a){r=Le(a)}e.filesUploadBusy=!1,r?e.filesMessage={kind:"error",text:i>0?`${i} uploaded, error: ${r}`:r}:dn(e,`${i} file${i!==1?"s":""} uploaded`),await pn(e,s)}async function Ip(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={path:t};n&&(s.agentId=n),await e.client.request("files.delete",s),dn(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await pn(e,n)}catch(s){e.filesMessage={kind:"error",text:Le(s)}}}}async function Nl(e,t,n,s){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={from:t,to:n};s&&(i.agentId=s),await e.client.request("files.move",i),dn(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await pn(e,s)}catch(i){e.filesMessage={kind:"error",text:Le(i)}}}}async function ar(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const s=await e.client.request("memory.status",n);s!=null&&s.ok&&(e.filesMemoryStatus={dirty:s.dirty??!1,files:s.files??0,chunks:s.chunks??0})}catch{}}async function Np(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 s=await e.client.request("memory.reindex",n),i=(s==null?void 0:s.files)??0,r=(s==null?void 0:s.chunks)??0;dn(e,`Re-indexed: ${i} files, ${r} chunks`),await ar(e,t)}catch(n){e.filesMessage={kind:"error",text:Le(n)}}finally{e.filesReindexBusy=!1}}}function Dp(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n}async function Op(e,t,n){if(!(!e.client||!e.connected)){if(!t.trim()){e.filesSearchResults=null;return}e.filesSearchLoading=!0,e.filesSearchResults=null;try{const s={query:t.trim(),maxResults:20};n&&(s.agentId=n);const i=await e.client.request("memory.search",s);e.filesSearchResults=(i==null?void 0:i.results)??[]}catch(s){e.filesMessage={kind:"error",text:Le(s)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function Bp(e){e.filesSearchQuery="",e.filesSearchResults=null}function Fp(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{rr(e,{quiet:!0})},5e3))}function Up(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function lr(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Jt(e,{quiet:!0})},2e3))}function cr(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function ur(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{e.tab!=="logs"||e.logsSubTab!=="session"||wt(e,{quiet:!0})},2e3))}function dr(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function pr(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&Zi(e)},3e3))}function hr(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function Wp(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{Pl(e)},3e4))}function Kp(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function zp(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{e.tab==="files"&&ar(e)},1e4))}function jp(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function Be(e,t){var s;const n={...t,lastActiveSessionKey:((s=t.lastActiveSessionKey)==null?void 0:s.trim())||t.sessionKey.trim()||"main"};e.settings=n,Uu(n),t.theme!==e.theme&&(e.theme=t.theme,bs(e,or(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function Dl(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Be(e,{...e.settings,lastActiveSessionKey:n})}function Hp(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),s=t.get("password"),i=t.get("session"),r=t.get("gatewayUrl");let o=!1;if(n!=null){const l=n.trim();l&&l!==e.settings.token&&Be(e,{...e.settings,token:l}),t.delete("token"),o=!0}if(s!=null){const l=s.trim();l&&(e.password=l),t.delete("password"),o=!0}if(i!=null){const l=i.trim();l&&(e.sessionKey=l,Be(e,{...e.settings,sessionKey:l,lastActiveSessionKey:l}))}if(r!=null){const l=r.trim();l&&l!==e.settings.gatewayUrl&&Be(e,{...e.settings,gatewayUrl:l}),t.delete("gatewayUrl"),o=!0}if(!o)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function qp(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?ur(e):lr(e):(cr(e),dr(e)),t==="debug"?pr(e):hr(e),ts(e),Bl(e,t,!1)}function Gp(e,t,n){$p({nextTheme:t,applyTheme:()=>{e.theme=t,Be(e,{...e.settings,theme:t}),bs(e,or(t))},context:n,currentTheme:e.theme})}async function ts(e){if(e.tab==="overview"&&await Fl(e),e.tab==="channels"&&await eh(e),e.tab==="instances"&&await Cl(e),e.tab==="cron"&&await fr(e),e.tab==="skills"&&await $t(e),e.tab==="nodes"&&(await rr(e),await ir(e),await xe(e),await gp(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await rh(e),cn(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await al(e),await xe(e)),e.tab==="debug"&&(await Zi(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await pe(async()=>{const{loadSessionLogs:s}=await Promise.resolve().then(()=>Tp);return{loadSessionLogs:s}},void 0,import.meta.url);await n(e,{reset:!0})}else await Jt(e,{reset:!0});rl(e,!0)}}function Vp(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?vs(e):Sp(window.location.pathname)}function Qp(e){e.theme=e.settings.theme??"system",bs(e,or(e.theme))}function bs(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Yp(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"&&bs(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Xp(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 Zp(e,t){if(typeof window>"u")return;const n=Ll(window.location.pathname,e.basePath)??"chat";Ol(e,n),Bl(e,n,t)}function Jp(e){var i;if(typeof window>"u")return;const t=Ll(window.location.pathname,e.basePath);if(!t)return;const s=(i=new URL(window.location.href).searchParams.get("session"))==null?void 0:i.trim();s&&(e.sessionKey=s,Be(e,{...e.settings,sessionKey:s,lastActiveSessionKey:s})),Ol(e,t)}function Ol(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?ur(e):lr(e):(cr(e),dr(e)),t==="debug"?pr(e):hr(e),e.connected&&ts(e)}function Bl(e,t,n){if(typeof window>"u")return;const s=ln(kp(t,e.basePath)),i=ln(window.location.pathname),r=new URL(window.location.href);t==="chat"&&e.sessionKey?r.searchParams.set("session",e.sessionKey):r.searchParams.delete("session"),i!==s&&(r.pathname=s),n?window.history.replaceState({},"",r.toString()):window.history.pushState({},"",r.toString())}async function Fl(e){await Promise.all([q(e,!1),Cl(e),Qi(e),un(e),Zi(e)])}async function eh(e){await Promise.all([q(e,!0),al(e),xe(e)])}async function fr(e){await Promise.all([q(e,!1),un(e),gs(e)])}function Ul(e){return e.chatSending||!!e.chatRunId}function th(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 Wl(e){e.connected&&(e.chatMessage="",await sl(e))}function nh(e,t,n){const s=t.trim(),i=!!(n&&n.length>0);!s&&!i||(e.chatQueue=[...e.chatQueue,{id:Vi(),text:s,createdAt:Date.now(),attachments:i?n==null?void 0:n.map(r=>({...r})):void 0}],cn(e))}async function Kl(e,t,n){var i,r;Yi(e);const s=await nl(e,t,n==null?void 0:n.attachments);return!s&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!s&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),s&&Dl(e,e.sessionKey),s&&(n!=null&&n.restoreDraft)&&((i=n.previousDraft)!=null&&i.trim())&&(e.chatMessage=n.previousDraft),s&&(n!=null&&n.restoreAttachments)&&((r=n.previousAttachments)!=null&&r.length)&&(e.chatAttachments=n.previousAttachments),cn(e),s&&!e.chatRunId&&zl(e),s}async function zl(e){if(!e.connected||Ul(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await Kl(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function sh(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function ih(e,t,n){if(!e.connected)return;const s=e.chatMessage,i=(t??e.chatMessage).trim(),r=e.chatAttachments??[],o=t==null?r:[],a=o.length>0;if(!(!i&&!a)){if(th(i)){await Wl(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),Ul(e)){nh(e,i,o);return}await Kl(e,i,{previousDraft:t==null?s:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?o:void 0,previousAttachments:t==null?r:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function rh(e){await Promise.all([Me(e),Qi(e),Ai(e)]),cn(e,!0)}const oh=zl;function ah(e){var i,r,o;const t=Va(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(i=e.hello)==null?void 0:i.snapshot;return((o=(r=n==null?void 0:n.sessionDefaults)==null?void 0:r.defaultAgentId)==null?void 0:o.trim())||"main"}function lh(e,t){const n=vs(e),s=encodeURIComponent(t);return n?`${n}/avatar/${s}?meta=1`:`/avatar/${s}?meta=1`}async function Ai(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=ah(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=lh(e.basePath,t);try{const s=await fetch(n,{method:"GET"});if(!s.ok){e.chatAvatarUrl=null;return}const i=await s.json(),r=typeof i.avatarUrl=="string"?i.avatarUrl.trim():"";e.chatAvatarUrl=r||null}catch{e.chatAvatarUrl=null}}const D={messageSquare:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,radio:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:f`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:f`<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:f`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>`,image:f`<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:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:f`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:f`<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:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:f`<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:f`<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:f`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:f`<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:f`<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:f`<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>`,chevronDown:f`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:f`<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>`},ch="Taskmaster",uh="/taskmaster-icon.png",jl="#00d4ff";let Pn=null;function We(){return Pn||(Pn={name:window.__TASKMASTER_BRAND_NAME__||ch,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||uh,accentColor:window.__TASKMASTER_ACCENT_COLOR__||jl},Pn)}function dh(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 ph(e){if(e===jl)return;const t=dh(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 hh=f`<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>`,fh=f`<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 To=!1;function gh(){To||(To=!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 at(e,t){const n=(u,p)=>u===e?f`<span class="sp-page-nav-current">${u}</span>`:f`<a href=${p}>${u}</a>`,s=f`
19
19
  ${n("Setup","/setup")}
20
20
  ${n("Chat","/chat")}
21
21
  ${n("Admins","/admins")}
@@ -175,7 +175,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
175
175
  </div>
176
176
  `:f`
177
177
  <div class="sp-canvas-placeholder">
178
- <div class="sp-canvas-placeholder-icon">${O.globe}</div>
178
+ <div class="sp-canvas-placeholder-icon">${D.globe}</div>
179
179
  <p>Click Start to begin streaming the Chrome viewport.</p>
180
180
  </div>
181
181
  `}
@@ -204,7 +204,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
204
204
  @drop=${a=>vh(a,e.path,t)}
205
205
  >
206
206
  <span class="sp-tree-chevron">${i?"−":"+"}</span>
207
- <span class="sp-tree-icon">${O.folder}</span>
207
+ <span class="sp-tree-icon">${D.folder}</span>
208
208
  <span class="sp-tree-name">${e.name}</span>
209
209
  </div>
210
210
  ${i&&e.children?e.children.map(a=>ql(a,t,n+1)):k}
@@ -216,7 +216,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
216
216
  @click=${a=>{a.metaKey||a.ctrlKey?t.onToggleSelectFile(e.path):t.onSelectFile(e.path)}}
217
217
  @dragstart=${a=>{a.dataTransfer&&(a.dataTransfer.effectAllowed="move",a.dataTransfer.setData(ns,e.path),a.dataTransfer.setData("text/plain",e.name))}}
218
218
  >
219
- <span class="sp-tree-icon">${O.fileText}</span>
219
+ <span class="sp-tree-icon">${D.fileText}</span>
220
220
  <span class="sp-tree-name">${e.name}</span>
221
221
  <span class="sp-tree-size">${gr(e.size)}</span>
222
222
  </div>
@@ -393,7 +393,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
393
393
  @click=${()=>t.onInfoModalOpen(e)}
394
394
  title="Details"
395
395
  >
396
- ${O.info}
396
+ ${D.info}
397
397
  </button>
398
398
  `}function Th(e){var s;if(!e.infoModalOpen)return k;let t="",n=[];switch(e.infoModalOpen){case"gateway":{const i=typeof window<"u"?window.location.host:"unknown";t="Gateway",n=[{label:"Status",value:e.gatewayHealthy===!1?"Stopped":"Running"},{label:"Address",value:i},{label:"Health",value:e.gatewayHealthMessage||"OK"}];break}case"claude":{const i=e.authExpiresIn;let r="N/A";if(i!=null&&i>0)if(i>60){const o=Math.floor(i/60),a=i%60;r=a>0?`${o}h ${a}m`:`${o}h`}else r=`${i}m`;t="Claude",n=[{label:"Connected",value:e.authConnected?"Yes":"No"},{label:"Token Expiry",value:r},{label:"Renewal",value:"Automatic (tokens refresh on expiry)"},...e.authMessage?[{label:"Message",value:e.authMessage}]:[]];break}case"license":{const i=e.licenseStoredKey?`…${e.licenseStoredKey.slice(-12)}`:"N/A";t="License",n=[{label:"Status",value:e.licenseValid?"Active":"Inactive"},{label:"Key",value:i},{label:"Tier",value:e.licenseTier||"Standard"},{label:"Device ID",value:e.licenseDeviceId||"N/A"}];break}case"whatsapp":{const i=_t(e),r=i?vr(i,e):null;t="WhatsApp",n=[{label:"Account",value:(r==null?void 0:r.name)||(r==null?void 0:r.accountId)||"Default"},{label:"Phone",value:((s=r==null?void 0:r.self)==null?void 0:s.e164)||"Not paired"},{label:"Connected",value:r!=null&&r.connected?"Yes":"No"},{label:"Linked",value:r!=null&&r.linked?"Yes":"No"},...r!=null&&r.lastError?[{label:"Last Error",value:r.lastError}]:[]];break}case"imessage":{const{thisWsOwns:i}=br(e);t="iMessage",n=[{label:"Connected",value:i&&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}default:return k}return f`
399
399
  <div class="setup-info-overlay" @click=${i=>{i.target.classList.contains("setup-info-overlay")&&e.onInfoModalClose()}}>
@@ -641,12 +641,12 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
641
641
  @click=${i}
642
642
  title="Save"
643
643
  style="color: #22c55e;"
644
- >${O.check}</button>
644
+ >${D.check}</button>
645
645
  <button
646
646
  class="setup-status-action"
647
647
  @click=${e.onWorkspaceRenameCancel}
648
648
  title="Cancel"
649
- >${O.x}</button>
649
+ >${D.x}</button>
650
650
  </div>
651
651
  `}return f`
652
652
  <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;">
@@ -657,7 +657,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
657
657
  @click=${e.onWorkspaceRenameStart}
658
658
  title="Rename"
659
659
  style="opacity: 0.5; transform: scale(0.8);"
660
- >${O.edit}</button>
660
+ >${D.edit}</button>
661
661
  </div>
662
662
  <button
663
663
  class="setup-status-action ${s?"spinning":""}"
@@ -665,7 +665,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
665
665
  @click=${e.onRefreshStatus}
666
666
  title="Refresh Status"
667
667
  >
668
- ${O.rotateCw}
668
+ ${D.rotateCw}
669
669
  </button>
670
670
  </div>
671
671
  `}function Lo(e){return f`
@@ -682,7 +682,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
682
682
  @click=${e.onRestartGateway}
683
683
  title="Restart Gateway"
684
684
  >
685
- ${O.rotateCw}
685
+ ${D.rotateCw}
686
686
  </button>
687
687
  </div>
688
688
  `}function Po(e){const t=e.authConnected===!0;return f`
@@ -702,7 +702,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
702
702
  @click=${e.onStartAuth}
703
703
  title="Refresh Token"
704
704
  >
705
- ${O.rotateCw}
705
+ ${D.rotateCw}
706
706
  </button>
707
707
  `:f`
708
708
  <button
@@ -710,7 +710,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
710
710
  @click=${e.onStartAuth}
711
711
  title="Connect Claude"
712
712
  >
713
- ${O.rotateCw}
713
+ ${D.rotateCw}
714
714
  </button>
715
715
  `}
716
716
  </div>
@@ -727,7 +727,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
727
727
  @click=${()=>{e.licenseRemoveConfirm?e.onLicenseRemoveCancel():e.onLicenseRemoveConfirm()}}
728
728
  title="Manage License"
729
729
  >
730
- ${O.rotateCw}
730
+ ${D.rotateCw}
731
731
  </button>
732
732
  ${e.licenseRemoveConfirm?f`
733
733
  <div style="width: 100%; margin-top: 8px; margin-left: 30px;">
@@ -767,7 +767,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
767
767
  title="WhatsApp Settings"
768
768
  style="opacity: 0.5; transform: scale(0.75);"
769
769
  >
770
- ${O.settings}
770
+ ${D.settings}
771
771
  </button>
772
772
  `:k}
773
773
  </div>
@@ -781,7 +781,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
781
781
  @click=${()=>e.onWhatsAppRelink(c)}
782
782
  title="${s?"Relink":"Link"} WhatsApp"
783
783
  >
784
- ${O.rotateCw}
784
+ ${D.rotateCw}
785
785
  </button>
786
786
  `:k}
787
787
  ${u&&e.whatsappLoginQrDataUrl?f`
@@ -914,7 +914,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
914
914
  @click=${e.onIMessageEnable}
915
915
  title="${n?"Manage iMessage":"Connect iMessage"}"
916
916
  >
917
- ${O.rotateCw}
917
+ ${D.rotateCw}
918
918
  </button>
919
919
  ${k}
920
920
  </div>
@@ -1031,7 +1031,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
1031
1031
  style=${c.hasKey?"":"display: none;"}
1032
1032
  title="Toggle visibility"
1033
1033
  @click=${i}
1034
- >${O.eye}</button>
1034
+ >${D.eye}</button>
1035
1035
  ${u?f`<span class="setup-apikey-badge saving">Saving\u2026</span>`:f`<button
1036
1036
  class="setup-apikey-save setup-button"
1037
1037
  style="display: none;"
@@ -1044,7 +1044,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
1044
1044
  title="Remove key"
1045
1045
  ?disabled=${e.apiKeyBusy}
1046
1046
  @click=${()=>e.onApiKeyRemove(c.id)}
1047
- >${O.trash}</button>
1047
+ >${D.trash}</button>
1048
1048
  `:k}
1049
1049
  </div>
1050
1050
  </div>
@@ -1079,7 +1079,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
1079
1079
  @click=${e.onUpdateRun}
1080
1080
  title="Update Now"
1081
1081
  >
1082
- ${O.download}
1082
+ ${D.download}
1083
1083
  </button>
1084
1084
  `:f`
1085
1085
  <button
@@ -1088,7 +1088,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
1088
1088
  @click=${e.onUpdateCheck}
1089
1089
  title="Check for Updates"
1090
1090
  >
1091
- ${O.rotateCw}
1091
+ ${D.rotateCw}
1092
1092
  </button>
1093
1093
  `}
1094
1094
  </div>
@@ -1101,7 +1101,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
1101
1101
  ${e.updateProgressSteps.map(o=>f`
1102
1102
  <div class="setup-update-step ${o.status}">
1103
1103
  <span class="setup-update-step-icon">
1104
- ${o.status==="running"?f`<span class="setup-update-spinner"></span>`:o.status==="done"?f`<span class="setup-update-check">&#10003;</span>`:f`<span class="setup-update-cross">&#10007;</span>`}
1104
+ ${o.status==="running"?f`<span class="setup-update-spinner"></span>`:o.status==="done"?f`<span class="setup-update-icon-ok">${D.check}</span>`:f`<span class="setup-update-icon-fail">${D.x}</span>`}
1105
1105
  </span>
1106
1106
  <span class="setup-update-step-name">${o.name}</span>
1107
1107
  ${o.durationMs!=null?f`<span class="setup-update-step-time">${Bo(o.durationMs)}</span>`:k}
@@ -1115,7 +1115,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
1115
1115
  `;if(n){const o=n.status==="ok";let a;if(o){const c=(s=n.before)==null?void 0:s.version,u=((i=n.after)==null?void 0:i.version)??n.currentVersion;a=c?`v${c} → v${u}`:`Updated to v${u}`}else a=n.reason??((r=n.failedStep)==null?void 0:r.name)??"unknown error";const l=n.durationMs!=null?Bo(n.durationMs):null;return f`
1116
1116
  <div class="setup-info-overlay" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onUpdateDismissResult()}}>
1117
1117
  <div class="setup-info-card" style="max-width: 360px; text-align: center;">
1118
- <div style="font-size: 40px; margin-bottom: 8px;">${o?"":""}</div>
1118
+ <div class="setup-update-result-icon ${o?"ok":"fail"}">${o?D.circleCheck:D.circleX}</div>
1119
1119
  <h3 style="color: ${o?"#22c55e":"#ef4444"};">
1120
1120
  ${o?"Update Complete":"Update Failed"}
1121
1121
  </h3>
@@ -1150,7 +1150,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
1150
1150
  <div class="setup-info-header">
1151
1151
  <h3>${t?"Change Account PIN":"Set Account PIN"}</h3>
1152
1152
  <button class="setup-info-close" @click=${()=>e.onAccountPinModalClose()}>
1153
- ${O.close}
1153
+ ${D.close}
1154
1154
  </button>
1155
1155
  </div>
1156
1156
  <form @submit=${l} style="display: flex; flex-direction: column; gap: 12px; padding: 16px 0 8px;">
@@ -1729,7 +1729,7 @@ ${s}`:c.join(", ");l.push({type:"text",text:h})}else s&&l.push({type:"text",text
1729
1729
  </div>
1730
1730
  </div>
1731
1731
  </div>
1732
- `}const Vl={CHILD:2},Ql=e=>(...t)=>({_$litDirective$:e,values:t});let Yl=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:jh}=Mu,Ho=e=>e,qo=()=>document.createComment(""),Ot=(e,t,n)=>{var r;const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=s.insertBefore(qo(),i),a=s.insertBefore(qo(),i);n=new jh(o,a,e,e.options)}else{const o=n._$AB.nextSibling,a=n._$AM,l=a!==e;if(l){let c;(r=n._$AQ)==null||r.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==a._$AU&&n._$AP(c)}if(o!==i||l){let c=n._$AA;for(;c!==o;){const u=Ho(c).nextSibling;Ho(s).insertBefore(c,i),c=u}}}return n},Ve=(e,t,n=e)=>(e._$AI(t,n),e),Hh={},qh=(e,t=Hh)=>e._$AH=t,Gh=e=>e._$AH,Qs=e=>{e._$AR(),e._$AA.remove()};const Go=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Vh=Ql(class extends Yl{constructor(e){if(super(e),e.type!==Vl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],r=[];let o=0;for(const a of e)i[o]=s?s(a,o):o,r[o]=n(a,o),o++;return{values:r,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Gh(e),{values:r,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,r;const a=this.ut??(this.ut=[]),l=[];let c,u,p=0,d=i.length-1,h=0,b=r.length-1;for(;p<=d&&h<=b;)if(i[p]===null)p++;else if(i[d]===null)d--;else if(a[p]===o[h])l[h]=Ve(i[p],r[h]),p++,h++;else if(a[d]===o[b])l[b]=Ve(i[d],r[b]),d--,b--;else if(a[p]===o[b])l[b]=Ve(i[p],r[b]),Ot(e,l[b+1],i[p]),p++,b--;else if(a[d]===o[h])l[h]=Ve(i[d],r[h]),Ot(e,i[p],i[d]),d--,h++;else if(c===void 0&&(c=Go(o,h,b),u=Go(a,p,d)),c.has(a[p]))if(c.has(a[d])){const w=u.get(o[h]),S=w!==void 0?i[w]:null;if(S===null){const T=Ot(e,i[p]);Ve(T,r[h]),l[h]=T}else l[h]=Ve(S,r[h]),Ot(e,i[p],S),i[w]=null;h++}else Qs(i[d]),d--;else Qs(i[p]),p++;for(;h<=b;){const w=Ot(e,l[b+1]);Ve(w,r[h]),l[h++]=w}for(;p<=d;){const w=i[p++];w!==null&&Qs(w)}return this.ut=o,qh(e,l),Fe}});class $i extends Yl{constructor(t){if(super(t),this.it=k,t.type!==Vl.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===Fe)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:[]}}}$i.directiveName="unsafeHTML",$i.resultType=1;const Ei=Ql($i);const{entries:Xl,setPrototypeOf:Vo,isFrozen:Qh,getPrototypeOf:Yh,getOwnPropertyDescriptor:Xh}=Object;let{freeze:ae,seal:de,create:Ti}=Object,{apply:Ci,construct:_i}=typeof Reflect<"u"&&Reflect;ae||(ae=function(t){return t});de||(de=function(t){return t});Ci||(Ci=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),r=2;r<s;r++)i[r-2]=arguments[r];return t.apply(n,i)});_i||(_i=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Rn=le(Array.prototype.forEach),Zh=le(Array.prototype.lastIndexOf),Qo=le(Array.prototype.pop),Bt=le(Array.prototype.push),Jh=le(Array.prototype.splice),jn=le(String.prototype.toLowerCase),Ys=le(String.prototype.toString),Xs=le(String.prototype.match),Ft=le(String.prototype.replace),ef=le(String.prototype.indexOf),tf=le(String.prototype.trim),he=le(Object.prototype.hasOwnProperty),re=le(RegExp.prototype.test),Ut=nf(TypeError);function le(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return Ci(e,t,s)}}function nf(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return _i(e,n)}}function D(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jn;Vo&&Vo(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const r=n(i);r!==i&&(Qh(t)||(t[s]=r),i=r)}e[i]=!0}return e}function sf(e){for(let t=0;t<e.length;t++)he(e,t)||(e[t]=null);return e}function ke(e){const t=Ti(null);for(const[n,s]of Xl(e))he(e,n)&&(Array.isArray(s)?t[n]=sf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=ke(s):t[n]=s);return t}function Wt(e,t){for(;e!==null;){const s=Xh(e,t);if(s){if(s.get)return le(s.get);if(typeof s.value=="function")return le(s.value)}e=Yh(e)}function n(){return null}return n}const Yo=ae(["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"]),Zs=ae(["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"]),Js=ae(["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"]),rf=ae(["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"]),ei=ae(["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"]),of=ae(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Xo=ae(["#text"]),Zo=ae(["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"]),ti=ae(["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"]),Jo=ae(["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"]),In=ae(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),af=de(/\{\{[\w\W]*|[\w\W]*\}\}/gm),lf=de(/<%[\w\W]*|[\w\W]*%>/gm),cf=de(/\$\{[\w\W]*/gm),uf=de(/^data-[\-\w.\u00B7-\uFFFF]+$/),df=de(/^aria-[\-\w]+$/),Zl=de(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pf=de(/^(?:\w+script|data):/i),hf=de(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jl=de(/^html$/i),ff=de(/^[a-z][.\w]*(-[.\w]+)+$/i);var ea=Object.freeze({__proto__:null,ARIA_ATTR:df,ATTR_WHITESPACE:hf,CUSTOM_ELEMENT:ff,DATA_ATTR:uf,DOCTYPE_NAME:Jl,ERB_EXPR:lf,IS_ALLOWED_URI:Zl,IS_SCRIPT_OR_DATA:pf,MUSTACHE_EXPR:af,TMPLIT_EXPR:cf});const Kt={element:1,text:3,progressingInstruction:7,comment:8,document:9},gf=function(){return typeof window>"u"?null:window},mf=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const r="dompurify"+(s?"#"+s:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},ta=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ec(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gf();const t=P=>ec(P);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Kt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:h}=e,b=l.prototype,w=Wt(b,"cloneNode"),S=Wt(b,"remove"),T=Wt(b,"nextSibling"),A=Wt(b,"childNodes"),E=Wt(b,"parentNode");if(typeof o=="function"){const P=n.createElement("template");P.content&&P.content.ownerDocument&&(n=P.content.ownerDocument)}let C,R="";const{implementation:U,createNodeIterator:Q,createDocumentFragment:ze,getElementsByTagName:Lt}=n,{importNode:gn}=s;let J=ta();t.isSupported=typeof Xl=="function"&&typeof E=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Pt,ERB_EXPR:ut,TMPLIT_EXPR:je,DATA_ATTR:As,ARIA_ATTR:$s,IS_SCRIPT_OR_DATA:Es,ATTR_WHITESPACE:mn,CUSTOM_ELEMENT:Ts}=ea;let{IS_ALLOWED_URI:yn}=ea,G=null;const vn=D({},[...Yo,...Zs,...Js,...ei,...Xo]);let V=null;const bn=D({},[...Zo,...ti,...Jo,...In]);let j=Object.seal(Ti(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}})),He=null,Rt=null;const Re=Object.seal(Ti(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let wn=!0,x=!0,_=!1,I=!0,N=!1,H=!0,K=!1,ie=!1,Ie=!1,dt=!1,kn=!1,Sn=!1,Br=!0,Fr=!1;const Jc="user-content-";let Cs=!0,It=!1,pt={},ye=null;const _s=D({},["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 Ur=null;const Wr=D({},["audio","video","img","source","image","track"]);let Ms=null;const Kr=D({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xn="http://www.w3.org/1998/Math/MathML",An="http://www.w3.org/2000/svg",Ae="http://www.w3.org/1999/xhtml";let ht=Ae,Ls=!1,Ps=null;const eu=D({},[xn,An,Ae],Ys);let $n=D({},["mi","mo","mn","ms","mtext"]),En=D({},["annotation-xml"]);const tu=D({},["title","style","font","a","script"]);let Nt=null;const nu=["application/xhtml+xml","text/html"],su="text/html";let X=null,ft=null;const iu=n.createElement("form"),zr=function(v){return v instanceof RegExp||v instanceof Function},Rs=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ft&&ft===v)){if((!v||typeof v!="object")&&(v={}),v=ke(v),Nt=nu.indexOf(v.PARSER_MEDIA_TYPE)===-1?su:v.PARSER_MEDIA_TYPE,X=Nt==="application/xhtml+xml"?Ys:jn,G=he(v,"ALLOWED_TAGS")?D({},v.ALLOWED_TAGS,X):vn,V=he(v,"ALLOWED_ATTR")?D({},v.ALLOWED_ATTR,X):bn,Ps=he(v,"ALLOWED_NAMESPACES")?D({},v.ALLOWED_NAMESPACES,Ys):eu,Ms=he(v,"ADD_URI_SAFE_ATTR")?D(ke(Kr),v.ADD_URI_SAFE_ATTR,X):Kr,Ur=he(v,"ADD_DATA_URI_TAGS")?D(ke(Wr),v.ADD_DATA_URI_TAGS,X):Wr,ye=he(v,"FORBID_CONTENTS")?D({},v.FORBID_CONTENTS,X):_s,He=he(v,"FORBID_TAGS")?D({},v.FORBID_TAGS,X):ke({}),Rt=he(v,"FORBID_ATTR")?D({},v.FORBID_ATTR,X):ke({}),pt=he(v,"USE_PROFILES")?v.USE_PROFILES:!1,wn=v.ALLOW_ARIA_ATTR!==!1,x=v.ALLOW_DATA_ATTR!==!1,_=v.ALLOW_UNKNOWN_PROTOCOLS||!1,I=v.ALLOW_SELF_CLOSE_IN_ATTR!==!1,N=v.SAFE_FOR_TEMPLATES||!1,H=v.SAFE_FOR_XML!==!1,K=v.WHOLE_DOCUMENT||!1,dt=v.RETURN_DOM||!1,kn=v.RETURN_DOM_FRAGMENT||!1,Sn=v.RETURN_TRUSTED_TYPE||!1,Ie=v.FORCE_BODY||!1,Br=v.SANITIZE_DOM!==!1,Fr=v.SANITIZE_NAMED_PROPS||!1,Cs=v.KEEP_CONTENT!==!1,It=v.IN_PLACE||!1,yn=v.ALLOWED_URI_REGEXP||Zl,ht=v.NAMESPACE||Ae,$n=v.MATHML_TEXT_INTEGRATION_POINTS||$n,En=v.HTML_INTEGRATION_POINTS||En,j=v.CUSTOM_ELEMENT_HANDLING||{},v.CUSTOM_ELEMENT_HANDLING&&zr(v.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=v.CUSTOM_ELEMENT_HANDLING.tagNameCheck),v.CUSTOM_ELEMENT_HANDLING&&zr(v.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=v.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),v.CUSTOM_ELEMENT_HANDLING&&typeof v.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(j.allowCustomizedBuiltInElements=v.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),N&&(x=!1),kn&&(dt=!0),pt&&(G=D({},Xo),V=[],pt.html===!0&&(D(G,Yo),D(V,Zo)),pt.svg===!0&&(D(G,Zs),D(V,ti),D(V,In)),pt.svgFilters===!0&&(D(G,Js),D(V,ti),D(V,In)),pt.mathMl===!0&&(D(G,ei),D(V,Jo),D(V,In))),v.ADD_TAGS&&(typeof v.ADD_TAGS=="function"?Re.tagCheck=v.ADD_TAGS:(G===vn&&(G=ke(G)),D(G,v.ADD_TAGS,X))),v.ADD_ATTR&&(typeof v.ADD_ATTR=="function"?Re.attributeCheck=v.ADD_ATTR:(V===bn&&(V=ke(V)),D(V,v.ADD_ATTR,X))),v.ADD_URI_SAFE_ATTR&&D(Ms,v.ADD_URI_SAFE_ATTR,X),v.FORBID_CONTENTS&&(ye===_s&&(ye=ke(ye)),D(ye,v.FORBID_CONTENTS,X)),v.ADD_FORBID_CONTENTS&&(ye===_s&&(ye=ke(ye)),D(ye,v.ADD_FORBID_CONTENTS,X)),Cs&&(G["#text"]=!0),K&&D(G,["html","head","body"]),G.table&&(D(G,["tbody"]),delete He.tbody),v.TRUSTED_TYPES_POLICY){if(typeof v.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof v.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=v.TRUSTED_TYPES_POLICY,R=C.createHTML("")}else C===void 0&&(C=mf(h,i)),C!==null&&typeof R=="string"&&(R=C.createHTML(""));ae&&ae(v),ft=v}},jr=D({},[...Zs,...Js,...rf]),Hr=D({},[...ei,...of]),ru=function(v){let $=E(v);(!$||!$.tagName)&&($={namespaceURI:ht,tagName:"template"});const L=jn(v.tagName),z=jn($.tagName);return Ps[v.namespaceURI]?v.namespaceURI===An?$.namespaceURI===Ae?L==="svg":$.namespaceURI===xn?L==="svg"&&(z==="annotation-xml"||$n[z]):!!jr[L]:v.namespaceURI===xn?$.namespaceURI===Ae?L==="math":$.namespaceURI===An?L==="math"&&En[z]:!!Hr[L]:v.namespaceURI===Ae?$.namespaceURI===An&&!En[z]||$.namespaceURI===xn&&!$n[z]?!1:!Hr[L]&&(tu[L]||!jr[L]):!!(Nt==="application/xhtml+xml"&&Ps[v.namespaceURI]):!1},ve=function(v){Bt(t.removed,{element:v});try{E(v).removeChild(v)}catch{S(v)}},qe=function(v,$){try{Bt(t.removed,{attribute:$.getAttributeNode(v),from:$})}catch{Bt(t.removed,{attribute:null,from:$})}if($.removeAttribute(v),v==="is")if(dt||kn)try{ve($)}catch{}else try{$.setAttribute(v,"")}catch{}},qr=function(v){let $=null,L=null;if(Ie)v="<remove></remove>"+v;else{const Y=Xs(v,/^[\r\n\t ]+/);L=Y&&Y[0]}Nt==="application/xhtml+xml"&&ht===Ae&&(v='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+v+"</body></html>");const z=C?C.createHTML(v):v;if(ht===Ae)try{$=new d().parseFromString(z,Nt)}catch{}if(!$||!$.documentElement){$=U.createDocument(ht,"template",null);try{$.documentElement.innerHTML=Ls?R:z}catch{}}const te=$.body||$.documentElement;return v&&L&&te.insertBefore(n.createTextNode(L),te.childNodes[0]||null),ht===Ae?Lt.call($,K?"html":"body")[0]:K?$.documentElement:te},Gr=function(v){return Q.call(v.ownerDocument||v,v,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Is=function(v){return v instanceof p&&(typeof v.nodeName!="string"||typeof v.textContent!="string"||typeof v.removeChild!="function"||!(v.attributes instanceof u)||typeof v.removeAttribute!="function"||typeof v.setAttribute!="function"||typeof v.namespaceURI!="string"||typeof v.insertBefore!="function"||typeof v.hasChildNodes!="function")},Vr=function(v){return typeof a=="function"&&v instanceof a};function $e(P,v,$){Rn(P,L=>{L.call(t,v,$,ft)})}const Qr=function(v){let $=null;if($e(J.beforeSanitizeElements,v,null),Is(v))return ve(v),!0;const L=X(v.nodeName);if($e(J.uponSanitizeElement,v,{tagName:L,allowedTags:G}),H&&v.hasChildNodes()&&!Vr(v.firstElementChild)&&re(/<[/\w!]/g,v.innerHTML)&&re(/<[/\w!]/g,v.textContent)||v.nodeType===Kt.progressingInstruction||H&&v.nodeType===Kt.comment&&re(/<[/\w]/g,v.data))return ve(v),!0;if(!(Re.tagCheck instanceof Function&&Re.tagCheck(L))&&(!G[L]||He[L])){if(!He[L]&&Xr(L)&&(j.tagNameCheck instanceof RegExp&&re(j.tagNameCheck,L)||j.tagNameCheck instanceof Function&&j.tagNameCheck(L)))return!1;if(Cs&&!ye[L]){const z=E(v)||v.parentNode,te=A(v)||v.childNodes;if(te&&z){const Y=te.length;for(let ce=Y-1;ce>=0;--ce){const Ee=w(te[ce],!0);Ee.__removalCount=(v.__removalCount||0)+1,z.insertBefore(Ee,T(v))}}}return ve(v),!0}return v instanceof l&&!ru(v)||(L==="noscript"||L==="noembed"||L==="noframes")&&re(/<\/no(script|embed|frames)/i,v.innerHTML)?(ve(v),!0):(N&&v.nodeType===Kt.text&&($=v.textContent,Rn([Pt,ut,je],z=>{$=Ft($,z," ")}),v.textContent!==$&&(Bt(t.removed,{element:v.cloneNode()}),v.textContent=$)),$e(J.afterSanitizeElements,v,null),!1)},Yr=function(v,$,L){if(Br&&($==="id"||$==="name")&&(L in n||L in iu))return!1;if(!(x&&!Rt[$]&&re(As,$))){if(!(wn&&re($s,$))){if(!(Re.attributeCheck instanceof Function&&Re.attributeCheck($,v))){if(!V[$]||Rt[$]){if(!(Xr(v)&&(j.tagNameCheck instanceof RegExp&&re(j.tagNameCheck,v)||j.tagNameCheck instanceof Function&&j.tagNameCheck(v))&&(j.attributeNameCheck instanceof RegExp&&re(j.attributeNameCheck,$)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck($,v))||$==="is"&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&re(j.tagNameCheck,L)||j.tagNameCheck instanceof Function&&j.tagNameCheck(L))))return!1}else if(!Ms[$]){if(!re(yn,Ft(L,mn,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&v!=="script"&&ef(L,"data:")===0&&Ur[v])){if(!(_&&!re(Es,Ft(L,mn,"")))){if(L)return!1}}}}}}}return!0},Xr=function(v){return v!=="annotation-xml"&&Xs(v,Ts)},Zr=function(v){$e(J.beforeSanitizeAttributes,v,null);const{attributes:$}=v;if(!$||Is(v))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0};let z=$.length;for(;z--;){const te=$[z],{name:Y,namespaceURI:ce,value:Ee}=te,gt=X(Y),Ns=Ee;let ee=Y==="value"?Ns:tf(Ns);if(L.attrName=gt,L.attrValue=ee,L.keepAttr=!0,L.forceKeepAttr=void 0,$e(J.uponSanitizeAttribute,v,L),ee=L.attrValue,Fr&&(gt==="id"||gt==="name")&&(qe(Y,v),ee=Jc+ee),H&&re(/((--!?|])>)|<\/(style|title|textarea)/i,ee)){qe(Y,v);continue}if(gt==="attributename"&&Xs(ee,"href")){qe(Y,v);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){qe(Y,v);continue}if(!I&&re(/\/>/i,ee)){qe(Y,v);continue}N&&Rn([Pt,ut,je],eo=>{ee=Ft(ee,eo," ")});const Jr=X(v.nodeName);if(!Yr(Jr,gt,ee)){qe(Y,v);continue}if(C&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!ce)switch(h.getAttributeType(Jr,gt)){case"TrustedHTML":{ee=C.createHTML(ee);break}case"TrustedScriptURL":{ee=C.createScriptURL(ee);break}}if(ee!==Ns)try{ce?v.setAttributeNS(ce,Y,ee):v.setAttribute(Y,ee),Is(v)?ve(v):Qo(t.removed)}catch{qe(Y,v)}}$e(J.afterSanitizeAttributes,v,null)},ou=function P(v){let $=null;const L=Gr(v);for($e(J.beforeSanitizeShadowDOM,v,null);$=L.nextNode();)$e(J.uponSanitizeShadowNode,$,null),Qr($),Zr($),$.content instanceof r&&P($.content);$e(J.afterSanitizeShadowDOM,v,null)};return t.sanitize=function(P){let v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,L=null,z=null,te=null;if(Ls=!P,Ls&&(P="<!-->"),typeof P!="string"&&!Vr(P))if(typeof P.toString=="function"){if(P=P.toString(),typeof P!="string")throw Ut("dirty is not a string, aborting")}else throw Ut("toString is not a function");if(!t.isSupported)return P;if(ie||Rs(v),t.removed=[],typeof P=="string"&&(It=!1),It){if(P.nodeName){const Ee=X(P.nodeName);if(!G[Ee]||He[Ee])throw Ut("root node is forbidden and cannot be sanitized in-place")}}else if(P instanceof a)$=qr("<!---->"),L=$.ownerDocument.importNode(P,!0),L.nodeType===Kt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?$=L:$.appendChild(L);else{if(!dt&&!N&&!K&&P.indexOf("<")===-1)return C&&Sn?C.createHTML(P):P;if($=qr(P),!$)return dt?null:Sn?R:""}$&&Ie&&ve($.firstChild);const Y=Gr(It?P:$);for(;z=Y.nextNode();)Qr(z),Zr(z),z.content instanceof r&&ou(z.content);if(It)return P;if(dt){if(kn)for(te=ze.call($.ownerDocument);$.firstChild;)te.appendChild($.firstChild);else te=$;return(V.shadowroot||V.shadowrootmode)&&(te=gn.call(s,te,!0)),te}let ce=K?$.outerHTML:$.innerHTML;return K&&G["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&re(Jl,$.ownerDocument.doctype.name)&&(ce="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
1732
+ `}const Vl={CHILD:2},Ql=e=>(...t)=>({_$litDirective$:e,values:t});let Yl=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,s){this._$Ct=t,this._$AM=n,this._$Ci=s}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:jh}=Mu,Ho=e=>e,qo=()=>document.createComment(""),Ot=(e,t,n)=>{var r;const s=e._$AA.parentNode,i=t===void 0?e._$AB:t._$AA;if(n===void 0){const o=s.insertBefore(qo(),i),a=s.insertBefore(qo(),i);n=new jh(o,a,e,e.options)}else{const o=n._$AB.nextSibling,a=n._$AM,l=a!==e;if(l){let c;(r=n._$AQ)==null||r.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==a._$AU&&n._$AP(c)}if(o!==i||l){let c=n._$AA;for(;c!==o;){const u=Ho(c).nextSibling;Ho(s).insertBefore(c,i),c=u}}}return n},Ve=(e,t,n=e)=>(e._$AI(t,n),e),Hh={},qh=(e,t=Hh)=>e._$AH=t,Gh=e=>e._$AH,Qs=e=>{e._$AR(),e._$AA.remove()};const Go=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Vh=Ql(class extends Yl{constructor(e){if(super(e),e.type!==Vl.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let s;n===void 0?n=t:t!==void 0&&(s=t);const i=[],r=[];let o=0;for(const a of e)i[o]=s?s(a,o):o,r[o]=n(a,o),o++;return{values:r,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,s]){const i=Gh(e),{values:r,keys:o}=this.dt(t,n,s);if(!Array.isArray(i))return this.ut=o,r;const a=this.ut??(this.ut=[]),l=[];let c,u,p=0,d=i.length-1,h=0,b=r.length-1;for(;p<=d&&h<=b;)if(i[p]===null)p++;else if(i[d]===null)d--;else if(a[p]===o[h])l[h]=Ve(i[p],r[h]),p++,h++;else if(a[d]===o[b])l[b]=Ve(i[d],r[b]),d--,b--;else if(a[p]===o[b])l[b]=Ve(i[p],r[b]),Ot(e,l[b+1],i[p]),p++,b--;else if(a[d]===o[h])l[h]=Ve(i[d],r[h]),Ot(e,i[p],i[d]),d--,h++;else if(c===void 0&&(c=Go(o,h,b),u=Go(a,p,d)),c.has(a[p]))if(c.has(a[d])){const w=u.get(o[h]),S=w!==void 0?i[w]:null;if(S===null){const T=Ot(e,i[p]);Ve(T,r[h]),l[h]=T}else l[h]=Ve(S,r[h]),Ot(e,i[p],S),i[w]=null;h++}else Qs(i[d]),d--;else Qs(i[p]),p++;for(;h<=b;){const w=Ot(e,l[b+1]);Ve(w,r[h]),l[h++]=w}for(;p<=d;){const w=i[p++];w!==null&&Qs(w)}return this.ut=o,qh(e,l),Fe}});class $i extends Yl{constructor(t){if(super(t),this.it=k,t.type!==Vl.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===Fe)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:[]}}}$i.directiveName="unsafeHTML",$i.resultType=1;const Ei=Ql($i);const{entries:Xl,setPrototypeOf:Vo,isFrozen:Qh,getPrototypeOf:Yh,getOwnPropertyDescriptor:Xh}=Object;let{freeze:ae,seal:de,create:Ti}=Object,{apply:Ci,construct:_i}=typeof Reflect<"u"&&Reflect;ae||(ae=function(t){return t});de||(de=function(t){return t});Ci||(Ci=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),r=2;r<s;r++)i[r-2]=arguments[r];return t.apply(n,i)});_i||(_i=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const Rn=le(Array.prototype.forEach),Zh=le(Array.prototype.lastIndexOf),Qo=le(Array.prototype.pop),Bt=le(Array.prototype.push),Jh=le(Array.prototype.splice),jn=le(String.prototype.toLowerCase),Ys=le(String.prototype.toString),Xs=le(String.prototype.match),Ft=le(String.prototype.replace),ef=le(String.prototype.indexOf),tf=le(String.prototype.trim),he=le(Object.prototype.hasOwnProperty),re=le(RegExp.prototype.test),Ut=nf(TypeError);function le(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return Ci(e,t,s)}}function nf(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return _i(e,n)}}function O(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jn;Vo&&Vo(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const r=n(i);r!==i&&(Qh(t)||(t[s]=r),i=r)}e[i]=!0}return e}function sf(e){for(let t=0;t<e.length;t++)he(e,t)||(e[t]=null);return e}function ke(e){const t=Ti(null);for(const[n,s]of Xl(e))he(e,n)&&(Array.isArray(s)?t[n]=sf(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=ke(s):t[n]=s);return t}function Wt(e,t){for(;e!==null;){const s=Xh(e,t);if(s){if(s.get)return le(s.get);if(typeof s.value=="function")return le(s.value)}e=Yh(e)}function n(){return null}return n}const Yo=ae(["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"]),Zs=ae(["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"]),Js=ae(["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"]),rf=ae(["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"]),ei=ae(["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"]),of=ae(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Xo=ae(["#text"]),Zo=ae(["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"]),ti=ae(["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"]),Jo=ae(["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"]),In=ae(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),af=de(/\{\{[\w\W]*|[\w\W]*\}\}/gm),lf=de(/<%[\w\W]*|[\w\W]*%>/gm),cf=de(/\$\{[\w\W]*/gm),uf=de(/^data-[\-\w.\u00B7-\uFFFF]+$/),df=de(/^aria-[\-\w]+$/),Zl=de(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pf=de(/^(?:\w+script|data):/i),hf=de(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jl=de(/^html$/i),ff=de(/^[a-z][.\w]*(-[.\w]+)+$/i);var ea=Object.freeze({__proto__:null,ARIA_ATTR:df,ATTR_WHITESPACE:hf,CUSTOM_ELEMENT:ff,DATA_ATTR:uf,DOCTYPE_NAME:Jl,ERB_EXPR:lf,IS_ALLOWED_URI:Zl,IS_SCRIPT_OR_DATA:pf,MUSTACHE_EXPR:af,TMPLIT_EXPR:cf});const Kt={element:1,text:3,progressingInstruction:7,comment:8,document:9},gf=function(){return typeof window>"u"?null:window},mf=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(s=n.getAttribute(i));const r="dompurify"+(s?"#"+s:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},ta=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ec(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gf();const t=P=>ec(P);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Kt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,i=s.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:h}=e,b=l.prototype,w=Wt(b,"cloneNode"),S=Wt(b,"remove"),T=Wt(b,"nextSibling"),A=Wt(b,"childNodes"),E=Wt(b,"parentNode");if(typeof o=="function"){const P=n.createElement("template");P.content&&P.content.ownerDocument&&(n=P.content.ownerDocument)}let C,R="";const{implementation:U,createNodeIterator:Q,createDocumentFragment:ze,getElementsByTagName:Lt}=n,{importNode:gn}=s;let J=ta();t.isSupported=typeof Xl=="function"&&typeof E=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Pt,ERB_EXPR:ut,TMPLIT_EXPR:je,DATA_ATTR:As,ARIA_ATTR:$s,IS_SCRIPT_OR_DATA:Es,ATTR_WHITESPACE:mn,CUSTOM_ELEMENT:Ts}=ea;let{IS_ALLOWED_URI:yn}=ea,G=null;const vn=O({},[...Yo,...Zs,...Js,...ei,...Xo]);let V=null;const bn=O({},[...Zo,...ti,...Jo,...In]);let j=Object.seal(Ti(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}})),He=null,Rt=null;const Re=Object.seal(Ti(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let wn=!0,x=!0,_=!1,I=!0,N=!1,H=!0,K=!1,ie=!1,Ie=!1,dt=!1,kn=!1,Sn=!1,Br=!0,Fr=!1;const Jc="user-content-";let Cs=!0,It=!1,pt={},ye=null;const _s=O({},["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 Ur=null;const Wr=O({},["audio","video","img","source","image","track"]);let Ms=null;const Kr=O({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xn="http://www.w3.org/1998/Math/MathML",An="http://www.w3.org/2000/svg",Ae="http://www.w3.org/1999/xhtml";let ht=Ae,Ls=!1,Ps=null;const eu=O({},[xn,An,Ae],Ys);let $n=O({},["mi","mo","mn","ms","mtext"]),En=O({},["annotation-xml"]);const tu=O({},["title","style","font","a","script"]);let Nt=null;const nu=["application/xhtml+xml","text/html"],su="text/html";let X=null,ft=null;const iu=n.createElement("form"),zr=function(v){return v instanceof RegExp||v instanceof Function},Rs=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ft&&ft===v)){if((!v||typeof v!="object")&&(v={}),v=ke(v),Nt=nu.indexOf(v.PARSER_MEDIA_TYPE)===-1?su:v.PARSER_MEDIA_TYPE,X=Nt==="application/xhtml+xml"?Ys:jn,G=he(v,"ALLOWED_TAGS")?O({},v.ALLOWED_TAGS,X):vn,V=he(v,"ALLOWED_ATTR")?O({},v.ALLOWED_ATTR,X):bn,Ps=he(v,"ALLOWED_NAMESPACES")?O({},v.ALLOWED_NAMESPACES,Ys):eu,Ms=he(v,"ADD_URI_SAFE_ATTR")?O(ke(Kr),v.ADD_URI_SAFE_ATTR,X):Kr,Ur=he(v,"ADD_DATA_URI_TAGS")?O(ke(Wr),v.ADD_DATA_URI_TAGS,X):Wr,ye=he(v,"FORBID_CONTENTS")?O({},v.FORBID_CONTENTS,X):_s,He=he(v,"FORBID_TAGS")?O({},v.FORBID_TAGS,X):ke({}),Rt=he(v,"FORBID_ATTR")?O({},v.FORBID_ATTR,X):ke({}),pt=he(v,"USE_PROFILES")?v.USE_PROFILES:!1,wn=v.ALLOW_ARIA_ATTR!==!1,x=v.ALLOW_DATA_ATTR!==!1,_=v.ALLOW_UNKNOWN_PROTOCOLS||!1,I=v.ALLOW_SELF_CLOSE_IN_ATTR!==!1,N=v.SAFE_FOR_TEMPLATES||!1,H=v.SAFE_FOR_XML!==!1,K=v.WHOLE_DOCUMENT||!1,dt=v.RETURN_DOM||!1,kn=v.RETURN_DOM_FRAGMENT||!1,Sn=v.RETURN_TRUSTED_TYPE||!1,Ie=v.FORCE_BODY||!1,Br=v.SANITIZE_DOM!==!1,Fr=v.SANITIZE_NAMED_PROPS||!1,Cs=v.KEEP_CONTENT!==!1,It=v.IN_PLACE||!1,yn=v.ALLOWED_URI_REGEXP||Zl,ht=v.NAMESPACE||Ae,$n=v.MATHML_TEXT_INTEGRATION_POINTS||$n,En=v.HTML_INTEGRATION_POINTS||En,j=v.CUSTOM_ELEMENT_HANDLING||{},v.CUSTOM_ELEMENT_HANDLING&&zr(v.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(j.tagNameCheck=v.CUSTOM_ELEMENT_HANDLING.tagNameCheck),v.CUSTOM_ELEMENT_HANDLING&&zr(v.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(j.attributeNameCheck=v.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),v.CUSTOM_ELEMENT_HANDLING&&typeof v.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(j.allowCustomizedBuiltInElements=v.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),N&&(x=!1),kn&&(dt=!0),pt&&(G=O({},Xo),V=[],pt.html===!0&&(O(G,Yo),O(V,Zo)),pt.svg===!0&&(O(G,Zs),O(V,ti),O(V,In)),pt.svgFilters===!0&&(O(G,Js),O(V,ti),O(V,In)),pt.mathMl===!0&&(O(G,ei),O(V,Jo),O(V,In))),v.ADD_TAGS&&(typeof v.ADD_TAGS=="function"?Re.tagCheck=v.ADD_TAGS:(G===vn&&(G=ke(G)),O(G,v.ADD_TAGS,X))),v.ADD_ATTR&&(typeof v.ADD_ATTR=="function"?Re.attributeCheck=v.ADD_ATTR:(V===bn&&(V=ke(V)),O(V,v.ADD_ATTR,X))),v.ADD_URI_SAFE_ATTR&&O(Ms,v.ADD_URI_SAFE_ATTR,X),v.FORBID_CONTENTS&&(ye===_s&&(ye=ke(ye)),O(ye,v.FORBID_CONTENTS,X)),v.ADD_FORBID_CONTENTS&&(ye===_s&&(ye=ke(ye)),O(ye,v.ADD_FORBID_CONTENTS,X)),Cs&&(G["#text"]=!0),K&&O(G,["html","head","body"]),G.table&&(O(G,["tbody"]),delete He.tbody),v.TRUSTED_TYPES_POLICY){if(typeof v.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof v.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=v.TRUSTED_TYPES_POLICY,R=C.createHTML("")}else C===void 0&&(C=mf(h,i)),C!==null&&typeof R=="string"&&(R=C.createHTML(""));ae&&ae(v),ft=v}},jr=O({},[...Zs,...Js,...rf]),Hr=O({},[...ei,...of]),ru=function(v){let $=E(v);(!$||!$.tagName)&&($={namespaceURI:ht,tagName:"template"});const L=jn(v.tagName),z=jn($.tagName);return Ps[v.namespaceURI]?v.namespaceURI===An?$.namespaceURI===Ae?L==="svg":$.namespaceURI===xn?L==="svg"&&(z==="annotation-xml"||$n[z]):!!jr[L]:v.namespaceURI===xn?$.namespaceURI===Ae?L==="math":$.namespaceURI===An?L==="math"&&En[z]:!!Hr[L]:v.namespaceURI===Ae?$.namespaceURI===An&&!En[z]||$.namespaceURI===xn&&!$n[z]?!1:!Hr[L]&&(tu[L]||!jr[L]):!!(Nt==="application/xhtml+xml"&&Ps[v.namespaceURI]):!1},ve=function(v){Bt(t.removed,{element:v});try{E(v).removeChild(v)}catch{S(v)}},qe=function(v,$){try{Bt(t.removed,{attribute:$.getAttributeNode(v),from:$})}catch{Bt(t.removed,{attribute:null,from:$})}if($.removeAttribute(v),v==="is")if(dt||kn)try{ve($)}catch{}else try{$.setAttribute(v,"")}catch{}},qr=function(v){let $=null,L=null;if(Ie)v="<remove></remove>"+v;else{const Y=Xs(v,/^[\r\n\t ]+/);L=Y&&Y[0]}Nt==="application/xhtml+xml"&&ht===Ae&&(v='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+v+"</body></html>");const z=C?C.createHTML(v):v;if(ht===Ae)try{$=new d().parseFromString(z,Nt)}catch{}if(!$||!$.documentElement){$=U.createDocument(ht,"template",null);try{$.documentElement.innerHTML=Ls?R:z}catch{}}const te=$.body||$.documentElement;return v&&L&&te.insertBefore(n.createTextNode(L),te.childNodes[0]||null),ht===Ae?Lt.call($,K?"html":"body")[0]:K?$.documentElement:te},Gr=function(v){return Q.call(v.ownerDocument||v,v,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Is=function(v){return v instanceof p&&(typeof v.nodeName!="string"||typeof v.textContent!="string"||typeof v.removeChild!="function"||!(v.attributes instanceof u)||typeof v.removeAttribute!="function"||typeof v.setAttribute!="function"||typeof v.namespaceURI!="string"||typeof v.insertBefore!="function"||typeof v.hasChildNodes!="function")},Vr=function(v){return typeof a=="function"&&v instanceof a};function $e(P,v,$){Rn(P,L=>{L.call(t,v,$,ft)})}const Qr=function(v){let $=null;if($e(J.beforeSanitizeElements,v,null),Is(v))return ve(v),!0;const L=X(v.nodeName);if($e(J.uponSanitizeElement,v,{tagName:L,allowedTags:G}),H&&v.hasChildNodes()&&!Vr(v.firstElementChild)&&re(/<[/\w!]/g,v.innerHTML)&&re(/<[/\w!]/g,v.textContent)||v.nodeType===Kt.progressingInstruction||H&&v.nodeType===Kt.comment&&re(/<[/\w]/g,v.data))return ve(v),!0;if(!(Re.tagCheck instanceof Function&&Re.tagCheck(L))&&(!G[L]||He[L])){if(!He[L]&&Xr(L)&&(j.tagNameCheck instanceof RegExp&&re(j.tagNameCheck,L)||j.tagNameCheck instanceof Function&&j.tagNameCheck(L)))return!1;if(Cs&&!ye[L]){const z=E(v)||v.parentNode,te=A(v)||v.childNodes;if(te&&z){const Y=te.length;for(let ce=Y-1;ce>=0;--ce){const Ee=w(te[ce],!0);Ee.__removalCount=(v.__removalCount||0)+1,z.insertBefore(Ee,T(v))}}}return ve(v),!0}return v instanceof l&&!ru(v)||(L==="noscript"||L==="noembed"||L==="noframes")&&re(/<\/no(script|embed|frames)/i,v.innerHTML)?(ve(v),!0):(N&&v.nodeType===Kt.text&&($=v.textContent,Rn([Pt,ut,je],z=>{$=Ft($,z," ")}),v.textContent!==$&&(Bt(t.removed,{element:v.cloneNode()}),v.textContent=$)),$e(J.afterSanitizeElements,v,null),!1)},Yr=function(v,$,L){if(Br&&($==="id"||$==="name")&&(L in n||L in iu))return!1;if(!(x&&!Rt[$]&&re(As,$))){if(!(wn&&re($s,$))){if(!(Re.attributeCheck instanceof Function&&Re.attributeCheck($,v))){if(!V[$]||Rt[$]){if(!(Xr(v)&&(j.tagNameCheck instanceof RegExp&&re(j.tagNameCheck,v)||j.tagNameCheck instanceof Function&&j.tagNameCheck(v))&&(j.attributeNameCheck instanceof RegExp&&re(j.attributeNameCheck,$)||j.attributeNameCheck instanceof Function&&j.attributeNameCheck($,v))||$==="is"&&j.allowCustomizedBuiltInElements&&(j.tagNameCheck instanceof RegExp&&re(j.tagNameCheck,L)||j.tagNameCheck instanceof Function&&j.tagNameCheck(L))))return!1}else if(!Ms[$]){if(!re(yn,Ft(L,mn,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&v!=="script"&&ef(L,"data:")===0&&Ur[v])){if(!(_&&!re(Es,Ft(L,mn,"")))){if(L)return!1}}}}}}}return!0},Xr=function(v){return v!=="annotation-xml"&&Xs(v,Ts)},Zr=function(v){$e(J.beforeSanitizeAttributes,v,null);const{attributes:$}=v;if(!$||Is(v))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0};let z=$.length;for(;z--;){const te=$[z],{name:Y,namespaceURI:ce,value:Ee}=te,gt=X(Y),Ns=Ee;let ee=Y==="value"?Ns:tf(Ns);if(L.attrName=gt,L.attrValue=ee,L.keepAttr=!0,L.forceKeepAttr=void 0,$e(J.uponSanitizeAttribute,v,L),ee=L.attrValue,Fr&&(gt==="id"||gt==="name")&&(qe(Y,v),ee=Jc+ee),H&&re(/((--!?|])>)|<\/(style|title|textarea)/i,ee)){qe(Y,v);continue}if(gt==="attributename"&&Xs(ee,"href")){qe(Y,v);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){qe(Y,v);continue}if(!I&&re(/\/>/i,ee)){qe(Y,v);continue}N&&Rn([Pt,ut,je],eo=>{ee=Ft(ee,eo," ")});const Jr=X(v.nodeName);if(!Yr(Jr,gt,ee)){qe(Y,v);continue}if(C&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!ce)switch(h.getAttributeType(Jr,gt)){case"TrustedHTML":{ee=C.createHTML(ee);break}case"TrustedScriptURL":{ee=C.createScriptURL(ee);break}}if(ee!==Ns)try{ce?v.setAttributeNS(ce,Y,ee):v.setAttribute(Y,ee),Is(v)?ve(v):Qo(t.removed)}catch{qe(Y,v)}}$e(J.afterSanitizeAttributes,v,null)},ou=function P(v){let $=null;const L=Gr(v);for($e(J.beforeSanitizeShadowDOM,v,null);$=L.nextNode();)$e(J.uponSanitizeShadowNode,$,null),Qr($),Zr($),$.content instanceof r&&P($.content);$e(J.afterSanitizeShadowDOM,v,null)};return t.sanitize=function(P){let v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,L=null,z=null,te=null;if(Ls=!P,Ls&&(P="<!-->"),typeof P!="string"&&!Vr(P))if(typeof P.toString=="function"){if(P=P.toString(),typeof P!="string")throw Ut("dirty is not a string, aborting")}else throw Ut("toString is not a function");if(!t.isSupported)return P;if(ie||Rs(v),t.removed=[],typeof P=="string"&&(It=!1),It){if(P.nodeName){const Ee=X(P.nodeName);if(!G[Ee]||He[Ee])throw Ut("root node is forbidden and cannot be sanitized in-place")}}else if(P instanceof a)$=qr("<!---->"),L=$.ownerDocument.importNode(P,!0),L.nodeType===Kt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?$=L:$.appendChild(L);else{if(!dt&&!N&&!K&&P.indexOf("<")===-1)return C&&Sn?C.createHTML(P):P;if($=qr(P),!$)return dt?null:Sn?R:""}$&&Ie&&ve($.firstChild);const Y=Gr(It?P:$);for(;z=Y.nextNode();)Qr(z),Zr(z),z.content instanceof r&&ou(z.content);if(It)return P;if(dt){if(kn)for(te=ze.call($.ownerDocument);$.firstChild;)te.appendChild($.firstChild);else te=$;return(V.shadowroot||V.shadowrootmode)&&(te=gn.call(s,te,!0)),te}let ce=K?$.outerHTML:$.innerHTML;return K&&G["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&re(Jl,$.ownerDocument.doctype.name)&&(ce="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
1733
1733
  `+ce),N&&Rn([Pt,ut,je],Ee=>{ce=Ft(ce,Ee," ")}),C&&Sn?C.createHTML(ce):ce},t.setConfig=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Rs(P),ie=!0},t.clearConfig=function(){ft=null,ie=!1},t.isValidAttribute=function(P,v,$){ft||Rs({});const L=X(P),z=X(v);return Yr(L,z,$)},t.addHook=function(P,v){typeof v=="function"&&Bt(J[P],v)},t.removeHook=function(P,v){if(v!==void 0){const $=Zh(J[P],v);return $===-1?void 0:Jh(J[P],$,1)[0]}return Qo(J[P])},t.removeHooks=function(P){J[P]=[]},t.removeAllHooks=function(){J=ta()},t}var Mi=ec();function wr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var lt=wr();function tc(e){lt=e}var en={exec:()=>null};function F(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(i,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(oe.caret,"$1"),n=n.replace(i,o),s},getRegex:()=>new RegExp(n,t)};return s}var yf=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),oe={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")},vf=/^(?:[ \t]*(?:\n|$))+/,bf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,wf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,kf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kr=/(?:[*+-]|\d{1,9}[.)])/,nc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,sc=F(nc).replace(/bull/g,kr).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(),Sf=F(nc).replace(/bull/g,kr).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(),Sr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,xf=/^[^\n]+/,xr=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Af=F(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$f=F(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kr).getRegex(),ws="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",Ar=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ef=F("^ {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",Ar).replace("tag",ws).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ic=F(Sr).replace("hr",hn).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",ws).getRegex(),Tf=F(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ic).getRegex(),$r={blockquote:Tf,code:bf,def:Af,fences:wf,heading:kf,hr:hn,html:Ef,lheading:sc,list:$f,newline:vf,paragraph:ic,table:en,text:xf},na=F("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hn).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",ws).getRegex(),Cf={...$r,lheading:Sf,table:na,paragraph:F(Sr).replace("hr",hn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",na).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",ws).getRegex()},_f={...$r,html:F(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ar).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:en,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:F(Sr).replace("hr",hn).replace("heading",` *#{1,6} *[^
1734
1734
  ]`).replace("lheading",sc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Mf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Lf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rc=/^( {2,}|\\)\n(?!\s*$)/,Pf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ks=/[\p{P}\p{S}]/u,Er=/[\s\p{P}\p{S}]/u,oc=/[^\s\p{P}\p{S}]/u,Rf=F(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Er).getRegex(),ac=/(?!~)[\p{P}\p{S}]/u,If=/(?!~)[\s\p{P}\p{S}]/u,Nf=/(?:[^\s\p{P}\p{S}]|~)/u,Df=F(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",yf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),lc=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Of=F(lc,"u").replace(/punct/g,ks).getRegex(),Bf=F(lc,"u").replace(/punct/g,ac).getRegex(),cc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ff=F(cc,"gu").replace(/notPunctSpace/g,oc).replace(/punctSpace/g,Er).replace(/punct/g,ks).getRegex(),Uf=F(cc,"gu").replace(/notPunctSpace/g,Nf).replace(/punctSpace/g,If).replace(/punct/g,ac).getRegex(),Wf=F("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,oc).replace(/punctSpace/g,Er).replace(/punct/g,ks).getRegex(),Kf=F(/\\(punct)/,"gu").replace(/punct/g,ks).getRegex(),zf=F(/^<(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(),jf=F(Ar).replace("(?:-->|$)","-->").getRegex(),Hf=F("^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",jf).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),is=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,qf=F(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",is).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),uc=F(/^!?\[(label)\]\[(ref)\]/).replace("label",is).replace("ref",xr).getRegex(),dc=F(/^!?\[(ref)\](?:\[\])?/).replace("ref",xr).getRegex(),Gf=F("reflink|nolink(?!\\()","g").replace("reflink",uc).replace("nolink",dc).getRegex(),sa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Tr={_backpedal:en,anyPunctuation:Kf,autolink:zf,blockSkip:Df,br:rc,code:Lf,del:en,emStrongLDelim:Of,emStrongRDelimAst:Ff,emStrongRDelimUnd:Wf,escape:Mf,link:qf,nolink:dc,punctuation:Rf,reflink:uc,reflinkSearch:Gf,tag:Hf,text:Pf,url:en},Vf={...Tr,link:F(/^!?\[(label)\]\((.*?)\)/).replace("label",is).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",is).getRegex()},Li={...Tr,emStrongRDelimAst:Uf,emStrongLDelim:Bf,url:F(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",sa).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:F(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",sa).getRegex()},Qf={...Li,br:F(rc).replace("{2,}","*").getRegex(),text:F(Li.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Nn={normal:$r,gfm:Cf,pedantic:_f},zt={normal:Tr,gfm:Li,breaks:Qf,pedantic:Vf},Yf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ia=e=>Yf[e];function Ce(e,t){if(t){if(oe.escapeTest.test(e))return e.replace(oe.escapeReplace,ia)}else if(oe.escapeTestNoEncode.test(e))return e.replace(oe.escapeReplaceNoEncode,ia);return e}function ra(e){try{e=encodeURI(e).replace(oe.percentDecode,"%")}catch{return null}return e}function oa(e,t){var r;let n=e.replace(oe.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(oe.splitPipe),i=0;if(s[0].trim()||s.shift(),s.length>0&&!((r=s.at(-1))!=null&&r.trim())&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(oe.slashPipe,"|");return s}function jt(e,t,n){let s=e.length;if(s===0)return"";let i=0;for(;i<s&&e.charAt(s-i-1)===t;)i++;return e.slice(0,s-i)}function Xf(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function aa(e,t,n,s,i){let r=t.href,o=t.title||null,a=e[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:r,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Zf(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let i=s[1];return t.split(`
1735
1735
  `).map(r=>{let o=r.match(n.other.beginningSpace);if(o===null)return r;let[a]=o;return a.length>=i.length?r.slice(i.length):r}).join(`
@@ -1799,8 +1799,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
1799
1799
  @click=${async n=>{const s=n.currentTarget;if(s==null||s.querySelector(".chat-copy-btn__icon"),!s||s.dataset.copying==="1")return;s.dataset.copying="1",s.setAttribute("aria-busy","true"),s.disabled=!0;const i=await ug(e.text());if(s.isConnected){if(delete s.dataset.copying,s.removeAttribute("aria-busy"),s.disabled=!1,!i){s.dataset.error="1",Dn(s,cg),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.error,Dn(s,t))},ag);return}s.dataset.copied="1",Dn(s,lg),window.setTimeout(()=>{s.isConnected&&(delete s.dataset.copied,Dn(s,t))},og)}}}
1800
1800
  >
1801
1801
  <span class="chat-copy-btn__icon" aria-hidden="true">
1802
- <span class="chat-copy-btn__icon-copy">${O.copy}</span>
1803
- <span class="chat-copy-btn__icon-check">${O.check}</span>
1802
+ <span class="chat-copy-btn__icon-copy">${D.copy}</span>
1803
+ <span class="chat-copy-btn__icon-check">${D.check}</span>
1804
1804
  </span>
1805
1805
  </button>
1806
1806
  `}function pg(e){return dg({text:()=>e,label:pc})}function hg(e){const t=e,n=fg(t.content),s=[];for(const i of n){const r=String(i.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(r)||typeof i.name=="string"&&i.arguments!=null)&&s.push({kind:"call",name:i.name??"tool",args:gg(i.arguments??i.args)})}for(const i of n){const r=String(i.type??"").toLowerCase();if(r!=="toolresult"&&r!=="tool_result")continue;const o=mg(i),a=typeof i.name=="string"?i.name:"tool";s.push({kind:"result",name:a,text:o})}if(tl(e)&&!s.some(i=>i.kind==="result")){const i=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",r=Za(e)??void 0;s.push({kind:"result",name:i,text:r})}return s}function fg(e){return Array.isArray(e)?e.filter(Boolean):[]}function gg(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 mg(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function yg(e){var i;const n=e.content,s=[];if(Array.isArray(n))for(const r of n){if(typeof r!="object"||r===null)continue;const o=r;if(o.type==="image")if(((i=o.source)==null?void 0:i.type)==="base64"){const a=o.source,l=a.data,c=a.media_type||"image/png",u=l.startsWith("data:")?l:`data:${c};base64,${l}`;s.push({url:u})}else if(typeof o.data=="string"&&o.data){const a=o.data,l=o.mimeType||o.media_type||"image/png",c=a.startsWith("data:")?a:`data:${l};base64,${a}`;s.push({url:c})}else typeof o.url=="string"&&s.push({url:o.url});else if(o.type==="image_url"){const a=o.image_url;typeof(a==null?void 0:a.url)=="string"&&s.push({url:a.url})}}return s}function vg(e){return f`
@@ -1851,7 +1851,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
1851
1851
  <div class="sidebar-header">
1852
1852
  <div class="sidebar-title">Tool Output</div>
1853
1853
  <button @click=${e.onClose} class="btn" title="Close sidebar">
1854
- ${O.x}
1854
+ ${D.x}
1855
1855
  </button>
1856
1856
  </div>
1857
1857
  <div class="sidebar-content">
@@ -1897,17 +1897,17 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
1897
1897
  --indicator-opacity: ${r.searchMode?0:1};
1898
1898
  --num-skintones: ${ga};`}),o(()=>{r.customEmoji&&r.database&&Q()}),o(()=>{r.customEmoji&&r.customEmoji.length?r.groups!==Bi&&(r.groups=Bi):r.groups!==ii&&(r.currentGroupIndex&&r.currentGroupIndex--,r.groups=ii)}),o(()=>{async function x(){r.databaseLoaded&&(r.currentSkinTone=await r.database.getPreferredSkinTone())}x()}),o(()=>{r.skinTones=Array(ga).fill().map((x,_)=>Tm(r.skinToneEmoji,_))}),o(()=>{r.skinToneButtonText=r.skinTones[r.currentSkinTone]}),o(()=>{r.skinToneButtonLabel=r.i18n.skinToneLabel.replace("{skinTone}",r.i18n.skinTones[r.currentSkinTone])}),o(()=>{async function x(){const{database:_}=r,I=(await Promise.all(ym.map(N=>_.getEmojiByUnicodeOrName(N)))).filter(Boolean);r.defaultFavoriteEmojis=I}r.databaseLoaded&&x()});function Q(){const{customEmoji:x,database:_}=r,I=x||ui;_.customEmoji!==I&&(_.customEmoji=I)}o(()=>{async function x(){Q();const{database:_,defaultFavoriteEmojis:I,numColumns:N}=r,H=await _.getTopFavoriteEmoji(N),K=await je(Mc([...H,...I],ie=>ie.unicode||ie.name).slice(0,N));r.currentFavorites=K}r.databaseLoaded&&r.defaultFavoriteEmojis&&x()});function ze(x){Mm(x,i,()=>{{const _=getComputedStyle(n.rootElement),I=parseInt(_.getPropertyValue("--num-columns"),10),N=_.getPropertyValue("direction")==="rtl";r.numColumns=I,r.isRtl=N}})}function Lt(x){Qm(x,i,_=>{for(const{target:I,isIntersecting:N}of _)I.classList.toggle("onscreen",N)})}o(()=>{async function x(){const{searchText:_,currentGroup:I,databaseLoaded:N,customEmoji:H}=r;if(!N)r.currentEmojis=[],r.searchMode=!1;else if(_.length>=pm){const K=await $s(_);r.searchText===_&&(h(K),b(!0))}else{const{id:K}=I;if(K!==-1||H&&H.length){const ie=await As(K);r.currentGroup.id===K&&(h(ie),b(!1))}}}x()});const gn=()=>{qn(()=>Rm(n.tabpanelElement))};o(()=>{const{currentEmojis:x,emojiVersion:_}=r,I=x.filter(N=>N.unicode).filter(N=>ma(N)&&!Fi.has(N.unicode));if(!_&&I.length)h(x),qn(()=>J(I));else{const N=_?x:x.filter(Pt);h(N),gn()}});function J(x){Lm(x,n.baselineEmoji,c)?gn():r.currentEmojis=[...r.currentEmojis]}function Pt(x){return!x.unicode||!ma(x)||Fi.get(x.unicode)}async function ut(x){const _=r.emojiVersion||await oi();return x.filter(({version:I})=>!I||I<=_)}async function je(x){return Cm(x,r.emojiVersion||await oi())}async function As(x){const _=x===-1?r.customEmoji:await r.database.getEmojiByGroup(x);return je(await ut(_))}async function $s(x){return je(await ut(await r.database.getEmojiBySearchQuery(x)))}o(()=>{}),o(()=>{function x(){const{searchMode:I,currentEmojis:N}=r;if(I)return[{category:"",emojis:N}];const H=new Map;for(const K of N){const ie=K.category||"";let Ie=H.get(ie);Ie||(Ie=[],H.set(ie,Ie)),Ie.push(K)}return[...H.entries()].map(([K,ie])=>({category:K,emojis:ie})).sort((K,ie)=>r.customCategorySorting(K.category,ie.category))}const _=x();w(_)}),o(()=>{r.activeSearchItemId=r.activeSearchItem!==-1&&r.currentEmojis[r.activeSearchItem].id}),o(()=>{const{rawSearchText:x}=r;Cc(()=>{r.searchText=(x||"").trim(),r.activeSearchItem=-1})});function Es(x){if(!r.searchMode||!r.currentEmojis.length)return;const _=I=>{we(x),r.activeSearchItem=ai(I,r.activeSearchItem,r.currentEmojis)};switch(x.key){case"ArrowDown":return _(!1);case"ArrowUp":return _(!0);case"Enter":if(r.activeSearchItem===-1)r.activeSearchItem=0;else return we(x),G(r.currentEmojis[r.activeSearchItem].id)}}function mn(x){const{target:_}=x,I=_.closest(".nav-button");if(!I)return;const N=parseInt(I.dataset.groupId,10);n.searchElement.value="",r.rawSearchText="",r.searchText="",r.activeSearchItem=-1,r.currentGroupIndex=r.groups.findIndex(H=>H.id===N)}function Ts(x){const{target:_,key:I}=x,N=H=>{H&&(we(x),H.focus())};switch(I){case"ArrowLeft":return N(_.previousElementSibling);case"ArrowRight":return N(_.nextElementSibling);case"Home":return N(_.parentElement.firstElementChild);case"End":return N(_.parentElement.lastElementChild)}}async function yn(x){const _=await r.database.getEmojiByUnicodeOrName(x),I=[...r.currentEmojis,...r.currentFavorites].find(H=>H.id===x),N=I.unicode&&S(I,r.currentSkinTone);return await r.database.incrementFavoriteEmojiCount(x),{emoji:_,skinTone:r.currentSkinTone,...N&&{unicode:N},...I.name&&{name:I.name}}}async function G(x){const _=yn(x);u("emoji-click-sync",_),u("emoji-click",await _)}function vn(x){const{target:_}=x;if(!_.classList.contains("emoji"))return;we(x);const I=_.id.substring(4);G(I)}function V(x){r.currentSkinTone=x,r.skinTonePickerExpanded=!1,l("skintone-button"),u("skin-tone-change",{skinTone:x}),r.database.setPreferredSkinTone(x)}function bn(x){const{target:{id:_}}=x,I=_&&_.match(/^skintone-(\d)/);if(!I)return;we(x);const N=parseInt(I[1],10);V(N)}function j(x){r.skinTonePickerExpanded=!r.skinTonePickerExpanded,r.activeSkinTone=r.currentSkinTone,r.skinTonePickerExpanded&&(we(x),qn(()=>l("skintone-list")))}o(()=>{r.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{r.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):r.skinTonePickerExpandedAfterAnimation=!1});function He(x){if(!r.skinTonePickerExpanded)return;const _=async I=>{we(x),r.activeSkinTone=I};switch(x.key){case"ArrowUp":return _(ai(!0,r.activeSkinTone,r.skinTones));case"ArrowDown":return _(ai(!1,r.activeSkinTone,r.skinTones));case"Home":return _(0);case"End":return _(r.skinTones.length-1);case"Enter":return we(x),V(r.activeSkinTone);case"Escape":return we(x),r.skinTonePickerExpanded=!1,l("skintone-button")}}function Rt(x){if(r.skinTonePickerExpanded&&x.key===" ")return we(x),V(r.activeSkinTone)}async function Re(x){const{relatedTarget:_}=x;(!_||_.id!=="skintone-list")&&(r.skinTonePickerExpanded=!1)}function wn(x){r.rawSearchText=x.target.value}return{$set(x){Fn(r,x)},$destroy(){s.abort()}}}const Xm="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Zm="en";var Jm={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"}},ey=':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 Lc=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],ty=`:host{--emoji-font-family:${_c}}`;class Ir extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=ey+ty,this.shadowRoot.appendChild(n),this._ctx={locale:Zm,dataSource:Xm,skinToneEmoji:gm,customCategorySorting:vm,customEmoji:null,i18n:Jm,emojiVersion:null,...t};for(const s of Lc)s!=="database"&&Object.prototype.hasOwnProperty.call(this,s)&&(this._ctx[s]=this[s],delete this[s]);this._dbFlush()}connectedCallback(){Sa(this),this._cmp||(this._cmp=Ym(this.shadowRoot,this._ctx))}disconnectedCallback(){Sa(this),cs(()=>{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,s){this._set(t.replace(/-([a-z])/g,(i,r)=>r.toUpperCase()),t==="emoji-version"?parseFloat(s):s)}_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:s}=this._ctx;(!s||s.locale!==t||s.dataSource!==n)&&this._set("database",new dm({locale:t,dataSource:n}))}_dbFlush(){cs(()=>this._dbCreate())}}const Pc={};for(const e of Lc)Pc[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(Ir.prototype,Pc);function Sa(e){e instanceof Ir||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Ir);function ny(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 xa(e){e.style.height="44px",e.style.overflowY="hidden"}const sy=5e3;function iy(e){return e?e.active?f`
1899
1899
  <div class="callout info compaction-indicator compaction-indicator--active">
1900
- ${O.loader} Compacting context...
1900
+ ${D.loader} Compacting context...
1901
1901
  </div>
1902
1902
  `:e.completedAt&&Date.now()-e.completedAt<sy?f`
1903
1903
  <div class="callout success compaction-indicator compaction-indicator--complete">
1904
- ${O.check} Context compacted
1904
+ ${D.check} Context compacted
1905
1905
  </div>
1906
1906
  `:k:k}const Vt=5*1024*1024;function Qt(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function vt(e,t){var s,i,r;let n=(s=e.closest(".chat"))==null?void 0:s.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 o=(i=e.closest(".chat"))==null?void 0:i.querySelector(".chat-compose");(r=o==null?void 0:o.parentElement)==null||r.insertBefore(n,o)}n.textContent=t,setTimeout(()=>n==null?void 0:n.remove(),4e3)}const ry=/\.(md|txt|csv|json|xml|html|css|js|ts|py|sh|yaml|yml|toml|ini|cfg|log|sql)$/i;function oy(e){return e.type.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name)}function ay(e){return e.type.startsWith("text/")||e.type==="application/json"||e.type==="application/xml"||ry.test(e.name)}function ly(e){return e.type==="application/pdf"||/\.pdf$/i.test(e.name)}function cy(e){return e.type.startsWith("video/")||/\.(mp4|webm|mov|avi|mkv|m4v)$/i.test(e.name)}function uy(e,t){var i;e.preventDefault(),e.stopPropagation();const n=e.currentTarget;n.classList.remove("chat--dragover");const s=(i=e.dataTransfer)==null?void 0:i.files;if(!(!s||s.length===0))for(let r=0;r<s.length;r++){const o=s[r];if(oy(o)){if(!t.onAttachmentsChange)continue;if(o.size>Vt){vt(n,`Image too large (${(o.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var p;const l=a.result,c={id:Qt(),dataUrl:l,mimeType:o.type},u=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...u,c])},a.readAsDataURL(o)}else if(ay(o)){if(!t.onAttachmentsChange)continue;if(o.size>Vt){vt(n,`File too large (${(o.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var p;const l=a.result,c={id:Qt(),dataUrl:"",mimeType:o.type||"text/plain",fileName:o.name,textContent:l},u=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...u,c])},a.readAsText(o)}else if(ly(o)){if(!t.onAttachmentsChange)continue;if(o.size>Vt){vt(n,`PDF too large (${(o.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var p;const l=a.result,c={id:Qt(),dataUrl:l,mimeType:"application/pdf",fileName:o.name},u=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...u,c])},a.readAsDataURL(o)}else if(cy(o)){if(!t.onAttachmentsChange)continue;if(o.size>Vt){vt(n,`Video too large (${(o.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var p;const l=a.result,c={id:Qt(),dataUrl:l,mimeType:o.type||"video/mp4",fileName:o.name},u=t.attachments??[];(p=t.onAttachmentsChange)==null||p.call(t,[...u,c])},a.readAsDataURL(o)}else vt(n,`Unsupported file type: ${o.name}. Use the Files page to upload to workspace.`)}}function dy(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),e.currentTarget.classList.add("chat--dragover")}function py(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&t.classList.remove("chat--dragover")}function hy(e,t){var i,r,o;const n=(i=e.clipboardData)==null?void 0:i.items;if(!n||!t.onAttachmentsChange)return;const s=[];for(let a=0;a<n.length;a++){const l=n[a];(l.type.startsWith("image/")||l.type.startsWith("video/"))&&s.push(l)}if(s.length!==0){e.preventDefault();for(const a of s){const l=a.getAsFile();if(!l)continue;const c=l.type.startsWith("video/")?"Video":"Image";if(l.size>Vt){const p=((o=(r=e.target)==null?void 0:r.closest)==null?void 0:o.call(r,".chat"))??document.querySelector(".chat");p&&vt(p,`${c} too large (${(l.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const u=new FileReader;u.onload=()=>{var w;const p=u.result,d=l.type.startsWith("video/"),h={id:Qt(),dataUrl:p,mimeType:l.type,fileName:d?l.name||"video.mp4":void 0},b=t.attachments??[];(w=t.onAttachmentsChange)==null||w.call(t,[...b,h])},u.readAsDataURL(l)}}}function fy(e){const t=e.currentTarget,n=t.closest(".chat-compose"),s=n==null?void 0:n.querySelector(".emoji-picker-popup");if(!s)return;const i=s.classList.toggle("active");if(t.classList.toggle("active",i),i){const r=o=>{s.contains(o.target)||t.contains(o.target)||(s.classList.remove("active"),t.classList.remove("active"),document.removeEventListener("click",r,!0))};requestAnimationFrame(()=>document.addEventListener("click",r,!0))}}function gy(e,t){const n=e.detail,s=n==null?void 0:n.unicode;if(!s)return;const i=e.currentTarget.closest(".chat-compose"),r=i==null?void 0:i.querySelector("textarea");if(!r)return;const o=r.selectionStart??t.draft.length,a=r.selectionEnd??o,l=t.draft.slice(0,o),c=t.draft.slice(a);t.onDraftChange(l+s+c);const u=i==null?void 0:i.querySelector(".emoji-picker-popup"),p=i==null?void 0:i.querySelector(".chat-compose__emoji");u==null||u.classList.remove("active"),p==null||p.classList.remove("active"),requestAnimationFrame(()=>{r.focus();const d=o+s.length;r.setSelectionRange(d,d)})}function my(e){const t=e.attachments??[];return t.length===0?k:f`
1907
1907
  <div class="chat-attachments">
1908
1908
  ${t.map(n=>{var s;return n.fileName?f`
1909
1909
  <div class="chat-attachment chat-attachment--file">
1910
- <span class="chat-attachment__icon">${(s=n.mimeType)!=null&&s.startsWith("video/")?O.film:O.fileText}</span>
1910
+ <span class="chat-attachment__icon">${(s=n.mimeType)!=null&&s.startsWith("video/")?D.film:D.fileText}</span>
1911
1911
  <span class="chat-attachment__name" title=${n.fileName}>${n.fileName}</span>
1912
1912
  <button
1913
1913
  class="chat-attachment__remove chat-attachment__remove--file"
@@ -1915,7 +1915,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
1915
1915
  aria-label="Remove attachment"
1916
1916
  @click=${()=>{var r;const i=(e.attachments??[]).filter(o=>o.id!==n.id);(r=e.onAttachmentsChange)==null||r.call(e,i)}}
1917
1917
  >
1918
- ${O.x}
1918
+ ${D.x}
1919
1919
  </button>
1920
1920
  </div>
1921
1921
  `:f`
@@ -1931,7 +1931,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
1931
1931
  aria-label="Remove attachment"
1932
1932
  @click=${()=>{var r;const i=(e.attachments??[]).filter(o=>o.id!==n.id);(r=e.onAttachmentsChange)==null||r.call(e,i)}}
1933
1933
  >
1934
- ${O.x}
1934
+ ${D.x}
1935
1935
  </button>
1936
1936
  </div>
1937
1937
  `})}
@@ -1967,7 +1967,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
1967
1967
  aria-label="Exit focus mode"
1968
1968
  title="Exit focus mode"
1969
1969
  >
1970
- ${O.x}
1970
+ ${D.x}
1971
1971
  </button>
1972
1972
  `:k}
1973
1973
 
@@ -1987,7 +1987,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
1987
1987
  aria-label="Scroll to bottom"
1988
1988
  title="Scroll to bottom"
1989
1989
  >
1990
- ${O.chevronDown}
1990
+ ${D.chevronDown}
1991
1991
  </button>
1992
1992
  `:k}
1993
1993
  </div>
@@ -2015,7 +2015,7 @@ ${e.sidebarContent}
2015
2015
  aria-label="Emoji"
2016
2016
  title="Emoji"
2017
2017
  >
2018
- ${O.smile}
2018
+ ${D.smile}
2019
2019
  </button>
2020
2020
  <label class="field chat-compose__field">
2021
2021
  <span>Message</span>
@@ -2035,7 +2035,7 @@ ${e.sidebarContent}
2035
2035
  aria-label="Stop"
2036
2036
  title="Stop generating"
2037
2037
  >
2038
- ${O.square}
2038
+ ${D.square}
2039
2039
  </button>
2040
2040
  `:k}
2041
2041
  <button
@@ -2045,7 +2045,7 @@ ${e.sidebarContent}
2045
2045
  aria-label="${n?"Queue":"Send"}"
2046
2046
  title="${n?"Queue message":"Send (Enter)"}"
2047
2047
  >
2048
- ${O.send}
2048
+ ${D.send}
2049
2049
  </button>
2050
2050
  </div>
2051
2051
  <div class="emoji-picker-popup">
@@ -2091,7 +2091,7 @@ ${e.sidebarContent}
2091
2091
  aria-label="Message settings"
2092
2092
  title="Message settings"
2093
2093
  >
2094
- ${O.slidersHorizontal}
2094
+ ${D.slidersHorizontal}
2095
2095
  </button>
2096
2096
  <div class="chat-settings-menu">
2097
2097
  <label class="chat-settings-menu__item">
@@ -3006,4 +3006,4 @@ ${a.text}`:l.join(", "):a.text;t.push({kind:"message",key:`queue:${a.id}`,messag
3006
3006
  `}const Iv={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Nv={name:"",description:"",agentId:"",enabled:!0,scheduleKind:"every",scheduleAt:"",everyAmount:"30",everyUnit:"minutes",cronExpr:"0 7 * * *",cronTz:"",sessionTarget:"main",wakeMode:"next-heartbeat",payloadKind:"systemEvent",payloadText:"",deliver:!1,channel:"last",to:"",timeoutSeconds:"",postToMainPrefix:""};async function Dv(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 fn(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 Ov(e,t){var s,i;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 r=await e.client.request("config.get",{});e.configSnapshot=r;const o=r.hash;if(!o){e.workspacesError="Config hash missing; reload and retry.";return}const a={name:n,baseHash:o,whatsappAccountName:n};(s=t.workspacePath)!=null&&s.trim()&&(a.workspaceDir=t.workspacePath.trim());const l=await e.client.request("workspaces.create",a);e.addingWorkspace=!1,e.newWorkspaceName="",e.newWorkspacePath="",await fn(e),(i=t.onCreated)==null||i.call(t,l)}catch(r){e.workspacesError=String(r)}finally{e.workspaceSaving=!1}}async function Bv(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 s=n.hash;if(!s){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.remove",{name:t,baseHash:s}),e.workspaceRemoveConfirm=null,await fn(e)}catch(n){e.workspacesError=String(n)}finally{e.workspaceSaving=!1}}}async function Fv(e,t,n){if(!(!e.client||!e.connected)){e.workspacesError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const i=s.hash;if(!i){e.workspacesError="Config hash missing; reload and retry.";return}await e.client.request("workspaces.rename",{name:t,displayName:n,baseHash:i}),await fn(e)}catch(s){e.workspacesError=String(s)}}}const Un=Object.freeze(Object.defineProperty({__proto__:null,createWorkspace:Ov,loadWorkspaces:fn,removeWorkspace:Bv,renameWorkspace:Fv},Symbol.toStringTag,{value:"Module"})),Gc={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"},Da=Gc,Ki={WEBCHAT:"webchat",CLI:"cli",UI:"ui",BACKEND:"backend",NODE:"node",PROBE:"probe",TEST:"test"};new Set(Object.values(Gc));new Set(Object.values(Ki));function Uv(e){const t=e.version??(e.nonce?"v2":"v1"),n=e.scopes.join(","),s=e.token??"",i=[t,e.deviceId,e.clientId,e.clientMode,e.role,n,String(e.signedAtMs),s];return t==="v2"&&i.push(e.nonce??""),i.join("|")}const Wv=4008;class Kv{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 s,i;const n=String(t.reason??"");this.ws=null,this.flushPending(new Error(`gateway closed (${t.code}): ${n}`)),(i=(s=this.opts).onClose)==null||i.call(s,{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 u;if(this.connectSent)return;this.connectSent=!0,this.connectTimer!==null&&(window.clearTimeout(this.connectTimer),this.connectTimer=null);const t=typeof crypto<"u"&&!!crypto.subtle,n=["operator.admin","operator.approvals","operator.pairing"],s="operator";let i=null,r=!1,o=this.opts.token;if(t){i=await lp();const p=(u=dp({deviceId:i.deviceId,role:s}))==null?void 0:u.token;o=p??this.opts.token,r=!!(p&&this.opts.token)}const a=o||this.opts.password?{token:o,password:this.opts.password}:void 0;let l;if(t&&i){const p=Date.now(),d=this.connectNonce??void 0,h=Uv({deviceId:i.deviceId,clientId:this.opts.clientName??Da.CONTROL_UI,clientMode:this.opts.mode??Ki.WEBCHAT,role:s,scopes:n,signedAtMs:p,token:o??null,nonce:d}),b=await cp(i.privateKey,h);l={id:i.deviceId,publicKey:i.publicKey,signature:b,signedAt:p,nonce:d}}const c={minProtocol:3,maxProtocol:3,client:{id:this.opts.clientName??Da.CONTROL_UI,version:this.opts.clientVersion??"dev",platform:this.opts.platform??navigator.platform??"web",mode:this.opts.mode??Ki.WEBCHAT,instanceId:this.opts.instanceId},role:s,scopes:n,device:l,caps:[],auth:a,userAgent:navigator.userAgent,locale:navigator.language};this.request("connect",c).then(p=>{var d,h,b;(d=p==null?void 0:p.auth)!=null&&d.deviceToken&&i&&pp({deviceId:i.deviceId,role:p.auth.role??s,token:p.auth.deviceToken,scopes:p.auth.scopes??[]}),this.backoffMs=800,(b=(h=this.opts).onHello)==null||b.call(h,p)}).catch(()=>{var p;r&&i&&hp({deviceId:i.deviceId,role:s}),(p=this.ws)==null||p.close(Wv,"connect failed")})}handleMessage(t){var i,r,o,a,l;let n;try{n=JSON.parse(t)}catch{return}const s=n;if(s.type==="event"){const c=n;if(c.event==="connect.challenge"){const p=c.payload,d=p&&typeof p.nonce=="string"?p.nonce:null;d&&(this.connectNonce=d,this.sendConnect());return}const u=typeof c.seq=="number"?c.seq:null;u!==null&&(this.lastSeq!==null&&u>this.lastSeq+1&&((r=(i=this.opts).onGap)==null||r.call(i,{expected:this.lastSeq+1,received:u})),this.lastSeq=u);try{(a=(o=this.opts).onEvent)==null||a.call(o,c)}catch(p){console.error("[gateway] event handler error:",p)}return}if(s.type==="res"){const c=n,u=this.pending.get(c.id);if(!u)return;this.pending.delete(c.id),c.ok?u.resolve(c.payload):u.reject(new Error(((l=c.error)==null?void 0:l.message)??"request failed"));return}}request(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return Promise.reject(new Error("gateway not connected"));const s=Vi(),i={type:"req",id:s,method:t,params:n},r=new Promise((o,a)=>{this.pending.set(s,{resolve:l=>o(l),reject:a})});return this.ws.send(JSON.stringify(i)),r}queueConnect(){this.connectNonce=null,this.connectSent=!1,this.connectTimer!==null&&window.clearTimeout(this.connectTimer),this.connectTimer=window.setTimeout(()=>{this.sendConnect()},750)}}function zi(e){return typeof e=="object"&&e!==null}function zv(e){if(!zi(e))return null;const t=typeof e.id=="string"?e.id.trim():"",n=e.request;if(!t||!zi(n))return null;const s=typeof n.command=="string"?n.command.trim():"";if(!s)return null;const i=typeof e.createdAtMs=="number"?e.createdAtMs:0,r=typeof e.expiresAtMs=="number"?e.expiresAtMs:0;return!i||!r?null:{id:t,request:{command:s,cwd:typeof n.cwd=="string"?n.cwd:null,host:typeof n.host=="string"?n.host:null,security:typeof n.security=="string"?n.security:null,ask:typeof n.ask=="string"?n.ask:null,agentId:typeof n.agentId=="string"?n.agentId:null,resolvedPath:typeof n.resolvedPath=="string"?n.resolvedPath:null,sessionKey:typeof n.sessionKey=="string"?n.sessionKey:null},createdAtMs:i,expiresAtMs:r}}function jv(e){if(!zi(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 Vc(e){const t=Date.now();return e.filter(n=>n.expiresAtMs>t)}function Hv(e,t){const n=Vc(e).filter(s=>s.id!==t.id);return n.push(t),n}function Oa(e,t){return Vc(e).filter(n=>n.id!==t)}async function Qc(e,t){if(!e.client||!e.connected)return;const n=e.sessionKey.trim(),s=n?{sessionKey:n}:{};try{const i=await e.client.request("agent.identity.get",s);if(!i)return;const r=yi(i);e.assistantName=r.name,e.assistantAvatar=r.avatar,e.assistantAgentId=r.agentId??null}catch{}}const us="taskmaster_update_pending";async function Yc(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 s=await e.client.request("update.status",{});e.currentVersion=s.current,e.latestVersion=s.latest,e.updateAvailable=s.updateAvailable,e.updateMessage=s.updateAvailable?`v${s.latest} available`:"Up to date"}catch(s){e.updateMessage=`Check failed: ${String(s)}`,e.updateAvailable=null}finally{e.updateChecking=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function qv(e){var t,n,s,i;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(us,String(Date.now())),localStorage.removeItem(Or)}catch{}try{const r=await e.client.request("update.run",{restartDelayMs:2e3,note:"Update from setup page"});if(r.ok&&r.result.status==="ok")e.updateMessage="Updated — restarting gateway...",(n=e.requestUpdate)==null||n.call(e);else if(r.ok&&r.result.status==="skipped")sn(),e.updateMessage=r.result.reason||"Update skipped",e.updateRunning=!1,(s=e.requestUpdate)==null||s.call(e);else throw sn(),new Error(r.result.reason||"Update failed")}catch(r){sn(),e.updateMessage=`Update failed: ${String(r)}`,e.updateRunning=!1,e.updateProgressSteps=[],(i=e.requestUpdate)==null||i.call(e)}}}function Gv(e,t){var s,i,r;const n=t.phase;if(n==="step-start"){const o=t.name,a=t.index,l=t.total;e.updateMessage=`Updating: ${o} (${a+1}/${l})`;const c=e.updateProgressSteps.find(u=>u.index===a);c?(c.status="running",c.name=o):e.updateProgressSteps=[...e.updateProgressSteps,{name:o,index:a,total:l,status:"running"}],(s=e.requestUpdate)==null||s.call(e)}else if(n==="step-done"){const o=t.name,a=t.index,l=t.total,c=t.ok,u=t.durationMs,p=e.updateProgressSteps.find(h=>h.index===a);p?(p.status=c?"done":"failed",p.durationMs=u):e.updateProgressSteps=[...e.updateProgressSteps,{name:o,index:a,total:l,status:c?"done":"failed",durationMs:u}];const d=!c&&t.error?`: ${t.error.slice(0,200)}`:"";e.updateMessage=c?`Updating: ${o} done (${a+1}/${l})`:`Update step failed: ${o}${d}`,(i=e.requestUpdate)==null||i.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,sn()}(r=e.requestUpdate)==null||r.call(e)}}async function Vv(e){var n,s,i,r;if(!e.client||!e.connected)return;const t=Yv();sn();try{const o=await e.client.request("update.lastResult",{});if(!o.ok||!o.result)return;const a=5*6e4,l=Date.now()-o.result.ts<a;if(!t&&!l||Xv(o.result.ts))return;e.updateLastResult=o.result;const c=(n=o.result.after)==null?void 0:n.version;if(o.result.status==="ok"&&c&&(e.currentVersion=c),e.updateAvailable=!1,o.result.status==="ok"){const u=(s=o.result.before)==null?void 0:s.version,p=c??o.result.currentVersion;e.updateMessage=u?`Updated: v${u} → v${p}`:`Updated to v${p}`}else{const u=o.result.reason??((i=o.result.failedStep)==null?void 0:i.name)??"unknown error";e.updateMessage=`Update failed: ${u}`}}catch{}finally{e.updateRunning=!1,e.updateProgressSteps=[],(r=e.requestUpdate)==null||r.call(e)}}const Or="taskmaster_update_dismissed";function Qv(e){var t;e.updateLastResult=null,e.updateMessage=null;try{localStorage.setItem(Or,String(Date.now()))}catch{}(t=e.requestUpdate)==null||t.call(e)}function Yv(){try{const e=localStorage.getItem(us);return e?Date.now()-Number(e)>30*6e4?(localStorage.removeItem(us),!1):!0:!1}catch{return!1}}function sn(){try{localStorage.removeItem(us)}catch{}}function Xv(e){try{const t=localStorage.getItem(Or);return t?Number(t)>=e:!1}catch{return!1}}function fi(e,t){var a,l,c;const n=(e??"").trim(),s=(a=t.mainSessionKey)==null?void 0:a.trim();if(!s)return n;if(!n)return s;const i=((l=t.mainKey)==null?void 0:l.trim())||"main",r=(c=t.defaultAgentId)==null?void 0:c.trim();return n==="main"||n===i||r&&(n===`agent:${r}:main`||n===`agent:${r}:${i}`)?s:n}function Zv(e,t){if(!(t!=null&&t.mainSessionKey))return;const n=fi(e.sessionKey,t),s=fi(e.settings.sessionKey,t),i=fi(e.settings.lastActiveSessionKey,t),r=n||s||e.sessionKey,o={...e.settings,sessionKey:s||r,lastActiveSessionKey:i||r},a=o.sessionKey!==e.settings.sessionKey||o.lastActiveSessionKey!==e.settings.lastActiveSessionKey;r!==e.sessionKey&&(e.sessionKey=r),a&&Be(e,o)}function _e(e){var s;e.lastError=null,e.hello=null,e.connected=!1,e.execApprovalQueue=[],e.execApprovalError=null;const n=e.setup||e.filesPage||e.browserPage||e.chatPage||e.adminsPage||e.customersPage||e.advancedPage?"setup-ui":"taskmaster-control-ui";(s=e.client)==null||s.stop(),e.client=new Kv({url:e.settings.gatewayUrl,token:e.settings.token.trim()?e.settings.token:void 0,password:e.password.trim()?e.password:void 0,clientName:n,mode:"webchat",onHello:i=>{e.connected=!0,e.lastError=null,e.hello=i,ss()&&(yr(),e.uninstallDone=!1),tb(e,i),e.handleAccessCheck(),Vv(e).then(()=>{Yc(e)}),Qc(e),Dv(e),(e.chatPage||e.setup)&&nb(e),rr(e,{quiet:!0}),ir(e,{quiet:!0}),fn(e).then(()=>{e.initWorkspaceSelection()}),e.setup&&(xe(e),sb(e)),ts(e)},onClose:({code:i,reason:r})=>{e.connected=!1,i!==1012&&(e.lastError=`disconnected (${i}): ${r||"no reason"}`)},onEvent:i=>Jv(e,i),onGap:({expected:i,received:r})=>{console.warn(`[gateway] event gap: expected seq ${i}, got ${r}`),ts(e)}}),e.client.start()}function Jv(e,t){try{eb(e,t)}catch(n){console.error("[gateway] handleGatewayEvent error:",t.event,n)}}function eb(e,t){if(e.eventLogBuffer=[{ts:Date.now(),event:t.event,payload:t.payload},...e.eventLogBuffer].slice(0,250),e.tab==="debug"&&(e.eventLog=e.eventLogBuffer),t.event==="agent"){if(e.onboarding)return;gd(e,t.payload);return}if(t.event==="chat"){const n=t.payload;n!=null&&n.sessionKey&&Dl(e,n.sessionKey);const s=il(e,n);(s==="final"||s==="error"||s==="aborted")&&(Yi(e),oh(e)),s==="final"&&Me(e);return}if(t.event==="presence"){const n=t.payload;n!=null&&n.presence&&Array.isArray(n.presence)&&(e.presenceEntries=n.presence,e.presenceError=null,e.presenceStatus=null);return}if(t.event==="cron"&&e.tab==="cron"&&fr(e),(t.event==="device.pair.requested"||t.event==="device.pair.resolved")&&ir(e,{quiet:!0}),t.event==="exec.approval.requested"){const n=zv(t.payload);if(n){e.execApprovalQueue=Hv(e.execApprovalQueue,n),e.execApprovalError=null;const s=Math.max(0,n.expiresAtMs-Date.now()+500);window.setTimeout(()=>{e.execApprovalQueue=Oa(e.execApprovalQueue,n.id)},s)}return}if(t.event==="browser.screencast.frame"){fv(e,t.payload);return}if(t.event==="browser.handoff"){gv(e,t.payload),e.browserPage||(window.location.href="/browser");return}if(t.event==="browser.handoff.resolved"){mv(e);return}if(t.event==="exec.approval.resolved"){const n=jv(t.payload);n&&(e.execApprovalQueue=Oa(e.execApprovalQueue,n.id));return}if(t.event==="update.progress"){Gv(e,t.payload);return}}function tb(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&&Zv(e,n.sessionDefaults)}async function nb(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 sb(e){if(!(!e.client||!e.connected))try{e.apiKeyProviders=await Wi(e.client)}catch{}}function ib(e){e.basePath=Vp();const t=We();if(ph(t.accentColor),window.scrollTo(0,0),Wp(e),e.setup){document.title=`${t.name} Setup`,_e(e);return}if(e.filesPage){document.title=`${t.name} Files`,zp(e),_e(e);return}if(e.browserPage){document.title=`${t.name} Browser`,_e(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,_e(e);return}if(e.customersPage){document.title=`${t.name} Customers`,_e(e);return}if(e.chatPage){document.title=`${t.name} Chat`,_e(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,_e(e);return}Zp(e,!0),Qp(e),Yp(e),window.addEventListener("popstate",e.popStateHandler),Hp(e),_e(e),Fp(e),e.tab==="logs"&&(e.logsSubTab==="session"?ur(e):lr(e)),e.tab==="debug"&&pr(e)}function rb(e){Sd(e)}function ob(e){var t;window.removeEventListener("popstate",e.popStateHandler),Up(e),cr(e),dr(e),hr(e),Kp(e),jp(e),Xp(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function ab(e,t){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.customersPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleCustomersLoad&&e.handleCustomersLoad(),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 s=t.has("setupStep")&&e.setupStep==="auth";(n||s)&&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(r=>{e.channelsSnapshot=r,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(i=>{e.channelsSnapshot=i,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"),s=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;cn(e,n||s||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&rl(e,t.has("tab")||t.has("logsAutoFollow"))}function lb(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 cb(e,t,n){await Xi(e,t,n),await q(e,!0)}async function ub(e,t){await ll(e,t),await q(e,!0)}async function db(e,t){await cl(e,t),await q(e,!0)}async function pb(e,t){await ul(e,t)}async function hb(e,t){await dl(e,t)}async function fb(e){await $d(e),await xe(e),await q(e,!0)}async function gb(e){await xe(e),await q(e,!0)}function mb(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[s,...i]=n.split(":");if(!s||i.length===0)continue;const r=s.trim(),o=i.join(":").trim();r&&o&&(t[r]=o)}return t}function Xc(e){var n,s,i;return((i=(((s=(n=e.channelsSnapshot)==null?void 0:n.channelAccounts)==null?void 0:s.nostr)??[])[0])==null?void 0:i.accountId)??e.nostrProfileAccountId??"default"}function Zc(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function yb(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=lb(n??void 0)}function vb(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function bb(e,t,n){const s=e.nostrProfileFormState;s&&(e.nostrProfileFormState={...s,values:{...s.values,[t]:n},fieldErrors:{...s.fieldErrors,[t]:""}})}function wb(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function kb(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=Xc(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const s=await fetch(Zc(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),i=await s.json().catch(()=>null);if(!s.ok||(i==null?void 0:i.ok)===!1||!i){const r=(i==null?void 0:i.error)??`Profile update failed (${s.status})`;e.nostrProfileFormState={...t,saving:!1,error:r,success:null,fieldErrors:mb(i==null?void 0:i.details)};return}if(!i.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await q(e,!0)}catch(s){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(s)}`,success:null}}}async function Sb(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=Xc(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const s=await fetch(Zc(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),i=await s.json().catch(()=>null);if(!s.ok||(i==null?void 0:i.ok)===!1||!i){const l=(i==null?void 0:i.error)??`Profile import failed (${s.status})`;e.nostrProfileFormState={...t,importing:!1,error:l,success:null};return}const r=i.merged??i.imported??null,o=r?{...t.values,...r}:t.values,a=!!(o.banner||o.website||o.nip05||o.lud16);e.nostrProfileFormState={...t,importing:!1,values:o,error:null,success:i.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:a},i.saved&&await q(e,!0)}catch(s){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(s)}`,success:null}}}async function xb(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 Ab(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 $b(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 Eb(e,t){e.authCodeInput=t}function Tb(e){e.setupStep="whatsapp"}async function Cb(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 _b(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 Mb(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 Lb(e,t){e.licenseKey=t}async function Pb(e){var t,n;if(!(!e.client||!e.connected)&&!e.gatewayHealthLoading){e.gatewayHealthLoading=!0,(t=e.requestUpdate)==null||t.call(e);try{const s=await e.client.request("health",{probe:!0});e.gatewayHealthy=s.ok===!0,e.gatewayHealthMessage=s.ok?`Healthy${s.durationMs?` (${s.durationMs}ms)`:""}`:"Unhealthy"}catch(s){e.gatewayHealthy=!1,e.gatewayHealthMessage=`Error: ${String(s)}`}finally{e.gatewayHealthLoading=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function Rb(e){var t,n,s;if(!(!e.client||e.gatewayRestartBusy)){e.gatewayRestartBusy=!0,e.gatewayHealthMessage="Restarting...",(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("gateway.restart",{reason:"Manual restart from setup page",delayMs:1e3});if(i.ok&&((n=i.restart)!=null&&n.ok))e.gatewayHealthMessage="Restarting...",setTimeout(()=>{window.location.reload()},3e3);else throw new Error("Restart not scheduled")}catch(i){e.gatewayHealthMessage=`Restart failed: ${String(i)}`,e.gatewayRestartBusy=!1,(s=e.requestUpdate)==null||s.call(e)}}}var Ib=Object.defineProperty,Nb=Object.getOwnPropertyDescriptor,m=(e,t,n,s)=>{for(var i=s>1?void 0:s?Nb(t,n):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(i=(s?o(t,n,i):o(i))||i);return s&&i&&Ib(t,n,i),i};const gi=Ou();function Db(){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 Ob(){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 s=n.trim().toLowerCase();return s==="1"||s==="true"||s==="yes"||s==="on"}function Bb(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function Fb(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function Ub(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function Wb(){const e=window.location.pathname;return e==="/customers"||e.endsWith("/customers")}function Kb(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function zb(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends kt{constructor(){super(...arguments),this.settings=Us(),this.password="",this.tab="chat",this.onboarding=Db(),this.setup=Ob(),this.filesPage=Bb(),this.browserPage=Fb(),this.adminsPage=Ub(),this.customersPage=Wb(),this.chatPage=Kb(),this.advancedPage=zb(),this.advancedTab="cron",this.connected=!1,this.accessState=Oc,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=gi.name,this.assistantAvatar=gi.avatar,this.assistantAgentId=gi.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatToolMessages=[],this.chatStream=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.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=`{
3007
3007
  }
3008
3008
  `,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.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={...Nv},this.cronRunsJobId=null,this.cronRuns=[],this.cronBusy=!1,this.cronNewEventModal=!1,this.cronDetailJobId=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.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.customersLoading=!1,this.customersSaving=!1,this.customersRecords=[],this.customersError=null,this.customersSearchQuery="",this.customersEditingId=null,this.customersShowAddForm=!1,this.customersNewPhone="",this.customersNewName="",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={...Iv},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.sessionLogsLoading=!1,this.sessionLogsError=null,this.sessionLogsEntries=[],this.sessionLogsFilterText="",this.sessionLogsTypeFilters={user:!0,assistant:!0,tool:!0,thinking:!0,error:!0,system:!0},this.sessionLogsAgentFilters={},this.sessionLogsAgents=[],this.sessionLogsAutoFollow=!0,this.sessionLogsFull=!1,this.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,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=()=>Jp(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this)}firstUpdated(){rb(this)}disconnectedCallback(){ob(this),super.disconnectedCallback()}updated(e){ab(this,e)}connect(){_e(this)}handleChatScroll(e){md(this,e)}handleLogsScroll(e){yd(this,e)}handleSessionLogsScroll(e){vd(this,e)}exportLogs(e,t){wd(e,t)}exportSessionLogs(e,t){kd(e,t)}resetToolStream(){Yi(this)}resetChatScroll(){bd(this)}async loadAssistantIdentity(){await Qc(this)}applySettings(e){Be(this,e)}setTab(e){qp(this,e)}setTheme(e,t){Gp(this,e,t)}async loadOverview(){await Fl(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 fr(this)}async handleAbortChat(){await Wl(this)}removeQueuedMessage(e){sh(this,e)}async handleSendChat(e,t){await ih(this,e,t)}async handleWhatsAppStart(e,t){await cb(this,e,t)}async handleWhatsAppWait(e){await ub(this,e)}async handleWhatsAppLogout(e){await db(this,e)}async handleAddWhatsAppAccount(e){await pb(this,e)}async handleRemoveWhatsAppAccount(e){await hb(this,e)}async handleAccessCheck(){await Ra(this)}async handlePinSubmit(e,t){await sv(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await iv(this,e)}async handleLogout(){await ov(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 s=await this.client.request("access.verify",{account:e,pin:t});if(!s.ok){this.changePinError=s.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 s=await this.client.request("access.verify",{account:e,pin:t});if(!s.ok){this.accountPinError=s.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 Ra(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 Cb(this)}async handleLicenseActivate(){await _b(this)}async handleLicenseRemove(){await Mb(this)}handleLicenseKeyChange(e){Lb(this,e)}async handleAuthStatusCheck(){await xb(this)}async handleAuthStart(){await Ab(this)}async handleAuthSubmitCode(e){await $b(this,e)}handleAuthCodeChange(e){Eb(this,e)}handleSkipToWhatsApp(){Tb(this)}async handleGatewayHealthCheck(){await Pb(this)}async handleGatewayRestart(){await Rb(this)}async handleUpdateCheck(){await Yc(this)}async handleUpdateRun(){await qv(this)}handleUpdateDismissResult(){Qv(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 pe(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>Co);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){pe(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>Co);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await Pl(this)}async clearAudit(){await Cp(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(s=>s.id))??void 0;const t=this.resolveFilesAgentId();pn(this,t),ar(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();pe(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>vv);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 t;const e=this.getSelectedWorkspaceInfo();if(e)return(t=e.agents[0])==null?void 0:t.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.chatRunId=null,this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}pe(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>rd);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this)})}handleAdvancedLoad(){this.loadCron()}async handleChannelConfigSave(){await fb(this)}async handleChannelConfigReload(){await gb(this)}handleNostrProfileEdit(e,t){yb(this,e,t)}handleNostrProfileCancel(){vb(this)}handleNostrProfileFieldChange(e,t){bb(this,e,t)}async handleNostrProfileSave(){await kb(this)}async handleNostrProfileImport(){await Sb(this)}handleNostrProfileToggleAdvanced(){wb(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)}handleCustomersLoad(){const e=this.selectedWorkspace??void 0;pe(async()=>{const{loadCustomers:t}=await Promise.resolve().then(()=>bv);return{loadCustomers:t}},void 0,import.meta.url).then(({loadCustomers:t})=>{t(this,e)})}handleCustomersNewPhoneChange(e){this.customersNewPhone=e,this.customersError&&(this.customersError=null)}handleCustomersNewNameChange(e){this.customersNewName=e,this.customersError&&(this.customersError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await pe(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>Un);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await pe(async()=>{const{createWorkspace:i}=await Promise.resolve().then(()=>Un);return{createWorkspace:i}},void 0,import.meta.url),{loadChannels:s}=await pe(async()=>{const{loadChannels:i}=await Promise.resolve().then(()=>Pd);return{loadChannels:i}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:i=>{if(!i.whatsappAccountId)return;const r=i.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await s(this,!0),await this.handleWhatsAppStart(!0,r),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(r),await s(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await pe(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>Un);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 pe(async()=>{const{renameWorkspace:s}=await Promise.resolve().then(()=>Un);return{renameWorkspace:s}},void 0,import.meta.url);await n(this,e,t),this.renamingWorkspace=!1,this.renameWorkspaceName=""}handleWorkspaceSelect(e){this.selectedWorkspace=e,localStorage.setItem("taskmaster-selected-workspace",e),go(e),this.settings=Us(),this.chatMessage="",this.chatAttachments=[],this.chatStream=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.customersPage?this.handleCustomersLoad():this.filesPage?this.handleFilesLoad():this.chatPage?this.handleChatLoad():this.advancedPage&&this.handleAdvancedLoad()}initWorkspaceSelection(){if(this.workspaces.length===0)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(s=>s.isDefault)??this.workspaces[0];this.selectedWorkspace=n.name,localStorage.setItem("taskmaster-selected-workspace",n.name)}go(this.selectedWorkspace),this.settings=Us(),this.reloadCurrentPageData()}render(){return f`${Lv(this)}${this.auditModalOpen?Rv(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,"customersPage",2);m([y()],g.prototype,"chatPage",2);m([y()],g.prototype,"advancedPage",2);m([y()],g.prototype,"advancedTab",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,"chatToolMessages",2);m([y()],g.prototype,"chatStream",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,"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,"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,"filesMessage",2);m([y()],g.prototype,"filesUploadBusy",2);m([y()],g.prototype,"filesReindexBusy",2);m([y()],g.prototype,"filesMemoryStatus",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,"skillEdits",2);m([y()],g.prototype,"skillsBusyKey",2);m([y()],g.prototype,"skillMessages",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,"customersLoading",2);m([y()],g.prototype,"customersSaving",2);m([y()],g.prototype,"customersRecords",2);m([y()],g.prototype,"customersError",2);m([y()],g.prototype,"customersSearchQuery",2);m([y()],g.prototype,"customersEditingId",2);m([y()],g.prototype,"customersShowAddForm",2);m([y()],g.prototype,"customersNewPhone",2);m([y()],g.prototype,"customersNewName",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,"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,"sessionLogsFull",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([qa("taskmaster-app")],g);
3009
- //# sourceMappingURL=index-DC6oJyqi.js.map
3009
+ //# sourceMappingURL=index-Dlud-Ha4.js.map