Welcome.
From 3664fcb578618d1684692b72d45920ff2e1519b6 Mon Sep 17 00:00:00 2001
From: Krasimir Kralev <263465593+KrasimirKralev@users.noreply.github.com>
Date: Sat, 7 Nov 2026 08:47:48 +0200
Subject: [PATCH 1/6] improve(web): explain workspace deletion and empty
ownership transfer
---
CHANGELOG.md | 2 +
apps/api/internal/webassets/dist/200.html | 4 +-
.../{app.ibw7ZCvv.js => app.aGajNKhZ.js} | 4 +-
.../dist/_app/immutable/nodes/10.NytjfBRi.js | 2 -
.../dist/_app/immutable/nodes/10.hy6Cmf4Z.js | 2 +
apps/api/internal/webassets/dist/index.html | 4 +-
.../(settings)/settings/overview/+page.svelte | 12 +++-
docs/features/workspaces.md | 2 +
tests/e2e/workspace-danger-zone.spec.ts | 60 +++++++++++++++++++
9 files changed, 83 insertions(+), 9 deletions(-)
rename apps/api/internal/webassets/dist/_app/immutable/entry/{app.ibw7ZCvv.js => app.aGajNKhZ.js} (96%)
delete mode 100644 apps/api/internal/webassets/dist/_app/immutable/nodes/10.NytjfBRi.js
create mode 100644 apps/api/internal/webassets/dist/_app/immutable/nodes/10.hy6Cmf4Z.js
create mode 100644 tests/e2e/workspace-danger-zone.spec.ts
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1032b4ce..b8eae066 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+- Workspace settings now say to type the workspace name before deleting it, label that field for screen readers, and show "No eligible members" instead of a blank transfer menu. Thanks @KrasimirKralev.
+
## 0.9.4 - 2026-11-05
**Highlights:** Clearer client configuration and signed-out session errors, with refreshed desktop and database dependencies.
diff --git a/apps/api/internal/webassets/dist/200.html b/apps/api/internal/webassets/dist/200.html
index f06f4b71..d3daecf4 100644
--- a/apps/api/internal/webassets/dist/200.html
+++ b/apps/api/internal/webassets/dist/200.html
@@ -114,7 +114,7 @@
-
+
@@ -136,7 +136,7 @@
import("/_app/immutable/entry/start.BT73xe8L.js").then(async (kit) => {
kit.init(__sveltekit_375u9e);
- const app = await import("/_app/immutable/entry/app.ibw7ZCvv.js");
+ const app = await import("/_app/immutable/entry/app.aGajNKhZ.js");
kit.start(app, element);
});
}
diff --git a/apps/api/internal/webassets/dist/_app/immutable/entry/app.ibw7ZCvv.js b/apps/api/internal/webassets/dist/_app/immutable/entry/app.aGajNKhZ.js
similarity index 96%
rename from apps/api/internal/webassets/dist/_app/immutable/entry/app.ibw7ZCvv.js
rename to apps/api/internal/webassets/dist/_app/immutable/entry/app.aGajNKhZ.js
index 3607c907..3d5ef23b 100644
--- a/apps/api/internal/webassets/dist/_app/immutable/entry/app.ibw7ZCvv.js
+++ b/apps/api/internal/webassets/dist/_app/immutable/entry/app.aGajNKhZ.js
@@ -1,2 +1,2 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CaM-kUrk.js","../chunks/DK3Fl9T5.js","../chunks/B-aw2y_U.js","../chunks/DF-YT2R-.js","./payload.DSmR2FwN.js","../chunks/Cg3pm-K7.js","../chunks/Dek69VGa.js","../chunks/C7ceXZWF.js","../chunks/BJnJ0WUy.js","../chunks/Dqjw8vaP.js","../chunks/DEPNME54.js","../assets/0.DCnwR7ce.css","../nodes/1.DYKgSh_a.js","../chunks/BHJGS62J.js","../nodes/2.CaVhX4UR.js","../chunks/B4px22Nd.js","../chunks/DBpO2iwN.js","../nodes/3.BP3QQiq-.js","../chunks/CRzLMJPS.js","../chunks/B0KjTaKD.js","../nodes/4.BlCTXp06.js","../chunks/CrCe5h9G.js","../chunks/BrEh_cfB.js","../chunks/BjZKaODP.js","../assets/QuoteBlock.Bmfc9wvU.css","../chunks/BemjdTbp.js","../chunks/DlGnnCJo.js","../chunks/CFaGG57V.js","../chunks/Co8QWJHk.js","../assets/ThreadPanel.DFXp9CyT.css","../chunks/CVdgRPye.js","../chunks/BIhzYFGW.js","../assets/ChatApp.BrxGlI__.css","../nodes/5.DHcWwatK.js","../nodes/6.D9bjDxN0.js","../nodes/7.DRY45mdW.js","../chunks/ClHfuOFp.js","../nodes/8.CbfDv62O.js","../nodes/9.CyNVdyaS.js","../nodes/10.NytjfBRi.js","../nodes/11.xg1uwDfw.js","../nodes/12.JNbQmAcv.js","../assets/12.CzRaoRZI.css","../nodes/13.SnqpANMe.js","../assets/13.CMVv15Ug.css"])))=>i.map(i=>d[i]);
-import{t as e}from"../chunks/CRzLMJPS.js";var t={},n=[()=>e(()=>import(`../nodes/0.CaM-kUrk.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url),()=>e(()=>import(`../nodes/1.DYKgSh_a.js`),__vite__mapDeps([12,2,7,4,6,13]),import.meta.url),()=>e(()=>import(`../nodes/2.CaVhX4UR.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,10,13,15,16]),import.meta.url),()=>e(()=>import(`../nodes/3.BP3QQiq-.js`),__vite__mapDeps([17,1,18,2,19]),import.meta.url),()=>e(()=>import(`../nodes/4.BlCTXp06.js`),__vite__mapDeps([20,2,19,21,1,18,3,4,5,6,7,10,9,15,16,22,23,24,25,8,26,27,28,29,30,31,32]),import.meta.url),()=>e(()=>import(`../nodes/5.DHcWwatK.js`),__vite__mapDeps([33,2,21,1,18,3,4,5,6,7,10,9,15,16,19,22,23,24,25,8,26,27,28,29,30,31,32]),import.meta.url),()=>e(()=>import(`../nodes/6.D9bjDxN0.js`),__vite__mapDeps([34,1,5,6,15]),import.meta.url),()=>e(()=>import(`../nodes/7.DRY45mdW.js`),__vite__mapDeps([35,1,2,10,9,16,30,36]),import.meta.url),()=>e(()=>import(`../nodes/8.CbfDv62O.js`),__vite__mapDeps([37,1,2,10,9,16,26,27,30,31,36]),import.meta.url),()=>e(()=>import(`../nodes/9.CyNVdyaS.js`),__vite__mapDeps([38,1,2,23,10,27,31]),import.meta.url),()=>e(()=>import(`../nodes/10.NytjfBRi.js`),__vite__mapDeps([39,1,2,3,4,5,6,7,10,16,31]),import.meta.url),()=>e(()=>import(`../nodes/11.xg1uwDfw.js`),__vite__mapDeps([40,2,21,1,18,3,4,5,6,7,10,9,15,16,19,22,23,24,25,8,26,27,28,29,30,31,32]),import.meta.url),()=>e(()=>import(`../nodes/12.JNbQmAcv.js`),__vite__mapDeps([41,1,2,10,9,22,23,24,25,8,26,27,31,42]),import.meta.url),()=>e(()=>import(`../nodes/13.SnqpANMe.js`),__vite__mapDeps([43,1,2,10,9,22,23,24,26,28,29,31,44]),import.meta.url)],r=[],i={"/":[3],"/app":[4],"/app/[workspaceID]":[5],"/app/[workspaceID]/(settings)/settings":[6,[2]],"/app/[workspaceID]/(settings)/settings/bots":[7,[2]],"/app/[workspaceID]/(settings)/settings/integrations":[8,[2]],"/app/[workspaceID]/(settings)/settings/members":[9,[2]],"/app/[workspaceID]/(settings)/settings/overview":[10,[2]],"/app/[workspaceID]/[targetID]":[11],"/embed/channel/[workspaceID]/[channelID]":[12],"/embed/thread/[workspaceID]/[messageID]":[13]},a={handleError:(({kind:e,error:t})=>{e===`unknown`&&console.error(t)}),reroute:(()=>{}),transport:{}},o=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.decode])),s=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.encode])),c=!1,l=(e,t)=>o[e](t),u=()=>e(()=>import(`../chunks/Bjy-W4x2.js`).then(e=>e.default),[],import.meta.url);export{l as decode,o as decoders,i as dictionary,s as encoders,u as get_error_template,c as hash,a as hooks,t as matchers,n as nodes,r as server_loads};
\ No newline at end of file
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CaM-kUrk.js","../chunks/DK3Fl9T5.js","../chunks/B-aw2y_U.js","../chunks/DF-YT2R-.js","./payload.DSmR2FwN.js","../chunks/Cg3pm-K7.js","../chunks/Dek69VGa.js","../chunks/C7ceXZWF.js","../chunks/BJnJ0WUy.js","../chunks/Dqjw8vaP.js","../chunks/DEPNME54.js","../assets/0.DCnwR7ce.css","../nodes/1.DYKgSh_a.js","../chunks/BHJGS62J.js","../nodes/2.CaVhX4UR.js","../chunks/B4px22Nd.js","../chunks/DBpO2iwN.js","../nodes/3.BP3QQiq-.js","../chunks/CRzLMJPS.js","../chunks/B0KjTaKD.js","../nodes/4.BlCTXp06.js","../chunks/CrCe5h9G.js","../chunks/BrEh_cfB.js","../chunks/BjZKaODP.js","../assets/QuoteBlock.Bmfc9wvU.css","../chunks/BemjdTbp.js","../chunks/DlGnnCJo.js","../chunks/CFaGG57V.js","../chunks/Co8QWJHk.js","../assets/ThreadPanel.DFXp9CyT.css","../chunks/CVdgRPye.js","../chunks/BIhzYFGW.js","../assets/ChatApp.BrxGlI__.css","../nodes/5.DHcWwatK.js","../nodes/6.D9bjDxN0.js","../nodes/7.DRY45mdW.js","../chunks/ClHfuOFp.js","../nodes/8.CbfDv62O.js","../nodes/9.CyNVdyaS.js","../nodes/10.hy6Cmf4Z.js","../nodes/11.xg1uwDfw.js","../nodes/12.JNbQmAcv.js","../assets/12.CzRaoRZI.css","../nodes/13.SnqpANMe.js","../assets/13.CMVv15Ug.css"])))=>i.map(i=>d[i]);
+import{t as e}from"../chunks/CRzLMJPS.js";var t={},n=[()=>e(()=>import(`../nodes/0.CaM-kUrk.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url),()=>e(()=>import(`../nodes/1.DYKgSh_a.js`),__vite__mapDeps([12,2,7,4,6,13]),import.meta.url),()=>e(()=>import(`../nodes/2.CaVhX4UR.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,10,13,15,16]),import.meta.url),()=>e(()=>import(`../nodes/3.BP3QQiq-.js`),__vite__mapDeps([17,1,18,2,19]),import.meta.url),()=>e(()=>import(`../nodes/4.BlCTXp06.js`),__vite__mapDeps([20,2,19,21,1,18,3,4,5,6,7,10,9,15,16,22,23,24,25,8,26,27,28,29,30,31,32]),import.meta.url),()=>e(()=>import(`../nodes/5.DHcWwatK.js`),__vite__mapDeps([33,2,21,1,18,3,4,5,6,7,10,9,15,16,19,22,23,24,25,8,26,27,28,29,30,31,32]),import.meta.url),()=>e(()=>import(`../nodes/6.D9bjDxN0.js`),__vite__mapDeps([34,1,5,6,15]),import.meta.url),()=>e(()=>import(`../nodes/7.DRY45mdW.js`),__vite__mapDeps([35,1,2,10,9,16,30,36]),import.meta.url),()=>e(()=>import(`../nodes/8.CbfDv62O.js`),__vite__mapDeps([37,1,2,10,9,16,26,27,30,31,36]),import.meta.url),()=>e(()=>import(`../nodes/9.CyNVdyaS.js`),__vite__mapDeps([38,1,2,23,10,27,31]),import.meta.url),()=>e(()=>import(`../nodes/10.hy6Cmf4Z.js`),__vite__mapDeps([39,1,2,3,4,5,6,7,10,16,31]),import.meta.url),()=>e(()=>import(`../nodes/11.xg1uwDfw.js`),__vite__mapDeps([40,2,21,1,18,3,4,5,6,7,10,9,15,16,19,22,23,24,25,8,26,27,28,29,30,31,32]),import.meta.url),()=>e(()=>import(`../nodes/12.JNbQmAcv.js`),__vite__mapDeps([41,1,2,10,9,22,23,24,25,8,26,27,31,42]),import.meta.url),()=>e(()=>import(`../nodes/13.SnqpANMe.js`),__vite__mapDeps([43,1,2,10,9,22,23,24,26,28,29,31,44]),import.meta.url)],r=[],i={"/":[3],"/app":[4],"/app/[workspaceID]":[5],"/app/[workspaceID]/(settings)/settings":[6,[2]],"/app/[workspaceID]/(settings)/settings/bots":[7,[2]],"/app/[workspaceID]/(settings)/settings/integrations":[8,[2]],"/app/[workspaceID]/(settings)/settings/members":[9,[2]],"/app/[workspaceID]/(settings)/settings/overview":[10,[2]],"/app/[workspaceID]/[targetID]":[11],"/embed/channel/[workspaceID]/[channelID]":[12],"/embed/thread/[workspaceID]/[messageID]":[13]},a={handleError:(({kind:e,error:t})=>{e===`unknown`&&console.error(t)}),reroute:(()=>{}),transport:{}},o=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.decode])),s=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.encode])),c=!1,l=(e,t)=>o[e](t),u=()=>e(()=>import(`../chunks/Bjy-W4x2.js`).then(e=>e.default),[],import.meta.url);export{l as decode,o as decoders,i as dictionary,s as encoders,u as get_error_template,c as hash,a as hooks,t as matchers,n as nodes,r as server_loads};
\ No newline at end of file
diff --git a/apps/api/internal/webassets/dist/_app/immutable/nodes/10.NytjfBRi.js b/apps/api/internal/webassets/dist/_app/immutable/nodes/10.NytjfBRi.js
deleted file mode 100644
index 1c04df38..00000000
--- a/apps/api/internal/webassets/dist/_app/immutable/nodes/10.NytjfBRi.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import{t as e}from"../chunks/DK3Fl9T5.js";import{B as t,Ct as n,E as r,Et as i,H as a,I as o,R as s,Tt as c,U as l,W as u,X as d,_t as f,bt as p,ct as m,d as h,f as ee,g as te,gt as g,h as ne,ht as _,k as v,kt as y,l as b,lt as x,mt as re,o as S,pt as C,y as w,yt as T}from"../chunks/B-aw2y_U.js";import{n as ie,r as E}from"../chunks/DF-YT2R-.js";import{i as D,n as O,t as k}from"../chunks/DEPNME54.js";import{n as ae}from"../chunks/DBpO2iwN.js";import{t as oe}from"../chunks/BIhzYFGW.js";var A=e({prerender:()=>!1,ssr:()=>!1}),se=t(``),ce=t(`
Preparing a safe preview.
Download original
You can still download the original file.
Download originalPreview is limited to 10,000 cells, the first 1,000 rows, and the first 100 columns. Download the original to inspect omitted cells.
`),Ar=r(``),jr=r(``),Pr=r(`
`),Fr=r(`
Some slide content was omitted by preview limits.
`),Ir=r(` `,1),Lr=r(``),Rr=r(``),zr=r(``),Br=r(` `),Vr=r(`or
`),Kr=r(` Continue with GitHub`,1),qr=r(` Sign in with OpenClaw ID`),Jr=r(``),Yr=r(`
`),Xr=r(`
`),$r=r(``);function ei(e,t){s(t,!0);let n=B(t,`deleting`,3,!1),r=B(t,`error`,3,``),a=i(()=>t.message.author?.display_name||`Local User`);function o(){n()||t.onClose()}var c=$r(),l=z(c),d=F(l,2),f=z(d),p=F(z(f),2);R(f);var m=F(f,2),h=F(z(m),2),_=z(h);{let e=i(()=>t.message.author?.id||t.message.author_id),n=i(()=>t.message.author?.avatar_url);yt(_,{class:`avatar`,get id(){return C(e)},get name(){return C(a)},get src(){return C(n)},size:36,loading:`eager`,fetchPriority:`auto`})}var v=F(_,2),y=z(v),x=z(y),w=I(x,!0),T=F(x,2),E=I(T,!0);R(y);var D=F(y,2),O=I(D,!0);R(v),R(h);var k=F(h,2),A=e=>{var t=Qr(),n=I(t,!0);j(()=>u(n,r())),g(e,t)};L(k,e=>{r()&&e(A)});var M=F(k,2),N=z(M),ee=F(N,2),te=I(ee,!0);R(M),R(m),R(d),R(c),j(e=>{l.disabled=n(),p.disabled=n(),u(w,C(a)),P(T,`datetime`,t.message.created_at),u(E,e),u(O,t.message.body),N.disabled=n(),ee.disabled=n(),u(te,n()?`Deleting...`:`Delete`)},[()=>et(t.message.created_at)]),S(`click`,l,o),S(`click`,p,o),S(`click`,N,o),S(`click`,ee,function(...e){t.onConfirm?.apply(this,e)}),g(e,c),b()}x([`click`]);var ti=6500,ni=r(`
`),fi=r(`
Channels
`),_i=r(`
`),vi=r(`
Direct messages
`),wi=r(`
Creating workspace…
`),Ti=r(``),Ei=r(``);function Di(e,t){s(t,!0);let n=B(t,`homeHref`,3,`/`),r=B(t,`homeLabel`,3,`cc`),a=B(t,`homeTitle`,3,`ClickClack home`);function l(e){return e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey}var d=Ei(),f=z(d);let p;var m=z(f),h=e=>{Qe(e,{size:48})},_=i(()=>zt(r())),v=e=>{var t=bi(),n=I(t,!0);j(()=>u(n,r())),g(e,t)};L(m,e=>{C(_)?e(h):e(v,-1)}),R(f);var y=F(f,4),x=z(y);o(x,17,()=>t.workspaces,e=>e.id,(e,n)=>{var r=Si();let i;var a=z(r),o=z(a),s=e=>{var t=xi();j(e=>P(t,`src`,e),[()=>Ce(C(n).icon_url)]),g(e,t)},c=e=>{var t=bi(),r=I(t,!0);j(e=>u(r,e),[()=>_t(C(n).name)]),g(e,t)};L(o,e=>{C(n).icon_url?e(s):e(c,-1)}),R(a),R(r),j(e=>{i=U(r,1,`guild-wrap`,null,i,{active:C(n).id===t.selectedWorkspaceID}),P(a,`title`,C(n).name),P(a,`aria-label`,C(n).name),P(a,`href`,e)},[()=>t.hrefForWorkspace(C(n).id)]),S(`click`,a,e=>{l(e)&&(e.preventDefault(),t.onSelectWorkspace(C(n).id))}),g(e,r)});var w=F(x,2);R(y);var T=F(y,2),E=e=>{var n=Ti(),r=z(n);M(r);var i=F(r,2),a=e=>{var n=Ci(),r=I(n,!0);j(()=>u(r,t.createError)),g(e,n)};L(i,e=>{t.createError&&e(a)});var o=F(i,2),s=e=>{var t=wi();g(e,t)};L(o,e=>{t.createPending&&e(s)}),R(n),j(()=>{se(r,t.workspaceName),r.disabled=t.createPending}),c(`submit`,n,e=>{e.preventDefault(),t.onCreateWorkspace()}),S(`input`,r,e=>t.onWorkspaceName(e.currentTarget.value)),g(e,n)};L(T,e=>{t.showWorkspaceCreate&&e(E)}),R(d),j(e=>{p=U(f,1,`guild home`,null,p,{"home--mark":e}),P(f,`title`,a()),P(f,`aria-label`,a()),P(f,`href`,n())},[()=>zt(r())]),S(`click`,w,function(...e){t.onToggleWorkspaceCreate?.apply(this,e)}),g(e,d),b()}x([`click`,`input`]);var Oi=`clickclack:sidebar-channel-order:v1:`,ki=new Map,Ai=new Map;function ji(e,t){return`${Oi}${t}:${e}`}function Mi(e){if(!e||e.length>1e6)return[];try{let t=JSON.parse(e);return Array.isArray(t)&&t.length<=1e4&&t.every(e=>typeof e==`string`&&e.length<=128)?[...new Set(t)]:[]}catch{return[]}}function Ni(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Pi(e,t,n){e?.startsWith(`${Oi}${n}:`)&&ki.set(e,Mi(t))}function Fi(e,t){if(!e?.id||!t)return[];let n=ji(t,e.id),r=ki.get(n);if(r)return r;let i=[];try{i=Mi(window.localStorage.getItem(n))}catch{}let a=e.sidebar_preferences?.channel_order?.[t];if(a===void 0)return i;let o=a.length?[...new Set([...a,...i])].slice(0,1e4):[];return Ni(n,o),o}function Ii(e,t,n,r,i){let a=ji(t,e);ki.set(a,n),Ni(a,n);let o=(Ai.get(a)??Promise.resolve()).then(async()=>{if(ki.get(a)===n&&i())try{let e=JSON.stringify({sidebar_preferences:{channel_order:{[t]:n.slice(0,500)}}});await r(`/api/me`,{method:`PATCH`,keepalive:new TextEncoder().encode(e).length<6e4,body:e})}catch{}});return Ai.set(a,o),o.then(()=>{Ai.get(a)===o&&Ai.delete(a)}),o}var Li=r(``),Ri=r(` `,1),zi=r(``),Bi=r(` `),Vi=r(``),Hi=r(`No pinned messages
Pin important messages to keep them easily accessible.
Try another word or phrase.
`),$=r(`
Channel
Archived channels move to the Archived section and keep their full message history.
`),Ha=r(``),Ua=r(``);function Wa(e,t){s(t,!0);let n=A(!1),r=A(``),i=A(!1),a=new AbortController;ie(()=>a.abort());async function o(){if(!C(n)){W(n,!0),W(r,``),W(i,!1);try{let e=await ke({method:`PATCH`,body:JSON.stringify(t.payload()),signal:a.signal});a.signal.throwIfAborted(),t.onUserUpdated(e.user),W(r,`Saved`),t.onSaved?.()}catch(e){if(a.signal.aborted)return;W(r,De(e,`Could not save ${t.section}`),!0),W(i,!0)}finally{W(n,!1)}}}var l=Ua(),d=z(l),f=z(d);p(f,()=>t.children),R(d);var m=F(d,2),h=z(m),_=e=>{var t=Va();let n;var a=I(t,!0);j(()=>{n=U(t,1,`settings-status`,null,n,{"is-error":C(i)}),u(a,C(r))}),g(e,t)},v=e=>{var t=Ha();g(e,t)};L(h,e=>{C(r)?e(_):e(v,-1)});var y=F(h,2),x=I(y,!0);R(m),R(l),j(()=>{d.disabled=C(n),y.disabled=C(n),u(x,C(n)?`Saving...`:`Save ${t.section}`)}),c(`submit`,l,e=>{e.preventDefault(),o()}),g(e,l),b()}var Ga=r(`
Browser notifications are not supported on this device.
`),Ka=r(`Browser notifications are blocked by this browser.
`),qa=r(``),Ja=r(`
Show alerts when ClickClack is in the background.
Shown in messages, mentions, and your profile card.
Used in mentions and the quick switcher. Must be unique.
Paste a public image URL. Your initials show when empty.
Keep agent reasoning summaries out of the message timeline.
Hide tool execution details while keeping ordinary messages visible.
Choose which side of the timeline shows your messages.
Choose which side of the timeline shows messages from other people and agents.
Add ClickClack to your Home Screen from the Share menu, then open it from there to turn this on.
`),eo=r(`This browser does not support push notifications.
`),to=r(``),no=r(`
`),ro=r(`
Receive alerts when the app is closed.
Send push notifications to your phone via Pushover.
Find this in your Pushover dashboard under "Your User Key".
Loading…
`),co=r(``),lo=r(`
Account
Bots you own across your workspaces. Tokens live with the workspace where the bot was created.
`),bo=r(``),xo=r(``);function So(e,t){s(t,!0);let n=A(``),r=A(``),i=A(``),a=A(``),o=A(!1),l=A(!1);async function d(){if(C(l))return;let e=vo(C(n),C(r),C(i));if(e)W(a,e,!0),W(o,!0);else{W(l,!0),W(a,``),W(o,!1);try{await G(`/api/auth/password/change`,{method:`POST`,body:JSON.stringify({current_password:C(n),new_password:C(r)})}),W(n,``),W(r,``),W(i,``),W(a,`Password updated. Your other devices were signed out.`)}catch(e){W(a,De(e,`Could not change your password`),!0),W(o,!0)}finally{W(l,!1)}}}var f=xo(),p=F(z(f),2),m=z(p),h=F(z(m),2),_=z(h);M(_),R(h),R(m);var v=F(m,2),y=F(z(v),2),x=z(y);M(x),R(y),R(v);var S=F(v,2),w=F(z(S),2),T=z(w);M(T),R(w),R(S),R(p);var E=F(p,2),D=z(E),O=e=>{var t=yo();let n;var r=I(t,!0);j(()=>{n=U(t,1,`settings-status`,null,n,{"is-error":C(o)}),u(r,C(a))}),g(e,t)},k=e=>{var t=bo();g(e,t)};L(D,e=>{C(a)?e(O):e(k,-1)});var N=F(D,2),P=I(N,!0);R(E),R(f),j(()=>{N.disabled=C(l),u(P,C(l)?`Updating...`:`Update password`)}),c(`submit`,f,e=>{e.preventDefault(),d()}),ae(_,()=>C(n),e=>W(n,e)),ae(x,()=>C(r),e=>W(r,e)),ae(T,()=>C(i),e=>W(i,e)),g(e,f),b()}var Co=r(``),wo=r(``),To=r(`
Account
Changes apply instantly and follow your account on every device.
Live preview — updates as you pick
Workspace
`,1),Po=r(``),Fo=r(``),Io=r(`
Loading...
`),Ro=r(``),zo=r(`
`),Bo=r(`
Account
How you appear across ClickClack.
End this session on this device.
Account
Decide when and how ClickClack should reach you.
`),js=r(`
`,1),Is=r(`
Loading thread…
`),Ls=r(``),bo=r(``),xo=r(``);function So(e,t){s(t,!0);let n=A(``),r=A(``),i=A(``),a=A(``),o=A(!1),l=A(!1);async function d(){if(C(l))return;let e=vo(C(n),C(r),C(i));if(e)W(a,e,!0),W(o,!0);else{W(l,!0),W(a,``),W(o,!1);try{await G(`/api/auth/password/change`,{method:`POST`,body:JSON.stringify({current_password:C(n),new_password:C(r)})}),W(n,``),W(r,``),W(i,``),W(a,`Password updated. Your other devices were signed out.`)}catch(e){W(a,De(e,`Could not change your password`),!0),W(o,!0)}finally{W(l,!1)}}}var f=xo(),p=F(z(f),2),m=z(p),h=F(z(m),2),_=z(h);M(_),R(h),R(m);var v=F(m,2),y=F(z(v),2),x=z(y);M(x),R(y),R(v);var S=F(v,2),w=F(z(S),2),T=z(w);M(T),R(w),R(S),R(p);var E=F(p,2),D=z(E),O=e=>{var t=yo();let n;var r=I(t,!0);j(()=>{n=U(t,1,`settings-status`,null,n,{"is-error":C(o)}),u(r,C(a))}),g(e,t)},k=e=>{var t=bo();g(e,t)};L(D,e=>{C(a)?e(O):e(k,-1)});var N=F(D,2),P=I(N,!0);R(E),R(f),j(()=>{N.disabled=C(l),u(P,C(l)?`Updating...`:`Update password`)}),c(`submit`,f,e=>{e.preventDefault(),d()}),ae(_,()=>C(n),e=>W(n,e)),ae(x,()=>C(r),e=>W(r,e)),ae(T,()=>C(i),e=>W(i,e)),g(e,f),b()}var Co=r(``),wo=r(``),To=r(`
Account
Changes apply instantly and follow your account on every device.
Live preview — updates as you pick
Workspace
`,1),Po=r(``),Fo=r(``),Io=r(`
Loading...
`),Ro=r(``),zo=r(`
`),Bo=r(`
Account
How you appear across ClickClack.
End this session on this device.
Account
Decide when and how ClickClack should reach you.
`),js=r(`
`,1),Is=r(`
Loading thread…
`),Ls=r(``),Ue=e(`
`),Ye=e(`
`),Ue=e(`
`),Ye=e(`
Open source · MIT · Single Go binary
ClickClack is a self-hostable chat app with Slack-style threads, +import{B as e,D as t,E as n,Et as r,I as i,Ot as a,R as o,S as s,Tt as c,V as l,X as u,a as d,b as f,ct as p,dt as m,f as h,gt as g,ht as _,k as ee,kt as v,pt as y,rt as b,v as x,y as S}from"./BZp9foKd.js";import"./Dkz09enA.js";var C=new Set([`clickclack.chat`,`www.clickclack.chat`]);function w(e){return C.has(e.toLowerCase())?`https://app.clickclack.chat`:`/app`}var T=e(` `,1),E=e(` `),D=e(`
`),te=e(`
Open source · MIT · Single Go binary
ClickClack is a self-hostable chat app with Slack-style threads, durable realtime, and an API surface that bots, CI jobs, and agents can drive from a shell.
go run ./apps/api/cmd/clickclack serveWhy ClickClack
Every durable message, thread reply, reaction, and channel update can be
recovered over HTTP with a cursor — clients and agents reconnect without
diff --git a/apps/api/internal/webassets/dist/_app/immutable/chunks/BJnJ0WUy.js b/apps/api/internal/webassets/dist/_app/immutable/chunks/BCyOjJiP.js
similarity index 89%
rename from apps/api/internal/webassets/dist/_app/immutable/chunks/BJnJ0WUy.js
rename to apps/api/internal/webassets/dist/_app/immutable/chunks/BCyOjJiP.js
index 344c5bd3..e37be140 100644
--- a/apps/api/internal/webassets/dist/_app/immutable/chunks/BJnJ0WUy.js
+++ b/apps/api/internal/webassets/dist/_app/immutable/chunks/BCyOjJiP.js
@@ -1 +1 @@
-import{_t as e}from"./B-aw2y_U.js";var t=e({mouse:!1}),n=`data-pointer-mode`;function r(){let e=window.matchMedia(`(any-pointer: fine)`),r=e=>{t.mouse!==e&&(t.mouse=e,e?document.documentElement.setAttribute(n,`mouse`):document.documentElement.removeAttribute(n))},i=t=>{t.pointerType===`mouse`?r(e.matches):t.pointerType===`touch`&&r(!1)};return window.addEventListener(`pointermove`,i,{capture:!0,passive:!0}),window.addEventListener(`pointerdown`,i,{capture:!0,passive:!0}),()=>{window.removeEventListener(`pointermove`,i,{capture:!0}),window.removeEventListener(`pointerdown`,i,{capture:!0}),r(!1)}}export{r as n,t};
\ No newline at end of file
+import{_t as e}from"./BZp9foKd.js";var t=e({mouse:!1}),n=`data-pointer-mode`;function r(){let e=window.matchMedia(`(any-pointer: fine)`),r=e=>{t.mouse!==e&&(t.mouse=e,e?document.documentElement.setAttribute(n,`mouse`):document.documentElement.removeAttribute(n))},i=t=>{t.pointerType===`mouse`?r(e.matches):t.pointerType===`touch`&&r(!1)};return window.addEventListener(`pointermove`,i,{capture:!0,passive:!0}),window.addEventListener(`pointerdown`,i,{capture:!0,passive:!0}),()=>{window.removeEventListener(`pointermove`,i,{capture:!0}),window.removeEventListener(`pointerdown`,i,{capture:!0}),r(!1)}}export{r as n,t};
\ No newline at end of file
diff --git a/apps/api/internal/webassets/dist/_app/immutable/chunks/BHJGS62J.js b/apps/api/internal/webassets/dist/_app/immutable/chunks/BHJGS62J.js
deleted file mode 100644
index f5e159cb..00000000
--- a/apps/api/internal/webassets/dist/_app/immutable/chunks/BHJGS62J.js
+++ /dev/null
@@ -1 +0,0 @@
-import"./C7ceXZWF.js";
\ No newline at end of file
diff --git a/apps/api/internal/webassets/dist/_app/immutable/chunks/BZp9foKd.js b/apps/api/internal/webassets/dist/_app/immutable/chunks/BZp9foKd.js
new file mode 100644
index 00000000..30157d70
--- /dev/null
+++ b/apps/api/internal/webassets/dist/_app/immutable/chunks/BZp9foKd.js
@@ -0,0 +1,3 @@
+typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var e={},t=Symbol(`uninitialized`),n=`http://www.w3.org/1999/xhtml`,r=`http://www.w3.org/2000/svg`,i=`http://www.w3.org/1998/Math/MathML`,a=Array.isArray,o=Array.prototype.indexOf,s=Array.prototype.includes,c=Array.from,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyDescriptors,f=Object.prototype,p=Array.prototype,m=Object.getPrototypeOf,h=Object.isExtensible,g=()=>{};function _(e){return typeof e?.then==`function`}function v(e){return e()}function y(e){for(var t=0;t Blocked. Profile Preparing a safe preview. You can still download the original file. Preview is limited to 10,000 cells, the first 1,000 rows, and the first 100 columns. Download the original to inspect omitted cells. Some slide content was omitted by preview limits. or Channels Direct messages Creating workspace… No pinned messages Pin important messages to keep them easily accessible. Try another word or phrase. Channel Archived channels move to the Archived section and keep their full message history. Browser notifications are not supported on this device. Browser notifications are blocked by this browser. Show alerts when ClickClack is in the background. Shown in messages, mentions, and your profile card. Used in mentions and the quick switcher. Must be unique. Paste a public image URL. Your initials show when empty. Keep agent reasoning summaries out of the message timeline. Hide tool execution details while keeping ordinary messages visible. Choose which side of the timeline shows your messages. Choose which side of the timeline shows messages from other people and agents. Add ClickClack to your Home Screen from the Share menu, then open it from there to turn this on. This browser does not support push notifications. Receive alerts when the app is closed. Send push notifications to your phone via Pushover. Find this in your Pushover dashboard under "Your User Key". Loading… Account Bots you own across your workspaces. Tokens live with the workspace where the bot was created. Account Changes apply instantly and follow your account on every device. Live preview — updates as you pick Workspace Loading... Account How you appear across ClickClack. End this session on this device. Account Decide when and how ClickClack should reach you. Loading thread… >7-e&1)&f}return{srcPos:t,destPos:m}}function rn({src:e,srcPos:t=0,dest:n,destPos:r=0,width:i,height:a}){let o=0,s=i*a*3,c=e.byteOffset+t,l=c%4==0?Math.floor(L(e.length-t,0,s)/4):0,u=l>0?new Uint32Array(e.buffer,c,l):null,d=F.isLittleEndian?4278190080:255;if(F.isLittleEndian){for(;o d[1]?(o=d[0],s=d[1]):s===d[1]&&(o=u(o,d[0])),l {t?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:r,height:i}=this.#n,a=Math.max(r,i);return{areContours:t,outline:_a.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:n,width:r,height:i},pageWidth:a,pageHeight:a,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[[`editSignature`,this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){let{x:a,y:o}=this,{outline:s}=this.#n=t;this.#e=s instanceof ma,this.description=r;let c;this.#e?c=e.getDefaultDrawingOptions():(c=e._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":s.thickness})),this._addOutlines({drawOutlines:s,drawingOptions:c});let[,l]=this.pageDimensions,u=n/l;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:`pdfjs.signature.inserted`,data:{hasBeenSaved:!!i,hasDescription:!!r}}),this.div.hidden=!1,this.#i&&(this.#i=!1,this.parent.addUndoableEditor(this))}getFromImage(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return _a.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return _a.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return _a.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,i=Object.assign(super.serialize(e),{isSignature:!0,areContours:this.#e,color:[0,0,0],thickness:this.#e?0:r});return this.addComment(i),e?(i.paths={lines:t,points:n},i.uuid=this.#r,i.isCopy=!0):i.lines=t,this.#t&&(i.accessibilityData={type:`Figure`,alt:this.#t}),i}static deserializeDraw(e,t,n,r,i,a){return a.areContours?ma.deserialize(e,t,n,r,i,a):da.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=await super.deserialize(e,t,n);return r.#e=e.areContours,r.description=e.accessibilityData?.alt||``,r.#r=e.uuid,r}},xa=class extends U{#e=null;#t=null;#n=null;#r=null;#i=null;#a=``;#o=null;#s=!1;#c=null;#l=!1;#u=!1;static _type=`stamp`;static _editorType=u.STAMP;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile,this.defaultL10nId=`pdfjs-editor-stamp-editor`}static initialize(e,t){U.initialize(e,t)}static isHandlingMimeForPasting(e){return We.has(e)}static paste(e,t){t.pasteEditor({mode:u.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:`stamp`,hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let t=e.get(`hasAltText`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}#d(e,t=!1){e?(this.#e=e.bitmap,t||(this.#t=e.id,this.#l=e.isSvg),e.file&&(this.#a=e.file.name),this.#m()):this.remove()}#f(){if(this.#n=null,this._uiManager.enableWaiting(!1),this.#o){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e)this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#e){this._reportTelemetry({action:`pdfjs.image.image_added`,data:{alt_text_modal:!1,alt_text_type:`empty`}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw Error(`No ML.`);if(!await n.isEnabledFor(`altText`))throw Error(`ML isn't enabled for alt text.`);let{data:r,width:i,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:`altText`,request:{data:r,width:i,height:a,channels:r.length/(i*a)}});if(!o)throw Error(`No response from the AI service.`);if(o.error)throw Error(`Error from the AI service.`);if(o.cancel)return null;if(!o.output)throw Error(`No valid response from the AI service.`);let s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}#p(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#d(e,!0)).finally(()=>this.#f());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#d(e)).finally(()=>this.#f());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#d(e)).finally(()=>this.#f());return}let e=document.createElement(`input`);e.type=`file`,e.accept=We.keys().join(`,`);let t=this._uiManager._signal;this.#n=new Promise(n=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:`pdfjs.image.image_selected`,data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(t)}n()},{signal:t}),e.addEventListener(`cancel`,()=>{this.remove(),n()},{signal:t})}).finally(()=>this.#f()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#o?.remove(),this.#o=null,this.#c&&=(clearTimeout(this.#c),null)),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(this.#t&&this.#o===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))):this.#t&&this.#p()}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i||this.#t||this.#s)}get toolbarButtons(){return[[`altText`,this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#s||(this.#e?this.#m():this.#p()),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:n,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(this.#t=n,r&&(this.#e=r),this.#s=!1,this.#m())}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(this.#c!==null&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#c=null,this.#g()},200))}#m(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}this._uiManager.enableWaiting(!1);let o=this.#o=document.createElement(`canvas`);o.setAttribute(`role`,`img`),this.addContainer(o),this.width=t/r,this.height=n/i,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),this.#g(),this.#u||=(this.parent.addUndoableEditor(this),!0),this._reportTelemetry({action:`inserted_image`}),this.#a&&this.div.setAttribute(`aria-description`,this.#a),this.annotationElementId||this._uiManager.a11yAlert(U._l10nAlert.stamp)}copyCanvas(e,t,n=!1){e||=224;let{width:r,height:i}=this.#e,a=new z,o=this.#e,s=r,c=i,l=null;if(t){if(r>t||i>t){let e=Math.min(t/r,t/i);s=Math.floor(r*e),c=Math.floor(i*e)}l=document.createElement(`canvas`);let e=l.width=Math.ceil(s*a.sx),n=l.height=Math.ceil(c*a.sy);this.#l||(o=this.#h(e,n));let u=l.getContext(`2d`);u.filter=this._uiManager.hcmFilter;let d=`white`,f=`#cfcfd8`;this._uiManager.hcmFilter===`none`?Ge.isDarkMode&&(d=`#8f8f9d`,f=`#42414d`):f=`black`;let p=15*a.sx,m=15*a.sy,h=new OffscreenCanvas(p*2,m*2),g=h.getContext(`2d`);g.fillStyle=d,g.fillRect(0,0,p*2,m*2),g.fillStyle=f,g.fillRect(0,0,p,m),g.fillRect(p,m,p,m),u.fillStyle=u.createPattern(h,`repeat`),u.fillRect(0,0,e,n),u.drawImage(o,0,0,o.width,o.height,0,0,e,n)}let u=null;if(n){let t,n;if(a.symmetric&&o.width Blocked. Profile No GIFs found No GIFs found An error occurred: Your browser blocked clipboard access. Copy the selected link below. An error occurred: Your browser blocked clipboard access. Copy the selected link below. >7-e&1)&f}return{srcPos:t,destPos:m}}function nn({src:e,srcPos:t=0,dest:n,destPos:r=0,width:i,height:a}){let o=0,s=i*a*3,c=e.byteOffset+t,l=c%4==0?Math.floor(L(e.length-t,0,s)/4):0,u=l>0?new Uint32Array(e.buffer,c,l):null,d=F.isLittleEndian?4278190080:255;if(F.isLittleEndian){for(;o 0){C??=o.measureText(p);let e=C.width*1e3/i*s;O d[1]?(o=d[0],s=d[1]):s===d[1]&&(o=u(o,d[0])),l
`),H=e(``),U=e(``);function W(e,l){n(l,!0);let T=b(l,`class`,3,`avatar`),E=b(l,`size`,3,40),O=b(l,`loading`,3,`lazy`),k=b(l,`fetchPriority`,3,`low`),A=p(``),j=t(()=>B(l.src)),N=t(()=>d(j)!==``&&d(A)!==d(j)),P=t(()=>M(l.id||l.name||d(j)||`avatar`)),F=t(()=>D(l.name));function I(){C(A,d(j),!0)}var L=w(),R=v(L),z=e=>{var t=H(),n=y(t),c=e=>{var t=V();m(()=>{h(t,`src`,d(j)),h(t,`width`,E()),h(t,`height`,E()),h(t,`loading`,O()),h(t,`fetchpriority`,k())}),r(`error`,t,I),o(t),s(e,t)},p=e=>{var t=i();m(()=>a(t,d(F))),s(e,t)};g(n,e=>{d(N)?e(c):e(p,-1)}),_(t),m(()=>{S(t,1,f(T())),x(t,`--hue: ${d(P)??``}deg`),h(t,`aria-label`,l.buttonLabel)}),u(`click`,t,function(...e){l.onclick?.apply(this,e)}),s(e,t)},W=e=>{var t=U(),n=y(t),c=e=>{var t=V();m(()=>{h(t,`src`,d(j)),h(t,`width`,E()),h(t,`height`,E()),h(t,`loading`,O()),h(t,`fetchpriority`,k())}),r(`error`,t,I),o(t),s(e,t)},l=e=>{var t=i();m(()=>a(t,d(F))),s(e,t)};g(n,e=>{d(N)?e(c):e(l,-1)}),_(t),m(()=>{S(t,1,f(T())),x(t,`--hue: ${d(P)??``}deg`)}),s(e,t)};g(R,e=>{l.buttonLabel?e(z):e(W,-1)}),s(e,L),c()}l([`click`]);export{F as a,P as c,j as d,k as f,I as i,O as l,M as n,L as o,E as p,D as r,N as s,W as t,A as u};
\ No newline at end of file
+import{B as e,Ct as t,Et as n,G as r,H as i,I as a,K as o,R as s,Tt as c,U as l,W as u,X as d,b as f,bt as p,ct as m,f as h,k as g,kt as _,mt as v,pt as y,t as b,v as x,y as S,yt as C,z as w}from"./BZp9foKd.js";import{i as T}from"./DEPNME54.js";function E(e){let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/);return n.length>=2?(n[0][0]+n[1][0]).toUpperCase():t.slice(0,2).toUpperCase()}function D(e){if(!e)return`?`;let t=e.trim();return t?t[0].toUpperCase():`?`}function O(e){return e?`@${e}`:``}function k(e){return e?.handle||e?.former_handle||``}function A(e){return e?.kind===`bot`&&!!e.deleted_at}function j(e,t=`Local User`){let n=e?.display_name||t;return A(e)?`${n} (deleted bot)`:n}function M(e){let t=0;for(let n=0;n
`),H=e(``),U=e(``);function W(e,l){n(l,!0);let T=b(l,`class`,3,`avatar`),E=b(l,`size`,3,40),O=b(l,`loading`,3,`lazy`),k=b(l,`fetchPriority`,3,`low`),A=p(``),j=t(()=>B(l.src)),N=t(()=>d(j)!==``&&d(A)!==d(j)),P=t(()=>M(l.id||l.name||d(j)||`avatar`)),F=t(()=>D(l.name));function I(){C(A,d(j),!0)}var L=w(),R=v(L),z=e=>{var t=H(),n=y(t),c=e=>{var t=V();m(()=>{h(t,`src`,d(j)),h(t,`width`,E()),h(t,`height`,E()),h(t,`loading`,O()),h(t,`fetchpriority`,k())}),r(`error`,t,I),o(t),s(e,t)},p=e=>{var t=i();m(()=>a(t,d(F))),s(e,t)};g(n,e=>{d(N)?e(c):e(p,-1)}),_(t),m(()=>{S(t,1,f(T())),x(t,`--hue: ${d(P)??``}deg`),h(t,`aria-label`,l.buttonLabel)}),u(`click`,t,function(...e){l.onclick?.apply(this,e)}),s(e,t)},W=e=>{var t=U(),n=y(t),c=e=>{var t=V();m(()=>{h(t,`src`,d(j)),h(t,`width`,E()),h(t,`height`,E()),h(t,`loading`,O()),h(t,`fetchpriority`,k())}),r(`error`,t,I),o(t),s(e,t)},l=e=>{var t=i();m(()=>a(t,d(F))),s(e,t)};g(n,e=>{d(N)?e(c):e(l,-1)}),_(t),m(()=>{S(t,1,f(T())),x(t,`--hue: ${d(P)??``}deg`)}),s(e,t)};g(R,e=>{l.buttonLabel?e(z):e(W,-1)}),s(e,L),c()}l([`click`]);export{F as a,P as c,j as d,k as f,I as i,O as l,M as n,L as o,E as p,D as r,N as s,W as t,A as u};
\ No newline at end of file
diff --git a/apps/api/internal/webassets/dist/_app/immutable/chunks/C07De2MR.js b/apps/api/internal/webassets/dist/_app/immutable/chunks/C07De2MR.js
new file mode 100644
index 00000000..48d0aeeb
--- /dev/null
+++ b/apps/api/internal/webassets/dist/_app/immutable/chunks/C07De2MR.js
@@ -0,0 +1 @@
+import"./z51mP5hD.js";
\ No newline at end of file
diff --git a/apps/api/internal/webassets/dist/_app/immutable/chunks/Dek69VGa.js b/apps/api/internal/webassets/dist/_app/immutable/chunks/C6Jfgk1u.js
similarity index 52%
rename from apps/api/internal/webassets/dist/_app/immutable/chunks/Dek69VGa.js
rename to apps/api/internal/webassets/dist/_app/immutable/chunks/C6Jfgk1u.js
index 89def224..25eb6183 100644
--- a/apps/api/internal/webassets/dist/_app/immutable/chunks/Dek69VGa.js
+++ b/apps/api/internal/webassets/dist/_app/immutable/chunks/C6Jfgk1u.js
@@ -1 +1 @@
-var e=`font-weight: bold`,t=`font-weight: normal`;function n(e,t,n){let r=Error(`${e}\n${t}\nhttps://svelte.dev/e/kit/${e}`);throw r.name=`SvelteKit error`,Error.captureStackTrace?.(r,n),r}function r(e){try{e()}catch(e){return e}}function i(e){throw Error(`https://svelte.dev/e/kit/invalid_export`)}function a(e){throw Error(`https://svelte.dev/e/kit/invalid_export_location`)}function o(e){throw Error(`https://svelte.dev/e/kit/invalid_redirect_status`)}function s(e){throw Error(`https://svelte.dev/e/kit/load_invalid_response`)}function c(e){throw Error(`https://svelte.dev/e/kit/match_in_service_worker`)}function l(e){throw Error(`https://svelte.dev/e/kit/param_matcher_async`)}function u(e){throw Error(`https://svelte.dev/e/kit/param_matcher_result_invalid`)}function d(e){throw Error(`https://svelte.dev/e/kit/redirect_external_javascript`)}function f(e){throw Error(`https://svelte.dev/e/kit/redirect_external_not_allowed`)}function p(e){throw Error(`https://svelte.dev/e/kit/redirect_external_not_in_allowlist`)}function m(e){throw Error(`https://svelte.dev/e/kit/redirect_external_option_invalid`)}function h(e){throw Error(`https://svelte.dev/e/kit/router_hash_page_options`)}function g(e){throw Error(`https://svelte.dev/e/kit/url_hash_unavailable`)}export{n as _,c as a,d as c,m as d,h as f,t as g,r as h,s as i,f as l,e as m,a as n,l as o,g as p,o as r,u as s,i as t,p as u};
\ No newline at end of file
+var e=`font-weight: bold`,t=`font-weight: normal`;function n(e,t,n){let r=Error(`${e}\n${t}\nhttps://svelte.dev/e/kit/${e}`);throw r.name=`SvelteKit error`,Error.captureStackTrace?.(r,n),r}function r(e){try{e()}catch(e){return e}}function i(e){throw Error(`https://svelte.dev/e/kit/invalid_export`)}function a(e){throw Error(`https://svelte.dev/e/kit/invalid_export_location`)}function o(e){throw Error(`https://svelte.dev/e/kit/invalid_redirect_status`)}function s(e){throw Error(`https://svelte.dev/e/kit/load_invalid_response`)}function c(e){throw Error(`https://svelte.dev/e/kit/match_in_service_worker`)}function l(e){throw Error(`https://svelte.dev/e/kit/param_matcher_async`)}function u(e){throw Error(`https://svelte.dev/e/kit/param_matcher_result_invalid`)}function d(e){throw Error(`https://svelte.dev/e/kit/redirect_external_javascript`)}function f(e){throw Error(`https://svelte.dev/e/kit/redirect_external_not_allowed`)}function p(e){throw Error(`https://svelte.dev/e/kit/redirect_external_not_in_allowlist`)}function m(e){throw Error(`https://svelte.dev/e/kit/redirect_external_option_invalid`)}function h(e){throw Error(`https://svelte.dev/e/kit/router_hash_page_options`)}new URL(`a://`);function g(e,t){if(e===t)return!0;try{let n=new URL(t),r=new URL(e,n);return r.protocol===n.protocol&&r.host===n.host}catch{return!1}}function _(e,t){return e===`/`||t===`ignore`?e:t===`never`?e.endsWith(`/`)?e.slice(0,-1):e:t===`always`&&!e.endsWith(`/`)?e+`/`:e}function v(e){return e.split(`%25`).map(decodeURI).join(`%25`)}function y({href:e}){return e.split(`#`)[0]}function b(e,t,n,r=!1){let i=new URL(e);Object.defineProperty(i,"searchParams",{value:new Proxy(i.searchParams,{get(e,r){if(r===`get`||r===`getAll`||r===`has`)return(t,...i)=>(n(t),e[r](t,...i));t();let i=Reflect.get(e,r);return typeof i==`function`?i.bind(e):i}}),enumerable:!0,configurable:!0});let a=[`href`,`pathname`,`search`,`toString`,`toJSON`];r&&a.push(`hash`);for(let n of a)Object.defineProperty(i,n,{get(){return t(),e[n]},enumerable:!0,configurable:!0});return i}export{h as _,y as a,t as b,o as c,l as d,u as f,m as g,p as h,_ as i,s as l,f as m,b as n,i as o,d as p,g as r,a as s,v as t,c as u,e as v,n as x,r as y};
\ No newline at end of file
diff --git a/apps/api/internal/webassets/dist/_app/immutable/chunks/CFaGG57V.js b/apps/api/internal/webassets/dist/_app/immutable/chunks/CFaGG57V.js
deleted file mode 100644
index f03dfbf6..00000000
--- a/apps/api/internal/webassets/dist/_app/immutable/chunks/CFaGG57V.js
+++ /dev/null
@@ -1 +0,0 @@
-import{C as e,Ct as t,E as n,Et as r,M as i,N as a,R as o,Tt as s,X as c,_t as l,bt as u,et as d,j as f,lt as p,mt as m,o as h,t as g,u as _,ut as v,yt as y,z as b}from"./B-aw2y_U.js";var x=e=>Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n}:${r};`},``),S=(e,t)=>e[0]===t[0]&&e[1]===t[1],C=(e,t)=>`_`+t,w,{min:T,max:E,abs:D,floor:O}=Math,k=(e,t,n)=>E(t,T(n,e)),A=e=>e.sort((e,t)=>e-t),j=setTimeout,M=clearTimeout,N=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},P=()=>{let e;return[new Promise(t=>{e=t}),e]},F=e=>e.ownerDocument,I=e=>e.defaultView,L=()=>(w??=/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0,w),R=e=>E(e.$getTotalSize(),e.$getViewportSize()),z=({$getRange:e,$findIndex:t,$getItemOffset:n,$getItemSize:r,$setItemSizes:i,$getTotalSize:a,$getLength:o,$setLength:s,$isEstimating:c},l=0)=>{let u=!!l,d=1,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=null,x=[0,u?E(l-1,0):-1],S=!1,C=new Set,w=()=>m-p,O=()=>w()+g+h,k=(e,t)=>{let i=n(e),a=r(e);return v!==1&&y===0?i+a<=t:i
`),Dr=r(` `),Or=r(` `),kr=r(`
`),Nr=r(`
`),Br=r(`
`),Vr=r(` Welcome.
Have a sign-in token?
Create channel
Start a DM
`),Si=r(``),Ci=r(`
`),na=r(`Connecting…`),ra=r(`
Pinned Messages
`,1),Pa=r(``);function Fa(e,t){s(t,!0);let n=B(t,`covered`,3,!1),r=B(t,`inert`,3,!1),c=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}),d=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}),f=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,year:`numeric`});function p(e,t){let n=Array.from(e),r=[],i=0;for(let e of t){let t=Math.max(i,Math.min(n.length,e.start)),a=Math.max(t,Math.min(n.length,e.end));t>i&&r.push({text:n.slice(i,t).join(``),highlighted:!1}),a>t&&r.push({text:n.slice(t,a).join(``),highlighted:!0}),i=a}return i
Channel settings
Conversation display
Notifications
Desktop
Mobile push
`),fo=r(`
My bots
Appearance
Profile settings
Notifications
`,1),Jo=r(``),Yo=r(``),Xo=r(``),Zo=r(``),Qo=r(``),$o=r(``),es=r(``),ts=r(``),ns=r(``),rs=r(`
`),os=r(``),ss=r(``),cs=r(``),ls=r(``),us=r(`
`,1),ds=r(`ClickClack
`),fs=r(``),ps=r(``),ms=r(``),hs=r(``),gs=r(`e.id===t))return;if(!e.all&&!e.seq){let e=Ja(t);if(e>=0&&!lo(t,e))return}let n=e.all?Math.max(e.seq||0,Ua(t)):e.seq||Wa(t);n<=0||(C(J).some(e=>e.id===t)?(Ha(t,n),e.all&&Ka(t,n)):C(q).some(e=>e.id===t)&&(Va(t,n),e.all&&Ka(t,n)))}function Ka(e,t){er.delete(e),er=new Map(er),W(q,C(q).map(n=>n.id===e?{...n,last_seq:Math.max(n.last_seq||0,t),last_read_seq:Math.max(n.last_read_seq||0,t),unread_count:0}:n)),W(J,C(J).map(n=>n.id===e?{...n,last_seq:Math.max(n.last_seq||0,t),last_read_seq:Math.max(n.last_read_seq||0,t),unread_count:0}:n))}function qa(e){let t=C(q).find(t=>t.id===e);return t?t.last_read_seq||0:C(J).find(t=>t.id===e)?.last_read_seq||0}function Ja(e){let t=C(q).find(t=>t.id===e);if(t)return za(e,t)>0?t.last_read_seq||0:-1;let n=C(J).find(t=>t.id===e);return n&&za(e,n)>0?n.last_read_seq||0:-1}function Ya(e,t,n){for(let r of t){if(!yo(r,e)||r.parent_message_id||r.author?.id===C(K)?.id||r.author_id===C(K)?.id)continue;let t=r.channel_seq;if(typeof t==`number`&&t>n)return r}return null}function Xa(e,t){if(!e)return;let n=co(e);if(za(e,n)<=0){er.delete(e),er=new Map(er);return}let r=n.last_read_seq||0,i=er.get(e);if(i?.boundarySeq===r&&i.since||!lo(e,r))return;let a=Ya(e,t,r);a&&(er=new Map(er).set(e,{boundarySeq:r,since:fo(a.created_at)}))}function Za(e,t,n){if(!e||!n)return;let r=er.get(e);r?.boundarySeq===t&&r.since||(er=new Map(er).set(e,{boundarySeq:t,since:fo(n)}))}function Qa(e){let t=e.payload,n=t.channel_seq??e.seq??t.seq;return typeof n==`number`?n:Number(n)||0}function $a(e){let t=e.payload;return{channelID:e.channel_id||(typeof t.channel_id==`string`?t.channel_id:``),dmID:typeof t.direct_conversation_id==`string`?t.direct_conversation_id:``}}async function eo(e){try{let t=await G(`/api/channels/${e}/notification-settings`);return io(e,t.preference),e===C(X)&&!C(Z)&&!C(He)&&W(ze,t.preference),t.preference}catch{return ro(e)||`all`}}function to(e){return C(K)?.id&&e?`clickclack:channel-notification:v1:${C(K).id}:${e}`:``}function no(e){let t=to(e);if(!t)return null;try{let e=window.localStorage.getItem(t);return e===`all`||e===`mentions`||e===`muted`?e:null}catch{return null}}function ro(e){return Be.get(e)||no(e)}function io(e,t){Be=new Map(Be).set(e,t);let n=to(e);if(n)try{window.localStorage.setItem(n,t)}catch{}}async function ao(e,t){if(e.type!==`message.created`&&e.type!==`thread.reply_created`)return;let{channelID:n,dmID:r}=$a(e),i=Qa(e);if(e.type===`message.created`&&i>0){let e=n||r;if(i<=(Ve.get(e)||0))return;Ve.set(e,i)}let a=e.payload,o=typeof a.kind==`string`?a.kind:``;if(o===`agent_commentary`||o===`agent_tool`||!C(Cn)||document.visibilityState===`visible`&&t)return;if(n){let t=await eo(n);if(!t||!C(Cn))return;let r=n===C(X)&&!C(Z);if(document.visibilityState===`visible`&&r||t===`muted`||t===`mentions`&&!e.mentioned_user_ids?.includes(C(K)?.id||``))return}let s=typeof a.message_id==`string`?a.message_id:`${e.channel_id||``}:${e.seq||Date.now()}`,c=typeof a.author_id==`string`?a.author_id:``,l=typeof a.body==`string`?a.body:`New message`;if(e.type===`thread.reply_created`&&typeof a.message_id==`string`)try{let e=await G(`/api/messages/${a.message_id}`);c=e.message.author_id,l=e.message.body}catch{}if(c&&c===C(K)?.id||!C(Cn)||document.visibilityState===`visible`&&(n&&n===C(X)||r&&r===C(Z)))return;let u=C(q).find(e=>e.id===n),d=Ys(c)?.display_name||`ClickClack`,f=u?`#${Et(u)}`:`Direct message`;if(Kt)Kt.notify({body:oo(l),route:wi(n||r),tag:`clickclack:${s}`,title:`${d} in ${f}`});else if(typeof Notification<`u`&&Notification.permission===`granted`)try{let e=new Notification(`${d} in ${f}`,{body:oo(l),tag:`clickclack:${s}`,icon:`/favicon.svg`});e.onclick=()=>{window.focus(),e.close(),n?aa(n):r&&ps(r)}}catch{}}function oo(e){let t=e.replace(/!\[[^\]]*]\([^)]+\)/g,`[image]`).replace(/\[[^\]]+]\(([^)]+)\)/g,`$1`).replace(/[`*_>#|]/g,``).replace(/\s+/g,` `).trim();return t?t.length>180?`${t.slice(0,177)}...`:t:`New message`}async function so(e){let t=e.payload,n=typeof t.direct_conversation_id==`string`?t.direct_conversation_id:``;return!n||C(J).some(e=>e.id===n)?!1:(await ds(),C(J).some(e=>e.id===n))}function co(e){return C(q).find(t=>t.id===e)||C(J).find(t=>t.id===e)||{}}function lo(e,t,n=C(Rn)){if(!e||t<0)return!1;let r=n.get(e);if(!r||r.messages.length===0)return!1;let i=t+1;return r.oldest_seq<=i&&r.newest_seq>=i}function uo(e,t,n=C(Rn)){let r=er.get(e);if(r?.boundarySeq===t)return r.since;if(!lo(e,t,n))return``;let i=Ya(e,C(We),t);return i?fo(i.created_at):``}function fo(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t)}function po(){if(!C(nr)||!C(In))return;let e=C(In).captureState();e&&Ln.set(C(nr),e)}function mo(e,t){let n=e!==C(nr);for(let[t,n]of at)!n.message.status&&(n.draft.viewKey!==e||C($e)&&n.draft.topicID!==C($e))&&at.delete(t);let r=Do(e).map(e=>e.message),i=new Map(r.map(e=>[e.id,e])),a=new Map(r.filter(e=>e.nonce).map(e=>[e.nonce,e]));Fe.seedMessages(t);let o=t.map(e=>{let t=i.get(e.id)||(e.nonce?a.get(e.nonce):void 0);return t?(!t.status&&(t.attachments||[]).every(t=>e.attachments?.some(e=>e.id===t.id))&&at.delete(t.nonce),{...e,nonce:t.nonce,status:t.status,attachments:t.attachments?.length?t.attachments:e.attachments}):e}),s=new Set(o.map(e=>e.id)),c=new Set(o.map(e=>e.nonce).filter(Boolean)),l=r.filter(e=>!s.has(e.id)&&!(e.nonce&&c.has(e.nonce)));W(We,[...o,...l].sort((e,t)=>(e.channel_seq||1/0)-(t.channel_seq||1/0))),Ie.reconcile(e,C(We)),W(nr,e),Xa(e,C(We)),n&&(W(_r,[]),W(yr,[]),sr())}function ho(e){_o(zn.updateMessage(e))}function go(e){_o(zn.updateAuthor(e))}function _o(e){let t=$(),n=t?C(Rn).get(t):void 0;if(e)for(let t of at.values()){let n=t.message;t.message={...e(n),status:n.status,attachments:n.attachments},t.receipt&&=e(t.receipt)}let r=e?n?.messages.map(e)||[]:n?.messages||[];n?_a(t,{...n,messages:r},`append`):mo(t,r)}function vo(e){return e?.channel_seq||0}function yo(e,t){return t?e.channel_id===t||e.direct_conversation_id===t:!1}async function bo(e=()=>!0){await N(),e()&&await C(In)?.scrollToBottom()}function xo(){return C(In)?.isFollowing()||C(In)?.isNearBottom(96)!==!1}async function So(e=!1){let t=C(or)||C(Xn)||C(ae)>0,n=la();try{if(t&&await fa(n),await bo(n),!n())return;C(Xn)||Ga({all:!0}),await bo(n)}catch(t){n()&&(W(Tt,{kind:`error`,text:De(t,`Could not jump to latest messages`)}),e&&await bo(n))}}function Co(e,t,n=`tmp_${e}`){let r=new Date().toISOString();return{id:n,workspace_id:t.workspaceID,channel_id:t.channelID,direct_conversation_id:t.directConversationID,topic_id:t.topicID,author_id:C(K)?.id||``,thread_root_id:n,body:t.body,body_format:`markdown`,created_at:r,author:C(K)||void 0,attachments:t.upload?[t.upload]:[],quoted_message_id:t.quotedMessageID,nonce:e,status:`pending`}}async function wo(){let e=C(Yt).trim();if(!e)return;if(C(A)&&!C(M)){W(Tt,{kind:`error`,text:`This conversation has no active recipient`});return}if(!C(X)&&!C(Z)){W(Tt,{kind:`ephemeral`,text:`Pick or create a channel to send a message.`});return}sr(),W(Tt,null);let t=++zr,n=$(),r=C(Z)?`dm`:`channel`,i=C(fr)&&C(pr)===r?C(fr):null;if(C(X)&&!C(Z)&&!C(un)&&!i){let r=Ss(e),i=r?Cs(C(bt),r.command):void 0;if(r&&i){W(Yt,``),ls(),await To(C(X),r.command,r.text,e,n,t);return}}let a={body:e,quotedMessageID:i?.id,upload:C(un)||void 0,workspaceID:C(Y),channelID:C(X)||void 0,directConversationID:C(Z)||void 0,topicID:C(X)&&C(Qe)||void 0,topicFilterID:C($e),topicFilterGeneration:et,viewKey:$()};W(Yt,``),i&&Jo(),ls(),await ko(a)}async function To(e,t,n,r,i,a){try{let r=await ws(e,t,n);if(a!==zr||$()!==i)return;r.text&&r.response_type!==`in_channel`&&W(Tt,{kind:`ephemeral`,text:r.text})}catch(e){if(console.warn(`slash dispatch failed`,e),a!==zr||$()!==i)return;W(Tt,{kind:`error`,text:e instanceof Ee&&e.message?Eo(e):`${t} failed`}),C(Yt).trim()||W(Yt,r)}}function Eo(e){try{let t=JSON.parse(e.message);if(t&&typeof t.error==`string`&&t.error)return t.error}catch{}return e.message}function Do(e){return[...at.values()].filter(({draft:t})=>t.viewKey===e&&(!C($e)||t.topicID===C($e)))}async function Oo(e,t,n,r){let{draft:i}=e;if(e.message=t,$()!==i.viewKey)return;let a=!1,o=C($e)===i.topicFilterID&&et===i.topicFilterGeneration;if(r()&&o&&C($e)&&i.topicID!==C($e)){qr(``),Ln.delete(i.viewKey),C(Rn).delete(i.viewKey),r=la();try{await fa(r)}catch{a=!0}}$()===i.viewKey&&(C($e)&&i.topicID!==C($e)?(C(Yt).trim()||W(Yt,i.body),W(Tt,{kind:`error`,text:`${n} Clear the active topic filter to recover the draft.`})):(_o(),W(Tt,{kind:`error`,text:a?`${n} The unfiltered timeline could not reload.`:n}),await bo(r)))}async function ko(e,t,n){let r=Er,i=()=>Er===r&&$()===e.viewKey,a=t??tt(),o=`tmp_${a}`,s=n??o,c=!C($e)||e.topicID===C($e),l=!t&&$()===e.viewKey&&c,u=Co(a,e,s),d={draft:e,message:u,receipt:at.get(a)?.receipt};at.set(a,d),$()===e.viewKey&&c&&(_o(),t||bo());let f=e.directConversationID?`/api/dms/${e.directConversationID}/messages`:`/api/channels/${e.channelID}/messages`,p={body:e.body,nonce:a};e.quotedMessageID&&(p.quoted_message_id=e.quotedMessageID),e.topicID&&(p.topic_id=e.topicID),e.upload&&(p.upload_id=e.upload.id);try{let t=d.receipt||(await G(f,{method:`POST`,body:JSON.stringify(p)})).message;if(d.receipt=t,e.upload&&!t.attachments?.some(t=>t.id===e.upload?.id))try{await G(`/api/messages/${t.id}/attachments`,{method:`POST`,body:JSON.stringify({upload_id:e.upload.id})}),t={...t,attachments:[...t.attachments||[],e.upload]}}catch(n){console.warn(`attachment fallback failed`,n),await Oo(d,{...t,nonce:a,status:`failed`,attachments:[...t.attachments||[],e.upload]},`The message was sent, but its attachment failed. Retry or discard it below.`,i);return}d.receipt=t,d.message={...t,nonce:a},$()===e.viewKey?_o():at.delete(a)}catch(t){console.warn(`send failed`,t),await Oo(d,{...u,status:`failed`},e.upload?`The attachment failed, so the message was not sent. Retry or discard it below.`:`The message failed to send. Retry or discard it below.`,i);return}i()&&l&&await So(!0)}function Ao(e){if(!e.nonce)return;let t=at.get(e.nonce)?.draft;t&&ko(t,e.nonce,e.id)}function jo(e){if(!e.nonce)return;let t=at.get(e.nonce);t?.receipt?t.message={...t.receipt,nonce:e.nonce}:at.delete(e.nonce),_o()}async function Mo(e,t){let n=Q.selection,r=()=>e===C(ir)&&Ie.session(e)?.generation===t.generation&&(t.surface!==`thread`||Q.selection===n);if(r()){if(wr++,t.surface===`thread`){if(t.threadRootID&&n?.messageID!==t.threadRootID&&(W(st,!1),Q.select(t.threadRootID),n=Q.selection,!await Lo(t.threadRootID,void 0,r))||!await Q.target({messageID:t.messageID,threadSeq:t.threadSeq},r)||!r())return;Q.root?.route_id&&await Oi(C(Y),Q.root.id)}else C(In)?.scrollToMessage(t.messageID),await Oi(C(Y),Q.root?.id||$());for(let e=0;e<16;e+=1){if(await N(),await new Promise(e=>requestAnimationFrame(()=>e())),!r())return;let e=document.querySelector(t.surface===`timeline`?`main.timeline`:`[aria-label="Thread pane"]`)?.querySelector(`[data-message-id="${CSS.escape(t.messageID)}"]`)?.querySelector(`textarea[aria-label="Edit message"]`);if(e){e.focus({preventScroll:!0});return}}}}function No(e){ho(e),Q.updateMessage(e),W(ut,C(ut).map(t=>t.id===e.id?nt(t,e):t))}function Po(e){!e.id||e.deleted_at||C(Ur).has(e.id)||(W(Wr,e),W(Gr,``))}async function Fo(){let e=C(Wr);if(e&&!C(Ur).has(e.id)){W(Ur,new Set([...C(Ur),e.id])),W(Gr,``);try{let t=(await G(`/api/messages/${e.id}`,{method:`DELETE`})).message;Ie.cancelMessage($(),t.id),ho(t),Q.updateMessage(t),W(ut,C(ut).filter(e=>e.id!==t.id)),C(fr)?.id===t.id&&Jo(),W(Wr,null)}catch(e){W(Gr,e instanceof Error?e.message:`Could not delete message`)}finally{let t=new Set(C(Ur));t.delete(e.id),W(Ur,t)}}}async function Io(e){wr++,ns(),W(st,!1),await Lo(e.id,e)&&C(Y)&&Q.root?.route_id&&await Oi(C(Y),Q.root.id)}async function Lo(e,t,n=()=>!0){W(Rt,null),W(zt,``),W(ot,null),W(gr,`thread`),Q.select(e,t);try{return await Q.open(n)}catch{return!1}}function Ro(e=[]){let t=Q.root;t&&(Fe.seedMessages(e),Ie.reconcile($(),[t,...Q.replies]),ho({id:t.id,thread_state:t.thread_state}))}async function zo(e){await zn.run(()=>G(`/api/messages/${e}/thread?latest=true&limit=1`),e=>{let t={...e.root,thread_state:e.thread_state};Fe.seedMessages([t]),ho(t)})}async function Bo(e,t){(C(We).some(t=>t.id===e)||zn.pending)&&await zn.run(()=>G(`/api/messages/${e}`),e=>ho(e.message),t)}function Vo(e,t){let n=C(We).find(t=>t.id===e);if(!n)return!1;let r=new Date(t.created_at).getTime();if(Number.isFinite(r)&&r _n&&typeof r==`function`,d=u?Date.now()+gn:0,f=0,p=this.commonObjs,m=this.objs,h,g;for(;;){if(a!==void 0){if(e===a.nextBreakPoint)return a.breakIt(e,r),e;if(a.shouldSkip(e)){if(++e===l)return e;continue}}if(!o||o(e,t)){if(h=c[e],g=s[e]??null,h!==v.dependency)g===null?this[h](e):this[h](e,...g);else for(let t of g){this.dependencyTracker?.recordNamedData(t,e);let n=t.startsWith(`g_`)?p:m;if(!n.has(t))return n.get(t,r,i),e}}if(e++,e===l)return e;if(u&&++f>_n){if(Date.now()>d)return r(),e;f=0}}}finally{this._pathCache=l}}#f(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){this.#f();for(let e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let e of this.#d)this.#C(e);this.#d.length=0,this.#i=null,this.#a=null,this.#o=null,this.#s=null,this.#c=1,this.#u=null,this.#r=0,this.#n=0,this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#p()}#p(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!==`none`){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width??e.displayWidth,r=e.height??e.displayHeight,i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=[],s=i,c=a,l=n,u=r;for(;s>2&&l>1||c>2&&u>1;){let e=l,t=u;s>2&&l>1&&(e=Math.ceil(l/2),s/=l/e),c>2&&u>1&&(t=Math.ceil(u/2),c/=u/t),o.push({newWidth:e,newHeight:t}),l=e,u=t}if(o.length===0)return{img:e,paintWidth:n,paintHeight:r,tmpCanvas:null};if(o.length===1){let{newWidth:t,newHeight:i}=o[0],a=this.canvasFactory.create(t,i);return a.context.drawImage(e,0,0,n,r,0,0,t,i),{img:a.canvas,paintWidth:t,paintHeight:i,tmpCanvas:a}}let d=this.canvasFactory.create(1,1),f=this.canvasFactory.create(1,1),p=n,m=r,h=e;for(let{newWidth:e,newHeight:t}of o)this.canvasFactory.reset(f,e,t),f.context.drawImage(h,0,0,p,m,0,0,e,t),[d,f]=[f,d],h=d.canvas,p=e,m=t;return this.canvasFactory.destroy(f),{img:d.canvas,paintWidth:p,paintHeight:m,tmpCanvas:d}}_createMaskCanvas(e,t){let n=this.ctx,{width:i,height:a}=t,o=this.current.patternFill,s=o?this.current.fillColor:n.fillStyle,c=R(n),l,u,d,f;if((t.bitmap||t.data)&&t.count>1){let n=t.bitmap||t.data.buffer;u=JSON.stringify(o?c:[c.slice(0,4),s]),l=this._cachedBitmapsMap.getOrInsertComputed(n,me);let r=l.get(u);if(r&&!o){let t=Math.round(Math.min(c[0],c[2])+c[4]),n=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(e,q.transformAndFill),{canvas:r,offsetX:t,offsetY:n}}d=r}d||(f=this.canvasFactory.create(i,a),Sn(f.context,t));let p=I.transform(c,[1/i,0,0,-1/a,0,0]);p=I.transform(p,[1,0,0,1,0,-a]);let m=r.slice();I.axialAlignedBoundingBox([0,0,i,a],p,m);let[h,g,_,v]=m,y=Math.round(_-h)||1,b=Math.round(v-g)||1,x=this.canvasFactory.create(y,b),S=x.context,C=h,w=g;S.translate(-C,-w),S.transform(...p);let T=null;if(!d){let e=this._scaleImage(f.canvas,xe(S));d=e.img,T=e.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),l&&o&&(l.set(u,d),T=null,f=null)}S.imageSmoothingEnabled=On(R(S),t.interpolate,this.pixelRatio),yn(S,d,0,0,d.width,d.height,0,0,i,a),T&&this.canvasFactory.destroy(T),f&&this.canvasFactory.destroy(f),S.globalCompositeOperation=`source-in`;let E=I.transform(xe(S),[1,0,0,1,-C,-w]);return S.fillStyle=o?s.getPattern(n,this,E,J.FILL,e):s,S.fillRect(0,0,i,a),l&&!o&&l.set(u,x.canvas),this.dependencyTracker?.recordDependencies(e,q.transformAndFill),{canvas:x.canvas,canvasEntry:l&&!o?null:x,offsetX:Math.round(C),offsetY:Math.round(w)}}setLineWidth(e,t){this.dependencyTracker?.recordSimpleData(`lineWidth`,e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){this.dependencyTracker?.recordSimpleData(`lineCap`,e),this.ctx.lineCap=kn[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData(`lineJoin`,e),this.ctx.lineJoin=An[t]}setMiterLimit(e,t){this.dependencyTracker?.recordSimpleData(`miterLimit`,e),this.ctx.miterLimit=t}setDash(e,t,n){this.dependencyTracker?.recordSimpleData(`dash`,e);let r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(t),r.lineDashOffset=n)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){for(let[n,r]of t)switch(n){case`LW`:this.setLineWidth(e,r);break;case`LC`:this.setLineCap(e,r);break;case`LJ`:this.setLineJoin(e,r);break;case`ML`:this.setMiterLimit(e,r);break;case`D`:this.setDash(e,r[0],r[1]);break;case`RI`:this.setRenderingIntent(e,r);break;case`FL`:this.setFlatness(e,r);break;case`Font`:this.setFont(e,r[0],r[1]);break;case`CA`:this.dependencyTracker?.recordSimpleData(`strokeAlpha`,e),this.current.strokeAlpha=r;break;case`ca`:this.dependencyTracker?.recordSimpleData(`fillAlpha`,e),this.ctx.globalAlpha=this.current.fillAlpha=r;break;case`BM`:this.dependencyTracker?.recordSimpleData(`globalCompositeOperation`,e),this.ctx.globalCompositeOperation=r;break;case`SMask`:this.dependencyTracker?.recordSimpleData(`SMask`,e),this.current.activeSMask=r?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case`TR`:{this.dependencyTracker?.recordSimpleData(`filter`,e);let t=this.filterFactory.addFilter(r);this.ctx.filter=t;let n=null;r&&(t===`none`||!F.isCanvasFilterSupported||this.ctx.filter===`none`||this.ctx.filter===``)&&(this.ctx.filter=t=`none`,n=new Dn(r)),this.current.transferMaps=t,(n||this.current.transferMapsFallback)&&(this.current.transferMapsFallback=n,this.current.patternFill||(this.ctx.fillStyle=this.#x(this.current.fillColor)),this.current.patternStroke||(this.ctx.strokeStyle=this.#x(this.current.strokeColor)));break}}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&=(this.canvasFactory.destroy(this.smaskPreparedEntry),null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e))}checkSMaskState(e){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){let{canvas:t,subtype:n,backdrop:r,transferMap:i}=e,a=n===`Luminosity`||n===`Alpha`&&i;if(!a&&!(n===`Luminosity`&&r)){this.smaskPreparedFor=e;return}let o;if(n===`Luminosity`&&r){let[e,t,n]=ye(r),a=Math.round(.3*e+.59*t+.11*n);o=i?.[a]??a}else o=i?.[0]??0;let{width:s,height:c}=this.ctx.canvas,l=t.width*t.height,u=s*c<4*l,d=a?{url:n===`Alpha`?this.filterFactory.addAlphaFilter(i):this.filterFactory.addLuminosityFilter(i),subtype:n,transferMap:i}:null,f=n===`Luminosity`?r:null,p,m,h;u?(p=this._bakeSMaskCanvas(t,e.offsetX,e.offsetY,s,c,f,d),m=0,h=0):(p=this._bakeSMaskCanvas(t,0,0,t.width,t.height,f,d),m=e.offsetX,h=e.offsetY),this.smaskPreparedEntry=p,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=m,this.smaskPreparedOffsetY=h,this.smaskPreparedOOBAlpha=!u&&o!==0?o:null}_bakeSMaskCanvas(e,t,n,r,i,a,o){!a&&!o&&E(`_bakeSMaskCanvas with neither backdrop nor filter`);let s=this.canvasFactory.create(r,i),c=s.context;if(c.drawImage(e,t,n),a&&(c.globalCompositeOperation=`destination-atop`,c.fillStyle=a,c.fillRect(0,0,r,i)),!o)return s;let l=this.canvasFactory.create(r,i),u=l.context;u.filter=o.url;let d=F.isCanvasFilterSupported&&u.filter!==`none`&&u.filter!==``;if(u.drawImage(s.canvas,0,0),F.isCanvasFilterSupported&&(u.filter=`none`),!d){let e=u.getImageData(0,0,r,i),{data:t}=e,{transferMap:n}=o;if(o.subtype===`Luminosity`)for(let e=0,r=t.length;eo.measureText(t))),(d===p.STROKE||d===p.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t)).recordDependencies(e,q.stroke),o.strokeText(t,n,r));f&&((this.pendingTextPaths||=[]).push({transform:R(o),x:n,y:r,fontSize:u,path:g}),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r))}get isFontSubpixelAAEnabled(){let e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1),t.fillText(`I`,0,10);let n=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let r=!1;for(let e=3;et?l/t:1,o=c>t?c/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,n){let{ctx:r,current:{lineWidth:i}}=this,[a,o]=this.getScaleForStroking();if(a===o){r.lineWidth=(i||1)*a,r.stroke(t);return}let s=e.#e??=new DOMMatrix,c=r.getLineDash();n&&r.save(),r.scale(a,o),s.a=1/a,s.d=1/o;let l=new Path2D;if(l.addPath(t,s),c.length>0){let e=Math.max(a,o);r.setLineDash(c.map(t=>t/e)),r.lineDashOffset/=e}r.lineWidth=i||1,r.stroke(l),n&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};for(let e in v)Nn.prototype[e]!==void 0&&(Nn.prototype[v[e]]=Nn.prototype[e]);var Pn=class extends Lt{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},Fn=class extends Rt{#e;#t;#n;#r;#i;#a;#o=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#i=t}get#s(){return this.#t||=new Map}get#c(){return this.#a||=new Map}get#l(){if(!this.#n){let e=this.#i.createElement(`div`),{style:t}=e;t.colorScheme=`only light`,t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#i.createElementNS(a,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#n=this.#i.createElementNS(a,`defs`),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#u(e){let t=e=>e&&Array.from(e,e=>e/255).join(`,`);if(e.length===1){let n=t(e[0]);return[n,n,n]}let[n,r,i]=e;return[t(n),t(r),t(i)]}#d(e){if(this.#e===void 0){this.#e=``;let e=this.#i.URL;e!==this.#i.baseURI&&(Ie(e)?T(`#createUrl: ignore "data:"-URL for performance reasons.`):this.#e=A(e,``))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return`none`;let t=this.#s.get(e);if(t)return t;let[n,r,i]=this.#u(e),a=e.length===1?n:`${n}${r}${i}`;if(t=this.#s.get(a),t)return this.#s.set(e,t),t;let o=`g_${this.#r}_transfer_map_${this.#o++}`,s=this.#d(o);this.#s.set(e,s),this.#s.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`,r=`base`,i=this.#c.get(r);if(i?.key===n||(i?(i.filter?.remove(),i.key=n,i.url=`none`,i.filter=null):(i={key:n,url:`none`,filter:null},this.#c.set(r,i)),!e||!t))return i.url;let a=this.#v(e);e=I.makeHexColor(...a);let o=this.#v(t);if(t=I.makeHexColor(...o),this.#b(),e===`#000000`&&t===`#ffffff`||e===t)return i.url;let s=Array.from({length:256},(e,t)=>Te(t/255)).join(`,`),c=`g_${this.#r}_hcm_filter`,l=i.filter=this.#m(c);this.#g(s,s,s,l),this.#p(l);let u=(e,t)=>{let n=a[e]/255,r=o[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return this.#g(u(0,5),u(1,5),u(2,5),l),i.url=this.#d(c),i.url}addSelectionHCMFilter(e,t){return this.addHighlightHCMFilter(`selection`,e,t,`HighlightText`,`Highlight`)}addSelectionFilter(){return this.addHighlightHCMFilter(`selection_default`,`black`,`white`,`HighlightText`,`Highlight`)}createSelectionStyle(e=null){let t=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return t===`none`||!F.platform.isFirefox?null:{"backdrop-filter":t,"background-color":`transparent`}}addAlphaFilter(e){let t=this.#s.get(e);if(t)return t;let[n]=this.#u([e]),r=`alpha_${n}`;if(t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_alpha_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#_(n,o),a}addLuminosityFilter(e){let t=this.#s.get(e||`luminosity`);if(t)return t;let n,r;if(e?([n]=this.#u([e]),r=`luminosity_${n}`):r=`luminosity`,t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_luminosity_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#f(o),e&&this.#_(n,o),a}addKnockoutFilter(e=0){let t=e>0?Math.min(1/e,1e6):1e6,n=`knockout_${t}`,r=this.#s.get(n);if(r)return r;let i=`g_${this.#r}_knockout_filter_${this.#o++}`,o=this.#d(i);this.#s.set(n,o);let s=this.#m(i),c=this.#i.createElementNS(a,`feComponentTransfer`);s.append(c);let l=this.#i.createElementNS(a,`feFuncA`);return l.setAttribute(`type`,`linear`),l.setAttribute(`slope`,`${t}`),l.setAttribute(`intercept`,`0`),c.append(l),o}addHighlightHCMFilter(e,t,n,r,i){let a=`${t}-${n}-${r}-${i}`,o=this.#c.get(e);if(o?.key===a||(o?(o.filter?.remove(),o.key=a,o.url=`none`,o.filter=null):(o={key:a,url:`none`,filter:null},this.#c.set(e,o)),!t||!n))return o.url;let[s,c]=[t,n].map(this.#v.bind(this)),l=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[r,i].map(this.#x.bind(this));u=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#v(n),n.join(` `)}#_(){let[e,t,n,r]=this.#e,[i,a,o,s]=this.#g();return`M${(this.#a[2]-e)/n} ${(this.#a[3]-t)/r} L${(this.#a[4]-e)/n} ${(this.#a[5]-t)/r} L${i} ${a} L${o} ${s} L${(this.#a[16]-e)/n} ${(this.#a[17]-t)/r} L${(this.#a[14]-e)/n} ${(this.#a[15]-t)/r} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,r,i]=this.#e,a=this.#a.subarray(4,6),o=this.#a.subarray(16,18),[s,c,l,u]=this.#g();e.push(`L${(a[0]-t)/r} ${(a[1]-n)/i} L${s} ${c} L${l} ${u} L${(o[0]-t)/r} ${(o[1]-n)/i}`)}newFreeDrawOutline(e,t,n,r,i,a){return new Xi(e,t,n,r,i,a)}getOutlines(){let e=this.#i,t=this.#t,n=this.#a,[r,i,a,o]=this.#e,s=new Float32Array((this.#f?.length??0)+2);for(let e=0,t=s.length-2;e
`),ut=e(``),dt=e(``),ft=e(`
`),ut=e(``),dt=e(``),ft=e(`
`:``+(n?i:wi(i,!0))+`
`}blockquote({tokens:e}){return``+(n?i:wi(i,!0))+`
@@ -71,6 +71,7 @@ ${this.parser.parse(e)}
`}tablerow({text:e}){return`
${e}
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`${n}>
-`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${wi(e,!0)}`}br(e){return`
`}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?wi(n,!0):this.parser.parseInline(r),o=Ei(e);if(o===null)return a;e=wi(o,i);let s=``+a+``,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ei(e);if(i===null)return wi(n);e=i;let a=``,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:wi(e.text)}},Gi=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return``}checkbox({raw:e}){return e}},Ki=class e{options;renderer;textRenderer;constructor(e){this.options=e||tr,this.options.renderer=this.options.renderer||new Wi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Gi,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n
`+wi(n.message+``,!0)+`
`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return Yi.parse(e,t)}$.options=$.setOptions=function(e){return Yi.setOptions(e),$.defaults=Yi.defaults,nr($.defaults),$},$.getDefaults=er,$.defaults=tr;function Xi(...e){return Yi.use(...e),$.defaults=Yi.defaults,nr($.defaults),$}$.use=Xi,$.walkTokens=function(e,t){return Yi.walkTokens(e,t)},$.parseInline=Yi.parseInline,$.Parser=Ki,$.parser=Ki.parse,$.Renderer=Wi,$.TextRenderer=Gi,$.Lexer=Ui,$.lexer=Ui.lex,$.Tokenizer=Hi,$.Hooks=qi,$.parse=$,$.options,$.setOptions,$.walkTokens,$.parseInline,Ki.parse,Ui.lex;function Zi(e){return Bn.sanitize($.parse(e,{async:!1,breaks:!0,gfm:!0}))}function Qi(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}var $i=e(``);function ea(e,t){i(t,!0);let n=_(null),r=_(null),a=_(null),o=typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null,l=o?.closest(`.thread`),f=o?.closest(`.timeline`),h=l?.querySelector(`[aria-label="Reply body"]:not(:disabled)`)??l?.querySelector(`[aria-label="Close thread"]`)??f?.querySelector(`[aria-label="Message body"]:not(:disabled)`)??f?.querySelector(`[aria-label="Search messages"]`)??(typeof document<`u`?document.querySelector(`[aria-label="Reply body"]:not(:disabled)`)??document.querySelector(`[aria-label="Message body"]:not(:disabled)`)??document.querySelector(`[aria-label="Close thread"]`)??document.querySelector(`[aria-label="Search messages"]`):null),g=new Set;c(()=>{let e=m(n)?.parentElement;if(e)for(let t of e.children)t instanceof HTMLElement&&t!==m(n)&&!t.inert&&(t.inert=!0,g.add(t));m(a)?.focus({preventScroll:!0})}),w(()=>{for(let e of g)e.inert=!1;g.clear(),!(o?.isConnected&&o!==document.body&&(o.focus({preventScroll:!0}),document.activeElement===o))&&h?.isConnected&&h.focus({preventScroll:!0})});function y(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.onClose();return}if(e.key!==`Tab`||!m(r))return;let n=Array.from(m(r).querySelectorAll(`a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.inert&&e.getClientRects().length>0);if(n.length===0){e.preventDefault(),m(r).focus();return}let i=n[0],a=n[n.length-1];e.shiftKey&&(document.activeElement===i||!m(r).contains(document.activeElement))?(e.preventDefault(),a.focus()):!e.shiftKey&&(document.activeElement===a||!m(r).contains(document.activeElement))&&(e.preventDefault(),i.focus())}var b=$i(),T=A(b),D=S(T,2),O=A(D),ee=A(O),j=C(ee,!0),te=S(ee,2),ne=A(te),re=S(ne,2);k(re,e=>N(a,e),()=>m(a)),E(te),E(O);var M=S(O,2),ie=C(M);E(D),k(D,e=>N(r,e),()=>m(r)),E(b),k(b,e=>N(n,e),()=>m(n)),v(()=>{x(D,`aria-label`,`Image viewer: ${t.title}`),s(j,t.title),x(ne,`href`,t.url),x(ie,`src`,t.url),x(ie,`alt`,t.title)}),p(`click`,T,function(...e){t.onClose?.apply(this,e)}),p(`keydown`,D,y),p(`click`,re,function(...e){t.onClose?.apply(this,e)}),u(e,b),d()}f([`click`,`keydown`]);var ta=e(``);function na(e,t){let n=j(t,`size`,3,44),r=j(t,`class`,3,``);var i=ta();v(()=>{M(i,1,`keystroke-mark ${r()??``}`,`svelte-1bx7eka`),te(i,`--keystroke-size: ${n()??``}px`)}),u(e,i)}var ra=e(`Copy message link
${wi(e,!0)}`}br(e){return`
`}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?wi(n,!0):this.parser.parseInline(r),o=Ei(e);if(o===null)return a;e=wi(o,i);let s=``+a+``,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ei(e);if(i===null)return wi(n);e=i;let a=``,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:wi(e.text)}},Gi=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return`
+`}checkbox({raw:e}){return e}},Ki=class e{options;renderer;textRenderer;constructor(e){this.options=e||tr,this.options.renderer=this.options.renderer||new Wi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Gi,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n
`+wi(n.message+``,!0)+`
`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return Yi.parse(e,t)}$.options=$.setOptions=function(e){return Yi.setOptions(e),$.defaults=Yi.defaults,nr($.defaults),$},$.getDefaults=er,$.defaults=tr;function Xi(...e){return Yi.use(...e),$.defaults=Yi.defaults,nr($.defaults),$}$.use=Xi,$.walkTokens=function(e,t){return Yi.walkTokens(e,t)},$.parseInline=Yi.parseInline,$.Parser=Ki,$.parser=Ki.parse,$.Renderer=Wi,$.TextRenderer=Gi,$.Lexer=Ui,$.lexer=Ui.lex,$.Tokenizer=Hi,$.Hooks=qi,$.parse=$,$.options,$.setOptions,$.walkTokens,$.parseInline,Ki.parse,Ui.lex;function Zi(e){return Bn.sanitize($.parse(e,{async:!1,breaks:!0,gfm:!0}))}function Qi(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e))}var $i=e(``);function ea(e,t){i(t,!0);let n=_(null),r=_(null),a=_(null),o=typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null,l=o?.closest(`.thread`),f=o?.closest(`.timeline`),h=l?.querySelector(`[aria-label="Reply body"]:not(:disabled)`)??l?.querySelector(`[aria-label="Close thread"]`)??f?.querySelector(`[aria-label="Message body"]:not(:disabled)`)??f?.querySelector(`[aria-label="Search messages"]`)??(typeof document<`u`?document.querySelector(`[aria-label="Reply body"]:not(:disabled)`)??document.querySelector(`[aria-label="Message body"]:not(:disabled)`)??document.querySelector(`[aria-label="Close thread"]`)??document.querySelector(`[aria-label="Search messages"]`):null),g=new Set;c(()=>{let e=m(n)?.parentElement;if(e)for(let t of e.children)t instanceof HTMLElement&&t!==m(n)&&!t.inert&&(t.inert=!0,g.add(t));m(a)?.focus({preventScroll:!0})}),w(()=>{for(let e of g)e.inert=!1;g.clear(),o?.isConnected&&o!==document.body&&(o.focus({preventScroll:!0}),document.activeElement===o)||h?.isConnected&&h.focus({preventScroll:!0})});function y(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.onClose();return}if(e.key!==`Tab`||!m(r))return;let n=Array.from(m(r).querySelectorAll(`a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.inert&&e.getClientRects().length>0);if(n.length===0){e.preventDefault(),m(r).focus();return}let i=n[0],a=n[n.length-1];e.shiftKey&&(document.activeElement===i||!m(r).contains(document.activeElement))?(e.preventDefault(),a.focus()):e.shiftKey||document.activeElement!==a&&m(r).contains(document.activeElement)||(e.preventDefault(),i.focus())}var b=$i(),T=A(b),D=S(T,2),O=A(D),ee=A(O),j=C(ee,!0),te=S(ee,2),ne=A(te),re=S(ne,2);k(re,e=>N(a,e),()=>m(a)),E(te),E(O);var M=S(O,2),ie=C(M);E(D),k(D,e=>N(r,e),()=>m(r)),E(b),k(b,e=>N(n,e),()=>m(n)),v(()=>{x(D,`aria-label`,`Image viewer: ${t.title}`),s(j,t.title),x(ne,`href`,t.url),x(ie,`src`,t.url),x(ie,`alt`,t.title)}),p(`click`,T,function(...e){t.onClose?.apply(this,e)}),p(`keydown`,D,y),p(`click`,re,function(...e){t.onClose?.apply(this,e)}),u(e,b),d()}f([`click`,`keydown`]);var ta=e(``);function na(e,t){let n=j(t,`size`,3,44),r=j(t,`class`,3,``);var i=ta();v(()=>{M(i,1,`keystroke-mark ${r()??``}`,`svelte-1bx7eka`),te(i,`--keystroke-size: ${n()??``}px`)}),u(e,i)}var ra=e(`Copy message link
gn&&typeof r==`function`,d=u?Date.now()+hn:0,f=0,p=this.commonObjs,m=this.objs,h,g;for(;;){if(a!==void 0){if(e===a.nextBreakPoint)return a.breakIt(e,r),e;if(a.shouldSkip(e)){if(++e===l)return e;continue}}if(!o||o(e,t)){if(h=c[e],g=s[e]??null,h!==_.dependency)g===null?this[h](e):this[h](e,...g);else for(let t of g){this.dependencyTracker?.recordNamedData(t,e);let n=t.startsWith(`g_`)?p:m;if(!n.has(t))return n.get(t,r,i),e}}if(e++,e===l)return e;if(u&&++f>gn){if(Date.now()>d)return r(),e;f=0}}}finally{this._pathCache=l}}#f(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){this.#f();for(let e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(let e of this.#d)this.#C(e);this.#d.length=0,this.#i=null,this.#a=null,this.#o=null,this.#s=null,this.#c=1,this.#u=null,this.#r=0,this.#n=0,this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#p()}#p(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!==`none`){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width??e.displayWidth,r=e.height??e.displayHeight,i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=[],s=i,c=a,l=n,u=r;for(;s>2&&l>1||c>2&&u>1;){let e=l,t=u;s>2&&l>1&&(e=Math.ceil(l/2),s/=l/e),c>2&&u>1&&(t=Math.ceil(u/2),c/=u/t),o.push({newWidth:e,newHeight:t}),l=e,u=t}if(o.length===0)return{img:e,paintWidth:n,paintHeight:r,tmpCanvas:null};if(o.length===1){let{newWidth:t,newHeight:i}=o[0],a=this.canvasFactory.create(t,i);return a.context.drawImage(e,0,0,n,r,0,0,t,i),{img:a.canvas,paintWidth:t,paintHeight:i,tmpCanvas:a}}let d=this.canvasFactory.create(1,1),f=this.canvasFactory.create(1,1),p=n,m=r,h=e;for(let{newWidth:e,newHeight:t}of o)this.canvasFactory.reset(f,e,t),f.context.drawImage(h,0,0,p,m,0,0,e,t),[d,f]=[f,d],h=d.canvas,p=e,m=t;return this.canvasFactory.destroy(f),{img:d.canvas,paintWidth:p,paintHeight:m,tmpCanvas:d}}_createMaskCanvas(e,t){let r=this.ctx,{width:i,height:a}=t,o=this.current.patternFill,s=o?this.current.fillColor:r.fillStyle,c=R(r),l,u,d,f;if((t.bitmap||t.data)&&t.count>1){let n=t.bitmap||t.data.buffer;u=JSON.stringify(o?c:[c.slice(0,4),s]),l=this._cachedBitmapsMap.getOrInsertComputed(n,pe);let r=l.get(u);if(r&&!o){let t=Math.round(Math.min(c[0],c[2])+c[4]),n=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(e,q.transformAndFill),{canvas:r,offsetX:t,offsetY:n}}d=r}d||(f=this.canvasFactory.create(i,a),xn(f.context,t));let p=I.transform(c,[1/i,0,0,-1/a,0,0]);p=I.transform(p,[1,0,0,1,0,-a]);let m=n.slice();I.axialAlignedBoundingBox([0,0,i,a],p,m);let[h,g,_,v]=m,y=Math.round(_-h)||1,b=Math.round(v-g)||1,x=this.canvasFactory.create(y,b),S=x.context,C=h,w=g;S.translate(-C,-w),S.transform(...p);let T=null;if(!d){let e=this._scaleImage(f.canvas,be(S));d=e.img,T=e.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),l&&o&&(l.set(u,d),T=null,f=null)}S.imageSmoothingEnabled=Dn(R(S),t.interpolate,this.pixelRatio),vn(S,d,0,0,d.width,d.height,0,0,i,a),T&&this.canvasFactory.destroy(T),f&&this.canvasFactory.destroy(f),S.globalCompositeOperation=`source-in`;let E=I.transform(be(S),[1,0,0,1,-C,-w]);return S.fillStyle=o?s.getPattern(r,this,E,J.FILL,e):s,S.fillRect(0,0,i,a),l&&!o&&l.set(u,x.canvas),this.dependencyTracker?.recordDependencies(e,q.transformAndFill),{canvas:x.canvas,canvasEntry:l&&!o?null:x,offsetX:Math.round(C),offsetY:Math.round(w)}}setLineWidth(e,t){this.dependencyTracker?.recordSimpleData(`lineWidth`,e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){this.dependencyTracker?.recordSimpleData(`lineCap`,e),this.ctx.lineCap=On[t]}setLineJoin(e,t){this.dependencyTracker?.recordSimpleData(`lineJoin`,e),this.ctx.lineJoin=kn[t]}setMiterLimit(e,t){this.dependencyTracker?.recordSimpleData(`miterLimit`,e),this.ctx.miterLimit=t}setDash(e,t,n){this.dependencyTracker?.recordSimpleData(`dash`,e);let r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(t),r.lineDashOffset=n)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){for(let[n,r]of t)switch(n){case`LW`:this.setLineWidth(e,r);break;case`LC`:this.setLineCap(e,r);break;case`LJ`:this.setLineJoin(e,r);break;case`ML`:this.setMiterLimit(e,r);break;case`D`:this.setDash(e,r[0],r[1]);break;case`RI`:this.setRenderingIntent(e,r);break;case`FL`:this.setFlatness(e,r);break;case`Font`:this.setFont(e,r[0],r[1]);break;case`CA`:this.dependencyTracker?.recordSimpleData(`strokeAlpha`,e),this.current.strokeAlpha=r;break;case`ca`:this.dependencyTracker?.recordSimpleData(`fillAlpha`,e),this.ctx.globalAlpha=this.current.fillAlpha=r;break;case`BM`:this.dependencyTracker?.recordSimpleData(`globalCompositeOperation`,e),this.ctx.globalCompositeOperation=r;break;case`SMask`:this.dependencyTracker?.recordSimpleData(`SMask`,e),this.current.activeSMask=r?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case`TR`:{this.dependencyTracker?.recordSimpleData(`filter`,e);let t=this.filterFactory.addFilter(r);this.ctx.filter=t;let n=null;r&&(t===`none`||!F.isCanvasFilterSupported||this.ctx.filter===`none`||this.ctx.filter===``)&&(this.ctx.filter=t=`none`,n=new En(r)),this.current.transferMaps=t,(n||this.current.transferMapsFallback)&&(this.current.transferMapsFallback=n,this.current.patternFill||(this.ctx.fillStyle=this.#x(this.current.fillColor)),this.current.patternStroke||(this.ctx.strokeStyle=this.#x(this.current.strokeColor)));break}}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&=(this.canvasFactory.destroy(this.smaskPreparedEntry),null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e))}checkSMaskState(e){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){let{canvas:t,subtype:n,backdrop:r,transferMap:i}=e,a=n===`Luminosity`||n===`Alpha`&&i;if(!a&&!(n===`Luminosity`&&r)){this.smaskPreparedFor=e;return}let o;if(n===`Luminosity`&&r){let[e,t,n]=ve(r),a=Math.round(.3*e+.59*t+.11*n);o=i?.[a]??a}else o=i?.[0]??0;let{width:s,height:c}=this.ctx.canvas,l=t.width*t.height,u=s*c<4*l,d=a?{url:n===`Alpha`?this.filterFactory.addAlphaFilter(i):this.filterFactory.addLuminosityFilter(i),subtype:n,transferMap:i}:null,f=n===`Luminosity`?r:null,p,m,h;u?(p=this._bakeSMaskCanvas(t,e.offsetX,e.offsetY,s,c,f,d),m=0,h=0):(p=this._bakeSMaskCanvas(t,0,0,t.width,t.height,f,d),m=e.offsetX,h=e.offsetY),this.smaskPreparedEntry=p,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=m,this.smaskPreparedOffsetY=h,this.smaskPreparedOOBAlpha=!u&&o!==0?o:null}_bakeSMaskCanvas(e,t,n,r,i,a,o){!a&&!o&&T(`_bakeSMaskCanvas with neither backdrop nor filter`);let s=this.canvasFactory.create(r,i),c=s.context;if(c.drawImage(e,t,n),a&&(c.globalCompositeOperation=`destination-atop`,c.fillStyle=a,c.fillRect(0,0,r,i)),!o)return s;let l=this.canvasFactory.create(r,i),u=l.context;u.filter=o.url;let d=F.isCanvasFilterSupported&&u.filter!==`none`&&u.filter!==``;if(u.drawImage(s.canvas,0,0),F.isCanvasFilterSupported&&(u.filter=`none`),!d){let e=u.getImageData(0,0,r,i),{data:t}=e,{transferMap:n}=o;if(o.subtype===`Luminosity`)for(let e=0,r=t.length;eo.measureText(t))),(d===f.STROKE||d===f.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r,()=>o.measureText(t)).recordDependencies(e,q.stroke),o.strokeText(t,n,r));p&&((this.pendingTextPaths||=[]).push({transform:R(o),x:n,y:r,fontSize:u,path:g}),this.dependencyTracker?.recordCharacterBBox(e,o,c,u,n,r))}get isFontSubpixelAAEnabled(){let e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1),t.fillText(`I`,0,10);let n=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let r=!1;for(let e=3;et?l/t:1,o=c>t?c/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,n){let{ctx:r,current:{lineWidth:i}}=this,[a,o]=this.getScaleForStroking();if(a===o){r.lineWidth=(i||1)*a,r.stroke(t);return}let s=e.#e??=new DOMMatrix,c=r.getLineDash();n&&r.save(),r.scale(a,o),s.a=1/a,s.d=1/o;let l=new Path2D;if(l.addPath(t,s),c.length>0){let e=Math.max(a,o);r.setLineDash(c.map(t=>t/e)),r.lineDashOffset/=e}r.lineWidth=i||1,r.stroke(l),n&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};for(let e in _)Mn.prototype[e]!==void 0&&(Mn.prototype[_[e]]=Mn.prototype[e]);var Nn=class extends It{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},Pn=class extends Lt{#e;#t;#n;#r;#i;#a;#o=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#r=e,this.#i=t}get#s(){return this.#t||=new Map}get#c(){return this.#a||=new Map}get#l(){if(!this.#n){let e=this.#i.createElement(`div`),{style:t}=e;t.colorScheme=`only light`,t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#i.createElementNS(i,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#n=this.#i.createElementNS(i,`defs`),e.append(n),n.append(this.#n),this.#i.body.append(e)}return this.#n}#u(e){let t=e=>e&&Array.from(e,e=>e/255).join(`,`);if(e.length===1){let n=t(e[0]);return[n,n,n]}let[n,r,i]=e;return[t(n),t(r),t(i)]}#d(e){if(this.#e===void 0){this.#e=``;let e=this.#i.URL;e!==this.#i.baseURI&&(Fe(e)?w(`#createUrl: ignore "data:"-URL for performance reasons.`):this.#e=k(e,``))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return`none`;let t=this.#s.get(e);if(t)return t;let[n,r,i]=this.#u(e),a=e.length===1?n:`${n}${r}${i}`;if(t=this.#s.get(a),t)return this.#s.set(e,t),t;let o=`g_${this.#r}_transfer_map_${this.#o++}`,s=this.#d(o);this.#s.set(e,s),this.#s.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`,r=`base`,i=this.#c.get(r);if(i?.key===n||(i?(i.filter?.remove(),i.key=n,i.url=`none`,i.filter=null):(i={key:n,url:`none`,filter:null},this.#c.set(r,i)),!e||!t))return i.url;let a=this.#v(e);e=I.makeHexColor(...a);let o=this.#v(t);if(t=I.makeHexColor(...o),this.#b(),e===`#000000`&&t===`#ffffff`||e===t)return i.url;let s=Array.from({length:256},(e,t)=>we(t/255)).join(`,`),c=`g_${this.#r}_hcm_filter`,l=i.filter=this.#m(c);this.#g(s,s,s,l),this.#p(l);let u=(e,t)=>{let n=a[e]/255,r=o[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return this.#g(u(0,5),u(1,5),u(2,5),l),i.url=this.#d(c),i.url}addSelectionHCMFilter(e,t){return this.addHighlightHCMFilter(`selection`,e,t,`HighlightText`,`Highlight`)}addSelectionFilter(){return this.addHighlightHCMFilter(`selection_default`,`black`,`white`,`HighlightText`,`Highlight`)}createSelectionStyle(e=null){let t=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return t===`none`||!F.platform.isFirefox?null:{"backdrop-filter":t,"background-color":`transparent`}}addAlphaFilter(e){let t=this.#s.get(e);if(t)return t;let[n]=this.#u([e]),r=`alpha_${n}`;if(t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_alpha_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#_(n,o),a}addLuminosityFilter(e){let t=this.#s.get(e||`luminosity`);if(t)return t;let n,r;if(e?([n]=this.#u([e]),r=`luminosity_${n}`):r=`luminosity`,t=this.#s.get(r),t)return this.#s.set(e,t),t;let i=`g_${this.#r}_luminosity_map_${this.#o++}`,a=this.#d(i);this.#s.set(e,a),this.#s.set(r,a);let o=this.#m(i);return this.#f(o),e&&this.#_(n,o),a}addKnockoutFilter(e=0){let t=e>0?Math.min(1/e,1e6):1e6,n=`knockout_${t}`,r=this.#s.get(n);if(r)return r;let a=`g_${this.#r}_knockout_filter_${this.#o++}`,o=this.#d(a);this.#s.set(n,o);let s=this.#m(a),c=this.#i.createElementNS(i,`feComponentTransfer`);s.append(c);let l=this.#i.createElementNS(i,`feFuncA`);return l.setAttribute(`type`,`linear`),l.setAttribute(`slope`,`${t}`),l.setAttribute(`intercept`,`0`),c.append(l),o}addHighlightHCMFilter(e,t,n,r,i){let a=`${t}-${n}-${r}-${i}`,o=this.#c.get(e);if(o?.key===a||(o?(o.filter?.remove(),o.key=a,o.url=`none`,o.filter=null):(o={key:a,url:`none`,filter:null},this.#c.set(e,o)),!t||!n))return o.url;let[s,c]=[t,n].map(this.#v.bind(this)),l=Math.round(.2126*s[0]+.7152*s[1]+.0722*s[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[d,f]=[r,i].map(this.#x.bind(this));u=6;e-=6)isNaN(t[e])?n.push(`L${t[e+4]} ${t[e+5]}`):n.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return this.#v(n),n.join(` `)}#_(){let[e,t,n,r]=this.#e,[i,a,o,s]=this.#g();return`M${(this.#a[2]-e)/n} ${(this.#a[3]-t)/r} L${(this.#a[4]-e)/n} ${(this.#a[5]-t)/r} L${i} ${a} L${o} ${s} L${(this.#a[16]-e)/n} ${(this.#a[17]-t)/r} L${(this.#a[14]-e)/n} ${(this.#a[15]-t)/r} Z`}#v(e){let t=this.#t;e.push(`L${t[4]} ${t[5]} Z`)}#y(e){let[t,n,r,i]=this.#e,a=this.#a.subarray(4,6),o=this.#a.subarray(16,18),[s,c,l,u]=this.#g();e.push(`L${(a[0]-t)/r} ${(a[1]-n)/i} L${s} ${c} L${l} ${u} L${(o[0]-t)/r} ${(o[1]-n)/i}`)}newFreeDrawOutline(e,t,n,r,i,a){return new Yi(e,t,n,r,i,a)}getOutlines(){let e=this.#i,t=this.#t,n=this.#a,[r,i,a,o]=this.#e,s=new Float32Array((this.#f?.length??0)+2);for(let e=0,t=s.length-2;e