@rubytech/taskmaster 1.0.103 → 1.0.105

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.
@@ -17,7 +17,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
17
17
  `],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function Jd(e,t){if(e.length===0)return;const n=new Blob([`${e.join(`
18
18
  `)}
19
19
  `],{type:"text/plain"}),i=URL.createObjectURL(n),s=document.createElement("a"),o=new Date().toISOString().slice(0,19).replace(/[:T]/g,"-");s.href=i,s.download=`taskmaster-session-logs-${t}-${o}.log`,s.click(),URL.revokeObjectURL(i)}function ep(e){if(typeof ResizeObserver>"u")return;const t=e.querySelector(".topbar");if(!t)return;const n=()=>{const{height:i}=t.getBoundingClientRect();e.style.setProperty("--topbar-height",`${i}px`)};n(),e.topbarObserver=new ResizeObserver(()=>n()),e.topbarObserver.observe(t)}function Ye(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function ut(e){return`${JSON.stringify(e,null,2).trimEnd()}
20
- `}function Al(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const r=t[o],a=t[o+1];if(typeof r=="number"){if(!Array.isArray(i))return;i[r]==null&&(i[r]=typeof a=="number"?[]:{}),i=i[r]}else{if(typeof i!="object"||i==null)return;const u=i;u[r]==null&&(u[r]=typeof a=="number"?[]:{}),i=u[r]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function Le(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});np(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function El(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});tp(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function tp(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function np(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?ut(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=ut(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=Ye(t.config??{}),e.configFormOriginal=Ye(t.config??{}),e.configRawOriginal=n)}async function ip(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?ut(e.configForm):e.configRaw,i=(t=e.configSnapshot)==null?void 0:t.hash;if(!i){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:n,baseHash:i}),e.configFormDirty=!1,await Le(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function bn(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 Ai(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 sp(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=si(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const i=e.everyUnit;return{kind:"every",everyMs:n*(i==="minutes"?6e4:i==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function op(e){if(e.payloadKind==="systemEvent"){const s=e.payloadText.trim();if(!s)throw new Error("System event text required.");return{kind:"systemEvent",text:s}}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 i=si(e.timeoutSeconds,0);return i>0&&(n.timeoutSeconds=i),n}async function rp(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=sp(e.cronForm),i=op(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),r={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:o||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!r.name)throw new Error("Name required.");await e.client.request("cron.add",r),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Ai(e),await bn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ap(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 Ai(e),await bn(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function lp(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 Ps(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function cp(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 Ai(e),await bn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ps(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 G(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 lo(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const i=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=i.message??null,e.whatsappLoginQrDataUrl=i.qrDataUrl??null,e.whatsappLoginConnected=null}catch(i){e.whatsappLoginMessage=String(i),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Cl(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 Tl(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 _l(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const i=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!i){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const o=Ye(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const r=o.channels;(!r.whatsapp||typeof r.whatsapp!="object")&&(r.whatsapp={});const a=r.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const u=a.accounts;if(u[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}u[i]={name:n,provider:"baileys"};const c=s.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const l=ut(o);await e.client.request("config.set",{raw:l,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await G(e,!0),await lo(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function Ml(e,t){if(!(!e.client||!e.connected)&&!e.whatsappAccountSaving){e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=Ye(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,r=o==null?void 0:o.accounts;if(!r){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(r).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!r[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete r[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(l=>{const d=l.match;return!d||d.channel!=="whatsapp"?!0:d.accountId!==t}));const u=n.hash;if(!u){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=ut(i);await e.client.request("config.set",{raw:c,baseHash:u}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await G(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const up=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:_l,loadChannels:G,logoutWhatsApp:Tl,removeWhatsAppAccount:Ml,startWhatsAppLogin:lo,waitWhatsAppLogin:Cl},Symbol.toStringTag,{value:"Module"}));async function co(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,i,s]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const o=i;e.debugModels=Array.isArray(o==null?void 0:o.models)?o==null?void 0:o.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const dp=2e3,pp=new Set(["trace","debug","info","warn","error","fatal"]);function hp(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 fp(e){if(typeof e!="string")return null;const t=e.toLowerCase();return pp.has(t)?t:null}function Pl(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,i=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,s=fp((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),o=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,r=hp(o);let a=null;r&&(typeof r.subsystem=="string"?a=r.subsystem:typeof r.module=="string"&&(a=r.module)),!a&&o&&o.length<120&&(a=o);let u=null;return typeof t[1]=="string"?u=t[1]:!r&&typeof t[0]=="string"?u=t[0]:typeof t.message=="string"&&(u=t.message),{raw:e,time:i,level:s,subsystem:a,message:u??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Pt(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.logsLoading=!0),e.logsError=null;try{const i=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),o=(Array.isArray(i.lines)?i.lines.filter(a=>typeof a=="string"):[]).map(Pl),r=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-dp),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const gp=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:Pt,parseLogLine:Pl},Symbol.toStringTag,{value:"Module"}));const Ll={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:re,n:Yn,Gx:Pr,Gy:Lr,a:ts,d:ns,h:mp}=Ll,dt=32,uo=64,yp=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},te=(e="")=>{const t=new Error(e);throw yp(t,te),t},vp=e=>typeof e=="bigint",bp=e=>typeof e=="string",wp=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ze=(e,t,n="")=>{const i=wp(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const r=n&&`"${n}" `,a=o?` of length ${t}`:"",u=i?`length=${s}`:`type=${typeof e}`;te(r+"expected Uint8Array"+a+", got "+u)}return e},Ei=e=>new Uint8Array(e),Il=e=>Uint8Array.from(e),Rl=(e,t)=>e.toString(16).padStart(t,"0"),Nl=e=>Array.from(Ze(e)).map(t=>Rl(t,2)).join(""),Oe={_0:48,_9:57,A:65,F:70,a:97,f:102},Ir=e=>{if(e>=Oe._0&&e<=Oe._9)return e-Oe._0;if(e>=Oe.A&&e<=Oe.F)return e-(Oe.A-10);if(e>=Oe.a&&e<=Oe.f)return e-(Oe.a-10)},Dl=e=>{const t="hex invalid";if(!bp(e))return te(t);const n=e.length,i=n/2;if(n%2)return te(t);const s=Ei(i);for(let o=0,r=0;o<i;o++,r+=2){const a=Ir(e.charCodeAt(r)),u=Ir(e.charCodeAt(r+1));if(a===void 0||u===void 0)return te(t);s[o]=a*16+u}return s},Ol=()=>globalThis==null?void 0:globalThis.crypto,kp=()=>{var e;return((e=Ol())==null?void 0:e.subtle)??te("crypto.subtle must be defined, consider polyfill")},yn=(...e)=>{const t=Ei(e.reduce((i,s)=>i+Ze(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},Sp=(e=dt)=>Ol().getRandomValues(Ei(e)),ri=BigInt,ot=(e,t,n,i="bad number: out of range")=>vp(e)&&t<=e&&e<n?e:te(i),P=(e,t=re)=>{const n=e%t;return n>=0n?n:t+n},Bl=e=>P(e,Yn),xp=(e,t)=>{(e===0n||t<=0n)&&te("no inverse n="+e+" mod="+t);let n=P(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const r=i/n,a=i%n,u=s-o*r;i=n,n=a,s=o,o=u}return i===1n?P(s,t):te("no inverse")},$p=e=>{const t=Kl[e];return typeof t!="function"&&te("hashes."+e+" not set"),t},is=e=>e instanceof pt?e:te("Point expected"),Ls=2n**256n,_e=class _e{constructor(t,n,i,s){U(this,"X");U(this,"Y");U(this,"Z");U(this,"T");const o=Ls;this.X=ot(t,0n,o),this.Y=ot(n,0n,o),this.Z=ot(i,1n,o),this.T=ot(s,0n,o),Object.freeze(this)}static CURVE(){return Ll}static fromAffine(t){return new _e(t.x,t.y,1n,P(t.x*t.y))}static fromBytes(t,n=!1){const i=ns,s=Il(Ze(t,dt)),o=t[31];s[31]=o&-129;const r=Ul(s);ot(r,0n,n?Ls:re);const u=P(r*r),c=P(u-1n),l=P(i*u+1n);let{isValid:d,value:h}=Ep(c,l);d||te("bad point: y not sqrt");const v=(h&1n)===1n,f=(o&128)!==0;return!n&&h===0n&&f&&te("bad point: x==0, isLastByteOdd"),f!==v&&(h=P(-h)),new _e(h,r,1n,P(h*r))}static fromHex(t,n){return _e.fromBytes(Dl(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=ts,n=ns,i=this;if(i.is0())return te("bad point: ZERO");const{X:s,Y:o,Z:r,T:a}=i,u=P(s*s),c=P(o*o),l=P(r*r),d=P(l*l),h=P(u*t),v=P(l*P(h+c)),f=P(d+P(n*P(u*c)));if(v!==f)return te("bad point: equation left != right (1)");const b=P(s*o),S=P(r*a);return b!==S?te("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:r,Z:a}=is(t),u=P(n*a),c=P(o*s),l=P(i*a),d=P(r*s);return u===c&&l===d}is0(){return this.equals(_t)}negate(){return new _e(P(-this.X),this.Y,this.Z,P(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=ts,o=P(t*t),r=P(n*n),a=P(2n*P(i*i)),u=P(s*o),c=t+n,l=P(P(c*c)-o-r),d=u+r,h=d-a,v=u-r,f=P(l*h),b=P(d*v),S=P(l*v),$=P(h*d);return new _e(f,b,$,S)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:r,Y:a,Z:u,T:c}=is(t),l=ts,d=ns,h=P(n*r),v=P(i*a),f=P(o*d*c),b=P(s*u),S=P((n+i)*(r+a)-h-v),$=P(b-f),A=P(b+f),C=P(v-l*h),T=P(S*$),M=P(A*C),R=P(S*C),B=P($*A);return new _e(T,M,B,R)}subtract(t){return this.add(is(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return _t;if(ot(t,1n,Yn),t===1n)return this;if(this.equals(ht))return Op(t).p;let i=_t,s=ht;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?i=i.add(o):n&&(s=s.add(o));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals(_t))return{x:0n,y:1n};const s=xp(i,re);P(i*s)!==1n&&te("invalid inverse");const o=P(t*s),r=P(n*s);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Fl(n);return i[31]|=t&1n?128:0,i}toHex(){return Nl(this.toBytes())}clearCofactor(){return this.multiply(ri(mp),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Yn/2n,!1).double();return Yn%2n&&(t=t.add(this)),t.is0()}};U(_e,"BASE"),U(_e,"ZERO");let pt=_e;const ht=new pt(Pr,Lr,1n,P(Pr*Lr)),_t=new pt(0n,1n,1n,0n);pt.BASE=ht;pt.ZERO=_t;const Fl=e=>Dl(Rl(ot(e,0n,Ls),uo)).reverse(),Ul=e=>ri("0x"+Nl(Il(Ze(e)).reverse())),Ae=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=re;return n},Ap=e=>{const n=e*e%re*e%re,i=Ae(n,2n)*n%re,s=Ae(i,1n)*e%re,o=Ae(s,5n)*s%re,r=Ae(o,10n)*o%re,a=Ae(r,20n)*r%re,u=Ae(a,40n)*a%re,c=Ae(u,80n)*u%re,l=Ae(c,80n)*u%re,d=Ae(l,10n)*o%re;return{pow_p_5_8:Ae(d,2n)*e%re,b2:n}},Rr=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Ep=(e,t)=>{const n=P(t*t*t),i=P(n*n*t),s=Ap(e*i).pow_p_5_8;let o=P(e*n*s);const r=P(t*o*o),a=o,u=P(o*Rr),c=r===e,l=r===P(-e),d=r===P(-e*Rr);return c&&(o=a),(l||d)&&(o=u),(P(o)&1n)===1n&&(o=P(-o)),{isValid:c||l,value:o}},Is=e=>Bl(Ul(e)),po=(...e)=>Kl.sha512Async(yn(...e)),Cp=(...e)=>$p("sha512")(yn(...e)),Wl=e=>{const t=e.slice(0,dt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(dt,uo),i=Is(t),s=ht.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},ho=e=>po(Ze(e,dt)).then(Wl),Tp=e=>Wl(Cp(Ze(e,dt))),_p=e=>ho(e).then(t=>t.pointBytes),Mp=e=>po(e.hashable).then(e.finish),Pp=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=Is(t),r=ht.multiply(o).toBytes();return{hashable:yn(r,i,n),finish:c=>{const l=Bl(o+Is(c)*s);return Ze(yn(r,Fl(l)),uo)}}},Lp=async(e,t)=>{const n=Ze(e),i=await ho(t),s=await po(i.prefix,n);return Mp(Pp(i,s,n))},Kl={sha512Async:async e=>{const t=kp(),n=yn(e);return Ei(await t.digest("SHA-512",n.buffer))},sha512:void 0},Ip=(e=Sp(dt))=>e,Rp={getExtendedPublicKeyAsync:ho,getExtendedPublicKey:Tp,randomSecretKey:Ip},ai=8,Np=256,zl=Math.ceil(Np/ai)+1,Rs=2**(ai-1),Dp=()=>{const e=[];let t=ht,n=t;for(let i=0;i<zl;i++){n=t,e.push(n);for(let s=1;s<Rs;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Nr;const Dr=(e,t)=>{const n=t.negate();return e?n:t},Op=e=>{const t=Nr||(Nr=Dp());let n=_t,i=ht;const s=2**ai,o=s,r=ri(s-1),a=ri(ai);for(let u=0;u<zl;u++){let c=Number(e&r);e>>=a,c>Rs&&(c-=o,e+=1n);const l=u*Rs,d=l,h=l+Math.abs(c)-1,v=u%2!==0,f=c<0;c===0?i=i.add(Dr(v,t[d])):n=n.add(Dr(f,t[h]))}return e!==0n&&te("invalid wnaf"),{p:n,f:i}},ss="taskmaster-device-identity-v1";function Ns(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function jl(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),i=atob(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o+=1)s[o]=i.charCodeAt(o);return s}function Bp(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Hl(e){const t=await crypto.subtle.digest("SHA-256",e);return Bp(new Uint8Array(t))}async function Fp(){const e=Rp.randomSecretKey(),t=await _p(e);return{deviceId:await Hl(t),publicKey:Ns(t),privateKey:Ns(e)}}async function Up(){try{const n=localStorage.getItem(ss);if(n){const i=JSON.parse(n);if((i==null?void 0:i.version)===1&&typeof i.deviceId=="string"&&typeof i.publicKey=="string"&&typeof i.privateKey=="string"){const s=await Hl(jl(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(ss,JSON.stringify(o)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await Fp(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(ss,JSON.stringify(t)),e}async function Wp(e,t){const n=jl(e),i=new TextEncoder().encode(t),s=await Lp(i,n);return Ns(s)}const ql="taskmaster.device.auth.v1";function fo(e){return e.trim()}function Kp(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const i=n.trim();i&&t.add(i)}return[...t].sort()}function go(){try{const e=window.localStorage.getItem(ql);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 Vl(e){try{window.localStorage.setItem(ql,JSON.stringify(e))}catch{}}function zp(e){const t=go();if(!t||t.deviceId!==e.deviceId)return null;const n=fo(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function jp(e){const t=fo(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=go();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:Kp(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Vl(n),s}function Hp(e){const t=go();if(!t||t.deviceId!==e.deviceId)return;const n=fo(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Vl(i)}async function mo(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 yo(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 qp(e){return{method:"exec.approvals.get",params:{}}}async function Vp(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=qp(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);Gp(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Gp(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=Ye(t.file??{}))}async function Gl(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 Rt(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Ci(e){return e instanceof Error?e.message:String(e)}async function ft(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=Ci(n)}finally{e.skillsLoading=!1}}}function Ql(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Yl(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 ft(e),Rt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Ci(i);e.skillsError=s,Rt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Xl(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 ft(e),Rt(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Ci(n);e.skillsError=i,Rt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Zl(e,t,n,i){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const s=await e.client.request("skills.install",{name:n,installId:i,timeoutMs:12e4});await ft(e),Rt(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=Ci(s);e.skillsError=o,Rt(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const Qp=Object.freeze(Object.defineProperty({__proto__:null,installSkill:Zl,loadSkills:ft,saveSkillApiKey:Xl,updateSkillEdit:Ql,updateSkillEnabled:Yl},Symbol.toStringTag,{value:"Module"})),Jl={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},ec=new Map(Object.entries(Jl).map(([e,t])=>[t,e]));function Ti(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function vn(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 Yp(e,t=""){const n=Ti(t),i=Jl[e];return n?`${n}${i}`:i}function tc(e,t=""){const n=Ti(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=vn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":ec.get(s)??null}function Xp(e){let t=vn(e);if(t.endsWith("/index.html")&&(t=vn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let i=0;i<n.length;i++){const s=`/${n.slice(i).join("/")}`.toLowerCase();if(ec.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function Zp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function vo(e){return e==="system"?Zp():e}const Dn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Jp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,On=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},eh=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var c;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,r=s,a=Jp();if(!!r.startViewTransition&&!a){let l=.5,d=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")l=Dn(n.pointerClientX/window.innerWidth),d=Dn(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const h=n.element.getBoundingClientRect();h.width>0&&h.height>0&&typeof window<"u"&&(l=Dn((h.left+h.width/2)/window.innerWidth),d=Dn((h.top+h.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${l*100}%`),o.style.setProperty("--theme-switch-y",`${d*100}%`),o.classList.add("theme-transition");try{const h=(c=r.startViewTransition)==null?void 0:c.call(r,()=>{t()});h!=null&&h.finished?h.finished.finally(()=>On(o)):On(o)}catch{On(o),t()}return}t(),On(o)},th=2e3;async function un(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),o=Array.isArray(s.entries)?s.entries:[],r=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=r?o:[...e.sessionLogsEntries,...o].slice(-th),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 nc=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:un},Symbol.toStringTag,{value:"Module"}));async function ic(e,t){if(!(!e.client||!e.connected))try{const n={},i=await e.client.request("memory.audit",n);i!=null&&i.ok&&(e.auditEntries=i.entries??[])}catch{}}async function nh(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Ie(e){return e instanceof Error?e.message:String(e)}let Bn=null;function Ft(e,t){Bn&&clearTimeout(Bn),e.filesMessage={kind:"success",text:t},Bn=setTimeout(()=>{e.filesMessage=null,Bn=null},3e3)}async function Ut(e,t){if(!(!e.client||!e.connected)){if(!t){e.filesTree=[],e.filesRoot="";return}if(!e.filesLoading){e.filesLoading=!0,e.filesError=null;try{const n={};t&&(n.agentId=t);const i=await e.client.request("files.tree",n);i!=null&&i.tree&&(e.filesTree=i.tree,e.filesRoot=i.root??"")}catch(n){e.filesError=Ie(n)}finally{e.filesLoading=!1}}}}async function ih(e,t,n){e.filesSelectedPaths=new Set([t]),await sc(e,t,n)}async function sh(e,t,n){const i=new Set(e.filesSelectedPaths);if(i.has(t)?i.delete(t):i.add(t),e.filesSelectedPaths=i,i.size===1){const s=[...i][0];await sc(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function oh(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const o of n)try{await oc(e,o,t),i++}catch(r){s=Ie(r)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:Ft(e,`${i} file${i!==1?"s":""} downloaded`)}async function rh(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await uh(e,t,o,i)}async function sc(e,t,n){if(!(!e.client||!e.connected)){e.filesSelectedPath=t,e.filesPreviewLoading=!0,e.filesPreviewContent=null,e.filesPreviewBinary=!1,e.filesPreviewSize=null;try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.read",i);e.filesPreviewContent=(s==null?void 0:s.content)??null,e.filesPreviewBinary=(s==null?void 0:s.binary)??!1,e.filesPreviewSize=(s==null?void 0:s.size)??null}catch(i){e.filesError=Ie(i)}finally{e.filesPreviewLoading=!1}}}async function oc(e,t,n){if(!(!e.client||!e.connected))try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.download",i);if(!(s!=null&&s.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const o=Uint8Array.from(atob(s.base64),c=>c.charCodeAt(0)),r=new Blob([o]),a=URL.createObjectURL(r),u=document.createElement("a");u.href=a,u.download=s.name??t.split("/").pop()??"download",document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(a)}catch(i){e.filesMessage={kind:"error",text:Ie(i)}}}async function ah(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const r of n)try{const a=await r.arrayBuffer(),u=btoa(new Uint8Array(a).reduce((l,d)=>l+String.fromCharCode(d),"")),c={path:t,name:r.name,data:u};i&&(c.agentId=i),await e.client.request("files.upload",c),s++}catch(a){o=Ie(a)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:Ft(e,`${s} file${s!==1?"s":""} uploaded`),await Ut(e,i)}async function lh(e,t,n,i){if(!e.client||!e.connected)return;e.filesMessage=null;const s=t==="."?n:`${t}/${n}`;try{const o={path:s};i&&(o.agentId=i),await e.client.request("files.mkdir",o),Ft(e,`Created ${s}`),await Ut(e,i),e.filesExpandedDirs=new Set([...e.filesExpandedDirs,s]),e.filesCurrentDir=s}catch(o){e.filesMessage={kind:"error",text:Ie(o)}}}async function ch(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={path:t};n&&(i.agentId=n),await e.client.request("files.delete",i),Ft(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await Ut(e,n)}catch(i){e.filesMessage={kind:"error",text:Ie(i)}}}}async function uh(e,t,n,i){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={from:t,to:n};i&&(s.agentId=i),await e.client.request("files.move",s),Ft(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await Ut(e,i)}catch(s){e.filesMessage={kind:"error",text:Ie(s)}}}}async function bo(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const i=await e.client.request("memory.status",n);i!=null&&i.ok&&(e.filesMemoryStatus={dirty:i.dirty??!1,syncing:i.syncing,syncProgress:i.syncProgress,files:i.files??0,chunks:i.chunks??0,model:i.model,embeddingState:i.embeddingState})}catch{}}async function dh(e,t){if(!(!e.client||!e.connected)&&!e.filesReindexBusy){e.filesReindexBusy=!0,e.filesMessage=null;try{const n={force:!0};t&&(n.agentId=t);const i=await e.client.request("memory.reindex",n),s=(i==null?void 0:i.files)??0,o=(i==null?void 0:i.chunks)??0;Ft(e,`Re-indexed: ${s} files, ${o} chunks`),await bo(e,t)}catch(n){e.filesMessage={kind:"error",text:Ie(n)}}finally{e.filesReindexBusy=!1}}}function ph(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n,e.filesCurrentDir=t}async function hh(e,t,n){if(!(!e.client||!e.connected)){if(!t.trim()){e.filesSearchResults=null;return}e.filesSearchLoading=!0,e.filesSearchResults=null;try{const i={query:t.trim(),maxResults:20};n&&(i.agentId=n);const s=await e.client.request("memory.search",i);e.filesSearchResults=(s==null?void 0:s.results)??[]}catch(i){e.filesMessage={kind:"error",text:Ie(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function fh(e){e.filesSearchQuery="",e.filesSearchResults=null}function gh(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{yo(e,{quiet:!0})},5e3))}function mh(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function wo(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Pt(e,{quiet:!0})},2e3))}function ko(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function So(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||un(e,{quiet:!0})},2e3))}function xo(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function $o(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&co(e)},3e3))}function Ao(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function yh(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{ic(e)},3e4))}function vh(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function bh(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{if(e.tab!=="files")return;const t=e;bo(t,t.filesResolvedAgentId)},3e3))}function wh(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function Ge(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,vd(n),t.theme!==e.theme&&(e.theme=t.theme,_i(e,vo(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function rc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Ge(e,{...e.settings,lastActiveSessionKey:n})}function kh(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),o=t.get("gatewayUrl");let r=!1;if(n!=null){const u=n.trim();u&&u!==e.settings.token&&Ge(e,{...e.settings,token:u}),t.delete("token"),r=!0}if(i!=null){const u=i.trim();u&&(e.password=u),t.delete("password"),r=!0}if(s!=null){const u=s.trim();u&&(e.sessionKey=u,Ge(e,{...e.settings,sessionKey:u,lastActiveSessionKey:u}))}if(o!=null){const u=o.trim();u&&u!==e.settings.gatewayUrl&&Ge(e,{...e.settings,gatewayUrl:u}),t.delete("gatewayUrl"),r=!0}if(!r)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function Sh(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?So(e):wo(e):(ko(e),xo(e)),t==="debug"?$o(e):Ao(e),li(e),lc(e,t,!1)}function xh(e,t,n){eh({nextTheme:t,applyTheme:()=>{e.theme=t,Ge(e,{...e.settings,theme:t}),_i(e,vo(t))},context:n,currentTheme:e.theme})}async function li(e){if(e.tab==="overview"&&await cc(e),e.tab==="channels"&&await Mh(e),e.tab==="instances"&&await Gl(e),e.tab==="cron"&&await Eo(e),e.tab==="skills"&&await ft(e),e.tab==="nodes"&&(await yo(e),await mo(e),await Le(e),await Vp(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await Nh(e),Bt(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await El(e),await Le(e)),e.tab==="debug"&&(await co(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await ie(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>nc);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await Pt(e,{reset:!0});$l(e,!0)}}function $h(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Ti(e):Xp(window.location.pathname)}function Ah(e){e.theme=e.settings.theme??"system",_i(e,vo(e.theme))}function _i(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Eh(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"&&_i(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Ch(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 Th(e,t){if(typeof window>"u")return;const n=tc(window.location.pathname,e.basePath)??"chat";ac(e,n),lc(e,n,t)}function _h(e){var s;if(typeof window>"u")return;const t=tc(window.location.pathname,e.basePath);if(!t)return;const i=(s=new URL(window.location.href).searchParams.get("session"))==null?void 0:s.trim();i&&(e.sessionKey=i,Ge(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),ac(e,t)}function ac(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?So(e):wo(e):(ko(e),xo(e)),t==="debug"?$o(e):Ao(e),e.connected&&li(e)}function lc(e,t,n){if(typeof window>"u")return;const i=vn(Yp(t,e.basePath)),s=vn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),s!==i&&(o.pathname=i),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}async function cc(e){await Promise.all([G(e,!1),Gl(e),ro(e),bn(e),co(e)])}async function Mh(e){await Promise.all([G(e,!0),El(e),Le(e)])}async function Eo(e){await Promise.all([G(e,!1),bn(e),Ai(e)])}function uc(e){return e.chatSending||!!e.chatRunId}function Ph(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 dc(e){e.connected&&(e.chatMessage="",await Sl(e))}function Lh(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:oo(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],Bt(e))}async function pc(e,t,n){var s,o;ao(e);const i=await kl(e,t,n==null?void 0:n.attachments);return!i&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!i&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),i&&rc(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((o=n.previousAttachments)!=null&&o.length)&&(e.chatAttachments=n.previousAttachments),Bt(e),i&&!e.chatRunId&&hc(e),i}async function hc(e){if(!e.connected||uc(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await pc(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Ih(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Rh(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],a=r.length>0;if(!(!s&&!a)){if(Ph(s)){await dc(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),uc(e)){Lh(e,s,r);return}await pc(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function Nh(e){var i;const t=e,n=Math.max((((i=t.chatMessages)==null?void 0:i.length)??0)+10,Pe);await Promise.all([Me(t,{limit:n}),ro(t),Ds(e)]),Bt(e,!0)}const Dh=hc;function Oh(e){var s,o,r;const t=pl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((r=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:r.trim())||"main"}function Bh(e,t){const n=Ti(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function Ds(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Oh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Bh(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),o=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const D={messageSquare:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,unlink:p`<svg viewBox="0 0 24 24"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"/><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"/><line x1="8" x2="8" y1="2" y2="5"/><line x1="2" x2="5" y1="8" y2="8"/><line x1="16" x2="16" y1="19" y2="22"/><line x1="19" x2="22" y1="16" y2="16"/></svg>`,radio:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:p`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:p`<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:p`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:p`<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>`},Fh="Taskmaster",Uh="/taskmaster-icon.png",fc="#00d4ff";let Fn=null;function Xe(){return Fn||(Fn={name:window.__TASKMASTER_BRAND_NAME__||Fh,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||Uh,accentColor:window.__TASKMASTER_ACCENT_COLOR__||fc},Fn)}function Wh(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 Kh(e){if(e===fc)return;const t=Wh(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 zh=p`<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>`,jh=p`<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 Or=!1;function Hh(){Or||(Or=!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 vt(e,t){const n=(l,d)=>l===e?p`<span class="sp-page-nav-current">${l}</span>`:p`<a href=${d}>${l}</a>`,i=p`
20
+ `}function Al(e,t,n){if(t.length===0)return;let i=e;for(let o=0;o<t.length-1;o+=1){const r=t[o],a=t[o+1];if(typeof r=="number"){if(!Array.isArray(i))return;i[r]==null&&(i[r]=typeof a=="number"?[]:{}),i=i[r]}else{if(typeof i!="object"||i==null)return;const u=i;u[r]==null&&(u[r]=typeof a=="number"?[]:{}),i=u[r]}}const s=t[t.length-1];if(typeof s=="number"){Array.isArray(i)&&(i[s]=n);return}typeof i=="object"&&i!=null&&(i[s]=n)}async function Le(e){if(!(!e.client||!e.connected)){e.configLoading=!0,e.lastError=null;try{const t=await e.client.request("config.get",{});np(e,t)}catch(t){e.lastError=String(t)}finally{e.configLoading=!1}}}async function El(e){if(!(!e.client||!e.connected)&&!e.configSchemaLoading){e.configSchemaLoading=!0;try{const t=await e.client.request("config.schema",{});tp(e,t)}catch(t){e.lastError=String(t)}finally{e.configSchemaLoading=!1}}}function tp(e,t){e.configSchema=t.schema??null,e.configUiHints=t.uiHints??{},e.configSchemaVersion=t.version??null}function np(e,t){e.configSnapshot=t;const n=typeof t.raw=="string"?t.raw:t.config&&typeof t.config=="object"?ut(t.config):e.configRaw;!e.configFormDirty||e.configFormMode==="raw"?e.configRaw=n:e.configForm?e.configRaw=ut(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=Ye(t.config??{}),e.configFormOriginal=Ye(t.config??{}),e.configRawOriginal=n)}async function ip(e){var t;if(!(!e.client||!e.connected)){e.configSaving=!0,e.lastError=null;try{const n=e.configFormMode==="form"&&e.configForm?ut(e.configForm):e.configRaw,i=(t=e.configSnapshot)==null?void 0:t.hash;if(!i){e.lastError="Config hash missing; reload and retry.";return}await e.client.request("config.set",{raw:n,baseHash:i}),e.configFormDirty=!1,await Le(e)}catch(n){e.lastError=String(n)}finally{e.configSaving=!1}}}async function bn(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 Ai(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 sp(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=si(e.everyAmount,0);if(n<=0)throw new Error("Invalid interval amount.");const i=e.everyUnit;return{kind:"every",everyMs:n*(i==="minutes"?6e4:i==="hours"?36e5:864e5)}}const t=e.cronExpr.trim();if(!t)throw new Error("Cron expression required.");return{kind:"cron",expr:t,tz:e.cronTz.trim()||void 0}}function op(e){if(e.payloadKind==="systemEvent"){const s=e.payloadText.trim();if(!s)throw new Error("System event text required.");return{kind:"systemEvent",text:s}}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 i=si(e.timeoutSeconds,0);return i>0&&(n.timeoutSeconds=i),n}async function rp(e){var t;if(!(!e.client||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{const n=sp(e.cronForm),i=op(e.cronForm),s=e.cronForm.agentId.trim(),o=(t=e.cronForm.accountId)==null?void 0:t.trim(),r={name:e.cronForm.name.trim(),description:e.cronForm.description.trim()||void 0,agentId:s||void 0,accountId:o||void 0,enabled:e.cronForm.enabled,schedule:n,sessionTarget:e.cronForm.sessionTarget,wakeMode:e.cronForm.wakeMode,payload:i,isolation:e.cronForm.postToMainPrefix.trim()&&e.cronForm.sessionTarget==="isolated"?{postToMainPrefix:e.cronForm.postToMainPrefix.trim()}:void 0};if(!r.name)throw new Error("Name required.");await e.client.request("cron.add",r),e.cronForm={...e.cronForm,name:"",description:"",payloadText:""},await Ai(e),await bn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function ap(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 Ai(e),await bn(e)}catch(i){e.cronError=String(i)}finally{e.cronBusy=!1}}}async function lp(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 Ps(e,t.id)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function cp(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 Ai(e),await bn(e)}catch(n){e.cronError=String(n)}finally{e.cronBusy=!1}}}async function Ps(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 G(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 lo(e,t,n){if(!(!e.client||!e.connected||e.whatsappBusy)){e.whatsappBusy=!0,e.whatsappActiveQrAccountId=n??null;try{const i=await e.client.request("web.login.start",{force:t,timeoutMs:3e4,accountId:n});e.whatsappLoginMessage=i.message??null,e.whatsappLoginQrDataUrl=i.qrDataUrl??null,e.whatsappLoginConnected=null}catch(i){e.whatsappLoginMessage=String(i),e.whatsappLoginQrDataUrl=null,e.whatsappLoginConnected=null}finally{e.whatsappBusy=!1}}}async function Cl(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 Tl(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 _l(e,t){if(!e.client||!e.connected||e.whatsappAccountSaving)return;const n=t.trim();if(!n){e.whatsappAccountError="Account name is required.";return}const i=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");if(!i){e.whatsappAccountError="Invalid account name.";return}e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const s=await e.client.request("config.get",{});e.configSnapshot=s;const o=Ye(s.config??{});(!o.channels||typeof o.channels!="object")&&(o.channels={});const r=o.channels;(!r.whatsapp||typeof r.whatsapp!="object")&&(r.whatsapp={});const a=r.whatsapp;(!a.accounts||typeof a.accounts!="object")&&(a.accounts={});const u=a.accounts;if(u[i]){e.whatsappAccountError=`Account "${i}" already exists.`;return}u[i]={name:n,provider:"baileys"};const c=s.hash;if(!c){e.whatsappAccountError="Config hash missing; reload and retry.";return}const l=ut(o);await e.client.request("config.set",{raw:l,baseHash:c}),e.addingWhatsAppAccount=!1,e.newWhatsAppAccountName="",await G(e,!0),await lo(e,!0,i)}catch(s){e.whatsappAccountError=String(s)}finally{e.whatsappAccountSaving=!1}}async function Ml(e,t){if(!(!e.client||!e.connected)&&!e.whatsappAccountSaving){e.whatsappAccountSaving=!0,e.whatsappAccountError=null;try{const n=await e.client.request("config.get",{});e.configSnapshot=n;const i=Ye(n.config??{}),s=i.channels,o=s==null?void 0:s.whatsapp,r=o==null?void 0:o.accounts;if(!r){e.whatsappAccountError="No accounts found in config.";return}if(Object.keys(r).length<=1){e.whatsappAccountError="Cannot remove the last account.";return}if(!r[t]){e.whatsappAccountError=`Account "${t}" not found.`;return}try{await e.client.request("channels.logout",{channel:"whatsapp",accountId:t})}catch{}delete r[t],Array.isArray(i.bindings)&&(i.bindings=i.bindings.filter(l=>{const d=l.match;return!d||d.channel!=="whatsapp"?!0:d.accountId!==t}));const u=n.hash;if(!u){e.whatsappAccountError="Config hash missing; reload and retry.";return}const c=ut(i);await e.client.request("config.set",{raw:c,baseHash:u}),e.whatsappActiveQrAccountId===t&&(e.whatsappActiveQrAccountId=null,e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null),await G(e,!0)}catch(n){e.whatsappAccountError=String(n)}finally{e.whatsappAccountSaving=!1}}}const up=Object.freeze(Object.defineProperty({__proto__:null,addWhatsAppAccount:_l,loadChannels:G,logoutWhatsApp:Tl,removeWhatsAppAccount:Ml,startWhatsAppLogin:lo,waitWhatsAppLogin:Cl},Symbol.toStringTag,{value:"Module"}));async function co(e){if(!(!e.client||!e.connected)&&!e.debugLoading){e.debugLoading=!0;try{const[t,n,i,s]=await Promise.all([e.client.request("status",{}),e.client.request("health",{}),e.client.request("models.list",{}),e.client.request("last-heartbeat",{})]);e.debugStatus=t,e.debugHealth=n;const o=i;e.debugModels=Array.isArray(o==null?void 0:o.models)?o==null?void 0:o.models:[],e.debugHeartbeat=s}catch(t){e.debugCallError=String(t)}finally{e.debugLoading=!1}}}const dp=2e3,pp=new Set(["trace","debug","info","warn","error","fatal"]);function hp(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 fp(e){if(typeof e!="string")return null;const t=e.toLowerCase();return pp.has(t)?t:null}function Pl(e){if(!e.trim())return{raw:e,message:e};try{const t=JSON.parse(e),n=t&&typeof t._meta=="object"&&t._meta!==null?t._meta:null,i=typeof t.time=="string"?t.time:typeof(n==null?void 0:n.date)=="string"?n==null?void 0:n.date:null,s=fp((n==null?void 0:n.logLevelName)??(n==null?void 0:n.level)),o=typeof t[0]=="string"?t[0]:typeof(n==null?void 0:n.name)=="string"?n==null?void 0:n.name:null,r=hp(o);let a=null;r&&(typeof r.subsystem=="string"?a=r.subsystem:typeof r.module=="string"&&(a=r.module)),!a&&o&&o.length<120&&(a=o);let u=null;return typeof t[1]=="string"?u=t[1]:!r&&typeof t[0]=="string"?u=t[0]:typeof t.message=="string"&&(u=t.message),{raw:e,time:i,level:s,subsystem:a,message:u??e,meta:n??void 0}}catch{return{raw:e,message:e}}}async function Pt(e,t){if(!(!e.client||!e.connected)&&!(e.logsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.logsLoading=!0),e.logsError=null;try{const i=await e.client.request("logs.tail",{cursor:t!=null&&t.reset?void 0:e.logsCursor??void 0,limit:e.logsLimit,maxBytes:e.logsMaxBytes}),o=(Array.isArray(i.lines)?i.lines.filter(a=>typeof a=="string"):[]).map(Pl),r=!!(t!=null&&t.reset||i.reset||e.logsCursor==null);e.logsEntries=r?o:[...e.logsEntries,...o].slice(-dp),typeof i.cursor=="number"&&(e.logsCursor=i.cursor),typeof i.file=="string"&&(e.logsFile=i.file),e.logsTruncated=!!i.truncated,e.logsLastFetchAt=Date.now()}catch(n){e.logsError=String(n)}finally{t!=null&&t.quiet||(e.logsLoading=!1)}}}const gp=Object.freeze(Object.defineProperty({__proto__:null,loadLogs:Pt,parseLogLine:Pl},Symbol.toStringTag,{value:"Module"}));const Ll={p:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n:0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,h:8n,a:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,d:0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,Gx:0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,Gy:0x6666666666666666666666666666666666666666666666666666666666666658n},{p:re,n:Yn,Gx:Pr,Gy:Lr,a:ts,d:ns,h:mp}=Ll,dt=32,uo=64,yp=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},te=(e="")=>{const t=new Error(e);throw yp(t,te),t},vp=e=>typeof e=="bigint",bp=e=>typeof e=="string",wp=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Ze=(e,t,n="")=>{const i=wp(e),s=e==null?void 0:e.length,o=t!==void 0;if(!i||o&&s!==t){const r=n&&`"${n}" `,a=o?` of length ${t}`:"",u=i?`length=${s}`:`type=${typeof e}`;te(r+"expected Uint8Array"+a+", got "+u)}return e},Ei=e=>new Uint8Array(e),Il=e=>Uint8Array.from(e),Rl=(e,t)=>e.toString(16).padStart(t,"0"),Nl=e=>Array.from(Ze(e)).map(t=>Rl(t,2)).join(""),Oe={_0:48,_9:57,A:65,F:70,a:97,f:102},Ir=e=>{if(e>=Oe._0&&e<=Oe._9)return e-Oe._0;if(e>=Oe.A&&e<=Oe.F)return e-(Oe.A-10);if(e>=Oe.a&&e<=Oe.f)return e-(Oe.a-10)},Dl=e=>{const t="hex invalid";if(!bp(e))return te(t);const n=e.length,i=n/2;if(n%2)return te(t);const s=Ei(i);for(let o=0,r=0;o<i;o++,r+=2){const a=Ir(e.charCodeAt(r)),u=Ir(e.charCodeAt(r+1));if(a===void 0||u===void 0)return te(t);s[o]=a*16+u}return s},Ol=()=>globalThis==null?void 0:globalThis.crypto,kp=()=>{var e;return((e=Ol())==null?void 0:e.subtle)??te("crypto.subtle must be defined, consider polyfill")},yn=(...e)=>{const t=Ei(e.reduce((i,s)=>i+Ze(s).length,0));let n=0;return e.forEach(i=>{t.set(i,n),n+=i.length}),t},Sp=(e=dt)=>Ol().getRandomValues(Ei(e)),ri=BigInt,ot=(e,t,n,i="bad number: out of range")=>vp(e)&&t<=e&&e<n?e:te(i),P=(e,t=re)=>{const n=e%t;return n>=0n?n:t+n},Bl=e=>P(e,Yn),xp=(e,t)=>{(e===0n||t<=0n)&&te("no inverse n="+e+" mod="+t);let n=P(e,t),i=t,s=0n,o=1n;for(;n!==0n;){const r=i/n,a=i%n,u=s-o*r;i=n,n=a,s=o,o=u}return i===1n?P(s,t):te("no inverse")},$p=e=>{const t=Kl[e];return typeof t!="function"&&te("hashes."+e+" not set"),t},is=e=>e instanceof pt?e:te("Point expected"),Ls=2n**256n,_e=class _e{constructor(t,n,i,s){U(this,"X");U(this,"Y");U(this,"Z");U(this,"T");const o=Ls;this.X=ot(t,0n,o),this.Y=ot(n,0n,o),this.Z=ot(i,1n,o),this.T=ot(s,0n,o),Object.freeze(this)}static CURVE(){return Ll}static fromAffine(t){return new _e(t.x,t.y,1n,P(t.x*t.y))}static fromBytes(t,n=!1){const i=ns,s=Il(Ze(t,dt)),o=t[31];s[31]=o&-129;const r=Ul(s);ot(r,0n,n?Ls:re);const u=P(r*r),c=P(u-1n),l=P(i*u+1n);let{isValid:d,value:h}=Ep(c,l);d||te("bad point: y not sqrt");const v=(h&1n)===1n,f=(o&128)!==0;return!n&&h===0n&&f&&te("bad point: x==0, isLastByteOdd"),f!==v&&(h=P(-h)),new _e(h,r,1n,P(h*r))}static fromHex(t,n){return _e.fromBytes(Dl(t),n)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}assertValidity(){const t=ts,n=ns,i=this;if(i.is0())return te("bad point: ZERO");const{X:s,Y:o,Z:r,T:a}=i,u=P(s*s),c=P(o*o),l=P(r*r),d=P(l*l),h=P(u*t),v=P(l*P(h+c)),f=P(d+P(n*P(u*c)));if(v!==f)return te("bad point: equation left != right (1)");const b=P(s*o),S=P(r*a);return b!==S?te("bad point: equation left != right (2)"):this}equals(t){const{X:n,Y:i,Z:s}=this,{X:o,Y:r,Z:a}=is(t),u=P(n*a),c=P(o*s),l=P(i*a),d=P(r*s);return u===c&&l===d}is0(){return this.equals(_t)}negate(){return new _e(P(-this.X),this.Y,this.Z,P(-this.T))}double(){const{X:t,Y:n,Z:i}=this,s=ts,o=P(t*t),r=P(n*n),a=P(2n*P(i*i)),u=P(s*o),c=t+n,l=P(P(c*c)-o-r),d=u+r,h=d-a,v=u-r,f=P(l*h),b=P(d*v),S=P(l*v),$=P(h*d);return new _e(f,b,$,S)}add(t){const{X:n,Y:i,Z:s,T:o}=this,{X:r,Y:a,Z:u,T:c}=is(t),l=ts,d=ns,h=P(n*r),v=P(i*a),f=P(o*d*c),b=P(s*u),S=P((n+i)*(r+a)-h-v),$=P(b-f),A=P(b+f),C=P(v-l*h),T=P(S*$),M=P(A*C),R=P(S*C),B=P($*A);return new _e(T,M,B,R)}subtract(t){return this.add(is(t).negate())}multiply(t,n=!0){if(!n&&(t===0n||this.is0()))return _t;if(ot(t,1n,Yn),t===1n)return this;if(this.equals(ht))return Op(t).p;let i=_t,s=ht;for(let o=this;t>0n;o=o.double(),t>>=1n)t&1n?i=i.add(o):n&&(s=s.add(o));return i}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:i}=this;if(this.equals(_t))return{x:0n,y:1n};const s=xp(i,re);P(i*s)!==1n&&te("invalid inverse");const o=P(t*s),r=P(n*s);return{x:o,y:r}}toBytes(){const{x:t,y:n}=this.assertValidity().toAffine(),i=Fl(n);return i[31]|=t&1n?128:0,i}toHex(){return Nl(this.toBytes())}clearCofactor(){return this.multiply(ri(mp),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let t=this.multiply(Yn/2n,!1).double();return Yn%2n&&(t=t.add(this)),t.is0()}};U(_e,"BASE"),U(_e,"ZERO");let pt=_e;const ht=new pt(Pr,Lr,1n,P(Pr*Lr)),_t=new pt(0n,1n,1n,0n);pt.BASE=ht;pt.ZERO=_t;const Fl=e=>Dl(Rl(ot(e,0n,Ls),uo)).reverse(),Ul=e=>ri("0x"+Nl(Il(Ze(e)).reverse())),Ae=(e,t)=>{let n=e;for(;t-- >0n;)n*=n,n%=re;return n},Ap=e=>{const n=e*e%re*e%re,i=Ae(n,2n)*n%re,s=Ae(i,1n)*e%re,o=Ae(s,5n)*s%re,r=Ae(o,10n)*o%re,a=Ae(r,20n)*r%re,u=Ae(a,40n)*a%re,c=Ae(u,80n)*u%re,l=Ae(c,80n)*u%re,d=Ae(l,10n)*o%re;return{pow_p_5_8:Ae(d,2n)*e%re,b2:n}},Rr=0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n,Ep=(e,t)=>{const n=P(t*t*t),i=P(n*n*t),s=Ap(e*i).pow_p_5_8;let o=P(e*n*s);const r=P(t*o*o),a=o,u=P(o*Rr),c=r===e,l=r===P(-e),d=r===P(-e*Rr);return c&&(o=a),(l||d)&&(o=u),(P(o)&1n)===1n&&(o=P(-o)),{isValid:c||l,value:o}},Is=e=>Bl(Ul(e)),po=(...e)=>Kl.sha512Async(yn(...e)),Cp=(...e)=>$p("sha512")(yn(...e)),Wl=e=>{const t=e.slice(0,dt);t[0]&=248,t[31]&=127,t[31]|=64;const n=e.slice(dt,uo),i=Is(t),s=ht.multiply(i),o=s.toBytes();return{head:t,prefix:n,scalar:i,point:s,pointBytes:o}},ho=e=>po(Ze(e,dt)).then(Wl),Tp=e=>Wl(Cp(Ze(e,dt))),_p=e=>ho(e).then(t=>t.pointBytes),Mp=e=>po(e.hashable).then(e.finish),Pp=(e,t,n)=>{const{pointBytes:i,scalar:s}=e,o=Is(t),r=ht.multiply(o).toBytes();return{hashable:yn(r,i,n),finish:c=>{const l=Bl(o+Is(c)*s);return Ze(yn(r,Fl(l)),uo)}}},Lp=async(e,t)=>{const n=Ze(e),i=await ho(t),s=await po(i.prefix,n);return Mp(Pp(i,s,n))},Kl={sha512Async:async e=>{const t=kp(),n=yn(e);return Ei(await t.digest("SHA-512",n.buffer))},sha512:void 0},Ip=(e=Sp(dt))=>e,Rp={getExtendedPublicKeyAsync:ho,getExtendedPublicKey:Tp,randomSecretKey:Ip},ai=8,Np=256,zl=Math.ceil(Np/ai)+1,Rs=2**(ai-1),Dp=()=>{const e=[];let t=ht,n=t;for(let i=0;i<zl;i++){n=t,e.push(n);for(let s=1;s<Rs;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Nr;const Dr=(e,t)=>{const n=t.negate();return e?n:t},Op=e=>{const t=Nr||(Nr=Dp());let n=_t,i=ht;const s=2**ai,o=s,r=ri(s-1),a=ri(ai);for(let u=0;u<zl;u++){let c=Number(e&r);e>>=a,c>Rs&&(c-=o,e+=1n);const l=u*Rs,d=l,h=l+Math.abs(c)-1,v=u%2!==0,f=c<0;c===0?i=i.add(Dr(v,t[d])):n=n.add(Dr(f,t[h]))}return e!==0n&&te("invalid wnaf"),{p:n,f:i}},ss="taskmaster-device-identity-v1";function Ns(e){let t="";for(const n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function jl(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),i=atob(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o+=1)s[o]=i.charCodeAt(o);return s}function Bp(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Hl(e){const t=await crypto.subtle.digest("SHA-256",e);return Bp(new Uint8Array(t))}async function Fp(){const e=Rp.randomSecretKey(),t=await _p(e);return{deviceId:await Hl(t),publicKey:Ns(t),privateKey:Ns(e)}}async function Up(){try{const n=localStorage.getItem(ss);if(n){const i=JSON.parse(n);if((i==null?void 0:i.version)===1&&typeof i.deviceId=="string"&&typeof i.publicKey=="string"&&typeof i.privateKey=="string"){const s=await Hl(jl(i.publicKey));if(s!==i.deviceId){const o={...i,deviceId:s};return localStorage.setItem(ss,JSON.stringify(o)),{deviceId:s,publicKey:i.publicKey,privateKey:i.privateKey}}return{deviceId:i.deviceId,publicKey:i.publicKey,privateKey:i.privateKey}}}}catch{}const e=await Fp(),t={version:1,deviceId:e.deviceId,publicKey:e.publicKey,privateKey:e.privateKey,createdAtMs:Date.now()};return localStorage.setItem(ss,JSON.stringify(t)),e}async function Wp(e,t){const n=jl(e),i=new TextEncoder().encode(t),s=await Lp(i,n);return Ns(s)}const ql="taskmaster.device.auth.v1";function fo(e){return e.trim()}function Kp(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const i=n.trim();i&&t.add(i)}return[...t].sort()}function go(){try{const e=window.localStorage.getItem(ql);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 Vl(e){try{window.localStorage.setItem(ql,JSON.stringify(e))}catch{}}function zp(e){const t=go();if(!t||t.deviceId!==e.deviceId)return null;const n=fo(e.role),i=t.tokens[n];return!i||typeof i.token!="string"?null:i}function jp(e){const t=fo(e.role),n={version:1,deviceId:e.deviceId,tokens:{}},i=go();i&&i.deviceId===e.deviceId&&(n.tokens={...i.tokens});const s={token:e.token,role:t,scopes:Kp(e.scopes),updatedAtMs:Date.now()};return n.tokens[t]=s,Vl(n),s}function Hp(e){const t=go();if(!t||t.deviceId!==e.deviceId)return;const n=fo(e.role);if(!t.tokens[n])return;const i={...t,tokens:{...t.tokens}};delete i.tokens[n],Vl(i)}async function mo(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 yo(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 qp(e){return{method:"exec.approvals.get",params:{}}}async function Vp(e,t){if(!(!e.client||!e.connected)&&!e.execApprovalsLoading){e.execApprovalsLoading=!0,e.lastError=null;try{const n=qp(t);if(!n){e.lastError="Select a node before loading exec approvals.";return}const i=await e.client.request(n.method,n.params);Gp(e,i)}catch(n){e.lastError=String(n)}finally{e.execApprovalsLoading=!1}}}function Gp(e,t){e.execApprovalsSnapshot=t,e.execApprovalsDirty||(e.execApprovalsForm=Ye(t.file??{}))}async function Gl(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 Rt(e,t,n){if(!t.trim())return;const i={...e.skillMessages};n?i[t]=n:delete i[t],e.skillMessages=i}function Ci(e){return e instanceof Error?e.message:String(e)}async function ft(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=Ci(n)}finally{e.skillsLoading=!1}}}function Ql(e,t,n){e.skillEdits={...e.skillEdits,[t]:n}}async function Yl(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 ft(e),Rt(e,t,{kind:"success",message:n?"Skill enabled":"Skill disabled"})}catch(i){const s=Ci(i);e.skillsError=s,Rt(e,t,{kind:"error",message:s})}finally{e.skillsBusyKey=null}}}async function Xl(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 ft(e),Rt(e,t,{kind:"success",message:"API key saved"})}catch(n){const i=Ci(n);e.skillsError=i,Rt(e,t,{kind:"error",message:i})}finally{e.skillsBusyKey=null}}}async function Zl(e,t,n,i){if(!(!e.client||!e.connected)){e.skillsBusyKey=t,e.skillsError=null;try{const s=await e.client.request("skills.install",{name:n,installId:i,timeoutMs:12e4});await ft(e),Rt(e,t,{kind:"success",message:(s==null?void 0:s.message)??"Installed"})}catch(s){const o=Ci(s);e.skillsError=o,Rt(e,t,{kind:"error",message:o})}finally{e.skillsBusyKey=null}}}const Qp=Object.freeze(Object.defineProperty({__proto__:null,installSkill:Zl,loadSkills:ft,saveSkillApiKey:Xl,updateSkillEdit:Ql,updateSkillEnabled:Yl},Symbol.toStringTag,{value:"Module"})),Jl={overview:"/overview",channels:"/channels",instances:"/instances",cron:"/cron",skills:"/skills",nodes:"/nodes",chat:"/chat",admins:"/admins",config:"/config",debug:"/debug",logs:"/logs"},ec=new Map(Object.entries(Jl).map(([e,t])=>[t,e]));function Ti(e){if(!e)return"";let t=e.trim();return t.startsWith("/")||(t=`/${t}`),t==="/"?"":(t.endsWith("/")&&(t=t.slice(0,-1)),t)}function vn(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 Yp(e,t=""){const n=Ti(t),i=Jl[e];return n?`${n}${i}`:i}function tc(e,t=""){const n=Ti(t);let i=e||"/";n&&(i===n?i="/":i.startsWith(`${n}/`)&&(i=i.slice(n.length)));let s=vn(i).toLowerCase();return s.endsWith("/index.html")&&(s="/"),s==="/"?"chat":ec.get(s)??null}function Xp(e){let t=vn(e);if(t.endsWith("/index.html")&&(t=vn(t.slice(0,-11))),t==="/")return"";const n=t.split("/").filter(Boolean);if(n.length===0)return"";for(let i=0;i<n.length;i++){const s=`/${n.slice(i).join("/")}`.toLowerCase();if(ec.has(s)){const o=n.slice(0,i);return o.length?`/${o.join("/")}`:""}}return`/${n.join("/")}`}function Zp(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function vo(e){return e==="system"?Zp():e}const Dn=e=>Number.isNaN(e)?.5:e<=0?0:e>=1?1:e,Jp=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches??!1,On=e=>{e.classList.remove("theme-transition"),e.style.removeProperty("--theme-switch-x"),e.style.removeProperty("--theme-switch-y")},eh=({nextTheme:e,applyTheme:t,context:n,currentTheme:i})=>{var c;if(i===e)return;const s=globalThis.document??null;if(!s){t();return}const o=s.documentElement,r=s,a=Jp();if(!!r.startViewTransition&&!a){let l=.5,d=.5;if((n==null?void 0:n.pointerClientX)!==void 0&&(n==null?void 0:n.pointerClientY)!==void 0&&typeof window<"u")l=Dn(n.pointerClientX/window.innerWidth),d=Dn(n.pointerClientY/window.innerHeight);else if(n!=null&&n.element){const h=n.element.getBoundingClientRect();h.width>0&&h.height>0&&typeof window<"u"&&(l=Dn((h.left+h.width/2)/window.innerWidth),d=Dn((h.top+h.height/2)/window.innerHeight))}o.style.setProperty("--theme-switch-x",`${l*100}%`),o.style.setProperty("--theme-switch-y",`${d*100}%`),o.classList.add("theme-transition");try{const h=(c=r.startViewTransition)==null?void 0:c.call(r,()=>{t()});h!=null&&h.finished?h.finished.finally(()=>On(o)):On(o)}catch{On(o),t()}return}t(),On(o)},th=2e3;async function un(e,t){if(!(!e.client||!e.connected)&&!(e.sessionLogsLoading&&!(t!=null&&t.quiet))){t!=null&&t.quiet||(e.sessionLogsLoading=!0),e.sessionLogsError=null;try{const n={cursors:t!=null&&t.reset?void 0:e.sessionLogsCursors,limit:500};Array.isArray(e.workspaceAgentIds)&&e.workspaceAgentIds.length>0&&(n.agents=e.workspaceAgentIds);const s=await e.client.request("sessions.transcript",n),o=Array.isArray(s.entries)?s.entries:[],r=!!(t!=null&&t.reset||Object.keys(e.sessionLogsCursors).length===0);e.sessionLogsEntries=r?o:[...e.sessionLogsEntries,...o].slice(-th),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 nc=Object.freeze(Object.defineProperty({__proto__:null,loadSessionLogs:un},Symbol.toStringTag,{value:"Module"}));async function ic(e,t){if(!(!e.client||!e.connected))try{const n={},i=await e.client.request("memory.audit",n);i!=null&&i.ok&&(e.auditEntries=i.entries??[])}catch{}}async function nh(e,t){if(!(!e.client||!e.connected))try{const n={};await e.client.request("memory.auditClear",n),e.auditEntries=[]}catch{}}function Ie(e){return e instanceof Error?e.message:String(e)}let Bn=null;function Ft(e,t){Bn&&clearTimeout(Bn),e.filesMessage={kind:"success",text:t},Bn=setTimeout(()=>{e.filesMessage=null,Bn=null},3e3)}async function Ut(e,t){if(!(!e.client||!e.connected)){if(!t){e.filesTree=[],e.filesRoot="";return}if(!e.filesLoading){e.filesLoading=!0,e.filesError=null;try{const n={};t&&(n.agentId=t);const i=await e.client.request("files.tree",n);i!=null&&i.tree&&(e.filesTree=i.tree,e.filesRoot=i.root??"")}catch(n){e.filesError=Ie(n)}finally{e.filesLoading=!1}}}}async function ih(e,t,n){e.filesSelectedPaths=new Set([t]),await sc(e,t,n)}async function sh(e,t,n){const i=new Set(e.filesSelectedPaths);if(i.has(t)?i.delete(t):i.add(t),e.filesSelectedPaths=i,i.size===1){const s=[...i][0];await sc(e,s,n)}else e.filesSelectedPath=null,e.filesPreviewContent=null,e.filesPreviewSize=null,e.filesPreviewBinary=!1}async function oh(e,t){if(!e.client||!e.connected)return;const n=[...e.filesSelectedPaths];if(n.length===0)return;let i=0,s="";for(const o of n)try{await oc(e,o,t),i++}catch(r){s=Ie(r)}s?e.filesMessage={kind:"error",text:`${i} downloaded, error: ${s}`}:Ft(e,`${i} file${i!==1?"s":""} downloaded`)}async function rh(e,t,n,i){const s=t.split("/").pop()??t,o=n==="."?s:`${n}/${s}`;o!==t&&await uh(e,t,o,i)}async function sc(e,t,n){if(!(!e.client||!e.connected)){e.filesSelectedPath=t,e.filesPreviewLoading=!0,e.filesPreviewContent=null,e.filesPreviewBinary=!1,e.filesPreviewSize=null;try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.read",i);e.filesPreviewContent=(s==null?void 0:s.content)??null,e.filesPreviewBinary=(s==null?void 0:s.binary)??!1,e.filesPreviewSize=(s==null?void 0:s.size)??null}catch(i){e.filesError=Ie(i)}finally{e.filesPreviewLoading=!1}}}async function oc(e,t,n){if(!(!e.client||!e.connected))try{const i={path:t};n&&(i.agentId=n);const s=await e.client.request("files.download",i);if(!(s!=null&&s.base64)){e.filesMessage={kind:"error",text:"Download failed: no data"};return}const o=Uint8Array.from(atob(s.base64),c=>c.charCodeAt(0)),r=new Blob([o]),a=URL.createObjectURL(r),u=document.createElement("a");u.href=a,u.download=s.name??t.split("/").pop()??"download",document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(a)}catch(i){e.filesMessage={kind:"error",text:Ie(i)}}}async function ah(e,t,n,i){if(!e.client||!e.connected)return;e.filesUploadBusy=!0,e.filesMessage=null;let s=0,o="";for(const r of n)try{const a=await r.arrayBuffer(),u=btoa(new Uint8Array(a).reduce((l,d)=>l+String.fromCharCode(d),"")),c={path:t,name:r.name,data:u};i&&(c.agentId=i),await e.client.request("files.upload",c),s++}catch(a){o=Ie(a)}e.filesUploadBusy=!1,o?e.filesMessage={kind:"error",text:s>0?`${s} uploaded, error: ${o}`:o}:Ft(e,`${s} file${s!==1?"s":""} uploaded`),await Ut(e,i)}async function lh(e,t,n,i){if(!e.client||!e.connected)return;e.filesMessage=null;const s=t==="."?n:`${t}/${n}`;try{const o={path:s};i&&(o.agentId=i),await e.client.request("files.mkdir",o),Ft(e,`Created ${s}`),await Ut(e,i),e.filesExpandedDirs=new Set([...e.filesExpandedDirs,s]),e.filesCurrentDir=s}catch(o){e.filesMessage={kind:"error",text:Ie(o)}}}async function ch(e,t,n){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const i={path:t};n&&(i.agentId=n),await e.client.request("files.delete",i),Ft(e,"File deleted"),e.filesSelectedPath===t&&(e.filesSelectedPath=null,e.filesPreviewContent=null),await Ut(e,n)}catch(i){e.filesMessage={kind:"error",text:Ie(i)}}}}async function uh(e,t,n,i){if(!(!e.client||!e.connected)){e.filesMessage=null;try{const s={from:t,to:n};i&&(s.agentId=i),await e.client.request("files.move",s),Ft(e,"File moved"),e.filesSelectedPath===t&&(e.filesSelectedPath=n),await Ut(e,i)}catch(s){e.filesMessage={kind:"error",text:Ie(s)}}}}async function bo(e,t){if(!(!e.client||!e.connected))try{const n={};t&&(n.agentId=t);const i=await e.client.request("memory.status",n);i!=null&&i.ok&&(e.filesMemoryStatus={dirty:i.dirty??!1,syncing:i.syncing,syncProgress:i.syncProgress,files:i.files??0,chunks:i.chunks??0,model:i.model,embeddingState:i.embeddingState})}catch{}}async function dh(e,t){if(!(!e.client||!e.connected)&&!e.filesReindexBusy){e.filesReindexBusy=!0,e.filesMessage=null;try{const n={force:!0};t&&(n.agentId=t);const i=await e.client.request("memory.reindex",n),s=(i==null?void 0:i.files)??0,o=(i==null?void 0:i.chunks)??0;Ft(e,`Re-indexed: ${s} files, ${o} chunks`),await bo(e,t)}catch(n){e.filesMessage={kind:"error",text:Ie(n)}}finally{e.filesReindexBusy=!1}}}function ph(e,t){const n=new Set(e.filesExpandedDirs);n.has(t)?n.delete(t):n.add(t),e.filesExpandedDirs=n,e.filesCurrentDir=t}async function hh(e,t,n){if(!(!e.client||!e.connected)){if(!t.trim()){e.filesSearchResults=null;return}e.filesSearchLoading=!0,e.filesSearchResults=null;try{const i={query:t.trim(),maxResults:20};n&&(i.agentId=n);const s=await e.client.request("memory.search",i);e.filesSearchResults=(s==null?void 0:s.results)??[]}catch(i){e.filesMessage={kind:"error",text:Ie(i)},e.filesSearchResults=null}finally{e.filesSearchLoading=!1}}}function fh(e){e.filesSearchQuery="",e.filesSearchResults=null}function gh(e){e.nodesPollInterval==null&&(e.nodesPollInterval=window.setInterval(()=>{yo(e,{quiet:!0})},5e3))}function mh(e){e.nodesPollInterval!=null&&(clearInterval(e.nodesPollInterval),e.nodesPollInterval=null)}function wo(e){e.logsPollInterval==null&&(e.logsPollInterval=window.setInterval(()=>{e.tab==="logs"&&Pt(e,{quiet:!0})},2e3))}function ko(e){e.logsPollInterval!=null&&(clearInterval(e.logsPollInterval),e.logsPollInterval=null)}function So(e){e.sessionLogsPollInterval==null&&(e.sessionLogsPollInterval=window.setInterval(()=>{!(e.advancedPage?e.advancedTab==="logs":e.tab==="logs")||e.logsSubTab!=="session"||un(e,{quiet:!0})},2e3))}function xo(e){e.sessionLogsPollInterval!=null&&(clearInterval(e.sessionLogsPollInterval),e.sessionLogsPollInterval=null)}function $o(e){e.debugPollInterval==null&&(e.debugPollInterval=window.setInterval(()=>{e.tab==="debug"&&co(e)},3e3))}function Ao(e){e.debugPollInterval!=null&&(clearInterval(e.debugPollInterval),e.debugPollInterval=null)}function yh(e){e.auditPollInterval==null&&(e.auditPollInterval=window.setInterval(()=>{ic(e)},3e4))}function vh(e){e.auditPollInterval!=null&&(clearInterval(e.auditPollInterval),e.auditPollInterval=null)}function bh(e){e.memoryStatusPollInterval==null&&(e.memoryStatusPollInterval=window.setInterval(()=>{if(e.tab!=="files")return;const t=e;bo(t,t.filesResolvedAgentId)},3e3))}function wh(e){e.memoryStatusPollInterval!=null&&(clearInterval(e.memoryStatusPollInterval),e.memoryStatusPollInterval=null)}function Ge(e,t){var i;const n={...t,lastActiveSessionKey:((i=t.lastActiveSessionKey)==null?void 0:i.trim())||t.sessionKey.trim()||"main"};e.settings=n,vd(n),t.theme!==e.theme&&(e.theme=t.theme,_i(e,vo(t.theme))),e.applySessionKey=e.settings.lastActiveSessionKey}function rc(e,t){const n=t.trim();n&&e.settings.lastActiveSessionKey!==n&&Ge(e,{...e.settings,lastActiveSessionKey:n})}function kh(e){if(!window.location.search)return;const t=new URLSearchParams(window.location.search),n=t.get("token"),i=t.get("password"),s=t.get("session"),o=t.get("gatewayUrl");let r=!1;if(n!=null){const u=n.trim();u&&u!==e.settings.token&&Ge(e,{...e.settings,token:u}),t.delete("token"),r=!0}if(i!=null){const u=i.trim();u&&(e.password=u),t.delete("password"),r=!0}if(s!=null){const u=s.trim();u&&(e.sessionKey=u,Ge(e,{...e.settings,sessionKey:u,lastActiveSessionKey:u}))}if(o!=null){const u=o.trim();u&&u!==e.settings.gatewayUrl&&Ge(e,{...e.settings,gatewayUrl:u}),t.delete("gatewayUrl"),r=!0}if(!r)return;const a=new URL(window.location.href);a.search=t.toString(),window.history.replaceState({},"",a.toString())}function Sh(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?So(e):wo(e):(ko(e),xo(e)),t==="debug"?$o(e):Ao(e),li(e),lc(e,t,!1)}function xh(e,t,n){eh({nextTheme:t,applyTheme:()=>{e.theme=t,Ge(e,{...e.settings,theme:t}),_i(e,vo(t))},context:n,currentTheme:e.theme})}async function li(e){if(e.tab==="overview"&&await cc(e),e.tab==="channels"&&await Mh(e),e.tab==="instances"&&await Gl(e),e.tab==="cron"&&await Eo(e),e.tab==="skills"&&await ft(e),e.tab==="nodes"&&(await yo(e),await mo(e),await Le(e),await Vp(e)),e.tab==="chat"&&!e.advancedPage&&!e.chatPage&&(await Nh(e),Bt(e,!e.chatHasAutoScrolled)),e.tab==="config"&&(await El(e),await Le(e)),e.tab==="debug"&&(await co(e),e.eventLog=e.eventLogBuffer),e.tab==="logs"){if(e.logsAtBottom=!0,e.logsSubTab==="session"){const{loadSessionLogs:n}=await ie(async()=>{const{loadSessionLogs:i}=await Promise.resolve().then(()=>nc);return{loadSessionLogs:i}},void 0,import.meta.url);await n(e,{reset:!0})}else await Pt(e,{reset:!0});$l(e,!0)}}function $h(){if(typeof window>"u")return"";const e=window.__TASKMASTER_CONTROL_UI_BASE_PATH__;return typeof e=="string"&&e.trim()?Ti(e):Xp(window.location.pathname)}function Ah(e){e.theme=e.settings.theme??"system",_i(e,vo(e.theme))}function _i(e,t){if(e.themeResolved=t,typeof document>"u")return;const n=document.documentElement;n.dataset.theme=t,n.style.colorScheme=t}function Eh(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"&&_i(e,n.matches?"dark":"light")},typeof e.themeMedia.addEventListener=="function"){e.themeMedia.addEventListener("change",e.themeMediaHandler);return}e.themeMedia.addListener(e.themeMediaHandler)}function Ch(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 Th(e,t){if(typeof window>"u")return;const n=tc(window.location.pathname,e.basePath)??"chat";ac(e,n),lc(e,n,t)}function _h(e){var s;if(typeof window>"u")return;const t=tc(window.location.pathname,e.basePath);if(!t)return;const i=(s=new URL(window.location.href).searchParams.get("session"))==null?void 0:s.trim();i&&(e.sessionKey=i,Ge(e,{...e.settings,sessionKey:i,lastActiveSessionKey:i})),ac(e,t)}function ac(e,t){e.tab!==t&&(e.tab=t),t==="chat"&&(e.chatHasAutoScrolled=!1),t==="logs"?e.logsSubTab==="session"?So(e):wo(e):(ko(e),xo(e)),t==="debug"?$o(e):Ao(e),e.connected&&li(e)}function lc(e,t,n){if(typeof window>"u")return;const i=vn(Yp(t,e.basePath)),s=vn(window.location.pathname),o=new URL(window.location.href);t==="chat"&&e.sessionKey?o.searchParams.set("session",e.sessionKey):o.searchParams.delete("session"),s!==i&&(o.pathname=i),n?window.history.replaceState({},"",o.toString()):window.history.pushState({},"",o.toString())}async function cc(e){await Promise.all([G(e,!1),Gl(e),ro(e),bn(e),co(e)])}async function Mh(e){await Promise.all([G(e,!0),El(e),Le(e)])}async function Eo(e){await Promise.all([G(e,!1),bn(e),Ai(e)])}function uc(e){return e.chatSending||!!e.chatRunId}function Ph(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 dc(e){e.connected&&(e.chatMessage="",await Sl(e))}function Lh(e,t,n){const i=t.trim(),s=!!(n&&n.length>0);!i&&!s||(e.chatQueue=[...e.chatQueue,{id:oo(),text:i,createdAt:Date.now(),attachments:s?n==null?void 0:n.map(o=>({...o})):void 0}],Bt(e))}async function pc(e,t,n){var s,o;ao(e);const i=await kl(e,t,n==null?void 0:n.attachments);return!i&&(n==null?void 0:n.previousDraft)!=null&&(e.chatMessage=n.previousDraft),!i&&(n!=null&&n.previousAttachments)&&(e.chatAttachments=n.previousAttachments),i&&rc(e,e.sessionKey),i&&(n!=null&&n.restoreDraft)&&((s=n.previousDraft)!=null&&s.trim())&&(e.chatMessage=n.previousDraft),i&&(n!=null&&n.restoreAttachments)&&((o=n.previousAttachments)!=null&&o.length)&&(e.chatAttachments=n.previousAttachments),Bt(e),i&&!e.chatRunId&&hc(e),i}async function hc(e){if(!e.connected||uc(e))return;const[t,...n]=e.chatQueue;if(!t)return;e.chatQueue=n,await pc(e,t.text,{attachments:t.attachments})||(e.chatQueue=[t,...e.chatQueue])}function Ih(e,t){e.chatQueue=e.chatQueue.filter(n=>n.id!==t)}async function Rh(e,t,n){if(!e.connected)return;const i=e.chatMessage,s=(t??e.chatMessage).trim(),o=e.chatAttachments??[],r=t==null?o:[],a=r.length>0;if(!(!s&&!a)){if(Ph(s)){await dc(e);return}if(t==null&&(e.chatMessage="",e.chatAttachments=[]),uc(e)){Lh(e,s,r);return}await pc(e,s,{previousDraft:t==null?i:void 0,restoreDraft:!!(t&&(n!=null&&n.restoreDraft)),attachments:a?r:void 0,previousAttachments:t==null?o:void 0,restoreAttachments:!!(t&&(n!=null&&n.restoreDraft))})}}async function Nh(e){var i;const t=e,n=Math.max((((i=t.chatMessages)==null?void 0:i.length)??0)+10,Pe);await Promise.all([Me(t,{limit:n}),ro(t),Ds(e)]),Bt(e,!0)}const Dh=hc;function Oh(e){var s,o,r;const t=pl(e.sessionKey);if(t!=null&&t.agentId)return t.agentId;const n=(s=e.hello)==null?void 0:s.snapshot;return((r=(o=n==null?void 0:n.sessionDefaults)==null?void 0:o.defaultAgentId)==null?void 0:r.trim())||"main"}function Bh(e,t){const n=Ti(e),i=encodeURIComponent(t);return n?`${n}/avatar/${i}?meta=1`:`/avatar/${i}?meta=1`}async function Ds(e){if(!e.connected){e.chatAvatarUrl=null;return}const t=Oh(e);if(!t){e.chatAvatarUrl=null;return}e.chatAvatarUrl=null;const n=Bh(e.basePath,t);try{const i=await fetch(n,{method:"GET"});if(!i.ok){e.chatAvatarUrl=null;return}const s=await i.json(),o=typeof s.avatarUrl=="string"?s.avatarUrl.trim():"";e.chatAvatarUrl=o||null}catch{e.chatAvatarUrl=null}}const N={messageSquare:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`,unlink:p`<svg viewBox="0 0 24 24"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"/><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"/><line x1="8" x2="8" y1="2" y2="5"/><line x1="2" x2="5" y1="8" y2="8"/><line x1="16" x2="16" y1="19" y2="22"/><line x1="19" x2="22" y1="16" y2="16"/></svg>`,radio:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>`,monitor:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`,check:p`<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>`,copy:p`<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:p`<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,brain:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/></svg>`,circleCheck:p`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>`,circleX:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>`,smile:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="2"/></svg>`,eye:p`<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:p`<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:p`<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:p`<svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>`,film:p`<svg viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18"/><path d="M3 7.5h4"/><path d="M3 12h18"/><path d="M3 16.5h4"/><path d="M17 3v18"/><path d="M17 7.5h4"/><path d="M17 16.5h4"/></svg>`,wifi:p`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.859a10 10 0 0 1 14 0"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/></svg>`,wifiOff:p`<svg viewBox="0 0 24 24"><path d="M12 20h.01"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/><path d="M5 12.859a10 10 0 0 1 5.17-2.69"/><path d="M13.41 10.28a10 10 0 0 1 5.59 2.58"/><path d="M2 8.82a15 15 0 0 1 4.17-2.65"/><path d="M10.66 5c4.01-.36 8.14.9 11.34 3.76"/><line x1="2" x2="22" y1="2" y2="22"/></svg>`},Fh="Taskmaster",Uh="/taskmaster-icon.png",fc="#00d4ff";let Fn=null;function Xe(){return Fn||(Fn={name:window.__TASKMASTER_BRAND_NAME__||Fh,iconUrl:window.__TASKMASTER_BRAND_ICON_URL__||Uh,accentColor:window.__TASKMASTER_ACCENT_COLOR__||fc},Fn)}function Wh(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 Kh(e){if(e===fc)return;const t=Wh(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 zh=p`<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>`,jh=p`<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 Or=!1;function Hh(){Or||(Or=!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 vt(e,t){const n=(l,d)=>l===e?p`<span class="sp-page-nav-current">${l}</span>`:p`<a href=${d}>${l}</a>`,i=p`
21
21
  ${n("Setup","/setup")}
22
22
  ${n("Chat","/chat")}
23
23
  ${n("Admins","/admins")}
@@ -177,7 +177,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
177
177
  </div>
178
178
  `:p`
179
179
  <div class="sp-canvas-placeholder">
180
- <div class="sp-canvas-placeholder-icon">${D.globe}</div>
180
+ <div class="sp-canvas-placeholder-icon">${N.globe}</div>
181
181
  <p>Click Start to begin streaming the Chrome viewport.</p>
182
182
  </div>
183
183
  `}
@@ -206,7 +206,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
206
206
  @drop=${c=>Gh(c,e.path,t)}
207
207
  >
208
208
  <span class="sp-tree-chevron">${s?"−":"+"}</span>
209
- <span class="sp-tree-icon">${D.folder}</span>
209
+ <span class="sp-tree-icon">${N.folder}</span>
210
210
  <span class="sp-tree-name">${e.name}</span>
211
211
  ${s&&((u=e.children)==null?void 0:u.length)===0?p`<span
212
212
  class="sp-tree-dir-delete"
@@ -223,7 +223,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
223
223
  @click=${c=>{c.metaKey||c.ctrlKey?t.onToggleSelectFile(e.path):t.onSelectFile(e.path)}}
224
224
  @dragstart=${c=>{c.dataTransfer&&(c.dataTransfer.effectAllowed="move",c.dataTransfer.setData(ci,e.path),c.dataTransfer.setData("text/plain",e.name))}}
225
225
  >
226
- <span class="sp-tree-icon">${D.fileText}</span>
226
+ <span class="sp-tree-icon">${N.fileText}</span>
227
227
  <span class="sp-tree-name">${e.name}</span>
228
228
  <span class="sp-tree-size">${gc(e.size)}</span>
229
229
  </div>
@@ -410,7 +410,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
410
410
  @click=${()=>t.onInfoModalOpen(e)}
411
411
  title="Details"
412
412
  >
413
- ${D.info}
413
+ ${N.info}
414
414
  </button>
415
415
  `}function nf(e){var i;if(!e.infoModalOpen)return k;let t="",n=[];switch(e.infoModalOpen){case"gateway":{const s=typeof window<"u"?window.location.host:"unknown";t="Gateway",n=[{label:"Status",value:e.gatewayHealthy===!1?"Stopped":"Running"},{label:"Address",value:s},{label:"Health",value:e.gatewayHealthMessage||"OK"}];break}case"claude":{const s=e.authExpiresIn;let o="N/A";if(s!=null&&s>0)if(s>60){const r=Math.floor(s/60),a=s%60;o=a>0?`${r}h ${a}m`:`${r}h`}else o=`${s}m`;t="Claude",n=[{label:"Connected",value:e.authConnected?"Yes":"No"},{label:"Token Expiry",value:o},{label:"Renewal",value:"Automatic (tokens refresh on expiry)"},...e.authMessage?[{label:"Message",value:e.authMessage}]:[]];break}case"license":{const s=e.licenseStoredKey?`…${e.licenseStoredKey.slice(-12)}`:"N/A";t="License",n=[{label:"Status",value:e.licenseValid?"Active":"Inactive"},{label:"Key",value:s},{label:"Tier",value:e.licenseTier||"Standard"},{label:"Device ID",value:e.licenseDeviceId||"N/A"}];break}case"whatsapp":{const s=Wt(e),o=s?_o(s,e):null;t="WhatsApp",n=[{label:"Account",value:(o==null?void 0:o.name)||(o==null?void 0:o.accountId)||"Default"},{label:"Phone",value:((i=o==null?void 0:o.self)==null?void 0:i.e164)||"Not paired"},{label:"Connected",value:o!=null&&o.connected?"Yes":"No"},{label:"Linked",value:o!=null&&o.linked?"Yes":"No"},...o!=null&&o.lastError?[{label:"Last Error",value:vc(o.lastError)}]:[]];break}case"imessage":{const{thisWsOwns:s}=Mo(e);t="iMessage",n=[{label:"Connected",value:s&&e.imessageConnected?"Yes":"No"},{label:"Assigned To",value:e.imessageOwnerWorkspace??"Not assigned"},{label:"Mode",value:"Self-chat only"},...e.imessageLastError?[{label:"Last Error",value:e.imessageLastError}]:[]];break}case"update":{t="Software Update",n=[{label:"Current",value:e.currentVersion?`v${e.currentVersion}`:"Unknown"},{label:"Latest",value:e.latestVersion?`v${e.latestVersion}`:"Unknown"},{label:"Status",value:e.updateAvailable===null?"Not checked":e.updateAvailable?"Update available":"Up to date"},...e.updateMessage?[{label:"Message",value:e.updateMessage}]:[]];break}case"internet":{const s=e.tailscaleStatus,o=s?s.installed?s.loggedIn?s.funnelEnabled&&s.funnelActive?"Active":s.funnelEnabled&&!s.funnelActive?"Enabled but not active":"Connected (not public)":"Not connected":"Not installed":"Checking...";t="Internet Access",n=[{label:"Status",value:o},{label:"What",value:"Makes your public chat and API reachable from the internet, not just your local network"},{label:"How",value:"Uses Tailscale Funnel — a free, secure tunnel that gives your device a public HTTPS address"},{label:"Security",value:"Only the /public/* paths are exposed. The control panel stays LAN-only."},...s!=null&&s.publicUrl?[{label:"Public URL",value:s.publicUrl}]:[],...s!=null&&s.hostname?[{label:"Hostname",value:s.hostname}]:[]];break}case"public-chat":{t="Public Chat",n=[{label:"Status",value:e.publicChatEnabled?"Enabled":"Disabled"},{label:"What",value:"A chat widget anyone can use to message your business from a web browser"},{label:"Access mode",value:df[e.publicChatAuthMode]??"Open access"},{label:"Open access",value:"Anyone can chat without identifying themselves"},{label:"WhatsApp OTP",value:"Visitors verify their phone number before chatting"},{label:"Visitor chooses",value:"Visitors can chat anonymously or verify via WhatsApp"}];break}case"account-pin":{t="Account PIN",n=[{label:"Status",value:e.accountHasPin?"Set":"Not set"},{label:"What",value:"A numeric PIN that protects this account on the control panel"},{label:"When needed",value:"Required when switching to this account or after the session expires"},{label:"Format",value:"4 to 6 digits"}];break}default:return k}return p`
416
416
  <div class="setup-info-overlay" @click=${s=>{s.target.classList.contains("setup-info-overlay")&&e.onInfoModalClose()}}>
@@ -658,12 +658,12 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
658
658
  @click=${s}
659
659
  title="Save"
660
660
  style="color: #22c55e;"
661
- >${D.check}</button>
661
+ >${N.check}</button>
662
662
  <button
663
663
  class="setup-status-action"
664
664
  @click=${e.onWorkspaceRenameCancel}
665
665
  title="Cancel"
666
- >${D.x}</button>
666
+ >${N.x}</button>
667
667
  </div>
668
668
  `}return p`
669
669
  <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;">
@@ -674,7 +674,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
674
674
  @click=${e.onWorkspaceRenameStart}
675
675
  title="Rename"
676
676
  style="opacity: 0.5; transform: scale(0.8);"
677
- >${D.edit}</button>
677
+ >${N.edit}</button>
678
678
  </div>
679
679
  <button
680
680
  class="setup-status-action ${i?"spinning":""}"
@@ -682,7 +682,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
682
682
  @click=${e.onRefreshStatus}
683
683
  title="Refresh Status"
684
684
  >
685
- ${D.rotateCw}
685
+ ${N.rotateCw}
686
686
  </button>
687
687
  </div>
688
688
  `}function Wr(e){return p`
@@ -699,7 +699,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
699
699
  @click=${e.onRestartGateway}
700
700
  title="Restart Gateway"
701
701
  >
702
- ${D.rotateCw}
702
+ ${N.rotateCw}
703
703
  </button>
704
704
  </div>
705
705
  `}function Kr(e){const t=e.authConnected===!0;return p`
@@ -719,7 +719,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
719
719
  @click=${e.onStartAuth}
720
720
  title="Refresh Token"
721
721
  >
722
- ${D.rotateCw}
722
+ ${N.rotateCw}
723
723
  </button>
724
724
  `:p`
725
725
  <button
@@ -727,7 +727,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
727
727
  @click=${e.onStartAuth}
728
728
  title="Connect Claude"
729
729
  >
730
- ${D.rotateCw}
730
+ ${N.rotateCw}
731
731
  </button>
732
732
  `}
733
733
  </div>
@@ -744,7 +744,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
744
744
  @click=${()=>{e.licenseRemoveConfirm?e.onLicenseRemoveCancel():e.onLicenseRemoveConfirm()}}
745
745
  title="Manage License"
746
746
  >
747
- ${D.rotateCw}
747
+ ${N.rotateCw}
748
748
  </button>
749
749
  ${e.licenseRemoveConfirm?p`
750
750
  <div style="width: 100%; margin-top: 8px; margin-left: 30px;">
@@ -784,7 +784,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
784
784
  title="WhatsApp Settings"
785
785
  style="opacity: 0.5; transform: scale(0.75);"
786
786
  >
787
- ${D.settings}
787
+ ${N.settings}
788
788
  </button>
789
789
  `:k}
790
790
  </div>
@@ -797,7 +797,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
797
797
  @click=${e.onRefreshStatus}
798
798
  title="Refresh Status"
799
799
  >
800
- ${D.rotateCw}
800
+ ${N.rotateCw}
801
801
  </button>
802
802
  ${n!=null&&n.linked?p`
803
803
  <button
@@ -806,7 +806,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
806
806
  @click=${()=>e.onWhatsAppUnlink(c)}
807
807
  title="Unlink WhatsApp"
808
808
  >
809
- ${D.unlink}
809
+ ${N.unlink}
810
810
  </button>
811
811
  `:p`
812
812
  <button
@@ -815,7 +815,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
815
815
  @click=${()=>e.onWhatsAppRelink(c)}
816
816
  title="Link WhatsApp"
817
817
  >
818
- ${D.link}
818
+ ${N.link}
819
819
  </button>
820
820
  `}
821
821
  `:k}
@@ -949,7 +949,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
949
949
  @click=${e.onIMessageEnable}
950
950
  title="${n?"Manage iMessage":"Connect iMessage"}"
951
951
  >
952
- ${D.rotateCw}
952
+ ${N.rotateCw}
953
953
  </button>
954
954
  ${k}
955
955
  </div>
@@ -1066,7 +1066,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1066
1066
  style=${c.hasKey?"":"display: none;"}
1067
1067
  title="Toggle visibility"
1068
1068
  @click=${s}
1069
- >${D.eye}</button>
1069
+ >${N.eye}</button>
1070
1070
  ${l?p`<span class="setup-apikey-badge saving">Saving\u2026</span>`:p`<button
1071
1071
  class="setup-apikey-save setup-button"
1072
1072
  style="display: none;"
@@ -1079,7 +1079,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1079
1079
  title="Remove key"
1080
1080
  ?disabled=${e.apiKeyBusy}
1081
1081
  @click=${()=>e.onApiKeyRemove(c.id)}
1082
- >${D.trash}</button>
1082
+ >${N.trash}</button>
1083
1083
  `:k}
1084
1084
  </div>
1085
1085
  </div>
@@ -1114,7 +1114,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1114
1114
  @click=${e.onUpdateRun}
1115
1115
  title="Update Now"
1116
1116
  >
1117
- ${D.download}
1117
+ ${N.download}
1118
1118
  </button>
1119
1119
  `:p`
1120
1120
  <button
@@ -1123,7 +1123,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1123
1123
  @click=${e.onUpdateCheck}
1124
1124
  title="Check for Updates"
1125
1125
  >
1126
- ${D.rotateCw}
1126
+ ${N.rotateCw}
1127
1127
  </button>
1128
1128
  `}
1129
1129
  </div>
@@ -1291,7 +1291,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1291
1291
  class="setup-info-btn"
1292
1292
  title="Copy URL"
1293
1293
  @click=${async o=>{const r=o.currentTarget;try{await navigator.clipboard.writeText(s)}catch{const a=document.createElement("textarea");a.value=s,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)}r.classList.add("copied"),setTimeout(()=>r.classList.remove("copied"),1500)}}
1294
- >${D.copy}</button>
1294
+ >${N.copy}</button>
1295
1295
  <button
1296
1296
  class="setup-link-btn"
1297
1297
  ?disabled=${n}
@@ -1307,7 +1307,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1307
1307
  background: ${s<t?"var(--tasker-accent, #00e5ff)":"rgba(255,255,255,0.15)"};
1308
1308
  "></span>`)}
1309
1309
  </span>
1310
- `}function Yr(e){var c;if(e.serverPlatform!=="linux")return k;const t=e.wifiStatus,n=e.wifiBusy;if(!t)return p`
1310
+ `}function Yr(e){if(e.serverPlatform!=="linux")return k;const t=e.wifiStatus,n=e.wifiBusy;if(!t)return p`
1311
1311
  <div class="setup-status-item">
1312
1312
  ${q("unknown")}
1313
1313
  <div class="setup-status-info">
@@ -1323,7 +1323,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1323
1323
  <span>NetworkManager not available</span>
1324
1324
  </div>
1325
1325
  </div>
1326
- `;const i=e.wifiNetworks,s=e.wifiSelectedSsid,o=i.length>0,r=!!t.savedSsid&&!t.connected,a=t.connected?"good":"partial",u=t.connected?p`${t.ssid} ${t.signal!=null?p`<span style="margin-left: 4px;">${Qr(t.signal)}</span>`:k}`:r?p`Saved: ${t.savedSsid} <span style="opacity: 0.5; font-size: 11px;">(disconnected)</span>`:"Not connected";return p`
1326
+ `;const i=e.wifiNetworks,s=e.wifiSelectedSsid,o=i.length>0,r=!!t.savedSsid&&!t.connected,a=t.connected?"good":"partial",u=t.connected?p`${t.ssid} ${t.signal!=null?p`<span style="margin-left: 4px;">${Qr(t.signal)}</span>`:k}`:r?p`${t.savedSsid} <span style="opacity: 0.4;">\u2014 reconnecting\u2026</span>`:"Not connected";return p`
1327
1327
  <div>
1328
1328
  <div class="setup-status-item">
1329
1329
  ${q(a)}
@@ -1333,26 +1333,17 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1333
1333
  ${t.connected&&t.ip?p`<span style="font-size: 11px; opacity: 0.5;">${t.ip}</span>`:k}
1334
1334
  </div>
1335
1335
  ${t.connected?p`<button
1336
- class="setup-link-btn"
1336
+ class="setup-status-action"
1337
1337
  ?disabled=${n}
1338
1338
  @click=${e.onWifiDisconnect}
1339
- >${n?"...":"Disconnect"}</button>`:k}
1340
- ${r?p`<button
1341
- class="setup-link-btn"
1342
- ?disabled=${n}
1343
- @click=${e.onWifiReconnect}
1344
- >${n?"...":"Reconnect"}</button>`:k}
1345
- ${t.connected||r?p`<button
1346
- class="setup-link-btn"
1347
- ?disabled=${n}
1348
- @click=${e.onWifiForget}
1349
- title="Remove saved WiFi password"
1350
- >${n?"...":"Forget"}</button>`:k}
1339
+ title="Disconnect"
1340
+ >${N.wifiOff}</button>`:k}
1351
1341
  <button
1352
- class="setup-link-btn"
1342
+ class="setup-status-action ${n?"spinning":""}"
1353
1343
  ?disabled=${n}
1354
1344
  @click=${o?e.onWifiDismiss:e.onWifiScan}
1355
- >${n?"...":o?"Close":"Scan"}</button>
1345
+ title="${o?"Close":"Scan for networks"}"
1346
+ >${o?N.x:N.wifi}</button>
1356
1347
  </div>
1357
1348
 
1358
1349
  ${e.wifiError?p`<div style="padding: 4px 0 4px 28px;">
@@ -1368,63 +1359,69 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1368
1359
  border-radius: 6px;
1369
1360
  margin-bottom: 8px;
1370
1361
  ">
1371
- ${i.map(l=>p`
1372
- <button
1373
- style="
1374
- display: flex;
1375
- align-items: center;
1376
- justify-content: space-between;
1377
- width: 100%;
1378
- padding: 8px 12px;
1379
- background: ${s===l.ssid?"rgba(255,255,255,0.1)":"transparent"};
1380
- border: none;
1381
- border-bottom: 1px solid rgba(255,255,255,0.06);
1382
- color: inherit;
1383
- font-size: 13px;
1384
- cursor: pointer;
1385
- text-align: left;
1386
- "
1387
- @click=${()=>{l.active?e.onWifiDismiss():e.onWifiSelectSsid(s===l.ssid?null:l.ssid)}}
1388
- >
1389
- <span style="display: flex; align-items: center; gap: 8px;">
1390
- ${l.active?p`<span style="color: #22c55e;" title="Connected">\u2713</span>`:k}
1391
- <span>${l.ssid}</span>
1392
- </span>
1393
- <span style="display: flex; align-items: center; gap: 8px;">
1394
- ${l.security!=="Open"?p`<span style="opacity: 0.4; font-size: 11px;" title="${l.security}">\uD83D\uDD12</span>`:k}
1395
- <span title="Signal: ${l.signal}%">${Qr(l.signal)}</span>
1396
- </span>
1397
- </button>
1398
- `)}
1362
+ ${i.map(c=>{const l=t.savedSsid===c.ssid;return p`
1363
+ <button
1364
+ style="
1365
+ display: flex;
1366
+ align-items: center;
1367
+ justify-content: space-between;
1368
+ width: 100%;
1369
+ padding: 8px 12px;
1370
+ background: ${s===c.ssid?"rgba(255,255,255,0.1)":"transparent"};
1371
+ border: none;
1372
+ border-bottom: 1px solid rgba(255,255,255,0.06);
1373
+ color: inherit;
1374
+ font-size: 13px;
1375
+ cursor: pointer;
1376
+ text-align: left;
1377
+ "
1378
+ @click=${()=>{c.active?e.onWifiDismiss():e.onWifiSelectSsid(s===c.ssid?null:c.ssid)}}
1379
+ >
1380
+ <span style="display: flex; align-items: center; gap: 8px;">
1381
+ ${c.active?p`<span style="color: #22c55e;" title="Connected">\u2713</span>`:l?p`<span style="opacity: 0.4; font-size: 11px;" title="Saved">\u2605</span>`:k}
1382
+ <span>${c.ssid}</span>
1383
+ </span>
1384
+ <span style="display: flex; align-items: center; gap: 8px;">
1385
+ ${c.security!=="Open"?p`<span style="opacity: 0.4; font-size: 11px;" title="${c.security}">\uD83D\uDD12</span>`:k}
1386
+ <span title="Signal: ${c.signal}%">${Qr(c.signal)}</span>
1387
+ </span>
1388
+ </button>
1389
+ `})}
1399
1390
  </div>
1400
1391
 
1401
- ${s&&!i.find(l=>l.ssid===s&&l.active)?p`
1392
+ ${s&&!i.find(c=>c.ssid===s&&c.active)?p`
1402
1393
  <div style="display: flex; gap: 8px; align-items: center;">
1403
- ${((c=i.find(l=>l.ssid===s))==null?void 0:c.security)!=="Open"?p`
1404
- <input
1405
- type="password"
1406
- placeholder="Password"
1407
- .value=${e.wifiPassword}
1408
- @input=${l=>e.onWifiPasswordChange(l.target.value)}
1409
- @keydown=${l=>{l.key==="Enter"&&e.onWifiConnect()}}
1410
- ?disabled=${n}
1411
- style="
1412
- flex: 1;
1413
- padding: 6px 10px;
1414
- background: rgba(255,255,255,0.06);
1415
- border: 1px solid rgba(255,255,255,0.15);
1416
- border-radius: 4px;
1417
- color: inherit;
1418
- font-size: 13px;
1419
- outline: none;
1420
- "
1421
- />`:k}
1394
+ ${(()=>{const c=i.find(h=>h.ssid===s),l=(c==null?void 0:c.security)!=="Open",d=t.savedSsid===s;return l&&!d?p`
1395
+ <input
1396
+ type="password"
1397
+ placeholder="Password"
1398
+ .value=${e.wifiPassword}
1399
+ @input=${h=>e.onWifiPasswordChange(h.target.value)}
1400
+ @keydown=${h=>{h.key==="Enter"&&e.onWifiConnect()}}
1401
+ ?disabled=${n}
1402
+ style="
1403
+ flex: 1;
1404
+ padding: 6px 10px;
1405
+ background: rgba(255,255,255,0.06);
1406
+ border: 1px solid rgba(255,255,255,0.15);
1407
+ border-radius: 4px;
1408
+ color: inherit;
1409
+ font-size: 13px;
1410
+ outline: none;
1411
+ "
1412
+ />`:k})()}
1422
1413
  <button
1423
1414
  class="setup-button primary"
1424
1415
  style="padding: 6px 16px; font-size: 13px;"
1425
1416
  ?disabled=${n}
1426
1417
  @click=${e.onWifiConnect}
1427
1418
  >${n?"Connecting...":"Connect"}</button>
1419
+ ${t.savedSsid===s?p`<button
1420
+ class="setup-link-btn"
1421
+ ?disabled=${n}
1422
+ @click=${e.onWifiForget}
1423
+ style="font-size: 12px; opacity: 0.6;"
1424
+ >Forget</button>`:k}
1428
1425
  </div>
1429
1426
  `:k}
1430
1427
  </div>
@@ -1439,7 +1436,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1439
1436
  ${e.updateProgressSteps.map(r=>p`
1440
1437
  <div class="setup-update-step ${r.status}">
1441
1438
  <span class="setup-update-step-icon">
1442
- ${r.status==="running"?p`<span class="setup-update-spinner"></span>`:r.status==="done"?p`<span class="setup-update-icon-ok">${D.check}</span>`:p`<span class="setup-update-icon-fail">${D.x}</span>`}
1439
+ ${r.status==="running"?p`<span class="setup-update-spinner"></span>`:r.status==="done"?p`<span class="setup-update-icon-ok">${N.check}</span>`:p`<span class="setup-update-icon-fail">${N.x}</span>`}
1443
1440
  </span>
1444
1441
  <span class="setup-update-step-name">${r.name}</span>
1445
1442
  ${r.durationMs!=null?p`<span class="setup-update-step-time">${Xr(r.durationMs)}</span>`:k}
@@ -1453,7 +1450,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1453
1450
  `;if(n){const r=n.status==="ok";let a;if(r){const c=(i=n.before)==null?void 0:i.version,l=((s=n.after)==null?void 0:s.version)??n.currentVersion;a=c?`v${c} → v${l}`:`Updated to v${l}`}else a=n.reason??((o=n.failedStep)==null?void 0:o.name)??"unknown error";const u=n.durationMs!=null?Xr(n.durationMs):null;return p`
1454
1451
  <div class="setup-info-overlay" @click=${c=>{c.target.classList.contains("setup-info-overlay")&&e.onUpdateDismissResult()}}>
1455
1452
  <div class="setup-info-card" style="max-width: 360px; text-align: center;">
1456
- <div class="setup-update-result-icon ${r?"ok":"fail"}">${r?D.circleCheck:D.circleX}</div>
1453
+ <div class="setup-update-result-icon ${r?"ok":"fail"}">${r?N.circleCheck:N.circleX}</div>
1457
1454
  <h3 style="color: ${r?"#22c55e":"#ef4444"};">
1458
1455
  ${r?"Update Complete":"Update Failed"}
1459
1456
  </h3>
@@ -1489,7 +1486,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
1489
1486
  <div class="setup-info-header">
1490
1487
  <h3>${t?"Change Account PIN":"Set Account PIN"}</h3>
1491
1488
  <button class="setup-info-close" @click=${()=>e.onAccountPinModalClose()}>
1492
- ${D.close}
1489
+ ${N.close}
1493
1490
  </button>
1494
1491
  </div>
1495
1492
  <form @submit=${u} style="display: flex; flex-direction: column; gap: 12px; padding: 16px 0 8px;">
@@ -2073,7 +2070,7 @@ ${o}`:o),e.chatStream="","working"}else if(t.state==="block"){const s=cn(t.messa
2073
2070
  </div>
2074
2071
  </div>
2075
2072
  </div>
2076
- `}const bc={CHILD:2},wc=e=>(...t)=>({_$litDirective$:e,values:t});let kc=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,i){this._$Ct=t,this._$AM=n,this._$Ci=i}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:Sf}=ld,sa=e=>e,oa=()=>document.createComment(""),Gt=(e,t,n)=>{var o;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const r=i.insertBefore(oa(),s),a=i.insertBefore(oa(),s);n=new Sf(r,a,e,e.options)}else{const r=n._$AB.nextSibling,a=n._$AM,u=a!==e;if(u){let c;(o=n._$AQ)==null||o.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==a._$AU&&n._$AP(c)}if(r!==s||u){let c=n._$AA;for(;c!==r;){const l=sa(c).nextSibling;sa(i).insertBefore(c,s),c=l}}}return n},st=(e,t,n=e)=>(e._$AI(t,n),e),xf={},$f=(e,t=xf)=>e._$AH=t,Af=e=>e._$AH,os=e=>{e._$AR(),e._$AA.remove()};const ra=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},Ef=wc(class extends kc{constructor(e){if(super(e),e.type!==bc.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;n===void 0?n=t:t!==void 0&&(i=t);const s=[],o=[];let r=0;for(const a of e)s[r]=i?i(a,r):r,o[r]=n(a,r),r++;return{values:o,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=Af(e),{values:o,keys:r}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=r,o;const a=this.ut??(this.ut=[]),u=[];let c,l,d=0,h=s.length-1,v=0,f=o.length-1;for(;d<=h&&v<=f;)if(s[d]===null)d++;else if(s[h]===null)h--;else if(a[d]===r[v])u[v]=st(s[d],o[v]),d++,v++;else if(a[h]===r[f])u[f]=st(s[h],o[f]),h--,f--;else if(a[d]===r[f])u[f]=st(s[d],o[f]),Gt(e,u[f+1],s[d]),d++,f--;else if(a[h]===r[v])u[v]=st(s[h],o[v]),Gt(e,s[d],s[h]),h--,v++;else if(c===void 0&&(c=ra(r,v,f),l=ra(a,d,h)),c.has(a[d]))if(c.has(a[h])){const b=l.get(r[v]),S=b!==void 0?s[b]:null;if(S===null){const $=Gt(e,s[d]);st($,o[v]),u[v]=$}else u[v]=st(S,o[v]),Gt(e,s[d],S),s[b]=null;v++}else os(s[h]),h--;else os(s[d]),d++;for(;v<=f;){const b=Gt(e,u[f+1]);st(b,o[v]),u[v++]=b}for(;d<=h;){const b=s[d++];b!==null&&os(b)}return this.ut=r,$f(e,u),Qe}});class Os extends kc{constructor(t){if(super(t),this.it=k,t.type!==bc.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===Qe)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}Os.directiveName="unsafeHTML",Os.resultType=1;const di=wc(Os);const{entries:Sc,setPrototypeOf:aa,isFrozen:Cf,getPrototypeOf:Tf,getOwnPropertyDescriptor:_f}=Object;let{freeze:pe,seal:ge,create:Bs}=Object,{apply:Fs,construct:Us}=typeof Reflect<"u"&&Reflect;pe||(pe=function(t){return t});ge||(ge=function(t){return t});Fs||(Fs=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(n,s)});Us||(Us=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const Un=he(Array.prototype.forEach),Mf=he(Array.prototype.lastIndexOf),la=he(Array.prototype.pop),Qt=he(Array.prototype.push),Pf=he(Array.prototype.splice),Xn=he(String.prototype.toLowerCase),rs=he(String.prototype.toString),as=he(String.prototype.match),Yt=he(String.prototype.replace),Lf=he(String.prototype.indexOf),If=he(String.prototype.trim),ye=he(Object.prototype.hasOwnProperty),le=he(RegExp.prototype.test),Xt=Rf(TypeError);function he(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return Fs(e,t,i)}}function Rf(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Us(e,n)}}function F(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Xn;aa&&aa(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(Cf(t)||(t[i]=o),s=o)}e[s]=!0}return e}function Nf(e){for(let t=0;t<e.length;t++)ye(e,t)||(e[t]=null);return e}function Ce(e){const t=Bs(null);for(const[n,i]of Sc(e))ye(e,n)&&(Array.isArray(i)?t[n]=Nf(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ce(i):t[n]=i);return t}function Zt(e,t){for(;e!==null;){const i=_f(e,t);if(i){if(i.get)return he(i.get);if(typeof i.value=="function")return he(i.value)}e=Tf(e)}function n(){return null}return n}const ca=pe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ls=pe(["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"]),cs=pe(["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"]),Df=pe(["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"]),us=pe(["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=pe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ua=pe(["#text"]),da=pe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ds=pe(["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"]),pa=pe(["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"]),Wn=pe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Bf=ge(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ff=ge(/<%[\w\W]*|[\w\W]*%>/gm),Uf=ge(/\$\{[\w\W]*/gm),Wf=ge(/^data-[\-\w.\u00B7-\uFFFF]+$/),Kf=ge(/^aria-[\-\w]+$/),xc=ge(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zf=ge(/^(?:\w+script|data):/i),jf=ge(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$c=ge(/^html$/i),Hf=ge(/^[a-z][.\w]*(-[.\w]+)+$/i);var ha=Object.freeze({__proto__:null,ARIA_ATTR:Kf,ATTR_WHITESPACE:jf,CUSTOM_ELEMENT:Hf,DATA_ATTR:Wf,DOCTYPE_NAME:$c,ERB_EXPR:Ff,IS_ALLOWED_URI:xc,IS_SCRIPT_OR_DATA:zf,MUSTACHE_EXPR:Bf,TMPLIT_EXPR:Uf});const Jt={element:1,text:3,progressingInstruction:7,comment:8,document:9},qf=function(){return typeof window>"u"?null:window},Vf=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},fa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ac(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qf();const t=I=>Ac(I);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Jt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:a,Element:u,NodeFilter:c,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:v}=e,f=u.prototype,b=Zt(f,"cloneNode"),S=Zt(f,"remove"),$=Zt(f,"nextSibling"),A=Zt(f,"childNodes"),C=Zt(f,"parentNode");if(typeof r=="function"){const I=n.createElement("template");I.content&&I.content.ownerDocument&&(n=I.content.ownerDocument)}let T,M="";const{implementation:R,createNodeIterator:B,createDocumentFragment:ee,getElementsByTagName:me}=n,{importNode:Ke}=i;let Z=fa();t.isSupported=typeof Sc=="function"&&typeof C=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:zt,ERB_EXPR:kt,TMPLIT_EXPR:Je,DATA_ATTR:Ri,ARIA_ATTR:Ni,IS_SCRIPT_OR_DATA:Di,ATTR_WHITESPACE:Sn,CUSTOM_ELEMENT:Oi}=ha;let{IS_ALLOWED_URI:xn}=ha,Q=null;const $n=F({},[...ca,...ls,...cs,...us,...ua]);let Y=null;const An=F({},[...da,...ds,...pa,...Wn]);let H=Object.seal(Bs(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}})),et=null,jt=null;const ze=Object.seal(Bs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let En=!0,x=!0,_=!1,N=!0,O=!1,V=!0,z=!1,ae=!1,je=!1,St=!1,Cn=!1,Tn=!1,Qo=!0,Yo=!1;const Pu="user-content-";let Bi=!0,Ht=!1,xt={},xe=null;const Fi=F({},["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 Xo=null;const Zo=F({},["audio","video","img","source","image","track"]);let Ui=null;const Jo=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),_n="http://www.w3.org/1998/Math/MathML",Mn="http://www.w3.org/2000/svg",Re="http://www.w3.org/1999/xhtml";let $t=Re,Wi=!1,Ki=null;const Lu=F({},[_n,Mn,Re],rs);let Pn=F({},["mi","mo","mn","ms","mtext"]),Ln=F({},["annotation-xml"]);const Iu=F({},["title","style","font","a","script"]);let qt=null;const Ru=["application/xhtml+xml","text/html"],Nu="text/html";let J=null,At=null;const Du=n.createElement("form"),er=function(w){return w instanceof RegExp||w instanceof Function},zi=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(At&&At===w)){if((!w||typeof w!="object")&&(w={}),w=Ce(w),qt=Ru.indexOf(w.PARSER_MEDIA_TYPE)===-1?Nu:w.PARSER_MEDIA_TYPE,J=qt==="application/xhtml+xml"?rs:Xn,Q=ye(w,"ALLOWED_TAGS")?F({},w.ALLOWED_TAGS,J):$n,Y=ye(w,"ALLOWED_ATTR")?F({},w.ALLOWED_ATTR,J):An,Ki=ye(w,"ALLOWED_NAMESPACES")?F({},w.ALLOWED_NAMESPACES,rs):Lu,Ui=ye(w,"ADD_URI_SAFE_ATTR")?F(Ce(Jo),w.ADD_URI_SAFE_ATTR,J):Jo,Xo=ye(w,"ADD_DATA_URI_TAGS")?F(Ce(Zo),w.ADD_DATA_URI_TAGS,J):Zo,xe=ye(w,"FORBID_CONTENTS")?F({},w.FORBID_CONTENTS,J):Fi,et=ye(w,"FORBID_TAGS")?F({},w.FORBID_TAGS,J):Ce({}),jt=ye(w,"FORBID_ATTR")?F({},w.FORBID_ATTR,J):Ce({}),xt=ye(w,"USE_PROFILES")?w.USE_PROFILES:!1,En=w.ALLOW_ARIA_ATTR!==!1,x=w.ALLOW_DATA_ATTR!==!1,_=w.ALLOW_UNKNOWN_PROTOCOLS||!1,N=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=w.SAFE_FOR_TEMPLATES||!1,V=w.SAFE_FOR_XML!==!1,z=w.WHOLE_DOCUMENT||!1,St=w.RETURN_DOM||!1,Cn=w.RETURN_DOM_FRAGMENT||!1,Tn=w.RETURN_TRUSTED_TYPE||!1,je=w.FORCE_BODY||!1,Qo=w.SANITIZE_DOM!==!1,Yo=w.SANITIZE_NAMED_PROPS||!1,Bi=w.KEEP_CONTENT!==!1,Ht=w.IN_PLACE||!1,xn=w.ALLOWED_URI_REGEXP||xc,$t=w.NAMESPACE||Re,Pn=w.MATHML_TEXT_INTEGRATION_POINTS||Pn,Ln=w.HTML_INTEGRATION_POINTS||Ln,H=w.CUSTOM_ELEMENT_HANDLING||{},w.CUSTOM_ELEMENT_HANDLING&&er(w.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=w.CUSTOM_ELEMENT_HANDLING.tagNameCheck),w.CUSTOM_ELEMENT_HANDLING&&er(w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),O&&(x=!1),Cn&&(St=!0),xt&&(Q=F({},ua),Y=[],xt.html===!0&&(F(Q,ca),F(Y,da)),xt.svg===!0&&(F(Q,ls),F(Y,ds),F(Y,Wn)),xt.svgFilters===!0&&(F(Q,cs),F(Y,ds),F(Y,Wn)),xt.mathMl===!0&&(F(Q,us),F(Y,pa),F(Y,Wn))),w.ADD_TAGS&&(typeof w.ADD_TAGS=="function"?ze.tagCheck=w.ADD_TAGS:(Q===$n&&(Q=Ce(Q)),F(Q,w.ADD_TAGS,J))),w.ADD_ATTR&&(typeof w.ADD_ATTR=="function"?ze.attributeCheck=w.ADD_ATTR:(Y===An&&(Y=Ce(Y)),F(Y,w.ADD_ATTR,J))),w.ADD_URI_SAFE_ATTR&&F(Ui,w.ADD_URI_SAFE_ATTR,J),w.FORBID_CONTENTS&&(xe===Fi&&(xe=Ce(xe)),F(xe,w.FORBID_CONTENTS,J)),w.ADD_FORBID_CONTENTS&&(xe===Fi&&(xe=Ce(xe)),F(xe,w.ADD_FORBID_CONTENTS,J)),Bi&&(Q["#text"]=!0),z&&F(Q,["html","head","body"]),Q.table&&(F(Q,["tbody"]),delete et.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=w.TRUSTED_TYPES_POLICY,M=T.createHTML("")}else T===void 0&&(T=Vf(v,s)),T!==null&&typeof M=="string"&&(M=T.createHTML(""));pe&&pe(w),At=w}},tr=F({},[...ls,...cs,...Df]),nr=F({},[...us,...Of]),Ou=function(w){let E=C(w);(!E||!E.tagName)&&(E={namespaceURI:$t,tagName:"template"});const L=Xn(w.tagName),j=Xn(E.tagName);return Ki[w.namespaceURI]?w.namespaceURI===Mn?E.namespaceURI===Re?L==="svg":E.namespaceURI===_n?L==="svg"&&(j==="annotation-xml"||Pn[j]):!!tr[L]:w.namespaceURI===_n?E.namespaceURI===Re?L==="math":E.namespaceURI===Mn?L==="math"&&Ln[j]:!!nr[L]:w.namespaceURI===Re?E.namespaceURI===Mn&&!Ln[j]||E.namespaceURI===_n&&!Pn[j]?!1:!nr[L]&&(Iu[L]||!tr[L]):!!(qt==="application/xhtml+xml"&&Ki[w.namespaceURI]):!1},$e=function(w){Qt(t.removed,{element:w});try{C(w).removeChild(w)}catch{S(w)}},tt=function(w,E){try{Qt(t.removed,{attribute:E.getAttributeNode(w),from:E})}catch{Qt(t.removed,{attribute:null,from:E})}if(E.removeAttribute(w),w==="is")if(St||Cn)try{$e(E)}catch{}else try{E.setAttribute(w,"")}catch{}},ir=function(w){let E=null,L=null;if(je)w="<remove></remove>"+w;else{const X=as(w,/^[\r\n\t ]+/);L=X&&X[0]}qt==="application/xhtml+xml"&&$t===Re&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const j=T?T.createHTML(w):w;if($t===Re)try{E=new h().parseFromString(j,qt)}catch{}if(!E||!E.documentElement){E=R.createDocument($t,"template",null);try{E.documentElement.innerHTML=Wi?M:j}catch{}}const se=E.body||E.documentElement;return w&&L&&se.insertBefore(n.createTextNode(L),se.childNodes[0]||null),$t===Re?me.call(E,z?"html":"body")[0]:z?E.documentElement:se},sr=function(w){return B.call(w.ownerDocument||w,w,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ji=function(w){return w instanceof d&&(typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||!(w.attributes instanceof l)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function")},or=function(w){return typeof a=="function"&&w instanceof a};function Ne(I,w,E){Un(I,L=>{L.call(t,w,E,At)})}const rr=function(w){let E=null;if(Ne(Z.beforeSanitizeElements,w,null),ji(w))return $e(w),!0;const L=J(w.nodeName);if(Ne(Z.uponSanitizeElement,w,{tagName:L,allowedTags:Q}),V&&w.hasChildNodes()&&!or(w.firstElementChild)&&le(/<[/\w!]/g,w.innerHTML)&&le(/<[/\w!]/g,w.textContent)||w.nodeType===Jt.progressingInstruction||V&&w.nodeType===Jt.comment&&le(/<[/\w]/g,w.data))return $e(w),!0;if(!(ze.tagCheck instanceof Function&&ze.tagCheck(L))&&(!Q[L]||et[L])){if(!et[L]&&lr(L)&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L)))return!1;if(Bi&&!xe[L]){const j=C(w)||w.parentNode,se=A(w)||w.childNodes;if(se&&j){const X=se.length;for(let fe=X-1;fe>=0;--fe){const De=b(se[fe],!0);De.__removalCount=(w.__removalCount||0)+1,j.insertBefore(De,$(w))}}}return $e(w),!0}return w instanceof u&&!Ou(w)||(L==="noscript"||L==="noembed"||L==="noframes")&&le(/<\/no(script|embed|frames)/i,w.innerHTML)?($e(w),!0):(O&&w.nodeType===Jt.text&&(E=w.textContent,Un([zt,kt,Je],j=>{E=Yt(E,j," ")}),w.textContent!==E&&(Qt(t.removed,{element:w.cloneNode()}),w.textContent=E)),Ne(Z.afterSanitizeElements,w,null),!1)},ar=function(w,E,L){if(Qo&&(E==="id"||E==="name")&&(L in n||L in Du))return!1;if(!(x&&!jt[E]&&le(Ri,E))){if(!(En&&le(Ni,E))){if(!(ze.attributeCheck instanceof Function&&ze.attributeCheck(E,w))){if(!Y[E]||jt[E]){if(!(lr(w)&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,w)||H.tagNameCheck instanceof Function&&H.tagNameCheck(w))&&(H.attributeNameCheck instanceof RegExp&&le(H.attributeNameCheck,E)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(E,w))||E==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L))))return!1}else if(!Ui[E]){if(!le(xn,Yt(L,Sn,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&w!=="script"&&Lf(L,"data:")===0&&Xo[w])){if(!(_&&!le(Di,Yt(L,Sn,"")))){if(L)return!1}}}}}}}return!0},lr=function(w){return w!=="annotation-xml"&&as(w,Oi)},cr=function(w){Ne(Z.beforeSanitizeAttributes,w,null);const{attributes:E}=w;if(!E||ji(w))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let j=E.length;for(;j--;){const se=E[j],{name:X,namespaceURI:fe,value:De}=se,Et=J(X),Hi=De;let ne=X==="value"?Hi:If(Hi);if(L.attrName=Et,L.attrValue=ne,L.keepAttr=!0,L.forceKeepAttr=void 0,Ne(Z.uponSanitizeAttribute,w,L),ne=L.attrValue,Yo&&(Et==="id"||Et==="name")&&(tt(X,w),ne=Pu+ne),V&&le(/((--!?|])>)|<\/(style|title|textarea)/i,ne)){tt(X,w);continue}if(Et==="attributename"&&as(ne,"href")){tt(X,w);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){tt(X,w);continue}if(!N&&le(/\/>/i,ne)){tt(X,w);continue}O&&Un([zt,kt,Je],dr=>{ne=Yt(ne,dr," ")});const ur=J(w.nodeName);if(!ar(ur,Et,ne)){tt(X,w);continue}if(T&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!fe)switch(v.getAttributeType(ur,Et)){case"TrustedHTML":{ne=T.createHTML(ne);break}case"TrustedScriptURL":{ne=T.createScriptURL(ne);break}}if(ne!==Hi)try{fe?w.setAttributeNS(fe,X,ne):w.setAttribute(X,ne),ji(w)?$e(w):la(t.removed)}catch{tt(X,w)}}Ne(Z.afterSanitizeAttributes,w,null)},Bu=function I(w){let E=null;const L=sr(w);for(Ne(Z.beforeSanitizeShadowDOM,w,null);E=L.nextNode();)Ne(Z.uponSanitizeShadowNode,E,null),rr(E),cr(E),E.content instanceof o&&I(E.content);Ne(Z.afterSanitizeShadowDOM,w,null)};return t.sanitize=function(I){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,L=null,j=null,se=null;if(Wi=!I,Wi&&(I="<!-->"),typeof I!="string"&&!or(I))if(typeof I.toString=="function"){if(I=I.toString(),typeof I!="string")throw Xt("dirty is not a string, aborting")}else throw Xt("toString is not a function");if(!t.isSupported)return I;if(ae||zi(w),t.removed=[],typeof I=="string"&&(Ht=!1),Ht){if(I.nodeName){const De=J(I.nodeName);if(!Q[De]||et[De])throw Xt("root node is forbidden and cannot be sanitized in-place")}}else if(I instanceof a)E=ir("<!---->"),L=E.ownerDocument.importNode(I,!0),L.nodeType===Jt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?E=L:E.appendChild(L);else{if(!St&&!O&&!z&&I.indexOf("<")===-1)return T&&Tn?T.createHTML(I):I;if(E=ir(I),!E)return St?null:Tn?M:""}E&&je&&$e(E.firstChild);const X=sr(Ht?I:E);for(;j=X.nextNode();)rr(j),cr(j),j.content instanceof o&&Bu(j.content);if(Ht)return I;if(St){if(Cn)for(se=ee.call(E.ownerDocument);E.firstChild;)se.appendChild(E.firstChild);else se=E;return(Y.shadowroot||Y.shadowrootmode)&&(se=Ke.call(i,se,!0)),se}let fe=z?E.outerHTML:E.innerHTML;return z&&Q["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&le($c,E.ownerDocument.doctype.name)&&(fe="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
2073
+ `}const bc={CHILD:2},wc=e=>(...t)=>({_$litDirective$:e,values:t});let kc=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,i){this._$Ct=t,this._$AM=n,this._$Ci=i}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const{I:Sf}=ld,sa=e=>e,oa=()=>document.createComment(""),Gt=(e,t,n)=>{var o;const i=e._$AA.parentNode,s=t===void 0?e._$AB:t._$AA;if(n===void 0){const r=i.insertBefore(oa(),s),a=i.insertBefore(oa(),s);n=new Sf(r,a,e,e.options)}else{const r=n._$AB.nextSibling,a=n._$AM,u=a!==e;if(u){let c;(o=n._$AQ)==null||o.call(n,e),n._$AM=e,n._$AP!==void 0&&(c=e._$AU)!==a._$AU&&n._$AP(c)}if(r!==s||u){let c=n._$AA;for(;c!==r;){const l=sa(c).nextSibling;sa(i).insertBefore(c,s),c=l}}}return n},st=(e,t,n=e)=>(e._$AI(t,n),e),xf={},$f=(e,t=xf)=>e._$AH=t,Af=e=>e._$AH,os=e=>{e._$AR(),e._$AA.remove()};const ra=(e,t,n)=>{const i=new Map;for(let s=t;s<=n;s++)i.set(e[s],s);return i},Ef=wc(class extends kc{constructor(e){if(super(e),e.type!==bc.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;n===void 0?n=t:t!==void 0&&(i=t);const s=[],o=[];let r=0;for(const a of e)s[r]=i?i(a,r):r,o[r]=n(a,r),r++;return{values:o,keys:s}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const s=Af(e),{values:o,keys:r}=this.dt(t,n,i);if(!Array.isArray(s))return this.ut=r,o;const a=this.ut??(this.ut=[]),u=[];let c,l,d=0,h=s.length-1,v=0,f=o.length-1;for(;d<=h&&v<=f;)if(s[d]===null)d++;else if(s[h]===null)h--;else if(a[d]===r[v])u[v]=st(s[d],o[v]),d++,v++;else if(a[h]===r[f])u[f]=st(s[h],o[f]),h--,f--;else if(a[d]===r[f])u[f]=st(s[d],o[f]),Gt(e,u[f+1],s[d]),d++,f--;else if(a[h]===r[v])u[v]=st(s[h],o[v]),Gt(e,s[d],s[h]),h--,v++;else if(c===void 0&&(c=ra(r,v,f),l=ra(a,d,h)),c.has(a[d]))if(c.has(a[h])){const b=l.get(r[v]),S=b!==void 0?s[b]:null;if(S===null){const $=Gt(e,s[d]);st($,o[v]),u[v]=$}else u[v]=st(S,o[v]),Gt(e,s[d],S),s[b]=null;v++}else os(s[h]),h--;else os(s[d]),d++;for(;v<=f;){const b=Gt(e,u[f+1]);st(b,o[v]),u[v++]=b}for(;d<=h;){const b=s[d++];b!==null&&os(b)}return this.ut=r,$f(e,u),Qe}});class Os extends kc{constructor(t){if(super(t),this.it=k,t.type!==bc.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===Qe)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}}Os.directiveName="unsafeHTML",Os.resultType=1;const di=wc(Os);const{entries:Sc,setPrototypeOf:aa,isFrozen:Cf,getPrototypeOf:Tf,getOwnPropertyDescriptor:_f}=Object;let{freeze:pe,seal:ge,create:Bs}=Object,{apply:Fs,construct:Us}=typeof Reflect<"u"&&Reflect;pe||(pe=function(t){return t});ge||(ge=function(t){return t});Fs||(Fs=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(n,s)});Us||(Us=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const Un=he(Array.prototype.forEach),Mf=he(Array.prototype.lastIndexOf),la=he(Array.prototype.pop),Qt=he(Array.prototype.push),Pf=he(Array.prototype.splice),Xn=he(String.prototype.toLowerCase),rs=he(String.prototype.toString),as=he(String.prototype.match),Yt=he(String.prototype.replace),Lf=he(String.prototype.indexOf),If=he(String.prototype.trim),ye=he(Object.prototype.hasOwnProperty),le=he(RegExp.prototype.test),Xt=Rf(TypeError);function he(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return Fs(e,t,i)}}function Rf(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Us(e,n)}}function F(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Xn;aa&&aa(e,null);let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(Cf(t)||(t[i]=o),s=o)}e[s]=!0}return e}function Nf(e){for(let t=0;t<e.length;t++)ye(e,t)||(e[t]=null);return e}function Ce(e){const t=Bs(null);for(const[n,i]of Sc(e))ye(e,n)&&(Array.isArray(i)?t[n]=Nf(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ce(i):t[n]=i);return t}function Zt(e,t){for(;e!==null;){const i=_f(e,t);if(i){if(i.get)return he(i.get);if(typeof i.value=="function")return he(i.value)}e=Tf(e)}function n(){return null}return n}const ca=pe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ls=pe(["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"]),cs=pe(["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"]),Df=pe(["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"]),us=pe(["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=pe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ua=pe(["#text"]),da=pe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ds=pe(["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"]),pa=pe(["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"]),Wn=pe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Bf=ge(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ff=ge(/<%[\w\W]*|[\w\W]*%>/gm),Uf=ge(/\$\{[\w\W]*/gm),Wf=ge(/^data-[\-\w.\u00B7-\uFFFF]+$/),Kf=ge(/^aria-[\-\w]+$/),xc=ge(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zf=ge(/^(?:\w+script|data):/i),jf=ge(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$c=ge(/^html$/i),Hf=ge(/^[a-z][.\w]*(-[.\w]+)+$/i);var ha=Object.freeze({__proto__:null,ARIA_ATTR:Kf,ATTR_WHITESPACE:jf,CUSTOM_ELEMENT:Hf,DATA_ATTR:Wf,DOCTYPE_NAME:$c,ERB_EXPR:Ff,IS_ALLOWED_URI:xc,IS_SCRIPT_OR_DATA:zf,MUSTACHE_EXPR:Bf,TMPLIT_EXPR:Uf});const Jt={element:1,text:3,progressingInstruction:7,comment:8,document:9},qf=function(){return typeof window>"u"?null:window},Vf=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},fa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ac(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qf();const t=I=>Ac(I);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Jt.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:r,Node:a,Element:u,NodeFilter:c,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:v}=e,f=u.prototype,b=Zt(f,"cloneNode"),S=Zt(f,"remove"),$=Zt(f,"nextSibling"),A=Zt(f,"childNodes"),C=Zt(f,"parentNode");if(typeof r=="function"){const I=n.createElement("template");I.content&&I.content.ownerDocument&&(n=I.content.ownerDocument)}let T,M="";const{implementation:R,createNodeIterator:B,createDocumentFragment:ee,getElementsByTagName:me}=n,{importNode:Ke}=i;let Z=fa();t.isSupported=typeof Sc=="function"&&typeof C=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:zt,ERB_EXPR:kt,TMPLIT_EXPR:Je,DATA_ATTR:Ri,ARIA_ATTR:Ni,IS_SCRIPT_OR_DATA:Di,ATTR_WHITESPACE:Sn,CUSTOM_ELEMENT:Oi}=ha;let{IS_ALLOWED_URI:xn}=ha,Q=null;const $n=F({},[...ca,...ls,...cs,...us,...ua]);let Y=null;const An=F({},[...da,...ds,...pa,...Wn]);let H=Object.seal(Bs(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}})),et=null,jt=null;const ze=Object.seal(Bs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let En=!0,x=!0,_=!1,D=!0,O=!1,V=!0,z=!1,ae=!1,je=!1,St=!1,Cn=!1,Tn=!1,Qo=!0,Yo=!1;const Pu="user-content-";let Bi=!0,Ht=!1,xt={},xe=null;const Fi=F({},["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 Xo=null;const Zo=F({},["audio","video","img","source","image","track"]);let Ui=null;const Jo=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),_n="http://www.w3.org/1998/Math/MathML",Mn="http://www.w3.org/2000/svg",Re="http://www.w3.org/1999/xhtml";let $t=Re,Wi=!1,Ki=null;const Lu=F({},[_n,Mn,Re],rs);let Pn=F({},["mi","mo","mn","ms","mtext"]),Ln=F({},["annotation-xml"]);const Iu=F({},["title","style","font","a","script"]);let qt=null;const Ru=["application/xhtml+xml","text/html"],Nu="text/html";let J=null,At=null;const Du=n.createElement("form"),er=function(w){return w instanceof RegExp||w instanceof Function},zi=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(At&&At===w)){if((!w||typeof w!="object")&&(w={}),w=Ce(w),qt=Ru.indexOf(w.PARSER_MEDIA_TYPE)===-1?Nu:w.PARSER_MEDIA_TYPE,J=qt==="application/xhtml+xml"?rs:Xn,Q=ye(w,"ALLOWED_TAGS")?F({},w.ALLOWED_TAGS,J):$n,Y=ye(w,"ALLOWED_ATTR")?F({},w.ALLOWED_ATTR,J):An,Ki=ye(w,"ALLOWED_NAMESPACES")?F({},w.ALLOWED_NAMESPACES,rs):Lu,Ui=ye(w,"ADD_URI_SAFE_ATTR")?F(Ce(Jo),w.ADD_URI_SAFE_ATTR,J):Jo,Xo=ye(w,"ADD_DATA_URI_TAGS")?F(Ce(Zo),w.ADD_DATA_URI_TAGS,J):Zo,xe=ye(w,"FORBID_CONTENTS")?F({},w.FORBID_CONTENTS,J):Fi,et=ye(w,"FORBID_TAGS")?F({},w.FORBID_TAGS,J):Ce({}),jt=ye(w,"FORBID_ATTR")?F({},w.FORBID_ATTR,J):Ce({}),xt=ye(w,"USE_PROFILES")?w.USE_PROFILES:!1,En=w.ALLOW_ARIA_ATTR!==!1,x=w.ALLOW_DATA_ATTR!==!1,_=w.ALLOW_UNKNOWN_PROTOCOLS||!1,D=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=w.SAFE_FOR_TEMPLATES||!1,V=w.SAFE_FOR_XML!==!1,z=w.WHOLE_DOCUMENT||!1,St=w.RETURN_DOM||!1,Cn=w.RETURN_DOM_FRAGMENT||!1,Tn=w.RETURN_TRUSTED_TYPE||!1,je=w.FORCE_BODY||!1,Qo=w.SANITIZE_DOM!==!1,Yo=w.SANITIZE_NAMED_PROPS||!1,Bi=w.KEEP_CONTENT!==!1,Ht=w.IN_PLACE||!1,xn=w.ALLOWED_URI_REGEXP||xc,$t=w.NAMESPACE||Re,Pn=w.MATHML_TEXT_INTEGRATION_POINTS||Pn,Ln=w.HTML_INTEGRATION_POINTS||Ln,H=w.CUSTOM_ELEMENT_HANDLING||{},w.CUSTOM_ELEMENT_HANDLING&&er(w.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=w.CUSTOM_ELEMENT_HANDLING.tagNameCheck),w.CUSTOM_ELEMENT_HANDLING&&er(w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),O&&(x=!1),Cn&&(St=!0),xt&&(Q=F({},ua),Y=[],xt.html===!0&&(F(Q,ca),F(Y,da)),xt.svg===!0&&(F(Q,ls),F(Y,ds),F(Y,Wn)),xt.svgFilters===!0&&(F(Q,cs),F(Y,ds),F(Y,Wn)),xt.mathMl===!0&&(F(Q,us),F(Y,pa),F(Y,Wn))),w.ADD_TAGS&&(typeof w.ADD_TAGS=="function"?ze.tagCheck=w.ADD_TAGS:(Q===$n&&(Q=Ce(Q)),F(Q,w.ADD_TAGS,J))),w.ADD_ATTR&&(typeof w.ADD_ATTR=="function"?ze.attributeCheck=w.ADD_ATTR:(Y===An&&(Y=Ce(Y)),F(Y,w.ADD_ATTR,J))),w.ADD_URI_SAFE_ATTR&&F(Ui,w.ADD_URI_SAFE_ATTR,J),w.FORBID_CONTENTS&&(xe===Fi&&(xe=Ce(xe)),F(xe,w.FORBID_CONTENTS,J)),w.ADD_FORBID_CONTENTS&&(xe===Fi&&(xe=Ce(xe)),F(xe,w.ADD_FORBID_CONTENTS,J)),Bi&&(Q["#text"]=!0),z&&F(Q,["html","head","body"]),Q.table&&(F(Q,["tbody"]),delete et.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw Xt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Xt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=w.TRUSTED_TYPES_POLICY,M=T.createHTML("")}else T===void 0&&(T=Vf(v,s)),T!==null&&typeof M=="string"&&(M=T.createHTML(""));pe&&pe(w),At=w}},tr=F({},[...ls,...cs,...Df]),nr=F({},[...us,...Of]),Ou=function(w){let E=C(w);(!E||!E.tagName)&&(E={namespaceURI:$t,tagName:"template"});const L=Xn(w.tagName),j=Xn(E.tagName);return Ki[w.namespaceURI]?w.namespaceURI===Mn?E.namespaceURI===Re?L==="svg":E.namespaceURI===_n?L==="svg"&&(j==="annotation-xml"||Pn[j]):!!tr[L]:w.namespaceURI===_n?E.namespaceURI===Re?L==="math":E.namespaceURI===Mn?L==="math"&&Ln[j]:!!nr[L]:w.namespaceURI===Re?E.namespaceURI===Mn&&!Ln[j]||E.namespaceURI===_n&&!Pn[j]?!1:!nr[L]&&(Iu[L]||!tr[L]):!!(qt==="application/xhtml+xml"&&Ki[w.namespaceURI]):!1},$e=function(w){Qt(t.removed,{element:w});try{C(w).removeChild(w)}catch{S(w)}},tt=function(w,E){try{Qt(t.removed,{attribute:E.getAttributeNode(w),from:E})}catch{Qt(t.removed,{attribute:null,from:E})}if(E.removeAttribute(w),w==="is")if(St||Cn)try{$e(E)}catch{}else try{E.setAttribute(w,"")}catch{}},ir=function(w){let E=null,L=null;if(je)w="<remove></remove>"+w;else{const X=as(w,/^[\r\n\t ]+/);L=X&&X[0]}qt==="application/xhtml+xml"&&$t===Re&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const j=T?T.createHTML(w):w;if($t===Re)try{E=new h().parseFromString(j,qt)}catch{}if(!E||!E.documentElement){E=R.createDocument($t,"template",null);try{E.documentElement.innerHTML=Wi?M:j}catch{}}const se=E.body||E.documentElement;return w&&L&&se.insertBefore(n.createTextNode(L),se.childNodes[0]||null),$t===Re?me.call(E,z?"html":"body")[0]:z?E.documentElement:se},sr=function(w){return B.call(w.ownerDocument||w,w,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ji=function(w){return w instanceof d&&(typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||!(w.attributes instanceof l)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function")},or=function(w){return typeof a=="function"&&w instanceof a};function Ne(I,w,E){Un(I,L=>{L.call(t,w,E,At)})}const rr=function(w){let E=null;if(Ne(Z.beforeSanitizeElements,w,null),ji(w))return $e(w),!0;const L=J(w.nodeName);if(Ne(Z.uponSanitizeElement,w,{tagName:L,allowedTags:Q}),V&&w.hasChildNodes()&&!or(w.firstElementChild)&&le(/<[/\w!]/g,w.innerHTML)&&le(/<[/\w!]/g,w.textContent)||w.nodeType===Jt.progressingInstruction||V&&w.nodeType===Jt.comment&&le(/<[/\w]/g,w.data))return $e(w),!0;if(!(ze.tagCheck instanceof Function&&ze.tagCheck(L))&&(!Q[L]||et[L])){if(!et[L]&&lr(L)&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L)))return!1;if(Bi&&!xe[L]){const j=C(w)||w.parentNode,se=A(w)||w.childNodes;if(se&&j){const X=se.length;for(let fe=X-1;fe>=0;--fe){const De=b(se[fe],!0);De.__removalCount=(w.__removalCount||0)+1,j.insertBefore(De,$(w))}}}return $e(w),!0}return w instanceof u&&!Ou(w)||(L==="noscript"||L==="noembed"||L==="noframes")&&le(/<\/no(script|embed|frames)/i,w.innerHTML)?($e(w),!0):(O&&w.nodeType===Jt.text&&(E=w.textContent,Un([zt,kt,Je],j=>{E=Yt(E,j," ")}),w.textContent!==E&&(Qt(t.removed,{element:w.cloneNode()}),w.textContent=E)),Ne(Z.afterSanitizeElements,w,null),!1)},ar=function(w,E,L){if(Qo&&(E==="id"||E==="name")&&(L in n||L in Du))return!1;if(!(x&&!jt[E]&&le(Ri,E))){if(!(En&&le(Ni,E))){if(!(ze.attributeCheck instanceof Function&&ze.attributeCheck(E,w))){if(!Y[E]||jt[E]){if(!(lr(w)&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,w)||H.tagNameCheck instanceof Function&&H.tagNameCheck(w))&&(H.attributeNameCheck instanceof RegExp&&le(H.attributeNameCheck,E)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(E,w))||E==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&le(H.tagNameCheck,L)||H.tagNameCheck instanceof Function&&H.tagNameCheck(L))))return!1}else if(!Ui[E]){if(!le(xn,Yt(L,Sn,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&w!=="script"&&Lf(L,"data:")===0&&Xo[w])){if(!(_&&!le(Di,Yt(L,Sn,"")))){if(L)return!1}}}}}}}return!0},lr=function(w){return w!=="annotation-xml"&&as(w,Oi)},cr=function(w){Ne(Z.beforeSanitizeAttributes,w,null);const{attributes:E}=w;if(!E||ji(w))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let j=E.length;for(;j--;){const se=E[j],{name:X,namespaceURI:fe,value:De}=se,Et=J(X),Hi=De;let ne=X==="value"?Hi:If(Hi);if(L.attrName=Et,L.attrValue=ne,L.keepAttr=!0,L.forceKeepAttr=void 0,Ne(Z.uponSanitizeAttribute,w,L),ne=L.attrValue,Yo&&(Et==="id"||Et==="name")&&(tt(X,w),ne=Pu+ne),V&&le(/((--!?|])>)|<\/(style|title|textarea)/i,ne)){tt(X,w);continue}if(Et==="attributename"&&as(ne,"href")){tt(X,w);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){tt(X,w);continue}if(!D&&le(/\/>/i,ne)){tt(X,w);continue}O&&Un([zt,kt,Je],dr=>{ne=Yt(ne,dr," ")});const ur=J(w.nodeName);if(!ar(ur,Et,ne)){tt(X,w);continue}if(T&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!fe)switch(v.getAttributeType(ur,Et)){case"TrustedHTML":{ne=T.createHTML(ne);break}case"TrustedScriptURL":{ne=T.createScriptURL(ne);break}}if(ne!==Hi)try{fe?w.setAttributeNS(fe,X,ne):w.setAttribute(X,ne),ji(w)?$e(w):la(t.removed)}catch{tt(X,w)}}Ne(Z.afterSanitizeAttributes,w,null)},Bu=function I(w){let E=null;const L=sr(w);for(Ne(Z.beforeSanitizeShadowDOM,w,null);E=L.nextNode();)Ne(Z.uponSanitizeShadowNode,E,null),rr(E),cr(E),E.content instanceof o&&I(E.content);Ne(Z.afterSanitizeShadowDOM,w,null)};return t.sanitize=function(I){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,L=null,j=null,se=null;if(Wi=!I,Wi&&(I="<!-->"),typeof I!="string"&&!or(I))if(typeof I.toString=="function"){if(I=I.toString(),typeof I!="string")throw Xt("dirty is not a string, aborting")}else throw Xt("toString is not a function");if(!t.isSupported)return I;if(ae||zi(w),t.removed=[],typeof I=="string"&&(Ht=!1),Ht){if(I.nodeName){const De=J(I.nodeName);if(!Q[De]||et[De])throw Xt("root node is forbidden and cannot be sanitized in-place")}}else if(I instanceof a)E=ir("<!---->"),L=E.ownerDocument.importNode(I,!0),L.nodeType===Jt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?E=L:E.appendChild(L);else{if(!St&&!O&&!z&&I.indexOf("<")===-1)return T&&Tn?T.createHTML(I):I;if(E=ir(I),!E)return St?null:Tn?M:""}E&&je&&$e(E.firstChild);const X=sr(Ht?I:E);for(;j=X.nextNode();)rr(j),cr(j),j.content instanceof o&&Bu(j.content);if(Ht)return I;if(St){if(Cn)for(se=ee.call(E.ownerDocument);E.firstChild;)se.appendChild(E.firstChild);else se=E;return(Y.shadowroot||Y.shadowrootmode)&&(se=Ke.call(i,se,!0)),se}let fe=z?E.outerHTML:E.innerHTML;return z&&Q["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&le($c,E.ownerDocument.doctype.name)&&(fe="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
2077
2074
  `+fe),O&&Un([zt,kt,Je],De=>{fe=Yt(fe,De," ")}),T&&Tn?T.createHTML(fe):fe},t.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};zi(I),ae=!0},t.clearConfig=function(){At=null,ae=!1},t.isValidAttribute=function(I,w,E){At||zi({});const L=J(I),j=J(w);return ar(L,j,E)},t.addHook=function(I,w){typeof w=="function"&&Qt(Z[I],w)},t.removeHook=function(I,w){if(w!==void 0){const E=Mf(Z[I],w);return E===-1?void 0:Pf(Z[I],E,1)[0]}return la(Z[I])},t.removeHooks=function(I){Z[I]=[]},t.removeAllHooks=function(){Z=fa()},t}var Ws=Ac();function Po(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var bt=Po();function Ec(e){bt=e}var dn={exec:()=>null};function W(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(s,o)=>{let r=typeof o=="string"?o:o.source;return r=r.replace(ue.caret,"$1"),n=n.replace(s,r),i},getRegex:()=>new RegExp(n,t)};return i}var Gf=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ue={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")},Qf=/^(?:[ \t]*(?:\n|$))+/,Yf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Xf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Zf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Lo=/(?:[*+-]|\d{1,9}[.)])/,Cc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Tc=W(Cc).replace(/bull/g,Lo).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(),Jf=W(Cc).replace(/bull/g,Lo).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(),Io=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,eg=/^[^\n]+/,Ro=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,tg=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ro).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ng=W(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Lo).getRegex(),Mi="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",No=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ig=W("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",No).replace("tag",Mi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_c=W(Io).replace("hr",wn).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",Mi).getRegex(),sg=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_c).getRegex(),Do={blockquote:sg,code:Yf,def:tg,fences:Xf,heading:Zf,hr:wn,html:ig,lheading:Tc,list:ng,newline:Qf,paragraph:_c,table:dn,text:eg},ga=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",wn).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",Mi).getRegex(),og={...Do,lheading:Jf,table:ga,paragraph:W(Io).replace("hr",wn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ga).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",Mi).getRegex()},rg={...Do,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",No).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:dn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Io).replace("hr",wn).replace("heading",` *#{1,6} *[^
2078
2075
  ]`).replace("lheading",Tc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ag=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Mc=/^( {2,}|\\)\n(?!\s*$)/,cg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pi=/[\p{P}\p{S}]/u,Oo=/[\s\p{P}\p{S}]/u,Pc=/[^\s\p{P}\p{S}]/u,ug=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Oo).getRegex(),Lc=/(?!~)[\p{P}\p{S}]/u,dg=/(?!~)[\s\p{P}\p{S}]/u,pg=/(?:[^\s\p{P}\p{S}]|~)/u,hg=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Gf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ic=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,fg=W(Ic,"u").replace(/punct/g,Pi).getRegex(),gg=W(Ic,"u").replace(/punct/g,Lc).getRegex(),Rc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",mg=W(Rc,"gu").replace(/notPunctSpace/g,Pc).replace(/punctSpace/g,Oo).replace(/punct/g,Pi).getRegex(),yg=W(Rc,"gu").replace(/notPunctSpace/g,pg).replace(/punctSpace/g,dg).replace(/punct/g,Lc).getRegex(),vg=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Pc).replace(/punctSpace/g,Oo).replace(/punct/g,Pi).getRegex(),bg=W(/\\(punct)/,"gu").replace(/punct/g,Pi).getRegex(),wg=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kg=W(No).replace("(?:-->|$)","-->").getRegex(),Sg=W("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",kg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pi=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,xg=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",pi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Nc=W(/^!?\[(label)\]\[(ref)\]/).replace("label",pi).replace("ref",Ro).getRegex(),Dc=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ro).getRegex(),$g=W("reflink|nolink(?!\\()","g").replace("reflink",Nc).replace("nolink",Dc).getRegex(),ma=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bo={_backpedal:dn,anyPunctuation:bg,autolink:wg,blockSkip:hg,br:Mc,code:lg,del:dn,emStrongLDelim:fg,emStrongRDelimAst:mg,emStrongRDelimUnd:vg,escape:ag,link:xg,nolink:Dc,punctuation:ug,reflink:Nc,reflinkSearch:$g,tag:Sg,text:cg,url:dn},Ag={...Bo,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",pi).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pi).getRegex()},Ks={...Bo,emStrongRDelimAst:yg,emStrongLDelim:gg,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ma).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ma).getRegex()},Eg={...Ks,br:W(Mc).replace("{2,}","*").getRegex(),text:W(Ks.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Kn={normal:Do,gfm:og,pedantic:rg},en={normal:Bo,gfm:Ks,breaks:Eg,pedantic:Ag},Cg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ya=e=>Cg[e];function Be(e,t){if(t){if(ue.escapeTest.test(e))return e.replace(ue.escapeReplace,ya)}else if(ue.escapeTestNoEncode.test(e))return e.replace(ue.escapeReplaceNoEncode,ya);return e}function va(e){try{e=encodeURI(e).replace(ue.percentDecode,"%")}catch{return null}return e}function ba(e,t){var o;let n=e.replace(ue.findPipe,(r,a,u)=>{let c=!1,l=a;for(;--l>=0&&u[l]==="\\";)c=!c;return c?"|":" |"}),i=n.split(ue.splitPipe),s=0;if(i[0].trim()||i.shift(),i.length>0&&!((o=i.at(-1))!=null&&o.trim())&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(ue.slashPipe,"|");return i}function tn(e,t,n){let i=e.length;if(i===0)return"";let s=0;for(;s<i&&e.charAt(i-s-1)===t;)s++;return e.slice(0,i-s)}function Tg(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}function wa(e,t,n,i,s){let o=t.href,r=t.title||null,a=e[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,u}function _g(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let s=i[1];return t.split(`
2079
2076
  `).map(o=>{let r=o.match(n.other.beginningSpace);if(r===null)return o;let[a]=r;return a.length>=s.length?o.slice(s.length):o}).join(`
@@ -2143,8 +2140,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
2143
2140
  @click=${async n=>{const i=n.currentTarget;if(i==null||i.querySelector(".chat-copy-btn__icon"),!i||i.dataset.copying==="1")return;i.dataset.copying="1",i.setAttribute("aria-busy","true"),i.disabled=!0;const s=await Wg(e.text());if(i.isConnected){if(delete i.dataset.copying,i.removeAttribute("aria-busy"),i.disabled=!1,!s){i.dataset.error="1",zn(i,Ug),window.setTimeout(()=>{i.isConnected&&(delete i.dataset.error,zn(i,t))},Bg);return}i.dataset.copied="1",zn(i,Fg),window.setTimeout(()=>{i.isConnected&&(delete i.dataset.copied,zn(i,t))},Og)}}}
2144
2141
  >
2145
2142
  <span class="chat-copy-btn__icon" aria-hidden="true">
2146
- <span class="chat-copy-btn__icon-copy">${D.copy}</span>
2147
- <span class="chat-copy-btn__icon-check">${D.check}</span>
2143
+ <span class="chat-copy-btn__icon-copy">${N.copy}</span>
2144
+ <span class="chat-copy-btn__icon-check">${N.check}</span>
2148
2145
  </span>
2149
2146
  </button>
2150
2147
  `}function zg(e){return Kg({text:()=>e,label:Oc})}function jg(e){const t=e,n=Hg(t.content),i=[];for(const s of n){const o=String(s.type??"").toLowerCase();(["toolcall","tool_call","tooluse","tool_use"].includes(o)||typeof s.name=="string"&&s.arguments!=null)&&i.push({kind:"call",name:s.name??"tool",args:qg(s.arguments??s.args)})}for(const s of n){const o=String(s.type??"").toLowerCase();if(o!=="toolresult"&&o!=="tool_result")continue;const r=Vg(s),a=typeof s.name=="string"?s.name:"tool";i.push({kind:"result",name:a,text:r})}if(wl(e)&&!i.some(s=>s.kind==="result")){const s=typeof t.toolName=="string"&&t.toolName||typeof t.tool_name=="string"&&t.tool_name||"tool",o=ml(e)??void 0;i.push({kind:"result",name:s,text:o})}return i}function Hg(e){return Array.isArray(e)?e.filter(Boolean):[]}function qg(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 Vg(e){if(typeof e.text=="string")return e.text;if(typeof e.content=="string")return e.content}function Gg(e){var s;const n=e.content,i=[];if(Array.isArray(n))for(const o of n){if(typeof o!="object"||o===null)continue;const r=o;if(r.type==="image")if(((s=r.source)==null?void 0:s.type)==="base64"){const a=r.source,u=a.data,c=a.media_type||"image/png",l=u.startsWith("data:")?u:`data:${c};base64,${u}`;i.push({url:l})}else if(typeof r.data=="string"&&r.data){const a=r.data,u=r.mimeType||r.media_type||"image/png",c=a.startsWith("data:")?a:`data:${u};base64,${a}`;i.push({url:c})}else typeof r.url=="string"&&i.push({url:r.url});else if(r.type==="image_url"){const a=r.image_url;typeof(a==null?void 0:a.url)=="string"&&i.push({url:a.url})}}return i}function Qg(e){return p`
@@ -2203,7 +2200,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
2203
2200
  <div class="sidebar-header">
2204
2201
  <div class="sidebar-title">Tool Output</div>
2205
2202
  <button @click=${e.onClose} class="btn" title="Close sidebar">
2206
- ${D.x}
2203
+ ${N.x}
2207
2204
  </button>
2208
2205
  </div>
2209
2206
  <div class="sidebar-content">
@@ -2244,22 +2241,22 @@ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error
2244
2241
  `;Li([xi({type:Number})],Nt.prototype,"splitRatio",2);Li([xi({type:Number})],Nt.prototype,"minRatio",2);Li([xi({type:Number})],Nt.prototype,"maxRatio",2);Nt=Li([ul("resizable-divider")],Nt);function jn(e){if(typeof e!="string"||!e)throw new Error("expected a non-empty string, got: "+e)}function hs(e){if(typeof e!="number")throw new Error("expected a number, got: "+e)}const im=1,sm=1,wt="emoji",Dt="keyvalue",Uo="favorites",om="tokens",Fc="tokens",rm="unicode",Uc="count",am="group",lm="order",Wc="group-order",Hs="eTag",mi="url",Aa="skinTone",Kt="readonly",Wo="readwrite",Kc="skinUnicodes",cm="skinUnicodes",um="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",dm="en";function pm(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function Ea(e){return pm(e,t=>t.unicode)}function hm(e){function t(n,i,s){const o=i?e.createObjectStore(n,{keyPath:i}):e.createObjectStore(n);if(s)for(const[r,[a,u]]of Object.entries(s))o.createIndex(r,a,{multiEntry:u});return o}t(Dt),t(wt,rm,{[Fc]:[om,!0],[Wc]:[[am,lm]],[Kc]:[cm,!0]}),t(Uo,void 0,{[Uc]:[""]})}const qs={},Zn={},yi={};function zc(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(new Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function fm(e){const t=await new Promise((n,i)=>{const s=indexedDB.open(e,im);qs[e]=s,s.onupgradeneeded=o=>{o.oldVersion<sm&&hm(s.result)},zc(n,i,s)});return t.onclose=()=>Ko(e),t}function gm(e){return Zn[e]||(Zn[e]=fm(e)),Zn[e]}function We(e,t,n,i){return new Promise((s,o)=>{const r=e.transaction(t,n,{durability:"relaxed"}),a=typeof t=="string"?r.objectStore(t):t.map(c=>r.objectStore(c));let u;i(a,r,c=>{u=c}),r.oncomplete=()=>s(u),r.onerror=()=>o(r.error)})}function Ko(e){const t=qs[e],n=t&&t.result;if(n){n.close();const i=yi[e];if(i)for(const s of i)s()}delete qs[e],delete Zn[e],delete yi[e]}function mm(e){return new Promise((t,n)=>{Ko(e);const i=indexedDB.deleteDatabase(e);zc(t,n,i)})}function ym(e,t){let n=yi[e];n||(n=yi[e]=[]),n.push(t)}const vm=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function Lt(e){return e.split(/[\s_]+/).map(t=>!t.match(/\w/)||vm.has(t)?t.toLowerCase():t.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const bm=2;function jc(e){return e.filter(Boolean).map(t=>t.toLowerCase()).filter(t=>t.length>=bm)}function wm(e){return e.map(({annotation:n,emoticon:i,group:s,order:o,shortcodes:r,skins:a,tags:u,emoji:c,version:l})=>{const d=[...new Set(jc([...(r||[]).map(Lt).flat(),...(u||[]).map(Lt).flat(),...Lt(n),i]))].sort(),h={annotation:n,group:s,order:o,tags:u,tokens:d,unicode:c,version:l};if(i&&(h.emoticon=i),r&&(h.shortcodes=r),a){h.skinTones=[],h.skinUnicodes=[],h.skinVersions=[];for(const{tone:v,emoji:f,version:b}of a)h.skinTones.push(v),h.skinUnicodes.push(f),h.skinVersions.push(b)}return h})}function Hc(e,t,n,i){e[t](n).onsuccess=s=>i&&i(s.target.result)}function mt(e,t,n){Hc(e,"get",t,n)}function qc(e,t,n){Hc(e,"getAll",t,n)}function zo(e){e.commit&&e.commit()}function km(e,t){let n=e[0];for(let i=1;i<e.length;i++){const s=e[i];t(n)>t(s)&&(n=s)}return n}function Vc(e,t){const n=km(e,s=>s.length),i=[];for(const s of n)e.some(o=>o.findIndex(r=>t(r)===t(s))===-1)||i.push(s);return i}async function Sm(e){return!await jo(e,Dt,mi)}async function xm(e,t,n){const[i,s]=await Promise.all([Hs,mi].map(o=>jo(e,Dt,o)));return i===n&&s===t}async function $m(e,t){return We(e,wt,Kt,(i,s,o)=>{let r;const a=()=>{i.getAll(r&&IDBKeyRange.lowerBound(r,!0),50).onsuccess=u=>{const c=u.target.result;for(const l of c)if(r=l.unicode,t(l))return o(l);if(c.length<50)return o();a()}};a()})}async function Gc(e,t,n,i){{const s=wm(t);await We(e,[wt,Dt],Wo,([o,r],a)=>{let u,c,l=0;function d(){++l===2&&h()}function h(){if(!(u===i&&c===n)){o.clear();for(const v of s)o.put(v);r.put(i,Hs),r.put(n,mi),zo(a)}}mt(r,Hs,v=>{u=v,d()}),mt(r,mi,v=>{c=v,d()})})}}async function Am(e,t){return We(e,wt,Kt,(n,i,s)=>{const o=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);qc(n.index(Wc),o,s)})}async function Qc(e,t){const n=jc(Lt(t));return n.length?We(e,wt,Kt,(i,s,o)=>{const r=[],a=()=>{r.length===n.length&&u()},u=()=>{const c=Vc(r,l=>l.unicode);o(c.sort((l,d)=>l.order<d.order?-1:1))};for(let c=0;c<n.length;c++){const l=n[c],d=c===n.length-1?IDBKeyRange.bound(l,l+"￿",!1,!0):IDBKeyRange.only(l);qc(i.index(Fc),d,h=>{r.push(h),a()})}}):[]}async function Em(e,t){const n=await Qc(e,t);return n.length?n.filter(i=>(i.shortcodes||[]).map(o=>o.toLowerCase()).includes(t.toLowerCase()))[0]||null:await $m(e,s=>(s.shortcodes||[]).includes(t.toLowerCase()))||null}async function Cm(e,t){return We(e,wt,Kt,(n,i,s)=>mt(n,t,o=>{if(o)return s(o);mt(n.index(Kc),t,r=>s(r||null))}))}function jo(e,t,n){return We(e,t,Kt,(i,s,o)=>mt(i,n,o))}function Tm(e,t,n,i){return We(e,t,Wo,(s,o)=>{s.put(i,n),zo(o)})}function _m(e,t){return We(e,Uo,Wo,(n,i)=>mt(n,t,s=>{n.put((s||0)+1,t),zo(i)}))}function Mm(e,t,n){return n===0?[]:We(e,[Uo,wt],Kt,([i,s],o,r)=>{const a=[];i.index(Uc).openCursor(void 0,"prev").onsuccess=u=>{const c=u.target.result;if(!c)return r(a);function l(v){if(a.push(v),a.length===n)return r(a);c.continue()}const d=c.primaryKey,h=t.byName(d);if(h)return l(h);mt(s,d,v=>{if(v)return l(v);c.continue()})}})}const Hn="";function Pm(e,t){const n=new Map;for(const s of e){const o=t(s);for(const r of o){let a=n;for(let c=0;c<r.length;c++){const l=r.charAt(c);let d=a.get(l);d||(d=new Map,a.set(l,d)),a=d}let u=a.get(Hn);u||(u=[],a.set(Hn,u)),u.push(s)}}return(s,o)=>{let r=n;for(let c=0;c<s.length;c++){const l=s.charAt(c),d=r.get(l);if(d)r=d;else return[]}if(o)return r.get(Hn)||[];const a=[],u=[r];for(;u.length;){const l=[...u.shift().entries()].sort((d,h)=>d[0]<h[0]?-1:1);for(const[d,h]of l)d===Hn?a.push(...h):u.push(h)}return a}}const Lm=["name","url"];function Im(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||Lm.some(i=>!(i in e[0])));if(!t||n)throw new Error("Custom emojis are in the wrong format")}function Ca(e){Im(e);const t=(h,v)=>h.name.toLowerCase()<v.name.toLowerCase()?-1:1,n=e.sort(t),s=Pm(e,h=>{const v=new Set;if(h.shortcodes)for(const f of h.shortcodes)for(const b of Lt(f))v.add(b);return v}),o=h=>s(h,!0),r=h=>s(h,!1),a=h=>{const v=Lt(h),f=v.map((b,S)=>(S<v.length-1?o:r)(b));return Vc(f,b=>b.name).sort(t)},u=new Map,c=new Map;for(const h of e){c.set(h.name.toLowerCase(),h);for(const v of h.shortcodes||[])u.set(v.toLowerCase(),h)}return{all:n,search:a,byShortcode:h=>u.get(h.toLowerCase()),byName:h=>c.get(h.toLowerCase())}}const Rm=typeof wrappedJSObject<"u";function nn(e){if(!e)return e;if(Rm&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t);for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function Yc(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const Nm=["annotation","emoji","group","order","version"];function Dm(e){if(!e||!Array.isArray(e)||!e[0]||typeof e[0]!="object"||Nm.some(t=>!(t in e[0])))throw new Error("Emoji data is in the wrong format")}function Xc(e,t){if(Math.floor(e.status/100)!==2)throw new Error("Failed to fetch: "+t+": "+e.status)}async function Om(e){const t=await fetch(e,{method:"HEAD"});Xc(t,e);const n=t.headers.get("etag");return Yc(n),n}async function Vs(e){const t=await fetch(e);Xc(t,e);const n=t.headers.get("etag");Yc(n);const i=await t.json();return Dm(i),[n,i]}function Bm(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,s=-1;++s<i;)t+=String.fromCharCode(n[s]);return t}function Fm(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),s=-1;++s<t;)i[s]=e.charCodeAt(s);return n}async function Zc(e){const t=JSON.stringify(e);let n=Fm(t);const i=await crypto.subtle.digest("SHA-1",n),s=Bm(i);return btoa(s)}async function Um(e,t){let n,i=await Om(t);if(!i){const s=await Vs(t);i=s[0],n=s[1],i||(i=await Zc(n))}await xm(e,t,i)||(n||(n=(await Vs(t))[1]),await Gc(e,n,t,i))}async function Wm(e,t){let[n,i]=await Vs(t);n||(n=await Zc(i)),await Gc(e,i,t,n)}async function Km(e,t){try{await Um(e,t)}catch(n){if(n.name!=="InvalidStateError")throw n}}class zm{constructor({dataSource:t=um,locale:n=dm,customEmoji:i=[]}={}){this.dataSource=t,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=Ca(i),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const t=this._db=await gm(this._dbName);ym(this._dbName,this._clear);const n=this.dataSource;await Sm(t)?await Wm(t,n):this._lazyUpdate=Km(t,n)}async ready(){const t=async()=>(this._ready||(this._ready=this._init()),this._ready);await t(),this._db||await t()}async getEmojiByGroup(t){return hs(t),await this.ready(),Ea(await Am(this._db,t)).map(nn)}async getEmojiBySearchQuery(t){jn(t),await this.ready();const n=this._custom.search(t),i=Ea(await Qc(this._db,t)).map(nn);return[...n,...i]}async getEmojiByShortcode(t){jn(t),await this.ready();const n=this._custom.byShortcode(t);return n||nn(await Em(this._db,t))}async getEmojiByUnicodeOrName(t){jn(t),await this.ready();const n=this._custom.byName(t);return n||nn(await Cm(this._db,t))}async getPreferredSkinTone(){return await this.ready(),await jo(this._db,Dt,Aa)||0}async setPreferredSkinTone(t){return hs(t),await this.ready(),Tm(this._db,Dt,Aa,t)}async incrementFavoriteEmojiCount(t){return jn(t),await this.ready(),_m(this._db,t)}async getTopFavoriteEmoji(t){return hs(t),await this.ready(),(await Mm(this._db,this._custom,t)).map(nn)}set customEmoji(t){this._custom=Ca(t)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await Ko(this._dbName)}async delete(){await this._shutdown(),await mm(this._dbName)}}const Gs=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([e,t,n])=>({id:e,emoji:t,name:n})),fs=Gs.slice(1),jm=2,Ta=6,Jc=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function _a(e){return e.unicode.includes("‍")}const Hm={"🫪":17,"🫩":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱‍♀️":4,"🤣":3,"👁️‍🗨️":2,"😀":1,"😐️":.7,"😃":.6},qm=1e3,Vm="🖐️",Gm=8,Qm=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],eu='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Ym=(e,t)=>e<t?-1:e>t?1:0,Ma=(e,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const i=n.getContext("2d",{willReadFrequently:!0});return i.textBaseline="top",i.font=`100px ${eu}`,i.fillStyle=t,i.scale(.01,.01),i.fillText(e,0,0),i.getImageData(0,0,1,1).data},Xm=(e,t)=>{const n=[...e].join(","),i=[...t].join(",");return n===i&&!n.startsWith("0,0,0,")};function Zm(e){const t=Ma(e,"#000"),n=Ma(e,"#fff");return t&&n&&Xm(t,n)}function Jm(){const e=Object.entries(Hm);try{for(const[t,n]of e)if(Zm(t))return n}catch{}return e[0][1]}let gs;const ms=()=>(gs||(gs=new Promise(e=>Jc(()=>e(Jm())))),gs),Qs=new Map,ey="️",ty="\uD83C",ny="‍",iy=127995,sy=57339;function oy(e,t){if(t===0)return e;const n=e.indexOf(ny);return n!==-1?e.substring(0,n)+String.fromCodePoint(iy+t-1)+e.substring(n):(e.endsWith(ey)&&(e=e.substring(0,e.length-1)),e+ty+String.fromCodePoint(sy+t-1))}function Ee(e){e.preventDefault(),e.stopPropagation()}function ys(e,t,n){return t+=e?-1:1,t<0?t=n.length-1:t>=n.length&&(t=0),t}function tu(e,t){const n=new Set,i=[];for(const s of e){const o=t(s);n.has(o)||(n.add(o),i.push(s))}return i}function ry(e,t){const n=i=>{const s={};for(const o of i)typeof o.tone=="number"&&o.version<=t&&(s[o.tone]=o.unicode);return s};return e.map(({unicode:i,skins:s,shortcodes:o,url:r,name:a,category:u,annotation:c})=>({unicode:i,name:a,shortcodes:o,url:r,category:u,annotation:c,id:i||a,skins:s&&n(s)}))}const Jn=requestAnimationFrame;let ay=typeof ResizeObserver=="function";function ly(e,t,n){let i;ay?(i=new ResizeObserver(n),i.observe(e)):Jn(n),t.addEventListener("abort",()=>{i&&i.disconnect()})}function Pa(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}let vs;function cy(e,t,n){let i=!0,s=!1;for(const o of e){const r=n(o);if(!r)continue;const a=Pa(r);a===0&&(s=!0),typeof vs>"u"&&(vs=Pa(t));const u=a/1.8<vs;Qs.set(o.unicode,u),u||(i=!1)}return s&&console.warn(`Emoji support detection failed - emoji character is 0 width.
2245
2242
  This is likely due to using \`display:none\` which is unsupported.
2246
2243
  If this is a Jest/Vitest environment, you can ignore this warning.
2247
- For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function uy(e){return tu(e,t=>t)}function dy(e){e&&(e.scrollTop=0)}function pn(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function La(e){return""+e}function py(e){const t=document.createElement("template");return t.innerHTML=e,t}const hy=new WeakMap,fy=new WeakMap,gy=Symbol("un-keyed"),my="replaceChildren"in Element.prototype;function yy(e,t){my?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function vy(e,t){let n=e.firstChild,i=0;for(;n;){if(t[i]!==n)return!0;n=n.nextSibling,i++}return i!==t.length}function by(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=vy(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&yy(i,e)}function wy(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:o,attributeName:r,attributeValuePre:a,attributeValuePost:u}}=n,c=e[o];if(s!==c)if(n.currentExpression=c,r)if(c===null)i.removeAttribute(r);else{const l=a+La(c)+u;i.setAttribute(r,l)}else{let l;Array.isArray(c)?by(c,n):c instanceof Element?(l=c,i.replaceWith(l)):i.nodeValue=La(c),l&&(n.targetNode=l)}}}function ky(e){let t="",n=!1,i=!1,s=-1;const o=new Map,r=[];let a=0;for(let c=0,l=e.length;c<l;c++){const d=e[c];if(t+=d.slice(a),c===l-1)break;for(let A=0;A<d.length;A++)switch(d.charAt(A)){case"<":{d.charAt(A+1)==="/"?r.pop():(n=!0,r.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const h=r[r.length-1],v=pn(o,h,()=>[]);let f,b,S;if(i){const A=/(\S+)="?([^"=]*)$/.exec(d);f=A[1],b=A[2];const C=/^([^">]*)("?)/.exec(e[c+1]);S=C[1],t=t.slice(0,-1*A[0].length),a=C[0].length}else a=0;const $={attributeName:f,attributeValuePre:b,attributeValuePost:S,expressionIndex:c};v.push($),!n&&!i&&(t+=" ")}return{template:py(t),elementsToBindings:o}}function Ia(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],o=s.attributeName?t:t.firstChild,r={binding:s,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(r)}}function Sy(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))Ia(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,r=-1;do{const a=t.get(++r);a&&Ia(a,o,n)}while(o=s.nextNode())}return n}function xy(e){const{template:t,elementsToBindings:n}=pn(hy,e,()=>ky(e)),i=t.cloneNode(!0).content.firstElementChild,s=Sy(i,n);return function(r){return wy(r,s),i}}function $y(e){const t=pn(fy,e,()=>new Map);let n=gy;function i(o,...r){const a=pn(t,o,()=>new Map);return pn(a,n,()=>xy(o))(r)}function s(o,r,a){return o.map((u,c)=>{const l=n;n=a(u);try{return r(u,c)}finally{n=l}})}return{map:s,html:i}}function Ay(e,t,n,i,s,o,r,a,u){const{labelWithSkin:c,titleForEmoji:l,unicodeWithSkin:d}=n,{html:h,map:v}=$y(t);function f(A,C,T){return v(A,(M,R)=>h`<button role="${C?"option":"menuitem"}" aria-selected="${C?R===t.activeSearchItem:null}" aria-label="${c(M,t.currentSkinTone)}" title="${l(M)}" class="${"emoji"+(C&&R===t.activeSearchItem?" active":"")+(M.unicode?"":" custom-emoji")}" id="${`${T}-${M.id}`}" style="${M.unicode?null:`--custom-emoji-background: url(${JSON.stringify(M.url)})`}">${M.unicode?d(M,t.currentSkinTone):""}</button>`,M=>`${T}-${M.id}`)}const S=h`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(t.searchMode&&t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?`emo-${t.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${v(t.skinTones,(A,C)=>h`<div id="skintone-${C}" class="emoji ${C===t.activeSkinTone?"active":""}" aria-selected="${C===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[C]}" aria-label="${t.i18n.skinTones[C]}">${A}</div>`,A=>A)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${v(t.groups,A=>h`<button role="tab" class="nav-button" aria-controls="tab-${A.id}" aria-label="${t.i18n.categories[A.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===A.id}" title="${t.i18n.categories[A.name]}" data-group-id="${A.id}"><div class="nav-emoji emoji">${A.emoji}</div></button>`,A=>A.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${v(t.currentEmojisWithCategories,(A,C)=>h`<div><div id="menu-label-${C}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:A.category?A.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${C!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(A.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${C}" id="${t.searchMode?"search-results":null}">${f(A.emojis,t.searchMode,"emo")}</div></div>`,A=>A.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${f(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,$=(A,C)=>{for(const T of e.querySelectorAll(`[${A}]`))C(T,T.getAttribute(A))};if(u){e.appendChild(S);for(const A of["click","focusout","input","keydown","keyup"])$(`data-on-${A}`,(C,T)=>{C.addEventListener(A,i[T])});$("data-ref",(A,C)=>{o[C]=A}),r.addEventListener("abort",()=>{e.removeChild(S)})}$("data-action",(A,C)=>{let T=a.get(C);T||a.set(C,T=new WeakSet),T.has(A)||(T.add(A),s[C](A))})}const vi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function Ey(e){let t=!1,n;const i=new Map,s=new Set;let o;const r=()=>{if(t)return;const c=[...s];s.clear();try{for(const l of c)l()}finally{o=!1,s.size&&(o=!0,vi(r))}},a=new Proxy({},{get(c,l){if(n){let d=i.get(l);d||(d=new Set,i.set(l,d)),d.add(n)}return c[l]},set(c,l,d){if(c[l]!==d){c[l]=d;const h=i.get(l);if(h){for(const v of h)s.add(v);o||(o=!0,vi(r))}}return!0}}),u=c=>{const l=()=>{const d=n;n=l;try{return c()}finally{n=d}};return l()};return e.addEventListener("abort",()=>{t=!0}),{state:a,createEffect:u}}function bs(e,t,n){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}const Ra=new WeakMap;function Cy(e,t,n){{const i=e.closest(".tabpanel");let s=Ra.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),Ra.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const ws=[],{assign:qn}=Object;function Ty(e,t){const n={},i=new AbortController,s=i.signal,{state:o,createEffect:r}=Ey(s),a=new Map;qn(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),qn(o,t),qn(o,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Gm,isRtl:!1,currentGroupIndex:0,groups:fs,databaseLoaded:!1,activeSearchItemId:void 0}),r(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const u=x=>{e.getElementById(x).focus()},c=x=>e.getElementById(`emo-${x.id}`),l=(x,_)=>{n.rootElement.dispatchEvent(new CustomEvent(x,{detail:_,bubbles:!0,composed:!0}))},d=(x,_)=>x.id===_.id,h=(x,_)=>{const{category:N,emojis:O}=x,{category:V,emojis:z}=_;return N!==V?!1:bs(O,z,d)},v=x=>{bs(o.currentEmojis,x,d)||(o.currentEmojis=x)},f=x=>{o.searchMode!==x&&(o.searchMode=x)},b=x=>{bs(o.currentEmojisWithCategories,x,h)||(o.currentEmojisWithCategories=x)},S=(x,_)=>_&&x.skins&&x.skins[_]||x.unicode,C={labelWithSkin:(x,_)=>uy([x.name||S(x,_),x.annotation,...x.shortcodes||ws].filter(Boolean)).join(", "),titleForEmoji:x=>x.annotation||(x.shortcodes||ws).join(", "),unicodeWithSkin:S},T={onClickSkinToneButton:H,onEmojiClick:$n,onNavClick:Sn,onNavKeydown:Oi,onSearchKeydown:Di,onSkinToneOptionsClick:An,onSkinToneOptionsFocusOut:ze,onSkinToneOptionsKeydown:et,onSkinToneOptionsKeyup:jt,onSearchInput:En},M={calculateEmojiGridStyle:ee,updateOnIntersection:me};let R=!0;r(()=>{Ay(e,o,C,T,M,n,s,a,R),R=!1}),o.emojiVersion||ms().then(x=>{x||(o.message=o.i18n.emojiUnsupportedMessage)}),r(()=>{async function x(){let _=!1;const N=setTimeout(()=>{_=!0,o.message=o.i18n.loadingMessage},qm);try{await o.database.ready(),o.databaseLoaded=!0}catch(O){console.error(O),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(N),_&&(_=!1,o.message="")}}o.database&&x()}),r(()=>{o.pickerStyle=`
2244
+ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`),i}function uy(e){return tu(e,t=>t)}function dy(e){e&&(e.scrollTop=0)}function pn(e,t,n){let i=e.get(t);return i||(i=n(),e.set(t,i)),i}function La(e){return""+e}function py(e){const t=document.createElement("template");return t.innerHTML=e,t}const hy=new WeakMap,fy=new WeakMap,gy=Symbol("un-keyed"),my="replaceChildren"in Element.prototype;function yy(e,t){my?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}function vy(e,t){let n=e.firstChild,i=0;for(;n;){if(t[i]!==n)return!0;n=n.nextSibling,i++}return i!==t.length}function by(e,t){const{targetNode:n}=t;let{targetParentNode:i}=t,s=!1;i?s=vy(i,e):(s=!0,t.targetNode=void 0,t.targetParentNode=i=n.parentNode),s&&yy(i,e)}function wy(e,t){for(const n of t){const{targetNode:i,currentExpression:s,binding:{expressionIndex:o,attributeName:r,attributeValuePre:a,attributeValuePost:u}}=n,c=e[o];if(s!==c)if(n.currentExpression=c,r)if(c===null)i.removeAttribute(r);else{const l=a+La(c)+u;i.setAttribute(r,l)}else{let l;Array.isArray(c)?by(c,n):c instanceof Element?(l=c,i.replaceWith(l)):i.nodeValue=La(c),l&&(n.targetNode=l)}}}function ky(e){let t="",n=!1,i=!1,s=-1;const o=new Map,r=[];let a=0;for(let c=0,l=e.length;c<l;c++){const d=e[c];if(t+=d.slice(a),c===l-1)break;for(let A=0;A<d.length;A++)switch(d.charAt(A)){case"<":{d.charAt(A+1)==="/"?r.pop():(n=!0,r.push(++s));break}case">":{n=!1,i=!1;break}case"=":{i=!0;break}}const h=r[r.length-1],v=pn(o,h,()=>[]);let f,b,S;if(i){const A=/(\S+)="?([^"=]*)$/.exec(d);f=A[1],b=A[2];const C=/^([^">]*)("?)/.exec(e[c+1]);S=C[1],t=t.slice(0,-1*A[0].length),a=C[0].length}else a=0;const $={attributeName:f,attributeValuePre:b,attributeValuePost:S,expressionIndex:c};v.push($),!n&&!i&&(t+=" ")}return{template:py(t),elementsToBindings:o}}function Ia(e,t,n){for(let i=0;i<e.length;i++){const s=e[i],o=s.attributeName?t:t.firstChild,r={binding:s,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(r)}}function Sy(e,t){const n=[];let i;if(t.size===1&&(i=t.get(0)))Ia(i,e,n);else{const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let o=e,r=-1;do{const a=t.get(++r);a&&Ia(a,o,n)}while(o=s.nextNode())}return n}function xy(e){const{template:t,elementsToBindings:n}=pn(hy,e,()=>ky(e)),i=t.cloneNode(!0).content.firstElementChild,s=Sy(i,n);return function(r){return wy(r,s),i}}function $y(e){const t=pn(fy,e,()=>new Map);let n=gy;function i(o,...r){const a=pn(t,o,()=>new Map);return pn(a,n,()=>xy(o))(r)}function s(o,r,a){return o.map((u,c)=>{const l=n;n=a(u);try{return r(u,c)}finally{n=l}})}return{map:s,html:i}}function Ay(e,t,n,i,s,o,r,a,u){const{labelWithSkin:c,titleForEmoji:l,unicodeWithSkin:d}=n,{html:h,map:v}=$y(t);function f(A,C,T){return v(A,(M,R)=>h`<button role="${C?"option":"menuitem"}" aria-selected="${C?R===t.activeSearchItem:null}" aria-label="${c(M,t.currentSkinTone)}" title="${l(M)}" class="${"emoji"+(C&&R===t.activeSearchItem?" active":"")+(M.unicode?"":" custom-emoji")}" id="${`${T}-${M.id}`}" style="${M.unicode?null:`--custom-emoji-background: url(${JSON.stringify(M.url)})`}">${M.unicode?d(M,t.currentSkinTone):""}</button>`,M=>`${T}-${M.id}`)}const S=h`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(t.searchMode&&t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?`emo-${t.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${v(t.skinTones,(A,C)=>h`<div id="skintone-${C}" class="emoji ${C===t.activeSkinTone?"active":""}" aria-selected="${C===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[C]}" aria-label="${t.i18n.skinTones[C]}">${A}</div>`,A=>A)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${v(t.groups,A=>h`<button role="tab" class="nav-button" aria-controls="tab-${A.id}" aria-label="${t.i18n.categories[A.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===A.id}" title="${t.i18n.categories[A.name]}" data-group-id="${A.id}"><div class="nav-emoji emoji">${A.emoji}</div></button>`,A=>A.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?null:`tab-${t.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${v(t.currentEmojisWithCategories,(A,C)=>h`<div><div id="menu-label-${C}" class="category ${t.currentEmojisWithCategories.length===1&&t.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:A.category?A.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu ${C!==0&&!t.searchMode&&t.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(A.emojis.length/t.numColumns)}`}" data-action="updateOnIntersection" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${C}" id="${t.searchMode?"search-results":null}">${f(A.emojis,t.searchMode,"emo")}</div></div>`,A=>A.category)}</div></div><div class="favorites onscreen emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${f(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,$=(A,C)=>{for(const T of e.querySelectorAll(`[${A}]`))C(T,T.getAttribute(A))};if(u){e.appendChild(S);for(const A of["click","focusout","input","keydown","keyup"])$(`data-on-${A}`,(C,T)=>{C.addEventListener(A,i[T])});$("data-ref",(A,C)=>{o[C]=A}),r.addEventListener("abort",()=>{e.removeChild(S)})}$("data-action",(A,C)=>{let T=a.get(C);T||a.set(C,T=new WeakSet),T.has(A)||(T.add(A),s[C](A))})}const vi=typeof queueMicrotask=="function"?queueMicrotask:e=>Promise.resolve().then(e);function Ey(e){let t=!1,n;const i=new Map,s=new Set;let o;const r=()=>{if(t)return;const c=[...s];s.clear();try{for(const l of c)l()}finally{o=!1,s.size&&(o=!0,vi(r))}},a=new Proxy({},{get(c,l){if(n){let d=i.get(l);d||(d=new Set,i.set(l,d)),d.add(n)}return c[l]},set(c,l,d){if(c[l]!==d){c[l]=d;const h=i.get(l);if(h){for(const v of h)s.add(v);o||(o=!0,vi(r))}}return!0}}),u=c=>{const l=()=>{const d=n;n=l;try{return c()}finally{n=d}};return l()};return e.addEventListener("abort",()=>{t=!0}),{state:a,createEffect:u}}function bs(e,t,n){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}const Ra=new WeakMap;function Cy(e,t,n){{const i=e.closest(".tabpanel");let s=Ra.get(i);s||(s=new IntersectionObserver(n,{root:i,rootMargin:"50% 0px 50% 0px",threshold:0}),Ra.set(i,s),t.addEventListener("abort",()=>{s.disconnect()})),s.observe(e)}}const ws=[],{assign:qn}=Object;function Ty(e,t){const n={},i=new AbortController,s=i.signal,{state:o,createEffect:r}=Ey(s),a=new Map;qn(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),qn(o,t),qn(o,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:Gm,isRtl:!1,currentGroupIndex:0,groups:fs,databaseLoaded:!1,activeSearchItemId:void 0}),r(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const u=x=>{e.getElementById(x).focus()},c=x=>e.getElementById(`emo-${x.id}`),l=(x,_)=>{n.rootElement.dispatchEvent(new CustomEvent(x,{detail:_,bubbles:!0,composed:!0}))},d=(x,_)=>x.id===_.id,h=(x,_)=>{const{category:D,emojis:O}=x,{category:V,emojis:z}=_;return D!==V?!1:bs(O,z,d)},v=x=>{bs(o.currentEmojis,x,d)||(o.currentEmojis=x)},f=x=>{o.searchMode!==x&&(o.searchMode=x)},b=x=>{bs(o.currentEmojisWithCategories,x,h)||(o.currentEmojisWithCategories=x)},S=(x,_)=>_&&x.skins&&x.skins[_]||x.unicode,C={labelWithSkin:(x,_)=>uy([x.name||S(x,_),x.annotation,...x.shortcodes||ws].filter(Boolean)).join(", "),titleForEmoji:x=>x.annotation||(x.shortcodes||ws).join(", "),unicodeWithSkin:S},T={onClickSkinToneButton:H,onEmojiClick:$n,onNavClick:Sn,onNavKeydown:Oi,onSearchKeydown:Di,onSkinToneOptionsClick:An,onSkinToneOptionsFocusOut:ze,onSkinToneOptionsKeydown:et,onSkinToneOptionsKeyup:jt,onSearchInput:En},M={calculateEmojiGridStyle:ee,updateOnIntersection:me};let R=!0;r(()=>{Ay(e,o,C,T,M,n,s,a,R),R=!1}),o.emojiVersion||ms().then(x=>{x||(o.message=o.i18n.emojiUnsupportedMessage)}),r(()=>{async function x(){let _=!1;const D=setTimeout(()=>{_=!0,o.message=o.i18n.loadingMessage},qm);try{await o.database.ready(),o.databaseLoaded=!0}catch(O){console.error(O),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(D),_&&(_=!1,o.message="")}}o.database&&x()}),r(()=>{o.pickerStyle=`
2248
2245
  --num-groups: ${o.groups.length};
2249
2246
  --indicator-opacity: ${o.searchMode?0:1};
2250
- --num-skintones: ${Ta};`}),r(()=>{o.customEmoji&&o.database&&B()}),r(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==Gs&&(o.groups=Gs):o.groups!==fs&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=fs)}),r(()=>{async function x(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}x()}),r(()=>{o.skinTones=Array(Ta).fill().map((x,_)=>oy(o.skinToneEmoji,_))}),r(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),r(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),r(()=>{async function x(){const{database:_}=o,N=(await Promise.all(Qm.map(O=>_.getEmojiByUnicodeOrName(O)))).filter(Boolean);o.defaultFavoriteEmojis=N}o.databaseLoaded&&x()});function B(){const{customEmoji:x,database:_}=o,N=x||ws;_.customEmoji!==N&&(_.customEmoji=N)}r(()=>{async function x(){B();const{database:_,defaultFavoriteEmojis:N,numColumns:O}=o,V=await _.getTopFavoriteEmoji(O),z=await Je(tu([...V,...N],ae=>ae.unicode||ae.name).slice(0,O));o.currentFavorites=z}o.databaseLoaded&&o.defaultFavoriteEmojis&&x()});function ee(x){ly(x,s,()=>{{const _=getComputedStyle(n.rootElement),N=parseInt(_.getPropertyValue("--num-columns"),10),O=_.getPropertyValue("direction")==="rtl";o.numColumns=N,o.isRtl=O}})}function me(x){Cy(x,s,_=>{for(const{target:N,isIntersecting:O}of _)N.classList.toggle("onscreen",O)})}r(()=>{async function x(){const{searchText:_,currentGroup:N,databaseLoaded:O,customEmoji:V}=o;if(!O)o.currentEmojis=[],o.searchMode=!1;else if(_.length>=jm){const z=await Ni(_);o.searchText===_&&(v(z),f(!0))}else{const{id:z}=N;if(z!==-1||V&&V.length){const ae=await Ri(z);o.currentGroup.id===z&&(v(ae),f(!1))}}}x()});const Ke=()=>{Jn(()=>dy(n.tabpanelElement))};r(()=>{const{currentEmojis:x,emojiVersion:_}=o,N=x.filter(O=>O.unicode).filter(O=>_a(O)&&!Qs.has(O.unicode));if(!_&&N.length)v(x),Jn(()=>Z(N));else{const O=_?x:x.filter(zt);v(O),Ke()}});function Z(x){cy(x,n.baselineEmoji,c)?Ke():o.currentEmojis=[...o.currentEmojis]}function zt(x){return!x.unicode||!_a(x)||Qs.get(x.unicode)}async function kt(x){const _=o.emojiVersion||await ms();return x.filter(({version:N})=>!N||N<=_)}async function Je(x){return ry(x,o.emojiVersion||await ms())}async function Ri(x){const _=x===-1?o.customEmoji:await o.database.getEmojiByGroup(x);return Je(await kt(_))}async function Ni(x){return Je(await kt(await o.database.getEmojiBySearchQuery(x)))}r(()=>{}),r(()=>{function x(){const{searchMode:N,currentEmojis:O}=o;if(N)return[{category:"",emojis:O}];const V=new Map;for(const z of O){const ae=z.category||"";let je=V.get(ae);je||(je=[],V.set(ae,je)),je.push(z)}return[...V.entries()].map(([z,ae])=>({category:z,emojis:ae})).sort((z,ae)=>o.customCategorySorting(z.category,ae.category))}const _=x();b(_)}),r(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),r(()=>{const{rawSearchText:x}=o;Jc(()=>{o.searchText=(x||"").trim(),o.activeSearchItem=-1})});function Di(x){if(!o.searchMode||!o.currentEmojis.length)return;const _=N=>{Ee(x),o.activeSearchItem=ys(N,o.activeSearchItem,o.currentEmojis)};switch(x.key){case"ArrowDown":return _(!1);case"ArrowUp":return _(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return Ee(x),Q(o.currentEmojis[o.activeSearchItem].id)}}function Sn(x){const{target:_}=x,N=_.closest(".nav-button");if(!N)return;const O=parseInt(N.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(V=>V.id===O)}function Oi(x){const{target:_,key:N}=x,O=V=>{V&&(Ee(x),V.focus())};switch(N){case"ArrowLeft":return O(_.previousElementSibling);case"ArrowRight":return O(_.nextElementSibling);case"Home":return O(_.parentElement.firstElementChild);case"End":return O(_.parentElement.lastElementChild)}}async function xn(x){const _=await o.database.getEmojiByUnicodeOrName(x),N=[...o.currentEmojis,...o.currentFavorites].find(V=>V.id===x),O=N.unicode&&S(N,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(x),{emoji:_,skinTone:o.currentSkinTone,...O&&{unicode:O},...N.name&&{name:N.name}}}async function Q(x){const _=xn(x);l("emoji-click-sync",_),l("emoji-click",await _)}function $n(x){const{target:_}=x;if(!_.classList.contains("emoji"))return;Ee(x);const N=_.id.substring(4);Q(N)}function Y(x){o.currentSkinTone=x,o.skinTonePickerExpanded=!1,u("skintone-button"),l("skin-tone-change",{skinTone:x}),o.database.setPreferredSkinTone(x)}function An(x){const{target:{id:_}}=x,N=_&&_.match(/^skintone-(\d)/);if(!N)return;Ee(x);const O=parseInt(N[1],10);Y(O)}function H(x){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&(Ee(x),Jn(()=>u("skintone-list")))}r(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function et(x){if(!o.skinTonePickerExpanded)return;const _=async N=>{Ee(x),o.activeSkinTone=N};switch(x.key){case"ArrowUp":return _(ys(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return _(ys(!1,o.activeSkinTone,o.skinTones));case"Home":return _(0);case"End":return _(o.skinTones.length-1);case"Enter":return Ee(x),Y(o.activeSkinTone);case"Escape":return Ee(x),o.skinTonePickerExpanded=!1,u("skintone-button")}}function jt(x){if(o.skinTonePickerExpanded&&x.key===" ")return Ee(x),Y(o.activeSkinTone)}async function ze(x){const{relatedTarget:_}=x;(!_||_.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function En(x){o.rawSearchText=x.target.value}return{$set(x){qn(o,x)},$destroy(){i.abort()}}}const _y="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",My="en";var Py={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"}},Ly=':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 nu=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],Iy=`:host{--emoji-font-family:${eu}}`;class Ho extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=Ly+Iy,this.shadowRoot.appendChild(n),this._ctx={locale:My,dataSource:_y,skinToneEmoji:Vm,customCategorySorting:Ym,customEmoji:null,i18n:Py,emojiVersion:null,...t};for(const i of nu)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){Na(this),this._cmp||(this._cmp=Ty(this.shadowRoot,this._ctx))}disconnectedCallback(){Na(this),vi(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,i){this._set(t.replace(/-([a-z])/g,(s,o)=>o.toUpperCase()),t==="emoji-version"?parseFloat(i):i)}_set(t,n){this._ctx[t]=n,this._cmp&&this._cmp.$set({[t]:n}),["locale","dataSource"].includes(t)&&this._dbFlush()}_dbCreate(){const{locale:t,dataSource:n,database:i}=this._ctx;(!i||i.locale!==t||i.dataSource!==n)&&this._set("database",new zm({locale:t,dataSource:n}))}_dbFlush(){vi(()=>this._dbCreate())}}const iu={};for(const e of nu)iu[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(Ho.prototype,iu);function Na(e){e instanceof Ho||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Ho);function Ry(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 Da(e){e.style.height="44px",e.style.overflowY="hidden"}const Ny=5e3;function Dy(e){return e?e.active?p`
2247
+ --num-skintones: ${Ta};`}),r(()=>{o.customEmoji&&o.database&&B()}),r(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==Gs&&(o.groups=Gs):o.groups!==fs&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=fs)}),r(()=>{async function x(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}x()}),r(()=>{o.skinTones=Array(Ta).fill().map((x,_)=>oy(o.skinToneEmoji,_))}),r(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),r(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),r(()=>{async function x(){const{database:_}=o,D=(await Promise.all(Qm.map(O=>_.getEmojiByUnicodeOrName(O)))).filter(Boolean);o.defaultFavoriteEmojis=D}o.databaseLoaded&&x()});function B(){const{customEmoji:x,database:_}=o,D=x||ws;_.customEmoji!==D&&(_.customEmoji=D)}r(()=>{async function x(){B();const{database:_,defaultFavoriteEmojis:D,numColumns:O}=o,V=await _.getTopFavoriteEmoji(O),z=await Je(tu([...V,...D],ae=>ae.unicode||ae.name).slice(0,O));o.currentFavorites=z}o.databaseLoaded&&o.defaultFavoriteEmojis&&x()});function ee(x){ly(x,s,()=>{{const _=getComputedStyle(n.rootElement),D=parseInt(_.getPropertyValue("--num-columns"),10),O=_.getPropertyValue("direction")==="rtl";o.numColumns=D,o.isRtl=O}})}function me(x){Cy(x,s,_=>{for(const{target:D,isIntersecting:O}of _)D.classList.toggle("onscreen",O)})}r(()=>{async function x(){const{searchText:_,currentGroup:D,databaseLoaded:O,customEmoji:V}=o;if(!O)o.currentEmojis=[],o.searchMode=!1;else if(_.length>=jm){const z=await Ni(_);o.searchText===_&&(v(z),f(!0))}else{const{id:z}=D;if(z!==-1||V&&V.length){const ae=await Ri(z);o.currentGroup.id===z&&(v(ae),f(!1))}}}x()});const Ke=()=>{Jn(()=>dy(n.tabpanelElement))};r(()=>{const{currentEmojis:x,emojiVersion:_}=o,D=x.filter(O=>O.unicode).filter(O=>_a(O)&&!Qs.has(O.unicode));if(!_&&D.length)v(x),Jn(()=>Z(D));else{const O=_?x:x.filter(zt);v(O),Ke()}});function Z(x){cy(x,n.baselineEmoji,c)?Ke():o.currentEmojis=[...o.currentEmojis]}function zt(x){return!x.unicode||!_a(x)||Qs.get(x.unicode)}async function kt(x){const _=o.emojiVersion||await ms();return x.filter(({version:D})=>!D||D<=_)}async function Je(x){return ry(x,o.emojiVersion||await ms())}async function Ri(x){const _=x===-1?o.customEmoji:await o.database.getEmojiByGroup(x);return Je(await kt(_))}async function Ni(x){return Je(await kt(await o.database.getEmojiBySearchQuery(x)))}r(()=>{}),r(()=>{function x(){const{searchMode:D,currentEmojis:O}=o;if(D)return[{category:"",emojis:O}];const V=new Map;for(const z of O){const ae=z.category||"";let je=V.get(ae);je||(je=[],V.set(ae,je)),je.push(z)}return[...V.entries()].map(([z,ae])=>({category:z,emojis:ae})).sort((z,ae)=>o.customCategorySorting(z.category,ae.category))}const _=x();b(_)}),r(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),r(()=>{const{rawSearchText:x}=o;Jc(()=>{o.searchText=(x||"").trim(),o.activeSearchItem=-1})});function Di(x){if(!o.searchMode||!o.currentEmojis.length)return;const _=D=>{Ee(x),o.activeSearchItem=ys(D,o.activeSearchItem,o.currentEmojis)};switch(x.key){case"ArrowDown":return _(!1);case"ArrowUp":return _(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return Ee(x),Q(o.currentEmojis[o.activeSearchItem].id)}}function Sn(x){const{target:_}=x,D=_.closest(".nav-button");if(!D)return;const O=parseInt(D.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(V=>V.id===O)}function Oi(x){const{target:_,key:D}=x,O=V=>{V&&(Ee(x),V.focus())};switch(D){case"ArrowLeft":return O(_.previousElementSibling);case"ArrowRight":return O(_.nextElementSibling);case"Home":return O(_.parentElement.firstElementChild);case"End":return O(_.parentElement.lastElementChild)}}async function xn(x){const _=await o.database.getEmojiByUnicodeOrName(x),D=[...o.currentEmojis,...o.currentFavorites].find(V=>V.id===x),O=D.unicode&&S(D,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(x),{emoji:_,skinTone:o.currentSkinTone,...O&&{unicode:O},...D.name&&{name:D.name}}}async function Q(x){const _=xn(x);l("emoji-click-sync",_),l("emoji-click",await _)}function $n(x){const{target:_}=x;if(!_.classList.contains("emoji"))return;Ee(x);const D=_.id.substring(4);Q(D)}function Y(x){o.currentSkinTone=x,o.skinTonePickerExpanded=!1,u("skintone-button"),l("skin-tone-change",{skinTone:x}),o.database.setPreferredSkinTone(x)}function An(x){const{target:{id:_}}=x,D=_&&_.match(/^skintone-(\d)/);if(!D)return;Ee(x);const O=parseInt(D[1],10);Y(O)}function H(x){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&(Ee(x),Jn(()=>u("skintone-list")))}r(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function et(x){if(!o.skinTonePickerExpanded)return;const _=async D=>{Ee(x),o.activeSkinTone=D};switch(x.key){case"ArrowUp":return _(ys(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return _(ys(!1,o.activeSkinTone,o.skinTones));case"Home":return _(0);case"End":return _(o.skinTones.length-1);case"Enter":return Ee(x),Y(o.activeSkinTone);case"Escape":return Ee(x),o.skinTonePickerExpanded=!1,u("skintone-button")}}function jt(x){if(o.skinTonePickerExpanded&&x.key===" ")return Ee(x),Y(o.activeSkinTone)}async function ze(x){const{relatedTarget:_}=x;(!_||_.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function En(x){o.rawSearchText=x.target.value}return{$set(x){qn(o,x)},$destroy(){i.abort()}}}const _y="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",My="en";var Py={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"}},Ly=':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 nu=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],Iy=`:host{--emoji-font-family:${eu}}`;class Ho extends HTMLElement{constructor(t){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=Ly+Iy,this.shadowRoot.appendChild(n),this._ctx={locale:My,dataSource:_y,skinToneEmoji:Vm,customCategorySorting:Ym,customEmoji:null,i18n:Py,emojiVersion:null,...t};for(const i of nu)i!=="database"&&Object.prototype.hasOwnProperty.call(this,i)&&(this._ctx[i]=this[i],delete this[i]);this._dbFlush()}connectedCallback(){Na(this),this._cmp||(this._cmp=Ty(this.shadowRoot,this._ctx))}disconnectedCallback(){Na(this),vi(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:t}=this._ctx;t.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(t,n,i){this._set(t.replace(/-([a-z])/g,(s,o)=>o.toUpperCase()),t==="emoji-version"?parseFloat(i):i)}_set(t,n){this._ctx[t]=n,this._cmp&&this._cmp.$set({[t]:n}),["locale","dataSource"].includes(t)&&this._dbFlush()}_dbCreate(){const{locale:t,dataSource:n,database:i}=this._ctx;(!i||i.locale!==t||i.dataSource!==n)&&this._set("database",new zm({locale:t,dataSource:n}))}_dbFlush(){vi(()=>this._dbCreate())}}const iu={};for(const e of nu)iu[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(Ho.prototype,iu);function Na(e){e instanceof Ho||Object.setPrototypeOf(e,customElements.get(e.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Ho);function Ry(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 Da(e){e.style.height="44px",e.style.overflowY="hidden"}const Ny=5e3;function Dy(e){return e?e.active?p`
2251
2248
  <div class="callout info compaction-indicator compaction-indicator--active">
2252
- ${D.loader} Compacting context...
2249
+ ${N.loader} Compacting context...
2253
2250
  </div>
2254
2251
  `:e.completedAt&&Date.now()-e.completedAt<Ny?p`
2255
2252
  <div class="callout success compaction-indicator compaction-indicator--complete">
2256
- ${D.check} Context compacted
2253
+ ${N.check} Context compacted
2257
2254
  </div>
2258
2255
  `:k:k}const Fe=5*1024*1024;function Ue(){return`att-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function ke(e,t){var i,s,o;let n=(i=e.closest(".chat"))==null?void 0:i.querySelector(".chat-attachment-error");if(!n){n=document.createElement("div"),n.className="callout danger chat-attachment-error",n.style.cssText="margin: 8px 4px; animation: fade-in 200ms ease-out;";const r=(s=e.closest(".chat"))==null?void 0:s.querySelector(".chat-compose");(o=r==null?void 0:r.parentElement)==null||o.insertBefore(n,r)}n.textContent=t,setTimeout(()=>n==null?void 0:n.remove(),4e3)}const Oy=/\.(md|txt|csv|json|xml|html|css|js|ts|py|sh|yaml|yml|toml|ini|cfg|log|sql)$/i;function su(e){return e.type.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name)}function ou(e){return e.type.startsWith("text/")||e.type==="application/json"||e.type==="application/xml"||Oy.test(e.name)}function ru(e){return e.type==="application/pdf"||/\.pdf$/i.test(e.name)}function au(e){return e.type.startsWith("video/")||/\.(mp4|webm|mov|avi|mkv|m4v)$/i.test(e.name)}function By(e,t){if(!t.onAttachmentsChange)return;const n=document.querySelector(".chat");if(su(e)){if(e.size>Fe){n&&ke(n,`Image too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:Ue(),dataUrl:i.result,mimeType:e.type};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else if(ou(e)){if(e.size>Fe){n&&ke(n,`File too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:Ue(),dataUrl:"",mimeType:e.type||"text/plain",fileName:e.name,textContent:i.result};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsText(e)}else if(ru(e)){if(e.size>Fe){n&&ke(n,`PDF too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:Ue(),dataUrl:i.result,mimeType:"application/pdf",fileName:e.name};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else if(au(e)){if(e.size>Fe){n&&ke(n,`Video too large (${(e.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);return}const i=new FileReader;i.onload=()=>{var o;const s={id:Ue(),dataUrl:i.result,mimeType:e.type||"video/mp4",fileName:e.name};(o=t.onAttachmentsChange)==null||o.call(t,[...t.attachments??[],s])},i.readAsDataURL(e)}else n&&ke(n,`Unsupported file type: ${e.name}. Use the Files page to upload to workspace.`)}function Fy(e,t){var s;e.preventDefault(),e.stopPropagation();const n=e.currentTarget;n.classList.remove("chat--dragover");const i=(s=e.dataTransfer)==null?void 0:s.files;if(!(!i||i.length===0))for(let o=0;o<i.length;o++){const r=i[o];if(su(r)){if(!t.onAttachmentsChange)continue;if(r.size>Fe){ke(n,`Image too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var d;const u=a.result,c={id:Ue(),dataUrl:u,mimeType:r.type},l=t.attachments??[];(d=t.onAttachmentsChange)==null||d.call(t,[...l,c])},a.readAsDataURL(r)}else if(ou(r)){if(!t.onAttachmentsChange)continue;if(r.size>Fe){ke(n,`File too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var d;const u=a.result,c={id:Ue(),dataUrl:"",mimeType:r.type||"text/plain",fileName:r.name,textContent:u},l=t.attachments??[];(d=t.onAttachmentsChange)==null||d.call(t,[...l,c])},a.readAsText(r)}else if(ru(r)){if(!t.onAttachmentsChange)continue;if(r.size>Fe){ke(n,`PDF too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var d;const u=a.result,c={id:Ue(),dataUrl:u,mimeType:"application/pdf",fileName:r.name},l=t.attachments??[];(d=t.onAttachmentsChange)==null||d.call(t,[...l,c])},a.readAsDataURL(r)}else if(au(r)){if(!t.onAttachmentsChange)continue;if(r.size>Fe){ke(n,`Video too large (${(r.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const a=new FileReader;a.onload=()=>{var d;const u=a.result,c={id:Ue(),dataUrl:u,mimeType:r.type||"video/mp4",fileName:r.name},l=t.attachments??[];(d=t.onAttachmentsChange)==null||d.call(t,[...l,c])},a.readAsDataURL(r)}else ke(n,`Unsupported file type: ${r.name}. Use the Files page to upload to workspace.`)}}function Uy(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),e.currentTarget.classList.add("chat--dragover")}function Wy(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,n=e.relatedTarget;(!n||!t.contains(n))&&t.classList.remove("chat--dragover")}function Ky(e,t){var s,o,r;const n=(s=e.clipboardData)==null?void 0:s.items;if(!n||!t.onAttachmentsChange)return;const i=[];for(let a=0;a<n.length;a++){const u=n[a];(u.type.startsWith("image/")||u.type.startsWith("video/"))&&i.push(u)}if(i.length!==0){e.preventDefault();for(const a of i){const u=a.getAsFile();if(!u)continue;const c=u.type.startsWith("video/")?"Video":"Image";if(u.size>Fe){const d=((r=(o=e.target)==null?void 0:o.closest)==null?void 0:r.call(o,".chat"))??document.querySelector(".chat");d&&ke(d,`${c} too large (${(u.size/1024/1024).toFixed(1)} MB). Maximum is 5 MB.`);continue}const l=new FileReader;l.onload=()=>{var b;const d=l.result,h=u.type.startsWith("video/"),v={id:Ue(),dataUrl:d,mimeType:u.type,fileName:h?u.name||"video.mp4":void 0},f=t.attachments??[];(b=t.onAttachmentsChange)==null||b.call(t,[...f,v])},l.readAsDataURL(u)}}}function zy(e){const t=e.currentTarget,n=t.closest(".chat-compose"),i=n==null?void 0:n.querySelector(".emoji-picker-popup");if(!i)return;const s=i.classList.toggle("active");if(t.classList.toggle("active",s),s){const o=r=>{i.contains(r.target)||t.contains(r.target)||(i.classList.remove("active"),t.classList.remove("active"),document.removeEventListener("click",o,!0))};requestAnimationFrame(()=>document.addEventListener("click",o,!0))}}function jy(e,t){const n=e.detail,i=n==null?void 0:n.unicode;if(!i)return;const s=e.currentTarget.closest(".chat-compose"),o=s==null?void 0:s.querySelector("textarea");if(!o)return;const r=o.selectionStart??t.draft.length,a=o.selectionEnd??r,u=t.draft.slice(0,r),c=t.draft.slice(a);t.onDraftChange(u+i+c);const l=s==null?void 0:s.querySelector(".emoji-picker-popup"),d=s==null?void 0:s.querySelector(".chat-compose__emoji");l==null||l.classList.remove("active"),d==null||d.classList.remove("active"),requestAnimationFrame(()=>{o.focus();const h=r+i.length;o.setSelectionRange(h,h)})}function Hy(e){const t=e.attachments??[];return t.length===0?k:p`
2259
2256
  <div class="chat-attachments">
2260
2257
  ${t.map(n=>{var i;return n.fileName?p`
2261
2258
  <div class="chat-attachment chat-attachment--file">
2262
- <span class="chat-attachment__icon">${(i=n.mimeType)!=null&&i.startsWith("video/")?D.film:D.fileText}</span>
2259
+ <span class="chat-attachment__icon">${(i=n.mimeType)!=null&&i.startsWith("video/")?N.film:N.fileText}</span>
2263
2260
  <span class="chat-attachment__name" title=${n.fileName}>${n.fileName}</span>
2264
2261
  <button
2265
2262
  class="chat-attachment__remove chat-attachment__remove--file"
@@ -2267,7 +2264,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
2267
2264
  aria-label="Remove attachment"
2268
2265
  @click=${()=>{var o;const s=(e.attachments??[]).filter(r=>r.id!==n.id);(o=e.onAttachmentsChange)==null||o.call(e,s)}}
2269
2266
  >
2270
- ${D.x}
2267
+ ${N.x}
2271
2268
  </button>
2272
2269
  </div>
2273
2270
  `:p`
@@ -2283,7 +2280,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
2283
2280
  aria-label="Remove attachment"
2284
2281
  @click=${()=>{var o;const s=(e.attachments??[]).filter(r=>r.id!==n.id);(o=e.onAttachmentsChange)==null||o.call(e,s)}}
2285
2282
  >
2286
- ${D.x}
2283
+ ${N.x}
2287
2284
  </button>
2288
2285
  </div>
2289
2286
  `})}
@@ -2296,7 +2293,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
2296
2293
  @scroll=${e.onChatScroll}
2297
2294
  >
2298
2295
  ${e.hasMore?p`<div class="chat-load-more">
2299
- ${e.loadingOlder?p`<span class="chat-load-more__spinner">${D.loader}</span> Loading older messages…`:p`<button class="chat-load-more__btn" type="button" @click=${e.onLoadOlder}>Load older messages</button>`}
2296
+ ${e.loadingOlder?p`<span class="chat-load-more__spinner">${N.loader}</span> Loading older messages…`:p`<button class="chat-load-more__btn" type="button" @click=${e.onLoadOlder}>Load older messages</button>`}
2300
2297
  </div>`:k}
2301
2298
  ${e.loading?p`<div class="muted">Loading chat…</div>`:k}
2302
2299
  ${Ef(Zy(e),b=>b.key,b=>b.kind==="interim"?Yg(b.text):b.kind==="reading-indicator"?Qg():b.kind==="stream"?Xg(b.text,b.startedAt,e.onOpenSidebar):b.kind==="group"?Zg(b,{onOpenSidebar:e.onOpenSidebar,showReasoning:r,assistantName:e.assistantName}):k)}
@@ -2322,7 +2319,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
2322
2319
  aria-label="Exit focus mode"
2323
2320
  title="Exit focus mode"
2324
2321
  >
2325
- ${D.x}
2322
+ ${N.x}
2326
2323
  </button>
2327
2324
  `:k}
2328
2325
 
@@ -2342,7 +2339,7 @@ For details see: https://github.com/nolanlawson/emoji-picker-element/issues/514`
2342
2339
  aria-label="Scroll to bottom"
2343
2340
  title="Scroll to bottom"
2344
2341
  >
2345
- ${D.chevronDown}
2342
+ ${N.chevronDown}
2346
2343
  </button>
2347
2344
  `:k}
2348
2345
  </div>
@@ -2382,7 +2379,7 @@ ${e.sidebarContent}
2382
2379
  aria-label="Emoji"
2383
2380
  title="Emoji"
2384
2381
  >
2385
- ${D.smile}
2382
+ ${N.smile}
2386
2383
  </button>
2387
2384
  <button
2388
2385
  class="chat-compose__attach"
@@ -2391,7 +2388,7 @@ ${e.sidebarContent}
2391
2388
  aria-label="Attach file"
2392
2389
  title="Attach file"
2393
2390
  >
2394
- ${D.paperclip}
2391
+ ${N.paperclip}
2395
2392
  </button>
2396
2393
  <input
2397
2394
  class="chat-compose__file-input"
@@ -2419,7 +2416,7 @@ ${e.sidebarContent}
2419
2416
  aria-label="Stop"
2420
2417
  title="Stop generating"
2421
2418
  >
2422
- ${D.square}
2419
+ ${N.square}
2423
2420
  </button>
2424
2421
  `:k}
2425
2422
  <button
@@ -2429,7 +2426,7 @@ ${e.sidebarContent}
2429
2426
  aria-label="${n?"Queue":"Send"}"
2430
2427
  title="${n?"Queue message":"Send (Enter)"}"
2431
2428
  >
2432
- ${D.send}
2429
+ ${N.send}
2433
2430
  </button>
2434
2431
  </div>
2435
2432
  <div class="emoji-picker-popup">
@@ -2475,7 +2472,7 @@ ${e.sidebarContent}
2475
2472
  aria-label="Message settings"
2476
2473
  title="Message settings"
2477
2474
  >
2478
- ${D.slidersHorizontal}
2475
+ ${N.slidersHorizontal}
2479
2476
  </button>
2480
2477
  <div class="chat-settings-menu">
2481
2478
  <label class="chat-settings-menu__item">
@@ -3504,7 +3501,7 @@ ${r.text}`:a.join(", "):r.text;t.push({kind:"message",key:`queue:${r.id}`,messag
3504
3501
  <p>Connecting...</p>
3505
3502
  </div>
3506
3503
  </div>
3507
- `;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return za({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(d,h)=>{h!=null&&e.handlePinSubmit(d,h)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(d,h,v)=>e.handleChangePin(d,h,v)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return za({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:d=>e.handleSetMasterPin(d)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",k}if(e.setup){const l=_b(e.channelsSnapshot),d=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],h=Mb(e.channelsSnapshot),v=Pb(e);return gf({connected:e.connected,serverPlatform:((s=(i=e.hello)==null?void 0:i.server)==null?void 0:s.platform)??null,assistantName:e.assistantName,currentStep:e.setupStep,licenseKey:e.licenseKey,licenseBusy:e.licenseBusy,licenseValid:e.licenseValid,licenseMessage:e.licenseMessage,licenseTier:e.licenseTier,licenseDeviceId:e.licenseDeviceId,licenseStoredKey:e.licenseStoredKey,onLicenseKeyChange:f=>e.handleLicenseKeyChange(f),onLicenseActivate:()=>e.handleLicenseActivate(),onLicenseRemove:async()=>{await e.handleLicenseRemove(),e.licenseRemoveConfirm=!1},licenseRemoveConfirm:e.licenseRemoveConfirm,onLicenseRemoveConfirm:()=>{e.licenseRemoveConfirm=!0},onLicenseRemoveCancel:()=>{e.licenseRemoveConfirm=!1},authConnected:e.authConnected,authBusy:e.authBusy,authMessage:e.authMessage,authUrl:e.authUrl,authCodeInput:e.authCodeInput,authExpiresIn:e.authExpiresIn,whatsappBusy:e.whatsappBusy,whatsappLoginMessage:e.whatsappLoginMessage,whatsappLoginQrDataUrl:e.whatsappLoginQrDataUrl,whatsappLoginConnected:e.whatsappLoginConnected,whatsappChannelStatus:l,whatsappAccounts:d,whatsappActiveQrAccountId:e.whatsappActiveQrAccountId,whatsappAccountSaving:e.whatsappAccountSaving,gatewayHealthy:e.gatewayHealthy,gatewayHealthLoading:e.gatewayHealthLoading,gatewayHealthMessage:e.gatewayHealthMessage,gatewayRestartBusy:e.gatewayRestartBusy,updateAvailable:e.updateAvailable,currentVersion:e.currentVersion,latestVersion:e.latestVersion,updateChecking:e.updateChecking,updateRunning:e.updateRunning,updateMessage:e.updateMessage,updateProgressSteps:e.updateProgressSteps,updateLastResult:e.updateLastResult,onUpdateCheck:()=>e.handleUpdateCheck(),onUpdateRun:()=>e.handleUpdateRun(),onUpdateDismissResult:()=>e.handleUpdateDismissResult(),uninstallConfirm:e.uninstallConfirm,uninstallBusy:e.uninstallBusy,uninstallDone:e.uninstallDone,uninstallError:e.uninstallError,uninstallConfirmText:e.uninstallConfirmText,onUninstallConfirm:()=>e.handleUninstallConfirm(),onUninstallCancel:()=>e.handleUninstallCancel(),onUninstallConfirmTextChange:f=>e.handleUninstallConfirmTextChange(f),onUninstallRun:()=>e.handleUninstallRun(),onUninstallDismiss:()=>e.handleUninstallDismiss(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:f=>e.handleAuthSubmitCode(f),onAuthCodeChange:f=>e.handleAuthCodeChange(f),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async f=>{await e.handleWhatsAppStart(!0,f),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(f),await G(e,!0),e.requestUpdate())},onWhatsAppUnlink:async f=>{await e.handleWhatsAppLogout(f)},onWhatsAppReset:async f=>{await e.handleWhatsAppLogout(f),await e.handleWhatsAppStart(!0,f),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(f),await G(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await G(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),G(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:f=>e.handleRemoveWhatsAppAccount(f),workspaces:e.workspaces,workspacesLoading:e.workspacesLoading,workspacesError:e.workspacesError,addingWorkspace:e.addingWorkspace,newWorkspaceName:e.newWorkspaceName,newWorkspacePath:e.newWorkspacePath,workspaceSaving:e.workspaceSaving,workspaceRemoveConfirm:e.workspaceRemoveConfirm,newWorkspacePin:e.newWorkspacePin,onSetNewWorkspacePin:f=>{e.newWorkspacePin=f},onWorkspaceCreate:async(f,b)=>{const S=e.newWorkspacePin;await e.handleWorkspaceCreate(f,b),S.match(/^\d{4,6}$/)&&(await yb(e,f,S),e.newWorkspacePin="")},onWorkspaceRemove:f=>e.handleWorkspaceRemove(f),onSetAddingWorkspace:f=>{e.addingWorkspace=f},onSetNewWorkspaceName:f=>{e.newWorkspaceName=f},onSetNewWorkspacePath:f=>{e.newWorkspacePath=f},onSetWorkspaceRemoveConfirm:f=>{e.workspaceRemoveConfirm=f},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(f,b)=>e.handleWorkspaceRename(f,b),whatsappDmPolicy:(()=>{const f=oe(e),b=f==null?void 0:f.whatsappAccountId,S=b?d.find($=>$.accountId===b):d[0];return(S==null?void 0:S.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var T;const f=oe(e),b=f==null?void 0:f.whatsappAccountId,S=b?d.find(M=>M.accountId===b):d[0];if(!S)return;const A=S.dmPolicy!=null&&S.dmPolicy!=="disabled"?"disabled":"open",C=A==="open"?{dmPolicy:A,allowFrom:["*"]}:{dmPolicy:A};try{const M=await e.client.request("config.get"),R=M.config,B=(T=R==null?void 0:R.channels)==null?void 0:T.whatsapp,me=((B==null?void 0:B.accounts)??{})[S.accountId]?{channels:{whatsapp:{accounts:{[S.accountId]:C}}}}:{channels:{whatsapp:C}};await e.client.request("config.patch",{raw:JSON.stringify(me),baseHash:M.hash,note:`WhatsApp DM policy → ${A}`,skipRestart:!0}),await G(e,!1)}catch(M){console.error("DM toggle failed:",M)}},whatsappModel:(()=>{var T,M;const f=oe(e);if(!f)return null;const b=f.agents.find(R=>R.id.endsWith("-public")||R.id==="public");if(!b)return null;const S=(T=e.configSnapshot)==null?void 0:T.config,$=(M=S==null?void 0:S.agents)==null?void 0:M.list;if(!Array.isArray($))return null;const A=$.find(R=>R.id===b.id);if(!(A!=null&&A.model))return null;const C=typeof A.model=="string"?A.model:A.model.primary;return(C==null?void 0:C.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async f=>{const b=oe(e);if(!b)return;const S=b.agents.find($=>$.id.endsWith("-public")||$.id==="public");if(S)try{const $=await e.client.request("config.get"),A=$.config,C=(A==null?void 0:A.agents)??{},T=Array.isArray(C.list)?[...C.list]:[],M=T.findIndex(B=>B.id===S.id);if(f)M>=0?T[M]={...T[M],model:f}:T.push({id:S.id,model:f});else if(M>=0){const{model:B,...ee}=T[M];Object.keys(ee).length<=1?T.splice(M,1):T[M]=ee}const R=T.length>0?{agents:{list:T}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(R),baseHash:$.hash,note:`Public agent model → ${f||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Model change failed:",$)}},whatsappThinkingLevel:(()=>{var C,T,M;const f=oe(e);if(!f)return null;const b=f.agents.find(R=>R.id.endsWith("-public")||R.id==="public");if(!b)return null;const S=(C=e.configSnapshot)==null?void 0:C.config,$=(T=S==null?void 0:S.agents)==null?void 0:T.list;if(!Array.isArray($))return null;const A=$.find(R=>R.id===b.id);return((M=A==null?void 0:A.thinkingLevel)==null?void 0:M.trim())||null})(),onWhatsAppThinkingChange:async f=>{const b=oe(e);if(!b)return;const S=b.agents.find($=>$.id.endsWith("-public")||$.id==="public");if(S)try{const $=await e.client.request("config.get"),A=$.config,C=(A==null?void 0:A.agents)??{},T=Array.isArray(C.list)?[...C.list]:[],M=T.findIndex(ee=>ee.id===S.id),R=f==="off"?void 0:f;if(R)M>=0?T[M]={...T[M],thinkingLevel:R}:T.push({id:S.id,thinkingLevel:R});else if(M>=0){const{thinkingLevel:ee,...me}=T[M];Object.keys(me).length<=1?T.splice(M,1):T[M]=me}const B=T.length>0?{agents:{list:T}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(B),baseHash:$.hash,note:`Public agent thinking → ${R||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Thinking change failed:",$)}},whatsappGroupPolicy:(()=>{var M,R;const f=(M=e.configSnapshot)==null?void 0:M.config,b=(R=f==null?void 0:f.channels)==null?void 0:R.whatsapp,S=oe(e),$=S==null?void 0:S.whatsappAccountId,A=(b==null?void 0:b.accounts)??{},C=$?A[$]:void 0;return(C==null?void 0:C.groupPolicy)??(b==null?void 0:b.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var R,B;const f=(R=e.configSnapshot)==null?void 0:R.config,b=(B=f==null?void 0:f.channels)==null?void 0:B.whatsapp,S=oe(e),$=S==null?void 0:S.whatsappAccountId,A=(b==null?void 0:b.accounts)??{},C=$?A[$]:void 0,M=((C==null?void 0:C.groups)??(b==null?void 0:b.groups)??{})["*"];return(M==null?void 0:M.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var S;const f=oe(e),b=f==null?void 0:f.whatsappAccountId;try{const $=await e.client.request("config.get"),A=$.config,C=((S=A==null?void 0:A.channels)==null?void 0:S.whatsapp)??{},T=C.accounts??{},M=b?T[b]:void 0,R=(M==null?void 0:M.groupPolicy)??C.groupPolicy??"allowlist",B=R==="disabled"||R==="allowlist",ee=B?"open":"disabled",me=B?{"*":{}}:void 0,Ke={groupPolicy:ee};me&&(Ke.groups=me);const Z=M?{channels:{whatsapp:{accounts:{[b]:Ke}}}}:{channels:{whatsapp:Ke}};await e.client.request("config.patch",{raw:JSON.stringify(Z),baseHash:$.hash,note:`WhatsApp groups → ${ee}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Group toggle failed:",$)}},onWhatsAppGroupMentionChange:async f=>{var $;const b=oe(e),S=b==null?void 0:b.whatsappAccountId;try{const A=await e.client.request("config.get"),C=A.config,M=((($=C==null?void 0:C.channels)==null?void 0:$.whatsapp)??{}).accounts??{},R=S?M[S]:void 0,B={"*":{requireMention:f}},ee=R?{channels:{whatsapp:{accounts:{[S]:{groups:B}}}}}:{channels:{whatsapp:{groups:B}}};await e.client.request("config.patch",{raw:JSON.stringify(ee),baseHash:A.hash,note:`WhatsApp group mention → ${f?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(A){console.error("Group mention change failed:",A)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:h.configured,imessageRunning:h.running,imessageConnected:h.connected,imessageLastError:h.lastError,imessageSelfChatMode:h.selfChatMode,imessageCliPath:h.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:v,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,S=(b==null?void 0:b.bindings)??[],$=oe(e),A=$==null?void 0:$.agents.find(B=>B.id.endsWith("-admin")||B.id==="admin"),C=(A==null?void 0:A.id)??"admin",T=S.filter(B=>{var ee;return((ee=B.match)==null?void 0:ee.channel)!=="imessage"}),M=[{agentId:C,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],R=[...T,...M];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:R}),baseHash:f.hash,note:"Enable iMessage (self-chat) for "+(($==null?void 0:$.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([G(e,!0),Le(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await G(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,$=((b==null?void 0:b.bindings)??[]).filter(A=>{var C;return((C=A.match)==null?void 0:C.channel)!=="imessage"});await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:$}),baseHash:f.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([G(e,!0),Le(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,S=(b==null?void 0:b.bindings)??[],$=oe(e),A=$==null?void 0:$.agents.find(R=>R.id.endsWith("-admin")||R.id==="admin"),C=(A==null?void 0:A.id)??"admin",T=S.filter(R=>{var B;return((B=R.match)==null?void 0:B.channel)!=="imessage"}),M=[{agentId:C,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:[...T,...M]}),baseHash:f.hash,note:"Reassign iMessage to "+(($==null?void 0:$.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([G(e,!0),Le(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:f=>{e.infoModalOpen=f},onInfoModalClose:()=>{e.infoModalOpen=null},isMaster:e.accessState.master,apiKeyProviders:e.apiKeyProviders,apiKeyModalOpen:e.apiKeyModalOpen,apiKeyBusy:e.apiKeyBusy,apiKeyError:e.apiKeyError,apiKeySuccess:e.apiKeySuccess,apiKeySavingProvider:e.apiKeySavingProvider,onApiKeyModalOpen:()=>{e.apiKeyModalOpen=!0,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeyModalClose:()=>{e.apiKeyModalOpen=!1,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeySave:async(f,b)=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await qa(e.client,f,b);const S=`${f} key saved`;e.apiKeySuccess=S,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await eo(e.client)}catch{}f==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===S&&(e.apiKeySuccess=null)},2500)}catch(S){e.apiKeyError=S instanceof Error?S.message:"Failed to save key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async f=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Xv(e.client,f);const b=`${f} key removed`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await eo(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===b&&(e.apiKeySuccess=null)},2500)}catch(b){e.apiKeyError=b instanceof Error?b.message:"Failed to remove key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},authApiKeyMode:e.authApiKeyMode,authApiKeyInput:e.authApiKeyInput,authApiKeyBusy:e.authApiKeyBusy,authApiKeyError:e.authApiKeyError,onAuthApiKeyToggle:()=>{e.authApiKeyMode=!e.authApiKeyMode,e.authApiKeyError=null},onAuthApiKeyChange:f=>{e.authApiKeyInput=f},onAuthApiKeySubmit:async()=>{const f=e.authApiKeyInput.trim();if(f){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await qa(e.client,"anthropic",f),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(b){e.authApiKeyError=b instanceof Error?b.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{var b;const f=e.selectedWorkspace??((b=e.workspaces[0])==null?void 0:b.name);return f?e.accessState.accounts.some(S=>S.id===f):!1})(),accountPinModalOpen:e.accountPinModalOpen,accountPinBusy:e.accountPinBusy,accountPinError:e.accountPinError,accountPinSuccess:e.accountPinSuccess,onAccountPinModalOpen:()=>{e.accountPinModalOpen=!0,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinModalClose:()=>{e.accountPinModalOpen=!1,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinSave:(f,b)=>{var $;const S=e.selectedWorkspace??(($=e.workspaces[0])==null?void 0:$.name);S&&e.handleAccountPinSave(S,f,b)},publicChatEnabled:(()=>{var S;const f=(S=e.configSnapshot)==null?void 0:S.config,b=f==null?void 0:f.publicChat;return(b==null?void 0:b.enabled)===!0})(),publicChatAuthMode:(()=>{var $;const f=($=e.configSnapshot)==null?void 0:$.config,b=f==null?void 0:f.publicChat,S=b==null?void 0:b.auth;return S==="verified"||S==="choice"?S:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var f;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get"),S=b.config,$=((f=S==null?void 0:S.publicChat)==null?void 0:f.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!$}}),baseHash:b.hash,note:`Public chat → ${$?"disabled":"enabled"}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat toggle failed:",b)}finally{e.publicChatToggleBusy=!1}}},onPublicChatAuthModeChange:async f=>{if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get");await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{auth:f}}),baseHash:b.hash,note:`Public chat auth → ${f}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat auth mode change failed:",b)}finally{e.publicChatToggleBusy=!1}}},tailscaleStatus:e.tailscaleStatus,tailscaleBusy:e.tailscaleBusy,tailscaleAuthUrl:e.tailscaleAuthUrl,tailscaleError:e.tailscaleError,tailscaleFunnelEnableUrl:e.tailscaleFunnelEnableUrl,onTailscaleEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleAuthUrl=null;try{const f=await e.client.request("tailscale.enable");if(f.authUrl){e.tailscaleAuthUrl=f.authUrl;const b=setInterval(async()=>{try{const S=await e.client.request("tailscale.status");e.tailscaleStatus=S,S.loggedIn&&(clearInterval(b),e.tailscaleAuthUrl=null,e.tailscaleBusy=!1)}catch{}},3e3);setTimeout(()=>{clearInterval(b),e.tailscaleBusy&&(e.tailscaleBusy=!1)},3e5)}else f.alreadyLoggedIn&&(e.tailscaleStatus=await e.client.request("tailscale.status")),e.tailscaleBusy=!1}catch(f){console.error("Tailscale enable failed:",f),e.tailscaleBusy=!1}}},onTailscaleFunnelEnable:async()=>{var f;if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null,e.tailscaleFunnelEnableUrl=null;try{await e.client.request("tailscale.funnel.enable")}catch(b){console.error("Tailscale funnel enable failed:",b);const S=b;(f=S.payload)!=null&&f.enableUrl&&(e.tailscaleFunnelEnableUrl=S.payload.enableUrl),e.tailscaleError=S.message||"Failed to enable Funnel",e.tailscaleBusy=!1}}},onTailscaleFunnelDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.funnel.disable")}catch(f){console.error("Tailscale funnel disable failed:",f),e.tailscaleBusy=!1}}},wifiStatus:e.wifiStatus,wifiNetworks:e.wifiNetworks,wifiBusy:e.wifiBusy,wifiError:e.wifiError,wifiPassword:e.wifiPassword,wifiSelectedSsid:e.wifiSelectedSsid,onWifiScan:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{const[f,b]=await Promise.all([e.client.request("wifi.scan"),e.client.request("wifi.status")]);e.wifiNetworks=f.networks,e.wifiStatus=b}catch(f){console.error("WiFi scan failed:",f),e.wifiError=f.message||"Failed to scan networks"}finally{e.wifiBusy=!1}}},onWifiConnect:async()=>{if(!(e.wifiBusy||!e.wifiSelectedSsid)){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.connect",{ssid:e.wifiSelectedSsid,password:e.wifiPassword}),e.wifiPassword="",e.wifiSelectedSsid=null,e.wifiNetworks=[];const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi connect failed:",f),e.wifiError=f.message||"Failed to connect"}finally{e.wifiBusy=!1}}},onWifiDisconnect:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.disconnect"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi disconnect failed:",f),e.wifiError=f.message||"Failed to disconnect"}finally{e.wifiBusy=!1}}},onWifiReconnect:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.reconnect"),e.wifiNetworks=[],e.wifiSelectedSsid=null;const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi reconnect failed:",f),e.wifiError=f.message||"Failed to reconnect"}finally{e.wifiBusy=!1}}},onWifiForget:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.forget"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi forget failed:",f),e.wifiError=f.message||"Failed to forget network"}finally{e.wifiBusy=!1}}},onWifiDismiss:()=>{e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="",e.wifiError=null},onWifiSelectSsid:f=>{e.wifiSelectedSsid=f,e.wifiPassword="",e.wifiError=null},onWifiPasswordChange:f=>{e.wifiPassword=f},wsProps:Sb(e)})}if(e.filesPage){const l=Ab(e);return Jh({connected:e.connected,wsProps:sn(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,currentDir:e.filesCurrentDir,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>Ut(e,l),onReindex:()=>dh(e,l),onSelectFile:d=>{e.filesPendingDeletePath=null,ih(e,d,l)},onToggleSelectFile:d=>sh(e,d,l),onToggleDir:d=>ph(e,d),onUpload:(d,h)=>ah(e,d,h,l),onNewFolder:(d,h)=>lh(e,d,h,l),onDownload:d=>oc(e,d,l),onBulkDownload:()=>oh(e,l),onDelete:d=>{e.filesPendingDeletePath=null,ch(e,d,l)},pendingDeletePath:e.filesPendingDeletePath,onArmDelete:d=>{e.filesPendingDeletePath=d||null},onMoveToDir:(d,h)=>rh(e,d,h,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:d=>{const h=e.filesSearchAgentId??l;hh(e,d,h)},onSearchAgentChange:d=>{e.filesSearchAgentId=d},onSearchClear:()=>{fh(e)},onSearchQueryChange:d=>{e.filesSearchQuery=d}})}if(e.browserPage)return Vh({connected:e.connected,active:e.browserScreencastActive,loading:e.browserLoading,error:e.browserError,inputMode:e.browserInputMode,fullscreen:e.browserFullscreen,handoffPending:e.browserHandoffPending,handoffReason:e.browserHandoffReason,onStart:()=>zv(e),onStop:()=>jv(e),onToggleInput:()=>qv(e),onToggleFullscreen:()=>Vv(e),onCompleteHandoff:()=>Hv(e),onCanvasMouseDown:l=>{const h=l.target.getBoundingClientRect(),f=hn().translateCoordinates(l.clientX-h.left,l.clientY-h.top);xs(e,"mousePressed",f.x,f.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const h=l.target.getBoundingClientRect(),f=hn().translateCoordinates(l.clientX-h.left,l.clientY-h.top);xs(e,"mouseReleased",f.x,f.y)},onCanvasMouseMove:l=>{const d=hn();if(d.shouldThrottleMouseMove())return;const v=l.target.getBoundingClientRect(),f=d.translateCoordinates(l.clientX-v.left,l.clientY-v.top);xs(e,"mouseMoved",f.x,f.y)},onCanvasKeyDown:l=>{let d=0;l.altKey&&(d|=1),l.ctrlKey&&(d|=2),l.metaKey&&(d|=4),l.shiftKey&&(d|=8),$s(e,"keyDown",l.key,{code:l.code,modifiers:d||void 0}),l.key.length===1&&$s(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{$s(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=xb(e),d=$b(e);return yf({connected:e.connected,wsProps:sn(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>Ii(e,l),onAdd:h=>{xu(e,h,l,d).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:h=>$u(e,h,l,d),onNewPhoneChange:h=>e.handleAdminsNewPhoneChange(h)})}if(e.contactsPage){const l=Eb(e);return kf({connected:e.connected,wsProps:sn(e),loading:e.contactsLoading,saving:e.contactsSaving,records:e.contactsRecords,error:e.contactsError,searchQuery:e.contactsSearchQuery,editingId:e.contactsEditingId,showAddForm:e.contactsShowAddForm,newRecordPhone:e.contactsNewPhone,newRecordName:e.contactsNewName,onSearch:d=>e.contactsSearchQuery=d,onSearchSubmit:()=>yt(e,l),onAdd:(d,h)=>Au(e,d,h,l),onDelete:d=>Eu(e,d,l),onSetField:(d,h,v)=>Cu(e,d,h,v,l),onDeleteField:(d,h)=>Tu(e,d,h,l),onToggleExpand:d=>{e.contactsEditingId=e.contactsEditingId===d?null:d},onShowAddForm:()=>e.contactsShowAddForm=!0,onCancelAddForm:()=>{e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName=""},onNewRecordPhoneChange:d=>e.handleContactsNewPhoneChange(d),onNewRecordNameChange:d=>e.handleContactsNewNameChange(d),onRefresh:()=>yt(e,l)})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",d=el(e),h=e.chatAvatarUrl??d??null,v=(()=>{var S;const f=(S=e.configSnapshot)==null?void 0:S.config,b=f==null?void 0:f.publicChat;return(b==null?void 0:b.enabled)===!0})();return ev({connected:e.connected,wsProps:sn(e),publicChatEnabled:v,publicChatAccountId:e.selectedWorkspace??void 0,sessionKey:e.sessionKey,onSessionKeyChange:f=>{e.sessionKey=f,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatInterimText=null,e.chatSuggestion=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:f,lastActiveSessionKey:f}),e.loadAssistantIdentity(),Me(e),Ds(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:f=>{const b=Math.max(e.chatMessages.length+10,Pe);Rn(e,e.sessionKey,{model:f}).then(()=>{Me(e,{limit:b})})},onThinkingLevelChange:f=>{const b=Math.max(e.chatMessages.length+10,Pe);Rn(e,e.sessionKey,{thinkingLevel:f==="off"?null:f}).then(()=>{Me(e,{limit:b})})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:f=>{e.chatMessage=f,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:f=>{const b=Math.max(e.chatMessages.length+10,Pe);Rn(e,e.sessionKey,{verboseLevel:f==="off"?null:f}).then(()=>{Me(e,{limit:b})})},onFillerChange:f=>{const b=Math.max(e.chatMessages.length+10,Pe);Rn(e,e.sessionKey,{fillerEnabled:f}).then(()=>{Me(e,{limit:b})})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:h,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:!1,onRefresh:()=>{e.resetToolStream();const f=Math.max(e.chatMessages.length+10,Pe);return Promise.all([Me(e,{limit:f}),Ds(e)])},onToggleFocusMode:()=>{},onChatScroll:f=>e.handleChatScroll(f),nearBottom:e.chatUserNearBottom,hasMore:e.chatHistoryHasMore,loadingOlder:e.chatLoadingOlder,onLoadOlder:()=>{e.handleLoadOlderChat()},onDraftChange:f=>e.chatMessage=f,attachments:e.chatAttachments,onAttachmentsChange:f=>e.chatAttachments=f,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:f=>e.removeQueuedMessage(f),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:f=>e.handleOpenSidebar(f),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:f=>e.handleSplitRatioChange(f),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?Mv({connected:e.connected,wsProps:sn(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&ft(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?un(e,{reset:!0}):Pt(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(r=(o=e.channelsSnapshot)==null?void 0:o.channelMeta)!=null&&r.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((a=e.channelsSnapshot)==null?void 0:a.channelOrder)??[],channelLabels:((u=e.channelsSnapshot)==null?void 0:u.channelLabels)??{},channelMeta:((c=e.channelsSnapshot)==null?void 0:c.channelMeta)??[],agentIds:(()=>{var d;const l=oe(e);return((d=l==null?void 0:l.agents)==null?void 0:d.map(h=>h.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1},detailJobId:e.cronDetailJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,Ps(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{rp(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,d)=>ap(e,l,d),onRun:l=>lp(e,l),onRemove:l=>cp(e,l),onLoadRuns:l=>Ps(e,l)},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:l=>e.skillsFilter=l,onRefresh:()=>ft(e,{clearMessages:!0}),onToggle:(l,d)=>Yl(e,l,d),onEdit:(l,d)=>Ql(e,l,d),onSaveKey:l=>Xl(e,l),onInstall:(l,d,h)=>Zl(e,l,d,h)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?un(e,{reset:!0}):Pt(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,d)=>{const h=e;h.sessionLogsTypeFilters={...h.sessionLogsTypeFilters,[l]:d}},onAgentToggle:(l,d)=>{const h=e;h.sessionLogsAgentFilters={...h.sessionLogsAgentFilters,[l]:d}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onRefresh:()=>{un(e,{reset:!0})},onExport:(l,d)=>e.exportSessionLogs(l,d),onScroll:l=>e.handleSessionLogsScroll(l)},loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:l=>e.logsFilterText=l,onLevelToggle:(l,d)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:d}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onRefresh:()=>Pt(e,{reset:!0}),onExport:(l,d)=>e.exportSessionLogs(l,d),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),p``)}function Ib(e){const t=new Date(e),n=t.toLocaleDateString("en-GB",{day:"2-digit",month:"short"}),i=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return`${n} ${i}`}function tl(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function Rb(e,t,n){return p`
3504
+ `;if(e.connected&&e.accessState.checked){const{accessState:l}=e;if(l.hasPins&&!l.authenticated)return za({show:!0,isFirstTime:!1,accounts:l.accounts,error:l.error,busy:l.busy,onSubmit:(d,h)=>{h!=null&&e.handlePinSubmit(d,h)},changePinMode:e.loginChangePinMode,onToggleChangePinMode:()=>e.toggleChangePinMode(),changePinBusy:e.changePinBusy,changePinError:e.changePinError,changePinSuccess:e.changePinSuccess,onChangePin:(d,h,v)=>e.handleChangePin(d,h,v)});if(!l.hasMasterPin&&!l.authenticated&&e.setup)return za({show:!0,isFirstTime:!0,accounts:[],error:l.error,busy:l.busy,onSubmit:d=>e.handleSetMasterPin(d)});if(!l.hasMasterPin&&!l.authenticated&&!e.setup)return window.location.href="/setup",k}if(e.setup){const l=_b(e.channelsSnapshot),d=((n=(t=e.channelsSnapshot)==null?void 0:t.channelAccounts)==null?void 0:n.whatsapp)??[],h=Mb(e.channelsSnapshot),v=Pb(e);return gf({connected:e.connected,serverPlatform:((s=(i=e.hello)==null?void 0:i.server)==null?void 0:s.platform)??null,assistantName:e.assistantName,currentStep:e.setupStep,licenseKey:e.licenseKey,licenseBusy:e.licenseBusy,licenseValid:e.licenseValid,licenseMessage:e.licenseMessage,licenseTier:e.licenseTier,licenseDeviceId:e.licenseDeviceId,licenseStoredKey:e.licenseStoredKey,onLicenseKeyChange:f=>e.handleLicenseKeyChange(f),onLicenseActivate:()=>e.handleLicenseActivate(),onLicenseRemove:async()=>{await e.handleLicenseRemove(),e.licenseRemoveConfirm=!1},licenseRemoveConfirm:e.licenseRemoveConfirm,onLicenseRemoveConfirm:()=>{e.licenseRemoveConfirm=!0},onLicenseRemoveCancel:()=>{e.licenseRemoveConfirm=!1},authConnected:e.authConnected,authBusy:e.authBusy,authMessage:e.authMessage,authUrl:e.authUrl,authCodeInput:e.authCodeInput,authExpiresIn:e.authExpiresIn,whatsappBusy:e.whatsappBusy,whatsappLoginMessage:e.whatsappLoginMessage,whatsappLoginQrDataUrl:e.whatsappLoginQrDataUrl,whatsappLoginConnected:e.whatsappLoginConnected,whatsappChannelStatus:l,whatsappAccounts:d,whatsappActiveQrAccountId:e.whatsappActiveQrAccountId,whatsappAccountSaving:e.whatsappAccountSaving,gatewayHealthy:e.gatewayHealthy,gatewayHealthLoading:e.gatewayHealthLoading,gatewayHealthMessage:e.gatewayHealthMessage,gatewayRestartBusy:e.gatewayRestartBusy,updateAvailable:e.updateAvailable,currentVersion:e.currentVersion,latestVersion:e.latestVersion,updateChecking:e.updateChecking,updateRunning:e.updateRunning,updateMessage:e.updateMessage,updateProgressSteps:e.updateProgressSteps,updateLastResult:e.updateLastResult,onUpdateCheck:()=>e.handleUpdateCheck(),onUpdateRun:()=>e.handleUpdateRun(),onUpdateDismissResult:()=>e.handleUpdateDismissResult(),uninstallConfirm:e.uninstallConfirm,uninstallBusy:e.uninstallBusy,uninstallDone:e.uninstallDone,uninstallError:e.uninstallError,uninstallConfirmText:e.uninstallConfirmText,onUninstallConfirm:()=>e.handleUninstallConfirm(),onUninstallCancel:()=>e.handleUninstallCancel(),onUninstallConfirmTextChange:f=>e.handleUninstallConfirmTextChange(f),onUninstallRun:()=>e.handleUninstallRun(),onUninstallDismiss:()=>e.handleUninstallDismiss(),onStartAuth:()=>e.handleAuthStart(),onSubmitAuthCode:f=>e.handleAuthSubmitCode(f),onAuthCodeChange:f=>e.handleAuthCodeChange(f),onSkipToWhatsApp:()=>e.handleSkipToWhatsApp(),onWhatsAppRelink:async f=>{await e.handleWhatsAppStart(!0,f),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(f),await G(e,!0),e.requestUpdate())},onWhatsAppUnlink:async f=>{await e.handleWhatsAppLogout(f)},onWhatsAppReset:async f=>{await e.handleWhatsAppLogout(f),await e.handleWhatsAppStart(!0,f),e.whatsappLoginQrDataUrl&&(await e.handleWhatsAppWait(f),await G(e,!0),e.requestUpdate())},onRefreshStatus:async()=>{await G(e,!0),await e.handleGatewayHealthCheck()},onWhatsAppBack:()=>{e.whatsappLoginQrDataUrl=null,e.whatsappLoginMessage=null,e.whatsappLoginConnected=null,e.whatsappActiveQrAccountId=null,e.requestUpdate(),G(e,!0)},onRestartGateway:()=>e.handleGatewayRestart(),onRemoveWhatsAppAccount:f=>e.handleRemoveWhatsAppAccount(f),workspaces:e.workspaces,workspacesLoading:e.workspacesLoading,workspacesError:e.workspacesError,addingWorkspace:e.addingWorkspace,newWorkspaceName:e.newWorkspaceName,newWorkspacePath:e.newWorkspacePath,workspaceSaving:e.workspaceSaving,workspaceRemoveConfirm:e.workspaceRemoveConfirm,newWorkspacePin:e.newWorkspacePin,onSetNewWorkspacePin:f=>{e.newWorkspacePin=f},onWorkspaceCreate:async(f,b)=>{const S=e.newWorkspacePin;await e.handleWorkspaceCreate(f,b),S.match(/^\d{4,6}$/)&&(await yb(e,f,S),e.newWorkspacePin="")},onWorkspaceRemove:f=>e.handleWorkspaceRemove(f),onSetAddingWorkspace:f=>{e.addingWorkspace=f},onSetNewWorkspaceName:f=>{e.newWorkspaceName=f},onSetNewWorkspacePath:f=>{e.newWorkspacePath=f},onSetWorkspaceRemoveConfirm:f=>{e.workspaceRemoveConfirm=f},renamingWorkspace:e.renamingWorkspace,renameWorkspaceName:e.renameWorkspaceName,onWorkspaceRenameStart:()=>e.handleWorkspaceRenameStart(),onWorkspaceRenameCancel:()=>e.handleWorkspaceRenameCancel(),onWorkspaceRename:(f,b)=>e.handleWorkspaceRename(f,b),whatsappDmPolicy:(()=>{const f=oe(e),b=f==null?void 0:f.whatsappAccountId,S=b?d.find($=>$.accountId===b):d[0];return(S==null?void 0:S.dmPolicy)??null})(),onWhatsAppDmToggle:async()=>{var T;const f=oe(e),b=f==null?void 0:f.whatsappAccountId,S=b?d.find(M=>M.accountId===b):d[0];if(!S)return;const A=S.dmPolicy!=null&&S.dmPolicy!=="disabled"?"disabled":"open",C=A==="open"?{dmPolicy:A,allowFrom:["*"]}:{dmPolicy:A};try{const M=await e.client.request("config.get"),R=M.config,B=(T=R==null?void 0:R.channels)==null?void 0:T.whatsapp,me=((B==null?void 0:B.accounts)??{})[S.accountId]?{channels:{whatsapp:{accounts:{[S.accountId]:C}}}}:{channels:{whatsapp:C}};await e.client.request("config.patch",{raw:JSON.stringify(me),baseHash:M.hash,note:`WhatsApp DM policy → ${A}`,skipRestart:!0}),await G(e,!1)}catch(M){console.error("DM toggle failed:",M)}},whatsappModel:(()=>{var T,M;const f=oe(e);if(!f)return null;const b=f.agents.find(R=>R.id.endsWith("-public")||R.id==="public");if(!b)return null;const S=(T=e.configSnapshot)==null?void 0:T.config,$=(M=S==null?void 0:S.agents)==null?void 0:M.list;if(!Array.isArray($))return null;const A=$.find(R=>R.id===b.id);if(!(A!=null&&A.model))return null;const C=typeof A.model=="string"?A.model:A.model.primary;return(C==null?void 0:C.trim())||null})(),whatsappModelCatalog:e.chatModelCatalog??[],onWhatsAppModelChange:async f=>{const b=oe(e);if(!b)return;const S=b.agents.find($=>$.id.endsWith("-public")||$.id==="public");if(S)try{const $=await e.client.request("config.get"),A=$.config,C=(A==null?void 0:A.agents)??{},T=Array.isArray(C.list)?[...C.list]:[],M=T.findIndex(B=>B.id===S.id);if(f)M>=0?T[M]={...T[M],model:f}:T.push({id:S.id,model:f});else if(M>=0){const{model:B,...ee}=T[M];Object.keys(ee).length<=1?T.splice(M,1):T[M]=ee}const R=T.length>0?{agents:{list:T}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(R),baseHash:$.hash,note:`Public agent model → ${f||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Model change failed:",$)}},whatsappThinkingLevel:(()=>{var C,T,M;const f=oe(e);if(!f)return null;const b=f.agents.find(R=>R.id.endsWith("-public")||R.id==="public");if(!b)return null;const S=(C=e.configSnapshot)==null?void 0:C.config,$=(T=S==null?void 0:S.agents)==null?void 0:T.list;if(!Array.isArray($))return null;const A=$.find(R=>R.id===b.id);return((M=A==null?void 0:A.thinkingLevel)==null?void 0:M.trim())||null})(),onWhatsAppThinkingChange:async f=>{const b=oe(e);if(!b)return;const S=b.agents.find($=>$.id.endsWith("-public")||$.id==="public");if(S)try{const $=await e.client.request("config.get"),A=$.config,C=(A==null?void 0:A.agents)??{},T=Array.isArray(C.list)?[...C.list]:[],M=T.findIndex(ee=>ee.id===S.id),R=f==="off"?void 0:f;if(R)M>=0?T[M]={...T[M],thinkingLevel:R}:T.push({id:S.id,thinkingLevel:R});else if(M>=0){const{thinkingLevel:ee,...me}=T[M];Object.keys(me).length<=1?T.splice(M,1):T[M]=me}const B=T.length>0?{agents:{list:T}}:{agents:{list:null}};await e.client.request("config.patch",{raw:JSON.stringify(B),baseHash:$.hash,note:`Public agent thinking → ${R||"default"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Thinking change failed:",$)}},whatsappGroupPolicy:(()=>{var M,R;const f=(M=e.configSnapshot)==null?void 0:M.config,b=(R=f==null?void 0:f.channels)==null?void 0:R.whatsapp,S=oe(e),$=S==null?void 0:S.whatsappAccountId,A=(b==null?void 0:b.accounts)??{},C=$?A[$]:void 0;return(C==null?void 0:C.groupPolicy)??(b==null?void 0:b.groupPolicy)??"allowlist"})(),whatsappGroupRequireMention:(()=>{var R,B;const f=(R=e.configSnapshot)==null?void 0:R.config,b=(B=f==null?void 0:f.channels)==null?void 0:B.whatsapp,S=oe(e),$=S==null?void 0:S.whatsappAccountId,A=(b==null?void 0:b.accounts)??{},C=$?A[$]:void 0,M=((C==null?void 0:C.groups)??(b==null?void 0:b.groups)??{})["*"];return(M==null?void 0:M.requireMention)!==!1})(),onWhatsAppGroupToggle:async()=>{var S;const f=oe(e),b=f==null?void 0:f.whatsappAccountId;try{const $=await e.client.request("config.get"),A=$.config,C=((S=A==null?void 0:A.channels)==null?void 0:S.whatsapp)??{},T=C.accounts??{},M=b?T[b]:void 0,R=(M==null?void 0:M.groupPolicy)??C.groupPolicy??"allowlist",B=R==="disabled"||R==="allowlist",ee=B?"open":"disabled",me=B?{"*":{}}:void 0,Ke={groupPolicy:ee};me&&(Ke.groups=me);const Z=M?{channels:{whatsapp:{accounts:{[b]:Ke}}}}:{channels:{whatsapp:Ke}};await e.client.request("config.patch",{raw:JSON.stringify(Z),baseHash:$.hash,note:`WhatsApp groups → ${ee}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch($){console.error("Group toggle failed:",$)}},onWhatsAppGroupMentionChange:async f=>{var $;const b=oe(e),S=b==null?void 0:b.whatsappAccountId;try{const A=await e.client.request("config.get"),C=A.config,M=((($=C==null?void 0:C.channels)==null?void 0:$.whatsapp)??{}).accounts??{},R=S?M[S]:void 0,B={"*":{requireMention:f}},ee=R?{channels:{whatsapp:{accounts:{[S]:{groups:B}}}}}:{channels:{whatsapp:{groups:B}}};await e.client.request("config.patch",{raw:JSON.stringify(ee),baseHash:A.hash,note:`WhatsApp group mention → ${f?"when mentioned":"always"}`,skipRestart:!0}),e.configSnapshot=await e.client.request("config.get")}catch(A){console.error("Group mention change failed:",A)}},whatsappSettingsOpen:e.whatsappSettingsOpen??!1,onWhatsAppSettingsOpen:()=>{e.whatsappSettingsOpen=!0},onWhatsAppSettingsClose:()=>{e.whatsappSettingsOpen=!1},imessageConfigured:h.configured,imessageRunning:h.running,imessageConnected:h.connected,imessageLastError:h.lastError,imessageSelfChatMode:h.selfChatMode,imessageCliPath:h.cliPath,imessageEnabling:e.imessageEnabling,imessageEnableConfirm:e.imessageEnableConfirm,imessageOwnerWorkspace:v,onIMessageEnable:()=>{e.imessageEnableConfirm=!0},onIMessageEnableConfirm:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,S=(b==null?void 0:b.bindings)??[],$=oe(e),A=$==null?void 0:$.agents.find(B=>B.id.endsWith("-admin")||B.id==="admin"),C=(A==null?void 0:A.id)??"admin",T=S.filter(B=>{var ee;return((ee=B.match)==null?void 0:ee.channel)!=="imessage"}),M=[{agentId:C,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}],R=[...T,...M];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:R}),baseHash:f.hash,note:"Enable iMessage (self-chat) for "+(($==null?void 0:$.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([G(e,!0),Le(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageEnableCancel:()=>{e.imessageEnableConfirm=!1},onIMessageProbe:async()=>{e.imessageEnabling=!0,e.requestUpdate();try{await G(e,!0)}finally{e.imessageEnabling=!1}},onIMessageDisconnect:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,$=((b==null?void 0:b.bindings)??[]).filter(A=>{var C;return((C=A.match)==null?void 0:C.channel)!=="imessage"});await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!1,dmPolicy:"disabled"}},bindings:$}),baseHash:f.hash,note:"Disconnect iMessage"}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([G(e,!0),Le(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},onIMessageReassign:async()=>{e.imessageEnabling=!0;try{const f=await e.client.request("config.get"),b=f.config,S=(b==null?void 0:b.bindings)??[],$=oe(e),A=$==null?void 0:$.agents.find(R=>R.id.endsWith("-admin")||R.id==="admin"),C=(A==null?void 0:A.id)??"admin",T=S.filter(R=>{var B;return((B=R.match)==null?void 0:B.channel)!=="imessage"}),M=[{agentId:C,match:{channel:"imessage",peer:{kind:"dm",id:"__self__"}},meta:{imessageOwner:!0}}];await e.client.request("config.patch",{raw:JSON.stringify({channels:{imessage:{selfChatMode:!0,dmPolicy:"disabled",allowFrom:["*"]}},bindings:[...T,...M]}),baseHash:f.hash,note:"Reassign iMessage to "+(($==null?void 0:$.name)??"default")}),e.imessageEnableConfirm=!1,setTimeout(()=>{Promise.all([G(e,!0),Le(e)]).then(()=>{e.imessageEnabling=!1})},3e3)}catch{e.imessageEnabling=!1}},infoModalOpen:e.infoModalOpen,onInfoModalOpen:f=>{e.infoModalOpen=f},onInfoModalClose:()=>{e.infoModalOpen=null},isMaster:e.accessState.master,apiKeyProviders:e.apiKeyProviders,apiKeyModalOpen:e.apiKeyModalOpen,apiKeyBusy:e.apiKeyBusy,apiKeyError:e.apiKeyError,apiKeySuccess:e.apiKeySuccess,apiKeySavingProvider:e.apiKeySavingProvider,onApiKeyModalOpen:()=>{e.apiKeyModalOpen=!0,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeyModalClose:()=>{e.apiKeyModalOpen=!1,e.apiKeyError=null,e.apiKeySuccess=null,e.apiKeySavingProvider=null},onApiKeySave:async(f,b)=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await qa(e.client,f,b);const S=`${f} key saved`;e.apiKeySuccess=S,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await eo(e.client)}catch{}f==="anthropic"&&await e.handleAuthStatusCheck(),setTimeout(()=>{e.apiKeySuccess===S&&(e.apiKeySuccess=null)},2500)}catch(S){e.apiKeyError=S instanceof Error?S.message:"Failed to save key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},onApiKeyRemove:async f=>{e.apiKeySavingProvider=f,e.apiKeyBusy=!0,e.apiKeyError=null,e.apiKeySuccess=null;try{await Xv(e.client,f);const b=`${f} key removed`;e.apiKeySuccess=b,e.apiKeySavingProvider=null;try{e.apiKeyProviders=await eo(e.client)}catch{}setTimeout(()=>{e.apiKeySuccess===b&&(e.apiKeySuccess=null)},2500)}catch(b){e.apiKeyError=b instanceof Error?b.message:"Failed to remove key",e.apiKeySavingProvider=null}finally{e.apiKeyBusy=!1}},authApiKeyMode:e.authApiKeyMode,authApiKeyInput:e.authApiKeyInput,authApiKeyBusy:e.authApiKeyBusy,authApiKeyError:e.authApiKeyError,onAuthApiKeyToggle:()=>{e.authApiKeyMode=!e.authApiKeyMode,e.authApiKeyError=null},onAuthApiKeyChange:f=>{e.authApiKeyInput=f},onAuthApiKeySubmit:async()=>{const f=e.authApiKeyInput.trim();if(f){e.authApiKeyBusy=!0,e.authApiKeyError=null;try{await qa(e.client,"anthropic",f),await e.handleAuthStatusCheck(),e.authApiKeyMode=!1,e.authApiKeyInput=""}catch(b){e.authApiKeyError=b instanceof Error?b.message:"Failed to save API key"}finally{e.authApiKeyBusy=!1}}},accountHasPin:(()=>{var b;const f=e.selectedWorkspace??((b=e.workspaces[0])==null?void 0:b.name);return f?e.accessState.accounts.some(S=>S.id===f):!1})(),accountPinModalOpen:e.accountPinModalOpen,accountPinBusy:e.accountPinBusy,accountPinError:e.accountPinError,accountPinSuccess:e.accountPinSuccess,onAccountPinModalOpen:()=>{e.accountPinModalOpen=!0,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinModalClose:()=>{e.accountPinModalOpen=!1,e.accountPinError=null,e.accountPinSuccess=null},onAccountPinSave:(f,b)=>{var $;const S=e.selectedWorkspace??(($=e.workspaces[0])==null?void 0:$.name);S&&e.handleAccountPinSave(S,f,b)},publicChatEnabled:(()=>{var S;const f=(S=e.configSnapshot)==null?void 0:S.config,b=f==null?void 0:f.publicChat;return(b==null?void 0:b.enabled)===!0})(),publicChatAuthMode:(()=>{var $;const f=($=e.configSnapshot)==null?void 0:$.config,b=f==null?void 0:f.publicChat,S=b==null?void 0:b.auth;return S==="verified"||S==="choice"?S:"anonymous"})(),publicChatBusy:e.publicChatToggleBusy,onPublicChatToggle:async()=>{var f;if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get"),S=b.config,$=((f=S==null?void 0:S.publicChat)==null?void 0:f.enabled)===!0;await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{enabled:!$}}),baseHash:b.hash,note:`Public chat → ${$?"disabled":"enabled"}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat toggle failed:",b)}finally{e.publicChatToggleBusy=!1}}},onPublicChatAuthModeChange:async f=>{if(!e.publicChatToggleBusy){e.publicChatToggleBusy=!0;try{const b=await e.client.request("config.get");await e.client.request("config.patch",{raw:JSON.stringify({publicChat:{auth:f}}),baseHash:b.hash,note:`Public chat auth → ${f}`}),e.configSnapshot=await e.client.request("config.get")}catch(b){console.error("Public chat auth mode change failed:",b)}finally{e.publicChatToggleBusy=!1}}},tailscaleStatus:e.tailscaleStatus,tailscaleBusy:e.tailscaleBusy,tailscaleAuthUrl:e.tailscaleAuthUrl,tailscaleError:e.tailscaleError,tailscaleFunnelEnableUrl:e.tailscaleFunnelEnableUrl,onTailscaleEnable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleAuthUrl=null;try{const f=await e.client.request("tailscale.enable");if(f.authUrl){e.tailscaleAuthUrl=f.authUrl;const b=setInterval(async()=>{try{const S=await e.client.request("tailscale.status");e.tailscaleStatus=S,S.loggedIn&&(clearInterval(b),e.tailscaleAuthUrl=null,e.tailscaleBusy=!1)}catch{}},3e3);setTimeout(()=>{clearInterval(b),e.tailscaleBusy&&(e.tailscaleBusy=!1)},3e5)}else f.alreadyLoggedIn&&(e.tailscaleStatus=await e.client.request("tailscale.status")),e.tailscaleBusy=!1}catch(f){console.error("Tailscale enable failed:",f),e.tailscaleBusy=!1}}},onTailscaleFunnelEnable:async()=>{var f;if(!e.tailscaleBusy){e.tailscaleBusy=!0,e.tailscaleError=null,e.tailscaleFunnelEnableUrl=null;try{await e.client.request("tailscale.funnel.enable")}catch(b){console.error("Tailscale funnel enable failed:",b);const S=b;(f=S.payload)!=null&&f.enableUrl&&(e.tailscaleFunnelEnableUrl=S.payload.enableUrl),e.tailscaleError=S.message||"Failed to enable Funnel",e.tailscaleBusy=!1}}},onTailscaleFunnelDisable:async()=>{if(!e.tailscaleBusy){e.tailscaleBusy=!0;try{await e.client.request("tailscale.funnel.disable")}catch(f){console.error("Tailscale funnel disable failed:",f),e.tailscaleBusy=!1}}},wifiStatus:e.wifiStatus,wifiNetworks:e.wifiNetworks,wifiBusy:e.wifiBusy,wifiError:e.wifiError,wifiPassword:e.wifiPassword,wifiSelectedSsid:e.wifiSelectedSsid,onWifiScan:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{const[f,b]=await Promise.all([e.client.request("wifi.scan"),e.client.request("wifi.status")]);e.wifiNetworks=f.networks,e.wifiStatus=b}catch(f){console.error("WiFi scan failed:",f),e.wifiError=f.message||"Failed to scan networks"}finally{e.wifiBusy=!1}}},onWifiConnect:async()=>{if(e.wifiBusy||!e.wifiSelectedSsid)return;const f=e.wifiSelectedSsid;e.wifiBusy=!0,e.wifiError=null;try{const b=await e.client.request("wifi.connect",{ssid:f,password:e.wifiPassword});e.wifiPassword="",e.wifiSelectedSsid=null,e.wifiNetworks=[],e.wifiStatus={available:!0,connected:b.connected,ssid:b.ssid,signal:null,ip:b.ip,savedSsid:b.ssid,autoconnect:!0},e.wifiBusy=!1;try{const S=await e.client.request("wifi.status");e.wifiStatus=S}catch{}}catch(b){console.error("WiFi connect failed:",b),e.wifiError=b.message||"Failed to connect",e.wifiBusy=!1}},onWifiDisconnect:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.disconnect"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi disconnect failed:",f),e.wifiError=f.message||"Failed to disconnect"}finally{e.wifiBusy=!1}}},onWifiForget:async()=>{if(!e.wifiBusy){e.wifiBusy=!0,e.wifiError=null;try{await e.client.request("wifi.forget"),e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="";const f=await e.client.request("wifi.status");e.wifiStatus=f}catch(f){console.error("WiFi forget failed:",f),e.wifiError=f.message||"Failed to forget network"}finally{e.wifiBusy=!1}}},onWifiDismiss:()=>{e.wifiNetworks=[],e.wifiSelectedSsid=null,e.wifiPassword="",e.wifiError=null},onWifiSelectSsid:f=>{e.wifiSelectedSsid=f,e.wifiPassword="",e.wifiError=null},onWifiPasswordChange:f=>{e.wifiPassword=f},wsProps:Sb(e)})}if(e.filesPage){const l=Ab(e);return Jh({connected:e.connected,wsProps:sn(e),loading:e.filesLoading,tree:e.filesTree,root:e.filesRoot,error:e.filesError,selectedPath:e.filesSelectedPath,selectedPaths:e.filesSelectedPaths,previewContent:e.filesPreviewContent,previewLoading:e.filesPreviewLoading,previewBinary:e.filesPreviewBinary,previewSize:e.filesPreviewSize,expandedDirs:e.filesExpandedDirs,currentDir:e.filesCurrentDir,message:e.filesMessage,uploadBusy:e.filesUploadBusy,reindexBusy:e.filesReindexBusy,memoryStatus:e.filesMemoryStatus,onRefresh:()=>Ut(e,l),onReindex:()=>dh(e,l),onSelectFile:d=>{e.filesPendingDeletePath=null,ih(e,d,l)},onToggleSelectFile:d=>sh(e,d,l),onToggleDir:d=>ph(e,d),onUpload:(d,h)=>ah(e,d,h,l),onNewFolder:(d,h)=>lh(e,d,h,l),onDownload:d=>oc(e,d,l),onBulkDownload:()=>oh(e,l),onDelete:d=>{e.filesPendingDeletePath=null,ch(e,d,l)},pendingDeletePath:e.filesPendingDeletePath,onArmDelete:d=>{e.filesPendingDeletePath=d||null},onMoveToDir:(d,h)=>rh(e,d,h,l),searchQuery:e.filesSearchQuery,searchResults:e.filesSearchResults,searchLoading:e.filesSearchLoading,searchAgentId:e.filesSearchAgentId,agentIds:e.workspaceAgentIds??[],onSearch:d=>{const h=e.filesSearchAgentId??l;hh(e,d,h)},onSearchAgentChange:d=>{e.filesSearchAgentId=d},onSearchClear:()=>{fh(e)},onSearchQueryChange:d=>{e.filesSearchQuery=d}})}if(e.browserPage)return Vh({connected:e.connected,active:e.browserScreencastActive,loading:e.browserLoading,error:e.browserError,inputMode:e.browserInputMode,fullscreen:e.browserFullscreen,handoffPending:e.browserHandoffPending,handoffReason:e.browserHandoffReason,onStart:()=>zv(e),onStop:()=>jv(e),onToggleInput:()=>qv(e),onToggleFullscreen:()=>Vv(e),onCompleteHandoff:()=>Hv(e),onCanvasMouseDown:l=>{const h=l.target.getBoundingClientRect(),f=hn().translateCoordinates(l.clientX-h.left,l.clientY-h.top);xs(e,"mousePressed",f.x,f.y,l.button===2?"right":l.button===1?"middle":"left")},onCanvasMouseUp:l=>{const h=l.target.getBoundingClientRect(),f=hn().translateCoordinates(l.clientX-h.left,l.clientY-h.top);xs(e,"mouseReleased",f.x,f.y)},onCanvasMouseMove:l=>{const d=hn();if(d.shouldThrottleMouseMove())return;const v=l.target.getBoundingClientRect(),f=d.translateCoordinates(l.clientX-v.left,l.clientY-v.top);xs(e,"mouseMoved",f.x,f.y)},onCanvasKeyDown:l=>{let d=0;l.altKey&&(d|=1),l.ctrlKey&&(d|=2),l.metaKey&&(d|=4),l.shiftKey&&(d|=8),$s(e,"keyDown",l.key,{code:l.code,modifiers:d||void 0}),l.key.length===1&&$s(e,"char",l.key,{text:l.key})},onCanvasKeyUp:l=>{$s(e,"keyUp",l.key,{code:l.code})}});if(e.adminsPage){const l=xb(e),d=$b(e);return yf({connected:e.connected,wsProps:sn(e),loading:e.adminsLoading,saving:e.adminsSaving,phones:e.adminPhones,error:e.adminsError,newPhone:e.adminsNewPhone,onRefresh:()=>Ii(e,l),onAdd:h=>{xu(e,h,l,d).then(()=>{e.adminsError||(e.adminsNewPhone="")})},onRemove:h=>$u(e,h,l,d),onNewPhoneChange:h=>e.handleAdminsNewPhoneChange(h)})}if(e.contactsPage){const l=Eb(e);return kf({connected:e.connected,wsProps:sn(e),loading:e.contactsLoading,saving:e.contactsSaving,records:e.contactsRecords,error:e.contactsError,searchQuery:e.contactsSearchQuery,editingId:e.contactsEditingId,showAddForm:e.contactsShowAddForm,newRecordPhone:e.contactsNewPhone,newRecordName:e.contactsNewName,onSearch:d=>e.contactsSearchQuery=d,onSearchSubmit:()=>yt(e,l),onAdd:(d,h)=>Au(e,d,h,l),onDelete:d=>Eu(e,d,l),onSetField:(d,h,v)=>Cu(e,d,h,v,l),onDeleteField:(d,h)=>Tu(e,d,h,l),onToggleExpand:d=>{e.contactsEditingId=e.contactsEditingId===d?null:d},onShowAddForm:()=>e.contactsShowAddForm=!0,onCancelAddForm:()=>{e.contactsShowAddForm=!1,e.contactsNewPhone="",e.contactsNewName=""},onNewRecordPhoneChange:d=>e.handleContactsNewPhoneChange(d),onNewRecordNameChange:d=>e.handleContactsNewNameChange(d),onRefresh:()=>yt(e,l)})}if(e.chatPage){const l=e.connected?null:"Disconnected from gateway.",d=el(e),h=e.chatAvatarUrl??d??null,v=(()=>{var S;const f=(S=e.configSnapshot)==null?void 0:S.config,b=f==null?void 0:f.publicChat;return(b==null?void 0:b.enabled)===!0})();return ev({connected:e.connected,wsProps:sn(e),publicChatEnabled:v,publicChatAccountId:e.selectedWorkspace??void 0,sessionKey:e.sessionKey,onSessionKeyChange:f=>{e.sessionKey=f,e.chatMessage="",e.chatAttachments=[],e.chatStream=null,e.chatInterimText=null,e.chatSuggestion=null,e.chatStreamStartedAt=null,e.chatRunId=null,e.chatQueue=[],e.resetToolStream(),e.resetChatScroll(),e.applySettings({...e.settings,sessionKey:f,lastActiveSessionKey:f}),e.loadAssistantIdentity(),Me(e),Ds(e)},thinkingLevel:e.chatThinkingLevel,showThinking:e.settings.chatShowThinking??!1,modelProvider:e.chatModelProvider,model:e.chatModel,modelCatalog:e.chatModelCatalog,onModelChange:f=>{const b=Math.max(e.chatMessages.length+10,Pe);Rn(e,e.sessionKey,{model:f}).then(()=>{Me(e,{limit:b})})},onThinkingLevelChange:f=>{const b=Math.max(e.chatMessages.length+10,Pe);Rn(e,e.sessionKey,{thinkingLevel:f==="off"?null:f}).then(()=>{Me(e,{limit:b})})},verboseLevel:e.chatVerboseLevel,fillerEnabled:e.chatFillerEnabled,suggestion:e.chatSuggestion,onSuggestionClick:f=>{e.chatMessage=f,e.chatSuggestion=null,e.handleSendChat()},onVerboseChange:f=>{const b=Math.max(e.chatMessages.length+10,Pe);Rn(e,e.sessionKey,{verboseLevel:f==="off"?null:f}).then(()=>{Me(e,{limit:b})})},onFillerChange:f=>{const b=Math.max(e.chatMessages.length+10,Pe);Rn(e,e.sessionKey,{fillerEnabled:f}).then(()=>{Me(e,{limit:b})})},loading:e.chatLoading,sending:e.chatSending,compactionStatus:e.compactionStatus,assistantAvatarUrl:h,messages:e.chatMessages,toolMessages:e.chatToolMessages,stream:e.chatStream,streamStartedAt:e.chatStreamStartedAt,interimText:e.chatInterimText,draft:e.chatMessage,queue:e.chatQueue,canSend:e.connected,disabledReason:l,error:e.lastError,sessions:e.sessionsResult,focusMode:!1,onRefresh:()=>{e.resetToolStream();const f=Math.max(e.chatMessages.length+10,Pe);return Promise.all([Me(e,{limit:f}),Ds(e)])},onToggleFocusMode:()=>{},onChatScroll:f=>e.handleChatScroll(f),nearBottom:e.chatUserNearBottom,hasMore:e.chatHistoryHasMore,loadingOlder:e.chatLoadingOlder,onLoadOlder:()=>{e.handleLoadOlderChat()},onDraftChange:f=>e.chatMessage=f,attachments:e.chatAttachments,onAttachmentsChange:f=>e.chatAttachments=f,onSend:()=>e.handleSendChat(),canAbort:!!e.chatRunId,onAbort:()=>{e.handleAbortChat()},onQueueRemove:f=>e.removeQueuedMessage(f),onNewSession:()=>e.handleSendChat("/new",{restoreDraft:!0}),sidebarOpen:e.sidebarOpen,sidebarContent:e.sidebarContent,sidebarError:e.sidebarError,splitRatio:e.splitRatio,onOpenSidebar:f=>e.handleOpenSidebar(f),onCloseSidebar:()=>e.handleCloseSidebar(),onSplitRatioChange:f=>e.handleSplitRatioChange(f),assistantName:e.assistantName,assistantAvatar:e.assistantAvatar})}return e.advancedPage?Mv({connected:e.connected,wsProps:sn(e),activeTab:e.advancedTab,onTabChange:l=>{e.advancedTab=l,l==="cron"&&e.loadCron(),l==="skills"&&ft(e,{clearMessages:!0}),l==="logs"&&(e.logsSubTab==="session"?un(e,{reset:!0}):Pt(e,{reset:!0}))},cronProps:{loading:e.cronLoading,status:e.cronStatus,jobs:e.cronJobs,error:e.cronError,busy:e.cronBusy,form:e.cronForm,channels:(r=(o=e.channelsSnapshot)==null?void 0:o.channelMeta)!=null&&r.length?e.channelsSnapshot.channelMeta.map(l=>l.id):((a=e.channelsSnapshot)==null?void 0:a.channelOrder)??[],channelLabels:((u=e.channelsSnapshot)==null?void 0:u.channelLabels)??{},channelMeta:((c=e.channelsSnapshot)==null?void 0:c.channelMeta)??[],agentIds:(()=>{var d;const l=oe(e);return((d=l==null?void 0:l.agents)==null?void 0:d.map(h=>h.id))??[]})(),runsJobId:e.cronRunsJobId,runs:e.cronRuns,newEventModalOpen:e.cronNewEventModal,onNewEventModalOpen:()=>{e.cronNewEventModal=!0},onNewEventModalClose:()=>{e.cronNewEventModal=!1},detailJobId:e.cronDetailJobId,onDetailOpen:l=>{e.cronDetailJobId=l.id,Ps(e,l.id)},onDetailClose:()=>{e.cronDetailJobId=null},onFormChange:l=>e.cronForm={...e.cronForm,...l},onRefresh:()=>e.loadCron(),onAdd:()=>{rp(e).then(()=>{e.cronNewEventModal=!1})},onToggle:(l,d)=>ap(e,l,d),onRun:l=>lp(e,l),onRemove:l=>cp(e,l),onLoadRuns:l=>Ps(e,l)},skillsProps:{loading:e.skillsLoading,report:e.skillsReport,error:e.skillsError,filter:e.skillsFilter,edits:e.skillEdits,messages:e.skillMessages,busyKey:e.skillsBusyKey,onFilterChange:l=>e.skillsFilter=l,onRefresh:()=>ft(e,{clearMessages:!0}),onToggle:(l,d)=>Yl(e,l,d),onEdit:(l,d)=>Ql(e,l,d),onSaveKey:l=>Xl(e,l),onInstall:(l,d,h)=>Zl(e,l,d,h)},logsProps:{logsSubTab:e.logsSubTab,onSubTabChange:l=>{e.logsSubTab=l,l==="session"?un(e,{reset:!0}):Pt(e,{reset:!0})},sessionLogsProps:{loading:e.sessionLogsLoading,error:e.sessionLogsError,entries:e.sessionLogsEntries,agents:e.sessionLogsAgents,filterText:e.sessionLogsFilterText,typeFilters:e.sessionLogsTypeFilters,agentFilters:e.sessionLogsAgentFilters,autoFollow:e.sessionLogsAutoFollow,onFilterTextChange:l=>e.sessionLogsFilterText=l,onTypeToggle:(l,d)=>{const h=e;h.sessionLogsTypeFilters={...h.sessionLogsTypeFilters,[l]:d}},onAgentToggle:(l,d)=>{const h=e;h.sessionLogsAgentFilters={...h.sessionLogsAgentFilters,[l]:d}},onToggleAutoFollow:l=>e.sessionLogsAutoFollow=l,onRefresh:()=>{un(e,{reset:!0})},onExport:(l,d)=>e.exportSessionLogs(l,d),onScroll:l=>e.handleSessionLogsScroll(l)},loading:e.logsLoading,error:e.logsError,file:e.logsFile,entries:e.logsEntries,filterText:e.logsFilterText,levelFilters:e.logsLevelFilters,autoFollow:e.logsAutoFollow,truncated:e.logsTruncated,onFilterTextChange:l=>e.logsFilterText=l,onLevelToggle:(l,d)=>{e.logsLevelFilters={...e.logsLevelFilters,[l]:d}},onToggleAutoFollow:l=>e.logsAutoFollow=l,onRefresh:()=>Pt(e,{reset:!0}),onExport:(l,d)=>e.exportSessionLogs(l,d),onScroll:l=>e.handleLogsScroll(l)}}):(window.location.replace("/chat"),p``)}function Ib(e){const t=new Date(e),n=t.toLocaleDateString("en-GB",{day:"2-digit",month:"short"}),i=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return`${n} ${i}`}function tl(e){return e.startsWith("memory/public/")?"public":e.startsWith("memory/shared/")?"shared":"other"}function Rb(e,t,n){return p`
3508
3505
  <div class="audit-modal-overlay" @click=${s=>{s.target.classList.contains("audit-modal-overlay")&&n()}}>
3509
3506
  <div class="audit-modal-card">
3510
3507
  <div class="audit-modal-header">
@@ -3539,4 +3536,4 @@ ${r.text}`:a.join(", "):r.text;t.push({kind:"message",key:`queue:${r.id}`,messag
3539
3536
  `}const Nb={trace:!0,debug:!0,info:!0,warn:!0,error:!0,fatal:!0},Db={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:""};function Ob(e){e.basePath=$h();const t=Xe();if(Kh(t.accentColor),window.scrollTo(0,0),yh(e),e.publicChat){const n=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__,i=(n==null?void 0:n.accountId)??"",s=i?i.charAt(0).toUpperCase()+i.slice(1):"Assistant";document.title=`Chat with ${s}`,Te(e);return}if(e.setup){document.title=`${t.name} Setup`,Te(e);return}if(e.filesPage){document.title=`${t.name} Files`,bh(e),Te(e);return}if(e.browserPage){document.title=`${t.name} Browser`,Te(e);return}if(e.adminsPage){document.title=`${t.name} Admins`,Te(e);return}if(e.contactsPage){document.title=`${t.name} Contacts`,Te(e);return}if(e.chatPage){document.title=`${t.name} Chat`,Te(e);return}if(e.advancedPage){document.title=`${t.name} Advanced`,Te(e);return}Th(e,!0),Ah(e),Eh(e),window.addEventListener("popstate",e.popStateHandler),kh(e),Te(e),gh(e),e.tab==="logs"&&(e.logsSubTab==="session"?So(e):wo(e)),e.tab==="debug"&&$o(e)}function Bb(e){ep(e)}function Fb(e){var t;window.removeEventListener("popstate",e.popStateHandler),mh(e),ko(e),xo(e),Ao(e),vh(e),wh(e),Ch(e),(t=e.topbarObserver)==null||t.disconnect(),e.topbarObserver=null}function Ub(e,t){if(!e.publicChat){if(e.filesPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleFilesLoad&&e.handleFilesLoad(),e.adminsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdminsLoad&&e.handleAdminsLoad(),e.contactsPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleContactsLoad&&e.handleContactsLoad(),e.chatPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleChatLoad&&e.handleChatLoad(),e.advancedPage&&e.connected&&t.has("connected")&&t.get("connected")===!1&&e.handleAdvancedLoad&&e.handleAdvancedLoad(),e.setup&&e.connected){const n=t.has("connected")&&t.get("connected")===!1;n&&e.handleLicenseStatusCheck&&e.licenseValid===null&&!e.licenseBusy&&e.handleLicenseStatusCheck(),n&&e.handleUpdateCheck&&e.handleUpdateCheck();const i=t.has("setupStep")&&e.setupStep==="auth";(n||i)&&e.setupStep==="auth"&&e.handleAuthStatusCheck&&e.authConnected===null&&!e.authBusy&&e.handleAuthStatusCheck(),e.setupStep==="whatsapp"&&t.has("setupStep")&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(o=>{e.channelsSnapshot=o,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1})),t.has("whatsappLoginConnected")&&e.whatsappLoginConnected===!0&&e.client&&!e.channelsLoading&&(e.channelsLoading=!0,e.client.request("channels.status",{probe:!0,timeoutMs:8e3}).then(s=>{e.channelsSnapshot=s,e.channelsLoading=!1}).catch(()=>{e.channelsLoading=!1}))}if(e.tab==="chat"&&!e.advancedPage&&(t.has("chatMessages")||t.has("chatToolMessages")||t.has("chatStream")||t.has("chatLoading")||t.has("tab"))){const n=t.has("tab"),i=t.has("chatLoading")&&t.get("chatLoading")===!0&&e.chatLoading===!1;Bt(e,n||i||!e.chatHasAutoScrolled)}e.tab==="logs"&&!e.advancedPage&&(t.has("logsEntries")||t.has("logsAutoFollow")||t.has("tab"))&&e.logsAutoFollow&&e.logsAtBottom&&$l(e,t.has("tab")||t.has("logsAutoFollow"))}}function Wb(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 Kb(e,t,n){await lo(e,t,n),await G(e,!0)}async function zb(e,t){await Cl(e,t),await G(e,!0)}async function jb(e,t){await Tl(e,t),await G(e,!0)}async function Hb(e,t){await _l(e,t)}async function qb(e,t){await Ml(e,t)}async function Vb(e){await ip(e),await Le(e),await G(e,!0)}async function Gb(e){await Le(e),await G(e,!0)}function Qb(e){if(!Array.isArray(e))return{};const t={};for(const n of e){if(typeof n!="string")continue;const[i,...s]=n.split(":");if(!i||s.length===0)continue;const o=i.trim(),r=s.join(":").trim();o&&r&&(t[o]=r)}return t}function _u(e){var n,i,s;return((s=(((i=(n=e.channelsSnapshot)==null?void 0:n.channelAccounts)==null?void 0:i.nostr)??[])[0])==null?void 0:s.accountId)??e.nostrProfileAccountId??"default"}function Mu(e,t=""){return`/api/channels/nostr/${encodeURIComponent(e)}/profile${t}`}function Yb(e,t,n){e.nostrProfileAccountId=t,e.nostrProfileFormState=Wb(n??void 0)}function Xb(e){e.nostrProfileFormState=null,e.nostrProfileAccountId=null}function Zb(e,t,n){const i=e.nostrProfileFormState;i&&(e.nostrProfileFormState={...i,values:{...i.values,[t]:n},fieldErrors:{...i.fieldErrors,[t]:""}})}function Jb(e){const t=e.nostrProfileFormState;t&&(e.nostrProfileFormState={...t,showAdvanced:!t.showAdvanced})}async function ew(e){const t=e.nostrProfileFormState;if(!t||t.saving)return;const n=_u(e);e.nostrProfileFormState={...t,saving:!0,error:null,success:null,fieldErrors:{}};try{const i=await fetch(Mu(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.values)}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const o=(s==null?void 0:s.error)??`Profile update failed (${i.status})`;e.nostrProfileFormState={...t,saving:!1,error:o,success:null,fieldErrors:Qb(s==null?void 0:s.details)};return}if(!s.persisted){e.nostrProfileFormState={...t,saving:!1,error:"Profile publish failed on all relays.",success:null};return}e.nostrProfileFormState={...t,saving:!1,error:null,success:"Profile published to relays.",fieldErrors:{},original:{...t.values}},await G(e,!0)}catch(i){e.nostrProfileFormState={...t,saving:!1,error:`Profile update failed: ${String(i)}`,success:null}}}async function tw(e){const t=e.nostrProfileFormState;if(!t||t.importing)return;const n=_u(e);e.nostrProfileFormState={...t,importing:!0,error:null,success:null};try{const i=await fetch(Mu(n,"/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoMerge:!0})}),s=await i.json().catch(()=>null);if(!i.ok||(s==null?void 0:s.ok)===!1||!s){const u=(s==null?void 0:s.error)??`Profile import failed (${i.status})`;e.nostrProfileFormState={...t,importing:!1,error:u,success:null};return}const o=s.merged??s.imported??null,r=o?{...t.values,...o}:t.values,a=!!(r.banner||r.website||r.nip05||r.lud16);e.nostrProfileFormState={...t,importing:!1,values:r,error:null,success:s.saved?"Profile imported from relays. Review and publish.":"Profile imported. Review and publish.",showAdvanced:a},s.saved&&await G(e,!0)}catch(i){e.nostrProfileFormState={...t,importing:!1,error:`Profile import failed: ${String(i)}`,success:null}}}async function nw(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 iw(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 sw(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 ow(e,t){e.authCodeInput=t}function rw(e){e.setupStep="whatsapp"}async function aw(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 lw(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 cw(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 uw(e,t){e.licenseKey=t}async function dw(e){var t,n;if(!(!e.client||!e.connected)&&!e.gatewayHealthLoading){e.gatewayHealthLoading=!0,(t=e.requestUpdate)==null||t.call(e);try{const i=await e.client.request("health",{probe:!0});e.gatewayHealthy=i.ok===!0,e.gatewayHealthMessage=i.ok?`Healthy${i.durationMs?` (${i.durationMs}ms)`:""}`:"Unhealthy"}catch(i){e.gatewayHealthy=!1,e.gatewayHealthMessage=`Error: ${String(i)}`}finally{e.gatewayHealthLoading=!1,(n=e.requestUpdate)==null||n.call(e)}}}async function pw(e){var t,n,i;if(!(!e.client||e.gatewayRestartBusy)){e.gatewayRestartBusy=!0,e.gatewayHealthMessage="Restarting...",(t=e.requestUpdate)==null||t.call(e);try{const s=await e.client.request("gateway.restart",{reason:"Manual restart from setup page",delayMs:1e3});if(s.ok&&((n=s.restart)!=null&&n.ok))e.gatewayHealthMessage="Restarting...",setTimeout(()=>{window.location.reload()},3e3);else throw new Error("Restart not scheduled")}catch(s){e.gatewayHealthMessage=`Restart failed: ${String(s)}`,e.gatewayRestartBusy=!1,(i=e.requestUpdate)==null||i.call(e)}}}var hw=Object.defineProperty,fw=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?fw(t,n):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(s=(i?r(t,n,s):r(s))||s);return i&&s&&hw(t,n,s),s};const Cs=gd();function gw(){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 mw(){const e=window.location.pathname;if(e==="/setup"||e.endsWith("/setup"))return!0;if(!window.location.search)return!1;const n=new URLSearchParams(window.location.search).get("setup");if(!n)return!1;const i=n.trim().toLowerCase();return i==="1"||i==="true"||i==="yes"||i==="on"}function yw(){const e=window.location.pathname;return e==="/files"||e.endsWith("/files")}function vw(){const e=window.location.pathname;return e==="/browser"||e.endsWith("/browser")}function bw(){const e=window.location.pathname;return e==="/admins"||e.endsWith("/admins")}function ww(){const e=window.location.pathname;return e==="/contacts"||e.endsWith("/contacts")}function kw(){const e=window.location.pathname;return e==="/chat"||e.endsWith("/chat")}function Sw(){const e=window.location.pathname;return e==="/advanced"||e.endsWith("/advanced")}let g=class extends Mt{constructor(){super(...arguments),this.settings=Yi(),this.password="",this.tab="chat",this.onboarding=gw(),this.setup=mw(),this.filesPage=yw(),this.browserPage=vw(),this.adminsPage=bw(),this.contactsPage=ww(),this.chatPage=kw(),this.advancedPage=Sw(),this.advancedTab="cron",this.publicChat=!!window.__TASKMASTER_PUBLIC_CHAT__,this.publicChatConfig=window.__TASKMASTER_PUBLIC_CHAT_CONFIG__??{},this.publicChatSessionKey=null,this.publicChatAuthenticated=!1,this.publicChatAuthStep="idle",this.connected=!1,this.accessState=bu,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=Cs.name,this.assistantAvatar=Cs.avatar,this.assistantAgentId=Cs.agentId??null,this.sessionKey=this.settings.sessionKey,this.chatLoading=!1,this.chatSending=!1,this.chatMessage="",this.chatMessages=[],this.chatHistoryTotal=0,this.chatHistoryHasMore=!1,this.chatLoadingOlder=!1,this.chatToolMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.compactionStatus=null,this.chatAvatarUrl=null,this.chatThinkingLevel=null,this.chatModelProvider=null,this.chatModel=null,this.chatModelCatalog=[],this.chatVerboseLevel=null,this.chatFillerEnabled=null,this.chatQueue=[],this.chatAttachments=[],this.sidebarOpen=!1,this.sidebarContent=null,this.sidebarError=null,this.splitRatio=this.settings.splitRatio,this.nodesLoading=!1,this.nodes=[],this.devicesLoading=!1,this.devicesError=null,this.devicesList=null,this.execApprovalsLoading=!1,this.execApprovalsSaving=!1,this.execApprovalsDirty=!1,this.execApprovalsSnapshot=null,this.execApprovalsForm=null,this.execApprovalsSelectedAgent=null,this.execApprovalsTarget="gateway",this.execApprovalsTargetNodeId=null,this.execApprovalQueue=[],this.execApprovalBusy=!1,this.execApprovalError=null,this.configLoading=!1,this.configRaw=`{
3540
3537
  }
3541
3538
  `,this.configRawOriginal="",this.configValid=null,this.configIssues=[],this.configSaving=!1,this.configApplying=!1,this.updateRunning=!1,this.applySessionKey=this.settings.lastActiveSessionKey,this.configSnapshot=null,this.configSchema=null,this.configSchemaVersion=null,this.configSchemaLoading=!1,this.configUiHints={},this.configForm=null,this.configFormOriginal=null,this.configFormDirty=!1,this.configFormMode="form",this.configSearchQuery="",this.configActiveSection=null,this.configActiveSubsection=null,this.channelsLoading=!1,this.channelsSnapshot=null,this.channelsError=null,this.channelsLastSuccess=null,this.whatsappLoginMessage=null,this.whatsappLoginQrDataUrl=null,this.whatsappLoginConnected=null,this.whatsappBusy=!1,this.whatsappActiveQrAccountId=null,this.whatsappPairedPhone=null,this.addingWhatsAppAccount=!1,this.newWhatsAppAccountName="",this.whatsappAccountError=null,this.whatsappAccountSaving=!1,this.whatsappSettingsOpen=!1,this.publicChatToggleBusy=!1,this.tailscaleStatus=null,this.tailscaleBusy=!1,this.tailscaleAuthUrl=null,this.tailscaleError=null,this.tailscaleFunnelEnableUrl=null,this.wifiStatus=null,this.wifiNetworks=[],this.wifiBusy=!1,this.wifiError=null,this.wifiPassword="",this.wifiSelectedSsid=null,this.licenseKey="",this.licenseBusy=!1,this.licenseValid=null,this.licenseMessage=null,this.licenseTier=null,this.licenseDeviceId=null,this.licenseStoredKey=null,this.licenseRemoveConfirm=!1,this.authConnected=null,this.authBusy=!1,this.authMessage=null,this.authUrl=null,this.authCodeInput="",this.authExpiresIn=null,this.setupStep="license",this.gatewayHealthy=null,this.gatewayHealthLoading=!1,this.gatewayHealthMessage=null,this.gatewayRestartBusy=!1,this.updateAvailable=null,this.currentVersion=null,this.latestVersion=null,this.updateChecking=!1,this.updateMessage=null,this.updateProgressSteps=[],this.updateLastResult=null,this.uninstallConfirm=!1,this.uninstallBusy=!1,this.uninstallDone=!1,this.uninstallError=null,this.uninstallConfirmText="",this.nostrProfileFormState=null,this.nostrProfileAccountId=null,this.presenceLoading=!1,this.presenceEntries=[],this.presenceError=null,this.presenceStatus=null,this.agentsLoading=!1,this.agentsList=null,this.agentsError=null,this.sessionsLoading=!1,this.sessionsResult=null,this.sessionsError=null,this.cronLoading=!1,this.cronJobs=[],this.cronStatus=null,this.cronError=null,this.cronForm={...Db},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.filesCurrentDir=".",this.filesPendingDeletePath=null,this.filesMessage=null,this.filesUploadBusy=!1,this.filesReindexBusy=!1,this.filesMemoryStatus=null,this.embeddingDownloading=!1,this.embeddingPollTimer=null,this.filesSearchQuery="",this.filesSearchResults=null,this.filesSearchLoading=!1,this.filesSearchAgentId=null,this.filesResolvedAgentId=void 0,this.auditEntries=[],this.auditLoading=!1,this.auditModalOpen=!1,this.skillsLoading=!1,this.skillsReport=null,this.skillsError=null,this.skillsFilter="",this.skillEdits={},this.skillsBusyKey=null,this.skillMessages={},this.adminsLoading=!1,this.adminPhones=[],this.adminsError=null,this.adminsSaving=!1,this.adminsNewPhone="",this.contactsLoading=!1,this.contactsSaving=!1,this.contactsRecords=[],this.contactsError=null,this.contactsSearchQuery="",this.contactsEditingId=null,this.contactsShowAddForm=!1,this.contactsNewPhone="",this.contactsNewName="",this.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={...Nb},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.sessionLogsCursors={},this.sessionLogsLastFetchAt=null,this.sessionLogsAtBottom=!0,this.client=null,this.chatScrollFrame=null,this.chatScrollTimeout=null,this.chatHasAutoScrolled=!1,this.chatUserNearBottom=!0,this.onLoadOlder=()=>this.handleLoadOlderChat(),this.nodesPollInterval=null,this.logsPollInterval=null,this.sessionLogsPollInterval=null,this.debugPollInterval=null,this.auditPollInterval=null,this.logsScrollFrame=null,this.toolStreamById=new Map,this.toolStreamOrder=[],this.basePath="",this.popStateHandler=()=>_h(this),this.themeMedia=null,this.themeMediaHandler=null,this.topbarObserver=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Ob(this)}firstUpdated(){Bb(this)}disconnectedCallback(){this.stopEmbeddingPoll(),Fb(this),super.disconnectedCallback()}startEmbeddingPoll(){if(this.embeddingPollTimer!=null)return;const e=async()=>{if(!(!this.client||!this.connected)){try{const t=await this.client.request("memory.status",{});if((t==null?void 0:t.embeddingState)==="downloading")this.embeddingDownloading=!0;else{this.embeddingDownloading&&(this.embeddingDownloading=!1),this.stopEmbeddingPoll();return}}catch{this.embeddingDownloading=!1,this.stopEmbeddingPoll();return}this.embeddingPollTimer=window.setTimeout(e,3e3)}};e()}stopEmbeddingPoll(){this.embeddingPollTimer!=null&&(window.clearTimeout(this.embeddingPollTimer),this.embeddingPollTimer=null)}updated(e){Ub(this,e)}connect(){Te(this)}handleChatScroll(e){Vd(this,e)}handleLogsScroll(e){Qd(this,e)}handleSessionLogsScroll(e){Yd(this,e)}exportLogs(e,t){Zd(e,t)}exportSessionLogs(e,t){Jd(e,t)}resetToolStream(){ao(this)}resetChatScroll(){Xd(this)}async loadAssistantIdentity(){await Js(this)}applySettings(e){Ge(this,e)}setTab(e){Sh(this,e)}setTheme(e,t){xh(this,e,t)}async loadOverview(){await cc(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 Eo(this)}async handleAbortChat(){await dc(this)}removeQueuedMessage(e){Ih(this,e)}async handleSendChat(e,t){await Rh(this,e,t)}async handleWhatsAppStart(e,t){await Kb(this,e,t)}async handleWhatsAppWait(e){await zb(this,e)}async handleWhatsAppLogout(e){await jb(this,e)}async handleAddWhatsAppAccount(e){await Hb(this,e)}async handleRemoveWhatsAppAccount(e){await qb(this,e)}async handleAccessCheck(){await Ja(this)}async handlePinSubmit(e,t){await gb(this,e,t),this.accessState.authenticated&&this.accessState.workspace&&this.handleWorkspaceSelect(this.accessState.workspace)}async handleSetMasterPin(e){await mb(this,e)}async handleLogout(){await vb(this)}toggleChangePinMode(){this.loginChangePinMode=!this.loginChangePinMode,this.changePinError=null,this.changePinSuccess=null}async handleChangePin(e,t,n){if(this.client){this.changePinBusy=!0,this.changePinError=null,this.changePinSuccess=null;try{const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.changePinError=i.message??"Incorrect current PIN",this.changePinBusy=!1;return}e==="__master__"?await this.client.request("access.setMasterPin",{pin:n}):await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.changePinSuccess="PIN changed successfully",this.changePinBusy=!1,setTimeout(()=>{this.loginChangePinMode=!1,this.changePinSuccess=null},2e3)}catch{this.changePinError="Failed to change PIN",this.changePinBusy=!1}}}async handleAccountPinSave(e,t,n){if(this.client){this.accountPinBusy=!0,this.accountPinError=null,this.accountPinSuccess=null;try{if(t!==null){const i=await this.client.request("access.verify",{account:e,pin:t});if(!i.ok){this.accountPinError=i.message??"Incorrect current PIN",this.accountPinBusy=!1;return}}await this.client.request("access.setAccountPin",{workspace:e,pin:n}),this.accountPinSuccess="PIN saved",this.accountPinBusy=!1,await Ja(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 aw(this)}async handleLicenseActivate(){await lw(this)}async handleLicenseRemove(){await cw(this)}handleLicenseKeyChange(e){uw(this,e)}async handleAuthStatusCheck(){await nw(this)}async handleAuthStart(){await iw(this)}async handleAuthSubmitCode(e){await sw(this,e)}handleAuthCodeChange(e){ow(this,e)}handleSkipToWhatsApp(){rw(this)}async handleGatewayHealthCheck(){await dw(this)}async handleGatewayRestart(){await pw(this)}async handleUpdateCheck(){await gu(this)}async handleUpdateRun(){await Zv(this)}handleUpdateDismissResult(){tb(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 ie(async()=>{const{runUninstall:t}=await Promise.resolve().then(()=>Br);return{runUninstall:t}},void 0,import.meta.url);await e(this)}handleUninstallDismiss(){ie(async()=>{const{clearUninstallDone:e}=await Promise.resolve().then(()=>Br);return{clearUninstallDone:e}},void 0,import.meta.url).then(({clearUninstallDone:e})=>{e()}),this.uninstallDone=!1,this.uninstallConfirm=!1,this.uninstallConfirmText=""}async loadAuditEntries(){await ic(this)}async clearAudit(){await nh(this),this.auditModalOpen=!1}handleFilesLoad(){var n;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((n=e==null?void 0:e.agents)==null?void 0:n.map(i=>i.id))??void 0;const t=this.resolveFilesAgentId();this.filesResolvedAgentId=t,Ut(this,t),bo(this,t)}handleAdminsLoad(){const e=this.resolveAdminAgentId();ie(async()=>{const{loadAdmins:t}=await Promise.resolve().then(()=>wb);return{loadAdmins:t}},void 0,import.meta.url).then(({loadAdmins:t})=>{t(this,e)})}resolveAdminAgentId(){const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(n=>n.id.endsWith("-admin")||n.id==="admin");return t==null?void 0:t.id}resolveFilesAgentId(){var n;const e=this.getSelectedWorkspaceInfo();if(!e)return;const t=e.agents.find(i=>i.id.endsWith("-admin")||i.id==="admin");return(t==null?void 0:t.id)??((n=e.agents[0])==null?void 0:n.id)}handleChatLoad(){const e=this.resolveAdminAgentId();if(e){const t=`agent:${e}:main`;t!==this.sessionKey&&(this.sessionKey=t,this.chatMessages=[],this.chatStream=null,this.chatInterimText=null,this.chatRunId=null,this.chatSuggestion=null,this.resetChatScroll(),this.applySettings({...this.settings,sessionKey:t,lastActiveSessionKey:t}),this.loadAssistantIdentity())}ie(async()=>{const{loadChatHistory:t}=await Promise.resolve().then(()=>oi);return{loadChatHistory:t}},void 0,import.meta.url).then(({loadChatHistory:t})=>{t(this).then(()=>{Bt(this,!0)})})}async handleLoadOlderChat(){if(this.chatLoadingOlder||!this.chatHistoryHasMore)return;const e=Gd(this),{loadOlderChatHistory:t}=await ie(async()=>{const{loadOlderChatHistory:i}=await Promise.resolve().then(()=>oi);return{loadOlderChatHistory:i}},void 0,import.meta.url);await t(this)&&e&&(await this.updateComplete,e())}handleAdvancedLoad(){var t;const e=this.getSelectedWorkspaceInfo();this.workspaceAgentIds=((t=e==null?void 0:e.agents)==null?void 0:t.map(n=>n.id))??void 0,this.sessionLogsEntries=[],this.sessionLogsCursors={},this.sessionLogsAgents=[],this.advancedTab==="cron"&&this.loadCron(),this.advancedTab==="logs"&&(this.logsSubTab==="session"?ie(async()=>{const{loadSessionLogs:n}=await Promise.resolve().then(()=>nc);return{loadSessionLogs:n}},void 0,import.meta.url).then(({loadSessionLogs:n})=>{n(this,{reset:!0})}):ie(async()=>{const{loadLogs:n}=await Promise.resolve().then(()=>gp);return{loadLogs:n}},void 0,import.meta.url).then(({loadLogs:n})=>{n(this,{reset:!0})})),this.advancedTab==="skills"&&ie(async()=>{const{loadSkills:n}=await Promise.resolve().then(()=>Qp);return{loadSkills:n}},void 0,import.meta.url).then(({loadSkills:n})=>{n(this,{clearMessages:!0})})}async handleChannelConfigSave(){await Vb(this)}async handleChannelConfigReload(){await Gb(this)}handleNostrProfileEdit(e,t){Yb(this,e,t)}handleNostrProfileCancel(){Xb(this)}handleNostrProfileFieldChange(e,t){Zb(this,e,t)}async handleNostrProfileSave(){await ew(this)}async handleNostrProfileImport(){await tw(this)}handleNostrProfileToggleAdvanced(){Jb(this)}async handleExecApprovalDecision(e){const t=this.execApprovalQueue[0];if(!(!t||!this.client||this.execApprovalBusy)){this.execApprovalBusy=!0,this.execApprovalError=null;try{await this.client.request("exec.approval.resolve",{id:t.id,decision:e}),this.execApprovalQueue=this.execApprovalQueue.filter(n=>n.id!==t.id)}catch(n){this.execApprovalError=`Exec approval failed: ${String(n)}`}finally{this.execApprovalBusy=!1}}}handleOpenSidebar(e){this.sidebarCloseTimer!=null&&(window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=null),this.sidebarContent=e,this.sidebarError=null,this.sidebarOpen=!0}handleCloseSidebar(){this.sidebarOpen=!1,this.sidebarCloseTimer!=null&&window.clearTimeout(this.sidebarCloseTimer),this.sidebarCloseTimer=window.setTimeout(()=>{this.sidebarOpen||(this.sidebarContent=null,this.sidebarError=null,this.sidebarCloseTimer=null)},200)}handleSplitRatioChange(e){const t=Math.max(.4,Math.min(.7,e));this.splitRatio=t,this.applySettings({...this.settings,splitRatio:t})}handleAdminsNewPhoneChange(e){this.adminsNewPhone=e,this.adminsError&&(this.adminsError=null)}handleContactsLoad(){const e=this.selectedWorkspace??void 0;ie(async()=>{const{loadContacts:t}=await Promise.resolve().then(()=>kb);return{loadContacts:t}},void 0,import.meta.url).then(({loadContacts:t})=>{t(this,e)})}handleContactsNewPhoneChange(e){this.contactsNewPhone=e,this.contactsError&&(this.contactsError=null)}handleContactsNewNameChange(e){this.contactsNewName=e,this.contactsError&&(this.contactsError=null)}async handleWorkspacesLoad(){const{loadWorkspaces:e}=await ie(async()=>{const{loadWorkspaces:t}=await Promise.resolve().then(()=>Vn);return{loadWorkspaces:t}},void 0,import.meta.url);await e(this)}async handleWorkspaceCreate(e,t){const{createWorkspace:n}=await ie(async()=>{const{createWorkspace:s}=await Promise.resolve().then(()=>Vn);return{createWorkspace:s}},void 0,import.meta.url),{loadChannels:i}=await ie(async()=>{const{loadChannels:s}=await Promise.resolve().then(()=>up);return{loadChannels:s}},void 0,import.meta.url);await n(this,{name:e,workspacePath:t,onCreated:s=>{if(!s.whatsappAccountId)return;const o=s.whatsappAccountId;this.handleWorkspaceSelect(e),setTimeout(async()=>{try{await i(this,!0),await this.handleWhatsAppStart(!0,o),this.whatsappLoginQrDataUrl&&(await this.handleWhatsAppWait(o),await i(this,!0),await this.handleWorkspacesLoad())}catch{}this.requestUpdate()},3e3)}})}async handleWorkspaceRemove(e){const{removeWorkspace:t}=await ie(async()=>{const{removeWorkspace:n}=await Promise.resolve().then(()=>Vn);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 ie(async()=>{const{renameWorkspace:i}=await Promise.resolve().then(()=>Vn);return{renameWorkspace:i}},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),Ar(e),this.settings=Yi(),this.chatMessage="",this.chatAttachments=[],this.chatStream=null,this.chatInterimText=null,this.chatSuggestion=null,this.chatStreamStartedAt=null,this.chatRunId=null,this.chatQueue=[],this.lastError=null,this.reloadCurrentPageData()}getSelectedWorkspaceInfo(){return this.selectedWorkspace?this.workspaces.find(e=>e.name===this.selectedWorkspace)??null:null}reloadCurrentPageData(){this.loadAuditEntries(),this.adminsPage?this.handleAdminsLoad():this.contactsPage?this.handleContactsLoad():this.filesPage?this.handleFilesLoad():this.chatPage?this.handleChatLoad():this.advancedPage&&this.handleAdvancedLoad()}initWorkspaceSelection(){if(this.workspaces.length===0){this.reloadCurrentPageData();return}const e=localStorage.getItem("taskmaster-selected-workspace"),t=e?this.workspaces.find(n=>n.name===e):null;if(t)this.selectedWorkspace=t.name;else{const n=this.workspaces.find(i=>i.isDefault)??this.workspaces[0];this.selectedWorkspace=n.name,localStorage.setItem("taskmaster-selected-workspace",n.name)}Ar(this.selectedWorkspace),this.settings=Yi(),this.reloadCurrentPageData()}render(){return p`${Lb(this)}${this.auditModalOpen?Rb(this.auditEntries,()=>this.clearAudit(),()=>{this.auditModalOpen=!1}):k}`}};m([y()],g.prototype,"settings",2);m([y()],g.prototype,"password",2);m([y()],g.prototype,"tab",2);m([y()],g.prototype,"onboarding",2);m([y()],g.prototype,"setup",2);m([y()],g.prototype,"filesPage",2);m([y()],g.prototype,"browserPage",2);m([y()],g.prototype,"adminsPage",2);m([y()],g.prototype,"contactsPage",2);m([y()],g.prototype,"chatPage",2);m([y()],g.prototype,"advancedPage",2);m([y()],g.prototype,"advancedTab",2);m([y()],g.prototype,"publicChat",2);m([y()],g.prototype,"publicChatConfig",2);m([y()],g.prototype,"publicChatSessionKey",2);m([y()],g.prototype,"publicChatAuthenticated",2);m([y()],g.prototype,"publicChatAuthStep",2);m([y()],g.prototype,"connected",2);m([y()],g.prototype,"accessState",2);m([y()],g.prototype,"theme",2);m([y()],g.prototype,"themeResolved",2);m([y()],g.prototype,"hello",2);m([y()],g.prototype,"lastError",2);m([y()],g.prototype,"eventLog",2);m([y()],g.prototype,"assistantName",2);m([y()],g.prototype,"assistantAvatar",2);m([y()],g.prototype,"assistantAgentId",2);m([y()],g.prototype,"sessionKey",2);m([y()],g.prototype,"chatLoading",2);m([y()],g.prototype,"chatSending",2);m([y()],g.prototype,"chatMessage",2);m([y()],g.prototype,"chatMessages",2);m([y()],g.prototype,"chatHistoryTotal",2);m([y()],g.prototype,"chatHistoryHasMore",2);m([y()],g.prototype,"chatLoadingOlder",2);m([y()],g.prototype,"chatToolMessages",2);m([y()],g.prototype,"chatStream",2);m([y()],g.prototype,"chatInterimText",2);m([y()],g.prototype,"chatSuggestion",2);m([y()],g.prototype,"chatStreamStartedAt",2);m([y()],g.prototype,"chatRunId",2);m([y()],g.prototype,"compactionStatus",2);m([y()],g.prototype,"chatAvatarUrl",2);m([y()],g.prototype,"chatThinkingLevel",2);m([y()],g.prototype,"chatModelProvider",2);m([y()],g.prototype,"chatModel",2);m([y()],g.prototype,"chatModelCatalog",2);m([y()],g.prototype,"chatVerboseLevel",2);m([y()],g.prototype,"chatFillerEnabled",2);m([y()],g.prototype,"chatQueue",2);m([y()],g.prototype,"chatAttachments",2);m([y()],g.prototype,"sidebarOpen",2);m([y()],g.prototype,"sidebarContent",2);m([y()],g.prototype,"sidebarError",2);m([y()],g.prototype,"splitRatio",2);m([y()],g.prototype,"nodesLoading",2);m([y()],g.prototype,"nodes",2);m([y()],g.prototype,"devicesLoading",2);m([y()],g.prototype,"devicesError",2);m([y()],g.prototype,"devicesList",2);m([y()],g.prototype,"execApprovalsLoading",2);m([y()],g.prototype,"execApprovalsSaving",2);m([y()],g.prototype,"execApprovalsDirty",2);m([y()],g.prototype,"execApprovalsSnapshot",2);m([y()],g.prototype,"execApprovalsForm",2);m([y()],g.prototype,"execApprovalsSelectedAgent",2);m([y()],g.prototype,"execApprovalsTarget",2);m([y()],g.prototype,"execApprovalsTargetNodeId",2);m([y()],g.prototype,"execApprovalQueue",2);m([y()],g.prototype,"execApprovalBusy",2);m([y()],g.prototype,"execApprovalError",2);m([y()],g.prototype,"configLoading",2);m([y()],g.prototype,"configRaw",2);m([y()],g.prototype,"configRawOriginal",2);m([y()],g.prototype,"configValid",2);m([y()],g.prototype,"configIssues",2);m([y()],g.prototype,"configSaving",2);m([y()],g.prototype,"configApplying",2);m([y()],g.prototype,"updateRunning",2);m([y()],g.prototype,"applySessionKey",2);m([y()],g.prototype,"configSnapshot",2);m([y()],g.prototype,"configSchema",2);m([y()],g.prototype,"configSchemaVersion",2);m([y()],g.prototype,"configSchemaLoading",2);m([y()],g.prototype,"configUiHints",2);m([y()],g.prototype,"configForm",2);m([y()],g.prototype,"configFormOriginal",2);m([y()],g.prototype,"configFormDirty",2);m([y()],g.prototype,"configFormMode",2);m([y()],g.prototype,"configSearchQuery",2);m([y()],g.prototype,"configActiveSection",2);m([y()],g.prototype,"configActiveSubsection",2);m([y()],g.prototype,"channelsLoading",2);m([y()],g.prototype,"channelsSnapshot",2);m([y()],g.prototype,"channelsError",2);m([y()],g.prototype,"channelsLastSuccess",2);m([y()],g.prototype,"whatsappLoginMessage",2);m([y()],g.prototype,"whatsappLoginQrDataUrl",2);m([y()],g.prototype,"whatsappLoginConnected",2);m([y()],g.prototype,"whatsappBusy",2);m([y()],g.prototype,"whatsappActiveQrAccountId",2);m([y()],g.prototype,"whatsappPairedPhone",2);m([y()],g.prototype,"addingWhatsAppAccount",2);m([y()],g.prototype,"newWhatsAppAccountName",2);m([y()],g.prototype,"whatsappAccountError",2);m([y()],g.prototype,"whatsappAccountSaving",2);m([y()],g.prototype,"whatsappSettingsOpen",2);m([y()],g.prototype,"publicChatToggleBusy",2);m([y()],g.prototype,"tailscaleStatus",2);m([y()],g.prototype,"tailscaleBusy",2);m([y()],g.prototype,"tailscaleAuthUrl",2);m([y()],g.prototype,"tailscaleError",2);m([y()],g.prototype,"tailscaleFunnelEnableUrl",2);m([y()],g.prototype,"wifiStatus",2);m([y()],g.prototype,"wifiNetworks",2);m([y()],g.prototype,"wifiBusy",2);m([y()],g.prototype,"wifiError",2);m([y()],g.prototype,"wifiPassword",2);m([y()],g.prototype,"wifiSelectedSsid",2);m([y()],g.prototype,"licenseKey",2);m([y()],g.prototype,"licenseBusy",2);m([y()],g.prototype,"licenseValid",2);m([y()],g.prototype,"licenseMessage",2);m([y()],g.prototype,"licenseTier",2);m([y()],g.prototype,"licenseDeviceId",2);m([y()],g.prototype,"licenseStoredKey",2);m([y()],g.prototype,"licenseRemoveConfirm",2);m([y()],g.prototype,"authConnected",2);m([y()],g.prototype,"authBusy",2);m([y()],g.prototype,"authMessage",2);m([y()],g.prototype,"authUrl",2);m([y()],g.prototype,"authCodeInput",2);m([y()],g.prototype,"authExpiresIn",2);m([y()],g.prototype,"setupStep",2);m([y()],g.prototype,"gatewayHealthy",2);m([y()],g.prototype,"gatewayHealthLoading",2);m([y()],g.prototype,"gatewayHealthMessage",2);m([y()],g.prototype,"gatewayRestartBusy",2);m([y()],g.prototype,"updateAvailable",2);m([y()],g.prototype,"currentVersion",2);m([y()],g.prototype,"latestVersion",2);m([y()],g.prototype,"updateChecking",2);m([y()],g.prototype,"updateMessage",2);m([y()],g.prototype,"updateProgressSteps",2);m([y()],g.prototype,"updateLastResult",2);m([y()],g.prototype,"uninstallConfirm",2);m([y()],g.prototype,"uninstallBusy",2);m([y()],g.prototype,"uninstallDone",2);m([y()],g.prototype,"uninstallError",2);m([y()],g.prototype,"uninstallConfirmText",2);m([y()],g.prototype,"nostrProfileFormState",2);m([y()],g.prototype,"nostrProfileAccountId",2);m([y()],g.prototype,"presenceLoading",2);m([y()],g.prototype,"presenceEntries",2);m([y()],g.prototype,"presenceError",2);m([y()],g.prototype,"presenceStatus",2);m([y()],g.prototype,"agentsLoading",2);m([y()],g.prototype,"agentsList",2);m([y()],g.prototype,"agentsError",2);m([y()],g.prototype,"sessionsLoading",2);m([y()],g.prototype,"sessionsResult",2);m([y()],g.prototype,"sessionsError",2);m([y()],g.prototype,"cronLoading",2);m([y()],g.prototype,"cronJobs",2);m([y()],g.prototype,"cronStatus",2);m([y()],g.prototype,"cronError",2);m([y()],g.prototype,"cronForm",2);m([y()],g.prototype,"cronRunsJobId",2);m([y()],g.prototype,"cronRuns",2);m([y()],g.prototype,"cronBusy",2);m([y()],g.prototype,"cronNewEventModal",2);m([y()],g.prototype,"cronDetailJobId",2);m([y()],g.prototype,"browserScreencastActive",2);m([y()],g.prototype,"browserScreencastFrame",2);m([y()],g.prototype,"browserScreencastMetadata",2);m([y()],g.prototype,"browserHandoffPending",2);m([y()],g.prototype,"browserHandoffReason",2);m([y()],g.prototype,"browserHandoffId",2);m([y()],g.prototype,"browserInputMode",2);m([y()],g.prototype,"browserFullscreen",2);m([y()],g.prototype,"browserLoading",2);m([y()],g.prototype,"browserError",2);m([y()],g.prototype,"filesLoading",2);m([y()],g.prototype,"filesTree",2);m([y()],g.prototype,"filesRoot",2);m([y()],g.prototype,"filesError",2);m([y()],g.prototype,"filesSelectedPath",2);m([y()],g.prototype,"filesSelectedPaths",2);m([y()],g.prototype,"filesPreviewContent",2);m([y()],g.prototype,"filesPreviewLoading",2);m([y()],g.prototype,"filesPreviewBinary",2);m([y()],g.prototype,"filesPreviewSize",2);m([y()],g.prototype,"filesExpandedDirs",2);m([y()],g.prototype,"filesCurrentDir",2);m([y()],g.prototype,"filesPendingDeletePath",2);m([y()],g.prototype,"filesMessage",2);m([y()],g.prototype,"filesUploadBusy",2);m([y()],g.prototype,"filesReindexBusy",2);m([y()],g.prototype,"filesMemoryStatus",2);m([y()],g.prototype,"embeddingDownloading",2);m([y()],g.prototype,"filesSearchQuery",2);m([y()],g.prototype,"filesSearchResults",2);m([y()],g.prototype,"filesSearchLoading",2);m([y()],g.prototype,"filesSearchAgentId",2);m([y()],g.prototype,"auditEntries",2);m([y()],g.prototype,"auditLoading",2);m([y()],g.prototype,"auditModalOpen",2);m([y()],g.prototype,"skillsLoading",2);m([y()],g.prototype,"skillsReport",2);m([y()],g.prototype,"skillsError",2);m([y()],g.prototype,"skillsFilter",2);m([y()],g.prototype,"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,"contactsLoading",2);m([y()],g.prototype,"contactsSaving",2);m([y()],g.prototype,"contactsRecords",2);m([y()],g.prototype,"contactsError",2);m([y()],g.prototype,"contactsSearchQuery",2);m([y()],g.prototype,"contactsEditingId",2);m([y()],g.prototype,"contactsShowAddForm",2);m([y()],g.prototype,"contactsNewPhone",2);m([y()],g.prototype,"contactsNewName",2);m([y()],g.prototype,"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,"sessionLogsCursors",2);m([y()],g.prototype,"sessionLogsLastFetchAt",2);m([y()],g.prototype,"sessionLogsAtBottom",2);m([y()],g.prototype,"chatUserNearBottom",2);g=m([ul("taskmaster-app")],g);
3542
- //# sourceMappingURL=index-HzTAaV5Y.js.map
3539
+ //# sourceMappingURL=index-DtuDNTAC.js.map